Skip to main content

Posts

Showing posts from 2014

Enterprise Messaging

Messaging made was never easy like this. This is first Oreilly video tutorial I followed. And I should mention that I am really happy about this tutorial. Before I watch this tutorial I had no idea about JMS. But in this tutorial Mark Richards explains Messaging concepts as well as JMS implementations.
Most of the developer tutorials don't explain important stuff about essential administration properly, But author explains concepts/implementations and administration tips and you wouldn't notice it. Examples are really simple and easy to understand. If you want to start to lean Enterprise messaging this is the correct tutorial you should follow. You should have a understanding about Java language basics other than that there is nothing else you should know.
Also this course was highly addictive. I couldn't stop my self from finishing this video tutorial. Although I had some other work to do I couldn't do anything else. I love this tutorial. It's simple and easy to …

How to swap two integer variables without a third variable? - Java

Well. We can swap two integer variables using third variables. That is not a problem. Let's say we want to swap two variables without using a third variable. For that you can use simple mathematical operations such as addition/subtraction. But division multiplication will introduce an error to the data for example if you have to swap 1 and 3. Using subtraction and addition, you can swap two variables without affecting their values. 

Principles of Big Data

I was really interested in reading this book. But it took a long time to me to read it. And concepts which are explained in this book are really important. To a person who wants to start learning about Big data concepts, I will recommend this book for sure.
If you have prior knowledge on BI tools and techniques, this book will help you to learn help you to quicker than any other book in the market. And this book wont get outdated like a technology book.  Because these concepts are valid for anything you are going to do.
I am working with Big Data researchers as part of my job. So I found this book was very helpful to learn Big data concepts and that made my life easier.
I like this book and I will recommend to any one who wants to learn about Big data concepts. No matter whether they are students/novice or intermediate readers.
You can purchase a copy of this book from : http://shop.oreilly.com/product/9780124045767.do

.gitignore file for Java

I am working with Java projects and Git both. But sometimes opening a project from different IDE will create extra files which we really don't want. So using .gitignore file in the root folder of your Git repository will ignore files and patterns you have mentioned. Finally I found there are three main Java IDEs currently. They are  EclipseIntelliJ IDEANetBeans I am very sorry if your favourite IDE is not listed here. So I just went through the Bitbucket and GitHub (link to gitignore templates). Then I created my own .gitignore file. I wish this would help you.

Mass insertion on Redis

You may want to insert a lot of data into Redis. This would be easier to insert a lot data into Redis using Linux commands. Lets say we have a comma separated values in a file.

data.csv:
key1,1200 key2,5000 key35,12345 key12,4500
With following command you can load all the data into Redis. But you should start Redis server first.


You can change data.csv as you want and according to your file.

How to build Redis server on Ubuntu 14.04

Recently we used Redis server on Ubuntu 14.04. And I just thought about writing a blog post to show how to build Redis on Ubuntu server or desktop editions. 
First of all you have to go to Redis site and download the redis source code. Redis site
Copy the download link from redis site. Currently download link looks like this "http://download.redis.io/releases/redis-2.8.17.tar.gz". It may change depending on the version you want to download.

Then connect to the server through SSH or take a terminal on Ubuntu desktop machine. Run below command
wget <URL that you copied from redis site>
Then you want to install build-essential and  libjemalloc-dev in order to build redis server. To install those packages run below command.
sudo apt-get update && sudo apt-get install buid-essential libjemalloc-dev
After installing dependencies and tool you want to extract redis archive. Run below commands to extract it. Change the archive name depending on your download.
tar xvf redi…

Disable telnet and enable ssh on Cisco Switch (IOS)

We recently purchased a Cisco switch for our Hadoop cluster. So I wanted to setup Cisco switch. But first of all I want to configure ssh and disable telnet. Lets see how we can do that.
Connect to the switch using telnet or using console port. (You should enable telnet and give a password from express setup.) enable configure terminal hostname <switchname> ip domain-name <domain name> crypto key generate rsa Enter "1024" when it prompts for
How many bits int the modulus [512]: Then run below commands interface fa0/0 ip address 192.168.1.1 255.255.255.0 no shutdown username <username> priv 15 secret <password> aaa new-model enable secret <password> If you have a Cisco router use "0 4" instead of "0 14" line vty 0 14 transport input ssh end copy running-config startup-config Now you can use SSH client to connect to switch.

Ubuntu 14.04 Desktop - How I feel it

I couldn't install Ubuntu 14.04 as soon as it was released. But I upgraded my office laptop to Ubuntu 14.04 in June.
Ubuntu 14.04 is more stable than other releases. And Ubuntu 14.04 is a LTS (Long term support) version which will release updates till 2019. I switched to 14.04 from 12.04.
They have disabled workspaces. (+1) I hate this workspace business because it is very hard to work with windows when these workspaces are there. In Ubuntu 14.04, workspaces are disabled by default. You have to enable it if you want it. 
Now Ubuntu supports real time windows resizing. (Not that impressive. But nice to have.)  
I don't like Amazon plug-in in Unity dashboard. So I always run fixubuntu.com script to disable it.
wget -q -O - https://fixubuntu.com/fixubuntu.sh | bash
What you have to do is just run above command line on terminal. After doing that you wont see advertisements on your Unity dashboard.

I don't see super fantastic awesome features to celebrate on this release. But d…

Portable Drive encryption with Ubuntu

I haven't used encryption on hard disk drives or pen drives ever. But recently I got a requirement to encrypt some portables disks. And there are some limitations also. After encrypting you would not be able to use that drive on Windows Operating System. You are going to limit to ext4 file system as well.
First you have to install cryptsetup to format your portable drive with encryption. To install cryptsetup run following command on a terminal.
sudo apt-get install cryptsetup After that you have to open Disk utility application. To open it just search on Unity dash board like below.  Then you will get a window like this. Click on "Unmount Volume" Click on "Format Volume". Then you will get a new dialog box like below. Select "Encrypt underlying device" option, before clicking "Format" button. After that Disk Utility will ask for a pass-phrase to encrypt device. Give a strong pass-phrase and don't forget it! If you forget it, you will lo…

Sri Lanka Cartogram with d3.js

We have been using d3js to visualize things on maps. And after struggling with topojson application my boss found a way to convert Sri Lanka Shape file (.shp) to topojson format. Then we wanted to use cartograms for our visualizations.

I found that there was a d3js cartogram implementation. - https://github.com/shawnbot/d3-cartogram/

With the help of this blog post - http://www.limn.co.za/2013/10/making-a-cartogram/, I finished cartogram Visualization. 
And Nisansa's co-ordinations for center of Sri Lanka was very helpful to calibrate Sri Lanka map.

You can find my sri-lanka-cartogram repository on GitHub - https://github.com/dedunumax/sri-lanka-cartogram
You find the live demo from here - http://web.dedunu.info/sri-lanka-cartogram/

Thanks https://github.com/mbostock for d3js library! He is a wizard in visualizations.
Thanks a lot https://github.com/shawnbot for cartogram.js! Hope this will be useful to you.

Hadoop Mapper only MapReduce jobs

It's funny! You can have mapper only Hadoop MapReduce Jobs. This would be useful sometime when you need to change the structure of data. Otherwise you can use this way when want to filter out data. But I don't think you will need this much often.

First file is a simple mapper which really does nothing. You can change it as you want. You can see in main method job.setNumReduceTasks(0); line which set reduce tasks to 0. You can find Maven project on GitHub

Hadoop with Maven

Last couple of days, I have been playing with Hadoop. Because of that I couldn't blog much often. I wanted to automated packaging with Maven. Below gist shows a sample Maven pom.xml for Hadoop.
This will resolve Hadoop dependency and package it as a jar file. Hope this will help you!