The random rantings of a concerned programmer.
Archive for April 18th, 2009

(Untitled)

April 18th, 2009 | Category: Random

FFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I just discovered a really fucking massive huge flaw in my shitty ORM shit. The ORM layer is supposed to lazily resolve foreign references, right? So if you have a schema

You’ll notice that the post table contains a self-reference. So the ORM layer will generate the following code for that table –

The own-table foreign key, post_parent is a killer, because it causes parseSql' to lazily enter an infinite loop. While this isn’t bad, when you throw that DbRecord to the automatically-generated JSON thingy, it tries chomping through the entire thing and gets tangled up.

There’s no good way to fix this, aside from doing a topological sort of all the inter-table relations and having the ORM layer go “oh hey” when it starts to loop. That kind of functionality could be added to either the parseSql' function above, or to the toAscListJSON function, which converts the DbRecord into a JSON-injestable form (and should be replaced by using Data.Data instead…)

Realistically, I should throw this shit out and do it some other way, especially since the code generation bit has become pig disgusting. Fuck! (Eventually I’ll rewrite it using Template Haskell or something).

No comments

(Untitled)

April 18th, 2009 | Category: Random

I just ordered a Asus eeePC 900 off Woot for $150. I feel kind of bad about it — the poor machine only has 512MB of RAM and a 4GB SSD. Probably going to slap FreeBSD on it (who would have guessed?) and honestly — my fileserver is running an i386 kernel, so building packages for the little thing shouldn’t be an issue. And disk space shouldn’t be an issue either — I can just run all the data over NFS. And there are even a couple wallpapers for it’s small resolution.

Mixed it up with the 901 though — the 900 has a Celeron M, not an Atom (FUUUUUUUUUUUU). But it’s really all about the form factor, I think.

I don’t know if my fat fingers are going to fit on that small keyboard though :(

3 comments