Measuring The Alcohol Content of Beer
All booze has an “Alcohol by Volume” measure specified. It’s denoted as a percentage which is supposed to tell you “how much alcohol” there’s in the specific drink, or, alternatively “how fucked up are you going to be and how fast”. Beer is typically between 4%-10%, wine 12%-14%, vodka and whiskey 40% and so on.
But how do they measure this quantity? How do they know exactly how much alcohol is there in a bottle of beer?…
Read more ⟶
Apache with PHP on a Windows Machine
The program can’t start because LIBPQ.dll is missing from your computer. Try reinstalling the program to fix this problem.
If you’re getting the above error when starting Apache after installing Apache and PHP on your Windows machine, go to your PHP install directory (e.g. c:Program Files (x86)PHP) and copy the file libpq.dll into the bin directory under the Apache install directory (e.g. C:Program Files (x86)Apache Software FoundationApache2.2bin).…
Read more ⟶
The Finnish Education System
A thought provoking article in the Atlantic about the education superpower Finland:
The small Nordic country of Finland used to be known – if it was known for anything at all – as the home of Nokia, the mobile phone giant. But lately Finland has been attracting attention on global surveys of quality of life – Newsweek ranked it number one last year – and Finland’s national education system has been receiving particular praise, because in recent years Finnish students have been turning in some of the highest test scores in the world.…
Read more ⟶
Using Better Naming to Clarify Code
.code{font-family:Lucida Console, Courier New;background:#ffdf73;}
I’m a big fan of good naming in code, here’s a recent example:
Suppose you have a unique index in a database table and you’re trusting that index to enforce no more than one record with the key.
So you’re using an insert ignore into…on duplicate key update statement.
So you end up calling something like DataAccess.InsertRecord(data) or DataAccess.AddRecord(data). Looking at such code it’s very unclear that what really happens is an insert/update and you’re only left with one record.…
Read more ⟶
Make the Ugly Scrollbars on your Facebook App Disappear
If you have annoying scrollbars around your Facebook app’s canvas, here’s what you need to do:
First, go to your app’s settings, click “Edit App” and then “Advanced” on the right.
Scroll all the way down to “Canvas Settings” and change “Canvas Height” to “Settable”.
Second, add a call to FB.Canvas.setSize() (http://developers.facebook.com/docs/reference/javascript/FB.Canvas.setSize/). Make this call inside window.fbAsyncInit, after calling FB.init.
That’s it! Gorgeous app, no scrollbars!…
Read more ⟶
Adaptive Payments Error This transaction has already been approved
If you’re using the PayPal Adaptive Payments API in sandbox mode, redirecting the user to https://www.sandbox.paypal.com/cgi-bin/webscr and getting the following error:
This transaction has already been approved
The problem may be that you’re using an incorrect sandbox user as the “sender” in the transaction.
You need to go to the sandbox (https://developer.paypal.com/) and then to “test accounts” on the left.
You need to create a test account. Click “preconfigured” next to “new test account” and then make sure you select “buyer” under “account type”.…
Read more ⟶
Jack Abramoff on How to Own The System
“When we would become friendly with an office,” he explained, “and they were important to us, and the chief of staff was a competent person, I would say or my staff would say to him or her at some point, ‘You know, when you’re done working on the Hill, we’d very much like you to consider coming to work for us.’ Now the moment I said that to them or any of our staff said that to ‘em, that was it.…
Read more ⟶
Hiking the Fjordruta in Norway
The Fjordruta is a great multi-day hike in the west of Norway. It has a little bit of everything: fjords, forests, mountains. The whole trail can take about two weeks but you can do as little as a couple of days.
The best time is summer. I did 3 days in late September: the conditions weren’t perfect but not too bad either. I had two overcast days with some rain and one sunny day.…
Read more ⟶
Launching Cohaico Beta
A little less than three months ago I started working on my new project, Cohaico, and today I’m launching the public beta of the website. From the announcement post on the Cohaico blog:
Let us fix that for you.
Guess what - your friends are already sharing everything they know about stuff. They do it on social networks like Twitter.
But if you get on Twitter - you’ll just see what was said in the last few hours or so.…
Read more ⟶
San Francisco
People are zombies Everybody’s on their iPhone, all the time. I find it kind of troubling. We’re soooo headed at The Matrix. And when it happens, 5-10 years from now, it won’t be all violent skynet-style-war-with-the-machines-kind-of-thing. When Steve Jobs comes up with the iThing that plugs via USB directly into your brain - people will just line up to get that $499 piece of crap.
Bubble This place is a bubble.…
Read more ⟶