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
2
votes
1 answer

Angular: reference currently instantiated controller

Is there a way to get reference to the currently instantiated controller object from within the controller's definition? I'd like to $compile a modal and bind that to the same controller that's creating the modal. Here's a simplified version of what…
bioball
  • 1,339
  • 1
  • 12
  • 23
2
votes
2 answers

Translating this to Common Lisp

I've been reading an article by Olin Shivers titled Stylish Lisp programming techniques and found the second example there (labeled "Technique n-1") a bit puzzling. It describes a self-modifying macro that looks like this: (defun gen-counter macro…
Wojciech Gac
  • 1,538
  • 1
  • 16
  • 30
2
votes
3 answers

Instantiate class variables in constructor of that class

I have a simple class like so: public class MyClass { public string String1; public string String2; public MyClass() { } public MyClass(string Json) { } } If the class is…
Dave
  • 25
  • 1
  • 4
2
votes
2 answers

Backbone js + Require js + backbone relational + circular dependency + self references

I've recently been experiencing issues with Backbone and Require JS as we have a fairly complex data model that I need to represent that is causing issues with circular dependencies and self references. I've read a bunch of posts online (none of…
2
votes
1 answer

Creating a self-referencing M2M relationship in SQLAlchemy (+Flask)

While trying to learn Flask, I am building a simple Twitter clone. This would include the ability for a User to follow other Users. I am trying to set up a relational database through SQLAlchemy to allow this. I figured I would need a…
Roy Prins
  • 2,790
  • 2
  • 28
  • 47
2
votes
1 answer

Self referencing model with Required annotation on some properties in ASP.Net MVC5

I have this selfreferencing Model: public class AddressDataViewModel { [Required] public String Country {get; set;} public String Town {get; set;} public AddressDataViewModel AdditionalAddress {get; set;} } Problem is that the…
CoCumis
  • 99
  • 1
  • 8
2
votes
1 answer

How do I create a self referential association (self join) in a single class using ActiveRecord in Rails?

I am trying to create a self join table that represents a list of customers who can refer each other (perhaps to a product or a program). I am trying to limit my model to just one class, "Customer". TL;DR available at bottom. The schema is: …
2
votes
1 answer

Rails polymorphic association self-referential associations

I am trying to implement polymorphic association + self-referential associations. The use case is: I have two models registered_user => registered users. unregistered_friend => friends of registered users who have not registered. I have a…
2
votes
1 answer

Self referencing entity & insert order - using Entity Framework Code First

I have two entities looking like this: public class AssetSession { [Key] public Guid Id { get; set; } public string RoomNumber { get; set; } public Contact Contact { get; set; } public virtual List Assets { get; set;…
RynoB
  • 323
  • 2
  • 14
2
votes
1 answer

Table Associations in Ruby on Rails

There are two tables, groups, and groups_hierarchy. groups has standard information about a group and the group_hierarchy has two columns (parent, child) that list the parent group's id and child group's id. This is to say that the child group is a…
2
votes
2 answers

has_many through self referential association

I want to (as an example) create a has_many association to all posts by friends of a person, something like has_many :remote_posts to give me something like person > friends > person > posts. ..here is how I would go about it script/generate model…
benjaminbenben
2
votes
1 answer

Entity framework.. self referencing table.. get records of Depth =x?

I am successfully using a self referencing table in entity framework. But I can't figure out how to get the records of the desired depth ? What should be the logic for this ? Model : public class FamilyLabel { public FamilyLabel() { …
Bilal Fazlani
  • 6,727
  • 9
  • 44
  • 90
2
votes
2 answers

T4 engine not recognizing current project namespace

I am using VS 2010 (C#) T4 templates to generate code. I need to iterate through all types within my project, shortlist entity poco classes and generate wrappers. The problem is, the project namespace is not being recognized. Here is the solution…
Raheel Khan
  • 14,205
  • 13
  • 80
  • 168
2
votes
2 answers

SQLAlchemy: Recursive hybrid property in a tree node

I've the following self-referential (tree) node, and wish to filter/sort by the calculated properties uuid_path and name_path: class Node (db.Model): id = db.Column (db.Integer, db.Sequence ('node_id_seq'), primary_key=True) …
hsk81
  • 792
  • 8
  • 15
2
votes
1 answer

how to import a table with a self relationship

I have the following table: EntityId - PK Label ParentEntityId - FK ParentEntityId is joined to EntityId of the same table. now I am having problems importing data to this table using SSIS because of instances where the parent entities haven't…
Mel
  • 3,058
  • 4
  • 26
  • 40