Sample Codes GUI for IDEA Project The sample codes provided here are provided by Francis Ng (upon request from Leong Hon Wai) for UIT2201 Intelligent Door Project.
This document and the
sample code has been revised recently (7-April-2003).
You may want to get a new copy to replace the old one you had.)
To get the sample program (all in one place), download
source3.zip. Then, follow the instructions
of Hong Ee (found in the forum page). After unzipping the files
there the permission modes of the files should be like
this.
Also, to compile your Java programs, please also use the
correct Java CLASSPATH as described here.
Download Instructions:
This is a sample FrontEnd GUI designed by Francis Ng (upon request from Leong Hon Wai) for UIT2201 Intelligent Door Project. It serve to as sample programs as well as to illustrate that the various components of our Intelligent Door can be independently developed. This is given as a FrontEnd GUI that can be accessed at
http://www-cgi.comp.nus.edu.sg:8000/~nghoongk/frontend.html(You need to be inside NUS or SoC's domain to be able to view.)
In this FrontEnd GUI, we want to illustrate the use of forms+cgi (in frontend.html) and how it communicates with a controller on the server.
At the moment, the sample Controller does the following simple task:
Some of the Software Feature Implementation teams will need to access the database -- for that they will need to interface with the Oracle Database designed by SDA3:DBMS. Thus, the sample programs (in Java and Perl) have been revised to include a part that will interface with the Oracle database to do query, get the results and process them. More on this in DB section. (Note: The one for C/C++ has not been revised.)
Remarks on Integration:
As discussed earlier, once we have the controller skeleton up (SDA1 Team), each one of you can download a copy and put into your own public_cgi sub-dir. Then, you can do your own independent testing of your executables on your copy of IDEA. Please do careful testing to make sure it is correct.
After that, you should email a copy of the source and executables to the SDA1 group -- who will then "install" your executables into the IDEA project account --- uit2201p.
% source /opt/oracle/bin/oraenv % sqlplus then login with userid and passwordto get you into a very primitive Unix interface to Oracle. From here, you can type in various sql commands. Some of the useful ones I learnt from Francis are:
> select table_name from user_tables; {lists out all the tables in the account} > select * from names; {list all entries in table names} > insert into names (userid,username) values (3,'leonghw'); {insert an entry into the table}Of course, you can also use other SQL clients to access the database. For more information, please see
The SDA3 Team will be responsible for designing the tables in the database and for publishing the schema for these tables, and also populating the tables with records. They may need help from some of the Feature Implementation people...
At the moment, there is a sample table called "Names" with schema {userid,username} and very few records. When I did a query, I got the following:
>select * from names USERID USERNAME ---------- -------------------- 1 Samantha 2 Michael 3 leonghw
A Note for the Feature Implementation People:
Since most of the people doing Feature Implementation are familiar with Java, we have provided Java sample program (CheckName.java) to interface with Oracle and doing query. Each of you will need to first establish an Oracle connection via the dbManager (a custom class written for this project). Then, it does an sql query "select * from names", then "catches" the output, and checks the name is in it.
(Of course, to list all entries in the table, you can just also just print out the output is caught. You can use this CheckName.java as a sample to play around with it using other sql queries.)
After receiving the output from the IDEAFeatureEngine programs, the controller parses the results and then calls the appropriate GUI-generation programs to generate the correct GUI (html page).
In this sample, we provide two mechanisms to do this: