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

Sunday, December 28, 2014

how to enable UTF-8 encoding

http://yoo2080.wordpress.com/2013/09/09/how-to-enable-unicode-encoding-lexical-scope-and-cl-functions-in-an-emacs-lisp-file/

1. how to enable UTF-8 encoding

In order to be able to use Unicode characters (in strings or comments) in your init file, visit the init file, then invoke the command add-file-local-variable-prop-line to add the file local variable coding with utf-8 as its value.

M-x add-file-local-variable-prop-line RET coding RET utf-8 RET
 
=> ;;; -*- coding: utf-8; -*-
 

Wednesday, December 03, 2014

Making Gnus behave like other mail readers

- http://www.emacswiki.org/emacs/GnusTutorial

Making Gnus behave like other mail readers

FIXME: This section is very incomplete! I hope that somebody will provide us with settings that might be desirable.

Don't hide messages that have been read

Gnus operates in a newsreaderly fashion and thinks that most of the time you don’t want to read messages twice. So it hides from you the messages that you have read already. It does not, however, delete these messages! They are still on disk.
If you want to see old messages, use C-u <RET> to enter a group, or type C-u M-g from within the group. If you always want to see old messages for a specific group, hit G c (not g c) on it and frob the display parameter. If you want to see old messages for several groups, you can also set the parameter on a topic. If you want to do it by group name, see the variable gnus-parameters (in recent Gnusae only).
But I advise against this, because showing a lot of messages in the summary buffer is quite slow in Gnus, and you can tell Gnus to show you the interesting ones. For example, I use
     (setq gnus-fetch-old-headers t)
and this means that when a new followup arrives in a thread, I see the previous messages from that thread, too. Of course, from time to time, I want to look at old messages and use C-u <RET> or C-u M-g, as described above.

Friday, November 28, 2014

http://stackoverflow.com/questions/378319/windows-explorer-command-prompt-here

You can edit the registry to add the Command Prompt item to the context menu. Here are a couple of .reg files that I use.

Cmdhere.reg - for WinNT/2000/XP/Vista/7:
-- start of here
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew\Command]
@="cmd.exe /k cd %1"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew\Command]
@="cmd.exe /k cd %1"
-- end of here
 
 
Doshere.reg - for Win9x:
-- start of here 
REGEDIT4
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew]
@="MS-DOS Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew\Command]
@="command.com /k cd %1"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew]
@="MS-DOS Prompt"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew\Command]
@="command.com /k cd %1"
-- end of here
 
Copy this into an empty text file and change the extension to .reg. Double-clicking on this in Windows Explorer will add these key to the registry.

Sunday, October 12, 2014

Switch between two input method in windows hot key


- 101key default value registery
--
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\i8042prt\Parameters]
"LayerDriver KOR"="KBD101A.DLL"
"OverrideKeyboardIdentifier"="PCAT_101AKEY"
"OverrideKeyboardType"=dword:00000008
"OverrideKeyboardSubtype"=dword:00000003
"LayerDriver JPN"="kbd101.dll"



* change with two input method with toggle key shift+space

-> 103key default value registery
--
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters]
"LayerDriver KOR"="KBD101C.DLL"
"OverrideKeyboardIdentifier"="PCAT_101CKEY"
"OverrideKeyboardType"=dword:00000008
"OverrideKeyboardSubtype"=dword:00000005
"LayerDriver JPN"="kbd101.dll"

Java Variable in windows

JAVA_HOME=C:\java\jdk1.7.0_65\
PATH=%PATH%;JAVA_HOME\bin\

CLASSPATH=.;%JAVA_HOME%\lib\tools.jar;

Wednesday, April 16, 2014

Heartbleed bug in OpenSSL

From: http://haydenjames.io/patched-servers-remain-vulnerable-heartbleed-openssl/

Check if Heartbleed-Patched OpenSSL is installed


openssl version -a
– OpenSSL 1.0.1 through 1.0.1f are vulnerable
– OpenSSL 1.0.1g is NOT vulnerable
– OpenSSL 1.0.0 branch is NOT vulnerable
– OpenSSL 0.9.8 branch is NOT vulnerable

Patching Heartbleed Vulnerability is not enough!

 ...
if an attacker has already exploited the Heartbleed bug to steal your SSL private keys they can continue to decrypt all past and future traffic even after the vulnerability has been patched – using the existing stolen keys.

Sunday, January 26, 2014

Joining wmv files

ex.1
mplayer\mencoder.exe -oac copy -ovc copy -of lavf -lavfopts format=wmv u:\t\a_1.wmv u:\t\a_2.wmv -o aa.wmv

ex.2
mencoder -oac copy -ovc copy -of lavf -lavfopts format=asf myfile.wmv.001 myfile.wmv.002 -o myfile.wmv

Locate for Windows Win32Locate vs. Locate32

- Win32 Locate and Updatedb Scripts (Commandline for Windows)
  http://sourceforge.net/projects/winlocate/ (winlocate-0.1.6.zip)
  > Win32Locate\Updatedb.bat p: m:

- Locate32 (Gui for Windows)
  http://sourceforge.net/projects/locate32/ (locate32-3.1.11.7100.zip)
  > (Administrate priviledge and Evn. setting)
  > help
  updtdb32 -h

; view
net view

; Create Drive
net use p: \\pi\pi

; updatedb
locate32\Updtdb32.exe -d d:\tmp\Locate32_PI-UP.dbs -cU -Lp:\usbup

; Delete Network Drive
net use /delete p:

Create an offline installer for Visual Studio from a Web Installer

- download patch
from: http://sstjean.blogspot.kr/2013/03/how-to-create-offline-installer-for.html

30 March 2013

Synopsis

"VS2012.4.exe" /layout

- download cd-dvd recorder ; infrarecorder
> http://infrarecorder.org

- check file ; md5sum (MinGW)
> http://sourceforge.net/projects/mingw/
md5sum ---help
md5sum -c binary_package_file

- recording

Friday, January 24, 2014

Sysinternal Process Explorer & Monitor

** Process Monitor v3.05 By Mark Russinovich and Bryce Cogswell
Published: June 4, 2013
http://technet.microsoft.com/en-us/sysinternals/bb896645
http://channel9.msdn.com/Shows/Defrag-Tools/Defrag-Tools-3-Process-Monitor

** Defrag Tools: #2 - Process Explorer
Process Explorer v15.40 By Mark Russinovich
Published: August 1, 2013
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

http://channel9.msdn.com/Shows/Defrag-Tools/Defrag-Tools-2-Process-Explorer

[Aug 2012, 29 min] Defrag Tools: #4 - Process Monitor - Examples
http://channel9.msdn.com/Shows/Defrag-Tools/Defrag-Tools-4-Process-Monitor

Pranten

 Pranten