Pages

28 Mar 2012

Just a tips with grep

It searches recursively, ignores binary files, and doesn't look inside Subversion hidden folders.(...)

grep -Ir --exclude="*\.svn*" "pattern" *

24 Mar 2012

Daemon Thread and User Thread

In java we have two type of Threads : Daemon Thread and User Threads. Generally all threads created by programmer are user thread (unless you specify it to be daemon or your parent thread is a daemon thread). User thread are generally meant to run our programm code. JVM doesn't terminates unless all the user thread terminate. 

On the other hand we have Daemon threads. Typically these threads are service provider threads. They should not be used to run your program code but some system code. These thread run parallelly to your code but survive on the mercy of the JVM. When JVM finds no user threads it stops and all daemon thread terminate instantly. Thus one should never rely on daemon code to perform any program code. 

For better understanding consider a well known example of Daemon thread : Java garbage collector. Garbage collector runs as a daemon thread to reclaim any unused memory. When all user threads terminates, JVM may stop and garbage collector also terminates instantly.

28 Feb 2012

Some tips for Mac users

Show all hidden files:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

Unlock folder recursively:
sudo chflags -R nouchg * ./

30 Jan 2012

Free Grep tool for Windows

It's findstr, which is already available in Windows (XP), did you know?

To get more details, you can refer this link: http://technet.microsoft.com/en-us/library/bb490907.aspx, or  type this command in the Command-line:
findstr /?

Here's a typical example to show how to use:
  • If in the Terminal of Unix you type:
grep -R "hi there" \data
  • Then in the Command-line of Windows you can type:
dir /B /S C:\data | findstr /f:/ "hi there"

28 Jan 2012

First post

It's always hard for me to write the first post of a new blog, and this time is not an exception. So to get over it, I will give you some links about me and this blog:
  • Here is the link to about page of this blog
  • And here is the link to my home page where you can find more information about me
Okie, now is 12:52 AM here, it's time to sleep, so bye...