Category Archives: Windows

Using WinRT from Winforms

It is beyond doubt that WinRT simplifies the development of our Apps, specially when we’ve to access devices like webcams or gyroscopes. But, is it possible to use these new APIs from our good old friend Winforms or are they restricted to Windows Store Apps?

I don’t know why Visual Studio does not allow you to use them out of the box, but don’t worry cause the procedure to enable that feature is quite simple. Just follow these steps:

  1. Open your .csproj file with your favorite text editor
  2. Add the following element as a child of the Project element:
<PropertyGroup>
    <targetplatformversion>8.0</targetplatformversion>
</PropertyGroup>

That’s it! Now you can open the project with Visual Studio and you’ll be able to add a reference to WinRT:

image

Updating from Windows RT 8.1 Preview to Windows RT 8.1 RTM

I’m one of those who always need to have the latest version of everything, regardless of the drawbacks that might lead me. I’m, by definition, an early bird. Having said that, it’s easy to figure out that my Surface RT was running Windows RT 8.1 Preview.

  • Go to Windows Update, desktop version, and install all updates (even the optional ones)
  • Try a reboot, just in case
  • If the Store is still refusing to show the update, open a browser and go to this URI ms-windows-store:WindowsUpgrade

That last URI should open the Store and show the update. Keep in mind that the process will take up to 2 hours and there is no indicator whatsoever about the progress of the update. You can take a look at the Task Manager to see CPU and Network usage to ensure that something is really going on.

Hopefully after that process you’ll have a Windows RT 8.1 RTM device ready to be used

How to hibernate Windows 8

Windows 8 is Fast and Fluid. It boots much faster than its predecessors, but sometimes you just wanna make it hibernate. Unfortunately, that doesn’t seem to be an option, cause if you try, the option won’t be there

Does this means that Windows 8 doesn’t know how to hibernate? No. It means that the vast majority of the users don’t give a shit about what’s going to happen once they press the power button. They trust the OS to do what’s best for them. However, does who know what hibernate mean might be tempted to use it so, how can we enable it?

We’ll have to go Power Options (you can search of it in de Start Screen under Settings or execute powercfg.cpl):

power

From there we’ll get into “Choose what the power button does” and then “Change settings that are currently unavailable”.

power1

That’ll allow you to modify the options and there is one for hibernate. You only have to check it and the next time you try to shutdown your machine the option to hibernate will be present.

power2

power3

I’ve to say that the vast majority of the time I only sleep my machines, but if you’re gonna be away from home for a while it might be useful to have the option 😉

Using Remote Desktop to shutdown a computer

If you’ve used Remote Desktop you’ve noticed that the button to shutdown and restart the computer in the Start Menu changes to Disconnect. This makes perfectly sense because the vast majority of the time you want to close Remote Desktop but for the remote computer to keep working as usual. However, what if what you really want to do is to shutdown the remote computer?

Windows Security

The first option is to invoke the Windows Security interface from the Start Menu, which is the one you’d get locally by pressing CTRL + ALT + DEL.

This interface allows you to shutdown, or reboot, the remote computer by pressing the buttons at the bottom right corner of the screen.

Command Line

Another less popular option among domestic users is to use the shutdown utility. While this option gives you more flexibility (like deferred or remote shutdowns) it also requires the use of the command line.

The first step is to open the command line with administration privileges.

The command to run would be: shutdown /s /t 0. /s indicates local shutdown and /t 0 that we want to wait 0 seconds for it, so shutdown now.

Getting into a 64 bits world: What Apple spotted and Microsoft missed

The user comes first

You might be a large corporation or a freelance developer, but it you’re in the software business you’re working for the end-user even if you don’t even know a single one of them. And let me tell you something about them: they’re stupid, but they hate to realize.

You want to make profit of your work, you have to make your user feel clever… or at least, don’t make him feel stupid or frustrated. A lot of users change powerful software for a crappy one that’s easy. I’m not saying technical quality is not important, I’m saying that if it two different applications can do the job, users will use the one which makes them feel clever by doing the job with less irritating error messages or cryptic questions.

Why so many users recommend using 32 bits?

Because they’re scared. They don’t know what 64 bits is apart from being the double of 32 bits… what they know is that some of their friends were using 64 bits and had to fallback to 32 because their applications weren’t working or the computer was unstable or… who knows what, but something wasn’t working.

But, is that true or is just a legend?

I’m afraid both. If we’re talking about windows, 32 bits applications will work on a 64 bits Windows without issues… but (there’s always a but) 16 bits applications will not work neither 32 bits drivers.

This means that if you’re running very old applications (MS-DOS and Windows 3.11 mainly) and you switch to 64 bits, you’re going to run into troubles. This is indeed a problem for business, but normal end-users do not rely on ancient software. However, they rely on something equally bad: cheap and crappy hardware.

Windows provides drivers for most common hardware, but it is likely that some bits of your system won’t be covered by the catalog windows offers. There is where hardware vendors step in providing you drivers for your operating system. A lot of 64-bits windows users found out, sadly, that their hardware vendors won’t provide 64 bits drivers (welcome to the Linux world, where your hardware vendor will tell you “I don’t care”).

32, 64 bits… who cares?

Let’s be honest. Users don’t care if your application is using 64, 32 bits or a giant wheel powered by a hamster. They want to do their job as fast as possible, knowing the minimum about the tool (ideally nothing) so they can move to important things (like watching big brother, or reading The Sun, but that’s another story).

However, as engineers we know that 64 bits is the right choice because we’re using more and more memory every day (chrome is actually eating memory) and relying on “tricks” like PAE is not a solution but a workaround.

The question is not if we should move to 64 bits, but how.

Universal Binaries: The Holy Grail

The solution to having to know about the architecture and choosing the right binary is: Universal binaries. Apple also used this solution when they changed their PowerPCs for Intel microprocessors.

The basic idea is to create a binary that would work on both, 32 and 64 bits by including both versions of the binary merged. Besides this, due to the particular way applications are packaged in MacOS X, applications have only one download for all architectures and all languages.

This is great for the user. It doesn’t matter if he’s using one or another architecture, in English or in Russian…. the same file is going to work smoothly and in the correct language.

The downside

Universal Binaries are the holy grail because the user doesn’t need to know anything. However, they achieve this by including binaries for all supported architectures and languages within the same distribution. Which means that the size of the application is going to be multiplied by the number of architectures supported and increased by the amount of languages included.

I’ve a 64 bits Intel Processor and I use everything in English. Why should I download application three times larger than expected (some of them have 64 and 32 bits versions along with a PowerPC version) and with support for German if I don’t have those processors and I can’t read German?

As an example, Google’s uploader for Google Music, called Music Manager, weights 45MB. After removing languages other than English and unused architectures (in this case, PowerPC support) the size is 11.7MB. In other words, I’ve an application that sizes nearly 4 times what it should.

Fortunately enough, there is software, like Xslimmer to strip out the unnecessary architecture and language support from our applications. But take this with caution, because this procedure could cause some updating methods to fail. Moreover, some applications won’t survive the process because realizing their size has changed, they refuse to work assuming they’re corrupted or tampered. You’re warned.

Using Windows Live Writer on Linux ( Ubuntu )

I’m quite sure I’m not the only one who uses Windows Live Writer. It’s a wonderful tool and I’ve talked about it two years ago so I’m not going to say the same twice. Then, why am I talking about it? Easy, after a long time using Windows as my primary operating system, I switched to Ubuntu.

As you can imagine, Microsoft doesn’t develop a version of Windows Live Writer for Linux and I don’t know any tool for doing the same. Don’t get this wrong, there are a few of applications for blog posting, but every single one of them has an important drawback. Some don’t let you upload pictures, others doesn’t have spell checker or you have to type the HTML. Others simply doesn’t allow you to work with multiple accounts, or they let you manage different blogs, but only WordPress based, and so on…

Solution? Keep using Windows Live Writer. I’ve VirtualBox with Windows XP SP3 and I run it in seamless mode. I know it sounds a little bit strange using a virtual machine just for one program… but that wouldn’t be true. Just face it, sooner or later everyone needs to use some “only-windows” application. Did you ever tried to update your iPod Touch on a Linux box? Forget it, as far as I know it’s impossible… you need iTunes and wine is good, but no so great.

How to fix the Windows Vista 0xc000000e error

My first Linux distribution was Mandrake (a.k.a. Mandriva),  since that I have always used Debian or Debian based, like Ubuntu. However, I really like to try other distributions and yesterday I downloaded the third beta of Suse 11.0.

I have an ATI X1600 Pro, and that was the first problem. The installation couldn’t detect it well and used the vesa driver… with my double monitor system. Anyway, that is not a big deal, the real problem came when I wanted to boot my Windows Vista.

As you can imagine, I couldn’t. The loader said "0xc000000e The entry could not be loaded because the application is missing or corrupt"

The way to fix it wasn’t very easy. I booted from my Vista DVD and I selected the repair option, later the command prompt utility.

In order to fix the issue, we have to set the partition as active, you can use the "diskpart" command to do that (you can write "help" if you need it).

Now we have to repair the boot sequence, so we need to write:

bootrec /fixmbr
bootrec /fixboot

Now you should be able to start your windows but in some cases you need to reboot and boot from your Windows Vista DVD and select the "startup repair".

Good luck! I really hate this kind of bugs…