Every now and then you end up having develop on a Windows box. Here are some handy hints for getting your cron jobs up and running.
The user interface for the Scheduled Tasks in Windows can be found at Start > Programs > Accessories > System Tools > Scheduled Tasks.
For performing cron jobs on webpages I recommend that you get the following binary: WGET for Windows
Now to setup your cron job:
- Double click Add Scheduled Task
- Click Next to skip past the intro
- Browse to program you wish run. Now you can use FireFox, Internet Explorer or indeed any other programme here. You could even run a batch script – more on this later. For web based invocation (calling a webpage over http etc) I recommend you use Wget though as it will not remain open after execution and it will use less resources. Of course if you have a PHP CLI script then you can invoke the PHP binary. I am going to focus on Wget and FireFox for the moment. After choosing the application click next.
- Give your task a name and choose the regularity with which you wish the task to be performed.
- Pick the time, start date and additional break points ie should it run on weekdays only?
- Now you need to enter the username and password of the user this application will be run as. It goes without mentioning that running FireFox as Administrator is a bad idea. Next.
- Check the “Open advanced properties for this task when I click Finish” checkbox and click finish.
You are now presented with what looks like a standard Windows file property dialogue but there are a few extra options. You will arrive on the Task tab.
- In the Run input box we can now specify the file we would like to be opened by our Application. This should be the full URL: http://www.simonholywell.com/my_cron_job.php for both FireFox and Wget. For Wget only add the following onto the end of the run command: " -r". This will cause Wget to clobber the file it downloads instead of making copies: Wget Manual see '-nc' '--no-clobber' So once your done your Run should resemble this C:\wget.exe http://www.simonholywell.com/my_cron_job.php -r
- On the Schedule tab you can change the regularity of the Task with more granularity using the Advanced button. And you can have multiple schedules for the same Task.
- The Settings tab I would set the Stop the task if it runs for: 00 hour(s) 1 minute(s).
- Click OK.
14.06.2008
XAMPP VirtualHosts
Here are some hints for those of you that use a XAMPP install for testing your developments on your local machine.
18.05.2008
Installing Agavi on XAMPP Windows
Having recently heard of the Agavi project from a web framework showdown at a PHP conference in the UK I have decided to trial it. My setup is a WinXP computer with a default install of the latest XAMPP which has thrown up some issues with installing and building Agavi. Please see my hints below to overcome these issues.
18.05.2008
Common PHP Mistakes
A few common PHP mistakes:
- Using require_once when a simple require would achieve the same result. Using require uses less system resources and therefore executes more quickly. You should engineer your code so you don’t need to use require_once. The same of course applies to include statements.
- Failing to declare variables before attempting to use them.
- Don’t use absolute paths and URLs where relative will suffice
- Not opening code for peer review. Often others will have ingenuous just like you about how to optimise your code. Make use of the resources you have.
- Using double quotes where an apostrophe will fit better. Only use “ where the string you are constructing contains ‘ or variables you wish to substituted. This saves the PHP parser from expanding text it doesn’t need to.
- It is recommended that you place the value you wish to match before the variable you hope to find it in. Eg. if (‘test’ == $var) { } This prevents the value being assigned to the variable should you forget an =
14.05.2008
Suzuki Bandit Carburettor Clean
When I went away on holiday the other year I left my Bandit standing for about 3 weeks and it must of had a bad batch of fuel in the tank. The bad fuel turned into jelly in the carburettors and of course the bike started running like a dog. In the back of my mind I had thought I should drain the float bowls before leaving, but it got forgotten in all the excitement of the trip.
14.05.2008
Vauxhall Astra Front Brakes
For those you who possess an Astra from 1990-1998 the following hints might prove useful. I bought a set of two vented rotors and four brake pads for about £40 on ebay so they are reasonably cheap.









