Eek, this is pretty bad…. http://codebetter.com/blogs/sahil.malik/archive/2006/01/19/136771.aspx
Posts Tagged ‘Code’
.NET RTM 2.0 Bug
Posted in Everything, Software Development, tagged Code on January 19, 2006 | 1 Comment »
T-SQL Transactions
Posted in Everything, Software Development, tagged Code, SQL on December 8, 2005 | 2 Comments »
I do not confess to being a database expert, nor a guru in T-SQL, which is why I have only just found out how crap transactions in T-SQL on SQL Server 2000 can be. Take a look at the following piece of T-SQL: CREATE TABLE #Foo ( PK int NOT NULL ) CREATE TABLE #Foo2 [...]
Trapping Javascript Errors
Posted in Everything, Software Development, tagged Code, JavaScript on December 8, 2005 | Leave a Comment »
Jonathan Cogley posts a neat way to trap Javascript errors on a web page, followed by the firing of a server-side exception, so .NET code can be written to email the developer responsible. http://weblogs.asp.net/jcogley/archive/2005/12/07/432584.aspx
From C++ to C#
Posted in Everything, Software Development, tagged C#, Code on November 28, 2005 | 2 Comments »
I have gone back in time this week to work on a legacy ISAPI application. The ISAPI application is being developed in C++ and makes use of MSXML to read an XML configuration file. Below is some code in C++ to open the XML file and read two text values, contained in element nodes: BOOL [...]
String.IsNullOrEmpty
Posted in Everything, Software Development, tagged Code on November 10, 2005 | 1 Comment »
C# 2.0 Tip: You no longer need to write the following code: if (null != someString && someString.Length > 0) { … } Instead you can now just write the following: if (String.IsNullOrEmpty(someString)) { … }
Multicast Delegate Events as Properties
Posted in Everything, Software Development, tagged C#, Code on October 25, 2005 | Leave a Comment »
The saying goes “you learn something new every day”, and today is no exception. I’m not sure how I missed this, but never less, this post shows how to gain finer control over adding and removing of event handlers to public multicast delegate events. Typically, most C# developers are used writing event code as follows: [...]
LCG Performance
Posted in Everything, Software Development, tagged Code on October 12, 2005 | 1 Comment »
The following are the results of a performance test performed against LCGs, direct function calls, and reflection API invokes. Each test ran for a number of iterations and produced a mean average time in milliseconds. The efficiency of the dynamic method delegate (LCGs) calls are calculated as the direct method call time divided by the [...]
Reflection and LCG
Posted in Everything, Software Development, tagged Code on October 12, 2005 | 7 Comments »
Anyone who has played with .NET long enough will tell you that Reflection is a really cool feature. Essentially, reflection enables the developer to query the type system (CLT – Common Language Type system), dynamically invoke methods, and dynamically create types at runtime, using meta-data stored in the .NET assemblies. The reflection API is built [...]
Tech Preview: LINQ
Posted in Everything, Software Development, tagged Code on September 14, 2005 | Leave a Comment »
This morning I’ve been checking out LINQ – Language Integrated Query from Microsoft, on Channel 9. LINQ enables developers to query any IEnumerable<T> collection with a simple query, much like that of SQL. Check out the following piece of LINQ code, which queries all the non-static methods supported by System.String, and displays the number of [...]
C# 2.0 and the ‘yield’ keyword
Posted in Everything, Software Development, tagged C#, Code on September 13, 2005 | 6 Comments »
Another nice addition to C# 2.0 is the yield keyword. Yield enables iterator blocks to provide values to an enumerated result, see the following example. // yield-example.cs using System; using System.Collections; public class List { public static IEnumerable Power(int number, int exponent) { int counter = 0; int result = 1; while(counter++ < exponent) { [...]
