Archive for May, 2005

Final FireFox plugins (for now)

I guess I should include the other plugins I use:

Adblock - the best think in Firefox bar none.

Cookie Culler - a much better cookie controller.

Web Developer Toolbar - Although this might be standard now - I don’t remember installing it last time…

More Cool FireFox Plugins

- PDF Download (thank you! I hate PDF in Browsers

- Menu Editor (trimmed down my context menu - another great feature)

- An easier History

Neat Firefox Plugins

Some good Firefox plugins:

- Live HTTP Headers

- Link Checker (neat!)

- Colorzilla

- View Formatted Source

Firefox Bug with Textboxes

I found my first bug in the Firefox web browser. Basically, if you’ve got a text box with autocomplete=”off” as an attribute, the up and down arrows move the text insertion point left and right. The code for this is:
<input type="text" name="x" autocomplete="off"
value="123456789" />

If you’re using Firefox, you can see this here:

Mouse Pointers and CSS Styles

Mouse pointer styles. E.g.
<span style="cursor: default;">default</span>

default pointer
auto text
help crosshair
move wait
n-resize ne-resize
e-resize se-resize
s-resize sw-resize
w-resize nw-resize

Incredible, but true - View Source problems on I.E.

I couldn’t believe that this fixed a problem we were having with the ‘View Source’ option on I.E. 6. It would not show the source at all. We deleted the link to Notepad that was on the desktop, and suddenly it did.

Windows is crap. And this bug has been around for AT LEAST 2 years.

Unicode

Sorry, but it’s been busy lately. You know how it is. I’ve recently had to do some work looking into how Unicode works and how to use it in PHP. Interesting stuff, certainly I think that all the guys I work with could do with reading this one. Internationalisation is important for big (successful) products - and isn’t that what everyone wants to write?

MySQL and AUTO_INCREMENT

So, MySQL has this lovely feature - you can have a column which will default to the next integer value when you insert some data. You don’t need to set it, it just takes the next value itself.

Unsurprising, the column that is auto incrementing has to be part of a PRIMARY KEY. I mean, that’s what makes the auto increment useful.

However, sometimes I find it can be necessary to have the auto incrementing column as a secondary column in a composite Primary Key. For example, if I have two columns, ‘msg’ and ‘thread’ that are the Primary Key, and I run:

Insert into myTable (thread, text ) values ( 1, 'Andy' );
Insert into myTable (thread, text ) values ( 2, 'Fred' );

Three times, then I would expect to see:

| thread | msg | Text |
-----------------------
|    1   |  1  | Andy |
|    1   |  2  | Andy |
|    1   |  3  | Andy |
|    2   |  1  | Fred |
|    2   |  2  | Fred |
|    2   |  3  | Fred |

What I was getting recently was different. First, I couldn’t have a secondary column in a primary key that was auto incrementing. Odd, I was sure I’d done it that way before. So I tried using a separate key for my composite. That worked, but the data I was getting now was:

| thread | msg | Text |
-----------------------
|    1   |  1  | Andy |
|    1   |  3  | Andy |
|    1   |  5  | Andy |
|    2   |  2  | Fred |
|    2   |  4  | Fred |
|    2   |  6  | Fred |

Not what I wanted. Anyway, to cut a long story short, I figured out the problem - table engines. When I’d build composite primary keys using auto increment, it was on a MyISAM table type (or table engine, as I believe the new parlance is). I’ve now got the latest version of MySQL, and it seems to be defaulting to INNODB table engines. INNODB, while adding cool stuff like transaction support, won’t allow auto increment on a secondary column in a primary key.

So, there you go, hopefully someone will find that a useful thing to know. Just change your table type, and that’ll fix it.