devxlogo

The Latest

More Efficient LPad Function for Large Padding Lengths

function LPad(ContentToSize,PadLength,PadChar) { return GetRepeatedCharString(PadChar, PadLength -ContentToSize.length) + ContentToSize;}function GetRepeatedCharString(Char, Size) { if (Size < 1) return ""; else if (Size == 1) return Char; else return GetRepeatedCharString(Char, Size /

Generate a Script-name Independent HTML Form

This tip is useful for large, server-side scripts containing lots of functions/procedures that generate HTML forms. Say you’ve hardcoded the script name (for the same script) in the ACTION tag

Find the Encryption Algorithm Used in SSL Requests

Servlet 2.3 provides an API that finds the algorithm used a Web app’s SSL requests. The attribute “javax.servlet.request.cipher_suite” is provided to get the information.Here’s the code: String cipherAttribute = “javax.servlet.request.cipher_suite”;String

How to Trim a Method in Javascript

/** * Function that will remove the leading and trailing spaces. */function trim(str){ return( rtrim(ltrim(str)));}/** * Function that will remove the trailing spaces. */function rtrim(str){ re = /(s+)$/; return str.replace(re,

CUSerFunction utility class

This VB6 class contains three methods for querying the name and group of the current Windows NT user: IsAdmin (true if the user is an Administrator), IsNTGroupMember (true if the

CreateDataReader_OleDb – Create an OLEDB Data Reader

‘ return a DataReader over an OleDbConnection” CONNSTRING is the connection string’ SQL is the SQL Select statement to be executed” the connection will be automatically closed when the DataReader

Copying menu controls from one form to another

If you’re building a project with multiple similar forms, it’s nice to be able to cut-and-paste controls from one form to another. However, in VB6, you can’t do this for

VB6 Task Management Add-in

This VB6 add-in provides you a handy project management console that helps you to track the bugs and pending tasks of the source code. You can mantain the list of

Determine whether a string is uppercase

Here’s a quick-and-dirty method to determine whether a string contains only uppercase characters ‘ the string to test is in the SOURCE variableIf System.Text.RegularExpressions.Regex.IsMatch(source, “^[A-Z]+$”) Then Console.WriteLine(“Uppercase string”)End If If

Determine whether a string is lowercase

Here’s a quick-and-dirty method to determine whether a string contains only lowercase characters ‘ the string to test is in the SOURCE variableIf System.Text.RegularExpressions.Regex.IsMatch(source, “^[a-z]+$”) Then Console.WriteLine(“Lowercase string”)End If If

VBMatch Add-in

When installed, this add-in adds an entry to the right-click menu in VB code window. You can then select or right-click on opening parenthesis or quotation mark or VB keyword,

Multitasking in a serial world

Many applications can benefit from using lazy processes or running routines in the background inside a single VB application. Designing a TaskThat was the fifty cent tour of what the

Hex – Convert from decimal to hexadecimal

‘ convert from decimal to hexadecimal’ if you pass the Digits argument, the result is truncated to that number of ‘ digits” you should always specify Digits if passing negative

IsValidEmail – Validate an email address

Function IsValidEmail(ByVal Value As String, Optional ByVal MaxLength As _ Integer = 255, Optional ByVal IsRequired As Boolean = True) As Boolean If Value Is Nothing OrElse Value.Length = 0

Hex2Dec – Convert from hexadecimal to decimal

‘ convert from hexadecimal to decimalFunction HexToDec(ByVal value As String) As Long ‘ we just need a call to the Convert.ToInt64 static method Return Convert.ToInt64(value, 16)End Function Related Posts How