Recent Articles / Archives

Killing specific ports and processes in windows.

I recently had a problem that, some application is using the port already and unable to start another program using same port. This might have been faced by many developers around the world. So before, you start your new program using the same port. Follow the steps as below.

Step 1: The netstat -ano command can produce the following output:

Proto    Local Address    Foreign Address               State                                     PID

TCP        0.0.0.0:80             0.0.0.0:0                      Listening                              888

Step 2: Let’s say that we are looking for port 80 — IIS, Apache and other web servers listen in port 80, so when you are having problems starting Apache, this technique will be useful. Here is the command.

C:\>netstat -aon | findstr 0.0:80

-a means list all active connections and their ports. -o means include their process IDs. -n means display the port numbers numerically.

Step 3: If you know the name of a process to kill, for example notepad.exe, use the following command from a command prompt to end it:

taskkill /IM notepad.exe

This will cause the program to terminate gracefully, asking for confirmation if there are unsaved changes. To forcefully kill the same process, add the /F option to the command line. Be careful with the /F option as it will terminate all matching processes without confirmation.

Or, after finding out the specific process id from step 2, we can kill that process as

Step 3: To kill a single instance of a process, specify its process id (PID). For example, if the desired process has a PID of 827, use the following command to kill it:

taskkill /PID 827

February 20, 2011 · Development Tools/Techonolgy · Comments (2)

Sleep Your Way to Better Heart Health

Lack of sleep can do more than make you cranky—it could shorten your lifespan. New research suggests that sleeping less than six to eight hours a night leads to an increased risk of heart attack and stroke.

The risk of heart disease can increase as much as 48 percent and the risk of stroke by 15 percent when a person regularly doesn’t get a minimum of six hours of sleep, scientists from the U.K.’s University of Warwick recently revealed. The researchers found that chronic sleep shortages produce hormones and chemicals in the body that increase the risk of cardiovascular disease.

Researchers studied 470,000 people from eight countries, including the U.S., U.K., Japan, and Sweden, and found that the demands of the modern workplace and family are taking a toll.

“The trend for late nights and early mornings is actually a ticking time bomb for our health,” researcher Francesco Cappuccio told the BBC. “So you need to act now to reduce your risk of developing these life-threatening conditions.”

The study suggests that sleep deprivation also contributes to high cholesterol, high blood pressure, diabetes, and obesity.

Source: Reader’s Digest Editors

February 15, 2011 · Awareness,Health · No Comments Yet

Search/Copy/Move file by extension

I recently had a problem to copy my PDF files to a different folder, to do this I could have used windows file search and select all and copy to a different location. But that’s a slow process and my windows explorer says “not responding” many times as there was above 3K PDFs on my computer. So I thought what if I can write a command line program which searches rigorously to the folders provided and finds all PDFs files for me and let me have a copy option to different folder as well. Initially I wrote a program to find files with “.pdf” extension but after successfully searching PDF files, I made it generic for all extensions provided. One interesting thing I found was the count of all the movies with “.avi” extension in some of my shared computer in my office. That was really interesting. And I thought of providing this to everyone, it would be more fun and useful for the needy as well. So let me share my small work which can be an effective tool for you as well. Download FileUtility.exe
The only thing required is JRE C:\Program Files\Java\JRE folder. For non-java users JRE can be downloaded on http://javadl.sun.com/webapps/download/AutoDL?BundleId=45832.
For Java Developers if you want to reuse the FileUtility API. You can download the JAR and browse the Javadoc and if you want to download Javadoc
Enjoy!!!!!!