Saturday, July 18, 2009

Do you know the Most Popular Car Color in America?

You may be wondering, what is the most popular car color? For seven years, silver was the most popular car color. It was seen as both a high-tech color and one that was safe for resell—not as many people would be turned off by a silver car as would be turned off by, say, a green car.

Buyers in 2007, however, broke the mold by buying more white cars than cars in any other color. Why? Well, it’s been said that a high-tech color like silver isn’t popular anymore. I disagree. I don’t think silver is a high-tech color anymore. Looking at the popularity of iPods, iPhones and other Apple products, I’d say white is going to be the color of technology for some time.

In 2007, nineteen percent of cars manufactured were white. Twenty-two percent of luxury cars were white. Eighteen percent of all cars were silver and sixteen percent were black.

Of course, given years of popularity, silver cars will still outnumber autos of other colors for awhile.

2007 Most Popular Car Colors
Source: DuPont 2007 Global Automotive Color Popularity Report

Source: most-popular.net

Most Expensive Wines

The word wine has its root from the ancient Greek word for vines, vinos. Grapevines produces lush grapes which are then fermented to create the popular yet sophisticated alcoholic drink we know as wine. In many areas, the English word wine and its synonyms in different languages are protected by law, as other beverages similar to wine can be produced from fruits, rice, flowers and honey.

At the highest end, rare, super-expensive wines are often the costliest item on the menu, and exceptional vintages from the best vineyards may sell for thousands of dollars per bottle. Expensive red wines with their complex subtleties are traditionally more costly than other expensive wines.

Here are the most expensive wines in the world.

World's Most Expensive Wines - Screaming Eagle

1992 Screaming Eagle
around $80,000

At Auction Napa Valley 2008, a charity event, a lot of six magnums of Screaming Eagle were sold for $500,000. In addition to the wine, the lot included a dinner at the winery. The lucky purchaser was Chase Bailey, an executive at Cisco Systems.

World's Most Expensive Wines - Chateau Mouton-Rothschild

1945 Chateau Mouton-Rothschild Jeroboam
$114,614

Sold to an anonymous buyer at a Christie’s auction in 1997, this bottle comes from what is considered by wine enthusiasts to be one of the finest vintages of the 20th century.

World's Most Expensive Wines - Th.J 1787 Chateau Lafitte

“Th.J” 1787 Chateau Lafitte
$160,000

A bottle of 1787 Chateau Lafitte which sold at Christie’s London in December of 1985, this wine was originally reported to be from the cellar of Thomas Jefferson, the former US President, and this most expensive bottle of wine had the initials Th.J etched into the glass bottle. It made its way into the hands of American tycoon Bill Koch, who became suspicious of the origins of the four bottles he had purchased. Eventually, he instigated the investigation that debunked the supposed origin of what was, at the time of purchase, the most expensive wine in the world.

World's Most Expensive Wines - Shipwrecked 1907 Heidsieck

Shipwrecked 1907 Heidsieck
$275,000

These hundred year old bottles of Champagne from the Heidsieck vineyard in Champagne took over eighty years to reach their destination. Shipped to the Russian Imperial family in 1916, a shipwreck off the coast of Finland caused this champagne to be lost at sea until divers discovered over 200 bottles in 1997. Now they’re finally being sold—to wealthy guests at the Ritz-Carlton hotel in Moscow, at least. Of course, the wine’s extraordinary tale and incredible age are what makes it the world’s most expensive wine.

Source: most-expensive.net

MySQL ssh tunnel Quickstart

Scenario: You're at home, and you want to connect to a mysql server on the other side of a firewall. There is a machine with ssh open on it that you can use as a gateway.

  1. On your home machine:
    ssh -L 3307:domain.name.of.mysqlserver:3306 username@domain.name.of.gatewayserver

    See the Unix man pages for ssh here.

    This will open a tunnel, listening on localhost:3307 and forwarding everything to mysqlserver:3306, and doing it all via the ssh service on the gateway machine.

    This example shows us specifying port 3307 on the local end of the tunnel; I did this because I run a MySQL server on my home machine, so I can't re-use the default MySQL port.

    You'll now have a terminal open on the gateway machine, but you don't need it for this procedure, so set it aside.

  2. Now, on your local machine, execute a mysql connection like so:
    mysql -u username -p -h 127.0.0.1 -P 3307 databasename
    In other words, mysql thinks it's connecting to localhost, but on a different port. In fact, the connection is being made securely to the remote mysql server, via the gateway machine and the local "mouth" of the ssh tunnel on your own machine.

    See the Unix man pages for mysql here.

  3. When you're finished with your mysql session, log out of the session on the gateway machine. That will properly close the tunnel.

Friday, July 17, 2009

The MySQL Optimize Table Command

The MySQL Optimize Table command will effectively de-fragment a mysql table and is very useful for tables which are frequently updated and/or deleted.

Example:

We have a table called articles which has many thousands of rows which are often inserted, updated and deleted. We can see from the table description below that the table contains variable length column data types:

mysql> desc articles;
+----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| content | text | NO | | NULL | |
| author_id | int(11) | YES | | NULL | |
| article_title | varchar(120) | YES | | NULL | |
| article_hash | int(11) | YES | | NULL | |
+----------------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

If we look at the size of the table on disk we can see that it around 190MB. If we query the table on a column which is indexes we can see the average query response time:

e.g.

mysql> select count(*) from articles where article_title like 'The%';
+----------+
| count(*) |
+----------+
| 15830 |
+----------+
1 row in set (0.63 sec)


If we now optimize the table with the following command:

mysql> optimize table articles;
+-----------------------+----------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+-----------------------+----------+----------+----------+
| books.articles | optimize | status | OK |
+-----------------------+----------+----------+----------+
1 row in set (6.27 sec)

This has the effect of defragmenting the table and reducing the size of the table on disk down to 105MB. It also has a very positive affect on query performance, reducing the select query response time from 0.63 to 0.39 seconds. N.B. the mysql query cache was turned off to demonstrate.

mysql> select count(*) from articles where article_title like 'The%';
+----------+
| count(*) |
+----------+
| 15830 |
+----------+
1 row in set (0.39 sec)

Source: dbtuna.com