Category Archives: Programming

propertypp: Objective-C-like properties for C++ classes

The short version: propertypp on GitHub The long version: A co-worker recently told me he had made some member variables in a C++ class public, because a getter and setter for them would just do exactly the same thing as … Continue reading

Posted in C++, English, Programming, Projects | 1 Comment

Drawing scalable pixels in the Qt Graphics View framework

Say you have a custom QGraphicsItem that you would like to draw pixel by pixel, and want it to appear pixelated when that item is scaled (or the QGraphicsView it is being displayed on, or whatever). At first, you might … Continue reading

Posted in C++, English, Programming, Qt | Leave a comment

Fond Memories

When I was 9 years old, I used to go to my mom’s workplace to talk to some IT guys who were working there. Eventually, one of them started teaching me BASIC, getting me started into programming and fulfilling my … Continue reading

Posted in BASIC, English, Nerd, Personal, Programming | Leave a comment

Aligning text in QGraphicsTextItem

The Qt Graphics View Framework provides a rich set of resources to create applications with interactive graphics scenes that display arbitrary shapes, text and even Qt widgets. While the framework provides almost everything you need regarding interactivity, scene hierarchy management … Continue reading

Posted in C++, English, Programming, Qt, Tutorials | Leave a comment

Run time machine code generation and execution

Some Common Lisp implementations (and I believe other languages’ also, but I don’t know of any) are incremental compilers, which means they are able to read Lisp code during program execution, compile it and make it immediately available for execution, … Continue reading

Posted in C, English, Programming | Leave a comment

Solving linker errors OpenThreads/Atomic on OSG projects on Mac OS X 10.6

I’ve just spent two days trying to figure out what was wrong with an OSG application I was not being able to build on Mac OS X 10.6. After importing all necessary OSG frameworks, I kept constantly getting linker errors … Continue reading

Posted in English, Mac, OSG, Programming | 2 Comments

Building OpenCV 2.0 on Mac OS X 10.6

I first tried it this way: $ cd OpenCV-2.0.0 $ mkdir build $ cd build $ cmake .. $ make But it failed. I got lots of errors when trying to link highgui to the Carbon libraries. The problem is … Continue reading

Posted in English, Mac, OpenCV, Programming | 1 Comment

Why Lua’s 0 (zero) as a true value makes sense

When I started to learn about Lua, I found it a little odd that the numeric 0 (zero) value is treated as a true boolean value by the interpreter, which was different from all other programming languages I had worked … Continue reading

Posted in English, Lua, Programming | Leave a comment

Ternary operator in Python

Here’s how you translate the following C code int max(int a, int b) { return (a > b ? a : b); } to Python: def max(a, b): return a if a > b else b The general syntax is: … Continue reading

Posted in English, Programming, Python | Leave a comment

Using feof() and fread()

When reading single bytes from a file in C, one must pay attention to the correct usage of feof() and fread(). At first, the following piece of code seems to work correctly: const char *filename = "hello"; unsigned char byte; … Continue reading

Posted in C, English, Programming | 3 Comments