devxlogo

Tip Bank

A Cleaner Way of Doing String Comparison

If you have a method into which you pass a String parameter that you compare with another string then: void foo( String str ){ String CONST_STR = “bar”; // DON’T

Debugging Variables Made Easy

At one time or another, all ASP progrmmers have used RESPONSE.WRITE to write out a variable on the screen, ensuring that the variable is passing correctly or has the correct

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,