Skip to content

2014

Unable to generate an explicit migration because the following explicit migrations are pending

After renaming the namespace of some POCO classes from Primo.LicenseManager.Models to Primo.Licensing.DataModel, the Entity Framework scaffolding no longer recognizes the applied migrations:

Add-Migration -Name AddInvoiceEntity -Verbose -StartUpProjectName LicensingDataModel -ProjectName LicensingDataModel

Unable to generate an explicit migration because the following explicit migrations are pending: [201310191546582_CreateTables]. 
Apply the pending explicit migrations before attempting to generate a new explicit migration.

In SQL Server Management Studio:

select * 
from __MigrationHistory 
where MigrationId = '201310191546582_CreateTables'

MigrationId: 201310191546582_CreateTables
ContextKey: Primo.LicenseManager.Models.Migrations.Configuration
Model: 0x1F8B08000000....
ProductVersion: 5.0.0.net45

The problem

In the database, the ContextKey in the __MigrationHistory table is still the old namespace: Primo.LicenseManager.Models.Migrations.Configuration.

The solution

Update the ContextKey to the new namespace Primo.Licensing.DataModel.Migrations.Configuration

update __MigrationHistory 
set ContextKey = 'Primo.Licensing.DataModel.Migrations.Configuration'
where MigrationId = '201310191546582_CreateTables'

Now this works:

Add-Migration -Name AddInvoiceEntity -Verbose -StartUpProjectName LicensingDataModel -ProjectName LicensingDataModel

How to upgrade the Linux kernel to 3.11 on Ubuntu 12.04.4 LTS

I have two Ubuntu 12.04.4 virtual machines that I use for building and testing AVBlocks - one 32 bit (i386) and one 64 bit (x86_64). Normally I keep them in sync and regularly updated via the Update Manager.

I noticed today that for some reason, the 32-bit machine upgraded to Linux kernel 3.11, but the 64-bit machine is stuck with Linux kernel 3.8. The Update Manager reports that both systems are up-to-date, yet the kernel versions are different on both systems.

Ubuntu 12.04.4 LTS x86_64

uname -a
Linux ubuntu-12-04-x64 3.8.0-39-generic #58~precise1-Ubuntu SMP Fri May 2 21:33:40 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.4 LTS
Release:    12.04
Codename:   precise

Ubuntu 12.04.4 LTS i386

uname -a
Linux ubuntu-12-04-i386 3.11.0-20-generic #35~precise1-Ubuntu SMP Fri May 2 21:35:48 UTC 2014 i686 i686 i386 GNU/Linux
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.4 LTS
Release:    12.04
Codename:   precise

The solution

After some reading on internet, I found that, only installations made from Ubuntu 12.04.2 ISO images and above will receive the 3.11 Linux kernel update automatically. For all other installations you will have to update it manually per this Ubuntu wiki article.

So, for Ubuntu 12.04.4, you have to install the Saucy (13.10) Hardware Enablement Stack:

sudo apt-get install --install-recommends linux-generic-lts-saucy xserver-xorg-lts-saucy libgl1-mesa-glx-lts-saucy
sudo reboot

Executable shell scripts open in Gedit on Ubuntu

This started happening after an upgrade to Ubuntu 13.04. We have shell scripts here and there saved as .run files, e.g. Build.linux.auto.run, to automate AVBlocks builds on Linux. Normally Nautilus will ask you whether you want to run the script when you double click a .run file, but on Ubuntu 13.04, Nautilus suddenly started opening .run files in Gedit. It turns out there is a setting in Gnome for that. Here is how to fix it:

  1. Run dconf-editor and navigate to org.gnome.nautilus.preferences
  2. Change the value of the executable-text-activation setting from display to ask.

If you do not have dconf-editor you can install these packages:

sudo apt-get install dconf-tools
sudo apt-get install gconf-editor

And just in case, this is how you run it:

dconf-editor

How to fix Tortoisehg Nautilus extension on Ubuntu 13.04

The TortoiseHg Nautilus extension stopped working after upgrading one of my Ubuntu machines from 12.10 to 13.04. It turned out the problem was it could not find libpython2.7.so.1.0.

Here is the fix on a 32-bit distro:

sudo ln -s /usr/lib/i386-linux-gnu/libpython2.7.so.1.0 /usr/lib/libpython2.7.so.1.0
nautilus -q

and on a 64-bit distro:

sudo ln -s /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 /usr/lib/libpython2.7.so.1.0
nautilus -q

Dual boot Windows 8.1 for VirtualBox and Hyper-V

Most of the time I use VirtualBox to run Linux distros like Ubuntu and Debian. At the same time, I have to work with Windows Phone SDK which needs Hyper-V to run the Windows Phone emulator. Understandably VirtualBox and Hyper-V will not run at the same time. The easiest way I found to solve that problem is creating a dual boot configuration where one of the boot options has Hyper-V disabled. Here is how to do it:

Run Command Prompt (not PowerShell) as Administrator and execute the following commands (note that the GUID will be different on your system):

bcdedit /set {current} hypervisorlaunchtype off 

bcdedit /copy {current} /d "Windows 8.1 with Hyper-V"
The entry was successfully copied to {5e0b6781-81ec-11e3-be83-74d02bc4e906}.

bcdedit /set {5e0b6781-81ec-11e3-be83-74d02bc4e906} hypervisorlaunchtype auto 
The operation completed successfully.

You should now have two boot options in the Windows start menu: "Windows 8.1" and "Windows 8.1 with Hyper-V". To switch between the different configurations, make sure you hold the Shift key while clicking on the Restart option.