Posted on

VirtualBox VM install of Linux Ubunutu or Lubunutu 18

I started to install Lubuntu 18 (a variant of Ubunutu) but the window graphics became corrupted after I selected the language. This is a known bug that sometimes occurs and there are various suggestions to workaround the problem.  What worked for me?

  1. Press Ctrl+Alt+F1
  2. Press Ctrl+Alt+F7
  3. Press Ctrl+Alt+F1

The screen went to a black blinking cursor and then back to normal.

Good luck!

Posted on

RED – how to match lines that don’t contain a character

Time for another Regular Expression of the Day! Let’s say you are looking for all of the lines that don’t have a special character (like an ‘_’ underscore). Here is it:


Start of line, followed by characters that are NOT underscore, followed by End of line

It’s a little confusing that the start of line indicator is a carrot so if you think of it instead as the NOT the end of line indicator it helps

Posted on

Using grep on Windows to recursively find a C++ class definition in a header

There are so many grep examples out there but if you want to use grep on Windows to find something recursively in just one file type it can get a bit tricky.  Here is the quick 2 step process:

  1. get grep. you can find it here

  2. add path to grep into your PATH by opening the Windows start menu and typing “env” then selecting Edit environment variables
    Windows Environment Variables
  3. open a command prompt by opening the Windows start menu and typing “cmd” then press Enter
  4. enter a grep command.  for example, to find a class definition in all .h files it might be:
    grep -r --include=*.h "class WhereIsThatClass" *
Posted on

How to maintain aspect ratio for QPixmap as a QWidget instead of QLabel

There are so many times that I have wanted an easy way to show a QPixmap on a form while maintaining the aspect-ratio of the image that I finally sat down and made one.  The single header file can be downloaded here: Extract the .h file and add it to any Qt project. It provides all of the necessary features to show an image when and where you want it using the SpworksWidgetImage class.


// Don't forget to #include "spworkswidgetimage.h"

// SETUP //

SpworksWidgetImage* scaledImage = new SpworksWidgetImage();


// fill the widget to 75% of the widget's size

// place the image in the bottom right corner of the widget
scaledImage->SpworksWidgetImage_SetAlignment(Qt::AlignRight | Qt::AlignBottom);

// paint the background of the entire widget white before painting the pixmap

// place a hidden border around the widget to keep the image off the edge

Posted on

How to quickly trim audio files

I can’t take credit for this post. Yes, I am the one writing the post, but the software I downloaded is just so incredibly powerful and easy to use that I feel guilty telling anyone how to use it. Still, I am about to shave a few minutes off your setup time so here goes…

1. Download SoX for your platform. I am going to use Windows for this “How To”
Here’s a link:
2. Open the folder you installed SoX to. I chose D:\tools\sox because I like to put all of my favorite command line tools in one place.
3. Right click the example batch file and choose edit.  This will open Notepad and you can replace all of the text with the following:
cd %~dp0
mkdir "sox output"
FOR %%A IN (%*) DO sox %%A "sox output/%%~nxA" fade 0 10 .5 rate -v 48000

5. Save and close the batch file
4. Now just drag and drop any number of audio files onto the batch file and it will create a folder called “sox output” and save the first 10 seconds of each file to the new folder. The files will fade out quickly at the end so that you won’t hear any annoying clicks/pops that you would if you had just trimmed the file.

The full documentation for SoX comes with the installer as a PDF and includes lots of examples.

Have fun!

Posted on

Moving Visual Studio Projects with Qt Integration

If you get an error like this:

The system cannot find the path specified.

or like this:

error MSB6006: "cmd.exe" exited with code 3.

Then you may need to just change your Qt Version under Qt Project Settings. The trick is that you must change from one valid Qt Version to another valid Qt Version. For example, if your current version is set to $(DefaultQtVersion) then you should change it to the explicit version entry. Make sure you actually apply the changed setting because otherwise nothing will happen. Once you have changed and applied the new setting, you can change it back and it may fix the problem.

Good luck!

Posted on

VLC Media Player with Telnet (TCP) Control

This post is going to take some time to develop properly.  Here is what to do for those who understand how:

  1. open a command prompt with administrative privileges
  2. change directory to where your VLC exe is found
  3. execute the following command
    vlc -I ntservice --ntservice-install --ntservice-extraintf=telnet --telnet-host= --telnet-password=12345
  4. Note: set the ip address to your IP or try if you want to work with all interfaces.  Also, the password is required to make the telnet server work so either keep it as 12345 or select your own.
  5. open a telnet client and connect to TCP port 4212

What is missing?  You may need to enter some firewall rules.  You may need to set some additional configuration options such as which IP to bind to, the port to use, etc.  I’ll try to provide more detailed configuration steps sometime in the future.

Good luck!