This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reqJson に json.Marshal したものが入っているとする | |
// APIHost = "webservices.amazon.co.jp" | |
// APIRegion = "us-west-2" | |
// APITarget = "com.amazon.paapi5.v1.ProductAdvertisingAPIv1.SearchItems" | |
// APIService = "ProductAdvertisingAPI" | |
bodyReader := bytes.NewReader(reqJson) | |
req, err := http.NewRequest("POST", "https://" + APIHost + "/paapi5/searchitems", bodyReader) | |
log.Println("request:", req) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setenv.bat に以下のように書いて、startup.bat を実行する。 | |
JAVA_OPTS=の後ろには "" 不要。 | |
set JAVA_OPTS=-Duser.language=ja -Duser.country=JP -Dspring.profiles.active=dev -Dfile.encoding=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. [python 3.6 をインストール](https://gist.github.com/moriya9n/22daf53cae550fa91e365e1acd4d7f8a)する。 venv で仮想環境を作っておく。 | |
2. pip install django | |
3. django-admin startproject hogehoge | |
4. レンタルサーバの仕様上、cgi でしか動作しないので、 django-cgi(https://github.com/chibiegg/django-cgi/blob/master/django-python3.cgi) | |
を取ってくる。(速度は期待できない) | |
5. cgi の先頭の python パス名は変更。sys.path.append でプロジェクトディレクトリを追加。 | |
6. index.cgi などにリネームして、好きなところに配置。 | |
7. /home/your_account/static などを作って、settings.py に STATIC_ROOT = '/home/your_account/static' を追加。python manage.py collectstatic | |
を実行。 | |
8. ln -s /home/your_account/static /home/your_account/www/site_name/static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
さくらのレンタルサーバーに python3.6 をインストールする方法 | |
=================================================== | |
そのままコンパイルすると pip が使えない(SSLバージョンエラー?)ので、openssl を入れる。 | |
openssl のコンパイル | |
---------------------------------- | |
wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz | |
tar xvf openssl-1.0.2o.tar.gz | |
cd openssl-1.0.2o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
import csv | |
# list | |
r = requests.get('https://www.mizuhobank.co.jp/retail/takarakuji/loto/loto6/csv/loto6.csv') | |
r.encoding='cp932' | |
loto6_list = [i[1:5] for i in r.text.splitlines() if i.startswith('第')] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
import csv | |
# list | |
r = requests.get('https://www.mizuhobank.co.jp/retail/takarakuji/loto/loto6/csv/loto6.csv') | |
r.encoding='cp932' | |
loto6_list = [i[1:5] for i in r.text.splitlines() if i.startswith('第')] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class 何かのクラス implements xxxAware { | |
public static 型 なんちゃらメソッド(); | |
} | |
xxx には ApplicationContext / Environment / MessageSource など |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/2751603/how-to-get-error-text-in-controller-from-bindingresult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
考え方(私見) | |
Javascriptを多用するページには合わないかもしれないが。。。 | |
作成、表示、更新、削除(CRUD) | |
URL | |
http[s]://なんたらかんたら/id | |
GET http[s]://なんたらかんたら/new | |
GET http[s]://なんたらかんたら/id |
NewerOlder