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
J'entrepose ici mes découvertes linux, bash, python et java que je souhaite partager et mettre de côté...
mardi 29 novembre 2011
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
Inscription à :
Articles (Atom)