The technology behind Noesis Gui

February 8, 2012 @ 4:37 | In Noesis, Programming | 7 Comments | twitter rss digg
NoesisGUI

As many of you know, in recent years I have been working at Noesis Technologies in charge of the technology. We have been very excited these days because we are ready to release our first public software, our internal user interface technology released as a middleware called NoesisGui. This week we are starting to roll out the SDK to participants in the private beta program and as many of you have asked questions about technical details I though it would be a good idea posting here a brief overview of the technology complexities we faced in NoesisGui.

Click to read the full article »



Twitter

September 26, 2011 @ 18:12 | In Personal, Programming | No Comments | twitter rss digg
twitter bird

Whoops, long time since my last post! It’s been exciting days this last year working very hard in different projects starting an own small business with my partners. Next week we are going to shed light on at least one of them.

I have several draft articles pending to be published here. As soon as I have time I will recover energy for this blog.

Meanwhile, you can follow me on my twitter account: @EntTwit



The Art of Multiprocessor Programming

July 5, 2010 @ 14:36 | In Books | 1 Comment | twitter rss digg
The Art of Multiprocessor Programming book image

The Art of Multiprocessor Programming
Author: Maurice Herlihy & Nir Shavit
Pages: 508
Published: 2008

Multiprocessor is everywhere now. After a period of uncertainty and fear we are starting to grasp multiprocessor architectures. We have started to forget about threads and started to think about tasks / jobs to decompose algorithms. The book The Art of Multiprocessor Programming will help you to have a solid background to implement a powerful multithreading architecture in your application.

The book is written as a textbook and each chapter at the end includes exercises that practice the presented concepts. In spite of the fact that this book may seem too academic in some sections, it is written and structured precisely. Java language is used in all samples although there is an appendix at the end of the book which describes the basic techniques using C# and C++ (using POSIX Threads). This book is definitely not for copying code but it is to understand deep details. After reading you should be prepared to start implementing these techniques yourself although I would recommend to use a good middleware (like TBB). Both actions are complementary to this book.

The book is structured in three parts. The content of the first part is definitions of mutual exclusion, fairness, memory models, shared memory and it may be hard to read. The second part is dedicated to real implementation. Firstly, basic tools like spin locks, monitors and semaphores are studied and implemented. Next, high-level containers are implemented using different techniques (mutexes, lock-free algorithms, etc): linked lists, concurrent queues, concurrent stacks, concurrent hashes, skip lists and priority queues. The chapter 16 is quite interesting. It is dedicated to futures and scheduling. Implementations like the Cilk Scheduler are described and implemented. The last part of the book (although included in the practice section) is dedicated to further experimental techniques like Transactonal Memory. It is good to see a working implementation of it.

I strongly recommend this book for the core programmers of your team, for those who will be in direct contact with the multithreading architecture. Although I would prefer a version of the book in C and I found some bugs and errors (probably due to being the first revision) I have not found other better book.

Rating: 7 / 10



Code Bloat Hunting

February 6, 2010 @ 1:39 | In Programming | 4 Comments | twitter rss digg
Image with lots of books

I have dedicated the last few days of work to face a problem that is getting bigger and bigger. Although we have a quite modular codebase, use interfaces whenever possible to hide implementation details and apply most of the recipes recommended in classic books, our linking times have started to be a problem in some of our libraries. Linking times is not the only problem. Our binary sizes are becoming really fat.

After a thoroughly study with the help of tools like Sizer, Symbol Sort (I strongly recommend reading the articles associated to this tool: 1, 2, 3, 4, 5, 6 and passing all them to your co-workers) we discovered lot of code bloating generated by improper template usage. The template is a powerful tool that can be easily misused although I am not against using it. We use template metaprogramming in lots of places like reflection, annotations, uri-like dependency properties, serialization and more places where it is worth it. The problem with templates is that normally declarations and definitions go in the same header file. With that structure a compiler is normally forced (although some compilers allow customization) to generate template instances in each obj file. Redundancy is eliminated in the linking phase, of course taking time. This is one of the faces of template bloating. The other face appears when you templatize functions when it is not strictly necessary. And you pay for it in the final size of your binaries.

Trying to solve all this, we applied a solution that although yet not standard seems to work in all compilers we tested: exporting explicit template instantiations. This technique applies when you have a template that is to be instantiated for only a few known types. Those instantiations are exported from a dll. This allows even hiding big functions in the .cpp without having to show them in the header. With this solution you have the best of both worlds: short functions can be inlined by the compiler and large functions instead of being instantiated in each compilation unit are referenced as an exported symbol. By the way, a special behavior of Visual Studio (to me, it is a bug) has the effect of non inlining functions being defined outside the class when exporting the template. We had to move our definitions (that we usually have pseudo hidden in a .inl file) to inside the class declaration.

We applied this strategy in several places reducing the bloatage by a considerable factor. For example, the vector library seems an ideal target because you normally only instantiate that library for a few types (float, double, int) and “big” functions like Invert() for 4×4 matrices can be hidden and exported from the dll. Another good candidate is std::string (instances for chat and wchar_t). Although, at least in MSVC, this job is already being done by the crt (not tested in other platforms).

I hope you find this useful. Thanks for reading and welcome to all the new subscribers since my last post!



The Documentation Challenge

July 28, 2009 @ 21:58 | In Programming | 2 Comments | twitter rss digg
Image with lots of books

Documentation is the part of the development process where usually less time and money is invested. Few resources implies a poor infrastructure for something that, as the project gets bigger and bigger, becomes a very important part of the overall process.

I want to share in this post the approach we are following for a project I have been involved with for over two years. This project (I will be able to give details about it very soon) is mainly a framework composed of libraries to be used by other companies. Basically, a work from developers to developers, clearly a context where documentation becomes very important.

Click to read the full article »



Compile-Time Strings

April 28, 2009 @ 23:19 | In CodeGems, Programming | 6 Comments | twitter rss digg

It would be nice if we had such a feature in the C language, wouldn’t it? The term ‘compile-time string’ is referred here as strings that are converted to unique integer identifiers at compile time. At run-time those identifiers are simple integers that can be compared and hashed very fast. In other languages, like for example Smalltalk, the concept of Symbol implements a similar idea. The following post describes a possible implementation of this feature in C/C++.

Click to read the full article »



Andrew Glassner’s Notebook

March 9, 2009 @ 1:52 | In Books | 2 Comments | twitter rss digg
Andrew Glassner's Notebook book image

Andrew Glassner’s Notebook
Author: Andrew Glassner
Pages: 304
Published: 1999

During periods in which I need to stay focused in hard technical problems I try to avoid reading dense books because they distract me from my work. I found this book in my bookshelf, in the stack of unread books :) , and decided to skim it a little bit. “This book is about having fun with computer graphics”, that’s the beginning of this book written by Andrew Glassner (editor of the mythical The Graphics Gems series, when the gem series were not a virus, and the classic Principles of Digital Image Synthesis among others). As soon as I started to read the first chapter I couldn’t stop.

I was expecting to find a book very similar to the Jim Blinn series, the Jim Blinn’s Corner. And although the structure and the origin is the same, a compilation of articles published by Glassner in a column of the bimonthly magazine IEEE Computer Graphics & Applications, this book is radically different to other books about graphics and mathematics. No formulas, no algorithms, no code in this book. Instead, you will learn about origami and the platonic solids and the teapotahedrom, how to organize the LCD segments of a digital display, the phenomenon of moiré patterns, designing tiles that are aperiodic (I didn’t know it was possible) or even how to layout box designs in a single piece of cardboard. After reading this chapter, the next time you unpack a box from Amazon you will pay attention to those little details that usually pass unnoticed.

Apart from the old revised chapters you can find columns that were never published too. Disparate topics, but all of them related to graphics and 3D in some sense. The visual quality of the book is excellent with all the pages in full color and the style of the author is even better. Andrew Glassner is among the best writers in the Computer Graphics field.

I give my full recommendation to this book. Andrew Glassner’s Notebook will appeal to both novice readers and experienced mathematicians.

Rating: 8 / 10



Planet 51 Trailer

January 16, 2009 @ 11:26 | In Internet, Personal, Videogames | 2 Comments | twitter rss digg
Planet51 logotype

Since the first day I saw content from Planet51 I knew it was going to rock. I am emotionally attached to this movie because I worked in the Videogame for a few months and because I have worked in the past with several member of the technical team that is behind the movie. I know first hand they are very talented people.

And finally, the trailer is now live: Planet51 trailer!

Congratulations to all the team. All the best for them.



Stripping comments from Shader bytecodes

January 15, 2009 @ 21:37 | In CodeGems, Programming | 1 Comment | twitter rss digg

In DirectX, when compiling a shader with D3DXCompileShader() a buffer containing the shader bytecodes is received. Apart from the bytecodes, extra content like debug and symbol table information is embedded. That extra information is added in form of comments that probably can be eliminated because you are already processing it at compile-time and it is not needed at run-time when loading the shader.

If you can do without that information the following code will help you to save a few bytes, even halving the size of the byte-code in the best cases.

Although not documented in the DirectX SDK, this CodeGem is not an undocumented hack. The Direct3D shader code format is documented in the MSDN, so it probaly won’t change in future revision of DirectX v9.0 (if there is going to be any more…)

D3DPtr<ID3DXBuffer> StripComments(const D3DPtr<ID3DXBuffer>& code)
{
    // Calculates the new size (without comments)
    int* codeData = static_cast<int*>(code->GetBufferPointer());
    unsigned int sizeInWords = code->GetBufferSize() / 4;
    unsigned int strippedSizeInWords = sizeInWords;
 
    for (unsigned int i = 0; i < sizeInWords; i++)
    {
        if ((codeData[i] & 0xffff) == D3DSIO_COMMENT)
        {
            int commentSize = codeData[i] >> 16;
            strippedSizeInWords -= 1 + commentSize;
            i += commentSize;
        }
    }
 
    // Creates a new buffer with the original code but omitting the comments
    D3DPtr<ID3DXBuffer> strippedCode;
    V(D3DXCreateBuffer(strippedSizeInWords * 4, strippedCode.GetPtrForInit()));
 
    int* strippedCodeData = static_cast<int*>(strippedCode->GetBufferPointer());
    size_t offset = 0;
 
    for (unsigned int i = 0; i < sizeInWords; i++)
    {
        if ((codeData[i] & 0xffff) == D3DSIO_COMMENT)
        {
            int commentSize = codeData[i] >> 16;
            i += commentSize;
        }
        else
        {
            strippedCodeData[offset++] = codeData[i];
        }
    }
 
    return strippedCode;
}


Three free productivity booster tools

December 20, 2008 @ 17:30 | In Internet, Programming | 4 Comments | twitter rss digg

We, as programmers, see optimization opportunities everywhere, and more when they can be applied to our work tool, the computer. What follows is an enumeration of three tools that will save you precious time in your daily work. To me, they have become indispensable tools. Hope they will become the same for you:

  • Launchy. Launchy is a keystroke launcher that clones the behaviour of Quicksilver in Mac OS. With this tool you will say goodbye to your start menu and desktop icons. Everything is now accessible from a few keystrokes: folders, applications and even websites, all with a simple alt + space. The perfect complement for Launchy is StartKiller, a tool for removing the Start button from the taskbar. To me, Launchy is as revolutionary as 4DOS was back in MS-DOS days. How much time did you save? (bonus: and now that you can have a 100% clean desktop it is time to use a decent wallpaper…).
  • AutoHotkey. Whatever can not be done with a few launchy keystrokes most likely can be programmed with an AutoHotkey macro. AutoHotkey incorporate a powerful script language that will allow you to automate almost anything: instant access to disk folders, internet tabs, activate tray programs, change visual studio layouts, send email, check calendar, etc.
  • xplorer². xplorer² is a file manager with enough features to say good bye to Windows Explorer (Microsoft, admit it, it is not designed for advanced file manipulation). Although there is a professional version, the free lite version is enough to me, especially the Tabbed dual-pane interface feature. With AutoHotkey you can easily redirect Win + E to xplorer².

And that closes out my small contribution to reduce energy wastage in the world 8-) . I am sure you can share more gems like these. One more time, thanks for reading.



Thu, 18 Sep 2014 23:46:04 +0000 / 18 queries. 1.609 seconds / 2 Users Online

gentoo link wordpress link apache link PHP link

Theme modified from Pool theme. Valid XHTML and CSS