Reality is a perception. Perceptions are not always based on facts, and are strongly influenced by illusions. Inquisitiveness is hence indispensable

Sunday, September 2, 2007

In Leeds

I have reached Leeds on 2nd August. Exactly 29 days passed by the time of writing this post. Leeds falls into the Midlands, precisely West-yorkshire. English weather, even in August carries a chill around, probably reminding the people around that summer is about to end.

You cannt' resist but observe the spacious dwellings and well organised parking arrangements, (especially coming from Indian cities, quite a contrast). UK is quite a place. The food, football, folks every thing and every one you come across carry a distinctly familiar undercurrent. The tallest building in Leeds is the 32 storied bridge waters buildling. It is close to the city center - a 15 min walk.

The city center is a lively place. The universities, shopping centers, Train station, bus stand all make the experience satiating. I didnt' get a chance to go around the city all by myself, but looking forth to do so. Will add more details in later posts.

Thursday, July 5, 2007

ANT TAUNTS

Another Neat Tool is what they say. What’s in the name? Shakespeare should have known better. ANT is a typical tool which comes into minds of java developers when they are supposed to package their goodies. ANT for newcomers is a utility to package, build and deploy user written software. In some sense, it is software written to manage software.
Any reasonably high-level programming language needs a compiler/interpreter. I wont' go into details of compilers/interpreters now. Rather, the focus is on ANT. Some most frequent tasks a programmer needs to do are clean up, rebuild, debug, run, test and deploy the code. The compilers/interpreters provide support for some of these tasks. Some of the tasks are dependent on the operational environment, for e.g. "rm" is used to remove files on unix where as it is "del" on windows. Let us call these "Developers utility tasks" or DUTs.
Writing a script to achieve these tasks is one way of solving this problem. ANT takes this approach further. ANT can be treated as a domain specific language intended todo these DUTs. Usage of ANT, for the most part, is declarative in nature. Essentially you dont' assign values to variables but state the task you want to achieve. It is kind of saying. "ANT, I want to clean up the mess" or "ANT, Can you compile these sources".
In an IDE driven era, most developers are not conversant with ANT. Those who do, don’t' make noise about it. I feel that, knowing how to write a good ANT script is a must for IDE independent development. Let us see a sample ANT example.
There are essentially three areas when it comes to using ANT.1. Having a clear idea of the directory structure. This is simple for most projects. The complex cases involve code level dependencies across projects. Things can be simplified by assuming presence of referred jar files rather than referred source folders. 2. Identifying and Understanding dependencies among tasks which we wish to have. 3. Writing an ANT file and populating the properties file. Properties file is a mechanism that changes a coding problem into a more manageable configuration problem. This simplifies maintenance.A sample directory structure would look like this• Project folder\ant\ • Project folder\lib\ • Project folder\src\ • Project folder\build\ • Project folder\dist\The "ant" folder is supposed to hold ant scripts. The "src" folder is self-explanatory. The "lib" folder is supposed to hold the jars on which the source files have dependency.The "build" folder contains the resultant files after compilation for e.g. ".class" files. The "dist" folder contains the packaged and ready to use bundles or jar files. "build" and "dist" can be generated by ANT and we do so in our exampleSample build.xml, copy it into your favorite editor and reformat it.################################################## < ?xml version="1.0" encoding="UTF-8"? > < project name="SomeProject" default="all" basedir=".." >
< property file="ant\build.properties"/ >
< path id="classpath" > < fileset dir="${lib.dir}"/ > < /path >
< target name="preconditons" > < echo > Displaying properties... < /echo > < echo > ${jar.name} < /echo > < echo > ${basedir} < /echo > < echo > ------------------------------ < /echo > < /target >
< target name="init" depends="preconditons" > < echo > Intializing build process... < /echo > < mkdir dir="${build.dir}" > < /mkdir > < mkdir dir="${dist.dir}" > < /mkdir > < /target >
< target name="clean" > < echo > Cleaning the ${build.dir}... < /echo > < delete dir="${build.dir}"/ > < delete dir="${dist.dir}"/ > < /target >
< target name="compile" depends="init" > < javac srcdir="${src.dir}"destdir="${build.dir}"compiler="${build.compiler}" source="${source.version}"fork="true" executable="${jdk.path}" > < classpath refid="classpath"/ > < /javac > < /target >
< target name="jar" depends="compile" > < jar destfile="${dist.dir}/${jar.name}" basedir="${build.dir}" > < manifest > < attribute name="Main-Class" value="${mainclass.name}"/ > < attribute name="Class-Path" value="${manifest.classpath}"/ > < /manifest > < /jar > < /target >
< target name="run" depends="jar" > < java jar="${dist.dir}/${jar.name}" fork="true" > < /java > < /target >
< target name="clean-build" depends="clean,compile" > < /target >
< target name="dist" depends="jar" > < copy todir="${dist.dir}" > < fileset dir="${lib.dir}" > < /fileset > < /copy > < /target > < target name="all" depends="clean,dist,run" > < /target >
< /project > ##################################################The sample properties file, please reformat the same. Remember to escape spaces using "\"################################################### Properties file jar.name=RunThisClient.jar mainclass.name=client.Main manifest.classpath=Common.jar # Taken care by the project directory structure under base dirbase.dir=.. src.dir=src lib.dir=lib build.dir=build dist.dir=dist # Compiler related informationjdk.path=C:\\Program\ Files\\Java\\jdk1.5.0_10\\bin\\javac build.compiler=javac1.5 source.version=1.5###################################################Try using this as a template and you will see that ANT really doesn’t taunt

Sunday, May 27, 2007

Indian politricks

INDIA: a land of many faces, facets, facts and fantasies. Indian ness is something very mythical. Is it lack of individualism or servitude to collectivism? The very nature of being related to India raises questions in my mind. India is not a perfect nation, No nation in the world is.

Indian politics are one (ugly) aspect that can give an understanding of how the nation thrives. Now whenever a government changes/ about to change. We see the following patterns. The time lines are drawn for upcoming elections. There is an incumbent govt. and some opposition parties. This is extreme simplification; we are ignoring internal boardroom disagreements & other issues. So the incumbent govt. starts its' campaign with bombastic antiques. They rope in movie stars, popular personas, and offer soaps. Why do they do that? Are they so scared? Scared of loosing power? Now this also involves buying advt. slots on prime time.

Here there is some sort of moderation provided by constitution in terms of Election Commission. These guys are the real heroes of democracy. They literally act like old school headmasters with a rod in their hand. They are the ones who resort sanity to the other wise completely one-sided bout.

What happens at the end of the day? Mostly the underrated opposition wins! Reason: The people know better. Now the party that wins resorts to some changes. They start appointing buerocrates who have their favor, in niche positions. The merit and past achievements are ignored. They also resort to reversing decisions made by last govt.

This may not sound ugly. But the next aspect is really ugly. The issues highlighted during campaign to power are brought into limelight. These include earlier govts. policies that were strongly criticized too. Now after a months time. These are put on backburner. One would find no difference in the attitude towards public after a year or so. The headlines also sound familiar only the names and pictures keep changing.

Wednesday, May 23, 2007

Paving Path to ClassPath and Packaging

Last fortnight vineela posed a question. Sounded silly in the first go but later found it to be not so silly. She was trying to compile java files from command prompt. Guess what happened. A disaster! Now she is not a run of the mill kind. Only issue was that she was born and brought up in the world of user-friendly IDEs. She never worked with the age old tools "javac" and java. Why should she? When was the last time I used javac? Let me guess, it is nearly four years.


There were three problems she was facing, packing the sources, compiling and running. The next step of packing the sources into directories sounds easy. What about classes? As per the practice, they also need to mimic the file structure. We need to duplicate the directory structure. What about running the app? Run it from the top-level package. Wait... Wait... why are we hurrying? Take a break and breath-in... & out... repeat it 3 times (use for loop!!)


Some references before we start.

http://java.sun.com/docs/books/tutorial/java/package/QandE/packages-answers.html http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html http://www.cs.wisc.edu/~hasti/cs368/JavaTutorial/NOTES/Packages.html



Simple Example:


Assuming we know how packages are formed we shall go ahead.

Have a directory called C:\Workarea. Now create three folders called "src", "classes". Under "src" create your package structure.

My source files are: myblog.master.Lord.java, myblog.servant.Gini.java.


There is a correlation between and packages and directory structure.

Under C:\Workarea\src create 3 directories

1.) myblog, 2.) mblog\master, 3.)myblog\servant.


Create the same structure under C:\Workarea\classes. We need to copy java sources to src directory location.

Now copy Lord.java to master and Gini.java to the servant directories. Now come to top directory i.e. C:\Workarea.


Under windows run these commands "dir /s /b *.java > a.txt" and then "javac -sourcepath src -classpath . -d classes @a.txt"

javac essentially takes parameters describing the source location, classpath info and destination where classes are to be saved. @a.txt is the file that contains the locations of .java source files


Bingo...


To run the app from C:\Workarea call "java mainclass"

Tuesday, March 20, 2007

vaio why?

Sumit left for Japan last week. He isnt' quite completely settled, but he is not a new customer. Hes been to Japan before too. Yesterday, he mailed ashish & me asking for an opinion about laptop purchase. He has already made up his mind and is giving a serious thought towards VAIO. Apple is off the radar, DELL is still within proximity range. His requirements are quite amusing. Till date I have seen guys boasting about their CPU muscle power! and enormity of memory space. This is the first time I have seen a techie someone go after really after a stylish glam doll. Ever heard of Armanis and RollsRoyce among computers, VAIO quite in the same league. VAIO has an interesting logo too. A cosine wave followed by 1 & 0 (binary notation). What does that mean? Pretty rudimentary isnt' it? Do most owners understand the significance of the symbol or is it... AAh I must be day dreaming.

Monday, March 12, 2007

Festival of colors

First things first, I am blogging this albeit late. Holi, in INDIA is also called as festival of colors. It falls in the early spring season. The colors are vibrant, so is the mood. Boys and girls have a go at each other with colors. It commemorates the ancient epic of Holica, sister of Hiranyakasipa who had a boon of being untouched by fire, being killed by Lord Vishnu when she intends to hurt his disciple Prahlad.

Children make merry throwing water balloons and spraying colors at every one. This festival is also memorialized in Raasa Leela, where Lord Krishna celebrates Holi. This year we had a gr8 time. First I was dragged into muddy pool then had colors hurled at me. Then had a chance to repeat the same unto others and finally in the afternoon went to a rain dance and danced for a long time. The colors was completely washed away by the end of the evening and I wasn’t’ sorry for that.

This is one day that stays long in memory

Yahoo! sounds

Last week I checked web for voice offerings. I was looking for cheap and reliable voice based offering. Guess what! I found that Yahoo has the best offering, I can call USA for just 1 cent per min. I had to pay 10$ for this and I have got atleast 1000min of talk time. Luckily I have a good net connection and I brag about the same :)

Skype comes close but at 2 cents per min they made my decision easier. You all know where my 2 cents went, don't' you.

Popular Posts

Labels

About Me

Well for a start, I dont' want to!. Yes I am reclusive, no I am not secretive; Candid? Yes; Aspergers? No :). My friends call me an enthusiast, my boss calls me purist, I call myself an explorer, to summarise; just an inquisitive child who didnt'learn to take things for granted. For the sake of living, I work as a S/W engineer. If you dont' know what it means, turn back right now.