How to disable image switching by the mouse scroll wheel in IrfanView

IrfanView is a great, free image editing program. One feature can destroy all your work if you keep it enabled.

When you rotate the scroll wheel of your mouse and the vertical scroll bar is not visible, the application loads the next image file from the directory. With this, you lose all changes you made to the image.

To disable image switching by the scroll wheel:

  • In the Options menu select Properties/Settings…
  • On the Properties/Settings page under Load next/previous file on Mouse wheel scroll select Never,
  • Click the Save button.

How to create a free Mapbox access token

Mapbox provides mapping services, and for private individuals many of those services are free. They ask for a credit card number to create a free access token, but they only charge it if the usage is very high, which usually only happens when the token is used for commercial purposes. To avoid credit card charges, keep your Mapbox token safe without publishing it on-line.

To create a free Mapbox access token

Create a Mapbox account

  • Navigate to https://www.mapbox.com/
  • Click the Get started for free button
  • Create an individual account
  • Follow the prompts and provide a credit card information. Mapbox will only charge it if the usage is very high, this usually never happens with private usage.

Create a Mapbox token

  • On the Tokens page click the Create a token button
  • Enter a name for the token, and keep the Public scopes selected
  • Click the Create token button
  • Save the token on your computer, never share it on the internet, as your credit card will be charged if the usage will reach the commercial level.

Migrating from conda to conda-forge for Python package management

Anaconda changed its Term of Use to require payment from companies larger than 200 employees. Many companies are not willing to pay the subscription fees for a software they can substitute.

conda-forge is the free, really open source alternative for the conda Python package manager.

To migrate your development environment from conda to conda-forge

Install conda-forge

To install conda-forge

  1. Navigate to https://conda-forge.org/download/,
  2. Download the installer for you operating system,

On macOS

  1. Open a terminal
  2. Execte the command
    bash ~/Downloads/Miniforge3-MacOSX-x86_64.sh
    • Answer yes when asked to accept the license terms
    • Press ENTER to allow the installation into your user directory

On Windows

  1. Execute the Windows installer

Configuration

Check the version of conda on your workstation, and update Conda, it should be higher than 4.9

conda --version
conda update conda

To not to activate the conda base environment at startup execute the command

conda config --set auto_activate_base false

To install packages from conda-forge, the free for everyone open source package repository

conda config --add channels conda-forge

Activate the strict channel priority to make sure the packages are first searched on the conda-forge channel

conda config --set channel_priority strict

Check the Conda configuration

To list the Conda config locations

conda config --show-sources

The usual Conda config location is ~/.condarc

To check the Conda configuration at the usual location

cat ~/.condarc

channels:
– conda-forge
– defaults
channel_priority: strict

For more information see A brief introduction to conda-forge

Find conda-forge packages

  • Start the Anaconda Navigator by executing in the terminal
    anaconda-navigator
  • On the Environments tab click Channels
  • Click the Add… button,
  • Enter https://conda.anaconda.org/conda-forge/ into the text box,
  • Press the Enter key, and
  • Click the Update channels button

Usage

To activate the conda base environment in the terminal, execute
eval “$(~/miniforge3/bin/conda shell.YOUR_SHELL_NAME hook)”

For iTerm the command is

eval "$(~/miniforge3/bin/conda shell.bash hook)"

To install conda’s shell functions for easier access, first activate the conda base environment as above, then:

conda init

For changes to take effect, close and re-open your current shell.

Type ‘unknown’ is not assignable to type …

TypeScript tries to make sure the variables are always populated with data of the type specified during the variable definition.

Issue

When the TypeScript compiler thinks a function can return another data type, or “unknown”, “undefined”, “null”, Visual Studio Code displays a warning:

type ‘unknown’ is not assignable to type …

Solution

The solution is to explicitly convert the return type to the expected one:

let soObject: SsoObject = <SsoObject> decodeJWT(ssoCookie);

Generating height maps with skydark.pl

To generate the height map of an area of the Earth

  • Navigate to https://heightmap.skydark.pl
  • Enter the name of the city in the search box
  • Set the Map size to 14.336 km
  • To move the selected area on the map, click and drag the central blue square.
  • To move the map closer to the sea level, click the Base level calculator button
  • Select Draw water streams to create the correct river and lake beds on the height map.
  • To display the elevation contour lines on the map image enable the Show height contours button
  • To display the edge of the water on the map image enable the Show water contours button
  • Click the Download PNG height hap button to download the height map.
  • Click the Download map image button to download the map for the overlay image.

Host the Cities: Skylines map generator locally

There are times when the Cities: Skylines Map Generator at https://heightmap.skydark.pl is not available. The free MapBox token expires because of the number of requests it serves.

We can host the site ourselves on our workstation and use it any time.

Install XAMPP

XAMPP is a free web server created by Apache Friends.

  • Download the installer for your workstation’s operating system at https://www.apachefriends.org/download.html
  • Install the application. As the popup will warn you, do not install it in the Program Files directory, as Windows restricts the access there.

Download the Cities: Skylines Map Generator application

The source code of the application is available on GitHub.

Place the application in the XAMPP directory

XAMPP contains the Apache web server which can host our JavaScript web application.

  • Create a directory called map in the htdocs folder of XAMPP. If you installed XAMPP to the default location, it is at C:\xampp\htdocs
  • Move the images and src directories of the map generator application into the map folder

Start XMAPP

  • Start the XAMPP Control Panel from the Start Menu
  • Start the Apache web server
  • Open your web browser and navigate to http://localhost/map/src/

Changing the MapBox access token

If the MapBox access token expires

  • Create a free access token for yourself at https://www.mapbox.com/
  • Update the value of mapboxgl.accessToken in the src/app.js file in line 47

To host the app from another directory

With the default configuration, XAMPP is looking for the web application in the htdocs directory within the XAMPP installation folder.

If you want to keep the Map Generator in another directory and host it from there with XAMPP:

  • Open the XAMPP control panel
  • Stop the Apache server
  • Click the Config button and select Apache (httpd.conf)
  • Place the project location into the DocumentRoot and Directory lines
  • Start the Apache server
  • Open your web browser and navigate to http://localhost/src/

Create a high resolution overlay image for Cities: Skylines II

The Image Overlay mod for Cities: Skylines 2 allows us to build a city based on real world locations. See Image overlay in Cities: Skylines 2 on how to install and use it.

To generate a high resolution overlay image

Create the standard resolution overlay image

Create a 2560×2560 pixel overlay image matching the height map. See Using the Map Editor in Cities:Skylines 2

Update the overlay image to high resolution

We can update the resolution to 16,384×16,384 pixels with some editing work using GIMP, the free graphics editor.

  • With your web browser navigate to Cities: Skylines map generator
  • Use the same location you used for the height map and the standard resolution overlay image
  • Set the Map size to 2.24 km