4 Nov 2006

PHP4.4 and Apache2.2 on Windows XP

Had loads of fun trying to set PHP 4.4 and Apache 2.2.3 up on my XP machine. After making the required PHP mods to the httpd.conf file, Apache would not restart with an "Operation Has Failed" dialogue. Running httpd.exe -t from the command line gave me the following:

httpd: Syntax error on line 115 of C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf: Cannot load C:/PHP/php4apache2.dll into server: The specified module could not be found.

But the DLL was definitely there!

Only after lots of fruitless searching did I notice that the PHP install notes only mention Apache 2.0, not 2.2. So I did a specific search and found the work of the dudes at ApacheLounge: http://www.apachelounge.com/download/

Their version of the DLL compiled for 2.2.x works a treat. Huzzah!

29 Oct 2006

Fog Gone!

So the other night I rode my bike down the A64 to my friend's house, and it was v. dark, and lo - my visor foggeth up and I could not see a bleedin' thing.

So I thought that was the end of my winter bike fun. However, turns out that my X-Lite X601 helmet features a Pinlock-compatible system. Basically this means you can buy an 'insert' which looks just like a cheap bit of perspex which fits inside the visor, and is held in place by two pins. So I did - those fine (but morose) chaps at Hein Gericke York had one in stock for 18 quid. Had a big ride around the Dales today and NO FOG AT ALL. Heaven knows I tried - deep breaths into the helmet - the visor surrounding the insert fogged up a treat, but the insert remained clear as day.

Amazing stuff, I order you to buy one immediately.

Now all I need is a new seat for my CBR, my bum is killing me now ;)

25 Oct 2006

Some Product Reviews

Thought I'd take a second to give some mad props to various software products I've been using recently.

First off, thanks to Innovasys for their nifty DocumentX and HelpStudio2 applications. These have allowed me to write professional-quality .NET 2.0 documentation for NetBuild CMS. DocumentX automagically collates all the XML comments that I've put in my code via VisualStudio and includes them with full Class and Member reference documentation. HelpStudio2 then integrates with my DocumentX project and allows me to write nice looking HTML help and tutorials. It has good built-in tools for screenshots - I especially like the User Interface Mapping tool which quickly lets me add bullets to screenshots for easy reference in my help text. Then I can create the documentation in plain HTML, CHM and PDF. Saved loads of time. I also got good phone support when I had a problem.

The other product I have been impressed with is XHEO Licensing 2.1 which has very quickly allowed me to add flexible licensing options to the NetBuild Suite products. You just need to point the License Manager at your .NET project and it does its stuff. Recompile your Assembly and it's ready to rock. Then you can issue licenses with a range of 'limits' like "Only allow to run from the following Domain Name(s)". Hats off to these guys.

Right, back to the NetBuild CMS v8.5 code face.....

12 Oct 2006


Here's the news, news shrews.


I bought a 1999 Honda CBR600F FX in Black n' Silver n' Yeller. And it's pretty good. Scary fast. Makes a hell of a lot of clattery noises but apparently that's normal. Always starts first time. Wish it had a clock though, I never know what time it is!

House Move

I done moved to Tadcaster near York. It's RUBBISH. Be moving again soon!

Wharfedale 21" CRT Television CTV2185RF

Was Crap, took it back.

Wharfedale Freeview Receiver DV832B

Was Good, kept it!

X-Arcade Trackball

Good at what it does - but expensive and was totally bored of it after one evening! So I told her to sling her hook and spent the next night playing Marble Madness on this instead, coolio!


20 Jun 2006

Motorbike / Motorcycle Training

So for some reason I decide I wanted to learn to ride a bike! A proper 500cc bike that is, so I booked a course with West Pennine Motorcycle Training in Blackburn, UK. I got 4 days of tuition and then did the test on the morning of the 5th day. I passed, yay! It wasn't easy but it was pretty amazing seeing as I never rode on a bike before.

Big thanks to Alan and Kevin from the course. And if anyone is considering the residential course, can I just warn you that the St Albans Guest House (the one they book you into) is like something out of a George Orwell novel.

Right I'm off to buy a bike :)

Visual Studio Solution Statistics

Usysware's DPACK is cool and amongst other things, can tell you how many lines of code you've written in your giant .NET projects :)

8 Mar 2006

Cookies in .NET 2.0

Here's some stuff you need to know when using Cookies in .NET 2.0 :

1. To check if a cookie exists, see if Request.Cookies[CookieName] is null. DON'T CHECK Response.Cookies in this way just to see if a cookie exists! Doing this, if the cookie does not exist

  • An empty "browser-session" cookie with name of CookieName is created in the Response.Cookies collection.
  • The cookie created above is copied to the Request.Cookies collection! This is clearly bonkers.

2. To send a new cookie to the user's browser, use Response.Cookies.Add().

  • If you want a "permanent" cookie, set Expires to DateTime.Now.AddYears(30)
  • If you want a "browser-session" cookie, set Expires to DateTime.MinValue

3. To change aspects of an existing cookie received from the user's browser, copy it from Request.Cookies to Response.Cookies and make your amendments. YOU HAVE TO RESET THE Expires PROPERTY as it will have arrived set to DateTime.MinValue in the Request.Cookies collection, regardless of its actual expiry date on the user's browser.

4. To remove an existing cookie from the user's browser, there is ONLY ONE RELIABLE WAY TO DO IT. Copy it from Request.Cookies to Response.Cookies and set the Expires property to DateTime.Now.AddYears(-30)

GOD HOW IRRITATING. I'm sure Cookies weren't this much bother in PHP. Thanks to Paul Riley for his useful article: http://www.codeproject.com/aspnet/AspNetCookies.asp

30 Jan 2006

Slow SQL Server Delete

Just wanted to share a solution with you. Slow SQL deletes had begun to make an application perform poorly.

I had optimized a delete sproc as much as possible using WITH (ROWLOCK) and all the other performance tricks I could find. Showing Execution Plan in Query Analyser shed no light on the problem - it reckoned the delete was putting little load on the server. However, deleting 500 rows from a table was taking 40 seconds!

Turns out that if you have referential integrity set up between your tables (i.e. foreign key relationships with Foreign Key Constraints enforced), you need to ensure that all foreign key columns in your tables have an index. Otherwise, when you delete a record from a primary key table, referential integrity checks will cause table scans on the referring foreign key tables - and scans are terribly slow compared to index lookups. Sure enough I had neglected to put an index on one of the referring tables; when fixed the same query took less than 2 seconds.


TABLE: Customer

CustomerID (Primary Key)
Address etc.

TABLE: Order

OrderID (Primary Key)
CustomerID (Foreign Key - Relationship with Customer table - THIS FIELD SHOULD BE INDEXED)
Order Details etc.

18 Jan 2006

W800i MP3 file problem

Hello zootfans. I've got a new mobile phone, a Sony Ericsson W800i, to replace my old SPV C500 (what a piece of crap that turned out to be!!).

The new phone seems pretty good so far. Just wanted to share with you something I've observed with it when trying to copy files to it via USB from Windows 2000.

Basically, don't try to access the MP3 tracks on the phone while the cable is connected to the pooter. Otherwise weird stuff happens, like tracks going missing. Here's how I transfer without problems:

1. Connect phone to computer via USB.
2. Copy tracks to phone either using Disc2Phone or Windows Explorer (the latter is quicker I reckon)
3. Use "Unplug or Eject Hardware" in the Windows taskbar to safely drop the connection.
4. Remove the USB cable from the phone.

I'm guessing step 3 won't be required on XP, but haven't tested it yet.

8 Jan 2006

Outlook 2000 Send/Receive Error "Operation Failed"

Bah, second time I've had to fix my crappy Outlook 2000. Works fine for a while then some day I'll press "Send / Receive" and it'll just come back with "The Operation Failed". Thanks a bunch Microsoft!

So I did a bunch of googling but the best solution I could find is just to create a new mail profile (in Control Panel > Mail), fill in all the bleedin' POP3 account details again and then add my old PST file with all my mail in it. You do that in Outlook - Tools > Options > Mail Setup > Data Files > Add. Then you have to set the old PST file as your default delivery location: Tools > Email Accounts > View / Change Existing Email Accounts > Deliver New Mail To The Following Location.

Only then can you delete the new PST file, smoke a doobie and pretend none of this crap ever happened. As ZZ Top said - "have you heard... what's the word??? It's Thunderbird".

6 Jan 2006

GuitarPort from Line6

Yay! My 73 quid ebay purchase finally arrived - a used Line6 Guitar Port. Okay, so I paid only a little less than for new - my least successful ebay bargain to date ;) Never mind, it's essentially a USB dongle and some software, so there's not much to go wrong with it when second hand.

So what is it? Basically it's a USB soundcard in a snazzy red case, with phono outputs, a headphone output, a line-in and most importantly - an input for an electric guitar (or microphone or whatever). That's not the clever bit - the clever stuff is the bundled software that processes the guitar input and makes it sound like I'm playing through a giant marshall stack with a grand's worth of effects pedals at my feet.

Really, for the money it is excellent - umpteen different amps modelled, a bunch of stomp boxes, a noisegate, a metronome and a tuner all united on a sweet computer interface that you control with just your mouse. For me with wife and tiny baby, being able to get a good sound without cranking up an amp is really cool. Headphones are fine - and if I want I can stick it through my stereo too.

Anyone considering purchasing one may have some questions like I did, about what else you need to run it an such. Well, because it's a soundcard in its own right all you really need is:
  • Computer with Win98-ME-2000-XP (I use a 1.8MHz laptop with 1Gb of RAM)
  • Guitarport Sound Engine software (included)
  • USB cable to GuitarPort (included)
  • GuitarPort (obviously :)
  • Electric guitar cable
  • Electric guitar
  • Headphones (they plug into the GuitarPort, not the computer)

That's the super-slimline basic requirements. Other than that you could run a cable from the line-out of your computer (if you have one) to the line-in of the GuitarPort; That would let you mix the computer's sound output with the modelled sound output of your guitar. Another groovy thing about it being a soundcard is that you can select it as an input in some recording software (e.g. the excellent and free Audacity) and record your rocking new sound.

Good job, Line6!

4 Jan 2006

ASP.NET 2.0 default form buttons

Back in the old days we used to be able to put as many forms as we liked on a page. One cool thing about that was they could be set to action on different pages, and the appropriate submit buttons would fire when Enter was pressed.

Now ASP.NET only really allows us to use one form (without nasty hacks) on a page, we have the problem that any submit button is potentially the target of the Enter key.

I did an ASP.NET 1.1 site where I had to solve this prob and used the MetaBuilders solution: http://www.metabuilders.com/Tools/DefaultButtons.aspx

Well, I just found out that the Panel object in ASP.NET 2.0 has a DefaultButton property which applies to all the child inputs of the Panel. Lordy loo.

There is a drawback however - it requires Javascript to work (like so many other ASP.NET controls). I'm no JavaScript hater but bear in mind that WCAG 1.0 Level A requires a site to work without Client Script. Nothing's ever easy is it?

3 Jan 2006

ASP.NET - controls created dynamically on event fail to fire their handler

Another wild goose chase, hoorah. So - I wanted to create an input control dynamically in response to a button being pressed on the same page. But I naturally wanted to handle events for the dynamically created control.

Here's how I did it:

1. Create a method e.g. LoadControl() to load the control.
2. Create the OnClick() handler for the button that initially loads the control onto the page, and wire it to LoadControl();

At this point, the control will appear in response to the OnClick() method, but will disappear again when you try to handle any further events that the control creates. This is because the control is only created in reaction to OnClick, not by the postback from the control. So....

3. Place code in the Page_Load() or OnLoad() method to call LoadControl() if certain postback criteria are met e.g. IsPostBack and detect some property of the dynamically loaded control from the postback.

4. And here's the bit that took me ages to track down - ensure you have given an explicit ID to every input of your dynamic control including buttons. Otherwise .NET will generate its own ID which may be different between requests, hence causing missed event handling.

Pretty obvious really, but I, as the Lancaster Bomber used to say, "had a cold". Ho ho ho.
If I helped you out today, you can buy me a beer below. Cheers!