p1atdev/ja-stackoverflow · Datasets at Fast360
{
// 获取包含Hugging Face文本的span元素
const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap');
spans.forEach(span => {
if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) {
span.textContent = 'AI快站';
}
});
});
// 替换logo图片的alt属性
document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => {
if (img.alt.match(/Hugging\s*Face/i)) {
img.alt = 'AI快站 logo';
}
});
}
// 替换导航栏中的链接
function replaceNavigationLinks() {
// 已替换标记,防止重复运行
if (window._navLinksReplaced) {
return;
}
// 已经替换过的链接集合,防止重复替换
const replacedLinks = new Set();
// 只在导航栏区域查找和替换链接
const headerArea = document.querySelector('header') || document.querySelector('nav');
if (!headerArea) {
return;
}
// 在导航区域内查找链接
const navLinks = headerArea.querySelectorAll('a');
navLinks.forEach(link => {
// 如果已经替换过,跳过
if (replacedLinks.has(link)) return;
const linkText = link.textContent.trim();
const linkHref = link.getAttribute('href') || '';
// 替换Spaces链接 - 仅替换一次
if (
(linkHref.includes('/spaces') || linkHref === '/spaces' ||
linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) &&
linkText !== 'OCR模型免费转Markdown' &&
linkText !== 'OCR模型免费转Markdown'
) {
link.textContent = 'OCR模型免费转Markdown';
link.href = 'https://fast360.xyz';
link.setAttribute('target', '_blank');
link.setAttribute('rel', 'noopener noreferrer');
replacedLinks.add(link);
}
// 删除Posts链接
else if (
(linkHref.includes('/posts') || linkHref === '/posts' ||
linkText === 'Posts' || linkText.match(/^s*Postss*$/i))
) {
if (link.parentNode) {
link.parentNode.removeChild(link);
}
replacedLinks.add(link);
}
// 替换Docs链接 - 仅替换一次
else if (
(linkHref.includes('/docs') || linkHref === '/docs' ||
linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) &&
linkText !== '模型下载攻略'
) {
link.textContent = '模型下载攻略';
link.href = '/';
replacedLinks.add(link);
}
// 删除Enterprise链接
else if (
(linkHref.includes('/enterprise') || linkHref === '/enterprise' ||
linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i))
) {
if (link.parentNode) {
link.parentNode.removeChild(link);
}
replacedLinks.add(link);
}
});
// 查找可能嵌套的Spaces和Posts文本
const textNodes = [];
function findTextNodes(element) {
if (element.nodeType === Node.TEXT_NODE) {
const text = element.textContent.trim();
if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') {
textNodes.push(element);
}
} else {
for (const child of element.childNodes) {
findTextNodes(child);
}
}
}
// 只在导航区域内查找文本节点
findTextNodes(headerArea);
// 替换找到的文本节点
textNodes.forEach(node => {
const text = node.textContent.trim();
if (text === 'Spaces') {
node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown');
} else if (text === 'Posts') {
// 删除Posts文本节点
if (node.parentNode) {
node.parentNode.removeChild(node);
}
} else if (text === 'Enterprise') {
// 删除Enterprise文本节点
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}
});
// 标记已替换完成
window._navLinksReplaced = true;
}
// 替换代码区域中的域名
function replaceCodeDomains() {
// 特别处理span.hljs-string和span.njs-string元素
document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => {
if (span.textContent && span.textContent.includes('huggingface.co')) {
span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com');
}
});
// 替换hljs-string类的span中的域名(移除多余的转义符号)
document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => {
if (span.textContent && span.textContent.includes('huggingface.co')) {
span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com');
}
});
// 替换pre和code标签中包含git clone命令的域名
document.querySelectorAll('pre, code').forEach(element => {
if (element.textContent && element.textContent.includes('git clone')) {
const text = element.innerHTML;
if (text.includes('huggingface.co')) {
element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com');
}
}
});
// 处理特定的命令行示例
document.querySelectorAll('pre, code').forEach(element => {
const text = element.innerHTML;
if (text.includes('huggingface.co')) {
// 针对git clone命令的专门处理
if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) {
element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com');
}
}
});
// 特别处理模型下载页面上的代码片段
document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => {
const content = container.innerHTML;
if (content && content.includes('huggingface.co')) {
container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com');
}
});
// 特别处理模型仓库克隆对话框中的代码片段
try {
// 查找包含"Clone this model repository"标题的对话框
const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]');
if (cloneDialog) {
// 查找对话框中所有的代码片段和命令示例
const codeElements = cloneDialog.querySelectorAll('pre, code, span');
codeElements.forEach(element => {
if (element.textContent && element.textContent.includes('huggingface.co')) {
if (element.innerHTML.includes('huggingface.co')) {
element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com');
} else {
element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com');
}
}
});
}
// 更精确地定位克隆命令中的域名
document.querySelectorAll('[data-target]').forEach(container => {
const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string');
codeBlocks.forEach(block => {
if (block.textContent && block.textContent.includes('huggingface.co')) {
if (block.innerHTML.includes('huggingface.co')) {
block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com');
} else {
block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com');
}
}
});
});
} catch (e) {
// 错误处理但不打印日志
}
}
// 当DOM加载完成后执行替换
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => {
replaceHeaderBranding();
replaceNavigationLinks();
replaceCodeDomains();
// 只在必要时执行替换 - 3秒后再次检查
setTimeout(() => {
if (!window._navLinksReplaced) {
console.log('[Client] 3秒后重新检查导航链接');
replaceNavigationLinks();
}
}, 3000);
});
} else {
replaceHeaderBranding();
replaceNavigationLinks();
replaceCodeDomains();
// 只在必要时执行替换 - 3秒后再次检查
setTimeout(() => {
if (!window._navLinksReplaced) {
console.log('[Client] 3秒后重新检查导航链接');
replaceNavigationLinks();
}
}, 3000);
}
// 增加一个MutationObserver来处理可能的动态元素加载
const observer = new MutationObserver(mutations => {
// 检查是否导航区域有变化
const hasNavChanges = mutations.some(mutation => {
// 检查是否存在header或nav元素变化
return Array.from(mutation.addedNodes).some(node => {
if (node.nodeType === Node.ELEMENT_NODE) {
// 检查是否是导航元素或其子元素
if (node.tagName === 'HEADER' || node.tagName === 'NAV' ||
node.querySelector('header, nav')) {
return true;
}
// 检查是否在导航元素内部
let parent = node.parentElement;
while (parent) {
if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') {
return true;
}
parent = parent.parentElement;
}
}
return false;
});
});
// 只在导航区域有变化时执行替换
if (hasNavChanges) {
// 重置替换状态,允许再次替换
window._navLinksReplaced = false;
replaceHeaderBranding();
replaceNavigationLinks();
}
});
// 开始观察document.body的变化,包括子节点
if (document.body) {
observer.observe(document.body, { childList: true, subtree: true });
} else {
document.addEventListener('DOMContentLoaded', () => {
observer.observe(document.body, { childList: true, subtree: true });
});
}
})();
\\n \\n```\",\n \"comment_count\": 3,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T02:28:20.707\",\n \"favorite_count\": 0,\n \"id\": \"5476\",\n \"last_activity_date\": \"2015-01-30T02:54:23.090\",\n \"last_edit_date\": \"2015-01-28T03:20:08.220\",\n \"last_editor_user_id\": \"4978\",\n \"owner_user_id\": \"7887\",\n \"post_type\": \"question\",\n \"score\": 2,\n \"tags\": [\n \"php\",\n \"html\",\n \"line-opengraph\",\n \"opengraph\"\n ],\n \"title\": \"LINE の OGP のリッチ表示についての質問です。\",\n \"view_count\": 4721\n}"},"answers":{"kind":"list like","value":[{"body":"上記の内容で思いつく原因として、以下が考えられそうです。\n\n * 「LINEで送る」Buttonでは認識されないTop level domainだった。\n\nそれ以外の理由は、ちょっと思いつきません。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-30T02:54:23.090","id":"5596","last_activity_date":"2015-01-30T02:54:23.090","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"531","parent_id":"5476","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"上記の内容で思いつく原因として、以下が考えられそうです。\\n\\n * 「LINEで送る」Buttonでは認識されないTop level domainだった。\\n\\nそれ以外の理由は、ちょっと思いつきません。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-30T02:54:23.090\",\n \"id\": \"5596\",\n \"last_activity_date\": \"2015-01-30T02:54:23.090\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"531\",\n \"parent_id\": \"5476\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"5476"},"accepted_answer_id":{"kind":"string","value":"5596"},"popular_answer_id":{"kind":"string","value":"5596"}}},{"rowIdx":1023,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 2,\n \"body\": \"### 前提\\n\\n現在以下の構成で TCP サーバアプリケーションを作成しています。\\n\\n```\\n\\n PC(クライアント)<──インターネット──>ロードバランサ ───────サーバ1\\n │─────────────────────────────サーバ2\\n │─────────────────────────────サーバ3\\n \\n```\\n\\nサーバアプリケーションとしては .NET Framework の `Socket` クラスを使用しています。\\n\\nソケットクラスに指定しているパラメタとしては\\n\\n * `AddressFamily#InterNetwork`\\n * `SocketType#Stream`\\n * `ProtocolType#Tcp`\\n\\nインスタンス生成時、上記を設定( TCP 送受信設定)しています。\\n\\nまた、環境は以下です。\\n\\n * クライアント PC:Windows 7\\n * サーバ:Windowws Server2012\\n * ロードバランサ:BIG-IP\\n * 開発言語:C++/CLI\\n * 実行環境:.NET Framework 4.5\\n * プログラム作成環境:Visual Studio Pro 2012\\n\\n## 質問事項\\n\\n以下のコードで、本来は接続されたクライアントのIPアドレスを取得出来る想定でしたが、ロードバランサのIPアドレスが取得されます。\\n\\n以下擬似コード\\n\\n```\\n\\n Socket ClientSocket = ServerSocket.EndAccept(iAsyncResult);\\n String IpAddress = ((IPEndPoint)ClientSocket.RemoteEndPoint).Address.ToString();\\n Console.WriteLine(IpAddress);\\n \\n --------------\\n 出力結果:ロードバランサのIPアドレス\\n --------------\\n \\n```\\n\\nWireShark を使用してパケットモニタリングし、調査した結果、 IP ヘッダにはクライアント PC\\nのIPアドレスが入っていることがわかりました。おそらく、プログラムで取得するやり方が悪いのだと思われるのですが、 IP ヘッダに記載されている IP\\nアドレスを取得する方法がわかりません。\\n\\n少しでも良いのでヒントになる情報があれば、ご教授くださると助かります。\",\n \"comment_count\": 6,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T02:32:50.143\",\n \"favorite_count\": 0,\n \"id\": \"5477\",\n \"last_activity_date\": \"2015-04-15T15:11:06.603\",\n \"last_edit_date\": \"2015-01-28T03:37:13.760\",\n \"last_editor_user_id\": \"4978\",\n \"owner_user_id\": \"2647\",\n \"post_type\": \"question\",\n \"score\": 4,\n \"tags\": [\n \"windows\",\n \".net\",\n \"socket\"\n ],\n \"title\": \".NET でロードバランサがある場合の送信元IPアドレス取得方法\",\n \"view_count\": 3000\n}"},"answers":{"kind":"list like","value":[{"body":"考えられるのは\n\n 1. .NETのバグ\n 2. プログラムのバグ\n 3. クライアントのアドレスがNATされている\n 4. 実際にロードバランサとサーバが通信している\n\nと言うところでしょうか(順不同)。\n\n英語版にも同様の質問がありましたが、proxyじゃないのか、という回答がついてます。\n\n[Socket.RemoteEndPoint returns gateway\naddress](https://stackoverflow.com/questions/18222140/socket-remoteendpoint-\nreturns-gateway-address)\n\nコメントと重複するところもありますが、一般論として確認する項目や方法を列挙しておきます。\n\n## トレース情報の出力\n\n[トレース情報の出力を有効](https://msdn.microsoft.com/ja-\njp/library/ty48b824%28v=vs.110%29.aspx)にすることで、Socketのトレースがとれます。\n\n```\n\n System.Net.Sockets Information: 0 : [4292] Socket#45653674 - 192.168.1.2:58849 から 192.168.1.1:22222 への接続を受け入れました。\n \n```\n\n## netstat\n\n```\n\n C:\\> netstat -n\n アクティブな接続\n \n プロトコル ローカル アドレス 外部アドレス 状態\n TCP 127.0.0.1:22222 127.0.0.1:51819 ESTABLISHED\n TCP 192.168.1.1:22222 192.168.1.2:58849 ESTABLISHED\n \n```\n\n不要分を省略してますが、この例だとサーバのポート(22222)に対して2つの接続があります。\n\nクライアント-サーバの接続が正しく表示されていますか?また、ロードバランサ-サーバの接続がありませんか?\n\n## パケットダンプ\n\n[Wireshark](https://www.wireshark.org/)等のネットワークアナライザでパケットを取得し確認する。\n\nこのとき注意することとしては、「自分の意図どおりのパケット」以外にも注目することです。\n\n今回の例では、PC-\nサーバ宛てのパケットが「意図通りのパケット」に当たりますが、実はそのパケットではコネクションが張れていないとか、それ以外にロードバランサ-\nサーバ間の通信が実際に存在したりしませんか。\n\n## ロードバランサ\n\nロードバランサは(設計)設定によってクライアントだったりサーバだったりのアドレスを変換します。どのような設定になっているか確認してください。\n\nまた、ヘルスチェックを行っている場合、ロードバランサがサーバに接続します。これが意図しない不具合を起こす場合もあります。(ソケットが埋まるなど)","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-04T02:09:57.767","id":"5907","last_activity_date":"2015-02-04T02:09:57.767","last_edit_date":"2017-05-23T12:38:56.083","last_editor_user_id":"-1","owner_user_id":"5793","parent_id":"5477","post_type":"answer","score":2},{"body":"WebRequestではなくSocketを使っていることから、HTTP以外のプロトコルかな?という気もしますが、仮にHTTPであれば、BIG-\nIPがアドレスを付け替えた際に、HTTPヘッダにX-Forwarded-Forヘッダを付けます。\n\n\n\nで、HTTPヘッダに情報が乗っていればWebRequest.Headersプロパティから取得できると思います。(試してませんが・・・)","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-14T14:13:56.197","id":"6488","last_activity_date":"2015-02-14T14:13:56.197","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"8278","parent_id":"5477","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"考えられるのは\\n\\n 1. .NETのバグ\\n 2. プログラムのバグ\\n 3. クライアントのアドレスがNATされている\\n 4. 実際にロードバランサとサーバが通信している\\n\\nと言うところでしょうか(順不同)。\\n\\n英語版にも同様の質問がありましたが、proxyじゃないのか、という回答がついてます。\\n\\n[Socket.RemoteEndPoint returns gateway\\naddress](https://stackoverflow.com/questions/18222140/socket-remoteendpoint-\\nreturns-gateway-address)\\n\\nコメントと重複するところもありますが、一般論として確認する項目や方法を列挙しておきます。\\n\\n## トレース情報の出力\\n\\n[トレース情報の出力を有効](https://msdn.microsoft.com/ja-\\njp/library/ty48b824%28v=vs.110%29.aspx)にすることで、Socketのトレースがとれます。\\n\\n```\\n\\n System.Net.Sockets Information: 0 : [4292] Socket#45653674 - 192.168.1.2:58849 から 192.168.1.1:22222 への接続を受け入れました。\\n \\n```\\n\\n## netstat\\n\\n```\\n\\n C:\\\\> netstat -n\\n アクティブな接続\\n \\n プロトコル ローカル アドレス 外部アドレス 状態\\n TCP 127.0.0.1:22222 127.0.0.1:51819 ESTABLISHED\\n TCP 192.168.1.1:22222 192.168.1.2:58849 ESTABLISHED\\n \\n```\\n\\n不要分を省略してますが、この例だとサーバのポート(22222)に対して2つの接続があります。\\n\\nクライアント-サーバの接続が正しく表示されていますか?また、ロードバランサ-サーバの接続がありませんか?\\n\\n## パケットダンプ\\n\\n[Wireshark](https://www.wireshark.org/)等のネットワークアナライザでパケットを取得し確認する。\\n\\nこのとき注意することとしては、「自分の意図どおりのパケット」以外にも注目することです。\\n\\n今回の例では、PC-\\nサーバ宛てのパケットが「意図通りのパケット」に当たりますが、実はそのパケットではコネクションが張れていないとか、それ以外にロードバランサ-\\nサーバ間の通信が実際に存在したりしませんか。\\n\\n## ロードバランサ\\n\\nロードバランサは(設計)設定によってクライアントだったりサーバだったりのアドレスを変換します。どのような設定になっているか確認してください。\\n\\nまた、ヘルスチェックを行っている場合、ロードバランサがサーバに接続します。これが意図しない不具合を起こす場合もあります。(ソケットが埋まるなど)\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-04T02:09:57.767\",\n \"id\": \"5907\",\n \"last_activity_date\": \"2015-02-04T02:09:57.767\",\n \"last_edit_date\": \"2017-05-23T12:38:56.083\",\n \"last_editor_user_id\": \"-1\",\n \"owner_user_id\": \"5793\",\n \"parent_id\": \"5477\",\n \"post_type\": \"answer\",\n \"score\": 2\n },\n {\n \"body\": \"WebRequestではなくSocketを使っていることから、HTTP以外のプロトコルかな?という気もしますが、仮にHTTPであれば、BIG-\\nIPがアドレスを付け替えた際に、HTTPヘッダにX-Forwarded-Forヘッダを付けます。\\n\\n\\n\\nで、HTTPヘッダに情報が乗っていればWebRequest.Headersプロパティから取得できると思います。(試してませんが・・・)\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-14T14:13:56.197\",\n \"id\": \"6488\",\n \"last_activity_date\": \"2015-02-14T14:13:56.197\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8278\",\n \"parent_id\": \"5477\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"5477"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"5907"}}},{"rowIdx":1024,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"5591\",\n \"answer_count\": 1,\n \"body\": \"Microsoft Word の docx 形式ファイルにおいて、指定したテキスト要素が何ページに表示されるのか、取得したいと考えています。\\n\\nApache POI または XML を直接操作した場合どうやって取得したらよいでしょうか。\\n\\nそもそも不可能なのでしょうか。\",\n \"comment_count\": 2,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T02:44:56.780\",\n \"favorite_count\": 0,\n \"id\": \"5479\",\n \"last_activity_date\": \"2015-01-30T00:52:29.100\",\n \"last_edit_date\": \"2015-01-28T12:52:09.810\",\n \"last_editor_user_id\": \"4978\",\n \"owner_user_id\": \"2298\",\n \"post_type\": \"question\",\n \"score\": 5,\n \"tags\": [\n \"java\",\n \"apache-poi\",\n \"docx\",\n \"ms-word\"\n ],\n \"title\": \"MS-Word 文章 (.docx) 中、指定テキストが何ページ目にあるか調べたい\",\n \"view_count\": 919\n}"},"answers":{"kind":"list like","value":[{"body":"document.xmlのページサイズ(w:pgSz)の高さからマージン(w:pgMar)のtop/bottom/header/footerを引いたものを変数で用意して、各パラグラフ(w:p)をドキュメントグリッド(w:docGrid)のlinePitchで乗算し、最初に用意した変数を超えたら改ページとするくらいしか浮かびませんね・・・。\n\n例外として、各パラグラフの中にw:lastRenderedPageBreakもしくはw:brのw:type=pageがあればその場で改ページという条件が必要ですけれど。\n\nECMA-376でもページに関する記載は無いため、自力で上記のようにコンテンツ描画をエミュレートするしかなさそうです。\n\nただ注意してほしいのは、MS\nOfficeは完全にECMA-376準拠というわけではないので、あらゆる例外が発生すると頭の片隅に残しておいてください。(私はExcelで泣きました・・・)","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-30T00:52:29.100","id":"5591","last_activity_date":"2015-01-30T00:52:29.100","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"3709","parent_id":"5479","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"document.xmlのページサイズ(w:pgSz)の高さからマージン(w:pgMar)のtop/bottom/header/footerを引いたものを変数で用意して、各パラグラフ(w:p)をドキュメントグリッド(w:docGrid)のlinePitchで乗算し、最初に用意した変数を超えたら改ページとするくらいしか浮かびませんね・・・。\\n\\n例外として、各パラグラフの中にw:lastRenderedPageBreakもしくはw:brのw:type=pageがあればその場で改ページという条件が必要ですけれど。\\n\\nECMA-376でもページに関する記載は無いため、自力で上記のようにコンテンツ描画をエミュレートするしかなさそうです。\\n\\nただ注意してほしいのは、MS\\nOfficeは完全にECMA-376準拠というわけではないので、あらゆる例外が発生すると頭の片隅に残しておいてください。(私はExcelで泣きました・・・)\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-30T00:52:29.100\",\n \"id\": \"5591\",\n \"last_activity_date\": \"2015-01-30T00:52:29.100\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"3709\",\n \"parent_id\": \"5479\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"5479"},"accepted_answer_id":{"kind":"string","value":"5591"},"popular_answer_id":{"kind":"string","value":"5591"}}},{"rowIdx":1025,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"5489\",\n \"answer_count\": 5,\n \"body\": \"PC の `bash` から `adb shell` に入り、連続して `cat` を実行した結果を、カンマ区切りの CSV で PC へと保存したいです。\\n\\n列1 に項目名を、列2 に `cat` した結果を保存する方法をご教示いただけませんでしょうか。\\n\\nスクリプト:\\n\\n```\\n\\n #!/usr/bin/bash -v \\n echo \\\"項目1\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/ipv4/tcp_sack >> hogelist.txt\\n echo \\\"項目2\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/core/rmem_max >> hogelist.txt\\n echo \\\"項目3\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/ipv4/tcp_rmem >> hogelist.txt\\n \\n```\\n\\n現在の出力結果 ( `hogelist.txt` )\\n\\n```\\n\\n 項目1\\n 1\\n 項目2\\n 163840\\n 項目3\\n 4098 46284 1094304\\n \\n```\\n\\n出力したい結果 ( `hogelist.csv` )\\n\\n```\\n\\n 項目1,1\\n 項目2,163840\\n 項目3,4098 46284 1094304\\n \\n```\",\n \"comment_count\": 3,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T04:14:31.983\",\n \"favorite_count\": 0,\n \"id\": \"5484\",\n \"last_activity_date\": \"2015-01-30T08:21:36.587\",\n \"last_edit_date\": \"2015-01-30T08:21:36.587\",\n \"last_editor_user_id\": \"4978\",\n \"owner_user_id\": \"7590\",\n \"post_type\": \"question\",\n \"score\": 2,\n \"tags\": [\n \"android\",\n \"bash\",\n \"sh\",\n \"adb\"\n ],\n \"title\": \"連続して cat を実行した結果を、カンマ区切りの CSV で保存したい( adb shell )\",\n \"view_count\": 11399\n}"},"answers":{"kind":"list like","value":[{"body":"ちょっと質問の意図を正しく読み取れているか不安ですが、こういうことでしょうか?\n\n```\n\n $ cat a\n koumoku1\n koumoku2\n koumoku3\n $ cat b\n 111\n 222\n 333\n $ paste -d',' a b\n koumoku1,111\n koumoku2,222\n koumoku3,333\n \n```","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T04:23:33.157","id":"5486","last_activity_date":"2015-01-28T04:23:33.157","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"4508","parent_id":"5484","post_type":"answer","score":1},{"body":"それでは以下の様になります。\n\n```\n\n $ awk 'NR%2{printf(\"%s,\", $0)} !(NR%2)' hogelist.txt\n \n```\n\n# もっとも、元のシェルスクリプトだけで最終結果を出力する方が良いかと思いますが。\n\n追記:\n\nbash ということで、元のシェルスクリプトを以下の様にすることもできるでしょう。\n\n```\n\n #/usr/bin/bash\n \n declare -a input\n input=(\n /proc/sys/net/ipv4/tcp_sack\n /proc/sys/net/core/rmem_max\n /proc/sys/net/ipv4/tcp_rmem\n )\n \n declare -i i=0\n for f in ${input[@]}\n do\n printf \"項目%d, %s\\n\" $((i+1)) \"$(adb shell cat ${input[$i]})\"\n : $((i++))\n done\n \n```\n\nただ、adb shell を使った場合を試していないので、その場合は期待する結果を得られないかもしれません。\n\n追記2:\n\nご存じの方も多いでしょうが、bash には `printf` という **ビルトインコマンド** が存在します。\n\n```\n\n $ type printf\n printf is a shell builtin\n \n```\n\n`/usr/bin/printf` コマンドに対して、いくつかの書式指定文字列が追加されています。\n\n```\n\n $ help printf\n :\n %b expand backslash escape sequences in the corresponding argument\n %q quote the argument in a way that can be reused as shell input\n \n```\n\nこれらは、状況によっては便利なこともあります。ご参考までにどうぞ。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T04:29:29.693","id":"5487","last_activity_date":"2015-01-28T07:12:40.653","last_edit_date":"2015-01-28T07:12:40.653","last_editor_user_id":null,"owner_user_id":null,"parent_id":"5484","post_type":"answer","score":3},{"body":"`echo -n` だけでも行ける気がしました。\n\n```\n\n #!/usr/bin/bash -v \n \n echo -n \"項目1,\" >> hogelist.txt\n adb shell cat /proc/sys/net/ipv4/tcp_sack >> hogelist.txt\n echo -n \"項目2,\" >> hogelist.txt\n adb shell cat /proc/sys/net/core/rmem_max >> hogelist.txt\n echo -n \"項目3,\" >> hogelist.txt\n adb shell cat /proc/sys/net/ipv4/tcp_rmem /hoge3 >> hogelist.txt\n \n```\n\n_Output_ :\n\n```\n\n $ cat hogelist.txt\n 項目1,1\n 項目2,163840\n 項目3,4098 46284 1094304\n \n```\n\n_man_ : `LANG=ja_JP.UTF-8 man echo`\n\n> 名前 \n> echo - 1 行のテキストを表示する \n> ...\n>\n> 説明 \n> STRING を標準出力に出力する\n```\n\n> -n 最後に改行を出力しない\n> \n```","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T04:54:26.650","id":"5488","last_activity_date":"2015-01-28T04:54:26.650","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"4978","parent_id":"5484","post_type":"answer","score":2},{"body":"多くの OS の `sh` (bash, zsh も含む) の組込みコマンド `echo` は、`-n` オプションで改行を抑制できます。\n\n```\n\n #!/bin/sh\n echo -n \"項目1,\" >> hogelist.txt\n adb shell cat /proc/sys/net/ipv4/tcp_sack >> hogelist.txt\n echo -n \"項目2,\" >> hogelist.txt\n adb shell cat /proc/sys/net/core/rmem_max >> hogelist.txt\n echo -n \"項目3,\" >> hogelist.txt\n adb shell cat /proc/sys/net/ipv4/tcp_rmem /hoge3 >> hogelist.txt\n \n```\n\nしかし、Solaris など SYSV 系の OS の `sh` の `echo` では `-n`\nオプションはサポートしていません。代わりに、出力したい文字列の最後に `\\c` を付与します。\n\n```\n\n #!/bin/sh\n echo \"項目1,\\c\" >> hogelist.txt\n adb shell cat /proc/sys/net/ipv4/tcp_sack >> hogelist.txt\n echo \"項目2,\\c\" >> hogelist.txt\n adb shell cat /proc/sys/net/core/rmem_max >> hogelist.txt\n echo \"項目3,\\c\" >> hogelist.txt\n adb shell cat /proc/sys/net/ipv4/tcp_rmem /hoge3 >> hogelist.txt\n \n```","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T04:55:00.960","id":"5489","last_activity_date":"2015-01-28T05:44:48.053","last_edit_date":"2015-01-28T05:44:48.053","last_editor_user_id":"7590","owner_user_id":"3061","parent_id":"5484","post_type":"answer","score":3},{"body":"今 adb の環境が手元にないので分かりませんが、コマンド置換では出来ないでしょか?\n\n```\n\n adb shell echo 項目1,`cat /proc/sys/net/ipv4/tcp_sack` >> hogelist.txt\n adb shell echo 項目2,`cat /proc/sys/net/core/rmem_max` >> hogelist.txt\n adb shell echo 項目3,`cat /proc/sys/net/ipv4/tcp_rmem` >> hogelist.txt\n \n```\n\n**追記**\n\n```\n\n adb shell sh -c \"echo 項目1,`cat /proc/sys/net/ipv4/tcp_sack` >> hogelist.txt\"\n adb shell sh -c \"echo 項目2,`cat /proc/sys/net/core/rmem_max` >> hogelist.txt\"\n adb shell sh -c \"echo 項目3,`cat /proc/sys/net/ipv4/tcp_rmem` >> hogelist.txt\"\n \n```\n\n**さらに追記**\n\n```\n\n adb shell sh -c \"echo 項目1,`cat /proc/sys/net/ipv4/tcp_sack`\" >> hogelist.txt\n adb shell sh -c \"echo 項目2,`cat /proc/sys/net/core/rmem_max`\" >> hogelist.txt\n adb shell sh -c \"echo 項目3,`cat /proc/sys/net/ipv4/tcp_rmem`\" >> hogelist.txt\n \n```","comment_count":6,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T06:31:22.820","id":"5497","last_activity_date":"2015-01-28T07:38:27.390","last_edit_date":"2015-01-28T07:38:27.390","last_editor_user_id":"440","owner_user_id":"440","parent_id":"5484","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"ちょっと質問の意図を正しく読み取れているか不安ですが、こういうことでしょうか?\\n\\n```\\n\\n $ cat a\\n koumoku1\\n koumoku2\\n koumoku3\\n $ cat b\\n 111\\n 222\\n 333\\n $ paste -d',' a b\\n koumoku1,111\\n koumoku2,222\\n koumoku3,333\\n \\n```\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T04:23:33.157\",\n \"id\": \"5486\",\n \"last_activity_date\": \"2015-01-28T04:23:33.157\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"4508\",\n \"parent_id\": \"5484\",\n \"post_type\": \"answer\",\n \"score\": 1\n },\n {\n \"body\": \"それでは以下の様になります。\\n\\n```\\n\\n $ awk 'NR%2{printf(\\\"%s,\\\", $0)} !(NR%2)' hogelist.txt\\n \\n```\\n\\n# もっとも、元のシェルスクリプトだけで最終結果を出力する方が良いかと思いますが。\\n\\n追記:\\n\\nbash ということで、元のシェルスクリプトを以下の様にすることもできるでしょう。\\n\\n```\\n\\n #/usr/bin/bash\\n \\n declare -a input\\n input=(\\n /proc/sys/net/ipv4/tcp_sack\\n /proc/sys/net/core/rmem_max\\n /proc/sys/net/ipv4/tcp_rmem\\n )\\n \\n declare -i i=0\\n for f in ${input[@]}\\n do\\n printf \\\"項目%d, %s\\\\n\\\" $((i+1)) \\\"$(adb shell cat ${input[$i]})\\\"\\n : $((i++))\\n done\\n \\n```\\n\\nただ、adb shell を使った場合を試していないので、その場合は期待する結果を得られないかもしれません。\\n\\n追記2:\\n\\nご存じの方も多いでしょうが、bash には `printf` という **ビルトインコマンド** が存在します。\\n\\n```\\n\\n $ type printf\\n printf is a shell builtin\\n \\n```\\n\\n`/usr/bin/printf` コマンドに対して、いくつかの書式指定文字列が追加されています。\\n\\n```\\n\\n $ help printf\\n :\\n %b expand backslash escape sequences in the corresponding argument\\n %q quote the argument in a way that can be reused as shell input\\n \\n```\\n\\nこれらは、状況によっては便利なこともあります。ご参考までにどうぞ。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T04:29:29.693\",\n \"id\": \"5487\",\n \"last_activity_date\": \"2015-01-28T07:12:40.653\",\n \"last_edit_date\": \"2015-01-28T07:12:40.653\",\n \"last_editor_user_id\": null,\n \"owner_user_id\": null,\n \"parent_id\": \"5484\",\n \"post_type\": \"answer\",\n \"score\": 3\n },\n {\n \"body\": \"`echo -n` だけでも行ける気がしました。\\n\\n```\\n\\n #!/usr/bin/bash -v \\n \\n echo -n \\\"項目1,\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/ipv4/tcp_sack >> hogelist.txt\\n echo -n \\\"項目2,\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/core/rmem_max >> hogelist.txt\\n echo -n \\\"項目3,\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/ipv4/tcp_rmem /hoge3 >> hogelist.txt\\n \\n```\\n\\n_Output_ :\\n\\n```\\n\\n $ cat hogelist.txt\\n 項目1,1\\n 項目2,163840\\n 項目3,4098 46284 1094304\\n \\n```\\n\\n_man_ : `LANG=ja_JP.UTF-8 man echo`\\n\\n> 名前 \\n> echo - 1 行のテキストを表示する \\n> ...\\n>\\n> 説明 \\n> STRING を標準出力に出力する\\n```\\n\\n> -n 最後に改行を出力しない\\n> \\n```\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T04:54:26.650\",\n \"id\": \"5488\",\n \"last_activity_date\": \"2015-01-28T04:54:26.650\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"4978\",\n \"parent_id\": \"5484\",\n \"post_type\": \"answer\",\n \"score\": 2\n },\n {\n \"body\": \"多くの OS の `sh` (bash, zsh も含む) の組込みコマンド `echo` は、`-n` オプションで改行を抑制できます。\\n\\n```\\n\\n #!/bin/sh\\n echo -n \\\"項目1,\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/ipv4/tcp_sack >> hogelist.txt\\n echo -n \\\"項目2,\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/core/rmem_max >> hogelist.txt\\n echo -n \\\"項目3,\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/ipv4/tcp_rmem /hoge3 >> hogelist.txt\\n \\n```\\n\\nしかし、Solaris など SYSV 系の OS の `sh` の `echo` では `-n`\\nオプションはサポートしていません。代わりに、出力したい文字列の最後に `\\\\c` を付与します。\\n\\n```\\n\\n #!/bin/sh\\n echo \\\"項目1,\\\\c\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/ipv4/tcp_sack >> hogelist.txt\\n echo \\\"項目2,\\\\c\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/core/rmem_max >> hogelist.txt\\n echo \\\"項目3,\\\\c\\\" >> hogelist.txt\\n adb shell cat /proc/sys/net/ipv4/tcp_rmem /hoge3 >> hogelist.txt\\n \\n```\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T04:55:00.960\",\n \"id\": \"5489\",\n \"last_activity_date\": \"2015-01-28T05:44:48.053\",\n \"last_edit_date\": \"2015-01-28T05:44:48.053\",\n \"last_editor_user_id\": \"7590\",\n \"owner_user_id\": \"3061\",\n \"parent_id\": \"5484\",\n \"post_type\": \"answer\",\n \"score\": 3\n },\n {\n \"body\": \"今 adb の環境が手元にないので分かりませんが、コマンド置換では出来ないでしょか?\\n\\n```\\n\\n adb shell echo 項目1,`cat /proc/sys/net/ipv4/tcp_sack` >> hogelist.txt\\n adb shell echo 項目2,`cat /proc/sys/net/core/rmem_max` >> hogelist.txt\\n adb shell echo 項目3,`cat /proc/sys/net/ipv4/tcp_rmem` >> hogelist.txt\\n \\n```\\n\\n**追記**\\n\\n```\\n\\n adb shell sh -c \\\"echo 項目1,`cat /proc/sys/net/ipv4/tcp_sack` >> hogelist.txt\\\"\\n adb shell sh -c \\\"echo 項目2,`cat /proc/sys/net/core/rmem_max` >> hogelist.txt\\\"\\n adb shell sh -c \\\"echo 項目3,`cat /proc/sys/net/ipv4/tcp_rmem` >> hogelist.txt\\\"\\n \\n```\\n\\n**さらに追記**\\n\\n```\\n\\n adb shell sh -c \\\"echo 項目1,`cat /proc/sys/net/ipv4/tcp_sack`\\\" >> hogelist.txt\\n adb shell sh -c \\\"echo 項目2,`cat /proc/sys/net/core/rmem_max`\\\" >> hogelist.txt\\n adb shell sh -c \\\"echo 項目3,`cat /proc/sys/net/ipv4/tcp_rmem`\\\" >> hogelist.txt\\n \\n```\",\n \"comment_count\": 6,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T06:31:22.820\",\n \"id\": \"5497\",\n \"last_activity_date\": \"2015-01-28T07:38:27.390\",\n \"last_edit_date\": \"2015-01-28T07:38:27.390\",\n \"last_editor_user_id\": \"440\",\n \"owner_user_id\": \"440\",\n \"parent_id\": \"5484\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"5484"},"accepted_answer_id":{"kind":"string","value":"5489"},"popular_answer_id":{"kind":"string","value":"5487"}}},{"rowIdx":1026,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"5493\",\n \"answer_count\": 2,\n \"body\": \"JSP の `html:checkbox`\\nで、初期値でチェックを入れた状態にしたいのですが、属性には初期値でチェックをいれた状態にするものがないように思います。\\n\\n方法が分かる方がいましたら、ご教授お願いします。\\n\\n```\\n\\n \\n チェックボックス\\n \\n \\n```\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T05:09:03.587\",\n \"favorite_count\": 0,\n \"id\": \"5490\",\n \"last_activity_date\": \"2015-01-28T05:37:27.050\",\n \"last_edit_date\": \"2015-01-28T05:37:27.050\",\n \"last_editor_user_id\": \"7214\",\n \"owner_user_id\": \"7626\",\n \"post_type\": \"question\",\n \"score\": 1,\n \"tags\": [\n \"java\",\n \"html\",\n \"jsp\",\n \"struts\"\n ],\n \"title\": \"Struts:JSPのhtml:checkboxで、初期値でチェックを入れた状態にしたいです。\",\n \"view_count\": 24761\n}"},"answers":{"kind":"list like","value":[{"body":"少し古い記事ですが参考になりそうなページがありました。 \n\n\n手元に環境がないため、動作確認ができず申し訳無いのですが、 \nご参考になれば幸いです。\n\n追記 \n----- リンク先から抜粋 (html:multibox) -----\n```\n\n public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {\n if(request.getParameter(\"multi\") == null){\n multi = null;\n }\n return super.validate(mapping, request);\n }\n \n```","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T05:20:08.483","id":"5491","last_activity_date":"2015-01-28T05:20:08.483","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"3516","parent_id":"5490","post_type":"answer","score":1},{"body":" \nの中盤に説明があります。\n\nフォームのBeanのpropertyの属性Aに \ntrueを設定して下さい。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T05:32:04.410","id":"5493","last_activity_date":"2015-01-28T05:32:04.410","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"2904","parent_id":"5490","post_type":"answer","score":3}],"string":"[\n {\n \"body\": \"少し古い記事ですが参考になりそうなページがありました。 \\n\\n\\n手元に環境がないため、動作確認ができず申し訳無いのですが、 \\nご参考になれば幸いです。\\n\\n追記 \\n----- リンク先から抜粋 (html:multibox) -----\\n```\\n\\n public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {\\n if(request.getParameter(\\\"multi\\\") == null){\\n multi = null;\\n }\\n return super.validate(mapping, request);\\n }\\n \\n```\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T05:20:08.483\",\n \"id\": \"5491\",\n \"last_activity_date\": \"2015-01-28T05:20:08.483\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"3516\",\n \"parent_id\": \"5490\",\n \"post_type\": \"answer\",\n \"score\": 1\n },\n {\n \"body\": \" \\nの中盤に説明があります。\\n\\nフォームのBeanのpropertyの属性Aに \\ntrueを設定して下さい。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T05:32:04.410\",\n \"id\": \"5493\",\n \"last_activity_date\": \"2015-01-28T05:32:04.410\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"2904\",\n \"parent_id\": \"5490\",\n \"post_type\": \"answer\",\n \"score\": 3\n }\n]"},"id":{"kind":"string","value":"5490"},"accepted_answer_id":{"kind":"string","value":"5493"},"popular_answer_id":{"kind":"string","value":"5493"}}},{"rowIdx":1027,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 7,\n \"body\": \"JavaScriptのコードを作成したり編集するためのエディターを探しています。 \\nお勧めのものを教えてください。\\n\\n※日本語対応のものでお願い致します。\\n\\n作業環境:Windows7Pro\\n\\n【質問の背景】 \\n私はWeb系の開発を始めたばかりなのですが、今のところWindows標準のメモ帳でJavaScriptやHTMLのファイルを開いてソースコードの内容を確認しています。 \\nしかしながら、JavaScriptのコードを扱うに当り、HTMLの中に埋め込まれているものを探し出してXXXXXXXX.jsファイルを開いてコードの追加・編集・削除を行うことに手間がかかっています。 \\nそこで、作業の迅速化を図るためにJavaScriptを扱うための比較的良くコードの編集に適したものを、経験者のご意見を参考にして作業を快適に進めていきたいと考えたので、今回の質問に至りました。\",\n \"comment_count\": 4,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T06:07:40.230\",\n \"favorite_count\": 0,\n \"id\": \"5494\",\n \"last_activity_date\": \"2015-02-02T14:30:23.777\",\n \"last_edit_date\": \"2015-02-01T23:09:38.270\",\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"7634\",\n \"post_type\": \"question\",\n \"score\": -3,\n \"tags\": [\n \"javascript\",\n \"windows\"\n ],\n \"title\": \"JavaScriptに最も適したエディターを探しています\",\n \"view_count\": 8919\n}"},"answers":{"kind":"list like","value":[{"body":"[Vim](http://www.kaoriya.net/software/vim/ \"Vim\")がおすすめです。スーパーハカーの気分になれます。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T06:24:08.047","id":"5496","last_activity_date":"2015-01-28T06:24:08.047","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"7894","parent_id":"5494","post_type":"answer","score":-2},{"body":"[Sublime\nText](http://www.sublimetext.com/3)にJavaScript系のプラグインをインストールして使用するという方法もありかなと思います。\n\n","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T06:59:44.670","id":"5502","last_activity_date":"2015-01-28T06:59:44.670","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"3555","parent_id":"5494","post_type":"answer","score":1},{"body":"自分の周辺にいるJavaScriptをメインに書いてるエンジニアはWebStormを使ってる人が多いです。 \nJavaScriptも書くし、他の動的型付け言語も書いてる人の場合はVimとかEmacsを使う人が多い印象です。\n\nAtomというエディタだとプラグインもJavaScriptで書けるので、エディタもJavaScriptにしたいっていう修行を行いたい場合はAtomでも良いと思います。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T07:23:19.077","id":"5504","last_activity_date":"2015-01-28T07:23:19.077","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"2650","parent_id":"5494","post_type":"answer","score":0},{"body":"簡単なものであれば[Notepad++](http://notepad-plus-plus.org/)を使っています。\n\n多くのプログラミング言語に対応しているので、 \n新しい言語に触れてみようとするときに向いています。\n\n軽量でそれほど学習コストもかかりませんが、 \n機能もそれなりです。\n\n本格的な開発をされるなら、 \n他の方が紹介しているエディターに乗り換えるべきだと思います。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T07:42:37.660","id":"5508","last_activity_date":"2015-01-28T07:42:37.660","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"70","parent_id":"5494","post_type":"answer","score":2},{"body":"個人的な好みですが \nSublimeText \nが好きですね。\n\nGrunt等も叩けるので...","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-02T03:38:29.453","id":"5735","last_activity_date":"2015-02-02T03:38:29.453","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"8013","parent_id":"5494","post_type":"answer","score":0},{"body":"\"テキストエディタでjsファイルを編集する\"のであれば \n[サクラエディタ](http://sakura-editor.sourceforge.net/index.html)が良いかと思います。 \n理由としては \n・言語ごとの設定が可能(拡張子関連付け・一時適応など) \n・言語ごとにカラー強調などの設定が可能 \n・拡張で入力保管やキーワードヘルプ機能を使用できる。 \n以上のような機能が便利です。 \n自分はPHPなども触るのですが簡単な編集程度であれば此方を使用しています。\n\n有料・無料の指定が無かったので無料のテキストエディタをあげましたが、 \n有料ですが開発するのであればVisualStudioが便利ですね……。 \nWeb開発でも「visual studio web developer」とかありますし……。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-02T04:07:36.010","id":"5740","last_activity_date":"2015-02-02T04:07:36.010","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"7676","parent_id":"5494","post_type":"answer","score":1},{"body":"もし **エディタの操作に慣れるまで時間をかける余裕がある**\nのでしたら、私もuser2617876さんと同様Vimをおすすめします。Windowsかつ日本語環境とのことなので、[Vim —\nKaoriYa](http://www.kaoriya.net/software/vim/) からダウンロードして使ってみるといいと思います。\n\n質問文に\n\n>\n> JavaScriptのコードを扱うに当り、HTMLの中に埋め込まれているものを探し出してXXXXXXXX.jsファイルを開いてコードの追加・編集・削除を行うことに手間がかかっています\n\nとありますが、Vimの場合、ファイルが相対パスで指定されていれば、ファイル名の上にカーソルを持って行って`gf`とタイプするだけで目的のファイルが開けます。\n\nまた、Web系の開発をされていると、後々Unix系のサーバーにSSH接続してファイルを操作する、という事も必要になるかと思います。Vimはそのようなサーバーでもたいてい利用できますし、場合によってはVimで操作するしかないこともあるかもしれません。なので、とりあえずVimの操作に慣れておくのは損にはならないのではないかな、と思ってお薦めさせていただきました。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-02T14:30:23.777","id":"5796","last_activity_date":"2015-02-02T14:30:23.777","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"3589","parent_id":"5494","post_type":"answer","score":4}],"string":"[\n {\n \"body\": \"[Vim](http://www.kaoriya.net/software/vim/ \\\"Vim\\\")がおすすめです。スーパーハカーの気分になれます。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T06:24:08.047\",\n \"id\": \"5496\",\n \"last_activity_date\": \"2015-01-28T06:24:08.047\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"7894\",\n \"parent_id\": \"5494\",\n \"post_type\": \"answer\",\n \"score\": -2\n },\n {\n \"body\": \"[Sublime\\nText](http://www.sublimetext.com/3)にJavaScript系のプラグインをインストールして使用するという方法もありかなと思います。\\n\\n\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T06:59:44.670\",\n \"id\": \"5502\",\n \"last_activity_date\": \"2015-01-28T06:59:44.670\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"3555\",\n \"parent_id\": \"5494\",\n \"post_type\": \"answer\",\n \"score\": 1\n },\n {\n \"body\": \"自分の周辺にいるJavaScriptをメインに書いてるエンジニアはWebStormを使ってる人が多いです。 \\nJavaScriptも書くし、他の動的型付け言語も書いてる人の場合はVimとかEmacsを使う人が多い印象です。\\n\\nAtomというエディタだとプラグインもJavaScriptで書けるので、エディタもJavaScriptにしたいっていう修行を行いたい場合はAtomでも良いと思います。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T07:23:19.077\",\n \"id\": \"5504\",\n \"last_activity_date\": \"2015-01-28T07:23:19.077\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"2650\",\n \"parent_id\": \"5494\",\n \"post_type\": \"answer\",\n \"score\": 0\n },\n {\n \"body\": \"簡単なものであれば[Notepad++](http://notepad-plus-plus.org/)を使っています。\\n\\n多くのプログラミング言語に対応しているので、 \\n新しい言語に触れてみようとするときに向いています。\\n\\n軽量でそれほど学習コストもかかりませんが、 \\n機能もそれなりです。\\n\\n本格的な開発をされるなら、 \\n他の方が紹介しているエディターに乗り換えるべきだと思います。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T07:42:37.660\",\n \"id\": \"5508\",\n \"last_activity_date\": \"2015-01-28T07:42:37.660\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"70\",\n \"parent_id\": \"5494\",\n \"post_type\": \"answer\",\n \"score\": 2\n },\n {\n \"body\": \"個人的な好みですが \\nSublimeText \\nが好きですね。\\n\\nGrunt等も叩けるので...\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-02T03:38:29.453\",\n \"id\": \"5735\",\n \"last_activity_date\": \"2015-02-02T03:38:29.453\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8013\",\n \"parent_id\": \"5494\",\n \"post_type\": \"answer\",\n \"score\": 0\n },\n {\n \"body\": \"\\\"テキストエディタでjsファイルを編集する\\\"のであれば \\n[サクラエディタ](http://sakura-editor.sourceforge.net/index.html)が良いかと思います。 \\n理由としては \\n・言語ごとの設定が可能(拡張子関連付け・一時適応など) \\n・言語ごとにカラー強調などの設定が可能 \\n・拡張で入力保管やキーワードヘルプ機能を使用できる。 \\n以上のような機能が便利です。 \\n自分はPHPなども触るのですが簡単な編集程度であれば此方を使用しています。\\n\\n有料・無料の指定が無かったので無料のテキストエディタをあげましたが、 \\n有料ですが開発するのであればVisualStudioが便利ですね……。 \\nWeb開発でも「visual studio web developer」とかありますし……。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-02T04:07:36.010\",\n \"id\": \"5740\",\n \"last_activity_date\": \"2015-02-02T04:07:36.010\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"7676\",\n \"parent_id\": \"5494\",\n \"post_type\": \"answer\",\n \"score\": 1\n },\n {\n \"body\": \"もし **エディタの操作に慣れるまで時間をかける余裕がある**\\nのでしたら、私もuser2617876さんと同様Vimをおすすめします。Windowsかつ日本語環境とのことなので、[Vim —\\nKaoriYa](http://www.kaoriya.net/software/vim/) からダウンロードして使ってみるといいと思います。\\n\\n質問文に\\n\\n>\\n> JavaScriptのコードを扱うに当り、HTMLの中に埋め込まれているものを探し出してXXXXXXXX.jsファイルを開いてコードの追加・編集・削除を行うことに手間がかかっています\\n\\nとありますが、Vimの場合、ファイルが相対パスで指定されていれば、ファイル名の上にカーソルを持って行って`gf`とタイプするだけで目的のファイルが開けます。\\n\\nまた、Web系の開発をされていると、後々Unix系のサーバーにSSH接続してファイルを操作する、という事も必要になるかと思います。Vimはそのようなサーバーでもたいてい利用できますし、場合によってはVimで操作するしかないこともあるかもしれません。なので、とりあえずVimの操作に慣れておくのは損にはならないのではないかな、と思ってお薦めさせていただきました。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-02T14:30:23.777\",\n \"id\": \"5796\",\n \"last_activity_date\": \"2015-02-02T14:30:23.777\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"3589\",\n \"parent_id\": \"5494\",\n \"post_type\": \"answer\",\n \"score\": 4\n }\n]"},"id":{"kind":"string","value":"5494"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"5796"}}},{"rowIdx":1028,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 2,\n \"body\": \"`Prolog` にて `ローンパターン(Loan Pattern)` を後述のように実装しましたが、より簡潔に書けないものでしょうか?\\n\\nここでの `ローンパターンは、 リソースの解放を忘れないようにする仕組み` を意図しています。 ( [C#でいう using\\nステートメント](https://msdn.microsoft.com/ja-jp/library/yh598w02.aspx) 、 [Javaでいう\\ntry-with-resources\\nステートメント](http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html)\\nが近いかもしれません。 )\\n\\n* * *\\n\\n特に以下の点について、疑問が残りました。\\n\\n * 毎度 `print_each` のような定義をしない方法はないか\\n * `repeat` の部分を簡潔に書けないか?\\n * (そもそもこれはローンパターンになっているのか?)\\n\\n```\\n\\n main :-\\n writeln('# Open!'),\\n \\n % 'test.txt' を開き、print_each 述語で処理する。\\n open_each('test.txt', print_each),\\n \\n writeln('# Closed!').\\n \\n % ファイルを読み込むごとに呼ばれる述語\\n % 【疑問点】毎度 print_each の定義しなければならないものか?\\n print_each(Term) :-\\n % some process here...\\n % \\n printf('%t', [Term]), nl.\\n \\n open_each(FileName, Do) :-\\n open(FileName, read, Stream),\\n \\n % 【疑問点】とくに以下は簡潔に書けないか?\\n repeat,\\n ( at_end_of_stream(Stream)\\n -> !\\n ; read(Stream, Term),\\n call(Do, Term), \\n fail\\n ),\\n \\n close(Stream).\\n \\n :- main, halt.\\n \\n```\\n\\n以下は test.txt の中身です。\\n\\n```\\n\\n text(foobar).\\n text(fuba).\\n text(abafu).\\n text(syzzy).\\n \\n```\\n\\n実行例は以下のようになります。\\n\\n```\\n\\n # Open!\\n text(foobar).\\n text(fuba).\\n text(abafu).\\n text(syzzy).\\n # Closed!\\n \\n```\\n\\n環境: SWI-Prolog version 5.10.4 for amd64 です。\\n\\n※ より Prolog らしいコードや用語の誤りなどありましたらコメントなどでご指摘お願いします\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T06:35:39.483\",\n \"favorite_count\": 0,\n \"id\": \"5498\",\n \"last_activity_date\": \"2015-02-07T06:04:48.007\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"5021\",\n \"post_type\": \"question\",\n \"score\": 5,\n \"tags\": [\n \"prolog\"\n ],\n \"title\": \"Prolog にて、ローンパターン(Loan Pattern) を簡潔に実装したい\",\n \"view_count\": 276\n}"},"answers":{"kind":"list like","value":[{"body":"`throw` and `catch` はいかがでしょうか。これは、Java などの `try 〜 catch 〜 finally 〜`\nと同じ様なものだと思います。\n\n```\n\n main :-\n writeln('# Open!'),\n open_each('test.txt', read_and_print_term),\n writeln('# Closed!').\n \n read_and_print_term(Stream) :-\n at_end_of_stream(Stream) -> !;\n read(Stream, Term),\n writef('%t', [Term]), nl,\n read_and_print_term(Stream).\n \n %% 追記: 以下は必要ありませんでした \n %%read_and_print_term :- throw(_).\n \n open_each(FileName, Do) :-\n open(FileName, read, Stream),\n catch(call(Do, Stream), _, (write('# Error!'), nl)),\n close(Stream).\n \n :- main, halt.\n \n```\n\n例えば、`text.txt` が以下の様になっている場合、\n\n```\n\n text(foobar).\n text(fuba).\n Hello World!\n text(abafu).\n text(syzzy).\n \n```\n\n実行結果は以下の様になります。\n\n```\n\n # Open!\n text(foobar)\n text(fuba)\n # Error!\n # Closed!\n \n```\n\nただ、質問者様のプログラムではエラーはスキップしてファイルを最後まで読み込む様な仕様に見えるので、これでは期待に添わないかもしれません。ご参考程度にどうぞ。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T12:58:14.473","id":"5521","last_activity_date":"2015-01-28T23:41:40.993","last_edit_date":"2015-01-28T23:41:40.993","last_editor_user_id":null,"owner_user_id":null,"parent_id":"5498","post_type":"answer","score":3},{"body":"クロージャのある言語であれば、Loan\nPatternにおけるリソース利用処理をクロージャ渡しで表現できて非常に簡潔に記述できます。私の知る限り、Prologにはクロージャはありません。ですが`copy_term/2`を利用することで関数型言語におけるλ式のような機能を実装できます。\n\n```\n\n :- op(1050, xfx, '=>').\n '=>'(Head, Body, A) :- copy_term(Head => Body, A => X), call(X).\n '=>'(Head, Body, A, B) :- copy_term(Head => Body, (A, B) => X), call(X).\n '=>'(Head, Body, A, B, C) :- copy_term(Head => Body, (A, B, C) => X), call(X).\n % とりあえず3引数まで対応\n \n```\n\n↑このような定義を予め用意しておきます。すると、以下の様に`call/*`によってλ式を呼び出すことができるようになります。\n\n```\n\n ?- F = ((A, B, Out) => Out is A+B), call(F, 1, 2, X).\n % ==> X = 3.\n \n```\n\n次に、回答となる実際のコードです。 \n(要点を明確にするため`catch`の利用は省略させていただきました。)\n\n```\n\n main :-\n with_io('test.txt', read, (IO) =>\n forall(terms_in_io(IO, Term), writeln(next :- Term))\n ),\n halt.\n \n with_io(Path, Mode, Call) :-\n open(Path, Mode, IO), call(Call, IO), !, close(IO).\n \n terms_in_io(IO, Term) :- repeat\n , (at_end_of_stream(IO), !, fail; read(IO, Term)).\n \n```","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-07T06:04:48.007","id":"6085","last_activity_date":"2015-02-07T06:04:48.007","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"4313","parent_id":"5498","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"`throw` and `catch` はいかがでしょうか。これは、Java などの `try 〜 catch 〜 finally 〜`\\nと同じ様なものだと思います。\\n\\n```\\n\\n main :-\\n writeln('# Open!'),\\n open_each('test.txt', read_and_print_term),\\n writeln('# Closed!').\\n \\n read_and_print_term(Stream) :-\\n at_end_of_stream(Stream) -> !;\\n read(Stream, Term),\\n writef('%t', [Term]), nl,\\n read_and_print_term(Stream).\\n \\n %% 追記: 以下は必要ありませんでした \\n %%read_and_print_term :- throw(_).\\n \\n open_each(FileName, Do) :-\\n open(FileName, read, Stream),\\n catch(call(Do, Stream), _, (write('# Error!'), nl)),\\n close(Stream).\\n \\n :- main, halt.\\n \\n```\\n\\n例えば、`text.txt` が以下の様になっている場合、\\n\\n```\\n\\n text(foobar).\\n text(fuba).\\n Hello World!\\n text(abafu).\\n text(syzzy).\\n \\n```\\n\\n実行結果は以下の様になります。\\n\\n```\\n\\n # Open!\\n text(foobar)\\n text(fuba)\\n # Error!\\n # Closed!\\n \\n```\\n\\nただ、質問者様のプログラムではエラーはスキップしてファイルを最後まで読み込む様な仕様に見えるので、これでは期待に添わないかもしれません。ご参考程度にどうぞ。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T12:58:14.473\",\n \"id\": \"5521\",\n \"last_activity_date\": \"2015-01-28T23:41:40.993\",\n \"last_edit_date\": \"2015-01-28T23:41:40.993\",\n \"last_editor_user_id\": null,\n \"owner_user_id\": null,\n \"parent_id\": \"5498\",\n \"post_type\": \"answer\",\n \"score\": 3\n },\n {\n \"body\": \"クロージャのある言語であれば、Loan\\nPatternにおけるリソース利用処理をクロージャ渡しで表現できて非常に簡潔に記述できます。私の知る限り、Prologにはクロージャはありません。ですが`copy_term/2`を利用することで関数型言語におけるλ式のような機能を実装できます。\\n\\n```\\n\\n :- op(1050, xfx, '=>').\\n '=>'(Head, Body, A) :- copy_term(Head => Body, A => X), call(X).\\n '=>'(Head, Body, A, B) :- copy_term(Head => Body, (A, B) => X), call(X).\\n '=>'(Head, Body, A, B, C) :- copy_term(Head => Body, (A, B, C) => X), call(X).\\n % とりあえず3引数まで対応\\n \\n```\\n\\n↑このような定義を予め用意しておきます。すると、以下の様に`call/*`によってλ式を呼び出すことができるようになります。\\n\\n```\\n\\n ?- F = ((A, B, Out) => Out is A+B), call(F, 1, 2, X).\\n % ==> X = 3.\\n \\n```\\n\\n次に、回答となる実際のコードです。 \\n(要点を明確にするため`catch`の利用は省略させていただきました。)\\n\\n```\\n\\n main :-\\n with_io('test.txt', read, (IO) =>\\n forall(terms_in_io(IO, Term), writeln(next :- Term))\\n ),\\n halt.\\n \\n with_io(Path, Mode, Call) :-\\n open(Path, Mode, IO), call(Call, IO), !, close(IO).\\n \\n terms_in_io(IO, Term) :- repeat\\n , (at_end_of_stream(IO), !, fail; read(IO, Term)).\\n \\n```\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-07T06:04:48.007\",\n \"id\": \"6085\",\n \"last_activity_date\": \"2015-02-07T06:04:48.007\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"4313\",\n \"parent_id\": \"5498\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"5498"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"5521"}}},{"rowIdx":1029,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"5510\",\n \"answer_count\": 2,\n \"body\": \"先日activesupportの`Object#instance_values`メソッドのソースコードを読んでいたら \\nHashについてわからないことがあったので質問させていただきます.\\n\\n```\\n\\n Hash[] #=> {}\\n Hash[[]] #=> {}\\n Hash[[[]]] #=> invalid number of arguments\\n Hash[[[1,2],[3,4]]] #=> {1=>2, 3=>4}\\n \\n```\\n\\n上に挙げたこれらのコードの挙動を教えていただけますでしょうか.\\n\\n下記はactivesupportの`Object#instance_values`のソースコードです.\\n\\n```\\n\\n def instance_values\\n Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] }]\\n end\\n \\n```\\n\\n\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T06:57:09.120\",\n \"favorite_count\": 0,\n \"id\": \"5501\",\n \"last_activity_date\": \"2015-01-29T04:22:14.253\",\n \"last_edit_date\": \"2015-01-29T04:22:14.253\",\n \"last_editor_user_id\": \"85\",\n \"owner_user_id\": \"7797\",\n \"post_type\": \"question\",\n \"score\": 5,\n \"tags\": [\n \"ruby\"\n ],\n \"title\": \"Hash[[[1,2],[3,4]]] のようなHashの挙動はどのように解釈すればいいですか?\",\n \"view_count\": 280\n}"},"answers":{"kind":"list like","value":[{"body":"面白いなと思ったので調べてみました。間違っている可能性がありますので、その際にはコメントでご指摘をおねがいします。\n\n仕様が参考になると思いますので、`Ruby 2.2.0`時点での`Hash`に関するリファレンスを貼っておきます。 \n\n\nこれによるとHash[]とした時、引数によって内部で行われる処理が変わりそうです。\n\n * self[other] -> Hash\n * self[*key_and_value] -> Hash\n\nざっくりとですが [ruby/hash.c at trunk ·\nruby/ruby](https://github.com/ruby/ruby/blob/trunk/hash.c)\nも参考にしました。([rb_hash_s_create](https://github.com/ruby/ruby/blob/trunk/hash.c#L566)関数が該当部分になります。) \n質問にあるそれぞれのケースについて見てみます。\n\n### Hash[] #=> {}\n\n`self[*key_and_value] -> Hash`の引数が0個の場合に相当し、空のHashが返ってきます。\n\n### Hash[[]] #=> {}\n\n`self[*key_and_value] -> Hash`で引数が分解されますが、要素数0のため、1つ前のケースと同じ結果となります。\n\n### Hash[[[]]] #=> invalid number of arguments\n\n`self[*key_and_value] -> Hash`で引数が分解されますが、要素数が1(`[]`)で奇数となるため失敗します。\n\n尚、エラー出力箇所は 606行目あたり(変動可能性あり)の\n\n```\n\n rb_raise(rb_eArgError, \"invalid number of elements (%ld for 1..2)\",\n RARRAY_LEN(v));\n \n```\n\nだと考えます。\n\n### Hash[[[1,2],[3,4]]] #=> {1=>2, 3=>4}\n\n`self[*key_and_value] -> Hash`の説明の通り、KeyとValueの繰り返しとして格納される。\n\n* * *\n\n**追記** \n尚、`Ruby`のバージョンによって挙動が異なる件ですが \n[hash.c: raise on invalid input · 8d6add9 ·\nruby/ruby](https://github.com/ruby/ruby/commit/8d6add973ebcb3b4c1efbfaf07786550a3e219af)あたりが関わっているように見えました。この修正のきっかけとなったバグは1.9.2の頃に報告されていて、2.0.0で修正されたようです。","comment_count":6,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T07:44:29.423","id":"5509","last_activity_date":"2015-01-29T03:01:58.290","last_edit_date":"2015-01-29T03:01:58.290","last_editor_user_id":"3313","owner_user_id":"3313","parent_id":"5501","post_type":"answer","score":5},{"body":"該当する部分は [Hash.[]](http://www.rubydoc.info/stdlib/core/2.1.0/Hash.%5B%5D)\nと思われます。\n\n>\n```\n\n> .[](key, value, ...) ⇒ Object\n> .[]([ [key, value)) ⇒ Object\n> .[](object) ⇒ Object\n> \n```\n\n>\n> Creates a new hash populated with the given objects. Equivalent to the\n> literal { key => value, ... }. In the first form, keys and values occur in\n> pairs, so there must be an even number of arguments. The second and third\n> form take a single argument which is either an array of key-value pairs or\n> an object convertible to a hash.\n```\n\n> Hash[\"a\", 100, \"b\", 200] #=> {\"a\"=>100, \"b\"=>200}\n> Hash[ [ [\"a\", 100], [\"b\", 200] ] ] #=> {\"a\"=>100, \"b\"=>200}\n> Hash[\"a\" => 100, \"b\" => 200] #=> {\"a\"=>100, \"b\"=>200}\n> \n```\n\n要約するとハッシュのコンストラクタには、以下のようにブロックを渡せますが、\n\n```\n\n Hash{key1 => value1, key2 => value}\n \n```\n\n別の呼び出し方として、以下のバリエーションがあると受け取れます。\n\n * `.[](key1, value1, key2, value2, ...)`\n * `.[]([[key1, value1], [key2, value2], [...))`\n * `.[](object)`\n\nそこで、質問に挙げられたコードを見ていきます。\n\n * `Hash[] #=> {}` \nこれは、要素無指定なので、空のハッシュが生成されました。\n\n * `Hash[[]] #=> {}` \nこれは、`.[]([[key1, value1], [key2, value2], [...))` の指定ですが、 「key, value\nペアがありません」でした。よって空のハッシュです。\n\n * `Hash[[[]]] #=> invalid number of arguments` \nこれは、`.[]([[key1, value1], [key2, value2], [...))` の指定ですが、 「key1= **無指定** ,\nvalue1= **無指定** 」 となり、key, value ペアを指定するための[]があるのにもかかわらず、要素の数が 0 でした。 よって\n\"invalid number of arguments\" エラーとなります。\n\n * `Hash[[[1,2],[3,4]]] #=> {1=>2,3=>4}` \nこれは、`.[]([[key1, value1], [key2, value2], [...))` の指定ですが、 `1=>2`, `3=>4`\nが指定され新しいハッシュが生成されました。\n\n※ コメントにありますが、 `Hash[[[]]]` についてはバージョンによって挙動が異なるようです。\n\n**追試:**\n\n上記の説明で、特に、`.[]([[key1, value1], [key2, value2], [...))`\nの動作について、`hash.c`を追いながら追試しました。説明で抜けていたのは、 「`key1` の値だけが与えられると、 `value1=nil`\nとされる」ことです。以下に例を示します。\n\n```\n\n # tested on ruby 2.0.0p598\n \n Hash[[]]\n # => {}\n \n Hash[[], 1]\n # => {[]=>1}\n \n Hash[[[]]]\n => invalid number of elements (0 for 1..2)\n \n Hash[[[[]]]]\n # => {[]=>nil}\n \n Hash[[[[]]], 1]\n # => {[[[]]]=>1}\n \n Hash[[[[[]]]]]\n # => {[[]]=>nil}\n \n Hash[[[[[]], 1]]]\n # => {[[]]=>1}\n \n```","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T07:46:42.027","id":"5510","last_activity_date":"2015-01-28T09:17:07.940","last_edit_date":"2015-01-28T09:17:07.940","last_editor_user_id":"4978","owner_user_id":"4978","parent_id":"5501","post_type":"answer","score":5}],"string":"[\n {\n \"body\": \"面白いなと思ったので調べてみました。間違っている可能性がありますので、その際にはコメントでご指摘をおねがいします。\\n\\n仕様が参考になると思いますので、`Ruby 2.2.0`時点での`Hash`に関するリファレンスを貼っておきます。 \\n\\n\\nこれによるとHash[]とした時、引数によって内部で行われる処理が変わりそうです。\\n\\n * self[other] -> Hash\\n * self[*key_and_value] -> Hash\\n\\nざっくりとですが [ruby/hash.c at trunk ·\\nruby/ruby](https://github.com/ruby/ruby/blob/trunk/hash.c)\\nも参考にしました。([rb_hash_s_create](https://github.com/ruby/ruby/blob/trunk/hash.c#L566)関数が該当部分になります。) \\n質問にあるそれぞれのケースについて見てみます。\\n\\n### Hash[] #=> {}\\n\\n`self[*key_and_value] -> Hash`の引数が0個の場合に相当し、空のHashが返ってきます。\\n\\n### Hash[[]] #=> {}\\n\\n`self[*key_and_value] -> Hash`で引数が分解されますが、要素数0のため、1つ前のケースと同じ結果となります。\\n\\n### Hash[[[]]] #=> invalid number of arguments\\n\\n`self[*key_and_value] -> Hash`で引数が分解されますが、要素数が1(`[]`)で奇数となるため失敗します。\\n\\n尚、エラー出力箇所は 606行目あたり(変動可能性あり)の\\n\\n```\\n\\n rb_raise(rb_eArgError, \\\"invalid number of elements (%ld for 1..2)\\\",\\n RARRAY_LEN(v));\\n \\n```\\n\\nだと考えます。\\n\\n### Hash[[[1,2],[3,4]]] #=> {1=>2, 3=>4}\\n\\n`self[*key_and_value] -> Hash`の説明の通り、KeyとValueの繰り返しとして格納される。\\n\\n* * *\\n\\n**追記** \\n尚、`Ruby`のバージョンによって挙動が異なる件ですが \\n[hash.c: raise on invalid input · 8d6add9 ·\\nruby/ruby](https://github.com/ruby/ruby/commit/8d6add973ebcb3b4c1efbfaf07786550a3e219af)あたりが関わっているように見えました。この修正のきっかけとなったバグは1.9.2の頃に報告されていて、2.0.0で修正されたようです。\",\n \"comment_count\": 6,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T07:44:29.423\",\n \"id\": \"5509\",\n \"last_activity_date\": \"2015-01-29T03:01:58.290\",\n \"last_edit_date\": \"2015-01-29T03:01:58.290\",\n \"last_editor_user_id\": \"3313\",\n \"owner_user_id\": \"3313\",\n \"parent_id\": \"5501\",\n \"post_type\": \"answer\",\n \"score\": 5\n },\n {\n \"body\": \"該当する部分は [Hash.[]](http://www.rubydoc.info/stdlib/core/2.1.0/Hash.%5B%5D)\\nと思われます。\\n\\n>\\n```\\n\\n> .[](key, value, ...) ⇒ Object\\n> .[]([ [key, value)) ⇒ Object\\n> .[](object) ⇒ Object\\n> \\n```\\n\\n>\\n> Creates a new hash populated with the given objects. Equivalent to the\\n> literal { key => value, ... }. In the first form, keys and values occur in\\n> pairs, so there must be an even number of arguments. The second and third\\n> form take a single argument which is either an array of key-value pairs or\\n> an object convertible to a hash.\\n```\\n\\n> Hash[\\\"a\\\", 100, \\\"b\\\", 200] #=> {\\\"a\\\"=>100, \\\"b\\\"=>200}\\n> Hash[ [ [\\\"a\\\", 100], [\\\"b\\\", 200] ] ] #=> {\\\"a\\\"=>100, \\\"b\\\"=>200}\\n> Hash[\\\"a\\\" => 100, \\\"b\\\" => 200] #=> {\\\"a\\\"=>100, \\\"b\\\"=>200}\\n> \\n```\\n\\n要約するとハッシュのコンストラクタには、以下のようにブロックを渡せますが、\\n\\n```\\n\\n Hash{key1 => value1, key2 => value}\\n \\n```\\n\\n別の呼び出し方として、以下のバリエーションがあると受け取れます。\\n\\n * `.[](key1, value1, key2, value2, ...)`\\n * `.[]([[key1, value1], [key2, value2], [...))`\\n * `.[](object)`\\n\\nそこで、質問に挙げられたコードを見ていきます。\\n\\n * `Hash[] #=> {}` \\nこれは、要素無指定なので、空のハッシュが生成されました。\\n\\n * `Hash[[]] #=> {}` \\nこれは、`.[]([[key1, value1], [key2, value2], [...))` の指定ですが、 「key, value\\nペアがありません」でした。よって空のハッシュです。\\n\\n * `Hash[[[]]] #=> invalid number of arguments` \\nこれは、`.[]([[key1, value1], [key2, value2], [...))` の指定ですが、 「key1= **無指定** ,\\nvalue1= **無指定** 」 となり、key, value ペアを指定するための[]があるのにもかかわらず、要素の数が 0 でした。 よって\\n\\\"invalid number of arguments\\\" エラーとなります。\\n\\n * `Hash[[[1,2],[3,4]]] #=> {1=>2,3=>4}` \\nこれは、`.[]([[key1, value1], [key2, value2], [...))` の指定ですが、 `1=>2`, `3=>4`\\nが指定され新しいハッシュが生成されました。\\n\\n※ コメントにありますが、 `Hash[[[]]]` についてはバージョンによって挙動が異なるようです。\\n\\n**追試:**\\n\\n上記の説明で、特に、`.[]([[key1, value1], [key2, value2], [...))`\\nの動作について、`hash.c`を追いながら追試しました。説明で抜けていたのは、 「`key1` の値だけが与えられると、 `value1=nil`\\nとされる」ことです。以下に例を示します。\\n\\n```\\n\\n # tested on ruby 2.0.0p598\\n \\n Hash[[]]\\n # => {}\\n \\n Hash[[], 1]\\n # => {[]=>1}\\n \\n Hash[[[]]]\\n => invalid number of elements (0 for 1..2)\\n \\n Hash[[[[]]]]\\n # => {[]=>nil}\\n \\n Hash[[[[]]], 1]\\n # => {[[[]]]=>1}\\n \\n Hash[[[[[]]]]]\\n # => {[[]]=>nil}\\n \\n Hash[[[[[]], 1]]]\\n # => {[[]]=>1}\\n \\n```\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T07:46:42.027\",\n \"id\": \"5510\",\n \"last_activity_date\": \"2015-01-28T09:17:07.940\",\n \"last_edit_date\": \"2015-01-28T09:17:07.940\",\n \"last_editor_user_id\": \"4978\",\n \"owner_user_id\": \"4978\",\n \"parent_id\": \"5501\",\n \"post_type\": \"answer\",\n \"score\": 5\n }\n]"},"id":{"kind":"string","value":"5501"},"accepted_answer_id":{"kind":"string","value":"5510"},"popular_answer_id":{"kind":"string","value":"5509"}}},{"rowIdx":1030,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"5512\",\n \"answer_count\": 1,\n \"body\": \"CentOS 6.4 にて rbenv 0.4.0-74-g95a039a を使っています。\\n\\nruby コマンドのオプション、`\\\\--debug` を使うと Exceptionメッセージが表示されるので、回避方法があればご教示願います。\\n\\n```\\n\\n $ ruby -d -e 'p $DEBUG'\\n Exception `LoadError' at /home/foo/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems.rb:1194 - cannot load such file -- rubygems/defaults/operating_system\\n Exception `LoadError' at /home/foo/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems.rb:1203 - cannot load such file -- rubygems/defaults/ruby\\n true\\n \\n```\\n\\n尚、1.9.3 の環境も同様で、1.8 だと期待する結果になりました。\\n\\n```\\n\\n $ rbenv local 1.8.7\\n $ ruby -d -e 'p $DEBUG'\\n true\\n \\n```\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T07:19:57.333\",\n \"favorite_count\": 0,\n \"id\": \"5503\",\n \"last_activity_date\": \"2015-01-28T08:35:05.183\",\n \"last_edit_date\": \"2015-01-28T08:30:15.437\",\n \"last_editor_user_id\": \"3313\",\n \"owner_user_id\": \"7208\",\n \"post_type\": \"question\",\n \"score\": 1,\n \"tags\": [\n \"ruby\",\n \"command-line\",\n \"rbenv\"\n ],\n \"title\": \"ruby のオプション --debug を使うと Exception が発生する\",\n \"view_count\": 916\n}"},"answers":{"kind":"list like","value":[{"body":"ドキュメント [variable $-d](http://docs.ruby-\nlang.org/ja/2.2.0/method/Kernel/v/DEBUG.html)\n\n> 例外を捕捉しているかどうかに関係なく、 例外が発生した時点で $stderr にそれが出力されます。 スクリプトの処理は続行されます。\n\n`rubygems.rb`を見ると表示されている2件のLoadErrorは捕捉して無視されているのですが`-d`のせいで表示されてしまっています。\n\n表示されているだけで害はないので現状は無視するしかないのではないでしょうか。\n\n# 該当のrequire 2件を消すとか、呼ばれているファイルを空で作ってしまうか、とも考えましたが副作用があるかもしれないので具体的な方法は書きません。","comment_count":2,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T08:35:05.183","id":"5512","last_activity_date":"2015-01-28T08:35:05.183","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"5793","parent_id":"5503","post_type":"answer","score":4}],"string":"[\n {\n \"body\": \"ドキュメント [variable $-d](http://docs.ruby-\\nlang.org/ja/2.2.0/method/Kernel/v/DEBUG.html)\\n\\n> 例外を捕捉しているかどうかに関係なく、 例外が発生した時点で $stderr にそれが出力されます。 スクリプトの処理は続行されます。\\n\\n`rubygems.rb`を見ると表示されている2件のLoadErrorは捕捉して無視されているのですが`-d`のせいで表示されてしまっています。\\n\\n表示されているだけで害はないので現状は無視するしかないのではないでしょうか。\\n\\n# 該当のrequire 2件を消すとか、呼ばれているファイルを空で作ってしまうか、とも考えましたが副作用があるかもしれないので具体的な方法は書きません。\",\n \"comment_count\": 2,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T08:35:05.183\",\n \"id\": \"5512\",\n \"last_activity_date\": \"2015-01-28T08:35:05.183\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"5793\",\n \"parent_id\": \"5503\",\n \"post_type\": \"answer\",\n \"score\": 4\n }\n]"},"id":{"kind":"string","value":"5503"},"accepted_answer_id":{"kind":"string","value":"5512"},"popular_answer_id":{"kind":"string","value":"5512"}}},{"rowIdx":1031,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"5518\",\n \"answer_count\": 1,\n \"body\": \"knockout.jsで以下の様なコードのchild配下の変更を検知できずに困っています。\\n\\nどのようにすれば実装できるかご教示願います。\\n\\n```\\n\\n var SomeVMM = function(){\\n var self = this;\\n self.some = ko.observable();\\n \\n self.fire = function(dict){\\n self.some([{\\\"title\\\": hoge, \\\"child\\\":dict}]);\\n }\\n }\\n \\n```\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T07:33:35.097\",\n \"favorite_count\": 0,\n \"id\": \"5506\",\n \"last_activity_date\": \"2015-01-28T11:51:03.763\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"4041\",\n \"post_type\": \"question\",\n \"score\": 1,\n \"tags\": [\n \"javascript\",\n \"knockout.js\"\n ],\n \"title\": \"Knockout.jsでko.observable配下の辞書の変更を検知する方法\",\n \"view_count\": 132\n}"},"answers":{"kind":"list like","value":[{"body":"前提として変更を受け取るためには`{\"title\": hoge,\n\"child\":dict}`ではなく、`child:ko.observable()`などと設定してやる必要があります。\n\nまたタイトルに辞書とありますが、これはkey-value型のコレクションという意味でしょうか? \nknockout.jsではそのようなコレクションはサポートされていなかったと記憶していますので、\n\n```\n\n this.child = ko.observableArray();\n this.child.push({key:'aaa', value:'bbb'});\n \n```\n\nのように配列で表現することになるかと思います。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T11:51:03.763","id":"5518","last_activity_date":"2015-01-28T11:51:03.763","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"5750","parent_id":"5506","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"前提として変更を受け取るためには`{\\\"title\\\": hoge,\\n\\\"child\\\":dict}`ではなく、`child:ko.observable()`などと設定してやる必要があります。\\n\\nまたタイトルに辞書とありますが、これはkey-value型のコレクションという意味でしょうか? \\nknockout.jsではそのようなコレクションはサポートされていなかったと記憶していますので、\\n\\n```\\n\\n this.child = ko.observableArray();\\n this.child.push({key:'aaa', value:'bbb'});\\n \\n```\\n\\nのように配列で表現することになるかと思います。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T11:51:03.763\",\n \"id\": \"5518\",\n \"last_activity_date\": \"2015-01-28T11:51:03.763\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"5750\",\n \"parent_id\": \"5506\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"5506"},"accepted_answer_id":{"kind":"string","value":"5518"},"popular_answer_id":{"kind":"string","value":"5518"}}},{"rowIdx":1032,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 1,\n \"body\": \"Windows にて RGui からあるパッケージをインストールし, `library(パッケージ名)` とすると読み込まれるのですが,同じパッケージを\\nRscript から読み込もうとすると存在しないと言われます. Rscript でも追加パッケージを認識させるにはどうすれば良いですか?\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T07:56:22.060\",\n \"favorite_count\": 0,\n \"id\": \"5511\",\n \"last_activity_date\": \"2015-01-28T15:14:30.863\",\n \"last_edit_date\": \"2015-01-28T08:17:36.257\",\n \"last_editor_user_id\": \"4978\",\n \"owner_user_id\": \"7899\",\n \"post_type\": \"question\",\n \"score\": 2,\n \"tags\": [\n \"r\",\n \"rscript\"\n ],\n \"title\": \"Rscript からのパッケージ読み込み\",\n \"view_count\": 358\n}"},"answers":{"kind":"list like","value":[{"body":"Rscriptのマニュアルに説明がございました。 \n\n\n一部抜粋致します。\n\n> Additional options accepted (before file or args) are\n>\n> --default-packages=list \n> where list is a comma-separated list of package names or NULL. Sets the\n> environment variable R_DEFAULT_PACKAGES which determines the packages loaded\n> on startup. The default for Rscript omits methods as it takes about 60% of\n> the startup time.\n\n要約すれば、\n\n * 読み込みたいRファイルや引数の前にオプションをつけること\n * 起動時に環境変数R_DEFAULT_PACKAGESに設定してロードする。。らしい。\n * Rscriptで起動した場合、デフォルトの(Rguiで起動するような場合と比較して?注)メソッドの60%が省略される。。らしい。\n\n`Rscript --default-packages=util hoge.r`\n\nみたいな実行方法で良いはず。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-01-28T10:43:08.740","id":"5515","last_activity_date":"2015-01-28T15:14:30.863","last_edit_date":"2015-01-28T15:14:30.863","last_editor_user_id":null,"owner_user_id":"2904","parent_id":"5511","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"Rscriptのマニュアルに説明がございました。 \\n\\n\\n一部抜粋致します。\\n\\n> Additional options accepted (before file or args) are\\n>\\n> --default-packages=list \\n> where list is a comma-separated list of package names or NULL. Sets the\\n> environment variable R_DEFAULT_PACKAGES which determines the packages loaded\\n> on startup. The default for Rscript omits methods as it takes about 60% of\\n> the startup time.\\n\\n要約すれば、\\n\\n * 読み込みたいRファイルや引数の前にオプションをつけること\\n * 起動時に環境変数R_DEFAULT_PACKAGESに設定してロードする。。らしい。\\n * Rscriptで起動した場合、デフォルトの(Rguiで起動するような場合と比較して?注)メソッドの60%が省略される。。らしい。\\n\\n`Rscript --default-packages=util hoge.r`\\n\\nみたいな実行方法で良いはず。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T10:43:08.740\",\n \"id\": \"5515\",\n \"last_activity_date\": \"2015-01-28T15:14:30.863\",\n \"last_edit_date\": \"2015-01-28T15:14:30.863\",\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"2904\",\n \"parent_id\": \"5511\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"5511"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"5515"}}},{"rowIdx":1033,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"5599\",\n \"answer_count\": 1,\n \"body\": \"下記の様に、canvasにexplodeのアニメーションをかけたところ、動作しません。\\n\\n```\\n\\n $(\\\"#my_canvas\\\").effect(\\\"explode\\\", {} ,200);\\n \\n```\\n\\nこちらはOK\\n\\n```\\n\\n $(\\\"#my_canvas\\\").effect(\\\"bounce\\\", {} ,200);\\n \\n```\\n\\ncanvasにかけられるアニメーションとかけられないアニメーションがあるのでしょうか?\\n\\n追記: \\n私の環境では下記のコードを実行すると、アニメーションせずにただ画像が消えます。 \\n実行環境はmacのchromeです。\\n\\n読み込み\\n\\n```\\n\\n $canvas = $(\\\"\\\").appendTo(\\\"body\\\").width(500).height(500);\\n var ctx = $canvas[0].getContext('2d');\\n var img = new Image;\\n img.onload = function(){\\n ctx.drawImage(img,0,0); // Or at whatever offset you like\\n };\\n img.src = \\\"https://www.google.co.jp/images/srpr/logo11w.png\\\"\\n \\n```\\n\\nイメージロード後にアニメーション実行\\n\\n```\\n\\n $canvas.effect(\\\"explode\\\",{},500);\\n \\n```\",\n \"comment_count\": 3,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-01-28T09:54:13.013\",\n \"favorite_count\": 0,\n \"id\": \"5514\",\n \"last_activity_date\": \"2015-01-30T03:57:57.620\",\n \"last_edit_date\": \"2015-01-30T02:03:58.343\",\n \"last_editor_user_id\": \"525\",\n \"owner_user_id\": \"525\",\n \"post_type\": \"question\",\n \"score\": 2,\n \"tags\": [\n \"jquery\",\n \"html5\",\n \"jquery-ui\"\n ],\n \"title\": \"canvasに対するeffect:explodeが反映されない\",\n \"view_count\": 369\n}"},"answers":{"kind":"list like","value":[{"body":"`