Showing newest posts with label homework. Show older posts
Showing newest posts with label homework. Show older posts

Wednesday, April 15, 2009

App Engine Hello Jose!

For this, our final homework, all you need to do is implement and deploy a simple google app engine application. The application needs to do two simple things:

  1. When someone visits http://yourwebsite.appspot.com they should see your name.
  2. When someone visits http://yourwebsite.appspot.com/bye they should see "Good bye".

Wednesday, March 25, 2009

GradeBook Web Application

For your next homework you will develop a grading sheet application. It will be an application that lets the user (which is the teacher of a class) enter the names and contact information for the students in the class and then assign grades for them to each of several tests. The application will calculate averages and plot grade distribution. You application will use jquery, the google visualization api and gears. This homework is due on Monday, April 13 at 10am. The specific requirements are as follows:

  1. The whole application is to reside on one HTML page. All updates are to be done by JavaScript (we will not be using Ajax to back up to the server).
  2. The user should be able to enter any number of students. For each student you will store:

    1. Name
    2. email
    3. An arbitrary set of other URLs (facebook page, twitter page, blog, etc.). This could be empty.
    4. The grade for each test (the class only has tests).
  3. The user should be able to add any number of tests. The user will give each test a name.
  4. After a test is added the user will be able to add the grade that each student received on that test.
  5. Your JavaScript code will calculate and display the average grade for each test, as well as the average for each student. Assume all tests are equally weighted.
  6. For each test you will also show a grade distribution graph. This is a bar chart. The x-axis is the numbers 0,5,10,..95. The y-axis are the number of students that received a grade in the range 0-5,5-10,...,95-100 for each point in the x-axis. These graphs are updated automatically as the user enters new grades.
  7. You will use the gears database to store all this data locally, so when the user quits and re-starts the browser the grades that he entered before will appear again.

The interface for this application should be an editable table, like a spreadsheet, where the user can click on a cell and directly edit that cell. The photo in this post should give you an idea of how the user interface should look. The blue text describes the functionality of some of the elements in the page

You can either implement this using an HTML table, or using the google visualization Table element. I think using the google Table will be easier.

Monday, March 2, 2009

Spring Break Homework: Ajaxify This

Yes, would you like to buy a book?

Your next homework is a bit more involved than usual. You will be building an Ajax front-end to a php+mysql backend that I have provided for you. There are two steps to this process. First you must download and install the php code and the initial database. We will do this step in class, together. The second step is the homework part where you use your new-found jQuery skills to Ajaxify the web 1.0 setup I provide. This homework is due Monday, 16 March at 9am.

Install PHP and Mysql database

The first step is to install the php code and the database. To do this you must follow these steps.

  1. Check to make sure there is a new web directory under your home directory. If there isn't, talk to me.
  2. On Friday I sent you an email with a list of usernames and urls. The urls look like http://web2.cse.sc.edu where instead of 2 you will have another number. In all the following instructions replace the 2 in web2 with your own website number. Find your username in the email and load that url in your browser (this will only work from within USC). The page you see should look like:
    Click on php example and you should see a "Hello World"
  3. Download php.tar.gz and place it on your web directory.
  4. On the comand line do:
    cd ~/web
    tar xfz php.tar.gz
    
    This will place all the files in your php directory. You can now
    cd web
    ls
    
    to see the new files.
  5. We will now install the data into your mysql database. To do this you will first need to go to https://www.cse.sc.edu, login with your Unix username and password, then click on Personal Homepage then click on CGI/PHP/JSP/MYSQL? then click on the link to change your Mysql password. Change your password from the default to something else, but remember the new password!
  6. Back on the command line type (but replace web2 with your own web server and the word 'yourusername' with your username):
    mysql -h web2.cse.sc.edu yourusername -u yourusername -p
    It will ask you for the password you just set. Enter it. You should now be logged in to your mysql server. Hit control-D to log out and go back to the command line.
  7. I have provided you with a simple database of books in the file table.sql. To load this data onto your mysql server type:
    mysql -h web2.cse.sc.edu yourusername -u yourusername -p < table.sql
    You will need to enter your password again. To make sure it works type
    mysql> show tables;
    at the mysql prompt. It should show you that there is now one table called 'books'. To view the contents of this table type:
    mysql> select * from books;
    If you see a lot of book titles and other stuff scrolling by then you now have the book data in the database.
  8. Open the file config.php in a text editor and change your website, username and password. The file should look like
    <?
    $link = mysql_connect('web2.cse.sc.edu', 'yourusername', 'yourmysqlpassword');
    if (!$link) {
        die('Not connected : ' . mysql_error());
    }
    
    if (! mysql_select_db('yourusername') ) {
        die ('Can\'t use yourusername : ' . mysql_error());
    }
    ?>
    
    Again, change web2.cse.sc.edu to your own website.
  9. You should now be able to visit the url http://web2.cse.sc.edu/php/list.php and get an html table containing all the books in the database. Notice that there is also an edit and a delete button. Feel free to use these to edit the books (the exact books in the database won't matter for this homework). Also notice that there is a new.php which you can use to add new books to the database. What you have now is a basic CRUD interface to the books table in the mysql database. Basically, you can now Create, Read, Update (edit) and Delete books from the database using a web interface. Neat! Make sure you play with this website a bit before moving on: try to figure out how it works.

Ajaxifying the Book Application

For your homework you will turn the crude web 1.0 website I have given you into a shiny new web 2.0 website. Specifically, your new website will consist of only one page of html and all the CRUD functions will be implemented using Ajax (use the jQuery library for this).

Notice first that there is get.php file also included. This script takes as input any one of the arguments title, author, year, isbn, publisher, and rating, with a string value. It then returns a JSON object with the books that match that query. For example, try loading the url http://web2.cse.sc.edu/php/get.php?author=bi. You will get back a JSON object with all the books whose author contains the substring 'bi'. This is the function that you will use to retrieve data back from the server. You will alse need to use the other php scripts (edit.php, delete.php, new.php) to change data on the database.

Your one webpage will look like this (but much prettier, of course):

Id
TitleAuthorYearIsbnPublisherRating
The boxes contain the search critera for the user: the keywords the user wants to search. If he types 'bi' in the author field then, when he clicks away from the box or hits the enter key, a table will popup up below this table containing all the books that match the author=bi search. If the user fills in more than one box simply ignore all but one of the boxes (that is, assume he won't do that).

I also want the list of books you show the user to be editable in place. That is, the information for each book should be displayed as regular text to the user (not in a text box), but if the user clicks on one, say the title of one of the books, then text gets replaced by a text box that contains the title and the user can edit the title. When the user clicks away or hits return you will commit these changes to your database.

Finally, you will implement a little notification area that tells the user when each of the XHR requests has completed. Or, if a request is taking too long then you will display an error message, cancel that request, and launch another identical request.

To turn it in just

cd ~/web
tar cfz php.tar.gz php
then email me the resulting php.tar.gz. Also, email me the URL to your working website.

Monday, February 23, 2009

Brain Age Homework

We will continue working on the Brain Age exercise on Wednesday and the code will be due on Monday, March2 @9am. Note that you do not need to draw the lines between the boxes. You only need to keep track of the last box the user clicked on, and keep the timer going.

Wednesday, February 18, 2009

Second JavaScript Homework

For your next JavaScript you will finish the closures exercise and turn it in by Monday, 23 February @9am.

Wednesday, February 11, 2009

JavaScript Homework

For our first JavaScript homework you will need to finish the four JavaScript exercise questions. This homework is due by Monday, 16 Feb, at 9am. During class on Monday we will start doing more complex JavaScript exercises.

Oh, and, one tip: I find it useful to have a printed JavaScript quick reference card so I can quickly look up the various functions that the language provides.

Monday, January 26, 2009

State Farmer's Market Website

Columbia has a great farmer's market, next to the stadium, which does not have a website. We have been contacted by Jessica Wyndham who has asked us if we could put together a simple website for the state farmer's market. She says that we should use as inspiration the Portland farmer's market website (of course, you do not want to copy their code, just browse it for ideas). So, our first homework you will deliver a website that

  1. is fully validated,
  2. has separated content (XHTML) from presentation (CSS),
  3. CSS classes should have good names,
  4. and uses a consistent, user-friendly, and pleasant presentation.

The final project is due Monday, Feb. 9 at 9am.

The requirements are the website should have the tabs, subtabs, and text shown below. For the pages for which we have no text either make up something or write "coming soon". The tabs your web site should have are:

  1. Home: Use "Intro" and "Entrance" Rendering
  2. About the Market (General Info, Map, News)
    • Heading for General Info

      The new South Carolina State Farmers Market will be a state of the art facility that provides the agricultural community of South Carolina with a one of a kind venue in which to showcase South Carolina products. The proposed site in Lexington County is located on U.S. Hwy. 321 and is within 1.5 miles of both I-77 and I-26, with over 2,500 feet of frontage on I-26. The new market design is based upon a clearly defined plan that provides separate and distinct areas for the major wholesale vendors, the retail sale of South Carolina agricultural products, with a section specifically designed for this purpose, and also a farmers' shed section, which will be owned and operated by SCDA and will provide an environment for South Carolina farmers to rent space on a daily or seasonal basis in order to offer their products.

      Each section of the new market is designed to serve a particular purpose and will provide the agricultural community of South Carolina with a venue that is second to none. The Retail/Agribusiness section is designed to be user/pedestrian friendly with 10 foot sidewalks, convenient onsite parking adjacent to each building, and a low country design offering 12 foot wraparound porches and heavy landscaping. This entire section is designed to be pedestrian/customer friendly so that families will be comfortable visiting the market.

      The inclusion of an exhibition kitchen to be operated by SCDA, a dedicated children~s play area, school bus drop off area, and a small amphitheater (400 seats +/-) will also provide additional amenities within the market which will assist in drawing traffic to the market. This will benefit the retail vendors and South Carolina Farmers renting space within the Farmers Shed Section of the market. Some folks may question why an amphitheater would be desirable as part of the State Farmers Market. The answer is quite simple; it provides a venue for festivals, outdoor entertainment, and other activities that are all part of the overall theme for this market.

      SCDA will relocate their current Laboratory facilities, as well as create a new conference center and construct Farmers' Sheds, which will be built, owned and operated by SCDA for the benefit of South Carolina Farmers.

      Insert renderings of the market

    • Map
    • News
  3. Directions/ Hours (Directions, Hours)
    • Heading for Directions, Hours
  4. Events and Calendar (Events, Calendar)
    • Heading for Events, Calendar
  5. Product Availability (Product List, Seasonal Calendar)
    • Heading for Product List, Seasonal Calendar
  6. Exhibition Kitchen (Schedule, About, Cooking Classes)
  7. Restaurant (About, Menu, Hours/ Directions)
  8. Newsletter (Current, Archives)
  9. Fresh Ideas (Fresh Finds, Fresh Recipes):
    • Create a link from home page with "Fresh Finds".

      Use the photo of the Leek for our "Fresh Find" and say

      The leek is a vegetable similar in appearance to a large green onion. It reaches maturity in the autumn months. The edible portions of the leek are the white, onion-like base and the light green portions of the stalk. The core is tender and may be eaten, but gets woody as the leek ages. The taste is similar to that of a mild scallion. When raw, it is crunchy and firm in texture.

      An easy way to clean the leek is to cut it into rounds and submerge in a bowl of water. Discard the rooted end. Swish so the grit falls out of the layers and down into the water. You can then retrieve the clean leeks from the top of the water. Leeks can be used in several ways, including boiling, frying and raw. Check out our "Fresh Recipe" for a delicious way to use this veggie!

    • Fresh Recipes: Create a link from home page with "Fresh Recipes" Logo. Include this recipe:

      Leek and Potato Soup

      Ingredients

      • 1 pound leeks (4-5 leeks), cleaned and dark green sections removed,
      • 3 tablespoons butter
      • 3 potatoes, peeled and diced
      • 1 quart vegetable broth
      • 1 cup whole milk
      • 1 cup cream
      • 1/2 teaspoon pepper
      • chives to garnish
      • (Cheddar cheese and bacon-optional garnish)

      Directions

      Chop the leeks into small pieces.

      Melt butter in saucepan over medium heat. Add the leeks and a heavy pinch of salt and saute for 5 minutes. Drop heat to medium-low and cook until the leeks are tender, approximately 25 minutes, stirring occasionally.

      Add the potatoes and the vegetable broth, increase the heat to medium-high, and bring to a boil. Reduce the heat to low, cover, and gently simmer until the potatoes are soft, approximately 45 minutes.

      Turn off the heat and puree the mixture with an immersion blender (or in standard blender or food processor) until smooth. Stir in the heavy cream, buttermilk and pepper. Taste and adjust seasoning if desired. Sprinkle with chives (and cheese and bacon, if desired) and serve while hot.


  10. Kids Corner (Classes, Activities, Fun)
    • Logo for Kids Corner, heading for Classes, Activities, Fun
  11. Vendors (List by Name, List by Product, Vendor Resources)
    • Headings for List by Name, List by Product, Vendor Resources
  12. Links
    • Heading for Links
  13. Contact Us

You should use the logo and some the other images that have been provided to us.

Tips

  1. First build a skeleton html file that implents the look of your website. All your pages should just change the content (English text) of this file.
  2. Feel free to use Server Side Includes if you want.

Turing it In

You must both zip the complete directory and email it to me, as well as placing all the files on your public_html and sending me the link to that live version.