Skip to main content.
September 26th, 2006

n-level, m-width tree parsing

I have been programming for several years, and have been exposed to all sorts of problems along the way. However, Friday was about my first opportunity to actually use a tree traversal in a ‘real’ project, not just one assigned by a professor.

As most *nix types are aware, you can set up an aliases file to map addresses onto real world users. The problem with this file is that aliases can get stale, new aliases can be made that end up totally encompassing old ones (unintentionally), etc.

So, the request came about to be able to use a webform to look up where, exactly, an alias points. So, into our work order ticketing system it went, and I started working on it on paper Thursday evening. Turns out that it is not in fact to be a graph problem but rather a tree problem. This is a Good Thing™. Graph problems aren’t horrible to work with, but they are substantially more complex than tree problems.

The general form of the /etc/aliases file is listed above, but I left out an important caveat - aliases can point to a file of delimited targets via the :include: directive. To make a medium-length story pretty short, to parse the aliases file, every line needs to be read, and then tokenized to display the results of a search, recursively.

I suppose you could traverse the tree using a loop-based approach, but heaven help you to handle the corner cases. The only I have to track in traversing the tree is what the most recently checked alias was, and advance to the next one in the list when the check on that iteration is over.

Overall, it turned out to be a really easy to write script, and it’s now live on our site. If you are Shodor staff, you can play with it here.

Posted by wmyers as work at 4:29 PM EDT

50 Comments »

September 22nd, 2006

nifty php line

If you ever need to get the name of the page you are on, and you don’t need the path, this will do it for you:

ltrim((str_replace(dirname($_SERVER['PHP_SELF']),"",$_SERVER['PHP_SELF'])),"/\\");

Posted by wmyers as hints at 11:20 AM EDT

No Comments »

shodonix 1.03

one package was missing, and another was acting up, so the image has been recreated again

we should be one user test away from using the cd in workshops

Posted by wmyers as work, projects at 11:19 AM EDT

No Comments »

September 15th, 2006

shodonix 1.02

The image has been shrunken enough to fit under 700M (694.7M to be axact). Now the CD is going through testing before being deployed to offsite workshops.

Posted by wmyers as Uncategorized at 1:41 PM EDT

No Comments »

September 12th, 2006

shodonix 1.01

Right. So, it turns out that if you don’t unmount /proc while chrooted, the iso won’t compress properly, which is what happened to my first attempt. The second following attempt was done from a fresh expansion of Knoppix, and I made sure I unmounted /proc, and everything’s copasetic.

The last thing to get working is the offline edition of Interactivate to load correctly (and fit). I am currently 10M over the limit, and the launch shortcut is wrong, but we’re very close.

Posted by wmyers as news, work, projects at 6:10 PM EDT

No Comments »