13.07.2015 Views

Software Engineering for Internet Applications - Student Community

Software Engineering for Internet Applications - Student Community

Software Engineering for Internet Applications - Student Community

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

when there is an educational dimension, i.e., when the moreexperienced users are helping the novices improve theirskills.CompressionWhen storing in<strong>for</strong>mation in digital <strong>for</strong>m, it is often possiblereduce the amount of space required by exploiting regularpatterns in the data. For example, documents written inEnglish frequently contain "the". A compression systemmight notice this fact and represent the complete word "the"(24 bits) with a shorter code. A picture containing yourfriend's face plus a lot of blue sky could be compressed ifthe upper region were described as "a lot of blue sky". Allpopular Web image, video, and sound <strong>for</strong>mats incorporatecompression.Content RepositoryInstead of having one SQL table <strong>for</strong> every different kind ofcontent on a site, e.g., articles, comments, news, questions,answers, it is possible to define a single content repositorytable that is flexible enough to store all of these in oneplace. This approach to data modeling makes it simpler toper<strong>for</strong>m queries such as "show me all the new stuff sinceyesterday" or "show me all the content contributed by User#37". With a content repository it is also easier to programand en<strong>for</strong>ce consistent site-wide policies regardingapproval, editing, and administration of content.CookieThe Cookie protocol allows a Web application toconveniently maintain a "session" with a particular user. TheWeb server sends the client a "magic cookie" (piece ofin<strong>for</strong>mation) that the client is required to return onsubsequent requests. The original specification is athttp://home.netscape.com/newsref/std/cookie_spec.html.Data ModelA data model is the structure in which a computer programstores persistent in<strong>for</strong>mation. In a relational database, datamodels are built from tables. Within a table, in<strong>for</strong>mation isstored in homogeneous columns, e.g., a column namedregistration_date would contain in<strong>for</strong>mation only of typedate. A data model is interesting because it shows whatkinds of in<strong>for</strong>mation a computer application can process. Forexample, if there is no place in the data model <strong>for</strong> theprogram to store the IP address from which content wasposted, the publisher will never be able to automaticallydelete all content that came from the IP address of aspammer.DNSHints: you'll want to deliver your script and any template file, ifapplicable, with a MIME type of "text/plain". This way the receivingbrowser won't try to render the HTML source. Some Web browsersare super aggressive and try to render anything that looks like HTML,even if it comes through without the text/html MIME type. Analternative approach that works with such browsers is to quote all ofyour HTML by replacing < with &lt;, > with &gt;, and & with &amp;,then wrap source code in a tag.Exercise 4: Servers that query <strong>for</strong>eign serversUsing the Web browser running on your local machine, visit the URLhttp://philip.greenspun.com/WealthClock. Read the discussion of thisprogram in Chapter 10 of Philip and Alex's Guide to Web Publishing.Drawing upon that program as a model, build a new Web applicationthat takes the ISBN of a book from a <strong>for</strong>m and queries several onlinebookstores to find price and stock in<strong>for</strong>mation. The results should bedisplayed in an HTML table (price and in stock/out of stock at eachstore). Make your service available at /basics/books (the entry <strong>for</strong>m)and /basics/books-2 (the results page).We suggest querying barnesandnoble.com andwww.1bookstreet.com. Your program should be robust to timeouts,errors at the <strong>for</strong>eign sites, and network problems. In other words, inno situation should your user ever get a "Server Error 500" page. Toensure this you'll have to learn about exception handling in yourchosen language. In Java, <strong>for</strong> example, you'll want to use try andcatch. Test your program with the following ISBNs: 0062514792,0140260404, 0679762906, 1588750019.Try adding more bookstores, but you may have trouble getting themto work. For example, amazon.com and wordsworth.com tend torespond with a 302 redirect if the client doesn't give them a sessionID in the query.Extra credit: Which of the preceding books states that "The obviousmathematical breakthrough would be development of an easy way tofactor large prime numbers"?Exercise 5: Talking to the RDBMSIt turns out that it takes less time to learn the basics of SQL than itdoes to figure out how to deliver an SQL command to your RDBMS.These instructions are <strong>for</strong> Oracle. Refer to your supplement if you'reusing another RDBMS.31633

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!