Leigh’s new blog

March 7th, 2006
 

She’s got a new look, she’s single and she’s got a new blog to boot. After about a year of prodding, Leigh has finally broken down and started a blog. She even wrote a political post already. It’s been a long time coming, but she finally has updated her site!

Double Muff

March 2nd, 2006
 

I admit it, I’m a guitar snob. I have an 18 watt, point-to-point hand wired amp, a totally stellar guitar, and numerous boutique effects pedals. So when I wanted a fuzz pedal this weekend, I went to the local music store to check out some pedals. I was fully expecting to try a couple, be disappointed with the sound, and leave. The first pedal I tried was the Jimmy Hendrix Octave fuzz, which had an interesting sound, but was a one-trick pony. It was also $130, so it was out. The salesman then brought up a Double Muff, and it was KILLER. It’s one of the most responsive pedals I’ve ever played through. It’s also got a creamy rich tone with a beautiful crackle-metallic edge. Backing off the volume cleans up the tone in a very controllable fashion, making it simple to go from clean to unbelievably saturated.

So, I decided to buy the thing, and to my complete surprise, it was $52; extremely cheap for a pedal with such fantastic tone. There are a couple flies in the ointment though, the pedal is a bit large despite the simple circuit. Also, the inputs and outputs are at the top of the pedal, which is very different than every other pedal in my pedal board. On top of this, it uses an 1/8″ power plug unlike every other pedal I have. The pedal is also very sensitive to placement. You need to put it first on the pedal board, or all the stank comes out of it.

But these are minor inconveniences, my pedal board actually came with an 1/8″ plug, and a bit of judicious cable routing solved the strange jack placement. In the end, the Double Muff delivers the goods and for a price that just sweetens the deal.

The carnival of ignorance

February 27th, 2006
 

I saw the Darwin is Dead carnival over at one of my favorite science blogs, Pharyngula, and what a bunch of ignorant drivel.

It’s hosted by a pathologically stupid creationist, Radar, who in turn links to other non-thinkers. It’s the standard creationist fare of anti-evolution arguments but with a few new twists. We get the standard “If humans evolved from apes, why are there still apes?” argument, but I do believe this one is new:

An eternal universe is not possible either. You cannot count to infinity. No matter how long you count you will always have a finite set of numbers. Likewise, you cannot have an infinite series of events into the past.

You know, I wouldn’t believe in infinity either, but this guy makes a great case for infinite ignorance. It’s painful to hear such nonsensical ramblings being pawned off as thought. By his definition, a trillion doesn’t exist since you can’t count to it either(well, you could, but it would take around 31,000 years). He’s also basically disproved god, being that the universe is eternal and all. Just gotta love how god conveniently skirts all the questions that anti-evolutionists throw at science. Additionally, when did evolution ever say how or when the universe was created? I thought –rightly– that it just talks about how life on earth began and continued over the past several billion years.

I read the comments on both sites, and it’s actually hard to believe that people like this exist. They’re so warped by their religion (all of them are Christians, natch) that they cannot accept facts that have attained a remarkable consensus in the scientific world. Granted, they don’t have much education, Mr. Infinity only has an associates degree, but these people are the ones responsible for getting solid science removed from our nation’s classrooms. Well, Radar, your right to practice your religion ends at my brain, so believe that the world was created 6000 years ago (as evidenced by this post) but just keep quiet about this issue, because you have no idea what you’re talking about.

Reality Intrudes

February 21st, 2006
 

Don’t you hate it when reality steps all over your pre-conceived notions?

Every morning, when I run along the bay, I see an old lady with her dog. She doesn’t move very fast, but she’s out there rain or shine. I’ve never said anything to her, but I have a commanding respect for her because she’s still trying to get some exercise even though it’s obviously difficult for her.

Today during my run, I see the old woman, but something is odd. Usually when I’m heading out, she’s approaching me, but today she’s headed back the other way. This is extremely strange until I see the reason why. Her dog just took a massive dump in the middle of the jogging path, and she wasn’t going to pick it up. My mind raced… Maybe it wasn’t her? No, there’s no one else around and there was no other access to the path at that point. Maybe the poop is old? No, it’s steaming (California, believe it or not is quite chilly in the morning). Damn, it was the old lady’s dog.

So I had a dilemma –do I say something to her or just keep running. Not wanting my first words to her to be accusatory, I just kept on running, but it really stinks to know that her dog is the one who has been messing up the trail. Now instead of being the old sweet lady that’s out there every day, she’ll be the poop lady.

WTF?

January 23rd, 2006
 

Orion pointed me to a site on Friday, called the The daily WTF?, and it’s great. It contains totally terrible code snippets that are supposedly pulled from actual production code. This example looks unbelievable, but it’s actually similar to code I have seen before.

When I first started in the eCommerce department back in 1997, the site was re-done by a company called Proxima (they later changed their name to the much more internety Proxicom). As I was browsing around the date code, I noticed a function called getMonthOptions(), which had a similar implementation:

function getMonthOptions(fieldName,currentMonth) {
   monthOptions = "";
   if ( currentMonth == 1) {
      monthOptions += "<option name=\"" +
      fieldName +
      "\" value=\"1\"" +
      " selected="true">January</option>";
   } else {
      monthOptions += "<option name=\""  +
        fieldName + "\" value=\"1\"" +
        ">January</option>";
   }
   if ( currentMonth == 2 ){
      monthOptions += "<option name=\""
         + fieldName + "\" value=\"2\"" +
         " selected="true">February</option>";
   } else {
      monthOptions += "<option name=\"" +
     fieldName + "\" value=\"2\"" +
     ">February</option>";
   }

….and on and on.

So, I replaced that code with something like:

function getMonthOptions(currentMonth) {
   var months = ",January,February,March," +
     "April,May,June,July,August," +
     "September,October,November,December".split(",");
   monthOptions = "";
   for(var i=1; i < months.length; i++) {
       monthOptions += "<option  value=\"" +
          months[i] + “\” “;
      if ( i == parseInt(currentMonth)) {
        monthOptions += ” selected=\”true\”";
      }
      monthOptions += “>” + months[i] + “</option>”;

   }
return monthOptions;
}

…and that was that.

Still, it struck me as odd that seasoned consultants would write such verbose code. However, After reading the daily WTF it appears that those consultants were actually pretty good.

The code is good for a laugh or two, but to find what’s really interesting about the site, you have to pull back the covers a little bit. First off, there are a lot of people who totally miss the WTF moment and instead post something like “he names the variables poorly”. That leads me to believe that they probably implemented something like the WTF in the past. Also interesting is the total commitment the administrator has to Microsoft. A while back, the site had a few performance problems, but he couldn’t afford to upgrade the site to Windows Server 2003 with SQL server. The upgrade would have cost him $2500, but he refused to entertain running on open source software. “Dirty hippie software” he derisively called it. What’s amusing is that he’s running some vanilla discussion software and that going open source would have saved him all that grief –someone eventually donated Windows Server Small Business Edition to him, but only after a couple of weeks of protracted whining. Furthermore, his coding skills aren’t that great; At one point, he had to ask how to serialize a HashTable (it’s C#, note the funny capitalization) to a byte array –not really challenging stuff.

Still, it’s a good read and allows me to re-live those days when I would marvel at the ways of the consultants. I might not like every line of code at work but none if it is even remotely as bad as a daily WTF.

Ruby: Yeah, me too.

January 15th, 2006
 

I’ve been using Ruby and rails at work for about a month now, and I have to say, it’s really growing on me.
From the beginning, I was amazed at how much you can do with so little code. It’s been a month, and I have some impressions. They’re not unique (it seems that everyone is playing with Ruby recently), but they’re mine.

First off, I love the terseness of the language. It’s amazing what you can do with one line of code, compare:
Java:

  Iterator i = list.iterator();
  while ( i.hasNext()) {
      Object o = i.next();
      if ( o == null ) {
         i.remove();
      }
  }
 

Ruby:

list.compact

Granted, that might not be the best example, since compact is built in to arrays in ruby, however, this does the same thing

list.reject{|element| element.nil?}

And the amazing part is that you get this type of reduction in total lines of code everywhere. Since we’re developing a web based application, we’ve been using Rails as well. Rails brings Ruby’s speed of development to the web. Coming from a Struts based application, it’s really shocking how quickly you can create a model, view and controller. This speed benefits your architecture as well –if it’s easy to make a new MVC, then you’re more apt to do it, rather than adding additional code to one that’s already there.

Rails does have its faults, and they impact both the speed at which you develop, and the Object Oriented nature of the code you write.

First off, ActiveRecord, Rails’s persistence mechanism, uses single table inheritance. This doesn’t seem to be such a bad thing at first –after all, Hibernate, OJB and just about every other O/R layer offer this feature as well. Where ActiveRecord breaks down is that it doesn’t have a mapping layer. Instead, all objects are built directly from database metadata. Most of the time, this works very well, as O/R layers generally map an object directly on to a database table, and ActiveRecord saves you this tedious and error prone step. However, if you use single table inheritance, that database table has the superset of all methods available for all objects in the inheritance hierarchy. This means that objects gain methods that they shouldn’t have, and there is no way to prevent them from having these extra methods. This is truly bad for object orientation, as you can’t define exactly what methods your objects expose. Sure, you can ‘know’ what method each type exposes, but that’s akin to sticking your fingers in your ears and screaming “I’m using OO programming techniques!!! LA LA LA!!!”, which, as we all know, doesn’t mean you’re programming in an OO manner. I’d suggest being able to tell ActiveRecord which methods an object should receive, like this:

   class Article
      methods :title,:description,:text
   end
   class NewspaperArtice <Article
      methods :byline, :run_date
   end
   class MagazineArticle < Article
     methods :author,:magazine_title,:issue_date
   end

In this example, the database would have the colums title, description, text, byline, run_data, author, magazine_title and issue_date.

Second, the documentation is atrocious. Being a java programmer, I’m used to excellent documentation. JavaDoc is a godsend for programming, and Java’s documentation is thorough, complete and correct. Even the open source Java projects have continued this tradition. Sadly, it’s not so in the Ruby world. Part of this comes from Ruby’s dynamism, it’s impossible to tell exactly how objects have been changed in any execution environment. How, for instance do you communicate that Ruby on rails added several methods to numeric objects? However, most of the documentation is just inadequate. I’ve looked extensively at the rails docs, and have yet to find a good explanation of how exactly I can configure routes.rb. this is no help. Where’s the documentation for the rails request object? Where is the testing documentation? Sadly, Google is more of a help for figuring out what to do in rails than any of their documentation. However, docs are an easily fixable problem, and I expect them to improve rapidly, now that rails has a high profile.

Still, ruby and rails are extremely valuable tools to have in your belt, and even with the above flaws, are worth using. The productivity increases are amazing. I’ve developed two projects in rails so far, one for work and one for a family friend. The project for work went as smoothly as any I’ve ever been on, and –get this– the one for the family friend was completed in the two week window that I was waiting for a design firm to re-do the mockups to use CSS. The original java implementation took months.
Yeah, it’s nice to be able to code a web app in the same amount of time it takes brain dead designers to do CSS.

My mom, the hacker

December 7th, 2005
 

I’ll bet you didn’t know that my mom is an 1337 h4×0r. I was talking to her this weekend, when she had a question. She said she went to a web site, and when she entered the URL from the magazine that was reading, the blue bar on safari would only get to the w.

This actually wasn’t that bad of a description. When I typed the URL she gave me, the browser just spun and didn’t download anything. Stranger still, it didn’t time out after 60 seconds. If the server is doing what I think it’s doing, this could be used to DOS the web site. As it turns out, I can replicate the behavior on any of their pages, simply by adding characters to the end of the URL. I’ve sent them a note, but if I know large corporations should land in an inbox somewhere about 3,000 miles away from the person that can actually do something about it.

Here’s hoping it’s not serious.

Finally catching on

November 17th, 2005
 

I haven’t blogged about politics in quite some time, but this is too sweet. Apparently America is starting to wake from its slumber of ignorance and realize what a truly incompetent leader they have chosen. What gets me is that 34% of people still have a positive impression of Bush. One of the guys I work with (Michael) says that his approval rating will never go below 10% because 10% of people are so ignorant that they’ll never change their opinion. Kinda sounds like someone in a high office, no?

jUploadr 0.8

October 30th, 2005
 

I released jUploadr 0.8 today. It’s really getting solid, and there are improvements over 0.7 across the board. I added a ton of features, fixed all the open bugs, and improved the usability.
It’s a spectacularly solid release, and eclipses the official uploader’s feature set. I finally got to see the official flickr uploader in action and was quite underwhelmed. jUploadr allows you much more flexibility in setting tags and descriptions, as well as allowing you to add photos to existing sets.

Anyway, go grab it while it’s hot.

Gnu’s Incompatible Java

October 12th, 2005
 

I’ve had a couple head-scratcher bugs from a couple of jUploadr users, and unfortunately, they all have the same cause.
The users were complaining about random crashes, and especially scary, the inability to save their preferences. After asking in vein what the trouble was, one of them sent me in a stack trace. From the trace, it was obvious what the problem was –she was using GIJ.

Since Java isn’t free software (free as in free speech, it costs nothing to download) most Linux distributions don’t include it by default. However, they’ve started including a free version of Java called GIJ/GCJ. GIJ/GCJ are front ends for GCC, the venerable C/C++ compiler and they’re fantastic projects, but GCJ/GIJ are not mature enough for distribution. There are huge swaths of the standard Java API that they don’t provide, including support for saving and loading application preferences. The end result is that when a user tries my application under this system, it just doesn’t work.

Java currently suffers from a reputation of sluggish performance, funny looking UIs and strange error messages, and GIJ just adds to these perceptions. It’s no small feat to write an application that runs unmodified on three separate operating systems unless you use Java. It’s sad that the free software umbrella –which brought you jUploadr, and all of the libraries that it uses– also makes that more difficult.