Thursday, January 24, 2013

VBScript :: Ping Servers and Export To Microsoft Excel

This is a useful VBScript I always keep around. It requires Microsoft Excel (tested with 2003/2007), a text file with a list of host names (Windows servers) and the Command Line to run

The file servers.txt must look like this:

HOSTNAME1
HOSTNAME2
HOSTNAME3
.
.
.
HOSTNAMEn

This is the syntax to execute it:

C:\>cscript ping_servers.vbs

Wednesday, January 23, 2013

AIX's kill command

Many people ask me which is the best practice for the kill command. My preferred SignalName is -TERM or -15. This signal can be trapped.

kill [  - SignalName |  - SignalNumber ] ProcessID ...

The kill command sends a signal (by default, the SIGTERM signal) to a running process. This default action normally stops processes. If you want to stop a process, specify the process ID (PID) in the ProcessID variable. The shell reports the PID of each process that is running in the background (unless you start more than one process in a pipeline, in which case the shell reports the number of the last process). You can also use the ps command to find the process ID number of commands.

A root user can stop any process with the kill command. If you are not a root user, you must have initiated the process you want to stop.

SignalName is recognized in a case-independent fashion, without the SIG prefix.

If the specified SignalNumber is 0, the kill command checks the validity of the specified PID.


  • -1 is the most polite.  It is a gentleman's agreement between Admin & Programmer.
  • -15 is from AIX.  It's the thing that happens when 'shutdown' says "All processes currently running will now be killed..."
  • -9, obviously, is low-down-dirty & mean.  The process doesn't get the chance to clean up at all.  Not ideal...

-HUP (1)
-TERM (15)
-KILL (9)


MapReduce


MapReduce is a framework introduced by Google for processing larges amounts of data.
The framework uses a simple idea derived from the commonly known map and reduce functions used in functional programming (ex: LISP). It divides the main problem into smaller sub-problems and distribute these to a cluster of computers. It then combines the answers to these sub-problems to obtain a final answer.
MapReduce facilitates the process of distributed computing making possible that users with no knowledge on the subject create their own distributed applications. The framework hides all the details of parallelization, data distribution load balancing and fault tolerance and the user basically has only to specify the Map and the Reduce functions.
In the process, the input is divided into small independent chunks. The map function receives a piece of the input, processes it, and passes the input in the format key/value pair as answer. These key/values are grouped in a certain way and given as input to the reduce function. This in its turn merges the values, giving the final answer.

Each map and each reduce may be processed by a different node (Computer) in the cluster. The quantity of nodes in the cluster may be as big as the availability of computers in your network. The framework is responsible for dividing the input and feeding the map function. Afterwards, it collects  map's outputs, group and send them to the reduce function. After the work of reduce if done, the framework gather the answers in a final output.

The following picture shows the MapReduce flow

Tuesday, January 22, 2013

Sucessful Import from Wordpress

I successfully imported my old posts from Wordpress. First I had to EXPORT my blog from Wordpress (Site Admin | Tools | Available Tools | Export).




Then uploaded the XML file to WordPress2Blogger online service to make it Blogger compatible.

Finally, I used the IMPORT function from Blooger. VoilĂ !