Apple's Broken Parental Controls

12 Nov, 2017

What's a nice way to give a kid a limited amount of spending freedom, and letting them buy some things without being able to decimate your credit card? iTunes Voucher -- seems reasonable right?

So... redeeming voucher... Enter Apple ID password. Okay. Use camera to enter code. That's helpful. Please enter your credit card security code. Wait, what? Sigh. Fine.

Hand iPad back to kid. "Right, you can buy something now."

"How about this one?"

"Nooo that's too expensive. Find another one."

"What about this?"

"Yes okay, that works. You can click this Buy button here."

"Pa??" iPad thrust back into your hands.

Enter Apple ID password

Sigh. Okay. Why the heck did I bother to add a nice long, secure password for his account?

Ask for your parent's approval. Click Ask... time passes... Nothing happened. Huh? Click Buy again.

Enter Apple ID password.

WTH? Just did that! For. The. Same. Game.

Ask for your parent's approval (they can also authorise on this device). Yes, but that defeats the purpose. The whole point was to let the kid buy a few things himself. Click Ask.

A message arrives on my phone: Your iDevice-obsessed post-toddler wants to purchase lego-something-or-other-game. Are you sure he's not already spending too much time on devices already? Woohoo, finally got the request! Unlock phone. Wait, WTH! Where's the authorisation dialog gone? Settings > Parental controls? Nope nothing there. Search > Parental Controls. Nothing there either. Sigh. Back to the kid's device again. Click Buy... again.

Enter Apple ID password

Whatever. Stupid long passwords.

Ask for your parent's approval. Stab Ask. Kid now looking at you strangely because you're starting to mutter rude words under your breath.

A message arrives on my phone: Your iDevice-obsessed post-toddler wants to purchase lego-something-or-other-game. Yes I know. It's me not the kid -- how's a child supposed to figure this out? Touch the dialog correctly this time.

A message arrives on the kid's iPad: The bossy parental unit has authorised your purchase. Excellent. Hand back device to kid.

"Pa??" iPad thrust back into my hands.

What's the problem now? Oh, the buy button has turned into a get link. Only it doesn't look like a link at all. It's just the text GET. WTH? Where are the UI standards? Isn't this supposed to be a button??

Your purchase is downloading. Finally. Mutter mutter Apple mutter.

...5 mins passes...

"Pa?? I'm bored with this game. Can I try this one?"

"Fine, okay". Click Buy.

Enter Apple ID password

.

.

.

Angry, from Disney's Inside Out


How Many Hours

11 Nov, 2017

Xing Y writes:

This is Xing Yanchao from the city of Qingdao, Shandong province, China, a big beautiful coastal city with 7 million citizens. I'm very interested in teaching kids to program, and plan to choose your book as the teaching material (In Chinese, ^_^). The kids may be between 8~12, how many hours do you suggest for us to finish the whole book?

Thank you in advance!

I think at least an hour a chapter for Part 1 of the book, but the chapters on functions, modules, classes and objects will probably take a bit longer. 12-15 hours is probably reasonable to cover most of Part 1 in a classroom setting, especially considering there should be a bit of time for kids to play around and try things for themselves, rather than following it exactly. Learn through play is important, particularly with a subject that can be pretty dry. Parts 2 and 3 are more difficult to estimate. I would actually suggest to just use Part 1 in the class, then let the kids come up with projects for themselves, and use the last two parts of the book as a reference (for example, let them create something for themselves, but use chapters 13-18 to figure out some of what they decide to do). Just a thought.


Multiplying Strings

10 Oct, 2017

Robin L writes (excerpted):

I am trying to teach myself how to code and thought this was a good place to begin. I am having trouble with the "multiplying strings" section. I don't know anyone else who codes so I am hoping that you are still available at this email. This is the part about printing a letter in the shell. For some reason when I run mine the "print()" keeps actually printing "()".

Can you please help me figure out what I am doing wrong?

There's a pretty major difference between printing with older versions of Python (Python2.7 and earlier) and newer versions (Python3 and later). In Python2, print is a statement, which means this works fine:

print "hi there"

If you try that in Python3, you'll get an error:

print "hi there"
  File "<stdin>", line 1
    print "hi there"
               ^
SyntaxError: Missing parentheses in call to 'print'

That's because print in Python3 is a function not a statement.

Why does that make a difference? In Python2, this code...

print()

...is a print statement followed by an empty tuple. You're effectively telling Python to "print this empty tuple", and by quirk of the way the print statement works, you get (). The exact same code in Python3 is a function name (print) followed by an open bracket, no parameters, and a closing bracket. You're providing no parameters and the function prints nothing as a consequence. And that, basically, is the difference.

Cutting a long story short - all you're doing wrong is running an older version of Python. Check chapter one, and follow the instructions to install Python3, and the code will work as you expect.


Stickman Refusing To Move

16 Jul, 2017

Haran R writes:

I tried out the code for the two games and have successfully run the first game (bounce). The second game however did not run like how i wished it to. I followed the book’s instructions to the letter, used the GIMP software to create the images, saved it in a directory and saved the code in the same directory. The graphics came out fine but unfortunately I have not been able to get the stickman to move. I have followed the coding in the book to the letter and have checked my code against the coding in the book multiple times and i can see no mistakes.

The problem is with the indentation in your Stick Man class. If you look at the indentation of your code...

indentation 1

and then compare with mine...

indentation 2

...hopefully you'll see where you've gone wrong (if it's not immediately obvious, take a look at the vertical line coming down from the animate function in each of the code samples, and you'll see where the indentation isn't right). When I fixed the indentation on your code, it worked perfectly -- so you were almost there.

Hope that helps.


Tcl Error

11 May, 2017

丁明 writes (edited for spelling):

In your book <<python for kids>> chapter 13, when I run the program, the python shell has a error I can't understand. my python version 3.6.0. Thank you for your reply!!

error.png

I'm not sure if the Chinese edition has captured the text on page 199 of the English version of the book:

You may see error messages written to the shell when you close the game window. This is because when you close the window, the code is breaking out of the while loop, and Python is complaining about it.

The is exactly the error you are seeing when you run that code and then close the window. You are stopping (interrupting) Python while it is running the code, and an error message is displayed as a consequence.

Basically, you can ignore the message, but if you want to know how to get rid of it for good, one option is to replace the loop at the bottom:

while True:
    ball.draw()
    tk.update_idletasks()
    tk.update()
    time.sleep(0.01)

...with this...

try:
    while True:
        ball.draw()
        tk.update_idletasks()
        tk.update()
        time.sleep(0.01)
except TclError:
    pass

You can find more about error handling here: https://wiki.python.org/moin/HandlingExceptions