Wednesday, July 2. 2008
A Turtle and a Giant Baby Blanket
I've just finished another slowpoke, like one I made earlier, and this one is at least as cute!

I realised after finishing this one that they original pattern has them with their heads looking sideways, maybe this is why mine always look a bit strange!! This one also doesn't have a tail ... when I came to assemble him, I hadn't made one and somehow it just never happened.
My next project is a square (or maybe more than one, who knows?) for the Oxfam Baby Blanket campaign. The plan is for loads of squares to be knitted and joined together into one large blanket which they display places to campaign on the state of maternal mortality in the world. Then they'll turn the squares into lots of baby blankets to be sent to places where they will be useful. I think its a great cause, this is how I'm doing so far:

If anyone else is knitting for this then add a comment!

I realised after finishing this one that they original pattern has them with their heads looking sideways, maybe this is why mine always look a bit strange!! This one also doesn't have a tail ... when I came to assemble him, I hadn't made one and somehow it just never happened.
My next project is a square (or maybe more than one, who knows?) for the Oxfam Baby Blanket campaign. The plan is for loads of squares to be knitted and joined together into one large blanket which they display places to campaign on the state of maternal mortality in the world. Then they'll turn the squares into lots of baby blankets to be sent to places where they will be useful. I think its a great cause, this is how I'm doing so far:

If anyone else is knitting for this then add a comment!
Tuesday, July 1. 2008
Vim Macro: cleaning up line endings
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.
Sunday, June 29. 2008
Serendipity and Feed Problems
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!
Friday, June 27. 2008
Zend Core Mysql Error
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.
Tuesday, June 24. 2008
DPC Interview
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.
PHPWomen Article Competition
There's an article competition running over at phpwomen.org where thre are two Zend Studio for Eclipse licenses to give away to the best short articles submitted in the Best Practices forum before the end of July. See the announcement for more details.
(Page 1 of 55, totaling 329 entries)
» next page


Comments
Fri, 04.07.2008 07:06
This is a good place to know about more & more women speaker s: hers i am: http://geekspeakr.com/speaker/sree
Wed, 02.07.2008 22:10
LinuxJedi: I have a niece to knit for, no need to go to the great lengths of breeding grandchildren :)
Wed, 02.07.2008 19:58
Awww….That is really cute. Your stuff just gets better an d better :) Although I have visions of you in a rocking c hair in 60 years time knitting away embarrassing clothes for all you grandkids :)
Wed, 02.07.2008 14:28
Lorna, If you’re getting into hooks and coding standards yo u might want to have a look at triggering Greg Sherwood’s ph p codesniffer when somebody attempts to check in changes. http://url.ie/hq6 is a redirect to his blog posting about d oing this.
Wed, 02.07.2008 13:16
Geoff: For line-endings the SVN property is really useful, but for more complex requirements, like the ones Ken mention ed, a hook is more functional I think. I must admit to usua lly specifying whitespace and line endings in coding standar ds and then shouting at people that do it wrong … it [...]
Wed, 02.07.2008 12:57
Have you tried using the svn:eol-style property? This seems more appropriate than using pre-commit hooks.
Wed, 02.07.2008 12:11
Ken: Hello, thanks for dropping by and upstaging me with suc h an excellent tip :) I’ve also seen some nice pre-commit h ooks for SVN that cleans up this kind of badness before the files go near the repo.
Wed, 02.07.2008 01:23
Hi Lorna. Cool tip but I think I can go one better! I ha ve the following line in my ~/.vim/ftplugin/php.vim file autocmd BufWritePre *.php :%s/\s\+$//e This removes all t railing spaces in a .php file prior to writing it to disk an d means I can concentrate on work rather that using ma [...]
Tue, 01.07.2008 22:09
Nik: I can’t imagine what a wsdl would look like pasted into here so I’ve put it in a separate file for you, I’ve includ ed another example soap function so you can see the wsdl wit h two functions and I hope this will give you the help you n eed. The wsdl is at http://web.lornajane.net/sugar_so [...]