Expert Texture Home Contact me About Subscribe Digipede Connect on LinkedIn rwandering on Twitter rwandering on FriendFeed

rwandering.net

The blogged wandering of Robert W. Anderson

Digipede + Velocity

Last week Microsoft released the first CTP of the Microsoft Distributed Cache (code-named Velocity). deatlefast2

I am definitely excited about this release.  While Microsoft is not breaking new ground here, the addition of a distributed cache to .NET is a great addition to the platform.  Certainly there are competing technologies, but Velocity will be a very simple choice for developers and ISVs because we’ll be able to count on its availability. 

This ISV is interested, so we tried it out.

We have many customers who use our Executive pattern to load and cache job-specific data for compute-intensive jobs on the Digipede Network.  These data are often fetched through WS calls or directly from SQL databases.  Often this is performed in the Executive.Start method.  Before Velocity, the code might look like this:

protected override void Start() {
    // read the CBOData object from the database.
    _cboData = ReadCboData(cache.Get(JobTemplate.Parameters["CBODataStore"].Value));          
}

Including Velocity in this example is really easy.  The following snippet adds use of the Velocity cache:

protected override void Start() {
    // get cache 
    CacheFactory factory = new CacheFactory();
    Cache cache = factory.GetCache("CBOCache");
    // see if our CBOData object is already there
    string key = JobTemplate.Parameters["CBODataKey"].Value;
    _cboData = (CBOData)cache.Get(key);
    // if not, read it from the database.
    if (_cboData == null) {
        _cboData = ReadCboData(cache.Get(JobTemplate.Parameters["CBODataStore"].Value));
        // store it in the cache for later use
        cache.Put(key, _cboData);
    }          
}

With a few lines of code, we reduce the load on the database server and network and spend more time computing.  (I’m making an assumption with this simple code that all Executives don’t start at once, an assumption made obsolete by seeding the cache from a master application).

Of course, this is a simple example, but there are many other use cases.  For example,:

  • Digipede-enabled applications can share results; 
  • master applications can load the cache with job-specific data; and,
  • others where baking Velocity deeply into the Digipede Network start looking pretty interesting.

I have seen many posts on “must-haves” for a Velocity RTM.  I mostly agree with the lists I have seen.  I’ll have a list too mostly from the ISV perspective.

Cool stuff.

Tags: , , ,

Digipede on Mono

deatle_mono_logo I am routinely asked if the Digipede Network can run under Mono.  The main scenario people want is to run Digipede Agents on a mix of Windows and Linux boxes.

My answer has always been the same:

Not now, maybe never, but this would not be technically challenging.

A while back we researched what it would take to get the Digipede Agent working on Linux.  At the time, the Mono project was less mature.  Finding out what worked was mostly a game of just trying it.  We eventually gave up, because a dependency on WSE2 turned out to be a blocker.

A couple of weeks ago I decided to see what it would take to finish this task.  I haven’t paid much attention to the Mono project over the years, but Moonlight gave me hope that Mono has made a lot of advances since we tried last.

It has.  Still using Visual Studio, I #ifdef’ed out a few noncompliant functions and got it working with the Mono runtime.  It was surprisingly easy.  Kudos to Miguel de Icaza, Novell, and the Mono team. 

So now I have it working in the lab on a Linux VM.  Checking in to a Digipede Server, it is able to run our .NET development patterns.  Of course, it can also run command-line applications with Linux-specific binaries.  Pretty cool.

This is not ready for release.  Not only is a supported product more than just bits, but I took a few shortcuts in getting the bits to work! 

Now if someone asks me if it Digipede Network can run under Mono, I can say

It does in the lab, it may never get released, and this is ultimately a market and product decision. 

So now we can do it, what shall we do with it?

Tags: , , ,

.NET on Server Core

Dmitry Sotnikov provides the steps to get PowerShell — and of more general interest, .NET 2.0 —  running on Windows Server 2008 Server core.

While this is a stopgap until Microsoft officially supports this configuration, it could still be useful. 

Now the question for me is, will this work for running Digipede components?

Tags: , , , ,

Digipede Network 2.1 Out the Door

Dan has a write up of some of the enhancements added to this release here.  He said we should have probably called it 3.0, but it is really more of a 2.5.  We’ll be hosting webcasts soon going over the new features.  

Thanks to the team for all the hard work in getting this out the door.

Follow http://twitter.com/010111011010111 for Digipede announcements.

Tags: , ,

On Live Mesh and Silverlight

David Treadwell was on the latest Gillmor Gang talking about the recent Live Mesh announcement.  David’s title is Corporate Vice President, Live Platform Services and has been described as Ray Ozzie’s point man on the Mesh.

It was a pleasure talking with him — and thanks to David for the LiveMesh invitations.

The synchronization capability in this preview is a big deal not in what it provides, but for what it promises. 

That is why it is a little disappointing that there is such a heavy emphasis on Windows and Windows Mobile.  I discount the coming Macintosh support because support for non-Windows mobile devices is really the issue.  If iPhones and Blackberrys are out of the equation, then the synchronization story isn’t so compelling.

Nobody should be surprised about Microsoft promoting Windows.  And I certainly am not, but Microsoft’s new openness had me hoping for a different alignment of Microsoft strategy.  One in which their S+S play would de-couple the Windows, Office, Windows Mobile, and Live businesses.  I saw this happening through the Silverlight runtime everywhere.  I hoped that the mobile Live Mesh synchronization client would be written on top of Silverlight.  I hoped that the next Office Mobile would be too.  Then Live services could serve any device running Silverlight.  And so on.  I’ve written about this previously, so I’ll leave it at that.

Instead, Microsoft is approaching Live Mesh as a set of open protocols that anyone can implement. So, an iPhone version could be written by a 3rd party using the Apple SDK.  Just implement the protocols — of which FeedSync seems to be the major part — and you are all set.  That is very good and much better than requiring the use of a Microsoft runtime to make it happen.

But, in addition to the open protocols, I would still have preferred a vision where the Silverlight runtime lies underneath the Microsoft implementations of the Live Mesh client.  That way, when the next big feature set for Live Mesh is released, the new client code could conceivably run everywhere. 

I want to make one thing clear: I’m not saying that Silverlight in its current form could support this at all.  And I know Silverlight’s (nee WPF/E) genesis emphasized presentation, but at the end of the day, it is a .NET runtime. 

As David says (from the Gillmor Gang transcript on TechCrunch):

Treadwell: I really view mesh and Silverlight as orthogonal and complementary technologies. Essentially what the mesh client does, it’s the runtime for doing synchronization and collaboration those kinds of things. I view Silverlight as a runtime that does the presentation engine. Mesh doesn’t really have anything for presentation, Silverlight doesn’t really have anything for synchronization and mobile communications. Working together I think you have a very good thought there about the combination of these and how they’ll come together. We’re working actively on that but we don’t have all the I’s dotted and t’s crossed.

Yes.  They are orthogonal if Microsoft says they are.  And Live Mesh and Silverlight will somehow come together though this appears to mean in terms of presentation.  Fair enough.

And more than a little cool.

Tags: , , , , ,

Ballmer @ MIX08

A little late, but here are my notes on the Steve Ballmer keynote at MIX08.

The Q & A format was certainly better than having Steve Ballmer just talk for an hour, though I got a little tired of Guy Kawasaki’s cracks at Ballmer — about his wealth and method of travel, how Microsoft “should have hired” him.  It got better when he stopped that.

I thought the best questions were from the Audience:

On .NET being baked into IE

Why isn’t IE built on .NET.

This has been a common theme, that is, the lack of .NET adoption for some major Microsoft products.  Part of that is dog-fooding, but a bigger part is that the developer stories for these products are harder for lack of deep .NET support.  For example, Office and IE are not based on .NET.  Connecting between their unmanaged, COM, BHO worlds and the managed .NET world is more than a little painful.

Anyway, his response was that .NET wasn’t expected to be as proven and as far along by the time Vista shipped.  Fair enough, but I would have been happier if the delays in Vista were related to a real WinFx in the OS than the reasons given.

The iPhone

What about Silverlight for the iPhone?

Steve Ballmer responded (paraphrased) . . .

Would love to get it on everything;

Can’t say we’ve been having talks about it; and

Licensing model not so good.

Right.  The licensing model is not so good.

Maybe Microsoft can pay Apple a bunch of money so Silverlight can run on the iPhone.  Then developers can build the apps for free?

Sounds good to me.

Tags: , , , , , , ,

When iPhone + Silverlight?

Onstage during his keynote at MIX08 yesterday, Scott Guthrie said they’ll be bringing Silverlight to “everything with an SDK”.  Yesterday, I suggested this was a dig at the iPhone with its lack of an SDK. 

Of course, that was yesterday and today we expected an announcement from Apple on the new SDK.  I also surmised that the SDK wouldn’t be deep enough for Silverlight, but reports are that I was wrong.

So, my guess is that Scott was hinting at Silverlight for the iPhone.

Cool.

So, Scott, when we’ll we see it?

And Ray Ozzie, please get the Office Team onto .NET, specifically the Office Mobile Team onto Silverlight.

Tags: , , , , , , , ,

ScottGu @ MIX08

This is the third of three posts on the MIX08 keynotes.  This is like live blogging without the live, since I’m writing this in Oakland.  You can follow my comments at http://twitter.com/rwandering.

Scott Guthrie et al.image

Most of the discussion was on Silverlight 2.  This is the coolest thing Microsoft is doing in the Internet space and it is (happily) pervading a lot of their strategy. 

Media

  • Silverlight 2, adaptive streaming very cool.
  • Advertising templates for Visual Studio.  Struck me as odd, but it looks good, and advertising is the corner stone of free.  I won’t be running out to try this one.
  • Double-click and Silverlight.  To keep “gold standard of reporting”, they support Silverlight for instream ad delivery.  Makes sense.

Silverlight 2

  • Silverlight 2 supports many languages (including JavaScript).  This is such a benefit to the .NET strategy that blows the doors off of Air and Java. 
  • Silverlight 2 built-in controls will truly accelerate Silverlight adoption.  New controls open-source with unit tests.  Very cool.

The Silverlight demos did not disappoint

  • Hard Rock International demo was really cool.  They showed deep zooming to incredible detail and zooming way out to see the entire collection, tiled.  Lots of Beatles stuff in there too.  Yay.
  • Aston Martin site cool too.  The number of options that a user can select.
  • Cirque de Soleil Human Resources system.  Custom built HR system.  This kind of application shows how IT can’t ever really be dead.  That is, one-size-fits-all HR systems don’t work where a company sees competitive advantage or reduced costs in custom systems. 

WPF Enhancements

  • Performance.
  • Better controls.
  • Write custom effect that can be pushed down to the GPU.

Silverlight Mobile

Windows Mobile and Non-Windows Mobile, but what does that mean?  Nokia Symbian, of course, but what else?  Scott says more and more devices.  In fact, he said,

Everything with an SDK. 

Is that a dig at the iPhone?  I wonder if the iPhone SDK when released will be deep enough to allow Silverlight.  My guess is no.

Anyway, good job Scott.  I’ve said it before, and I’ll say it again.  The Microsoft .NET strategy really rocks.

Tags: , , , , , , ,

Narrowing the Semantic Gap

Last week, PowerShell Architect Jeffrey Snover wrote an excellent post titled the Semantic Gap.  He writes about the gap as . . .

. . . 2 worlds:

  1. The world as we think about it.
  2. The world as we can manipulate it.

The difference between these two is what is called the semantic gap

This is a great working definition. 

Jeff writes about this specifically regarding PowerShell and instrumentation providers and asks the question,

So why do instrumentation providers close or not close the semantic gap?

Yes, some do, and some don’t.  This isn’t just about hierarchy of needs, but also about prioritization.  How important to the provider is a narrow semantic gap for product X when used through interface Y? 

In the case of X := Digipede Network and Y:= PowerShell, we thought it pretty important.

But how do you decide if narrowing the gap is worth it?  Engineering costs aside, understanding what your interface could look like in PowerShell can help you decide.  Internally, we answered these questions:

  1. What would a PowerShell script look like just using your .NET or COM APIs? 
  2. What could it look like with Cmdlets? 
  3. Would these Cmdlets support how we think about the Digipede Network (i.e., small gap?).

I already said the answer to #3 turned out to be yes and in a previous post, I gave an example of the gap in Why a SnapIn for the Command-Line?  This example highlights the gap for a common operation on the Digipede Network: get the description of a pool of resources.

If you are thinking about supporting PowerShell in your product, take a look at my post.

I hope this helps you decide.

Tags: , , , ,

Dan’s Worst .NET Bug

Last Thurday, Dan posted Worst .NET Bug I’ve Ever Seen.  This post was the result of a Digipede customer support incident resulting from this .NET behavior.  We had some trouble tracking it down.  The unexpected exceptions were bad enough — and the deceptive exception message text made it worse. 

He posted code to reproduce the problem on a single thread (a tight loop of open, write, close).  The actual code in question included no looping, but multiple threads following a fairly common pattern (i.e., open temp file, write, close, delete, rename).  The code was properly synchronized, but it still threw exceptions.  To keep this simple, I’ll stick with Dan’s simple version:

while (true) { 
   using (Stream sw = File.Open(strFileName, FileMode.Create)) { 
         using (BinaryWriter bw = new BinaryWriter(sw)) { 
            BinaryFormatter bf = new BinaryFormatter(); 
            bf.Serialize(bw.BaseStream, this); 
         } 
   } 
}

Loop this code on one or more threads and you may eventually get a System.IO.IOException.  I say may because I can’t reproduce it, but Dan can and so can one of our customers. 

Given many caveats (e.g., the paths are valid, the proper permissions exist, the file is not opened elsewhere, etc.), this code should never throw an exception.  The unmanaged resources should be released when the Stream.Dispose method is called.  The file should be closed.  The types of exceptions that our customer (and Dan) got all follow from the fact that sometimes the file isn’t closed.  Add a Thread.Sleep(1000) after the using block and the problem goes away.

So, is this a .NET bug or a Windows bug, or just expected behavior?

The first thing I did was take Dan’s simple loop and write it using the Windows Platform SDK (i.e., using the Windows API, not .NET).  I left out the delete/rename part of the pattern to make it like Dan’s tight loop.  The code looks like this:

while (true) { 
    HANDLE hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 
        0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);   

    if (hFile == INVALID_HANDLE_VALUE) { 
        printf("Could not open file (error %d)\n", GetLastError()); 
        break;; 
    }   

    byte buffer[1024]; 
    DWORD writtenBytes; 
    if (!WriteFile(hFile, buffer, sizeof(buffer), &writtenBytes, NULL)) { 
        printf("Could not write file (error %d)\n", GetLastError()); 
        break; 
    }   

    if (!CloseHandle(hFile)) { 
        printf("Could not close file (error %d)\n", GetLastError()); 
        break; 
    } 
}

This code works fine on Dan’s machine (i.e., never exits).  

Next steps

So, yes, this appears to be a problem in .NET.  My next steps are to . . .

  1. Check the .NET versions / are they somehow different between our machines?
  2. See if this is a known bug.  Connect.microsoft.com, here I come.
  3. Question my assumptions.  

To this last point, does .NET (or Windows) not guarantee that a file is closed when the last handle is released?  If this is somehow true . . . how much code have you written that assumes that it does?  Me, a lot.  OK, not a huge amount, but enough that I’m really surprised this hasn’t come up before.

I’ll follow up on this post when I get to the bottom of it.  I also have some complaints about the content of some of the exceptions.  In the meantime, any reader want to try to reproduce this?

Tags: , , , , , , ,

« Previous entries · Next entries »