It all sounds Geek to me! [Gautam Arora]

Saturday, December 10, 2005

TurboGears 0.9...coming soon to a blog near you!

It might be some time before we get TG 0.9 but the docs are being updated and now a new screencast has been added....a Tunes Tutorial! The video also demos the CatWalk, and I almost fell off my chair looking at it! :)

Looking at the roadmap for TG Dilly, its still 60% to do....cant wait to get my hands on it!

The docs also highlight the deployment stuff and its much needed as i am hoping to move to TG. And have found some web hosting plans too at TextDrive,DreamHost and Python-Hosting but yet to come to a decision.

On the work front, i have been hopping between two projects:
1. on the J2EE platform-> development on Win, testing on Linux and deployment on Solaris!
2. using C/Pro*C/Unix for development (might get to use libxml here, which has some gr8 python bindings)

There are times where i prefer to use over Google search, coz i like it that some one has already done the search for me and tagged the best pages, and then i also get to see his other bookmarks which are mostly related to my search! and now Yahoo! bought, so i am wondering what would be Google's next move? digg or reddit or (but that uses or...

Monday, December 05, 2005

Why Reddit was rewritten in Python?

Well, Spez has tried to make peace between the Lisp, Ruby and Python warriors with a straight and simple explanation for the Reddit rewrite in Python.

"We were already familiar with Python. It's fast, development in Python is fast, and the code is clear. In most cases, the Lisp code translated very easily into Python. Lots of people have written web applications in Python, and there's plenty of code from which to learn. It's been fun so far, so we'll see where it takes us."

Do check out the comments on this page and at previous post by spez.

Reddit rewritten in Python!

It a day to celebrate for the Python Geeks ...

Reddit in a new Pythonic Avtaar!

p.s. got to use my limited python skills at work. A python script to analyse some bugs in .java files under a given target directory (and sub-dirs...).A 20-odd lines code that scans through 2225 files and 201 folders to generate a log file in ~ 4 secs! (This aint for setting any benchmarks though!) Python Rocks! also used the py2exe module to get a .exe

Just for the records, for the last few weeks i have been workin on:

-Cygwin and IBM WebSpehere App Assembly Tool


- and now Python

-and most of the work was on Linux!


More on Py Reddit:

What is reddit written in?

Seriously? I heard it was written in Lisp.
It was, but we rewrote it.

So what Python framework did you use?, the web application framework of choice for discriminating programmers. is itself upon SQLObject and Cheetah. The data is stored in a PostgreSQL database and served by lighttpd.

Friday, December 02, 2005

Where the 'FLOCK' have i been

Now thats what i call a browser for Web 2.0 !!!

Flock will redefine the way we surf, blog and of course, keep track of bookmarks!

For the past few days i have been busy getting myself comfortable with Google Reader (for my feeds), bookmarking) and tons of its extensions, Furl (bookmarks where you can search for text within the links), slashdot(this aint new for me though), digg, reddit etc etc...

But having my bookmarks online was on top of my priority list and somehow none of the existing options available impressed me, so the best i could come up was to use and carefully tagging my links, an extension for Firefox Foxylicious for syncing 'em and another script for furling em and another script to remember if the page i was on was already bookmarked by me.......

and then i decided to give a shot at Flock!

Its got all i wanted and more, a perfect web solution! The best features include the seamless integration with, 'star'ing and blogging plus there are so many that i could just keep blogging......

and hopefully it will make me a lil more regular with my posts....... :)

read more about Flock at FaeLLe's Blog

Friday, November 25, 2005

Friday, November 11, 2005

TurboGears: Python-Based Framework for Rapid Web Development

I have been trying my hands at TurboGears(TG) for some time now, and though i am still learning the basics and going through the docs, i am slowly falling in love with it...

Talking of web frameworks, this one is quite a beauty.There are others in the Python world too like Django(and lets not forget Ruby on Rails, right CodeMonkeys?)
I wanted to give a shot at one of these and when i heard of TG at awaretek, i decided to go for it.

TG pulls together Mochikit(Javascript library),Kid (XML-based templating engine), CherryPy (web app framework) and SQLObject(object relational mapper) in the MVC way!

This is what its got...

and this is how it all works togethers...

Plus its got great docs and a 20-minute-wiki screencast...

Saturday, October 15, 2005

Form validations for PL/SQL

--***PL/SQL code for Email validation***---
t_valid NUMBER(1);
t_totallen NUMBER(2);
t_counter NUMBER(2):=0;
t_atpos NUMBER(2):= 1;
i NUMBER(2) := 1;
t_pointpos NUMBER(2):= 1;

mail_ch VARCHAR2(1);

result number; --:GR


t_totallen := LENGTH(:text_item_email);
t_counter := t_totallen;
i := 1;
t_valid := 1;


IF LENGTH(ltrim(rtrim(:text_item_email))) = 0 THEN
t_valid := 0;
--This is to check special characters are present or not in the email ID
t_counter := t_totallen;

WHILE t_counter > 0
mail_ch := substr(:text_item_email,i,1);
i := i+1;
t_counter := t_counter -1;

IF mail_ch IN (' ','!','#','$','%','^','&','*','(',')','-','','"',
'+','|','{','}','[',']',':','>','<','?','/','\','=') THEN t_valid := 0; EXIT; END IF; END LOOP; --------------------------------------------------------------------------------------- --This is to check more than one '@' character present or not t_atpos := instr(:text_item_email,'@',1,2) ; IF t_atpos > 1 then
t_valid := 0;

--This is to check at minimum and at maximum only one '@' character present

t_atpos := instr(:text_item_email,'@',1) ;

IF t_atpos IN (0,1) THEN
t_valid := 0;

--This is to check at least one '.' character present or not

t_pointpos := instr(:text_item_email,'.',1) ;

IF t_pointpos IN (0,1) THEN
t_valid := 0;


--This is to check at least one character is present between @ and '.' :GR

t_atpos := instr(:text_item_email,'@',1) ;
t_pointpos := instr(:text_item_email,'.',1) ;

IF t_pointpos-t_atpos<=1 THEN t_valid := 0; END IF; --------------------------------------------------------------------------------------- --This is to check at least one character is present after '.' :GR t_pointpos := instr(:text_item_email,'.',1) ; IF t_totallen-t_pointpos<=0 THEN t_valid := 0; END IF; --------------------------------------------------------------------------------------- END IF; if(t_valid=0) then message('Invalid Email'); result:=show_alert('alert_email'); raise form_trigger_failure; end if; END; ---***PL/SQL code for Name Validation***--- DECLARE t_valid NUMBER(1); t_totallen NUMBER(2); t_counter NUMBER(2):=0; i NUMBER(2) := 1; name_ch VARCHAR2(1); --name_ch_ascii NUMBER; result number; --:GR BEGIN t_totallen := LENGTH(:text_item_first_name); t_counter := t_totallen; i := 1; t_valid := 1; ------------------------------------------------------------------------------------- IF LENGTH(ltrim(rtrim(:text_item_first_name))) = 0 THEN t_valid := 0; ELSE --------------------------------------------------------------------------------------- --This is to check if each character in name lies in the valid ascii range t_counter := t_totallen; WHILE t_counter > 0
name_ch := upper(substr(:text_item_first_name,i,1));
--name_ch_ascii := convert(name_ch,'US7ASCII');
i := i+1;
t_counter := t_counter -1;

--IF name_ch_ascii not between 65 and 90 THEN
IF name_ch not between 'A' and 'Z' THEN
t_valid := 0;


if(t_valid=0) then
message('Invalid First Name');
raise form_trigger_failure;
end if;

Note: I came across some code for Email validation in PL/SQL (during my Oracle Forms and Reports training) after some googling.Added some more test-cases to it and now its stronger than before.Also used it as a base for name validation.
The code aint pretty but its what you need when u got to submit a mini-project quickly.
Hail Google!

Sunday, September 11, 2005

# Firedrop2 micromini how-to-blog-behind_the_scenes [for win-xp]

Though the entire process is simple-click-click, here is a small section of what goes on behind the scenes.
1.The wxfiredrop.pyw starts the fd2 gui. *.pyw file supresses the command-prompt window.
2.Your Weblog is created at C:\Weblog.The following files have been created at 'C:\Weblog'
build.ini,, page_template.html, entry_template.html
3.Your Weblog has been loaded by the fd2.
4/5.A new entry is created for the blog, with the title as *New* and body as *New*.The first 2 lines record the system date and time for this entry.The text below the '--' is the actual blog entry.The 'sextile' format of a blog entry is
Blog Entry Title

Blog Entry Body
6.The blog entry is saved as '00001.FD2'
7.The build script is run, which uses the build.ini configuration file to create/update your blog.
The following files have been created at 'C:\Weblog\articles_html'
arch_d7_2005_08_20.html, index.html, all_by_date.html, index.xml, atom.xml
The 'build' step will, by default, create a 'articles_html' folder.Incase you want to change this edit a line in the build.ini file.
8.It works!

Saturday, August 27, 2005

# Firedrop2 micromini how-to-blog [for win-xp]

1.Open the firedrop2 gui by double-clicking 'C:\Python24\Lib\site-packages\firedrop2\wxfiredrop.pyw'

2.Make your blog by:
File->New site...->Choose a content type:Weblog->Choose/Create directory...->Make New Folder->C:\Weblog->Generating files->OK

3.Click the 'Open' button on the fd2 gui, and select 'C:\Weblog' from the browse-tree.
Note: Your Weblog has been loaded by the fd2.

4.Click the 'New' button on the fd2 gui.This will create an entry '*New*.
insert_date='2005-08-21 00:31:09'
modified_date='2005-08-21 00:31:09'

5.Edit the content to:
insert_date='2005-08-21 00:31:09'
modified_date='2005-08-21 00:31:09'
Hello World

Welcome to Firedrop2

6.Click the 'Save' button on the fd2 gui, to save your blog entry.

7.Click on 'Build', to build your blog.

8.Click on 'Preview'. This will open a browser window and display your blog.

You have successfully created a blog using 'firedrop2'.To create more entries, return to step 4.

Sunday, August 21, 2005

# Firedrop2 micromini how-to-install [for win-xp]

The purpose of this how-to is to get you started with the Firedrop2 on win-xp asap!

  • What is Firedrop2?
Firedrop2 is a client side weblog creation and web content management system.
It is open source and written in Python by Hans Nowak.
It is cross platform and runs on Windows,Linux, Mac OS X and most Unix like systems.
Fuzzyman has created a plugin creation tool and some nice plugins.

  • Downloads:
Python 2.4
wxPython 2.5xx (wxPython2.5-win32-ansi-
wax 2.xx (wax-0.2.68 )

  • Installation:
>>>Python 2.4 - Install py2.4 at 'C:\Python24'

>>>wxPython 2.5xx (wxPython2.5-win32-ansi- -Install at 'C:\Python24\Lib\site-packages'

>>>wax 2.xx (wax-0.2.68 ) - Unzip the file(anywhere) and copy-paste the 'wax' folder to 'C:\Python24\Lib\site-packages'
Note: is provided for installation, but due to some incompatible changes,this might not work.Use the copy-paste technique as above.

>>>firedrop2-2005.9 - Unzip the file to 'C:\Python24\Lib\site-packages'

Note: 'C:\Python24\Lib\site-packages' should contain the following folders now: wx-2.5.5-msw-ansi, wax, firedrop2

  • Configuration:
>>>Edit 2 lines in the file 'C:\Python24\Lib\site-packages\firedrop2\'

import tools

import tools

  • Testing:
Double click the file 'C:\Python24\Lib\site-packages\firedrop2\wxfiredrop.pyw'. This should start the firedrop2 gui as below.

You have successfully installed and configured the 'firedrop2'.

>>> This micromini how-to is based on the Mini How-To for Firedrop2 and Python411: Firedrop2 Podcast by Ron Stephens

Thursday, August 18, 2005

Lets be more Pythonic ... Part II

The comments in the previous post sure brought abt a miniature py vs ry code-snippet war:

1) List comprehensions
Python: ret=[do_something(elem) for elem in li]
Ruby: ret=li.each {|elem| elem.do_something}

2) return
In Python, all functions return a value; if you dont provide return, your function returns the None object automatically
In Ruby, everything(methods, prodecures, code blocks etc.) returns a value; usually of the last statement executed unless an explicit return statement
(More research required for this point....)

3) each
Python: [do_something(elem) for each in li]
Ruby: ret=li.each {|elem| elem.do_something}

4) yield (the 'round' wheels)

Ruby code for fibo series from Programming Ruby:The Pragmatic Programmer's Guide

def fibUpTo(max)
...i1, i2 = 1, 1
...while i1 <= max
......yield i1
......i1, i2 = i2, i1+i2
fibUpTo(1000) { |f| print f, " " }

Python code for fibo series

def fibUpTo(max):
...while i1<=max:
......yield i1
print [i for i in fibUpTo(1000)]

5) Syntax
Python: Indentation rules
Ruby: OO

6)Readability: --->depends on u

This (friendly???) war is certainly gonna continue, but its quite a learning experience and has made me more passionate about Py!

More issues will be discussed and more rants will be thrown around.....watchout!

Thursday, August 11, 2005

Lets be more Pythonic ...

This is C:

for (i=0; i < class="entryText">
Is this being Pythonic:

i = 0
while i < mylist_length:
i += 1
NO! certainly not!
Then this must be being Pythonic:
for i in range(mylist_length):

This one ?
for element in mylist:
Oh Yes! This is is more like it!

"To be Pythonic is to use the Python constructs and
datastructures with clean, readable idioms.
It is Pythonic is to exploit dynamic typingfor instance,
and it's definitely not Pythonic to introducestatic-type style
verbosity into the picture where not needed. To bePythonic is
to avoid surprising experienced Python programmers with unfamiliar
ways to accomplish a task."

This is a must-try for anyone with a python interpreter around.
Invoke the python interpreter and type 'import this'.

Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
The Pythonic way of getting the Python source code:

import ftplib

f.retrbinary("RETR Python-2.4.tar.bz2",open('Python-2.4.tar.bz2','wb').write)

This code works(try it if you have a python interpreter)!

Additional info at:
Python Secret Weblog - Martijn Faassen's musings
and Python Corner-Linux For You(LFY)

Wednesday, August 10, 2005

HOWTO: Installation & Configuration of WAMP - Part 1

->WAMP:Windows Apache MySQL PHP

  • Apache Web Server Installation:
1.Get Apache Win32 Binary (MSI Installer)

2.The only info you need to fill during the installation wizard is:
For the rest of the screens, just click the next button.

3.Apache is installed at "C:\Program Files\Apache Group\Apache2"

  • Apache Web Server Configuration:
1.Stop Apache Server by double clicking the icon in the taskbar which displays the Apache Service Monitor and then clicking Stop.

2.Open "C:\Program Files\Apache Group\Apache2\conf\httpd.conf" using notepad.

#.Change DocumentRoot to DocumentRoot to DocumentRoot "C:\Program Files\Apache Group\Apache2\htdocs"

#.Change to

3.Change DirectoryIndex index.html index.html.var to DirectoryIndex index.html index.html.var index.php

4.Save the configuration file

5.Start Apache server using the Apache Service Monitor

  • Testing Apache Web Server:
Open your Internet Explorer/Mozilla Firefox and in the address bar type, 'http://localhost'

  • PHP Installation:
1.Get PHP 4.4.0 zip package

2.Unzip the file to 'C:\PHP\php-4.4.0-Win32'

3.Copy all 'dll' files from 'C:\PHP\php-4.4.0-Win32\dlls' to 'C:\PHP\php-4.4.0-Win32' i.e where file 'php4ts.dll' is located

4.Copy all 'dll' files from 'C:\PHP\php-4.4.0-Win32\extensions' to 'C:\PHP\php-4.4.0-Win32' i.e where file 'php4ts.dll' is located

5.Copy 'php.ini-dist' file from 'C:\PHP\php-4.4.0-Win32' file to 'C:\WINDOWS' and rename it to 'php.ini'

6.Edit 'php.ini file' and set 'doc_root' as doc_root = "C:\Program Files\Apache Group\Apache2\htdocs"

7.Edit 'php.ini file'and set 'user_dir' as user_dir = "C:\PHP\php-4.4.0-Win32"

8.Edit 'php.ini file'and set 'extension_dir'as extension_dir = "C:\PHP\php-4.4.0-Win32"

  • PHP Configuration with Apache:
1. To make PHP work with Apache, edit file 'C:\Program Files\Apache Group\Apache2\conf\httpd.conf' and set the following:

AddType application/x-tar .tgz
ScriptAlias /php/ "C:\PHP\php-4.4.0-Win32\"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
Action application/x-httpd-php "/php/php.exe"

2.Double click to start 'C:\PHP\php-4.4.0-Win32\php.exe' to make sure PHP starts.

3.Also restart Apache

4. To test if PHP works with Apache, make a file with the following content:

echo "Hello!";

and save it as 'test.php' under web document root directory which is at 'C:\Program Files\Apache Group\Apache2\htdocs'

  • Testing PHP on Apache Web Server:
Now go to Internet Explorer and open 'http://localhost/test.php'. You should see 'Hello!' on the page.

This concludes Part 1 of the WAMP HOWTO.
Part 2 will cover MySql installation and more ...

Note: This article is an updated version of the original WAMP article By NORBU (
Please leave your comments if you faced any problems or tips to improve this howto.

Saturday, August 06, 2005

Experience at the Mumbai PHP Meetup August 2005

I attended my first Mumbai PHP Meetup today, organised at the People Cafe(the people)
It started with a 4-hour workshop on MySQL by Mr.Shantanu Oak, covering the basics and advanced topics and giving a demo of phpAdmin(which i learnt can be used to power the backend of your website.Its a risky deal, but you would be safe if you take your backups and its worth the effort, coz its your free MySQL server!)

After the workshop, began the meetup where the group discussed topics about database migration and large forms.The solutions being provided by the members kept in mind the business logic and usability.

The PHP meetup group is a bunch of friendly motivated individuals(mostly working professionals), with the desire to share and learn.A great community building effort here, and an ideal place to open up your mind and put forward your business ideas.

Mr.Shantanu Oak also demonstrated a financial tool that he has developed using MS-Excel as frontend and MySQL as backend, to extract stock prices from websites.Another great find was Sarovar, the Indian equivalent to Sourceforge.

Many seemed to agree as to how M$'s ASP and ASP.NET starts cracking apart when the real money starts coming in(thats when a large number of users register, say a million or so) and the only way to keept it together to get in the M$ Business Logic Server etc to save the day.
This made me feel real good(no points for guessing why!)

LAMP, but of course, stands tall as the strongest platform for such database-intensive websites e.g an example!)

Such active groups are an ideal way to start off open source projects, and I believe that this group will have something coming up in a few months too.

Note: The views expressed in this post are solely mine, and not of the group as a whole! :)

Thursday, August 04, 2005

Knoppix and Kanotix

Knoppix is one of the most popular Linux Live CD, where you just need to pop a cd into your cdrom drive, change the bios settings to boot from cdrom, and the Knoppix OS unpacks itself on your RAM, and runs like a dream.

I downloaded the latest Knoppix 3.9 (approx 700 mb) using a torrent, and thanks to my broadband connection, its did not take me long

Knoppix 3.9 looked and worked even better than the previous 3.6, and the KDE desktop rendered itself beautifully, leaving me speechless.
Thats when i thought, that if such is the power that Knoppix delivers off a CD, what would be the results when i install it on my hard disk...!

I decided it was time to move on from my Fedora Core 3 (PC Quest White Hope), which is complete and stable distro for developers.

Installing Knoppix onto the hard disk is no different than any linux distro, and if you have ever installed linux, no need to think twice...

Installing Knoppix from CD to Hard Disk:
1.Boot from cdrom with the knoppix cd in the cdrom drive
2.Once on the desktop, click on the Knoppix penguin(next to the K Menu on the taskbar), and select Root Shell (you will have to provide the root password)
3.On the root prompt type:
4.Configure your installation and set the partitions using QTParted
5.Start installation...

Kanotix (HD Installation) is fast, stable and packs in more punch than Knoppix (after all this time its on the hard disk!)

Knoppix 3.9 and Kanotix are both based on Debian with Linux-Kernel 2.6 and KDE v3 and the rest of the powerful features.

This was my first shot on a debian-based system, and i wondered if i was better of in the world of rpm's, but to my surprise, updating,upgrading,installing and removing packages on Debian distros is even simpler.
#apt-get update
#apt-get upgrade
#apt-get install package_name
#apt-get remove package_name

As with Knoppix, setting my broadband connection here on Kanotix required me to choose Knoppix Penguin(taskbar)->Network/Internet->ADSL/PPPOE configuration and i was up and surfing.

All tools required for chatting, IRC,mail clients,browsers,word processors etc are packed into this very compelete distro.

Get hold of a Knoppix3.9 cd asap, and then a copy of Knoppix Hacks.

Monday, August 01, 2005

Zipping away with's in the air!

When i last posted about Python, i was still learning the ropes, but a few days at the Python Challenge and my current position at Level 7, has really improved my Python skills.
I started Level 1 with a procedural code to break into Level 2, but soon realised that it wasnt in the pythonic spirit and i wouldnt reach far.
After a quick glance at the py tutorial again, set my gears in motion and i can feel 'python powered'.
The Python Challenge, i agree, is the best way to learn python.

My partner in crime is Swapneel (at level 7 too!), coding away the py challenege in Ruby!

If uou are heading towards the land of pythons, i would recommend the py tutorial, and keep a copy of Learning Python(2nd Ed) and Programming Python handy for any in-depth topic coverage (you will need it!)

#The Python Challenge Guide:Part Python and Ruby...Comin Soon!
any volunteers for the Python Challenege in any other languages e.g. php?

#Visit Open Puppets for open-source artwork (like my python above!)!

Monday, July 25, 2005

A Simple Port Scanner using Java

This is part 2 of the ‘Make our own simple networking tools using Java’. In part 1, we developed a simple command-line packet sniffer and now, we will make a simple Port Scanner (Note: We will not be using Threads, so this scanner will be a slow one, but in the weeks to come, we will make one of those fast ones too!)

We will divide our work into 2 java files:

1) JPortScanConn – This file will take care of the socket

2) JPortScanner – This file will deal with the actual command-line interface and validating user input

The tutorial is divided into three sections:

1) Definitions

2) Installation

3) Writing a simple port scanner


1) Port: A connection point for different protocols to communicate on different machines

2) Socket: ( class)is an object that represents a network connection between two machines. This means that’s the two machines have information about each other, including network location (IP address) and TCP port.

3) Port Scanner: is a software program that allows you to scan a target machine to provide information about the status of ports.


Download and install Javatm2 Platform, Standard Edition (J2SEtm) JRE or

Writing a Simple Port Scanner:

As we have defined the much needed concepts above, the logic we will try to implement is that we would try to connect to port number x of the target machine, if we are successful, we will declare that the port is open else it is closed!

Ø First let’s make the file:

// Import is needed to create sockets and fetch the IP Address!)\\


// Create a class JPortScanConn \\

class JPortScanConn


// Declare a socket called skt that will make all the connections \\

// Declare integer variable startPort and endPort \\

// Declare an interger array openPorts[] which will hold a list

// of the open ports of the target machine

// Note: 65535 is the maximum number of ports on a machine \\

// Declare a string variable host to store the hostname of the target \\

// Declare an instance of type InetAddress that holds the IP address of the target \\

Socket skt;

int startPort, endPort;

int[] openPorts=new int[65535];

String hostName;

InetAddress hostAddress;

// Create a parameterised constructor to be used if user passes

// all 3 values i.e. for start and end port and the host name \\

JPortScanConn(int startPort, int endPort, String hostName)


// Initialize the values for the instance members

// with that passed by the user \\




// Declare a flag named 'open' to hold the status

// of the current scanned port \\

boolean open=false;

// Initialize the hostAddress usning the getByName() method

// of the InetAddress class

// p.s. getByName()throws a UnknownHostException

// if the hostName is invalid \\





catch (UnknownHostException ea) {}

// Initialise all values in the openPorts[] array to 0(closed) \\

for(int i=0;i<65535;i++)


System.out.println("Scanning "+hostAddress.getHostAddress()+":");

// Scan the reqired ports by tring to create a connection

// p.s. 'currentport' holds the value of the port with which we

// try to establish a connection on the target machine 'hostAddress' \\

for(int currentPort=startPort,i=0;currentPort<=endPort;currentPort++)




skt= new Socket(hostAddress,currentPort);

// SUCCESS! \\



catch( eb)


// FAILED! \\







// Close the connection \\



catch( ec){}

catch(NullPointerException ed){}


// Add the port number to the openPorts[] array if the

// connection was established \\




// Reset the open flag \\


// Move to the next port \\





// Create another constructor if user wishes to pass only the host name

// and we then scann all the ports \\

JPortScanConn(String hostName) throws UnknownHostException




// Create a constructor if user wants to scan a single port of the target \\

JPortScanConn(int startPort, String hostName) throws UnknownHostException





Ø Now lets move to

// Create a public class JPortScanner

// p.s. 'public' so that it can use the members and methos of JScanConn class

public class JPortScanner


// Make an instance of JPortScanConn

static JPortScanConn jpsc=null;

// Create a method to display the valid synatx for using the port scanner

static void usage()


System.out.println("Usage:\njava JPortScanner host [startport] [endport]");

System.out.println("If only startport is specified, the portscanner scans only that port.");

System.out.println("If neither is specified, the portscanner scans all ports from 1-65535");

System.out.println("Examples:\n java JPortScanner \n java JPortScanner 80\n java JPortScanner 80 90");



// Now comes the psvm() \\

public static void main(String[] args)


// If invalid syntax is used for command, display the Usage







// Call the appropriate constructor for the jpsc instance

if(args.length==3 && Integer.parseInt(args[1])<65535>

jpsc = new JPortScanConn(Integer.parseInt(args[1]),Integer.parseInt(args[2]),args[0]);

else if(args.length==1)

jpsc = new JPortScanConn(args[0]);

else if(args.length==2)

jpsc = new JPortScanConn(Integer.parseInt(args[1]),args[0]);


throw new NumberFormatException();


catch( ea)


System.out.println("Address cannot be resolved"+ea);


catch(NumberFormatException eb)


System.out.println("startport and endport must be numbers less than 65535"+eb);


// Display the open ports

System.out.println("Open ports are...");

for(int i=0;i<65535;i++)







That’s it!

Open the console window, move to the appropriate directory and type the following commands:



#java JPortScanner localhost 25

Now you can go ahead scanning ports on your machine or on any target machine!

Lets Tweak:

Allowing timeouts:

Add an int variable ‘timeout’ to the JPortScanConn class and initialize it to 4000( in ms).

Now, edit the line in

skt= new Socket(hostAddress,currentPort);


skt= new Socket();
skt.connect(new InetSocketAddress(hostAddress,currentPort),timeout);

Word Press : A Bloggers Dream

Google's Blogger has done a great job getting young bloggers(like me) to swim in new waters, but soon enough one wants to break free and swim into the deep sea...thats when WordPress(WP) comes along.

''WordPress is a state-of-the-art semantic personal publishing platform with a focus on aesthetics, web standards, and usability. What a mouthful. WordPress is both free and priceless at the same time.''

Blogging tools are freely available with the likes of b2evolution, Movable Types, Drupal etc., but after a look around, i had to agree with Ajay, WP rocks!

"....freely distributed, standards-compliant, fast, light and free personal publishing platform, with sensible default settings and features, and an extremely customizable core."

" elegant, well-architectured personal publishing system built on PHP and MySQL and licensed under the GPL."

WP Codex:The Online Manual is the best resource for WP, and I will be heading in that direction when i decide to move to a more powerful blogging tool.

Friday, July 22, 2005

>>>Python and Jython
- the state of scripting universe
-Google uses python
-currently working on python guis

>>>XML and Web Services
-xml is hot...

-thats what makes gmail fast!

Note: The subject to this post is (?xml version="1.0"?)...replace () with <>, which is not being displayed(No points for guessing why)
Infact, its not even being displayed in the 'Previous' links and neither is letting me post it here in the content...

Using a blank subject line would cause the first line of the post to be considered as the subject, and it wont give the same results...

This is indeed my tiny Blogger Hack to prevent subjects from being displayed on top of posts as well as under the previous links section.I wonder how would i be able to reach this post individually, as blogger usually uses the hyphenated-subject to provide a link to the post directly but there is no subject here...

Viewing the source of this page provides all the answers:

1.The subject is displayed between the h3 tags and is same as the actual subject.So it is displayed neither on top of the post, nor in the previous links.

2.To reach this post directly, blogger falls back to its concept of hyphenated-text of part of the first line and the direct link to this post is here.

Tuesday, July 19, 2005

Python Challenge - Level 0 conquered

I came across the Python Challange a few months back while searching for some python resources. I tried my hand at Level 0 for about 5 minutes, but made no progress.

Today, after 2 minutes of thinking, I have been able to reach the 1st level :)

The Py Challenge is definitely worth a shot.

Wednesday, July 13, 2005

Develop a Vocabulary Building Tool using Google and Deskbar API - A Proposal

The best way to build a good vocab(as many would say) would be to read tons of books, novels and magazines in different genres. A hurdle in this direction, is the process of moving onto the dictionary for every new word encountered.

A simpler approach to this rather enervating task would be a tool to help us through our vocab building process.

Google Deskbar provides a great support to this proposal, and we could develop a plugin using the available API to provide features like:

Spell Check

The DeskBar mini-view provides a great format for a readable display of the above mentioned features, and to add to them we could connect it to a Database and store them for offline use or printing.

The APIs provided by Google include:

With the Google Web APIs service, software developers can query more than 8 billion web pages directly from their own computer programs. Google uses the SOAP and WSDL standards so a developer can program in his or her favorite environment - such as Java, Perl, or Visual Studio .NET.

With the Google Deskbar API, you can write plug-ins to add your own features to the Google Deskbar. Plug-ins can be written in any .NET language, such as C# or Visual Basic.NET.

For those working towards competitive exams like SAT,GRE,CAT etc that have dedicated verbal sections, this could be a 'one-stop-shop' fitting right onto the toolbar/deskbar or used through the browser.

Note: Babylon-Pro is dictionary tool, providing excellent features. But a Google-based plugin will provide free, easier and ubiquitous support.

Friday, June 17, 2005

Sun's Solaris is now OpenSolaris!

On June 14, 2005 after a long wait and millions of DTrace downloads, the gates of Solaris were thrown Open!

The OpenSolaris project is an open source operating system, a community development effort and a place for collaboration and conversation about OpenSolaris technology. It is aimed at developers and users who want to develop and improve operating systems. The OpenSolaris technology represents cutting edge operating system design, but the innovation is just getting started!

Sun's Solaris has been a dominant force on the server-side, and open-sourcing it has been long debated.

For those who want to have a look before they download the 45MB of C code, there is an OpenSolaris Source Browser.

You can either download the source code and build it with gcc or install from pre-built archives.
OpenSolaris code can be downloaded and built for both, the SPARC and x86 platform. Infact its the same code, but depending on the platform its built differently!

Whether you are a user or developer and have basic understanding of Unix and C, you should not miss this open-source initiative.

This also makes Sun, the biggest contributor to open-source code. OpenOffice, Solaris, what will be Sun's next move?

Games Bond: CounterStrike on TV

StarOne has launched a Video Games show based on CS, called Games Bond on every Friday at 2030 IST.

They have about 8 clans and each week, 2 clans face each other.

The game has 2 rounds and 3 battles per round.
Battle 1- Aztec (Bomb The Target)
Battle 2- Dust (Bomb The Target)
Battle 3- Italy (Hostage Rescue)

The team which wins the toss at the start gets to choose CT(Counter-Terrorist) or T (Terrorist) for Round 1 and in the Round 2 there is a role reversal.

Each round starts with 5 memebers on each side, and after every battle the captain of the winning team eliminates one member from each team.

Episode 1: Indian Tigers VS Extremists

Toss: Extremists win and choose CT

Round 1: IndTig(T) vs Ext(CT)
Battle 1 - CT
Battle 2 - T
Battle 3 - T

Round 2: IndTig(CT) vs Ext(T)
Battle 1 - T
Battle 2 - T
Battle 3 - T

Result: Extremists win 4-2

Comments: Extremists were far superior in the role of Terrorists with a flawless victory. But the IndianTigers showed some great skill in the Dust battle of Round 1.

Next week: Jaipur Lords vs Bombay Rockers

Its a nice show, and of course you cant compare it to the thrill of playing the game, but watching India's Top clans fight it out every week is a great concept.

Saturday, May 21, 2005

Free But Shackled - The Java Trap by Richard Stallman

Here is an article by GNU guru Richard Stallman where he talks about the fact that Java developers are completely dependent on Sun, and its time the GNU get a GCJ(GNU Java Compiler with Libraries), which will lead to complete freedom for the Java coders (just what GCC did for C...)

"If your program is free software, it is basically ethical--but there is a trap you must be on guard for. Your program, though in itself free, may be restricted by non-free software that it depends on. Since the problem is most prominent today for Java programs, we call it the Java Trap."

"If some of a program's dependencies are non-free, this means that all or part of the program is unable to run in an entirely free system--it is unusable in the Free World. Sure, we could redistribute the program and have copies on our machines, but that's not much good if it won't run. That program is free software, but it is effectively shackled by its non-free dependencies."

"If you develop a Java program on Sun's Java platform, you are liable to use Sun-only features without even noticing. By the time you find this out, you may have been using them for months, and redoing the work could take more months. You might say, "It's too much work to start over." Then your program will have fallen into the Java Trap; it will be unusable in the Free World."

"We are trying to rescue the trapped Java programs, so if you like the Java language, we invite you to help in developing GNU Classpath. Trying your programs with the the GCJ Compiler and GNU Classpath, and reporting any problems you encounter in classes already implemented, is also useful. However, finishing GNU Classpath will take time; if more non-free libraries continue to be added, we may never have all the latest ones. So please don't put your free software in shackles. When you write an application program today, write it to run on free facilities from the start."

The complete article can be found here.

Note: I will refer the work in progress at the Harmony Project, and try to see if any similar objectives exist between the two.

Wednesday, May 18, 2005

Firefox Tabs: Now with IE7 too

One of my favourite and most frequently used feature in Firefox, the Tabs, will now be seen in IE7 too!

This information is derived from the IE7 blog

"Yes, IE7 has tabs.

In general, I think tabs are a great idea. I liked them a lot in Office dialogs and in Excel in the early 90's. (I used to work on Office, and I admit we almost added tabs to Word at one point.) I like them in Visual Studio. I think, as an industry, we have a ways to go in refining the experience, consistency, and value of tabs."

"The tabbed browsing experience in the upcoming IE7 beta is pretty basic. Expect additional end-user functionality to come in after the beta."

"I think we made the wrong decision here initially, and we’re making the right one now."

In my opinion, the bigger issues that M$ IE needs to handle are concerning security vulnerabilities and web standards. But i think those are not on their immediate 'To-Do list' ...

Monday, May 16, 2005

JXTA - Get Connected

JXTA™ technology is a set of open protocols that allow any connected device on the network ranging from cell phones and wireless PDAs to PCs and servers to communicate and collaborate in a P2P manner.

This open source project is licensed under the Apache Software License, encouraging others to join in the effort. The project is evolving daily.

Peer-to-peer is a style of computing that allows any device to interact with any other computer on the network. In effect, P2P turns every device into both a client and a server, enabling a much more symmetrical and decentralized communications model for applications, services and users.

JXTA (pronounced "juxta") is short for Juxtapose, as in side by side. It is a recognition that peer to peer is juxtapose to client server or Web based computing -- what is considered today's traditional computing model.

JXTA peers create a virtual network where any peer can interact with other peers and resources directly even when some of the peers and resources are behind firewalls and NATs or are on different network transports.

At its core JXTA is simply a protocol for inter-peer communication. Each peer is assigned a unique identifier (peer ID). Each peer belongs to one or more peer groups in which the peers cooperate and function similarly and under a unified set of capabilities and restrictions. JXTA provides protocols for the basic functions -- create groups, find groups, join and leave groups, monitor groups, talk to other groups and peers, share content and services -- all of which are performed by publishing and exchanging XML advertisements and messages between peers.

The JXTA protocols are a set of six protocols that have been designed for peer-to-peer (P2P) network computing. The six protocols are the Peer Discovery Protocol, the Peer Resolver Protocol, the Peer Information Protocol, the Peer Membership Protocol, the Pipe Binding Protocol, and the Peer Endpoint Protocol.

Project Objectives
  • Interoperability - across different peer-to-peer systems and communities
  • Platform independence - multiple/diverse languages, systems, and networks
  • Ubiquity - every device with a digital heartbeat

Imagine the Possibilities
  • Find peers and resources on the network even across firewalls
  • Share files with anyone across the network
  • Create your own group of peers of devices across different networks
  • Communicate securely with peers across public networks

Friday, May 13, 2005

SAP, ABAP and NetWeaver - The Buzz Words

The name SAP a German company is an acronym for "Systeme, Anwendungen, Produkte in der Datenverarbeitung." This is translated in English as "Systems, Applications, and Products in Data Processing."

SAP is an enterprise resource planning (ERP) software product capable of integrating multiple business applications, with each application representing a specific business area. These applications update and process transactions in real time mode. It has the ability to be configured to meets the needs of the business.

In a standard SAP project system, it is divided into three environments, Development, Quality Assurance and Production.
The development system is where most of the implementation work takes place. The quality assurance system is where all the final testing is conducted before moving the transports to the production environment. The production system is where all the daily business activities occur. It is also the client that all the end users use to perform their daily job functions.

The main advantage of using SAP as your company ERP system is that SAP have a very high level of integration among its individual applications which guarantee consistency of data throughout the system and the company itself.

The SAP R/3 enterprise application suite for open client/server systems has established a new standards for providing business information management solutions.

SAP/R3 is categorized into 3 core functional areas:

  • Logistics
    • Sales and Distribution (SD)
    • Material Management (MM)
    • Warehouse Management (WM)
    • Production Planning (PP)
    • General Logistics (LO)
    • Quality Management (QM)
  • Financial
    • Financial Accounting (FI)
    • Controlling (CO)
    • Enterprise Controlling (EC)
    • Investment Management (IM)
  • Treasury (TR)
    • Human Resources
    • Personnel Administration (PA)
    • Personnel Development (PD)

SAP is a table drive customization software. It allows businesses to make rapid changes in their business requirements with a common set of programs. User-exits are provided for business to add in additional source code. Tools such as screen variants are provided to let you set fields attributes whether to hide, display and make them mandatory fields.

For complex reports specifications, SAP allows you to write customize ABAP/4 programs.
ABAP/4 (Advanced Business Application Programming 4GL) language is an "event-driven", "top-down", well-structured and powerful programming language. The ABAP/4 processor controls the execution of an event. Because the ABAP/4 language incorporates many "event" keywords and these keywords need not be in any specific order in the code, and companies tend to implement in-house ABAP/4 coding standards.There is no one size fixed all software, with this in mind, SAP allows its users to create their own dialog or reports programs using the language ABAP/4.

The main purpose of using a standard business application software like SAP is to reduce the amount of time and money spend on developing and testing all the programs. Therefore, most companies will try to utilized the available tools provided by SAP.

SAP NetWeaver, the next evolution of mySAP Technology integrates information and business processes across technologies and organisations.It provides comprehensive collaboration tools and services that foster teamwork in a wide range of business processes.

Net Weaver in simple words is an application and Integration platform in which Web Services play a major role and which is open for Non-SAP applications and platform. It is used by organizations to improve productivity and enhance efficiency by making all the resources that are available in an enterprise to work collectively. The SAP customers to bring heterogeneous environments at one platform use SAP NetWeaver. In addition, it enables customers to use the already existing systems without putting in much investment.

Further in the near future, the various corporate sectors and Organizations have to take a decision for some common platform; could be Microsoft .NET, IBM Websphere , J2EE (support for this was announced later at JavaOne,2003) or SAP NetWeaver. Irrespective of the choice that they make, SAP NetWeaver is the one that integrates with all the four technologies.

Wednesday, May 11, 2005

India's Open Source License - KPL

Deepak Phatak of the Indian Institute of Technology has kicked off an effort to create the Knowledge Public License, or KPL, a licensing program that will let programmers share ideas with one another while at the same time allowing them to retain the rights to their own software modifications. The license will likely function much like the Berkeley Software Distribution or the MIT License programs.

The number of open-source licenses has exploded, leaving many in the community miffed. But Phatak's proposal comes with the power of numbers. India's 1,750 colleges with computer science and electrical engineering degrees admit about 250,000 students a year. Combined with the outsourcing boom, that makes India one of the major centers for software development.And thus, the need for an open source license to meet the Indian Developer's needs

The idea is to create an environment where developers can take advantage of the collaborative power of the open-source movement while giving individuals the ability to exploit their own twists.

He claims that such a program could also help ease the raging tensions between the open-source software movement and proprietary software companies.

"The free software people are afflicted by what I call the J factor, which is the jealousy factor. The proprietary people are afflicted by the G factor, the greed factor. They want to maximally extract money from the world, I am working to tell the world, 'Please permit these groups to coexist peacefully and harmoniously. There is a tremendous advantage to everyone.'"