Web Development in Racket - Chris G and Aman K

Required Reading

1) http://untyped.com/files/icfp068-welsh.pdf

2) http://docs.racket-lang.org/continue/index.html

Reading Questions

  1. How is HTML handled in racket? How do we represent it?

  2. Convert the following into RACKET lists:

    1. <p> This is really cool </p>

    2. <a href=”link.html”> I am a link </a>

    3. <div id=”container”><p> I contain <h1><b> THINGS ></b</h1> </p></div>

  3. Which function is called when our code runs on the web server?

  4. How do get data from incoming requests?

  5. What is the ‘send/suspend/dispatch’ function do? Why is it needed?

  6. Where is the “#:mutable” clause put? What is its purpose?

  7. How do we link other files such as CSS files to our application?

  8. What is the use of the “#:prefab” clause?

  9. What might using Racket over Java, Python, or Ruby be a good choice for web development?

  10. What libraries were created to create web applications, and what do they do?

  11. Can you guess as to why the two were written as separate libraries?

  12. What does the Racket web server do?

  13. What does query-list do?

  14. Line by line, describe what blog-insert-post does. What do the question marks mean?

  15. Why is format and ~a not used?

  16. Why is models.rkt a separate file instead of all in one?

Lecture Notes

Screencast: http://www.youtube.com/watch?v=KdVU50T0HAc&feature=youtu.be

In class exercise: Finish the tutorial on http://docs.racket-lang.org/continue/index.html

SQL in Racket Lecture notes: https://dl.dropbox.com/s/sgnzys0o74y44ey/Databases%20in%20Racket.pptx?dl=1

Homework assignment

  • Aman's homework: Create a to-do list application. The application should:

    • Pull to-dos from a SQL database.

    • A to-do should have a title, due-date and a priority.

    • Have fun with some css (not required however)

  • Chris' homework: Create a rudimentary Twitter application. The application should:

    1. Pull “tweets” from a SQL database of pre-generated tweets and show in a list, similar to Twitter

    2. Allow a user to post tweets along with their name

    3. The name should be read as “Tweeted by __________” with a different styling than the other text

Quiz Questions

  1. Write an application which shows “Hello World” on the browser in bold format and also has a title of “Hello World”?

  2. Describe the basic format of a racket application.

  3. How do you handle multiple requests for the start function? Why is this a problem?

  4. What does query-exec do?

  5. Use the sample code on the Racket documentation tutorial (http://docs.racket-lang.org/continue/#(part._.Using_an_.S.Q.L_database)) to create a blog, but add a field for “author”.

  6. Create the intialize function in the models for an application that stores order information on a shopping site. Include anything table columns that you might think are relevant. Initialize the database with a sample entry.

Answers

http://dl.dropbox.com/u/23196483/answers.pdf