Pages

The Downsides of ASP.NET Session State

http://tech-journals.com/jonow/2011/10/22/the-downsides-of-asp-net-session-state

by default the ASP.NET pipeline will not process requests belonging to the same session concurrently. It serialises them, i.e. it queues them in the order that they were received so that they are processed serially rather than in parallel. 

Tuesday, October 25, 2011

When does Application_Start get called in ASP.NET?



First time running
Or
Web.config was changed

A Toast to C


" But when it comes to high-performant computation, there's just nothing like C"
"it is relatively paradigm-free"

Wednesday, October 19, 2011

How to solve problem, "Team Foundation Services are not available from server 503"


One reason to cause this problem is the user account :TFSSERVICE, either locked or password expired.

In the event log, you will got following error event:

Application pool Microsoft Team Foundation Server Application Pool has been disabled. Windows Process Activation Service (WAS) encountered a failure when it started a worker process to serve the application pool.


Solution:
1. Open Team Foundation Server admin console, find the action, "reapply the account", and input password again.
2. Reset IIS server

Thursday, October 13, 2011

Indexes causes deadlocks in SQL Server



Another common scenario for deadlock
If make a lot of indexes with same set of columns but sequence is different, can cause deadlocks between select/update query.
Solution:
Carefully design indexes for a table, don’t let tuning advisor do it for you.

Reference:




Wednesday, October 12, 2011

Using TRY - CATCH to Rollback a Transaction - SQL Server

http://www.eggheadcafe.com/tutorials/aspnet/6a8ef7d5-840e-4629-b53a-1a40e7db601f/using-try--catch-to-rollback-a-transaction--sql-server.aspx


BEGIN
BEGIN TRY --Start the Try Block..
BEGIN TRANSACTION -- Start the transaction..
UPDATE MyChecking SET Amount = Amount - @Amount
WHERE AccountNum = @AccountNum
UPDATE MySavings SET Amount = Amount + @Amount
WHERE AccountNum = @AccountNum
COMMIT TRAN -- Transaction Success!
END TRY
BEGIN CATCH


ROLLBACK TRAN --RollBack in case of Error
-- you can Raise ERROR with RAISEERROR() Statement including the details of the exception
RAISERROR(ERROR_MESSAGE(), ERROR_SEVERITY(), 1)
END CATCH
END

How to check variable is undefined in Javascript


            if (typeof (variablename) == "undefined") {
            }

Friday, October 7, 2011

How to analyze and fix deadlocks in SQL Server?

1.Monitor and get detail on each deadlock
Analyzing Deadlocks with SQL Server Profiler
http://msdn.microsoft.com/en-us/library/ms188246.aspx


2. Wrap all all of insert/update/delete into transaction with rollback and high deadlock priority
SET DEADLOCK_PRIORITY HIGH;
http://msdn.microsoft.com/en-us/library/ms186736.aspx

SET XACT_ABORT ON;
http://msdn.microsoft.com/en-us/library/ms188792.aspx

3. Improve all of slow SQL query that got from xdl file

Tuesday, October 4, 2011

Two useful javascript methods: preventDefault, stopPropagation


event.preventDefault
Cancels the event if it is cancelable, without stopping further propagation of the event

event.stopPropagation