Monday, March 17, 2014

Lesson 56 - The Cat and the Invisible Pipe

As promised, today it was a day for nc hacking.

First we discussed protocols and addresses. Like 

  • snailmail protocol, where your address consists of your name, street address and zip etc. 
  • email protocol and email address
  • telephone protocol, where the telephone address is the protocol
  • computers talk with TCP/IP protocol and they have an IP address. 
So, we dug out the IP address of her computer using ifconfig. I explained that we are going to create a "pipe" between our computers to be able to send messages and that we're going to use Netcat (nc) for that. I explained also that in TCP/IP you need to use the IP address and a "port" which is just a number and has to be quite big. We agreed on port 10100. I had her write down the IP and the port.



Then we started Netcat on her machine, and made it "listen to" port 10100.

    nc -l 10100

Such excitement! Nothing happend though. The computer is waiting for the other one to connect.



Then we went to my machine and connected it to hers.

    nc 192.168.1.10 10100

So hack! But nothing happens here either. But when I told her that we can now send secret messages though the INVISIBLE PIPE that we just created, her eyes started to glare. So we started chatting through the invisible pipe (a TCP socket really). It even worked when I took my computer downstairs!

After that we did the same but directed the output from Netcat to a local file, as in


    nc -l 10100 >sala

So now we sent message to each other, so that the recipient could only read the message from the file on their machine. She used vim to read the message I had sent to her.

    vim sala

Now she's replying to me using email. Very internet!

Sunday Coding

Yesterday I took a nap with my 2-year old. Meanwhile the 5-year old had played some Move the Turtle by herself.

Later in the evening she wanted a coding lesson from me. Unfortunately it was quite late and I refused, based on earlier experience on coding lessons just before bedtime.

So she gave a lesson herself to her little sister. They hacked on Turtle Roy together.



It was kinda cute.

Saturday, March 15, 2014

Lesson 55 - In the App Store

Today we tried some iPad apps that teach coding skills. We bought Tynker and Move the Turtle for 5 euros or so, which makes this by far the most expensive lesson ever. But education is worth investing right?

The Tynker app has three different "sub-apps", one of which is Sketch Racer, where you must guide a turtle to draw different shapes. The concept of a drawing turtle is of course very familiar to us from Turtle Roy. And the control mechanism is just like in Scratch. You drag pieces of code together to make up the program that moves the turtle. So it was kinda piece of cake to get started with.



I was a bit worried that the big numbers would be a problem. Like, in the very first problem, you had to issue a "Forward 400" command. But fortunately when I showed her that you can use the rulers to measure the lengths of the edges, she got it at once. And started solving problems.

She got as far as the 7th problem. That was the one where you had to use Repeat for the first time. I guess she'll complete the rest of the challenges Sketch Racer challenges later. Then she played Puppy Adventure that she has earlierly completed on the Hour of Code site. And tried the space adventure thingie but that wasn't her thing.



Next up was Move the Turtle. Once again it's about giving commands to a turtle character. But the UI is not very as intuitive for kids. In the Tynker games and Scratch, the building blocks and the available blocks are always shown and clearly indicate which ones fit together. For instance the Repeat block is U-shaped and suggests that you should drag another block inside it.

Trying apps was fun. Maybe we should start writing app reviews and get rich. Naah, next time we'll go command-line and do some TCP/IP hacking with nc.

Saturday, March 8, 2014

Lesson 54 - Straight Cat

Today we agreed to play some Lightbot together. But when we sat down, she wanted to do the Hour of Code first tutorial instead. Except not. One excercise was enough. Then to Lightbot. One excercise and that was enough. She wanted to do stuff with Scratch.

She selected a nice backdrop from the Scratch backdrop library. Then she started drawing some nice animal characters. The dog and elephant are cute. The cat and the mouse come from the Scratch sprite library.



The coding part was that she made the cat rotate forever. As in


The problem for her was that she couldn't get the cat "straight" again. So I suggested that maybe we should add another script that would stop the rotation when the spacebar is pressed. She was ok with that so I showed her the new blocks she needed and this was the new script.


So, in fact you can react to keyboard input in Scratch and you can stop other scripts from running.

Then I showed her the little game I had coded while she was doing this. She liked it, but quickly found it way too easy. Also she wondered why I didn't include any background music. We agreed that she'll make a similar game herself and adds a background tune too.

Not today though.