Prime numbers less than 100

Posted by Michał ‘mina86’ Nazarewicz on 12th of December 2010

Anyone working in a major company must have been hit by some ‘funny’ mail from a coworker that helps everyone gets through the day. No different at my office — at one point all engineers have been challenged to write the shortest code in C that prints all prime numbers (and only prime numbers) less than a hundred each on separate line.

This is an interesting brain-teaser so posting it here so others may choose to think about it while their code’s compiling.

Of course, a ‘C program’ needs not to be taken too seriously — depending on not too far fetched undefined behaviours of given implementation is all right (but please do not use system or exec family of calls; not that I can see how that would help).

By the way, if you’re interested in how this challenge looks solved in Rust, I’ve described that as well.

0 is ambiguous

Posted by Michał ‘mina86’ Nazarewicz on 24th of October 2010

It has been a long time since my last entry, so inspired by Adriaan de Groot’s entry, I decided to write something about 0, NULL and upcoming nullptr.

I will try to be informative and explain what the whole buzz is about and then give my opinion about nullptr. Let us first inspect how a null pointer can be donated in C and C++.

Synchronizacja w jądrze Linux

Posted by Michał ‘mina86’ Nazarewicz on 3rd of April 2010

Prezentacja z seminarium dyplomowego na temat mechanizmów synchronizacji w jądrze Linux. Pokrótce przedstawia bariery pamięci, zmienne atomowe, semafory, spinlocki itp.

Dni Wolnego Oprogramowania

Posted by Michał ‘mina86’ Nazarewicz on 25th of February 2010

UPDATE: Dni ciągle jeszcze trwają, acz moja prelekcja już się odbyła, w związku z czym umieszczam nowszą, a tym samym poprawioną wersję prezentacji wraz z pełnymi kodami źródłowymi.

Niektóry wiedzą, inni właśnie się dowiedzą, iż w przyszły piątek (5 marca) ruszają III Dni Wolnego Oprogramowania w Bielsku-Białej. Będę miał przyjemność nie tylko bycia na tej imprezie, ale również aktywnego uczestnictwa. Dla wszelkich osób zainteresowanych udostępniam wersję alfa prezentacji, którą będę przedstawiał. Po zakończeniu wystawię wersję finalną wraz ze wszystkimi kodami źródłowymi.

Python, wrażenia

Posted by Michał ‘mina86’ Nazarewicz on 31st of January 2010

Niedawno miałem okazję stworzyć trochę kodu w Pythonie. Popisałem sobie w nim kilka dni i muszę przyznać… język jest tragiczny, zastanowię się kilka razy zanim po raz kolejny go użyję.

Wpis ten dedykuję pewnej osobie, która ciągle mi przypomina, abym pisał nowe wpisy. :)

NTP over HTTP

Posted by Michał ‘mina86’ Nazarewicz on 16th of January 2010

Sitting in a dark office, after swearing for hours at ATI video cards I noticed time on my computer was incorrect. ‘No problem,’ I thought as I started typing ntpdate. That’s where it struck me that our beloved IT department had blocked most of the Internet. Checking the time on a watch or a mobile phone was not an option — I had neither — nor was looking at GKrellM on another PC — that’s lame.

‘I wish there was a NTP-over-HTTP protocol’ I sighed. And then I realised there was…