June 30, 2003

Scaling Out With Object-Relational Mapping on .NET

long with the proliferation of the Internet and large-scale intranets, the requirements of enterprise applications have evolved. Launching a service in an expanding enterprise could put an ever-increasing load on the application forcing more server resources to be added to be able to sustain a reasonable user experience. You are

ChangeDriveIcon – Changing the icon of a drive

‘ Change the icon of a drive’ Example: ChangeDriveIcon(“d”, “c:myicon.ico”)Sub ChangeDriveIcon(ByVal driveLetter As String, ByVal icoPath As String) ‘ create the parent key Dim regKey As Microsoft.Win32.RegistryKey = _ Microsoft.Win32.Registry.LocalMachine.CreateSubKey( _ “SoftwareMicrosoftWindowsCurrentVersionExplorerDriveIcons” & _ driveLetter & “DefaultIcon”) ‘ set the (Default) value with the icon’s path regKey.SetValue(“”, icoPath) regKey.Close()End Sub’

Ask a Yes/no question and return a Boolean

‘ Ask a Yes/no question’ returns True if the user replies “Yes”‘ Example: MessageBox.Show(AskYesOrNo(“Do you like me?”, “ME”, True))Function AskYesOrNo(ByVal text As String, ByVal title As String, _ ByVal defaultAnswer As Boolean) As Boolean Dim defButton As MessageBoxDefaultButton = MessageBoxDefaultButton.Button2 If defaultAnswer Then defButton = MessageBoxDefaultButton.Button1 End If Dim answer

Print3D – Drawing a text with 3D effect

‘ Display a text with 3D effect” g: a Graphics object’ text: the text to be displayed’ coords: the Point with the X and Y coordinates’ col: the text color’ fnt: the text font’ shadowCol: the shadow color (default is black)’ shadowOffsetX, shadowOffsetY: the shadow distance of shadow in pixels

SemiCRC – A fast CRC-like algorithm

‘ Evaluate the 16-bit Checksum of an array of bytesFunction SemiCRC(ByVal source() As Byte) As Integer Dim crc, temp As Integer, i As Long Const divisor As Integer = 32768 For i = 0 To source.GetUpperBound(0) temp = 0 If crc divisor Then temp = 1 crc = (((crc *

ShowOpenWithDialog – Displaying and opening a file through the “Open with…” dialog

‘ Display the “Open with…” dialog and open the specified file with the ‘ selected program’ Example: ShowOpenWithDialog(“d: est.txt”) Shared Function _ ShellExecute(ByVal hwnd As Integer, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Integer) As IntegerEnd

IncrementString- Incrementing the numeric right-most portion of a string

‘ Increment the numeric right-most portion of a string’ Example: MessageBox.Show(IncrementString(“test219”)) ‘ => 220Function IncrementString(ByVal text As String) As String Dim index As Integer Dim i As Integer For i = text.Length – 1 To 0 Step -1 Select Case text.Substring(i, 1) Case “0” To “9” Case Else index =