June 24, 2003

Determine the Last Day of the Month

This can be accomplished with just one line of code: FindEOM = DateSerial(Year(ADate), Month(ADate) + 1, 0) Setting the day parameter of DateSerial to 0 always returns the day prior to day 1, which is the end of the previous month.

A Useful Retrieval Procedure

This procedure retrieves the table name, table id, column or fieldname, data type, the length of the field in bytes, and the order in which the fields were created. I use it as a data source for my MS Access utility. I also use it to get needed project development

Sending Email Through a Stored Procedure in SQL Server 2000

Use this stored procedure to send an email: DECLARE @SenderAddress varchar(100)DECLARE @RecipientAddress varchar(100)DECLARE @Subject varchar(200)DECLARE @Body varchar(8000)DECLARE @oMail int –Object referenceDECLARE @resultcode intSET @SenderAddress = ‘[email protected]’SET @RecipientAddress= ‘[email protected]’SELECT @Subject = ‘subject of email for today ‘ + CAST(getdate() ASvarchar(12))SET @Body = ‘This is the body of my email’EXEC @resultcode =

Change the Read-only Permissions of a File (JDK 1.2.2)

Use this code to change the read-only permissions of a file in JDK 1.2.2: public void changeFilePermission(){ String osName = System.getProperty(“os.name”); try{ if (osName.equalsIgnoreCase(“WINDOWS NT”) ||osName.equals(“Windows 2000”) ) { Runtime.getRuntime().exec(“cmd.exe /c attrib -r *.*”); }else{ Process Proc = Runtime.getRuntime().exec(“command.com /Cattrib -r *.*”); } Thread.currentThread().sleep(100); }catch(Exception e){ System.out.println(e.getMessage()); } }

The Trim Function in JavaScript

JavaScript doesn’t have a trim to strip the spaces around strings. This little bit of code uses regular expressions to strip the spaces around given input. function trim(input){ var lre = /^s*/; var rre = /s*$/; input = input.replace(lre, “”); input = input.replace(rre, “”); return input;}

A Design for a Large Project Containing Unicode String

It has been stated before that hard-coded, literal strings are to be avoided. I disagree. There is an easy, convenient way to handle hard-coded, literal strings: use a macro directly in the code. Take a look: const char *msg1 = _LIT( _T(“hello”), HELLO ); The _LIT macro is designed to

Learn to Consume RSS Using DevX’s New Content Feeds

SS (Really Simple Syndication) feeds are an easy way for organizations to distribute content. At the most basic level, an RSS feed, or channel, is an XML document containing a list of titles, descriptions, and links to content. Any client that can parse XML can read and format the content

How to Double Image Size

Use the following code to scale an image into double its original size: import java.applet.*;import java.awt.*;import java.net.*;public class ScaleImage extends Applet{ Image img; public void init() { try { img = getImage (new URL(getDocumentBase(),flo.jpg)); }catch (MalformedURLException e) { System.out.println(URL not valid:+e); } } public void paint (Graphics g) { g.drawImage(img,0,0,img.getWidth(null)*2,img.getHeight(null)*2,this);