Dougga Photos

| | Comments (0) | TrackBacks (0)

I recently travelled to Tunisia for a holiday. Visiting the ancient ruined Roman city of Dougga was a highlight. It is quite hard to reach as an independent traveller. First you have to find the Tunis Northern Bus Station (out of the tourist areas), go on a 2-hour bus journey to Teboursouk (the closest town), from there you arrange a return taxi trip to the ruins. Once there though, it is quite impressive. We had the place almost to ourselves for a couple of hours - perhaps we should have arranged for a longer stay with the taxi driver, but we had to catch the last bus back to Tunis! Some of the best photos I took are here on Flickr. In future I will put more photos up under that Flickr account.

Ruby on Rails Hosting

| | Comments (0) | TrackBacks (0)

Now that I have a couple of sites up and running on the web, I thought I'd talk about how I chose my hosting providers and how it's going. For those who just want the short version: I use Slicehost and am very happy with them. Read on for more details.

When looking at potential hosts for my Rails web apps I took into consideration price, speed/memory, reliability and flexibility. I basically wanted something cheap, reliable and fast. I've been an amateur sysadmin before (and at my first dotcom job was technically a pro sysadmin), so I wasn't scared of getting into the unix command line. Thus support wasn't important. Similarly for a small project, bandwidth, email accounts and credit-card billing systems would not be used. I wanted more than a hobbyist's hosting site (even if that is exactly what I am), but not costly, professional hosting.

My first thoughts were my domain name register, GoDaddy, or the host of this blog, pair. I know a number of people have issues with GoDaddy, but I've always found them fine for buying domain names and I can just ignore their constant upselling. However, I wasn't sure about their Rails hosting and a search only found bad stories (eg. here, here and here). I've also been happy with the service Pair have provided with this blog and associated static website. I didn't find much online about their Rails hosting and decided it would in any case be best to use different providers for this blog and my Rails apps.

Next I took a look at some webpages specifically listing Rails web hosts, such as on the Rails wiki. Among the massive listing there, special mention is made of Joyent and EngineYard on a couple of occasions. Certainly, these two companies seem to be held in very high esteem in the Rails community and host many well known Rails sites. However, they are both quite expensive - aiming for the high-end market. Too expensive for my goals or really anyone without funding. They are more aspirational - it would be nice to one day need the services of such a hosting firm.

I also found a couple of lists at rubyonrailswebhost and Zen and the Art of Programming. They rate Dreamhost and Site5 highly and both hosts matched my needs: dirt cheap (under $10/month) and with decent reliability according to reviews. Before signing up I sent Antonio Cangiano at Zen and the Art of Programming (a decent Rails blog I now subscribe to) an email asking if he had any updated advice since his blog on hosting was nearly 2 years old. Antonio suggested a new name, Slicehost. Slicehost use a virtualisation system so that it appears to the hosted application that it has a whole server to itself (albeit a fairly small server). This means that someone else's app can't hog resources slowing down your app. With memory intensive Rails apps this is very useful. They also have full command line access - you basically start with a clean build and can install/configure it how you like. While any "point and click" users would find it daunting, this really appealed to me. They provide a number of useful getting started articles, including some Rails ones, so I was sold. They are more expensive than other hosts at $20/month for a 256MB, but I have been very happy with their service over the last 6 months.

Quick Timezone Calculation

| | Comments (0) | TrackBacks (0)

I have been asked what time I get the forecasts for a location in my historical weather forecast system. The obvious problem being that if I read all the forecasts at nearly the same time, different cities could be in different days due to differing timezones.

The answer is, I read the forecasts at roughly midday in each of the locations. That is, every hour I read the forecasts for the locations where it is roughly midday. This is done by approximating the various timezones using the location's longitude. This isn't exact - it doesn't account for daylight savings or places like China, which is all one timezone despite being wide enough to be split into many. Generally it is accurate to within a couple of hours - fine for the purpose. The code is below.

time_band = -Time.now.gmtime.hour + 12
locs = Location.find_by_sql ["select * from locations where longitude >= ? and longitude < ?", (time_band-1)*15, time_band*15]

Past weather forecasts

| | Comments (0) | TrackBacks (0)

I often have ideas for little projects, most never go anywhere, but some act as distractions and bother me until I complete them. Recently, I wanted to know what the weather was in London a few days in the past. Easy, I thought, I just find it online. I couldn't. There are many sites with the current weather or forecasts. However, I could not find any with historical weather. So I quickly created one based on my knowledge of BBC Backstage.

I have put the system up here. It is still at an early state, it may change or be shutdown. At the moment it displays only last month's historical weather forecasts.

I am doing some work with the Rails text_field_with_auto_complete method to provide a dropdown list of completed options as a user types, like Google Suggest. However, I needed the item displayed in the dropdown to be different to the item displayed when it is selected. I couldn't find any help online. So at first I thought I would need to override the AJAX code, but when I looked I saw text_field_with_auto_complete already had this feature built in.

How to make £1/hour playing online poker

| | Comments (0) | TrackBacks (0)

I have just completed my 50th online poker game. I lost. My top pair turned into a straight on the river and so I went all-in against a player who check-called. Turned out he made a full house on the flop! Now seems like a suitable milestone to think again about my play.

After the home games I thought I'd try online poker for real money (opposed to the online "play" money with which I learnt the game). So I put US$50 on Pokerstars. Pokerstars also invited me to a beginner's tournament, which seemed to be a ploy to get some more money into newbies' hands - I won US$32. Thus I started with US$82 and that is my baseline. I decided to focus on one type of game and chose micro stakes heads-up Hold'em sit'n'go tournaments. That is, there are two players, each puts in US$2.20 for a set number of chips and play until one person has all the chips. The winner gets US$4 and the site US$0.40 in fees - the loser gets nothing. There are always a couple of these games going so you can play whenever you want. It would take a long time to go broke and with a single opponent I could learn the basics in the simplest environment possible.

At first I started winning. I think I won my first 3 games straight. I started dreaming of becoming a poker pro. Then I starting losing, dropping to around the US$60 mark after nearly 20 games. I started paying more attention to the game and writing down results - 5/10, then 7/10, then 8/10, lastly a loss to reach the 50 game mark. In total I have won 25, lost 25. Thus, due to fees I have US$72 - US$10 down on where I started. I think in the right circumstances I can beat this level of the game. In the final eleven games I played noticeably worse than my opponent three times (I lost one and won two - lucky). Winning 7 out of 10 seems a reasonable goal. Which at about 2.5 hours per 10 games equates to roughly £1/hour (hence the title).

There is however one small problem. I have a tendency to tilt. Tilt is a great concept in poker, it is when for whatever reason you are not playing rationally and letting your emotions influence your decisions. This can be getting bored; overbetting back at someone who is annoying; or a vast range of other suboptimal play. I certainly think that my poker maths skills have a great deal of room for improvement, but that doesn't seem to matter too much at my level. My opponents have a lot to learn too. What seems to separate us, in my limited experience, is temperament. Over the last 30 games or so I focussed mainly on ensuring I was in an appropriate frame of mind before starting (patient, relaxed, time to play and a desire to win) and stopping if I felt this slipping. That lead to the improvement.

So what now? I have started reading a book on poker theory, so hopefully my game will slowly improve. Other than that I aim to control my tendency to tilt. I'll play another 50 games (which will take a couple of months) and aim to win 70%, which would mean I break US$100. If I can manage this and I think I'm playing well, I'll consider going up a level or trying a different game.

Using BBC Backstage Weather

| | Comments (0) | TrackBacks (0)

Recently for a little project I wanted to get weather reports, and being in London my first thought was to use BBC weather. Doing a little searching, the BBC provides a number of RSS feeds for its data (news, weather, etc), as part of the Backstage project. Details of the weather feeds are here. This post gives some of the tips and tricks I discovered using these feeds.

FOWA London 2008

| | Comments (0) | TrackBacks (0)

Last Friday I went to the Future of Web Apps (FOWA) London 2008 conference. As I only had the single day off work I decided to get the expo only entrance (£5) rather than a two-day full pass for nearly £400. Thus I didn't get to see any of the proper talks, instead I just walked around the floor to see the booths and one "FOWA university" talk.

The talk was by Yuuguu on how to run a company when all employees telecommute. Apparently, the FOWA conference is the first time all the Yuuguu employees have met at the same time. Most of the talk was fairly bland and many in the audience were head down on their laptops or iPhones. However, there were a few interesting points. Yuuguu people don't work if they meet in person, they consider the time too important to waste on work and they bond instead. Also, every Friday they get together online for virtual "beers".

There were a couple dozen companies with booths. A few big names like Microsoft, Sun and Myspace were there, but most were firms I had never heard mentioned before. This caused some awkward experiences, as their names normally give no hint as to their business areas. I would squint at their posters trying to work out what they did (which often didn't help much either). Meanwhile some marketing person would creep up on me, start talking and give me their Moo mini business card (these were literally everywhere). I left the conference knowing what every exhibiting business did, but only about half of them were marginally relevant to me.

The Microsoft booth was by far the best. Among the computers they had a couple of Xboxs and a Surface box - the Xboxs were empty while it was hard to see the Surface through the crowd. Rightly so, it was an impressive machine. All that made me want to code rather than talk and I left after an hour, skipping the Diggnation filming - I saw it last year. Anyway if want you can see the FOWA talks here.

Is there dumb money on Intrade?

| | Comments (0) | TrackBacks (0)

A friend recently mentioned that there is dumb money on Intrade, a site that creates markets in various real-life events such as the US Presidential elections. They said that there are still people betting that Hillary Clinton will become President in November. I'm a big fan of free money so I thought I'd check it out. Sure enough, according to Intrade, there is a 1.6% chance Hillary will be elected President, with thousands of dollars worth of contracts available. I'll grant the chance of Hillary being elected as non-zero, but it must be orders of magnitude less than 1.6%, so what's going on? It was a quiet day so I thought I'd work out if it was a scam or a bad deal.

Todo lists are hard

| | Comments (0) | TrackBacks (0)

This blog article argues that current online todo list and project management tools don't meet people's needs and are too complex. Judging by the comments of some people at the London Hackers Meetup, this is not an uncommon view. I agree too. This is why I'm trying to steer a user-friendly middle-path between Queuesarus' competitors - a group it seems Ativiti intends to join (yeah, bring it on!).

So how is it going? Well the Beta testing suggests that the functionality is nearly good enough, but that it is still not user-friendly. I'm not sure what to do. While I knew some parts of the system were difficult to understand, I had a plan for them. However, there are problems with areas I thought were fine. As the blog says, it is a hard problem and I haven't seen it done well. More thought is required, and advice is welcome.