Monthly Archive for December, 2007

Mac keyboard cheat sheet

As a Mac beginner, I often forget which key is related to a symbol. So this is the cheat sheet of mac keyboard.

mac keyboard cheat sheet

Java Tips: Scanner

Java 5 introduces a new class named Scanner. This class provides the best way to work with stream of character.

Using the class, you can reduce the code to read and process any character stream, that’s include file or any other input stream. That’s mean you can also use System.in for getting input interactively from user in a console application (something that is very hard to do with previous Java version).

For more information about Scanner, see the tutorial in Sun.

How does it feel…

when you have 100Mb internet for yourself?

Ask this guy who downloaded Ubuntu (ca. 700MB) in less than 1 minute.

From: Wired

Free Articles of Getting Things Done

Are you a GTD practitioner or maybe a wannabe? This collection of free articles from the writer of GTD might help you somehow. Even if you don’t really do all the suggestions, there is probably one or two tricks you want to try.

  • 5 Phases
  • Stalking the Wild Projects
  • Palm
  • Are You Micro-Managing Your Mind?
  • The Weekly Review
  • The Coach as Personal Trainer
  • The Threefold Nature of Work
  • Make It Up and Make It Happen
  • Organizing a Paper Organizer
  • The Productivity Investments
  • General Reference Filing
  • The Tickler File
  • Overtime… All the Time
  • Managing Work on a Vacation
  • Personal Inventory Control
  • Workflow Diagram
  • Workflow Advanced

Collect comic strip in your home computer

Who don’t like comic strip? My favorite is Foxtrot, so it’s pretty disappointing when Bill Amend announced that he will only release a new comic once a week, not every day like before.

Anyway, if you have a certain comic strip’s favorite, you can collect them in your local machine as long as you don’t publish it anywhere else. The most primitive way is of course just ‘copy and paste’ the image everyday (or every new comic is released).

If you use linux, there is a better way to do it. Just install dailystrips package and configure it to run everyday with all comic titles you want to download and it will do the jobs for you. You can anytime go o your archive and read all the comics you haven’t read.

For Mac, the most convenient way is to use ACMEreader. This is also a free application and it has nicer interface than dailystrips. The drawback is that you have to open the application once in a while to make sure that you don’t miss any release.

00000018.png

So don’t wait any longer, start your comic strip collection now!

Solving Rubik

Rubik is pretty classic game and it even has a World Championship.

rubiks_cube.jpg

I have my first (which has already gone for a long time) when I was in the Junior High School and it was accompanied with a paper about how to solve the rubik. So earlier, I always look at that paper anytime I want to solve it. When the paper gone, I found a nice way to solve the rubik: take out the stickers and put them back together in the proper position :D.

So, when two months I get a new rubik’s cube without accompanying paper instruction, I just look into Youtube and found many links about rubik (which is not a topic of this post, but many are also interesting) and a tutorial by Dan Brown (does the name seems familiar to you?). Here are the links part 1, part 2.

After several days struggling, now I can say I’m able to solve rubik 3×3 without any help in under 10 minutes. Try me!

My top Eclipse keyboard shortcut

eclipse logo

If you use Eclipse a lot you must have your favorite keyboard shortcut. Here are mine:

  1. Context Assist (CTRL+SPACE), I believe this is all favorite since they just have so many functionality. You want assistance about class name/method name/variable name. You get all. More than that, it also shows the template available for the context. It even suggests the possible variable name/method name. And it works in all places, even in the dialogs. This is a must know keyboard shortcut for all Eclipse user. Without it, you just will not get anything from Eclipse.
  2. Format (Shift+Ctrl+F), I usually type anything as fast as I can without bothering the format of the code. This shortcut will tidy up all the clutter and make my code readable.
  3. Save (Ctrl+S). OK, I know that this is a must for nearly all applications.
  4. Quick Fix (Ctrl+1). You get error or warning? Many times you will find that this shortcut can solve the problem for you.
  5. Rename (Ctrl+2+R). Since I’m a refactoring guy, I never escape from this task, renaming variables/methods/classes.
  6. Quick Type Hierarchy (Ctrl+T). Nice way to get information about classes tree without opening JavaDoc

So if you are also using Eclipse, what’s your favorite keyboard shortcut?

Java Tips: Array argument

This tips is not that advance. I expect that many have already known this and I even have already write a tips of one nice application of this technique. For those who don’t, Java 5 provides a nicer way to define an array argument.

Say there is a method like this:

public void processArray(int[] is) {
   // ...
}

With the old technique, you have to create the array explicitly before passing it as argument, such as:

processArray(new int[] {1,2,3,4,5});

With the new technique, you can simplify it to:

processArray(1,2,3,4,5);

But the method defined before have to be changed to:

public void processArray(int... is) {
   // ...
}

Of course, there are several requirements for this to happen.

  1. There is only one array that you want to change in the method
  2. The argument of array have to be placed in the very end of the method declaration

Spring Tips: Initializing bean using EasyMock for unit test

Unit test is a very good practice for creating robust application. Using Spring, we can avoid using ApplicationContext and instead arrange all dependencies programmatically. However, once in a while, we still need to test using the actual ApplicationContext. This can be problematic if our test using mock from EasyMock.

So here is the example on how to create a mock using EasyMock programmatically:

AccountDAO accountDAOMock = EasyMock.createMock(AccountDAO.class);

Move it to Spring ApplicationContext like this:

<bean id="accountDAOMock" class="org.easymock.EasyMock"
		factory-method="createMock">
      <constructor-arg index="0"
			value="com.argus.camc.datamanagement.interfaces.AccountDAO" />
</bean>

Happy unit testing!

Focusing attention on presentation

Often in a presentation, we need to show a demo to the audience. A live demo is often much more appreciated than recorded cast. But the problem with live demo is you will be forced to show the entire screen of your computer. If you want to focus the attention to a window or a point, you need to dim the rest of your screen.

Doodim in action

Clutter Cloak is the tools for your Windows machine, whereas Doodim does the exact job for the Mac. Both are free.

If what you need is somewhat different, you may want to see Mousepose. Instead of a static rectangular area, Mousepose simulates a dark room with strong light to a certain place pointed by your mouse.

Mousepose in action

BTW, Mousepose is available as bonus if you finish the MacHeist II stage 2. It’s still running now, so you must hurry if you want one.