Quick Tip: Start Docker Toolbox Shell via Batch

Are you still stuck with Windows 8.1 or earlier? Then, if you want to use Docker, you have to use the Docker Toolbox.

Docker Toolbox comes with its own “shell” called Docker Quickstart Terminal. It uses Windows’ own command window – which is pretty limited.

docker-shell.png

As I explored in Command Line Replacement For Windows, there are alternatives.

To be able to interact with Docker Toolbox in these alternative command line tools, you can create a simple batch file that drops you into the same Docker shell as the “Docker Quickstart Terminal”:

@echo off
setlocal
cd /D %DOCKER_TOOLBOX_INSTALL_PATH%
"%GIT_INSTALL_ROOT%\bin\bash.exe" --login -i "%DOCKER_TOOLBOX_INSTALL_PATH%\start.sh"

Command Line Replacement For Windows

Even though Windows has a command line, this command line is very limited when compared to the ones available on Mac or Linux.

Fortunately, there are (free) alternatives out there. In this article we’ll be looking at three of them: ConsoleZ, ConEmu, and Cmder

At the end of the day, we’re looking for the best tool. So I’ve assembled a comparison chart for these three tools to find out which one is the best for me and you.

Read more →

Ping/Identify Computers By Name In Local Network

In a local network (or any other network), it’s desirable to be able to find computers by name rather than by ip address.

So, instead of using:

$ ping 192.168.178.25

one wants to use:

$ ping mycomputer

This mapping task is typically done by a DNS server.

Sometime back I wrote an article about how to ping/identify computers by name on Windows.

Unfortunately this solution highly depends on a good router that

  • lets you specify names for individual ip addresses (or determines them automatically)
  • provides a domain name for your local network (e.g. “fritz.box”)

Unfortunately, I recently was forced to switch to a less “superior” router that doesn’t support these features. So an alternative had to be found.

Multicast DNS

Fortunately, a solution exists and this solution is called Multicast DNS (short: mDNS).

Multicast DNS lets you find computers on your local network by name. You just have to add .local to the computer’s name.

So, to ping a computer called marvin you’d use:

$ ping marvin.local

What Do I Need?

There are two major mDNS implementations: Apple’s Bonjour and Microsoft’s Link-local Multicast Name Resolution (LLMNR).

Bonjour seems to have a wider adoption so I’m concentrating on this.

Here’s what you need:

  • Windows: If you have iTunes installed, you’re ready to go. If you don’t want to install iTunes, you’ll need to install the Bonjour Print Services for Windows. (Don’t be bothered by the “printing” part in the name. The package is a fully functional mDNS solution and it’s the only standalone Bonjour package available for Windows anyway.)
  • Linux: You need Avahi which is compatible with Bonjour. On Ubuntu/Debian, you need two packages: avahi-daemon (to be visible on the network) and libnss-mdns (to be able to find other computers)
  • OS X: Everything is pre-installed. You don’t need anything else.

Notes:

  • The domain .local has officially been reserved for resolving names in a local network. This means that:

    • there will never be a “real” domain ending called “.local”. So you don’t run the risk of name conflicts with the internet.
    • good routers won’t ask your ISP’s DNS server for “.local” names. So connecting to a “.local” name, will always result in an ip address from the local network.
  • mDNS, of course, only works if no two computers on the local network share the same name.
  • With mDNS, you don’t need to specify .local as “primary DNS suffix” on Windows – unlike the solution in the aforementioned article.

File Download Script for Visual Studio

download-progress-dialog.png

If you have some binary files you need for your Visual Studio project but you don’t want to add them to your version control system, here’s a PowerShell script that does the downloading for you:

download.ps1

Basically this mimics a very simple dependency management.

Source Repository: https://bitbucket.org/mayastudios/powershell-downloader/

Configuration

At the very top of the script, you define which files to download where.

For example, this downloads the x86 and the x64 version of a SQLite .dll file:

$base_url = 'https://mydomain.com/sqlite'
$files = @{
  '..\sqlite.dll' = "$base_url/x86/sqlite.dll"
  '..\sqlite_x64.dll' = "$base_url/x64/sqlite_x64.dll"
}

Entries must be separated by line breaks or semicolon (;).

Paths are relative to the location of the script file.

Usage

To include the script in your project, call it from your project’s Pre-build event.

For example, if you’ve placed download.ps1 in a folder called libs in your project, use this line to execute it:

powershell -ExecutionPolicy ByPass -File "$(ProjectDir)\libs\download.ps1"

That’s it.

When Does It Download

The script will download the files if:

  • they don’t exist
  • the script file is newer as the files (idea behind this: you’ve changed the file version to download)
  • a file named force-download.txt exists in the scripts folder and this file contains anything else but “false”

These rules are defined in the Needs-Downloading function.

Unicode, UTF-8, WTF?

Ever wondered what Unicode is and how it relates to UTF-8, UTF-16, and so on? Or did you stumble over “code points” and didn’t know what the difference to characters is?

Then you should try out the shiny new Unicode Explorer.

For some basics, click on the “Basics” link in the Unicode Explorer.

MayaStudios Unicode Explorer