Thursday, September 24, 2015

7 Of The Fastest Growing Fruit Trees

http://makingdiyfun.com/7-of-the-fastest-growing-fruit-trees/

1. Peaches & Nectarines.
2. Cherries.
3. Apple Tree.
4. Pear Tree.
5. Apricot tree.
6. Figs.

Monday, September 21, 2015

Monday, August 17, 2015

How to upgrade windows 10


How to upgrade windows 10

  1. use windows Auto update
  1. with Install Tools
http://answers.microsoft.com/ko-kr/windows/forum/windows_10-windows_install/%EC%9C%88%EB%8F%84%EC%9A%B0/4f06cdf8-bf9b-4d03-8882-8bf8e92d6d85?auth=1
[작업 방법 2. Windows 10 설치 도구로 진행하는 방법] 아래의 링크를 클릭하여 설치 파일 다운로드 페이지로 이동합니다. https://www.microsoft.com/ko-kr/software-download/windows10 다운로드 페이지에서 PC의 환경에 따라 지금 도구 다운로드(32비트 버전) 혹은 지금 도구 다운로드(64비트 버전)를 클릭합니다. MediaCreationTool.exe(64bit의 경우, MediaCreationToolx64.exe)를 저장 후, 실행합니다. 지금 이 PC 업그레이드 항목을 선택하고 다음 버튼을 클릭하여 진행 절차에 따라 진행합니다. (다른 PC용 설치 미디어 만들기를 통해서 설치 미디어 제작 후 업그레이드를 진행해보실 수도 있습니다.)
  • Prepare
시작하기 전에
다음을 확인합니다. 인터넷 연결(인터넷 서비스 공급자 요금이 적용될 수 있음) 컴퓨터, USB 또는 외장형 드라이브에 다운로드에 사용할 만큼 충분한 데이터 저장 공간 확보 미디어를 만들려는 경우 4GB 이상의 공간이 있는 빈 USB 또는 DVD(및 DVD 버너) 모든 콘텐츠가 삭제되므로 비어 있는 USB 또는 DVD를 사용하는 것이 좋습니다. 시스템 요구 사항을 확인합니다. 처음으로 운영 체제를 설치하는 경우 Windows 제품 키(xxxxx-xxxxx-xxxxx-xxxxx-xxxxx)가 필요합니다. 제품 키와 제품 키가 필요한 경우에 대한 자세한 내용은 FAQ 페이지를 참조하세요. Enterprise 버전을 다운로드하려면 볼륨 라이선스 서비스 센터에 로그인합니다.
미디어 생성 도구 를 사용하여 Windows를 다운로드합니다. 이 도구는 Windows 7, 8.1 및 10을 실행하는 고객을 위한 최상의 다운로드 환경을 제공합니다. 도구에는 다음이 포함됩니다.
다운로드 속도에 최적화된 파일 형식 USB 및 DVD용 기본 제공 미디어 생성 옵션 ISO 파일 형식으로의 선택적인 변환
  • select option > Version N is made for the EU market and does not include Windows Media Player. KN is made for the Korean Market and does not include Windows Media Player or an Instant Messenger. VL are volume license editions for business enterprise customers and uses MAK (Multiple Activation Keys) or KMS (Key Management Server) to activate.
    -> if you installed KN or N Version Median Pack can be downloaded following link http://www.microsoft.com/ko-kr/download/details.aspx?id=48231
    > architecture: 64 or 32bit
08월18일(화)_01:50:03+UTC_Y2015

Monday, July 20, 2015

Connecting to a Postgresql Database in OpenOffice - how to connect postgres in openoffice

how to connect postgres in openoffice
 
--> https://wiki.openoffice.org/wiki/Base/connectivity/PostgreSQL

Base/connectivity/PostgreSQL

Connecting to a Postgresql Database

Using the SDBC Driver


Download the SDBC driver from PostgreSQL SDBC Driver This page has additional information on the driver.

Installation with OOo 2.x

DO NOT unzip the driver.

  • Go to menu bar
  • Open Tools/Extension Manager

ExtMgr.jpg


  • Highlight My Extensions
  • Click on Add... Button
  • Go to folder where SDBC driver was downloaded
  • Click Open
  • Make sure that it is enabled
  • Close extension manager
  • Shutdown OOo including the Quick Starter. You might have to use Task Manager in order to shutdown soffice.bin


  • Start OOo Base
  • The Database Wizard window will open up
  • Select Database...

DbWizard1.jpg

Note: Your Postgresql database must already exist.
  • Click on Connect to existing database radio button
  • Scroll down to postgresql
  • Click Next>>
  • Connection Setting...

DbWizard2.jpg


  • In the text box type: dbname=NameOfDatbase host=localhost. NameOfDatabase is the name of the Postgresql database that you are connecting to and use localhost if the Postgresql server is on your computer.
  • Click Next>>
  • Set up user authentication...

DbWizard3.jpg


  • Enter user name of Postgresql database
  • Click Test Connection

DbWizard4.jpg


  • Type in database password and click OK
  • If test connection is successful click OK
  • Click Next>>

DbWizard5.jpg


  • Click Finish
  • Type in OOo Base file name for this front end to your Postgresql database

Thursday, May 28, 2015

MS-Word 에서 Emacs Key 지정

1. 기존에 있는  명령어에서 지정

Word Option > 왼쪽창 [사용자 지정]
            > 오른쪽 창 아래 [사용자 지정]
            > 창 [키보드 사용자 지정]
            > 좌측 범주 [모든 명령] 선택

  --> 오른쪽 창 --> (아래 선택) -> 새 바로가기 키 지정 -> 지정
C-b – CharLeft   현재키: 추가  Ctrl+B
C-f – CharRight  ->
C-e – EndOfLine  
C-p – LineUp
C-n – LineDown
C-a – StartOfLine
;; 붙여넣기는 키 중복으로 윈도우즈에서 보류한다. -> C-v – PageDown


2. 글자 하나 지우는 것과 라인 끝까지 지우는 건 매크로 지정으로 처리

Word Option > 좌측창 [기본설정] > 우측창 - Word에서 갖아 많이 사용하는 옵션
          > [리본 메뉴에 개발 도구 탭 표시] 체크 함
          > 화면 상단 우측에 [보기] 메뉴 우측에 [개발 도구] 메뉴가 표시 됨

       화면상단 [매크로 기록] 클릭 ->
          매크로 이름 지정 -> "DeleteCharacter"
          매크로 할당 위치 -> 키보드 클릭 -> (작업수행)  -> 화면상단 -> [매크로 기록 중지] 클릭

Here’s the procedure, in MS Word 2011 for Mac.
    Tools → Macros → Record Macro
    Give it a name with no spaces
    Click the keyboard button to assign a keystroke to it
    Select OK
    Type the set of key strokes
    Tools → Macros → Stop Recording

C-d – [DeleteCharacter] (as a macro)
C-k – [KillLine] (as a macro)

한글 & 중국어 입력 -- dot/init-multi.el

dot/init-multi.el

;;;; ----------------------------
;;;; key define
;; Input method and key binding configuration.
;; http://stackoverflow.com/questions/12032231/is-it-possible-to-alternate-two-input-methods-in-emacs
(setq alternative-input-methods
      '(
        ("korean-hangul"    . [?\C-\\])
        ("chinese-py-punct" . [?\C-|])

;       ("chinese-py-punct" . [?\M- ])
        ("korean-hangul"    . [?\M- ])    ;; m-spc   > hangul
        ("chinese-py-punct" . [?\S-\M- ]) ;; m-s-spc > chinese

;       ("russian-computer" . [?\C-\M-|])
;       ("german-postfix"   . [?\C-\\])
  ))

(setq default-input-method
      (caar alternative-input-methods))

(defun toggle-alternative-input-method (method &optional arg interactive)
  (if arg
      (toggle-input-method arg interactive)
    (let ((previous-input-method current-input-method))
      (when current-input-method
        (deactivate-input-method))
      (unless (and previous-input-method
                   (string= previous-input-method method))
        (activate-input-method method)))))

(defun reload-alternative-input-methods ()
  (dolist (config alternative-input-methods)
    (let ((method (car config)))
      (global-set-key (cdr config)
                      `(lambda (&optional arg interactive)
                         ,(concat "Behaves similar to `toggle-input-method', but uses \""
                                  method "\" instead of `default-input-method'")
                         (interactive "P\np")
                         (toggle-alternative-input-method ,method arg interactive))))))

(reload-alternative-input-methods)
;;;; ----------------------------


;;;; ----------------------------
;;;; set font
;(if (not (member '("-*-courier new-normal-r-*-*-13-*-*-*-c-*-fontset-chinese" . "fontset-chinese") fontset-alias-alist))
;    (progn
;        (create-fontset-from-fontset-spec    ; chinese fontset
;        "-*-Courier New-normal-r-*-*-14-*-*-*-c-*-fontset-chinese,
;         chinese-gb2312:-*-MS Song-normal-r-*-*-12-*-*-*-c-*-gb2312*-*,
;         chinese-big5-1:-*-MingLiU-normal-r-*-*-12-*-*-*-c-*-big5*-*,
;         chinese-big5-2:-*-MingLiU-normal-r-*-*-12-*-*-*-c-*-big5*-*" t)
;         (setq default-frame-alist
;            (append
;             '((font . "fontset-chinese"))
;             default-frame-alist))
;    )
;)

(set-fontset-font "fontset-default" 'han '("Microsoft YaHei". "unicode-bmp"))
;;(frame-parameter nil 'font)?????fontset-default???
(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"))

;;;; ----------------------------------------
;;;; -- eim
;(load (concat emacs-lib-path "dot/init-china.el"))
;;;; -- use eim input
(setq load-path (append load-path (list (concat emacs-lib-path "eim"))))
(autoload 'eim-use-package "eim" "Another emacs input method")

;; Tooltip 暂时还不好用
(setq eim-use-tooltip nil)

(register-input-method "eim-wb" "euc-cn" 'eim-use-package "五笔" "汉字五笔输入法" "wb.txt")
(register-input-method "eim-py" "euc-cn" 'eim-use-package "拼音" "汉字拼音输入法" "py.txt")

;; 用 ; 暂时输入英文
(require 'eim-extra)
;(global-set-key ";" 'eim-insert-ascii)

(set-frame-font "Inconsolata 12")
;(set-face-attribute 'default nil :height 100)

;;;; end of chinese
;;;; --------------------------------------------------------------------------------

Wednesday, May 20, 2015

Audacity - Tutorial - Recording Computer Playback on Windows

http://manual.audacityteam.org/o/man/tutorial_recording_computer_playback_on_windows.html

Tutorial - Recording Computer Playback on Windows

 

Choosing the recording device in Audacity

Choose "MME" or "Windows DirectSound" in the Audio Host box of Device Toolbar and the sound device's input for recording computer playback in the third (Recording Device) box of Device Toolbar. You can also choose this recording device at Recording Device in Devices Preferences.
DeviceToolbarWin7Basic.png
If the sound device provides an input for recording computer playback, it could be called "Stereo Mix", "Wave Out", "Sum", "What U Hear", "Loopback" or other names. The exact name and whether such an input is available depends entirely on the drivers of your sound device. Also Audacity will not see this input unless it is enabled in the Windows Control Panel.
You must play the audio you want to record using the same sound device that has the "Stereo Mix" or similar input. You cannot play audio through an HDMI output or through a headset, headphones or speakers that connect via USB or wirelessly then record that playback using the stereo mix input of the built-in sound device. Choose the Windows WASAPI host (next section) if you want to record playback of a USB, wireless or external sound device.
Warning icon Transport > Software Playthrough (on/off) should be off when recording computer playback, so if Software Playthrough has a check mark, click that item to turn it off. Otherwise you will hear and record echoes or distorted sound.

Windows WASAPI loopback recording

On Windows Vista, Windows 7 or Windows 8 only you can choose the Windows WASAPI  Audio Host and then the (loopback) input in the Recording Device box. Choose the loopback input for the computer playback device you will be listening to (for example, "Speakers (loopback)" ). The loopback input records computer playback even if your sound device lacks its own stereo mix or similar input:
DeviceToolbarStreamingAudio - WASAPI loopback.png
WASAPI loopback has an advantage over stereo mix or similar inputs provided by the soundcard that the capture is entirely digital (rather than converting to analog for playback, then back to digital when Audacity receives it). System sounds playing through the device selected for WASAPI loopback are still captured, however.

Playback and Recording sliders

The behavior of the Audacity playback and recording sliders may vary according to the sound device you are recording from.

....

http://manual.audacityteam.org/o/man/tutorial_recording_computer_playback_on_mac.html

Tutorial - Recording Computer Playback on Mac

 

Use Soundflower

Soundflower is a free open source system add-on for Mac computers that allows you to route what is playing on the computer digitally back to the input without using a cable. Set Soundflower as your system output device, then in Audacity, set Soundflower as your recording device.
  1. Download the latest version of Soundflower. It is possible that older versions of Soundflower may work better on older versions of OS X. Older versions of Soundflower may be obtained if necessary at https://code.google.com/p/soundflower/downloads/list.
  2. If the downloaded zip file does not extract automatically, double-click it to extract the DMG file it contains, or use your favorite extraction utility. To install the extracted DMG file, double-click it to mount it. In the DMG itself, double-click the PKG file.
    Warning icon If you see a warning on OS X 10.7.5 or later that Soundflower cannot be opened due to your Security Preferences, right-click or control-click over the PKG file and choose "Open", then choose "Open" again.
  3. After opening the PKG file, you may see a warning that the certificate for the installer has expired. Press "Show Certificate" to review the certificate then choose "Continue".
  4. Then run through the standard installer steps. Save your work in other applications, then press the button in the installer to restart your Mac.
  5. Choose Apple Menu > System Preferences and select the Sound preferences panel.
  6. In the Sound preferences panel, choose the Output tab, then select "Soundflower (2ch)" from the "Select a device for sound output:" list and turn the Output volume up.
    MacSoundPrefsSoundflower.png
  7. In the same panel, choose the Input tab, select "Soundflower (2ch)" and and turn the Input volume up.
    • At this point you will no longer be able to hear what is playing on the computer. The sound output of the computer is being sent to Soundflower.
  8. Click on the "Sound Effects" tab, and from the "Play sound effects through" dropdown menu choose "Line Out", "Headphones" or "Internal Speakers" (whichever is appropriate for your system).
    • This will route some system alert sounds (such as Mail alert sounds) to the Line Out or Internal Speakers and not to Soundflower. Thus these sounds will not be recorded by Audacity.Some Macintosh applications are better behaved than others when it comes to alert sounds. Tests on a recent iMac running 10.7.2 show that Mail and TextEdit alert sounds will not be recorded with the above setup, but iCal and Yahoo Messenger alert sounds will be recorded. To be safe you should disable the sound on any iCal alerts that may occur while you are recording, and quit any other program that may make an alert sound.
  9. Close the System Preferences window.
  10. Start Audacity.
  11. In Audacity's Device Toolbar, select Built-in Output  MenuDownArrow.png or similar as Playback Device and Soundflower (2ch)  MenuDownArrow.png as Recording Device.
    DeviceToolbarMac02.png
  12. Click on the Transport menu and make sure that "Software Playthrough" is checked.
  13. Go to the application that will be playing the sound you want to record. For example, start Safari and go to a website that plays sound clips. Start some audio playing.
  14. Click on the recording level meters (beside the microphone symbol) to begin monitoring:
    Recording Toolbar in use.png
    You should now be able to hear the sound playing on your computer.
  15. Now click Record to record anything playing on your computer.

To set things back to "normal" so you can hear audio playing on your computer without running Audacity

1) Click on Apple Menu > System Preferences then the Sound panel, and select the Output tab. Select "Line Out", "Internal Speakers" or "Headphones" in the output device list. See step 3 above for an illustration.
2) In Audacity, if you want to record from a different source (such as the Line Input or an external USB device), click on Audacity > Preferences then the Devices section and select the input you want to record from in the Recording section. See step 7 above for an illustration.

 

Tuesday, May 12, 2015

Emacs - Chinese setting

;;;; dot ----------------------------
;;;; 1. load with default (with hangul)
;;;; 2. load chinese setting -> chinese ==> f10
;;;; 3. change chinese -> korean ==> M-SPC = change font in english mode with chinese
;;;; 4. change korean -> chinese ==> f2 = my-inconsolata-hangul

(defun my-inconsolata-china ()
  (interactive)  "set font"
  (set-frame-font "Inconsolata 12")
; (set-face-attribute 'default nil :height 100)
  (load "d:/Pkg/emacs/lib/dot/init-china.el"))

(global-set-key [f10] 'my-inconsolata-china)
;(my-inconsolata-china)

(defun my-inconsolata-hangul ()
  (interactive)  "load set hangul"
; (set-frame-font "Inconsolata 12")
; (set-face-attribute 'default nil :height 100)
  (activate-input-method "korean-hangul"))

(global-unset-key (kbd "M-SPC"))
(global-set-key (kbd "M-SPC") 'my-change2-chinese)

(defun my-change2-chinese ()
  (interactive)  "set hangul input"
; (set-keyboard-coding-system 'chinese-iso-8bit)   ; input
; (set-language-environment "Chinese-GB18030")
  (load "d:/Pkg/emacs/lib/dot/init-china.el")
  (toggle-input-method)
)

;(global-unset-key [f2] 'my-inconsolata-hangul)
(global-set-key [f2] 'my-inconsolata-hangul)

;;;; init-china.el --------------------------------
;;;; --------------------------------------------------------------------------------
;;;; -- Chinese

;;;; -- chinese language
(set-keyboard-coding-system 'chinese-iso-8bit)   ; input
;(set-selection-coding-system 'chinese-iso-8bit)  ; copy/paste

;(setq w32-enable-synthesized-fonts t)

(if (not (member '("-*-courier new-normal-r-*-*-13-*-*-*-c-*-fontset-chinese" . "fontset-chinese") fontset-alias-alist))
    (progn
        (create-fontset-from-fontset-spec    ; chinese fontset
        "-*-Courier New-normal-r-*-*-14-*-*-*-c-*-fontset-chinese,
         chinese-gb2312:-*-MS Song-normal-r-*-*-12-*-*-*-c-*-gb2312*-*,
         chinese-big5-1:-*-MingLiU-normal-r-*-*-12-*-*-*-c-*-big5*-*,
         chinese-big5-2:-*-MingLiU-normal-r-*-*-12-*-*-*-c-*-big5*-*" t)
         (setq default-frame-alist
            (append
             '((font . "fontset-chinese"))
             default-frame-alist))
    )
)

(set-language-environment "Chinese-GB18030")
;(setq file-name-coding-system 'gb18030)

;;set font
; Microsoft JhengHei / ???? /
;    (set-fontset-font "fontset-default"
;    'gb18030 '("Microsoft YaHei" . "unicode-bmp"))
;;?????????????? :pixelsize=18:foundry=monotype:weight=medium:slant=i:width=normal
;;????????M-x describe-char??????

;; (if (eq system-type 'windows-nt)
;;     (set-default-font "Courier New")
;; (set-default-font "Bitstream Vera Sans Mono"))
;(set-frame-font "YaHei Consolas Hybrid-12")

(set-fontset-font "fontset-default" 'han '("Microsoft YaHei". "unicode-bmp"))
;;(frame-parameter nil 'font)?????fontset-default???
(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"))

;;;; ----------------------------------------
;;;; -- eim
;(load (concat emacs-lib-path "dot/init-china.el"))
;;;; -- use eim input
(setq load-path (append load-path (list (concat emacs-lib-path "eim"))))
(autoload 'eim-use-package "eim" "Another emacs input method")

;; Tooltip 暂时还不好用
(setq eim-use-tooltip nil)

(register-input-method "eim-wb" "euc-cn" 'eim-use-package "五笔" "汉字五笔输入法" "wb.txt")
(register-input-method "eim-py" "euc-cn" 'eim-use-package "拼音" "汉字拼音输入法" "py.txt")

;; 用 ; 暂时输入英文
(require 'eim-extra)
;(global-set-key ";" 'eim-insert-ascii)

(set-frame-font "Inconsolata 12")
;(set-face-attribute 'default nil :height 100)

;;;; end of chinese
;;;; --------------------------------------------------------------------------------

Thursday, April 23, 2015

How to use SQL Query in emacs org-mode


- How to use SQL Query in emacs org-mode
  (org-mode 에서 Postgres SQL 사용)

* Install Postgres
   - omitted


* set up for SQL-mode
   - not always necessary

;;   (load (concat emacs-lib-path "dot/init-sql.el")) ; postgres v.1

#+begin_src emacs-lisp
;;
;; usage:  M-x sql-connect --> "if fail" --> retry again!
;; M-x sql-postgres
;; sql-send-region : C-c C-r
;; sql-send-buffer : C-c C-b
;;
;-- 1. Open sql file  ( chagne buffer sql-mode )
;-- 2. M-x sql-connect --> emacsdb
;-- input buffer *SQL-postgres* or *SQL*
;-- C-c C-r : send region
;-- C-c C-b : send buffer
;-- output is --> *SQL* buffer

;-- DB:emacsdb / Table:headers
;select title, sender, receiver, datetime_txt, size, sent_received from headers where datetime_txt like '%12-10%';
;select title, sender, receiver, datetime_txt, size, sent_received from headers where title like '%체크%';

;-- DB:emacsdb / Table:phonebook
;SELECT d_project, string_agg(fullname, ', '), string_agg(email, ',') AS title_list FROM phonebook where d_project like '%cctv%' GROUP  BY 1 ;
;SELECT d_project, string_agg(fullname, ', ') AS title_list FROM phonebook GROUP  BY 1 ;
;SELECT d_project, string_agg(email, ', ') AS title_list FROM phonebook GROUP  BY 1 ;
;SELECT d_project, string_agg(email, ', ') AS email_list FROM phonebook where d_project like '%drone%' GROUP  BY 1 ;
;SELECT fullname, email FROM phonebook where d_attend='y' order by fullname;
;select column_name, data_type, character_maximum_length  from INFORMATION_SCHEMA.COLUMNS where table_name = 'phonebook';
;-- quit  --> \q

(setq sql-postgres-login-params
      '((user :default "kys")
        (database :default "emacsdb")
        (server :default "localhost")
        (port :default 5432)))

;; call toggle-truncate-lines in sql-interactive-mode-hook.
(add-hook 'sql-interactive-mode-hook
          (lambda ()
            (toggle-truncate-lines t)))


(setq sql-connection-alist
 '((emacsdb (sql-product 'postgres)
           (sql-port 5432)
           (sql-server "localhost")
           (sql-user "kys")
           (sql-database "emacsdb")
   )
   (kysdb2 (sql-product 'postgres)
           (sql-port 5432)
           (sql-server "localhost")
           (sql-user "kys")
           (sql-database "kysdb")
   )
 )
)

(defun my-sql-server1 ()
  (interactive)
  (my-sql-connect 'postgres 'server1))

(defun my-sql-server2 ()
  (interactive)
  (my-sql-connect 'postgres 'server2))

(defun my-sql-connect (product connection)
  ;; remember to set the sql-product, otherwise, it will fail for the first time
  ;; you call the function
  (setq sql-product product)
  (sql-connect connection))

(defun my-sql-connect (product connection)
  ;; load the password
  (require my-password "my-pass")

  ;; update the password to the sql-connection-alist
  (let ((connection-info (assoc connection sql-connection-alist))
        (sql-password (car (last (assoc connection my-sql-password)))))
    (delete sql-password connection-info)
    (nconc connection-info `((sql-password ,sql-password)))
    (setq sql-connection-alist (assq-delete-all connection sql-connection-alist))
    (add-to-list 'sql-connection-alist connection-info))

  ;; connect to database
  (setq sql-product product)
  (sql-connect connection))
#+end_src



* enable sql mode with org-mode initial file

- init-org.el
#+begin_src emacs-lisp
(org-babel-do-load-languages
 'org-babel-load-languages
  '(
     (css . t)
;    (dot . t)
     (emacs-lisp . t)
     (js . t)
     (gnuplot . t)
;    (latex . t)
     (ledger . t)
;    (makefile . t)
     (sh . t)
     (python . t)
     (ruby . t)
     (R . t)
     (sh . t)
     (sql . t)  ;; <-- this is for SQL-MODE
;    (sqlite . t)
   ))
#+end_src



* org file - ex. sample.org


** Method-1. All of sql will be setted by the header Properties
   단락 헤더 아래에 모든 쿼리가 Property 에 속성에 대입되어 처리 된다.

 * Postgres
  :PROPERTIES:
  :LANGUAGE: sql
  :engine: postgresql
  :exports: result
  :cmdline: -p 5432 -h localhost -U kys -d emacsdb PGPASSWORD=my-pass
  :END:

#+END_SRC sql
SELECT d_project, string_agg(email, ', ') AS email_list FROM phonebook where d_project like '%drone%' GROUP  BY 1 ;
#+END_SRC


** Method-2. Property is will be setted by per src
 개발 src 속성으로 처리 된다.
#+BEGIN_SRC sql :engine postgresql :exports results :cmdline -p 5432 -h localhost -U kys -d emacsdb PGPASSWORD=my-pass
select fullname, email from phonebook limit 3;
#+END_SRC

#+RESULTS:
| fullname | email             |
|----------+-------------------|
| 임--K    | bin--@--lus.co.kr |
| 방--D    | yhb--@--us.co.kr  |
| 엄--S    | syo--@--\.com     |

#+BEGIN_SRC sql :engine postgresql :exports results :cmdline -p 5432 -h otherhost.com -U kys -d emacsdb PGPASSWORD=my-pass
select fullname, email from phonebook limit 3;
#+END_SRC

#+RESULTS:
| fullname | email             |
|----------+-------------------|
| 임--K    | bin--@--lus.co.kr |
| 방--D    | yhb--@--us.co.kr  |
| 엄--S    | syo--@--\.com     |


* UTF-8
   International Language support


** MS-Windows - UTF-8 with Msys+MinGW

- Hangul with org-mode babel
http://www.iac.es/sieinvens/siepedia/pmwiki.php?n=SIEminars.EnvironmentVariables


** ruby check
- plan text
#+begin_src ruby :exports both :results output
puts "Howdy!"
#+end_src

#+RESULTS:
: Howdy!

- hangul
#+begin_src ruby :exports: both :results output
puts "Howdy!"
puts "한글로처리해라"
#+end_src


evalute
(setenv "LANG" "ko_KR.UTF-8")
(setenv "LC_ALL" "ko_KR.UTF-8")
or
(setenv "LANG"   "C.UTF-8")
(setenv "LC_ALL" "C.UTF-8")

#+BEGIN_SRC ruby :exports both :results output
  puts RUBY_VERSION
  puts __ENCODING__
#+END_SRC


-- shell test
(setenv "LANG" "cp949")
(setenv "LC_ALL" "cp949")

#+BEGIN_SRC ruby :exports both :results output
  puts RUBY_VERSION
  puts __ENCODING__
#+END_SRC

#+RESULTS:
: 1.9.3
: UTF-8

(setenv "LANG" "EUC-KR")
(setenv "LC_ALL" "EUC-KR")

#+BEGIN_SRC ruby :exports both :results output
  puts RUBY_VERSION
  puts __ENCODING__
#+END_SRC

#+name:
: 1.9.3
: UTF-8

- shell test

#+begin_src sh :exports both :results output
printenv |grep LANG
#+end_src

#+RESULTS:
: NLS_LANG=KOREAN_KOREA.KO16MSWIN949
: LANG=ko_KR.UTF-8

> check filename
#+begin_src sh :exports both :results output
ls ~/download/*.txt
#+end_src
#+RESULTS:
: /d/home/download/set_var.txt
: /d/home/download/test.txt


- .cshrc
#+begin_src
setenv LANG C.UTF-8
setenv LC_ALL C.UTF-8
setenv LC_CTYPE C.UTF-8
setenv LC_NUMERIC C.UTF-8
setenv LC_TIME C.UTF-8
setenv LC_COLLATE C.UTF-8
setenv LC_MONETARY C.UTF-8
setenv LC_MESSAGES C.UTF-8
#+end_src

- .emacs_bash
#+begin_src
export TERM=msys
# gettext
export OUTPUT_CHARSET=UTF-8
export TZ=KST+9
#export LANG=ko_KR.UTF-8
#export LANG=C.UTF-8
export LC_ALL='C'
export TPUT_COLORS=256
export HOSTNAME=msys-bash

#export PATH=~/.packer:$PATH:/c/Program\ Files\ \(x86\)/Git/bin
alias open="explorer"
export MSYSTEM=MSYS
export PATH=.:/usr/local/bin:/bin:/mingw/bin:$PATH
#+end_src


.bashrc
#+begin_src
# .bashrc
export SHELL='d:/Pkg/MinGW/msys/1.0/bin/bash.exe'
export LANG="C.UTF-8"
export LC_CTYPE="C.UTF-8"
export LC_NUMERIC="C.UTF-8"
export LC_TIME="C.UTF-8"
export LC_COLLATE="C.UTF-8"
export LC_MONETARY="C.UTF-8"
export LC_MESSAGES="C.UTF-8"
export LC_ALL="C.UTF-8"
#+end_src

How to use SQL Query in emacs org-mode (org-mode 에서 Postgres SQL 사용)

>

org-sql-blog

  • How to use SQL Query in emacs org-mode (org-mode 에서 Postgres SQL 사용)

Install Postgres

  • omitted

set up for SQL-mode

  • not always necessary

;; (load (concat emacs-lib-path "dot/init-sql.el")) ; postgres v.1

;;
;; usage:  M-x sql-connect --> "if fail" --> retry again!
;; M-x sql-postgres
;; sql-send-region : C-c C-r
;; sql-send-buffer : C-c C-b
;;
;-- 1. Open sql file  ( chagne buffer sql-mode )
;-- 2. M-x sql-connect --> emacsdb
;-- input buffer *SQL-postgres* or *SQL*
;-- C-c C-r : send region
;-- C-c C-b : send buffer
;-- output is --> *SQL* buffer

;-- DB:emacsdb / Table:headers
;select title, sender, receiver, datetime_txt, size, sent_received from headers where datetime_txt like '%12-10%';
;select title, sender, receiver, datetime_txt, size, sent_received from headers where title like '%체크%';

;-- DB:emacsdb / Table:phonebook
;SELECT d_project, string_agg(fullname, ', '), string_agg(email, ',') AS title_list FROM phonebook where d_project like '%cctv%' GROUP  BY 1 ;
;SELECT d_project, string_agg(fullname, ', ') AS title_list FROM phonebook GROUP  BY 1 ;
;SELECT d_project, string_agg(email, ', ') AS title_list FROM phonebook GROUP  BY 1 ;
;SELECT d_project, string_agg(email, ', ') AS email_list FROM phonebook where d_project like '%drone%' GROUP  BY 1 ;
;SELECT fullname, email FROM phonebook where d_attend='y' order by fullname;
;select column_name, data_type, character_maximum_length  from INFORMATION_SCHEMA.COLUMNS where table_name = 'phonebook';
;-- quit  --> \q

(setq sql-postgres-login-params
      '((user :default "kys")
        (database :default "emacsdb")
        (server :default "localhost")
        (port :default 5432)))

;; call toggle-truncate-lines in sql-interactive-mode-hook.
(add-hook 'sql-interactive-mode-hook
          (lambda ()
            (toggle-truncate-lines t)))


(setq sql-connection-alist
 '((emacsdb (sql-product 'postgres)
           (sql-port 5432)
           (sql-server "localhost")
           (sql-user "kys")
           (sql-database "emacsdb")
   )
   (kysdb2 (sql-product 'postgres)
           (sql-port 5432)
           (sql-server "localhost")
           (sql-user "kys")
           (sql-database "kysdb")
   )
 )
)

(defun my-sql-server1 ()
  (interactive)
  (my-sql-connect 'postgres 'server1))

(defun my-sql-server2 ()
  (interactive)
  (my-sql-connect 'postgres 'server2))

(defun my-sql-connect (product connection)
  ;; remember to set the sql-product, otherwise, it will fail for the first time
  ;; you call the function
  (setq sql-product product)
  (sql-connect connection))

(defun my-sql-connect (product connection)
  ;; load the password
  (require my-password "my-pass")

  ;; update the password to the sql-connection-alist
  (let ((connection-info (assoc connection sql-connection-alist))
        (sql-password (car (last (assoc connection my-sql-password)))))
    (delete sql-password connection-info)
    (nconc connection-info `((sql-password ,sql-password)))
    (setq sql-connection-alist (assq-delete-all connection sql-connection-alist))
    (add-to-list 'sql-connection-alist connection-info))

  ;; connect to database
  (setq sql-product product)
  (sql-connect connection))

enable sql mode with org-mode initial file

  • init-org.el
(org-babel-do-load-languages
 'org-babel-load-languages
  '(
     (css . t)
;    (dot . t)
     (emacs-lisp . t)
     (js . t)
     (gnuplot . t)
;    (latex . t)
     (ledger . t)
;    (makefile . t)
     (sh . t)
     (python . t)
     (ruby . t)
     (R . t)
     (sh . t)
     (sql . t)  ;; <-- this is for SQL-MODE
;    (sqlite . t)
   ))

org file - ex. sample.org

Method-1. All of sql will be setted by the header Properties

단락 헤더 아래에 모든 쿼리가 Property 에 속성에 대입되어 처리 된다.

  • Postgres

#+END_SRC sql SELECT d_project, string_agg(email, ', ') AS email_list FROM phonebook where d_project like '%drone%' GROUP BY 1 ; #+END_SRC

Method-2. Property is will be setted by per src

개발 src 속성으로 처리 된다.

fullname email
임–K bin–@–lus.co.kr
방–D yhb–@–us.co.kr
엄–S syo–@–\.com
fullname email
임–K bin–@–lus.co.kr
방–D yhb–@–us.co.kr
엄–S syo–@–\.com

UTF-8

International Language support

MS-Windows - UTF-8 with Msys+MinGW

ruby check

  • plan text
puts "Howdy!"
Howdy!
  • hangul
puts "Howdy!"
puts "한글로처리해라"

evalute (setenv "LANG" "ko_KR.UTF-8") (setenv "LC_ALL" "ko_KR.UTF-8") or (setenv "LANG" "C.UTF-8") (setenv "LC_ALL" "C.UTF-8")

  puts RUBY_VERSION
  puts __ENCODING__

– shell test (setenv "LANG" "cp949") (setenv "LC_ALL" "cp949")

  puts RUBY_VERSION
  puts __ENCODING__
1.9.3
UTF-8

(setenv "LANG" "EUC-KR") (setenv "LC_ALL" "EUC-KR")

  puts RUBY_VERSION
  puts __ENCODING__
1.9.3
UTF-8
  • shell test
printenv |grep LANG
NLS_LANG=KOREAN_KOREA.KO16MSWIN949
LANG=ko_KR.UTF-8

> check filename

ls ~/download/*.txt
/d/home/download/set_var.txt
/d/home/download/test.txt
  • .cshrc
setenv LANG C.UTF-8
setenv LC_ALL C.UTF-8
setenv LC_CTYPE C.UTF-8
setenv LC_NUMERIC C.UTF-8
setenv LC_TIME C.UTF-8
setenv LC_COLLATE C.UTF-8
setenv LC_MONETARY C.UTF-8
setenv LC_MESSAGES C.UTF-8
  • .emacs_bash
export TERM=msys
# gettext
export OUTPUT_CHARSET=UTF-8
export TZ=KST+9
#export LANG=ko_KR.UTF-8
#export LANG=C.UTF-8
export LC_ALL='C'
export TPUT_COLORS=256
export HOSTNAME=msys-bash

#export PATH=~/.packer:$PATH:/c/Program\ Files\ \(x86\)/Git/bin 
alias open="explorer"
export MSYSTEM=MSYS
export PATH=.:/usr/local/bin:/bin:/mingw/bin:$PATH

.bashrc

# .bashrc
export SHELL='d:/Pkg/MinGW/msys/1.0/bin/bash.exe'
export LANG="C.UTF-8"
export LC_CTYPE="C.UTF-8"
export LC_NUMERIC="C.UTF-8"
export LC_TIME="C.UTF-8"
export LC_COLLATE="C.UTF-8"
export LC_MONETARY="C.UTF-8"
export LC_MESSAGES="C.UTF-8"
export LC_ALL="C.UTF-8"
04월24일(금)_00:05:56+UTC_Y2015

How to input Chinese Language - IME in Windows

Change chinese input mode with alphbet then click [Shift] -> typing

Tuesday, April 14, 2015

Disable Windows Media Player

How to Disable Windows Media Player in Windows 7 http://www.ofzenandcomputing.com/disable-windows-media-player-windows-7/ Control Panel -> Program Add or Delete -> [Windows Function Use / Delete] -> Media Function -> delete three check 제어판 -> 프로그램 추가/제거 -> 윈도우즈 기능 사용/사용안함 -> 미디어 기능 -> 3개 항목 모두 제거

Thursday, January 15, 2015

여적 .. 몰아서 하기 - 취미생활 끝

test

test

emacs

png, jpeg view in emacs-24.4

ELISP> (emacs-version) "GNU Emacs 24.4.1 (i686-pc-mingw32)\n of 2014-10-25 on LEG570"

DONE popup menu in emacs key

  • State "DONE" from "TODO" [2015-01-16 금 10:08]

lacarte.el (global-set-key "\C-xrp" 'replace-rectangle) ; menu command lacarte-execute-… (global-set-key "\C-xrn" 'insert-number-rectangle) ;if not block insert descedent order

DONE image in emacs-24.4

  • State "DONE" from "TODO" [2015-01-16 금 10:08]

iimage-mode: M-i (Meta+shift+i) 이미지 => 파일://위치/파일이름.확장자 org-mode-unicorn.png

(org-display-inline-images) ;iimage-mode (defun my-epresent-run () "epresent-run start with org-display-inline-images or iimage-mode" (interactive) ; (require 'epresent) (org-display-inline-images) ; or iimage-mode (epresent-run) )

DONE shell command in ruby

  • State "DONE" from "TODO" [2015-01-16 금 10:09]

7z a -tzip d:\home\download\emacs_20150116f.zip d:\pkg\emacs

#+Title 간단한 설명

dir d:/home/download/

#+Title 쉘 압축하기

7z a -tzip d:\\home\\download\\emacs_20150116f.zip d:\\pkg\\emacs
echo "test"
echo "only work with sh.exe"
test      
only work with sh.exe

DONE presentation

  • State "DONE" from "TODO" [2015-01-16 금 10:10]

(load-library "d:/pkg/emacs/lib/dot/epresent") ;open org > M-x epresent-run > ;;;; t:top_level > "n", "p", "t" and quit with "q"

(defun my-epresent-run () "epresent-run start with org-display-inline-images or iimage-mode" (interactive) ; (require 'epresent) (org-display-inline-images) ; or iimage-mode (epresent-run) )

DONE org-mode sql

  • State "DONE" from "TODO" [2015-01-16 금 10:13]

Meta + F11 keybindg :* Heading

SELECT d_project, string_agg(fullname, ', ') AS title_list FROM phonebook GROUP  BY 1 ;
d_pa titl
a aa성
tesa aa스
appa aa성
droa aa범
pcva aa채
quaa aa현
droa aa성
ccta aa영
ccta aa종
cctawc aa경

STARTED Project Journal.org

SELECT d_project, string_agg(fullname, ', ') AS title_list FROM phonebook GROUP  BY 1 ;
CREATE TABLE countries (
  code CHAR(2) NOT NULL,
  year INT NOT NULL,
  gdp_per_capita DECIMAL(10, 2) NOT NULL,
  govt_debt DECIMAL(10, 2) NOT NULL
);
select version();
version
PostgreSQL 9.3.2, compiled by Visual C++ build 1600, 32-bit

org export to html

  • menu bar add (define-key menu-bar-mytools-menu [org-html-export-to-html] '("org2htm" . org-html-export-to-html))
  • css tag add

DONE ruby install & test

  • State "DONE" from "TODO" [2015-01-16 금 10:18]
  • d:\Devs\row.bat
set PATH=c:\windows\system32\;c:\windows
set PATH=%PATH%;d:\Devs\Ruby193\bin
start "Ruby on Windows" /D d:/Devs

> Ruby-1.9.3-p551 (32bit) ==> d:\Devs\Ruby193\ <- install Ruby home > DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe ==> D:\Devs\Ruby193\Ruby_193_DevKit<- install Development kit

  • install ruby development kit

cd d:\Devs\Ruby193\Ruby_193_DevKit ruby dk.rb init

  • test installation

> gem install json –platform=ruby –no-ri –no-rdoc > ruby -rubygems -e "require 'json'; puts JSON.load('1').inspect"

  • check

ruby -v

D:\Devs\Ruby193\Ruby_193_DevKit>ruby -v ruby 1.9.3p551 (2014-11-13) [i386-mingw32]

  • install mysql interface

mysql –user root -p mysql-connector-c-noinstall-6.0.2-win32.zip -> extract => d:\Devs\mysql-connector-c-noinstall-6.0.2

get install mysql2 –no-ri –no-rdoc – –with-mysql-dir=d:\Devs\mysql-connector-c-noinstall-6.0.2

. test

mkdir d:\Devs\test\mysql

cd d:\Devs\test\mysql

https://github.com/lakelse/row => test.rb

– test.rb

require 'mysql2'

client = Mysql2::Client.new(host: 'localhost', username: 'root', password: 'mypass')

sql = 'select NOW() as timestamp'

result = client.query(sql)

result.each do |row|
  puts row['timestamp']
end
  • row.bat ; add path
set PATH=c:\windows\system32;c:\windows
set PATH=%PATH%;D:\Devs\Ruby193\bin
set PATH=%PATH%;D:\Devs\mysql-connector-c-noinstall-6.0.2-win32\lib

start "Rails on Windows" /D D:\Devs\

> select emails group by d_project

SELECT d_project, string_agg(email, ', ') AS email_list FROM phonebook where d_project like '%drone%' GROUP  BY 1 ;
  • test connection
require 'pg'

conn=PGconn.connect( :hostaddr=>"127.0.0.1", :port=>5432, :dbname=>"emacsdb", :user=>"kys", :password=>'mypass')
# or for a non IP address :host => 'my.host.name.com' instead of hostaddr

# run the query
res = conn.exec("SELECT * FROM phonebook")

# Ran only once in order to get field Name
fieldArray=res.fields()
fieldArray.each do |elem|
    print "elem="+elem+"\n"
end

# print data from the query
res.each{ |row|
    puts "Code="+row["code"]  +" title="+row["title"] +" did="+row["did"] +" date_prod="+row["date_prod"] +" kind="+row["kind"] +" len="+row["len"]
}

org-mode languge

def hello(str):
    return "Hello, " + str + "!"
return hello ("dude")
Hello, dude!

Footnotes:

1

DEFINITION NOT FOUND.

01월16일(금)_10:38:09+UTC_Y2015

Pranten

 Pranten