Wednesday, April 21, 2010

Detailed performance summary in MSBuild

Use the /ds switch to get a summary of build nodes and the projects they built, with timings.

Sunday, April 18, 2010

Different types of SafeHandle

I ran into the following error:
"Cannot marshal 'return value': Returned SafeHandles cannot be abstract."

The Microsoft.Win32.SafeHandles namespace has several different handle types.

Thursday, April 8, 2010

Change to folder that PowerShell script is located

To change to the folder or directory that the executing PowerShell script is located:

pushd (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)

Alternatively:

$scriptFolder = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent

Note that $PSScriptRoot is preferable for PowerShell 3.0.

Saturday, March 20, 2010

Monday, March 8, 2010

Reserving HTTP namespace for use by self-hosted WCF application

I ran into the following error while creating a WCF application that is not hosted in IIS:

HTTP could not register URL http://+:8080/Logging/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).

The solution on Vista is to reserve the namespace for the user that wants to bind to this URI, which must be done as an administrator:

netsh http add urlacl url={url} user={user\domain}

See MSDN for more detail, and don't forget that you will need to configure your firewall if you want this address to be externally visible.

Saturday, March 6, 2010

Programming job trends

This job search site provides some interesting trend information:

Programming Languages

cobol, java, perl, C++, C#, visual basic,delphi Job Trends graph



cobol, java, perl, C++, C#, visual basic,delphi Job Trends graph


Platforms

linux,windows Job Trends graph



linux,windows Job Trends graph


Platforms with C++ and C#

linux AND C++, windows AND c++,linux AND C#,windows AND C# Job Trends graph



linux AND C++, windows AND c++,linux AND C#,windows AND C# Job Trends graph


Databases

SQL Server,Informix,DB2,Oracle,Sybase,MySQL,Postgres Job Trends graph



SQL Server,Informix,DB2,Oracle,Sybase,MySQL,Postgres Job Trends graph

Tuesday, February 23, 2010

Smallest C++ windowed application

Interesting to see this is the smallest windowed Windows application:

#include <windows.h> 

LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShow)
{
    MSG msg;

    WNDCLASSEX wc = {sizeof(WNDCLASSEX), CS_VREDRAW|CS_HREDRAW|CS_OWNDC, 
    WndProc, 0, 0, hInstance, NULL, NULL, (HBRUSH)(COLOR_WINDOW+1), 
    NULL, L"DX9_TUTORIAL1_CLASS", NULL}; 

    RegisterClassEx(&wc);

    HWND hMainWnd = CreateWindow(L"DX9_TUTORIAL1_CLASS", 
    L"DirectX 9 Bare Bones Tutorial 1", 
    WS_OVERLAPPEDWINDOW, 100, 100, 300, 300, 
    NULL, NULL, hInstance, NULL);
    ShowWindow(hMainWnd, nShow);
    UpdateWindow(hMainWnd);

    while(GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    return(0);
} 

LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_DESTROY:
        PostQuitMessage(0);
        return(0);
    }

    return(DefWindowProc(hwnd, msg, wParam, lParam));
}