Archives de catégorie : Anki

No porting Anki to Firefox OS

I thought about porting Anki/Ankidroid to Firefox OS, but I realized that I would be a daunting task (and not just a simple conversion from Python/Java to JavaScript). Why?

First reason: In Firefox OS, there is no native support for Sqlite, the library (and file format) used by Anki. There is a port of Sqlite done using emscripten (a C/C++ to Javascript converter), but it only operates on in-memory databases. So if you want to modify an existing Anki file, you need to load it completely in memory (mine is larger than 70Mo!), work on it, then save it completely in the end. So your modifications will not be saved after a transaction/card review, and working in memory may not fit with cheap phones.

Second reason: In Sqlite, there is an abstraction layer for I/O operations for each OS/family of OS. But it does not seem possible to create a implementation for Firefox OS… because the I/O in Firefox OS are asynchronous (when your read/write is done, it will call a callback function). And refactoring Sqlite in order to convert all the synchronous I/O calls to asynchronous calls seems an Herculean work.

What about IndexedDB? The data model of Anki is quite simple, but IndexedDB does not support joins, so it would have to be emulated with JavaScript code. Also, it will not help importing/exporting an existing Anki file…

Conclusion: From what I saw, I feel quite disappointed by the model adopted by Firefox OS, which only proposes a limited set of system API and seems quite limited for the port of existing libraries. Especially the asynchronous I/O aspect. It seems like this model is great for applications developed with Firefox OS in mind, but if you need to port an existing application… May it will get better (I hope there will be an official SQLite support)…

Résolution de dysfonctionnement avec Anthy, Anki et Firefox

Voila deux problèmes que j’ai rencontrés (et contournés) avec Anthy (permet de saisir du japonais) sous Kubuntu.

Tout d’abord, la saisie de texte japonais avec Anthy ne fonctionnait des fois tout simplement pas dans Anki lors de la création/modification d’une carte. Rageant, non?! Un contournement simple: sélectionner temporairement le champ «marqueur», puis revenir dans un des champ de la carte. Et voila, Anthy fonctionnera à nouveau!

Un autre: des fois, la barre d’URL de Firefox (un petit moteur de recherche à elle-même) ne complétait plus les caractères saisis. C’était dû à un conflit avec Anthy. Quand cela arrive, je passe en mode Anthy, puis repasse en clavier français (bépo dans mon cas). Et hop, le complètement automatique revient.

MyKanji 0.3

J’ai écrit une petite extension pour Firefox permettant de voir dans une page les kanjis que je n’ai pas encore appris. On peut l’installer depuis cette page (pas encore vérifié par Mozilla), et les sources se trouvent sur GitHub.

Comment cela fonctionne-t-il?

  • Phase 1: installation et configuration
    • installez le module
    • mettez dans le presse-papier un texte contenant les kanjis que vous connaissez. Par exemple en faisant un export texte d’un paquet Anki, et en copiant le contenu de ce fichier texte.
    • cliquez sur le bouton «文» dans la barre d’outils.
    • dans la zone de texte, coller le texte que vous avez préparé
  • Phase 2: utilisation
    • dans une page web, sélectionnez du texte ou toute la page (control-a)
    • ouvrez le menu contextuel (clic droit) et sélectionnez «Mes Kanjis»
    • vous obtiendrez la liste des kanjis inconnus, avec leur niveau