Show me the code! RSS 2.0
 Sunday, June 22, 2008

Good Job Plurk!  I won't be doing that again.

This is what happens when you use their built-in 'feature' to add people you already know from another service, such as Gmail. 

Have we not heard of using ssl or form submission without using querystring values?  It's really not that difficult guys...

Sunday, June 22, 2008 12:18:53 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -

 Tuesday, June 03, 2008

The first day of Tech Ed has been exciting and full of things to be learned and explored.  Here are the sessions I attended and my thoughts/reflections on each.

Keynote with Bill Gates, S. "Soma" Somasegar, others


Pragmatic Architecture: The Role of an Architect with Ted Neward

  • Architects spend too much time defining their role
  • The building architect analogy is good, but the maestro/conductor comparison is better.
  • How do we start polishing the process of software architecture over the next 5-10 years?
  • Why is there often a negative connotation with the title "Architect"
  • Some architects really have no idea what is going on.  You must understand the big picture before you can create solutions at this level.
  • Should architects still write code?  Absolutely!


Best Practices with the Microsoft Visual C# 3.0 Language Features with Mads Torgersen (PM for C#)

 

Automatically implemented properties

public string CustomerID { get; set; }

 

Implicitly typed Local variables

 

 

var custs = new List<Customer>()

{

new Customer()

{

                        CustomerID = “MADST”;

                        CustomerName = “Mads Torgersen”;

                        City = “Redmond”;

}

}

 

Collection and Object Initializers

Code-result Isomorphism

            Shape imitates result

 

ObjectDumper

 

Extension Methods

Public static IEnumerable<Customer> GetLondoners(this IEnumerable<Customer> source)

Foreach (var c in source)

{

            If (c.City == “London”) yield return c;

}
Allows you to insert extension methods into an instance (even if static)

New functionality on existing types

Scoped by using causes

Interfaces & constructed types

 

Lambda Expressions

Public static IEnumerable<T> Filter <T>(GetLondoners(this IEnumerable<T> source, Predicate>T> p)

foreach (var c in source)

{

            If (p(c)) yield return c;

}

 

var query customers.Filter(delegate(Customer c) { return c.City == “London”; };

 

Terse syntax for anonymous methods:

var query customers.Filter(c =>{ c.City == “London”;});


*When you only have one thing left you can remove the parens

 

LINQ to Objects

var query = Customers

            .Where( c=> c.City == “London”);

            .Select ( c=> c.ContactName);

 

ObjectDumper.Write(query);

 

Monads – Look into this

 

Don’t use LINQ for *other magic* that is not a query

 

Expression Trees

Related to link

Expression(of)

Represents a lambda expression as an expression tree at runtime

 

 


ASP.NET MVC with Scott Hanselman

  • Separation of Concerns!
  • A new .NET project type
  • Designed to be very easily testable with minimal need for mocking objects compared with other patterns
  • Test with mbunit or integrated VS test system
  • Uses three new namespaces:
    • System.Web.Abstractions
    • System.Web.Mvc;
    • System.Web.Routing;
  • "Bin-deployable" These new assemblies do not have to be installed in the GAC.  Useful when you can't, or are afraid to, install them there.
  • Flexible.  Plays well with Winforms
  • Fundamental to .NET from version 3.5 forward
  • Demo of red-green TDD.  This is really quite easy with MVC because of much improved separation of concerns when used properly
  • JQuery and AJAX compatible
  • Dove into the call stack for MVC at runtime, it's quite informative for understanding what's going on "under the covers".  Have a look at the call stack of a running MVC app to get a good picture of what's going on.
  • Discussion of Routing
  • Provides for cleaner URLs and HTML
  • Phil Haack (PM for MVC) is open to suggestions from the community and will be incorporating recommendations from developers as much as possible.
  • "Strongly typed query strings"
  • Much better than average runtime errors when something goes wrong.  This is strange but true!
  • Discussed Extension Methods, Lambda queries, and LINQ
Monday, June 02, 2008 11:04:02 PM (Eastern Standard Time, UTC-05:00)  #    Comments [2] -

 Wednesday, May 28, 2008

privacyLink.Text = String.Format("<a href=\"{0}\"{2}>{1}</a>", hrefLink, LinkBuilder.ExtractTextFromLink(links[0]));

This caused me a bit of grief this evening.  While I am not a fan of building strings like this, it's the way things were and I had to run with it.  In an ideal world this would be done with a text or html writer, but I'll be happy with anything short of basic string concatenation. 

While refactoring a fairly large application for a web analytics migration, I missed one small but key problem with the line of code listed above.  The error given was referencing an array index out of bounds or an undefined array index referenced.  Thus I immediately went chasing after a possible problem with the links array being empty or null.  This proved futile, and after a few minutes of tracing the flow and checking the history of changes on this file it became apparent that if there was a problem with the array reference, it had been an issue for at least six months. 

Google had a cached copy of the page, indexed before my code push, which told me it had definitely been working before I touched anything.  I decided a closer look at the String.Format() method call was necessary.  In this instance we're expecting a string formatter and an array of one or more strings as additional parameters. 

Since this uses late binding of the string parameters into the formatter, the compiler never checks that the correct number of arguments are specified.  It would have been nice if the compiler had been designed to parse the formatter and fail the compilation if one too few arguments were provided, but understandably that responsiblity falls on the developer in this case.

There were some key factors in why this bug made it into production before being caught during testing there:

  • Partially centralized link building, duplicated in many different portions of the application when a single linkbuilding class would have been ideal.  In reality, halfway OOP is often much worse than none at all.
  • Code that is not testable with out cost-prohibitive refactoring.
  • Limited content and resources with which to test in the staging environment
  • The error only occurs when a custom privacy policy link is used, >70% of the time the default is used.  Only 5 of well over 100,000 pages were throwing the error.
  • Lack of automated tests on production data.  We're working to eliminate this particular hindrance, but precious time for such "extras" is always scarce.

I was eventually able to correct the error and push the code up to staging and pre-production to validate the fix.  In the end the fix made its way to production before customers became aware of the problem, but these kind of errors are preventable by working to correct the problems listed above.

Wednesday, May 28, 2008 8:40:17 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -

 Thursday, May 01, 2008

See you there!

http://tinyurl.com/4l4bdr

Thursday, May 01, 2008 6:16:40 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -

 Sunday, April 20, 2008

On a somewhat limited timeframe (Saturday late morning until Sunday night), I seem to have picked the perfect destination to escape city life and enjoy some great views of Linville Gorge

Was a great opportunity to try out my new tent in stormy & windy weather.  It deflected both wind and rain quite effectively.

We went down the twisty 8 mile gravel road from 181 to the parking area at Table Rock, and then it was a short 1 mile hike to the summit on Saturday evening.  The fog had engulfed the entire mountain, hiding the many spendid views until it lifted mid-morning on Sunday. 

The sunrise was just incredible, one of the best I've ever seen.  The sunshine quickly pushed back the clouds from the day before, slowly giving way to some breathtaking views.

Roxy faired well, as usual, except when I had the bright idea of launching the last piece of Bridget's uneaten Cliff Bar off the side of a cliff; and then scrambling to convince her that I was not playing fetch with her.  Luckily she had more sense than her owner this time.

Timing was crucial, as we packed things into the tent just after finishing cooking dinner and nothing got wet before we were able to get all our gear stowed away in the tent or the covered vestibule.  The spot we camped at had this random level grassy patch among the rocks that seemed to have no other purpose than a nice soft place to camp on.  There were some good areas at the summit too, but it was far more rocky and uneven; though had keenly positioned bushes that would have shielded us from a significant bit of wind, had we not turned in early because of the rain. 

I was initially a little reluctant to carry my camera because of the extra weight of a SLR vs. a point & shoot, but the extra weight was neglegible on this short trek and the photos I got wouldn't have been half as good.  The tripod did, however, stay in the car, as there really wasn't a place to attach it to my pack and the extra 5-7lbs would have been annoying.  Next time I'll invest in one of those bendable gorilla arm tripod-like devices to be able to do some time-lapse and low-light shots.

Half-way down the mountain we scoped out a lower nearby peak as a possible site for future trips in the area and found it to be an excellent group camping site with plenty of locations to see around half of the Gorge.  It's not quite high enough to see Lake James as you could at the summit, but there is room to bring a few friends with you without them having to sleep on rocks.

All the steep cliffs reminded me of my last Gorge experience when my older brother fell around 60 feet from a ledge when the weight in his day-pack shifted and pulled him over the side.  We're all very lucky his fall was broken by a thick spanse of thorn bushes!  So I took a lot of extra care any time the verticals looked particularly threatening. 

Pulling out the map, I was able to verify that you can indeed see Babel Tower from Table Rock, as I had suspected.  The Babel Tower trail is a favorite of many, including myself; as it is particularly challenging with a full equipment load.  By Sunday when the clouds cleared out a bit you were able to see Sandy Flats from most any part of the Table Rock upper ridge area.

I believe Laurel Knob is the next camping spot on my list in the Gorge.

Sunday, April 20, 2008 5:15:08 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Linville Gorge | Outdoors | Travel
 Thursday, April 10, 2008

~A Camping Trip~

April 18th to April 20th ("May" was a typo)

We are thinking of staying at or near Linville falls.  It's either there or at Price Park and drive over the the nearby falls.  Let me know if you and/or friends want to go.  The more the merrier.  We just need to know how many so we can try to reserve enough space for everyone.  If you need a tent let me know, I have a couple or three extras. 

Linville Falls Campground, located off the Blue Ridge Parkway at milepost 317, is family oriented, located next to the Linville River. It provides easy access to numerous hiking trails to some of the most beautiful scenery in the Linville Gorge area. Interpretive programs are provided on weekends during the peak recreation season. Fishing opportunities are available on the Linville River.

   

 

Julian Price Park Campground is located on the beautiful Blue Ridge Parkway near Boone and Blowing Rock NC. The campground is adjacent to Price Lake. Fishing and boating are allowed. Fishing requires a state license and no motor boats are permitted. Canoe and rowboat rental is available from Memorial Day - Labor Day, and on weekends in early May, late September and the month of October. Hiking trails and trailheads are located within the campground.

   

Please RSVP as soon as possible but at least by Wednesday April 16 if interested.

//Chris

Thursday, April 10, 2008 10:50:52 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
General | Outdoors | Travel
 Monday, April 07, 2008


Monday, April 07, 2008 7:11:57 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
General | Programming
 Saturday, April 05, 2008
That didn't take long... Regardless of their official reasons for closing on their site, I would venture to guess that the combination of charging $10 per ticket and using GSO as a major hub played a large role.

It's still a little disappointing to see GSO add and lose an airline so quickly
Saturday, April 05, 2008 1:10:46 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -


Spooky!, originally uploaded by ballance5702.

This is a time lapse shot I took of some friends around a bonfire in the backyard. I'm not quite sure who the uninvited guest in the tree is.  Invader Zim or the rabbit from Donnie Darko?

Saturday, April 05, 2008 1:07:34 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -

Flickr stream
Archive
<June 2008>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Christopher Ballance
Sign In
Statistics
Total Posts: 13
This Year: 13
This Month: 0
This Week: 0
Comments: 2
All Content © 2008, Christopher Ballance