2010年4月28日水曜日

マリー&ガリー

NHKはどこへ向かっているのか。

誰が見てるのかわからないけど、入門編には良いのかも。誰が見てるのか知らないけど。

2010年4月16日金曜日

Stellariumの日本風星座線

Stellariumの星座線は欧米風らしい。日本でよく使われているものは天文年鑑仕様のものだそうで、手元の星座早見盤などと見比べる場合にちょっとだけ不便な気がする。

ということで、日本風の星座線ファイルを作ってみた。

データ元はCelestiaの日本風星座線である。http://celestia.aqsp.net/repository.html
勝手に使ったけど大丈夫なのかな。まずかったら言ってください。すぐに消します。

StellariumとCelestiaでは星座線ファイルの表現形式が違ったので、PHPでコンバーターを作ってびゃびゃびゃと変換しました。

constellationship.fab

Stellariumインストールフォルダの/skycultures/western/constellationship.fabと置き換えれば表示はできます。でもそうすると当然もとのWesternの星座線がなくなってしまうので、あらかじめconstellationship.fabのバックアップを取っておくか、一番いいのはwesternフォルダの中身をコピーしてwestern_japanなどという名前の新しいskycultureを作るといいでしょう。で、western_japanの中に日本風のconstellationship.fabを入れると。

2010年4月13日火曜日

Zend_Validateが吐き出すエラーコード

Zend_Validateをそのまま利用するときに困るエラーメッセージの日本語化のために、エラーコードとエラーメッセージの対応表を作ってみた。


ValidatorError CodeMessage
Alnum
INVALID Invalid type given, value should be float, string, or integer,
NOT_ALNUM '%value%' contains characters which are non alphabetic and no digits,
STRING_EMPTY '%value%' is an empty string,
Alpha
INVALID Invalid type given, value should be a string,
NOT_ALPHA '%value%' contains non alphabetic characters,
STRING_EMPTY '%value%' is an empty string
Barcode
FAILED '%value%' failed checksum validation,
INVALID_CHARS '%value%' contains invalid characters,
INVALID_LENGTH '%value%' should have a length of %length% characters,
INVALID Invalid type given, value should be string,
Between
NOT_BETWEEN '%value%' is not between '%min%' and '%max%', inclusively,
NOT_BETWEEN_STRICT '%value%' is not strictly between '%min%' and '%max%'
Callback
INVALID_VALUE '%value%' is not valid,
INVALID_CALLBACK Failure within the callback, exception returned,
Ccnum
LENGTH '%value%' must contain between 13 and 19 digits,
CHECKSUM Luhn algorithm (mod-10 checksum) failed on '%value%'
CreditCard
CHECKSUM Luhn algorithm (mod-10 checksum) failed on '%value%',
CONTENT '%value%' must contain only digits,
INVALID Invalid type given, value should be a string,
LENGTH '%value%' contains an invalid amount of digits,
PREFIX '%value%' is not from an allowed institute,
SERVICE Validation of '%value%' has been failed by the service,
SERVICEFAILURE The service returned a failure while validating '%value%',
Date
INVALID Invalid type given, value should be string, integer, array or Zend_Date,
INVALID_DATE '%value%' does not appear to be a valid date,
FALSEFORMAT '%value%' does not fit the date format '%format%',
Db_RecordExists
Db_NoRecordExists
Digits
NOT_DIGITS '%value%' contains characters which are not digits; but only digits are allowed,
STRING_EMPTY '%value%' is an empty string,
INVALID Invalid type given, value should be string, integer or float,
EmailAddress
INVALID Invalid type given, value should be a string,
INVALID_FORMAT '%value%' is no valid email address in the basic format local-part@hostname,
INVALID_HOSTNAME '%hostname%' is no valid hostname for email address '%value%',
INVALID_MX_RECORD '%hostname%' does not appear to have a valid MX record for the email address '%value%',
INVALID_SEGMENT '%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network.,
DOT_ATOM '%localPart%' can not be matched against dot-atom format,
QUOTED_STRING '%localPart%' can not be matched against quoted-string format,
INVALID_LOCAL_PART '%localPart%' is no valid local part for email address '%value%',
LENGTH_EXCEEDED '%value%' exceeds the allowed length,
Float
INVALID Invalid type given, value should be float, string, or integer,
NOT_FLOAT '%value%' does not appear to be a float,
GreaterThan
NOT_GREATER '%value%' is not greater than '%min%',
Hex
INVALID Invalid type given, value should be a string,
NOT_HEX '%value%' has not only hexadecimal digit characters,
Hostname
INVALID Invalid type given, value should be a string,
IP_ADDRESS_NOT_ALLOWED '%value%' appears to be an IP address, but IP addresses are not allowed,
UNKNOWN_TLD '%value%' appears to be a DNS hostname but cannot match TLD against known list,
INVALID_DASH '%value%' appears to be a DNS hostname but contains a dash in an invalid position,
INVALID_HOSTNAME_SCHEMA '%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%',
UNDECIPHERABLE_TLD '%value%' appears to be a DNS hostname but cannot extract TLD part,
INVALID_HOSTNAME '%value%' does not match the expected structure for a DNS hostname,
INVALID_LOCAL_NAME '%value%' does not appear to be a valid local network name,
LOCAL_NAME_NOT_ALLOWED '%value%' appears to be a local network name but local network names are not allowed,
CANNOT_DECODE_PUNYCODE '%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded,
Iban
NOTSUPPORTED Unknown country within the IBAN '%value%',
FALSEFORMAT '%value%' has a false IBAN format,
CHECKFAILED '%value%' has failed the IBAN check,
Identical
NOT_SAME The token '%token%' does not match the given token '%value%',
MISSING_TOKEN 'No token was provided to match against',
InArray
NOT_IN_ARRAY '%value%' was not found in the haystack,
Int
INVALID Invalid type given, value should be string or integer,
NOT_INT '%value%' does not appear to be an integer,
Ip
INVALID Invalid type given, value should be a string,
NOT_IP_ADDRESS '%value%' does not appear to be a valid IP address,
Isbn
INVALID '%value%' is no valid ISBN number,
LessThan
NOT_LESS '%value%' is not less than '%max%'
NotEmpty
IS_EMPTY Value is required and can't be empty,
INVALID Invalid type given, value should be float, string, array, boolean or integer,
PostCode
INVALID Invalid type given, value should be string or integer,
NO_MATCH '%value%' does not appear to be an postal code,
Regex
INVALID Invalid type given, value should be string, integer or float,
NOT_MATCH '%value%' does not match against pattern '%pattern%',
StringLength
INVALID Invalid type given, value should be a string,
TOO_SHORT '%value%' is less than %min% characters long,
TOO_LONG '%value%' is more than %max% characters long,