Sunday, February 26, 2017

(require 'scala-mode-auto)
(require 'ensime)

#+RESULTS:

(add-to-list 'auto-mode-alist '("\\.sc$" . scala-mode))
(add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode))

(add-hook 'scala-mode-hook 'ensime-mode)
* org babel mode scala

#+begin_src scala :exports both :results output
def helloworld() = {
  println("Hello there")
  println("한글로처리2")
}
helloworld()
#+end_src

: Hello there
: 한글로처리2

emacs - org babel mode - using paramer ex. sql (from:Introduction to Literate Programming)

--> from:
 http://www.howardism.org/Technical/Emacs/literate-programming-tutorial.html





Introduction to Literate Programming

Welcome to a brief tutorial on literate programming in org-mode.
The following began as the basis for a workshop for the PDX Emacs Hackers meetup, but since everyone couldn’t attend, I decided to expand it into a tutorial. I assume you understand the basics of Emacs and as well as familiarity with org-mode for creating exported documents.
As you probably know, Org is pretty large, and the features for writing, evaluating and connecting blocks of source code in a document are extensive, and documenting them all is a daunting task. I hope this tutorial is a good start, but if I glossed over something you feel I should include, please let me know.
Warning: The examples are pretty lame.
--
# -*- coding: utf-8 -*-
#+STARTUP: content
#+LANGUAGE: ko
#+PROPERTY: header-args:sql :engine postgresql :export results :cmdline -p 5432 -h localhost -U kys -d emacsdb PGPASSWORD=pass1234

* example-1. use parameter in the document level defind '#+PROPERTY'
#+BEGIN_SRC sql 
select eng_name, title, fullname from springschema.phonebook;
#+END_SRC


#+RESULTS:
| eng_name  | title | fullname |
|-----------+-------+----------|
| So Wonju  | 대리  | 지원호   |
| Mr.Jung   | 사원  | 김지원   |
..


** example-2. use parameter in the org-heading section of ':PROPERTIES:'
 :PROPERTIES:
 :LANGUAGE: sql
 :engine: postgresql
 :exports: results
 :cmdline: -p 5432 -h localhost -U kys -d emacsdb PGPASSWORD=pass1234
 :END:

#+begin_src sql
select eng_name, title, fullname from springschema.phonebook;
select "select version()";
#+end_src

#+RESULTS:
| eng_name  | title | fullname |
|-----------+-------+----------|
| So Wonju  | 대리  | 지원호   |
| Mr.Jung   | 사원  | 김지원   |
..


* example-3. use in specified src block values
#+BEGIN_SRC sql :engine postgresql :exports results :cmdline -p 5432 -h localhost -U kys -d emacsdb PGPASSWORD=pass123
select eng_name, title, fullname from springschema.phonebook;
#+END_SRC

#+RESULTS:
| eng_name  | title | fullname |
|-----------+-------+----------|
| So Wonju  | 대리  | 지원호   |
| Mr.Jung   | 사원  | 김지원   |

 ※ :results:output 가 있으면 raw 로 encoding 없이 출력된다.
(※ ':results:output' means output without encoding) 


Thursday, February 23, 2017

google notice to blogger users - with cookie

유럽 연합 법규는 유럽 연합 방문자에게 블로그에 사용되는 쿠키에 대한 정보를 제공하도록 규제하고 있습니다. 또한 대부분의 경우 이러한 법규는 사용자의 동의를 얻도록 요구합니다.


이 규제를 준수할 수 있도록 Google은 귀하의 블로그에 Google이 특정 Blogger를 사용하며 Google 애널리틱스와 애드센스 쿠키를 비롯한 Google 쿠키를 사용한다는 것을 알리는 공지사항을 추가했습니다.


귀하는 이 공지사항이 블로그에 실제로 적용되고 표시되도록 할 책임이 있습니다. 타사 제품의 기능을 추가하는 등 다른 쿠키를 사용하는 경우 이 공지사항이 귀하에게 적합하지 않을 수 있습니다. 이 공지사항 및 책임에 대해 자세히 알아보기

Font for Emacs - Korean, Chinese-Hanyu

> chinese font
       (set-fontset-font fontset 'hangul '("Gulim" . "unicode-bmp"))


> korean font
        (set-fontset-font fontset 'hangul '("NanumBarunGothic" . "unicode-bmp"))

> japnese font

;; -- 0
;(set-face-font 'default "Monaco-12")
;(set-fontset-font "fontset-default" '(#x1100 . #xffdc) "NanumGothicOTF-15")
;(set-fontset-font "fontset-default" 'kana  "Hiragino Kaku Gothic Pro-14")
;(set-fontset-font "fontset-default" 'han   "Hiragino Kaku Gothic Pro-14")

(defun xftp (&optional frame)
  "Return t if FRAME support XFT font backend."
  (let ((xft-supported))
    (mapc (lambda (x) (if (eq x 'xft) (setq xft-supported t)))
          (frame-parameter frame 'font-backend))
    xft-supported))

(when (string-equal my-system-is "MAC")
  (set-face-attribute 'default nil :family "DejaVu Sans Mono" :height 160) ; 140
;  (set-face-font 'default "Monaco-14") ; 12
;  (set-face-attribute 'default nil :height 160)
;  (face-remap-add-relative 'default :family "Bitstrem Vera Sans Mono" :height 180)

   ;; -- 1
  (set-fontset-font "fontset-default" '(#x1100 . #xffdc) '("DejaVu Sans Mono" . "iso10646-1"))
;  (set-fontset-font "fontset-default" '(#xe0bc . #xf66e) '("나눔고딕코딩" . "iso10646-1"))

  ;(set-fontset-font "fontset-default" 'latin  '("Monaco-14" . "unicode-bmp"))
  ;(set-fontset-font t 'latin (font-spec :family "나눔고딕코딩" :size 18)) ; 16
  ;(set-fontset-font "fontset-default" 'latin (font-spec :family "NanumGothicCoding" :size 22))
  ;(set-fontset-font "fontset-default" 'latin (font-spec :family "Bitstrem Vera Sans Mono" :size 22))
  (set-fontset-font "fontset-default" 'latin (font-spec :family "DejaVu Sans Mono" :size 22))

  ;; -- 2
  (set-fontset-font "fontset-default" 'han (font-spec :family "STHeiti" :size 24))
  ;(set-fontset-font "fontset-default" 'han (font-spec :family "Microsoft YaHei" :size 24))

  ;; -- 3
  ;(set-fontset-font "fontset-default" 'kana (font-spec :family "STSong-24" :size 22))
;  (set-fontset-font "fontset-default" 'kana (font-spec :family "Monaco-16" :size 22))

  ;; -- 4
  (set-fontset-font "fontset-default" 'hangul (font-spec :family "나눔고딕코딩" :size 14))
 )

(when (string-equal my-system-is "GIG")
;   (set-face-font 'default "Monaco-12")

;; bad
;   (set-fontset-font "fontset-default" '(#x1100 . #xffdc)  '("NANumGothicCoding" . "unicode-bmp"))
;   (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)  '("NanumGothicCoding" . "unicode-bmp"))

;; bad
;   (set-fontset-font "fontset-default" '(#x1100 . #xffdc)  '("NanumGothicOTF" . "iso10646-1"))
;   (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)  '("NanumGothicOTF" . "iso10646-1"))
   (set-fontset-font "fontset-default" '(#x1100 . #xffdc)  '("NanumBarunGothic" . "iso10646-1"))
   (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)  '("NanumBarunGothic" . "iso10646-1"))

   (set-fontset-font "fontset-default" 'kana  '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
   (set-fontset-font "fontset-default" 'japanese-jisx0208 '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
   (set-fontset-font "fontset-default" 'katakana-jisx0201 '("Hiragino Kaku Gothic Pro" . "iso10646-1"))

   (set-fontset-font "fontset-default" 'han '("Microsoft YaHei". "unicode-bmp"))
   ;(set-fontset-font "fontset-default" 'han '("NanumGothicCoding". "unicode-bmp"))

   (set-fontset-font (frame-parameter nil 'font) 'cjk-misc '("Microsoft YaHei" . "unicode-bmp"))
   (set-fontset-font (frame-parameter nil 'font) 'bopomofo '("Microsoft YaHei" . "unicode-bmp"))
   (set-fontset-font "fontset-default"    'gb18030 '("Microsoft YaHei". "unicode-bmp"))
   (set-fontset-font (frame-parameter nil 'font) 'symbol '("Microsoft YaHei". "unicode-bmp"))

   (set-fontset-font t 'han (font-spec :family "Microsoft Yahei" :size 16))
   ;(set-fontset-font t 'han (font-spec :family "NanumGothicCoding" :size 16))

   (setq face-font-rescale-alist '(("Microsoft Yahei" . 1.4) ("WenQuanYi Zen Hei" . 1.4)))

;; -- this xfp will crash !!
;   (when (xftp)
;     (let ((fontset "fontset-default"))
;       (set-fontset-font fontset 'latin  '("DejaVu Sans Mono" . "unicode-bmp"))
;  ;    (set-fontset-font fontset 'latin  '("NanumGothicCoding" . "unicode-bmp"))

;  ;    (set-fontset-font fontset 'hangul '("NanumGothicCoding" . "unicode-bmp"))
;       (set-fontset-font fontset 'hangul '("SeoulHangangB" . "unicode-bmp"))
;  ;    (set-fontset-font fontset 'hangul '("SeoulNamsanM" . "unicode-bmp"))

;       (set-face-attribute 'default nil :font fontset :height 110)
;      )
;    )


   (when (xftp)
     (let ((fontset "fontset-default"))
;       (set-fontset-font fontset 'latin  '("DejaVu Sans Mono" . "unicode-bmp"))
        (set-fontset-font fontset 'latin  '("DejaVu Sans Mono-14" . "unicode-bmp"))
;  ;    (set-fontset-font fontset 'latin  '("NanumGothicCoding" . "unicode-bmp"))

;       (set-fontset-font fontset 'hangul '("Gulim" . "unicode-bmp"))
        (set-fontset-font fontset 'hangul '("NanumBarunGothic" . "unicode-bmp"))

;        (set-fontset-font fontset 'hangul '("Gulim" . "unicode-bmp"))
   ;    (set-fontset-font fontset 'hangul '("NanumGothicCoding" . "unicode-bmp"))
;       (set-fontset-font fontset 'hangul '("SeoulHangangB" . "unicode-bmp"))
;  ;    (set-fontset-font fontset 'hangul '("SeoulNamsanM" . "unicode-bmp"))

;       (set-face-attribute 'default nil :font fontset :height 110)
      )
    )

;; -- this xfp not tested
;   (when (xftp)
;     (let ((fontset "fontset-default"))
;       (set-fontset-font fontset 'latin  '("DejaVu Sans Mono" . "unicode-bmp"))
;  ;    (set-fontset-font fontset 'latin  '("NanumGothicCoding" . "unicode-bmp"))

;  ;    (set-fontset-font fontset 'hangul '("NanumGothicCoding" . "unicode-bmp"))
;       (set-fontset-font fontset 'hangul '("SeoulHangangB" . "unicode-bmp"))
;  ;    (set-fontset-font fontset 'hangul '("SeoulNamsanM" . "unicode-bmp"))

;       (set-face-attribute 'default nil :font fontset :height 110)
;      )
;    )
  )

;;;; ----------------------------------------------------------------------
;; test -- 1
(cond
 ((string-equal system-type "windows-nt") ; Microsoft Windows
  (when (member "DejaVu Sans Mono" (font-family-list))
    (add-to-list 'initial-frame-alist '(font . "DejaVu Sans Mono-12"))
    (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-12"))
    )
  )
 ((string-equal system-type "darwin")   ; Mac OS X
  (when (member "DejaVu Sans Mono" (font-family-list))
    (add-to-list 'initial-frame-alist '(font . "DejaVu Sans Mono-12"))
    (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-12")))
  )
 ((string-equal system-type "gnu/linux") ; linux
   (when (member "DejaVu Sans Mono" (font-family-list))
    (add-to-list 'initial-frame-alist '(font . "DejaVu Sans Mono-12"))
    (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-12"))
;    (set-face-attribute 'default nil :family "Source Code Pro" :height 130) ; 120
   )
  )
 )

;;;; ----------------------------------------------------------------------
;; test -- 2
;; -- this is DejaVu Good looking
;(add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-12"))
;(set-frame-font "DejaVu Sans Mono-12" nil t)

;; -- not as good as DejaVu - its test now
(add-to-list 'default-frame-alist '(font . "Source Code Pro-13"))
(set-frame-font "Source Code Pro-13" nil t)

;; -- not as good it's just old fashion style
;(add-to-list 'default-frame-alist '(font . "lucidasanstypewriter-12"))
;(set-frame-font "lucidasanstypewriter-12" nil t)

(set-face-attribute 'default nil :family "Source Code Pro" :height 130) ; 120


;;;; ----------------------------------------------------------------------
(defun my-font-middle ()  (interactive)
  (set-face-font 'default "Monaco-12")
  (set-fontset-font "fontset-default" '(#x1100 . #xffdc)  '("NanumGothicOTF" . "iso10646-1"))
  (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)  '("NanumGothicOTF" . "iso10646-1"))
  (set-fontset-font "fontset-default" 'kana  '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
  (set-fontset-font "fontset-default" 'japanese-jisx0208 '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
  (set-fontset-font "fontset-default" 'katakana-jisx0201 '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
  (set-fontset-font "fontset-default" 'han '("Microsoft YaHei". "unicode-bmp"))
  (set-fontset-font (frame-parameter nil 'font) 'cjk-misc '("Microsoft YaHei" . "unicode-bmp"))
  (set-fontset-font (frame-parameter nil 'font) 'bopomofo '("Microsoft YaHei" . "unicode-bmp"))
  (set-fontset-font "fontset-default"    'gb18030 '("Microsoft YaHei". "unicode-bmp"))
  (set-fontset-font (frame-parameter nil 'font) 'symbol '("Microsoft YaHei". "unicode-bmp"))
  (set-fontset-font t 'han (font-spec :family "Microsoft Yahei" :size 16))
  (setq face-font-rescale-alist '(("Microsoft Yahei" . 1.4) ("WenQuanYi Zen Hei" . 1.4)))
)

(defun my-font-big ()
  (interactive)
  (set-face-font 'default "Monaco-14")
  (set-fontset-font "fontset-default" '(#x1100 . #xffdc)  '("NanumGothicOTF" . "iso10646-1"))
  (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)  '("NanumGothicOTF" . "iso10646-1"))
;  (set-fontset-font "fontset-default" '(#x1100 . #xffdc)  '("NanumGothicCoding" . "iso10646-1"))
;  (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)  '("NanumGothicCoding" . "iso10646-1"))
  (set-fontset-font "fontset-default" 'kana  '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
  (set-fontset-font "fontset-default" 'japanese-jisx0208 '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
  (set-fontset-font "fontset-default" 'katakana-jisx0201 '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
  (set-fontset-font "fontset-default" 'han '("Microsoft YaHei". "unicode-bmp"))
  (set-fontset-font (frame-parameter nil 'font) 'cjk-misc '("Microsoft YaHei" . "unicode-bmp"))
  (set-fontset-font (frame-parameter nil 'font) 'bopomofo '("Microsoft YaHei" . "unicode-bmp"))
  (set-fontset-font "fontset-default"    'gb18030 '("Microsoft YaHei". "unicode-bmp"))
  (set-fontset-font (frame-parameter nil 'font) 'symbol '("Microsoft YaHei". "unicode-bmp"))
  (set-fontset-font t 'han (font-spec :family "Microsoft Yahei" :size 16))
  (setq face-font-rescale-alist '(("Microsoft Yahei" . 1.6) ("WenQuanYi Zen Hei" . 1.6)))
)

;(my-font-big)
;(my-font-middle)
;; M-x list-fonts

Pranten

 Pranten