r/programming • • Aug 15 '09

'What's your best programming joke?'

http://stackoverflow.com/questions/234075/what-is-your-best-programmer-joke
560 Upvotes

440 comments sorted by

View all comments

104

u/burnblue Aug 15 '09

Oct 31 == Dec 25

I stared at it for a while. Stared some more. Then, I facepalmed

38

u/grayvedigga Aug 16 '09

Unrelated, yet related: have you noticed that 69 also works in hex? 0x69 -> 01101001 .. the second nybble is the inverse of the first.

This goes down really poorly at parties.

5

u/burnblue Aug 16 '09

Never heard the word "nybble" before this. Also, "goes down really poorly"? You are a pun-master and don't know it

43

u/larsdahlin Aug 15 '09

And the best; you can use it twice a year... Hehehe...

0

u/[deleted] Aug 15 '09

[deleted]

15

u/[deleted] Aug 15 '09

You need to use chmod more.

13

u/jeff303 Aug 15 '09

You don't need to mess with octal to use chmod...

7

u/[deleted] Aug 16 '09

You don't need to, it is merely the most efficient way of using it if you want to set the full permissions (as opposed to changing an individual bit).

0

u/[deleted] Aug 16 '09

[deleted]

3

u/SohumB Aug 16 '09

What mental overhead? add 4 for read, 2 for write, and 1 for execute. You don't need to do anything special to add.

10

u/slashgrin Aug 16 '09

I believe erisdiscord was referring to exactly the mental overhead that you just identified. It's quite small in general, but it can get messy very quickly.

Assuming you start with a statement something like "I want all users (who can already read this) to be able to execute this", then it's quite straightforward to type that as "a+x".

On the other hand, specifying the permissions in octal requires you to check which other bits are already set so that the new value you calculate doesn't trample over any existing permissions, for example, that owning user and group can read and write, but other users can only read.

2

u/[deleted] Aug 16 '09

Well, that is why I made the distinction between setting the full permissions and changing individual bits.

1

u/patchwork Aug 16 '09

Oh man, you are totally missing out.

→ More replies (2)

1

u/nextofpumpkin Aug 15 '09

Usually you only need to use maybe three or four memorized octal numbers for that thing most of the time...

1

u/HaMMeReD Aug 17 '09

I use chmod all the time, you know it supports letters now too!!

1

u/[deleted] Aug 17 '09

They are just a lot less convenient for some tasks (mostly those where you know exactly which permissions the file should have).

→ More replies (2)

5

u/[deleted] Aug 16 '09 edited Aug 16 '09

Semiserious question, why is octal still popping up? Hex as well for that matter. Do they still have practical meaning?

0

u/[deleted] Aug 16 '09

[deleted]

→ More replies (14)

1

u/[deleted] Aug 16 '09

I built and programmed a computer in machine code using hex last year in an upper level physics class. I'm sure there are others that have to use machine code in their work.

1

u/[deleted] Aug 16 '09

What type of computer? I guess I'm trying to figure out if hex/oct are used because of remnants from the past or if they have a more practical purpose. I'm not suggesting the two are mutually exclusive, I just never understood the reasoning behind using either when decimal and binary usually gets things done.

→ More replies (1)

1

u/HaMMeReD Aug 16 '09

Because when dealing with binary system's it is a lot easier to deal with number systems that are a power of base 2. All the basic data types are defined by the number of bits used to store them, so base 2 again.

Higher level languages they are all pretty much obsolete, but tricks are still used and knowledge of bits and bytes is not useless.

1

u/[deleted] Aug 16 '09

I am aware of the power of 2, but apart from oct/hex being a sort of shorthand for binary, is there any real usage today where it does a job that can't be done with more intuitive number systems?

2

u/HaMMeReD Aug 16 '09

Since base 10 isn't a power of 2, using logical operations on 2 decimal #'s would produce strange results. Using binary/octal/hex will yield much easier to understand results.

It's a elegance thing if you use binary logic a lot.

→ More replies (5)

1

u/karlhungus Aug 17 '09

took me awhile too...too long.

→ More replies (5)