executor

This error has greeted me several times before in the past when working with Msysgit on Windows. It alway appears for no apparent reason; sometimes from one boot to the next, and sometimes it suddenly starts happening while the system is running. Once the error is there, it stays consistently at the very least until the next reboot. Sometimes it only happens for specific commands like “git log”, sometimes it seems to affect every cygwin command.
Continue reading Msysgit couldn’t reserve space for cygwin’s heap

Yesterday, I listened to an episode of the .NET Rocks podcast featuring Scott Hanselman and Chris Sells talking about HTML and JavaScript in today’s modern web. While the episode is essentially hysterically funny and I quite like Hanselman and his (at times) extremely helpful blog posts, there is a lot in this particular episode that rubbed me the wrong way and I somehow need to get this off my chest.
Continue reading Why “Browser OS” is a stupid idea

Recently I stumbled on a piece of PowerShell syntax that confused me massively on first glance

$ some-command |% {some-expression}

It took me a while to find the documentation for that since I was of course looking in the wrong place. It looked to me like some sort of special pipe, when in fact it is just a pipe “|” followed by the ForEach-Object CmdLet which has an alias that (unfortunately) is “%”. So what was actually happening is:

$ some-command | ForEach-Object {some-expression}

For example, I used this to basically fill in some placeholders in a template file

$ Get-Content "mytemplate.txt" |% {$_ -replace "PLACEHOLDER", "42"}

Have you ever wondered whether it is possible to create your own collection initializers just like for the List<T>?

var list = new List { 12, 42, 256, 1024 };

Well… doing that is actually extremely simple. All your custom object needs is a public Add method that takes whatever arguments you might want. Don’t try to analyze the code, I know that it doesn’t make any sense at all – it’s just an example

public class MyCollection : IEnumerable
{
	private List _list = new List();

	public void Add(Predicate predicate, T trueValue, T falseValue)
	{
		_list.Add(new MyIfThen { Predicate = predicate, TrueValue = trueValue, FalseValue = falseValue });
	}

	public struct MyIfThen
	{
		public Predicate Predicate;
		public T TrueValue;
		public T FalseValue;
	}

	#region IEnumerable Members

	public IEnumerator GetEnumerator()
	{
		return _list.Select(ifthen => ifthen.TrueValue).GetEnumerator();
	}

	#endregion

	#region IEnumerable Members

	System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
	{
		GetEnumerator();
	}

	#endregion
}

...

var mine = new MyCollection
		   {
			   {i => i%2 == 0, 12, 42},
			   {i => i%3 == 0, 33, 66},
		   };

I have recently run into a very peculiar problem: After the switch to .NET 4, our company website started reporting strange errors. The exception message reads as follows

The page is performing an async postback but the ScriptManager.SupportsPartialRendering property is set to false. Ensure that the property is set to true during an async postback.

And even weirder is that after some investigation and adding some debug information to the exception log it became clear that all those exceptions were “caused” by Safari UserAgent strings (iPhone, iPad, …) that according to the ASP.NET browser capabilities were “recognized” as “Mozilla 0.0” Browsers with basically no capabilities whatsoever. Continue reading ASP.NET 4 BrowserCaps (or: what were they thinking?)

Previously I thought this was not possible, since the ASP.NET postback involves POST-ing the all-encompassing ASP.NET form, but I am here to tell you, that it is indeed possible to do a postback to a new window or even a popup (created with window.open). In fact, it is surprisingly simple. All you really have to know is that the “target” attribute you know from anchors (links) works exactly the same way for forms!
Continue reading ASP.NET Postback to new Window or Popup

That one recently cost me a couple of hours and quite a bit of nerves to figure out: In a 64bit Windows, if a 32bit process accesses the Registry, it actually interacts with a DIFFERENT registry than a 64bit process. This means that your 32bit compiled program potentially reads and writes different registry keys than the same program compiled for 64bit! I’m sure you can imagine how this might result in seemingly strange behavior if you don’t know that. Windows Registry FTW, right?

Since regedit.exe runs as a 64bit process, you can usually only see the 64bit registry, but what if you want to see/change 32bit entries? It turns out you can do that if you know how this registry redirection works. In every node in the (64bit) registry there CAN be a child node with the name “WOW6432Node” that contains the 32bit entries that override/amend the 64bit entries. The only WOW node that I could find in my registry was in HKLM\SOFTWARE, but the concept works for every other part of the registry.

Source: http://msdn.microsoft.com/en-us/library/aa384253%28v=vs.85%29.aspx