Code Repository

A knowledge dump of code and programming thoughts

  • Unit testing internal methods with the InternalsVisibleTo attribute

    One very frustrating aspect of unit testing is the inability to test private methods. Often you may start with a small public method, and as you build your application up, decide that some methods ought to be private, or you may refactor pieces of functionality into private methods. One argument is that unit testing only needs to test the public methods of a class because these are exposed and thus are the "api" for the class. But I still think there is always value in creating private …

    Read More...
  • Setup ConEmu with Powershell and VS2012 Developer Command Prompt tabs

    ConEmu is a Console Emulator for Windows, and greatly enhances the experience using any command line interface. See Scott Hanselman's blog post for a much more detailed review. You can download ConEmu from Source Forge or Google Code. Once downloaded, set it up to open Powershell and the VS2012 Developer Command Prompt. Open the settings, and add two new tasks: Powershell Name: Powershell Params: /dir "c:\users\eyeung\documents\repos" Command: powershell VS2012 Developer …

    Read More...
  • A Brief Introduction to SOA

    Service Oriented Architecture is a software design methodology which involves developing software using modular components known as services which collectively make up a larger complex software application. One of biggest misunderstandings is that SOA is about technology. It is not. SOA is a design paradigm which emphasises a set of principles. The biggest advantage to SOA is the ability to reuse code through loose coupling and ensuring each service is discrete and self-contained. The aim of …

    Read More...
  • How useful are Design Patterns today?

    Design Patterns are solutions to common problems. They were first formalized for software development by the Gang of Four (GoF). The publication listed 23 design patterns which have formed the foundation of all other design patterns. For a good overview of each of the patterns, visit the Dofactory Patterns site. There are some good .Net examples there. Ayende Rahien did a very good blog series reviewing most of the patterns. My own conclusion is that, it is very good to know and …

    Read More...
  • Using RavenDB with Ninject

    I love both RavenDB and Ninject because they are both very easy to use (available on NuGet). RavenDB is an excellent NoSQL / Document database, and Ninject is a lightweight dependency injection framework. Getting them both to work together is relatively straightforward: Step 1 Add RavenDB and Ninject to your project via NuGet Step 2 Create a class containing a Ninject Module for initializing and binding RavenDB Step 3 Register the module with Ninject. If you have an MVC4 …

    Read More...
  • Setting up Orchard Website with Git on BitBucket

    Previously I had written a blog post on Setting up Git for Windows from scratch. But now I want set up a repository and host my website in BitBucket. Step 1. Login to BitBucket website If you haven't already, sign up for an account and start hosting your files. Free for repositories with 5 users or less. Create a new repository on BitBucket. Step 2. Then back in Powershell, we clone the new repository BitBucket to a local repository. mkdir Repos C:\Users\Edmund\Repos git clone …

    Read More...
  • Setting up Git for Windows from scratch

    Here is a start to finish, step by step guide on setting up Git on Windows from scratch. I recommend using Powershell as it is our Windows alternative to Bash. I've turned this post into an evolving page to include things I come across as I learn more about Git. 1. Download and Install Git Go to the Git Downloads page to get the latest version of Git to install. http://code.google.com/p/msysgit/downloads/list Choose the latest install file, go through the wizard and select the settings …

    Read More...
  • Reading Error Logs on Azure Websites

    Its not immediately obvious how to read the error logs when something has gone wrong on Windows Azure Websites. The first step is to enable logging. Go to Configure. Under Diagnostics, enable "Web Server Logging", "Detailed Error Messages", "Failed Request Tracing". Remember to "Save" the settings to apply the changes. Next we need to access the files which get logged. At this point you may need to reproduce the error, such that the error occurs and gets logged. However, I often find …

    Read More...
  • Changing Serial Key for Activating Windows 8

    When installing Windows 8 Enterprise, I found that the activation key was already entered and there was no way to change the key through the UI. The way around this was to change it through command prompt. Open Command Prompt (or Powershell). Press start and type "CMD" or "Powershell" Type "slmgr.vbs -ipk 00000-00000-00000-00000-00000" and replace the zeros with your Windows 8 Serial Key. This step changes the activation key. You will get a notification window popup to let you know it …

    Read More...
  • Installing Linksys AE2500 Drivers on Windows 8

    For some reason the wireless adaptor Linksys AE2500 drivers didn't get included in the Windows 8 installation, and can't be found automatically. Luckily downloading and installing the Windows 7 drivers still works. I had to manually download it from another computer and copy it over. Cisco really should release a Windows 8 version of this driver, but I doubt this will ever happen - Cisco isn't known for supporting old hardware. I thought Windows 8 was meant to magically support devices that …

    Read More...