Monday, September 03, 2012

As more and more sad details surface about Apple's legal crusade, I keep thinking why I'm using the iPhone and don't just switch to an Android.

Yeah, it's not as good still, and I always told myself I'll get an Android phone eventually, when they're good enough.

But then it hit me:

It doesn't matter. Apple is not going to lose only because eventually its customers will switch to the competitors' products. Apple is going to lose because eventually its own employees, the people that make it the greatest company in the world, will leave.

Apple is the personal creation of a great man. Perhaps the greatest man of our time. But as such, Apple also has in it the seed of its own destruction. In it's insatiable desire to being the greatest there's also the insatiable desire to be worshiped and acknowledged as the greatest.

It's not enough to win, to sell the most phones, tablets and laptops. It's not enough to be the most valuable company in the world. Apple also wanted its competitors to bow before it, admit that Apple invented and created everything that's good in the world, and commit a elaborate suicide ritual at Apple's feet.

And when I say "Apple", I mean "Steve".

Want to join me as partner in a cool new startup?
Get in touch: pasha at cohai dot co

Bookmark and Share Monday, September 03, 2012 7:55:24 PM (Jerusalem Daylight Time, UTC+03:00)  #    Comments [5]  
 Sunday, September 02, 2012

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?

General process

The alcohol in beer is created by fermentation. Yeast is eating up the grains in the beer, making alcohol (ethanol) in the process.

The density of ethanol is known, so in order to tell the amount of ethanol in the beer, we measure the overall density of the beer before and after the fermentation, and then deduce the amount of ethanol in the beer.

Density

"Density" is a measure of how "heavy" something is for a given volume. Imagine two identical boxes, one with nails and one with flowers. The box with nails will probably be heavier, so intuitively we can say that nails are more "dense" than flowers.

We use "Specific Gravity" to denote the density of beer. Specific Gravity is a unit of how dense something is relatively to some kind of "standard" density. For liquids, the standard is usually water. So water has a standard gravity of "1". Something that's twice as dense as water has the standard gravity "2" and so on.

Measuring the density of beer

A tool called Hydrometer is used to measure the density of a liquid. It's basically a tube with a weight at the bottom. You fill the tube up to a certain point with the liquid you're interested in measuring and the hydrometer shows the density by measuring the weight of the liquid.

The calculation

Now, since we know the density of ethanol and we have the two measures of density for the beer - before and after fermentation, we can use a simple formula to tell the Alcohol by Volume:

( ( 1.05 x ( OG – FG ) ) / FG ) / 0.79 x 100

Where "OG" is "Original Gravity" - the density before fermentation, and "FG" is "Final Gravity", the density after fermentation.

Want to join me as partner in a cool new startup?
Get in touch: pasha at cohai dot co

Bookmark and Share Sunday, September 02, 2012 7:29:48 PM (Jerusalem Daylight Time, UTC+03:00)  #    Comments [2]  
 Thursday, May 10, 2012

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 Foundation\Apache2.2\bin).

Want to join me as partner in a cool new startup?
Get in touch: pasha at cohai dot co

Bookmark and Share Thursday, May 10, 2012 7:04:05 AM (Jerusalem Daylight Time, UTC+03:00)  #    Comments [5]  
 Tuesday, January 03, 2012

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.

The thesis is the egalitarian approach is the main reason for the success:

In fact, since academic excellence wasn't a particular priority on the Finnish to-do list, when Finland's students scored so high on the first PISA survey in 2001, many Finns thought the results must be a mistake. But subsequent PISA tests confirmed that Finland -- unlike, say, very similar countries such as Norway -- was producing academic excellence through its particular policy focus on equity.

Not sure if applicable to some other countries, but definitely mind blowing.

Want to join me as partner in a cool new startup?
Get in touch: pasha at cohai dot co

Bookmark and Share Tuesday, January 03, 2012 6:12:04 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [7]  
 Tuesday, December 27, 2011

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.

You can go the way of making your code explicit my moving the logic into your app and doing something like

var record=DataAccess.GetRecord(key);
if(record == null)
  DataAccess.InsertRecord(data);

But then you'll be losing the power of using the database do that for you.

So what I'm suggesting is just making your naming better, for example: DataAccess.ReplaceRecord(data).

Want to join me as partner in a cool new startup?
Get in touch: pasha at cohai dot co

Bookmark and Share Tuesday, December 27, 2011 9:34:39 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [16]  
 Monday, December 26, 2011

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!

Want to join me as partner in a cool new startup?
Get in touch: pasha at cohai dot co

Bookmark and Share Tuesday, December 27, 2011 4:50:42 AM (Jerusalem Standard Time, UTC+02:00)  #    Comments [6]  
 Sunday, December 18, 2011

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".

Now use the email of this account that you've just created as the "senderEmail" in the call to the "Pay" API operation.

Want to join me as partner in a cool new startup?
Get in touch: pasha at cohai dot co

Bookmark and Share Sunday, December 18, 2011 8:09:59 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [5]  
 Saturday, December 17, 2011
“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. We owned them.”

Amazing stuff on the Jack Abramoff story.

Want to join me as partner in a cool new startup?
Get in touch: pasha at cohai dot co

Bookmark and Share Saturday, December 17, 2011 11:34:34 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [4]  

First you need to go to Server Manager, expand "Roles", right-click "web server" and choose "add role services".

Then under "security" choose "basic authentication".

Now go to IIS Manager, click "Authentication" and enable "basic authentication".

Last, set up a local user: go to Server Manager, expand "configuration"->"local users and groups". Right-click "users" and click "new user...". Set up a user/password.

Voila, now user the user/password you've set up when browsing to your website.

Want to join me as partner in a cool new startup?
Get in touch: pasha at cohai dot co

Bookmark and Share Saturday, December 17, 2011 11:12:13 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [5]