玉を取り出す確率最大化問題
めるきたんのコメントを受けて、一般化して考え直してみよう。
n個の玉A, n個の玉Bが合わせて2n個あり、2つの箱a,bに分けて入れる。
a,bをまず無作為に選び、その後選んだ箱から1個の玉を取り出すとき、取り出した玉がAである確率を最大にするためには、どのように玉をa,bに入れておくのが最善だろうか。
Windowsでシンボリックリンクを貼る
- Vista以上の場合。
mklinkコマンドがある。
作成
mklink リンクファイル ターゲットファイル mklink /d リンクフォルダ ターゲットフォルダ
削除
del リンクファイル rd リンクフォルダ
- XPの場合
linkd.exe を入れる。
linkd リンクフォルダ ターゲットフォルダ
ファイルにリンクを貼ることはできない。
コンソールでCtrlとCAPSを入れ替える
/usr/bin/loadkeys jp106_Ctrl_CAPS
を実行。起動するたびに有効にするには、 /etc/sysconfig/keyboard の該当行を
KEYTABLE="jp106_Ctrl_CAPS"
と書き換える。
JavaScript & DOMで動的table生成
できない。
最後の手段として、stringでhtmlを吐き出すというのがあるが、これはできれば使いたくない。
<html> <head> <title></title> <script type="text/javascript"> function start(tbl) { // get the reference for the body // var body = document.getElementsByTagName("body")[0]; if (typeof tbl == "table") tbl = document.getElementsById(tbl); // creates a <table> element and a <tbody> element var tblBody = document.createElement("tbody"); // creating all cells for (var j = 0; j < 2; j++) { // creates a table row var row = document.createElement("tr"); for (var i = 0; i < 2; i++) { // Create a <td> element and a text node, make the text // node the contents of the <td>, and put the <td> at // the end of the table row var cell = document.createElement("td"); var cellText = document.createTextNode("繧サ繝ォ縺ッ "+j+" 陦^Z "+i+" 蛻^Z 縺ァ縺^Z"); cell.appendChild(cellText); row.appendChild(cell); } // add the row to the end of the table body tblBody.appendChild(row); } // put the <tbody> in the <table> tbl.appendChild(tblBody); test-table_2.html:33Uncaught TypeError: Object tblid has no method 'appendChild' test-table_2.html:33Uncaught TypeError: Object tblid has no method 'appendChild' // appends <table> into <body> // body.appendChild(tbl); // sets the border attribute of tbl to 2; tbl.setAttribute("border", "2"); } </script> </head> <body> <table id="tblid"> </table> <p> test </p> <button onclick="start('tblid');">Display Table</button> </body> </html>
こいつを読み込ませたら
Uncaught TypeError: Object tblid has no method 'appendChild' 13 Uncaught TypeError: Object tblid has no method 'appendChild'
と言われる。tableの子ノードってtbodyじゃないの常識的に考えて。
*[Linux] Blogiloでfc2ブログを書く
- Blogを選択して Add Blog... を選択
- Blog/Homepage URL: に http://blog.fc2.com/xmlrpc.php を入力
- Username と Password を登録
- Auto-configure を押すと、成功すれば、ブログ名が Title に表示されます。
- AdvancedタブでAPI を MovableType API として Fetch ボタンをクリック
- OKで閉じる。