30 July 2010

Using Blizzard Downloader from behind a proxy server

The Blizzard Downloader used to download Starcraft II and all other Blizzard products does not work from behind a proxy. Blizzard does not support proxies in any way really, so if you don't have a direct connection to the internet you're slightly out of luck.

But if you're keen enough, there's always a way. The requirements for this method are:
1. An SSH connection to a server anywhere in the world that has a direct internet connection.
2. SocksCap - free Windows program that can force any program to connect through a Socks proxy.
3. Putty - free Windows program that can act as an SSH client and allow you to make SSH tunnels.

If you already have an SSH server that you can use for this purpose, great. If not, consider either turning a home server into an SSH server (this could be slow if you have a slow internet connection at home), or go get a VPS (you can get a server from VPSLink for a whole month for $7.99, this includes full root access & SSH access, the whole process takes about 5 minutes).

Once you have your SSH server, download putty and install. Create a session to your new SSH server, but before you connect go to Connections/SSH/Tunnels. In here enter say 5555 for Source port, check the 'Dynamic' radio button underneath and click Add. Now connect to your server and login, leaving the terminal open. The SSH tunnel is now in effect. Basically, Putty listens on local port 5555 for any connections and forwards these to your server via an encrypted SSH link, the server then forwards the request to whatever IP address and port the program that initiated the connection requested. To test this, go into Internet Explorer or Firefox, go to the Proxy settings dialog, select to enter manual settings, and under the Socks proxy enter 'localhost' for host and '5555' for port. This will tunnel your internet traffic through the SSH server. Test by trying to go to google.com or youtube in your browser. If the pages load, the tunnel is working. Double-check this before proceeding. Close the Putty session and try refreshing the browser. The webpages should now NOT load, as the tunnel is broken. Open putty and connect again as before (you can save the settings and reload without re-entering all the details again).

Once the above is done, download SocksCap 2.4. Install it, open the program and go to settings. In the SOCKS Server field enter 'localhost', and Port '5555'. In the Protocol section check SOCKS Version 4 and enter anything in the User ID field ('bob' will work just fine). Click Ok to save the settings. Now it's time to make an application profile to use the proxy. In the SocksCap main window, click New. Type anything in Profile Name. For Command Line, click browse and locate the Battlenew downloader, or whatever other program you want to tunnel (you can tunnel entire games just by selecting the main .exe launcher). Leave working directory blank and click Ok. Now just select the newly created profile in SocksCap and click Run.

This will launch the program and intercept all it's internet connection calls, tunneling them through the Putty local Socks tunnel, which tunnels through SSH to your remote server, which finally connects to whatever address the Battlenet client or whatever program your running requested.

29 July 2010

Creating a minimal Ubuntu 10.4 VirtualBox Virtual Machine

  1. Download the latest Ubuntu Minimal ISO.
  2. Start up VirtualBox and create a new Ubuntu Virtual Machine. Give it say 768MB RAM and create a new 8GM dynamically expanding disk space (you cannot increase this maximum disk size so make sure you pick something that will accommodate the largest possible size your VM will take).
  3. Go to the Settings dialog in VirtualBox and select to mount the the mini Ubuntu ISO you downloaded. Go through all the other settings as well and make sure sensible configurations are enabled (you can always change these later).
  4. Start the VM, it should boot from the ISO and take you to a 'boot:' prompt. Just hit enter without typing anything.
  5. Select Command-line install from the next menu and follow the prompts selecting language, keyboard, etc. All defaults work fine in most cases.
  6. Set a proxy when prompted if you're behind a proxy server. The installer will then do it's thing, connect to the internet, download packages and install the core of the OS.
  7. After the install, create a user and password when prompted, say ubuntu/ubuntu.
  8. Once all that is over, the VM will restart and you'll be taken to a login prompt. 
  9. Login with the user you created, then install the following (first is a minimal gnome setup, second is needed for installing Guest Additions later):
    1. sudo apt-get install xorg gnome-core gdm gnome-applets gnome-system-tools gnome-utils ubuntu-artwork compiz-gnome file-roller
    2. sudo apt-get install build-essential linux-headers-generic
  10. Restart the VM and login via the new interface.
  11. Install the VirtualBox Guest Additions by clicking on Devices/Install Guest Additions in the VirtualBox menu bar at the top of the VM window. This will just mount a CD ISO under /media/VBOXADDITIONS_x_x_x. Navigate to that directory in a terminal and run 'sudo ./VBoxLinuxAdditions-x86.run'. 
  12. This gives you a minimal install with not much besides the Gnome environment (you could use an alternative to Gnome such as xfce4 which is supposed to be lighter, but I find Gnome is just a lot more standard and will give you less headaches in the long term). Before installing anything else you may want to just shut down the VM and make a zip of the .vdi disk file to store in a safe place. You can use this as a base image that you can import into a new VM and configure differently. Whenever you do this though (create a new VirtualBox machine configuration and attach it to a copy of this .vdi), login to Ubuntu and delete the file /etc/udev/rules.d/70-persistent-net.rules (otherwise the virtual network card won't be detected, the new VM config creates a new random virtual MAC, Ubuntu caches the old MAC from the original VM you used and gets confused, deleting the file and restarting the VM forces Ubuntu to reconfigure the eth0 interface).
If you want to install PHP/Apache/Postgresql, do the following:
  1. sudo apt-get install postgresql postgresql-client postgresql-contrib
  2. sudo apt-get install php5 php5-gd php5-curl php5-pgsql
  3. sudo apt-get install apache2-mpm-prefork libapache2-mod-php5 
To install a web-browser, just do:
  1. sudo apt-get install firefox
You may also want to create a shared folder between the host OS and the guest OS. In the VirtualBox application on the host OS, click settings and add a new shared folder giving it a name, say 'share'. Then, in the Ubuntu VM, type 'sudo vi /etc/rc.local' and add the line 'mount -t vboxsf share /tmp'. This will link the host folder named 'share' with the Ubuntu /tmp folder at startup. Note though that if you're thinking of creating a shared folder which is also a Dropbox folder, it won't work. The Ubuntu guest Dropbox client won't be able to properly detect and index the files that are being shared by the host.

Install whatever other tools you may need, and remember you can always shut-down and make a zip of the .vdi to take a backup copy that you can come back to later (you can also use the VirtualBox snapshot feature, but make sure you back these up to redundant storage).

    26 July 2010

    Removing wall stains with Magic Erasers

    If you've ever tried to remove a stain off a wall, you know how hard it is. These stains are usually marks left behind from a couch that's rubbing up against the back wall, or little marks in the hallway that slowly accumulate over time as you come home and try to squeeze through with 5 bags and two boxes on each arm, or perhaps kids drawing Pokemon with crayons, etc.

    Trying to scrub these away with a damp cloth and warm water, or perhaps sugar soap, or fine sand paper, or whatever else you can think of, is usually futile. It's easy to spend 20 minutes scrubbing one spot until your arms are numb with little to no progress to show for it. Luckily however, there's an easier way.

    Most supermarkets or hardware stores will sell something called a Magic Eraser. Here in Australia it's manufactured by Chux and looks like the picture below. There are a number of different brands around the world that are all basically the same product. A quick Google search for Magic Eraser in your local area should reveal what's available.


    The product is a soft sponge that you dip under a running tap then squeeze out as much of the water as you can. You then just rub it up against any mark on your walls (or cabinets, or most painted surfaces) as you would a normal pencil eraser. It takes very little pressure and very little scrubbing to get rid of most marks. It really does seem like magic every time you try it! The sponges disintegrate pretty quickly, but are worth their weight in gold. I used a pack of these to clean the walls of a rental apartment before moving out. They worked so well that I went back to the supermarket and bought 5 more packs for future use!

    The technology behind it is something called melamine foam. This stuff was originally used for sound isolation but later discovered to be very effective for cleaning as well. The foam is soft to the touch, but very hard at the microscopic level. From my understanding, it's basically like steel wool, but with fiber-glass strands, and much, much finer. Whatever it is, it works great!

    Oh, and Chux also make a version specific for removing soap scum. I tried one of these too and it worked just like advertised. It makes kitchen sinks and bathroom surfaces shine like you've never seen them before.

    07 July 2010

    MyTouch Slide Battery Drain

    There seems to be an issue with the MyTouch Slide causing the battery to drain extremely quickly at times (within a couple of hours). In my experience this seems to happen mostly when not connected to WiFi and when applications try to synchronize data over the 3G connection.

    I tried to identify which application was responsible for this battery drain by closing them down one-by-one (using ATK). After everything was closed the battery was still draining. So I went into Settings/Applications/Manage Services and started shutting these down one by one too.

    It seems that, in my case at least, the Google Talk Service was responsible for the battery drain. Shutting this service down dramatically increased my battery life. Restarting the phone brings the service back up, and a few hours later rapid battery drain begins too.

    02 July 2010

    Dismiss Windows Update Postpone

    If you have Windows set to automatically download and install updates, you'll often get a little dialog asking you to restart your computer or postpone the restart for 10 minutes or up to 4 hours.


    This can get pretty annoying, especially when you get the restart notice early in the morning. Restarting can be a pain when you're busy doing your work and have multiple applications open and configured as required. Postponing every 4 hours works, but what if you're away from your desk when the next notice comes up? Or what if the dialog pops open and you accidentally hit restart?

    It would be good if there was an option to select 'Remind me - never' or something along those lines, but there isn't.

    An easy workaround however is to just open a Command Prompt and type net stop "windows update". This will turn off the Windows Update service, hence no more restart prompts. The service will come back on by itself whenever you do get around to restarting your PC.

    Note though that some say it's not a good idea to postpone the restart for too long as it can lead to system instability. Use this at your own risk!