g++ -Weffc++

from man g++

-Weffc++ (C++ only)
Warn about violations of the following style guidelines from Scott
Meyers' Effective C++ book:

* Item 11: Define a copy constructor and an assignment operator
for classes with dynamically allocated memory.

* Item 12: Prefer initialization to assignment in constructors.

* Item 14: Make destructors virtual in base classes.

* Item 15: Have "operator=" return a reference to *this.

* Item 23: Don't try to return a reference when you must return
an object.

Also warn about violations of the following style guidelines from
Scott Meyers' More Effective C++ book:

* Item 6: Distinguish between prefix and postfix forms of incre-
ment and decrement operators.

* Item 7: Never overload "&&", "||", or ",".

When selecting this option, be aware that the standard library
headers do not obey all of these guidelines; use grep -v to filter
out those warnings.

Ai revision

As I am preparing for my last exam I came across this. It is a table of what we say and what we mean. Quite interresting if you ask me.


The project I have been working on for the last few days is in beta1. It is a little C++ program that takes in an isbn and prints out a book reference. It takes the data from Amazon. You can use this for your papers if you don't want to type in all the book data. Have a look at


I am planning of making a windows version soon. If I can figure out cygwin.

The only interresting slide in 7 Lectures

I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg.
The phaonmneel pewor of the hmuan mnid.
Aoccdrnig to a rscheearcr at Cmagbride Uinervtisy, it deosn't mttaer in waht oredr the ltteers of a wrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be in the rghit pclae.
The rset can be a taotl mses and you can sitll raed it wouthit a porbelm.
Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istleft, but the wrod as a wlohe.
Amzanig eh?
And I awlyas tohuhgt slpelnig was ipmorantt!


I have been looking into some XML parsers for my little dbooks project. But to be honest they are all shit. Xerces is just too big. I really don't need DTD's for a little XML file. Then you have the little ones like TinyXML that has the right idea but how it is done is simply dreadfull. Some others parsers are libxml++ which uses gtkmm so I need to ship gnome with a 24K program, brilliant. And if you have a '£' in your XML you get a:
terminate called after throwing an instance of 'Glib::ConvertError'
Why isn't there a little cpp file I can include, pass it a string or char* and give it the node I want and it will retrurn me a string vector or char array[]* of the values. Something like

parse(string xmlStuff);

This would make my life so much easier.

Professional C++ Programming (Programmer to Programmer)

I bought the book because I liked the style and that the basic concepts are covered so early in the beginning. (First 50 Pages). I hate books that have 500 pages about an if statement.
This is not a book for beginners, hence the title.
If you want to profit from it you should have advanced knowledge in C++ or another oo programming language. I would not advise it as book to learn C++ or oop even if you know c. Further you will not be able to use it as a reference for libraries. But if you know C++ a little and want to take it to the next step, this book will teach you how to do it properly and keep you interested throughout.

C++ isbn validator

This is a little C++ function/method I wrote to validate ISBN 10 numbers. It takes in a string without '-' or ' ' and returns true if valid and false if not. Only replace the [REPLACE] tag with your class name and off you go. Is not the quickest way to do it, but it is easy to understand and KISS is what we all whant isn't it.

 1:   /**
2: Checks if the isbn is valid
3: */

4: bool [REPLACE]::isbnOk(std::string isbnToTest){
6: /*The multiplyer */
7: int multy = 10;
9: int sum = 0;
11: int checkSum = 0;
13: /* Will work only for ISBN 10 */
14: if(isbnToTest.size() != 10){
15: std::cout << "ISBN wrong size only isbn 10" << std::endl;
16: return false;
17: }
19: for(int i = 0; i < 9; i++){
20: /* Because atio thinks it is a pointer to an array it
will shoot off into memory. So if you want to convert
a single char into an int don't use atoi. IMPORTANT*/

23: int atoiIsGay = isbnToTest[i] - '0';
24: sum = sum + (atoiIsGay * multy);
25: multy--;
26: }
28: checkSum = (11 - (sum % 11));
30: if(checkSum == 10 && isbnToTest[9]=='X')
31: return true;
33: if(checkSum == (isbnToTest[9] - '0'))
34: return true;
36: return false;
37: }

And the clean isbn method to get rid off all the stuff we don't want

 1:   /**
2: Cleans out the isbn, Removes spaces and stuff
3: */

4: std::string [REPLACE]::cleanIsbn(std::string dirtyIsbn){
5: std::string outPutBuffer = "";
7: for (unsigned int i =0; i < dirtyIsbn.size(); i++){
8: if((dirtyIsbn[i] != '-') && (dirtyIsbn[i] != ' ')){
9: outPutBuffer += dirtyIsbn[i] ;
10: }
11: }
12: return outPutBuffer;
13: }

Broken Hard dirve

Ok edd is positive that I can sell a broken hard drive for about 5 Pounds on eBay. Lets see
Apparently they use the platines. I will post for how much it sold.
Now I am 0.24 Pounds minus because of eBay costs.

C++ curl wrapper

I am spending some time writing a little app to index all of my books. As I am getting the data from amazon I needed a little curl wrapper for C++. As the libcurl or curl man page and the online resources take some time to look through here it is.
You just give it a URL and the class will return a string with the content of the URL or NULL if a error accrued. This can be saved into a file. For example to download a image.

Don't forget to add LDFLAGS=`curl-config --libs` in your Makefile

The .h file

1: /*
2: * DBook : Didi's book system
3: *
4: * $Id: GetDataCurl.h,v 1.1 2007/04/22 23:57:17 didi Exp $
5: *
6: * This class is used to download a webpage with curl
7: *
8: */

10: #include <string>
11: #include <iostream>
12: #include "curl/curl.h"
14: namespace dbook{
16: class GetDataCurl{
18: public:
19: std::string getDataFromWeb(std::string theUrl);
21: private:
22: char bufferError[CURL_ERROR_SIZE];
23: std::string outputBuffer;
25: /* The curl thing */
26: /* Has to be static because c doesn't understand C++ */
27: static int curlWriter
char *data, size_t size, size_t nmemb, std::string *outputBuffer);
28: };
29: }

And the .cpp File

1: /*
2: * DBook : Didi's book system
3: *
4: * $Id: GetDataCurl.cpp,v 1.1 2007/04/22 23:57:17 didi Exp $
5: *
6: * This is the main class for getting data from a http server
7: *
8: */

11: #include <string>
12: #include <iostream>
13: #include "curl/curl.h"
15: #include "GetDataCurl.h"
16: #include <errno.h>
18: namespace dbook{
20: std::string GetDataCurl::getDataFromWeb(std::string theUrl){
22: CURL *curl;
23: CURLcode result;
25: /* Init */
26: curl = curl_easy_init();
28: if (curl){
29: /* set up some stuff */
30: curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, bufferError);
31: curl_easy_setopt(curl, CURLOPT_URL, theUrl.c_str() );
32: curl_easy_setopt(curl, CURLOPT_HEADER, 0);
33: curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
34: curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlWriter);
35: curl_easy_setopt(curl, CURLOPT_WRITEDATA, &outputBuffer);
37: result = curl_easy_perform(curl);
39: /* Clean*/
40: curl_easy_cleanup(curl);
43: if (result == CURLE_OK){
44: return outputBuffer;
45: }else{
46: /* Something whent wront trying to download the page */
47: std::cerr << "Error: " << bufferError << std::endl;
48: return NULL;
49: }
50: }else{
51: /* Something whent wrong while trying to init curl */
52: perror("curl_easy_init failed");
53: return NULL;
54: }
56: }
59: /* The curl thing */
60: int GetDataCurl::curlWriter
char *data, size_t size, size_t nmemb, std::string *outputBuffer){
61: /* Check for errors */
62: if (outputBuffer != NULL){
63: outputBuffer->append(data, size * nmemb);
64: }
65: return (size * nmemb);
67: }
69: }

IE 7

I just implemented https at work and created my own Certificate for this. This is OK as the site is only internal and I just want the connection to be encrypted because all the accounting stuff and so on. After about 5 minutes later, I get a worried call from my boss telling me that the page " may indicate an attempt to fool you or intercept any data you send to the server". Have a look at the screen IE7 presents you when you don't have a certificate by a trusted certificate authority.

Why would you write such a horrible text. This is totally confusing. If someone actually cares about security he is punished by stuff like this. How can Microsoft claim to enhance security with IE7.
A further remark to the IE developers. When you do Anti-Aliasing do it properly. The text is so blurred it hurts your Eyes to read anything. This has given me the last push to migrate everything to FireFox. At least there the message is informative and there is a way to view the certificate so a user can make up his own mind and is not influenced through stupid little icons.

My Gf about computing

Hello I am ****
I am 21 Years old and love my Computer. His name is Erwin. We haven't been best friends for that long, but we get on really well. Today for example he told me about when he went to computing school and learnt German, English and some other spell checking languages. Further the told me about when he learnt about how to draw a straight line.
But sometimes Erwin has naughty thoughts and he shows little pictures of male and female jumping around on each other. But this only happens when you touch him in a special way. At the end of the day Erwin is just a little computer boy.

TeXLive Packages for OpenBSD

My friend edd just finished porting TeXLive to OpenBSD. He put in a whole lot of effort and I just wanted to link to it

So if you use OpenBsd have a look at it