If you asked me a year ago what was the most awesome feature that Windows has and that
MacOS doesn’t, I would have probably scratched my head for a bit, mentally
sorting through all the obscure advanced things you can do with the Windows SDK
and a few lines of code, or all the little things that make organizing files so
much easier than with the horrible Mac Finder.
But if you ask me now, I’ll reply straight away this: mapped network drives.
You would think there’s not much to it, but this has been my biggest problem
as a user when I switched to a Macbook Pro as my main machine. In the first part
of this 2-part post, we’ll look at the problem. Go to part 2 for the
solution I’m using.
One of my laptops is getting old and the lid is not as sturdy as it used to be. It now has the unwanted tendency of triggering a “laptop lid open” event when you barely touch it because the lid moves up a bit and back down. This is problematic because it wakes up the operating system, which doesn’t always detect that the lid was closed immediately.
When you run an internet search about laptop lids and putting Windows on stand by or hibernate, you find a lot of stuff, but nothing useful about disabling resume. To solve this problem you need to think like a programmer, i.e. find a solution that kinda makes sense, but not really.
Obviously, the answer lies in the Power Options dialog, but the only setting you have access to is what to do when the lid is closed, not when it is open.
Well, here comes the shocking answer: if you put your computer on stand by when you close your lid, it will wake up when you open it. But if you don’t do anything when you close your lid, it won’t do anything either when you open it!
Setting that first combobox above to “Do nothing” therefore fixed my problem. Now, I can close the lid, let the computer go to sleep after 5 minutes of inactivity, and move it around without fear of it waking up because the lid is too sensitive. I do have to press the power button to wake it up instead of just opening it, but that’s not too awful.
These, days, I'm back doing PHP stuff at home, and therefore had to install Apache. Of course, I could do PHP under IIS7, which would be easier, what with the nice administration interface and all, but I need to recreate the same environment as my hosting solution, complete with .htaccess and all that stuff.
One of the first thing you need to do in this situation is to add an alias to your websites because they probably aren’t located in the default documents root. So I did that, I opened httpd.conf in Notepad, edited it, saved it, restarted Apache, and off I went to write some PHP code.
A few days later, I want to move my websites to another directory, and add a few other ones. This time, I open httpd.conf in SciTE because I remember it’s got some nice syntax highlighting for this. I edit it, save it, restart Apache, and… mmmh, Apache doesn’t look like it noticed the changes. It’s still using the old locations, and none of the new ones.
After a couple hours of debugging, reading the logs and cursing at Apache, I realize who’s to blame: Vista. I should have known… I mean, everybody’s blaming it for everything, so I should have followed the crowd from the start. As it always is in these situations, the basic problem was that I was not editing the correct file. This is one of the golden rules of troubleshooting:
If a program looks like it’s not picking up the changes in a file you just edited, you most likely edited the wrong file.
This time, though, I really didn’t think there was a problem. After all, I had an explorer window open on Apache‘s conf directory, and I was either drag and dropping httpd.conf on SciTE, right-cliking and using "Open in SciTE", or going File > Open directly in SciTE.
When I entered "full paranoid mode" (you know, that mode you get into when nothing works and you feel you don’t trust anything anymore, even the magnetic fields and gravity), I noticed an unknown button in explorer:
Do you see it? It’s the "Compatibility Files" button on the tool bar. "What the fuck is that?", I thought, and I clicked on it. It led me to this:
I’ve selected the address bar so you can see the physical location of this thing.
All my cursing immediately redirected to Vista.
Scott Hanselman already got burned by the same thing and he explains it all, so go there if you want to know more about this whole thing… but basically, it’s a backward compatibility system that allows "legacy" applications that don’t explicitely require privilege elevation to still "work" by being redirected to a virtual storage when they perform file system operations on items the current user doesn’t have access to. In plain language, it allows crappy applications that assume you’re an Administrator to work correctly even though you’re not.
Now, the problem is that SciTE is not a crappy application. It’s just a text editor. When I opened the file, it should have seen I didn’t have access to that file, therefore treating it like any other read-only file: display a "Read Only" warning in the title bar, prevent me from editing or saving it, etc. But no, because Vista told it otherwise. Vista said "yeah, it’s okay, this file is totally writeable, no problem" while hiding the fact that it was redirecting that process to another place, so SciTE went along with it.
I understand that backward compatibility is a huge thing in the enterprise, and is actually one of the main reasons of Windows‘ commercial success, but it obviously fails in this situation. It’s wrong to tell a text editor that a configuration file is writeable when it’s not. It probably works in lots of other cases, allowing lots of big, expensive legacy programs to run correctly, but it fails here.
Scott suggests that the UI should do a better job of, well, not letting the user waste time figuring out where his files went, but I think the problem is deeper. I think this kind of "feature" should be a choice in the first place, not something that’s forced upon the user. The assumption that users are Administrators was in the long run a mistake, and there’s no way around a mistake without getting bitten in the ass at some point. There should be a way to just face it, and risk breaking programs. This is not desirable in most business places, but it may be desirable on lambda users’ machines. Yes, it would break stuff, but Vista already had a hard time with it already anyway, and Apple managed to go through a similarly harsh transitions before. We should be able to install Windows without 20 years of Side by Side libraries and "magical" weirdnesses like this one if we want to.