Archive for August, 2007

RoundCube Webmail - thoughts a few weeks in

Thursday, August 30th, 2007

Three weeks ago I migrated my webmail from trusty old Squirrel to RoundCube. I did this for a few reasons

  • I was tired of squirrel mail not being more reactive.
  • I was tired of errors reading HTML mail. The process to view in HTML mode would break a lot and when viewing the HTML portion of the email the “reply” button was lost. Generally I have no interest in reading the HTML version of an email but occasionally I do want to see the pretty pictures.
  • I wanted an ajax preview pane so I would be able to more easily navigate from message to message without a lot of full page refreshes
  • I was really tired of not having address book integration. I was constantly going through old email’s looking for addresses. Squirrel mail had some LDAP options but nothing that was accessible from the composition page. I use plaxo and would have loved integration with that but I didn’t need it. Roundcube promised an ajax address book lookup which sounded golden.

I installed roundcube easily enough. LAMP application and the configuration was fairly obvious. The look and feel was immediately snazzy. Aside from my browser shell roundcube gives the impression of a modern web 2.0 application.

I opened an email and was immediately bothered by the full page view. I was expecting the index page to split and see a message preview (I had looked at roundcube in the past and specifically recalled a screenshot showing this). I figured it was in the preferences somewhere but didn’t see anything. After digging through the roundcube roadmap and issue tracker I discovered the preview pane had been pulled out (due to it being buggy) and it was slated for a later release. This was a real bummer.

I said to myself “Well someone must have added a plugin for this” and set about looking for the roundcube plugin repository. To my shock there wasn’t one. On the trac ticket for the preview view I found a patch I could apply to my install and a few roadmap milestones away was the feature “Implement the plugin API with documentation.” under Milestone 3 Beta. Considering the application is in .1 RC1 and there are no timetables I was completely surprised. After the excellent design of roundcube and the ambitious ajax / drag drop feature set (which appears to be custom developed..no scriptaculous/prototype js files) the lack of a plugin architecture up front shocked me. Particularly after using wordpress with it’s outstanding plugin support I really was left speechless. I had no desire to apply a patch to my roundcube install (and the subsequent upgrade hell that follows).

The composition address completion worked great. Even adding addresses to the built in address is a breeze although checking to see if I already have the address and not presenting the “+” button next to the name would be nice.

I noticed a few inconsistent bugs when moving messages using drag and drop. The first few times I tried it the messages did not move. Later the problem went away and I had no issues moving messages among folders.

There is no empty trash button which was strange for an IMAP client.

HTML rendering of email is fantastic. Remote images are blocked by default like I would expect.

So overall I guess I am satisfied. The ajax features are excellent, the IMAP performance is improved, and I can’t say squirrel mail is any better at a preview pane. Roundcube still feels much like a beta application (which is what it is). It shows a lot of promise but I would be greatly concerned about its absolute lack of extensibility. I’d love to contribute (or use) a plaxo address book extension / plugin but there is no easy way to do so. An application like roundcube should be designued up front for drop in extensions and plugins - not a clunky diff / patch system.

Julio Lugo’s Improving 2007 Splits

Tuesday, August 21st, 2007

I can’t get over how well Lugo has played since the All Star break. For a guy with a .272 career average and someone who hit .197 in the first half of the season (including an absolutely dismal .089 in may) he has turned it around with a .313 july, .338 so far in august for a second half (so far) average of .326. Check out his 2007 Splits

You have to give credit to Terry Francona’s decision to move him down in the order and take the pressure off him. At the top of the lineup Lugo is hitting .226 but at the 9 spot he is an all star at .330.

What is weird is whatever pressure Lugo is facing is not Boston (or at least proximity to it). Lugo is hitting .303 at Fenway (right now he is only hitting better in Kansas City).

Chicken Breasts Stuffed With Herbed Couscous, Lemon Asparagus, and Apple Grape and Celery Salad

Monday, August 20th, 2007

The last time I visited with my sister I was drawn into her Everyday Food tv guide size magazine. It is a Martha Stewart (yes I know) magazine that focuses on easy to cook meals. Since I rarely like to spend more than 30-45 minutes cooking a meal its 10 issues a year seemed an easy way to broaden my cooking repertoire without adding a lot of time. So I decided to subscribe (and yes through a serious gaff by either me or their lousy online subscription portal managed to subscribe to Living as well). So I was bothered to see an issue of Living on Friday in my mailbox but was excited about the prospects of Everyday Food which was hiding underneath it.

So Sunday was my first foray into the Everyday Food world and for dinner I attempted a few things.

Apple, Grape, and Celery Salad
For a salad I decided to make an Apple, Grape, and Celery Salad. This was very easy. The ingredients for this were:

  • 1 cup red grapes, halved.
  • 1 granny smith apple, cored, halved, and thinly sliced
  • 1 tbsp oil (I avoided vinegar because beth does not like it)
  • 2 stalks of celery, thinly sliced on the diagonal
  • 1/2 cup chopped walnuts
  • salt and pepper

I tossed these together. The salad was very quick and easy to make and was delicious. The bulk of the recipe came from the magazine but I swapped almonds for walnuts since I had decided to use walnuts in the main course and didn’t feel like buying two types of nuts.

Lemon Asparagus
There was a recipe for Lemony Broccolini which sounded tasty and easy to do. On my trip to Whole Foods there was no broccolini so I decided to go for a Lemony Asparagus. It was a snap to make:

  • 1/4 cup lemon juice
  • 1 bunch of asparagus
  • 2 garlic gloves sliced thin
  • 2 tbsp oil (approx. i just drizzled it into my pan)
  • Salt and Pepper
  • 1/4 cup water

I heated the oil over medium heat and then added the garlic and asparagus. After 2 minutes I added the water and covered for 6-8 minutes. This was too much time - the asparagus was very tender at this point. In the future I would probably try 3-4 minutes of cooking once I add the water. Anyway after 6-8 minutes (which again should have been less) I added the lemon juice and salt and pepper. I tossed these together in the skillet and transferred directly to the serving plates.

Chicken Breasts Stuffed With Herbed Couscous
Finally for the main course I used a variation of the chicken breasts stuffed with herbed couscous recipe from everday food. I followed its directions exactly except for the following substitutions :

  • 1/2 cup basil leaves instead of mint. I have been growing my own basil and used that instead.
  • Walnuts instead of pinenuts. Beth prefers walnuts and I figured they would work. I did finely chop them so they wouldn’t standout in the stuffing.

I didn’t have any real problems making these. It was a bit difficult stuffing the chicken breasts but I chalk that up to me never doing that before as opposed to anything particularly hard about it. By far the last one I did (I made 4) was the easiest and most well done. One thing I noticed was it was difficult to keep the outside clean of the couscous stuffing but it really added to the dish all together because I was not able to have a stuffed filling on the entire breast so having trace amounts on the outside ensured distribution of the flavor.

The couscous as a stuffing was delicious and also was healthier than a traditional bread stuffing.

Beth really enjoyed the food (she cleaned her plate very quickly) and it is something I will definitely make again. It also was an easy technique (by altering the stuffing) to vary the flavor which I will keep in mind when I am making something up.

Howto Rails Generators with SeaCucumber

Monday, August 20th, 2007

Over the weekend I spent some time working on some generators for SeaCucumber the javascript testing framework I am working on with Mike Ward. There is quite a bit of redundant HTML code that serves as plumbing to the framework and a generator would simplify that.

I found the most useful generator documentation is on the RoR wiki: Understanding Generators.

The generator code itself was very simple although it will be interesting to try for a more complex generator.

class SeacucumberGenerator < Rails::Generator::NamedBase
  def manifest
    record do |m|
      m.directory File.join('test/javascripts')
      m.directory File.join('public/javascripts')      

      m.file 'unittest.js', File.join("public", "javascripts", "unittest.js")
      m.file 'test.css', File.join("test", "javascripts", "test.css")

      m.template('javascript_template.js',
          File.join("public", "javascripts", "#{file_name}.js"))
      m.template('seacucumber_template.html',
          File.join("test", "javascripts", "#{file_name}_test.html"))
    end
  end
end

This generator does three basic things.

  • m.directory - Creates directories if necessary.
  • m.file - Copies static files without modification to the target directory.
  • m.template - Executes the two templates using ERB and writes them to the target location.

I used a NamedBase which take an argument. For example I might run this:

script/generate seacucumber MyFunction

Rails::Generator::NamedBase exposes a number of accessible attributes which are created from the argument. The most useful thing this class does is provide a bunch of attributes you can use from the manifest or template. It takes a trip to the source code to find out what they all are. To save time I thought I’d list them along with their values which follow standard rails inflection rules:

  • name MyFunction
  • class_name MyFunction
  • singular_name my_function
  • plural_name my_functions
  • table_name my_functions
  • class_path (blank)
  • file_path my_function
  • class_nesting (blank)
  • class_nesting_depth 0

Next I need to add a bit more sophistication to the templates I am generating to make them sensible for when someone is starting to develop a JavaScript function and needs to generate the Sea Cucumber plumbing.

Spaghetti Carbonara With Snap Peas

Thursday, August 16th, 2007

I felt like some Carbonara last night and set about making it for the first time. I’ve had quite a few varieties of the dish (from the no cream versions in Italy to the more Americanized cream and green pea versions I see in the US) and liked them all. Lately I’ve also had a motivation to shell my own peas so leaning towards a green pea version I opted for the Americanized version.

After looking at a few recipes I ended up using this Food and Wine Spaghetti Carbonara With Green Peas Recipe. I was specifically looking for one that used a heavy cream and Parmesan along with green peas. This one seemed fairly easy.

Beth was slightly concerned about the raw eggs but I think she thought the egg cooking against the freshly cooked pasta cool.

I went to whole foods for my ingredients.

Once home I ran into what was my biggest issue - peas. I was all for shelling peas. There was good tennis on TV last night (federer was playing benneteau in an easy win and baghdatis was in the other court against chela) and I was waiting for Beth to get back from a meeting so I had the time. Green peas were not available so I got snap peas. I read some pea shelling instructions and went right into it. I needed 3/4 cup of peas for my recipe and after spending about an hour shelling I had gone through my two containers of peas and had about 1/4 cup. It could have been a pretty big let down but I saw it coming after I saw how slow I was filling my measuring cup. The peas were generally really small. I am not sure if it was the type of peas (snap as opposed to green), if these were just particularly lame peas, or if all pea shelling is this tedious.

I used an uncured smokehouse bacon instead of pancetta. It worked well for the recipe and plus Beth really doesn’t go for any cured meats so I was taking that into account as well.

Everything was really easy to do (except for the peas). I used the 1/4 cup of peas instead of adding more green peas that would have been from a bag in the freezer. The result was much more creamier and cheesier than the photo from the recipe. I really mixed the sauce thoroughly together in the pot.

Overall I would call this a success and certainly make it again. I need to figure out shelling peas - I think I probably just need to buy green peas as opposed to substituting snow or snap and I’ll find them larger. Or just go with frozen peas which is a) easier and b) available and pretty much just as good.

WordPress Plugin for Google Syntax Highlighter

Wednesday, August 15th, 2007

I am a big fan of the source code highlighter used by the Waffle project. Michael Ward recommended it for me to use when I set my blog up a few weeks ago.

Screenshot

The highlighter itself is simple to use on its own - it’s just a javascript include but I had been using another code highlighter which had a WordPress plugin that made it’s use a snap.

I figured it wouldn’t be too hard to create a plugin for the syntax highlighter (which had larger language support including ruby which I needed) and so I did. The plugin is being hosted by WordPress and I encourage you all to take a look and use in your own blogs.

Google Syntax Highlighter for WordPress

Debian etch webdav issues

Friday, August 10th, 2007

I was setting up my webdav (which I had not used since I upgraded my debian installation to etch from sarge) to talk to Windows XP and ran into a couple of unexpected issues.

AuthDigestFile becomes AuthUserFile
Somewhere in the upgrade to etch the AuthDigestFile directive went invalid (I recall I just disabled my webdav site when i upgraded). and is now AuthUserFile. Otherwise everything else stays the same.

XP forces NTLM Authentication
When I tried adding my web dav as a network place using my username / password the authentication failed and in the windows authentication box I saw servername/username instead of just my username. I did a bit of digging around various webpages and found a few client and a few server fixes. The easiest one for me was to create a new user in the form of user@server that bypassed the windows forcing NTLM authentication bug.

Etch denies DavLockDB
Finally I was able to connect but then I noticed that both cadaver (which I was using as a sanity check) and windows could not write to the dav. Windows reported the error a device attached to the system is not functioning. In Cadaver I was receiving an I/O error. It turned out that the apache2 user (www-data) could not write to the DavLockDB which was at /var/lock/apache2/DAVLock. I changed the owner of that file to www-data and from that point on the WebDAV was functional from both cadaver and WindowsXP.

The Windows XP authentication error was something I would have encountered but the sarge => etch upgrade path did not make it easy for my WebDAV. I am not sure if there was a reason why the DavLOCK database was no longer accesible to www-data (perhaps the default location for this database was moved) or why the Apache directive for digest authentication changed.

BDD Model Validation using RSpec and extensions to Hash

Wednesday, August 8th, 2007

I avoid writing fixtures for testing. They are cumbersome to write and management (particularly after the fact) is a hassle. When testing a model’s validations I want to work with a generally static model that only changes one or two attributes which illustrate the test condition I am working on. To this end I followed Luke Redpath’s blog post on BDD and models in particular that uses a more behavior driven approach to testing a model and it’s attributes.

As such in my rails projects now I like to use this Hash extension when defining the validation rules for my model.

module HashExtension
  def except(*keys)
    self.reject { |k,v|
      keys.include? k.to_sym
    }
  end
end

And then I can define a model’s allowed behavior using RSpec. For example:

describe "a test model" do
  def valid_model_attr
     { :name => "name", :age => 21}.extend(HashExtension)
  end 

   it "should be valid" do
      Model.new(valid_model_attr).should be_valid
   end

   it "should be invalid without name" do
       model  = Model.new(valid_model_attr.except(:name))
       mode.should_not be_valid
       model.errors.on(:name).should_not be_nil
   end

  it "should be invalid if age is under 21" do
       model  = Model.new(valid_model_attr.except(:age))
       model.age = 20
       mode.should_not be_valid
       model.errors.on(:age).should_not be_nil
  end
end

I can add as many tests as I want without defining several test specific fixtures which need to be updated when the validation rules for a model change. Using an attribute hash and except I can update one hash.

This technique gets a little more complicated when testing a model with a has_many / belongs_to relationship but I recently had success with that on this site I developed (www.clowndown.net). In that case I defined a test hash a such:

  before(:each) do
    @team  = Team.new
  end

  def valid_team
    {
      :name => "team name",
      :contact_number => "call me here!",
      :people => [valid_person, valid_person],
      :knowledge_of_chicago => "pretty good",
      :why_will_win => "might get lucky",
      :relationship => "great"
    }.extend(HashExtension)
  end

  def valid_person
    person = Person.new
    person.attributes = {
      :email => "email@email.com",
      :name => "My Great Name",
      :shirt_size => "L",
      :hometown => "Chicago",
      :team => @team,
      :occupation => "occupation"
    }
    person
  end

And I was able to write specs like this that used an object relation that focused on testing of the behavior of the has_many / belongs_to relation.

  it "is invalid with 1 person" do
    @team.attributes = valid_team.except(:people)
    @team.people = [valid_person]
    @team.should_not be_valid
    @team.errors.on(:people).should_not be_nil
  end

Inconsistent/Broken WordPress Category Feeds

Wednesday, August 8th, 2007

I have been setting up WordPress on my Debian etch server and everything seemed fine. That is until I tried using category specific feed.

I am assigning all of my posts On my blog I have a couple categories that I would like to have feeds for. These are:

http://www.peterryan.net/category/geek/feed/
http://www.peterryan.net/category/cooking/feed/

They both correspond to the following category archives:

http://www.peterryan.net/category/geek/
http://www.peterryan.net/category/cooking/

However as far as I can observe the readers I am testing with (Firefox Live Bookmarks, Thunderbird RSS Reader, Google Reader, and ThoughtWorks blogs which should be subscribing to the geek category) are not processing the results correctly. Sometimes the wrong category is returned (such as the cooking category is returned when I access the geek feed) and sometimes in Firefox an HTML instead of an XML page is rendered (and sometimes the wrong version of that).

This problem goes away if I do not use pretty permalinks (as described in the WordPress Codex and use the default. I would like to avoid using ugly links but I feel like I am running out of options.

I have looked at the following word press support threads plus I am sure more:

http://wordpress.org/support/topic/111113
http://wordpress.org/support/topic/112673
http://wordpress.org/support/topic/111356
http://wordpress.org/support/topic/124459?

And I have opened my own support forum with no help received so far:

http://wordpress.org/support/topic/129238

I am currently attempting to find help on the wordpress irc channel but have not had much success. Since this problem could be related to either my debian apache2 server, my php5 configuration, mod_rewrite, or wordpress I am a bit at a loss as to how to proceed. I would greatly appreciate any help related to this problem.

My HTACCESS file (generated by wordpress) is:



RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

I would greatly appreciate any help.

Sauteed Italian Chicken

Monday, August 6th, 2007

Last night I used a recipe from one of my favorite cookbooks - a 30 minute cookbook for during the week. It is a very simple recipe but the results are fantastic.

ingredients

  • Boneless skinless chickent breasts
  • 1 clove minced garlic
  • 1 tbsp Olive Oil
  • 1 tbsp butter
  • 1 tbsp oregano
  • 1/2 cup spaghetti sauce
  • 1/4 cup wine (I used a 2004 Kalinda Riesling which I bought a case of last year. It is fairly dry for a riesling otherwise I probably would have used a chardonnay)
  • 1/2 cup chopped fresh parsley

recipe

  1. Heat olive oil and butter on a skillet over high heat until shimmering
  2. Reduce heat to medium high and add the chicken breasts. Leave undisturbed for 3-4 minutes
  3. Flip the chicken breasts and leave undisturbed another 3-4 minutes.
  4. Remove the chicken breasts and put to a side plade. Reduce the heat to medium on the skillet
  5. Add the minced garlic and let cook for 15 seconds or so
  6. Add the wine and let burn down, not for very long (maybe 30 seconds)
  7. Add the spaghetti sauce, parsley, oregano, and salt and pepper. Stir together and let the sauce simmer 1-2 minutes
  8. Return the chicken to the skillet and coat well on each side with the sauce. Remove to serving plates and drizzle the remaining sauce over the chicken.
  9. Serve immediately.

We served this with a hodge podge of sides (corn on the cob and rice pilaf) mostly because of what we felt like. But the results of this (which is 25 minutes including prep) make it something I will return to again. Very tasty!