Fast Chicken / Big Ted

Purveyers of fine iOS apps including mobileAgent and Trip Wallet

Working at Home - the Ups and Downs

I’ve been working at home for a little over a week now, and so far it’s been an interesting experience.

On the plus side, my coffee intake is down, a lot. I usually had 3-4 cups a day (of espresso), now I’m down to 2-3, depending if I remember to have one in the afternoon, rather than needing one. I’m getting about as much work done in 6-8 hours as I would in 2 days or so when I was at my previous employer, mostly because of lack of distractions, and in general, I’m eating less (and it’s better stuff – no more muffins!) and exercising more – even if “more” is a very relative term. That’ll change this weekend, because there is a Bikram Yoga studio opening up the road on the weekend. Yay for interesting exercise options.

I’m pretty sure my blood pressure is down, but I need a full day to check it – ie, take it every hour for a day. The headaches are long gone since my desk was setup correctly.

Using git is working out well. I pull code from a remote subversion repo, or work on my own stuff pushing to a local repo when I need to check in, and then pushing to my hosting provider when I want to do an offsite backup of the code. Not 100% ideal, but it’s working well. The head-shift and learning curve of git is quite steep, but so far, the pay back has been worth it. Git Extensions has helped a lot there.

On the downside, there is little or no interaction with other humans, which isn’t helped by Leonie being away in the Algarve this week. I can deal with that, mostly, and I have an option to work at Leonie’s work from time to time, which will make it easier. The other downside is I’m running out of podcasts – I had enough to cover about 2 hours a day (my previous commute), but not for 6-8 hours, so I have to hunt back through my music collection to find interesting stuff. Not a bad thing, really.

One thing, which I’m not going to let continue once Leonie is back, is getting up late. I used to get up about 7, and start work at about 10 (1-1:15 commute in there). Now I get up about 9 and start about 11, working until I get hungry about 7. Same amount of time, but the time-shift into the evening is not going to be practical when she’s back. Thats ok – it’s easier to get out of bed when both of us are getting up at the same time. The internet is also quicker in the morning – or rather, any time before 4pm, so thats another incentive to start earlier.

Does anyone else who works at home a lot (@kiwibastard? @irvtheswirv?) have any hints or tips? Or do both of you have family around, and hence it’s a case of blocking them out, not trying to let stuff in?

HOW IT IS

HOW IT IS, originally uploaded by Nic Wise.

Miroslaw Balka’s exhibition (if you can call it that) in the Tate in London. An excellent messing with the senses. Also reminds me of the set of the movie Cube.

Learning PostgreSQL - Being a N00b Once Again Feels Strange

It’s been a while since I’ve been a n00bie*. I’ve been coding for a long time now, but most of it has been in technologies that have evolved from what I knew before – Delphi to Java to c# and .NET, then to Roby, Python and PHP (ok, that was a step backwards, but it looks a lot like c# and Java). Paradox to Interbase to SQL Server. ASP to ASP.NET to anything with an MVC in it. It’s been a nice progression over 10 years (yes, scary, it’s been 10 years or more!).

Until now.

This week, and for the next few weeks/months, I’m porting a fairly major email archiving application over to PostgreSQL. It was going to be going to MySQL, but their licensing isn’t going to work – we can’t use GPL code, we have a product, and we can’t force people to pay 500€, they may as well buy MS SQL! On top of that, the products lacks a lot of the things we need, eg uuid columns and, ya know, stability. Core database tables which are not transaction-safe will never make it into production. The app is currently backed on MS SQL Server, which is performing fine in everything except price.

On the surface, pgsql (as it appears to be known) is very similar to MSSQL – tho it’s actually closer to Oracle. It has all the usual database things – tables, rows, types, keys, indexes, stored procedures/functions etc, and a whole host more that SQL Server doesn’t, like GIS datatypes.

It took me a weekend to write/adapt a tool to port the structure over from mssql to postgres. I have a few tweeks to make – eg identity columns in mssql are INT IDENTITY(1,1) NOT NULL, and in pgsql they are SERIAL (it’s own datatype), but all up, the structure was easy to move over.

The stored procedures, on the other hand, are something else. We don’t have a lot of them, maybe 25 or 30, but some of them are pretty complex.

The basic ones are easy:

create procedure foo(@storeid integer) AS BEGIN select messages.identifier, messages.storeid from messages where storeid = @storeid; END GO;

becomes

create or replace function foo(in_storeid integer) returns table (identifier integer, storeid integer) as $$ select messages.identifier, messages.storeid from messages where storeid = in_storeid; $$ language sql;

But SQL Server has one often-used trick that pgsql doesn’t. (note, at this point: if you know otherwise, please, PLEASE, email me!). And that is returning a resultset from a stored procedure.

Now, a few people will scream that you can. And yes, you can. You do it in SQL Server by doing this:

create procedure myproc as select * from table;

and the result comes back as all columns and rows from table. In pgsql, I need to do something like this:

create function myproc() returns table(a int, b varchar, c text) as $$ select a,b,c from table; $$ language sql;

I can also return a refcursor, which is a reference to a cursor, tho I’m yet to get that working in the sql tools. The main thing is, I have specify the output columns. This is all well and good for strong typing, or for a few unchanging columns, but I have cases where my resulting sql looks more like this:

select tablea.id, tableb.* from tablea, tableb etc;

So if the structure of tableb changes, and at present it has about 10 columns, I have to recode the function. Queue maintenance nightmare!

Now, I can say

returns setof ….

but that appears to only work in some cases, and I still need to specify the format of the output. Same with

returns table( fields….)

Frankly, it’s doing my head in. Maybe I just need to accept that this is the way of pgsql, and get on with it. But I keep looking for the “better” way to do it, and not finding it.

Which brings me back to the n00bie feeling. In effect, I’m learning pgsql – and pl/pgsql (their dialect of oracle’s pl/sql) – using the equivalent of SQL Server Books Online. But without the index. Or a SQL Guru to help.

Doing that with SQL Server would be suicide, or a recipe for extreme frustration. Postgres isn’t much different, and my brain is fried trying to do it. I’ve ordered a book, which should be here tomorrow, and I’m going to jump on their mailing lists shortly, but still – it’s not nice. I don’t know of many – if any – people who use this in anger, so sadly there isn’t anyone to ask “am I just going down a rat hole here?”.

So now I know how it feels for someone learning SQL Server from scratch – a platform which is SO familiar to me I don’t even think about it. All this DailyWTF quips, funny as they are, take on a new meaning for me at the moment.

  • for those who dont know what a n00bie is, it’s someone who is new to something – a mashup of newbie – new person.

Listening to: Sun Control Species – Scienza Nouva. And it’s REALLY good.

Facebook Stats From Dare

Dare Obasanjo has a nice summary of the Facebook Engineering Road Show.

They have some scary / fantastic stats:

Mike Shreopfer started his talk with a number of impressive statistics. These stats include the fact that 2 billion pieces of content are shared per week when you add up all of the status updates, comments, likes and other sharing gestures that are performed on the site. There are also 2 billion photos uploaded per month, 15,000 Facebook Connect implementations which in combination with the various platform applications make over 5 billion API calls per day and about 300 million active users per month.

They use PHP on the front-end because it is easy to learn, easy to develop in and it is very productive. However there are downsides such as the fact that their benchmarks have shown that it is ten times slower than if they used more traditional web programming technologies like C# or Java. They have done a lot of work to optimize PHP and will continue to invest in optimizations instead of switching the language they use on their front ends.

This gels with what I’ve seen at my previous employer. It’s easy to find “good enough” PHP people who also know HTML, CSS and Javascript (and not too hard to find rock stars like Lorenzo). Training someone who can code in PHP is easy, even if they feel like their brain is being extracted thru their tear ducts. That makes a lot of sense – it’s cheaper than buying more hardware by a long shot.

Once they got memcached throughput that high, they hit another scaling bottleneck in that they started flooding their network switches due to putting too much data on the network.

All up, it shows some of the problems that you run into when you have a site which is a lot more than just “big” – it’s “huge”. I’d LOVE to see a similar thing from Google or Microsoft. The BBC – which is, in almost anyones terms, a “big” site – doesn’t run into these kinds of problems. Google, Facebook, Microsoft, Amazon have really created a new class of scale.

It’s a Matter of Trust (or: I Dont Trust Time Capsule Anymore)

So, my time capsule died this morning. No light, no nothing. Dead. Of course, that takes out the rest of the network, too.

I took it into Apple today, and they swapped it out for a new 1tb model (I had 500gb before). Cheers Apple, I was only expecting a refurb model. It wasn’t under warranty, but the all our Mac’s are, and they are covered under those AppleCare agreements.

The problem I have now is: I don’t trust the device. It’s died after 18 months, like the 100s of others which went the same way. There is no change in the design, so I’d expect it to happen again in another 18 months. I’m even going to put a calendar appointment in to make damn sure it’s totally backed up.

However, this is not something I want to trust with all our data!! Because of all the news reports, I had some of the contents backed up onto a usb drive – yes, backing up a backup device – but all our collected movies and some tv shows are long gone. It could have been a disaster, but in this case it’s just a large inconvenience.

I can’t recommend anyone get a time capsule. It’s design – mostly it’s lack of cooling – make it unfit for the purpose it was sold. If you want Apple gear, get an Airport Extreme and an external hard drive. The performance will most likely be better, and it’s not going to blow up on you.

The Stig Army Prepaires to Say Nothing

Westfield Plaza.

Leonie says:

some say, they only hunt in packs when their girlfriend is away… some say, they can’t leave the house before 10am in the winter or their helmets frost up on the inside and they can’t see to drive…

all we know is, they’re called the stig(s)

I think the show should be back on shortly – early next month…..