Monday, 23 February 2015

Cloud Computing Dedicated Servers

While Cloud computing has several advantages , it certainly has few disadvantages too . The first is possible downtime , so if your cloud server is down , your business is down too .

Second big issue is security , because your cloud data can be accessed from anywhere , across internet . so if a data breach happen to your cloud server , your whole business data might be compromised .

Third issue is , since performence , sometimes it cloud server performance is slower than dedicated servers . tries to overcome these major disadvantages of cloud computing by providing dedicated servers , which are bench-marked and tested thoroughly . It also provides greater security for the business data . esecure data owns and operates two world class data center to provide great performance . Some of the features of these data centers are : 1 ) Redundant gigE fiber optic connections directly on the west-coast Internet backbone.

2)5000 square foot (500 m²) battery room. All servers run directly off the power room at all times, which means power grid outages do not affect the data center at all.

3)World-class temperature control

4)Two Multi-Megawatt Diesel Back-up Generators

5)Unsurpassed uptime. The best in the industry.

6)Secure swipe-card controlled access

7)24/7/365 Security Personnel

8)24/7/365 Qualified Network Personnel

9)True Tier 4 support levels and good prices You can can run the speed test of these two data centers and know the difference for yourself . pricing model is pretty modest considering the value it is providing to its customer . It has great bandwidth and real world hard drive ranging from 500 gb to 12000 gb . The most important thing is about its CPU . Real Intel Quad Core Xeon CPUs. No Celerons - Celerons are fine for low-demand desktop computers, but servers are constantly processing multiple tasks at the same time and Celerons simply cannot keep up. With you get top quality servers in a world-class data center at amazing prices.

Post your comments and suggestions !!!

Thursday, 29 January 2015

Top Build Automation Tools

Apache ANT :

Apache Ant uses build.xml file to describe build process and it is implemented in java . ANT first version released in 2000 and soon became one of the most popular build tool at that time .Ant was intended to be used in place of unix make process which was not platform independent. ANT is an abbreviation for Another Neat Tool . Ant has several tasks available which you can use according to your project's requirements and it is flexible enough , so that you can create your own custom tasks . The biggest drawback of ANT is the use of xml file , which might become complex and verbose .

Apache MAVEN :

Apache Maven is based on project object model also known as POM. The biggest different between Maven And Ant is , Maven allowed the dependency to be downloaded over the internet . In ANT , we have to included each and every dependency by ourselves , Maven reduced the burden . It is also uses the pom.xml file for describing the build process , but the structure is completely different from Ant's build.xml . It still has the same problem of bulky and large xml file in case of big projects .

Gradle :

Gradle has combined the features of Ant and Maven with its own Domain Specific Langauge based on Groovy. It does not uses xml for describing the build process . Gradle is slowly getting popular .


Buildr is based on Ruby's build system Rake, and uses Ruby as a scripting language. It provides greater flexibility as you can write your custom Ruby code before and after standard buildr targets .


Thursday, 8 January 2015

Java MultiThreading Interview Question

What would be the output of the following program ?

public class ThreadTest implements Runnable
 private Object obj=new Object();

 public static void main(String[] args)
  ThreadTest test = new ThreadTest();
  Thread t1 = new Thread(test);
  Thread t2 = new Thread(test);

 public void run()
   System.out.println("1 " + Thread.currentThread().getId());
   obj = new Object();
   System.out.println("2 " +Thread.currentThread().getId());

Thursday, 18 December 2014

How to Check For Null Payload in Mule XML

If we want to check in our flow , weather payload is null or not , we can do it using MULE Expression Language .
#[payload == null]
This was not working in MULE 3.1.1 , so we can try another expression like this :
#[payload is NullPayload]
But , this condition also threw and Exception like this :
org.mule.api.MessagingException: Execution of the expression "payload is NullPayload" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: NullPayload
 at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(
 at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(
 at org.mule.execution.MessageProcessorExecutionTemplate.execute(
 at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(
 at org.mule.processor.chain.AbstractMessageProcessorChain.process(
 at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(
 at org.mule.execution.MessageProcessorExecutionTemplate.execute(
 at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(
 at org.mule.interceptor.AbstractEnvelopeInterceptor.process(
 at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(
 at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(
 at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(
 at org.mule.execution.ExecuteCallbackInterceptor.execute(
 at org.mule.execution.HandleExceptionInterceptor.execute(
 at org.mule.execution.HandleExceptionInterceptor.execute(
 at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(
 at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(
 at org.mule.execution.SuspendXaTransactionInterceptor.execute(
 at org.mule.execution.ValidateTransactionalStateInterceptor.execute(
 at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(
 at org.mule.execution.ExternalTransactionInterceptor.execute(
 at org.mule.execution.RethrowExceptionInterceptor.execute(
 at org.mule.execution.RethrowExceptionInterceptor.execute(
 at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(
 at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(
 at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$ Source)
 at Source)
Caused by: org.mule.api.expression.ExpressionRuntimeException: Execution of the expression "payload is NullPayload" failed.
 at org.mule.el.mvel.MVELExpressionLanguage.evaluateInternal(
 at org.mule.el.mvel.MVELExpressionLanguage.evaluate(
 at org.mule.expression.DefaultExpressionManager.evaluate(
 at org.mule.expression.DefaultExpressionManager.evaluateBoolean(
 at org.mule.routing.filters.ExpressionFilter.accept(
 at org.mule.routing.ChoiceRouter.selectProcessors(
 at org.mule.routing.AbstractSelectiveRouter.process(
 at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(
 at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(
 at org.mule.execution.MessageProcessorExecutionTemplate.execute(
 at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(
 at org.mule.execution.MessageProcessorExecutionTemplate.execute(
 ... 23 more
Caused by: [Error: could not access: NullPayload; in class: null]
[Near : {... Unknown ....}]
[Line: 1, Column: 0]
 at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(
 at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropertyAO(
 at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(
To resolve this , you have to tweak the expression a little bit like this :
#[payload is org.mule.transport.NullPayload]
Post Comments And Suggestions !!


Thursday, 20 November 2014

How To Get Client Operating System Name IN ROR

In the world of increasing web sites in a fast pace , at times we need to get the clients OS details to execute some script in clients machine, or know what is the OS/Web browser/Client Details used by client.

When ever a client accesses your website and makes a request, Browser sends the details of the client in as an WEBHTTP OBJECT.

HTTP_USER_AGENT request header contains the information about client .

To get this information in rails we need to write following code .

we create a around filter/action to and paste it in application controller so that it keeps the track of every request.

def get_operating_system
  if request.env['HTTP_USER_AGENT'].downcase.match(/mac/i)
  elsif request.env['HTTP_USER_AGENT'].downcase.match(/windows/i)
  elsif request.env['HTTP_USER_AGENT'].downcase.match(/linux/i)
  elsif request.env['HTTP_USER_AGENT'].downcase.match(/unix/i)
Thanks to Santosh for writing this post .

Monday, 17 November 2014

How to Use ActiveMQ in Rails App

Active MQ is one of the most popular messaging server . In this post we will list out the steps on how to use it in rails application.

Installation ActiveMQ procedure for Ubuntu 14.04

Download ActiveMQ 5.4.2 from or you can install it from console by writing following command .
sudo apt-get install activemq
Now start the server by writing following command :
$ ./activemq start
Now , for connecting activeMQ server , we can use Stomp Gem .

So for sending message , open IRB prompt and write following command :
$ irb req1.9.3-p362 :001 > require "stomp"=> true 
1.9.3-p362 :002 > client ="admin", "admin", "localhost", 61613)
You might get error like this :
Errno::ECONNREFUSED: Connection refused - connect(2)
 from /home/usermac44/.rvm/gems/ruby-1.9.3-p362/gems/stomp-1.3.3/lib/connection/netio.rb:203:in `initialize'
We have to configure stomp protocol on our activemq server like this : Add the following line to the configuration file:
    <transportConnector name="stomp" uri="stomp://;wireformat.maxFrameSize=104857600"/>
Now restart activemq , initiate the client and send message like this :
client ="admin", "admin", "localhost", 61613)
 => #"0,0", 
"session"=>"ID:ACSMAC05-63136-1415951184416-2:1", "server"=>"ActiveMQ/5.8.0", "version"=>"1.0"} ......#>

client.publish {|msg|  puts msg }
It will work now . You can see the active mq console at http://localhost:8161/admin .

Thanks to santosh for writing this post .

Thursday, 30 October 2014

How to Upload Images to DropBox In Java

This Tutorial explains how to upload images to drop box and get the public url of uploaded image .
First of all we have to create a DropBox API app using app console. Once you create the app , you can get App key and secret key in the app properties .

Now add following dependency in your pom file .
Now this java program will do the rest . Replace your app ket and secret key in program . Run this java program from command line and it will ask for the code , you will get the code by following the url printed on the console.

For getting the public url , we just need to use createShareableUrl of the dropboxClient class.
import java.util.Locale;

import com.dropbox.core.DbxAppInfo;
import com.dropbox.core.DbxAuthFinish;
import com.dropbox.core.DbxClient;
import com.dropbox.core.DbxEntry;
import com.dropbox.core.DbxException;
import com.dropbox.core.DbxRequestConfig;
import com.dropbox.core.DbxWebAuthNoRedirect;
import com.dropbox.core.DbxWriteMode;

public class UploadImages
 public static void main(String[] args) throws IOException, DbxException
  final String DROP_BOX_APP_KEY = "APPKEY";
        final String DROP_BOX_APP_SECRET = "SECRETKEY";
        String rootDir = "C:\\Users\\Downloads\\";

        DbxAppInfo dbxAppInfo = new DbxAppInfo(DROP_BOX_APP_KEY, DROP_BOX_APP_SECRET);

        DbxRequestConfig reqConfig = new DbxRequestConfig("javarootsDropbox/1.0",
        DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(reqConfig, dbxAppInfo);

        String authorizeUrl = webAuth.start();
        System.out.println("1. Go to this URL : " + authorizeUrl);
        System.out.println("2. Click \"Allow\" (you might have to log in first)");
        System.out.println("3. Copy the authorization code and paste here ");
        String code = new BufferedReader(new InputStreamReader(;

        DbxAuthFinish authFinish = webAuth.finish(code);
        String accessToken = authFinish.accessToken;

        DbxClient client = new DbxClient(reqConfig, accessToken);

        System.out.println("account name is : " + client.getAccountInfo().displayName);

        File inputFile = new File(rootDir +"images\\"+ "javaroots.jpg");
        FileInputStream inputStream = new FileInputStream(inputFile);
        try {
            DbxEntry.File uploadedFile = client.uploadFile("/javaroots.jpg",
                DbxWriteMode.add(), inputFile.length(), inputStream);
            String sharedUrl = client.createShareableUrl("/javaroots.jpg");
            System.out.println("Uploaded: " + uploadedFile.toString() + " URL " + sharedUrl);
        } finally {
Take reference from the this official drop box link.

You can download the full project from this link . Post Comments and Suggestions !!