Open Source or Knowledge Socialization


I think that sooner or later you have to admit that the free software or open source is one of the most controversial, important and biggest social revolution of our industry.

Now we have a lot of new business models, from the free foundations and the hacker’s community to the business of the “free” stuff. Its important not only for the opportunities and the new models but for the social change that promotes.

Our world is becoming more and more communicated. Culture, languages and distances now doesn’t matter at all. More than ever we need to stop, to realize this new world, and to change, we are more concerned about mutual help to resolve our world most relevant issues.

I’m a believer of free knowledge and the importance of share what you know. If we stop to hold it just for ourselves our world will be very different. If you look at mathematics you will see how this science mother of others is sharing and creating innovations everywhere. The author will have the recognition from the community but you can use this knowledge at once, at no charge. Is even sort of a contradiction that you can patent immediately some applications of those mathematics and you don’t have to pay to the original author of the mathematics foundation.

It is understandable that patents have his place in history and that are or at least where good in a specific time and place, but I don’t see a terrible slow innovation by free or open software.

¿Witch business model will stand to the future? ¿Is there any chance that other industries like pharmaceutics will be on a free and open way of share the innovation and discoveries? ¿This will be sustainable? ¿What about automobile, construction or other industries?
¿What we can learn from mathematics and from the open source software?

A good friend told me once: Now is the time for knowledge socialization just turn around and look to Wikipedia.

¿Are we really achieving the knowledge socialization, are we ready for it?


Computer Vision


Computer vision has today less buzz but much more real and practical application. I’m a little impressed with the state of the art of this field. I remember those days at the Universidad La Salle when some friends and I was trying to get some advantages in image processing with the “new” mmx functions of the Intel Pentium processors and when we try to implement some Douglas-Peucker Approximation with the aid of the voodoo graphics cards and the glide libs. Today you don’t need almost anything about mathematics and you just need a standard computer to do very impressive things.

I think the most important thing of all is that today there are some good companies and startups that are making great business when before it were just an academic interest.

Microsoft for example always had some research on CV, and has some libraries out there, but now is making business with a more small company that has the kinetic technology. This is a good juncture I think and a good opportunity for startups or companies that clearly has a single-technology focused strategy.

If you had some interest you can check companies like PrimeSence or Seeing Machines to take an example.

Singleton and Thread Safe Methods on .Net


Recently I had a code review on one of my colleagues project and found this common implementation there:

public sealed class TheClass {
   private TheClass() {}
   private static _theClass value;
   private static object obj = new Object();
    public static Instance Value {
          get {
                 if (TheClass.value == null) {
                        lock (syncRoot) {
                               if (TheClass.value == null) {
                                      TheClass.value = new TheClass();
                 return TheClass.value;

Yes we are talking about the classic Singleton pattern here, but not implemented as the proper or, more importantly, safer way. This implementation could permit a double instantation at some point. In short I’ll just recommend to make _theClass volatile, but I know it’s not the unique way to achieve this and is not always the safer way in all platforms. So searching this on the internet I found a lot of discussions so if you are interested on a deep level reading check this links:

volatile and MemoryBarriers
Double-checked locking in .net at Stackoverflow

Alois Kraus even shows the assembled code!
Lazy Vs Eager Init Singletons / Double-Check Lock Pattern

And of course the Official Microsoft Pattern

Good reading!

System.DirectoryServices.AccountManagement.UserPrincipal Serialization


You can’t serialize this Type, the first reason is simple: Doesn’t have [Serialize] attribute on the base classes, but more important it has a lot of dependencies on non-managed resources that has to be connected to this class. If you could serialize making some tricks the class would expect to connect to Active Directory on the client consumer side, and assuming that the class could connect then it will be non sense to send the class in the first place. It will be more easy that the final client create and connect to the class directly.

So if you need to serialize just “data” of this class like some info on the attributes of an user. The recommended way will be to implement a memento pattern.

When you had a lot of properties and you are not worried of a coupled internal constructor (for example when the class will be serialized for a .Net Web Service and that constructor will not be used on the client consumer side) you could use a internal constructor that get as an argument the original class like:

public class UserInfo
  private string displayName;

  public UserInfo()

  internal UserInfo(UserPrincipal user)
      this.displayName = user.DisplayName;

This way you can use it in your return methods like this:

return new UserInfo(user);