Archived News for August 2009

Using Long Varchar Columns with Doctrine

MySQL has supported large varchar columns since 5.0.3, about four years ago (previously, you could only have varchar columns of up to 255 characters in length). So, for quite a while now, you've been able to use them with lengths up to 65,536 characters - depending on a few variables like your maximum row length and character set.

Unfortunately, that doesn't seem to be the case if you're using Doctrine. By default, if you use a string column with a length larger that 255 characters, Doctrine will silently use a text column, not a varchar. That has a bunch of follow-on effects, that you might not notice at first. For example, MySQL will only use the first 1024 characters of your column for sorting. I could see this leading to some pretty hard to find bugs.

Investigating where the 255 character limit comes from, it does seem to be a property of the Doctrine Connection. That's good: it's the right place for the restriction to be recorded. But, even though Doctrine_Connection extends Doctrine_Configurable, the varchar_max_length property of the connection doesn't seem to be configurable. In any way. At all.

Let me make it clear. They could have implemented varchar_max_length as an attribute, or as a parameter, in which case Doctrine_Configurable would have let you change its value. But they didn't. Or they could have implemented it as an option, in which case Doctrine_Connection would have let you change its value. But they didn't. They implemented it as a property, which you can't change without subclassing the connection object. Yuck.

OK, I thought. Not too bad. I'll just subclass the connection and use that. Oh, wait. All the connection drivers are hard coded in Doctrine_Manager:

        $drivers = array('mysql'    => 'Doctrine_Connection_Mysql',
                         'sqlite'   => 'Doctrine_Connection_Sqlite',
                         'pgsql'    => 'Doctrine_Connection_Pgsql',
                         'oci'      => 'Doctrine_Connection_Oracle',
                         'oci8'     => 'Doctrine_Connection_Oracle',
                         'oracle'   => 'Doctrine_Connection_Oracle',
                         'mssql'    => 'Doctrine_Connection_Mssql',
                         'dblib'    => 'Doctrine_Connection_Mssql',
                         'odbc'     => 'Doctrine_Connection_Mssql', 
                         'firebird' => 'Doctrine_Connection_Firebird',
                         'informix' => 'Doctrine_Connection_Informix',
                         'mock'     => 'Doctrine_Connection_Mock');

        if ( ! isset($drivers[$driverName])) {
            throw new Doctrine_Manager_Exception('Unknown driver ' . $driverName);

WTF? Who thought that was a great idea?

Windows 7 and TrustedInstaller

So this probably isn't the best idea to override the system setting (it probably has a use right?), however i dont like notepad and i like something better like notepad2. So here is how you override the annoying as hell TrustedInstaller permissions that stop you from doing fun things to windows core files:

  1. Open a command prompt with admin privilage
  2. Take ownership of notepad.exe: takeown /F c:\windows\system32\notepad.exe
  3. Change the security settings so you have full access to notepad.exe: cacls c:\windows\system32\notepad.exe /G <username>:F

Things to note:

  • If you get a virus, its now quite easy for it to over write notepad.exe to a virus (but i'm guessing it could use the above process anyway)
  • As per usual, backup the original, just incase the proverbial hits the fan

Thank is all.

Pedal Board

This thing's finally off the ground, making progress, and making noise. Thanks to Dom for helping me procure the transformer which gives me eight filtered 9V DC supplies (plenty of room for expansion) and one 9V AC for the delay pedal; yes, the enclosure is a screwed-down takeaways container with soldering-iron holes in it. It can be seen that neatness isn't my priority; I ain't even gonna show you the insides of any of the boxes. The chassis is what's left of an old piano I've been salvaging for various furniture pieces about the house.

The signal chain right now is: gat, home-made fuzz/distortion, dunlop crybaby for bass, moog LPF with expression pedal to frequency, ZVEX ringtone, home-made fuzz, home-made buzzbox/weird tremolo-ringmod into buzzbox, line6 delay modeler.

The old piano pedal acts as a no-intermediary expression pedal for the delay pedal: when the pedal touches the nail it shorts a resistor across the expression pedal jack and switches between two delay settings. I want to do something similar with the other piano pedal to get another foot-control for the LPF, but that'll probably have to be latching. Next pedal is a multi-octave thing little more ambitious than what I've built there.

bass rig pedal board right pedal board left weird tremolo-ringmod-buzzbox pedal pedal detail


I got a 2degrees SIM card from their free offering on the web.

They just sent me an email, subject: "did someone steal your mail?". They've figured that I received the SIM. But they also know that I haven't made a call with it yet. (I've checked it works with my Android phone, passed it on to someone else.) So, in the email they have me on about it, encouraging me to make my first call.

That's great marketing.

Newest Posts