KLabGames Tech Blog - English

KLab develops and provides service for a variety of smartphone games. The world of mobile games is growing by leaps and bounds, and the development process calls for a different set of skills than traditional console games.

How It All Started

Two years ago, we had our first bundle of joy. In this blog entry, I’m going to talk about what happened when our little boy, who was a bright and bubbly 1-year-old at the time, was handed a laptop installed with Linux for Learners.

Why Linux for Learners?

Kids love anything they can get their hands on, including parents’ computers. By the time our newborn learned how to crawl, every time I pulled out my computer to look up something on the internet or work on a program I was writing at home, his little antennae would go up like a spaceship, and he’d squiggle his way on over to me and my laptop to see what was up. I kept my cool when he beat my keyboard like it was some kind of baby drum. I turned the other cheek when he attempted to hijack my mouse. What really chapped my caboose was when he reached for that shiny, green power button. Daddy says NO! Then there was that time he tried to press the Delete button when I was working on my home server’s shared folder-babies can be terrifying.

I was in a pickle. I thought and thought about what I could do to keep my child from ruining my work life. That’s when I came up with the idea to give my baby boy his very own computer. I pulled out my wife’s old laptop and set to work figuring out what I needed to do to make this brilliant idea a reality. Her laptop already had Windows Vista installed, but it was a bit too complicated for a wee 1 year old. I knew in my heart I needed to give him an OS so simple that even a child could use it. I started looking for one immediately.

It was the perfect opportunity to try out that Linux for Learners everyone has been jabbering about.

Linux: There’s a Distro for Everyone


This Linux distro is a customized educational version of Ubuntu. As of the time I’m writing this blog, the most current version of Edubuntu uses Ubuntu 14.04 as its base. It’s often combined with low-spec computers, using them as a thin client to make the magic happen. It's especially suited for the classroom environment. Several educational applications are bundled into Edubuntu that target the 6 to 18-year-old demographic.

Check it out for yourself here:


Here’s a screenshot of a live DVD running on a VM.


Imagine, if you will, a satchel full of educational applications and classroom network admin tools added to the regular version of Ubuntu. That’s Edubuntu. Pretty neat stuff, really.


This little gem is a Linux distro based on Knoppix.



As the name suggests, KnoSciences is pre-installed with a wide range of science and math-related applications.


This one’s an educational distro based on Debian. Some call it DebianEdu. Either way, Skolelinux makes it extremely easy to set up an educational-oriented network via a thin client-server setup, much like Edubuntu.

More details:


Sugar on a Stick

This intriguing Fedora-based distro takes the OS developed for the One Laptop Per Child project and lets you run it on a single USB stick. It comes with a unique application cluster called Activity.



Unlike other Linux distros, this one comes with its own unique environment.

Project Priorities

First and foremost, I needed a simple OS with an intuitive and consistent UI. The last thing I needed was a bunch of “metaphors” cluttering up the desktop, making it hard for my kid to learn. I also wanted something with big UI elements that are easy enough for, well you know, a kid to understand.

Though I was looking for something simple that didn’t require the OS to do much (i.e., I didn’t need a bunch of applications), I wanted an environment that allowed for the creation of original content. I also wanted to give my child the opportunity to use a Terminal that allowed him to interact with a CUI. In other words, I wanted to experience programming at a fundamental level.

Lastly, using a browser for the network was fine, but I needed the shared network to be hidden to keep my child from messing with our home network. I made sure this was airtight before I handed the keys over to my son.

Sugar It Is!

At the end of the day, the OS that met all of the above requirements was Sugar on a Stick, so I decided to go with that.

What Sugar is Good At

  • Pre-installed apps and UI have a consistent look and feel.

  • It’s simple enough for a child to understand.

    • There are big, easy-to-use icons.

    • Single-task orientation only displays the activity currently in use on the screen.

  • Console can be called from the standard menu.

  • It comes with a simple IDE for programming in Python, a LOGO-like programming language, and Squeak.

  • The features used to connect with NAS that I was worried about can be hidden via the console. Such features can also be hidden by switching the WindowManager to Gnome. (Sugar does not include an interface for his.)

  • You can view and edit the source code for each activity right from the start!

What Sugar is Bad At

  • You can’t type in Japanese without doing a little extra work. (Not a problem if you’re not typing in Japanese.)

  • Compared to other Linux distros, the things you can do with Sugar is fairly limited.

Since it all comes down to personal preference at the end of the day, I decided to go with Sugar.

Installing Sugar on the Machine

You can view the instructions for installing Sugar here. There’s a couple of different ways to do it, but I went with the USB stick + Windows machine method.

First, I downloaded the image of the USB-version of Sugar on a Stick. You’ll need a USB with at least 2GB of space on it.

Next, I downloaded Fedora Live USB Creator and used it to create an image of Sugar on a Stick on my USB stick. This creates a portable version of Sugar that can be booted directly from your USB stick.


I could’ve run Sugar right off my USB stick. However, since I had the time, I installed it directly onto the hard drive. I plugged in my USB stick, started up Sugar on a Stick, and opened Terminal.

Last but certainly not least, I called the Fedora installer with the all-too familiar command,

# liveinst

to install Sugar on a Stick.

Post-Installation Setup

When you first install Sugar, the login screen will come up by default, forcing users to enter their password every time they log in. Most of the time that’s fine. However, this posed quite the challenge for my young son, who had yet to learn his way around a keyboard. I changed the settings so that the computer automatically logged into my son’s account on startup.

I went to Terminal, su’d my way to root, then went inside /etc/lightdm/lightdm.conf and set autologin-user to my kid’s account.

Did He Like It?

It’s been almost a year since I gave my son a computer with Sugar on a Stick on it. What have I learned from this little experiment?

It seems to me he thinks of his computer as a special kind of toy. I mean, I’m pretty sure he likes it. He’s got a laptop just like daddy does, and he feels like a big boy carrying it around just like mom and dad.

His favorite apps are Analog Clock and Speak, a little program that automatically says the words you type.


He hasn’t figured out how to click with the slide pad yet, so he still has to rely on mommy and daddy’s help to open apps. I really should’ve just gotten him a mouse. Maybe even a touch pad would’ve been better. He’s starting to get the hang of the alphabet, and it seems like he’s beginning to realize what the keyboard is for.

At the very least, his computer is one of his favorite toys. As a parent, I’m going to sit back and watch carefully how things go from here.

If you’re wondering if my son has stopped trying to mess with MY computer, don’t worry. He still tries to get his hands on my laptop every chance he gets. Lately, he’s been especially adamant about stealing my Surface Pro 3 pen whenever my back is turned. It’s a mild annoyance I have learned to live with. As my child grows up, he’s going to become interested in more and more things. I’ll just have to grow and adapt my method of thinking along with him. Being a parent is kind of challenging and awesome that way.

Closing Thoughts

If you’re thinking of getting your kid a computer for a Christmas present this year, then this blog just may hit the spot.

Until then, happy parenting!


EM Department@KLab

Amazon surprised the world yet again by unveiling its line of Amazon Dash Buttons on March 31, 2015. These handy little devices let you order your favorite products with the simple push of...get this...a button. You may not be able to change the batteries on these bad boys, but they do come in a variety of designs tailored to deliver more of the little things in life that we just can’t live without.

Dash Buttonはただの通過点、アマゾンが真に狙うは家電すべてとの連携ショッピング:ギズモード・ジャパン

The first Dash Buttons to hit the market were given to preferred customers on an invitation-only basis. After a successful trial run, these handy devices started selling at $4.99 a pop. By September 2015, Amazon officially announced plans to expand its booming Dash Button business.

One Button Devices: Benefits and Real-Life Applications

Amazon’s business model for the Dash Button line is interesting enough to fill a blog, but let’s stick to the device itself. These tricky little boogers are basically dry-cell battery-powered IoT devices comprised of a microcomputer and a wireless LAN module.



Dash Buttons are stand-alone devices, making them extremely quick and easy to use in time of need—even handier than smartphone apps. The single-button interface makes these devices incredibly easy to operate. Combined with an immediacy that only simplicity can provide, the Dash Button’s UI is almost unbeatable in its field. However, on the flipside of all that simplicity lies an intricately-woven strategic approach born from a process of trial-and-error and tears of entire teams working to discover new and better ways to meet consumer needs.

Sure it may look like anyone could come up with the Dash Button, but Amazon surely deserves credit for actually going and making this thing. Everyone always sings the praises of smartphones as the culmination of all convenience, but the fact that this US-based company took a gamble on a dedicated piece of hardware provides an excellent object lesson to everyone in the IT industry.

The idea behind this device has the potential for a myriad of IoT uses that extend far beyond the finite walls of the business realm. The possibilities for what a simple “push of a button” could trigger are limited only by the bounds of our imagination. The allure of convenience brought about by the low-cost Dash Button is already giving birth to a world of new ideas that surpass the original purpose of the device. Here are a few examples that have caught the world’s attention so far.

This may very well be the first recorded example of someone using a Dash Button for something other than the originally intended purpose. Edward Benson was searching for a quick and easy way to record and keep track of what time his baby was going poo. After trying several options, he found it was far too much hassle to fumble around with the baby tracking smartphone apps in the middle of the night. The one-push Dash Button was love at first sight.

"...using your smart phone at night disrupts sleep. I want a simple button I can stick to the wall and push to record poops today, wake-ups tomorrow"

Forget about the initial setup required to create an account for ordering things on Amazon. We’re not going to hack the device either. Instead, let’s focus our attention on the ARP packets sent when the button is pushed and the device is starts up. We’ll use them to extract the MAC address from the device. The address will then be used to trigger a PC-based program in order to make this deceptively simple device do our bidding.


The article ends with a punchy, “The Internet of Things is already here.” While Amazon may not be particularly happy about customers taking their precious Dash Buttons and fiddling with their insides, it’s not like we’re mutilating the devices themselves. We’re just returning them to their original, “unregistered” state. If use-cases like these continue to spread, Amazon may be forced to implement some sort of anti-tampering system. However, at the moment, they haven’t said anything. Happy hunting!

Raymond Xie was super excited about the high cost performance of the Dash Button. The PiTFT he was using was getting super hot during use. He used the Dash Button as an easy way to turn his PiTFT on and off without wrecking the code. That’s when his wife chimed in with a suggestion. Why not use it to do something practical? Raymond decided to use the button to let his kids know when it’s time to eat. Both Raymond and his wife had a hard time getting the kids to come down for dinner as they were always on the second floor of the house playing games with headphones on. The Dash Button was wired to a Philips Hue light, and the push of the button made the lights flicker on and off, letting the kids know it’s time to eat. The button stays in the hands of the wife, stationed conveniently in the comfort of her own kitchen.

  • PizzaDash (2015ー09ー12) - github.com/bhberson

Inspired by Mr. Benson’s article, Brody Berson made his Dash Button into a one-stop Domino’s pizza delivery service (without Amazon being the wiser). Using the push-button as a trigger, Rasperry Pi calls the official Domino’s Pizza API to complete the order.

This led to the official adoption of the one-button ordering service in the Domino’s located in the UK (as of November 23, 2015).

It’s hard to tell how much of this has been inspired by “PizzaDash,” but Domino’s has shown itself to be a very resourceful, formidable early adopter of new IT resources and innovative online ordering systems.

Michael Donnelly was so excited about his rendition of the Dash Button that he posted it on YouTube. Here, we see Michael making the hallway light glow a menacing shade of red when he pushes the button to turn on the AC inside his parked car to cool off his vehicle to his preferred driving temperature. It also honks the horn for bonus points. Score!

Tony Dicola of Adafruit tries his hand at hacking the Dash Button head on. He overrides the firmware by writing over the original code for the LED with his own custom version. He leaves room for a sequel with the ominous-sounding, “...his guide didn’t touch on the Dash’s Wi-Fi module yet.” Only time will tell how far Tony will go.

Amazon Web Services (AWS), in conjunction with their October 2015 announcement of the beta version of the AWS IoT, released the beta version of the AWS IoT Button, which uses the exact same hardware as the Amazon Dash Button. At the AWS re: Invent 2015 conference which was held from October 6-9, participants were given the opportunity to experience the magic of AWS IoT firsthand. A simple push of the button sends a notification to the AWS IoT service, causing whatever task the user has prescribed to be performed.


Additionally, we’re starting to see more original button-based products produced by crowd-funding. It won’t be long before we start seeing more examples like the ones below.


These types of one-button IoT devices are catching the world’s eye with their expedient level of usability.

Engineering and Testing

After that healthy dose of history, it’s pretty natural for engineers such as myself to take everyday materials and create our very own one-touch device (example #1, example #2). As long as the device fits the overall description, it doesn’t really matter what the button actually does. I went for a design that hit home—a button that sent emails for me.

The Infamous Trial Run (30 Sec. Video)


The Device

Here are the materials and schematics I used for my test device. I started off with the resources that were so kindly made available via the Arduino IDE for ESP8266 project controlled by an ESP8266 Wi-Fi module I used as a stand-alone microcomputer.

(Prices are current as of October 2015)

  • ESP8226 module CDP-ESP8266 - Cerevo JPY 842 (tax not included)

  • Battery RW-111 (Phone battery: 3.6V 800mAh) - Rowa Japan JPY 780 (tax included) Amazon

            * Requires 3 AAA batteries

  • Breadboard EIC-15010 - Switch Science JPY 216 (tax included)

  • Jump wires, resistors, tact switch, red LED

  • Tupperware container, paper towels



  • The switch is created by taking a tact switch, cushioning it with paper towels, and then using the elastic snap of the Tupperware top to push the button. It may look cheap, but this extra layer of protection cradles the delicate switch and makes the entire device look presentable while acting as a shade for the LED.

  • I had a couple of Rowa batteries laying around the house for my house phone. (It’s this Uniden handset here, for those of you who are that interested in my private life.) The specs and size were perfect, but it had to be attached to my phone in order to charge the battery. I tried contacting the company to see if they had a separate charger unit available, but the answer was a pre-anticipated, “No.”

  • In order to control battery consumption, the ESP8266 module goes into deep sleep mode when it’s not being used. When the button is pushed, the device resets and the required process is called. Once the process is finished, the device goes back to sleep.

    • When in deep sleep mode, the ESP8266 uses a nominal 10μA. I verified that it actually used 11μA.

    • The operating voltage of the ESP8266EX is 3.0 to 3.6V. The operating current (average value) is a nominal 80mA (see datasheet below). I measured how much battery it used during my tests, and it turned out that a total of 60mA was used from the time the button was pushed to when the device went back to sleep (this includes making the LED lamp flicker). It took about 10 seconds to finish one complete cycle.

ESP8266EX Datasheet Version 4.4 (2015-08-01) Page 8

(Click to enlarge)

  • Next, I tested to see approximately how long the battery would last.

I set a few simple rules for this test. The user must activate and deactivate the device with a push of the button two times a day. If we take the values mentioned above into consideration, this leaves us with 10 seconds of 80mA for two cycles per day. The remaining 86,380 seconds are calculated using the 11μA (0.011mA) value, yielding an average of approx. 0.03mA. Ignoring any naturally occurring energy dispersion, we can use the battery life calculator found at www.digikey.jp to run a quick calculation for our 800mAh Rowa battery. The results are as follows:

800mAh / 0.03mA * 0.7 ≒ 18666.67 hours ≒ 777.78 days ≒ 25.1 months ≒ 2.1 years

  • Time for a bit of random trivia. The Amazon Dash Button uses one Ultimate Lithium Energizer battery. This battery claims to last up to 9 hours longer compared to alkaline alternatives, making it perhaps the best battery currently available in the market.

  • Amazon Dash Button Teardown - mpetroff.net

* A closer look at the black band on the positive pole of this tiny powerhouse reveals a cryptic message from the makers of this long-lasting powerhouse. 12-2034” and “12-2035” can be seen written in white. This number represents how long the battery will remain usable in its dormant state. That’s 20 years of pure deep-sleep power!


  • According to this datasheet, Energizer’s Ultimate Lithium AAA has an extremely high capacity with the following specs: “Max Discharge: 1.5 Amps Continuous, 2.0 Amps Pulse (2 sec on / 8 sec off).” For devices like the Dash Button that occasionally requires electricity, one can take full advantage of the long-lasting benefits of this stamina-packed battery.

  • The mpetroff.net article includes the following statement. "The Dash Button operates at 3.3 V boosted from the battery’s nominal 1.5 V, drawing 200–300 mA from the battery when on and 2.3 μA when in sleep." At present, there is no official statement about the battery life of the Dash Button.

  • Energizer’s Ultimate Lithium battery excels in the high-performance category. The battery alone makes the $4.99 price tag on the Dash Button look extremely appealing.

Energizer L92BP-Energizer Ultimate Lithium AAA Battery (4-Pack):

$7.99 on www.amazon.com

  • If you don’t use the breadboard, you can make the wiring portion of the device even smaller. However, given the size of our device in this experiment, it’s more than acceptable.

About the Program

I used SendGrid for sending the email itself. SendGrid is very popular for this particular application. When signing up however, you’ll be required to submit a brief explanation that includes the intended purposes of use for the service. Such measures are taken in efforts to prevent the improper use of SendGrid. An employee will then review your application and decide whether or not to issue your account.

You can send up to 400 messages a day with their free plan, which is more than enough for what we want to do. The API documentation has everything you ever wanted to know and more about SendGrid.

We’ll be using the following straightforward Web API. It’s been available since the service first came out.

Like most cloud services out there, HTTPS is required for using SendGrid’s Web API. The Arduino IDE for ESP8266 Project includes support for TLS 1.0/1.1 as of August 31, 2015. As a user myself, I’ve been looking forward to this feature for a while now. However, at the present moment (early November 2015), it’s still under development. It’ll most likely take some time before it is stable enough to use effectively.

That should explain why I went with SendGrid. I played around with adding an SSL client feature to the ESP8266 module’s AT command earlier this year. I modified the HTTPS client code from a sample program provided by Espressif, using Arduino IDE as a library. This can easily be used for more than just email applications.

* The stable version of Arduino IDE for ESP8226 that i currently have on hand is from a July 23, 2015 release entitled 1.6.5-947-g39819f0. When I used the Espressif library included in this build to create a sketch for our program, I ran into a problem that caused irregular shutdowns when a connection request was sent to SendGrid’s “https://api.sendgrid.com/” API server. I was able to eliminate this problem by writing over the *.a portion of packages/esp8266/hardware/esp8266/1.6.5-947-g39819f0/tools/sdk/lib/ with the latest service provided here: esp_iot_sdk_v1.4.0_15_09_18.

I’ve posted my source code below so you can take a closer look. Take the EspHttpsClient library and save it inside your local library folder to get started.

Library: EspHttpClient
EspHttpClient.h - GitHub
EspHttpClient.cpp - GitHub


Sketch: OneButtonMailer
OneButtonMailer.h - GitHubsd

You may experience a little bit of a delay. Instead of using a dedicated service, you may want to go with IFTTT’s Maker Channel. If you’re trying to send emails, you can use the screenshots below to start cooking up your own recipe for success. (Click to enlarge)
OneButtonMailer_IFTTT.h - GitHub


I’ve included a few key sections about ESP8266’s sleep mode from the documentation provided by Espressif.

ESP8266EX Datasheet Version 4.4 (2015-08-01)


(Click to enlarge)

and system_deep_sleep_set_option() references from ESP8266 SDK API Guide Version 1.4 (2015-09-18)


Thanks for reading, and here’s to bright futures for one-push devices and the Internet of Things!


The following was translated from the original Japanese article posted on July 23, 2015.

Getting Started

@tenntenn reporting in.

Go 1.5 is on the verge of being released, and I’m curious to know which new feature everyone is looking forward to most. With concurrent GCs and the ability to create shared libraries, the new version of Go is looking pretty sweet. However, even amidst all this Christmas-like excitement, I find myself particularly attracted to the Go Mobile update introduced in Go 1.4.

Go Mobile is a project that provides an array of tools for creating mobile apps in Go. With the advent of Go 1.5, developers can create app builds for iOS and enjoy the enhanced support provided for Android. As of July 19, 2015, the latest master branch already includes functionality for creating iOS builds. The Go Team also released an APL-like interpreter, known as Ivy, for iOS and Android.

The other day, I released an app on Google Play as a test for a Lightning Talk (LT) Timer I used at the Go Conference 2015 Summer LT Conference. The app is called GoFun, and here’s the source code. I tried testing my limits by creating the app without using Java. It’s written completely in Go.

I run across articles about apps written in a mix of Java and Go all the time, but I hardly ever see articles about programs written exclusively in Go. I found some interesting gems while researching for this project, and I’ll be sharing them here on this blog. For my first article, I’ll explain what Go Mobile is and how to install it.

The details and steps contained in this article are current as of July 19, 2015. Go Mobile is still under development, and it’s changing radically almost every day. This means that methods for creating builds, package names, and the ways different libraries and tools are used may change and evolve over time.

All the testing done for this article was conducted using Mac OS X Yosemite (10.10.3) and Nexus 9 (Android 5.1.1). No testing was done on any other OSes or Android devices. Though it seems like Go Mobile runs on Linux, it doesn’t run on Windows...yet.

Installing Go Mobile

You need Go 1.5 in order to use the latest version of Go Mobile. Either download Go 1.5 or build your own from the source code. You’ll need Go 1.4 in order to create the build for Go 1.5.

Once you’ve finished installing Go 1.5, it’s time to “go get” gomobile command.

$ go get golang.org/x/mobile/cmd/gomobile

gomobile command will be installed inside $GOPATH/bin. If $GOPATH/bin isn’t included in $PATH, be sure to add it in. Now you’re ready to use gomobile command.

$ gomobile -h
Gomobile is a tool for building and running mobile apps written in Go.

To install:

Next, we’re going to run gomobile init. This command will install the necessary components so you can start using Go Mobile. It looks like everything you need for cross-compiling builds for mobile devices, such as Go Toolchain, Android NDK, and OpenAL (libopenal) will be installed for you. In my case, android-ndk-r10d was installed inside $GOPATH/pkg/gomobile/. Since it’ll take a long time to install, it might be wise to tack on a -v and check the progress every once and a while.

$ gomobile init -v

Writing Mobile Apps Purely in Go

You can create mobile apps in Go with Go Mobile using either of the following two methods.

- Call functions written in Go from Java (Android) or Objective-C (iOS)

- Use OpenGL or OpenAL to write apps in Go

Go Mobile was not designed to provide wrappers for all the APIs provided by Android and iOS. Just like GUI and other Android and iOS app development tools, it uses Java and Objective-C, and lets Go take care of the processes it’s best equipped to handle. (I haven’t looked into whether or not you can make calls through Swift. Sorry!)

Go Mobile allows you to call OpenGL and OpenAL functions. Even if you’re not using a standard OS UI for your game, you can still use these tools to develop your app. However, the features it provides are still on the low-end of the functionality spectrum. As you can tell from the fact that many of the packages have been placed inside exp, a lot of the features are still in the experimental phase of the implementation process.

You can use almost all of the features that come with Go’s standard packages from your Go Mobile app.

Making Your Sample “Go”

You’ll find a directory entitled example in the Go Mobile repository. Inside this handy directory, you’ll find a handful of excellent samples to get you going with Go Mobile. Let’s take a closer look at the most basic of all these samples: example/basic.

First, let’s try running it on our Mac. Go to the directory with the sample inside and execute the go run command.

$ cd $GOPATH/src/golang.org/x/mobile/example/basic/
$ go run main.go

If you’re doing it right, you should see a green triangle positioned atop a sea of red, much like the screenshot below. You should be able drag the green triangle across the screen.


Now that we’ve confirmed we can move the triangle around on our Mac, let’s make sure we can do the same thing on our Android device. Use the gomobile build command to create a mobile app version of the build. This command creates an APK file by default. You can also create an APP file for iOS devices by using -target ios. If you create an IPA from the APP, you can probably move the triangle around on the iOS device. However, I can’t make any promises because I wasn’t able to generate an IPA file with the platform I was using.

$ cd ~/Desktop #You can put it anywhere, really
$ gomobile build golang.org/x/mobile/example/basic

Inputting the command shown above will generate a basic.apk file in your current directory. Use adb install to install the APK on your Android device.

$ adb install basic.apk

If everything’s going smoothly, you’ll see something similar to the screenshot below on your Android device!


I used gomobile build in the example above, but if you use gomobile install, you can use adb install after you generate the build. This does everything for you automatically right up to the point where it installs the app on your Android device. The adb command is required to use gomobile install. Get your Android SDK development environment set up and ready to go, and then run the adb command through the path. Be careful, though—if the build target for the gomobile install command isn’t an android device, your app won’t run at all.

$ gomobile install golang.org/x/mobile/example/basic

I hope you were able to glean something useful from this article! Certainly, watching your app written entirely in Go running on your Android device is its own reward. Next time, we’ll take a look at another sample to check out how Go Mobile’s sprite package works.

Back to Top