Adding Timeout to Github Actions

To add a timeout to a Github Actions Workflow, add the timeout-minutes to the workflow YAML file.  See the red box in the image below for where to add it.  Once you save, commit, and push that change to your repo, let your TA know and they will re-enable Actions for your repo after confirming the addition. 

Old Python2 Code Causing you a Headache? Convert Python3 Automagically!

Do you have some Python 2 code hanging around?  Found some example code for exactly what you’re trying to do, but it is written in Python2?  Python 2 has been sunset for a while now.  But converting your Python2 to Python3 can be a pain.  Well, did you know there’s a handy little tool included with most, if not all, Python3 distributions?  I’m using the Anaconda distro, and this tool is super helpful.  

2to3 <filename.py> – this will output a diff of the current Python2 code with changes that should/could be made, but it doesn’t modify the file.  

2to3 -w <filename.py> – this will actually modify filename.py based on the recommendations of the updater.  A backup of the original file will be made, so don’t fret.  

Need more info?  Check out the 2to3 documentation in the Python Docs.  

Happy Coding!

What are the gcc system include paths?

The #include preprocessor directive in c++ is one of the first things that people learn. They come in two varieties:

  1. #include<> – usually meant for system-level includes such as iostream or other headers from libraries installed at the system level.
  2. #include " " – usually meant for files included from a location relative to the code being written… for instance, another header file for a class you just wrote.

But, where are system level headers stored?  On Linux with the gcc tool chain installed, you can execute the following command to find out:

g++ -E -x c++ - -v < /dev/null

  • -E – Stop after the pre-processing step
  • -x c++ – language of interest is c++
  • -v – verbose output

In the output, look for the section that starts with #include <...> search starts here.  A collection of paths is listed after this line which is where the pre-processor will look for any includes that are in <...> (angle brackets).

FWIW, there’s also a way to include additional paths to be used as system includes on the command line when compiling code.

Docker and MySQL

Containers are all the rage, and Docker is the container engine of choice these days.  So, I wanted to provide this tutorial for setting up a MySQL server instance in a Docker container.

[Read more…]

Linux, C++, and Libraries like myHTML

Whenever you write c++ code for a project, have you ever wondered where the actual implementations for iostream’s << and >> operators are?  What about the implementations for all of the algorithms that are in the algorithm header? Whenever you’re building a project and linking in things from external libraries, where’s the compiled version of those functions?  The secret is in libraries of code external to your project. [Read more…]

Testing More than One Thing with Catch

In a modern piece of software, you wouldn’t have tests for just one class.  You’d have exhaustive tests for all the functionality in your program.  However, it would be challenging to put all of the tests in one single tests.cpp file.   [Read more…]

Setting up Docker and MySQL

Docker is an application that simplifies the create/deploy/run software dev cycle by using the concept of containers.  A container is a way to package up an application and all of its dependencies.

Do the following to get Docker installed and a MySQL server running in a container. [Read more…]

More on Linked Lists in C++

Linked lists can be tricky some times.  Here are some additional resources as you’re working through understanding them.

Youtube Videos:

Learning SQL

For those new to it, SQL can be difficult initially to wrap your head around.  One of the reasons is because it requires a different type of thinking from other languages like Java, Python, or C. You have to learn to think in sets (remember all those Venn diagrams from various places throughout school?). [Read more…]

B+ Trees

B+ Trees are very efficient search tree data structures that are related to binary search trees.  They are particularly useful in indexing situations where the entire data set cannot fit into main memory at one time.  Each node in a B+ Tree contains multiple keys and pointers (as compared to 1 key and two pointers in a binary search tree).   [Read more…]