MySQL ワークベンチで、時間かかるプロシジャなどを実行していると
Error Code: 2013 Lost connection to MySQL server during query 600.135 sec
となってしまうことがある。
こういう場合、設定でSQLEditer の中のMySQL Session のDBMS connection
keep-alive が 600 になっているのでこれを大きくする。
jQuery context menu
https://swisnl.github.io/jQuery-contextMenu/
これを使ったコンテキストメニューのアイコンの変更の方法、
items オプションを指定する時に記述する icon キーワードに沿って、以下のクラス名で
CSSを用意しないとならない。
.context-menu-item.context-menu-icon-キーワード {
/* アイコンのスタイルを書く。*/
}
.context-menu-item.context-menu-icon- {
/* マウス hover 時のスタイルを書く。*/
}
例)
items: { "config": { name: "設定", icon: "config" },
という items を書いた場合、
.context-menu-item.context-menu-icon-config{
background-image: url(images/cogs_b.png);
background-repeat: no-repeat;
background-position: 4px 2px;
min-height: 18px;
}
.context-menu-item.context-menu-icon-config.context-menu-hover{
background-image: url(images/cogs_w.png);
background-color: #2980b9;
}
Java7 では、数字がカンマなどで区切られた文字列を split して List<Integer> にするのに、
こんなコードを書いていた。。。
String str = "1,2,,4,5";
List<Integer> list = new ArrayList<Integer>();
for(String s: str.split(",") ){
if ( ! "".equals(s) ){
list.add(Integer.parseInt(s));
}
}
Java8 なら、、いろいろ書き方あるかもしれないが、、Arrays.asList を使うなら、
List<Integer> list = Arrays.asList(str.split(",")).stream()
.filter(e->!"".equals(e))
.mapToInt(Integer::parseInt)
.collect(ArrayList<Integer>::new, (r, t)->r.add(t), (r, u)->r.addAll(u));
PatternのsplitAsStreamを使うなら、
List<Integer> list = Pattern.compile(",").splitAsStream(str).filter(e->!"".equals(e))
.mapToInt(Integer::parseInt)
.collect(ArrayList<Integer>::new, (r, t)->r.add(t), (r, u)->r.addAll(u));
こんなところだろうか。。if文の代わりに filter は必要だなあ。。
とりあえず、ブログをここに引っ越し作業完了。
いくつか画像は持ってこなかったけど。
カテゴリも全部までは振り直していない、そのうち、やるつもりです。
相変わらずたいしたものは書かない、時代とともにどうでもいいものになるのもあるでしょう。ただのメモの寄せ集めで思いだしたい時に
ひっくり返して見るのが目的のブログをこれからも続けてみようと思います。
はじめての投稿テスト
元のブログから引っ越しを作業中です。
mybatis のSQLアノテーションで動的SQLを書くには、SQLMap XMLで書いていた <if> 等を
<script> で囲んで書く。
(例)
@Select("<script>SELECT * FROM shops WHERE delete_flg = 0 "
+ "<if test=\"branch_id != null\"> AND branch_id = #{branch_id}</if>"
+ " ORDER BY build_order ASC</script>")
public List<Shop> getShops(@Param("branch_id")Integer id);
Wicket モーダルウィンドウに Autocompleteや Datepicker を配置した時、選択の前にウィンドウを閉じた場合に残る Autocompete やカレンダー表示などが残ってしまう問題、
これを回避するために、、
$('div[class="w_caption"]').mouseover(function(){
$('input[class="ui-autocomplete-input"]').autocomplete("close");
$('input[class="datepicker hasDatepicker"]').datepicker("hide");
});
$('button').mouseover(function(){
$('input[class="ui-autocomplete-input"]').autocomplete("close");
$('input[class="datepicker hasDatepicker"]').datepicker("hide");
});
を実行してマウスカーソルのイベントで対処していたが、これだと、Autocomplete の close は、、
以下、エラーが発生することがある。たいていのケースがこれで良かったのに。。。
Uncaught Error: cannot call methods on autocomplete prior to initialization; attempted to call method 'close'n.extend.error
@ jquery-2.1.4.min.js:2(anonymous function)
@ jquery-ui-1.11.4.custom.min.js:6n.extend.each
@ jquery-2.1.4.min.js:2n.fn.n.each
@ jquery-2.1.4.min.js:2e.fn.(anonymous function)
@ jquery-ui-1.11.4.custom.min.js:6(anonymous function)
Autocomplete が動いているの後の操作で動く close の実行なのにどうして初期化してないから云々のエラーになるのか?
諦めて以下のようなメソッドを用意して、Autocomplete の ul - li 表示リストを mouseover で削除する メソッドを用意してこれを
モーダルウィンドウ表示後に呼び出す。
var modalCaptionSetting = function(){
$('div[class="w_caption"]').mouseover(function(){
$('ul.ui-autocomplete').empty();
$('ul.ui-autocomplete').prop('style', 'display: none');
$('input[class="datepicker hasDatepicker"]').datepicker("hide");
});
$('button').mouseover(function(){
$('ul.ui-autocomplete').empty();
$('ul.ui-autocomplete').prop('style', 'display: none');
$('input[class="datepicker hasDatepicker"]').datepicker("hide");
});
};