Lets say we have a table with only one varchar column and no more than 5 rows (typically it is a temporary table ), and the requirement is to extract a comma separated list of value of each row like:
row1, row2, row3, row4, row5
It is possible to do that by using a cursor, But cursors are not efficient and they are usually being used when there is no simpler alternative. This script shows how to so that faster and shorter:
-- Create the table and insert values
Create table #a (name1 varchar (20))
Insert into #a values ('Ali')
Insert into #a values ('Albert')
Insert into #a values ('Alan')
Insert into #a values ('Al')
Insert into #a values ('Alex')
-- Here is the actual script:
DECLARE @SUM varchar(255),@delimiter CHAR(2)
SET @delimiter = ',' -- Can also be: char(13) + char(10)
SET @SUM = NULL
SELECT @SUM = COALESCE(@SUM + @delimiter,'') + name1 from #a
Select @SUM as Aggregated_String
Here is the result of running the script:
Aggregated_String
—————————-
Ali, Albert, Alan, Al, Alex
I use this little cheat sheet to remember XmlTextReader class details.

Click to see larger size, It is a little big.
I had hard time trying to remove horizontal scrollbar from IFrames that I had on my first page. Then, I found this article on Macromedia site from Jolantha Belik. It explains possible reasons for IFrame’s redundant horizontal scrollbar and their remedies.
I had enough from DCOM during COM days. That’s why I like this Humor at TheServerSide.NET:
Humor: The Top Ten Reasons .NET is Better than COM
Some times I need to know which stored procedure uses a specific table. I simply use this query:
SELECT * FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE ‘%TheTableName%’
Similarly, we can use INFORMATION_SCHEMA.COLUMNS view to know which table contains a specific column name
If you know more interviews, please send me the link.
A Conversation with Anders Hejlsberg by Bill Venners with Bruce Eckel
Programming in C#, Interview with Andres in MSDN .NET Show
O’RIELY:Deep Inside C#: An Interview with Microsoft Chief Architect Anders Hejlsberg
I am more kind of .NET guy, but I always whach how the two technologies compet with each other. To me it’s more like wtching a soccer play! Here are some nice articles:
Virtual PC is a great product, but it gave me hard time when I was installing RedHat Linux on it. The problem is the default color resolution on RedHat is 24 bit and Virtual PC cannot handle 24 bit color depth, Therefore it shows a fuzzy screen when you run KDE desktop.
The solution stated in Microsoft kb 824513 can be simplified. Here is my simplified solution:
Solution 1) During the installation, choose customize graphic configuration then choose “16 Bit” as the color depth. This is a snapshot of the screen:

Click to see larger size
Solution 2) After the installation, if the screen is fuzzy, so you can’t read contents. Here are the steps:
- Press Left{Control-Alt}-1, Linux switches to the first text terminal
- It prompts for login, Login as root.
- Edit /etc/X11/XF86Config (like vi /etc/X11/XF86Config)
- In the section .., change the DefaultDepth to 16
Here is a screen shot:

Click to see larger size
These are very nice articles about Data Structure. They remind me school days. It is good to have data structure articles from C# prespective:
When ASP.NET encounters an error and stop during processing a page that opens a data file, any attempt to edit the file pops up the above error message! That means some process have the data file open and doesn’t allow you to touch it.
The solution is murdering ASP.NET worker process, aspnet_wp.exe, through Windows Task Manager. The worker process starts again upon next page request; however the application will be restarted. That is all session variables will be lost!
April 2007 Update: Today I use Ulocker to take care of all annoying sharing violation pop-ups!