marcelpetrick

Linux Mint 17.3: upgrade CMake

Written by  on September 3, 2018

Ok, cmake 2.8 was installed – I need 3.0. At least. For C++11 features.
The good old Ubuntu-forum helped. This is the condensed version:

Patterns, idioms, whatchamacallit?

Written by  on September 3, 2018

Had first an interesting discussion if you can call the “patterns” we use patterns. Or if there are no “patterns” in software-development, just “idioms”. Of course, quite academical question.
But it reminded me to remove the dust & spider-webs from my own knowledge and refresh it a bit. What’s better than doing it with some C++17 – support?

The other book was just referenced in some software architecture-book. Interesting collection of anecdotes. I can confirm half of the given examples as “seen in real life and projects” ..

First pull-request on github, yay!

Written by  on August 5, 2018

Searched for a usable NTP-library, which assorts well with Qt and stumbled over qntp. While fiddling around I noticed in their source some opportunities to improve the code. So I cloned the repo, did them and created my very first pull-request for open-source ๐Ÿ™‚
(Side-note: currently mostly Python-code is pushed due to the daily coding-challenge. But C++/Qt is still my carthorse.)

keep the catcam up to date

Written by  on July 10, 2018

Logging in to the raspberry(ies) to update them on a regular basis takes time and effort. Both are currently dear.
Also: while the catcam is taking pictures, you can’t update the rpi-binaries.

So I made this nice script, which first suspends the catcam-operation while renaming the script from the cronjob, then does all updates, reverts the renaming and then reboots the MCU.

Make it executeable via ‘sudo chmod +X updateCatcam.sh’ and also add it as cronjob (once a day).

rsync: get all files from the camera’s sd-card .. without interruption

Written by  on July 6, 2018

Of course, you need the same source- and target-directory ๐Ÿ˜‰
Using this, because Nautilus (or how that horrible explorer is called) is prone to auto-unmounting the card while transfer due to heavy load ..

โ€œTell me and I forget, teach me and I may remember, involve me and I learn.โ€

Written by  on June 22, 2018

I can use the quote from Benjamin Franklin or the straight-forward one from my professor “You learn programming by programming.”. So, for gaining further knowledge about Python and how to use it, I subscribed to the mailing-list @ dailycodingproblem.com and try to solve every day a new problem. Most of them seem easily doable, because – at least – I know algorithms and have developed software for some ~years~ decades. But then hypocrisy hits reality and I realize that my Python-skills are virtually non-existant ๐Ÿ™‚ So I do a lot of look-ups at stackoverflow, the internet and the manuals for python-standard-libraries. And this is fine, totally fine. Because this way I learn (it the hard way).
Results are committed at: https://github.com/marcelpetrick/pythonCollection/tree/master/dailyCodingTask

And – which I am really happy about – I tend to write proper unit-tests BEFORE I start implementing the real functionality!
dailycodingproblem.com always adds some example-data and the expected result. This is already the first test.

ESP32: first hands on MAX7219 and WiFi

Written by  on May 29, 2018

For an investment of 80-90 minutes time I am quite happy about the result and amazed what sohisticated capabilites are offered at some really easily accessible level.
What has been achieved so far?
* setting up a working Arduino Studio 1.8.5-environment with ESP32-toolchain on a Win7-laptop (not my favorite, but Linux-PC was blocked)
* setting proper options to the IDE to make the examples compile and upload via serial to the board; learn how to use the integrated serial-monitor
* finding the proper PIN-setup for the MAX7219-LED-display (just one module – for now) and setting up the library
* playing around with the WiFi-functionality (scanning for networks)
* putting both tasks (network scan and led-output) together and running into the first “I need threads”-pit


[Video was taken at an early stage: a static string is displayed.]

Of course, THIS is nothing, just the very first tiny baby-step. Everyone is able to achieve this, because almost no creativity needs to be invested.
But: configuring all the necessary tools was already a pain in the ass. Of course, just read the manual(s) [..]
But this is not a “unwrap and press start”-toy, so the learning-curve was steeper than expected.
But I did it. And I look forward. Especially to put some threaded application on the MCU, because – why just run one thread, when you can have two? ๐Ÿ˜‰

[The MAX7219 and the ESP32-dev-board from MakerHawk hours before the first test run. Battery pack not included.]

MPC: adding additional DEFINES

Written by  on May 25, 2018

Some weeks ago I noticed how the qDebug()-output could be enriched, so that in bigger solutions with a lot of different “unknown” components a reported error could be immediately pinned. And you save writing always __FILE__ and __LINE__. Referres to this post.
But the problem was that with the mpc-buildsystem it was unknown to me how to force it to put this DEFINE into the vcxproj-files.

It can be done via the “macros”-statement!

So I worked on my Python-skills and wrote a short script which iterates the given path recursively and fixes all mpc-files by checking for the position of the line with the last closingbrace “}” and then it adds before that position the line. Of course, the experts know several thousand ways to improve that script – but I am currently happy with it. It works, it is debug-able (.sh, I look at you!) and I will use the skeleton also for some other tasks.
It can be found (like most Python-snippets) at: https://github.com/marcelpetrick/pythonCollection

Preventing the crash of the performance-profiler from Visual Studio (2013-2017) due to Meltdown-/Spectre-patches

Written by  on May 24, 2018

I needed some analytical help from Visual Studio (due to the fact that MTuner and AQTimer could not work properly with our suite). So, I build my solution, fire up the “Performance Profiling” in VS2015 and *zump* computer reboots.
Discussions and investigations led to the thesis that some Windows-patches are the culprit, because they prevent that previously used hooks are usable.
So, setting those two lines in an admin-enabled cmd.exe (plus reboot) lead to alleviation:

Python-advanced level-seminar: lifelong learning

Written by  on May 9, 2018

I am currently traveling back from my very first paid educational leave. Proper selection, arrangement and preparation lead to some awesome impressions: about the capabilities of Python and about the city of Detmold.
Daniel Warner lead us – an assembly of five inquisitive men in the age-range from 30 to 60 – along the details and
specialties of that programming language. I learned much, in detail:

  • basic structures; list comprehension
  • classes; objects; overrides; imports; representation; init-method
  • dictionaries for caching results (memoisation)
  • decorators (nice for for printing, caching and thread-safety)
  • descriptors, properties and slots, kwargs
  • (multi-)inheritance and its quirks
  • recursive functions; functional programming
  • threads, synchronisation, atomic access

I put all the exercises (full script with my own annotations) into a Git-repository right from the beginning and published it:ย https://github.com/marcelpetrick/Python_FortgeschrittenenSeminar/.
Which also makes a nice view of the github-history ๐Ÿ™‚

Python was chosen by me by intent: I see and plan for ways to use it with artifical intelligence (TensorFlow-binding ..); microcontroller-programming (ESP can run MicroPython) and for the Raspberry (currently the tumblr-upload-script for the catcam is also Python); for daily data-manipulation-tasks which are currently done more or less on Bash or AutoIt or Batch – and then: write it once, run it both on Linux and Win).
This was a great choice! And I want to thank my wife for supporting these stays absent from home and my plan to achieve the wanted education ๐Ÿ™‚ And I got a small certificate – but that’s just icing on the cake.

My plan as first real exercise is to re-implement the “find all islands in the given map”-programming challenge. This will be fun. Getting to know some specialties and what properties/slots mean in Python-context (compared to the Qt-ones) was nice. And the decorators are a really powerful way to add special functionality to methods without bloating them and without blocking the view to the busines logic.