"In the world ye shall have tribulation: but be of good cheer; I have overcome the world." –John 16:33

Category: Software Page 4 of 5

A tutorial on machine learning

I just found a book, available free online, about machine learning. It has a lot of great recommendations and is in an area where I have yet to advance my skills beyond a beginner level. It is a book Kelly might be able to use if she is not already too advanced. I thought I would start to try to work my way through it. It might finally get me kick-started in this area.

Betty Blonde #296 – 09/04/2009
Betty Blonde #296
Click 
here or on the image to see full size strip.

A new (old) project–finding something to do

My buddy John from North Carolina via New York and I have started up a new software/vision project based on some previous work both of us have done. Now that Lorena and I are starting to get settled here in Oregon, we have time on our hands. John is in the same boat, so we are putting together some software to do some hobby stuff. We put together a preliminary project plan and even have a name for the work. We are not sure what we want to do with it yet. Maybe it will turn it into an open source project. We might just use it for our work. It will be a ton of work and, like always, worst case, we will learn a ton.

Betty Blonde #271 – 08/03/2009
Betty Blonde #271
Click 
here or on the image to see full size strip.

BleAx rewrite: Introduction

My daughter Kelly drew a comic strip called Betty Blonde five days per week for two years starting when she was thirteen years old. I wrote a program called BleAx a few years back to help her accumulate the four hand drawn panels of her daily comic strip into a single image with a title, date, copyright, borders and that sort of thing. The program allowed the her to automatically upload the strip to a website for display. I did the whole thing by hand for about a year, then spent about six months writing BleAx whenever I had an hour or so free, here and there. BleAx stands for Betty Blonde Aggregator of Comix.

I wrote BleAx in Python and still have it, but have decided to rewrite it as a learning exercise. I normally write programs in C/C++ in my day job, but have recently been wrapping some of the time critical stuff I write in C++ in a Python wrapper so engineers who do not normally write in a “non-garbage-collected” language can use it easily. I now have started using a set of libraries called PySide to write Qt GUI’s in Python. It took me a bit of time and hassle to get my environment set up to automate the GUI development and C/C++ wrapping in so I did not have to go through a ton of manual processes to build the programs and put the results where they needed to be. I do a lot of work with OpenCV so I will talk about how to use that effectively in this environment, too.

I am sure my process is not perfect and that is part of the reason I am doing this publicly, so some of the people that might read this can beat up my process and tell me how to do it better.  To that end, I am going to start rewriting BleAx. I do not have a ton of time, so this will be a little bit of a slow process. I am mostly doing it just for fun and documentation, but if it helps anyone else, that will be great.

Betty Blonde #222 – 05/22/2009
Betty Blonde #222
Click 
here or on the image to see full size strip.

More C++, Python, PySide, SWIG, OpenCV and an early Christmas gift

We received a great Christmas gift last night. The big, big boss of our company in Sydney (not just the big boss from Prescott) wrote a letter and gave us an extra five days of vacation over the holidays because we had such a tough year and because of some health issues in our new executive team. The reality is that no one has taken much of a vacation over the last two years and most of us have worked just about every weekend. It will be nice to spend a couple of unfettered weeks with the family.

Just as good, I have been put on a project that involves writing programs in two different languages using a couple of libraries I really like in both of those languages.

“Why two languages?” you ask.

Well, C++ is a language that is very good for doing things very efficiently and effectively, but that can really get you in trouble if you do not know what you are doing. Well written C++ code generally runs much faster than code written in higher level languages like Python. It lets you do just about anything you want and does not provide any restrictions with respect to leaking memory or jumping off into areas of memory that are totally unrelated to what you are doing. Python is a great language for people who are not so comfortable with the freedom of C++. It also allows user to write a lot of functionality fast and has lots and lots of add-on libraries to do lots and lots of things easily.

I normally use C++ because of the need for speed. Other members of my team need to use my code in programs they can develop rapidly for use in scientific experiments and production code for the instruments we make. So, we have decided that I will write my machine vision code in C++, then wrap it up in a Python wrapper using a tool called SWIG. All the tools I normally use in C++ to build GUI’s (Qt) and perform image processing tasks (OpenCV) are available in Python as libraries. The Qt libraries we use are called PySide and the OpenCV libraries are just called Python OpenCV.

I have set up my environment so that whenever I write a C++ library, the Python wrapped results are automatically built and stuck into the correct directory for use by the rest of the team. In addition, when I build a GUI with Qt Designer, I can run a batch file that turns the C++ code into a Python program. I have to do a little merging with that if I change the GUI, but it is all quite painless. I think I might write up what I have done and post it here. I am sure I have some inefficiencies and someone might be able to make some suggestions.

Betty Blonde #219 – 05/19/2009
Betty Blonde #219
Click 
here or on the image to see full size strip.

No Shave November (more than Movember), Python, C++, PySide and SWIG

What you see below is a little program I have worked on over the last week or so. It does not look like much, but there is quite a bit under the hood. The GUI is built with something called PySide which is an open source version of the wonderful C++ Qt libraries in a Python wrapper. It is amazing how easy it is to use. I knew nothing about it less than a week ago. In addition, I built a C++ capture library based on OpenCV (I will switch to camera specific libraries when we decide what camera we want to use for our project). I then used SWIG to add a Python wrapper around the library. I write this, not because I think it is particularly interesting to anyone, but because I am having a great time learning some new things, there appears to be a lot more coming and it will be good to remember what a good time I had doing it a few years from now.

You might notice that I got a little jump on No Shave November. I decided to go with the beard, partly because I have been away from home quite a bit over the last month, so Lorena has not been able to wrestle me down and shave it all off. If I can just last until Thanksgiving…

Python/C++ GUI for Machine Vision Development

Betty Blonde #212 – 05/08/2009
Betty Blonde #212
Click 
here or on the image to see full size strip.

Programming Python (again)

I have been given a project at work to write a program to control a camera, some motors and I/O and perform some machine vision. That is pretty much what I do anyway, but the high level parts of the project are to be developed in Python with the low-level, “need to go fast” parts to be written in C/C++ with a Python wrapper. I am going to be able to develop some new skills and play with some new toys, but will have to slow down my Our Homeschool Story posts a bit. I hope to keep going but not a post a day, at least for awhile.

Betty Blonde #207 – 05/01/2009
Betty Blonde #207
Click 
here or on the image to see full size strip.

Walking and a new short term project

Dad's new walking toolsI have to admit I have been struggling a little with a lot of very little things over the last month or two. It is almost a perfect storm:

  • The kids are moving three thousand miles from home to go to college.
  • My day job company is just about to deliver on the first (really hard) product so I will start on a new, big project that does not require 60-80 work weeks.
  • We lost Lorena’s father(Grandpa Lauro) which did a pretty hard reset on my priorities.
  • I have delivered a ton of new functionality to GaugeCam so my work there will probably just consist of bug fixes for at least a few months and probably a year or so.
  • I am fatter and more unhealthy than at any point in my life.
  • A few months back it seemed like a good idea to “finish” this blog and go on to something else, but I can’t bring myself to do it.  The problem is I realize I do not have anything very interesting to say.

So yesterday, when I was feeling sorry for myself, I decided to try to do something about my weight and health, so I went out for a five mile walk.  About half way through, I realized I was getting a sunburn on my bald head, so I stopped and got some walking tools (a ball cap and some sunglasses) displayed in their full glory in the obnoxious selfie accompanying this post.  This morning, I got up early enough before Sunday morning meeting to walk to MacDonald’s for some oatmeal.  Before I left, I downloaded one of those walking applications from my Samsung S3 (My Tracks by Google) and used it.  It is very cool, but the only direct place to post results is to Google+.  The stats, map, and graphs are cool, but Google+ is not really where I want to post them.

So, I think I got a short reprieve.  It is possible to send the walking results as a CSV file to my Google Drive.  So, to keep me interested in continuing to walk and for a short-term project, I think I am going to try to write an application that takes the results of the My Tracks app from my cell phone and posts them to this blog.  That will give me a little more time to think about what I want to do with the blog, find some new, bigger projects on which to work, get a little healthier, and get my act together again.

Betty Blonde #132 – 01/16/2009
Betty Blonde #132
Click here or on the image to see full size strip.

Back to work on GaugeCam


I have finally gotten a chance to spend an hour or two on GaugeCam.  I really did not have the time, but was so burnt out on everything else, I took a little time after dinner last night and fixed a few things.  Here is the blog post for the latest update.  The video shows what I did.  It used to take three or four clicks of the mouse to calibrate the water level measurement system.  Now it only takes one.  You can see it in the video above.

I have decided I am going to spend some more time on this over the next few months until Lorena and I have had a chance to figure out what we will do next. More and more people are getting interested in it and we keep thinking of new things to improve. It should be fun.

Betty Blonde #120 – 12/31/2008
Betty Blonde #120
Click here or on the image to see full size strip.

Switching to Opera

Day 960 of 1000

Due to Mozilla’s unconscionable and extreme treatment of their former CEO, Brendan Eich, I have decided to kick Firefox to the curb.  Daniel Greenfield explains the issue quite well in his blog post at Frontpage Mag.  He also makes a great case for why Chrome is a bad choice for a replacement.  I thought I would try Opera first because I have heard so many good things about it.  I am writing this post from the ScribeFire extension that I used previously in Firefox.  I have been able to import all my bookmarks and am blocking ads with AdBlock Plus.  The browsers is noticeably faster.  I will have to retrain myself to use the Opera layout, but that does not look to be too onerous.  So far, admittedly only one day, I am quite happy with the change.  I will leave Firefox installed for a few more days to easy the transition, but will put up a post when I am Firefox free.

Betty Blonde #99 – 12/02/2008
Betty Blonde #99
Click here or on the image to see full size strip.

Christian is doing the same stuff as me

Day 807 of 1000

Position probability mapAmazingly, Christian uses many of the same algorithms for his undergraduate research as I do for my day job. Christian created the image to the left. It is a normalized correlation response map used in the process of finding a pattern in an image. His work is very technical–some of the elements of his research requires deeper math skills than I normally use. It has been fun watching the work move forward.

Religious wars in the world of Statistics

Day 772 of 1000

I logged for one summer in North Idaho while I was in college.  Though I had worked in sawmills a lot, I found the logging culture both different and interesting.  There seemed to be a constant flame war going on about which cork boots were best (White is the brand I remember).  There were also continuous arguments about chainsaws (Stihl, Husqvarna, etc.), the “right” way to file you saw chain (whether to do it yourself or have someone else do it), and a million other work and tool related subjects.  It is really not much different in the world of of programming.  There is always a struggle to get everyone on the same page with respect to programming languages, development environments, debuggers, hardware, etc., etc.

I got a kick out of the seventh item on this list in an article at Simply Statistics.  It points to an article about using something called Hadoop to deal with “big data” problems.  I am just starting to learn more about different statistical tools, so it was great to be able to glean information about tools that are new to me from this article like pandas and scalding.  The pop-culture element of the article is the reason I thought to right about it here.  The disdain with which the author writes about Hadoop is more than matched in the comments section below the post.  I especially like an aside written by one of the commenters in response to a commenter before him who extolled the virtues of  language named Erlang while hammering everything else:

[Edit: I have had a poke around, and you appear to have a bit of a history of trolling and flaming-anything-that-isn’t Erlang, so if you don’t mind, I will take your criticism with a grain of salt.]

Christian and I discuss this kind of thing pretty regularly.  It is hard not to get caught up in the religious wars.  It is something I have to fight on a regular basis.  In industry it is critical to do what is best for the company.  Sometimes that means reuse of a really, really bad code base to get something to market quickly.  Sometimes it means using almost dead cult languages like Delphi and Haskell (see, I still have some religion) that have little penetration in the real world.  As I get older I realize there is nothing new under the sun.  Before there were chain-saw arguments, I am sure there were axe arguments.

Swirl: An interactive learning environment for R

Day 770 of 1000

There is a post over at the Simply Statistics blog that talks about an interactive programming environment for the R statistical programming language called swirl.  I have decided to download this when I am back in my Hotel room tonight (I am working in Prescott, AZ this week) and report what I find.  It is amazing how important statistics has become in the work I do in machine vision.  The last four jobs (including this one) is loaded with it.  I just sent a set of data off to members of our team in Australia and China because we do not have anyone here yet who can handle it.  I suspect, I will be hiring a data science consultant to pick up some small projects, soon, but believe we will be hiring a fulltime data scientist within two or three years just to consume the data we produce in my group.  I need to start studying R and Weka to get enough knowledge to hire well.  I would like to learn SAS and JMP, too.  Kelly says JMP is not so expensive, so we might start with that.  Fortunately, I have some data scientist friends who are capable of helping me.

Statistics Unconference

This is something for Kelly.  Is this cool or what.  A live stream, Statistics Unconference with excellent presenters from JHU, University of Washington, and R-Studio.  It is about the future of Statistics and statistical tools.

Notes on Christian’s 18th birthday

Day 745 of 1000

I will be in Arizona on Christian’s birthday this year so we had a birthday cake and celebrated a little early with a birthday cake and some candles after dinner last night.  It was nice.  I thought I would write down a few things about him to celebrate this milestone.
Christian and Dad, two days before his 18th birthday

Here are a just a few random notes:

  • When Christian was about 12, he had pretty sloppy handwriting, but for some reason or another, he got fascinated with the topic of fonts.  He implemented anti-aliasing of fonts on RockBox (an operating system for MP3 players with screens), designed some computer fonts, then decided he wanted to design his own, fast, efficient, handwritten, serif font.  He did that and it was quite amazing.  For a period of about two years he took notes and wrote letters with a hand-written font that looks essential similar to courier new.  When he started getting into complicated college class at age 14 or 15 he needed to write faster, so he dropped some of the serifs, but still has impressive handwriting skills.
  • Christian is one class short of his associate degree.  He has enough credits, but needs one literature class to finish up.  He loves his old community college (Wake Tech) and wants to finish the degree online after he gets out of graduate school.  I hope he does that.
  • Christian started NCSU as a Junior when he was 16.  Rather than go through normal channels to get a canned research project, he approached the professor in charge of electrical engineering graduate research to solicit a research project.  The professor told him no one had previously done that, but got the word out and he was given two professors that needed some help.  He is now on his third project for the professor he selected and has had a stellar research experience that has included circuit design, data gathering and analysis, PID loop tuning, C/C++, Assembly, and MatLab programming, a research paper, two research posters (and presentations), and he still has a big capstone project and paper in math and image processing to do before he graduates.
  • Christian started college full time at age 14, but had 15 credits from CLEP testing he started accumulating when he was 13 that were accepted by the community college.
  • Christian started his Senior year at NCSU at age 17.  He has a 4.0 GPA.  He is taking two graduate level math classes this semester and is scheduled for three more next semester.  He has been on the Dean’s list every semester he has been in college.
  • Christian took a driver education class that is offered by the State of North Carolina when he was fifteen.  He got his drivers permit just in time to spend the whole summer driving from near Fuquay-Varina with his Dad to an engineering internship in RTP.
  • Now that he is 18, he is old enough to go into the men’s locker room at the YMCA.
  • He is scheduled to do English-Spanish translation at our church convention this weekend.
  • He is a good son who gives us great joy.

HAPPY 18th BIRTHDAY CHRISTIAN!!!

A serious 18th Birthday picture of Christian with Dad

How to teach computer programming to kids (Part 9) A suggested curriculum

Day 617 of 1000

This is the ninth in a series of posts on how we taught our children to program, what we did wrong and how we think we could have done better.  You can see the introductory post and index to the series by clicking here.

[Previous post]

This post describes how I think I would teach an eleven year old kid how to program.  I explained the many things we did wrong and the few things we did right in teaching our kids how to program when they were young In the previous posts in this series.  We really did not do so badly with our son.  He is a good programmer with a solid knowledge of the fundamentals of object oriented programming in C#, C/C++, and Python.  His college level Introduction to Java class was a trivial exercise for him.  We did horribly with our daughter.  So much so that she struggled mightily with the same Introduction to Java class at which our son had excelled.

We have a good (certainly not perfect, but good) track record teaching our kids things like reading, math, art, typing, and all kinds of other stuff, so I have tried to think about what I did wrong and how I might do it if I had it to do over.  I think the main reason we did not do so well is that we did not see programming as an essential skill.  We were wrong.  All STEM majors need to know how to program and that knowledge is a huge advantage to kids who enter a STEM degree in the University.

What language should you chose?

So, what could we have done to teach our kids programming at an early age?  There are a lot of small concepts a new programmer has to learn before any attempt is possible to learn the big picture programming ideas, particularly object oriented programming.  There are lots of books that explain these details quite well.  A language that handles some of the minutiae for the new programmer so they can learn these small concepts one at a time is a big advantage.  Languages like C#, Python, and Java all qualify.  C/C++ does not for reasons #3 and #4. There are good reasons for selecting one of these languages:

  1. These are serious languages for serious programmers that can perform anything from small embedded applications for single board computers to game programs running on personal computers to full-blown, big data, internet enabled monster programs running on “big iron”.
  2. They have large sets of libraries that the new programmer can use without a lot of knowledge about what is going on under the hood.
  3. Garbage collection (a technical detail we don’t need to go into here) is managed by the language so the new programmer can concentrate on learning the small concepts without the program breaking for mystifying reasons.
  4. There are very good Integrated Development Environments (IDE) for all of these options.  An IDE is a program that is used to write programs.  It has an editor, a compiler, a linker–everything need to write, debug, and run a program in an easy to use environment that usually has a hint systems (intelli-sense) for computer commands in case the programmer forgets what he should type next.
  5. There is a TON of documentation, tutorials, examples, and books on the internet and in print for all these languages.

We started in C# because it meets all the criteria above, I had good knowledge of the language, and we found what looked like a good tutorial book on C# that featured something of interest to my son.  That was a great reason to go that direction at the time.  I think if I had to do it over, I might start with Python.  There is no particular reason that Python would be better than C# or Java, but I am aware of a number of cool, hobby projects written in Python and I would like to get a little deeper knowledge of Python myself.

What book should you chose?

Programming the Raspberry Pi, Getting Started with PythonThese days, it is possible to get all the information required to program online.  I have learned languages that way (Python and R).  Nevertheless, for a sit down class with an 11 or 12 year old kid, it is nice to have a book to follow.  In addition to the book we used to get started (Beginning C# Programming),  I have been looking at a book with great reviews titled Programming the Raspberry Pi, Getting Started with Python.  The thing that is great about this book is that, if you already have a USB cable and a reasonably capable PC, you can be complete set up with an embedded computer to write robotic, internet, game, and other kinds of programming for less than $100.  Here is the blurb from Amazon for the book, a Rasberry Pi embedded computer, and the Raspberry Pi user manual:

Rasberry Pi + Manual + Python book

The reason both the books are good is that they start from ground zero, they feature good starting languages as defined above, and they have project goals that are likely to interest kids of the age of 11 or 12.  The Raspberry Pi is particularly good because it features a chunk of hardware to which the kids can hook up other stuff and/or connect to the internet.  These are just examples, but the concepts behind both these books are great.

How should I do the teaching?

This is an especially good question if you, yourself know nothing about programming.  The beauty of the above setup is that the books walk you through the set up of the computer, the download of the language and IDE, etc.  They give button push by button push instructions.  If you do not know anything about programming, this will teach you.  As for your kid, it has been my experience that at 11 or 12, kids generally love to do stuff one-on-one with their parents, even if they sometimes do not admit it.  The one-on-one approach is the right way to go.  Here were my rules for a structured program like this:

  • Go by the book.  You might think you have a better idea.  You might ACTUALLY have a better idea, but if you stick to the book you will be assured you and your kid have all the materials to go on to the next chapter.
  • Sit down with your kid for 20-30 minutes per day, at least four days per week.  Be present with him the whole time, but quit after the alloted time so you want to come back for more.
  • Let him do ALL the reading.  Have him read every word, aloud.  Talk about it when you or he don’t get it.  Look up explanations on the Internet when needed.
  • Sit on your hands.  Let your kid hold the book and turn the pages.  Let you kid plug in the computer. Let your kid download and install the programs and software.  Let your kid do ALL the typing.

That is all I have.  I wish I would have done it that way.

How to teach computer programming to kids (Part 8) CSC 116 Introduction to Computing – Java at NCSU

Day 614 of 1000

This is the eight in a series of posts on how we taught our children to program, what we did wrong and how we think we could have done better.  You can see the introductory post and index to the series by clicking here.

[Previous post]
[Next post]

Kelly and Christian both took the “Programming 101” class at North Carolina State University this semester for science majors.  We all agreed that it was badly done.  Part of the problem was with the disparity in knowledge of the students coming into the class, but a lot of it had to do with the structure and operating rules of the class.  This seems to be a typical problem for many, if not most, introductory college programming classes.  Here is the course description:

CSC 116 Introduction to Computing – Java UNITS: 3 – Offered in Fall Spring Summer
Corequisite: (E115 or PAMS 100) and (MA 121 or MA 131 or MA 141)
An introductory course in computing in Java. Emphasis on algorithm development and problem solving. Careful and methodical development of Java applications and applets from specifications; documentation and style; appropriate use of control structures; classes and methods; data types and data abstraction; object-oriented programming and design; graphical user interface design.

First, let’s talk about the disparity of knowledge of the kids entering the class.  Kelly and Christian are a classic example.  Kelly, as is described in a previous post in this series, had virtually no programming experience before she took the class.  The University required her to take a one-hour course on how to log into a University computer and use a Linux environment, how to make a PowerPoint presentation, and a bunch of politically correct goofiness.  In other words, she started the Java class with zero programming knowledge.  Christian, on the other hand, already had more knowledge about programming in C/C++, C#, Python and PHP than would be taught in the course.  So, while Christian was bored out of his gourd, Kelly struggled to learn about data types, loops, if-else statements, classes and objects, and all the rudimentary building blocks needed to program.

Meanwhile, the operating rules of the class prevented her from getting help from her brother, Google, me, or anyone who had deep knowledge of these programming topics other than the course instructor and the less than capable TA’s for the class.  Whose bonehead idea was it to make those operating rules?  I get that the student who takes the class needs to understand the material on their own and it is important to do their own work, but it is ridiculous to forbid the use of tools and resources that will allow the student to learn the material more thoroughly.  I am sure many students ignored these rules, but Kelly worked mightly to do the class according to the operating rules.  Those rules were a great hinderance to the learning process for Kelly.  For Christian, it did not matter, he already knew everything.

There has to be a way to do some kind of triage before assigning kids to a class like this.  There has to be a better way of teach the beginning programmers.  I will talk about what we would do to prepare our kids for these classes if we had to do it over, but I do not know what to do about the college classes themselves.  I am not sure what to do about the college level introductory courses themselves.  What I do know is that I have hired lots of programmers during my career and I rarely, if ever, hire programmers that have Computer Science degrees.  Partly that is because of the type of programming we do in my field (robotics and machine vision), because it seems like the CS majors are best suited for database, gui, and internet programming.  Partly, it is because I have seen too much of the kind of nonsense like the course desribed here that goes for college level programming instruction.

How to teach computer programming to kids (Part 7) Statistical programming in R and SAS

Day 613 of 1000

This is the seventh in a series of posts on how we taught our children to program, what we did wrong and how we think we could have done better.  You can see the introductory post and index to the series by clicking here.

[Previous post]
[Next post]

A Beginner's Guide to RKelly did not start learning to program until she was already in college.  The very first pass at this was when our friend Troy helped her in his work at the Biological and Agricultural Engineering laboratory at North Carolina State University.  We got her a book on R programming.  She spent about three weeks to work her way through four or five chapters of the book before she spent about three weeks in the lab with Troy.  I did not sit with Kelly at all during that process and even though she learned a lot, she felt pretty badly that she contributed so little.  That was my first clue that I had failed terribly by not teaching Kelly to program.

Nevertheless, there was a lot of programming good that came out of Kelly’s six or so weeks in the R Language.  Kelly is a Senior in Statistics at NCSU, so it was a very good thing that R was her first programming language.  Most programmers start with variables that hold a single piece of data and build bigger structures to hold sets of data.  Statistical languages start with whole data sets that allow the programmer to calculate measures of the data set and present the data in user friendly formats.  There is a big difference in paradigms between statistical programming and the more traditional language like C/C++/C#, Java, and Python.

This semester Kelly took her first two programming classes:  SAS (statistical) programming and Java.  The difference between her preparedness for the two classes was stark.  She was way out in front of everyone in her statistical programming class because she had learned to think of programming in terms of how to manipulate entire data sets where looping is often internal.  In Java, not only did she have to learn how to think of data points rather than data sets, she also needed to create loops to work through all the points in the sets.  Her meager six weeks of R experience paid huge dividends in her statistics class and she excelled there.  It was a different story with the Java class.

Kelly struggled and needed to spend many more hours during the first part of semester just to stay even in Java.  By the middle of the semester, she had everything under control, but she did not start “getting” the material until the last few weeks of the semester.  She kept her grade up until that light went on with memorization and hard work.  It was frustrating to her and so unnecessary.  If we would have done the same thing for Java as we had done for R by giving her some training before she got to the class, her experience would have been completely different.  She gets the material now, but there could have been a good deal more joy and a deeper understanding of Java had I given her even a minimal amount of training–six weeks would have done it.

How to teach computer programming to kids (Part 6) C++, Python, and browsing the web with a dumb phone

Day 612 of 1000

This is the sixth in a series of posts on how we taught our children to program, what we did wrong and how we think we could have done better.  You can see the introductory post and index to the series by clicking here.

[Previous post]
[Next post]

C++ Primer PlusPart four of this series describes how Christian studied C# during the first half of the homeschool year when he was 11. Part five describes several computer software projects he performed during the second half of that same year.  At that point, he had gotten to know quite a lot about the build process (compiling and linking).  He could do some procedural programming in C# with a fairly top level understanding of object oriented programming.  He could program pretty well in PHP and use Drupal to build a good website.  He had modified a pretty sophisticated C program to run on a new platform.

All that he accomplished was great, but he had such a strong interest in the topic, it was pretty shameful I had let him do virtually all of this on his own with almost no tutoring from me.  So the next year, when he was 12, I decided I would help him learn C++ so that he could learn more about pointers and garbage collection as well as get a deeper understanding of object oriented programming.  We did something similar with C++ as what we did with C#.  Christian began to work his way through the book for about fifteen or twenty minutes per day.

We set up Christian’s computer with the Unbuntu Linux, the Qt libraries, and Qt Creator as an IDE.  I should him how to work in that environment and he got started.  I sat down with him more than previously, but more of my time explaining concepts and performing code reviews would have helped the process a great deal.  After two or three months, we decided he needed a project.  He decided he wanted to be able to be able to send commands from his SMS phone.  It was not a smart phone, just a phone that could make calls and send and receive SMS and MMS messages.

He created a gmail account just to pass messages between his cell phone and his Linux computer running as a server at home.  When he wanted to do something on his computer from his phone, he would send an SMS message to the gmail account.  The Linux computer continually looked for message on the gmail account.  When it received a message, it interpreted it, ran the command on the Linux computer and sent the message back to the phone via SMS message.  He got his program up and running fairly well about half way through the school year.  About then, he was getting a little bored because he had finished this project and moved further up the curve with respect to object oriented programming and the lower level aspects of C++ programming.  He was not great at it, but was no longer a beginner.

I knew we needed to do something to maintain his interest because we had started to bog down.  He had the idea that he would like to figure out a way to use his SMS/MMS phone (not a smart phone) to browse the internet.  He found some Python libraries that would make this task easier, so he asked if he could switch to Python for awhile.  I thought that was a great idea.  Again, the thing that keeps him engaged is a project he really wants to make work.  Python is an object oriented language that would serve to continue solidification of his object oreinted programming skills.  At this point, for reasons mostly having to do with work and the kids other homeschool subject matter, I disengaged from my teaching efforts with respect to program.

Over the rest of the year, Christian was able to get a fairly amazing program up and running on his Linux server.  It did the following:

  • An SMS/MMS phone sends an SMS message that holds a URL for a specific web page to a specific gmail account.
  • Christian’s Python program running on a Linux server (at home) continually checks for emails arriving at the specific gmail account.
  • If an arriving message holds the URL of a web page, the following sequence is performed by the Python program:
    •  A web browser is opened to the web page specified by the URL.
    • A screenshot of the web page is captured and saved as a jpeg image.
    • Numbers for the links are added to the image.
    • The image is transmitted back to the calling phone as an MMS message.
  • When the phone receives the image of the web page back, the user can send back the number of a link on the page and the Linux program will transmit that web page back to the phone as an image.
  • If the user selects an input field by selecting its number from the web page image and adds some text after the number, the phone will enter the input text into the input field.  That is how he could enter the username and password to check his email accounts and/or enter restricted web sites.

Again, the first part of the year was a little bit tedious for Christian until he got to the point where he could do a project that interested him.  He came way up the programming curve specifically because of that.  He was not a great programmer by the end of the year, but he was pretty good for a 12 year old and had two great little programs and some cool stuff to show his friends to show for it.

How to teach computer programming to kids (Part 5) Projects in C, GaugeCam, and PHP

Day 608 of 1000

This is the fifth in a series of posts on how we taught our children to program, what we did wrong and how we think we could have done better.  You can see the introductory post and index to the series by clicking here.

[Previous post]
[Next post]

Sandisk C200 MP3 Audio PlayerChristian only spent half the school year at age 11 learning to program C#.  We really only got him going on it as an afterthought because he was interested.  After he had established a foundation, he got a little bored, I think because he did not have a specific project in mind to practice his skill.  The reason he asked to switch from C# programming to was that we got him a little MP3 audio player.  When he gets a new “toy” like that, he really likes to investigate its capabilities.  He found that it was possible to convert many MP3 players from just audio playback devices into little, general use computers that could run games, videos, and other programs.

The conversion is made by replacing the firmware provided by the hardware vendor to perform audio playback with an open source program called Rockbox.  Rockbox is written in C and Assembly language.  The problem Christian wanted to solve was to make the fonts look better for Rockbox on the Sandisk C200, the one we bought him for his birthday.  To do that Christian did the following:

  • Downloaded the source code
  • Learned how to build and install the code with the gcc compiler
  • Found some anti-aliasing font code to improve the appearance of the fonts
  • Modified the code to run on the Sandisk C200

This new pass through the whole configure-make-install process was much less automated that with the Linux environment.  It moved him up the curve a little bit further and got him his first experience at modifying someone elses C/C++ code to work on a new platform.  The problem was that he finished that in just a couple of months and wanted to move on to a new project.  That is when he decided he needed to know how to build a professional quality website.

Rather than start with something already packaged like WordPress, Christian decided he would use one of the professional quality open source, content management frameworks and build a site from scratch.  After eliminating the idea of using WordPress, he decided on Drupal, so he had to learn PHP.  PHP is a scripting langauge that looks (speaking very roughly here) like HTML with embedded C functions.  It also requires a working knowledge of the MySQL database program.  He spent several months learning how to use the tools, then built himself a site.

In addition to learning how to program a website, he also learned how to work on the aesthetics of his site. I am notoriously bad at making this blog look good.  Christian browbeat me into adjusting the site’s appearance this very weekend.  He still thinks I did a pretty bad job, but he that it is better than it was before.  Part of that is due to the help he gave me on such things as using complementary colors and using the Color Scheme Designer website for help in their selection.

During this whole time, Christian volunteered his time at the GaugeCam project under Dr. Francois Birgand in the Biological and Agricultural Engineering Department at North Carolina State University.  While most of the GaugeCam spent their time gathering data, performing research, testing equipment, etc,, Christian was tasked with building a server to run the website, capture and process results, host a blog, and generally act as the systems administrator on the project for a couple of years.  We gave him an old computer on which he installed a LAMP stack, the operating system and programs to run the server.

The take-away from all this is that Christian stayed engaged in computing with the help of a variety of projects that had specific goals the he wanted to finish and make work.  He learned a lot along the way, a little at a time as it was required for his projects.  The gift of interesting projects with specific goals is one we believe is essential in the effort to learn how to program.  He had one additional project that fits into this category, but that is sufficiently interesting that it requires a post of its own.  Christian figured out how to browse the web on his “dumb” cell phone.  That will be the subject of the next post in this series.

How to teach computer programming to kids (Part 4) C#

Day 605 of 1000

This is the fourth in a series of posts on how we taught our children to program, what we did wrong and how we think we could have done better.  You can see the introductory post and index to the series by clicking here.

[Previous post]
[Next post]

Beginning C# Game ProgrammingAt the beginning of the school year, just before Christian turned 11, we decided it might be a good thing for Christian to learn a object-oriented, non-garbage collected language with a lot of libraries and support.  The three obvious choices were Python, C#, and Java.  If I had to do it again, I probably would hanve started Christian with Python or Java, but I was doing some work in C# on Windows for my job at the time and was playing with Mono (a cross-platform C# implementation).

I wanted Christian to work toward the ability to program something in which he was interested so when I found Beginning C# Game Programming, it seemed a good fit.  The first few chapters explained the concepts of object oriented programming and the C# programming language.  Visual Studio Express, Microsoft’s Integrated Development Environment (IDE) for learners and hobbyists had come out not too long before this, so I spent a couple of hours on a Saturday downloading the program with Christian and showing the fundamentals of how to write, build, and run a “Hello, World!” program.

Next, as part of Christian’s daily homeschool plan, I assigned him to work on C# for fifteen minutes per day.  I wish I could say I assigned the work as part of a rigorous, well-thought plan to teach Christian to program, but the reality is that I assigned it to him because he was excited about learning to program.  I was more concerned that he focus on Literature, Writing, Math, and Science than programming.  We spent a lot more time on those core materials than his programming efforts.

The reality is that all I really did in terms of “teaching” him anything about programming (and I use the word “teaching” very loosely here), is review where he said he was in the book, quiz him a little bit about the concepts in that part of the book, look at how his program ran, and give him a few hints about coding style.  He was on his own with this.  The amazing thing is that he came away with quite a good understanding of Classes, Objects, Encapsulation, Inheritance, Polymorphism, and the concepts of Object Oriented Programming, as well as a pretty good knowledge of how to make things happen in a C# program.

Christian followed this program for about five months to get through the first four or five of chapters of the book.  The reason we stopped and moved on to something else is because Christian’s excitement diminished after about four months.  After that, we stopped programming for awhile so Christian could work on other computing projects.  It was a great exercise that was just long enough to keep a 11 year old kid interested.  Again, if I had to do it over, I would do it differently and will explain how I might have done it in one or more later posts.

Page 4 of 5

Powered by WordPress & Theme by Anders Norén