Finally, a use for Internet Explorer!

So, to cut a long story short, due to my employers’ “interesting” IT policies, I’ve ended up providing my own computer, which can only be connected to the guest wi-fi, not the real network. However, I would still like to access my work e-mail, which is kept in MS Exchange.

Enter “Outlook Web Access”. Now normally this isn’t a great deal of fun to use: the interface is clunky, and it doesn’t even refresh itself to show new messages as they arrive. But this is because you are limited to the “Light” version when viewing it with any browser other than IE.

Load the full version in Internet Explorer, and by some Microsoft magic, it is almost identical to the standalone version of Outlook inside a web browser container! You can even right click things and they do what you expect.

So, that makes two neat pieces of engineering from Microsoft that made my day. The other one was Windows 7.

Scripting fun: Rename files by date in Windows

When I’m working on a computer, I frequently make backups of what I’m doing. There are a lot of ways to do this, but the one I use is a bit ghetto.

1. Right click the folder with my work in it, and select “Send To > Compressed (zipped) folder”

2. Rename the resulting zip file so that the name includes the date in ISO format. You have to rename it in order to store multiple versions in the same place, so might as well add some useful data to the name.

3. Copy it to a backup drive somewhere.

I got fed up of doing the renaming manually, so I created (cobbled together from various Howtos) a batch file to do it for me. Here’s the code:
@echo off
FOR %%V IN (%1) DO FOR /F "tokens=1-6 delims=/: " %%J IN ("%%~tV") DO IF EXIST %%~nV-%%L%%K%%J-%%M%%N%%O%%~xV (ECHO Cannot rename %%V) ELSE (Rename %%V %%~nV-%%L%%K%%J-%%M%%N%%O%%~xV)

Paste that all into a text file (one long line!) and call it something like RenameByDate.bat.

Now, if you drag and drop another file onto this batch file’s icon, it should get renamed to its original name, plus the date and time of its timestamp.

If this doesn’t work, you may need to enter the following three commands at a command prompt, to enable drag and drop for batch files.
ftype batfile="%1" %*
assoc .bat=batfile
regsvr32 /i shell32.dll

(from here)

Finally, place the batch file in your Send To folder. (C:\Documents and Settings\YourUserName\SendTo)

Now you can rename any file, adding the date and time to the name, by right-clicking it and selecting “Send To > RenameByDate.bat”.

In other news, I’ve mostly been automating Bill Of Material generation with Perl.

The Stinkpad Saga Part 2.

I did some more research into the “meh” quality of the Stinkpad onboard audio, and it turned out that the sound chip resamples everything internally to 48kHz. The resampling doesn’t seem to cause any bad artifacts, just a slight loss of treble through the anti-alias filter, but that very lack of high end is probably what makes it meh.

So I decided to have one last attempt at getting an audiophile-grade output from old Stinkpad, and if it failed I would throw him out of the window and make do with a single computer. I’ve long been a fan of M-Audio products: I struggled with music production on consumer soundcards for years, until the day I bought a Delta 66, and everything just worked. So I bought a Transit, which is their cheapest, lowest-channel-count USB audio doofer.

Upon installing it to the Stinkpad I got exactly the same snaps and pops as before, at the rate of about 5 per second πŸ™ But this time, I noticed that they only happened when the CPU was idle, and loading it up with Winamp’s visualisation thing made them go away. There were no pops from Sound Forge, and indeed I was able to get a bit-for-bit digital copy through the Transit’s optical I/O to my MP3 player and back. (I have an IHP-120 running Rockbox that has digital I/O and can record and playback uncompressed, so I could test everything by dubbing a test file from the laptop to the IHP-120 and back, and subtracting the result from the original.)

This was a promising result that made it worth investigating more. I assumed that the problem was due to some sort of power management system that was shutting the CPU off when it was idle, and maybe taking a bit too long to power it up again, so that the USB audio stream ran dry. And now the heartwarming bit, the Thinkpad 600X might be 10 years old, but IBM/Lenovo still support it! I was able to download a power management driver compatible with XP from their site. This added a tab to XP’s Power Properties dialog, with options to disable CPU and PCI bus power management. I disabled the CPU power management, and the audio troubles were utterly gone, with the machine running considerably faster as a bonus.

Of course, in computing you never fix one problem without introducing three new ones. The CPU fan now runs full speed all the time, and I expect the battery will now last about 5 minutes while the laptop will get hot enough to fry eggs πŸ™ There doesn’t seem to be any way of having this CPU power management “On for battery power but off for AC”, either. Maybe there was a driver to make that happen in Windows 98, but it wouldn’t work in XP.

Oh well, I guess this is what I get for bringing a vintage tractor on the information superhighway.

I smell stinkpad…

I’m currently trying to kick my computer collecting habit, as there’s only room for so many of the things in my flat. My plan is to get down to two machines: one small, low-powered one that can be left on all the time, for things like playing MP3s and internet radio, and running BitTorrent, and a big fast machine crammed with noisy fans to use for my digital audio experiments. The role of the low-powered machine used to be filled by Linosaur, my Linux server, but it’s currently down after a failed attempt to fit it into a smaller case. (That’s “down” as in dismantled in a cardboard box in my mum and dad’s garage. No, it doesn’t respond to pings.)

Hence, I decided that the Stinkpad should take its place. This is an old IBM Thinkpad 600E that refuses to die. It was made at IBM’s plant in Greenock, so it has some typically Scottish quirks such as headbutting you on errors instead of beeping. I upgraded the memory and hard drive, but I can’t do anything about the slow-ass 500MHz CPU. However in this application, the slowness isn’t a problem, as long as it can run uTorrent and Winamp.

The problem I had was that it wouldn’t even do that, since I upgraded it to XP. The onboard audio tended to stutter whenever the machine was loaded, and any external soundcards I tried just popped and stuttered even worse. I tried all sorts of things, messing with settings, disabling all the XP eye candy, but it made no difference.

That is, until I went into the Device Manager and noticed that my hard drive was running in PIO mode! Like it was 1987 again! πŸ™‚ (For non-tech readers, PIO is an old, obsolete way of communicating between hard drive and computer, which is very slow and wastes CPU power. Any half-decent machine can use “DMA” mode which shifts the data faster, and lets the CPU get on with something else in the meantime.)

All attempts to make it go into DMA mode failed, until I found this helpful script. After the mandatory reboot, the stuttering was gone, and as a bonus, the Stinkpad felt about 10 times faster. It must have been stuck in PIO mode for ages, maybe even since the day I installed XP. Who knows why it happened, I’ll just hope it doesn’t do it again.

It now performs its role better than Linosaur did. Since it’s Windows, I can listen to the BBC IPlayer (powered by Windows Media, which makes it pretty off-limits for Linux.) I get really good sound quality using a Roland UA-1EX USB sound dongle, with Otachan’s ASIO plugin for Winamp to bypass all the kernel mixer and resampling gubbins built into Windows. (for media played through Winamp at least…) No I don’t! it worked once and then started snapping and popping πŸ™

Neatest of all, using TCPMP it gives decent full-screen playback of MP4 movies, something Linosaur always struggled to do since it had no screen at all πŸ™‚ I first tried TCPMP as a player for my palmtop, and it worked so well on that, I thought I’d try the desktop version too.

All in all, I think this is pretty good meh for a 10 year old laptop running XP.

Last person in the world on iTunes?

This week I was lucky enough to be given a small, cute iPod Shuffle for my birthday. Yay.

Unfortunately this meant I had to start using iTunes. I’d previously managed all my digital music with a bunch of free software, ripping CDs with (now defunct) RipTrax, playing things with an old Linux machine running mpd/phpMP, and filling my iRiver mp3 player with rsync.

I’ve heard that there are other ways of getting music into an iPod than iTunes, even that it was possible from Linux, but the complexity and level of Linux evangelism involved nearly made my head explode. Asplode, even. And the sheer pointlessness, when my main computer at home runs XP, and my Linux box linosaur is headless.

So off to apple.com I went, downloaded the latest iTunes for Windows, and installed it, and it just worked. Almost! I forgot that I had quite a lot of music in Ogg Vorbis format.

But after a quick visit to xiph.org Quicktime Components I could play all my Ogg stuff too! Though if I ever try uploading any of it to the Shuffle, it may well catch fire.

All in all, I really like the iTunes software, and it may make linosaur’s jukebox function obsolete, and let me get rid of another computer at home.

I even found my own band in the iTunes store. Hardly surprising, since it was me who delivered our album via TuneCore.

(click to see the album in iTunes, if you have it installed) πŸ˜€

Windows command of the week: “netsh winsock reset”

I discovered this fascinating command when trying to fix Kat’s computer.

Originally it showed a completely empty desktop with no icons or taskbar, just the wallpaper, even in so-called “Safe Mode”. A rollback to the last known good configuration solved this, but the networking still wouldn’t work. The DNS resolved domain names as garbage, some even containing bell characters that made the machine beep.

I tried uninstalling the driver for the network card and rebooting, at which point the DNS just stopped working altogether. The “ipconfig /renew all” command failed saying that “No adapter is in the state permissible for this operation”.

A quick Google search for this error message (using my handy palmtop that happened to work with Kat’s wi-fi) turned up a MSDN article that basically said: “Shit happens, type ‘netsh winsock reset’ and reboot”

And what do you know, it worked πŸ™‚