|
Tuesday, February 5. 2008
It's pretty common for sites to have a password reset system on websites, which allow you to enter your email address, and have the site email you a link you can use to reset your password.
I had a specification that demanded this kind of system, however it needed to be stateless - in that I could not store any extra information. Also, the hash could only be used once, and it was required that it needed to time out after a configurable time period. Also, the URL must be short enough such that it can be easily copied and pasted into the address bar from an email, and doesn't wrap in the email.
Continue reading "Stateless password reset system"
Wednesday, November 21. 2007
I got PHP4, compiled it as CGI.. here's how.
Install required packages
apt-get install make libmysqlclient15-dev libmcrypt-dev libxpm-dev libpng12-dev \
libjpeg62-dev libcurl4-openssl-dev apache2-dev gcc bison flex
configured as follows.
./configure --enable-force-cgi-redirect --disable-cli --enable-discard-path \
'--prefix=/home/pookey/php/' '--with-xml' '--enable-bcmath' '--enable-calendar' \
'--with-curl' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' \
'--with-xpm-dir=/usr/X11R6' '--with-mcrypt' '--enable-magic-quotes' \
'--with-mysqli' '--with-mysql=/usr' '--with-openssl' \
'--enable-discard-path' '--with-pear' '--enable-sockets' \
'--enable-track-vars' '--enable-versioning' '--with-zlib'
This installed it into /home/pookey/php
Enabled per vhost using the following syntax
SetEnv PHPRC /home/pookey/php/lib/stage
ScriptAlias /php4-cgi /home/pookey/php/bin/php
<Location />
Action php4-script /php4-cgi
AddHandler php4-script .php
</Location>
For some stupid reason I failed to figure out, doc_root needs to be set to the document root for each vhost, and can only be done in php.ini (setting PHP_DOCUMENTATION_ROOT with SetEnv failed). This means each vhost needs it's own php.ini, which is placed wherever you set PHPRC to.
Using this system, you can have PHP4 and PHP5 mixed even on the same vhost
Monday, October 29. 2007
I noticed that google was going crazy indexing trac for doctrine. Today it downloaded over 90000 pages, transfering 3 gig of data! It was causing quite a bit of load on the server (not huge amounts, but enough to show in my graphs!)
Eventaully , I came up with a nice little trick for reducing the number of hits google will make against a trac install. Google have extended robots.txt to allow some slightly improved pattern matching. Here's my snippet, if you don't understand it, please don't use it.
User-Agent: Googlebot
Disallow: /*?rev*
Tuesday, October 23. 2007
Took me a while to figure this out, so thought I'd put it here for others. This is useful for Xen setups, where you use a file for the disk image. AFAIK, you can only grow an image, not shrink it.
# dd if=/dev/zero bs=1M count=1024 >> disk.img
# e2fsck -f disk.img
# resize2fs disk.img
# e2fsck -f disk.img
This makes the disk image bigger, checks the image, resizes the file system, and then checks it again
Tuesday, October 2. 2007
Check out this blog post. Looks promising, PHP might finally get name spaces, and somehow, they have managed to use the '::' separator! Great news, but I'm not going to believe it till I see it released, even though it's been checked into SVN already
Sunday, September 30. 2007
The symfony SVN is pretty unstable, and it's anoying
Here's a mirror!
http://symfony.pengus.net
Thursday, June 14. 2007
This precommit script will prevent people from checking in syntactically invalid PHP files to a subversion repositroy
#!/bin/bash
REPOS="$1"
TXN="$2"
PHP="/usr/lib/php5/bin/php"
SVNLOOK=/usr/bin/svnlook
CHANGED=`$SVNLOOK changed -t "$TXN" "$REPOS" | awk '{print $2}'`
for LINE in $CHANGED
do
FILE=`echo $LINE | egrep \\.php$`
if [ $? == 0 ]
then
MESSAGE=`$SVNLOOK cat -t "$TXN" "$REPOS" "${FILE}" | $PHP -l`
if [ $? -ne 0 ]
then
echo " " 1>&2
echo "---------------------------------------------------------------------------------" 1>&2
echo "During automatic PHP syntax checking we found an error in the following PHP file: " 1>&2
echo " " 1>&2
echo "${FILE}: $MESSAGE" | sed "s| -| $FILE|g" 1>&2
echo " " 1>&2
echo "Please correct the error and try commit again." 1>&2
echo " " 1>&2
echo "You can check for syntax error on your computer by running command: php -l ${FILE}" 1>&2
echo " " 1>&2
echo "Best regards," 1>&2
echo "Doctrine Dev Team" 1>&2
echo "---------------------------------------------------------------------------------" 1>&2
exit 1
fi
fi
done
Wednesday, May 16. 2007
I've done a bit of research, and the N95 is defiantly coming to Three. The time frame isn't set (or at least, isn't announced, and I've been unable to find one...), however it's likely to appear within the next few weeks or months.
UPDATE (31/05/2007): The manager at my local 3 store was told that the phone would be in by the end of this month. It's not actually going to happen, but it does give the impression it will be happening any time now. Perhaps within the next few weeks. Someone discussing this on 3g.co.uk suggests that Three don't want to release another buggy handset, and are holding back on releasing this phone for a while.
UPDATE (01/06/2007): Another place worth watching might be here http://www.x-series.org/2007/05/08/nokia-n95-is-coming-to-three/trackback/
- apparently the first week of june is looking likely!
UPDATE (12/06/2007): Three called me today, and explained it would be a while, they are still testing. They could unfortunately give me no idea as to how long it would be, but it is coming (apparently).
Sunday, May 6. 2007
The parts of a Walkera 60 are hard to find, as such I had to get mine of ebay. The parts came with no instructions at all, and it took me much googling before I managed to find anything useful.
So, I though I would link to guides I found from here, to help out fellow Walkera 60 owners. The first guide also covers the fitting of the tail rotor kit, and shows how you would go about replacing a rotor shaft should you need to.
Sunday, February 25. 2007
Phix - an alternative to PHP... well, not yet
Knowing how Theo is when get gets in one of his moods, it will never actually get finished, but he's started a new language called Phix, which hopefully one day might be a replacement for PHP. Wait and see....
|