Thursday 11 February 2016

Create Runnable Jar in Eclipse

Here's a quick pictorial on how to create an executable jar in Eclipse. Assuming you have a Java project in place, let's take a quick look into the steps.

Go to File menu -> Export. Expand Java to choose Runnable JAR File and click Next. Check out the screenshot for reference.


In the next screen, you simply have to choose the Destination folder where you want to save the executable Jar. Also choose the java application's Launch configuration. It also lets you save an Ant script describing the Jar file that you created. Check out this link for official detailed reference.

Shibuya - The Modern Tetris

A few months back I had some real trouble concentrating well on things. A friend of mine suggested I play Tetris once in a while to help improve my concentration. Well, that's when I stumbled across this simple awesome game - Shibuya. 

Shibuya Grandmaster is a modern day refined Tetris with the classic arcade look and feel. The objective of the game is very simple - match multiple blocks of the same color and take them out. But the game needs to be completed in 7 varying speeds. Though the game may seem extremely simple in the beginning, but gets really tough later. The speed list is as follows : 
  • Slow
  • Normal
  • Adept
  • Fury
  • Reflex
  • Machine
  • Gentle Rain
The slow speed is the easiest while the Gentle Rain is really really difficult. The continually faster speeds challenge your reflexes and thereby helps improve concentration. You really need to plan fast based on the upcoming blocks so as to form pairs. You have to couple your concentration with quick adept planning to successfully complete the level in stipulated 2 minutes. All in all, its a beautiful game of concentration and planning, highly recommended to players of all ages.

Check out my gameplay of the Reflex Mode below to get a taster : 


Tuesday 9 February 2016

How to setup Apache Ant on Mac OS X

Folks, presenting a quick tutorial on how to setup the build tool Apache Ant on a Mac OS X machine.

Download the relevant ant archive version from Apache Ant homepage. For this example we download the latest v1.9.6.
Store it locally at any location you like; maybe like /Users/Username/apache-ant-1.9.6

Now lets edit the .bash_profile to define the ANT_HOME environment variable.

sudo vim ~/.bash_profile

Add the following lines to it (make sure to replace with your own username in the path):

export ANT_HOME=/Users/IroncladZone/apache-ant-1.9.6/
export PATH=$PATH:$ANT_HOME/bin

Now source ~/.bash_profile and restart terminal.

Check the above settings by looking up the ant version in terminal :

ant -v
Apache Ant(TM) version 1.9.6 compiled on June 29 2015
Trying the default build file: build.xml
Buildfile: build.xml does not exist!
Build failed

This means your ant is ready to use for builds. Going forward all you have to do is pass the build.xml to trigger the build.

Folks, watch out for this space for more basic to intermediate to advanced tutorials coming up soon.

Monday 8 February 2016

How to Set JAVA_HOME environment variable in Mac OS X

Check out a quick reference guide to set the JAVA_HOME environment variable in Mac OS X.

Open terminal and type the following :

  • sudo vim ~/.bash_profile
  • Enter your password
  • Now in the vim editor, insert the following text :
export JAVA_HOME=(/usr/libexec/java_home)
  • Save the .bash_profile from the vim editor using :wq
  • Now type the following in terminal :
source ~/.bash_profile

Confirm your changes by typing the following in terminal :

echo $JAVA_HOME

You should see the value/path of JAVA_HOME environment variable you just set as above.



Transfer files between two servers using SCP

We can transfer files between 2 remote hosts using the scp command as follows :

scp Username@Server1:/path-to-file-to-be-copied/ Username@Server2:/destination-path-where-files-are-to-be-copied/

Note that you may have to enter the credentials manually after this to logon to both the hosts.

Eg :

scp user123@Unix_Host_1:/Users/user123/Documents/Textfile.txt user123@Unix_Host_2:/users/user123/Documents/

You may also use the -3 switch to transfer files from one machine to another through your local host.

Check out the following available switches on a Mac OS X machine :

usage: scp [-12346BCEpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]

           [[user@]host1:]file1 ... [[user@]host2:]file2



Sunday 7 February 2016

Compare files contents in Mac OS X from command line using Comm

Comm is the command in Mac OS X if you want to compare the contents of two files through the command line.

The usage is as follows :

comm -switch file1 file2

where -switch can be any of the following :

-1 : This will not display the lines which are UNIQUELY present only in File1
-2 : This will not display the lines which are UNIQUELY present only in File2
-3 : This will not display the lines which are COMMON in both the files. i.e it will only display the unique lines from File1 and the File2

-i : This will basically display 3 columns. The 1st column will display lines which are UNIQUELY present only in File1. The 2nd column will display lines which are UNIQUELY present only in File2. And the 3rd column will display lines which are COMMON in both the files.

For eg:

we have taken two Text files for comparison, the contents of which are as follows :

TextFile1.txt

ABC
DEF
GHI
JKL
MNO
PQR
STU
VWX
YZ

TextFile2.txt

ABCD
DEFG
GHI
JKL
MNO
PQR
STU
VWXYZ
YZ

------ Usage 1 ------

comm -1 TextFile1.txt TextFile2.txt
ABCD
DEFG
GHI
JKL
MNO
PQR
STU
VWXYZ

YZ

------ Usage 2 ------

comm -2 TextFile1.txt TextFile2.txt
ABC
DEF
GHI
JKL
MNO
PQR
STU
VWX

YZ

------ Usage 3 ------

comm -3 TextFile1.txt TextFile2.txt
ABC
ABCD
DEF
DEFG
VWX

VWXYZ

------ Usage 4 ------

comm -i TextFile1.txt TextFile2.txt 
ABC
ABCD
DEF
DEFG
GHI
JKL
MNO
PQR
STU
VWX

VWXYZ


Friday 5 February 2016

Manhattan Massive Crane Collapse - Shocking Viral NYC Video

Just came across this shocking video of a huge massive crane (height of maybe 30-40 floors perhaps) crashing down the street in a matter of few seconds. The crane collapsed in the early morning hours around 8am on 5th Feb today. This happened in the Tribeca neighbourhood of lower Manhattan, New York City. The roofs of several cars were crashed and 1 man was confirmed killed as per latest reports. As per reports, this caused massive street closures due to the collapse. As you may be aware, Wall Street is just nearby.

Check out this shocking viral youtube video guys. Really surprised at the timing when the video captured the incident. What a timing! Shocked!

Related Posts Plugin for WordPress, Blogger...
eXTReMe Tracker