Archive for May, 2009

Girls rock a giant piano

Shiny Toy Guns – Major Tom

Another good song is introduced in commercial. This time it is 2010 Lincoln MKZ. Soundtrack “Major Tom (Coming Home)” is performed by Shiny Toy Guns.

Also the song can be downloaded for free on Lincoln’s site – http://www.lincoln.com/extras/asset/majortom.zip. Archive should contain a 10Mb file with a 320kbps encoded mp3.

Excuse me… Did you say something?

Excuse me... Did you say something?

Scrum In 13 seconds

Transformers: Revenge Of The Fallen

Looks like Michael Bay knows how to direct movies. 🙂

The Rock, Armageddon, Pearl Harbor, Transformers are followed by Transformers: Revenge Of The Fallen which may be the most awaited movie of 2009. Looking forward to June, 24!

MySQL: Add Leading Zeros

There might be many ways to force leading zeros to be displayed when string length is less than expected.

One of them is to use string function LPAD(). For example, the following query:

SELECT LPAD('1101', 8, '0');

returns ‘00001101’.

However, if string (first parameter) is longer than length (second parameter), the return value is shortened. For example:

SELECT LPAD('1101', 2, '0');

returns ’11’.

MySQL: Display Width Of Integer Data Type

Sometimes junior database developers are being confused by field types like INT(2). Does it mean 2 bytes or 2 digits only?

However it is just optional field width which in conjunction with the optional extension attribute ZEROFILL allows to replace the default padding of spaces with zeros. For example, for a column declared as INT(5) ZEROFILL, a value of 4 is retrieved as 00004.

Therefore the display width does not constrain the range of values that can be stored in the column, nor the number of digits that are displayed for values having a width exceeding that specified for the column. For example, a column specified as SMALLINT(3) has the usual SMALLINT range of -32768 to 32767, and values outside the range allowed by three characters are displayed using more than three characters.

But according to MySQL reference manual there is a possibility of problems when MySQL generates temporary tables for some complicated joins and larger values than the display width are stored in an integer column, because in these cases MySQL assumes that the data fits into the original column width.

2 Unlimited – Jump For Joy

Recently have discussed with a friend of mine that ‘2 Unlimited’ may be a good example of techno.

In any way jump for joy and… “Dance like no one is watching. Sing like no one is listening. Love like you’ve never been hurt and live like it’s heaven on Earth.” (Mark Twain)

By the way, Ray and Anita reunited on April 11, 2009, to perform together for the first time in 13 years at the “I Love The 90s” concert in Hasselt, Belgium.

MySQL: daylight savings time support

Time zone support is a typical part of many web applications. But not every application takes into account daylight savings time when +1 is added to hour difference during summer time only.

When PHP allows to identify DST simply by calling something like:

print date('I', strtotime('2009-03-11 00:00:00'));

it may not be obvious that:

SELECT CONVERT_TZ('2009-03-11 00:00:00', 'GMT', 'EST');

and

SELECT CONVERT_TZ('2009-03-11 00:00:00', 'GMT', 'US/Eastern');

return different results:

  • ‘2009-03-11 05:00:00’ in case of ‘EST’ and
  • ‘2009-03-11 04:00:00’ in case of ‘US/Eastern’.

This article explains how to make work CONVERT_TZ() function (which returns NULL by default) and stay current with time zone changes.

P.S.: There are some time zones with minute adjustment like UTC+5:45 or UTC+9:30 as well as with difference more than 12 hours from GMT like UTC+13 or UTC+14.

How to get sound from YouTube video

Sometimes it could be very convenient just to listen instead of sitting and watching. Especially if it is an interview or a lecture.

There is a very simple and fast service Media Converter which supports not only YouTube and allow to convert files up to 100Mb for free.

Next Page »