Questions tagged [self-reference]

Self-reference is the ability of a program (or logical sentence) to refer to itself, either directly or indirectly.

Self-reference is the ability of a program (or logical sentence) to refer to itself, either directly or indirectly.

Useful Links:

Stanford Encyclopedia 'Self Reference' Entry

Related Tags:

596 questions
0
votes
1 answer

Postgres - with recursive - get parent name column

I have a table: CREATE TABLE cell ( cellpk serial NOT NULL, cellname character varying NOT NULL, parent integer NOT NULL, CONSTRAINT cellpk PRIMARY KEY (cellpk) ) cellA --> subcellA1 --> subsubcellA1 |--> subcellA2 --> subsubcellA2…
blue01
  • 2,035
  • 2
  • 23
  • 38
0
votes
1 answer

Rails self referrential associations, how to determine mutual intersection?

I want to have friends/followers mechanzm, so I've created following DB structure: user_id friend_id I want to know what's the easiest and simplest way to determine (Rails-way) that following users are mutual friends? user_id friend_id 1 …
user973254
0
votes
4 answers

SQL tricks: finding a value within a range across rows

I am using a database of exchange rates that has values valid only within specific dates. For instance if I want to convert USD to EURO I have to use a particular exchange rate that falls within specific dates. The exchange rate changes over time…
prince
  • 671
  • 2
  • 11
  • 26
-1
votes
1 answer

How do I add values to the same cell with its current value?

I am trying to add value of cell A1 to cell A2. However, I want to keep adding A1's value to A2's current value because I want to keep some monthly record and that is represented by A2. I will keep changing A1's value daily. One way I found is the…
-1
votes
1 answer

How do I use a class variable inside of that class? (C++)

This is the code I'm trying to run: class poly { public: int vnum; vrtx vrts[this->vnum]; }; (Note: The class name "poly" and other class "vrtx" are named as such to approximate the purpose of the problematic snippet. Vrtx is a…
-1
votes
1 answer

How does memory work in declaration of structure which uses self-referential structure pointer in C/C++?

In declaration of structure in C/C++, we have to use a self-referential structure pointer instead of a structure itself. // compile error struct stack { int overflow; stack p; } struct stack { int overflow; stack* p; } One brings…
Woonil
  • 3
  • 1
-1
votes
1 answer

Sort DataTable with self referential Relationship

I have a requirement where I need to sort out a data table with self referential relationship. My Table looks something below as shown in the image. I want all the related subset records should be displayed under the parent record. Any…
-1
votes
1 answer

Python {NameError} name 'self' is not defined in __init__

I'm making a small python script/program for extracting exam questions from a certain med-school, based on filtering keywords. It's been working pretty well. I've been adding more and more features and improving compatibility, and have done some…
emileber
  • 23
  • 4
-1
votes
1 answer

Is there a way for the value of an object to be made aware of its own key dynamically?

This is a purely theoretical question here (though one I think is an interesting thought exercise). I was just working on a JavaScript object (documentation-related) and the somewhat-unusual thought crosses my mind: is there a way to make a…
NerdyDeeds
  • 343
  • 1
  • 11
-1
votes
1 answer

How dose [self] work on Swift ? It work like [unowned self] or strong reference

I know [weak self] and [unowned self] but I don't know [self]. How dose it work ? [self] = [unowned self] or [self] = strong reference
-1
votes
3 answers

Can any one explain me how the size get allocated in the following case?

I got confused with the size allocation with my gcc compiler, can any one help me how the size get allocated for the following code. struct node { int data; struct node *next; }; sizeof(struct node) it gives an output as 16. struct node { int…
selvabharathi s
  • 137
  • 2
  • 8
-1
votes
3 answers

iterative cumsum where sum determines the next position to be added

I have a data.table as follows set.seed(5) x <- data.table(x=sample(1:20,15)) > x x 1: 5 2: 14 3: 17 4: 20 5: 2 6: 11 7: 8 8: 15 9: 12 10: 16 11: 3 12: 18 13: 10 14: 4 15: 13 and I would like to start at 1 and cumulate values…
bumblebee
  • 1,116
  • 8
  • 20
-1
votes
1 answer

How to self-reference the variable to the left in an asignment in GNU Octave?

Say you need to store the name of all local variables in a script: local = union(who,"local"). Is there a function to replace the name ("local") with a reference to the variable which is to the left of the expression? Update: For the sake of…
nightcod3r
  • 752
  • 1
  • 7
  • 26
-1
votes
1 answer

What is the difference between the two marked methods? Are their outputs the same?

This code was questioned in an exercise I had to solve. Although my code shows the right result (version one), I'm not sure if it is as good as the solution provided (version two) or if it is correct at all. The task is to write a class which is…
Patrick Na
  • 13
  • 3
-1
votes
1 answer

Java returning subclass without generic parameter in superclass method

I really love using initializers to make constructing and configuring classes more understandable. Basically I prefer this: new ClassObj().StartingFrom(1).EndingAt(5).IncrementBy(1).Backwards(); Rather than this: new ClassObj(1,5,1,false); This…
Morgen
  • 1,010
  • 1
  • 11
  • 15
1 2 3
39
40