Showing posts with label Not quite rocket science. Show all posts
Showing posts with label Not quite rocket science. Show all posts

Wednesday, 16 September 2015

The magic of Aspect Oriented Programming with PostSharp

In this video tutorial, I explain what Aspect Oriented Programming (AOP) is all about, the issues it solves and the benefits of using it.
I demonstrate it with PostSharp, the best framework for implementing aspects and integrating them with your solution.

Quoting PostSharp, it allows developers to eradicate boilerplate by offloading repeating work from humans to machines. PostSharp contains ready-made implementations of the most common patterns and gives you the tools to build automation for your own patterns..

In my demo, I show how to use those ready-made implementations, as well as get started with your own custom ones (best viewed in full screen, for the code screencast).

Sunday, 5 February 2012

Remote Debugging In the Comfort of Your Living Room

Be the domainless master of your own domain
Many times I need to test a project on different operating systems, preinstalled or not preinstalled with specific components (e.g. a 32 bit project built with Windows 7 x64, run on a Windows XP x64 or x86, without an installation of the .NET framework runtime environment) and see how it behaves.
And in many cases it would misbehave.

In such cases I'd like to inspect my errors in order to repair them. And in many cases this is no easy task. It's sometimes hard to trace the problems without a proper debugger.
It's possible, of course, to install  a complete development environment on my test machine, but that would be heavy, take disk space and memory, and in many cases would be quite an overkill.

Fortunately, Microsoft provides the platform and tools for remotely debugging your application.
Unfortunately, accessing a remote machine for debugging requires appropriate permissions, and the remote debugging tools are planned to work when both computers share a domain and can work with common domain users.

A common (and economic) trick for testing an application on multiple environments is by using a virtual machine. I can  run several virtual machines on my computer, each with a different setup and a different OS.
In order to achieve remote debugging, I'd theoretically need to set up a domain server, and start managing users among my virtual machines (or use a real network, such as the one in my workplace, in order to log in as a domain user, given sufficient privileges on the virtual machine).
However, there are tricks to work around this requirement. I'll demonstrate how to run remote debugging from my local machine (not attached to any domain) to a virtual machine (running on its own detached workgroup).
Click to see the wonder in action:
Snap! A crash inside the VM (Click for the screen capture)
Obviously an index was exceeding the bounds of some array. Absolutely valuable information, which will not always be available upon crash, especially if your project is big enough.
In any case, we need to know where this exception is thrown and why.

Article Level:
Not quite rocket science

Sunday, 27 November 2011

My WPF Localization Solution

The world awaits
I ran into a need to have my WPF application support multiple languages, to prepare it for its big day day when it finally becomes the hottest product in China or at least in Burkina-Faso.

There are plenty of localization solutions out there. I've been searching for the optimal way to make my application multilingual, and being the lazy developer I am, by "optimal" I usually mean optimal for me (i.e. the developer):
  • I want all the texts to change to the current selected culture automatically.
  • I want to retrieve additional resources, such as images, for a specific culture. 
  • I want to be able to add new multilingual resources to my application without effort.
  • I want all multilingual support and resources to be reusable in a separate assembly.
Article Level:
Not quite rocket science

Saturday, 5 November 2011

Using ADO.NET Entity Framework 4.1 with SQL Server Compact 4.0

WTF and Why?!!
ADO.NET Entity Framework, an object-relational mapper (ORM) built into the .NET framework, provides an easy way to map your classes into a database tables and vice versa.
I've been working with with Entity Framework CTP 4, and have now upgraded my project to use the final released version 4.1. I'll provide here a small proof-of concept which I've built in order to chart the important bits and pieces.
Article Level:
Not quite rocket science