FAQ Database Discussion Community


Self Referencing on a separate table - BoM in Laravel

laravel,laravel-4,laravel-5,self-reference,self-referencing-table
I'm curious if there's an easy way of implementing a bill of materials (assemblies) type recursive system using eloquent? Here are the two table structures I'm working with: inventory table: +----+------------+-------------+ | id | name | is_assembly | +----+------------+-------------+ | 1 | Table | 1 | +----+------------+-------------+ | 2 |...

c#: Self referencing object conversion [closed]

c#,converter,infinite-loop,self-reference
I have a self referencing object, which I need to converted from one to another object which is similar. I'm unable to find suitable method to do the convert with recursion without leading into an infinite loop. Any help would be appreciated.Still learning my ropes in c# Object 1: public...

Why is self-referencing pointer or this out of scope in button?

java,swing,this,self-reference,state-pattern
I'm trying to produce a dynamic canvas using the Swing library with the State pattern. My code can compile but with red marks all over the console when my buttons are pressed. The problem: my self-referencing pointer or reserved word this is out of scope in button. I want to...

Convert Obj C code to Swift weak self

objective-c,swift,uipageviewcontroller,weak-references,self-reference
I am using the code here but I'm having difficulty to convert the __weak __typeof(self) weakSelf = self; to Swift. Is there a way for me to convert the following code into Swift? I'm stucked convert to Swift even after reading the material said that [unowned self] or [weak self]....

one account have many friend who have same attribute of user ? how to implement it in DB & how it look like in ER diagram

mysql,database-design,many-to-many,entity-relationship,self-reference
one account have many friend who have same attribute of user ? how to implement it in DB & how it look like in ER diagram i'm trying to build simple DB project where i have user with (email,password) each user have many friend where the friend also a user...

Refer to class in C++ macro

c++,class,macros,self-reference
I want to write struct Foo{ MY_MACRO }; and have that expand into struct Foo{ void bar(Foo&){} }; How do I define MY_MACRO? The only things I can come up with is the following: #define MY_MARCO(X) void bar(X&){} struct Foo{ MY_MACRO(Foo) }; This comes very close but is sub ideal,...

Whats the best way to create a self-referential association in Rails 4?

ruby-on-rails-4,associations,self-reference
In my project I am dealing with objects called Workflows. Every Workflow can have many subflows (Workflows that it calls). At the same time every workflow (Including ones with sub flows) may also act as a Superflow that is calling the sub-flows and may have many Superflows that call it...

PHP Self-referencing script

php,forms,self-reference
I am trying to embed a self-referencing PHP script inside an HTML form with following code: Undefined index: conv <form action = "<?php $_SERVER['PHP_SELF'] ?>" method = "post"> <input type = "number" id = "temp2" name = "temperature2" placeholder = "28"> <label for = "temp2"> degrees </label> <select> <option name...

Optimizaion of calculating how many data.frame record timestamps appear in a one second window from every record timestamp in that data.frame

r,optimization,data.table,dataframes,self-reference
I have an R data.frame with a number of columns, one of which contains POSIXct timestamp records. I want to add a column to the data.frame that, for each row, contains the number of records that have a timestamp between that row's timestamp and one second into the future. The...

How to loop self referenced class in Jsp?

java,jsp,data-structures,html-lists,self-reference
I have written a Node class for storing tree data structure as , The node looks like , The tree i want to develop as, public class Node1 { public String data; public Node1 left; public Node1 right; public static int level=0; public Node1(String data) { this.data=data; this.left=null; this.right=null; }...

C function pointer callback as struct member with “self” reference parameter [duplicate]

c,struct,function-pointers,typedef,self-reference
This question already has an answer here: forward declaration of a struct in C? 2 answers I want to create a task struct containing a function pointer to a callback to execute said task. The task contains the parameters so I would like to pass a "this/self" pointer of...