HTC Dream Reviewed

Rogers is bringing the HTC Dream to Canada next month. As I mentioned in HTC Magic Reviewed I can not wait to get my hands on the Google Android operating system.

The HTC Dream is exactly the same as the T-Mobile G1. According to an article by Rob Jackson (HTC Dream vs. T-Mobile G1)T-Mobile rebranded the HTC Dream as the T-Mobile G1 to "cash in on the idea of the '1rst Google Phone' - or G1". Check out the HTC Dream specifications versus the T-Mobile G1.

The reviews of the HTC Dream include quotes such as:

  • "The G1(HTC Dream) isn’t going to blow anyone’s mind right out of the gate." - Engadet
  • "Unfortunately the Dream can't decide whether it's a touchscreen device or not." - The Sydney Morning Herald
  • "Better Wait for HTC Magic, Forget HTC Dream" - wassup

Enough said. The HTC Magic is a better choice.

HTC Magic Reviewed

The HTC Magic is coming to Canada next month. I am excited by this new "smart phone" (aka mini-computer) and can't wait to get my hands on the Google Android operating system. All reviews are positive and position the HTC Magic as an open-source competitor to Apple's iPhone.

This phone is running Google Android 1.5 (nicknamed Cupcake) and boasts many improvements. For a detailed and informative review check out this HTC Magic review. For the technically inclined here are the HTC Magic Specifications.

Personally I would rather wait for some more phone choices before committing to a smart-phone and a plan. If I had to choose now I would take the HTC Magic over the HTC Dream (aka T-Mobile G1, see HTC Dream Reviewed).

Debugging PHP Tip: Using the __FILE__ Magic Constant

Recently I came into a situation where a former employee had used a gateway marshaling concept and created multiple directories with the same file names (eg. www/admin/index.php. www/admin_v2/index.php). Debugging the code became problematic due to long filenames when using __FILE__. The long file paths were polluting the debug output and making it difficult to read.

I wrote a little function to return the file path based on a root directory specification. For instance if the script filename (aka __FILE__) is '/really/long/and/hard/to/read/path/www/index.php' the function will return 'www/index.php'.

This is useful for debugging calls (I use PEAR::Log) when using techniques such as:

$thisFile = getFile(__FILE__);
$log->debug($thisFile.': initializing page');

module-alsa-sink.c: Error opening PCM device front:0: Device or resource busy

I ran into an problem with sound on a Dell Inspiron 518 workstation running Ubuntu 8.04. I had paused Amarok and then viewed a Flash video on youtube. When I went to play Amarok again Amarok stalled and hung there. I had to kill the amarok process to shut it down. The syslog gave up:

pulseaudio[29142]: module-alsa-sink.c: Error opening PCM device front:0: Device or resource busy

MySQL Error: Specified key was too long; max key length is 1000 bytes

When updating a MySQL database table to use UTF-8 I came across an error:

ERROR 1071 (42000) at line 1: Specified key was too long; max key length is 1000 bytes

Initial research indicates that the maximum key size in MySQL is 1000 bytes. Given that latin1 uses one (1) byte per character and UTF-8 uses three (3) bytes per character some indexes will exceed the 1000 byte limit. This accounts for the generated error when converting tables with large or compound indexes from latin1 to UTF8 encoding.

According to the MySQL bug tracker this issue has yet to be resolved. Currently the only solution is to limit indexing on UTF-8 encoded tables or use latin1 instead. Not the best of choices to say the least.

Migrating MySQL to UTF-8 encoding

While developing a content management system (CMS) using default MySQL settings an issue came to light in regards to UTF-8 encoding. Clients were sending in documents in Microsoft Word format that were encoded with UTF-8. When the data was copied from the document and pasted into the CMS WYSIWYG editor strange characters would be displayed after saving the document.

A second issue was identified where exported MySQL tables that contained UTF-8 encoded characters were being not being read correctly by Debian. Note that I am using an old installation of Debian (fully updated of course) that was rolled out before widespread adoption of UTF-8. Newer installations may already have UTF-8 enabled by default.

The goals of this HOWTO are as follows:

  1. set newly created tables in MySQL to use UTF-8 encoding
  2. convert existing MySQL tables to UTF-8
  3. set default environment (command line) encoding to use UTF-8

Eclipse OutOfMemoryError

I was getting OutOfMemoryErrors when running Eclipse with multiple projects open. To solve the problem I added the following arguments to my quicklaunch:

eclipse -vmargs -Xms512m -Xmx1024m -Xss2m -XX:MaxPermSize=256m

Reference

-Xms

Specify the initial size, in bytes, of the memory allocation pool. This value must be a multiple of 1024 greater than 1MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is chosen at runtime based on system configuration.

-Xmx

Automated MySQL Backups

The HOWTO will show how to automate the backup of your local MySQL server on a daily basis. The backup process uses a bash script and the local logrotate functionality to achieve an automated systems. The backup is processed daily via cron (see /etc/cron.daily/logrotate).

While this HOWTO is written for a local development environment it could easily by modified for remote multi-server environments.

Step1: Create the backup script

Create a file at /usr/local/sbin/backup_mysql.sh using your favorite text editor. I use joe:

Ubuntu, Eclipse 3.4 (Ganymede), and Subclipse 1.4.4 Issue

I recently downloaded and installed the latest version of Eclipse (3.4.0 aka Ganymede) and ran into some issues when trying to get Subclipse (plugin for subversion) up and running.

Initially I was getting the following error message when accessing Windows->Preferences->Team->SVN->SVN Interface dropdown:

JavaHL (JNI) Not Available

When attempting to view a repository via the "SVN Repository Exploring" perspective I got a different error message:

Unable to load default SVN client

Enable Auto Properties (auto-props) for Subversion (Subclipse) in Eclipse

Setting auto properties (auto-props) allows for specific files to have unique properties applied such as mime types (svn:mime-type), end of line (svn:eol-style), and my personal favorite: svn:keywords.

I use svn:keywords to automatically update the following fields that I store at the top of each code file: "LastChangedDate LastChangedRevision LastChangedBy Id". Each time I commit a file relevant data is updated on the file itself that can tell me who last committed changes and when they did. As well the version number is updated.

Syndicate content