Archive for the ‘software’ Category

Passwords in clear text

Friday, July 4th, 2008

I just received a newsletter from a social network site (brijj.com) and was surprised how they had embedded my username and password in clear text. It speaks volumes on how seriously they take security. I think when storing passwords all sites should go by few rules:

  • Do not store passwords in cleartext. Never ever.
  • Use any encryption technology, preferable a 1-way hash so that nobody can decipher the password.
  • If you break the above rules, which several sites do, at least do not send out passwords in emails without being asked for. That’s the worst you can do.

Everyone should realize that people tend to use same passwords for several sites and accounts so sending out passwords in clear text not only compromises the user’s account at your site but possibly at other places as well.

Evaluating / Comparing NetBeans and Eclipse EE for Java EE development

Friday, October 19th, 2007

Although we are ‘big’ Eclipse fans and have been using it for many years for everything (PHP/symfony, Java, XUL, HTML) and have even contributed plugins but we decided to evaluate NetBeans to see if it gives any extra features that might help/speed up development for our forth coming Java EE project.
Technologies we are going to use in our application are:

Preferred IDE requirements:

  • CVS integration
  • Integration with GlassFish - so that we don’t have to leave the IDE to deploy etc
  • Should support debugging of web application
  • Support for profiling
  • XML/JSP editor
  • Context sensitive help and auto completion for tags

We are comparing
NetBeans 6 Beta 1 and Eclipse 3.3 Java EE

Creating a new web project is pretty straight forward. Both IDEs create more or less same directory structure only difference being the location where Java source files are stored. Eclipse keeps them under src where as NetBeans keeps them under src/java.
Next thing I wanted to do was import (share) my project to CVS. Found it more user friendly in Eclipse although NetBeans was equally straight forward.

JSP/XML Editor
NetBeans editor is lot more advance and friendly.
Editing Web.xml in Eclipse
Editing web.xml in NetBeans

Other differences
- In Netbeans you don’t have to click on ‘fast views’ just mouse over brings the window.

- Can’t easily change destination of compiled class files in NetBeans. We wanted to try directory deployment feature of GlassFish so that we don’t have to create .war every time, this required us to compile and put the class files in WEB-INF/class folder. This setting is pretty straight forward in Eclipse whereas you have to change projects.properties file in NetBeans. (Or it was not easy to find how to change it via UI)

- One of the biggest inconveniences was not having auto import while writing Java Code. Eclipse will auto import a class if you use it (Ctrl+space) but in NetBeans you have to manually add imports. There is fix imports also but thats an extra step.

- Eclipse UI in general is more user friendly. As an example ‘output console’ had a title bar and then some tabs. Each of these tabs are (or at least look) like individual windows with separate x (close) buttons. Its very natural to double click on the title to maximize it, hence you would try to double click on title ‘GlassFish v2′ but it will not do anything. You will have to double click on the bar above it ‘Output’. This is understandable but not ‘really’ as expected. On the other hand eclipse is pretty straight forward.
NetBeans console windowEclipse console window

- Eclipse kept on crashing (giving out of memory error) on my colleague’s laptop which has 1GB RAM, this happens when he tries to run GlassFish from Eclipse. Trying to run GF outside of Eclipse doesn’t crash it. This is actually a show stopper, or he needs to upgrade RAM

- I couldn’t figure out how to auto compile and auto deploy application on NetBeans. Every time you change a class file you need to ‘build’ and ‘run’ or ‘deploy’ on the other hand Eclipse will compile and deploy automatically on save. On the other hand auto deploying can also become a problem when application size grows. But this made it very smooth on Eclipse to build/test.

We also evaluated how to create a project so that it can be opened in both the IDEs so that we can either switch or let programmers choose whatever they want. There was no ‘huge’ difference of features or one IDE helping a LOT. On the other hand as we are comfortable with Eclipse shifting on NetBeans can be counter productive as we have to learn/get used to the new IDE. We know that we will need NetBeans for debugging and profiling but development will be faster with Eclipse using directory deploy and .reload feature of GlassFish.

Visualizr - Yahoo! Open Hack Day Bangalore, India

Tuesday, October 9th, 2007

Over the weekend we went to the open yahoo! hack day at Bangalore ….and what……

Hack Day - visualizr

Here are the ideas we thought of

  1. A service which will take your favorite blogs, your linked in profile or/and your favorite articles as input and create a mash-up of articles you might be interested in from Amazon or images from flickr or events from upcoming. Will also try to make a guess as to what kind of person you are.
  2. Visualizr, what we initially called as pic-story and the one we finally built.
  3. Travel Helper - Give us your travel dates and cities you are visiting and we will tell you what are the events happening during that time on those places and we will also show you interesting pictures from flickr taken in those cities so that you can decide what you want to do if you have free time.
  4. Tell us what you want to buy and we will give you all the relevant information. for e.g. items from different shopping sites, review sites, news, flickr etc
  5. Pictorial how to? Give us step by step procedure of creating or doing anything and we will return the same how with pictures to understand better.

Creating visualizr was fun and we really like the idea as it could actually be applied in lots of things like

  • Make your own cards
  • Build an ad campaign
  • With more comprehensive image access a new way of communication
  • Evolve as a How to tool? Ask 10 questions and see how Images can answer for you
  • May give a whole new way of learning difficult concepts
  • Or just brighten up your day

So what are you waiting for, go check it out visualizr

Recovering database from MySQL 4.x

Friday, August 31st, 2007

Recently I was involved with a task to recover a database on MySQL 4.x that crashed. Below are the steps that I did to recover the database. The commands in this post are available on MySQL 4.x, if you are on MySQL version higher than this then check MySQL 5.x

1. The MYI file of the database was corrupted and I could find out that by trying to select rows from one of the tables. The error message returned for the select query - ERROR 1016 (HY000): Can’t open file: ‘TABLE.MYI’ (errno: 144).

2. Next step was to run myisamchk for which I should shut down the database first by issuing command “mysqladmin -u root shutdown” at the command prompt

3. First I tried using the –quick option on the database to rebuild the index only
/pathtomysqlexecutablefiles/myisamchk –quick /pathtodatabase/*.MYI [ to repair all the tables use wildcard (*) ], the command executed successfully, and displayed the repair information.

4. I again started mysql server using command “mysqld &”

5. Logged in to mysql prompt and selected the repaired database. To know the status of the tables after repair I executed “show table status” on the mysql prompt.

6. The results displayed error “Incorrect information in file: ‘./database/TABLE.frm” which means the frm file of the database got corrupted. Searching for the same on the web I found if we run an extended check using myisamchk may solve this problem for which I had to go to step 2.

7. There are few checks one should do if step 3 cannot help you recover the database, and after every check repeat steps 4 - 6 in the same order. You would know your table is recovered when “show table status” shows no errors, and to confirm this further you should be able to select rows from the table.

a) /pathtomysqlexecutablefiles/myisamchk –force –fast -c -i -r /pathtodatabase/*.MYI
b) /pathtomysqlexecutablefiles/myisamchk –force –fast -c -i -o /pathtodatabase/*.MYI
c) /pathtomysqlexecutablefiles/myisamchk –force –fast –update-state -i -r -e /pathtodatabase/*.MYI

if it gives error - myisamchk: error: Not enough memory for blob at 1940 (need 1890777748) (1.7GB thats wierd)
but if you think your table may be holding that much of data and your server has huge memory you may use
d) /pathtomysqlexecutablefiles/myisamchk –fast –update-state -i -o -e -O key_buffer_size=2048M -O read_buffer_size=2048M -O write_buffer_size=2048M /pathtodatabase/*.MYI
Thats giving 2 GB of memory to myisamchk for processing!
If you want to know more about visit : myisamchk Memory Usage

If the error about memory persists, it means there has been serious damage to the database. Same was the case with my database, these are the steps for recovering in such scenario:
a) Recreate a database on local MySQL server.
b) Recreate all the tables with similar schema as it is on the web server
c) Stop local MySQL server
d) Copy frm and MYD to the local computer at the same place where your newly created database exists with its (frm, MYI and, MYD) files.
e) Execute myisamchk –quick /path/to/datadir/*.MYI (One can also use REPAIR TABLE command from mysql prompt)
f) Restart MySQL Server and try selecting rows from the tables.

Free Photo Editing Softwares

Monday, August 20th, 2007

Wanting a powerful and free photo editing software is a common thing. I mean when you are trying it as a hobby or for some small time fun, why would you pay $649 for Photoshop ? This is where free softwares come to your aid. Of course if you are reading this, you have looked around for them and have come across the same old lists. So which one to use ? That question is very common - and very hard to answer too. You could go for an MS Paint-Style editor with a few extra functions or yield the real power from a Photoshop-Style editor. So I am here to help you in your quest for the right editor.

  • The GIMP : You will hear this name very often. GIMP ( GNU Image Manipulation Program ) is one of the most famous names out there. GIMP started as a free open-source replacement for Photoshop and has become what it wanted to be. It is getting better with each release and the number of users is increasing rapidly. It works on Linux, Unix, Windows and Macintosh and is Multilingual. It is the idle Photoshop replacement for many people. Here are a few screenshots. If you want to ask me, this is what I recommend to anyone who is looking for a free image manipulation software/image editor.
    • GIMP on Linux
    • GIMP on Unix
    • GIMP on Windows
    • GIMP on Mac
  • GIMPshop : GIMPshop is a GIMP hack to make it feel like Photoshop. It does not sacrifice or add any features but the interface is modified to make Photoshop users feel comfortable with it. So if you are switching from Photoshop to GIMP, you should probably go for this.
  • : Another great windows-only alternative. Considered by some as “Free Photoshop”. According to their site, Paint.NET started as a undergraduate college senior design project mentored my Microsoft and was originally intended to be used as a free replacement for Microsoft Paint. It kept getting more features and became what it is now. Personally, I don’t like it much. But then that is just my opinion. You should go and try and decide for yourself. It is very powerful, but I find GIMP better. Heres a screenshot of it.
  • Pixen : Pixen is a mac-only pixel art designer. Its made for pixel artists who do their work pixel by pixel. If you are looking for big sized realistic pictures, you better avoid this one. But if you are into pixel art or want to try it, and have a mac or a mac emulator on your Windows/Linux/Unix, then you can go for it. But keep in mind that this doesn’t support layers. If you need layers, try the next one.
  • mtPaint : Another one made for pixel art. This one comes for Linux and Windows. This has support for layers so you might want to go for it if you need layers ( Pixen doesn’t support layers ). Some useful features are present in there but don’t expect something really big.
  • : This ones not really that famous. Based on GIMP and for Mac only. And its not there to replace Photoshop. A simple interface for basic home users. So you are better off with GIMP.