ePub Publishing with Audio

I am recording my thoughts about this process here because I will forget someday. Perhaps this information will help someone else.

The last two years my son’s school was offering books with a disconnected book interface. That is to say the website they were using to host to page turning books had a separate site to host audio. In the end it was very hard to for the kids and parents to use. This year they started using a new service that basically combines the two as a video. So my books aren’t being made any longer.

I took the PDF and .mp3 files they uploaded and (through a cumbersome process) I combined them into an ePub book. Each page had a separate audio player control at the bottom of the page. This was great because it made it much easier for kids to back up the audio so they could hear something again. The other huge benefit of this method is ePub files are portable, so many parents loaded their homework books up on their iPads and had them review on the ride to school!

I discovered that ePub files are an archive compressed in the ZIP format, and by changing the file extension from .epub to .zip I could view into the structure of a book. Download one of the last books from here for an example. I didn’t use any fancy software to create the books, I used a couple of AppleScript droplet scripts to speed my process (PDF2PNG, ePub_Zip, ePub_UnZip), but I hand edited the HTML and split the large audio file page by page in Audacity.

The process I used is very similar to this one by John Carroll University.

Here is an awesome video for Pages users.

LEGO Mindstorms vs LEGO WeDo

This post was originally part of a discussion I was having with other Junior FIRST LEGO League (Jr.FLL) club parents. I am sharing it here as a reminder to myself and perhaps to help other parents in deciding between these two terrific educational platforms.

Of course my 6 year old son is very excited by the idea of the Lego Mindstorms robotics kit. Who wouldn’t want to build a walking robot and carries out a series of commands on its own! I know his mom and I were very tempted to buy a set.

Mindstorms are what the older Riverview Robos team are using. They used Mindstorms to create and program a robot to accomplish a series of tasks at a First Lego League (FLL) competition recently.

Our kids are at the Jr. First Lego League (Jr.FLL) age level. Beginning Jr.FLL teams are advised to use a kit of Lego Technic parts that including a motor, gears, belts, rods, etc. Optionally Jr.FLL teams can add Lego WeDo programing functionality to their projects.

After some research, we discovered that WeDo is the lesser known sibling of Mindstorms designed for younger kids. While Mindstorms are available at many stores, WeDo is only available at the legoeducation.us website.

For the last two weeks my son has spent his time after school building (and rebuilding) the various WeDo projects. After his first 2 or 3 projects he decided he didn’t want to copy the software instructions out of the book anymore, he wanted to create the instructions on his own!

I am of the opinion that the WeDo system has advantages over Mindstorms for our kids, at least until they are almost 10 years old. Here is a list of the advantages of WeDo over Mindstorms:

  1. Slightly less expensive.
  2. Programming software is simplified.
  3. Build options are simplified because there are less sensor types.
  4. The software instructions do not need to be transferred to a separate “mini computer box” before you can see what effect your changes make.

Mindstorms has a “mini computer box” that runs the software that controls your project, while WeDo sensors and motors are ran directly from the computer. At first glance the requirement that the WeDo to being tethered to a computer seems like a hinderance. But this actually simplifies things a bit more since it removes the Mindstorms step of transferring the software to the “mini computer box” before you can test your changes. And besides, WeDo projects generally involve building things like Ferris Wheels and other things that don’t need to move away the computer.

If you have any other questions about Lego WeDo or Mindstorms ask away. I have some WeDo links to my Jr. RV Robos page which includes all of the links I have personally saved.

P.S. If you think your 3rd grader might be about ready for Mindstorms, you might consider waiting until the next version of Mindstorms (EV3) is available this Fall in August. Although, I will say the prices of the current Mindstorms NXT 2.0 are really good right now. 🙂

Lego Mindstorms EV3

Favorite Christmas Gaming Memory

This story is inspired by the Gameroom Junkies call to action on Facebook this morning. So, here is the story I shared with them.

My fondest Christmas gaming memory is the morning a computer desk and Atari 520 ST mysteriously appeared in our living room overnight!

It was our 2nd computer, we had gotten a Vic 20 a couple of Christmases before. While I have vague memories of typing seemingly random symbols to run games off of a cassette tape. I remember very clearly sitting in a chair next to my dad on Christmas morning and playing King’s Quest II together.

This was my first social gaming experience. My mom, dad, sister, and I would all crowd around that 12 inch color monitor. My dad would control King Graham while we all suggested what we should do next. I remember being really startled the first time that witch from the cave appeared. That spooky tune is stuck in my head to this day! 🙂

Audio Source: VGMPF

Happy Holidays!

Garage Monitor: Garbage Collection, and jQuery Animations

Here is a quick update summarizing the changes I have made over the past few days. I am convinced I have removed 99% of the memory leaks. The memory on my Raspberry Pi stayed pretty stable yesterday.

The summary of what has changed is this:

  1. import gc was added to garagemonitor.py (the Python Garbage Collector).
  2. gc.collect() was added to the end of my main loop (so its runs on each cycle and tries to free any orphaned variables/objects).
  3. keep_garage_monitor_active.sh bash script was created to researt the garagemonitor service when the script is no longer in the process list (for some reason it has terminated a couple of times on me, I am not sure why).
  4. The Status web page no longer reload the entire page every 10 seconds. Instead, it now uses AJAX to query the Web Service every 5 seconds. It now only reloads the page when the status has actually changed. This saves workload and bandwidth for the server, and moves more of the work to the client’s browser.
  5. The Status web page background grows bright then returns to the normal color to indicate when the status has been updated.

I may even rework the status webpage all together again so it never reloads the entire page again. I am looking at the jQuery Mobile framework right now.

As always a stable version of my code is avilable at Github.

Garage Monitor Remote Requests

I have added a wish list item to my My Raspberry Pi Garage Monitor. I added the ability for users to be able to issue requests from buttons on the Status Page. The first button issues a “Status Refresh” request.

Garage Monitor Status Page

Action Request Web Service

For safety I decided not to make the Pi accessible to the Internet, so I setup a second web service. The button submits a form which stores the request in a file. A web service which reads that file is queried by the Raspberry Pi every so often. Right now I have garagemonitor.py setup to query the service every 60 seconds.

Future Expandability

I may add the ability to close the garage door on the Open Status Page. However, there are some issues to consider.

  1. We do not want the web service to be able to open the door. (For safety reasons.)
  2. The door could be closed remotely while someone is backing out of the garage. (For example, my wife checks the status at work and closes the door while I am backing my car out.)

Does anyone have any other ideas?

Garage Monitor Memory Leak: Part 3

Note: this is part 3 of a series. You can see all of the articles I have written on my Garage Monitor here.

A Possible Solution

OK, so after going down the route of debugging and tracing, I realized I had no idea what I was looking for. So I started thinking about what I should be doing to cleanup. I realized that I wasn’t freeing the memory of the objects that I was using in the functions. So, I started trying to figure out how to do that.

Memory Readings

So after making some modifications, I have been randomly taking readings by running the free command. Over the last 2-3 hours the free memory is staying quite stable. In fact for a couple of the readings the free memory actually goes up: 349816, 349824, 349576, 349700, 349584, 349576, 349584! 🙂

Continue reading “Garage Monitor Memory Leak: Part 3”

Garage Monitor Memory Leak: Part 2

Update: I may have found a solution. Read about it in Garage Monitor Memory Leak: Part 3

Note: While this was an interesting exercise, I don’t understand the results so I cannot use them to find the issues at this time. I think my next step will look up some Python Best Practices. I have already found an interesting discussion on Stack Overflow.

In an effort to trace the memory leak, I discovered an article. In the article Marek Majkowski describes using the Python Debugger (PDB), and a garbage collection library. His article also describes the use of Python Object Graphs, an open source library written by Marius Gedminas.

Continue reading “Garage Monitor Memory Leak: Part 2”

Garage Monitor Memory Leak: Part 1

Update: Garage Monitor Memory Leak, Part 2: Tracing the memory leak.

There is some kind of memory leak happening. I first noticed a problem yesterday when the python script stopped running. The Raspberry Pi was still responding to my SSH requests, and when I ran “ps aux | grep garagemonitor.py”, the script was no longer in memory.

As a troubleshooting step I disabled some of the superflous functions (such as temperature monitoring and startup LED flashing). I have been watching how much memory is free over the past hour or two. The free memory has gone from 299596 to 288784. So it is obvious to me that this is going to run out of memory at some point as well.

Apparently Matt Hawkins from the Raspberry Pi Spy blog is having the same issue. Does anyone have any suggestions? At this point all I can think to do is schedule a reboot every so often.

Continue reading “Garage Monitor Memory Leak: Part 1”

My Raspberry Pi Powered Garage Monitor

Update #1: Garage Monitor Memory Leak: Part 1.

Update #2: I should point out that the arm on the switch I ended up using bent so it stopped working after about a month of use. I really need to figure out a way to mount the magnetic switch instead. I added a rough parts list to the end of this article.

This project uses a switch and temperature sensor connected to a Raspberry Pi (revision 2 board) to provide the state of the garage to a personal web server. This allows my wife and I to check the status of the garage via a bookmark on our smartphones.

This is the first circuit I have created a circuit board for. I am proud of the results. 🙂

Continue reading “My Raspberry Pi Powered Garage Monitor”

My Path to iPad Devlopment

Waiting for an excuse to learn

I have been wanting to learn to develop for mobile devices since I got my first Windows Mobile phone six years ago. At the time my attention was occupied with the impending birth of my first son, and the traumatic transition from working life1 to becoming a stay-at-home parent.

I want an iPhone… never mind, I want a Droid!

Two years ago my wife and I were wanting to treat ourselves to iPhones… then Verizon launched the Motorola Droid.2 By this time our second son was 1-year-old and I was too busy raising two young boys.

The path to an iPad (and to an iPhone for the wife).

This summer, Google launched the “Honeycomb” version of Android meant for Tablet devices.3 Although I had trouble justifying why I needed one, I bought an Android tablet. I found it quite handy and my 5-year-old, my wife, and I all got addicted to playing Plants vs Zombies. It was clear we needed a second tablet. To justify buying an iPad we did some research and found a bunch of nice educational apps/games for our boys to play and learn at the same time… oh and PvZ was available on the iPad as well. My wife enjoyed the iPad enough that she traded her Droid for an iPhone 4S.

An opportunity appears.

Continue reading “My Path to iPad Devlopment”