Saturday, July 21, 2012

Mac Outlook 2011 - Export Mac Outlook to Windows Outlook

I was trying to export my Mac Outlook mailbox, and to my disappointment, it can only export to a olm file. In the other hand, Windows Outlook only understand pst file. For some reason, Microsoft does not allow export Mac Outlook and import to Windows Outlook.

So, here is the work around. The idea is create an intermediate IMAP mail client to transfer Mac Outlook email to Windows Outlook email.

Setup IMAP mail account

1. Apply or use an existing IMAP mail account. GMail is one of them and this guide will use GMail as an example.
2. Just follow the wizard to create an GMail account. Log into the account after successful account creation

3. After log in, go to setting page

4. At setting page, go to Forward and POP/IMAP tab, enable IMAP. Then save the configuration

5. Also, near the configuration, click on Configure Instruction link to see how to set up IMAP on outlook. Here is the link. Follow Outlook 2007/2010 to setup IMAP at your Mac Outlook 

Setup Mac Outlook with IMAP mail account

1. Open Mac Outlook, on your menu, go to Tools -> Account

2. At the Account page, click on the + -> E-mail

3. At the Add Email page, type in the account information base on the IMAP setting.

4. If you setup the IMAP account successfully, you will see your account listed on the Mail tab

Create Gmail Label and synchronize to Mac Outlook

1. Go to Gmail web interface, go to Setting -> Labels
2. Create a new label. Make sure the label is show and checkbox of "Show in IMAP" is checked. 



3. Now go to Mac Outlook. Click on Send/Receive button to update IMAP mailbox

Moving Email to IMAP mailbox

1. At Mac Outlook, go to your desire emails, Right click -> Move -> Copy to Folder. 
2. At the Copy page, type your IMAP folder name and click Copy.

3. Click Send/Receive to update your Mac Outlook IMAP folder or go to GMail to refresh the folder. You should see your email being synchronized to IMAP mailbox.

Moving Email from IMAP mailbox to Windows Outlook

1. Following Setup Mac Outlook with IMAP mail account to setup up IMAP at Windows Outlook. They are similar
2. Setup up your normal mail account that you want to import your IMAP mails.
3. Drag your IMAP mail to Windows Outlook Inbox folder.

Friday, July 20, 2012

Samsung Galaxy S3 - Connecting to hidden SSID

For security reason, we hide our WIFI SSID so that other people had a tougher time to find it.

The usual step to connect a hidden SSID is

1. Broadcast the WIFI SSID
2. Let the device scan for WIFI and find the desire SSID
3. Select the discovered SSID, configure the setting and connect to it
4. Go to router admin and hide the SSID

For some reason, Samsung Galaxy S3 won't work this way. If you set up your WIFI setting with auto scanning, it will only work with broadcast SSID. This is true even if you only hide your SSID after you had setup your WIFI with auto scanning.

So, to use hidden SSID with Samsung Galaxy S3, do the following

1. Go to your router admin and hide the SSID
2. On WIFI for Samsung Galaxy S3
3. Remove/forget any WIFI setting that has the same SSID of your hidden one
4. At your WIFI network setting, scroll to the bottom and click on Add Network
5. Type in your hidden SSID and configure security. After all is done, save the setting.

After the above setting, you will see your Samsung Galaxy S3 connect to your hidden SSID

Sunday, July 15, 2012

C3P0 - Managing Connection Pool

C3P0 is an open source database connection pool library. By using the ComboPooledDataSource and reading the document, you can easily set up a database connection pool for your application.

I will talk a bit more about managing database connection pool. A database connection pool is simply just a group of persistent database socket.

Why do we want a connection pool? Mainly for performance. A pool allow you to reuse the same set of established persistent connections over and over again. This will greatly reduce the wait time due to connection establishment.

For example, a naive new connection usually require the following time

1. network connection setup + database connection initialization
2. database transaction and commit
3. database connection close + network socket close

This is fine if we are only performing a single database transaction. Imagine if we are performing hundreds of transaction per minute. Time used for step 1 and 3 will hinder the application performance.

If you are using a connection pool, after initial connection establishment, only step 2 time is a factor on application performance.

Then, since the connection is persistent, why don't we just use 1 persistent connection instead of a connection pool? Database transaction requires time. It may take a long transaction if the commit are huge. Nowaday, applications perform multiple transaction in a seconds. So, if you use only 1 persistent connection and the current transaction is huge, it will create a "hang" effect of the application.

You may be thinking that since the connection is persistent, won't it waste system resource if the application idle most of the time? Connection pool is a balance between performance and resource. If you have a huge pool, you may have a good application performance. However, you will be using a lot of system resource. The reverse applies.

Now, back to C3P0. By default, C3P0 does not expires connections. So, if you use their default setup, you may see your connection increase over time and occupying the system resource. And at one point of time, you may see your application complaining for "connection limit exceeded"

To handle this issue, the following will help

initialPoolSize - This allow you to set the initial pool size for your connection pool. C3P0 will only accept logical input. And by testing, the value must be more than 2. If not, it will set to default value of 3.

minPoolSize - This allow you to set the minimum pool size for your connection pool. Minium pool size means that your pool will always have this amount of connections in your application at any time.

maxIdleTimeExcessConnections - This allow you to set the timeout value in second for connections that is over your minPoolSize. This is an important value if you want to maintain your connection pool as close to minPoolSize as possible or prevent connection spike that cause a sudden increase of your connections.

An example - initialPoolSize = 2, minPoolSize = 1, maxIdleTimeExcessConnections = 300

This means C3P0 will start a connection with initial of 2 connections and C3P0 will actively purge any connection that over minPoolSize that has idle for 5 minutes. So, after the startup, C3P0 will purge the initial 2 connections down to 1 connection (minPoolSize) if either of them idle for 5 minutes


Reference: http://www.mchange.com/projects/c3p0/#managing_pool_size