The Latest

DevX - Software Development Resource

Using Types as Template Parameters

A template can take ordinary types such as int and long as parameters: template class Array // type int used a parameter {/* Related Posts API Resource groupPIVOTing Data in

DevX - Software Development Resource

Event Thread and Painting

Java uses the event thread to notify listeners of events by making calls to methods such as actionPerformed() and itemStateChanged(). However, this same thread is also responsible for repainting components.

DevX - Software Development Resource

Displaying Native SQL

Java Database Connectivity (JDBC) drivers sometimes perform conversions on Structured Query Language (SQL) statements that you execute before sending them to the database. It can be helpful for debugging purposes

DevX - Software Development Resource

Call Functions by Name

JavaScript has a powerful mechanism to create and execute code on the fly using the eval() statement. This statement takes a string as a parameter. This string is then run

DevX - Software Development Resource

Using Roles Properly

SQL Server 7 has taken great strides in improving its security model. Groups have been done away with and replaced by roles. The practical difference lies in the fact that

DevX - Software Development Resource

Use the right type for constants

VB stores symbolic and literal constants internally using the simplest data type possible; this means that most common numeric constants-such as zero or one-are stored as Integers. If you use

DevX - Software Development Resource

Use Sleep API to add pauses to your programs

Don’t use an empty For…Next loop to add pauses to your programs; instead, use the Sleep API function, that releases the CPU and lets other apps in the system effectively

DevX - Software Development Resource

GoSub are slower in compiled programs

In VB applications compiled as native code, GoSubs are 5-6 times slower than calls to regular Subs or Functions; conversely, in p-code they are considerably faster. This is one of

DevX - Software Development Resource

Upgrade to the most recent Service Pack

OK, this is a silly suggestion, but I personally know a lot of developers that complain about Visual Basic’s bugs that were fixed in more recent Service Packs. This is

DevX - Software Development Resource

And is faster the Mod

Use the And operator instead of Mod when the divisor is a number in the form 2^N. For instance, there are two methods to extract the least significant byte in

DevX - Software Development Resource

Always declare objects with full library name

If your application uses objects from external components, either third-party or your own libraries, a good rule of thumb is to include the complete servername.classname string in the Dim statement,

DevX - Software Development Resource

ProjectName – The name of the current project

‘ Returns the name of the current project’ The first time it’s called it clears the error code’Function ProjectName() As String Static result As String If Len(result) = 0 Then

DevX - Software Development Resource

Ceiling – The integer equal or higher than a given value

‘ Returns the integer equal or higher than its argumentFunction Ceiling(Number As Double) As Long Ceiling = -Int(-Number)End Function Related Posts Tower Semiconductor Submits New Wafer Facility ProposalSuper micro computer

DevX - Software Development Resource

Use integer division operator

Use “” instead of “/” when performing divisions between Integers. The “/” operator returns a Single value, therefore the seemingly efficient line C% = A% / B% actually requires three

DevX - Software Development Resource

Where on Earth is an Add-ins’s Description

Every now and then someone asks me “How can I modify the default description that is associated to an add-in I have written and that appears in the Add-In Manager?

DevX - Software Development Resource

Reduce the number of DoEvents

Don’t fill your code with unnecessary DoEvents statements, especially within time-critical loops. If you can’t avoid that, at least you can reduce the overhead by invoking DoEvents only every N

DevX - Software Development Resource

GetShortFileName – Convert a filename to 8.3 format

Private Declare Function GetShortPathName Lib “kernel32” Alias _ “GetShortPathNameA” (ByVal lpszLongPath As String, _ ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long’ Convert a long filename into the

DevX - Software Development Resource

Hide the Automation Manager

If you haven’t switched to DCOM yet, and still use Remote OLE Automation, you must launch the Automation Manager program on the server machine, in order to let the server

DevX - Software Development Resource

Topmost windows

This is an evergreen, but it’s still popular. It is very easy to create a window that always stays on top of the others, thanks to the SetWindowPos API function.

DevX - Software Development Resource

Plug the Security Holes

We all know to keep the sa password secret and to share it with as few people as necessary. However, users see no problem with registering their server in Enterprise