Monthly Archives: September 2020

Powershell from File Explorer’s context menu

Let’s add an “Open Poweshell” option to the File Explorer context menu.

  • Run Regedit
  • Go to HKEY_CLASSES_ROOT\Directory\shell
  • Add a new key to this, we’ll call ours power_shell as you may already see a PowerShell option and I don’t want to change that one
  • Change Default for the key to the text you want display in your context menu, i.e. Open Powershell Here
  • Add a new string value named Icon and in it’s value put C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
  • Add a new key to the power_shell key, named command. This is what’s actually run in the Default key put C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command Set-Location -LiteralPath ‘%L’

This will now show the Open Powershell Here option when you click on a folder in File Explorer, but what about if you’re already in the folder and want to open powershell from the current folder, then…

  • If you’ve closed Regedit then run Regedit again
  • Go to HKEY_CLASSES_ROOT\Directory\background\shell
  • Add a key named power_shell as before
  • As before we now add a string value named Icon with the same value as above
  • Again add a command subkey and with a slightly change add the following value into the Default key C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command Set-Location -LiteralPath ‘%V’ – note we change %L to %V

Building and testing TypeScript code using Github actions

In previous posts we’ve used Github actions to build .NET core code, now let’s create a workflow to build/transpile a TypeScript application.

  • Create a file (mine’s named build.yml) in your Github repo. in the folder .github/workflows
  • As per other examples of such a .yml action file we need to give the build a name and set up the triggers, so let’s do that, here’s the code
    name: Build
    
    on:
      push:
        branches: [ master ]
      pull_request:
        branches: [ master ]
    
    jobs:
      build:
    
        runs-on: ubuntu-latest
    

    In the above we’ve simply named the action Build which is triggered by pushes to master (and pull requests). We then set the action up to run on an ubuntu VM

  • Next we’ll add the following code to create a strategy (basically think, job configurations and application wide variables)
    strategy:
      matrix:
        node-version: [12.x]
    

    In this case we’re creating a variable named node-version with the version of node we want to use.

  • Now we’ll create the steps for the build
    steps:
      - uses: actions/checkout@v2
      - name: Node.js
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm install -g yarn    
      - name: yarn install, build and test
        run: | 
          yarn 
          yarn build
          yarn test
    

    Firstly we declare the checkout action to be used, then we used the setup-node action to (as the name suggests) setup node with the version we defined. In this example we then run npm to install yarn. Obviously we could have simply used npm instead (and you can replace the yarn commands with npm if you wish).

    Finally we have a step to install, build and test our code running the relevant yarn commands to carry out these tasks.

The above expects the package.json of your project to have scripts named test and build. For example

"scripts": {
  "test": "jest",
  "build": "tsc"
}

TIB/Rendezvous Daemon viewer

A useful tool for checking whether a user/machine is connected to TIBCO RV is to connect to their daemon. The TIBCO RV daemon includes a web browser – simply connect to the following

http://hostname:7580/index.html

Setting the host name to that of the machine you want to inspect (or their ip address).

This will display general information about the installed version of rvd if it’s installed ofcourse. Selecting the Client option will show the daemon’s client connections. For each connection is an Identifier which you can click on to see more details regarding that connection. From this you can also view the Subscriptions, i.e. what topics you’re daemon is listening on.

The Service option will show what service the daemon is connected to as well as all the other hosts that are connected.

Finally there’s the Current Log showing the log from the daemon.