How to disable Sticky Keys in Windows

When you press the Shift key five times Windows turns on a feature called Sticky Keys to help people to type with one hand. Sometimes this can cause inconvenience when you want to use two hands and just pressed the Shift key too many times.

To turn off this automatic feature in Windows 7

  • In the Control Panel select Ease of Access Center
  • Select the Make the keyboard easier to use link
  • In the Make it easier to type section select the Set up Sticky Keys link
  • In the Keyboard shortcut section uncheck Turn on Sticky Keys when SHIFT is pressed five times
  • In the Options section uncheck Lock modifier keys when pressed twice in a row

windows 7 disable sticky keys

How to remove Windows 8 and install Windows 7 on a Sony VAIO SVF15N17CXB laptop

If you want to remove the preinstalled Windows 8 from a new Sony VAIO laptop you need an external USB DVD drive and a Windows 7 DVD. You can buy the LG external USB DVD drive for $40 at Best Buy, and the Windows 7 at Amazon.

The first step is to turn off UEFI in the BIOS and enable the legacy boot. This will allow the computer to boot from the Windows 7 DVD.

To enter the BIOS

  • Turn off the Sony VAIO laptop
  • Press the small “Assist” button between the Delete button and the display to turn on the computer and display the VAIO Care Menu
  • In the VAIO Care Menu select Start BIOS Setup


Turn off the UEFI boot mode in the BIOS

  • In the BIOS setup select Boot on the top of the screen
  • Press Enter on the Boot Mode option and select Legacy


Save the BIOS settings

  • Select Exit on the top of the screen
  • Select Exit Saving Changes and press Enter
  • Press Enter on Yes to save the changes

The computer will automatically try to restart into Windows 8

  • Keep the power button pressed to force it to shut down


Boot from the Windows 7 DVD

  • Start the computer with the “Assist” button
  • Insert the Windows 7 DVD into the DVD drive
  • In the VAIO Care Menu Menu select Start from Media (USB device/optical disc)


Install Windows 7

  • The computer will boot from the Windows 7 DVD
  • Select Install, Advanced installation
  • Delete all partitions on the hard drive
  • Create one partition (Windows will create another 100MB system partition for itself)
  • Select the large partition as the destination of Windows 7


Enjoy the last usable Windows version.

How to use your Skype account in Windows 8.1

When you click the Skype tile on the Windows 8.1 start screen the “modern” Skype application opens. It forces you to abandon your Skype user name and password and use a Microsoft account to log in.


There is a way to use the regular Skype desktop application on Windows 8.1

  • Open the web browser and navigate to http://www.skype.com/go/getskype-full
    This link will download the latest full desktop Skype application
  • Save the appication
  • When the download completed select Run to install the Skype desktop application
  • Log in with your regular Skype account name an password


To add the full Skype desktop application to the Windows 8.1 start screen

  • Click the down arrow at the lower left corner of the Start screen
    The page will display all of your installed applications in alphabetical order
  • Scroll to the right to see the Skype for Desktop icon in the Skype section
  • Right click the Skype for Desktop icon
  • At the bottom of the page select Pin to Start
  • Move the Skype for  Desktop application icon the desired location on your Start screen


To remove the “modern” Skype application icon from the Start screen

  • Right click the “modern” Skype application icon on the Start screen
  • At the bottom of the screen select Unpin from Start


To place the Windows 8.1 “modern” Skype icon back to the Start screen

  • Type Skype into the search field
  • Right click the Skype icon
  • Select Pin to Start

How to add tooltip to a Windows Form

In Windows Form applications the tooltip functionality is not built into the controls as in HTML objects.

To add tooltip to your controls on Windows Forms

  • Open the Windows Form in the designer
  • Drag the ToolTip control from the Common Controls section of the Toolbox to the form. The ToolTip control will be placed at the bottom margin of the design surface outside of the visible area of the form.
  • A new item appears in the Misc section of the property list of the form controls (buttons, textboxes, etc): ToolTip on toolTip1
  • Enter the text there you want the users to see when they hover above the control.

How to add a DataGridView to a Windows Form

To display data in a DataGridView on a Windows Form

  • Add a new form to the Win Form Application project
  • Drag a BindingSource from the Toolbox to the form
    Visual Studio Toolbox Data

 

  • The bindingSource object appears below the form
    Visual Studio DataGridview Binding DatSource insert

 

  • Rename the Binding Source
    • Select the bindingSource1 object below the form
    • Press F4 to display the Properties
    • Change the Name property to reflect the purpose of the object
      Visual Studio DataGridview Binding DatSource properties

 

  • Select the DataSource item in the Data section and click the Add Project Data Source… link
    Visual Studio DataGridview Binding DatSource properties select data source

The name is misleading. At this step we are not selecting the source of the data, we are selecting the object that describes the data row. The DataGridView will generate the columns based on the object we will select here.

  • To load the data from a class select Object as the Data Source Type and click Next
    Visual Studio DataGridview Binding Data Source properties choose data source type

 

  • Select the object that describes the data row you want to display
    Visual Studio DataGridview Binding Data Source properties select data object

 

  • Drag a DataGridView from the Toolbox to the form
    Visual Studio Toolbox Data data grid view

 

  • Select the small arrow at the upper right corner of the DataGridView to open the Tasks dialog
  • Click the down arrow next tot the Choose Data Source list
  • Select the Binding Data Source that you added to the form
    Visual Studio DataGridview select binding data source

 

  • Click the Edit Columns link to set the visibility of the columns
    Visual Studio DataGridview Edit Columns

 

  • To hide a column set the Visible attribute in the Appearance section to False
    Visual Studio DataGridview Column visibility
  • To load data into the DatGridView add the following code to the constructor of the form. In this example the GetUsers() method returns an array of UserView objects
    // Load the data into the DataGridView
    bindingSourceUsers.DataSource = _business.GetUsers();
  • To hide the row selector column on the left side of the data add the following to the constructor of the form. This option is not included in the property sheet of the DataGridView, so we have to set it in the code.
    dataGridView1.RowHeadersVisible = false;

How to test SOAP web services from outside of the server with a web browser

SOAP web services that accept primitive type arguments (string, int, etc.) can be tested from a web browser.
For security reasons this feature is disabled if the web browser runs on another machine. To enable testing the SOAP web services in the test environment from another machine add the following to the system.web section of the Web.config file:

<webServices>
    <protocols>
        <add name="HttpPost"/>
        <add name="HttpGet"/>
    </protocols>
</webServices>

DbArithmeticExpression arguments must have a numeric common type

The Microsoft Visual Studio 2013 Entity Framework database query does not support the subtraction of two dates to calculate TimeSpan.

For example the following statement will throw a runtime error:

site.VisitFrequencySec < ((TimeSpan)(dtNow - site.LastVisitDate)).TotalSeconds)

To solve the problem create a computed database column to calculate the difference between the dates and use the computed value for comparison.

Column definition:

[SecondsSinceLastVisit]  AS (datediff(second,[LastVisitDate],getdate()))

Now you can use the computed column in the C# Entity Network comparison.

site.VisitFrequencySec < site.SecondsSinceLastVisit

The underlying provider failed on Open

When you get the following error message in Microsoft Visual Studio 2013 check the inner exception.

System.Data.Entity.Core.EntityException was unhandled
  HResult=-2146233087
  Message=The underlying provider failed on Open.
  Source=EntityFramework

The inner exception gives you detailed information on the real cause of the error. Most of the time the inner exception is the following:

InnerException: System.Data.SqlClient.SqlException
       HResult=-2146232060
       Message=Cannot open database “…” requested by the login. The login failed.
Login failed for user ‘…’.
       Source=.Net SqlClient Data Provider
       ErrorCode=-2146232060

Check the rights of the user. Most likely the specified user does not have access to the database.

 

The Entity Framework provider … could not be loaded

When you create a new Microsoft Visual Studio 2013 project that uses the Entity Framework you may get the following error message:
The Entity Framework provider type ‘System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer’ registered in the application config file for the ADO.NET provider with invariant name ‘System.Data.SqlClient’ could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

  • Add the EntityFramework NuGet package to the Data Access project that accesses the database and the Web Application or Web Service project that calls the project
    • Right click the project in Solution Explorer
    • Select Manage NuGet Packages
    • On the left side select Online
    • On the right side enter EntityFramework into the search field
    • Click Install next to the EntityFramework package
  • Make sure your app config file contains the following lines:

 

<entityFramework>
  <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
    <parameters>
      <parameter value="v11.0" />
    </parameters>
  </defaultConnectionFactory>
  <providers>
    <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
  </providers>
</entityFramework>
  • Your project should contain a reference to EntityFramework.SqlServer.dll
  • Add the following line to the constructor of the class that accesses the database
var type = typeof(System.Data.Entity.SqlServer.SqlProviderServices);
  • Add the System.Data.Entity reference to the project accessing the database

How to migrate the Visual Studio 2013 user database to SQL Server 2008

When you create a new web application in Microsoft Visual Studio 2013 the user database it creates is version 706. SQL Server 2008 can only open databases up to version 663 or earlier. To migrate the new Visual Studio 2013 databases to SQL Server 2008 script the database tables and create them again in the SQL Server 2008 Management Studio.

  • Start Visual Studio 2013
  • Create a new web application with user authentication
  • On the left side select the Server Explorer
  • Click the arrow next to the Data Connections
  • Click the arrow next to DefaultConnection
  • Click the arrow next to Tables
  • Right click each table and select Open Table Definition

visual studio script database table

At the bottom of the screen the table definition script appears

visual studio script database table result

You have to create the tables in the appropriate order, to satisfy the foreign key references. The script below creates the tables in the right order:

CREATE DATABASE your_database
GO
USE your_database
GO

--  ---------------------------------------------------------------------

CREATE TABLE [dbo].[__MigrationHistory] (
    [MigrationId]    NVARCHAR (150)  NOT NULL,
    [ContextKey]     NVARCHAR (300)  NOT NULL,
    [Model]          VARBINARY (MAX) NOT NULL,
    [ProductVersion] NVARCHAR (32)   NOT NULL,
    CONSTRAINT [PK_dbo.__MigrationHistory] PRIMARY KEY CLUSTERED ([MigrationId] ASC, [ContextKey] ASC)
);
GO            

--  ---------------------------------------------------------------------

CREATE TABLE [dbo].[AspNetRoles] (
    [Id]   NVARCHAR (128) NOT NULL,
    [Name] NVARCHAR (MAX) NOT NULL,
    CONSTRAINT [PK_dbo.AspNetRoles] PRIMARY KEY CLUSTERED ([Id] ASC)
);
GO

--  ---------------------------------------------------------------------

CREATE TABLE [dbo].[AspNetUsers] (
    [Id]            NVARCHAR (128) NOT NULL,
    [UserName]      NVARCHAR (MAX) NULL,
    [PasswordHash]  NVARCHAR (MAX) NULL,
    [SecurityStamp] NVARCHAR (MAX) NULL,
    [Discriminator] NVARCHAR (128) NOT NULL,
    CONSTRAINT [PK_dbo.AspNetUsers] PRIMARY KEY CLUSTERED ([Id] ASC)
);
GO

--  ---------------------------------------------------------------------

CREATE TABLE [dbo].[AspNetUserClaims] (
    [Id]         INT            IDENTITY (1, 1) NOT NULL,
    [ClaimType]  NVARCHAR (MAX) NULL,
    [ClaimValue] NVARCHAR (MAX) NULL,
    [User_Id]    NVARCHAR (128) NOT NULL,
    CONSTRAINT [PK_dbo.AspNetUserClaims] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_dbo.AspNetUserClaims_dbo.AspNetUsers_User_Id] FOREIGN KEY ([User_Id]) REFERENCES [dbo].[AspNetUsers] ([Id]) ON DELETE CASCADE
);
GO

--  ---------------------------------------------------------------------

CREATE TABLE [dbo].[AspNetUserLogins] (
    [UserId]        NVARCHAR (128) NOT NULL,
    [LoginProvider] NVARCHAR (128) NOT NULL,
    [ProviderKey]   NVARCHAR (128) NOT NULL,
    CONSTRAINT [PK_dbo.AspNetUserLogins] PRIMARY KEY CLUSTERED ([UserId] ASC, [LoginProvider] ASC, [ProviderKey] ASC),
    CONSTRAINT [FK_dbo.AspNetUserLogins_dbo.AspNetUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [dbo].[AspNetUsers] ([Id]) ON DELETE CASCADE
);
GO
CREATE NONCLUSTERED INDEX [IX_UserId]
    ON [dbo].[AspNetUserLogins]([UserId] ASC);
GO

--  ---------------------------------------------------------------------

CREATE TABLE [dbo].[AspNetUserRoles] (
    [UserId] NVARCHAR (128) NOT NULL,
    [RoleId] NVARCHAR (128) NOT NULL,
    CONSTRAINT [PK_dbo.AspNetUserRoles] PRIMARY KEY CLUSTERED ([UserId] ASC, [RoleId] ASC),
    CONSTRAINT [FK_dbo.AspNetUserRoles_dbo.AspNetRoles_RoleId] FOREIGN KEY ([RoleId]) REFERENCES [dbo].[AspNetRoles] ([Id]) ON DELETE CASCADE,
    CONSTRAINT [FK_dbo.AspNetUserRoles_dbo.AspNetUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [dbo].[AspNetUsers] ([Id]) ON DELETE CASCADE
);
GO
CREATE NONCLUSTERED INDEX [IX_RoleId]
    ON [dbo].[AspNetUserRoles]([RoleId] ASC);
GO
CREATE NONCLUSTERED INDEX [IX_UserId]
    ON [dbo].[AspNetUserRoles]([UserId] ASC);
GO

Execute the script in the SQL Server Management Studio