Ruby and Rails programming problems


May 2007

html graph generator

  specs:
  • Ruby/Rails library
  • display a bar graph (horizontally or vertically)
  • allow an arbitrary number of data points and labels
  • require the user to specify a destination directory
  • allow the user to specify 'copy' or 'move'
  • adjusts each bar to that data point's percentage of the total
  bonus spec:
  • optionally display the each data point's percentage of the total
  • optionally display the each data point's value
  • optionally display the total of all data points

April 2007

backup script

  specs:
  • Ruby app
  • require the user to specify a source filename or directory
  • if the user specifies a source directory, create a tarball of the directory
  • require the user to specify a destination directory
  • allow the user to specify 'copy' or 'move'
  • perform the copy or move of the tarball (or file) to the destination directory
  bonus spec:
  • automatically add the current date to the tarball, if a tarball is created

March 2007

no assignment this month!

With our group's one year birthday celebration in March, we decided to skip the programming problem and eat cake at Flying Star Cafe!


February 2007

file encrypt/decrypt program

  specs:
  • Ruby app
  • allow the user to specify a filename
  • allow the user to specify the operation (encrypt or decrypt)
  • allow the user to specify a secret passphrase
  • read in the specified file
  • write the file’s contents to stdout (encrypted or decrypted)
  bonus specs!
  • allow the user to optionally specify a salt phrase
  • allow the user to optionally specify the security protocol (from among your supported protocols)

January 2007

ad-hoc query app

  specs:
  • Rails app
  • allow admin users to define named queries, specifying required criteria fields
  • allow non-admin users to select a query by its name

  •   app will present criteria fields required by the selected query
      user enters criteria and runs the query
      data returned is presented in a table
  bonus specs!
  • allow users to 'save' criteria for queries
  • allow users to define 'queues' of queries
  • allow users to run their query 'queues'

December 2006

message log server

  specs:
  • Ruby application
  • runs as a server (using a TCP socket, XML-RPC service or whatever you like)
  • messages can be text, a Ruby stack trace or whatever
  • with each incoming message, display the following:

      hostname of the caller
      date and time, nicely formatted
      message

  • build a client piece as a Ruby module
  • demonstrate calling the log server from a Rails app
  hey it’s the holidays, we have loads of bonus specs!
  • allow only specified hosts to connect and leave messages
  • write the messages to a database
  • email the messages to a predetermined email address
  • write a simple Rails app to view/clear the messages

November 2006

system monitor

  specs:
  • Rails application
  • display the local hostname
  • have links to the following reports...

      ps (process status)
      uptime (system uptime)
      users (list current users)
      df (free disk space)

  • for each link above, call the corresponding unix (or cygwin) program from Ruby and display the results, formatted nicely
  bonus spec:
  • allow the system to monitor remote machines

October 2006

photo website creator

  specs:
  • Ruby or Rails application
  • require the user to give the path to a directory of image files
  • let's say the directory structure looks something like this...

    My pics/

      New York City/
        Empire State building.jpg
        Lady Liberty.jpg
        Brooklyn Bridge.jpg
        Central Park.jpg

      Latest baby pictures/
        IMG_001.jpg
        IMG_002.jpg
        IMG_003.jpg
        ...
        IMG_024.jpg

      Santa Fe hike/
        Lost in the aspens.jpg
        Mountaintop clouds.jpg
        Best buddies!.jpg

      (for simplicity, only allow one level of sub-directories)

  • create a home page with a link to each 'thumbnail' page
  • in the example above, the home page would have three links, one link to each of the three thumbnail pages ('New York City', 'Latest baby pictures', 'Santa Fe hike')
  • create thumbnail images corresponding to each image file
  • create thumbnail pages that will display the thumbnail images for that sub-directory's image files
  • each thumbnail page contains a link back to the home page
  • each thumbnail will be a link to a page that contains the full size image that corresponds to that thumbnail
  • each full size image page contains a link back to the thumbnail page and a link back to the home page
  bonus specs:
  • jazz it up with some CSS
  • have the program create a zip file of the resulting website files
  hint: for thumbnail creation, look at ImageMagick and RMagick

September 2006

file upload/download app

  specs:
  • Ruby on Rails application
  • access to the website is controlled via a login page
  • allow users to upload files to the server
  • keep each user's files private - accessible only by that user
  • list all files that have been uploaded by the user
  • allow users to download their files
  bonus specs:
  • allow users to mark uploaded files as 'public'
  • allow any user to view and download 'public' files

August 2006

zip program

  specs:
  • zip all files in the specified directory (recursing the dir tree) to the specified zip filename
  bonus specs:
  • unzip an existing zip file
  • build a GUI that allows user selection of the files to zip (could be standalone GUI or Rails app)

July 2006

simple grep program

  specs:
  • search a text file for the specified criteria text
  • accept the file name and criteria text as command line arguments
  • display the line number(s) where the criteria text was found
  • display the line(s) of text within which the criteria text was found
  bonus specs:
  • support searching all files in a directory tree
  • allow specific files to be searched by providing a regular expression for the file name argument
  • allow criteria text argument to be a regular expression

June 2006

line count program

  specs:
  • count and display the number of 'lines of code' in a text file
  • count the number of 'comment lines' in the text file
  • display both the number of 'lines of code' and 'comment lines'
  • accept the file name to be analyzed as a command line argument
  bonus specs:
  • support analyzing all files in a directory tree with a display that includes file type counts, lines of code and comment counts
  • categorize file, line and comment counts by file extension