Monday, 23 June 2008

Pixel Lapse

I recently came across this small application called pixel-lapse. The basic principle sounds interesting: record a webcam image one pixel at a time. From the photo gallery on the web site, it looks like you get the most interesting results when part of the image is static and part of it moves. So I decided to give it a go and here's the first shot:

Pixel Lapse image

Working at the computer

Interesting result indeed! Shame about the watermark though. I'd happily pay a few quid for a version without the watermark but it doesn't seem to be an option on the web site.

Thursday, 19 June 2008

Web Sharing and PHP on Mac OS-X Leopard

Mac OS-X comes with a version the Apache web server that is configured to allow users of the system to publish their own web pages directly from the Sites directory in their home folder. This is of limited use for the average user but is just great for web developers who can test their work directly, using a real web server. However, there is a glitch: if you upgrade from OS-X Tiger (10.4) to Leopard (10.5), existing users will suddenly get an HTTP error 403 Forbidden when navigating to their web pages. This is because in Leopard, Apache's security is tightened by default.

Apple provide an article that describes how to re-enable access for those users. However, their version will still deny access to sub-directories. So I slightly adapted the shortname.conf file to make it more flexible. Here is my version:

<Directory "/Users/shortname/Sites/*">
Options Indexes MultiViews
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>

The star (*) at the end of the directory name on the first line ensures that the rule applies not only to the ~/Sites directory but also all sub-directories. The FileInfo value for the AllowOverride option on the third line tells Apache to allow settings override in a .htaccess file in that directory or any sub-directory thus allowing much finer grained control.

After getting this to work, it appears that, although PHP5 is installed, it is not enabled in Leopard's Apache installation. Enabling it is very easy and very well explained at Foundation PHP.

There you go: a full blown web server with PHP support is just what you need to locally test drive you beautiful web creations and you don't even have to install any extra software.

Friday, 13 June 2008

Montignac, 12 days on

At the beginning of last week, I decided to follow the Montignac method to try and lose my beer belly. I lost just over 1kg in the first week but realised that, as I was buying my lunch from shops surrounding the office, I had no way to know the exact list of ingredients that went into my food and therefore no way to check that I was really following the method. So I decided to sort out my own pack lunch to make sure I knew exactly what I was eating. This meant doing more comprehensive and careful food shopping at the weekend, which was a bit of a pain but hopefully it would be worth it. As a result, I lost another 200grams on the first day but regained them over the next few days. I finish the week today the same weight as I started it: 87.3kg. That's not very promising and quite frustrating. I'll keep trying for a few more weeks just in case my body needs a bit more time to adapt. After that, if it stays the same, I'll just go buy an ice cream and dump my Montignac books in the (recycling) bin.

Monday, 2 June 2008

Getting Rid of the Beer Belly

Since I moved to the UK, I've been steadily acquiring a beer belly. Even without my mum telling me so (which she does every time she sees me), I've wanted to lose it for some time. Now the problem is that I've never been keen on weight loss diets because most of them are just unsustainable in the long term as they require you to give up entire food groups. But lo and behold, I was recently introduced to the Montignac method and I like his approach. I mean, someone who includes unpasteurised cheese, foie gras, dark chocolate and wine in a weight control diet (note: weight control, not crash weight loss) has to be a genius!

The whole concept behind this diet is the Glycemic Index of food ingredients. So, yes it is related to the Atkins and GI diets but is done is a way that seems more sensible to me. And, as Michel Montignac is French, he bases everything on eating good food and enjoying it which makes it that much easier to follow. Having said that, I will probably not be all plain sailing: I'm not sure how difficult it will be to cut down on stuff like beer, potatoes and bread. On the other hand, it will get me to cook more and experiment with food, which can only be a good thing.

To follow progress, I'll try to weigh myself every day. The starting position today was 88.4kg, for a BMI of 27.6, which is squarely in the 25–30 Overweight bracket.

Stay tuned to see if I can get myself into shape!

Obviously, this post is completely unrelated to the previous one.

In The Beginning

I received this story by email from a friend and it made me laugh out loud so I thought I had to share it. Enjoy!

In the beginning God covered the earth with broccoli, cauliflower and spinach, with green, yellow and red vegetables of all kinds so Man and Woman would live long and healthy lives.

Then using God's bountiful gifts, Satan created Dairy Ice Cream and Magnums. And Satan said: You want hot fudge with that? And Man said: Yes! And Woman said: I'll have one too with chocolate chips. And lo they gained 10 pounds.

And God created the healthy yoghurt that woman might keep the figure that man found so fair.

And Satan brought forth white flour from the wheat and sugar from the cane and combined them. And Woman went from size 12 to size 14.

So God said: Try my fresh green salad. And Satan presented Blue Cheese dressing and garlic croutons on the side. And Man and Woman unfastened their belts following the repast.

God then said I have sent you healthy vegetables and olive oil in which to cook them.

And Satan brought forth deep fried coconut king prawns, butter-dipped lobster chunks and chicken fried steak, so big it needed its own platter, and Man's cholesterol went through the roof.

Then God brought forth the potato: naturally low in fat and brimming with potassium and good nutrition.

Then Satan peeled off the healthy skin and sliced the starchy centre into chips and deep-fried them in animal fats adding copious quantities of salt. And Man put on more pounds.

God then brought forth running shoes so that his Children might lose those extra pounds.

And Satan came forth with a cable TV with remote control so Man would not have to toil changing the channels. And Man and Woman laughed and cried before the flickering light and started wearing stretch jogging suits.

Then God gave lean beef so that Man might consume fewer calories and still satisfy his appetite.

And Satan created McDonald's and the 99p double cheeseburger. Then Satan said You want fries with that? and Man replied: Yes, and super size 'em. And Satan said: It is good. And Man and Woman went into cardiac arrest.

God sighed... and created quadruple by-pass surgery.

And then... Satan chuckled and created the NHS.

For those who don't live in the UK, the NHS is the National Health Service and the subject of many a joke and disaster stories.

Wednesday, 12 March 2008

Making your Business Profitable: Rule #1

Okay, so I'm not a business guru, I'm a geek. But setting up my own limited company to operate as a contractor has taught me a few tricks about business and how to make it profitable. So, going back to basics, how do you make a business profitable? You ensure that there is more money coming in than going out. The money going out part is easy: it's all the bills you have to pay and it's a bit like your personal finances: you've got to make sure you don't overspend. The tricky part is the money coming in because it's different from what you're used to as an employee: the amount that comes in can vary widely and you never know when it will come in. So that's the area to concentrate on. As a result, here is in my (not very experienced) opinion the most important rule of running a business:

Make it as easy as possible for the money to come in.

At that point, you may be thinking about marketing, sales and all that sort of things. But before that, think about the plain boring basics. There are two things you need to get right from the start:

  • Tell your customers how much they owe you,
  • Make it easy for your customers to pay you.

Well, yes, the vast majority of your customers will gladly pay you if you tell them how much they owe you and make it easy for them to pay. So how does that work in real life?

Tell your customers how much they owe you

If your business is retail, this should be easy: just tell the customer when they buy something. In other businesses, like services, this is usually done by invoicing your customer. An invoice can be quite complex, especially when you start taking VAT into account. Some companies spend millions of pounds on invoicing systems. The reason is that the quicker you can invoice a customer, the quicker they will pay you. So spend a bit of time getting it right so that it's easy to do. In my case, I made sure I had a number of document templates for this and that they did most of the work for me. Nowadays, I can just open one of those templates, fill in the number of days worked, the rate per day and it does the rest for me: calculate the VAT and all total amounts. The result is that is takes me about 5 minutes to produce an invoice. Granted, my business model is very simple but it still applies whatever your model is.

Make it easy for your customers to pay you

Think about how your customers may want to pay you and make it easy for them to do so. Rather than theorise on what you could do, I'll give you a simple example.

Tonight, a colleague and I went out for dinner at a Chinese restaurant round the corner. We had a very good meal and were served by nice and helpful staff. We couldn't ask for more. Then came the time to pay the bill. The total amount for the two of us was £28.25 so we added a tip to take the total to £32. Because we have to file in our expenses differently, we wanted to pay half each and get two receipts for £16. I wanted to pay by credit card while my colleague wanted to pay cash. At that point, it all went downhill. For whatever reason, what we wanted to do was impossible. After a good 10 minutes talking to the head waiter, he managed to split the bill provided we both paid cash. From the explanation we got, I understood that the main problem in paying the way we wanted was the till system that just couldn't deal with it and didn't have a manual override.

The end result of that experience is that the problems in paying completely ruined the good experience we had had of the place, meaning that we will probably not go back there, even if everything else was great.

Invoicing your customers efficiently and making it easy for them to pay you may sound like boring mundane details but if you don't get them right, it doesn't matter how good the rest of your business is, money won't be coming in.

Wednesday, 5 March 2008

Leap Years and Microsoft

Following Leap Day last Friday and the confusion this seemed to generate, it looks like the problem is even worse that originally thought, especially where Microsoft products are concerned. And reading the comments on that Register article, it looks like they are not the only ones.

Via The Register.

Sunday, 2 March 2008

Asus Eee PC, Nokia E65 and WPA Wireless Networks

My home wireless network uses WPA for security. When I received my Asus Eee PC, it could not connect to my wireless network complaining about the shared key being too long, which I found odd because all other devices connected fine. Then when I got my Nokia E65, it couldn't connect either but wouldn't tell me why.

Then, over the weekend and prompted by a friend, I decided to fiddle with the Eee PC and get it to connect to the wireless network. So, in an attempt to humour the machine, I changed the pass phrase on my network to something shorter. An lo and behold, the Eee connected! It could then ping all the machines on the network except the router it was actually connected to. As a result, it couldn't route any traffic outside the network so couldn't get on the internet. Checking the routing tables, everything looked fine. It could resolve any name into an IP address so it had nothing to do with the DNS. I thought there could be something dodgy with DHCP so I re-configured the interface manually... and it worked! Going backwards, I set it back to DHCP and... it worked fine, even though I didn't change anything compared to the first attempt. That's IT for you: sometimes, doing the same thing twice fails the first time and works the second, for no apparent reason.

Now all chuffed by my success with the Eee, I decided to try again with the Nokia E65. I first spent a good 20 minutes trying to find how to set up access points and being defeated by the completely non-intuitive menu system of the S60 operating system that runs on those phones. I then turned to the user manual (yes, I know, RTFM) which only marginally helped because said manual is riddled with mistakes and the relevant menu option mentioned did not exist. So I spent another 10 minutes finding out where the manual was wrong. I eventually found what I wanted and set up my access point. Of course, in keeping with the experience with the Eee, it failed to connect first time. The main difference was that the E65 just closed the browser without explanation rather than tell me what went wrong. But trying a second time it worked fine.

So there you go: shortening the WPA secret key means that all my wireless enabled devices can now connect to my home network (apart from the Nintendo DS but that's because it doesn't support WPA at all). Some might say that a shorter key means my network is less secure. Yes and no: considering the network doesn't advertise its SSID in the first place, that's two pieces of information you need to guess. And then, because I knew I was shortening the pass phrase, I took more time to think of something that would be more difficult to guess.

PS: Nokia, could you please ditch the poor excuse for an operating system called S60 and give use something intuitive and user friendly instead? Now that you've acquired Trolltech, could we have nice Qtopia based phones please?

Tear It Down

It's illegal and it doesn't make sense: tear it down!

Friday, 29 February 2008

Leap Year Maths

Today is Leap Day, the 29th of February. Reading this article on The Register earlier and in particular the comments, it looks like the logic behind calculating whether a year is a Leap Year is still fuzzy for some. This is an essential calculation to get right in any software that deals with dates (that is, most of them), so here are all the gory details.