Sunday, September 18, 2011

Some big news coming out of Microsoft's Build 2011

 Yesterday I was anxiously waiting for the news from Microsoft Build 2011. Everyone from tech community is expecting some big announcement from Microsoft.
And Microsoft stood up to the expectation & announced some big ticket changes in technology too (good or bad is up to you J).

1.      Windows 8 developer preview release:
The first developer preview version of windows 8 is out & you can try out at  http://msdn.microsoft.com/en-us/windows/apps/br229516
Some highlights of Windows 8 :
·         First Microsoft’s OS to exclusively designed for tablets.
·         First Microsoft’s OS to run on ARM architecture (good bye to Intel).
·         Heavily influenced by Metro UI of Windows 7 mobile (In opinion metro UI looks crap ).
·         Supports HTML5 / CSS based application.(Microsoft is putting XAML and HTML/CSS on an equal footing in that regard. So speculation is  WPF/Silverlight might not be the preferred UI language for Windows platform)
·         Multiserver management. (Server version only)
·         Friction-free server deployment( Windows Server 8 inherits Windows Server 2008's wizards for installing roles and features,
but combines them in what Microsoft calls "scenario-based deployment." Server version only)
·         IP address management (Windows Server 8 introduces a full-featured IP address manager that combines network discovery, static and dynamic address allocation,
DNS and DHCP monitoring, and network auditing capabilities all in one place. Server version only)
·         Dynamic Access Control (Server version only)
Today's folder-centric model for access control makes it all too easy for permissions to get garbled  and auditing is a horror.
Dynamic Access Control doesn't replace your current file and folder permissions, but allows you to layer global policies and claims-based access controls on top of them (just like circles in Google +).

2.      Visual Studio 11 developers preview: (Available in MSDN downloads )
Visual Studio 11 provides an integrated development experience that spans the entire lifecycle of software creation from architecture to code creation, testing and beyond.
This release adds support for Windows 8 and HTML 5, enabling you to target platforms across devices, services and the cloud.
Key Features :
·         Develop Metro style Apps for Windows 8. (Template support for Metro style app in various languages like C# , VB, C++).
·         Open Expression Blend support from VS 11.
·         Enhancements for Game Development (Visual Studio 11 provides access to a number of resource editing, visual design, and visual debugging tools for writing 2D / 3D games and Metro style applications.)
·         Code Clone Analysis (Much awaited).
The Code-Clone Analysis tool in Visual Studio 11 examines your solution looking for logic that is duplicated, enabling you to factor
this code out into one or more common methods. The tool does this very intelligently; it does not just search for identical blocks of
code, rather it searches for semantically similar constructs using heuristics developed by Microsoft Research.
·         Code Review Workflow with Team Explorer:
Visual Studio 11 Preview works hand in hand with Team Foundation Server 11 to provide best in class application lifecycle management.
Visual Studio 11 facilities collaboration is by enabling developers to request and perform code reviews through using Team Explorer.
·         Exploratory Testing and Enhanced Unit Testing:
The Exploratory Testing feature is an adaptive tool for agile testing that enables you to test without performing formal test planning. You can now directly
start testing the product without spending time writing test cases or composing test suites. When you start a new testing session, the tool generates a
full log of your interaction with the application under test. You can annotate your session with notes, and you can capture the screen at any point and add the resulting screen shot to your notes.
3.      .Net 4.5: (Available in MSDN downloads)
Following are some features:
·         .NET for Metro style apps. (Obvious)
·         Async support in c#:
The feature introduces two new keywords, async and await. The async modifier specifies that a method is
an async method. When called, an async method returns a Task or Task(Of TResult), which represents the ongoing work of the method.
·         The Managed Extensibility Framework (MEF) provides the following new features:
o   Support for generic types.
o   Convention-based programming model that enables you to create parts based on naming conventions rather than attributes.
o   Multiple scopes.
·         A bunch of new features for ASP.NET 4. Like new HTML5 form types, unobtrusive JavaScript in client-side validation scripts, encoding routines from the AntiXSS library (previously an external library) to protect from cross-site scripting attacks etc.
·         In the .NET Framework 4.5 Developer Preview, Windows Presentation Foundation (WPF) contains changes and improvements in the following areas:
o   The new Ribbon control, which enables you to implement a ribbon user interface that hosts a Quick Access Toolbar, Application Menu, and tabs.
o   The new INotifyDataErrorInfo interface, which supports synchronous and asynchronous data validation.
o   New features for the VirtualizingPanel and Dispatcher classes.
o   Improved performance when displaying large sets of grouped data, and by accessing collections on non-UI threads.
o   Data binding to static properties, data binding to custom types that implement the ICustomTypeProvider interface, and retrieval of data binding information from a binding expression.
o   Repositioning of data as the values change (live shaping).
o   Better integration between WPF and Win32 user interface components.
o   Ability to check whether the data context for an item container is disconnected.
o   Ability to set the amount of time that should elapse between property changes and data source updates.
o   Improved support for implementing weak event patterns. Also, events can now accept markup extensions.
·         From WCF:
o   Simplification of generated configuration files.
o   Support for contract-first development.
o   Ability to configure ASP.NET compatibility mode more easily.
o   Changes in default transport property values to reduce the likelihood that you will have to set them.
o   Updates to the XmlDictionaryReaderQuotas class to reduce the likelihood that you will have to manually configure quotas for XML dictionary readers.
o   Validation of WCF configuration files by Visual Studio as part of the build process, so you can detect configuration errors before you run your application.
o   New asynchronous streaming support.
o   New HTTPS protocol mapping to make it easier to expose an endpoint over HTTPS with Internet Information Services (IIS).
o   Ability to generate metadata in a single WSDL document by appending ?singleWSDL to the service URL.
o   Websockets support to enable true bidirectional communication over ports 80 and 443 with performance characteristics similar to the TCP transport.
o   Support for configuring services in code.
o   XML Editor tooltips.
o   ChannelFactory caching support.
o   Binary encoder compression support.

For more details please visit

Saturday, September 10, 2011

TextBlock Vs. Label (The Ultimate battle for UI Supremacy)


In WPF both Textblock and Label are used to show a small amount of text means visually both snippets produce the same UI.
But if you always has this confusion which one to use (Label or TextBlock) when showing a readonly data in GUI? Then just try to show “Label_Vs_TextBlock” in UI you will get your answer.
Label will show it as “LabelVs_TextBlock” (Label.Content = "Label_Vs_TextBlock").
TextBlock will show it as “Label_Vs_TextBlock”  (TextBlock.Text= "Label_Vs_TextBlock").
As you can see Label is taking the first Underscore as AccessKey & removing it. While TextBlock is showing it perfectly.
So what does this mean TextBlock has won the ultimate war for showing readOnly text on your UI.
Then you are wrong, think again ………………

There is a big difference between the two:
TEXTBLOCK: TextBlock lives in the System.Windows.Controls namespace, it is not a control. It derives directly from FrameworkElement. TextBlocks are used in a lot of controls to display text.

LABEL:
Label, on the other hand, derives from ContentControl means that label can: be given a custom control template (viaTemplate property), Display data other than just a string (via Content property), Apply a DataTemplate to its content (via ContentTemplate property), and you can do whatever else a ContentControl can do that a FrameworkElement cannot. It supports access keys.


Label vs TextBlock (class hierarchy)

Still, If the above problem of accessKey is a nightmare to you help yourself & use the  below style
      <Style x:Key="{x:Type Label}" TargetType="Label"> 
        <Setter Property=
"Template"> 
          <Setter.Value> 
            <ControlTemplate TargetType=
"Label"> 
              <Border> 
                <ContentPresenter 
                  HorizontalAlignment=
"{TemplateBinding HorizontalContentAlignment}" 
                  VerticalAlignment=
"{TemplateBinding VerticalContentAlignment}" 
                  RecognizesAccessKey=
"False" /> 
              </Border> 
            </ControlTemplate> 
          </Setter.Value> 
        </Setter> 
     
</Style> 


CONCLUSION:
If you want to use styles in WPF correctly (and you need to modify the margin, etc), It is recommended to use a Label instead of a TextBlock. TextBlocks are used inside a lot of controls, and modifying the TextBlock style has a major impact on how most controls (such as a Button, ComboBox, GridView Columns, etc) behave.

So, if you want to display text as a control itself, always use Label. The benefits of showing
styles correctly (and have more control over styles and themes) are better than the fact that a TextBlock is lighter.