Archive for May, 2006
My Favourite Note-Taking Applications
3Earlier, it used to be sufficient to have a sticky note-taking application hanging around a corner of the screen(or on a different [virtual] desktop) ready to take any text you want to paste in it for future reference. While browsing various technology related websites, I would just copy and paste the important text, along with the URL of the page, in the sticky notes. The data thus collected could then be perused later, organised, blogged about, sent as email to the friends etc. Stickies are easy to create, easy to manage and the data persists even across system reboots. A text editor in contrast has to be started from a menu or a command line, and the user also needs to remember to save the contents every once in a while lest it may be lost due to an unexpected system failure. Every time the system reboots, the text editor needs to be started and the scratch file needs to be re-opened, unless you have the habit of saving your work session before rebooting(I never do it).

Nevertheless, there are some shortcomings of a sticky note-taking application too.They are as follows:
- Its available in only one operating system. I can’t save the notes in Gentoo and later access them from Ubuntu or Windows operating systems. Accessing the notes from another machine is out of question.
- It doesn’t save the formatted text(bold, italic etc), images, hyperlinks and similar stuff – only pure text is supported.
Three applications that I have evaluated in the past few weeks proved to be excellent replacements for the traditional way of taking notes. These modern note taking applications that I grew really fond of are:
- Google Notebook: This application allows formatted text to be saved including images, and also includes a link to the source of the text in case you want to go back to it to collect some more info. Multiple notebooks can be created for different categories of notes, some of them can be shared with the general public, it has got features like expanding and collapsing the notes etc. Most significant benefit is that it is accessible from any machine, any operating system that has got an Internet connection. It pops up in the bottom left corner of the web browser for easy note taking while surfing the web; a full page view is also available to better organise and share the collected notes.
- EverNote: You are sure to fall in love with the interface of this application if you give it but one chance. The feature rich, basic version(no time limit) of this product is freely downloadable from the website, and the paid version, EverNote Plus, that boasts of some additional impressive features like handwriting recognition, is currently priced at $35. A one month trial version of it is available for download at their website.

Its the best note-taking application I have ever used; be it the interface of the application, the features that it supports(copy content from anywhere and paste it in the application and it appears just like it was in the original place) or even the help manual that comes with the product, everything leaves a strong impression upon the user. If you are used to taking notes heavily while you surf the web, read the emails, chat with friends, read the documents etc then you must give this application a try. The only limitation of the product is that its available only for Windows users. - Tomboy: Its a desktop application created in Mono for the GNU/Linux operating system. So unlike Google Notebook, the data cannot be shared across operating systems or among different machines. It allows the text to be formatted after the text has been copied into it(it does not retain the formatting from the original page as does Google Notebook and EverNote) and also allows links to be created to the other notes created in the same application(sort of cross-linking).

It’s still in early stages of the development, so lets give it some time before it can completely replace our old note-taking applications.


Upgrading from Drupal 4.6.6 to Drupal 4.7
0Now that the 4.7 version of the Drupal CMS is released, I went through the documentation for the upgradation process, watched the videocast available on the website, and on one bright afternoon, decided to attempt the upgradation of my drupal 4.6.6 installation. These are the steps that I followed to complete the task:
- I downloaded the latest version of Drupal software, Drupal 4.7, from the drupal.org website: Drupal 4.7.0
- I took a complete backup of the existing Drupal installation in a safe location:
- Backed up all the files and folders present in the Drupal installation location(themes, modules, admin etc).

- Took the full backup of the drupal database.
- Backed up all the files and folders present in the Drupal installation location(themes, modules, admin etc).
- I always first test out the backup to see if it is in good condition or not before overwriting the original installation; a bad backup is worse than no backup. So I tried the restore procedure on the local machine and made sure that everything is working fine and I can depend on this backup if something goes wrong.
- I then logged into my old installation using my administrator account and disabled all the non-core modules(modules that didn’t come with Drupal 4.6.6 and I had to install them manually). I also reverted back to the default ‘bluemarine’ theme and disabled all the other themes. Finally, I logged out.
- I renamed the old installation folder ‘drupal’ to ‘drupal_bak’ and copied the downloaded latest version of Drupal and gave it the folder name ‘drupal’. I copied the ‘settings.php’ file from drupal_bak to drupal folder. I do not have any files in ‘files’ folder, otherwise I would have had to copy that folder also from drupal_bak to drupal.
Its always advisable that you don’t overwrite the old installation files with the files from the new release – for security reasons(some old files may be left out exposing a potential vulnerability etc). Its better to completely remove the old files and the folders and then freshly copy the files from the new version. If Drupal is installed in a sub-folder, as opposed to being installed in the root folder of the web domain, the process becomes as simple as renaming the old folder to a different name and then copying the latest version in its place. Later, the old version can be removed completely or atleast ‘settings.php’ should be permanently deleted from it(don’t forget this).
- I ran the update.php script by going to:
http://mydomain/drupal/update.php
then clicked the ‘Update’ button and watched all the scrolling SQL statements closely for any errors. Fortunately, there was not even a single error. - In anticipation that the hard work will be getting paid and Drupal 4.7′s home page would be welcoming me in all its splendour, I tried accessing the index page at http://mydomain/drupal, but was greeted with an error message instead, which indicated that a function called nodequeue_node_titles() was being called but its definition did not exist.
Yuck. I forgot to delete this function call that I had manually added to one of the blocks. Once the nodequeue module was disabled, there was no way that this line of code could work. I promptly had to go back to my previous installation(rename drupal to drupal_new and drupal_bak to drupal AND restore the backed-up database), login, disable everything again(modules, themes) and additionally, remove the above function call from the block that I had created. If I had added anymore such custom code in any other blocks/pages/files that depended on the non-core modules, I would have had to remove/commentize those parts too.
I repeated the above procedure to attempt the upgradation process another time:
- Moved drupal to drupal_bak and drupal_new to drupal
- Ran the http://mydomain/drupal/update.php file. Selected “Update” button.
When I tried to access the home page this time, there were no more surprises in store; the old familiar home page welcomed me with all my posts and the other stuff. I logged in as administrator to make a final check that everything is in proper order.
- The next tough task was to find the latest, Drupal 4.7 compatible versions of my old themes and modules. I always try to use the modules/themes that are in active developement so that there is best chance of these modules/themes getting upgraded as soon as the main software is updated, and I can immediately continue to use them even after a version upgrade of the main software. If you use a module that is not in active development, then it may not get upgraded to the new version of the software at its release time and hence you may have to wait a long time/forever to get similar functionality after you upgrade. If the module is critical for the working of the website, then it can single-handedly stop you from upgrading to the latest versions! Another reason why you should use only those modules which add significant value to the websites and not try out every single module that is released for the software.
- Download the 4.7 versions of the modules that were being used earlier with the website.
- Extract them in the modules folder.
- Login as administrator and enable the modules from the modules page: administer->modules.
Thankfully with Drupal, majority of the modules are upgraded to the latest version in no time. Among the rest, old version of some of them continue to work with the new Drupal version and some others work if their latest CVS versions are checked out. I was able to replace most of the modules with their 4.7 versions, and I am still in the process of finding the best possible way to replace the rest of them. The process is straightforward:
After confirming that everything is working smoothly and correctly, I permanently deleted the drupal_bak folder and all of its contents. If your journey was not as smooth as mine, you can refer to the following resources to get any assistance:
A Case Against Ajax Web Development Model
2Ajax is the hottest buzzword today on the web development scene. Everyone is trying to port their existing websites to now make use of the Ajax technologies or just including the name ‘Ajax’ somewhere on the website to claim that they too are in the loop too. I am not totally impressed by the Ajax technologies though.
My primary reservations are with the complete diversion of the path that web development is currently taking towards the Ajax based development style. I have the following concerns:
- Creating websites using a heavy dose of HTML and Javascript is not the most intuitive way of creating complex web applications. After taking all the steps to build convenient abstractions(objects and events) for web development, hence bringing it closer to the desktop development model, its foolish to take one big step back now.
- Not being able to bookmark most of the pages of a website is not going to make anyone, the customer or the website owner, feel happy about it. We come across the same concern with the ‘POST’ data too, but POST method is either used:
- when submitting sensitive information to the server; or
- when sending large amounts of data to the server
No bookmarking should be needed in either of these cases. The same is not the case with the Ajax based websites.
- It breaks the ‘Back’ button of the web browser. Once again, this is not a new restriction; many websites break at many places if the ‘Back’ button of the browser is used, but the problem is compounded to the extreme level when using Ajax.
- I can’t right click on a link to open the target page in a new window. This point may look silly but this in fact is my biggest irritation when using the otherwise excellent Google Mail interface.
- Web developers need to be taught to learn new interface design guidelines. With the liberty of being able to create and destroy any part of a web page dynamically, a bad design can easily leave the user clueless and confused if enough indications are not left regarding what each part of the page tries to accomplish(Flickr demonstrates an example of a good interface). Easy to navigate interfaces are critical for any kind of applications, but the issue gains more importance with Ajax based interfaces.
Its not that I see only drawbacks of using the Ajax technology – with so many great application interfaces being created using this technology every day and so many Ajax applications gaining such widespread adoption, it cannot be without its virtues. It allows some cool effects to be achieved(game website) without having to invest a lot of effort in it – just a basic knowledge of HTML, DOM and Javascript(a skill set that every web developer should be comfortable with) is sufficient. Ajax is not just coolness though; it also helps in creating better interfaces than possible with the traditional web development model, for similar kind of functionality; improves response times giving a more interactive feel to the users; it saves bandwidth, saving time and money in turn.
So when would I use Ajax and when would I prefer to stick to the traditional web development style? For simple web tools(eg: a file uploader/manager, a simple online game, a calculator etc), I would go all the way to use the Ajax technology as it would enable the user to experience the same convenience as that of a desktop application. For complex/moderately complex applications, it should be a tough call based upon the following question: what is most critical for the application, the interface and responsiveness, or the development and the maintenance of the application? Let us admit the simple fact that its not a much pleasurable activity to implement feature after feature using heaps of Javascript code, then writing just enough php code to merely pull the data from the database to return it to the client in some obscure data structuring format.
I would still use Ajax based techniques to pepper up certain parts of the interface though, if I feel like none of the above mentioned disadvantages weigh heavily over the gains that the application can make with them. For example, I wouldn’t use Ajax technologies heavily if I were creating a website like Amazon, though I would still use Ajax to pop up the balloons whenever a user holds the mouse over a product, providing the user with fresh and useful information about it(how many in stock, latest discounts etc).
All the Ajax frameworks that are propping up on the Internet in recent times should help the web developers escape from having to write large amounts of Javascript code, test them, debug them and also from having to maintain them. Such frameworks also use the best practices, thus removing the scope of many design errors that the web developers might commit if they write the Javascript code manually. The Ajax framework that Google has released recently is definitely worth trying out, and I will try to write about it in a future post.
Browse Internet Without Using the Mouse Buttons
0I recently came across this website that contains no buttons, no hyperlinks etc – in short, no clickable items at all. You can browse the entire website without using a single mouse click: if you want to know more about a term on the website(that has an associated target page), you can reach to it just by pausing the mouse over it for a while. Would you like to browse all the websites in the same way? It should be pretty painful if every time the mouse hovers at a place the website takes the user to a different page even if it was not the user’s intention, but we are getting serious here. Let the concerned people continue with their research and until then, let us have some fun with this website; below are some screenshots from the website:

The website: DONTCLICK.IT
Boost Filesystem Library: Writing Portable C++ Programs to Acess The Filesystem
5
Boost Filesystem library allows us to write portable code to access files and directories from a C++ program without using the operating system specific system/library calls. I have written about the Boost family of libraries in an earlier post, and have posted the procedure to install and get started with the Boost libraries on various OS distributions here. In this post, I will be talking about one of the popular Boost libraries – the Filesystem library. Lets first consider how a C++ program that needs to check for the existence of a file might look like:
first.cpp
[cpp]
#include
#include
#include
int main()
{
struct stat st;
if(lstat(“first.cppâ€, &st) == -1 && errno == ENOENT)
std::cout<<"the file doesn't exist.\n";
else
std::cout<<"the file exists.\n";
}
[/cpp]
The above code runs under most of the GNU/Linux operating systems. It won’t work under the Windows operating system though. One way to write portable code that runs under different operating systems without needing any modifications, is to use #ifdef family of preprocessor directives that selectively include different parts of the code on different operating systems. A better way would be to create an intermediate abstraction layer that provides a single interface to the programs to talk to different operating systems. Boost provides one such interface, with implementations available for Windows and all POSIX compatible operating systems, which covers most of the popular operating systems today. Additional benefits of using the Boost libraries are robustness and the design practices that are close to philosophy of the C++ standard library itself. Let’s try to write the above program using the Boost Filesystem library:
first.cpp
[cpp]
#include
#include
namespace bf = boost::filesystem; //create an alias
int main()
{
bf::path p(“first.cpp”);
if(bf::exists(p))
std::cout<
std::cout<
[/cpp]
Line 4 above creates an alias named ‘bf’ to the namespace ‘boost::filesystem’ which contains all the functions useful for the manipulation of files(like exists(), is_directory(), etc). ‘path’ is a type that allows paths to be represented in a platform independent format; instead of passing path names as strings to every boost function, we just wrap it in a ‘path’ object and use the object in its place.
[cpp]
bf::path p(“first.cpp”); //’p’ represents “first.cpp”
[/cpp]
The function exists() takes a path name as its argument(i.e, an object of type ‘path’) and returns true if the path represented by the path name exists; otherwise false. We print the return value of the function ‘leaf()’, which is the last part of the path stored in p; so for example if “/home/user/tests/first.cpp” is stored in the path object, then invoking leaf() on it will return ‘first.cpp’.
The exact procedure to compile the above program depends on the specific platform used(compilation on some platforms discussed here), but it should be on the similar lines to :
Similarly, there are a bunch of other operations that can be performed on the underlying file system using the boost filesystem library, and all of these are declared in the ‘operations.hpp’ header file. The class ‘path’ itself is defined in the ‘path.hpp’ header file, but we do not need to include it separately as it is already included by the ‘operations.hpp’ file. Some of the other interesting functions available in boost filesystem library are demonstrated by the following example:
second.cpp
[cpp]
#include
#include
namespace bf = boost::filesystem;
int main()
{
bf::path p(“second.cpp”);
if( !bf::exists(p) )
{
std::cout<
}
if( bf::is_directory(p) )
std::cout<
std::cout<
std::cout<
std::cout<<"file size: "<
[/cpp]
The program should be self-explanatory. There are a lot of other functions that allow operations like: creation and deletion of files, iterating over all the files present in a directory, copying and moving files between directories, etc. I would follow-up with examples that use these operations, but until then the following links should keep you busy:
Boost Filesystem
operations.hpp header file

Recent Comments