marcelpetrick

Qt: libpng warning (exception) about wrong color profile (sRGB)

Written by  on October 1, 2019

Problem: libpng warning: iCCP: known incorrect sRGB profile

When debugging Qt applications which load some PNG as icons at startup, it could be annoying to continue with the debugger for each thrown exception.
So, let us fix them.

Invoking $ mogrify *.png in the icon directory will fix them.

How to get mogrify? Install imagemagick.
Either manually or on macOS via homebrew: $ brew install imagemagick

libPNG in version 1.6 has to be at least installed: $ convert -list format | grep PNG

How to force Win10 to use certain interface for “browsing”

Written by  on September 17, 2019

Problem was that before only two ethernet-interfaces were active. One for the company-intranet (which was gateway for internet) and the second one for some device connection.

After adding some 10 GigE-interface, somehow all DNS-requests were first routed via that interface. Which lead to a delay of 3-4 seconds for loading pages.

Can be fixed via setting a lower metrik to the interface, which influences the routing-table: “network- and sharing option > the specific adapter > “IPv4” > “Settings” > “Advanced settings” > bottom “metric” from “automatic metric” to some lower value. Usually it should be 25, I set 13.
You can check via CMD: $ route print for the current value. The used Gateway should have the lowest metric.

EFI partition on usb-stick: Win10 not able to remove it with the diskmanager

Written by  on September 5, 2019

Regular formatting/diskmanager can not handle it.
Additional tools were not available/allowed to install.

So the trick was to use “diskpart” (CMD ..):

  • then “list disk”
  • “select disk1” (or the one medium which contains the partition(s))
  • “clean”
  • confirm the error

Then use a regular tool to create a new partition.

Qt: Error: Not a signal or slot declaration

Written by  on September 4, 2019

This error is too ‘good’ to be just put into “Today I learned”.

While adapting some unit-testing-code for one of the classes, I received from minGW a error stating:

What is the problem? The member-declaration looked totally valid.
Until I realized I had removed the (now commented) “private”-statement and therefore the pointers were seen by the MOC as signals/slots. Which they weren’t!

Shame on me :’)

Win: run script after executing the VisualStudio-environment-command

Written by  on July 11, 2019

Problem: our CMakeLists.txt contained one specific variable which is just set via the VisualStudio-command-prompt. But I did not want to start that cmd, then execute our “start IDE”-script from there. Naa, too much clicks 😉
Copy this as bat-file to the directory where the qtcreator.bat would be.

python: maximum size of certain containers

Written by  on July 9, 2019

Getting the 64 bit version is quite important. Still don’t get it why for Win the 32 bit one was preferred ..

32 bit: 2147483647 (elements)
64 bit: 9223372036854775807 (elements)

20190711 edit: even if the container could keep that much elements – remember that [Boolean] is 24 Byte (intead of one Bit) in vanilla Python. Means: if you run out of real memory, then MemoryError :/

Education 2019

Written by  on June 27, 2019

Time to reveal the plans of the supervised education for 2019: today my course from the “Volkshochschule” (adult evening school?) for “machine learning with Python” starts (you remember the course for advanced Python I did in May 2018 and which I backep up by doing exercises for Project Euler and “365 days coding challenge”? link ). I am really, really looking forward and am eager to learn 🙂

After this is finished in June my course for basic introduction to Mandarin will start (not a ‘computer’ language, but an interesting one) in addition to my daily Duolingo-exercises for this upcoming lingua franca (from my POV). Will be a challenge, especially the spoken version with its intonations.

Last but not least: on week ago I participated in a course as first responder for emergencies (at work).

And I still plan to do a professional certified course for software architecture (the big picture) in autumn.

edit: repo with a apart of the notes from the machine learning with Python-course are at Github.

Heltec WifiKit 8

Written by  on June 11, 2019

Ordered myself two Wifikit8 Esp8266-based boards from Aliexpress.
Received them after roundabout two weeks and now the fun can start.

With the integrated 0.91″ display (128×32 Pixel) a lot of effort for integrating some display or LEDs can be saved. Just noticed that a LiPo-charger is built-in as well, wow. For 4,50 € not a bad choice. But I am not 100% sure if this is the real device or some copycat – nevertheless: in the end the functionality matters.

First project-idea is to create an extended and verifyable version of the random-reviewer. With display of the currently chosen person, a big buzzer-button as trigger and a web-interface for those who doubt the true randomness ..

good guides:

Qt: clean includes

Written by  on May 20, 2019

(I’ve decided to follow a more agile workflow: instead of creation a “one post covers the whole topic”-post, to post also updates for each step. Article will be therefore edited while “doing”)

Last week I’ve cleaned Qt-includes for a larger project. Like #include to #include how it should be. With proper indirection, so that the Qt-library handles how and where the class is implemented.
A colleauge raised the question, why not use #include to be even more precise and to see the used module directly (needed for the CMakeLists or qmake).

First step: identify all used Qt-includes

Greps all includes starting with an uppercase Q; then split the result at the “:”; then sort und make it unique

Second step: create a replacement-list and a (python?) script which does this for all .h/.cpp-files
tdb

C++: proper init for double/float and the proper check

Written by  on May 9, 2019

Problem was that I initialized some doubles with 0.0 and then hoped that the imported values are assigned, which does not happen always. So a check was needed. But checking if(0.0 == x) is a really bad idea. MinGW will tell you too (as other compilers).
So I was searching for a proper way to check against 0.0. And then I found a better idea: initialize with NaN and use the standard-check against this. Much better!

(addendum: I know, a variant would be the best to fix the given task.)