NoVa CodeCamp 2008.01 Schedule Released


The Nova CodeCamp 2008.01 schedule has been released, you can find it here.  There may be one or two changes, but only one of them should be major.

The low-down:

When: May 17, 2008 from 9a - 6p (registration begins at 8:30)
Where: Microsoft Offices in Reston, VA (directions)
How: Gracious support from our contributors, speakers and volunteers.
Why: Because we don't get enough of this during the week... Because all of our speakers and volunteers are passionate about community and want to give back.
How much: Free (and we'll feed you pizza!)

Where can I sign up?  Register here.  We have a limit of 200 and we're almost full, so register now.

author: Jeff Schoolcraft | posted @ Monday, May 05, 2008 2:42 PM | Feedback (0)

NoVa CodeCamp 2008.01 (5/17/08 in Reston) Call for Speakers


The next NoVa CodeCamp in Reston, VA is on May 17, 2008 from 9a - 6p and we need your help.  We're looking for new speakers, returning speakers and people that don't want to speak but will sit in front of a crowd and code (and offer color commentary on the side).

Your topics could be on pretty much anything in the Microsoft .NET Developer sphere of interaction, whether it comes from the mothership or the ALT.NET fringe or even the more radical Mono cult.  It could probably be on anything else too, development theory, tools, Django, Rails anything that opens our eyes and makes us think about how we could be doing things better.

At this point we're still shooting for four tracks with five time slots, or about twenty spots to fill.  I keep threatening to do a lightning talks track and a lobby track, but I've dropped them in the past because our speaker response has been overwhelming.  If that changes this time, I'll put them back in.

If you're interested in speaking, send me an email with your topic abstract and bio.  I'll be going through the submissions and announcing the sessions this weekend.

author: Jeff Schoolcraft | posted @ Monday, April 21, 2008 9:23 AM | Feedback (0)

NoVa CodeCamp 2008.01 Speakers and Registration


Expect a more formal announcement in a few days but we're looking for speakers, if you're interested then I'd love to hear from you: jeff at novacodecamp dot org.

Registration is also open, we've got a limit of 200 and these things always sell out--I guess the price is right--so you might want to hurry over and register.

The details?  I guess they'd help.

What: NoVa CodeCamp 2008.01
Where: Microsoft Offices in Reston, VA
When: May 17, 2008 from 9a to 6p (registration opens at 8:30)
Why: Because we care [can].
How: The help and dedication of our contributors, speakers and volunteers (to be determined and thanked copiously at a later date)

author: Jeff Schoolcraft | posted @ Monday, April 14, 2008 9:13 PM | Feedback (0)

Euler 14, F#, C#, Ruby and a Geriatric Gerbil


I came across this post while clearing out my Google Reader items this morning. While I'm not particularly interested in F# I am interested in math problems so I skimmed the post. I have nothing against F#, I just don't have time to learn yet another thing.

I'll describe Euler 14 in a minute, but I need to get some attribution out of the way.  As I said, this post was my introduction to the problem.  It turned out to be a response to this post, asking for a faster F# solution.  So here, is problem 14 of Project Euler.net:

The following iterative sequence is defined for the set of positive integers:

nn/2 (n is even)
n → 3n + 1 (n is odd)

Using the rule above and starting with 13, we generate the following sequence:

13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1

It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.

Which starting number, under one million, produces the longest chain?

NOTE: Once the chain starts the terms are allowed to go above one million.

I thought I'd do it in ruby, mainly to pass the time and give me an excuse to use ruby. I first started out just printing the first hundred Euler chains.  Then I thought I'd see if I could solve the problem, the longest chain generated from a number less than 1,000,000. My first, brute force implementation looked something like this:

require 'benchmark'

def even?(num)
  num % 2 == 0
end

def euler_chain_size(start)
  length = 0
  while start > 1
    if even?(start)
      start = start/2
    else
      start = 3*start+1
    end
    length += 1
  end
  length
end

max_chain_size = 0
max_chain_start = 1

Benchmark.bm do |x|
  x.report do
    1.upto(1000000) do |i|
      chain_size = euler_chain_size(i)
      if chain_size > max_chain_size
        max_chain_size = chain_size
        max_chain_start = i
      end
    end
  end

  puts "(#{max_chain_start}, #{max_chain_size})"
end

I had saved that off to euler14.rb and typed this in at my console:

time ruby euler14.rb

For my windows readers unfamiliar with time, it "runs programs and summarizes system resources". Basically it's a cheap way to see how long it took to run. The benchmark was added so I can get timings in windows (or anywhere).

For me that came back at:

real 7m34.232s

Ugh. The geriatric gerbil generating juice for my X41T must have died halfway through and his twin somehow resuscitated him (it's a core2 duo, of course). To make matters worse, I'm doing this all on Ubuntu in a VM on Windows Vista SP1.

I was playing a bit and mentioned the problem to a buddy of mine. He's a python dev and he whipped up a nearly identical brute force method in python. His took 1m17s. He does have some crazy fast laptop, but still, that's it's like 5x faster.

I don't know why, but I thought I'd move even? into an inline ternary. That version didn't change much, so here is the new euler_chain_size method:

require 'benchmark'

def euler_chain_size(start)
  length = 0
  while start > 1
    start = start%2 == 0 ? start/2 : 3*start+1
    length += 1
  end
  length
end

That run, for me, was nearly twice as fast.

C:\development\InstantRails2\dev>ruby euler14.rb

user

system

total

real

207.898000

0.010000

207.908000

(252.110000)

I'm still new to ruby but, I remember reading about methods and messages in ruby and think this may be an issue with ruby messaging having to call even?(num) 1,000,000 times. Maybe not, someone that knows, would you let me know?

Not bad, but I'm still not even close to my buddies time. So I applied a quick optimization and now I'm down to:

C:\development\InstantRails2\dev>ruby euler14a.rb

user system total real
17.585 0.030000 17.615000 ( 21.230000)

How am I going from 208 seconds to 18? I'm not recalculating the lengths of chains we encountered before (or already calculated).

require 'benchmark' 

def euler_chain_size(start)
  length = 0 
  while start > 1 
    start = start%2 == 0 ? start/2 : 3*start+1 
    length += 1 
    if @chains.has_key?(start) 
      length += @chains[start] 
      break 
    end 
  end 
  length 
end 

@chains = {} 
max_chain_size = 0 
max_chain_start = 1 

Benchmark.bm do |x| 
  x.report do 
    1.upto(1000000) do |i| 
      chain_size = euler_chain_size(i) 
      @chains[i] = chain_size 
      if chain_size > max_chain_size 
        max_chain_size = chain_size 
        max_chain_start = i 
      end 
    end 
  end 
  puts "(#{max_chain_start}, #{max_chain_size})" 
end 

I store the length of chains in a hash, keyed off of their start value. When I get to the start value of a chain that I already know (is in the hash) I just add that length to my current length and break out of my while loop.

I'm sure I could optimize this more and it's probably horribly ugly ruby in a c# mind set, so I'd love input on how to refactor my code.

The answer? You should really work it out on your own.  If you're really curious post a comment or send me an email.

author: Jeff Schoolcraft | posted @ Thursday, April 03, 2008 8:33 PM | Feedback (0)

First NoVa CodeCamp South a Success


I think the first showing of the NoVa CodeCamp South went really well.  We had a capacity set on the event for 100 people, had about 104 registered attendees and we counted 87 people walking through the door.

There were some challenges with the site itself but I think we were able to get around those.  The biggest was the lack of a room big enough to hold all the attendees at once, so we couldn't do a proper intro or closing and lunch was cramped (but we did placate everyone with pizza and beverages).  The second was a miscommunication on schedule, we ended up having to rush everyone out of the building at 5 (instead of 5:15) and did our closing/raffle in the parking lot.  We gave away an 8GB Zune which helped morale.

I'm working on getting all the presentation materials up on http://novacodecamp.org.  If you don't see a particular sessions content let me know AND pester the speaker about getting me the materials.

We'd appreciate your feedback on the event.  It helps us run a better CodeCamp and helps the speakers tweak their presentations.  If you attended, you should have received and email from me about this, but if you walked in and I don't have your email (or you didn't get one) please fill out the evaluation.  On CodeCampEvals click on the NoVa CodeCamp South link to fill out the eval.

I was impressed with the turn out, I'm still trying to feel out the community in the area and it's nice to see so many people come out.  If you're interested in getting together on a more regular basis in the Woodbridge area, for a usergroup maybe, let me know.  I'd also be happy to organize a geek lunch or two for the local geeks to hang out and chat someplace during lunch.

author: Jeff Schoolcraft | posted @ Monday, March 31, 2008 10:41 AM | Feedback (0)

The two problems of regex...


I was checking my email after lunch and saw a message sitting in my Inbox with the subject: "REGEX".  Okay, I thought, what now?  Here's the email:

You know how to build regular expressions?

/^(2[0-3])|[01][0-9]:[0-5][0-9]$/

This is supposed to test for a valid time.

Can you tell me what the (2[0-3]) at the beginning does?

Also, how would I add on A/PM?

Let's discuss the email.  Do I know how to build regular expressions?  Sure.

Can you tell me what the (2[0-3]) at the beginning does?  It matches a 2 followed by a single digit in the range from 0 - 3 and places the result of that match in a group.  Specifically it's looking for 20, 21, 22 or a 23.

Also, how would I add on A/PM?  Well, before the $ you'd want to add something like:

(\s*[AP]M)?

That would catch any amount of white space after the last digit, including none.  Then AM or PM, but only if it was present.  The ? means the pattern could happen 0 or 1 times.

Obviously AM/PM doesn't make sense in the context of 24 hour time, which is what that regex above validates.

Now's the time to insert a quote on regex in an under-handed and humorous way:

Some people, when confronted with a problem, think
“I know, I'll use regular expressions.”   Now they have two problems.

If you're interested in the origin of that quote, as I was, you'll want to read this.  It was Jamie Zawinski if you can't be bothered with the link.

I had another email, about a month earlier, about using a RegularExpressionValidator in an ASP.NET application.  Here's the interesting bit:

ValidationExpression="[0-9][0-9]"

The question was something to the effect of: "This should validate that the field has two numbers, but it's accepting a89 and 99e as input.  Do you have any idea why?"  Sure, that regex is supposed to match 2 digits and it is.  If you only want to match 2 digits and nothing else then you need to bound your input with something like:

^\d{2}$

I understand, that to some, regex are mysterious voodoo like bit math but it's one of those things that keep popping up and you'd be doing yourself a favor if you figured out basic structure and rules.  Don't learn all the escape sequences (\s, \S, \d, \w, \b) because that's easy enough to find on a cheatsheet.  It doesn't help that there are so many ways to express the same intent (doesn't help in a deciphering sense).  Just look at the second expression above, [0-9][0-9].  That alone could be rewritten in any of the following forms:

  • \d\d
  • \d{2}
  • [0-9]{2}

After you have the basic structure I think you need to find a decent tool that will let you evaluate regular expressions in your target language (the first regex was for javascript, the second was for .NET).  The one I keep going back to for .NET is The Regulator by Roy Osherove.  Here's an ajax version for javascript: http://tools.netshiftmedia.com/regexlibrary/ 

You would be even better served by writing up some tests asserting how the validations should work with examples of passing and failing inputs.  For one, they're more permanent than the tools.  They also allow you to add assertions based on changing requirements or bugs and help document regular expressions in code.  If you think it's hard to read straight code a few weeks or months later, even your own code, it's even harder to read a regular expression.  Even a slightly complicated regex without context could be a nightmare to debug a few months down the road, those tests will give your regex context.

The title refers to the quote, I have no problems with regex.

author: Jeff Schoolcraft | posted @ Wednesday, March 26, 2008 7:27 AM | Feedback (0)

NoVa CodeCamp 2008.01 Call for Speakers


We're gearing up to do another CodeCamp in Reston, VA on May 17, 2008 and we need your help! We're looking for speakers, of course, to come and pass along some knowledge to the vibrant .NET Developer community in Northern Virginia.

[If you're looking for NoVa CodeCamp South v1, this Saturday March 29 in Woodbridge: register now]

We're especially looking for new faces, people that have found a fantastic tool, method or something that would enrich our lives as developers. We're a casual group and this would be a great way to get started in the community. We love our speakers and our honored to have some really big names come out time and time again for a free event and offer conference quality speeches. But, we're convinced that there are a lot of awfully smart people lurking in our community and we'd love to pick your brains or hear what you have to say.

Don't feel up to the task of speaking on your own? Team up with a friend or just offer to do a lightning talk (they're quick 5 minute talks).

NoVa CodeCamp 2008.01

What is CodeCamp?

According to the CodeCamp Manifesto it is:

  1. By and For the Developer Community

Code Camps are about the developer community at large. They are meant to be a place for developers to come and learn from their peers. Topics are always based on community interest and never determined by anyone other than the community.

  1. Always Free - Code Camps are always free for attendees.
  2. Community Developed Material - The success of the Code Camps is that they are based on community content. All content that is delivered is original. All presentation content must be provided completely (including code) without any restriction. If you have content you don’t want to share or provide to attendees then the Code Camp is not the place for you.
  3. No Fluff – only Code - Code Camps are about showing the code. Refer to rule #1 if you have any questions on this.
  4. Community Ownership - The most important element of the Code Camp is always the developer community. All are welcome to attend and speak and do so without expectation of payment or any other compensation other than their participation in the community.
  5. Never occur during work hours - We need to understand that many times people can’t leave work for a day or two to attend training or even seminars. The beauty of the Code Camp is that they always occur on weekends.

Updated information will be available at: NoVaCodeCamp.org and on my blog (rss feed)

author: Jeff Schoolcraft | posted @ Wednesday, March 26, 2008 6:39 AM | Feedback (0)

NoVa CodeCamp South v1 Saturday 3/29/08 Monday, March 24, 2008


    Come join us this Saturday, March 29, 2008 at the Strayer University Campus in Woodbridge, VA from 9a - 5p for the first NoVa CodeCamp South.

    What is CodeCamp?

    According to the CodeCamp Manifesto it is:

    1. By and For the Developer Community - Code Camps are about the developer community at large. They are meant to be a place for developers to come and learn from their peers. Topics are always based on community interest and never determined by anyone other than the community.
    2. Always Free - Code Camps are always free for attendees.
    3. Community Developed Material - The success of the Code Camps is that they are based on community content. All content that is delivered is original. All presentation content must be provided completely (including code) without any restriction. If you have content you don’t want to share or provide to attendees then the Code Camp is not the place for you.
    4. No Fluff – only Code - Code Camps are about showing the code. Refer to rule #1 if you have any questions on this.
    5. Community Ownership - The most important element of the Code Camp is always the developer community. All are welcome to attend and speak and do so without expectation of payment or any other compensation other than their participation in the community.
    6. Never occur during work hours - We need to understand that many times people can’t leave work for a day or two to attend training or even seminars. The beauty of the Code Camp is that they always occur on weekends.

    Who's speaking?

    We have a lot of great local talent speaking at this CodeCamp. The list below represents what the line up is as of this writing (I've had a couple cancellations in the past, the most up to date list is always here: Speakers)

    • Steve Andrews
    • Chad Boyd
    • Antonio Chagoury
    • Jonathan Cogley
    • Steve Fibich
    • Jay Flowers
    • Greg Galipeau
    • Quentin Gilbert
    • Hal Hayes
    • Frank LaVigne
    • Sahil Malik
    • John Morales
    • Brian Noyes
    • Geoff Snowman
    • Portman Wills

    What are they talking about?

    The current list of sessions looks like this (the most up to date version of this list is always here: Sessions)

    • Portman Wills - Building Facebook applications with .NET
    • John Morales - Ajaxify your webpages using jQuery
    • Chad Boyd - SQL Server 2008 (Overview or specific topics)
    • Brian Noyes - WPF Databinding
    • Jonathan Cogley - Refactoring in C# - Bad code to better code
    • Jay Flowers - Test Driven Development
    • Sahil Malik - Writing WF's in MOSS
    • Antonio Chagoury - Developing Dot Net Nuke (DNN) Modules
    • Hal Hayes - SQLCLR; Writing .NET code inside SQL Server 2005
    • Jonathan Cogley - Web Application Testing In Watin
    • Greg Galipeau - Introducing .Net 3.5 “Extensions” ADO.Net DataServices (code name “Astoria”)
    • Hal Hayes - SSIS; Beginners Tutorial
    • Brian Noyes - Developing Service Oriented Workflows
    • Frank LaVigne - Silverlight
    • Steve Fibich - SSIS Event Handling
    • Chad Boyd - Performance Tuning and Optimization
    • Quentin Gilbert - Can .NETers do Agile Development?
    • Geoff Snowman - Storing Geographical Data in SQL Server 2008

    Where are all the details?

    Right here:

    • Register here, so we know we have enough pizza.
    • Directions (Google Map). Our classrooms and sign in will be at the entrance directly across from WaWa. It's best, on Caton to just make a U-Turn and enter the parking lot on Caton. We'll have signs at the event if you get turned around.
    • NoVaCodeCamp.org is the place for track information and ultimately session downloads, things like:

    Updated information will be available at: NoVaCodeCamp.org and on my blog (rss feed)

author: Jeff Schoolcraft | posted @ Monday, March 24, 2008 8:52 PM | Feedback (0)

ASP.NET MVC Preview 2 Released


Go get it now!

If you're interested in seeing what's new in this release you should read Scott Guthrie's ASP.NET MVC Road-Map post.  Among the many new items is the ability to run in partial trust, so you can drop System.Web.Mvc.dll in your bin/ and be up and running instead of having to install it in the GAC.

author: Jeff Schoolcraft | posted @ Wednesday, March 05, 2008 2:31 PM | Feedback (0)

NoVa CodeCamp South Call for Speakers


We're working on slotting what responses we've had to speak into sessions, a task that will hopefully be completed by this weekend.  It looks like we're going to have some openings, so if you're interested, send me an email (jeff at thequeue dot net) with your name and the session title and abstract.

We'd prefer coding sessions but guided discussions are also a welcome addition.  Some ideas for discussions might be "How is MVC going to affect me", "Coolest things you do in your build process" or "Choosing your AJAX framework".

It looks like we're going to have 4 tracks and about 4-5 sessions each (we're still working on session length).  One track is going to be a dedicated lobby track, or at least that is the plan right now.  A lobby track is a place to geek out with fellow attendees during a timeslot that might not have something to offer you.  CodeCamp is about learning, but it's also about connecting with your fellow developers.

The details:
When: March 29, 2008 from 9a - 5p (we'll provide pizza for lunch, other options nearby)
Where: Strayer University Woodbridge Campus (directions)
Registration: http://tinyurl.com/39yhtw (limited to 100 and it's filling up fast!)

author: Jeff Schoolcraft | posted @ Thursday, February 21, 2008 11:52 AM | Feedback (0)