Mysql Error
Monday, July 7. 2008
I was running an import script today taken from a mysqldump from another user, when I saw an error that looked like this:
This is caused by a mysqldump or export process exporting tables in alphabetical order and not in the order in which they rely on one another. My tables had foreign keys which fail on import if the other table doesn't exist when you create the table with the key. In this case I was only importing six or eight tables so I simply opened the script in a text editor and re-ordered the import blocks. On a bigger scale a more technical solution might be required!
ERROR 1005 (HY000) at line 123: Cant create table(errno: 150)
This is caused by a mysqldump or export process exporting tables in alphabetical order and not in the order in which they rely on one another. My tables had foreign keys which fail on import if the other table doesn't exist when you create the table with the key. In this case I was only importing six or eight tables so I simply opened the script in a text editor and re-ordered the import blocks. On a bigger scale a more technical solution might be required!
Vim Macro: cleaning up line endings
Tuesday, July 1. 2008
When development teams have people working on a variety of platforms, its pretty common to end up with wrong line endings. In vim these will look like ^M at the end of each line. To get rid of these line endings you can use the following command (in command mode)
:% s/^M$//
To type the correct ^M character, you'll need to press Ctrl + V followed by Ctrl + M (the first combination means "take the next combination literally).
To turn this into a macro you should do the following. In command mode, pressq, followed by any letter. This will be the shortcut to access the macro. Then type the command as above. Finally, press q again to stop recording and its done. You can use your macro by pressing @ and then the letter you chose.
:% s/^M$//
To type the correct ^M character, you'll need to press Ctrl + V followed by Ctrl + M (the first combination means "take the next combination literally).
To turn this into a macro you should do the following. In command mode, pressq, followed by any letter. This will be the shortcut to access the macro. Then type the command as above. Finally, press q again to stop recording and its done. You can use your macro by pressing @ and then the letter you chose.
Serendipity and Feed Problems
Sunday, June 29. 2008
This site uses a blogging platform called serendipity which is a nice little tool and I've been mostly happy since moving across from textpattern (I did write about the experience). Recently however, a few things have been going wrong with the feeds.
I edited an old post, because the image links were broken (I did have a nightmare migrating because I was so inconsistent about the format of the image tags in textpattern, completely my own fault). I was very careful not to update the published date of the article, however the edited article appeared in the feed, which wasn't what I had in mind! It turned out that this is by design. On line 262 of includes/functions_entries.inc.php (I have serendipity 1.1.3), I found this:
$cond['orderby'] = 'last_modified DESC';
I've commented out this line, which was in an if($modified_since) clause. Hopefully this will stop updated entries from appearing in the feed - I have a few other old ones to fix images in so we'll soon see.
At around the same time, Ivo mentioned that he was seeing the order of posts change in his reader (google reader) when people commented on my posts. I suspect that this is part of the same issue and I'm optimistic of it also being fixed by this change. However when I was looking into the problem I noticed that the URL he was using to access my feed, http://www.lornajane.net/index.rss2, actually returned RSS 0.91. Not ideal! The problem is the rewrite rule in serendipity's .htaccess file, which looks like this:
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
When you request index.rss2 it should rewrite to rss.php?file=$1&ext=$2 but the "rss" matches first so the user gets redirected to index.rss instead. As a nasty hack to get around this I removed the rss from the above example and gave it a line of its own:
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rdf|rss2|xml) rss.php?file=$1&ext=$2
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss) rss.php?file=$1&ext=rss
Requests to index.rss2 are now correctly rewritten as rss.php?file=index&ext=rss2 and will get RSS 2.0 format in the response. I have just noticed however that this is the most requested page on the site so I really hope I didn't break anything!
I edited an old post, because the image links were broken (I did have a nightmare migrating because I was so inconsistent about the format of the image tags in textpattern, completely my own fault). I was very careful not to update the published date of the article, however the edited article appeared in the feed, which wasn't what I had in mind! It turned out that this is by design. On line 262 of includes/functions_entries.inc.php (I have serendipity 1.1.3), I found this:
$cond['orderby'] = 'last_modified DESC';
I've commented out this line, which was in an if($modified_since) clause. Hopefully this will stop updated entries from appearing in the feed - I have a few other old ones to fix images in so we'll soon see.
At around the same time, Ivo mentioned that he was seeing the order of posts change in his reader (google reader) when people commented on my posts. I suspect that this is part of the same issue and I'm optimistic of it also being fixed by this change. However when I was looking into the problem I noticed that the URL he was using to access my feed, http://www.lornajane.net/index.rss2, actually returned RSS 0.91. Not ideal! The problem is the rewrite rule in serendipity's .htaccess file, which looks like this:
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
When you request index.rss2 it should rewrite to rss.php?file=$1&ext=$2 but the "rss" matches first so the user gets redirected to index.rss instead. As a nasty hack to get around this I removed the rss from the above example and gave it a line of its own:
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rdf|rss2|xml) rss.php?file=$1&ext=$2
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss) rss.php?file=$1&ext=rss
Requests to index.rss2 are now correctly rewritten as rss.php?file=index&ext=rss2 and will get RSS 2.0 format in the response. I have just noticed however that this is the most requested page on the site so I really hope I didn't break anything!
Zend Core Mysql Error
Friday, June 27. 2008
I've had this error more than once. On a debian virtual machine, with Zend Core installed, and when mysql doesn't restart when the machine reboots. It looks something like this:
debian:/usr/local/Zend/mysql/bin# ./mysqld
080627 12:31:16 [ERROR] Can't find messagefile '/usr/local/mysql/share/mysql/english/errmsg.sys'
080627 12:31:16 [ERROR] Aborting
This is for two reasons. First: you need to be up one level of directory to be able to run these commands. Some errors will tell you that but this one doesn't. Secondly, you need to use the mysqld_safe command.
debian:/usr/local/Zend/mysql# bin/mysqld_safe
Starting mysqld daemon with databases from /usr/local/Zend/mysql/data
This works for me - I have no idea if it is the prescribed method but background the process above and you're good to go.
debian:/usr/local/Zend/mysql/bin# ./mysqld
080627 12:31:16 [ERROR] Can't find messagefile '/usr/local/mysql/share/mysql/english/errmsg.sys'
080627 12:31:16 [ERROR] Aborting
This is for two reasons. First: you need to be up one level of directory to be able to run these commands. Some errors will tell you that but this one doesn't. Secondly, you need to use the mysqld_safe command.
debian:/usr/local/Zend/mysql# bin/mysqld_safe
Starting mysqld daemon with databases from /usr/local/Zend/mysql/data
This works for me - I have no idea if it is the prescribed method but background the process above and you're good to go.
DPC Interview
Tuesday, June 24. 2008
So, at the Dutch PHP Conference, they were making a video and they interviewed me. The video is at http://www.bachelor-ict.nl/dpc and it is also featured in this article on DevZone which is exciting! The video is mostly about the PHPWomen organisation, rather than my talk but it does have some footage of me speaking and of the conference itself.
DPC Day 1
Friday, June 13. 2008
Well, its a misleading title because the day is only half over but the Dutch PHP Conference 2008 is well and truly underway! Today I've been in the Zend Framework tutorial given by Matthew Weir O'Phinney, which is a full-day session. Its been excellent - with some concepts, some examples, and now a real working application to take a look around and learn from. I've had to work with ZF a little bit lately and I wish I'd been able to have this tutorial before I did that!
I've been able to catch up with a lot of people since arriving late last night and making the mistake of not going to bed until late because I wasn't tired (still on UK time) and then having to get up early today! Tonight we have an Ibuildings employees event which will be great, I'm excited to put faces to names for all my colleagues - the downside of the telecommute is that I mostly know people on Skype or IRC and not in real life. Later on there is a pre-conference social as well (from 8pm) - which is why my day is only half done :)
Looking forward to tomorrow, when there will be a phpwomen stand upstairs outside the main hall, we'll be giving out shirts (they're white this year) so if you want one then come and get it! Tomorrow at 2pm I'm giving my talk "PHP Deployment with Subversion" which looks like it will be well attended. Oh and its Worldwide Knit In Public Day as well so I'll be attempting to fit that in as well!
I've been able to catch up with a lot of people since arriving late last night and making the mistake of not going to bed until late because I wasn't tired (still on UK time) and then having to get up early today! Tonight we have an Ibuildings employees event which will be great, I'm excited to put faces to names for all my colleagues - the downside of the telecommute is that I mostly know people on Skype or IRC and not in real life. Later on there is a pre-conference social as well (from 8pm) - which is why my day is only half done :)
Looking forward to tomorrow, when there will be a phpwomen stand upstairs outside the main hall, we'll be giving out shirts (they're white this year) so if you want one then come and get it! Tomorrow at 2pm I'm giving my talk "PHP Deployment with Subversion" which looks like it will be well attended. Oh and its Worldwide Knit In Public Day as well so I'll be attempting to fit that in as well!
« previous page
(Page 2 of 5, totaling 25 entries)
» next page

Comments
Wed, 27.08.2008 10:19
If it’s anything like the Asus that I have, then it should b e relatively easy to put Ubuntu on it, like I’ve done with m ine. Put installer on to a bootable USB stick…
Wed, 27.08.2008 08:50
It should be possible to automatically close down the wifi c onnection and unload the kernel module on hibernate. Look a t the scripts in /etc/apm/suspend.d for example. /etc/de fault/acpi-support might also have some options to get you s omewhere. I put my normal ethernet driver module (e100 [...]
Tue, 26.08.2008 14:56
Vid: Thanks for dropping by, I’m very pleased to hear you fo und this useful.
Tue, 26.08.2008 14:54
dotjay: Shared offices are OK, but I do like the peace and quiet of not sharing I must say. I get a bit loopy though i f I stay home for too long! The offline time trick is a goo d one – I like to at least turn off the monitor and use a pe n sometimes.
Mon, 25.08.2008 20:00
I’m so glad that you settled into telecommuting so well. As you know, I’ve been working for myself and/or telecommuting for the last five years. I’ve never really had the experienc e of a shared office, but I do use Skype a lot, sometimes ta lking with work mates for hours at a time. The trick i [...]
Sun, 24.08.2008 23:25
Lorna, Great post, found this via Chris’s blog, more tool s in my toolset now :). Thanks
Sat, 23.08.2008 20:46
shaun: I didn’t anticipate problems, I just didn’t think it worked in that way – but I’m completely happy to be told oth erwise :) Don’t be surprised that curl lets you do weird an d wonderful things, lots of tools are like that and it allow s you to use them in ways that the original author had [...]
Sat, 23.08.2008 10:21
ok, I’ve been experimenting with this, ‘switch’ing on the RE QUEST_METHOD to implement post, get, put, delete for a db r esource; so far I’ve not had problems using $SERVER[‘QUERY STRING’] and parse_str()... what problems do you anticipate? (I’m not sending files, everything fits in the string [...]
Fri, 22.08.2008 09:20
The main conference site is now live, and the call for paper s is open – see http://conference.phpnw.org.uk/phpnw08/