Switching OpenID providers through delegation

Back in the days, when I decided to join StackOverflow, I was forced to create an OpenID – because this is the way to login on StackOverflow.

I decided to use an independent OpenID provider, called myOpenID. I also set up OpenID delegation. This way I could use my own domain name as my OpenID. (OpenID uses URLs as user names, like http://manski.net.)

Now, myOpenID is shutting down on Feburary 1, 2014. Thus, I had to switch my OpenID provider.

Fortunately, OpenID delegation makes this easy – you just replace the two delegation <link> tags and you’re done.

Unfortunately, not all OpenID providers seem to support this. I tried Google (which should work according to this), but StackOverflow always wanted to create a new account for me. (May also be StackOverflow’s fault, I don’t know.)

Fortunately, StackOverflow provides its own OpenID service:

https://openid.stackexchange.com/

So I created a new OpenID there, replaced the <link> tags (details), done. Works like a charm.

Disable UAC in Windows 8

In Windows 8, Microsoft changed the UAC slider’s lowest setting from “Disable UAC” to “Hide UAC”.

So, even with the lowest setting programs will still not run with Administrator privileges (like in Windows 7).

Windows' "Run" dialog with UAC still active.
Windows’ "Run" dialog with UAC still active.

To disable UAC, execute this PowerShell script as Administrator (e.g. via powershell from an Admin Command Prompt):

Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value "0"

After that restart and UAC is disabled.

Windows' "Run" dialog with UAC disabled.
Windows’ "Run" dialog with UAC disabled.

Notes:

  • Only do this, if you’re aware of the consequences. Disabling UAC may make the system less secure.
  • The Windows 8 Store can’t be used anymore if UAC is disabled. (You can, especially, no longer installed Windows 8.1.)
  • To reenable UAC, use -Value "1" in the command above.

LINQ to SQL – bits and pieces

In a project I’m currently working on we’re using LINQ to SQL. While most of it is straight forward, there are some quirks that are not that obvious (at least to me).

This article is mostly a FAQ but I will explain some of the not-so-obvious features in more detail.

Note: I’m not going to explain how to setup the connection to the database in this article. I’m assuming that this already works.

Read more →

P/Invoke Tutorial: Passing strings (Part 2)

In the previous tutorial we passed a single string to a native C/C++ function by using P/Invoke.

This function was defined like this:

// C++
void print_line(const char* str);
// C#
[DllImport("NativeLib.dll")]
private static extern void print_line(string str);

However, there exists a hidden pitfall here:

What happens when the user passes a non-ASCII character to this function?

Read more →

Native libraries in MonoDroid library projects

Currently, MonoDroid (Mono for Android) doesn’t support native libraries (or any other Android resource type) in library projects (bug report). Fortunately, they support normal .NET assembly resources. This led me to write a workaround for this missing feature.

The Class

Here’s the class that implements to loader.

MonoDroidLibraryLoader.cs

History:

  • 2012-07-18: Updates documentation and added some logging
  • 2012-07-11: Initial revision

How to use

To use this class, you first need to create a directory structure for the native libraries, like this:

Project
+- NativeLibs
   +- armeabi-v7a
   +- armeabi
   +- other ABIs you want to support

Now place the native libraries in the apropriate directories, for example:

Project
+- NativeLibs
   +- armeabi-v7a
   |  +- libsqlite.so
   +- armeabi
      +- libsqlite.so

Then select “Embedded Resource” as Build Action in the file’s properties (Hotkey: F4).

Selecting "Embedded Resource" as "Build Action"

Now use one of the Load() methods to load the library. For example, if you have a type called MyType in the project’s default namespace (specified in the project settings), you can use this call to load a library called libsqlite.so:

MonoDroidLibraryLoader.Load("sqlite", typeof(MyType));

Note: If you renamed the directory “NativeLibs” from above, you can specify it as third parameter for Load().