Friday, May 01, 2009

Last year I posted a Ruby script that parsed the NFL schedule on ESPN.com and output it in CSV format. I recently got a request for a 2009 version and since it was just a matter of re-running the script here it is! :)

2009_nfl_schedule.csv (11.52 KB) Enjoy!
Friday, May 01, 2009 5:29:50 PM (Eastern Daylight Time, UTC-04:00) | Comments [3] | #
Thursday, September 11, 2008
I quick break from the silence here on this blog to make a quick request for donations for Team Eichert at the 2008 Buddy Walk! :)

Hey All,

It's that time of year again!  The 2008 Buddy Walk is on October 5th, 2008 at Villanova University.  Christin, McKayla, Steven John, Keegan, and I will be attending the walk with our family and friends and would love to have you join us...or if you can't join us we'd LOVE to have you support Team Eichert with a donation! 

As I believe everyone on this list already knows, my son Steven John has Down Syndrome.   Steven John will be 5 on December 7th of this year.  He's my best friend and I think he's the coolest kid in the world.  Steven is doing really great and would love to see you at this year's Buddy Walk!

The Buddy Walk is an event that benefits the Trisomy 21 Center (http://www.tri21center.org/) at Children's Hospital of Philadelphia.  The Trisomy 21 Program at CHOP supports individuals with Trisomy 21, or Down syndrome, and their families and healthcare teams by providing educational material, healthcare collaboration and a comprehensive review of developmental, behavioral, educational, psycho-social and medical issues prevalent in individuals with Trisomy 21.

If you would like to join us for the walk you can go to the following URL and click the "Join Team" link that is in the grey header next to "Team Eichert". 

http://giving.chop.edu/goto/teameichert

If you can't join us for the walk but would like to make a donation you can do so by clicking the following URL and click the "Make a gift" link on the right hand side of the screen next to the thermometer looking thing. :)

http://giving.chop.edu/goto/teameichert

We look forward to seeing many of you at this years Buddy Walk, and we really appreciate any donation you might be able to make! 

Much Love,
The Eichert's
- Steve, Christin, McKayla, Steven John, and Keegan

Friday, September 12, 2008 3:12:27 AM (Eastern Daylight Time, UTC-04:00) | Comments [0] | #
Thursday, July 24, 2008
It seems as though I've been forced out of my blogging retirement by Alex.

How old were you when you first started programming?
When I was in 9th grade I took an elective computer programming course.  So I was whatever age a 9th grader is.

How did you get started in programming?
As stated above I took a computer programming course in 9th grade.  It was fun, and made me think in ways that I thought were interesting.  I took the course through my high school years but never got too serious.  When I went to college I picked a computer related major since it seemed to be where all the cool kids were headed.  Or more accurately, where all the people who wanted to make decent money upon graduation were headed.

What was your first language?
My memory is terrible.  I think we had some high tech Apple Classic's in our computer lab and we were using Apple Pascal, or maybe it was Basic.  I forget, but it was kickass!

What was the first real program you wrote?
I remember creating a blackjack game in that first computer programming course.  It had a pretty killer GUI!

On the more "real" side, I think one of the first real programs I wrote was a content management / tv scheduling system for CN8 (www.cn8.tv).  It was one of the first projects I worked on after graduating, and was written in *classic* ASP!  I hear some people actually still have ASP applications that they're porting to .NET, not sure what they've been doing for the last 6 years since .NET came out but hey I'm getting off topic.

What languages have you used since you started programming?
This depends greatly upon what "used" means.

Basic, C, COBOL, Visual Basic (all varieties), Java, Javascript, Python, Ruby, C#, SQL (T/PL)

What was your first professional programming gig?

I worked at a web consulting company named Image Refinery Productions (later renamed to Refinery).  I did a lot of web programming, specifically content management systems, document management, intranets, and other custom business applications.  I had the joy of working with *classic* ASP early on, along with some Visual Basic sprinkled in.  Once .NET rolled around I quickly grabbed a hold of it and didn't let go.

If you knew then what you know now, would you have started programming?
Definitely.  I would have taken some different courses in college and would have majored in Computer Science instead of Computer Information Systems (CIS) but I'd definitely go down the programming route again.

If there is one thing you learned along the way that you would tell new developers, what would it be?

The biggest problems in the software development world have to do with people, not technologies.  Learn how to work with people, understand the people who you are building software for, and create software that helps them kick ass.  Let the technology fade into the background.  Learn new technologies, don't be scared to leave your comfort zone.  Finally, if you don't love being a programmer/developer find something you do love. 

What's the most fun you've ever had ... programming?
Hrm, very tough question.  I've had lots of fun over the years.  I'll think about it and get back to you.

I'll tag:
Aaron Feng
Brian Donahue
Sam Gentile
Kyle Burton
Jonathan Tran
Toby DiPasquale
Friday, July 25, 2008 2:43:18 AM (Eastern Daylight Time, UTC-04:00) | Comments [0] | #
Saturday, June 28, 2008
For the last week Twitter has been mostly unusable.  While it's been possible to "tweet" it hasn't been possible to view replies, and now you can't see "older" posts.  While twitter hasn't become a staple in my life yet, I can see with some recent changes in my life me relying on it, or something similar, for communicating with others.  Twitter has proven time and time again that it isn't up to the challenge of being a service that we can rely on for much of anything.  I've given some other services a try to see what might be able to take the place of twitter, and I'm starting to form an opinion on what I think may be our best path forward.

I've developed a 6 step plan for removing twitter from our lives.

Step 1: Sign up for friendfeed, and add all the online services you use to your account
Step 2: Sign up for tumblr (or some other microblogging service) where you can post the things you normally post to twitter.  Another option would be to just use the "share something" feature of friendfeed for what you normally use twitter for.
Step 3: Take advantage of all the other services friendfeed supports and use those services for what they're good at.  For links use delicious or magnolia, for photos use flickr or smugmug, in short use the services that you like the most and use friendfeed as the central hub where you can view everything you and your friends are doing online.   
Step 4: Use friendfeed for viewing your "friends" activity stream, and allow it to become the central place that you communicate with your "friends".
Step 5: If you've become reliant on desktop client for interacting with twitter, download twirl or AlertThingy and set it up with your friendfeed account.
Step 6: Enjoy life without twitter

Sound good?

Saturday, June 28, 2008 5:29:38 PM (Eastern Daylight Time, UTC-04:00) | Comments [1] |  | #
Friday, May 23, 2008
I have a small fantasy football related project that I'm going to be working on that requires access to the full 2008 NFL Schedule.  I decided to use Hpricot, and scrape the schedule from ESPN.  The CSV file I created with the output from the below script can be found here: nfl-schedule.csv (11.48 KB)  

Download script (parse_schedule.rb)

#!ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'

class Game
   attr_accessor :date, :week, :away_team, :home_team, :time

   def to_s
      "#{@date} #{@time} #{@away_team} at #{@home_team}"
   end

   def to_csv
      "#{@week},#{@date.gsub(",", "")},#{@time},#{@away_team},#{@home_team}"
   end
end

def parse_games(doc)
   games = []
   doc.search("//table[@class='tablehead']//tr").each do |tr|
      @week = tr.search("/td/a").inner_html if(tr[:class] == 'stathead')
      @date = tr.at("td").inner_html if(tr[:class] == 'colhead')

      teams = []
      tr.at("td").search("a").each do |team|
         teams << team.inner_html
      end

      if(teams.size == 2)
         @time = tr.search("td:eq(1)").inner_html
         game = Game.new()
         game.date = @date
         game.week = @week
         game.time = @time
         game.away_team = teams[0]
         game.home_team = teams[1]
         games << game
      end
   end
   games
end

games = parse_games(Hpricot(open("http://sports.espn.go.com/nfl/schedule")))
games.each do |g|
   puts g.to_csv
end
puts "Total games: #{games.size}"
Saturday, May 24, 2008 12:35:58 AM (Eastern Daylight Time, UTC-04:00) | Comments [10] | #
Monday, May 19, 2008
Have you ever been shamboozled by the WinForms designer in Visual Studio?  If you haven't, its likely only because you've never used it.  Over the last several years I've had many wars with the WinForms designer, and unfortunately I've lost every single time. 

Not long ago as I was exploring a couple interesting open source ruby projects, I came across one that had me longing for something as simple in the .NET world.  The project was shoes, done by none other then why the lucky stiff.  For those unfamiliar with shoes, it's website describes it as:
Shoes is a very informal graphics and windowing toolkit. It's for making regular old apps that run on Windows, Mac OS X and Linux. It's a blend of my favorite things from the Web, some Ruby style, and a sprinkling of cross-platform widgets.
To give you an idea of how simple shoes makes creating the simplest of GUI's checkout the following code:
Shoes.app {
button("Press Me") { alert("You pressed me") }
}
To give you a little more background, shoes uses a ruby "dsl" for describing the layout of desktop GUI, and under the covers is implemented in C.  Although I wasn't sure how far I could get, I decided to "implement" shoes using IronRuby for my philly code camp presentation.  My goal was to keep the same ruby syntax for declaring the layout and controls that make up the screen,  however, instead of using the backend implementation of shoes I wanted to write my own implementation in IronRuby by leveraging the interop capabilities between IronRuby and Windows Forms.  After hacking on it for a few hours a couple nights last week, as well as doing a little more this past weekend I've been able to get enough of shoes replicated in IronRuby to create some reasonable apps.  Let's start with a simple "Hello Iron Shoes" example. 
require "shoes"
Shoes.app :width => 450, :height => 400, :title => "Hello!" do
banner "Hello Iron Shoes"
end

We start with a require statement that includes the shoes.rb file that implements the shoes "dsl".  Every shoes app starts with a call to Shoes.app that takes a hash of options.  In this example we specify the width and height of the form as well as a title.  We then pass a block that contains a simple banner "Hello Iron Shoes" statement.  Within shoes, all layout and nesting is done via Ruby blocks.  So everything within the do...end block of Shoes.app is added as content to the form.  When we run the above using IronRuby we get the following result.

What's you might find particularly interesting is that since Mono just recently completed their implementation of Windows Forms, and since IronRuby is open source we get the same cross platform support from our IronRuby implementation as we get with the real shoes.  We can also add a bit of user interaction by using an edit_line and button like so:

require "shoes"
Shoes.app :width => 200, :height => 200, :title => "Hello!" do
@input = edit_line
button("Say Hello") { alert("Hello #{@input.text}")}
end


Finally to see some of the other controls that are supported checkout this very beautifully designed form:

The code for this beauty is as follows:
require "shoes"
Shoes.app :width => 800, :height => 600, :title => "IronShoes everything sample" do
flow :width => 800, :height => 600 do
stack :width => 300, :height => 600 do
link "CLICK ME" do; alert "HEY"; end
link "GOOGLE", :click => "http://google.com"
image "shoes-logo.png", :click => "http://code.whytheluckystiff.net/shoes/"
@e = edit_line
banner "Hello Iron Shoes"
para "This is shoes...", strong("and another"), em("and a final one")
button "Foo" do
alert("Hello Foo")
end
button "Bar" do
alert("Hello Bar")
end
button "Get Textbox Value" do
alert(@e.text)
end
edit_box :width => 200, :height => 100
end
    stack :width => 400, :height => 600 do
  banner "Banner"
title "Title"
subtitle "Subtitle"
tagline "Tagline"
caption "Caption"
para "This is some more text"
image "rails.png"
para "Jimmy kissed", strong("Margaret"),
"and I've saved a picture somewhere on",
link("Flickr", :click => "http://flickr.com")
end
end
end

To checkout the code for my IronRuby implementation of shoes you can download the zip file containing my demos from my Code Camp presentation.

Overall, the experience of creating a basic implementation of shoes with IronRuby was very enjoyable.  While I did run into some problems, for the most part things went very smoothly.  I created a basic calculator, a very ugly friendfeed client (since twitter was down), as well as the other basic examples shown here. 

There is still a lot of API's available within shoes I'm not handling, as well as many things I'm not handling as well as I could so I'll likely continue to hack around on it a bit.  WPF and Silverlight support would be nice (and very doable) as well!

Tuesday, May 20, 2008 1:24:59 AM (Eastern Daylight Time, UTC-04:00) | Comments [1] | #
This past weekend I got a chance to present on IronRuby at the Philly Code Camp.  I had a really great time preparing and giving this talk, despite more then a few hiccups along the way (keynote trouble and computer crash!).  After getting to talk to a few people afterwards it seems it was well received despite my stumblings.

My primary goal for the presentation was to encourage those in the audience who don't know Ruby to learn it.  I think Ruby is a great programming language that has a ton of really compelling use cases.  Additionally, I think the process of learning Ruby is extremely beneficial and can change the way you think about and write software.

I'm very excited about where the IronRuby project is, and even more so about where it's headed.  The team is making great strides and getting really close to a couple milestones that will be very exciting.  We really need to get as many individuals within the .NET community involved in the IronRuby project as possible so we can have a kick ass implementation of Ruby that runs on the CLR!

I've attached my slides to this post, but be forewarned that they're not all that useful standalone.  I've also attached my sample code/demos.  I had the most fun putting together my "shoes" sample which I'm going to write a follow up post on shortly I've written about in my Creating Cross platform GUI's with IronRuby post.

Slides
Sample Code

Tuesday, May 20, 2008 12:52:26 AM (Eastern Daylight Time, UTC-04:00) | Comments [3] | #
Thursday, May 08, 2008
In preparation for my upcoming Code Camp session on IronRuby I've been hacking around on the IronRuby source, as well as on Ruby programs that can run on IronRuby.  One of the core areas of interest for me concerning IronRuby is in writing specifications for my .NET applications using Ruby.  While I've been learning Ruby (the real kind) I've become very fond of the testing libraries they have available, most notably RSpec and mocha

Over the last two nights I've been writing some ruby code to test .NET classes written in C#.  With a few of the hacks I have locally, I've had some pretty good success.  The following set of specifications verify the behavior of an Account class I've written.

require "../../trunk/tests/ironruby/Util/simple_test.rb"
require "IronRubySamples"
include IronRubySamples

describe "Account" do
    describe "When depositing money into my account" do
        it "should increase my balance by the amount deposited" do
            account = Account.new(10)
            account.Deposit(10)
            account.Balance.should == 20
        end
    end
                               
    describe "When withdrawing money from my account" do
        it "should decrease my balance by the amount withdrawn" do
            account = Account.new(100)
            account.Withdraw(50)
            account.Balance.should == 50
        end
    end
                   
    describe "When withdrawing money from an account with insufficient funds" do
        it "should tell me I have insufficient funds" do
            account = Account.new(30)
            should_raise(InsufficentFundsException) { account.Withdraw(50) }
        end
    end
   
    describe "When making a withdraw that drops my balance below the minimum" do
        it "should reduce my account by the amount withdrawn + the low funds charge amount" do
            account = Account.new(55)
            account.Withdraw(50)
            account.Balance.should == 4
        end
    end
end

The next step in my quest to test .NET code with IronRuby required me to figure out how to mock out dependent objects.  I considered several different options.  My first thought was to try and use "simple mock", however, I quickly realized via Scott Bellware that while it worked well on IronRuby libraries it wouldn't fit my needs.  My next thought was to give Moq a try.  After downloading Moq, I attempted to run a spec that referenced Moq and created a Mock<T> instance as shown below:

require "../../trunk/tests/ironruby/Util/simple_test.rb"
require "IronRubySamples"
require "Moq"
include Moq
include IronRubySamples

describe "LoginController" do
    describe "When a user logs in" do
        it "should vallidate credentials with login service" do
            mock = Mock.of(ILoginService).new
            #do expects
           
            controller = LoginController.new(mock.Object)
            controller.Login("steve", "****")
        end
    end
end

When running this via ir.exe I got an error that "Moq.Mock is not a generic type".  After poking around a bit I discovered this was due to a bug in IronRuby.  Currently IronRuby has problems when there is a generic and non generic type of the same name within a referenced assembly.  In order to work around this, I first tried to figure out what needed to be modified in IronRuby, however, that wasn't very fruitful so I decided to modify the source for Moq to get around my problem.  After renaming the static Mock class in Moq to MockRetriever, and hacking around another bug in IronRuby related to creating generic types where the type argument is an interface, I was finally able to get IronRuby to create the Mock<ILoginService> type:

mock = Mock.of(ILoginService).new

Unfortunately, this led to me to another roadblock.  When setting up expectations in Moq you do so with lambda expressions such as:

// C#
var mock = new Mock<ILoginService>();
mock.Expect(s => s.Login("steve", "****"));

While IronRuby has blocks and lambda's it doesn't have a way to express the above (at least that I know).  I'm going to dig around in the IronRuby source a bit to see if any ideas pop into my head, but at this point I'm not very hopeful. 

Friday, May 09, 2008 1:09:46 AM (Eastern Daylight Time, UTC-04:00) | Comments [3] |  |  | #
Search
Archive
Links
Categories
Admin Login
Sign In
Blogroll
Themes
Pick a theme: