David R. Heffelfinger

Wednesday Nov 19, 2008

Installing Amazon MP3 Downloader under Ubuntu 64 bit

Being a child of the 80's, I love listening to the music I grew up with. Unfortunately, it seems most of the 80's compilation CDs out there made a conscious effort to find the suckiest songs of the 80's and put them together in a CD. It seemed like the really good music from that era had just but disappeared.

Today while browsing Amazon I ran into some MP3 downloads for some songs I hadn't heard in about 20 years, the good stuff that I thought had dissappeared, I, of course, became very eager to add these songs to my collection.

When downloading individual songs in Amazon, no special software is needed, however, the Amazon MP3 downloader is needed to download complete albums.

They have a few Linux versions for Fedora, Debian, OpenSUSE aand Ubuntu. The only version of Ubuntu they support is Gutsy Gibbon, which is two versions behind the latest, Intrepid Ibex.

Feeling brave, I tried to install the Ubuntu Gutsy Gibbon Amazon MP3 Downloader under Intrepid Ibex, unfortunately the installer failed, telling me that the architecture was wrong. The deb package available on Amazon is for i386, and I run the 64 bit version of Ubuntu Linux.

I googled around to see if there was a way to install 32 bit packages under 64 bit Ubuntu, I ran into getlibs.

getlibs is a script that downloads any missing libraries for any installed package.

In summary, what I had to do to install the Amazon MP3 Downloader under 64 bit Ubuntu was to get getlibs from http://www.boundlesssupremacy.com/Cappy/getlibs/getlibs-all.deb. Simply clicking on the link results in the package opening in GDebi, it should install without issues.

Once GDebi is installed, the Amazon MP3 Downloader needs to be installed, passing a parameter to ignore the architecture difference:

sudo dpkg -i --force-architecture amazonmp3.deb

This will install the package, it will be placed under /usr/bin/amazonmp3, however at this time it won't run properly because of missing libraries. In order to get the libraries, we need to run the getlibs script:

sudo getlibs /usr/bin/amazonmp3

At this point the application should be "good to go" and able to download MP3 albums from Amazon MP3 Downloads.

NetBeans 6.5 Final Now Available

It has come to my attention that NetBeans 6.5 final is now available.

It can be downloaded from the NetBeans web site.

If you would like to learn the ins and outs of enterprise Java development, my book, Java EE 5 Development with NetBeans 6, may help.

Sunday Nov 16, 2008

Streaming Internet Radio on BlackBerry

For a few years, I have been listening to internet streaming radio with Shoutcast, there are several programs in Linux that I can use to listen to the streams, I currently use Rhythmbox, but in the past I have used Audacious and XMMS, they all work great to listen to internet streaming radio on my laptop.

I have been wanting to be able to listen to internet radio on my BlackBerry for a while, but I hadn't been able to find any software to do it. I had seen some references to Radio Bee, but I hadn't been able to get it to work.

Yesterday I decided to look once again, and I bumped into FlyCast, I downloaded it over the air, and it installed flawlessly. The first time I ran it, it asked me to register by providing my email address. Once I did that I was able to run it, and lo and behold, I was listening to streaming internet radio on my BlackBerry Bold!

So far I have only used it with a WiFi connection, and it works great, very little or no buffering. I have yet to try it under 3G or edge, so I have yet to see how well it works when a WiFi connection is not available.

FlyCast's web site does not specify if the software is free, if there is a trial period or if you have to register. I was expecting some kind of nag screen or a point where it would ask me for my credit card information, but so far it hasn't happened, although I've only been using FlyCast for two days. When most songs play, the album cover for the song is displayed on the BlackBerry screen, clicking on it with the trackball takes you to the Amazon site and gives you the opportunity to buy the CD. I assume that is how FlyCast will make its money, by being an Amazon affiliate.

Saturday Nov 15, 2008

Blackberry Bold and Google Sync Gotcha

Like I mentioned recently, I just upgraded my old BlackBerry to a BlackBerry bold.

One very nice application I had in my old BlackBerry is Google Sync, it allows seamless synchronization between the BlackBerry calendar and Google calendar.

Of course, one of the first things I did when I got my new BlackBerry was to install Google Sync. Well, yesterday I added a new appointment to Google calendar, and when I check the appointment on my BlackBerry Bold I noticed that the time for the appointment is wrong, it is set to 5 hours later than the correct time.

Turns out that the BlackBerry Bold comes preset to Greenwich Mean Time (GMT), but of course I am not in that timezone, instead I am on Eastern Standard Time (EST). When synchronizing between Google Calendar and the BlackBerry bold, the timezone conversion was done automatically.

Once I found out what the issue was the solution was trivial, set up the timezone in the BlackBerry bold to EST by going to Settings | Options | Date/Time and setting the correct time zone.

Thursday Nov 13, 2008

Synchronizing Contacts Between Two Blackberries Under Ubuntu Intrepid

I just upgraded my old Blackberry to a Blackberry Bold. I of course wanted to transfer all my old contacts to my new device. I transferred all my contacts to the sim card and installed the sim card in the new phone, however that is a less than ideal solution since the sim card splits the contacts, that is, if a contact has home, phone and work numbers, that one contact appears as three different contacts in the sim card. Also, email addresses are lost when using this technique.

It is no secret that I am a Linux user, however I do keep a spare Windows partition around for the rare cases that I need to use Windows. Today was one of those days.

Blackberries come bundled with Windows software to install applications, synchronize with outlook, perform backups, so on and so forth. I wanted to run the Blackberry software to transfer the address book from my old device to my new Bold.

I booted to Windows vista and ran the installer, while it was running a million security updates and popups were showing up, and windows kept asking me to reboot my laptop. I refused to reboot as I simply wanted to transfer my addressbook to my new bold. Once the Blackberry desktop installer completed, lo and behold, it asked me to reboot. I gave in and rebooted, only to have Windows Vista prevent me from logging in again once it came back up.

When I tried to log in, a Windows Activation dialog window showed up, complaining about the license store containing inconsistent data or something like that. The dialog box had a link to contact HP, my laptop's manufacturer. I clicked on it and I was able to chat with HP customer support. After a lot of back and forth what HP told me is that I would have to do a full system restore, which I refuse to do since it would wipe out my Ubuntu Intrepid Ibex installation.

I googled around for a solution to Windows vista preventing me from logging in to no avail. I tried to transfer the addressbook via bluetooth, but for some reason I don't get the option when I select the Bold from my old Blackberry (I do get the option when I select my bluetooth headset, go figure).

At this point I turned my attention to trying to transfer the addressbook using Linux. I had heard of a utility called Barry that may help me with my issue.

I found Ubuntu deb packages here, unfortunately the most recent version they support at this time is Hardy, I saw no packages for intrepid. I felt brave and installed the packages for Hardy under Intrepid, they installed with no obvious issues.

From the list of packages, barrybackup-gui looked promising. I installed it by simply clicking on the link from Firefox and opening the downloaded file directly in GDebi. There were some unresolved dependencies, which at the moment I can't remember exactly, but all the dependencies are listed in the same page. I simply installed the dependencies and tried again, until all dependencies were satisfied (I only had to install two or three dependencies).

At this point I plugged my old Blackberry to one of the USB ports in my laptop, and executed barrybackup, it detected the blackberry, asked me to identify it. At this point I configured barrybackup to backup only the address book by going to Edit | Config, then clicking the configure button.

I only wanted the addressbook, therefore I clicked "Deselect All", followed by activating the "Address Book" database. I OK'ed my way out of there and clicked on "Backup". After a couple of seconds, I had an addressbook backup in my Linux box.

At this point I unplugged my old blackberry from the USB port, plugged my new one and re-ran barrybackup, it recognized the new device and asked me to identify it. After doing so I clicked restore and it started copying my backups to the bold (word to the wise, it deletes all entries in the existing addressbook before restoring). Unfortunately there was a problem and it only restored a partial number of the entries in my addressbook.

It left out about 20 or so entries, luckily a lot of those I don't need anymore, therefore I ended up having to enter only a few by hand.

Although the Ubuntu/Barry combination wasn't perfect, it sure was a better solution to my problem than Windows vista with the official Blackberry desktop software

Monday Nov 10, 2008

Installing and Configuring a New MySQL Installation on Ubuntu

I recently got involved in a project that uses MySQL as its RDBMS. I am not a DBA, nor I pretend to be, but I wanted to set up a local MySQL database on my Ubuntu 8.10 Intrepid Ibex laptop.

I ran into some issues that were primarily because of my lack of experience installing or administering MySQL, I assume others trying to do the same will run into the same issues, therefore I decided to write this entry recording what I had to do to get MySQL going for the benefits of others (and possibly some time in the future I might forget the solutions my issues, therefore I can refer to this entry myself if I ever need to setup MySQL again).

The first problem I ran into was that MySQL does not show up in the "Add/Remove Applications" GUI tool, sure there are MySQL clients, but the RDBMS itself is nowhere to be found.

I tried "sudo apt-get mysql" and it turned out there was no package mysql to be installed, at this point I started to suspect that the Desktop version of Ubuntu I have does not include MySQL, not even in the repositories.

Luckily I turned out to be wrong, after some research I found out that the correct package to install is mysql-server, a "sudo apt-get mysql-server" took care of installing MySQL.

Creating a new database worked without issue. I issued the following query to create the database:

CREATE DATABASE somedatabase;

It worked without issues.

The next thing I wanted to do was to create a regular, non administrator user to use MySQL. Following the instructions at the MySQL 5.0 Reference Manual created a user allright.

The following query:

CREATE USER someuser IDENTIFIED by 'password';

did the trick "someuser" is the new mysql login name for the new user "password" is the user's mysql password. Originally I forgot to enclose the password in single quotes, rookie mistake, I corrected the mistake and the query worked without a problem.

Next I wanted to grant the newly created user all privileges on my newly created database, in order to do so, I issued the following query:

GRANT ALL on 'somedatabase' to 'newuser';

At this point I thought I was "good to go", I attempted to log in to mysql by issuing the following command in the command line:

mysql -u newuser -p

At which point I was prompted for a password, I entered the correct password and was denied access.

After a lot of googling and hair pulling, I found out that my grant statement did not work for "localhost", I had to issue a different grant statement to be able to log in using my newly created user.

The following query did the trick:

GRANT ALL on somedatabase to newuser@localhost

It turns out I had to specify use the username@hostname syntax to be able to log in from the same server where mysql is running.

After doing this I was finally able to log in as my newly created user and create the tables I needed for the application I am working on.

Saturday Nov 08, 2008

JavaRanch Book Promotion Over

The JavaRanch book promotion we had this week for my new book, Java EE 5 Development With NetBeans 6 is now over.

There were many good questions over the week about the book and NetBeans in general.

I would like to personally congratulate all the "Java Ranchers" that won a free copy of the book:

  • renu richard
  • Peter Johnson
  • Rogerio Kioshi
  • Ankit Garg
Congratulations to all!

Monday Nov 03, 2008

Project WebSynergy First Impressions

After blogging about my OpenPortal First Impressions, I was contacted by Eduardo Pelegrí-Llopart, he suggested I take a look at Project WebSynergy, a joint venture between Sun Microsystems and Liferay. Project WebSynergy includes code from Liferay and OpenPortal.

I downloaded it and took it for a spin, here is what I found:

Out of the box, it is much more aesthetically pleasing than OpenPortal

Project WebSynergy Screenshot

Tabs can be created directly from the user interface.

Project Synergy Add Page

Similarly, hovering over a tab results in a little red icon showing up, clicking on it allows the user to delete a tab: Project WebSynergy delete tab

Of course a confirmation dialog asks the user to confirm the deletion of the tab.

Project WebSynergy delete tab confirmation

Project WebSynergy certainly seems to include a lot of built in functionality that may have to be manually coded when using OpenPortal. The advantages I found for OpenPortal was the tight integration it provided with GlassFish and NetBeans.

Although Project WebSynergy is not available from the GlassFish Update center, it can be downloaded bundled with GlassFish. That is what I did to try it out, I'm not sure how easy it would be to deploy it on an existing GlassFish installation.

As of NetBeans, the portlet plugins available in the NetBeans Plugin Manager do not integrate with Project WebSynergy, however, the NetBeans PortalPack 3.0 (milestone 2 is the latest available at the time of writing) does. Simply downloading the plugins from the NetBeans Portal Pack page and installing them on NetBeans (I tried on NB 6.5 RC2) provides the same integration that is provided with OpenPortal by the portlet plugins in the NetBeans Plugin Manager.

All in all my overall impression of Project WebSynergy is favorable, my one concern is that neither the NetBeans plugins nor Project WebSynergy itself are officially released, therefore they cannot be considered stable yet. In my admittedly simple tests they worked fine, but I can't be sure there aren't any issues waiting to be discovered if/when we start using it for real work.

Sunday Nov 02, 2008

NetBeans Book Now Available From Amazon

It has come to my attention that my newly released NetBeans Book is now available through Amazon.

Java EE 5 Development With NetBeans 6 amazon link
Java EE 5 Development With NetBeans 6

It is also available directly from Packt Publishing.

Saturday Nov 01, 2008

Just Finished Installing Ubuntu Intrepid Ibex

I just finished installing Ubuntu Intrepid Ibex on my HP Pavilion dv6810us, which is part of the HP dv6000 series

Installation was fairly straightforward, the only hiccup I found was that wireless networking was not working out of the box, I had to install ndiswrapper, but thankfully this was pretty painless. All I had to do was install ndisgtk

sudo apt-get install ndisgtk

And the Windows XP drivers for its wireless card (identified as 03:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01) by lspci According to this post in the Ubuntu forums, the correct drivers can be found here.

Once I installed ndisgtk and downloaded the windows drivers, all I had to do was point ndisgtk to the .inf file included with the driver, and wireless "just worked", no mucking around with blacklisting drivers or anything like I had to do with previous versions of Ubuntu

I also ran into an issue in which the system would stop booting unless a key (any key) was pressed repeatedly. This issue seems to be affecting several Hewlett Packard (HP) and Compaq laptops.

This issue was reported on launchpad, and I found a workaround there.

The file /boot/grub/menu.lst needs to be edited as root, I use vi as my editor, substitute the following command with your favorite editor:

vi /boot/grub/menu.list

Find the following line:

kernel /boot/vmlinuz-2.6.27-7-generic root=UUID=c877e76e-7e7f-4b47-aec7-6ae28d1ab767 ro quiet splash

and append "acpi=noirq" to it. After doing this the line should look like this:

kernel /boot/vmlinuz-2.6.27-7-generic root=UUID=c877e76e-7e7f-4b47-aec7-6ae28d1ab767 ro quiet splash acpi=noirq

After making the above modifications I was able to boot to Ubuntu Intrepid Ibex normally.

OpenPortal First Impressions

I recently got involved in a project that may need some portlet development. The project is a completely new application to be built from the ground up.

The customer has been using GlassFish as their application server and they are very pleased with it, therefore it just makes sense to continue using it.

The OpenPortal Portlet Container can be installed in GlassFish from its update tool, therefore it made sense to try it out.

GlassFish Update Center

Once installed, I also installed the NetBeans Portal Pack plugin from NetBeans 6.5 RC2, that can be installed directly from the NetBeans Plugin Manager.

NetBeans Plugin Manager

The plugin makes deploying portlets to OpenPortal a breeze, as can be seen in this flash demo.

My main complaint? The default look and feel of the portlet is, let's just say, not the best looking.

OpenPortal default look

As far as I can tell the only way to change the default look is to hack the CSS and JSPs by hand. I noticed the icons to minimize a portlet, maximize it, edit it, etc had transparent backgrounds, therefore it gave me some hope that they should be able to be used when simply changing the background color of the portlet bar. I made a simple modification to the CSS to test this, unfortulately it seems like some of the pink background creeped into the icons.

OpenPortal modified look

Also, as far as I can tell, modifying the available tabs to match our application requirements will involve some customizations of the JSPs included with OpenPortal, there is no tool to create or modify tabs as necessary.

Even with these disadvantages, I'm leaning towards using OpenPortal if we in fact turn out to need portlets for this project. The tight integration with GlassFish and NetBeans is a great advantage and I can live with having to do some CSS and JSP hacking to make it look the way we need it to look.

Friday Oct 31, 2008

Java EE Development With NetBeans 6 has been published

I'm pleased to announce that my latest book, Java EE Development With NetBeans 6 has been published.

Java EE 5 Development With NetBeans 6

The book covers several aspects of Java EE development using NetBeans, such as:

  • Visual Web JSF Development
  • JPA development, including automatic JPA generation from existing database schemas.
  • Automated JSF CRUD application generation from existing JPA entities
  • EJB 3 development, including session and message driven beans.
  • Debugging Java EE applications with the NetBeans debugger
  • Profiling Java EE applications with the NetBeans profiler
  • Additional Java EE Development Topics
I have been working on the book for the past several months, I am glad to finally see the fruits of my labor.

Monday Oct 27, 2008

NetBeans Book Promotion Next Week On JavaRanch


Java EE 5 Development With NetBeans 6

Next week I'll be discussing my new book, Java EE 5 Development With NetBeans 6 in the IDEs, Version Control and other tools of the JavaRanch Big Moose Saloon.

I will be answering questions about the book, Java EE 5 and NetBeans.

See you there!

Saturday Oct 25, 2008

Linux Command Line Tricks

There are several "shells" that can be used in the command line for Linux and Unix systems.

The default shell for most Linux distributions such as Ubuntu and Fedora is called bash, which stands for "Bourne Again Shell", bash is an improved version of the Bourne Shell.

The first feature I would like to mention is tab completion.


  • Typing the first few letters of an executable command, then hitting tab completes the command.
  • After entering an executable command, hitting tab again shows a list of available arguments. Typing the first letter of the argument then hitting tab shows a list of arguments that start with that letter.
  • tab completion is especially useful to change directories, for example, to change directories to /home/david/Documents we could simply type "cd /ho<tab>/da<tab/Do<tab, saving us several keystrokes.

In addition to tab completion, the !$ character combination can be used for substitution, for example, if we were examining a file with the cat, more or less, then we realized we need to edit it, we don't need to type in the file the second time around:

less foo.txt
vi !$

The second line is equivalent to vi foo.txt, the !$ character combination is substituted for the last argument in the previous command.

The !! character combination executes the last command executed, preventing us from having to type it again.

We can view the history of the last several commands entered by using the history command, the output would look something like this:


476 ls
477 ls -larth
478 su
479 history |grep sudo
480 ls
481 ls f*
482 ls -ld fo*
483 cd
484 history

Of course, typical output is much longer, in any case, if we want to re-execute any command in the history, we simply need to enter it's number in the history preceded by an exclamation point, for example, if we wanted to re-execute command number 482, all we would need to enter is:

!482

We can also navigate through the history by simply using the up and down arrows, the up arrow shows the previous command in the history, the down arrow shows the next command in the history.

Knowing these bash shell scripts help us be very proficient with the Unix command line, which I miss dearly when I am using a Windows box (by the way Cygwin provides a bash shell for Unix systems).

Ubuntu Intrepid Ibex is coming, worth the upgrade?

Ubuntu 8.10, also known as Intrepid Ibex, is about to be released soon.

I downloaded the release candidate and installed it under VirtualBox, an open source virtual machine that allows operating systems to be installed inside other host operating systems, similar to VMWare.

My impression of Intrepid is that it is not much different from Hardy Heron, the main difference is that it has updated versions of all the included applications.

Having written three books using OpenOffice.org, my one wish list is an updated version of this free and open source office suite. Unfortunately I found out that Ubuntu Intrepid Ibex does not come with OpenOffice.org 3.0, which is the recently released latest version.

I'm sure OpenOffice.org will end up in the Ubuntu Backports repository, but it feels kind of "hackish" to have to install it that way. It would be nice if OpenOffice.org 3.0 was included by default.

I may end up upgrading anyway, just to get updated versions of other applications, however I don't have that "must update now!" feeling I've had when other versions of Ubuntu were released.