SharpKeys: Reviving the missing < and > key using Norwegian layout on a US keyboard

At Microsoft Build this year we were so lucky to receive a HP Spectre x360, and it has proven to be quite a decent 2-in-1 (check out reviews etc). The only problem: it has a US keyboard. Being Norwegian I’m used to a different keyboard layout, so keys are a bit misplaced (yes, I said it). So far it has been fine. As long as I don’t look at the keys the muscle memory takes care of hitting the right ones according to the norwegian keyboard layout.

For most people this will be fine for most usecases, but in case you’re a developer then you might want to use the lesser and greater than keys (< and >). Using a Norwegian layout on a US keyboard these keys do not exist as far as I can tell. On a Norwegian keyboard we have an extra key next to the Z key that houses both < and >:

Huh, where's that key?
Huh, where’s that key?

There’s an easy fix if you’re willing to let another key be replaced. Caps lock is a key that I don’t use at all, so for me it was easy to remap caps lock. Surprisingly there weren’t many guides online that adressed this specific issue that I could find.

To help us with this issue download the SharpKeys tool from their codeplex site. Install it on your system.

To add a key mapping simply click Add, and you’re presented with a simple dialog where you can choose which key to map from and which key to map to.

The SharpKeys interface
The SharpKeys interface

At first I felt a bit disheartened because the list was made for US keyboards so the specific key that I was looking was not present. Not at first. After a bit of thinking I found a USB keyboard that I had, hooked it up and clicked the Type key button. I hit the <> key and it got detected as key: Unknown: 0x0056 (00_56). Very intuitive I know!

Add/Edit key mapping. Use the Unknown: 0x0056 (00_56) for <> keys
Add/Edit key mapping. Use the Unknown: 0x0056 (00_56) for <> keys

When you’re all set, hit ok, then the “Write to registry” button. Sign in and out and you should be set!

I hope this can help others with this issue who are feeling a little lost like I felt when I started my Google with Bing search.

Azure WebJobs: You need Connection Strings

If you run into any trouble after adding a fresh Azure Webjob to your project and try to run it, my guess will be it has to do with connection strings and a missing storage account. If you don’t have an Azure Storage Account then creating one will be the first step. You then need to define these two connections strings in your web app: Portal (Web App -> Configure):

  • AzureWebJobsDashboard
  • AzureWebJobsStorage

connection-strings

And the format for those connection strings:

Replace STORAGE_ACCOUNT_NAME with the name you give the storage account and get the PRIMARY_ACCESS_KEY from the Portal.

If you’re going to connect to a database, also make sure that the name of the connection string you’re using is present in the Portal as well. Otherwise, if you use something like ‘DefaultConnection’ (in your DB context) which is the default one, the Azure Web App will make sure to make that work, but WebJobs will not. When you look at the connection strings in the portal you will probably not find DefaultConnection, but something along the lines of “prod_db” etc. Either rename the connection string on both ends or make sure that ‘DefaultConnection’ is present so that WebJobs can access it.

Hopefully this little post can be of some help if you run into the same problems as I did.

VS2013: An exception has been encountered. This may be caused by an extension.

Hey peeps,

Ever gotten the nice error dialog when opening your Visual Studio saying something like: “An exception has been encountered. This may be caused by an extension. You can get more information by bexamining the file ~AppDataRoamingMicrosoftVisualStudio12.0ActivityLog.xml”?

Then after reading that, you think “OK, lets check it out. Might be some useful information there”.

Opening up the ActivityLog.xml you’ll probably notice that your assumption might have been slightly off base:

System.IO.IOException: The file exists. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.IO.Path.InternalGetTempFileName(Boolean checkHost) at Microsoft.VisualStudio.Text.Utilities.WpfHelper.LoadCursorDPIAware(Stream cursorStream) at Microsoft.VisualStudio.Text.Editor.Implementation.LeftSelectionMargin.get_RightArrowCursor() at Microsoft.VisualStudio.Text.Editor.Implementation.LeftSelectionMarginProvider.CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin) at Microsoft.VisualStudio.Text.Utilities.ContainerMargin.<AddMargins>b__2(IWpfTextViewMarginProvider mp) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension,TMetadata,TExtensionInstance](Object errorSource, Lazy2 provider, Func2 getter)

Boom! Now what to do with that? Turns out this indicates that Visual Studio or some extension has difficulties creating files/folders in your Temp folder, because it is full! Full being it has over 65535 files/folders in it. Cleaning up the temp folder will do the trick, and also save you some space. In my case I had 4 GB of crap laying around. (Where did all that come from and why weren’t it deleted automatically?).

Oh, your Temp folder is probably located here: C:UsersYOURUSERNAMEAppDataLocalTemp.

Have fun!

Xamarin iOS: Build host too old?

Hey guys,

I just wanted to post a quick tip a way to resolve the error “The build host is too old for this version of Xamarin.iOS extension” in Visual Studio. This seems to occur if you recently set up a proxy of some sorts or have installed a tool like Fiddler.

I had just installed Fiddler to capture HTTP packets for monitoring my requests and responses when communicating with a back-end. Turns out Fiddler had enabled a proxy of a sort that disrupts the Xamarin Build host connection into thinking that the build host is too old.

Opening up Fiddler and turning off all the Proxy-settings I could find, the connection was fixed and I could build again. Happy days.

 

Xamarin iOS: Could not instantiate class named MKMapView

This might not occur that often in your projects but if you find yourself dropping a MapView on your storyboard and then just running the app you will most certainly will experience a crash. Why?

  1. Make sure you have enabled Map services in your Info.plist file
  2. Make sure you give your MapView a name (that automagically creates an outlet)

If you don’t give your MapView a name then the Xamarin/Mono linker will not link in the MapKit framework due to it not being used in code.

Fixing auto-increment sequences in PostgreSQL

Exporting from SQLite3 and other database-sources and importing them into PostgreSQL might generate some head-scratching errors when you’re trying to insert new rows. You might see an error like this one: “ERROR: duplicate key value violates unique constraint “posts_pkey”“. The error indicates that it’s trying to insert a row into the database with an ID that already exists. Why does this happen? PostgreSQL seems to use something called a “sequence” which we can view and edit using functions like setval and nextval . Anyway, the quick fix is provided by an answer from a thread at Stackoverflow:

UPDATED: Removed the incrementation of MAX(ID) by one. Setval sets the value to the current id so when a new ID is stored nextval will return id + 1.

Reading Mac formatted drives/images in Windows

HFSExplorer Main WindowThe other day I was going to watch a couple of episodes of Drew Carey’s Improv-A-Ganza at my girlfriends place and I brought my laptop so we could hook it up to the TV via HDMI. She runs all Mac and had an external drive with her which she transferred the episodes onto. What we didn’t know and what I didn’t think of at first was that the external drive was formatted in HFS+ which Windows can’t handle. So what do we do when we stumble upon such a problem? We use HFSExplorer from Catacombae!

[box icon=”info”]HFSExplorer is an application that can read Mac-formatted hard disks and disk images.

It can read the file systems HFS (Mac OS Standard), HFS+ (Mac OS Extended) andHFSX (Mac OS Extended with case sensitive file names).[/box]

Using this handy tool it was an ease to extract the episodes from the drive and everyone was happy!

If you encounter an error that you’re missing MSVCP71.dll which I did (I run Windows 7) you’ll find the files you need at this site. Also included is an easy guide on how to install the files which is copying the two files to either WindowsSystem32 or WindowsSysWOW64 if you run a 64-bit system.

Linux/Ubuntu: The problem of the line!

In my last post I went through the steps on how to set up a dual-monitor system in Linux the way you wanted to. I had my laptop on the left side of my main monitor and I couldn’t get it right with the ATI Catalyst Control Center so I had to resort to a script that utilized xrandr.

I mentioned in my last post that I experienced a little problem though, an annoying 1-2 pixel wide line that pushed the desktop on my main monitor to the right. I don’t know why but I figured out what seemed to have happened. It seems that the auto resolution on the laptop monitor caused it to extend onto the main display. The resolution which was set was 1366×758. I didn’t think it would do any good so I joked with the idea of setting the resolution down to 1360×758, and I did for fun and it magically fixed everything!

The only thing is that I don’t know why I had to do that, because the resolution I have on my laptop screen in Windows is 1366×758 and it works fine with dual monitors. It’s a strange world…

Linux & ATI: Making your second monitor the main display!

Hi all!

If you’ve followed my “Linux on my laptop” page you probably know of this problem. The ATI Catalyst Control Center won’t allow me to set my second monitor as my main display and let it extend onto the laptop screen which is positioned left of my 26″ monitor. After wiping my drive and making Ubuntu 10.10 : MAVERICK! my main operating system and getting the “good luck” from the Ubuntu IRC channel I started my quest to solve the problem. Turns out you can do it! The poster on the ubuntu forums had a nifty little script that after modifying solved my problem! The solution involves using xrandr to turn off the displays and then re-enable them with the proper settings.

xrandr –output LVDS –off;
xrandr –output DFP1 –off;
xrandr –output DFP1 –auto –primary;
xrandr –output LVDS –auto –left-of DFP1;

The two first commands there turns off LVDS (Laptop Display) and my 26″ monitor (DFP1). The last two sets DFP1 as the primary screen, and will auto extend the LVDS left of DFP1. This works like a charm except there’s one little bug I’m experiencing. I’ve got a 1 pixel wide line that runs right at the left edge of my 26″ monitor pushing the desktop 1 pixel to the right. It’s a little annoying at first but I hardly notice it now, although it still appears when running full screen video so I guess that can be a little annoying but it’s something I will work on getting rid of 🙂 There’s also one thing worth mentioning: I have to run the script every time I boot Ubuntu if I’m in a dual-monitor setup. For me that’s no problem, as either I’m at school with only my laptop display or I’m home running the system without rebooting until I have to shutdown for school.

At least it’s a step in the right direction! Hopefully one day it can be as simple to do as the new Screen preferences in Windows 7 🙂

Getting Linux right on a laptop with switchable graphics (almost)

The reason why I haven’t used Linux for a while, especially on the laptop that I use is the way my laptop is built. It has a switchable graphics solution that lets me choose from the integrated Intel HD card and the ‘external’ ATI Mobility Radeon HD 5850 card. I must say, it’s a real good solution when it works properly; which it kinda does when I use Windows 7. The amount of battery life you get when going into the power saving mode with the Intel HD card is astonishing. I get everything from 7 to 9 hours out of the thing before I have to plug in the AC adapter. Anyways, this particular feature isn’t working too well in Linux at the moment. You can’t install the ATI drivers for the Radeon card, because it won’t work properly. I would gladly use it the way the system is set up after a clean install of say Ubuntu 10.10 or Linux Mint but without the ability to set up dual monitors or use accelerated 3D graphics there’s really no point for me.

BIOS Switchable Graphics

A while back I stumbled upon some notes while searching for a solution for this very problem and while I can’t recall where this was posted or who posted it but the solution to getting your laptop running smoothly with Linux is to change a setting in BIOS. I bet there’s an option for turning the switchable graphics from Enabled to Discrete/Disabled or maybe you’re lucky and get to choose what card to use. Disabling the switchable

graphics results in it only using the external ATI card which then allowed me to install the proprietary ATI drivers properly and getting it to work! My life was getting back on the right track..

.. until I started fiddling about with the dual-monitor settings. I haven’t done enough research or asked the right persons about this issue yet but from what I can gather from the Catalyst Control Center there’s no way to set my second monitor as my main display. I have a 26″ 1080p display that I use as my main display and then extend the desktop onto the laptop’s screen. My temporary solution was to just disable the laptop’s display from the Control Center, but turns out that might cause some problems with the accelerated graphics and compositing.

Why do I keep pursuing this Linux business? Well, those couple of hours I spent using Linux Mint was incredible. I’ve missed the sheer elegance of the GNOME desktop environment and how snappy the interface can be. Everything seemed to be going on overdrive in contrast to Windows 7 which I just did a fresh install of.

If anyone out there have a simple solution for this problem please let me know!