I’m now an MCPD: Enterprise Applications Developer

Over the past few months, I’ve been studying towards Microsoft .NET qualification. This morning I sat (and passed) the last of the five exams.

Now I’m a fully-qualified Microsoft Certified Professional Developer (MCPD): Enterprise Application Developer! I will also talk about the software used in mobile casino applications and what makes them so attractive. Use the exclusive bonus offer of 50€ free cash and discover the best French casino apps.

When your Woosh modem dies, take the battery out

Last night, my Woosh Wireless broadband modem (an IPWireless P1D) went completely dead. My connection dropped, all the status lights went out, and there was no response at all when I hit the power button. I tried unplugging and replugging everything, but nothing happened. Thankfully I had internet data on my phone, so I was able to play my favorite games. Next time you are stuck in traffic or have some time to kill, I recommend you go and check out an online casino. The site that I prefer playing on is Mr. Green because of their no deposit bonuses that allow me to play roulette for free. The best part is that even though I don’t have to pay, I get to withdraw and use anything I manage to win.

As you may know, this modem has a battery and a SIM card slot very similar to a mobile phone. After I took the apparently dead battery out, everything worked fine.

Update: A rep from Woosh saw this article and sent me out a new battery. I didn’t even have to call!

software development methodologies

Popular Software Development Methodologies to Put in Practice

Living in the era of technology , we have the blessing to reach out to almost everything by only one click. In just a few seconds, we can learn about the latest high-tech innovations in online casinos in Ghana, for example. How? By clicking on this link. Thanks to the  software development process, the technology has reached a point where you can create platforms that can do whatever you imagine. Everything from a simple news site to a huge casino enterprise. Online casinos made by our methodology just distinguishes it from most sites. Friki Games is one of those sites. They offer quality arcade games and their layout and infrastructure is made with our help. We encourage you to check out our work and maybe some of theirs if gaming is your thing. In case you need another strong recommendation for an outstanding selection of arcade games, visit the Gameonstpete website to play the latest titles. They are listed among the best free online game sites in the world today.

We came across some of the most popular software development methodologies, so today we are  going to share with you their advantages and disadvantages.

Agile Software Development Methodology.

This type of software development methodology is an approach that is very adaptive and is very flexible to changes. It enables direct communication and improves the quality of the whole software development process by triggering the defects in the early stages and fixing them very quickly. For all lovers of retro gaming who want to discover which arcades are powered by the best software providers, go on http://gratogames.com/titan-souls.html and enjoy playing arcade-style battles with creatures that evoke deadly magical forces in a fantasy world.

However, the main disadvantage of this software development methodology is that it is not very efficient regarding documentation.

Dynamic System Development Methodology

According to all the books on software development methodologies, this model tries to involve the user as much as often in the whole process, and its main purpose is to get the process done right on time, utilizing all the required resources.

Compared to the other software development methodologies, the dynamic model is not recommended for small companies and it is also very expensive.

Spiral Software Development Methodology

The advantages of this model are pretty darn good. It can reduce all the risk factors at the early stages of the process, and is suitable for more complex projects with high risks and companies that have different requirements.

Nevertheless, this is a very costly software development methodology, and any downfall on the risk factors can make the project disappear.

If you have any thoughts on this topic, you can contact me, and we can discuss our approaches.

Powershell to recursively strip C# regions from files

Here’s a super quick little powershell snippet to strip regions out of all C# files in a directory tree. Useful for legacy code where people hide long blocks in regions rather than encapsulate it into smaller methods/objects.

dir -recurse -filter *.cs $src foreach ($_) {
    $file = $_.fullname
    echo $file
    (get-content $file) | where {$_ -notmatch "^.*\#(end)?region.*$" } | out-file $file
}

Run this in your solution folder and support the movement against C# regions!

Optimise For Simplicity, Not Brevity

Which is better: code that is simple, or code that is short?

Many would answer that they frequently occur together. The length of a program is often a good indicator of how simple to understand the code will be.

But don’t make the mistake of confusing brevity with simplicity. Making a program shorter does not always make it simpler – sometimes quite the opposite.

A classic example of this phenomenon is AutoMapper, a popular .NET library. Fundamentally, AutoMapper solves the problem of too many assignment statements in your code:

userDto.Id = user.Id;userDto.FirstName = user.FirstName;userDto.LastName = user.LastName;// ... etc

What’s wrong with this code? Absolutely nothing. Lists of assignment statements are extremely easy to understand, extremely flexible, and extremely fast to run.

So why would you choose a reflection-based property loop over compile-time performance? A third-party library over built-in language support? Custom IValueResolvers and ITypeConverters over plain language statements? To save tens or maybe hundreds of lines of code? Really?

Remember, the simplest code possible does not mean the shortest code possible. DRY does not mean that all lines of code must be unique. A simple statement inlined twice is better than burying it in a ‘helper’ function.

Optimise for simplicity, not brevity.

Ten Seconds

Ten seconds between receiving a message from a pricing engine, and delivering that price to the client. Admittedly it’s an exotic structured product (not HFT).

Layered, stateless services + ORM-backed repository pattern + ambient database connections.

If you cannot precisely predict the number of database round-trips that will occur from a single API call, then you have no coherent data access strategy.

Stock Exchange Limit Order Book in Go

I’ve been learning Go this week, and on Tuesday I attended the London Go Gathering at Google’s London Campus.

As a learning exercise, I decided to port the winning QuantCup competition entry — implementing a fast stock exchange matching engine for a high-frequency trading bot — from C to Go.

You can check out my code here: https://github.com/rdingwall/go-quantcup

I focussed primarily on Go language features and idiomatic style. However, I stayed as true as possible to the memory access and CPU paths in the original implementation, so there are no heap allocations (besides unit tests) and it’s still single-threaded (so cannot take advantage of goroutines or channels).

Book Review: .NET 4.5 Parallel Extensions Cookbook

.NET 4.5 Parallel Extensions Cookbook

Here’s my quick review of a new book, .NET 4.5 Parallel Extensions Cookbook by Bryan Freeman.

  • .NET 4.5 Parallel Extensions Cookbook (Paperback)
  • .NET 4.5 Parallel Extensions Cookbook (Kindle)

The book launches straight in to fairly long code examples, so it would be best if you’ve already got some basic experience using Tasks.

The book’s chapters are divided into sections providing many examples of the following topics:

  • The Task Parallel Library (TPL)
  • Parallel LINQ (PLINQ)
  • The new BCL concurrent collections and producer/consumers
  • Thread synronchronization primatives
  • The new Visual Studio parallel profiling and debugging windows
  • Async and await keywords
  • The new .NET Dataflows library

Reasons why you should read this book

If you already have basic familiarity with Tasks, but you aren’t sure the difference between:

  • Task.Start() and Task.Factory.StartNew()
  • Different TaskCreationOptions
  • Different ParallelMergeOptions for parallel LINQ queries

Or, if you’re not sure about:

  • The correct semantics around throwing OperationCancelledException
  • How to link multiple CancellationTokens together
  • How to schedule a continuation to execute when a task faults or is cancelled
  • How to break out of Parallel.For()
  • In the BCL concurrent collections, what completeness or a consuming iterator means
  • What is a Barrier and how to use it
  • What BufferBlock, TransformBlock, WriteOnceBlock, BroadcastBlock and JoinBlocks are for, and how they interact with Tasks

Then, like me, you will find this book useful.

Other bits I liked

The chapters on synchronization primatives provide not only an overview of new TPL concepts like Barriers, but also a good coverage of traditional .NET concepts (like Monitor and ManualResetEventSlim) and how they can be used inside Tasks.

The book highlights the very-useful new Visual Studio 2012 concurrency visualizer debugging windows, which can quickly identify performance issues in your program such as deadlocks or excessive context-switching (where one CPU core slows down because it is frequently reloading the cache and stack so it can switch to a different thread). These new features should be essential knowledge for any .NET developer working on multi-threaded code.

I also enjoyed the chapters on the new TPL Dataflow library, which provides a framework for building composable Task-based input/output processing steps, which can be linked together to form a larger sequential pipeline. Unfortunately, the book doesn’t provide many examples of situations when you might want to use Dataflows, but off the top of my head I can think of a couple of places in past projects where they would have been useful:

  • In an e-commerce system: post-order processing e.g. after a user makes a purchase, submitting the order to fulfilment, accounting, invoicing, analytics and other downstream systems.
  • In a trading/finance market risk analysis system: enriching trade positions through a series of steps that calculate their various different types of risk exposures (including calculations which can be quite CPU intensive) plus fetching other related information (OLAP dimensions) about the trade from other systems (which can involve IO-bound remote service/database calls).

Bits I didn’t like

It would have been nice if the author had further explored how Tasks can be used together with other popular .NET libraries, for example:

  • How Tasks compare to Reactive Extensions (Rx)?
  • How to create an IObservable event stream based on Task completions
  • How you can integrate Tasks into ASP.NET MVC and WebAPI to make scalable asynchronous controllers

The author also uses C_STYLE_CONSTANTS in his code examples — a minor (but annoying) stylistic mistake.

Also be aware the Kindle edition’s fonts are quite a lot smaller than typical books you might purchase from the Amazon store. I had to turn my Kindle display up to size 6 font in order to get an equivalent reading experience from my normal size 2 settings.

Otherwise, I didn’t notice any other serious problems, and would recommend the book as a good entry-level introduction for developers interested in learning more about the TPL.

Book links: Amazon (Paperback), Amazon (Kindle), Amazon (UK), Publisher’s Page

Disclaimer: this review was based on a free promotional copy sent to me by Tania at Packt Publishing.

Howto: Set up an SSL Offload / Termination Proxy with IIS 7

An SSL termination proxy is a service that sits in front of your web server and converts HTTPS requests to plain HTTP, by offloading the SSL decryption to a separate machine or process. They are commonly used for internet-facing websites, but usually with separate servers. Here’s a quick guide how you can set up your own local SSL termination proxy using IIS to simulate — for development purposes — a production webserver environment.

ssl_termination_proxy

Pre-requisites: Install Rewrite + ARR IIS Features

First, we need to install and enable a couple of IIS features that will make this all work:

  1. Download and install the URL Rewrite and Application Request Routing (ARR) IIS 7 features.
  2. Open the IIS Management Console (inetmgr) > expand your machine > Application Request Routing Cache > right click, Server Proxy Settings… > check Enable Proxy.

Part One: Reverse Proxy Incoming HTTP Requests

Assume we have the following two IIS websites set up:

  1. The real site, containing your app or content, bound on HTTP port :80
  2. The SSL termination proxy, simply a website pointing to an empty directory, bound on HTTPS port :443

First we need to ensure requests arriving at the HTTPS:443 site are proxied through to the HTTP:80 site. We can do this by creating a web.config in the root of the HTTPS:443 IIS site with a single rewrite rule that catches all requests and rewrites them to the HTTP:80 URL:

<configuration>  <system.webServer>    <rewrite>      <rules>        <rule name="Reverse Proxy" patternSyntax="ECMAScript" stopProcessing="true">          <match url="(.*)" />          <!-- Redirect all requests to non-HTTPS site. -->          <action type="Rewrite" url="http://localhost:80/{R:1}" logRewrittenUrl="true" />        </rule>      </rules>    </rewrite>    <handlers>      <clear />      <!-- No other handlers required. Must clear them otherwise ASP.NET might try to intercept *.svc paths etc. -->      <add name="Rewrite" path="*" verb="*" modules="RewriteModule" resourceType="Unspecified" />    </handlers>  </system.webServer></configuration>

Part Two: Block non-HTTP Connections to Deal Service

On the real production hardware, only HTTPS connections will be allowed. We can simulate this on our local IIS by setting up a rewrite rule that will block any request that does not have the X-ARR-SSL HTTP header which indicates it has been routed through ARR.

This rewrite rule should be added to the HTTP:80 site’s web.config:

<system.webServer>  <rewrite>    <rules>      <rule name="Block Non-SSL Requests" patternSyntax="Wildcard" stopProcessing="true">        <match url="*" />        <conditions>          <add input="{HTTP_X_ARR_SSL}" pattern="*|*" negate="true" />        </conditions>        <action type="CustomResponse"                statusCode="403"                statusReason="Forbidden: This site requires SSL."                statusDescription="This site is currently configured to only accept connections                                   through a local SSL termination proxy (IIS Application Request                                   Routing + Rewrite modules). Any HTTP requests that do not                                   include a valid X-ARR-SSL header are blocked." />      </rule>    </rules>  </rewrite></system.webServer>

The rewrite rule also contains a nice descriptive error message to explain what’s going on if you start getting random 403 errors.

(Note that, as you’ve probably already figured out, anyone can fool this blocking rule by simply populating the X-ARR-SSL header themselves. This is an insecure blocking method that should never be used on production hardware!)

Part Three (Optional): WCF Configuration

If you’re exposing WCF services through the SSL termination proxy, you may need to add the following attribute to your operation contracts:

[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]public class MyService : IMyService{    ...}

Without this attribute WCF will refuse to process requests with a different original URL than what it expects from the binding configuration.

Acknowledgements: This guide was originally based on Ruslan Yakushev’s guide to Reverse Proxy with URL Rewrite v2 and Application Request Routing.

Microsoft.Web.Administration Confusion

Just a quick tip — if you’re having problems with programmatically modifying your IIS sites configuration using the Microsoft.Web.Administration .NET API, and are currently banging your head against the desk because:

  • ServerManager.Sites returns a completely different set of sites than what is visible in IIS Manager, or
  • No matter how many times you call it, ServerManager.CommitChanges() does not seem to have any visible effect

… then make sure you’re referencing the correct Microsoft.Web.Administration.dll assembly.

Assembly Version Location
Microsoft.Web.Administration.dll v7.0.0.0 C:WindowsSystem32inetsrv
Microsoft.Web.Administration.dll v7.9.0.0 GAC

What’s the difference? Except for the version number, the two asssemblies look identical, except one (7.9.0.0) only affects IIS Express. You must use v7.0.0.0 if you want to modify IIS. Watch out!