2008-08-11

apache 2, mod_proxy, load balancer, mongrel_cluster, rails, and 404

I don't know where the bug is, but the fix had nothing to do with mongrel or rails. For some pages, most of the time I would get a 404 Not Found error. The apache error log showed this:

[Sun Aug 10 20:54:48 2008] [error] [client a.b.c.d] proxy: error reading status line from remote server 127.0.0.1, referer: http://triplex.softify.com/
[Sun Aug 10 20:54:48 2008] [error] [client a.b.c.d] proxy: Error reading from remote server returned by /user/list, referer: http://triplex.softify.com/


After much googling I ended up on the page that says it all, and more besides: https://issues.apache.org/bugzilla/show_bug.cgi?id=37770

Two config modifications stand out: firstly, to add these lines -

SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1


and secondly, to set the log level to debug:

LogLevel debug


I added both and the situation is much improved. The worst offender is a very slow-loading page.

I'm on apache 2.2.6. I'd love to know what the correct fix is. Interestingly, according to the bugzilla page for bug 37770, this has been an issue since 2.2.2.

This is how my mongrel_cluster apache virtual host proxy load-balancer config looks now:


<VirtualHost *:80>
ServerName triplex.softify.com
DocumentRoot /u/apps/triplex/current/public
RewriteEngine On

<Proxy balancer://mongrelcluster>
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
BalancerMember http://127.0.0.1:8002
</Proxy>

# Redirect all non-static requests to Mongrel
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrelcluster%{REQUEST_URI} [P,QSA,L]

ProxyPass / balancer://mongrelcluster/
ProxyPassReverse / balancer://mongrelcluster/
ProxyPreserveHost on

SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1


<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ErrorLog /var/log/apache2/triplex.softify.com.error.log
CustomLog /var/log/apache2/triplex.softify.com.access.log combined
LogLevel debug
</VirtualHost>

2008-07-24

Au Revoir, Banque

Bye-bye BNP Paribas. We had a great time together for three and a half years, more than your own rules allow. We might even meet again.

Next week: the Pyrennees. Watch this space for photos, assuming there's an internet connection down there somewhere.

After that: freelancing and maybe some startupping.

Beyond that: Hong Kong? Australia? India? Japan? Switzerland?

See you this evening in O'Sullivan's !!

2008-07-17

Urssaf considered harmful

Urssaf is a big government body in France that collects money. I don't know what this money is for, but they send nasty letters threatening legal action if you don't pay.

Urssaf sucks in more ways than I can list.

Today (17th July), however, we received what we thought was an opportunity for vengeance. A customer satisfaction survey. We started crossing all of the "not satisfied at all" boxes in heavy black ink. And then noticed on the cover letter: "Please return this form before the 11th of July 2008". Oops. And then noticed the postmark on the envelope: 10th of July 2008

I bet there is some damned smug pointy-haired manager in the bowels of Urssaf somewhere describing to his boss, through yellowing teeth and cigarette breath, as he strokes his balding head, his innocent surprise at how so few surveys were returned.

Merde, merde, and double merde.

If you can recommend a country that's not as completely broken as France, please leave a comment.

Using checkbox for a multiple-value parameter in Rails

This wasn't obvious. Thanks to satish on rails I learned this is the way to do it:


<input type="checkbox" name="customer[preferences][]" value="yellow"/>
<input type="checkbox" name="customer[preferences][]" value="blue"/>
etc


The extra [] at the end of the parameter name makes all the difference. In your controller, you can now reference


params[:customer][:preferences]


and get a list.

2008-06-23

The End is Nigh - but wait, I haven't checked in my code yet!

I set my alarm, get up at 7:30 or so, walk my son to school (he has a future, you know), and hop on the bus. On the bus to work I practice lisp, because it's the language of the future, you know. At the office, I write more software, helping replace legacy systems with future-oriented web technologies. Helping the bank acquire more future wealth. Gathering the crumbs for my own future wealth. I think about my future projects, what kind of a startup should I build, what kind of wealth I will accumulate, and what will I do with it. Where will I live, who will I know, what will I be doing in and with the world? And my children? What kind of a world are we building for them?

And then I remember: there is no future.


When the rain passes, moving up the coast, we cross the creek on the pontoon, pulling ourselves across the slow flow on a simple, effective contraption of empty oil drums and steel grating, and walk to the beach. Sand after rain seems like hope or the promise of forgiveness—, a reminder that after we've gone, when the last human passes, the world will continue, and will begin to erase the signs of our time on Earth. Like the maze of footprints on the beach and the excavations and constructions of small children with plastic spades and buckets, the traces of our activities will be erased by weather and time and non-human lives.

When and how this will happen, I don't know. I do suspect it will happen not catastrophically and globally but gradually and patchily. Human existence, already grim in much of the world, will become grimmer, then desperate, and the expansion of regions where humans cannot live will accelerate. There, in those deserted and ruined places, the record of human life will begin to fade.


(from pohanginapete, with thanks to Dave Pollard for the link)

2008-06-22

Drive massive amounts of traffic to your blog

Oh, I'm talking about traffic again. Didn't mean to, honest ...

A while back, Dhaval blogged about Google Analytics. I had installed this snippet of javascript on this blog at the beginning of this year and it's better than television. OMG I got two hits yesterday I have *so* made it!!!1! It's the first thing I check in the evening when I get home. Ok, the second thing, after reddit. And the arc forum.

Anyway, I digress. As Dhaval mentions, it's full of charts and analyses and breakdowns. But a powerful little feature that deserves a bit of attention is the "keywords" report. It tells me, for all hits that came from searches, what terms were used in those searches. So even though "conan dalton" is the single dominant search expression, there are many more search expressions containing "onmouseout", "oracledatasource", "hibernate". Because I happened to write short articles describing my experience with problems in those topics.

But I don't think they're my most interesting articles! I'm a human being, I have thoughts, feelings, emotions, I care about things like crossing the road, and what my children can teach me about business. onmouseout isn't really that important, in the grand scheme of things!

Anger and denial over. So, analytics teaches me what drives people to my blog. It looks like I should stop writing about me, and write some more about the behaviour of onmouseout when using Spring to configure Rails with Markaby and ActiveHibernateRecord buzzword buzzword Oracle DSL .NET iPhone buzzword ...

But can I go further? Yes! It turns out that Google have another great little tool, Google Trends. (Yes, I'm expecting a nice cheque from them one of these days). Hot Trends tell me what people are interested in today. Armed with this knowledge, all I need to do is blog about today's top ten search expressions and voilà, Blogger will collapse under the strain. So, here goes:

  1. thomas finchum - never heard of this dude. He's a diver. Some pictures.
  2. david boudia - another diver. What's going on? Is it the olympics or something? Why did nobody tell me?
  3. gwen araujo - transgender woman beaten and murdered. I remembered Boy's don't cry. It made me cry.
  4. radio days - a Woody Allen film. From 1987.
  5. henry klum - Heidi Klum's son. He went to the park.
  6. emphysema - a lung disease. Caught by Amy Winehouse. She's a singer. Ouch.
  7. michelle brown - her identity was stolen
  8. crisco.com/grilling - Seriously? Google, have you checked your trends algorithm?
  9. ironman coeur d alene - a Ford-organised triathlon. This year, with less waste, apparently. Great.
  10. ocean breeze - well, who doesn't want more of that? But ... Top 10?


I'll let you know what happens to my stats. In the meantime, I've learnt some stuff today that otherwise ... otherwise ... I might never have learnt. Thanks, Google!

2008-06-13

No, no, and no!

Living in France, I didn't vote in yesterday's referendum on the Lisbon treaty, but I'm pretty sure I would have voted against. Unlike some in office, I might have even made the effort to read a summary of what we were asked to vote for. There was a time when I believed in greater European integration for economic self-defense against the established and upcoming economic giants of the world - 300 million people have a lot to say, but if you took the entire population of Ireland and plopped them in India, I'm not sure anyone would notice.

More recently however I've become skeptical of centralised power and big bureaucracies. A big government is just as likely to screw its own people as defend against foreign interests.

It's kind of sickening to see other European politicians slamming the Irish people for their decision, regardless of how poorly the decision might have been made. Those politicians know where Lisbon would be if their own peoples had a say in the matter. "21% of Irish people decide the fate of 300 million Europeans" - WTF? Is it preferable that a few dozen politicians make this decision? Do you, like, *trust* your leaders??

Back in the Dark Ages, legend has it, Ireland "saved civilisation" by taking the scholarly works of the Holy Roman Empire with them as they fled to the safety and isolation of this little island far from the wanton destruction of heathen invaders from the North. It's kind of funny to think this country, with its silly insular, provincial political factions, might now be the last outpost of democracy in Europe.

On a completely unrelated note, and I hope you'll forgive me for being irrelevant, reddit kindly pointed out this video (52 mins) of an academic demolition of standard WTC collapse theories. It says much the same as 911 Mysteries, but without all the drama and excitement. Just a simple analysis of publicly available knowledge - photos, videos, and witness accounts.