Archive for the ‘Uncategorized’ Category

Week 5 Sample Code

Thursday, April 24th, 2008

Hey everyone, I’ve attached the week 5 examples here. Enjoy!

Week 4 Extra Credit Test

Thursday, April 17th, 2008

Hey everyone! If you’d like to do the extra credit problem, here is a test that you can use to benchmark your solution:

  require 'digest/md5'
  require 'test/unit'
  def test_encode_alac_speed
    in_filename = 'test/data/3db65f4f0e1b01a3307c3c2c2ddedbb7.wav'
    out_filename = 'test/data/out.raw'
    assert_equal('3db65f4f0e1b01a3307c3c2c2ddedbb7',
      Digest::MD5.hexdigest(File.read(in_filename))
    )
    File.open(in_filename, 'rb') { |file|
      File.open(out_filename, 'wb') { |outf|
        while data = file.read(4096 * 2 * 2)
          outf.write(Week4.encode_alac(data))
        end
      }
    }
    assert_equal('62047625a959a52469e81a90d852329e',
                 Digest::MD5.hexdigest(File.read(out_filename)))
  end

You’ll need to drop this file in to the test/data directory. But watch out, the file is 29MB. It took about 64 seconds to process on my machine. The extra credit is to make the encode_alac method faster, and to make the method work with Ruby 1.9. There will be a prize for the fastest implementation as well as a prize for a Ruby 1.9 implementation.

I will also come up with a solution and throw it in to the mix. Good luck, and have fun!

More Detailed Topic Overview

Saturday, April 5th, 2008

Here is a more detailed list of the topics that we’ll be discussing. I hope to cover all of these topics before the class is over. We may cover more material depending on how fast the class goes. Please leave comments or email me about things you’d like to discuss but don’t see in the list!

Metaprogramming

  • Open Classes
  • Singleton Methods
  • eval_*, define_method
  • DSLs
  • include, extend
  • method_missing
  • inherity
  • const_missing
  • method_added
  • singleton_method_added

Concurrency

  • Threading
  • Forking
  • Locking
  • Timeouts
  • Interprocess Communication
  • Multiprocess Synchronization
  • Producer-Consumer

Network Programming

  • Sockets
  • net/(http,smtp,ftp)
  • Distributed Ruby

Patterns in Ruby

  • Template
  • Adapter
  • Factory
  • Decorator
  • Observer

Alternate Ruby Implementations

  • JRuby
  • Ruby 1.9
  • Rubinius

Packaging and Extending Ruby

  • Building Ruby gems
  • hoe
  • sow
  • Ruby Inline
  • Traditional Extensions
  • Extending with Java
  • Publishing Gems

Class Books

Tuesday, April 1st, 2008

All of these books are recommended but not necessarily required.  If you have the Pickaxe, you probably won’t need the Ruby Way, and vice-versa.