December 25, 2008

TDD, the EOS 5D Mark II and black dots

For almost 8 weeks I have had a queued order at a large Swedish camera dealer waiting for the delivery of a Canon EOS 5D Mark II (easier model names are welcome!).
Rumors go wild on the internet about two software issues called Black dot and banding issues on the newly released EOS 5D II. Users seems be concerned by the bug despite it appears under very special circumstances.
Canon has acknowledged the problem and announced that a firmware update will correct it.

Since I have been working as software developer for many years I know how difficult it is to test all possible combinations in a complex system such as a modern SLR camera. It is not very clear to me that Test Driven Development would have revealed that issue even when I suspect Canon has very strong testing routines. Today we live surrounded by systems that rely on software: airplanes, nuclear plants, train control systems and SLR cameras are a few examples. There is a very substantial difference between the first three and the last one: the target groups that operate those systems and the security and reliability requirements they must meet. Higher reliability requirements will definitly have an impact on the final price. And who will pay for that?

So, SLR users, we have to be patient and accept that these "issues" occur and will occur. They are one of the results of the very hard competition between camera manufacturers that want to be first on the market with models that perform on the top of the line. Both as a professional and customer I have much respect for Canon as a hi-tech company who has solutions for a number of segments.

As we can see below, Canon is not alone facing criticism from photographers. Relax and enjoy.

Los cubanos y las Navidades

Nuevamente Enrisco vuelve a deleitarnos con otro de sus escritos humorísticos. Esta vez abarca el tema de las Navidades y su relación con los cubanos. Aquí lo tienen.

December 12, 2008

Extreme situation

Here we can see Simon Lowe's fantastic video at Manchester Airport taken during a takeoff of the World's (in my opinion) most beautiful aircraft, the Boeing 757. A bird strike on the engine 2 is clearly visible. Amazing cooperation between the control tower and the pilot. Very professional! A clear example of how-to-do. Take a look.

November 5, 2008

A new hope

Today the people of the USA voted for change. A change that could make this world a better place for everyone of us.
I wish Barack Obama and hes team much success with all the goals he aims to achieve.
Barack Obama is just what the World needed, not only to end the Bush era but to reintegrate the USA to the world community.

September 30, 2008

Eliécer Ávila, las consecuencias

A principios de febrero el mundo pudo ver como unos valientes estudiantes de la Universidad de Ciencias Informáticas (UCI) en La Habana ponían contra las cuerdas al presidente de la Asamblea Nacional del Poder Popular, Ricardo Alarcón Quesada, en una reunión celebrada en la nombrada institución. Especialmente se destacaron dos de los intrépidos jóvenes, Rafael Alejandro Hernández y Eliécer Ávila.


Debo admitir que inicial e inocentemente había creído en la sinceridad de Raúl Castro cuando conminó a los ciudadanos a promover la crítica para sacar adelante al país del atascamiento en que se encuentra. Sus palabras han resultado ser vacías y esta entrevista con Eliécer Ávila lo demuestra.

Espero que atrás hayan quedado ya los tiempos en que un estudiante universitario solía ser expulsado por cuestionar la política o simplemente lanzar una crítca "de mal gusto". Eliécer no ha sido (aún) expulsado de la UCI pero según su testimonio es ya un cadáver político a sus 22 años. El status quo continúa: el sistema no tolera ninguna crítica por muy buenas que sean las intenciones como, en este caso, las de Eliécer Ávila.

Este valiente joven merece todo nuestro respeto y son personas como él las que nuestro país necesitará más temprano que tarde.

September 25, 2008

PostSharp, very cool!

I got this interesting link to PostSharp for tracing code execution from my friend Marcus.
It's really worth to take a look at it.

August 29, 2008

Honor olímpico

Nuevamente Enrisco nos vuelve a deleitar con su humor. Ésta vez examina las prestaciones de la delegación cubana en los recientemente concluidos juegos olímpicos de Pekín y toca, como es de esperar, el vergonzoso incidente protagonizado por Ángel Matos quien propinó una patada y un empujón al árbitro tras ser correctamente descalificado en un combate de taekwondo. Toda una bajeza y falta de espíritu deportivo. La revista Cubaencuentro lo ha publicado íntegramente aquí.

August 23, 2008

Shame on Ángel Matos and his coach!!!


Today I am not glad about being Cuban.

I saw how Cuban taekwondo fighter Ángel Matos went crazy and kicked the Swedish referee Chakir Chelbat when the Cuban was declared the loser of the bronze match for taking more than the allowed 60 seconds of injury time after he hurt his foot.
The Cuban coach Leudis González refused to apologize for Matos' actions and criticized the referee saying: "He was too strict." The World Taekwondo Federation announced lifetime bans for both Matos and González for "a strong violation of the spirit of taekwondo and the Olympics."

I can agree that in this Olympics there have been scandals in sports where the referee may take a subjective decision. But reactions like Matos' are absolutely unacceptable! Sadly most Cuban official mediums are keeping hermetic silence about this embarrasing situation. The site Vanguardia from my home town Santa Clara wrote a short note wihtout any explanation of the reason for which Matos was declared loser.



Any Cuban official reading this can take a look how Ara Abrahamian lost his chance to the gold medal in the 84 kg class. He protested and threw away the bronze medal with Honor without hurting anybody!

June 29, 2008

New job

Today I posted the signed contract that initiates my proffessional relationship with SEB. On October 20th I will join SEB as software developer after 7,5 years at Europeiska.

June 3, 2008

Go ahead, Obama!

Today Barack Obama has become the Democratic Party Nominee to the President of the United States of America.
Now, the senator for Illinois can concentrate efforts and aim on the battle against McCain, a battle I hope so much Obama will win.

May 31, 2008

Enterprise Library 4.0

So it is here: Microsoft Enterprise Library 4.0.
Most important for this version is that it works only with .NET 3.5.
At my work we currently use Enterprise Library 2.0 but it lacks Validation and Policy Injection blocks. Those blocks are present in the 3.1 version that, for instance, works on both .NET 2.0 and 3.0.

For 4 or 5 days ago I downloaded this latest version to my workstation in order to test it and make a complete evaluation. Although we are not moving to .NET 3.5 it is important to follow Micorsoft's steps.

Compared to its predecessor, this version as some performance improvements, bug fixes, instrumentation support and VS 2008 support.

May 26, 2008

El baile del chiki-chiki

Con ésta humorística contribución un poco refinada España se presentó el pasado sábado en el Eurovisión 2008.



La canción original la tenemos aquí:



...mas Chiki-Chiki News:

May 25, 2008

Hallazgo

En marzo pasado un grupo de pescadores de la localidad de Trinidad, al sur de la antigua provincia de Las Villas, sacó a la superficie una serie de objetos entre los que se incluyen balas de cañón, lastres de hierro, baquetas entre otros.
La edad de dichos objetos "corresponde al período comprendido entre el inicio de la colonización en América y principios del siglo XIX" según el arqueólogo cubano Leonel Delgado citado por el diario oficialista Juventud Rebelde.

Este singular hallazgo me deja más preguntas que respuestas. En la plataforma insular de Cuba encuentran un barco de casi cinco siglos de antigüedad. Pero ¿qué pasa con el avión de Camilo que no aparece?

Hemos de apresurarnos a preguntarle a Raúl Castro antes de que envejezca demasiado y la demencia le impida recordar lo que en realidad le ocurrió al comandante de la sonrisa ancha y el sombrero alón. Yo no creo en casualidades y mientras no se demuestre lo contrario continuaré con mi idea de que Camilo fue accidentalmente herido de muerte (menor probable) o asesinado súbita o premeditadamente de mano o por orden de los hermanos Castro (la más probable).

May 3, 2008

.NET or .NJET?

Most of programmers that began their career on the .NET framework have never asked themselves how the programs interact with the OS or computer through the framework.

Before I went over to .NET, I spended many hours trying to understand what makes the generated code so slow compared to other high level programming languages such as C/C++ or Delphi. I wrote several programs to compare native performance against .NET (C#) and discovered that, for relatively simple operations on integer and floating point types, native languages was over 300% faster than their .NET equivalent ones. The framework itself and the architecture behind is the cause of this. Every time you define a variable in a C program or a member in a C++ or Delphi class, the compiler allocates just as much memory as it needs to hold the variable value: 4 bytes for a 32-bit integer or pointer, 8 bytes for a 64-bit double floating point variable and so on.

While the Marshal.SizeOf method still tells us the truth about the size of an integer or a double type since the method gives the object's unmanaged size, there is a back side of this "truth". Once you've defined a member or variable of any type in .NET, the compiler must also allocate managed resources for, at least, the System.Object members. This means that you can invoke any of those members, for instance, int.ToString(). Easy and elegant but it has a price in form of a performance penalty.
Working on strings is not the best side of the .NET framework. Any time you copy or concatenate a string, the string class allocates a new string object that will be returned by the member in question. As the Copy method reveals, the returned string is allocated by the FastAllocateString call.

public static unsafe string Copy(string str)
{
if (str == null)
{
throw new ArgumentNullException("str");
}
int length = str.Length;
string str2 = FastAllocateString(length);
fixed (char* chRef = &str2.m_firstChar)
{
fixed (char* chRef2 = &str.m_firstChar)
{
wstrcpyPtrAligned(chRef, chRef2, length);
}
}
return str2;
}

In contrast, the C runtime library works on memory areas which is much faster but the programmer is responsible of keeping buffer sizes and boundaries.

It is well known that for large strings, the StringBuilder class, performs much better than the string class does. But this will not be covered here.

But, back to the question: Dot NET or dot Njet? For me the answer is definitly .NET as long as there are no high performance requirements. I suspect there is no programmer out there that would even consider writing a graphic-intensive game or a device driver in C#. For those purposes the Microsoft Visual Studio still gives you the C/C++ option and you have all combined in one development tool. If there comes a day when I must develop a time or resource critical application, I will dust off my C/C++ skills.

April 6, 2008

.NET managed printing - a real slug

At my work we have had a document rendering and printing service for a while.
The service first renders those Reporting Services reports in a queue and then prints them out when needed.
The printing classes of the service I wrote in 100% managed C#. At that time I was not aware of the peroformance penalties that the PrintDocument class had.
Everything began when my boss assigned me a task for implementing new features in our existing printing service for the newly purchased and very advanced printers. Firstly, the users should have a "follow me" function. Then, the serive must handle to printing to pre-defined media type(s), rather than to a specific paper tray.

The .NET framework does not provide the posibility to print to a specified media type since that functionality is device-dependent, so I started my research work by contacting Ricoh, the printer manufacturer. I got the API and the device driver to communicate with the printer devices.
After translating thousands of lines of code from C/C++ to C# I could build an assembly that I could use to select the Ricoh user defined media types. Partial success! But I would be dissapointed by the way .NET differs between managed Enhanced Metafile handles from unmanaged ones. Just EMF handles, I thought. Soon I realized that I could not use the Enhanced MetaFile handle, obtained by a call to the GetHenhmetafile method of the MetaFile class to be passed as a parameter to the PlayEnhMetaFile API function. By the way, I discovered a bug in the MetaFile class and submitted it to Microsoft.

Finally, in order to get my new classes work properly I had to make several calls to undocumented GdiPlus functions, mix some data in unsafe contexts and wrap some API native functions. After all, a document that took 113 seconds to be printed is now ready after 11 seconds. Unbelievable, 10 times faster!!!

Now we have a printing service that works in turbo mode and Ricoh will get the complete API code for the .NET framework free of charge so other developers rapidly can use it in their .NET projects.

February 19, 2008

Fidel Castro abandona el poder

Con una mezcla de alegría y preocupación he recibido la noticia de parte de mi esposa. Alegría porque el estancamiento en el que se hallaba Cuba ha sido finalmente interrumpido. Mi preocupación se debe a que Cuba no amanecerá como una democracia porque Fidel Castro haya decidido apartarse del poder, obligado por su deteriorada salud y avanzada edad.

Raúl Castro será sin dudas el hombre que iniciará, tímidamente al principio, los cambios que tanto esperan los cubanos dentro y fuera de la isla. Ya en la década de los 80 el hermano menor de Fidel Castro demostró ser un hombre dispuesto a reformar el sistema. Una de esas reformas fue la del mercado campesino que Fidel Castro deshizo cuando se percató de que los intermediarios y campesinos habían comenzado a acumular grandes sumas de dinero.

Por fin los vientos del cambio han comenzado a soplar sobre la isla. En otras ocasiones he celebrado eventos de menor relevancia que éste, así que ¡Enhorabuena!

February 4, 2008

Apellidos españoles (chiste)

Este chiste me lo envió un amigo. Está bien cómico.

El sufijo "ez" en los apellidos españoles proviene del hebreo y significa "hijo de". Así tenemos:

Álvarez - hijo de Álvaro
González - hijo de Gonzalo
Hernández - hijo de Hernando
López - hijo de Lope
Martínez - hijo de Martín
Rodríguez - hijo de Rodrigo

Chávez - hijo de Puta

February 2, 2008

The Mercury flow (III)

Finally, the Lateral Thigh Trainer has been stopped by InterSport Sweden. Now we are awaiting for IIC in Switzerland to stop the product even internationally, forcing all the dealers to remove it from the market.

Hopefully this will happen soon. As I wrote for three months ago, the use of mercury is prohibited in the whole European Union. Nevertheless I feel that I made a contribution to a better environment. Further I will keep my eyes open.

Here is the letter issued by the InterSport Sweden product chief Jan Johansson and addressed to Marcus Hagberg at the Swedish Chemicals Agency.

January 20, 2008

The Portuguese Men o' War

During the Cuban winter season it is posible to see the Portuguese Men o' War arriving to the Cuban coasts blown by the winds from North America.
These creatures (Physalia physalis) are as beautiful as they are dangerous to humans. The blue sail allows the animal to stay floating on the surface and to be pushed by the winds and water currents. Under the surface the Man o' War has a number of tentacles that can be as long as 10 meters!

The sting from the tentacles can be fatal to humans. Actually, when I was at Clínica Internacional de Varadero with my wife, the paramedics came in with a teenager that had been stung by a Portuguese Man o' War. The girl was in a serious state of shock.

After that I began to warn every tourist that I saw on the beach being attracted by the beauty of the stranded animals.

Finally, when I was taking a photo of a stranded Portuguese Man o' War on the beach of Varadero, I didn't see that a wave had thrown another Man o' War close to my feet. My right foot was reached by one of its tentacles. What a pain!

January 15, 2008

Visita inusual

El día 28 de diciembre de 2007, luego de haber sido multado en la calle Línea como escribí en el artículo anterior, me dirigí hacia el municipio Playa.
Esta vez iba a ver a Gorki Águila Carrasco, director de Porno para Ricardo, un grupo de rock muy conocido tanto en la isla como fuera de ella.

A él le llevaba un encargo: el díptico conformado por los CD: A mí no me gusta la política pero yo le gusto a ella compañeros y Soy porno, soy popular.
Yo ya me había comprometido a llevárselos para que cada integrante del grupo tuviera su propia copia del trabajo que ellos hacen pero que no ven producido ya que esos discos son editados fuera de Cuba.

Conversamos amenamente un rato y antes de marcharme recibí de sus manos un afiche con el logotipo del grupo. Al entregármelo me lo dedicó.

El la edición de hoy de Encuentro en la red aparece un artículo sobre el concierto que ofreció la banda recientemente en un cine en el municipio Playa. Concierto y desafío se titula el escrito.

My first ticket!

On December 28th, 2007 I went to Havana with my parents and daughter to see my sick aunt there. My wife was also sick and stayed in Varadero.


I drove through 13th street and, before the intersection with the Línea street, there is a left-turn-prohibited sign. I had seen the sign but there was a congestion on the Línea street all the way down to Malecón and my father insisted that it would be ok to turn left. What a surprise when we saw the police 20 meters ahead!

No discussion, I broke the article 143 inc. 5 of the Cuban Trafic Law, said the officer. I got a ticket for 30 pesos. I could never imagine that the first time in my life I got fined would be in the Cuban capital!


But the most interesting of all was that the police officer could not spell correctly in his mother tongue. He spelled Sweden as Suesia (see ticket picture) and, on the receipt he kept, he misspelled the street name as Linia. The correct spellings are Suecia and Línea.

Well, what can we expect from a country where the authorities are unable to write properly in their language?

January 13, 2008

Mapa de mi barrio

Este es el mapa del barrio donde crecí y viví hasta los 18 años.


Ver mapa más grande

January 12, 2008

¿Cuántos cubanos hacen falta?

Mi esposa y yo íbamos caminando por 1ra Avenida desde Varadero hacia Santa Marta rumbo a la casa de mi hermana cuando mi esposa divisó un grupo de personas al otro lado de la calle y recordó un chiste que yo muchas veces he mencionado: "¿Sabes cuántos cubanos son necesarios para...?" Mira la foto y verás.

¿Cuántos cubanos se necesitan para cambiar unas tejas?
Siete.

Uno para que cambie las tejas y los demás seis se quedan abajo hablando kk y diciendo que las mejores tejas del mundo son las que se fabrican en Cuba.

Jóvenes sin moral

En la tarde del 23 de diciembre de 2007 mi padre, mi cuñado y yo asistimos al estadio Julio César Sandino de Santa Clara para presenciar el choque entre los equipos de Villa Clara y Santiago de Cuba.
Muy buen juego donde hubo derroche de todo por parte de ambos contrincantes. Fue un vedadero placer, después de más de 20 años, el poder volver a ver un partido de béisbol en vivo donde participaba la novena naranja dirigida por el legendario Víctor Mesa. Lamentablemente esa tarde los villareños cargaron con la derrota con un resultado de 6 carreras por 5.

No fue eso, sin embargo, lo que más me impactó en ese juego.
Por las gradas del estadio se paseaban, de un lado a otro, jovencitas de unos 12 ó 13 años y tal parecía que no habían ido allí para disfrutar del evento. También había un grupo de muchachuelos de igual o menor edad que, cada vez que las jóvenes pasaban, las tocaban por las nalgas y a veces hasta les pegaban. Yo los dejé pasar una y dos veces, oyendo con dolor en el alma, cómo unos adultos sentados detrás de mí reían a carcajadas disfrutando del atrevimiento de los "valientes" muchachos.
Lo comenté con mi padre antes de intervenir y me sorprendió que me recomendara que "no me metiera en eso". Quizá mi padre eso lo vea con sus ojos acostumbrados a la sociedad machista donde él nació, creció y ya va envejeciendo. Tampoco quería mi viejo que yo fuera a buscarme un problema con los padres de los chicos. De todas maneras, yo vivo fuera de Cuba desde 1988, y desconozco ya algunos de los códigos de la sociedad cubana.
Hablé con mi cuñado para ponerlo al tanto de la situación que podría avecinarse. Tampoco me recomendó que actuara pero yo quería tener un backup.

Unas muchachas pasaron una tercera vez y fueron objeto de acoso nuevamente por parte de los chicuelos. Mi primer ataque fue dirigido contra los adultos que reían detrás de mí. Les pregunté que dónde estaba lo cómico de las escenas. Que si ellos consideraban que avalar actitudes como esas era digno y qué valores les enseñaban a esos chicos. Me extendí a la escuela y a la sociedad en general, hablando en voz alta para que muchos me escucharan. Para mi sorpresa, se retractaron y reconocieron el grave error que habían cometido.
Acto seguido me dirigí a los jovencitos. Les dije que eso que ellos hacían era una falta de respeto muy grave hacia las muchachas. Que toda persona, si quiere ser respetada, debe respetar primeramente y, si ellas no lo habían solicitado, no debían ser tocadas ni por las nalgas ni por ninguna parte. Eso es acoso sexual en Cuba y en todo el planeta.

El gobierno debería priorizar la educación moral de los niños antes de llenarles la cabeza de veneno político. De la educación de los niños de hoy depende la sociedad que tendremos mañana.

Sea Turtle saved

On January 9th, 2008 I and my family arrived to Stockholm from our one month long vacation in Cuba.

I was very pleased to see my parents, sister and other relatives and friends once again. And once again I could see that the Cuban government is moving: one step forward and two backward. Very sadly!

On December 15th, 2007, in Varadero, I was walking on the north side of the Hicacos Peninsula when I saw a fisherman holding a Sea Turtle.
I know that these beautiful animals often are captured and killed to be sold as dacorative objects. For that reason I decided to take the turtle from the fisherman and for that I paid 10 euros. After that, I released the turtle on the South side of the peninsula, near the Varadero Golf Club.

I hope the turtle will have a long and prosper life!