CSCI 4230
 Internet Application Development
 Summer 2001
 Homework #4

Due date:  July 11, 2001

(1)    Write a Perl program to use the image description file created in Homework #2 to populate the table ImageDescription(Id, filename, pathname, description) of your DSN.  The program should be called as populateImageTable.pl subdirectory image_desc_filename.  For example:

populateImageTable.pl gwtw2 image_desc.txt

The subdirectory a gwtw2 has the same contents as gwtw, as created in homework #2, except for the image description file image_desc.txt.

The image description file should be stored in the subdirectory.  The pathname field of the table will be set to the command line argument subdirectory.  The first line of the image description file image_desc.txt is not used.  The image description file stores one image description per line in the format of:

image_file_name::description

Your program should provide progress alert and some error handling capability.

Assume that the contents of image_desc_txt in gwtw2 is:

Gone with the wind
sadpc.jpg::scarlett looking at ashley and melly
shimmy.jpg::scarlett and cathleen walking up the stairs
abc.jgp::error: no such file
sadpc.jpg::error: duplicate file name
rhetscar.jpg::the atlanta escape
neverhungry.jpg::never hungry again
bonniescarlett.jpg::bonnie and scarlett
scarlettanddad.jpg::scarlett and gerald walking at tara
bbqdrs01.jpg::fiddle dee dee
pittypat.jpg::christmas leave
gwtw12.gif::scarlett and rhett in bedroom
happy.jpg::scarlett waiting for rhett
cukorvivselzhowhav.jpg::cast signing contracts
rhett4-r&belle.jpg::rhett and belle watling
gwtw18.gif::the first cocver for the book
rhetsca.jpg::clark and vivien publicity shot
afterbonnie.jpg::scarlett after bonnie was born
dscar.jpg::scarlett drinking after franks death
scarlett19-s&ashleybbq.jpg::the slap in the library
pascar.gif::scarlett and pa on the lawn of tara
greendress.jpg::greendress shadows
1gwtw05.gif::belle and melly
myfaveposter2.jpg::original gwtw poster
whitedress.gif::scarlett running to wait for pa
3_copyl.jpg::scarlett talking to her pa
scarlettandashley.jpg::scarlett and ashlet at mellie's death
leighpc.jpg::scarlett in muslin dress portrait
scarhet3.jpg::scarlett with her green bonnet from paris
vivlh7.jpg::scarlett and ashley in a scene that was deleted
scarlettwrhett.jpg::scarlett with rhett
gwtw21.gif::new book cover
scarmelmam.jpg::melly and mammy after bonnie is born
mellyscarlett.jpg::the birth of beau
fire.jpg::rhett and scarlett and the first kiss
stairsgt.gif::scarlett looking at the girls on the stairs
ashleyscarlett.jpg::scarlett and ashley
cryingscarlett.jpg::scarlett as a widow crying
scarrhett.jpg::scarlett and rhett in a deleted scene
scxarrhettfood.jpg::scarlett and rhett eating
1gwtw12.gif::scarlett and mely at her death
tomthecop.jpg::shanty town night
scarletturn.jpg::scarlett smiling picture
dreamscene.jpg::scarlett and rhett in the dream scene
flemingviv.jpg::fleming and vivien on the set
sunset.gif::scarlett and pa in sunset
kiss.jpg::the proposal
scarlett10-draperydress3.jpg::scarlett and mammy and the portiers
cryingviv.jpg::Scarlett crying
whitedress.jpg::scarlett bored
gwtw71.gif::portrait of scarlett
gwtw74.gif::the stairs scene
filmcover1960pc.jpg::famous gwtwt poster
bbqdresstill.jpg::bbq dress still
thefirstpicofgreendress.jpg::scarlett and tarleton twins at tara
reddresspc.jpg::scarlett in red dress
bluegfwt.gif::scarlett getting ready for the bbq
scarletthospitalescape.jpg::scarlett hospital escape set
scarlett14-mornafterstairs.jpg::scarlett the morning after the stairs scene
4_copyl.jpg::scarlett praying
lockdoor.jpg::no more babies
scarhett.jpg::scarlett and rhett at tara
selz.jpg::selznick with scarlett portrait
rhettmellie.jpg::rhett crying
mewlscarl.gif::melly and scarlett in atlanta
1gwtw7.gif::scarlett still picture
bazaar.gif::the bazaar in atlanta
handkisspc.jpg::scarlett and rhett on honeymoon

Note that description #3 and #4 have been added to test for error handling:

abc.jgp::error: no such file
sadpc.jpg::error: duplicate file name

Executing:

>populateImageTable.pl gwtw2 image_desc.txt

outputs:

File successfully open...
..
#3: File abc.jgp does not exist. Skipped.

#4: File name sadpc.jpg already inserted to the table. Skipped.
...............................................................
Number of file names inserted: 65.

Note that a '.' represents the successful insertion of one record.

(2)    Write a HTML/Javascript program to allow user to enter text.  When the user clicks a "Count Letter" button, the Javascript code counts the numbers of alphabet letters in the text (case insensitive) and show their occurrences.  The look and feel should be as close to below as possible.

Initial form:

After the following text is entered to the input text and the 'Count Letter' button' is clicked: