Sunday, October 11, 2009

Where do you keep (serialize) application data?

Applications keep data everywhere. From plain text file, INI file, Windows registry, database to proprietary file format.

Take a browser as an example, it needs to serialize user options, bookmarks, cookies and history. The designer can choose to keep each kind of persistence in different files. For example, options in one file and bookmarks in one file. The designer can also choose to keep user options in Windows registry, while keeping the bookmarks in a file.

Can we keep everything (or almost everything) in a single place? Sure, database to the rescue! I am not talking about client/server database system like Oracle and SQL Server. I am talking about small but powerful database system such as SQLite and embedded Firebird. For a real world example, Firefox 3 uses SQLite to keep bookmarks, histories and cookies.

There are several apparent advantages of using database to keep data. It is easy to backup and restore if everything is kept in one database. You are also free from opening and closing various files. Retrieving data quickly is easily accomplished by using index. You can also avoid data inconsistency by using transactions.

Some people will complain that using database to keep small set of data is an overkill. You’ll have to judge that by yourself. Do you want to free yourself from headaches such as creating indexes and creating your own file formats? If so, start to serialize your data to database now. You can then focus on developing your software and release it quicker.

And yes, there are people who keep big list of bookmarks and histories.

Friday, October 9, 2009

Opera in XIII: The Conspiracy

Maybe I haven't watched too many movies, so this was the first time I saw Opera in a film. I was excited that I replayed to see the icon again :)

XIII was rescued by an old couple after being coma on a tree with a parachute. He woke up without remembering who the hell he was and what in the world he did, yet his could still show off his various skills.

He tried to use the old folk’s machine which had Opera installed (notice the dot dot dot (…) button?):
XIII uses Opera


Opera couldn’t connect:
2009-10-09 Opera2


Old man said the internet has not been functioning for more than a year, it must have been disconnected. XIII said that some ISPs are so lazy that they just disable users by blocking hardware ID. So he took off the modem cover (which was not screwed or glued together at all), adjusted a DIP switch,
2009-10-09 DIP


spoofed the MAC address,
2009-10-09 Spoof


and voilĂ , he’s online with HOT hit (#1 user-rated search engine)!
2009-10-09 Online


“You can't even remember your own name. How did you manage to do that?” the old man asked with a curious look.
2009-10-09 Old folk


“I have no idea,” XIII replied.
2009-10-09 No idea

Monday, October 5, 2009

Windows 7 Keyboard and Mouse Shortcuts

Windows 7 added some useful shortcut keys and mouse shortcuts.


Window

The following keys affect the current window. They works only if Aero Snap is enabled which is enabled by default. If yours is somehow disabled, go to Ease of Access Center -> Make the mouse easier to use –> clear the “Prevent windows from being automatically arranged when moved to the edge of the screen" checkbox.

  • Win+Up: Maximize window (if it can be maximized).
  • Win+Down: Restore window if it is currently maximized, or minimize if it is not currently maximized.
  • Win+Shift+Up or Double-click the top border: Maximize window vertically.
  • Win+Shift+Left / Right: Move window to the another monitor.
  • Win+Left: Dock to the left of the screen, press this repeatedly to cycle the window through different monitors.
  • Win+Right: Dock to the right of the screen, press this repeatedly to cycle the window through different monitors.
  • Win+Spacebar = Take a peek at the desktop.
  • Win+Home = Minimize all other windows except the current window. Press again to undo.

Taskbar

In Windows Vista and Windows 7, you can press Win+T to focus the taskbar. You can do these when the taskbar has the keyboard focus:

  • Left or Right arrow: move between tasks.
  • Home: focus the first task button. Works only in Windows 7.
  • End: focus the last task button. Works only in Windows 7.
  • Press the first letter of a task title: That task button will be focused.
  • Up arrow: focus the Aero Peek window. When you are at a Aero Peek window, you can press left/right/home/end to move around. Press down arrow or Esc to focus back to the task button.
  • Enter or Spacebar: switch to the selected task.

Tray

Press Win+B to focus the tray. Then:
    • Left or Right arrow: move between icons.
    • Press the first letter of a icon tooltip: That icon will be focused. The tooltip is the text that appears when you hover a tray icon with the mouse.
    • Enter or Spacebar: this is the same as double-clicking the icon.
    • Drag a tray icon from the taskbar and drop it outside the taskbar: this will hide that tray icon from the taskbar, unless it has notifications.
    • Drag a icon from the hidden icon box to the taskbar: this will show that tray icon on the taskbar, making it always visible.

  • Taskbar Favorites

    Press Win+<Number> to open task quickly. For example: press Win+1 to open the first program on the taskbar. Press Win+0 to open the 10th program on the taskbar. These key combinations are called Taskbar Favorites, some models of Microsoft keyboard have actually included hotkeys just for these.