Updates from Andy Skelton Toggle Comment Threads | Keyboard Shortcuts

  • Andy Skelton 11:53 am on October 23, 2012 Permalink
    Tags: burlington vermont, Food, Lunch, Random, Sandwich, Surprise   

    A sandwich. A good one. 

    White Paper Bag

    What’s inside?

    While in Burlington, Vermont, I worked at the excellent Office Squared downtown coworking space. Some days I had to go out for lunch. That one burrito place on Church Street was unworthy of mention. My next try was Top of the Block Sandwich Shoppe. Here I found my usual.

    My first time there, I was overwhelmed by the endless options on the sandwich menu. I didn’t want to spend half my lunch break studying a food list. So I simply asked for a sandwich. Any sandwich would do, I said, as long as it’s good. No, I don’t have any food allergies or restrictions. Just make it a sandwich, not a wrap. Surprise me.

    This intrigued the young ladies behind the counter. The lucky one who got to make my sandwich was thrilled by the possibilities. She could make whatever she fancied and I would probably love it. The others kept an eye on the project, jealous of her creative opportunity.

    I took my sandwich back to the office and I loved it. The bread, the special mayo, the juicy meat and unconventional mix of veggies. This was a unique sandwich made by a person whose curiosity and passion had been aroused by a simple, open-minded request: make me a sandwich. A good one.

    Each week I went back once or twice for a new sandwich. Each visit brought smiles to the faces behind the counter. Each sandwich was better than my memory of the last.

    By the third visit I didn’t have to speak my order. My request was so memorable that I was an instant regular. I am the guy who wants a random sandwich. Surprise me.

    My surprise sandwich was the most consistently pleasurable lunch outside of my home. For the same price everyone else paid for their made-to-order sandwich I got joy, suspense, and possibly the best sandwich made that day.

    When ordering a sandwich what I really want is two slices of bread surrounding something good. Turkey, peppers, mustard, none of the above, whatever. Maybe not every sandwich maker has the passion or the sense of humor to do it right like Top of the Block. Maybe I’d be unhappy with the “surprise item” from most other places. I’m happy I found these professionals and took that chance.

  • Andy Skelton 3:27 pm on September 6, 2012 Permalink
    Tags: Bedtime, Dark, Kids, Parenting, Phobia   

    How to end fear of the dark 

    Fear of the darkMy 2-year-old daughter suddenly became afraid of the dark. “I’m scared of the dark!” became her screaming mantra at bedtime and her objection to entering any room without an electric light on–even when there was still daylight. This is how I helped to ease her back into a painless bedtime routine. (More …)

    • aggiezoe 4:15 pm on September 6, 2012 Permalink | Reply

      She has a couple of times randomly told me that Mommy is dark. Thanks for that.

    • Ian Stewart 9:41 am on September 7, 2012 Permalink | Reply

      I understand that in ancient Sparta children were driven into pitch black caves at spearpoint to deal with their fear of the dark. I think I like your method better.

    • Jonathan 1:17 pm on December 10, 2012 Permalink | Reply

      Nice algorithm! I’ll use this in the future.

    • Mandy 10:01 pm on March 1, 2013 Permalink | Reply

      I’m going to try this tomorrow night. My son started saying he is scared of the dark 2 weeks ago. We have tried some different things, night light (still too dark), children books about being scared of the dark (not getting it), talking about why it’s dark (seemed to help, but not for long) and even letting him know we would check up on him every 5 minutes (loved the attention). Now typing this I realize how inconsistent this looks. We now have him sleeping with the big light on, but he won’t fall asleep until close to 10pm, while his bedtime is 8pm.
      I’ll let you know how your method is working for me.

  • Andy Skelton 3:47 pm on June 14, 2012 Permalink  

    svn merge -c 

    How many times have you frantically googled “svn merge revert” to remember how to undo a recent commit? If you answered “too many” then you were probably confused by the syntax of svn merge -rARG1:ARG2. After this post you’ll never have that problem again because you can easily memorize svn merge -c-ARG instead.

    # to undo changeset 1234 in the working copy:
    svn merge -c-1234 files

    The c is for “change” and the - means “in reverse”. When you read that command to yourself, say “svn merge change in reverse 1234”. That is sensible enough that you can remember it forever, even in an emergency. Right?

    To apply several changes at once, use several -c- options:

    # to undo two changesets at once:
    svn merge -c-1234 -c-1220 files

    To re-apply the changes in your working copy for debugging, use -c:

    # to re-apply the changes you undid:
    svn merge -c1220 -c1234 files

    May this knowledge shave precious seconds off your next svn emergency!

  • Andy Skelton 9:40 am on May 30, 2012 Permalink
    Tags: education   

    Programming is not Algebra 

    A friend discovered a small interest in learning to program computers. She tried an online course but she didn’t get far before losing interest. She may have had other reasons for giving it up but by watching her and asking questions I did locate one significant hurdle: she was trying to read code through the lens of algebra.

    I have seen this before. A student encounters a word, symbol, or pattern they recognize from some other context. Believing they have sufficient information to understand it in the new context, they push ahead. Soon their mental model fills with contradictions and the entire subject becomes intractable. This state of affairs causes people to quit their studies.

    I’ve been there. Fortunately I learned the solution:

    1. Find what word or symbol was misunderstood.
    2. Learn the correct meaning.
    3. Re-study the material from the first occurrence.

    The hardest part is completing the first step. This is especially true of students who already know a great deal and who are confident in their knowledge. Preconceptions hide themselves well but they surrender easily once found. Most people will be eager to complete the remaining steps after they have identified a real misunderstanding.

    In this article I will expose some common preconceptions which can cause students of programming to quit. Teachers of beginner programming classes and writers of books would do well to treat these handicaps before setting students to code.
    (More …)

    • csabill 4:15 am on July 20, 2012 Permalink | Reply

      Well… this is the whole argument behind FP. To emulate a computer in my head…??? While it is a useful skill… is that a productive use of my time?

      And… assignment is complicated.

    • Thomas Kluyver 4:31 am on July 20, 2012 Permalink | Reply

      I remember having that moment – it was when I saw (in a QBASIC program), “A = A + 1”. It really threw me – how could A be the same as A+1? Luckily, my Dad could explain it, and after that it was all clear.

    • Ori Livneh (@scatterblot) 5:06 am on July 20, 2012 Permalink | Reply

      Erlang R15B01 (erts-5.9.1) [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]

      Eshell V5.9.1 (abort with ^G)
      1> A = 10.
      2> B = 20.
      3> A = B.
      ** exception error: no match of right hand side value 20

    • jmhowitt m howitt 5:09 am on July 20, 2012 Permalink | Reply

      Tried Erlang?

      • Andy Skelton 9:16 am on July 20, 2012 Permalink | Reply

        I am an avid user of Erlang. It would not be my language of choice for introducing students to programming.

    • 5:13 am on July 20, 2012 Permalink | Reply

      a sequence of instructions to be executed in order”

      This misconception is the root behind probably half of all concurrent-related bugs ever. Huge mistake to define it like that.

      • Andy Skelton 9:22 am on July 20, 2012 Permalink | Reply

        This post is about teaching beginners. Concurrency is an advanced topic, not for beginners.

    • mech 6:09 am on July 20, 2012 Permalink | Reply

      This is only true for imperative programming languages. If someone has a math background but no programming background, it makes much more sense to start with a functional language (Haskell, F# etc.).

    • André 7:07 am on July 20, 2012 Permalink | Reply

      not like algebra”

      Programming is like math

      a sequence of instructions to be executed in order”

      A Program is an algorithm which is a mathematical concept. Alan Turing wrote a chess program using nothing more than paper. Therefore, programming is math.

    • Jake Grimley 7:27 am on July 20, 2012 Permalink | Reply

      Is this nothing more than a confusion about the assignment operator (typically =) and the evaluation operator typically (==) ? I don’t think it’s quite true that programming is not algebra, and I don’t think programming is ‘a sequence of instructions’ I think it’s just that the syntax is different.

    • Tony Morris 8:32 am on July 20, 2012 Permalink | Reply

      Programming most definitely is algebra. Suggesting otherwise implies you understand neither. Let me know when you’d like to fix that.

    • iijiij (@iijiij) 10:54 am on July 20, 2012 Permalink | Reply

      So, I think this is the sort of problem (in the context of of encountering ‘the misunderstanding of what you are being taught by an online/automated/self-administered teaching resource) that would potentially be helpfully addressed by a ‘more discursive teaching process’ that I describe in an article I wrote recently called “Why are we so bad at teaching struggling learners online?” http://www.iijiij.com/?p=14060
      The idea is that ‘question-asking should be woven into the teaching/learning process’ in a sort of 2001 HAL-like ‘Dave, I just noticed that you..’. questions which are aimed at attempting to determine if the learner has misunderstood something.
      An issue which arises is whether the question asking and answering process that this requirement seems to demand is beyond our current AI capabilities and how to go about the job of ‘bring humans into the conversation’ (as an ‘AI substitute’) if AI isn’t up to tackling it (yet).

      • Andy Skelton 11:05 am on July 20, 2012 Permalink | Reply

        Another valuable aspect of the student-teacher relationship is human observation. A very good teacher can often detect trouble before the student knows she’s in it. “I saw you frowning at your book. What were you reading just then? Did you find something confusing?”

    • encryptio 1:03 pm on July 20, 2012 Permalink | Reply

      The same problem can come across in the opposite direction – *when programming is exactly algebra*. Coming from a strong, but only procedural background, I spent 6 months learning Haskell.

      For the first month I thought I was doing okay, even though it was difficult. For the next two months I slowly figured out what was wrong with my understanding, and the month after that I couldn’t code well at all because I was rethinking all my knowledge from the ground up. I had headaches after relatively short periods of coding because I was doing that; I was rethinking literally everything from how scalar values work to the chaining of large functions in an organized way.

      As a sidenote, that experience is the most intensive and useful coding experience of my life, second only to my first understanding of mutation of variables when I was using REALbasic and the ensuing flood of experiments, 9 years earlier.

      I also have many thoughts on the teaching/learning of programming with students, which I wrote up as a response post because it got too big: https://encryptio.com/posts/2012-07-20-re-programming-is-not-algebra/

    • Benjamin Dean 4:55 pm on July 20, 2012 Permalink | Reply

      for some time, exactly the way that students in some of the top CS programs in (at least) the US was to introduce them to programming with SICP, and to present the substitution model of evaluation for Scheme. Which is, more or less, algebra. Personally, I found this to be a fantastic, though admittedly difficult introduction to programming.

    • Jed Wesley-Smith 6:24 pm on July 20, 2012 Permalink | Reply

      Even grandmothers know this is wrong. http://www.mrspeaker.net/2011/11/28/immutable-nanna/

    • Jaguar Links 8:48 pm on October 17, 2012 Permalink | Reply

      This post throws some light on why most programmers suck. If you think programming is not like math and you consider yourself a proficient programmer, then you’re in the same boat as the beginners you mentioned. Programming and math are practically identical but you don’t see it because you use imperative languages and your code reeks of assignment statements. Go learn lambda calculus, Haskell, ML, Lisp, or some other functional language and then you will understand. Until then you’re still a beginner.

      • Andy Skelton 11:57 am on October 22, 2012 Permalink | Reply

        The gist of the post: programming is not like the algebra that most people are familiar with: the elementary algebra they learned as teenagers. Was it TL;DR for you?

        We agree that programming is actually like math, especially in lambda calculus. However, as this post is about deficiencies in how beginner topics are taught it is directed at people for whom a little differentiation would help.

        So while your technical assertion is correct, this is not the place to post it. Furthermore, your condescending and combative tone is inappropriate. Normally I would move such comments into the trash. Yours was allowed solely as an example of the kind of comment which should be discouraged.

    • Jaguar Links 3:08 am on November 4, 2012 Permalink | Reply

      I find your response hard to believe. If my comment was indeed inappropriate, then you would have ignored it completely and that would be the end of it. But I understand how rhetoric works so that is why I used the tone that I did. In any case, I disagree with you that this is not the place to post these comments–it most certainly is. It’s no different than you as a teacher, or a tutor, stopping to correct a student right then and there if you overheard something that you knew was not correct. Please read Tony Morris’ comment above.

      • Andy Skelton 2:15 pm on November 5, 2012 Permalink | Reply

        Beginners in all fields are given to simplify in order to gain understanding. It is not incorrect for them to think and solve problems without knowing what complexities lurk at higher levels.

        A high-school physics teacher is not wrong to present practice problems in which gravity is a uniform field with all “down” vectors parallel. His students lack the math to integrate the converging vectors. So their study of parabolas is good even though the teacher knows that nature produces much more complex curves.

        You would be wrong to enter his classroom and cross out his chalk marks, preaching graduate-level theory to beginning students. They need to approach the subject on a gradient. That is the point of the post. It is not to say that programming is not related to math. You and Tony Morris both made this mistake: you assumed that the term “algebra” always refers to higher maths when I clearly marked it as “elementary algebra” (the stuff of middle and high schools) early in the post.

    • Tony Morris 5:05 pm on November 5, 2012 Permalink | Reply

      You’re kidding yourself mate. You are justifying your total absence of understanding of both programming and algebra with superficial qualifications. It makes me cringe.

      The most difficult kind of beginner is the one who doesn’t realise it. I suspect you are that.

      • Andy Skelton 5:22 pm on November 5, 2012 Permalink | Reply

        I do not claim to be expert in programming or algebra or rhetoric. But I use these things every day and I did post something worthwhile about all three. Your comments suggest that you possess superior knowledge (I can’t argue that) but you and JL have done nothing worthwhile here.

        Since this is the WWW you can post links to pages explaining your position. That would be worthwhile. Otherwise your comments here will only testify to your poor social skills.

    • Renee Marie Jones 11:38 am on December 22, 2012 Permalink | Reply

      One of the first things we ever did in an introductory computer class was to assign functions to every person in the class (I got to be an adder) and then “play computer.” Indeed, stepping through programs is probably the best way to start to get an idea about what programming is. Your story shows how important it can be to have a good teacher whenever you start to learn a new subject.

      On the other hand, have you ever programmed in Prolog? Or created a font with METAFONT? Programming and algebra may be more closely related than you think :-) Programmers who have only dealt with procedural languages are often just as lost as your friend when they are confronted with purely functional or declarative languages. Your friend would probably have done great if she started with Prolog!

  • Andy Skelton 3:45 pm on February 14, 2012 Permalink  

    Atomically update serialized PHP arrays in MySQL 

    Okay, okay, it’s hard to find a use case for this when it’s so obvious that the correct way to handle one-to-many is with JOIN. But if you’re already committed to your schema and you decide you need to append serialized PHP data to a row atomically, you can cons serialized values with this query:

      serialized = "i:1;"
        serialized = CONCAT(

    After you have performed this three times with the serialized values 1, 2, and 3, the row contains this:


    After unserializing, deconstruct it with this function:

    function decons($list) {
        $res = array();
        while ( $list != array() ) {
            if ( $list[0] === 'cons' ) {
                array_unshift( $res, $list[1] );
                $list = $list[2];
            } else {
                array_unshift( $res, $list );
        return $res;

    The result:

    array(1, 2, 3)

    I haven’t actually used it (probably never will) but you are welcome to try this at home!

    Proving that this is stupid is left as an exercise for the reader.

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc

Get every new post delivered to your Inbox.

Join 2,058 other followers