「structure」を含む日記 RSS

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

2016-06-08

カードの裏を確認するパズルについて、ちょっとだけ解説

こんにちは趣味パズル作家です。

カードの裏を確定させる最小枚数を求めるのって、あるあるネタなんだけど、

これを気にパズル作家が増えると良いなと思ったので、パズル的な解説しま

最近見た数学ネタ好意的だったけど、カード裏のネタ罵倒が並んでたので……)

カード裏のパズル

要は、コレのことね。(クッキーブロックしてると見えないかも)

これ、端的にいうと、条件が足りないか限定が変。だから不正解選択肢しか無い。

正解は、「D」と「F」と「3」をめくる。譲歩しても「D」だけをめくる、かな。

(あ、残念ながら「7」をめくる必要はない……)

変な限定もしくは足りない条件

表と裏に区別がある場合

表と裏に区別のあるカードなら、「D」だけめくれば良い。

例えば、カードの表面が赤色カードの裏面が青色だとする。

「Dの裏は7である」を確認するには、「D」をめくれば良い。

表と裏に区別があるなら、「表3で裏D」でも関係ない。

表と裏に区別が無い場合

問題文には裏表の限定なんか書いてないって?

そりゃそうだ。だからウラとオモテ区別はないと考える。

「Dの裏は7である」が違反するのは、次の3つのパターン

Dの裏側にフナッシーが描かれてても、別に前提条件とは矛盾しない。

単に『「Dの裏は7である」というルール』に違反しているだけだ。

同じように「Fの裏にDがある」場合は、困ったことになる。

これをつかってパズルを作る

「D」「F」「3」「7」のカードと、「Dの裏は7である」というルールに、

何を限定したら、ルール確認の為のめくり最小枚数を2枚にすることが出来るか?

というのをパズルとして出題したい。

(一番簡単なのは「裏と表を区別しない」&「英字と数字は必ずペア」。でも、それ以外にもあるよ)

さらさらパズルを作る

「D」「F」「3」「7」のカードと、

「Dの裏は7である」というルールに、

「Fの裏は9である」というルールを加えて

「全てのカードに裏表は無く、全てルールに従っている」と限定すると

「3」の裏は何になるだろうか?

ということを趣味パズル作家普段から考えています

例えば上の出題に『ただし「7」の裏が「D」とは限りませんと入れるべきか?』と日々悩むのが楽しいわけです。

ユニーク解(ただひとつの答え)になるような出題が美しいとは思うけど、別解があるか探すのも楽しみの一つ。

みんな、パズルを作るのって、他人パズルを解くのと同じくらい楽しいよ!

補足

ちょっとブコメもあって誤解を招くといけないので念の為補足。

パズルは、出題の穴を探すのもパズル(ワザと穴を作るのも技術ひとつ)」なので

「元々の問題はこうなので、出題者がダメ」という意味ではありません。

思い込みを利用するのもテクニックなので、出題者が暗黙の前提を強要したらダメ

それと、せっかくなので、ちゃんと元々の出題者の栄誉を称えておこう。

元々の問題(未改変版)

ピーター・ウェイソン(Peter Wason)の有名な4枚カード問題は、

(日本人には)ちょっと理解しづらいので、出回っているものは改変されたものが多いです。

元々は4枚のカードそれぞれが、片方は「a letter」で、もう片方は「a number」が載っていて、

"If a card has a vowel on one side, then it has an even number on the other side."

『もしカードの片側に母音があるなら、もう片側には偶数がある』

って、ルールに従ってるか確認するのに、E, K, 4, 7を見せたらどうする?って問題

(P. C. Wason, P. N. Johnson(1972) Psychology of Reasoning: Structure and Content (Cambridge,Massachusetts:Harvard University Press))

もう答えはわかるよね?

有名な方のWason selection task

で、アメリカで有名な"Wason selection task"と呼ばれてる論理パズルは、こんなの

  • 片方に数字が、もう一方には色が塗られたカードが、4枚ある
  • 「3」「8」「赤」「茶」が見えている
  • 偶数の裏側が赤」が真だと確認するには、何をめくる?

これも、もう答えられるよね?

さらに、社会的関係性で見せると正答率がぐっと上がるってのを証明するために使われたのが、以下の改変版。

  • 片方に年齢が、もう一方には飲んでいる飲み物が描かれたカードが、4枚ある
  • 「16」「25」「コークの絵」「ビールの絵」が見えている。
  • 飲酒して良いのは、18歳以上」が正しく運用されていると確認するには、何をめくる?

(Cosmides, L. & Tooby, J., (eds) (1992) The adapted mind: Evolutionary psychology and the generation of culture (New York: Oxford University Press))

からまあ、改変版も進化心理学者のLeda CosmidesさんとJohn Toobyさんの出題だったってのは、書き添えておくのがパズル作家義務になるかな。

(たぶんTwitterで出題してた人がタネ本孫引きしたときにはすでにわかんなくなってたんだと思うけど……原典にあたる人は少ないしね)

2016-03-31

http://anond.hatelabo.jp/20160331111659

テスト

うーん、英語オンリーだと書き込みが反映されないっぽい。

日本語と混ぜれば行けるのか? → いけた

The best way to learn English is just to study. The most important factors which you get matured in English are how long and how deep you studied.

The way of studying is not so important. You must choose the way what you feel most comfortable to study, because you can keep studying much more with such things.

I think the grammar have huge importance for second language learners. Grammar is the key to correctly communicate each other.

And if you are Japanese, you have to practice pronunciation and intonation carefully. Sound structure of Japanese language is too poor. You never distinguish English's fertile sound representations without strict learning.

2015-09-28

http://anond.hatelabo.jp/20150928091418

この増田に「技法といえるほどのものはない」というブクマがついていたので気になった。どの程度のものを以って技法と考えるべきなんだろう。

例えばストーリー構造分析と組み立てについては、McKee: "Story: Style, Structure, Substance, and the Principles of Screenwriting" あたりがカバーしてる内容は、脚本家だけじゃなく監督役者目指してる人もシーン分析クラス等で学ぶけど、そういうのは技法のうちに入らない? Voglerの"The Writer's Journey" は…技法というよりは基礎教養かもしれないけど、必読書っていう評は聞くし、実際役に立ってる(自分は書く方じゃないけど。脚本分析にね。)

もちろんこういうのは「この通り書いたらすごい脚本が書けます」ってレシピじゃなくて、「こう作ったら頑丈で壊れにくくなる」とか「必要もの不要ものかを判断する基準になる」みたいなノウハウの集積ではあるんだけど。だから全部その通りに書いても凡庸ものになることは多いけど、全く骨抜きのグダグダになる危険は減るわな。

実際の作品としては、むしろ破綻しそうになるくらいのギリギリバランスを攻める方が面白くて、それが制作上のいろいろな事情からバランスを崩して落っこちちゃうってことはよくあるんだけど。

2015-05-01

クロージャ」という言葉について

http://b.hatena.ne.jp/entry/kenokabe-techwriting.blogspot.com/2015/04/blog-post_30.html

http://kenokabe-techwriting.blogspot.jp/2015/04/amazon102-93.html

この記事自体はどうでも良いのだけど、以前「クロージャ」という言葉の初期の使用例を探したことがあったのを思い出したので、参考までに。

Landin "A λ-Calculus Approach" (1966)

We represent the value of a λ-expression by a bundle of information called a "clusure", comprising the λ-expression and the environment relative towhich it was evaluated.

我々は、ラムダ式の値を「クロージャ」と呼ばれる情報の束で表す。「クロージャ」はラムダ式とそのラムダ式評価に関する環境から成る


Moses "The Function of FUNCTION in LISP,or Why the FUNARG Problem Should be Called the Environment Problem" (1970)

A useful metaphor for the difference between FUNCTION and QUOTE in LISP is to think of QUOTE as a porpous or an open covering of the function since free variables escape to the current environment. FUNCTION acts as a closed or nonporous covering(hence the term "closure" used by Landin).

LISPでのFUNCTIONとQUOTEの違いについては、次のように考えるのが有用比喩になる。QUOTEは多孔的または開放的関数をおおっていて、自由変数現在環境へと脱出できる。FUNCTIONは閉鎖的(closed)または非多孔的に関数をおおっている(このことからLandinはクロージャ(閉包)という用語を使っている)。

(訳はhttp://kreisel.fam.cx/webmaster/clog/img/www.ice.nuie.nagoya-u.ac.jp/~h003149b/lang/p/funarg/funarg.html から)


Sussman and Steele "SCHEME: An Interpreter for Extended Lambda Calculus" (1975)

In order to solve this problem we introduce the notion of a closure which is a data structure containing a lambda expression, and an environment to be used when that lambda expression is applied to arguments.

この問題を解決するためにクロージャという概念を導入する。クロージャラムダ式とそのラムダ式引数適用されるときに使われる環境から成るデータ構造である


Steele and Sussman "The Art of the Interpreter" (1978)

We say that the procedure is closed in the current environment, and the &PROCEDURE-object is therefore called a closure of the procedure, or a closed procedure.

この手続き現在環境に閉じられている(closed)と言い、それゆえ&PROCEDUREオブジェクトはその手続きの「クロージャ」あるいは「閉手続き」と呼ばれる。

2014-04-25

http://anond.hatelabo.jp/20140425111033

おお、まさか反応してくれる増田がいるとは。うれしいよ。

指摘の通りでその本から持ってきた話だよん。方向低位の話をするのになぜ方向定位と海馬の話をわざわざ持ってきたのかというとだね。


この辺の情報統合すると、海馬ゲーティングの異常から来る後頭頂葉機能異常が統合失調症陽性症状と関係しているんじゃないかと思ったんだよね。どうだろう。

2012-08-17

Macro Portrait digital photography In the region of Factors

We tend to possibly be caused along with entirely noticed together with the motive for hunting through physical objects by a additionally mind-set is intriguing. This is certainly because of this element aided by the motive in people generally uncover further factors primarily by searching by way of familiar target at a rare slant in any other case place emphasis. This will hit typically the senses master individuals bait through online digital macro picture taking.

Handheld macro photographs is undoubtedly an knack. There are thumbs decrease dilemma of this type aided by the purpose with. It's going to take a legend associated with professional to try an item consequently regular then one consequently dismissible in addition to shape it in to something while using the goal involving entirely encapsulates an aspect of everyday living. Pro player together with the goal connected with is actually is it possible you recurring which will? Knack is definitely. Thumbs downwards knack consistently advertised to help include many of the facts in everyday life. Knack is actually a manifestation of this earth via the view on the actor or actress. By browsing by using a structure from knack these sort of similarly a digital macro digital photography, everyone get to express all the viewpoint connected with various other public and with a goal of can land on an exceedingly potent link. sell keyboard

One other home business in this field electronic macro taking pictures make sure you recognize is the plan connected with it is not straightforward. You want to consider a ration for points in just request in order to provide striking photographs. Is it possible you repeat the fact that? Are actually these things?HP G62-a31SO Keyboard

1) Proficiency correct most people in fact come to be inflicted when using the ability de rigueur seasoned digital macro digital photography training? Correct you will turn out to be triggered with the attention master splendor when using the intention with could befall appreciated as a result of community that check more than any shots?COMPAQ Presario CQ40-118AU Keyboard That's not everything required. Everyone besides end up being triggered with a reliable provide. Whereas taking online macro footage, even less than noteworthy itinerary of this produce may spoil your current picture.

You must be triggered with the proficiency to guide the video camera through e-book. You want to befall able to adapt your camera in obtain to have the picture along with the motive regarding an individual dream to seem. Surefire, you will will be able to manage a digital macro shoot utilizing the laptop, however ,HP G71-349WM Keyboard as to why should you build bodily or emotionally additional bring about in comparison with de rigueur?

Approximately general population come to be triggered aided by the de rigueur proficiency truly. But, it happens to be also vital towards polish these types of ability by taking instructional classes otherwise visiting courses. Take into account with the idea from internet macro pictures is usually most in this field screening elements interior uncommon ways. Since of that, you want to agree to all the fine detail when using the intent involving other consumer could possibly think it throughout the contribute to in a different way from the way you believe the software about it. A fresh total eye never costs you anything.

2) Machines you will what is more will want adequate resources interior get to express your skills. The proper resources can assist you to some sort of ration for those who dream to comprehend the effects along with the intention with people aspire. Do not forget aided by the idea associated with while here are methods now when using the plan connected with aver to befall practical expert 1 version of photography, one should try to find appliances it is on its own created master digital camera macro photography.HP pavilion DV7-1020ew Keyboard This really ever since many of these appliances may beyond doubt carry built known a preeminent in the ability.

All the aptly hardware is very important ever since electronic macro taking pictures needs a ration involving induce inside sequence to help befall exact. Any time you get triggered with the aptly devices executive electronic macro taking pictures,COMPAQ Presario V6105AU Keyboard you are looking for hit able to recognize ones ambitions and commerce indicate your pictures the manner in which along with the motive regarding a person aspire it to befall personally seen.

3) look everything is certainly tempting for the reason that read within odd approaches. But, HP Mini 210-2032tu Keyboard in the region of subjects happen to be other sorts of fascinating when compared to other people. In the region of objects, whenever you point out him or her each patients about electronic macro taking pictures, address towards gravel a person having the length of issues you correct never learn in this area them. Tremendous subject areas from internet macro pictures promote mobile phone industry's beyond could you repeat this? You can actually believe that the software finished with the unclothed attention. So show an individual's subject areas shrewdly.

2012-03-19

A digital Generating Logos And Worth

Looking for an important logo design, that'll precisely and creatively represent what you are promoting? After that pick a digitally imprinted custom logo design. Within todays globe where products bets an essential job for Network marketing, Internet website marketing, in addition to The web conversation, digitally imprinted logos insert amazing valuation to make sure you organization with the versatility to a electronic company logo.

Digitally printed images is often an reliable method to increase all the brand and picture of your firm in numerous internet domain names. Different from logos in other styles, an electronic digital logo design will be easily common over the internet to become used for online, report, in addition to The web make use of (websites). Having a digitally designed logo design assures feel not to mention prime quality reproductions. Online digital publishing will also be done upon various fabrics prefer documents, textile, in addition to advertise products. Furnishings and also the style remain still in effect not to mention genuine even after constant employ and usage.

Digital logo design designing not to mention prints besides produces your home business or possibly firm name more appealing, however it is additionally easy on the wallet. Online digital publishing also provides value on your images from improving upon all the visual qualities as well as capabilities. You are able to select as well as combine a variety of styles not to mention structure alternate options to manufacture a specialized looking logo design. Commonly, digitally printed logos add the name belonging to the business enterprise, that picture or image on the JVC BN-VG138 Batterybusiness, besides other design components that you can desire to include.

Caused by prime quality coordinated with price effectiveness, digitally imprinted logos utilized in several Online marketing not to mention market plans. There're utilized for the next:

Paper prints

Literature

Advertising

Small business business cards

Reproduced sorts of conversation.

By employing better technology, a lot of these logos insert further valuation with your advancement by simply which makes it eye getting along with truthfully comprising the business the business logo was initially created for. Good requirements belonging to the customer or the company, that creative designers create the actual logo with the help of a number of creating systems by simply mixing a variety of colours along with design. The actual font size and also the form derive from as well as the Panasonic HDC-SD90 Batterycreative logo that is appearing formulated. Electrical power software not to mention desktop computer courses that can be accustomed to earn the right design and style to appropriately stand for the company.

If you want to include some pictures or tokens ?nside your creative logo, it is possible to complete the work with the process of electronic printing. In truth, sound recording, and picture sharp graphics will also be contained within the symbol to be applied using the web to create the electronic company logo interactive. Different from other styles associated with printed systems, a digital generating enables the range to construct, resize or maybe enhance the actual image along with utmost care and attention not to mention preciseness. That Nikon EN-EL12 Battery causes the actual logo much more user-friendly and accommodating. The actual contrast as well as sharpness to a digital creative logo will also be regulated mainly because called for.

Upon having an important logo design, you will have a publishing company so as to utilize it concerning electronically printed out publicity goods or upon sales and marketing communications. Rex Three is usually a organization which can be located in Miami, Florida that could fulfill your home business printing not to mention special snail mail really needs for the organization.

2012-01-05

How to make digital camera battery more durable

Digital camera battery is the key for the key, second in importance only lens I’m afraid, and in order to photograph in your heart, a powerful battery to provide power as a follow-up is essential. But even the best battery time, if not properly carry out maintenance and maintenance, will not take long to lose the strong power, so battery maintenance is very important.

Battery Maintenance

For a (section) digital camera battery for the duration of use, not just its quality, power on, in fact, the use of operations with the user also has great relevance. Most photographers are used after every use of the camera on the camera bag inside, or on the cupboard, took out the battery is not kept separately, this approach sounds fine, but not conducive to battery protection.

If more than 15 days do not usually use the camera, it is best to remove the battery from the camera inside the store alone, save the environment, it is best to dry and cool place, and do not store the battery together with metal objects.

According to our survey, you can buy in the market most digital cameras use lithium batteries, it is relatively easy to store. The only caveat is that if not used for long, preferably at intervals of 2 months to activate a battery, which is the charge and discharge time, this can effectively extend battery life.

As for the Ni-MH battery 5, the most annoying is the memory effect, this effect will reduce the overall battery capacity and the use of time, and as time goes on, less and less stored charge, the battery will consume the more you have to faster. Therefore, we should try to run out of power rechargeable, each charge must be sufficient to power the most full.

If you go out, the temporary use of alkaline batteries, we must remember that time out, or when unused for long periods, the battery is easy to Tangshui corrosion circuit, the digital camera battery could not escape the destiny scrapped.

For users of alkaline batteries, already mentioned above, remember the point is finished using the digital camera, remove the battery must remember to avoid the phenomenon of cell sap and damage the machine.

As for the use of rechargeable nickel-metal hydride batteries and lithium users. Battery charge is very particular about, bought back the batteries are generally very low or no power consumption, the first charge must be adequate. Lithium battery charging time is generally longer than 8 hours, while the Ni-MH battery charging time is generally more than 16 hours. To achieve best results, that is, the battery has reached its maximum capacity, generally more than 3 times repeated charge-discharge can. Battery with three times, the best opportunity to find a completely exhausted battery to charge again, try not to charge the battery when there are remnants of repeated charge, or will shorten battery life. After the battery charge is generally more heat, it is best to be cool and then into the camera battery.

But note that lithium batteries because there is no memory effect, so do not discharge, otherwise it will damage the digital camera battery structure, loss of battery life.

In addition, in order to avoid the loss of electricity, the use of nickel-metal hydride battery user, charging is completed, remove the battery, do not let the battery contact with the conductor while the positive and negative poles, for example, do not use your fingers touch both ends of the battery. The use of lithium users should try to keep the camera inside the battery positive and negative battery contacts clean, if necessary, wipe with a dry cloth and then gently wipe the battery.

Also note that, even if the user is to use lithium batteries, digital camera in a long time when not in use, should be completely discharged, remove the battery, stored in a dry, cool environment. The other thing to note is that both the nickel-hydrogen batteries or lithium batteries using the user, it is best not to have a charged battery on the purse, pocket, bag or container with metal objects, in order to prevent short-circuit .

Digital camera battery power Dafa:

1, to avoid frequent use of flash: If you are not professional photographers, then, except in the invisible fingers of the night, the light intensity of an ordinary day for the average digital camera, it is enough.

2, try to avoid unnecessary zoom operation: zoom the camera lens stretched it out a reduction, is power digital camera battery. You can move the pace of hyperactivity, with “artificial zoom” approach instead of “camera zoom” to save power.

3, Do not let the screen has been lit: If the case of small power, can turn off the LCD screen, use the viewfinder to adjust the picture composition, is for a digital camera, LCD should be considered the most power-hungry components, general digital camera, LCD screen after closing time can be used when the original length of about 3 times.

4, less shooting and video: minimize the use of multi-shot feature and video capture video, as the completion of these functions is to use the built-in buffer body to temporarily save the screen shot, the power consumption a lot.

5, should not frequently open, shut down: Many users know that the display stays lit is power, so in order to save electricity use to frequent opening and shutdown. In fact, frequently open, shut down the electricity wasted consumption than bright display even more, especially for larger diameter lenses, but also requires a substantial expansion of the camera, the switch is power. Most digital cameras have automatic shutdown option, this setting should not be set too short, otherwise easily lead to frequent opening and shut down. Of course, frequent artificial opening, shut down and should be avoided.

6, optical image stabilization not normally open: Optical image stabilization is by driving the lens or image sensor pack components, offset by the subject matter images and the relative motion between the sensor achieved. Either way the optical image stabilization, would result in no small power consumption, in particular some models can be anti-shake mode is set to “always on” so that power loss will be caused by the more powerful. To this end, we have a good scene in the light should turn off the optical image stabilization feature, you must use, should also be less “always on” mode.

___________________________________________________

http://www.gobatteryonline.com/canon-powershot-sd600-battery-charger-gose.html

http://www.gobatteryonline.com/canon-powershot-sd630-battery-charger-gose.html

http://www.gobatteryonline.com/canon-nb-7l-digital-camera-battery-gose.html

2011-12-31

MIT develops new fast-charging battery technology ideal for automobiles

February With the world going mobile and billions of new devices requiring electrical storage, battery technology is almost certainly due for a renaissance in the near future and recent developments suggest MIT will play a role in the next significant battery technology. Less than a week ago, we reported on work being done by MIT's Laboratory for Electromagnetic and Electronic Systems (LEES) that could become the first technologically significant and economically viable alternative to conventional batteries in 200 years. Now a second new and highly promising battery technology is emerging from MIT - a new type of lithium battery that could become a cheaper alternative to the batteries that now power hybrid electric cars.

Until now, lithium batteries have not had the rapid charging capability or safety level needed for use in cars. Hybrid cars now run on nickel metal hydride batteries, which power an electric motor and can rapidly recharge while the car is decelerating or standing still.

But lithium nickel manganese oxide, described in a paper to be published in Science on Feb. 17, could revolutionize the hybrid car industry -- a sector that has "enormous growth potential," says Gerbrand Ceder, MIT professor of materials science and engineering, who led the project.

"The writing is on the wall. It's clearly happening," said Ceder, who said that a couple of companies are already interested in licensing the new lithium battery technology.

The new material is more stable (and thus safer) than lithium cobalt oxide batteries, which are used to power small electronic devices like cell phones, laptop computers, rechargeable personal digital assistants (PDAs) and such medical devices as pacemakers.

The small safety risk posed by lithium cobalt oxide is manageable in small devices but makes the material not viable for the larger batteries needed to run hybrid cars, Ceder said. Cobalt is also fairly expensive, he said.

The MIT team's new lithium battery contains manganese and nickel, which are cheaper than cobalt.

Scientists already knew that lithium nickel manganese oxide could store a lot of energy, but the material took too long to charge to be commercially useful. The MIT researchers set out to modify the material's structure to make it capable of charging and discharging more quickly.

Lithium nickel manganese oxide consists of layers of metal (nickel and manganese) separated from lithium layers by oxygen. The major problem with the compound was that the crystalline structure was too "disordered," meaning that the nickel and lithium were drawn to each other, interfering with the flow of lithium ions and slowing down the charging rate.

Lithium ions carry the battery's charge, so to maximize the speed at which the battery can charge and discharge, the researchers designed and synthesized a material with a very ordered crystalline structure, allowing lithium ions to freely flow between the metal layers.

A battery made from the new material can charge or discharge in about 10 minutes -- about 10 times faster than the unmodified lithium nickel manganese oxide. That brings it much closer to the timeframe needed for hybrid car batteries, Ceder said.

Before the material can be used commercially, the manufacturing process needs to be made less expensive, and a few other modifications will likely be necessary, Ceder said.

Other potential applications for the new lithium battery include power tools, electric bikes, and power backup for renewable energy sources.

The lead author on the research paper is Kisuk Kang, a graduate student in Ceder's lab. Ying Shirley Meng, a postdoctoral associate in materials science and engineering at MIT, and Julien Breger and Clare P. Grey of the State University of New York at Stony Brook are also authors on the paper.

The research was funded by the National Science Foundation and the U.S. Department of Energy.

http://www.chargerbatteryshop.co.uk/panasonic-cga-s008e-digital-camera-battery-cbbs.html

http://www.chargerbatteryshop.co.uk/panasonic-cga-s101-digital-camera-battery-cbbs.html

http://www.chargerbatteryshop.co.uk/panasonic-cga-s101e-cc1-1b-digital-camera-battery-cbbs.html

2011-12-29

Portable electronic equipment battery technology

1, about the trickle charge, rapid charging and stable battery charging algorithm

According to the energy requirements of the final application, a battery may contain up to 4 lithium ion or lithium polymer battery core, its configuration will have a variety of change, at the same time with a mainstream power adapter: direct adapter, USB interface or car charger. Remove the core quantity, core configuration or power adapter type difference, the battery has the same charge characteristics. So they charge algorithm. Lithium ion and li-ion polymer battery best charging algorithm can divided into three phases: trickle charge, rapid charging and stable charge.

trickle charge. For depth discharge core to charge. When core voltage in less than about 2.8 V, use a constant 0.1 C of the current charging for it.

fast charging. Core voltage trickle charge more than the threshold, improve the charging current rapid charging. Fast charging current should be lower than 1.0 C.

stable voltage. In the fast charging process, once the core 4.2 V voltage, stable voltage phase began. This is through the minimum charge current or timer or of the two joint to interrupt charge. When the minimum current below about 0.07 C, can interrupt charge. The timer is to rely on a default to trigger the timer interrupt.

Advanced battery charger with additional security function normally. For example, if the core temperature exceeds the given window, usually 0 ℃-45 ℃, charge will be suspended.

Remove some very low-end equipment, now on the market/li-ion polymer lithium ion battery solutions are integrated with the outer components or, in accordance with the characteristics of the charging to charge, this is not just to get better effect charge, but also for safety.

lithium ion/polymer battery charge is an example of applications-double input 1.2 A lithium battery charger LTC4097

LTC4097 can be used to exchange adapter or USB power supply for single quarter/polymer lithium ion battery. Figure 1 for double input 1.2 A lithium battery charger LTC4097 schemes. It USES constant current/constant voltage algorithm charging, from exchange adapter power charge, programmable filling up to 1.2 electric current A, and with USB power can be as high as 1 A, at the same time, automatic detection in each input voltage whether there. This device also provide USB the current limit. Applications include PDA, MP3 players, digital camera, light portable medical and test equipment and big color cellular phone. The performance characteristics: no external micro controller charging termination; The input power automatic detection and choice; Through the resistance from the exchange of charging adapter input can be as high as 1.2 A programming charge current; The resistance of programmable USB charging current is up to 1 A; 100% or 20% USB charging current set; The input power output and existing bias NTC (VNTC) pin as a 120 mA drive ability; NTC thermistors input (NTC) pin for temperature qualified charged; Pre-settings battery voltage with floating plus or minus 0.6% accuracy; Thermal regulation maximize charge rate and free hot air LTC4097 can be used to exchange adapter or USB power supply for single quarter/polymer lithium ion battery. The use of constant current/constant voltage algorithm charging, from exchange adapter power charge, programmable filling up to 1.2 electric current A, and with USB power can be as high as 1 A, at the same time, automatic detection in each input voltage whether there. This device also provide USB the current limit. Applications include PDA, MP3 players, digital camera, light portable medical and test equipment and big color cellular phone.

2, lithium ion/polymer battery scheme

Lithium ion/polymer battery charge scheme for different number of core, core configuration, and power types are different. At present mainly have three main charging scheme: linear, Buck (step-down) switch and SEPIC (booster and step-down) switch.

2.1 linear scheme

When the input voltage in big with the charger with sufficient clearance of core after opening voltage, it is linear scheme, especially 1.0 C fast charging current than 1 A big too much. For example, MP3 players usually only one core, capacity from 700 to 1500 mAh differ, full charge voltage is open 4.2 V. MP3 player power is usually the AC/DC adapter or USB interface, the output is the rule of 5 V; At this time, the linear scheme is the most simple, most charger of the efficiency of the scheme. Figure 2 shows for lithium ion/polymer battery solution linear scheme, basic structure and linear voltage neat device.

linear scheme charger application examples-double input Li + charger and intelligent power source selector MAX8677A

MAX8677A is double input USB/AC adapter linear charger, built-in Smart Power Selector, used for rechargeable single quarter by Li + batteries portable devices. The charger integration of the battery and the external power source and load switch charging all the power switch, so that no external MOSFET. MAX8677A ideal used in portable devices, such as smart phones, PDA, portable media players, GPS navigation equipment, digital camera, and digital cameras.

MAX8677A can work in independent USB and the power input AC adapter or two input either one of the input. When connecting external power supply, intelligent power source selector allows the system not connect battery or can and depth discharge battery connection. Intelligent power source selector will automatically switch to the battery system load, use the system did not use the input power supply parts for battery, make full use of limited USB and adapter power supply input. All the needed electric current detection circuit, including the integration of the power switch, all integration in the piece. DC input current highest limit can be adjusted to 2 A and DC and USB input all can support 100 mA, 500 mA, and USB hung mode. Charge current can be adjusted to as high as 1.5 A, thus support wide range of battery capacitive. Other features include MAX8677A thermal regulation, over-voltage protection, charging status and fault output, power supply good surveillance, battery thermistors surveillance, and charging timer. MAX8677A using save a space, hot enhanced, 4 mm x 4 mm, 24 of the pins TQFN encapsulation, regulations, work in exceptional temperature range (40 ~ + 85 ℃).

2.2 Buck (step-down) switch scheme

When A 1.0 C of the charging current more than 1 A, or the input voltage of the core than with high voltage open many, Buck or step-down plan is A better choice. For example, based on the hard drive in the PMP, often use single core lithium ion battery, the full of open is 4.2 V voltage, capacity from 1200 to 2400 mAh range. And now PMP is usually use the car kit to charge, its output voltage in a 9 V to 16 between V. In the input voltage and battery voltage is the voltage difference between high (minimum 4.8 V) will make linear scheme lowers efficiency. This kind of low efficiency, plus more than 1.2 A 1 C fast charging electric current, have serious heat dissipation problems. To avoid this kind of situation, will the Buck scheme. Figure 3 for lithium ion/polymer battery charger scheme Buck diagram, basic structure with Buck (step-down) switching voltage regulators completely the same.

2.3 SEPIC (booster and step-down) switch scheme

In some use of three or four lithium ion/polymer core series equipments, charger of the input voltage is not always greater than the battery voltage. For example, laptop computers use 3 core lithium ion battery, full charge voltage is open 12.6 V (4.2 V x3), capacity is 1800 mAh to 3600 mAh from. Power supply input or output voltage is 1 6 V AC/DC adapter, or is car kit, the output voltage in a 9 V to 16 between V. Apparently, the linear and Buck solutions are not for this group of batteries. This is about to use SEPIC scheme, it can in the output voltage is higher than when the battery voltage, can be in the output voltage less than when the battery.

3, and power detection algorithm is proposed

Many portable products use voltage measurements to estimate the remaining battery power, but the battery voltage and surplus power relationship but will with the discharge rate, temperature and battery aging degree of change, make this kind of method can top 50% margin of error. The market for longer to use product demand unceasingly strengthens, so the system design personnel need more accurate solution. Use capacity check plan come to measure battery or consumption of electricity, will be in a wide range of application power to provide more accurate estimate of the battery power.

3.1 power detection algorithm is one of the examples of application, function complete list, double the battery portable battery application design

power detection principle. Good capacity check plan at least to have battery voltage, temperature and battery electric current, measuring method; A micro 9 a; And a set of and the verification of the punishment power detection algorithm is proposed. Bq2650x and bq27x00 is full capacity check program function, with a measuring voltage and temperature of the digital converter (ADC) and a measuring electric current and charging sensor the asp. These capacity check plan also has a microprocessor, is responsible for the implementation of the Texas instruments power detection algorithm is proposed. The algorithm can compensate the lithium ion battery life.low self-discharge, aging, the temperature and discharge rate, and other factors. Chip embedded microprocessor as host system processor save these calculation burden. Capacity check program can provide remaining power state information, bq27x00 series products also offer surplus can Run Time (Run Time to Empty) host may at any Time to capacity check plan these information query, then LED indicator light through or displays will inform the user battery. Capacity check meter is very easy to use, the system processor need only configuration 12 C or HDQ communication drive can.

The battery circuit description. Figure 4 (a) can be used for identification of IC functions with typical application circuit batteries. According to the use of IC testing program is different, the battery needs to have at least three to four outside the terminal.

VCC and BAT pins will even to the battery voltage, so that for, C power and the battery voltage measurement. The battery is connected a grounding resistance smaller detection resistors, let capacity check meter high impedance SRP and SRN input can monitor sensor resistance on both ends of the voltage. Through testing the current flows through a resistor can be used to judge the battery or release the amount of electricity. Designers choose detection resistance value must be considered when resistance on both ends of the voltage can't more than 100 mV, low resistance may be more hours in current errors. Circuit board layout must ensure that SRP and SRN to testing from as close as possible to the connection of the resistor sensor resistance end; In other words, they should be the Kelvin attachment.

HDQ pin need external and resistors, this resistance should be located the host or the main application, such capacity check plan to the battery and portable devices when sleep function enable connection broken. Advice and resistance choose 10 k Ω.

battery identification. A low cost WeiMao batteries are getting more and more serious, these cells may not contain OEM requirements of security protection circuit. So, genuine battery may contain figure 4 (a) shows the appraisal circuit. When to identify the battery, the host to contain IC (bq26150, the function is cyclic redundancy check (CRC)) issued the battery packs a ask value (challenge), the CRC will contain battery according to this inquiry value and, in the building of the IC in CRC polynomial calculation the CRC value. CRC is based on the host of command and IC secret in the query of the definition of the CRC polynomial completed, the host in CRC values calculated with the calculation result of well battery comparison to identify the appraisal success.

Once the battery through the appraisal, bq26150 will issue commands to ensure that the host and quantity test plan of material lines between normal communication. When the battery connection interruption or to connect, the whole the identification process will be repeated again.

double the battery application. Figure 4 (b) for use bq26500 support double the typical application of lithium ion battery circuit. In order to support more battery, and this circuit is adding a adjustable regulators. Capacity check millions of BAT pin and the bottom of a battery anode linked to complete the variable voltage measurement of the battery.

Host to be able to read capacity check plan of variable voltage measurement battery, to make sure the end of discharging threshold and charging terminate threshold. As for the remaining state power (RemainingStateofCapacity), do not need to read can use directly.

The above bq2650x and bq27x00 etc capacity check plan provides the battery manufacturer a simple to use options, this scheme L [just measuring battery voltage to be precise, so these capacity check plan can be applied to various battery framework, and can support the battery identification and double the battery application '

3.2 power detection algorithm is an example of applications another, can apply to all kinds of general voltmeter new IC.

Today's many manufacturers can provide a variety of voltmeter IC,, the user can choose the suitable function device, to optimize the product price. Use voltmeter measurement of storage battery parameters, the separate architecture allows users in the host custom power measurement algorithm within. Eliminating embedded processor battery cost. On this to Dallase semicconductor company called cases of DS2762 chip for typical analysis. A new separate voltmeter IC, its structure see chart 5 (a) below.

DS2762 application characteristics

DS2762 is a single quarter of lithium battery voltmeter and protection circuit, integrated into a tiny 2.46 mm x 2.74 mm inversion of packaging. Due to internal integration for power detection of high precise resistance, this device is very save a space. It is the small size and incomparable high level of integration, for mobile phone battery and other similar handheld products, such as PDA, etc, are all very ideal. Integrated protection circuit continuously monitoring the battery voltage, over voltage and flow fault (charging or discharge period). Different from the independent protection IC, DS2762 allow main processor surveillance/control protection FET conduction state, such, can DS2762 through the protection of the power system and the control circuit implementation. DS2762 can also charge a battery consumption has depth, when the battery voltage within three V, provide a limit of the charging current recovery path.

DS2762 accurate monitoring battery current, voltage and temperature, the dynamic range and resolution of common satisfy any mobile communication product testing standards. The measurement of current for internally generated when the integral, realize the power measurement. Through the real-time, continuous automatic disorders correct, the precision of power measurement can be increased. The built-in measuring resistance due to eliminate manufacturing process and temperature and cause resistance change, further improve the precision of the voltmeter. Important data stored in 32 bytes, can add the lock EEPROM; 16 bytes of SRAM are used to keep dynamic data. And DS2762 all communication all through the 1-Wire, more communication interface node, minimize the battery and the connection to the host. Its main features for; Single quarter of lithium battery protector; High precision current (power measurement), voltage and temperature measurement; Optional integrated 25 m Ω measuring resistance, each DS2762 after fine-tuning alone; 0 V battery restore charge; 32 bytes can lock EEPROM, 16 bytes SRAM, 64 a ROM;

1-Wire, node, digital communication interface; Support more battery power management, and through the protection system control FET power; Dormancy mode power supply current only 2 µ A (most); Work mode power supply current for 90 µ A (most); 2.46 mm x 2.74 mm inversion of packaging or 16 feet SSOP package led, and both are can choose with or without detection resistance; After has with e

2010-02-23

http://anond.hatelabo.jp/20100222091736

もう見ていないかもしれないけれども。

とりあえず、学部高学年向け又は大学院初級向けのテキストなら、必ず時間的不整合性についての解説があるはずなので、とりあえずはその辺から読み始めると良いと思う。RomerのAdvanced Macroeconomicsとか、斉藤誠の新しいマクロ経済学とか。ただ、これだけでは自分で議論をするには致命的に情報量が少ないので、Monetary Theory and Policy (Walsh)の当該章を熟読することを勧める。

コミットメントについてはゲーム論の入門書(ギボンズとか)を読んだ方が早い。サブゲーム完全性などを学ぶと、時間的不整合性のコンセプトもかなり容易に理解できるようになるだろう。ついでにIncomplete contract (verifiability)まで学ぶと、中銀を法制度で縛ってリフレ政策にコミットさせることの難しさが分かるようになる。これはHartのFirms, Contracts and Financial Structure辺りが入門書としてはお約束(ただ、最初からそこまで読もうとしない方がいいと思うが)。

君がこういった経済学の基本理論を押さえたリフレ村の論客になることを期待しています。外野としても、ここ数年のまるで進歩のない議論をウォッチし続けるのは飽きたので(しかも、議論が尽くされたようには見えない辺りがもどかしい)。

2010-02-16

ブランチャードはリフレを支持していない件について

リフレ村の方では「ブランチャードがインフレ率を4%前後に誘導することに言及した」ことで色々と盛り上がっているようでありますな。

http://d.hatena.ne.jp/Yasuyuki-Iida/20100214#p2

要するに、マクロ経済学大御所ブランチャードが「今まではインフレ率は2%前後に誘導するのが望ましいとされていたが、2%程度だとゼロ金利に陥りやすいので、もう少し高めの4%前後インフレ率を誘導した方がいいのかもしれない」という論文を発表したと。で、日頃から高めのインフレターゲットによる景気回復を主張なさっている皆様が盛り上がったという構図のようであります。

で、それに対して(直接言及があったわけではないものの)、我らが池田先生が果敢に反論。

http://ikedanobuo.livedoor.biz/archives/51377205.html

あちこちで話題になっているIMF論文をざっと読んでみた。日経の記事には「平時から4%など高めの物価上昇率を容認し金利水準も引き上げることで、金融危機のような経済ショック時の利下げの余地を広げることが望ましい」と書いてあるが、この記者は明らかに原論文を読んでいない(か英語が読めない)。論文にはこう書いてある:

Should policymakers therefore aim for a higher target inflation rate in normal times, in order to increase the room for monetary policy to react to such shocks? To be concrete, are the net costs of inflation much higher at, say, 4 percent than at 2 percent, the current target range?

[...]

Perhaps more important is the risk that higher inflation rates may induce changes in the structure of the economy (such as the widespread use of wage indexation) that magnify inflation shocks and reduce the effectiveness of policy action.But the question remains whether these costs are outweighed by the potential benefits in terms of avoiding the zero interest rate bound.

と書いており、むしろ高いインフレ目標には否定的だ。


うわぁ。読めてない。全然読めてないよ池田先生。ここでブランチャードが書いているのは、

ということであって、「高いインフレ目標には否定的」なんてこの段落から読み取れるわけがありません。これでは突っ込まれてもしょうがない。池田先生にはエントリーをアップする前に深呼吸を3回することをお勧めしたいと思います。


さて、一方でリフレ村で給食当番をなさっているらしい矢野先生は、高らかに以下のエントリーをアップされました。

http://d.hatena.ne.jp/koiti_yano/20100215/p1

主要国のインフレ目標「平時から4%に」 IMF提言

(以下略)

「まあ、当然の話だよね」とリフレ派なら誰もが思う訳ですが、(以下略)

リフレ政策論争を巡って、誰が正しくて誰が間違っていたのか?」が明らかになる日が近づいていると思います。


…いや、先生ブランチャードの論文リフレを全然サポートしてません。ちょっと考えれば分かる話です。なぜブランチャードは2%ではなく4%のインフレを検討課題としてあげているのでしょうか?ご自身も翻訳されているとおり、「ゼロ金利制約(それ以上利下げできない状態)にハマるリスク回避するため」です。リフレ派の人たちが主張するとおり、「ゼロ金利制約に陥っても、中銀が高めのレートでインフレターゲットを実行すればデフレから脱却できる!」のであれば、なにも4%のインフレを許容してまでゼロ金利回避する必要などありません。処方箋はあるのですから、それを粛々と実行して安定成長へと復帰すればよろしい。

ブランチャードらがここまで繰り返しゼロ金利制約の問題を強調するのは、その処方箋が当てにならないと判断したからです。この点を明確にするために、以下でブランチャード論文の一節を翻訳します。この論文

  1. What we thought we knew (以前はコンセンサスとして認められていたが、今回の危機で否定されたか、疑問符が付いたアイデアを列挙している)
  2. What we have learned from the crisis (文字通り、今回の危機の教訓)
  3. Implications for the design of policy (今後の経済政策へのインプリケーション)

という3部構成になっており、問題の4%インフレは第3部の一項目です。以下で翻訳するのは第1部のB節、つまり「今や否定されつつある過去コンセンサス」について語った一節です。

http://www.imf.org/external/pubs/ft/spn/2010/spn1003.pdf

B. Low Inflation

インフレーションはただ安定しているだけでなく、非常に低く抑えられているべきだ(多くの中央銀行は2%前後ターゲットに選んでいる)」という広いコンセンサス(increasing consensus)があった。これはインフレによって流動性の罠へ陥ってしまうのではないかという議論へと繋がった。低い平均インフレは低い平均名目金利を招き、そして名目金利ゼロ以下には下げられないので、低インフレの下では不景気の際に利下げ(金融緩和)の余地が小さいと言うことになる。しかしながら、この低インフレ危険性は低いと見なされた。なぜなら、中央銀行が将来の高い名目マネーサプライ成長率とひいては将来の高いインフレーションコミット訳注約束)できるなら、中銀は期待インフレ率の上昇によって将来の予想実質金利を低下させ、それによって現在の景気を刺激することが出来るからだ脚注)。そして、それほど景気へのショックが大きくない世界では、2%のインフレがあればゼロ金利制約を回避するのには十分だと思われたのである。こうして、議論の焦点は、コミットメント重要性と中央銀行インフレ期待への影響力へと絞られたのである。

大恐慌時に発生した流動性の罠、それに伴うひどいデフレと低い名目金利は、もはや歴史上の出来事であると認識され、そのような政策の失敗は今や回避可能であると考えられた。1990年代日本経験、すなわちデフレゼロ金利および長く続く不景気は、この認識の前に不愉快に立ちふさがる問題だった。しかし、これは日銀が将来のマネーサプライ増と将来のインフレとにコミットする能力ないしは意思に欠けるからであると片付けられてしまった(公平を期しておくと、Fed日本経験を無視したわけではなく、2000年の初めにデフレリスクを憂慮した論文を発表している)。

脚注ではEggertsson and Woodford (2003)が参照されている)

ブランチャードらがなぜゼロ金利流動性の罠)に陥るリスクを重視するのか、このB節から明らかであると言えると思います。 特に太字で強調した部分を参照してください。どこかで見たことがある主張ではありませんか。少し分かり易く言い換えれば、リフレ政策が役に立ちそうにないから、「低インフレによって流動性の罠へ陥ってしまうのではないか」という懸念が復活しており、だからこそリフレ政策が必要になるような状況に陥らないように政策を運営すべきだと彼らは主張しているのです。4%のインフレ率というのはそのための政策案です(ただし、ブランチャードらもイマイチ自信がないのか、6つ挙げられた政策オプションのうち、この4%インフレの案だけは表題にクエスションマークが付いています)。

紅茶を片手に「まぁ、当然の話だよね」などと余裕をかましている場合ではありません。さぁ、今こそ高らかに「リフレ政策があれば流動性の罠など恐るるに足らない、だから4%のインフレ率なんか必要ない!」と宣言を!

外野増田池田先生矢野先生の熱い戦いを心から応援しております。

2010-01-23

Re: 搾取を語るなら論文を読め

http://anond.hatelabo.jp/20100119124726

どうもはじめましてid:flurryです。

挙げられた論文のうち、Cumings(1984)を少し読んでみたのですが、疑問が出てきましたので匿名ダイアリーに書かせていただきました。

英語があまり得意ではないこともあり、読み間違いなども多いかと思いますが、遠慮なく指摘していただけると幸いです。

 

本題。元増田さん(こういう言い方でいいんでしたっけ?)の主な主張は、

日本韓国統治が善政だったかどうかはともかく、「その植民地政策が、他の帝国主義国家の政策とは明らかに異なる、有益なものであった」ことについては、学者の間である程度のコンセンサスがある

とのことですが、例として挙げられているCumingsの文章を読んでみても、そのようなことが書いてあるようには読み取れませんでした。

(一応の確認ですが、この元増田さんの主張って「日本植民地主義が他の帝国主義国家のそれよりも、被支配者にとって有益であった」ってことですよね?)

Professor Eto remarks that Japan's vices were no different than those of European colonists. This may be true, but its virtues were quite different. There was no legitimizing myth that the Japanese could make stick. They were not good tutors to teach their subjects how to achieve the goal of independence, as at least some Filipinos thought was true of American colonialism. They were not good exemplars of liberal democracy, as at least some thought that the British were in India. The virtues that the Japanese shared were hard to justify philosophically, but easy to adopt practically: military success, the uses of a strong state, rapid economic development, modern industrial structure. Thus Koreans greeted liberation in 1945 with a profound rejection of Japanese colonialism, yet have never been able to rid themselves of its Janus-faced influence.

元増田さんの訳)

エトウ教授日本の悪徳はヨーロッパの植民者のそれと何ら変わるところがなかった、と述べている。それは正しいのかもしれないが、一方でその美徳はヨーロッパ人のそれとは全く異なっていた。日本人には、信じるに足る「自らを正当化する神話」は存在しない。少なくとも何人かのフィリピン人は、アメリカ植民地主義独立というゴールへと至るための良き教師であると信じていたが、日本は良き教師ではなかった。少なくとも幾人かはイギリスインドにとって自由民主主義の良き模範であったと信じているが、日本は良き模範でもなかった。日本がもたらした美徳の数々は、倫理的には(philosophically)正当化するのは難しいが、実際的には(practically)容易に受け入れられるものだ:軍事的成功、強力な国権の運用、急速な経済発展、そして近代的な工業セクター。それゆえ、1945年韓国人達は日本植民地主義に対する全面的な拒絶を唱えて解放を謳歌したが、その一方で日本がもたらした様々な影響からは抜け出すことが出来ないという、二律背反に直面することになったのである。

1) ここでCumingsが書いているのは、「日本のviceはヨーロッパ帝国主義国家と似ている(かもしれない)けど、virtueは全然似ていないよ」程度のことであって、「日本植民地主義ヨーロッパのそれよりも有益であった」なんてことは言っていないように思われます。

2) で、virtue=美徳ですが、一般的には「あのひとは勤勉だ/勇敢だ」のように、人間が持つ性質や姿勢のことを指すと思います。

"The virtues that the Japanese shared"を元増田さんは「軍事的な成功、急速な経済発展などの、日本がもたらした美徳の数々」と訳して、日本朝鮮半島にいいことをした!と主張されていると思うのですが、実際はこれ「軍事的な成功、急速な経済発展といった、日本人が持っていた優れた点」ぐらいの意味じゃないでしょうか。

(「日本朝鮮に軍事的成功をもたらした」って、なんか変ですよね?)

つまりこの部分は、「戦後韓国北朝鮮日本のやり方(富国強兵殖産興業国家権力の強化)を『隠れた』ロールモデル=お手本とした/せざるをえなかった」と読むべきではないでしょうか。

あと、もう一つ。

3) 論文冒頭(479ページ)でCumingsは、

アメリカ朝鮮半島に深く関わるようになって長い時間日本の侵略期間と同じくらい)が経つのに、自由選挙・自由民主主義基本的人権の尊重といったことが根付かないのは、日本の侵略の影響がいまだ継続している、つまり、日本の侵略の影響が、大戦後の韓国北朝鮮両国家をさまざまな方法で形作っていったからなのだ」

と書いています。「Cumingsが日本植民地政策を有益だと評価している」というのは気のせいではないでしょうか。

2008-10-12

[][]Grass

Table of Contents: ||||||

オープンソースソフトウェアGISOpen Source software and GISOpen Source software and GIS 1 (6)
オープンソース概念Open Source concept1 (2)
オープンソースGISとしてのGRASSGRASS as an Open Source GIS3 (2)
ノースカロライナサンプルデータセットThe North Carolina sample data set 5 (1)
この本の読み方How to read this book5 (2)
GIS概念GIS conceptsGIS concepts 7 (14)
一般的なGIS原理General GIS principles 7 (6)
地理空間データモデルGeospatial data models 7 (4)
GISデータシステムの構成Organization of GIS data and system11 (2)
機能functionality
地図投影法と座標系Map projections and coordinate systems 13 (8)
地図投影原理Map projection principles13 (3)
一般的な座標系とdatumsCommon coordinate systems and datums 16 (5)
GRASSをはじめようGetting started with GRASSGetting started with GRASS 21 (32)
第一歩First steps21 (16)
GRASSダウンロードインストールDownload and install GRASS 21 (2)
データベースコマンド構造Database and command structure 23 (3)
GRASS6のためのグラフィカルユーザインタフェイス: Graphical User Interfaces for GRASS 6: 26 (1)
QGISgis.mQGIS and gis.m
ノースカロライナを用いてGRASSを開始Starting GRASS with the North Carolina 27 (3)
データセットdata set
GRASSデータディスプレイ3D可視化GRASS data display and 3D visualization30 (4)
プロジェクトデータ管理Project data management34 (3)
新しいプロジェクトGRASSを開始Starting GRASS with a new project37 (7)
aのための座標系の定義Defining the coordinate system for a 40 (4)
新しいプロジェクトnew project
空間投影されていないxy座標系Non-georeferenced xy coordinate system 44 (1)
座標系の変換Coordinate system transformations44 (9)
座標系のリストCoordinate lists 45 (2)
ラスタベクトル地図投影Projection of raster and vector maps 47 (1)
GDAL/OGRツールで、再投影Reprojecting with GDAL/OGR tools 48 (5)
GRASSデータモデルデータの交換GRASS data models and data exchange53 (30)
ラスタデータRaster data54 (16)
GRASS2Dの、3DラスタデータモデルGRASS 2D and 3D raster data models 54 (2)
領域の統合と境界Managing regions and boundaries raster map resolution
ジオコードされたラスタデータインポートImport of georeferenced raster data58 (8)
スキャンされた歴史地図インポートとジオコーディングImport and geocoding of a scanned66 (3)
ラスタデータエクスポートRaster data export 69 (1)
ベクトルデータVector data70 (13)
GRASSベクトルデータモデルGRASS vector data model70 (3)
ベクトルデータインポートImport of vector data73 (5)
xy CAD描画のための座標変換Coordinate transformation for xy CAD drawings 78 (2)
ベクトルデータエクスポートExport of vector data80 (3)
ラスタデータを使うWorking with raster data 83 (86)
ラスタ地図を表示、管理Viewing and managing raster maps 83 (22)
ラスタデータの表示と、カラーテーブルの割り当てDisplaying raster data and assigning a color table 83 (3)
ラスタ地図に関するメタデータを管理Managing metadata of raster maps 86 (2)
ラスタ地図クエリプロファイルRaster map queries and profiles88 (2)
ラスタ地図統計Raster map statistics90 (1)
ラスタ地図ズームと、部分集合の生成Zooming and generating subsets from91 (1)
簡単なラスタ地図の生成Generating simple raster maps92 (2)
再分類と再スケーリングReclassification and rescaling of94 (3)
ラスタ地図raster maps
ラスタ地図タイプの記録と値の置換Recoding of raster map types and value replacements 97 (2)
カテゴリベルの割り当てAssigning category labels99 (4)
マスキングとノーデータ値の取り扱いMasking and handling of no-data values 103(2)
ラスタ地図の計算Raster map algebra 105(10)
整数と浮動小数点データInteger and floating point data107(1)
基本的な計算Basic calculations 108(1)
“if"状態を使うWorking with ``if'' conditions109(1)
r.mapcalcのNULL値の取り扱いHandling of NULL values in r.mapcalc 110(1)
r.mapcalcでMASKを作成Creating a MASK with r.mapcalc 111(1)
特別なグラフ演算子Special graph operators112(1)
相対的座標での近傍演算Neighborhood operations with relative coordinates113(2)
ラスタデータの変換と内挿Raster data transformation and interpolation 115(11)
離散的ラスタデータ自動ベクトルAutomated vectorization of discrete raster data115(3)
連続フィールドの等値線の描画を生成Generating isolines representing continuous fields 118(1)
ラスタデータのリサンプリングと内挿Resampling and interpolation of raster data 119(5)
ラスタ地図オーバーレイマージOverlaying and merging raster maps 124(2)
ラスタデータの空間分析Spatial analysis with raster data126(29)
近傍分析とクロスカテゴリー統計Neighborhood analysis and cross-category statistics126(7)
ラスタフィーチャのバッファリングBuffering of raster features 133(2)
コストサーフェイスCost surfaces135(5)
地勢と分水界分析Terrain and watershed analysis 140(13)
ランドスケープ構造解析Landscape structure analysis 153(2)
ランドスケーププロセスモデリングLandscape process modeling 155(11)
文学的、地下水モデルHydrologic and groundwater modeling155(3)
浸食と宣誓証言モデルErosion and deposition modeling158(8)
ラスタベースモデルと解析に関するまとめFinal note on raster-based modeling and analysis166(1)
ボクセルデータを使うWorking with voxel data166(3)
ベクトルデータを使うWorking with vector data 169(94)
地図の表示とメタデータ管理Map viewing and metadata management169(4)
ベクトル地図を表示Displaying vector maps 169(3)
ベクトル地図メタデータ維持Vector map metadata maintenance172(1)
ベクトル地図属性管理とSQLサポートVector map attribute management and SQL support173(14)
GRASS6でのSQLサポートSQL support in GRASS 6 174(7)
サンプルSQLクエリ属性変更Sample SQL queries and attribute modifications 181(4)
地図再分類Map reclassification 185(1)
複数の属性があるベクトル地図Vector map with multiple attribute tables: layers 186(1)
ベクトルデータデジタルDigitizing vector data 187(5)
位相データデジタル化の一般原理General principles for digitizing topological data187(2)
GRASSでの対話的なデジタイジンInteractive digitizing in GRASS189(3)
ベクトル地図クエリ統計Vector map queries and statistics192(4)
地図クエリMap queries192(2)
ベクトルオブジェクトに基づくラスタ地図統計Raster map statistics based on vector objects194(2)
ポイントベクトル地図統計Point vector map statistics196(1)
幾何学操作Geometry operations196(20)
位相的な操作Topological operations 197(6)
バッファリングBuffering203(1)
フィーチャの抽出と境界のディゾルブFeature extraction and boundary dissolving204(1)
ベクトル地図を修理Patching vector maps 205(1)
ベクトル地図インターセクディングとクリッピングIntersecting and clipping vector maps206(3)
ベクトル幾何の変換と3Dベクトルの作成Transforming vector geometry and creating 3D vectors 209(2)
点からのコンベックスハルとトライアンギュレーションConvex hull and triangulation from points 211(1)
同じ位置の掘り出し物の複数のポイントFind multiple points in same location212(2)
一般的な多角形境界の長さLength of common polygon boundaries214(2)
ベクトルネットワーク分析Vector network analysis216(11)
ネットワーク分析Network analysis 216(5)
直線的な参照システム(LRS)Linear reference system (LRS)221(6)
ラスタへのベクトルデータ変化Vector data transformations to raster227(3)
空間的な内挿と近似Spatial interpolation and approximation230(19)
内挿方法を選択Selecting an interpolation method230(5)
RSTによる内挿と近似Interpolation and approximation with RST 235(2)
RSTパラメタの調整: テンションスムージングTuning the RST parameters: tension and smoothing 237(4)
RSTの精度を評価Estimating RST accuracy241(3)
セグメント化処理Segmented processing 244(3)
RSTとのトポグラフィー分析Topographic analysis with RST247(2)
ライダーポイントクラウドデータを使うWorking with lidar point cloud data249(8)
ボリュームに基づくは内挿Volume based interpolation 257(6)
3番目の変数の追加: 高度のある降水量Adding third variable: precipitation with elevation 258(3)
ボリュームとボリューム-時間内挿Volume and volume-temporal interpolation 261(1)
地球統計学とスプライGeostatistics and splines262(1)

2008-10-02

Classic Texts in Computer Science

リブログです。

    http://www.zafar.se/bkz/Articles/ClassicCompScienceTexts

    http://www.zafar.se/bkz/wiki/view/43bafac8c8570f4f

    にあったけど、無くなっていたので

    http://web.archive.org/web/20060823143349/www.zafar.se/bkz/home/classictextsincomputersc.html

    から拾ってきた。

    でも書いてる途中に↓を見つけてしまったのでした。

    Classical Computer Science Texts

    2008-02-01

    高速道路環境

    http://anond.hatelabo.jp/20080201001641:title

    エスカレーター私立中学校に通う男子プログラミング独習記。(Scheme/DrScheme)

    今時小学生でもコード書いてるわけだから不思議じゃないけど、

    こういうの見るとやはり梅田望夫羽生直也は正しいこと言ってると思う。

    俺が中学高校の時とかSICPとかありえなかったし。

    ただこいつの環境っていう面もあなどれない。親がおそらく優秀なプログラマだってことはなんとなくわかるし、

    SICP中学英語で読めるようなもんじゃないから帰国子女の可能性もある。

    昨日親に話してみたら、Structure and Interpretation of Computer Programsっていう本を勧められて、

    今度はHow to Design Programsっていうもっと入門編の本を教えてくれて

    こんな親父なかなかいない。

    しかも中高一貫受験勉強にあくせくせずにやりたいことができる環境

    ただもしこいつが増田で練習問題の回答晒して俺らが突っ込み入れてみたいに続けると恐ろしいことになるかも。

    15歳中学生「はじめてのプログラミング」その1

    エスカレーター私立中学校に通う男子プログラミング独習記。(Scheme/DrScheme)

    本来高校受験を目の前に控えているはずなんだけど、怠けの坊ちゃん学校にはそんなものもなく教室の空気は緩んでいる。

    3年前になんだかんだで部活動に入りそびれた僕は、際立ってダラダラなカテゴリに属す。

    ベタギターをやってみたり、携帯のオンラインRPGにハマったり、プロフ女の子と会ってみたけどあまりしっくりこない。モバも飽きた。

    唯一ハンズで買った財布づくりキットみたいなヤツをきっかけに革を触って何か作ったりするのは続いてる。革の裁断面を磨きまくるコバ磨きをしていると何故だか落ち着く。

    僕のことばかり書いてても仕方ないな。で、なんか中学生活で達成したとかそんなの全然ないし、高校生活に胸をときめかせるとかもなくて。

    それじゃああんまりだと言う事で、何か新しいことを始めたいなぁと思ってたんだ。

    ちょうど親がプログラマーで、(全然パソコンには詳しくないけど)モノをつくるのも好きだし、やってみようって気になった。

    昨日親に話してみたら、Structure and Interpretation of Computer Programsっていう本を勧められて、MITっていう大学(?)のサイトで見てみたけど難し過ぎた。

    ってそのままお父さんに言ってみたら今度はHow to Design Programsっていうもっと入門編の本を教えてくれて、これ以上簡単な解説書はないからもうこれでわからなかったら諦めろと。

    なんだか悔しいし、どうにかしてモノにしたい。早速MITサイトから100ページ分ぐらいダウンロードしてみた。

    親に聞くのもイヤだし、(いつの間にかできるようになってたい)2chもそれ関係スレマニアック過ぎて謎過ぎたからここで書いてみる。

    書いてることが間違ってたらぜひぜひ教えて欲しいです。

    今日は最初の12ページ分。なんかプログラミングって何?とかプログラミングを学ばなきゃいけない理由とかが書いてあった。

    • ()内が僕が考えたこと。それ以外は本に書いてあったことです。

    プログラミングって、職業的なスキル以上のものになってきてる。

    すごく楽しいし、創造性のはけ口になるし、抽象的でふわふわしたアイデアを目に見える形で表現できちゃったりする。

    (このアイデアを形にする手段、っていうのはなんかイイなと思った。やっぱりなんかひとりでモノをつくれる人は尊敬できるなぁ。)

    プログラミングクリティカルリーディング、分析的思考、創造的統合(?)、細部へのこだわりを教えてくれる。

    (創造的統合って何だろう?creative synthesisっていわれるとイメージはできる気もするけどうまく言葉にできない。

    複雑なものをformingするってことだよね。多分...)

    さらに何がイイかって、すぐにフィードバックが返ってくるところ。

    冒険的、実験的になれるし、自己評価もできる。達成感を味わうっていうのもあるみたい。数学ドリルをするより全然。(確かに目に見える何ができるって励みになりそう)

    この本ではプログラミング言語の細かいところとかにはあまり触れずに、デザインプロセスに焦点を当てる。

    つまり問題定義からオーガナイズドされたソリューションまでの一連の流れについて語る。

    2つのイノベーションがこの本にはあって、以下。

    ・明確なデザインガイドラインがある

    ・めちゃめちゃ新しいプログラミング環境

    まず一つ目。今までの本は抽象的でクソみたいな定義の提案しかしてこなかった。例えば「デザインはトップからボトムに」とか「構造的にデザインしろ」とか。

    この本には明確なステップがあって、読むこと、分析すること、組織化すること、実験すること、システマティックに思考することを学べる。

    二つ目は、初心者向けのプログラミング環境であるということ。既存の本は周りにプログラミングプロがいて、すぐにその人に質問したりできることを前提に書かれていた。

    この本はそういった意味の分からない前提は捨てて、独習できるように設計してある。

    1. 問題のデータのかたまり(problem dataってなんだ?)を記述する

    2. 簡単にプログラムの挙動の仕様をつくる

    3. 挙動を図にしてみる(例をつくる)

    4. プログラムの型(program templateってなんだ?)やレイアウトをきっちりつくる

    5. テンプレートを変形して、完全な定義をつくる

    6. テストしてエラー発見する

    (なんかプロセスとしてはわかりやすいけど、抽象的でプログラミングしたことのない僕には雲をつかむような感じ...

    inputデータの記述からどうやってprogram templateが得られるんだろう?1→2がよくわからない)

    プログラミングアクティビティってつまるところ、

    1. ある数とある数を関係づけること

    2. 名前の代わりに値を用いることで、関係を評価する

    ってこと。(これもわかったようなわからないような。1はinputとoutputの間の話?2は数値化するってこと?)

    プログラムを学ぶのってサッカーを学ぶのと似てるね。

    最初はトラップやドリブルパスシュートの仕方を学んで、次はあるポジションの役割を学んで、戦略を学んで、どの戦略を選ぶかを学んで、時々新しい戦略をつくったりもする。フィットするヤツがない場合はね。

    他にも建築家作曲家作家に似てる。

    彼らが楽器技術や書く技術建築技術を学んでアイデアを形にするように、プログラマープログラムを学んでモノをつくる。

    この本ではSchemeというプログラミング言語を使う。開発環境はDrSchemeで行う。

    ただこの本はSchemeの解説書ではないから、Schemeの構成概念の6つだけを使う。

    function difinition、application、conditional expressions、structure definition、local definition、assignmentsだ。

    ---

    とりあえず1回目はこんな感じ。

    まだ全然良く分かってない。ただ親が使ってるのがlispっていうプログラミング言語で、Schemeはその方言みたいなものってことは今調べてわかった。ふーん。

    まだ何がわからないっていうか全部わからないので、アドバイスのしようもないとは思いますが、最初はこれやっとけ!とかこのサイト読めとかあったら教えてください。

    2007-07-19

    /* Ten */
    if (typeof(Ten) == 'undefined') {
        Ten = {};
    }
    Ten.NAME = 'Ten';
    Ten.VERSION = 0.06;
    
    /* Ten.Class */
    Ten.Class = function(klass, prototype) {
        if (klass && klass.initialize) {
    	var c = klass.initialize;
        } else if(klass && klass.base) {
            var c = function() { return klass.base[0].apply(this, arguments) };
        } else {
    	var c = function() {};
        }
        c.prototype = prototype || {};
        c.prototype.constructor = c;
        Ten.Class.inherit(c, klass);
        if (klass && klass.base) {
            for (var i = 0;  i < klass.base.length; i++) {
    	    var parent = klass.base[i];
                if (i == 0) {
                    c.SUPER = parent;
                    c.prototype.SUPER = parent.prototype;
                }
                Ten.Class.inherit(c, parent);
                Ten.Class.inherit(c.prototype, parent.prototype);
            }
        }
        return c;
    }
    Ten.Class.inherit = function(child,parent) {
        for (var prop in parent) {
            if (typeof(child[prop]) != 'undefined' || prop == 'initialize') continue;
            child[prop] = parent[prop];
        }
    }
    
    /*
    // Basic Ten Classes
    **/
    
    /* Ten.JSONP */
    Ten.JSONP = new Ten.Class({
        initialize: function(uri,obj,method) {
            if (Ten.JSONP.Callbacks.length) {
                setTimeout(function() {new Ten.JSONP(uri,obj,method)}, 500);
                return;
            }
            var del = uri.match(/\?/) ? '&' : '?';
            uri += del + 'callback=Ten.JSONP.callback';
            if (!uri.match(/timestamp=/)) {
                uri += '&' + encodeURI(new Date());
            }
            if (obj && method) Ten.JSONP.addCallback(obj,method);
            this.script = document.createElement('script');
            this.script.src = uri;
            this.script.type = 'text/javascript';
            document.getElementsByTagName('head')[0].appendChild(this.script);
        },
        addCallback: function(obj,method) {
            Ten.JSONP.Callbacks.push({object: obj, method: method});
        },
        callback: function(args) {
            // alert('callback called');
            var cbs = Ten.JSONP.Callbacks;
            for (var i = 0; i < cbs.length; i++) {
                var cb = cbs[i];
                cb.object[cb.method].call(cb.object, args);
            }
            Ten.JSONP.Callbacks = [];
        },
        MaxBytes: 8000,
        Callbacks: []
    });
    
    /* Ten.XHR */
    Ten.XHR = new Ten.Class({
        initialize: function(uri,opts,obj,method) {
            if (!uri) return;
            this.request = Ten.XHR.getXMLHttpRequest();
            this.callback = {object: obj, method: method};
            var xhr = this;
            var prc = this.processReqChange;
            this.request.onreadystatechange = function() {
                prc.apply(xhr, arguments);
            }
            var method = opts.method || 'GET';
            this.request.open(method, uri, true);
            if (method == 'POST') {
                this.request.setRequestHeader('Content-Type',
                                              'application/x-www-form-urlencoded');
            }
            var data = opts.data ? Ten.XHR.makePostData(opts.data) : null;
            this.request.send(data);
        },
        getXMLHttpRequest: function() {
            var xhr;
            var tryThese = [
                function () { return new XMLHttpRequest(); },
                function () { return new ActiveXObject('Msxml2.XMLHTTP'); },
                function () { return new ActiveXObject('Microsoft.XMLHTTP'); },
                function () { return new ActiveXObject('Msxml2.XMLHTTP.4.0'); },
            ];
            for (var i = 0; i < tryThese.length; i++) {
                var func = tryThese[i];
                try {
                    xhr = func;
                    return func();
                } catch (e) {
                    //alert(e);
                }
            }
            return xhr;
        },
        makePostData: function(data) {
            var pairs = [];
            var regexp = /%20/g;
            for (var k in data) {
                var v = data[k].toString();
                var pair = encodeURIComponent(k).replace(regexp,'+') + '=' +
                    encodeURIComponent(v).replace(regexp,'+');
                pairs.push(pair);
            }
            return pairs.join('&');
        }
    },{
        processReqChange: function() {
            var req = this.request;
            if (req.readyState == 4) {
                if (req.status == 200) {
                    var cb = this.callback;
                    cb.object[cb.method].call(cb.object, req);
                } else {
                    alert("There was a problem retrieving the XML data:\n" +
                          req.statusText);
                }
            }
        }
    });
    
    /* Ten.Observer */
    Ten.Observer = new Ten.Class({
        initialize: function(element,event,obj,method) {
            var func = obj;
            if (typeof(method) == 'string') {
                func = obj[method];
            }
            this.element = element;
            this.event = event;
            this.listener = function(event) {
                return func.call(obj, new Ten.Event(event || window.event));
            }
            if (this.element.addEventListener) {
                if (this.event.match(/^on(.+)$/)) {
                    this.event = RegExp.$1;
                }
                this.element.addEventListener(this.event, this.listener, false);
            } else if (this.element.attachEvent) {
                this.element.attachEvent(this.event, this.listener);
            }
        }
    },{
        stop: function() {
            if (this.element.removeEventListener) {
                this.element.removeEventListener(this.event,this.listener,false);
            } else if (this.element.detachEvent) {
                this.element.detachEvent(this.event,this.listener);
            }
        }
    });
    
    /* Ten.Event */
    Ten.Event = new Ten.Class({
        initialize: function(event) {
            this.event = event;
        },
        keyMap: {
            8:"backspace", 9:"tab", 13:"enter", 19:"pause", 27:"escape", 32:"space",
            33:"pageup", 34:"pagedown", 35:"end", 36:"home", 37:"left", 38:"up",
            39:"right", 40:"down", 44:"printscreen", 45:"insert", 46:"delete",
            112:"f1", 113:"f2", 114:"f3", 115:"f4", 116:"f5", 117:"f6", 118:"f7",
            119:"f8", 120:"f9", 121:"f10", 122:"f11", 123:"f12",
            144:"numlock", 145:"scrolllock"
        }
    },{
        mousePosition: function() {
            if (!this.event.clientX) return;
            return Ten.Geometry.getMousePosition(this.event);
        },
        isKey: function(name) {
            var ecode = this.event.keyCode;
            if (!ecode) return;
            var ename = Ten.Event.keyMap[ecode];
            if (!ename) return;
            return (ename == name);
        },
        targetIsFormElements: function() {
            var target = this.event.target;
            if (!target) return;
            var T = (target.tagName || '').toUpperCase();
            return (T == 'INPUT' || T == 'SELECT' || T == 'OPTION' ||
                    T == 'BUTTON' || T == 'TEXTAREA');
        },
        stop: function() {
            var e = this.event;
            if (e.stopPropagation) {
                e.stopPropagation();
                e.preventDefault();
            } else {
                e.cancelBubble = true;
                e.returnValue = false;
            }
        }
    });
    
    /* Ten.DOM */
    Ten.DOM = new Ten.Class({
        getElementsByTagAndClassName: function(tagName, className, parent) {
            if (typeof(parent) == 'undefined') {
                parent = document;
            }
            var children = parent.getElementsByTagName(tagName);
            if (className) { 
                var elements = [];
                for (var i = 0; i < children.length; i++) {
                    var child = children[i];
                    var cls = child.className;
                    if (!cls) {
                        continue;
                    }
                    var classNames = cls.split(' ');
                    for (var j = 0; j < classNames.length; j++) {
                        if (classNames[j] == className) {
                            elements.push(child);
                            break;
                        }
                    }
                }
                return elements;
            } else {
                return children;
            }
        },
        removeEmptyTextNodes: function(element) {
            var nodes = element.childNodes;
            for (var i = 0; i < nodes.length; i++) {
                var node = nodes[i];
                if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) {
                    node.parentNode.removeChild(node);
                }
            }
        },
        nextElement: function(elem) {
            do {
                elem = elem.nextSibling;
            } while (elem && elem.nodeType != 1);
            return elem;
        },
        prevElement: function(elem) {
            do {
                elem = elem.previousSibling;
            } while (elem && elem.nodeType != 1);
            return elem;
        },
        scrapeText: function(node) {
            var rval = [];
            (function (node) {
                var cn = node.childNodes;
                if (cn) {
                    for (var i = 0; i < cn.length; i++) {
                        arguments.callee.call(this, cn[i]);
                    }
                }
                var nodeValue = node.nodeValue;
                if (typeof(nodeValue) == 'string') {
                    rval.push(nodeValue);
                }
            })(node);
            return rval.join('');
        },
        onLoadFunctions: [],
        loaded: false,
        timer: null,
        addEventListener: function(event,func) {
            if (event != 'load') return;
            Ten.DOM.onLoadFunctions.push(func);
            Ten.DOM.checkLoaded();
        },
        checkLoaded: function() {
            var c = Ten.DOM;
            if (c.loaded) return true;
            if (document && document.getElementsByTagName &&
                document.getElementById && document.body) {
                if (c.timer) {
                    clearInterval(c.timer);
                    c.timer = null;
                }
                for (var i = 0; i < c.onLoadFunctions.length; i++) {
                        c.onLoadFunctions[i]();
                }
                c.onLoadFunctions = [];
                c.loaded = true;
            } else {
                c.timer = setInterval(c.checkLoaded, 13);
            }
        }
    });
    
    /* Ten.Style */
    Ten.Style = new Ten.Class({
        applyStyle: function(elem, style) {
            for (prop in style) {
                elem.style[prop] = style[prop];
            }
        }
    });
    
    /* Ten.Geometry */
    Ten.Geometry = new Ten.Class({
        initialize: function() {
            if (Ten.Geometry._initialized) return;
            var func = Ten.Geometry._functions;
            var de = document.documentElement;
            if (window.innerWidth) {
                func.getWindowWidth = function() { return window.innerWidth; }
                func.getWindowHeight = function() { return window.innerHeight; }
                func.getXScroll = function() { return window.pageXOffset; }
                func.getYScroll = function() { return window.pageYOffset; }
            } else if (de && de.clientWidth) {
                func.getWindowWidth = function() { return de.clientWidth; }
                func.getWindowHeight = function() { return de.clientHeight; }
                func.getXScroll = function() { return de.scrollLeft; }
                func.getYScroll = function() { return de.scrollTop; }
            } else if (document.body.clientWidth) {
                func.getWindowWidth = function() { return document.body.clientWidth; }
                func.getWindowHeight = function() { return document.body.clientHeight; }
                func.getXScroll = function() { return document.body.scrollLeft; }
                func.getYScroll = function() { return document.body.scrollTop; }
            }
            Ten.Geometry._initialized = true;
        },
        _initialized: false,
        _functions: {},
        getScroll: function() {
            if (!Ten.Geometry._initialized) new Ten.Geometry;
            return {
                x: Ten.Geometry._functions.getXScroll(),
                y: Ten.Geometry._functions.getYScroll()
            };
        },
        getMousePosition: function(pos) {
            // pos should have clientX, clientY same as mouse event
            if ((navigator.userAgent.indexOf('Safari') > -1) &&
                (navigator.userAgent.indexOf('Version/') < 0)) {
                return {
                    x: pos.clientX,
                    y: pos.clientY
                };
            } else {
                var scroll = Ten.Geometry.getScroll();
                return {
                    x: pos.clientX + scroll.x,
                    y: pos.clientY + scroll.y
                };
            }
        },
        getElementPosition: function(e) {
            return {
                x: e.offsetLeft,
                y: e.offsetTop
            };
        },
        getWindowSize: function() {
            if (!Ten.Geometry._initialized) new Ten.Geometry;
            return {
                w: Ten.Geometry._functions.getWindowWidth(),
                h: Ten.Geometry._functions.getWindowHeight()
            };
        }
    });
    
    /* Ten.Position */
    Ten.Position = new Ten.Class({
        initialize: function(x,y) {
            this.x = x;
            this.y = y;
        },
        subtract: function(a,b) {
            return new Ten.Position(a.x - b.x, a.y - b.y);
        }
    });
    
    /*
    // require Ten.js
    **/
    
    /* Ten.SubWindow */
    Ten.SubWindow = new Ten.Class({
        initialize: function() {
            var c = this.constructor;
            if (c.singleton && c._cache) {
                return c._cache;
            }
            var div = document.createElement('div');
            Ten.Style.applyStyle(div, Ten.SubWindow._baseStyle);
            Ten.Style.applyStyle(div, c.style);
            this.window = div;
            this.addContainerAndCloseButton();
            document.body.appendChild(div);
            if (c.draggable) {
                this._draggable = new Ten.Draggable(div, this.handle);
            }
            if (c.singleton) c._cache = this;
            return this;
        },
        _baseStyle: {
            color: '#000',
            position: 'absolute',
            display: 'none',
            zIndex: 2,
            left: 0,
            top: 0,
            backgroundColor: '#fff',
            border: '1px solid #bbb'
        },
        style: {
            padding: '2px',
            textAlign: 'center',
            borderRadius: '6px',
            MozBorderRadius: '6px',
            width: '100px',
            height: '100px'
        },
        handleStyle: {
            position: 'absolute',
            top: '0px',
            left: '0px',
            backgroundColor: '#f3f3f3',
            borderBottom: '1px solid #bbb',
            width: '100%',
            height: '30px'
        },
        containerStyle: {
            margin: '32px 0 0 0',
            padding: '0 10px'
        },
        // closeButton: 'close.gif',
        closeButton: 'http://s.hatena.com/images/close.gif',
        closeButtonStyle: {
            position: 'absolute',
            top: '8px',
            right: '10px',
            cursor: 'pointer'
        },
        _baseScreenStyle: {
            position: 'absolute',
            top: '0px',
            left: '0px',
            display: 'none',
            zIndex: 1,
            overflow: 'hidden',
            width: '100%',
            height: '100%'
        },
        screenStyle: {},
        showScreen: true,
        singleton: true,
        draggable: true,
        _cache: null
    },{
        screen: null,
        windowObserver: null,
        visible: false,
        addContainerAndCloseButton: function() {
            var win = this.window;
            var c = this.constructor;
            var div = document.createElement('div');
            win.appendChild(div);
            Ten.Style.applyStyle(div, c.containerStyle);
            this.container = div;
            if (c.handleStyle) {
                var handle = document.createElement('div');
                Ten.Style.applyStyle(handle, c.handleStyle);
                win.appendChild(handle);
                this.handle = handle;
            }
            if (c.closeButton) {
    	    var btn = document.createElement('img');
                btn.src = c.closeButton;
                btn.alt = 'close';
                Ten.Style.applyStyle(btn, c.closeButtonStyle);
                win.appendChild(btn);
                new Ten.Observer(btn, 'onclick', this, 'hide');
                this.closeButton = btn;
            }
            if (c.showScreen) {
                var screen = document.createElement('div');
                Ten.Style.applyStyle(screen, Ten.SubWindow._baseScreenStyle);
                Ten.Style.applyStyle(screen, c.screenStyle);
                document.body.appendChild(screen);
                this.screen = screen;
                new Ten.Observer(screen, 'onclick', this, 'hide');
            }
        },
        show: function(pos) {
            pos = (pos.x && pos.y) ? pos : {x:0, y:0};
            with (this.window.style) {
                display = 'block';
                left = pos.x + 'px';
                top = pos.y + 'px';
            }
            if (this.screen) {
                with (this.screen.style) {
                    display = 'block';
                    left = Ten.Geometry.getScroll().x + 'px';
                    top = Ten.Geometry.getScroll().y + 'px';
                }
            }
            this.windowObserver = new Ten.Observer(document.body, 'onkeypress', this, 'handleEscape');
            this.visible = true;
        },
        handleEscape: function(e) {
            if (!e.isKey('escape')) return;
            this.hide();
        },
        hide: function() {
            if (this._draggable) this._draggable.endDrag();
            this.window.style.display = 'none';
            if (this.screen) this.screen.style.display = 'none';
            if (this.windowObserver) this.windowObserver.stop();
            this.visible = false;
        }
    });
    
    /* Ten.Draggable */
    Ten.Draggable = new Ten.Class({
        initialize: function(element,handle) {
            this.element = element;
            this.handle = handle || element;
            this.startObserver = new Ten.Observer(this.handle, 'onmousedown', this, 'startDrag');
            this.handlers = [];
        }
    },{
        startDrag: function(e) {
            if (e.targetIsFormElements()) return;
            this.delta = Ten.Position.subtract(
                e.mousePosition(),
                Ten.Geometry.getElementPosition(this.element)
            );
            this.handlers = [
                new Ten.Observer(document, 'onmousemove', this, 'drag'),
                new Ten.Observer(document, 'onmouseup', this, 'endDrag'),
                new Ten.Observer(this.element, 'onlosecapture', this, 'endDrag')
            ];
            e.stop();
        },
        drag: function(e) {
            var pos = Ten.Position.subtract(e.mousePosition(), this.delta);
            Ten.Style.applyStyle(this.element, {
                left: pos.x + 'px',
                top: pos.y + 'px'
            });
            e.stop();
        },
        endDrag: function(e) {
            for (var i = 0; i < this.handlers.length; i++) {
                this.handlers[i].stop();
            }
            if(e) e.stop();
        }
    });
    
    /* Hatena */
    if (typeof(Hatena) == 'undefined') {
        Hatena = {};
    }
    
    /* Hatena.User */
    Hatena.User = new Ten.Class({
        initialize: function(name) {
            this.name = name;
        },
        getProfileIcon: function(name) {
            if (!name) name = 'user';
            var pre = name.match(/^[\w-]{2}/)[0];
            var img = document.createElement('img');
            img.src = 'http://www.hatena.ne.jp/users/' + pre + '/' + name + '/profile_s.gif';
            img.alt = name;
            img.setAttribute('class', 'profile-icon');
            img.setAttribute('width','16px');
            img.setAttribute('height','16px');
            with (img.style) {
                margin = '0 3px';
                border = 'none';
                verticalAlign = 'middle';
            }
            return img;
        }
    }, {
        profileIcon: function() {
            return Hatena.User.getProfileIcon(this.name);
        }
    });
    
    /* Hatena.Star */
    if (typeof(Hatena.Star) == 'undefined') {
        Hatena.Star = {};
    }
    
    /*
    // Hatena.Star.* classes //
    **/
    if (window.location && window.location.host.match(/hatena\.com/)) {
        Hatena.Star.BaseURL = 'http://s.hatena.com/';
    } else {
        Hatena.Star.BaseURL = 'http://s.hatena.ne.jp/';
    }
    Hatena.Star.Token = null;
    
    /* Hatena.Star.User */
    Hatena.Star.User = new Ten.Class({
        base: [Hatena.User],
        initialize: function(name) {
            if (Hatena.Star.User._cache[name]) {
                return Hatena.Star.User._cache[name];
            } else {
                this.name = name;
                Hatena.Star.User._cache[name] = this;
                return this;
            }
        },
        _cache: {}
    },{
        userPage: function() {
            return Hatena.Star.BaseURL + this.name + '/';
        }
    });
    
    /* Hatena.Star.Entry */
    Hatena.Star.Entry = new Ten.Class({
        initialize: function(e) {
            this.entry = e;
            this.uri = e.uri;
            this.title = e.title;
            this.star_container = e.star_container;
            this.comment_container = e.comment_container;
            this.stars = [];
            this.comments = [];
        },
        maxStarCount: 11
    },{
        flushStars: function() {
            this.stars = [];
            this.star_container.innerHTML = '';
        },
        bindStarEntry: function(se) {
            this.starEntry = se;
            for (var i = 0; i < se.stars.length; i++) {
                if (typeof(se.stars[i]) == 'number') {
                    this.stars.push(new Hatena.Star.InnerCount(se.stars[i],this));
                } else {
                    this.stars.push(new Hatena.Star.Star(se.stars[i]));
                }
            }
            if (se.comments && !this.comments.length) {
                for (var i = 0; i < se.comments.length; i++) {
                    this.comments.push(new Hatena.Star.Comment(se.comments[i]));
                }
            }
            this.can_comment = se.can_comment;
        },
        setCanComment: function(v) {
            this.can_comment = v;
        },
        showButtons: function() {
            this.addAddButton();
            this.addCommentButton();
        },
        addAddButton: function() {
            if (this.star_container) {
                this.addButton = new Hatena.Star.AddButton(this);
                this.star_container.appendChild(this.addButton);
            }
        },
        addCommentButton: function() {
            if (this.comment_container) {
                this.commentButton = new Hatena.Star.CommentButton(this);
                this.comment_container.appendChild(this.commentButton.img);
            }
        },
        showStars: function() {
            var klass = this.constructor;
            // if (this.stars.length > klass.maxStarCount) {
            //     var ic = new Hatena.Star.InnerCount(this.stars.slice(1,this.stars.length));
            //     this.star_container.appendChild(this.stars[0]);
            //     this.star_container.appendChild(ic);
            //     this.star_container.appendChild(this.stars[this.stars.length - 1]);
            // } else {
            for (var i = 0; i < this.stars.length; i++) {
                this.star_container.appendChild(this.stars[i]);
            }
        },
        showCommentButton: function() {
            if (this.can_comment) {
                this.commentButton.show();
                if (this.comments.length) this.commentButton.activate();
            } else {
                // this.commentButton.hide();
            }
        },
        addStar: function(star) {
            this.stars.push(star);
            this.star_container.appendChild(star);
        },
        addComment: function(com) {
            if (!this.comments) this.comments = [];
            if (this.comments.length == 0) {
                this.commentButton.activate();
            }
            this.comments.push(com);
        },
        showCommentCount: function() {
            this.comment_container.innerHTML += this.comments.length;
        }
    });
    
    /* Hatena.Star.Button */
    Hatena.Star.Button = new Ten.Class({
        createButton: function(args) {
            var img = document.createElement('img');
            img.src = args.src;
            img.alt = img.title = args.alt;
            with (img.style) {
    	    cursor = 'pointer';
    	    margin = '0 3px';
                padding = '0';
                border = 'none';
                verticalAlign = 'middle';
            }
            return img;
        }
    });
    
    /* Hatena.Star.AddButton */
    Hatena.Star.AddButton = new Ten.Class({
        base: ['Hatena.Star.Button'],
        initialize: function(entry) {
            this.entry = entry;
            this.lastPosition = null;
            var img = Hatena.Star.Button.createButton({
                src: Hatena.Star.AddButton.ImgSrc,
                alt: 'Add Star'
            });
            this.observer = new Ten.Observer(img,'onclick',this,'addStar');
            this.img = img;
            return img;
        },
        ImgSrc: Hatena.Star.BaseURL + 'images/add.gif'
    },{
        addStar: function(e) {
            this.lastPosition = e.mousePosition();
            var uri = Hatena.Star.BaseURL + 'star.add.json?uri=' + encodeURIComponent(this.entry.uri) +
                '&title=' + encodeURIComponent(this.entry.title);
            if (Hatena.Star.Token) {
                uri += '&token=' + Hatena.Star.Token;
            }
            new Ten.JSONP(uri, this, 'receiveResult');
        },
        receiveResult: function(args) {
            var name = args ? args.name : null;
            if (name) {
                this.entry.addStar(new Hatena.Star.Star({name: name}));
                //alert('Succeeded in Adding Star ' + args);
            } else if (args.errors) {
                var pos = this.lastPosition;
                pos.x -= 10;
                pos.y += 25;
                var scroll = Ten.Geometry.getScroll();
                var scr = new Hatena.Star.AlertScreen();
                var alert = args.errors[0];
                scr.showAlert(alert, pos);
            }
        }
    });
    
    /* Hatena.Star.CommentButton */
    Hatena.Star.CommentButton = new Ten.Class({
        base: ['Hatena.Star.Button'],
        initialize: function(entry) {
            this.entry = entry;
            this.lastPosition = null;
            var img = Hatena.Star.Button.createButton({
                src: Hatena.Star.CommentButton.ImgSrc,
                alt: 'Comments'
            });
            img.style.display = 'none';
            this.observer = new Ten.Observer(img,'onclick',this,'showComments');
            this.img = img;
        },
        ImgSrc: Hatena.Star.BaseURL + 'images/comment.gif',
        ImgSrcActive: Hatena.Star.BaseURL + 'images/comment_active.gif'
    },{
        showComments: function(e) {
            if (!this.screen) this.screen = new Hatena.Star.CommentScreen();
            this.screen.bindEntry(this.entry);
            var pos = e.mousePosition();
            pos.y += 25;
            this.screen.showComments(this.entry, pos);
        },
        hide: function() {
            this.img.style.display = 'none';
        },
        show: function() {
            this.img.style.display = 'inline';
        },
        activate: function() {
            this.show();
            this.img.src = Hatena.Star.CommentButton.ImgSrcActive;
        }
    });
    
    /* Hatena.Star.Star */
    Hatena.Star.Star = new Ten.Class({
        initialize: function(args) {
            if (args.img) {
                this.img = args.img;
                this.name = this.img.getAttribute('alt');
            } else {
                this.name = args.name;
                var img = document.createElement('img');
                img.src = Hatena.Star.Star.ImgSrc;
                img.alt = this.name;
                with (img.style) {
                    padding = '0';
                    border = 'none';
                }
                this.img = img;
            }
    	new Ten.Observer(this.img,'onmouseover',this,'showName');
    	new Ten.Observer(this.img,'onmouseout',this,'hideName');
    	if (this.name) {
                this.user = new Hatena.Star.User(this.name);
                this.img.style.cursor = 'pointer';
                new Ten.Observer(this.img,'onclick',this,'goToUserPage');
            }
            if (args.count && args.count > 1) {
                var c = document.createElement('span');
                c.setAttribute('class', 'hatena-star-inner-count');
                Ten.Style.applyStyle(c, Hatena.Star.InnerCount.style);
                c.innerHTML = args.count;
                var s = document.createElement('span');
                s.appendChild(img);
                s.appendChild(c);
                return s;
            } else {
                return this.img;
            }
        },
        ImgSrc: Hatena.Star.BaseURL + 'images/star.gif'
    },{
        showName: function(e) {
            if (!this.screen) this.screen = new Hatena.Star.NameScreen();
            var pos = e.mousePosition();
            pos.x += 10;
            pos.y += 25;
            this.screen.showName(this.name, pos);
        },
        hideName: function() {
            if (!this.screen) return;
            this.screen.hide();
        },
        goToUserPage: function() {
            window.location = this.user.userPage();
        }
    });
    
    /* Hatena.Star.InnerCount */
    Hatena.Star.InnerCount = new Ten.Class({
        initialize: function(count, e) {
            this.count = count;
            this.entry = e;
            var c = document.createElement('span');
            c.setAttribute('class', 'hatena-star-inner-count');
            Ten.Style.applyStyle(c, Hatena.Star.InnerCount.style);
            c.style.cursor = 'pointer';
            c.innerHTML = count;
            new Ten.Observer(c,'onclick',this,'showInnerStars');
            this.container = c;
            return c;
        },
        style: {
            color: '#f4b128',
            fontWeight: 'bold',
            fontSize: '80%',
            fontFamily: '"arial", sans-serif',
            margin: '0 2px'
        }
    },{
        showInnerStars: function() {
            var url = Hatena.Star.BaseURL + 'entry.json?uri=' +
            encodeURIComponent(this.entry.uri);
            new Ten.JSONP(url, this, 'receiveStarEntry');
        },
        receiveStarEntry: function(res) {
            var se = res.entries[0];
            var e = this.entry;
            if (encodeURIComponent(se.uri) != encodeURIComponent(e.uri)) return;
            e.flushStars();
            e.bindStarEntry(se);
            e.addAddButton();
            e.showStars();
        }
    });
    
    /* Hatena.Star.Comment */
    Hatena.Star.Comment = new Ten.Class({
        initialize: function(args) {
            this.name = args.name;
            this.body = args.body;
        }
    },{
        asElement: function() {
            var div = document.createElement('div');
            with (div.style) {
                margin = '0px 0';
                padding = '5px 0';
                borderBottom = '1px solid #ddd';
            }
            var ico = Hatena.User.getProfileIcon(this.name);
            div.appendChild(ico);
            var span = document.createElement('span');
            with(span.style) {
                fontSize = '90%';
            }
            span.innerHTML = this.body;
            div.appendChild(span);
            return div;
        }
    });
    
    /* Hatena.Star.NameScreen */
    Hatena.Star.NameScreen = new Ten.Class({
        base: [Ten.SubWindow],
        style: {
            padding: '2px',
            textAlign: 'center'
        },
        containerStyle: {
            margin: 0,
            padding: 0
        },
        handleStyle: null,
        showScreen: false,
        closeButton: null,
        draggable: false
    },{
        showName: function(name, pos) {
            this.container.innerHTML = '';
            this.container.appendChild(Hatena.User.getProfileIcon(name));
            this.container.appendChild(document.createTextNode(name));
            this.show(pos);
        }
    });
    
    /* Hatena.Star.AlertScreen */
    Hatena.Star.AlertScreen = new Ten.Class({
        base: [Ten.SubWindow],
        style: {
            padding: '2px',
            textAlign: 'center',
            borderRadius: '6px',
            MozBorderRadius: '6px',
            width: '240px',
            height: '120px'
        },
        handleStyle: {
            position: 'absolute',
            top: '0px',
            left: '0px',
            backgroundColor: '#f3f3f3',
            borderBottom: '1px solid #bbb',
            width: '100%',
            height: '30px',
            borderRadius: '6px 6px 0 0',
            MozBorderRadius: '6px 6px 0 0'
        }
    },{
        showAlert: function(msg, pos) {
            this.container.innerHTML = msg;
            var win = Ten.Geometry.getWindowSize();
            var scr = Ten.Geometry.getScroll();
            var w = parseInt(this.constructor.style.width) + 20;
            if (pos.x + w > scr.x + win.w) pos.x = win.w + scr.x - w;
            this.show(pos);
        }
    });
    
    /* Hatena.Star.CommentScreen */
    Hatena.Star.CommentScreen = new Ten.Class({
        base: [Ten.SubWindow],
        initialize: function() {
            var self = this.constructor.SUPER.call(this);
            if (!self.commentsContainer) self.addCommentsContainer();
            return self;
        },
        style: {
            width: '280px',
            height: '280px',
            overflowY: 'auto',
            padding: '2px',
            textAlign: 'center',
            borderRadius: '6px',
            MozBorderRadius: '6px'
        },
        handleStyle: {
            position: 'absolute',
            top: '0px',
            left: '0px',
            backgroundColor: '#f3f3f3',
            borderBottom: '1px solid #bbb',
            width: '100%',
            height: '30px',
            borderRadius: '6px 6px 0 0',
            MozBorderRadius: '6px 6px 0 0'
        },
        containerStyle: {
            margin: '32px 0 0 0',
            textAlign: 'left',
            padding: '0 10px'
        },
        getLoadImage: function() {
            var img = document.createElement('img');
            img.src = Hatena.Star.BaseURL + 'images/load.gif';
            img.setAttribute('alt', 'Loading');
            with (img.style) {
                verticalAlign = 'middle';
                margin = '0 2px';
            }
            return img;
        }
    },{
        addCommentsContainer: function() {
            var div = document.createElement('div');
            with (div.style) {
                marginTop = '-3px';
            }
            this.container.appendChild(div);
            this.commentsContainer = div;
        },
        showComments: function(e, pos) {
            var comments = e.comments;
            if (!comments) comments = [];
            this.commentsContainer.innerHTML = '';
            for (var i=0; i<comments.length; i++) {
                this.commentsContainer.appendChild(comments[i].asElement());
            }
            if (e.starEntry && !e.can_comment) {
                this.hideCommentForm();
            } else {
                this.addCommentForm();
            }
            var win = Ten.Geometry.getWindowSize();
            var scr = Ten.Geometry.getScroll();
            var w = parseInt(this.constructor.style.width) + 20;
            if (pos.x + w > scr.x + win.w) pos.x = win.w + scr.x - w;
            this.show(pos);
        },
        bindEntry: function(e) {
            this.entry = e;
        },
        sendComment: function(e) {
            if (!e.isKey('enter')) return;
            var body = this.commentInput.value;
            if (!body) return;
            this.commentInput.disabled = 'true';
            this.showLoadImage();
            var url = Hatena.Star.BaseURL + 'comment.add.json?body=' + encodeURIComponent(body) +
                '&uri=' + encodeURIComponent(this.entry.uri) +
                '&title=' + encodeURIComponent(this.entry.title);
            new Ten.JSONP(url, this, 'receiveResult');
        },
        receiveResult: function(args) {
            if (!args.name || !args.body) return;
            this.commentInput.value = ''; 
            this.commentInput.disabled = '';
            this.hideLoadImage();
            var com = new Hatena.Star.Comment(args);
            this.entry.addComment(com);
            this.commentsContainer.appendChild(com.asElement());
        },
        showLoadImage: function() {
            if (!this.loadImage) return; 
            this.loadImage.style.display = 'inline';
        },
        hideLoadImage: function() {
            if (!this.loadImage) return; 
            this.loadImage.style.display = 'none';
        },
        hideCommentForm: function() {
            if (!this.commentForm) return;
            this.commentForm.style.display = 'none';
        },
        addCommentForm: function() {
            if (this.commentForm) {
                this.commentForm.style.display = 'block';
                return;
            }
            var form = document.createElement('div');
            this.container.appendChild(form);
            this.commentForm = form;
            with (form.style) {
                margin = '0px 0';
                padding = '5px 0';
                // borderTop = '1px solid #ddd';
            }
            //if (Hatena.Visitor) {
            //    form.appendChild(Hatena.Visitor.profileIcon());
            //} else {
            //    form.appendChild(Hatena.User.getProfileIcon());
            //}
            var input = document.createElement('input');
            input.type = 'text';
            with (input.style) {
                width = '215px';
    	    border = '1px solid #bbb';
                padding = '3px';
            }
            form.appendChild(input);
            this.commentInput = input;
            var img = this.constructor.getLoadImage();
            this.loadImage = img;
            this.hideLoadImage();
            form.appendChild(img);
            new Ten.Observer(input,'onkeypress',this,'sendComment');
        }
    });
    
    /* Hatena.Star.EntryLoader */
    Hatena.Star.EntryLoader = new Ten.Class({
        initialize: function() {
            var entries = Hatena.Star.EntryLoader.loadEntries();
            this.entries = [];
            for (var i = 0; i < entries.length; i++) {
                var e = new Hatena.Star.Entry(entries[i]);
                e.showButtons();
                this.entries.push(e);
            }
            this.getStarEntries();
        },
        createStarContainer: function() {
            var sc = document.createElement('span');
            sc.setAttribute('class', 'hatena-star-star-container');
            sc.style.marginLeft = '1px';
            return sc;
        },
        createCommentContainer: function() {
            var cc = document.createElement('span');
            cc.setAttribute('class', 'hatena-star-comment-container');
            cc.style.marginLeft = '1px';
            return cc;
        },
        scrapeTitle: function(node) {
            var rval = [];
            (function (node) {
                if (node.tagName == 'SPAN' &&
                    (node.className == 'sanchor' ||
                     node.className == 'timestamp')) {
                         return;
                } else if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) {
                    return;
                }
                var cn = node.childNodes;
                if (cn) {
                    for (var i = 0; i < cn.length; i++) {
                        arguments.callee.call(this, cn[i]);
                    }
                }
                var nodeValue = node.nodeValue;
                if (typeof(nodeValue) == 'string') {
                    rval.push(nodeValue);
                }
            })(node);
            return rval.join('');
        },
        headerTagAndClassName: ['h3',null],
        getHeaders: function() {
            var t = Hatena.Star.EntryLoader.headerTagAndClassName;
            return Ten.DOM.getElementsByTagAndClassName(t[0],t[1],document);
        },
        loadEntries: function() {
            var entries = [];
            //var headers = document.getElementsByTagName('h3');
            var c = Hatena.Star.EntryLoader;
            var headers = c.getHeaders();
            for (var i = 0; i < headers.length; i++) {
                var header = headers[i];
                var a = header.getElementsByTagName('a')[0];
                if (!a) continue;
                var uri = a.href;
                var title = '';
                // Ten.DOM.removeEmptyTextNodes(header);
                var cns = header.childNodes;
                title = c.scrapeTitle(header);
                var cc = c.createCommentContainer();
                header.appendChild(cc);
                var sc = c.createStarContainer();
                header.appendChild(sc);
                entries.push({
                    uri: uri,
                    title: title,
                    star_container: sc,
                    comment_container: cc
                });
            }
            return entries;
        }
    },{
        getStarEntries: function() {
            var url = Hatena.Star.BaseURL + 'entries.json?';
            for (var i = 0; i < this.entries.length; i++) {
                if (url.length > Ten.JSONP.MaxBytes) {
                    new Ten.JSONP(url, this, 'receiveStarEntries');
                    url = Hatena.Star.BaseURL + 'entries.json?';
                }
                url += 'uri=' + encodeURIComponent(this.entries[i].uri) + '&';
            }
            new Ten.JSONP(url, this, 'receiveStarEntries');
        },
        receiveStarEntries: function(res) {
            var entries = res.entries;
            if (!entries) entries = [];
            for (var i = 0; i < this.entries.length; i++) {
                var e = this.entries[i];
                for (var j = 0; j < entries.length; j++) {
                    var se = entries[j];
                    if (!se.uri) continue;
                    if (encodeURIComponent(se.uri) == encodeURIComponent(e.uri)) {
                        e.bindStarEntry(se);
                        entries.splice(j,1);
                        break;
                    }
                }
                if (typeof(e.can_comment) == 'undefined') {
                    e.setCanComment(res.can_comment);
                }
                e.showStars();
                e.showCommentButton();
            }
        }
    });
    
    /* Hatena.Star.WindowObserver */
    Hatena.Star.WindowObserver = new Ten.Class({
        initialize: funct
    
    
      
    ログイン ユーザー登録
    ようこそ ゲスト さん