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
executor
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"}
I work quite a bit with Git these days and I do that cross-platform. On Windows I tend to use msysgit (with the GIT Bash) since I already know my way around the Git command line and quite frankly, I like it. One of the things I always have to Google together from different sources is how to get an SSH setup that allows me to authenticate with Github and my own repositories using public/private keys. Continue reading OpenSSH Configuration
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}, };
If you’re working with Windows, your definitely familiar with the sight of the “[Application] has stopped working” ™ dialog
Whether that is good or bad in general? I don’t care. Not today at least. I am much more interested in a particular use case where this is most certainly not what you want. That case is if you run another application as a sub-process using the System.Diagnostics.Process class. Maybe you’re running other applications that simply crash occasionally and you want to automatically restart them, maybe you just don’t want the users to know. In any case, if the sub-process pops up with this dialog it doesn’t terminate the actual process until one of the buttons is clicked which is absolutely not what I wanted in my use case. Continue reading Suppress the “[Application] has stopped working” Dialog
Recently, my feelings towards PowerShell have been somewhat ambivalent. There are some seriously good ideas in the PowerShell design. I really want to like it, it’s just that it makes it very hard sometimes… Let’s just say you have the simple task to create a file that contains a list of all files in a specific directory – recursively of course. You’ll probably start with the Get-ChildItem cmdlet (aka “ls”) which gives you the files in the current directory.
Continue reading PowerShell output formatting trouble
$ Get-ChildItem
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