November 12, 2008

Create XML from an Array

Passing arrays as arguments to stored procedures is not currently possible in SQL Server, but you can use XML to accomplish this. To do this, you need to create an XML string using your preferred language (C#, VB, etc.). You can use the following function to convert an array to

Determine the Version of .NET on a Client PC Using JavaScript

Use the following JavaScript to determine which .NET version is on a client PC: &ltscript language=”JavaScript” type=”text/javascript”&gtvar a = navigator.userAgent.match(/.NET CLR [0-9.]+/g);if (a == null) document.write( “.NET Framework(s) is not installed” )else{ document.write( “The following versions of .NET Frameworks are installed:” ) for (i = 0; i < a.length; ++i)

Minimize Flickers in Windows Forms

Users often experience flickers when loading forms or during other operations. To minimize this flickering, enable double buffering on the form, as illustrated below: // Activates double buffering this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);this.UpdateStyles(); When DoubleBuffer is set to true, drawing is performed in a buffer. After it

Utilizing a Multi-Core System with the Actor Model

typical multi-threaded application in Java contains numerous synchronized methods and statements. They might also contain calls to the methods wait() and notify() that were introduced with Java 1.0, but these methods provide very primitive functionality and are easily misused. Java 5 introduced the java.util.concurrent package, which provides some higher-level abstractions

Make an Immutable Class

The following code shows how to make an immutable class: package com.test;final class TestImmutable{// instance var are made private to restrict the access // and final to not get reassigned private final int var1; private final double var2; public TestImmutable(int paramCount,double paramValue) { var1= paramCount; var2 = paramValue; }// Only