Chapter Resources

Each chapter section here contains homework exercises, references, and additional links for demos and information for each chapter in the book - Distributed Systems: Architecture and Implementation.


Chapter 1 - Introduction

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. The Eight Fallacies of Distributed Computing
  2. Putty and Bitvise SSH Client
  3. CyberDuck
  4. WinSCP

Additional Links

  1. Common Unix Commands
  2. FTP vs. SCP
  3. Sample file for ch1 homework
  4. Changing your gl prompt (optional)

Notes

  1. Check that you have your web directory (swe2017) activated. Go to http://swe.umbc.edu/~username and if you see a web page or a web directory browse, you are ok. If not, you need to activate your web directory by running this script.

Ch1 Exercise

Any time an exercise anywhere in the book asks you to put information into a file with a .txt extension, it must be a plain text file. Never use a word processor format. The bold item in the list of homework exercises always indicates what must be turned in for that homework assignment. Ask any questions on the blackboard forum.

  1. Do the following step-wise tasks:
    1. Login to your gl account using SSH to home.
    2. Navigate to your swe2017 directory and stay there for the exercise.
    3. Create two text files named f1.txt and f2.txt and place some text in each using pico.
    4. Get the meta.html file from my gl account and save it in your swe2017.
    5. Rename the meta.html file to f3.html.
    6. Move the f1.txt file to your home directory and display a listing that shows it there.
    7. Display the f2.txt file on the screen.
    8. Change the permissions on the f2.txt so that group has write rights. Show that the rights are changed using a long listing.
    9. Copy the text transcript of all these tasks from the terminal screen and save it is a file called f4.txt in your swe2017 directory.
    10. Display the f4.txt file one page at a time on the screen.
    11. Use a web browser to look at f3.html and f4.txt.
  2. Use SCP to copy a text or html file from your client machine to your swe2017 directory. Look at that file in a web browser.

Chapter 2 - The Evolution of Distributed Systems

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. None.

Additional Links

  1. W3Schools - This tutorial will be used throughout the book for reference on web technologies. This home page has links on the left for each topic. The following tutorials are referenced in chapter 2.
  2. Reference for xmllint.
  3. On-line validator for DTDs.
  4. The shiporder.xml file.
  5. The shiporder.dtd file.

Ch2 Exercise (ex1)

Ch2 Homework (hw1)

  1. Review the material for XML Basic and for DTD at http://w3schools.com. These are short readings that complement the discussion here in the book.
  2. Create a well-formed resume in XML for yourself or a fictional person. It should be very short but include tags for name, address, phone number, qualifications, at least three jobs, and at least 2 previous educational achievements. Save it as resume.xml and transfer it to your gl account in www. Note:
  3. Now make a DTD for a valid resume. Instead of using an external DTD as we did above, use an internal DTD and add it to your resume.xml file using pico. An example of an internal DTD is at w3schools. Note:
  4. Validate your resume.xml file using xmllint on gl. Note:
  5. There are also on-line validators from web pages. Use http://www.cogsci.ed.ac.uk/~richard/xml-check.html to validate your resume. Be sure and check the validate checkbox! Otherwise, it only does a well-formedness check.
  6. Go to the w3schools page on XHTML and read the section on validation (in XML Basic). View the source for that very page and note that it has the declaration for the XHTML DTD.

Chapter 3 - Web Technologies

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. The W3C.

Additional Links

  1. W3Schools - The following tutorials are referenced in chapter 3.
  2. Object-Oriented PHP Tutorial and read only the following 3 sections:
  3. JavaScript Demo
  4. PHP Demo
  5. CSV File for PHP Demo
  6. Source File for PHP Demo

Ch3 Exercise (ex2)

Ch3 Homework (hw2)

  1. We want to see the http headers for a simple web page, such as http://userpages.umbc.edu/~jianwu/is651/programs/ch3/test.html, using curl -v command. Seperate the request and response message of the returned text into two text files. Note the URL to your two text files on gl.
  2. JQuery and XMLHTTPRequest exercise - Go to the w3schools.com site for Learn JQuery. Peruse the basic JQuery tutorial. Your goal is not to memorize, but to see how it works. Under the JQuery Get Started section, note that at the bottom of the page, it tells you how to include the JQuery library as a online link - use that method. Go to the JQuery Load section and implement the first Ajax example for JQuery load(). Copy the code on gl and change it to load a text file with your name in it. Be sure to use a different .txt file contents that includes your name in your gl account. Note how easy this makes an Ajax call. Note the URL to your HTML file.
  3. CGI exercise - We will just implement a simple CGI program using Perl. You will just copy my program and implement it in your account. CGI libraries offer sophisticated integration with a programming language. Go to http://userpages.umbc.edu/~jianwu/is651/programs/ch3/colors4.html and choose a color and submit. See how the results work and view the returned HTML source. You can just replace the .cgi extension with .txt to see the commented source code. Also your cgi file on gl has to be executable. Replace 'Gold' with a different color and implement these 2 files in your gl account. You can see all color names and codes in the w3schools HTML tutorial. Note the URL and CGI text URL to your HTML file.
  4. PHP exercise 1 - Go to the w3schools PHP Form Handling tutorial for PHP Forms. Implement the HTML and PHP files in your gl account for its first example. You need to change the 2 fields first - do not use name and email. Note the URL to your HTML file.
  5. PHP exercise 2 - Implement the procedural example from the object-oriented php tutorial above on gl. Then add a function with 2 parameters to add a lastname to a person as in this output. See also php associative arrays. Note the URLs to your php file and a text version so I can see the php code.
  6. Create an HTML Table of Contents (toc) on gl. A toc here is simply a list of 6 links in HTML. Submit the single url to your toc on blackboard.

Chapter 4 - SOAP

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. SOAP at W3C.
  2. XMLSchema at W3C.
  3. XMLSchema for SOAP 1.1

Additional Links

  1. W3Schools - The following tutorials are referenced in chapter 4.
  2. The shiporder.xml file with XMLSchema, but no namespace.
  3. The shiporder2.xml file with XMLSchema and namespace.
  4. XMLme Web Services. Choose 'Web Services' and then choose 'Shakespeare...More...'.
  5. Modification of the Shakespeare example at UMBC.
  6. Online XML Validator - XSD (XML Schema).

Ch4 Exercise (ex3)

Ch4 Homework (hw3)

  1. Recreate your resume XML document as valid using XMLSchema. This means that you will use the same resume, but swap out the DTD for a reference to the new external schema file. You need to use a namespace that you can create using your own gl account URL, just as I did in the chapter example. This will require 2 files – resume.xml and resume.xsd.
  2. Validate your new resume using xmllint. Look at the man page to verify your syntax as having this form: xmllint --noout --schema note.xsd note.xml. Unlike xmllint output for DTDs, the output for schemas is: note.xml validates for the example above. Copy the xmllint command and output from the terminal screen and put it in a file called xmllint.txt.
  3. Use the validator to validate your resume at both xmllint and an online validator. Be sure that the validation succeeds for your namespace. Put that complete output in a text file called xsv.txt.
  4. Take a look at the above XMLSchema for SOAP. Remember that for standard schemas, you can use the namespace URL. Also remember that since schemas consist of all tags, you will have to view the source to actually see it. Find the XML subtree that defines the Body tag and uses the ##any wildcard. Copy just that complex type to a text file called any.txt.
  5. I have programmed a similar kind of program as in figure 4.6 using PHP. The difference is that the ASP at xmlme.com is replaced with PHP on gl. This PHP shows you details at a lower level (obviously, you would not want to give this to a real user!). You will be programming this kind of thing yourself on gl in chapter 9. Go to the following URL and and enter a line. You will see some PHP response detail and the actual request and response SOAP messages - examine them closely. Copy the request and response SOAP to a file soap.txt.
  6. Create an HTML TOC on gl for these chapter 4 homework tasks. It should show an ordered list where links 1-5 go to the files created in task 1-5. Put the single url to this TOC in the Blackboard assignment submission area.

Chapter 5 - WSDL

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. WSDL at W3C.
  2. XSLT at W3C.

Additional Links

  1. W3Schools - The following tutorials are referenced in chapter 5.
  2. WSDL for the Shakespeare web service.
  3. SoapUI: A popular REST & SOAP Testing Tool.
  4. For-each XSLT example (Use 'View Page Source' option to see source code), The cd.xsl file
  5. Apply-Templates XSLT example (Use 'View Page Source' option to see source code), The cd2.xsl file

Ch5 Exercise (ex4)

Ch5 Homework (hw4)

  1. Create an XSLT stylesheet for your XML resume that uses a client-side transform to display your resume using an HTML table. You should use the resume validated by the XMLSchema for practice with namespaces.
  2. Create an HTML TOC on gl for the hw from chapter 5 with the 1 link below (the toc will also include the links for chapter6 hw below).
    1. XML resume file (that calls the XSLT)

Chapter 6 - WS-*

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. OASIS.
  2. WS-Addressing at W3C.
  3. RSS 2.0 Specification.
  4. Atom Specification.

Additional Links

  1. W3Schools - The following tutorials are referenced in chapter 6.
  2. DocBook.
  3. DocBook Book (see chapter 2).
  4. XSL StyleSheets (download docbook-xsl-1.76.1.zip under docbook-xsl).
  5. Saxon (download the Saxon 6.5.5 zip version) - this is the java-based processor (it is an older version but ok for us). You only need the saxon.jar file, so you can unzip it on your pc and then just upload that file to gl or unzip it on gl and delete the extra files.

Ch6 Exercise

Ch6 Homework (hw4)

  1. Do this exercise with SAXON:
  2. Create an HTML TOC on gl with links for b-d above. Submit the single URL in the submission area on Blackboard. Your final HTML TOC will have 4 links (a-d), including the first one from chapter 5 above.

Chapter 7 - REST

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. Fielding Dissertation (2000).
  2. JSON.
  3. CURL.
  4. JQuery.
  5. Building Web Services the REST Way
  6. RESTful Web services: The basics

Additional Links

  1. W3Schools - The following tutorials are referenced in chapter 7.
  2. JSON demo.
  3. Guardian/JQuery example. The referenced PHP file is also saved with .txt so you can see the code.
  4. Flickr API.
  5. We will use the Flickr REST API to build a url to their photo service. This will require that you register on Flickr and get an API key. This is free, quick, easy, and typical of the REST services out there. All the information of what to do is in the documentation on the Flickr site, but you may find this tutorial or this one useful also.

Ch7 Exercise (ex5)

Ch7 Homework (hw5)

  1. Implement the Guardian example from this chapter with a different query. You need to use 2 additional variables from the guardian JSON. You will end up with one url to submit, but you need to create the guardian.php for the application to call on gl using ajax. You now need an api-key for this as explained in the slides. Note that the jquery calls the php which uses curl to call the api to avoid cross-domain problems.
  2. We will use the Flickr REST API to build a url to their photo service. Create the following URLs:
    1. Create a REST query for getHotList from the Flickr API documentation. You can see the REST url work from my gl account:
      =>curl -X GET 'https://api.flickr.com/services/rest/?method=flickr.tags.getHotList&format=rest&period=day&count=10&api_key=your_api_key'
      
      <?xml version="1.0" encoding="utf-8" ?>
      <rsp stat="ok">
      <hottags period="day" count="10">
      
      <tag score="100">feb23</tag>
      <tag score="97">whitenight</tag>
      <tag score="95">whitenightmelbourne</tag>
      <tag score="94">farligt</tag>
      <tag score="93">avstand</tag>
      <tag score="92">facedowntuesday</tag>
      <tag score="90">encuentros</tag>
      <tag score="90">whenigrowup</tag>
      <tag score="90">dp3merrill</tag>
      <tag score="90">whitenightmelb</tag>
      </hottags>
      </rsp>
              
      Or you could put the url directly in the browser address box.
    2. Create a REST query to search for all photos with a certain tag. You can choose the tag. Limit the results to 10 photos.
    3. Create a REST query to search for all public photos by a certain user reported in your last query.
    4. Create a REST query to search for the geo-location of a photo by a user reported in your last query. You can do a query for a different user if your previous one had no geo-locations - just be sure to find one that does.
    5. You will now have 4 urls.
  3. Create an HTML TOC on gl. It should include 5 items from tasks above. The first link is for the guardian app and use the actual Flickr REST URL for the 4 Flickr urls. Submit the single URL to your TOC in the submission area on Blackboard.

Chapter 8 - Distributed Systems Basics

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. Caching Tutorial.
  2. Iterative and Recursive DNS Queries.
  3. IETF (maintains the DNS specification).
  4. OpenAFS.
  5. Websocket.org.
  6. SAXON The XSLT and XQuery Processor - We will use the Saxon-HE.

Additional Links

  1. W3Schools - XQuery Tutorial (Also review XPath there).
  2. Good overview single threading for Node.js.

Notes

Ch8 Exercise (ex6)

Ch8 Homework (hw6)

  1. Read and study the XQuery Tutorial section.
  2. Download and install the Saxon processor. You can delete your old saxon.jar file from your account to save space. You need to download the zip file for Java for Saxon-HE 9.4 (or 9.5) from SourceForge (e.g. SaxonHE9-5-1-10J.zip). You will unzip it and you only need the saxon9he.jar file on gl. Also read the documentation under Using XQuery - Running XQuery from the Command Line.
  3. Implement all the XQuery examples for the W3Schools bookstore example in your gl account. First modify the given books.xml file to have 5 addtional books for a total of 9 books. Create a transcript of all these examples working and put them in a text file. This is how your transcript should look. See this note on the data function. Here are the 8 examples repeated from the W3Schools reading:
    1. doc("books.xml")/bookstore/book/title
    2. doc("books.xml")/bookstore/book[price<30]
    3. doc("books.xml")/bookstore/book[price>30]/title
    4. for $x in doc("books.xml")/bookstore/book where $x/price>30 return $x/title
    5. for $x in doc("books.xml")/bookstore/book where $x/price>30 order by $x/title return $x/title
    6. <ul> { for $x in doc("books.xml")/bookstore/book/title order by $x return <li>{$x}</li> } </ul>
    7. <ul> { for $x in doc("books.xml")/bookstore/book/title order by $x return <li>{data($x)}</li> } </ul>
    8. for $x in doc("books.xml")/bookstore/book return if ($x/@category="CHILDREN")
      then <child>{data($x/title)}</child> else <adult>{data($x/title)}</adult>
  4. Write an xquery that transforms the cdcatalog.xml from W3Schools to: Then redo examples e-h above using the new cdcatalog.xml file with appropriate changes to the XQuery to match the new cdcatalog so that it makes sense. Save a transcript of the transform and the 4 examples working on the command-line. Be sure and cat each file you are calling before you call it so I can see the source code - there is an example in the above sample transcript. The new xml should look like this.
  5. Submit the 2 links (#3,4) for hw6 on blackboard.

Chapter 9 - Web Frameworks

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. Design Patterns book by Gamma et al.
  2. SVG at W3C.

Additional Links

  1. CodeIgniter.
  2. Download CodeIgniter link - get old version 1.7.3.
  3. Demo scripts to download CodeIgniter on gl.
  4. unzip command.
  5. Webadmin for MySQL - web-based GUI.
  6. Example SVG image.
  7. PHP db reference that uses php4.
  8. First 'Hello World' CodeIgniter Video. See and implement this before doing the blog.
  9. Resume modification of first video in a gl account.
  10. Resume modification of first video with phone function.
  11. Second 'Create a Blog in 20 Minutes' CodeIgniter Video

Notes for CodeIgniter on gl

  1. Be sure and read these notes about the gl environment before doing work with CI. Since we cannot change the configuration of the web server, we must live with some gl defaults. If we had control, we could fix all this, but we do not.
  2. You must use the front controller 'index.php?' in all URLs (not 'index.php' as in the video). So a valid URL would be: http://swe.umbc.edu/~username/ci/index.php?/resume. Also, we cannot use .htaccess to get rid of the front controller because the apache rewrite module is not active on gl.
  3. Edit the config.php file for: $config['base_url'] = "http://swe.umbc.edu/~username/ci/"; and $config['index_page'] = "index.php?";
    Note that you will use your username and whatever you called your codeigniter directory.
  4. You will use the web tool to create db tables that is similar but differs from the one in the video. Use: https://mysql-admin.umbc.edu/phpMyAdmin. For server choice, choose studentdb-maria.gl.umbc.edu. There is no default id like in the video, so you create it. Make sure it is specified as the primary key using the first radio button on the right and is auto_increment using the drop-down.
  5. Remember that both your db name and username are your umbc username and you should change the password. The easiest way is to use the mysqladmin web app GUI.
  6. Since we are using a previous version of CI (version 1.7.3), there is a minor change from the video. The autoload.php entry is named 'libraries' (not 'core') as: $autoload['libraries'] = array('database');
  7. The hostname for database.php setting: $db['default']['hostname'] = "studentdb-maria.gl";

Ch9 Exercise (ex7)

Ch9 Homework (hw7)

  1. Implement the Blog application from the second CI video tutorial 'Create a Blog in 20 Minutes' on gl. Note the URL for your Blog. Be sure and check out the UMBC environment notes in the on-line syllabus for chapter 9.
  2. Create an SVG file that contains a circle, a rectangle, and a line, each with a different color. Be sure to ditch the DTD and use the namespace. Save your SVG file on gl. Use your .svg file in an HTML file using the embed tag. Note the URL for your HTML file.
  3. Create an HTML TOC with links to both URLs. Submit the single URL for the TOC in the submission area on Blackboard.

Chapter 10 - SOAP Revisited

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. NuSoap.
  2. C14n at W3C (Canonicalization.)
  3. Creating Web Services with PHP and SOAP. This is just another example very similar to the one in the chapter.

Additional Links

  1. Shakespeare Example from the lecture.
  2. cdStore simple example from the lecture.
  3. Modified ProductList. This is a modified version of the example in reference#3 implemented on gl.
  4. cdStore Refactoring Video Tutorial for hw8.

Ch10 Exercise (ex8)

Ch10 Homework (hw8)

  1. Create a NuSOAP catalog server similar to the one in this chapter but using different products. Test it with a similar hard-coded PHP client that includes display of the the request and response SOAP. Hard-coded means that the client passes a static request. Note the URL to this client.
  2. Refactor the simple SOAP web service from the chapter to solve 4 problems:
    1. The client should not be hardcoded.
    2. The 3 arrays should be consolidated into 1 array and moved to a separate file.
    3. The web service should return an invoice in either html or json.
    4. A new web service function should return the catalog as an html table.
    A complete video tutorial on this refactoring shows how to use the given sample files at swe.umbc.edu (I also list given sample files at userpages.umbc.edu for your reference). Note the url to your working v2 application on gl. Be sure to redundantly save each .php file as .txt so I can see the source code.
  3. Create an HTML TOC with links to the 2 URLs from task 1 and 2. All php files should be redundantly named with .txt so I can see the source code. Submit the single URL to this TOC into the submission area on Blackboard.

Chapter 11 - REST Revisited

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

IMPORTANT - This has been updated to remove the Flickr exercises due to API changes.

References

  1. Magpie.
  2. PATCH.
  3. OmDb.
  4. Rolling Stone RSS.

Additional Links

Notes

  1. If you ever have trouble with curl on the command line, place your url inside single quotes and try it again.
  2. Remember that the REST application is a live application. Do not go drunk and crazy and mess up my application database. If you want to play with mine, then create a new record, edit that record, and finally delete it.

Ch11 Exercise (ex9)

Ch11 Homework (hw9)

  1. Do the final mashup demo from the book. Limit the output to 10 entries. Note the URL to your working mashup.
  2. We will implement a correct REST API for a simple model. We will not use codeigniter, but create our own rest api from scratch using php. The exact instructions for this item are inside the source code of the starter (the second last link from Additional Links).
  3. Create a HTML TOC with 4 links (#2 requires 3 URLs). Submit the single URL to your TOC in the submission area on Blackboard.

Chapter 12 - Semantic Web

Exercise and Homework

Homework due by Monday, following the class noted on the syllabus schedule.

References

  1. Scientific American article by Berners-Lee et al. (2001).
  2. RDF at W3C.
  3. RDF Primer at W3C.
  4. RDFS at W3C.
  5. OWL at W3C.
  6. SPARQL at W3C.

Additional Links

  1. Original discussion on Linked Data
  2. foaf:
  3. Sparql Endpoints:
  4. SPARQL Examples
  5. DbPedia.
  6. Mondial.
  7. RDF to SVG web service.
  8. An OWL example for wine.

Ch12 Exercise (ex10)

Ch12 Homework (hw10)

  1. Go to the MONDIAL database at: http://www.dbis.informatik.uni- goettingen.de/Mondial/. See the section: MONDIAL in RDF. This database provides information on the statistics, history, people, government, economy, geography, communications, transportation, military, and transnational issues for world entities such as countries. Try the example SPARQL query using the an 'open' SPARQL endpoint. Note that you will have to change the example query to access the RDF/N3 files on the web (not a file). For instance, 'from <file:mondial-meta.n3>' should be changed to 'from <http://www.dbis.informatik.uni-goettingen.de/Mondial/Mondial-RDF/mondial-meta.n3>'. The metadata file is an OWL ontology and the other europe file is data. Save the resulting XML file of country codes as mondial1.xml (a) on gl. Take look at the europe file and see the structure. Make your own SPARQL query that shows 3 columns, one for the code that is the same as the last query, one for the real name of the country, and one for population number for all countries with population > 10000000 (so only countries with the specified population requirement will show up). Save the resulting XML file mondial2.xml (b) and the sparql query as mondial3.txt (c) on gl.
    Example first row in html format:
    code name pop
    http://www.semwebtech.org/mondial/10/country/B/ "Belgium" 11099554
  2. Create an HTML TOC for chapter 12. It should have 3 links as a, b, c. Submit the single URL to your TOC in the submission area on Blackboard.