C++

Remove multiple newlines from a file

Written by  on April 29, 2015

===========================
Warning 20150507: Just noticed, that the sed-expression also filters identical “not empty” lines from you file! This is not what I wanted. So if you have code with array-initialisations which use the same lines or multiple consecutive calls of the same function, then be careful and check the result of the following command with diff!

Hint 20150508: take a look at this code-snippet. Just copy&paste&compile&run.
===========================

Task to achieve is: remove the superfluous double or triple empty lines between functions. One empty line as separator is acceptable. Two are annoying ..
Workflow is: filter the original source-file and put it into a new file. Remove the old one and replace it.

Maybe I should put it into a shellscript which parses the given directory recursively and applies this to all *., *cpp, *.hpp ..

useless data pt. II

Written by  on March 28, 2015

If you ever wondered how many times you compiled your project {today, the last week, ..} and got no answer: here is a clue.
Add the command “date >> someTextFile.txt” as custom command to QtCreator as build step before make is executed.
This will insert everytime you compile a new line with the current time into a textfile. Processing that data is your own task.
Small hint: if you are lazy and just want some alltime-stats use “wc compileDates.txt” 😉

compileRuns

Edit 20150407:
If you are just interested in the date, use this:

Qt-inheritance: hitting rock bottom

Written by  on February 26, 2015
  • missing semicolon
  • missing Q_Object
  • missing “public” for the inherited class
  • ctor/dtor private ..