Archive for August, 2008

Destination Alpha in Alpha Blending

Everyone knows that c0 = cd*(1-a)+cs*a for color channels, but how do you compute the final alpha channel ? Using the same equation means a0=ad*(1-a)+a*a that may not be what you would expect, for example if you have full opaque destination you may end up with a translucent image a0 < 1.

By reverse engineering of Paint.NET (and Photoshop) I came with a0 = ad*(1-a)+1*a, that is an additive blending for alpha. While I have found no real explanation why to use this formula, I had to. Oh and BTW, ActionScript’s BitmapData.copyPixels blends like crap, you’d better code your own alpha blending.

Update: Well, the correct alpha blending equations are: a0 = a+ad*(1-a) and c0 = (cd*ad*(1-a)+cs*a) / a0, from Wikipedia.

Unwrap Mosaics by Microsoft

Nice idea, striking similar to how textures for 3d models are stored.

The paper is here.

via feeder

Sql Server Management Studio 2008 Intellisense

It seems to work nice but … only on Sql Server 2008 connections! This really sucks :(
.

Trojan Written in Java !?

It’s not a joke, I got my hands on one :) . And, yes, it has a simple Win32 stub exe that checks for JVM and installs it if not found.

Power Outage Corrupts SQL Server Database

I could have bet on anything that SQL Server has atomic disk writes so no crash can possibly corrupt anything, well, after a power outage I had a database marked as (Suspect) by the recovery. The only way to actually get it back running was DBCC with REPAIR_ALLOW_DATA_LOSS that indeed has lost an entire table full of data along with some other fields around.

EntityFramework and Oracle

Using this provider http://code.msdn.microsoft.com/EFOracleProvider it’s easy to change you model to use Oracle instead of SQL Server – only change the column types (for example from nvarchar to nvarchar2 :) etc). Unfortunately the provider then throws a bizarre error, you can see it in the comments.

Phrase of the week

to run circles around

I really did not know about it :) First heard in Romanian then in English.

An easy way to invoke javascript events in WebBrowser

e.GetType().InvokeMember(“onmouseover”, System.Reflection.BindingFlags.InvokeMethod, null, e, null);

where e is IHTMLElement.

Yahoo Design patterns

The Yahoo Developer Network has some interesting articles on common patterns you may encounter in developing web applications.

Ted Dziuba’s column at The Register

Definitely a must-read.