I was thinking about how to rewrite an old (2009) WCF middle-tier service, and have been thinking about George Tsiokos's recent TPL vs. RxNet post.
I think a middle-tier service is perfect to illustrate how I see the strengths and weaknesses of these two.  Specifically the scenario:

Complex Middle-Tier:  Startup vs. Message Handling

TPL might be great for startup tasks.  There is one 'global' task, Initialize, that has many sequences and chunks (in TPL these could be child tasks) that can have different degrees of parallelization.  It also requires global 'command and control' and 'top-down' composition and error handling (a type of event correlation).  If any critical part of startup fails then tear-down the service (cancel outstanding parallel tasks) and exit the service quickly.  So global handling and command-control programming style (root of the call hierarchy has all control).

Once everything is initialized you want bottom-up event correlation and error handling.  The function at the top of the callstack has no control (usually a WCF operation or I/O completion callback).  You only want global state to be touched when absolutely necessary, not touched by ignorable infrastructure errors, and not by errors that are ignorable according to business rules.

Startup, large complex top-down composable work:
TPL

Streams, composable business logic (streams that include error/end):
RxNet

With .NET 5 the TPL dataflow libraries might change things again, but for now I much prefer RxNet for composing and routing 'messages' between layers.  We recently used it in a project and when you have to correctly handle error scenarios it shines.  Imagine a WCF callback for a business operation that is completely async, where business logic has to fire if the notification fails (delivery of the data to the client).  The code isn't pretty in either case, but is better and can be handled at the right level of the lego blocks with RxNet.
0

Add a comment


  1. 'Better together' VS + Windows is over

    • VS can't run 64-bit web apps, and can't open IIS projects when not elevated.
    • File links can't run an app elevated, and an EXE can't be marked to always run elevated ... so My_IIS_App.sln is always broken.
    • With VS elevated you have to turn UAC off to drag-drop files from OS folders to VS IDE b/c Win8 explorer.exe cannot run elevated.
    • "This app can't be activated when UAC is disabled." when clicking .PDF on #Win8 w/ UAC off. I switched PDF to open in Chrome.
    • No VS IDE support for new powerfull OS shell script, Powershell 3.0.  Powershell_ISE doesn't understand VS TFS.
    Is seems very apparent to me that MS refused to accept that desktop Windows is now a 'truck OS', so the OOB dev experience is crap.
    0

    Add a comment

  2. In Windows 8 the 'default browser' is more complicated. I like IE10 in Metro mode (Chrome just doesn't seem to fit here). But all other times I like chrome.

    At the end of the day while watching Comedy Central (via a Win8 app) or NBC News (via a Win8 app) I find myself browsing in Metro IE with way too many keystrokes to get the same page in Chrome, which has my password manager extension, Google auto-signin, mobile tab sync to iOS Chrome, etc..

    So I wrote a bridge. GIST - bookmarklet to open current IE page in Chrome using protocol handler, chrome2:// It comes in two parts: a bookmarklet, and a registry hack (.REG file) to launch Chrome. It uses powershell to remove the extra chrome2:// protocol, leaving just http:// or https://. I'm using chrome2:// as the (fake) protocol to launch chrome. The first time you use the bookmarklet you'll be asked if the page can open "chrome2://" links in a local application, but you can disable further notifications.

    WARNING: This can probably be easily hacked - it opens URLS from a powershell command line. I did my best to limit abuse, but this code is by no means guaranteed. All I can say is that I've been using it for two weeks and haven't been hacked yet.

    GIST - IE bookmarklet to open currnent page in Chrome
    0

    Add a comment

  3. Lately I post most of my tech thoughts to Google Plus.
    0

    Add a comment

  4. I'm running Windows 8 on a laptop and Windows Server on my desktop/workstation.  I'm using Input Director to share Mouse & Keyboard with desktop and laptop.

    Why Server?  I use Hyper-V, so same HW can run multiple DEV servers through MSDN license.

    OK, background info done.  This post is about Input Director.  I wasted an hour trying to figure out why Input Director wasn't working.  Windows Firewall was blocking it on the Server side.

    I found this powershell commands for Windows 8 and Server 2012 that you can use to check (and disable) firewall:

    Get-NetFirewallProfile | ft Name,Enabled -Auto


    Remember to run Powershell elevated (as Admin) if you want to use it to change any OS settings.

    This might have gotten reset when I renamed the server.  I removed it from the domain and re-added it with a different name, which might have removed the 'Domain' profile from firewall.  When it rejoined the domain the firewall profile for 'Domain' defaulted to 'Enabled: True'.  ... Maybe.
    0

    Add a comment

  5. We're looking at a custom server build for work. I did some research last night and wanted to record some finding regarding RAID.

    • Windows SW RAID has come a long way since the Windows 2000 days (when I last tried it).
    • Stripped (RAID0) SSDs are easy, but to get performance benefit from Mirrored (RAID1/10/6) requires a 'good' RAID controller.
    • LSI seems to dominate the performance-conscious market with their MegaRaid controllers.  servethehome.com has some good info on controllers (I think the 2208 is best-of-breed with dual-core controller chip).
    • The Adaptec 'Hybrid' to always read from SSD, but pair writes (writes to both the SSD and conventional HDD) sounds really good.  Adaptec 6405 should handle 2 SSDs and isn't expensive (under $400).   But can't find a good review of it.
    For now I think I'm going to recommend conventional disks for the server.  The consumer SSDs are getting cheaper but the server-grade (um, enterprise) SSDs are still very expensive.  It looks like there aren't good options for pairing consumer (fail at any moment) SSDs with conventional HW Raid, unless Windows 2012 Server Storage Spaces fill the gap.  Not sure if we can wait for RTM and system builder distribution of Windows Server 2012.
    0

    Add a comment

  6. My Google Apps...

    0

    Add a comment

  7. I just ran a little experiment and ran an HTA app under debugger (by adding //X as the arguments to MSHTA.exe). In the app version string it reports Trident 6.0 (a.k.a. IE 10) as the rendering engine. This is interesting, because I think they could have chosen to run HTA apps in compatibility mode with IE 8 (which shipped with the last OS) but they continued to move MSHTA to use the latest IE engine, like they alway have. This means local HTA apps have CSS3 and other HTML5 enhancements.

    I'd like to see if MSHTA.exe ships on Windows RT (WOA / Windows on ARM). If it does this might help fill the gap between native desktop apps for power users that can't run as metro apps, like tabbed file explorer (i.e. Directory Opus / Cubic Explorer). Instead of native code Windows RT might run 'script apps' like PowerShell and HTA.

    1. I used an ancient train simulator utility as my sample (after you click the initial error it shows the current folder and a file list, and it is blazing fast).
    2. Create a .cmd script that contains 'mshta.exe sra.htm //X' and it will launch the app and immediately prompt to attach a javascript debugger. (Thanks for this tip.)

    The next step is to try to combine this with modern Metro-ish CSS template (thanks code 52).

    I'd like to see if a few js libraries work in a Windows 8 HTA. Rx.js, jQuery (or alternate DOM selection and ajax wrapper), and a modern js templating library like JSRender.

    0

    Add a comment

  8. I'm not sure how to approach the following technology migrations my team needs to tackle, especially planning, story weights, and customer benefit language.

    SQL 2008 R2 -> SQL 2012
    Geometry/Geography improvements
    VS 2010 -> VS 2012
    IDE Performance, integrated SL tools, improved HTML/js tools
    production .NET 4.0 -> .NET 4.5
    Hoping to see better startup performance, and use new APIs.

    The following are also changes I think are needed but which I haven't sold the team on yet.

    MSTest -> xUnit
    It seems MSTest integration (like test lists) are being retired by Microsft in favor of OSS tools. A big plus (use best of breed OSS where possible) but painful in short run, as we have everything in MSTest and test lists.
    SSIS -> SQLCMD or .NET Console (FileHelper OSS DLL)
    Migrate data import/export away from SSIS (for files under 100MB).

    Update 7/5/2012 5:10 PM

    Eliminate GUID PKs
    Eliminate GUID primary keys (uniqueidentifier) on all tables
    0

    Add a comment

  9. I have VS 2012 running on my main 2 solutions and things are running smoothly. I recently hit a significant problem.

    Platform / Tools info:
    1. I'm running Windows 8 Pro x64 Release Preview (as a VM, in Hyper-V)
    2. I'm running Visual Studio 2012 RC

    I also have Visual Studio 2010 SP1 installed, and I do swap back to that IDE 10% or less(for SQL Management Studio and SSIS tooling support) and we plan to have both IDEs installed for all top devs in the company for some time (until SQL tools and SSIS are moved completely to VS 12).

    Here's my problem: Publish to file system seems to be broken. I have a simple web services project (ASP.NET project hosted in IIS) that we've always used 'publish to file system' in VS 2010 to deploy. We're using config transformations, so the publish button makes managing and copying the transformations easy.

    I just tried it in VS 2012, and it says it deployed successfully, but nothing. It deleted all the files from the (remote) service folder, but it didn't deploy anything.

    I have a question: besides opening a web browser after the deployment, what does the new 'URL' setting on the publish profile do? Just used to open a browser, or does it 'do' anything else?
    1

    View comments

  10. Visual Studio 2012 doesn't have allow the 'compare' command when merging changes from one branch to another.

    Here is the uservoice request to add the feature to VS 2012.  If you know me please vote for it.  :)
    http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2947191-always-allow-compare-in-pending-changes-for-br


    It does allow it when VS is configured to use an external compare tool.  My favorite is SourceGear DiffMerge (free).

    Merge
    /m /r=%4 /t1=%7 /t2=%8 /t3=%6 /c=%9 %2 %3 %1

    Compare
    /t1=%6 /t2=%7 %1 %2

    Best feature: this tool also makes is brain-dead simple to move chunks of code (if you change your mind about checking in that web.config change at the last minute).  I'm really surprised VS didn't copy this feature from all the OSS merge tools.  They did all the work to have VS keyboard shortcuts and syntax highlighting, but didn't add 'move this block from 'Server' version to 'Local'.  This is now (finally) possible, but involves copy/paste and disrupts flow when reviewing large merges and large check-ins.



    1

    View comments

Blog Archive
Contributors
Contributors
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.