devxlogo

The Latest

Define JNI Functions and Convert Java Parameters to C++ Parameters in VC++

Include the following definition: #include The function definition goes like: JNIEXPORT jboolean JNICALL MethodName( JNIEnv *env,/*env variable: must*/ jstring functionId,/*String variable*/ jobject objectId/*Object variable*/){ const char *str = env->GetStringUTFChars( functionId,

Find Missing Numbers in a Sequence

There are several cases where you may write algorithms only to find missing numbers in a sequence. There is an efficient way to do this. Let’s say you have a

How to Read a Value from a Registry?

You can read a key from a particular path in registry by using the RegQueryValueEx function. The following piece of code reads a particular key under HKEY_LOCAL_MACHINESoftwareDevx: void GetKeyValue(char *key,

Hit a Website from the Command Line Repeatedly

Here’s the code: public class IncreaseCounter { public static void displayURL(String url) { boolean windows = isWindowsPlatform(); String cmd = null; try { if (windows) { // cmd = ‘rundll32

Has Sun Given Up on the Desktop?

ava is no longer the new kid on the block. Its original promises are no longer “wait and see” propositions. We have waited. We have seen. And though I could

An Easier Way to Trap Exceptions

Exception handling can be a real chore Related Posts Why Your Proprietary Software and Your Open Source Software Need Separate Brand NamesUnderstanding Memory Availability and UsageSkip Weekends SQL FunctionUsage of

Solving Global Namespace Clashes

The C++ language provides a single global namespace. This can cause problems with global name clashes. For instance, consider these two C++ header files: // file1.hfloat f ( float, int

ASP Message Board

This is an ASP based Message Board. It is driven by a SQL Database and it supports attachments (uploads are handled by SoftArtisan FileUP component, but it can be easily

Resolve an internet host address

The System.Net.Dns class exposes a few static methods that let you resolve an internet domain name – such as www.vb2themax.com – into a 4-part numeric IP address, also known as

A cheap way to display files and hex data

The .NET framework includes a ByteViewer control, that you can use on your own forms to display data stored in a Byte array or in a file. The ByteViewer control

Right-align formatted strings

The String.Format function supports many formatting options, but none allows you to display right-aligned columns of numbers, as in: 1.00 12.00 123.00 1,234.00 However, you can easily create a helper

GetDriveTypeEx – Detect drive type, including CD or DVD driver

Private Type DEVICE_MEDIA_INFO Cylinders As Double MediaType As STORAGE_MEDIA_TYPE TracksPerCylinder As Long SectorsPerTrack As Long BytesPerSector As Long NumberMediaSides As Long MediaCharacteristics As LongEnd TypePrivate Type GET_MEDIA_TYPES DeviceType As Long

Centralize ASP.NET settings in one file

Although ASP.NET lets you distribute web.config files over all the application’s subdirectories, it surely doesn’t force you to do so. You can keep all the application settings in its main

Add exception tracing with one line of code

At times you want to keep a log of all the exception occurred in your application, including those that are correctly caught by a Catch block. At first you might

Use custom error pages in ASP.NET

The tag in ASP.NET configuration files affects how error pages are managed in an ASP.NET application and whether developers can redirect users to their custom error pages when an exception

Reduce Server Too Busy errors with the httpRuntime tag

The httpRuntime tag in ASP.NET configuration files lets you determine several features of ASP.NET at the machine or site level, including the how ASP.NET uses multi-threading. Here’s the complete syntax