About the author

J Sawyer is a developer based in Houston, TX who absolutely loves to write code. After spending 9 years at Microsoft, he moved on to other things and is currently the Lead Developer for the RealTime Data Management team at Logica US. He spends his days building Really Cool Things around StreamInsight and having a blast doing it.

He has been involved with HDNUG, one of the oldest and largest .NET-focused user groups in the US, since its inception in 2001 and has watched it grow from 5-10 technologists meeting around a conference table to a thriving community of over 5000 with regular meeting attendance averaging 100 attendees. He currently serves as the Vice President. You can join him at HDNUG on the second Thursday of every month at the Houston Microsoft office.

He also loves to ride his Yamaha FZ1. And sometimes his Ninja 650. And also his Honday XR-400 dirt bike. But he doesn't code and ride at the same time. That would be bad.

Parallel Computing …

July 29, 2008 9:26 PM

I’m up in Seattle right now at TechReady, an internal Microsoft conference with technical presentations and information for folks in the field (like me, of course). So … with that said, there will likely be the occasional post this week about something that I’ve seen up here that I can actually talk about.

The first thing is the parallel extensions to .Net. You can get a preview of these at the MSDN Parallel Computing Center. Keep in mind that it’s a CTP (that’s lower on the food chain than an official Beta) – and an early CTP at that – so there will be bugs and the performance won’t be as good as the final, RTM release. Also, be forewarned: the API may (OK, let’s be honest, it will) change before the RTM release. Still, it’s a good thing to play with because it gives you a good idea of where we’re going to enable developers to make traditional very hard things easy.

The hard thing that the parallel extensions address is multi-threading where concurrency between threads is required. Doing this right is actually a pretty significant undertaking and it’s really, really easy to get yourself all messed up and tied up in knots. And multi-threaded code has some additional challenges when it comes to debugging. Then there is the issue related to dividing the work to be done up among the different threads.

In the days of single core processors, where most applications weren’t running on multi-proc boxes, multi-threading was something that could help with UI responsiveness, but let’s be honest … work wasn’t really done concurrently. Sure, Windows would schedule your threads at different times and in some cases you could actually get somewhat better performance than if you used a single thread, but you didn’t nearly have the number of issues (and the challenges) that you have with multi-core processors. And in this day and age, multi-core processors have become very much the mainstream, entry level processor. I just looked at a Major Computer Manufacturer’s website and found that only the very, very lowest end systems had single core processors … and a dual core desktop could be had for as little as $359 (sans monitor, of course). Intel has dual-core Celerons (their “value” processors). And, of course, triple-cores (from AMD) and quad-cores are available … and I saw a desktop with quad-core for as low as $729. If, like me, you build your own systems from parts, a dual-core processor can be found for around $50 and a quad-core can be found for about $175. Eight-core processors aren’t going to be too far down the road (octo-core?) and I really doubt that it’ll stop there. Oh, and lest I forget, Intel’s HyperThreading technology looks (and in many ways acts) like multiple cores.

In order to take full advantage of this powerful hardware, developers need to rethink some of things that we’ve traditionally done with an eye towards multi-threading and parallel processing. It is a huge change to much of what we’ve done for years and it sometimes hurts the brain to try to follow the way the code executes … a single line of code could be executing on, say, 4 different threads literally at the same time. Yes, the Windows scheduler is still involved scheduling the threads for execution but now it’s got 2, 3 or 4 processors to execute the threads on. It’s not just appearances anymore. The parallel extensions to .Net make this dirt simple (I like dirt simple). It can be as simple as adding AsParallel() to a Linq query. Or use Parallel.ForEach() rather than a traditional for … each loop.

The demo that was showed did a couple of different operations (find, sum, etc) and compared the performance of the parallel with the non-parallel version of the same code. Even now, in the CTP, where the performance tuning hasn’t been done to any real extent, there was an improvement of 3-4 times. Pretty impressive.

Tags:

.Net Dojo – Date, Time and Location

July 29, 2008 8:34 PM

A reader from Austin pointed out that I didn’t specify these pertinent details about .Net Dojo. So, without further ado, here is the info:

Date: Thursday, August 28, 2008
Time: 1:00 PM – 5:00 PM
Location: Houston Microsoft Office

And, of course, the registration link so that you can sign up!

Tags:

.NET Dojo: ASP.NET MVC

July 22, 2008 7:37 PM

First, what's this .Net Dojo stuff? Well, here it is ... it is a new series of events (I'm hoping monthly) that we will be having monthly to help developers hone and sharpen their .Net Kung Fu. It will be a combination of lecture and hands-on labs ... lecture to explain the concepts (of course) and hands-on to let you get your fingers dirty playing with the technology. Since it is hands-on, you will need to bring a laptop to do the labs and (possibly) install some additional prerequisites before the session (these will be listed, of course). They will be held at the Houston Microsoft office from 1:00 PM to 5:00 PM and cover a wide range of .Net topics. I'm also hoping to be able to get some of the technical leaders here in Houston to deliver some of the sessions ... so that you'll be learning from the best around.

Ben Scheirman of Sogeti has volunteered to deliver the very first .Net Dojo on the ASP.NET MVC Framework. (Didn't I tell you that I wanted to get the best around?) Here are the details:

Overview: ASP.NET MVC is one of the key new features that will be included in .NET Framework 3.5 Service Pack1. It provides a framework that enables you to easily implement the model-view-controller (MVC) design pattern in your web applications, helping you build loosely-coupled, pluggable components for application design, logic and display. While not a replacement for traditional ASP.NET WebForms, ASP.NET MVC does provide a compelling alternative for developing web applications and better facilitates test driven development (TDD) in web applications. This workshop will dig into what ASP.NET MVC is, what it does, and how it is different from WebForms.

What you will learn: Through a combination of lecture and hands-on labs, attendees will learn how to create ASP.NET MVC applications using Visual Studio 2008 and how to work with the key components of an ASP.NET MVC application. Additionally, they will learn how to test their MVC components and applications using TDD principles.

Prerequisites: To fully participate in this workshop, attendees will need the following:

  • An open mind
  • A working knowledge of ASP.NET, C#, HTML and CSS.
  • A laptop with:
    • Visual Studio 2008 Professional or higher (Trial is OK)
    • ASP.NET MVC Preview 4 (available as a separate download.
    • A CD-ROM drive to load additional components and lab files.

Sign up here ... but hurry ... space is limited!

Hope to see you there ...

Tags: , ,

.NET Stuff | Events | Web (and ASP.NET) Stuff

C# SIG Presentation

July 22, 2008 11:59 AM

I have uploaded (finally) the presentation that I delivered to the C# SIG last Wednesday, July 16 to my SkyDrive. You can download it here.

I did make some little modifications to it though ... and they address one of the outstanding questions of the evening ... how does ASP.NET Role-based security work with ASP.NET Dynamic Data? Well, it's pretty simple and straightforward, actually.

Some background first. ASP.NET Dynamic Data uses SP1's UrlRoutingModule to map requests to the correct table ... with the name of the table appearing as a directory on the web site. So, when editing the "Products" table, the URL will be http://mydatasite/Products/[NameOfView]. Adding authentication and authorization for the entire site is a no-brainer; just add the authorization element into the web.config with the proper entries and you're done. Doing it for individual tables is just about as easy; in this case, you just need to add a location element to your web.config and configure the settings for the location. For example:

<location path="products">
  <system.web>
    <authorization>
      <allow roles="Products"/>
      <deny users="*"/>
    </authorization>
  </system.web>
</location>

In this case, we have defined a role called "Products" that can edit (and view, of course) the products table, but no one else can. This will behave exactly as would a "real" folder in any ASP.NET web site using role-based authorization with the built-in RoleManager (regardless of where the roles are actually coming from!).

As I said, I added this to the demos that I uploaded. All access to the site is authenticated; no anonymous users are allowed. There are 2 roles - Products, which can edit the Products table and HR, which can edit the Employees table - and 3 users. All users have the same password (Pass@word1). Here's the breakdown:

User ID Role
User1 HR
User2 Products
User3 <No Role>

 

You can, of course, get a bit more complicated than this, but you'd have to do some additional customization of the different pages to do that.

Tags: , ,

Community | User Groups | Web (and ASP.NET) Stuff

CORRECTION: C# SIG Tomorrow

July 14, 2008 5:05 PM

In my previous post, I said that I'd be talking about ADO.NET Data Service. I'm not sure what happened to my brain, but that's not what I told Harry. I will actually be talking about ADO.NET Dynamic Data. Hope to see you there tomorrow!!

Tags: ,

Community | User Groups