Apache DBCP Pooling Driver Example
Here's a simple example of how to use the PoolingDriver. In this example, we'll construct the PoolingDriver manually, just to show how the pieces fit together, but you could also configure it using an...
View ArticleApache DBCP Pooling Datasource Example
Here's a simple example of how to use the PoolingDataSource. In this example, we'll construct the PoolingDataSource manually, just to show how the pieces fit together, but you could also configure it...
View ArticleHow to create PDF file using Java API?
This snippet shows how to created a empty PDF file using the PDFBox Apache Framework.
View ArticleUnderstanding Java Shutdown Hook
The JVM provides the capability to add Shutdown hooks at Runtime. This shutdown hooks can be used to perform any resource cleanup or save state as required just before the JVM shuts down either...
View ArticleFind the Calling Method in Java?
This snippet shows how to write a method whoCalledMe() which would be used to find the calling method. This example leverages the fact that the JVM maintains a stack wherein, it adds the method names...
View ArticleInvoke a method of class using Java Reflection API
This snippet shows how to invoke a method of class using Java Reflection API. The example uses a class called TargetClass that has a instance method named as runMe(). Now from the main method, this...
View ArticleWhat is Static Classloading in Java?
The JVM creates class loaders that loads the classes as required during program execution. Whenever a class that is declared with the new keyword in the code, that class will be statically loaded by...
View ArticleWhat is Dynamic Class Loading In Java?
The JVM creates ClassLoaders that loads the classes as required during program execution. In case of Dynamic classloading, a class is loaded programatically instructing the ClassLoader to load it via...
View ArticleJava Language Fundamentals Interview Guide
This guide provides a list of Interview Questions related to core Java Language fundamentals.
View ArticleHow to zip folder using Java?
Building a utility like Winzip is easy in Java, thanks to java.util.zip package.Basically we need to open a ZipOutputStream which is created on top of FileOutputStream, then loop through all the files...
View ArticleHow to extract a zipped file using Java?
Building a Zip utility like Winzip is easy in Java, similarly building a unzip tool is easy too, thanks to java.util.zip package.Basically in this case we need to open a ZipInputStream to reference...
View ArticleHow to construct DOM and convert to XML?
Constructing DOM (Document Object Model) to generate or represent XML is easy. The basic steps are as follows > Create the XML Document object using the Document Builder Factory.>Build your...
View ArticleProgrammatically Toggle Function Keys
The function keys of the keyboard Caps Lock, Num Lock and Scroll Locks keys can be turned on or off programmatically via the simple API available in the Toolkit class. This feature is very helpful in...
View ArticleHow to encode URL?
URLEncoder is the utility class for HTML form encoding is part of JDK API. This class contains static methods for converting a String to the application/x-www-form-urlencoded MIME format. Custom...
View ArticleNo Such Object (LdapException)
This exception normally happens when we try to add/delete/update an entry in LDAP and no such entry exits.Caused by: LDAPException: No Such Object (32) No Such ObjectLDAPException: Server Message:...
View ArticleFind Files in Directory based on Extension
How about finding files of a given type (extension) in a given folder? The following snippets shows how to do so, it list all the files in the directory, then using Regex pattern it tries to match the...
View ArticleComparator for Primitive Types in Java
/** * Collected methods which allow easy implementation of equals. Example use case in a class called Car: * publicboolean equals(Object that) { if(this== that) returntrue;...
View ArticleUsing NSUserDefaults to store Settings in iOS
NSUserDefaults is one of simplest ways to store your configuration/settings of your iPhone/iPad application. You don't have to create a plist or work with the file system, it encapsulates all of...
View ArticleUsing NSError Explained
One of common ways for Error handling and error code propagation is the use of try/catch blocks to catch an exception and throw clause to throw an exception. Traditional programmers would prefer just...
View ArticleHow to convert Hex String to Bytes and viceversa in Java?
Converting from hex String from a byte array and vice-versa is not available a function as part of JDK. The following shows a implementation of such methods. For Hex to Byte Array , it loops through...
View Article
More Pages to Explore .....