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!

Stealth mode in Mac OS X

In Mac OS X, you can enable Stealth mode so that ping requests to your IP address are unreachable.

Go to System preferences -> Security & Privacy -> Firewall -> Firewall Options

Tick the Stealth mode options as shown below:


Now if you try to ping your Mac's IP address from another machine, you'll get the Request Timeout error with the stealth mode enabled.

Maven - Install vs Deploy

In Maven, the difference between mvn install and mvn deploy is the following :

  • mvn install is used to install the artifact/dependency on your local repository.


  • mvn deploy is used to upload/install the artifact/dependency on the remote repository like nexus or artifactory.

Check this link for detailed reference.

Also let me refresh your memory about repositories. As you may be aware, your local repository is usually a local cache of the remote repository and may also contain unreleased artifacts.
Related Posts Plugin for WordPress, Blogger...
eXTReMe Tracker