週末にAppleにレビューを出していたアプリがリジェクトされてきた。

al_yousecond2010-02-26

ひとつは、ツイッターの認証画面がでないということだがこちらでも再現できずにいると、違う現象でうまく認証ができないことがわかった。利用しているモジュール側で修正が出ていたのでそれを利用したのだが、今後のツイッター側での変更がある可能性があるので、もう少し柔軟な対応に変更をしておいた。
もうひとつは、UIのガイドラインにのっとっていなとのことなのでUI周りを変更して再びレビューに出した。
iPhoneラップタイマー「AutoLap」のツイッター連携は日の目を見ることはできるのだろうか???

http://www.ivalues.jp/

ランニングやサーキット走行などのラップタイムをもっと気軽に計測するためのiPhoneアプリケーションをリリースしました。

iPhoneラップタイマー「AutoLap」は、iPhoneでラップタイムを自動的に計測できるアプリケーションです。

皇居一周を走っている方や、富士スピードウェイでサーキット走行している方はコースデータが既に登録されていますので、コース作成せずに直ぐにご利用いただけます。

詳細はこちら。

【メモ】 libxml2のNodetypeについて

NodeType: The node type,
1 for start element,
15 for end of element,
2 for attributes,
3 for text nodes,
4 for CData sections,
5 for entity references,
6 for entity declarations,
7 for PIs,
8 for comments,
9 for the document nodes,
10 for DTD/Doctype nodes,
11 for document fragment
12 for notation nodes.

Moose::Util::TypeConstraintsによるアクセサのタイプ制限について

Xbrlの格闘から、ようやくコーディングができる状態までやってきた。
色々となにがいいか調査をしている間に、perlMooseというモジュールにたどりつき、
試しに色々と使ってみようかと考えているところである。
さっそく、Moose::Util::TypeConstraintsを利用して、アトリビュートにオブジェクトタイプの制約を設定してみた。
作成したモジュールは下記のとおり。

package Car;

use warnings;
use strict;
use Carp;

use version; our $VERSION = qv('0.0.3');
use Moose;
use Moose::Util::TypeConstraints;

has 'name' => ( is => 'rw', isa => 'Str');
has 'type' => ( is => 'rw', isa => 'Str');

subtype 'Tire'
 => as 'Object'
 => where { $_->isa('Tire') };
has 'tire' => ( is => 'rw', isa => 'Tire' );

package Tire;

use warnings;
use strict;
use Carp;

use version; our $VERSION = qv('0.0.3');

# Module implementation here
use Moose;

has 'size' => ( is => 'rw', isa => 'Int' );
has 'width' => ( is => 'rw', isa => 'Int' );
has 'profile' => ( is => 'rw', isa => 'Int' );

これらのモジュールを下記のようなテストスクリプトから呼び出し。

use Test::More tests => 2;
use Car;
use Tire;

my $new_tire = Tire->new(
         size => 285,
         inch => 20,
         profile => 35
       );

my $new_car = Car->new(
         name => 'GT-R'
);

$new_car->tire('YOKOHAMA');
$new_car->tire($new_tire);

$new_car->type('sports');
is( $new_car->name, 'GT-R', 'getter name');
is( $new_car->type, 'sports', 'getter sports');

モジュールのテストを実施すると、下記のような2つのエラーが発生

①Prototype mismatch: sub Car::type ($$;$$) vs none at /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Class/MOP/Package.pm line 94.

②Attribute (tire) does not pass the type constraint because: Validation failed for 'Tire' failed with value YOKOHAMA at (eval 74) line 7
Car::tire('Car=HASH(0xa12a7c0)', 'YOKOHAMA') called at t/01.cat.t line 14

②のほうは、tireアトリビュートの制約エラーなのでこちらの想定したとおりなってOK。
①のほうはCARオブジェクトのtypeメソッドではなく、useしているMoose::Util::TypeConstraints
パッケージのtypeメソッドが呼ばれていて、プロトタイプエラーになっている模様。

Carモジュールの下記のように修正
1. use Moose::Util::TypeConstraintsに()をつけてメソッドのインポートを抑制
2. subtype,as,whereをパッケージ修飾子をつけて指定

package Car;

use warnings;
use strict;
use Carp;

use version; our $VERSION = qv('0.0.3');
use Moose;
use Moose::Util::TypeConstraints();

has 'name' => ( is => 'rw', isa => 'Str' );
has 'type' => ( is => 'rw', isa => 'Str' );

Moose::Util::TypeConstraints::subtype 'Tire'
  => Moose::Util::TypeConstraints::as 'Object'
  => Moose::Util::TypeConstraints::where { $_->isa('Tire') };
has 'tire' => ( is => 'rw', isa => 'Tire' );

わざわざ、パッケージ修飾子つけるのも面倒なので、Mooseによるアクセサの作成のされ方等、
ソースを調べてみないとわからないかもしれないが、他に方法がないか引き続き調査中。
どう考えても、Moose::Util::TypeConstraintsのメソッド名と自分で作成するメソッド名が
重複する可能性は高いので、何かしらの簡潔な解決方法を見つけないといけないかもしれない。

PerlベストプラクティスPerlベストプラクティス
(2006/08/24)
Damian Conway

商品詳細を見る
実用Perlプログラミング実用Perlプログラミング
(2006/03)
サイモン カズンズ

商品詳細を見る

A replication setup of MySQL

1.The snapshot of a master is prepared for the slave side.

The dump file exported from the master is imported to the slave side like the procedure of "Distributed File of MySQL."

2.A setup of a master

The following is added to my.cnf.

server-id = 100 <- Numbers are arbitrary numbers which do not overlap with other MySQL servers.

The user in whom replication is possible is set up from a slave server.

mysql> grant replication slave on *.* to bookmark@192.168.1.50 identified by 'PASSWORD';
Query OK, 0 rows affected (0.01 sec)

The MySQL server by the side of a master is started.

3.A setup of a slave

The following is added to my.cnf.

server-id = 200 <- Numbers are arbitrary numbers which do not overlap with other MySQL servers.
master-host = 192.168.1.40
master-port = 13306 <- A master server port is specified.
master-user = bookmark <- The user who connects from a slave (user who specified by the master side)
master-password = <- The password specified for [ which is connected from a slave ] users
replicate-do-db = SandBox <- The database which performs replication.

The MySQL server by the side of a slave is started.
It is checked whether the error etc. has come out by the error log.

It checks that the following logs are outputted and replication is started in my case.

080218 16:00:29 mysqld started
080218 16:00:29 InnoDB: Started; log sequence number 0 60873317
080218 16:00:29 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.0.24-log' socket: '/tmp/mysql.sock' port: 13306 Source distribution
080218 16:00:29 [Note] Slave SQL thread initialized, starting replication in log 'binlog.000031' at position 351, relay log './c2-relay-bin.000059' position: 232
080218 16:00:29 [Note] Slave I/O thread: connected to master 'bookmark@192.168.1.40:13306', replication started in log 'binlog.000031' at position 351

4.The check of replication

It changes into the database by the side of a master, and checks being satisfactorily reflected in the slave side.

MySQLによる最速RDBMS構築ガイドMySQLによる最速RDBMS構築ガイド
(2005/09/17)
鶴長 鎮一、MCEA DB研究会 他

商品詳細を見る

MySQL逆引きクイックリファレンス―MySQL 4.0/4.1/5.0対応MySQL逆引きクイックリファレンス―MySQL 4.0/4.1/5.0対応
(2006/12)
山田 祥寛

商品詳細を見る

MySQLのレプリケーション設定

1.マスターのスナップをスレーブ側に準備する。

MySQLのファイル分散」の手順と同じように、マスターからエクスポートしたdumpファイルをスレーブ側にインポートする。

2.マスターの設定

my.cnfに下記を追加。

server-id = 100 <- 数字は他のMySQLサーバと重ならない任意の数字

スレーブサーバからレプリケーション可能なユーザの設定をする。

mysql> grant replication slave on *.* to bookmark@192.168.1.50 identified by 'パスワードを指定';
Query OK, 0 rows affected (0.01 sec)

マスター側のMySQLサーバを起動

3.スレーブの設定

my.cnfに下記を追加

server-id = 200 <- 数字は他のMySQLサーバと重ならない任意の数字
master-host = 192.168.1.40
master-port = 13306 <- MySQLのサーバ名
master-user = bookmark <- スレーブから接続するユーザ(マスタ側で指定したユーザ)
master-password = <- スレーブから接続するユーザ用に指定したパスワード
replicate-do-db = SandBox <- レプリケートを行うデータベース

スレーブ側のMySQLサーバを起動する。
ログでエラー等がでていないか確認。

私の場合は下記のようなログが出力されて、レプリケーションが開始されていることを確認。

080218 16:00:29 mysqld started
080218 16:00:29 InnoDB: Started; log sequence number 0 60873317
080218 16:00:29 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.0.24-log' socket: '/tmp/mysql.sock' port: 13306 Source distribution
080218 16:00:29 [Note] Slave SQL thread initialized, starting replication in log 'binlog.000031' at position 351, relay log './c2-relay-bin.000059' position: 232
080218 16:00:29 [Note] Slave I/O thread: connected to master 'bookmark@192.168.1.40:13306', replication started in log 'binlog.000031' at position 351

4.レプリケーションの確認

マスター側のデータベースに変更を行い、スレーブ側に問題なく反映されていることを確認

MySQLによる最速RDBMS構築ガイドMySQLによる最速RDBMS構築ガイド
(2005/09/17)
鶴長 鎮一、MCEA DB研究会 他

商品詳細を見る

MySQL逆引きクイックリファレンス―MySQL 4.0/4.1/5.0対応MySQL逆引きクイックリファレンス―MySQL 4.0/4.1/5.0対応
(2006/12)
山田 祥寛

商品詳細を見る