Itz great to see Jason Haley recommendation; my name is listed along with my favorite techie Somasegar, Scott, etc
Saturday, July 31, 2010
Motivation
Itz great to see Jason Haley recommendation; my name is listed along with my favorite techie Somasegar, Scott, etc
Go Green Google
Blackle is a website powered by Google Custom Search, which aims to save energy by displaying a black background and using grayish-white font color for search results.
The concept behind Blackle is that computer monitors can be made to consume less energy by displaying much darker colors. Blackle is based on a study which tested a variety of CRT and LCD monitors. There is dispute over whether there really are any energy saving effects. This concept was first brought to the attention of Heap Media by a blog post, which estimated that Google could save 750 megawatt hours a year by utilizing it for CRT screens.[1][5] The homepage of Blackle provides a count of the number of watt hours claimed to have been saved by enabling this concept.
Statistics on power savings on the various LCD Models are listed in the attached image.
To read about blackle, plz visit at 'http://www.blackle.com/about/'
Sunday, July 25, 2010
Sealed Class
Sealed Class is the class which can not be inherited.the members/methods in the sealed class can not be derived from any other class. A compile-time error occurs if a sealed class is specified as the base class of another class. By default, structs are sealed; not classes in .NET
~~~ Sealed class benchmark results (C#) ~~~
See "Benchmark" section for the code compared.
TestA.GetNumber (regular): 2.490 ns
TestB.GetNumber (sealed): 2.162 ns [faster]
So, the keyword sealed provides a way to demand that the class not to be inherited from, but it is also useful for performance optimization.
Sunday, July 18, 2010
readonly preferance
C# has two versions of constants. They are compile timed 'const' and run timed 'readonly'. As named, const variables are replaced with the value of that constant in the object code. But readonly constants are evaluated at runtime; they are referenced with IL( Intermediate Language) generated variables not the value. Compile time constants can be used only for primitive types.
readonly for instance constants are used to store different values for each instance of a class type. Compile time const are static constants by definition
// compile time
public const int Millennium = 2000;
// run time
public static readonly int thisYear = 2010;
Advantage of using const over readonly is performance, where as readonly prefers the increased flexibility due to runtime compatability constants.
Thursday, July 8, 2010
MSDTC-Transaction Controller
On writing an .NET application with multiple LINQ insert/update statements TransactionScope is useful.
Letz say we are inserting EmployeeInfo table, then EmployeeSalaray table, followed by EmployeeAttendance table.
When the application completes all work it wants to perform in a transaction, Complete method informs transaction manager that it is acceptable to commit the transaction. Failing to call this method aborts the transaction. Isn't it cool?
But, I got an error '[System.Transactions.TransactionManagerCommunicationException] during TransactionScope execution. On analysis, it has been found Network access for Distributed Transaction Manager (MSDTC) has been disabled by default in XP. MSDTC is a transaction manager which permits client applications to include several different sources of data in one transaction, and which then coordinates committing the distributed transaction across all the servers that are enlisted in the transaction.
To resolve this issue, MSDTC is enabled via 'Control Panel->Administrative Tools->ComponentServices->MyComputer' MSDTC properties. You need to click on Security Configuration button under Transaction Configuration panel. In that section, enable 'Network DTC Access' After this setup, my application runs smoothly and TransactionScope is successful.
Subscribe to:
Posts (Atom)