cyclic

How can you re-arrange items in an array based on its dependencies? and also detect any cyclic dependency

Given the type: class Field{ public string Name{get;set;} public string[] DependsOn{get;set;} } Let's say I have an array of Field items: List<Field> fields = new List<Field>(); fields.Add(new Field() { Name = "FirstName" }); fields.Add(new Field() { Name = "FullName", DependsOn = new[] {"FirstName",...

Backend module needs URLs from presentation layer - how to avoid cyclic dependency?

URL generation in my web app is in charge of the presentation layer. Now consider another module sending out messages containing URLs. (Not neccessarily triggered from presentation). However, the presentation layer has to know about the module (since it might be the trigger, and the user can configure the module using the frontend). I.e...

How does one avoid a cyclic redirect when writing a facebook application using pyfacebook and google app engine?

Hello. I'm trying to write my first application for Facebook using python and pyfacebook hosted on Google App Engine. The problem I'm facing is that of cyclic redirects. Firefox dies complaining "This page isn't redirecting properly" when I visit http://apps.facebook.com/appname. Here's the code: class CanvasHandler(webapp.Reques...

Table design for cyclic dates

hello, In my application users should be able to define dates when they are available. Ie. user joe may define he's available: - at every monday, wednesday and sunday between 15:00 and 17:00 from 1.09.2009 to 15.11.2009. - at 2.09.2009 between 12:00 and 14:00 and so on... Dates may be defined maximum 1 year in future. Users may add, e...

sql closed loop relations; what could go wrong?

Hi, I am working with a database with the following design. I read it is not a good practice to have closed loops in a database design, and i have more than one. But i cannot remember why. So not sure how this might affect me. Any examples how this could be dangerous? Edit: went through my ebooks, found what i was reading was Begin...

cyclic dependency between header files

I'm trying to implement a tree-like structure with two classes: Tree and Node. The problem is that from each class I want to call a function of the other class, so simple forward declarations are not enough. Let's see an example: Tree.h: #ifndef TREE_20100118 #define TREE_20100118 #include <vector> #include "Node.h" class Tree { ...

Avoiding indirect cyclic references when using shared_ptr and weak_ptr

I'm currently putting together an application that relies heavily on shared_ptr and everything looks good so far - I've done my homework and have a pretty good idea of some of the pitfalls of using shared_ptrs. One of the most recognised problems with shared_ptr is cyclic dependencies - these issues can be solved by storing weak_ptrs th...

The Elegant way to handle Cyclic Event in Java ??

Hi fellows, i think this not a specific problem to me; everybody might have encountered this issue before. To properly illustrate it, here's a simple UI: As you can see, those two spinners are controlling a single variable -- "A". The only difference is that they control it using different views. Since these two spinners' displaying ...

Finding an element in a cyclic group of prime order

Greetings! How do I check if an element a belongs to a specific cyclic group G of prime order, given the generator? Right now i simply generate all the elements in the group, save them into a container and check if the element is in it. This is the code im currently using to generate all the elements of the group: public HashSet<BigInt...

How to detect if a directed graph is cyclic?

How can we detect if a directed graph is cyclic? I thought using breadth first search, but I'm not sure. Any ideas? ...

Database design: circular references

I have three database tables: users emails invitations Emails are linked to users by a user_id field. Invitations are also linked to users by a user_id field Emails can be created without an invitation, but every invitation must have an email. I would like to link the emails and invitations tables so it is possible to find the ema...

Is there a standard Cyclic Iterator in C++

Based on the following question: Check if one string is a rotation of other string I was thinking of making a cyclic iterator type that takes a range, and would be able to solve the above problem like so: std::string s1 = "abc" ; std::string s2 = "bca" ; std::size_t n = 2; // number of cycles cyclic_iterator it(s2.begin(),s2.end(),n); ...

How do find the longest path in a cyclic Graph between two nodes?

Hi, I already solved most the questions posted here, all but the longest path one. I've read the Wikipedia article about longest paths and it seems any easy problem if the graph was acyclic, which mine is not. How do I solve the problem then? Brute force, by checking all possible paths? How do I even begin to do that? I know it's goin...

CMake cyclic dependency error when custom library name is the same of a system library

Hi guys, i have the following problem. I'm writing a CMakeLists.txt to build a C++ project of mine, which is composed of libhybris.so : A shared library with some exported functions. hybris : An executable which links to libhybris.so A set of various shared libraries which links to libhybris.so The problem is that, libhybris.so depen...

create a cyclic auto increment column in mysql

I have a table that's used to store some temporary bookkeeping stuff. It needs a unique id for each row, so I used an autoincremented column. However, after a while the column reaches it's max value and then I cannot enter new rows into the table. The table is rather small, only ~100 rows at a time since I keep inserting and deleting ro...

finding the longest road in a Settlers of Catan game algorithmically

I'm writing a Settlers of Catan clone for a class. One of the extra credit features is automatically determining which player has the longest road. I've thought about it, and it seems like some slight variation on depth-first search could work, but I'm having trouble figuring out what to do with cycle detection, how to handle the joining...

JAXB cyclic reference avoidance using @XmlIDREF

I'm using JAXB in a web service with some slightly complex objects. One of the objects, Sensor, has a list of other objects it can communicate with, which necessarily can include itself (behavior that cannot be changed), leading to a cyclic reference during marshalling to XML. @XmlAccessorType(XmlAccessType.FIELD) public class Sensor e...

using cut for cyclic data

hi i am trying to analyse wind data using the 'cut' command, i want to set 16 wind directions how can i cut directions 348.75 till 11.25 to a "0" label? thank you eliav ...

How to implement a cyclic UIScrollView?

How to implement a cyclic UIScrollView? That is to say, when you scroll to the very left item then the UIScrollView will show the very right one. Any help would be appreciate. ...

Are clojure function cyclic dependencies specifically disallowed by design, or is it just a reader behaviour?

If I do the following in clojure (defn sub1a [a] (cond (= a 0) 0 true (sub1b (- a 1) ))) (defn sub1b [a] (cond (= a 0) 0 true (sub1a (- a 1) ))) (println (sub1a 10)) I get the following error: java.lang.Exception: Unable to resolve symbol: sub1b in this context But if I do the following: (defn sub1a [a] (co...