Add Git Bash to Windows

If you’re after using a bash prompt then I’d suggest using; https://git-scm.com/download/win

Once installed, you can open a bash prompt just by doing Start->git bash

Advertisement

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 https://obsproject.com/download 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

Using AJAX to handle updates to a specific entry in a list

Bit clunky as I’m in a hurry, but this is really just to remind me how to set this up when I do it next time.

So, imagine you have a list of div’s. Each div contains a visual representation of a task or a database entry that you’re showing to a user. You want to dynamically update content within each div depending on the selection made in a pulldown: –

JavaScript

The ‘onchange’ of the pulldown (select element) calls OnChange in the code below and triggers and update for the given index. sel is the select element and idIn is the index in the list of “div’s” (the 0 or 1 in “id=’div_0′”, “id=’div_1′” etc)

// ==========================================================================
// Use ajax to populate a div based on selection in a select element
// ==========================================================================
function OnChange(sel, idIn)
{
    xmlhttp = newXMLHttpRequest();
    xmlhttp.onreadystatechange = SubFunction(idIn); // Use a sub-function to handle the parameter passing

    // Pass in the selected index so we know which 'div' to replace
    var selected = sel.options[sel.selectedIndex].value;
    xmlhttp.open("GET", "./populate.php?s=" + selected, true);
    xmlhttp.send();
}

// ==========================================================================
// Handle the ajax callback
// ==========================================================================
function SubFunction(idIn)
{
    return function()
    {
        if (this.readyState == 4 && this.status == 200)
        {
            var el = document.getElementById("div_" + idIn);
            el.innerHTML = this.responseText;
        }
    };
}
PHP
<!-- populate.php would be something like... -->
<?php

// Build content based as required here. This will be inserted into the innerHTML of the appropriate div

$id = $_GET['s'];
echo "here's some content: ".$id;
?>
HTML
…and the HTML is set up quite simply as: –
$string=<<<END
    <select onchange='OnChange(this, $id)'>
        <option value="0">Option 1</option>
        <option value="1">Option 2</option>
        <option value="2">Option 3</option>
    </select>
END;
echo $string;

The $id is the id of the current row in the div list (matches the div element id)