Monday, 15 June 2009

Getting rained on

This morning on HFM they said the weather was going to be very rainy, stormy and maybe even hailing in the afternoon, but not in Harborough. I wasn't sure whether the present was joking about the 'not in Harborough' bit, but as it was nice weather I thought I might as well go out just in case the weather was bad in the afternoon.

I walked up the old railway line again, by the time I had gone out it had clouded over, but was still reasonably bright. I didn't see any small butterflies, just larger ones, which kept flying away whenever I got near them. I also saw some scorpion flies. I didn't know they weren't dangerous until after I came home and looked them up on the pinternet, so I was very scared of them. Also a mosquito or something bit me while I was trying to take a photo of a male scorpion fly, then when I looked up it had disappeared.

I did see one person on my walk today.

On the way back home it started raining, and although I walked pretty quickly, myself and my camera did get quite wet (I didn't take my camera bag since there wasn't much point bringing it).

When I got back home I dried myself and the camera off, then did some more website work. I found that Nginx was loading files with the incorrect mime types. Doing some googling, I found this was because I didn't have include mime.types; in my Nginx server config. After adding this and restarting the server, it still didn't work though. After trying a few different things I finally found that Firefox was loading the page from cache (despite neither Nginx nor apache sending any cache/expires headers). So clearing Firefox's cache I could see Nginx was working correctly.

After getting that working, I tried to get Nginx to start when the machine was booted and try to start every 20mins in case it crashed and needed to be restarted. This took me quite a while, I did some googling on cron jobs, and got the cron job running, but nginx wasn't actually being started. When I ran the command from the user account that nginx was installed on, it worked okay. But when run from the cron job or a different user account, nothing happened.

Previously I was executing an nginx init script that I'd got from a website that had a tutorial on setting up nginx, and I'd modified the script slightly. So I tried using the init script for Ubuntu on the nginx wiki, obviously I had to modify that as well, but this would now work when called from a cron job.

I'm not sure why one script worked when the other didn't (even though it did actually work, just not from cron jobs or other user's accounts).

Lots of info I'd read on Nginx said it was faster running PHP with Nginx than with apache, though they didn't seem to have any actual tests, just anecdotal evidence. Further, most people were comparing apache with mod_php vs. Nginx with PHP FastCGI. My current PHP implementation at WebFaction is apache with mod_fcgid and PHP FastCGI. Though googling for that, I found a post (with test results) saying that PHP through mod_fcgid is slightly slower (though less resource intensive) than mod_php.

After dinner I watched an episode of Star Trek TOS with Moccle and L, then watched a Springwatch Special with L, Rad and Clare.

I was wondering about SEO/human friendly URLs, and whether it is okay to include the key of the page in the URL so you can look up the page contents easily from the database, or whether you shouldn't include the key of the page, and so would have to look it up in the database by doing a text search, e.g.
http://photosite.com/Animals/Birds/Thrushes/Blackbirds/20 (20 would be the id of the Blackbirds record in the database) vs.
http://photosite.com/Animals/Birds/Thrushes/Blackbirds (To get the page content you'd have to look up the record for Blackbirds in the database that had a parent of Thrushes that had a parent of Birds that had a parent of Animals - quite a bit of work for the database to do)

I was going to post on the websqueeze about this, but first did a quick check to see if it had already been covered, and it had: How To Build Up Your Search Engine Friendly Url's. So the advice seems to be that there's not much point removing the database record key from the url, as most people don't care too much about how a URL looks or whether it's easy to remember. If they want to remember it, they'll just add it to their favourites. So I'll stick with keeping the numbers in the URL.

The weather was sunny first thing, then overcast, then rainy, then sunny most of the afternoon, then overcast again around tea time and rained a bit more, then stayed reasonably cloudy, but it looked like there was a good sunset.

Food
Breakfast: Strawberry jam toast sandwich; cup o' tea.
Lunch: Mature cheddar cheese with iceberg lettuce sandwich; bag of barbecue flavour crisps; peach; Rocky; cup o' tea; small chocolate santa.
Dinner: slice of quiche (meant to be ham quiche but didn't have any ham in it); chips; salad. Pudding was 2x apple pies warmed in the oven with custard and cream. Coffee; Oreo; small chocolate santa.
Supper: ⅓ Malted milk; ½ nice; choc chip cookie; hot chocolate.

No comments: