Coda and TextMate Tips for Mac OS X Terminal

Here are some tips for easy shell access to open files with TextMate and Coda from the terminal. I found and modified these while I’ve been dinking around with PhoneGap for iPhone (love it) and Android (jury is still out).  PhoneGap will likely be another post.

These tips allow you to easily open a file or files (or a whole directory in the case of TextMate awesomeness).  To open an html file in the current directory from the shell prompt becomes as easy as:

coda index.html
or
mate index.html

Opening all the HTML files (Coda) or all the editable files (TextMate) becomes:

coda .
or
mate .

How-to:

1- Open Terminal
2- In terminal, enter: open .profile
3- Scroll to the bottom of the file and add the following lines of code

# TextMate
# set path and simple shell function
export TEXTMATE_PATH=/Applications/TextMate.app/Contents/Resources/mate
mate () {
    $TEXTMATE_PATH $1 $2 $3 $4 $5 $6
}
# svn for TextMate (default editor, end-of-line types)
export EDITOR="$TEXTMATE_PATH -w"
export LC_CTYPE=en_US.UTF-8

# Coda
# set path
export CODA_PATH=/Applications/Coda.app
# function roughly like 'mate .' by expanding '.' to '*.htm*'
coda () {
if [[ "." == $1 ]]
then
    open -a $CODA_PATH *.htm*
else
    open -a $CODA_PATH $1 $2 $3
fi
}

4- Save .profile
5- Quit Terminal
6- Restart Terminal and try one of the new functions

Obviously you must have TextMate and Coda installed for this to work. Likewise, there are more robust ways to achieve this. However, I like using shell functions in .profile, so that I have only one place to look for customizations when migrating to a new Mac.

More robust implementation approaches can be found for each command at:
Coda: https://github.com/egonSchiele/Command-Line-Coda
TextMate: http://blog.macromates.com/2005/textmate-shell-utility-tmmate/

My next tips will be some über-handy apps for Finder, allowing you to easily open the Terminal with the current Finder window as the working directory or to easily drag-and-drop to open files in a preferred editor.

Total Validator for HTML

A little help can make a big difference when you’re trying to improve on writing valid and accessible HTML— whether you are doing it for better performance or for compliance to US ADA Section 508 (or compliance to W3C Web Accessibility Guidelines). I was recently reminded of just how great of a help the Total Validator tool/service is with HTML5 validation— and I also experienced their great customer service.

First, a bit about the service from their site:

Total Validator is a free one-stop all-in-one validator comprising a HTML validator, an accessibility validator, a spelling validator, a broken links validator, and the ability to take screenshots with different browsers to see what your web pages really look like.

They add, Total Validator provides the following main features (my emphasis added):

  • A parser that validates the basic construction of your pages
  • True HTML validation against the W3C Markup Specifications or ISO/IEC definition using the published DTDs and standards: (HTML 2.0, 3.2, 4.0, 4.01, HTML5, ISO/IEC, XHTML 1.0, 1.1 and 5, XHTML Basic 1.0, 1.1, (X)HTML+RDFa, XHTML-Print)
  • An accessibility validator that validates against the W3C Web Accessibility Guidelines (1.0 and 2.0) and US Section 508 Standard
  • A broken links validator that checks each page for broken links
  • A spelling validator that spell checks the content of your pages (English, French, Italian, Spanish, German)
  • Snapshots (screenshots) of your pages in different browsers, on different platforms, at different resolutions

It is super-easy to use, especially with the Total Validator Firefox extension (Linux/Mac/Win) or Total Validator Desktop version. Here is a 1 minute demo of using Total Validator with the results for a simple page. Note that I deselected the screenshots option of Total Validator for a faster response.

Now here is a great customer service/responsiveness story about Total Validator. Last Saturday morning I modified the Pastelets utilities that I’ve been known to obsessively update. With everything debugged (thank you Firebug) and the layout looking good, I load the paged from my site and click the Total Validator TV icon in my status bar. Though everything looks fine, I get an error about an invalid link/protocol with a tag–
<img src="data:image/png;base64, …">
It didn’t seem to like use of the data: URL protocol, even though the image rendered fine in 3 browsers. I double-checked my code and everything looked good and seemed to work, so I reported an issue to Total Validator. Early Sunday morning I get an email back and the Total Validator team has fixed the issue. That was quick!

Do yourself a favor get the Total Validator Firefox extension try the free Total Validator service to help with the accessibility and validity of your web pages. It validates better than Dreamweaver CS5 and validates HTML5.

Even better, purchase a license to the Total Validator Pro Desktop version for ~$37 USD to remove some limitations on checking and add capabilities like being able to check an entire web site at once, while excluding certain areas of the site. After your initial purchase, annual renewal is about $8 USD a year.

Updated Pastelets for iPad, iPhone and iPod Touch

The Pastelet utilities easily create javascript: bookmarks (bookmarklets) that paste a custom text string into a web page form in Mobile Safari on iPhone, iPad or iPod Touch. A super-handy way to have a scrapbook of text snippets you can use without leaving Mobile Safari.

The most recent releases are a very significant update. The utilities are written in HTML5 and leverage HTML5 input types for data entry. This means you can use the Email/Login version and get the email-friendly version of the Touch keyboard. Similarly, the Telephone version pops-up the numeric keypad.

Likewise, the generated bookmarklets are HTML5-savvy; when selected they “paste” their designated text into the first email form field or telephone number field found on a page (and do so in a clever way that works well with older HTML too).

Here they are with as a hyperlink and a full URL:

All of the iOS pages look a lot like the older version(s),
old “Make Pastelet” utilitynew “Email Pastelet” utility
but they do a lot more.

There is still a desktop version that also works with Internet Explorer- http://mobilemind.net/iphone

For basic information, see my original post, Paste (Frequently-used) Text into Web Forms on iPhone, iPad, and iPod Touch

PRO TIPS:

  • The generic Make Pastelet Utility is the one to use if you’re unsure; it has the widest compatibility and lets you confirm the “paste” as it steps through the fields.
  • The Email/Login Pastelet is the one I use most. It works great for Gmail and other services where your email address is your user ID, and doesn’t require the extra step of a confirmation. It also works great with non-email user IDs on services like Remember The Milk and many others.
  • Use copy and paste with the “Your Pastelet” text box to streamline updates or changes to existing Pastelets. Start like you’re making a brand new pastelet. Next, select and copy the contents of the “Your Pastelet“ text box to the clipboard. Then use Bookmarks to edit an existing Pastelet. Simply select the old URL and paste over it. Voilá, an updated Pastelet! Streamlined with no need to create a new bookmark, save, re-open/edit, drag across that long text string and finally delete the prefix.
  • Desktop browsers let you more quickly create a slew of Pastelets, if you already sync the browser with Mobile Safari via iTunes. Just use your desktop browser to visit Email/Login Pastelet or Telephone Pastelet. Make a pastelet and simply drag the “Pastelet as link” hyperlink to your bookmark bar. Ta-da, a bookmarklet without the editing fuss. Make a bunch and then sync. You can easily fine-tune them on the device using the previous copy & paste tip.

Watch for more updates on bookmarklets and some updates on travel applications soon.

Thoughts on Learning in 3D- Virtual book Tour

I’m fortunate that this blog is an early stop on the “#Lrn3Dvirtual book tour for Learning in 3D: Adding a New Dimension to Enterprise Learning and Collaboration by Karl M. Kapp and Tony O’Driscoll. There is much to come on the tour, from colleagues and friends widely held in high esteem through the learning and training profession. My perspective on virtual worlds may cast me as an outlier, and therefore warrant some explanation. If you can bear with my explanation and thoughts about it, there just may be a book discount in it for you.

Though I am competitive, I’m not a gamer. I’m considered a technologist by myself and others, but I’m not a fan of virtual worlds and Second Life. I’ve tried them a few times and they have served little purpose for me. I suspect it may be awhile before they do. [Although Stephen Colbert recently said that “…more and more of life is becoming 3D.”]

The previous paragraph is an odd transition into a post about Learning in 3D. However, I believe my post, like the book it is about, will benefit both others like myself, and those at the other end of the spectrum. Personally, I am challenged to understand and find the benefits of these environments. It often seems that training needs can be better served by more widely understood and widely adopted technologies combined with sound instructional design and basic business acumen. Virtual Worlds and 3D for learning are areas that deserve thought and resources whether you find yourself enamored, intrigued or skeptical.

As an avowed skeptic, I found information in the book to expand my understanding of these areas and tools to apply to learning in 3D (as well as simulations and training in general). Two things in particular helped me become more understanding of virtual worlds for learning. First, an alternate view– not thinking of the technology, but the plot or story. As contributor Randy Hinrichs puts it in Chapter 4:

Virtual worlds are about theater, character development, relationships with other characters, plot, conflict, denouement, catharsis, and conclusion. We need to design for the full immersive experience in which the users must adapt to the environment, survive in the environment, and fail if they haven’t learned well enough.

Second, I benefited from frameworks and scaffolding as schemas for concepts and as job aids for design and development. The authors deliver on these with useful tools like a model of design principles for 3D Learning Experiences (also in Chapter 4). There are other useful checklists presented as rhetorical “Key Questions” throughout.

Finally, I found it refreshing to review the case studies both for the successes and the lessons learned about design and implementation. It’s not just pie-in-the-sky, but gets down to brass tacks about what worked, what didn’t and how it can be done better in the future. These are real case studies from major organizations, and there are nine of them. Each has some innovation and some challenges. I really appreciate that they also share the lessons learned about implementation, orientation, design and evaluation.

That just skims a few parts of the book. I’ll leave it to my colleagues to provide broader and deeper analysis— I just touched on a few areas, mostly from Chapters 4 and 6. If you’d like to learn more about the book, stay tuned to the virtual book tour, visit the book web site, book wiki or for awhile buy it from the publisher with a 20% discount using code L3D1.

iPhone Travel Apps: Me v. National Geographic

One screen of my iPhone is dedicated to essential travel apps and I’d like to share that list with you. For comparison I’m also including a link to and the short list of Travel Tech: Top 20 iPhone Travel Apps from National Geographic Adventure.

My key travel apps for iPhone (prices as of July 3, 2009):

  1. TravelTracker with TripIt $7.99If you take more than 6 trips a year get this app and sign up for TripIt service on the web. TravelTracker shines over the free TripIt app because it keeps past trips and has many more features. Silverware is a good company and this is a good app. Loved the previous TravelTracker incarnations on the Newton & the Palm, and I got it on iPhone as soon as it came out as a new-from-ground-up, smarter app. I’d hold off on getting the “Pro” version for now though… there are some iPhone 3.0 issues to sort out. In a few weeks I will be upgrading to TravelTracker Pro though, so I can get live flight status plus download and upload to TripIt. Update: A new version of TravelTracker posted to the App Store today—July 3, 2009.
  2. TripIt for iPhone FreeHuh? You just said TravelTracker. I use both. The TripIt app is less cluttered and faster— for the current trip, but I can not easily forward an itinerary or do many other things that TravelTracker does so well. I use TripIt for quick access to info on the current trip, like hitting the rental car info with my big fat thumb as I dash away from baggage claim.
  3. The Weather Channel FreeAs National Geographic puts it:

    [The Weather Channel app] gets the nod for customization and the ability to check out conditions in multiple locations at a glance.

  4. AroundMe FreeI admit it, Starbucks pwns me. AroundMe helps me quickly find that essential latte, or a local equivalent and other conveniences (ATM/bank, restaurant, pharmacy, retailer). I’ve tried coffee-specific apps and a few brand-name bank/retailer/restaurant finders. This particular app works well and seems current most places I go, and does away with having a slew of category/vendor-specifc apps.
  5. Currency FreeFantastic currency converter that auto-updates exchange rates. Shows a purchase amount in multiple currencies of your choice at the same time. Easily switch from entering in one currency to entering in another. Very helpful on my trip to Singapore when trying to figure out what $5 USD was in SGD or what $900 SGD is in USD (answer: 1 nice watch).
  6. Taxi Magic FreeGreat app for getting a taxi when you aren’t in an urban center or near a taxi stand. It electronically hails a taxi and sends your current location to your choice of cab companies. You can even create an account & use it to pay for the ride, without using cash or credit in the cab. Cities supported include: Atlanta, Austin, Boston, Charlotte, Chicago, Dallas, Denver, Kansas City, LA, Minneapolis, Nashville, NYC, the OC, Pittsburgh, Phoenix, Portland, Sacramento, San Antonio, San Diego, Dan Francisco, San Jose, Seattle, St. Louis, and Washington DC.
  7. Urban Spoon FreeThe best way to break the logjam of “I dunno, where do you want to go.” Also nice to find something interesting & local instead of the shopping mall-perimeter chain restaurant defaults.

Then there are the airline superstars of iPhone web app-friendliness. The standout here is JetBlue, who has a very useful and colorful web app. Honorable mention to Southwest Airlines, who made great use of the very cool iUI iPhone templates found on Google Code.

To make the most of any of the web apps below, just visit the URL on your iPhone and then bookmark with the “Add to Home Screen” option.

Great iPhone web apps from airlines to add to your iPhone homescreen (actual iPhone/Touch home screen icons shown):

I heard back from @Alaska Airlines on twitter that Alaska is working on it. Go Alaska! No word from United Airlines on when http://ua.flightlookup.com will become more iPhone-aware. Sadly, the very-cool, but Flash-dependent site of Virgin America doesn’t make the iPhone cut either (as of July 3, 2009). Btw, lots of airlines are on twitter, as I found out working on @AICC followers.

A Few Extra Travel-related Apps
Rounding-out my travel page I have Aeroguide Lite (Free) to recognize things like that rare Ilyushin Il-62 I once saw over SFO (an Il-62 looks like MD-80/DC-9 with 4 engines or a Vickers VC10).

Other miscellanneous items on the page include: Gas Cubby ($9.99) for recording and charting the MPG, etc. of my own car; FedEx Mobile (Free) for help with shipping; and Google Earth (Free) for miscellaneous mapping and geographical visualization.

The National Geographic Adventure List
To get more detailed information on their picks, please see Travel Tech: Top 20 iPhone Travel Apps from National Geographic Adventure. I’ve add my opinions to their list below where I had feelings one way or the other. For reference, here is their list:

  1. Next Flight $2.99
  2. Urban Spoon Free
  3. HearPlanet reg $5.99 (on sale for $1.99 on July 3, 2009)
  4. Air Sharing $4.99(Nix I say, get FTP On the Go)
  5. Tweetie $2.99 (Nice, but nix say I. Get free TweetDeck or Twittelator Pro for $4.99, or both as I did)
  6. IAmHere $0.99
  7. World Customs $0.99
  8. Wi-Fi Finder Free
  9. The Weather Channel Free
  10. Google Earth Free
  11. Packing $1.99 (on sale for $0.99 on July 3, 2009. This one *I* might try)
  12. Room Free
  13. FlightTrack Pro $9.99 (Nix, I say, get TravelTracker w/TripIt)
  14. Lonely Planet Phrasebook $9.99
  15. Skype Free (I totally agree here–a very popular app, 4M downloads & estimated to be on 10%+ of iPhones)
  16. WriteRoom $4.99
  17. (Amazon) Kindle for iPhone Free (I totally agree here too)
  18. Cheap Gas Free
  19. Babelingo $3.99 (on sale for $1.99 on July 3, 2009)
  20. Where Free

LETSI Tech Meetings Live Blog

This is a temporary location for the Live Blog of LETSI Tech Meetings being held during June 2009 at IEEE Headquarters in New Jersey. Ultimately this post will be come a link to this blog hosted on the LETSI site.

Thanks.

iPhone Travel- Save on Calls, SMS and Data

Avoiding excessive charges is one key trick for International Travel with an iPhone. International travel can include a quick cruise to Mexico or the Caribbean, or a full-on international flight. Either way, some tips I’ve learned will save you money. I spent a week in Singapore and saved $60 over what the roaming rates would have totaled for data, SMS and calls.

Summary

  • Get the free AT&T myWireless Mobile app. It is an easier way to manage the service add-ons.
  • Get the free Skype app for iPhone. You can make cheap calls over WiFi, or even skip/miss a call to your iPhone number and then call right back using Skype.
  • Skim the AT&T iPhone Tips for International Data Roamers from their web site.
  • Be smart with call & SMS rates. 2-3 days before travel, activate the $5.99/month “AT&T World Traveler” for cheaper call & SMS rates.
  • Be smart about 3G data. 2-3 days before travel, activate a “Data Global Add-On” for International Data roaming (20/50/100 MB for $24.99/$59.99/$119.99/$199.99)
  • Turn off or dial-back SMS reminders from things like Twitter, etc. Do it a day or two early, there may be that one last service that sends a message and you can turn it off before you leave.
    Tip: I leave twitter Direct Messages on, so that colleagues traveling can reach me without using up their own SMS messages.
  • Scout for WiFi options before you leave. Try Hotspot Locations or Ji-Wire Global Wi-Fi Finder. Remember to ask locals and check for more once you arrive.
  • Delete or move what you can out of your IMAP email account Inbox. Having a smaller Inbox or putting messages in rarely used subfolders will reduce data updates.
  • On your iPhone, use Settings>General>Network>Data Roaming to turn OFF Data Roaming before you board (airplane or ship; you can get hit with roaming data charges just walking between connecting flights with your phone on, or when a cruise ship sails out-of-range). Turn it on when you really want to connect for data.
  • Turn off PUSH data services using Settings>Fetch New Data to select Push OFF. On the same screen, change Fetch to Manually (or if you really want updates, Hourly)
  • Updated: Turn off less critical Notifications— they use data too.This includes Growl/Prowl if you use it.
  • Reset the iPhone Usage Tracker to Zero using Settings>General>Usage>Reset. Check your data usage daily (consider an alarm or appointment for this).
    Tip: If you get close to the limit of your Data Plan, you can call well before you exceed it to upgrade to a plan with more capacity. (While traveling, call International Wireless Care at +1-916-843-4685).
  • Wait 7-10 days after returning to deactivate your “Data Global Add-On” and “AT&T World Traveler” services add-ons. Though they are pro-rated for portions of a month, international billing can take a week and you don’t want to be charged the higher rate.

More Details

Service Add-ons:
Use AT&T myWireless Mobile app to activate/deactivate additional services rather than calling AT&T. I recommend doing this at least 72 hours before you leave the USA.
Tip: When you activate the add-ons, immediately set an appointment or “To Do” to de-activate 10 days after you return. You’ll save a few dollars that month since it is pro-rated, and won’t accidentally carry-over the service into future months.

If you need to call or just prefer it, note that you’ll need to make 2 calls. First call the regular service number (611 on mobile or 800-331-0500 from another phone). Second, call International Wireless Care at 800-335-4685 or if already abroad, +1-916-843-4685 to add your “Data Global Add-On” for International Data. Do this AT LEAST 72 hours before you leave; it can take 24 hours or more to activate.
Tip: Add “AT&T International” as a Contact with the 916 number above. You can quickly call for support or to update service.

AT&T World Traveler” is just $5.99 a month and is pro-rated. It can save you $0.30 to $1.00 per minute on calls you receive (rates here). The cost of each SMS message can drop a similar amount. The gotcha is be sure to leave it active for ~10 days after your return. If there are delays in international billing you’ll get hit with the higher rate if you already de-activated this add-on.

Regarding the “International Roaming- Data”- Pick a plan that suits your needs. I watch my data budget tightly and did fine with 20MB ($24.99) for a 6 day trip. I turn off “Data roaming” often and use WiFi where I can. I was ready to call and upgrade if needed though.
Tip: Before you travel, reset the iPhone Usage and watch it for a 2 days to see what your data budget might need to be.

Skype:
Buy in US dollars before you go (or stay in euros if your account is already in euros). Don’t switch currencies on your Skype account; you’ll get hit with a currency conversion charge. I started on Skype years ago when Euros were the only option. I’ll only switch to US Dollars when my account is at zero.

WiFi:
72 hours before leaving the USA, Scout for WiFi. Check with the hotel or conference venue to see if WiFi is available. That can greatly reduce 3G data needs. It will also help you decide how large of a data plan to buy.
Tip: Check if the hotel has a frequent guest plan, many hotels offer free or reduced WiFi for frequent guests. Sign-up before you leave the US.

Data Misers:
Set a recurring alarm for “data off” (bedtime) and one for “data on” (wake). Toggle the Data Roaming setting accordingly. You can still get calls or use alarms, but won’t be disturbed (or charged) for night-time email updates. Get them in a batch at a WiFi spot or when you turn on 3G data again.

Preload maps by searching for directions while at a WiFi spot. You can still get updates via 3G while out and about, but the larger map will already be downloaded.

SMS:
48 hours before leaving the USA, turn off or dial-back on SMS updates. Why 2 days before leaving? So you can catch that one extra service you forgot. Likely sources of SMS reminders to turn off are: Google Calendar, Jott, Remember the Milk, TripIt Premium, twitter.
Tip: Once you’ve established your new locale, do more than set the iPhone time zone. Also set your twitter time zone preferences to reflect your “do not disturb” hours for the new time zone.

Don’t be surprised if you receive 1-2 SMS messages from AT&T as you travel. AT&T will alert you when you’re in a roaming zone and you are not charged for those messages.

Switch iPhone from MobileMe to iTunes Sync Without Losing Bookmarks

Once used on the iPhone, turning off MobileMe sync for bookmarks will result in deletion of all the bookmarks on the iPhone. Furthermore, there is no way to force the iPhone bookmarks to over-write things on the Mac if the sync ever goes awry.

If, like me, you ever end-up with the “good” bookmarks on the iPhone and “bad” on the Mac, there is just no way to sync the good over and replace the bad. However, one can do some tricks with the iPhone back-up preferences file (plist) and Mac Safari export/import bookmarks to achieve a transfer from iPhone to Mac. Once complete, two-way sync will be restored via iTunes. Unlike the MobileMe sync, you can turn off the iTunes bookmark sync to Safari without losing bookmarks on you iPhone.

I’m not responsible for lost data. Back-up everything before you start this process. Do NOT sync the iPhone until the process is complete. Others may have some shortcuts or improvements to this process [eg, convert Mobile Safari plist to Mac Safari plist instead, or use XSLT or shell script improvements, etc.]. I welcome those suggestions and will re-post them. Leave a comment or send email to me at mobilemind (at) pobox.com.

Here’s how I managed to save my iPhone bookmarks, recover them to Mac, and switch off MobileMe bookmark sync without losing data. Now I just use iTunes for Bookmark sync.

1. Download iPhone / iPod Touch Backup Extractor by clicking on the big honking icon on that page. (I sent him $10 USD because it worked so well for me. Send him a few Euro if it works for you too.)

2. Launch the Extractor, open a backup and extract “iPhone OS Files”.

If your current back-up is questionable or to deliberately use an older version of iPhone bookmarks do the following. First make a copy of the current back-up, and put it in another location. Then use Time Machine or your back-up utility to find and restore a “good” previous version of the backup, from:

  ~/Library/Application Support/MobileSync/Backup

Remember that “~” is shorthand for the user home folder (Home icon in Finder, or Shift-Command-H).

3. Save the “iPhone OS Files” extract to a new folder, and find the Bookmarks preferences file. It should be in:
  newfolder/iPhone OS Files/Library/Safari/Bookmarks.plist

4. Convert the binary preferences file to XML. Open a terminal window and go to the folder with Bookmarks.plist. Then issue this command:

  plutil -convert xml1 Bookmarks.plist

Leave the terminal window open, you’ll need it in a minute.

5. Open Mac Safari and do File > Export Bookmarks… to save a backup. We’ll use this if anything goes wrong, and it’s a handy reference example of the bookmark file format. I saved mine as “Safari Bookmarks.html” and put an extra copy in the same folder as “Bookmarks.plist”.

6. Get or make some shell magic with grep to reformat the XML plist preferences file into a rough approximation of a Mac Safari bookmarks import/export file. I found a great bit of code from Dave Taylor here.

I took Dave’s example and removed some stuff like the sorting (more on that in a minute). Then I added the necessary opening and closing tags for a Bookmark file, with some comments. Here is my shell file for you to download: plist2bookmarks.sh

7. Save the shell script and make it executable. Save the shell file to the same folder as the converted Bookmarks.plist file. Then go to the terminal window and make it executable by you (the owner) and your group.

  chmod 774 plist2bookmarks.sh

8. Execute the script and direct the output to a new file. I called my output file “MobileSafariBookmarks.html” (no spaces to make the shell command easier).

  ./plist2bookmarks.sh >MobileSafariBookmarks.html

9. Clean-up the “MobileSafariBookmarks.html” in your favorite editor to make it match the folder hierarchy of your iPhone Bookmarks. I used Dreamweaver CS4 and TextMate to open my reference file (“Safari Bookmarks.html”) and the new file (“MobileSafariBookmarks.html”), bouncing back & forth to make sure I got the tags right.

Have your iPhone handy to check the folder structure. That helped me as I did edits. The comments put in by “plist2bookmarks.sh” should help you understand how and where to create folders (or nest them).

Keep in mind that the iPhone has a few built-in bookmark folders and bookmarks, like the “History” folder and the bookmarks for “Yahoo!”, “Google”, “AT&T MyAccount”, and “iPhone User Guide”.

10. Prepare to import Mobile Safari Bookmarks into Mac Safari. Make sure you have a back-up of your Mac Safari bookmarks. Then open Safari, use Bookmarks > Show All Bookmarks, and delete ONLY your bookmarks. Do NOT delete Address Book or other items. In m case, I selected Bookmarks Bar and deleted all the items there. Then I selected Bookmarks Menu and deleted all those items.

11. Import the Mobile Safari Bookmarks into Mac Safari. Use File > Import Bookmarks… to import “MobileSafariBookmarks.html” as cleaned-up in step 9.

12. Verify Mac Safari against Mobile Safari before you disable MobileMe sync of bookmarks. Remember, that will delete the iPhone bookmarks. Carefully check the list and URL addresses of the bookmarks now in Mac Safari against the list and structure in Mobile Safari on iPhone. Quit Safari on the Mac when you are done. Quit Mobile Safari on the iPhone too.

13. Take a deep breath and delete the bookmarks on Mobile Safari by disabling MobileMe sync of Bookmarks. On iPhone, go to Settings > Mail, Contacts, Calendars. Then, under Accounts select your MobileMe account. Change Bookmarks to OFF. iPhone will warn you about deleting bookmarks. That is OK, because we now have them in Safari and will soon sync with iTunes from Mac Safari back to iPhone.

14. Disable iTunes automatic syncing for devices to allow us to make changes. Do not connect the iPhone yet. Start iTunes. Open Preferences and select Devices. Check the box that says “Disable automatic syncing for iPhones and iPods”. Close Preferences.

15. Connect the iPhone and change iTunes to Sync Safari bookmarks. After the iPhone connects, it may sync anyway. That is OK. Select the iPhone in the left panel. Then select the tab labeled Info in the large main panel of iTunes. Scroll down to the shaded bar for Web Browser and check the box next to Sync Safari bookmarks.

16. Apply the change to sync. Click the Sync button in the lower right corner of iTunes and wait.

17. When the sync is done, all the bookmarks moved manually from the backup to Mac Safari, will be restored to the iPhone. From now on, the iPhone and Mac Safari will sync via iTunes. Changes on one will be reflected on the other after each sync. As an extra bonus, the MobileMe “push” should be a little shorter and a little less battery draining, since bookmarks are no longer synced over-the-air.

If you want, you can even turn off iTunes bookmark sync and add/restore your original Mac Safari bookmarks, either to keep things separate or to merge them back to iPhone later.