Thursday, 25 December 2008

I've been hacked and am pissed off ...

I have this domain registered ... with about 50MB hosting ... I plan to use this to set up a family website ... because the domain name if my family name ... Initially I set up some static HTML ... OK .. good ... then I realized I could put some PHP ... so I go ahead .. look for a PHP CMS .. free one ... get in touch with the developer and tweak it a bit and deploy ...

that night ... some asshole hacked it and pointed to some porn ...

I was pissed ... I changed all passwords and went back to static pages ...

Yesterday ... I put one HTML page with some javascript using Jquery ... and today ... some stupid fuck hacks it again!!!!!!!!!

dont the sick fucks know not to bother with simple family pages!!! I am not writing my credit card details there!!

Wednesday, 24 December 2008

My experiments with setting up source control

Today I had to set up Subversion(SVN) for my new project.The project is basically a small affair with two guys in London and two guys in Bangalore. The client has no interest in providing us a source control system, and we were maintaining the code through a web drive in my company.

Enter me - I was till last week in another place where we used SVN and Cruise Control on a daily basis. So when I saw an opportunity to teach a few things, I jumped in.

What we had was very basic - two desktop machines. No server, no backup and certainly no one willing to maintain my SVN.

I took the simplest approach

1. Download and install Apache HTTP server 2.2.x from here
2. Download and install/unzip the Apache bindings for subversion from here
3. Install Tortoise SVN from here

After this I had to do a few steps manually

1. Go to the folder where you unzipped the SVN binaries for Apache and look for mod_dav_svn.so and mod_authz_svn.so. Copy these to the modules folder under Apache
2. Copy the libdb*.dll and the intl3_svn.dll files from the bin folder where you unzipped the SVN Apache binaries and put them under the Apache bin folder
3. Add the bin folder under the SVN binaries folder to the system PATH

Now the next step is make some changes to the Apache httpd.conf file

Go to the LoadModule section and uncomment the lines corresponding to mod_dav_fs.so and mod_dav.so. Also add the following two lines at the end of the LoadModule section:

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so


Now we need to tell Apache where our SVN repository is. Add the following to the end of your Apache httpd.conf file:


DAV svn
SVNListParentPath on
SVNParentPath [Folder where all your repositories will be]
#SVNIndexXSLT "/svnindex.xsl"
AuthType Basic
AuthName "Subversion repositories"
AuthUserFile passwd
#AuthzSVNAccessFile svnaccessfile
Require valid-user



Just substitute the path under which you want to put all your SVN repositories.

The above XML tells Apache that you will authenticate with the SVN repository using apache user ID. So, go to the Apache home directory and run the following command to create a passwd file with a user ID and password:


bin\htpasswd -c passwd


If you already have a passwd file, then type


bin\htpasswd passwd


This will add a new user to the existing file.



With this we have set up everything on the Apache side. Go and restart the Apache server.If you open your browser and navigate to http://localhost/svn - it should ask you for a user id and password and should show an empty list of SVN repositories.

You need to set up a repository.

Go to the folder which you specified as the SVNParentPath. Create a folder called "Project" where Project is the name of the project for which you are setting up SVN. Now go into that folder and if you right click your mouse and go to the Tortoise SVN menu, you will see an option saying "Create respository here". Click that and a few files and folders appear in that folder. The repository is created.

You can create multiple folders under this parent path and create a repository in that folder.

Now if you browse to http://localhost/svn/Project , you can see the repository!

Of course you need to add some files to this.

You can do this through Tortoise SVN, or any other client or from Eclipse using Subclipse.

Sunday, 21 December 2008

Leaking legacy code

Recently I have been working on an application that has been around for years and has lots of legacy stuff to maintain compatibility. The fact that we maintained Java 1.3 compatibility for a long time and very recently moved to Java 1.4 is a good indication.

When we moved to Java 1.4, it was due to the fact that our new JMS implementation required atleast Java 1.4. We reworked on bits of code to get it to work with the new JMS infrastructure, but never really thought about the Java 1.3 to Java 1.4 migration issues. Java 1.4 was a big clean up release and we should have been wise. However, fortunately or unfortunatley we did not face any issues all through our testing. But when the users started using the code in different situations like JNI or App servers, shit hit the fan.

One of the recent issues is interesting.

Some one wanted to run the code in JBoss - we had never built it with that in mind, but did not see any issues. So we said - go ahead, feel free. They did it and in testing, the server crashed with an out of memory exception!

This was the first ever reported memory leak, so we were concerned. I ran the code in Tomcat and Resin, the memory grew by 10MB in 12 hours and most of it was strings. We were running in debug mode and we use lots of string operations all over the place - so we were not suprised.

But when we ran in JBoss we saw a large number of JMX objects - BasicMBeanRegistry in the heap. We saw that they kept increasing in number with time.

We have a JMX interface to our code and it was written ages ago in Java 1.3. We did not know - and still dont know - how it affected the JBoss server. But as a test we switched off the JMX and today I am told it is running for more than 72 hours with under 90MB of memory.

So something in the way our JMX code was written is not going well with JBoss.
I am hoping we will not have to rewrite the JMX bit to adhere with Java 1.5 or higher.

Any ideas?

Friday, 19 December 2008

Python

Finally, I managed to convince my Technical Architect and good friend Sanjay that Python is a good language fit for web development - using Django and Google App Engine ...

I was in awe of Python for a while now and am playing with Django and the Google App Engine, but convincing Sanjay who was a Java fan was not easy. I am the developer who is easily attracted to new things, but he has the technical architects brain that dissects everything to pieces before he accepts it ... so .. Whew good win ..

Now he will make me sweat on a few projects that he is already thinking for us using Python and the App Engine

Marriage ...

I will be getting married in August 2009 ... I am very much looking forward to it ...

Being an Indian means that the concept of an arranged marriage or the fact that girls get married by 25 and boys by 30 is not really alien to me. The concept of love marriages and the whole falling in love thing was in fact more alien for me till I was 18 years old. It was then that I realized that being in love is being utterly and totally comfortable in someones presence - either talking or just being silent. And I also realized that me being me, most people find it hard to adjust with me and expecting a girl that my parents choose to adjust with me will be tough.

I told my parents after I got a job that I want them to leave the decision of marriage to me. Coming from a 22 year old guy who just got his job, it did seem strange to them. And this year when I finally found the right person and told them, they just said OK. That was quick and easy.

And now I am getting married next year.

Over the last few years I have been working in London for my projects. I feel comfortable socializing here with my colleagues, and in my interactions I have come to realize and accept the fact that marriage is not the end goal that people are looking at when they get into a relationship. People can have 3 or 4 kids and still not be married - they are committed but not married.I am not shocked by this,but the reverse does not hold. I tell people I am getting married next year and the say "What?" - well they don't say it but the expression is the same. It feels kind of odd to them that at 26 I am getting married and looking forward to it.

I have just one answer to that - " thats the only way to some things in India!".

Agreed the generation has moved on and nowadays young people in India do get into relationships - physical as well - before marriage, but that is still a very small number. And for these guys and those who are more strict in their upbringing, the ultimate aim is still to settle down in a marriage. I cant just walk up to my folks and say - " I like this girl, I am moving in with her, and lets see how it goes" - I would like to but I wont, I cannot, it just is not "my way".

Ah well, some day in the future I might see my kids say this to me, but hey thats many many years away ... right now ... I spent a hell of an effort trying to convince my girl's parents, and am looking forward to August 2009!

Thursday, 18 December 2008

Garbage In,Garbage Out

"Garbage In, Garbage Out" or GIGO was one of the first computer acronyms that I learnt, and one that my cousin hammered into me. I should never expect the computer to identify the invalid data that I had entered and still give me a valid result. What this taught me was to check all the steps in my code and to always check for user stupidity as far as input data was concerned. I must admit I have been tempted to be complacent, I have succumbed and even paid the price, but nevertheless I have tried my best to adhere to this as much as I can.

Over the last one year, I have had the chance to work on a project involving a huge amount of coding. The amount of coding that we did is way above the usual coding done by my department. We are more into package tool implementation. So when projects like this come around, maniacs like me are in demand.

I realized during the course of last year that the quality of programmers in my company has fallen. And each time I read a story on the internet saying "if you want to eliminate the need for programmers, then outsource your project" or talking about the lack of quality in the code produced by developers in India/China and other outsourcing hubs, I am pained and the scenes that I see around me don't do anything to reduce the pain.

Garbage In, Garbage Out.

Back in the days when I started to write my first program, I was taught BASIC. C and Pascal were around, but I was taught BASIC so that I could appreciate the basic fact of programming - a set of instructions, nothing more.

When I did move to C and use #include and functions and recursion, I was merely applying structure to the basic set of instructions.Pointers, data structures etc were new and challenging topics and the fact that I crashed my code bu not freeing up memory was a learning step. So today when I write in Java and Python, I still remember how things work under the covers - Java and Python are written in C.

But the guys I work with nowadays are not aware of all this. Most of them were introduced to Java as a course in the semester, with a lab that taught that very basic programming tasks, nothing big or as a 5 day crash course in the company boot-camp. They know things,but never used them in anything big and most of all lack practice. Practice is what makes you good at programming, the more you practice, the more problems you face/analyze/solve the better you will be.

In the hurry to get up to speed on the latest buzz words, we are forgetting our basics. We don't teach the kids the best practices of programming, the way of analyzing a problem effectively and the optimum solution. We tell them the buzz words, a few samples,few lines of code using Eclipse or some such IDE and thats it - certified and project ready. In reality they cannot write 200 lines in one day.

No wonder when you approach a project with such resources, the results take ages to get to the desired quality. They finally get there because people realize things on the job,learn on the job and then deliver.

Is this the best way to go? Can we not improve the situation?