Category Archives: Computing

The Application

The company I used to work for, like so many, had a lottery pool for playing the MegaMillions lottery. A few years ago, I wrote a simple VB program that read a CSV file, which stored everyone’s “lucky numbers” (little evidence exists that these are, in fact at all lucky) and after you entered the latest draw, displayed a visual representation of the results (see right).

Now, I’ve never had much luck with the widget-style programming exercises. Things like the awful Northwind database examples in Microsoft Access, and countless recipe XML samples have always left me cold. So I decided that I needed to pick something that had some “use” even if it was something as mundane as matching numbers in a lottery. I figured that this would give me a reasonable target, it would cover some basic Rails concepts, and would remain interesting enough to go that extra mile in order to get it to work the way I wanted.

First up, I needed to poke around in the Interactive Ruby shell to get a handle on the text manipulation functions. Stuff like “split” and CSV handling, brush up on my RegExp, and other such things. It also gave me a chance to experiment with some of the lessons I learned through online tutorials. Once I’d played around a bit, I felt that I should shift to the Rails model and start designing.

Intermission – Install Debian on an old IBM Thinkpad 240

Why did I decide to do this? Completely sucked two days of my life. Who knew that the lack of a CDROM, or more precisely, a reliably working CDROM, would have made this so difficult. I doesn’t seem unreasonable to be able to perform an install from any medium. Having found DOS drivers for USB devices, including a thumb drive, It really thought this was going to be a snap. In the end the USB CDROM drive performed long enough for the installation to work. So now I have a little 10″ IBM Thinkpad 240 running Linux. It’s just a shame that the battery life on this little thing is about 10 minutes!

Setting up the development environment

OK. So against all advice I’m going to be working on a Windows XP setup. There are several good reasons for this, that I won’t bore you with, and many bad reasons, which although outnumber the good ones, would cause me massive organizational problems.

For this I’ve downloaded InstantRails. I’ve done a lot of enterprise software installations in my time, and quite frankly, had my fill of tweaking massive and annoying Apache configurations. When I first came across WAMP, some years ago, I thought it was the best thing since sliced bread. It couldn’t have been easier. I expected a similar experience with InstantRails. Sadly, this really wasn’t the case.

Firstly, it’s old, so get ready for some upgrading once it’s installed. Secondly, there are a couple of things that just didn’t fly. Possibly, because I’d already installed Ruby on this box and the environment variables were tripping over each other (this was definitely one of the culprits).

The MySQL part of the image was surprisingly messed up.

  • The libmysql.dll file was missing in the ruby/bin directory. I needed to copy that from the mysql/bin directory.
  • I was getting “Error #2003 The server is not responding“, which turned out to be a Windows specific problem associated with ODBC. The fix is to:
  1. Log in to mySQL as root. Open a Command Window, cd to the app directory (probably ‘depot’ in your case), and enter: mysql -u root -p Then just hit enter when prompted for the root password, or enter one if you’ve set one up for the root user.
  2. Enter the following line to grant access to the “ODBC” user grant all on depot_development.* to ‘ODBC’@’localhost‘;
  3. Exit

There were several other headaches, which amidst the shouting, cursing and thumping of desk and floor, I failed to document.

The only other thing I need to do each time I start InstantRails is manually run mysqld.exe from the mysql/bin directory. Possibly because it’s conflicting with an ancient MySQL installation on this box, who knows.

After all of this, which ended up taking a couple of days, I ended up with a functioning setup. Now to decide on my first app.

Ruby and Ruby on Rails

At the suggestion of an old programming friend of mine, I’ve decided to teach myself Ruby and Ruby on Rails.

Ruby seemed like a good idea. Scripting languages have always been an important aspect of how I use computers, and the opportunity to select a single language that will work across multiple operating systems is very seductive.

I’m starting completely from scratch on this one, so I fully expect to encounter some interesting and challenging problems, which I intend to document in this blog.

I started this process a couple of months ago, so the first few entries in this will be an attempt to transcribe my development/learning diaries into this blog format.