<?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:blogger='http://schemas.google.com/blogger/2008' 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-1578022360101244332</id><updated>2024-10-25T00:01:05.698+09:00</updated><title type='text'>覚え書き</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://darutk-oboegaki.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>100</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-646134050160706544</id><published>2015-08-21T22:20:00.002+09:00</published><updated>2015-09-29T16:10:15.093+09:00</updated><title type='text'>How to parse Eddystone packets (Android)</title><summary type="text">It&#39;s easy if you use nv-bluetooth library. onLeScan method would be implemented like the following.


public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord)
{
    // Parse the payload part of an advertisement packet.
    List&amp;lt;ADStructure&amp;gt; structures =
        ADPayloadParser.getInstance().parse(scanRecord);
 
    // For each AD structure contained in the packet.
    for (</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/646134050160706544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/646134050160706544'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/08/how-to-parse-eddystone-packets-android.html' title='How to parse Eddystone packets (Android)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-5234225370836644631</id><published>2015-08-21T19:33:00.001+09:00</published><updated>2016-03-09T00:14:17.861+09:00</updated><title type='text'>Eddystone パケットをパースする (Android)</title><summary type="text">nv-bluetooth ライブラリを使えば簡単。onLeScan メソッドの実装例は次のようになる。


public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord)
{
    // アドバータイジングパケットのペイロードをパースする。
    List&amp;lt;ADStructure&amp;gt; structures =
        ADPayloadParser.getInstance().parse(scanRecord);
 
    // アドバータイジングパケットに含まれる各 AD structure ごとに
    for (ADStructure structure : structures)
    {
        if (structure instanceof </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/5234225370836644631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/5234225370836644631'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/08/eddystone-android.html' title='Eddystone パケットをパースする (Android)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-168254658666024322</id><published>2015-06-20T02:24:00.002+09:00</published><updated>2015-06-24T21:02:23.511+09:00</updated><title type='text'>ZooKeeper でリーダー選出を実装する</title><summary type="text">『ZooKeeper による分散システム管理』 を買って読みました。

書籍では、ZooKeeper を使う典型的な例として 「複数のマシンの中から一台をマスターとして選ぶ」 というユースケース、いわゆる 「リーダー選出」を挙げ、3 章以降でコーディング例を示しています。しかし、コールバックやら Watcher やらの組み合わせ方がややこしいため、コードのフローは追いにくいものになっています。

8 章では 「ZooKeeper の高レベル API」 として Curator フレームワークを紹介し、Curator を使った場合にリーダー選出のコーディングがどうなるかを示しているものの、それでも分かりにくいです。というか、分かりやすいかどうかよりも、リーダー選出のために、素の ZooKeeper API とはだいぶ異なる Curator API を学習しなければならないという点で既に、「</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/168254658666024322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/168254658666024322'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/06/zookeeper_20.html' title='ZooKeeper でリーダー選出を実装する'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-3040724388603108569</id><published>2015-06-16T20:28:00.000+09:00</published><updated>2015-06-16T20:28:45.395+09:00</updated><title type='text'>ZooKeeper の起動に苦労した点</title><summary type="text">ZooKeeper クライアントを起動して、「Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect」というエラーが出たら、これは単純に ZooKeeper サーバーが起動していない可能性が高い。私の場合、ZooKeeper のソースコードを追っていって、ClientCnxnSocketNIO.java の 361 行目 (version 3.4.6) の sc.finishConnect() でエラーが起こっていることが分かったが、この sc というのは java.nio.channels.SocketChannel のインスタンスなので、もはや ZooKeeper の範疇ではない。そういうわけで、ZooKeeper の設定云々の話ではなくて、</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3040724388603108569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3040724388603108569'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/06/zookeeper.html' title='ZooKeeper の起動に苦労した点'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-6403249881846079978</id><published>2015-05-12T15:36:00.000+09:00</published><updated>2015-05-12T15:41:15.485+09:00</updated><title type='text'>undefined method `path2class&#39;</title><summary type="text">直接の原因

psych.so ファイルが適切な場所に置かれていない。


問題回避方法

私のケースでは：

cp /usr/local/share/ruby/gems/2.0/gems/psych-2.0.13/lib/psych.so \
   /usr/share/ruby/vendor_ruby/2.0/


詳細

path2class メソッドは psych_to_ruby.c 内で定義され、rb_define_private_method() により Psych::ClassLoader クラスのプライベートメソッドとして登録される。下記はそのコード。Init_psych_to_ruby() 関数の最後の行に注目。


static VALUE path2class(VALUE self, VALUE path)
{
#ifdef HAVE_RUBY_ENCODING_H</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/6403249881846079978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/6403249881846079978'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/05/undefined-method-path2class.html' title='undefined method `path2class&#39;'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-7195966079852270943</id><published>2015-05-02T01:31:00.000+09:00</published><updated>2016-05-11T20:57:38.109+09:00</updated><title type='text'>WebSocket client library (Java SE 1.5+, Android)</title><summary type="text">This page explains nv-websocket-client, a WebSocket client library written in Java. Its JavaDoc is here.


Last Updated: May. 11, 2016 


Overview

High-quality WebSocket client implementation in Java which


complies with RFC 6455 (The WebSocket Protocol)
works on Java SE 1.5+ and Android,
supports all the frame types (continuation, binary, text, close, ping and pong),
provides a method to send </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/7195966079852270943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/7195966079852270943'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/05/websocket-client-library-java-se-15.html' title='WebSocket client library (Java SE 1.5+, Android)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-3713630413255827905</id><published>2015-04-22T02:40:00.000+09:00</published><updated>2016-05-11T21:08:28.902+09:00</updated><title type='text'>WebSocket クライアントライブラリ (Java SE 1.5+, Android)</title><summary type="text">WebSocket クライアントライブラリ (Java) nv-websocket-client の説明です。JavaDoc はこちら。


最終更新日: 2016 年 5 月 11 日 


特長


RFC 6455 (The WebSocket Protocol) に準拠している。
Java SE 1.5+, Android で動く。
全てのフレームタイプ (continuation/binary/text/close/ping/pong) をサポートしている。
分割されたフレームを送信するメソッドを提供している。
WebSocket が使用しているソケットを取得して設定できる。
Basic 認証のためのメソッドを提供している。
javax.net.SocketFactory インターフェースを利用するファクトリークラスを提供している。
WebSocket イベントをフックするため</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3713630413255827905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3713630413255827905'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/04/websocket-java-se-15-android.html' title='WebSocket クライアントライブラリ (Java SE 1.5+, Android)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-2245312882771990183</id><published>2015-04-14T19:50:00.000+09:00</published><updated>2015-06-11T01:27:01.402+09:00</updated><title type='text'>Rails をインストールする (Ubuntu/VirtualBox/Windows)</title><summary type="text">Windows 上に Rails をインストールしようとしたところ、簡単に解決しなさそうな問題がいろいろ出てきたので、Windows に直接 Rails をインストールすることは諦め※1、Windows に仮想化ソフト VirtualBox を入れてその上で Ubuntu を動かし、そこに Rails をインストールすることにした。しかしそれでも、幾つも問題に遭遇したので、手順を書き残しておく。

※1：その後、問題回避策として「gem update --system 2.3.0」をおこなったら、Windows でも Rails が動いた。（参考： Rubygems Issue 977）


1. 仮想ハードディスクイメージのダウンロード

VirtualBox で作成する仮想マシンの仮想ハードドライブとして使用するイメージを「日本語 Remix 仮想ハードディスクイメージのダウンロード</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/2245312882771990183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/2245312882771990183'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/04/rails-ubuntuvirtualboxwindows.html' title='Rails をインストールする (Ubuntu/VirtualBox/Windows)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWNmDGy1AJiuaTGt43XHOqnCbuW-Y_zpVbKIazP9L54tCYuFHCjASGQLlv08waTEjJUBaW8Qqi8bpcJRa5YLJB3cndn4NXPWxiRAEsh-UyQJan3peFYCGInCkRB_zhTz-IY1iaz_mkDJw/s72-c/virtual-machine-creation-os.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-7419237614946992895</id><published>2015-04-07T16:28:00.000+09:00</published><updated>2015-04-07T16:30:30.737+09:00</updated><title type='text'>Function to define a namespace in JavaScript (namespace.js)</title><summary type="text">Sample Code:

// Define a namespace &#39;aaa.bbb.ccc&#39; and add a function &#39;hello&#39;
// under the namespace which prints &#39;Hello, world.&#39;.
namespace(&#39;aaa.bbb.ccc&#39;).hello = function() {
    print(&#39;Hello, world.&#39;);
};

// Execute the function.
aaa.bbb.ccc.hello(); 



Source Code:

</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/7419237614946992895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/7419237614946992895'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/04/function-to-define-namespace-in.html' title='Function to define a namespace in JavaScript (namespace.js)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-3150490593398600984</id><published>2015-03-21T00:49:00.002+09:00</published><updated>2015-03-21T00:59:29.804+09:00</updated><title type='text'>iBeacon as a kind of AD structures</title><summary type="text">First of all, iBeacon should be parsed as a kind of AD structures. Any library that is not implemented that way is just &quot;usable&quot; at best.

The AD structure format is described in &quot;11 ADVERTISING AND SCAN RESPONSE DATA FORMAT&quot; of &quot;Bluetooth Core Specification 4.2&quot;. You can find the document at Specification Adopted Documents.

nv-bluetooth is a utility library written in Java and it contains </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3150490593398600984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3150490593398600984'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/03/ibeacon-as-kind-of-ad-structures.html' title='iBeacon as a kind of AD structures'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-9151777414980628612</id><published>2015-02-20T16:11:00.000+09:00</published><updated>2015-02-20T16:11:16.601+09:00</updated><title type='text'>Redshift の文字列型はバイト単位！？</title><summary type="text">
私の勘違いでなければ、

通常の PostgreSQL の場合、character varying(N) などの N は「文字数単位」ですが、PostgreSQL 8.0.2 から派生した Amazon Redshift の場合は「バイト単位」になるようです。

PostgreSQL ドキュメント 「Character Types」 より抜粋


SQL defines two primary
  character types: character varying(n) and character(n), where
  n is a positive integer. Both of
  these types can store strings up to n characters (not bytes) in length.

Redshift ドキュメント 「</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/9151777414980628612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/9151777414980628612'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2015/02/redshift.html' title='Redshift の文字列型はバイト単位！？'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-438165278366339172</id><published>2014-12-16T23:50:00.002+09:00</published><updated>2014-12-16T23:50:57.372+09:00</updated><title type='text'>Sinatra + SSL</title><summary type="text">Found a better way to enable SSL in Sinatra than &quot;Sinatra+Thin+SSL&quot;. This is a generic way and does not require Thin.


</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/438165278366339172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/438165278366339172'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2014/12/sinatra-ssl.html' title='Sinatra + SSL'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-3097640483492335269</id><published>2014-10-01T22:24:00.003+09:00</published><updated>2014-12-16T23:53:49.848+09:00</updated><title type='text'>Sinatra + Thin + SSL</title><summary type="text">Finally found a way to enable SSL in Sinatra + Thin.

# [2014/12/16]
# Found a better way.
# See &quot;Sinatra&amp;nbsp;+ SSL&quot;. 




Start this script (sinatra+thin+ssl.rb) then type:

curl -k https://localhost/

and you will see &quot;Hello, SSL.&quot;
</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3097640483492335269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3097640483492335269'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2014/10/sinatra-thin-ssl.html' title='Sinatra + Thin + SSL'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-2636807825576305515</id><published>2014-09-20T03:28:00.000+09:00</published><updated>2014-09-20T04:09:16.360+09:00</updated><title type='text'>MissingTableException on Google Cloud SQL</title><summary type="text">If you are using JDO to access Google Cloud SQL and suffering from MissingTableException like below:



org.datanucleus.store.rdbms.exceptions.MissingTableException: Required table missing : &quot;`TABLE NAME`&quot; in Catalog &quot;&quot; Schema &quot;&quot;. DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable &quot;datanucleus.autoCreateTables&quot;



and if</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/2636807825576305515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/2636807825576305515'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2014/09/missingtableexception-on-google-cloud.html' title='MissingTableException on Google Cloud SQL'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-2821774552691830074</id><published>2014-07-19T04:27:00.000+09:00</published><updated>2014-07-19T04:27:08.370+09:00</updated><title type='text'>JDO：カラムサイズは十分大きいのにデータが保存できないという問題を解消する方法</title><summary type="text">&amp;nbsp; JDO を使っているときに表示される次のようなエラーメッセージは、


Attempt to store value &quot;{DATA}&quot; in column &quot;`{COLUMN-NAME}`&quot; that has maximum length of 255. Please correct your data!

保存しようとしているデータのサイズが、対応するデータベーステーブルのカラムのデータサイズよりも大きいということを意味している。しかし、カラムサイズが十分大きくてもこのエラーが起きることがある。例えば、対応するカラムの型を TEXT で定義しているにもかかわらず（MySQL 的には TEXT は 65535 まで OK であるにもかかわらず）、上記のようなエラーが出てしまうことがある。

&amp;nbsp; この問題は、@Column アノテーションに length を追加して</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/2821774552691830074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/2821774552691830074'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2014/07/jdo.html' title='JDO：カラムサイズは十分大きいのにデータが保存できないという問題を解消する方法'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-3465049416601006467</id><published>2014-07-10T12:50:00.000+09:00</published><updated>2014-07-11T07:39:45.141+09:00</updated><title type='text'>JDO Enum Mapping</title><summary type="text">&amp;nbsp; Java Data Objects 3.0 (JSR 243) の仕様によると、Enum の値をストレージに永続化する際、ストレージでの型が数値型であれば Enum.ordinal() メソッドの返す値が、文字列型であれば Enum.name() メソッドの返す値が用いられるとのこと。 (15.1 Column Elements / Mapping enums)

&amp;nbsp; Enum にマッピングされるカラムのデフォルトの jdbc-type は VARCHAR なので、ordinal() の値を使いたいときは、当該カラムに対して明示的に jdbc-type を指定したほうがよい。有効な jdbc-type は次のとおりで、全て大文字か全て小文字かのどちらかで指定する。 (18.4 ELEMENT column)


CHAR, VARCHAR, LONGVARCHAR</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3465049416601006467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3465049416601006467'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2014/07/jdo-enum-mapping.html' title='JDO Enum Mapping'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-8205137098850567792</id><published>2014-04-19T02:53:00.000+09:00</published><updated>2015-04-13T23:13:27.866+09:00</updated><title type='text'>2 の 256 乗を計算してみた</title><summary type="text">2256 を十進数で表すと 78 桁で、無量大数の十億倍くらいの値であることが分かりました。
ちゃんとした方法でランダムに生成した 256 ビットのハッシュ値が偶然ぶつかるかもしれないなんてことを心配するのは馬鹿げていることを理解しました。いや、馬鹿げているのは理解していたのですけど、実際に計算してみると、どれだけ途方もなく馬鹿げているのかが分かった、という話です。

どれくらい大きな数字なのか例えで考えてみます。


太陽の寿命が来るまで今から 50 億年のあいだ、

100 億人の人が、

毎ナノ秒 1 兆個の数値を消費していく活動があり、

その活動を、太陽系が属するこの銀河系の全ての星（～2,000 億くらい）でおこなうと、


消費される数字の個数は、50 億年 × 100 億人 × 100000000 ナノ秒 × 60 秒 × 60 分 × 24 時間 × 365 日 × 1</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/8205137098850567792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/8205137098850567792'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2014/04/2-256.html' title='2 の 256 乗を計算してみた'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-5754496135564997105</id><published>2014-03-17T02:49:00.000+09:00</published><updated>2014-03-17T02:49:09.957+09:00</updated><title type='text'>AccessControlException when using local MySQL for Google Cloud SQL</title><summary type="text">&amp;nbsp; If you are developing an application for Google App Engine + Google Cloud SQL and using local MySQL during development, you may encounter AccessControlExeption like below.
java.security.AccessControlException:
    access denied (&quot;java.lang.RuntimePermission&quot; &quot;modifyThreadGroup&quot;)

&amp;nbsp; This exception is raised when your application tries to use Thread because Google App Engine does not </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/5754496135564997105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/5754496135564997105'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2014/03/accesscontrolexception-when-using-local.html' title='AccessControlException when using local MySQL for Google Cloud SQL'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-4861333392468459529</id><published>2014-03-13T16:37:00.000+09:00</published><updated>2014-03-13T16:37:27.827+09:00</updated><title type='text'>MySQL: Error 1067 Process terminated unexpectedly</title><summary type="text">&amp;nbsp; If MySQL service fails to start and reports &quot;Error 1067&quot;, it indicates that the configuration file my.ini contains errors. 1067 is a generic error code, so you cannot tell which configuration parameter is the cause. Therefore, to find wrong configuration parameters, you have to repeat comment in/out configuration parameters and start/stop MySQL service.

&amp;nbsp; In my case, configuration </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/4861333392468459529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/4861333392468459529'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2014/03/mysql-error-1067-process-terminated.html' title='MySQL: Error 1067 Process terminated unexpectedly'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-4187162353927693850</id><published>2014-03-05T02:28:00.000+09:00</published><updated>2014-10-17T18:53:29.066+09:00</updated><title type='text'>Google App Engine Tips</title><summary type="text">

Eclipse で com.google.appengine.archetypes:guestbook-archetype を指定して
GAE のテンプレートプロジェクトを作ると、.classpath の中に &amp;lt;classpathentry&amp;gt;
が大量に挿入されるが、絶対パスで書かれるので、GAE SDK をアップデートするときに都合が悪い。
.classpath を手作業で編集して次の内容で置き換えたほうがよい。
&amp;lt;classpathentry kind=&quot;con&quot;
  path=&quot;com.google.appengine.eclipse.core.GAE_CONTAINER&quot;/&amp;gt;



.classpath の中で、GAE_CONTAINER を MAVEN2_CLASSPATH_CONTAINER より前に置いておかないと、.m2
の中にある GAE </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/4187162353927693850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/4187162353927693850'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2014/03/google-app-engine-tips.html' title='Google App Engine Tips'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-4545447799335587302</id><published>2014-02-23T22:41:00.000+09:00</published><updated>2014-02-23T22:41:13.744+09:00</updated><title type='text'>Apache Shiro Configuration (日本語訳)</title><summary type="text"># Apache Shiro Configuration の日本語訳 

&amp;nbsp; 単純なコマンドライン・アプリケーションからクラスター化された大規模エンタープライズアプリケーションに至るまで、あらゆる環境で動作するように Shiro は設計されています。環境は多岐にわたるため、適切に設定をおこなえるよう、設定方法も数多く存在します。この節では、Shiro core によりサポートされる設定方法について説明します。


多くの設定オプション

&amp;nbsp; Shiro の SecurityManager 実装群と補助コンポーネント群は、全て JavaBeans 互換です。これにより、事実上 Shiro は、通常の Java、XML (Spring, JBoss, Guice, etc), YAML, JSON, Groovy Builder マークアップ、等々、設定書式を問わずに設定</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/4545447799335587302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/4545447799335587302'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2014/02/apache-shiro-configuration.html' title='Apache Shiro Configuration (日本語訳)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-2030255606301043617</id><published>2013-12-29T19:35:00.000+09:00</published><updated>2013-12-29T19:35:19.331+09:00</updated><title type='text'>Apache Shiro Realms (日本語訳)</title><summary type="text"># Apach Shiro Realms の日本語訳

&amp;nbsp; Realm は、ユーザー、ロール、パーミッション等のアプリケーション固有のセキュリティーデータにアクセスするコンポーネントです。データソースが幾つ存在していようが、どれだけアプリケーションに特化したデータであろうが、アプリケーション固有のデータが Realm を通して解釈可能なフォーマットに整えられ、それにより Shiro は、単一でかつ理解も容易な Subject というプログラミング API を提供することが可能となっています。

&amp;nbsp; Realm は通常、リレーショナルデータベースや LDAP ディレクトリ、ファイルシステムといったデータソース、もしくは他の似たようなリソースと、1 対 1 の関係を持っています。そのため、Realm インターフェースの実装では、JDBC やファイル I/O、</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/2030255606301043617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/2030255606301043617'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2013/12/apache-shiro-realms.html' title='Apache Shiro Realms (日本語訳)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-3470989194641867286</id><published>2013-12-28T23:07:00.000+09:00</published><updated>2013-12-28T23:07:38.833+09:00</updated><title type='text'>文字数、UTF-8 でのバイト数、サロゲートペアの数を数える</title><summary type="text">&amp;nbsp; 下記のコードは、文字数、UTF-8 で符号化したときのバイト数、サロゲートペアの数、を数え上げるロジックを JavaScript で表現したものです。Java や Objective-C など、文字列を UTF-16 で扱っているプログラミング言語であれば、同じロジックを適用できます。GIST はこちら。Unicode 理解度簡易チェックはこちら。本ブログの英語版はこちら。


&lt;!-- Input --&gt;



&lt;!-- Output: Number of letters--&gt;
文字数： 0
&lt;!-- Output: Number of bytes in UTF-8 --&gt;
UTF-8 でのバイト数： 0
&lt;!-- Output: Number of surrogate pairs --&gt;
サロゲートペアの数： 0




function </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3470989194641867286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3470989194641867286'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2013/12/utf-8.html' title='文字数、UTF-8 でのバイト数、サロゲートペアの数を数える'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-6314731521976278827</id><published>2013-12-28T16:48:00.000+09:00</published><updated>2013-12-28T17:12:47.675+09:00</updated><title type='text'>Count up letters, bytes in UTF-8 and surrogate pairs in JavaScript</title><summary type="text">Below is a sample code in JavaScript to count up letters, bytes in UTF-8 and surrogate pairs. Available as a gist.


&lt;!-- Input --&gt;



&lt;!-- Output: Number of letters--&gt;
0 letter(s).
&lt;!-- Output: Number of bytes in UTF-8 --&gt;
0 byte(s) in UTF-8.
&lt;!-- Output: Number of surrogate pairs --&gt;
0 surrogate pair(s).






function compute_bytes_in_utf8(codePoint)
{
  // Unicode code points and their </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/6314731521976278827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/6314731521976278827'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2013/12/count-up-letters-bytes-in-utf-8-and.html' title='Count up letters, bytes in UTF-8 and surrogate pairs in JavaScript'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1578022360101244332.post-3442573368746669700</id><published>2013-12-13T05:41:00.000+09:00</published><updated>2013-12-14T03:12:11.191+09:00</updated><title type='text'>Unicode 理解度簡易チェック</title><summary type="text">次のことが理解できているかを簡単に調べることができます。


UTF-8 は Unicode の文字符号化方式の一つである
    (Unicode と UTF-8 の違いが分かっているか？)
Java や Objective-C でプログラミングするときに文字の値は UTF-16 になっている
    (ちゃんとプログラミングできるか？)


下記の表の内容を見て、全て理解できれば OK です。






  あ


  Unicode の規格でこの文字に割り当てられた
Unicode スカラ値 (十六進数表記)
  U+3042


  この文字の Unicode スカラ値を UTF-8 で
符号化したときのバイト列 (十六進数表記)
  E3 81 82
(3 バイト)


  この文字の Unicode スカラ値を UTF-16BE で
符号化したときのバイト列 (十六進数表記</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3442573368746669700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1578022360101244332/posts/default/3442573368746669700'/><link rel='alternate' type='text/html' href='http://darutk-oboegaki.blogspot.com/2013/12/unicode.html' title='Unicode 理解度簡易チェック'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/14478197146468646900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOgbCTVnQ2Dp_LpKXTppHvtqDBgVpTQ2loL-q7c8Cj_L82W8-mp6i-zIPdX7meoEvEBj79ocg7qHoGZoVsb-uPgOnlgHO-q0UucYoeKJYGkG_M-9FjNZX6nxOL4LNa2TDrABOEWrtDk8s/s72-c/20bb7.png" height="72" width="72"/></entry></feed>