Who Accessed My File?

January 21, 2008

A few years ago, I recall needing to know (programmatically) which user has accessed a particular file.  As part of a legacy system, this couldn't make the code base any worse.  The idea was that there's a configuration file sitting on a network share; access to it is granted to only a single user at any given time.  However, other users requesting access want to know why access is being denied - i.e., which user is holding them from accessing the file.  This information would be displayed to them, and then they were able to go and (physically) kick...
tags: , ,
one comment

Wonders with WCF’s DataContractSerializer

January 20, 2008

Serialization possibilities in the .NET Framework have been significantly augmented with the advent of .NET 3.0.  Tradionally, you had the choice between using the BinaryFormatter used by .NET Remoting (or its slow and deprecated companion, the SoapFormatter) - producing binary data in a completely proprietary format using Reflection as the underlying engine for serialization discovery - and using the XmlSerializer - employing code generation to produce well-formed plain-text XML, as long as your object graph didn't have cycles, didn't try anything out of the ordinary, exposed every serializable piece of data through a public get/set property, and didn't use...
2 comments

User Account Control Helpers Library

January 19, 2008

I've just released a preliminary version of the User Account Control Helpers Library, a bunch of code meant to assist developers targeting Windows Vista with the inevitable adaptation to UAC. This preliminary release addresses two major hurdles in porting applications to Vista: Embedding an application manifest in each and every executable to specify a requested execution level; Interacting with the UAC mechanism for application compatibility purposes. UAC in a Nutshell The primary goal of the UAC mechanism is improving security in the Windows operating system.  This worthy objective is achieved on two axes: Making more actions in...
tags: ,
no comments

Dynamic Reply Endpoints in a Duplex Workflow Service

January 15, 2008

The Workflow Services paradigm in .NET 3.5 gives us the ability to expose a workflow as a WCF service, and to communicate with a WCF service from within a workflow.  These useful scenarios are enabled by the ReceiveActivity and the SendActivity respectively.  (If all of this sounds new, check out Guy Burstein's primer on Workflow Services.) The built-in SendActivity is great until you need to provide custom endpoint information.  Basically, there are three options, in rising degree of complexity: Option 1 (Fully static) Statically configure SendActivity.ServiceOperationInfo (specifying which method on which contract type you want to...
tags: ,
no comments

Notes on Teaching Introduction to .NET

January 13, 2008

Today I've had an interesting experience of teaching a one-day session titled "Introduction to .NET" (roughly based on this Sela course).  I wouldn't find it post-worthy whatsoever (except for maybe the fact that class started at the dumbfounding time of 7:45AM) if not for the audience. The group consisted of about 15 ultra-Orthodox men (Haredim; Wikipedia: Hebrew, English) who are going through several months of training to eventually practice software testing.  It is fairly unique in the way people without any previous experience with computers are trained to be software developers and software testers. When working with...
tags:
3 comments

P/Invoke Signature Generator

January 12, 2008

If you ever needed to call a Win32 function from .NET code, you know the dreaded feeling.  You fire up MSDN and start looking for the function signature, hoping it doesn't invent a new pattern of parameter passing, returning a value and calling back a function you specify.  And while you're at it, you still have to figure out what the function is expecting at offset 0x20 from the beginning of the input buffer when the value of the dwExtendedFlags parameter is non-zero. This tedious process has long ago come to an end with the advent of PInvoke.net, a...
tags:
10 comments

Generating Documentation with Sandcastle

Sandcastle is a free toolset released by Microsoft for constructing professional-looking, MSDN-ish documentation for managed code libraries.  It is also used by Microsoft to construct the .NET framework documentation.  The toolset is currently in its CTP phase (for over a year now), but a community is beginning to form.  The latest release is the October 2007 CTP (look for further announcements on the Sandcastle blog or the Sandcastle CodePlex project). Here's what the results look like for a sample project I've generated (in HTML Help 1.x format, which produces a CHM): (Full disclosure: in the past,...
tags:
3 comments

Attaching a Workflow Instance to a Workflow Service Host

January 11, 2008

As part of WF and WCF integration in .NET 3.5, Workflow Services give us the ability to expose workflows as WCF services (including activation) and to consume WCF services from within workflows.  Additional interesting features include explicit context management support, conversation support (multiple parallel send-receive pairs in a workflow), durable services and other interesting issues.  (Check out the demos in the Visual Studio 2008 Training Kit, specifically the Demos\03 - WF directory.) This model seems really cool because it's enough for me to put a ReceiveActivity as the first activity of my WF, set the CanCreateInstance of that activity...
tags: ,
one comment