Create a React web site

The React framework adds components on top of HTML and JavaScript to create dynamic one-page web applications. It does not have routing and data handling capabilities, to create a full stack web application use Next.js or Remix.

Configure the development environment

  • Install npm
  • Make sure npx is available on your workstation
    npx comes with npm 5.2 and higher

Create the React web site skeleton

Create the web site skeleton

View the new React web site

  • Step into the web application directory
    cd MY_WEB_SITE_NAME
  • Start the web application
    npm start
  • If asked, allow iTerm to control Google Chrome
  • Your React application loads in a new browser window at http://localhost:3000/

Test the application

By default the test are related to the changes made since the last Git commit.

  • If running, stop the application by pressing CTRL-C
  • Open the terminal in the application directory
    cd MY_WEB_SITE_NAME
  • Execute the test
    npm test

Deploy the application

Build the application

The application build process creates the minified version of the site in the “build” directory

  • To build a minified bundle of the application execute
    npm run build

Using GitHub Copilot

GitHub Copilot is a ChatGPT based AI pair programmer extension for Visual Studio Code, Visual Studio, JetBrains IDE, and Neovim. It is most effective in Python, JavaScript, TypeScript, Ruby, Go, C# and C++.

Installation

GitHub Copilot has personal and business subscription models. Start your free trial at https://github.com/features/copilot

Ask for suggestions

  • Create a file with the standard file extension of the language to indicate the preferred programming language to the AI.
  • Start to create a function with the name that describes its purpose (in this example we will use the JavaScript syntax)
    function getDaysInMonth(month, year) {
    (If your IDE automatically adds the closing curly brace, remove it, otherwise Copilot does not offer solutions)
    or
  • Create a comment to describe the functionality
    // Express server on port 3000 and return the current date

Select the suggestion

  • Use the Alt-[ and Alt-] on Windows, Option-[ and Otion-] on Mac to cycle through the suggested solutions and press Tab to accept it, or Esc to reject all of them.

See all suggestions in a new tab

  • Press Ctrl-Enter to open a new tab, and a few seconds later all suggestions will be listed in the new tab.
  • Click the Accept Solution link above the suggestion to insert it into your file.

For more information see the documentation

To activate and deactivate the GitHub Copilot

  • In the lower right corner of the editor click the Copilot icon
  • Select the scope to disable GitHub Copilot: for all languages, or for a specific language only.

Tutorials

There are GitHub repositories to learn to use GitHub Copilot. The Tutorials for GitHub Copilot page lists all of them. These are interactive repositories to learn the skills using real code:

  • skills-getting-started-with-github-copilot – The basics of using GitHub Copilot
  • skills-expand-your-team-with-copilot – How to use GitHub AI agents to do complex tasks in your repository

Interaction modes

GitHub Copilot has two main modes: Ask mode and Agent mode

Ask is an interactive communication mode, where the Copilot is a chat companion to give you information on the inner workings of the code, and give you brainstorming ideas.

Agent mode can make autonomous edits across multiple files in the project.

GitHub copilot Cheat Sheets

UI specific commands to enhance the work with Chat and Agent at GitHub Copilot Chat cheat sheet
The Visual Studio specific commands are:

Chat participants

Chat participants are like domain experts with specialty knowledge. Specify the chat participant with the @ symbol in your prompt. Most common chat participants are

VariableSpecialty
@azureAzure services
– Service deployment and management.
– App deployment to Azure.
@githubGitHub
– GitHub specific skills.
@terminalVisual Studio Code Terminal
– To create and debug Terminal commands
@vscodeVisual Studio Code
– Commands and features
@workspaceThe current workspace
– Project structure
– Code parts interaction
– Design patterns

For more information see Chat participants

Chat variables

Chat variables give specific context in the prompt. The chat variables are

VariableDescription
#blockIncludes the current block of code in the prompt.
#classIncludes the current class in the prompt.
#commentIncludes the current comment in the prompt.
#fileIncludes the current file’s content in the prompt.
#functionIncludes the current function or method in the prompt.
#lineIncludes the current line of code in the prompt.
#pathIncludes the file path in the prompt.
#projectIncludes the project context in the prompt.
#selectionIncludes the currently selected text in the prompt.
#symIncludes the current symbol in the prompt

For more information see Chat variables

Slash commands

Slash commands are frequently used instructions:

CommandDescription
/clearStart a new chat session.
/explainExplain how the code in your active editor works.
/fixPropose a fix for problems in the selected code.
/fixTestFailureFind and fix a failing test.
/helpQuick reference and basics of using GitHub Copilot.
/newCreate a new project.
/testsGenerate unit tests for the selected code.

For more visit Slash commands

Tools in chat

Type the # sign in the chat prompt to display the list of tools. The list contains the list of files referenced in the current chat, and the available tools.

For more about tools see Use tools in chat

MCP Servers

To enable the MCP gallery in the Visual Studio Code extension explorer

Some of the MCP server registries are

Starting MVP servers as Docker containers

When using Docker with stdio servers, don’t use the detach option (-d). The server must run in the foreground to communicate with VS Code.

For more on MCP Servers see Use MCP servers in VS Code

Inline Chat

Inline chat can help you with fast responses related to a particular line in the code. To invoke it move the cursor to the line and press Ctrl-I (Cmd-I on Mac), or right-click the line and select Copilot, Editor Inline Chat. If you want the AI to insert lines in to your code, like generating test data by adding elements to an array, place the cursor where the lines should go.

Kerbal Space Program 2 configuration

Settings file

The game settings file is located at C:\Users\YOUR_USER_NAME\AppData\LocalLow\Intercept Games\Kerbal Space Program 2\Global\Settings.json

Mods

Mods make using KSP 2 a better experience. Modders can create functionality faster than the development team, as they only have to concentrate to their particular area. This also means, a game update can render a mod unusable until the modder also updates the mod.

Recommended mods for Kerbal Space Program 2

To configure the mods, in the Settings menu select Mods, and scroll down to the mod to adjust.

NameDescriptionRecommended settingsHome page
Docking Alignment DisplayAdds a new instrument providing necessary information to dock with precision!https://forum.kerbalspaceprogram.com/topic/218752-v011-for-ksp2-013-docking-alignment-display-dad/
Flight PlanPlan your (Space) Flight! Fly your Plan! Handy tools to help you set up maneuver nodes that will get you where you want to be.
Making spaceflight planning easier for Kerbal Space Program 2 one mission at a time.
https://forum.kerbalspaceprogram.com/index.php?/topic/216393-flight-plan/
K2-D2The Kerbal Space Program astromech
A set of tools to Help Space Navigation.
https://spacedock.info/mod/3325/K2-D2
KerbalHeadlampAdd Kerbal Headlamps so you can see in the dark.https://forum.kerbalspaceprogram.com/topic/222849-kerbalheadlamp-012-for-ksp2-020/
Kontrol System 2Scripting framework for autopilotshttps://forum.kerbalspaceprogram.com/topic/214543-release-kontrolsystem2-042/
Lazy OrbitLazy Orbit is a simple mod that allows you to set a vessel’s orbit, land it on a surface, or teleport it to another vessel via a simple GUI. Open the GUI by clicking the button in the app bar (or press ALT+H), select a body and an altitude, and press Set Orbit. Great for testing and modding, don’t use it for anything nefarious!https://forum.kerbalspaceprogram.com/index.php?/topic/214571-lazy-orbit-v040-set-a-vessels-orbit-via-a-simple-menu/#comment-4253292
Maneuver Node ControllerProvides an interface to finely tune maneuver nodes and restores missing maneuver node features from Kerbal Space Program 1. Make fine tuned adjustments to your maneuver nodes even if they are off screen!https://forum.kerbalspaceprogram.com/index.php?/topic/214244-maneuver-node-controller-003/
MapView Focus and TargetingUse keyboard shortcuts to focus and target celestial bodies in KSP2.

Press Home to focus on the current vessel, press PgUp and PgDn to cycle through planets. Right-click to bring up Set Target menu.
https://spacedock.info/mod/3346/MapView Focus and Targeting
MICRO ENGINEERDisplays useful information about your vessel in flight and in VAB. See your orbital and surface parameters, deltaV, TWR and many other things.https://forum.kerbalspaceprogram.com/index.php?/topic/215989-micro-engineer/
Orbital SurveyScan celestial bodies from orbit.https://forum.kerbalspaceprogram.com/topic/221133-orbital-survey/
Science ArkiveSee all your science experiments at a glance, and check where you can pick some more points!https://forum.kerbalspaceprogram.com/topic/222785-science-arkive-v010-for-ksp2-v020/
Shadow Inc: Exploration DivisionThis mod adds parts that are orientated around explorationhttps://spacedock.info/mod/3407/Shadow Inc: Exploration Division
SPARK TechnologiesSPARK Technologies is proud to present the latest in electric rocket engines.https://forum.kerbalspaceprogram.com/topic/219596-stellar-plasma-assisted-rocket-kinetics-spark-technologies-010/
The Nuclear OptionWhen solar power, batteries, and fuel cells simply aren’t enough, it’s time for The Nuclear Optionhttps://forum.kerbalspaceprogram.com/topic/219626-the-nuclear-option-tno-010/
WASD For VABControl the VAB camera using WASDRequire Right Click For Controlhttps://forum.kerbalspaceprogram.com/topic/223551-wasd-for-ksp/
Wayfarer’s Wings (Rank Ribbons)Give each Kerbal the fame they deserve, know who was the first to plant a flag on Mun, or whatever else!https://forum.kerbalspaceprogram.com/topic/223457-wayfarers-wings-rank-ribbons-v040-for-ksp2-v021/

The clicking area of the object in Phaser does not cover the entire image

When Phaser constructs the input area of an object where the user’s click will trigger the action, it tries to read the dimensions of the image. It usually works, but in some cases the area does not cover the entire image.

To display the input area add the enableDebug() function to your code.

  • First, set the button interactive
  • Enable this.input.enableDebug() on the button
this.nextPlayerButton.setInteractive();
this.input.enableDebug(this.nextPlayerButton);

Error: EACCES: permission denied, open …

When Node.js libraries cannot open files on the local disk, the file does not exist at the specified location, or the file or folder permission are not correct.

To check the permission of the file see Get the octal file permission number of a file or directory

If you get the error message related to the AWS credential and config files,

Error: EACCES: permission denied, open ‘/Users/…/.aws/config’ or

Error: EACCES: permission denied, open ‘/Users/…/.aws/credentials’

  • Set the permission of the AWS config and credentials files to 744
sudo chmod 744 /Users/$USER/.aws/config
sudo chmod 744 /Users/$USER/.aws/credentials

Using the redis Docker container locally

To develop applications with the redis database we can use a Docker image.

The documentation is at https://hub.docker.com/_/redis/

Set up the redis container to be accessed via localhost on the local computer

Start the redis container

Start the redis container “detached” ( -d ) in the background and expose it through localhost:6379

  • In the terminal execute
    docker run -dit --name redis -p 127.0.0.1:6379:6379 redis

Check if the container running

  • In the terminal execute
    docker ps -a

Test the redis database

Start a shell session in the redis container to access the command line utility

  • In the terminal execute
    docker exec -it redis sh
  • At the # prompt start the redis cli
    redis-cli
  • At the 127.0.0.1:6379> prompt test the connection
    ping
    The response should be “PONG”
  • Store a value
    set cat 10
    The response should be “OK”
  • Retrieve the value
    get cat
    The response should be “10”
  • Get the list of all keys
    keys *

Set up redis to be used by other Docker containers

Create a network

Create a Docker network, so multiple containers can communicate with each other using it.

  • In the terminal execute
    docker network create redis

Start the redis container

Start the redis container “detached” ( -d ) in the background in the “redis” network to make it available for redis-cli.

  • In the terminal execute
    docker run --name redis --network redis -d redis

Start the redis command line utility

  • In the terminal execute
    docker run --name redis-cli -it --network redis --rm redis redis-cli -h redis

Using the redis command line utiliy

Store a value in the redis database
  • In the terminal execute
    set cat 10
Read a value from the redis database
  • In the terminal execute
    get cat

DeprecationWarning: Access to process.binding(‘http_parser’) is deprecated.

When you try to run an older Node.js application under a new version of Node.js you may get deprecation warnings. If you downgrade Node.js and keep the out of date component, you will introduce a dangerous security risk in your application.

To refresh the referenced Node.js libraries

  • In the command line execute
    npm install --force
    npm audit fix --force

DevOps Engineering part 1. (Win) – Make your Windows computer easier to use

Set up your computer

Display the file extensions

On Windows 11

  • Open the File Explorer
  • Click the arrow next to View and select Show
  • Mark File name extensions and Hidden items

On Windows 10

  • Open File Explorer
  • On the View tab select
    • File name extensions
    • Hidden items
      windows-03-show-file-extensions

On Windows 7

(if you accidentally run into an ancient machine)

  • Open Windows Explorer and select Organize
  • Select Folder and search options
    windows-02-show-file-extensions
  • On the View tab
    • Select Show hidden files, folders, and drives
    • Uncheck Hide extensions for known file types

Disable the Caps Lock key

If you frequently accidentally press the Caps Lock key and you feel it is not necessary, you can disable it. See Disable the Caps Lock key in Windows 11

Disable the Windows key

If you use a Macintosh computer, you use the Command key all the time. Unfortunately, on the Windows keyboard you will always accidentally hit the Windows key. This can be very frustrating, as pressing the Windows key with any of the cursor keys will resize the current window.

To disable the Windows key

  • Download the 64 bit version of PowerToys by Microsoft (currently PowerToysSetup-0.68.1-x64.exe) from https://github.com/microsoft/PowerToys/releases/tag/v0.68.1
  • Execute the installer file to install the application
  • Start Powertoys
  • On the left side select the Keyboard manager
  • Click the Open Settings button
  • Select Remap a key
  • Click the plus sign
  • On the left side select Win (Left), on the right side select Disable and click the OK button.
  • Click Continue Anyway

Nice to have utilities

WinDirStat

Screenshot

WinDirStat is a disk utility to display the relative size of your files in a graphical interface and provide a tree view to help to find them.

Download it from https://windirstat.net/

Install the DevOps development tools on Windows

Chocolatey

If you want to host Chocolatey packages internally install Chocolatey. See Install Chocolatey

Store your username in an environment variable

We will use it in the .kitchen.yml file of the Chef SDK.

  1. Open the Git Bash window and execute the command echo ‘export USER=`whoami | tr -d “\\n”`’ >> ~/.bashrc

Virtual Box

Download Virtual Box from https://www.virtualbox.org/wiki/Downloads and follow the instructions to install it.

At the time of writing, this was the section where the installer files were referenced

virtual-box-01-download

Run the downloaded installer file and accept all default values.

The installer starts the Virtual Box application.You can close it, we will use other tools to start it in the future.

To be able to launch 64 bit guest operating systems turn off Hyper-V in Windows Features

  1. In the Windows search box enter Windows Features and select Turn Windows Features on or off,
  2. Uncheck Hyper-V and click OK,
  3. Reboot the computer for the setting to take effect.

Configure VirtualBox

Networking

To share the connectivity of the host computer with the virtual machine, mainly if you use VPN

  1. In Virtual box click Settings
  2. Select Network
  3. Attach the network adapter to NAT

Copy and paste

To enable copy and paste between the virtual machine and the host ( your workstation )

  1. On the General tab of the Settings page select the Bidirectional shared clipboard

Shared Folders

Specify the shared folder on your workstation

  1. In the VirtualBox menu select Preferences
  2. On the Shared Folders tab click the + icon
  3. To share the entire system drive, select the C: drive of your workstation

Enable shared folders on the virtual machines

To enable the shared folders on the virtual machine and other configurations see Virtual machine configuration at VirtualBox


Vagrant

For Vagrant installation see Vagrant.


Ruby

  • Download Ruby from http://rubyinstaller.org/downloads
  • Install the 32 bit version, as the 64 bit version is fairly new and has compatibility issues. Download the latest Ruby installer. Pick the file that does not have the (x64) at the end.
  • Accept the default values but check Add Ruby executables to your PATH
    ruby-01-add-to-path

 Ruby Development Kit

The Ruby Development Kit is need for certain Ruby gems, so install it.

  • Download the Ruby Development Kit from the DEVELOPMENT KIT section of  http://rubyinstaller.org/downloads
  • If you have installed the 32 bit version of Ruby make sure you install the 32 bit version of the DevKit. Select the Development kit that matches the Ruby version you installed. At the time of writing the latest development kit is under “For use with Ruby 2.0 and above (32bits version only)
    • Run the installer to extract it to a permanent location (C:\RubyDevKit)
    • Open a command window in the C:\RubyDevKit folder
    • Run these commands in the command prompt to install it.
      • ruby dk.rb init
      • ruby dk.rb install
  • For more information see  http://github.com/oneclick/rubyinstaller/wiki/Development-Kit

Chef Development Kit

Terraform by Hashicorp

Install it with Chocolatey

  • Open a terminal window as administrator
  • Execute
    choco install terraform

or

Manual installation

  • Download Terraform from https://www.terraform.io/downloads.html
  • Unzip the downloaded package to C:\HashiCorp\Terraform
  • Add the Terraform directory to the path of the computer. It is not added automatically on 64 bit Windows.
    • In Windows Explorer right-click Computer and select Properties,
    • On the left side select Advanced System Settings,
    • At the bottom click the Environment Variables… button,
    • In the System Variables box select Path and click the Edit… button,
    • Add the following to the end of the Variable value. (Don’t forget to start with the semicolon as the separator). ;C:\HashiCorp\Terraform
  • To create RDS (Relational Database Service) instances in AWS, install the Amazon Web Services Command Line Interface (See instructions below)
  • Configure the GitBash window to run as administrator to be able to execute the “terraform get” command to get local modules during development
    • Right click the shortcut of the Bash window you use and select Properties
    • On the Compatibility tab check Run this program as an administrator

For more details see https://www.terraform.io/intro/getting-started/install.html

Graphviz

Graphviz is a Dependency Graph Visualization Software. We will use this utility to display the Terraform graphs.

  • Download from http://www.graphviz.org/Download..php
    There are really two dots in the address :-)
  • Execute the installer
  • You may need to add the location to the Path environment variable. Make sure you use the actual folder name, as it contains the version of the application. ;C:\Program Files (x86)\GraphvizX.XX\bin

AWS CLI

The Amazon Web Services command line interface installation will set up your workstation to launch instances in AWS from Test Kitchen. If you know you will work with AWS, see DevOps Engineering part 3. – Working with AWS for the AWS CLI installation.

Packer

We use Packer to create custom AWS AMIs that contain the fundamental configuration and applications that are common in every instance we launch.

Install with Chocolatey

  • Open a Git Bash window as administrator
  • Execute choco install packer

or

Manual Installation