Cloud Computing For Personal Backups – Amazon S3 Versus Dreamhost?

August 14, 2008


Bookmark and Share

Utility Computing Meets Personal Backups


Short Version

A drive died in my fileserver, providing the impetus to use “Cloud Computing” to do my personal backups.

S3 is Amazon’s Scalable Storage Service, one of the components of Amazon Web Services (AWS). AWS is a set of Cloud Computing resources for creating scalable Internet businesses which can benefit from a scale-on-demand scheme. In particular, if you have an Internet business that has large spikes in traffic, then AWS can lower costs dramatically since you pay only based on the resources used.

However, back of the envelope calculations show that for applications which don’t require scaling (e.g. home backups), AWS can be fairly pricey when compared to simple alternatives like web hosting services, even when availability is considered. Using rsync to backup to a web hosting service can be done for less than 1/10th the price of Amazon’s S3, with very little setup involved. Availability can be easily enhanced beyond that provided by S3, by employing a second hosted server, still at 1/5th the price.

AWS is designed for applications which could benefit from scale-on-demand scheme. If your application doesn’t need this, then it might not make sense economically.

Long Version


The Joys and Sorrows Of Owning Shiny Metal Boxes

One of the SATA drives on my home file server died a horrible death this week. The server had been acting funny all week, giving me the occasional strange I/O error. Finally, the system would not boot , instead showing the familiar “Insert CD:” error that shows on the screen when the boot drive fails. Attempting to auto-recognize the first SATA drive from the BIOS made the computer think for awhile, and then come back without finding anything. Unfortunately, this box was also running slimserver which provides access to my music collection from my Squeezebox. No streaming music for the BBQ I’m hosting this weekend (we’ll have to switch to the redundant iPod + boombox).

I originally built the computer as a tiny fileserver-on-the-cheap for things like my videos, music collection, and family photo album. At the time, 2 years ago, I had been looking at SOHO NAS systems for a while, but just couldn’t get over how much they cost. Also, for the price I thought I deserved unfettered access to the underlying server to put whatever I wanted on it. Whenever I see some new device with Linux on it, the hacker in me wants access to bend it to my will. For the server, I used the tiniest enclosure I could find that fit microATX, which at the time was the Antec 1380, a small cube about the size of 2 shoe boxes. One slight design flaw was putting a powerful (but inexpensive) CPU in the box: an AMD dual-core 3800. Yes, I succumbed to market forces and, in the popular venacular, “biggie sized it.” While I got the CPU at a good price, it ran a bit hot. In retrospect I wonder if this extra heat caused my drive to fail.

If I had to buy my own equipment today, I’d probably go with the Thecus 5200 (dedicated SOHO NAS). Let’s face it, owning tiny, shiny boxes packed with technology is fun. But it’s also expensive, and eventually, everything breaks.

Cloud Computing To The Rescue?

A natural response to owning things that break is to not own them anymore, which brings us to Utility or Cloud Computing. I had preferred the earlier term “Utility Computing,” as I thought this moniker more accurate, although Cloud Computing does sound cooler. Eventually the coolest sounding name wins mindshare and we are forced to use it.

Also, a problem with the term Utility Computing is that the the analogy of “computing power as electricity” is limited. Utility Computing is less like electricity, more like lego pieces. Utility, er rather Cloud Computing already has a variety of different payment models, and service types, each with different features which are important for solving different types of problems. One important feature to emerge is the ability to scale-on-demand, which is being pioneered by companies like Amazon, with their Web Services (AWS).

Scale-on-demand (my own term) is a really cool feature, which is part of the basic strategy for Amazon Web Services. The basic argument is if one must own/rent equipment to cover the maximal use, then the equipment will not be fully utilized. Consider a company whose normal utilization is 1/10th of periodic spikes in activity, say around noon. In own/rent models, the company would have to have 10 times the equipment just to handle the spikes, even if the spikes only lasted for 1 hour. Calculations show the average utilization would be far lower => 9 + 24 computer hours => 33/24 = 1.375. So we need 1.375 computers instead of 10, if we could spread our load out consistently over time.

This shows that there is room for a middleman who aggregates computing resources to make a profit. If the middleman can effectively spread out utilization spikes so that the utilization pattern for a large number of companies approaches the average utilization, then machines can approach 100% utilization. This is exactly the approach that Amazon is taking with its various services which make up AWS.

AWS has many individual component services which each have different applications. Those of you who work in the Internet space, or distributed computing will recognize many of the pieces of scalable Internet storage – entity storage, mySQL database instances, key value persisted storage, virtual instances (ala Xen), durable queues. There are already many startup companies who have built their entire infrastructure using AWS.

Are Personal Backups Using S3 Cost Effective?

I’ve seen a lot of blog posts about doing personal backups to S3, which one must admit sounds extremely cool at first glance. S3 is Amazon’s Simple Storage Service, which allows one to write, read and delete objects of up to 5GB. The objects are retrieved from buckets you define via the bucket id and object name.

The best way to do incremental backups is to look at the state of what is backed up, and then produce a delta of what has changed. This way, we’d only send the portions of the files that had changed. This delta system works extremely well for many types of files. And it turns out there is a well-known and dependable tool which does this well: rsync. Rsync remotely calculates a delta, and sends only the minimal set of file updates via ssh. There are also some clever minimal backup packages that use Unix hard links to provide “minimal space snapshots.” This technique is so cool and simple, but it does rely on hard links, which are not available to every OS (but all *nix have them). If hard links aren’t available in a particular OS/filesystem, rsync can be trivially used to maintain a single up-to-date snapshot (a cron job invoking rsync is all it takes).

Note that rsync should be installed on any Linux host from a web hosting company, so if you have ssh access, you can use this backup technique, with almost no setup required. Here are some links:

  1. Rsync – file copy utility which computes and transmits minimal deltas to update.
  2. Rsnapshot – a backup program based on rsync and written in perl which implements the minimal space snapshot idea with hard links.

Next, lets look at the cost analysis. Remember that the Amazon Web Services can help us save money, but are designed from the standpoint of providing scale-on-demand ability versus purchasing for peak utilization. We are essentially “buying insurance” against usage spikes. But our simple backup application is completely predictable, and will never have any usage spikes. This is for our home backups, not to provide scalable backups for all the consumers out there on the Web. The backups are easy to schedule so that there are never any spikes, and thus we can completely predict our usage. Not only that, but backups are not latency sensitive – I just want to make sure they happen every night. I don’t really care if they take an extra 10 minutes.

S3 costs $0.15 per GB per month for storage. For 500 GB, this would be $75 a month. Web hosting services provide a variety of monthly plans from about $11, and give between 500 and 2500 GB. In fact, there are services which offer “unlimited storage.” Unlimited storage is simply another play on the averages. If you have enough customers, you can give people unlimited storage, because your average storage will be extremely low. It’s like an all-you-can-eat buffet: the average person is paying for the people loading their plates.

Thus, purely from a cost perspective, storage for backups from a web hosting company should be 1/8th – 1/34th the cost of Amazon S3.

One final issue to look at is availability. Amazon has an actual SLA for S3 which guarantees 99.9% uptime, or you will get reduced rate for the period of the outage. This is actually pretty cool as they will return from 10%-25% of your money for that month. Keep in mind this is good, as the incentives will push Amazon to get better and better, but it’s no guarantee of stability. Once they have a “really bad month,” the incentive to keep the month good goes away. After all, under the Amazon S3 Service Level Agreement they could be down the entire month (0% uptime), but still charge you 75% for storage fees. In extremis this sounds ridiculous, but this is a problem in the structure of most SLA’s, not just Amazon’s.

In the month of July, Amazon S3 had an 8 hour outage due to a data corruption problem. Amazon CTO Werner Vogels mentions in his blog the root cause was single bit corruption of internal state messages that are distributed via Gossip techniques. It’s good to keep in mind that the core technologies for AWS are new and so have a few minor kinks to work out. While Amazon does not have to rely on software upgrades to existing services for revenue, they still have to provide missing features for their customers. So I would expect errors like this to abate over time, but not completely vanish. In a distributed system, any error, regardless how small, becomes serious through amplification.

This puts them at 98.88% for the month of July, just for this event. To their credit, the response was very professional, swift and public. CEO Jeff Bezos even talked about it. To put this in perspective, service companies usually apologize in private, and try to make it up when the monthly SLA reports are given to customers. In my mind this is one of the things, besides the technology, which puts Amazon way out in front in the race to define this industry. I especially like the Amazon AWS dashboard which shows their history of outages.

The web hosting companies have no SLAs for most self-serve customers (although upscale web hosting, which costs more, may have SLAs for businesses). Uptime is measured by third party companies. It’s not clear how the measurements are taken or what the relationships are from the hosting companies. I have to believe the hosting companies are providing advertising money to these uptime companies, which doesn’t bode well for the objectivity of the measuring company. Still, it is not hard to find companies with uptime of 99.5%. This would equate to 2 hours of downtime a month, which for a backup solution, seems completely acceptable, especially at 1/8th the price. This does not take into account data transfer, or computational costs, which would be free for the web hosting company, but translate into even higher S3 costs.

Also note you can have a secondary web hosting service, or even a different server with the same service, to get a much better availability through trivial redundancy. Note that two hosting servers would give availability of 99.9975%, which is 1 minute of downtime a month, and far better than Amazon, at 1/4th the cost.

Note that either of these solutions is superior to owning your own hardware, as Jeremy Zawodny calculates. Also, if you are interested in software which backs up to S3, Jeremy has done the legwork for you.

Amazon S3 (and AWS) really shines as a model for scale-on-demand. This makes a lot of sense for things like a website with a video that becomes popular overnight, and needs to scale up to meet a rush of users. But the scale-on-demand terms approach loses the pricing advantage when the max utilization is close to the average utilization. For long term storage this tends to be true, as it grows very slowly. I’m thinking S3 is designed more for scaling I/O reads and writes, which are costly features our backup solution won’t use.

Don’t get me wrong, I think S3 and AWS in general are the coolest thing since sliced bread, but they don’t make sense for every project (especially where scalability isn’t important). We’ll come back to some cool uses of AWS services in future articles where the model does make sense.

Giving Dreamhost A Try

I’d heard good things about Dreamhost, so I’m giving them my business. Setting up backups was trivial, rsync was already installed so it worked on my first rsync command attempt. We’ll see how the availability is over the coming months.


Bookmark and Share


How To Tether The iPhone 3G To A Mac Laptop

August 11, 2008

Today’s Slightly Naughty Post: Avoid The $60/month charge for Laptop Wireless Connectivity By Tethering Your iPhone




Bookmark and Share


Unix Command-Line From A Jailbroken iPhone

Unix Command-Line From A Jailbroken iPhone

In today’s post, I’ll show how to configure your iPhone for “tethering” to act as a cellular modem for your laptop. AT&T does not provide a tethering option for the iPhone and has no official plans to do so, despite having one for the Blackberry which costs an additional $30 ($60 total). Note that tethering the iPhone does constitute a violation of the Terms of Service (TOS), which if detected might require paying an extra $30 (or possibly worse). However, if you want to use a laptop for remote work in the U.S., the only currently authorized means of doing this is to get a separate cell modem account, at an additional cost of $60 per month.

Tethering requires jailbreaking your iPhone, a relatively simple and foolproof process which may nonetheless make you slightly nervous. This allows loading a cornucopia of unofficial software onto the iPhone, as well as access to the underlying modified FreeBSD system (e.g. via command-line). Once this is done we can put a socks proxy server on the iPhone, which will forward requests from the laptop received over an ad hoc Wifi network. This requires a little bit of configuration.

When comparing a tethered iPhone to a dedicated laptop wireless card, the iPhone has far less effective bandwidth (33%-50%) and far higher error rates, particularly in signal challenged locations. The better performance of the dedicated card is partly due to the card’s specialized, dedicated processor. Further, the iPhone has some minor reliability problems due to uncoordinated software components which occasionally stomp on each other. A top-of-the-line, dedicated wireless card is far more reliable in situations with higher error rates. If you rely heavily on a laptop with remote access for work, you’ll likely be happier with a dedicated card, despite the fairly high, extra monthly fee.

An alternative to tethering is to use an external keyboard with the iPhone in landscape mode for text entry. For example, MacAlly is readying a bluetooth enabled keyboard called the BTKeyMini. This is likely useful enough for writing short documents, long emails, and remote ssh.

Despite these considerations, tethering your laptop to your iPhone does have benefits. For the occasional cafe that lacks Wifi, the iPhone would likely have a strong signal, and thus provide a decent connection without extra cost.

I Don’t Think Netshare Is Coming Back to the App Store

You may heard of nullriver’s application “netshare” which made a brief debut on the App Store only to be removed by Apple a few days later. According to nullriver, netshare allowed one to easily tether the iPhone to a Laptop. It was probably taken down because tethering is in violation of AT&T’s Terms of Service (TOS), the agreement you digitally sign when you get a new account. Having an officially sanctioned application which allows inexperienced users to tether, and therefore break the TOS, isn’t desirable from the carrier’s standpoint. Considering U.S. carrier’s, like AT&T, have tightly controlled the types of things people can do with their phones, I wouldn’t expect this application to be available again on App Store.

An alternative to netshare is provided by this article. It relies on “unofficial” software which we can easily tap into – no doubt you’ve heard the term “jailbreaking” before. Today’s post shows how to tether your iPhone via 3proxy, which is a SOCKS proxy server we can install on any jailbroken iPhone. No cable is required from the laptop to the iPhone as we will use Wifi.

A Word About Jailbreaking

Jailbreaking your iPhone requires a only a little bit of technical savvy, and is mostly foolproof. It does require a bit of nerve to overcome the FUD (”you’ll brick your iPhone”). The truth is that jailbreaking is relatively safe, and tens of thousands of people have done it. The benefit is you can put software you obtain from outside of Apple’s App Store. This let’s you use your iPhone like a tiny Unix workstation (modified FreeBSD). While this will probably not get you any girls (actually, you may lose one or two), the thought of having a tiny Unix workstation in your hip pocket…well, it sends shudders down my spine thinking of it.

I give a link below to the jailbreaking instructions that I followed.

Comparing iPhone Tethering to a Dedicated Laptop Cellular Modem

A dedicated laptop wireless card is far superior to a tethered iPhone both in terms of speed and reliability. If you require wireless access for your laptop on a regular, extended basis, you should probably get the dedicated card. Try to get your work to pay for the monthly charges.

I currently have both an iPhone (AT&T) and a Kyocera KPC650 Wireless PC Card (Sprint). The Kyocera is basically a little cell phone (modem) which plugs into the Type 2 slot on my Mac Laptop. Running a test from my cubicle in Sunnyvale, the iPhone, which shows 3G and full signal strength, gets 150-350 Kbps. The Kyocera laptop card gets about 500-700 Kbps. This speed difference is likely due to the Kyocera card’s dedicated processor.

Differences between using iPhone tethering and a Dedicated Laptop Wireless Card:

  1. The iPhone is about 33% – 50% of the speed of the latest dedicated laptop cellular modem.
  2. Assuming you are already paying for an iPhone, it will cost you about $60 less per month to use tethering, since you don’t have to have a separate cell modem account.
  3. iPhone tethering has many more manual setup steps than the dedicated modem. There are also some problems stemming from independent software components stepping on each other’s toes. This occasionally results in manual steps to remedy the situation.
  4. iPhone tethering requires jailbreaking which is not suitable for most people.
  5. iPhone tethering violates the carrier’s TOS. While the carrier can detect you are doing something fishy, it’s not clear what they would do, especially if one uses tethering sparingly.

An External Keyboard for the iPhone. A Viable Alternative to Tethering?

One of the main reasons to tether your laptop is to use it for work. By “work,” I mean sitting in one place and using the mouse and keyboard to produce things like code, emails, omnigraffle diagrams, documents, and powerpoints. These activities may require special software, and are much easier with a larger screen and keyboard. Some of these do not require special software, but are much harder without a reasonably sized screen and keyboard.

I often need to use my laptop to access remote development computers via ssh. If I had a decent keyboard for the iPhone, I could use ssh from the iPhone (ala jailbreak) and get by with viewing the screen in landscape mode on the iPhone. While the tiny iPhone screen would be a big handicap, I could get by using tools like “screen” to multiplex my single tiny terminal window.

MacAlly was recently promoting a product at Macworld Expo called BTKeyMini, a $100 bluetooth mini keyboard that is supposed to pair with the new iPhone. From the pictures, it looks to be about the size of a folded sheet of paper (8.5″ x 5.5″), which is a decent size for a mini keyboard. A company called avalive is accepting pre-orders for $92. Caveat Emptor – the product was supposed to be available in March and it’s currently August.

Online distributor www.avalive.com has a pre-order page for the BTKeyMini.

Overview Of The Procedure

Here’s an overview of what we are going to do: we’re going to “jailbreak” our phone, which allows us to put non-blessed (by Apple) software on our iPhone, as well as use it as a little Unix workstation (it already is_ one, we just don’t have access to it). Next we’ll setup the iPhone as a SOCKS proxy server. This will allow our iPhone to handle web page requests forwarded from our browser. Then, we’ll configure our Mac Laptop to use the SOCKS proxy (for Firefox). Finally, we’ll configure and turn on the Mac Laptop’s Wifi network sharing mode, which will allow the laptop to connect to the iPhone.

Step 1: Jailbreak your iPhone
There are some good descriptions of how to do this elsewhere, so I won’t repeat them. Before you start, you’ll want to make sure your data is backed up. This automatically happens when you connect your iPhone to iTunes during the syncing process. If you have setup iTunes to manually manage your media (video and audio files), the syncing will not save it and you will need to manually drag and drop again after jailbreaking (jailbreaking will wipe your iPhone clean and restore it). Note that you can always reset your phone back to its original state through iTunes, but manually managed media will have to be done through drag-and-drop.

The jailbreaking process “builds” a new monolithic software image, which is used to replace whatever is on your iPhone. This new image takes the official image provided by Apple, and alters it by adding software to it and making small modifications. One of the programs that is added to your iPhone is the “cydia loader” which allows you to select packages (software bundles), and download and install them to your iPhone.

You may have heard of Installer.app, which is by nullriver, the group with the defunct tethering program I mentioned earlier. As of this posting, Installer.app doesn’t work for 2.0, so the cydia installer is currently the only option. Note that cydia also plays nice with App Store, so you can get apps from both places.

Jailbreaking itself takes a bit of getting comfortable with. After all, you’re resetting the software on your phone. While it is fairly safe, it does require a cool technical head if things don’t fully go according to plan.

Do:

  1. Goto iClarified’s Jailbreaking Instructions and follow them.
Cydia Installer on Jailbroken iPhone

Cydia Installer on Jailbroken iPhone

Since the iPhone is now jailbroken, we can install a terminal program (to access the shell’s command-line), and a SOCKS proxy program (3proxy) in the next step.

Step 2: Install 3proxy and MobileTerminal
3proxy and MobileTerminal are two pieces of software which are not officially blessed by Apple, which is why we had to jailbreak the iPhone. We’ll use the new cydia installer to install 3proxy and MobileTerminal:

Do:

  1. iPhone Home => cydia [icon]
  2. Search [icon bottom right] => type “3proxy” => Select 3proxy => Install [button upper right]
  3. Search [icon bottom right] => type “MobileTerminal” => Select MobileTerminal => Install [button upper right]

Installing MobileTerminal puts a new icon on the iPhone called “terminal”. This program gives us access to a command-line for launching programs. 3proxy has no icon associated with it, and therefore must be launched from terminal. 3proxy is a SOCKS server which will listen, by default, on port 1080 for incoming connections. Later, our browser will connect to the iPhone through this proxy.

MobileTerminal Installed.  3proxy is installed but has no icon.

MobileTerminal Installed. 3proxy is installed but has no icon.

Step 3: Create An Ad Hoc Wifi Network On The Mac Laptop

Mac Laptop’s have a feature which peer-to-peer (ad hoc) connection over Wifi, thus eliminating the need for a network switch or router. Since we’ll have to flip to this configuration whenever we need to use tethering, we’ll create a network “Location” on the Mac. Locations are preset network configurations that can enabled by a drop-down selection.

Our new network location, which we’ll call “tethering”, will have static IP settings for the Mac Laptop’s Airport. This will consist of setting a static IP and netmask for Airport. We won’t fill in settings for the router, otherwise our iPhone might try reaching the Internet over the Airport, and disable 3G. Neither will we setup a DNS, since DNS requests will get routed through our SOCKS proxy.

Do:

  1. Mac Laptop => System Preferences [docked icon] => System Preferences [window]
  2. Network [icon] => Location [dropdown] => New Location… [submenu] => type “Tether”
  3. Show [dropdown] => Airport [menu choice] => TCP/IP [tab]
    1. Configure IPv4: => Manually [menu choice]
    2. IP Address: => type “192.168.0.208″
    3. Subnet Mask: => type “255.255.255.0″
    4. Leave all the rest blank

Note that I’ve chosen to use a Static IP setup rather than DHCP for simplicity. DHCP should work, but it’s easier to make things static so that the IPs don’t change and negate the setup (e.g. if the iPhone’s IP changes, you’ll need to change the proxy settings in the Laptop).

Also, I’ve chosen the IPs 192.168.0.208 and 209. These make sense for my home network, but you should use any 192.168.0.xxx IPs that make sense for you (using 208 and 209 will, of course, work).

Static IP Settings for Our New Network Location (Tether)

Static IP Settings for Our New Network Location (Tether)

Note that although there is a “Proxies” tab, we do not set it because it does not work. Apparently Apple has made some changes that render this option useless for our purposes.

We do not set the global SOCKS proxy setting (could not figure out how to make this work).

We do not set the global SOCKS proxy setting (setting the appropriate fields didn't seem to work for me).

Step 4: Select “Tether” Location, Turn on Airport and Internet Sharing

We need to select the “Tether” location we just created, then enable Airport and Internet Sharing.

Do:

  1. Mac Laptop => System Preferences [docked icon] => System Preferences [window]
  2. Network [icon] => Location: Tether [dropdown] => click “Apply Now” button
  3. Mac Laptop => Menu Bar [upper right] => Airport Icon [dropdown] => Turn Airport: On
  4. Mac Laptop => Menu Bar [upper right] => Airport Icon [dropdown] => Open Internet Sharing… => Sharing Window
  5. Sharing Window => Internet Tab => To computers using … => Airport [checkbox]
  6. Sharing Window => Start [button]

You should see a little arrow icon in the middle of the Airport icon (triangle made of wavy lines) indicating sharing is enabled. Note that we did not setup a password for our ad hoc network, but you could easily do this later.

Enable Internet Sharing Over Wifi (Ad Hoc Network)

Enable Internet Sharing Over Wifi (Ad Hoc Network)

Step 5: Have iPhone join the Wifi network

Next we’ll set our iPhone’s IP to a static address. We’ll do this by joining the Ad Hoc Wifi network we’ve previously activated, and then manually set the IP address associated with the network.

Do:

  1. iPhone Home => Settings [icon] => Wi-Fi [selection] => Choose a Network… => Find Wifi Network you Created (should be name of your Laptop) => Select “Static” Tab
    1. IP Address => type “192.168.0.209″
    2. Subnet Mask => type “255.255.255.0″

We now have a little LAN. The iPhone and Laptop are connected by Wifi, and each have a static IP.

Select the Mac Laptop\'s Wifi (an Ad Hoc Wifi Network).

Select the Mac Laptop's Wifi (an Ad Hoc Wifi Network).

We use Static IP address 192.168.0.209 for the iPhone.

iPhone Wifi Static IP Settings

iPhone Wifi Static IP Settings

Step 6: Start the Proxy Server

We’ll now run the 3proxy (SOCKS proxy) from the terminal program’s command-line.

Do:

  1. iPhone Home => terminal [icon] => type “socks [RETURN]” at command-line (the [RETURN] is the return key)

Nothing visible will happen – socks is now running, and when it terminates, we will see the prompt again. It should not terminate unless we force it to, for example, force quitting terminal program, or CTRL-C. Force quit can be performed by holding the iPhone’s Home key down for several seconds, while CTRL-C can be performed in MobileTerminal by a stroke across the screen from bottom left to upper right.

Launching Socks Proxy (3proxy) Program From Terminal Command-Line

Launching Socks Proxy (3proxy) Program From Terminal Command-Line

Step 7: Make sure the iPhone is using 3G and not Wifi for Internet Access

The way to do this is to open iPhone Safari and load any web page (e.g. http://www.yahoo.com). If it tries to use Wifi, it will timeout and switch to 3G (or E). You should see the symbol for the currently active mode (either 3G, E or Wifi symbol) in upper left hand of iPhone display. When the page loads, the iPhone will have switched from Wifi to 3G or E.

Do:

  1. iPhone Home => Safari [icon] => type “www.yahoo.com” => Wait until loads (see 3G or Edge icon).

Step 8: Configure Firefox browser to use SOCKS proxy
On laptop from firefox application.

Do:

  1. Firefox Application => Firefox [menu] => Preferences… [submenu] => Pops up window
  2. Window => Advanced [top icon] => Network [tab] => Configure how Firefox connects to the Internet => Settings… [button] => Drops down dialog
    1. Select => Manual Proxy configuration [radio button]
    2. SOCKS Host: => type “192.168.0.209″ => Port: => type “1080″
    3. Select => SOCKS v5 [radio button]
    4. Note: Everything else should be clear. The socks host IP is the IP of the iPhone we previously set.
  3. Firefox => type “about:config” in address bar => type “dns” in Filter:
  4. Double click on network.proxy.socks_remote_dns until Value = “true”
Firefox Advanced/Network Tab

Firefox Advanced/Network Tab

Firefox Proxy Dialog (for setting SOCKS proxy)

Firefox Proxy Dialog (for setting SOCKS proxy)

Step 9: Surf the Web

You should now be able to pull up a web page from your laptop.

Step 10: Set All Your Config Back To Normal

Remember to turn off Internet Sharing, select the “Automatic” location (or other location besides “Tether”), and set your Firefox preferences back to whatever they were before you manually enabled the proxy (likely “detect settings automatically”).

Gotchas

There were several problems I ran into with the tethered iPhone. The first was that the phone would occasionally get confused and stop using 3G. This could easily be rectified by going to the iPhone’s safari browser and loading a page. Then everything would go back to working. You can detect this problem by looking at the iPhone’s icons if something goes wrong (3G should be displayed).

A second problem was that the MobileTerminal program would sometimes die without warning, taking socks down with it. Starting terminal and lauching socks solved this problem.

Finally, in the area I tested (on a moving Amtrak train from Sunnyvale to Berkeley), iPhone tethering had very high error rates in places with poor reception. My browser has Firebug installed, and it showed a high number of javascript errors on repeated page loads from wordpress.com. This was in contrast to my dedicated card which had no errors. It’s not clear to me why corrupted pages somehow got loaded, but this seems to be the case (javascript which had some missing chars here and there). I’d think the pages would just take longer to load, with TCP/IP retransmitting whatever garbled packets were received, but this was not what I experienced. I’m at a loss to explain this, other than to say the number of errors I had was fairly large, which caused the site to not function properly. It’s quite possible that 3proxy has some bugs under error conditions.

Also, the SOCKS proxy setting in the Network Proxies tab no longer works properly. This is apparently due to changes Apple has recently made.


Bookmark and Share


That’s my blog title and I’m sticking with it.

February 19, 2008

My wife, after reading my first post asked what the blog title “naughty bits” was all about. “What kind of a name is that for a blog?,” she asked, insinuating an audit of my browser history was imminent.

I pointed out that it was the “naughty bits” in one’s code that made it not work so well. Also, since I grew up with sitcoms like “Three’s Company” and reruns of Monty Python, the phrase “naughty bits” seemed so perfect.

Three’s Company was a comedy about two girls and a guy living in the same apartment. The guy, Jack, had to pretend to be gay so that the landlord would allow him to live in a mixed situation. Silly jokes and misunderstandings ensue. The phrase “double entendre” is introduced into the popular culture. Many years later, Susan Sommers, one of the stars of the show, makes a comeback selling “thighmaster” excercisers on late night T.V (even thigh master is a double entendre).

Here’s what wikipedia has to say about “Three’s Company”.

Naughty Bits, is also, of course, a double entendre.

Anyway, it’s too late to change the title. I don’t want to alienate my (2.3) readers, and I like it too much to change. We’re going to press with Naughty Bits.


Command line programs and perl Getopt::Long

February 19, 2008

In Today’s Post

I provide a simple template I use to start every command-line utility I write in Perl. We’ll also make command-line option parsing easy using Getopt::Long, as well as make encapsulated documentation using POD.

Perl, the Swiss Army Chainsaw

Perl is an excellent language for system scripting. There are those who criticize Perl for being “syntactically excessive.” However, as languages evolve expressive power they often become more complicated. Remaining backward compatible requires carrying around a certain amount of syntactic baggage.

I’m pragmatic in that I’d choose a language that was powerful with a few eccentricities over one that was perfect and less useful, or one that had stopped evolving. Languages are a living thing – they need to adapt to changes in the environment or they die.

Perl will always be alive and well because it’s just too damn useful. Larry Wall, the creator of Perl, has described his creation variously as “duct tape for the Web” and a “Swiss Army chainsaw”. Perl’s hallmark is flexibility, which is just what’s required to glue things together that weren’t necessarily designed to be glued together.

In a future post I’ll show you a style of Perl programming that works well for me and provides just the right amount of OOP without going overboard. This is actually simpler to do than you might think.

Read the rest of this entry »


And now for something completely different…

February 14, 2008

I’ve spent a fair deal of time hemming and hawing about writing a blog. As a “member of Generation X,” the idea of blogging is an awkward one. On the other hand, since the average blog has 2.3 readers, I can safely assume that both my brother and mother will forgive me if this blog fails to amuse them (they’ve forgiven so much already).

So here goes. What the heck is this blog about anyway?

I’ve always really enjoyed programming, in spite of the fact that I do an awful lot of it as a professional. A friend and I were talking about writing good code and he mentioned that if I “included good code” in a blog, that people would actually read it. Of course I was intrigued by this incredibly naive sounding idea and had to try it out.

If it turns out to be wrong, all 3.3 of us can have a good laugh and collectively blame Allen.