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.

August 17, 2013

NLog in WP7

Does anyone use the NLog successfully in WP7?

I googled a lot, finally I cannot add an extension to the NLog. So I add the IsolatedStorageTarget to the dll, and compile it. And it successfully worked.

What I do?

1. add the following codes to the target folder:


2. Add the NLog.config:



3. Add the codes to your cs file that you want to use:


that is all of the steps you need to do.

If you want the compiled dll, you can download from link. If the link is not available, please comment under the article.

Hi blogger

Hi everyone, this is the first time I arrived blogger, I like it very much. I`m a Chinese man, I`d like to make friends with us. Even though, my English communication is not so good, but I have the confidence to do it in a better way. In this new home, I`ll write some tech-articles if I met an issue and solved it successfully and share others blogger articles.

Thanks!