ときどきの雑記帖 2012


一つ前へ 2012年8月(下旬)
一つ後へ 2012年9月(中旬)




なんか今日辺りから朝の通勤時に見かける高校生の数が増えたような。 こちらの時間は変わってないんですが。


■_ What are the drawbacks of Python?

reddit の方で What are the drawbacks of Python? : programming

What are the drawbacks of Python? : programming

What are the drawbacks of Python? (programmers.stackexchange.com)

    The transition to Python 3 is taking ages, because Python 2.x seems to be good enough for most people despite its drawbacks.
    Package distribution/management is too complex.
    The stdlib has non-portable libraries (i.e: curses doesn't work on Windows).
    Lambdas must consist of a single expression.
    Super can be tricky (Not that I can think of a better way to handle it, given MI).
    No switch statement. It can be emulated with a dicts/functions though.
    No explicit declaration of variables/functions.
    Scoping fail: e.g. difficult to work with nested functions.
    No immutable data structures.
    No multi-line anonymous functions (and half-hearted implementation of functional paradigms in general).
    No switch.
    Poor Unicode support.
    Poor docs.
    The GIL.
    Large amount of language magic/corner cases that bite the unwary.
    Interminable pretentious debates about whether some trivial detail is sufficiently 'Pythonic'/ excessive evangelism.

There's better competition around these days, and Python is starting to show its age.

    other languages you might choose to do similar tasks that Python is suitable for

Given that Python is classified as a scripting language similar to Perl and Ruby, Python compares
somewhere between Perl and Ruby.

vs Perl:

    OO isn't tacked-on as an afterthought the way it is in Perl
    Most things have methods, unlike Perl
    Lists within Lists don't require special syntax, unlike Perl
    Same #! shebangs as Perl
    More verbose than Perl
    But more readable than Perl
    Python regex methods are overengineered compared to Perl's regex syntax
    Where Perl uses foreach, Python uses [ e for e in iterator ], which is easily nested.
    Python is installed using mostly official packages, whereas Perl is installed using a variety of homegrown, unsupported packages (Strawberry Perl)
    Perl has CPAN for packages, which works 92% of the time
    Perl has a longer history of UNIX / sysadmin support, but Python has far more industry / academic support due to its easy syntax

vs Ruby:

    But where Python uses [ e for e in iterator ], Ruby uses iterator.each { |e| ... }, which is even more easily nested: iterator.each_file.each_word.each_char.each_bit
    Whitespace is a problem. If you're coding in an editor without support for tabs (Web ajaxterm, it happens), you're sunk.
    Ruby derives from SmallTalk, so it has better OO design than Python
    Same #! shebangs as Ruby
    Ruby has better regex syntax, similar to Perl's
    Python is installed using mostly official packages, whereas Ruby is installed using a variety of unsupported packages (RubyInstaller)
    Ruby has RubyGems, Python has shit that doesn't fucking work (setuptools) due to circular dependency chains
    Ruby has industry support, but mostly limited to web apps.
    Matsumoto does not work for Google, but van Rossum does.
    GIL in CPython.

    Statements vs. expressions: why this shit? This is behind the lambda/def insanity BTW.

    Hostility towards functional programming.

    Guido van Rossum, B. Dictator For Life., trying to create the most "pythonic" language rather
    than the best language, for his personal, arbitrary, prejudiced definition of "pythonic".

    Packages and their alternatives are a mess.

    Libraries sticking to Python 2.x.




MUA というかメールクライアント。 某社では某有名シェアウエアが標準のメールクライアントに指定されております。 他のメールクライアントは(原則?)使用禁止。 んでまあ日々(でもないか)困っているのがメールの検索。 インデックスやらなんやら作らず毎回正直に検索しているようで、 使っていて(ry

TaPL でも出てきたし、モナドの説明なんかでも良くでてくると思うんですが よくわからんのですわー >「(関数などの)lift」

満員電車 時差通勤通学


■_ Python の

drawbacks (弱点とか欠点とか)

programming languages - What are the drawbacks of Python? - Programmers

Python seems all the rage these days, and not undeservingly - for it is truly a language with
which one almost enjoys being given a new problem to solve. But, as a wise man once said
(calling him a wise man only because I've no idea as to who actually said it; not sure whether he
was that wise at all), to really know a language one does not only know its syntax, design, etc.,
advantages but also its drawbacks. No language is perfect, some are just better than others.

So, what would be in your opinion, objective drawbacks of Python.

Note: I'm not asking for a language comparison here (i.e. C# is better than Python because ...
yadda yadda yadda) - more of an objective (to some level) opinion which language features are badly
designed, whether, what are maybe some you're missing in it and so on. If must use another language
as a comparison, but only to illustrate a point which would be hard to elaborate on otherwise (i.e.
for ease of understanding)

I use Python somewhat regularly, and overall I consider it to be a very good language. Nonetheless,
no language is perfect. Here are the drawbacks in order of importance to me personally:

    It's slow. I mean really, really slow. A lot of times this doesn't matter, but it definitely
    means you'll need another language for those performance-critical bits.

    Nested functions kind of suck in that you can't modify variables in the outer scope. Edit: I
    still use Python 2 due to library support, and this design flaw irritates the heck out of me,
    but apparently it's fixed in Python 3 due to the nonlocal statement. Can't wait for the libs I
    use to be ported so this flaw can be sent to the ash heap of history for good.

    It's missing a few features that can be useful to library/generic code and IMHO are simplicity
    taken to unhealthy extremes. The most important ones I can think of are user-defined value
    types (I'm guessing these can be created with metaclass magic, but I've never tried), and ref
    function parameter.

    It's far from the metal. Need to write threading primitives or kernel code or something? Good luck.

    While I don't mind the lack of ability to catch semantic errors upfront as a tradeoff for the
    dynamism that Python offers, I wish there were a way to catch syntactic errors and silly things
    like mistyping variable names without having to actually run the code.

    The documentation isn't as good as languages like PHP and Java that have strong corporate backings.
Things I don't like about Python:

    Threading (I know its been mentioned already, but worth mentioning in every post).
    No support for multi-line anonymous functions (lambda can contain only one expression).
    Lack of a simple but powerful input reading function/class (like cin or scanf in C++ and C or Scanner in Java).
    All strings are not unicode by default (but fixed in Python 3).




TAPL読書会。 4ヶ月ぶりのご無沙汰。 そのせいもあってか今回はほとんど進まず。 今回読んだのはこの辺り



declarative presentaions と algorithmic presetaions の
one of most distinctive doffrences

delclarative ~ は explicit rule of transitivity が含まれる
if S<:U and U<:T the S <:T
algorithmic ~ にはない(algorithmic~では無意味だから)

the rule of transitivty は declarative system において
two useful roles を play する
第一に、関係する subtype を reader に対して明確にする
transitivity はより primitive な form で単純な other rules をしばしば allow する

  Subtype(S, T) = if T = Top, then true
                  else if S = S1 → S2 and T1 → T2
                    then subtype(T1, S1) ∧ subtype(S2, T2)
                  else if S = {...} and T = {...}
                    then {li i∈ 1..m} ⊆ {kj j∈1..m}
                        ∧ for all i there is some j ∈ 1..m with kj = li
                             and subtype(Sj, Ti)
                  else false.

→16.2 Algorithmic Typing

小さな規則を組み合わせた mega rule を駆使する必要がある
"depth subtyping" within record fields
"width subtyping" by adding new fields
"permutation" of fields can be stated seprarately

closure property
inductive definition

Suppose F and G are monotone functions, and let H(X) = F(X) ∨ G(X)
Then μH is the smalles set that is both F-closed and G-closed.


Knaster-Tarski theorem

Suppose F is a generation function on the universe U.
Show that gretes fixed point νF^TR of the generation function

         F^TR(R) = F(R) ∨ TR(R)

is the total relation on  U × U

generating function → 生成関数、母関数
monotone function  → 単調写像

21.5 Membership Checking

some universe U に関する generating function F と element x ∈ U が与えられたときに
x falls in the greatest fixed point of F かどうかをどのように判定するか


either is empty or contains a unique member that is a subset of all the others.

invertible → 逆元

A generating function F is said to be invertible if, for all x ∈ U,
the collection of sets

   Gx = {X ⊆ U | X ∈ F(X)}

F が invertible であるとき
partial function supportF ∈ U → P(U) は次のように定義される

 supportF(x) = { X  if X ∈ Gx and ∀X' ∈ Gx. X ⊆ X'
                 ↑ if Gx = 空集合

The support function is lifted to sets as follows

  supportF(x) = {U x ∈x supportF(x) if ∀x ∈ X. supportF(x)↓
                 ↑                  otherwise

定義域 defined
parial function は数学的には×

Verify that Sf and S,
the genrating functions for the subtyping relations from Definitions 21.3.1 and 21.3.2,
are invertible, and give their support functions

Our goal is to develop algorithms for checking membership
in the least ad greatest fixed points of a generatong function F.
The basic steps in these algorithms will involve "running F backwards":
to check membership for an element x,
we need to ask how x cound have been generated by F.
the advantage of an invertbile F is that there is at most one way to generated by F.
For a non-invertible F, elements can be generated in multiple ways,
leading to a combinatorial explosion in the number of paths that the algorithm must explore.
From now on, we restrict our attention to invertible generating functions.

supoort function
関数の support とは?

辞書なんかじゃないやい: 関数のsupport(supp)とは


■_ こーどれびう


過去にてこずった不具合を将来のレビューで注力して検出する手順を提案した論文:森崎修司の「どうやってはかるの?」:ITmedia オルタナティブ・ブログ Cloudreach Dev Blog: Asynchronous Code Reviews as an Efficient Way of Ensuring Code Quality

以前ついったで、「これからコードレビューだからマサカリ投げまくる」的な発言を見かけたことがあって、 そのときはそりゃあいかんだろうと思ったんですが、 いくつかコードレビューについての記事を読んでみると わざわざ「egoless」云々に言及しているものが多いってのを考えると マサカリ投げたくなる人ってのは多いんでしょうねえ (自分のことは棚上げ)。

■_ 読んだ

山手線に新駅ができる本当の理由 (メディアファクトリー新書)
山手線に新駅ができる本当の理由 (メディアファクトリー新書)

面白かった。 キーワードは「東北縦貫線」。 朝のラッシュ時に山手線で一番混雑するのは御徒町のあたりだそうで、 この東北縦貫線ができればその混雑の原因を(ある程度は)解決できるだろうとか。 あとは新駅の再開発はどういう意味を持ってということなど。 ただ気になったのは、山手線新駅を含めた再開発で人を呼び込んでということをしたとして、 山手線以外の、西武やら東武、京急、東急等々のラッシュはどうすんのよ。という辺り。 それはこの本の書くところからは外れるだろうということなんでしょうが(JR東の話だから)、 Hexenkessel, 「何時頃の何線に乗ってるんだ?」... という話も最近話題になっているわけだし、JR 以外の鉄道は各自でよろしくやれ。ってのもひどいような。 小田急は複々線化を着々と進めているし、東横線は20m×8の編成を20m×10にするとか 色々やってますけど焼け石に水よりはましくらい? ついったで見てても朝方の不満のツイートはよく見かけますもんねえ。

混雑率ワースト5はアノ路線! “痛勤ラッシュ”を避けるコツ | web R25 ラッシュ時 - Wikipedia 路線別のラッシュ時における混雑率の推移/千葉県

■_ 買った

ちと薄め > Developer's code

Developer's Code 本物のプログラマがしていること
Developer's Code 本物のプログラマがしていること プログラマのためのサバイバルマニュアル
プログラマのためのサバイバルマニュアル 素数夜曲: 女王陛下のLISP
素数夜曲: 女王陛下のLISP


■_ ソースコード

50周年とかで流れてたリンクを辿り こういうのを見つけたのだけど

LISP 1.5 family — Software Preservation Group

Source code

    LISP system assembly listing. "FIELD TEST ASSEMBLY OF LISP 1.5 SEPTEMBER 1961", labeled "Bonnie's Birthday Assembly".
    Science and Technology Collection, M.I.T. Museum, Cambridge, Massachusetts, catalog number 1993.053, donated by Timothy P. Hart.
        Jack Harper. Scan of listing. PDF (16MB)
        Pascal Bourguignon. Reconstruction of assembly source code. .tar.gz at informatimago.com (background at Dusty Decks)
        Rich Cornwell and Bob Abeles. Proofread reconstruction of assembly source code. unpacked
            This should be runnable under SIMH or Rich's variation of SIMH for the IBM 704, but it
            still needs some debugging by someone with Lisp 1.5 experience or a desire to learn.
            Contact paul mcjones.org if you are interested. 

.tar.gz へのリンクをクリックしたら 403 だった○| ̄|_



まつもとさんの新連載があったので買ってみた 日経 Linux (リナックス) 2012年 10月号 [雑誌]
日経 Linux (リナックス) 2012年 10月号 [雑誌]

色んな人が誉めてたと思うけどオススメ。 やっぱりこういうことなんだと思いますよ(とこれだけでは意味不明) 小さく賭けろ!―世界を変えた人と組織の成功の秘密

■_ memmem

Feature #6311: memmem()によるrb_memsearch()の高速化 - ruby-trunk - Ruby Issue Tracking System という話があって、それはどんなもので(なんとなく見当はつくけど) なぜそれを使うと速くなったのかが気になった。 Christian Thaeter - memmem.c improvement


Christian Thaeter - memmem.c improvement

memmem.c improvement

    From: Christian Thaeter <ct at pipapo dot org>
    To: libc-alpha at sourceware dot org, git at vger dot kernel dot org
    Date: Sat, 01 Dec 2007 01:48:15 +0100
    Subject: memmem.c improvement

Short story, 'memmem()' is a gnuish, nonstandard function. I wanted to
provide a generic fallback in some code. So, lets borrow it somewhere else:

First looking at git's compat/memmem.c which I found was suboptimal with
roughly O(M*N) performance (albeit ok for that case since it was just a
generic fallback).

Well, second taking a look at glibc's source surprised me, there is the
same code as in git. I somewhat expected a faster implementation from a
generic C library.

That thought and done, the code is attached to this mail. The algorithm
is similar to the Rabin/Karp method for string searches but uses a
weaker and simpler additive rolling hash. The result is still somewhat
like O(M+N) for most cases (There may be corner cases where it not that
good, but its really hard to imagine those). Anyways, it is always
faster than the current implementation, in my tests with common data
(parsing multipart/form-data cgi responses) it yields approx 20%-100%
improvements and with little artificial cheating (having strings in
haystack which only differ at the last char of needle) the improvements
are much better (500%, since is another complexity class). The fact is
that the old implementation does a brute force search which has corner
cases which are quite easy to hit (repeating symbol sequences, small set
of possible symbols) while for my implementation the corner cases are
much more rare and even then, it will still perform better than the old

The code is not much more complex as the old one, not the original
'Rabin/Karp' algorithm because that would require a efficient modulo
operation with a prime number which might be slower on some platforms
(just a guess, I didn't even tried, the performance satisfies me
perfectly). Other search algorithms like 'Knuth/Morris/Pratt' or
'Boyer/More' are more complex to implement and require O(Needle) extra
memory for common implementations, which reserve them for special
purposes imo. I just wanted to keep it simple but still considerably
better than the current one.

Feel free to use the code in glibc and/or git.


/* Copyright (C) 1991,92,93,94,96,97,98,2000,2004 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#include <stddef.h>
#include <string.h>

#ifndef _LIBC
# define __builtin_expect(expr, val)   (expr)

#undef memmem

/* Return the first occurrence of NEEDLE in HAYSTACK. */
void *
memmem (haystack, haystack_len, needle, needle_len)
     const void *haystack;
     size_t haystack_len;
     const void *needle;
     size_t needle_len;
  /* not really Rabin-Karp, just using additive hashing */
  char* haystack_ = (char*)haystack;
  char* needle_ = (char*)needle;
  int hash = 0;		/* this is the static hash value of the needle */
  int hay_hash = 0;	/* rolling hash over the haystack */
  char* last;
  size_t i;

  if (haystack_len < needle_len)
    return NULL;

  if (!needle_len)
    return haystack_;

  /* initialize hashes */
  for (i = needle_len; i; --i)
      hash += *needle_++;
      hay_hash += *haystack_++;

  /* iterate over the haystack */
  haystack_ = (char*)haystack;
  needle_ = (char*)needle;
  last = haystack_+(haystack_len - needle_len + 1);
  for (; haystack_ < last; ++haystack_)
      if (__builtin_expect(hash == hay_hash, 0) &&
	  *haystack_ == *needle_ &&	/* prevent calling memcmp, was a optimization from existing glibc */
	  !memcmp (haystack_, needle_, needle_len))
	return haystack_;

      /* roll the hash */
      hay_hash -= *haystack_;
      hay_hash += *(haystack_+needle_len);

  return NULL;

Tor Myklebust - Re: (class=ham score=-4.96032) memmem.c improvement Christian Thaeter - Re: (class=ham score=-4.96032) memmem.c improvement Tor Myklebust - Re: memmem.c improvement

'Rabin/Karp' algorithm この辺がポイントなのかな


んで、glibc のを


/* Copyright (C) 1991,92,93,94,96,97,98,2000,2004,2008 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <http://www.gnu.org/licenses/>.  */

/* This particular implementation was written by Eric Blake, 2008.  */

#ifndef _LIBC
# include <config.h>

/* Specification of memmem.  */
#include <string.h>

#ifndef _LIBC
# define __builtin_expect(expr, val)   (expr)

#define RETURN_TYPE void *
#define AVAILABLE(h, h_l, j, n_l) ((j) <= (h_l) - (n_l))
#include "str-two-way.h"

#undef memmem

/* Return the first occurrence of NEEDLE in HAYSTACK.  Return HAYSTACK
   if NEEDLE_LEN is 0, otherwise NULL if NEEDLE is not found in
   HAYSTACK.  */
void *
memmem (const void *haystack_start, size_t haystack_len,
	const void *needle_start, size_t needle_len)
  /* Abstract memory is considered to be an array of 'unsigned char' values,
     not an array of 'char' values.  See ISO C 99 section  */
  const unsigned char *haystack = (const unsigned char *) haystack_start;
  const unsigned char *needle = (const unsigned char *) needle_start;

  if (needle_len == 0)
    /* The first occurrence of the empty string is deemed to occur at
       the beginning of the string.  */
    return (void *) haystack;

  /* Sanity check, otherwise the loop might search through the whole
     memory.  */
  if (__builtin_expect (haystack_len < needle_len, 0))
    return NULL;

  /* Use optimizations in memchr when possible, to reduce the search
     size of haystack using a linear algorithm with a smaller
     coefficient.  However, avoid memchr for long needles, since we
     can often achieve sublinear performance.  */
  if (needle_len < LONG_NEEDLE_THRESHOLD)
      haystack = memchr (haystack, *needle, haystack_len);
      if (!haystack || __builtin_expect (needle_len == 1, 0))
	return (void *) haystack;
      haystack_len -= haystack - (const unsigned char *) haystack_start;
      if (haystack_len < needle_len)
	return NULL;
      return two_way_short_needle (haystack, haystack_len, needle, needle_len);
    return two_way_long_needle (haystack, haystack_len, needle, needle_len);



/* Return the offset of one string within another.
   Copyright (C) 1994,1996,1997,2000,2001,2003,2008,2009
   Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <http://www.gnu.org/licenses/>.  */

/* This particular implementation was written by Eric Blake, 2008.  */

#ifndef _LIBC
# include <config.h>

/* Specification of strstr.  */
#include <string.h>

#include <stdbool.h>

#ifndef _LIBC
# define __builtin_expect(expr, val)   (expr)

#define RETURN_TYPE char *
#define AVAILABLE(h, h_l, j, n_l)			\
  (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l))	\
   && ((h_l) = (j) + (n_l)))
#include "str-two-way.h"

#undef strstr

#ifndef STRSTR
#define STRSTR strstr

/* Return the first occurrence of NEEDLE in HAYSTACK.  Return HAYSTACK
   if NEEDLE is empty, otherwise NULL if NEEDLE is not found in
   HAYSTACK.  */
char *
STRSTR (const char *haystack_start, const char *needle_start)
  const char *haystack = haystack_start;
  const char *needle = needle_start;
  size_t needle_len; /* Length of NEEDLE.  */
  size_t haystack_len; /* Known minimum length of HAYSTACK.  */
  bool ok = true; /* True if NEEDLE is prefix of HAYSTACK.  */

  /* Determine length of NEEDLE, and in the process, make sure
     HAYSTACK is at least as long (no point processing all of a long
     NEEDLE if HAYSTACK is too short).  */
  while (*haystack && *needle)
    ok &= *haystack++ == *needle++;
  if (*needle)
    return NULL;
  if (ok)
    return (char *) haystack_start;

  /* Reduce the size of haystack using strchr, since it has a smaller
     linear coefficient than the Two-Way algorithm.  */
  needle_len = needle - needle_start;
  haystack = strchr (haystack_start + 1, *needle_start);
  if (!haystack || __builtin_expect (needle_len == 1, 0))
    return (char *) haystack;
  needle -= needle_len;
  haystack_len = (haystack > haystack_start + needle_len ? 1
		  : needle_len + haystack_start - haystack);

  /* Perform the search.  Abstract memory is considered to be an array
     of 'unsigned char' values, not an array of 'char' values.  See
     ISO C 99 section  */
  if (needle_len < LONG_NEEDLE_THRESHOLD)
    return two_way_short_needle ((const unsigned char *) haystack,
				 (const unsigned char *) needle, needle_len);
  return two_way_long_needle ((const unsigned char *) haystack, haystack_len,
			      (const unsigned char *) needle, needle_len);
libc_hidden_builtin_def (strstr)


下請け関数の two_way_short_needle と two_way_long_needle は共通だから その前の部分の違いが影響してるってことかなあ。


んで下請け関数はこちら。 ちょっと長めなのでリンクだけ。 str-two-way.h



More falsehoods programmers believe about time; "wisdom of the crowd" edition: @NoahSussman: Infinite Undo

More falsehoods programmers believe about time; “wisdom of the crowd” edition

A couple of days ago I decided to write down some of the things I've learned about testing over
the course of the last several years. In the course of enumerating the areas that benefit most
from testing, I realized that I had accumulated a lot of specific thoughts about how we as
programmers tend to abuse the concept of time.

So I wrote another post called “falsehoods programmers believe about time,” where I included 34
misconceptions and mistakes having to do with both calendar and system time. Most of these were
drawn from my immediate experience with code that needed to be debugged (both in production and
in test).


All of these falsehoods were suggested by people who commented on the original post. Each
contributor is credited below.

    The offsets between two time zones will remain constant.

    OK, historical oddities aside, the offsets between two time zones won't change in the future.

    Changes in the offsets between time zones will occur with plenty of advance notice.

    Daylight saving time happens at the same time every year.

    Daylight saving time happens at the same time in every time zone.

    Daylight saving time always adjusts by an hour.

    Months have either 28, 29, 30, or 31 days.

    The day of the month always advances contiguously from N to either N+1 or 1, with no

    There is only one calendar system in use at one time.

    There is a leap year every year divisible by 4.

    Non leap years will never contain a leap day.
    閏年でない年は決して閏日(leap day)を含まない

    It will be easy to calculate the duration of x number of hours and minutes from a
    particular point in time.

    The same month has the same number of days in it everywhere!

    Unix time is completely ignorant about anything except seconds.

    Unix time is the number of seconds since Jan 1st 1970.

    The day before Saturday is always Friday.

    Contiguous timezones are no more than an hour apart. (aka we don’t need to test what
    happens to the avionics when you fly over the International Date Line)

    Two timezones that differ will differ by an integer number of half hours.

    Okay, quarter hours.

    Okay, seconds, but it will be a consistent difference if we ignore DST.

    If you create two date objects right beside each other, they'll represent the same time.
    (a fantastic Heisenbug generator)

    You can wait for the clock to reach exactly HH:MM:SS by sampling once a second.

    If a process runs for n seconds and then terminates, approximately n seconds will have
    elapsed on the system clock at the time of termination.

    Weeks start on Monday.

    Days begin in the morning.

    Holidays span an integer number of whole days.

    The weekend consists of Saturday and Sunday.

    It's possible to establish a total ordering on timestamps that is useful outside your system.

    The local time offset (from UTC) will not change during office hours.
    UTC からの local time offset は office hours の間は変わらない

    Thread.sleep(1000) sleeps for 1000 milliseconds.

    Thread.sleep(1000) sleeps for >= 1000 milliseconds.

    There are 60 seconds in every minute.

    Timestamps always advance monotonically.

    GMT and UTC are the same timezone.
    GMT と UTC は同一のタイムゾーンである

    Britain uses GMT.

    Time always goes forwards.

    The difference between the current time and one week from the current time is always 7 * 86400 seconds.

    The difference between two timestamps is an accurate measure of the time that elapsed between them.

    24:12:34 is a invalid time
    24:12:34 は不正な時刻である

    Every integer is a theoretical possible year

    If you display a datetime, the displayed time has the same second part as the stored time

    Or the same year

    But at least the numerical difference between the displayed and stored year will be less than 2

    If you have a date in a correct YYYY-MM-DD format, the year consists of four characters

    If you merge two dates, by taking the month from the first and the day/year from the second, you get a valid date

    But it will work, if both years are leap years

    If you take a w3c published algorithm for adding durations to dates, it will work in all cases.

    The standard library supports negative years and years above 10000.

    Time zones always differ by a whole hour

    If you convert a timestamp with millisecond precision to a date time with second precision, you can safely ignore the millisecond fractions

    But you can ignore the millisecond fraction, if it is less than 0.5

    Two-digit years should be somewhere in the range 1900-2099

    If you parse a date time, you can read the numbers character for character, without needing to backtrack

    But if you print a date time, you can write the numbers character for character, without
    needing to backtrack

    You will never have to parse a format like ---12Z or P12Y34M56DT78H90M12.345S
    12Z や P12Y34M56DT78H90M12.345S といった書式のものを解析しなければならない事態にはならないだろう

    There are only 24 time zones

    Time zones are always whole hours away from UTC

    Daylight Saving Time (DST) starts/ends on the same date everywhere

    DST is always an advancement by 1 hour

    Reading the client's clock and comparing to UTC is a good way to determine their timezone

    The software stack will/won't try to automatically adjust for timezone/DST

    My software is only used internally/locally, so I don't have to worry about timezones

    My software stack will handle it without me needing to do anything special

    I can easily maintain a timezone list myself

    All measurements of time on a given clock will occur within the same frame of reference.

    The fact that a date-based function works now means it will work on any date.

    Years have 365 or 366 days.

    Each calendar date is followed by the next in sequence, without skipping.

    A given date and/or time unambiguously identifies a unique moment.

    Leap years occur every 4 years.

    You can determine the time zone from the state/province.

    You can determine the time zone from the city/town.

    Time passes at the same speed on top of a mountain and at the bottom of a valley.

    One hour is as long as the next in all time systems.

    You can calculate when leap seconds will be added.

    The precision of the data type returned by a getCurrentTime() function is the same as the precision of that function.

    Two subsequent calls to a getCurrentTime() function will return distinct results.

    The second of two subsequent calls to a getCurrentTime() function will return a larger result.

    The software will never run on a space ship that is orbiting a black hole.





歴史群像。 信長の独断フルスロットルの最後の一文がいいなあ。

歴史群像 2012年 10月号 [雑誌]
歴史群像 2012年 10月号 [雑誌]



■_ sprintf

C99を使ったオープンソース開発 に、 セキュリティ・ホールの多くは sprintf でのバッファー・オーバーランが元になっていますが、この機能で防ぐ事ができるのです。 ってのがあったんですが「sprintfでのバッファーオーバーラン」というのにちと引っかかるものが。 いや、バッファーオーバーランがというのはそうだろうなとは思うのですが、 sprintf でのというところに。 実際のところはどうなんでしょうか


■_ YAPC::Asia

YAPC::Asia 2012 に参加される全ての皆さんへ、タイムスケジュールと注意事項 | Things You Should Know Before Coming To The Venue | YAPC::Asia Tokyo 2012 毎年、当日券を発売していましたが今年は物品の販売などを一切行いません。







なんか直近でこんな本がでるらしく(んーむこれまで出版予定に見つけられなかったんだがががが) Amazon.co.jp: Developer's Code 本物のプログラマがしていること: Ka Wai Cheung, 新丈径: 本 調べてみるとこれの翻訳らしい Amazon.com: The Developer's Code (9781934356791): Ka Wai Cheung: Books …持ってるじゃんこれ ○| ̄|_ 例によって読み切っていない。しかし原著がPublication Date: February 14, 2012 なのにもうでますか。

L'eclat des jours(2012-09-05) L'eclat des jours(2012-09-05) Developer's Code 本物のプログラマがしていること(Ka Wai Cheung/新丈径) - capsctrldays(2012-09-05)

FSIJ 月例会 テーマ: 自由ソフトウェアの「これまで・いま・これから」 15日かー



チューリング生誕百周年記念Tシャツを作りました! | シュプリンガー・ジャパン プレゼント応募方法は、当社 twitter @springerjapan をご覧ください。





東京都、自転車へのナンバープレート装着義務化を検討 | スラッシュドット・ジャパン


あとでよむ 泳ぐやる夫シアター AAで学ぶ南北戦争への道 第11回 米英再戦



モーレツ宇宙海賊(パイレーツ) 7(初回限定盤)(Blu-ray Disc)
モーレツ宇宙海賊(パイレーツ) 7(初回限定盤)(Blu-ray Disc)

あの夏で待ってる 6 (初回限定版) [Blu-ray]
あの夏で待ってる 6 (初回限定版) [Blu-ray]

アレとかアレのBOXがあるので今走ってるものも これからのものもない…か?



covariant の説明はこの辺りからどぞ 共変性と反変性 - Wikipedia

Functr: Java Oddities (Part I)

Thursday, August 30, 2012
Java Oddities (Part I)
Posted by Raoul-Gabriel Urma

There's a famous lightening talk given by Gary Bernhardt about Javascript and Ruby oddities.

I would like to start a series of blog posts documenting some oddities in the Java language for
fun! I'll explain why or where these oddities come from with reference to the Java Language
Specification when possible. I hope you learn some new things. Feel free to email or tweet me
if you would like to add to the list.

Array Declarations

Java programmers can declare array variables in several ways:

  int[] a;
  int b[]; // allowed to make C/C++ people happy

However, the grammar doesn't enforce a particular style for arrays of dimensions greater than
one. The [] may appear as part of the type, or as part of the declarator for a particular
variable, or both. The following declarations are therefore valid:

しかし Java の文法では二次元以上の配列を一つの形式に強制していません。
[] は型の一部に置くこともできるし、変数の宣言の一部とすることもできるし

  int[][] c;
  int d[][];
  int[] e[]; // :(
  int[][] f[]; // :(

This mixed annotations is obviously not recommended by the Java Language Specification 
(Array Variables) as it can lead to confusions and is reported by code convention tools such
as checkstyle.

この混合記法は混乱を招きやすく、Java Language Specification によっても
推奨されるものでないことは明らかです。また、chckstyle のような
code convertion toos によって問題ありと指摘されます。

This can be taken to the extreme. The following method signature in a class or interface
declaration will be accepted by the standard Javac parser:

standard Javac parser が受理します

  public abstract int[] foo(int[] arg)[][][][][][][][][][][];

The return type of the method foo is int[][][][][][][][][][][][].

このメソッド foo の戻り値の型は int[][][][][][][][][][][][] です。

In fact, the grammar of ClassBodyDeclaration is defined as follows:
実際には ClassBodyDeclaration の構文は以下のように定義されています:

  ClassBodyDeclaration = 
     .. | TypeParameters (Type | VOID) Ident MethodDeclaratorRest | ..

  MethodDeclaratorRest = 
      FormalParameters BracketsOpt [Throws TypeList] ( MethodBody | [DEFAULT AnnotationValue] ";")

  BracketsOpt = {"[" "]"}

The BracketsOpt rule allows a sequence of [] to be inserted after the formal parameters definition.

この BracketsOpt ルールは[]の並びを formal parameters definition の後ろに置くことを

The relevant lines within com.sun.tools.javac.parser.JavacParser start at 2938.

Array Covariance

Java arrays are covariant. This means that given a type S which is a subtype of a type T then S[]
is considered a subtype of T[]. This property is described in the Java Language Specification
(Subtyping among Array Types). This property is known to lead to ArrayStore exceptions as
documented in the Java Language Specification: (Array Store Exception). For example:

Java の配列は covariant (共変) です。

  Object[] o = new String[4];
  o[0] = new Object(); // compiles but a runtime exception will be reported
                       // コンパイルは通りますが実行時に例外が報告されます

Arrays were made covariant because before the introduction of generics it allowed library
designers to write generic code (without type safety). For example, one could write a method
findItems as follows:

配列は常に covariant にされます。それはジェネリクスが導入される以前に
そうすることで library designers が generic なコードを

  public boolean findItems(Object[] array, Object item)

This method will accept arguments such as (String[], String) or (Integer[], Integer) and in a
sense reduces code duplication since you don't need to write several methods specific to the
types of the arguments. However, there is no contract between the element type of the array that
is passed and the type of the item that needs to be found.

このメソッドは (String[], String) や (Integer[], Integer) のような引数を受理しますし
しかし、要素の型と配列の型との間には contract がありません

Nowadays one can use generic methods (making use of a type parameter) to achieve the same
mechanism with additional type safety:

  public <T> boolean findItems(T[] array, T item)

Integer Caching

  int a = 1000, b = 1000;  
  System.out.println(a == b); // true
  Integer c = 1000, d = 1000;  
  System.out.println(c == d); // false
  Integer e = 100, f = 100;  
  System.out.println(e == f); // true

This behaviour is documented in the Java Language Specification (Boxing Conversion):
この振る舞いは Java Language Specification (Boxing Conversion) に記載されています:

    If the value p being boxed is true, false, a byte, or a char in the range \u0000 to \u007f,
    or an int or short number between -128 and 127 (inclusive), then let r1 and r2 be the
    results of any two boxing conversions of p. It is always the case that r1 == r2.

For those curious, you can look up the implementation of Integer.valueOf(int), which confirms
the specification:

  public static Integer valueOf(int i) {
      assert IntegerCache.high >= 127;
      if (i >= IntegerCache.low && i <= IntegerCache.high)
          return IntegerCache.cache[i + (-IntegerCache.low)];
      return new Integer(i);


その2 Functr: Java Oddities (Part II)

■_ 日経コンピュータ

株の誤発注を生んだソースコードが公開:日経コンピュータ8/30号: 組み込み技術者の単身赴任日記 東証-みずほ誤発注裁判、高裁でバグ混入の経緯判明 ほか:日経コンピュータDigital 日経コンピュータ

ということで日経コンピュータ買ってみましたが… ホントにソースコードほんのちょっとなのね。



推薦図書/必読書のためのスレッド 69

38 デフォルトの名無しさん [] 2012/09/04(火) 11:55:11.99 ID: Be:

39 デフォルトの名無しさん [sage] 2012/09/04(火) 17:15:35.57 ID: Be:

40 デフォルトの名無しさん [sage] 2012/09/04(火) 20:14:08.45 ID: Be:

41 デフォルトの名無しさん [sage] 2012/09/04(火) 21:17:16.56 ID: Be:

42 デフォルトの名無しさん [sage] 2012/09/04(火) 21:27:29.61 ID: Be:

43 デフォルトの名無しさん [sage] 2012/09/04(火) 22:00:58.13 ID: Be:




PC で使っているtwitterクライアントが(ある程度の期間(容量?)でローテートするけど) sqlite3 のデータベースに自分が受け取ったツイート情報をかなり詳しく残すので、 それを使ってちょっと調べてみた。 やー楽しいw できれば何週間分か24時間丸ごとデータを集めてそれを調べてみたいんだけど、 さすがにPC立ち上げっぱなし繋ぎっぱなしにはできないよなあ。



I をまだちゃんと読んでいないうちに次が(配列の型が云々てのは読んだ) Functr: Java Oddities (Part II)

I はこっち (IIにリンクあるけど) Functr: Java Oddities (Part I)

■_ 12の

Bill the Lizard: 12 (Really) Controversial Programming Opinions

Bill the Lizard: 12 (Really) Controversial Programming Opinions

9. C (or C++) should be the first programming language (+24/-5) by hansen j

The first language should NOT be the easy one, it should be one that sets up the student's mind
and prepare it for serious computer science.

C is perfect for that, it forces students to think about memory and all the low level stuff, and
at the same time they can learn how to structure their code (it has functions!)

C++ has the added advantage that it really sucks :) thus the students will understand why people
had to come up with Java and C#.


Bill the Lizard: 12 (Really) Controversial Programming Opinions

12. Singletons are not evil (+42/-7) by Steve

There is a place for singletons in the real world, and methods to get around them (i.e.
monostate pattern) are simply singletons in disguise. For instance, a Logger is a perfect
candidate for a singleton. Additionally, so is a message pump. My current app uses distributed
computing, and different objects need to be able to send appropriate messages. There should
only be one message pump, and everyone should be able to access it. The alternative is passing
an object to my message pump everywhere it might be needed and hoping that a new developer
doesn't new one up without thinking and wonder why his messages are going nowhere. The
uniqueness of the singleton is the most important part, not its availability. The singleton has
its place in the world.



参加したかったなー 函数プログラミングの集い2012 函数プログラミングの集い2012その1 #fpm2012 - Togetter んで日曜にもこういうものが Proof Summit 2012 - [PARTAKE]

TAPL 翻訳版
なんかさかいさんも関わっているとか。 ひょっとして Alloy 本と同じメンバー?

■_ Beauty is in The Eye of the Beholder

Beauty is in The Eye of the Beholder

この言い回し、見覚えがあるが思い出せない。 でぐぐって答一発 Beauty is in the eye of the beholderの意味 - 英和辞典 Weblio辞書

しかしだな、「ビホルダー」というとどうしても 「鈴木土下座衛門」が… 鈴木土下座衛門 (すずきどげざえもん)とは【ピクシブ百科事典】 バスタードQ&A


■_ 50周年

50th Anniversary of LISP 1.5 Programmer’s Manual | Dusty Decks

■_ JavaScript


■_ ハム研



1 名無しさん@お腹いっぱい。 [] 2007/04/14(土) 22:09:59 ID: Be:

2 名無しさん@お腹いっぱい。 [sage] 2007/04/14(土) 23:26:53 ID: Be:

3 名無しさん@お腹いっぱい。 [] 2007/04/14(土) 23:59:55 ID: Be:

4 名無しさん@お腹いっぱい。 [] 2007/04/15(日) 14:43:47 ID: Be:

5 名無しさん@お腹いっぱい。 [] 2007/04/17(火) 20:20:20 ID: Be:


6 名無しさん@お腹いっぱい。 [sage] 2007/04/18(水) 15:55:56 ID: Be:

7 Hiroya [] 2007/04/18(水) 23:30:57 ID: Be:

8 名無しさん@お腹いっぱい。 [sage] 2007/04/19(木) 00:34:11 ID: Be:

162 □□□□(ネーム無し) [sage] 2011/10/10(月) 00:11:49.08 ID: Be:

163 □□□□(ネーム無し) [] 2011/10/10(月) 19:32:55.07 ID: Be:

164 □□□□(ネーム無し) [sage] 2011/10/25(火) 23:50:39.47 ID: Be:

165 □□□□(ネーム無し) [sage] 2011/10/30(日) 22:41:02.67 ID: Be:

166 □□□□(ネーム無し) [] 2011/11/16(水) 15:33:31.88 ID: Be:

167 □□□□(ネーム無し) [sage] 2011/11/17(木) 04:53:20.70 ID: Be:


168 □□□□(ネーム無し) [sage] 2011/12/27(火) 22:44:17.64 ID: Be:

172 □□□□(ネーム無し) [] 2012/05/18(金) 13:16:06.23 ID: Be:

173 □□□□(ネーム無し) [] 2012/05/18(金) 14:41:15.82 ID: Be:

174 □□□□(ネーム無し) [] 2012/07/28(土) 20:25:06.45 ID: Be:

■_ 今日の重箱の隅

大絶賛されているもので見つけてしまうと以下略 (まーべた褒めしているのも極一部な気がしますが)。

Tip26 企業の解剖学




ATM が出力する帳票を見て銀行にいくらの資金が預けられているかをチェックするが、
会社の健全度を示す2つの重要な文書を作る。貸借対照表 (PL) は、ある時点における
会社の財産、債務のスナップショットであり、キャッシュフロー計算書 (CS) は資金の
しかし、PL や CS (そして BS: 損益計算書)の数値は、会社がどこにいるかについてフィルターの


「人事」は原文では Human Resources なので、HR という略語もごく自然なんですが The first person you talked to at your company was probably in human resources (HR). まんま「人事」と置き換えてしまって おそらく人事(HR)の人だろう とか書かれてもなんのこっちゃとなるような。

んで、問題は財務の方。 貸借対照表は Balance Sheet で B/S ですし、 P/L と略されるのは損益計算書です。 日本語では「損益計算書」で一貫しており、P/L と略称されることがある。 (損益計算書 - Wikipedia) 貸借対照表(たいしゃくたいしょうひょう)とは、財務諸表の一つ。バランスシート(Balance sheet、略称B/S)とも呼ばれる。 (貸借対照表 - Wikipedia) 原文ではどうなっているかというと

Second, business don't treat money like you treat your checking account. You can
look at a receipt from the ATM machine and know how much money you have in the bank.
A business, on the other hand, breathes money like a living being - there is constantly
money flowing in and out. The accounting folks generate two key documents that show
the health of the company: the profit and loss statment that is a snapshot in time
of the company's money, and a cash-flow stateent that shows more of the dynamic
flow of money.
I'll be frank; I don't look at these documents often. It takes education to make heads
or rails of them, and if you want to know the product is selling, it's a lot easier
to ask a product manager. The numnbers, however, give you a raw, unfilterd perspective
on where the company stands, and it's good to see them at least once.

the profit and loss statment that is a snapshot in time of the company's money 「snapshot」に引きずられて「貸借対照表」だろうと判断しちゃったんですかねえ。 でも原文にもない B/S を持ってきて(財務諸表には含まれるので文脈として持ち出すのは 間違っていないと思いますが)、BS: 損益計算書 と書いちゃうのは どうしたもんでしょうか。

あと、「当座預金」 cheking account の訳にこれを当てるのは間違ってないと思いますが、 そもそも「当座預金」ってものを知っている人はこの本の想定読者には 多くない気がするし、日本では「個人」で当座預金を持つのはレアケースな気がします。 そういった意味で、欄外でちょっと説明加えるくらいはした方が良いんじゃないかと思います。 checking accountの意味 - 英和辞典 Weblio辞書 当座預金口座と普通預金口座の違いを解りやすく説明するとどうなりますか? 当座は... - Yahoo!知恵袋 「普通預金」と「当座預金」個人でも当座預金できますか?その使い方は? - 貯蓄 - 教えて!goo

あ、そうそう。原文の 「ATM machine」 ってなんたらシンドロームすね :)

英語での、P/L、B/S それぞれの説明。

Profit and Loss Statements

What is a profit and loss statement?

The profit and loss statement is a summary of the financial performance of a business over time
(monthly, quarterly or annually is most common). It reflects the past performance of the business
and is the report most often used by small business owners to track how their business is

As the name indicates the profit and loss statement (also known as a statement of financial
performance or an income statement) measures the profit or loss of a business over a specified
period. A profit and loss statement summarises the income for a period and subtracts the expenses
incurred for the same period to calculate the profit or loss for the business.
Balance Sheets

What is a balance sheet?

The balance sheet provides a good picture of the financial health of a business and is a tool
used to evaluate a business's liquidity. It helps a small business owner identify trends and
quickly grasp the financial strength and capabilities of their business.

The balance sheet is the financial statement used to report on the financial position of the
business to the owner and other stakeholders such as banks and investors.

The balance sheet is a statement of what a business owns (assets) and owes (liabilities), and the
value of the owner's equity (or net worth of the business) at a specific point in time. The
balance sheet is also known as a statement of financial position because it shows a summary of
the business’s financial position at a particular point in time.

The difference between the assets and liabilities is known as owner’s equity. The balance sheet
is so named because the equity must equal assets minus liabilities.

適当に開いたページを読んでて見つけたので、 きちんと読めばほかにもこの種の間違いがあるかもしれませんしないかもしれません。




行けなかったので以下略 函数プログラミングの集い 2012 in Tokyo - [PARTAKE]

読んだ。 泳ぐやる夫シアター AAで学ぶ南北戦争への道 第9回 改革と革命



TMT の「あとでチェック」に残ってたリンクなんだけど削除されたっぽい。 はて、なにがあったんだろか。 Twitter / ?


言及している「さっきのスライド」というのはこれ(のはず)→ オブジェクト指向できていますか?

MISRA-C の規約(基準)にも興味があるんだけど、 少なくとも日本語で読めるものは有料っぽいものしかないようなんですよね。 例の、F-35関連のソフトウェアをC++で~のときに このMISRA-Cへの言及がちょこっとでてきたので調べてみたんだけど。

■_ たぶれっと

どれか試しに買ってみたいのだけどどれがいいのやら。 [ハード][Android] nexus7を買ってみた 購入はAmazonのマーケットプレイスで、Crowd onlineという店舗が並行輸入しているようです。 というので見てみると、おお、確かに。 Amazon.co.jp: nexus7

■_ The Best Programming Advice I Ever Got

たぶんこれが一覧 → Experts in Programming Share Their Knowledge with "The Best Programming Advice I Ever Got" Series | InformIT


本の虫: glibcがBusyBoxのsedで動かない理由

本の虫: glibcがBusyBoxのsedで動かない理由


    [BusyBox] Busybox "expr" is broken.


    expr "UNKNOWN" \< 5

    'perl -V:apiversion'はUNKNOWNを返し、それがperlが古すぎないかどうかの確認に使われている。

GNU (の expr) は 5を返す。とあるけれども、 なんか違和感のある仕様だし opengroup あたりの記述をみても どうもそんな動きをするようには書いてないようだよなあと思いつつ (とはいえ「文字列」と「数値」の比較はなかなかに地雷っぽい気配) 原文を見ると

[BusyBox] Busybox "expr" is broken.

So I'm bashing away on ./configure with busybox in the path, trying to see 
what else is broken.  Currently bashing my way through the glibc build, and I 
found a problem with expr.  The following works differently with busybox expr 
and gnu expr:

expr "UNKNOWN" \< 5

Gnu returns 0, busybox returns 1.  This is what's causing perl not to be 
detected.  (`perl -V:apiversion` is returning UNKNOWN, which gets passed to a 
production like the above to see if perl is too old to be usable, and we say 
"yes, UNKNOWN is less than 5!" which causes the ./configure script to disable 

For once, it's not a sed problem! :)



[BusyBox] Busybox "expr" is broken.


On Sun, Jan 25, 2004 at 12:52:31PM -0600, Rob Landley wrote:
> So I'm bashing away on ./configure with busybox in the path, trying to see 
> what else is broken.  Currently bashing my way through the glibc build, and I 
> found a problem with expr.  The following works differently with busybox expr 
> and gnu expr:
> expr "UNKNOWN" \< 5
> Gnu returns 0, busybox returns 1.  This is what's causing perl not to be 
> detected.  (`perl -V:apiversion` is returning UNKNOWN, which gets passed to a 
> production like the above to see if perl is too old to be usable, and we say 
> "yes, UNKNOWN is less than 5!" which causes the ./configure script to disable 
> perl.)
> For once, it's not a sed problem! :)

I just checked in a fix.  expr was coercing any non-empty string to an
integer using atoi().  So "UNKNOWN" was being converted to 0 and an
integer comparison was being done, instead of a string compare.


また atoi() か!

でも string compare つーことは perl 10 なんか出た日には…


一つ前へ 2012年8月(下旬)
一つ後へ 2012年9月(中旬)



メールの宛先はこちらkbk AT kt DOT rim DOT or DOT jp