The techie in me RSS 2.0
 Saturday, October 02, 2010

I am sure that most you have read this in the MSDN documentation, it appears almost everywhere. Recently while brainstorming about a deadlock issue in our project someone raised this topic. ‘Public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe’, and claimed that all Framework type static instances are thread safe.

My opinion is this is bit misleading. This doesn't mean that all type in .NET framework are thread safe in static instance, nor that all static instance of any type is thread safe. If you think for a sec, nothing is thread safe by default, the author has to make a type thread safe, in this case MS has taken the time to verify that they are thread safe (which is very easy if they don't touch shared data). So it is your responsibility to make your class/type is thread safe.

I am sure MS is aware of this confusing statement. In old days it used to be only the two sentences in documentation (as above), but now you can see they are elaborating it bit more. Check here documentation for Array

And check this out, Thread Safety for TaskFactory says,

All public and protected members of TaskFactory are thread-safe and may be used concurrently from multiple threads

Hope that helps.

 

Rujith

Saturday, October 02, 2010 10:23:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Coding | Everything
 Monday, August 30, 2010

Recently I was trying to find duplicate records in a table. The records are considered duplicate if two columns in different records has the same value. For example if first name and last name is same in record1 and record2, they considered as duplicate.

The below query will help to find the duplicate records.

SELECT fname, lname, COUNT(*) AS DuplicateCount FROM [Users]
GROUP BY fname, lname HAVING COUNT(*) > 1
ORDER BY COUNT(*), fname.

 

(I know this is pretty simple one, but most of the time you struggle for the simplest query :) so thought of sharing it)

Monday, August 30, 2010 10:13:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [1] -
Database
 Friday, July 23, 2010

I recently found a nice free icon editor called IconFX.  Its really cool and very lightweight, you can simply use the exe no need to install. That’s surprise in this world when you have install (and sometimes reboot ) every single piece of software isn't it ?

Try it out… http://icofx.ro/

Thursday, July 22, 2010 11:17:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Everything
 Saturday, April 10, 2010

String.Replace is not case insensitive, so what is the best way to do it. There are several ways, if I think of the quickest one it is using regex.

using System.Text.RegularExpressions;string 
string str = "The quick brown Fox jumps over the lazy dog";
string strReplace = "cat";
string result = Regex.Replace(str, "fox", strReplace, RegexOptions.IgnoreCase);

-Rujith

 

Saturday, April 10, 2010 10:18:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [1] -
Coding
 Monday, February 08, 2010

I had lot of trouble in my last project due the html body onload event. The aspx pages were relying lot on this event ( I agree its not the best way, but we don't have the budget and time for to rebuild the entire site). These sites were AJAXyfied recently using Telerik RadControls, and were not working in FireFox. I must admin Telerik controls are really good, its makes your job very easy in AJAX world. Though I don't like their quarterly release idea. YES, they release a new version every quarter...

So the problem in AJAX is, the page can be loaded asynchronously, so when the onload event on the body is fired the controls may not be ready, so you get null exceptions.

The best way I found is to use the built in ‘pageLoad()’ method(this is a reserved method). This will be called once all AJAX load events are finished. Remember you can use this only in AJAX pages. Also this is consistent in different browsers. (If you are going with FireFox you have to use window.load=function() instead onload=function())

Coding is fun

-Rujith

Monday, February 08, 2010 12:32:00 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Coding
 Sunday, February 07, 2010

Maximum request length matters when you want to allow upload/download of large files.

This is one of the major change in IIS7. In previous version the default is 4MB, in IIS7 its 28.6MB. So when you deploy your ASP.NET application you will see that it will work for files larger than 4MB, but will give as soon as you cross the 28MB.

In IIS 7, the attribute has been changed to maxAllowedContentLength and it has to appear in <system.webServer> section (as for all IIS 7 settings). The complete attribute will look something like this…

<system.webServer>
<
security > <requestFiltering> <requestLimits maxAllowedContentLength="3072000000" /> </requestFiltering> </security>

 

Sunday, February 07, 2010 12:18:00 AM (GMT Standard Time, UTC+00:00)  #    Comments [1] -
Coding | WCF
About me
Name : Rujith Anand Send mail to the author(s)
Archive
<October 2010>
SunMonTueWedThuFriSat
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456
Blogs I read
Disclaimer

Disclaimer
Postings are provided as is with no warranties, and confer no rights. Opinions expressed here are my own delusions; my employers at best shake their heads and sigh, at worst repudiate the content with extreme prejudice, whenever it manages to appear on their radar.

© Copyright 2012
Rujith Anand

Statistics
Advertisement
All Content © 2012, Rujith Anand