Netbeans, PHP and "Fest"s
The project I'd talked about a couple of blog posts earlier, was, if you had a look, for managing what are popularly called "fests" (or festivals) in India. A college organizes a few days of competition on various topics, and invites other colleges to participate in the same. My project would've helped institutes out with the same, including the fest's website, and administration. Trouble is, it didn't quite turn out that way... It turns out, our university's server only supports PHP, and not JSP. That support is currently underway, after our departement requested it... Since I was part of the team in-charge of the fest website, I began work on PHP. Boring to do it again, but someone's gotta do it...
Since Netbeans 6.5, released late last year has support for PHP, I decided to give it a try. Another team member prepared the CSS, and a couple of sample pages, and then I got cracking on it. I usually use Notepad++ for PHP, and WAMP, since Internet Explorer is still the numero uno browser out there... Netbeans read the application my friend had made thus far easily... Also, since the WAMP server was in another directory, Netbeans readily volunteered to copy the files to the server, without the metadata Netbeans needs, of course.
Since I'd already worked with JSP in Netbeans, it didn't require much effort to learn the tool. All the features that I wanted were there... syntax highlighting, pop-up documentation, automatic code completion, etc. I found myself using source formatting again and again. Correction of code was easier too. Creating a template came in handy, in order to get all those PHP includes out of the way as a soon as I create a document.
There are some features that I never used though... CSS Preview, Javascript debugging, and the PHP debugger. Call me an old dog, but I'm used to debugging PHP code the conventional way, type it out on the screen. There wasn't a lot of it anyways. During deployment, I just copied the folder from the local server, to our university server. Since the university server's Solaris, I got a few errors I didn't account for. The slashes in a couple of pages were the other way around, so didn't work on Solaris (I know, beginner's mistake...) The GD library wasn't available, so had to use a script that got around that problem. The server had caching enabled, and that created a lot of problems for editing on the server itself. I'll try to verify it on my OpenSolaris installation on Virtualbox, but then the operating versions might differ, but still better than nothing...
That's not Netbeans' issue though. Overall, Netbeans did help to make it smoother, and I'll use it next time too. And, in case you want to visit the website itself, please go on ahead. The fest is called Sankalan :) Do attend if you can!
Posted at 12:35AM Jan 20, 2009 by Aadhar Mittal in Personal | Comments[2]
Creating a project on Java.net
Some of the students at my institute wanted to create projects at Java.net, the website for open-source projects related to java, created by Sun Microsystems. These would be for the India-specific competition, Code for Freedom, where each team of participant(s) has to create an application using at least 3 of Sun's open-source offerings.
After the results of the last competition, where both participants from our institute won 2nd prizes in their respective categories, I don't blame them! We were the only institute from the world to do so, which raises expectations too I guess. After walking a couple of them through the process, I figured it'd just be easier to write a blog post about it. So here we go.
1. Visit java.net
2. Register at the site, and log into your newly created account.
3. Request a project by clicking on the link in the left-hand side toolbar. Use the information available on the Creating a new project help page in order to fill out the forms.
4. After creation, you will be taken directly to your project page, and it will also be listed on the "My pages" page.
5. You can watch the members list of the project, and add more members to the project (after the project has been approved) by clicking on the link given under the title "Participation".
6. Under downloads, you can access the Docs and Files section, and add new files and folders. The documentation goes here.
7. The code, requires access to a repository. For those who don't know what that is, understand that for projects that require teams and versions to be maintained over time (all open-source software?), you need a revision control system. I'll let wikipedia explain the rest. The ones java.net uses are Subversion, and on request, CVS. If you use Netbeans, you can find a tutorial here in order to accomplish the same. Don't forget to download Subversion first though, from the Netbeans-suggested site or the origin. If you don't use Netbeans, and are on Windows, I'd recommend downloading TortoiseSVN and learning how to use it. For other systems, you can download subversion, and search for a third-party client or find out the commands. If you have taken all the steps above, your project should have been successfully uploaded.
You can drop me the new project's link when you do :)
Posted at 03:40AM Jan 13, 2009 by Aadhar Mittal in Personal | Comments[3]
A First implementation on Glassfish
I've dug out this project from the archives in order to write this post, and also as an entry to a contest.
Anyways, I'll begin with a little context. I know a bit of web designing, and I use PHP primarily. That was, until a project came along, as part of my curriculum, that required me to use Java for a website. The project was to make a website for fests, that is competitions, technical or otherwise. Of course, shifting to a new language can be easy if the paradigm is the same, but if you really want to take advantage, you have to take into account the strengths of the language.
Web design can be divided into two parts primarily, the user-interface, and the backend, all the business logic, and functionality of your project. PHP uses a method where your code, and your UI, that is the HTML part, come in together. Moreover, it does not use object-oriented programming all that much. While, there is something to be said about the advantages of the same, this kind of design makes it rather difficult to seperate these tasks into two. JSP uses a different approach for this, and that is where the primary difference lies.
JSP is based on a simple concept, bring Java coding to the web. The same language and library that has made the Java programming language such a success has made available on the web. Of course, it does not include the entire thing. As a matter of fact, while the Java library is J2SE, the Web Development part is called J2EE. What makes it possible is a J2EE container, basically a web server that can be used to execute J2EE code. This includes Tomcat, and it's more elaborate, and modern-day alternative Glassfish. While JSP pages are analogous to PHP, Servlets are also a part of this package, and they are kind of a Java class that returns HTML code. Unfortunately, that's not a very elegant solution, and hence I found Servlets to be inappropriate. However, servlets can serve as controllers, that is, they can manage where a control goes from one page to another, so that you do not have to put that part in the JSP page.
Next come the various web frameworks available, like spring and Struts. They are based on an MVC framework, which you can find out more about on the wikipedia page. Such a framework can prove very useful for seperating the various layers of the project, ie. the business logic layer, application layer, and data layer. They provide some good facilities, though those were not the end aim of the project, so I decided to skip an MVC framework, or servlets. Now, another concept that differs from PHP is the use of tag libraries.
Now, a JSP page, much like a PHP page will contain both code, and HTML. In order to eliminate that, the tag library concept was invented. It is essentially a set of HTML like notation that can be used to implement code like functionality, without neccessarily coding. This helps to make the task of the webpage designer just to use tags, and not code. Of course, tag libraries are extendable too. There as also, JavaBeans and Enterprise JavaBeans (EJBs) which are standard ways to code classes so that it makes the task of coding for webpages easier. I wouldn't really go into the details of how.
Thus, designing a web application is very different for J2EE as compared to PHP. It does tend to break up work into many different parts, which augurs well for larger organizations. As I said, Glassfish is what makes it all possible. It is the reference implementation for the J2EE platform, which means that if you want to know how the J2EE standards should be implemented, this is where you need to look. It also uses Grizzly as the HTTP frontend, which is written in Java, and is thus integrated right into the application server. Finally the addition of clustering, the Metro stack for web services, and a JPA implementation ensure that there's plenty to look forward to with Glassfish, on top of Tomcat.
Of course, what has enabled the wide-spread popularity of PHP is the entire LAMP, WAMP or SAMP stack, that it is a part of. That refers to Linux, Apache, MySQL, PHP (or Python or Perl). This is the combination of an operating system, a web server, a database server, and the lanugage, which is actually the more readily substitutable part of the stack. MySQL, of course is the leading open-source database server, and amongst the most widely used ones worldwide. It supports a wide variety of techniques and is available on a large number of platforms. SQL, stored procedures, triggers, cursor
s, etc. are obviously supported. It also supports clustering using the shared-nothing scheme. Of course, the fact that is allows for different storage engines adds merit.
Thus, for my project, I used Glassfish, MySQL and also Netbeans, which helped to bring it all together. I used a simple scheme that utilized JavaBeans, and coded all the functionality in Java classes. However, I did not use Servlets, or an MVC framework. The JSP classes contained only minor pieces of code such as for loops and stuff. However, the way such efforts can benefit should be obvious from the unit tests that could be easily defined for the Java classes. All in all, a good learning experience.
Posted at 12:34AM Oct 23, 2008 by Aadhar Mittal in Sun | Comments[1]
OpenSolaris Install Fest
Hello everyone,
For some reason, this post was supposed to be on this blog a month ago, but I forgot all about it :) Anyways.
I recently conducted a Software Freedom Day Celebration at the Department of Computer Science, Delhi University. This consisted primarily of an OpenSolaris Install Fest. For the demo part of this event I used Virtualbox to install OpenSolaris on a windows machine.
Since the concept of virtualization itself would naturally stimulate the interests of young Computer Science students, I decided to make the first part of the presentation about Virtualization. Of course, the complex topic that it is, I tried to take it step-by step, and introduce it only to the level of detail that was appropriate for the installation that was being demonstrated.
Then I proceeded with the demo, which consisted of installation of Virtualbox, and it's usage; and the installation of OpenSolaris itself. All this was done on the laptop of a volunteer. (Remember, this was an install fest, so there were other machines available :) While the installation was going on, I introduced the various features of OpenSolaris that make is the most advanced operating system in the world. The installation completed with a demo of the working of the operating system.
The other people installing the same simultaneously ran into some minor troubles. (like inserting the wrong disk :D ) The session ended with a briefing about SFD itself, and talks of OSUM and Sun club. I also distributed several OpenSolaris Starter kit DVDs as a part of the same. The 40 attendees left satisfied with the knowledge they had of Open Source Software, OpenSolaris, and virtualization, and of course, the installations on their machines.
Posted at 04:37PM Oct 16, 2008 by Aadhar Mittal in Sun | Comments[1]
First job, first task
Hey everyone
I'm Aadhar Mittal, part of the Sun Campus Ambassador program running at Sun Microsystems for the year 2008-2009. I'm from the Department of Computer Science, Delhi University, and am registered for the course of Master of Computer Applications program.
Actually, I'd started off with this blog elsewhere. Because of some mis-understanding on my part, the blog here wasn't created till today. But better late than never. Here, I might be able to posting about the first real task I undertook for the program.
Sun is the largest corporate contributor to the Open Source movement with reference to the number of lines of code contributed. I think that's the most obvious criteria, since measuring man-hours contributed would be non-trivial.
One of the tasks I have to do as a Campus Ambassador is to deliver talks in my department on topics related to open-source software and/or Sun. In order to start off, I chose the easiest topic I could think of, "Open Source : How we already use it". The reason I chose this topic is that the target audience consisted of first years, all of whom did not know what open-source software is. Also, the "How we already use it" part would help me demonstrate the use of open-source software that is already taking place. I also tried to build in basics like what is a database, how the Internet works. In very simple terms, of course.
I started off taking Orkut as an example. I know, I know, it's written in ASPX. No marks for pointing that out. But it fit the bill for my presentation perfectly. Indian Internet users log on to social networking sites extensively. I could talk about databases (think personal info), servers and stuff in an obvious and intuitive manner. Also, Google has open-sourced a part of Orkut, and it was the first to do so. And if that is not enough, just think of how people forgive the "sins" of Apple and Google just because of the fantastic user experience they provide, and use that as an excuse here :D
I also tried to tie in how things are done at our department with all of this. We use Java and C++ as the primary programming languages, and both GCC and Java are of course Open Source. Then come the projects and assignments which usually involve stuff like MySQL, JSP, Tomcat, Glassfish, and Netbeans. A couple of projects also had Solaris, and J2ME. All in all, I didn't have to work hard on that part.
I introduced the Java User Group for Delhi University and the Sun Club for the same. The Sun club was initiated by me, and isn't that active yet, but I'm sure it'll grow with time. I also tried to get a democratic approach to the sessions, but I'll blog about that some other time. (Effect from reading the book Maverick! by Ricardo Semler during that time). The first result of that was that my next session changed from Netbeans to an OpenSolaris session.
Well, there were pens distributed, and some refreshments were served. And yeah, the refreshments got late, so I talked about the Sun Academic Initiative and Certification impromptu. :D I had an audience of around 100. According to what I gathered, they were with me for the most part. Except maybe the institute projects part. Well, many of them were first years, so can't blame them.
Some points to improve upon:
It was pretty short. I generally tend to speak only 60% of what I intend to when I prepare for a presentation.
My speech can do without the pauses when I'm thinking of a word... Well, I'm not that good yet...
The impromptu part could've come without the former ambassador, Agraj prompting me :D
I should've presented the various business methods behind Open Source Software
Overall it went well enough.
Posted at 05:12AM Sep 26, 2008 by Aadhar Mittal in Sun | Comments[0]