<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-2757408430207485368</atom:id><lastBuildDate>Tue, 23 Dec 2008 01:58:34 +0000</lastBuildDate><title>tralfamadore.com</title><description>Hacking, iPhone, iPod Touch, Java, Jocstrap, Apple, Developer, Open Source, LBS, Location Sharing, Locatable, Geolocation</description><link>http://www.tralfamadore.com/</link><managingEditor>noreply@blogger.com (Wesley)</managingEditor><generator>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-6473415440774785228</guid><pubDate>Tue, 23 Dec 2008 01:49:00 +0000</pubDate><atom:updated>2008-12-22T17:58:34.859-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>webapp</category><category domain='http://www.blogger.com/atom/ns#'>locatable</category><title>Turf Bombing on your iPhone</title><description>The creator of &lt;a href="http://turfbombing.com/"&gt;Turf Bombing&lt;/a&gt; emailed to let me know this creative web application now supports iPhones with Locatable installed.  This is a great concept that blends real locations with a virtual game that can be played on both laptops and mobiles.  (And you'll probably have an advantage playing on an iPhone with GPS, as WiFi-based locations are often far less accurate.)&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here's a brief description of the concept:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="color: rgb(96, 96, 96);   font-family:Helvetica;font-size:9px;"&gt;&lt;div id="chat" style="height: 100%; padding-top: 1px; padding-right: 7px; padding-bottom: 7px; padding-left: 7px; "&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;blockquote&gt;Turf Bombing is a location-based turf battle game which rewards and encourages traveling and learning about different neighborhoods. &lt;br /&gt;&lt;br /&gt;Gangs are assigned by the zip code of your home address. The goal of each gang is to gain as much territory as possible. &lt;br /&gt;&lt;br /&gt;Territories are acquired as players plant time bombs at different locations in physical space. If the bomb is not diffused by a local gang member in time, the bomb will explode and the territory will be turned over to the gang that planted the bomb. &lt;/blockquote&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</description><link>http://www.tralfamadore.com/2008/12/turf-bombing-on-your-iphone.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-5190091336807514442</guid><pubDate>Tue, 23 Dec 2008 01:32:00 +0000</pubDate><atom:updated>2008-12-22T17:46:39.517-08:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>relocatable</category><category domain='http://www.blogger.com/atom/ns#'>fireeagle</category><category domain='http://www.blogger.com/atom/ns#'>locatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>FireEagle + Relocatable</title><description>Last month I was fortunate enough to see a presentation at Google headquarters UK from Yahoo!'s FireEagle team, part of the inaugural location-based developer meetup session.  (That's right, not only did Google let Yahoo!s in the building, they even gave them food and drink -- of course, we all had to sign an NDA to get into the meeting room, presumably so we wouldn't wander about jotting down random scrawlings on people's whiteboards).  As you might know, FireEagle is a permission-based location storage service.  It's sort of like a depot where you can save your most recent location, and allow other (FireEagle-enabled) web sites and services to access it.  They are apparently close to launching a Facebook application, for example, that lets you locate anyone in your friends list who has a FireEagle account.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are several FireEagle-related apps in the AppStore but they also suffer from the Apple restriction of not being able to run in the background, a condition that can only be avoided on a jailbroken phone.  This is exactly the scenario that got me to write the Relocatable application in the first place, and sadly, it's not one that is likely to be resolved soon.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For those of you who are interested in always-on updates to FireEagle via your iPhone, Robbie over at BaseX.be &lt;a href="http://basex.be/content/2008/11/iphone-fireeagle-facebook"&gt;has a recipe for you&lt;/a&gt;.  He goes through the full process, including jailbreaking, installing Locatable/Relocatable, and setting up some python scripts to send your location data to FireEagle automatically.  Good stuff!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Speaking of FireEagle, I'd love to see a web-only solution also, using the W3C API and Locatable.  This would be more of an on-demand app, e.g. a bookmark for iPhone Safari that when loaded would save your current location.  Any takers?  Let me know and I'll put a link up here.&lt;/div&gt;</description><link>http://www.tralfamadore.com/2008/12/fireeagle-relocatable.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-8077560005753220315</guid><pubDate>Mon, 22 Sep 2008 21:37:00 +0000</pubDate><atom:updated>2008-09-22T15:15:45.198-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>schema migration</category><category domain='http://www.blogger.com/atom/ns#'>javascript database</category><category domain='http://www.blogger.com/atom/ns#'>gears</category><title>Schema migration with Safari's Javascript Database</title><description>Locatable relies on Safari's SQLite-based Javascript database implementation for its client-side data storage.  As anyone who has worked with Gears or similar technologies can attest, this is pretty slick stuff.  The only thing that's been hard for me to get used to is the callback/closure paradigm for dealing with asynchronous query results (really? they couldn't make a synchronous method for selects?)  Coming from a more linear JDBC (and before that, though it pains me to say it, ODBC... and before that, Oracle Pro*C... the list goes on...) aesthetic, I have to say the code ends up looking a bit pasta-ish.  But it works.&lt;br /&gt;&lt;br /&gt;What Safari has not yet provided, though, is any semantics around schema migration.  It's easy to create and drop tables from code, and to add (but not delete) columns from existing tables (subject to the usual constraint checking).  The openDatabase command lets you specify a version number, but it's not particularly useful; its only impact is to throw an exception if you try to open a database while specifying a different version than then one it was created with.&lt;br /&gt;&lt;br /&gt;Which means it's down to application code to handle upgrades that require schema modifications.  One way to do this would be to have a table with a row that specifically tracks the version number or code.  I'm guessing this is how &lt;a href="http://m.ac.nz/gearshift/"&gt;Gearshift&lt;/a&gt; works for Google Gears.  When starting up, you could query this; if it doesn't exist, you're running for the first time, otherwise you could apply the right schema mods.&lt;br /&gt;&lt;br /&gt;But that's too much work (for someone as lazy as me).  Fortunately, JSDB does include transactions, and of course a transaction will bomb out if it gets an error.  So if all you want to do is make sure you get the user upgraded to the latest schema, an easier way looks something like this:&lt;br /&gt; in your initialization function:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;var db = openDatabase('mydb', '1.0', 'mydb', 65536);&lt;br /&gt;&lt;br /&gt;db.transaction(function (transaction) {&lt;br /&gt;    transaction.executeSql(&lt;br /&gt;      "CREATE TABLE version001 (id integer primary key)",&lt;br /&gt;      []);&lt;br /&gt;    // Do table creation required for version 001&lt;br /&gt;   transaction.executeSql("CREATE TABLE mytable ...", []);&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;db.transaction(function (transaction) {&lt;br /&gt;    transaction.executeSql(&lt;br /&gt;      "CREATE TABLE version002 (id integer primary key)",&lt;br /&gt;      []);&lt;br /&gt;    // Do schema migration to version 002&lt;br /&gt;    transaction.executeSql("ALTER TABLE mytable ..."), []);&lt;br /&gt;});&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And so on.&lt;br /&gt;&lt;br /&gt;When this runs, the create table statements for dummy tables version001 and version002 act like assertions: the transaction fails (and the rest of the SQL statements within it are skipped) if the table already exists.  (It's not strictly necessary to have the version001 table in this example, as the create table line for "mytable" has the same effect; it's just there for clarity).  If a user has a version001 table, the code skips to the version002 piece.  You can put inserts, updates, and so on in there, none of which will have any effect unless it's the first run through (be careful of other side effects, though; Javascript variables have no transaction boundaries).&lt;br /&gt;&lt;br /&gt;Doubtless there are other (and perhaps better) ways of doing this; this one certainly has the time drawback of testing against each version dummy table, which could get slow if you have a lot of versions to check through.  If you only have a few, it's probably just as fast as (and a lot less complicated than) asynchronously handling a callback that tells you what version number you're at, and going from there (in which case you'd need all the same code, just broken into a bunch of different functions).&lt;br /&gt;&lt;br /&gt;(And yes, this does mean that altitude, horizontal accuracy and vertical accuracy will be part of the schema in the next release of Locatable!)</description><link>http://www.tralfamadore.com/2008/09/schema-migration-with-safaris.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-7043381929315299690</guid><pubDate>Mon, 01 Sep 2008 17:41:00 +0000</pubDate><atom:updated>2008-09-01T11:02:07.268-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>roadmap</category><category domain='http://www.blogger.com/atom/ns#'>geolocation</category><category domain='http://www.blogger.com/atom/ns#'>gps</category><category domain='http://www.blogger.com/atom/ns#'>locatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>Locatable roadmap and feature planning</title><description>I thought I'd give an update on where I'm going with Locatable and I'd love to hear feedback or suggestions for new functionality.&lt;br /&gt;&lt;br /&gt;I've just tested a better technique for saving data to the client-side database from the Locatable application which means that the app itself should not need any network connectivity.  This is good news as there's a risk of settings becoming unsynchronized between the app and the database the way it's working right now (e.g. if the connection fails).  This means rewriting all the preferences-saving and preferences-loading code and won't have any visible effect on the UI.&lt;br /&gt;&lt;br /&gt;Preferences anyway are about to get more complex.  Now that Locatable is tracking per-site preferences (so you can choose to only be prompted once or twice per site to share location), there needs to be a UI to see what sites are currently in the list and manage their individual settings.  I'm thinking of it a lot like the cookie manager in Firefox &amp;mdash; you should be able to blacklist and whitelist individual sites that you visit, as well as alter their settings individually.  So that's the task for Locatable 0.4.&lt;br /&gt;&lt;br /&gt;The other item on the TODO list requires a schema upgrade, which is why I've been procrastinating on it.  It would be good to store the horizontal accuracy of the reading so this can be shared (via the W3C API and redirector).  It would be nice to have altitude and vertical accuracy as well, though I'm not sure if these even work (certainly not on an iPod Touch!).&lt;br /&gt;&lt;br /&gt;Once those are in there, the plan is to submit to the AppStore.  If accepted, the only difference between the jailbroken version and the AppStore one will be the inclusion of Relocatable, which of course won't work.  (I won't be discontinuing development on it, but it &lt;span style="font-style: italic;"&gt;may&lt;/span&gt; become its own package in Cydia.)&lt;br /&gt;&lt;br /&gt;In the meantime I'm open to suggestions on other functionality that should be included.  Primarily what I've been hearing about is people using Relocatable to do their own lojack-type apps.  I'd really like to get some feedback on using Locatable on your web sites to integrate positioning data, do maps mash-ups, and so on.  Private feedback is fine, public is even better (and I'll be happy to put links on the Featured Sites page).</description><link>http://www.tralfamadore.com/2008/09/locatable-roadmap-and-feature-planning.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>14</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-69016923789283266</guid><pubDate>Fri, 29 Aug 2008 22:54:00 +0000</pubDate><atom:updated>2008-08-29T16:08:59.357-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>iphone</category><category domain='http://www.blogger.com/atom/ns#'>pwnage</category><title>The plunge</title><description>... I've taken it.  Over the next 18 months, I will pay O2 UK £664 (plus the £159 I laid down at the Apple Store today) for the privilege of owning an iPhone 3G.  When I look at it that way it seems, um, a lot, but as I can remember the time when I was paying £15/mo. for a bundle of 5 &lt;span style="font-style: italic;"&gt;megabytes&lt;/span&gt; of data access (that was 2002, on Orange, if memory serves), I guess I can see the bright side of an unlimited data plan.&lt;br /&gt;&lt;br /&gt;As you might expect, the first step before syncing music and photos was Pwnage.  Can't wait to try some of the iPhone-specific apps out there, particularly Saurik's new video recorder.  Oh, and to see how Locatable works in the field using actual GPS.&lt;br /&gt;&lt;br /&gt;One annoyance: I couldn't get PwnageTool (the latest, 2.0.3.1) to add in a custom boot image.  I wanted to get the classic multicolor Apple image on there, but every time I went to add it, the tool crashed.  Oh well &amp;mdash; next upgrade.</description><link>http://www.tralfamadore.com/2008/08/plunge.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-3663763846909999374</guid><pubDate>Thu, 28 Aug 2008 00:43:00 +0000</pubDate><atom:updated>2008-08-31T09:21:17.104-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>javascript</category><category domain='http://www.blogger.com/atom/ns#'>api</category><category domain='http://www.blogger.com/atom/ns#'>w3c</category><category domain='http://www.blogger.com/atom/ns#'>geolocation</category><category domain='http://www.blogger.com/atom/ns#'>locatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>The W3C Geolocation API on iPhone with Locatable</title><description>I've ported the W3C's draft &lt;a href="http://dev.w3.org/geo/api/spec-source.html"&gt;Geolocation API&lt;/a&gt; so it can be used from an iPhone with Locatable installed (my Javascript skills are far from elite, but with enough prodding and old-school alert() debugging, I got there).  This means that in addition to the &lt;a href="http://www.tralfamadore.com/2008/08/howto-developing-with-locatable.html"&gt;redirect API&lt;/a&gt; (which is nice for embedding static links to pages that can take lat/long coordinates), you can now get at location information on demand via Javascript, through what is likely to become the standard API in future browsers.&lt;br /&gt;&lt;br /&gt;To use it, just include this in your HEAD:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;script type="text/javascript"&lt;br /&gt;src="http://lbs.tralfamadore.com/w3c-api.js"&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can &lt;a href="http://lbs.tralfamadore.com/w3c-api.js"&gt;download&lt;/a&gt; and install the script locally if you like (but please check back for new versions from time to time).&lt;br /&gt;&lt;br /&gt;Then, to use it, just use the standard W3C-prescribed approach via a global object called &lt;code&gt;Locatable&lt;/code&gt;, e.g.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;// Callback handler&lt;br /&gt;function gotLocation(position) {&lt;br /&gt;alert('You are at (' + position.latitude + ','&lt;br /&gt; + position.longitude + ').');&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Use this anywhere you like&lt;br /&gt;Locatable.getCurrentPosition(gotLocation);&lt;/pre&gt;The only addition to the W3C API is an &lt;code&gt;isEnabled()&lt;/code&gt; method.  This will attempt to figure out if the API will work on the current browser.  Right now this merely checks if someone is on an iPhoneOS device, but might be more sophisticated in the future.&lt;br /&gt;&lt;br /&gt;There's a test page up at &lt;a href="http://www.tralfamadore.com/test-w3c.html"&gt;http://www.tralfamadore.com/test-w3c.html&lt;/a&gt; that demonstrates this functionality.&lt;br /&gt;&lt;br /&gt;Some implementation notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The same logic applies when sharing location as with the redirector.  Depending on user preferences, an alert will ask them to confirm if they want to share their location.  If they decline, you'll get an error callback if you provide the second argument to getCurrentPosition.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;If the location needs to be refreshed, the app will launch, update the reading, and then return to Safari.  This can take some time (in Locatable 0.3, up to 20 seconds, depending on the user accuracy setting).  On jailbroken phones with default Locatable settings this is unlikely to occur as the daemon will be updating location in the background, but an AppStore version will not have this advantage, so be mindful of this.&lt;/li&gt;&lt;li&gt;W3C PositionOptions (the accuracy hint) does nothing at the moment.&lt;/li&gt;&lt;li&gt;watchPosition() is "implemented" (that is, the function exists), but you'll only ever get one reading, so it's not entirely useful.&lt;/li&gt;&lt;li&gt;The accuracy reading in the position object is currently the user-set minimum accuracy level (a round number like 10, 100, or 1000 meters), not the device-reported accuracy of the reading itself.  This is likely to change in future versions.&lt;/li&gt;&lt;li&gt;Altitude and velocity are not implemented yet and yield null values.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;w3c-api.js will attempt to detect if you're running an iPhone or iPod Touch and not install itself otherwise.  It also won't overwrite navigator.geolocation if it's already implemented (non-null).&lt;/li&gt;&lt;li&gt;It probably goes without saying, but you should include the w3c-api.js script on every page you want to use it in.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;I'd consider this a beta version — I've done some basic testing but haven't tried too many use cases.  Let me know how it works for you in the comments.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update (31 Aug 08):&lt;/span&gt; Upon some reflection, I decided it's best not to try to automatically install as the &lt;code&gt;navigator.geolocation&lt;/code&gt; global, so the script has been updated to use a global called Locatable (capital L) instead.  You're free to assign it to navigator yourself (i.e. &lt;code&gt;navigator.geolocation = Locatable&lt;/code&gt;).  Also added the &lt;code&gt;isEnabled()&lt;/code&gt; method.</description><link>http://www.tralfamadore.com/2008/08/w3c-geolocation-api-on-iphone-with.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-7223849934067970163</guid><pubDate>Wed, 27 Aug 2008 00:06:00 +0000</pubDate><atom:updated>2008-08-30T05:26:48.585-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>relocatable</category><category domain='http://www.blogger.com/atom/ns#'>geolocation</category><category domain='http://www.blogger.com/atom/ns#'>changelog</category><category domain='http://www.blogger.com/atom/ns#'>locatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>Changelog for Locatable 0.3</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.tralfamadore.com/uploaded_images/locatable_screenshot_0_3-764539.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://www.tralfamadore.com/uploaded_images/locatable_screenshot_0_3-764535.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I'm just about to submit the new version of Locatable.  Here are the changes:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Locatable&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;More accurate GPS readings.  When retrieving a location, wait until the accuracy is within the specified range, or 20 seconds, whichever comes first (i.e. if you set it to "Best", it'll spend the full 20 seconds).&lt;/li&gt;&lt;li&gt;New option "Expire after" specifies how stale of a location is allowed to be sent to web sites.  Default is 10 minutes.  If you set this to "each request", Locatable will pop up every time a web site wants to read your location.&lt;/li&gt;&lt;li&gt;New option "Ask permission" defines if and how many times you'll be prompted to allow a site to see your location.  Default is to always ask.  Set this to "Twice per site" to mimic the behaviour of iPhone native apps.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Relocatable&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Relocatable is now a daemon process.  You can control how often and how fast it runs by editing /System/Library/LaunchDaemons/com.tralfamadore.locatable.plist.&lt;/li&gt;&lt;li&gt;You can also run it from the command line (it now lives in /usr/libexec/relocatable), which gives you the following options:&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;~ root# /usr/libexec/relocatable/Relocatable -h&lt;br /&gt;Usage: Relocatable [-v] [-t SECONDS] [-d SECONDS] [-e CMD]&lt;br /&gt;-d SECONDS      run as a daemon, delay specified seconds between fixes&lt;br /&gt;-e CMD          execute given program (with args) after each location fix,&lt;br /&gt;                 can include @lat@, @long@, and @hacc@ tokens&lt;br /&gt;-t SECONDS      spend specified seconds waiting for a fix, default 30&lt;br /&gt;-v              turn on verbose logging&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;Let me know if you encounter any issues.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update (30 Aug 08):&lt;/span&gt; A few people had questions about getting the command execution piece to work.  Here's an example &amp;mdash; the important bit is to wrap the whole command in single quotes, otherwise the shell gets confused.&lt;br /&gt;&lt;br /&gt;First, if Relocatable is already running as a daemon (it will be by default), you need to stop it:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;~ root# launchctl unload /System/Library/LaunchDaemons/com.tralfamadore.locatable.plist&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Once that's done, you can run Relocatable as a one-off from the command line:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;~ root# /usr/libexec/relocatable/Relocatable -v \&lt;br /&gt;&gt; -e 'curl "http://my.site.com/savepos.pl?lat=@lat@&amp;amp;long=@long@&amp;amp;acc=@hacc@"'&lt;br /&gt;Opened LBS database for read...&lt;br /&gt;Started updates...&lt;br /&gt;newLocation: &lt;+51.xxxxxxxxx, -0.xxxxxxxx&gt; +/- 93.21m @ 2008-08-30 13:17:44 +0100&lt;br /&gt;newLocation: &lt;+51.xxxxxxxxx, -0.xxxxxxxx&gt; +/- 93.21m @ 2008-08-30 13:18:29 +0100&lt;br /&gt;Stopped updates&lt;br /&gt;Opened LBS database for write...&lt;br /&gt;* About to connect() to my.site.com port 80 (#0)&lt;br /&gt;*   Trying xxx.xxx.xxx.xxx... connected&lt;br /&gt;* Connected to my.site.com (xxx.xxx.xxx.xxx) port 80 (#0)&lt;br /&gt;&gt; GET /savepos.pl?lat=51.xxxxxxxxxx&amp;amp;lng=-0.xxxxxxxxxxxx&amp;amp;acc=93.21 HTTP/1.1&lt;br /&gt;&gt; User-Agent: curl/7.17.1 (arm-apple-darwin9) libcurl/7.17.1 OpenSSL/0.9.8g zlib/1.2.3&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note the use of the single quotes (to bracket the command passed to Relocatable) and double quotes (to bracket the URL, so it can contain characters that would otherwise confuse the shell, like the ampersand).&lt;br /&gt;&lt;br /&gt;The same rules regarding quoting apply to editing the daemon plist.  Once you're happy with your settings and have edited the plist to your satisfaction, remember to start it back up:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;~ root# launchctl load /System/Library/LaunchDaemons/com.tralfamadore.locatable.plist&lt;/pre&gt;</description><link>http://www.tralfamadore.com/2008/08/changelog-for-locatable-03.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>19</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-1943529467381845201</guid><pubDate>Tue, 26 Aug 2008 03:19:00 +0000</pubDate><atom:updated>2008-08-25T22:14:06.841-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>javascript</category><category domain='http://www.blogger.com/atom/ns#'>cross-domain</category><category domain='http://www.blogger.com/atom/ns#'>ajax</category><category domain='http://www.blogger.com/atom/ns#'>xss</category><category domain='http://www.blogger.com/atom/ns#'>json</category><category domain='http://www.blogger.com/atom/ns#'>mashup</category><category domain='http://www.blogger.com/atom/ns#'>cross-site</category><category domain='http://www.blogger.com/atom/ns#'>scripting</category><category domain='http://www.blogger.com/atom/ns#'>css</category><title>Xsstc: Cross-site scripting through CSS</title><description>I've been doing a lot of reading on cross-domain scripting approaches.  Generally speaking, the browser is sandboxed by the same-origin policy, and mashups that want to incorporate data from external sites, even if those sites are cooperating, need to provide server-side proxies.  There are a couple of popular workarounds: (1) using the hash (#) portion of the URL, which can be read between frames, and (2) cross-domain JSON, or in other words, directly importing live scripts from a third party site into your own.  Other more fanciful techniques include using the Flash plugin; obviously this fails if you try to run the code on any device without Flash installed, regardless of its Javascript capabilities (the iPhone comes to mind).&lt;br /&gt;&lt;br /&gt;Ideally, a client script just wants to directly invoke a server-side method and get a response back.  Due to popular demand, there's work underway in the standards bodies to make this happen, but it will be a long while before it reaches ubiquity.&lt;br /&gt;&lt;br /&gt;I started to wonder about other pieces of data in the browser that might enable the basic use case, and after some long hours of experimentation, I finally found a way in: externally loaded cascading style sheets (CSS).&lt;br /&gt;&lt;br /&gt;It turns out CSS leaks data in a very subtle way.  Properties set by an external stylesheet (that is, one that is loaded using a LINK REL="STYLESHEET" tag) are used to style the elements of the host page, and at runtime the page can introspect itself to see what styles have been applied.  Most of these tend to be strictly prescribed data, such as background colours for block elements, or some multiple choice items, like left/center/right alignment for text.  While you could conceivably come up with a binary (or ternary) system based on that, it would be a pretty nasty job to try to make those into a general-purpose data channel.  Fortunately, there are a few places where CSS lets you specify essentially free-text attributes: image URLs.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;n.b.: I did a lot of searching on the topic but it was only after I got this technique working that I found the proposal posted by Gideon Lee on the &lt;a href="http://openajax.org/pipermail/communicationshub/2007q3/000183.html"&gt;OpenAjax&lt;/a&gt; mailing list, advocating much the same approach.  I'm not sure if that work is still in progress as the last message on the list dates from October '07, but Gideon deserves credit for coming up with the basic idea.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I chose to work with the background-image attribute, and verified that a location hash for an image URL set in the CSS, though meaningless to the browser, is still visible by introspection via the getComputedStyle() method (currentStyle attributes in IE).  There's some complexity in reliably reading this value, and in dynamically loading stylesheets, but the long and short of it is that on top of this system I've created a cross-browser Javascript library for cross-site requests.&lt;br /&gt;&lt;br /&gt;First, check out the &lt;a href="http://www.tralfamadore.com/test-xsstc.html"&gt;test page&lt;/a&gt; I've set up.    You might want to view source, and also check out the two CSS "response documents" it references.  Then read on for how to do it yourself.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Client&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Using the library is straightforward.  You can get the current version at &lt;a href="http://www.tralfamadore.com/xsstc.js"&gt;http://www.tralfamadore.com/xsstc.js&lt;/a&gt;, or a minified version that's a mere 777 bytes at &lt;a href="http://www.tralfamadore.com/xsstcx.js"&gt;http://www.tralfamadore.com/xsstcx.js&lt;/a&gt;.  Stick it on your server somewhere or feel free to link to the copy here directly.&lt;br /&gt;&lt;br /&gt;On your page, you need the following:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;A SCRIPT tag in the header referencing xsstc.js (or xsstcx.js)&lt;/li&gt;&lt;li&gt;An empty DIV tag in the body with id="Xsstc".  No other attributes required.&lt;/li&gt;&lt;li&gt;Javascript that calls Xsstc.exec(functionURL, callback).  This method loads the specified URL and expects it to be formatted as described below (The Server).  Once it has finished loading, it calls the specified callback function, which takes one argument, the string containing the parsed response.&lt;/li&gt;&lt;/ol&gt;The simplest HTML page looks something like this (using the HelloWorld example from the test page):&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;Xsstc Sample&amp;lt;/title&amp;gt;&lt;br /&gt;&lt;b&gt;&amp;lt;script type="text/javascript" src="xsstcx.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/b&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function showResponse(retval) {&lt;br /&gt;alert('Return value: ' + retval);&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form&amp;gt;&lt;br /&gt;&amp;lt;input type="button" value="Test Me"&lt;br /&gt;onClick="&lt;b&gt;Xsstc.exec('http://lbs.tralfamadore.com/test.css', showResponse)&lt;/b&gt;" /&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;b&gt;&amp;lt;div id="Xsstc"/&amp;gt;&lt;/b&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;The key pieces are &lt;b&gt;bolded&lt;/b&gt; above.  In this example, http://lbs.tralfamadore.com/test.css serves as the server-side endpoint.  Now let's look at...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Server&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The server's job is straightforward.  It receives a normal HTTP GET request, that might have various arguments (these can be encoded in the usual way, via query string parameters, pathinfo, or whatever you like; Xsstc doesn't prescribe the notation), and must respond with a valid CSS stylesheet document.&lt;br /&gt;&lt;br /&gt;The trick is in embedding the method response in the CSS background-image value.  I've found that "about:blank" (which causes the browser to show a blank screen) is a good placeholder value for a background image that the response can then be appended to after the hash (#) character.  If you use a real image URL, it will most likely get loaded by the browser, which isn't really what we want.  The response proper needs to be URL-encoded, as it's, well, part of a URL.&lt;br /&gt;&lt;br /&gt;In order for the client side to read the value that gets set by the stylesheet, it needs to attach to an actual element in the HTML document.  That's why we added the do-nothing DIV called Xsstc.  The CSS simply targets this DIV by its ID, and sets its background image.  So a response document that wanted to embed "Hello World" would look like this:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;#Xsstc {&lt;br /&gt; background-image: url('about:blank#&lt;b&gt;Hello%20World&lt;/b&gt;');&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;Because this response format is so simple, it's easy to create in just about any server-side programming language.  And because of the data seepage inherent in stylesheets, the server can be any site on the Internet that has chosen to expose its services in this way — you're not limited by the same-domain policy the browser applies to other external requests.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Xsstc and JSON&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There's a natural fit between Xsstc and JSON, as one of the examples on the test page alludes to.  I've taken a sample JSON response straight off of &lt;a href="http://www.json.org/example.html"&gt;&lt;/a&gt;&lt;a href="http://www.json.org/example.html"&gt;www.json.org/example.html&lt;/a&gt;, URLencoded it, and slapped it into the Xsstc response format.  This is not to say that Xsstc is dependent on JSON in any way: the Xsstc.exec() method generates a callback that returns whatever string is in the response, however it's formatted.  But JSON is a nice compact way of representing datasets that can be easily worked with in Javascript, so a JSON library on top of the Xsstc communications channel seems like a natural fit.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Compatibility&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is the first release and while I'm sure there will be something broken, I've tested the examples (minimal though they are) on recent versions of Mozilla, Safari and Internet Explorer (IE is of course the worst to work with, but with a little bit of switching logic it seems to be doing well).  It should also work on modern versions of Opera, and hopefully anything else that's W3C compliant.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Limitations&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There are a few limitations that are worth being aware of.  The first is that because the response string needs to be embedded in a URL, some browsers (you know which) are likely to cap the possible length of a response.  While there are ways to work around this (for example, you could split one response into several consecutive method calls), it might mean that Xsstc is overly painful for implementing methods that have a bulky response.&lt;br /&gt;&lt;br /&gt;At the moment the library is also single-threaded, though this can be remedied in time.    This means that only one Xsstc.exec() method can be in progress at a given time, or you're likely to have untoward side effects.  In a similar vein, there's virtually no error-handling going on in the current version, and the script will happily wait until the end of time for a response from a server that might be down.&lt;br /&gt;&lt;br /&gt;Finally, because there's no onLoad event for stylesheet loading, the script is set up to poll for the availability of the response.  In my tests this hasn't caused significant problems (there's a 50ms pause between each check), but sites that have a lot of other activities going on may want to look at how to best tune the performance of the timers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Security&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;My understanding is that you cannot specify javascript: URLs for CSS background-image attributes and expect them to execute, which should mitigate any concerns of remote scripts stealing data.  In the OpenAjax discussion, it was mentioned that on FF2 you can apparently execute javascript in this mode but it runs in a very sandboxed manner, without access to the document object.  Taking a broader view, if there is a vulnerability here, it exists already with the ability to load foreign stylesheets, and will not be something new exposed by Xsstc.&lt;br /&gt;&lt;br /&gt;Because both the client and server systems must cooperate on the request/response cycle, and the Xsstc DIV element is the only item singled out for data transfer, there's very little likelihood of "rogue" code.  In addition, Xsstc doesn't rely on script loading and is therefore naturally immune to the trust issues that plague cross-domain implementations of JSON.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;License&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Xsstc (pronounced, if you'll indulge me, "Ecstasy") is licensed BSD-style.  The relevant text is in the xsstc.js file.  I'm happy to incorporate worthwhile changes and additions — just reply in the comments or email me (my address is wes at this blog's domain).&lt;br /&gt;&lt;br /&gt;As always, happy hacking!</description><link>http://www.tralfamadore.com/2008/08/xsstc-cross-site-scripting-through-css.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>6</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-444173626526763848</guid><pubDate>Sat, 23 Aug 2008 23:07:00 +0000</pubDate><atom:updated>2008-08-23T16:30:25.224-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>statistics</category><category domain='http://www.blogger.com/atom/ns#'>location</category><category domain='http://www.blogger.com/atom/ns#'>international</category><category domain='http://www.blogger.com/atom/ns#'>jailbreak</category><category domain='http://www.blogger.com/atom/ns#'>locatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>Locatable: Some stats</title><description>Locatable has been on Cydia for about a week now, and thanks to BigBoss I can see that there have been over 5,000 downloads (some of these are people upgrading from 0.1 to 0.2, of course).&lt;br /&gt;&lt;br /&gt;I've also done some analysis of the visitors to the Featured Sites page.  First of all, I'm impressed by how far around the globe the jailbroken iPhone has traveled.  Within just the last 12 hours there have been visitors from over 50 countries -- here are the top ones:&lt;br /&gt;&lt;br /&gt;1. U.S. (18%)&lt;br /&gt;2. France (7%)&lt;br /&gt;3. Mexico (7%)&lt;br /&gt;4. Brazil (6%)&lt;br /&gt;5. U.K. (6%)&lt;br /&gt;6. Spain (4%)&lt;br /&gt;7. Canada (4%)&lt;br /&gt;8. Slovakia (3%)&lt;br /&gt;9. Italy (3%)&lt;br /&gt;10. Norway (3%)&lt;br /&gt;&lt;br /&gt;Traffic is overwhelmingly (95%) coming from iPhones as opposed to iPods Touch, as you might expect for an app that is most useful with GPS when you're out and about; on the other hand, so far usage is still fairly evenly split between WiFi and mobile networks.&lt;br /&gt;&lt;br /&gt;In other news: I've got a heavily reworked version of Relocatable just about ready to go that makes it very easy to do the location tracking hack posted previously.  It also does a far better job of getting accurate GPS readings, though it takes a little longer.  I'm working on incorporating the same technique into Locatable and I'd like to start adding some more management preferences, such as the ability to have trusted sites that you aren't continually prompted for (much the same as the way the iPhone works for applications that request to read your location: after a couple of checks, it assumes you're fine with it).  If you have other feature ideas please comment!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;n.b. If you have a working iphone-gcc toolchain installed, the Makefiles are set up so you can build your own copies of Locatable and Relocatable from source now, and the changes mentioned above for Relocatable are checked in.&lt;br /&gt;&lt;/span&gt;</description><link>http://www.tralfamadore.com/2008/08/locatable-some-stats.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-6139979020037785089</guid><pubDate>Sat, 23 Aug 2008 09:53:00 +0000</pubDate><atom:updated>2008-08-23T02:59:39.172-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>java</category><category domain='http://www.blogger.com/atom/ns#'>midp</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>iPhone MIDP status</title><description>I haven't had much time to hack on the MIDP project lately but did put everything I've got in the svn repository now, including the files needed to put a MIDletRunner app on SpringBoard.  The &lt;span style="font-family: courier new;"&gt;README&lt;/span&gt; file that's included should be self-explanatory if you'd like to get a little GUI Java running on your own (jailbroken) device, and it can execute the included HelloWorldMIDlet.  I should note that this is pretty much the &lt;span style="font-style: italic;"&gt;only&lt;/span&gt; MIDlet that is expected to work at this stage.  See previous posts for svn info.</description><link>http://www.tralfamadore.com/2008/08/iphone-midp-status.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-3270523049255462291</guid><pubDate>Thu, 21 Aug 2008 16:52:00 +0000</pubDate><atom:updated>2008-09-01T10:38:59.705-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>server</category><category domain='http://www.blogger.com/atom/ns#'>location</category><category domain='http://www.blogger.com/atom/ns#'>relocatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><category domain='http://www.blogger.com/atom/ns#'>schedule</category><category domain='http://www.blogger.com/atom/ns#'>push</category><title>Location tracking using Relocatable</title><description>"Relocatable" is the location-gathering daemon add-on to "Locatable" (currently they're bundled together for distribution purposes on Cydia; an AppStore version will only contain Locatable as it's not permissible to install daemon processes through the official program).&lt;br /&gt;&lt;br /&gt;Relocatable is set up to run at 10-minute intervals and gather location data in the background.  This means location data is typically available to the browser on a jailbroken phone without having to launch the Locatable app proper.&lt;br /&gt;&lt;br /&gt;Several of you have asked if there's a way to do a scheduled publish of your location to a destination server of your choice based on the data that Relocatable collects.  The answer is a definite yes, and Mike Carambat emailed me the following solution:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-weight: bold;"&gt;Requirements&lt;/span&gt;&lt;br /&gt;1. Jailbroken iPhone&lt;br /&gt;2. Install "Locatable" from Cydia&lt;br /&gt;3. Make sure you have "SQLLite" from Cydia&lt;br /&gt;4. Make sure you have "cURL" from Cydia&lt;br /&gt;5. A server based facility to store the data captured from your phone&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Concept&lt;/span&gt;&lt;br /&gt;Basically, "Locatable" is a springboard app which uses Core Location to capture GPS coordinates. The cool thing about it, is that it stores them in a SQLite database which is then easily accessible. You query this database via the sqlite3 command and pipe its results to cURL which forwards the data to your server.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Instructions&lt;/span&gt;&lt;br /&gt;1. Create a shell script called "pushgps" on your iphone which you will invoke on a periodic basis. Put it in the /usr/bin/ on your iphone.&lt;br /&gt;&lt;br /&gt;This shell script looks like this:&lt;br /&gt;&lt;br /&gt;---------- start ----------&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; #! /bin/sh&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt; curl -d POS="`sqlite3 /var/mobile/Library/WebKit/&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;wbr  style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;Databases/http_lbs.&lt;/span&gt;&lt;/span&gt;&lt;wbr  style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;tralfamadore.com_0/*.db 'select latitude, longitude from location where tag = "Current"'`" &lt;/span&gt;&lt;a style="font-family: courier new;" href="http://www.yourserverhere.com/path_to_gps_recorder" target="_blank"&gt;http://www.yourserverhere.com/&lt;wbr&gt;path_to_gps_recorder&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;----------- end -----------&lt;br /&gt;&lt;br /&gt;(replace the "yourserverhere" and "path_to_gps_recorder" with YOUR server and recording software. (see below for ideas on doing this)&lt;br /&gt;&lt;br /&gt;Don't forget to: &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;chmod 755 pushgps&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;2. Next, create a plist file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; /System/Library/LaunchDaemons/&lt;/span&gt;&lt;wbr  style="font-family:courier new;"&gt;&lt;span style="font-family:courier new;"&gt;com.whatever.pushgps.plist&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;which contains:&lt;br /&gt;&lt;br /&gt;---------- start ----------&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&amp;gt;&lt;br /&gt;&amp;lt;plist version="1.0"&amp;gt;&lt;br /&gt;&amp;lt;dict&amp;gt;&lt;br /&gt;   &amp;lt;key&amp;gt;Label&amp;lt;/key&amp;gt;&lt;br /&gt;   &amp;lt;string&amp;gt;com.whatever.pushgps&amp;lt;/string&amp;gt;&lt;br /&gt;   &amp;lt;key&amp;gt;ProgramArguments&amp;lt;/key&amp;gt;&lt;br /&gt;   &amp;lt;array&amp;gt;&lt;br /&gt;           &amp;lt;string&amp;gt;/usr/bin/pushgps&amp;lt;/string&amp;gt;&lt;br /&gt;   &amp;lt;/array&amp;gt;&lt;br /&gt;   &amp;lt;key&amp;gt;StartInterval&amp;lt;/key&amp;gt;&lt;br /&gt;   &amp;lt;integer&amp;gt;600&amp;lt;/integer&amp;gt;&lt;br /&gt;&amp;lt;/dict&amp;gt;&lt;br /&gt;&amp;lt;/plist&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:georgia;font-size:100%;"  &gt;----------- end -----------&lt;br /&gt;&lt;br /&gt;(replace the "whatever"s with your name, company name, domain, or whatever. This is just an identifier. the 600 refers to every 10 minutes. change if needed. Locatable's interval defaults to 10 minutes, but can be changed as well in its plist file (same directory))&lt;br /&gt;&lt;br /&gt;3. Create software to record the GPS data&lt;br /&gt;&lt;br /&gt;You'll need to post the coordinate data to *somewhere* online. No, I'm not gonna do it for you. Get your own server ;) Maybe the folks at &lt;a href="http://www.instamapper.com/" target="_blank"&gt;www.instamapper.com&lt;/a&gt; would be open at some point to do this for us.&lt;br /&gt;&lt;br /&gt;I wrote a simple perl script called gps.pl which runs on my server which simply records and time/date stamps the data. Something like this:&lt;br /&gt;&lt;br /&gt;---------- start ----------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;&lt;br /&gt;&lt;/tt&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="Ih2E3d"&gt;&lt;tt&gt; #!/usr/bin/perl&lt;br /&gt;# GPS Recorder&lt;br /&gt;&lt;br /&gt;$maxhistory=1000; # Total number of locations to store&lt;br /&gt;&lt;br /&gt;if ($ENV{"REQUEST_METHOD"} eq 'GET') {$buffer=$ENV{"QUERY_STRING"};&lt;wbr&gt;}&lt;br /&gt;else {read (STDIN, $buffer, $ENV{"CONTENT_LENGTH"});}&lt;br /&gt;&lt;br /&gt;@vars=split(/&amp;amp;/,$buffer);&lt;br /&gt;foreach $var (@vars) {&lt;br /&gt;       ($name, $value)=split (/=/,$var);&lt;br /&gt;       $name =~ tr/+/ /;&lt;br /&gt;       $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/&lt;wbr&gt;pack("C", hex($1))/eg;&lt;br /&gt;       $value =~ tr/+/ /;&lt;br /&gt;       $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/&lt;wbr&gt;pack("C", hex($1))/eg;&lt;br /&gt;       chomp($name);&lt;br /&gt;       chomp($value);&lt;br /&gt;       $stuff{$name}=$value;&lt;br /&gt;       }&lt;br /&gt;if (exists ($stuff{'POS'})) {&lt;br /&gt;       ($lat,$long)=split(/\|/,$&lt;wbr&gt;stuff{'POS'});&lt;br /&gt;       chomp($lat);&lt;br /&gt;       chomp($long);&lt;br /&gt;&lt;br /&gt;       &amp;GetDateTime;&lt;br /&gt;    &lt;br /&gt;       open (STUFF, "gpslocation.txt");&lt;br /&gt;       @lines=&lt;stuff&gt;;&lt;br /&gt;       close (STUFF);&lt;br /&gt;&lt;br /&gt;       $numlines=@lines;&lt;br /&gt;       $sp=0;&lt;br /&gt;&lt;br /&gt;       if (($numlines-$maxhistory)&gt;-1) {&lt;br /&gt;               $sp=$numlines-$maxhistory;&lt;br /&gt;               }&lt;br /&gt;       open (STUFF, "&gt;gpslocation.txt");&lt;br /&gt;    &lt;br /&gt;       for ($i=$sp; $i&lt;$numlines; $i++) {                 chomp($lines[$i]); &lt;/stuff&gt;&lt;/tt&gt;&lt;/div&gt;&lt;tt&gt;                 print STUFF "$lines[$i]\n";&lt;/tt&gt;&lt;div class="Ih2E3d"&gt;&lt;tt&gt;&lt;br /&gt;               }&lt;br /&gt;       print STUFF "$date\t$time\t$lat\t$long\n";&lt;br /&gt;       close (STUFF);&lt;br /&gt;&lt;br /&gt;       print "Content-type: text/plain\n\n";&lt;br /&gt;       print "Latitude: $lat\n";&lt;br /&gt;       print "Longitude: $long\n";&lt;br /&gt;       exit(0);&lt;br /&gt;       }&lt;br /&gt;print "Content-type: text/plain\n\n";&lt;br /&gt;print "ERROR";&lt;br /&gt;exit(0);&lt;br /&gt;&lt;br /&gt;sub GetDateTime {&lt;br /&gt;($second, $minute, $hour, $dayofmonth, $month, $year, $weekday, $dayofyear, $isdst) = localtime(time);&lt;br /&gt;$year=($year+1900);&lt;br /&gt;$month++;&lt;br /&gt;$date=sprintf("%02D",$month)."&lt;wbr&gt;/".sprintf("%02D",$dayofmonth)&lt;wbr&gt;."/".sprintf("%04D",$year);&lt;br /&gt;$time=sprintf("%02D",$hour).":&lt;wbr&gt;".sprintf("%02D",$minute).":".&lt;wbr&gt;sprintf("%02D",$second);&lt;br /&gt;}&lt;/tt&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style=";font-family:georgia;font-size:100%;"  &gt;----------- end -----------&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;div class="Ih2E3d"&gt;&lt;span style=";font-family:georgia;font-size:100%;"  &gt;Thanks Mike!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update (1 Sep 08):&lt;/span&gt; While this method still works (and it provides a good example of a server-side script to handle the data), as of version 0.3 Relocatable allows you to specify a command to execute each time a location fix is acquired, so there's no need to use the &lt;code&gt;pushgps&lt;/code&gt; part.  See &lt;a href="http://www.tralfamadore.com/2008/08/changelog-for-locatable-03.html"&gt;this post&lt;/a&gt; for details.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;</description><link>http://www.tralfamadore.com/2008/08/location-tracking-using-relocatable.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-7830991808726250049</guid><pubDate>Tue, 19 Aug 2008 19:48:00 +0000</pubDate><atom:updated>2008-08-19T13:02:47.264-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>release</category><category domain='http://www.blogger.com/atom/ns#'>source</category><category domain='http://www.blogger.com/atom/ns#'>locatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>Locatable 0.2 + source release</title><description>Locatable 0.2 should be out on Cydia soon.  Release early, release often, as they say.  It's a minor release that fixes an issue and adds a feature:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Locatable and its daemon process (Relocatable) would get stuck if the device couldn't get a location fix.  Now it dies gracefully (though this can take a few seconds).&lt;/li&gt;&lt;li&gt;New option in preferences panel to specify how accurate of a location reading to get.&lt;/li&gt;&lt;/ul&gt;I'll also be adding some more options to the redirector, including the ability to test for a Locatable-enabled device without needing to prompt the user to share location.  Stay tuned and your feedback is welcome.&lt;br /&gt;&lt;br /&gt;Also, in the practicing-what-you-preach department, the Locatable and Relocatable applications are available in source form under the GPL in the svn.tralfamadore.com repository.  To check them out using Subversion, try &lt;span style="font-family: courier new;"&gt;svn co http://svn.tralfamadore.com/repos/iphone/locatable&lt;/span&gt; (or &lt;span style="font-family: courier new;"&gt;relocatable&lt;/span&gt;).  I'm not exactly proud yet of my Objective-C skills, so your critiques are probably warranted and indeed you're welcome to contribute!</description><link>http://www.tralfamadore.com/2008/08/locatable-02-source-release.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-3024292332976651684</guid><pubDate>Mon, 18 Aug 2008 16:28:00 +0000</pubDate><atom:updated>2008-08-18T10:11:35.722-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>rest</category><category domain='http://www.blogger.com/atom/ns#'>developer</category><category domain='http://www.blogger.com/atom/ns#'>redirect</category><category domain='http://www.blogger.com/atom/ns#'>locatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>Howto: Developing with the Locatable redirect service</title><description>For the first release of Locatable I've stuck to a very basic HTTP (REST) API.  The idea is that you have a page that can take latitude/longitude coordinates in its URL.  This might be an existing page, or it might be an iPhone-specific entry page that sets up some other variables or session cookies or whatever you might want to do.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Template URLs&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;The basic URL to perform a redirect to your location-enabled page is as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;http://lbs.tralfamadore.com/r?u={myURL}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For this to work, &lt;span style="font-family:courier new;"&gt;{myURL}&lt;/span&gt; needs to be a full absolute URL (including http://) to your page.&lt;br /&gt;&lt;br /&gt;Locatable looks for some special sequences in the URL you provide.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;@lat@&lt;/span&gt; will get replaced with the user's latitude, as a floating point number&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;@long@&lt;/span&gt; will get replaced with the user's longitude, as a floating point number&lt;br /&gt;&lt;br /&gt;If the user hasn't installed Locatable, they choose not to send their location to your site, or the mobile device can't read an accurate location, the template parameters will be replaced by the empty string (that is, they will be stripped out of the URL before the redirect occurs).  You should code your page for this condition.  (Note: I'm looking at adding a parameter so you can check whether the service is enabled to make it easier to detect when you'll have a valid location, but that's not there yet; see below for a way to set a default value.)&lt;br /&gt;&lt;br /&gt;To take an example, the Geocaching web site expects a URL that looks like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;http://www.geocaching.com/seek/nearest.aspx?origin_lat=39.549167&amp;amp;origin_long=-94.329722&amp;amp;dist=100&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To make this into a template URL for Locatable, we simply replace the numbers with the macros described above:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;http://www.geocaching.com/seek/nearest.aspx?origin_lat=&lt;span style="font-weight: bold;"&gt;@lat@&lt;/span&gt;&amp;amp;origin_long=&lt;span style="font-weight: bold;"&gt;@long@&lt;/span&gt;&amp;amp;dist=100&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Encoding the URL&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Because we're going to use it as a querystring parameter to the redirector, make sure to properly encode your templated URL.  Here's how to do it in various languages:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;PHP: &lt;span style="font-family:courier new;"&gt;urlencode($myURL)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Java: &lt;span style="font-family:courier new;"&gt;java.net.URLEncoder.encode(myURL, "UTF-8")&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Javascript: &lt;span style="font-family:courier new;"&gt;encodeURIComponent(myURL) &lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;You get the basic idea.  There's also a little encoder you can cut and paste from on &lt;a href="http://lbs.tralfamadore.com/developer.html"&gt;this page&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;After doing that step on our example URL, it looks like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;http%3A%2F%2Fwww.geocaching.com%2Fseek%2Fnearest.aspx%3Forigin_lat%3D%40lat%40%26origin_long%3D%40long%40%26dist%3D100&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then we just need to add this to the redirector URL, and we're off and running:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;http://lbs.tralfamadore.com/r?u=&lt;span style="font-weight: bold;"&gt;http%3A%2F%2Fwww.geocaching.com%2Fseek%2Fnearest.aspx%3Forigin_lat%3D%40lat%40%26origin_long%3D%40long%40%26dist%3D100&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Take that URL, put it in a HTML href, and you're ready to go!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Defaulting the Location&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you'd rather have some value for latitude and longitude rather than none, you can use the following syntax:&lt;br /&gt;&lt;br /&gt;@lat:defaultValue@ gets replaced by the latitude, or defaultValue if none is available&lt;br /&gt;@long:defaultValue@ gets replaced by the longitude, or defaultValue if none is available&lt;br /&gt;&lt;br /&gt;For example, if we were to start with the same Geocaching URL, but want to default to Charing Cross in London (latitude 51.509, longitude -0.125), we'd use the following template URL:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;http://www.geocaching.com/seek/nearest.aspx?origin_lat=&lt;span style="font-weight: bold;"&gt;@lat:51.509@&lt;/span&gt;&amp;amp;origin_long=&lt;span style="font-weight: bold;"&gt;@long:-0.125@&lt;/span&gt;&amp;amp;dist=100&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Happy (geo)hacking!</description><link>http://www.tralfamadore.com/2008/08/howto-developing-with-locatable.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-4285375812915671034</guid><pubDate>Mon, 18 Aug 2008 08:36:00 +0000</pubDate><atom:updated>2008-08-18T01:51:31.080-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>geolocation</category><category domain='http://www.blogger.com/atom/ns#'>mashup</category><category domain='http://www.blogger.com/atom/ns#'>locatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>Geohacking with Locatable</title><description>Locatable has had well over a thousand downloads in the first 12 hours, so I've just been updating the featured sites to give everyone something to play with.  I haven't yet heard of any "made for iPhone" sites that can take advantage of the latitude/longitude sharing feature of lbs.tralfamadore.com, so for now the links you'll find there are publicly available web sites and services that take lat/long coordinates.&lt;br /&gt;&lt;br /&gt;I used some of the more common online mapping services to test during development, but now that I have a little more time to browse around, I'm finding a lot of interesting things that can be done already:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Geocaching.  Use your iPhone to participate in local treasure hunts.&lt;/li&gt;&lt;li&gt;GeoNames.  Find and identify nearby landmarks.&lt;/li&gt;&lt;li&gt;Panoramio.  Look at photos that have been taken near your location.&lt;/li&gt;&lt;/ul&gt;Here are some things I'd love to see but haven't tracked down yet (even if they don't yet exist as lat/long-enabled URLs, the mashup would be easy to do):  movie listings, traffic reports, friend finder, turn-by-turn spoken driving directions, emergency services finder, shop finder (Apple store, anyone?), and so on. &lt;br /&gt;&lt;br /&gt;Maybe I'll hunt around a little later.  In the meantime, let me know if you have any links to post.</description><link>http://www.tralfamadore.com/2008/08/geohacking-with-locatable.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-6668987219678211709</guid><pubDate>Sun, 17 Aug 2008 21:46:00 +0000</pubDate><atom:updated>2008-08-18T01:57:03.706-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>locatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>Locatable 0.1</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.tralfamadore.com/uploaded_images/locatable_screenshot-796743.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://www.tralfamadore.com/uploaded_images/locatable_screenshot-796741.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Locatable 0.1 is out on Cydia!  If you have a jailbroken 2.0 iPhone, you'll find it in the Utilities section of Cydia.  For more info, check &lt;a href="http://lbs.tralfamadore.com/"&gt;lbs.tralfamadore.com&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I wanted to take a minute to give a quick thank you to some of the people and resources that have helped me get this up and running.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Jay Freeman, a.k.a. saurik, who has built and written more and better software for iPhone development than possibly the collective staff at Apple.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;BigBoss, for hosting the package gratis -- many thanks and highly recommended!&lt;/li&gt;&lt;li&gt;The community at iPhoneDevSDK who post tons of useful examples and answers to coding questions.&lt;/li&gt;&lt;li&gt;Some useful blog entries that helped get me past a few tricky issues:  &lt;a href="http://cafe-babe.blogspot.com/2008/01/handling-date-with-google-gears.html"&gt;Handling Date With Google Gears&lt;/a&gt; (Cafe Babe), &lt;a href="http://dominiek.com/articles/2008/7/19/iphone-app-development-for-web-hackers"&gt;iPhone App Development for Web Hackers&lt;/a&gt; (Dominiek.com)&lt;/li&gt;&lt;/ul&gt;Thanks!</description><link>http://www.tralfamadore.com/2008/08/locatable-01.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-5923155690692211713</guid><pubDate>Fri, 15 Aug 2008 04:42:00 +0000</pubDate><atom:updated>2008-08-18T01:53:09.513-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>loki</category><category domain='http://www.blogger.com/atom/ns#'>location</category><category domain='http://www.blogger.com/atom/ns#'>skyhook</category><category domain='http://www.blogger.com/atom/ns#'>share</category><category domain='http://www.blogger.com/atom/ns#'>geolocation</category><category domain='http://www.blogger.com/atom/ns#'>gps</category><category domain='http://www.blogger.com/atom/ns#'>fireeagle</category><category domain='http://www.blogger.com/atom/ns#'>locatable</category><category domain='http://www.blogger.com/atom/ns#'>iphone</category><title>Sneak peek</title><description>I'm close to a beta release for &lt;a href="http://lbs.tralfamadore.com/"&gt;Locatable&lt;/a&gt;, and I'm excited enough about it that I wanted to give a quick preview, from a tech-centric point of view.&lt;br /&gt;&lt;br /&gt;Locatable is an application and geolocation federation service that let you share your location (GPS coordinates, or any decent facsimile thereof) from your iPhone or iPod Touch to any web site, via the built-in Safari browser.  It takes advantage of the new client-side storage capabilities of Safari to allow some very nice anonymity and privacy features -- notably, the user's location is never stored on the server side, with the service at lbs.tralfamadore.com acting as a gateway to storage on the device.&lt;br /&gt;&lt;br /&gt;There's a lot to say about this and its relationship to similar services such as MyLoki (Skyhook) and FireEagle (Yahoo!).  Both of those could be integrated, as can just about any existing location-based service.&lt;br /&gt;&lt;br /&gt;Anyway, check out the concept and check back for more updates soon.</description><link>http://www.tralfamadore.com/2008/08/sneak-peek.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-8903940819927982078</guid><pubDate>Wed, 13 Aug 2008 22:26:00 +0000</pubDate><atom:updated>2008-08-14T00:49:05.323-07:00</atom:updated><title>Reading location</title><description>The API to read location data from an application is nice and easy.&lt;br /&gt;&lt;br /&gt;However, to help the user know what's going on, the iPhone will prompt for the user to allow an application to see location data, at least the first couple of times it runs.  Interestingly enough, this also happens if an otherwise non-GUI application attempts to read the location.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.tralfamadore.com/uploaded_images/IMG_0002-732726.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://www.tralfamadore.com/uploaded_images/IMG_0002-732488.PNG" alt="" border="0" /&gt;&lt;/a&gt;The application name it puts in quotes is taken from the "CFBundleIdentifier" string in the local directory's Info.plist file.  The program will basically freeze until the alert is dismissed by the user (if the user hits "Don't Allow", the program receives an error on the callback).&lt;br /&gt;&lt;br /&gt;It seems that most location-savvy apps will only cause the OS to prompt the user on the first two consecutive runs.  For a while I thought this wasn't happening for my jailbroken app, but the trick was to ensure that you tell the location manager to stop sending updates.&lt;br /&gt;&lt;br /&gt;The apps that locationd (the system process that exposes location services) has seen seem to be stored in /private/var/mobile/Library/Preferences/com.apple.locationd.plist, though this doesn't seem to store the information about when they can be run without prompting the user.</description><link>http://www.tralfamadore.com/2008/08/reading-location.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-3351242960568345029</guid><pubDate>Wed, 13 Aug 2008 21:59:00 +0000</pubDate><atom:updated>2008-08-13T15:23:25.293-07:00</atom:updated><title>Jailbroken iPhone logging basics</title><description>Graphical apps on iphoneos 2.0 can't be started from the command line, which makes using stdout and stderr for logging a bit difficult.  Or, more to the point, useless.  You also can't see any messages that might occur if any app, GUI or non-, crashes.&lt;br /&gt;&lt;br /&gt;There are a couple of tips being passed around to address this.  This one I've copied from the technique used to run Java apps.  To get stdout logging, simply rename your executable and replace it with a wrapper shell script whose output you can pipe to a log file of your choosing, like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;exec "$(dirname "$0")"/MyRenamedExecutable &amp;amp;&gt; /tmp/myapp.log&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That gives you printf() (or System.out.println() if you're so inclined).  To get error messages, you can set up syslogd to run: &lt;a href="http://code.google.com/p/iphone-elite/wiki/IphoneSyslogd"&gt;straightforward instructions here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Note that after configuring syslogd, you'll need to reboot.  You could do this the hard way, by holding down the power button for a few seconds and then sliding the touchscreen prompt.  Or if you're impatient like me, you could just type &lt;span style="font-family: courier new;"&gt;reboot &lt;/span&gt;from the command line.&lt;br /&gt;&lt;br /&gt;Now to figure out why none of my apps are working...</description><link>http://www.tralfamadore.com/2008/08/jailbroken-iphone-logging-basics.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-6631423225991115741</guid><pubDate>Tue, 12 Aug 2008 22:10:00 +0000</pubDate><atom:updated>2008-08-12T15:18:59.970-07:00</atom:updated><title>I'm losing my memory</title><description>A brief aside to the folks who invented PC2 5300 DDR2 RAM DIMMs, and then decided that they'd apply that same exact name to both a desktop and a laptop configuration, &lt;span style="font-style: italic;"&gt;which are completely different form factors&lt;/span&gt;: Your ways are indeed mysterious, and no doubt you take pleasure in confusing mere mortals like myself, yet you shall be punished for your cruelty when the wheel of fortune turns.&lt;br /&gt;&lt;br /&gt;In other words, I hope I can get a refund or an exchange.  Sigh.</description><link>http://www.tralfamadore.com/2008/08/im-losing-my-memory.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-4185473230526869768</guid><pubDate>Sun, 10 Aug 2008 21:52:00 +0000</pubDate><atom:updated>2008-08-10T15:25:06.507-07:00</atom:updated><title>iphone-java: Get subverted</title><description>To catch you up with our story:  Between his work on Cydia, Winterboard, and getting a full gcc toolchain to run on iphoneos, the indefatigable Saurik has also created jocstrap, the amusingly named Java to Objective-C bootstrapping library.  Jocstrap enables Java code running on jailbroken iPhones to access most (and eventually all) of the iPhone SDK APIs, meaning Java applications can use the native look and feel widgets and participate in the windowing and event system on the iPhone*.  All this runs on top of the &lt;a href="http://jamvm.sourceforge.net/"&gt;jamvm&lt;/a&gt; bytecode interpreter and &lt;a href="http://www.gnu.org/software/classpath/"&gt;GNU Classpath&lt;/a&gt; system libraries.  So Java on the iPhone is getting more and more stable by the day, and while it's limited to jailbroken devices at this point, there's a hope that the GCJ ahead-of-time bytecode compiler can be ported to work on the platform, meaning apps written in Java could potentially get around Apple's restriction on interpreted programs being sold on the AppStore.&lt;br /&gt;&lt;br /&gt;Of course there are a lot of missing pieces still, and one of my major goals is to get a more intuitive API working for Java that abstracts away the messiness of bridging to the native functions.  To this end I've been working on a MIDP implementation that is roughly based on the GPL PhoneME project.  At the moment it does little more than run a HelloWorld MIDlet, but it does that with gusto.  And having converted it over to use the 2.0 SDK APIs, it's about time the source saw the light of day on its own little subversion server.  So here it is:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;svn checkout http://svn.tralfamadore.com/repos/iphone&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There are three directories here:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: courier new;"&gt;midp&lt;/span&gt; - containing the work-in-progress MIDP implementation.  This all builds to a midp.jar file, but includes a main class (currently javax.microedition.midlet.Runner) that acts as a MIDlet chooser and can be wrapped into an iPhone .app bundle (currently this is left as an exercise to the reader, but I'll add it to the build script soon).&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: courier new;"&gt;jocenum&lt;/span&gt; - a small shell script to generate Java constant (public static final ints) declarations from the enums in the iPhone SDK headers&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: courier new;"&gt;share&lt;/span&gt; - containing jocstrap and other JAR files for MIDP (and any other projects that might live here) to link against.&lt;/li&gt;&lt;/ul&gt;If you're interested in helping out, please join us at the &lt;a href="http://www.telesphoreo.org/cgi-bin/mailman/listinfo/iphone-java"&gt;iphone-java mailing list&lt;/a&gt; or email me privately (wes at tralfamadore.com).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;* Even though I have an iPod Touch, the SDK is the same for both the Touch and the iPhone, and as the latter is shorter to type and more prominently marketed, I'm just going to refer to it that way (after all, Apple calls it iphoneos in the internals).&lt;/span&gt;</description><link>http://www.tralfamadore.com/2008/08/iphone-java-get-subverted.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-719323640432329411</guid><pubDate>Sat, 09 Aug 2008 22:09:00 +0000</pubDate><atom:updated>2008-08-09T15:31:38.662-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>iphone ssh</category><title>Tip: ssh autologin on the iPhone</title><description>If you have a jailbroken iPhone or iPod Touch and an inclination to hack and/or just poke around, you've probably &lt;span style="font-family: courier new;"&gt;ssh&lt;/span&gt;'ed into it as root (the password, if you haven't reset it, is "&lt;span style="font-family: courier new;"&gt;alpine&lt;/span&gt;").  Oh, the heady rush the first time I saw that shell hash prompt.&lt;br /&gt;&lt;br /&gt;Anyway, after getting highly skilled in quickly typing "alpine" (muscle memory is a beautiful thing) it occurred to me I could eliminate that step by using &lt;span style="font-family: courier new;"&gt;ssh&lt;/span&gt;'s autologin feature.  Because it configures the session setup aspect of secure communication, it also applies to other secure connections you might make to the iPhone, like those via &lt;span style="font-family: courier new;"&gt;scp&lt;/span&gt;.  And really, if you've got &lt;span style="font-family: courier new;"&gt;ssh &lt;/span&gt;and &lt;span style="font-family: courier new;"&gt;scp&lt;/span&gt;, what else do you need?&lt;br /&gt;&lt;br /&gt;There are plenty of howtos out there that go into &lt;a href="http://www.puddingonline.com/%7Edave/publications/SSH-with-Keys-HOWTO/document/html/SSH-with-Keys-HOWTO-4.html"&gt;a lot of detail&lt;/a&gt; on the subject, but the basics are:&lt;br /&gt;&lt;br /&gt;On your PC:&lt;br /&gt;1. Run &lt;span style="font-family: courier new;"&gt;ssh-keygen&lt;/span&gt; from the command line.  This will generate a public key and put in your home directory in a hidden subdirectory named&lt;span style="font-family: courier new;"&gt;.ssh&lt;/span&gt;.&lt;br /&gt;2. Go to your &lt;span style="font-family: courier new;"&gt;.ssh&lt;/span&gt; directory and &lt;span style="font-family: courier new;"&gt;scp &lt;/span&gt;your &lt;span style="font-family: courier new;"&gt;id_rsa.pub&lt;/span&gt; file to your iPhone.&lt;br /&gt;3. &lt;span style="font-family: courier new;"&gt;ssh &lt;/span&gt;to your iPhone.&lt;br /&gt;&lt;br /&gt;On your iPhone&lt;br /&gt;4. Create a ~/.ssh directory and set its mode to 0700.&lt;br /&gt;5. Move the &lt;span style="font-family: courier new;"&gt;id_rsa.pub&lt;/span&gt; file you copied over to &lt;span style="font-family: courier new;"&gt;~/.ssh/authorized_keys&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Voila, no more alpine.  You can repeat the process from more PCs by appending each public key file to the authorized keys file (i.e. &lt;span style="font-family: courier new;"&gt;cat id_rsa.pub &gt;&gt; .ssh/authorized_keys&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;Note that this doesn't actually disable you or others from logging in to your iPhone if you or they know the root password, and in any case you might want to consider changing it (in the usual way, with the &lt;span style="font-family: courier new;"&gt;passwd &lt;/span&gt;command).</description><link>http://www.tralfamadore.com/2008/08/tip-ssh-autologin-on-iphone.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-2757408430207485368.post-8783823230694051060</guid><pubDate>Sat, 09 Aug 2008 19:43:00 +0000</pubDate><atom:updated>2008-08-09T13:29:59.627-07:00</atom:updated><title>Hacklog.start()</title><description>Let's talk iPhone programming.  I've got a few interesting projects coming up that I'll share through these pages, along with various tips and tricks that I find useful.&lt;br /&gt;&lt;br /&gt;A quick note on my development environments:&lt;br /&gt;&lt;br /&gt;iPod Touch 16GB&lt;br /&gt;Apple firmware 2.0&lt;br /&gt;Jailbroken with PwnageTool 2.0.1&lt;br /&gt;Full iphone-gcc toolchain installed&lt;br /&gt;&lt;br /&gt;Mac Mini 1.42GHz (PPC)&lt;br /&gt;OS X 10.5 Leopard&lt;br /&gt;512MB RAM (I ordered the upgrade to 1GB)&lt;br /&gt;Aquamacs Emacs 1.4&lt;br /&gt;XCode (when I have to)&lt;br /&gt;Interface Builder (if I must)</description><link>http://www.tralfamadore.com/2008/08/starting-up.html</link><author>noreply@blogger.com (Wesley)</author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></item></channel></rss>