Neil Fraser: Boredom and Frustration

A lot of academic work is being poured into machine learning. The idea is that computers can see what works, what doesn’t, and come up with new strategies. This is a complex problem; legions of PhDs have thrown their careers at it.

I think there is a simpler approach. Boredom and frustration. Today I was watching Widget deal with some sticks I gave her. She grabbed one in her mouth and ran towards her nest. For some inexplicable reason the 10cm long stick stopped suddenly when she attempted to enter the 3cm wide tunnel to her nesting box. Oh well, if you don’t succeed, try again. Which she did. Again, it didn’t work. After several more attempts she was clearly frustrated and changed her approach. She tried dragging the stick from one end. This worked a little better, but the stick got jammed at the first tight-radius turn. After several minutes of fighting the stick, she got bored and turned her attention to other matters.

This is behaviour one doesn’t see in most computers. They will quite happily execute an infinite loop until the Sun burns out. My proposal is that the computer should periodically stand back and do a self-evaluation. What percentage of the task has been completed? If this percentage is not changing (or even declining) over a significant period of time then there’s no point in grinding on. There are two options:

  1. Frustration. This technique isn’t working. Try another technique if one is available. Even one that in theory should be less effective might be better (due to a special case or some bug). An interesting and cheap source for other techniques might be previous versions of the offending code in the repository.
  2. Boredom. Nothing is happening. Alternatives have failed. Bail out and devote your attention to other things.

Some systems already have these concepts implemented to a certain extent. My Roomba understands the concept of frustration. I watched it get trapped under my desk the other day, ricocheting off the boundaries in a deterministic pattern like a ball in Arkanoid. After a short period it got frustrated at the constant wall-banging and switched to wall-following mode instead. It worked and it freed itself.

Sha1 Code Collissions in Practice

It’s one thing to find *a* collision, it’s quite another to:

1. Find a collision for the sha1 of harmless.c which I know you use,
and replace it with evil.c.

2. Somehow make evil.c compile so that it actually does something
useful and nefarious, and doesn’t just make the C compiler puke.

If finding one arbitrary collision costs $43K in 2021 dollars
getting past this point is going to take quite a large multiple of
$43K.

3. Somehow inject the new evil object into your repository, or
convince you to re-clone it / clone it from somewhere you usually
wouldn’t.

At some point in the early days of Git Linus went on a rant to this
effect either on this list or on the LKML.

Basic example of using .ajax() with JSONP?

There is even easier way how to work with JSONP using jQuery

<span class="pln">$</span><span class="pun">.</span><span class="pln">getJSON</span><span class="pun">(</span><span class="str">"http://example.com/something.json?callback=?"</span><span class="pun">,</span> <span class="kwd">function</span><span class="pun">(</span><span class="pln">result</span><span class="pun">){</span>
   <span class="com">//response data are now in the result variable</span><span class="pln">
   alert</span><span class="pun">(</span><span class="pln">result</span><span class="pun">);</span>
<span class="pun">});</span>