Archive for the 'code' Category
October 1st, 2011 by Alexander Kirk |
Comments Off
Just a quick note, be careful when using the whitespace character \s in preg_match when operating with UTF-8 strings. Suppose you have a string containing a dagger symbol. When you try to strip all whitespace from the string like this, you will end up with an invalid UTF-8 character: $ php -r 'echo preg_replace("#\s#", "", [...]
Posted in code, php |
Permalink
May 31st, 2011 by Alexander Kirk |
Comments Off
Today I had the need to restore single objects from a mongodb installation. mongodb offers two tools for this mongodump and mongorestore, both of which seem to be designed to only dump and restore whole collections. So I'll demonstrate the workflow just to restore a bunch of objects. Maybe it's a clumsy way, but we'll [...]
Posted in code, mongodb |
Permalink
January 27th, 2011 by Alexander Kirk |
Comments Off
I use trac for quite a few projects of mine. Recently I tried to find a plugin for deciding which features to implement next. Usually trac hacks has something in store for that, but not this time. I wanted to be able to create a ticket and then collect user feedback as comments for the [...]
Posted in code, projects |
Permalink
January 11th, 2011 by Alexander Kirk |
Comments Off
Just to add to the speculation about the causes of the 2011 alarm clock bug of iOS where the one-time alarms would not activate on January 1 and January 2, 2011. My guess is that the code that sets off the alarm takes day, month and year into account when checking whether the alarm should [...]
Posted in code, observations |
Permalink
December 26th, 2008 by Alexander Kirk |
Comments Off
I have been using Mac OS X as my primary operating system for a few years now, and only today I have found a very neat way to debug PHP code, like it is common for application code (i.e. stepping through code for debugging purposes). The solution is a combination of Xdebug and MacGDBp. I [...]
Posted in php |
Permalink
August 21st, 2008 by Alexander Kirk |
1 Comment »
Posted in code, misc, web |
Permalink
July 15th, 2008 by Alexander Kirk |
Comments Off
Whenever a new version of WordPress comes out (as just WordPress 2.6 did), it is somewhat of a pain to upgrade it. But not for me anymore, because I have created a small (and simple) script some versions ago which I would like to share with you. $ cat upgrade_wordpress.sh wget http://www.wordpress.org/latest.tar.gz mv www wordpress [...]
Posted in code |
Permalink
May 21st, 2008 by Alexander Kirk |
Comments Off
I am only scratching my own itch here, but maybe someone can use it or expand from it. I just always found annoying that pear run-tests tab gives all files instead of just *.phpt. This is what this snippet actually does. Paste this into the file /opt/local/etc/bash_completion on OSX (for me it is just before [...]
Posted in code |
Permalink
September 26th, 2007 by Alexander Kirk |
6 Comments »
I'd like to introduce you to this great book by Steve Souders. There already have been several reports on the Internet about it, for example on the Yahoo Developers Blog. There is also a video of Steve Souders talking about the book. The book is structured into 14 rules, which, when applied properly, can vastly [...]
Posted in code, web |
Permalink
October 12th, 2006 by Alexander Kirk |
Comments Off
Use svn merge -rhead:{date} to go back in time with a file
Posted in code |
Permalink
August 9th, 2006 by Alexander Kirk |
42 Comments »
Note that this is an updated version. Original version can be found here. Thanks to the commenters I have updated this post with some better tricks. In a loose series I'd like to point out a few of them. As I am currently mostly programming in JavaScript, I will write most of my samples in [...]
Posted in ajax, code |
Permalink
August 8th, 2006 by Alexander Kirk |
Comments Off
Note that there is an updated version I have been programming for about 10 years now, and I am always longing for improving my code. Throughout time I added a few habbits that I consider to be good practices and increase the quality of my code. In a loose series I'd like to point out [...]
Posted in ajax, code |
Permalink