Blog

Game Controllers

With all the fuss about the new look in iOS 7, has anybody noticed Apple is also adding a standard API for game controllers?

It might seem banal, but I’d be surprised if this is not a prelude to apps (and games) running on the Apple TV.

MeoTempo

For about two years now, I’ve been working part-time on an iOS project with a small team of people. The app is structured as a calendar, but unlike other calendar apps this one tells you how much time you have left, how much time you’ve planned and spent on things, and it comes with a tool to track what you’re doing right now (giving you later a history of how you spent your time).

I’m not going to detail what the app can do here. It was released last week, so just go take a look.

For this app I built a synchronization engine. Each device running the app has an independent copy of the database, and each time it connects to our servers, databases are merged together and changes are propagated to other devices. The way it works is interesting, so I’ll elaborate a little.

Our synchronization system is built in a similar way to distributed version control systems (Git, Mercurial, etc.). It has a repository layer used to syncs binary data blocks with other repositories. On top of this the app maintains a SQLite database corresponding to the model. Changes in the local repository are kept in sync with the model database. Changes in the local repository are also pushed to the remote one, and vice versa. And there your iPhone syncs with your iPad.

This systems has two interesting properties in common with DVCS. First, if one repository is lost (whether on the server or on a device), it can be reconstructed from the others. Second, in theory we could do peer-to-peer sync too without a central server even though in practice managing peer-to-pear communications is more complicated and nothing has been done on this front.

It’s interesting to note that the model database is basically a cache of what is in the repository. Whenver the schema for the model database changes (when updating the app for instance), we don’t have to migrate any data: we get rid of the previous model database and rebuilt it from the local repository, just like when syncing.

All in all, I’m quite happy with this system. It took some time to build, there’s still some rough edges, but it was really worth the effort. Give MeoTempo a try if you want to see it in action.

PHP Markdown Lib

It’s time for PHP Markdown to become a mature well-packaged PHP library instead of a hybrid file that tries to be everything for everyone.

Today, I’m announcing the Lib branch of PHP Markdown. It contains the two exact same parsers found in PHP Markdown and PHP Markdown Extra, but without all the cruft. It is packaged to be used as a library, and only as a library. The two parsers classes are in the Michelf namespace:

\Michelf\Markdown
\Michelf\MarkdownExtra

Yep, a namespace, so it requires PHP 5.3 or later.

The Lib branch is PSR-0 compliant to allow autoloading of its parser classes. It’s also a Composer package made available on Packagist.

Three Branches

So, right now there are three branches of PHP Markdown. Here’s a summary of each:

PHP Markdown
The original PHP Markdown is the one implementing the Markdown syntax specification. It includes a global Markdown function, a parser class, as well as various plugin interfaces for Wordpress, Smarty, for replacing the Textile parser.
PHP Markdown Extra
The Extra branch has been added quite a while ago to extend the core Markdown syntax with other useful things. It’s implemented as a second parser class derived from the PHP Markdown parser’s, and packaged exactly the same way in a single file with the various plugin interfaces.
PHP Markdown Lib
The Lib branch is a new one aimed at being a modern PHP library people can use to integrate in various things. Contrary to the other two, it does not contain any plugin code. It requires PHP 5.3 or later because it makes use of namespaces.

PHP Markdown Lib starts at version 1.3. I wanted to start over at 1.0, but that’d have made bug reports about a specific version of PHP Markdown harder to understand (people often don’t say or know which branch they’re using), hence why there’s a separate version number.

Moving forward

Next year, in 2014, only the Lib branch will continue to be updated.

The original PHP Markdown and PHP Markdown Extra distributions will continue to be available on the classic version page, but starting next year updates containing bug fixes and new Extra features will go exclusively to the Lib branch.

If like many of you you’ve been using PHP Markdown as a Wordpress plugin, you can still continue to rely on it, it is unlikely to stop working anytime soon. The reality however is that I do not have the time to keep improving things for Wordpress as it evolves. Time passed, and now many other plugins based on PHP Markdown but with better integration have appeared. I do not have a recommendation to make at this time, but feel free to let me know if you have one as I might write a follow-up on that topic.

Ditching support for older versions of PHP will simplify the maintenance work and will enable usage of newer PHP constructs in the code. Getting rid of the Wordpress plugin part will let me worry about things which are more related to the parser side of things.

It’s time for PHP Markdown to become a mature well-packaged PHP library instead of the strange hybrid it has been for many years. Therfore, starting today, the Lib version now takes the front row on the updated PHP Markdown webpage. Let me know if you have any question.

Aaron Swartz, slices of an inbox

Aaron Swartz, 2004, Markdown-Discuss mailing list:

Jelks Cabaniss:

Will there by a way do allow the “implicit link name” syntax to do without the following [] brackets? In other words, like [this] instead of like [this][]?

That was my original idea, but Gruber was concerned it would be too easily tripped, e.g. in:

Condi said, "[The President] loves his job."

Turns out that your idea, like many others, is now implemented everywhere. Thank you for your ideas.


Aaron Swartz, 2006, seeking advice about porting PHP Markdown to Python:

Eek. Everything I try to run this regular expression through goes into some sort of infinite loop:

'/^(?:[^`]+|(`+)(?:[^`]+|(?!\1[^`])`)*?\1(?!`))*$/s'

(it’s the balanced ` matching thing…)

The regular expressions used to implement Markdown would madden anyone. I’m glad I could help.


Aaron Swartz, 2008, finding something wrong with my website:

I think you mean “markdown” not “makrdown”

Oops!


Rest in peace Aaron. We weren’t talking that much, but I’ll miss you.


P.S.: Someone ought to find a way to fix that farce of a justice system.


Archive