2014/04/15

How to look up a file in a directory? (UNIX)

In the below example:
CCY_EMU_EXT = filename (it will look up files CCY_EMU_EXT and more CCY_EMU_EXTx, where x can be anything with unlimited number of characters)

After the ">" symbol is the path where you want the result to print it to.  CCY_EMU_EXT_1.log is the result file.

find /gtsallsrv/gts/ -name "*" | xargs grep -l CCY_EMU_EXT  > /var/tmp/v439333/CCY_EMU_EXT_1.log &

How do you look up a process in UNIX? (UNIX)

How do you grep a process?  And what is grep?  grep is actually a function to "grab" the process of a specific name in unix.  It helps you to identify which process is actually running on background.

/usr/ucb/ps -auxww | grep -i qm | grep -i GTSD25QM

-i = ignore letter case

Enjoy.

What is sp_lock & sp_who (SQL)

sp_lock (Reports information about processes that currently hold locks.)
sp_who (Run sp_who to get the spid of the locking process.)

2014/04/12

How to set thousands separator in Java?

The following will work:

int no = 124750;
String str = String.format("%,d", no);
ENJOY!

How to convert from int to String? (Java)

Integer.toString(i) or String.valueOf(i) will work.

Enjoy!

How to convert string to int in Java?

int foo = Integer.parseInt("1234");

How do you pause in android (Java)?

First you have to create a Handler();, then you have to use the postDelayed function to pause the code.

public class MyActivity extends Activity {
    private Handler mHandler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mHandler.postDelayed(new Runnable() {
            public void run() {
                doStuff();
            }
        }, 5000);
    }

    private void doStuff() {
        System.out.println("Hellow World After 5 seconds!");
    }
}