Nick Geoghegan

Professional Yak Shaver

Category: Programming

PGI Compilers and CUDA 5

I’ve been using the PGI Compilers along with CUDA to do GPGPU development for some time. The compilers themselves are fantastic – OpenACC support, OpenMP support and loads of other cool things. Recently I upgraded to CUDA 5.0 and noticed that a number of programs now failed to compile, as the compiler wasn’t seeing CUDA 5 […]

Read More

Scarface as Code

#include #include void main(void){ int tonyMontana=0; char* get=”First”; char* then=”, then”; printf(“%s”,get); while (!strcmp(get,”women\n”)==0){ switch (tonyMontana){ case 1: get=”power”; printf(“%s”, then); break; case 2: get=”women\n”; printf(“%s”, then); break; default : get=”money”; break; } tonyMontana++; printf (” you get the %s”,get); } }

Read More

2012 Reading List

My reading list has really spiralled out of control lately, so this is a post to let you know what I’ll be reading for the rest of the year. Python Learning Python by Mark Lutz Programming Python by Mark Lutz Python Cookbook by Alex Martelli, Anna Ravenscroft and David Ascher Python in a Nutshell (In a Nutshell (O’Reilly)) […]

Read More

Inventing on Principle

Every aspect of your life is a choice. There are default choices: you can choose to sleepwalk through your life and accept the path that’s laid out for you. You can choose to accept the world as it is… but you don’t have to. If there is something in the world you feel is wrong, […]

Read More

The ‘Anti-Java’ Professor and the Jobless Programmers

James Maguire’s article raises some interesting questions as to why teaching Java to first year CS / IT students is a bad idea. The article mentions both Ada and Pascal – neither of which really “took off” outside of the States, with the former being used mainly by contractors of the US Dept. of Defense. This […]

Read More


A few things can confuse programming students, or new people to programming. One of these is abstraction. Wikipedia says: In computer science, abstraction is the process by which data and programs are defined with a representation similar to its meaning (semantics), while hiding away the implementation details. Abstraction tries to reduce and factor out details so that the programmer can focus on […]

Read More

Mutex vs. Semaphore

Back when I taught C programming labs, a student asked what was the difference between a Mutex and a Semaphore. My simple explination is below. Little did I know, Niclas Winquist came up with the same explanation in 2005. To me, this really is the best explanation for a non-technical audience. Mutex Mutex is also called “Mutual Exclusion”. […]

Read More


Programmers have a very precise understanding of truth. You can’t lie to a compiler. Try it sometime. Garbage in, garbage out. Booleans, the ones and zeros, trues and falses, make up the world programmers live in. That’s all there is! I think programming is deep, it teaches us about the non-cyber universe we live in. […]

Read More

C can be crazy

C can be crazy some times. #include void(*swap)() = (void(*)()) “\x8b\x44\x24\x04\x8b\x5c\x24\x08\x8b\x00\x8b\x1b\x31\xc3\x31\xd8\x31\xc3\x8b\x4c\x24\x04\x89\x01\x8b\x4c\x24\x08\x89\x19\xc3” “Oh, there you are Mr. Insanity…”; int main(){ // works on GCC 3+4 int a = 37, b = 13; swap(&a, &b); printf(“%d%d”,a,b); } So, what the fuck is going on? This code, basically, takes a block of raw instructions, stick it into the memory, […]

Read More