Node.js - Multithreaded Javascript Engine

Ever wondered how to implement multithreading in PHP? Natively, PHP can't do multithreading, only multiprocessing, but multiprocessing on a single resource in PHP is not robust solutions as it could encounter race condition, which is common problem in multithreading if the resource is not locked prior to being used. There are several techniques implementing multithreading in PHP but I'm only mentioning this particular lightweight framework. This is even simplier than ASP.NET inherent multithreading capabilities.

Node.js (http://nodejs.org) is a javascript framework that could even act as a small web server. It allows you to implement multithreading without the hassle of locking/unlocking resources. It could even allow you to design stateful web (equivalent to viewstate/session management). It's even best for designing scalable clustered web app (where several instance resides on same multi-core servers or different servers with load balancer).


No Symbols Loaded - Debugging Silverlight App in ASPX Page

I was once assigned to an ongoing silverlight project with Dynamic CRM integration with no technical documentation and was oriented only on the basics. Being an inquisitive person but couldn't get much help from the original team of developers (offshore), what I did was to examine the flow in debug mode. It's an expensive approach but leaves me no choice.

Fixing Too Many Connection Problem

My very first .Net project way back in year 2003 using Visual Studio 2003 (later switch to 2005, 2008 and 2010 as time went by), and using MySQL 4.1 (later migrated to MySQL 5.5) as the backend database, was faced with the same database connectivity problem, the application often would encounter this  "Too many connection.." error, when the database driver (MySQL.NET), after some prolong running, could not established database connection anymore.

I've fixed this by inserting the following code under the try/catch database connectivity error handler.
System.Data.SqlClient.SqlConnection.ClearAllPools();
The same line of code works in .NET default data driver ADO.NET hence MySQL.Net driver has adopted ADO.NET namespace for ease of using either SQL Server or MySQL database.

The nature of my application is multithreaded and demands for very fast database connection as each task per user has to spin each own background thread from the threadpool. But if your application is not very particular about database connection speed and would like each instance being destroyed immediately after closing the database connector, you can adjust it on IIS application settings or via the connection string by setting Pooling=false.

Reading Cookie from Other Website with Different Domain

By W3C rule, a web browser is not permitted to read cookies from different site with different domains. So how do we beat the challenge of reading cookies from other 3rd party site when let's say you were task to integrate it in your site and there are some needed parameters that are stored on 3rd party cookies which you need to read.

You'll need your Network Admin guy for this task or if you have access to CPanel or similar UI which allows your to assign subdomain alias (CNAME).

Single Login Session Between Websites

Single sign-on or login allows user to login from one site or another and authentication happens only once per active session. Without this mechanism, it would be annoying to the user whenever he wants to switch between website and prompted again to login.

In ASP.NET, to implement single sign-on or login between websites on same domain with different subdomain, do the following:

Where to Upload and Host CSS / Javascript - Fast and Free

There are a lot of free site that offers to host your script for free yet some have limited bandwidth and slow. But there's one without bandwidth limit and very fast, yet the feature is not obvious for hosting CSS and JAVA script.

Google has a lot of useful yet free applications, and one of that is Google Docs. It's a collaborative office applications where it allows you to do document editing online., but we're not going to use that feature, rather to host script file.

MS Access Export to Excel or CSV

Exporting data from Ms Access 2007 to Excel from code is just a one line statement using DoCmd.TransferSpreadsheet, but in CSV there's an inherent bug so I created my own export module. Plus a special function that saves file to disk, which I modified a bit to make it work on 64 bit machine.