The diary and photos of Chris Beach. I'm into windsurfing, coding, badminton, drawing and composing music using computers and synths.

Let's start with a quote:
"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours" Stephen Roberts


email: password:
Sign in with Google

last journal entries (total: 98) RSS Feed

fixing phlickr's internal php references so it can be used from scripts throughout a filesystem

Phlickr is the PHP5 API for the excellent photo-sharing website Flickr. It works well from what I've seen so far.

One problem though - the various PHP files within the Phlickr API reference each other using relative links i.e. require_once 'Phlickr/API.php', which means that all scripts that use the Phlickr API must be in the directory that contains the Phlickr directory. For me this proved inflexible as I nest my PHP scripts within various directories.

Therefore, I needed to run a substitution on the Phlickr API files in order to make the referenced paths absolute. Here we can use PHP's global $_SERVER['DOCUMENT_ROOT'] variable, which provides the physical filesystem path to the root directory serving up the PHP files. Here's a substitution command I came up with, which should be run within the Phlickr API directory:

find . -name "*.php" | xargs sed -i "s/'Phlickr\\//\$_SERVER['DOCUMENT_ROOT'] . '\\/Phlickr\\//g"

Note: this command works for me in bash - I haven't tried it in other shells.

After the substitution, the Phlickr API should be placed in this root directory, but other scripts that need to access it can be placed in subdirectories

written by Chris Beach
04/09/07 11:31pm
(5 years, 9 months ago)
comment add comment

photoadd photo

auctioning judgetheweb.com and judgetheweb.co.uk

I've decided to auction off a couple of domain names that I'm not using at the moment:

judgetheweb.com [visit auction]

judgetheweb.co.uk [visit auction]

They're both starting at £0.99 and have no reserve. If you know anyone who might be interested, please let them know!

I also have a few more "spare" domains but I'm curious to see the response to these auctions before I give the others a shot.

Does anyone know of any good places to promote these sales? I will be hitting facebook.com as soon as I get home, of course!

written by Chris Beach
20/06/07 11:44am
(6 years ago)
comment add comment

photoadd photo

automating spam assassin's learning process on plesk

Update [22/11/07]: I have updated the script to make it more generic

Amongst other techniques, Spam Assassin uses a bayesian filter to judge the probability that a mail is spam. The bayesian filter works on the probability that certain words in the mail identify it as spam or non spam. In order for this to be effective, the filter needs to be taught - and this can be automated to a degree.

It took a fair amount of Googling to work out this solution, so hopefully it will save you some time if you have a similar setup to mine (Linux, Plesk, Qmail, Spam Assassin). You may need to substitute your Spam, Learn and Trash folder names if they differ from mine:

1. Inside your Spam mail folder, create a folder named Learn.
2. If a spam mail is not caught by Spam Assassin, get in the habit of moving it manually to your Spam/Learn folder (do this in your mail client).
3. Create a script /var/scripts/dailyMailJobs as follows:


#!/bin/bash

MAILNAMES_PATH="/var/qmail/mailnames"
SPAM_LIFETIME_DAYS=2
TRASH_LIFETIME_DAYS=4

# learnAndFlush args are the following directories: MAIL SPAM SPAM.LEARN TRASH
function learnAndFlush {
echo -e "\n\nLearning new Bayesian data from spam for $1 on" `date`
sa-learn --dbpath ${MAILNAMES_PATH}/$1/.spamassassin --spam ${MAILNAMES_PATH}/$1/Maildir/$3/cur/
# Flush Spam.Learn
flush $1 $3
# Flush Spam
flush $1 $2 ${SPAM_LIFETIME_DAYS}
# Flush Trash
flush $1 $4 ${TRASH_LIFETIME_DAYS}
echo -e "\nLearning new Bayesian data from the last 24hrs of non-spam for $1"
find ${MAILNAMES_PATH}/$1/Maildir -mtime -1 -type d -name cur -not -path "*$2*" -not -path "*$4*" -not -path "*/Maildir/cur" -print -exec sa-learn --dbpath ${MAILNAMES_PATH}/$1/.spamassassin --ham {} \;
}

function flush {
echo -e "\nCleaning $2 from ${MAILNAMES_PATH}/$1"
mtimeArg=""
if [ "$3" ]
then
echo "Only deleting mail older than $3 days"
mtimeArg="-mtime +$3"
fi
find ${MAILNAMES_PATH}/$1/Maildir/$2/cur $mtimeArg -type f -exec rm {} \;
}

su popuser
# Substitute your mail directory here:
learnAndFlush chrisbeach.co.uk/chris .Spam .Spam.Learn .Trash

4. Place this in your crontab so it runs every day (e.g. at 00:15):


15 0 * * * /var/scripts/dailyMailJobs >> /var/cronjobs/logs/dailyMailJobs.log

This script will teach Spam Assassin that the mails in the Spam/Learn folder are spam, and the mails elsewhere are non-spam. It will also perform some housekeeping, deleting the Spam/Learn mails that have been learnt, and deleting old mails from Trash (5 days or older) and Spam (3 days or older).

written by Chris Beach
01/02/07 8:12pm
(6 years, 4 months ago)
comment one comment

photoadd photo

server-side mail filtering using qmail/procmail/safecat under plesk

After enabling Spam Assassin on my Plesk-managed domain I had been relying on email clients to move spam-tagged emails into a "Spam" folder. This was impractical as it only worked when a client was open, and rules had to be set up on each client.

After a lot of digging on Google I worked out a server-side solution. The key app here is procmail, which runs rules on incoming mails and can file them into folders. Procmail should already be present on your Plesk installation. Another app called safecat is required to place filtered mail into a maildir within the file system. The following steps apply to my mailbox "chris" on domain "chrisbeach.co.uk" You will obviously need to substitute your own mailbox and domain.

1. Create a folder called "Spam" in your mailbox.

2. Install safecat (see http://jeenyus.net/~budney/linux/software/safecat.html)


cd /tmp/
wget http://jeenyus.net/~budney/linux/software/safecat/safecat-1.13.tar.gz
tar xvzf safecat-1.13.tar.gz
cd safecat-1.13
make
make setup check

3. Create /var/qmail/mailnames/chrisbeach.co.uk/chris/.procmailrc


MAILDIR=/var/qmail/mailnames/chrisbeach.co.uk/chris/Maildir
SPAMDIR=${MAILDIR}/.Spam
DEFAULT=${MAILDIR}/
LOGFILE=${MAILDIR}/procmail.log
LOG="--- Logging ${LOGFILE} for ${LOGNAME} "

# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to the designated spam folder
:0
* ^X-Spam-Status: Yes.*
| /usr/local/bin/safecat "${MAILDIR}/tmp" "${SPAMDIR}/new"

4. Edit /var/qmail/mailnames/chrisbeach.co.uk/chris/.qmail so that it contains only the following two lines:


| /usr/local/psa/bin/psa-spamc accept
|preline /usr/bin/procmail -m -o .procmailrc

Let me know how you get on, and also if you know of any enhancements I could make to these instructions

written by Chris Beach
01/02/07 2:46pm
(6 years, 4 months ago)
comment 9 comments

photoadd photo

avoid 1&1 internet

I've just moved web hosts - which, for 20 domains and 13 websites, is a complicated and expensive process. Let me explain what made me want to move...

I'd been with my old host, 1&1 Internet for over three years and had become more and more frustrated with them. They couldn't solve, or even explain, regular outages in service and serious problems with their managed server configuration. It all came to a head in June, after two months of wasted time chasing their support team. I wanted to speak to a manager but was denied by their outsourced phone crew. I was told I should complain to complaints@1&1.co.uk, so I wrote the following email on 21/06/06. It was only acknowledged (see below) after I emailed again on 27/08/06, two months later.

Good afternoon,

I'd like to raise a complaint about 1&1 support, who have made no positive progress correcting issues with the configuration of a managed server for the last two months. I have sent thirteen emails this month alone, supplying information about the issues and helping where possible.. and chasing where necessary. On occasion, my requests have been unanswered by 1&1 for a week or more.

My "professional" package hosts thirteen websites, two of which are commercially important to me. One of them (brittenhouse.com) is the front-end for an information and messaging system running live on LCD screens throughout a block of flats in Chelsea. Outages on this site (now a regular occurrence) are extremely visible and problematic. Another of my sites is a nightlife community website which I am currently expanding to include a payment system. However, outages are affecting the functionality, and, most importantly, the credibility of this system.

I have been a customer of 1&1 for the last three years, and begun suffering serious problems this year. The database has been regularly refusing connections from the application server; the database server has been repeatedly and inexplicably shutting down (sometimes at peak traffic time, and sometimes in the early hours of the morning, under negligible load); simple queries on small tables (in the order of hundreds of rows) were taking more than a second to execute, slowing page loads to a crawl.

These issues were visibly disrupting my sites so I contacted 1&1, who unfortunately made no progress with the case until the end of May when they took "steps to speed up the queries and lessen the load on the server."

This had no positive effect whatsoever, so I emailed again, and received a reply on Friday 2nd June to say my database would be moved. Such a move would require configuration changes on my side in order to keep the sites operational. I emailed back to say that I would be free to make the configuration change that day but did not receive a reply by the end of the day. Therefore I called up oneandone phone support in the evening, who hadn't a clue about what was going on, but said they would attach a note on my account and that the move would occur over the weekend. I stayed in that weekend, in readiness to make the configuration change. I heard nothing back, and the database was not moved. I emailed again on Monday, and there was no reply until Tuesday afternoon, when I was finally told the new configuration details.

Had the move fixed the issues? No. Not even slightly (the shutdowns, connection issues and appalling query performance remained). Worst of all, a new intermittent problem had been introduced. The sites now frequently suffered errors: "Host '212.227.127.135' is not allowed to connect to this MySQL server." Clearly, there was a MySQL, IP or DNS configuration issue on 1&1's side. In all this time no one has explained why the database servers are being shut down.

After repeated email exchanges which have continued since the database move, 1&1 technicians have made absolutely no progress solving ANY of these issues (I have also had to explain to the latest support technician that he is looking at the wrong database, and I've still not heard back from him after a week). Instead of explaining the technical issues or resolving them, 1&1 support have recommended that I upgrade to a dedicated server to host my sites.

The reason given is that my sites have "outgrown" my current package. I'm not convinced. My database is just a few megabytes in size, and there is no reason why queries should be taking up to a second to run. More tellingly, errors such as the one described above is clearly caused by configuration and NOT by load.

Despite my doubts about 1&1's technical support, I am tempted to move to a dedicated server because it will give me more control over my configuration and hopefully the move to a fresh server will negate the issues, or allow me to solve them myself. The leap in cost is from £18.79/month to £69/month, which is a lot of money for me to have to pay, but my domain/subdomain/email configuration is comprehensive and it would be time-consuming to transfer them to another hosting company. I have already wasted enough of my time trying to help 1&1 resolve these issues and now I'm fed up and I want results.

I'm emailing to express my despair at the FUTILITY in contacting 1&1 about the configuration of their managed servers. I hope that you will take my concerns on board and that the situation will improve in the future. I would like this email to be acknowledged, at the very least.

Sincerely,

Chris Beach

My experience with 1&1 has been incredibly frustrating, and I can see from a brief Google search that I'm not the only unsatisfied customer (see [1], [2], [3], [4], [5], [6], [7], [8], [9], [10]).

During my two-month wait for a reply from 1&1, I decided to move over to a new hosting company. I chose Interhost's Linux VPS (virtual private server) 50 package, which offered a very comprehensive set of features and root access to a Linux host. I called the support number before I signed up, and got straight through to a knowledgeable guy who was clearly in direct contact with the system. No more clueless outsourcers, thank god. My subsequent email queries to Interhost were answered within a few hours. It was great to finally have a robust application server and database. Note (updated 04/01/2008) that Interhost has sadly declined somewhat.

Updated 01/08/2006: this just in from 1&1:

Thank you for contacting us. First let me offer my apologies for you not receiving a response to your complaint, unfortunately this was a result of a break down in communication on our part. The service you received was below any acceptable level and the time taken for a resolution for your database issues was well over our desired time frame. Unfortunately the cause of the issue was hard to locate due to its intermittent nature and the time needed to find a solution exceeded our usual resolution time

We apologise for any inconvenience that this may have caused you and that as a result of this issue you moved you're hosting to a new provider. You first reported an the issue you were experiencing on 20th Feb 2006, so as a gesture of goodwill we will be refunding your card with all fees paid after the first time you reported this issue (20th Feb 2006). This means you will receive the following refund...

Invoice no.       Refund
------------- ---------
71422019 £91.36
71592669 £75.14
71697903 £52.23
71749795 £70.46
-----------------------------
Total = £289.19
-----------------------------

Updated 04/08/2006: 1&1 has just DEBITED my account £70.46. Unbelievable! This is over a month after I cancelled my contract with them. Needless to say I called up to tell them what I thought about this in no uncertain terms. They claim that their system "always does this" and there is "nothing they can do about it" except subsequently refund the money. They claim a refund had been made that day but this has not yet appeared on my bank statement. I'll wait and see. No sign of the compensation yet.

Updated 08/08/2006: After phoning them twice, and sending my bank statement to them, 1&1 has refunded £69.71. It's just short of the £70.46 they took, but I'm too weary to bother chasing small fry when I'm still owed almost £300 in compensation from them

Updated 10/08/2006 In an email from their billing department, 1&1 reveals that the compensation offer partly comprised a refund for the [illegal] invoice of £70.26, so now I am only due to receive £219.48. I respond with the following:

Daniel

Thanks for getting back to me.

I was unaware that the compensation partly comprised a refund for an invoice that was to be illegally debited from me after the compensation offer itself! The invoice in question, 71749795 was debited after my cancellation, and after the £289 compensation was offered. Since the actual invoice document never reached me by email I was unaware that this actually formed part of the amount offered in compensation.

Losing an anticipated £70.46 is regrettable but to be honest I will be happy for this long, drawn-out saga to be over when I finally receive the remaining compensation.

Back in July when I cancelled my contract, I phoned to confirm I wouldn't be charged any further amounts by 1&1. Whilst I was told that I wouldn't be charged, in August my account was debited. This is disconcerting.

This time, can you please put it to me in writing that 1&1 will never debit my account again.

Thanks in advance

Chris Beach

Updated 15/08/2006 The reduced amount of compensation (£219.48) finally hits my account. All in all, the experience with 1&1 has been fraught with broken promises and wasted effort. When you're choosing your host, think very carefully before choosing 1&1.

written by Chris Beach
27/07/06 10:16am
(6 years, 11 months ago)
comment 54 comments

photoadd photo

essex ann summers - a redesign

I've been working on essexannsummers.co.uk with my buddy, Katie. The idea is that we pass on her promoter's discount on Ann Summers goods and make a little profit along the way. Last night I put up a redesign of the site, which I'm pleased with.

I've followed a few trends in website design: glassy gradients, rounded corners and big spikey circles.

What do you reckon? I'd like your feedback, good or bad.

written by Chris Beach
05/05/06 2:18pm
(7 years, 1 month ago)
comment 3 comments

photos (total: 2) RSS Feed

photoadd photo

a money-making idea for essexclubbing.co.uk

I've had banner ads on essexclubbing.co.uk for a couple of years, and the profits have funded the hosting costs for the thirteen websites that I'm currently running.

Now it's time to make money from the core business of the site - promoting clubs and events.

One or two of the regular promoters have been interested in a mailshot feature, and it's starting to look feasible as the site approaches 1000 signed-up members. I don't want to annoy anyone though - mailshots won't be sent more than once a day, and noone will receive a mail unless they have "opted in".

So, the plan is as follows: An auction will be held each day for promoters. The highest bidder will win the following: His/her event details will be sent out in a mailshot, at 6pm, and as an added bonus, the event will get a special spot on the front page of the site, entitled "Spotlight On." This will be shown until 6pm the following day, at which time the next auction will have finished, and the next event will be spotlit and mailshot.

Having an auction means that the promoters can decide how much they're willing to pay, rather than me setting a price which might be too high or too low.

I'm going to work to implement this over the next couple of weeks.

written by Chris Beach
05/05/06 3:03pm
(7 years, 1 month ago)
comment add comment

photoadd photo

apple releases official support for windows on intel macs

Apple have just announced a new software tool that will allow Intel-based Macs to boot Windows XP. It's called Bootcamp and is available on public beta.

Running XP on an Intel Mac was previously possible, but extremely difficult. For starters, Windows is designed to be booted from BIOS and Intel Macs use the modern equivalent, EFI, which is a completely different standard. Secondly, some of the Mac hardware (AirPort, Mac keyboard etc.) requires obscure custom drivers to function in Windows.

Bootcamp helps by packaging up the drivers onto a CD, and allowing Windows to run seamlessly through EFI.

There are a couple of amusing anti-Windows gibes on Apple's Bootcamp page:

Windows running on a Mac is like Windows running on a PC. That means it’ll be subject to the same attacks that plague the Windows world.
Sadly, Windows XP, and even the upcoming Vista, are stuck in the 1980s with old-fashioned BIOS. But with Boot Camp, the Mac can operate smoothly in both centuries.

written by Chris Beach
05/04/06 5:14pm
(7 years, 2 months ago)
comment add comment

photoadd photo

google sandbox effect

It appears that Travel Insurance Now is still languishing in Google's "sandbox", around nine months after the domain was registered. When I first created the site, reciprocal links were created to it from several other UK insurance sites. I even devised a "link agent" program which employed other people to apply for reciprocal links on relevant websites. However, despite accumulating a page rank of 4, Travel Insurance Now is still not listed in Google for any of the key search phrases.

Unfortunately Google's "sandbox effect" means this site is crippled, compared to its competition in the insurance market. The other search engines provide just a fraction of the traffic that Google does.

Does anyone have any ideas how I might break the site free of the sandbox?

written by Chris Beach
31/03/06 6:54pm
(7 years, 2 months ago)
comment add comment

photoadd photo

some decent info on windows vista

There's a lot of hype flying around about Vista, and plenty of inaccurate claims and faked screenshots. I've found a couple of sites with some definitive info. Check out:

written by Chris Beach
17/03/06 1:21pm
(7 years, 3 months ago)
comment one comment

photoadd photo

more journal entries