February 9, 2010
python-oauth2 : インストールと確認

とりあえずGithubでフォークした。

pipでインストール

(twitq)hdknr@deblen:~/.ve/twitq/src$ pip install -e git+ssh://git@github.com/hdknr/python-oauth2.git#egg=python-oauth2
Obtaining python-oauth2 from git+ssh://git@github.com/hdknr/python-oauth2.git#egg=python-oauth2
  Cloning ssh://git@github.com/hdknr/python-oauth2.git to ./python-oauth2
remote: Counting objects: 427, done.
remote: Compressing objects: 100% (157/157), done.
remote: Total 427 (delta 199), reused 427 (delta 199)
  Running setup.py egg_info for package python-oauth2
Installing collected packages: python-oauth2
  Running setup.py develop for python-oauth2
    Creating /home/hdknr/.ve/twitq/lib/python2.5/site-packages/oauth2.egg-link (link to .)
    Adding oauth2 1.0.5 to easy-install.pth file

       Installed /home/hdknr/.ve/twitq/src/python-oauth2
Successfully installed python-oauth2

確認

(twitq)hdknr@deblen:~/.ve/twitq/src$ tree python-oauth2/
python-oauth2/
|-- LICENSE.txt
|-- README.md
|-- debian
|   |-- changelog
|   |-- compat
|   |-- control
|   |-- copyright
|   |-- pycompat
|   |-- pyversions
|   `-- rules
|-- example
|   |-- client.py
|   `-- server.py
|-- oauth2
|   `-- __init__.py
|-- oauth2.egg-info
|   |-- PKG-INFO
|   |-- SOURCES.txt
|   |-- dependency_links.txt
|   |-- top_level.txt
|   `-- zip-safe
|-- setup.cfg
|-- setup.py
`-- tests
    `-- test_oauth.py
 5 directories, 20 files

httplib2が必要だった。

(twitq)hdknr@deblen:~/.ve/twitq/src$ python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
»> import oauth2 as oauth
Traceback (most recent call last):
  File “<stdin>”, line 1, in <module>
  File “/home/hdknr/.ve/twitq/src/python-oauth2/oauth2/__init__.py”, line 31, in <module>
    import httplib2
ImportError: No module named httplib2

(twitq)hdknr@deblen:~/.ve/twitq/src$ yolk -S name=httplib2
httplib2 (0.6.0):
        A comprehensive HTTP client library. (twitq)hdknr@deblen:~/.ve/twitq/src$ pip install httplib2
Downloading/unpacking httplib2
  Downloading httplib2-0.6.0.tar.gz (53Kb): 53Kb downloaded
  Running setup.py egg_info for package httplib2
Installing collected packages: httplib2
  Running setup.py install for httplib2
Successfully installed httplib2

動作確認

キー、シークレットは潰しています。
(twitq)hdknr@deblen:~/.ve/twitq/src$ python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
»> import oauth2 as oauth
»> c=oauth.Consumer(‘fdafdsafdsafsdafdsaf’,’fdsafdsafdasfdsafdsafsdafa’)
»> url=“http://twitter.com/oauth/request_token”;
»> client = oauth.Client(c)
»> res,content = client.request(url,’GET’)
»> type(res)
<class ‘httplib2.Response’>
»> type(content)
<type ‘str’>
»> print content
oauth_token=reoqrdsafdsalfdsafd432fhdsahfdhsafdsafdsafdas&oauth_token_secret=fdr42qr3ofdoashfdsafedeq
»> print res
{‘status’: ‘200’, ‘content-length’: ‘116’, ‘content-location’: ‘http://twitter.com/oauth/request_token?oauth_nonce=91616366&oauth_timestamp=1265663914&oauth_consumer_key=fdsafdasfdafdafdsafda&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&oauth_signature=fdsafdafdafdsafdsafdsafdaf%3D’;, ‘x-transaction’: ‘542354954-432143-4324’, ‘set-cookie’: ‘_twitter_sess=fdasfdsafdsa%dsafdsafdf%fdsafa—fdsafdsa; domain=.twitter.com; path=/’, ‘expires’: ‘Tue, 31 Mar 1981 05:00:00 GMT’, ‘vary’: ‘Accept-Encoding’, ‘x-runtime’: ‘0.01270’, ‘server’: ‘hi’, ‘x-revision’: ‘DEV’, ‘last-modified’: ‘Mon, 08 Feb 2010 21:18:34 GMT’, ‘connection’: ‘close’, ‘etag’: ‘“2a33d94df68b07474217bf29f093c169”-gzip’, ‘pragma’: ‘no-cache’, ‘cache-control’: ‘no-cache, no-store, must-revalidate, pre-check=0, post-check=0’, ‘date’: ‘Mon, 08 Feb 2010 21:18:34 GMT’, ‘content-type’: ‘text/html; charset=utf-8’, ‘-content-encoding’: ‘gzip’}

Posted via email from 原宿工業大学 | Comment »

Enablr : Bitbucket でのプロジェクトを初期化する

SubversionとGit/Githubも可能ですが、まだ完璧にテストしていません。

virtualenvを作る

hdknr@deblen:~$ mkvirtualenv twitq
New python executable in twitq/bin/python
Installing setuptools………………….done.

pipを入れる

(twitq)hdknr@deblen:~$ easy_install pip
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://pip.openplans.org
Best match: pip 0.6.3
Downloading http://pypi.python.org/packages/source/p/pip/pip-0.6.3.tar.gz#md5=0602fa9179cfaa98e41565d4a581d98c
Processing pip-0.6.3.tar.gz
Running pip-0.6.3/setup.py -q bdist_egg —dist-dir /tmp/easy_install-cY8Ghr/pip-0.6.3/egg-dist-tmp-AtENEu
warning: no previously-included files matching ‘*.txt’ found under directory ‘docs/_build’
no previously-included directories found matching ‘docs/_build/_sources’
warning: no files found matching ‘*’ under directory ‘scripts/completion’
zip_safe flag not set; analyzing archive contents…
pip.runner: module references __file__
pip.basecommand: module references __file__
pip.venv: module references __file__
pip.vcs.__init__: module references __file__
Adding pip 0.6.3 to easy-install.pth file
Installing pip script to /home/hdknr/.ve/twitq/bin Installed /home/hdknr/.ve/twitq/lib/python2.5/site-packages/pip-0.6.3-py2.5.egg
Processing dependencies for pip
Finished processing dependencies for pip

MySQLdbを入れておく

(twitq)hdknr@deblen:~$ easy_install mysql-python
Searching for mysql-python
Reading http://pypi.python.org/simple/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3c1
Downloading http://pypi.python.org/packages/2.5/M/MySQL-python/MySQL_python-1.2.3c1-py2.5-linux-i686.egg#md5=1efcbed6f1f29acd50993f54109938d3
Processing MySQL_python-1.2.3c1-py2.5-linux-i686.egg
Moving MySQL_python-1.2.3c1-py2.5-linux-i686.egg to /home/hdknr/.ve/twitq/lib/python2.5/site-packages
Adding MySQL-python 1.2.3c1 to easy-install.pth file Installed /home/hdknr/.ve/twitq/lib/python2.5/site-packages/MySQL_python-1.2.3c1-py2.5-linux-i686.egg
Processing dependencies for mysql-python
Finished processing dependencies for mysql-python

(twitq)hdknr@deblen:~$ pip install yolk
Downloading/unpacking yolk
  Downloading yolk-0.4.1.tar.gz (80Kb): 80Kb downloaded
  Running setup.py egg_info for package yolk
Requirement already satisfied (use —upgrade to upgrade): setuptools in ./.ve/twitq/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg (from yolk)
Installing collected packages: yolk
  Running setup.py install for yolk
    Installing yolk script to /home/hdknr/.ve/twitq/bin
Successfully installed yolk

yolkも入れておく

(twitq)hdknr@deblen:~$ pip install yolk
Downloading/unpacking yolk
  Downloading yolk-0.4.1.tar.gz (80Kb): 80Kb downloaded
  Running setup.py egg_info for package yolk
Requirement already satisfied (use —upgrade to upgrade): setuptools in ./.ve/twitq/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg (from yolk)
Installing collected packages: yolk
  Running setup.py install for yolk
    Installing yolk script to /home/hdknr/.ve/twitq/bin
Successfully installed yolk

Djangoも入れておく

(twitq)hdknr@deblen:~$ pip install django
Downloading/unpacking django
  Downloading Django-1.1.1.tar.gz (5.6Mb): 5.6Mb downloaded
  Running setup.py egg_info for package django
Installing collected packages: django
  Running setup.py install for django
    changing mode of build/scripts-2.5/django-admin.py from 644 to 755
    changing mode of /home/hdknr/.ve/twitq/bin/django-admin.py to 755
Successfully installed django

Enablrを入れる

(twitq)hdknr@deblen:~$ pip install -e hg+ssh://hg@bitbucket.org/hdknr/enablr#egg=enablr
Obtaining enablr from hg+ssh://hg@bitbucket.org/hdknr/enablr#egg=enablr
  Cloning hg ssh://hg@bitbucket.org/hdknr/enablr to ./.ve/twitq/src/enablr
  Running setup.py egg_info for package enablr
    warning: no previously-included files matching ‘*~’ found anywhere in distribution
Downloading/unpacking pit (from enablr)
  Downloading pit-0.2.tar.gz
  Running setup.py egg_info for package pit
Downloading/unpacking pyYAML (from pit->enablr)
  Downloading PyYAML-3.09.tar.gz (238Kb): 238Kb downloaded
  Running setup.py egg_info for package pyYAML
Installing collected packages: enablr, pit, pyYAML
  Running setup.py develop for enablr
    warning: no previously-included files matching ‘*~’ found anywhere in distribution
    Creating /home/hdknr/.ve/twitq/lib/python2.5/site-packages/enablr.egg-link (link to .)
    Adding enablr 0.0.1 to easy-install.pth file

       Installed /home/hdknr/.ve/twitq/src/enablr
  Running setup.py install for pit
  Running setup.py install for pyYAML
    checking if libyaml is compilable
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c build/temp.linux-i686-2.5/check_libyaml.c -o build/temp.linux-i686-2.5/check_libyaml.o
    checking if libyaml is linkable
    gcc -pthread build/temp.linux-i686-2.5/check_libyaml.o -lyaml -o build/temp.linux-i686-2.5/check_libyaml
    building ‘_yaml’ extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c ext/_yaml.c -o build/temp.linux-i686-2.5/ext/_yaml.o
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_get_version_string’:
    ext/_yaml.c:1072: warning: assignment discards qualifiers from pointer target type
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_7CParser___init__’:
    ext/_yaml.c:1830: warning: passing argument 2 of ‘yaml_parser_set_input’ from incompatible pointer type
    ext/_yaml.c:2040: warning: pointer targets in passing argument 2 of ‘yaml_parser_set_input_string’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__token_to_object’:
    ext/_yaml.c:3465: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:3465: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:3478: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:3478: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:4045: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:4045: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:4099: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:4099: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:4153: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:4153: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:4166: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:4166: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:4253: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__event_to_object’:
    ext/_yaml.c:5716: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:5716: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:5729: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:5729: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:5899: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:5899: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:5974: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:5974: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6011: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:6011: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6027: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6343: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:6343: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6380: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:6380: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6576: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:6576: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:6613: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:6613: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_node’:
    ext/_yaml.c:7934: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:7934: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:8152: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:8152: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:8181: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:8181: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:8210: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:8210: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_scalar_node’:
    ext/_yaml.c:8727: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c:8894: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:8894: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_sequence_node’:
    ext/_yaml.c:9341: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:9341: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_mapping_node’:
    ext/_yaml.c:9882: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness
    ext/_yaml.c:9882: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_8CEmitter___init__’:
    ext/_yaml.c:10912: warning: passing argument 2 of ‘yaml_emitter_set_output’ from incompatible pointer type
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_8CEmitter__object_to_event’:
    ext/_yaml.c:12070: warning: pointer targets in assignment differ in signedness
    ext/_yaml.c:12182: warning: pointer targets in assignment differ in signedness
    ext/_yaml.c:12458: warning: pointer targets in passing argument 2 of ‘yaml_alias_event_initialize’ differ in signedness
    ext/_yaml.c:13112: warning: pointer targets in passing argument 2 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:13112: warning: pointer targets in passing argument 3 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:13112: warning: pointer targets in passing argument 4 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:13490: warning: pointer targets in passing argument 2 of ‘yaml_sequence_start_event_initialize’ differ in signedness
    ext/_yaml.c:13490: warning: pointer targets in passing argument 3 of ‘yaml_sequence_start_event_initialize’ differ in signedness
    ext/_yaml.c:13868: warning: pointer targets in passing argument 2 of ‘yaml_mapping_start_event_initialize’ differ in signedness
    ext/_yaml.c:13868: warning: pointer targets in passing argument 3 of ‘yaml_mapping_start_event_initialize’ differ in signedness
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_8CEmitter_serialize’:
    ext/_yaml.c:15146: warning: pointer targets in assignment differ in signedness
    ext/_yaml.c:15258: warning: pointer targets in assignment differ in signedness
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_8CEmitter__serialize_node’:
    ext/_yaml.c:15955: warning: pointer targets in passing argument 2 of ‘yaml_alias_event_initialize’ differ in signedness
    ext/_yaml.c:16629: warning: pointer targets in passing argument 2 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:16629: warning: pointer targets in passing argument 3 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:16629: warning: pointer targets in passing argument 4 of ‘yaml_scalar_event_initialize’ differ in signedness
    ext/_yaml.c:16932: warning: pointer targets in passing argument 2 of ‘yaml_sequence_start_event_initialize’ differ in signedness
    ext/_yaml.c:16932: warning: pointer targets in passing argument 3 of ‘yaml_sequence_start_event_initialize’ differ in signedness
    ext/_yaml.c:17348: warning: pointer targets in passing argument 2 of ‘yaml_mapping_start_event_initialize’ differ in signedness
    ext/_yaml.c:17348: warning: pointer targets in passing argument 3 of ‘yaml_mapping_start_event_initialize’ differ in signedness
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.5/ext/_yaml.o -lyaml -o build/lib.linux-i686-2.5/_yaml.so
Successfully installed enablr pit pyYAML

Pitでレポジトリ(Bitbucket)のアカウントを作成する。

(twitq)hdknr@deblen:~$ echo $EDITOR
vim

(twitq)hdknr@deblen:~$ python -c “from pit import Pit ; Pit.set(‘bitbucket’);” email: *******@hdknr.compassword: ***********
push: hg clone %(url)s
repository: hg
url: ssh://hg@bitbucket.org/%(username)s/%(package)s/
username: hdknr

Bitbucketにプロジェクトをつくる

作ったプロジェクトを”Enablr”する

(twitq)hdknr@deblen:~/.ve/twitq/src$ python -c “import enablr;enablr.enable(‘bitbucket’,’twiq’);”
checkouting … ssh://hg@bitbucket.org/hdknr/twiq/ to /home/hdknr/.ve/twitq/src/twiq
hg clone ssh://hg@bitbucket.org/hdknr/twiq/
destination directory: twiq
no changes found
updating working directory
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

hg -R /home/hdknr/.ve/twitq/src/twiq add /home/hdknr/.ve/twitq/src/twiq/*
adding twiq/twiq/__init__.py
hg -R /home/hdknr/.ve/twitq/src/twiq add /home/hdknr/.ve/twitq/src/twiq/.svnignore hg -R /home/hdknr/.ve/twitq/src/twiq add /home/hdknr/.ve/twitq/src/twiq/.hgignore

hg -R /home/hdknr/.ve/twitq/src/twiq commit -u hdknr -m “initialized” hg -R /home/hdknr/.ve/twitq/src/twiq push
pushing to ssh://hg@bitbucket.org/hdknr/twiq/
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 7 changes to 7 files
remote: bb/acl: hdknr is allowed. accepted payload.
remote: quota: 8.3 MB in use, 150.0 MB available (5.55% used)
pip install -e hg+ssh://hg@bitbucket.org/hdknr/twiq/#egg=twiq
Obtaining twiq from hg+ssh://hg@bitbucket.org/hdknr/twiq/#egg=twiq
  Updating ./twiq clone
  Running setup.py egg_info for package twiq
    warning: no previously-included files matching ‘*~’ found anywhere in distribution
Installing collected packages: twiq
  Running setup.py develop for twiq
    warning: no previously-included files matching ‘*~’ found anywhere in distribution
    Creating /home/hdknr/.ve/twitq/lib/python2.5/site-packages/twiq.egg-link (link to .)
    Adding twiq 0.0.1 to easy-install.pth file

       Installed /home/hdknr/.ve/twitq/src/twiq
Successfully installed twiq

Bitbucketのソースを確認


ディレクトリツリーはこんな感じ

(twitq)hdknr@deblen:~/.ve/twitq/src$ tree 
.
|-- enablr
|   |-- LICENSE
|   |-- MANIFEST.in
|   |-- README.rst
|   |-- enablr
|   |   |-- __init__.py
|   |   `-- __init__.pyc
|   |-- enablr.egg-info
|   |   |-- PKG-INFO
|   |   |-- SOURCES.txt
|   |   |-- dependency_links.txt
|   |   |-- not-zip-safe
|   |   |-- requires.txt
|   |   `-- top_level.txt
|   `-- setup.py
`-- twiq
    |-- LICENSE
    |-- MANIFEST.in
    |-- README.rst
    |-- setup.py
    |-- twiq
    |   `-- __init__.py
    `-- twiq.egg-info
        |-- PKG-INFO
        |-- SOURCES.txt
        |-- dependency_links.txt
        |-- not-zip-safe
        `-- top_level.txt
 6 directories, 22 files
そうすると、同じvirtualenvで別プロジェクトから今作ったtwiqをimport できて、かつtwiqも同時進行で開発できる。

Posted via email from 原宿工業大学 | Comment »

ぐるなび - 土古里 大井町店

February 8, 2010
.Nat Zone : OAuth Wrap Web App Profile Summary by Nat - =nat

» VBScript: Download and Save a Binary File

’ Set your settings
    strFileURL = “http://www.domain.com/file.zip”
    strHDLocation = “D:\file.zip”

’ Fetch the file
    Set objXMLHTTP = CreateObject(“MSXML2.XMLHTTP”)

    objXMLHTTP.open “GET”, strFileURL, false
    objXMLHTTP.send()

If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject(“ADODB.Stream”)
objADOStream.Open
objADOStream.Type = 1 ‘adTypeBinary

objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0    ’Set the stream position to the start

Set objFSO = Createobject(“Scripting.FileSystemObject”)
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing

objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if

Set objXMLHTTP = Nothing

Excell のVBAから同様に呼べるかな?

Posted via web from 原宿工業大学 | Comment »

PHP:PDO : Debian Lenny での確認

PHPバージョン確認

hdknr@deblen:~$ php -v
PHP 5.2.6-1+lenny4 with Suhosin-Patch 0.9.6.2 (cli) (built: Nov 22 2009 02:38:03)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with XCache v1.2.2, Copyright (c) 2005-2007, by mOo
 

PHP.INIはどこ?

hdknr@deblen:~$ dpkg -L php5-common | grep ini
/usr/share/doc/php5-common/examples/php.ini-dist
/usr/share/doc/php5-common/examples/php.ini-paranoid
/usr/share/doc/php5-common/examples/php.ini-recommended
/usr/share/php5/php.ini-dist
/usr/share/php5/php.ini-dist.cli
/etc/php5/conf.d/pdo.ini

PDOはある?

hdknr@deblen:~$ dpkgdpkg -L php5-common | grep pdo
/usr/lib/php5/20060613+lfs/pdo.so
/etc/php5/conf.d/pdo.ini

MySQLのPDOは?

hdknr@deblen:~$ sudo find / -name "pdo*" -print
/usr/lib/php5/20060613+lfs/pdo_mysql.so
/usr/lib/php5/20060613+lfs/pdo_pgsql.so
/usr/lib/php5/20060613+lfs/pdo.so
/etc/php5/conf.d/pdo_mysql.ini
/etc/php5/conf.d/pdo_pgsql.ini
/etc/php5/conf.d/pdo.ini

php5-mysqlをいれると入るようです。

hdknr@deblen:~$ dpkg -L php5-mysql | grep pdo
/usr/lib/php5/20060613+lfs/pdo_mysql.so
/etc/php5/conf.d/pdo_mysql.ini

conf.dの内容確認。

hdknr@deblen:~$ more /etc/php5/conf.d/pdo_mysql.ini
# configuration for php MySQL module
extension=pdo_mysql.so

サンプルコード

hdknr@deblen:~$ more test.php
<?PHP
$DBN='tweet';
$DBU=$DBN;
$DBP=$DBN;
try {
    $pdo = new PDO("mysql:host=localhost; dbname=$DBN",$DBU,$DBP);
    $stmt = $pdo->query("SET NAMES utf8");
    $stmt = $pdo->query("SELECT * FROM tweets_tweet limit 5");
     while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
        echo implode(", ", $row) . PHP_EOL;
    }
} catch (PDOException $e){
    var_dump($e->getMessage());
}
 $pdo = null;
?>
 

実行結果

hdknr@deblen:~$ php test.php
1, 8015912, hdknr, ひできならでは, http://d.hatena.ne.jp/hdknr/, 2010-01-23 14:19:19, 2010-01-23 14:19:19, http://twitter.com/hdknr/statuses/8100709399, hdknr: いいっすね! RT @tkudos じゃ、うちからはこれを http://blog.livedoor.jp/chezkatsuno/ RT @hdknr @ni http://tl.gd/4sfvq, hdknr: いいっすね! RT @tkudos じゃ、うちからはこれを http://blog.livedoor.jp/chezkatsuno/ RT @hdknr @ni http://tl.gd/4sfvq
2, 8015912, hdknr, ひできならでは, http://d.hatena.ne.jp/hdknr/, 2010-01-23 14:14:21, 2010-01-23 14:14:21, http://twitter.com/hdknr/statuses/8100568460, hdknr: 白のタキシードは日本独自。タキシードは6:00以降の服で、昼の結婚式にどうしてもタキシードを着たいという独自のニーズでできた。, hdknr: 白のタキシードは日本独自。タキシードは6:00以降の服で、昼の結婚式にどうしてもタキシードを着たいという独自のニーズでできた。
3, 8015912, hdknr, ひできならでは, http://d.hatena.ne.jp/hdknr/, 2010-01-23 13:12:33, 2010-01-23 13:12:33, http://twitter.com/hdknr/statuses/8098728166, hdknr: @doramimy 答えはリンク先の写真をクリック!, hdknr: @doramimy 答えはリ ンク先の写真をクリック!
4, 8015912, hdknr, ひできならでは, http://d.hatena.ne.jp/hdknr/, 2010-01-23 13:09:07, 2010-01-23 13:09:07, http://twitter.com/hdknr/statuses/8098621429, hdknr: Jay Electronica - Exhibit C - EP - http://itunes.apple.com/jp/album/exhibit-c-ep/id346331122 #iTunes, hdknr: Jay Electronica - Exhibit C - EP - http://itunes.apple.com/jp/album/exhibit-c-ep/id346331122 #iTunes
5, 8015912, hdknr, ひできならでは, http://d.hatena.ne.jp/hdknr/, 2010-01-23 13:07:38, 2010-01-23 13:07:38, http://twitter.com/hdknr/statuses/8098575957, hdknr: Jay Electronica - Exhibit C ってラップはNas? カッコいいね。, hdknr: Jay Electronica - Exhibit C ってラップはNas? カッコいいね。

Posted via email from 原宿工業大学 | Comment »

February 7, 2010
山本一太氏へ新聞業界から多額の献金: きっこのブログ

山本一太参議院議員(52)を始めとする自民党の複数の議員に対して、新聞業界から多額の政治献金が渡っていたことが、ジャーナリストの黒薮哲哉氏の調査で明らかにされた。

Posted via web from hdknr’s posterous | Comment »

5:58pm  |   URL: http://hdknr.com/post/375776931
FILED UNDER: Opinion 
Bookmark and Share
4sq.comもbit.ly

[Today]hdknr: 食器洗って、米炊いて、猫達にカリカリあげたとこ。

hidelafoglia - View my ’hdknr20100206’ photos on Flickriver

03:58  @hdknr: 食器洗って、米炊いて、猫達にカリカリあげたとこ。

04:03  @hdknr: RT @Aceface7:…

Untitled

     
こんにちゃ!
Snow LeopardのMac Mailからだしてみらたらどうなるかな?
どうなるんだろう?

 

Posted via email from hdknr’s posterous | Comment »