Browsed by
Category: Featured

Native Keyword / Calling C Program From Java

Native Keyword / Calling C Program From Java

You might have seen in Java API many methods are using native keyword. Lets understand them.

The native keyword is applied to a method to indicate that the method is implemented in native code using JNI.

Definition From JSR
A method that is native is implemented in platform-dependent code, typically written in another programming language such as C, C++, FORTRAN,or assembly language. The body of a native method is given as a semicolon only, indicating that the implementation is omitted, instead of a block.

Still looking more .. google it 🙂

Lets start with an example :

see this link

Stay Tuned… will post an example soon.

JavaScript Utility

JavaScript Utility

Below are few Java Script methods to help you.

Debugging in JavaScript:
Debugging in JavaScript is now become easier with modern browsers.But still you will be facing issues in many cases so the alternative can be writing print statments in javaScript (i.e. console.log(“Message”)).

But in IE browser if you console is not opened (it can be opened with Developer tools (F12)) then it will show function undefined error and will stop further javascript execution. To prevent this you can use console as below.

window.console && console.log (“Message To Log”);

Getting Param From URL
function getParam(name) {
name = name.replace(/[\[]/, “\\\[“).replace(/[\]]/, “\\\]”);
var regexS = “[\\?&]” + name + “=([^&#]*)”;
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if (results == null)
return “”;
return results[1];

Example :

You must either modify your dreams or magnify your skills …

getParam(“load”) will return true;

Reload the Page Native Method

Lot more come.. Stay tuned…

Twitter Bootstrap

Twitter Bootstrap

From Wiki
Bootstrap is a free collection of tools for creating websites and web applications. It contains HTML and CSS-based design templates for typography, forms, buttons, navigation and other interface components, as well as optional JavaScript extensions.
It is the most popular project on GitHub and has been used by NASA and MSNBC among others.

Bootstrap was developed by Mark Otto and Jacob Thornton at Twitter as a framework to encourage consistency across internal tools. Before Bootstrap, various libraries were used for interface development, which led to inconsistencies and a high maintenance burden.

Bootstrap website

Bootstrap is simple to use. Look at few examples .

Bootstrap come with many ready to use features. See why to use at this link.

Ant Build Tool : Quick Notes

Ant Build Tool : Quick Notes

Ant Script for JAVA Developers

1) Simple Ant Script for Clean , Compile and jar generation adding Manifest information to jar

Note :- All folder path are relative to basedir . Here is basedir=”.”
Note :- the values at class-path are separated by space

2) Using Property in Ant Script

3) Reading From Property File

4) Current Time Stamp in Ant Script

5) Directory Opertaions
Make dir

6) Ant Script and Svn

SVN Checkout

Note :- for https:/ type svn
7)File uploads and Ant Script

8) Variable of Varible in Ant Scipt

9)creating war and zip file in ant script

10) Creating Custom Ant Tasks

Required Jar files for ant’s different task
antlr-runtime-3.1.3.jar commons-net.jar ganymed.jar jna.jar
jsch-0.1.44.jar sqljet.1.0.4.jar svnant.jar svnClientAdapter.jar
svnjavahl.jar svnkit.jar svnkit-cli.jar
svnkit-javahl.jar trilead.jar

Blank final field in Java

Blank final field in Java

A variable that is declared as final and not initialized is called a blank final variable. A blank final variable forces the constructors to initialize it.

In other words
The final property of class must have a value assigned before object is created. So the last point where you can assign value to them is constructor.

This is used often for immutable objects.