09.24.06

Marshalling class

Based on the xds xdr serialization lib, I have implemented a type-safe, exception-safe marshalling class with full c++ semantics, that also does strings and vectors. It can be easily extended to other stl containers. If you see the code and can give some comments, let me know. It's very straightforward to use, for example:

vector<uint8_t> buff;
Marshall m(&buff);
float f;
double d;
int64_t i64;
vector vd;

m << f << d << i64 << vd;  // marshall data into buff
m.resetpos();
m >> f >> d >> i64 >> vd;  // read data into variables

The point is that is simple and easy to use, and the destination buffer can be used to read and write to with systemcalls by using &buff[0], as vectors are contiguous in memory. I have checked it for leaks with valgrind, and it has BSD license.

| Posted in computers | No Comments »
09.21.06

Coding carefully

Coding with the xds serialization library, I faced a problem. It has two buffer modes: GIFT and LOAN. In one you give it a buffer allocated by you to the lib, and in the other the library owns the buffer. Also there are the octecstream and string encoding functions that use malloc to allocate placement in the buffer. I think this is somewhat evil, from a C++ perspective, since opens the doors to memory leaks, through exceptions. When you get used to the C++ coding paradigm is really painful to have situations like this one. I think I'll solve it by avoiding calls to those functions that allocate memory on the heap. In cases where a function needs to allocate data I think the safest choice is to pass a vector or an string by reference, so you are protected against memory leaks by their respective destructors. Is there a better solution?

| Posted in computers | No Comments »
09.20.06

Making income with open source software

There's an interesting guide about making income with open source software made by the damnsmalllinux ppl. With adsense ads in the middle of the pages, as the guide proposes to do. Also interesting is the "passive vs active" income.

09.20.06

Thumbs up for OSSP xds serialization engine

After having looked for marshalling posibilities for c++ that were too complicated, difficult to audit their code, etc. I have found something interesting: OSSP xds serialization engine. I have thoroughly reviewed most of the code, it looks very very nice, and carefully coded. I think it must be one of the fastest implementations possible and has BSD like license. If you go through the floating point code to verify possible rounding errors let me know. I'm going to use it in my projects. OSSP xds serialization engine page.

| Posted in computers | No Comments »
09.12.06

Quick impressions of Madrid

Food was in general, at least cheaper and at most better than in Barcelona. This time there weren't any violent incidents. Although Madrid is huge, seems to be more gardens and parks than in Barcelona, so in my opinion doesn't feel so closed. A lot of inmigration has configured a very diverse city. I see it more similar to London than to Bcn. Gran Vía, for example reminded me of picadilli circus etc. Didn't have the chance to talk to many different people though. I came back in the AVE. Very fast, from Mad to Huesca in 2:20 h. Sometimes it bounces from side to side, as if the curvature of the railway was not smooth enough. But it's quite confortable. Unfortunately it costs 47€.

| Posted in social | No Comments »