We recently went through a huge migration at work (Lotus Notes to Exchange) and I needed a way to decompress, so I thought I would learn something new. I have some previous experience in web development, so I thought a little project like this would be fun.
The Tools
Let me dwell a second and give some of the reasoning behind the tools I’m using here.
SQLite: I like SQLite for learning applications because it is quick, easy, and, since it is a file based database, I can replicate the changes through SVN. This way, no matter which work station I sit at, I can have the exact environment I left…even the database.
PHP: I programmed with PHP at my last job and despite the fact that I enjoy the syntax of python better, PHP is still a great tool.
jQuery: its hard to do anything involving JavaScript without mentioning jQuery. It’s shortcuts are priceless.
Coffeescript: Obviously the least known tool in the stack, one may wonder why you need anything more than jQuery in order to write good JavaScript. And, you’re right. You don’t “need” Coffeescript. You don’t even need jQuery. I stumbled upon Coffeescript a while back and really related to the syntax. JavaScript, especially the proper scoping of variables, remains somewhat of an enigma to me. Coffeescript helps me translate it into something I understand a bit better.
The Setup
This walk through doesn’t require much, but, I always find the best place to start is the beginning. Before we can write some code, we need to setup our environment.
PHP
Any LAMP, WAMP, MAMP, or BAMP setup will work just dandy for anything I will be doing in the next couple entries (although we won’t be using the M part of any of those setups since we’ll be using SQLite instead of MySql.) Usually, on Windows, I prefer the Zend Community Server. The only stipulation is that the version of PHP needs to be able to do PDO. Correct me if I’m wrong, but, I think your pretty safe with any PHP version that starts with a 5.
Coffeescript
The trickiest part of the development environment is getting Coffeescript setup. If your setup has any *nix in it, you’ll have to take a detour through here to get that figured out. Once you have Node.js working, its as easy as:
npm install -g coffee-script
For those of you following along on your Windows box, I have a different solution. Following the instructions here:
- Download the Node.js executable for windows from http://nodejs.org/#download and run the installer.
- Download Coffeescript from http://github.com/jashkenas/coffee-script/tarball/master, extract (use 7-zip if you need to), and place in your
Program Files directory.
- Create a new text file on your desktop and rename it to
coffee.cmd. Edit the file so that it contains the following text:
@echo off
"%PROGRAMFILES%/nodejs/node.exe" "%PROGRAMFILES%/CoffeeScript/bin/coffee" %*
Note:If you are running 64-bit Windows, you can either replace "%PROGRAMFILES%/Node/node.exe" with "C:\Program Files (x86)\nodejs\node.exe" or move your nodejs folder from C:\Program Files (x86) to C:\Program Files. Its your call.
- Move
coffee.cmd to your C:\Windows\System32 folder
If all is well in Coffeescript land, you should be able to open a command line, type coffee and enter an interactive session. Use ctrl-c to exit.
With that, we should be all setup. Tune in next time and we will actually write some code.