Sometimes you need to pretend to be in another country.
VPN’s are great for this, but one novel approach is Unblock-Us which changes the location of your DNS server, instead. You use your IP, but you make DNS requests against in-country DNS servers, thus directing you to the application servers supporting that country. There is no anonymity, but you don’t have to worry about bandwidth caps, and it’s worked for every service I’ve tried it on.
I use this when I need to access video that is region limited. However, changing your DNS servers through the Mac settings app is a pain when you have to do it over and over again. On Windows they have an app to download which can manage the change for you.
So what I did on my Mac was create a script to use the built in networksetup command to change my DNS as needed.
networksetup -setdnsservers "Wi-Fi" 208.122.23.23 208.122.23.22
And one to un-set it.
networksetup -setdnsservers "Wi-Fi" "Empty"
To top it off, I built a simple Alfred workflow, making it even quicker and cleaner.

You can download that here: Unblock-Us Alfred Workflow.
Note that if you are using a wired network interface, you’ll need to change the service name from “Wi-Fi” to, well, whatever it is you are using.
I’ve noticed a trend in PHP code to shy away from function application and closures. I understand to some extent. Useful, inline anonymous functions were not available until 5.3.0, which is relatively new. And create_function is an abomination.
Still, I think that PHP programmers just don’t think in this mindset, but it can be very useful.
Here is a rather contrived example, but one I’ve honestly seen an analogue of before.
$accumulator = array();
foreach( $this->tags->all() as $tags ) {
$accumulator[] = htmlspecialchars( $tag->name );
}
return implode( ', ', $accumulator );
Easy to understand, simple, does the job, but it is far more verbose than it needs to be.
Here is a version using array_map.
$tags = array_map( 'htmlspecialchars', $this->tags->all() );
return implode( ', ', $tags );
The array_map function is doing all the work of the loop, but you don’t have to write it and you don’t have to manage the accumulator.
Doesn’t that feel better?
Next time you mangle an array, first think if array_map or it’s friends array_filter or array_reduce could do it better.
The online docs for testing and deploying your Enyo apps to the TouchPad are woefully weak. I finally found how to get the TouchPad into developer mode, and thought I’d share.
- Start “Device Info”
- In the menu, pick “Custom Application”
- Enter “##devmode#”
- Done!
You’ll need to do a restart before you can install any packages, or at least I did.
I’ve had trouble compiling native extensions on the Mac before, but I finally found a fix.
You just need the correct ARCHFLAGS environment variable. You can set this in your .bashrc or use it right before python setup.py build
ARCHFLAGS="-arch i386 -arch x86_64"
This works because XCode dropped the PPC compiler in v4, and with that variable we tell the setup script not to bother trying to compile for that arch, just i386 and x86_64.
Much thanks to Y.H. Wong in this Super User thread.