Skip to content

Instantly share code, notes, and snippets.

View moriya9n's full-sized avatar

Seiji MORIYA moriya9n

View GitHub Profile
@moriya9n
moriya9n / gist:790ef652bafe95d2d7d5ab94b5301a4d
Created January 19, 2018 05:22
spring-framework 日付欄に空白を許可
// 日付欄に空白を許可
// https://stackoverflow.com/questions/4806033/converting-empty-string-to-null-date-object-with-spring
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
@moriya9n
moriya9n / gist:2b56a09b9c1b40e530b22133fa7d1974
Last active January 19, 2018 05:38
Java 関連でよく見るリファレンス
JSP/JSTL (よくまとまってる)
http://struts.wasureppoi.com/jstl/00_jstl.html
Spring Framework (ver4)
https://docs.spring.io/spring/docs/4.3.13.RELEASE/spring-framework-reference/htmlsingle/
Spring Security
https://docs.spring.io/spring-security/site/docs/4.2.3.RELEASE/reference/htmlsingle/
Validator 関連
@moriya9n
moriya9n / gist:c49afce1d72113feab68b4311319977a
Last active January 19, 2018 06:35
spring web null skip validation
あってるかどうか知らん
stackoverflow かどこかで見つけたやつ?
空欄のときに validation をスキップさせたい時に使った。
@InitBinder
public void initBinder(WebDataBinder binder) {
// 入力値が空の場合は null をセットしてバリデータをスキップする
binder.registerCustomEditor(String.class, "field_name", new StringTrimmerEditor(true));
}
考え方(私見)
Javascriptを多用するページには合わないかもしれないが。。。
作成、表示、更新、削除(CRUD)
URL
http[s]://なんたらかんたら/id
GET http[s]://なんたらかんたら/new
GET http[s]://なんたらかんたら/id
https://stackoverflow.com/questions/2751603/how-to-get-error-text-in-controller-from-bindingresult
@moriya9n
moriya9n / gist:69e38ad7c09a70fb0b2691f68741a9b3
Created January 22, 2018 06:55
spring / static メソッドから MessageSource などにアクセスする
class 何かのクラス implements xxxAware {
public static 型 なんちゃらメソッド();
}
xxx には ApplicationContext / Environment / MessageSource など
@moriya9n
moriya9n / awsmonero.md
Last active April 29, 2018 01:40
aws monero cpu mining on spot instance without installation
#!/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('第')]
@moriya9n
moriya9n / loto6_latest.py
Last active May 5, 2018 04:20
loto6 最新
#!/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('第')]
@moriya9n
moriya9n / gist:22daf53cae550fa91e365e1acd4d7f8a
Last active October 3, 2018 02:05
さくらのレンタルサーバーに python3.6 をインストール
さくらのレンタルサーバーに 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