2013년 9월 17일 화요일

emacs python 세팅


  • python.el 설치 
    • package-install python.el
  • python-flymake 설치
    • https://github.com/purcell/flymake-python-pyflakes
    • emacs 세팅
      • (require 'flymake-python-pyflakes)
      • (add-hook 'python-mode-hook 'flymake-python-pyflakes-load)
      • (setq flymake-python-pyflakes-executable "/usr/local/bin/pyflakes")

  • python refactoring
    • Pymacs 설치
      • pip install -e "git+https://github.com/pinard/Pymacs.git#egg=Pymacs"
      • cd src/pymacs
      • sudo python setup.py install
      • python -c "import Pymacs" 이 에러 없음면 설치 완료
      • emacs 에서 package-install pymacs
    • rope, ropemacs 
      • sudo pip install rope
      • sudo pip install ropemacs 
      • cd .emacs.d 
      • hg https://bitbucket.org/agr/ropemacs
    • emacs 설정
      • (defun load-ropemacs()
      •   "Load pymacs and repemacs"
      •   (interactive)
      •   (require 'pymacs)
      •   (pymacs-load "ropemacs" "rope-")
      •     ;; Automatically save project python buffers before refactoring                                                                                                                                                                                                             
      •   (setq ropemacs-confirm-saving 'nil))

      • (add-hook 'python-mode-hook 'load-ropemacs)
      • (global-set-key "\C-xpl" 'load-ropemacs)

2013년 8월 16일 금요일

centos 5.9 python 2.7 python-ldap 설치

yum installl openldap24-libs.i386
yum installl openldap24-libs.x86_64
yum installl openldap24-libs-devel.i386
yum installl openldap24-libs-devel.x86_64

python-ldap-2.4.13.tar.gz download

tar -xvzf python-ldap-2.4.13.tar.gz

cd python-ldap-2.4.13
emacs setup.cfg

lib 에 /usr/lib64/openldap24 ,/usr/lib/openldap24 추가
include 에 /usr/include/openldap24 추가

python setup.py install




2013년 8월 14일 수요일

mac ldap lib 설치

http://projects.skurfer.com/posts/2011/python_ldap_lion/

rb 파일만 넣고
brew install하면 끝남.

그후에 python-ldap 하면 됨.

python ldap 2.3.13

https://pypi.python.org/pypi/python-ldap/2.3.13


centos 6
yum install openldap24-libs-devel.x86_64

2013년 8월 13일 화요일

python mysql connector 설치 및 SQLAachemy 연동

You can use the MySQL Connector/Python
Installation via PyPip
pip install mysql-connector-python
Further information can be found on the MySQL Connector/Python 1.0.5 beta announcement blog.
On Launchpad there's a good example of how to add-, edit- or remove data with the library.



MySQL-Connector Notes

Support for the MySQL database via the MySQL Connector/Python adapter.
MySQL Connector/Python is available at:

Connecting

Connect string format:
mysql+mysqlconnector://<user>:<password>@<host>[:<port>]/<dbname>

http://docs.sqlalchemy.org/en/rel_0_7/dialects/mysql.html#id5

2013년 8월 9일 금요일

maven net.sf.json-lib 등록시 json-lib.jar 없을때

<dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier>
        </dependency>
       

2013년 8월 5일 월요일

android sdk 콘솔에서 update

./android update sdk --no-ui

android console org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp

jenkins에서  org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp 발생시 확인 사항

  • ant-1.8 이상 확인
  • jenkins에 ANT_HOME이 ant-1.8로 되어 있는지 확인 



2013년 8월 1일 목요일

python wsdl client 사용업

> pip install sudl

python > from sudl import Client
python > client = Client("wsdl 주소")

메소드 확인
python > print client

메소드 실행 방법

python > client.service.메소드(파라미터)

접속에러시

python > client.set_options(location="wsdl 메소드 url")

디버그 방법
http://stackoverflow.com/questions/4426204/how-can-i-output-what-suds-is-generating-receiving
from suds.client import Client
import logging

logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
logging.getLogger('suds.xsd.schema').setLevel(logging.DEBUG)
logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)

SB_PRIVATE_ACCESS = {"PATH":"https://thisurl.com:443/services/",}

client = Client(SB_PRIVATE_ACCESS['PATH'])
print client

parallel로 test 코드 짜기

http://www.javacodegeeks.com/2013/07/run-your-unit-tests-in-parallel.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+JavaCodeGeeks+%28Java+Code+Geeks%29

2013년 7월 31일 수요일

Documentation

clojure.repl/ doc find-doc apropos source pst javadoc (foo.bar/ is namespace for later syms)

Primitives

Numbers

Literals Long: 7, hex 0xff, oct 017, base 2 2r1011, base 36 36rCRAZY BigInt: 7N Ratio: -22/7 Double: 2.78 -1.2e-5 BigDecimal: 4.2M
Arithmetic + - * / quot rem mod inc dec max min
Compare = == not= < > <= >= compare
Bitwise bit-{and, or, xor, not, flip, set, shift-right, shift-left, and-not, clear, test}
Cast byte short int long float double bigdec bigint num rationalize biginteger
Test nil? identical? zero? pos? neg? even? odd?
Random rand rand-int
BigDecimal with-precision
Unchecked *unchecked-math* unchecked-{add, dec, divide, inc, multiply, negate, remainder, subtract}-int

Strings

Create str format See also IO/to string
Use count get subs compare (clojure.string/) join escape split split-lines replace replace-first reverse (1.5) re-quote-replacement (java.lang.String) .indexOf .lastIndexOf
Regex #"pattern" re-find re-seq re-matches re-pattern re-matcher re-groups (clojure.string/) replace replace-first (1.5) re-quote-replacement
Letters (clojure.string/) capitalize lower-case upper-case
Trim (clojure.string/) trim trim-newline triml trimr
Test char char? string? (clojure.string/) blank?

Other

Characters char char-name-string char-escape-string
Keywords keyword keyword? find-keyword
Symbols symbol symbol? gensym

Collections

Collections

Generic ops count empty not-empty into conj (clojure.walk/) walk prewalk prewalk-demo prewalk-replace postwalk postwalk-demo postwalk-replace
Content tests distinct? empty? every? not-every? some not-any?
Capabilities sequential? associative? sorted? counted? reversible?
Type tests coll? list? vector? set? map? seq?

Lists

Create '() list list*
Examine first nth peek .indexOf .lastIndexOf
'Change' cons conj rest pop

Vectors

Create [] vector vec vector-of
Examine (my-vec idx)( nth my-vec idx) get peek .indexOf .lastIndexOf
'Change' assoc pop subvec replace conj rseq
Ops (1.4) mapv filterv reduce-kv

Sets

Create #{} set hash-set sorted-set sorted-set-by
Examine (my-set item)( get my-set item) contains?
'Change' conj disj
Rel algebra (clojure.set/) join select project union difference intersection
Get map (clojure.set/) index rename-keys rename map-invert
Test (clojure.set/) subset? superset?

Maps

Create {} hash-map array-map zipmap sorted-map sorted-map-by bean frequencies group-by
Examine (:key my-map)( get my-map :key) get-in contains? find keys vals
'Change' assoc assoc-in dissoc merge merge-with select-keys update-in
Entry key val
Sorted maps rseq subseq rsubseq

Transients (clojure.org/transients)

Create transient persistent!
Change conj! pop! assoc! dissoc! disj! Note: always use return value for later changes, never original!

Misc

Compare = == identical? not= not compare clojure.data/diff
Test true? false? nil? instance?

IO

to/from ... spit slurp (to writer/from reader, Socket, string with file name, URI, etc.)
to *out* pr prn print printf println newline (clojure.pprint/) print-table
to writer (clojure.pprint/) pprint cl-format also: (binding [*out* writer] ...)
to string format with-out-str pr-str prn-str print-str println-str
from *in* read-line (clojure.tools.reader.edn/) read
from reader line-seq (clojure.tools.reader.edn/) read also: (binding [*in* reader] ...) java.io.Reader
from string with-in-str (clojure.tools.reader.edn/) read-string
Open with-open (clojure.java.io/) text: reader writer binary: input-stream output-stream
Binary (.write ostream byte-arr) (.read istream byte-arr) java.io.OutputStream java.io.InputStream GitHub: gloss byte-spec
Misc flush (.close s) file-seq *in* *out* *err* (clojure.java.io/) file copy delete-file resource as-file as-url as-relative-path GitHub: fs
Data readers (1.4) *data-readers* default-data-readers (1.5) *default-data-reader-fn*

 

 

 

 

Abstractions

Protocols (clojure.org/protocols)

Define ( defprotocol Slicey (slice [at]))
Extend ( extend-type String Slicey (slice [at] ...))
Extend null ( extend-type nil Slicey (slice [_] nil))
Reify ( reify Slicey (slice [at] ...))

Records (clojure.org/datatypes)

Define ( defrecord Pair [h t])
Access (:h (Pair. 1 2))1
Create Pair. ->Pair map->Pair

Types (clojure.org/datatypes)

Define ( deftype Pair [h t])
Access (.h (Pair. 1 2))1
Create Pair. ->Pair
With methods ( deftype Pair [h t]
  Object
  (toString [this] (str "<" h "," t ">")))

Multimethods (clojure.org/multimethods)

Define ( defmulti my-mm dispatch-fn)
Method define ( defmethod my-mm :dispatch-value [args] ...)
Dispatch get-method methods
Remove remove-method remove-all-methods
Prefer prefer-method prefers
Relation derive isa? parents ancestors descendants make-hierarchy

Reader Macros

' Quote: 'form(quote form)
\ Character literal
; Single line comment
^ Metadata (see Metadata section)
@ Deref: @form(deref form)
` Syntax-quote
~ Unquote
~@ Unquote-splicing
#"p" Regex Pattern p
#' Var quote: #'x(var x)
#() #(...)(fn [args] (...))
#_ Ignore next form

Metadata (clojure.org/special_forms)

General ^{:key1 val1 :key2 val2 ...}
Abbrevs ^Type^{:tag Type}
^:key^{:key true}
Common ^:dynamic ^:private ^:doc ^:const
Examples (defn ^:private ^String my-fn ...)
(def ^:dynamic *dyn-var* val)
On Vars meta with-meta vary-meta alter-meta! reset-meta! doc find-doc test

Namespace

Current *ns*
Create/Switch (tutorial) ns in-ns create-ns
Add alias def import intern refer
Find all-ns find-ns
Examine ns-{name, aliases, map, interns, publics, refers, imports}
From symbol resolve ns-resolve namespace
Remove ns-unalias ns-unmap remove-ns

Loading

Load libs (tutorial) require use import refer
List loaded loaded-libs
Load misc load load-file load-reader load-string

Concurrency

Atoms atom swap! reset! compare-and-set!
Futures future future-{call, done?, cancel, cancelled?} future?
Threads bound-fn bound-fn* {get, push, pop}-thread-bindings thread-bound?
Misc locking pcalls pvalues pmap seque promise deliver

Refs and Transactions (clojure.org/refs)

Create ref
Examine deref @ (@form(deref form))
Transaction sync dosync io!
In transaction ensure ref-set alter commute
Validators set-validator! get-validator
History ref-history-count ref-{min, max}-history

Agents and Asynchronous Actions (clojure.org/agents)

Create agent
Examine agent-error
Change state send send-off restart-agent (1.5) send-via set-agent-send-executor! set-agent-send-off-executor!
Block waiting await await-for
Ref validators set-validator! get-validator
Watchers add-watch remove-watch
Thread handling shutdown-agents
Error error-handler set-error-handler! error-mode set-error-mode!
Misc *agent* release-pending-sends