Tag Archives: iPad

Want your iPad calendar to start the week on Monday? Move to Namibia

Frustratingly, my iPad calendar appeared to unilaterally decide that the first day of the week was Sunday. And there was no obvious setting to change it, like there is for Calendar on the Mac.

Turns out this “feature” is decided by Apple based on your region. They believe Australian weeks start on Sunday so that’s the way it is. To change the day, change your region.

For Australians wanting their calendar to start on a Monday:

  1. Launch settings
  2. Select General > International
  3. change region format to Namibia

This bizarre choice seems to have the best option for calendar setting, as well as changes it makes to keyboards (what currency symbol you see), date and time formats, even which google you default to when you search. Namibia appears to leave all the other settings “just like Australia”, and still default to google.com.au for searching in Safari.

Thanks to the clever chaps on the Whirlpool forums, particularly dokh22, for uncovering this. Now how long before Apple gives us a calendar setting to do it properly?

Simple image (frame-by-frame) animation in IOS and Xcode

Adding frame-by-frame animations to your iOS application is simple once you find out that a UIImageView can be initialised with an array of images, not just one image.

This post was inspired by a colleague who had not uncovered that fact, and so had spent time arduously linking separate views with timers. This post shows how to use a single view and 3 lines of animation code to do all the work.

What to do?

What we’ll do as a test is animate the blinking eyes on a tennis-playing ninja splash screen. To trigger the animation will add a “blink” button on the same screen.

Don’t ask how we ended up with that as the example (thanks to the friend). But you can download the entire project, or just the images if wanting to join in.
Continue reading

IOS5 – Wireless sync is the gravy

Finally managed to download and install the IOS5 update for the iPad. Most of the new features are unobtrusive, although still trying to find some of them.

However what wins is the wireless synchronisation feature. Now I can update my library (songs, books, tv) on my computer and click Sync. And the iPad gets updated while not connected. While not even switched on. While in my briefcase in another room.

Sweet.

[Although I'll admit it's probably sweet because Apple kept us tethered for far too long!]

Issue with centre-aligned text in an ePUB on the iPad

For a while now been puzzled by an issue where centred text in an ePUB book was not appearing as such once the book was viewed on the iPad.

The following images show the issue in a test EBook generated initially in InDesign. All the items in the first (frontis) page should be centered, but aren’t. However the titles in each chapter (added using exactly the same styles!) appear fine.

 
To further confuse, testing the identical book in Adobe Digital Editions shows the required formatting.

So in the immortal words of developers everywhere, what the?

 
It turns out the problem is not in the CSS, or even in the ePUB. But with iBooks. And I thank the gurus at Pigs, Gourds and Wikis for pointing me in the right direction.

The solution is “Apple simple”, meaning its easy/obvious once you’ve been told where to look. But impossible to fathom before then.

 
Turns out iBooks has an “override” setting for justifying text. And this for some reason messes with my text-align:center. settings. The value can be changed within the Settings application. To get the centred text to appear as expected I needed to turn full justification off.
 
To demonstrate, following are the same pages from the start of the article, but now with the setting changed. Nothing was modified in the ePUB itself, only the iBooks configuration.
 

All is right with the world.

iPad VGA Adapter selective with output – no iBooks

I just purchased the VGA adapter for the iPad so I could use it to present some content. However it works in a slightly misleading manner.

Not all iPad screen output is automatically pushed out to the device when plugged in. For example I navigate through my video files in iTunes on the iPad (external screen blank) until I click Play. Then the video appears (and works flawlessly) on the external monitor. But the iPad screen freezes and shows a still frame.

Similarly with iPhoto. I can navigate through images and folders only on the iPad. My pictures only appear on the external monitor when I start a slide show.

So those two limits are perhaps manageable. But the killer was iBooks. I had a presentation to give but not having Keynote installed on the iPad I instead exported as a PDF and added to iTunes for viewing via iBooks. However there’s no VGA ‘output’ for any content in iBooks. So the external monitor remained frustratingly black.

So short of buying Keynote for the iPad, my only other option would be to export as a movie and watch through iTunes. How painful is that!

Here’s hoping there’s a configuration setting I missed…….

Rich media EBooks (on the iPad/Phone)

Good news from Apple. Made my coffee break when this trickled into Google reader:

IBooks app updated to support audio and video content

To date my EBook focus has been on the iPad platform, since that’s the tool we’re evaluating for business reference/learning. The first books were plain text and images, and handmade.

Initial attempts to add richer content via CSS and Javascript had mixed results (and will publish those once complete). But until now it was quite clear that audio and video were out, at least without some major hackery. So let’s hope this is good news….

Building and publishing an eBook on your iPad

When you start researching online how to publish an eBook, the focus is strongly on commercial release to the general public.

However, particularly in the corporate world, you may not want to make your book publically available. So how do you get all the benefits of an eBook on the iPad (and/or the excuse to buy an iPad for business use) but without releasing your internal documents to the world? After some research, trial and error, the process is really quite simple.

To have your very own library on your very own iPad just three steps are required:

  1. create a valid eBook
  2. drag that book into iTunes, and
  3. synchronise your iPad with your updated iTunes library.

Your personal eBook will then be available on your iPad, right there alongside, and indistinguishable in quality, your John Grisham collection. Or your Alice in Wonderland collection if still stuck in a region – like here in Australia – with no functioning iBooks store.

Step 1. Create a valid eBook

While this may appear daunting it’s really straightforward once you realise a few simple truths.

  • iBooks supports eBooks produced in the standard ePub format (read more on Wikipedia)
  • an ePub book is simple a zipped folder with a different extension (changes .zip to .epub)
  • within your eBook your content must be included as XHTML files, one file per chapter
  • accompanying your content are a variety of XML files that define the structure and order of your content

Sample ePub contents - just XHTML and XML files
And that’s it. You don’t need anything more complicated than a text editor and a folder zipping tool. It’s so simple I strongly recommend you (at least the first time) build one manually. It’ll give you a much better understanding of how it all comes together, and what options you have in defining and manipulating your content.

There are several tutorials online to help guide you through the process to build an eBook.  I recommend you follow this one from jedisaber. Download the sample file provided and follow the steps.

If your experience is the same as mine, most of the issues you’ll face when generating your first book will be in producing valid XHTML content. As such it’s recommended you build and validate this first. Issues I had included:

  • incorrect nesting of tags
  • not closing tags (particularly the img and br items)
  • missing attributes (particularly alt on all my images)

However use a decent XHTML validator (if not using Safari – which tests automagically – go for the master and use the one from W3C) and you’ll get through them.

Outside the XHTML the only other issue was in ensuring all the content files were encoded correctly:

Set encoding in BBEdit (OSX)
On the Mac I was using BBEdit. It gives you an option in the Edit Window to set the encoding: pick UTF-8. Note I also picked Windows CRLF because I was using a PC to package the book, more on that later.

Set encoding in Notepad (Win7)
On the PC I was using Notepad to edit. It allows you to set the encoding when saving. Again, choose UTF-8.

 
Once all your content is complete and valid, you can then compile your book in the folder you’ll then zip and rename to become the finished ePub. Follow the instructions (and sample) from jedisaber:

  1. ignore mimetype and META-INF (content does not need to change from one book to the next)
  2. load your valid content into OPS folder, documents and images (use subdirectory for your images if you set the URLs in your content to match)
  3. edit content.opf (XML file) to list all your content (and only your content – remove references to sample files not used). Make sure the URLs are correct, particularly if using subdirectories in OPS to organise your content
  4. edit toc.ncx (XML file) to list your content in the order to be navigated and with the section/chapter titles as you want them to be shown
  5. ZIP the folder
  6. Rename the folder from a .ZIP extension to a .ePUB extension

Be careful generating the ZIP version on a Mac using the built in compression tool. Not only does this incorporate all the hidden OSX files (DS_Store, etc) it also seems to put an extra folder layer in. I was only able to generate the correctly formatted ZIP file using Winzip on a PC.  This also allowed me to set the compression for the mimetype file to 0% as requested.

Note I managed to resolve the “extra folder” issue in OSX. Trick is not to choose your eBook folder to compress. Instead select the contents of that folder (should be three things: mimetype and META-INF and OEBPS folders) and compress them. You’ll get an Archive.Zip file you can then rename. This doesn’t resolve the potential issue with hidden files but I’ve not had any issues with ePUBs built this way since.

I then suggest you validate the eBook prior to the move into iTunes. Use the online threepress tool – it’s free. It may identify a few items you’ll need to return to your source to resolve. Just make the edits, rebuild/rename the ZIP and try again.

With that tool the only error I was not able to get rid of concerned the length of the first filename. I’m guessing this is because the requirement is for mimetype to be the first file in the ZIP file but I could not find any way to enforce this. However even with this error I did not get any issues with the subsequent steps so if you get this error, ignore it like I did.

If the book validates, then also consider testing it in a reader outside of iTunes. I used the bookworm from O’Reilly. Alternatively try Adobe Digital Editions, a free download so you can test your books without a web connection.

Step 2. Drag into iTunes

Simply open iTunes, select your Books folder, and drag your .epub file into the window. If all works well you should see your book listed, with its cover appearing in all its glory.

Note you cannot open/view/test the book from here. That only happens when you get it onto the iPad.

Step 3. Synchronise and launch on your iPad

When you sync your iPad just ensure its set to include all new eBooks. Your file will then get copied across and be ready for use. Congratulations!

Next steps

Using XHTML it’s straightforward to include text and images in your content. So feel free to improve on your content’s richness. Also consider adding a stylesheet (include in your content.opf file, as well as referenced in your XHTML) to further enhance the presentation.

You can easily add a nicer title/cover page so your book looks better on the shelf. Either build in XHTML or just create as a nice image and include.

From this foundation, the next step for me is to see if possible to include some richer media in the book. For example a video or audio snippet. We’ll see how that goes….

Resources

Note: All the online tools listed here require you to upload your content to their servers. Be mindful of how secure you want/need your content to remain before using any of these tools.

Getting the iPhone simulator to recognise sqlite database changes done in Terminal

I’ve been tearing my hair out for an afternoon working with a simple DB application for the iPhone/iPad. Essentially it connects to a sqlite3 database as the source file. But each time I edited that database content in Terminal, nothing was changing in the application when run.

Finally a solution. Need to reset the simulator itself to remove the local copy taken/needed when running a DB application.

Option you need is Reset Contents and Settings… under the iPhone Simulator menu.

Once reset when the application is run it pulls the updated database across as its copy. Phew!