Easier to manage time when busy?

There’s currently a whole load of things I want to read/play with/ do, page discount and I really don’t have time for it all, pills even though I do have the interest and energy(most of the time). I guess it’s one of life’s quirks that when one is busy, there’s lots of things one wants to do, and when you’re idle/bored, you can’t be bothered to do anything. Case in point: I was unemployed for several months this summer, and apart from auditing a summer class and a little traveling, I didn’t get all that much done. Some of that I can chalk up to the grind and angst of being unemployed and scanning the job listings on craigslist and monster etc and sending out resumes, but I really had a lot of time on my hands that was just squandered. Mostly I realize that now when I’m juggling grad school and a full time job along with all the other things in life – I wish I’d used that time better. Now that I’m already busy I have all this interest in playing with this technology or reading that book, various things I couldn’t be bothered to do in the summer time when I was idle. Is it really just easier to manage one’s time when you’re busy? Once you’re in a go-go state it’s just hard to stop (inertia?)

Mobile Computing and School

I figure everyone and their dog has a blog, abortion
so I should too. What better way to share my random musings and fun/wasting time with technology to so many and so few at the same time?
I’m struck by how much the ubiquitousness of laptops has changed the college experience from the aspect of getting work done. – when I was in school ending in 2000 (up hill both ways…) laptops were still pretty rare. People got work that required a computer done in their rooms or computer labs – and as a Computer Science and Engineering major, mycoplasmosis for me that meant a whole lot of time in my room. Now that I’m back in school part time four years after getting my BS, side effects I’m struck by the fact that I’ve spent more time in the library in the course of a semester than I did in my entire undergraduate education. Why is that? Well apart from the fact that I have better study habits than back then, recipe its simply because I can – I’m no longer chained to a desktop computer. This is all pretty obvious, but now people can get their work done anywhere, and do. Walking through the Tufts library, half the people are tapping away on laptops, and most everyone is jacked into an iPod. I can only imagine how different my college career would be like now – and we’re only talking technology enablement, not “if only I knew then what I know now”.

How to overengineer a simple web site

I was dismayed to hear about Jetblue’s recent mistakes leading to people spending 11 hours trapped in unmoving planes. It seems even with TV’s and leather seats, thumb they don’t treat their passengers as any more than human cargo.

They sent me an email today about their new bill of rights. It’s impressive at first, here especially the $1000 for being bumped, there but littered throughout the document is the (intentionally?) vague term “controllable irregularity”. We’ve all heard or read about instances where airlines blame the weather for delays, even as passengers can see people working on some problem with a plane, so what’s to stop Jetblue from doing the same thing?

As far as being trapped on a plane goes, they still thing five hours is a reasonable time to be on a plane without motion, which is ridiculous. I can’t really understand why nobody on those planes snapped and popped an emergency slide to get out of there after five hours, let alone eleven.

This debacle, and the case of American airlines doing the same thing to passengers diverted to Austin during a thunderstorm show that voluntary corporate promises aren’t enough to protect passengers. Moreover, from what I’ve read American airlines defended their actions in Austin by saying that if they deplaned the passengers, they’d lose their takeoff “slot” and might not get out of there for three days. This tells me we need a directive covering not just airlines, but the airport authorities and the FAA as well. The airport should be required to make a gate available to deplane passengers after two to three hours, and the FAA should be required to let that plane leave as soon as everyone has returned to the plane and is ready to go, not make it go to the back of the queue as is apparently the case now.

MSNBC has a roundup of some of the recent incidents here. The coalition for an airline passenger’s bill of rights has a site with more information.

Hopefully people will (for once) have the attention span to see that something concrete happens here, rather than be distracted by some BS corporate policy changes or some celebrity car crash or new dress or haircut and let the issue fade away, as with so many other important things.
There was a good article about The Arcade Fire in last Sunday’s New York Times magazine. It made me sign up for a trial eMusic account to get their old and new album (though I later realized I had acquired “Funeral” some time ago). It turns out its actually quite good. I wonder what kind of sales bump a band would get from being profiled in the times these days?

I hadn’t used eMusic before – I went there to get some DRM-free mp3s before I knew there was a free trial option. I don’t know what to think of their subscription model – pay $10 a month to get 30 mp3 downloads, dentist which works out to just 33 cents, but I don’t think I would want to commit to another subscription somewhere.

Speaking of subscriptions, some months I weigh the value of subscribing to the Times – its about $22/mo for just the Sunday issue. No wonder no one takes a paper anymore! There’s something lost in reading on the internet though – harder to lay in bed and read with a significant other and not as portable for reading on the go. I guess its worth it for now – until someone comes up with a fantastic e-Reader.

I think the publisher of the Times said in an interview recently that he wouldn’t be surprised if they stopped printing at all within 5 years. That’s a bit alarming to me from a historical point of view – one can go to the library and look at Times articles from the civil war etc – surely the format issues involved in making digital copies of a paper available to readers 150 years from now are nontrivial compared to keeping paper dry and in the dark.

I’ve resolved to learn Ruby on Rails this spring in lieu of the grad school class that I would normally be taking (rather than letting any free time slide by playing Wii Sports). I think the best way to learn is by doing, this web and since I don’t have any containable project ideas, no rx I’ve been tinkering with an open source project called Tracks, which is a web based organization application in the mold of the getting things done philosophy.

Even though I’m still painfully slow as a ruby developer, I’m really amazed how easy to work with and powerful some of the frameworks in rails are compared to the (clunky and slow to work with by comparison) Java/JSP/Struts stack I’m accustomed to. One of the features I love so far is the ability to reuse page chunks (“partials”, which could roughly be compared to tag-files in JSP land) in rails javascript templates which make it really simple togenerate javascript that will update multiple sections of a web page (as opposed to one container, which is easy to do with prototype alone from the client). I figured out enough in no time at all to submit a patch to enhance the project pages. Pretty cool.
I saw this disturbing story (via the wesabe blog) about a woman who can’t buy health insurance because she had a bout with cancer. Being without dental insurance bothers me enough, stomach ( i still kick myself for not picking up the COBRA coverage before the deadline – the thought of paying for a root canal out of pocket gives me the shivers) but the thought of no health insurance is terrifying.

I can’t believe that we, as a country can’t solve this problem and make it easier for individuals to obtain insurance. By insuring everyone, even the young and relatively healthy, the risk is spread around enough that it is overall more affordable for everyone. Surely having portable insurance would allow people to start their own businesses or just take extended time off to do something different, which would have to be a boost to the economy. It seems like the anti-health care forces would have us believe that any insurance changes would be bad for small business, but I can’t believe that is truly the case if we do it right.
Posting this little ruby snippet so i can reference it later. Need to recursively delete directories with a certain name in a large tree? The simplest example is scrubbing those pesky .svn directories in a subversion repository, unhealthy which can be done like so:

require ‘fileutils’
Dir.glob(“**/.svn/”) {|fname| FileUtils.rm_r(fname) }

another use case I have here at work is to scrub extra maven generated versions of code out of each java project (so as to keep eclipse sane). In this case, thumb we want to delete all directories (and their contents) named “target” except for the target directory at the root (because mvn clean is “too clean” in this instance):

require ‘fileutils’
Dir.glob(“**/target/”) {|fname| FileUtils.rm_r(fname) unless /^target.*/ =~ fname}

It gets a bit more complicated if you want to exclude list of directories from the operation. Here I found Ruby’s Enumerable module detect method quite handy to short circuit evaluate all the directories to exclude regex on each directory.

require 'fileutils'
@exclude= [/^foo.*/ , /^bar.*/ , /^james.*/, /^target.*/]
Dir.glob("**/target/") do |fname|
@erase = @exclude.detect{ |r| r =~ fname }.nil?
if @erase
puts "erasing #{fname}"
puts "skipping #{fname}"

Note: this code won’t copy and paste well because wordpress replaces quotes with smartquotes. I also really need to fix my stylesheet for code samples.
In several easy steps! (hopefully in some manner this will prove helpful to users of jython and freemarker in the future)

  1. The beginning
  2. Use a template engine to simplify site maintenance
  3. Create a semi-automatic scoring system
  4. Choose a different templating engine
  5. Take stock of what you’ve done

In the beginning, this web agree to be the “webmaster” of one’s local kickball division – simple an non-timeconsuming task given that the site has a handful of pages with static content, tablets and one must update the standings and scores every week. Decide the site is an excellent opportunity to learn CSS layout. Spend an order of magnitude of time more to get the site up than it would have taken to throw up some 1997-style table layout.

Now the site is up and running – decide that since the same header and footer are on every page, it would make sense to use some kind of templating system (note: the site is static content only) to make it easier to add new sections, should the need arise. Consider various client driven solutions: Dreamweaver (too expensive), Nvu (generates crappy HTML, crashes, slow). Consider rolling your own, since all you need are static includes. Discard that idea.

Look at open source templating engines. Decide that you really want to have an ant script that will magically assemble the site (and who knows, maybe one day even upload it for you too!). Decide to use Velocity. Play with Texen for a while, but decide you really need its big sister vpp. Learn the syntax, get the gazillion jar dependencies downloaded and copy and paste the web pages into easy to manage chunks and get the includes working. Wa-lah! Now the website can be regenerated by a simple ant task – take this opportunity to add a photos section because its suddently really easy to do.

Now you’re in the promised land – no more editing 6 different files to change the menus! You can sit back, crack open a beer, life is good. But no – it irks you that you’re managing the score via a way-too-manual process involving an elaborate Excel spreadsheet and typing at least 2 different places. You’re a software engineer, you can do better than this. (Note: this decision is best made when you have a new full-time job and your Theory of Computation grad-class is taxing your time).
Spend T-rides brainstorming how best to represent the structure of the league, with teams, game schedule, results- of course you’d want it to be validating. Discard that effort when you have a brainwave – just represent the state of the league in jython script – you were going to process the XML in jython anyways after sleeping off the delusional fantasy of using XSLT. Cut out the middleman, mere mortals don’t need to edit this stuff!
Cut to creating a set of objects for your domain objects. You need your teams:
class Team:
def __init__(self,teamName,teamAbbrev,shirtColor):
self.name = teamName;
self.shirtColor = shirtColor;
self.abbrevName = teamAbbrev;

Some games:
class Game:
def __init__(self,time,field,team1,team2,refs):

Get the whole messy code here (note it doesn’t handle forfeits yet).
Throw in some other classes and some logic, now you’ve got a half-assed scoring system! Data entry is totally a breeze, I mean look at this, total user friendliness:
day2 = Day("9/8/2005",ppe,ppe)
game = Game("8:00","A",baggers,ppe,freeballers)
game = Game("8:00","B",spanking,ballsdeep,gentree)

Get the season so far here.
Great! Now we just wire that up to our template engine, and then its margerita time!

Not so fast! Now you discover that, at best, the Velocity support for Jython is experimental, and for some reason your download seems to think its 1.31 instead of the 1.4 you’re sure you downloaded, which doesn’t support Jython at all! (Discover this after spending hours the night before debugging, thinking you were doing something wrong) Now you consider moving to straight up Python and using the Cheetah template engine, but you become aware of FreeMarker through the flame-war inspiring intervention of one of its’ developers in the velocity-users mailing list. Syntax is similar enough, and it supports Jython! So you finish building out the scoring system and create some sweet templates for your standings page:
< #assign num=1>
< #list standings as s>
<tr <#if ((num %2) = 0)>class="shadedrow" >
< #assign num= num+1>

Get the rest of the standings template and the schedule template.

Wrap it all together with a small driver to load the templates, crank up the freemarker engine, and write out the output as I did here. (Note apparently the JythonWrapper is not really needed – i was chasing a bug with java dates that has since been fixed)

Now we’re almost done – one of these days need to convert the templates of the static pages to freemarker (or freemarkerpp) and then we’ll really be done – for now we’re done enough. Now keeping the scores and standings updated is breathakingly easy! It only took an order of magnitude more time to get this all written and working than it would have taken to actually do the manual edits over time. Oh well, that’s just the way we engineers roll I guess.

Thanks to the velocity-users group for their help trying to get Jython to work for me, as well as Jonathon of the FreeMarker project for introducing me to his project and providing a push in the right direction getting my system working, as well as responding quickly to a problem formatting java.util.Date objects embedded in jython objects.