Archives de l’auteur : Fab

Greffon Anki: «Stats: Expected number of cards»

J’ai écrit un petit greffon pour Anki qui affiche le nombre de carte attendues. Ce nombre est calculé en utilisant la fréquence de chaque carte. Ainsi une carte avec une fréquence de 4 jours vaut pour 0.25 carte/jour.

Ça s’appelle « Stats: Expected number of cards ».

Un patch est aussi disponible pour Ankidroid 2, mais je ne sais pas si il sera accepté.

Mise à jour de mes paquets Anki de japonais, passage à Anki 2

J’ai mis à jour mes paquets Anki, qui sont maintenant au format Anki 2: : +210 mots et +50 kanjis.

Grâce au nouveau format, les données Anki prennent significativement moins de place. Mon paquet de vocabulaire passe de 3.6Mo à 715ko. Bravo à Damien Elmes (et aux autres éventuels contributeurs d’Anki) pour cette amélioration.

Migration Anki 2: un succès

J’ai migré depuis peu à Anki 2 et surtout Ankidroid 2. Concernant ce dernier, j’ai noté les  améliorations suivantes:

  • l’interface est plus belle
  • les crashs réguliers à la fermeture ont disparus
  • le logiciel est plus rapide, notamment la recherche de cartes

Je regrette qu’il y ait un peu moins de statistiques, mais dans l’ensemble c’est du super boulot.

Je n’ai pas encore profité des nouveautés fonctionnelles de Anki, comme la hiérarchisation des paquets, mais ça viendra.

Nexus 10: good stuff and disappointments

After a few days of use, I can say that the Nexus 10 is quite a nice device. I was a little bit disappointed that:

  • I struggled so much to login the first time using my Google account (mandatory to use the tablet). After many attempts, I could login using the browser interface (and not the native interface)
  • During these attempts, I tried to change the keyboard layout, and I found myself stuck in the keyboard configuration because the button 「back」is not present at this stage (what a stupid bug). I had to reboot to try again.
  • Transferring files using MTP (official way using USB) or FTP (limited by the wi-fi bandwidth) is super slow. Using ADB gave a descent 5Mo/s, but come on, using a debugging tool for such a thing is a shame
  • Charging the battery takes forever if you are using the device (I even wonder if it is charging at all).
  • The autonomy is not impressive
  • No cover is present in the package (my EEE-PC had one for a smaller price)
  • I had a complete freeze after starting Chrome once (I barely use it), and I am not the only one
  • These random reboots, grrrr (lost some work)
  • Sometimes, the automatic time sync get wrong by exactly 10 minutes, and the only solution is to disable it
  • Some apps look really ugly on a tablet

Now the good points:

  • Android 4 is really nice to use, not perfect, but really nice
  • Always very responsive, it doesn’t feel like a computer or a phone but like a physical object. It always reacts immediately. That is so great not to have to wait (well, excepted for network comm). On my (fast) PC, if I start Kate, I have to wait a few seconds (wait for a text-editor to start!?). On my Android phone, switching from an app to another is sometimes slow because of the lack of memory.
  • Even Firefox is fast (on my phone its start-up is slow)
  • Does not come with crap like Facebook or trial apps you will never use
  • The screen looks sooo great
  • Voice search is fun (even if it doesn’t always work well)
  • Using voice recognition (not) to type is also fun

I was a little bit sceptic at first, but I may become one of those who use their computer once in a while. Well, I will still need it to edit my Anki packets, type long emails, edit Openstreetmap, order and edit my photo, write code and things like that, but I have to admit that for the rest (browsing and reading, listening to music,  endless watching pointless streaming video) the concept is fantastic (thanks Steve).

Cygwin, xorg et clavier bépo

Sous Windows, on peut demander à xorg de supporter les claviers français et bépo en le démarrant comme ceci:

/usr/bin/startxwin -- -xkblayout fr -xkbmodel pc105 -xkbvariant "fr,bepo"

Par contre, l’option -xkboptions grp:alt_shift_toggle » ne m’a pas permise de basculer de l’un à l’autre, alors j’ai créé les alias suivants:

alias bepo='setxkbmap -layout "fr" -variant bepo'
alias fr='setxkbmap -layout "fr" -variant oss'

 

 

Golang, Openstreetmap, threads

In my previous attempt of parsing Openstreetmap data, I found parsing XML data slow. Fortunately I realized that the data was also available in Google Prococol Buffer format, and

  • it’s 30-40% smaller than bzip2 XML (and you know, bzip2 requires a fair amount of CPU power)
  • it’s much faster to parse: with Osmosis, reading a PBF file on my quad-core took 14 seconds, and reading the XML.bzip2 with the help of lbunzip2 (multi-thread decompressor) it took 1mn50s. Ouch!

There is a Go library to handle Protocol Buffers, so I tried to write a PBF reader in this language and could see how efficient it would be. My program worked like this:

  • the main thread would read blocks from the file and pass them to thread workers using a channel
  • each worker (a goroutine) would decompress the block, unmarshall the data and process it
  • when there would not be any block left to process, the results of the workers would be merged into a single image

So what kind of performance did I get? I get the best result with a number of workers equal to the number of cores + 1 (so 5 workers): about 28 seconds. I cannot compare this result with Osmosis (not all the cases are handled), but it’s quite acceptable.

I find Go a nice language to use, and it compiles very very quickly. I struggled a little bit with some points, and everything is not clear yet for me also. It feels strange not to program in a OO-way. And I can’t be sure if I have to trigger tons of goroutines or use a pool of workers, if I should pass callback functions or channels.

That’s also a pity that the tremendous performance is not there yet. It’s supposed to be «close to the metal», «a language for system programming», but for the moment (after 3 years) it is not a fast as Java.