Wednesday, June 06, 2012

Windows 8 Doesn't Woo Enterprise Users


Last week I attended an event hosted by Markus Egger about .NET and Windows 8 Developer know-how! I felt a bit of pressed to write something about it because I am concerned about Microsoft's strategy for one OS to combine metro and desktop. I don't question Microsoft can produce a stunning OS to compete with iOS + MacOS on consumer tablets market. If there is one company other than Apple on the earth, it got to be Microsoft. However, is it really a good idea to combine metro with desktop? Really? How soon will the laptops and desktops all have the touch screens? How about multiple monitors?

My concerns were mainly for enterprise users and how Windows 8 would roll into enterprise domain:

  • Windows 8 customer preview doesn't provide the flexibility to configure WorkStation only or Metro mode only. I hope Microsoft will fix this. For enterprise users, there is no need to have metro mode. Windows 7 is a huge success. Windows 8 desktop mode didn't do much to improve it further. There will be a new windows explorer with ribbons panes for documents and library. The task manager will be revamped to have more information. So instead call the workstation windows 8, we can call it Windows 7.1. The good thing about the workstation mode is that it supports everything Windows supports before.
  • Metro mode can run on ARM processors for power efficiency and long battery life. Microsoft appears not to want existing applications to run on ARM unless they are redesigned for Metro – though it says there will be a version of its Office suite for ARM systems. But there is No Office suite for Windows 8 metro mode. You have to use desktop mode to run office suite. How can you imagine the enterprise Windows users not use Office?
  • There will be Two Version of IE(s). As a developer, I can foresee the compatibility issues just between these two versions of IE. According to Markus, one IE will run with System32.dll and the other runs on WinRT. One supports plug-ins (Flash and Silverlight) and the other will not. How the enterprise web site to adjust that? Does enterprise have to convert everything to HTML5?
  • The metro mode will Not Support Multi Monitors. Can you imagine the user with multiple desktops to switch to metro style and see other screens blank. I am not sure if this is the final decision yet but it doesn't make senses to me if it is to-be-shipped "feature". We should not call Metra mode Windows. Instead I think Windows 8 should call it Window 8 (Windows without s).
  • The metro mode has Limited Multi-Tasking Support. It makes sense for slate-and-touch devices because everything is running as full screen. Limiting tasks will save the power assumption. However, does it make sense for plugged in desktops and laptops? Especially for multi-monitor desktops. This is doesn't make sense for enterprise users.
  • Deployment metro style application will be a chore. The only way to deploy metro application is through AppStore. I don't think this is very friendly for enterprises. Does enterprise will allow Microsoft check the source code before the application get approved to be added to the store?
  • Xaml Compatibility is very low according to XAML Comparer Tools between WPF and Metro. It's about 20-% compatible between existing WPF and Silverlight xaml application (This tool allows for comparison of different XAML dialects and utilized framework namespaces. Want to know if your Silverlight project will translate well to Windows 8 Metro? And whether your Metro assets can be reused in your Windows Phone app? And how about that WPF app?)
  • No Start Menu for workstation mode, really???
In the end, I have to come to the conclusion – Windows 8 doesn't have enough attractions for the enterprise users. It might be a huge success in consumer market. All the opinions are personal and based on what I got from the meeting. So they could be biased and not accurate.

We will see.

Tuesday, April 17, 2012

Configure NLog ColoredConsole

I like NLog because it is probably the easiest logging framework I used. By simply copying NLog.config file to the project and set the Build Action to Content, I can use NLog in my code now. NLog support ColoredConsole. However, the default color scheme doesn't seem to make sense to  me. Here is the example, you can see the Error level is yellow. The Debug level is the same white color as Info level.

Fortunately, it's very easy to configure NLog to use different color scheme. Here is the color scheme I used.

Error/Fatal level: Red
Warn level: Yellow
Info level: White
Debug level: DarkGreen

Here is the configuration file correspondingly.


  <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <targets>
      <target name="console" xsi:type="ColoredConsole" layout="${longdate} [${whenEmpty:whenEmpty=${threadid}:inner=${threadname}}] ${level} ${logger} ${message} ${exception:format=tostring}">
        <highlight-row condition="level == LogLevel.Error" foregroundColor="Red" />
        <highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />
        <highlight-row condition="level == LogLevel.Info" foregroundColor="White" />
      </target>
      <target xsi:type="File" name="file" layout="${longdate} ${level} ${logger} ${message} ${exception:format=tostring}" fileName="${basedir}/logfile.log" keepFileOpen="false" encoding="iso-8859-2" />
    </targets>
    <rules>
      <logger name="*" minlevel="Info" writeTo="console" />
    </rules>
  </nlog>

Thursday, November 17, 2011

Kudos for JetBrains - TeamCity Notification

I have been used quite a few of source control systems and build systems, such as ClearCase, CVS, SubVersion, CruiseControl, GitHub, and Team Foundation Server.

TeamCity is a new one for me. But I always know JetBrains will always have some great products, just like ReSharper which is one of my core tool-set. TeamCity supports both Java and .NET software development teams and integrates with the most popular VCSs, IDEs and development frameworks to ensure a smooth and stable development workflow.

I am most impressed by how easy it is to setup and how many build notifications TeamCity supports. Kudos to JetBrains.
It supports Windows system tray notifications;

It also supports RSS so I can read from my RSS reader.

Tuesday, October 25, 2011

Demystify Roslyn

Today I watched the video of //build/ C# 5.0, VB 11, Visual studio 2011 New Features from Anders Hejlsberg - Windows Runtime support, Asychronous support, Call Information attributes, Roslyn project, Script engine etc.  Mostly interested to me is that it demystify what Roslyn can do. It is indeed very cool.

The foundation of this Roslyn is a new C# compiler, written in C# (and a new VB compiler written in VB too, see the VB Team blog for details). This compiler is written as a library that exposes a rich public API. Next up is a new language service written purely using that public API and exposing its own extensibility points to allow 3rd parties to do amazing things inside Visual Studio with that language understanding.

Traditionally, compilers are black boxes -- source code goes in one end, and object files or assemblies come out the other end. The Microsoft “Roslyn” community preview changes that model by opening up the VB and C# compilers.

Compilers in “Roslyn” provide APIs to allow tools and end-users to share in the wealth of information the compilers have about code. The Microsoft "Roslyn" CTP previews the new language object models for code generation, analysis, and refactoring, and the upcoming support for scripting and interactive use of C# and Visual Basic.

Tuesday, September 27, 2011

Picked Silverlight 4.0 over WPF 4.0

It has been two months to work on a POC for a new client, a major marine transportation company. I am the sole SunGard technology resource along with BAs to work with the client. It is very rewarding to work on the archeticture from ground up. It gave me the chances to compare the technologies side by side. We have hand-picked the following technologies the in-house transportation scheduling engine.

  • Silverlight, and XAML
  • MVVM, and Prism
  • Unit tests, MSTest, MOQ, and TDD
  • Multi-threaded programming, and TPL
  • Distributed System, and NServiceBus
  • Entity Frameworks, and WCF Data Service
  • WCF, and REST
  • FitNesse, SliMTest, and Acceptance Test
  • Telerik Silverlight Controls
  • Distributed Cache, e.g. SharedCache, AppFabric
  • Oracle ODP .NET client to Oracle Financial System
Visualization is the key of the POC. The reason that we pick up Silverlight over WPF is that the map performance. Telerik Map Silverlight Radcontrols is performing much better than WPF with the DeepZoom technology. The map is the highlight of the POC. It visualize the routes, the locations, the boat speed, and scheduling features. On the plus side, Silverlight can also support multiple platforms like Apple MacOS. So Silveright wins. To be honest, as a developer I would never like Silverlight over WPF. But the map is just so beautiful and more informative than any other means. WPF doesn’t support it as well as Silverlight.



Monday, July 04, 2011

TPL Dataflow Presentation


With quite good responses to my presentation about .NET Task Parallel Library (TPL) to both the office SunGard and the client BoA/ML, I am asked to give another presentation to the first meeting of SunGard Houston .NET interested group. This time I am going to add TPL Dataflow (Visual Studio Async) to the talk. There are a few good points about TPL dataflow which I am very pleased with. I am pretty sure the presentation will generate a lot of interests in the techie community of the office.

First of all, as we all know, in particular TPL did not focus on problems best expressed with agent-based models or those based on message-passing paradigms. TPL Dataflow is focused on providing building blocks for message passing and parallelizing CPU- and I/O-intensive applications with high-throughput and low-latency.


Secondly, you can actually use Rx in Task Dataflow. Rx is predominantly focused on coordination and composition of event streams with a LINQ-based API, providing a rich set of combinators for manipulating IObservable<T>s of data. You can let data flow blocks to be exposed as both observable and observers, therefore enabling direct integration of Rx library.


The implementation is extremely flexible and give the developers a lot of options. TPL Dataflow is comprised of "dataflow blocks," data structures that buffer, process, and propagate data. They can be either sources, targets, or both, in which case they're referred to as propagators, e.g.
ActionBlock, BufferBlock, BoadcastBlock, WriteOnceBlock, TransformBlock, BatchBlock, JoinBlock, and BatchedJoinBlock.

Tuesday, March 29, 2011

.NET 4.0 TPL Rocks!

I’ve been working with multi-threaded programming since C# v1.0 with Visual Studio 2003. Before that, I have a few years working on multi-threaded programming in Java and C++.

There were a few things I hated on multi-threaded programming: imperative programming, implicit contract, and heavy thread composing; Thread interacting with WaitHandles like ManualResetEvent and AutoResetEvent; concerns about the race conditions, dead locks, live locks, thread starving etc. The last but not the least is the debugging. When there is something going wrong, it is really hard to debug without a good tool.

Task Parallel Library, or TPL, is a new .NET 4.0 new library, an component of the .NET 4.0 Parallel Frameworks. After I used it in my project, I felt Microsoft really hit the ball off the park this time.

TPL is EASY. TPL is just like the easy button. It is easy to use. It is easy to debug. It is easy to boost the performance of your application. If you have not started to use it in your project, I would strongly recommend you to start to use it or encourage your developers to use it.

Tasks vs Threads -> Tasks don’t equal to threads. You can think of Tasks are threads without all the threads’ drawbacks. Threads are single core, expensive on resources, such as 2M user mode memory plus kernel constructs. Thread needs time to startup and dispose. The most important is that the context switching the performance killer.

TPL is better in performance than using thread:

· Task scheduler has been highly optimized to utilize multi-processors with the brand new thread pool.

· There are less startup and tear down (mostly I/O) time for tasks than for threads.

· There is less time spending on context switching for tasks than for threads when threads are more than cores. Performance will degrade if the thread manager is not multi-core aware and thread running time aware.

· Memory (I/O) has been pre-allocated for the thread pool.

Here are some tips I learned to use TPL:

-- -- TPL Tips – Creating Task

· You can pass delegate to the constructor, either Action or Func. You can pass LINQ expression as well.

· You can create Task and run it right away. Or you can just create a task and declare it’s running condition.

· You can define TaskCreateOptions, such as LongRunning, or AttachedParent

· You can pass in Cancellation token.

-- -- TPL Tips – Passing data

· You can pass any object inherited from System.Object

-- -- TPL Tips – Returning

· This is way better than old TheadPool.QueueUserItem

-- -- TPL Tips – Waiting

· Waiting is a good way to declare parallelism

· Wait, WaitAll, WaitAny

-- -- TPL Tips – Cancelling

· Cancelling is cooperative

· CancellationTokenSource can be used once.

· Cancellation Token can be passed into task creation or waiting

· The beauty of the cancellation token is once the cancellation token source is cancelled, if the task has not been scheduled, it will not be executed.

-- -- TPL Tips – Continuing

· Task.ContinueWith

· Task.Factory.ContinueWhenAll()

· ContinuationOptions (OnlyOnFaulted, OnlyOnCancelled, NotOnRanToComplete)

· Continue with ParentTask.Result

-- -- TPL Tips – Composing

· AttachedToParent

8. -- TPL Tips – AggregateException

9 . -- TPL Tips – Cool Tools

· Parallel Tasks (see the location of code)

· Parallel Stacks (see the stack of the code)

What is hot in the coming releases in .NET 5.0?

Task DataFlow (TDF) – is based on Concurrency and Coordination Runtime and Visual C++ Asynchronous Agency 2010. Currently it is based on.

Visual Studio Async - async and await keywords. You can await anything, not only Task and Task.


Like I mentioned, if you haven't started to use TPL, you should start now. TPL is easy to use, easy to debug, easy to boost the performance of your application.

Be A Developer That Uses AI

Developers will not be replaced by AI, they'll be replaced by developers that use AI. Generative AI tools are revolutionizing the way de...