Thursday, December 22, 2005

merry Xmas and a happy new year

King Crimson "Eyes Wide Open" from "The Power To Believe"

Here it comes, here comes another day

Another decision on the way

Well here it comes, here comes a covered display

of preferences to make

Well here it comes, here comes a knock on the door

Open it for an opportunity

Well here it comes, here comes another day

for memories to be made

Eyes wide open

Eyes wide open all the time

'n there it was, it was a perfect take

and were you asleep or awake

There it was, it was a perfect time

to speak your mind

'n there it was, it was a chance of a lifetime

It flew right by and what did you do?

Well there it was, it was another day

for memories to be made

Eyes wide open

Eyes wide open all the time

I've got my eyes wide open

Eyes wide open all the time

Because you never know

what you might see...

Wednesday, September 28, 2005


During a software design I had to store a huge frame inside variables that were valid data that needed further processing . Instead of using a simple solution, which will be given next, I declared a bunch of variables to accomplish it. Suppose you have a frame:

void processFrame( unsigned char * uFrame )
/* copy it to several variables here */
memcpy( &myvar[0], &uFrame[0], 12 );

The above code will save the 12 bytes in a myvar variable. Suppose you have a huge list of bytes, instead of copying each one of them to variables, simply declare a struct to store everything.

struct MyStruct{
unsigned char a[12];
unsigned char b[2];
/* and it may go further*/
} myStructReal;

Next, just point to the first address of the structure and sum up the total of bytes:

memcpy( &myStructReal, &fFrame[0], totalofbytes);

Ok, you will have to be sure of how many bytes will come inside the data frame, but generally you know it. It is a major ellegant and simpler solution. As, C treats structures as a series of data addresses, it will fit your huge array of bytes into a struct, piece of cake right?

Thursday, September 15, 2005

They say that president Lula is stupid


I can acuse him of several faults, but most people mention that he´s not intelligent or that he does not speak portuguese properly. As a former PT and Lula supporter I can say that I read many Lula interviews and articles and also heard interviews given on TV and believe me, although he didn´t have formal education, the guy has a huge cultural knowledge.

However, it won´t take away all the accusations ....

Tuesday, September 13, 2005

Programmer or hobbyst?

I make a living programming embedded systems in C, could also program in C++ or programming PLCs or being an automation engineer. But, I consider programming a hobby also. For many years, Java was my hobby but I became disappointed with it because I thought I´d work with Java professionally. After sometime, I still find Java funny, although I bash it, and usefull for a certain usage but I got annoyed with Java programmers or J2EE programmers. So, as hobby I´ll use python, which I like a lot too.

Daily, ANSI C comes all the day. With some free time, it is python.

Wednesday, September 07, 2005


Forget anything I said about Java. I hate it ...

It does not mean that I will refuse to code Java. Java programmers are most of times too arrogant and produce a bunch of senseless terms and APIs.

Sunday, July 24, 2005

Why C/C++ lately?

Because I will start studying to get a certification in ANSI C/C++ and I want to throw it in the face of any asshole that asks me whether I have a certification or not.

A great C/C++ course comes from the professor

Rob Pooley

ANSI C course
ANSI C++ course

I will sell all my Java books too. Really.

Saturday, July 23, 2005

Haunted mistery room

When I was young, my uncle´s room had a dim light most of times. I tried to avoid going there because my uncle said "beware with all this!", but I always entered the room. Magic books, LPs, film posters , painting, comic books and miniatures filled the spaces.

I just ignored my fear and went there to check out the packages that carried out mistery. Horror books scared me, but they rocked the hell. Many LPs which I didn´t like at that time, now are favorites of mine like Yes, Peter Gabriel or Kate Bush albums. Those posters still live in my memory, altough I don´t know what my uncle did with them.

The room was full of sci-fi books -I became a fan of the genre before actually reading any book-. Asterix, Mafalda, Dune, Gentle Giant. When my uncle got a VCR, he connected the output to his stereo and that was a real new experience. The first time I saw Blade Runner was there at the room. I need to say that most of my hobbies came out from that room, or directly from my uncle. So, I don´t regret any single bit of don´t listening my uncle and going there inside the room, although I am totally sure that he knew that I spent hours and hours there.

To be honest, I have my own small room of misteries but it is both an attempt to make my uncle´s room and a palid version of the original one.

A superhero

I thought I should learn more o C++. To be honest, a lot of it just goes away as I don´t use it much..


Heh, loved this guy´s page, expecially Guru of the week...

Friday, July 22, 2005

An outstanding C++ Online course

So far, it is free. It covers the basics, intermediate and advanced C++ including a few GDI tips. It is actually great for reference and for STL and Data Structures learning, which I think my C++ book, Deitel & Deitel fails a little bit.

A great quick reference for C++:

I also like Thinking in C++ v1, although the abusive ammount of "tricky" literally self indulgement of the author ( like for ex, the main function evokes sensations of my old experiences of old memories yadda etc):

I keep a copy of the book on my palm top and read it eventually. Well, I like the Eckel´s style hehehe

Be aware that C++ or C tutorials that use void main() {//...} as the main function must be totally ignored as they are NOT ANSI C++ or ANSI C. In ANSI C if you ommit the function data return you are defaulting it to "int", not void. The compiler expects that you return a int within main, so if you ommit the return you are using the default.

By seeing that most people today LOVES java and the horrible J2EE I decided that I will hate JAVA heheheh
J/k but I won´t bother much with their specific APIs. I like it to exemplify OOP theory, and GOD, the Swimg API despite the obvious performance trouble, is excellent.

Thursday, June 09, 2005

Embedded Systems part 3

Given the current state of art of VHDL and FPGAs, I think that circuits and programs will walk around the networks. FPGAs are boards that can be programmed to emulate every digital circuit you can figure out. VHDL is how they are programmed.

If you can send a program over the net, by copying an instance of it in a given location, you can ask it to carry out a VHDL program, reach a particular target, access a FPGA board generate the circuit and next, ask the source to load theVHDL code.

Physical medium is most likely becoming optical or wireless, but to guys like me, it won´t matter. We will leave the information ready in bytes or whatever they will call it, so it reaches the physical medium and then gets broadcasted.

Embedded Systems part 2

Hardware and firmware are encapsulated to the programmer. OK, you could think that this is not TRUE programming, but remember digital circuits: you are not seeing all those C-MOS transistors that make all those gates that make all those latches and flip-flops.

The world is full of encapsulation.

Firmware should be written in C of course. Assembly might be used to, but in small bits. Not because I don´t like Assembly, because it is not readable, it is not easy to handle and maintain. Truth to be told, I mostly read the comments when I need to check out Assembly code rather than the code it self.

Suppose you write a program that reads temperature, pressure, and needs to generate an output for a electronic injection systems. In this case, using C is much better because all the code rely on low level.

Fun enough?

Embedded Systems part 1

Why using C? Is there anyone still using C? Surprisingly or not, most embeded programming done these days is written in C rather than C++ or Java. Well, I program embedded systems and I use C!!! heheheheh ;-)

Java has a trouble: you need a device that supports J2ME machines.
Not a big deal, as it is not impossible to create these machines as you may have seen in cell phones or PDAs.

Also, schools are still teaching C as an introduction to programming. If you want to write numerical methods and don´t want to bother using a pre-historical language like Fortran use C instead.

Anyways, the ANSI C standard is mandatory for C. Basically, you are required to use prototypes to every function, your main function explicitly returns a int, your functions have parameters inside it´s call ( for ex, f( int * a)).

Why not C++ ? It can be very complex if you want to make it complex. Try to read code with templates,operator overloading, it´s a pain. Not that these features are useless, on contrary, they are mandatory for good OOP design, but we end up with code that´s not easily read.

A note: Java 1.5 supports generics which are the Sun way for templates, but you these are not hard to read as C++ ones. If you are on embeded, avoid generics. Most of time you will deal with bytes, which are basically unsigned char types, and mostly certainly people will use your code.

Wednesday, June 01, 2005



I was wondering about Java and polymorphism. Actually, I am waiting for that the QA team to test my software so I can correct bugs and I was freaked out because I thought I could forget
OOP and Java so I thought I should try a little of it. :-)

I basically think of an abstract class A and derive B and C so I can have a 4th class that may use
any of the other 3 and I only write one implementation...

public abstract class A {

A( int a, int b ){};
public abstract void f1();

public class B extends A {

protected myC;

B( int a, int b, int c ){
super( a , b );
myC = c;

public void f2(){

public void f2b(){

public class C extends A {

protected String s;

C( int a, int b, String s ){
super( a , b );
this.s = s;

public void f2(){

public class D {

A aptr;

D( A a ){

// points to class A
// but knows which derived class it refers to
// because of the polymorphism
aptr = a;


void DoSomething(){


public class E{
public static void main( String[] args ){
B b = new b( 1 , 2 , 3 );
C c = new c( 1 , 2 , "asdasdd" );
D d1 = new D( b );
D d2 = new D( c );


Friday, May 20, 2005

Embbeded Systems


In the future the embed programming :

In the hardware side intel, ARM and Motorola uCs will have most of the market, while developers will use C and Java to program them. Whenever a J2ME machine can be executed, developers will use Java. It´s easy to understand why old developers migrate their applications to C instead of C++. Because you need to change a paradigm. Large C++ applications need UML analysis and design. Perhaps, for small applications C fits better, though devs should worry about modularization otherwise we tend to see non stable bizarre software.

It has grown the idea of template for large C applications so that the developer just customize the final product, not needing to bug off with setting memory and hardware parameters. The guys that made the hardware know it better than you and me, don´t you agree?

In the future, forget about COM and LPT1 ports, it will be most of it Ethernet and USB for local connections. Wireless, will come at hand too. You knew that , didn´t you?

The point, however, will be system interconnection. Say you have a system for PDA and most certainly you will need to connect it to a large data base system located in another type of
station. C++ has significant better performance than Java, so I think while Sun cannot make it
as fast as C++, C++ will stay on the top.

Tuesday, May 17, 2005



Sorry for the absense.. I´ve been consumed by job and family. Not that I complain ;-)

I have been studying UML ( very slowly ) as I think it is a great tool for describing a virtual
world or enviroment like the Matrix. Multithread and multitask have been constant to me.
But in pure C....

Music I have listened to: Meshuggah, Tool, Metallica, Bach, Satriani, Vai, Morse and many others.

Monday, March 14, 2005



I´ve been concentrating on playing bass and music theory. And I´ve been also diving down on thousands of lines of C code. I find it interesting that this code was legated from Assembly and it uses Assembly like routines, i.e. , most parameters are void and use global variables.

But it is ok, for a c++ guy like me, it is a matter of going backwards to C, which is very fun, since I love C.

I know C since 1995, so I may have be congratulated by 10 years
of knowing it..



Saturday, February 26, 2005

new job

Hey dear readers,

I got a new job, so I am not working for smar anymore thank God !!!!!

Now it's only C and assembly!

Friday, January 14, 2005

There's gotta be something wrong with Mordor

Or with me heheheh For years and years I complained about Windows until I touched WINDOWS 2000 and NT. I still do not agree with them, specially I hate the guy who's their CEO (he's not Bill Gates, just a marketing guy that was put as MS President) and all the marketing guys, but you have to admit their developers must be praised.

Read this:

Visual Studio 2005 Express Beta Products The Express products, expanding the Visual Studio product line to include lightweight, easy-to-use, easy-to-learn tools for hobbyists, enthusiasts, and novices who want to build dynamic Windows applications and Web sites.

Please read again the part in BOLD....

If you did not grasp it well, Mordor allows FREE downloads of Visual Studio 2005 Beta. I actually downloaded the C# and a new web programming tool and I am very praised with the result, but I think this has a lot to do with Anders Hejlsberg, who was the designer engineer of .NET and C#, who had brought to the programming world an OOP Visual Pascal version named Delphi. Mordor paid him a lot of money and Anders Hejlsberg came up with a new solution that's frankly awesome. Not just regarding programming web sites (now you won't need to use VB as it was required with ASP and you will be able to code in C#) or WINDOWS FORMS (they found a way to say goodbye to the MFC and API just adding a new layer to it named WINDOWS FORMS).

Wednesday, January 12, 2005

Serial COM in C#/ Image Processing

Image Processing in C#:

Image Processing for Dummies with C# and GDI+ (1) (2) (3) (4) (5) (6)

These are a series of articles written by Christian Graus

I read that Visual C#.NET 2005 will support a new Namespace named "SerialPort", so it looks like MS is more insterested in Serial COMs than SUN, who hasn't updated or given more details on their Serial COM API in years.

Wednesday, January 05, 2005

Conversion of Pressure Units in ASP.NET

By me.

Will Eisner

One of the greatest writers and artist of our time has passed away. Yesterday, the gothic sister has spread her wings to take the master away.

When he created Spirit most people compared his work to Orson Wells. To me, Eisner was much bigger than Wells. Very talented writer, he was the sort of guy who could use a few words to create an impact bigger than 1000 lines of verses. I am not a artist, but his black and white work has no paralel in the western civilization (I only rank with another master that has gone Goseki Goshima from LonlyWolf). I may have read "The Building" 10 times and "A Contract With God" was borrowed from a friend of mine. I don't get too affected when a celebrity dies, but the last flight of mr. Will Eisner was too much to know. It's weird that I forgot about it when I went back home yesterday, maybe because of my son, but today, reading online newspapers, I can only say have a good flight Master!

Monday, January 03, 2005

The tragedy in Asia


When I saw it I thought 3500 deaths were not too much, but with the days the number has grown, but I wasn't really thinking about it as something that was real. Then, I saw on TV about a village that was devastated by the waves. Nobody survived.

On September 11th, 3500 died. We blamed Bin Laden.

This time, we can't blame anyone except mother earth. There are no words to be said now. So, I think that at least a lot of people is helping. Yeah, this simple thought saved my day. Fuck man,
although we are animals that still kill each other daily, we still help people when we are in trouble and this is the best thing that can be taken out of this tragedy: we still care for the other person at our side.

I am trying my best to see this as a tragedy and not as something that has images that we gotta see.