Wednesday, August 20, 2008

MBS Basics

MBS Basics.

Wednesday, August 6, 2008

Redirect Standard Out, The old (C) style

We have a third party library that outputs some debug/trace information when executes, this is of course not very nice when you have a command line application that calls the library.

The solution we used is to have a wrapper around the library, which redirects stdout before the call and restores it after.

An initial attempt to do this with Windows APIs (GetStdHandle/SetStdHandle) was unsuccessful probably because C runtime keeps its own handles. So, we had to go down and dirty to the low level C APIs (and this works fine):


    //keep a handle and close stdout
    int handle = _dup(1);
    _close(1);

    // call the lib function here

    //restore stdout, close the copy
    _dup2(handle, 1);
    _close(handle);

Saturday, August 2, 2008

C++ Development with Eclipse

Eclipse has been the only Java IDE I can comfortably use. And while I'm writing C++ code on Windows, Visual Studio is naturally my first choice. But what should I do if I need to develop Linux C++ code (okay, I know vim and xemaces are out there...)?

Luckily, there is Eclipse CDT (C/C++ Development Tools). It seems basically build (with make) and code completion works nice and neatly. What I'd like to test next is to see whether the relatively "tricky" things, such as code completion with templates and smart pointers, might work with this...

Monday, July 21, 2008

Markit and DTCC form derivatives trade processing JV

Markit and DTCC form derivatives trade processing JV.

The partners say the new company will provide a single gateway for confirming OTC derivative transactions globally and the initiative will accelerate the adoption of electronic processing services across the rapidly growing $454 trillion OTC derivative market where around 50% of transactions are still confirmed on paper.

Friday, July 11, 2008

Randomness

Something as simple as generating random strings can actually be complex. What if you want the strings to be truely unique? What if you have constraints on what chars to use and the length of the output?

The article here has a few methods listed, along with their respective pros and cons.

Wednesday, July 2, 2008

PInvoke Interop Assistant

I have been using PInvoke.Net most of the time for P/Invoke translation of Windows APIs. Just found out that Microsoft has officially released a tool that does the same called PInvoke Interop Assistant.

The tool relys on a Windows API signature database file, so it won't work with any non-API third party DLLs. Given the way C/C++ compilers name mangling works, a generic signature translator is probably mission impossible anyway.

Since this doesn't really provide more functionality than P/Invoke, I guess I might just stick with PInvoke Visual Studio Add-in.

Friday, May 23, 2008

For Three Minutes, China stopped

On Monday, May 19th 14:28pm, exactly one week after Sichuan Earthquake, a quarter of world's population stopped to mourn for the wictims.

What can record this better than the number of searches processed by Google.cn search engine?

Monday, May 19, 2008

A Moment of Silence

Three days of national mourning for more than 30,000 victims of 5.12 Sichuan Earthquake.