Monday, November 16, 2009

What I love about Thunderbird 3

At the time of writing, I have been using Thunderbird 3 Beta 4. It does have some bugs, but overall it has very good and important features.

1. Thunderbird has now officially replaced Opera as my RSS reader. Its easy to import existing RSS feeds using Add Account -> Blogs and News Feeds --> Finish. Account Settings -> Blogs and News Feeds --> Manage Subscriptions --> Import XML or OPML

2. While browsing a website using Firefox, you can simply ask Firefox to open the RSS in Thunderbird instead of its Live Bookmarks or Google Reader.

3. I use Thunderbird's Favorite folders option more than the Smart Folders. In this way, I get to see only the folders (Inbox@gmail1, Inbox@gmail2) that I want, across multiple gmail accounts.

4. Over a period of time, while reading RSS one tends to have several 'ToDo' tags. It is easy to create a 'Search' folder called ToDo that will show all ToDo RSS's in one place.
Right Click RSS account --> Search -> (Add rule that says 'Tags | contains | To Do' -> Search. Then Save as Search Folder. Enter the required folder and other details and you are done. I then add this search folder to my Favorite list. Note, I always use the Favorite Folders view.

5. While reading an email or RSS news item, pressing space bar takes you to the next unread item in the next folder/account. Pretty handy when your mind is in reading mode.

6. I get to share the same Thunderbird profile across my Ubuntu and Windows. No duplicate mailboxes, no waste of disk space. All settings are shared! This has to be THE best thing about mozilla (works for Firefox too)

- Message Filter function is still buggy as of Thunderbird 3 b4, but I don't use it anyways

Tip: To see and manage your existing Feed subscribtions, simply right click on any existing RSS feed in your Thunderbird and Subscribe. This will save some time. Conventionally, you would use Account Settings --> RSS account --> Manage Subscriptions.

Sunday, October 25, 2009

Copy Orkut Birthdays to Google calendar and Outlook

Till date, Google has not added support to export Orkut Birthday calendar to the personal calendar (Google Calendar) and hence there is no easy way to have the same in Outlook.

Here is a manual way of copying Orkut Birthdays to Google Calendar and Outlook.
(Note, this method allows you to copy only one birthday event at a time to your google calendar)

1. (Skip this step if you already see Orkut Birthday calendar in your Google Calendar) Login to Orkut and add your orkut friend's birthdays to Google Calendar. How to?
2. In Google Calendar, click on the birthday event you wish to copy.
3. If you get a popup, select 'copy to calendar' option. If not, and you get the event details, under 'More Actions', choose the option 'Copy to yourname/emailid'. This will open the event details for editing.
4. Change the 'Repeats' option to yearly if preferred. Edit Reminder options as required.
5. Click Save. The entry will be added to your Google calendar.
6. Now sync Google calendar with Outlook, see how to.

Monday, October 19, 2009

How I upgraded the firmware on my Nokia E51 (against Nokia's wishes)

I bought a Nokia E51 in India with firmware version v200.34.36. For reasons best known only to Nokia; firmware updates are very slow to reach this part of the world. If I use Nokia software updater, it would politely tell me that my current firmware is already the latest available. However, The latest version of firmware for other regions is v400.34.011, hence I decided to give it a try.

Step 1: Backup phone and Memory card data. I backed up using two methods.
1a. (PC Suite mode) Backed up the complete phone using Nokia PC Suite backup feature. (Handy if something goes wrong while updating firmware and I want to revert back all settings and changes)
2a. (Removable drive mode) Manually copied the contents of Phone memory and Memory card to a folder on my Laptop. (Handy if I wish to restore some apps or documents manually. After all you really don't want to copy all the old settings again!)

Step 2: I downloaded the Nemesis Service Suite (NSS) Beta 1.0.38.15 from here.
I downloaded the Nokia Software Updater 1.8.10 from here.
I already had the latest version of PC Suite 7.1.30.9

Step 3: Now this is what worked for me. Disconnected Phone from PC Suite.
Uninstalled Nokia PC Suite (and Software Updater, since I already had it)
Restarted the PC.

Step 4: Install NSS using Virtual USB as the option.
Install Nokia PC Suite
Install Nokia Software Updater

Step 5: Exited out of Nokia PC Suite at this point (right clicked on tray icon and Exit).
Start NSS. Connected the phone to laptop in PC Suite mode (important to select PC suite mode on phone. Did not start PC suite at this point)

Step 6: In NSS, click on the Scan option present on top right corner of screen. Once successful, clicked on the Phone Info icon . Then under 'Production Data Edit', clicked the Read button and NSS was able to read my phone contents.

Step 7: I used this APAC product code 0552352. Clicked Enable corresponding to Product Code and entered this code. Then clicked Write. Status at the bottom left confirmed that it was successful. (no other message pops up!)
Closed NSS and started PC Suite.

Step 8: Clicked Software Updater and proceeded with firmware upgrade. This time the updater showed that a new firmware version is available. The further steps went smoothly. Followed on screen instructions.

Step 9: Restored messages, contacts, calendar, notes and user files using my backup copy. Did not restore 'Settings' since I think its unwise to restore settings.

Now, I have the shiny new firmware and with nice updates!

Monday, September 28, 2009

Nautilus - Expand/Collapse directory tree with keyboard

I use Ubuntu 9.04 and generally prefer to use the keyboard while navigating through directories in Nautilus.

Discovered a nice feature today.
Quite handy if you don't want to move away from the current view and just see the contents of current directory.

To open/expand a directory tree, use <Shift> + <Right key>
To close/collapse a directory tree, use <Shift> + <Left key>


This trick also works in the Tree pane/Side bar (F9)

Thursday, September 10, 2009

Fixing Eclipse J2ME emulator in Ubuntu after Java upgrade

Java upgrade in Ubuntu tend to cause minor headaches sometimes.
Like today; the package manager upgraded Java on my machine, and suddenly my J2ME project(midlet) won't launch.
My Sun Wireless Toolkit (launched from eclipse) which was pointing to the previous version which no longer exists on the system.

Here is a simple fix.
Traverse to the {WTK installation path}/bin directory
Open the emulator.sh (on Ubuntu) in Text editor. Here I found the hardcoded JRE path
javapathtowtk=/usr/lib/jvm/java-6-sun-1.6.0.16/bin/

I updated the above variable and then my J2ME project in eclipse started working.

Sunday, August 23, 2009

Setting up the tools for J2ME app development

Aim: To setup tools and environment for J2ME application development
My OS: Ubuntu jaunty

JRE

1. Download and install JRE (Java Runtime Environment) using the Synaptic Package Manager. The JRE is required for Eclipse to run.

Eclipse

2. Download and install Eclipse. I use this Eclipse Ganymede package.
Make sure you are able to launch Eclipse after it has been downloaded and extracted.
If Eclipse won't start with messages like 'Widget disposed too early', try adding this line to eclipse.ini
-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner
this worked for me! BTW, eclipse log is located at /.metadata/.log
.metadata is a hidden folder!

Sun WTK

3. Download and install the Wireless Tool Kit. Although, Sun now has a Java ME SDK 3.0, it is currently available only for Windows. I use the earlier Sun Java Wireless Toolkit 2.5.2. Extract the contents to a suitable directory.

EclipseME plugin
4. Next we proceed to download the plugin to help us develop the J2ME midlets. Although the EclipseME project has graduated and is now called Eclipse Mobile Tools for Java (MTJ), I did face some problems with it on my Ubuntu machine. Problems were especially related to Proguard not being able to find my inner classes and throwing NoClassDefFound errors during Obfuscation. Hence I decided to switch back to the tried and tested EclipseME 1.7.9 plugin.
To install, use Eclipse's Software Updates feature and add the site http://www.eclipseme.org/updates


Proceed with the installation. Restart Eclipse if asked to. After successful installation, you should be able to see a new 'J2ME' option under Eclipse -> Window -> Preferences

Proguard
5. This is a must if you wish to optimize the resulting jar and also make sure nobody copies your code (Obfuscate). I downloaded the latest Proguard4.4.tar.gz version. Extract it to a suitable directory.

Antenna Eclipse Plugin

6. Add the plugin update site http://antenna.sf.net/update via Eclipse's Software Updates feature and install it.


Proceed to install the plugin. Restart Eclipse if asked to.
Installation guide is here.

You can also download the Antenna Jar
This is required if you wish to build using Ant (build.xml) How to set it up and use it will be covered in another post.

Wiring it all!

Browse to Eclipse -> Window -> Preferences -> J2ME (Left side option)
Set the Antenna JAR and WTK Root properties
Antenna JAR (antenna.preprocessor.v2_1.7.7.jar) will be located under Eclipse/plugins directory
WTK Root is where you extracted the contents in Step 3 above.


Import the Sun WTK Emulation devices in Eclipse

Open Eclipse -> Window -> Preferences -> J2ME (Left side option) -> Device Management
Click Import
In the Import Devices dialog that pops up, browse for the WTK/bin directory.
Click Refresh. You should see this.

Click Finish

On Preferences screen, Click J2ME -> Packaging -> Obfuscation and set the Proguard Root Directory.
Set it to the path where you extracted Proguard contents in step 5 above. Mine is /media/sda5/Dev/proguard4.4

All Done!

Now import an existing project or create a dummy project.
Right click on the project and enable 'Antenna Preprocessor'.
Now if you see the Project Properties (Alt-Enter), you should see a new option 'Antenna preprocessor' under it.



JMUnit
If you wish to write Test cases, you should consider adding JMUnit jar to your project classpath.

A nice guide on using JMUnit is here

You are all set to start J2ME programming.
Next, I ll post on how to actually start using these tools and make the most out of it.

Saturday, August 15, 2009

J2ME programming tools

In my experience, these are the tools required for developing mobile applications (midlets).

Eclipse IDE. The latest is Eclipse Galileo. I use Eclipse Ganymede.
Mobile Java Tools plugin for Eclipse.
Sun Java Wireless Toolkit The latest is Java ME SDK 3.0, but I use WTK 2.5.2 separately
Antenna Preprocessor

In another post, I ll be talking about how to use these tools to develop and application.

Update - MJT experience :(
Recent experience with Mobile Java Tools was not good. I faced problems with unnecessary NoClassDefFound errors on inner classes, probably something to do with the preverifier and obfuscator (proguard). So I decided to switch back to the tried and tested EclipseME 1.7.9 Plugin

Update - More tools:
Proguard (latest is v4.4) - Obfuscator, preverifier etc to safeguard and optimize the code
JMUnit - for unit testing (my research tells me that JMUnit is better than j2meunit, also at sourceforge)

Tuesday, August 11, 2009

Reinstall Windows on existing Linux partition

What I wanted to do:
- Remove logical partitions
- Cleanly reinstall Windows XP
- Resize and merge existing logical partitions
- Make sure Ubuntu is unaffected (Grub)

Note #1. Partition magic will not help, if you attempt to resize/move an existing partition due to the presence of the linux partition.

Note #2. Grub is my boot loader. I did not note down the partition on which my linux is installed and kind of regretted later. Note down the partition information when you attempt to boot into Ubuntu ..something like 'Booting from hd (0,5)' etc

Here is what I did.

Task #1: Remove logical partition
As I said earlier, Partition magic will not help in this regard due to the presence of the Linux partition.
I booted using the Windows XP setup CD and using the partition utility, removed the logical partitions that I did not want.

Task #2: Install Windows
After the partitions were removed, I proceeded to install Windows XP on my newly formatted partition. Note, my Linux partition was untouched all this while.

Now, once XP was installed, the XP boot manager takes over and I could not see my Linux boot options. Now the task was to restore Grub as the boot manager.

Task #3: Resize partitions
Now I restarted the PC and booted using the Live CD.
Ubuntu has a Partition manager that ships with the Live CD.
Using that, I was able to resize the partitions

Task #4: Restore Grub
Once inside, In a terminal window, I used the following commands:

a. sudo grub
b. root hd(0,5)
(you may have noticed where Grub loads from as mentioned in Note#2 above)
if not, here is what can be done to find where Grub was previously installed
b1. find /boot/grub/stage1

c. setup hd(0)
d. quit

All done!
I now restarted the PC without the Live CD and was able to see the Grub menu with Ubuntu and Windows XP OS choices.

Thursday, July 9, 2009

Configure Eclipse and MySQL on Ubuntu Jaunty

I assume that Eclipse and MySQL has already been installed. I use Eclipse Ganymede (3.4.2) and MySQL 3.5.1. For installing MySQL on Ubuntu, see my previous post.

1. Download MySQL JDBC Connector (mysql-connector-java-5.1.7.zip/jar)

Choose a mirror and download from here

Extract the contents of the jar/zip to a folder.

2. In Eclipse, click Menu -> Window -> Show View -> Other. Expand the 'Data Management' option and select 'Data Source Explorer'.

Click OK. The Data Source Explorer tab will open.

3. In Data Source Explorer, right click 'Database Connections' folder and click New.

The 'New Connection Profile' dialog will open. Select 'MySQL' and click Next.

Most likely your Drivers drop down will be empty. If yes, then it is time to create a new Driver definition.

4. Click on the small 'New Driver Definition' icon next to the drop down.

5. In the dialog that opens, select MySQL JDBC Driver v5.1. 

6. Click Jar/List tab. You need to add the MySQL JDBC connector jar that you downloaded and extracted in step 1 above. Click Add JAR/Zip and select the mysql-connector-java-5.1.7.jar that you extracted. Click OK

7. Change the Database from 'database' to 'mysql' in both Database and URL fields.

8. Enter the password that you had provided during MySQL installation.

9. Click Test Connection and you should see a ping succeeded dialog.

10. Click Finish. Your database connection is successfully created. If you Expand the connection tree, you can see the database and tables etc.

Happy querying!

Install and setup MySQL on Ubuntu Jaunty

Here is how I installed MySQL 5.1 Community Edition on Ubuntu Jaunty:

1. Install MySQL

Goto Synaptic Package Manager and in quick search type 'mysql-server-5.1' (without quotes). From the list that will be provided, choose to install package with name mysql-server-5.1. It will show you all the dependencies and proceed to install.

Alternately you can use apt-get command.

sudo apt-get install mysql-server-5.1

1a. During the installation it will prompt for a password. Enter password of your choice.

1b. Confirm the password. Make sure installation completes successfully

2. Test the installation

To test the installation, type the following in Terminal.

mysql --user=root --password=yourpassword

"Welcome to the MySQL monitor. Commands end with ; or \ g.
Your MySQL connection id is 53
Server version: 5.1.31-1ubuntu2 (Ubuntu)

Type 'help;' or '\ h' for help. Type '\ c' to clear the buffer."

After this you should be able to see the prompt change to

mysql>

3. Use the mysql database.

mysql> use mysql;

"Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed"

4. Now see the tables present in the database

mysql> show tables;

This will display all the tables present in the database.

MySQL has been successfully installed.

In the next post I ll show how I configured Eclipse to talk to MySQL!

Sunday, July 5, 2009

Ubuntu Update Manager - Check/Uncheck All!

By default, the Ubuntu Update manager (Jaunty in my case), always has all the available updates checked (selected). But sometimes if I wish to select only a few of them, then unselecting the others was a real pain.

Here are two nice options that I found to Check All or Uncheck All the updates.

These options are available if you right-click on the checkmark/checkbox in the Update manager.

Handy!

Thursday, June 25, 2009

Customize Nautilus Shortcut Keys

Today, I had this itch to customize the shortcut keys in my Ubuntu Jaunty --> Nautilus.

I wanted to assign the Alt-D key to select the location bar. Ctrl-L is the default option, but I find Alt-D easier on the fingers, especially when all fingers are resting on the correct keys on the keyboard! I also use Alt-D in Opera/Firefox to highlight the address in the address bar.

Unfortunately, The 'Keyboard Shortcuts' in System --> Preferences does not have any option for Nautilus.

A quick search landed me here and Wolki had a nice suggestion. It worked like a charm.

So to change Ctrl-L option to Alt-D, here is what needs to be done:

1. In Ubuntu Jaunty, Go to System --> Preferences --> Appearance --> Interface.

2. Enable the option 'Editable menu shortcut keys'

This is what Ubuntu Help says about this option:

"Editable menu shortcut keys

  Selecting this option allows you to define new keyboard shortcuts for menu items.

  To change an application shortcut key, open the menu, and with the mouse pointer on the menu item you wish to change, press the new combination of keys. To remove a shortcut key, press Backspace or Delete.

  When using this feature, you will not be warned if assigning a new shortcut key to a command also removes it from another command.

  There is no way to restore the original, default keyboard shortcut for a command.

  This feature does not maintain shortcuts that are normally common to all applications, such as Ctrl+C for Copy. This may lead to inconsistencies in your GNOME applications."

3. Now open Nautilus, click 'Go' menu and highlight the 'Location...' option by moving mouse pointer over it.

4. At this point, press Alt-D on the keyboard. The Ctrl-L shortcut will be replaced by Alt-D!

5. As a precaution, turn off the 'Editable menu shortcut keys' option.

6. If the shortcut does not work immediately, log out and log back in. (need not restart)

Disclaimer: Read the warnings in the above help extract carefully. You should know what you are doing!

Amarok tip on Ubuntu

Ok, this is neat. I have been using Amarok 2.0.2 for sometime on Ubuntu, but just discovered this today.

If you drag a song from 'Collection' to either the 'Current Track Info' window or 'Lyrics' window (and hold it there for couple of seconds), it displays some good options to 'Queue Track' or 'More' options to 'Edit Track details'. 

Holding down the dragged song on the 'More' option (also hold it for couple of second) also gives some more options!

See snapshots:

Wednesday, June 24, 2009

Creating tiny urls easily!

I wanted a quick way of creating tiny urls for either posting on twitter or just to include in my emails. 

I somehow did not like the fancy toolbar buttons or java scripts or add ons. I like a clean browser.

So using my favourite Opera 9.64 this is how I achived my goal.

1. I jumped to the tinyurl website. Link

You can use this with any url shortening site. I just like tiny!

2. Then I right clicked on the the textbox (left of the Make TinyURL button) and clicked 'Create Search'

3. A search engine dialog popped up. In the keyword textbox, I entered 'tiny'. You can use any word even 't', but 'tiny' is easy to remember. Click OK

4. Now to create a tiny URL, I just copy that looong URL and type

tiny   and this immediately creates a short URL and directs to the tinyurl.com page.

Here address bar shortcut like Alt-D helps to select the current URL (if thats the long URL you wanted to shorten). Or sometimes, if I am already on the page that needs to be shortened, I use the following sequence:

1. Click Alt-D (highlight the address)

2. Click Home

3. type 'tiny ' (with space at end) and hit enter! Thats it.

Now thats the shortest and easiest way to create shortened URLs!

No plugins, no javascript!

Ubuntu and the LCD projector!

I had a presentation in office and thought of using Ubuntu for it. But I was not sure if Ubuntu will behave well if I connect to the LCD projector. Didn't wanna take a chance.

Beforehand, I had done some research on connecting Ubuntu based laptop to the LCD projector and the problems that may arise.

This tip worked and helped me connect the Laptop running Ubuntu to the LCD projector.

1. Start the LCD projector (obviously!)

2. Start Ubuntu and log in with your username

3. Connect the projector to your laptop. Now like me, chances are, you may not see anything on the projector screen.

4. Now, log out (using ctrl-bkspace, if it works). Need not restart the laptop.

5. Log back in and you should see your Ubuntu desktop on the big screen!

Ubuntu, Openoffice, AnyRemote!

So I had this presentation in office and I thought of 'showcasing' ubuntu!

Had some trouble getting anyRemote to work on Ubuntu with Nokia E51, but eventually met with success. Initially I tried to download the .gz files from sourceforge.net and compile them myself. After resolving a few compiler dependencies, i could, configure, make and install. But I was still clueless and thought 'nothing seem to happen'

Eventually this is what worked well for me. And darn pretty simple too.

Make sure your Open office Impress presentation is loaded.

1. I downloaded and installed the java client for mobiles. Link

2. Instead of using the .gz files from sourceforge, I installed anyremote from the ubuntu repositories.

So I searched the Synaptic Package manager for gAnyRemote and installed it.

3. Start ganyremote on Ubuntu

In a terminal, type ganyremote

I got a message, saying 'Bluetooth service is not active', I ignored it.

ganyremote starts and an icon is visible in the top right panel.

4.Click on the icon and it will display a window with a list of applications.

5. I clicked on Open Office Impress and clicked 'Start'. The status changed to 'Managed'

6. Then I launced anyremote on mobile (Nokia E51).

7. Then from the options menu, I clicked 'Enter BT address'.

8. You need to know your PC's bluetooth address. For this type hcitool dev  in any Ubuntu terminal. Note down the 12 char address. Enter this address in your mobile (option 7 above). The format will be something like this btspp://0008F4163049:19 (the address in bold will be your PC's bluetooth address. Rest remains the same)

9. Now I switched to the impress presentation and using the keypad on mobile, I was able to control the presentation!

Thursday, February 26, 2009

Opera quick search

I have 3 browsers on my machine. Unfortunately not all of them are capable of working with all sites. Though I must admit that Opera has its own charm. I like the ability to quickly search my history.

To do so..

Type 'h' (without quotes) in the browser followed by the keyword and hit enter.

Opera will automatically list all your historical items matching the keyword.

Similarly for finding something on the current web page, you can use 'f'!

Wednesday, February 18, 2009

Log4j, Websphere - Print server or host name to application log

My project runs on Websphere server and uses a cluster of two servers. Both the servers log to the same application log file. After a bad production issue, we found it necessary to log the server name to the application log file, so as to be able to track activity on individual servers. Since the code is already in production, I didn't want to change it. Log4j documentation didnt help, and I didn't wish to dwelve into MDC.

Here is a simple trick that worked for me.

Websphere has an inbuilt variable WAS_SERVER_NAME, which basically has the name of the server (e.g. Server1, Server2 etc).

1. Using the Websphere Admin Console , I created a JVM Custom property.

Key = WAS_SERVER_NAME

Value = ${WAS_SERVER_NAME}

2. I referred the above property in my log4j.properties file.

log4j.appender.X.layout.conversionPattern=%d %-5p [%C] ${WAS_SERVER_NAME} %m%n

(The text in bold is the extra word that I added)

Now log4j prints the server name in the application log file.

This idea can be used to print any extra information, like host name etc!