Buying iTunes vouchers/gift cards online

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 http://www.buyfrompowerseller.com/, 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 buyfrompowerseller.com 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

Posted in Articles | Tagged , | 2 Comments

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
redsn0w-win_0.8.zip 45849b42 6b9480bde795f20c62592645ecddec1c b7c3f3e1ec1f9b62fde9030265f2e3623e2576bd
⌙ redsn0w.exe 01324e34 aeb7ac29b1954c992f33335da1e59189 1499f5fad69a2212126096379582204298abf911
Posted in Articles | Tagged | Leave a comment

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.

Posted in Articles | Tagged , | 1 Comment

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):

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.

Posted in Articles | Tagged | Leave a comment

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:

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:

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:

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.

Posted in Articles | Tagged , | Leave a comment

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.

Posted in Articles | Tagged , , | Leave a comment