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

Tag: Qt

Weekend learning (and setting up to learn)

This last weekend, I spent most of the weekend taking Grandpa Milo and Grandma Sarah around and working on the learning/development stuff I have described here over the last few weeks. It has felt like I have been trying to drink through the proverbial fire hose in an effort to learn too much stuff at once, so I have started to break it up into bite-size chunks. When I did that, I realized I needed to do some infrastructure work before I even started. So this weekend, I decided to spend most of my time getting set up to work rather than invest a lot of time in learning. I held to that for the most part; the exception being that I started in on a set of tutorials on how to use GIT.

So, here is what I did:

  • Decided to use DropBox as a way to back up and share a bunch of stuff (bought a tera-byte for a year).
  • Set up a web server with WAMP on the new (cheap) desktop computer we had Fry’s make for us (on a special).
  • Made it available from other places with the help of Duck DNS (awesome free service).
  • Added an ftp server to that.
  • Installed Ubuntu LAMP server on the old desktop (32-bit x386)
  • Set up a GIT repository on that.
  • Made it available in other places with Duck DNS
  • Installed R and RStudio on all the computers
  • Went through the first third of a GIT tutorial because I am so pathetic at that. It was great and I am up and going now.
  • Added Qt, Qt Creator and OpenCV to the Linux server
  • Added XMing to my laptop
  • Learned how to SSH to the Linux box to perform code testing remotely

Next, I am going to start working up the learning curve on Machine Learning with R and continue to code on my previous projects. All-in-all, it was a great weekend. Lorena and I even went out to eat a couple of times. Now, all I have to do is start working in a few walks and my life might arrive at a sense of normalcy again.

Betty Blonde #303 – 09/15/2009
Betty Blonde #303
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.

Programming and comic strips: An example

Kelly has decided she wants to start drawing her comic strip again as she has time. You can see an example of what she did before at the bottom of this post. She is going to do something different now, but plans to do a four panel strip like before. I wrote up some code to accumulate the hand draw single panels, add titles, copyright notices, borders, etc, and then post the results to our website. I could easily dust off the old code and use it again for her current efforts, but have decided to try to rewrite it as a way to improve some new skills on which I am working.

The idea will be to write a series of blog posts on how to set up an environment to write low level code that needs to go fast in C++ and the GUI and everything else in Python. I plan to talk about how I use Qt Creator, OpenCV, SWIG, PyCharm, PySide, some batch files, and a merge tool to automate this and make it easier. I am at the beginning of another series called Our Homeschool Story that I will also continue, but this is a very different thing that will provide some variety. I hope to start sometime over Christmas break.

Betty Blonde #220 – 05/20/2009
Betty Blonde #220
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.

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.

Powered by WordPress & Theme by Anders Norén