Thursday, October 30, 2014

Top Ten Reasons for learning Java Programming Language

Java is the best programming languages created ever as it has last 20 years by gaining popularity every passing day. Although there were occasions when Java development slowed down, but with path breaking changes in form of Enum, Autoboxing and Generics in Java 5, Google's choice of language for Android apps development and performance improvement with Java 6, kept Java as top programming language. Also In terms of Job opportunities and popularity Java outscore every one with lots of Jobs opportunity available. You can work on developing core Java based server side application, can even go for Android based mobile application development and J2EE web and enterprise applications.

Here are top 10 reason for Learning Java Programming Language

1) Java is Easy to learn

Java has fluent English like syntax which makes it easy to read Java program and learn quickly. Once you are familiar with initial hurdles with installing JDK and setting up PATH and understand How Classpath works, it's easy to write program in Java.

2) Java is an Object Oriented Programming Language

Java is an Object Oriented Programming language. Developing OOPS application is easier, and it also helps to keep system modular, flexible and extensible. You can use all key concepts like AbstractionEncapsulationPolymorphism and Inheritance. Java also promotes use of SOLID and Object oriented design principles in form of open source projects like spring, which make sure your object dependency is well managed by using dependency Injection principle.

3) Java has Rich API

Java provides API for networking, I/O, utilities, xml parsing, database connection, and almost everything. Whatever left is covered by open source libraries like Apache Commons, Google Guava and others.

4) Powerful development tools e.g. Eclipse, Netbeans

Eclipse and Netbeans has played huge role to make Java one of the best programming language. Coding in IDE is a treat, especially if you have coded in DOS Editor or Notepad. They not only help in code completion but also provide powerful debugging capability, which is essential for development and testing. Integrated Development Environment made Java development much easier, faster and fluent. Apart from IDE, Java platform also has several other tools like Maven and ANT for building Java applications, JConsole, decompilers, Visual VM for monitoring Heap usage etc.

5) Good collection of Open Source libraries

Open source libraries ensures that Java should be used everywhere. Apache, Google, and other organization has contributed lot of great libraries, which makes Java development easy, faster and cost effective. There are framework like Spring, Struts, Maven, which ensures that Java development follows best practices of software craftsmanship, promotes use of design patterns and assisted Java developers to get there job done.

Tuesday, October 7, 2014

Java : File Encryption and Decryption using Blowfish

The Java security APIs span a wide range of areas, including cryptography, public key infrastructure, secure communication, authentication, and access control. Java security technology provides the developer with a comprehensive security framework for writing applications, and also provides the user or administrator with a set of tools to securely manage applications.
Source :

This class provides the functionality of a cryptographic cipher for encryption and decryption. It forms the core of the Java Cryptographic Extension (JCE) framework.
Cipher API :

Cipher: initialized with keys, these used for encrypting/decrypting data. There are various types of algorithms: symmetric bulk encryption (e.g. AES, DES, DESede, Blowfish, IDEA)

Blowfish has a 64-bit block size and a variable key length from 1 bit up to 448 bits
Blowfish Wiki :

Here are the general steps to encrypt/decrypt a file in Java -

  • Create a Key from a given byte array for a given algorithm.
  • Get an instance of Cipher class for a given algorithm transformation.
  • Initialize the Cipher with an appropriate mode (encrypt or decrypt) and the given Key.
  • Invoke doFinal(input_bytes) method of the Cipher class to perform encryption or decryption on the input_bytes, which returns an encrypted or decrypted byte array.
  • Read an input file to a byte array and write the encrypted/decrypted byte array to an output file accordingly.

Please see the below java code

Wednesday, September 24, 2014

Javascript code for 2048 number puzzle

Other day I was playing this game on my android mobile and I was so amazed with it that I thought why not try to write a JavaScript code for this game. So here I am with it.

new game

Score :

HOW TO PLAY: Use your arrow keys to move the tiles.

Please see the complete source code -

Output -

Sunday, August 31, 2014

Five Common Questions from JavaScript Beginners

What is JavaScript?

JavaScript is an easy-to-use version of programming language (a constructed language that communicates instructions to a computer).  JavaScript is a scripting language (this means it is a programming language that supports scripts, which can interpret and automate the execution of tasks). Developed by Brendan Eich, while working for Netscape Communications Corporation, this program code was designed to appeal to nonprofessional programmers.  JavaScript runs inside an Internet browser. JavaScript is not a stand-alone programming language.  JavaScript is designed to embed information  in a web browser.  JavaScript includes the following features: dynamic typing and has first-class functions.  

Is Java the same as JavaScript?

Though both Java and JavaScript are both programming languages they are also immensely different.  Java is a very complex programming language while JavaScript is an easy-to-use version that is great for those beginners learning about program languages.  JavaScript and Java have the same expression syntax, naming conventions, and basic control-flow constructs.  JavaScript was previously named LiveScript; the name change has caused much confusion between Java and JavaScript.  Java is a programming language that can be used as a ‘stand-alone’ whereas JavaScript must rely on the environment it is operating in.

How Does JavaScript Work?

JavaScript works by placing code within a Web page.  When a browser loads the page, the built in interpreter reads the JavaScript code it finds within the page and runs it.

What is JavaScript Used For?

JavaScript is mostly used to allow ‘client-side’ scripts to interact with the user.  It is also used to control a Web browser, alter content that is displayed in a document, game development, as well as desktop and mobile applications.  Real life applications where this can be used (outside of web pages) include PDF documents, site-specific browsers, and desktop widgets.

What are the Various Data types used in JavaScript?

Number: Numbers can be written with or without decimals and may use scientific (exponential) notation if they are large enough. Does not allow the use of non-numbers such as NaN.
String: Strings are written with quotes.  Either double or single. 
Boolean: Can only have two values: true or false.
Array: Arrays use square brackets ‘[]’ while separating elements with comas.
Object: Objects are written with curly brackets ‘{}’. Comas separate each pair while the colon ‘:’ separates the name from its value.
Null: An empty value.  Variables can be emptied by setting the value to null.
Undefined: The value of a variable with no value.

Author Bio: Right brain, meet left brain. We're the whole brain. Agency Fusion in Salt Lake City, Utah is a web development and design firm with both creative and technological expertise. Learn more about Agency Fusion.