Archive for the ‘Software’ Category

Lecture de fichier “LIT” sous Mac

Vendredi, mai 29th, 2009

Après un coup d’oeil rapide je n’ai pas trouvé de moyen de lire directement des livres électroniques au format “LIT” directement sur MAC.

Par contre, un utilitaire (binaire) en combinaison avec un petit script (applescript) font la conversion des “LIT” en format “HTML” que vous pouvez par la suite lire avec Safari ou votre navigateur préféré.

Pour obtenir plus de détails consulter les URL en commentaire dans le script suivant

(* script source : http://www.macosxhints.com/article.php?story=20060716020829624 *)
(* lit conv src : http://www.convertlit.com/index.php *)

property type_list : {}
property extension_list : {"lit"}
on open these_items
	repeat with i from 1 to the count of these_items
		set this_item to item i of these_items
		set the item_info to info for this_item
		if (folder of the item_info is false) and Â
			(alias of the item_info is false) and Â
			((the file type of the item_info is in the type_list) or Â
				the name extension of the item_info is in the extension_list) then
			process_item(this_item)
		end if
	end repeat
end open

on process_item(this_item)
	set file_path to quoted form of POSIX path of this_item
	set this_item to this_item as alias
	set file_info to info for this_item
	if name of file_info does not end with ".lit" then
		display dialog "This application only works on Microsoft .lit files that adhere to appropriate naming conventions." buttons {"Ok"} default button 1
		error number -128
	end if
	-- REMOVE THE DASHES BELOW THIS LINE
	do shell script "/bin/c-l-i-t " & file_path & " " & file_path & "_Open_eBook/"

end process_item

support Mercurial sous TextMate

Mercredi, mai 13th, 2009

Un “Bundle” existe sous TextMate (le super éditeur Mac) pour gérer les sources sous mercurial.  La façon simple de l’installer est d’exécuter le script ci-dessous qui proviens d’ici où vous retrouvez aussi une liste de Bundle disponibles.   


 

#!/bin/sh

LC_CTYPE=en_US.UTF-8
SVN=`which svn`

echo Changing to Bundles directory...
mkdir -p /Library/Application\ Support/TextMate/Bundles
cd /Library/Application\ Support/TextMate/Bundles

if [ -d /Library/Application\ Support/TextMate/Bundles/Mercurial.tmbundle ]; then
	echo Mercurial bundle already exists - updating...
	$SVN up "Mercurial.tmbundle"
else
	echo Checking out Mercurial bundle...
	$SVN --username anon --password anon co http://macromates.com/svn/Bundles/trunk/Bundles/Mercurial.tmbundle/
fi

echo Reloading bundles in TextMate...
osascript -e 'tell app "TextMate" to reload bundles'

CVS repository switch

Lundi, mars 9th, 2009

This is a simple script that change recursively the CVS repository of a project.

In this example, it changes from “-d :ext:lsabo:/gen” remote server to a local file repository “-d /cvsroots/gen”.

find * | grep Root | xargs sed -i 's/:ext:lsabo\/gen/\/cvsroots\/gen/'

PDF Half page splitting

Jeudi, février 26th, 2009

I’ve found this interresting script digging around.  As I’ve a lot of old book got scanned 2 / 1 pages and I don’t found then easy to read on my portable device I think this could be useful.

#!/bin/bash
#script:    unpnup
#        This script reformats pdf files where two portait pages
#        are joined on one landscape page (like pnup does). After
#        completion each page is on one single fullframe page
#         Copyright (c) 2007 F5 GmbH
# Author: Harald Hackenberg <hackenberggmx.at>
#
#programs required:
#           pdftk, pdftops, poster, epstopdf
#
#
#
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.  See http://www.gnu.org/copyleft/gpl.html for
# the full text of the license.
if [ "$1" == "" ] || [ "$1" == "--help" ]; then
echo
echo “Usage: `basename $0` filename”
echo
else

mkdir tmp
cd tmp
pdftk “$1″ burst
for file in pg*.pdf;
do
pdftops -eps $file
poster -v -pA4 -mA5 -c0% `basename $file .pdf`.eps > `basename $file .pdf`.tps
epstopdf `basename $file .pdf`.tps
done
pdftk pg*.pdf cat output ../`basename $1 .pdf`_unpnuped.pdf
rm *
cd ..
rmdir tmp
fi

Programmation objet

Mardi, novembre 18th, 2008

 Extrait d’une entrevue avec le créateur du langage Erlang.  Il parle de sa vision de la programmation orientée objet.
Ref: http://www.infoq.com/interviews/Erlang-Joe-Armstrong

You’ve been reading my OOP sucks blogs. I saw a blog yesterday, they said Erlang is actually more object oriented, truer to the spirit of pure object orientation than all object oriented languages. You could take two views: you could say either Erlang isn’t object oriented - which I used to say a few years ago - or you could say it’s more object oriented than all the object oriented languages. Alan Kay said that he made a mistake in not really emphasizing the messaging aspect of object oriented programming. He said in SmallTalk you talk about sending a message to an object, but you don’t, you do a function call. I think function calls and remote procedure calls are too high-level in the sense that a function call or a remote procedure call returns to the person who made it.

If I do remote procedure call against you, I can say “Hey, do this!” and the answer automatically comes back to me, but that’s not how we work. I could say “You do that” and reply to this guy. Why am I involved? That’s how we behave. If you are a manager at office you say “Can you check this out? When you’ve done it, tell this guy”. This is just an asynchronous message passing model. I think when you talk about object orientated programming, when you model a world, you are encouraged to think in terms of objects and I don’t see objects. I also have what you would call the categorization problem: which object do I put my code in? Sorry I just don’t get this. Let’s suppose you have a method, in SmallTalk terms, that manipulates time of a directory structure or something like that, is this a subclass of a time object or is it a subclass of a directory object? I don’t know.

Years ago I’ve started several projects staff - file my data/my letters, physical papers and research reports and things like that. Every time I’ve done that it failed, because I get files and I put something on this line - it says “Correspondence”, “Lectures”, “Papers”. Then I get this thing: it’s a paper, I put it in the file called papers; this is a letter which contains a paper “Do I put it in ‘Correspondence’ or do I put it in ‘Lecture notes’?”. It breaks down because I don’t know where to put it. I think if you’ve got objects in your function, which object do you put it in? I made another filing scheme, in which I just numbered everything, and I have files and I go over my office and the first file says 1-167 and the next file says 168- something. I have a single file that goes 1,2,3,4 and some text. I use emacs to create, I use grep to search, and it’s a brilliant system!

This is how we organize things in English. We have a dictionary and when we want to know what the word means, we look it up in the dictionary. Everything is in alphabetical order - that’s a good way to organize data. I think object oriented programming is not a good way to organize data. There is a principle in programming “Never write something twice” - yes, it’s a fine principle, a great principle, but let’s think about this: “How do I find the old stuff, that I am going to reuse?” That becomes extremely difficult, in fact, I think people have been deluded into thinking that this choice is easy. When I started programming, there were no choices, I programmed everything in Fortran - Fortran was the only language I had on my machine. Nowadays, some poor sod’s got to choose the programming language: “Should I have Java or C# or C++ or Lua or F# or Pascal or Prologue or Erlang or Haskell? On what should I do it?” “You don’t want something in the-NET framework or a Java framework that runs on the JVM or on Mac OSX?”

You have all these decisions, incredibly difficult to make, and then you got bosses. You don’t write this stuff in scratch! You got to reuse somebody else’s code. After all that is. Somebody else’s code doesn’t do exactly what you want - it does something that’s subtly different. Then, the time taken to modify and understand this old code takes an incredible amount of time. Have you ever sat there with code that somebody else has written and have to modify it? You spend hours and hours doing it. You can’t reuse object oriented code, because all the stuff it inherited has to be there as well. You can’t just take this stuff out and put it in your program cut and paste, like you did in C, or Erlang or Prologue or Perl, you got to take all the stuff it inherits from.

One of the problems I had with object oriented programming, one guy said: “You wanted a banana but what you got was a gorilla that was holding the banana and the entire jungle. You got a lot of stuff in it and all you wanted was just a little bit of code”. The Lisp idea - lots of little functions - ubiquitous data structures like Lists, everywhere, and lots of very small functions that work on this, that these are highly reusable. Code that’s referentially transparent, that means if you call it twice with the same arguments, you get the same value - it’s very reusable. To them the question is “How do we reorganize all this stuff? I think something like a dictionary, like the English dictionary, put in alphabetical order. Don’t put lots of modules, just put one module! If code is referentially transparent, it’s small functions, then it doesn’t belong to object. Where does it belong? What is the containing object? There isn’t one! So, just put them all in alphabetical order and use Google to search it and you’ll find the code easily.

REST, RESTFull, RESTLess the saga

Lundi, octobre 20th, 2008

Un bon vieux principe élémentaire du web.. un URL c’est supposé être un document.

Du Full REST (et même du rest less) implique donc qu’un URL correspond à 1 document et soit “cachable”.

La nomenclature d’une URL du type

http://”HOST_NAME”/usedcar/fullloadbygeocoordinates?lat=43.345&long=-79.801&dist=250

serait donc fautive.. il faudrait utiliser un format

GET http://…./fullloadbygeocoordinates/43.345,-79.801

pour être plus conforme.

Cependant l’utilisation avec des paramètres pourrait être faite en utilisant préalablement un POST pour créer un document

POST http://”HOST_NAME”/usedcar/fullloadbygeocoordinates?lat=43.345&long=-79.801&dist=250

qui retournerai l’URL d’un nouveau document créé en utilisant les coordonnées en paramètre et par la suite appellé en GET

GET http://….url retourné… ?page=1&encoding=json
Ce nouveau document peut être référé par plusieurs requêtes POST avec plus ou moins de précisions sur les coordonnées, permet de faire varier l’ordre des paramètres, etc.  Ce nouveau document est également référençable et “cachable”.

L’utilisation de l’URL fautive (avec les lon/lat en paramêtre dans la requête GET) devrait au moins retourner une redirection (302) sur un URL correctement forgé avec les coordonnées dans l’URL comme référence au nom du document et non pas en paramètre.

Mac Os X - Barre d’application

Dimanche, septembre 21st, 2008

Saviez-vous qu’on peut retirer facilement des icones de la barre d’application au haut (par défaut) dans Os X?  Il suffit de cliquer dessus en maintenant la touche commande (la pomme) enfoncée et de “dragger” les icones hors de la basse.  C’est de cette manière dont je me suis débarassé de l’icone de “mobile me” que je n’ai jamais demandé de voir apparaître!.L’on peut également de cette manière, réorganiser les icones présentes dans la barre en les déplaçant sur la barre. 

Agile - Scrum

Jeudi, juillet 10th, 2008
Mais qu’est-ce que c’est que ça Agile et Scrum?
Selon WikiPedia:
 

Scrum est une méthode agile pour la gestion de projets.
 

et

La notion de méthode agile se limite actuellement aux méthodes ciblant le développement d’une application informatique. Ces méthodes Agiles permettent de concevoir des logiciels en impliquant au maximum le demandeur (client), ce qui permet une grande réactivité à ses demandes. Les méthodes agiles se veulent plus pragmatiques que les méthodes traditionnelles. Elles visent la satisfaction réelle du besoin du client, et non d’un contrat établi préalablement. La notion de méthode agile est née à travers un Manifeste Agile signé par 17 personnalités.”

J’ai essayer de trouver quelques liens intéressants sur le sujet.

En premier, voici deux podcasts (en anglais) dont l’un avec un des ”inventeurs” du scrum.



Et voici les autres

Il y a également plusieurs volumes intéressants et d’autres liens pertinents.

iPod Touch - Note/GTD Applications

Lundi, mai 19th, 2008

J’ai récemment essayé plusieurs applications.  Particulièrement dans le but de trouver quelque chose qui se rapproche de la méthode GTD pour organiser les tâches à faire.  Parmi mes critères, il devait rouler sur le iPod Touch, mais également se synchroniser avec mon portable et/ou d’autres ordinateurs.  Idéalement la synchronisation pourrait se faire par réseau sans fil (wifi) et non pas avec le cable USB.  De plus, il ne devait pas s’agir d’application web (qui ne fonctionne pas s’il n’y a pas de réseau comme durant l’épicerie). Celle dont je me rappelle:

  •  Todo
  • MobileToDoList
  • ShopList
Finalement j’ai opté (temporairement) pour l’utilisation de l’application native de note (qui ressemble à des petits post-it jaunes) du ipod jumelé avec une application web qui permet de consulter et modifier les notes via une interface web à partir d’autres appareils connectés sur le même réseau sans-fil.
  • RemoteNote
Il y a également plusieurs application web de disponibles mais elle ne répondaient pas à mes critères de base.
 

Ipod Touch password change

Lundi, mai 19th, 2008

Il m’a été recommandé de ne pas changé le mot de passe ‘root’ de mon ipod touch.  Cela sous prétexte que la fonction ‘passwd’ serait brisée.  Mais puis-je vraiment laisser mon appareil ouvert à tous avec un mot de passe connu? Et non!  Après quelques recherche, j’ai trouvé que l’on peut changer le mot de passe manuellement en modifiant le fichier ‘/etc/master.passwd’.  Pour trouver le contenu a y placer, utiliser la fonction suivante: 

perl -e 'print crypt("MonNouveauMotDePasse", "/s");' 

  Vous n’avez qu’a copier-coller le résultat. Source