Thursday, June 26, 2008

FP + Rails

While extending a codebase for work today, it occurred to me that many of the annoyances I encounter while working in Rails are really just the result of incorrect abstraction choice. For instance, Rails has a theoretically very useful extension quote_value that throws quotes around the object that is passed to it. Unfortunately, this is not implemented as an extension to String or even Object, but to some moderately-difficult to access OO-abstraction. (think it might be Class) Were it just a globally available function, it would actually be useful all of the time, instead of when you're operating within the box.

Similarly, passing instance-level variables in models to class-level functions in the same model is very hard to do (as far as I could tell, impossible) without using the controller to function as a mediator that passes arguments.

This is really just an isolated aspect of a larger argument: OO sucks. Its suckage in this particular case is largely masked because Rails is very well designed for most tasks, but the suckage becomes quite apparent when you start breaking out of the standard Rails box.

Don't get me wrong: the Rails box is very nice. It is, however, still a box. It's possible that a concerted effort behind Arc could make something that is Rails-y by default while retaining the inherent flexibility of something written in a Lisp, but I'm not sure that it would be as useful as Rails is for web-dev. It seems like the hypothetical 'Arc on an Ark' platform would end up getting tweaked locally too much to actually be a meaningful standard, and I believe that to be a large part of the value of Rails: the silver lining on the box cloud.

In any event, I would argue that FP is the most useful of the various programming methodologies for a broad spectrum of use, probably in no small part because it encourages you to follow the (probably paraphrased/apocryphal) advice of Abraham Lincoln: "If you have four hours to cut down a tree, spend the first two sharpening your axe".

Wednesday, June 25, 2008

Mystical Thinkings

Interesting cards to consider:

(Coldsnap)

Adarkar Valkyrie: is absurdly good if online with Twilight Shepherd, but is probably just not efficient enough.

Braid of Fire: very weird, and seems like it should be fueling a combo deck.

Fury of the Horde: too situational, but it's retardedly good when it's good.


Herald of Leshrac: absurd in EDH if you can protect it and yourself.

Hibernation's End: too expensive, but it seems like it might have potential in older formats that can support it better and give it more targets.

Panglacial Wurm: Seems really good in EDH.

Phyrexian Etchings: it's a bad Greed.

Phyrexian Soulgorger: 8/8. for 3. that's a lot of 8/8, even with a drawback.

Sek'Kuar, Deathkeeper: EDH General.

Zur, the Enchanter: EDH General.

(TSP)

Avatar of Woe: absurd in EDH.

Bitter Ordeal: nuts if you have War Marshal + a sac outlet, probably amazing in EDH.

Gaea's Blessing: something of a known quantity, but fantastic.

Hypergenesis: weird, but absurd with a good hand.

Intet, the Dreamer: great EDH general.

Ith, High Arcanist: seems like an interesting EDH general. In particular, he may have an interesting interaction with first strike.


Numot, the Devastator: EDH general.


Orcish Librarian: he's retardedly good deck manipulation, particularly if you can do something with the RFG'd cards.

Oros, the Avenger: EDH general.

Rites of Flourishing: insanely powerful, but helps your opponent first.

Scion of the Ur-Dragon: retardedly good EDH general.

Shrouded Lore: might be interesting in older formats.

Teneb, the Harvester: EDH general.

Witch's Mist: seems good in EDH, as it's potentially very political.

Rails + PostgreSQL

I'm doing a Rails internship this summer with LocaModa, started today. (I've previously worked for/on Jango, which was my first RoR experience.)

Getting postgres installed on Ubuntu Hardy was just a matter of apt-get'ing, getting the postgres gem installed required me to grab libpq-dev (evidently a replacement for postgresql-dev, and I have no idea why that's a Q instead of a G) first.

In order to get Rails capable of talking to postgres, I had to modify pg_hba.conf: the actual (ie, non-commented) content of mine is two lines that look like this:

local all all md5

followed by this:
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5

the effect of the first line that begins with 'local' is to allow username/password logins from users other than the default postgres user.

Without that, attempting to login from another user account (for instance, the primary one on my laptop) resulted in this error:

rails FATAL: Ident authentication failed for user "postgres"

While I could have just started using the postgres user account for work, that's just assy.

Not sure how much of a hassle this was compared to the setup on OS X (as far as I can tell, rails dev happens almost entirely on either OS X or Ubuntu), but it was pretty reasonable and with slight documentation improvements would have been trivial.

Resulting convictions:

*PostgreSQL is less newbie-friendly than MySQL, but is a substantially better tool. (going back to my CRREL days, has support for GIS. more recently, was just more pleasant to work with. the backslash commands are useful as all get-out)

*Rails continues to be the best tool in its class, probably in the field period.

*Hardy is probably the best moderately mainstream OS out there, although it is occasionally a hassle.