Development

roger's picture

<define> task for NAnt

Essentially, you write a new task like this:

<define name="echo3">
  <echo message="${this.message}"/>
  <echo message="${this.message}"/>
  <echo message="${this.message}"/>
</define>

...and then you call it like this:

<echo3 message="Hello World"/>

Any parameter passed to the defined task is available as this.foo inside the defined task. I've found it useful when you don't want to write a task in C#, perhaps because all you're doing is calling a bunch of other NAnt tasks.

roger's picture

Tweaking TeamCity

I just started using TeamCity Professional Edition for some personal projects (and we're evaluating the Enterprise edition for use at work).

roger's picture

Roger's ReSharper Live Templates

ReSharper allows you to define "Live Templates". They're like Visual Studio snippets, but much more useful. So that I don't lose mine, I'm going to stash them here.

roger's picture

Source Code License

Unless specified otherwise, all source code published on the differentpla.net website is available under the following license terms: Do what you want with it, but don't claim you wrote it, and it's not my fault if it doesn't work.

roger's picture

FindFirstFile and SE_BACKUP_NAME

If you want to read a file and bypass security (e.g., if you're writing a backup program), it's not enough to simply enable the SE_BACKUP_NAME privilege, you have to also pass FILE_FLAG_BACKUP_SEMANTICS to CreateFile.

Fortunately, you don't have to do this for FindFirstFile. Enabling the privilege is enough.

roger's picture

ShellExecute doesn't work for URLs when called from a multithreaded apartment

I've got a dialog box with a SysLink (WC_SYSLINK) control on it. When the user clicks on the link, it should open our website in the user's default browser. In my test app, it works. In the production app, it doesn't.

roger's picture

A list of HRESULT codes

...because every time I search for a given HRESULT, all I get is yet another frigging VB website regurgitating the contents of WinError.h

roger's picture

Bad UI: Why SQL Query Analyzer sucks

I'm doing a bunch of SQL hacking at the moment, and I've decided to use SQL Query Analyzer as a good template for how not to write a text editor.

Note that this only applies to SQL Query Analyzer in SQL 2000. SQL Management Studio in SQL 2005 has its own set of suckage. I'm sure I'll rant about that when I've used it more.

roger's picture

Windows ListView Control Returns -1 From LVM_INSERTITEM

I just spent the best part of a morning chasing this one down, so I thought I'd share it with you:

If you try calling CListCtrl::InsertItem (or LVM_INSERTITEM), using LPSTR_TEXTCALLBACK, you can't use either of the LVS_SORTASCENDING or LVS_SORTDESCENDING styles for the list view.

roger's picture

Test First: Roman Numeral Conversion

Question: Everyone "knows" that you should write a decimal to Roman number converter using a table. What happens if you try it test-first?

Syndicate content