# Tuesday, 28 August 2012

At some point when you're developing a Windows 8 App you probably realized that if the app is run on a tablet form factor device you'd want to freeze the app orientation in either landscape or portrait display modes like you'd do in a Windows Phone app. So what you do in Visual Studio 2012 is that you double click on the Package.appxmanifest file so you can start tweaking the manifest settings for your app, in particular is the Supported rotations section.

image

Since you want your app to only support landscape mode, you check both landscape modes. Then you decide to test if this works, so you fire up the simulator, and rotate it, but instead of being locked in landscape, your app still rotates to potrait mode.

image

This doesn't work because the simulator doesn't accurately simulate the hardware rotation, as mentioned in the documentation (look under the change device orientation section)

Since that doesn't work, you try to manually rotate your screen using Windows Mobility Center (Windows + X, then select Windows Mobility Center)

image

And STILL your app doesn't stick to landscape orientation!

So what exactly is wrong?

The problem here is that the rotation preference setting of the app is only enforced on a Windows 8 system with a supported HARDWARE ACCELEROMETER.

Which means unless Windows knows how the system is orientated through the means of a supported sensor, it'll never attempt to switch to the app's preferred orientation.

So you shouldn't need to worry that your preferred orientation setting isn't working, it'll work on any hardware that is properly designed for Windows 8. How do you deal with people who manually rotate their screens using Windows Mobility Center then? Well... did you know you could rotate your screen using Windows Mobility Center? Did you even know that there was a Windows Mobility Center? It should be safe to assume that if someone knew enough to manually rotate their screen display, they'll know enough that not all apps run fine in both portrait and landscape orientations. Winking smile


Tuesday, 28 August 2012 22:02:29 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Sunday, 26 August 2012

So I've recently obtained the RTM version of Windows 8 through my MSDN subscription. And therefore I have a few updates to add to my previous Windows To Go post.

The first and most important finding which was discovered by a friend was that the San Disk Cruzer Fit 32GB is actually capable of running Windows 8 at usable speeds.

DSC01320

Performance wise, it's still not going to be as good as a hard disk, but the fact that it's

  • Bloody small so it doesn't get in your way like a hard disk would.
  • Bloody cheap (RM67!)

Makes it a very tempting proposition! So what kind of performance are we talking about? Well... overall reading performance will feel slow, but not unbearably slow during normal usage. And you might encounter some instances where it seems like the system stalls for while when there's heavy traffic going through the USB bus. Also, disk intensive scenarios like when you try to install programs might be a bit slower than usual.

One thing to note is that actual performance still depends a lot on your PC's USB Bus, if that becomes a performance bottleneck you still will get unbearable speeds from the drive.

Speaking of installing programs, another interesting scenario popped up once my friend made his Windows To Go drive. If you installed Windows 8 directly onto the USB drive, it's possible that the OS would regard it as a removable drive, this would cause many programs to refuse to install onto the OS drive. Which is not what you'd want.

Luckily, there is a solution for this. All you need to do is to install Windows 8 onto a VHD that's on the USB drive and boot into it. There are again various guides to do this on the net so just search around for it. I might get around to doing one if people actually ask for it.

Till the next update then!


Sunday, 26 August 2012 15:11:15 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Saturday, 25 August 2012

So you’ve just finished installing Windows 8, and you’re staring at the spanking new Start screen.

screenshot_08182012_232204

After staring at this for a few seconds you might already have a few questions on your mind. Let me try and answer them for you.

Where’s the Start Button?

The Start button is in the same place where it was in previous versions of Windows, just that it’s hidden to not take up an extra icon of space. Space saving is not exactly a good argument but in any case, to access the Start button, just move your mouse pointer into the LOWER LEFT CORNER of the screen and the Start button will appear.

image

The basic idea is to hide your mouse pointer in the lower left corner of the screen to get it. You’ll probably fumble around once or twice but it’s easy enough to get used to it, since it is pretty much in the same place where it was in previous Windows.

Note: Don’t try this when you’re actually IN the Start Screen (The screen you see when you first launch windows, ie. The one on top) When you’re in the Start Screen, the lower left corner brings you to the last app that was opened before your arrived at the Start Screen.

Keyboard Tip : Typing when you're in the Start Screen works just like typing in the Start Menu of Windows 7, it'll immediately start searching for whatever you typed.

What’s this Charms Bar thingy I keep hearing about?

When you hide the mouse pointer in the upper right or lower right corner of the screen, a column of icons will appear.

image

Then when you reach for them, the icons will gain a proper background and look like a toolbar.

image

This is what is known as the Charms Bar, it provides quick access to Windows and App features. Start is self explanatory and is basically the Start Button. Devices brings up a list of devices which you can interact with, you can control your projector output settings from this.

Search, Share and Settings have a very interesting and not so obvious behavior that new users wouldn’t understand at first. They are app-specific. For example, if you’re using a calendar application and you’re looking for a button in the app that will open up a setting’s page for you to set reminder options, you don’t have to go digging around just hit the Settings button on the charms bar and you’ll be able to access the application’s settings page. If you’re using a mail application and you want to search for something, hitting the Search button on the charms bar will bring you to the app’s search interface.

One caveat though, as always all these integrated buttons will work like they’re supposed to if the app developer was paying attention and doing their jobs properly.

KEYBOARD TIP: The keyboard shortcut for the Charms Bar is Windows + C

How Do I Turn Off My System?

A very good question considering that the option is now quite hidden compared to previous versions of Windows. Bring up the Charms Bar and click on Settings. Look at the bottom part of the panel.

image

Apart from the Power Button which we're looking for (FYI clicking on it brings up the options to Sleep, Restart, Shutdown and doesn't immediately turn your system off) There're a few other useful controls that are easily accessible.

Keyboard Tip : Press the physical power button on your PC to turn it off. Smile with tongue out Ok... I suppose some machines are configured to sleep when the power button is pressed.

Where Did The Internet Explorer Address Bar Go?

When you first open Internet Explorer from the Start screen you'll see the address bar at the lower part of the screen.

image

But after you start surfing for a while the address bar disappears, and you can't seem to get the address bar back by moving the mouse to the bottom of the screen.

To reveal the address bar in Internet Explorer, or the application bar for any other Windows 8 UI app. Right Click on any BLANK space in the application.

Keyboard Tip : You can press Windows + Z to bring up the application bar in Internet Explorer as well as any other Windows 8 UI app. You can also use the familiar Alt-D shortcut as well.

How Come I Can't Run A Program I Just Downloaded!

So you've just downloaded a program and you double click to run it just like you'd do in any other Windows, but a dialog box appears with the message "Windows SmartScreen prevented an unrecognized app from starting. Running this app might put your PC at risk."

image

Unlike the previous dialog boxes that block direct execution of downloaded programs, there's no "Yes just run the darn thing already" button that's clearly visible in the dialog. But rest assured, this is not Microsoft preventing you from running anything you want. It's just another well meaning but probably futile effort at stopping people from simply running things which they don't intend to.

In any case, clicking on the More info link in the dialog will present you with the Run Anyway button to run your program.

image

And that's it for now, future updates as and when I think there's something to add to this.

November 18th 2012 : If you're using Windows 8 on a touch enabled PC you might want to follow up with this post.


Saturday, 25 August 2012 21:18:29 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Saturday, 04 August 2012

So there I was writing my first application for Windows 8, I had to call a web service sitting on a server which had to be connected through HTTPS, but because it wasn't a production server the certificate was self signed and thus is considered to be an invalid cert. No biggie I thought, with all my years of .Net experience I knew that all I had to do was fiddle with the System.Net.ServicePointManager.ServerCertificateValidationCallback method, as mentioned here.

Imagine my surprise when I realized that the class doesn't exists when you're writing a .Net app for the Windows Runtime!

Trying to look for other solutions also came up empty, it was then which I realized that what I needed to do was to allow the application to get a certificate which ISN'T invalid. What I needed was a web proxy which could give the impression that the remote certificate was actually valid.

What I needed... was Fiddler!

So first download Fiddler4 (Because Windows 8 comes with .Net 4.0) from the download page.

After installation and running the program enter Fiddler Options by selecting Tools->Fiddler Options from the menu bar.

image

After which head into the HTTPS tab and check Decrypt HTTPS Traffic

image

You'll be warned that you're about to install a wild card certificate on your system. Shown below is one of the many warning screens, you'll have to answer YES to ALL of them.

image

After the certificate is installed, look back at the options window and check Ignore Certificate Errors. This will make Fiddler not complain about any invalid certs.

image

Fiddler is a web proxy, which basically means it sits between your machine and the internet so you can monitor the web traffic your PC is making as long as the program is setup to use the system proxy. If you don't know what this implies then just keep Fiddler on only when you're doing development, and turn it off once you're done.

For more information about using Fiddler to assist in Windows 8 development out this post.


Saturday, 04 August 2012 15:51:14 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Thursday, 02 August 2012

One of the most talked about yet not so consumer oriented feature of Windows 8 is Windows To Go which is the ability to run Windows 8 from a USB drive instead of installing it onto a fixed hard drive. And of course everyone wanted to cool looking thumbdrive!

There are no shortage of instructions on how to make a Windows To Go drive. Here's 2 of them

  • Link 1 (Requires downloading of the Windows Automated Installation Kit)
  • Link 2 (Requires an already running Windows 8 installation)

So of course I decided to try and make one myself then! Here's what I found out after tons of sweat and disappointment.

Your USB thumbdrive probably ain't gonna work!

I have a wide range of USB drives ranging from so called super fast speeds, to petit drives that hides itself from the user.

DSC01282

They all failed miserably at running Windows 8! How do you know if your thumbdrive can't run Windows 8?

First of all, when you try to image it following the instructions on the links above it'll take a LOOOOOOOOONG time to image. Basically if the imaging process takes longer than 60 mins (don't read the estimated time from the imaging program) Your thumbdrive is probably not going to work too well. If you actually decide to press on after the installation and actually boot into Windows 8, the first boot is gonna take more than 30 mins to finish the initial setup. If that STILL doesn't deter you from attempting to use Window 8 on your thumbdrive and you actually make it into Windows 8, disk access would be so slow that the user experience is totally unbearable at all!

A Hard Disk Works Best!

DSC01285

The one thing that worked the few times I tried it? A simple USB hard drive. I suppose that since it's on USB, disk access would be slower than on a normal SATA channel, but performance generally feels... normal when I was using a hard drive as the source.

USB 3.0 Might Not Make A Difference

What about USB3.0? That question might have crossed your mind when you were reading the paragraph above. That was what I thought so too! Until I found out that my motherboard's USB 3.0 ports CANNOT be used as a boot drive, I *think* it's because they're basically sitting on a different channel or something like that. While it didn't work for me I suppose there's probably some motherboards out there which CAN boot from their USB 3.0 ports.

In conclusion, does that mean that as long as we use an external HDD we can run Windows To Go probably then? Well...

This probably isn't how to install Windows To Go in the release version of Windows 8

If you go back to the Microsoft page about Windows To Go which I linked at the start, it mentions that a Windows To Go system

  • Disables sleep and hibernate
  • Disabled internal hard drives of the computer it is booting on
  • etc. etc.

This does NOT happen with the install method I link to above, also during my various attempts in getting Windows To Go to work. There was ONE instance which after I booted into Window, a message actually popped up informing me that I was using Windows To Go mode. This has NEVER happened again.

So be warned that all the instructions online probably aren't creating a Windows To Go drive the way Microsoft is talking about.

If you STILL want to proceed...

While it's great that a simple USB hard drive would work, you might want something small and more compact to move around with compared to a hard disk. If that's the case you might want to try and look for the Pen Drive USB 3.0 External SSD

DSC01284

It's a small, thin solid state drive which seems to be capable of running Windows 8 properly.

26th August 2012 : Update #1


Thursday, 02 August 2012 00:00:03 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  |