Open source examples

  • scope_guard

    • A modern C++ scope guard that is easy to use but hard to misuse
    • this discussion of choices shows how I approach software design

  • StretchableSprite2D Demo (recording)

    • 3D node scaling is reinterpreted so that the 2D image stretches and shrinks – the borders are kept intact and only the “inside” is scaled, unless only space for borders is left, at which point they are also scaled
    • 9-patch principle
    • The pull request and forum threads discussing the idea here and here


  • A few documents

  • RT 2014 proceedings RT 2014 poster 2008/2009 Activity report

  • A few presentations

  • Data Scouting status update HLT Integration status update Evolution of PSC framework and athenaHLT
    Data Scouting tests in Technical Run 9 Updates on xAOD::EventInfo Online histogramming in athenaHLT
    Improvements made in package histmon for release tdaq-02-00-03 Follow-up of my work at CERN HLT infrastructure and integration
    (TDAQ week talk)

  • ATLAS Outstanding Achievement Award

    • For outstanding contributions to ensuring the integrity of the Trigger for Run 2.

  • The 1st thematic CERN School of ComputingtCSC 2013

    • Data oriented design
    • Memory programming
    • Parallelism
    • Efficient computing
    • Acceleration


  • From the moment I found it, I was immediately seduced by the edX project, which offers online courses from the best universities in the world. I audited a few courses and managed to learn a lot with MIT's Solid State Chemistry course, which I unfortunately didn't find the time to finish.
  • With Berkeley's CS188.1x Artificial Intelligence, however, I took the full challenge and I am glad I did. Even though I am familiar with the subject, it was still a great hands-on review experience. I got 91% because I stupidly missed a piece of homework... grrrr

  • CS188.1X Certificate CS188.1X grade


  • Screenshots

  • Demos

  • This video shows the execution of the program Faces, which allows the user to create facial expressions for a character by mixing existing expressions. This tool was based on an existing OGRE sample which we adapted and extended to meet our needs. This tool was implemented by Janete Faustino, on her master's, and by myself, prior to my own master's, on the first year I worked at LabMAg (Laboratório de Modelação de Agentes – Agent Modeling Laboratory).

    The face model, along with all pre-existing animations was completely created by Janete. I worked more on the programming side for allowing the actual expression mixing and saving process.

    This demo uses the codec ensharpen. If you have trouble watching it, try to either install this codec, or simply watch with VLC.

    During my second year at LabMAg, where I did my master's, I devoted most of my time to design and implement the Graphical Processing Layer of the IViHumans platform. This was a project that was constantly supported by my master's supervisor, Ana Paula Cláudio, and by my teacher Beatriz Carmo. The teachers Graça Gaspar, and Luís Moniz who were on the side of the Artificial Intelligence Layer, also provided me with great and frequent orientation.

    This video shows some of the features I implemented for the graphical layer of the IViHumans platform: synthetic vision, real-time simple and composite facial expressions with seamless transitions, steering and locomotion, and the interface for communicating with the AI layer (in this case represented by a stub client that is used to send commands).

    Note that the virtual human models are only prototypes I produced for demonstration purposes. The poor frame-rate of this video does not reflect the real operation of the graphical layer. It is caused by the interference of the screen capturing which is most noticeable when the camera moves .

    The male model was derived by applying free motion capture data to an already rigged model. The motion capture data was obtained from mocapdata. The model was a free version found at aXYZ design.

    This demo uses the codec ensharpen. If you have trouble watching it, try to either install this codec, or simply watch with VLC.

    This is an older video that shows the result of cycling through the expressions of a prototype model we created, as well as having it move with an earlier stage of our steering/locomotion implementation. This video was created for a presentation of the process we followed for the creation of this virtual human prototype, which involved merging of an exiting face into a foreign body, while keeping the animations previously encoded for both.

    This video was screen-captured with fraps and uses their own codec. If you have trouble watching it, try to either install their codec, or simply watch with VLC.

  • Most important (IViHumans') documents

  • IViHumans Platform
    The Graphical Processing Layer
    (Master's Thesis)
    Virtual Humans in the IViHumans Platform
    (3IA paper)

    More Publications

    Python does rule! – Code Snippets

    Python is a programming language that I learned when I went to CERN and that I came to venerate :)
    This section has a few examples of magic/crazy stuff you can do with it.

  • Creating and using classes at runtime.

  • This example shows the creation and usage, at runtime, of an exception class. The user is asked to input a name for the new exception, which is created, raised, and caught:

  • Faking the __dir__ mechanism for python versions < 2.6

  • From Python 2.6 on, you can implement a __dir__ method for your objects, which will be called whenever the method dir is called for that object. At some point, I wanted to use this feature to implement a state machine that provided different operations in different states, but I was stuck with Python 2.5 at that point at work and had to implement the mechanism myself:

    This will only install the new dir method if the original still doesn't implement the __dir__ mechanism, that is, if the version of the interpreter being run is < 2.6. If you want to test this in python 2.6 or higher, you can comment the line
    version_split = platform.python_version().split('.')
    and uncomment the one bellow it.

    You can add something like the following to try the custom dir:

  • Calling methods in another process

  • This example shows how you can call methods in another process directly, using the dot (".") as always. Note that this is probably not something you want to do, because you are hiding the fact that the methods are being called in different processes and because you need to call a special method to obtain their return value (otherwise you would have to wait for the other process to finish executing your method, which would take away the whole point of parallelism). You would probably be better off with some method "remote_call" that you would call explicitly, to make it clear that the method is being executed in another process. Still, this was a pretty fun experiment.

    Notice how you can execute a "doStuff" method in another process "worker" just by saying "worker.doStuff()". Notice also that you can even pass parameters. This example uses the unittest to show what it can do, but there is also a simple direct usage demonstration in the end.

    C++ can be frightening – Code Snippets

    C++ can be frustrating and frightening at times, but it also gives you a great feeling of power when you dominate the beast. In this section I will be putting short code snippets and discussions of interesting stuff.

  • Dynamic library loading and forbidden pointer-to-object to pointer-to-function casts

  • Suppose you want to dynamically load some library that provides the implementation of some interface – let this interface's name be T – that you use in your code. Suppose also that the only way you have of obtaining your implementation object is by calling a factory function that is required to be defined in the library you are going to load. That is just what I have to do in one of the projects I work at...

    I am somewhat lucky, because in this project I have access to a private library that makes the library loading process more C++ like than the usual, while still using dlfcn.h for its Unix implementation. But it still cannot solve a known C++/SUS (Single Unix Specification) standard conflict (see the section "Rationale" in the previous link). The problem is that the XSI extension requires functions to be holdable in void* pointers while, on the other hand, the C++ standard forbids you from casting between pointer-to-object and pointer-to-function. Since dlsym returns void*, and because void* is seen as a pointer-to-object, you would be breaking the rules once you cast what you get from dlsym to a function type (which you would need to do to call it). I don't know about other compilers/versions, but in g++34, this would generate a warning, unless you used an old style C cast. In g++43 you get the warning even if you use the C cast.

    This warning was annoying and I didn't like the fact that I had to break the standard to get what I needed, so I came up with a different solution: instead of casting a pointer-to-object to my pointer-to-function, I cast the method that returns the pointer-to-object to a method that returns a pointer-to-function. The cast is still from function to function, so it is ok, but you will get the intended function pointer when you call the resulting method.

    The following code shows how I did this, taking out the irrelevant parts and the error checking/handling. Here, Module is a class that abstracts the loading procedure. It has a static method add that has to be called first to associate module names with actual libraries and modules. You can then call get to get a handle to the module abstraction. Finally, you can use its member void *symbol(const std::string& name) const; to get a pointer to the dynamically loaded symbol you want. In my case, the symbol I want is a factory function whose type is defined in the first typedef. I called this type factory_func. The second typedef defines a function that is very similar to Module::symbol but that returns factory_func instead of void*. Once I get my factory, I can call it to get the implementation of T I needed in the first place.

    Just for fun, here is what the line where the cast occurs would have looked like without the typedefs...

    Now, that took me some time to get right...


    My list of publications, with the corresponding PDF files

    My CV
    Get my Curriculum Vitae in PDF format

    Design downloaded from free website templates.