This blog has, IMO, some great resources. Unfortunately, some of those resources are becoming less relevant. I'm still blogging, learning tech and helping others...please find me at my new home on http://www.jameschambers.com/.

Thursday, July 2, 2009

*Sigh*

You take a couple of days off for your birthday and you’re left with 446 unread emails in your inbox.

I will try to get back to everyone as quickly as possible; thanks again, all for your interest in this blog, WPF and my messings with SQL Server (particularly the posts on splitting strings and converting IP Addresses).

I am attending a conference in Michigan for about four days starting Saturday…I fear the state of my inbox when I return!

Tuesday, June 30, 2009

Why You Should Always let Your Kids Visit You at Work…

On a day when I’m fighting with WCF, WPF, polling and MVVM my 5 year-old son visits and draws me a picture:

image

He says I’m the really tall superhero with the big blue light sabre.  The little guys are evil coders that Daddy is going to squash.

This from the kid who tells everyone he wants to be a geek like his Dad when he grows up.

Man, kids sure know how to put a smile on your face…

Monday, June 29, 2009

TimeSpan ‘Ticks’

Using a bit of a misleading nomenclature, one of the constructors for TimeSpan uses ‘Ticks’ to initialize the object.

I have been using Environment.TickCount for eons, it seems, where 1000 ‘ticks’ equals one second.  Because of some of the processing I’m doing right now, I decided to use DispatchTimer to simplify pushing info back to the UI thread from background data refreshes.

Here’s some code that looks innocent enough:

_dispatchTimer.Interval = new TimeSpan(3000);
_dispatchTimer.Tick += new EventHandler(dispatcherTimer_Tick);
_dispatchTimer.IsEnabled = true;



Unfortunately, when run, the timer is firing (or at least trying to) approximately every 1ms.  Which…is about as fast as it’ll go.  In fact, I was getting 12-16 lines of output in my logger from the tick event firing about every 11ms. Oops.



Now, had I read the tooltip from the constructor or otherwise checked the doc’s, I would have seen that TimeSpan actually accepts ticks as 100 nanoseconds.



So, in passing in 3000 as the parameter for the constructor I was actually telling it to tick every 0.000003 seconds. Nice.



Ahem. That should read:



_dispatchTimer.Interval = new TimeSpan(30000000);

…if you don’t want your UI wiggin’ out.

Wednesday, June 24, 2009

Direction on WPF and MVVM

Karl Schifflett, one of the key players in the WPF arena, is now working at Microsoft.  I don’t follow him close enough to know when he made the switch (I think earlier this year), but I am hoping that this will start to clear some of the waters.

The WPF Toolkit on the CodePlex website gives us a project template from  the folks working on WPF at Microsoft.  This is a great start, but it collides in some regards with Karl’s work in the Power Toys.  On top of that, there are very respectable folks out there blogging their thoughts and pattern approaches to MVVM for both WPF and Silverlight.

I know that patterns are just that: patterns.  They aren’t the be-all and end-all of development practices and you can’t adopt them as policy.  BUT, I would argue, those who share that view – and take an honest look at it – also know that using patterns in everything you do is a little bit of an academia dream.

I’m fortunate at the company I’m at now, but previously I have had very few managers who know GoF-speak.  In fact, as recently as the last few years I have worked at shops where they wrote, flat-out adopt patterns as policies as the law, failing your code review if you don’t use the pattern as a law-abiding coder should…even if it’s the worst possible approach to the solution.

So when I say I’m hoping for clearer waters in the MVVM pattern, I’m not asking for one source of guidance that I can accept as law; rather, I’m hoping that – with some of the bigger minds in this space now working together – that the tools and the pattern can start to enjoy a more unified growth.

Ultimately, what would be nice, is when we as imagedevelopers can sit in a room together, bring up MVVM and not all have a different picture in our minds as to what we’re actually talking about.  I’ve never, in bringing up Abstract Factory, been asked, “Oh, do you mean Frank Geevers implementation, or Garry Frank’s?”  It’s just…Abstract Factory.  And people get it.

I’m getting the feeling we’re getting close to this.  There is a good set of WPF folks at MS, the developer credited with MVVM works there, now Karl, Jamie Rodriguez as well…

I guess the one drawback would be the other side of the trap: Microsoft releases a toolkit and guidance on the Patterns & Practices web site and then managers start making that the law…and likely for web services, too. :oS

Tuesday, June 23, 2009

The ‘New’ Rapid Prototyping

One of the people I highly regard in the MVVM/WPF spectrum is Karl Schifflett.  Not only has he contributed some absolute gems to the coding world through his blog, but he has co-conspired to open the gates to the WPF internal rendering and visual tree engine that, for many once-WinFormers-would-be-WPFers is so foreign to how they roll.

Confession time: I feel pure geek here.  I highly anticipate the next release of XAML Power Toys.  If that doesn’t come across ‘geek’ enough for you, how about this: I am actually looking imageforward to excited about the incremental version of a plug-in for an integrated development environment that leverages the existing XAML tools and adds code-generation and LoB application rapid prototyping.

Mmmmm.  Prototyping…

Anyways…I have put out a couple of suggestions that Karl is working into his next build.  Sweet. 

Raven (the project I’m working on) is growing up quickly and the rapid release schedule of the application does not really allow for, say, time to do things like code my own forms.  Working with the XAML power tools I am able draft the first few versions of a form before we start the styling and business rule authoring process.

This turns out to be very productive.  There are three apps now in the wild for Raven – Prospect, QueueMonitor and HelpDesk – and this was achieved in just three short months.

I have been able to spike out the customer stories in hours rather than days, and using a direct connection to the dev or test database (using LINQ to SQL…another prototyping tool in my developer’s Swiss army knife) and the XAML Power Toys, I can actually stitch together forms with real data that the users recognize.  This lets them get past the visual deficiencies of the iteration much more quickly.

Steve Jobs Kills Innocent 17 Year Old Girl

…well, not really.

But, indirectly, he singlehandedly exposed a health care system that allowed a girl to die.

He then manipulated it to ensure that he wouldn’t, but still hasn’t refunded my money for the crappy iPod that always freezes.

Congrats to everyone who buys Apple products: your evil leader will be back to lead the demons soon.

http://www.msnbc.msn.com/id/31509368/ns/health-health_care/

And, by many accounts, there are far less selfish actions exerted by those on the other side of the ‘glass’:

On the evidence, [Steve Job] is nothing more than a greedy capitalist who's amassed an obscene fortune. It's shameful. In almost every way, Gates is much more deserving of Jobs' rock star exaltation.

Article on the Apple Cult’s leader: Cult of Mac

Friday, June 19, 2009

Mobile Device Browser File

Okay, either people don’t know about this, or it’s being distributed in other ways.

The team that runs the web servers for Microsoft has compiled a list of nearly every available mobile device type that has requested a page from its servers (using services like Live, Hotmail, etc).  The compilation includes an incredible set of over five dozen properties exposed about the mobile browser used on that device.

If you write applications for mobile devices, you need to be using this!  Because each device might be in horizontal or vertical mode, because the screen sizes vary, because different devices can playback different kinds of media, because some mobile devices might support AJAX…because of a whole host of things, if you are writing web applications for mobile devices using ASP.Net you really need to get plugged in here.

Here’s the project site on CodePlex: Mobile Device Browser File

Now, what gets me is that there are so few downloads.  Even the one that’s been around longest has not even 700 downloads!

What’s so beautiful about this nonsense I’m going on about?  Well, check this out:image

Simply by dropping the mobile.browser file in a folder in your project you gain instant capabilities detection from the existing framework, without a line of code.  Except, of course, to check the capabilities.

How easy is this:

if (Request.Browser.IsMobileDevice)
{
if (int.Parse(Request.Browser["ScreenPixelsWidth"]) > 240)
Label1.Font.Size = 40;
else
Label1.Font.Size = 20;
}


Now, you are likely to do something more interesting, like serving up appropriate image types for the devices.



Either way, when you pair this with ASP.Net MVC you start to get some very interesting things going on, as Scott Hanselman wites.



I just can’t believe more people aren’t developing in the mobile space…or don’t care to leverage this powerful resource!