andrei

This user hasn't shared any biographical information


Posts by andrei

Linq Join Two Lists side-by-side

Easy: Enumerable.Range( 0, list1.Count).Select( i => list1[i] + ” – ” + list2[i])

Semaphore Pool

It seems that there’s nothing in .NET similar to MsgWaitForMultipleObjects, I needed a semaphore list with the ability to wait for an item to be released (and to get that semaphore’s index). The closest thing I did was a loop to wait for each semaphore a time slice, however it’s far from optimal. Still looking into it.

Viruses

It’s the first time my PC got infected in a loooong time, I fought them with HijackThis but in the end I found a better solution, that is, ComboFix.

Adobe Switchboard

does a good job at controlling Adobe Photoshop from Air, too bad that sometimes random messages get lost :) .

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.