Dilip's WWW Programming Class Home Page

barman@cs.unc.edu

University of North Carolina
Department of Computer Science
Sitterson Hall, CB 3175
Chapel Hill, NC 27599

Visit my real home page for lots of good vegetarian and bicycling links.


Learning perl

Hello, World Execution Source Code
Assignment Specification Execution Source Code
Project Proposal Execution Source Code System Notes

perl is a somewhat arcane language that has been popular for writing cgi-bin scripts, especially before Java became popular. We're spending a bit under 1/3 of the class learning perl.

Just to understand how to create and run a perl program, I wrote a Hello, World program. It's useful to look at its source code, which I've tried to clearly document with inline comments, to understand how to structure and run perl programs from the UNC cgi-bin server. One unix file system trick to remember is to symbolically link - e.g., "ln -s my.pl.cgi my.pl" . If you try to follow a hypertext reference to a .cgi file, the semantics imply execution. The symbolic link creates a phantom .pl file that can be the target when one wants to look at source code.

By September 9, we had to suggest a suitable 2-week programming project. I originally came up with two proposals, one a web spider and the second a stock analysis routine and was planning on proceeding with the more fun and useful stock routine. However, I ran into technical difficulties so came up with another fun project, that of maintaining a database of music.

Our first programming assignment is due September 11 and has to meet the given specifications for computing compound interest. It was useful to look at our forms lesson to design the input form. I used Steven Brenner's library of Perl Routines to Manipulate CGI input to parse the input variables. I could use either GET (input saved in environment variables) or POST (input delivered as part of stdin) methods, and chose POST as input in the standard input stream makes more sense to me. The program can be run and its source code viewed.


Learning java

Hello, World Execution Source Code
Assignment: Events Specification Execution Source Code
Assignment: Layout Managers Specification Execution Source Code
Assignment: Animation Specification Execution Source Code-main class Source Code-AnimationObject class
Project Proposal Project Implementation

I wrote my first "Hello, world!" application on October 6, and then turned it into an applet. You can see the source code of the applet.

On October 16, I wrote my first homework assignment applet to try out events and UI. I am still getting the hang of the event model, but you can see the source code and its execution.

I found the second homework assignment to be challenging. We had to design an application allowing users to manipulate scrollbars and text fields to set the RGB color values that we depicted in a rectangular area. It was frustrating trying to get all of the Grid Bag Layout constraints set to result in a suitable layout and took several hours of experimenting. The event model is making a bit more sense to me now. It's fun to see applet running; the source code is also available, including that of the MyFrame class.

The third assignment was to do an animation, not necessarily like the sample, that uses double buffering. My code generates up to 10 (you can change a constant and recompile to have a different limit) objects, squares and circles with equal probability, and animates them in random colors. The source code for the main class and the class that generates the animation objects is available, as well as supporting classes that provide a closeable frame and debug window.

Finally, I contributed an animated arcade-style game to a Children's Games Suite java project. It was an extension of the third homework assignment and, though much of it was fun to do, I came to the conclusion that a java development environment is very important for any sizable java project.


Final Exam

We were given a final exam, focusing on java, the week of December 8 and were to do it as a take-home closed-notes exam due on December 13. You can see both the exam and my answers.


Other interesting links


About me: My unix finger information


Created 27 August 1997
Last updated 13 December 1997

-- Dilip

The Jump to Java Logo is a trademark or registered trademark of Sun Microsystems, Inc. in the U.S. and other countries.