Spring Dependency Injection

Spring provides dependency injection capabilities using Setter injection, or Constructor injection. Object models can then be declaratively represented in XML. Here’s a Setter injection based example using the property element: <bean name="shaker" class="net.bencode.model.Shaker"> <property name="proteinPowder" ref="proteinPowder" /> </bean> <bean name="proteinPowder" class="net.bencode.model.ProteinPowder"> <property name="grams" ref="120" /> </bean> Or if XML isn’t your thing, annotations are also an option, using a combination of @Component and @Autowired. @Component public class Shaker { @Autowired private ProteinPowder proteinPowder; ... } @Component public class ProteinPowder { private int grams; ... } Constructor injection is similarly defined using the constructor-arg element. The following example works if the Shaker class has a constructor that takes in a ProteinPowder instance: ...

April 25, 2013 · 1 min

Native Desktop Window Skeleton with ATL

Building native Windows application with C++ can be done using a variety of techniques, from handrolled win32 to MFC. Some uglier than others. Using some ATL macros, here is the most minimalist implementation I could find, that will get you a native Windows desktop shell up and running. Here’s a skeleton native Windows desktop application that uses ATL (Abstract Template Library) as a thin wrapper on top of the underlying Windows scaffolding (e.g. the winproc, the message pump and so on). Compared to hand rolling this plumbing yourself, ATL (although its largly macro based) keeps the code lean and mean. I plan to use this as a shell DirectX render target for testing. For buildable VS2012 solution see github. ...

December 31, 2012 · 1 min

C++11 with Clang on Windows and MinGW

Installation steps for getting a functional Clang++ build running on Windows 8 and MinGW. Step 1 Install MinGW. Using mingw-get-inst-20120426.exe go with the pre-packaged repository catalogues, which bundles in GCC 4.6.1 as opposed to 4.7.x, which at the time of writing Clang does not support seemlessly. You will need the C Compiler, C++ Compiler, MSYS Basic System and MinGW Developer Toolkit MinGW packages. Step 2 Python 2.x. Install the Python Interpreter and Libraries into c:\MinGW\bin. ...

October 20, 2012 · 3 min

StreamInsight in Azure

Well, the dust is starting to settle after an amazing geek-out week at the gold coast with the Mexia team. Pre-TechEd Australia 2012, we kicked off with the Mexia’s “Code Camp 2.0”, an opportunity for the team to come together and deep dive (hack code, whiteboard, design and discuss, present) on emerging Microsoft technologies. It was epic to say the least. One technology that particularly excites me is StreamInsight. Perhaps because my brain has become so conditioned to the existing data storage techniques (relational, normalisation, warehousing, ETL, etc…) that we regularly apply in the industry, when I first learned of StreamInsight or Complex Event Processing (CEP), it seemed such a natural and elegant fit for so many common data problems we aim to solve today. ...

September 18, 2012 · 7 min

NeoMutt setup (2022 edition)

Intro Getting started with mutt 2022 setup cron GPG crypto Address book integration pam-gnupg Intro If you haven’t heard of mutt you’re missing out. Mutt is a small but very powerful text-based mail client for UNIX operating systems It’s a command line based mail reader (MUA). The neomutt project is a contemporary fork of the original mutt with added features, patch sets and fixes. I started seriously using mutt as my full-time mail client in 2012. I found its simplicity refreshing. It quickly became apparent how much useless baggage modern graphical mail clients (e.g., thunderbird, outlook, etc) actually bog you down with, not to mention the harrowing way they actually encode mail. Its taken me a long time to appreciate this: ...

August 18, 2012 · 6 min

How to pass 70-513 Windows Communication Foundation 4 Development

My experience preparing for and gaining the TS Windows Communication Foundation Development 4 certification. The (~7 year old) WCF stack to my suprise, is much larger than I ever gave it credit for. 70-513 successfully pointed me toward a number of “off the beaten track” topics, so much so, that I actually quite enjoyed preparing for this exam. Lots of emphasis in the exam on topics such as routing, diagnostics, transactions, sessions and discovery. ...

April 29, 2012 · 6 min

F# Cheatsheet

The VS11 beta includes a really slick cheatsheet style F# language reference. A gem for groking F# syntax. The samples are grouped into modules. A module is just a collection of value, function and type definitions. To execute the code in F# Interactive, highlight a line of code and then either type Alt-Enter, or right-click and choose “Send to Interactive”. To start F# Interactive, see the “View” menu. For more about F#, see: http://fsharp.net ...

April 23, 2012 · 32 min

T4 Template Custom Host and BizTalk Pipeline

Frameworks like ASP.NET are well equipped with templating engines, and more so now with the extensibility that ASP.NET MVC offers (can run with the awesome Razor view engine, or swap in a view engine of your liking such as the excellent Spark view engine). Simply put, a views template is responsible for transforming a model into a representation. A T4 text template is a mixture of text blocks and control logic that can generate a text file. The control logic is written as fragments of program code in Visual C# or Visual Basic. The generated file can be text of any kind, such as a Web page, or a resource file, or program source code in any language. ...

April 16, 2012 · 6 min

WCF Error Handling using IErrorHandler and log4net

When its comes to managing and supporting WCF services, like any software, having insight into erroronous situtions is essential. There are several ways to go about this that are specific to WCF, such as enabling a trace listener for example. A more customisable option involves fleshing out an IErrorHandler. As put by MSDN, provides the necessary hooks to run custom error processing logic. Allows an implementer to control the fault message returned to the caller and optionally perform custom error processing such as logging. ...

April 11, 2012 · 3 min

Autofac Your WCF

Autofac (a .NET IoC container) makes .NET code better. Simple. Controlling the way software interacts with it’s components (dependencies) is one powerful way to the increase its “bendability”. Bendability meaning how well a chunk of software is able to cope with change (this is inevitable). WCF’s unique object model (bindings, endpoints, behaviors, contracts, etc) can make doing IoC more of a challenge, however Autofac’s native WCF integration comes to the rescue. ...

March 22, 2012 · 3 min