Showing posts from 2010

.Net v4 vs v2 - In-Process Side-by-Side

In-Process Side-by-Side, or In-Proc SxS is a process whereby assemblies written in .NET4 and .NET2 co-exist together in runtime. This is possible because a process is able to host multiple version of .NET CLR in a single process. This means if an application is recompiled to run against the .NET Framework 4 runtime and still has dependent assemblies built
against .NET 2.0, those assemblies will load on the .NET 4 runtime transparent to the user.
It faces problem (if .NET4 runtime is used) in the following areas:
a) Shell Extension support is limited. Application built with earlier version wil fail.
b) C++/CLI section which specifically states that a pre-2.0 mixed mode assembly can only load in a v2 CLR. The v4 CLR does not
support this scenario. There is no solution to this problem. You have to recompile the mixed mode assembly under v4 or switch back
to v2 for your application.

Building Mongodb on Fedora

The documentation provided by mongodb to build on Fedora is pretty accurate. Here is the link to the document. Just have to make sure that you have got all the required tools like boost and scons that is vital for the build.

Build can be trigger using the following command:
scons all

Compiling mono on Fedora 12.

It is really easy, just following the instruction from here and set the prefix to your preferred build directory; For example, set the mono binaries to /tmp/mono_build.

./configure --prefix=/tmp/mono_build; make; make install
That's it.

Enterprise Library configuration without using App.config / Web.config

Sometimes you might want your Enterprise Library logging configuration file to kept separately and maybe you're not going to put an entry even in your web.config using [Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection].
The following codes shows how this can be accomplished:-

// Assuming the configuration file is default [loggingConfiguration] and in your current .exe directroy FileConfigurationSource fileSrc = new FileConfigurationSource("Test.config"); // If you would like to validate your configuration // var loggingSection = fileSrc.GetSection("loggingConfiguration"); LogWriterFactory wfac = new LogWriterFactory(new FileConfigurationSource("Test.config")); var Writer = wfac.Create(); LogEntry logEntry = new LogEntry(); logEntry.Message = "Life"; Writer.Write(logEntry);
Your new configuration file is called Test.config and its contents the same…

.Net Performance notes

Some performance notes that i got from MSDN.
JIT compiler performs the following optimization given the small amount of time:
•Constant folding •Constant and copy propagation •Common subexpression elimination •Code motion of loop invariants •Dead store and dead code elimination •Register allocation •Method inlining •Loop unrolling (small loops with small bodies)

Value types, including integral types, floating point types, enums, and structs, typically live on the STACK. Reference types and boxed value types live in the HEAP. They are addressed by object references, which are simply machine pointers just like object pointers in C/C++.
NGEN, a tool which "ahead-of-time" compiles the CIL into native code assemblies
9 million allocation Type Size of Allocation Execution Time string 575,783 00:00:2739811 int 8620 bytes - 40 instances 00:00:2515444 short 10472 bytes - 238 instances 00:00:2538425 employee 1,440,457,523��������������…

Network Monitor MSI / Setup give Error Opening log file

When you try to install using Microsoft MSI, you bump into the following message

“Error Opening Installation log file. Verify that the specified log file location exists and is writable”

Workaround, extract the .exe file by using the following command below

NM33_x86.exe /c /t:c:\tools\networkmonitor

the /t switch is used to tell installer where to extract the file.

Then try to run netmon.msi to install network monitor. I tried it with Network Monitor 3.3 and it works (Netmon.msi and Microsoft_Parsers.msi)

Streaming Algorithm

This is going to be an ongoing update to some interesting streaming algorithm that i found over the web. If anyone have any input, please let me know.

-- Haven't really work on it yet --

Recommendation algorithm

This is going to be an ongoing update to some interesting recommendation algorithm that i found over the web. If anyone have any input, please let me know.

Contextual-Bandit algorithm - Li Long, Wei Chu, J.Langford, R.Schapire
-Adapting machine learning approach for recommending advertisement, news and other articles to users.
Nearest Neighbour Algorithm - To be updated :)


Nearest Neighbour Algorithm (This give a really easy to understand overview of the algorithm - far better than alot of the lecture notes given by professors)

Case sensitive in JQuery class selectors

When you're using jquery's class selectors for example, $('a.lookupScript'), it will work in Mozilla but not on IE. So you gotta make sure that you got the case right. :)

Determining IIS version your server is running on.

I got this from Microsoft Support site... :)
VersionObtained fromOperating System1.0Included with Windows NT 3.51 SP 3 (or as a self-contained download).Windows NT Server 3.512.0Included with Windows NT Server 4.0.Windows NT Server 4.03.0Included with Windows NT Server 4.0 Service Pack 3(Internet Information Server 2.0 is automatically upgraded to Internet Information Server 3.0 during the install of SP3).Windows NT Server 4.04.0Self-contained download from or the Windows NT Option Pack compact disc.Windows NT Server 4.0 SP3 and Microsoft Internet Explorer 4.015.0Built-in component of Windows 2000.Windows 20005.1Built-in component of Windows XP Professional.

Illegal character in Firefox

Firebug detected an illegal character while loading javascript, to fix this just have to open up the javascript with a proper texteditor and remove those illegal character. Pretty simple i guess.
You can find more info from here