Standing on the shoulders of giants. RSS 2.0
# Thursday, January 22, 2009

This is not new, but something that helped me today.

When debugging, you can see the types in scope in the auto’s window:

Default debugger

This shows only the relevant information after expanding the view. One way of improving the experience is by implementing the ToString() method.

ToString method

While this helps a lot, this means you can’t use the ToString method for something else. Luckily in VS 2008 the DebuggerDisplayAttribute was introduced, this allows you to achieve the same effect and more.

DebuggerDisplayAttribute

And the code:

[System.Diagnostics.DebuggerDisplay("Date:{Date}, Value:{Value}", Name="{Name}")]
class Item
{
    public string Name { get; set; }

    public DateTime Date { get; set; }

    public int Value { get; set; }
}
Thursday, January 22, 2009 8:31:28 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0] - Trackback
C# | Codesnippet
# Tuesday, December 30, 2008

String.Join concatenates an array of strings together without checking for empty entries. This means the separator character is added twice, between non-empty items sometimes.

String[] input = {foo, null, bar};

var result = String.Join(",", input);

// result == "foo,,bar"

My alternative uses the IEnumerable.Aggregate extension method, it checks for there empty entries and when it finds one doesn't add a redundant separator.

 string[] input = { "foo", null, "bar" };
 string result = input.Aggregate((x, y) => String.IsNullOrEmpty(y) ? x : string.Concat(x, ",", y));

// result == "foo,bar"
Tuesday, December 30, 2008 5:40:12 AM (Pacific Standard Time, UTC-08:00)  #    Comments [1] - Trackback
Codesnippet
# Monday, November 03, 2008

After a week of geeking out, PDC 2008 is over. It was an intense week with a bunch of interesting announcements and promising technologies.

The highlights:

Dublin”: an application server build upon IIS 7 (Win2k8) hosting WCF and WF 4.0. But it’s more! Besides hosting WCF and WF, it also includes tooling (in the IIS management interface and Power Shell commandlets), templates in Visual Studio for deploying and a database filled with management information. (See also: BB18).

Geneva”: an STS (Security Token Server) which allows you to extract the authentication from your applications (making it the problem of the IT professionals ;-)). Using the Geneva Server and the Geneva Framework federation, extracting metadata about your users from diverse sources (age, shoe size etc.) becomes a matter of configuration instead of a matter of fragile hardcoded queries. (See also: BB42).

C# Futures: dynamic types, a little love from the dynamic languages for their static cousins. (See also: TL16 and TL10).

Boku: the best presentation from MSFT research, a ‘game’ which allows you to program using an Xbox controller.

Oslo”: a language “M”, a visual modeler “Quadrant” and a repository. Everything is data, the quadrant visual modeler is stored as data in the repository. “M” (and MGrammer and MSchema) allows you to define your own DSL for your problem (e.g. music library with songs), build a grammar for it and create an object graph in memory. Quadrant is a visual modeler for your Visual DSL, which gives your end users a very rich editing experience. I did a hands on lab with “Oslo” and Dublin, modeling a WCF and WF solution and deploying it all from Quadrant, very slick! (See also: TL23 and TL31).

Windows Azure: making hosting easy and cheap. Combined with all the announced services (.NET Services, SQL Services, Access Services, Workflow Services etc.) this is a very compelling story for hosting your websites and –applications without the headaches of scaling and maintenance. (See also: ES16 and BB01).

CodeContract class: the new CodeContract class in .NET 4.0 allows you to defined pre- and post-conditions for the parameters of your methods (should never be null) and uses static analysis to verify those conditions. (This and more changes to the CLR in 4.0 see: PC49).

Expect more detailed posts about these and other subjects after my vacation.

See you at PDC 2009 (17 November 2009 – 20 November 2009).

Monday, November 03, 2008 8:33:08 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0] - Trackback
Conference | PDC2008
# Tuesday, October 21, 2008

Scott Hanselman has some great tips for cleaning up disk space under Windows Vista. The best tip is using vsp1cln.exe to remove the sp1 install files.

vsp1cln.exe - After you install Vista SP1, it leaves around the original files so you can uninstall the Service Pack if you want. After a few months with the Service Pack, I've decided for myself that it's a good thing and decided I don't need the option.
Open up an administrative command prompt. That means, click the Start Menu, type cmd.exe, then right-click on it and click "Run as Administrator." Alternatively, you can press Ctrl-Shift-Enter to run something as Administrator.
Next, type "vsp1cln" at the command prompt. If you select yes, you'll get back around 2 to 3 gigs. The only thing, again is that you can't uninstall SP1.

Tuesday, October 21, 2008 12:59:52 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
General
# Monday, October 20, 2008

Last week the timeline for PDC08 was posted on the PDC site. All the sessions you previously selected, to help make a better schedule, are already added to your personal schedule. This is my schedule, based on the sessions I selected. As you can see, I have a small challenge, with 2-4 sessions at the same time, so I’m going to have some difficult choices to make.

Monday, October 27  
8:30 AM - 11:00 AM Keynote
11:00 AM - 12:15 PM Identity Roadmap for Software + Services
Deep Dive: The New Rendering Engine in Microsoft Internet Explorer 8
Under the Hood: Advances in the .NET Type System
12:45 PM - 1:30 PM Datacenters and Resilient Services
"Dublin" and .NET Services: Extending On-Premises Applications to the Cloud
1:45 PM - 3:00 PM Identity: "Geneva" Server and Framework Overview
The Future of C#
3:30 PM - 4:45 PM Microsoft Silverlight, WPF and the Microsoft .NET Framework: Sharing Skills and Code
Deep Dive: Dynamic Languages in Microsoft .NET 
Parallel Programming for C++ Developers in the Next Version of Microsoft Visual Studio
5:15 PM - 6:30 PM Developing and Deploying Your First Cloud Service
Microsoft Visual C++: 10 Is the New 6
WF 4.0: A First Look
IronRuby: The Right Language for the Right Job
Microsoft Visual Studio Team System Database Edition: Overview
Tuesday, October 28  
8:30 AM - 12:00 PM Keynote
12:45 PM - 1:30 PM WCF: Zen of Performance and Scale
1:45 PM - 3:00 PM SQL Server 2008: Developing Large Scale Web Applications and Services
SQL Server 2008: Beyond Relational
Essential Cloud Storage Services
Developing Applications Using Data Services
A Lap around "Oslo"
3:30 PM - 4:45 PM Architecture of the Building Block Services
Identity: "Geneva" Deep Dive
"Oslo": The Language
5:15 PM - 6:30 PM Live Services: Building Applications with the Live Framework
Identity: Live Identity Services Drilldown
Architecting Services for the Cloud
ASP.NET and JQuery
Entity Framework Futures
Wednesday, October 29  
8:30 AM - 11:00 AM Keynote
10:30 AM - 11:45 AM SQL Server Data Services: Futures
Live Services: Live Framework Programming Model Architecture and Insights
Service Bus Services: Connectivity, Messaging, Events, and Discovery
Microsoft Internet Information Services 7.0 and Beyond
WCF 4.0: Building WCF Services with WF in Microsoft .NET 4.0
Parallel Programming for Managed Developers with the Next Version of Microsoft Visual Studio
Panel: The Future of Programming Languages  403AB
12:00 PM - 12:45 PM SQL Server 2008: Developing Secure Applications
Microsoft XNA Game Studio: An Overview
1:15 PM - 2:30 PM SQL Server 2008: New and Future T-SQL Programmability
Logging, Diagnosing, and Troubleshooting Applications Running Live in the Cloud
Modeling Data for Efficient Access at Scale
Concurrency Runtime Deep Dive: How to Harvest Multicore Computing Resources
3:00 PM - 4:15 PM Live Services: Mesh Services Architecture and Concepts
"Dublin": Hosting and Managing Workflows and Services in Windows Application Server
SQL Server 2008: Deep Dive into Spatial Data
Offline-Enabled Data Services and Desktop Applications
"Oslo": Repository and Models
4:45 PM - 6:00 PM .NET Services: Access Control Service Drilldown
Deploying Web Applications with Microsoft Internet Information Services 7.0 and the Web Deployment Tool
Business Considerations for Cloud Computing
WF 4.0: Extending with Custom Activities
Thursday, October 30  
8:30 AM - 9:45 AM SQL Server Data Services : Under the Hood
Dynamics Online: Building Business Applications with Commerce and Payment APIs 
Developing RESTful Services
Microsoft .NET Framework: Declarative Programming Using XAML
Research: Contract Checking and Automated Test Generation with Pex
10:15 AM - 11:30 AM Messaging Services: Protocols, Protection, and How We Scale
ASP.NET: Cache Extensibility
Microsoft .NET Framework: CLR Futures 
1:45 PM - 3:00 PM Workflow Services: Orchestrating Services and Business Processes Using Cloud-Based Workflow
Identity: Windows CardSpace "Geneva" Under the Hood
An Introduction to Microsoft F#
Monday, October 20, 2008 3:03:55 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Conference | PDC2008
# Monday, October 06, 2008

Blog Bling BrainLast week the final (25) sessions were added to the PDC Session list, making it a total of 178 sessions. I’m not sure which sessions are new or updated, so this list will not be unfamiliar to regular readers of this blog (all 5 of you).

The sessions I will try to attend, if they can schedule around my wishes, are: sessions about “Oslo”, “Zermatt”,  CLR Futures, some language sessions (C#, F#, Dynamic Languages, XAML), “Dublin” and the Parallel Symposium.

Update: I had another look at the session list today and 10 more sessions were added, making it a total of 188.

Monday, October 06, 2008 7:38:07 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [1] - Trackback
Conference | PDC2008

Yesterday dasBlog 2.2 (2.2.8279.16125) was released on CodePlex. This release adds OpenID for comments (and admin login), support for IIS 7 and support for custom 404 pages.

As always you can download the web- and the full install from CodePlex or get the source from repository.

Monday, October 06, 2008 1:38:21 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
dasBlog
# Friday, October 03, 2008

AnnotatedTuringCover25In 1936 Alan Turing wrote a paper "On Computable Numbers, with an Application to the Entscheidungsproblem [0]". The most interesting result of this paper is not the conclusion, that there cannot be a general solution to the Entscheidungsproblem, but how Alan Turing reached that conclusion. In his paper he introduces a computing machine (a Turing machine) with a limited number of operations, by showing that such a machine can not determine the ultimate fate of all other machines, he proves there is not general solution.

In 2008 Charles Petzold wrote "The Annotated Turing", in this book he dissects the original paper from Alan Turing. This book not only presents the original paper (and the appendix and corrections) with numerous annotations and samples, but also is a biography of Alan Turing's life and an introduction to the mathematical background, required for understanding the paper. The book concludes with an overview how the Turing machines can be used to help understand the human mind and the universe.

This is a highly recommended book, which is very accessible for anyone with a general interest in computes and mathematics. And a must read for all developers, who want to understand why there can't be a general program which verifies all programs are error free.

[0] The Entscheidungsproblem asks for a general decision procedure with a finite number of steps to determine the provability of any given well-formed formula.

Friday, October 03, 2008 7:53:13 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
Reading
# Wednesday, October 01, 2008

The ‘normal’ use case for using templated databound controls like the listview control is to specify the control and the templates in declarative markup and bind the control in the code-behind.

 <asp:ListView runat="server" ID="listview">
     <LayoutTemplate>
        <ol><li runat="server" id="itemPlaceholder" />ol>
     LayoutTemplate>
     <ItemTemplate>
        <li><%#Eval("item") %>li>
     ItemTemplate>
 asp:ListView>

and in the code-behind:

listview.DataSource = ....
listView.DataBind();

But when you’re building a webpart or a composite control, this is generally not really an option. The way to define templates in the code-behind is to define two classes which implement the ITemplate interface and assign an instance of these classes to the LayoutTemplate and the ItemTemplate properties. (There are a lot more templates you can use, but these are used to show how the concept works.)

The Layout template is the simplest to define:

private class LayoutTemplate : ITemplate
{
    public void InstantiateIn(Control container)
    {
        var ol = new HtmlGenericControl("ol");
        var li = new HtmlGenericControl("li") { ID = "itemPlaceholder" };
        ol.Controls.Add(li);

        container.Controls.Add(ol);
    }
}

The only requirement is that it control with the ID itemPlaceHolder, the listview uses this ID to find the control to replace with the item template when databinding.

The InstantiateIn method in the item template is similar to that method in the layout template: a control is created (the same type as previously) and this is added to the container control, effectively replacing the child-control (with the itemPlaceHolder ID) from the layout template. The only difference is that we register for the databinding event of the childcontrol. In the databinding method a reference to the childcontrol is obtained (the sender parameter) and a reference to the current item from the bound collection.

private class ItemTemplate : ITemplate
{
    public void InstantiateIn(Control container)
    {
        var li = new HtmlGenericControl("li");

        li.DataBinding += DataBinding;
        container.Controls.Add(li);
    }

    public void DataBinding(object sender, EventArgs e)
    {
        var container = (HtmlGenericControl)sender;
        var dataItem = ((ListViewDataItem)container.NamingContainer).DataItem;

        container.Controls.Add( new Literal(){Text = dataItem.ToString() });
    }
}

Complete source: FibonacciControl.txt (1.88 KB)

Wednesday, October 01, 2008 3:47:00 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] - Trackback
ASP.NET
Ads
About
© Copyright 2012
Paul van Brenk
Sign In
newtelligence dasBlog 2.3.2011.0
All Content © 2012, Paul van Brenk
DasBlog theme 'Business' created by Christoph De Baene (delarou)