THE BLOG

25
Aug

Setting up Snow Leopard for Web Development

My trusty old 1st-gen MacBook Pro died on me last week, so I’ve got myself a shiny new one, which is exciting! One thing I was looking forward to was a clean install of the OS, so I could re-appraise the way I used my computer. One of the things I decided to do was to move away from using XAMPP and have a more traditional set up using the built-in Web Sharing. Here, I’m going to talk about what I’ve done and how I propose to use my new laptop for Web Development to smooth my workflow.

Apache and PHP

Mac OS X Snow Leopard comes with Apache and PHP, although PHP is disabled by default. I didn’t know this to begin with, so I started off by installing Marc Liyanage’s PHP bundle. However, after installing this I found that I was getting 301 “Permanently Moved” errors on all my pages, so that was soon uninstalled.

To enable PHP on Snow Leopard, you need to open the config file in your favourite text editor (mine’s TextMate, but you can use vim, nano, or any other). In a terminal, open the file for editing (replacing ‘mate’ with the command for your text editor) entering your password when prompted.
sudo mate /etc/apache2/httpd.conf
You’re looking for a line like this:
#LoadModule php5_module        libexec/apache2/libphp5.so
If it exists, remove the # symbol, otherwise add the line in, minus the #. Save the file and exit the editor. Now you need to restart the Apache server, so type the following in the terminal:
sudo apachectl restart
You can test whether it’s worked by creating a file in your Sites directory that looks like this:
<?php phpinfo(); ?>
Call this file info.php, and then in your browser navigate to http://localhost/~yourusername/info.php – if it’s worked then you should see a nice table which has all the details of the PHP installation.

MySQL

If, like me, you’re going to be using MySQL for the database side of your web applications, then you’re in luck! It’s really easy to install, since MySQL provide some lovely .dmgs. Go to http://dev.mysql.com/downloads/mysql/ and choose the DMG archive most appropriate for you (remember to check your operating system version, and whether your computer is 32 or 64 bit). Note that all of these downloads are for Intel-based Macs only. When you’ve got the file, open it up and you’ll see 4 files. Start by installing the main MySQL application which will be called something like mysql-5.1.50-osx10.6-x86_64.pkg. When that’s done, I installed the MySQLStartupItem.pkg and the MySQL.prefPane files (both done by double clicking on them), which starts the MySQL server when I login and lets me control it through the System Preferences application.

You can manage the database in a number of ways, but I choose to use SequelPro. It’s a free application that’s got all the features you need in a lovely Cocoa-based UI. If you prefer, you could install phpMyAdmin or one of a number of alternatives, but I haven’t tried those so I shan’t give you any advice on them.

Starting Development

Now you’ve got all the components set up, it’s time to create some web apps! All the code will go in the Sites folder that’s located in your home directory. I’m going to be following Remy Sharp’s guide, which sets up domain names that point to your local machine (so, for example, I could develop and view on my local machine at the url http://imaginaryroots.dev). There’s quite a lot of work involved in that, so I intend to write a shell script to do the majority for me, but I haven’t gotten around to it yet…

Now all’s that’s left is to knuckle down and write some code – and let’s face it, isn’t that why we’re all here?

09
Aug

On Brevity

Lots happened in my blogging hiatus, and I intend to talk more thoroughly on those topics in the near future, but I thought I’d give you a quick bullet-pointed list of things that I’ve done and am interested in at the moment. Enjoy!

  • I graduated with a 1st class Honours in Computer Science from Warwick.
  • I learnt Objective-C and Cocoa to make my first desktop app, DoodleDesk.
  • I’ve re-written the Mondrian generator in using JavaScript and the Raphael library as a result of my growing dislike of all things Flash.
  • I’ve been working on Fretless quite a lot. It’s a big project that’s taking a while to come together, but it is, slowly…
  • As of September I will be an employee of thrudigital – exciting!
  • I’ve been recording guitar parts for the debut release from my band, Drongo Sealion Magic.
  • I’ve been playing a lot of Gran Tourismo 5 Prologue, and have been holding my breath far too long for the release of GT5…
  • I’ve designed and launched a website for my brother’s company, Energy Regeneration.
  • I’m following with interest the recent developments in the P vs. NP problem.
  • I’ve held off on getting an iPad so far… Will be getting an iPhone 4 soon though.
05
Aug

On Autonomous Robotics

Long time no blog! I’ve now finished uni and have graduated, and thought I would put up a reflection on my final year project, entitled Autonomous Robot Operation for Simulated Disaster Environments.

It was a group project which I undertook with 4 other Computer Science students in my year. The five of us worked with the Warwick Mobile Robotics group, who have for some years been developing tele-operated robots as a final year group project for entrance into the RoboCup Rescue competition. The competition tests robots in simulated earthquake damaged buildings, with the aim being to identify “victims” – simulated signs of life that might suggest a human is trapped. The competition has sections tailored for both autonomous and tele-operated robots, and this year WMR wished to compete in both regions. They would design and build a robot using which we would implement algorithms performing Simultaneous Localisation and Mapping (SLAM) and Victim Identification.

I would be working with Jonathan Abbey on the SLAM algorithms – an exciting and difficult set of problems. SLAM is the problem of an autonomous robot navigating an unknown environment whilst simultaneously generating an accurate map of that environment. It’s an unsolved problem – there are many potential solutions, but none are complete. My tasks involved Data Association, the problem of determining which of the features the robot can currently see have been seen before; Occupancy Grid Mapping, which generates a map of the environment by recording what (if anything) occupies each grid location, and can be visualised as a standard map; as well as dealing with low-level device code and porting the code onto the robot. Two other members of the team, Jan Vosecky and Jason Cook, worked on Victim Identification code, which attempted to identify potential victims through vision using both standard and Infra-Red cameras.

As part of the project, I was fortunate enough to travel to Magdeburg, Germany for the RoboCup German Open. There, I was able to observe the solutions put forward by other teams. Of most interest were the entrants by Darmstadt and Koblenz. Both these teams have worked hard for many years on these problems, and have incredible robots which are very impressive to watch (check out Koblenz’s videos on YouTube – particularly the loop closing, which is just phenomenal). Our robot, unfortunately, was significantly less impressive. Infact, if it made a single turn we considered it to be a good run. The project will continue, and has a good team of CS students taking it over next year, so with a bit more development WMR should be very competitive in the autonomous region at future competitions.

More than anything, though, this project has really piqued my interest in autonomous robotics. It’s really interesting to read about the DARPA Grand Challenge, which pits unmanned vehicles against each other. These vehicles are incredibly impressive, with an ability to not only map their environment and complete navigational objectives, but to also observe obstacles in the form of other vehicles and to obey traffic laws.

I was watching the Grand Prix this weekend, and I had a thought: how far can we push autonomous vehicles? Could we, for instance, go so far as to create an autonomous Formula 1 series?

Imagine it: F1 cars, minus the heavy drivers and safety shells, autonomously driving around race tracks at speed. This poses more challenges than it is possible to list here, but amongst the major of those is the sheer speed of motion compared to the speed of computation. Can we process sensor data fast enough to react to the environment? Can we get sensors that feed data fast enough for us to even be able to react in a reasonable time at speed? Real-time SLAM is something no-one seems to worry about at the moment (and perhaps rightly so – if it’s not solved, why make it faster?), but it’s a challenge that needs to be faced sooner or later if autonomous robots are going to fulfill everything researchers are dreaming of.

Another challenge is simply keeping control of the car – F1 drivers can detect and react quickly to understeer, oversteer, tyre graining and a host of other problems that haunt these high performance cars. Can we make a computer that can also deal with all these?

And how about overtaking? Could we design intelligent AI algorithms which would plan and execute maneuvers – and could these algorithms perhaps teach us something, with no fear and the ability to rapidly judge and weigh multiple options?

I, for one, would love to see this. It looks like the University of Essex might be working along these lines, but it’s quite far away. Maybe if I get bored of Web Development I’ll try and start something…

In the meantime, enjoy a lovely video of our robot from our project, along with some fairly horrible music I composed using Garage Band.