Category: Windows

Principle of Least Astonishment

Noah Petherbridge
kirsle
Posted by Noah Petherbridge on Tuesday, March 22 2016 @ 05:29:07 AM

In user interface and software design, the principle of least astonishment states that "if a necessary feature has a high astonishment factor, it may be necessary to redesign the feature." It means that your user interface should behave in a way that the user expects, based on their prior knowledge of how similar interfaces behave.

This is a rant about Mac OS X.

Read more...

Installing Windows 8 on a Samsung Series 5

Noah Petherbridge
kirsle
Posted by Noah Petherbridge on Saturday, May 18 2013 @ 10:25:21 PM
Here's some info on installing Windows 8 Pro on a Samsung Series 5 Ultrabook, in case anybody else has one and they wanna reinstall Windows from scratch.

To get the basics out of the way first:

  • Computers that ship with Windows 8 pre-installed usually have the Windows 8 Core Edition on them by default.
  • Also, the product key for the Core Edition install is baked in to the BIOS ROM.
  • If you boot a "vanilla" DVD or USB for Windows 8 Pro, it will fail, because Windows 8 looks for the product key in the BIOS ROM and will see that it is not a valid Pro key.
  • Some people say you can't install Windows from a USB on this laptop. You can do it, it's just tricksy.
The method that I found worked involves a dual-boot setup, where I have Windows 8 and Fedora Linux installed on the same laptop (you can substitute Fedora with any Linux distro of your choice... Ubuntu, Mint, etc.). If you want only Windows 8 on your laptop, this guide isn't for you. Sorry.

My particular laptop (the 13.3" variety) includes a 500GB hard drive and a 32GB SSD drive, which apparently is the ExpressCache drive. This is important.

So first, how to get Windows 8 to actually attempt to install. You can't just boot a vanilla DVD or USB, because the installer will see the OEM product key baked into the BIOS, and complain because it's for Core Edition and you're trying to install Pro Edition.

You need to make a USB installer for Windows 8 using the "Windows 7 DVD/USB Tool" (Google it). This is because you have to add a text file to the USB. You might be able to modify an ISO to add the text file to it, but you're on your own there.

Open Notepad, and create a text file named "PID.txt", and put this in as its contents:

[PID]
Value=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
Substitute the X's for your Windows 8 Pro product key. Place the text file in the Win8 USB under the "sources" directory, for example D:\sources\PID.txt

Now when you boot from the USB, Windows will use that product key instead of looking in the BIOS. And the installation will continue as normal.

But, it won't boot from disk after the installation is done. This is because the Windows Installer saw the 32GB ExpressCache disk, and it installed its bootloader onto that disk instead of onto the primary hard drive. The problem with this is that the BIOS on the laptop can't see the ExpressCache disk, and so it can't boot Windows from it.

I saw a couple solutions floating around the Internet for this. One solution said to format the ExpressCache disk with a Mac OS X file system, so that Windows wouldn't make use of it for its bootloader. You could probably format it with a Linux filesystem as well and get the same result. In this case, Windows 8 would've installed the bootloader directly onto the primary hard drive, and the BIOS would be able to boot it. This isn't much help to you, though, if you don't already have Windows installed to be able to format this partition.

What I did instead when I got to this point was... go ahead and install Linux. When I installed Windows 8, I gave it a 128GB partition on the hard drive. I gave Linux the remaining space to partition up as it pleases. When Linux installs the GRUB bootloader, it installs it onto the primary hard drive. This means the BIOS is able to boot GRUB... and, GRUB is able to see the Windows 8 Bootloader on the ExpressCache disk. Score! So now you can boot either Linux or Windows from GRUB.

This is what worked for me, anyway. If you don't wish to dual-boot Linux on your laptop, you may want to just boot a Linux LiveCD/USB, format the ExpressCache disk (/dev/sdb, probably) with a Linux filesystem like ext4, and then run the Windows installer again. Theoretically, Windows won't touch the ExpressCache disk to install its bootloader, and will install it on the primary disk. No guarantees that will work, though, as I haven't tested it.

Windows 8 Rant

Noah Petherbridge
kirsle
Posted by Noah Petherbridge on Thursday, April 18 2013 @ 01:51:31 AM
So, I thought I liked Windows 8 a bit. The OS itself isn't absolutely horrible once you get used to it. I even bought the $40 upgrade to Windows 8 for my main PC, where I promptly spent 100% of my time on the desktop and not in the Metro apps. ;)

But, I just bought my first computer that actually had Windows 8 preinstalled on it: a Samsung Series 5 Ultrabook. It has a touchscreen and some nice features, and I wanted to dual-boot Windows 8 and Fedora Linux on it (giving Windows the smaller half of the hard drive, of course). Microsoft apparently went to great lengths to make this darn near impossible.

I came to find out, when you have Windows 8 pre-installed on your computer, it's probably the Windows 8 "Core" Edition. The only Win8 install DVD I had laying around was the Professional edition that I bought for $40. It was logical to me that I should be able to hopefully reinstall Windows 8 on the ultrabook from this DVD, maybe even using the same OEM product key that the laptop came with and not having to worry about any activation issues.

Apparently, Windows 8 PCs have their product keys "baked in" to the BIOS ROM. If you boot a Windows 8 installer of any edition, the installer looks for this product key in the ROM, and if the key is for a different edition than what the installer is intended for, it gives you some ugly error message about, "The product key you entered doesn't correspond to any of the install images. Enter a different product key." -- except it doesn't let you enter a product key anywhere, and just restarts the setup process from the beginning.

There also apparently is no Windows 8 Core ISO floating around the Internet -- not one that I would trust downloading, anyway. With the baked-in product key, the only Win8 installer that would work would be a Core edition installer, which doesn't exist. You can't install Windows 8 Pro on your computer, because the installer simply won't allow it.

Long story short, Microsoft has basically forced me to forego dual-booting completely and just install Linux on the entire hard disk. The built-in Windows 8 OS came bundled with a bunch of Samsung's crapware, and there's no way to "start fresh" with Windows 8 -- your only option of "reinstalling" is to use the Control Panel feature, which restores "to factory settings", which means your Samsung crapware is still gonna be there after the reinstall is done. And you can't install from scratch from a DVD for the aforementioned reasons.

You can even completely remove Windows 8 from your computer, maybe install Windows 7 or Linux across the whole drive, and you still won't be allowed to put Windows 8 back on there from an install DVD or USB again.

There is a workaround, though: if you make a bootable USB for Windows 8, you can add a text file to it where you specify the product key to use. For me to do this, however, I'd need to buy an additional Windows 8 Pro license, and that's not worth it to me. So, good riddance Windows 8, I don't care to have you on my ultrabook anymore, anyway.

Force MSN Messenger to Use a Proxy

Noah Petherbridge
kirsle
Posted by Noah Petherbridge on Friday, December 30 2011 @ 02:33:45 PM
For anybody wanting to know how to do this, it's possible to force Windows Live Messenger to obey your proxy settings.

In my case I wanted MSN 2011 to connect using a socks proxy (using SSH port forwarding to use an SSH tunnel as SOCKS 5 proxy).

To set the proxy settings, go to the "Connection" page in the preferences of MSN Messenger, click Advanced Settings and enter your proxy details.

The problem is, MSN will only use your proxy settings if it can't normally connect to MSN without them (i.e. if your default TCP internet connection will work, MSN will always use that instead of your proxy settings). This is how you can force MSN to use the proxy settings.

You have to block MSN from being able to connect to its authentication servers without the proxy. To do this, we have to tamper with the Hosts file.

The Hosts file on Windows is kept at C:\Windows\System32\drivers\etc\hosts (note that it doesn't have a file extension). Open this in a text editor like Notepad or the edit command in Command Prompt (I prefer the latter approach because you can open a Command Prompt window as Administrator and then editing the file is a snap without having to deal with permission issues when saving changes).

Add these lines to the Hosts file:

127.0.0.1       messenger.hotmail.com
127.0.0.1       msgr.hotmail.com
127.0.0.1       gateway.messenger.hotmail.com
127.0.0.1       login.gateway.hotmail.com
And then restart MSN and it should have difficulty connecting without the proxy settings (if using a SOCKS proxy, attempt to sign into MSN before you open the proxy to be sure that it fails to connect. Then start the proxy and see that it successfully signs in).

This works by routing all the MSN Messenger hostnames to the loopback address and blocks MSN from being able to authenticate. But with the SOCKS proxy, it can connect because it would do the DNS lookups from the SSH server instead of the local system.

Hope this helps someone!

Get FAT Drive Serial Numbers in Unix

Noah Petherbridge
kirsle
Posted by Noah Petherbridge on Thursday, December 31 2009 @ 01:15:43 PM
There's not a lot of information about this on The Google, so hopefully this blog will help anyone who wants to know how to get the serial number of a FAT partition from within a Unix-like operating system (including Linux and Mac OS X).

First, this is what I mean about serial numbers. Suppose you're using a Windows system, have a floppy disk at drive A:/ and a regular USB flash drive at E:/, and you run these commands in the command prompt:

C:\>vol E:
Volume in drive E is CRUZER
Volume Serial Number is 955C-59BF

C:\>vol A:
Volume in drive A has no label.
Volume Serial Number is EC2B-36AF
These serial numbers are assigned when the drive is formatted; reformatting a floppy disk or flash drive will give it a different serial number.

According to The Wikipedia, the serial number (ID) is kept in two different places on the partition depending on the version of FAT being used.

In FAT12 and FAT16 (used with floppy disks), the ID begins at byte offset 0x27 (39 in decimal); in FAT32 (used with flash drives and external hard drives), the ID begins at 0x43 (67 in decimal).

So, with the handy dd utility that comes standard on pretty much any Unix-like system, you can extract this information and display it. Here are a couple of one-liners you can run in a Unix terminal. I'll explain how they work afterward.

# For FAT32 filesystems (modern flash drives)
dd if=/dev/sdb1 skip=67 bs=1 count=4 | hexdump -v -e '1/1 "%02X" " "' | xargs perl -e '@_=@ARGV; print "Serial Number: $_[3]$_[2]-$_[1]$_[0]\n"'

# For FAT12/16 filesystems (old floppy drives)
dd if=testfloppy.img skip=39 bs=1 count=4 | hexdump -v -e '1/1 "%02X" " "' | xargs perl -e '@_=@ARGV; print "Serial Number: $_[3]$_[2]-$_[1]$_[0]\n"'
I underlined the input file (if) and byte offset (skip) in both of these commands. In the first one, I ran the command on a real, physical, flash drive, that had a device node at /dev/sdb1 for its one and only partition. In the second one, I ran it on a floppy disk image file (who has a computer with a real floppy drive these days?)

If you're going to be using a physical device like in my first command, you need to run the command with root privileges (regular users can't read directly from the device node). My second example (using an image file) can be run as a regular user, however.

These commands printed in the terminal for me:

(for the flash drive)
4+0 records in
4+0 records out
4 bytes (4 B) copied, 3.3445e-05 s, 120 kB/s
Serial Number: 955C-59BF

(for the floppy image)
4+0 records in
4+0 records out
4 bytes (4 B) copied, 3.1551e-05 s, 127 kB/s
Serial Number: EC2B-36AF
And now, how the commands work. I'll use the flash drive command as the example. In this one-liner, three commands are being executed at once:
dd if=/dev/sdb1 skip=67 bs=1 count=4
hexdump -v -e '1/1 "%02X" " "'
xargs perl -e '@_=@ARGV; print "Serial Number: $_[3]$_[2]-$_[1]$_[0]\n"'
The dd command gets the operating system to read raw data from the flash drive at /dev/sdb1, skipping the first 67 bytes, reading only 1 byte at a time, and reading a total of 4 bytes. This gets the 4 byte serial number; now we need to display it in hexadecimal like Windows and DOS.

The hexdump command takes the 4 binary bytes and displays them in hexadecimal. On my flash drive, it looks like this: BF 59 5C 95. Note that the hex codes are out of order; Windows shows them as 955C-59BF - basically, the reverse of what hexdump shows. Hexdump is showing the correct order; Windows and DOS reverse them when they show you the serial number.

So, we run it through xargs (which turns the four hex numbers into four separate parameters) and sends them to a quick Perl script, which prints out "Serial Number:" and puts the hex codes in the correct order, to give the same result as Windows and DOS.

One could use this information to make a vol command for Unix. If the command checks other places in the filesystem headers to determine the version of FAT, it could automatically use the correct byte offset and get the serial number from both floppy disks and flash drives.