Monday, January 30, 2012

Adding Recent File List Plugin to VIM

From: http://stackoverflow.com/questions/3171284/recent-file-history-in-vim

MRU (Most Recently Used) Plugin
http://www.vim.org/scripts/script.php?script_id=521

How to add on unix:
On vim enter:
:help add-plugin


Steps:

mkdir ~/.vim
mkdir ~/.vim/plugin
cd 
~/.vim/plugin
wget -O mru.vim http://www.vim.org/scripts/download_script.php?src_id=11919


To Use:
While working on vim, enter the command:

1. :MRU
2. Select a file, press enter, thats it.

ProcessBuilder Runtime Redirecting Output and Exec uting

The following discuss details of the problem:


ProcessBuilder redirecting output


http://stackoverflow.com/questions/5986324/processbuilder-redirecting-output

Shell redirection operators are unknown to ProcessBuilder. Put your command in a shell script and execute it, as shown here. Alternatively, use bash -c, as shown here.



Or prepending "bash -c" to the exec


http://stackoverflow.com/questions/5740390/printing-my-macs-serial-number-in-java-using-unix-commands/5740673#5740673


How to use OutputStream for output redirection


http://stackoverflow.com/questions/3777654/problem-with-runtime


Split a string containing command-line parameters into a String[] in Java


http://stackoverflow.com/questions/3259143/split-a-string-containing-command-line-parameters-into-a-string-in-java
Wonderful answer here:


Here is a pretty easy alternative for splitting a text line from a file into an argument vector so that you can feed it into your options parser:
This is the solution:
public static void main(String[] args) {
    String myArgs = Commandline.translateCommandline("-a hello -b world -c \"Hello world\"");
    for (String arg:myArgs)
        System.out.println(arg);
}

Git User Manual, Looks Very Good

Git, how to diff a file with its previous commits

git diff HEAD 0d82 -- myfile.java

Git, How to revert to a previous commit?

Best on this is:http://stackoverflow.com/questions/4114095/git-revert-to-previous-commit-how

I like this way:

git checkout 0d1d7fc32 .
git commit
Also you can do the following if you have some local modifications:
git stash
git checkout 0d1d7fc32
git stash pop
git commit


Friday, January 27, 2012

Saturday, January 14, 2012

Display files modified in the last 10 minutes on linux

find /var/log -type f -mmin -10

Wonderful command.