Fix the Home, End and Numbers keys on Mac OS X

The origin post at here: http://mwholt.blogspot.com/2012/09/fix-home-and-end-keys-on-mac-os-x.html

If you use a keyboard that’s not designed specifically for Macs, you probably are familiar with the annoying mapping of the Home and End keys: they scroll to the beginning or end of an entire document, with no regard to the cursor’s location.

Fortunately it’s an easy fix. (Note: This works for native Cocoa apps only, not X11 programs.)

To get your Home and End keys working properly on Mac OS X (in my case, Mountain Lion, although this should work in prior versions back to at least Tiger), simply open the Terminal and do this:

$ cd ~/Library
$ mkdir KeyBindings
$ cd KeyBindings
$ nano DefaultKeyBinding.dict

Put these lines in that file, including the curly braces:

{

/* Remap Home / End keys to be correct */
“UF729” = “moveToBeginningOfLine:”; /* Home */
“UF72B” = “moveToEndOfLine:”; /* End */
“$UF729” = “moveToBeginningOfLineAndModifySelection:”; /* Shift + Home */
“$UF72B” = “moveToEndOfLineAndModifySelection:”; /* Shift + End */
“^UF729” = “moveToBeginningOfDocument:”; /* Ctrl + Home */
“^UF72B” = “moveToEndOfDocument:”; /* Ctrl + End */
“$^UF729” = “moveToBeginningOfDocumentAndModifySelection:”; /* Shift + Ctrl + Home */
“$^UF72B” = “moveToEndOfDocumentAndModifySelection:”; /* Shift + Ctrl + End */

}

Press Ctrl+O and then Enter to save the file, and Ctrl+X to exit. Restart your computer to have it take full effect.

Install dropbox on ubuntu

1. Download the deb file from: https://linux.dropbox.com/packages/ubuntu/dropbox_1.6.0_i386.deb 2. Install the dependences: apt-get -f install -f python-gtk2 libatk1.0-0 libcairo2 libpan go1.0-0 python-cairo python-gobject-2 libgdk-pixbuf2.0-0 libatk1.0-data libx11-6 libxcb-render0 libxcb-shm0 libxcb1 libxrender1 libjasper1 libjpeg8 libtiff4 lib gdk-pixbuf2.0-common libthai0 libxft2 libgtk2.0-0 libpixman-1-0 libjpeg-turbo8 libthai-data libdatrie1 libx11-data libxau6 libxdmcp6 libgtk2.0-common libxcompo site1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 hicolor-icon-theme libgtk2.0-bin

Improve perfrormance of WP7 multiple IsolatedStorageFile.ExistDirectory calls

In my new project, I need to check the isolated storage to get if the Directory is exist, but if the directories have the same parent directory, we can first call isf.GetDirectoryNames(Path.Combine(“Downloads”, “*”)); to get the directories and then using strings.contain(xxx), after all, performance is fine.

With a lot of isf.DirectoryExists:
About cost 1.1s
With GetDirectoryNames and strings.contain(xxx)
After change the code, cost 0.11s.