Search this site


Metadata

Articles

Projects

Presentations

Installing Windows 8 Consumer Preview

I have a fresh workstation and am running through the windows 8 installer on USB. When choosing the drive to install to, I get an error:
We couldn't create a new partition or locate an existing one
Lots of googling and I didn't find any hints for windows 8, but windows 7 has a similar error and folks pointed at diskpart nonsense to fix it. So let's do that -
  • At the installer, choose "Repair your computer"
  • Choose "troubleshoot"
  • Choose "advanced options"
  • Choose "command prompt"
  • Run diskpart.
In diskpart, you'll want to make sure your target drive is formatted and active.
list disk

# now pick your disk
select disk 0
clear
create partition
format fs=ntfs compress quick
active
Now reboot and try the installer again, it worked for me.

Windows window management

My first real dive into any real windows programming was last week. There was much to learn: winapi, managed c++, wpf, and visual studio. Despite all the learning hurdles, I finally have a somewhat-working first-feature of a window management tool I'm working on - the first feature is being able to find an open window and jump to it.

For fun, it uses WPF's easy gradients and easy transparency. WPF's coolest feature is it's item templating, where you can easily represent a data object (say, a window structure) in the UI. The behavior of the tool right now is similar in behavior of my firefox tabsearch extension, where it shows only items matching input words (each word is treated as a regex, etc).

If you are curious, download winmgr.exe. When you run it, nothing happens - it registers the hotkey 'alt+space'. Press alt+space and then start typing the name of the window you want to switch to. Press enter to select the first window in the list.

I worked around VS Express' limitation around resource editing (it's not allowed) by telling VS to compile my UI files (XAML) with a custom ruby script that turned each into string-escaped #define (eg; #define FOO_XAML "<.....").

Querying temperature in Windows

It occured to me tonight that I didn't have a good way to query temperatures from a Windows box. I'd used GUI tools to do it before, but that doesn't really lend itself to automation and monitoring.

The default SNMP configuration in XP doesn't export temperature (at least nothing I saw). I knew SMART had temperature information, but that wasn't CPU temperature or anything else outside the harddrive.

SMART data is accessible through a number of tools. I've used smartmontools before, but didn't know they had a build available for Windows until just now. Same tools as the Linux/FreeBSD/whatever versions. The device naming is the same as on the non-windows versions, and the smartctl manpage details the syntax. I wanted temperature information, and powershell helps make this pretty easy:

PS > .\smartctl.exe -a /dev/hda `
     | where {$_ -match "Temperature"} `
     | foreach { $_.split()[-1] }
46

After a bit of randomly permuting search queries, I found that some temperature information is available through WMI. The temperature values are in tenths of kelvin. We can query this from powershell:

PS > get-wmiobject MSAcpi_ThermalZoneTemperature -namespace "root/wmi" `
     | select CurrentTemperature,InstanceName

CurrentTemperature InstanceName
------------------ ------------
              3102 ACPI\ThermalZone\THRM_0
I found this particular WMI class by doing the following after getting some hints from search results:
PS > get-wmiobject -namespace "root/wmi" -list | findstr Temp
MSAcpi                                    MSAcpi_ThermalZoneTemperature

Powershell to remove dotfiles

I just rsync'd all willy-nilly (not something I recommend). I copied stuff I was working on to a test windows box. Poking around, I realized I copied over a pile of dotfiles (.svn, vim backup files, etc).

In any bourne shell, this fix would be a simple find invocation (depending on how modern your find(1) is):

 find somepath -name '.*' -delete 
Back in Windows, my first reaction was to be sad because I didn't know a simple oneliner to do the same thing. Then, I remembered powershell was installed and made this kind of stuff easy.
 dir -recurse | where {$_.name -match "^\."} | rm 
Delicious.

keynav being ported to windows.

I'm in the process of porting keynav to Windows. I've never programmed in Visual Studio before, but I think it's going quite well considering I've never coded for this platform.

The current total lines of code is 277. I expect it to be about this number once I'm finished.

I'm writing it using Visual C++ Express, a free version of Visual Studio. Free (after free registration). From Microsoft. Very cool :)

So far I have screen splitting working correctly. My clip code is kinda borked. After I fix that, it should be completely trivial to add mouse movement calls. Since Windows doesn't typically use sloppy focus, I think I'll add extra code to figure out what window the mouse is over and give that window focus.