Archive for April, 2006

Stuff FastCGI – I’m moving RForwards!

Tuesday, April 25th, 2006

The first version of RForward, my ISAPI DLL that bypasses FastCGI and makes running Rails through IIS simpler, is almost in the beta stage.

As described before it sidesteps the FastCGI issue by running as a proxy. A request (only GET or POST for now) comes into IIS, is rewritten to RForward, which forwards the request to one of the many WEBrick/Mongrel instances you have running in the background. By running multiple ruby processes we avoid the synchronisation lock in ActionPack (that means Rails can only deal with one request at a time), by using an existing ruby-friendly web-server we avoid all the nasty configuration issues with FastCGI.

I’m just working on WEBrick Service Installer (that will automate the setup of multiple Windows Services for WEBrick) – but if anyone wants it early, let me know (my email is the same as my MSN).

Getting weird FastCGI errors?

Friday, April 21st, 2006

I’ve just been having a conversation with Jens, who was getting an ‘unable to connect to FastCGI error’, which I know seems to be the most common way for this setup to fail.

First was looking at the temporary folder – if it works in WEBrick but not in IIS does it mean that IIS does not have permission to write session files to the temporary folder? In this case, IIS had all the permissions it needed. One thing to watch out for is that I find “Everyone” does not always mean everyone – so it may help to add certain users individually.

Next suggestion was the fast-cgi crash log – which seems to appear in the rails application’s log folder. There was none – but it’s not always that helpful anyway.

Next up was watching Task Manager as the request goes in – does rubyw.exe appear at all? In this case, no. This is useful as it shows whether the request is passing through FastCGI and it is ruby that cannot start or whether it was FastCGI going wrong. In this case ruby could not start. Why?

One thing that I found useful when installing a Rails application on my personal hosted site (Linux/Apache) was to run dispatch.cgi and dispatch.fcgi manually. Open a command prompt, move to your public folder and run ruby dispatch.cgi – you should get an internal server error. Try the same with dispatch.fcgi – here Jens got a useful error – ‘could not load MSVCR71.dll’. It turns out that this is part of the MS C runtime and is a free download. A quick internet search and Jens was up and running.

So, if you are getting weirdness in your FastCGI setup then try downloading MSVCR71.DLL and see if that fixes it.

UPDATE: Not quite working yet, but it looks like its Rails weirdness, not FastCGI weirdness.

Wanna be Steve Jobs?

Wednesday, April 19th, 2006

Business Week tells you how to emulate His Steveness.

How to do it properly

Tuesday, April 18th, 2006

Brent Simmons has a post almost identical in content to the 37Signals post about user-feedback and feature requests.

But whereas 37Signals’ tone was “look at the rubbish we have to put up with”, Brent’s was “please help me to help you”.

It’s not that difficult really.

The greatest thing DHH ever did

Monday, April 17th, 2006

I was writing some SQL Server code to strip the time portion off a date/time value – it took me about half an hour to find a way of doing it that didn’t kill performance (as I needed the calculation doing in the where clause of a select statement). The code I came up with was:

declare @DateAndTime datetimedeclare @DateOnly datetime

select @DateAndTime = getdate()

select @DateOnly = cast(floor(cast(@DateAndTime as float)) as datetime)

select @DateAndTime as DateAndTime, @DateOnly as DateOnly

Half an hour for something that ought to be really simple. It made me think that date/time handling is pretty poor in nearly all languages.

Which is why the best thing that DHH ever did (if it wasn’t him, my apologies to the author) was:

10.minutes.from_now2.months.ago

Not quite solving the problem described above but absolute genius and the way dates and times should work.

UPDATE

The next version of our application is going to have a denormalised date only field that is populated on a trigger. Ugly but better than the where clause hack shown above.

UPDATE TWO

What’s better than

10.minutes.ago

Obviously

10 minutes ago.

Looks good, smells even better

Monday, April 17th, 2006

Java:

dave.hit(nail, hammer, com.something.hittingthings.Force.REALLY_HARD);

RoR:

dave.hit(nail, :with => hammer, :force => :really_hard)

Smalltalk:

dave hit: theNail with: aHammer andForce: #ReallyHard.

You’re not alone

Friday, April 14th, 2006

At the risk of sounding obsessed, I’m not alone in my thoughts about 37Signals. Suffice to say that no company of mine would ever say such a thing (even if we think it). And absolutely no way would we ever tag incoming mail with terms such as “moron”. If you are my customer then you are not a moron. That’s what it means to be in a service industry.

Update: Guy Kawasaki says it much better.

What do you say about your customers?

Wednesday, April 12th, 2006

My first thought on reading this, coupled with DHH’s recent posts, was that the pressure of success must be getting to 37Signals. Despite being at pains to deny it, it is an attack on their customers (or potential customers) and even with the anonymity, anyone quoted in there has a right to feel slightly aggrieved.

But, as Jason says, it’s just what they talk about in private. And they want to be open. Like them, we have customers that sometimes infuriate us and quite often it’s not what they are saying but the way they are saying it that causes the problem. I don’t work for an open organisation. I don’t think I have mentioned the company name or URL on here once and I doubt I ever will, simply because it is not the company way. But even if I did, I don’t think I would make public a complaint like that – maybe an individual comment paraphrased beyond recognition – but a collection of direct quotes? No way!

Which provides the unifying thread between this post, the last post, DHH and Jason Fried – at the end of the day, it’s all about intention and respect. Jason’s post is a complaint that if these prospects and customers showed a bit more civility in their comments they would receive a more favourable response. However, the manner in which the complaint was presented, lumping together a set of different responses to different issues and quoting verbatim so that the person who made the original comment will immediately recognise it (even if 99.999% of the readers do not), is, to my mind at least, similarly disrespectful – if not in content then in tone. And tone is notoriously hard to read on the internet.

My point? If you are using a medium where such nuances and subtleties (and intention is always open to interpretation) are hard to read then do not say it. You are the supplier, not the customer. Even if you can afford to lose the business (which I presume 37Signals can) relationships are hard to build and easy to break and you never know when you might need a helping hand.

(then again, I may just be jealous because my employers are not making money hand over fist in such an open environment – a theme I may be returning to soon enough)

UPDATE: My company’s site has been mentioned. I leave it to you to find out where …

The Backlash starts here!

Friday, April 7th, 2006

DHH’s two latest blog posts (here and here) reekof smugness and elitism. Fair enough, if anyone deserves to be smug and feel like they are part of the elite then it’s DHH, Jason Fried and the 37Signals people. But that attitude stinks and I’ll never like it.

Who is this mainstream that you despise so much? It’s the vast majority of normal people who may be as smart as you but haven’t had the breaks. Or who may not be as smart as you but are still pretty smart. Or who may not be that smart at all but have a job programming computers. But they have bills to pay and their mortgages and loans and divorce payments and screaming children mean that they can’t afford the risk of chucking away their “shitty” J2EE/.NET/COBOL jobs with its £30000 salary. Remember £30000 is half again higher than the average household income in the UK. Swap J2EE/.NET/COBOL for McDonalds/petrol station/supermarket checkout. Those people are real scum, right?

Just because you’re a superstar doesn’t mean you should shit on those who aren’t. It’s plain rude and shows a lack of basic respect for other people.

Update on the IIS installer

Friday, April 7th, 2006

I officially have permission from my boss to release this as open-source (I know, I ought to have asked first). I also have a first draft Delphi ISAPI application that effectively proxies each request to a single WEBrick instance running on the same machine.

Next stage is to tidy up the reverse proxy (any embedded links contain http://server:3000/controller/action) and then add a simple load-balancer (round robin to begin with) so it can pass requests off to different WEBrick instances in turn.

Then I’ll probably rewrite the entire thing as a .NET HTTPModule – precisely because I want all you lucky lucky people to join in, test the bugger and get it working everywhere, all the time – and because Delphi is dying. I’ll also need to rewrite the all-singing, all-dancing WEBrick installer in order to get it to install multiple processes/services – and, if I get the chance, I may even write a Mongrel equivalent.

Ideally, I would like to get at least the Delphi version ready by the middle of May as I have a deadline of then. So hold tight … it’s on its way.