Posts

Back to C: CMake and CUnit

I'm back at programming in C. I proposed something 8 months ago at work that was totally ignore. Now my boss wants me to do it because the other alternatives have totally failed. The idea is to implement an ODBC Driver. If I have the time I'll put a tutorial here on how to do that on Linux. But back to the point of this entry. This small guide will help you create a simple project using CMake to build it and cunit to test it. Yes, I believe in test driven development, no matter the language. Let's imagine a simple project that produces an executable that prints the result of 2 + 3 (I know, lame but sufficient for this example). To make it easier to test I split the application. The functions will go into a library and there will be a source file that starts the program. The library header file is called "lib.h" (extra points for originality). Here are its contents: int add(int a, int b) ; The implementation is on the lib.c file as follows: int add(int a, int b)...

LOL - "Server Too Busy"

Image
This just happened to me today. What is more interesting is that this is an unhandled exception. So, the server being to busy is not something that they should predict and allow the application to handle, they just make you wait and then throw this at you. Don't you just love these products.

The Plan

It has been some time since I last posted here but I cam across this gem that I had to share. The tile is " The Plan ": In the beginning was The Plan. And then came The Assumptions. And The Assumptions were without form. And The Plan was without substance. And a terrible darkness fell upon the face of the Workers. And they spoke among themselves, saying "It is a crock of shit, and it stinks." And the Workers went unto their Supervisors and said loudly "It is a bucket of dung, and we cannot live with the smell." Whereupon the Supervisors went unto their Managers and didst say "It is a container of excrement, and it is very strong, such that none may abide by it." The Managers went quickly up into the temple and seeing there the Directors of the company, went unto them, saying in pious voices "It is a vessel of fertiliser, and none may abide its strength." After much feasting and lewd revellry, the Directors spoke among themselves, saying...

Helping out OpenStreeMap

It has been a while since I have last posted but I hope to do it more often. Don't ask me why. I guess that if you are in the bottom you loose all will to do anything. But a two weeks vacation and a few changes in both my personal and professional life and I'm starting to see the light at the end of tunnel. But that is enough drama, on to the goal of this entry. I made my very first contribution to the OpenStreetMap . Think of it like a Wiki that is a map of the whole world. Since my country doesn't have a nice coverage I decided to hack my GPS to track my trips and share them. Then I edited my first roads (two fully and a part of one) and they are already appearing on the site. Next step is to add more roads. Want to help out? You don't even have to edit the roads. Just trace your trips and upload them they will help others since the more information the more accurate the map will be.

A Small Surgery

There are moments in your life when your health throws a curve ball at you. It happened to me several years ago and the end result is now on display . I'm at home, recovering from a surgery. I've been at home for almost 4 weeks and I still have at least 2 more to go before I'm considered able to go to back to work. Although the surgery was nothing too complicated this is my second day almost completely out of bed. I'm now able to sit for small burst of time. For the rest of the time I either stand up and walk or I simply go back to bed. I'm lucky. The day after my surgery, the doctor talked to me. I said it clearly: "Only 50 to 60% of these cases don't recover like we would like them to. When they don't recover in the 2 to 3 weeks like we like them to, then the scale is in the order of months. Minimum 2 to 3 months." That scared my, but I was confident because the doctor said that "90% of the success depends on the patient. If you stick to a f...

A Diet

Image
I always intended to write about this subject a while back but never got the change to actually sit and write about it. I think this is the time, so if you're looking for a technical or management related blog entry simply skip this one. Eight months ago I started a diet. I was a "little" overweight and always postponing the task of getting back into shape. I was unable to postpone this any time longer because of my mother. Some times in your life you need a little push in the right direction. This push can come from many sides. It can be an event that occurred to you. It can simply be a loved one or a friend that has a talk with you. In my case it was my mother actually scheduling an appointment with a nutritionist. My excuse for not caring about my weight was always that I would first go to a doctor, a nutritionist, before embarking on a diet. Well, my mother took the next step and actually scheduled the appointment and the necessary blood analysis that I had to ...

"Moving Out"

It has been a while since I posted anything on the blog. I've been keeping the shared items going because they are part of my daily reads, but nothing regarding the blog itself. There are many reasons for this but on of them is that I have "moved out" of my parents house. I say "moved out" between quotes because I always go to my parents house on the weekends, but during the week I'm alone on a rented apartment. Why rent an apartment? Because I was tired of not having any time for myself. With the relocation of my workplace I ended up doing 1 hour drives each way to go to work. This meant 10 hours each week. This had a penalty in my life, not only on my health. My day was fully filled without any time to just breath. Now I live a 10 minute walk from my work. Sufficiently far to refuse to go their if they call me, but close enough to walk and leave the car parked all week long... except when I go windsurfing... The end result of all this is that I expect to p...

So much to do and so little time...

It is true: life can throw you a curve when you least expect it. I have some many reasons to blog about but I haven't found the time to get down and actually write anything. What has happened in my left? A lot... Lets see if I can make a short list of the most important things: I lost over 20Kg of weight (and got back up to shape by actually running over 6km every day); I've made a web site for my family's company (that is online and working without a hitch for a couple of weeks now); I've managed to get Gentoo running on an External USB hard drive so I can use the dead weight computer that the company I work for assigned to me while traveling to work on my things (yes, because that thing must have M$ Win...); I've been promoted; I've shown the guys in my company that simply saying it is impossible and giving up is not the answer; and a lot more... Should I talk about it all??? Well, the Linux part I'll leave for another entry because I want to put up the in...

Replacing a Bad Inverter on a Toshiba Laptop...

Image
The year has just begun and my laptop decided to bork. It already borked some time ago. The problem was the backlight: it started blinking and the laptop would go to sleep. I search the web and found this blog . I tried to figure out if this was the problem with my laptop, but I was almost sure it wasn't, because even if I connected an external monitor Linux kept receiving spurious lid close events. It turned out to be the board that had the lid closing button. The trick was to find the parts, but I was lucky enough. I called my old boss, who also bought the same laptop as I did and asked her what happened. Well, it turns out that the laptop was going for recycling. Not a moment too late! I asked for it, she gave it to me for free (thank you!!!) and I repaired my laptop using the board of her laptop - which seems to have a broken video card... Today the backlight finally hit the fan. I had been noticing some flickering of the backlight for some days but I completely ignored it and ...

New Year, New Adventures...

Welcome to 2008!!! I wish you all a good year filled with health and happiness for you and your family. And when I say "all" I actually mean "all", even those that consider themselves my enemies... When a new year comes along it is usually a time to think about what went well in the last year and what hasn't gone that well and to make some new year resolutions. If I believed in New Year resolutions mine would be to improve my health and fitness. Since I don't believe that making resolutions only once a year I won't make any... My vacations are practically over. I was finally allowed to take a vacations. I said allowed because I actually had to site laws to get them to approve my vacations, but it was worth it: I finally got some time to just recharge my batteries, you know, sleep 11 hours per day, read a book and basically do nothing... Work will start next week and I think it is time to scare the crap out of them. I believe I should be professional to...

Finally on Vacations!!!

So, I'm finally on my vacations. I had to cite law articles to get some vacation time, but I'm finally at home, resting and recharging my batteries. I have some things to do, but things that are fun to do!!! And it was the right time to go on vacations: my mood wasn't all that good, in fact, nobody could hear another one of my comments about how things are all wrong; my car needs to go to the garage (they are able to squeeze it this week); I need to by some clothes; I need to check out some swimming pools and I need to find a new house. Many things to do while I'm on my vacations, but the one that I'm also doing is a Web Site for my family's company. It will be a simple Apache, PHP and MySQL site. What I really wanted was to make a full blow JEE5 Site, all Web 3.0 and so on. Facts are that they don't need all that bloat: they need a simple, clean and fast site. Taking into consideration the hosting costs and everything, PHP seems to be the way to go. I'l...

Creative Commons!

Today I can't help to blog about something I stumbled upon in the Web. I don't know if you haver heard about the Creative Commons initiative. If you didn't brace yourself for a trip to the world of freedom of expression and though!!! Whenever you have an idea and implement it, the idea is automatically copyrighted. This is specifically true for Music, Pictures, Films, Books and son on. The problem nowadays is that this rights are being enforce to a level that is so extreme that our children are being forced in to pirates. They are being forced into believe that copyright should exist. My humble opinion is that copyright does and should exist. But common sense should guide on what is breaking a copyright. If I'm copying a music without paying for it and redistributing it to the whole world, free of charge or not, I'm breaking a copyright. I don't think I'm breaking a copyright when I use a peace of a music, mix it with video and share it with my friends. Th...

Swing Tip: Heavy Paint Job...

Have you ever needed to make some heavy 2D rendering operation in Swing and you didn't want to block the Swing Thread? Well, I had to, several times and today I made a hack for a colleague that I would like to built upon here. My first attempt to ensure that the Swing Thread wasn't blocked was to conduct all rendering on a background thread. This obviously violated all Swing and Java2D principles. If you don't know, just Google for it, but the fact is that all rendering should be done by the Event Dispatch Thread. So, all Swing activities should also be done in that same thread. What happens if the scene you are rendering is rather complex and you don't want to hog the Even Dispatch Thread? A simple technique can be applied. The idea is to hold the context when the rendering is started. If the rendering has been going for quite some time, place an event in the Event Queue to resume it later. This allows the Event Dispatch Thread to process other events. When the renderi...

Updating my Six Year Old Laptop

Today I finally finished the update on my six year old laptop. I know it sounds crazy, but I bough a laptop back in end of 2001 and I still haven't replaced it. I put linux into it and never looked back Started with Mandrake at the time, I then made the switch to Gentoo. Since then I have always updated my system without any format like you have to do on other operating systems. I was unable to connect it to the internet for a while. This lead to a very outdated operating system. Luckily Gentoo is almost straight forward to update. The only problem is that my desktop environment is eating a little too much memory for my taste. I guess I'll need to tackle it later. On my project list is an idea to make a 3D chart on top of Java 2D. Why? Well, I already made such a chart for the company I work for, but at that time I used Java 3D. Now, there is nothing seriously wrong with Java 3D itself. Let me make it clear that it is very nice API. But to do a chart in Java 3D is an overkill. ...

WebBeans and others...

It has been some time since I blogged. I hope to do this more often. You see, I lost the internet connection in my Linux Laptop. Why? Well, my ISP decided to change its settings and didn't tell no one about it. It worked on Windows, but my laptop hasn't run Windows for over 4 years. I though it was a problem with the modem, or my configuration. I ended up buying a new modem/router. It still didn't work so I called technical support and then they told me the options that you have to use when you're not using their own modems. Why? Well, their modems have their hidden configuration options hardwired... but on to more interesting things. I came across a series of articles about Web Beans. I don't know if you know about JEE (yes, since version 5 it is JEE - Java Enterprise Edition, not J2EE) but I had a training on this subject and I liked the way they used annotations and other techniques to turn a bloated platform into a clean and simple programming model. But their e...

I'm Still Alive!!!

No, I haven't disappeared from the face of the earth. At least no yet! What happened was a drastic change in my life that led me to stop blogging about anything. Today I decided to put this small entry just to say that I'm still alive. I'm finally having some time off work to recharge batteries and get my life back together. I also hope this extra time allows me to post more things here. I have a couple of tutorials lined up. The first should be about WebServices in Java: how to call or build your one WebService following a predefined WSDL without using any libraries but the standard ones included in the Java Runtime Environment. So keep reading...

News Update...

It has been a long time since I last blogged. The reasons are many, but lets just say that things have been a little chaotic. It seems that everything has landed on top of my head: work, thesis, health, you name it... Although it might seem that I'm just ranting for nothing, lets take a look at a few examples. First I had to make a presentation to the President of the Republic. Yes, I live in a republic and we have a president. I was chosen by my former chief and the current chief to make this presentation. A 5 minute presentation that should pass the concept of the product, including a live demo of the software. In other words: you have 5 minutes to either excel at it, or be marked for the rest of your life for the worst reasons. Why do I say this? Well, all the public TV channels were there, including some private. Newspaper reports, radio reports, you name it. I even ended up with my face and my back in the public television!!! My parents were so proud ;-) On that same week I ha...

The Building, Life and the Laptop...

It is funny how things turn out some times. No matter how many plans you make, destiny will always throw a curve ball at you. You may plan it all out: what to do, when to do it, even how to do it. But the fact is that when you try to actually do it, things will blow up in your face. The last entry I made in this blog was about the building I'm currently working on. Funny thing is that it has been over a month since I blogged and the building is still under constructions. But since someone very important, like the President, is coming for the official opening the work has suddenly switched into Warp 5 Speed. You have painters working side by side with welders; technicians configuring the elevator; technicians testing the air conditioning and more. The end result is that nobody can actually get any work done in the mist of all the noise and smell of paint. On top of that the building still has no full electrical power. We didn't work for a whole morning so the power company could...

A Goodbye...

Today was my last day at my current working location. It is strange to leave a place where I have worked for 7 years and 15 days exactly. I'm not leaving the company, but the place, the friends from other departments that are staying. I will miss specially the ladies, since in our new location there won't be a single lady in the floor I'll be working: just men. I usually say that if you put too many men engineers in the same place without a single women things fall apart. I say this because the conversation level degrades... A women would make all the men automatically be more self-conscious and avoid having conversations in slang or anything worse. To all those that stay in the old location I wish the best of luck and happiness with their lives. For all those that like me will be pursuing a new adventure I wish also the best luck and happiness. For those that have left or will leave I want to say this: I understand and although I'll miss you, as friend I have to tell y...

Accepting an Offer...

This was a different week. The company I work for is moving locations and I considered their offer unacceptable. Well, they made another offer and I decided to accept it. Although I feel like I sold myself, I can't stop and think that I'm still taking a huge risk. Part of what was proposed to me still hasn't been confirmed and three years from know I'll probably be loosing money if I continue in the company. I'm still thinking if I should sign the agreement without having this confirmation. It makes the risk even greater. But with that fact aside and if things go according to the plan I'll start working on the new location next Friday. I honestly believe that things won't go according to the plan because it involves changing 80 persons from 4 different locations to a new building that is from 4 to 250Km where those persons currently work. It involves changing people's machines, bindings, pencils, lab machines that are almost never turned off, the UPS, p...