Sunday, February 28, 2010

searching Bluetooth devices from terminal command

type in terminal

$sudo hidd --search

make sure the targeting device is emitting signal by, for example, pressing a button like "connect".

Saturday, February 27, 2010

YaTeX command list

 コンパイル、プレビュー、印刷 (C-c t)
C-c t j コンパイル(platex)
コンパイル(領域指定)
コンパイル中断
bjbibtex
 pプレビュー(xvdi)
印刷(lpr)
※印刷環境の整備ができていないため、現在直接印刷はできません
 入力補完
(La)TeXでは多くの環境が提供されるため、すべてのキーバインドを一度に覚えることはできないため、コマンド一覧を表記するコマンドを示す。
C-c aアクセント補完
b SPCbegin型補完
B SPCbegin型補完(領域指定)
b 環境の頭文字begin型補完(即時)
B 環境の頭文字begin型補完(即時・領域指定)
eend補完
large型補完
Llarge型補完(領域指定)
mmaketitle補完
section型補完
Ssection型補完(領域指定)
SPC随時補完
数式記号イメージ補完
(数式環境内で)
ギリシャ文字イメージ補完
(数式環境内で)
 カーソルジャンプ
C-c ’ コンパイルエラー個所へ
対応するオブジェクト
4g別ウィンドウで対応するオブジェクトへ
メインファイルへ
4^別ウィンドウでメインファイルへ
ESCC-a環境の先頭
ESCC-e環境の末尾
ESCC-h環境全体をマーク
 コメントアウト
C-c領域/環境のコメントアウト
領域/環境のコメント解除
段落/環境宣言コメントアウト
段落/環境宣言コメント解除
 その他
C-ci itemの桁揃え
LaTeXコマンド変更
コマンドの削除
領域を()で括る
領域を{}で括る
$領域を$$で括る
wモードの切り替え
%%#記法の編集
&tabular/array桁位置表示
オンラインヘルプ
/オンラインapropos 
インクルード構造ブラウズ
ESCRETおまかせ改行
tabular,array,itemize,enumerate,list,descriptionで
 
information from 
http://www.yuge.ac.jp/home/~nagao/teaching/LaTeX/yatex.html

Emacs in terminal

booting Emacs in terminal instead of Xwindow system.

$emacs -nw

ArabTeX testing the first code

ArabTeX is a package for LaTeX to write beautiful arabic letters.
In codes, no Arabic characters are used.

\documentclass[a4]{article}
\usepackage{arabtex}
\begin{document}
\setarab
\fullvocalize
\transtrue
\arabtrue
\begin{RLtext}
bismi al-ll ahi al-rra.hm_ani al-rra.hImi
\end{RLtext}
\end{document}


LaTeX compile and producing PDF file

$latex xxx.tex
$dvipdf xxx.dvi

Friday, February 26, 2010

current .emacs file

;;----------Load-path:ダウンロードした .el ファイルをロードする-----------
(setq load-path (cons "/usr/local/share/emacs/emacslisp" load-path))
(setq load-path (cons "/usr/local/share/emacs/emacslisp/yatex1.74" load-path))
;;--------------------------------------------------
(setq default-frame-alist
      '((background-color . "gray16")
(foreground-color . "white")
(width . 100)
(height . 40)
(top . 0)
(left . 0)
(line-spacing . 2)))
;;--------------------------------------------------
;; C-x bでミニバッファにバッファ候補を表示
(iswitchb-mode t)
(iswitchb-default-keybindings)
;;--------------------------------------------------
;; shell-pop
;; C-tでshellをポップアップ
(require 'shell-pop)
(shell-pop-set-internal-mode "ansi-term") ;; ansi-termを使うよ
(shell-pop-set-internal-mode-shell "/bin/bash") ;; bashを使うよ
(defvar ansi-term-after-hook nil)
(add-hook 'ansi-term-after-hook
          '(lambda ()
             (define-key term-raw-map "\C-t" 'shell-pop)))
(defadvice ansi-term (after ansi-term-after-advice (org))
  "run hook as after advice"
  (run-hooks 'ansi-term-after-hook))
(ad-activate 'ansi-term)
(global-set-key "\C-t" 'shell-pop)
;;--------------------------------------------------
;;; *.~ とかのバックアップファイルを作らない
(setq make-backup-files nil)
;;; .#* とかのバックアップファイルを作らない
(setq auto-save-default nil)
;;--------------------------------------------------
;;http://www.nanashinonozomi.com/tdiary/20080714.html
(cond
  (window-system
    ;; デフォルトフォントの設定
    ;; フォント名-フォントサイズで指定する。
;;    (set-default-font "VL ゴシック-7")
    (set-default-font "Arial-8")
    ;; 日本語(japanese-jisx0208)フォントの設定
    (set-fontset-font
      (frame-parameter nil 'font)
      'japanese-jisx0208
      '("VL ゴシック" . "unicode-bmp")
;;      '("VL ゴシック:weight=bold" . "unicode-bmp")
      ;; 手元の環境では、↑のようにボールドの設定をしておか
      ;; ないと、いわゆる半角英数文字のボールドフォントが、
      ;; 設定したもの(ここでは VL ゴシック)にならない。
    )
  )
)
;;--------------------------------------------------
(set-cursor-color "yellow")
;;(setq split-window-vertically)
(setq truncate-partial-width-windows nil)
;;Font lock ON キーワードを色付け
(global-font-lock-mode t)
;;他のアプリケーションとのコピペを可能にする
(setq x-select-enable-clipboard t)
;;ツールバーを消す
(tool-bar-mode nil)
;;ChangeLog用ユーザー名とアドレスを設定
(setq user-full-name "Soichi Ishida")
(setq user-mail-address "zau_777_emacs@kki.biglobe.ne.jp")

;; ; 日本語をデフォルトにする。
;; (set-language-environment "Japanese")
;; ; anthy.el をロードできるようにする (必要に応じて)。
;; (push "/usr/local/share/emacs/site-lisp/anthy/" load-path)
;; ; anthy.el をロードする。
;; (load-library "anthy")
;; ; japanese-anthy をデフォルトの input-method にする。
;; (setq default-input-method "japanese-anthy")

;; (add-hook 'anthy-mode-hook
;;    #'(lambda()
;; (set-cursor-color (if anthy-mode '"cyan" '"white"))))

;;----------linum setup:F5でon/offの切り替え可能----------------------
;;http://ccl.scc.kyushu-u.ac.jp/~ebiszk/emacs/lisp.html------------
;;より抜粋----------------------------------------------------------
(require 'linum)
(global-set-key [f5] 'linum-mode)
(add-hook 'lisp-interaction-mode-hook (lambda () (linum-mode t)))
(add-hook 'text-mode-hook (lambda () (linum-mode t)))
;;;====================================
;;;; print - 印刷設定
;;;====================================
;;; Postscript で印刷
(setq my-print-command-format "nkf -e | e2ps -a4 -p | lpr")
(defun my-print-region (begin end)
     (interactive "r")
     (shell-command-on-region begin end my-print-command-format))
(defun my-print-buffer ()
    (interactive)
    (my-print-region (point-min) (point-max)))
;;モードラインの色を変える------------------------------------------------
(set-face-foreground 'modeline "blue")
;;--------------------------------------------------
;;YaTeXモードの設定
(setq auto-mode-alist
      (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
;;----------BBDBsetup----------------------------------------------
;;http://www.bookshelf.jp/texi/gnus/gnus-ja_10.html#SEC501
;;より
(require 'bbdb)
;; 北アメリカに住んでいるのでなければ、以下によって電話番号の
;; チェックをやめさせるべきです。
(setq bbdb-north-american-phone-numbers-p nil)
;; あなたの電子メールアドレスを BBDB に教えましょう。
(setq bbdb-user-mail-names
      (regexp-opt '("zau_777_emacs@kki.biglobe.ne.jp"
                    "soujiro0725@gmail.com")))
;; メールアドレスを補完するときに、候補をエンドレスで出します。
;; cycling while completing email addresses
(setq bbdb-complete-name-allow-cycling t)
;; BBDB のバッファーをポップアップさせません。
(setq bbdb-use-pop-up nil)
;;-------------------------------------------------------------------
;;w3m for newsticker
(require 'w3m-load)
(setq w3m-use-cookies t)
;;from
;;here
;;http://groups.google.com/group/emacs-g-client/browse_thread/thread/8dd33df945222c1a
(setq g-html-handler 'w3m) ;;required for google service
;;--------------------------------------------------
(setq newsticker-html-renderer 'w3m-region
      browse-url-browser-function 'w3m-browse-url)
(setq w3m-fill-column -3)
;;--------------------------------------------------------------------

;;====================================================================
;;Maxima set-up
;;; add to load-path the directory where imaxima.el is installed.
;;; If you change the install directory of imaxima, the first argument of push must be
;;; changed accordingly.
(push "/usr/local/share/emacs/site-lisp" load-path)
;;; add to load-path the directory where maxima.el is installed.
;;; If you change the install directory of maxima, the first argument of push must be
;;; changed accordingly.
(push "/usr/share/maxima/5.13.0/emacs" load-path)
;;; add autoload of imaxima and maxima.
(autoload 'imaxima "imaxima" "Frontend for maxima with Image support" t)
(autoload 'maxima "maxima" "Frontend for maxima" t)
;;; add autoload of imath.
(autoload 'imath-mode "imath" "Imath mode for math formula input" t)
;;; Make the line effective if you want to use maxima mode with imaxima.
;; (setq imaxima-use-maxima-mode-flag t)
;;=====================================================================
;;-----JAVA環境の設定----------------------------------------------------
;;(autoload 'jde-mode "jde" "Java Development Environment for Emacs." t)
;;(setq auto-mode-alist (cons '("\.java$" . jde-mode) auto-mode-alist))
;;-----メールアドレスを自動で挿入する--------------------------------------
;;(setq user-full-name "Ishida, Soichi")
;;(setq user-mail-address "zau_777_emacs@kki.biglobe.ne.jp")
;======================================================================
; JDEE
;======================================================================
(require 'jde)
(autoload 'jde-mode "jde" "Java Development Environment for Emacs." t)
(setq auto-mode-alist
      (cons '("\.java$" . jde-mode) auto-mode-alist))
(setq user-full-name "Soichi Ishida")
(setq user-mail-address "zau_777_emacs@kki.biglobe.ne.jp")
(add-hook 'jde-mode-hook
          '(lambda ()
             (c-set-offset 'arglist-intro '+)
             (c-set-offset 'arglist-close 0)
         (c-set-offset 'topmost-intro-cont 0)
             (c-set-offset 'func-decl-cont 0)
             (setq indent-tabs-mode nil)
         ))
(let ((elem (assq 'encoded-kbd-mode minor-mode-alist)))
  (when elem
    (setcar (cdr elem) "")))
;;
;;-----cedetの設定------------------------------------------------------
(setq semantic-load-turn-useful-things-on t)
(load "cedet")
;;=====================================================================
;;=======マウスの位置のバッファがアクティブになる===========================
;;http://www.bookshelf.jp/soft/meadow_31.html#SEC439
(require 'follow-mouse)
;;とりあえずオフにしておく
;;オンにするにはコメントを外す
;;(turn-on-follow-mouse)
;;=====================================================================
;;========dismal-mode=================================================
;; (load "/usr/local/share/emacs/dismal-1.4/dismal-mode-defaults.el")
;; ;;--------------------------------------------------------------------
;; ;;====================================================================
(load "~/.twitter.el")
;;==============================================
;;howmの設定
;;http://www.bookshelf.jp/soft/meadow_38.html#SEC560
(setq howm-menu-lang 'ja)
(global-set-key "\C-c,," 'howm-menu)
(mapc
 (lambda (f)
   (autoload f
     "howm" "Hitori Otegaru Wiki Modoki" t))
 '(howm-menu howm-list-all howm-list-recent
             howm-list-grep howm-create
             howm-keyword-to-kill-ring))
;;-----------------------------------------------
;;howm追加設定
;; リンクを TAB で辿る
(eval-after-load "howm-mode"
  '(progn
     (define-key howm-mode-map [tab] 'action-lock-goto-next-link)
     (define-key howm-mode-map [(meta tab)] 'action-lock-goto-previous-link)))
;; 「最近のメモ」一覧時にタイトル表示
(setq howm-list-recent-title t)
;; 全メモ一覧時にタイトル表示
(setq howm-list-all-title t)
;; メニューを 2 時間キャッシュ
(setq howm-menu-expiry-hours 2)

;; howm の時は auto-fill で
(add-hook 'howm-mode-on-hook 'auto-fill-mode)

;; RET でファイルを開く際, 一覧バッファを消す
;; C-u RET なら残る
(setq howm-view-summary-persistent nil)

;; メニューの予定表の表示範囲
;; 10 日前から
(setq howm-menu-schedule-days-before 10)
;; 3 日後まで
(setq howm-menu-schedule-days 3)

;; howm のファイル名
;; 以下のスタイルのうちどれかを選んでください
;; で,不要な行は削除してください
;; 1 メモ 1 ファイル (デフォルト)
(setq howm-file-name-format "%Y/%m/%Y-%m-%d-%H%M%S.howm")
;; 1 日 1 ファイルであれば
(setq howm-file-name-format "%Y/%m/%Y-%m-%d.howm")

(setq howm-view-grep-parse-line
      "^\\(\\([a-zA-Z]:/\\)?[^:]*\\.howm\\):\\([0-9]*\\):\\(.*\\)$")
;; 検索しないファイルの正規表現
(setq
 howm-excluded-file-regexp
 "/\\.#\\|[~#]$\\|\\.bak$\\|/CVS/\\|\\.doc$\\|\\.pdf$\\|\\.ppt$\\|\\.xls$")

;; いちいち消すのも面倒なので
;; 内容が 0 ならファイルごと削除する
(if (not (memq 'delete-file-if-no-contents after-save-hook))
    (setq after-save-hook
          (cons 'delete-file-if-no-contents after-save-hook)))
(defun delete-file-if-no-contents ()
  (when (and
         (buffer-file-name (current-buffer))
         (string-match "\\.howm" (buffer-file-name (current-buffer)))
         (= (point-min) (point-max)))
    (delete-file
     (buffer-file-name (current-buffer)))))

;; http://howm.sourceforge.jp/cgi-bin/hiki/hiki.cgi?SaveAndKillBuffer
;; C-cC-c で保存してバッファをキルする
(defun my-save-and-kill-buffer ()
  (interactive)
  (when (and
         (buffer-file-name)
         (string-match "\\.howm"
                       (buffer-file-name)))
    (save-buffer)
    (kill-buffer nil)))
(eval-after-load "howm"
  '(progn
     (define-key howm-mode-map
       "\C-c\C-c" 'my-save-and-kill-buffer)))
;;----------------------------------------
;;howm自動保存の設定
 ;; メニューを自動更新しない
(setq howm-menu-refresh-after-save nil)
;; 下線を引き直さない
(setq howm-refresh-after-save nil)
;;----------------------------------------
;;========================================
;;windows.elの設定------------------------
;;http://technique.sonots.com/?UNIX%2F%E5%AD%A6%E7%94%9F%E3%83%84%E3%83%BC%E3%83%AB%2Felisp%2Fwindows.el
;; Lisp ライブラリの load path に "~s1138001/lib/emacs/lisp" を追加します。
(setq load-path (cons (expand-file-name "~s1138001/lib/emacs/lisp")
                      load-path))

;; windows.el
(require 'windows)
(win:startup-with-window)
(define-key ctl-x-map "C" 'see-you-again)

;; revive.el
(autoload 'save-current-configuration "revive" "Save status" t)
(autoload 'resume "revive" "Resume Emacs" t)
(autoload 'wipe "revive" "Wipe emacs" t)
;;----------------------------------------
;;========================================
;;--g-clientを使う-------------------------
;;--g-clientディレクトリのみを読み込むパス----
;; (setq load-path (cons "/usr/local/share/emacs/emacslisp/g-client" load-path))
;; (load-library "g")
;; (setq g-user-email "soujiro0725@gmail.com")
;; (setq gcal-user-email "soujiro0725@gmail.com")
;;(setq browse-url-browser-function 'w3m-browse-url)
;;----------------------------------------
;;空の新規バッファを開いたときは常にEmacs-Lipsモードとする
(setq default-major-mode 'lisp-interaction-mode)
;;----------------------------------------
;;auto-complete.el設定
(require 'auto-complete)
(global-auto-complete-mode t)
(require 'auto-complete-acr)
;;----------------------------------------
;;pymacs設定====================
;; Pymacs
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
(eval-after-load "pymacs"
  '(add-to-list 'pymacs-load-path "~/app/emacs/pymacs-elisp"))
;;--------------------------------------------------

Pymacs Instruction

here Pymacs instruction:

Pymacs Framework

Wednesday, February 24, 2010

YaTeX set up

YaTeX is a major mode of Emacs for editing LaTeX.  It enables completions by typing the Tab key.

download from
http://www.yatex.org/

and untar by
tar xvzf xxx.tar

 move the folder to where the path is reachable.

in .emacs
-------------------------------------------------------------

(setq auto-mode-alist
      (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
-------------------------------------------------------------
will do.

CSS: color list

Color NameColor Code
Pearly Gates
Pale Olive
Ultra Pure White
Frosted Lime
White Orchid
Green Veil
Gray Cliffs
Far Horizon
Plantation White
Warm Summer
Ivory Tusk
Eggshell Cream
Toasted Meringue
Light Sand
Carmel Tan
Wedding Veil
Subtle White
Warm Shadow
Sand Box
Frosted Peach
Dusted Pink
Porcelain White
Light Adobe
Barely Blushing
Dusty Trail
Ostrich Feather
White Sail
Morning Fog
Dove Beige

Emacs: refrain from automatically making back-up files

Emacs automatically creates back-up files such as xxx.x~ .
The following code in .emacs or .emacs.el will not make any.

;;; *.~ とかのバックアップファイルを作らない
(setq make-backup-files nil)
;;; .#* とかのバックアップファイルを作らない
(setq auto-save-default nil)




Tuesday, February 23, 2010

switching buffers more easily

in .emacs the following set-up will help visualize which buffers are currently active in the mini-buffer.


;; C-x bでミニバッファにバッファ候補を表示
(iswitchb-mode t)
(iswitchb-default-keybindings)

Emacs: shell-pop

"shell-pop" is an Emacs mode that enables pop-up a window of terminal by typing
Ctrl + t

this is mush quicker than switching buffers to eshell to ansi-mode

require shell-pop.el from
http://www.emacswiki.org/emacs-en/ShellPop

in .emacs


;; shell-pop
;; C-tでshellをポップアップ
(require 'shell-pop)
(shell-pop-set-internal-mode "ansi-term") ;; ansi-termを使うよ
(shell-pop-set-internal-mode-shell "/bin/zsh") ;; zshを使うよ
(defvar ansi-term-after-hook nil)
(add-hook 'ansi-term-after-hook
          '(lambda ()
             (define-key term-raw-map "\C-t" 'shell-pop)))
(defadvice ansi-term (after ansi-term-after-advice (org))
  "run hook as after advice"
  (run-hooks 'ansi-term-after-hook))
(ad-activate 'ansi-term)
(global-set-key "\C-t" 'shell-pop)

Sunday, February 21, 2010

ruby-tumblr seems useful

ruby-tumblr

but it is a bit old...


require "tumblr" 

Tumblr::API.read("tumblr.dynamic-semantics.com") do |pager|
  data = pager.page(0)
  p data.tumblelog
  data.posts.each do |post|
    p post
  end
end 

Learning Tumblr API

Tumblr - blog-like service - provides API.
It is to be implemented over standard HTTP request.

Probably using Ruby is good enough...

http://www.ruby-lang.org/ja/man/html/Net_HTTPRequest.html

Ruby has HTTP libraries, so writing some scripts will do the job...?

Printing codes in Color with Emacs

If you want to print source codes whose key words appear in color,

M-x ps-print-buffer-with-faces

But some colors of key words seem too pale to read accurately...

information from
http://www.swlab.ice.uec.ac.jp/announce/srcprint.html

Starting a New Blog for programming memo

I have started another blog which contains only programming tips and notes.
I am NOT a professional programmer...but I am learning a lot.

Mainly it is going to be about Ruby, Python, Java, Google Web Toolkit, and Emacs.
If anyone wants to share the information, I would appreciate it.