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
Wednesday, December 26, 2007
What version of Flash do you have?
Posted by
Vishnu Agrawal
at
1:47 PM
0
comments
Labels: flash version
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");
}
}
Posted by
Vishnu Agrawal
at
10:12 PM
0
comments
Labels: java, perl script
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
Posted by
Vishnu Agrawal
at
6:53 PM
1 comments
Labels: google tip
Tuesday, November 20, 2007
Find Nth Max salary of employee
I have following table in the DB
Create table Employee
(
Eid int,
Name varchar(10),
Salary money
)
insert few values in the table:
Insert into Employee values (1,\'harry\',3500)
Insert into Employee values (2,\'jack\',2500)
Insert into Employee values (3,\'john\',2500)
Insert into Employee values (4,\'xavier\',5500)
Insert into Employee values (5,\'steven\',7500)
Insert into Employee values (6,\'susana\',2400)
A simple query that can find the employee with the maximum salary, would be:
Select * from Employee where salary = (Select max(Salary) from Employee)
[The SQL Engine evaluates the inner most query and then moves to the next level (outer query). So, in the above example inner query i.e. Select max(Salary) from Employee is evaluated first. This query will return a value of 7500 (based on the sample data shown as above). This value is substituted in the outer query and it is evaluated as: ]
Select * from Employee where salary = (7500)
Returns:
Eid Name Salary
5 steven 7500
If the same syntax is applied to find out the 2nd or 3rd or 4th level of salary, the query would become bit complex to understand. See the example below:
Select * from Employee where salary =
(Select max(Salary) from Employee where salary
< (Select max(Salary) from Employee where
Salary < (Select max(Salary) from Employee where
Salary < …………………………………………… N
The above query would go on and on, depending on the level of salary that is to be determined. As mentioned earlier, the SQL Engine evaluates the inner most query first and moves the next outer level. One wouldn’t want to write such a big query just to find out this simple information.
The same result can be achieved with a simple syntax and easily understandable logic, by using a CORRELATED SUBQUERY. Correlated sub-query is a performance overhead to the database server and so, you have to use it only if it is required. Avoid using Correlated subquery on large tables, as the inner query is evaluated for each row of the outer query
Following is the query that captures the Nth maximum value:
Select * From Employee E1 Where
(N-1) = (Select Count(Distinct(E2.Salary)) From Employee E2 Where
E2.Salary > E1.Salary)
(Where N is the level of Salary to be determined)
In the above example, the inner query uses a value of the outer query in its filter condition meaning; the inner query cannot be evaluated before evaluating the outer query. So each row in the outer query is evaluated first and the inner query is run for that row. Let’s look into the background process of this query, by substituting a value for N i.e. 4,(Idea is to find the 4th maximum salary):
Select * From Employee E1 Where
(4-1) = (Select Count(Distinct(E2.Salary)) From Employee E2 Where
E2.Salary > E1.Salary)
Since the outer query’s value is referred in the inner query, the operation is done row-by-row. Based on the sample data as shown above, the process starts with the following record:
Employee E1
----------------------------------
Eid Name Salary
1 harry 3500
The salary of this record is substituted in the inner query and evaluated as:
Select Count(Distinct(E2.Salary)) From Employee E2
Where E2.Salary > 3500
Above query returns 2 (as there are only 2 salaries greater than 3500). This value is substituted in the outer query and will be evaluated as:
Select * From Employee E1 Where (4-1) = (2)
condition evaluates to FALSE and so, this record is NOT fetched in the result.
Next the SQL Engine processes the 2nd record which is:
Employee E1
----------------------------------
Eid Name Salary
2 jack 2500
Now the inner query is evaluated as:
Select Count(Distinct(E2.Salary)) From Employee E2
Where E2.Salary > 2500
This query returns a value of 3 (as there are 3 salaries greater than 2500). The value is substituted in the outer query and evaluated as:
Select * From Employee E1 Where (4-1) = (3)
condition evaluates to TRUE and so, this record is fetched in the result. This operation continues for all the remaining records. Finally the result shows these 2 records:
Eid Name Salary
2 jack 2500
3 john 2500
Posted by
Vishnu Agrawal
at
5:24 PM
2
comments
Sunday, November 18, 2007
Exponential(TM) Identifies Top Online Advertising Trends For 2008
Exponential(TM) Interactive, Inc., the technology-driven media services company that delivers innovative products and services to meet the demands of advertisers and publishers, today announced online advertising trends for 2008. The parent company of Tribal Fusion, one of the industry's leading online ad networks, Exponential has identified top trends emerging from technology and business innovation, creativity and brand measurement. Trends to watch include: one-to-one marketing, online video advertising, new local advertising platforms, innovation in ad effectiveness measures, marketing opportunities from the semantic web, and virtual worlds.
Read Full Article here
Posted by
Vishnu Agrawal
at
6:17 PM
0
comments
Labels: exponential, online advertising, tribal fusion
Tuesday, October 30, 2007
GNU Screen utility
Screen program provides the following functionality:
- Remote terminal session management (detaching or sharing terminal sessions)
- Unlimited windows (unlike the hardcoded number of Linux virtual consoles)
- Scrollback buffer (not limited to video memory like Linux virtual consoles)
- Copy/paste between windows
- Split terminal (horizontally) into multiple regions
- Locking other users out of terminal
- Screen is an easy way to allow processes to continue running after the session is terminated, if you lose connection screen will save your spot
************************************************************
startup_message off
vbell off
caption always “%{= bb}%{+b w}%n %h %=%t %c”
hardstatus alwayslastline “%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<” activity “Activity in %t(%n)” shell -/bin/bash
************************************************************
Screen Commands
(screen) Start screen
(screen -S vishnu) Create a screen session with the name vishnu
(screen -r vishnu) reconnect to the session with the name vishnu
(screen -x ) Connect to an existing screen session
(screen -d ) detaching a screen session
(screen -r) reattaching the screen session
(Ctrl+a c ) New window
(Ctrl+a n ) Next Window
(Ctrl+a p ) Previous Window
(Ctrl+a ” ) Select window from list
(Ctrl+a Ctrl+a) Previous window viewed
(Ctrl+a <0-9> ) Select the numbered window
(Ctrl+a A ) Set window title
(Ctrl+a K ) Kill window
(Ctrl+a d ) Detach screen from terminal
(Ctrl+a x ) Lock Session
(Ctrl+a : ) Goto screen command prompt
(Ctrl+a ? ) Show key binding/command names
(Ctrl+s ) Pause the output on screen
(Ctrl+q ) Resume the output on screen
(Ctrl+a :escape ^Ww) Change key binding to w character
(Ctrl-a * ) List all currently attached displays. (displays)
(Ctrl-a Ctrl\) Kill all windows and terminate screen. (quit)
(Ctrl-a w ) List all windows. (windows)
(Ctrl-a h ) Write contents of the current window to the file hardcopy.n. (hardcopy)
(Ctrl-a H ) Begin/end logging of the current window to the file screenlog.n. (log)
(Ctrl-a ' ) Prompt for window name or number to switch to. (select)
Posted by
Vishnu Agrawal
at
10:15 PM
0
comments
Labels: gnu screen, linux, screen
Sunday, September 9, 2007
Linux Cut command
Cut Command
------------
Divide a file into several parts (columns)
syntax:
cut [-b] [-c] [-f] list [-n] [-d delim] [-s] [file]
Examples:
--------
1. Let say you have a file test.txt which has colon(:) seperated data
406378:Sales:Itorre:Jan
031762:Marketing:Nasium:Jim
636496:Research:Ancholie:Mel
396082:Sales:Jucacion:Ed
If you want to print first set of data from each row, you can use cut command as follow:
cut -d":" -f1 test.txt
If you want to print just columns 1 to 6 of each line (the employee serial numbers), use the -c1-6 flag, as in this command
cut -c1-6 test.txt
Posted by
Vishnu Agrawal
at
10:19 PM
2
comments
Linux Tips
Replace newline with comma (cut -d, -f1 vishnu.csv | tr '\n' ',')
Get some specific string from each line (grep "uid%3D" <fileName> |awk -F"uid%3D" ` {print $2}` | cut -d"%" -f1)
Pull first n characters of each line from a file (cut -c1-n file.txt > newfile.txt)
Count total number of lines in all specific files under a directory (find . -type f -name '*.as' -o -name '*.mxml' -o -name '*.java'| xargs cat |wc -l)
Find number of occurrences of a text in a file (grep text fileName |wc -l)
Display the top most process utilizing most CPU (top -b 1)
Show the working directory of a process ? (pwdx pid
Display the parent/child tree of a process ? (ptree pid
Display the no.of active established connections to localhost ? (netstat -a | grep EST)
How to create null file ? (cat /dev/null > filename1)
Display top ten largest files/directories ? (du -sk * | sort -nr | head)
Display disk usage (du -h)
How to save man pages to a file ? (man
Display the files in the directory by file size ? (ls -ltr | sort -nr -k 5)
Display the processes, which are running under yourusername ( ps -aef | grep
Display the all files recursively with path under current directory ? ( find . -depth -print)
Display the Disk Usage of file sizes under each directory in currentDirectory ? (du -k . | sort -nr)
List the files in current directory sorted by size ? (ls -l | grep ^- | sort -nr)
Posted by
Vishnu Agrawal
at
10:12 PM
0
comments
Wednesday, September 5, 2007
Soalris: Kill a process which is using a particular port number
Today i came across a problem in solaris. The problem was that while starting my application server, it was throwing an error "Address already in use".
My app server is a java process and there are many other java process which are running on my zone. But the issue is, how may i know that which java process is using that particular port?
I followed following steps:
1. List all the java process running on my zone ( ps -eaf |grep vagrawal| grep java )
2. Go through each java process and check if it using that particular port ( pfiles $pid|grep 1182
(here $pid is the process id of the java process and
Above method works fine but it is bit a long process, as i have to run step 2 for all java processes, so i ran a folowing command on my console:
Above command/script will list out all the process ID and will tell if any process is using port 1188
Now i have process ID of the process which is occupying my port, and i can kill that by kill -9 pid
Posted by
Vishnu Agrawal
at
4:30 PM
0
comments
Labels: solaris