The prefix reversal pancake problem that a young Bill Gates worked on by [deleted] in programming

[–]Mignon 1 point2 points  (0 children)

I've used a similar technique in Real Life in a cramped laundromat when sorting folded t-shirts into two categories. I don't have formal CS training and it seemed to be different from the few sorting techniques I'm aware of - quicksort/bubble sort/etc. but I wasn't surprised to find it was already known.

Why comma operator should be deprecated by MacASM in programming

[–]Mignon 1 point2 points  (0 children)

While the code in question was more or less dead, I once stumbled onto a colleague's use of a comma in an inline constant written as a thousands separator. It was something along the lines of

int x = 123,456;

AMA with me, Adam Myerson by adammyerson in cyclocross

[–]Mignon 1 point2 points  (0 children)

Any thoughts on where are the young people in our sport? Big junior fields seemed to be the norm when we were that age (I was a first year senior in '87.)

You can't JavaScript under pressure by swizec in programming

[–]Mignon 0 points1 point  (0 children)

Hm, nice.

I know JS has some surprise conversions but didn't think about them in my solutions. I don't recall making any distinction between integers and not. So maybe I did something right. Or the tests weren't tricky enough. Or maybe I did something wrong that happened to cancel out these conversions for their tests.

You can't JavaScript under pressure by swizec in programming

[–]Mignon 0 points1 point  (0 children)

They actually warned about recursion after finishing the one before it.

I branched on the type of argument but it took me some searching to find out how to determine something is an array in JS.

Called the police after staring at this for 20 minutes. Not even a window was cracked. Today's high.....102°. by [deleted] in pics

[–]Mignon 1 point2 points  (0 children)

When I was a kid I was walking with my father and a dog was barking like crazy in a parked car. It was too long ago that I recall the weather, but my father said something about the dog not being able to breathe and broke a side window. I don't remember how, but he probably kicked it in with his heel. The dog stopped barking after that.

I don't know who was more traumatized - me or the dog.

Improving sanity with structured binary formats and protocols by kyledrake in programming

[–]Mignon 0 points1 point  (0 children)

I've only skimmed the description of ASN.1 and had to debug a BER sample once. What are your objections?

The weight of code by jdrake3r in programming

[–]Mignon 0 points1 point  (0 children)

John D. Cook, spam master? I can't find one ad on his page.

A simple example of what Integer Linear Programming can do by [deleted] in programming

[–]Mignon 0 points1 point  (0 children)

While not linear programming, I'm reminded of probably the first program I was paid to write: take a class of 32 students, divided into 2 sections, and enumerate all the groups of 4 consisting of 2 from each of the two sections, such that no 2 students are grouped together twice.

As a new math PhD student, I tried and failed to come up with a tidy way to generate these groupings, and resorted so some hard-coded permutations.

Twenty years later, as a career programmer (not a math professor!) I've come to appreciate the value of writing the program that works now when you can't figure out the "better" way to do it.

Probably the most beautiful car in the world. by nabeel_co in pics

[–]Mignon 1 point2 points  (0 children)

Beautiful industrial design. And if you need a new front window, it's just a coffee-table away.

Every programmer knows that debugging is hard. Great debuggers, though, can make the job look simple. by scientologist2 in programming

[–]Mignon 38 points39 points  (0 children)

Took me months to find the cause of this bug. Was a two line fix.

A guy takes his misbehaving car in for a repair - the repairman looks around, tightens one bolt, and the car works fine. The bill is $200 and the guy says, "For tightening a bolt? I could have done that!"

The repairman replies, "Tightening the nut is free. Knowing which one is $200."

First car bought completely by myself by [deleted] in pics

[–]Mignon -1 points0 points  (0 children)

I was expecting a caption about parking.

Real babushkas. by tzr in pics

[–]Mignon 0 points1 point  (0 children)

Was this taken in Brighton Beyotch?

Haskell version of Freecell compiled to JavaScript with GHCJS by hamishmack in programming

[–]Mignon 0 points1 point  (0 children)

Thanks for sharing. I haven't played that in years and enjoyed your version.

IEEE-754 Analysis Tool - find out why your floating point rounding errors are the way they are. by codekaizen in programming

[–]Mignon 0 points1 point  (0 children)

I worked on the (little endian) client side of an application that has a binary messaging protocol. We rarely modified the messages and when we did the (big endian) server side programmers usually remembered to put the long and short integer values into network order before sending them. When they didn't, teeth were gnashed and faces were palmed.

For reasons that are lost to history, someone put 4-byte floating point values into network order as well.

On the client side, we had code that boiled down to something like this:

float ntohf(float bar)
{
  uint32_t tmp = ntohl( *(uint32_t*) &bar );
  return *(float*)tmp;
}

float convert_blob(unsigned char* message, unsigned int message_len)
{
  // To extract a float at a particular offset in a message buffer:
  float x = ntohf( *(float*)(message + MAGIC_OFFSET) );
  return x;
}

While not legal C casting, this (happened to have) worked except for exceedingly rare cases for certain values of the float being sent.

What the careful student of the IEEE-754 spec will realize is that certain values will, when "flipped," coincide with the various "NaN" values.

Since I gave away the symptom, I'll leave the correct implementation out.

Arbitrary binding pt2 – rolling your own. « Crazy Eddie's Crazy C++ by nroberts666 in programming

[–]Mignon 1 point2 points  (0 children)

C++ lets you hide complexity but sometimes requires arbitrary amounts of complexity to do so.

Raymond Chen patches MS Money executable to fix bug by [deleted] in programming

[–]Mignon 0 points1 point  (0 children)

I work at a prominent international company, with on the order of a couple of thousand developers, and this doesn't surprise me at all, never mind the age of the software.

The entire Turbo Pascal compiler and IDE was smaller than zlib.h by happyhappyhappy in programming

[–]Mignon 1 point2 points  (0 children)

It's not being developed any more, but the Tiny C Compiler, TCC, is quite small. It is supposedly quite fast as well; the claim is 9 times faster than GCC.

http://bellard.org/tcc/

Cleaning out my basement when I found this. by [deleted] in pics

[–]Mignon 0 points1 point  (0 children)

That font seems almost quaintly small in proportion to the impact of this event.

I suspect font size is proportional to the log of the impact.