20210818
Poky-toolchain-shellscripts are tar.xz archives. Just rename (or force) extraction to check their content.
20200914
There is a major difference between PyQt5 and PySide: the frequency of the release of the GIL determine show responsive the ui can become with several threads: https://bugreports.qt.io/browse/PYSIDE-803?focusedCommentId=496894&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-496894
20200903
Nice page for comparison of rivalling tools, languages and devices: https://www.educba.com
202006017
(also a todo)
While following the ususal trailing-whitespace-discussion I’ve checked if not a pre-commit-hook (for git) could solve the issue. Yes, it can. Then I trailed a bit further to something purely python-specific: https://ljvmiranda921.github.io/notebook/2018/06/21/precommits-using-black-and-flake8/
Should try this. Currently I use no linter or formatter for python.
20200409:
Check (inside a delegate) if inside the current model (of the QTableWidget) is already the newly entered name (string):
1 2 3 4 5 6 7 8 9 10 11 12 |
QString newText{"foo"}; auto allTheHits = model->match( model->index(0, 0), Qt::DisplayRole, QVariant::fromValue(newText), -1, // get all hits! Qt::MatchRecursive); if(!allTheHits.empty()) { qDebug() << "New name was already used: use something else."; return; } |
The model is actually a QAbstractItemModel.
20200306:
Get short summary of all the changes since certain tag/id until now (head of master):
$ git log --pretty=oneline --abbrev-commit oldTag..HEAD
20200302:
Build the Qt-SDK with asserts in release-mode:
qglobal.h:
1 2 3 4 5 6 7 |
#if !defined(Q_ASSERT) # if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) # define Q_ASSERT(cond) qt_noop() # else # define Q_ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop()) # endif #endif |
See: https://stackoverflow.com/questions/12573230/q-assert-release-build-semantics/12573446#12573446
20200229:
Problem: files added to .gitignore, but they still show up as changed?
Cause: they were version controlled at least once before
Solution: remove them from the cache
1 |
$ git rm -r --cached <folder> |
20200225:
Visual Studio 2015, C#: running an unit-test multiple tims via the UI is not possible.
Solution: create a unit-test, which runs the respective test several times ..
1 2 3 4 5 6 7 8 9 |
[TestMethod] [TestCategory("CalculationTests")] public void FakyMultiTest() { for(int i = 0; i < 100; i++) { TestCalculation(); } } |
20200213:
homebrew (brew) quick-guide for macOS:
brew update – update the current state and brew itself
brew outdated – show which packages are not up-to-date
brew upgrade – clean, new shiny everything ..
20200212:
grep hints
-n : show linenumbers
-i : case-insensitive search
-v : inverted match
20200210:
Also my personal opinion and way to handle it, if I have the freedom: Dead code should be removed Else the next developer who checks a certain code-block starts to wonder (is this necessary or not?) and has now two issues to worry about 🙂
20200124:
When using heob for memory-profiling and doing leak-analysis with QtCreator, set “-oleaks.html” into the Extra Arguments field, and see if the generated leaks.html meets your needs.
20200115:
Create polls for finding a date (without Doodle): Framadate@digitalcourage
20200110:
Acquired today the KDAB-badge (besides the one from Microsoft) by helping them with their homebrew-recipes (Ruby, which I totally don’t use ..) for GammaRay xD
Not sure for what this is good for.
20200108:
Ok, current ‘location’ blocks certain pages, but I want to check the catcam!
Solution: use a in-browser page-renderer like https://www.browserling.com/browse/win/7/firefox/68/miezmiezmiez.tumblr.com
20191211:
Consulted the Qt-documentation about QMetaObject while developing a new feature … “This class is not normally required for application programming, but it is useful if you write meta-applications, such as scripting engines or GUI builders.” xD #madeMyDay #Qt
20191202:
‘warning: padding class ..’-hint from GCC explained. And how to avoid wasted space.
20191112:
For the ten-thousandth time: restore an accidentally closed tab in Firefox: CTRL+SHIFT+T
20191111:
‘systeminfo’ cmd for CMD on Windows prints lots of useful OS- and network-related information.
20191002:
Primer for C#/.NET: https://www.dotnetperls.com/array
20190917:
If there is a type-conversion problem in your code, you get the mangled names: h and j, but for what do they stand?
C++ name demangling can help: c++filt
1 2 |
λ c++filt.exe -t h unsigned char |
20190902:
C++; minGW; undefined reference at link-time even if everything seems right?
Did you forget to add a XYZ_EXPORT flag to the class declaration?
1 2 3 4 5 6 |
#if defined (__MINGW32__) || defined (__MINGW64__) # ifdef MAKE_XYZ # define XYZ_EXPORT __declspec(dllexport) # else # define XYZ_EXPORT __declspec(dllimport) # endif |
20190828:
Print readme.md-files (or whatever markup) in a fashionable way: try gitprint by using the github-url to the document and replace github->gitprint.
example: https://gitprint.com/google/googletest/blob/master/googlemock/docs/for_dummies.md?print
20190822:
macOS names and numbers:
for everyone who preferes numbers over names:
Mac OS X 10.6 Snow Leopard
Mac OS X 10.7 Lion
OS X 10.8 Mountain Lion
OS X 10.9 Mavericks
OS X 10.10 Yosemite
OS X 10.11 El Capitan
macOS 10.12 Sierra
macOS 10.13 High Sierra
macOS 10.14 Mojave <– current
macOS 10.15 Catalina <– upcoming
20190813:
Creating a smol program which calls some DLL-functions (also C#) results at runtime before even the very first breakpoint is reached something like:
An unhandled exception of type 'System.BadImageFormatException' occurred in mscorlib.dll
Solution: make sure DLLs and code use the same target framework version for .NET! Both 3.5 in my case. Can be done via “solution > properties”.
20190722:
Save and/or view openCV-mask (image) as picture for evaluation:
1 2 3 4 5 6 7 8 9 10 |
// testing: get the mask and save it to file static int counter = 1000; QString filename("maskImage"); filename.append(QString::number(counter)).append(".png"); cv::imwrite(filename.toStdString(), maskImage); counter++; // just for testing cv::imshow(filename.toStdString(), maskImage); // attention - does not close the view until end of program-run cv::waitKey(); |
20190718:
Converting from a QVariant-container back to your arbitrary container of custom class:
inVariant->getProperty(propertyString).value<QList>();
toList() on non QVariant-convertable items will yield a list of size 0 and this is unexpected when the gdb can show the QVariant’s contents.
Also check that tutorial before worrying again too much xD
20190626:
Get all findings with grep but without path or line-number:
git grep -h "de <Q"
20190613:
Sometimes a warning about “Prior to the resolution of a defect report against ISO C++11 ..” a warning by the code-model of QtCreator is given (due to -Wreturn-std-move-in-c++11 ), which can be suppressed by adding a std::move(returnValue) to the return.
20190612:
Fucked something up? Revert all changes and make sure no artifacts (which are not version-controlled) remain:
1 2 |
git reset --hard git clean -xfd |
20190528:
Ifdef in InnoSetup-scripts are possible and usable. StackOverflow also mentions that setting their value by commandline should be possible: call with “/DUSE_SPECIALCOMP 1”
1 2 3 4 5 6 |
; LS-1661: define if certain components shall be added or not. By default: not. ;#define USE_SPECIALCOMP 1 ; usage: ;#ifdef USE_SPECIALCOMP ; // do whatever is necessary ;#endif |
20190522:
C# bootcamp continues – learning things the hard and fast way.
Yesterday I broke a lot of tests by just converting structs to classes and adding default inits to the values. Could mbe due to the mix with C-functions ..
Found a way around: keep as struct, but add the default ctor for the struct with optional params for each field. Like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
internal struct myStruct { /// LS_Handle_t->int32_t->int public int _handle; public double _frequency; /// double[2048] [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2048, ArraySubType = UnmanagedType.LPArray)] public double[] _out_modData; public LS_LTOPD_LuminanceModulation_t( int devHandle = 0, float samplFreq = 0.0, double[] outModMeasData = null) // note how the array is "null"ed; no = {} { _in_deviceHandle = devHandle; _in_samplingFrequency = samplFreq; _out_modulationMeasurementData = outModMeasData; } } |
Special characters for the XML-comments have to be HTML-escaped (or use CDATA): < would be < ..
handling of the IDE (Visual Studio 2015):
- auto-format code with Visual Studio 2015: CTRL+K, CTRL+F
- close the current file: CTRL + F4
- go to the last view: CTRL + –
20190521:
I made it my task to acquire as much C#-knowledge as possible, because a tiny part of the project is some C# SDK and we needed a volunteer to groom it. Guess who raised his hand? 😉
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
// init a IntPtr as nullptr (C++) public System.IntPtr _out_data = System.IntPtr.Zero; // init an array public params[] _in_paramPairs = {}; // init an enum: mind the . instead of ::! MyEnum_t var = MyEnum_t.blubb; // init a string string message = System.String.Empty; // or string.empty in simplified form // structs can't have an unparameterized default constructur, which inits all fields // Therefore use a class. internal class FooBar { public int number = 0; } |
StructLayoutAttribute:
Before it was applied to a struct, does it work for class too? Documentation says: “You can apply this attribute to classes or structures.
Typically, the common language runtime controls the physical layout of the data fields of a class or structure in managed memory. However, if you want to arrange the class or structure needs in a certain way, you can use StructLayoutAttribute. Explicit control of a class layout is important if the class is to be passed to unmanaged code that expects a specific layout.”
Visual Studio (2015) quick help:
F12 : jump to implementation
CTRL + “-” : go back to last view
More later – maybe I make a real blog-entry out of it.
20190430:
Even big corporate repositories are not shiny and polished: but this is just another opportunity for me to participate. Found some typos in the documentation of Microsoft’s SymCrypt. Solved it and created a pull request 🙂
20190429:
Even Qt 5.11 (5.12 is latest, I know) treats big chunks of data with the idea “Oh, size of an object won’t be bigger than what fits into 31 bit” and boom, here hits you the well-known 2 GiByte-limit. This is super annyoing if you use a QByteArray or QDataStream::writeRawData / QDataStream::readRawData.
So I rewrote those calls to separate the data into chunks of 1 GiByte and write/read them sequentially. Works, but somehow felt slower and the code becomes uglier. Bit it works, yay!
20190425:
Win, Cmake, MinGW, Qt 5.12: suddenly after switching from Qt 5.11 an errror while starting the app popped up: “This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: direct2d, minimal, offscreen, windows.”
Copying the “platforms”-folder to the location where the executable is, did not help (like it should). The Cmake already deploys properly.
Workaround was found via one hidden stackoverflow-comment, because I can’t use the windeploy-tool here.
So: create a file names “qt.conf” with content inside the exe-directory:
[Paths]
Prefix = .
20190404:
How to reset the state of the filesystem of the git-repo to “just like after checkout”: $ git clean -xfd
20190401:
QtCreator: Alt+Enter on a member opens the context-menu for refactoring (“Create Setter/Getter functions”). Better this than RMB + clicks for each member.
20190401:
Parsing XML files with Qt/C++: QXmlQuery was not my way to go – QDomDocument/QDomNodeList and QDomElement were my friends. Example: read node P and put as double into a QVariant.
QDomElement const elemP = node.firstChildElement("P");
QVariant vP = elemP.text().toDouble();
20190214:
C++ has (now) a quite nice way to determine the supported number of threads: std::thread::hardware_concurrency();
See: https://en.cppreference.com/w/cpp/thread/thread/hardware_concurrency
20190207:
Experienced first time in QtCreator “FTH: (15020): *** Fault tolerant heap shim applied to current process. This is usually due to previous crashes. ***”
Better explanation than I could provide here: https://forum.qt.io/topic/94341/fault-tolerant-heap-shim-error
20190129:
There is a map where you can check where which SSID (wifi identifier) was found: https://wigle.net/
20180920:
Visual Studio 2013 (at least) has an integrated ico-file-editor which is quite convenient for painting application-symbols. Integrating it to some qmake-project (Cullendula) was simple.
20180918:
* C plus equal: the feminist version of C++. Not sure if this is nice, obscure or a joke? I had some good laughs while reading the manual and the examples. https://github.com/TheFeministSoftwareFoundation/C-plus-Equality
20180917:
* github.io – and how to create my own (https://marcelpetrick.github.io/)
* The void operator()() for C++. Nice for iteration of containers.
* boost::accumulators for easier data-collection: nice for min, max, mean, etc.
20180913: Use a lambda-expression for delayed triggering of a function-call.
1 |
QTimer::singleShot(200, [=]() { functionCall(); qDebug() << "called: functionCall()"; }); |
20180904: the online-installers for Qt5.11 and Visual Studio 2017 Community Editon will download 18 GiByte during installation :’)
20180903: how to configure and use cmake for an originally qmake-based project. And even the linking works now. More later 🙂
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
tanteedith@miniPC ~/Desktop/Softwarekrams/BSB $ make all Scanning dependencies of target BowlingScoreBoard_automoc [ 20%] Automatic moc and uic for target BowlingScoreBoard Generating ui_BSB_MainWindow.h Generating moc_BSB_MainWindow.cpp Generating moc_BSB_UdpListener.cpp [ 20%] Built target BowlingScoreBoard_automoc Scanning dependencies of target BowlingScoreBoard [ 40%] Building CXX object CMakeFiles/BowlingScoreBoard.dir/main.o [ 60%] Building CXX object CMakeFiles/BowlingScoreBoard.dir/BSB_MainWindow.o [ 80%] Building CXX object CMakeFiles/BowlingScoreBoard.dir/BSB_UdpListener.o [100%] Building CXX object CMakeFiles/BowlingScoreBoard.dir/BowlingScoreBoard_automoc.o Linking CXX executable BowlingScoreBoard [100%] Built target BowlingScoreBoard tanteedith@miniPC ~/Desktop/Softwarekrams/BSB $ |
20180826: std-lib has some pretty nice random-number-generators (Mersenne-twister), which can be seeded properly with system-time:
1 2 3 4 5 6 7 8 9 10 |
#include <random> #include <chrono> .. { mRandEngine.seed(std::chrono::system_clock::now().time_since_epoch().count()); std::uniform_int_distribution<> distribution(0, 2); mA = distribution(mRandEngine); mB = distribution(mRandEngine); } |
20180824: Lambda-expressions in Qt-slots are quite nice for “one liner”-functions. Saves much space.