Skip to content

Christopher Miles

These are the stories that have been posted by Christopher Miles category.

Wherein the Author Promises to Blog More Often


Published to miscellaneous, etc. by Christopher Miles March 25, 2008 17:29

I know I’ve said it a million times before, but I’m going to try and do better with the blog. All of my cool friends have lively blogs and I really should have one too. I mean, lets admit it: I am that interesting. ;)

Like everyone else in the Western MA Developer’s Group, I have been playing with Clojure. Rich Hickey did an extremely interesting presentation on Clojure for the group and it made a strong impression on all of us.

I do a lot of web application development and I found a couple things really interesting. The way Clojure has been designed to minimize mutability and the idea of managing memory in a transactional way make the development of applications with a lot of concurrency really easy. Rich showed us a short demonstration program that simulated some ants running around for food and it was very exciting to see. Every ant was doing it’s own thing, there wasn’t any code for managing locks and it was all very concise.

Which is the other thing I found really exciting: the brevity. I’ve been coding Java for many moons and it’s true, I admit it: Java code is wordy. So is a lot of C and C++, certainly Objective C is also right up there. But still, it was very exciting to see something interesting happening with such little code. It wasn’t particularly difficult to understand, Rich walked us through it pretty much line by line and I was surprised to see it mostly making sense to me.

Clojure is a Lisp and the last time I looked at a Lisp I ended up with a headache. It was the sort of headache that makes you feel slow and stupid. Lisp has always looked weird to me and I’ve taken a stab at it a couple of times but I think I just wasn’t interested enough. After Rich’s talk, I can actually see problems that Clojure can actually help me solve. I’m going back over some books and example programs and I have to say it’s really exciting. Coming from languages like Java and C, it all seems so much different, so novel.

I’ll try an post an article a week, I’ll also try to keep them all from being about Lisp and Clojure. :P

Her Data, My Data, Our Data


Published to miscellaneous, etc. by Christopher Miles November 29, 2007 20:40

At the last meeting of the Western MA Developers’ Group the subject of data and privacy protection came up (as it often does). Everyone had a story about this or that company letting a large amount of data into the wild and most of them were amusing anecdotes. Stories about developers loading live data into a test system and then making the test system publicly available. Stories about corporations mailing tapes of data to incorrect addresses via the postal service. Funny stuff.

As I was chuckling to myself about the story of some consultants for Hewlett Packard losing a laptop full of live employee data, I remembered something important: some of that data was mine! There was a time when HP was sending me a letter every couple of months, insisting that they would get the data back any minute and even if they did not, I shouldn’t worry as it was encrypted with space-age, unbreakable encryption.

That’s when I started to think about this data in an entirely different way: no matter who’s data is lost (Fidelity Mutual, Hewlett Packard, your local grocery store) odds are good that there is something about you in there. Corporations buy and sell our information on a daily basis, in other cases companies merge and our data is transferred from one to the other. I’m starting to think that this distinction between “my” data and everyone else’s data is mere wishful thinking.

This leads to my next thought: why can’t we get at our data? If I’m worried about Facebook sharing my data I can close my account. I can take a look at what they are sharing and make an educated decision. In the case of Citibank, I have no idea what they are collecting and where it’s going. Sure, I can get a credit report, but I’m not so naive as to think that’s all the data that Citibank is collecting. Hospital’s are the same way, why can’t I see my x-rays or test results?

Perhaps this is the new frontier in computing: letting people manage their data. Giving people the ability to see what data is being collected and where it’s going. It’s an interesting logistical problem.

My New Website Goes Live: AmigoCodes.com [1]


Published to miscellaneous, etc. by Christopher Miles June 12, 2007 17:52

I have just finished up my newest website, AmigoCodes.com. The site will store your “friend codes” for Nintendo DS games and then share them with people that you add to your list of “friends”. So far I’ve only tested it with a couple of people, so I’m leaving that “Beta” stamp on there for now.

Now that the site is live, I’m trying to drive some traffic to it. I have posted the story to my two favorite news sites, Digg and Reddit. If you have a minute, please check them out and maybe vote on my story.

This is my first real Ruby and Rails application, I am really curious to see how it handles the traffic. I did some load testing myself, but it’s not the same as having people sign up and actually interacting with the site. I also rely pretty heavily on Amazon’s ECS web service and I’m hoping that doesn’t end up slowing things down.

Fingers crossed!

I'm Even More of A Nerd than I had Thought


Published to miscellaneous, etc. by Christopher Miles May 23, 2007 11:57


I am nerdier than 91% of all people. Are you a nerd? Click here to find out!

Badi tagged me this morning and I had to find out my Nerd Score. The questionnaire is pretty short, some of these things make you slog through a zillion questions but this one wasn’t bad. I am surprised by my score: 91!

There were a couple easy questions that I missed, but my knowledge of the periodic table appears to have put me over the top. I blame you, freshmen-year Chemistry teacher!

Installing Ruby and Rails with MacPorts [1]


Published to miscellaneous, etc. by Christopher Miles March 22, 2007 17:18

I’ve been working on learning Ruby and getting Rails all figured out. It’s been a lot of fun and I’m pretty happy with the way it’s working out so far. For the last couple of years it’s been all Java all the time and it’s nice to take a break.

My first big task was to get Ruby and Rails working on my workstation. That sounds pretty easy and it is, sort of. There are many introductory tutorials and they get you to the point where you can run some Ruby code and put together a simple Rails project. But that’s where they leave you and it’s a little bit shy of actually deploying a real application. To quote Apple:

To do any serious Rails development you’ll want to install a production-quality web server, database server, and a few other goodies.

And I do. In fact, now that I’m thinking about it, I’d like to get as close to my deployment environment as possible. It’s a real server, it’s running FreeBSD and Apple’s always bragging on the “UNIX underpinnings” so this shouldn’t be too hard. So, yeah, I’d like to install Ruby and Rails, then Apache 2 and MySQL 5. That’d be totally kick ass, I could even move data between my deployment server and my workstation to troubleshoot.

Most of the tutorials don’t deal with these issues. Apple gives it a shot, but they recommend Locomotive. It’s a pretty nice product and I like a nice GUI just as much as the next guy, but this is the sort of thing I’ve become used to dealing with at the prompt. My server is managed from the prompt and maybe this makes me some kind of backwards knuckle-dragger, but I’ve grown to like it that way. I decided that these introductory articles simply are not for me and I needed to write my own (you are reading it now).

The FreeBSD server that I’ll be deploying my fancy new Ruby apps onto has this nice, relatively painless tool/system called port that manages installing and upgrading software. It took me a while to get used to, at first I would tell port to update this or that critical chunk of infrastructure (like PHP) and I’d literally bite my nails as my stomach did somersaults. After doing this for a while and nothing bad happening, I finally learned to de-clench and trust port to do it’s thing.

On Mac OS X we have two choices in this space:

Fink is definitely the road more traveled. I spent some time with Fink back in the day when I was running Panther. It’s modeled after the Debian system, I know very little about the Debian system for managing packages. MacPorts is closer to the FreeBSD port system that I know, so I picked that one (it used to be called “DarwinPorts”, if that rings a bell).

Install MacPorts

Installing MacPorts is pretty easy as long as you have the Xcode tools installed (install them now if you haven’t already). I won’t go over the steps for either here. Before you run over to their installation page and start clicking about willy-nilly, here’s a tip for you: skip directly to step 4.

Installing MacPorts

Once you’ve done that, add the two directories for the MacPorts commands to your path. Open up the terminal and bring up your profile. I used “vi” to do this, if you use TextMate (which you should) use “mate”. instead.

vi .profile

You might have an entry where you export your PATH already. Add this line or alter your existing path.

export PATH="/opt/local/bin:/opt/local/sbin:$PATH"

This puts the MacPorts commands (in /opt/local/…) first in your path. If you install something that Apple already has installed (like Ruby), you’ll use the MacPorts version instead of Apple’s. Exit your Terminal session and open another so that your change takes effect.

Now that MacPorts is installed, give it a chance to update itself and it’s tree of software.

sudo port selfupdate

MacPorts will phone home and get the current tree of software and set it up on your Macintosh. If necessary, it’ll download a new version of itself as well.

Install Apache

Now that MacPorts is all updated and running, you’re all set to install some software. We’ll install Apache 2 first.

sudo port -v install apache2

If you leave off the “-v” flag, you won’t see the output from the compile process. I like to see it so that I know something is actually happening. Port will download the source code for Apache 2, apply patches from the MacPorts project, compile it and then install it. If you haven’t done so already, make sure that “Personal Web Sharing” isn’t running on your Macintosh. You can click it off in the “Sharing” control panel inside the System Preferences application.

Port doesn’t setup a httpd.conf file as part of the install process. It does, however, leave us with a working sample one. We’ll copy that over and use it as a starting point.

cd /opt/local/apache2/conf cp httpd.conf.sample httpd.conf

Enable User Home Directory Serving

This configuration is pretty good, but it won’t serve up files in the Sites folder in your Home folder. You probably want that, I know that I do. Open up the httpd.conf file and scan for a couple lines that read:

# User home directories

#Include conf/extra/httpd-userdir.conf

Remove that hash-mark in front of the “Include” and Apache will start serving up your personal Sites folder. This is very nearly what we want except that the default rules for the user directories are a little too restrictive. Open up that file and take a look…

vi extra/httpd-userdir.conf

I am the master of my workstation, so I’ve configured mine like so:

<directory> AllowOverride ALL Options ALL </directory>

Order allow,deny Allow from all

This lets me do pretty much whatever I want via .htaccess files in my Sites folder. You want to do this too, when you deploy Rails applications they have a bunch of mod_rewrite rules to keep the URL’s looking pretty.

With that done, let Mac OS X know that you want it to startup Apache 2 when the Macintosh starts up.

sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

That will instruct launchd to read in the configuration file for Apache 2. If you want to start and stop Apache on command, you can still do that the old fashioned way.

sudo apachectl start

Install mod_fcgid

Myself, I’ll be deploying my Rails applications with mod_fcgid. I’ve had nothing but problems with FastCGI and, lets be honest, it doesn’t look like anyone is working on it. Still, Ruby needs to link against FastCGI. Lucky for us, MacPorts will let us install just the development kit.

sudo port -v install fcgi

With that out of the way, we can install mod_fcgid.

sudo port install mod_fcgid

Port will download, patch, and then compile the package. It’ll do everything but actually update your apache configuration file. Open that file up.

vi /opt/local/apache2/conf/httpd.conf

Scan down to the end of the “LoadModule” section and add one for mod_fcgid to the end.

LoadModule fcgid-module modules/mod-fcgid.so

Those dashes should be underscores (Grrr…) Restart Apache so that these changes take effect. If you’re using launchd, you do it like so…

sudo launchctl stop /Library/LaunchDaemons/org.macports.apache2 sudo launchctl start /Library/LaunchDaemons/org.macports.apache2

Most launchd scripts also have a “restart”, but not this one. I’m sure they’ll get that straightened out eventually. In fact, it might be fixed by the time your read this.

Install MySQL

We’ll need MySQL to provide database services to our Ruby applications. This is very similar to the steps for installing Apache.

sudo port -v install mysql5 +server

Once port has installed MySQL5, you have to initialize the database. Port lists the couple of commands you should run to finish up the MySQL installation. First, initialize the database used by MySQL itself.

sudo /opt/local/lib/mysql5/bin/mysql-install-db –user=mysql

Again, the dashes should be underscores. Damn you, WordPress!

Now that MySQL is installed, you have to tell launchd to load it and start it.

sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5 sudo launchctl start /Library/LaunchDaemons/org.macports.mysql5

With MySQL started and running, you can change the root password. You’ll want to do this twice, once for the root account at localhost and again for root at your hostname. Port should list these commands as well.

mysqladmin5 -u root password ‘mumble2837’ mysqladmin5 -u root -h emma.nervestaple.com password ‘mumble2837’

Install Ruby and Rails

With all of that legwork done, We’re all set to actually install Ruby!

sudo port -v install -v ruby

How easy is that? To install Ruby software and libraries, we’ll want to install gem as well.

sudo port -v install rb-rubygems

We’ll also want MySQL support.

sudo port -v install rb-mysql

And fcgi support.

sudo port -v install rb-fcgi

Lastly, we’ll want to install Rails. We can use gem for that, Rails is more of a Ruby thing and isn’t as dependent on locally installed libraries.

sudo gem install rails

Update: It’s also possible to install the Ruby/MySQL bindings with Gem, but you have to pass in the location of the MySQL library and header files. When you call gem, if your first argument is “––”, subsequent arguments are passed onto the script that builds the C library.

sudo gem install mysql -- --with-mysql-include=/opt/local/include/mysql5/mysql --with-mysql-lib=/opt/local/lib/mysql5/mysql

Adjusting Your Rails Application

With this setup, your Rails application really do not need to be altered very much. The only thing that needs to be changed is the .htaccess and the dispatch.fcgi files in the public folder of the app.

The .htaccess file contains the mod_rewrite rules that keep the URL’s clean and push requests to the dispatch script. Go ahead and pull that file up in your editor of choice. The first step is to comment out the handlers that we aren’t using. The top of your file should look something like this:

# General Apache options AddHandler fastcgid-script .fcgi AddHandler cgi-script .cgi AddHandler fcgid-script .fcgi Options +FollowSymLinks +ExecCGI

We’ll be using the third handler to invoke mod_fcgid. Go ahead and comment out the first two handlers.

Scan down towards the end of the file, you should see a hunk of text that looks similar to this:

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
# Alias /myrailsapp /path/to/myrailsapp/public
# RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

The Rails application is being served from your home directory and that is very similar to an alias. We have to add a “Rewrite Base” line directly underneath the comments, this will be immediately before the first “RewriteRule”.

RewriteBase /~miles/r4rmusic1/public

My home directory is “miles” and my Rails application is called “r4rmusic”. Now, this won’t actually hide the other folders in your Rails application. That would require an Alias directive to be placed in the VirtualHost for your site and we’re not using an actual VirtualHost.

The last change to your application is to edit the “dispatch.fcgi” file, also in the “public” folder. We’re editing the first line. It should read:

#!/usr/bin/ruby

That will invoke the Ruby instance that came with Mac OS X. We want to use the one that we installed with MacPorts. Change that line to read:

#!/opt/local/bin/ruby

That’s it, everything is all set. To access this Rails app in my web browser, I’d load up an URL like this:

http://emma.local/~miles/r4rmusic1/public

There may be a way to get around the Alias restriction with mod_rewrite rules, but that would complicate this particular setup. For me, this is more than good enough.

That’s it! I hope you find this helpful. I know I’ll be coming back to this article the next time I have to setup another workstation. :)

Sites That Have Stuck With Me [1]


Published to miscellaneous, etc. by Christopher Miles February 26, 2007 04:19

There are a lot of nifty websites out there. Sites that promise to connect you with new people in new and exciting ways. Websites that promises to deliver tiny nuggets of data that not only did you not know you needed, but once discovered you will not be able to live without. Sites that promise to deliver on umpteen promises that the internet had, so far, failed to deliver upon.

Of course, most of these sites lose their slick gloss in about a month and then you forget all about them. Until, that is, they are sold to another company and start bombarding you with pointless and annoying ads until you drag your browser back one last time to attempt to close out your account (in vain of course, that functionality usually doesn’t work).

Looking back at my bookmarks, I see many of these sites. Sites like Weekendr, Plazes, and URL123 to name the few that I can remember. There was a day when I giddily sent links to all of these out to my friends, encouraging them to sign up.

A few of these sites have stood the test of time, becoming even more useful as time goes on. I’ve decided to sing the praises of the few, those sites that somehow avoided running out of money or becoming overrun by noisy newbies.

Last.fm

The Last.fm service will compile a personal music chart of all the music that you listen to, it will also try and recommend new music that it thinks you might like. You download a plug-in for your music player and this plug-in tracks the songs you listen to and sends the information back to Last.fm. The data on your listening habits is collected, compiled, and cross-referenced with everyone else’s listening habits. It works a lot like Firefly did way back in the day.

In addition to the charts, they also provide a pretty nice internet radio service. You can listen to a radio station that plays songs Last.fm thinks you might like, songs of people who like the same sort of music as yourself (neighbors), or you can explore different genres. There’s also the requisite batch of social networking extras: people can recommend songs to you, you can track what your friends listen to, etc.

When I signed up with this service, it was called AudioScrobbler and it was one of the ugliest sites on the internet. The radio component was exceedingly flaky and played almost nothing but high-frequency nail-on-the-chalkboard type noise. In fact, the only component that worked at all was the charts. They were dense and difficult to read, but full of interesting information. For a while it looked like they might implode, but they’ve managed to shake it off and hold it together. New features consistently improve the utility of the site and the ads are not overwhelming. I have yet to receive any spam from Last.fm. Check it out, the charts are just the sort of thing I could waste hours on.

del.icio.us

The odds on you being unfamiliar with this site are slim, but still, this is one I’ve stuck with. Del.icio.us lets you keep track of all of your bookmarks in one place. You can recommend links to friends or keep track of the links your friends are bookmarking. I’m one of those people that bookmarks a lot of pages, having a way to sort and manage these bookmarks is something I find to be really and truly helpful.

Flickr

This is another hugely popular site and you probably know at least one person who keeps pestering you to sign up. Flickr provides a place for you to keep all of those photos that you’ve been taking. You can keep track of photos that you’re friends take or join a photo group interested in pictures of Talk Like a Pirate Day or crap people throw away.

All my vacation photos end up here. Links are sent to family and friends, and there’s no bandwidth limit. What more could you want?

Flock

Flock is a web-browser based on Firefox that pulls together social bookmarking sites like del.icio.us and photo sites like Flikr and bends them to it’s web-browsing will. Every bookmark you make in Flock gets added to your del.icio.us account (or one of the other bookmarking sites). It provides a handy blog entry editor and you can pull in photos from a photo site like Flikr and stick ‘em right into your blog entry. How cool is that?

For me, this site was the last piece of the puzzle that actually got me using del.icio.us regularly. All of the sudden, I didn’t have to remember to use the icky little bookmarklet thingy to get a bookmark into del.icio.us. Every bookmark I make just ends up in there, I’ll never have to lose a bookmark again!

Shelfari

Shelfari is a pretty new site, I don’t think they’ve been around for very long. They provide a place where you can keep track of all the books that you’ve read or are reading. You can keep track of books that friends are working on and post opinions on this or that book. They also have some groups you can join and chat with like-minded readers.

I love to buy books and hate to throw them away, so I have quite a few. Being able to browse through them all in one place is something I find to be really nice. I’ve created a couple of book groups and I’m hoping that people join and help me find some new authors. But even if that never pans out, Shelfari is already providing a useful service.

43 Things

43 Things provides a place where you can post personal goals and keep track of your progress. Other people working on the same goals can post little stories about how they’re doing and the whole thing is supposed to help keep you on track and help you actually accomplish some of these things. There’s a whole suite of related sites: 43 Places for places you’d like to go, 43 People for people you’d like to meet, and All Consuming for things you’d like to buy, see, read, etc.

Much to my surprise, 43 Things has managed to keep me thinking about some goals that are just for fun or happen to be more long-term. Unlike work stuff, I didn’t really have a good place for keeping track of things that I would want to do, or places that I’d like to go. 43 Things provides a web-based nook for storing this stuff and also sends me and e-mail every so often to keep it on my mind.

There are a couple more I could post, but this entry is long enough! If there are any useful sites that you belong to that you’d like to share, post about them in the comments.

Going Back to School [3]


Published to miscellaneous, etc. by Christopher Miles February 19, 2007 21:45

I’ve been talking about going back to school for a long time now. Not just a long time, but more like a really long time. I think I may have mentioned going back to school every winter for the last five years. This year I have vowed to move forward on this goal and I’m trying to figure out the best way to get it done.


UMASS Amherst is my nearest college, in addition to regular day classes they also have a continuing education program and the University Without Walls. I’ve been trying to figure out which program is the best way to go. The UWW program has a couple of orientation sessions every month and I attended one this meeting. I’ve mentioned this to a couple people and everyone seemed interested so I’ll try to sum up what I’ve learned so far.


The most straightforward option is to enroll in the regular undergraduate Computer Science program as a part-time student. The Continuing Education program does not offer a Computer Science degree so regular day classes would be required anyway. The cost difference between regular day classes and these other programs appears to be negligible. Coursework from other colleges would be transferred over, if you’ve gone to another MA state school you are guaranteed to get credit for your courses. The Computer Science department appears to be willing to give you credit for work experience and private study. The regular undergraduate program requires a foreign language, the Continuing Education program does not.


The Continuing Education program only offers five undergraduate degrees, none of these is suitable for computer science coursework. They have two for hospitality and tourism, two for nursing, and one for “general studies.” For anything else, they refer you to the University Without Walls program.


Students enrolled in the University Without Walls program take courses through the Continuing Education program. What the UWW is offering is the ability to give you credit for life and work experience as well as various training and certificate programs. The Continuing Education program will not give you credit for these kinds of things. They will also let you create your own degree program. The regular undergraduate degree programs are not available through the UWW.


The UWW program is looking to give you credit so that you can scratch classes off your list and get a degree more quickly. In all likelihood you are currently working in the field you’d like to get a degree in, so the credit you’ll be getting will be for classes in your area of concentration. UWW probably won’t be able to give you credit for General Education requirements although they will try.


The BS that the UWW program will be giving you will not be the same BS in Computer Science that the undergraduate program provides. The UWW will let you pick and choose the classes that you want and they’ll give you a proper BS when you’ve completed your coursework. The UWW will assign a faculty advisor that will be responsible for helping you put together a sensible degree program and to ensure you take the important classes. When you finish the program you will have a BS from the UWW program at UMASS Amherst.


Personally, my feeling is that the BS in Computer Science can vary greatly in coursework from place to place. In terms of getting work, I suspect that there isn’t a great deal of difference between a BS through the UWW and the regular undergraduate Computer Science BS. All anyone will ever see on your resume is that you have a BS.


UWW graduates do well in graduate school, they have placed people all over (not only at UMASS). Some programs are a better fit than others, they specifically mention Engineering degrees from the UWW program not holding the same weight as the regular Engineering degree. They have been around since the beginning of the UWW movement in 1970 and are one of the longest running. Most UWW students graduate within 5 semesters.


In addition to regular coursework, the UWW program offers an Independent Study program that can be applied toward your degree program. They also will let you apply your regular work toward an “Internship” if you work in your field of study. With a part-time course load and an internship, you may find yourself earning the same credit toward your degree program as a full-time student.