Origami butterfly

  • Model: Robert J. Lang’s Butterfly
  • Folded by: Rafał Cieślak
  • Paper size: 36cm (14″) square sheet
  • Model size: 15cm (6″) wing span
  • Paper type: Waxed-tissue-foil¹
  • Folding time: ~5h

Butterfly   Butterfly

Butterfly   Butterfly Read the rest of this entry »

C++11: std::threads managed by a designated class

Recently I have noticed an unobvious problem that may appear when using std::threads as class fields. I believe it is more than likely to meet if one is not careful enough when implementing C++ classes, due to it’s tricky nature. Also, its solution provides an elegant example of what has to be considered when working with threads in object-oriented C++, therefore I decided to share it.

Consider a scenario where we would like to implement a class that represents a particular thread activity. We would like it to:

  • start a new thread it manages when an instance is constructed
  • stop it when it is destructed

I will present the obvious implementation, explain the problem with it, and describe how to deal with it.

Read the rest of this entry »

A few drawings

I find drawing relaxing. Here are some images I recently draw using Inkscape:

blue1redcat1mamooth1Each took about 2-3 evenings to draw. They work pretty well as wallpapers, hi-res versions can be downloaded by clicking on an image.

I do not have much spare time on evenings, so it is rare for me to spend them drawing animals. I do, however, enjoy the results a lot. Vector graphics are fun!

Programowanie zespołowe na wakacje

Picture taken from yugioh.wikia.com, where it was published under the terms of the CC-BY-SA license.

tl;dr: Szukam niezaawansowanych informatyków zainteresowanych zdobywaniem doświadczenia, chętnych do dobrowolnego programowania w prowadzonym przeze mnie zespole w trakcie wakacji, oferując ze swojej strony potrzebne szkolenia i szeroko pojętą pomoc.

UPDATE: Zainteresowanie projektem okazało się większe, niż się spodziewałem; w ciągu kilka dni udało się skompletować całkiem rozsądną 7-osobową ekipę. Ze względu na moje ograniczone możliwości, nie jestem w stanie przyjąć więcej osób.

Wysoka temperatura, koniec sesji, przesilenie letnie, różne są oznaki nadchodzących wakacji. Dla mnie wakacje to przede wszystkim spora ilość czasu wolnego. Mam w zwyczaju poświęcać ten czas nie tylko na coroczny wypoczynek, ale też by we własnym zakresie poszerzać umiejętności, zgodnie z zainteresowaniami.

W praktyce oznacza to, że w wakacje dużo programuję dla własnej przyjemności. Czasem są to rzeczy pożyteczne światu, czasem jest to eksperymentowanie z różnymi technologiami; czasami piszę samotnie, czasami w zespole. W każdym przypadku wiąże się to ze zdobywaniem doświadczenia.

Read the rest of this entry »

Dynamic linker tricks: Using LD_PRELOAD to cheat, inject features and investigate programs

This post assumes some basic C skills.

Linux puts you in full control. This is not always seen from everyone’s perspective, but a power user loves to be in control. I’m going to show you a basic trick that lets you heavily influence the behavior of most applications, which is not only fun, but also, at times, useful.

A motivational example

Let us begin with a simple example. Fun first, science later.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(){
  srand(time(NULL));
  int i = 10;
  while(i--) printf("%d\n",rand()%100);
  return 0;
}

Simple enough, I believe. I compiled it with no special flags, just

gcc random_num.c -o random_num

I hope the resulting output is obvious – ten randomly selected numbers 0-99, hopefully different each time you run this program.

Now let’s pretend we don’t really have the source of this executable. Either delete the source file, or move it somewhere – we won’t need it. We will significantly modify this programs behavior, yet without touching it’s source code nor recompiling it.

For this, lets create another simple C file:

int rand(){
    return 42; //the most random number in the universe
}

We’ll compile it into a shared library.

gcc -shared -fPIC unrandom.c -o unrandom.so

So what we have now is an application that outputs some random data, and a custom library, which implements the rand() function as a constant value of 42.  Now… just run random_num this way, and watch the result:

LD_PRELOAD=$PWD/unrandom.so ./random_nums

If you are lazy and did not do it yourself (and somehow fail to guess what might have happened), I’ll let you know – the output consists of ten 42′s.

Read the rest of this entry »

e4rat – decreasing bootup time on HDD drives

This time I will describe how to set up e4rat in order to speed your Ubuntu’s boot time. Let’s begin with some motivation: my netbook used to boot-up in ~40 seconds. Using e4rat, it takes ~10-15 seconds. Impressive, isn’t it? Let’s see how does this trick work, and I’ll teach you how to enable it on your machine.

Read the rest of this entry »

There is something wrong with the new UDS system.

When I read the news about Canonical’s decision to change the way Ubuntu Developer Summit (original announcement here) I was totally astonished. I expected this change will cause a lot of buzz within the community, especially given the fact that all recent Canonical decisions are considered very controversial. This surprises me heavily, as I can spot a big number of problems that this decision may cause, as well as problems with the way this decision itself was handled. Jono Bacon’s article explaining the decision did not satisfy me either. It explains the general reasoning behind this idea, but it does not clarify everything.

Read the rest of this entry »

Follow

Get every new post delivered to your Inbox.