I have the following structure:
config
|-- groups
|-- rootgroup
|-- group1 (includes rootgroup)
|-- group2 (includes group1)
|-- group3 (includes rootgroup)
|-- users
|-- Fred (includes group3 and group2)
So inheritance tree for Fred will look like:
_Fred_
v v
group2 group3
v v
group1 ...
Hello,
i have a table with categoryId, name and parentId. I would like to build a html list with parent and child tree like structure
my table looks like this
------------------------------------------------------------------
id categoryId parentId categoryName SortSeq
----------------------------------------------------------...
I want to create a function that will retry an expression if it fails. Here's my working version:
retry <- function(.FUN, max.attempts=3, sleep.seconds=1) {
x <- NULL
if(max.attempts > 0) {
f <- substitute(.FUN)
x <- try(eval(f))
if(class(x) == "try-error") {
Sys.sleep(sleep.seconds)
return(suppressWarnings(...
Hi,
I'm having problems with a pathfinder (it's my first, so that was to be expected) : it doesn't always take the shortest way. For example, if I want to go one square down, the path will be : one square left, one down, one right.
public void getSquares(){
actPath = new String[Map.x][Map.y];
isDone = new boolean[Map.x][...
Hi,
Suppose you have a class named MyClass. MyClass should have a property named Parent, Parent must be of type MyClass itslef. It is necessary because MyClass wants to hold a tree structure.
How can it be done?
...
I want to write code like this:
/*something*/ Fn() { ... }
int main()
{
/*something*/ fn = Fn;
while(fn) fn = fn();
return 0;
}
Is it possible to do this is a fully type safe way? Assume C, C++, D, C#, Java, or any other statically typed language.
...
Hi,
Please suggest me the solution to the following problem
consider a function
function recurse(a):
for child in a.childs:
recurse(child)
Now I want to execute some code lets say
print "Program ends here"
when the program is done with recursion,so how can I know when the recursion will end?
Thank you
...
I have what I call a catalogue, a dictonary like this:
fields = ("property1", "property2")
catalogue = { 0.3: {
100: [ {"property1": 0.3, "property2": 100, "value": 1000},
{"property1": 0.3, "property2": 100, "value": 2000},
{"property1": 0.3, "property2": 100, "val...
Hi,
I need to move some code from C# into a Stored Procedure for speed reasons. What I'm trying to get is a unique list of TemplateIds from the RoleTemplates (or CategoryToRoleTemplate) table based on a CategoryId.
However, I need the query to walk the Category.ParentId relationship, and collection all of the parent's related TemplateId...
Hello, how does referenced linking work in OCaml?
Example, let's assume I have 3 modules declared as
A.ml
B.ml
C.ml
of which
A needs B and C
B needs A
How should I proceed in compiling?
Since order is relevant using ocamlc or ocamlopt how can I fix the cross reference between B and A?
I'm trying to first compile them all into ...
I have already posted a similiar question to this one some time ago, but now it's different, so please don't close this as a duplicate.
I have a multi-dimensional array. I want a function that finds the position of the given array key (all my array keys are strings) and then returns the position of the key in the array, AS an array.
He...
I have two tables in a database, one lists package and one lists dependencies:
packages
id | name
---------
0 | xorg
1 | gnome-session
2 | gnome-panel
3 | gnome-mixer-applet
4 | gnome-media
depends
package | depends
-----------------
1 | 0
2 | 1
3 | 2
4 | 2
Obviously, if I want to find out what a packag...
Hi,
I have this method and it's kind of really big so I can't include it in this post. It takes an array as parameter and tests its objects (NSStrings). Sometimes -but not always-, the method calls itself with an array containing one of those strings. If every test is passed, then the NSString is sent to another method which processes i...
The old value/reference things. Im getting ConcurrentModificationException
for this adaptation of the Bron-Kerbosch.
public int[] bk(ArrayList<Integer> R, ArrayList<Integer> P, ArrayList<Integer> X) {
int count[] = new int[n];
int u=0, c = 0;
ArrayList<Integer> tempPX = new ArrayList<Integer>();
ArrayList<Integer> new...
I am showing images one by one.. But it displays two images at a time... Why this strange behavior?
<div Id="BannerDiv">
<img src="images/CIOT flash/im_01.png" alt="image1"/>
<img src="images/CIOT flash/im_02.png" alt="image2"/>
<img src="images/CIOT flash/im_03.png" alt="image3"/>
<img src="images/CIOT flash/im_04.png" alt="ima...
I want to convert generator or iterator to list recursively.
I wrote a code in below, but it looks naive and ugly, and may be dropped case in doctest.
Q1. Help me good version.
Q2. How to specify object is immutable or not?
import itertools
def isiterable(datum):
return hasattr(datum, '__iter__')
def issubscriptable(datum):
...
def mainCaller() = {
val name = "xyz"
someList.foreach { u:Map => foo(name, u) }
}
def foo(name:String)(map:Map): Unit = {
//match case....
//recursive call to foo in each case where name remains same, but map changes
}
how can I write foo as a partially applied function, where I dont have to pass name in every recursive call...
Recursion - when would you use it and when wouldn't you use it?
...
Ok, the real problem is slightly more complicated because it uses some classes that I've written instead of Strings, but it can be imagined like this: If you have a list of 700ish 3-letter words, how can I find every combination that can be formed by linking 5 of these words together by their first and last letters, i.e., CAT TOW WAR RAD...
How do I do mutually recursive definitions in Clojure?
Here is a code in Scala to find prime numbers which uses recursive definitions:
val odds: Stream[Int] = cons(3, odds map { _ + 2 })
val primes: Stream[Int] = cons(2, odds filter isPrime)
def primeDivisors(n: Int) =
primes takeWhile { _ <= Math.ceil(Math.sqrt(n))} filter { n % _...