My Resume

  • My Resume (MS Word) My Resume (PDF)


Affiliations

  • Microsoft Most Valuable Professional
  • INETA Community Champion
  • Leader, NJDOTNET: Central New Jersey .NET User Group

Friday, December 19, 2008

ASP.NET MVC Release: So close you can FEEL it!

I had a great time reading ScottGu's blog post today discussing all of the cool new features coming in the RC. Some of them (like the View page template not including a code-behind file) really got me excited, but I nearly freaked out when I got to the end and read this:

We'll be releasing the ASP.NET MVC Release Candidate in January. Our plan is to have that build be ASP.NET MVC V1 API and feature-complete and have zero known bugs. We'll give people a short period to upgrade to it, give it a good tire-kicking, and report any last minute issues they find. We'll then ship the official V1 release shortly after that (so not far off now).

ASP.NET MVC v1 is SOOO close! I really feel like this framework has come a long way in its relatively short development lifetime and with all of the recent candy that's been added in the past few releases, I can just tell that it will be a wonderful platform to develop on for years to come.

Microsoft... ScottGu (and the rest of the MVC team)... You ROCK. I can not wait to be working in this framework on a daily basis.

Tuesday, December 9, 2008

Princeton, NJ -- Community Events This Week

If you're in the Princeton, NJ area - or can somehow manage to get here - this week, boy do we have some events for you!  Infragistics has teamed up with our local .NET User Group (NJDOTNET) and our local Microsoft Developer Evangelists out of New York City to bring you the following awesome events:

  1. Thursday, December 11th, 1PM - 5PM:  MSDN Roadshow
    Presenters:  Peter Laudati and Bill Zack
    Session 1: Cloud Computing

    Hear about key problems that cloud computing is solving and how these services fit into the Microsoft cloud computing initiatives. Learn about the pillars of the platform, its service lifecycle, and see how they fit with both Microsoft and non-Microsoft technologies.

    Session 2: Silverlight 2 Application Development

    Now it’s time for you to get ready to build next generation rich Internet applications with Silverlight!  In this session, we’ll quickly review what the Silverlight 2 platform is, and then move into the bits and bytes.

    If you're interested, register using this link:

    http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032395688&culture=en-US

     

  2. Thursday, December 11th, 6:15-8:30 PM:  NJDOTNET User Group monthly meeting
    Topic:  The ASP.NET MVC Framework
    Presenter:  Jess Chadwick

    The Model-View-Controller (MVC) architectural pattern is one that many developers are familiar with which separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. It is a lightweight, highly testable framework that allows you to easily incorporate this pattern into your applications, helping to separate the different aspects  (input logic, business logic, and UI logic) into loosely-coupled and pluggable elements.

  3. Saturday, December 13th,  9:30 AM - 5:00 PM:  NJDOTNET ASP.NET MVC Firestarter
    Join us at the Infragistics HQ to participate in an all-day, deep-dive into one of Microsoft's latest (and greatest!) technologies: ASP.NET MVC.

    At the ASP.NET MVC Firestarter, we’ll give you a quick tour of the framework, then peel back the layers and dive deeper into how it works.   As part of that, we’ll spend time discussing the design and development practices that lead to the creation of the MVC framework.  By the time you leave, you’ll have enough knowledge to get fired up and start building web applications with it.

    Detailed Agenda:

    • ASP.NET MVC Introduction
      • The MVC Design Pattern
      • Hello World Demo – Walking through routing, controllers, and views
    • Framework Fundamentals & Practices
      • C# 3.0 Primer
      • Anonymous Classes
      • Lambda Expressions
      • Extention Methods
      • LINQ
      • Dependency Injection
    • Routing & Controllers
      • Routing 101
      • Controllers – Actions & ActionResults
      • Controllers & TDD
    • Rendering Markup
      • Views (using WebForm tools)
      • Extensibility with View Engines
    • Working with Data
      • Creating & Submitting Forms
      • UI Helpers
    • Building Rich Web Interfaces
      • Applying AJAX Helper extensions
      • Walkthrough of ASP.NET AJAX + MVC Extensions
      • Enhancing MVC with jQuery
      • Action Filters & applying to AJAX

    If you are interested in attending this session, please register using the following link:
    http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032397108&culture=en-US

 

I look forward to seeing you at these great events!

Sunday, November 16, 2008

Easier Automated Database Testing with SQL Express

Scenario

I've got a project in which I actually have full create scripts for my database such that I can build a whole new instance from the bottom up.  I've also got some automated unit/integration tests that I want to run against this database, complete with a bunch of scripts that can build some test data for me (unrealistic, I know...  but bear with me :).  Also, I really don't want to have to worry about configuring connection strings just for my tests - I just want some database available to me when I need it that I can wail on with requests and gets cleaned up for me when I'm done.  Finally, I want to keep my tests as isolated as possible, which to me means a file-based SQL Express database; that way, I can attach, detach, and delete as much as I want with as little exposure and impact to the rest of my build system as possible.

Solution

My solution to the above scenario I found myself in was to create a helper class called TestDatabase whose job is to give me a database when I need one, provide me with a clean version of my test data before each test I run, and clean up after me when I'm done.  To this end, I started searching for how to create a file-based SQL Express database using code, and came up with Louis DeJardin's great blog post that walked me right though it.  After I had that, it was a simple matter of whipping up the class, shown below (Note: this is only a partial listing.  You can get the full listing from my code repository):

TestDatabase.cs (partial listing)
public class TestDatabase : IDisposable
{
private readonly string connectionString;
private readonly string databaseFilename;

public string ConnectionString { get { return connectionString; } }
public string Schema { get; set; }
public string TestDataScript { get; set; }

public TestDatabase(string databaseFilename, string schema, string testData)
{
this.databaseFilename = databaseFilename;
connectionString = string.Format(
@"Server=.\SQLEXPRESS; Integrated Security=true;AttachDbFileName={0};",
Path.GetFullPath(databaseFilename));
Schema = schema;
TestDataScript = testData;
}

public void Dispose()
{
DeleteDatabaseFiles();
}

public void RecreateTestData()
{
EnsureDatabaseCreated();

if (!string.IsNullOrEmpty(TestDataScript))
ExecuteQuery(TestDataScript);
}

// Create a new file-based SQLEXPRESS database
// (Credit to Louis DeJardin - thanks! http://snurl.com/5nbrc)
protected void CreateDatabase()
{
var databaseName = Path.GetFileNameWithoutExtension(databaseFilename);

using (var connection = new SqlConnection(
"Data Source=.\\sqlexpress;Initial Catalog=tempdb;" +
"Integrated Security=true;User Instance=True;"))
{
connection.Open();
using (var command = connection.CreateCommand())
{
command.CommandText =
"CREATE DATABASE " + databaseName +
" ON PRIMARY (NAME=" + databaseName +
", FILENAME='" + databaseFilename + "')";
command.ExecuteNonQuery();

command.CommandText =
"EXEC sp_detach_db '" + databaseName + "', 'true'";
command.ExecuteNonQuery();
}
}

// After we've created the database, initialize it with any
// schema we've been given
if (!string.IsNullOrEmpty(Schema))
ExecuteQuery(Schema);
}
}


Let's analyze the things we've got going on here:


  1. First, we've got the CreateDatabase() method (lines 34-61) - basically ripped right from Louis's blog post linked above - which does the magic of creating a file-based SQL Express database.  It all boils down to a "CREATE DATABASE" and "EXEC sp_detach_db" call on the local SQL Express instance's tempdb database, which everyone has access to.  Then when that's all done, I execute the schema script that the tester passed in to build the database schema and finish the initial setup.
  2. Now that the database has been created and initialized with its schema, we can run some tests against it!  Problem is, at this point it's just an empty database...  Fortunately for us, we've got the RecreateTestData() method, which just executes the TestDataScript against the current database, allowing us to easily populate whatever test data we want!  This script should include everything it needs to clean out the database and rebuild it from scratch with a new set of clean data.
  3. Built-in connection string management.  As you can see, our constructor takes in a database filename, builds a connection string out of it, and then exposes that connection string to our testers via a read-only property.  That is one less connection string that our test project has to worry about managing in its app.config (or whatever), which is pretty nice and clean, IMHO!
  4. Finally, our big finale:  cleaning up after ourselves!  You can see that TestDatabase implements IDisposable, allowing us to create a Dispose() method which cleans up after everything we've done - namely, deleting the database files we've created along the way.  This means that after everything is said and done, we've left not one footprint of our presence on the build system.

Now, after we've got our TestDatabase class available, our unit tests become as easy as this:


public void SomeCoolDatabaseDrivenServiceTest()
{
var mySchema = System.IO.File.ReadAllText("mySchema.sql");
var testData = System.IO.File.ReadAllText("testData.sql");
using (var db = new TestDatabase("TestDatabase.mdf", mySchema, testData))
{
db.Initialize();
var service = new MyService(db.ConnectionString);
service.DoSomething();
}
}

Of course, individual tests can have even less code if you manage the test database outside of the test by using your test framework's setup and teardown methods.  For example, if I had a whole slew of tests against the same database (which is usually always the case), the test class would start out like this:


TestDatabase database;

public void ClassInitialize()
{
var mySchema = System.IO.File.ReadAllText("mySchema.sql");
var testData = System.IO.File.ReadAllText("testData.sql");
database = new TestDatabase("TestDatabase.mdf", mySchema, testData);
database.Initialize(true);
}

public void TestInitialize()
{
// Rebuild the test data from scratch before EVERY test
database.RecreateTestData();
}

public void ClassCleanup()
{
database.Dispose();
}

Now that we have all of that setup and teardown logic out of the way, we can focus on what we're actually testing, so then that test I showed you before becomes a simple one-liner (as it would have been if we were just passing in a connection string from a configuration file):


public void SomeCoolDatabaseDrivenServiceTest()
{
// No TestDatabase setup - just use its connection string!
var service = new MyService(database.ConnectionString);
service.DoSomething();
}

What's cool about this is that not only do we not have to worry about where to get our connection string from, our entire suite of test data is also being rebuilt for us before every test is run!

Try It Out For Yourself!


If you like what you've seen in this post and want to try it out for yourself, you can grab the full source file (complete with in-line comments and unit tests) from my repository: TestDatabase.cs.  Just drop it in your project and start using it!
Note: The full source file has unit tests included. If you don't want them, you can simply delete them without affecting the main class.


As always, I'd love to hear your comments and feedback on all this.  If you've found this useful or - better yet - if you have a better way of doing it, please let me know!

Monday, October 27, 2008

Live from PDC: Getting settled in and thoughts on the Keynote

Greetings from PDC!

After a long and uncomfortable (for those who don't know me - 6'3", 220lbs...) flight, I'm finally here in beautiful and smoggy Los Angeles, ready for some PDC action!  First up - this morning's keynote in which Ray Ozzie announced Windows Azure, their new offering.  Sounds much like Amazon's service offerings (EC2, S3, etc)... only .NET and a whole slew of other MS offerings.  Sounds pretty darn cool, if you ask me.  So far, I haven't really been interested in utilizing Amazon's services, mostly due to cost, and I wonder how Azure will compare.  Ozzie says their CTP will be free due to changes that may possibly break anything and everything that you make with it at this point (my words, not his), and says that the final pricing will be "competitive with the market" (dunno if that's an exact quote or not, but it's about right).  One has to ask - what's "the market"?  As far as I can tell, that means Amazon's services and - as I just got done saying - their pricing was a deal-breaker for me.  Along these same lines, I noticed that one of the bullet points said "hobbyist-friendly" - with any luck that is referring to their pricing structure.

I also found it interesting that they referred to "new patterns and best practices such as loosely-coupled services and applications" numerous times...  It really is news to me that loosely-coupled designs are "new patterns and best practices"!   But, I'm not complaining - if developers are now more or less forced to use loosely coupled architectures to take the most advantage of cloud services, that's a good thing, right?

My next session (A Lap Around Windows Azure) is starting, so I should wrap this one up...  but, more to come for sure.

Wednesday, October 8, 2008

Wow - Thanks, Microsoft!

It's taken me quite a few days to get around to writing this post (been busy preparing and delivering a new ASP.NET MVC presentation at the Richmond Code Camp last Saturday), but I received a great email last Wednesday welcoming me to a great community of Microsoft professionals, and beginning with this header:

I'm now a Microsoft MVP in ASP.NET!  Needless to say, as soon as I found out, I got crazy excited and began thinking of everyone who was so helpful in achieving this great award. 

The first two guys I needed to thank were Aaron Marisi and Todd Snyder.   These two have been - and continue to be - crucial in helping me run the NJDOTNET User Group.  With their help (and it was only possible with their help!) we have been able to expand this monthly meeting to a meeting every week, providing exponentially more value to the members of the group.  I am going to make it my mission from here on out to make sure these two guys get all the credit they deserve!

In a separate class altogether are Ambrose Little and Jason Beres.  It is these two guys that had the greatest impact on my professional and community life because it was the leadership, knowledge, and obvious passion that these two MVPs (and I mean that in every sense of the acronym) exhibit on a daily basis that inspired me to become so involved with the development community in the first place.  Were it not for them, I probably would still be sitting in the back of the monthly user group meetings, barely saying a word.  But, after working with them for only a short time, their selfless guidance and inspirational example were too much to ignore and I just had to join in and attempt to contribute even half as much as they do.  In fact, I attribute so much of my recent success to them that if I could (and if they didn't already have one!) I would give my award directly to them.

I can't even imagine how much more vibrant and exciting our community would be if there were more Aarons, Ambroses, Jasons, and Todds out there pushing things along.  I eternally grateful to be able to work with all of them and even call them my friends.

So, thank you everyone for all of your support and I am really looking forward to all of the great community participation in the coming year!

Wednesday, September 10, 2008

S-E-Ooooh, That's How You Do It!

My boss, Kevin, and I headed out to Seattle last month (coincidentally during the time that some of our Infragistics buddies were heading up the speaker list at DevScovery) to attend an expert-level SEO seminar given by the bright folks over at SEOmoz.  And, boy was it enlightening!

Now, before I go any further, I'm going to have to state right up front that (until late last month) I have been wandering through my professional web career knowing only a bare minimum about SEO.  I thought I understood basic concepts like linking and keyword placement - the more times you link to a page and repeat a word, the higher your search rank, right?  Unsurprisingly, it turns out to be a bit more involved that that. :)

There's no way I'm going to duplicate in a blog post or even a series of blog posts what I learned at that awesome seminar - if you're truly that interested, I would suggest signing up for the training or at the very least checking out the articles on SEOmoz.  However, I wanted to 'jot down' a few of my largest takeaways, because they really made me reevaluate my view on the way SEO works.  Since I have a knack for oversimplifying things (verging on naivety), I figured a bulleted list would do just the trick.  So, below you'll find my ridiculously simplified...

List of Things You Probably Already Knew About SEO But Didn't Realize How Important They Were (or at least I didn't...):

  1. Backlinks.  I'm sure it comes as no surprise that having other sites (especially the big/important ones) link to yours is beneficial, but I'd have to say the most unexpected thing I took away from this seminar was just how important they are!  From what I understand, these account for the vast majority of your PageRank-ings - I'm talking well over half.  That means you need to beg, borrow, cheat, and steal (wait, no... not those last two) to get everyone and their dog to link back to you (assuming their dog's site has a lot of traffic, of course!).  As always, the better their PageRank, the better your Link Juice.

  2. Oh, yeah - Link Juice and nofollow!   To be honest, I'd never heard the term 'link juice' before.  But after hearing it explained, it was just so incredibly appropriate I really became endeared with it.  Put simply, think of the traffic to any one of your pages as water flowing into a pipe.  You start out with 10 gallons of water coming into one pipe (this landing page) from which it is split up and diverted to various other pipes (pages you're linking to from the landing page).  Each of these splits divides and cuts down the volume of the initial 10 gal., such that if you have, say, 10 links on your page each of them gets 1 gal. of that initial 10.  Now, if you play that concept all the way through each page, constantly splitting up the water on every page, you can imagine how quickly that 10 gallon deluge can become just a trickle...  Obviously, we'd like to see some pages on our site get more traffic than others, so how do we  keep our existing links so people can still navigate our site, yet "divert the water" to the pages that we think are the most important?  Fortunately, the answer is pretty simple - the "rel='nofollow'" tag!  Placing this tag on any of your links basically tells search engines "this page really isn't important to me and I really don't want to waste my influence on it."  It's kind of like disavowing all knowledge of your pages... even if it quite obvious that they're worth something to you (since they still exist, after all).

  3. Then there's plain ol' good, properly-formatted, and relevant content...  Really, from what I could tell, those first two bullets are the major players in terms of tips & tricks.  The search engines are getting better at filtering out spammers every day through various techniques, so your ultimate defense is to create interesting content, and make use of standard best practices like putting your important keywords in your <title> and <hx> tags, concentrating on creating relevant content, and trying to keep your markup light and semantically correct.  Simple... right?  "Easier said than done" is more like it!

I had intended from the start for this to be a quick overview of what I took away from my recent training and nowhere near a "deep dive" into SEO.  But, to help you on your way, I've collected a few resources that might help you learn some more if I've happened to pique your interest... which I certainly hope I have!

Additional Resources:

Hope this all helps!  Oh, and please leave me a comment and let me know if it does - I'd love to hear about it!

Saturday, August 2, 2008

The NJDOTNET Dojo is Born!

If you're a developer in the Princeton, NJ area, you'll be pleased to know that the NJDOTNET organizers have decided to create yet another group for your .NET learning pleasure!  Just this past Thursday, we had our first NJDOTNET Dojo meeting, at which I gave a presentation on the Web Development Productivity Tools I use to get things done. 

This new group will continue to meet on an on-going basis every Thursday night that there isn't another meeting (the main User Group or Agile discussion) going on.  Basically, if you're looking to learn about .NET, come on down to the Infragistics HQ on any given Thursday and you're bound to be satisfied!

See this forum thread for more details.

Tuesday, July 1, 2008

Use ASP.NET MVC ActionFilters to Render AJAX Responses!

In my previous blog post on ASP.NET MVC, I walked through an example based on the MVC Preview 2 bits which showed how to make your own custom view engines and ActionFilters.  I also proved (or at least hope I proved) just how powerful these parts of the framework can be, especially when used in conjunction with each other.  The truth is that - while I thought they made great examples on how to extend the base parts of the framework - the whole thing seemed kind of kludgie to me.  What I mean is that it felt kind of awkward having to use the ActionFilter to change which ViewEngine is being used on the fly.  I don't know, maybe I just feel like view engines should be more closely tied to the controller and shouldn't just be chosen willy-nilly like that!

This was all before the introduction of the ActionResult in MVC Preview 3.  Oh man, was this a great addition!  Expanding the notion of being "loosely coupled", the controller action's job is no longer to execute logic and chose which view to display-- ok, well, it is...  only now its main responsibility is returning an ActionResult, which is basically a command object that tells the framework what to do instead the controller taking that action itself.  This not only helps us to decouple the controller (allowing for easier testing, etc.), it also lets us know what the controller wants the framework to do before it happens.  When you think of it, this is pretty powerful stuff, and gives us access to a whole new part of the process in which can inject additional logic.  And inject it we shall...

The SerializableViewDataAttribute Revisited

In my previous post, the attribute that I adorned my Actions with was pretty stupid.  It just said, "Is this an AJAX request? If so, set our custom view engine."  Pretty much all of the meaningful (and interesting) logic happened in our custom view engine.  Now, with the introduction of the ActionResult we no longer have to wait until the view engine phase to get access to (and override) the way our data is returned to the client - we can hijack it in the attribute, and manipulate the Action's result!  Before I confuse you any more, here's the code:

SerializableViewDataAttribute: Preview 3 style
public class SerializableViewDataAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
// Get the (lowercase) render mode from the querystring
var method = filterContext.HttpContext.Request.QueryString["renderMode"] ?? string.Empty;
method = method.ToLowerInvariant();

// Get the view data from the context (using a custom extension method defined elsewhere)
var viewData = filterContext.GetViewData();

// If this isn't a serializable request or it has no data, just return
if (string.IsNullOrEmpty(method) || viewData == null) return;

// Decide which method to use
switch (method)
{
case ("xml"):
filterContext.Result = getXmlResult(viewData);
break;
case ("json"):
filterContext.Result = getJsonResult(viewData);
break;
case ("partial"):
// If this is supposed to be a partial request, just change the view name.
// Obviously, this implies that this view exists (in addition to your
// original view that the controller was pointing to to begin with.
var viewResult = ((ViewResult)filterContext.Result);
viewResult.ViewName = "Partial" + viewResult.ViewName;
break;
}
}

private static ActionResult getJsonResult(object viewData)
{
// Since there's a JsonResult Action,
// all we have to do is pass in the data
return new JsonResult { Data = viewData };
}

private static ActionResult getXmlResult(object viewData)
{
// There's no "XmlResult" so we have to serialize it ourselves
var sb = new StringBuilder();
using (var writer = new StringWriter(sb))
{
new XmlSerializer(viewData.GetType()).Serialize(writer, viewData);
}

// ...then pass it into a ContentResult
return new ContentResult
{
ContentType = "text/xml", // Be sure to set the ContentType!
Content = sb.ToString()
};
}

}


As you can see, it is a lot like the logic that was used to create my custom view engine in the last post.  In fact, I essentially copied and pasted it (and added support for partial rendering)!  Also, now that all of this logic lives in the ActionFilter we have no more need for that pesky custom view engine.  So long, cruft!


For the benefit of those who may not have read the explanation of this logic in my previous blog post, I'll go ahead and repeat (as well as expand on) it here.  This version should actually be a lot easier to understand since the logic is now contained in one place instead of spread out between the ActionFilter and the ViewEngine.  Here's a basic run-down of what's going on:


  1. The first thing to note is that we're overriding the OnActionExecuted method of the ActionFilter.  What this implies is that the controller action to which this attribute is applied has already completed, so we now have access to everything it's done: ViewData, TempData, ViewName, etc.  We could also have overridden the OnResultExecuting method as well; this would be somewhat similar to the difference between the PreRender and Render events when using Web Forms.
  2. Once the "event" has been triggered, the first thing we want to do is figure out what, exactly, is expected of us - AKA, which serialization mode (if any) we should be using.  In this implementation, I have decided to glean this information from the querystring, but you can just as easily use any other environment variable you'd like (such as the Route Data, cookies... whatever!).
  3. Next, I get the ViewData from the context, if any, using the filterContext.GetViewData() extension method.  Though this method is defined elsewhere and you can't see it in this snippet, it's not really all that interesting - it's just a convenience method that drills down into filterContext.Controller.ViewData (or ViewData.Model, if available) and returns it.
  4. Check the render method that we got in Step #2 and if that or the ViewData is invalid, there's nothing for us to do, so we're done and we just return.
  5. Assuming we didn't bail out in Step #4, we then go on to overwrite the existing ActionResult (or its properties), depending on what the user has asked for.  This particular version supports:
    1. JSON:  Along with the introduction of the ActionResult came the JsonResult, which is a super-cool implementation of ActionResult that serializes whatever data you give to it into JSON to be rendered down to the browser.  As you can see in this example, this makes handling requests for JSON data really simple and easy.
    2. XML:  Though there is no "XmlResult" as there is for JSON, the MVC framework still provides a ContentResult which is a lot like the JsonResult in spirit.  Both of them allow us to send data in some form back to the browser without requiring a View to render it with.  Going back to our example - you can see that it takes a bit of work, but the end result is a raw batch of just XML sent back to the client for processing.
    3. Partial Rendering:  I included this render mode as a bit of a teaser - I should have a follow-up post going in-depth about using partial rendering in ASP.NET MVC.  For now, I'll just say that you can think of it a lot like the ASP.NET AJAX UpdatePanel server control...

  6. That's it!  If we've gotten to this step and not hit any of the three types above, this particular filter will just let the request continue on and have no effects what-so-ever.  That probably means it'll just end up rendering out a fully-rendered page like any other normal (non-AJAX) request.  The important part to note here is that this filter only injects behavior when it is appropriate.  Otherwise, things proceed as normal and noone even needs to know that these actions are AJAX-ified unless you want them to.


I don't know about you, but the power that this kind of stuff gives us just makes my head spin!  Hopefully you find the above useful; if you do, please feel free to contact me and let me know, especially if you end up using it in one of your apps!



As always, you can check out all of the source code in my repository: http://code.jesschadwick.com/


This particular piece of code can most easily be found at this direct link.

Wednesday, June 25, 2008

Where the heck can I download Firefox 2.0!?

Now that Firefox 3.0 is finally released, Mozilla has done a real good job of clearing out any mention of it from their website.  Thing is, we web developers still need to test on it!

Well, after a bit of querystring hacking (simply replacing "product=firefox-3.0" with "product=firefox-2.0.0.14"), I came up with this link, which should get you what you need:

Download Firefox 2.0.0.14

Thursday, June 19, 2008

Inaugural NJDOTNET Agile Meeting **Tonight**

As I announced at the last few weeks' NJDOTNET Study & User Group meetings, we'll be having our very first NJDOTNET Agile meeting tonight, Thursday, June 16th starting at 6:30 PM in the Infragistics auditorium in East Windsor (the same location as the regular NJDOTNET user group meetings). Here's a little bit about the group:

Taking a cue from both the growing ALT.NET movement and quite a few members of the main NJDOTNET user group, I've decided to augment the monthly meetings of our established user group to create a more interactive, discussion-based meeting. These Open Spaces meetings will occur once a month, on the weeks following the regular User Group (the third Thursday of the month). Hopefully the addition of these meetings will allow everyone to get the benefit of a different style of interaction and learning that the “Lecture-Learn” style of the main user group cannot provide.

I'll see everyone there!

Tuesday, June 10, 2008

ASP.NET MVC: Using Custom View Engines and Filters for AJAX

Way back in the time of ASP.NET MVC Preview 2 (last month), I was preparing for a presentation and decided that it would be nice to show just how simple it is to make your own View Engine.  Having found David Higgins' JsonViewEngine a few days earlier, I decided to expand a little upon it and add the option to emit either XML or JSON using the same engine.  After a little while, I had something looking like this that supported both:

SerializableViewEngine

public class SerializableViewEngine : IViewEngine
{
    public void RenderView(ViewContext viewContext)
    {
        string method = viewContext.RouteData.Values["responseType"] as string;

        string serializedData = string.Empty;
        switch (method.ToLowerInvariant())
        {
            case "json":
                serializedData = new JavaScriptSerializer().Serialize(viewContext.ViewData);
                break;
            case "xml":
                serializedData = SerializeToXml(viewContext.ViewData);
                break;
        }

        viewContext.HttpContext.Response.Clear();
        viewContext.HttpContext.Response.Write(serializedData);
    }

    protected static string SerializeToXml(object o)
    {
        StringBuilder sb = new StringBuilder();
        using (TextWriter writer = new StringWriter(sb))
        {
            new XmlSerializer(o.GetType()).Serialize(writer, o);
        }
        return sb.ToString();
    }
}

As far as building a custom ViewEngine goes, I figure this is a great example - other than the fact that I extracted my "SerializeToXml" logic out, this is a one-method override!  At first glance this (and David's) implementation may seem a little "underpowered" because of how few lines it took, but if you disassemble the System.Web.Mvc assembly or look at the MVCContrib code, you'll see that even real-world ViewEngine implementations can be this simple!  I guess that's one of the nice side-effects of separation of concerns - when big things are broken up into a bunch of pieces, those pieces are usually pretty small!

As for the details of this particular example, you'll notice that it checks the RouteData dictionary (populated from the routing tables you specified elsewhere) to see if it contains "responseType" (e.g. if one of your routes was "{responseType}/{controller}/{action}" and the url that was called looked something like "/json/products/categories") and try to honor it by serializing the ViewData that was passed from the controller into the requested result.  Once it has serialized the data, it just writes it directly to the Response and you're done!  You could then use this View Engine to render out all the async calls all day and night, just by setting the ViewEngine property on the controller instance like so:

Setting the ViewEngine

public void AsyncCategories()
{
    var categories = repository.GetCategories();
    this.ViewEngine = new SerializableViewEngine();
    return RenderView("Category", categories);
}

Simple as that, right?  Well, sure... but what happens when you end up making duplicate Actions for your "normal" browser and AJAX requests that have all the same logic with the exception of that one line?  The line that sets the ViewEngine is hard-coded in there, so you have to have separate Actions, right? 

Enter the ActionFilter!

Wrong!  After thinking about it for a minute I realized that this is the perfect place to use an ActionFilter (which was a good thing, because I just so happened to need a code example for that, too)!  And so, I got to coding and came up with this guy:

SerializableViewDataAttribute

public class SerializableViewDataAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(FilterExecutingContext filterContext)
    {
        var controller = ((Controller)filterContext.Controller);

        if (filterContext.RouteData.Values.ContainsKey("responseType"))
            controller.ViewEngine = new SerializableViewEngine();

        base.OnActionExecuting(filterContext);
    }
}

As you can read about here (if you haven't already), ActionFilters are the perfect way to "inject" behaviors into your controllers.  I like to compare them to the ol' Web Forms ASP.NET Page Lifecycle events such as PreInit, Init, PreRender, Render, etc. that let you plug in to the various stages of processing a request and allow you to manipulate it accordingly.  For example, by overriding the OnActionExecuting method on the ActionFilterAttribute as shown above, you can plug into the request after it's reached the controller, but before any action has actually been taken on it.  I believe I could have also used OnActionExecuted to accomplish the same thing since I'm only setting the ViewEngine, but that just didn't "feel" right.

Using this new custom ActionFilter, I could apply it at the Action level - or the Controller level if I wanted to apply it to all of the controller's actions - and get rid of those silly duplicate Actions.  Now, instead of having the AsyncCategories Action shown above (which is assumedly just a duplicate of some other Action, perhaps called Categories) that explicitly overrides the ViewEngine with every request, I can now drop the line that sets the View Engine and let my new ActionFilter take care of setting it for me when it is appropriate!  In other words, the code above now turns into the code below, which handles both "regular" and AJAX calls with the same code!

Removing the ViewEngine code from the AsyncCategories Action

[SerializableViewData]
public void Categories()
{
    var categories = repository.GetCategories();
    return RenderView("Category", categories);
}

The first time I successfully saw the result of running this demo was the first time the power of ASP.NET MVC really hit me.  This whole example was just a bunch of really small and straight-forward (dare I say 'simple'?) pieces that, when put together, create some really amazing and powerful results.

Grab the Code and See For Yourself!

You can see all of this stuff in action by downloading the code from my website:

 

I welcome any and all feedback y'all can throw my way.  Enjoy!

UPDATE:  As the beginning of the post says, these are what you can do with the Preview 2 bits.  With the addition of the ActionResult in Preview 3 and the related methods on ActionFilter, you can actually ditch the custom ViewEngine altogether and just use the ActionFilter!  Not the ActionFilter I show here, mind you, but an updated version I will show in an up-coming blog.  :)

Thursday, June 5, 2008

Douglas Crockford JavaScript Videos Online!

I was doing some JavaScript development earlier tonight, Googled an issue I was having and at the bottom of a blog post the author linked to a bunch of videos on Y! Video of a Douglas Crockford presentation, "The JavaScript Programming Language".  These videos are - hands down - the best use of my time spent learning JavaScript ever.

Here they are:

There is also an "Advanced" series, too!

Monday, June 2, 2008

ASP.NET MVC Firestarter - June 7th!

Are you interested in diving deep into the new ASP.NET MVC framework?  If so, come check out the NYC ASP.NET MVC Firestarter!


I'm not going to duplicate too many details here, but it's Saturday, June 7th, 2008 at the Microsoft offices in NYC (1250 Ave. of Americas). 

Check out this link for more information and to register!

Oh yeah - there's gonna be free food, too! :)

The Search for a Proper VM Host

The task that's been consuming my past few weekends (and a good deal of my weeknights) has been exploring various options for running various virtual machines on my desktop PCs (as opposed to my "server", which runs Gentoo Linux without debate or question).  "Why?" you might ask, and for good reason, since I am continually asking myself the same thing...  Even I am not sure that this is really the best route to go, but I'll try to enumerate my goals below which may shed some light on my rationale.

My Goals

  • Avoid the pain of dealing with pre-release software and frameworks.  I've always been incredibly interested in bleeding-edge technologies and releases and being an early adopter often has its painful side-effects.
  • Avoid bloat.  Keep it "clean and simple." I'm a minimalist and I don't like bloat.  Visual Studio may be the best .NET IDE around, but it's friggin' huge!  I may use it (and my other development tools) a lot, but I don't consider them part of my "core OS/tools".  When I boot up, I want to be up and running as quickly as possible; and when I'm running, I don't want anything other than what I currently need (and that includes stupid OS "features") to be hogging my resources, be it CPU, RAM, or even disk space.  I want to load those those in their own VM and turn them off/on when I need them; having them in their own VM also gives me the freedom to store them wherever I want and even transport them other places (like work)!
  • Be "Agile".  The key to agility is being able to do things quickly.  I also think a key part of Agile development practices is being able to not only try something just to see how it turns out, but the implied converse of easily being able to roll back to a clean environment before you tried that thing out.  Applying this principle at the OS level is a very powerful concept.  (This is very closely related to the first bullet-point above)
  • Run Linux as much and where ever possible.  This one has no real logic to it - it's completely emotionally-driven.  I love the idea of the power I get running Linux and I'd like to harness that power wherever possible.  The downside to this (as I found out in this process) is that the UI in Linux really sucks;  it's ugly to the point of un-usability.  (Yes, I know function, experience, and style are very different things, but in this case style overrules them all.)

My Stabs at Success

  1. VMWare ESX Server.  This looked like the ultimate answer, since it appeared to serve all of my goals above.  Unfortunately, the install for ESX didn't really go very smoothly (not to mention the fact that it was slightly, ah, "questionable" - legally speaking - to begin with...) so I gave up on it quite easily.
  2. VMware Server on Ubuntu JeOS.  I downloaded and burned a copy of this at 3 AM Saturday morning, but never installed it.  Why?  'Cause I re-read its overview and saw that it is meant to run ON a VM host, not act as one!  Stupid (actually, time for bed...)!  Luckily I only wasted about 20 minutes and a CD downloading and burning it.
  3. VMware Server on Ubuntu Server Edition.  Well, I got everything up and running with minimal overview...  Then I realized I didn't just need to host VMs...  I needed to be able to "consume" them on the same machine!  DOH!  In retrospect, this was an incredibly blatant oversight.
  4. VMware Server on Xubuntu.  Now we're on to something!  Linux host with very minimal overhead - I had the whole system up and running, hosting VMs, and running the client with only 600 Mb RAM.  This was awesome, and it met all of my goals.  Problem was - it met them a little too well.  Sure, I wanted a minimal system to host VMs with no bloat, but the fact is, I kinda wanted some of that bloat.  IM, Twitter, and even Microsoft Office are the types of things that I want available all the time and not things I want or need to virtualize.  Sure, there are OSS replacements or workarounds that can handle pretty much all of my needs, but I came to the sad, sad realization that Linux as a desktop just plain sucks.  It's powerful, sure - but it looks like crap, and that makes it just plain dreadful to spend most of your time in... especially in a "minimal" environment like the one I was shooting for.
  5. VMWare Player on a trimmed-down Vista.  Luckily, I was trying out all of the previous attempts on an extra HD, not actually overwriting my existing Vista install; an install which, quite honestly, I never intended to completely replace as I do play games on it occasionally.  This is the solution I eventually settled for (at least for now), since it seemed the best compromise of all my goals, including those hidden ones I discovered along my journey.  I'm wondering, though, if this really is the best solution...  For starters - you'll notice the other solutions involve VMWare Server whilst this one uses Player.  That's right - since I'm on a 64-bit machine and stupid Vista doesn't allow non-signed drivers (and for some strange reason stupid VMWare doesn't provide signed drivers for Server), I'm left with the crappy, non-feature-ridden VMWare Player.  Which sucks.  Oh yeah, and did I mention Vista is bloaty!?

The Bloat that is Vista

Even after I spent quite a while picking and choosing which services to kill (practically all of them - including Themes - except the bare system ones) in order to make my Vista install as lean as possible, it still took up 15% of my total 6 GB of RAM!  Here's a few screenshots of my system after it's booted up before I've run anything (except SnagIt and FolderShare):

Vista - Memory Hog Vista Task Manager - Full

That is not my idea of "minimal", especially compared to my Xubuntu install!  I don't have a screenshot of the latter, so you'll just have to trust me when I tell you - 617Mb.  A fully-running system (including X & XFCE Window Manager) took 617Mb of RAM... and that was without any real attempts at minifying it any more than the default install!  Now I'm left wondering what a stripped-down install of XP would look like....

So, I'm back to square one - facing the dilemma that I've been tortured with for the past 6 years since I began using Linux: suffer with the unsavory UI and awkward UX that is the Linux Desktop, or deal with the bloat that is Windows.

It really is a no-win situation.

Sunday, April 20, 2008

Central New Jersey MS Certification Study Group

We had our inaugural meeting of the "NJDOTNET Spring '08 MCTS Study Group" this past Thursday, and I thought it was a wild success!  I had just under 30 people register (express interest) over the past few weeks, about 5 email me before the meeting to let me know that they wouldn't be able to attend this first one (but, yes, they are very excited!), and an even 20 people actually show up.  I sure am happy with those numbers!  My favorite part about the whole thing is the positive energy and just raw desire to dive deep into .NET that all of the members are showing.  It really is a great thing to know that you'll be able to meet up with these people (and this energy) for at least a few hours every week.

For those of you who haven't heard through the various other channels, we can still squeeze a few more members in.  So, if you're interested in getting your MCTS certification in Windows Forms or ASP.NET, please feel free to let me know.  We meet every Thursday night at 6:30 PM at the Infragistics headquarters just outside of Princeton, NJ.  Check the NJDOTNET Website for more information, including directions.

Using Plain Old WebForms Controls in your ASP.NET MVC Views

Still wanna use all those nifty controls that you had access to back when you were developing in the Dark Ages of WebForms?  Well, you can!  ... sort of.

If you're like me, one of the first things you did when you started writing your first ASP.NET MVC app was say to yourself, "Hmmm... wonder what happens when I drop this TextBox control on my View?"  I don't think anyone is surprised when you see something along the lines of "[...] type 'TextBox' must be placed inside a form tag with runat=server."  I'm sure most seasoned ASP.NET developers have gotten this error at some point in your coding life when you're writing a new page from scratch and forget to wrap your page in that oh-so-important "<form runat='server'>" tag.  What you may or may not know (I didn't realize this until I got into MVC Land and tried it) is that not all tags have this constraint.  Tags such as the Image tag (and a handful of others) are just there to generate markup and don't really care whether or not they're in a form.  Feel free to litter your pages with them and they should do some pretty good work for you.  Unfortunately, tags like TextBox and his cronies really like the secure feeling they get by having that nice warm <form> tag wrapped around them.  And - after all - things like <input> tags are "form" elements, right?  It's understandable that they need the <form> tag to live.

...or do they?

The short answer is, "Yes, they do."  In order to use these controls - the visual representatives of the Web Forms Way - the way that you're used to, they do need that <form> tag and all that it entails (like ViewState - ech!).  However, that answer simply wasn't enough for me.  When I switched over to ASP.NET MVC, I knew that I was going to lose a lot of the convenience that WebForms and ViewState gave me... but I also knew (or at least hoped!) I'd be getting rid of the problems that came with it, too.  So, I'm already in that mindset when I'm working on my MVC app, but I get frustrated when I have to copy code all over the place to generate "static" HTML like image buttons and the like.  Like I am with the MVC framework in general, I am more than willing to give up the advanced features of the Web Forms controls (like event handling and the like) if only I could just continue to utilize the markup they generated so well.

So, my mission was simple: I needed a way to get rid of that error message and allow these controls to generate the HTML I so desperately missed.  And - lucky for me - I found a way!  here's the magic:

Avoiding the Error
    public class BaseViewPage : ViewPage
{
public override void VerifyRenderingInServerForm(Control control)
{
return;
}
}



That's it.  Just overriding "VerifyRenderingInServerForm" on the ViewPage keeps the error from occurring and lets the controls try to output the markup they are tasked to. 



I'll be the first to say - this works with varying degrees of success, depending heavily on which control you're trying to use and how you're trying to use it.  But, hey - anything is more than you had before, right?  It's a neat little trick that may end up saving you from having to duplicate some of the work that those bright folks at Microsoft have already done for you.  And, it may just help you make your markup a bit cleaner.

Tuesday, April 15, 2008

Unit Test Project Structure

I recently came across Phil Haack's interesting blog post and associated poll about structuring your unit test projects - do you have separate unit test assemblies or not? - and was not entirely surprised by the results.  They were more or less in line what what I'd expect.  At the beginning of my TDD "career" I'd actually considered for a brief second whether it'd be better to put my unit tests in line with the code they're testing (not "inline" as in the same file, but close) or in a completely separate assembly.  After a few minutes of thought, I came away with what it seems most other people come away with - and emphatic "NO!"  I'm honestly left wondering - and I don't mean any disdain, but - what are these 8% of "Yes" voters are thinking!?  Is it laziness, or some other motive that I'm not getting?  Really - I'd love to know!

Sunday, April 13, 2008

NHibernate Lazy Loading Snafu

Oh, man did I get thrown for a loop last night... 

I've got a test project I'm working on that uses NHibernate.  In this project, I've got a Building class, which has an Address attribute, of type Address, for which I overrode the ToString() method like so:

image

I've also got a page that grabs a bunch of Buildings from the NHibernate session and binds them to a Repeater.  For my initial tests, just to see if everything worked, I just bound right to the Address property on the Building in my markup and everything worked fine.  That is, the address printed out just as it was supposed to - in just the right format I'd set in the ToString() overload.  Then I went to refactor the page and break the address out into it's individual bits to show them in a slightly different way...  and was greeted with a null reference exception!

I was troubleshooting for a good half hour or so before I came across this dialog:

image

WTF!?  How in the world could my ToString() overload be generated correctly when all of its properties are null!?  And then I realized - lazy loading!  D'oh!  I went to my NHibernate mapping file for the Building class and updated it, adding the "lazy='false'" attribute, so it ended up looking like so:

image

and now everything works like a charm!  This fix doesn't really bother me because the Address probably shouldn't have been lazily loaded to begin with, but I never did end up figuring out how exactly that AddressProxy was able to give info to my ToString() override but was not nice enough to populate my properties for me!  Looks like I've got to learn about lazy loading and NHibernate Proxy classes!

If you've got some ideas on how this happened, please leave a comment - I'd love to know!  But for now, I'm just happy I figured it out!

Wednesday, March 26, 2008

ASP.NET MVC ViewData Extensions

I've been playing a little bit with ASP.NET on my own (outside of the CodeCampServer project that I'm involved with) and I'm starting to really find out the cool uses and limits of the new framework the ASP.NET team has released to us.  The most awkward thing IMHO is dealing with ViewData; specifically, having to jump through hoops to get typed data out in your view when all you want to do is just use it and not really have to worry about it.

Out of the box, there's System.Web.Mvc.ViewPage which is what all of the beginner samples say to use.  Then, once your needs evolve a bit (just a bit is all it takes - you grow out of that quite quickly!) you realize that you need a way to easily access typed data in the view.  The MVC framework's answer to that (at least in the Preview 2 bits) is the generic version of the aforementioned ViewPage class (appropriately System.Web.Mvc.ViewPage<T>) which allows you to pass in one type to use as your ViewData.  This is a step in the right direction, but it still falls short since you find yourself creating all of these new classes just to hold a bunch of different types of view data and it often ends up being one new, custom class per page/view...  hardly a reuse of code there, and very (uncomfortably) reminiscent of Web Forms style development.

You need a middle-ground - a nice way to interact with the ViewData collection in a strongly-typed way, but without having to create new classes to go along with each of your new views.  Jeffrey Palermo came up with a nice way of handling this with his SmartBag (that he describes in this post and subsequently implemented in the CodeCampServer project).  I really liked the idea at first because it solved a problem and it did it pretty well... not to mention somebody else did the work of creating it for me so all I had to do was just use it. :)  However, when I tried to start using it in my projects, it became all too clear just how much work Jeffrey had to go through to introduce it.  After thinking for a bit I remembered a powerful new tool that .NET 3.0 has provided us with - Extension Methods!  With these, you can tack on functionality to pretty much any class - or even interface - you want, and so I started tinkering...

What I came up with was a set of extension methods on top of the Controller.ViewData property's type (IDictionary<x,y>) to make adding the strongly-typed data a lot easier using generics...  very simple, but very powerful and very helpful.  Then, going back to the whole impetus for this mess - I made a matching set of extension methods on top of the ViewPage.ViewData property (which is of type ViewData, interestingly enough) to help get access to the values we so easily tucked away using the Controller.ViewData extension methods.  I've been using it for a few weeks now and it seems to be working like a charm!

Without further ado, here's the code!

The Add Extension Method (to get data IN)
                
/// <summary>
/// Add a value to a dictionary, using its type name as the key
/// </summary>
/// <param name="dictionary" />Dictionary to add to</param>
/// <param name="data" />Data to be added</param>
public static void Add(this IDictionary<string,object> dictionary, object data)
{
// Get the object's type name to use as the key
string typeName = data.GetType().FullName;

// Check to see if it already exists and if it does, throw an exception
if (dictionary.ContainsKey(typeName))
throw new System.Data.DuplicateNameException(typeName);

// Add the data to the dictionary using the type name as the key
dictionary[typeName] = data;
}

And then, to pull it back out on the view, I added these Extension Methods to the ViewData class: ViewData Extension Methods

   
/// <summary>
/// Get the object saved in ViewData of this type.
/// </summary>
/// <typeparam name="T">Type of object to get</typeparam>
/// <param name="viewData" />ViewData collection to retrieve from</param>
/// <returns>
/// The typed data value (if found).
/// Otherwise, the default value for type T.
/// </returns>
public static T Get<T>(this ViewData viewData)
{
return Get<T>(viewData, typeof(T).FullName);
}
/// <summary>
/// Get the object saved in ViewData of this type.
/// </summary>
/// Type of object to get</typeparam>
/// <param name="viewData" />ViewData collection to retrieve from</param>
/// <param name="key" />The key used to save the data.</param>
/// <returns>
/// The typed data value (if found).
/// Otherwise, the default value for type T.
/// </returns>
public static T Get<T>(this ViewData viewData, string key)
{
T returnValue;

if (viewData.ContainsDataItem(key))
returnValue = (T)viewData[key];
else
{
// Since we're in the view, just play nice
// and return the default value if it the
// key doesn't exist.
returnValue = default(T);
}
return returnValue;
}


Simple enough, but I find them to be wicked useful! I hope you will, too.



Edit: I noticed as I was looking through the CodeCampServer source tonight (just after finishing this post, no less) that Jeffrey had actually updated his SmartBag concept to something much more along the lines of this. Hey, I never said it was incredibly original, but it sure is nice to have your thoughts validated by someone else (especially one as knowledgeable as Jeffrey!).

Sunday, March 23, 2008

MIX 08 Recap

I got back from MIX 08 two weeks ago and I think I've just about recovered.  Not only from the conference (and Vegas) itself, but the hole 1+ month of heads-down coding that came leading up to it.  I've finally gotten some time to come up for air and talk a little but about my trip and some of the cool things they were talking about.  It was a dangerous conference this year - what with one presenter falling off the stage and another one actually passing out - but the risks were certainly worth it, having gotten to see a whole bunch of really cool, exciting things.

I'd have to say one of the coolest parts was the keynote, complete with a Deep Zoom demo and Scott Guthrie juggling.  There were quite a few interesting topics in here, but one of my favorites had to be the showing-off of the up-coming Silverlight 2.0 application that's going to be leading NBC's online Olympics coverage later this summer.  We've had Picture-In-Picture technology for quite some time - and in fact I never really saw much value in it - but there was something amazing about seeing in on the PC... and in your browser, no-less.  Traditional TV-based PiP always seemed so clunky and annoying to use to the point that it just wasn't worth setting up, but offer a mouse and keyboard interaction and all the sudden it's become much easier and much more practical!  Truly awesome.

Also during the keynote I also noticed a UI paradigm being used that I'd seen plenty of times before, but had not realized the power of until now - the "baseball card" effect.  It was shown in the context of an HR management app (or something like that) where the user scrolled through a sort of virtual Rolodex.  I'll try to explain the concept that struck me by using an example:

You start out with a whole bunch of "cards", each with two sides:

  • Each of the cards has a "front", which contains a picture (say, of a client) and the general overview or the important details, such as a persons name and general location.
  • Then they each have a "back", which has little to no graphics, but is more data-oriented.  Here you might find the client's full information, included detailed address, phone number, likes, dislikes, etc. much like you'd find a baseball player's stats on the back of a baseball card.

There's an important third aspect (or dimension, if you will) to this whole equation that UI frameworks like WPF and Silverlight bring to the table that haven't been readily accessible to most developers until now - animation.  Well, that's the functional tool we've been provided with...  the real power is using this now tool to give us the ability to make a painless switch in context between the front and the back of these cards by using an animation of the card flipping over.  The important link that this creates that of the card's front and back and not just switching between two "pages" that just happen to have detail about the same person. Instead, it allows us to make a more physical link between the two sides by representing them as being two parts of the same whole by showing the whole motion of "flipping the card over".  What's really cool is that this is a concept that you can further exploit by collecting many of these "cards" - each one containing data for a specific person - and do things with them, like shuffling them, pouring them out onto a table, or stuffing them into a virtual Rolodex.  These paradigms certainly aren't new, it's just that they were - until recently - only available to visual designers and those with madd grafikal skillz.  Well, not any more!  Now all you need is a bit of XAML knowledge to start harnessing these powerful paradigms - how exciting!

Saturday, March 22, 2008

ASP.NET MVC Framework Sample Project (CodeCampServer)

Back in early January, I jumped at the opportunity to answer Jeffery Palermo's call for OSS developers to help out with his new project dubbed CodeCampServer and used as a vehicle for exploring the new ASP.NET MVC Framework.  I had hit the ground running and helping out in any way I could with a bunch of checkins and chatter on the groups and learned a lot.  Unfortunately, the whole of February I was pretty much heads-down coding Infragistics' new property - Pixel8 - so I wasn't able to be as active as I'd hoped, but I'm looking forward to getting back into the loop and back into churning out some code.

Before I joined the project, I have been a pretty avid reader of the CodeBetter blogs for some time and for the most part I really appreciate not only what they have to say but especially the new concepts, ideas and viewpoints they can provide.  I often related most with Jeffery's posts and being involved in a project with him has been not only fun but incredibly educational.  Jeffery's emphasis on agile methodologies and concepts - particularly TDD and composition over inheritance - were a refreshing change from what I've been traditionally exposed to and it's nice to start branching out.

CodeCampServer is definitely only going to be a nice, useful piece of software.  However, I think its best use may just be as a learning tool for anyone looking to dive in to any of the myriad concepts and practices the project exemplifies, such as:

  • ASP.NET MVC (of course...)
  • test-driven design and development
  • composition over inheritance
  • using StructureMap
  • using NHibernate
  • setting up a build environment using NAnt
  • ...and probably many more that I'm not even able to pick out!

So, if you're interested in learning about any of those topics, be sure to head on over to the CodeCampServer source code repository browser available online and glance through the code... or download the whole lot and run it for yourself!

It's been a real joy to be involved in this project, and I'd like to thank Jeffrey and Ben for working so hard to set it up and keep it going.  Plus, if the quality of their up-coming book is anything close to the quality of this project, it's bound to be an incredible tomb of knowledge.

ASP.NET MVC Source Code Released

Just found out some cool news a little while ago:  the ASP.NET team graciously released the source code for their new wicked-cool framework on Wednesday.  You can get it at their CodePlex project http://www.codeplex.com/aspnet (and here's a link directly to the download page).

This is a great development in the ongoing push that Microsoft seems to be making to become more and more transparent... or at the very least more agile.  And, I must say - I do like it!  So, if you haven't gotten a chance to play with the MVC framework stuff yet, go grab all the bits; if you have already been playing with it, now you can check out the source, too!

Tuesday, March 11, 2008

Pixel8 is born!

I've been heads-down coding for the past two months or so, trying to get a whole slew of things ready and out for MIX '08.  Now that MIX is over (and I'm back and recharged from Vegas - ouch!) I can finally get back to doing some blogging.

The major project I've been working on during my 9-5 (ha - yeah right!) is the recently-released Pixel8 (http://pixel8.infragistics.com).  It's Infragistics' newest web property - adding yet one more to the exhaustive list of sites under my purview - with relevant development pod- and vid-casts streaming through our Silverlight media player... and I think it's pretty darn cool.  It all started when late last year we were finally able to woo Craig Shoemaker of Polymorphic Podcast fame to come work for us and keep churning out his awesome content, but let us still our name on it... and man has he delivered!  It's been only days since we released the site and we've already got over 8 audio and video shows live and ready for public devouring.  This was a really exciting project for me not only because I got to work side-by-side with Craig, but also due to the joys of working with the ASP.NET AJAX framework, ASP.NET Futures controls, and of course Silverlight (albeit only 1.0...).  I had a lot of fun and learned some valuable things.

So, if you've got a few minutes - or a few hours - to kill, head on over to http://pixel8.infragistics.com and fire up our new player and watch some shows.  I'm sure you'll enjoy what you see.

Saturday, February 16, 2008

Server-Side ASP.NET Variables Meet Client-Side JavaScript

I came across Rick Strahl's awesome blog post tonight about something that's consistently been a thorn in my side: I've got an ASP.NET variable/value (say, a control's ClientID, or "a $Ch~!'unk of T==ex_t '1'$li%20ke"`th"is~!") that I want to populate a JavaScript variable with on the client side.  My first instinct has always been to just do a handy little in-line <%= MyVariable %> and for the most part that usually works... for the most part.  But, there are plenty of cases - such as special characters, encoding issues, or simply the fact that you're trying to mix inline code with external (aka - static) script files - where this solution won't work.  However, Rick's nice little class takes a stab at addressing that problem, and I think it does it pretty darn well.  I'm looking forward to trying this out in my next project.

Keep 'em coming, Rick. :)

Wednesday, January 9, 2008

Upcoming Community Events (Central New Jersey)

If you're in the central New Jersey area for the next few weeks, we've got quite a few great events coming up:

 

Thursday, January 10th:  NJDOTNET User Group Meeting - A Developer's Introduction to Sharepoint

Come join us at the Infragistics World Headquarters for the Princeton area NJDOTNET User Group this Thursday night at 6:15 PM for a great talk given by our own Todd Snyder!  I've had the pleasure of working relatively closely with Todd since he joined us at Infragistics a few months ago, and I can certainly tell you that he knows his stuff - Sharepoint in particular.  This should prove to be a very interesting event!

Click here or the header above for more info!

 

Saturday, January 12th:  Philly.NET Code Camp

Unfortunately, the registration period for this event has already closed, but maybe if you beg somebody over at the philly.net group, they'll let you in. :)  They've got a lot of great speakers and topics lined up so this, too, should prove to be a great event.

 

Saturday, January 26th:  New York City - Silverlight 1.0 Firestarter

If you missed the Silverlight Firestarter down in Philly last month, you missed a great time.  And, if you haven't even got a clue what Silverlight is, you're missing a whole lot more!  Luckily, the guys up in New York City have got you covered with their upcoming Firestarter event at the end of the month.  With a number of sessions throughout the day, developers with any level of Silverlight knowledge should be able to get a lot out of this event.  Click the link above for more details.

Sunday, January 6, 2008

Silverlight Logging

I was recently referred to a great article over on CodeProject showing how to implement client logging in your Silverlight apps.  In addition to being very informative (even going into describing the Silverlight code Security Model!) I found it to be a very inspiring article.  It is well-written with great visual aids (screenshots, component and flow diagrams... you name it!).

Basically, it all boils down to calling a logging method (ala log4net) in your Silverlight app, which then decides locally (based on a config you've downloaded from the server) whether or not to call the web service on the server with the message.  On the web service side, you've got "strategies" defined that determine how to process the messages, usually by delegating to another logging framework such as log4net (as in the example included with the article).

Simple and effective.  Just my style!  Props to Daniel Vaughn for the implementation and the incredibly coherent article!

Wednesday, January 2, 2008

Viva Las Vegas: See You at MIX '08!

I recently found out that I'm one of the lucky ones whom Infragistics is sending to attend the Microsoft web developer event of the year - MIX '08!  Getting to see such rockstars as Steve Ballmer, Scott Guthrie, and even Guy Kawasaki in person is really exciting... not to mention all of the other cool presentations, workshops, and panels.  This is the event I look forward to going to every year (and only partially due to the fact that it's in fabulous Las Vegas) and this year is certainly no exception.  Here are some of the topics I'm really excited about seeing this year:

  • ASP.NET MVC pattern
  • Windows Live platform
  • Dynamic SharePoint Websites
  • REST w/ ADO.NET Data Services Framework ("Astoria")
  • A whole slew of Silverlight stuff
  • and much more!

So, if you're a web developer, designer, manager... heck, if you even surf the web, you should definitely come and check this show out!

I haven't yet figured out my exact schedule as far as which sessions I'll be attending, but I'll definitely be attending the opening party at TAO...  and after hours you'll almost certainly find me at the 3-6 table across the street at the Mirage.  :)