Sunday, April 29, 2007

emacs love

I was working on some ruby code just now. I had a hash with keys that were capitalized words, such as:

comp << l['Address'] unless l['Address'].empty?
comp << l['City'] unless l['City'].empty?
comp << l['State'] unless l['State'].empty?
comp << l['Zip'] unless l['Zip'].empty?
comp << l['Country'] unless l['Country'].empty?

but I made some changes so that all of the keys would now be lowercase and turned into symbols. Basically I wanted the output to look like this:

comp << l[:address] unless l[:address].empty?
comp << l[:city] unless l[:city].empty?
comp << l[:state] unless l[:state].empty?
comp << l[:zip] unless l[:zip].empty?
comp << l[:country] unless l[:country].empty?

With a little help from an ex coworker's blog, I was able to achieve this using the following regular expression:

M-x replace-regexp
l\['\([A-Z]\)\([^']*\)'\]
l[:\,(downcase \1)\2]

Note that the '\,' (backslash-comma) combination escapes the lisp command that is part of the replacement text.
I never ceased to be amazed by the power of emacs. I'm still decades away from being able to develop a webservice in lisp. :)

Tuesday, April 17, 2007

juice

I just received a juicer - the Breville JE95XL Two-Speed Juice Fountain Plus - from amazon. It's pretty sweet. I just made some carrot/celery/ginger juice. The leftover pulp is moist but not soggy - so it seems to have done a good job extracting. I'm going to see if we can bake the pulp into something though instead of wasting it.


Monday, April 16, 2007

The fire is burning.

Several people have asked me if I have a hard time motivating myself now that I'm starting something of my own. In fact, that's a question I asked my friend (and bluedot founder) a few months ago.

The answer is an emphatic no. I have this hot fire burning under my rear end that makes me do all sorts of odd things. Like wake up at 4:15am to start coding because I just dreamed up (literally) a line of code. Or pass on the wonderful california sun and sit inside and code all day.

I realized today that my first code-complete deadline is in about 15 weeks. And that just turned up the temperature a notch. The only redeeming thought is that what I have so far is only 6 weeks worth of actual coding.

Tuesday, April 10, 2007

eating whole and cheap

The wife is doing a story (possibly series of stories) on eating whole/ natural/ organic/ healthy on a low budget and without devoting your entire day to cooking (I'm busy coding all day, and she's busy with classes and assignments). We also live in a tiny studio with two hotplates, one bowl, two pans - you get the point - a minimalist kitchen.

This week we are on a $60/week food budget for the both of us.

My breakfast today was fig-bran muffins that she made (basic recipe courtesy our buddy guidoism) and a big strawberry/banana milkshake. For lunch I had a sandwich with guacamole (home-made), hummus (store-bought), yogurt (store-bought), cheese, tomatoes, and bread (store-bought). Dinner was lentil soup, asparagus, and bread. I want to try making my own hummus next.

I think we still have a few bucks left on our $60 budget, surprisingly, and a lot of ingredients with which to cook the rest of the week.

She hasn't yet decided how long this experiment will last. Part of me wants to continue with it for a while - just so I eat healthier and more creatively. The rest of me is hoping the budget will increase a little :)

Thursday, April 05, 2007

Magnifying mirrors

I've had this hunch for a while about people that really get on my nerves. The hunch is that the people that irritate me are the people in whom I see my bad qualities qualities reflected or, more often, magnified.

I wasn't sure about it but a few weeks ago the wife and I sat down and talked about all of the people that annoy each of us (both of us are pretty chill, if I may so say so myself, so the list was quite short - but both of us have a few people that drive us up the wall). We realized that, in each case, the thing that gets on our nerves about the person is some trait that we both are very conscious of in ourselves and try to change or improve.

So all of a sudden getting irritated by someone has a silver lining - it's just a little reminder about the things that we need to work harder on improving about ourselves.

I'm curious - have you found the same to be true in your experience?

Update: The wife claims that she came up with the idea long ago and I have just misappropriated it from her. The wife is always right.