using a column that references an object_id in your own table

Is it safe to use OBJECT_ID() as a reference in your own tables, with the assumption that the value will always refer to the same database object no matter what?

The msdn states

All metadata functions are nondeterministic. This means these functions do not always return the same results every time they are called, even with the same set of input values.

so that would indicate it’s not safe, but I couldn’t find any (other) hard facts that it shouldn’t be done, and, to be fair, no examples of people actually doing it, which in itself might be evidence not to do it.

But the value OBJECT_ID() is (or seems to be) used in the system tables and views as keys from one object to another, so there must be some form of integrity and reliability.

For the record: I don’t necessarily need it, but it just popped into my mind as an option while designing my system, and got curious.

Recurrence relation for the number of “references” to two mutually recursive function

I was going through the Dynamic Programming section of Introduction to Algorithms(2nd Edition) by Cormen et. al. where I came across the following recurrence relations in the assembly line scheduling portion.


$ (1),(2),(3)$ are three relations as shown.

$ $ f_{1}[j] = \begin{cases} e_1+a_{1,1} &\quad\text{if } j=1\ \min(f_1[j-1]+a_{1,j},f_2[j-1]+t_{2,j-1}+a_{1,j})&\quad\text{if} j\geq2\ \end{cases}\tag 1$ $

Symmetrically,

$ $ f_{2}[j] = \begin{cases} e_2+a_{2,1} &\quad\text{if } j=1\ \min(f_2[j-1]+a_{2,j},f_1[j-1]+t_{1,j-1}+a_{2,j})&\quad\text{if} j\geq2\ \end{cases}\tag 2$ $

(where $ e_i,a_{i,j},t_{2,j-1}$ are constants for $ i=1,2$ and $ j=1,2,3,…,n$ )

$ $ f^\star=\min(f_1[n]+x_1,f_2[n]+x_2)\tag 3$ $


The text tries to find the recurrence relation of the number of times $ f_i[j]$ ($ i=1,2$ and $ j=1,2,3,…,n$ ) is referenced if we write a mutual recursive code for $ f_1[j]$ and $ f_2[j]$ . Let $ r_i(j)$ denote the number of times $ f_i[j]$ is referenced.

They say that,

From $ (3)$ ,

$ $ r_1(n)=r_2(n)=1.\tag4$ $

From $ (1)$ and $ (2)$ ,

$ $ r_1(j)=r_2(j)=r_1(j+1)+r_2(j+1)\tag 5$ $


I could not quite understand how the relations of $ (4)$ and $ (5)$ are obtained from the three corresponding relations.

Thought I could make out intuitively that as there is only one place where $ f_1[n]$ and $ f_2[n]$ are called, which is in $ f^\star$ , so probably in $ (4)$ we get the required relation.

But as I had not encountered such concept before I do not quite know how to proceed. I would be grateful if someone guides me with the mathematical prove of the derivation as well as the intuition, however I would prefer an alternative to mathematical induction as it is a mechanical cookbook method without giving much insight into the problem though (but if in case there is no other way out, then I shall appreciate mathematical induction as well provided the intuition is explained to me properly).

Determine page number and offsets for address references

I’m working on learning operating systems and I’ve come across a strange question that I don’t know how to answer.

The question is:

Assuming a 1-KB page size, what are the page numbers and offsets for the following address references (provided as decimal numbers)?

21205

The notes and slides I have are very confusing and I can’t find anything quite like this from my searches. I understand that a 1KB page size means that it’s 2^10 but what do I do after that exactly? Most descriptions I see involve splitting that in half and using the first half as your offset and the other half as the page number but then I see others saying not to do this and my notes, as I mentioned, are useless. I’m sure this is extremely easy but I feel like I’ve been given only 1/3 of the knowledge needed.

Any help would be greatly appreciated!

Can I sell a supplement that references non-SRD Cleric Domains?

I am creating a completely unique setting for Dungeons & Dragons 5th Edition, and really pouring my heart and soul into it. Under Wizards of the Coast’s OGL (Open Gaming License), I am hoping to sell this setting as a supplement book (probably a downloadable PDF through DriveThruRPG).

However, I’m a little bit fuzzy on the differences between the OGL, and the SRD, and what I’m allowed to use vs. what I’m not in the context of a commercial product. Specifically, I was thinking of referencing some non-SRD cleric domains (the only SRD cleric domain, as far as I know, is Life), such as, say, the ones from the Player’s Handbook, in the context of locations that are tied to particular Domains. Would that be permissible? I don’t know if I’m allowed to use non-SRD domains in a commercial work. I wouldn’t be reproducing the actual Domains, in their specific mechanics, just referencing their existence.

Foreign key references on column definitions are ignored. Feature, not a bug — why?

Good old references constrains. They work like a charm when defined at the table level.

create table foo (id int primary key);  create table bar (id int, foreign key(id) references foo(id)); insert into bar values (1); -- ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (...) 

But if you come from another ecosystem and are used to occasionally define foreign key constrains at the column level, this is what happens:

create table baz (id int references foo(id)); insert into baz values (1); -- happily takes a value that isn't there in foo select id from baz; -- 1 

What happens is that the references has been recognized, but ignored.

It turns out that this is not a bug. The MySQL documentation says they do it, and that’s all you need to know:

MySQL parses but ignores “inline REFERENCES specifications” (as defined in the SQL standard) where the references are defined as part of the column specification. MySQL accepts REFERENCES clauses only when specified as part of a separate FOREIGN KEY specification.

The MariaDB documentation is slightly more verbose on their rationale:

MariaDB accepts the REFERENCES clause in ALTER TABLE and CREATE TABLE statements, but that syntax does nothing. MariaDB simply parses it without returning any error or warning, for compatibility with other DBMS’s. However, only the syntax described below creates foreign keys.

Now what could be the use for this “feature” that helps “compatibility” with other DBMS — and the standard — by silently breaking the very purpose of the reference, while at the same time, correctly implementing it does not look like a big effort since foreign key constrains are indeed enforced when declared at the table level? And don’t tell me this cannot be fixed because people rely on the fact that foreign constrains can be broken when declared at the column level.

Please help me make sense out of this.

Remove less secure ciphers from WHM by decrpyting different convoluted references to the same ciphers

I have previously removed less secure ciphers from WHM (Web Host Manager) however it has been a while and I want to learn how to fish, not be handed a fish.

The trouble seems to stem from the fact that there is little-to-no consistency in how ciphers are referenced or even where they are defined.

WHM Cipher Definitions

Ciphers seem to be listed in two places: Exim Configuration Manager and Apache Configuration ⇨ Exim Configuration Manager.

  • The Apache Configuration has a field “SSL/TLS Protocols” which is currently defined as ALL:!ADH:!AECDH:!EDH:!RC4:+HIGH:+MEDIUM:-LOW:-EXP.
  • The Exim Configuration Manager currently has a field “SSL/TLS Cipher Suite List” which is set to ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256.

Definition of Weak Ciphers

Here is the SSL Labs test for my domain. I have everything except TLS 1.2 and TLS 1.3 disabled and many less secure ciphers disabled. The test lists the following ciphers as being weak:

TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013) ECDH x25519 (eq. 3072 bits RSA) FS WEAK 128 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014) ECDH x25519 (eq. 3072 bits RSA) FS WEAK 256 TLS_RSA_WITH_AES_128_GCM_SHA256 (0x9c) WEAK 128 TLS_RSA_WITH_AES_256_GCM_SHA384 (0x9d) WEAK 256 TLS_RSA_WITH_AES_128_CBC_SHA (0x2f) WEAK 128 TLS_RSA_WITH_AES_256_CBC_SHA (0x35) WEAK 256 

I attempted to “translate” though after updating the values in both sections and running cPanel’s AutoSSL I still got the same results on the test.

Translating Cipher References

I attempted to reference the TLS 1.2 standard as well as some documentation from OpenSSL. I made numerous other search queries and spent hours reading through documentation, standards and forums without luck.

Here is my attempt to make the lists look more similar to each other:

From the Exim Configuration Manager:

  • ECDHE_ECDSA_CHACHA20_POLY1305
  • ECDHE_RSA_AES128_GCM_SHA256
  • ECDHE_RSA_AES256_GCM_SHA384
  • ECDHE_RSA_AES128_SHA256
  • ECDHE_RSA_AES256_SHA384
  • ECDHE_RSA_CHACHA20_POLY1305

From the SSL Labs Test to be removed:

  • ECDHE_RSA_WITH_AES_128_CBC_SHA
  • ECDHE_RSA_WITH_AES_256_CBC_SHA
  • RSA_WITH_AES_128_GCM_SHA256
  • RSA_WITH_AES_256_GCM_SHA384
  • RSA_WITH_AES_128_CBC_SHA
  • RSA_WITH_AES_256_CBC_SHA

The list says to remove two ECDHE and the rest don’t have ECDHE. In that example how do I remove something not defined? Secondly it suggests removing CBC though that is not defined in the first list.

Desirable Answer Format

Learning is the detection of patterns so I’m really looking for an answer with a table where column A lists the ciphers from the SSL Labs test and column B references how they are referenced (to be defined (for stronger ciphers) and disabled for weaker ciphers). Just enough that I can detect the pattern of how the test references the same ciphers as Apache (or whichever software directly handles all of this). A good reference URL with such a table (and where on the page if it’s more than just a few paragraphs) would be very helpful.

It would also be incredibly useful to know how to have the server define a preferred cipher and to know which is considered the strongest if possible please.

Traversing/comparing tree structures with only parent references

Consider a tree structure with nodes containing references to only their parent. So, the root node’s parent will be null. This tree represents a class hierarchy. The goal is to search such a tree for a particular subtree, and if it doesn’t exist, add it to the tree. Is there an algorithm that can be used to achieve this?

In this particular case, I have a C# WinForms application which uses this kind of structure. At the moment, an iterative breadth-first traversal is being used to traverse through such a tree and display it as a treeView. How this is being done is as follows: To represent the nodes of the tree itself, there is a class Data_Node. To perform the traversal, the nodes are placed into a queue. The queue contains instances of a data structure, QueueNode:

private class QueueNode {     public Model.Data_node dataNode; // actual tree node     public QueueNode parent; // reference to the parent     public TreeNode treeNode; // node for treeView in the UI } 

The next step is to implement another such tree (assume it is already, then check whether it is a subtree of the first one, and add it if it is not.

I have researched examples of what I am trying to achieve, but they were only for binary search trees, with nodes having references to the child nodes. In my case, the nodes only have references to the parent node.

Looking for some references on voting theory

After reading through this paper on optimizing the sum of sigmoid functions, http://www.web.stanford.edu/~boyd/papers/pdf/max_sum_sigmoids.pdf, I am interested in the problem addressed in section 7.3 (Political marketing example). Specifically I am interested in any work on the following problem.

Suppose there is a set of candidates $ C$ and set of voters $ V$ where each candidate $ c_i = <c_{i, 1}, …, c_{i, l}>$ , and each $ v_j = <v_{j, 1}, …, v_{j, l}>$ is a vector of real numbers over $ l$ issues. And voters have some logistic probability to vote for each candidate depending on how much the candidate and voter “agree” on each of the $ l$ issues, e.g. $ v_j$ votes for $ c_i$ with probability $ \phi\big(-(c_i \bullet v_j)\big)$ where $ \phi$ is just some sigmoidal function.

Assume all voters positions and all candidate positions are known and static, expect for $ c_1$ . The objective of the problem is to select the position on issues for $ c_1$ such that $ c_1$ has the highest probability of winning the plurality vote. That is select

$ $ \max_{c_1} \sum_{v_j} \phi\bigg(-(c_1 \bullet v_j)\bigg)$ $

The paper discuss a general method of solving this problem using a branch and bound technique (which has a nonpolynomial runtime) for sigmoidal programing problems. However, the paper, and the references, do not give a hardness proof of this specific voting problem, and the references do not appear to mention any other techniques for solving this problem.

Any literature addressing the hardness of this problem, or more specific techniques for this problem would be greatly appreciated.