Tag: Databases

  • Database Error 1002

    Database Error 1002

    This issue was resolved in Roastmaster 7.0.2

    With iOS 7, Apple ushered in a lot of changes, both in the look of the OS as well as much of its underlying functionality. One of the more impactful changes for Roastmaster was a big shift in how Core Data operates with SQL databases like Roastmaster’s. As with any shift in technology, it has not been without its share of bumps in the road.

    It has surfaced since iOS 7 that in two uncommon scenarios, Roastmaster may display “Error opening database: 1002 – Could not perform compatibility check” when either launching the app and opening the main database, or manually opening any other database.

    Why Does This Happen?

    If you encounter this error due to either of the following two situations, do not fear – your data is not gone, Core Data is simply refusing to open it.

    In BOTH of these cases, I can easily and quickly reset the offending “flag” in the database file, and send it back to you in its original operational state. This error can present due to one of two situations:

    You have recently experienced an unexpected shutdown of your iOS device. This can be due to a hard reset of the device (such as in a hang, freeze or kernel panic), or due to the device shutting down on its own (such a in a low battery situation, or other iOS or hardware malfunction).

    If an iOS device experiences a core OS freeze, and a hard reset is performed, or the OS unexpectedly reboots for another reason, iOS may fail to reset the “busy” flag of the database files, causing Core Data to reject the database the next time you attempt to open it because it thinks the files are already in use.

    I can easily reset the busy flag by simply opening it in an external SQLite editor, exporting it via Roastmaster and sending right back to you.

    You have just restored or setup an iOS device from an iCloud or iTunes backup

    During the backup process, when iCloud or iTunes encounter a Roastmaster database file (.sqlite), it notices its two supporting cache files (.wal and .shm) and coalesces all three into a single, portable .sqlite file, in a process similar to what Roastmaster performs when you export a database. The single resulting .sqlite file(s) are backed up to iTunes or iCloud and stored in the device backup. This all happens transparently in the backup process.

    It appears that in the coalescing process, iTunes and iCloud fail to reset the journal mode on the database(s) from WAL mode (3 files) to DELETE mode (1 file). During the restore, it restores an intact .sqlite file, but since the journal mode is erroneously left as WAL, iOS expects the 2 supporting files. When it does not find them, it refuses to open the database.

    I can easily recreate the extraneous cache files by simply opening it in an external SQLite editor, exporting it via Roastmaster and sending right back to you.

    How Do I Get My Data Back?

    Regardless of which of these situations has presented itself, your data can be easily retrieved.

    If You Have an Exported Backup (or can make one from another device)

    If you have an external backup that is up to date, or are able to export an up-to-date file from another Roastmaster installation, this is the easiest way. Just import the resulting sqlite backup file into Roastmaster, and open that database by tapping the logo on the home screen, tapping the database button and opening it manually.

    If You Do Not Have a Backup

    You will need to send your database folder to me and I will “reset” the database. All that is required on my end to simply open the database in an external SQL editor. This will either A) reset the “busy” flag if it was left marked as “in use” after an unexpected reboot or B) reset (what I believe) to be an erroneous journal mode not properly set during the coalesce phase of the iTunes/iCloud backup.

    In most cases I can do this immediately and return the database file back to you for easy import, and you will be up and running in no time.

    Since Roastmaster actually opens a database to prep it for export, you will not be able to export the database from the app. You will need to use iTunes file sharing to copy the databases folder to your desktop by following these steps:

    1. Tether the device to iTunes
    2. In the “File Sharing” pane of the “Apps” tab, select Roastmaster
    3. In the “Roastmaster Documents” pane, find the “Databases” folder and copy the folder to your desktop
    4. ZIP that folder and email it to support@rainfroginc.com

    I will return a single database file that can be easily imported from Dropbox or email or copied to your Roastmaster documents folder via iTunes file sharing, then choosing “Import from documents” from Roastmaster’s home screen.

    When Will This Be Fixed?

    Unfortunately, it does not appear that I can do anything to fix either of these bugs until the actual causes are revealed. The bugs lie in either iCloud, iTunes or iOS itself – it’s unclear at the moment. I’ve filed two separate bug reports with Apple outlining the problem, and how to reproduce it.

    If you’ve found this page after encountering this error, PLEASE let me know – even if you don’t need my help in resetting your database. The more users I can report having this issue, the higher priority Apple is likely to assign to getting it fixed for good.

  • Using Dropbox to Share a Database Among Multiple Devices

    Using Dropbox to Share a Database Among Multiple Devices

    Roastmaster provides simple, convenient methods to export database file(s) from one device for backup purposes, or to quickly import onto other iOS devices. You can save them to the documents folder of Roastmaster on the device for retrieval via iTunes file sharing, attach it to an email, or – by far the easiest – send it to your Dropbox.

    Dropbox accounts, as well as the iOS mobile apps, are completely free. Just sign up for an account, and download the Dropbox app to your iOS device, and you’re ready to use it with Roastmaster.

    Open Drum Door
    Open Drum Door

    How Do I Export My Live Database?

    1. On the home screen in Roastmaster, swipe up on the drum door to open it.
    2. Tap the “Actions” button
    3. Tap “Export Current Database”
    4. Choose the Dropbox icon at the bottom of the export window that appears

    Congratulations! Your database file now resides on Dropbox, as a backup copy to protect you in the case of accidental data loss, and can also be distributed to other iOS devices with the Dropbox app installed.

    How Do I Import A Previously Exported Database From Dropbox?

    1. In the Dropbox app on the target device, navigate to the “Apps” directory and tap to open it.
    2. Tap on the “Roastmaster” directory to open it and list the files you’ve exported from Roastmaster on any of your iOS devices.
    3. Tap on the .sqlite database file you wish to import. The preview screen will open. When the preview window finishes loading, Dropbox may display “Unable to view file – This file type can’t be viewed”. This simply means it cannot generate a preview, and is no cause for concern.
    4. Tap the action button in the lower right of the window, and choose “Open in Roastmaster”
    5. Roastmaster’s Import screen will display. Tap “Import” to import the database. If a database already exists with the same name as the one you are importing, Roastmaster will ask if you want to replace the existing database, or rename it.
    6. The new database is now saved in your database list. If it was named the same as the database you were using before the import, and you chose to replace it, Roastmaster will automatically open the newly imported database and you are ready to go. If you chose to rename the database, you will need to open it first, by tapping the logo above the drum door, and selecting it from your list of databases.

    You’re ready to begin using your new data!

    Note

    If you use this feature frequently to share a database among iOS devices, you may find when you open Dropbox that it is still displaying the preview screen of that database from the last time you performed an import.

    If this happens, YOU MUST dismiss this preview screen, and load it again before opening the database in Roastmaster. Dropbox caches the file when this preview screen loads, and it will still contain the OLD data from the last import, not the NEW data you want to import. Dismissing that screen, and reloading it from the list of Roastmaster files will force it to load the NEW data.

  • Exporting and Importing Data

    Exporting and Importing Data

    Roastmaster makes it easy to share key data types with other users, or a database between iOS devices.

    Exporting Data

    From the detail view of any of the supported data types, tap the action button in the upper left corner of the screen. You will be presented with the export view. Choose the method you wish to use to send the file:

    • Upload to your Dropbox account
    • Email as an attachment
    • Save the file to your Roastmaster documents folder on the iOS device, for later distribution via iTunes File Sharing

    Importing Data

    Roastmaster makes iOS aware of the file types it supports, so a data import can be initiated anywhere on your device that you encounter one of the supported files, such as a web page in Safari, your Dropbox app or email attachments. To initiate an import, simply tap the file, and choose to open in Roastmaster. Roastmaster will launch and present you with the import view.

    Details About Data Types

    Profiles

    Export: Profiles are exported as a .pfe file from the profile’s detail view. You can opt to include or exclude any snapshots associated with it.

    Import: Profile (.pfe) files can be imported into any roaster in your database as either a profile or program.

    Programs

    Export: Programs are exported as a .pge file from the program’s detail view. You can opt to include or exclude any snapshots associated with it.

    Import: Program (.pge) files can be imported into any roaster in your database as either a profile or program.

    Curves

    Export: Curves are exported as a .cve file from the curve’s detail view.

    Import: Curve (.cve) files can be imported into any profile or program.

    Roasters

    Export: Roasters are exported as a .rse file from the roaster’s detail view. The exported file will include all of the original’s profiles and programs. You can opt to include or exclude any snapshots contained in its profiles or programs.

    Import: Roaster (.rse) files are imported into the live database.

    Databases

    Export: Databases are exported as an .sqlite file from the database’s detail view.

    Import: Database (.sqlite) files are imported directly into Roastmaster’s list of databases.

    Note: some email services are not friendly to SQLITE database files, and may erroneously encode their MIME data. If you are emailing database copies as a backup, please test with your email provider to ensure that your MIME attachments are handled correctly.

    Using the database import/export feature is a great way to share a database among all of your iOS devices, or to easily create offline backup copies to protect against accidental data loss. From the home screen, tap to open the drum door, then choose “Export current database…”. Simply choose your desired destination.

    To import, simply tap the icon of the file anywhere you encounter it in iOS (for importing from Dropbox, navigate to the file in the iOS Dropbox app, tap it, then tap the action button and choose “Open in Roastmaster”.)

    When importing a database, if the name of the database is the same as the current database, Roastmaster will give you the option of replacing the current database, or renaming the imported database.

    Label Definitions

    Export: Currently unsupported

    Import: Label template (.xml) files are imported directly into Roastmaster’s list of label definitions.

  • Protect Your Data With Database Backups

    Protect Your Data With Database Backups

    Whether you’re a home roaster with a passion for the best possible coffee, or a professional shop roaster who’s livelihood depends on it, protecting your data should be high on your priority list. It certainly is on ours, and Roastmaster provides several ways to help ensure you never have to face a situation where data is lost.

    Where Does My Data Live?

    Every App in iOS is a self-contained entity living in its own personal, and protected space call a Sandbox. All of Roastmaster’s files, including its Databases, exported documents (such as Profiles, Programs, Curves, etc.), label definition files, etc. all reside in Roastmaster’s own private sandbox. Nothing can touch these files – they are secure and protected.

    As secure and simple as this paradigm is, it’s equally simple to unwittingly delete them all, forever. Here we must put our first warning…

    If you delete Roastmaster from an iOS device, all of your databases will be permanently deleted with it. The only way to get this data back is from an externally stored backup copy.

    So, How Do I Protect Against Data Loss?

    For the sake of defining whether or not a backup strategy is actually a good one, we’ll say there are two ways to store backup database files:

    Good: In an external location (your desktop Mac or PC, iCloud, Dropbox, etc.)

    Not so good: Within Roastmaster itself as a backup copy

    External Backups

    This is best way to totally protect your Roastmaster data.

    An externally stored backup copy ensures you will never be without at least a recent version of your Roastmaster database. An external backup file can be created in one of three ways.

    Roastmaster’s built-in import and export features.

    Roastmaster provides the built-in ability to easily export and import database files (.sqlite files).

    To Export the Live Database:

    1. On the home screen, open the drum door and tap “Actions”
    2. Tap “Export Current Database”
    3. Choose one of the three locations to export to:
      1. Dropbox
      2. Email
      3. Roastmaster’s Documents folder. The file can later be copied to your Mac or PC via iTunes file sharing.

    To Export a Database Other Than the Live Database

    1. On the database details screen (accessed in Utilities->Databases) tap the action button in the upper left corner of the screen
    2. Choose “Export…”
    3. Choose one of the three locations to export to:
      1. Dropbox
      2. Email
      3. Roastmaster’s Documents folder. The file can later be copied to your Mac or PC via iTunes file sharing.

    To Import a Roastmaster database:

    1. Tap on an .sqlite file in another area of iOS – this can be anywhere you might encounter a Roastmaster database – web forum, email attachment, web link, etc. For example, to import a Roastmaster database from the Dropbox App, simple navigate to the file in the Dropbox app and tap it. The details screen will appear. Tap the action button and choose “Open in Roastmaster”
    2. Roastmaster’s import screen will appear.
    3. Approve the import, deciding whether to rename or replace if a database already exists with the same name.

    iCloud backups when charging and linked to WiFi

    When iCloud is properly configured on an iOS device, all of Roastmaster’s data will be backed up to iCloud, whenever the device is charging and linked to a WiFi network. To verify that Roastmaster is being backed up with your regular iCloud backups:

    1. On your Home Screen, tap Settings
    2. Tap iCloud
    3. Tap Storage & Backup
    4. Tap Manage Storage
    5. Select the device you want to manage
    6. Verify that Roastmaster is in this list, and turned on

     iTunes backups when tethered to a Mac or PC

    iTunes can create backups of your iOS device, and app data, in one of two ways:

    • Via a sync operation if iCloud backups are not enabled on the device (otherwise, a backup is not made during a sync)
    • Via a manual backup operation, performed by right-clicking on the device in iTunes, and selecting “Back Up”, or selecting “Back Up Now” in the “Summary” tab.

    Internal Backups

    Convenient, but not a long-term backup solution.

    Roastmaster provides the ability to create local backup copies by selecting “Backup…” in the database details screen.
    A local backup file of a database is simply a copy of the database file, filed in a different directory within Roastmaster’s sandbox on the iOS device. It does NOT provide any type of external protection from device failure, accidental deletion, etc.

    This may, at first glance, seem like a useless feature. It is definitely true – this feature has no use in a GOOD permanent backup strategy. So, why does it exist? Well, a few reasons.

    1. It provides an easy way to make a quick backup if you are about to make sweeping changes in the database, and want a quick safeguard before implementing them.
    2. It facilitates Roastmaster’s automatic database upgrade functions. Whenever you download an update from the App Store, Roastmaster upgrades your databases, and automatically creates a backup copy in the unlikely event anything goes wrong.
    3. For folks who roast a lot (and I mean thousands and thousands of roasts) it provides a quick and easy way to make a copy of a database, restore it and start from scratch – eliminating old data that is of no use, but still retaining the important stuff, like the bean library, profiles, programs, etc.

    This feature does have its uses, however it should not be considered as part of a comprehensive plan to protect against accidental data loss.

  • Version 2.0

    Version 2.0

    Hi all!

    Most of you have already updated to version 2.0. Hopefully you’ve had to a chance to explore some of the new features, and find them easy to use. I was very happy with the way curves fleshed out in the long run, even if it took a bit of back-tracking in my design approach. I wanted them to be intuitive and flexible, and above all – easy to use. Sorry for the wait!

    Here’s a punch list of the new features/changes in Roastmaster 2.0…

    • Roasting Curves
    • Expanded Profiles and Programs
    • Profile and Program Snapshots
    • Benchmark Past Roast Matching Mode
    • iTunes File Sharing
    • Editable Cupping Dates
    • Post-Roast Weight Field
    • Alarm Dispatch to OS in iOS4 (so you will be notified if the phone is put to sleep)
    • Improved Roasting Graph
    • Setpoint Alerts for Active Curves
    • Bug Fixes

    A few words about iTunes files sharing… I realized after release, that this is completely undocumented, so here’s how it works. If you’re running iOS 4 and the latest iTunes, while your iPhone or iPod touch is connected, navigate to the “Apps” tab of the device in iTunes. At the bottom, in the File Sharing section, you should see Roastmaster. Select it, and you will be able to copy either the Databases or Backup Databases folder to your desktop. Inside this copied folder, you will find your Roastmaster SQLite database(s).

    If you ever have the need to copy a database back to Roastmaster, simply drag one or more database files (not the folder itself) into the root level of “Roastmaster Documents” in the iTunes window. They should end up listed with the other folders. Roastmaster will find it the next time you launch the app (it must be a fresh launch – not an awakening from background), and will import it as a live database.

    This probably goes without saying, but for those of you familiar with SQL databases, or anyone for that matter, do not modify the database outside of Roastmaster and attempt to use that copy with Roastmaster again. This feature is only intended for backing up databases for safe keeping, sharing databases, and for those that wish to broadcast or export their data to other sources.

    I plan on posting again in a few days about the immediate future plans for Roastmaster, so drop back by soon. And please let me know how the new features are working for you. I’m anxious to hear!

    Cheers

    Danny