Thursday, October 23, 2014

Show full list of program arguments in top command

Pass the -c argument to top to display the command line arguments that were passed to the process
top -c

Monday, September 29, 2014

List all references to a table in Oracle

Got this query from this blog:
select * from all_constraints
where r_constraint_name in
    (select constraint_name from all_constraints
      where table_name='TABLE_NAME');

Friday, March 8, 2013

Searching ascii code in vim

You can use %d to specify the ASCII value of the character to search. For example the following command would replace the SOH character (ASCII value 1) with a space

:%s/\%d1/ /g

Friday, January 13, 2012

Repeatedly run a command on Linux

The watch utility can be used to continuously run a command on Linux. For example in order to continuously monitor system memory via free the following command can be used:

watch -n1 free

Sunday, August 21, 2011

Azan 3.4 Released

Check out "Azan"

The latest version of Android based Azan application has been released.

It now has more than 30000(and still counting) total downloads and an average rating of more than 4 stars (out of 5). And It is being used by people from all over the world.

Friday, August 19, 2011

some sscanf magic

In the world of regular expressions and comprehensive frameworks like boost, ace etc it is justifiable if you have forgotten about poor sscan and the string parsing capabilities it provides.

Recently I had to do some rudimentary string parsing in C and didn't have external frameworks at my disposal. Thus sscanf came to the rescue and solved the problem just one line.

The following invocation of sscanf extracts from str everything uptill the first '*' and puts it in res_str.

sscanf(str, "%[^*]%*s", res_str);

Friday, August 12, 2011

Determine ringer mode on Android

The following code would let you determine if Android the device is on silent or vibrate.

private boolean isDeviceSilentOrOnVibrate(){
AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
case AudioManager.RINGER_MODE_SILENT:
case AudioManager.RINGER_MODE_VIBRATE:
return true;
return false;