Posts

Showing posts from 2013

Lync Server Call Handling and Transfer Using UCMA

Microsoft Unified Communications Managed API? Never heard of it? Yes, it's not that common for programmer to integrate with Lync, especially - its server part. Though I had (still have?) an opportunity to work with it (UCMA 3.0) and now I will tell you one of the interesting stuff I was able to implement using it. I am not talking about really advanced (say, "advanced advanced") things like changing/looking at the SIP headers or implementing custom codecs for media but something more advanced than starting a conference. Here is the scenario: I need to move (transfer) the incoming (dialin) audio call from conference to conference endlessly, with no bounds. Once moved to one conference, you should be able to kick the user to another conference as much times as he(she) desires. For the unpatient, I'll say that the trick here is to use the call self-transfer. But let's get to the sample. Sample is called "Locations" and is freely available at GitHub Wh

DXGI fast screen capture

Task at hand was capturing desktop or monitor contents under Windows really fast. Actually, the faster is better because the real contents of the buffer I am writing to will be displayed/rendered in real time. There are several options of screen capture in Windows. The oldest and the easiest one is using GDI. The minus of it is that it's really slow. The second way of performing capture is DirectX Graphics Infrastructure - you command video card to store the whole screen or one/several monitors's contents inside separate part of its memory (surface). After that, you can either command video card to draw it somewhere else (for example, on texture). Or lock this surface and copy its contents to the main memory. Looks a lot more promising, huh? Of course I chose the DXGI way! To keep the actual DXGI-based implementation away from the main sources, I had created DXGIManager object incapsulating the actual capture stuff and opened up only a few basic methods: HRESULT SetCapt

Firefox: building from source and trying out the incremental build

Task at hand on the job required me to understand how does the Mozilla Firefox's plugin system works in detail. Although there is a lot of documentation on the protocol used there (it is called NPAPI ), the task required not only understanding the interface but to have an opportunity to see what data is passing between some plugin and the browser itself. So I decided a pretty straightforward way in here - build Firefox from source and debug browser or have some additional logs added to the source. Building Firefox turned out to be not so scary or complicated - I used the official knowledge base:  https://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions In short: - I chose not to download the zipped sources over HTTP - using source control system looked more appealing in case if there will be any need in rolling back my changes or pulling new changes from the server. I simply cloned the main repo of the Firefox: hg clone mozilla-central - Downloaded

Using C# code in C++: CLI

C# codebase on other hand (old project) and the necessity to reuse its code in C++ (WCF, WIF, some SDKs are purely .NET) led our team to the question "how would we be able to reuse this code fast"? Ideas of implementing pipe interface is too clumsy and finding the unmanaged alternatives of the WCF and WIF will take too much time. And here the solution that come up: use the interim C++/CLI library which will use purely managed C# libraries on one hand and will expose purely unmanaged CPP interfaces on the other. Here the sample project is: https://github.com/pgurenko/CLIDemo CLIDemo solution contains three projects: CSharpLib – pure C# assembly with one class we will use from CPP CSharpLibCLR – C++/CLI wrapper for the CSharpLib CLIDemo – purely unmanaged C++ console project using CSharpLibCLR as a statically linked library CLIDemo is creating the interim class, subscribing to events and invoking events/receiving event callbacks using purely man

Updating Perforce revision information when copying files to another PC

Recently, had a task to sync with Perforce branch that had enormous amount of data (10 Gb). As soon as there was not only me but my colleagues as well required to download this branch, the simplest way of "Get Latest Revision" would require a lot of time. So what are we got to do? The solution turned out to be very simple: 1) Download branch only once 2) Copy contents of the branch to any other PC 3) Issue p4 flush command in command prompt As soon as (1) and (2) are pretty easy to do, the hardest part was to issue the correct p4 flush command. To help others, here it is: > p4 -p tcp:<host>:<port> -c <workspace> -p <password> flush //depot/<path>/...@<revision> You can add "-n" in the end to not doing anything but just testing your command first. Have fun!

C#: Enumerating Windows Using Interop

At last I decided (and willing:)) to get a better understanding of the technologies I use. And to better understand, you know, you should practicing, right? So here is my first tiny sample written it 10 mins. It enumerates all the windows on your desktop. Just out of coriosity. Sample shows just the small part of C# interop: which "using" to define, what it looks like (a bit ugly at my taste;)) Feel the power of interop and god bless  http://www.pinvoke.net/ ! Platform: Windows Language: C# IDE: Visual Studio 2010 Source code is freely available on GitHub: https://github.com/pgurenko/CSharpInteropSample Cheers