Send Alt-Control-Delete to a Windows server via Remote Desktop

When you log into a Windows server via the Remote Desktop Protocol (RDP) in some cases you need to send the Alt-Control-Delete ( in other notations Alt-Ctrl-Del, Control-Alt-Delete, Ctrl-Alt-Del ) key combination to the remote server.

From a Macintosh laptop

On a Macintosh laptop press the fn+control+option+delete keys to send Alt-Control-Delete to the server.

From a Windows workstation

If the Remote Desktop window is not in full-screen mode, Alt+Control+Delete will control your own Windows workstation.

On a Windows workstation press the Alt+Control+End keys to send Alt-Control-Delete to the remote server.

 

Connect to a MySQL database from Visual Studio 2017

As of today weI can connect to a MySQL database, but cannot generate the Entity Data Model from a MySQL database in Visual Studio 2017

To access a MySQL database from Visual Studio 2017

IMPORTANT: First install MySQL for Visual Studio, and after that install MySQL Connector/Net.

If MySQL Connector/Net is already installed on your workstation, uninstall it before installing MySQL for Visual Studio and reinstall MySQL Connector/Net.

Install MySQL for Visual Studio

Available version information is at https://dev.mysql.com/doc/visual-studio/en/visual-studio-intro.html

  1. Close all instances of Visual Studio,
  2. Download the installer from https://dev.mysql.com/downloads/windows/visualstudio/
  3. Start the installer
  4. Click the Complete button,
  5. If you select Typical, make sure the Visual Studio 2017 components are selected

 

Install the MySql Connector/Net the fully-managed ADO.NET driver for MySQL

  1. Download the installer from https://dev.mysql.com/downloads/connector/net/
  2. Download version 6.9.10, because version 6.10.5 throws the

    Inheritance security rules violated by type: ‘MySql.Data.Entity.MySqlEFConfiguration’. Derived types must either match the security accessibility of the base type or be less accessible

    error. More info at https://stackoverflow.com/questions/47227495/inheritance-security-rules-violated-by-type-mysql-data-entity-mysqlefconfigura

  3. Select version 6.9.10, your operating system and click the Download button
  4. If you don’t want to create an Oracle account, click the No thanks… link
  5. Start the downloaded installer
  6. Click the Complete button

Install the NuGet packages

Make sure to install the same version of the NuGet packages as the MySql Connector/Net

Generate Entity Framework Entity Data Model in Visual Studio 2017

Visual Studio 2017 has many project type options, and not all of them support the Entity Framework user interface to generate the Entity Framework Data Model (EDMX) file. If you create an ASP.NET Web Application(.NET Framework) you can add the EDMX file to it. The .NET Core projects do not support the Entity Framework Data Model creation.

For more complex web applications it is good practice to separate the data access layer from the presentation layer. You can even reference the data access project from another solution if that also needs access to the same data.

To be able to use the graphical user interface to generate the Entity Framework Entity Data Model

  1. Add a new Class Library (.NET Framework) type project to the solution,
  2. Right-click the new project and select Add -> New Item
  3. In the Data section select the ADO.NET Entity Data Model
  4. Select EF Designer from database
  5. Continue the process to create the database connection and generate the data model.

Generate the Entity Classes

  1. Open the EDMX file
  2. Right-click the background and select Add Code Generation Item
  3. Select the latest EF DbContext Generator
  4. When the classes have been generated, close the solution and open it again, otherwise, the newly created classes cannot be referenced.

{“error”:”Entity type ‘AspNetUserRoles’ has composite primary key defined with data annotations. To set composite primary key, use fluent API.”}

When a database table has composite keys (multiple columns are in the key) you cannot use the usual key definition

[Key]
[Display(Name = “UserId”)]
public string UserId { get; set; }

[Key]
[Display(Name = “RoleId”)]
public string RoleId { get; set; }

When you run the application you get the error message:

{“error”:”Entity type ‘AspNetUserRoles’ has composite primary key defined with data annotations. To set composite primary key, use fluent API.”}

To declare composite keys, in the fluent API format

In the model declare the keys

public class AspNetUserRoles {

    // Composite primary keys
    // Initialized in ApplicationDbContext.OnModelCreating()
    public object UserId { get; internal set; }
    public object RoleId { get; internal set; }
    ...

In the ApplicationDbContext file add the lines to the OnModelCreating(ModelBuilder builder) method

// Composite primary key
builder.Entity().HasKey(table => new {
   table.UserId,
   table.RoleId
});

 

 

Remove the 2014 Honda CR-V EX center console

There is a great post at http://www.crvownersclub.com/forums/17-interior/152730-2014-center-console-removal.html on the steps to remove the center console of the 2014 Honda CR-V EX by Jepalan. I have copied his description and added my photos to help others in the process.

This is in a 2014 CRV EX that does NOT have NAV, Heated Seats, Factory Amp, or Rear Entertainment System, but should be similar for all models.

You need a taped flat head screwdriver to prevent scratching (or plastic body tools), Phillips head screwdriver, 10 mm socket with extension, pliers, and the usual panel removal tools.

There are 5 bolts (10 mm), one screw (Phillips), and two wire harnesses that need to be disconnected.

Remove front and rear floormats.

Take off the footwell center kick panels in the front of the console on both sides, both have 2 pins and clips. The driver side has a hinge-like flange at the front.

Use a flat head screwdriver to pull out the center of the pins

         

Driver side

      

Passenger side

      

Remove the push-pin on each side revealed at the front of the console after removing the kick panels.

   

Remove the rear panel of the center console, clips around top and sides.

   

Remove the two bolts revealed at the rear of the center console.

Open the center console, and by grabbing the small tab at the rear, remove the rubber mat from the bottom, it isn’t attached.

Remove the two 10 mm bolts revealed.

It is not necessary to remove the plastic piece that covers bottom & side inside the center console. If you want to remove it

Remove the black Philips screw at the bottom of the center console.

Lift up the plastic piece.  Do not pry the back, it will slide up.

The 5th bolt is behind a small cover under the shift quadrant, just above the center console cup holders. The cover is held by 4 clips.

       

The two wiring harness connectors are on the driver side, revealed when the footwell kick panel is removed. They are connected to each other and clipped to the center console. Detach the clip holding them to the console by squeezing the tabs with the pliers, then lift the rear of the console an inch and move the console backward to get at them.

The release catch for the gray is on the top, for the white is between the two connectors. Use a flat head screwdriver to release it.

   

Once you have everything disconnected, fold the armrests up, then put both seat backs all the way back to make the seats as flat as possible. Move the console toward the rear of the car, then lift up the front and angle it out. The picture below shows the opposite, I moved the console to the front and lifted the rear. That works too.

Reverse the steps to put it back together.

The ham radio restarts when the push to talk button is released

I have installed a new Kenwood TM-281A ham radio in my car. The power is filtered by a Kenwood PG-3B noise filter. When I opened the package of the noise filter, I have noticed some burnt smell but did not pay much attention. The radio transmitted perfectly, but when I released the push to talk button, the radio turned off for a fraction of a second, then turned on again.  When I disconnected the noise filter, the radio started to continuously work again. It is interesting, that a faulty noise filter can supply enough current for the transmission, but cause problems when the current is suddenly reduced.

The sales person at the ham radio store suggested, that most likely the capacitor was faulty. I have returned the noise filter to the store, and when I tested the radio without it, I noticed, that I do not need it for clean, noiseless transmission.

Generate SQL script from Entity Framework migration script

It is not recommended to execute Entity Framework migration scripts in production, It is important that you execute all SQL steps manually on the production database section-by-section to immediately see the result and be able to recover in case a destructive action goes wrong.

The Visual Studio .NET application templates contain Entity Framework migration scripts to set up your local database to match the sample code. To generate the SQL script you can execute by hand on the production database

Install the EF Core .NET Command-line Tools

  1. Open a command window in the folder of the project that contains the database access code
  2. In the command line execute
    dotnet add package Microsoft.EntityFrameworkCore.Design
    dotnet restore
  3. Test the dotnet ef installation with
    dotnet ef

 

Script the .NET Entity Framework migrations

  1. Open a command window in the folder of the project that contains the database access code
  2. In the command line execute
    1. To generate the SQL script to bring the current development database to the scripted configuration state, use the –idempotent option.
      (Generating idempotent scripts for migration is not currently supported by MySql)

      dotnet ef migrations script --idempotent --output "script.sql" --context MY_DBCONTEXT
    2. To generate the SQL script based on the entire migration script to update the production database to match the template after you have updated the development database
      dotnet ef migrations script --output "script.sql" --context MY_DBCONTEXT

 

 

DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded.

The .NET Core Entity framework makes database access easy. When you auto-generate a Razor page in a .NET web application to edit a data row, the scaffolding places controls on the page for every column.

There are columns in most of the tables that we don’t want to display or edit, like keys, checksums, password hashes. If column values are missing during database update, the error is thrown:

A database operation failed while processing the request.
DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.

When the edit page is displayed, all values of the row are passed to the page in the Model. When the user clicks the Save button the model is sent back to the server, and the OnPostAsync() method saves the values to the database. The values that we don’t display or store otherwise on the web page are not retained in the browser, and not passed back to the server. To keep the not displayed values, add hidden attributes to the page. The primary key of the row is automatically added, and based on that create hidden attributes for the rest of the not displayed columns.

 <form method="post">
 <div asp-validation-summary="ModelOnly" class="text-danger"></div>
 <input type="hidden" asp-for="ApplicationUser.Id" />
 <input type="hidden" asp-for="ApplicationUser.AccessFailedCount" />
 <input type="hidden" asp-for="ApplicationUser.ConcurrencyStamp" />
 <input type="hidden" asp-for="ApplicationUser.NormalizedEmail" />
 <input type="hidden" asp-for="ApplicationUser.NormalizedUserName" />
 <input type="hidden" asp-for="ApplicationUser.PasswordHash" />
 <input type="hidden" asp-for="ApplicationUser.SecurityStamp" />
 <input type="hidden" asp-for="ApplicationUser.UserName" />

 

 

 

Splunk App for AWS

To collect data from AWS install the Splunk App for AWS plugin.

The app currently can collect information from

  • AWS Config,
  • Config Rules,
  • CloudTrail,
  • Inspector,
  • CloudWatch,
  • CloudWatch Logs,
  • Billing,
  • S3,
  • Kinesis,
  • Metadata.

New data source

To set up a new data source, click the Set up button

Already set up data source

To add a new input to the data source, click the New Input button

To view the list of existing inputs, click the link in the section

To view the settings of an existing input, click the name of the input, to add a new input, click the Add Input button. There is no way to edit the settings of existing inputs, to make changes, create a new input. There is also no method to disable an existing input, to stop the data collection, delete the input in the Action column.

S3

To read and process files from S3, select the S3 data source.

To select the Source Type click the Source Type field. If the source type is in the list, select it.

To add a source type, not in the list, enter the name into the text box, and click the generated link under the text box.

To collect the data more frequently than the default 30-minute interval, click the Advanced Settings link and enter the interval in seconds.

 

Skip steps in an InSpec integration test based on Chef attribute values

To speed up the test of some complex recipes, I use an attribute to skip certain long-running installations when I only need to test the rest of the recipe.

We will pass Chef Attribute values into an InSpec test using environment variables.

Declare an attribute in the atrributes.rb file with a safe default value, to allow the execution of all steps if the value is not overridden

# Set this to true in the .kitchen.yml file to skip long-running tasks during local test
default['quick_launch_for_test'] = false

Set the value in the suites: section of the kitchen.yml file to true to skip the long-running installations

  attributes:
    quick_launch_for_test: true

Save the attribute value in an environment variable in the recipe to pass it to InSpec

# Store the value in an environment variable for the integration test
env 'quick_launch_for_test' do
  value "#{node['quick_launch_for_test']}"
end

Make a decision in the recipe based on the value of the attribute

if ( node['quick_launch_for_test'] != true )
  #########################################
  #Microsoft Visual Studio Community 2017 #
  #########################################
  ...
end

Read the value of the environment variable into a local variable in the InSpec test file. If the environment variable does not exist, or the value is not “true”, the value of the local_execution variable will be “false”.

local_execution = ( os_env('quick_launch_for_test').content() == 'true')

Use the if statement to make the decision in your InSpec test file

if !local_execution
  describe package('Microsoft Visual Studio Community 2017') do
    it { should be_installed }
  end
end