fun

Three arguments to main, and other obfuscating tricks.

The following obfuscated C code prints the words to the "12 days of Xmas". I was trying to puzzle out how it works. I'm basically completely lost. What is the significance of the three untyped arguments to main in the initial call, the series of characters after the first return, the negative numeric arguments to the calls to main? Eek...

What are the worst working conditions you have written code in?

There are good times and there are worst times. I recently had to write code in a hot room with temperatures near 107°F (42°C); nothing to sit on; 64 Kbps inconsistent internet connection; warm water for drinking and a lot of distractions and interruptions. I am sure many people have been in similar situations and I would like to know yo...

Are there any CRobots style games that support robots written in more than one language?

Many years ago, just as I was getting started with programming, I ran into some programming games in the style of CRobots (I don't think it actually was CRobots, but a clone of sorts) which were pretty cool to play around with. Recently I've gotten a feeling of "programming is work, not play", which I would rather get rid of, so I figur...

Network tools for exploring the internet (traceroute, whois)?

I just recently discovered traceroute and whois. As a newbie discovering these tools, I feel like I can potentially learn and explore a lot just from accessing random websites. Can anyone tell me about other useful tools/information I could use to explore the internet? I just found out about nmap and wireshark. Haven't used either yet. ...

What do you say to express the first succesful running of a program?

Yesterday, I had a moment of excitement when my LDAP client (pure C Win32) module successful retrieved data from Active Directory for the very first time. It was more than a smoke test -- I had all ready run a few of those, and it was well less than even feature complete code. Some data was mangled - so it wasn't even code I would show...

What is the most obfuscated code you've had to fix?

Most programmers will have had the experience of debugging/fixing someone else's code. Sometimes that "someone else's code" is so obfuscated it's bad enough trying to understand what it's doing. What's the worst (most obfuscated) code you've had to debug/fix? If you didn't throw it away and recode it from scratch, well why didn't you? ...

What does your workplace look like?

What does your workplace* look like? How is it set up? Is it in a home attic (burning the midnight oil), or in your home basement (underground movement), or do you spend most of your time at the company diligently working? Cubicle? A private office maybe, or did they put you in the boiler room? How does your "precious one" look like (n...

What jargon do you use among programmers in a non-work context?

What expression do you "import" from programming while talking, in a non-work context, with other programmers? Is "2.0" the only expression that made it into mainstream? ...

I want to make a temporary answerphone which records MP3s

An artistic project will encourage users to ring a number and leave a voice-mail on an automated service. These voice-mails will be collected and edited into a half-hour radio show. I want to make a temporary system (with as little as possible programming) which will: Allow me to establish a public telephone number (preferably in the...

What is the oldest code written by yourself to which you still have access?

What is the oldest code written by yourself to which you still have access? And how has your coding style evolved over time? ...

All possible values of int from the smallest to the largest, using Java.

Write a program to print out all possible values of int data type from the smallest to the largest, using Java. Some notable solutions as of 8th of May 2009, 10:44 GMT: 1) Daniel Lew was the first to post correctly working code. 2) Kris has provided the simplest solution for the given problem. 3) Tom Hawtin - tackline, came up arguab...

Shortest-code for prime-calculation

The newspaper for the Computer Science-line at my school (called readme, is's norwegian, page 19) had a fun competition: Write the shortest possible Java-code for this problem: Take in an integer (as a string in the first entry of a string array, since the Java main method only takes a string array) as an argument, and write out fir...

Check if a number is divisible by 3

Write code to determine if a number is divisible by 3. The input to the function is a single bit, 0 or 1, and the output should be 1 if the number received so far is the binary representation of a number divisible by 3, otherwise zero. Examples: input "0": (0) output 1 inputs "1,0,0": (4) output 0 inputs "1,1,0,0": (6) out...

Change keyboard locks in Python

Is there any way, in Python, to "programmatically" (:-) change the CAPS LOCK/NUM LOCK/SCROLL LOCK states. This isn't really a joke question - more like a real question for a joke program. I intend to use it for making the lights do funny things ;-) ...

Fun: Algorithm to divide a chocolate bar in equal parts

A random thought popped into my head (when I was sharing a chocolate bar of course!). I was wondering if there is a generic algorithm to solve this problem. The problem goes like this: Info 1. You have a chocolate bar with small squares arranged in a rectangular matrix 2. There are n people in the room The problem Write an algorithm ...

"Fun" C++ library that interprets ASCII figures in code - what is it called? ("Multi-Dimensional Analog Literals")

A while ago I stumbled upon a C++ gem, a set of classes that through operator overloading and possibly some preprocessor tricks, let you define variables using in-code ASCII art: Line x = |-----|; //x is 5 Line y = |---|; //y is 3 Rectangle r = +---+ | | +---+; //r is 3 by 1 and IIRC, it even had...

How can you tell if a person is a programmer?

I was wondering when I read the famous "Programmer Habits" thread, I was wondering: Is there any way to tell if somebody is a programmer without actually asking them? Clarification: I am asking for things that you can use to recognise a programmer from "afar" or without knowing them well. To identify habits, you need to be around a ...

Capability Im-Maturity Model

Found an article about Capabilty Im-Maturity Model (CIMM) that complements the CMM levels (1-5) with levels 0 to -3: Level 0: The Negligent Level Level -1: The Obstructive Level Level -2: The Contemptuous Level Level -3: The Undermining Level I have never worked in projects on level -3, but certainly experienced the other levels. Wh...

Most inappropriate function or variable names you have encountered?

I was reading through my daily doze of RSS when I noticed a link to the python compiler documentation where class names like assList, assName and assTuple exist. While starting names with 'ass' is perfectly acceptable to me, it just sparked this idea that there probably exist much better examples of this. Have you personally used or ot...

What is the WORST commit message you have ever authored?

I mean, we've all done it, making some changes and the checking them in with messages such as "made some changes" or "fixed a bug." Messages so inane, so pointless, you might as well have written "magical fun bus" in their place (of this, I am guilty), as it would be, perhaps, more descriptive. I ask you then, what is the most pointless,...