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

Author Archive

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]iPhone, Microsoft, Silverlight, .NET, Office, Office Mobile, ScottGu, Ozzie[/tags]

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]Microsoft, MIX08, Silverlight, Nokia, ScottGu, iPhone, Symbian, .NET[/tags]

Tags: , , , , , , ,

IE8 @ MIX08

This is the second 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.

IE8, Dean Hachamovitch, GM IEimage

Focus on standards compliance.  This will be a great productivity boost for web-site developers.

1. CSS 2.1. 

  • Good. 

2. CSS cert. 

  • Funny that Microsoft is claiming that ambiguities in the specs make it hard to prove correctness.  They are correct, but it sounds a little like whining.  It also reminds me of the Server 2008 test. 
  • Test cases from Microsoft, good. 
  • IE 8 transition might be painful.  For users.

3. Performance.

  • Script performance. 

4. HTML 5.

  • Back button can work with AJAX.  This is a very big deal for improving the consistency of the browser user experience.   
  • Connection events in HTML 5 / DOM storage, re-connect, “make content available” later.  Cool.

5. new dev tools

  • Cool script debugger in IE8.  Looks like the developer toolbar has gotten much better. 

6. Activities

  • User activities added to browser by users (kind of like smart links). 
  • Activities are defined in XML.  Kind of cool, though I can see the browser becoming hard to use as a user adds a bunch of activities; however, that is up to them to manage.   
  • This format is the OpenService Format Specification.  Share/Share-alike spec.

7. WebSlices

  • Users can subscribe to parts of web-pages (driven by sites providing this as a service).  
  • This is the WebSlice Format Specification.  Public domain spec.

8. IE8, Beta 1 for developers

  • Released today.  Cool.  I will be checking this out.  At first in a VM.  I hope IE7 can live along side IE8.  Since they didn’t mention this, my guess is no.

[tags]Microsoft, MIX08, IE8, IE7, IE, Silverlight[/tags]

Tags: , , , , ,

Ozzie @ MIX08

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

Ray Ozzie

Ray Ozzie opened the MIX08 conference keynotes talking about the overall Microsoft strategy.  He said all the right things about the transition to the cloud.   Talked about three principles (social device mesh, business, fabric of small pieces).  No surprises here. 

In the context of the world of connected systems, he said (paraphrased) . . .

Magic of software to bring them all together into . . .a mesh

I love the expression “the magic of software”.  Of course, we developers are not magicians, but when things are done right there is a real feeling of magic.  This is especially true when disparate systems begin working together through elegant and open standards.

He spent most of his time talking about 5 scenarios . . . here are some thoughts.

1. Connected devices

His vision of bringing your different devices together reminds me of the Blackberry Enterprise Server, but for consumer devices.

2. Connected entertainment

License media / collections (playlists) / subscriptions  once, use any device for playback.  This is kind of a holy grail, I think.  If this is managed through a SilverLight runtime we may have a hope that it is across devices.

3. Connected productivity

Office PC, Office Mobile, Office Live — seamlessly allow users to work across devices, using the right tool at the right time.  No info on licensing costs, or on the details of Office Mobile.  If the Mobile story requires Windows Mobile, then this isn’t so compelling.

4. Connected Business

Exchange in cloud.  Other services too.  Good.  Very good. 

5. Connected Development

Of course, .NET + Silverlight, Expression, . . . Good stuff.

[tags]MIX08, Ozzie, Silverlight, Office, Microsoft[/tags]

Tags: , , , ,

Unprivileged Tasks in Windows 6 with VBS

Last week, Bart de Smet wrote about calling the Task Scheduler in Windows Vista (and Windows Server 2008) from managed code.  In his usual style, he does a great job diving into the topic.

It reminded me of something I did last year for Windows Server 2008 Certification: write code to start an unprivileged task in Windows 6 specifically written for installers.   

If you are familiar with UAC, you know that applications identify their least required privilege level in their manifest.  Applications that don’t require elevation identify themselves with the level="asInvoker" tag (the value may be confusing, but makes sense).

This creates a bit of complexity for installations that launch applications when they finish.  If your installation required elevation, but the launched application does not, what should you do?  Windows UAC guidelines say that you should launch them unprivileged.  This makes sense: you don’t want an application to run elevated as a side-effect of the installation.

And you do this by starting the task in the Windows 6 task scheduler.

The UAC guidelines contain some C++ code for this, and Bart has a managed version, but for reasons of maintainability and consistency, we wanted VB Script.  I was able to find some pieces of this online, but the following code is basically a port of the UAC Guidelines version with a check for Windows version too. 

' Arguments 
set args = WScript.Arguments 
if args.Count >= 1 then 
    strCommand = args(0) 
end if 
if args.Count >= 2 then 
    strArguments = args(1) 
end if 

' Determine the version of Windows 
set objWMI = GetObject("winmgmts:\\.\root\cimv2") 
set colOS = objWMI.InstancesOf("Win32_OperatingSystem") 
for each objOS in colOS 
   version = split(CStr(objOS.Version), ".", 2) 
next 

if CInt(version(0)) < 7 then 
    ' pre Vista / Server 2008.  Just run the task directly 
    set objShell = CreateObject("Wscript.Shell") 
    set objProc  = objShell.Exec(strCommand & " " & strArguments) 
else 
    ' Vista / Server 2008 or later.  Schedule it for immediate execution 
    scheduleTask strCommand, strArguments 
end if 

' Schedule a task for immediate execution; requires Windows 6 or later 
private sub ScheduleTask(strCommand, strArguments) 
    ' Some constants we need 
    TASK_TRIGGER_REGISTRATION = 7 
    TASK_ACTION_EXEC = 0 
    TASK_CREATE	= 2 
    TASK_LOGON_GROUP = 4 

    on error goto 0 
    ' Get the TaskService class 
    set pService = CreateObject("Schedule.Service") 

    ' Connect to the task service. 
    pService.Connect  

    '  Get pointer to root task folder. 
    set pRootFolder = pService.GetFolder("\") 

    Randomize(20000) 
    taskName = "MyBackgroundTask " & CStr(Rnd(1000)) 

    '  See if task exists, delete it if it does. 
    on error resume next 
    pRootFolder.DeleteTask taskName, 0 
    on error goto 0 

    '  Create task 
    set pTask = pService.NewTask(0) 
    set pSettings = pTask.Settings 
    pSettings.StopIfGoingOnBatteries = false 
    pSettings.DisallowStartIfOnBatteries = false 

    ' Create trigger 
    set triggerCollection = pTask.Triggers 
    set trigger = triggerCollection.Create(TASK_TRIGGER_REGISTRATION) 

    ' Create a new action 
    set actionCollection = pTask.Actions 
    set action = actionCollection.Create(TASK_ACTION_EXEC) 
    action.Path = strCommand 
    action.Arguments = strArguments 

    ' Register the task using users group 
    set registeredTask = pRootFolder.RegisterTaskDefinition(taskName, pTask, TASK_CREATE,  "S-1-5-32-545", null, TASK_LOGON_GROUP, "") 

    ' give 10 seconds for the task to start 
    for i = 0 to 100 
        state = registeredTask.State 
        if state = TASK_STATE_RUNNING then 
            break 
        end if 
        WScript.Sleep 100 
    next 

   ' delete the task 
    pRootFolder.DeleteTask taskName, 0 
end sub

You can see it takes arguments for the application and an argument to pass to the application.  Also note that the VBS must be run elevated in Windows 6, otherwise tasks cannot be scheduled.

Ah, VB Script.  You gotta love it.  Or not, but I wish someone else had posted this! 

Note to Microsoft: you would have saved a lot of people time if you had included a VBS version in your guidelines document.

[tags]VBS, UAC, Server 2008, Vista, Windows 6, Task Scheduler[/tags]

Tags: , , , , ,

Dynamic IP and OpenDNS? Watch out.

OpenDNS is a cool service.  I use it.  It basically provides two kinds of services:

  • Better DNS Servers: to get this service, you just switch your DNS settings to their servers.
  • Extended services:  various typo-correction features, domain shortcuts, domain blocking and anti-phishing, and domain usage tracking.  To get these services, you create an OpenDNS account.

I use their servers, and while I do have an OpenDNS account, I don’t use any of the extended services. 

At least, I don’t intentionally use them.

The problem is that the services are applied based on the IP source address used in DNS queries.  IP addresses change.  IP addresses are not secure.  For most people they are dynamic.

This impacts the reliability of the service . . . 

  • For example, User A defines OpenDNS extended services associated with their IP address.
  • IP address changes.
  • User A either doesn’t have the services they are relying on, or gets services they never signed up for. 

. . . and has privacy implications . . .

  • User A changes their DNS settings, signs up for the additional services, and starts tracking domain queries.
  • User B never signs up, but just changes their DNS settings to the OpenDNS servers.
  • At some point (before or after A signs up), B gets A’s old IP address.
  • A is tracking B’s queries.

Unlikely?  Maybe.  Possible to exploit?  Definitely.  Expected by users?  I doubt it.  In fact, User B probably didn’t think this was possible. 

This is such an obvious issue that I went looking on the OpenDNS site for answers.  I expected a big warning like this:

Warning: Using OpenDNS with dynamic IPs is an advanced use case.  To use OpenDNS with dynamic IPs, you must sign up for an OpenDNS account and reliably update us with your IP address when it changes.  If you do not, other users may track your DNS queries and extended services may get applied even though you did not sign up for them. 

Expecting I must just be missing something, I posted on the community, and got an unconvincing . . .

not a major issue…and we won’t let it become one

Sounds like stonewalling to me.

So, why do I care?  User contracts 101 says if you don’t like the service, don’t use it.  OK.  I might just quit the sevice.  That is fine.

But, the user contract of “just use our DNS servers and everything is better” does not include these major caveats.  I think it is misleading.

What do I think they should do about this?  I dunno, but here is an idea:

  1. Split their DNS servers into 2 (Primary / Secondary) pairs.  This eliminates the problem for the users who use the OpenDNS servers without signing up for an account.
    • First pair doesn’t enable any extended services (except for the OpenDNS Guide).
    • Second pair is required for the extended services.  This pair is provided to users only after sign-up. 
  2. Promote a warning like the one I give above. 

These solutions don’t make the problem go away, but they make sure users are informed about what is actually going on.  And they make for a sensible user contract.

[tags]OpenDNS, Exploits, Dynamic IPs, DNS, User Contracts[/tags]

 trackback

Tags: , , , ,

Come see Digipede at the Microsoft launch event

Heroes who happen by our booth at the Server 2008, Visual Studio 2008, and SQL Server 2008 launch will get a chance to win an XBOX-360.  OK, you don’t have to be hero, but you do have to be spotted wearing a Digipede sticker sporting our mascot, Deatle.

image image

Come on by and see us.

BTW: I won’t be at this event, but I’ll be at the one in SF on March 13th.  No Digipede booth or give-away there.

[tags]Server 2008, Microsoft, Launch, Digipede, XBOX, Deatle[/tags]

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]NET, c#, Cmdlet, Digipede, PowerShell[/tags]

Tags: , , , ,

An SP1 by any other name would . . .

Mary Jo Foley writes there’s no Windows Server 2008 SP1 in the works.

Why?  Because the first RTM of Server 2008 is called Windows Server 2008 SP1.  This is due to Server 2008 and Vista sharing the same core code and components.

Hmm.

This makes only marginal sense, and then only if Microsoft commits to keeping the service packs synchronized across the Windows 6 product family.  I think this will be less confusing to customers.  We’ll see if this synchronization happens. 

Regardless of Microsoft’s plans, the SP1 designation on Server 2008 is misleading.  Most of the server components of Windows 6 will remain without a service pack until SP2.

Customers who like to wait for initial service packs still will — unless they are duped into thinking they’ve already got it.

[tags]Microsoft, Server 2008, Vista, Windows, SP1[/tags]

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].NET, .NET3.5, .NET2.0, CLR, BCL, Bug, Microsoft, Connect[/tags]

Tags: , , , , , , ,

« Previous entries · Next entries »