Posted by trevor
Tue, 07 Jun 2005 23:36:00 GMT
So it’s been two weeks since I (thought I) had anything to say.
I completely forgot that a few days back I put my first entry into the Ruby On Rails Wiki. That’s got to count for something right?
So, if you’ve ever wondered how to do validations outside of DB-bound models, this is a good starting point.
Posted by trevor
Tue, 24 May 2005 17:29:51 GMT
If you’ve been caught out by the Rails ActiveRecord bug where eager load mysteriously deletes records you might be interested to know that, for me at least, it only happens when you have ”:dependent => true” set on the association.
Posted by trevor
Wed, 18 May 2005 18:41:23 GMT
Browsing when I should be working, I learned something when I came across this little essay. Garrett’s ideas are interesting but some of the comments really struck a chord.
One comment in particular talks about “cogs”. To paraphrase – a designer starts from how something looks, building cogs to support it, while a programmer starts from a cog and drapes a skin over it to act as an interface.
What’s interesting is “cogs”. That’s pretty visual isn’t it?
It’s also nothing like how I operate as a programmer. I don’t imagine discrete machine parts turning in concert, I imagine discrete entities talking to each other. Nouns and verbs.
When I express a problem in my head I don’t see the solution unfold, I hear it.
Think fast: Observer or Listener? Granted, they aren’t exactly the same thing but they address similar needs. What do you instinctively reach for? Do you imagine your objects are watching for changes or listening for changes?
Does it even matter? Maybe.
It may be why starting with the interface feels a little unnatural to me. Of course it makes sense – starting with the interface helps to ensure early on that your priorities are aligned with the priorities of the person paying the bills.
I think why I’ve felt it unnatural is because an interface is something you see (it’s not called a ‘display’ for nothing) and something you touch. It passively waits for you to poke and prod. It’s a viewpoint that’s habit more than anything else – I spent too long writing code and then grafting on the interface when the designers were done.
The “half-baked epiphany” is that I’ve probably sold myself short. Not to insult your intelligence (dear reader) by stating the obvious, but “the visual” speaks too. I need to spend more time giving the users an appropriate vocabulary to talk to my code.
Posted by trevor
Tue, 17 May 2005 16:49:00 GMT
I’ve got two Rails apps in ‘production’ mode. That is, they are (were) stable, humming along nicely and hadn’t been changed in weeks. Until this morning, that is.
All of a sudden FastCGI is going nuts spawning copies of itself and complaining of incomplete headers – of course, no crash log is generated, so my only pointer is incomplete headers. Not much help there.
I rebooted the box, killed all the old session files and removed the FCGI IPC directory (to get a clean one). No joy.
I tried switching back to vanilla CGI - works fine so it’s not issues further down the chain (like the DB). Still no joy then.
After much digging (and swearing), I found that by removing the -restart flag from my system-wide FastCGI settings I could make the problem go away.
The problem is, I’ve had the -restart flag set for ages with no issues. I haven’t touched the box in, like, forever (internet time). So from the guy who can often be found saying “OK, I know you don’t think you changed anything but try really hard to remember what you might have done”, I’m saying dammit, I didn’t change anything!
So what’s the deal? Oh wait – it’s Tuesday isn’t it? That must be the problem. Tuesday.
Stupid emergent behavior…
Posted by trevor
Wed, 11 May 2005 18:11:16 GMT
I’ve just begun to read a borrowed copy of “Gödel, Escher, Bach: an Eternal Golden Braid”.
Here’s a game you can play if you need an occasional diversion when plowing through the material:
Let the book fall open to a random page. Scan the page for a lengthy paragraph which is completely incomprehensible. Something where you can pronounce the words but you have absolutely no idea why they are significant when strung together. It shouldn’t take long to find a likely candidate.
Next, picture Wallace Shawn sitting across from you at a restaurant. Imagine that he is speaking the words as you read them from the page.
As he goes on, he becomes agitated. His voice becomes more and more shrill and his lisp is uncontrollable. The pace of his speech becomes feverish and he occasionally stabs at the air with pudgy fingers.
He approaches the climax of his diatribe and he can no longer contain himself. He is speaking far too quickly to allow for pauses so he flails his arms and smacks the table as a whole-body substitute for punctuation. Tiny globules of spittle arc from his bottom lip – luckily not far enough to reach your bowl of soup.
Somehow, squeezing the last bit of air from his lungs, he actually manages to increase the pitch and volume of his voice even further. Face purple with effort, he utters the final words – the fundamental truth of what he’s been describing (and what you’ve been reading).
He slumps in his chair, silent, nodding, smiling. And looking to you for a reaction-in-kind.
Okay, so it does nothing to help you understand the material but it sure can be entertaining.
Try it. It’s fun.
Posted by trevor
Mon, 09 May 2005 06:22:35 GMT
Right. Here I go then.
We have a tradition at our house. OK, the reality is we stole a tradition from some good friends but that’s not the point.
The tradition goes like this – at the dinner table everyone gets to say three things about their day: something good, something bad and something they’ve learned.
And that’s why I’ve renamed my journal “something learned”.
Riveting huh?