This has been haunting me for quite some time. When building Qt app for Windows, the QImage::save() function did not work for JPEG for deployed applications, while it did work if Qt SDK was installed on the machine. Continue reading →
Here are few optimization techniques that were handy to me recently; they mostly concern 2D graphics programming, where these patterns often emerge, but are helpful anywhere where you have to iterate and update data.
Yes, it’s a clumsy solution, but it does the work just fine… Sure, you can catch the lines in array, and afterwards print them one by one back to file, etc. … but it’s just not at all pretty bash script (enhancements and suggestions welcome!).
Notice that the command is pretty much dependent on the format of the line the BuildNum is defined on, and that “BuildNum” should not appear anywhere else as a second word on the line!
Presented here is a simple bash script for automatic Makefile generating.
This script simply takes all .c, .cpp, .c++ and .cxx files in the current folder, and generates Makefile that builds an executeable from all these sources.
Dependencies are generated using the gcc‘s -MM functionality.
Of course, any comments, reports of use, and suggestions are very much welcome – just leave me a comment! It takes just a moment, and makes me know I didn’t put all the work in posting and updating this for nothing.
While this seems like re-inventing the wheel, it sure is hard to find this code for free on-line (believe me, I tried ).
Of course, you might wanna use iconv for this, but it’s a bit too huge if all you want is UTF-8 <-> wchar_t.
Note: This code is converting UTF-8 to UCS-4-internal, thus it works properly only on systems, where size of wchar_t is 4 bytes (Linux/Unix, BSD, MacOS), but not on Windows, where wchar_t is only 2 bytes!
If you only want a guide to casting in C++, skip to the end of the article. If you want also a bit of technicalities for a better understanding of casting in C++, skip to the one but last section. If you want also a bit of my mind, read the article whole.