Tuesday, June 23, 2015

VIM Commands (VI Improved)

-N Use newer Vim mode (not compatible with original vi)
vim -N file-name

i - Insert text at out current cursor position
I - Insert at the start of the current line
a- Append to cursor position
A - Append to end of the current line
o - Insert a blank line below and go into insert mode
O - Insert a new line above the current cursor position

x - delete text in command mode
3x - delete three characters
dw - delete the whole word
3dw - delete 3 words
u - Undo

Navigation

7G - Go to line number 7
7gg
w - move forward one word
5w - jump 5 words
b - move backward one word
$ - end of the line
^ - start of the line
1G - Return to the start of the file
G - Go to the end of the file
gg - Go to the first line of the file

x - Save and quit
wq - Save and quit

u - Undo

Ctrl + r - Redo

yy - Yank (copy) current line

p - Paste text below the current line.

P - Paste above the current line.

cw - change current word
6l - Six times rightward
c
:w! - Force write

5j - Jump down 5 lines

:cd - Change working directory

:pwd - Check the current working directory.

:e. - Directory listing

V - Visual mode line select
v - Character wise visual mode:

d - Delete selected region

c - Change selected text (Cut)

y - copy

:set autochdir - Automatically use the current file's directory as the working directory.


Wednesday, June 17, 2015

Run Hadoop Unit-Tests on an Amazon EC2 Ubuntu instance, then disconnect

I am using an Amazon EC2 Ubuntu instance to build Hadoop codebase and it takes several hours. During Unit-Tests run the Putty SSH connection disconnects and the build also stops along with it, since the session ends. So I had the problem where I couldn't complete the build.

I raised with as a question in the AWS forum as well.
https://forums.aws.amazon.com/thread.jspa?threadID=182760&tstart=0

Later I found out it could be done using the "nohup" command as follows:
The maven build command is highlighted in yellow.
nohup mvn -Dmaven.test.failure.ignore=true test </dev/null > unit-test.log 2>&1 &


When you log into the instance again use the following command to see the Unit Test output:
tail -f -n 20 unit-test.log

Sunday, June 7, 2015

Load Apache Kafka codebase on Scala IDE

1) Download and load Scala IDE.

http://scala-ide.org/download/sdk.html

2) Install Spring Tool Suite for Scala IDE.

3) Go the below URI and copy the highlighted URI.

https://spring.io/tools/sts/all


4) Open Install New Software dialog on Scala IDE and paste the above highlighted URI on Add Repository.

Select only "Core / Eclipse Integration for Gradle"

On Scala IDE go to import Gradle Project dialog and browse the Kafka codebase root and click "Build Model" button to create the eclipse project files. Once all the projects are configured, there are shown in the Import Gradle Project dialog.




My Dev Environment Details:

> Operating System Window 7
> java version "1.8.0_45"
> Scala IDE Version 4.1.0