Programmation
Thursday, 19 September 2013
|
Écrit par
Grégory Soutadé

Nokia 7373

After 6 years of wonderful services I decided to change my superb Nokia 7373 by a Nexus 4 (thanks to the last price down). Welcome to the 21th century with a big smartphone running Android. One problem : how to transfer my contacts from Nokia to Android ? After reading some articles on the net I didn't find any simple solution. So I developped a perl script that will convert contacts extracted from Nokia Suite to vCad format (.vcf). The procedure is bellow :

  • Extract your contacts with Nokia Suite into a CSV file
  • Run this script (you can see help with -h switch)
  • Copy vcf files to your phone (you can copy them in DCIM directory if you have a Nexus 4, it works)
  • Go to "contact" application and import all vcf files

Now you can use your mobile phone as before. Personally I deactivated contact synchronisation because I do not want to give phone numbers of my friends to Google (even if I suppose it already has). *Beware* this script has been developped for French people : default call prefix is +33 (you can change it) and a cell phone numbers starts with 6 in France (you can change it). If you're in another country you may have to tweak it. Currently it can extract first name, last name, phone numbers and email. Have fun !

Nexus 4

Friday, 06 September 2013
|
Écrit par
Grégory Soutadé

Au boulot, je suis souvent amené à lire du binaire. Sous GNU/Linux, il y a l'utilitaire hexdump. S'il est très pratique, je ne supporte pas le formatage par défaut (8 colonnes, 2 octets par colonne, big endian), lui préférant celui d'EMACS (qui est bien plus naturel). En cherchant ici et là, j'ai trouvé comment avoir un résultat un peu plus sympa :

Simple formatage 16 colonnes, 1 octet par colonne

hexdump -v -e '16/1 "%02x " "\n"' test
cd 7d 3a 34 2f 9c b7 17 b2 46 0f 13 96 dc 29 2c
a7 38 15 c1 40 74 07 1d 34 c8 a2 c6 01 e8 ff e1
0c 52 72 66 4c 6d 55 9a 13 9a 3c fb 09 cc f8 5e

Simple formatage 16 colonnes, 2 octets par colonne (affichage big endian)

hexdump -v -e '16/2 "%04x " "\n"' test
7dcd 343a 9c2f 17b7 46b2 130f dc96 2c29 38a7 c115 7440 1d07 c834 c6a2 e801 e1ff
520c 6672 6d4c 9a55 9a13 fb3c cc09 5ef8 c8b5 f747 c076 3a64 4363 ba02 3cc3 b899
2fdd 0c04 15f0 26fc 4840 de08 5682 0795 f938 dfbd 97e0 6219 4dc1 bd11 a217 48a2

Simple formatage 16 colonnes, 4 octets par colonne (affichage big endian)

hexdump -v -e '8/4 "%08x " "\n"' test
343a7dcd 17b79c2f 130f46b2 2c29dc96 c11538a7 1d077440 c6a2c834 e1ffe801
6672520c 9a556d4c fb3c9a13 5ef8cc09 f747c8b5 3a64c076 ba024363 b8993cc3
0c042fdd 26fc15f0 de084840 07955682 dfbdf938 621997e0 bd114dc1 48a2a217
0b2a4ba6 92e126e3 41b390bb c6715665 513d27ce ac133bf9 c4110439 2617d3eb
6be79814 3c87391d 950461d9 e4fc7027 dcd0bf46 0d690fdc eb5b68d7 3d5d0bee
8d78785d 97e315ee f801f1ac b1d8247a 02bd5328 91acb913 0f6b4024 8eadb09d

Avec l'affichage des adresses

hexdump -v -e '"%08_ax " ' -e '16/1 "%02x " "\n"' test
00000000    cd 7d 3a 34 2f 9c b7 17 b2 46 0f 13 96 dc 29 2c
00000010    a7 38 15 c1 40 74 07 1d 34 c8 a2 c6 01 e8 ff e1
00000020    0c 52 72 66 4c 6d 55 9a 13 9a 3c fb 09 cc f8 5e
00000030    b5 c8 47 f7 76 c0 64 3a 63 43 02 ba c3 3c 99 b8

Affichage par octet sans retour à la ligne

hexdump -v -e '/1 "%02x "' test
cd 7d 3a 34 2f 9c b7 17 b2 46 0f 13 96 dc 29 2c a7 38 15 c1 40 74 07

Avec l'affichage des caractères

head -n 3 gpl-3.0.txt| hexdump -e '8/1 "%02X " "\t\t"' -e '8/1 "%c" "\n"'
20 20 20 20 20 20 20 20                
*
20 20 20 20 47 4E 55 20            GNU
47 45 4E 45 52 41 4C 20        GENERAL
50 55 42 4C 49 43 20 4C        PUBLIC L
49 43 45 4E 53 45 0A 20        ICENSE

Variante (sans les étoiles)

head -n 3 gpl-3.0.txt| hexdump -v -e '8/1 "%02X " "\t\t"' -e '8/1 "%c" "\n"'
20 20 20 20 20 20 20 20                
20 20 20 20 20 20 20 20               
20 20 20 20 47 4E 55 20            GNU
47 45 4E 45 52 41 4C 20        GENERAL
50 55 42 4C 49 43 20 4C        PUBLIC L
49 43 45 4E 53 45 0A 20        ICENSE

On peut ainsi combiner les formatages à l'infini pour avoir le résultat souhaité !

Wednesday, 12 June 2013
|
Écrit par
Grégory Soutadé

Fenêtre principale de KissCount

Sortie annuelle de KissCount. Pour ceux qui ne s'en souviennent pas, il s'agit d'un logiciel de comptabilité personnelle dont l'objectif est d'être le plus simple possible : je l'ouvre, je rentre les données (dans une seule fenêtre), je le ferme. Des versions (.deb) pour i386 et amd64 ainsi que pour Windows sont disponibles. Cette version marque une certaine maturité du projet. En effet, les changements sont assez peu nombreux :

  • Ré écriture du composant principal (grille)
  • Export au format CSV
  • Icônes basse résolution
  • Affichage des statistiques dans la recherche
  • Quelques bugs en moins


Quid de la suite ? Probablement une migration vers Qt5. Pour le moment il n'y a pas de nouvelles fonctionnalités de prévu.

Thursday, 18 April 2013
|
Écrit par
Grégory Soutadé

If I often compile under emacs, I use a lot the terminal. Most of people ignore how it's fast and practical to work, not for every tasks but it's perfect for programing. I already talks about Autojump2, today I will present colout. It's true that the terminal miss some colors. For better displays I personaly use black over white, but when you compile some projects, it's hard to see if errors happens.

I tweak colout (written by nojhan) to fit my needs. It's a simple Python software that will color terminal output if it found specific words. The list of words is fix and embedded into the script (unlike the original one that takes them in parameter). My script is available here.

You only need to add colout file into a bin directory (referenced in your $PATH) and edit your .bashrc with (don't forget to make it executable) :

function make() { /usr/bin/make "$@" 2>&1 | colout ;}

So, when you type "make", it will transparently use colout. The only bad thing is that you loss make's returns value.

Example with :

int main() { int a, b; b = a+1; c = a; return 0; }

colout result

It's better, isn't it ?

Sunday, 24 March 2013
|
Écrit par
Grégory Soutadé

Ready for PIC board

Some weeks ago I bought a "Ready for PIC" board from MikroElektronika. These board comes with a PIC18F25K22 flashed with a bootloader that receives a program from UART and load it in memory without flashing. The prototype area is very nice for peoples that do not want to weld, it also contains a FTDI chip and can be powered by USB. Plus MikroElektronika supply a GUI software to interact with the bootloader. These GUI is available for Windows and Linux, that's great ! Contrary to microchip, MikroElektronika wants to sell their expensive C/BASIC/Pascal compiler and provide cool boards at a good price. The only thing I regret is that you cannot reset the PIC with the FTDI, you need to press the reset button before and after code is downloaded (so boring...).

Maybe the GUI is useful for electronics peoples, but I found it (on Linux) heavy and sometimes buggy. Moreover you cannot access to serial output just after code is downloaded. So, I wrote a simple console Python program that will download an HEX file with command line and optionally displays the output of UART. This allows to do quicker and simpler tests. You can find the file here, it's licensed under GPL v3.