Filed under:
Base
Releases

Base 2.4.4 is now available to download for both web and App Store users. The changes in this version are small, but significant:

  • Sandboxing is now re-enabled for App Store customers. See this blog post for more details
  • A crash-on-launch bug has been fixed
  • An interface glitch where the SQL error notice could not be dismissed has been fixed.
  • Base now requires Mac OS 10.8 or newer to run

Base 2.4.4 can be downloaded from the product page or from the Mac App Store.

As always, the full list of changes can be found in the release notes and if you’ve found a bug or have a question, please do get in touch.

Filed under:
Base
Releases

Base 2.4.3 is now available to download. This is a very important update if you are running Mac OS 10.7 and purchased Base from the Mac App Store.

This version will only be available for a short time (at the latest, 19th May 2013) and will be the last version to support Mac OS 10.7.


That sounded a bit serious, right? Here’s why:

When Base 2.4 was released, the App Store version enabled sandboxing - a security system required to be used by all updated apps on the Store. Among other things, sandboxing places very strict limits on which files an app can open. Typically this is only files which have been specifically selected by the user. However, Base needs more than that. As well as the selected database file, Base needs access to journal files. These are short-lived files which are temporarily created then deleted when making changes to the original database.

A method of getting access to these related files was added in Mac OS 10.8, so Base makes use of it and everything works smoothly. Except that due to a mistake in my testing, I didn’t realise that this method does not exist on 10.7. This means that people running Base on 10.7 could not make changes to their databases as the journal files were prevented from being created by the sandbox.

So that’s the problem in a nutshell. A mistake on my part results in Base coming up against a strict security system. The obvious answer would be to not use that system, but it’s not that simple. The app sandbox is required by Apple for all (non-bug-fix) updates to apps in the Store. Once you’ve enabled it, you are prevented from releasing an update which does not have the sandbox turned on. The system behind the Store flat-out refuses to allow it.

With slight trepidation, I contacted the App Review team at Apple with a request to temporarily opt out of the sandbox. After explaining the problem to a very helpful person, they have agreed to the following:

  • An update to Base can be released with sandboxing disabled
  • Another update must be submitted to the Store with sandboxing re-enabled by May 19th 2013

To achieve this, Base will need to remove support for Mac OS 10.7. This would have happened soon in any case, it is just unfortunate that it is occurring in this way.

Although it seems fashionable at the moment to openly criticise the app sandbox and app review systems, I do not wish to do so. The engineer at DTS who helped me add sandboxing to Base was most helpful and the person I spoke to in App Review took the time to fully understand what had happened and how I proposed to fix it. While the technology may not be perfect, the people making it appear to be working hard to get there.

Finally, though most importantly, I would like to apologize for the hassle this has caused people affected by the bug. If you have any further questions, please do get in touch.

Filed under:
Code

Lemon is a parser generator - a tool which takes a context-free grammar and converts it into code which can parse a file using that grammar. It’s a very useful tool, but can be a bit fiddly to get set up when building an app with Xcode. It’s fiddly because it’s not the grammar file which gets compiled into your app, but the code generated from it.

This post will describe how to integrate both the Lemon tool and the converting of the grammar into an Xcode build.

Sample Code

A sample project including the code from this post can be downloaded from GitHub.

Setup

You will need to add the two files required by Lemon to your project. These are lemon.c and lempar.c. The former is the generator itself and the latter is a template file for the generated code. These are under source control in the SQLite fossil repository.

Building the Lemon tool

Before we can do anything else, we need to build the Lemon tool itself. In this example, we will do it as part of building the demo app. To do this, select the project in the project navigator and add a new Run Script build phase. Drag this build phase to be the first item and enter the following command:

clang -o "${DERIVED_FILES_DIR}/lemon" "${PROJECT_DIR}/LemonDemo/lemon.c"

And add an entry to the output files table below with the text:

$(DERIVED_FILE_DIR)/lemon

Your new build phase should look like this:

Xcode build rule showing code

Now, each time you build your app, the lemon binary will be built along with it.

Creating the parser code from a grammar

Next, we have to tell Xcode how to compile the grammar files using the freshly-built tool. To do this, add a build rule to your Xcode project to build files with names matching *.lemon. In the custom script area, insert the following code:

// Copy the grammar and template files to an intermediate directory
cp "${INPUT_FILE_PATH}" "${DERIVED_FILES_DIR}"
cp "${PROJECT_DIR}/lempar.c" "${DERIVED_FILES_DIR}"

// Build the parser from the grammar
cd "${DERIVED_FILES_DIR}"
"${DERIVED_FILES_DIR}"/lemon "${DERIVED_FILES_DIR}/${INPUT_FILE_NAME}"

// Change the file extension to allow Objective-C code in the grammar
cp "${INPUT_FILE_BASE}.c" "${INPUT_FILE_BASE}.m"

This script copies the C template file and grammar to an intermediate folder and builds it using the lemon tool. It then copies the built file from a .c extension to .m so that you can use Objective-C code in your grammar file.

You will also need to enter the expected output files below the script. Here you should add the following entries:

$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).h
$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).m

This is an important step! The output files are those that will be included by Xcode when building your app. Your build rule should now look like this:

Xcode build phase showing code

Finished!

Now your project is ready to build *.lemon grammar files into a parser. As you can see, integrating generated code is not a difficult task, but one that needs a little care to make sure it works correctly. Just remember the steps in order:

  1. Build the tool
  2. Use the tool to build the parser from the grammar
  3. Use the parser in your app

If there is interest, I will follow this up with a post describing how to write a basic grammar to parse particular texts. If you want to take a peek ahead, there’s more detail in the sample code for this demo.

Filed under:
Charge
Releases

Charge icon I am very pleased to announce the release of a new app, Charge.

Charge is a handy little app for displaying your Mac notebook battery level in a clear, colourful and unobtrusive way. Once you set it running, the adjustable icon will float wherever you leave it and always show an up-to-date level of your battery. If you want specific details, double-click on the icon to show a notification with the exact percentage charge and time remaining.

Check out the full description of Charge, or purchase it on the Mac App Store.

Filed under:
Statistics

I’m sorry to announce that our iOS app Statistics for WordPress is to be discontinued.

The WordPress.com stats plugin which powers the app has been migrated to the Jetpack plugin. Alongside this, WordPress API keys which are needed to log into the stats server are to be retired. Unfortunately, the amount of work needed to update Statistics so that it works with this new system is simply too extensive to justify.

I would like Statistics to retire gracefully. To this end, I am making the app free for the remainder of the month so that anyone who wishes to download a copy can do so. On the 1st March 2013, Statistics for WordPress will be removed from sale.

For those who still want to view WordPress blog statistics on their iOS device, I recommend downloading the WordPress iOS app.

I would also like to thank all the users who have purchased Statistics and those who provided feeback and suggestion for improvement. This app was a most enjoyable project and I am sorry to see it go.

Filed under:
Base
Releases

Unfortunately, in my haste to release a fix for the crashes in Base 2.4, version 2.4.1 did not completely address the root of the problem. In order to limit the number of people downloading a broken release, I reverted back to 2.3.1 on this website and temporarily removed Base from sale on the Mac App Store.

Now, Base 2.4.2 is available for download from this website, and has been submitted to the Mac App Store for review. Once it has been reviewed, I will re-enable it for download. Once again, I apologise for the annoyance this has caused.

Base 2.4.2 can be downloaded from the product page or from the Mac App Store.

Filed under:
Base
Releases

The previous update to Base had a bug which caused a crash on launch for users running Mac OS 10.7. It did not affect users on 10.8 or newer.

Version 2.4.1 of Base fixes this bug and is available immediately for download from this site. People who have purchased Base via the Mac App Store will have to wait a little longer as the update must be approved by Apple. I have requested an expedited review, so hopefully this will not take long.

I apologize for the trouble this has caused all those affected, and encourage anyone with questions to get in touch.

Base 2.4.1 can be downloaded from the product page or from the Mac App Store.

Filed under:
Base
Releases

Base 2.4 is now available to download, for both web and App Store users. This update includes both new features and some bug fixes.

The main points for this version are a new logging system, with fast filtering and simplified preferences and improvements to the custom SQL tab. After running your own statements, you can now get a breakdown of each statements execution time.

This update also enables sandboxing for the Mac App Store version. I have decided not to enable it for the direct-sale version of Base until I am completely happy that it does not cause any issues with the App Store version. Lastly, as of this update, Base now requires Mac OS 10.7 (Lion) or newer to run.

Base 2.4 can be downloaded from the product page or from the Mac App Store.

As always, the full list of changes can be found in the release notes and if you’ve found a bug or have a question, please do get in touch.