Quantcast
Channel: api Feed
Browsing all 20 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

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 Article



Image may be NSFW.
Clik here to view.

Apache 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 Article

Image may be NSFW.
Clik here to view.

How to create PDF file using Java API?

This snippet shows how to created a empty PDF file using the PDFBox Apache Framework.

View Article

Image may be NSFW.
Clik here to view.

Understanding 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 Article

Image may be NSFW.
Clik here to view.

Find 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 Article


Image may be NSFW.
Clik here to view.

Invoke 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 Article

Image may be NSFW.
Clik here to view.

What 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 Article

Image may be NSFW.
Clik here to view.

What 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 Article


Image may be NSFW.
Clik here to view.

Java Language Fundamentals Interview Guide

This guide provides a list of Interview Questions related to core Java Language fundamentals.

View Article


Image may be NSFW.
Clik here to view.

How 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 Article

Image may be NSFW.
Clik here to view.

How 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 Article

Image may be NSFW.
Clik here to view.

How 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 Article

Image may be NSFW.
Clik here to view.

Programmatically 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 Article


Image may be NSFW.
Clik here to view.

How 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 Article

Image may be NSFW.
Clik here to view.

No 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 Article


Image may be NSFW.
Clik here to view.

Find 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 Article

Comparator 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 Article


Image may be NSFW.
Clik here to view.

Using 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 Article

Image may be NSFW.
Clik here to view.

Using 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 Article

Image may be NSFW.
Clik here to view.

How 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
Browsing all 20 articles
Browse latest View live




Latest Images