August 20, 2002

Comparing Two Date Objects in JavaScript

This is a very handy and easily understandable code. There are two different methods, depending upon the type of data that is required as input to the functions: function CompareDatesOne(firstdate,seconddate){ //assuming firstdate and seconddate are //java script date objects if(firstdateseconddate){ alert(“First date is more then Second Date”); }else{ alert(“The dates

The Benefit of Using the For-Next Loop over the While-Wend Loop

We all know that the For-Next and While-Wend loops execute statement(s) as long as the loop condition is true. However, there is a difference between the two. A loop condition is checked each time the While-Wend loop executes/iterates, whereas this is not the case with the For-Next loop (Loop condition

Running DOS Commands in SQL Server Query Analyzer

If you run this statement In SQL Server Query Analyzer: EXEC master..xp_cmdshell ‘dir *.exe’ You will get the result as DOS DIR Command. Using this, you can run all DOS commands. A sample result looks like this: 09/21/01 08:25a 26,384 actmovie.exe09/24/01 10:07a 118,032 addgrpw.exe09/21/01 08:25a 155,920 addusrw.exe10/14/96 07:08a 10,774 append.exe04/29/99

Extract a Character in a String to the Left or Right

The following functions are used to extract the character in the string to the left or to the right. Left(), Right() functions are not available in Javascript. function Left(str, n){ if (n String(str).length) return str; else return String(str).substring(0,n);}function Right(str, n){ if (n String(str).length) return str; else { var iLen =

Download Files of Any File Type

You may encounter a situation where you need to open a “Save As” dialogue box for downloading files of different types on to the client machine. You might have found code snippets using FileSystemObject. These are limited to text files only and they make trying to find the file type

Validate an Email Address

Below is a VB Script example of how to validate an email address using Regular Expressions:

Send Mail Using a VC++ Application

Import the complete path of the following files in your application using the #import statement: MSO9.DLL msoutl9.olb HRESULT hr;CComBSTR inputStr;inputStr = CString(“MAPI”).GetBuffer(0);CoInitialize(NULL);Outlook::_ApplicationPtr xyz(“Outlook.Application”);_bstr_t name(inputStr, true);Outlook::_NameSpacePtr nsp = xyz->GetNamespace(name);CComBSTR cTo = CString(“[email protected]”).GetBuffer(0);CComBSTR cCC = CString(“[email protected]”).GetBuffer(0);CComBSTR cBody = CString(“this is a test mail”).GetBuffer(0);CComBSTR cSub = CString(“this is a test mail”).GetBuffer(0);_bstr_t to(cTo, true);_bstr_t

Insert Values into a Table with a Single Query

There will always be situations when you need to insert a record in a table, but the data needs to be collected from other tables present in the database itself. These insert queries replace the need for first getting the values in temporary variables and firing the new insert query.

Explore the File System from T-SQL

The Indexing Service should be started before using the following code.The File content search relies on the Microsoft OLE DB Provider for the IndexingService. The following query lists all the files that are in the path “D:Test”: EXEC sp_addlinkedserver MyFileSystem, ‘Index Server’, ‘MSIDXS’, ‘System’SELECT * FROM OpenQuery(MyFileSystem, ‘SELECT Directory,FileName FROM

No more posts to show