@madpilot makes

Another month flies by…

I’m sorry, I don’t remember authorising anyone to make it the end of August already. The last 30 days have been CRAZY. In no particular order:

The business and mobile phone versions of 88 Miles was released, so not you can track your time when you are out of the office. The business version allows one person to manage the time of many other people, which makes running a small office much easier.

My laptop video card decided to goto the big ol’ interweb in the sky, so I have been with out it for the last two weeks. Apparently trying to source a motherboard for a computer that is barely two years old is a less that trivial task. This has meant that I have had to use my Linux machine for day-to-day use (other than at work) which has been interesting to say the least. One tidbit of wisdom – don’t try running major OS updates of a production server late on a Saturday night. It results in spending much of Sunday testing backup systems :)

The WA Web Awards have come and gone. I  had the honour of chairing the awards this year, and might I say, even though a stupid amount of time went into organising it, it was well worth it. We had 130 enteries, sold out all 114 tickets in a week and managed to pull the whole thing together all whilst working fulltime.

The new sit down dinner format really added to the night, it felt so much more awards night like. I must put out a big thankyou to the rest of the committee – there were some hairy moments in the last couple of weeks, but it all came together on the night. Congratulations to all of the winners – especially Freckle Creative, who took out the coverted “Best overall” award. There are photos for your viewing pleasure on Flickr.

The Sunday after the web awards (that is 2 days after the web awards) Bam Creative moved offices. And, I must say that I like the new digs – they have a much better feel about them and it seems to be much more condusive to work (Which is a handy thing for a work place).

Work at Bam has been non-stop of the past two weeks, the three of four major projects I’ve been working on have pushed the boundries of my sanity, but since some would argue I was already insane, there may not be too much difference… On top of that my MadPilot work still seems to be trickling in, regardless of how much I tell people that I’m working full time now.

Luckily, next month is Web Directions, so I can at least enjoy a couple of days off. I’m really excited about the event, it’ll be great to meet some of the big names in the web industry. I find these sorts of events really inspiring and invigorating. I’ll try and blog my way through it, just like every other man and his dog!

Make scheduling jobs easier – use web services!

Web developers deal with scheduled jobs a lot. Any online application that deals with paid subscriptions needs to remind users when they need to pay up. Other apps may require data mining services to be run on a nightly basis.

This is pretty easy to do – run a cronjob under *nix or a scheduled task under windows. However, where things get tricky is when you have spent an in ordinate amount of time coding business logic into you application. Duplicating this logic for an external script to be run by cron is pretty silly, not to mention bug-prone. However there is a quick and simple solutions: Web services!

By setting up a web service that does your maintainence, you can leverage the classes and business rules that you have already written. For example, if we take a Model-View-Controller framework (such as Rails or CakePHP) we may have logic that will do data manipulations before the data is saved to the database. There is no way I would want to try and emulate what these frameworks do in an external script. By using web services, you are calling the framework natively and you avoid all of these problems.

How it works

It is really simple:

  1. Setup a webservice that will perform the functions you need to run on a regular basis.
  2. Create a simple script that calls the web services.
  3. Add this script to you crontab or task scheduler

The beauty is that you don’t even need to bother setting up the web service using SOAP or XML-RPC – REST will do the job quite nicely, especially since the web service is designed to only be used by you. However, when using rails I like to use SOAP, because it is so easy to setup and use. Here is a simple example:

class HousekeepingController < ApplicationController
  wsdl_service_name Housekeeping
  web_service_api HouseKeepingAPI
  def maintain()
    # Run you maintainence script here
  end
end

This file is the webservices controller. You would add your logic here – this may be expiring users or automatically checking email.

class HousekeepinApi < ActionWebService::API::Base
 api_method :maintain, :returns => [:string]
end

This file defines the method to the web service caller. I usually set the return to type :string so I can output statistical messages or errors that occur during the job.

#!/usr/bin/ruby -w
require soap/wsdlDriver
include SOAP
begin
  wsdl = path_to_wsdl_file
  factory = WSDLDriverFactory.new(wsdl)
  housekeeping = factory.create_rpc_driver
  out = housekeeping.maintain
  put_s out
rescue Exception
  $stderr.print An error occured: #{$!}n“
  $stderr.print Detailes error description, if any:n
  raise
end

This file is called by the cronjob. You will need to replace the string path_to_wsdl_file with the path to the real WSDL file. You get get the WSDL file from a Rails web service by querying /:controller/wsdl (so in this example http://www.yoursite.com/housekeeping/wsdl – pipe the returned xml to a file and save it.

Then it is just a matter of adding the housekeeping_run.rb command to you cronjob! Cron will even email you the results that get returned by your service – Nifty!

Nice an easy, eh?

Fixing ZeroCfgSvn.exe crashes

I use a Toshiba Satellite M70 which has an Intel ProSet Wireless 2200BG Wireless network card.

I have had a couple of problems with the wireless card though:

  1. When I boot, the wireless connects for about a minute, then the connection drops and it reconnects – this plays havoc on my IM programs not to mention slows my boot time considerably
  2. After I installed VMWare, the Zero Configurations Service kept crashing. This was annoying to say the least.

After a little Googling, it became apparent that the issue is the driver. Easy – go and get the latest driver from Toshiba, right? Wrong – I updated to the lastest version and still no fix.

The solution: Just on to the intel website, select Wireless > Wireless LAN Products menu item on the left and select the wireless card you have.

Download the 123Mb (?!) driver file and install. You will lose your saved Access Point information though.

If you are like me and prefer to have Windows manage you connections, Right-click on the task bar icon and select “Allow Windows to Manage my connections”.

If you are also like me and HATE erronoues taskbar icons, open the Intel Wireless Manager (Start > Programs > Intel PROSet Wireless > Intel PROSet Wireless). Click the Tools > Applications Settings menu and uncheck the “Show application icon in the taskbar” checkbox.

That should do the job quite nicely.

More people to play with

Exciting news just to hand! The perth web industry has been going to through a bit of a shake up of late – perpetual freelancers taking full time jobs (That’s me), stalwalts of the industry going out on there own, mergers and aquisitions.

“Mergers and aquisitions”, you say?

“I’ve heard but nothing!”

Yes, dear reader, this little secret has been very well kept (rare for the industry over here) – two major players in the boutique web arena have joined forces in a super-mega-power play of gigantic small business proportions.

Bam creative (my new place of employ) has recently aquired Cube7 (an old client of mine). Customary website here. This is extremely exciting news as both of these companies are well sort after in the local market.

This event is being simul-blogged by Miles Burke and Simon Wright.

Busy, busy, busy

Phew! What a week.

I’ve started at Bam, and I’m trying to get all of my outstanding contracts completed and trying to organise the WA Web Awards (I’m the sub-committee chairperson).

A few quick announcments:

  • WA Web Awards entries are open. It’s $25 for Port80 members, $10 for Student Members, and $35 for non-members.
  • 88 Miles is but days away from having a full web-service API released. It’s all working, I’m just finishing up the unit tests.
  • Port80 Melbourne is starting up next week. It is piggy-backing on a Ruby on Rails user group meeting. Go and see Miles’ blog for details.
  • There has been some interest in starting a Ruby on Rails special interest group on the back of Port80 over here, so I’m seriously looking in to that. Miles’ suggestion for a name was caboose. I like it

End

The times, they are a-changing…

Well, Miles has finally managed to do it – today I signed on as the “Development Team Leader” at Bam Creative. Bam Creative is one of the coolest and most respected boutique web companies in Perth and it is an honour to become part of the team.

I’ve done quite a bit of contract work for them in the past and I think we will be a good match. There is of course that whole issue of having two Miles/Myles’ in the office. I don’t think there are too many companies that can boast that combination!

So what does this mean for MadPilot Productions? Not a great deal – I will still be actively working on 88 Miles and a some other yet-to-be-released systems (watch this space!), but I won’t be taking on any freelance contract work.

How I work

Lifehacker have been running a “How I work series” which has given an interesting look into how their editiors work on a day-to-day basis.

Well time for me to blatently rip off the idea :)

I challenge all of the Westcoastbloggers to answer the same questions on their blogs.

What desktop software do you use every day?

I’m still an Outlook user. Originally I used it because it sync’d with my PocketPC nicely, now it is just because I like it. I occasionally use Thunderbird on Linux.

I will often have a copy of either notepad (Microsoft’s BEST program – ever!) or notepad2 open. Notepad2 supports colour highlighting and UNIX line endings, so fills the gap nicely when notepad won’t cut the mustard. Unfortunately it doesn’t support ruby yet :(

I use Illium’s eWallet for password management. It is almost always open so I don’t have to remember all of my clients passwords. Also sync with my PocketPC so I can access stuff away from my laptop.

The command line utility NCFTP is my trusted FTP client. I started using this on Linux and fell in love with it, so I jumped at the changed to use it when the windows version came out.

If I’m text editing on Linux, I use VIM. There is a Windows version, but notepad is easier.

I use PuTTY to SSH in to the various servers that I work on. Since I work on a development server and I use Subversion for version control, this is a must have.

Although I try to keep this closed whereever possible, I use FeedDemon 2.0 for my RSS feeds.

What web sites do you use every day?

I always have my time tracking system, 88 miles open in a firefox tab

I frequent the port80 forums.

It goes without saying that Google gets fired up many times a day.

What PDA/personal organizer/system do you use to keep organized?

I have a Compaq iPaq, but don’t use it that often anymore. I used to use it mainly for time tracking, but now I use 88 miles. I have a big A4 paper diary in which I write meetings, todo lists and reminders for the next day (I’m more likely to read them in there as it is always right in front of me). If I’m out I will take my PDA because it is a bit smaller than my paper diary. I’m trialling Remember the Milk as a task list manager. Although I still seem more inclinded to write stuff down on paper.

My desktop

Time tracking for freelancers and small firms made REAL easy.

I have just launched a new web site called 88 Miles. I was sick and tired of trying to juggle excel spreadsheets to maintain my client timesheets – I ended up having to double input (Because it was too much of a pain to enter the time directly, so I would write them down first) and would usually leave the task until the end of the week. Not suprisingly this part of my week wasn’t my favourite.

Punch-in punch-out demo Enter 88 Miles. This little system that I have designed is meant to be REALLY basic. There is no invoiceing system or task system and this is by design. I wanted to make it’s primary role – that is entering time – extremely quick.

When you go to the site, you click punch in to the project you are starting. When you have finished the job, click the corresponding punch out button. That’s it. Really.

At the moment, the system is in beta so it is missing some of the other features that I plan implement before the official launch (Aiming for 1 June 2006) like RSS, an API and some desktop applets, but please feel free to go and have a play with it and let me know what you think!

As a bonus, those of you that sign up before the 1st of June get the first two months of access for free if they decided to continue after that point!

Prices look like they will be $24/year for the premium account – standard accounts will be free but limited to three companies and five tasks at any one time.

The tech:

The system is built in Ruby on Rails and is running on Textdrive.

WordPress 2.0 mod: Insert highlighted code.

I have complained before about not being able to insert source code into WordPress when using the TinyMCE Rich Text Editor. Sure, I could switch to plain text mode, but frankly I would prefer an RTE as it makes entering posts much quicker. There is a TinyMCE plugin called insertcode written by by Maxime Lardenois which does exactly what I wanted. In fact, it even uses the GeSHI cde highlighter class (written in PHP) to do code highlighting. There is something like 50 different languages which are supported – Very cool.

Unfortunately, installation was not quite as simple as I hoped. Here is what I had to do (Substitute [blog_root] with the absolute path to your wordpress install):

  1. Untar the GeSHI tarball and copy the geshi.php files and geshi directory to [blog_root]/wp-includes
  2. Unrar (yes rar) the insertcode RAR file to [blog_root]/wp-includes/js/tinymce/plugins/insertcode (Create the insertcode directory first)
  3. THe RAR file I go didn’t have a directory structure – I don’t know whether I just messed up or what, but I had to create the following directories: config, css, images, jscripts, langs, webservice
  4. Copy config.php into the config directory, insertcode.css into the css directory, insertcode.gif into the images directory, insertcode.js into the jscripts directory all the php files into the webservice directory and all of the language files (e.g. en.js) into the langs directory. You should only have editor_plugin.js editor_plugin_src.js and insertcode.htm files in the insertcode dir.
  5. Open get_highlighted_code.php and change the $geshi->set_header_type(GESHI_HEADER_PRE) to $geshi->set_header_type(GESHI_HEADER_DIV)
  6. Open [blog_root]/wp-includes/js/tinymce/tiny_mce.gzip.php and find the line $plugins = apply_filters – add ‘insertcode’ to the array
  7. Still in tiny_mce.gzip.php add ‘insertcode’ to the line that starts with $mce_buttons = apply_filters
  8. Finally add the following to lines to the initArray javascript array:

content_css : “/[blog_url_path]/wp-includes/js/tinymce/plugins/insertcode/css/insertcode.css”,

encoding : “xhtml”,

This should add a new button to your toolbar with the letter “C” into. Pressing the button should pop a dialog box in which you can cut and paste code.

To make it look nice on the front end cut and paste the contents of insertcode.css into you themes’ style.css file:

That SHOULD be it.

<li class="li1">
  <div class="de1">
    [echo</span>](http://www.php.net/echo) print_message<span class="br0">(</span><span class="br0">)</span>;
  </div>
</li>

<li class="li1">
  <div class="de1">
    <span class="kw2">function</span> print_message<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>
  </div>
</li>

<li class="li1">
  <div class="de1">
    <span class="kw1">return</span> <span class="st0">&#8220;Hello World!&#8221;</span>;
  </div>
</li>

<li class="li1">
  <div class="de1">
    <span class="br0">}</span>
  </div>
</li>

<li class="li1">
  <div class="de1">
    <span class="kw2">?></span>
  </div>
</li>

You will notice that the indentation gets stripped – this is (I think) a WordPress thing. I’ll post a solution once I figure one out :) Also, it can be a little tempermental – you have been warned. And as always: YMMV.

Edit: I’ve fixed the indent bug: check out this post.

3rd Degree e-news site publishes it’s first edition

The Edith Cowan University journalism students have launched the first edition of 3rd Degree – an online e-news site. The site was designed by Paul Bui and was developed by me in CakePHP.

The site allows the 3rd year students to understand the pressure of publishing a weekly news publication, with different teams controlling different parts of the process. If you would like to receive the weekly newsletter, you can register here.

3rd Degree is the brainchild of Kayt Davies, who is the lecturer in the unit.

Previous Next