Activation Hell

People used to ask me “Why do you use Linux on your desktop?” Now they ask me “Why do you like Apple?” Here’s why:

Somewhere, deep in the bowels of Microsoft, there is a person who’s sole responsibility is to make other people miserable. After dealing with Windows XP activation for the last few days, I know this must be true.

In my spare time I’m reloading Windows on some old Dell GX280s that are being placed in a computer lab. This should be a no-brainer. Load the OS, install antivirus, download 85 updates, install Office, and you’re done.

This would be the case if it weren’t for one simple step – online activation. The first two I reloaded worked perfectly. The online activation happened almost instantly. Things went south on the third system. Online activation failed.

activation.png

It’s not like I’m a pirate. These are Dell systems with the original Certificates of Authenticity stickers still attached. Now I get to call Microsoft.

Step one, read 54 numbers to a computer. Step two, answer a few personal questions. Here’s a hint: you’ve installed this copy of XP on one computer, and yes you have upgraded hardware. Step three, type in 54 different numbers as the computer reads them back to you.

Thankfully I’m only doing 5 of these. I feel sorry for whichever one of my employees gets to do the other 45…

Ruby Generators

In my continuing quest to expand my knowledge of all things Computer Science, I stumbled across the Generator topic on Wikipedia. I ended up here after reading an excerpt from Python Cookbook.

The Wikipedia article describes a generator as something that looks like a function but behaves like an iterator. The interesting thing to me is that they can be used to build endless lists.

For example, the Python Cookbook gives several generators that will list all prime numbers (given enough time). The Wikipedia article gives another way of generating prime numbers.

I was surprised that Ruby wasn’t mentioned in the Wikipedia article so I set off on a search for information about Ruby generators. Unfortunately, most of what I found was dealing with code generators for Rails which is something else entirely.

The Ruby Documentation contains a description of the Generator class with a brief example. I was able to use this to convert Wikipedia’s simple prime number generator to Ruby.

require 'generator'

g = Generator.new do |g|
  n = 2
  p = []

  while true
    if p.all? { |f| n % f != 0 }
      g.yield n
      p << n
    end
    n += 1
  end
end

Using this code, each time you call g.next it will return the next prime number starting with 2. For example, this will print the first 25 prime numbers:

for i in 1..25
  puts g.next
end

If you examine the source code in both Python and Ruby you’ll find that they are remarkably similar. The only change is basically replacing Python’s any function with a call to Ruby’s Enumerable#all?.

The more I learn about Python and Ruby, the more similar I realize they are. I have yet to find anything in Python that can’t be done just as easily in Ruby or vice-versa.

Facebook Developer Garage

It’s not too late to sign up for Facebook Developer Garage Dallas. The event is being held at SMU on Tuesday, November 13 from 10:00 a.m. until 4:30 p.m.

Dave Morin, Senior Platform Manager at Facebook will be speaking in the morning. As will Lee Lorenzen. Lunch will include at least four lightning round demos.

Three more speakers will present after lunch, followed by a panel discussion. There will be an after party at Trinity Hall sponsored by Joyent starting at 5:00 p.m.

The Facebook event page currently lists 52 confirmed guests and 33 people who might attend. I will attend, but unfortunately I won’t get there until 1:00 p.m.

Go to the Eventbright Page to register. Also, check out the Facebook Developers Dallas Group for all the details.

This is a great opportunity for developers and entrepreneurs around Dallas. These events usually only happen in California or on the East Coast.

Dallas.rb

I attended my first meeting of the Dallas Ruby Brigade last night. It was a lot of fun. Adam Keys and Geoffrey Dagley did a little ping-pong pair programming. They worked on the Credit Card Problem on Ruby Quiz.

It’s always interesting to see someone else’s code, but to be able to watch them right it was really enlightening. Geoff and Adam took turns writing specs and then adding the code to satisfy the spec.

I’ve done a little test driven development, but never behavior driven development with RSpec. I can see where it would come in handy when dealing with a non-technical client.

Adam demonstrated some serious Ruby-fu when solving the Luhn algorithm part of the quiz. I found a good article on Vitamin that talks about some of the array tricks he was doing.

Unfortunately I got tied up in traffic and didn’t make it to Freebirds before the meeting. I will be there next month.

SICP

As I mentioned yesterday, I’m starting to work my way through the Structure and Interpretation of Computer Programs. Here are a few links that should help you get started if you’d like to follow in my footsteps.

First, you should know that the full text of the book is available online for free. It’s also available for purchase at Amazon.com, but it costs $69.51.

You can watch the the SICP lectures on Google Video. You can also download these videos in high quality and reformatted for the iPod.

Since you’re going to be programming in Scheme, you’ll need an interpreter. I’ve had good luck with DrScheme on both Windows and Macintosh. They also have a Linux version available.

The main thing you’ll need to get through this book is time. Unfortunately, I haven’t found a way to link to that yet. If you come across a link to some spare time, be sure to leave a comment below so I can have some, too.

A Social Experiment

I’m a big fan of the social bookmarking site reddit.com. Basically anyone can submit a link and then everyone votes on it to decide if it’s actually worth reading or not. Good links move up and bad links just go away.

Another nice thing about reddit are the subreddits. These are reddit subdomains that focus on a particular topic. Since I consider myself a programmer, I’m most fond of the programming subreddit.

I’ve been going to reddit for months, but I’ve never submitted anything. I was curious about exactly how it worked, so last night I decided to submit my post about The Little Schemer to the programming subreddit.

Submitting The Link

First, I was surprised to see my link appear on the front page. I thought links appeared first on the new page and only moved to the front page after they got a certain number of votes.

I refreshed the front page every few minutes to see what would happen. I got one up-vote almost immediately. I guess someone liked the book and thought they would up-vote my post just for the title. A few minutes later and it was back down to 1 point.

I got my first (and only) comment a few minutes later. Here it is in its entirety:

If this guy read SICP I think his head would explode 🙂

That’s probably true. I tried reading SICP once, but didn’t get very far. Structure and Interpretation of Computer Programs is the text book used in the introductory computer science class at MIT.

After about 25 minutes, my post was down-voted again and disappeared from the front page. That was the end of my fun.

The Results

I normally get around 3-4 visitors per day to this site. Yesterday, I got 145. That’s not bad considering my link was on the front page for less than 30 minutes.

The comment on reddit was helpful, if a little terse. I really should try to read SICP again now that I know a little more about Scheme. I also got a comment on this site from a friendly guy named Tim Wee.

Overall this was a good experience. Most visitors to reddit tend to be friendly. That’s one reason I go there instead of Digg or Slashdot. I’ll probably post something else to reddit one of these days, once I finish reading SICP.

The Little Schemer

So, you think you know a lot about programming? I’ve been writing code since my senior year in high school. That’s 14 years. I’ve written code in more languages than I care to remember – C, C++, Assembly, Pascal, COBOL, Java, Perl, VBScript, JavaScript, PHP, Ruby, Python, Unix Shell.

I thought I knew a lot about programming, until I started reading The Little Schemer. This is a book that literally blew my mind. As soon as I started reading it I thought I can’t wait to finish this and start reading The Seasoned Schemer.

Once I got about halfway through the book I realized that I wouldn’t be able to do that. Instead, when I finished the book I immediately started reading it again. I’ve never done that with any book before. The Little Schemer is really that good. I’m on my third reading now.

What makes it so great? It teaches a whole new way of looking at programming problems. Not only that, it uses a unique method of teaching. Instead of the usual dull paragraphs followed by pages of code, this book is a humorous series of questions and answers. The authors never really tell you anything. They let you figure things out for yourself.

Even more interesting is the authors’ choice to talk about the Scheme programming language. As I said earlier, I’ve written a lot of code, but never any Scheme. Scheme is a dialect of the Lisp language. Here’s what Eric S. Raymond has to say about learning Lisp:

Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot.

After reading The Little Schemer, I believe that quote. No matter what language you program in, this book is worth reading. Even if you have no experience with Lisp, by the time you finish studying this book you’ll be able to write your own Scheme interpreter.

Several other programmers have taken ideas from The Little Schemer and applied them into other languages. One of my favorites is The Little JavaScripter by Douglas Crockford. Douglas Crockford is a genius JavaScript programmer. He took all of the code from the book and translated it into JavaScript, including the Scheme interpreter.

Another interesting book to check out if you enjoy this style of learning is A Little Ruby by Brian Marick. This is just a draft of the first three chapters of the book, but I sincerely hope he finishes it someday.

Enjoy these links, I’ve got to get back to reading.

NaBloPoMo

I was all set to write an entry about NaNoWriMo – National Novel Writing Month. I’ve been following the site for a couple years now wishing I had time to participate. A few months ago I decided I was finally going to do it.

The basic idea is you write an entire 50,000 word novel in the month of November. That means around 1666 words per day. So for 30 days you spend all of your spare time writing. The idea is you don’t worry about editing or making it perfect, you just write.

As usual, I’m pretty busy with other projects right now, so I’ve decided to put off NaNoWriMo for another year. I don’t imagine my situation will be drastically different next year, but time will tell.

As a bit of a consolation to myself, I decided to instead participate in NaBloPoMo – National Blog Posting Month. This seems almost easy by comparison. All you have to do is write one blog post per day for the month of November.

I’m off to a pretty rocky start since this is November 2nd and I didn’t post anything yesterday. But I’m not going to let that slow me down. I’ll just have to write two posts on one of the other days to make up for it.

I have a few posts lined up already including some updates to my video website that I mentioned a while back. So far it’s just a quick hack in Perl, but I hope to recreate it in Rails and Django by the end of the month.