Books, Gaming, Kids, Programming, Scratch

Two Great Books To Get Kids Into Coding

Earlier this year, when I started teaching programming to my kids (4 and 6 yrs old at the time of this writing), I was not sure where to start because you need to translate lots of knowledge that is usually targeted for adults into kids friendly language. I found these two books that really helped with this task, and I highly recommend them if you want to get your kids into coding as well.

Coding Games In Scratch

What is Scratch?

Scratch is a project of the Lifelong Kindergarten Group at the MIT Media Lab, free of charge, which helps create interactive stories, games, and animations. You can learn more here.

Who this book is for: Although it’s targeted for children 8 – 12 with no coding experience, this book is perfect if you want to start children as young as 4 years old by sitting with them and going through the exercises together. The first few pages provide insightful knowledge about games, like what makes a good game, types of games, game characters, etc, and the step-by-step instructions are easy to follow. No coding experience required.

OrderCoding Games in Scratch

Hello Ruby: Adventures In Coding

The author, Linda Liukas, is a programmer, storyteller, and illustrator from Helsinki, Finland, and this book is the product of one of the most successful Kickstarter campaigns for children’s books. What is so great about it is, as you may imagine, it combines great story with great visuals to take you on a programming journey. Also, it contains fun “offline” activities. Click on the image to learn more.

Who this book is for: Recommended for children 4 – 8 years old. I feel that this book is perfect for parents who will be reading and doing the activities with their children, specially when no experience in programming is something to factor in. But even if you have a Computer Science or Engineering background, you may benefit from the language and images used in the book. Definitely a good place to start before jumping into Scratch.

Order: Hello Ruby: Adventures in Coding

Disclosure of Material Connection: Some of the links in the post above are “affiliate links.” This means if you click on the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers. I am disclosing this in accordance with the Federal Trade Commission’s 16 CFR, Part 255: “Guides Concerning the Use of Endorsements and Testimonials in Advertising.”

Standard
Programming

My Hour of Code Playlist for First Graders

This year I volunteered for Hour of Code. I visited my older son’s classroom, and it was so rewarding to see all 25 first graders in the room deeply engaged in a coding activity. We talked about Computer Science, my job as a Software Engineer and the company I work for, watched some videos, and worked on “The Foos”, a really fun game/coding activity designed by Code Spark Academy for the Hour of Code. Continue reading

Standard
PHP, Programming

Creating a Directory, Adding Files and Deleting Everything

I was running a test and it came really handy to create a temporary directory, store some files in it, and later remove all the files and the directory itself.

$path = 'path/to/your/new/directory';

// Create directory if it doesn't already exist
if(!file_exists($path)) {
    mkdir($path, 0777, true);
}

// Add a text file
file_put_contents($path . 'text.txt', 'Hello World');

// Add a base64 image file
$data = 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAB1ElEQVRYR+2XzVHD' .
  'MBSEd31guBE6UNIAoQKgAnJJwo1QAe6AUAGkgsANwoF0QNJBKgDRARyBGS0of/xMkpExIh' .
  'zQjO2xR9J+elr7PRPjpnpxAHBjch/1Kg3Yudv0GvQn7ZltKLmJKvp1cuc2eWUHnwGkPjt3' .
  '2zFBVCv2QG6BbocXtvcFAMfs3DbjApSaII6CAVQ1ZZBtkH1e3qZTz/jnL7Ds2ocswKplAF' .
  'DVNECegLiHU8PvmSqmgJWkDaIC5w54Zc9+HOCTiHSOZ6V+pSOzsg1xHXANdmw3i/jQ8CER' .
  'GHYC0o8i04FSH4kavLA2q3g4gA/zKgpeRHvGwPEaZBnKb9KgCLx/nEoppCMQj3CqeA98Z9' .
  'UfxwQDqF7sAtwF0MKTa2Z1+zzQIICRCdkFdPodoy2KUhBA3jD/A/xHYGEE6qVTAIezkxFk' .
  'AaVwyJRggk2boADxDGRhDkDwVPk7zqwH8k8bPsPfAhjleAtiLXwJOXoKj3h2xn/ehyXZuD' .
  'A1APzxG81O0vkU4DdUZ2lQNVMBebgUAKnFaZm8DAL/GxAJoAW62fWikjKAk5HxYgGM3/G5' .
  'RUm9pLgAUA9ibw5AeVjSR41AqJ+ibUFGAJ+d9kPH/Gi/t5+eV4F3mU/7boBsAAAAAElFTk' .
  'SuQmCC';

$data = base64decode($data);
$image = imagecreatefromstring($data);
imagepng($image, $path . '/image.png', 0);
imagedestroy($image);

// Up until this point, if you step debug you should
// be able to see the directory and files in it.
// Let us now clean up and remove everything.

// I'm going to use PHP's DirectoryIterator class
// If you're not familiar with it you should check it out
// It has some cool methods.
$tmp_files = new DirectoryIterator($path);
foreach($tmp_files as $file) {
    // I only created files, but there are a couple of 
    // directories that get in the way (i.e. '.' and '..')
    if($file->isFile()) {
        // So, if it's a file let's get rid of it
        unlink($path . $file->getBasename());
    }
    // now remove the directory
    rmdir($path);
}

 

Standard