Movatterモバイル変換


[0]ホーム

URL:


はてラボはてな匿名ダイアリー
ようこそ ゲスト さんログインユーザー登録

「head」を含む日記RSS

はてなキーワード:headとは

2009-04-07

終端と先頭と末尾の対義語は何?

終端に対して「始端」という言葉が、一応あるようだ。ググってみたらあった。確かに聞いたことのある言葉ではあるが、終端ほどには使わない気がする。

先頭の対義語はなんだろう?頭(head)の反対が尾(tail)というわけで、末尾が妥当か?

何か違った見解があれば、教えて欲しい。

Permalink |記事への反応(1) | 12:31

このエントリーをはてなブックマークに追加ツイートシェア

2009-03-18

公明党都議選重視?

コピーして、test.htaのような拡張子HTAで保存

HTAプログラム

 ↓

<html&gt;

<head&gt;

<style type="text/css"&gt;dt{float:left;clear:left;width:10em;}</style&gt;

<meta content="charset=Shift_JIS"/&gt;

</head&gt;

<body&gt;

<script type="text/javascript"&gt;</p&gt; <p&gt;window.onload = init;</p&gt; <p&gt;varurl = [</p&gt; <p&gt; "<ahref="http://www.senkyo.metro.tokyo.jp/h19sangiin/san_kekka/h19san_hkai.html"&gt;http://www.senkyo.metro.tokyo.jp/h19sangiin/san_kekka/h19san_hkai.html</a&gt;",</p&gt; <p&gt; "<ahref="http://www.senkyo.metro.tokyo.jp/h17shugiin/sokuhou/7kaijyo_s.htm"&gt;http://www.senkyo.metro.tokyo.jp/h17shugiin/sokuhou/7kaijyo_s.htm</a&gt;",</p&gt; <p&gt; "<ahref="http://www.senkyo.metro.tokyo.jp/h17togisen/sokuhou/2kaijyo_s.htm"&gt;http://www.senkyo.metro.tokyo.jp/h17togisen/sokuhou/2kaijyo_s.htm</a&gt;",</p&gt; <p&gt; "<ahref="http://www.senkyo.metro.tokyo.jp/data/h16san_hkai.html"&gt;http://www.senkyo.metro.tokyo.jp/data/h16san_hkai.html</a&gt;",</p&gt; <p&gt; "<ahref="http://www.senkyo.metro.tokyo.jp/data/h15shu_hkai.html"&gt;http://www.senkyo.metro.tokyo.jp/data/h15shu_hkai.html</a&gt;",</p&gt; <p&gt; "<ahref="http://www.senkyo.metro.tokyo.jp/data/data01_01_03.html"&gt;http://www.senkyo.metro.tokyo.jp/data/data01_01_03.html</a&gt;",</p&gt; <p&gt; "<ahref="http://www.senkyo.metro.tokyo.jp/data/data01_02_05.html"&gt;http://www.senkyo.metro.tokyo.jp/data/data01_02_05.html</a&gt;",</p&gt; <p&gt; "<ahref="http://www.senkyo.metro.tokyo.jp/data/data03_04.html"&gt;http://www.senkyo.metro.tokyo.jp/data/data03_04.html</a&gt;",</p&gt; <p&gt; "<ahref="http://www.senkyo.metro.tokyo.jp/data/data01_05_05.html"&gt;http://www.senkyo.metro.tokyo.jp/data/data01_05_05.html</a&gt;"</p&gt; <p&gt;];</p&gt; <p&gt;varbase = "<ahref="http://www.senkyo.metro.tokyo.jp/data/tokuhyo_23ku/"&gt;http://www.senkyo.metro.tokyo.jp/data/tokuhyo_23ku/</a&gt;";</p&gt; <p&gt;var file = ["chiyoda","chuou","minato","shinjyuku","bunkyo",</p&gt; <p&gt; "taitho","sumida","koutho","sinagawa","meguro",</p&gt; <p&gt; "ohta","setagaya","shibuya","nakaono","suginami",</p&gt; <p&gt; "toshima","kita","arakawa","itabashi","nerima",</p&gt; <p&gt; "adachi","katushika","edogawa"];</p&gt; <p&gt;for(var i=0; i<23; i++){</p&gt; <p&gt;url.push(base + file[i] + "\.html");</p&gt; <p&gt;}</p&gt; <p&gt;varid = [</p&gt; <p&gt; "2007参院比", "2005衆院比", "2005都議会", "2004参院比", "2003衆院比",</p&gt; <p&gt; "2001参院比", "2001都議会", "2000衆院比", "1998参院比", "1997都議会"</p&gt; <p&gt;];</p&gt; <p&gt;var ku = [</p&gt; <p&gt; "千代田","中央","港","新宿","文京",</p&gt; <p&gt; "台東","墨田","江東","品川","目黒",</p&gt; <p&gt; "大田","世田谷","渋谷","中野","杉並",</p&gt; <p&gt; "豊島","北","荒川","板橋","練馬",</p&gt; <p&gt; "足立","葛飾","江戸川"</p&gt; <p&gt;];</p&gt; <p&gt;var regexku = newRegExp("(" + ku.join("|") + ")区");</p&gt; <p&gt;var iframe = [];</p&gt; <p&gt;var data = {};</p&gt; <p&gt;var parse = [ function(){</p&gt; <p&gt; var d = iframe[0].contentWindow.document;</p&gt; <p&gt; var td = d.getElementsByTagName("td");</p&gt; <p&gt; for(var i=0, l=td.length; i<l; i++){</p&gt; <p&gt; if(regexku.test(td[i].firstChild.nodeValue)){</p&gt; <p&gt; for(var j=0, e=td[i]; j<10; j++){</p&gt; <p&gt; e = e.nextSibling;</p&gt; <p&gt; }</p&gt; <p&gt; data[RegExp.$1 + "0"] = e.firstChild.firstChild.nodeValue.replace(/\.\d+/,"");</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt; show();</p&gt; <p&gt;}, function(){</p&gt; <p&gt; var d = iframe[1].contentWindow.document;</p&gt; <p&gt; var nobr = d.getElementsByTagName("nobr");</p&gt; <p&gt; for(var i=0, l=nobr.length; i<l; i++){</p&gt; <p&gt; if(regexku.test(nobr[i].firstChild.nodeValue)){</p&gt; <p&gt; for(var j=0, e=nobr[i].parentNode; j<4; j++){</p&gt; <p&gt; e = e.nextSibling;</p&gt; <p&gt; }</p&gt; <p&gt; data[RegExp.$1 + "1"] = e.firstChild.nodeValue;</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt; show();</p&gt; <p&gt;}, function(){</p&gt; <p&gt; var d = iframe[2].contentWindow.document;</p&gt; <p&gt; var nobr = d.getElementsByTagName("nobr");</p&gt; <p&gt; for(var i=0, l=nobr.length; i<l; i++){</p&gt; <p&gt; if(regexku.test(nobr[i].firstChild.nodeValue) &amp;&amp; nobr[i].parentNode.tagName == "SPAN"){</p&gt; <p&gt; for(var j=0, e=nobr[i]; j<6; j++){</p&gt; <p&gt; e = e.parentNode;</p&gt; <p&gt; }</p&gt; <p&gt; vare2 = e.nextSibling.nextSibling.firstChild.childNodes[2].firstChild;</p&gt; <p&gt; var k = 0;</p&gt; <p&gt; data[RegExp.$1 + "2"] = 0;</p&gt; <p&gt; while(e2){</p&gt; <p&gt; if(e2.firstChild.firstChild.nodeValue.indexOf("公明党") != -1){</p&gt; <p&gt; data[RegExp.$1 + "2"] += parseInt(e2.parentNode.nextSibling.childNodes[k+2].firstChild.nodeValue.replace(",",""), 10);</p&gt; <p&gt; }</p&gt; <p&gt;e2 =e2.nextSibling;</p&gt; <p&gt; k++;</p&gt; <p&gt; }</p&gt; <p&gt; data[RegExp.$1 + "2"] = int2str(data[RegExp.$1 + "2"]);</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt; show();</p&gt; <p&gt;}, function(){</p&gt; <p&gt; var d = iframe[3].contentWindow.document;</p&gt; <p&gt; var td = d.getElementsByTagName("td");</p&gt; <p&gt; for(var i=0, l=td.length; i<l; i++){</p&gt; <p&gt; if(regexku.test(td[i].firstChild.nodeValue)){</p&gt; <p&gt; for(var j=0, e=td[i]; j<19; j++){</p&gt; <p&gt; e = e.nextSibling;</p&gt; <p&gt; }</p&gt; <p&gt; data[RegExp.$1 + "3"] = e.firstChild.firstChild.nodeValue.replace(/\.\d+/,"");</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt; show();</p&gt; <p&gt;}, function(){</p&gt; <p&gt; var d = iframe[4].contentWindow.document;</p&gt; <p&gt; var td = d.getElementsByTagName("td");</p&gt; <p&gt; var regexku2 = /(大田|世田谷|練馬|足立|江戸川)/;</p&gt; <p&gt; for(var i=0, l=td.length; i<l; i++){</p&gt; <p&gt; if(regexku.test(td[i].firstChild.nodeValue)){</p&gt; <p&gt; data[RegExp.$1 + "4"] = td[i].nextSibling.nextSibling.firstChild.nodeValue.replace(/\.\d+/,"");</p&gt; <p&gt;continue;</p&gt; <p&gt; }</p&gt; <p&gt; if(regexku2.test(td[i].firstChild.nodeValue)){</p&gt; <p&gt; data[RegExp.$1 + "4"] = (data[RegExp.$1 + "4"] || 0) </p&gt; <p&gt; + parseInt(td[i].nextSibling.nextSibling.firstChild.nodeValue.replace(",","").replace(/\.\d+/,""));</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt; for(var j=0; j<5; j++){</p&gt; <p&gt; data[ku[[10,11,19,20,22][j]]+"4"] = int2str(data[ku[[10,11,19,20,22][j]]+"4"]);</p&gt; <p&gt; }</p&gt; <p&gt; show();</p&gt; <p&gt;}, function(){</p&gt; <p&gt; var d = iframe[5].contentWindow.document;</p&gt; <p&gt; var td = d.getElementsByTagName("td");</p&gt; <p&gt; for(var i=0, l=td.length; i<l; i++){</p&gt; <p&gt; if(regexku.test(td[i].firstChild.firstChild.nodeValue)){</p&gt; <p&gt; for(var j=0, e=td[i]; j<10; j++){</p&gt; <p&gt; e = e.nextSibling;</p&gt; <p&gt; }</p&gt; <p&gt; data[RegExp.$1 + "5"] = e.firstChild.firstChild.nodeValue.replace(/\.\d+/,"");</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt; show();</p&gt; <p&gt;}, function(){</p&gt; <p&gt; var d = iframe[6].contentWindow.document;</p&gt; <p&gt; var td = d.getElementsByTagName("td");</p&gt; <p&gt; for(var i=0, l=td.length; i<l; i++){</p&gt; <p&gt; if(regexku.test(td[i].firstChild.firstChild.nodeValue)){</p&gt; <p&gt; for(var j=0, e=td[i]; j<7; j++){</p&gt; <p&gt; e = e.nextSibling;</p&gt; <p&gt; }</p&gt; <p&gt; data[RegExp.$1 + "6"] = e.firstChild.firstChild.nodeValue.replace(/\.\d+/,"").replace("-","0");</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt; show();</p&gt; <p&gt;}, function(){</p&gt; <p&gt; var d = iframe[7].contentWindow.document;</p&gt; <p&gt; var td = d.getElementsByTagName("td");</p&gt; <p&gt; for(var i=0, l=td.length; i<l; i++){</p&gt; <p&gt; if(regexku.test(td[i].firstChild.firstChild.nodeValue)){</p&gt; <p&gt; for(var j=0, e=td[i]; j<9; j++){</p&gt; <p&gt; e = e.nextSibling;</p&gt; <p&gt; }</p&gt; <p&gt; data[RegExp.$1 + "7"] = e.firstChild.firstChild.nodeValue;</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt; show();</p&gt; <p&gt;}, function(){</p&gt; <p&gt; var d = iframe[8].contentWindow.document;</p&gt; <p&gt; var td = d.getElementsByTagName("td");</p&gt; <p&gt; for(var i=0, l=td.length; i<l; i++){</p&gt; <p&gt; if(regexku.test(td[i].firstChild.firstChild.nodeValue)){</p&gt; <p&gt; data[RegExp.$1 + "8"] = int2str(td[i].nextSibling.firstChild.firstChild.firstChild.nodeValue);</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt; show();</p&gt; <p&gt;}, function(n){ return function(){</p&gt; <p&gt; var d = iframe[n+9].contentWindow.document;</p&gt; <p&gt; var td = d.getElementsByTagName("td");</p&gt; <p&gt; data[ku[n]+"9"] = 0;</p&gt; <p&gt; for(var i=0, l=td.length; i<l; i++){</p&gt; <p&gt; if((((td[i].firstChild || 0).firstChild || 0).nodeValue || "").indexOf("公明") == 0){</p&gt; <p&gt; data[ku[n]+"9"] += parseInt(td[i].parentNode.lastChild.firstChild.firstChild.nodeValue.replace(",",""));</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt; data[ku[n]+"9"] = int2str(data[ku[n]+"9"]);</p&gt; <p&gt; show();</p&gt; <p&gt;}}];</p&gt; <p&gt;function init(){</p&gt; <p&gt; for(var i=0; i<23; i++){</p&gt; <p&gt; vardl = document.createElement("dl");</p&gt; <p&gt;dl.appendChild(document.createTextNode("\n【" + ku[i] + "区における公明票】\n"));</p&gt; <p&gt; for(var j=0; j<10; j++){</p&gt; <p&gt; vardt = document.createElement("dt");</p&gt; <p&gt; vardd = document.createElement("dd");</p&gt; <p&gt;dt.innerText =id[j];</p&gt; <p&gt;dl.appendChild(dt);</p&gt; <p&gt;dl.appendChild(dd);</p&gt; <p&gt; }</p&gt; <p&gt; document.body.firstChild.appendChild(dl);</p&gt; <p&gt; }</p&gt; <p&gt; for(var i=0; i<32; i++){</p&gt; <p&gt; var e = document.createElement("iframe");</p&gt; <p&gt; iframe[i] = e;</p&gt; <p&gt; e.style.display = "none";</p&gt; <p&gt; if(i<9) var f = parse[i];</p&gt; <p&gt; else var f = parse[9](i-9);</p&gt; <p&gt; e.attachEvent("onload", f);</p&gt; <p&gt; e.src =url[i];</p&gt; <p&gt; document.body.appendChild(e);</p&gt; <p&gt; }</p&gt; <p&gt;}</p&gt; <p&gt;function show(){</p&gt; <p&gt; for(var i=0; i<23; i++){</p&gt; <p&gt; vardl = document.body.firstChild.childNodes[i];</p&gt; <p&gt; for(var j=0; j<10; j++){</p&gt; <p&gt; vardt =dl.childNodes[j*2+1];</p&gt; <p&gt;dt.innerText =id[j] + " " + (data[ku[i]+j] || "");</p&gt; <p&gt;dt.nextSibling.innerText =bar(data[ku[i]+j], j);</p&gt; <p&gt; }</p&gt; <p&gt; }</p&gt; <p&gt;}</p&gt; <p&gt;function int2str(num){</p&gt; <p&gt; return newString(num).split("").reverse().join("").replace(/(\d{3})/g,"$1,").split("").reverse().join("");</p&gt; <p&gt;}</p&gt; <p&gt;functionbar(str,flag){</p&gt; <p&gt;str =str || "";</p&gt; <p&gt; if(str == "" ||str.length < 5) return "";</p&gt; <p&gt; var num = parseInt(str.match(/\d+/)) + 1;</p&gt; <p&gt; var arrow = (flag == 2 ||flag == 6 ||flag == 9) ? " ←" : "";</p&gt; <p&gt; var _bar = new Array(num).join("|") + arrow;</p&gt; <p&gt; return _bar;</p&gt; <p&gt;}</p&gt; <p&gt;</script&gt;

</body&gt;

</html&gt;

Permalink |記事への反応(4) | 11:24

このエントリーをはてなブックマークに追加ツイートシェア

2009-02-06

Re:サーバRSSリーダーUAで弾く理由

なんでブクマトラバで誰も304 Not Modifiedについて触れていないんだ。

昔のバカなRSSアグリゲーターだとライブラリを使わずに自分HTTP取得処理を書いて304に対応していないので、毎回サーバーに負荷をかけていたというトホホな話があったけど。

まともなアグリゲーターならHEADリクエストで304に対応してるから負荷なんてかかんないよ。

そりゃ仮に1秒間に数百回もアクセスすりゃDoSになるけど、30秒に1回ぐらいだったら屁でもないよ。

ちなみにまなめの使ってるcococいそろぐ(仮):cococ v1.03のとおり304に対応してる。

Permalink |記事への反応(0) | 22:14

このエントリーをはてなブックマークに追加ツイートシェア

2008-12-25

うう、おもしろすぎるぜ日経メディカルオンライン

コンサートでの激しい首振り、何度を超えると危険

http://medical.nikkeibp.co.jp/leaf/mem/pub/hotnews/bmj/200812/508975.html

元ネタは「Head and neck injury risks in heavy metal:head bangers stuck betweenrockand a hardbass

http://www.bmj.com/cgi/content/full/337/dec17_2/a2825

直接観察ってやっぱりステージ際から客席をじーっと見たりしたんだろうか。

いや、角度を測ってるから撮影かもしれないな。

熱狂するステージと観客、あくまで冷静な計測班。

「休暇中に健康を損なわぬためには、音楽にも大人の選択を。」

Permalink |記事への反応(0) | 16:21

このエントリーをはてなブックマークに追加ツイートシェア

2008-12-08

Fucking Hostileの和訳 メモ

1, 2, 3, 4!

Almost every day

ほとんど毎日

I see the same face

同じ顔を

On broken picturetube

壊れたテレビで見るぜ

It fits theattitude

態度にピッタリだな

If you could see yourself

自分自身を見直してみろ

You put you on a shelf

自分のことを棚に上げながら

Yourverbal masturbate

口先だけのオナニー

Promise to nauseate

ゲロみたいな約束なんだ、お前のやってることは

Today I'll play the part of non-parent

今日保護者の役はやれないな

Notmake a hundred rules

100個もルールを作る気にもならない

For you to know about yourself

お前が自分自身についてわかるように

Not lie andmake you believe

嘘なしで信じさせてやる

What's evil is makinglove

セックス

and making friends

友達も

and meetingGod you're own way

神様に祈るのも悪いことさ

The right way

こいつが正しいんだ


(Chorus)

To see

見てみろ

To bleed

血を流してみろ

Cannot be taught

教えられることじゃねえ

In turn

次々に

You're making us

お前が俺を作ってるんだな

Ohhhh Fucking hostile

なんてお前は敵対的なんだ


We stand alone

俺たちは一人ぼっちってことさ


Thetruth in right and wrong

真実は間違ってるけど正しい

The boundaries of the law

法律すれすれのところで

You seem to miss the point

お前はしくじっちゃったみたいだな

Arresting for a joint?

マリファナに気づかれちまったのか?

You seem to wonderwhy

どうしてって聞きたいみたいだな

Hundreds of people die

何百もの人が死んでいって

You're writing tickets man

お前はその切符を書いてる

Mymom got jumped -- they ran!

母親が飛ぶとあいつらは走るから

Now I'll play a public servant

警察と今遊んでるのさ


To serve and protect

奉仕して、守って

By the law and thestate

法と国家によって

I'd bust the punks

パンク野郎をぶったおしてる

That rape steal and murder

盗み、強姦殺人

And leave you be

お前をそんなふうにして

If you crossed me

俺ともう一回会えるなら

I'd shake your hand like a man

人間にみたいに握手をしよう

Not agod

神じゃなくて


(Chorus)


Come meet your maker, boy

お前の親父に会わせろよ

Some things youcan't enjoy

享受できないことだってあるさ

Because ofheaven/hell

天国と地獄のせいさ

A fucking wives' tale

糞みたいな物語

They put it in yourhead

あいつらがお前の頭の中に入れて

Then put you in yourbed

ベッドのそばで子守唄にする

He's watching say your prayers

お前のために祈ってる奴を見ろってあいつは言うなあ

CauseGod is everywhere

神様はどこにでもいるからだってさ

Now I'll play a man learning priesthood

じゃあ俺は聖職者に付き従ってる男の役でもやってみよう

Who's about totake the ultimatetest inlife

誰が人生最大の問いなんてものを投げかけてきても

I'd question things because Iamhuman

俺は人間だから答えてやろう

And call NOONE my fatherwho's nocloser than a stranger

知らない奴より神様に近い奴なんていなんだ

I won't listen

聞きたくもないんだ


To see

見てみろ

To bleed

血を流してみろ

Cannot be taught

教えられることじゃねえ

In turn

次々に

You're making us

お前が俺をつくってるんだな

Fucking, fucking, fucking

糞みたいに

FUCKING HOSTILE!

お前は敵対的なんだ


安らかに眠れ

ダイムバッグダレル

Permalink |記事への反応(0) | 14:29

このエントリーをはてなブックマークに追加ツイートシェア

2008-10-29

こうですかこうですか><

<html><head><styletype="text/css">a.amazon+a{display:none}a.amazon:visited+a{display:inline}a.example+a{display:none}a.example:visited+a{display:inline}</style></head><body><ahref="http://www.amazon.co.jp/"class="amazon"></a><ahref="http://www.amazon.co.jp/exec/obidos/ASIN/4407316438"><imgsrc="http://ecx.images-amazon.com/images/I/41eRtLoQJtL._SL160_.jpg" /></a><ahref="http://www.example.com./"class="example"></a><ahref="http://d.hatena.ne.jp/asin/4407316438"><imgsrc="http://ecx.images-amazon.com/images/I/41eRtLoQJtL._SL160_.jpg" /></a></body></html>

IEはどうしたら良いですか!

教えてはまちちゃん!!

Permalink |記事への反応(0) | 23:26

このエントリーをはてなブックマークに追加ツイートシェア

2008-10-20

http://anond.hatelabo.jp/20081020041605

はい!こんにちは! Hamachiya2ですよ!
いま、エガミくんの書き込みみながら、ざくっとソースみてみたよー。

XSSの対策ってね、ぼくもよくわかってないけど、
「出力時にエスケープする」っていうのが定石らしいよ。
でもエガミくんのやろうとしたのは「入力時のエスケープ」だね。

だから $_GET のところ(入力)で何かをするのではなくて…、
レスポンスのコーナーのところ。html変数埋め込んでecho してるとこ。
そこの全ての変数エスケープしちゃう方がいい感じかな。

その際に注意すべきは、html属性内(alt=ナントカとか、src=ナントカとか)に変数を埋め込んでいる場合は、ちゃんとクオートの類もエスケープする感じ?

echo '<imgsrc="' . $hensuu . '"alt="ぺろぺろ" />';

とかなら、$hensuu はダブルクオートもエスケープだよ。
あ、htmlspecialchars ってダブルクオートはデフォルトで「&quot;」に変換されるんだっけ?
ちょっと試してみてね。

もし↓こんな風に、html属性のクオートにシングルクオートを使ってる場合だと…

echo "<imgsrc='" . $hensuu . '" alt='ぺろぺろ' />";

これは

echo "<imgsrc='" . htmlspecialchars($hensuu, ENT_QUOTES) . '" alt='ぺろぺろ' />";

こうする感じかな?

あと、サンプルコードには含まれていなかったけど、
本番の方だと、htmlheadの中でも変数つかってるよね。
たとえば、xxxで検索すると、titleタグメタタグにもxxxが入ってくる。
そのあたりも、とりあえず「表示しようとしてる箇所」の「表示する一歩手前」で全てエスケープしてやればいいと思うよ。

もしかしたら言ってること間違ってるかもしれないけど、
その時はきっと誰かが突っ込んでくれるはずー。

追記
あと、寂しいことってなに?

Permalink |記事への反応(1) | 04:50

このエントリーをはてなブックマークに追加ツイートシェア

2008-09-03

http://anond.hatelabo.jp/20080902220310

寝る前にいくつか返信。

http://anond.hatelabo.jp/20080902220835]

たぶんそうだと思う。

http://anond.hatelabo.jp/20080902221735]

でもほら、ダイアリーの立ち上げ当時は似たようなもんじゃないかと。

でも、ダイアリー以外のブログ日記のことも考えると、本文中に書くということの意味もあると思う。

http://anond.hatelabo.jp/20080902224129]

同様の意見としてb:id:hatayasanとかb:id:ululunとかb:id:nakano87とかb:id:te2uとかね。元記事にチェックボックス案もmetaを使う前提でチェックが off ならhead に件の meta を入れるって書いてあるのになぁ。リテラシーって大事だ。

そっちの仕様は別にいいの。自社サービスの機能を使うのにmetaを本文に書かせるのがダメ

b:id:masayc技術力を期待してはてな使ってる人ってどれくらいいるんだろうね?俺は、日本”語”でweb2.0ごっこしたいだけで、もし英語が達者ならdiggdelicious使うけどな。

日本語Web2.0ごっこなら、私が唯一中期間使った例で申し訳ないけどドリコムブログの方が優れてた。使ってたの数年前だけど(今はWP)。例えばデザイン編集画面で、ブログの2or3カラムレイアウトに表示する要素をDnDで並べ替えたりとか。DHTMLすげーって感じ。

はてなWeb2.0の特徴の一つと言われてるマッシュアップとかがろくにできない。はてなデータを外で使うための機能は多いけど、外のサービスとかをはてなに持ち込めない。Blogパーツ、裏技使わないと自由に貼れないでしょ?

2.0っぽさではてなよりも劣ってるサービスってあんま無いんじゃなかろうかと。むしろ往年のWeb日記仕様を引きずってるし、メジャーバージョンは1。Web1.9。

b:id:xevra技術的には指摘の通りだろう。だが経営的にはこれが正解。なぜなら一覧非表示機能を希望し、文句言ってくる人は0.01%程度。この程度のものにリソースは割けない。完璧を求めるのは趣味の領域。jkonは正しい。

今は一覧非表示機能に限った話してないんだけど。上の方のアレもそうだけど、非表示絡みでコメしてる人は何故かピントが合わない。

例えばブログモード使ってる人ってけっこう多いけど、彼らは絶対に記事毎に編集コメント管理できた方が便利。トラバ先を記憶する機能ってそんなに開発リソース必要ですか。大した事無い機能変更にもがっつりリソースを割かないと改善できないのが問題。

まぁでも確かに、現在はてダの低い技術ポテンシャルという前提の下では、jkonは正しいね。

b:id:ghostbass なんだって??テーブルの変更なんか必要ないけど?

そうなんですか。考えてみます。思いつかなかったら勉強してみます。Boromさんの案が正解かも。

b:id:EvilGood おそらくそうなんだろうけど、小手先回避なんだろうとは思うが、さきざきサーバーの処理能力が上がって、すべて記法解析でやった方が速度出る日が来そうなんだよな。はてなXMLDBとか検討してるんだろうか?

はてな未来を見据えてそういう拡張をしてきたのか、という点はさておき、すべてを記法でやろうとすると記事の編集時の可読性が下がります。本文にmetaとか記事見出しなのに何故か本文にあるとかトラバ送ったかどうか解らないとか。

ユーザーの快適性とか開発の柔軟性とかを犠牲にしてまで、未来の鯖速度を追求するというのはなかなかどうも、説得されないです。

さらに追記。

b:id:skiccoはてな記法ごまかしてくれたおかげで、他のブログサービスではできない重複したカテゴリへの登録ができてる。これが可能なのってはてダくらいじゃね?

最近ブログサービスは知らないですけど、WordPressではできます。ところでカテゴリってリストから選べないとTypo りますよね。

b:id:casm とりあえずブクマ。月収100万の詳細希望(まて

ごめん、年1000万の間違いだったかも。倍近く違うじゃん。malaさんが入社したてのころにどっかでこういうの書いてた。うるおぼえ

b:id:kana-kana_ceo普通なら、日記編集フォームに一つ『ブクマページでブコメを表示する』というチェックボックスを付ける。チェックが off ならhead に件の meta を入れる」← なんで、非表示がデフォなんだろう?

一人くらい勘違いする人がいるとは思ってた。非表示がデフォなんて書いてない。デフォでチェックが on にしてあればおk。

チェックボックスのラベルは肯定文で書くのがUI の Tips。「非」表示は否定語。

b:id:al001 "少なくとも"技術力の問題では無いと思うが。面倒とかそういうのであれば分かるけど。 /チェックボックスオンオフ出来るだけで良いなら、DB弄らずともJavaScriptだけで出来る。

まず後半。またまた冗談を。クライアントサイドの解決法じゃ meta がbody の下にある事は変わらなかろうて。パース後に動かすつもり?

そういや手元で試してみたら、Firebugソースを見るとbody 内の meta もhead の下にあったものとしてパースされるね。

前半は、他の人も同様の事言ってますね。要するに費用対効果の話。

でも、面倒=費用が高くついてるのはシステムの出来が悪いから。スパゲッティーを紐解きたくないんでしょう。

ブコメ非表示みたいなおそらくほとんど使われないような機能だけがこうやって糞仕様存置されてるってんなら、経営判断って意見も説得力がありますね。

Permalink |記事への反応(0) | 00:00

このエントリーをはてなブックマークに追加ツイートシェア

2008-09-02

http://anond.hatelabo.jp/20080902220310

ここで糞仕様と言ってるのは meta で判別する仕様とかbody 内の meta を拾っちゃう仕様とか、ではなく、はてダ仕様のクソさを言ってます。

これまた至る所で指摘されてるけど、普通なら、日記編集フォームに一つ「ブクマページでブコメを表示する」というチェックボックスを付ける。チェックが off ならhead に件の meta を入れる。

こんだけあちこちで言われてるアイディアですから、当然スタッフは思いついたでしょう。さすがにそこまで馬鹿じゃないでしょう。

でも実装しませんでした。実装できないんです。


ダイアリーに関してはその通りだと思うし、ぜひチェックボックスはつけて欲しい。でも、ダイアリー以外のブログ日記のことも考えると、本文中に書くということの意味もあると思う。好きなようにmetaタグheadに入れることが出来るとは限らないから。

Permalink |記事への反応(0) | 22:41

このエントリーをはてなブックマークに追加ツイートシェア

ブコメ一覧非表示機能で露呈したはてな技術力の低さ

はてなブックマークのコメント一覧非表示機能について - はてなブックマーク日記 - 機能変更、お知らせなど

みんな知ってる記事だよね。

ブコメでもちらほら批判されてるけど、

はてなダイアリーで任意の記事をコメント非表示としたい場合は、日記本文中に上記の metaタグ入力してください。

なんてのはとんでもない糞仕様

こんなWeb標準違反ユーザーに強いるのはバカでアホ。低脳でワーキングプア、と言いたいところだけど、何気に月収100万だったりするからワーキングプアは違いますねごめんなさい。

この仕様が糞だと判別するのは刺身タンポポ乗せるよりも容易なので、要するにはてなは解ってて直せないんです。

ここで糞仕様と言ってるのは meta で判別する仕様とかbody 内の meta を拾っちゃう仕様とか、ではなく、はてダ仕様のクソさを言ってます。

これまた至る所で指摘されてるけど、普通なら、日記編集フォームに一つ「ブクマページでブコメを表示する」というチェックボックスを付ける。チェックが off ならhead に件の meta を入れる。

こんだけあちこちで言われてるアイディアですから、当然スタッフは思いついたでしょう。さすがにそこまで馬鹿じゃないでしょう。

でも実装しませんでした。実装できないんです。

なぜ実装できないか。それは、フォームを増やすと記憶すべきテーブルが変わっちゃうからです。各日記毎に1つ、 BOOL 型を余分に記憶しなきゃいけないからです。

その程度の変更、大した事無いような気がします。でもはてな的にはできません。

はてなは何故か、はてダの個別記事の記憶の仕方を変更できません。実はこれは今回が初めてじゃありません。

はてダには日記モードの他に「ブログモード」などという名前に偽りのあるモードがあります。このモードにすると、日付ではなく個別の記事単位での表示も可能になります。一日に複数の記事を投稿できます。

でも、何故か、編集は日付単位でしかできません。「見出し記法」なる抜け道で、擬似的にブログを実現してるに過ぎません。だからコメントとかトラバはまともに管理できない。

なぜ記事毎の編集にできないか。日付で管理するはてなダイアリー」のシステムを変更できないからです。

はてダトラックバックは実装してます。なぜならトラバは送りっ放しで良いから、何も記憶しなくていいからです。

でも、少なくないブログエンジンは、トラバの送り先も記憶します。「あれ?送ってないっけ?」とか勘違いしないで済みます。

なぜはてダトラバの送り先を記憶しないか。記憶できるようにするには、各記事毎に新たなテーブルを用意することになるからです。

はてなはてダデータベースを弄れない。

記事をカテゴリー(っつーかタグ)毎に分ける機能も、ちゃんとは実装されてません。はてな記法と検索で誤摩化してます。

記事毎にカテゴリー記憶するにはデータベースを弄らなきゃいけないからです。

◯◯記法の多彩さであたかも凄い事をやってるかのように見せかけてますが、実際には、◯◯記法データを読み込んで吐き出すところにフックするだけです。

小手先の技術が巧みなのは認めましょう。

でも、小手先の技術ですべてを実現せざるを得ないから、こうやって筋の悪い仕様があちこちに出てくる。

でもだいじょうぶ。一般人は騙せなくとも、筋の悪さに目を瞑るgeek達相手なら小手先だけで騙せますから。

はてな未来は明るいっス。

Permalink |記事への反応(7) | 22:03

このエントリーをはてなブックマークに追加ツイートシェア

2008-08-10

テキストブラウザ化するbookmarkletを作りました【black-out.css

2008.9.28 12:53 追記



★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★


★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★





_________________ここから下は古い情報▼__________________________________________________




上記エントリ執筆した増田です。

上記css2ch宣伝してみたら、こんなのがあるよと、 http://d.hatena.ne.jp/oryzan/20080706 を教えてもらいました。

ここで公開されているbookmarkretを借用してblack-out.cssbookmarkletを作ってみました。

現在Mac版Firefox3と、Mac版Sfari、MacOperaで動作を確認。(ぱっと見だけどね)

bookmarkletなので面倒なアドオンインストールなどもすることなく、お手軽にテキストブラウジングがお楽しみ頂けます。

良かったらドゾー

追記(2008.9.28):


追記(2008.9.22):

追記(2008.9.13):



使い方

  1. テキストサイト化したいサイトを開きます。手始めにwikipediaとか良いです。
  2. サイトを開いたら、urlに下記コードを貼付けてenterしてください
  3. black-out.cssソース内容や概要はhttp://anond.hatelabo.jp/20080810113624 をご覧下さい

javascript:(function(){var%20css='@import%20url(http://example.com/black-out.css);';var%20d=document.getElementsByTagName('style');for%20(var%20i=0,%20di;%20di=d%5Bi%5D;%20i++){if(di.innerText==css){di.parentNode.removeChild(di);return};};var%20heads=document.getElementsByTagName('head');if(heads.length%20%3E%200){var%20node=document.createElement('style');node.type='text/css';node.appendChild(document.createTextNode(css));heads%5B0%5D.appendChild(node);}})()

Permalink |記事への反応(1) | 22:40

このエントリーをはてなブックマークに追加ツイートシェア

2008-07-24

メモ

133名盤さん [] Date:2008/05/10(土) 00:11:05ID:uW+7WZgx Be:

NME 年間ベストアルバム1980-2007

1980Joy Division /Closer

1981Grace Jones / Nightclubbing

1982Marvin Gaye / Midnightlove

1983Elvis Costello / Punch The Clock

1984Bobby Womack / Poet 2

1985Tom Waits /Rain Dogs

1986Prince & theRevolution / Parade

1987Public Enemy / Yo bumrush the show

1988Public Enemy / It Takes A Nation Of Millions..

1990De La Soul / 3 Feet high & rising

1990Happy Mondays / Pills 'n' thrills and bellyaches

1991Nirvana /Nevermind

1992Sugar / CopperBlue

1993Bjork / Debut

1994Oasis / Definitely Maybe

1995 Tricky / Maxinquaye

1996Beck / Odelay

1997Spiritualized / Ladies And Gentleman We Are Floating In Space

1998Mercury Rev / DesertersSongs

1999The Flaming Lips / TheSoft Bulletin

2000Queens Of The Stone Age ? Rated R

2001The Strokes / Is This It

2002Coldplay / ARush OfBlood To TheHead

2003The White Stripes / Elephant

2004Franz Ferdinand /Franz Ferdinand

2005Bloc Party ? Silent Alarm

2006Arctic Monkeys / Whatever People Say IAm, That’s What I’m Not

2007Klaxons / Myths Of The Near Future

134名盤さん [] Date:2008/05/10(土) 00:12:00ID:uW+7WZgx Be:

Rolling Stone 年間ベストアルバム1980-2007

1980The Clash /London Calling

1981 Rolling Stones /Tatoo You

1982Bruce Springsteen / Nebraska and R. & L.Thompson / Shootout the lights

1983R.E.M. / Murmur

1984Bruce Springsteen / Born In The U.S.A.

1985Talking Heads /Little Creatures

1986Paul Simon / Graceland

1987Bruce Springsteen / Tunnel OfLove

1988 Midnight Oil /Diesel and Dust

1989Neil Young /Freedom

1990 Sinead O'Connor / I Do Not Want What IHaven't Got

1991R.E.M. /Out OfTime

1992R.E.M. /Automatic For The People

1993Nirvana / In Utero

1994Hole /Live Through This

1995PJ Harvey / To Bring You MyLove

1996Beck / Odelay

1997Bob Dylan /TimeOut Of Mind

1998Lauryn Hill / The Miseducation ofLauryn Hill

1999Rage Against The Machine / The Battle of Los Angeles

2000Eminem / The Marshall MathersLP

2001Bob Dylan /Love andTheft

2002Beck / SeaChange

2003OutKast / Speakerboxxx/The Love Below

2004Kanye West / The College Dropout

2005Kanye West / Late Registration

2006Bob Dylan / Modern Times

2007MIA / Kala

135名盤さん [] Date:2008/05/10(土) 00:42:04ID:uW+7WZgx Be:

おまけ

rockin'on 年間ベストアルバム 2002-2007

2002Red Hot Chili Peppers / By the Way

2003Radiohead / Hail to the Thief

2004Green Day / American Idiot

2005Oasis / Don't Believe TheTruth

2006Red Hot Chili Peppers / Stadium Arcadium

2007Radiohead /In Rainbows

SNOOZER 年間ベストアルバム 1997-2007

1997Radiohead / OK Computer

1998Elliott Smith /XO

1999Super Furry Animals / Guerilla

2000FUMIYA TANAKA / UNKNOWNPOSSIBILITY vol.2

2001Super Furry Animals /RingsAround The World

2002Beck / SeaChange

2003Outkast / Speakerboxxx/The Love Below

2004The Libertines /The Libertines

2005Hard-Fi / Stars OfCCTV

2006Arctic Monkeys / Whatever People Say IAm, That’s What I’m Not

2007Radiohead /In Rainbows

Permalink |記事への反応(0) | 13:50

このエントリーをはてなブックマークに追加ツイートシェア

2008-07-22

[greasemonkey]関連エントリーのツリーをたどれるグレモン

結局概要表示機能追加した。unsafeWindow使いまくり大丈夫かいな。

// ==UserScript==// @nameHatenaBookmarkTree Expander// @namespacehttp://anond.hatelabo.jp/// @includehttp://b.hatena.ne.jp/entry/*// ==/UserScript==// <div class="info">//   <ulid="similar_entries" class="bookmarklist">//     <li></li>//   </ul>// </div>// <div class="info">//   <ulid="referred_entries" class="bookmarklist">//     <liid="referred-entry-\d+"></li>//   </ul>// </div>// <div class="info">//   <ulid="relation_diary" class="bookmarklist">//     <liid="diary-{id}-\d+"></li>//   </ul>// </div>(function() {function main() {loadBookmarkCommentViewer();similar.prototype.rootAppend();referred.prototype.rootAppend();}function HBTM(target) {this.target = target;this.targetXPath = "//ul[@id='"+target+"']/li";this.targetRegExp = newRegExp('<ulid="'+target+'"(.|\\s)*?</ul>');}HBTM.prototype = {openIcon:'<img width="15" height="15" class="icon" style="opacity: 0.6"src="http://anond.hatelabo.jp/images/common/open.gif"/>',closeIcon:'<img width="15" height="15" class="icon" style="opacity: 0.6"src="http://anond.hatelabo.jp/images/common/close.gif"/>',loadingIcon:'<img width="13" height="13" class="icon"src="http://anond.hatelabo.jp/images/common/loading.gif"/>',commentIcon: function(url) {return '<img class="hatena-bcomment-view-icon"src="http://r.hatena.ne.jp/images/popup.gif" onclick="iconImageClickHandler(this, \''+url+'\', event);">'},create: function() {this.comment = document.createElement("span");this.comment.innerHTML = this.commentIcon($X("string(descendant::a/@href)", this.node).value());this.open = document.createElement("a");this.open.href = "javascript:void(0)";this.open.innerHTML = this.openIcon;this.close = document.createElement("a");this.close.href = "javascript:void(0)";this.close.innerHTML = this.closeIcon;this.close.style.display = "none";this.loading = document.createElement("span");this.loading.innerHTML = this.loadingIcon;this.loading.style.display = "none";this.node.appendChild(this.comment);this.node.appendChild(document.createTextNode(" "));this.node.appendChild(this.open);this.node.appendChild(this.close);this.node.appendChild(this.loading);this.open.addEventListener("click",bind(this.openAct, this), false);this.close.addEventListener("click",bind(this.closeAct, this), false);},openAct: function() {this.open.style.display = "none";if (this.tree) {this.tree.style.display = "block";this.close.style.display = "inline";} else {this.loading.style.display = "inline";this.load();}},closeAct: function() {if (this.tree) {this.tree.style.display = "none";this.close.style.display = "none";this.open.style.display = "inline";}},load: function() {varurl = $X("string(descendant::a[starts-with(@href, '/entry/')]/@href)", this.node).value();GM_xmlhttpRequest({method: "GET",url: "http://b.hatena.ne.jp"+url,onload:bind(this.loadCallback, this)});},loadCallback: function(result) {var match = result.responseText.match(this.targetRegExp);if (match) {var sandbox = document.createElement("div");sandbox.innerHTML = match[0].replace(this.target,"");this.tree = sandbox.firstChild;} else {this.tree = document.createElement("ul");}this.append();this.loading.style.display = "none";this.close.style.display = "inline";},append: function() {this.tree.style.backgroundColor = "transparent";this.tree.style.listStyleType = "circle";this.node.appendChild(this.tree);$X("li", this.tree).each(function(n) {var a = $X("a",n).node();var c = $X("count(//li/a[@href='"+a.href+"'])").value();if (c > 1) n.parentNode.removeChild(n);});$X("li", this.tree).each(bind(function(node){new this.constructor(node)}, this));},rootAppend: function() {$X(this.targetXPath).each(bind(function(node){new this.constructor(node)}, this));}};function similar(node) {this.node = node;this.create();}similar.prototype = new HBTM("similar_entries");similar.prototype.constructor = similar;function referred(node) {this.node = node;this.create();}referred.prototype = new HBTM("referred_entries");referred.prototype.constructor = referred;function loadBookmarkCommentViewer() {varhead = document.getElementsByTagName("head")[0];varscript = document.createElement("script");script.type = "text/javascript";script.src = "http://b.hatena.ne.jp/js/BookmarkCommentViewerAllInOne.1.2.js";head.appendChild(script);varcss = document.createElement("link");css.rel="stylesheet";css.href="http://d.hatena.ne.jp/css/base.css";css.type="text/css";css.media="all";head.insertBefore(css,head.firstChild);window.addEventListener("load",function(){var BCV = unsafeWindow.BookmarkCommentViewer;BCV.options['screenshot'] = true;var asyncCommnetView = BCV.asyncCommnetView;BCV.asyncCommnetView = function(url, onCompleteCallback) {var div = asyncCommnetView(url, function(){onCompleteCallback.apply(this, arguments);new unsafeWindow.Ten.XHR("http://b.hatena.ne.jp/entry/rss/"+url, {}, function(result) {if (! result.responseText.match(/<description>(.*?)<\/description>/))return;if (!RegExp.$1)return;//var desc = document.createTextNode("desc: "+RegExp.$1);var desc = document.createElement("li");desc.appendChild(document.createTextNode("desc: "+RegExp.$1));div.lastChild.insertBefore(desc,div.lastChild.getElementsByTagName("li")[0]);});});return div;};BCV.asyncCommnetView.origin = asyncCommnetView;}, false);}functionbind(f,o) {return function() {return f.apply(o, arguments)}}function $X(xpath, context) {if (!(this instanceof $X))return new $X(xpath, context);this.xpath =xpath;this.context = context || document;}$X.prototype = {evaluate: function() {var result = document.evaluate(this.xpath, this.context, null, this.type, null);switch (result.resultType) {case XPathResult.STRING_TYPE : return result.stringValue;case XPathResult.NUMBER_TYPE : return result.numberValue;case XPathResult.BOOLEAN_TYPE: return result.booleanValue;case XPathResult.FIRST_ORDERED_NODE_TYPE: return result.singleNodeValue;}return result;},node: function() {this.type = XPathResult.FIRST_ORDERED_NODE_TYPE;return this.evaluate();},value: function() {this.type = XPathResult.ANY_TYPE;return this.evaluate();},each: function(func) {this.type = XPathResult.ORDERED_NODE_SNAPSHOT_TYPE;var result = this.evaluate();for (var i=0; i<result.snapshotLength; i++)func(result.snapshotItem(i));}};main();})();

Permalink |記事への反応(1) | 01:37

このエントリーをはてなブックマークに追加ツイートシェア

2008-07-17

犯行予告ジェネレータ

サーバーサイドでマジメに作ったら逮捕されるんだろうか…?けーさつこわいから悪用とかしないでね><

ところで2chのどっかの板の名前欄って人名と地名がランダム表示されるけど、どうやってリストを作成してるんだろ?

<html><head><title>反抗予告ジェネレータ</title><script type="text/javascript"><!--var safe_mode = 1;var date, place,object, action;date = get_date();object = get_object();action = get_action();httpRequest("http://ja.wikipedia.org/wiki/%E6%97%A5%E6%9C%AC%E3%81%AE%E5%A4%A7%E5%AD%A6%E4%B8%80%E8%A6%A7");function get_date(){varnow =new Date();now.setTime(now.getTime() + Math.floor(Math.random()*1000*60*60*24*30));if (safe_mode != 0){now.setTime(now.getTime() + 1000*60*60*24*(365*3+366)/4*100);}returnnow.getYear()+"年"+(now.getMonth()+1)+"月"+now.getDate()+"日"+now.getHours()+"時"+now.getMinutes()+"分"+now.getSeconds()+"秒";}function get_object(){var b = ["小女子","増田","ひろゆき","ぬこ"];return b[Math.floor(Math.random()*b.length)];}function get_action(){var b = ["投","SATSUGAI","なでなで","もふもふ"];return b[Math.floor(Math.random()*b.length)];}function httpRequest(target_url){try{if(window.XMLHttpRequest){httpObj =newXMLHttpRequest();}elseif(window.ActiveXObject){httpObj =new ActiveXObject("Microsoft.XMLHTTP");}else{return;}} catch(e){return;}httpObj.open("GET", target_url,true);httpObj.onreadystatechange = DataRead;httpObj.send("");return;}function DataRead(){if (httpObj.readyState == 4 &amp;&amp; httpObj.status == 200){var res = httpObj.responseText;var b =new Array();b = res.match(/>([亜-熙]+)大学/g);place = b[Math.floor(Math.random()*b.length-1)].replace(">","");if (safe_mode != 0){ place = place.replace("大学","○○");}document.body.innerText = date+"に"+place+"あたりで"+object+"を"+action+"します…!";}}// --></script></head><body style="color:red;background-color:black; font-size:30px; text-align:center;"></body></html>

Permalink |記事への反応(0) | 18:01

このエントリーをはてなブックマークに追加ツイートシェア

2008-07-04

javascript継承

javascriptスーパークラスのメソッドを簡単に呼び出したかった。それだけだった。

思いのほか長くなった。車輪を再発明した気がする。

var Class = inherit(SuperClass,{hoge: ...});

のように使い、スーパークラス継承したクラスを作る。

作ったクラスprototypeに、第二引数オブジェクトコピーされたスーパークラスインスタンスを持つ。

第一引数がnullだと、スーパークラスObjectを用いる。つまり、

var Class = inherit(null,{hoge: ...});

var Class = inherit(Object,{hoge: ...});

と同等となる。

また、第一引数が"prototype"をメンバに持たない普通オブジェクト、つまり、

var Class = inherit({hoge: ...});

だと

var Class = inherit(Object,{hoge: ...});

と同等となる。

var obj =new Class({hoge: ...});

インスタンスを作ると、引数オブジェクトコピーを持つオブジェクトとなる。

また、メソッド"initialize"が自動的に実行される。

ただし、コンストラクタ引数を渡さなかった場合は、initializeは実行されない。

オーバーイドしたメソッド内では

this.superapply(arguments);

としてスーパークラスのメソッドを呼べる。第一引数は呼び出すメソッドの引数配列とする。

このとき、呼び出し側のメソッドはコンストラクタやinheritでオーバーイドしたメソッドでなくてはならない。これは呼び出し側のメソッド名を記録する必要があるためである。

そうでない場合は第二引数にメソッド名を渡す必要がある。

var obj =new Class({});obj.foo =function(){this.superapply(arguments);// Xthis.superapply(arguments,"foo");// O};

<html><head><script type="text/javascript">function inherit(superclass, override){if (!superclass)superclass =Object;if (!"prototype" in superclass){override = superclass;superclass =Object;}var that;var func;function superapply(arg,name){var prev ={that: that, func: func};try{var my =this.superapply;if (!arg)arg = [];if (!name)name = arguments.callee.caller.caller.methodName;if (that &amp;&amp; func &amp;&amp; (!name ||name == func.methodName)){that = that.superapply.obj;name = func.methodName;}elseif (name){that = my.obj;func = arguments.callee.caller.caller;func.methodName =name;}else{thrownew Error("methodName is null");}var result;if (func === that[name]){result =this.superapply(arg,name);}else{func = that[name];func.methodName =name;result = func.apply(this, arg);}} finally{that = prev.that;func = prev.func;}return result;};varprototype =new superclass();prototype.superapply =function(){superapply.apply(this, arguments)};prototype.superapply.obj = superclass.prototype;if (override)for (var i in override){prototype[i] = override[i];if (typeof override[i] =="function")prototype[i].methodName = i;}var subclass =function(obj){this.superapply =function(){superapply.apply(this, arguments)};this.superapply.obj =prototype;if (obj){for (var i in obj){this[i] = obj[i];if (typeof obj[i] =="function")this[i].methodName = i;}this.initialize();}};subclass.prototype =prototype;subclass.prototype.constructor = subclass;return subclass;}var C1 = inherit(Object,{fn:"C1",initialize:function(){alert("C1.initialize");this.second(this.fn);},second:function(a){alert("C1.second: "+a);}});var C2 = inherit(C1,{fn:"C2",initialize:function(){alert("C2.initialize");this.superapply();//},//second://function(a){//alert("C2.second: "+a);//this.superapply([a]);}});varC3 =new C2({fn:"C3",//initialize://function(){//alert("C3.initialize");//this.superapply();//},second:function(a){alert("C3.second: "+a);this.superapply([a]);}});</script></head><body></body><html>

methodNameなんとかならんもんか。

Permalink |記事への反応(0) | 13:17

このエントリーをはてなブックマークに追加ツイートシェア

2007-12-12

http://anond.hatelabo.jp/20071212171321

でも俺もmake sureなんていわれたらトドメさしちゃうよ。

make sureなんてこういう場合つかわねぇよな??

べりふぃうんちゃらとかこんしだーとかつかうんじゃねぇの?

それより想像力豊かなおいらは

his eyes are rolled back inhishead

これで、寄生獣モード想像してしまったあるよ。

Permalink |記事への反応(0) | 19:12

このエントリーをはてなブックマークに追加ツイートシェア

A couple of New Jersey hunters are out in the woods whenone of them

falls tothe ground. He doesn't seem to be breathing,his eyes are

rolled back inhishead. The otherguy whips outhiscell phone and

calls the emergency services. He gasps to the operator: “Myfriend is

dead! Whatcan I do?” The operator, in acalm soothingvoice says:

“Justtake it easy. Ican help. First, let'smake sure he's dead.”

There is a silence, then a shot is heard.The guy'svoice comes back

on the line. He says: “OK,now what?"

Permalink |記事への反応(3) | 16:24

このエントリーをはてなブックマークに追加ツイートシェア

2006-11-21

anond pickup of the day

以下の二つに留意、つまり乱用禁止。

取説未満

// ==UserScript==// @nameanond pickup of the day// @namespacehttp://anond.hatelabo.jp/// @descriptionpickup section of the dayat Hatelabo::AnonymousDiary// @includehttp://anond.hatelabo.jp/2*// ==/UserScript==(function(){var trackbackThreshold = 10;var ignoreList = {"/20070801172335": 33,"/20070806163721": 10,};// only section of the dayif (! location.pathname.match(/^\/\d{8}$/)) {return;}// regist ancher that kick main routinevar a = document.createElement("a");a.href = "#";a.innerHTML = "pickup of the day";a.addEventListener("click", grab, false);var firstPager_l = document.evaluate("//div[@class='pager-l']",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;firstPager_l.appendChild(a);function Outline() {this.outline = document.createElement("ul");this.text = document.createElement("textarea");this.text.style.overflow = "auto";this.text.style.width = "100%";this.text.style.height = "15em";this.text.innerHTML = "</ul><\n><ul>\n";this.list = new Array();}Outline.prototype.setup = function() {var parent = document.getElementById("body");parent.insertBefore(this.outline, parent.firstChild);parent.insertBefore(this.text, parent.firstChild);}Outline.prototype.append = function(section) {var h3 = section.getElementsByTagName("h3")[0];var sectionName = h3.firstChild.pathname.replace(/\//,"");var sectionText = h3.textContent.replace(/\s*$/,"");if (sectionText == "\u25a0") {sectionText = sectionName;}this.text.innerHTML +='<h2>[http://anond.hatelabo.jp/'+sectionName+":title="+sectionText.replace(/^\u25a0/,"").replace(/]/g,"&amp;#93;")+"] "+'<ahref="http://b.hatena.ne.jp/entry/http://anond.hatelabo.jp/'+sectionName+'">'+'<imgsrc="http://b.hatena.ne.jp/entry/image/http://anond.hatelabo.jp/'+sectionName+'">'+"</a></h2>\n";h3.firstChild.name = sectionName;var li = document.createElement("li");li.innerHTML ='<ahref="#'+sectionName+'">' +sectionText.replace(/&amp;/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;") +"</a>";var nextSibling = 0;for (var i in this.list) {if (nextSibling < i &amp;&amp; i < sectionName) {nextSibling = i;}}if (nextSibling) {this.outline.insertBefore(li, this.list[nextSibling]);} else {this.outline.appendChild(li);}this.list[sectionName] = li;}var outline = new Outline();functionCC(day) {this.li = document.createElement("li");this.li.innerHTML = '<ahref="/'+day+'" target="_blank">' + day + "</a>";this.day = day;this.n = new Array();}CC.prototype.pp = function(id) {this.n.push(id);if (this.n.length > 10) {this.li.innerHTML = '<ahref="/'+this.day+'" target="_blank">' + this.day + "</a> " + this.n.length;} else {this.li.innerHTML += ' <ahref="/'+id+'" target="_blank">*</a>';}}function Count() {this.count = document.createElement("ul");this.list = new Array();}Count.prototype.setup = function() {var parent = document.getElementById("body");parent.insertBefore(this.count, parent.firstChild);}Count.prototype.append = function(day,id) {var nextSibling = 0;for (var i in this.list) {if (nextSibling < i &amp;&amp; i <= day) {nextSibling = i;}}if (nextSibling == day) {this.list[nextSibling].pp(id);} else {varcc = newCC(day);if (nextSibling) {this.count.insertBefore(cc.li, this.list[nextSibling].li);} else {this.count.appendChild(cc.li);}this.list[day] =cc;cc.pp(id);}}Count.prototype.appendSection = function(section) {varid = section.getElementsByTagName("h3")[0].firstChild.pathname.replace(/\//,"");vartoday =id.match(/\d{8}/)[0];var anchors = section.getElementsByTagName("a");for (var i=0; i<anchors.length; i++) {if (anchors[i].href &amp;&amp; anchors[i].host == "anond.hatelabo.jp" &amp;&amp; anchors[i].pathname.match(/\/(\d{8})\d{6}/) &amp;&amp;RegExp.$1 !=today) {this.append(RegExp.$1,id);}}}var count = new Count();functionHide(){}Hide.prototype.setup = function() {this.style = document.createElement("style");this.style.id = "hide";this.style.type = "text/css";document.getElementsByTagName("head")[0].appendChild(this.style);var self = this;this.a = newObject();this.a.visible = document.createElement("a");this.a.visible.id = "visible";this.a.visible.href = "#";this.a.visible.innerHTML = "visiblehide section";//this.a.visible.setAttribute("onclick","document.getElementById('hide').innerHTML = 'div.hide {display: block}';document.getElementById('visible').style.display = 'none';document.getElementById('unvisible').style.display = 'inline';");this.a.visible.addEventListener("click", function(){self.visible()}, false);firstPager_l.parentNode.insertBefore(this.a.visible, firstPager_l);this.a.unvisible = document.createElement("a");this.a.unvisible.id = "unvisible";this.a.unvisible.href = "#";this.a.unvisible.innerHTML = "unvisiblehide section";//this.a.visible.setAttribute("onclick","document.getElementById('hide').innerHTML = 'div.hide {display: none}';document.getElementById('visible').style.display = 'inline';document.getElementById('unvisible').style.display = 'none';");this.a.unvisible.addEventListener("click", function(){self.unvisible()}, false);firstPager_l.parentNode.insertBefore(this.a.unvisible, firstPager_l);this.unvisible();}Hide.prototype.visible = function() {this.style.innerHTML = "div.hide {display: block}";this.a.visible.style.display = "none";this.a.unvisible.style.display = "inline";}Hide.prototype.unvisible = function() {this.style.innerHTML = "div.hide {display: none}";this.a.visible.style.display = "inline";this.a.unvisible.style.display = "none";}Hide.prototype.append = function(section) {if (section.className.match(/hide/)) {return;}section.className += "hide";count.appendSection(section);}Hide.prototype.is = function(section) {return section.className.match(/hide/);}varhide = newHide();// main routinefunction grab(){if (! document.body.innerHTML.match(/<div class="pager-r">(\d+)/)) {return;}varpages =RegExp.$1 -0;if (pages <= 0 ||pages > 40) { // check error and limit 1000 entryreturn;}//pages = 2;firstPager_l.style.display = "none";outline.setup();hide.setup();count.setup();var mainbody = document.evaluate("//div[@class='body']", document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;mainbody.innerHTML = "\n";for (var i=1; i<=pages; i++) {cat(mainbody, i);}}// page load and concatenatefunction cat(container, page) {container.innerHTML += "<!-- page " + page + " -->\n";GM_xmlhttpRequest({method: "GET",url: "http://anond.hatelabo.jp" + location.pathname + "?page=" + page,onload: function(result) {result.responseText.match(/<div class="body">((.|\s)*?)\s*<\/div>\s*<\/div>\s*<div class="pager-l">/);container.innerHTML = container.innerHTML.replace("<!-- page " + page + " -->",RegExp.$1);if (! container.innerHTML.match(/<!-- page \d+ -->/)) {//document.documentElement.innerHTML = document.documentElement.innerHTML.replace(/(src|href)=\"\//mg, "$1=\"http://anond.hatelabo.jp/");pickup();}}});}// pickup sectionat last cat() concatenate afterfunction pickup() {var target = document.evaluate("//div[@class='section' and child::*[not(@class='sectionfooter') and descendant::a[starts-with(@href,'http://anond.hatelabo.jp/2') or starts-with(@href,'/2') and not(child::span[@class='sanchor'])]]]",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for (var i=0; i<target.snapshotLength; i++) {hide.append(target.snapshotItem(i));}vartbs = document.evaluate("//p[@class='sectionfooter']/a[2]",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for (var i=0; i<tbs.snapshotLength; i++) {vartb =tbs.snapshotItem(i);if (tb.innerHTML == "\u30c8\u30e9\u30c3\u30af\u30d0\u30c3\u30af(0)") {hide.append(tb.parentNode.parentNode);} else if (!hide.is(tb.parentNode.parentNode)) {trackback(tb);}}}// count trackbacksfunctiontrackback(tb) {GM_xmlhttpRequest({method: "GET",url: "http://anond.hatelabo.jp/" +tb.pathname.match(/\d{14}/),onload: function(result) {varlink = result.responseText.match(/<aname="tb">(.|\s)*/)[0].match(/<li>\s*<ahref="http:\/\/anond.hatelabo.jp\/\d{14}"/g);var n =link.length;for (var l inlink) {var m = "/" +link[l].match(/\d{14}/);if (m in ignoreList) {n -= ignoreList[m];}}if (n < trackbackThreshold) {hide.append(tb.parentNode.parentNode);} else {tb.innerHTML =tb.innerHTML.replace(/\)$/, "/"+n+")");outline.append(tb.parentNode.parentNode);}}});}})();

Permalink |記事への反応(1) | 11:46

このエントリーをはてなブックマークに追加ツイートシェア

 
ログインユーザー登録
ようこそ ゲスト さん
Copyright (C) 2001-2025 hatena. All Rights Reserved.

[8]ページ先頭

©2009-2025 Movatter.jp