Monday 22 June 2009

Websiting

This morning I was listening to H-FM, and they played 'Tiny dancer' by Ironik. When I first heard it I thought it was Richard Blackwood. When I found out it wasn't Richard Blackwood, I was kind of suprised that a previously unknown artist with a relatively weak flow could be reasonably successful. I checked that it's not just me thinking Ironik's flow sounded weak, and its not just me.

The sad thing is that I hear Ironik songs (mainly "Stay with Me") more often that say Wiley tracks on the radio. And the only Wiley song they ever play is "Wearing my Rolex".

I spent the morning do some work on my photo website, changing the way that categories are extracted from the image's metadata and inserted into the database since I have changed the way the categories are saved in the image's metadata.

I spent the afternoon and evening trying to debug my code and find why it wasn't inserting the categories properly. Most of the problems were due to typos, but I did have one problem that took me quite a while to work out and wasn't a typo:

When I ran the query
INSERT INTO location SET City = 1
, ProvinceState = 1
, country = (SELECT country.id FROM country WHERE CountryName = 'United Kingdom')
, WorldRegion = (SELECT worldRegion.id FROM worldRegion WHERE WorldRegion = 'Europe')
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
INSERT INTO img_locationCreated VALUES(1, LAST_INSERT_ID());
I was getting the error
Mysql Error: Cannot add or update a child row: a foreign key constraint fails (`dkphoto/img_locationCreated`, CONSTRAINT `fk_img_locationCreated_location` FOREIGN KEY (`location_id`) REFERENCES `location` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)

I didn't understand how this error was happening. I checked that all my column types (unsigned ints) matched up, and they did, the column names were correct etc. I tried quite a few different things, but couldn't get any of them to work.

But when I was getting the CREATE TABLE sql to post on the mysql forums with my question about why it wasn't working, I noticed that the storage engine for the table was set to BerkeleyDB. This is because I wanted rows in this table to be UNIQUE, even if they contain NULL values. However, I think BerkeleyDB support has been dropped from MySQL, and the table was actually created with the MyISAM engine. Anyway, I changed the engine to InnoDB, and the problem disappeared.

After fixing that I watched an episode of Satr Trk with Moccle and L. Then I watched some youtube videos including:

2.3 avg. rating on IMDB and £60 +P&P on VHS from ebay!! Looks like the best film ever!!

Then I did some more website stuff and found my URLs were getting a bit long e.g. http://www.photosite.com/photos/Life/Plants, Animals, Fungi, Chromista, Protozoa/Plants/Flowering Plants/Dicots/Violales/Begonias/Begonia/2-Begonia-flower-close-up
Reading SEO Best Practices for URL Structure, it says you shouldn't have more than 5 words! So after all that time I spent trying to get my categories extracted with long paths, it seems it was a waste of time. Oh well.

Food
Breakfast: Chocolate crunch oat cereal; cup o' tea.
Lunch: 2x cheese-on-toasts; salad; apple; slice of Madeira cake; Rocky; cup o' tea.
Dinner: Chilli con carne; rice; tortilla chips; cheese. Pudding was a Strawberry Muller fruit corner. Coffee. 3 bits Sainsbury's caramel chocolate.

No comments: