C#

Archived Posts from this Category

Afternoon Tea – 11th June 2013 – Open Source Projects I Like: Glimpse

Posted by on 11 Jun 2013 | Tagged as: .NET, Afternoon Tea, ASP.NET, C#, Community, Development, Morning Brew

A couple of weeks ago I watched the dotNetConf Open Source .NET Panel’ discussion which brought together a number of people from the .NET Open Source communities to discuss the state of Open Source in our community. The discussion was a good one, well worth watching and made me start to think about some of the Open Source projects I like – one of which features in this post.

Glimpse

Glimpse
Glimpse provides the answer for server side code that the likes of Firebug and Chrome Developer Tools provide for the client side developer. The project was originally conceived by Anthony van der Hoorn and Nik Molnar back in early 2011, and launched at Mix11’s Open Source Fest.

Glimpse did the usual Open Source project dance through many <1.0 releases, and mid last year became a project supported by Red Gate. Since then things have rapidly accelerated, and the community team have blasted beyond the 1.0 release threshold.

Today sees the announcement of Glimpse 1.4, along with a significant new look and feel introducing a Heads Up Display to make the most significant and useful information always available when Glimpse is enabled. Check out the announcement post over on the Glimpse Blog for the full lowdown, including a short video which gives a real impression of how the new Heads Up Display actually works.

More Heads Up

Get Your Head Up!

I love that adding Glimpse to a project while working is as simple as adding a NuGet package

Install-Package Glimpse.MVC4

Once installed, build and run your solution, and then hit up the Glimpse Handler to see what’s installed and to enable the tool

http://localhost:12345/glimpse.axd

So far all as expected. Now head back to your web application, and you will be greeted by the new look Heads Up Display at the bottom of the page, in all its Metro’esque glory.

Glimpse Heads Up Display

The Heads Up Display appears across the bottom of all pages when enabled, providing at a glance key metrics about the page:

  • Key Overall Timing Metrics
    • Overall Time
    • Time spent network communicating
    • Time Spent processing Server Side Code
    • Time until DOM Ready
  • Server Side Processing Breakdown
    • In the MVC case identifying the Controller
    • The Action processing time
    • The View processing time
    • The Time taken by Database queries triggered by the page
  • Realtime updating view of the Ajax Requests

Hovering the mouse over each of these sections gives further information about the metrics in a concise and clear, yet information dense way:
Heads Up Display Detail

More new UI awaits you on clicking the ‘g’ logo in the corner, the traditional way to summon Glimpse’s detailed FireBug like UI to the foreground, which has also had the Metro style make over. If you’ve ever used Glimpse before you will be familiar with the range of information available in here, including the very useful (and even prettier now) Timeline view:

Glimpse Detail View - Timeline

Why Glimpse Works for me

  1. Very, very easy to get up and running
    The ‘Pit Of Success’ is easy to get into, install the package, enable via a URL, and you are reaping the rewards.
  2. Tells me useful information
    Glimpse has the useful metrics, configuration and information readily available – other than enabling it there is nothing more that needs to be done
  3. Friendly and far reaching community
    Nik and Anthony are nice chaps and have fostered a good community round Glimpse, and care about engagement in the open source community. The community is growing with with ever increasing numbers of contributors and extensions for all kinds of things ranging from pure ADO to SignalR – I’ve found the SignalR one useful on a number of occasions
  4. Easy Extension
    It’s pretty simple to start adding your monitoring for your own functionality to a custom Glimpse tab (so easy I’ve managed it!)

I’ve found having the metrics Glimpse provides to be invaluable on a countless occasions, and I encourage you to try it out, or even better, get involved with the project itself.

Full Disclosure – Anthony & Nik gave me a preview of the new Head Up Display functionality a few days ago, which prompted me to tell you how much I’ve liked Glimpse for quite some time – No money exchanged hands, but I might let them buy me a drink when I finally get to meet them both ;)

The Morning Brew #1195

Posted by on 24 Sep 2012 | Tagged as: .NET, ASP.NET, C#, COM Interop, Database, Development, Links, Morning Brew, SysAdmin

Software

  • jQuery 1.8.2 Released – The jQuery Team announce the release of jQuery 1.8.2, a bugfix and performance regression fix release. As usual the files are available from the jQuery site, and should be making their way to the various content delivery networks.
  • IE 9.0.10 Available via Windows Update – The Internet Explorer Team have released a high importance security patch for Internet Explorer 9 to address recently reported security issues. Additionally there is an update for Internet Explorer 10 to address a Adobe Flash issue.

Information

Afternoon Tea – Sunday 10th June 2012

Posted by on 10 Jun 2012 | Tagged as: .NET, Afternoon Tea, ASP.NET, C#, COM Interop, Community, Database, Development, Links, Morning Brew, SysAdmin, Talks / Presentations

It’s been quite a while since the last ‘Afternoon Tea’ post, and there have been quite a lot of significant announcements in the past few weeks, coupled with my being busy at work which has resulted in me building up quite a backlog of links which I really wanted to include in a Morning Brew. This post is my attempt to ‘clear the decks’ and get caught up again, and also provides the perfect excuse to do a link roundup of DDD South West which I had the pleasure of presenting at at the end of last month.

Software

  • Introducing jQuery++ – Justin B Meyer and the folsk over at Bitovi announce the release of jQuery++, a collection of DOM helpers which complement and extend jQuery
  • Bundler.NET – Bundler.NET brings the CSS and JavaScript minification and combining features of .NET 4.5 to earlier versions of .NET. The installation is simple via a NuGet package and the API reflects the .NET 4.5 implementation.
  • bddify is moved to GitHub and is renamed to TestStack.BDDfy – Mehdi Khalili gives an update on TestStack.BDDfy, the project formerly known as bddify, discussing the name change, and change to the projects hosting, along with looking at the structure of the NuGet packages which amke up TestStack.BDDfy.
  • #mvvmlight V4 for Windows 8 RP is available – Laurent Bugnion announces the release of version 4 of his MVVMLight framework for Windows 8 Release Preview
  • Get latest CSS 3 support in Visual Studio 2010 – Mads Kristensen discusses how you can get the latest version of the CSS3 support into your Visual Studio 2010 installation providing a link to the schema files required and giving instructions on getting it setup and installed in Visual Studio 2010
  • Tree Surgeon – Alive and Kicking or Dead and Buried? – Bil Simser gives an update on an old tool that I used to make considerable use of in the past. Tree Surgeon was a tool to create a standardized format of Development Source Tree structure. In this post Bil discusses how the landscape of .NET development has changed in the 4 years since its last release with improvements in T4 Templating and NuGet, and questions if there is a future for the project.
  • Introducing RabbitBus – Derek Greer introduces RabbitBus, a .NET client API implementation for working with RabbitMQ, aiming to provide constructs which are not provided in the standard RabbitMQ .NET client. The library is open source with code available on GitHub, and the installation is available in NuGet package format.

Information

DeveloperDeveloperDeveloper South-West 4.0

The Morning Brew #479

Posted by on 18 Nov 2009 | Tagged as: .NET, C#, Development, Morning Brew

PDC

  • ASP.NET MVC 2 Beta Released – Phil Haack shares the news of the ASP.NET MVC 2 Beta release, announced as part of the PDC keynote. This beta release includes support for Visual Studio 2008 SP1, but not for VS2010 beta 2 due to that being on a different schedule
  • Windows Identity Foundation RTM! – ‘vibro’ highlights the PDC announcement of the GA / RTM release of Windows Identity Framework, Microsoft’s latest incarnation of identity products formerly know as Geneva.
  • Announcing the Identity Developer Training Course on Channel9 – Vibro also highlights the Identity Developer Training Course, a self learning set of content available on the Channel 9 site covering the use of identity in a number of scenarios such as Web, Web services, Azure
  • Microsoft Codename Dallas : Introducing "Dallas" – Moe Khosravy shares the announcement of the new Microsoft project codenamed ‘Dalas’ which brings hih quality information conent services to the Azure offering via a clean API. Moe also shares A Quick Overview of Dallas for Developers.
  • Developing and Managing Services with Windows Server AppFabric – Cliff Simpkins talks about the Windows Server AppFabric Beta 1 release which is designed to make it easier to build and scale out applications built on IIS. Key components of this technology are the Velocity Cache, Windows Communication Foundation, Windows Workflow Foundation, ADO.NET Data Services all of which enable SOA style applications to be built on the framework
  • Announcing Microsoft Sync Framework Power Pack For SQL Azure CTP – Maheshwar Jayaraman highlights the release of the Microsoft Sync Framework Power Pack For SQL Azure CTP which contains the Azure Data Sync tool which lets you synchronise data between your own SQL instances and Azure, the SqlAzureSyncProvider which eables synchronisation of existing data providers and adds in a number of SQL Azure metadata APIs, and a SQL Azure Offline Visual Studio plugin which enables you to build offline synchronisation routines with Azure
  • Azure – from July CTP to November 2009 PDC Release – Mike Kelly takes a look at the changes from the July CTP release of the Azure SDK through to the release for PDC 2009, highlighting the large key changes
  • Windows Azure case studies launched at PDC 2009 – Hanu Kommalapati highlights a number of Azure case studies showing the use of various Azure features in real world situations. Hanu also shares some of the details of the pricing of Windows Azure supported OS image types
  • Breaking Down ‘Data Silos’ – The Open Data Protocol (OData) – Mike Flasko of the ADO.NET Data Services Team talks about the new OData protocol for data sharing which aims to make interoperability between data sources much eaier
  • Introducing the Microsoft Open Data Protocol Visualizer – Noam Ben-Ami & Fabian Winternitz of teh ADO.NET Data Services Team share the release and show the Microsoft Open Data Protocol Visualizer a tool to help work with Open Data Protocol data from inside Visual Studio
  • PDC09 Demo App: Tailspin Travel (Visual Studio 2010) – Dr. "Z" highlights the availability of the full source of the TailSpin sample application being shown at PDC on CodePlex. This app, build in VS2010 Ultimate and requiring the new Azure AppFabric installed shows off a number of the new features being discussed this PDC
  • PDC 2009 Day 1: Future Directions for C# and Visual Basic – Sasha Goldshtein talks about some of the interesting stuff revealed at PDC about the two main .NET languages and also some interesting news about the respective compilers for each language

Software

  • Vim Emulator Editor For Beta2 Released – Jared Parsons updates his VIM emulator for Visual Studio 2010 Beta 2, bringing some traditional VIM Editor goodness to the Visual Studio IDE
  • SharePoint 2010 Beta 2 is finally here! – Eric Kraus highlights the release of SharePoint 2010 Beta 2 which will expire on 31 October 2010 and is available now to MSDN subscribers. Eric also links to a number of resources with help for getting installed and running
  • Announcing: IIS SEO Toolkit v1.0 release – CarlosAg highlights the release of the IIS Search Engine Optimisation Toolkit 1.0 RTM release. This release builds on the sucess of the Beta 1 and Beta 2 releases adding a number of bug fixes and new features while retaining backward compatibility with the betas
  • Deep Tracing of Internet Explorer – John Resig highlights a useful tool for anyone battling performance issues in JavaScript in Internet Explorer versions 6-8. dynaTrace Ajax looks like a really useful tool at a good price (free)
  • Reactive Extensions for .NET (Rx) released on DevLabs – Matthew Podwysocki highlights the release of the Reactive Extensions for .Net which was release on DevLabs today. This release covers .NET 4 beta 2, .NET 3.5 SP1 and Silverlight 3 giving lots of opportunities to play with this stuff.

Information

  • Getting Started with Entity Framework 4 – Simple Model First Example – Eric Nelson follows up from his TechEd presentation with a series of blog posts looking at the content he delivered there. This first part looks at implementing the Entity Framework from the model, using a empty model, building entities and pushing them back to the database
  • Security Tools : How to Configure WPL v1.0 SRE – RV takes a look at the Web Protection Library released last week showing how you go about setting it up and configuring it to protect your sites from a variety of attacks
  • TempData Improvements – Jacques Eloff talks about the improvements made to TempData in the ASP.NET MVC 2 Beta release
  • Pass Number 1: ActiveRecordEngine for ASP.NET – Rob Conery continues the discussion about a standard interface implementation for Active record allowing active record implementations from your ORM of choice to be plugged in.
  • ASP.NET MVC from Basics to Tips and Tricks – Michael Johnson shares his notes from his presentation to the Fort Smith .NET User Group on ASP.NET MVC basics and tricks and tips, bringing together a lot of the standard advice with simple small code samples to illustrate
  • How We Do Things – The Team Room – Scott C Reynolds continues his series looking at how his team do development with this post looking at how they organise their team room discussing layout, white boards, hardware, etc

Community

  • NotAtPDC – For those of us not at PDC this year, the .NET community has created the NotAtPDC events, a string of virtual events from well known speakers who are not at PDC either. There is a health list of sessions scheduled over the next few days, so check it out

Untrusted Network shares

Posted by on 30 Oct 2007 | Tagged as: .NET, C#, Design, Development, Software, SysAdmin

One of my longest standing pet hates with desktop software developed in .NET relates to the almost inevitable security exception that will occur if you attempt to run it from a network share. Its always one of the first things I notice about software, as I often download and unzip software onto my desktop (which on my work machine is located on a network share) and then attempt to run it in place. Many large and quite impressive pieces of software that get distributed as .ZIP files rather than installers suffer this plight, and a lot of them don’t handle the exception well (One that springs to mind was the much heralded release of NDepend 2.0).

The good news is that this anguish may well be about to come to an end, as Brad Abrams requests feedback about the .NET teams possible plan to make network shares trusted. As he mentions, there really is no good reason not to trust a network share for running managed .NET code – there is no such protection for unmanaged code, and there is little or no way a normal user would be aware of which is .a NET EXE and which is unmanaged EXE.

To answer Brad’s Questions:

A) Have you ever run into this limitation (a security exception when running a .NET application from a network file share)?

I frequently experience these issues – I tend to use this problem (and if its been worked round in the application) as a yard stick as to how well written the application is.

B) How often do you use network file shares for deploying applications (managed or otherwise)?

Most of my development is web based, however for utilities written for in house use we tend to distribute them on a network share – being able to run these in place would be a great help, as updating them would be easier.

C) If you think we should make this change, when would be a good time? Is it something we should do sooner in a service pack of the .NET Framework or later in a full release of the framework. Note, we are DONE with .NET Framework 3.5, so there is zero chance it is getting in that release.

From my point of view a patch as soon as possible, and have it included in the next release of the framework – Since this is a relaxation of the current restriction, I can’t see that it would cause any more problems in terms of support of existing application, as a reduction of the support incidents caused by this issue would reduce.

D) Can you ask your local network admin what they think of this issue? Would they be in favor of this sort of change? If so, when?

This change should simplify deployment – allowing Managed EXE to run from shares should mean that local disks can be more locked down as there would be no need to copy programs locally to run them.

All in all, I’m very much in favour of this change – It will level the playing field, give a more consistent user experience, and reduce the problems people have with winforms applications.

Invalid XML from a .NET web service

Posted by on 01 Oct 2007 | Tagged as: .NET, ASP.NET, C#, Development, Web Services, XML

10187684_78f140f0e2_m.jpg
Image Credit: kevinzim on Flickr

One of my basic assumptions about the .NET framework was proved incorrect last week. Up until then, I had believed that when you are using the built in framework classes for exposing web services you were always safe when it came to the output being valid XML. Sadly that turns out to be untrue, and to make matters worse, .NET will happily output XML over a web service even its own .NET web service clients can’t read.

There are certain characters that are forbidden from being in XML as per the official specification. These characters are the low ascii characters such as NULL, EOF etc. Its important to note that this is not a case of unescaped/unencoded versions of this character being disallowed, the encoded characters are also disallowed.

The problem with this isn’t that the .NET framework doesn’t understand these rules – it manages just fine when it comes to acting as a client to a web service serving these characters in content, throwing nice exceptions explaining that these characters are invalid. Additionally, the XML Text Reader has a property ‘Normalization’ which causes the XML reader to be more liberal and ignore invalid characters – but this option is not used within the automatically generated Web Service Client.

This problem isn’t limited to just the web services, standard XML serialisation also experiences the same problems. Here are bits of code that illustrate the problem:

[WebMethod()]

public string InvalidCharacter()
{
   return "" + (char)4;
}

public class MyClass
{
   public string Test = "" + (char)0;
   public static void Main()
{
     MyClass c = new MyClass();
     System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(MyClass));
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     System.IO.StringWriter sw = new System.IO.StringWriter(sb);
     xs.Serialize(sw, c);
     Console.WriteLine(sb.ToString());
    
     System.IO.StringReader sr = new System.IO.StringReader(sb.ToString());
     try
     {
         c = (MyClass)xs.Deserialize(sr);
     }
     catch (System.Exception ex)
     {
         Console.WriteLine(ex.ToString());
}
}
}

The little console application gives output like this:

<?xml version="1.0" encoding="utf-16"?>
<MyClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <Test>&#x0;</Test>
</MyClass>

System.InvalidOperationException: There is an error in XML document (3, 12).
System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character.
Line 3, position 12.

Unfortunately I haven’t yet found a fix for this – my only solution is to work around the problem by ensuring that these invalid characters can’t get into the system in the first place or clean the text on the get of each property of the serialized objects.

Things like this really worry me – our frameworks shouldn’t be outputting things that they can’t read – let alone outputting things that completely contravene the specifications. As always, any suggestions on an alternative solution to this problem are welcome.

Yahoo HackDay – Flickr Face Ball

Posted by on 17 Jun 2007 | Tagged as: .NET, C#, Community, Photography, Software

OK, the time has come to unveil my Hack for Yahoo Hack Day.  Face Ball is the ‘Crazy new game at Flickr HQ‘, and images have been popping up all over flickr as other join in.  Well now, you too can join in the fun, and just like Thom Shannon, make your own Face Ball images without risk of injury or special equipment.

Flickr Face Ball is a .NET 2 Windows Forms application that allows you to select images from you Flickr photo stream by tagging them as ‘ToFaceBall’, and add one of three different face ball images to the original photo, uploading the results to your Flickr account.

 

So, how do you get involved in this craze:

  1. Ensure you are running Windows with the .NET 2 framework – sorry Mac guys – this one probably isn’t for you.
  2. Download the Zip File
  3. Tag a few suitable images on your Flickr photo stream with the tag ‘ToFaceBall’
  4. Extract the .zip and run FlickrFaceBall.exe
  5. Enter your Flickr user account name into the box provided and click ‘Fetch From Flickr’
  6. Wait patiently while it loads the images.
  7. Choose an Image from the thumbnail strip at the bottom of the screen, choose a ball from the pallet on the left, and click on the image to position it.
    Face Ball picks on the BT Internet Van in the carpark
  8. When you have achieved the look you want, click save, enter a title and description, followed by Authenticate.
  9. When prompted in your browser, please allow the application to upload the images.
  10. Finally, click upload, and (hopefully) your creation will be be uploaded to your flickr stream.
    image 

Credits:

FlickrFaceBall uses the Flickr.NET API Implementation – I have only good things to say about this library – it just works ;)

Thom Shannon for providing the inspiration for the Hack, and also providing the PSD of face ball images.

Finally, to the original source of the Face Ball images – photo1 and photo2

Please Note: This program is hack quality code – It’s not been tested much, and if it breaks your computer, flickr account, or anything else, its your own responsibility.

 

Keys with multiple values in appSettings

Posted by on 08 Feb 2007 | Tagged as: .NET, C#, Development

One of my pet hates about the default ApplicationSettings within the .NET framework is the inability to work with multiple values for the same key in the config file (app.config or web.Config)

<appSettings>
   <add key="key" value="value1" />
   <add key="key" value="value2" />
   <add key="key" value="value3" />
</appSettings>

The built in support suggests that it would be possible to call the System.Configuration.ConfigurationSettings.AppSettings.GetValues("key") method to return a string[] containing all the values for the specified key. Unfortunately, the built in support only returns the last value defined (in my example above, “value3″)

Thankfully there are a number of very easy to use replacements for the standard support, and a variation on the solution proposed in Diego Mijelshon’s article How to make AppSettings work with multiple values for a key is one of the first things that I add into any application which will make use of AppSettings.

Code Project has a number of good articles about extending the default AppSettings support, two others which caught my eye are:

Next Page »