Sunday, September 26, 2010

Git on Windows [ Beginners HowTo ] - Part 1

This is Part#1 'HowTo' beginners guide for using Git, one of the best open-source SCM (Source Code Management) technology devised by Linus Torvalds to manage Linux's source code contribution from the phenomenal linux community.
location for 'msysgit': http://code.google.com/p/msysgit/

Topics covered in this video tutorial:

  1. downloading 'msysgit', windows Git implementation for Git
  2. installing 'msysgit' properly to have a GUI option in context menu of directories
  3. using GUI: creating a new Project with Git Repository
  4. using GUI: making changes to repository and committing them
  5. using GUIcloning a local and a remote repository

@Youtube: http://www.youtube.com/watch?v=Npd1UA4exCc

@Vimeo:

Wednesday, August 11, 2010

[LiNUX] to kill multiple instances of a service; so AWKill (kill + awk) it

aw(Kill) all instances:

it has been happening in Linux where sometimes I need to start/restart/stop any Linux service but either it don't have a (init.d,rc.d,*)/Service Script or simply failed even if it had
then the usual thing I used to do is get Process ID of relevant App by using
`ps aux | grep $StuckApp` 
and then kill it by
`kill -9 $PID`

but few days back I ran a server (w/o any service script), generating 7-10 parallel instances of it
now to kill it look + type all PIDs... now 'm not lazy but that real wastage of time
so I automated it with help of AWK


so here is a command/script you can use to automate it in similar cases:

shell command:
ps aux | grep $StuckAppNameHere | awk '{print $2; system("kill -9 "$2"");}' 

to use it as a shell script save following two lines in a script:
echo "Killing all instances found matching for "$1
ps aux | grep $1 | awk '{print $2; system("kill -9 "$2"");}'


and pass the name of app to be matched and killed as parameter to it
say you saved script as awKillAll.sh, and you have to kill all processes matching with 'python'
then use
#awKillAll.sh python

Thursday, August 5, 2010

run PYTHON (no-script) to provide a CGI supported HTTP Server

want HTTP Server with CGI Support, just need PYTHON without any scripts

so to have CGI supported HTTP server, just by using PYTHON, you need to follow below steps

Step#1. 
opening shell/command-prompt

Step#2.
$>cd (change dir) to directory you want to be root of your server

Step#4.
create a directory name 'cgi-bin' or 'htbin', say "mkdir cgi-bin"

Step#5.
copy all your CGI-scripts to this newly created 'cgi-bin' directory


Step#6. 
now if anyhow you changed your directory, change it back to Parent Dir of created dir 'cgi-bin'

Step#7. 
now run this command without quotes 
"python -m CGIHTTPServer"

Finally, [ Say yyippppeeeee... ] Thanks...

now you have a CGI supported Simple HTTP Server running, that can be accessed at Port 8000 of your Server's IP/Name

so you can test it by browsing in any web browser at http://YOUR_SERVER_IP:8000/
and like if you copied any script 'time' to cgi-bin then its accessible at http://YOUR_SERVER_IP:8000/cgi-bin/time

is( PYTHON installed ){ Yes: you have a simple HTTP server }

is Python installed, you already have Simple HTTP Server

if you need any simple plain web-server on your machine to server files (html or else)
and
if you have PYTHON installed over your machine
then
you don't need anything else
because
you can run PYTHON itself in Simple HTTP Server mode to serve files from any directory you need
by
following below steps
Step#1.
[ opening shell/command-prompt ]
Step#2.
[ $>cd (change dir) to directory you want to be root of your server ]
Step#3.
[ run this command without quotes "python -m SimpleHTTPServer" ]
Finally, [ Say abra-ca-dabra... ] Thanks...
now
you have a Simple HTTP Server running, that can be accessed at Port 8000 of your Server's IP/Name
so
you can test it by browsing in any web browser at http://YOUR_SERVER_IP:8000/

Tuesday, July 13, 2010

DummyNet - HowTo { an open-source tool to tweak network latency and bandwidth }

Any service allowing to  tweak Network Latency and Bandwidth as per desire
for testing application  performance at different network latency scenarios.

Tools/Technology Used:
DummyNet
{Home}URL: http://info.iet.unipi.it/~luigi/dummynet/

Background:
Normally the difference which comes in  development and  deployment
environment of Web Applications, is of bandwidth and latency.
To test the applications in actual scenario, one needs to tweak the latency as
per deployment scene and then use it.
There are few paid VE Technology based services like "Shunra" for this. But
we required a free, open-source application, if possible for windows.
DummyNet, it's an old Italian university project started for BSD systems,
recently ported for Windows also. It helps in reducing latency of NIC to
desired level.

Execution Method:
[] Install NDIS Driver
1.  Open the configuration panel for the network card in use
  {right click on the icon on the SYSTRAY, or go to 'Control
Panel' > 'Network' to select}
2.  Click on 'Properties' > 'Install' > 'Service' > 'Add'
3.  Click on 'Driver Disk' and select 'netipfw.inf' in the
folder it has been extracted to.
4.  Select 'ipfw+dummynet' which should be the only service
visible.
5.  Click 'Accept' on the warnings for the installation of an
unknown driver.

Create a BAT-File for your Application to be run under test bandwidth &
latency with following content
--------------------------------------File Content Starts  from Next line
@echo off
@set CYGWIN=nodosfilewarning
@ipfw -q flush
@ipfw -q pipe flush
@echo #################
@echo ## Setting up ##
@echo #################
ipfw pipe 3 config delay 1000ms bw 500Kbit/s mask all
ipfw add pipe 3 ip from any to any
ipfw pipe show

@echo ""
@echo "Network Tweaking Done, Start Testing."
@echo ""
@echo "Press Enter when testing is done, to restore original Network Settings."
pause

@echo #################
@echo ## Cleaning up ##
@echo #################
ipfw -q flush
ipfw -q pipe flush
pause
--------------------------------------File Content Ends at Previous line
Here, 1000ms is latency set and can be changed to desired value
500 Kbps is bandwidth set and can be changed to desired value
'delay x' and 'bw x'; both can be used separately also as per need
either place a command running your application to be tested in place of
'your_command_running_your_app'; or simple remove that line 
and when the command gets paused at the first pause, run your appl ication
manually.
 

Installation:
Follow the wlak-through video on Youtube at :
http://www.youtube.com/watch?v=jP-DrxTMXDc

Then, to test if it gets installed properly as a network services. It has a testme.bat file showing different tests, just run it and
check statistics.

I tested it on Windows XP, Vista, 7... and it worked great.

Wednesday, June 23, 2010

Microsoft Network Monitor {its free, it's efficient}

Microsoft Network Monitor

Brief Description:
One of the best network analysis utilities on Windows. 
You can choose any Physical/Virtual NIC present on your machine to capture traffic.
It shows the traffic in a nested tree menu ordered by Application Name generating that traffic.
This way you can analyse entire network traffic per application from your machine.
Tool to allow capturing and protocol analysis of network traffic.
It's free, it's fine network packets analysis utility.

It also allows you to save captured data into PCAP files, and can even open and analyze PCAP files.

Download Link & Installation:

How To Capture Network Traffic:

msnm.jpg

Saturday, January 16, 2010

Easily Set Up a WebServer with a StandAlone Executable JAR

To set up a WebServer on your machine, a very easy way would be to use 'ABK SiteHoster', a project currently in its beta stage... just a standalone executable JAR... no complex configuration required...

demo @ Youtube: http://www.youtube.com/watch?v=CogPa646vi8

Using:
[Step#1]
Download JAR file from any of the two locations below

Sourceforge Link : http://sourceforge.net/projects/sitehoster/ 



say you downloaded a file named "http09_v0.5beta.jar"

[Step#2]
Copy your WebSite (currently no Server Side Scripting supported) to any folder, whose Absolute Path is say "C:\temp\WebDocs"

[Step#3]
open command prompt, change directory to "http09_v0.5beta.jar"'s directory and execute following command

cmd> java -jar http09_v0.5beta.jar "C:\temp\WebDocs"

if you want "C:\temp\WebDocs\index.html" to be default file opened at Website root, then instead run following command

cmd> java -jar http09_v0.5beta.jar "C:\temp\WebDocs" index.html

if Port 80 of your machine is already busy, and you want to run it at some other port say 1234, then run following command

cmd> java -jar http09_v0.5beta.jar "C:\temp\WebDocs" index.html 1234

[NOTE]
if you are on Linux/Unix not Windows follow the Note at end of this post


PreRequirement:
Instrall Java Virtual Machine on your Computer System.

Syntax :

[] Starting HTTP Server hosting web files in folder with as default file to open when root of IP accessed (it opens at Port 80 by default)
SYNTAX:
"java -jar http09_v0.5a.jar C:\WebDoc\ index.htm"

[] Starting HTTP Server hosting web files in folder with as default file to open when root of IP accessed; and 1234 is Port to be opened at (so access like http://IP:1234/index.htm)
SYNTAX:"java -jar http09_v0.5a.jar C:\WebDoc\ index.htm 1234"


NOTE:
to make it work in Linux, download Source Code, extract it and in /SRC/MACRO/appMACRO.java file
change to   and recompile the app