- VMの-Xmxを充分な値に設定しているかどうか。
- BufferedImageを使用後にflushやnullを設定するなどの後処理をしているか。(特にファイルを連続で読み込んだりする場合は注意。)
2014年9月4日木曜日
ImageIO.readeで java.lang.OutOfMemoryの例外が発生する場合に注意しておく点
ImageIO.readeで java.lang.OutOfMemoryの例外が発生する場合、以下の点に注意する。
画像のエンコーディングをJavaで検知するには?
ImageIO.getImageReadersを使う。
http://stackoverflow.com/questions/4530348/detecting-image-encoding-in-javaImageInputStream imageInputStream = ImageIO.createImageInputStream( myInputStream); Iterator<ImageReader> iter = ImageIO.getImageReaders(imageInputStream); if (!iter.hasNext()) { // this always happens } ImageReader reader = (ImageReader) iter.next(); if (!reader.getFormatName().equals("jpeg")) { }
jQueryでフォームの値をクリアするには?
// Call it on your <form>
$('form').clearForm();
http://jquery-howto.blogspot.com/2013/08/jquery-form-reset.html
2014年7月11日金曜日
MySQLでテーブル作成でエラーが出た時の詳細ログチェックの方法
MySQLで例えばテーブルを作成する時に外部キー制約などが間違ってた場合、error no 150と言われてもさっぱり分からないので、以下のコマンドで詳細をチェック。
>SHOW ENGINE INNODB STATUS
外部キーであれば、テーブル名が存在しないなどと詳しいエラーを教えてくれる。
http://stackoverflow.com/questions/17812616/mysql-error-1005-cant-create-table-errno-150
>SHOW ENGINE INNODB STATUS
外部キーであれば、テーブル名が存在しないなどと詳しいエラーを教えてくれる。
http://stackoverflow.com/questions/17812616/mysql-error-1005-cant-create-table-errno-150
2014年7月10日木曜日
ELF header smaller than expectedがUbuntuのアップデート後の再起動で出た場合
ELF header smaller than expectedがUbuntuのアップデート後の再起動で出た場合、以下の手順で治します。
http://askubuntu.com/questions/401105/elf-header-smaller-than-expected
- UbuntuのブータブルUSBスティックを作る
- USBスティックからブート
- boot-repairをインストール
- sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
- boot-repairを実行
- sudo apt-get install -y boot-repair && (boot-repair &)
- リブートしてOK
http://askubuntu.com/questions/401105/elf-header-smaller-than-expected
2014年6月27日金曜日
mysqlでダンプファイルから特定の列をリストアするには?
idを指定してやる場合。
http://stackoverflow.com/questions/5658284/how-to-use-mysqldump-for-a-portion-of-a-table
mysqldump -uroot -p db_name table_name --where='id<1000000'
http://stackoverflow.com/questions/5658284/how-to-use-mysqldump-for-a-portion-of-a-table
登録:
投稿 (Atom)