I decided to start gathering some C code that I have written over the years into an easy to use library. The easy to use part is a work in progress but I plan to add lots of simple use cases to and documentation to help anyone who wants to use it.
Here’s the link
There is a great command line tool that comes with Ubunutu called “nmcli”
Here is how to disable the Wifi radio:
sudo nmcli r all off
and for everything else it is easy to get help by typing
or about a specific thing like
nmcli radio help
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?
- Press Ctrl+Alt+F1
- Press Ctrl+Alt+F7
- Press Ctrl+Alt+F1
The screen went to a black blinking cursor and then back to normal.
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
Google left out a lot of steps in their tutorial on using the App Engine to access a Datastore. Not only that, but if you want to run Python 3.x and 2.x on the same machine there are some simple ways to handle it that Google never explains. Here is the run down:
1. download and install python 3.x from the python website. this will include the py.exe python launcher
2. download and install python 2,x because Google doesn’t support 3.x when this was written
3. download and install the google cloud SDK and don’t use their bundled python option
4. when you open the google sdk command prompt, enter this to use the correct python version: SET PY_PYTHON=2
That’s it for the setup portion. Now for the real problem! You cannot execute the dev_appserver.py ./ python script and have it open a http server as expected. It will run and say something like “update#setState idle”
Also, you will get get an error (ERR_CONNECTION_REFUSED) trying to connect to locahost:8080. You need to do the following instead:
1. as mentioned in the install instructions for google cloud python sdk, you must install the missing python components using gcloud commands from a temp directory somewhere on your computer. This usually works:
2. now enter the gcloud command:
gcloud components install app-engine-python
and when that is done get the extras because it didn’t work for me without them:
gcloud components install app-engine-python-extras
3. now you can run the dev_appserver.py but you have to use the py.exe launcher to make sure the correct v2 python exe is used, so change directories to where your project is and enter this command:
py “C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\dev_appserver.py” ./app.yaml
4. open a web browser and go to http://localhost:8080 to see the results
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:
- get grep. you can find it here http://gnuwin32.sourceforge.net/packages/grep.htm
- add path to grep into your PATH by opening the Windows start menu and typing “env” then selecting Edit environment variables
- open a command prompt by opening the Windows start menu and typing “cmd” then press Enter
- enter a grep command. for example, to find a class definition in all .h files it might be:
grep -r --include=*.h "class WhereIsThatClass" *
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: SpworksWidgetImage.zip. 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();
// OPTIONAL SETTINGS //
// 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
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: http://sox.sourceforge.net/
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:
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.
I am looking for a 3D CAD software that is simple to learn and affordable. Three things I am looking for in particular are: able to work in quad-view (top, front, side, 3d), able to enter dimensions using the keyboard, and able to snap to grid and objects during object creation and editing.
Rhino 5 https://www.rhino3d.com/ is a very full featured CAD software. I was able to quickly get started creating boxes and editing dimensions. I had to search the forums for help on getting objects to snap to each other but it was frustrating because I had to explicitly type the command to use each time I wanted to move or resize an object. It was also difficult because the only way to begin the snap operation was to press the left mouse button, which had to be pressed each time a different snap location was selected. This made editing a very slow process.
Retail pricing at the time this was written (Oct 27, 2017) was a little on the high side and also weird. Windows version was priced at $995 USD while the Mac version was priced at $695.00 USD. There was no mention of a different feature set so this was a very steep cost to run on Windows.
One last thing, when I was ready to remove the evaluation copy of this software I found that I had to uninstall 5 separate packages on Windows. This is not unheard of, but it could have been better.
Overall I would recommend trying Rhino 5. It is worth the time to evaluate and, like I said, is very fully featured. Unfortunately, it just did not meet my needs.
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.