Programming

Get NMock2 to Return Out Params

Posted on

There are plenty of mocking frameworks out there, with Rhino Mocks and Moq leading the way. Personal preferences aside, I am currently working on a project that is using NMock2 for mocking and found that the following feature isn’t very well known. In the process of adding unit tests to some legacy code, before I […]

Programming

AJAX Ready State Codes

Posted on

If you are hand-cranking an AJAX request, you’ll be looking for a Ready State of 4 and a Status of 200. But what other Ready State Codes are there and what do they mean? request.onreadystatechange = function () { alert(“readyState: ” + request.readyState); }; 0. Uninitialized 1. Set up, but not sent 2. Sent 3. […]

Browsers

Firefox About URI Schema

Posted on

The “about:” URI schema has been around since the days of Netscape, but there is more to it than the common “about:blank” reference for an empty page. Some of these options give you an advanced view over Firefox and its cache – and others a just a bit of entertainment. Here is a list of […]

Programming

Auto Load Your PHP Classes

Posted on

In PHP you can create classes to organise your code and represent objects that you want to pass around. This has long been a feature of other languages and was a fundamentally important step forward for PHP. There was one thing, though, that I didn’t like about PHP classes. If I wanted to instantiate a […]

Windows

Search Titles Only with Windows Search

Posted on

Revised, July 2014. Just a note to say this still works on later versions of windows, so although this article talks about the old Windows Search – give these tricks a go! If you’ve got your hands on Windows Search (formally known as “Windows Desktop Search”), you’ll probably agree that it is much better and […]

Programming

JavaScript and Noisy HTML

Posted on

I was answering a question on a popular coding forum and it once again highlighted the age old problem of terribly bad JavaScript. This was the HTML code in question: <a id=”image1″ href=”#”><img src=”image.png”></a> And there was a bit of JavaScript adding an onclick event to the anchor tag. An innocent looking example. An anchor […]

Programming

JavaScript Namespacing

Posted on

This is just a quick article to demonstrate a quick bit of JavaScript namespacing. Why would you do this? Well, this allows you to put functions and variables inside of an identifier. It acts like a “box of stuff” and prevents variable and function name conflicts. It also supplies a neat way to organise and […]