home

Moving: Back to weblogs.asp.net

Good news, everyone!

I tire of maintaining my own blog engine at windojitsu.com...  I'm moving my blog back to http://weblogs.asp.net/savanness -- now that they're running Community Server 2.x, and Live Writer has made it easier to post content with embedded screenshots and attachments. :-)  Also, comment-spam is now somewhat under control, so it will be nice to have a centralized feed w/ content + comments.

Here are the new-old feeds:

 

2007.01.12
AutoClaimsFX

In celebration of WinFX Beta2, I've attempted to recreate the Tablet PC SDK's beloved AutoClaims sample in WPF.

...all in 100% pure XAML!

Ok, admittedly it probably would've been easier to code some of those lengthy EventTriggers for managing the layers in C#.  And I'm a little bummed to discover than I can't set Panel.ZIndex in partial trust (else you'd be running this app in your browser right now, not reading about it).

Still, it's a fun exercise in what can be done with InkCanvas and XAML, with so few lines of code compared to our WinForms platform.  You really have to compile and run the mundane old WinForms version, and peruse the code, to appreciate this WPF rendition.

Enjoy!

 

2006.05.31
ScrollViewer for Lefties

Josh says “Windows Presentation Foundation (aka WPF, aka Avalon) is the best thing to happen to Tablet PC's.”

Josh, I couldn't have said that better...  well done!  (We're trying hard to live up to your expectations, anyway. :-)

This reminds me -- at a recent talk, I happened to mention (to a group of Tablet PC developers) how ScrollViewer could be re-styled to align the scrollbar on the left, for left-handed users.  The response was quite enthusiastic!  Here's the XAML...

2006.03.09
Real-time Ink in 3D: A Postcard from Stefan Wick

Hello from Redmond, we're enjoying the Feb CTP of WinFX, wish you were here...

PostCard.xaml

2006.02.22
Windows Vista + WinFX: Feb CTP

The 2006 February CTP of WinFX Runtime Components has been published! (Corresponding Windows Vista CTP coming soon, to MSDN subscribers.)

2006.02.22
WinFX Ink: Fun with VisualBrush

Just in case anybody who reads this doesn't read Petzold...

2006.02.03
WinFX: Fun with InkCanvas

Updated for RTM... and improved resizing/scaling experience w/ Viewbox!

Here's a fun little InkCanvas sample app... yeah that's right, it's tic-tac-toe.  What?  This ain't rocket science.  (It does, however, include source code for a very, very simple handwriting recognition engine. :-)

I got my web host to turn on the MIME type mappings for .xaml and .xbap files -- now you can play TicTacToeFX right in your browser (IE6-7)!

2005.11.22
Bug Bash

Excited to find that the MS-internal comic strip Bug Bash is now available to the masses...

2005.11.08
My Fifteen Minutes on Channel9

http://channel9.msdn.com/Showpost.aspx?postid=116335

2005.09.16
How to Tell When Your Team Thinks You Have an Ego Problem

The lead dev on my feature team filed an interesting spec-bug against me, today.  I think Sam's trying to say something...

2005.09.09
New Tablet PC Team Blog Online!

New Tablet PC Team blog is up on blogs.technet.com...

2005.08.05
Tablet at PDC

Some folk have asked about Tablet PC sessions at PDC...

2005.08.03
Digital Ink in Avalon

An introduction to the Tablet PC platform features built into Avalon...

2005.07.11
Physics Illustrator Hints

I've never really blogged much about Physics Illustrator -- the little animated shape-reco funlet for Tablet PC, inspired by research from MIT, that my homie Peter Gruenbaum and I wrote at Leszynski Group.

But some mates of mine asked me about it last night, and I googled it... whoa boy!  I've never seen such love and praise written about any piece of code I've touched.  Here are some hints, along with a few PI downloads, worth perhaps a few extra hours of fun...

2005.05.22
Snipping Tool Hints

Some usage and setup hints for v2.0 of Microsoft Snipping Tool for Tablet PC...

2005.04.28
Avalon: March CTP bits now available

The March CTP release of Avalon and Indigo is now available, to MSDN Subscribers...

2005.03.17
Winding down from VSLive / MWA

The Microsoft Windows Anywhere (MWA) side-show at VSLive in San Francisco was a lot of fun...

2005.02.14
A Bug Story

The story of a horrific bug in PrinterSettings.get_InstalledPrinters, leading to an occasional, hard-to-repro OutOfMemoryException...

2005.01.13
Come see me at VSLive / Windows Anywhere...

...this Feb 6-10, in San Francisco. I'll be giving a talk on Advanced Tablet PC Development Topics.

2005.01.11
ResXCop

Scans ResX files to warn about embedded binary image resources (which may silently thwart your ability to build and run your code down-level) and optionally removes the offending blobs and back-ports any/all CLR version references to v1.0.3300.  ResXCop takes a slightly more aggressive stance than VSConvert, which leaves the binary data intact, except for the frightening business of back-porting CLR version references in the midst of the base64 stream...!  Not only do I not want to go there, but for reasons described here, I don't want to maintain copies of my binary resources in ResX files, at all.

2004.12.23
I Hate ResX Files

This holiday season, rather than warmth and cheer, I'm filled with cold, hard hatred -- for .resx files...

2004.12.23
Using WeakReference to Avoid Leaking Event Subscribers

Updated: I'm officially killing this blog entry... there are just too many bugs, problems, and general complexities using WeakReference to track event subscribers, in the way I was attempting.  I encourage everyone to read Ian Griffiths' approach to this problem, which is far more elegant and less troublesome than mine.

2004.12.09
101 Uses for Nested Classes in .NET (well, sort of)

From time to time, people new to .NET ask about the utility of nested classes -- especially since FxCop recommends against using them in publicly visible APIs.  It took me a while, but I've compiled a list of 101 uses for nested classes...

2004.11.08
TestRunner

Command line unit testing tool -- a cruder, simpler, hassle-free alternative to NUnit.

2004.10.13
Lamer than NUnit

I like unit testing, but I don't care for NUnit.  Well, I've nothing against NUnit per se, I just don't like adding dependencies to my build process and redistributions, unless absolutely necessary.

While it's usually no big deal to incorporate NUnit into a massive application development project, it's far too much hassle to incorporate it into every single little class and component I write and publish.  Unfortunately, it's those little library classes and code samples which seem to benefit the most from unit testing...

So, I've taken it upon myself to cook up a simpler alternative...

2004.10.11
Mobile Ink Jots: Writing Solid (Tablet PC) Code

My latest (last?) Mobile Ink Jots column is up on MSDN:  learn how to write solid, secure, thread-safe, exception-hardened, resource-friendly, locale-aware Tablet PC code.

http://msdn.microsoft.com/library/en-us/dnmobink/html/WritSldTabAp.asp

The advice is sound (I hope!), and it's not just for Tablet PC developers...

2004.10.07
Regex Search and Rescue

Command line search-and-replace tool based on .NET's excellent regex engine -- can serve as a drop-in replacement for the lesser regex engine in Visual Studio .NET!  Full source code included.

[Update: I've moved the home of RSaR over to CodePlex.com...  the source and binary are available there, under the MS-PL public license.]

New in version 2.0: 

New in version 1.3: 

New in version 1.2: 

 

2004.10.06
.NET: Robust Comparison of Floating-point Values

A clever technique for the robust comparison of floating-point values -- reinterpreting the bits as sign-magnitude integers -- using purely verifiable, managed code.

Inspiration comes from Bruce Dawson (by way of Kim Gräsman) and Jeroen Frijters.

Some unit tests are included, but swim at your own risk, ok?

2004.09.29
Copy Constructors vs ICloneable -- Redux (Updated!)

Back in 2002, I wrote an article for ONDotNet.com, about .NET's copying, cloning, and marshalling semantics.  I suggested that the role of C++ style copy constructors was diminished, in the face of ICloneable.  Boy, was I wrong...

Updated: Ken Kozman points out an embarrassing bug in my copy-ctor implementations.  The assignment operations are backward!  This was almost certainly due to me fumbling a copy/paste operation, while messing around in the HTML trying to get the formatting right.  That'll teach me to be more careful...  I've fixed this in the post, and changed the name of the 'clone' parameter to something a little more intuitive. 

Before and after:

  protected Base(Base clone)
  {
    clone.baseState = this.baseState;
  }

and

  protected Derived(Derived clone) : base(clone)
  {
    clone.derivedState = this.derivedState;
  }

were changed to, respectively:

  protected Base(Base that)
  {
    this.baseState = that.baseState;
  }

and

  protected Derived(Derived that) : base(that)
  {
    this.derivedState = that.derivedState;
  }

I apologize if that error caused anyone any grief..  (You all caught this in your unit-tests, right? ;-)

2004.09.16
Mobile Ink Jots: Ink on the Web

July's Mobile Ink Jots column is now on-line (yes I know, it's late August).  This month, I talk about the Tablet PC's new support for running Ink in partially trusted CAS contexts:

http://msdn.microsoft.com/library/en-us/dnmobink/html/tbconmij3.asp

2004.08.27
Be the first to rate this page...

For those who've been wondering why my blog is so silent, it's because I've been busy writing content for the new Tablet PC Developer Center on MSDN. My first column just went live...

http://msdn.microsoft.com/library/en-us/dnmobink/html/mij02.asp

2004.08.07
.NET: Jitsu.Collections.Specialized.ByteVector

Strongly-typed collection class for System.Byte -- manages storage as a byte[] internally, to avoid both boxing and excess heap allocations.  Use this class as a template for your own custom collection types.

2004.05.06
P/Invoke Properly, Please!

Please everyone, use DllImport(SetLastError=true), whenever possible -- and, more important still, remember to check the function's return value!  A smidgin of encapsulation helps enforce this...

2004.03.18
Still More on XmlSerializer

I'm in a rut, blogging about XmlSerializer.  This week's tip: XmlSerializer gives special treatment to your objects' IEnumerable implementations.  What?  You already knew that?  Ok, but did you know that it will work, even without the [XmlArray] and [XmlArrayItem] attributes?

2004.02.24
.NET: ColorConsole class

A p/invoke wrapper for SetConsoleTextAttribute -- for writing colored text to the console.

2004.02.22
.NET: AsyncStreamPump class

The programming model for asynchronous I/O is an alien beast. You call BeginRead, specifying a callback function to be invoked asynchronously when the read operation completes (or the stream is closed). But you're not given the actual data -- for that, you have to call back into the stream's EndRead method, and then reestablish the async read by calling BeginRead, again. It's really quite a chore, because you have to have cached that Stream object somewhere... Uncle!

Doesn't .NET have a nice, tidy event model? Yes it does. Can't we just subscribe to receive the data as it comes in, without writing two pages of boilerplate code juggling streams, buffers, and IAsyncResult references? Yes we can.

Submitted for your approval: ASyncStreamPump, my attempt at a reusable solution for this problem...  useful for large file copies, downloads, uploads -- can even be used to proxy a network connection, with just a few lines of client code!

2004.02.17
On hosting UserControls in IE

More pitfalls in IE's hosting of .NET UserControls.

2004.01.30
More on XmlSerializer

Last month, I blogged about XmlSerializer, and the constraints it imposes on the .NET types you'd like to map onto XML structure.  I was recently reminded of another limitation of XmlSerializer:  it doesn't let you switch your type mappings, on the fly -- for example, in response to a version attribute.  And yet.  A great many XML document formats use just such an attribute...

2004.01.06
More Options for IPC in .NET

I've gotten a bit of reader feedback from my article on Secure, Robust IPC in .NET...

(from the beforetime)
In Search Of... Robust, Secure IPC for .NET

In the latest (last?!) issue of Windows Developer Magazine, I relate my experience and frustrations trying to find a safe, robust IPC story somewhere in the .NET Framework...

(from the beforetime)
XmlSerializer does not play nice with others. By design.

XmlSerializer is a wonderful tool, but it imposes a lot of restrictions on your types.  Crisis, or opportunity?

(from the beforetime)
.NET: RegexMarshalByRefWrapper class

Regular expressions created with RegexOptions.Compiled will leak, unless they're housed in a secondary AppDomain that can be unloaded -- you'll need this wrapper class, or something like it, to do that.

A similar technique can be used with System.CodeDom.Compiler types, or anything that uses Reflection.Emit under the hood.

(from the beforetime)
Win32: HiResTimer class

It's not rocket science, but it's amazing how often folks get this wrong (also available in C#).

(from the beforetime)
PeekCL

Diagnostic tool for peeking at a running process's command line.  This can be amazingly insightful...

(from the beforetime)
Reggie

A fully-open, debuggable alternative to Microsoft's RegSvr32.exe (and RegTLib.exe) -- a must-have for COM development.

(from the beforetime)
.NET: HiResTimer class

It's not rocket science, but it's amazing how often folks get this wrong (also available in unmanaged C++).

(from the beforetime)
DCOM: PingRemoteHost function

Use this helper function to "ping" a remote DCOM server, before calling CoCreateInstanceEx -- thus greatly mitigating the DCOM timeout problem (at least for the initial activation request).

Update -- Windows Server 2003 and Windows XP SP2 don't allow unauthenticated DCOM activation requests, by default (if at all).  I'm removing support for bUnAuthenticated=true.

(from the beforetime)
Win32: ModelessDialogHook class

Encapsulating reusable dialogs as components (either in DLLs, or in COM objects) is a great idea -- much better than trying to reuse a .rc file -- but things get tricky if you like your dialogs modeless...

(from the beforetime)
ATL3: CSimpleVector template

The ATL3 array template (CSimpleArray) is buggy and leaky -- don't use it (note: ATL7 finally repairs the bugs in CSimpleArray, and also offers a newer template, CAtlArray).

(from the beforetime)
ATL3: CSimpleList template

As seen in Attila (note: ATL7 offers similar functionality with their new CAtlList template).

(from the beforetime)
ATL3: CComTSTR class

The ATL3 string conversion macros are ugly (at best) or they pose terrible security holes (at worst) -- use this heap-based wrapper class instead (note: ATL7 offers a similar solution with its new CW2A et. al. classes).

(from the beforetime)

Updated: Mon, 31 Dec 2007 03:12:00 GMT