<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1348867205453941222</id><updated>2011-04-22T05:42:19.890+09:00</updated><category term='入力チェック'/><category term='linux'/><category term='文字列置換'/><category term='ファイルダウンロード'/><category term='key'/><category term='File'/><category term='gnome-terminalが起動しない'/><category term='list()'/><category term='lsof'/><category term='scim-launcher'/><category term='Ruby'/><category term='listFiles()'/><category term='perl'/><category term='HTML、表'/><category term='XSS対策'/><category term='~/.ssh/known_hosts'/><category term='ssh'/><category term='MySql'/><category term='実行中'/><category term='ファイル操作'/><category term='Java'/><category term='コメント'/><category term='processlist'/><category term='jspアクションタグ、カスタムタグ'/><title type='text'>Technical-Log</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-4745968395692417403</id><published>2008-11-02T09:25:00.002+09:00</published><updated>2008-11-02T09:32:06.274+09:00</updated><title type='text'>Oracle Database XE　でパスワードを忘れた場合</title><content type='html'>Oracle Database XEのデータベースのホームページでログインしようと思ったが、パスワードを忘れてログインできなかった。この場合、パスワードを変更してログインできるようにする方法を記しておく。ただし、OS認証が有効になっていることを前提とする。&lt;br /&gt;&lt;br /&gt;①コマンドプロンプトを立ち上げsqlplusにログインする。&lt;br /&gt; C:\&gt;sqlplus /nolog&lt;br /&gt;&lt;br /&gt;②sysでログインする。&lt;br /&gt; SQL&gt;conn sys as sysdba&lt;br /&gt;&lt;br /&gt;③ユーザーのパスワードを変更する（例えば、sysのパスワードをpasswordに変更するには以下のようにする）&lt;br /&gt; SQL&gt;ALTER USER sys IDENTIFIED BY password;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-4745968395692417403?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/4745968395692417403/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=4745968395692417403' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/4745968395692417403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/4745968395692417403'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/11/oracle-database-xe.html' title='Oracle Database XE　でパスワードを忘れた場合'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-3044088089330665449</id><published>2008-11-01T11:25:00.022+09:00</published><updated>2008-11-01T11:47:27.315+09:00</updated><title type='text'>javaでファイルアップロード</title><content type='html'>まず、以下のJakarta Commonsの以下の２つのライブラリを用いる。&lt;br /&gt;　①commons-fileupload&lt;br /&gt;　②commons-io&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;まず、jspの設定。&lt;br /&gt;以下のフォームを記述する。&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- (1)&amp;lt;FORM&amp;gt;タグにmultipart/form-dataを指定 --&amp;gt;&lt;br /&gt;&amp;lt;form method="POST" &lt;br /&gt;      enctype="&lt;font color="red"&gt;multipart/form-data&lt;/font&gt;" &lt;br /&gt;      action="アップロードサーブレットのパス"&amp;gt;&lt;br /&gt;  &amp;lt;!-- (2)ファイルを選択する&amp;lt;input type="file"&amp;gt;タグを指定 --&amp;gt;&lt;br /&gt;  &amp;lt;input type="&lt;font color="red"&gt;file&lt;/font&gt;" name="fileName" /&amp;gt;&lt;br /&gt;  &amp;lt;input type="submit" value="送信" /&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;br /&gt;次に、サーブレットの記述。&lt;br /&gt;&lt;br /&gt; Collection&lt;Item&gt; ItemList = new ArrayList&lt;Item&gt;();&lt;br /&gt;&lt;br /&gt;&lt;font color="red"&gt;&lt;br /&gt;  InputStream inputStream = null;&lt;br /&gt;  InputStreamReader inputStreamReader = null;&lt;br /&gt;  BufferedReader bufferedReader = null;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="red"&gt;&lt;br /&gt;  DiskFileItemFactory factory = new DiskFileItemFactory();&lt;br /&gt;  ServletFileUpload sfu = new ServletFileUpload(factory);&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;try {&lt;br /&gt;   List&lt;FileItem&gt; fileItemList = &lt;font color="red"&gt;sfu.parseRequest(request)&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;   if (fileItemList.get(0).getName() == null&lt;br /&gt;     || fileItemList.get(0).getName().equals("")) {&lt;br /&gt;    // ファイルが選択されていない場合はアップロード画面へ遷移&lt;br /&gt;    request.setAttribute("message", "ファイルを選択してください。");&lt;br /&gt;    request.getRequestDispatcher(&lt;br /&gt;      "アップロード画面").forward(&lt;br /&gt;      request, response);&lt;br /&gt;    return;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   for (FileItem fileItem : fileItemList) {&lt;br /&gt;    if (fileItem == null) {&lt;br /&gt;     break;&lt;br /&gt;    }&lt;br /&gt;&lt;font color="red"&gt;&lt;br /&gt;    inputStream = fileItem.getInputStream();&lt;br /&gt;    inputStreamReader = new InputStreamReader(inputStream);&lt;br /&gt;    bufferedReader = new BufferedReader(inputStreamReader);&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;    String line = null;&lt;br /&gt;    while ((line = bufferedReader.readLine()) != null) {&lt;br /&gt;     itemList.add(line);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    new uploadService().itemUpload(itemList);&lt;br /&gt;   }&lt;br /&gt;   // アップロード画面へ遷移&lt;br /&gt;   aRequest.setAttribute("message", "アップロードに成功しました。");&lt;br /&gt;   request.getRequestDispatcher(&lt;br /&gt;     "アップロード先").forward(&lt;br /&gt;     request, response);&lt;br /&gt;   return;&lt;br /&gt;  } catch (FileUploadException e) {&lt;br /&gt; //例外処理記述&lt;br /&gt;  } catch (SQLException e) {&lt;br /&gt; //例外処理記述&lt;br /&gt;  } catch (NamingException e) {&lt;br /&gt; //例外処理記述&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;/*ここまで。*/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-3044088089330665449?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/3044088089330665449/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=3044088089330665449' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/3044088089330665449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/3044088089330665449'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/11/java_01.html' title='javaでファイルアップロード'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-4170471869957475716</id><published>2008-11-01T08:08:00.007+09:00</published><updated>2008-11-01T08:18:18.230+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ファイルダウンロード'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>javaでファイルダウンロード</title><content type='html'>Javaでファイルダウンロードを行ってみたが、期待する動作にならない。&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;ItemServiceクラスのfindItems()メソッドを呼び出して、ItemのリストitemListを得る。&lt;br /&gt;そのリストの値を一つずつ読み込んで、toCSV()メソッドでCSV形式にしてからファイルに保存したい。&lt;br /&gt;firefox2.0.0.17ではファイルに保存できる。&lt;br /&gt;IE7ではブラウザにファイルの内容が書き出されてしまう。なぜ？&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;public class ItemDownloadServlet extends HttpServlet {&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt; protected void doGet(HttpServletRequest request,&lt;br /&gt;   HttpServletResponse response) throws ServletException, IOException {&lt;br /&gt;  process(request, response);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @Override&lt;br /&gt; protected void doPost(HttpServletRequest request,&lt;br /&gt;   HttpServletResponse response) throws ServletException, IOException {&lt;br /&gt;  process(request, response);&lt;br /&gt; }&lt;br /&gt;request.setCharacterEncoding("Windows-31J");&lt;br /&gt;  response.setContentType("application/octet-stream");&lt;br /&gt;  String downloadFileName = "itemData.csv";&lt;br /&gt;  response.setHeader("Content-Disposition", "attachement:filename="&lt;br /&gt;    + downloadFileName);&lt;br /&gt;&lt;br /&gt;  OutputStream os = null;&lt;br /&gt;  OutputStreamWriter osw = null;&lt;br /&gt;  BufferedWriter writer = null;&lt;br /&gt;&lt;br /&gt;  os = response.getOutputStream();&lt;br /&gt;  osw = new OutputStreamWriter(os);&lt;br /&gt;  writer = new BufferedWriter(osw);&lt;br /&gt;&lt;br /&gt;  try {&lt;br /&gt;   List&lt;Item&gt; itemList = (List&lt;Item&gt;) new ItemService().findItems();&lt;br /&gt;   for (Item item : itemList) {&lt;br /&gt;    writer.write(toCSV(item));&lt;br /&gt;   }&lt;br /&gt;   writer.flush();&lt;br /&gt;  } catch (SQLException e) {&lt;br /&gt;   // TODO 自動生成された catch ブロック&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  } catch (NamingException e) {&lt;br /&gt;   // TODO 自動生成された catch ブロック&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  } catch (NotFoundException e) {&lt;br /&gt;   // TODO 自動生成された catch ブロック&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;  } finally {&lt;br /&gt;   if (os != null) {&lt;br /&gt;    os.close();&lt;br /&gt;   }&lt;br /&gt;   if (osw != null) {&lt;br /&gt;    osw.close();&lt;br /&gt;   }&lt;br /&gt;  }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-4170471869957475716?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/4170471869957475716/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=4170471869957475716' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/4170471869957475716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/4170471869957475716'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/11/java.html' title='javaでファイルダウンロード'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-1433631307229275914</id><published>2008-10-14T21:46:00.002+09:00</published><updated>2008-10-14T21:48:58.642+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='実行中'/><category scheme='http://www.blogger.com/atom/ns#' term='MySql'/><category scheme='http://www.blogger.com/atom/ns#' term='processlist'/><title type='text'>MySQLで接続中のスレッドや実行中のSQLを確認する</title><content type='html'>MySQLで、接続中のスレッドや実行中のSQLを確認するには以下のようにすれば良い。&lt;br /&gt;&lt;br /&gt;mysql&gt; show processlist;&lt;br /&gt;+-----+------+-----------------+----------+---------+------+-------+------------------+&lt;br /&gt;| Id  | User | Host            | db       | Command | Time | State | Info             |&lt;br /&gt;+-----+------+-----------------+----------+---------+------+-------+------------------+&lt;br /&gt;| 270 | user  | localhost:19549 | dbname | Query   |    0 | NULL  | show processlist |&lt;br /&gt;+-----+------+-----------------+----------+---------+------+-------+------------------+&lt;br /&gt;1 row in set (0.00 sec)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-1433631307229275914?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/1433631307229275914/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=1433631307229275914' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1433631307229275914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1433631307229275914'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/10/mysqlsql.html' title='MySQLで接続中のスレッドや実行中のSQLを確認する'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-1083333288976109128</id><published>2008-10-14T21:37:00.000+09:00</published><updated>2008-10-14T21:38:06.675+09:00</updated><title type='text'>MySQLでログイン中のユーザーを確認する</title><content type='html'>ログイン中のユーザーを確認するには以下のようにすると良い。&lt;br /&gt;&lt;br /&gt;mysql&gt;select USER();&lt;br /&gt;+---------------+&lt;br /&gt;| USER()        |&lt;br /&gt;+---------------+&lt;br /&gt;| user@localhost |&lt;br /&gt;+---------------+&lt;br /&gt;1 row in set (0.03 sec)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-1083333288976109128?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/1083333288976109128/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=1083333288976109128' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1083333288976109128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1083333288976109128'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/10/mysql_14.html' title='MySQLでログイン中のユーザーを確認する'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-3465834950259532832</id><published>2008-10-13T09:57:00.002+09:00</published><updated>2008-10-13T10:00:54.105+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySql'/><category scheme='http://www.blogger.com/atom/ns#' term='コメント'/><title type='text'>MySQLのコメント</title><content type='html'>MySQLでコメント文を書く方法と注意点を述べる。&lt;br /&gt;&lt;br /&gt;コメントスタイルは以下の３つ。&lt;br /&gt;&lt;br /&gt;&lt;font color="red"&gt;&lt;br /&gt;①　#（行末まで）、&lt;br /&gt;②　--（行末まで）、&lt;br /&gt;③　/*（行中または複数行）*/&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;をサポートしている。&lt;br /&gt;&lt;br /&gt;ここで注意だが、&lt;br /&gt;&lt;font color="red"&gt;&lt;br /&gt;--（ダッシュ2つ）のコメントスタイルでは、2 つ目のダッシュの後にスペースを 1 つ以上挿入する必要がある。&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;これを知らずに苦労した経験があるので、注意すること。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-3465834950259532832?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/3465834950259532832/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=3465834950259532832' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/3465834950259532832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/3465834950259532832'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/10/mysql_13.html' title='MySQLのコメント'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-8240995046856395784</id><published>2008-10-13T09:46:00.005+09:00</published><updated>2008-10-14T21:40:32.132+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySql'/><title type='text'>MySQLでデータベース一覧と表一覧を確認する</title><content type='html'>MySQLでデータベース一覧、表一覧、表のフィールドを見る方法をメモしておく。&lt;br /&gt;&lt;br /&gt;・データベース一覧はshow databasesを用いる。&lt;br /&gt;・表一覧はshow tablesを用いる。&lt;br /&gt;&lt;br /&gt;-- データベース一覧の表示&lt;br /&gt;mysql&gt;show databases;&lt;br /&gt;+--------------------+&lt;br /&gt;| Database           |&lt;br /&gt;+--------------------+&lt;br /&gt;| information_schema |&lt;br /&gt;| bookshop           |&lt;br /&gt;| foods              |&lt;br /&gt;| mysql              |&lt;br /&gt;| sqldrill           |&lt;br /&gt;+--------------------+&lt;br /&gt;5 rows in set (0.00 sec)&lt;br /&gt;&lt;br /&gt;-- テーブル一覧の表示&lt;br /&gt;mysql&gt;show tables from foods;&lt;br /&gt;+-----------------+&lt;br /&gt;| Tables_in_foods |&lt;br /&gt;+-----------------+&lt;br /&gt;| foodslist       |&lt;br /&gt;+-----------------+&lt;br /&gt;1 row in set (0.06 sec)&lt;br /&gt;&lt;br /&gt;-- フィールド一覧の表示&lt;br /&gt;mysql&gt;show fields from foods.foodslist;&lt;br /&gt;+----------+-------------+------+-----+---------+----------------+&lt;br /&gt;| Field    | Type        | Null | Key | Default | Extra          |&lt;br /&gt;+----------+-------------+------+-----+---------+----------------+&lt;br /&gt;| id       | int(11)     | NO   | PRI | NULL    | auto_increment |&lt;br /&gt;| foodname | varchar(30) | YES  |     | NULL    |                |&lt;br /&gt;| maker    | varchar(30) | YES  |     | NULL    |                |&lt;br /&gt;| category | varchar(20) | YES  |     | NULL    |                |&lt;br /&gt;| price    | int(11)     | YES  |     | NULL    |                |&lt;br /&gt;+----------+-------------+------+-----+---------+----------------+&lt;br /&gt;5 rows in set (0.00 sec)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-8240995046856395784?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/8240995046856395784/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=8240995046856395784' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/8240995046856395784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/8240995046856395784'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/10/mysql.html' title='MySQLでデータベース一覧と表一覧を確認する'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-706842606146785937</id><published>2008-10-09T19:36:00.002+09:00</published><updated>2008-10-09T19:43:44.663+09:00</updated><title type='text'>DBViewerプラグイン</title><content type='html'>今日はEclipseのDBViewerプラグインを使用してみた。&lt;br /&gt;&lt;br /&gt;DBViewerPluginを右クリックして「登録」を選択。すると、&lt;br /&gt;データベース定義名とJDBCドライバーを登録するウィンドウが表示されるから、&lt;br /&gt;必要事項を記入。&lt;br /&gt;&lt;br /&gt;データベース定義の接続情報の設定では以下のように入力（DBにMySQLを使用している場合）。&lt;br /&gt;&lt;br /&gt;接続文字列の箇所では以下の&lt;host&gt;と&lt;database&gt;を環境に合わせて設定。&lt;br /&gt;&lt;br /&gt;jdbc:mysql://&lt;host&gt;:3306/&lt;database&gt;&lt;br /&gt;&lt;br /&gt;例えば、ローカルでデータベース名がDataBaseならば&lt;br /&gt;&lt;host&gt;→localhost&lt;br /&gt;&lt;database&gt;→DataBase&lt;br /&gt;と設定する。&lt;br /&gt;&lt;br /&gt;これで、EclipseからSQL文を実行し、テーブルを作成したりできるようになる。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-706842606146785937?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/706842606146785937/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=706842606146785937' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/706842606146785937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/706842606146785937'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/10/dbviewer.html' title='DBViewerプラグイン'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-7411467817456267057</id><published>2008-10-06T22:26:00.007+09:00</published><updated>2008-10-07T00:22:36.002+09:00</updated><title type='text'>数値と文字列を通貨の出力形式で出力する</title><content type='html'>数値を通貨の出力形式で出力するには&lt;font color="red"&gt;NumberFormatクラスのgetCurrencyInstance(Locale.フィールド)メソッド&lt;/font&gt;を用いる。&lt;br /&gt;&lt;br /&gt;例えば、2000という数値を￥2,000という出力形式（文字列）で出力させたい場合、以下のメソッドを用いるとよい。&lt;br /&gt;&lt;br /&gt;public toYen(long number){&lt;br /&gt;&amp;nbsp;NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.JAPAN);&lt;br /&gt;&amp;nbsp;  return nf.format(number);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;さて、long型の整数値はこれでよいが、webアプリではフォームからの入力を文字列で受け取る。そのため、文字列として与えられた数字を上記のような形式で出力したい場合が多いだろう。その場合は、上記のメソッドをオーバーロードした以下のメソッドを用いると良い。&lt;br /&gt;&lt;br /&gt;public toYen(String number){&lt;br /&gt;&amp;nbsp;NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.JAPAN);&lt;br /&gt;&amp;nbsp;  return nf.format(Integer.valueOf(number).intValue());&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;これは、ただ単に、文字列numberをInteger.valueOf(number).intValue()という操作を通して整数値に変換しているだけ。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-7411467817456267057?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/7411467817456267057/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=7411467817456267057' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/7411467817456267057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/7411467817456267057'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/10/blog-post_8607.html' title='数値と文字列を通貨の出力形式で出力する'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-8035003657593358728</id><published>2008-10-06T21:51:00.003+09:00</published><updated>2008-10-06T22:00:23.658+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTML、表'/><title type='text'>表の基本形</title><content type='html'>HTMLで基本的な表を作成する。&lt;br /&gt;&lt;br /&gt;&amp;lt;table border="外枠の大きさ"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;tr&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;th&amp;gt;見出し&amp;lt;/th&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;tr&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;td&amp;gt;データ&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&lt;br /&gt;ここで、それぞれのタグの説明。&lt;br /&gt;&amp;lt;tr&amp;gt;&amp;lt;/tr&amp;gt;は横１列を表す。&lt;br /&gt;&amp;lt;th&amp;gt;&amp;lt;/th&amp;gt;はセルの見出し用。&lt;br /&gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;はセルのデータ用。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-8035003657593358728?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/8035003657593358728/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=8035003657593358728' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/8035003657593358728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/8035003657593358728'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/10/blog-post_9283.html' title='表の基本形'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-1712586957519423440</id><published>2008-10-06T21:31:00.004+09:00</published><updated>2008-10-06T21:42:06.038+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='jspアクションタグ、カスタムタグ'/><title type='text'>アクションタグ</title><content type='html'>JSPでJavaBeansのオブジェクトを生成する。&lt;br /&gt;&lt;br /&gt;&amp;lt;jsp:useBean id="オブジェクト変数"&lt;br /&gt;　　　　　　　　　 scope="スコープ"&lt;br /&gt;　　　　　　　　　 class="クラス"&lt;br /&gt;　　　　　　　　　 type="オブジェクト変数の型"&lt;br /&gt;　　　　　　　　　 beanName="クラス" /&amp;gt;&lt;br /&gt;&lt;br /&gt;例えば、listというjava.util.Collection&lt;Sample&gt;型のオブジェクト変数が、requestスコープに格納されている場合は以下のようになる。&lt;br /&gt;&lt;br /&gt;&amp;lt;jsp:useBean id="list"&lt;br /&gt;　　　　　　　　　 scope="request"&lt;br /&gt;　　　　　　　　　 type="java.util.Collection&amp;lt;Sample&amp;gt;"/&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-1712586957519423440?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/1712586957519423440/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=1712586957519423440' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1712586957519423440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1712586957519423440'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/10/blog-post_06.html' title='&lt;jsp:useBean&gt;アクションタグ'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-1527427829609250281</id><published>2008-10-03T01:06:00.002+09:00</published><updated>2008-10-03T01:09:14.624+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='XSS対策'/><title type='text'>HTMLエンコード</title><content type='html'>大抵の本に載っているが一応。&lt;br /&gt;&lt;br /&gt;public class HTMLEncoderUtil {&lt;br /&gt; public static String encode(String aTag) {&lt;br /&gt;  if (aTag == null || aTag.equals("")) {&lt;br /&gt;   return aTag;&lt;br /&gt;  }&lt;br /&gt;  StringBuffer sb = new StringBuffer();&lt;br /&gt;  for (int i = 0; i &lt; aTag.length(); ++i) {&lt;br /&gt;   if (aTag.charAt(i) == '&lt;') {&lt;br /&gt;    sb.append("&amp;lt;");&lt;br /&gt;   } else if (aTag.charAt(i) == '&gt;') {&lt;br /&gt;    sb.append("&amp;gt;");&lt;br /&gt;   } else if (aTag.charAt(i) == '&amp;') {&lt;br /&gt;    sb.append("&amp;amp;");&lt;br /&gt;   } else if (aTag.charAt(i) == '\'') {&lt;br /&gt;    sb.append("&amp;#39;");&lt;br /&gt;   } else if (aTag.charAt(i) == '"') {&lt;br /&gt;    sb.append("&amp;quot;");&lt;br /&gt;   } else {&lt;br /&gt;    sb.append(aTag.charAt(i));&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  return sb.toString();&lt;br /&gt; }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-1527427829609250281?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/1527427829609250281/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=1527427829609250281' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1527427829609250281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1527427829609250281'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/10/html.html' title='HTMLエンコード'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-3262965580443948437</id><published>2008-10-02T07:14:00.005+09:00</published><updated>2008-10-04T07:27:58.386+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='入力チェック'/><title type='text'>空白文字チェック</title><content type='html'>/**&lt;br /&gt;  * 空白文字チェック（全角スペース・半角スペースの両方をチェック）&lt;br /&gt;  *&lt;br /&gt;  * @param aValue&lt;br /&gt;  * @return&lt;br /&gt;  */&lt;br /&gt;public static boolean checkBlankOrNull(String aValue) {&lt;br /&gt;  if (aValue==null || validateMask(aValue.trim(), "^\\s"))&lt;br /&gt;   return true;&lt;br /&gt;&lt;br /&gt;  return isBlankOrNull(aValue);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;  * aValueに空白文字が含まれているかどうかのチェック&lt;br /&gt;  *&lt;br /&gt;  * @param aValue&lt;br /&gt;  * @return 空白文字が含まれていれば真を返す&lt;br /&gt;  */&lt;br /&gt; public static boolean containsBlank(String aValue) {&lt;br /&gt;  return validateMask(aValue.trim(), "\\s");&lt;br /&gt; }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-3262965580443948437?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/3262965580443948437/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=3262965580443948437' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/3262965580443948437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/3262965580443948437'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/10/blog-post.html' title='空白文字チェック'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-7353009691040069755</id><published>2008-09-30T02:01:00.003+09:00</published><updated>2008-09-30T02:10:49.013+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>DBからDATE型の日付を取得して文字列に格納する</title><content type='html'>dayがDBのDATE型のカラム名とする。&lt;br /&gt;すると、rs.getDate("day")の内容は、2008-09-30のような形式となっている。&lt;br /&gt;これを2008/09/30のような形式で表示させるには以下のようにする。&lt;br /&gt;&lt;br /&gt;rs.getDate("day").toString().replaceAll("-", "/")&lt;br /&gt;&lt;br /&gt;ここで、rsはResultSetである。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-7353009691040069755?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/7353009691040069755/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=7353009691040069755' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/7353009691040069755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/7353009691040069755'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/09/dbdate.html' title='DBからDATE型の日付を取得して文字列に格納する'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-8724677461085987918</id><published>2008-09-28T00:42:00.003+09:00</published><updated>2008-09-30T02:11:02.845+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>javaのResultSetからデータを取得する際の注意点</title><content type='html'>ResultSetからデータを取得する際の注意点を１つ挙げる。それは、&lt;br /&gt;&lt;br /&gt;★ResultSetオブジェクトの指すカーソルは、一番最初は、sql文を実行して取得したデータセットの&lt;font color="red"&gt;一行目の一つ前に置かれる&lt;/font&gt;ことになっているので、 nextメソッドの最初の呼び出しで、カーソルは一行目に置かれ、一行目がカレント行になる。&lt;br /&gt;&lt;br /&gt;つまり、&lt;font color="red"&gt;取得データの一行目を扱いたかったら、必ず初めにnext()メソッドを実行して次の行があるかどうかを判定し、それから一行目のデータを扱う&lt;/font&gt;必要がある。&lt;br /&gt;&lt;br /&gt;コードで書けば以下のような感じ。&lt;br /&gt;&lt;br /&gt;ResultSet rs = stmt.executeQuery("SELECT id FROM usertable");&lt;br /&gt;if(rs.next){&lt;br /&gt;&amp;nbsp;&amp;nbsp;String id = rs.getString("id");&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-8724677461085987918?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/8724677461085987918/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=8724677461085987918' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/8724677461085987918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/8724677461085987918'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/09/javaresultset.html' title='javaのResultSetからデータを取得する際の注意点'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-4751895624084519936</id><published>2008-09-27T22:59:00.004+09:00</published><updated>2008-09-30T02:11:17.338+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Javaで、日付・妥当性の厳密チェック</title><content type='html'>Javaで入力フォームから、yyyy/MM/ddのような日付入力(例：2008/08/23)を受けたとき、それが入力形式(yyyy/MM/dd)に合致しているかを厳密に調べるメソッドisDateFormat()の作成。&lt;br /&gt;&lt;br /&gt; public static boolean validateMask(String aValue, String aMask) {&lt;br /&gt; &amp;nbsp;&amp;nbsp; return GenericValidator.matchRegexp(aValue, aMask);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public static boolean isDateFormat(String aValue) {&lt;br /&gt;  //YYYY/MM/ddのチェック&lt;br /&gt;  if(!validateMask(aValue, "\\d{4}/\\d{2}/\\d{2}")){&lt;br /&gt; &amp;nbsp;&amp;nbsp;  return false;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  DateFormat format = DateFormat.getDateInstance();&lt;br /&gt;     // 日付/時刻解析を厳密に行うかどうかを設定する。&lt;br /&gt;     format.setLenient(false);&lt;br /&gt;     try {&lt;br /&gt; &amp;nbsp;&amp;nbsp;        format.parse(aValue);&lt;br /&gt; &amp;nbsp;&amp;nbsp;        return true;&lt;br /&gt;     } catch (Exception e) {&lt;br /&gt; &amp;nbsp;&amp;nbsp;        return false;&lt;br /&gt;     }&lt;br /&gt; }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-4751895624084519936?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/4751895624084519936/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=4751895624084519936' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/4751895624084519936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/4751895624084519936'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/09/java_27.html' title='Javaで、日付・妥当性の厳密チェック'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-1557100387174412826</id><published>2008-09-25T00:55:00.003+09:00</published><updated>2008-09-30T02:11:33.469+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Javaで正規表現を用いるためのライブラリ</title><content type='html'>Javaで正規表現を使おうと思うと外部のライブラリを使う。&lt;br /&gt;JakartaプロジェクトのOROというライブラリを使う。 &lt;br /&gt;&lt;font color="red"&gt;OROはPerl互換の正規表現を提供するライブラリ。&lt;/font&gt;&lt;br /&gt;このライブラリをビルドパスに追加しなければ、NoClassDefFoundErrorが発生する。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-1557100387174412826?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/1557100387174412826/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=1557100387174412826' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1557100387174412826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1557100387174412826'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/09/java.html' title='Javaで正規表現を用いるためのライブラリ'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-3425990267267678971</id><published>2008-09-22T13:49:00.008+09:00</published><updated>2008-09-30T02:12:12.213+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySql'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>コネクションプーリングを用いたDBアクセス</title><content type='html'>&lt;font color="blue"&gt;環境&lt;/font&gt;&lt;br /&gt;&lt;table border="2"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;言語&lt;/td&gt;&lt;td&gt;java1.6&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;アプリケーションサーバ&lt;/td&gt;&lt;td&gt;Tomcat5.5&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;DB&lt;/td&gt;&lt;td&gt;mysql5.1.6&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;OS&lt;/td&gt;&lt;td&gt;Windows XP&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;①JDBCドライバを&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Tomcatインストールディレクトリ\Tomcat 5.5\common\lib&lt;br /&gt;に配置する。&lt;br /&gt;今回は&lt;br /&gt;&amp;nbsp; mysql-connector-java-5.1.6-bin.jar&lt;br /&gt;を用いる。&lt;br /&gt;&lt;br /&gt;&lt;font color="red"&gt;&lt;br /&gt;＊＊＊&lt;br /&gt;当初、eclipseのWEB-INF/libに、このドライバをコピーするだけでドライバをロードできると思っていたが、それでは以下のような例外が発生して、ロードできない。&lt;br /&gt;&lt;br /&gt;org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;②以下の３つのファイルに設定を加える。&lt;br /&gt;(i)WEB-INF/web.xml&lt;br /&gt;&amp;lt;resource-ref&gt;&lt;br /&gt;  &amp;lt;res-ref-name&gt;jdbc/projectDB&amp;lt;res-ref-name&gt;&lt;br /&gt;  &amp;lt;res-type&gt;javax.sql.DataSource&amp;lt;res-type&gt;&lt;br /&gt;  &amp;lt;res-auth&gt;Container&amp;lt;res-auth&gt;&lt;br /&gt;  &amp;lt;res-sharing-scope&gt;Shareable&amp;lt;res-sharing-scope&gt;&lt;br /&gt; &amp;lt;/resource-ref&gt;&lt;br /&gt;&lt;br /&gt;(ii)META-INF/context.xml&lt;br /&gt;&amp;lt;Context docBase="projectPass" path="/projectPass"&gt;&lt;br /&gt; &amp;lt;ResourceLink global="jdbc/projectDB" name="jdbc/projectDB"&lt;br /&gt;  type="javax.sql.DataSource" /&gt;&lt;br /&gt;&amp;lt;Context&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="red"&gt;&lt;br /&gt;***ここで、nameの値はWEB-INF/web.xmlのres-ref-nameと一致させる。また、globalもjdbc/projectDBにする。もしも、globalをprojectDBだけにしたら、以下の例外が発生する。&lt;br /&gt;&lt;br /&gt;javax.naming.NameNotFoundException: 名前 projectDB はこのコンテキストにバインドされていません&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;(iii)tomcatのconfig/server.xml&lt;br /&gt;&amp;lt;Resource auth="Container"&lt;br /&gt;   driverClassName="com.mysql.jdbc.Driver" name="jdbc/projectDB"&lt;br /&gt;   password="DBパスワード" type="javax.sql.DataSource"&lt;br /&gt;   url="jdbc:mysql://localhost/projectPass" username="DBユーザー名" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="red"&gt;&lt;br /&gt;***今回の場合、urlにはポート番号を加えたりしない。つまり以下のようにしたりしない。&lt;br /&gt;url="jdbc:mysql://localhost:3306/projectPass"&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="red"&gt;&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;最後に。何か間違っていることをしていたら、コンソールにエラーメッセージが出力されるから基本的にそれを見て対処すること。また、最終的に戻るべきところはmysqlやtomcat、java APIなどのドキュメント。&lt;br /&gt;&lt;/font&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-3425990267267678971?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/3425990267267678971/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=3425990267267678971' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/3425990267267678971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/3425990267267678971'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/09/db.html' title='コネクションプーリングを用いたDBアクセス'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-1395943521642061995</id><published>2008-09-13T01:10:00.009+09:00</published><updated>2008-10-13T09:44:40.761+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySql'/><title type='text'>mysqlを使って、ユーザー作成からテーブル作成までを行う</title><content type='html'>①インストールが完了したら、以下のコマンドを入力してrootでログインする。&lt;br /&gt;&lt;br /&gt;C:\&gt; mysql -u root -p&lt;br /&gt;&lt;br /&gt;②ユーザーを登録する。&lt;br /&gt;　ユーザーIDがuser、パスワードがpasswordというユーザーに全てのテーブルに対して、全ての権限を与えて登録する場合は以下のようにする。&lt;br /&gt;&lt;br /&gt;mysql&gt; GRANT ALL ON *.* TO user@localhost IDENTIFIED BY 'password';&lt;br /&gt;&lt;br /&gt;③次にデータベースを作成する。&lt;br /&gt;user_dbという名前のデータベースを作成する場合は以下のようにする。&lt;br /&gt;&lt;br /&gt;mysql&gt; CREATE DATABASE user_db;&lt;br /&gt;&lt;br /&gt;データベースが作成されたかどうかは、&lt;br /&gt;&lt;br /&gt;mysql&gt; SHOW DATABASES;&lt;br /&gt;&lt;br /&gt;として確認できる。&lt;br /&gt;&lt;br /&gt;＊＊&lt;br /&gt;因みに、データベースの削除は&lt;br /&gt;mysql&gt; DROP DATABASE user_db;&lt;br /&gt;&lt;br /&gt;とすればよい。&lt;br /&gt;&lt;br /&gt;④テーブルの作成&lt;br /&gt;データベースの中にテーブルを作成するには以下のようにする。&lt;br /&gt;&lt;br /&gt;まず、テーブルを作成したいデータベース(ここではuser_dbとする)に接続する。&lt;br /&gt;&lt;br /&gt;mysql&gt; USE user_db;&lt;br /&gt;&lt;br /&gt;続いて、データベースを作成するためにCREATE TABLEを実行する。&lt;br /&gt;&lt;br /&gt;mysql&gt; CREATE TABLE user_table(id INTEGER NOT NULL, password VARCHAR(30), PRIMARY KEY(id));&lt;br /&gt;&lt;br /&gt;のようにすればよい。&lt;br /&gt;&lt;br /&gt;⑤テーブルが正しく作成されたかどうかの確認&lt;br /&gt;&lt;br /&gt;mysql &gt; show fields from user_db;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-1395943521642061995?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/1395943521642061995/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=1395943521642061995' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1395943521642061995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1395943521642061995'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/09/mysql.html' title='mysqlを使って、ユーザー作成からテーブル作成までを行う'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-1813459064931471910</id><published>2008-06-14T14:58:00.003+09:00</published><updated>2008-06-14T15:27:47.737+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='list()'/><category scheme='http://www.blogger.com/atom/ns#' term='ファイル操作'/><category scheme='http://www.blogger.com/atom/ns#' term='listFiles()'/><category scheme='http://www.blogger.com/atom/ns#' term='File'/><title type='text'>Javaのファイル操作</title><content type='html'>package packagename;&lt;br /&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;public class IO {&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * @param args&lt;br /&gt;  * @throws IOException &lt;br /&gt;  */&lt;br /&gt; public static void main(String[] args) throws IOException {&lt;br /&gt;  // TODO 自動生成されたメソッド・スタブ&lt;br /&gt;  File dir = new File("C:\\Documents and Settings\\users\\Cookies");&lt;br /&gt;  File file1 = new File(&lt;br /&gt;    "C:\\Documents and Settings\\users\\My Documents\\work\\test.txt");&lt;br /&gt;&lt;br /&gt;  // ファイル名を得る&lt;br /&gt;  String[] fileNames = dir.list();&lt;br /&gt;  for (int i = 0; i &lt; fileNames.length; ++i) {&lt;br /&gt;   System.out.println(fileNames[i]);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  // ファイル名を絶対パスで表示させる&lt;br /&gt;  File[] dirName = dir.listFiles();&lt;br /&gt;  for (int i = 0; i &lt; dirName.length; ++i) {&lt;br /&gt;   System.out.println(dirName[i]);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  // ルートディレクトリを得る&lt;br /&gt;  for (int i = 0; i &lt; dir.listRoots().length; ++i) {&lt;br /&gt;   System.out.println(dir.listRoots()[i]);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  // カレントディレクトリを得る&lt;br /&gt;  String currentDir = System.getProperty("user.dir");&lt;br /&gt;  System.out.println("カレントディレクトリは" + currentDir);&lt;br /&gt;&lt;br /&gt;  // 現在のプログラムがファイル読み取りを許可されているか&lt;br /&gt;  // 許可されていれば最終更新日を１９７０年１月１日から経過した時間（ミリ秒）を表示&lt;br /&gt;  if (file1.canRead()) {&lt;br /&gt;   //System.out.println((file1.list())[0] + "の長さは" + file1.length());&lt;br /&gt;   System.out.println(file1.lastModified());&lt;br /&gt;  }&lt;br /&gt;  //現在のプログラムが書き込みを許可されているか&lt;br /&gt;  //許可されていれば削除&lt;br /&gt;  if(file1.canWrite()){&lt;br /&gt;   file1.delete();&lt;br /&gt;  }&lt;br /&gt;  //同じ名前のファイルが存在しない場合は、この名前で新しい空のファイルを作成&lt;br /&gt;  file1.createNewFile();&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-1813459064931471910?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/1813459064931471910/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=1813459064931471910' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1813459064931471910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1813459064931471910'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2008/06/java.html' title='Javaのファイル操作'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-2624144007076728456</id><published>2007-12-29T18:53:00.000+09:00</published><updated>2007-12-29T19:03:29.625+09:00</updated><title type='text'>nmap4.50をvine4.2にインストール</title><content type='html'>make installする段階で以下のエラーがでてとまった。&lt;br /&gt;vine4.1のときは、何も苦労するところがなかったが。&lt;br /&gt;そのときのnmapのversionはなんだったかな。&lt;br /&gt;&lt;br /&gt;error: invalid Python installation: unable to open /usr/lib/python2.4/config/Makefile (No such file or directory)&lt;br /&gt;make: *** [install-zenmap] エラー 1&lt;br /&gt;&lt;br /&gt;結局、調べるのも面倒だったのでapt-getでインストール。&lt;br /&gt;あとで調べておこう。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-2624144007076728456?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/2624144007076728456/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=2624144007076728456' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/2624144007076728456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/2624144007076728456'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2007/12/nmapvine42.html' title='nmap4.50をvine4.2にインストール'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-1185529571404990404</id><published>2007-12-10T19:42:00.000+09:00</published><updated>2007-12-10T20:11:45.177+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><title type='text'>rubyを使って、標準入力から入力を受け付けるプログラムに入力値を渡す</title><content type='html'>　標準入力から入力（整数値）を受け取って、それを用いるプログラムを使用する時のお話。&lt;br /&gt;入力値をー８から８まで１ずつ増やしていき、各々の値に対してそのプログラムを走らせる必要があったのだが、rubyで自動化するのに少し手間取った。&lt;br /&gt;　これまでは、perlを用いて下のようにしていた。&lt;br /&gt;&lt;p&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;for($i=-8; $i&lt;=8; $i++){&lt;br /&gt;  system("echo $i | 実行プログラム");&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;これをrubyで行おうとして、はじめは次のように書いた。&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;#!/usr/bin/ruby                                                                 &lt;br /&gt;for i in -8..8&lt;br /&gt;  system("echo i | 実行ファイル");                                                           &lt;br /&gt;end&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;　ところが、rubyではrubyスクリプト内で用いられているiは""の中では展開されない。&lt;br /&gt;perlでは数値として扱われるところがrubyとperlにおける違いの一つのようだ。&lt;br /&gt;　そこで、&lt;font color="red"&gt;式展開 #{}&lt;/font&gt;を用いて以下のように修正する。&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;#!/usr/bin/ruby                                                                 &lt;br /&gt;for i in -8..8&lt;br /&gt;  system("echo #{i} | 実行ファイル");                                                           &lt;br /&gt;end&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;　これで期待どおりに動いた。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-1185529571404990404?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/1185529571404990404/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=1185529571404990404' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1185529571404990404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/1185529571404990404'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2007/12/ruby.html' title='rubyを使って、標準入力から入力を受け付けるプログラムに入力値を渡す'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-3405391315389635733</id><published>2007-11-30T01:31:00.000+09:00</published><updated>2007-11-30T01:36:56.453+09:00</updated><title type='text'>program.c:3: error: stray '\241' in program</title><content type='html'>少し悩まされた。&lt;br /&gt;その理由は、はじめてみるエラーだったということと、&lt;font color="red"&gt;コードを見直しても間違いが見えなかった&lt;/font&gt;からだ。&lt;br /&gt;&lt;br /&gt;googleで検索すると、このエラーメッセージが教えてくれているのは&lt;br /&gt;&lt;br /&gt; &lt;font color="red"&gt;全角が混ざっている&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;ということのようだ。そこでスペースを調べると全角の空白が混ざっていた。コードを見直しても気がつかないわけだ。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-3405391315389635733?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/3405391315389635733/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=3405391315389635733' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/3405391315389635733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/3405391315389635733'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2007/11/programc3-error-stray-241-in-program.html' title='program.c:3: error: stray &apos;\241&apos; in program'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-2187113053273583696</id><published>2007-11-29T16:45:00.000+09:00</published><updated>2007-11-29T17:01:29.732+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='key'/><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='~/.ssh/known_hosts'/><title type='text'>~/.ssh/known_hosts</title><content type='html'>　Linuxからあるマシンにsshで接続しようとした際の話。&lt;br /&gt;&lt;br /&gt;$ssh -X [ユーザー名]@[サーバ名]&lt;br /&gt;&lt;br /&gt;として、接続しようとしたが以下のようなエラーメッセージがでた。&lt;br /&gt;&lt;br /&gt;------------------エラーメッセージ--------------------&lt;br /&gt;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @&lt;br /&gt;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!&lt;br /&gt;Someone could be eavesdropping on you right now (man-in-the-middle attack)!&lt;br /&gt;It is also possible that the DSA host key has just been changed.&lt;br /&gt;The fingerprint for the DSA key sent by the remote host is&lt;br /&gt;18:86:0b:ec:64:34:b1:c3:37:49:61:9c:ed:80.&lt;br /&gt;Please contact your system administrator.&lt;br /&gt;Add correct host key in /home/staff/hoge/.ssh/known_hosts to get rid of this message.&lt;br /&gt;Offending key in /home/staff/hoge/.ssh/known_hosts:6&lt;br /&gt;DSA host key has changed and you have requested strict checking.&lt;br /&gt;Host key verification failed.&lt;br /&gt;----------------------------------------------------&lt;br /&gt;&lt;br /&gt;　エラーメッセージの最初に出力されているように、これは&lt;br /&gt;&lt;br /&gt;接続先サーバーと通信するための暗号の鍵が変更されたため&lt;br /&gt;&lt;br /&gt;に起こったもの。&lt;br /&gt;　鍵は最初に通信した際にクライアント側に保存されており、今回はそれが変更されたとのこと。サーバ管理者に問い合わせたところ、マシンが変わったとか。&lt;br /&gt;&lt;br /&gt;そこでクライアント側では、&lt;br /&gt;&lt;br /&gt; &lt;font color="red"&gt;~/.ssh/known_hostsにおいて、接続先ホストの公開鍵が記述されている部分を削除する&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;必要があったのだ。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-2187113053273583696?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/2187113053273583696/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=2187113053273583696' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/2187113053273583696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/2187113053273583696'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2007/11/sshknownhosts.html' title='~/.ssh/known_hosts'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-5530736180654121599</id><published>2007-11-28T18:57:00.000+09:00</published><updated>2007-11-29T17:02:33.032+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scim-launcher'/><category scheme='http://www.blogger.com/atom/ns#' term='gnome-terminalが起動しない'/><category scheme='http://www.blogger.com/atom/ns#' term='lsof'/><title type='text'>scim-launcherがCPUを１００％使用してしまう</title><content type='html'>vinelinux4.1で作業をしているときの話し。&lt;br /&gt;　PCのハードディスク容量が満杯になったため突然、GNOMEの動作が鈍る。&lt;br /&gt;そこで&lt;font color="red"&gt;ctrl+alt+f1によりコンソールを変え&lt;/font&gt;、不要なファイルを削除した後にrebootをかける。&lt;br /&gt;&lt;br /&gt;　reboot後、再度ログインして作業をしようと思い、gnome-terminalを起動しようとするが起動しない。gnome-terminalに不具合があると思い、apt-getでgnome-terminalを一度removeした後にinstallする。しかし、問題は解決しなかった。&lt;br /&gt;&lt;br /&gt;　そこでlaucherのメニューからRoot Terminalを起動してみる。すると、これは起動できた。その後、システムモニタも起動できたのでCPU使用率を見ると１００％になっている。どのジョブがCPUを喰い尽くしているのかを調べると、&lt;br /&gt;&lt;br /&gt; &lt;font color="red"&gt;scim-launcherがCPUを喰い尽くしていた。&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;原因を探るため、&lt;br /&gt;&lt;br /&gt; &lt;font color="red"&gt;# ps -ef | grep scim-launcher&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;としてscim-launcherのプロセスIDを調べる。次に、lsofコマンド(デフォルトでなかったのでインストールした)を用いて、scim-launcherが開いているファイルを調べてみた。&lt;br /&gt;&lt;br /&gt; &lt;font color="red"&gt;# lsof -p プロセスID&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;すると、ライブラリやバイナリファイル以外で&lt;br /&gt;&lt;br /&gt; &lt;font color="red"&gt;~/.anthy/last-record2_defaultを開いている&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;とあった。調べてみると、このファイルの末尾がおかしいと、無限ループに陥るらしい。そのため、このファイルを削除した。&lt;br /&gt;&lt;br /&gt;そして再起動すると、scim-launcherがCPUを喰い尽くすことなく、めでたくgnome-terminalを起動できた。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-5530736180654121599?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/5530736180654121599/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=5530736180654121599' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/5530736180654121599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/5530736180654121599'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2007/11/scim-launchercpu.html' title='scim-launcherがCPUを１００％使用してしまう'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-7501736685741316877</id><published>2007-11-18T14:37:00.000+09:00</published><updated>2007-12-16T18:04:04.201+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='文字列置換'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>perlで文字列置換</title><content type='html'>ＨＴＭＬファイルに記すタイムスタンプを更新する必要があった。&lt;br /&gt;その際にファイルを１つずつ手書きで修正するのは大変なので、スクリプトを書いてみた。&lt;br /&gt;&lt;br /&gt;#############################################################################&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;###---　HTMLファイルの文字列修正を行うPerlスクリプト　---###&lt;br /&gt;&lt;br /&gt;### カレントディレクトリ（ディレクトリハンドルＤＩＲ）をオープンする ###&lt;br /&gt;opendir(DIR,".") || die "cannot open a current directory:\n";&lt;br /&gt;&lt;br /&gt;### カレントディレクトリのファイルを@files配列に格納する ###&lt;br /&gt;@files = readdir(DIR);&lt;br /&gt;&lt;br /&gt;### ディレクトリハンドル（ＤＩＲ）を解放する ###&lt;br /&gt;closedir(DIR);&lt;br /&gt;&lt;br /&gt;### ファイルのリスト（@files）の要素を１つずつ$oldfileに読み込み操作する ###&lt;br /&gt;foreach $oldfile (@files){&lt;br /&gt;    #.htmlという要素を含むファイルだけ操作する&lt;br /&gt;    if($oldfile =~/.html/) {&lt;br /&gt;#$oldfileを読み取り専用に開く(ファイルハンドルはFHOLD)&lt;br /&gt;      if ( ! open ( FHOLD, "&lt; $oldfile") ) {&lt;br /&gt;        print "File not found.\n";&lt;br /&gt;        exit(-1);&lt;br /&gt;      }&lt;br /&gt;#$newfileを修正後のファイルの書き込み用に開く。ここで適当にファイル名を”temp"として与える&lt;br /&gt;      $newfile="temp";&lt;br /&gt;      if ( ! open ( FHNEW, "&gt; $newfile") ) {&lt;br /&gt;          print "Cannot make file.\n";&lt;br /&gt;          exit(-1);&lt;br /&gt;      }&lt;br /&gt;#修正するファイルを１行ずつ読み込み(特殊変数$_に格納される)文字列置換する&lt;br /&gt;      while (&amp;lt;FHOLD &amp;gt;){&lt;br /&gt;          $_ =~ s/置換したい文字列/新たに置き換えられる文字列/g;&lt;br /&gt;#$newfileに一行ずつ書き込んでいく&lt;br /&gt;          print FHNEW $_;&lt;br /&gt;      }&lt;br /&gt;#開けたら閉じる、ファイルハンドル&lt;br /&gt;      close(FHOLD);&lt;br /&gt;      close(FHNEW);&lt;br /&gt;#元のファイル名の末尾に.origをつけて元のファイルを保存する&lt;br /&gt;      rename($oldfile,"$oldfile.orig");&lt;br /&gt;#置換後の新しいファイルを元のファイル名に変更して保存する&lt;br /&gt;      rename($newfile,$oldfile);&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-7501736685741316877?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/7501736685741316877/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=7501736685741316877' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/7501736685741316877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/7501736685741316877'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2007/11/perl.html' title='perlで文字列置換'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1348867205453941222.post-4762105992590676328</id><published>2007-11-15T15:49:00.000+09:00</published><updated>2007-11-15T15:50:36.287+09:00</updated><title type='text'>Technical Log start</title><content type='html'>このページは作者が、PCの勉強を進めていく過程で思ったこと、分かったことを書き留めていくページです。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1348867205453941222-4762105992590676328?l=technical-log.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technical-log.blogspot.com/feeds/4762105992590676328/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1348867205453941222&amp;postID=4762105992590676328' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/4762105992590676328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1348867205453941222/posts/default/4762105992590676328'/><link rel='alternate' type='text/html' href='http://technical-log.blogspot.com/2007/11/technical-log-start.html' title='Technical Log start'/><author><name>technical_log</name><uri>http://www.blogger.com/profile/10346427061452355894</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
