“python.exe has stopped working” suddenly appeared under Windows 10

When attempting to start python tonight, Windows 10 suddenly produced the “python.exe has stopped working” error. Examining the event in the Event Viewer didn’t provide any more useful information, but surprisingly everything worked if I launched python.exe directly from Explorer – or through bash (cygwin), but not if I launched it through the regular command line (cmd.exe).

What solved it? Removing the old directory again (even after trying a fresh install) and then explicitly finding the 64-bit version from the python download page (it gives you the 32-bit version by default, it seems). Reinstalling with the new archive fixed everything, and now it works again (and I checked “pre-compile the standard library, but that shouldn’t change anything)! Woho! Now to just reinstall quite a few virtualenvs..

alt+<number key> stops working in irssi and putty under Windows

I have no idea why this happens. I have not been able to fix the underlying issue, but .. do you have photoshop open?

It turns out photoshop interrupts the alt+number keys globally, so even if you have putty open, changing windows with alt+<number key> won’t work. Closing photoshop makes everything work again.

Weird.

Windows 7 and Suddenly Changed to a Lower Sound Volume (Realtek)

After plugging in an unrelated USB device my built-in realtek sound card suddenly decided to go into low volume mode, where the output level was several levels below what it used to be. The mixer in Windows 7 shows the full volume for the application playing (Spotify in this case), but the volume output on the speakers was very low.

Go into the “Realtek HD Audio Manager” on the control panel, select “Speakers” and then “Default Format“. This had suddenly been set to 24 bit, switching it back to 16-bit 192KHz made the volume normal again. Unless you require another format on the digital output, 16-bit 192KHz or 48KHz should be more than enough (I’m guessing this adjust the quality of the internal DAC on the sound card, so go with 192KHz).

Update: turns out this still happens, but changing it to something else, then back to the previous value solves the issue. No idea why.

“Klareringsforholdet mellom arbeidsstasjonen og primærdomenet ble ødelagt.” or “The trust relationship between this workstation and the primary domain failed.”

I added the Norwegian translation of the error message to the title as well to help any Norwegians trying to find a solution to this Windows AD issue. The root cause is that the kerberos secret on the client no longer (for some reason) matches the secret stored in the AD forest. The usual fix is to make the client rejoin the domain, however, there’s a better solution.

First you’ll need Administrator access to the client. If you’re unable to log in as an Administrator (because the computer was locked by a domain user account before the secret got borked), reboot the client without any network access. This will allow the user to log in with the cached credentials, as the client is unable to discover that its secret differs from the secret stored in the domain.

You’ll need to download the Remote Server Administration Tools for Windows 7, and install it on the client. After installing, go to Programs and features in the Control Panel, select enable / disable windows features on the left pane, and navigate through:

Remote Server Administration Tools > Role Administration Tools > AD DS and AD LDS Tools

.. and find the choice that includes “console tools” (I don’t remember the exact name).

Start cmd as an administrator (right click, select run as administrator under Accessories), and use netdom.exe to sort the issue out properly.

netdom resetpwd /s:<server.domain.local> /ud:DOMAIN\user /pd:*

The user referenced by DOMAIN\user needs to have access to add / edit clients in the domain.

Getting Mac OS X-fonts to Work on Windows (Through Ubuntu)

This will be a fairly technical post, so if you’re not in the mood or don’t know what a bash script or Ubuntu is, this might not be the post for you.

Useful Ubuntu packages: fontforge (install with apt-get install fontforge)
Useful PERL Libraries: Mac::AppleSingleDouble (install with cpan install Mac::AppleSingleDouble)

First; Mac OS X stores the actual font data as a secondary data stream / file that’s attached to the actual font that the user can see. This requires the user sending the font to zip the contents before sending, so that both files can be included. The interesting files will be located in the __MACOSX folder and not in the actual folder containing the font (this folder will only contain the files with a 0 byte size). These files in __MACOSX will be the ones we’re going to town with.

Doing “file” on any file from this directory will probably yield “AppleDouble encoded Macintosh file”.

You can extract the actual contents of these files with the following awesome PERL snippet from a post at superuser:

perl -MMac::AppleSingleDouble -e 'for(@ARGV) {
    $a = new Mac::AppleSingleDouble($_);
    if(open $f, ">", $_.".rsrc") {
        binmode $f;
        print $f $a->get_entry(2);
        close $f;
    }
}' FILENAME_HERE

This will create a FILENAME_HERE.rsrc file in the current directory. This is the actual file that were stored as side channel data, without the other metadata associated with it.

In my case the resulting file was indicated to be a “Mac OSX datafork font, PostScript” by “file”, and after this I tried two things – one worked, one failed.

The first that failed:
In the archive there was also two other small datafiles. I tried extracting these and renaming the files to .pfb and .pfm (to use them as PostScript Type 1 fonts on Windows). This did not work. I’m not really sure where this failed at the moment, as I didn’t really feel like digging myself further down into the Windows Font subsystem. I also tried running the files through fondu, but didn’t get anywhere (it seems I really should run this under Mac OS X to be able to generate the proper .pfb and .afm files).

The second that worked (sort of):
fontforge is able to import a PostScript/dfont file without the associated metadata file. This might break kerning and a few other issues (fontforge will guess, so it won’t be half-bad), but will give you a resulting TTF file that actually works and can be used for most of the things that you’d use the font for. It was good enough for our use. Simply start fontforge, open the file and select file -> Generate Font afterwards.

Hopefully I won’t have to do this any time soon again. Fonts. Prrffftttt.

Restoring File Associations for OpenOffice.org 3

After removing Office 2007 from my computer earlier today after helping a friend with a few coding issues several weeks ago, my file associations ended up in a limbo where they weren’t associated with OpenOffice.org (.doc, .xls, .rtf, etc.). A few Google searches didn’t turn up any proper solutions, but Jan-Petter suggested that I should simply go to Add / Remove programs and choose to repair the installation. After finding the application in the Add / Remove Programs list and clicking ‘Change’, the installation dialogs from OpenOffice.org popped up. A few clicks later after selecting Repair and waiting for a few dialogs to finish, everything was back to normal.

And that’s how you reassign OpenOffice.org to handle all its file extensions again.