Those who abstain from the command line, avert thy eyes

April 12th, 2008

Here’s my top 10 command line entries, according to history | awk '{a[$2]++} END{for(i in a){printf “%5d\t%s\n”,a[i],i}}’ | sort -rn | head

125 svn
58 ls
38 symfony
37 gvim
36 vim
36 cd
34 php
20 uptime
14 ssh
10 lighttpd

Idea & shell magic via Bill de Hóra. You can see that my recent work has been symfony-heavy (that’s what all the php is for, too).

cross another shared host off the list

February 8th, 2008

Just opened my first support ticket with the shared host Site5, and was shocked to see that every email generated by the process includes my username and password. Granted, these credentials only apply to their helpdesk site, but this is still so fundamentally stupid that I feel completely justified in avoiding them in the future. WTF.

Some recent projects

February 5th, 2008

I’ve been meaning to write something substantial about the projects I’ve been working on as a contractor, but it’s been long enough that just getting out a quick summary seems like it’s the best I’m likely to manage any time soon. Here’s some of what I’ve been up to for the last few years:

http://womenslunchplace.org/ — this just launched in November. It’s based on the Drupal open source CMS; my work included participation in the planning process, basic CMS configuration, building the theme based on static HTML & CSS templates from collaborators Jon Sachs and Andrew Rodgers, and writing some custom code to handle donations & related info.

http://rrankk.com — local startup. I did most of the data layer and vote processing work, while a couple other people did the design and interface. The voting stuff was particularly interesting, as it gave me a chance to learn more about the state of the art in voting theory, and to contribute some patches to Benjamin Mako Hill’s rubyvote library.

http://hear-db.org/ — this is a custom contact-management tool I developed with the BU School of Public Health and other local environmental health groups. Unfortunately, there isn’t much to look at without an account. I’m working on releasing the code behind this as an open source project, based on symfony.

http://skylineshuttle.com/ — a rare out-of-town project. My old friend Dave recently started this company, which runs shuttles from Duluth, MN to the Minneapolis airport, and points in-between. Dave is the sort of amazing guy who can teach himself how to build a scheduling and reservation-taking website while handling all the other aspects of launching a business. He’s also smart enough to bring in an old-timer like me to audit and modify his code for security, accessibility, and reliability before launching it publicly.

http://alexandreemmanuel.com/ — a portfolio site for local painter Alexandre Emmanuel, developed with my friend Cliff. This was an interesting challenge, because we needed to come up with a low-budget, bilingual site that could be cheaply hosted and easily added to.

http://jpgazette.com — another Drupal CMS site, which I worked on as part of the Alliance for Community Journalism. Beyond standard CMS configuration and theming, most of my work had to do with getting calendar events to show up similarly to their print edition.

Guatemala photos get around!

January 25th, 2008

It’s been interesting to see where my Creative Commons-licensed photos get used. road back to Quiche The latest is in the German Wikipedia entry on Tajumulco — previous ones were another Tajumulco shot in Glossopedia, and an older version of a milpa article on Citizendium (that’s the one over there in this post). Pretty gratifying for a casual amateur.

puttering around with Symfony

January 23rd, 2008

On advice from Nate, I’m taking Symfony for a spin (using the stable version 1, not the under-development 1.1), reimplementing the aforementioned contact management application. Here’s what I’m noticing:

  • Somewhat like Rails, there’s DB-independent schema definition! Big win here. Among other things, this lets you develop in SQLite and deploy in MySQL, which is a nice pattern. Rails’ awesome migrations aren’t here, so it’s not as useful and flexible a system, but it’s better than nothing for getting up & running.
  • One big difference from Rails that’s clear right away: rather than building code dynamically based on the DB schema, thousands of lines of getters / setters / etc. are generated by the symfony command line tool. Makes sense for PHP, but it’s a clunkier development experience.
  • There’s testing built in! It’s a bit of a PITA to do things like create a test database, and all the pieces for testing your models aren’t there right away, but still better than CakePHP. The aforementioned missing piece is available as a plugin. There doesn’t seem to be a straightforward way to get the propel-insert-sql task to run on alternate environments, so one must create the db on their own. I’m using SQLite, which is great, but my local environment somehow ended up with PHP having SQLite 2.8 while my command line is version 3 (macports at fault? what a step backwards from Ubuntu…). One port install sqlite2 later, and you can do sqlite data/test.db < data/sql/lib.model.schema.sql
  • No console, which makes the tests even more essential, so it does seem to be worth the pain of getting them working.

Side note — already, on the basis of the previous post, I’m seeing a surprising amount of traffic from searches on CakePHP, Symfony, and REST. Clearly I’m not the only one looking for this kind of thing.

Joomla! has an odd ecosystem

December 19th, 2007

Continuing on in year-end odd-project mode, I’ve found myself poking around Joomla! for a client. After working with a variety of Perl, Java, PHP, Python, and Ruby projects over the last 10 years, it’s very strange to find an “open source” project where significant chunks of project-related code are in some way proprietary.

For example, the first calendar component that pops up on my searches is licensed under the GPL, but costs $5 to download. The authors explain that this all makes sense because the files for the component are available at joomlacode.org. Maybe yes, maybe no, but I think there’s good reason this isn’t a common pattern. The $5 introduces some friction into the whole system — while it isn’t a significant amount of money to exchange for something that’s going to save development time, it forces the developer to find their wallet, dig out their credit card, and type in a bunch of numbers, all sight unseen. Multiply this friction for everyone who might come in contact with the code, offer patches, bug reports, etc. I can’t imagine things working this way in any of the other open source project communities I’ve worked in.

The calendar certainly isn’t the only example; the only tag component I can see is a proprietary component, complete with a graphic of a software box and at least a half-dozen “Get your copy - Download Now!” (for £ 25.00 + VAT) links on its home page. A little searching reveals some interesting perspectives from commercial component developers.

None of this is to say that the Joomla! community’s approach is inherently wrong, but as a developer thinking about doing some work with Joomla!, I’m motivated to reassess other, more conventionally Open Source options.

First thoughts on CakePHP from a Rails perspective

December 14th, 2007

I have a new project coming up that seems like a great fit for Ruby on Rails, particularly the RESTful interfaces that have gone in over the last year. However, the typical questions about using Rails apply here: I’m not sure how well the project’s hosting environment will support Rails, and collaborators aren’t as familiar with it. Thus, it seemed like it might be worth another look at options on the PHP side of things. I keep hearing that CakePHP is Rails-inspired and has many of the same advantages, so today I’ve taken the stable version (1.1.8.5850) for a spin, letting the Cake manual’s blog tutorial get me started. Here’s what I’ve noticed about CakePHP development as practiced in the tutorial — maybe there’s better ways to do things & the tutorial just isn’t mentioning them?

  • No migrations; you have to generate the DDL on your own, both initially and for any subsequent modifications. Also, no model or controller generators. It’s definitely nicer to just do script/generate scaffold post title:string body:text; rake db:migrate and be off to the races — from Rails 1.2 on, those races include the whole REST business. To be fair, there is a one off reference to ‘bake’ scripts in the CakePHP manual, but no pointers on what those are, or where they live, and the website isn’t much clearer.
  • No TDD. Woah. That’s, like, half the advantage of Rails — automated testing is right there in your face, and is firmly entrenched in the community.
  • PHP code is not quite as elegant as Ruby. For example, generating a link to delete a post looks like this: $html->link('Delete', "/posts/delete/{$post['Post'][id']}”, null, ‘Are you sure?’ ). Can you spot the syntax error? Probably you can, but it took me a good few minutes. The Rails equivalent would be
    link_to "Delete", { :action => "delete", :id => @post.id }, :confirm => "Are you sure?", :method => :delete
  • A lack of the experiences baked into Rails. For example, after the Google Web Accelerator fiasco, it became common practice to make all links to destructive actions happen via POST, which can be done via link_to’s :method parameter. Compare to the GET-powered delete link above, straight from the Cake tutorial.
  • I miss my vim & rails integration, which makes creating and navigating the various files a breeze. (Glad I went to the trouble of making that a link, as it got me re-reading the plugin’s about page, and I saw the parts about partial extraction and migration inversion, neither of which I’d noticed before)

On the upside, using CakePHP sure beats writing a CRUD-heavy PHP application from scratch. One of my current projects, a completely custom contact management application, would be in much better shape if it were using CakePHP instead of the project-specific ORM I cobbled together — I’m going to have to give conversion of that project to CakePHP some serious thought.

But is CakePHP a DSL for the web in the sense that Rails is? Not yet.

Don’t worry, be happy about the state of the environment?

December 12th, 2007

I’ve been meaning to review Jared Diamond’s Collapse and James Howard Kunstler’s Long Emergency for a while. Now that so-called environmentalists Ted Nordhaus & Michael Shellenberger have done me the favor of including both in their recent what-me-worry piece of sophistry, I have an excuse to cover both in one swoop.

Nordhaus & Shellenberger’s characterization of recent environmental writing, including Kunstler & Diamond’s works, is that they consist of “the tragic narrative of humankind’s fall from Nature.” This hardly applies to Kunstler; the tragic narrative he writes is of America’s addiction to cheap fossil fuels, which doesn’t go back more than a century or so. I don’t recall a single passage from Kunstler’s book that shows any concern for the idea of capital-N Nature that has Nordhaus & Shellenberger so agitated; instead, his utopia revolves around sustainable communities whose citizens thrive without depending on abundant fossil fuels.

It’s not a very good characterization of Diamond’s work, either. He examines a number of small and old civilizations and shows where they came up short against natural resources. Nordhaus & Shellenberger suggest his argument requires that “the Greenland Norse. . .convened tribal councils to choose collective suicide”, which is of course ridiculous, and also not something Diamond ever claims. He does talk about societies choosing how they respond to environmental challenges, but not in such a literal-minded way. Instead, for example, he shows how the Greenland Norse continued to depend on forms of agriculture that worked in Norway but clearly weren’t sustainable in Greenland’s harsher climate.

Honestly, I was hoping that the Nordhause & Shellenberger essay would provide some meaty criticism that would make the substance of Kunstler & Diamond’s books clearer, but the sad fact is that most of the essay is cheap insults, flaky logic, and sensationalist accusations. One moment they’re trying to discredit Diamond’s book by claiming that today’s ecological crises are better understood by “research into political psychology and social values” than by his studies, the next they’re throwing around phrases like “biblical rather than scientific” to get us to dismiss others’ analysis. The middle of the essay would fit right into a middling Relativist Philosophy 101 paper. I will grant them that including some half-hearted questioning of human-caused climate change was a little unexpected. Thanks to Salon for publishing this excerpt — I would have hated to waste the library’s time by checking a copy out.

As for Kunstler and Diamond’s books, I’d recommend them both. Kunstler certainly lives on the gloomy side of things, but his perspective is important to take into consideration. I hope things don’t turn out like he suggests, but I don’t see any reason why they couldn’t. His histories of the 20th century as a whole, and American politics of the last few decades through the prism of oil availability, are both fresh perspectives. It’s also hard to argue that a finite supply of fossil fuel, steadily increasing demand, lack of proven alternatives, and drastic implications for significant energy price increases demand serious planning.

Diamond’s survey of cultures is more hopeful, as it includes examples where people have succeeded in adopting to limits on available resources, as well as where they have not. Implications for the intensely interconnected societies we live in now aren’t clear, but there are surely some relevant lessons to be found.

Nordhaus and Shellenberger seem to think the key to our society’s survival is smiling and thinking happy thoughts, but if they can’t do that while honesty dealing with their critics, they’ll get no support from me. Anyone interested in further, better informed criticism of Nordhaus & Shellenberger’s recent work might want to check out this, this or this — none of which was presumably written over the authors’ lunch break.

Sorry, but vinyl rugs are not cool

December 11th, 2007

I’ve been reading Kevin Kelly’s Cool Tools blog for a while, and it generally lives up to its name. Today’s entry, however, was a bummer — it promotes vinyl rugs. Vinyl has some seriously nasty health and environmental issues which more than offset any convenience it may offer for pets with leaky bladders.

Fortunately, there are better alternatives.

All about the 2007 & 2005 Boston City Council elections

November 4th, 2007

Adam at Universal Hub has a comprehensive post on Tuesday’s city council election.

Boston.com has two year old articles.

Score one for the bloggers!

Update: Brighton Centered posts scans of Globe sidebar on candidates. Bloggers 2, boston.com 0.