Feb 27, 2015

Powerful awk

Awk is really a powerful script language. We can perform a large tasks within a few line of codes. Just for example:

Consider we have a sample spreadsheet with the information as below:

test_awk.csv

Consider we want to find how many different records are in the 3rd column, we can use the following command in the terminal or bash:

           awk '{print $3}' test_awk.csv | sort -n | uniq -c

Output:

       1 x121REB000
     12 x121REB227
      6 x131REB198
      4 x131REB205
     20 x131REB221
      4 x131REB254
      3 x131REB294
      1 x131REB317
      5 x131REB392


And, consider we want to find number of TRUE and number of FALSE, for each uniuqe record in the column 3, we can run following commands:

          awk '{print $3, /TRUE/, /FALSE/}' test_awk.csv | sort -n | uniq -c

Output:

 Count   Code         T  F 
      1  x121REB000 0 1
     11 x121REB227 0 1
      1  x121REB227 1 0
      1  x131REB198 0 1
      4  x131REB198 1 0
      1  x131REB198 1 1
      3  x131REB205 0 1
      1  x131REB205 1 0
     17 x131REB221 0 1
      3  x131REB221 1 0
      2  x131REB254 0 1
      1  x131REB254 1 0
      1  x131REB254 1 1
      2  x131REB294 0 1
      1  x131REB294 1 0
      1  x131REB317 0 1
      4  x131REB392 0 1
      1  x131REB392 1 0

Lastly, for each record in column no. 3,  to find the unique record in field number 2, we can use the command:

          awk '{print $3, $2}' test_awk.csv | sort -n | uniq

Output:

Code-3 Code-2
x121REB000 5921
x121REB227 5724
x121REB227 9087
x131REB198 1443
x131REB198 1841
x131REB198 2339
x131REB198 5261
x131REB198 7284
x131REB198 9758
x131REB205 1446
x131REB205 1958
x131REB205 2285
x131REB205 5999
x131REB221 3866
x131REB221 6171
x131REB221 9616
x131REB221 9898
x131REB254 4732
x131REB254 6078
x131REB254 7679
x131REB254 9112
x131REB294 1025
x131REB294 3369
x131REB294 6006
x131REB317 6452
x131REB392 4045
x131REB392 4898



Feb 21, 2015

Cant hear their Mother

Reference: International Mother Language Day, Feb21.  

Mother is the first teacher of every child. Children start to learn, hearing their mother and exchange words in mother-language. But those who are born with inborn hearing impairment are deprived of this. They learn with the help of sign language.

Below, a girl puts up her thumb, index finger and pinkie finger, while keeping her ring finger and your middle finger down to express word 'Love'. They need our love.


Feb 16, 2015

Lets keep it simple

I imagine it would be better if we all think that "I am a human being first". Only after that we may be a Christian, Buddhist, Muslim, Hindu or, Chinese, Latvian, American or whatsoever. You may be richer than I am or you may have less, but my friend! when we die all of us will take the same amount of money with us. 

Lets make a better and peaceful world to live in. 

We need Love and Peace because we deserve it. 

Feb 9, 2015

Install Oracle Java for Netbeans

I was trying to install Netbeans in Ubuntu 14.0.4. But default Java for this version of Linux is OpenJDK7, which was not compatible with the netbeans. So I had to install the Oracle Jave so that the installation of Netbeans can be continued.

Here is the process to install Oracle Java:

Linux Terminal:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
 
After that, Netbeans will install in Ubuntu.
 
Process to install Netbeans in Ubuntu can be seen in this Site of Netbeans.  

Feb 5, 2015

Budapest Trip - Night Heaven

Budapest is simply awesome. At night it looks like heaven on Earth. The parliament building, Buda Castle, Castle Hill, Parliament and the Basilica of St. Stepen are the beautifully illuminated at night. Millenary Monument and the zechenyi Bath are the attractions at the some eastern part of the Budapest city. There are a lot of natural hot baths in this classical city. 


The official currency of Hungary is Hungarian Forint (HUF) and 1 HUF nearly equals 0.0033 euros. You need the currency to buy the tickets from machines. The transportation map for the Budapest can be downloaded from this site




Feb 4, 2015

Prague Tour

We reached Prague, the capital city of Czech Republic, on Jan 28, 2015. We had planned to stay there for 2 days. Our bus took to the Florenc Bus Station in the morning. Just at the bus station there is a friendly tourist information center from where you can get the tourist map and a money exchange (official with 0% commission). The currency of Prague is Czech Crown (czk) with 1 czk equals 0.036 euro. From the same place, you can get the metro that connect you with each corners of the city. Prague has  a excellent metro lines. You can get further information on the metro from its website. They also have night tram so that you can easily get to the bus station even though you have a night departure bus.

On the first day we visited the west sides of the river Vltava. The main attraction on this side of river are the St. Vitus Cathedral, Prague Castle and St. Nicholas Church. Tram 20 is ideal to visit the important spots on this side of river. From the top of the hill, one can get beautiful view of Prague old town with a lot of beautiful classical houses.
St. Vitus Cathedral
Charles bridge is the very beautiful bridge over the Vltava river with many statues. Walking along the bridge is a pleasant time to have in Prague.

On next day we visited the east side of the river, which is basically the old town. In the main square of the Prague old town, one can see many beautiful churches and houses. The astronomical clock is a wonderful piece of art and science at the main square. The Narodni museum of Prague is a massive beautiful architectural structure which is currently under maintenance.
Prague Old Town Square
We stayed at Mosaic House Hostel which is really good and friendly.