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.

text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/xmng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1Note that Mozilla is making full use of the original conception of the Webin which the server and the client would negotiate to provide the userwith the best possible file in response to a request <strong>for</strong> an abstract URL.The order of the MIME types in the Accept header is irrelevant. Thebrowser indicates its preference with quality values, <strong>for</strong> example in thevalue text/html;q=0.9, Mozilla is indicating that plain vanillaHTML is less preferred than the three preceding XML types, whichdefault to a quality of 1.0. To learn more about this system, see thesection on "Quality Values" in the HTTP 1.1 specification, athttp://www.w3.org/Protocols/rfc2616/rfc2616.htmlA second method <strong>for</strong> distinguishing between desktop andmicrobrowsers is examining the User-Agent HTTP header.Consider the following two shell sessions, in which the user-typedinput is highlighted in bold:No Extra Headers% telnet www.google.com 80Trying 216.239.57.99...Connected to www.google.com.Escape character is '^]'.GET / HTTP/1.1HTTP/1.1 200 OKDate: Tue, 22 Apr 200301:20:53 GMTCache-control: privateContent-Type: text/htmlServer: GWS/2.0Content-length: 2691Google.........Connection closed by <strong>for</strong>eignhost.Claiming to be a Palm% telnet www.google.com 80Trying 216.239.57.99...Connected to www.google.com.Escape character is '^]'.GET / HTTP/1.1User-Agent: UPG1 UP/4.0(compatible; Blazer 1.0)HTTP/1.1 302 FoundDate: Tue, 22 Apr 200301:37:18 GMTLocation:http://www.google.com/palmContent-Type: text/htmlServer: GWS/2.0Content-length: 156302Moved302 MovedThe document has movedhere.Connection closed by <strong>for</strong>eign-- content_id is the primary key here; it is possible to-- have at most one row in this table <strong>for</strong> a row in the-- content_raw tablecreate table discussion_question_status (content_id not null primary keyreferences content_raw,status varchar(10)check (status in ('open', 'closed')),-- if the question is closed the next column will-- contain the content_id of the posting that closed itclosed_by references content_raw);-- make it fast to figure out whether a posting-- closed a questioncreate index discussion_question_status_by_closed_by ondiscussion_question_status(closed_by);As the community gains experience with this system it will probablyeventually want to give greater prominence to responses frommembers with a history of writing good answers. In a fully normalizeddata model the server would have to, <strong>for</strong> each answer displayed,count up the number of old answers from the author and query thediscussion_question_status table to figure out whatpercentage of those were marked as closing the question. In practiceyou'd probably want to maintain a denormalized metric as an extracolumn or columns in the users table, perhaps columns <strong>for</strong>n_answers_posted and n_answers_closing, counts maintainedby nightly batch updates or database triggers.Supporting the "initially show only to my mentor" option <strong>for</strong> newcontent would require the addition of a show_only_to_mentorcolumn to the content_raw table, where it could be used <strong>for</strong>discussion <strong>for</strong>um postings, comments on articles, and any othercontent item. Rather than changing all of the pages that use thecontent tables it would be easier to update the SQL views that thosetables use, e.g., articles_approved, so as to exclude contentthat should only be shown to a mentor.Some new page scripts would be required, at least the following:• /workspace -- a page or sidebar providing a logged-inmember with links to previously asked questions andpossibly other in<strong>for</strong>mation as well, e.g., new content sincelast visit, recent content by members previously marked as178171

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

Saved successfully!

Ooh no, something went wrong!