The joy of open source


I was first drawn to open source by the promise of free software. Blogs I read and respected would suggest a GPL’d app which I would download, use and not think twice about as long they worked. Open source apps were like any other piece of software - the only difference was they didn’t cost me anything.

However, now that I’ve been learning PHP, I have begun to appreciate open source apps in a completely different way. For me, taking apart a PHP program, tracing functions and variables across different include files, has taught me more than any book about how to write proper PHP scripts. The fact that I can “look under the hood” to see how a program is constructed is fascinating and has inspired me to do some tinkering myself.

Scuttle, my bookmark manager has a great feature which allows you to mark a bookmark public or private. This is most often done when the bookmark is first added but can be amended later by editing the bookmark on another page. By default, new bookmarks are publicly viewable which means that you don’t have to log in to access them. This is great for most uses but for personal bookmarks I would have to either remember to set my bookmark to private when I first added or click on the edit link which would take me to a separate page where I would have access to edit all fields (URL, description, tags, etc) related to that bookmark. All I wanted was a simple link on the page which would allow me to mark something as private or public without having to edit the entire boomark record. However, I noticed that beside the “edit” link there was another link called “delete” which allowed me to directly delete a link without having to go to another page.

Harnessing the power of open source, I was able to learn that the delete function worked quite simply and elegantly by parsing a URL which contained the id number of the boomark to be deleted. This boomark id was used by a php script to construct a DELETE query in MYSQL which removed the bookmark from the list of visible bookmarks. Knowing that making my bookmarks private or public was just a matter of executing an UPDATE query to set the bookmark status to either (0) for public or (2) for private, I easily copied the php file used for the delete action and modified the SQL script to UPDATE instead of DELETE. In the main bookmarks file, I also added two links to the script that created the bookmarks list which would allow me to mark boomarks public or private. Voila !! Without having to put in a feature request to the author I was able to customize scuttle to suit my work style.

Simply put, that’s really cool …


comments powered by Disqus

Date

Sunday, May 8, 2005

Estimated Reading Time

2 minutes

Categories

Previous Article

Next Article