June 5, 2014

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.

April 6, 2014

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

January 13, 2014

How to build OpenSSL in Win32

Post the content from http://softwerkz.net/2009/09/libtorrent/ Building OpenSSL Library This section is optional. However, if you wish to include OpenSSL library into your libtorrent, here are the steps to build it. Download ActivePerl and install it to assist the building of OpenSSL library. Download NASM and install it if you have not done so. Add the environment variable OPENSSL and set its value to the openssl folder e.g., D:\libtorrent\openssl-1.0.1c. Add the environment variable NASM and set its value to the nasm folder e.g., C:\Program Files (x86)\NASM. Execute the Visual Studio Command Prompt. (It can be found from Start Menu for Windows 7.) Then, run the following commands. perl Configure VC-WIN32 --prefix="%OPENSSL%" %NASM%\nasmpath.bat call ms\do_nasm nmake -f ms\nt.mak The OpenSSL libraries are located in folder, out32. =================error happened============================= Hi, I have gone through OpenSSL, but I can’t find libeay32lib and ssleay32.lib in $(OpenSSL)\out32. hm… weird. oh I just found an error after I ran nmake -f ms\nt.mak cl : Command line warning D9035 : option ‘O’ has been deprecated and will be rem oved in a future release o_str.c .\crypto\o_str.c(66) : fatal error C1083: Cannot open include file: ‘strings.h’: No such file or directory NMAKE : fatal error U1077: ‘”C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN \cl.EXE”‘ : return code ’0×2′ Stop. ========================How to solve ==================================== Hi Joon, Did you run “perl Configure VC-WIN32 –prefix=%OpenSSL%” with Visual Studio 2008 Command Prompt under the directory of your OpenSSL folder? Example (for my test case here): D:\openssl-1.0.0a>perl Configure VC-WIN32 –prefix=%OpenSSL% Your results will be something like the following:
Configuring for VC-WIN32 no-gmp [default] OPENSSL_NO_GMP (skip dir) no-jpake [experimental] OPENSSL_NO_JPAKE (skip dir) no-krb5 [krb5-flavor not specified] OPENSSL_NO_KRB5 no-md2 [default] OPENSSL_NO_MD2 (skip dir) no-rc5 [default] OPENSSL_NO_RC5 (skip dir) no-rfc3779 [default] OPENSSL_NO_RFC3779 (skip dir) no-shared [default] no-store [experimental] OPENSSL_NO_STORE (skip dir) no-zlib [default] no-zlib-dynamic [default] IsMK1MF=1 CC =cl CFLAG =-DOPENSSL_THREADS -DDSO_WIN32 -W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN ... < more of the definitions here > EX_LIBS = CPUID_OBJ =x86cpuid.o BN_ASM =bn-586.o co-586.o x86-mont.o DES_ENC =des-586.o crypt586.o AES_ENC =aes-586.o BF_ENC =bf-586.o CAST_ENC =cast-586.o RC4_ENC =rc4-586.o RC5_ENC =rc5-586.o MD5_OBJ_ASM =md5-586.o SHA1_OBJ_ASM =sha1-586.o sha256-586.o sha512-586.o RMD160_OBJ_ASM=rmd-586.o CMLL_ENC= =cmll-x86.o PROCESSOR = RANLIB =true ARFLAGS = PERL =perl THIRTY_TWO_BIT mode BN_LLONG mode RC4_INDEX mode RC4_CHUNK is undefined Configured for VC-WIN32.
If you look at the CFLAG values, you will find -DOPENSSL_SYSNAME_WIN32, this actually disable the #include in the o_str.c If look into the file o_str.c, you’ll see:
#if !defined(OPENSSL_IMPLEMENTS_strncasecmp) && \ !defined(OPENSSL_SYSNAME_WIN32) && \ !defined(NETWARE_CLIB) # include #endif
So two checks here. First make sure you are running the command under Visual Studio Command Prompt and the CFLAG has the mentioned flag. Also, you can open up the Configure file in the OpenSSL folder. Do a find on “OPENSSL_SYSNAME_WIN32″, you will see it in VC-WIN32 target. You can add it there or re-download the OpenSSL if it’s not there. Hope it helps.

October 13, 2013

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.

October 11, 2013

How to create a branch from WP78 to 80

Please following these steps: 
1.right the trunk(include WP78 repository), choose branch/Tags 
2.navigate the combobox to "branch/80" 
3.click ok. 
4.open the solution, update the specified project 
5.remove the WP78 tiles from App.xaml 
6.remove the unavailable references and replace them. 
7.remove the package.config, it`s just contain WP78 nuget informations. 
8.re-install the nuget packages. 
9.if you meet the vm:Locator not exist, you can update the MVVMLight using nuget, after all error has fixed, you can see the not exist error is disappeared. 
10.commit the new solution.

October 2, 2013

How to merge WP 71/80 repository with TortoriseSVN?

Here is the following steps :
1.navigate to 80(branch)
2.Right click choose merge
3.choose "Merge a range of revisions"
4.Choose all revision
5.choose merge.
6.If you meet collision(such as WMManifest.xml), choose prep local.

October 1, 2013

Windows Phone Toolkit cannot install with WP8.0

Successfully installed 'WPtoolkit 4.2013.08.16'. Successfully uninstalled 'WPtoolkit 4.2013.08.16'. Install failed. Rolling back... Could not install package 'WPtoolkit 4.2013.08.16'. You are trying to install this package into a project that targets 'WindowsPhone,Version=v8.0', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author. When I met the issue, it means I could not install the nuget package. The way to solve the issue is go to http://www.nuget.org and install the latest package.