How to change default encoding in Eclipse?

It’s super easy. Just follow the below step.

     Window > Preferences > General > Workspace > Text file encoding

Try to use UTF-8 since you’ll encounter an issue that might need to support Korean, Chinese, or Japanese characters in the future.

How to change tomcat default deployment directory in Eclipse?

I’m using Mac and Eclipse’s default deployment directory is like below.

.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\

And I hate it! So, let’s change the default deployment directory for Tomcat 7.

1. Go to your server view.

window -> show view -> server

2. Double-click your server.

3. Choose one of the 3 options.

You need to choose appropriate option for you to change the deployment directory.
I’m using the 2nd option.

Image

[PhoneGap] Getting Started with Android in Eclipse

At this moment, PhoneGap 3.0 has been released. However, the documents for it is very limited so I had many troubles dealing with the new version. So I decided to start with PhoneGap 2.9. Below is the Getting Started Guide from PhoneGap official document.

http://docs.phonegap.com/en/2.0.0/guide_getting-started_android_index.md.html

By following the steps, you’ll be able to launch your HTML files on Android using Eclipse. It’s super easy. :)

Error: Tools jar does not exist in Eclipse

By following the instructions below, you can re-configure your Java version and fix your tools.jar location error.

1. Go to ‘Preferences’.

2. Java > Installed JREs

3-A-1) Select your JDK and click on Edit.

3-A-2) In the new Dialog, you can add external jars like tools.jar to your execution environment.

OR

3-B-1) Click ‘Add’

3-B-2) Select ‘Standard VM’ and ‘Next’

3-B-3) Locate your Java HOME directory you have installed, and ‘Finish’.

Error. Project facet Java version 1.7 is not supported in Eclipse

Following below steps could resolve this error by fixing up the conflict.

 

1. Right Click on your Project on Project Explorer and click on Properties.

2. Goto “Java Build Path” > “Libraries”

3. Delete any conflicted libraries. (which shows red x box)

4. Check JRE System Library Jars and also select JDK 1.6 or 1.7

5. Goto “Project Facets” and select your java version.

Eclipse ANSI Console Plugin

To use ANSI Console in Eclipse, you need to install below plugin.

1. Help > Install New Softwrae

2. Input below URL into Work with:
http://www.mihai-nita.net/eclipse

3. Click ‘Add’

4. And you will know what to do. ;)

The plugin Homepage.
http://mihai-nita.net/2013/06/03/eclipse-plugin-ansi-in-console/

How to reset Garmin Nuvi Navigator

How do I perform a master reset on my nuvi 200, 400, 500, 600, 700, 1000, 1300, 1400 series device? 

Caution: Reset will erase all personal data including favorites, and it will restore your device to the factory settings. If you want to backup your device before proceed, please find it on my another following article.

  1. Turn off your Garmin GPS.
  2. Touch and hold the LOWER RIGHT CORNER of the screen with your nail. (or a stylus)
  3. Keep holding the lower right corner, and turn on your Garmin.
  4. Release the power button when the device is ON.
  5. Press Yes for the following prompt: Do you really want to erase all user data?
  6. Now you can remove your nail from the touch screen.
It’s really easy. Now enjoy your device with factory clean settings!

How to sync multiple Google calendars with iPad and iPhone

How to sync multiple Google calendars with iPad and iPhone

It took me some time to figure out this fully so I will share it here.

Part I. Set up your browser.

  1. Open Safari. (You can use other browsers but I will use Safari because that’s the easiest way.)
  2. Open Preferences > Advanced
  3. Check on “Show Develop Menu in Menu Bar”
  4. Open Safari menu Develop > User Agent > Mobile Safari 3.1.3 and go to step 7.
  5. If you don’t have Mobile Safari 3.1.3, select “Other…” and go to step 6.
  6. Input following strings:
    Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10
  7. Check Develop > Disable JavaScript
  8. Now you’re ready for Part I. Let’s go to Part II.

Part II. Set up iPad and iPhone.

  1. Open Settings > Mail, Contacts, Calendars > Add Account
  2. Select Microsoft Exchange (Do not select Gmail)
  3. Enter your Email address
  4. Leave the Domain field blank
  5. Enter your Gmail account including @gmail.com and input password
  6. Click on “Next”
  7. Server field will appear, then enter m.google.com
  8. Click on “Next”
  9. You have done set up your iPad (iPhone)
  10. Let’s move on Part III.

Part III. Select multiple calendars to sync.

  1. Run Calendar app on your iPad or iPhone. I have both so I will do it on both devices
  2. Open m.google.com/sync on Safari
  3. Now you have to login with your Gmail account
  4. After you login, you will see several devices including your iPad and iPhone
  5. Click whatever you have, and check all calendars you want to sync with the device
  6. Done!!!

Part IV. Reset Safari settings

  1. Undo what you have done in Part I.
Congratulations! Enjoy Google calendar on your iPad and iPhone. :D

Allocating enough memory to Eclipse (Windows, Mac)

Allocating enough memory to Eclipse (Windows)

Eclipse allocates 256mb of memory by default. This would be enough for simple developments. However, I felt Eclipse is too slow when I ran the Android emulator. So here’s the instruction how to allocate more memory to an Eclipse.

eclipse -vmargs -Xmx<size of the memory>

The maximum permanent generation size is increased by the following command:

eclipse -vmargs -XX:MaxPermSize=<size of the memory>

This argument may not be available for all VM versions and platforms. When you change this arguments, make sure you don’t input more than 1024mb of memory. It may not work.

Allocating enough memory to Eclipse (Mac)

I knew how to allocate more memory to an Eclipse on Windows, but didn’t know how to do so on Mac. Here’s the instruction.

  • Go to your Eclipse home directory.
  • Right click (two fingers click) on “Eclipse.app“
  • Select “Show package contents“
  • Open Contents > MacOS folder.
  • Open eclipse.ini file with TextEdit.
  • Update the values as you need.
You should restart to make the changes work. Isn’t that easy? :)

Changing Android emulator size

How to change the size of the Android emulator

Is your emulator too big so that you cannot click the menu bar? Here’s how to reduce the size of the Android emulator.

  1. Go to Run > Run Configurations. 
  2. Select your application on the left side.
  3. Click on “Target” tab on the right panel.
  4. Scroll down to the bottom and input the following under the “Emulator launch parameters“.
  5. -cpu-delay 0 -no-boot-anim -cache ./cache -scale 0.7
  6. This reduces your emulator size by 70%, and remove boot-up Android animation.

Android AlertDialog Usage

I’m writing this article for others who encounter the same problem I had yesterday. Basically my problem was like follows.

  • I wanted to get user input for the next process.
  • I used AlertDialog.Builder(Context) to create alert message and user input.
  • AlertDialog doesn’t wait until the user input any message and click on “ok”.

I tried to solve this problem for several hours. I have been programmed in Java for several years, but this problem really annoyed me. And here’s the solution. I couldn’t find any easy solution on the Internet so I’m posting this article to help beginners in Android.

  • AlertDialog never waits until user inputs.
  • You should do whatever you want to do inside of the OnClickListener() if you want to hold next step until a user clicks a button.
  • For example, if you want to pop up two dialogs consecutively, open the second dialog inside the first OnClickListener(). It also means that there’s a dependency.

I think now you got the idea. I have tried so many ways to get around this problem, but I couldn’t succeed. I needed to change the way of thinking. I’m not sure if there’s another way to implement this, but I think this is the simplest and maybe the best way. I think Android works slightly different.

Here’s a code sample. Remember, this is just a sample. You should think about yours too.

pubic … funcA()
{
      …
      showDialog(DELETE_ID);
      … 
}

protected Dialog onCreateDialog(int id)
{
     switch (id)
     {
          case DELETE_ID:
               final EditText input = new EditText(this);
               return new AlertDialog.Builder(this)
                    .setIcon(R.drawable.dialog_icon)
                    .setTitle(R.string.dialog_entry)
                    .setView(input)
                    .setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener()
                    {
                         public void onClick(DialogInterface dialog, int whichButton)
                         {
                               // Do something here!
                          }
                     })
                     .create();
      }
}

How to delete a smart folder in Finder

Recently, I have moved some of my folders from default partition to another partition. After that, one of my smart folder on the left side of my Finder didn’t work. I tried to remove and recreate it, but didn’t know how. Here’s the answer. It’s really simple.

  • Hold down command key and drag the smart folder you want to delete out of the Finder.

Isn’t that easy?! So many usages of Mac are really easy but sometimes we just don’t know how. Enjoy your Mac life~*

How to connect MSN to iChat

After I purchased Macbook Pro, iChat became my favorite messenger application. It is simple and offers everything I need. So I wondered if iChat supports MSN, but the answer was No. However, there is a way to do this vis Jabber. Here’s how.

Part I. Register Jabber account and connect MSN with it.

1. Of course, you need a MSN account.

2. Download Jabber client application such as Psi which I used. You can download it here: http://psi-im.org

3. Create a Jabber account with the application. There should be several service provider, so choose one of those. And you need this server name soon, so write it down somewhere.

4. After creating your Jabber account, login to it and click on “Service Directory” on the top menu bar.

5. Choose MSN for your service, and enter your login information.

Part II. Connect your Jabber account with iChat.

1. Run iChat, and go to Preferences > Account tab from the top menu bar.

2. Add a new account by clicking on ‘+’, and enter your login information.

3. Select Jabber for the account type, and input your account name with full address including @ and etc.

4. Click on down arrow to expand Server Options, and input your Jabber account service provider used in Part I. For example, I used thiessen.im as my service provider, and port number was 5222.

5. Now, you’re ready to go. But there’re additional steps to do.

Part III. Enable your Jabber account.

1. After your Jabber account is created, click on iChat > Accounts > your Jabber account from the top menu of the iChat.

2. You need to make your status available to login.

3. Done!

Congratulations! Now you connected MSN with iChat. If you want to connect Facebook chat to your iChat, please follow the instruction here:

https://tipandtech.wordpress.com/2011/04/29/connect-facebook-to-ichat/

How to connect Facebook chat to iChat

How to connect Facebook chat to iChat

1. First, you need to set up an username on your Facebook account. If you already have one, go to the step 3.

2. Make username for your Facebook account by clicking on Account > Account Settings, then locate username and click edit. Now you can visit your Facebook by http://www.facebook.com/yourusername 

3. Open iChat, then click on iChat > Preferences, and click on the Accounts tab

4. Click on the (+) sign to add a new account, with these settings:

  • Account Type: Jabber Account
  • Account name: facebook_username@chat.facebook.com
  • Password: your Facebook password
  • Click drop-down arrow to reveal Server options.
  • Server name: chat.facebook.com
  • Port number: 5222
  • Click Done.

5. Click Done again, and you are ready to go!

I have connected my MSN account, Google Talk account, and iChat account all together. I’ll explain how to connect your MSN account to iChat on the next article.

https://tipandtech.wordpress.com/2011/04/29/how-to-connect-msn-to-ichat/

How to view Android logs

Just run the emulator, wait until completed, then from shell, issue command:
adb logcat
If you are using an Eclipse like me, you could get a log view if you switch to the DDMS perspective and here’s how.

Eclipse:
To open LogCat, go to Window > Show view > LogCat. If you can’t see LogCat directly from under ‘Show view’ menu, you have to click ‘others’ to find it. The LogCat window shows all log messages from Android.

The application can also log message that will be shown in the Logcat view. The application can Log message with ‘Log’ class. Use methods Log.v (verbose), Log.d (debug), Log.i (info), Log.w (warning) and Log.e (error) as per the required log levels.

DDMS Perspective on Eclipse:
ADT comes with DDMS perspective in Eclipse. Go to Windows > Open Perspective > DDMS to open it.
The DDMS perspective has Devices, Emulator Control, File Explorer, Heap Status, and Thread Status windows.