Saturday, December 29, 2007

Read properties from ant build file using perl

I want to read some properties from my ant build file in my perl script. I wrote a sample perl script for it. below is the script:

Thursday, December 27, 2007

Check all arguments of a running process

Many Java processes have long command lines, and as as a regular user, I may wish to determine that my java processes are running with the correct arguments or not.
unfortunately with the ps (/usr/bin/ps) command, users can only see the first 80 characters of command line, rest are ignored. So the user can not see the all command line arguments.

Solution:
1. Use pargs argument (ex. ps -eaf | pargs -a <pid>)
or
2. Use /usr/ucb/ps command ( /usr/ucb/ps -awwx | grep <pid>)

Wednesday, December 26, 2007

What version of Flash do you have?

Visit following link to display the currently installed version of the Flash player.

www.adobe.com/products/flash/about

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15507

Monday, December 24, 2007

Kill java processes from perl script

Requirement:- If multiple java processes are running on your system and you want to kill only few specific from them.
If we do it manually then we have to perform below two steps:

1. jps (it will return all the java processes running on the system) in below format:
<pid>     <process name>
<pid>     <process name>
<pid>     <process name>
<pid>     <process name>
...

in my case i got the below output from above command:

1234 Server1
1334 Server2
1454 Server3
1264 Server4
1238 Server5
1244 Server6

2. now i have the process id of all the java processes so i can kill them using kill command, (let say if i have to kill only Server1, Server5 , then)

kill -9 1234
kill -9 1238

By using perl script, i can write below simple script which will do my above task:

foreach $_ (`jps`) {
my($pid,$pname) = /(\S+)\s+(.*)/;
if($pname eq "Server1" | $pname eq "Server5" ) {
print("Killing Process : $pname ($pid) \n");
system("kill -9 $pid");
}
}

Monday, December 17, 2007

Searching tips in Google

1. Explicit Phrase: Lets say you are looking for content about internet marketing. Instead of just typing internet marketing into the Google search box, you will likely be better off searching explicitly for the phrase. To do this, simply enclose the search phrase within double quotes.

Example: “internet marketing”

2. Exclude Words: Lets say you want to search for content about internet marketing, but you want to exclude any results that contain the term advertising. To do this, simply use the “-“ sign in front of the word you want to exclude.

Example Search: internet marketing -advertising

3. Site Specific Search: Often, you want to search a specific website for content that matches a certain phrase. Even if the site doesn’t support a built-in search feature, you can use Google to search the site for your term. Simply use the “site:somesite.com” modifier.

Example: “internet marketing” site:www.smallbusinesshub.com

4. Similar Words and Synonyms: Let’s say you want to include a word in your search, but want to include results that contain similar words or synonyms. To do this, use the “~” in front of the word.

Example: “internet marketing” ~professional

5. Specific Document Types: If you’re looking to find results that are of a specific type, you can use the modifier “filetype:”. For example, you might want to find only PowerPoint presentations related to internet marketing.

Example: “internet marketing” filetype:ppt

6. This OR That: By default, when you do a search, Google will include all the terms specified in the search. If you are looking for any one of one or more terms to match, then you can use the OR operator. (Note: The OR has to be capitalized).

Example: internet marketing OR advertising

7. Phone Listing: Let’s say someone calls you on your mobile number and you don’t know how it is. If all you have is a phone number, you can look it up on Google using the phonebook feature.

Example: phonebook:617-555-1212 (note: the provided number does not work – you’ll have to use a real number to get any results).

8. Area Code Lookup: If all you need to do is to look-up the area code for a phone number, just enter the 3-digit area code and Google will tell you where it’s from.

Example: 617

9. Numeric Ranges: This is a rarely used, but highly useful tip. Let’s say you want to find results that contain any of a range of numbers. You can do this by using the X..Y modifier (in case this is hard to read, what’s between the X and Y are two periods. This type of search is useful for years (as shown below), prices or anywhere where you want to provide a series of numbers.

Example: president 1940..1950

10. Stock (Ticker Symbol): Just enter a valid ticker symbol as your search term and Google will give you the current financials and a quick thumb-nail chart for the stock.

Example: GOOG

11. Calculator: The next time you need to do a quick calculation, instead of bringing up the Calculator applet, you can just type your expression in to Google.

Example: 48512 * 1.02

12. Conversion: The next time you need to do a quick calculation on the temperature, you can just type your expression in to Google.

Example: 72F in C

The conversion feature works for a whole host of things: "100cm in inches", "100us gallons in uk gallons", "100bar in psi", "100 GBP in USD", etc.

13. Word Definitions: If you need to quickly look up the definition of a word or phrase, simply use the “define:” command.

Example: define:plethora

14. Searching for URLs containing certain words. Use the "inurl:word" modifier.

Example site:i-hack.org inurl:psp