Saturday, April 19, 2008

visualizing edb's tag structure

This post deals with visualizing the internal storage format used by the elementaldb project.
I'm in the middle of rewriting the radix-tree storage engine in the elementaldb - while speed isn't a huge goal for the project, the newly rewritten proper crit-bit tree is performing inserts slower than the old version. So I thought it'd be interesting to use Graphviz to visualize the tag structure (and also the current radix tree) implementation. The tagm module was originally written for a mail client where messages could be tagged with a specific value. The generic requirements of the tag module were: it had to perform quick appends and it had to support a sort of hierarchical structure. The result is a linked-list implementation with nodes that can have an unlimited number of children. It's nothing really fancy but provides a convenient layer on which to write other data structures (b+tree, radix or anything else really).


This image shows the result of doing ten inserts of x = [0..9]. Each node is a tag value, in the current rtree implementation a tag node can potentially have a maximum of 256 children. These are sequentially searched (I know, I know) during a rtree put operation when a split branch point is reached. This means that storing binary data is very inefficient, hence the need to write a proper crit-bit implementation.


The image above shows the resulting structure when storing in a crit-bit structure. In this case a tag can have a maximum of 3 children: 0, 1, and data.

Wednesday, April 16, 2008

Untitled FWS


Untitled FWS is an episodic flash web strip that will be published every week on Monday, Wednesday and Friday.
My eventual idea is to actually have an entertaining story and goals to accomplish for each episode. So far the first published one on Monday contained only the very basic mechanics. The episode published today contains an actual goal and some objectives. For the next episodes I hope to continue this development trend.
The publishing schedule is very aggressive but it should force me to streamline the whole development process or fail miserably.

Maybe I'll give it a name soon too!

Saturday, April 12, 2008

Loveless


It's not very hard to see that Apple is the best at creating user interfaces. I've started using Amazon's MP3 Store and if you're a fan of DRM free music (and who isn't?) you should start using it too. The only problem is the interface to the store is simply awful. I've gotten so familiar with Apple's iTunes interface it's difficult to swallow a system where I can't see the most popular songs from an album or sort by most downloads or have any sort of interactive auto-complete search feature. When you go to check out for some reason Amazon's "One-Click" (tm) actually takes four clicks from the time I decide I want a song. After clicking four times for "one-click" the downloader pops-up to actually start the download process. The whole system needs to be put in the trash and Amazon's developer's should start over. The whole system feels very hackish and leaves a lot to be desired.
What can Amazon do? First, look at what Apple's done then try to achieve something similar but as a web solution. Retool the "MP3 Downloader" application to be a hidden plugin (similar to the Google gear's interface) where the web app. would communicate with the downloader portion via a javascript interface. This would make the whole interface seem more consistent (even though the plugin would still be required).
Apply lots of ajax magic to the page so that when I start typing "radi" I get "Radiohead" and a list of 5 other similar band and song names. Lists of songs should also be fast to load and NOT require the whole page to be (re)loaded. Make the song pagination system snappier so that browsing through songs feels snappier.
DRM-free music is worth the extra effort to go through the amazon system and as a new system goes it's not too bad but there is definitely quite a bit of room for improvement.

Thursday, April 3, 2008

php is teh funnays

So I'm squashing compiler warnings in my little project when I come across a warning when building in linux. It deals with pread/pwrite being implicitly defined. I check the man page, yes unistd is included but still the warning. So I google and find some PHP silliness:
Bug #32049 Implicit declaration of function pread - It's just a warning (ha!), note the date and files...
php4: files session handler broken on sparc - deals with the same files and almost 1 year earlier.

Warnings actually really do matter and they are normally pretty easy to fix. I know these were from a few years ago but the complete dismissive attitude of the bug response prompted me to post this.

Tuesday, April 1, 2008

2d line intersection

Playing around with line intersections again. There are two sites I found useful:
Intersection Point Of Two Lines
and N Tutorial's great site (I wish they had done more tutorials but they were probably busy doing N+).

To visualize it all I created a little cocoa app which displays two lines, the intersection point, a normal and a reflected ray from the intersection point:




Download Cocoa Project Source (requires Xcode dev tools): 2d_intersect.zip