Polly Transient Fault handling

So I started reading about Paramore Brighter CommandProcessor, didn’t get far and started reading about the packages it uses. This called out Polly (github)  this project takes the voodoo out of writing retry handling. In the past I’ve raised comments on .NET discussions expressing my desire for this to be built directly into the BCL. That never really seemed to go anywhere.

 
really seemed to face the same dilemma and decided to roll his own. I haven’t used it yet, but from reading the markdown readme it has a beautiful fluent interface. I will definitely be using this in the future. Some usage examples:

// Retry multiple times, calling an action on each retry 
// with the current exception, retry count and context 
// provided to Execute()
Policy
    .Handle<DivideByZeroException>()
    .Retry(3, (exception, retryCount, context) =>
    {
        // do something 
    });

Just awesome.

MOAR BLOGZ

So it’s been a somewhat rather long time since I’ve posted. Numerous times I’ve said to myself I need to dedicate time and post some real blogs. Clearly that didn’t work out. Since that hasn’t absolutely occurred. I’m going to do some pseudo-micro-blogging and talk about some stuff I’ve learned recently. Each post will likely be short, but I’ll have new stuff! Finally!

Also I’ll have an elaborate bookmark for myself. I’m self serving, what can I say.

MySpace releases a new version, and a lesson in the worst things you can do to your users

Below is a screen shot of the new myspace:


what myspace does wrong in their new release

First the most blatant and unacceptable thing to do to your users is throw out all of their existing content. Not only did it seem to not carry over one single shred of my profile other than name and location, it does not even seem to have carried over my friends list. That is just unbelievably silly.

Next up is the primary input box is nearly entirely off the page. I run 1920×1200 resolution and do not browse with my window full screen. It seems that they just assume you have your viewport to be the same size as your resolution.

For some reason this layout uses horizontal scrolling, i think this is more related to buggy design than actual intent. Next to the text input and where it says my “stream is empty” is a gigantic void that goes over some 1000+ pixels off screen. (Did it erroneously calculate resolution based on the fact I’m using dual monitors?)

When you get the mouse anywhere near the bottom of the page, that hideous gigantic thing pops up, I don’t even know what it is. I assume it’s a track list for listening to music on myspace. This thing pops up incredibly easily and then stays there. When it’s there you can no longer across the horizontal scroll bar so depending where you are you might actually be blocked from interacting with the site altogether until you trigger a hover out to make it go away. (I really hope it doesn’t function like this on a tablet/phone)

I could point out alot of things they got right with the new myspace, but these flaws are just so gigantic and so gaping there is no room for discussion of improvement when you drop a nuclear bomb on your users and delete all of their created content. [Naysayers hush, yes I know the content likely exists still on old myspace somewhere, somehow, but i’m speaking in terms of how a user would feel about their usage and their experience].

Comcast Metro Ethernet and How much does it cost?

Comcast has been advertising a new line of service for business users called Comcast Metro Ethernet. This is really just standard fiber to the premises. They do a good job of not making any information available online to figure out pricing.

Recently I was involved with discussions about this service. These figures are loose numbers for the Central PA region. I cannot be certain whether the prices are wildly different across the country. These prices also assume Comcast does not need to incur very significant costs for running fiber to your premises. These costs also expect a multiple year commitment.

Comcast Metro Ethernet is unmetered fiber to the building. You purchase it per megabit and as a symmetric connection. There is no option for asymmetric speed, and there is no option for metered traffic. Basically they expect you to purchase a line that sits idle for a significant portion the month as opposed to selling you service based on actual usage. This is very disappointing.

On to the numbers!

10 mbps – $800/month

20mbps – $1100/month

50mbps – $1500/month

70mbps – $1800/month

100mbps – $2300/month

Not very impressive.

Edit: Apparently my not very impressive remarks are for US high speed internet industry as a whole. Comcast’s pricing was competitive compared against Level 3 and lower cost than most other providers in our region. It’s still disappointing to see that apparently no provider offers a plan along the lines of 500mbps or 1000mbps metered pay as you go. Or even sold with XXXX GB allocated upfront and then per use fees afterwards.

Renaming a group of files

Today I needed to do a mass replacement of file extensions to a different extension, this is very painful to do in Windows from anything I could see.
In the past I’ve used DIR to get file names and then excel to create a bat file of ren file.foo file.bar to be able to be expanded to every file, very painstaking.
Today i decided I would use powershell, should be alot easier, started looking up how to do it and instead found: ReNamer by Denis Kozlov. This tool gave me what I needed within seconds! It’s free for personal use, paid for commercial (don’t know how much there’s only a contact form about it). It lets you set up rules to do all kinds of things, I only need a very trivial setup, 1 rule “replace foo with bar” and to uncheck ignore extensions.
It even gives you a preview of the intended changes!

Debugging layered http calls with fiddler

You may reach a point where all you want to know is EXACTLY what is a web server returning to you over http whether it’s from a webservice or even just regular http call. At times this can become very tricky to get access to the raw responses when your requests go through a webservice client like WCF or a http client like EasyHttp.

Yesterday this cropped up that I wanted to get access to the raw response of a web application that I consume from another web application over EasyHttp.

The simplest way to make sure a request goes to the fiddler proxy is replace localhost with ipv4.fiddler (or ipv6.fiddler if that’s what you’re interested in). However there are many scenarios where this won’t work, especially in .NET tools that this results in

The remote name could not be resolved: ‘ipv4.fiddler’

The way I was able to accomplish this:

Instead of having app1 call localhost/restful to change the url to be machineName/restful.

In addition to this change you want to add this section to your web.config while debugging

<system.net>
<defaultProxy>
<proxy usesystemdefault="False" bypassonlocal="False" proxyaddress="http://127.0.0.1:8888 " />
</defaultProxy>
</system.net>

Between these 2 changes this should force the traffic to go across Fiddler’s proxy to be able to be properly captured.

BloggingContext.ApplicationInstance.CompleteRequest();

Nuget package creation harmony with Visual Studio

Over a year ago I opened a post on Nuget’s Codeplex detailing how creating packages, to put it bluntly, just sucked. Nuget has gone through several major releases since then. With current state of Nuget, it’s exceedingly easy to create projects that manage their nuget package creation automatically.

Steps to reach harmony

  1. Right click the solution root in the solution explorer < Enable Nuget Package restore (this should create you a .nuget folder that has nuget.exe in it)
  2. Right click the project you wish to turn into a package, properties and goto the build events tab
  3. In the post build event command line enter:

    “$(SolutionDir).nuget\Nuget.exe” pack “$(ProjectPath)” -Verbose -Properties Configuration=$(ConfigurationName)

Save the project changes, then build your project and you’ll see your packages dropping out in the relevant Bin\Debug or Bin\Release folders!

BloggingContext.ApplicationInstance.CompleteRequest();

DateTime.ParseExact “R” the liar liar pants on fire API aka how do I make Response.Cache.SetLastModified work right

I generally have orders of praise for .NET (most specifically C#) and it’s immensely robust CLR.

Today I had to resolve bugs that have exist in the .NET API since atleast 1.1 if not earlier, this is just stupid.

When you’re working with Http Caching and the method

Response.Cache.SetLastModified()

This will emit a date over the wire effectively doing:

DateTimeUtil.ConvertToUniversalTime(date).ToString(“R”)

This returns us a date string similar to “Sat, 01 Nov 2008 19:35:00 GMT”.

Now the major major GOTCHA:

#FAIL DateTime.ParseExact(“Sat, 01 Nov 2008 19:35:00 GMT”, “R”, CultureInfo.InvariantCulture)#FAIL

will not actually parse this exactly. It will give you some other invalid time because of bugs in handling timezones.

The proper way to parse this is:

DateTime.Parse(“Sat, 01 Nov 2008 19:35:00 GMT”, null, DateTimeStyles.AdjustToUniversal);

Very deceptive, very deceitful of an API. Details explained at length on MSDN

BloggingContext.ApplicationInstance.CompleteRequest();