Stupid programming

Nice site with samples of real bad programming. Funny though.

VB Form localization?

Couldn’t find any support in VB for this (the problem is that the position / size of form controls should be localized also, i.e. it depends on the language, because some text could not fit and so on). Now I didn’t had time to build a framework for that, so ended with changing the size of the some controls in the code, depending on the current language. Easiest solution – and also pretty elegant.

GDI leaking

Recently I did my first GDI leak (well it was very strange actually, the DC returned from GetDC() shouldn’t be released). The behaviour was weird (Yahoo Messenger refresh problems) – after 3-4 days I thought about leaks in our code.

Horrible bug

Ok so in my last 1.5 days I have investigated a strange crash in the Adobe PDF printer driver, however couldn’t find a logical explanation for it. I really tried everything to ensure that the driver had large enough buffers to modify and so on. In the end, I try/catched it – dissapointing solution.

Funny Microsoft KB entries

These two entries are the funniest from their entire database :)

OpenGL shaders

I did some normal mapping in OpenGL for some University project, ATI only unfortunately (had to bring the videocard for demoing). DirectX 8.1 equivalent OpenGL shaders have very poor support (i.e. code on the net), and you *have* to build two shader versions, as ATI and nVidia have different extensions (not sure how much different though). We may use shaders for optimizing rendering in our next project also, so this quick test was very welcomed.

Google’s new frontpage

Of course it’s nice, as Dragos described it last night. Shouldn’t be extremely complicated to do (I assume will have a bet with Chirila on this).

2D Image quality

I had to improve the scaling quality in our current product (actually in the 2d presentation module), so I tested some filtering techniques. After building some releases with exotic algorithms (Blackman, Hamming), the feedback received and our observations led us to the conclusion that the simple bilinear filtering has the best visual effect.

It will support OpenGL rendering, using maximum (16X) anisotropic filtering for best quality available (with mipmaps of course) (should switch to software rendering for machines with on-board video and strong CPU).

The image edges will be anti-aliased using alpha channel and bilinear filtering (alpha either 0 or 255, precomputed or set up in a pixel shader).

Hardcore OLE stuff

Our experimental implementation of OLE in .NET (not entirely in C#, a MFC proxy is somewhere around) is so full of hacks that we must definitely re-write it from scratch. A primary issue is the bi-directional inter-process communication, we have user .NET Remoting but it’s a bit of overhead, COM is not so usable so we may resort to using Win32 concepts like File Mapping and such.

The basic idea is of an MFC OLE Server (as generated by the Visual C++ wizard) that simply instantiates the real application (written in .NET) and dispatches drawing requests and document openings, while handling the OLE commands like Copy as link.

Microsoft Research has a beta compiler (it integrates with Visual Studio .NET) for the C Omega language. It’s a derivative of C# that supports SQL, XML and XPath directly into the language. So you can write:

foreach (b in bs.book)
{
  yield return 
                {b.title}
                {b.author}
               ;
}

and also:

    struct{SqlString CustomerID; SqlString ContactName;}* res
      = select CustomerID, ContactName
            from DB.Customers
            where City == mycity
            order by ContactName;

I think we’ll be using this language in our next project.

(via Adrian).