Iterating a C++ std::list

Set up a list to store pointers to a “Points” class…

list<Point*> m_pointList;

Add to the list…

Point* p = new Point(x, y);

Then iterate the list using this…

std::list<Point*>::iterator it = m_pointList.begin();
while (it != m_pointList.end())
    Point* p = *it;

    // do something with the Point here!


…or, if you’d prefer a for loop…

for(std::list<Point*>::iterator it = m_pointList.begin(); it != m_pointList.end(); ++it)
    Point* p = *it;
    // do something with the Point here!

Installing CUDA

Here’s the process for installing CUDA. I’m installing version 11.4 update 2, but the process has been the same for a while now.

  1. Go to the CUDA SDK download page here

2. Select the OS. As you select content, more buttons will appear to narrow the download content so it’s specific to your device. When prompted, I use a network install. This will download a small stub and then pull additional content as it’s needed. For Windows 10 64bit, I ended up with this display…

3. Download the installer and run it. It will ask for a temp directory to store content in. I go with the default: –

4. If you’re happy with it, then accept the licensing agreement

5. Select Express install. This puts all of the core features in

6. Wait for the content to download…

7. Wait for the Install to complete…

8. When complete, the installation will show the components installed so you know what’s been done.

9. Click “Close” and the install is complete

That’s the lot. Hope it helps!

Adding a Display Capture to OBS

I recently did a quick overview of how to install OBS here. The process to add display capture is as follows: –

  1. Click the “+” button in the “Sources” area

2. Select “Display Capture” in the list that pops up

3. Under “Create new” accept the default or name your display as you’d like and then click “OK”

4. Select the display you’d like to use and click “OK”

…and that’s it. If you’d like to add a webcam then take a look here.

Hope it helps!

Adding a webcam to OBS

I did a quick overview of how to install OBS here. If you’d like to add a webcam to that install then here’s how you do it…

  1. Click on the “+” in the “Sources” area.

2. Select “Video Capture Device”

3. In the “Create new” textbox enter “Webcam” (or whatever you want to call it) and click “OK”

4. Select the Webcam or capture device you want to use and press the “OK” button. In my case my webcam showed up as “USB Video Device”

5. The webcam will now show in the main view. You can drag and re-size it if required.

That’s the lot. Hope it helped!

Installing OBS

OBS is a handy piece of software for capturing and streaming video. I use it when I’m doing tutorials for work but I’m also going to start pushing “How To” videos so I thought I’d do a quick overview of the set-up process.

  1. First, go to and download the installer that works for your set-up. I’m using Windows 10 64bit for this example
  2. Run the installer and you’ll see the screenshot below. Hit “Next”

3. Accept the license information by pressing “Next” (if you’re happy with it that is)

4. Set the install location or leave it as default and click “Install”. Files will install to the selected location.

5. Click “Finish” to complete the install when you see the screen below.

6. When the app starts, select the type of activity you’ll be doing (streaming or recording). I set to “Recording” and then upload to YouTube later. Once you’ve made your choice, click “Next

7. I record from a specific monitor (selected in the pulldown in the screen below). I use the center monitor of the three I have and then put OBS on the right monitor so I can start/stop recording and change settings while recording as needed.

8. OBS will figure out the best set-up for you and then show you the settings. In my case the monitor I’m recoding from the UHD so it’ll auto-scale down to 1920×1080 to avoid too much bandwidth use.

…and that’s it. When you hit “Apply Settings” it’ll start the software and you’re ready to go.

If you’d like to add a webcam then take a look here for more info

If you’d like to add a display capture then take a look here for more info

Rename a member in Unity without losing the assignments in the Inspector

This is pretty simple when you have the right tag.

public GameObject m_foo;

To rename m_foo to m_bar without losing the assignments that have been set in a Unity scene, add the following on the line before the m_foo declaration: –


Now rename m_foo to m_bar and go have a look at the scene in Unity. The member name is changed but the assignments aren’t lost.

Once you’ve been in to Unity and the scene has updated, it’s safe to delete the “[FormerlySerializedAs(“m_foo”)]” line as it’s not needed anymore.

Hope it helps!

Quaternions: Set up an Quaternion to give a specific angle on a specific axis

Again, just dropping this here so I know where to find it. The following will set up a 1 degree rotation around the x axis (in this case it’s just rotating a Unity transform by 1 degree in the x)

    Quaternion q = a_activeMesh.m_meshFilter.gameObject.transform.rotation;
    Quaternion q2 = CreateFromAxisAngle(1.0f, 0.0f, 0.0f, 1.0f * Time.deltaTime);
    q = q * q2;
    a_activeMesh.m_meshFilter.gameObject.transform.rotation = q;
Quaternion CreateFromAxisAngle(float x, float y, float z, float a)
    // Here we calculate the sin( theta / 2) once for optimization
    float factor = Mathf.Sin(a / 2.0f);

    Quaternion q;

    q.x = x * factor;
    q.y = y * factor;
    q.z = z * factor;

    // Calcualte the w value by cos( theta / 2 )
    q.w = Mathf.Cos(a / 2.0f );

    return q.normalized;

ADB Quick Commands

I keep looking these up, so dropping them here so I don’t have to: –

This will echo all output from a Unity project; adb logcat Unity:V *:S

This will echo all output from a Unity project to a file; adb logcat Unity:V *:S -d >> output.txt

This will clear the log; adb logcat -c

This will increase the buffer size so you have more than a few seconds before your logs start to disappear; adb logcat -G 16M