$ python notes.py --de 25 --vers 20 --pas 0.25 | column -c 80
0.00 => 0.00 5.25 => 4.20 10.50 => 8.40 15.75 => 12.60 21.00 => 16.80
0.25 => 0.20 5.50 => 4.40 10.75 => 8.60 16.00 => 12.80 21.25 => 17.00
0.50 => 0.40 5.75 => 4.60 11.00 => 8.80 16.25 => 13.00 21.50 => 17.20
0.75 => 0.60 6.00 => 4.80 11.25 => 9.00 16.50 => 13.20 21.75 => 17.40
1.00 => 0.80 6.25 => 5.00 11.50 => 9.20 16.75 => 13.40 22.00 => 17.60
1.25 => 1.00 6.50 => 5.20 11.75 => 9.40 17.00 => 13.60 22.25 => 17.80
1.50 => 1.20 6.75 => 5.40 12.00 => 9.60 17.25 => 13.80 22.50 => 18.00
1.75 => 1.40 7.00 => 5.60 12.25 => 9.80 17.50 => 14.00 22.75 => 18.20
2.00 => 1.60 7.25 => 5.80 12.50 => 10.00 17.75 => 14.20 23.00 => 18.40
2.25 => 1.80 7.50 => 6.00 12.75 => 10.20 18.00 => 14.40 23.25 => 18.60
2.50 => 2.00 7.75 => 6.20 13.00 => 10.40 18.25 => 14.60 23.50 => 18.80
2.75 => 2.20 8.00 => 6.40 13.25 => 10.60 18.50 => 14.80 23.75 => 19.00
3.00 => 2.40 8.25 => 6.60 13.50 => 10.80 18.75 => 15.00 24.00 => 19.20
3.25 => 2.60 8.50 => 6.80 13.75 => 11.00 19.00 => 15.20 24.25 => 19.40
3.50 => 2.80 8.75 => 7.00 14.00 => 11.20 19.25 => 15.40 24.50 => 19.60
3.75 => 3.00 9.00 => 7.20 14.25 => 11.40 19.50 => 15.60 24.75 => 19.80
4.00 => 3.20 9.25 => 7.40 14.50 => 11.60 19.75 => 15.80 25.00 => 20.00
4.25 => 3.40 9.50 => 7.60 14.75 => 11.80 20.00 => 16.00
4.50 => 3.60 9.75 => 7.80 15.00 => 12.00 20.25 => 16.20
4.75 => 3.80 10.00 => 8.00 15.25 => 12.20 20.50 => 16.40
5.00 => 4.00 10.25 => 8.20 15.50 => 12.40 20.75 => 16.60
J'entrepose ici mes découvertes linux, bash, python et java que je souhaite partager et mettre de côté...
samedi 17 décembre 2011
Mise en colonnes en shell
Une petite commande plutot sympa pour afficher des résultats en colonnes et tout voir sur l'écran du terminal !
jeudi 1 décembre 2011
Droits sql...
Pour générer les commandes SQL adéquates pour 3 types d'utilisateurs de la BD avec les grant mysql qui vont bien.
grant insert select on mysql user privileges flush
mardi 29 novembre 2011
Moteur de recherche dans navigateur
Il est relativement simple de permettre à un site web de proposer un moteur de recherche dans le navigateur d'un client...
Pour cela il faut proposer un fichier mysearch.xml
Et le proposer dans votre page html via la balise link
Pour cela il faut proposer un fichier mysearch.xml
Et le proposer dans votre page html via la balise link
open search description moteur recherche navigateur
Petit serveur de pages statiques sur sa machine perso...
Installation d'apache :
Pages statiques :
Ouvrir le browser
http://127.0.0.1/~me/hello.html
:)
$ apt-get install apache2
$ cd /etc/apache2/mods-enabled/
$ sudo ln -s ../mods-available/userdir.conf .
$ sudo ln -s ../mods-available/userdir.load .
$ sudo /etc/init.d/apache2 reload
Pages statiques :
$ mkdir ~/public_html
$ echo 'hello' > ~/public_html/hello.html
Ouvrir le browser
http://127.0.0.1/~me/hello.html
:)
vendredi 25 novembre 2011
Tri de numéros de version
$ cat ~/a
9.1.1
9.4.14
9.4.6
$ export LC_ALL=C ; cat ~/a | sort -t. -n -k1 -k2 -k3
9.1.1
9.4.14
9.4.6
=> pas bon
$ export LC_ALL=fr_FR.UTF-8 ; cat ~/a | sort -t. -n -k1 -k2 -k3
9.1.1
9.4.6
9.4.14
=> bon
$ export LC_ALL=C ; cat ~/a | sort -t. -k1,1n -k2,2n -k3,3n
9.1.1
9.4.6
9.4.14
=> bon
Sinon si l'option est disponible (version récente de la commande)
cat ~a | sort --version
mercredi 23 novembre 2011
mardi 22 novembre 2011
encoding
Hudson crie !
C'est dû à l'encoding qui n'est pas le bon lors de la lecture du fichier.
Il ouvre en ISO-8859-1 alors que c'est de l'UTF-8.
Solution :
Référence : http://www.jmdoudoux.fr/java/dej/chap-encodage.htm
[line 4: the character at position 51 is not allowed
[Demande(0,0,affichage);INCOMPLET;;OUI;pour un problème d'affichage.;;], ...
C'est dû à l'encoding qui n'est pas le bon lors de la lecture du fichier.
Il ouvre en ISO-8859-1 alors que c'est de l'UTF-8.
Solution :
BufferedReader reader = new BufferedReader(new InputStreamReader(
new FileInputStream(f.getAbsolutePath()), "UTF-8"));
Référence : http://www.jmdoudoux.fr/java/dej/chap-encodage.htm
vendredi 18 novembre 2011
mardi 15 novembre 2011
Recompile with -Xlint:unchecked
[javac] Note: src/main/java/com/orange/mbs/aiguilleur/ws/WsConfiguration.java
uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
La solution...
<target name="compile" description="Compilation of the overall project">
<mkdir dir="${classes.dir}">
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="on" optimize="off"
deprecation="on" source="1.5" target="1.5">
<classpath refid="classpath">
<compilerarg value="-Xlint:unchecked">
</compilerarg></classpath></javac>
</mkdir></target>
jeudi 3 novembre 2011
emacs
Fichier ~/.emacs
Fichier ~/.emacs.d/themes/color-theme-blackboard.el
(require 'color-theme)
(load-file "~/.emacs.d/themes/color-theme-blackboard.el")
(color-theme-blackboard)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(setq column-number-mode t)
(setq line-number-mode t)
(setq inhibit-startup-message t)
;; ==================== KEYS ====================
;; already bind via simple.el
;; (global-set-key [home] 'beginning-of-line)
;; (global-set-key [end] 'end-of-line)
;; (global-set-key [backspace] 'backward-delete-char-untabify)
;; (global-set-key [(control space)] 'set-mark-command)
;; (global-set-key [(control insert)] 'kill-ring-save)
;; (global-set-key [(shift insert)] 'yank)
;; (global-set-key [(control home)] 'beginning-of-buffer)
;; (global-set-key [(control end)] 'end-of-buffer)
;; (global-set-key [(control left)] 'backward-word)
;; (global-set-key [(control right)] 'forward-word)
;; (global-set-key [(control o)] 'open-line)
;; already bind via paragraphs.el
;; (global-set-key [(control down)] 'forward-paragraph)
;; (global-set-key [(control up)] 'backward-paragraph)
(defun beginning-of-page () (interactive) (move-to-window-line 0))
(defun end-of-page () (interactive) (move-to-window-line -1))
(global-set-key [(control kp-begin)] 'move-to-window-line)
(global-set-key [(control kp-down)] 'end-of-page)
(global-set-key [(control kp-up)] 'beginning-of-page)
(defun delete-char-or-region() (interactive) (if mark-active (delete-region (point) (mark)) (delete-char 1)))
(global-set-key [delete] 'delete-char-or-region)
(global-set-key [(control return)] 'newline-and-indent)
(global-set-key [(control delete)] 'kill-region)
(global-set-key [?\e ?s] 'point-to-register) ;; M-s
(global-set-key [?\e ?r] 'jump-to-register) ;; M-r
(global-set-key [?\e backspace] 'backward-kill-word)
(global-set-key [?\e delete] 'kill-word)
(global-set-key [?\e ?g] 'goto-line)
(global-set-key [M-return] 'kill-this-buffer)
(global-set-key [(control >)] 'bs-cycle-next)
(global-set-key [(control <)] 'bs-cycle-previous)
(global-set-key [f5] 'linum-mode)
(global-set-key [f6] 'menu-bar-mode)
(global-set-key [f8] 'next-error)
(global-set-key [f9] 'compile) ;;my-compile-or-tramp-compile)
(defun move-region (start end n)
"Move the current region up or down by N lines."
(interactive "r\np")
(let ((line-text (delete-and-extract-region start end)))
(forward-line n)
(let ((start (point)))
(insert line-text)
(setq deactivate-mark nil)
(set-mark start))))
(defun move-region-up (start end n)
"Move the current line up by N lines."
(interactive "r\np")
(move-region start end (if (null n) -1 (- n))))
(defun move-region-down (start end n)
"Move the current line down by N lines."
(interactive "r\np")
(move-region start end (if (null n) 1 n)))
(defun move-line (n)
"Move the current line up or down by N lines."
(interactive "p")
(setq col (current-column))
(beginning-of-line) (setq start (point))
(end-of-line) (forward-char) (setq end (point))
(let ((line-text (delete-and-extract-region start end)))
(forward-line n)
(insert line-text)
;; restore point to original column in moved line
(forward-line -1)
(forward-char col)))
(defun move-line-up (n)
"Move the current line up by N lines."
(interactive "p")
(move-line (if (null n) -1 (- n))))
(defun move-line-down (n)
"Move the current line down by N lines."
(interactive "p")
(move-line (if (null n) 1 n)))
(defun move-line-region-up (start end n)
(interactive "r\np")
(if (region-active-p) (move-region-up start end n) (move-line-up n)))
(defun move-line-region-down (start end n)
(interactive "r\np")
(if (region-active-p) (move-region-down start end n) (move-line-down n)))
(global-set-key [(meta up)] 'move-line-region-up)
(global-set-key [(meta down)] 'move-line-region-down)
;;; Déplacements entre buffers ************************************************
;;; Affichage du nom du fichier dans minibuffer *******************************
(global-set-key [(meta left)] 'goto-previous-buffer)
(global-set-key [(meta right)] 'goto-next-buffer)
(defun goto-next-buffer ()
""
(interactive)
(let ((l (reverse (buffer-list)))
(buf (current-buffer))
(regexp "^ ?\\*.*\\*$")
)
(while (progn
(if l nil
(switch-to-buffer buf)
(error "No buffer to show"))
(switch-to-buffer (car l))
(message (buffer-file-name))
(setq l (cdr l))
(string-match regexp (buffer-name (current-buffer)))))))
(defun goto-previous-buffer ()
""
(interactive)
(let ((n (length (buffer-list)))
(k 0)
(buf (current-buffer))
(regexp "^ ?\\*.*\\*$")
)
(while (progn
(setq k (1+ k))
(if (<= k n) nil
(switch-to-buffer buf)
(error "No buffer to show"))
(bury-buffer)
(message (buffer-file-name))
(string-match regexp (buffer-name (current-buffer)))))))
;;; deplacement entre frames **************************************************
(global-set-key (kbd "")
'(lambda () (interactive)
(message (buffer-file-name)) (other-window -1)))
(global-set-key [(control tab)]
'(lambda () (interactive)
(message (buffer-file-name)) (other-window 1)))
;;; Acces par REGEXP dans C-x b ***********************************************
(iswitchb-mode t)
(iswitchb-default-keybindings)
(defun iswitchb-system-buffers-to-end ()
""
(let ((files (delq nil (mapcar
(lambda (x)
(if (or
(string-match "Summary" x)
(string-match "^ ?\\*.*\\*$" x))
x))
iswitchb-temp-buflist))))
(iswitchb-to-end files)))
(add-hook 'iswitchb-make-buflist-hook 'iswitchb-system-buffers-to-end)
(message "main is loaded")
Fichier ~/.emacs.d/themes/color-theme-blackboard.el
(defun color-theme-blackboard ()
"Color theme"
(interactive)
(color-theme-install
'(color-theme-blackboard
((background-color . "black")
(background-mode . dark)
(border-color . "black")
(cursor-color . "#A7A7A7")
(foreground-color . "#F8F8F8")
(mouse-color . "sienna1"))
(default ((t (:background "#000000" :foreground "#F8F8F8"))))
(font-lock-builtin-face ((t (:foreground "#F8F8F8"))))
(font-lock-comment-face ((t (:italic t :foreground "#AEAEAE"))))
(font-lock-constant-face ((t (:foreground "#D8FA3C"))))
(font-lock-doc-string-face ((t (:foreground "DarkOrange"))))
(font-lock-function-name-face ((t (:foreground "#FF6400"))))
(font-lock-keyword-face ((t (:foreground "#FBDE2D"))))
(font-lock-preprocessor-face ((t (:foreground "Aquamarine"))))
(font-lock-reference-face ((t (:foreground "SlateBlue"))))
(font-lock-regexp-grouping-backslash ((t (:foreground "#E9C062"))))
(font-lock-regexp-grouping-construct ((t (:foreground "red"))))
(font-lock-string-face ((t (:foreground "#61CE3C"))))
(font-lock-type-face ((t (:foreground "#8DA6CE"))))
(font-lock-variable-name-face ((t (:foreground "#FF6400"))))
(font-lock-warning-face ((t (:bold t :foreground "Pink"))))
(gui-element ((t (:background "#D4D0C8" :foreground "black"))))
(region ((t (:background "#253B76"))))
(mode-line ((t (:background "grey75" :foreground "black"))))
(highlight ((t (:background "#222222"))))
(highline-face ((t (:background "SeaGreen"))))
(italic ((t (nil))))
(left-margin ((t (nil))))
(text-cursor ((t (:background "yellow" :foreground "black"))))
(toolbar ((t (nil))))
(underline ((nil (:underline nil))))
(zmacs-region ((t (:background "snow" :foreground "ble")))))))
Cette configuration requiert
le paquet suivant : emacs-goodies-el
lundi 17 octobre 2011
mercredi 31 août 2011
Mysql: afficher requête en ligne
select * from flashes\G
*************************** 1. row ***************************
id: 1
etape: BRANCHE_MOTIF
dateCreation: 2011-08-29 14:27:45
dateDebut: 2011-08-04 00:00:00
dateFin: NULL
active: oui
*************************** 2. row ***************************
id: 2
etape: AC
dateCreation: 2011-08-29 14:43:22
dateDebut: 2011-08-03 00:00:00
dateFin: NULL
active: oui
*************************** 3. row ***************************
id: 3
etape: BRANCHE_MOTIF
dateCreation: 2011-08-29 14:46:28
dateDebut: 2011-08-05 00:00:00
dateFin: NULL
active: oui
*************************** 1. row ***************************
id: 1
etape: BRANCHE_MOTIF
dateCreation: 2011-08-29 14:27:45
dateDebut: 2011-08-04 00:00:00
dateFin: NULL
active: oui
*************************** 2. row ***************************
id: 2
etape: AC
dateCreation: 2011-08-29 14:43:22
dateDebut: 2011-08-03 00:00:00
dateFin: NULL
active: oui
*************************** 3. row ***************************
id: 3
etape: BRANCHE_MOTIF
dateCreation: 2011-08-29 14:46:28
dateDebut: 2011-08-05 00:00:00
dateFin: NULL
active: oui
mercredi 17 août 2011
mardi 16 août 2011
Couleurs...
Pour retrouver/voir les codes couleurs...
http://www.colorschemer.com/online.html
http://html-color-codes.info/
http://www.tayloredmktg.com/rgb/
http://www.colorschemer.com/online.html
http://html-color-codes.info/
http://www.tayloredmktg.com/rgb/
vendredi 12 août 2011
vendredi 17 juin 2011
Json en java
Lib java pour parser une entrée formattée avec json...
http://code.google.com/p/json-simple/
Simple et pas de dépendance !
http://code.google.com/p/json-simple/
Simple et pas de dépendance !
vendredi 3 juin 2011
Chemin absolu
La commande readlink permet de retourner le chemin absolu d'un fichier/répertoire en suivant éventuellement les liens symboliques
$ readlink -f ~/.emacs
/home/user/etc/emacs/dot_emacs.el
lundi 30 mai 2011
tables de hachage en bash
Voici comment déclarer une table de hachage en bash et itérer sur ses clés pour récupérer les valeurs :
hash declare animals key value hachage iterate
jeudi 7 avril 2011
jeudi 31 mars 2011
Inscription à :
Articles (Atom)