Friday, December 31, 2010

iTunes: How to share apps between different accounts on a single computer

I've got multiple family user accounts on a Windows XP computer. I have my iTunes library set up the way I want, and my son has his playlists set up in iTunes under his own Windows login. All good. We even share the same iTunes music library, thanks to clear instructions here

To complicate matters slightly, he's using my iTunes account.

To summarize:
2 windows accounts
1 iTunes account
shared iTunes media library
I sync the iPad when I'm signed in under my windows login
he syncs the iPod when he's signed in under his windows login

This sounds complicated, but it all works remarkably well. His playlists and ratings are blessedly separate from mine, yet we can pull from the same underlying pool of music. I can listen to his Weird Al, and he can (hopefully, someday) learn to appreciate Elvis Costello and Gillian Welch.

Now, one little problem was that the apps were not shared automatically the way the music was. I sync an iPad to mine, he an iPod. The apps I install, I can see in iTunes when I'm logged in to my PC as me. However, even though we are sharing the library across multiple PC accounts, the apps are not showing up in his iTunes.

Instead of redownloading, here's what to do to get the apps to appear in his iTunes:

Log in to windows under his account. Right-click on one app in the local iTunes Library, and choose "Show in Windows Explorer". This brings up an explorer window at "D:\Bla\Bla\iTunes\iTunes Music\Mobile Applications". This folder contains all the .ipa files that store the applications on the PC. Since we are sharing an iTunes library, this "Mobile Applications" folder contains all the apps I downloaded while I was logged in as me.

I dragged the relevant .ipa files from the explorer window over to iTunes, and it added those apps. Now I can see the apps from his Windows login, and I can install them onto the iPod as well as the iPad.

Thursday, November 18, 2010

How to switch Windows XP from IDE mode to AHCI mode.

Many recent motherboards include AHCI-capable SATA controllers. However, if you have an existing installation of Windows XP, you can not easily switch from IDE to AHCI mode.

If you are doing a fresh install of Windows XP, you can introduce the proper drivers with the old F6 method, or by slipstreaming the needed drivers on to you own custom install disk. However, for existing installations of XP, there's a catch-22.

You can't switch to AHCI mode in the BIOS - that causes a Stop Error (BSOD) at the start of the boot process. This is because the Windows bootloader loads the existing IDE driver, but the motherboard is presenting an AHCI interface.

Neither can you solve the problem by replacing the Windows driver first. The AHCI drivers won't install, since all Windows can see is an IDE controller.

Some vigorous googling revealed nothing more than some dubious and dated registry hacks, or the suggestion to do a Repair installation of XP.

I wasn't satisfied with any of those solutions. I thought, "Isn't this chicken-and-egg problem the kind of thing that Utility Boot CDs are supposed to solve?" Indeed. There is a little utility on the Ultimate Boot CD for Windows called Fix HDC, purported to "Fix the Hard Drive Controller when replacing your motherboard on an XP system" That sounds good to me.

Now, the Ultimate Boot CD for Windows (UBCD4Win) is a decidedly do-it-yourself affair. You build it yourself, based on your own copy of the Windows XP install disk (I used an nLite install disk, slipstreamed with SP3 and the right AHCI drivers, but a plain Windows XP install CD should work fine too, since UBCD4Win comes with a bunch of drivers). I hit a snag caused by multiple copies of cygwin1.dll on my computer, but this post helped me clear it up.

So, burn a UBCD4Win cd, and put it in the drive. Boot the computer, and go in to your BIOS to make some changes. First, make sure that the CD player is first in the boot order. Also, change your SATA controller from IDE mode to AHCI mode in the BIOS. Note that many motherboards have two SATA controllers, so make sure you are changing the right one. Mine has a six-port Intel controller, and a four-port controller from Gigabyte.

After a long boot process, UBCD4Win dumps you in to a bizarro-world version of Windows,with a zombie-colored, MS Serif Start menu. No matter, we didn't come here for the design. Under Start > Programs > Registry Utilities, you will find Fix HDC. Make sure you have changed your BIOS to AHCI mode beforehand, otherwise FixHDC will just install regular IDE drivers.

In the Start Menu, Fix HDC is a folder, containing two items. The first allows you to set which Windows installation you want to modify. The second runs the actual Fix HDC utility. It runs in a dos window, and prompts you to back up your installation and/or modify your storage drivers. I chose Modify. UBCD4Win comes with a comprehensive selection of drivers, so Fix HDC will likely find the right driver for your hardware.

If UBCD4Win does not have the right driver for your hardware, it may install a "close enough" driver that will at least allow you to boot into your hard-disk Windows in AHCI mode. Once there, you can upgrade the driver just as you would any other.

This post has a very clear explanation of which driver to use based on your motherboard.

Anyway, the changes made by Fix HDC worked.

Tuesday, October 26, 2010

Ctrl-Enter in Thunderbird

Did you know that Ctrl-Enter in Thunderbird sends your email message immediately? If you do, you probably learned it the hard way, by sending a half-written email, like I just did. Awkward . . .

To get rid of this behavior, install the keyconfig extension. Once you have installed the extension and restarted Thunderbird, go to the Tools menu > Keyconfig. Choose "Send Now", and click the disable button.

If you installed keyconfig, but you can't find the "Send Now" option:

1) Open Thunderbird
2) Start composing a new message (in a new window)
3) In the main Thunderbird window, go to the Tools menu > Keyconfig
4) At the top of the Keyconfig window, there is a dropdown box, with one entry for each open Thunderbird window
for example:
- Inbox
- Write (no subject)
- Keyconfig
5) Choose the "Write . . ." window in the Keyconfig dropdown box
6) Send Now should now be listed in the Keyconfig listbox
7) Select Send Now, and click Disable
8) done!

Tuesday, July 20, 2010

Nested list comprehensions in Python

Python's nested list comprehensions often hover on the edge between elegance and obfuscation.

I made some examples to show the order of evaluation, and the results of adding/removing the nested bracket symbols.


matrix = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
]

# This flattens and transposes the matrix.
c = [row[i] for i in range(len(matrix)) for row in matrix]
d = []
for i in range(len(matrix)):
for row in matrix:
d.append(row[i])
assert(c == d)
print c # [1, 4, 7, 2, 5, 8, 3, 6, 9]

# This flattens the matrix.
e = [row[i] for row in matrix for i in range(len(matrix))]
f = []
for row in matrix:
for i in range(len(matrix)):
f.append(row[i])
assert(e == f)
print e # [1, 2, 3, 4, 5, 6, 7, 8, 9]

# This transposes the matrix.
a = [[row[i] for row in matrix] for i in range(len(matrix))]
b1 = []
for i in range(len(matrix)):
b2 = []
for row in matrix:
b2.append(row[i])
b1.append(b2)
assert(a == b1)
print a # [[1, 4, 7], [2, 5, 8], [3, 6, 9]]

# This returns the matrix unchanged.
g = [[row[i] for i in range(len(matrix))] for row in matrix]
h1 = []
for row in matrix:
h2 = []
for i in range(len(matrix)):
h2.append(row[i])
h1.append(h2)
assert(g == h1)
assert(g == matrix)
print g # [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

# This oddity builds up a nested list from simple lists.
k = [zip(j,j) for j in [range(i) for i in range(4)]]
m1 = []
for i in range(4):
m1.append(range(i))
m2 = []
for j in m1:
m2.append(zip(j,j))
assert(k == m2)
print k # [[], [(0, 0)], [(0, 0), (1, 1)], [(0, 0), (1, 1), (2, 2)]]


Thanks to Luka Marinko for his instructions for setting up syntax highlighting on Blogger.