Archive for October, 2010

The 32 most commonly misused words and phrases

Guys at PM Hut (amazing blog on project management) came up with a great list of the 32 most commonly misused words and phrases.
Although the post is titled Even a Project Manager Needs Good Grammar, I believe such list can work as a good ‘flashcard’ for anyone including those who studies either for SAT or GRE exams.

Some notable of those words are quoted below:

Affect/Effect – The way you “affect” someone can have an “effect” on them. “Affect” is usually a verb and “Effect” is a noun.
Complement/Compliment – I often must compliment my wife on how her love for cooking perfectly complements my love for grocery shopping.
Discreet/Discrete – We can break people into two discrete (separate) groups, the discreet (secretive) and indiscreet.
Elicit/Illicit – Some people post illicit things on message boards to elicit outrageous reactions from others.
Flair/Flare – A flair is a talent, while a flare is a burst (of anger, fire, etc.)
Inflammable – Don’t let the prefix confuse you, if something is inflammable it can catch on fire.
Imply/Infer – A reader infers what an author implies. In other words, when you imply something, you hint at it. When you infer something, you draw a conclusion based on clues.
Literally – If you say “His head literally exploded because he was so mad!” then we should see brains splattered on the ceiling.
Lose/Loose – If your pants are too loose you may lose them. That would be almost as embarrassing as misusing these two words.
Percent/Percentage – The word “percent” should only be used when a specific number is given. “Percentage” is more of a general term.
Stationary/Stationery – You are stationary when you aren’t moving. Stationery is something you write on.
Unique – Something can’t be “kind of unique” or even “very unique.” It’s either one of a kind or it isn’t. There is no in between when it comes to unique.
Lie/Lay – After you lay the books on the table, go lie down on the couch.
Allude/Elude – When someone alludes to something in conversation (indirectly references), if you aren’t paying attention the meaning may elude you (escape you).

A Day in the Life of Facebook Operations

Tom Cook gives an amazing talk at Velocity 2010 on a day in the life of Facebook operations.
Learn the numbers behind Facebook (400 million of users and growing!), how the code is pushed, what tools are used to monitor the servers and many other interesting stuff behind the scenes.

MySQL: How to store IP address

It is still common to store IP addresses as a varchar(15) field though it is possible to use integer type instead. Unlike the varchar type, integer has fixed size and uses only 4 bytes.

INET_ATON() is used to convert an IP address to a number and INET_NTOA() – for the reverse operation.

SELECT INET_ATON('127.0.0.1');
SELECT INET_NTOA(2130706433);

It is important to use INT UNSIGNED with INET_ATON() so that IP addresses for which the first octet is greater than 127 is stored correctly.

Also PHP has similar functions – ip2long() and long2ip(). However ip2long() function may return negative results in certain cases. To make it always positive unsigned intereger ip2long() call has to be paired with printf() or sprintf() function:

printf('%u', ip2long('128.0.0.1');

Thus plan the IP address column datatype accordingly.

MySQL: How to find an optimal datatype for the columns

PROCEDURE ANALYSE examines the result from a query and returns an analysis of the results that suggests optimal data types for each column that may help reduce table sizes. Simply append PROCEDURE ANALYSE to the end of a select statement:

SELECT f1, f2 FROM t PROCEDURE ANALYSE(20, 2000);

where

  • 10 is is the maximum number of distinct values which is checked for columns;
  • 2000 is the maximum amount of memory which can be allocated per column while trying to find all distinct values.

This MySQL feature can be helpful after importing new data or for checking your existing tables to verify whether columns datatype was designed providently.