Your iPhone & its dock: Disabling the mute feature

iPhone dock with Line Out port

I recently purchased a dock for my iPhone from a guy on Ebay. It’s not an official Apple product, because $5 is a far better price than the $29 Apple wants for a piece of plastic. All-in-all, its a great little product, and it would be perfect but for one thing; every time I plug my iPhone 3G into it, it mutes the sound.

Of course, given that this dock has a Line Out jack on the back, it makes sense that it would disable my iPhone’s built-in speakers. After all, why would you want your iPhone’s tinny sound tarnishing whatever you plug in the back? However, seeing as I’m using it as a bed-side stand, there will never be a speaker system to tarnish. Here’s how to prevent it from muting your iPhone.

Step 1: Open it up. You’ll need a small phillips screwdriver, about 2.5mm in diameter. Just stab it through the rubber layer on the bottom and unscrew.

Location of the screws on the bottom of the iPhone dock

Step 2: Using a soldering iron, remove the tiny resistor (Pictured to the right) from the marked location on the PCB.

Location of the resistor to remove on the iPhone dock PCB

Step 3: Reassemble and enjoy. :)

Restoring iPhone USB access under iTunes 9

Like many jailbreak iPhone users, I prefer to SSH to my iPhone 3G via the USB cable instead of over my wifi network. Since upgrading to iPhone OS 3.1.2 and iTunes 9.0.2 (Specifically, however, I’ve discovered that the tool I used, iphone_tunnel.exe, no longer works. Instead, every time I try to connect with Putty or WinSCP, the error message iphone_tunnel gives me is:

new connection !
AMDeviceNotificationSubscribe = 0
iPhone attached !
AMDeviceConnect = 0
AMDeviceIsPaired = 1
AMDeviceValidatePairing = 0
AMDeviceStartSession = 0
MobileDevice: _send_message: Could not encode message as XML
AMDeviceStartService = 0
AFCConnectionOpen = 0

My initial search results lead me to downgrade the “Apple Mobile Device Support” component to the version used in iTunes, but this did not work. After a lot more searching, I discovered a slightly different tool, itunnel, which I originally discounted as just another name for iphone_tunnel. It is actually a modified version of iphone_tunnel, presumably for iTunes 9 compatibility. It works fine on my iPhone 3G, and I imagine the same would go for the iPhone 3GS.

You can download it from MediaFire (623.55 KiB).

The legal risks of buying a US iTunes voucher/gift card

My experience with safely buying a US iTunes voucher was entirely positive, but being scammed isn’t the only way things can go wrong for a South African iTunes user.

I recently came across a post discussing the legality of using US iTunes gift cards in South Africa. In short, redeeming the voucher as a South African is a breach of contract, as you are breaking Apple’s terms and conditions on voucher redemption. The article goes on to cover why Apple includes these terms, and why breaking them may also lead you to break content copyrights.

So what does this mean for us? Effectively, Apple are entitled to terminate offending iTunes accounts on the basis that their terms of service were breached, which may well result in the account owners losing access to any purchased content.

Thus far, Apple have not enforced this, and I’m hoping they never do. Currently, it’s in their financial interest to turn a blind eye in favour of increased iTunes voucher sales, but if the content providers push hard enough, Apple’s stance may change and then we all lose out.

Buying iTunes vouchers/gift cards online

Warning: This review is old and may no longer hold true. Please see the edits at the end of this post.

Using an iPhone and iTunes as a South African user sucks. Every iPhone user I know has registered a US iTunes account to get access to apps that are inexplicably* unavailable in South Africa. The only downside is that, without a US credit card, the only way to buy apps on the AppStore is by using iTunes vouchers/gift cards. Naturally, getting the vouchers in the first place can be a risky endeavour.

I decided to take a chance on, given their positive eBay feedback profile. The order went in at 18:35 GMT, and 76 minutes later, I had my voucher code; iTunes happily accepted it and my first purchase was entirely without incident. So far I’m entirely happy, although I’ll update this post if anything develops.

* Apparently South African law requires all “games” to be reviewed by the Film & Publications Board. Thus, even if an app is set for global distribution in iTunes, it won’t appear in the South African flavour.

P.S. 2011/07/19: I recently noticed that is currently linking to this review on their affiliate page. For the record, I am not an affiliate of theirs, and I have not received anything from them except the iTunes voucher, which I purchased at full price. — Ashley

P.P.S. 2012/11/28: Felix has raised an issue with not fulfilling orders, sharing an article that highlights the problem. If one checks buyfrompowerseller’s eBay feedback, you’ll find only one review in the last year. This is worrying, as it shows that they have stopped selling iTunes vouchers through eBay, which also means that customers can no longer rate their experience in an open forum. Please beware when purchasing from this vendor, and do not trust their eBay feedback profile. — Ashley

redsn0w 0.8 Checksums

As it doesn’t appear to be online elsewhere, here are the checksums for redsn0w 0.8 for Windows:

Filename CRC32 MD5 SHA1 45849b42 6b9480bde795f20c62592645ecddec1c b7c3f3e1ec1f9b62fde9030265f2e3623e2576bd
⌙ redsn0w.exe 01324e34 aeb7ac29b1954c992f33335da1e59189 1499f5fad69a2212126096379582204298abf911

Migrating iTunes apps between installs

Ahh, a new PC, a new install of iTunes, and all the apps I downloaded for my iPhone are nowhere to be seen. iTunes doesn’t offer me a way to redownload all the apps I installed, and what’s more, when I try to sync my iPhone with the new copy of iTunes, I get the following message:

Are you sure you want to sync applications? All existing applications and their data on the iPhone will be replaced with applications from this iTunes library.

I’m not especially inclined to manually redownload all those apps, but nor am I keen on the idea of losing them all. Fortunately, I had not yet nuked the old PC and a quick search revealed that iTunes stores your downloaded apps under My Documents\My Music\iTunes\Mobile Applications. I simply copied all the .IPA files from my old PC over to the new one and then, in iTunes, clicked on File > Add Folder to Library…, selected the folder, and breathed a sigh of relief as the apps reappeared in the Applications library.

Of course, all this could be avoided if Apple provided a way to back up one’s Applications library. iTunes does provide a “Backup” feature that involves burning your library to CD/DVD, but that isn’t quite what I had in mind.

C# Quines

Writing quines is a fun way to while away an afternoon, especially when trying to make them as short as possible. This is the result of my attempt at writing the shortest C# quine possible (155 characters, source file):

class q{static void Main(){string s="class q{{static void Main(){{string s={0}{1}{0};System.Console.Write(s,'{0}',s);}}}}";System.Console.Write(s,'"',s);}}

PS: I came across a shorter C# 3.5 quine (149 characters), which uses var instead of string. Clever. Oh well, c’est la vie.

Crouching Enumerator, Hidden Boxing

A few months ago, I was playing around with a simple C# permutation generator to build a word list, with each character position having its own list of characters to iterate through:

List.Enumerator enumerator = characterList.GetEnumerator();

while (condition) {
	if (!enumerator.MoveNext()) {


Oddly, I was getting a compilation error on line 5, as enumerator doesn’t have a Reset() method despite the IEnumerator interface defining one. MSDN quickly cleared things up, though, revealing that List<T>.Enumerator explicitly implements the method as void IEnumerator.Reset(), which is implicitly private. You can still call private interface methods if you first cast to that interface, so I changed line 5 to the following:

		((IEnumerator) enumerator).Reset();

I thought that was the end of it, but bizarely, the second call to MoveNext() on line 6 also returns false. I confirmed that the private Reset() method actually implements reset functionality, which it certainly does, yet it seemed to have no effect.

The answer lies in the fact that List<T>.Enumerator is a struct. This means that behind the scenes, the cast to IEnumerator is creating a boxed copy of enumerator, and that’s what’s being reset. The original is left untouched, so the call to MoveNext() will naturally return false. Rather than trying to keep the boxed copy that you get from the cast, the correct solution is to use IEnumerator<T> from the outset, rather than List<T>.Enumerator:

IEnumerator enumerator = characterList.GetEnumerator();

while (condition) {
	if (!enumerator.MoveNext()) {


All this drama could have been avoided if I hadn’t checked the return type for List<T>.GetEnumerator() and used that. So much for more explicit typing being helpful.

Still, it’s rather odd that List<T>.Enumerator is both public and a struct. The former encourages its direct use, and the latter results in the problem I was experiencing. Sadly, this design is constant throughout the System.Collections.Generic namespace. By contrast, the equivalent non-generic collection is ArrayList, and there, the GetEnumerator() method returns an IEnumerator, which is implemented by a private class nested within the ArrayList type – a design that is constant throughout the rest of the System.Collections namespace, and is, in my opinion, better for everyone.

The Joy of ASP.NET, Visual Studio and Proxies

Some time ago, the web project I was working on started refusing to open. Every time I tried to reload the ASP.NET project, Visual Studio (In this case, VS.NET 2003, but it may affect 2005 and 2008) gave a strange error message:

The Web server reported the following error when attempting to create or open the Web project located at the following URL:
‘http://localhost:/xyz/ACME.XYZ.Widget’. ‘The connection with the server was reset’.

The project files hadn’t changed and I hadn’t made any changes to IIS recently. In my search for a solution, I come across someone else having problems creating ASP.NET projects from Visual Studio on a network that used a proxy, getting the message ‘A connection with the server could not be established’ – this proved to be the key to the answer. In short, Visual Studio needs to support environments where your ASP.NET project is not hosted on your own machine, so it uses the system’s proxy settings.

In my case, under Control Panel > Internet Options > Connections > LAN Settings…, I had enabled Use a proxy server for your LAN but had neglected to also tick the Bypass proxy server for local addresses checkbox. When Visual Studio gave the proxy a request for localhost, the proxy responded by closing the connection, and thus Visual Studio came back with the error message. Simple, logical, and entirely frustrating.