First post from OS X

I’m composing this from the MacBook my new job has has provided me with. Coming from PC-land it’s a culture shock, a very sleek, stylised culture shock, but a culture shock none-the-less.

I’ve got a 2GHz Intel Core Duo processor along with 1.5 GB of RAM at my disposal, so everything is very smooth and shiny but I’m having to adjust to an operating system I’ve never used before so I feel almost crippled when it comes to doing things I don’t normally even have to think about. Oh, and the keyboard just seems wrong.

First thing I did when I got my new toy home was to set up wireless networking: before I put together an IPCop router I was using a Gigabyte GN-B49G and had never used the wireless facility, but I plugged its WAN port into the switch for my “green zone” and went through the router’s setup wizard and bingo! As a finishing touch I configured it to use MAC authentication to prevent any of my lovely neighbours hi-jacking my bandwith ;)

So far there has been nothing that has struck me with “ah, this is what I’ve been missing all along” but I’m looking forward to adding another string to my bow, regardless of the amount of muscle memory I’m having to fight against to do anything via the keyboard. The only negative side I can see to using a Mac is that the experience might be a one-way thing and I’ll never be able to go back to commodity hardware. I’ll always have Linux running on my servers though!

Nine Inch Nails – Year Zero

A trailer clip for Nine Inch Nails upcoming album Year Zero was released today and I’m sitting here, taking some time out from coding, listening to the tracks from it which were recently “leaked”.

The tracks are: “Survivalism”(the forthcoming single,) “My Violent Heart” and “Me, I’m Not”. It’s these last 2 which were discovered on USB drives in toilet cubicles at a couple of recent gigs. The files are all 320 kbit/s CBR MP3s and I’ve had the 3 of them on repeat. I can’t wait until the final album is released!

Ajax: first impressions

I’ve been working on a form in my app and was faced with a decision regarding one of the fields: I need the user to select an object from a (possibly large) number of existing objects. I reckoned I had 3 options: a simple drop-down list, which could prove to be impractical; a pop-up window; or, behind door number 3, I could investigate the use of Ajax, which would have the added effect of adding some web 2.0 style eye-candy to the project. Can you guess which option I went with?

Google, as always, provided an abundance of information, so I started reading this tutorial.

I downloaded the script.aculo.us library (which includes the Prototype framework) onto my development machine and extracted all the necessary .js files into /app/webroot/js/, excluding the unit test stuff. I included the scripts by adding the following to my document header in /app/views/layouts/default.thtml:

<?php
echo $javascript->link('prototype.js');
echo $javascript->link('scriptaculous.js?load=effects');
?>

I then made the application aware of this new functionality by added this line to the AppController definition in /app/app_controller:

var $helpers = array('Html', 'Ajax', 'Javascript');

No errors so far! In the view I was working on I created a div, put some content into it and through CSS set display: none, learning the hard way to use an inline style to do this instead of using the external style sheet…

On the form I created a link similar to this:

<a href="#" onclick="new Effect.Appear('id_of_hidden_div', {duration: 1.0}); return false;">show me the magic</a>

And by Jove it worked! Clicking on the link made the formally hidden div fade into existence before my very eyes.

This is why I love what I do :)

Amazon.co.uk free super saver delivery

I’d finished reading the last interesting book in my stack on Saturday morning so I wandered down to Waterstone’s to pick up something to tide me over until I got my act together and ordered some of the items on my Amazon wish list.  On Tuesday afternoon I waved bye-bye to a few shekels and seeing as I’d still a good bit to go on the book I bought at the weekend I opted for the free delivery. The order was confirmed at 2:36pm. The delivery man was at my door 25 minutes ago.

Free delivery and within 48 hours, I’m impressed! Hard sci-fi cyber-punk shenanigans aplenty!

PyAIMt

Last week I found myself with the need to communicate with some people via AIM. I’d never bothered with that particular protocol before but being a Linux enthusiast I detected the opportunity for a bit of geekery…

All my IM needs are taken care of by jabberd running on substance. I can communicate directly with the people I know who use Google Talk and I’ve the MSN transport running to keep in touch with a few folks using that network, so, instead of taking the easy route and switching to a multi-protocol client, I opted to install the AIM transport.

I downloaded the latest release, extracted it to /usr/local/pyaim-t and proceeded to simply, almost blindly, follow the given instructions.

I assigned a JID to the transport, aim.nulltheory.com, added the info into /usr/local/pyaim-t/config.xml and created a corresponding subdomain in my dynamic DNS settings.

I added the transport details into /usr/local/etc/jabberd/router-users.xml and
added an alias for chatroom.aim.nulltheory into /usr/local/etc/jabberd/router.xml. No heavy lifting so far…

I restarted jabberd and, fingers crossed, launched the transport with python /usr/local/pyaim-t/PyAIMt.py &, used my Jabber client to discover the available services and there it was, w00t!

The whole process took the minimum of effort and the lengthiest part was signing up for an AIM account: once I had that it was plain sailing to register with the transport and add the contacts to my roster. Open-source to the rescue once again :)

CakePHP

I secured my first consultancy gig on Monday, developing a web-app for a local business; the end-product is to be deployed onto a standard *nix hosting account, so it’s going to be an adventure in PHP and MySQL from here on in.

Since my first meeting with the client I started collating all the various bits and pieces of PHP I’ve written over the past couple of years with the intention of producing some form of crude framework which would allow me to develop sites quicker and easier. Incidentally I’d also been reading the Design Patterns book over the past month, which really impressed upon me the idea of programming to an interface and not a implementation and software reuse in general. Needless to say, my head was filled beyond capacity with information, I did more thinking than coding and it just hit me on Monday: “why bother re-inventing the wheel?”

After a bit of research I decided to try out the CakePHP framework: it appears to have all the features I need, with plenty of documentation and favourable reviews. It will also help me avoid the dreaded “not invented here” syndrome which would have me write absolutely everything from scratch for no good reason whatsoever.

From what I’ve seen so far of this system I feel I’ve made the right choice: the development process is a lot more rapid and it has brought the joy back into coding for me. I’ve still some way to go before I can leverage the full power of the framework but I’m enjoying having my focus on problem solving rather than writing loads of code to manage things like database interactaction, site navigation and so on. I’ll definitely utilise frameworks in future projects.

All in all I’m pretty excited :) Now back to the code…

Fun with port forwarding

I’ve been having great fun with tunneling connections through SSH lately and today it dawned on me that I could close another hole in my firewall by connecting to my Jabber server via a tunnel. In the past, when I’ve been working remotely, I’ve made changes to my firewall by connecting to my public-facing machine; from there to my desktop machine through a DMZ-pinhole and once a presence has been established within the “green zone” browsing to the routers web-interface with lynx.

I decided to try something a bit different today. I started by forwarded an arbitrary local port with PuTTY on my windows desktop at work:

Fun by proxy - PuTTY configuration

Next up was to connect from my Slackware box over to my Kubuntu desktop and use it as a SOCKS proxy, using the previously forwarded port:

steve@substance:~$ ssh -D 8100 steve@192.168.0.2

Viola, my desktop was now acting as a proxy and was accessible through a local port. I added the details of my newly created proxy into the SwitchProxy extension for Firefox thusly:

Fun by proxy - SwitchProxy

I enabled the proxy and tested it out by browsing to whatismyip.com with both browsers available to me:

Fun by proxy - different IP addresses

Happy days. From there it was perfectly effortless to access the web-interface of my router and close the client-to-server Jabber port and to skip over to my download box and queue up a DVD to entertain me this evening.

The more I use Linux and the wealth of software bundled with the majority of distributions the more I see what is left out of windows by default. Instead of thinking “which application do I need to perform this task?” it is becoming more a question of “which protocol?” I love it!