Bluetooth: Not Available in Sierra on the Macintosh

After software update in Sierra on my Macintosh, my Bluetooth mouse usually stops working.

The toolbar displays the Bluetooth not available icon: 

When I click it, the “Bluetooth: Not Available” message is displayed.

There are two recommended actions we can take to bring Bluetooth back to life. If the first one does not help, try to execute them together during the same shutdown and restart cycle.

Delete the com.apple.Bluetooth.plist file from Library / Preferences

  1. Start Finder,
  2. In the Go menu select Go to Folder,
  3. Enter /Library/Preferences into the text box and click the Go button,
  4. Move the com.apple.Bluetooth.plist file to the trash,
  5. Shut down the Macintosh,
  6. Start the computer again.

Reset the SMC to reinitialize the Bluetooth module

  1. Shut down the Macintosh,
  2. Disconnect all peripherals (external display, drives, mouse, printer),
  3. Make sure the power adapter is connected to the computer,
  4. Press and hold the Shift, Control and Option buttons for 10 seconds,
  5. Start the computer with the power button, with the peripherals still disconnected,
  6. Re-connect the peripherals.

Second monitor does not work on Toshiba P-70A in Windows 10

Since I installed Windows 10 on my Toshiba P-70A laptop, the computer does not recognize the second monitor.

To make the second monitor work, I had to uninstall the display drivers and remove them from the computer:

  1. Open the File Explorer
  2. Right click This PC and select Properties
  3. In the upper left corner select Device Manager
  4. Expand the Display adapters section
  5. Right click each display adapter,
    1. Select Uninstall
    2. Check  Delete the driver software for this device
  6. The computer will reboot.

To keep your second monitor working do not update the display drivers, keep the drivers that Windows installs during the reboot.

How to secure Jenkins

When you install Jenkins, the default settings allow anyone to sign up and administer it. There are many ways to secure Jenkins, the simplest is to disable the user sign up and require login to administer the server.

  1. Click sign up in the upper right corner and create an account for yourself
  2. On the Jenkins Dashboard select Manage Jenkins
  3. On the Manage Jenkins page select Configure Global Security
  4. Make sure the circled items are set according to the picture below.

Minimum Windows workstation setup to work with Windows servers

If you work on a Mac or Linux workstation and need to script and administer Windows servers, you need a few Windows tools. You can create a Windows Virtual Machine hosted in the free Virtual Box from Oracle or in VMware Fusion. For installation instructions see Install the DevOps development tools on Windows

  • Notepad++
  • Chocolatey
  • Git
  • AWS CLI (Amazon Web Services Command Line Interface)

Disable the left Windows Key

When you work on a Mac, you use the Command key for cut, copy, paste and other functions. If you press the same key in the Windows virtual machine, it acts as the Windows key. If you press it with an arrow key, it will move or resize your current window.

To disable the left Windows Key in your Windows virtual machine download SharpKeys from https://www.randyrants.com/category/sharpkeys/.

The application does not run in the background, it only updates the registry to remap the specified keys. Configure it to disable the left Windows Key:

Windows tools on the Mac

There are DevOps tools that you can install on your Mac to work with Windows servers and applications

Microsoft SQL Server tools

To connect to Microsoft SQL servers you can install Visual Studio Code and the MSSQL extension on your Mac.

Visual Studio Code

Install Visual Studio Code

  1. Install OpenSSL from the terminal window with
    brew update
    brew install openssl
    ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
    ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
  2. Download and install Visual Studio Code from https://code.visualstudio.com/Download
  3. In Visual Studio Code open the Code menu and select Preferences, Settings
  4. On the left side select the Extensions icon, and type mssql into the search field
  5. Click the Install button.

To connect to an MSSQL server from Visual Studio Code

  1. In Visual Studio Code press F1 ( or SHIFT+COMMAND+P ) to open the Command Palette
  2. Type sql into the search field to display the MSSQL commands and select MS SQL: Connect
  3. Select Yes, to switch to the SQL language
  4. Type sql into the search field and select SQL
  5. Click Create Connection Profile
  6. Enter the IP address or the name of the server, and press enter
  7. You may enter the database name
  8. Select the authentication type. If you want to connect to the database server with SQL credentials, select SQL Login, to connect with Windows credentials, select Integrated.
  9. Enter the username
  10. Enter the password
  11. To save the password in the connection profile select Yes
  12. Enter a name for the profile
  13. Visual Studio Code connects to the database server. the status bar at the bottom of the page shows the connected server information,
  14. Hover above the server name with the mouse to display the detailed server info.

To edit the SQL Server profile in Visual Studio Code

  1. In the Code menu select Preferences, Settings
  2. Edit the JSON file in the USER SETTINGS window

Execute an SQL script

  1. Enter the script into a Visual Studio Code tab
  2. Press COMMAND+SHIFT+E to execute the script
  3. Choose the profile to connect to the server
  4. The result is displayed on the Results tab

For more info on MSSQL in Visual Studio Code see https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-develop-use-vscode?view=sql-server-2017

NoMethodError: undefined method `exists?’ for Chef::Resource::File:Class

When you create a Chef custom resource and use the File class, you need to make slight a change in the syntax you use.

In a Chef recipe you can use

if File.exists?("#{FileName}")

to check for the existence of a file. If we use the same line in a Chef custom resource, we get the error message:

NoMethodError: undefined method `exists?’ for Chef::Resource::File:Class

In a Chef custom resource, you need to add :: in front of the File class to make it work

The leading :: tells Chef not to look for the “File” class in the Chef namespace.

if ::File.exists?("#{FileName}")

 

Migrate databases to and from AWS RDS instances

Amazon Web Services do not provide tools to migrate data to, from and between AWS RDS instances.

There is a free utility that can do the job.

SQL Server Management Studio (SSMS)

Install Microsoft SQL Server Management Studio (SSMS), because the utility uses libraries from it.

  1. Download the installer for free from https://msdn.microsoft.com/en-us/library/mt238290.aspx

SQL Azure Migration Wizard

Installation

  1. Download the SQL Azure Migration Wizard from http://sqlazuremw.codeplex.com/
  2. Unzip the downloaded ZIP file into a folder on your hard drive
  3. Create a shortcut in your Start Menu for SQLAzureMW.exe

Migrate a database

  1. Start the SQL Azure Migration Wizard by executing the SQLAzureMW.exe file
  2. Select Database in the Analyze / Migrate section and click Next

Connect to the source database

  1. On the Connect to Server page
    1. Enter the address of the database server
    2. Select SQL Server Authentication
    3. Enter the database owner login name and password
    4. If you keep Master DB selected, the next screen will show the list of databases to select from
    5. To save the username and password select Save Login Information
    6. Click Connect

  2. Select the database to connect to and click Next
  3. Leave Script all database objects selected and click Next
  4. On the Script Wizard Summary page click Next
  5. Click Yes to start the read process
  6. On the Results Summary page select Auto Scroll Display to see the scrolling results
  7. When the read is done click Next

Connect to the target database

  1. Enter the connection properties of the target database server
  2. Select the target database
    1. To migrate the data into a new database click the Create Database button
    2. On mirrored RDS instances we cannot drop and recreate databases. To migrate data into an existing database
      1. Use SQL Management Studio to drop the existing tables to avoid key conflicts
      2. Select the target database on this page
  3. Click Next
  4. Click Yes to start the write process
  5. When the write process is done click Exit

 

Chef file locations

The Chef file and folder locations are different on Linux and Windows machines. This article explains the purpose of each file and the location.

Summary

Linux Windows
Cookbook location /var/chef/cache/cookbooks  C:\chef\cache\cookbooks
Chef Client run log /var/log/chef.log First run only
C:\chef\chef-client.log
Subsequent Chef client runs
C:\chef\log\client.log
Error log /var/chef/cache/chef-stacktrace.out C:\chef\cache\chef-stacktrace.out
Ohai output /var/chef/cache/failed-run-data.json C:\chef\cache\failed-run-data.json
Recommended location for custom log files /var/log/cheflog.log C:\Logs\Chef\cheflog.log
Chef Client configuration /etc/chef/client.rb C:\chef\client.rb

When you test your cookbook in Test Kitchen

The .kitchen.yml file contains the username to execute the Chef cookbook. It is specified under platforms:, transport:, username:

Use that value in place of USER-NAME-FROM-KITCHEN-YML below.

Linux Windows
Cookbook location /tmp/kitchen/cookbooks
/tmp/kitchen/cache/cookbooks
 C:\Users\USER-NAME-FROM-KITCHEN-YML\AppData\Local\Temp\kitchen\cookbooks
Error log /tmp/kitchen/cache/chef-stacktrace.out C:\Users\USER-NAME-FROM-KITCHEN-YML\AppData\Local\Temp\kitchen\cache\chef-stacktrace.out
Ohai output /tmp/kitchen/cache/failed-run-data.json C:\Users\USER-NAME-FROM-KITCHEN-YML\AppData\Local\Temp\kitchen\cache\failed-run-data.json
Data bags /tmp/kitchen/data_bags C:\Users\USER-NAME-FROM-KITCHEN-YML\AppData\Local\Temp\kitchen\data_bags

Cookbook location

When the Chef recipes are executed, all cookbooks are stored on the node. You can examine the code to make sure your latest changes are reflected on the machine.

The log of the Chef client run

The output of the Chef cookbook execution is in the chef.log or chef-client.log file

On Windows

The log of the first Chef Client run and subsequent runs are stored in different log files. After the initial Chef Client run, the rest of the log entries are collected in the second file.

Stacktrace

Chef saves information on the hard drive when scripts are executed. If there is a failure, the stack trace of the last error is saved in the chef-stacktrace.out file.

Ohai output

All the information that Ohai collects on the instance, is saved in the failed-run-data.json file, even if there is no error. It is a great resource to get the server specific values.

Cloud info

  • cloud-specific information under “cloud
  • cloud instance information under “ec2

Computer info

  • CPU and memory configuration under “cpu“, “cs_info“, “memory
  • drive sizes and network settings under “filesystem” and “network

Operating system info

  • operating system information under “os_info
  • list of enabled Windows features under “dism_features
  • the list of installed applications under “packages

Chef info

  • Chef client configuration values under “chef_client
  • the Chef node information under “chef_type”: “node
  • the Chef run list under “run_list
  • list of Chef cookbooks and their versions under “cookbooks
  • list of the executed recipes under “recipes
  • the value of the passed in Chef attributes under “normal
  • the value of the Chef cookbook attributes under “chef_client” and the cookbook name
  • all the information on the Chef resources under “json_class
  • the stack trace of the last error under “exception

 Debug mode

To get detailed information on the Chef run, start the Chef Client in debug mode. Execute the command in sudo mode, because many Chef steps require elevated rights.

chef-client -l debug -L debug.txt

The debug information is saved in the debug.txt file in the current folder.

Internalize Chocolatey packages

To access Chocolatey packages in your private network you need to download them from the Internet and store them at a location where all servers can access them. You can internalize Chocolatey packages if you have a Chocolatey Business subscription.

You can use an Artifactory server to host the internalized packages.

List of available packages

To get the list of the available Chocolatey packages on an Artifactory server

choco list -s http://ARTIFACTORY_SERVER_URL/artifactory/api/nuget/ARTIFACTORY_REPOSITORY_NAME

Non copyrighted applications

If the Chocolatey package does not contain copyrighted components, Chocolatey can download and repackage the entire package, including the application.

Download a Chocolatey package from the Internet and store it on your local drive

choco download PACKAGE_NAME --internalize

To store the Chocolatey packages on an Artifactory server

  • The Artifactory server has to have a Pro license
  • Create a NuGet type local repository

Upload all packages from your local drive to an Artifactory server. Some of the large packages depend on other NuGet packages that have to be available on your Artifactory server.

curl -u ARTIFACTORY_USERNAME:ARTIFACTORY_PASSWORD -X PUT "http://ARTIFACTORY_SERVER_URL/artifactory/ARTIFACTORY_REPOSITORY_NAME/FOLDER_NAME/PACKAGE_FILE_NAME.nupkg" -T ./PACKAGE_FILE_NAME.nupkg

Copyrighted applications

If the Chocolatey package installs an application that is copyrighted, the author of the package cannot publish the copyrighted source, but can place the download location and installation process into the package.

Internalize the package

To download the necessary files and create a custom Chocolatey package with copyrighted application source:

    1. Download the Chocolatey package without the internalize option
      choco download PACKAGE_NAME

      Example:

      choco download javaruntime
    2. Delete the small .nupkg files. These are too small to contain the installer files. We will recreate them in a subfolder with the downloaded installer files.
    3. Find the package folder in the download sub-folder that has a tools subfolder. In the case of “javaruntime”, the real package is the “jre8”, not “javaruntime”.
    4. Open the tools\chocolateyInstall.ps1 file
    5. Find the download urls of the installer files.

       Some scripts contain variables for the version of the application, so you have to manually assemble the final download URL.
    6. Assemble the actual download URL and download the application source with your web browser,
    7. Place the downloaded installer files into the tools folder,
    8. Update the chocolateyInstall.ps1 to point to the installer files in the package:
      • Add the following before the $url =… and $url64 =… statements
        $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
      • Replace the the $url =… and $url64 =… statements. Use the actual file names, and make sure to use double quotes () for the string interpolation to work!
        $url = "$toolsDir\32_BIT_INSTALLER_FILE"
        $url64 = "$toolsDir\64_BIT_INSTALLER_FILE"

      • Add
        -UseOriginalLocation

        to the Install-ChocolateyPackage  line.

    9. Right click the .nuspec file in the package folder and select Compile Chocolatey Package

      (or execute choco pack PATH\TO\NUSPEC.nuspec)
    10. The package is created in the folder of the .nuspec file and the file name is the composite of id + “.” + version tag values in the .nuspec file.

Upload the package to the local repository

  • In the command line execute
    curl -u ARTIFACTORY_USERNAME:ARTIFACTORY_PASSWORD -X PUT "http://ARTIFACTORY_SERVER_URL/artifactory/ARTIFACTORY_REPOSITORY_NAME/PACKAGE_NAME/PACKAGE_FILE_NAME.nupkg" -T PATH/TO/PACKAGE_FILE_NAME.nupkg

    Video tutorials

  • Package Synchronizer

…refers to a location that is unavailable

When you try to copy a file from an external drive, or a network location, you may get the following error message:

On Windows 10

… is unavailable. If the location is on this PC, make sure the device or drive is connected or the disc is inserted, and then try again. If the location is on a network, make sure you’re connected to the network or Internet, and then try again. If the location still can’t be found, it might have been moved or deleted.

On Windows 7

… refers to a location that is unavailable. It could be on a hard drive on this computer, or on a network. Check to make sure that the disk is properly inserted, or that you are connected to the Internet or your network, and try again. If it still cannot be located, the information might have been moved to a different location.

This can happen when you try to copy a file from an external drive or network location to a folder on your computer, and the operating system wants to ask your permission to access the target location.

On Windows 10

On Windows 7

For some reason clicking the Continue button does not satisfy Windows when you copy from a network location.

To be able to copy the file, first copy the file to the desktop, and move it to the destination folder.

Recommended utilities for your workstation

Graphics

Snagit

Snagit is a great utility to capture screens and annotate them for documentation. The program is available for Mac and Windows.

Download the latest version at https://www.techsmith.com/

Get older versions at https://www.techsmith.com/download/oldversions

Terminal emulator

PuTTY

Install PuTTY

On Macintosh

  1. Open a terminal window
  2. Install PuTTY with Homebrew. For the Homebrew installation see the Homebrew section of Install the DevOps development tools on Macintosh
    brew install putty

On Windows

  1. Download the MSI (‘Windows Installer’) of PuTTY from https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html,
  2. Execute the MSI installer.