Freelance Projects, Software Development, Programming Jobs

Simple Single Sign-On server on Linux and Tomcat


I spent nearly one hour trying to find a solution how to setup a Single Sign-On server (SSO) on Ubuntu and Tomcat.

What I found is this tutorial and it uses Jasig CAS server on Tomcat 7:


You can have your own hosted Ubuntu on Digital Ocean for as little as $5/month which is an incredible price for all possibilities it gives you!


Hadoop Tutorial

Hadoop Tutorial

First, before beginning this Hadoop Tutorial, let's explain some terms.

What is Big Data?

Big Data is the reality of to do business for most organizations. Big data is a collection of large data sets which can not be processed using routine data processing techniques. Big Data is no longer a given, it became a complete subject which involves various tools, techniques and frameworks. Big data involves data produced by applications and devices. Some areas that are under the Big Data roof

Some examples of Big Data

Social Media data such as Facebook and Twitter capture information and views displayed by millions of people worldwide.
Currency Exchange data contains information on the "buy" decisions and "sell" on the one hand made from different companies by clients.
Power Grid data contains information used by a particular node with respect to a base station.
Transport Data includes model, capacity, availability and distance of a vehicle.
Search Engine Data recover much data from different databases.

Big Data types

The data will be of three types:
- structured data is relational data.
- semi-structured data are XML data.
- unstructured data are documents like Word, PDF, Text, Media Newspapers

Technologies used in Big Data

There are various technologies in the market from different vendors, including Amazon, IBM, Microsoft, etc. to manage large volumes of data. In this article we will examine the two following classes of technologies:

Operational Big Data

It includes a system like MongoDB operational capabilities that provide real-time, interactive workloads where data is mainly captured and stores. NoSQL big data systems are designed to take advantage of new architectures of cloud, it makes operational workloads of large data much more manageable, cheaper and faster to implement.

Big Data Analytics

It includes systems such as Massively Parallel Processing (MPP) systems and database MapReduce analytic capabilities that provide complex analysis to show which can affect most or all of the data. MapReduce provide a new method of data analysis that is corresponding to the capabilities of SQL and MapReduce-based system that can be scaled from single servers to thousands of high-end devices and low.

Difficulties encountered by Big Data

The main challenges related to large volumes of data are:

• Data Capture
• Conservation
• Storage
• Research
• Share
• Transfer
• Analysis
• Presentation

Hadoop Big Data Solution

Old traditional approach

In traditional business old approach will have a computer to store and process large data. In these data will be stored in an RDBMS such as Oracle Database, MS SQL Server or DB2 and complicated software can be written to interact with the database process the required data and present users for purposes of analysis.

Limitation of the traditional approach

We use this approach where we have less volume of data that can be accommodated by the database servers or standard data to the processor limit that is currently processing the data. But when it comes to trade with huge amounts of data traditional approach is really a tedious task to process the data via a traditional database server.

The Google solution

MapReduce algorithm is Google's solution for this problem. In this algorithm, we split the task into smaller parts and assign the parts to many computers on the network and collect the results to form the final result dataset.

Where the Apache Hadoop fits in?

Let's first begin in this Hadoop tutorial what the Apache Hadoop actually is. Hadoop is basically an open framework of software that can store data and process data through hardware clusters. Hadoop is designed to grow from a single server to thousands of machines offering to each local storage and computer. Hadoop gives a massive storage for any data type with enormous processing power and the ability to handle tasks or virtually unlimited parallel jobs.

Hadoop Big Data Solution and history

Doug Cutting, Mike Cafarella and his team took the solution provided by Google and started an open source project called Hadoop. Hadoop in 2005 is a trademark of the Apache Software Foundation. Apache Hadoop is an open source framework written in Java that allows processing of large data sets on distributed computer clusters using simple programming models. Hadoop runs applications using the MapReduce algorithm, where the data are processed in parallel on various processor nodes. Hadoop framework is capable enough to develop applications that run on computer clusters and they could do a full statistical analysis to huge amounts of data.


Hadoop architecture framework

Hadoop Framework consists of four modules:

1) Common Hadoop
2) Hadoop Yarn
3) Hadoop Distributed File System
4) Hadoop MapReduce

Hadoop Tutorial


Discussing in detail the four hadoop modules

1) Common Hadoop is Java libraries and utilities required by other Hadoop modules. These libraries provide files and OS level abstractions system to contain the Java files and scripts needed to start Hadoop.

2) Yarn Hadoop is a framework for task scheduling and managing cluster resources.

3) Hadoop distributed file system that provides broadband access to the application data.

4) Hadoop MapReduce is Yarn based system for parallel processing of large data sets.
Working of Hadoop

There are 3 steps in Hadoop can discuss in detail in this Hadoop tutorial:

1st step: the user submits a job / Application to Hadoop for the necessary process by specifying the following:

1. Define the locations of the input and output files in the distributed file system.

2. Define the Java classes as a jar file containing the implementation of the plan and reduce functions.

3. Definition of the configuration of the job by defining different parameters specific to the job.

2nd Step: Hadoop (A Hadoop job client) then submits the job (jar / executable etc.) and configuring the Job Tracker which then assumes responsibility for distributing the software / configuration to the slaves, scheduling tasks and monitoring of granting status as diagnosis information to the job client.
3rd Step: Task Trackers on different nodes perform the task by the implementation and output of the function to reduce MapReduce is stored in the output files on the file system.

Hadoop Tutorial

Benefits of Hadoop

Top reasons to choose Hadoop is its ability to store and process huge amount of data quickly. Other benefits of Hadoop are:

Computing power - Hadoop distributed computing data module quickly process any amount of data. The increase in processing power using several computing nodes.
Flexibility - information you should pretreatment before storing. You can store as much information as you require and choose how to use it later.
Fault Tolerance - Information and handling of the application are insured against hardware failures. Incase a node goes down task are automatically redirected to other nodes to ensure that distributed computing is not lacking. Hadoop automatically store multiple copies of data.
Low Cost - Hadoop is open source Hadoop software framework is free & used good material to store large amount of data.
Hadoop is scalable - With little administration, we can easily increase our system simply by adding new nodes.

Hadoop MapReduce

It is a software framework for easily writing applications that process large amounts of data in parallel on large clusters working on thousands of basic hardware nodes reliably and fault tolerance.

The two different following tasks that programs perform MapReduce Hadoop actually refer the term:

1) Task Map: This is the first task that takes the input data and converts it into a data set, where individual elements are decomposed into tuples (key / value pairs).

2) Reduce Group: The reduction task is always executed after the task map. Out of a task card is taken as input and combines these data tuples in a small set of tuples.

Hadoop Tutorial

Author: Written by Mubeen Khalid for ®

Image Resources:

Row was updated or deleted by another transaction


While working with hibernate (which is quite popular java object relational mapper), you might have stumbled upon this exception:

Row was updated or deleted by another transaction


What does this exception really mean? Well, you're most probably trying to update an object via hibernate which was version ID is lower than version ID of object in the database.

Hibernate uses versioning to know that modified object you had is older than one which is currently persisted.

Hope this will help some java newbies which are using hibernate for persistence.

What is the solution to "row was updated or deleted by another transaction" then?



You need to get the very latest version of object to avoid "row was updated ... " exception before you make any changes.

This can be usually accomplished by adding:

MyEntity myEntity = persistenceManager.findObjectById(myEntity .getId())


here goes then:


on your hibernate persistence manager


jQuery Drop Down List


The best way how to get a good jQuery drop down list is to utilize some of the plugins available at

There are many tutorials around the internet how to add drop down list on your website and use it in your applications.


Most of them use the most low-level way how to do that, and you have to create lot of boilerplate code to get a good drop down in your menu accomplished with jQuery.


Most of these plugins utilizing jQuery have same structure:

1. You need to include a jQuery script into the HTML header

<script src="//"></script>

2. You need to include drop down plugin script to HTML header

<script src="/jquery.{plugin_name}.js"></script>

3. Include CSS which adds styling to menu

<link rel="stylesheet" href="/css/{plugin_name}.css">

4. The actual HTML of drop down lists

<ul id="menu">
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a>
<li><a href="#">Sub Item 1</a></li>
<li><a href="#">Sub Item 2</a></li>
<li><a href="#">Item 3</a>
<li><a href="#">Item 4</a>


The Ultimate Android OS Battle: Android L vs Android M

Google released the developer preview of its next version, called as Android M, on this year's I/O conference. While Google current Android version Lollipop was aimed at visual aesthetics, Android M on the other hand, will mainly focus on optimization and enhanced battery life. So, for those who would like to know about the major differences between both the Android versions, this post will provide useful insight on what's new in Android M vs Android 5.1 Lollipop. But, before heading straight towards the differences, let us first have a brief introduction on both of these Android versions.

A Look at: Android M and Android L

Android Lollipop was introduced during the Google I/O conference – held on June 25, 2014 – and was officially named as Android 5.0 “Lollipop” on October 15, 2014. Android L, was arguably the major highlight of Google's annual developer's conference. It was a complete visual redesign that Android had seen since Ice Cream Sandwich (Android version update). In fact, overhaul of the user interface based on a design language, called as “Material Design”, was said to be the most prominent changes in the Android Lollipop.

A lot of bugs were found in Google's Android 5.0 version, however, an update was released in May known as Google’s Android 5.1 Lollipop to fix those bugs. Till date, the current Lollipop version has been made available for select devices running Android distributions such as Nexus. The successor to Android 5.0 Lollipop, codenamed “Android M” hasn't changed much in terms of look and feel, but focuses on making improvements in usability and stability.

A lot of new features were unveiled in the Android M developer preview, and it is expected that Google will likely add even a lot more features prior to the release of Android M, at the end of the year. So, for now only the early developer preview (or you can say beta version) of Android M is here. You'll have to wait for the final version release of Google's software update. As discussed the new Android version is said to bring forth many new changes such as better battery life and much more, ensuring to provide an optimal core user experience of Android.

Basically, Android M will provide familiar visual experience just like Lollipop, but it will be better compared to its predecessor Android L. The next Android software update will be a free update for all of the Android powered Smartphones, as well as, tablets. The Android M beta has been made available only for “Nexus 5, 6, 9 and Player”. However, this update will arrive somewhat late for the mainstream manufacturers Samsung, HTC, and others (i.e. somewhere around December, or most likely in 2016).

Android M vs Android L: What's the difference?

So far, we've discussed about the key aspects of both Android M and Android L. And now, it's time to unveil some major highlights of the ultimate battle between the Android versions.

1. App Permissions Will Get an Overhaul

The long overdue app permissions model will be getting overhauled. Prior to the release of Android M beta, requesting permissions for apps in Android has been a nuisance for users, since apps asked for way more information than needed. However, with Android M, the control of the app permission system will be in the hands of the user.

Unlike the previous Android versions that requested for permissions at the time when apps (like Location, Camera, SMS, etc.) were being downloaded, Android M will request for app permissions during runtime. Simply put, you can now ask for the permissions at the same time when you'll try to use some feature, and not during the installation of the app. And, you don't need to agree to the permissions that seem senseless to you.

For example, the “WhatsApp” will ask for your permission first, if it can use your microphone for recording a voice message. So, in case something wants access to your application, you'll have to approve the permission.

2. Google “Now On Tap

Google Now is a voice-enabled personal assistant that gets right information – related to weather, traffic, and other data based on your interests – exactly when you need it. With the new Android software update, Google Now will get better. Android M, will come shipped with Google Now on Tap that will help enhance the user search experience, by providing them with real-time context.

In simple words, Google Now will help provide content – right where you're – without having to navigate from one app to another. What's more, you no longer will have to look up for the information, as Google Now on Tap will deliver the desired information to you. You just need to press and hold the home button – whenever you need to find something – and Google Now will provide you with information – that you would likely search for anyhow.

For example, in the middle of using an app or when reading an email, you might receive a prompt from your friends asking you to accompany them for a movie. But, what if you would like to have more information about that movie. Simply, long-press the home button (a shortcut) will make Google Now appear on your device screen, offering useful data based on your needs.

3. Android Pay – The New Improved Mobile Payment Solution

In order to compete with the popular payment solutions such as Apple Pay, Google has introduced a new mobile payment solution called as “Android Pay” for Android M. Although, Android Smartphones have a payment solution known as Google Wallet, but it has been a failure. Android Pay is compatible with devices that comes with NFC capabilities.

The new payment solution enables merchants to make their phone connect to terminal equipped with touch-payment, and make them receive a digital receipt. You can use the Android Pay app as a credit-card locker, but you don't need to open up apps to make this app work: you just need to touch the app and make the payment. Google said that Android Pay will be accepted at more than 700,000 US stores shortly, however, nothing has been said about availability of Pay on other markets.

With Android Pay, you'll be able to choose the card that can be used for payment across multiple devices, and you won't have to unnecessarily provide information for the transaction. The new payment solution will be making use of virtual account numbers for presenting users' account information, which will add an extra layer of security to the process.

4. Fingerprint Support Will Be Native

With Android M, the long awaited biometric fingerprint support will make you capable to compete with iOS “Touch ID”. So far, the biometric fingerprint technology has been available with Samsung Galaxy X and Galaxy Note Devices only. However, devices with Android M will be able to have native fingerprint support via a fingerprint scanner.

In essence, Google will standardize the fingerprint scanners support for devices that will run on Android M. This new feature will make users pay for products with Android Pay in a highly secure way. Android M will make you unlock your device, or sign into any account, use Android Pay, and do a lot more things with the help of your fingerprint.

The new feature will not only bring convenience to how you access things on an Android device, but will also improve security.

5. Improve Your Battery Life With “Doze”

Another major highlight of Android M is "Doze". This feature is intended to improve user experience regarding battery life. As the name implies, it will make on your device (including the apps) doze off (i.e. sleep) when it is not being used. This will eventually help in improving the battery life of Android devices. Doze will get activated when a device is unplugged, or in the case when it is not in use, thereby saving battery life.

This feature, in particular, makes the apps stay in a low-power state or compels them to stay asleep. Once the device wakes, the apps can resume their normal activity.

With Doze enabled on your device, you can continue to receive important notifications such as Gmail alerts, texts, etc. In addition, you can even manage the apps that you would like to doze.

6. New Improved Google Photos Will Make Managing Photos a Breeze

Android M will have a standalone Photos app that will help you share and store images “independent of Google+”. It will come with cloud storage capability, and so you no longer need to worry about losing your photos – not even if you lose your device.

Google Photos app will help you automatically images in GIF format, slideshows, etc. that you can share with your friends and family. What's amazing about this app, is that will come loaded with features such as “Auto-Awesome” and “Stories”, which automatically provide suggestions about how you can use your images in a creative manner and so on.

Wrapping Up!

Android's new version has been unveiled during this year Google I/O conference, and has been named as “Android M”. When compared to its predecessor Android L, you won't see many changes in the visual aesthetics of Android M. However, the new Android software update is expected to introduce many useful features which include, improved battery life, a new mobile payment solution, better security feature and lots more.

While there is a plethora of features that have been introduced with Android M, but in this post, we've covered some of the major features that are hard to ignore.

Author Signature: Lucie Kruger is an application developer working with Mobiers Ltd, which is the leading Android app development company. She provides concrete information on latest information on mobile technologies like iOS or Android development processes.


Noclassdeffounderror Java

If you are a java developer, you definitely were experiencing java class not found exception with this error: noclassdeffounderror java . But what's behind this error?

We'll explain in next few lines:

Usually compiler tries to find a class within your classpath, but the class is not there. Therefore you're getting noclassdeffounderror.


If you are running a java command from command line:

1. Check included .jar files within your classpath

In windows environment type a command: "set"

Result should be something like:

CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
Path=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporati
;D:\Prog\TortoiseGit\bin;C:\Program Files (x86)\Skype\Phone\
PROCESSOR_IDENTIFIER=AMD64 Family 16 Model 10 Stepping 0, AuthenticAMD
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
TVT=C:\Program Files (x86)\Lenovo

another command: set CLASSPATH=$CLASSPATH$"c:\{yourdirectorywithjarfiles}"

This should add visibility of your jar files within the classpath.

Optionally, you can specify a classpath this way:

java -jar mypackage.jar -cp c:\{yourdirectorywithjarfiles}

Guest Posting / Blogging

We're looking for guest bloggers to write articles about web technologies, latest trends, e-commerce and online marketing.

If you are interested, please drop us an email to info at codegravity dot com. Thank you !

Binding Dropdown using jQuery

Author Bio :

Amy is WordPress developer by profession. She works for WordPrax - WordPress website development company and has a strong inclination for a suite of creative endeavors. Blogging meanwhile is a new found hobby for Amy.


Dropdown binding is perhaps one of the best things possible with jQuery. Eventhough it is feasible to bind a dropdown list using C#, opting for jQuery to perform the job entails utmost performance and convenience. This is a post which will walk you through the steps associated with using jQuery for binding a dropdown list.

Coming to the process of binding dropdown list using jQuery

Step 1- Add the reference jQuery Library

Prior to being able to use any particular function(s) available in jQuery, it is crucial for you to have the reference for the same within the aspx page. With jQuery 2.0 as the current working version, you can use the below line of code for providing reference of jQuery library within the aspx page:

<script src="/jquery-2.0.js" type="text/javascript"></script>

Step 2- Use a function for fetching data from jQuery Library

Just use the below mentioned function for deriving data from jQuery Library:

<script >

$(document).ready(function () {


type: "POST",

contentType: "application/json; charset=utf-8",

url: "test.aspx/LoadCountry",

data: "{}",

dataType: "json",

success: function (Result) {

$.each(Result.d, function (key, value) {




error: function (Result) {





Here's an explanation of the above code snippet:

1. $(document).ready(function () {

The above function is executed once the document has been loaded completely on the client machine. It is important to note that a page can't be manipulated securely unless the document is ready.

2. $.ajax({

You can combine jQuery and Ajax for getting and posting data on the server. Here, $.ajax is used for posting data to the sever and fetching data back for binding the same within the dropdown list.

3. type: "POST",

In this tutorial, I've assumed that the page just has two conditions: get and post. The above line of code represents this assumption.

4. contentType: "application/json; charset=utf-8",

This line of code represents as to what the content is encoded in.

5. url: "test.aspx/LoadCountry",

Th above line of code represents that URL holds the address of location where it is connected. So, text.aspx represents the name of page and LoadCountry is the name of method which allows you to connect the URL to database, followed by returning data on execution of jQuery function.

6. data: "{}",

Usually, data is passed the parameters (data) jQuery to code that's associated with the chosen method(here, it is LoadCountry).

7. dataType: "json",

This line of code represents that the all data types used in the explained example are supported by JSON. Some popular data types supported by JSON include: number, boolean, string, value, array, white space, object and many more.

8. success: function (Result) {

$.each(Result.d, function (key, value) {




In the above code snippet, Success is a pre-defined function available in jQuery. Also, the result is the object value $.Each which works in the form of a continuous loop until the desired values are returned. Within the lines of code:


  • #ddlcountry is the id of the 'country' drop-down

  • append($(“<option></option>”).val(value.CountryId).html(value.CountryName));

    represents that new options have been added into the dropdown list and their respective values are represented by value.CountryId and value.CountryName.

9. error: function (Result) {


Here, Error is also a jQuery function which is executed each time an error result is derived from executing the function.

Now, here is the code behind the above mentioned function:

// Country POCO class public class Country { public int CountryID {get; set;} public string CountryName {get; set;} }

[System.Web.Services.WebMethod] public static List<Country> LoadCountry() { return LoadCountries(); }

The above code represents the static type method used for executing the function.

The entire code snippet is shown below:

/// <summary> /// This method returns a list of Countries /// </summary> /// <returns>List<Country></returns> public static List<Country> LoadCountries() { //create a reference of List<Property>. List<Country> CountryInformation = new List<Country>();

// Creating database context and write Linq query to fetch countries list

using (var Context = new DatabaseContext()) { var list = Context.Country.ToList(); if(list != null && list.Count > 0) { foreach(var item in list) { CountryInformation.Add(new Country() { CountryID = item.CountryId, CountryName = item.CountryName }); } } return CountryInformation; } }

We're done!

OutPut :



Binding dropdown list on a page has always posed as a great challenge to developers. I hope the code mentioned within this post would aid you in performing the job with utmost amount of perfection.

Slow Apache PHP UniServer on localhost


It's been months since I was trying to figure out WHY was PHP and Apache sooo damn slow on localhost !

I tried uniserver, xampp, wamp, all kind of server bundles which were offering PHP/Apache/MySQL. I was even thinking about developing under Ubuntu linux.

Whenever I tried to refresh a page, it took approximately 3 seconds or even more. Very annoying !


I found several posts around the internet such as:


Most of them are instructing you to add lines to windows hosts file. You know what? It doesn't help !


What worked for me regarding slow Apache / PHP on localhost


>>> I changed localhost to in configuration.php of Joomla installation. That's all ! <<<<


I'm currently using Uniserver, which is really great.

If you're using Wordpress, some other CMS, or even no CMS at all, you have to change it in some main database configuration file.


Results before running command "wget.exe localhost"

Start time: 2014-12-21 15:28:18
End time: 2014-12-21 15:28:24 (6 seconds difference ! )


After the modification:

Start time: 2014-12-21 15:38:21
2014-12-21 15:38:22 (1 second difference ! )


waiting 6 seconds vs 1 second can be a huge difference if your're doing some development on localhost !

If I knew that some time ago it could have saved me hours waiting for damn f*** windows trying to resolve localhost to even though this entry was in etc/hosts file !





Articles about software development, new trends

web analytics

Conversion tracking, optimization services


Software development, PHP, Java, JEE, Spring, Hibernate