Tethering your iPhone : Experiences

Update: Nov. 17th, 2008 - PDANet 1.4.0 allows VPN access, however at first look it doesn’t work correctly with VPN Tracker 5.

One of the biggest benefits of my iPhone that I’ve been waiting vainly to try was the ability to tether my iPhone to my laptop so I could access the net from anywhere in case of an emergency - whether it be a server at work or a life or death flash video that isn’t on YouTube. It’s also very worthwhile to note that this will suck your iPhone’s battery faster than anyone would like - for me it lasts about 2.5 hours as both the WiFi and 3G antennae are in heavy use.

It should be noted that all the present options require jailbreaking your iPhone which is not without its caveats and primarily a reason I want an official solution simply because if Apple breaks the jailbreak during an upgrade you’re forced to wait for the iPhone dev team (it’s amazing the work they’ve done) to be able to get a patch out so they can still jailbreak themselves. The good news on this front is the current jailbreak they have is quite resilient as the current jailbreak method they are using can’t be fixed with software. (Although iTunes 8 does look for jailbroken ipsws and tries to stop them). For more details on the jailbreaking process I recommend checking out the iPhone Dev Team’s Blog

PDANet 1.3.3

By June Fabrics PDA Technology Group
Homepage | Available through Cydia

Pros:

  • Very easy to use
  • Very little setup - only need to have the iPhone connect to your laptop’s created wireless network
  • Keeps working even after the iPhone’s screen has turned off.

Cons:

  • Does not work with VPN (deal breaker) - IPSec Passthrough does not work
  • Some Terminal commands do not work - eg. can not ping
  • Can not use your iPhone for anything else without disrupting connectivity.

Using ssh and SOCKS

Sample Instructions | Requires OpenSSH to be installed on your iPhone
Linked are some instructions on how to do this - I’ve done this before as a poor man’s VPN before so it was straightforward.

Pros:

  • Easy setup (as OpenSSH is installed by default when jailbreaking now)
  • Keeps working even after the iPhone’s screen has turned off. Not 100% reliable though.
  • You can still use your iPhone

Cons:

  • For those unfamiliar or comfortable with the Terminal it may be a bit confusing.
  • Does not work with VPN (deal breaker) - IPSec Passthrough does not work

3proxy

Sample Instructions | Available via Cydia

Very similar to simply using the ssh setup - but uses 169.254.x.x and port 1080 for your SOCKS Proxy.

Pros:

  • It works
  • Can still use your iPhone

Cons:

  • Requires more setup (downloading and installing 3proxy).
  • Requires use of Mobile Terminal. The instructions require force quitting Mobile Terminal, but if you added a & at the end of the command you could then run jobs -p when you want to quit, see the process id and type kill PID (where PID is that number that jobs -p gave you).
  • Does not work with VPN - IPSec Passthrough does not work

iPhoneModem zsrelay

Homepage | Part a download for OS X (or use PuTTY on Windows) and part iPhone app on Cydia.

Note: There is another iPhoneModem application by Addition that exists that costs $9.99 and as far as I can tell has nothing to offer that the free options here don’t have.

The Mac application side is only required if you’d like to secure the connection between your computer and the iPhone. It will use ssh to secure the connection between the two to start and then puts WEP on the ad-hoc network created as well to help discourage anybody jumping on to the network. (WEP may not be secure but the network I really doubt is going to be around for longer than a brief period of time).

Pros:

  • Nicest setup
  • You can still use your iPhone
  • Secure connection between your computer and the iPhone

Cons:

  • Harder setup in comparison to other options
  • Advanced Settings on the iPhone has a download counter that appears to reset whenever you leave that page but updates properly once more data is used.
  • As with all these options that just use proxies - VPN (IPSec) is not allowed over SOCKS.
  • Slow setup - and more involved.

NetShare

The original tethering application that was available on the App Store. I opted to not try and install NetShare on my iPhone because even though it’s not publicly available to buy anymore it’s still illegal.

Conclusions

Of the options available iPhoneModem zsrelay is the nicest setup with a good mix of security, ease of use and other features however the easiest to set up and use is hands down PDANet. The unfortunate portion for me is that none of them will allow me to use VPN Tracker to connect to the VPN server at work. Personally I’ll stick with PDANet as it’s the least invasive

Venus T5 : Benchmarks (ZFS versus Hardware RAID)

After trying out ZFS on a handful of fitful USB keys I pulled out the AMS Venus T5 a 5 drive SATA RAID enclosure with an eSATA port for plugging into the computer. The Venus T5 was outfitted with 5 x 7200RPM 1TB Seagate Drives for the test. I was curious as to what the difference would be

RAID 0 setting has them all striped together. The Single Drive results are an average from all 5 drives. To keep in with the previous post I still used date +%s for the timings instead of using the more accurate time command.

Standard Test (5 cycles):

Single DriveHardware RAID 0Software RAID 0ZFS
Sequential Read Speed: 71.542 68.170 66.358 678.275
Sequential Write Speed: 63.107 68.043 64.925 338.702
Random Read Speed: 17.203 21.308 28.053 276.802
Random Write Speed: 29.525 29.634 46.104 505.464

Extended Test (5 cycles):

Single DriveHardware RAID 0Software RAID 0ZFS
Read Speed: 100.501 113.045 125.893 248.304
Write Speed: 90.517 97.360 101.469 299.403
Speeds in MB/sec

As seen in the ZFS test on the USB keys it’s quite obvious that QuickBench 4.0 is useless in benchmarking a ZFS formatted drive in comparison to other formatted drives. ZFS isn’t supported so it isn’t surprising.

As a continuation of a more consistent test we then copied a 903MB file (Xcode 2.5) and a folder of of 1500 0 byte files numerically named.

date +%s; cp ~/Desktop/SpeedTest/xcode.dmg DESTINATION; date +%s;
cp ~/Desktop/SpeedTest/*.txt DESTINATION; date +%s
Single DriveHardware RAID 0Software RAID 0ZFS
Large File Time: 0:36 (~25MB/sec) 0:31 (~29MB/sec) 0:29 (~31MB/sec) 0:41 (~22MB/sec)
Small File Time: 0:01 <0:01 <0:01 <0:01
Measured in seconds. 5 trials, highest and lowest scores dropped and remaining 3 trials averaged.

With much better hardware the actual throughput information is a lot more interesting.

Messing with USB Keys: ZFS Fun and Shenanigans

In the quest to sate my curiosity of the viability of ZFS for replacing hardware RAIDs I gathered a few extra USB keys that were lying around my office in hopes to see just how much of a difference in terms of numbers one can find between a single USB key, a software RAIDed set and the new Zettabyte file system (ZFS) that will be more predominantly shown in Snow Leopard.

I used two identical Kingston DataTraveler 2.0 Media DTI/1GB keys. Key 1 reports 980MB, whereas Key 2 reports 984MB. I had originally 4 keys lined up to use, but the two other keys I had would not format. I am unsure why there is such a difference in reported size, and the two keys that wouldn’t format would both report 970MB.

Because ZFS is a software RAID I was comparing it to the software RAIDs created by Apple’s Disk Utility (Version 11.1 in Mac OS X Leopard 10.5.5). The ZFS installation was the 119 release that was put on MacOSForge on July 23rd, 2008 and is still very much under development as the Mac OS X port isn’t even complete yet.

All test performed using QuickBench’s Standard Test, which is a test that transfers several small files ranging from 4KB to 1MB:

Single DriveRAID 0RAID 1RAID
Concatenation
ZFS
Sequential Read Speed: 11.394 18.487 11.556 11.024 360.927
Sequential Write Speed: 3.386 6.090 3.431 3.750 258.036
Random Read Speed: 11.159 18.167 11.416 10.963 220.398
Random Write Speed: 0.741 0.593 0.608 0.637 423.246
All speeds in MB/sec

Given the insane speed increase seen by ZFS (which I assume is greatly improved by it’s ability to use compression reducing the amount of I/O work) which makes the test sound horribly flawed I redid the test using the Extended Test in QuickBench 4.0.

Extended Test (20-100MB)

Single DriveRAID 0ZFS
Read Speed: 13.892 27.288 65.964
Write Speed: 5.396 9.954 202.043

In this second test we were again getting wildly fast results that didn’t fit with reality - the files divisible by 30 were wildly faster than any other result.

Lastly a very simple copy using the command line copy:

date +%s; cp ~/Desktop/Reverie_Final_Cut2_midres.m4v DESTINATION; date +%s

As a baseline a simply copy on my 5400RPM drive in the MacBook Pro this was done on takes 11 seconds.

Single DriveRAID 0ZFS
Time (seconds): 37 22 11
Measured in seconds. 3 trials averaged.

Caveats: The RAID 1 copy trials ranged from 13 seconds (subsequent trials) to as much as 39 seconds (the first copy). While ZFS was 11 seconds each and every time. Also the commands used are going to be imprecise - if I wanted it to be more accurate instead of easily out by as much as 1 second I would have used the time command.

As a continuation of a more consistent test we then copied a 903MB file (Xcode 2.5) and a folder of of 1500 0 byte files numerically named.

date +%s; cp ~/Desktop/SpeedTest/xcode.dmg DESTINATION; date +%s;
cp ~/Desktop/SpeedTest/*.txt DESTINATION; date +%s
Single DriveRAID 0ZFS
Large File Time: 4:13 2:40 3:10
Small File Time: 0:03 0:01 0:01
Measured in seconds. 3 trials averaged.

So what does this all mean? From the first two tests we can see that ZFS does improve throughput but our standard QuickBench tests aren’t any help of determining how much because of ZFS’ difference in dealing with files giving us consistent odd results. The more practical test of copying an H.264 file and the large file with many small files gave us inconsistent results. There isn’t anything concrete in my non-scientific results but I’m looking forward to Snow Leopard being released and ZFS becoming a full fledged filesystem citizen in the Mac OS - if only because with maturity ZFS might be a faster option for a RAID system.

Tomorrow the same file copying tests will be performed on a 5TB RAID connected to the computer via eSATA for kicks.

LaunchBar Snippets

One of the very first programs I install on any machine I will be spending a good deal of time on is LaunchBar. I am a self confessed LaunchBar whore because of the amount of time it saves me from going down to the Dock or having to find the Applications folder to launch Applications on top of being able to calculate, do web searches and manipulate files just from a few keystrokes.

Here are three snippets I’ve added to my LaunchBar configuration that make my life a bit easier:

Add /Library/CoreServices as a folder to search - it means you can access applications like Screen Sharing and a few other lesser known applications without digging.

Searching Apple Mailing Lists: http://search.lists.apple.com/?q=*&cmd=Search%21&form=extended&m=all&ps=50&fmt=long&wm=wrd&wf=2221&sp=1&ul=

LargeText: x-launchbar:large-type?string=*

Lastly a couple other tips that I keep running up against:

  1. ** allows you to do powers of in the calculator. Not ^.

  2. If you consistently misspell something (eg. LIHGR instead of LIGHR for Lightroom) you can set the abbreviation by typing in something that does bring up the file or application and then press Command-Option-A (Select->Assign Abbreviation with the mouse) and then type in the misspell that you keep typing.

build_hd_index

I came across a process running on my iMac at home tonight that was consuming a fair chunk of RAM, and a consistent 40-50% of my CPU while accessing each and every hard drive I have hooked up. The process in question is called build_hd_index and is part of Apple’s built in Remote Management software in OS X.

The specific file can be found in /System/Library/CoreServices/RemoteManagement/ as part of ARDAgent.app (ARDAgent.app/ Contents/Support/build_hd_index) and is used by the program (Apple Remote Desktop Agent) to build user and applications reports to be sent back to Remote Desktop Admin (an Apple program for managing multiple computers that is awesome). The reason this was even turned on was that as part of an attempt to get a VPN server working I added my home computer to Remote Desktop Admin on my work computer. By default (as it’s set in my preferences and I believe always default) it will gather reports on certain data which run at midnight in order to cache the data on the computer running Remote Desktop Admin so you don’t have to requery such information every time you wish to look at it.

A quick Google search on build_hd_index showed several other people having issues with it suggesting ways to neuter the process (which would break System updates) or other attempts to disable it.

To turn it off, on every computer running Remote Desktop Admin you need to tell it to stop collecting data (Get Info on the computer) or you can force this by removing the plist file in charge of ARDAgent at /Library/Preferences/com.apple.ARDAgent.plist . More of this is covered in detail in Apple’s KBase article.

So as of a result, since my work computer is a laptop and is not on, let alone at work at midnight I’ve turned off uploading information at scheduled intervals - however I still want my work computers to cache the data as the information is useful to debugging why something may be happening.

WebKit Nightly Update Script

This is a repost of a much older post that was lost when I transitioned from Moveable Type 3 to 4.

I personally like using WebKit nightlies as my main browser as it’s more or less Safari with a better, faster, and much more current rendering engine underneath it. That and the gold logo looks much better than the silver. It does have bugs occasionally (for example I was unable to post comments to Flickr with WebKit nightlies for a couple weeks) but all in all the experience is very positive. This is the script I use to keep WebKit updated whenever it bugs me for an update. I use an alias in my .bashrc file so I can just type ‘wkupdate’ to run the shell script. The best part is that if I copy it and I’m still using the program the changes won’t take effect until I restart but it allows me to copy it still. (Not advisable however)

#! /bin/bash

#Find current revision
currentRevision=`cat /Applications/WebKit.app/Contents/Resources/VERSION`

#Get address
#Download start page and find address
address=`curl -s http://nightly.webkit.org/start/trunk/$currentRevision | grep 'WebKit-SVN-r[0-9]*' -o | head -n 1`

#Abort if there is no update
if [ "$address" == "" ]
then
	echo "There is no update for WebKit available"
	exit
fi

#Append download address
address='http://nightly.webkit.org/files/trunk/mac/'${address}'.dmg'

echo "Downloading... $address"
curl -s $address -o /tmp/WebKit.dmg
#Mount Image
hdid -readonly -quiet /tmp/WebKit.dmg

echo "Copying..."
#Copy to Applications
revision=`cat /Volumes/WebKit/WebKit.app/Contents/Resources/VERSION`

cp -RfL /Volumes/WebKit/* /Applications/ 2>/dev/null
ls /Volumes/WebKit/

echo "Cleaning up..."
#Clean up
hdiutil detach /Volumes/WebKit/ -quiet
rm -rf /tmp/WebKit.dmg

echo "Finished. (r$revision)"

EDIT: Updated 12/30/08 - Fixed URL check. Realistically you should be looking for the latest source at the link below:

As always this script can be found in my git repository on GitHub.

Opening/Copying Locked DVDs

At work we sometimes receive DVDs that we need footage off of that are locked. They will play back fine in DVD Player but we don’t want it for playback. The resulting DVD images are always titled SONATA_VOLUME and are created by a stand alone Sony DVD Recorder.

In order to copy the VIDEO_TS file off of the DVD you require sudo access but given that sudo access is limited to administrators (and not the editors) - this gets to be a bit of hassle because I have to be called to copy the DVD which adds unnecessary overhead to just get some footage off a simple DVD.

The solution? Create a droplet application (in this case AppleScript with shell scripts) so the editors don’t have to disrupt their workflow to get me to unlock the footage they need.

The source follows:

(* Files dropped onto the application will be copied to the root folder
of the main hard drive and set so the user has ownership - allowing 
them to move, rename and delete said file/folder. *)
on open files_
	repeat with file_ in files_
		--Get name of file, path, and the current username of editor
		set name_ to name of (info for file_)
		set file_ to POSIX path of file_
		set username_ to short user name of (system info)
		(* The 3 shell commands here can be condensed into one longer line
			but I left them separate for debugging and readability reasons
		*)
		do shell script "/bin/cp -R " & quoted form of file_ & " /" & quoted form of name_ user name "ADMIN_USER_NAME" password "PASSWORD" with administrator privileges
		do shell script "/bin/chmod -R 777 /" & quoted form of name_ user name "ADMIN_USER_NAME" password "PASSWORD"" with administrator privileges
		do shell script "/usr/sbin/chown -R " & username_ & " /" & quoted form of name_ user name "ADMIN_USER_NAME" password "PASSWORD"smoke@#$" with administrator privileges
		do shell script "open /"
	end repeat
end open

The Move To WordPress

After much (okay very little) persuasion from Matt and coincidentally a well written breakdown on how he has set up his WordPress installation I’ve pulled the trigger and installed WordPress. The installation replaces my MT4.1 installation that languished under the wait for me to find some time to design the new blog and accompanying photo blog on mcjones.ca. I had even got so far I had it written it out and sketched in a notebook. Finding the time to sit down and actually code it however never came to pass as when I did make time it was the last thing I felt like doing.

So please bear with some minor growing pains as I decide and modify a theme for WordPress - I’d still love to go with the design I made but since that is never going to come to fruition I should move and start creating articles that interest me.

kCFErrorDomainCFNetwork: 302

After seeing this error popping up a lot while having issues with my internet connection dropping packets left and right I searched CFNetworkErrors.h for what the error code meant (since Google didn’t say much other than it appeared in 10.5.3). The line in question is: kCFErrorHTTPConnectionLost = 302,

So if you get kCFErrorDomainCFNetwork: 302 errors, it’s because the HTTP connection was lost somewhere along the way. As to what causes it can really definitely seem like voodoo.

Tab Count to Growl for Safari

The following AppleScript snippet figures out how many tabs are open in the frontmost window and spits it out to Growl. Helps when I don’t feel like counting how many tabs I’ve opened in WebKit/Safari. Note: To get this to work with Safari change WebKit to Safari.

tell application "WebKit"
    activate
    set numtabs to index of last tab of front window
    tell application "GrowlHelperApp"
        set the allNotificationsList to {"Number of Tabs"}
        set the enabledNotificationsList to {"Number of Tabs"}
        register as application "Growl AppleScript Sample" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "WebKit"

        notify with name "Number of Tabs" title "Number of Tabs" description "" & numtabs application name "Growl AppleScript Sample"
    end tell
end tell