Monday, January 28, 2008

Summer of 69 Guitar Tablature

I am a Bryan Adams fan. Summer of 69 needs no introduction.

This is the guitar tablature of the first few seconds that starts the electricity.

Create these tabs in Guitar Pro.

Track 1
E E E E E E E E E E E E E E Q
E||--0--------2--------3-----|-----2--------0-----2----|
B||-----3--------3--------3--|--------3----------------|
G||--------2--------2--------|--2--------2-----2-------|
D||--------------------------|-------------------------|
A||--------------------------|-------------------------|
E||--------------------------|-------------------------|


E E E E E E E E E E E E E E Q E E E E E E E E
--------------------------|-------------------------|--0--------2--------3-----|
--0--------2--------3-----|-----2--------0-----2----|-----3--------3--------3--|
-----2--------2--------2--|--------2----------------|--------2--------2--------|
-----------------2--------|--2--------2-----2-------|--------------------------|
--------2-----------------|-------------------------|--------------------------|
--------------------------|-------------------------|--------------------------|


E E E E E E Q E E E E E E E E E E E E E E Q
-----2--------0-----2----|--------------------------|-------------------------||
--------3----------------|--0--------2--------3-----|-----2--------0-----2----||
--2--------2-----2-------|-----2--------2--------2--|--------2----------------||
-------------------------|-----------------2--------|--2--------2-----2-------||
-------------------------|--------2-----------------|-------------------------||
-------------------------|--------------------------|-------------------------||


Wednesday, January 23, 2008

Enable UTF-8 on PHP, MySQL and Apache

Before we begin, you need r00t access to key Apache, PHP and MySQL configuration files.

Let’s start with the apache config. The location paths may differ based on your server setup. Look around and be sure that you are editing real config files and not the templates.

Apache Config - /etc/httpd/conf/httpd.conf

AddDefaultCharset UTF-8

PHP Config – /etc/php.ini

default_charset = "utf-8"

MySQL Config - /etc/my.cnf

[client]
default-character-set=utf8

[mysqld]
character-set-server=utf8
default-character-set=utf8
default-collation=utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-client = utf8

Restart the above services once these updates have been applied.

Confirm if UTF-8 is Enabled:

# mysql –uroot –hlocalhost –p
# show variables like 'c%'

The above output should be:

+--------------------------+-------------------------------------------------------------------+
| Variable_name | Value |
+--------------------------+-------------------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| collation_connection | utf8_general_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 5 |
+--------------------------+-------------------------------------------------------------------+

It is possible that after these updates, PHP will continue to decode a UTF-8 character set in the form of question marks. Eg: ????

The solution is to call mysql_query() immediately after mysql_connect() has attempted a connection to the database.

$db_ = @mysql_connect (HOST, USER, PASSWORD, TRUE) or die("Could not connect");
mysql_query('SET NAMES utf8');
mysql_select_db(DB, $db_);

(Note the mysql_query('SET NAMES utf8'); above)

// Other db connect info here

// To be continued
Howto override php.ini through htaccess


Monday, January 14, 2008

MySQL Access Denied Error

Before dumping a list of databases between different MySQL servers, be sure to exclude the MySQL database.

Assuming you are importing the dump from Server A to Server B, the database imports the password from Server A onto B. There could be a few other settings that could be messed up too in the MySQL db if the versions are different.

To resolve this issue, set the MySQL password /etc/my.cnf on Server B to the one that was set on Server A. Restart the MySQL daemon.

To prevent this issue from occurring, specify the --databases parameter and explicitly mention the database names to be included before the process is executed.

Tuesday, January 01, 2008

Queen Elizabeth - The Christmas Broadcast 1957

Interesting how a message from Queen Elizabeth back in 1957 continues to hold true today.

Minute 2:33/7:56
... trouble is caused when honesty is counted as foolishness
... loose the trust of the world if we abandon fundamental principles
... it has always been difficult to build and destroy. To build and cherish is much more difficult.