Friday, August 31, 2007

Prabhu-Gallery Beta

I took a five day break from office and headed home to spend my time with my parents.
Finally I got time to work on my webpage and got it running.
http://prabhudc.net/gallery/index.html is in its beta stages. I call it Beta as I am yet to build the Front end,load all the images and many other plans in mind.

I really enjoyed building and I would like to brief on How I achieved it.
Apart from my own scripts,I have used Lightbox module for the effects on the images and scriptaculous library for the special effects with the menu panel.

I wrote Ajax front end and back end php for the gallery. Only tool I used for debugging was Firefox's firebug. Firebug is an awesome tool and it really helped me getting over the numerous javascript bugs.

The backend php script is very straight forward. It receives a directory location as a post request from the front end. The script looks within that directory and retrieves all files with a ".JPG" extension and creates a "^" delimited list of all the image files. This string is returned as a response to the front end.
The Front end too, without any much special effects is straight forward. The Ajax script is written in such a way that it sends a directory path as a request to the server.

As the images could be very heavy and also large in number,displaying all of them by resizing them into thumbnails would be very inefficient. Hence I created distinct directories for thumbnails and the large images, although I made it sure that the image names were same. So the images that are displayed as thumbnails are indeed low resolution thumbnails and they load pretty fast. But On clicking the thumbnail, the image that is retrieved is the high resolution image(I got javascript to change the path).

Until now was the easiest. What really bogged me was getting the effects of lightbox. Latest lightbox release has the ability of recognizing a group of snaps which fall under the same category which is actually very helpful and easy for a developer. But! What the heck! That would be really boring if you don't get to do anything. So I took the primitive version of lightbox and tried to get it run. All we have to do is to include the lighbox.js/.css files and add the property "rel=lightbox" to each image. I got this done pretty easily with javascript. But somehow the image was not rendering itself. As I click on any thumbnail, it opens itself in a blank page without any effects. The Ajax code which I had written, worked absolutely fine, i.e. I was getting the thumbnails easily, but it was the lightbox Ajax part that had been f###'d up! I took nearly 20hrs to find the cause of this going wrong. I even edited the lightbox javascript code, but that really didn't help me. Finally I was able to figure out what was going wrong. The lightbox script works as following. Once a page loads it scans the whole page for all images and also verifies if it has the "rel=lightbox" property. Now once my page was getting loaded, it was able to capture any image that was hardcoded in the HTML. The problem with lightbox script was that it was not able to recognize my thumbnails as it was got through Ajax and at a later stage(After page load). All I had to do to get over this problem was to reload the lightbox module after any successful response from the server.

As of now I am still testing the page in various browsers. It seems to be fine on FF2+, IE7,IE6. There is still a lot of work that needs to be done.

Sunday, August 26, 2007

Ellavarkum hridayam niranja onashamsakal

In the sense, Hearty Onam wishes to all!!
Onam is celebrated mainly in Kerala a southern state of Kerala. Onam signifies affluence and happiness among keralites. This festival dates back to the 8th century A.D. Basically Kerala's history prior to 8th century A.D. is a mystery as there is no record of it.

Onam traditionally is celebrated as a harbinger of spring when harvest is around the corner. Every malayalee[Malayalam is the language spoke by Keralites all over the world] celebrates this festival even in a condition of destitute. Even if other traditional customs are missed, no Onam passes by without a sadya alias a perfect onam lunch.



Apart from being a symbol of a harbinger of spring Onam has a very interesting story. King Mahabali had defeated king Indra. King Mahabali being an Asura had great reverence towards lord Vishnu. But as the gods wanted revenge and because of a series of events Lord himself planned to take birth in the form of Vamanan. Vamanan is said to have stamped Mahabali and pushed him to hell. Once in a year Mahabali is allowed to return to earth and meet his people. That day is Thiruvonam. People lay mats of flower at their doorsteps, decorate their house and expect Mahabali to visit them.
This mat laying of flowers is also cinsidered as a competition in Kerala. Local youth clubs of each colony try to display their skills by laying complex and beautiful flower mats. These flower mats are called as athapookalam.



Again Happy Onam to all, let Mahabali visit your house as well!!

Friday, August 17, 2007

Ubuntu saves XP

I wanted to install IE 7 on my lappy the other day, so I downloaded it and ran the set up.
The download went fine until the end. Suddenly it gave me an alert saying a file was not found, I never realized what file it would be and what could be its significance and hit the OK button. Immediately my system started to shut down. It rebooted within seconds and I selected XP from GRUB. I gave my login password and I was taken to a blank screen. Couldn't do anything at all. The only thing that worked was CTR-L - ALT - DEL. I could run processes from that, tried iexplore, but the network was not getting activated so I couldn't access the net either. Basically the EXPLORER.exe could not be started because a system32 file "normaliz.dll" got deleted during the IE7 update. I thought of googling so got into UBUNTU and gave a search. There was no satisfactory work around for this. Basically I was screwed. Then came the idea of accessing ntfs folder from UBUNTU and get the file to its place. After some significant googling I got a driver "ntfs-3g" which helped me get write access to NTFS drives. I got could get write access to all other drives than the drive that had system32 due to some config problem. Not a problem! I got the file into another directorie that had write access. Rebooted. Logged into XP, through task manager, ran cmd.exe, copied the file from its location to system32 folder. Then ran EXPLORER.exe. Voila!!!!!
Feisty fawn saved my day.

Wednesday, August 15, 2007

Ever wondered how many pages Google would have indexed.

I always wonder how many pages Google would have indexed and cached in its servers. Imagine the kind of space it would require to store them. Also intriguing is how they organize the data for immediate results. Apparently I was told that they have server pool architecture and have replicated them at geographically distinct locations.

Check out this URL for a brief analysis on the number of pages indexed by Google corp.

Click Here


Powered by ScribeFire.

News

This is just about a fact that I had noticed. Last Sunday I was in Bangalore spending my weekend at home. Browsing through the channels I stumbled upon ABC News (ABC for Australian Broadcasting corporation and not its American counterpart). Following the headlines was the news in brief, The first was about an unrest in Afghanistan and the next was on India. Apparently more that 600 people had lost their lives in North India since last two weeks alone. Back in Chennai, I get to watch Indian news channels almost everyday in office during breakfasts and lunches. Ironically I never knew about such a tragedy in India all along. Although I do not want to point them out here, I am talking about India's top News channels. Its very disappointing that these channels focus on ridiculous News like Indian cricket team or some pathetic rape case. In the evening there would be long running programmes having a bunch of politicians in the middle and surrounding them a bunch of jobless people to ask foolish question, to make it all worse you could see a hyperactive host in the middle who basically does not let anyone talk other than herself. These Indian News channels are clearly commercially oriented, they prefer to focus on public inclinations and not the facts.

I am totally disappointed that I came to know something about my country through a foreign channel