tree command on osx bash

Using homebrew: brew install tree Using macports: sudo port install tree Using the source: Follow these directions. (Caveat; you should use the flags/etc. that make sense.) <rant>All systems should come with tree; I use it a lot. And we can post directory structures as text, not pics.</rant>

Handling inheritance with overriding efficiently

I have 3 possible answers. The sql fiddle for your question is here: http://sqlfiddle.com/#!3/7c7a0/3/0 The sql fiddle for my answer is here: http://sqlfiddle.com/#!3/5d257/1 Warnings: Query Analyzer is not enough – I notice a number of answers were rejected because their query plans are more expensive than the original query. The Analyzer is only guide. Depending … Read more

Storing a large number of images

We had a similar problem in the past. And found a nice solution: Give each image an unique guid. Create a database record for each image containing the name, location, guid and possible location of sub images (thumbnails, reducedsize, etc.). Use the first (one or two) characters of the guid to determine the toplevel folder. … Read more

Is there pointer in C# like C++? Is it safe?

If you’re implementing a tree structure in C# (or Java, or many other languages) you’d use references instead of pointers. NB. references in C++ are not the same as these references. The usage is similar to pointers for the most part, but there are advantages like garbage collection. class TreeNode { private TreeNode parent, firstChild, … Read more

create array tree from array list [duplicate]

oke this is how i solved it: $arr = array( array(‘id’=>100, ‘parentid’=>0, ‘name’=>’a’), array(‘id’=>101, ‘parentid’=>100, ‘name’=>’a’), array(‘id’=>102, ‘parentid’=>101, ‘name’=>’a’), array(‘id’=>103, ‘parentid’=>101, ‘name’=>’a’), ); $new = array(); foreach ($arr as $a){ $new[$a[‘parentid’]][] = $a; } $tree = createTree($new, array($arr[0])); print_r($tree); function createTree(&$list, $parent){ $tree = array(); foreach ($parent as $k=>$l){ if(isset($list[$l[‘id’]])){ $l[‘children’] = createTree($list, $list[$l[‘id’]]); } … Read more