Sunday, July 20, 2008

Drupal & Joomla to your Rescue !!

Have you ever felt that the process of making a web site tedious, time-consuming and lengthy process and spent more time than is actually needed ??

Or have you ever felt the need to build an interactive website really fast, may be for a semester project ??

If yes, then Content Management Systems (CMS) like Drupal & Joomla! are exactly what you need. This is not to say that only in these CMS would work only in these situations. They can be used by experts as well as novices to build rich-featured, reliable, easily administered websites by providing them an extremely flexible and highly configurable environment to operate in.

Let's see what is a CMS ?
CMS stands for Content Management System. It can be seen as a software package that can be used by individual or community of users to easily publish, manage and organize a wide variety of content on your website.
CMS eases the process of building websites by being flexible in nature and providing the developer with high degree of configuration and customization.
Also using CMS, one need not be proficient in scripting languages like PHP, however basic knowledge would help.

Well known CMS like Drupal & Joomla! basically need Apache Web Server, MySQL database, and PHP to work on, so you basically need LAMP(Linux, Apache, MySQL, PHP) stack whereas with Windows, you need a WAMP(Windows, Apache, MySQL, PHP) server. You can download the WAMP server here.

So before you start using any one of them, make sure that your web server is properly installed.
For windows, you need to perform the following steps:
  • Install the WAMP server on your local machine.
  • Download Drupal or Joomla! dump from their respective sites and depending on whether you use localhost or remote web server, you need to unzip files from the dump to a correct location.
For localhost development, all that is needed is to copy paste Drupal's or Joomla's files to a folder on your WAMP server i.e. make a folder in www in your WAMP server and place all the files there. Then run in a web browser, http://localhost/name_of_folder and follow the installation instructions

For remote web server, an extra step is that you need to FTP these files to the server using any FTP client like FileZilla and then follow the installation instructions.

Drupal eases your installation task by providing you with a videocast on how to install and configure your CMS, that is really really useful for novices like me. :-)
Joomla! also provides you with detailed installation instructions that helps you with any issue that you might get into.

Having being used both of them, i can say that Drupal is much more extensive in terms of features and functionality that it provides to the developer. May be because it is in existence for a longer time than Joomla!. But, it also makes Drupal user-interface more overwhelming (not complicated though) and sometimes frustating for the newbie. But one should devote some more time in understanding the basics, its architecture and workflow.

This is not to say that Joomla! is not good. On the other hand, i would recommend students to begin with Joomla! and then slowly graduate to Drupal But still i found it pretty easy to set permissions in Drupal than in Joomla!. There are several tutorials on both of them and I'm not really an expert to compare the two. The bottom-line is that both are useful and extensible in their own right.

Using a CMS, you can easily make website for your school/college clubs or alumni portal providing features like discussion forums, creating polls and voting on them, giving each user a facility to create and manage their own blog using a blogging API, creating, editing and managing articles, stories, pages as well as commenting on other's posts, uploading files onto the server and much more. It provides a plethora of options to the administrator as well and helps him/her to have total control on the flow, thus making your website secure, reliable and safe.

With Drupal and Joomla! being open-source, they are backed by a huge community of users and developers who continuously keep on developing new innovative modules and themes which can be downloaded as such (free of cost, obviously) and used within your website. Thus, they make your website easily extensible and flexible in nature.

Thus anyone, who is interested in creating websites on-the-go can definitely give these frameworks a try and end up learning quite a lot.

There is so much more to share about these exciting systems, but I think I have already written a pretty long blog, so will continue sometime later...

Saturday, July 12, 2008

GWT - Have you tried it ??

What's GWT ?
Google Web Toolkit is an open source Java development framework that can be used to build web applications using AJAX easily and you do not have to worry about issues like cross-browser compatibility.

GWT Major Features:
  • Real-time debugging
  • Cross-browser compatibility
  • Reusable UI Components
  • Simplified DOM API
  • Completely Open Source
One of GWT's major strength is GWT's Java-to-JavaScript compiler which translates the Java source code into equivalent JavaScript code which can be run in web mode on any web server.
Also, during development you can run and debug your application in hosted mode by running it as Java Bytecode within JVM using GWT's Hosted Web Browser.
To get an overview of the its architecture, please see this

On a downside, there are few issues still unresolved:
  • GWT 1.4 does not support JDK 1.5 version but GWT 1.5 Release Candidate do support it
  • Also, GWT does not support several concepts in Java such as Reflection, Finalization, Assertions, Multithreading & Synchronization, mainly because JavaScript does not provide support for them.
Certain links that i think any novice (to GWT) would find useful
So, what are you waiting for !!
If you haven't tried it yet, download it right now here and have fun making easy to use and interactive good looking web applications.

Sunday, July 6, 2008

Interesting SQL Query

Write a SQL query to compute the Nth Maximum Salary

Lets get started with an easy one.
Write a SQL query to compute the 2nd Maximum Salary

select Max(Salary)
from Employee
where Salary != (select Max(Salary) from Employee);

To see how it works, you need to understand how a nested query is executed:
First the innermost (nested) query is executed and its result is placed in a temporary table, then the outer query is executed which uses that result.

So if you have to find the 3rd Maximum Salary, you could extend the previous query by increasing one more level of nesting. And so on.

A more interesting and simpler way to find Nth maximum salary would be the following correlated subquery

select * from Employee E1 where
(N-1) = (select Count(Distinct(E2.Salary))
from Employee E2
where E2.Salary > E1.Salary );

Let us now see how this correlated query works:
For each tuple of table Employee, the inner query is executed once and
the result is now stored in some temporary form which is used by the
outer query.

Thus, this correlated query takes O(n*n) time (quadratic time) as compared to linear time {O(n+n) = O(n)} of nested queries but it is still better than nesting the query n number of times as that would result in cumbersome code. However, both would take equal time. :-)

The best way to understand the query is to dry run it on some sample data and some value for N

Is Java "Purely" Object-Oriented ??

There are two schools of thought here......obviously disagreeing on the issue.

One, considers Java to be purely Object-oriented language as
Every single program that you can write in Java has to be encapsulated
in a Class (unlike in languages like C++) i.e you cannot write any java
program without having to write a class and since we know that every

class in java implicitly extends Object class, thereby exhibiting characteristics and features of an Object-Oriented Language.

On the other hand, some people refute the previous claim by saying that
Since there are primitive data types in Java such as int, double, char, boolean etc. and we can write a simple program in Java without having to create any object or without having to use other objects or predefined classes, so it can't be called as a completely object-oriented language, especially when we compare it with languages such as Smalltalk, Python, Lisp etc.

As it goes, I'm also a bit confused on the issue but i would like to believe that Java is a
purely object-oriented language.

Any comments, corrections are welcome and required. :-)

Tuesday, July 1, 2008

My Blog Wins Award

My Blog Entry JavaMail for Starters !! is one of those few, which have won themselves quite a fortune in Sun's Student Review Contest on NetBeans and OpenSolaris. You can see the complete result here.

The blog entry was about how to send Email from a Java Application, making use of JavaMail API. The blog was written for the target audience, primarily unfamiliar with such API's and using them with NB.