Showing posts from November, 2013

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:

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 mozilla-build b…

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:
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 managed code.

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!