Week 9 Slides

June 4th, 2009

Here you go! All 11 slides!

week N slides

May 27th, 2009

Week-6.pdf

Homework for Week 6, 7, 8, and 9

May 14th, 2009

For week 6, 7, 8, and 9, everyone should work on their approved projects. Each week (Friday night by midnight) please email Ryan and I with either a repository where we can find your project or a zip/gem of your project.

We would also like you to write a little about what you accomplished each week, along with something new that you learned while working on your project.

We will be grading you on your productivity (how much you’ve accomplished during the week), tests, code cleanliness, and the ever illusive goal of doing the simplest thing possible to get the job done.

Slides for week 6

May 13th, 2009

Here are your slides for week 6.

Yay! Slides!

Week 5 Homework

May 6th, 2009

2 HTTP Servers (really basic HTTP 0.9/GET only):

  • gserver for thread spawning per connection
  • tcpserver w/ prespawned thread pool

requirements:

  • craft your own request / response objects
  • servelets of your own design. start with time of the day app.
  • static files from the filesystem.
  • html files served plain
  • html.erb files should render via erb.
  • no caching, no clever.

Bare minimum HTTP protocol:

  • request:

GET /index.html HTTP/1.0 CRLF
CRLF

  • response:

HTTP/1.1 200 OK CRLF
Date: Thu, 07 May 2009 01:06:01 GMT CRLF
Last-Modified: Mon, 19 Jan 2009 23:02:19 GMT CRLF
Content-Length: 3750 CRLF
Content-Type: text/html CRLF
CRLF
...content...

  • other responses are:
  • 304 redirected
  • 404 missing
  • 500 app error

2 Chat Servers:

drb-based centralized chat server & client

  • port 31337
  • multiple users, nick
  • multiple channels
  • join/leave
  • no protocol otherwise
  • client does no authentication, just connects.
  • server announces connection, etc.
  • protocol is objects, not text.

multicast plaintext chat server/client (distributed `wall`)

  • port 7387
  • broadcast text to others.
  • print all text you see.
  • zero protocol

General Requirements:

  • must be TDD. start with direct objects, no network.
  • check your manifest before you package or I’ll dock you w/o mercy.

Week 5 Slides

May 6th, 2009

week-5.pdf

HELLO! HERE IS YOUR WEEK 4 HOMEWORK

April 29th, 2009

Your week four homework is two parts. The first part is making your week 3 homework use threads. Make the tasks in your week 3 homework run in parallel. Make sure to synchronize when appropriate.

The second part is writing an apache log processor. For this project you will:

  • Provide a commandline tool that safely modifies files
  • Change IP Address at the beginning of the line in an Apache logfile
  • Must be multithreaded
  • Must maintain log order
  • Cache name lookups across invocations
  • Age the cache items (expire lookups)
  • Commandline option to limit number of threads (you should determine a sensible default)
  • Look at “resolv” for DNS lookups
  • This homework can be completed using only tools from ruby’s standard library

The file format will look like this:

208.77.188.166 - - [29/Apr/2009:16:07:38 -0700] "GET / HTTP/1.1" 200 1342
75.119.201.189 - - [29/Apr/2009:16:07:44 -0700] "GET /favicon.ico HTTP/1.1" 200 1406
75.146.57.34 - - [29/Apr/2009:16:08:38 -0700] "GET / HTTP/1.1" 304 -
75.119.201.189 - - [29/Apr/2009:16:09:53 -0700] "GET / HTTP/1.1" 200 1340
208.77.188.166 - - [29/Apr/2009:16:11:51 -0700] "GET / HTTP/1.1" 304 -
75.146.57.34 - - [29/Apr/2009:16:12:00 -0700] "GET / HTTP/1.1" 304 -
75.119.201.189 - - [29/Apr/2009:16:13:15 -0700] "GET / HTTP/1.1" 304 -
208.77.188.166 - - [29/Apr/2009:16:13:15 -0700] "GET / HTTP/1.1" 304 -
75.119.201.189 - - [29/Apr/2009:16:13:17 -0700] "GET / HTTP/1.1" 304 -
75.146.57.34 - - [29/Apr/2009:16:13:50 -0700] "GET / HTTP/1.1" 200 1294
75.146.57.34 - - [29/Apr/2009:16:13:55 -0700] "GET /stylesheets/main.css?1240264242 HTTP/1.1" 200 2968
74.125.67.100 - - [29/Apr/2009:16:13:55 -0700] "GET /stylesheets/home.css?1240264242 HTTP/1.1" 200 7829

We want the file to end up looking like this:

example.com - - [29/Apr/2009:16:07:38 -0700] "GET / HTTP/1.1" 200 1342
example.com - - [29/Apr/2009:16:07:44 -0700] "GET /favicon.ico HTTP/1.1" 200 1406
example.com - - [29/Apr/2009:16:08:38 -0700] "GET / HTTP/1.1" 304 -
example.com - - [29/Apr/2009:16:09:53 -0700] "GET / HTTP/1.1" 200 1340
example.com - - [29/Apr/2009:16:11:51 -0700] "GET / HTTP/1.1" 304 -
example.com - - [29/Apr/2009:16:12:00 -0700] "GET / HTTP/1.1" 304 -
example.com - - [29/Apr/2009:16:13:15 -0700] "GET / HTTP/1.1" 304 -
example.com - - [29/Apr/2009:16:13:15 -0700] "GET / HTTP/1.1" 304 -
example.com - - [29/Apr/2009:16:13:17 -0700] "GET / HTTP/1.1" 304 -
example.com - - [29/Apr/2009:16:13:50 -0700] "GET / HTTP/1.1" 200 1294
example.com - - [29/Apr/2009:16:13:55 -0700] "GET /stylesheets/main.css?1240264242 HTTP/1.1" 200 2968
example.com - - [29/Apr/2009:16:13:55 -0700] "GET /stylesheets/home.css?1240264242 HTTP/1.1" 200 7829

These domain names aren’t correct, but your output format should be similar.

Here is an example session using the command line tool you will write for your homework:

$ apache_lookup my_logs.log

After execution you should be able to examine my_logs.log and see that the ip addresses have been replaced with domain names. You should also be able to do this:

$ apache_lookup -t 100 my_logs.log
The above execution should spawn 100 threads to process your logfile.

This homework MUST be test driven. We will dock points for non-test driven code. You MUST turn your homework in as a tar.gz or as a gem. Remember to email the mailing list, use IRC, start early, test all the time, and have fun!

Week 4 Slides

April 29th, 2009

Hello everyone, here are your week 4 slides.

YOUR WEEK 3 HOMEWORK!

April 22nd, 2009

This week, your homework will be to write a program similar to Rake. Your program must deal with tasks and dependencies.

Here are the Phase 1 requirements:

  • tasks - take a block and can execute it
    • run outputs task execution including nesting of dependencies
    • tasks are executed via tests/code. cmdline interface extra credit.
  • dependencies amongst tasks - deps must run first
    • dependencies are intellegently run, they won’t re-execute if met.
    • declaration order doesn’t matter - aka resolve dependencies late.
    • architect this so it can be made multithreaded later
  • This will be TDD from the ground up with good coverage.

Here is an example task recipe w/ the basic public API needed:

require 'worker_bee'

WorkerBee.recipe do work :sammich, :meat, :bread do puts "** sammich!" end

work :meat, :clean do puts "** meat" end

work :bread, :clean do puts "** bread" end

work :clean do puts "** cleaning!" end end

WorkerBee.run :sammich

Executing this should output:

running sammich
  running meat
    running clean
** cleaning!
** meat
  running bread
    not running clean - already met depnedency
** bread
** sammich!

When building your project use “sow”. Just execute:

$ sow WorkerBee

Fill out the project with tests, and make it go.

WEEK 3 SLIDES

April 22nd, 2009

HEY EVERYONE GUESS WHAT? HERE ARE YOUR WEEK 3 SLIDES, THAT’S WHAT!

HAPPY WEEK 3!