Sunday, May 07, 2017

Website mockup with Pencil Sketching

* Website mockup with Pencil Sketching

** why

I'm not a designer but I need mockup web site for desinger and other member of developer team.

- Microsoft Office is a good tool which I used more than 10 years, but it makes me tired.

- LibreOffice is a good tool sometime it crash, but since verion 5.x it stabilized. It  makes feel like more than MS-Office, just kidding.

- Actually, I use Emacs. You know what it make you is somewhat fear. So, I need out of this Emacs word!


** where it came from?

*** Once it was in -> https://code.google.com/archive/p/evoluspencil/

*** Now it is one -> https://github.com/prikhi/pencil

** download
*** source and release -> https://github.com/prikhi/pencil/releases

*** homepage and nightly build -> http://pencil.evolus.vn/Downloads.html
    (Firefox Extension link)


** installation guide

 -> Read Readme.md https://github.com/prikhi/pencil

  : Prerequisites
  :
  : You will need version 4 or higher of firefox to run Pencil as a
  : Firefox Extension. Linux users will need version 4 or higher of either
  : firefox, iceweasel or xulrunner, or version 25 or higher of
  : palemoon. The Windows installer and OS X archive has everything you
  : need built-in.


** browser requirement
※ (from the above)
   Pencil requires browser "firefox, iceweasel, xulrunner, palemoon"

*** firefox in Ubuntu
   > env. I am running firefox installed 53.0 (64-bit) on Ubuntu 17.04 in Linux(4.10.0-20-generic), which is not compatable with pencil extension.

   > I can't drag & drop

  (If you use nightly build firefox 55, it opted multi-thread and you can not even activate)

*** xulrunner
   (If I have enough time, it's a good chice but time is always short to me.)

*** palemoon
   download -> http://www.palemoon.org/

   It's simple and fast, actually not far differenct. I choose it.


** install pencil with extension

   download -> https://addons.mozilla.org/en-US/firefox/addon/pencil-prototyping/

   Launch ▶ [Menu] ▶ Pencil Sketching ...

※ other (just for fun)
  search engine change -> https://www.ecosia.org/


** Add Extra Stencil Collections
   > from. https://github.com/prikhi/pencil

: Extra Stencil Collections

: Android Lollipop by Nathanielw
: Bootstrap by Nathanielw
: Bootstrap Glyph Icons by Craig-Fisk
: Material Design Icons by Nathanielw
: Polymer Iron Icons by MercMobily

 ① download zip file from above link.
 ② then launch pencil extension in the browser (palemonn)'s
    Tools ▶ [Menu] ▶ Pencil Sketching ...
 ③ in the Pencil's menu ▶ Tools ▶ Install new Collection...
    then select download in ① file named with .zip file

Monday, April 03, 2017

raspberry pi - mariadb install and change default data dir

* mariadb

sudo apt-get install mariadb-server

mysql -u root -p
 "mypassword"

CREATE DATABASE IF NOT EXISTS new_database;
SELECT database();
DROP DATABASE new_database;
DROP DATABASE IF EXISTS new_database;


** check
mysql -u root -p

: Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
SELECT database();

: +------------+
: | database() |
: +------------+
: | NULL       |
: +------------+
: 1 row in set (0.01 sec)

select @@datadir;
: +-----------------+
: | @@datadir       |
: +-----------------+
: | /var/lib/mysql/ |
: +-----------------+
: 1 row in set (0.00 sec)

exit
: Bye


** change default data directory


*** stop service
- stop service
sudo service mysql stop

> check
sudo service mysql status

- directory move

> permission check
 --> /var/lib/mysql
   drwxr-xr-x  4 mysql   mysql   4.0K  4월  3 15:44 mysql

ls -alh /var/lib/mysql/


*** move default directory with tar-mode
mkdir $new_volume/mysql

cd $new_volume/mysql
mkidr -p $new_volume/log
sudo cp -apR /var/log/mysql /$new_volume/log/


*** copy with rsync

ref.
>> https://www.digitalocean.com/community/tutorials/how-to-change-a-mariadb-data-directory-to-a-new-location-on-centos-7


*** modify my.cnf
sudo cp /etc/mysql/my.cnf /etc/mysql/my.cnf-dist
sudo vi /etc/mysql/my.cnf


-- my.cnf
#+title:
#+begin_src conf
[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

# modified for utf8 client
default-character-set=utf8  # <-- added with modified


[mysqld]
...
socket          = /var/run/mysqld/mysqld.sock # leave it
# datadir               = /var/lib/mysql # modified
datadir         = /NEW_VOLUME_ROOT/mysql # modified
tmpdir          = /tmp # leave it
...
# -- modify
bind-address          = 127.0.0.1
# bind-address            = 0.0.0.0

# -- modify
log_error = /NEW_VOLUME_ROOT/log/mysql/error.log
#log_bin                        = /var/log/mysql/mysql-bin.log
..
# expire_logs_days      = 10
expire_logs_days        = 2 # modified
# max_binlog_size         = 100M
max_binlog_size         = 10M # modified
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name

# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# added following 2 line for utf8 -- modified
init_connect=SET collation=utf8_general_ci
init_connect=SET NAMES utf8
# -- default-character-set=utf8 # error
# character-set-server=utf8 # new DB create with option character-set
# collation-server=utf8_general_ci


[client]
port=3306
# unmodified:w

# socket=/mnt/volume-nyc1-01/mysql/mysql.sock


!includedir /etc/my.cnf.d

#+end_src


*** test connect

tail -f /NEW_VOLUME_ROOT/log/mysql/error.log

sudo service mysql start

sudo service mysql status
: ● mysql.service - LSB: Start and stop the mysql database server daemon
:    Loaded: loaded (/etc/init.d/mysql)
:    Active: active (running) since 월 2017-04-03 16:39:16 KST; 33s ago
:   Process: 28500 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
:   Process: 29028 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
:    CGroup: /system.slice/mysql.service
:            ├─29053 /bin/bash /usr/bin/mysqld_safe
:            ├─29206 /usr/sbin/mysqld --basedir=/usr --datadir=/NEW_VOLUME_ROOT/mysql --plugin-dir=/usr/li...
:            └─29207 logger -t mysqld -p daemon.error


- check local connect
mysql -u root -p

\quit


- check host connect
mysql -h MY_MARIADB_HOST -u root -p
: Enter password:
: ERROR 1130 (HY000): Host 'pii.local' is not allowed to connect to this MariaDB server


*** create table & user

sudo netstat -tap | grep mysql

mariadb-client-core-10.0

- connect
mysql -u root -p
or
mysql -h server_ip -P 3306 -u root -p

- root: create user
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypassword';
flush privileges;

: CREATE USER 'myuser'@'192.168.0.3';
: CREATE USER 'myuser'@'%';
: CREATE USER myuser@test IDENTIFIED BY 'mypassword';
: mysql -h my_server_ip -u myuser -p

-- other options
CREATE USER foo
  WITH MAX_QUERIES_PER_HOUR 10
  MAX_UPDATES_PER_HOUR 20
  MAX_CONNECTIONS_PER_HOUR 30
  MAX_USER_CONNECTIONS 40;

-- check grant or privileges

 > commit;
flush privileges;
status;

 > if super priviledge need - with grant option
#+begin_src sql
GRANT ALL PRIVILEGES ON journaldev.* TO 'USER_ME'@'%' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON journaldev.* TO 'USER_ME'@localhost WITH GRANT OPTION;
#+end_src


*** client install

$ mysql-workbench
The following packages will be REMOVED:
  mariadb-client-core-10.0

The following NEW packages will be installed:

  libaec0 libarmadillo6 libarpack2 libcrypto++6 libctemplate3
  libdap17v5 libdapclient6v5 libepsilon1 libfreexl1 libgdal20
  libgeos-3.5.0 libgeos-c1v5 libgeotiff2 libhdf4-0-alt libhdf5-10
  libkmlbase1 libkmldom1 libkmlengine1 libminizip1 libmysqlclient20
  libmysqlcppconn7v5 libnetcdf11 libodbc1 libogdi3.2 libpq5 libproj9
  libqhull7 libspatialite7 libsuperlu4 libsz2 liburiparser1
  libvsqlitepp3v5 libxerces-c3.1 libzip4 mysql-client mysql-client-5.7
  mysql-client-core-5.7 mysql-utilities mysql-workbench
  mysql-workbench-data odbcinst odbcinst1debian2 proj-bin proj-data
  python-cffi-backend python-cryptography python-enum34 python-idna
  python-ipaddress python-mysql.connector python-paramiko
  python-pyasn1 python-pyodbc python-pysqlite2 ttf-bitstream-vera


- ubuntu client (only)
sudo apt-get install mariadb-client-core-10.0

※ mysql-workbench will automatically install
mysql-client, mysql-client-core then
remove mariadb-clinet

so, reinstall mariadb-clinet-core

sudo apt-get install mariadb-client-core-10.0

then clinet prompt will change from "mysql" to "MariaDB"
MariaDB [(none)]>


** remove mysql start service
https://mariadb.com/kb/en/mariadb/installing-system-tables-mysql_install_db/ https://www.digitalocean.com/community/tutorials/how-to-change-a-mariadb-data-directory-to-a-new-location-on-centos-7


** Prevent MySQL from starting on boot up
sudo update-rc.d -f mysql remove

then
  You would then start mysql manually using

sudo service mysql start


** referance
How To Change a MariaDB Data Directory to a New Location on CentOS 7
https://www.digitalocean.com/community/tutorials/how-to-change-a-mariadb-data-directory-to-a-new-location-on-centos-7


sudo service mysql status

: ● mysql.service - LSB: Start and stop the mysql database server daemon
:    Loaded: loaded (/etc/init.d/mysql)
:    Active: inactive (dead) since 월 2017-04-03 15:54:30 KST; 58s ago
:   Process: 28500 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)

Wednesday, March 29, 2017

Emacs Web Server


Emacs Web Server

http://nullprogram.com/blog/2009/05/17/
     May 17, 2009

 The server log is lisp itself. Here is an example log starting the server, serving one request, and halting,
'(log
  (start "Wed May 13 23:33:34 2009")
  (connection
   (date "Wed May 13 23:36:25 2009")
   (address "192.168.0.3")
   (get "/0001.html")
   (req
    ("Referer" "http://192.168.0.2:8080/")
    ("Connection" "keep-alive")
    ("Keep-Alive" "300")
    ("Accept-Charset" "ISO-8859-1,utf-8;q=0.7,*;q=0.7")
    ("Accept-Encoding" "gzip,deflate")
    ("Accept-Language" "en-us,en;q=0.5")
    ("Accept" "image/png,image/*;q=0.8,*/*;q=0.5")
    ("User-Agent" "Mozilla/5.0 [...] Iceweasel/3.0.9 (Debian-3.0.9-1)")
    ("Host" "192.168.0.2:8080")
    ("GET" "/0001.html" "HTTP/1.1"))
   (path "~/public_html/0001.html")
   (status 200))
  (stop "Wed May 13 23:38:17 2009"))

--

simple-httpd and impatient-mode

Thursday, March 23, 2017

Cinnamon shortcut

* Cinnamon shortcut

The Complete List Of Linux Mint 18 Keyboard Shortcuts For Cinnamon by Gary Newell 
Updated March 23, 2017

1. Toggle Scale - List All Applications On Current Workspace (CTRL, ALT, DOWN)
2. Toggle Expo - List All Applications On All Workspaces (CTRL, ALT, UP)
3. Cycle Through Open Windows (ALT, TAB) (SHIFT, ALT, TAB)
4. Open The Run Dialog (ALT, F2)
5. Troubleshooting Cinnamon (SUPER, L)
6. Maximise A Window (ALT, F10)
7. UnMaximise A Window (ALT, F5)
8. Close A Window (ALT, F4)
9. Move A Window (ALT, F7)
10. Show The Desktop (SUPER, D)
11. Show The Window Menu (ALT, SPACE)
12. Resize A Window (ALT, F8)
13. Tile A Window To The Left (SUPER, LEFT) (CTRL, SUPER, LEFT)
14. Tile A Window To The Right (SUPER, RIGHT) (CTRL, SUPER, RIGHT)
15. Tile A Window To The Top (Super, UP) (CTRL, SUPER, UP)
16. Tile A Window To The Bottom (SUPER, DOWN) (CTRL, SUPER, DOWN)
17. Move A Window To A Workspace To The Left (SHIFT, CTRL, ALT, LEFT)
18. Move A Window To A Worksapce To The Right (SHIFT, CTRL, ALT, RIGHT)
19. Move A Window To The Left Monitor (SHIFT, SUPER, LEFT)
20. Move A Window To The Right (SHIFT, SUPER, RIGHT)
21. Move A Window To The Top Monitor (SHIFT, SUPER, UP)
22. Move A Window To The Bottom Monitor (SHIFT, SUPER, DOWN)
23. Move To The Workspace To The Left (CTRL ALT, LEFT)
24. Move To The Workspace To The Right (CTRL, ALT, RIGHT)
25. Log Out (CTRL, ALT, DELETE)
26. Shut Down The System (CTRL, ALT, END)
27. Lock The Screen (CTRL, ALT, L)
28. Restart The Cinnamon Desktop (CTRL, ALT, ESCAPE)
29. Take A Screenshot Of Part Of The Screen (SHIFT, PRTSC) (CTRL, SHIFT, PRTSC)
30. Take A Screenshot (PRTSC) (CTRL, PRTSC)
31. Take A Screenshot Of A Window (ALT, PRTSC) (CTRL, ALT, PRTSC)
32. Record The Desktop (SHIFT, CTRL, ALT, R)
33. Open A Terminal Window (CTRL, ALT, T)
34. Open The File Explorer At Your Home Folder (SUPER, E)

Thursday, March 16, 2017

fcitx language, xim setting, Gnome Key change

* fcitx language, xim setting, Gnome Key change
   [[file:img/fcitx_lang.png]]

 리눅스 우분투 키 시퀀스 변경은은 2곳에서 설정하는 데,

1. 주메뉴 [시스템 설정] > Hardware [Keyboard] > [Shortcuts] 탭 > "Typing" [List Menu)
   ( [시스템 설정] > Hardware [Keyboard] > [Typing] 탭의 "Text Entry" 을 선택해도 된다 )
   - Switch to next source: Super+Space
   - Siwtch to previous source: Shift + Super +Space
   [[file:img/fcitx_system_key.png]]

2. fcitx 설정에서 변경
   Fcitx [Icon] 실행 혹은 Configure Fcitx [mouse light popup menu]
     -> Input Method [tab]
        -> Pinyin [list select]
            -> Global Config [Tab]
                -> Trigger Input Method [item]
                   change from: "Ctrl+Space" --> to "Shift+Space"
                -> Scroll between Input Method: Ctrl_Shift
    [[file:img/fcitx_config.png]]

3. Emacs key sequence 변경
   (만약 emacs 에서 사용하는 키가 시스템에서 정의한 키와 중복될 경우 먼저 제거한다)

#+name: dot emacs
#+begin_src elisp
;; <leim> 을 사용할 경우 require (required korea-util.el and hangul.el)
;; <S-Hangul> --> toggle-korean-input-method from korea-util.el
;; [한자]키 --> toggle-korean-input-method hangul-to-hanja-conversion from hangul.el

;; <fcitx> 를 사용할 경우 --> fcitx -> change fcitx and system key sequence
;; 1. in [fcitx config]
;;    a. [Trigger Input Method] from [Control-SPACE] to [Shift-Space]
;;    b. Scroll between Input Method: Control+Sift
;;
;; 2. in [system kebyaord sequence setting]
;;    Next source (fcitx): [Super-Space]
;;    Switch to previous source (fcitx): [Super+Space+Space]

;(global-set-key (kbd "S-SPC") 'toggle-input-method)
;(global-set-key (kbd "S-SPC") 'toggle-korean-input-method)
(global-unset-key (kbd "S-SPC")) ; leave it to fcitx [Trigger Input Method]
(global-set-key (kbd "C-SPC") 'set-mark-command) ; constomize

;(define-key global-map [(control meta ?r)] 'remember)

(global-set-key [(shift meta q)] 'rebox-cycle)
;(global-set-key (kbd "C-c r r")  'my-put-file-name-on-clipboard)
(global-set-key (kbd "C-x C-f")  'find-file) ; ido-find-file

;(global-set-key [?\M-j] 'ido-display-buffer)
;(global-set-key (kbd "C-x x f") 'ido-find-file)
(global-set-key (kbd "<C-f1>")  (lambda()(interactive) (kill-this-buffer)))

(add-hook 'bs-mode-hook 'turn-on-font-lock) ; bs.el
(global-set-key (kbd "C-%") 'replace-regexp)
;(global-set-key [(meta _)] 'sh-switch-to-process-buffer)

(global-unset-key "\M-q")
(global-set-key (kbd "M-q q") 'fill-paragraph)
(global-set-key (kbd "M-q w") 'unfill-paragraph)

(global-set-key (kbd "C-c t t")  'delete-trailing-whitespace)
(global-set-key (kbd "C-c t f")  'flush-blank-lines)
#+end_src

Wednesday, March 08, 2017

How to enable Nginx FancyIndex on Ubuntu

> From: How to enable Nginx FancyIndex on Ubuntu


sudo apt-get install nginx-extras

location / {
fancyindex on;
fancyindex_exact_size off;
}
Read more about Nginx FancyIndex:
  • http://wiki.nginx.org/NgxFancyIndex
  • https://github.com/aperezdc/ngx-fancyindex

Tuesday, March 07, 2017

SQLite Source Code Blocks in Org Mode



SQLite Source Code Blocks in Org Mode--> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sqlite.html

# -*- coding: utf-8 -*-
#+STARTUP: content
#+LANGUAGE: ko
#+PROPERTY: header-args:sqlite :dir ~/org/ :db journal.db :var rel="cur" :results line :colnames yes

: header arguments -> :csv, :column, :line, :list, :html
: results -> silent raw
: separator \

※ 1. File scope variable which is name "#+PROPERTY" can be located any location of file.
※ 2. "#+PROPERTY" var will be initialize when file opening time.
    (therefore, if you modify "#+PROPERTY" it can be use until reopen the file again!)

* sqlite org babel

  [[http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sqlite.html][guide_from orgmode.org]]

** emacs babel setup
#+TITLE: dot
#+begin_src elisp
(org-babel-do-load-languages
 'org-babel-load-languages (quote ((emacs-lisp . t)
                                    (sqlite . t)
                                    (R . t)
                                    (python . t))))
#+end_src

** Org Mode Features for SQLite Source Code Blocks
Header Arguments
Language-specific default values

There are no language-specific default header arguments for SQLite.

** Language-specific header arguments
   There are 11 SQLite-specific header arguments. 

db
    a string with the name of the file that holds the SQLite database. Babel requires this header argument.
header
    if present, turn on headers in the output format. Headers are also output with the header argument :colnames yes.
echo
    if present, set the SQLite dot command .echo to ON.
bail
    if present, set the SQLite dot command .bail to ON.
csv
    the default SQLite output format for Babel SQLite source code blocks.
column
    an SQLite output format that outputs a table-like form with whitespace between columns.
html
    an SQLite output format that outputs query results as simple HTML tables.
line
    an SQLite output format that outputs query results with one value per line.
list
    an SQLite output format that outputs query results with the separator character between fields.
separator
    a string that specifies the separator character used by the SQLite `list' output mode and by the SQLite dot command .import.
nullvalue
    a string to use in place of NULL values. 

** Variables
  It is possible to pass variables to sqlite. Variables can be of type table or scalar. Variables are defined using :var=<value> and referred in the code block as $<name>.

Table variables
    Table variables are exported as a temporary csv file that can then be imported by sqlite. The actual value of the variable is the name of temporary csv file.
Scalar variables
    This is a value that will replace references to variable's name. String variables should be quoted; otherwise they are considered a table variable.

** Sessions
  SQLite sessions are not supported.

** Result Types
   SQLite source code blocks typically return the results of a query. The header arguments :csv, :column, :line, :list, and :html determine the output format.

: #+PROPERTY: header-args:sqlite :dir ~/org/ :db org.db :results list


* sample create
: #+name: sqlite-populate-test
: #+header: :results line
: #+header: :dir ~/tmp/
: #+header: :db hello.db
: #+begin_src sqlite
: create table greeting(one varchar(10), two varchar(10));
: insert into greeting values('Hello', 'world!');
: #+end_src

#+begin_src sqlite
create table greeting(one varchar(10), two varchar(10));
insert into greeting values('Hello', 'world!');
#+end_src


* sample query
: #+name: sqlite-hello
: #+header: :list
: #+header: :separator \ 
: #+header: :results raw
: #+header: :dir ~/tmp/
: #+header: :db hello.db
: #+begin_src sqlite
: select * from greeting;
: #+end_src

#+begin_src sqlite
select * from greeting;
#+end_src

#+RESULTS:
| one   | two    |
|-------+--------|
| Hello | world! |


* Using scalar variables

** using local var.
#+BEGIN_SRC sqlite :db ~/org/journal.db :var rel="tname" n=300 :colnames yes
drop table if exists $rel;
create table $rel(n int, id int);
insert into $rel(n,id) values (1,210), (3,800);
select * from $rel where id > $n;
#+END_SRC

#+RESULTS:
| n |  id |
|---+-----|
| 3 | 800 |



** usign file var.
#+BEGIN_SRC sqlite :var n=300 
drop table if exists $rel;
create table $rel(n int, id int);
insert into $rel(n,id) values (1,210), (3,800);
select * from $rel where id > $n;
#+END_SRC

#+RESULTS:
| n |  id |
|---+-----|
| 3 | 800 |



* Using table variables

  We can also pass a table to a query. In this case, the contents of the table are exported as a csv file that can then be imported into a relation:


** local var.

#+NAME: tableexample
| id |  n |
|----+----|
|  1 |  5 |
|  2 |  9 |
|  3 | 10 |
|  4 |  9 |
|  5 | 10 |

#+begin_src sqlite :db ~/org/journal.db :var orgtable=tableexample :colnames yes
drop table if exists testtable;
create table testtable(id int, n int);
.mode csv testtable
.import $orgtable testtable
select n, count(*) from testtable group by n;
#+end_src

#+RESULTS:
|  n | count(*) |
|----+----------|
|  5 |        1 |
|  9 |        2 |
| 10 |        2 |


** using global file var.
#+begin_src sqlite :var orgtable=tableexample
drop table if exists testtable;
create table testtable(id int, n int);
.mode csv testtable
.import $orgtable testtable
select n, count(*) from testtable group by n;
#+end_src

#+RESULTS:
|  n | count(*) |
|----+----------|
|  5 |        1 |
|  9 |        2 |
| 10 |        2 |

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