Why Not to Use an Exit Within a Loop
This recent tip gives advice on how to include an exit within a loop to avoid repeated code. While avoiding repeated code is prudent, using an exit from a loop
This recent tip gives advice on how to include an exit within a loop to avoid repeated code. While avoiding repeated code is prudent, using an exit from a loop
The following function finds out how many times a string is found inside another string: create function fnOccurances (@string varchar(8000),@pattern varchar(4000)) returns smallint asbegin declare @i int declare @counter int
This VB function returns the DNS domain name (westcoast.mycorp.com) from the passed LDAP distinguishedName (CN=Administrator,DN=Users,DC=westcoast,DC=mycorp,DC=com). Function DN2DomainName(ByVal strDN As String) On Error Resume Next Dim strDomainName As String Dim strDNParts()
Because everything in Linux is composed of files, you can get any required information from the /proc/meminfo file. Here’s the code: int getFreePhysicalMemory(){ ifstream meminfo(“/proc/meminfo”); if ( ! meminfo.is_open() )
Overloading a constructor or a method so it takes an extra argument based upon some specific requirement can result in duplicate code. For instance, a project that contains a lot
You may have found that sometimes, copying a custom .NET object to the clipboard doesn’t work. That’s because retrieving a custom object from the clipboard returns nothing if the object
The following code demonstrates how to use sun.misc classes for Base64 image conversion: import java.io.*;import java.awt.*;import java.awt.event.*;class Base64Example extends Frame implements ActionListener{Image IMG=null; //image1Image IMGdecode=null; //image2-resultTextArea TA=new TextArea(); //printing the
To implement the GetTickCount API when porting code from Windows to Linux, use the following code: long getTickCount(){ tms tm; return times(&tm);}
To display the shortcut menu, you call ContextMenu.Show() method. Typically, you call this method if the right mouse button on a control or area of the form is clicked. The