Archive for March, 2007

Java only gets 10mpg

Monday, March 26th, 2007

I’ve never been a huge Philip Greenspun fanboy, but anybody who disses Java and SUV’s in one fell swoop deserves a link. Yeah, the quotes is as old as the hills (2003), but it’s new to me. And now I’m subjecting you to it, probably again.

A project done in Java will cost 5 times as much, take twice as long, and be harder to maintain than a project done in a scripting language such as PHP or Perl. People who are serious about getting the job done on time and under budget will use tools such as Visual Basic (controlled all the machines that decoded the human genome). But the programmers and managers using Java will feel good about themselves because they are using a tool that, in theory, has a lot of power for handling problems of tremendous complexity. Just like the suburbanite who drives his SUV to the 7-11 on a paved road but feels good because in theory he could climb a 45-degree dirt slope. If a programmer is attacking a truly difficult problem he or she will generally have to use a language with systems programming and dynamic type extension capability, such as Lisp. This corresponds to the situation in which my friend, the proud owner of an original-style Hummer, got stuck in the sand on his first off-road excursion; an SUV can’t handle a true off-road adventure for which a tracked vehicle is required.

I experience this first hand every day. All the Java code I work with could be done just as well if not better in maybe 1/10th as much code in any of the much-maligned “scripting” languages. Plus it would be easier to test and maintain. What does the “strength” of Java buy? Nothing.

I owe Stan a pitcher

Saturday, March 24th, 2007

UCLA beat KU by 13 in the “elite eight,” so per the terms of our bet, I owe Stan a pitcher of beer.  Let me know when you’d like to collect, Stan.

Removing duplicate tracks from iTunes with Ruby and RBOSA

Saturday, March 24th, 2007

When I put a new hard drive in my computer, I decided to reinstall the operating system and install applications and data from scratch. Unfortunately, I had a small mishap and accidentally imported two copies of my iTunes library. Removing duplicates by hand would have been possible, but it would have been tedious as well. Mercifully, I stumbled on to RBOSA, so I was able to let the computer do it.

RBOSA is basically Applescript for people who never got around to learning Applescript. The interface to things like iTunes is very simple, so it didn’t really take a lot of work to get something to find duplicates up and running.

The strategy I used was to look at songs in the main library (the method I used for finding the “main library” looks kind of suspect, but it worked. Use caution if you try this at home) and put all duplicates in to a new playlist. Once they were there, I was able to check them over to make sure that they were dups and delete them.

Now, if you’re playing the home game and you know the secret trick for finding and deleting large groups of duplicates (around 8,500 tracks in this case) without busting out the programming: please tell me. I’m pretty sure that I’ll need to do this again at some point, and I’m all about doing things the easy way.

Follows is the script. I used Ruby 1.8.6 and RubyOSA 0.3.0.1 (installed via gem.)

require 'rubygems'
require 'rbosa'

itunes = OSA.app 'iTunes'

dups = itunes.make OSA::ITunes::Playlist
dups.name = 'Duplicate Tracks'

class OSA::ITunes::Track
  def eql?(o)
    artist == o.artist &&
      album == o.album &&
      track_number == o.track_number &&
      name == o.name &&
      time == o.time
  end
  def hash
    to_s.hash
  end
  def to_s
    "#{artist}/#{album}/#{track_number}/#{name}/#{time}"
  end
end

seen = Hash.new
itunes.sources[0].playlists[0].tracks.each do |track|
  seen[track] ||= Array.new
  seen[track] << track
end

seen.values.each do |tracks|
  if 1 < tracks.length
    # Keep the file with the largest bitrate.
    tracks = tracks.sort { |a,b| b.bit_rate <=> a.bit_rate }
    keep, rest = tracks[0], tracks[1..-1]
    rest.each { |t| t.duplicate dups }
  end
end

KU by 1.5

Friday, March 23rd, 2007

I’m totally going to extend my sports betting streak.  In this Saturday’s KU v. UCLA game, I have KU by a point and a half against Stan.  A pitcher to the winner.

Lazyweb: Round trip XSD to BNF?

Friday, March 23rd, 2007

So I’ve got this XSD file that describes some data that I need to generate. This pleases me. Having a schema is always Martha Stewart. However: Damn do I hate reading XML. I don’t know why those Java people get in to it quite so much.

So what I want to know is this: Has anybody written a tool that will go from XSD to something BNF-ish and back again? I would love to be able to edit (or even just read!) a grammar in a way that makes sense (i.e., not XML) but still have the computer be able to easily do its thing with the XSD file.

It is official.

Friday, March 23rd, 2007

I owe Pat a pitcher at Delerium. Let me know when you want to collect, Pat.

Hello World

Friday, March 23rd, 2007

I moved. Sort of. I switched blogging software, that is. Turns out that it’s easier to monkey about with software than it is to write something interesting. Who knew?

Anyway, enjoy. Permalinks from the old site are almost certainly broken, as are countless other features. Features that you never even knew were here. Because they weren’t.

Local Service Reviews: Di-No Computers and Gem Plumbing

Thursday, March 22nd, 2007

I recently worked with two local service providers: Gem Plumbing and Di-No Computers. Both got the job done both quickly and well. I recommend both.

We called Gem a few weeks back when the line running from our bathroom backed up. The disclosure statement for the house suggested that this would happen and that we would indeed have to just get it snaked out every six months or so. My experience with plumbers so far has been mixed. They get the job done, but I have had to sit around for hours waiting for them to show up. I don’t like waiting.

Gem showed up exactly when they said they would. In fact, they called an hour before they were supposed to be there and said that they could get started early if I wanted them to. As I don’t like waiting, this on its own is golden.

When they got to the house, we pointed them to the room, gave our layman’s take on what was up and got out of the way.

Less than half an hour after that we had a functioning drain, an explination as to where the problem was and why it wasn’t any of the other things we thought it might have been and a few things we could do if we wanted to solve the problem permanently. So, yeah. A positive experience to say the least.

Di-No fixes Apple computers. When I bricked my laptop the other day, I called the Apple store who cringed, said that it sounded like an ugly and expensive problem, and referred me to Di-No. I gave Di-No a quick call, verified that they are indeed open during lunch, (why did I think that they wouldn’t be?) took the machine over to them and told them how I had broken it.

The only down side to Di-No is that they weren’t even able to look at the computer for almost a week. (There is a very visible sign on their front desk stating when they will be able to get to your computer, so there were absolutely no surprises involved.) However, once they did, they ordered a replacement part and had it back in to my hands within two days. Further, the repair was all done under warranty, so not one thin dime came out of my pocket. When I picked the computer up, they strongly recommended that I purchase AppleCare, as my factory warranty will run out in May. I think I’ll take them up on that.

If you need a Mac fixed or a drain snaked, you know where to go.

It’s easy to not look like a homer when your team is a 1 seed

Thursday, March 15th, 2007

I will win each and every pool that I’m in with my bracket of might. FYI.

Sometimes you eat the bear…

Wednesday, March 14th, 2007

Yesterday was one of those days when both crappy and really, really good things happen. It’s a bummer that the bad goes down, but at least the good is there to balance things out.

So, the bad. I’m out of disk space on my laptop. Very, very out of disk space, to the point where I can’t do many things that I need to do. I got an external hard drive, and that sort of helped, but it was really too inconvenient for regular use. So, rocket scientist that I am, I replaced the hard drive with a much larger one and accidentally pulled the keyboard ribbon off the motherboard in the process. Oops. I now own a very expensive Apple-branded brick. (Although it’s an Apple-branded brick with a bitchin’ hard drive.) We’ll see if Di-No can fix it.

However, this was more than balanced out by the fact that Stephanie spent all day working yesterday to get the hot tub up and running. It is now fully operational. Which is rather more than braggable. Before bed last night, we poured a couple of cool beverages, turned the jets on, jumped in and watched the first half of Mr. Blandings Builds His Dream House on her (still functional) laptop. It was quite great.


This is a free Wordpress template provided by Mathew Browne | Web Design | SEO