{ // 获取包含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```\n\nあと、productionで使うなら `config.assets.precompile` でファイルを指定しておく必要があるかもしれません。\n\n```\n\n # config/environments/production.rb\n config.assets.precompile += %w(ajaxzip3-https.js)\n \n```\n\n参考になれば幸いです。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T08:39:18.530","id":"7140","last_activity_date":"2015-02-26T11:24:31.757","last_edit_date":"2015-02-26T11:24:31.757","last_editor_user_id":"85","owner_user_id":"85","parent_id":"7127","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"`app/views` 内のHTMLで以下のように書くのはどうでしょう。\\n\\n```\\n\\n <% if Rails.env.production? %>\\n \\n <% else %>\\n \\n <% end %>\\n \\n```\\n\\nSlim の場合はこんな感じでしょうか。\\n\\n```\\n\\n - if Rails.env.production?\\n script src=\\\"https://ajaxzip3.googlecode.com/svn/trunk/ajaxzip3/ajaxzip3-https.js\\\"\\n - else\\n script src=\\\"http://ajaxzip3.googlecode.com/svn/trunk/ajaxzip3/ajaxzip3.js\\\"\\n \\n```\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T07:21:39.390\",\n \"id\": \"7129\",\n \"last_activity_date\": \"2015-02-26T08:46:05.180\",\n \"last_edit_date\": \"2015-02-26T08:46:05.180\",\n \"last_editor_user_id\": \"85\",\n \"owner_user_id\": \"208\",\n \"parent_id\": \"7127\",\n \"post_type\": \"answer\",\n \"score\": 1\n },\n {\n \"body\": \"`request.protocol`とHelperメソッドを組み合わせるとスッキリ書けそうです。\\n\\n```\\n\\n # app/helpers/application_helper.rb\\n module ApplicationHelper\\n def ajaxzip3_include_tag\\n file_name = ssl? ? 'ajaxzip3-https.js' : 'ajaxzip3.js'\\n javascript_include_tag(file_name)\\n end\\n \\n def ssl?\\n request.protocol == 'https://'\\n end\\n end\\n \\n```\\n\\n```\\n\\n <% # app/views/layouts/application.html.erb %>\\n \\n \\n \\n Your app name\\n <%= stylesheet_link_tag 'application', media: 'all' %>\\n <%= javascript_include_tag 'application' %>\\n <%= ajaxzip3_include_tag %>\\n <%= csrf_meta_tags %>\\n \\n \\n \\n <%= yield %>\\n \\n \\n \\n \\n```\\n\\nあと、productionで使うなら `config.assets.precompile` でファイルを指定しておく必要があるかもしれません。\\n\\n```\\n\\n # config/environments/production.rb\\n config.assets.precompile += %w(ajaxzip3-https.js)\\n \\n```\\n\\n参考になれば幸いです。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T08:39:18.530\",\n \"id\": \"7140\",\n \"last_activity_date\": \"2015-02-26T11:24:31.757\",\n \"last_edit_date\": \"2015-02-26T11:24:31.757\",\n \"last_editor_user_id\": \"85\",\n \"owner_user_id\": \"85\",\n \"parent_id\": \"7127\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"7127"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"7140"}}},{"rowIdx":1602,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 1,\n \"body\": \"Full GC多発の現象調査をしているのですが \\nGCログにFull GCとFull GC(System)が存在しております。\\n\\n前任者はFull GC(System)を外して集計しているのですが・・・ \\n違いも判らず外すのも気持ち悪くて質問させていただきました。\\n\\nネットの海におちていなかったor2\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T07:27:22.157\",\n \"favorite_count\": 0,\n \"id\": \"7131\",\n \"last_activity_date\": \"2015-02-26T08:00:57.610\",\n \"last_edit_date\": \"2015-02-26T07:56:14.967\",\n \"last_editor_user_id\": \"208\",\n \"owner_user_id\": \"858\",\n \"post_type\": \"question\",\n \"score\": 1,\n \"tags\": [\n \"java\",\n \"gc\"\n ],\n \"title\": \"GCログに記載されている「Full GC」 と「Full GC(System)」の違い\",\n \"view_count\": 2278\n}"},"answers":{"kind":"list like","value":[{"body":"[Does java garbage collection log entry “Full GC (System)” mean some class\ncalled System.gc()?](https://stackoverflow.com/questions/6626680/)\n\nに、まさにドンピシャな質問と回答があります。詳細はこの記事に譲るとして\n\n```\n\n System.gc();\n \n```\n\nを呼んだ時に記録されるもの、ということらしいです。申し訳ないですが、私自身が確かめたわけではありません。\n\nなお Google で `\"Full GC (System)\"` と言った感じでダブルクォーテーション付きで検索することで、この記事に行き当たりました。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T07:55:28.193","id":"7137","last_activity_date":"2015-02-26T08:00:57.610","last_edit_date":"2017-05-23T12:38:56.083","last_editor_user_id":"-1","owner_user_id":"208","parent_id":"7131","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"[Does java garbage collection log entry “Full GC (System)” mean some class\\ncalled System.gc()?](https://stackoverflow.com/questions/6626680/)\\n\\nに、まさにドンピシャな質問と回答があります。詳細はこの記事に譲るとして\\n\\n```\\n\\n System.gc();\\n \\n```\\n\\nを呼んだ時に記録されるもの、ということらしいです。申し訳ないですが、私自身が確かめたわけではありません。\\n\\nなお Google で `\\\"Full GC (System)\\\"` と言った感じでダブルクォーテーション付きで検索することで、この記事に行き当たりました。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T07:55:28.193\",\n \"id\": \"7137\",\n \"last_activity_date\": \"2015-02-26T08:00:57.610\",\n \"last_edit_date\": \"2017-05-23T12:38:56.083\",\n \"last_editor_user_id\": \"-1\",\n \"owner_user_id\": \"208\",\n \"parent_id\": \"7131\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7131"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"7137"}}},{"rowIdx":1603,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7135\",\n \"answer_count\": 1,\n \"body\": \"macでAndroid Studioを起動した時に、選択しているクラスのメンバとメソッド一覧を表示する方法またはショートカットキーはありますか? \\n`Android Stuido` -> `Preference` -> `Keymap` \\nは参照しましたが、該当するキーを見つけられませんでした。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T07:32:34.840\",\n \"favorite_count\": 0,\n \"id\": \"7132\",\n \"last_activity_date\": \"2015-02-26T13:13:02.860\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"356\",\n \"post_type\": \"question\",\n \"score\": 3,\n \"tags\": [\n \"android-studio\"\n ],\n \"title\": \"Android Studioでクラスのメンバとメソッド一覧を表示する方法\",\n \"view_count\": 18856\n}"},"answers":{"kind":"list like","value":[{"body":"※追記:キーを勘違いしていたので修正しました。 \n`⌘ (Command) + F12` でメンバ変数とメンバメソッドの一覧をポップアップさせることができます。 \n`⌘ (Command) + Shift + H` でメソッドヒエラルキーの表示を行います。\n\nこれでいかがでしょうか?\n\n* * *\n\n※追記\n\n参考:\n\n上記は IntelliJ IDEA のショートカットキー一覧です。 \nAndroid Studio は IntelliJ IDEA をベースに Android 開発環境として特化した IDE なので、大方の keymap\nが一致します。 \n今後の参考になれば幸いです。","comment_count":2,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T07:50:03.450","id":"7135","last_activity_date":"2015-02-26T13:13:02.860","last_edit_date":"2015-02-26T13:13:02.860","last_editor_user_id":"7926","owner_user_id":"7926","parent_id":"7132","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"※追記:キーを勘違いしていたので修正しました。 \\n`⌘ (Command) + F12` でメンバ変数とメンバメソッドの一覧をポップアップさせることができます。 \\n`⌘ (Command) + Shift + H` でメソッドヒエラルキーの表示を行います。\\n\\nこれでいかがでしょうか?\\n\\n* * *\\n\\n※追記\\n\\n参考:\\n\\n上記は IntelliJ IDEA のショートカットキー一覧です。 \\nAndroid Studio は IntelliJ IDEA をベースに Android 開発環境として特化した IDE なので、大方の keymap\\nが一致します。 \\n今後の参考になれば幸いです。\",\n \"comment_count\": 2,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T07:50:03.450\",\n \"id\": \"7135\",\n \"last_activity_date\": \"2015-02-26T13:13:02.860\",\n \"last_edit_date\": \"2015-02-26T13:13:02.860\",\n \"last_editor_user_id\": \"7926\",\n \"owner_user_id\": \"7926\",\n \"parent_id\": \"7132\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"7132"},"accepted_answer_id":{"kind":"string","value":"7135"},"popular_answer_id":{"kind":"string","value":"7135"}}},{"rowIdx":1604,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7183\",\n \"answer_count\": 2,\n \"body\": \"アプリケーションでログイン機構を作るために、パスワードハッシュをDBに保存します。\\n\\nハッシュを生成する際、 salt を組み合わせたり、ストレッチングをするといいと聞きましたが、自分で実装するのは不安なので、\\n`password_hash()` を使おうかと考えています。\\n\\n * [PHP: パスワードのハッシュ - Manual](http://php.net/manual/ja/faq.passwords.php)\\n * [いまさら聞けないパスワードの取り扱い方](http://www.slideshare.net/ockeghem/ss-25447896/25)\\n\\nところが、[この関数のマニュアル](http://php.net/manual/ja/function.password-\\nhash.php)にはこう書かれていました。\\n\\n> PASSWORD_BCRYPT を algo に指定すると、 password が最大 72 文字までに切り詰められます。\\n\\n調べてみると、この制約を回避するためにパスワードをあらかじめ別のハッシュ関数にかけておくとよい、という話が見つかりました。\\n\\n[password_hash()の重要な制限 | yohgaki's blog](http://blog.ohgaki.net/password_hash-\\nimportant-limitation)\\n\\n追記:このあたりを書き直しました\\n\\nただこの記事を見たとき、この記事は `password_hash` に限定しているからこういう方法をとっているのではないかと思いました。\\n\\n72文字を超えるパスワードを許容し、尚かつほかの実装方法もいとわないのであれば、これは使わない方がいいのでしょうか。あるいはそういった前処理を加えたとしても、依然\\n`password_hash` が推奨されるのでしょうか。\\n\\n// Openwall の PHPass がいいという話も見かけましたが、これも内部的に `$2a$` で `crypt()`\\n関数を使っているようなので、同じ問題があると思っています。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T07:42:12.467\",\n \"favorite_count\": 0,\n \"id\": \"7133\",\n \"last_activity_date\": \"2019-02-27T02:26:34.160\",\n \"last_edit_date\": \"2015-02-27T04:00:20.193\",\n \"last_editor_user_id\": \"8000\",\n \"owner_user_id\": \"8000\",\n \"post_type\": \"question\",\n \"score\": 10,\n \"tags\": [\n \"php\"\n ],\n \"title\": \"72文字を超えるパスワードを許容したい場合、password_hashを使うべきではない?\",\n \"view_count\": 2236\n}"},"answers":{"kind":"list like","value":[{"body":"「何を使うべきか」という質問であれば要件次第と言う答えにしかならないと思います\n\n * 73文字目以降が無視されるのは不可、複数のハッシュ関数を使うのは気持ち悪い→`crypt()`を使ってBROWFISH以外で自前実装。もしくはもっと低レイヤのハッシュ関数で自前実装\n * (この項について追記を読んでください)73文字目以降が無視されるのは不可だが複数のハッシュ関数という点は気にしない→ハッシュ関数を通してから`password_hash()`\n * 73文字目以降が無視されてもかまわない→そのまま`password_hash()`\n\nほとんどのアプリケーションでは72文字もあればパスワード強度としては十分でしょうから73文字以降が無視されたとしても現実的には問題ないと思います。\n\n* * *\n\n更新された質問に合わせて追記。\n\n`password_hash()`が依然としてベストプラクティスなのか、もしくはよりよい代替手段があるのか、ということですね。\n\n`password_hash()`を直接置き換える代替手段は提供されていない一方、`password_hash()`の文字数問題は前記の通り現実のアプリケーションに深刻な影響を与えるものとは言えず`password_hash()`を忌避する積極的な理由はないないので、結局は上に書いたとおりになると思います。\n\nいかなる場合もベストプラクティス、から、条件付きではあるがベストプラクティス、にニュアンスは変わっていますが、現実には深刻に捉えなければならない条件とは言えないので依然としてベストプラクティスには違いない、と言うことでいいのではないでしょうか。\n\n* * *\n\n余談。ASCIIの印字可能文字95種を72文字使うと約2.5e+142でbit数でいうと473bitになるので、SHA384とSHA512の間ぐらいになります。逆に、512bitを文字数に直すと78文字です。\n\n* * *\n\n(追記)PHPのbcrypt実装はバイナリセーフではないため、生のハッシュ値をpassword_hashに渡すと意図しない切り詰めが生じる場合があります。\n\n\n\nハッシュ値をpassword_hashに渡すのは避けてください。","comment_count":1,"content_license":"CC BY-SA 4.0","creation_date":"2015-02-27T03:20:46.550","id":"7183","last_activity_date":"2019-02-27T02:26:34.160","last_edit_date":"2019-02-27T02:26:34.160","last_editor_user_id":"5793","owner_user_id":"5793","parent_id":"7133","post_type":"answer","score":9},{"body":"質問文にあるマニュアルのリンクに [ユーザーランドでの実装](https://github.com/ircmaxell/password_compat)\nがあったので、その近所を眺めていると、fork\n元がちょっと古いですが、[ここら](https://github.com/fredericve/password_compat) に crypt の\nSHA512 で真面目に実装してそうなものがあったりしました。\n\n最新のものにマージしても動きそうなので、独自実装をメンテする覚悟があるなら工夫してみるのも一つの手かもしれません。\n\n * 捨てコード\n``` 8192));\n echo $out.\"\\n\";\n echo (password_verify($pass . \"test\", $out) ? \"true\" : \"false\") .\"\\n\";\n \n```\n\n * 実行\n``` $ php test.php\n\n $2y$10$xvbzRgk6P43krmuuV2bHE.4SYMHkiznz1eM628S1dknRRzQqIAVRm\n true\n $6$rounds=8192$32eHmy/jGehb/LS4$ICeAgh81FHnDEPSaUr8f4O9tk4l6EyDg0uif1r2XCSwcbpvLYYNltXB6QcyY6NARBLb6NzxBPKfbzw2DRyxrL/\n false\n $\n \n```\n\n以下は `git clone https://github.com/ircmaxell/password_compat` して\n[ここ](https://github.com/fredericve/password_compat/commit/9504ebcd1f0350b7e4f2c12bbe43f716bfaac8d9)\nとか\n[ここ](https://github.com/fredericve/password_compat/commit/11f8d5de164d96fe121a21ecc46f5ee6add2d910)\nを参考にしてお手当したものの `git diff`\n\n```\n\n diff --git a/lib/password.php b/lib/password.php\n index 805caa5..d2588a1 100644\n --- a/lib/password.php\n +++ b/lib/password.php\n @@ -17,6 +17,7 @@ namespace {\n * code.\n */\n define('PASSWORD_BCRYPT', 1);\n + define('PASSWORD_SHA512', 2);\n define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);\n define('PASSWORD_BCRYPT_DEFAULT_COST', 10);\n }\n @@ -67,6 +68,24 @@ namespace {\n // The expected length of the final crypt() output\n $resultLength = 60;\n break;\n + case PASSWORD_SHA512:\n + // Note that this is a C constant, but not exposed to PHP, so we don't define it here.\n + $rounds = 5000;\n + if (isset($options['rounds'])) {\n + $rounds = $options['rounds'];\n + if ($rounds < 1000 || $rounds > 999999999) {\n + trigger_error(sprintf(\"password_hash(): Invalid sha512 rounds parameter specified: %d\", $rounds), E_USER_WARNING);\n + return null;\n + }\n + }\n + // The length of salt to generate\n + $raw_salt_len = 16;\n + // The length required in the final serialization\n + $required_salt_len = 22;\n + $hash_format = sprintf('$6$rounds=%d$', $rounds);\n + // The expected length of the final crypt() output\n + $resultLength = strlen($hash_format) + $raw_salt_len + 87;\n + break;\n default:\n trigger_error(sprintf(\"password_hash(): Unknown password hashing algorithm: %s\", $algo), E_USER_WARNING);\n return null;\n @@ -188,6 +207,11 @@ namespace {\n $return['algoName'] = 'bcrypt';\n list($cost) = sscanf($hash, \"$2y$%d$\");\n $return['options']['cost'] = $cost;\n + } else if (PasswordCompat\\binary\\_substr($hash, 0, 3) == '$6$') {\n + $return['algo'] = PASSWORD_SHA512;\n + $return['algoName'] = 'sha512';\n + list($rounds) = sscanf($hash, '$6$rounds=%d$');\n + $return['options']['rounds'] = $rounds;\n }\n return $return;\n }\n @@ -215,6 +239,12 @@ namespace {\n return true;\n }\n break;\n + case PASSWORD_SHA512:\n + $rounds = isset($options['rounds']) ? $options['rounds'] : 5000;\n + if ($rounds != $info['options']['rounds']) {\n + return true;\n + }\n + break;\n }\n return false;\n }\n \n```","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T08:19:14.527","id":"7210","last_activity_date":"2015-02-27T08:19:14.527","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"2992","parent_id":"7133","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"「何を使うべきか」という質問であれば要件次第と言う答えにしかならないと思います\\n\\n * 73文字目以降が無視されるのは不可、複数のハッシュ関数を使うのは気持ち悪い→`crypt()`を使ってBROWFISH以外で自前実装。もしくはもっと低レイヤのハッシュ関数で自前実装\\n * (この項について追記を読んでください)73文字目以降が無視されるのは不可だが複数のハッシュ関数という点は気にしない→ハッシュ関数を通してから`password_hash()`\\n * 73文字目以降が無視されてもかまわない→そのまま`password_hash()`\\n\\nほとんどのアプリケーションでは72文字もあればパスワード強度としては十分でしょうから73文字以降が無視されたとしても現実的には問題ないと思います。\\n\\n* * *\\n\\n更新された質問に合わせて追記。\\n\\n`password_hash()`が依然としてベストプラクティスなのか、もしくはよりよい代替手段があるのか、ということですね。\\n\\n`password_hash()`を直接置き換える代替手段は提供されていない一方、`password_hash()`の文字数問題は前記の通り現実のアプリケーションに深刻な影響を与えるものとは言えず`password_hash()`を忌避する積極的な理由はないないので、結局は上に書いたとおりになると思います。\\n\\nいかなる場合もベストプラクティス、から、条件付きではあるがベストプラクティス、にニュアンスは変わっていますが、現実には深刻に捉えなければならない条件とは言えないので依然としてベストプラクティスには違いない、と言うことでいいのではないでしょうか。\\n\\n* * *\\n\\n余談。ASCIIの印字可能文字95種を72文字使うと約2.5e+142でbit数でいうと473bitになるので、SHA384とSHA512の間ぐらいになります。逆に、512bitを文字数に直すと78文字です。\\n\\n* * *\\n\\n(追記)PHPのbcrypt実装はバイナリセーフではないため、生のハッシュ値をpassword_hashに渡すと意図しない切り詰めが生じる場合があります。\\n\\n\\n\\nハッシュ値をpassword_hashに渡すのは避けてください。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 4.0\",\n \"creation_date\": \"2015-02-27T03:20:46.550\",\n \"id\": \"7183\",\n \"last_activity_date\": \"2019-02-27T02:26:34.160\",\n \"last_edit_date\": \"2019-02-27T02:26:34.160\",\n \"last_editor_user_id\": \"5793\",\n \"owner_user_id\": \"5793\",\n \"parent_id\": \"7133\",\n \"post_type\": \"answer\",\n \"score\": 9\n },\n {\n \"body\": \"質問文にあるマニュアルのリンクに [ユーザーランドでの実装](https://github.com/ircmaxell/password_compat)\\nがあったので、その近所を眺めていると、fork\\n元がちょっと古いですが、[ここら](https://github.com/fredericve/password_compat) に crypt の\\nSHA512 で真面目に実装してそうなものがあったりしました。\\n\\n最新のものにマージしても動きそうなので、独自実装をメンテする覚悟があるなら工夫してみるのも一つの手かもしれません。\\n\\n * 捨てコード\\n``` 8192));\\n echo $out.\\\"\\\\n\\\";\\n echo (password_verify($pass . \\\"test\\\", $out) ? \\\"true\\\" : \\\"false\\\") .\\\"\\\\n\\\";\\n \\n```\\n\\n * 実行\\n``` $ php test.php\\n\\n $2y$10$xvbzRgk6P43krmuuV2bHE.4SYMHkiznz1eM628S1dknRRzQqIAVRm\\n true\\n $6$rounds=8192$32eHmy/jGehb/LS4$ICeAgh81FHnDEPSaUr8f4O9tk4l6EyDg0uif1r2XCSwcbpvLYYNltXB6QcyY6NARBLb6NzxBPKfbzw2DRyxrL/\\n false\\n $\\n \\n```\\n\\n以下は `git clone https://github.com/ircmaxell/password_compat` して\\n[ここ](https://github.com/fredericve/password_compat/commit/9504ebcd1f0350b7e4f2c12bbe43f716bfaac8d9)\\nとか\\n[ここ](https://github.com/fredericve/password_compat/commit/11f8d5de164d96fe121a21ecc46f5ee6add2d910)\\nを参考にしてお手当したものの `git diff`\\n\\n```\\n\\n diff --git a/lib/password.php b/lib/password.php\\n index 805caa5..d2588a1 100644\\n --- a/lib/password.php\\n +++ b/lib/password.php\\n @@ -17,6 +17,7 @@ namespace {\\n * code.\\n */\\n define('PASSWORD_BCRYPT', 1);\\n + define('PASSWORD_SHA512', 2);\\n define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);\\n define('PASSWORD_BCRYPT_DEFAULT_COST', 10);\\n }\\n @@ -67,6 +68,24 @@ namespace {\\n // The expected length of the final crypt() output\\n $resultLength = 60;\\n break;\\n + case PASSWORD_SHA512:\\n + // Note that this is a C constant, but not exposed to PHP, so we don't define it here.\\n + $rounds = 5000;\\n + if (isset($options['rounds'])) {\\n + $rounds = $options['rounds'];\\n + if ($rounds < 1000 || $rounds > 999999999) {\\n + trigger_error(sprintf(\\\"password_hash(): Invalid sha512 rounds parameter specified: %d\\\", $rounds), E_USER_WARNING);\\n + return null;\\n + }\\n + }\\n + // The length of salt to generate\\n + $raw_salt_len = 16;\\n + // The length required in the final serialization\\n + $required_salt_len = 22;\\n + $hash_format = sprintf('$6$rounds=%d$', $rounds);\\n + // The expected length of the final crypt() output\\n + $resultLength = strlen($hash_format) + $raw_salt_len + 87;\\n + break;\\n default:\\n trigger_error(sprintf(\\\"password_hash(): Unknown password hashing algorithm: %s\\\", $algo), E_USER_WARNING);\\n return null;\\n @@ -188,6 +207,11 @@ namespace {\\n $return['algoName'] = 'bcrypt';\\n list($cost) = sscanf($hash, \\\"$2y$%d$\\\");\\n $return['options']['cost'] = $cost;\\n + } else if (PasswordCompat\\\\binary\\\\_substr($hash, 0, 3) == '$6$') {\\n + $return['algo'] = PASSWORD_SHA512;\\n + $return['algoName'] = 'sha512';\\n + list($rounds) = sscanf($hash, '$6$rounds=%d$');\\n + $return['options']['rounds'] = $rounds;\\n }\\n return $return;\\n }\\n @@ -215,6 +239,12 @@ namespace {\\n return true;\\n }\\n break;\\n + case PASSWORD_SHA512:\\n + $rounds = isset($options['rounds']) ? $options['rounds'] : 5000;\\n + if ($rounds != $info['options']['rounds']) {\\n + return true;\\n + }\\n + break;\\n }\\n return false;\\n }\\n \\n```\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T08:19:14.527\",\n \"id\": \"7210\",\n \"last_activity_date\": \"2015-02-27T08:19:14.527\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"2992\",\n \"parent_id\": \"7133\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"7133"},"accepted_answer_id":{"kind":"string","value":"7183"},"popular_answer_id":{"kind":"string","value":"7183"}}},{"rowIdx":1605,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7160\",\n \"answer_count\": 2,\n \"body\": \"`TableView`の各セルで横スクロールやページングを行いたいのですが、イマイチ考え方が分かりません。`Storyboard`に`UITableView`を乗せてその上に複数の`UITableViewCell`を乗せ、その各セル上に`UIScrollView`を置きました。それから`Storyboard`上の各`UIScrollView`に`UITableViewCell`を継承したクラスを紐付けました。一度この状態でビルドすると、空のセルを持った`TableView`が表示されるのですが、ここからどうすればいいのか分かりません。`TableView`の`cellForRowAtIndexPath`メソッド内で`ScrollView`に画像を置いたり、ページング処理を施すのでしょうか?または`UITableViewCell`を継承したクラス内で何か処理を行うのでしょうか?下に現在の途中まで書いているコードを記します。この先どういう風にプログラムを組んでいけばいいかアドバイスをいただきたいです。すみませんが、よろしくお願いします。\\n\\nViewController.h\\n\\n```\\n\\n @interface ViewController : UITableViewController\\n \\n @end\\n \\n```\\n\\nViewController.m\\n\\n```\\n\\n @interface ViewController () {\\n \\n IBOutlet UITableView *_tableView;\\n }\\n \\n @end\\n \\n @implementation ViewController\\n \\n - (void)viewDidLoad {\\n [super viewDidLoad];\\n // Do any additional setup after loading the view, typically from a nib.\\n \\n UINib *nib = [UINib nibWithNibName:NSStringFromClass([PagerCell class]) bundle:nil];\\n [_tableView registerNib:nib forCellReuseIdentifier:@\\\"cell\\\"];\\n }\\n \\n - (void)didReceiveMemoryWarning {\\n [super didReceiveMemoryWarning];\\n // Dispose of any resources that can be recreated.\\n }\\n \\n - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {\\n return 4;\\n }\\n \\n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\\n PagerCell *cell = [tableView dequeueReusableCellWithIdentifier:@\\\"cell\\\"];\\n \\n if (!cell) {\\n cell = [[PagerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@\\\"cell\\\"];\\n }\\n \\n switch (indexPath.row) {\\n case 0:\\n [self setTopPager];\\n break;\\n \\n default:\\n \\n break;\\n }\\n \\n return cell;\\n }\\n \\n - (void)setTopPager {\\n PagerCell *pagerCell = [[PagerCell alloc]init];\\n [pagerCell setTopPager:self.view];\\n }\\n \\n @end\\n \\n```\\n\\nPagerCell.h\\n\\n```\\n\\n @interface PagerCell : UITableViewCell\\n \\n @property (weak, nonatomic) IBOutlet UIScrollView *pager;\\n \\n - (void)setTopPager:(UIView*)_view;\\n \\n @end\\n \\n```\\n\\nPagerCell.m\\n\\n```\\n\\n @implementation PagerCell\\n \\n - (void)awakeFromNib {\\n // Initialization code\\n }\\n \\n - (void)setSelected:(BOOL)selected animated:(BOOL)animated {\\n [super setSelected:selected animated:animated];\\n \\n // Configure the view for the selected state\\n }\\n \\n - (void)setTopPager:(UIView*)_view {\\n NSArray* imageNames = [NSArray arrayWithObjects:@\\\"android.png\\\", @\\\"android.png\\\", @\\\"android.png\\\", @\\\"android.png\\\", @\\\"android.png\\\", @\\\"android.png\\\", @\\\"android.png\\\", @\\\"android.png\\\", @\\\"android.png\\\", @\\\"android.png\\\", nil];\\n int imageNum = [imageNames count];\\n for (int i=0; i < imageNum; i++) {\\n UIImage* image = [UIImage imageNamed:[imageNames objectAtIndex:i]];\\n UIImageView* imageView = [[UIImageView alloc] initWithImage:image];\\n CGSize size = CGSizeMake(100, 100);\\n imageView.frame = CGRectMake(160*i + (160 - size.width) / 2, 0 + (180 - size.height) / 2, size.width, size.height);\\n [self.pager addSubview:imageView];\\n }\\n [self.pager setContentSize:CGSizeMake(100*imageNum, 120)];\\n [_view addSubview:self.pager];\\n }\\n \\n @end\\n \\n```\",\n \"comment_count\": 2,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T07:45:16.700\",\n \"favorite_count\": 0,\n \"id\": \"7134\",\n \"last_activity_date\": \"2015-02-27T01:09:35.607\",\n \"last_edit_date\": \"2015-02-26T22:57:55.727\",\n \"last_editor_user_id\": \"5210\",\n \"owner_user_id\": \"5210\",\n \"post_type\": \"question\",\n \"score\": 1,\n \"tags\": [\n \"objective-c\",\n \"uitableview\",\n \"uiscrollview\"\n ],\n \"title\": \"TableViewの各セルで横スクロールやページング処理をしたい\",\n \"view_count\": 1162\n}"},"answers":{"kind":"list like","value":[{"body":"returnのcellがUITableViewCellのままなので、こんな感じでできるのではないでしょうか?\n\n```\n\n PagerCell *cell = [tableView dequeueReusableCellWithIdentifier:@\"cell\"];\n \n if (!cell) {\n cell = [[PagerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@\"cell\"];\n }\n \n```","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T10:12:45.633","id":"7146","last_activity_date":"2015-02-26T10:12:45.633","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"8567","parent_id":"7134","post_type":"answer","score":1},{"body":">\n> TableViewのcellForRowAtIndexPathメソッド内でScrollViewに画像を置いたり、ページング処理を施すのでしょうか?またはUITableViewCellを継承したクラス内で何か処理を行うのでしょうか?\n\n後者(カスタムセル側で処理)の方が良いと思います。 \ncellForRowAtIndexPath内でカスタムセルに表示したいデータを渡して、 \nデータの加工や表示についてはカスタムセル側に任せた方が見やすいし変更もしやすいです。\n\nまた、個人的にはカスタムセル側で色々な処理をしたい場合は、別途`xib`を作成してカスタムセルと紐付ける方がやりやすいと思います。 \n※この場合は`Storyboard`上に`CustomCell`を配置する必要はありません。\n\nざっくり書くとこんな感じです。 \n※セルの再利用とかは考慮していません。\n\nViewController.m\n\n```\n\n - (void)viewDidLoad\n {\n [super viewDidLoad];\n // セルを登録\n UINib *nib = [UINib nibWithNibName:NSStringFromClass([CustomCell class]) bundle:nil];\n [_tableView registerNib:nib forCellReuseIdentifier:@\"cell\"];\n }\n \n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\n {\n CustomCell* cell = [tableView dequeueReusableCellWithIdentifier:@\"cell\" forIndexPath:indexPath];\n \n // 表示要素を設定\n [cell setElementsValue:datasource_[indexPath.row]];\n return cell;\n }\n \n```\n\nCustomCell.h\n\n```\n\n @interface CustomCell : UITableViewCell\n \n - (void)setElementsValue:(NSDictionary *)dic;\n \n @end \n \n```\n\nCustomCell.m\n\n```\n\n @interface CustomCell ()\n \n @property (weak, nonatomic) IBOutlet UILabel *title;\n @property (weak, nonatomic) IBOutlet UILabel *body;\n \n @end \n \n @implementation CustomCell\n \n - (void)setElementsValue:(NSDictionary *)dic\n {\n // タイトル\n [self setTitleText:dic[@\"title\"]];\n // 本文\n [self setBodyText:dic[@\"body\"]];\n }\n \n // タイトル設定\n - (void)setTitleText:(NSString *)text\n {\n _title.text = text;\n }\n \n // 本文設定\n - (void)setBodyText:(NSString *)text\n {\n _body.text = text;\n }\n \n // その他スクロール処理等\n \n @end\n \n```\n\n----- 質問追記部分に対する追記 -----\n```\n\n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n PagerCell *cell = [tableView dequeueReusableCellWithIdentifier:@\"cell\"];\n \n if (!cell) {\n cell = [[PagerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@\"cell\"];\n }\n \n switch (indexPath.row) {\n case 0:\n [self setTopPager];\n break;\n \n default:\n \n break;\n }\n \n return cell;\n }\n \n - (void)setTopPager {\n PagerCell *pagerCell = [[PagerCell alloc]init];\n [pagerCell setTopPager:self.view];\n }\n \n```\n\nここの処理がおかしいです。 \nせっかく`cellForRowAtIndexPath`内で`tableView`に紐付けたセルを取得しているのに \n`setTopPager`で不要なインスタンスを新たに作成しています。 \nまた`PagerCell`の`setTopPager`を不要なインスタンス側で実行しているため、 \n`tableView`に紐付けたセル側では何も起きません。\n\nこの辺りは`UITableView`を使用する際には重要な知識だと思いますので、 \n基本的な使い方を再確認しておくと良いと思います。","comment_count":4,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T15:46:34.563","id":"7160","last_activity_date":"2015-02-27T01:09:35.607","last_edit_date":"2015-02-27T01:09:35.607","last_editor_user_id":"3516","owner_user_id":"3516","parent_id":"7134","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"returnのcellがUITableViewCellのままなので、こんな感じでできるのではないでしょうか?\\n\\n```\\n\\n PagerCell *cell = [tableView dequeueReusableCellWithIdentifier:@\\\"cell\\\"];\\n \\n if (!cell) {\\n cell = [[PagerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@\\\"cell\\\"];\\n }\\n \\n```\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T10:12:45.633\",\n \"id\": \"7146\",\n \"last_activity_date\": \"2015-02-26T10:12:45.633\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8567\",\n \"parent_id\": \"7134\",\n \"post_type\": \"answer\",\n \"score\": 1\n },\n {\n \"body\": \">\\n> TableViewのcellForRowAtIndexPathメソッド内でScrollViewに画像を置いたり、ページング処理を施すのでしょうか?またはUITableViewCellを継承したクラス内で何か処理を行うのでしょうか?\\n\\n後者(カスタムセル側で処理)の方が良いと思います。 \\ncellForRowAtIndexPath内でカスタムセルに表示したいデータを渡して、 \\nデータの加工や表示についてはカスタムセル側に任せた方が見やすいし変更もしやすいです。\\n\\nまた、個人的にはカスタムセル側で色々な処理をしたい場合は、別途`xib`を作成してカスタムセルと紐付ける方がやりやすいと思います。 \\n※この場合は`Storyboard`上に`CustomCell`を配置する必要はありません。\\n\\nざっくり書くとこんな感じです。 \\n※セルの再利用とかは考慮していません。\\n\\nViewController.m\\n\\n```\\n\\n - (void)viewDidLoad\\n {\\n [super viewDidLoad];\\n // セルを登録\\n UINib *nib = [UINib nibWithNibName:NSStringFromClass([CustomCell class]) bundle:nil];\\n [_tableView registerNib:nib forCellReuseIdentifier:@\\\"cell\\\"];\\n }\\n \\n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\\n {\\n CustomCell* cell = [tableView dequeueReusableCellWithIdentifier:@\\\"cell\\\" forIndexPath:indexPath];\\n \\n // 表示要素を設定\\n [cell setElementsValue:datasource_[indexPath.row]];\\n return cell;\\n }\\n \\n```\\n\\nCustomCell.h\\n\\n```\\n\\n @interface CustomCell : UITableViewCell\\n \\n - (void)setElementsValue:(NSDictionary *)dic;\\n \\n @end \\n \\n```\\n\\nCustomCell.m\\n\\n```\\n\\n @interface CustomCell ()\\n \\n @property (weak, nonatomic) IBOutlet UILabel *title;\\n @property (weak, nonatomic) IBOutlet UILabel *body;\\n \\n @end \\n \\n @implementation CustomCell\\n \\n - (void)setElementsValue:(NSDictionary *)dic\\n {\\n // タイトル\\n [self setTitleText:dic[@\\\"title\\\"]];\\n // 本文\\n [self setBodyText:dic[@\\\"body\\\"]];\\n }\\n \\n // タイトル設定\\n - (void)setTitleText:(NSString *)text\\n {\\n _title.text = text;\\n }\\n \\n // 本文設定\\n - (void)setBodyText:(NSString *)text\\n {\\n _body.text = text;\\n }\\n \\n // その他スクロール処理等\\n \\n @end\\n \\n```\\n\\n----- 質問追記部分に対する追記 -----\\n```\\n\\n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\\n PagerCell *cell = [tableView dequeueReusableCellWithIdentifier:@\\\"cell\\\"];\\n \\n if (!cell) {\\n cell = [[PagerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@\\\"cell\\\"];\\n }\\n \\n switch (indexPath.row) {\\n case 0:\\n [self setTopPager];\\n break;\\n \\n default:\\n \\n break;\\n }\\n \\n return cell;\\n }\\n \\n - (void)setTopPager {\\n PagerCell *pagerCell = [[PagerCell alloc]init];\\n [pagerCell setTopPager:self.view];\\n }\\n \\n```\\n\\nここの処理がおかしいです。 \\nせっかく`cellForRowAtIndexPath`内で`tableView`に紐付けたセルを取得しているのに \\n`setTopPager`で不要なインスタンスを新たに作成しています。 \\nまた`PagerCell`の`setTopPager`を不要なインスタンス側で実行しているため、 \\n`tableView`に紐付けたセル側では何も起きません。\\n\\nこの辺りは`UITableView`を使用する際には重要な知識だと思いますので、 \\n基本的な使い方を再確認しておくと良いと思います。\",\n \"comment_count\": 4,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T15:46:34.563\",\n \"id\": \"7160\",\n \"last_activity_date\": \"2015-02-27T01:09:35.607\",\n \"last_edit_date\": \"2015-02-27T01:09:35.607\",\n \"last_editor_user_id\": \"3516\",\n \"owner_user_id\": \"3516\",\n \"parent_id\": \"7134\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7134"},"accepted_answer_id":{"kind":"string","value":"7160"},"popular_answer_id":{"kind":"string","value":"7146"}}},{"rowIdx":1606,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 2,\n \"body\": \"WindowsPC/AndroidごとにWebページを用意するのではなく、 \\n両方から1つのWebページを表示したいです。\\n\\nPCはWebページを参照するだけなのですが、タブレットはHTML5でバーコードをスキャンもさせたいです。\\n\\n① WindowsPC/AndroidでWebページを共有する際に発生する問題を教えて下さい。 \\n→ レイアウトが崩れたりしませんか?ボタンサイズの問題 etc...\\n\\n② HTML5を使ってバーコードスキャンって、実際どうなんですか? \\n→ HTML5を使ってバーコードスキャンするよりも、javaでAndroidアプリを作る方が安全だと思うんです\",\n \"comment_count\": 5,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T07:50:24.527\",\n \"favorite_count\": 0,\n \"id\": \"7136\",\n \"last_activity_date\": \"2020-01-13T01:15:02.103\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8247\",\n \"post_type\": \"question\",\n \"score\": -1,\n \"tags\": [\n \"android\",\n \"java\",\n \"html5\"\n ],\n \"title\": \"WindowsPC/Androidタブレットで同じWebページを表示したい\",\n \"view_count\": 229\n}"},"answers":{"kind":"list like","value":[{"body":"取りあえず、PCとスマホ兼用のページを作るのは如何でしょう? \n例えば、ALLAboutさんが「レスポンシブな2カラムレイアウトを作るCSSの書き方」 \nというのを書かれています。(2019年11月20日現在) \n \nこれは、PC用とモバイル用と、css を別けるだけで、1つのhtml を兼用出来ます。 \n片方だけに必要なリンクを表示させることも出来ます。 \nただ、PCではメニューは左右・スマホでは上下等、 \n兼用出来るレイアウトを考える必要はあります。","comment_count":0,"content_license":"CC BY-SA 4.0","creation_date":"2019-11-20T15:58:41.843","id":"60707","last_activity_date":"2019-11-20T16:21:05.493","last_edit_date":"2019-11-20T16:21:05.493","last_editor_user_id":"36568","owner_user_id":"36568","parent_id":"7136","post_type":"answer","score":0},{"body":"WindowsPC/AndroidごとにWebページを用意するのではなく、 \n両方から1つのWebページを表示したいとのことですが、WordPressで作成すると、 \nPCではPCのフォーマットで、スマホではスマホのフォーマットで \n表示されるサイトを作ることができます。 \nこのようなやり方ではだめですか?","comment_count":0,"content_license":"CC BY-SA 4.0","creation_date":"2020-01-13T01:15:02.103","id":"62198","last_activity_date":"2020-01-13T01:15:02.103","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"24490","parent_id":"7136","post_type":"answer","score":0}],"string":"[\n {\n \"body\": \"取りあえず、PCとスマホ兼用のページを作るのは如何でしょう? \\n例えば、ALLAboutさんが「レスポンシブな2カラムレイアウトを作るCSSの書き方」 \\nというのを書かれています。(2019年11月20日現在) \\n \\nこれは、PC用とモバイル用と、css を別けるだけで、1つのhtml を兼用出来ます。 \\n片方だけに必要なリンクを表示させることも出来ます。 \\nただ、PCではメニューは左右・スマホでは上下等、 \\n兼用出来るレイアウトを考える必要はあります。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 4.0\",\n \"creation_date\": \"2019-11-20T15:58:41.843\",\n \"id\": \"60707\",\n \"last_activity_date\": \"2019-11-20T16:21:05.493\",\n \"last_edit_date\": \"2019-11-20T16:21:05.493\",\n \"last_editor_user_id\": \"36568\",\n \"owner_user_id\": \"36568\",\n \"parent_id\": \"7136\",\n \"post_type\": \"answer\",\n \"score\": 0\n },\n {\n \"body\": \"WindowsPC/AndroidごとにWebページを用意するのではなく、 \\n両方から1つのWebページを表示したいとのことですが、WordPressで作成すると、 \\nPCではPCのフォーマットで、スマホではスマホのフォーマットで \\n表示されるサイトを作ることができます。 \\nこのようなやり方ではだめですか?\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 4.0\",\n \"creation_date\": \"2020-01-13T01:15:02.103\",\n \"id\": \"62198\",\n \"last_activity_date\": \"2020-01-13T01:15:02.103\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"24490\",\n \"parent_id\": \"7136\",\n \"post_type\": \"answer\",\n \"score\": 0\n }\n]"},"id":{"kind":"string","value":"7136"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"60707"}}},{"rowIdx":1607,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7505\",\n \"answer_count\": 2,\n \"body\": \"[`ArrayAdapter`](http://developer.android.com/reference/android/widget/ArrayAdapter.html)\\nのサブクラスで `getView` が呼び出される際、コンストラクタで渡した`ArrayList` のsize に関わらず position は 0\\nのままで、 `ListView` に `ArrayList` の2つ目以降のアイテムのViewが渡されません。\\n\\nレイアウトは ListView1 が ListView2 を持つ入れ子の構造で、 ListView1 は問題なく動作しますが、 ListView2\\nは上記のような状態です。\\n\\n```\\n\\n private class DayAdapter extends ArrayAdapter { \\n private LayoutInflater inflater;\\n private class ViewHolder{\\n TextView textDate;\\n ListView listItem;\\n TextView textBalance;\\n \\n ViewHolder(View view){\\n this.textDate = (TextView) view.findViewById(R.id.txtDate);\\n this.listItem = (ListView) view.findViewById(R.id.lstItem);\\n this.textBalance = (TextView) view.findViewById(R.id.txtBalance);\\n }\\n } \\n \\n public DayAdapter(Context context, int textViewResourceId, List objects) {\\n super(context, textViewResourceId, objects);\\n this.inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);\\n }\\n \\n @Override\\n // こちらのpositionは更新される\\n public View getView(int position, View convertView, ViewGroup parent) {\\n ViewHolder holder;\\n \\n if(convertView == null){\\n convertView = inflater.inflate(R.layout.day, null);\\n holder = new ViewHolder(convertView);\\n convertView.setTag(holder);\\n }else{\\n holder = (ViewHolder)convertView.getTag();\\n }\\n \\n DayData day = (DayData)getItem(position);\\n if(day != null){ \\n holder.textDate.setText(day.GetStringDate());\\n holder.textBalance.setText(day.GetStringBalance());\\n \\n Log.d(\\\"ItemAdapter\\\", \\\"size=\\\"+day.GetItemList().size());\\n ItemAdapter adapter = new ItemAdapter(Diary.this, 0, day.GetItemList());\\n holder.listItem.setAdapter(adapter);\\n }\\n return convertView;\\n }\\n } \\n \\n private class ItemAdapter extends ArrayAdapter {\\n private LayoutInflater inflater;\\n private class ViewHolder{\\n TextView textDate;\\n TextView textItem;\\n TextView textPrice;\\n \\n ViewHolder(View view){\\n this.textDate = (TextView) view.findViewById(R.id.textView1);\\n this.textItem = (TextView) view.findViewById(R.id.textView2);\\n this.textPrice = (TextView) view.findViewById(R.id.textView3);\\n }\\n }\\n \\n public ItemAdapter(Context context, int textViewResourceId, List objects) {\\n super(context, textViewResourceId, objects);\\n this.inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);\\n }\\n \\n @Override\\n // こちらのpositionは0のまま\\n public View getView(int position, View convertView, ViewGroup parent) {\\n ViewHolder holder;\\n if(convertView == null){\\n convertView = inflater.inflate(R.layout.row, null);\\n holder = new ViewHolder(convertView);\\n convertView.setTag(holder);\\n }else{\\n holder = (ViewHolder)convertView.getTag();\\n }\\n \\n Log.d(\\\"getView()\\\", \\\"position=\\\"+position);\\n ItemData item = (ItemData)getItem(position);\\n if(item != null){ \\n holder.textDate.setText(item.GetStringDate());\\n holder.textItem.setText(item.GetItem()); \\n \\n String sign = \\\"\\\";\\n if(item.GetPrice() > 0) sign = \\\"+\\\";\\n holder.textPrice.setText(sign + Integer.toString(item.GetPrice()) + \\\"円\\\");\\n }\\n return convertView;\\n }\\n }\\n \\n```\\n\\nday.xml\\n\\n```\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n```\\n\\nrow.xml\\n\\n```\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n```\\n\\nこの場合どのような原因が考えられるでしょうか?\",\n \"comment_count\": 2,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T09:37:36.510\",\n \"favorite_count\": 0,\n \"id\": \"7143\",\n \"last_activity_date\": \"2015-03-05T21:25:37.377\",\n \"last_edit_date\": \"2015-03-05T21:25:37.377\",\n \"last_editor_user_id\": \"5750\",\n \"owner_user_id\": \"8560\",\n \"post_type\": \"question\",\n \"score\": 2,\n \"tags\": [\n \"android\",\n \"java\",\n \"android-layout\"\n ],\n \"title\": \"ArrayAdapter のサブクラス内の getView() の引数 position が 0 のままで加算されない\",\n \"view_count\": 8531\n}"},"answers":{"kind":"list like","value":[{"body":"原因は、ListView2 (@id/lstItem) の layout_height が wrap_content\nであるためではないでしょうか。リストビューの高さは子要素によって計算することができないため固定値または match_parent にする必要があります。\n\n下に TextView を続けるなら RelativeLayout に変えて、以下のようにすればなんとかなるのではないかと思います。\n\n```\n\n \n \n \n \n \n```\n\nただ、リストビューの入れ子というのはスクロールの面で難儀しそうなので、他の方法を取られたほうが得策かなという気はしますね。","comment_count":2,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T10:36:09.127","id":"7147","last_activity_date":"2015-02-26T10:46:18.497","last_edit_date":"2015-02-26T10:46:18.497","last_editor_user_id":"7558","owner_user_id":"7558","parent_id":"7143","post_type":"answer","score":0},{"body":"## なぜか\n\n`position`値がゼロのままになる理由を説明します。 \nListViewにセットされた`ArrayAdapter`の`getView()`が呼び出されるのは、ListViewがスクロールされて画面内にはいってきた子要素に対応する`View`が必要になったタイミングです。 \nしたがって、`ListView`の初期状態に要素1個しか表示できない状態の場合、スクロールしないかぎり次の`getView()`は呼び出されません。\n\n## どのようにすればよいか\n\n今回は、内側の`ListView`をスクロールしたくないので、簡単にするために`LinearView`に置き換えれば良いです。\n\n`day.xml`レイアウトを変更。\n\n```\n\n \n \n \n \n \n \n \n \n \n```\n\n`DayAdapter#getView()`を以下のように修正(ブロックコメントの箇所のみ)。\n\n```\n\n @Override\n // こちらのpositionは更新される\n public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder;\n \n if(convertView == null){\n convertView = inflater.inflate(R.layout.day, null);\n holder = new ViewHolder(convertView);\n convertView.setTag(holder);\n }else{\n holder = (ViewHolder)convertView.getTag();\n }\n \n DayData day = (DayData)getItem(position);\n if(day != null){\n holder.textDate.setText(day.GetStringDate());\n holder.textBalance.setText(day.GetStringBalance());\n \n Log.d(\"ItemAdapter\", \"size=\"+day.GetItemList().size());\n ItemAdapter adapter = new ItemAdapter(Diary.this, 0, day.GetItemList());\n \n /* listItemをクリアしてからadapterでrowレイアウトを必要なだけ作って追加する */\n holder.listItem.removeAllViews();\n for (int i = 0; i\\n \\n \\n \\n \\n```\\n\\nただ、リストビューの入れ子というのはスクロールの面で難儀しそうなので、他の方法を取られたほうが得策かなという気はしますね。\",\n \"comment_count\": 2,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T10:36:09.127\",\n \"id\": \"7147\",\n \"last_activity_date\": \"2015-02-26T10:46:18.497\",\n \"last_edit_date\": \"2015-02-26T10:46:18.497\",\n \"last_editor_user_id\": \"7558\",\n \"owner_user_id\": \"7558\",\n \"parent_id\": \"7143\",\n \"post_type\": \"answer\",\n \"score\": 0\n },\n {\n \"body\": \"## なぜか\\n\\n`position`値がゼロのままになる理由を説明します。 \\nListViewにセットされた`ArrayAdapter`の`getView()`が呼び出されるのは、ListViewがスクロールされて画面内にはいってきた子要素に対応する`View`が必要になったタイミングです。 \\nしたがって、`ListView`の初期状態に要素1個しか表示できない状態の場合、スクロールしないかぎり次の`getView()`は呼び出されません。\\n\\n## どのようにすればよいか\\n\\n今回は、内側の`ListView`をスクロールしたくないので、簡単にするために`LinearView`に置き換えれば良いです。\\n\\n`day.xml`レイアウトを変更。\\n\\n```\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n```\\n\\n`DayAdapter#getView()`を以下のように修正(ブロックコメントの箇所のみ)。\\n\\n```\\n\\n @Override\\n // こちらのpositionは更新される\\n public View getView(int position, View convertView, ViewGroup parent) {\\n ViewHolder holder;\\n \\n if(convertView == null){\\n convertView = inflater.inflate(R.layout.day, null);\\n holder = new ViewHolder(convertView);\\n convertView.setTag(holder);\\n }else{\\n holder = (ViewHolder)convertView.getTag();\\n }\\n \\n DayData day = (DayData)getItem(position);\\n if(day != null){\\n holder.textDate.setText(day.GetStringDate());\\n holder.textBalance.setText(day.GetStringBalance());\\n \\n Log.d(\\\"ItemAdapter\\\", \\\"size=\\\"+day.GetItemList().size());\\n ItemAdapter adapter = new ItemAdapter(Diary.this, 0, day.GetItemList());\\n \\n /* listItemをクリアしてからadapterでrowレイアウトを必要なだけ作って追加する */\\n holder.listItem.removeAllViews();\\n for (int i = 0; i= 400 && responseCode <= 499) {\\n }else{\\n is = con.getInputStream();\\n String path = Environment.getExternalStorageDirectory() + \\\"/apdroid/\\\";\\n String fileName = url.substring(url.lastIndexOf('/') + 1);\\n File dir = new File(path);\\n dir.mkdirs();\\n File outputFile = new File(dir, fileName);\\n FileOutputStream fos = new FileOutputStream(outputFile);\\n \\n byte[] buffer = new byte[1024];\\n int len = 0;\\n while ((len = is.read(buffer)) != -1) {\\n fos.write(buffer, 0, len);\\n }\\n fos.close();\\n is.close();\\n \\n image = BitmapFactory.decodeStream(is);\\n }\\n return image;\\n \\n }catch (IOException e) {\\n e.printStackTrace();\\n }\\n \\n```\\n\\n* * *\\n\\nこちらのコードに変更してやってみたらダウンロードはできるのですが、画像形式ではなくてHtmlで保存されてしまします。\\n\\n```\\n\\n Request request = new Request(Uri.parse(url));\\n request.allowScanningByMediaScanner();\\n request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);\\n request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, \\\"download\\\");\\n request.setVisibleInDownloadsUi(false);\\n request.setDescription(contentDisposition);\\n downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);\\n query = new DownloadManager.Query();\\n // ダウンロードフラグ\\n query.setFilterByStatus(DownloadManager.STATUS_FAILED);\\n query.setFilterByStatus(DownloadManager.STATUS_SUCCESSFUL);\\n downloadid = downloadManager.enqueue(request);\\n \\n receiver = new BroadcastReceiver(){\\n @Override\\n public void onReceive(Context context, Intent intent) {\\n String action = intent.getAction();\\n if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {\\n \\n long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);\\n Log.d(\\\"xxx\\\", \\\"End Download download Id = \\\" + id);\\n \\n query.setFilterById(id);\\n Cursor c = downloadManager.query(query);\\n \\n if(c.moveToFirst()) {\\n int status = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_STATUS));\\n int reason = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_REASON));\\n Log.d(\\\"status\\\", Integer.toString(status));\\n Log.d(\\\"reason\\\", Integer.toString(reason));\\n \\n // ダウンロードに失敗した場合\\n if (status == DownloadManager.STATUS_FAILED) {\\n downloadManager.remove(downloadid);\\n \\n // ダウンロードに成功した場合\\n } else if (status == DownloadManager.STATUS_SUCCESSFUL) {\\n Log.d(\\\"\\\",\\\"SECCUSS\\\");\\n try {\\n ParcelFileDescriptor file =\\n downloadManager.openDownloadedFile(downloadid);\\n FileInputStream files =\\n new ParcelFileDescriptor.AutoCloseInputStream(file);\\n imageView.setImageBitmap(BitmapFactory.decodeStream(files));\\n } catch (FileNotFoundException e) {\\n e.printStackTrace();\\n }\\n \\n }\\n }\\n c.close();\\n \\n }\\n }\\n };\\n registerReceiver(receiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));\\n \\n```\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T09:39:33.453\",\n \"favorite_count\": 0,\n \"id\": \"7144\",\n \"last_activity_date\": \"2016-03-25T04:11:18.843\",\n \"last_edit_date\": \"2015-02-28T14:14:45.023\",\n \"last_editor_user_id\": \"30\",\n \"owner_user_id\": \"8567\",\n \"post_type\": \"question\",\n \"score\": 3,\n \"tags\": [\n \"java\",\n \"webview\",\n \"exception\"\n ],\n \"title\": \"FileNotFoundException:添付ファイルをダウンロード\",\n \"view_count\": 670\n}"},"answers":{"kind":"list like","value":[{"body":"DownloadManagerのことを調べていたらたどり着きました。 \nこちらの質問は9か月前のものなのですでに何かしら解決しているかわかりませんが、 \n多分私も以前似たような経験をしたので回答します。\n\nログインしておかなければ取得できないファイルを取得しようとしてはいませんか?\n\n私はそのファイルをAndroidアプリでWebViewからAsyncTaskでHttpURLConnectionなどを利用してダウンロードしようとした時、自分が指定したjpgファイルとして保存されたものの開くことができませんでした。 \nそのファイルをMacへ取り出して確かテキストエディタで見たところ、HTML形式で取得されていることがわかりました。 \n拡張子を変えてブラウザで見てみると、「アクセスするにはログインが必要です」的なログインフォームが表示されていました。\n\nfumikiさんがWebViewで何をしているかはわかりませんが、私の場合はWebViewでログイン処理を済ませていたので、その時のCookieをHttpURLConnectionに設定することにより無事画像としてダウンロードすることができたので、それを試してみるといいと思います。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-11-26T02:02:47.323","id":"19308","last_activity_date":"2015-11-26T02:02:47.323","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"9710","parent_id":"7144","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"DownloadManagerのことを調べていたらたどり着きました。 \\nこちらの質問は9か月前のものなのですでに何かしら解決しているかわかりませんが、 \\n多分私も以前似たような経験をしたので回答します。\\n\\nログインしておかなければ取得できないファイルを取得しようとしてはいませんか?\\n\\n私はそのファイルをAndroidアプリでWebViewからAsyncTaskでHttpURLConnectionなどを利用してダウンロードしようとした時、自分が指定したjpgファイルとして保存されたものの開くことができませんでした。 \\nそのファイルをMacへ取り出して確かテキストエディタで見たところ、HTML形式で取得されていることがわかりました。 \\n拡張子を変えてブラウザで見てみると、「アクセスするにはログインが必要です」的なログインフォームが表示されていました。\\n\\nfumikiさんがWebViewで何をしているかはわかりませんが、私の場合はWebViewでログイン処理を済ませていたので、その時のCookieをHttpURLConnectionに設定することにより無事画像としてダウンロードすることができたので、それを試してみるといいと思います。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-11-26T02:02:47.323\",\n \"id\": \"19308\",\n \"last_activity_date\": \"2015-11-26T02:02:47.323\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"9710\",\n \"parent_id\": \"7144\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"7144"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"19308"}}},{"rowIdx":1609,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7167\",\n \"answer_count\": 2,\n \"body\": \"Nagios を使って HTTP や HTTPS のコンテンツが変更されたことを \\n検知する仕組みはどのようにすれば実現できるでしょうか。\\n\\ncheck_http には次のオプションがあり、「指定した時間より古い場合に警告」という動作をします。\\n\\n```\\n\\n -M, --max-age=SECONDS\\n \\n```\\n\\nこれとは逆に「新しい場合に警告」という動作ができれば問題を解決できると思っていますが実現方法がわかりません。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T10:05:55.183\",\n \"favorite_count\": 0,\n \"id\": \"7145\",\n \"last_activity_date\": \"2021-11-01T00:19:12.787\",\n \"last_edit_date\": \"2021-11-01T00:19:12.787\",\n \"last_editor_user_id\": \"3060\",\n \"owner_user_id\": \"5008\",\n \"post_type\": \"question\",\n \"score\": 2,\n \"tags\": [\n \"linux\",\n \"http\",\n \"monitoring\"\n ],\n \"title\": \"Nagios で HTTP コンテンツが変更されたことを検知したい\",\n \"view_count\": 584\n}"},"answers":{"kind":"list like","value":[{"body":"別途、\"wget -N\" などでコンテンツをダウンロードしてから check_file_age でどうでしょうか。\n\nあるいは、ハッシュ値などを計算・保存しておいて、前回のものと比べる方法が考えられます。 \nNagios は過去の値を保存して比較するような用途には向いていませんが、プラグイン側で工夫すればできそうです。\n\n直接ファイルを参照できるのであれば、Tripwire, AIDE などの改竄検知ツールが良いと思います。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T15:23:30.153","id":"7159","last_activity_date":"2015-02-26T15:23:30.153","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"4603","parent_id":"7145","post_type":"answer","score":1},{"body":"Nagiosのpluginはしかるべきステータスコードを返すプログラムというだけなので、たいていのことはちょっとしたシェルスクリプト程度で監視できます。\n\n```\n\n #!/bin/sh\n \n HOST=$1\n URL=$2\n \n SAVE=/var/tmp/${HOST}\n \n new_data=`curl -s $URL |sha256sum`\n new_data=`echo $new_data` #空白よけ\n \n if [ ! -e $SAVE ]; then\n status=3 #UNKNOWN\n else\n old_data=`cat $SAVE`\n \n if [ \"$old_data\" = \"$new_data\" ]; then\n status=0 #OK\n else\n status=2 #CRITICAL\n fi\n fi\n \n echo $new_data > $SAVE\n exit $status\n \n```","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T01:44:11.530","id":"7167","last_activity_date":"2015-02-27T01:44:11.530","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"5793","parent_id":"7145","post_type":"answer","score":3}],"string":"[\n {\n \"body\": \"別途、\\\"wget -N\\\" などでコンテンツをダウンロードしてから check_file_age でどうでしょうか。\\n\\nあるいは、ハッシュ値などを計算・保存しておいて、前回のものと比べる方法が考えられます。 \\nNagios は過去の値を保存して比較するような用途には向いていませんが、プラグイン側で工夫すればできそうです。\\n\\n直接ファイルを参照できるのであれば、Tripwire, AIDE などの改竄検知ツールが良いと思います。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T15:23:30.153\",\n \"id\": \"7159\",\n \"last_activity_date\": \"2015-02-26T15:23:30.153\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"4603\",\n \"parent_id\": \"7145\",\n \"post_type\": \"answer\",\n \"score\": 1\n },\n {\n \"body\": \"Nagiosのpluginはしかるべきステータスコードを返すプログラムというだけなので、たいていのことはちょっとしたシェルスクリプト程度で監視できます。\\n\\n```\\n\\n #!/bin/sh\\n \\n HOST=$1\\n URL=$2\\n \\n SAVE=/var/tmp/${HOST}\\n \\n new_data=`curl -s $URL |sha256sum`\\n new_data=`echo $new_data` #空白よけ\\n \\n if [ ! -e $SAVE ]; then\\n status=3 #UNKNOWN\\n else\\n old_data=`cat $SAVE`\\n \\n if [ \\\"$old_data\\\" = \\\"$new_data\\\" ]; then\\n status=0 #OK\\n else\\n status=2 #CRITICAL\\n fi\\n fi\\n \\n echo $new_data > $SAVE\\n exit $status\\n \\n```\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T01:44:11.530\",\n \"id\": \"7167\",\n \"last_activity_date\": \"2015-02-27T01:44:11.530\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"5793\",\n \"parent_id\": \"7145\",\n \"post_type\": \"answer\",\n \"score\": 3\n }\n]"},"id":{"kind":"string","value":"7145"},"accepted_answer_id":{"kind":"string","value":"7167"},"popular_answer_id":{"kind":"string","value":"7167"}}},{"rowIdx":1610,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7157\",\n \"answer_count\": 1,\n \"body\": \"Android StudioでModuleが2つある場合の優先順位についてです。\\n\\n1つのプロジェクトにappというアプリケーションとhogeというライブラリが存在しています。 \\nappはbuild.gradleで`build.apply plugin: 'com.android.application'`宣言をしており \\nhogeはbuild.gradleで`build.apply plugin: 'com.android.library'`宣言しています。 \\napp、hogeともにjavaソース、res配下のvaluesやlayout、AndroidManifest.xmlを保持しています。\\n\\nProject Structureでappからhogeへの関連付けを行いappのコードでhogeを呼び出して実行していますが。 \\nappの`values` -> `string.xml`がhogeのstring.xmlで実行時に上書きされているようで \\n`string.xml`のapp_nameなどがhogeの値になっているので、 \\nappの`string.xml`を優先するにするにはどんな関連付けを行えばよいでしょうか?\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T10:48:39.540\",\n \"favorite_count\": 0,\n \"id\": \"7148\",\n \"last_activity_date\": \"2015-03-04T16:07:59.127\",\n \"last_edit_date\": \"2015-02-26T14:05:42.403\",\n \"last_editor_user_id\": \"7572\",\n \"owner_user_id\": \"356\",\n \"post_type\": \"question\",\n \"score\": 2,\n \"tags\": [\n \"android\",\n \"android-studio\",\n \"gradle\"\n ],\n \"title\": \"Androidでライブラリのstring.xmlが優先される問題\",\n \"view_count\": 1651\n}"},"answers":{"kind":"list like","value":[{"body":"Android Developers「[Managing Projects\nOverview](http://developer.android.com/tools/projects/index.html#LibraryProjects)」の抜粋です。\n\n> ### Resource conflicts\n>\n> Since the tools merge the resources of a library module with those of a\n> dependent application module, a given resource ID might be defined in both\n> modules. In this case, the tools select the resource from the application,\n> or the library with highest priority, and discard the other resource. As you\n> develop your applications, be aware that common resource IDs are likely to\n> be defined in more than one project and will be merged, with the resource\n> from the application or highest-priority library taking precedence.\n>\n> ### Use prefixes to avoid resource conflicts\n>\n> To avoid resource conflicts for common resource IDs, consider using a prefix\n> or other consistent naming scheme that is unique to the module (or is unique\n> across all project modules).\n\n要約すると、同じリソースIDがあると競合(ライブラリのものが優先される)するので気をつけましょう。モジュールごとに一貫性のあるプレフィクスを付ける等して衝突しないようにしたりする事も検討しましょう、とのこと。\n\n編集:認識違い・訳違いについてコメント頂いたので、原文段落を追加、要約に留めました。","comment_count":4,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T15:01:26.580","id":"7157","last_activity_date":"2015-03-04T16:07:59.127","last_edit_date":"2015-03-04T16:07:59.127","last_editor_user_id":"7572","owner_user_id":"7572","parent_id":"7148","post_type":"answer","score":5}],"string":"[\n {\n \"body\": \"Android Developers「[Managing Projects\\nOverview](http://developer.android.com/tools/projects/index.html#LibraryProjects)」の抜粋です。\\n\\n> ### Resource conflicts\\n>\\n> Since the tools merge the resources of a library module with those of a\\n> dependent application module, a given resource ID might be defined in both\\n> modules. In this case, the tools select the resource from the application,\\n> or the library with highest priority, and discard the other resource. As you\\n> develop your applications, be aware that common resource IDs are likely to\\n> be defined in more than one project and will be merged, with the resource\\n> from the application or highest-priority library taking precedence.\\n>\\n> ### Use prefixes to avoid resource conflicts\\n>\\n> To avoid resource conflicts for common resource IDs, consider using a prefix\\n> or other consistent naming scheme that is unique to the module (or is unique\\n> across all project modules).\\n\\n要約すると、同じリソースIDがあると競合(ライブラリのものが優先される)するので気をつけましょう。モジュールごとに一貫性のあるプレフィクスを付ける等して衝突しないようにしたりする事も検討しましょう、とのこと。\\n\\n編集:認識違い・訳違いについてコメント頂いたので、原文段落を追加、要約に留めました。\",\n \"comment_count\": 4,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T15:01:26.580\",\n \"id\": \"7157\",\n \"last_activity_date\": \"2015-03-04T16:07:59.127\",\n \"last_edit_date\": \"2015-03-04T16:07:59.127\",\n \"last_editor_user_id\": \"7572\",\n \"owner_user_id\": \"7572\",\n \"parent_id\": \"7148\",\n \"post_type\": \"answer\",\n \"score\": 5\n }\n]"},"id":{"kind":"string","value":"7148"},"accepted_answer_id":{"kind":"string","value":"7157"},"popular_answer_id":{"kind":"string","value":"7157"}}},{"rowIdx":1611,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7201\",\n \"answer_count\": 2,\n \"body\": \"お世話になります\\n\\niOS8でadmobの6はサポートされてないよってログに出てくるので、7にしようと思ってます。 \\nで、cocoapodsでインストールしてるのですが、 \\nHeader Search Pathにある、admobのパスには、admobのファイルはおらず \\n以下のエラーで困っております\\n\\n```\\n\\n 'GADBannerView.h' file not found\\n \\n```\\n\\nちなみに、現状はこちらです\\n\\n```\\n\\n {15-02-26 20:06}[ruby-2.1.0]server:~/Documents/NeoCafesagashi2015@master✗✗✗✗✗✗ shiratsu% open NeoCafesagashi2015.xcworkspace\\n {15-02-26 20:08}[ruby-2.1.0]server:~/Documents/NeoCafesagashi2015@master✗✗✗✗✗✗ shiratsu% ls Pods/Headers/Public\\n FMDB PonyDebugger SMCalloutView SocketRocket\\n {15-02-26 20:10}[ruby-2.1.0]server:~/Documents/NeoCafesagashi2015@master✗✗✗✗✗✗ shiratsu% cat Podfile\\n source 'https://github.com/CocoaPods/Specs.git'\\n \\n platform :ios, '7.0'\\n \\n pod 'Google-Mobile-Ads-SDK', '~> 7.0'\\n pod 'SMCalloutView'\\n pod 'PonyDebugger'\\n pod 'FMDB'\\n \\n```\\n\\nヘッダサーチパスは以下です\\n\\n```\\n\\n \\\"${PODS_ROOT}/Headers/Public/Google-Mobile-Ads-SDK\\\"\\n \\n```\\n\\nたしかにそんなとこには、ないので、直接、admobのファイルがある場所に向けたのですが、 \\n今度は、Admobが二重で定義されてると怒られ、もう何が何だかわからず。。。\\n\\n```\\n\\n import \\\"GADBannerView.h\\\"\\n \\n static const CGFloat CalloutYOffset = 10.0f;\\n static NSString * const urlKey = @\\\"url\\\";\\n \\n @interface ViewController ()\\n {\\n BOOL _pinclflag;\\n }\\n \\n```\\n\\nよろしくお願いします。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T11:20:58.487\",\n \"favorite_count\": 0,\n \"id\": \"7150\",\n \"last_activity_date\": \"2015-03-03T01:23:35.313\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"403\",\n \"post_type\": \"question\",\n \"score\": 1,\n \"tags\": [\n \"xcode\",\n \"xcode6\",\n \"ios8\",\n \"admob\"\n ],\n \"title\": \"iOSでAdmobを最新にしたらエラー\",\n \"view_count\": 1850\n}"},"answers":{"kind":"list like","value":[{"body":"おそらくframeworkへ変更されたことが原因ではないでしょうか? \n”Release Notes”にあるように7.0.0から”Released SDK as a\nframework.”へ変更されています。それに伴いCocoapodsで追加されるファイルもframeworkへ変更されています。\n\n```\n\n //#import \"GADBannerView.h\"\n #import \n \n```","comment_count":2,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T06:19:54.487","id":"7201","last_activity_date":"2015-02-27T06:19:54.487","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"4551","parent_id":"7150","post_type":"answer","score":2},{"body":"xcodeで`.h`ファイルを追加する必要があります。 \nGoogleMobileAds/GADBannerView.h","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-03-02T03:27:39.650","id":"7310","last_activity_date":"2015-03-03T01:23:35.313","last_edit_date":"2015-03-03T01:23:35.313","last_editor_user_id":"3313","owner_user_id":"8632","parent_id":"7150","post_type":"answer","score":-1}],"string":"[\n {\n \"body\": \"おそらくframeworkへ変更されたことが原因ではないでしょうか? \\n”Release Notes”にあるように7.0.0から”Released SDK as a\\nframework.”へ変更されています。それに伴いCocoapodsで追加されるファイルもframeworkへ変更されています。\\n\\n```\\n\\n //#import \\\"GADBannerView.h\\\"\\n #import \\n \\n```\",\n \"comment_count\": 2,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T06:19:54.487\",\n \"id\": \"7201\",\n \"last_activity_date\": \"2015-02-27T06:19:54.487\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"4551\",\n \"parent_id\": \"7150\",\n \"post_type\": \"answer\",\n \"score\": 2\n },\n {\n \"body\": \"xcodeで`.h`ファイルを追加する必要があります。 \\nGoogleMobileAds/GADBannerView.h\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-03-02T03:27:39.650\",\n \"id\": \"7310\",\n \"last_activity_date\": \"2015-03-03T01:23:35.313\",\n \"last_edit_date\": \"2015-03-03T01:23:35.313\",\n \"last_editor_user_id\": \"3313\",\n \"owner_user_id\": \"8632\",\n \"parent_id\": \"7150\",\n \"post_type\": \"answer\",\n \"score\": -1\n }\n]"},"id":{"kind":"string","value":"7150"},"accepted_answer_id":{"kind":"string","value":"7201"},"popular_answer_id":{"kind":"string","value":"7201"}}},{"rowIdx":1612,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7156\",\n \"answer_count\": 2,\n \"body\": \"Djangoでモデルを作るとき、\\n\\n```\\n\\n class UserCustom(models.Model):\\n hoge = models.AutoField(primary_key=True, help_text='hogeを入力して下さい', verbose_name=u'別名')\\n \\n```\\n\\nのようにすれば、別名をつけることが出来ます。\\n\\n```\\n\\n class UserCustom(models.Model):\\n hoge = models.AutoField(primary_key=True, help_text='hogeを入力して下さい', verbose_name=u'別名')\\n def custom_column(self):\\n return 'bar'\\n \\n```\\n\\nのようにcustom_columnを追加した時に、 \\ncustom_columnに別名を付けたいです。 \\n※このテクニックをカスタムカラムというのかわかりませんが、便宜上こう名づけました。\\n\\n情報が無いため試しにこれらを行ってみましたが、\\n\\n```\\n\\n def custom_column(self):\\n class Meta:\\n verbose_name = u'カスタムカラム'\\n \\n```\\n\\nや\\n\\n```\\n\\n def custom_column(self):\\n self.verbose_name = u'カスタムカラム'\\n \\n```\\n\\nダメでした。 \\nよろしくおねがいします。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T12:17:20.573\",\n \"favorite_count\": 0,\n \"id\": \"7151\",\n \"last_activity_date\": \"2015-04-01T04:49:55.200\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"7934\",\n \"post_type\": \"question\",\n \"score\": 0,\n \"tags\": [\n \"python\",\n \"sqlite\",\n \"django\"\n ],\n \"title\": \"Djangoでモデルのカスタムカラムに名前を付けたい\",\n \"view_count\": 1554\n}"},"answers":{"kind":"list like","value":[{"body":"`admin.py`の`admin.ModelAdmin`で定義するようです:\n\n```\n\n class UserCustomAdmin(admin.ModelAdmin):\n list_display = (..., 'custom_column',)\n \n def custom_column(self):\n return 'bar'\n \n```\n\n参照 \n","comment_count":4,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T14:56:39.123","id":"7156","last_activity_date":"2015-03-02T01:05:33.553","last_edit_date":"2017-05-23T12:38:56.467","last_editor_user_id":"-1","owner_user_id":"2314","parent_id":"7151","post_type":"answer","score":1},{"body":"`メソッド名.short_description`を定義すれば、管理サイトのカラムのタイトルが変更できます。\n\nmodels.py\n\n```\n\n class UserCustom(models.Model):\n ...\n def custom_column(self):\n return 'bar'\n custom_column.short_description = u'カスタムカラム'\n \n```\n\nadmin.py\n\n```\n\n list_display = ('custom_column', ... )\n \n```\n\n参考URL: [Django admin サイト](http://django-docs-\nja.readthedocs.org/en/latest/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display)","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-04-01T04:49:55.200","id":"8638","last_activity_date":"2015-04-01T04:49:55.200","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"9044","parent_id":"7151","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"`admin.py`の`admin.ModelAdmin`で定義するようです:\\n\\n```\\n\\n class UserCustomAdmin(admin.ModelAdmin):\\n list_display = (..., 'custom_column',)\\n \\n def custom_column(self):\\n return 'bar'\\n \\n```\\n\\n参照 \\n\",\n \"comment_count\": 4,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T14:56:39.123\",\n \"id\": \"7156\",\n \"last_activity_date\": \"2015-03-02T01:05:33.553\",\n \"last_edit_date\": \"2017-05-23T12:38:56.467\",\n \"last_editor_user_id\": \"-1\",\n \"owner_user_id\": \"2314\",\n \"parent_id\": \"7151\",\n \"post_type\": \"answer\",\n \"score\": 1\n },\n {\n \"body\": \"`メソッド名.short_description`を定義すれば、管理サイトのカラムのタイトルが変更できます。\\n\\nmodels.py\\n\\n```\\n\\n class UserCustom(models.Model):\\n ...\\n def custom_column(self):\\n return 'bar'\\n custom_column.short_description = u'カスタムカラム'\\n \\n```\\n\\nadmin.py\\n\\n```\\n\\n list_display = ('custom_column', ... )\\n \\n```\\n\\n参考URL: [Django admin サイト](http://django-docs-\\nja.readthedocs.org/en/latest/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display)\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-04-01T04:49:55.200\",\n \"id\": \"8638\",\n \"last_activity_date\": \"2015-04-01T04:49:55.200\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"9044\",\n \"parent_id\": \"7151\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7151"},"accepted_answer_id":{"kind":"string","value":"7156"},"popular_answer_id":{"kind":"string","value":"7156"}}},{"rowIdx":1613,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7164\",\n \"answer_count\": 1,\n \"body\": \"初心者です。RoRでチャットを作っています。下記のコードで走らせても思ったように動きません。どこに問題がありますか?\\n\\nユーザーの新規のpostを1秒ごとに取得して、render_to_stringした後で送信しています。クライアント側では、それをpostが表示される\\\"post-\\nlist\\\"にappendしています。しかし、ユーザーがpostを作成しても、作成は成功しますが、表示がされません。\\n\\n**chats.coffee**\\n\\n```\\n\\n $ ->\\n chat_id = $(\\\"chat_id\\\").text()\\n eventSource = new EventSource(chat_id+\\\"/stream\\\")\\n eventSource.addEventListener 'push', (event) ->\\n post = event.data\\n $('#post-list').append(post)\\n \\n```\\n\\n**chats.controller.rb**\\n\\n```\\n\\n include ActionController::Live\\n def stream\\n @chat = Chat.find(params[:id])\\n response.headers['Content-Type'] = 'text/event-stream'\\n start = Time.zone.now\\n loop do\\n Post.uncached do\\n Post.where('created_at > ?', start).where('chat_id = ?', @chat.id).each do |post|\\n html = render_to_string partial:'shared/_post.html.erb', object:post\\n response.stream.write(\\\"event:push\\\\n\\\")\\n response.stream.write(\\\"data:#{html}\\\\n\\\\n\\\")\\n start = post.created_at\\n end\\n end \\n sleep 1\\n end\\n rescue\\n ensure\\n response.stream.close\\n end\\n \\n```\\n\\nお願いします。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T12:59:26.813\",\n \"favorite_count\": 0,\n \"id\": \"7152\",\n \"last_activity_date\": \"2015-02-26T22:17:23.190\",\n \"last_edit_date\": \"2015-02-26T17:38:20.977\",\n \"last_editor_user_id\": null,\n \"owner_user_id\": null,\n \"post_type\": \"question\",\n \"score\": 2,\n \"tags\": [\n \"javascript\",\n \"ruby-on-rails\",\n \"coffeescript\"\n ],\n \"title\": \"ActionController::Liveとjavascriptがうまく働かない\",\n \"view_count\": 172\n}"},"answers":{"kind":"list like","value":[{"body":"`ActionController::Live`は使ったことがないのですが、「ActionController::Live render\nrender_to_string」というキーワードでネットを検索したところ、`render_to_string`がそのままでは使えないのでモンキーパッチを当てた、という記事がありました。\n\n\n\n\n\n```\n\n # モンキーパッチのコード\n def render_to_string(*)\n orig_stream = response.stream\n super\n ensure\n if orig_stream\n response.instance_variable_set(:@stream, orig_stream)\n end\n end\n \n```\n\nただ、ちょっと情報が古いので最新のRailsではどうなっているのかよくわからないのと、以下のように「結局JS側はうまく動かない」という情報もあったりします。\n\n\n\nですが、いずれにせよ「作成は成功しますが、表示がされません」だけだと回答する側も原因を予測しづらいです。 \nなのでChrome\nデベロッパーツールの「ネットワーク」タブやJavaScriptのデバッグ実行などを使って、正常な実行を妨げている箇所を絞り込んだ後に、その情報と一緒に質問を投げるのがベターだと思います。\n\nデベロッパーツールに関する参考情報: \n\nちなみにコントローラーのコードで\n\n```\n\n rescue\n ensure\n response.stream.close\n \n```\n\nと書いていますが、`rescue`する場合は「発生が予想されるエラーのみ」に絞り込んでおいた方が良いです。\n\n```\n\n # See http://tenderlovemaking.com/2012/07/30/is-it-live.html\n rescue IOError\n # When the client disconnects, we'll get an IOError on write\n ensure\n response.stream.close\n \n```\n\n現状のコードだとあらゆるエラーを握りつぶしてしまうので、問題が起きていても気づけなくなります。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T22:06:41.810","id":"7164","last_activity_date":"2015-02-26T22:17:23.190","last_edit_date":"2017-05-23T12:38:55.250","last_editor_user_id":"-1","owner_user_id":"85","parent_id":"7152","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"`ActionController::Live`は使ったことがないのですが、「ActionController::Live render\\nrender_to_string」というキーワードでネットを検索したところ、`render_to_string`がそのままでは使えないのでモンキーパッチを当てた、という記事がありました。\\n\\n\\n\\n\\n\\n```\\n\\n # モンキーパッチのコード\\n def render_to_string(*)\\n orig_stream = response.stream\\n super\\n ensure\\n if orig_stream\\n response.instance_variable_set(:@stream, orig_stream)\\n end\\n end\\n \\n```\\n\\nただ、ちょっと情報が古いので最新のRailsではどうなっているのかよくわからないのと、以下のように「結局JS側はうまく動かない」という情報もあったりします。\\n\\n\\n\\nですが、いずれにせよ「作成は成功しますが、表示がされません」だけだと回答する側も原因を予測しづらいです。 \\nなのでChrome\\nデベロッパーツールの「ネットワーク」タブやJavaScriptのデバッグ実行などを使って、正常な実行を妨げている箇所を絞り込んだ後に、その情報と一緒に質問を投げるのがベターだと思います。\\n\\nデベロッパーツールに関する参考情報: \\n\\nちなみにコントローラーのコードで\\n\\n```\\n\\n rescue\\n ensure\\n response.stream.close\\n \\n```\\n\\nと書いていますが、`rescue`する場合は「発生が予想されるエラーのみ」に絞り込んでおいた方が良いです。\\n\\n```\\n\\n # See http://tenderlovemaking.com/2012/07/30/is-it-live.html\\n rescue IOError\\n # When the client disconnects, we'll get an IOError on write\\n ensure\\n response.stream.close\\n \\n```\\n\\n現状のコードだとあらゆるエラーを握りつぶしてしまうので、問題が起きていても気づけなくなります。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T22:06:41.810\",\n \"id\": \"7164\",\n \"last_activity_date\": \"2015-02-26T22:17:23.190\",\n \"last_edit_date\": \"2017-05-23T12:38:55.250\",\n \"last_editor_user_id\": \"-1\",\n \"owner_user_id\": \"85\",\n \"parent_id\": \"7152\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7152"},"accepted_answer_id":{"kind":"string","value":"7164"},"popular_answer_id":{"kind":"string","value":"7164"}}},{"rowIdx":1614,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 1,\n \"body\": \"あるファイルを、\\n\\n```\\n\\n git rm --cached text.php\\n \\n```\\n\\nとしてステージから削除したあとに、\\n\\n```\\n\\n git add -A\\n \\n```\\n\\nとして、\\n\\n```\\n\\n git diff \\n \\n```\\n\\nとすると、\\n\\n```\\n\\n old mode 100644\\n new mode 100755\\n \\n```\\n\\nと出てきました。色々ぐぐって\\n\\n```\\n\\n [core]\\n filemode = false\\n \\n```\\n\\nをconfigに追加すればパーミッションの変更が無視されて対処できることはわかったのですが、根本的な理由がわからず下記2つについて教えてほしいです。\\n\\n①なぜステージから削除→再度ステージにupをするとパーミッションが変わるのか \\n②パーミッションが644→755に変わったと表示されているのにファイル自体を`ls -l`でみてみると、パーミッションが`-rw-r--\\nr--`になっており、755になっていない \\n③git diffで\\n\\n```\\n\\n old mode 100644\\n new mode 100755\\n \\n```\\n\\nと出てしまっているものを削除したい\\n\\nどうぞよろしくお願い致します。\\n\\n[環境] \\nゲストマシン:centOS6.6をvagrantで実行。 \\nホストマシン:macOS \\nで、vagrantの中身をmacOSから(vagrant sshせずに)phpstormをつかっていじっている、という環境です。\",\n \"comment_count\": 2,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T14:55:58.103\",\n \"favorite_count\": 0,\n \"id\": \"7155\",\n \"last_activity_date\": \"2015-07-22T16:13:51.287\",\n \"last_edit_date\": \"2015-02-27T06:39:26.477\",\n \"last_editor_user_id\": \"288\",\n \"owner_user_id\": \"288\",\n \"post_type\": \"question\",\n \"score\": 10,\n \"tags\": [\n \"git\"\n ],\n \"title\": \"git rm --cached 後に git add -Aするとファイルのパーミッションが変わる\",\n \"view_count\": 1372\n}"},"answers":{"kind":"list like","value":[{"body":"自分も同じ現象を経験し、同じ方法で解決しました。 \n結局のところ、 \nWindowsから参照・変更・作成したファイルと、 \nLinuxから参照・変更・作成したファイルのパーミッションが違うから、 \nWindowsエディタで作成したファイルをコミットしてあったらリポジトリもそのパーミッションになるし、 \nLinuxで作成したファイルをコミットしてあったら(略\n\nということではないでしょうか。 \nlocalでcygwinでgitをいじっているということであれば、 \nwindowsで編集したファイルは644になって、cygwinでコミットした時に755になる \ncygwinでcloneして、windowsで見るとwindows標準パーミッションと異なっているので> が付く。 \nwindowsでコミットしてcygwinでgit commit -aすればfile modeが変更される \nということですね。\n\nうまく説明できなくてすみません。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-03-24T08:45:40.890","id":"8326","last_activity_date":"2015-03-24T08:45:40.890","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"8396","parent_id":"7155","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"自分も同じ現象を経験し、同じ方法で解決しました。 \\n結局のところ、 \\nWindowsから参照・変更・作成したファイルと、 \\nLinuxから参照・変更・作成したファイルのパーミッションが違うから、 \\nWindowsエディタで作成したファイルをコミットしてあったらリポジトリもそのパーミッションになるし、 \\nLinuxで作成したファイルをコミットしてあったら(略\\n\\nということではないでしょうか。 \\nlocalでcygwinでgitをいじっているということであれば、 \\nwindowsで編集したファイルは644になって、cygwinでコミットした時に755になる \\ncygwinでcloneして、windowsで見るとwindows標準パーミッションと異なっているので> が付く。 \\nwindowsでコミットしてcygwinでgit commit -aすればfile modeが変更される \\nということですね。\\n\\nうまく説明できなくてすみません。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-03-24T08:45:40.890\",\n \"id\": \"8326\",\n \"last_activity_date\": \"2015-03-24T08:45:40.890\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8396\",\n \"parent_id\": \"7155\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"7155"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"8326"}}},{"rowIdx":1615,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7245\",\n \"answer_count\": 3,\n \"body\": \"以下のコードはコンパイルし,動作します.(Wandboxのg++ 4.9.2,clang 3.5.0にて確認,以下同じ)\\n\\n```\\n\\n #include \\n int main(){\\n auto p = new int const(0);\\n delete p;\\n }\\n \\n```\\n\\nしかし,delete p;を::operator\\ndelete(p);で置き換えた場合にはコンパイルエラーが発生してしまいます.(g++での例,clangでもコンパイルエラー)\\n\\n```\\n\\n prog.cc: In function 'int main()': \\n prog.cc:4:24: error: invalid conversion from 'const void*' to 'void*' [-fpermissive] \\n ::operator delete(p);\\n \\n```\\n\\n確かにconstなオブジェクトへのポインタは非constなオブジェクトへのポインタには変換できませんし,operator\\ndeleteが非constなオブジェクトへのポインタを要求するのは理解できるのですが,ではなぜ最初のdelete式がコンパイル可能であるのかが分かりません.\\n\\nN3797の§5.3.5.7より,\\n\\n> Otherwise, the delete-expression will not call a deallocation function\\n> (3.7.4.2).\\n\\nとあるので,`operator delete`の呼び出しが省略されたのかと考えましたが,以下のコードを実行してみたところ,`op\\ndelete`が出力されました.(bは無関係なオブジェクトでの呼び出しを避けるために使用しています)\\n\\n```\\n\\n #include \\n #include \\n \\n bool b = false;\\n void operator delete(void*) noexcept{\\n if(b){\\n std::cout << \\\"op delete\\\" << std::endl;\\n }\\n }\\n \\n int main(){\\n b = true;\\n auto p = new int const(0);\\n delete p;\\n b = false;\\n }\\n \\n```\\n\\nこの結果はどのように解釈すれば良いのでしょうか.\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T15:15:10.817\",\n \"favorite_count\": 0,\n \"id\": \"7158\",\n \"last_activity_date\": \"2015-02-28T07:10:07.533\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8573\",\n \"post_type\": \"question\",\n \"score\": 12,\n \"tags\": [\n \"c++\"\n ],\n \"title\": \"constなオブジェクトへのポインタをdeleteしたときの挙動\",\n \"view_count\": 2146\n}"},"answers":{"kind":"list like","value":[{"body":"まず,`delete-expression` は const ポインタを渡すことができますが,(§5.3.5.2 の Note) `::operator\ndelete` の直接の呼び出しは delete-expression ではなく,単なる関数呼び出しなので,引数のポインタがそのまま渡され const\nポインタを渡すことができません. \n具体的には,`delete-expression`である delete はデストラクタの呼び出し後にオーバーロードを考慮した operator delete\nの呼び出しを行いますが, ::operator delete の直接の呼び出しではデストラクタが呼び出されず,引数のポインタがそのまま渡されます.","comment_count":4,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-26T17:39:40.547","id":"7162","last_activity_date":"2015-02-26T17:39:40.547","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"8577","parent_id":"7158","post_type":"answer","score":2},{"body":"ISO/IEC 14882:1998 によれば\n\n5.3.5 delete \n5.3.5-2 Note に const つき型へのポインタを渡してよい constness をキャストで除去する必要は無いとあります。\n\n12.1 constructor, 12.4 destructor にも \n12.1-4 constructor は const, volatile, const volatile オブジェクトに対して呼べる \nconstructor が完了するまで const/volatile-ness は適用されない \n12.4-2 destructor は const, volatile, const volatile オブジェクトに対して呼べる \ndestructor が開始した時点で const/volatile-ness は適用されなくなる \nとあります。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T05:28:04.847","id":"7195","last_activity_date":"2015-02-27T05:28:04.847","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"8586","parent_id":"7158","post_type":"answer","score":3},{"body":"同じく ISO/IEC 14882:1998 より \n5.3.5 delete \n1 delete-式 は最派生オブジェクトの解体であり \n6 削除されるオブジェクトにデストラクタがあれば呼びだす \nなので\n\n> オブジェクトのdestructionであると解釈すれば\n\n「解釈すれば」は要らないでしょう。\n\nまた 12.4 destructors に \n「解体されるオブジェクトの占めている記憶域を解放する」系の文言は一切ありません。\n\n一方で 3.7.3.2 operator delete はその名 [ 解放関数 ] のとおり \n- デストラクタを起動するとは書かれていない \n- 記憶域を解放する (義務がある) と書かれている\n\n一般的実装としては operator delete が直ちに OS 等に直接資源を返すとは考えにくく \nいわゆる free-store (に類する何か) に「未使用」マークを付けるだけ、が多いでしょう。 \nなので operator delete に const T* を渡すことには意味が無いと解釈すべきでしょう。 \nconst だと「未使用」マークを付ける操作すらできないので。\n\nだから一般的 C++ 実装としては \ndelete-expression に const/volatile T* が渡されたときの処理系の挙動は \n1. cv 修飾を除去する \n2. デストラクタを呼ぶ (cv 修飾除去後の型で) \n3. 最適解放関数を呼ぶ (cv 修飾除去後の型で) \nとなるものと思われます。\n\n蛇足 \npandaman 氏は当然わかっていて故意に書かれているのでしょうが第三者読者のために追記しておくと \n提示サンプルの1 \n- new-式 + delete-式の組み合わせ=正しい \n- new-式 + operator delete の組み合わせ=デストラクタが呼ばれないので正しくない\n\n提示サンプルの2 \n- operator new は処理系提供のもので operator delete は自作=記憶域は正しく解放されていない \nすなわちメモリリークしている(デストラクタは呼ばれている)\n\nことだけ注意喚起しておきます。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-28T07:10:07.533","id":"7245","last_activity_date":"2015-02-28T07:10:07.533","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"8589","parent_id":"7158","post_type":"answer","score":6}],"string":"[\n {\n \"body\": \"まず,`delete-expression` は const ポインタを渡すことができますが,(§5.3.5.2 の Note) `::operator\\ndelete` の直接の呼び出しは delete-expression ではなく,単なる関数呼び出しなので,引数のポインタがそのまま渡され const\\nポインタを渡すことができません. \\n具体的には,`delete-expression`である delete はデストラクタの呼び出し後にオーバーロードを考慮した operator delete\\nの呼び出しを行いますが, ::operator delete の直接の呼び出しではデストラクタが呼び出されず,引数のポインタがそのまま渡されます.\",\n \"comment_count\": 4,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T17:39:40.547\",\n \"id\": \"7162\",\n \"last_activity_date\": \"2015-02-26T17:39:40.547\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8577\",\n \"parent_id\": \"7158\",\n \"post_type\": \"answer\",\n \"score\": 2\n },\n {\n \"body\": \"ISO/IEC 14882:1998 によれば\\n\\n5.3.5 delete \\n5.3.5-2 Note に const つき型へのポインタを渡してよい constness をキャストで除去する必要は無いとあります。\\n\\n12.1 constructor, 12.4 destructor にも \\n12.1-4 constructor は const, volatile, const volatile オブジェクトに対して呼べる \\nconstructor が完了するまで const/volatile-ness は適用されない \\n12.4-2 destructor は const, volatile, const volatile オブジェクトに対して呼べる \\ndestructor が開始した時点で const/volatile-ness は適用されなくなる \\nとあります。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T05:28:04.847\",\n \"id\": \"7195\",\n \"last_activity_date\": \"2015-02-27T05:28:04.847\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8586\",\n \"parent_id\": \"7158\",\n \"post_type\": \"answer\",\n \"score\": 3\n },\n {\n \"body\": \"同じく ISO/IEC 14882:1998 より \\n5.3.5 delete \\n1 delete-式 は最派生オブジェクトの解体であり \\n6 削除されるオブジェクトにデストラクタがあれば呼びだす \\nなので\\n\\n> オブジェクトのdestructionであると解釈すれば\\n\\n「解釈すれば」は要らないでしょう。\\n\\nまた 12.4 destructors に \\n「解体されるオブジェクトの占めている記憶域を解放する」系の文言は一切ありません。\\n\\n一方で 3.7.3.2 operator delete はその名 [ 解放関数 ] のとおり \\n- デストラクタを起動するとは書かれていない \\n- 記憶域を解放する (義務がある) と書かれている\\n\\n一般的実装としては operator delete が直ちに OS 等に直接資源を返すとは考えにくく \\nいわゆる free-store (に類する何か) に「未使用」マークを付けるだけ、が多いでしょう。 \\nなので operator delete に const T* を渡すことには意味が無いと解釈すべきでしょう。 \\nconst だと「未使用」マークを付ける操作すらできないので。\\n\\nだから一般的 C++ 実装としては \\ndelete-expression に const/volatile T* が渡されたときの処理系の挙動は \\n1. cv 修飾を除去する \\n2. デストラクタを呼ぶ (cv 修飾除去後の型で) \\n3. 最適解放関数を呼ぶ (cv 修飾除去後の型で) \\nとなるものと思われます。\\n\\n蛇足 \\npandaman 氏は当然わかっていて故意に書かれているのでしょうが第三者読者のために追記しておくと \\n提示サンプルの1 \\n- new-式 + delete-式の組み合わせ=正しい \\n- new-式 + operator delete の組み合わせ=デストラクタが呼ばれないので正しくない\\n\\n提示サンプルの2 \\n- operator new は処理系提供のもので operator delete は自作=記憶域は正しく解放されていない \\nすなわちメモリリークしている(デストラクタは呼ばれている)\\n\\nことだけ注意喚起しておきます。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-28T07:10:07.533\",\n \"id\": \"7245\",\n \"last_activity_date\": \"2015-02-28T07:10:07.533\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8589\",\n \"parent_id\": \"7158\",\n \"post_type\": \"answer\",\n \"score\": 6\n }\n]"},"id":{"kind":"string","value":"7158"},"accepted_answer_id":{"kind":"string","value":"7245"},"popular_answer_id":{"kind":"string","value":"7245"}}},{"rowIdx":1616,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 1,\n \"body\": \"SwiftでMBaaSであるParseを使ってTextFieldに入力した文字をTableViewに表示するプログラムを作っているのですが、TableViewを引っ張って更新する部分がうまく行きません。\\n\\n```\\n\\n override func viewDidLoad() {\\n super.viewDidLoad()\\n \\n //parseからデータ取得\\n self.loadData()\\n // DataSourceの設定をする.\\n tableView.dataSource = self\\n \\n // Delegateを設定する.\\n tableView.delegate = self\\n \\n //引っ張って更新\\n self.pullrefresh()\\n \\n }\\n \\n //parseからデータ取得\\n func loadData() {\\n var query:PFQuery = PFQuery(className: \\\"Comment\\\")\\n query.orderByDescending(\\\"createdAt\\\")\\n query.findObjectsInBackgroundWithBlock{(objects: [AnyObject]!, error: NSError!) -> Void in\\n if (error != nil){\\n //error処理\\n }\\n \\n //PFObjectのcommentsにparseのデータを収納\\n for object in objects {\\n self.comments.addObject(object)\\n }\\n self.tableView.reloadData()\\n }\\n \\n }\\n \\n //引っ張って更新関数\\n func pullrefresh(){\\n self.refreshControl = UIRefreshControl()\\n self.refreshControl.attributedTitle = NSAttributedString(string: \\\"↓引っ張る\\\")\\n self.refreshControl.addTarget(self, action: \\\"refresh:\\\", forControlEvents: UIControlEvents.ValueChanged)\\n self.tableView.addSubview(refreshControl)\\n }\\n //更新のデータ取得方法\\n func refresh(sender:AnyObject)\\n {\\n self.loadData()\\n //refreshを終える\\n self.refreshControl.endRefreshing()\\n }\\n \\n```\\n\\nこういうプログラムを書いたのですが、引っ張って更新すると、同じ内容がダブって表示されます。 \\nもう画面に表示されているテキストはダブらずに表示されていないものだけ更新するにはどうすればいいでしょうか? \\n回答よろしくお願いします。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T16:37:29.967\",\n \"favorite_count\": 0,\n \"id\": \"7161\",\n \"last_activity_date\": \"2015-07-28T03:32:36.780\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8576\",\n \"post_type\": \"question\",\n \"score\": 4,\n \"tags\": [\n \"ios\",\n \"swift\",\n \"xcode\",\n \"parse.com\"\n ],\n \"title\": \"SwiftでParse.comを使用しているのですが、TableViewの更新が上手くいきません\",\n \"view_count\": 517\n}"},"answers":{"kind":"list like","value":[{"body":"Parseは利用したことがないのですが、気付いたことを書きます。\n\nPFQueryで特に絞り込みがなされていないようなので、query.findObjectsInBackgroundWithBlockで毎回全件取得していますよね。それを既にデータが入っているself.commentsに追加しているので、重複して追加されているようです。\n\nですので可能であればPFQueryで日付で絞り込むか、それができなければself.commentsを取得した配列で置き換える\n\n```\n\n self.comments = objects\n \n```\n\nようにすれば良いと思います。\n\nそれからquery.findObjectsInBackgroundWithBlockはバックグラウンドで処理されるようですが、コールバックはどのスレッドで呼ばれるのでしょうか?メインスレッドなど常に特定のスレッドで呼ばれるのでしたらよいのですが、もしそうでなければ同時実行障害が発生する可能性があるように思います。それとtableView.reloadDataはメインスレッドで実行する必要があります。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T23:08:12.967","id":"7239","last_activity_date":"2015-02-27T23:08:12.967","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"238","parent_id":"7161","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"Parseは利用したことがないのですが、気付いたことを書きます。\\n\\nPFQueryで特に絞り込みがなされていないようなので、query.findObjectsInBackgroundWithBlockで毎回全件取得していますよね。それを既にデータが入っているself.commentsに追加しているので、重複して追加されているようです。\\n\\nですので可能であればPFQueryで日付で絞り込むか、それができなければself.commentsを取得した配列で置き換える\\n\\n```\\n\\n self.comments = objects\\n \\n```\\n\\nようにすれば良いと思います。\\n\\nそれからquery.findObjectsInBackgroundWithBlockはバックグラウンドで処理されるようですが、コールバックはどのスレッドで呼ばれるのでしょうか?メインスレッドなど常に特定のスレッドで呼ばれるのでしたらよいのですが、もしそうでなければ同時実行障害が発生する可能性があるように思います。それとtableView.reloadDataはメインスレッドで実行する必要があります。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T23:08:12.967\",\n \"id\": \"7239\",\n \"last_activity_date\": \"2015-02-27T23:08:12.967\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"238\",\n \"parent_id\": \"7161\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7161"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"7239"}}},{"rowIdx":1617,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7240\",\n \"answer_count\": 1,\n \"body\": \"お世話になります。 \\nSymfony2を勉強中です。全コントローラー(同じバンドル内)に共通で読み込ませるクラスはどんな手順で組み込むのでしょうか。\\n\\n```\\n\\n use bar\\\\fooBundle\\\\hogehoge;\\n \\n```\\n\\nこんなようにuseを使ってすべてのコントローラーの頭で読み込ませるのは何かしら合理的ではないような気がしております。 \\nパスワードの暗号化や時間の比較、オブジェクトのキャストなどなど、汎用的に使う関数があるかと思うのですが、皆様はどのような形で実装しているのでしょうか。 \\nよろしくお願いします。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-26T17:51:36.190\",\n \"favorite_count\": 0,\n \"id\": \"7163\",\n \"last_activity_date\": \"2015-02-28T00:29:27.190\",\n \"last_edit_date\": \"2015-02-26T21:23:31.057\",\n \"last_editor_user_id\": \"7926\",\n \"owner_user_id\": \"7154\",\n \"post_type\": \"question\",\n \"score\": 3,\n \"tags\": [\n \"php\",\n \"symfony2\"\n ],\n \"title\": \"Symfony2で汎用的なクラスを作成する\",\n \"view_count\": 1180\n}"},"answers":{"kind":"list like","value":[{"body":"普通にOOPのアプローチが使えますので、例えばコントローラであればプロジェクト用のベースクラスを作り、そこにユーティリティメソッドを実装する方法があります。Standard\nEditionの標準のコントローラの場合はFrameworkBundleのControllerクラスを継承していますから、この継承階層の間に1つ、プロジェクト用のコントローラを挟む形になります。\n\n```\n\n // src/AppBundle/Controller/BaseController.php\n use Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller;\n \n /**\n * プロジェクト用ベースコントローラ\n */\n class BaseController extends Controller\n {\n /**\n * ユーティリティメソッド\n */\n public function someUtilityMethod($foo)\n {\n ...\n \n // src/AppBundle/Controller/FooController.php\n /**\n * 個々のコントローラ\n */\n class FooController extends BaseController\n {\n public function indexAction($bar)\n {\n // ベースクラスのユーティリティメソッド呼び出し\n $this->someUtilityMethod($bar);\n \n```\n\n注意点としまして、このアプローチだと手軽さのために、あらゆるものをBaseControllerに実装しがちになり、そこがウィークポイントになってしまいます。機能はできるだけ別のクラスにサービスとして実装し、利用するコントローラ側で明示的に取得するようにしておく方が、後々の管理等しやすいです。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-28T00:29:27.190","id":"7240","last_activity_date":"2015-02-28T00:29:27.190","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"5444","parent_id":"7163","post_type":"answer","score":4}],"string":"[\n {\n \"body\": \"普通にOOPのアプローチが使えますので、例えばコントローラであればプロジェクト用のベースクラスを作り、そこにユーティリティメソッドを実装する方法があります。Standard\\nEditionの標準のコントローラの場合はFrameworkBundleのControllerクラスを継承していますから、この継承階層の間に1つ、プロジェクト用のコントローラを挟む形になります。\\n\\n```\\n\\n // src/AppBundle/Controller/BaseController.php\\n use Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller;\\n \\n /**\\n * プロジェクト用ベースコントローラ\\n */\\n class BaseController extends Controller\\n {\\n /**\\n * ユーティリティメソッド\\n */\\n public function someUtilityMethod($foo)\\n {\\n ...\\n \\n // src/AppBundle/Controller/FooController.php\\n /**\\n * 個々のコントローラ\\n */\\n class FooController extends BaseController\\n {\\n public function indexAction($bar)\\n {\\n // ベースクラスのユーティリティメソッド呼び出し\\n $this->someUtilityMethod($bar);\\n \\n```\\n\\n注意点としまして、このアプローチだと手軽さのために、あらゆるものをBaseControllerに実装しがちになり、そこがウィークポイントになってしまいます。機能はできるだけ別のクラスにサービスとして実装し、利用するコントローラ側で明示的に取得するようにしておく方が、後々の管理等しやすいです。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-28T00:29:27.190\",\n \"id\": \"7240\",\n \"last_activity_date\": \"2015-02-28T00:29:27.190\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"5444\",\n \"parent_id\": \"7163\",\n \"post_type\": \"answer\",\n \"score\": 4\n }\n]"},"id":{"kind":"string","value":"7163"},"accepted_answer_id":{"kind":"string","value":"7240"},"popular_answer_id":{"kind":"string","value":"7240"}}},{"rowIdx":1618,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 1,\n \"body\": \"MediaPlayerを使って動画を再生したときに以下の例外が発生します。\\n\\n```\\n\\n E/MediaPlayer(18065): Unable to create media player\\n E/DEBUG(18065): Error\\n E/DEBUG(18065): java.io.IOException: setDataSourceFD failed.: status=0x80000000\\n \\n```\\n\\n以下を実行しています。\\n\\n```\\n\\n FileInputStream is = null;\\n try {\\n is = new FileInputStream(mPath);\\n mMediaPlayer.setDataSource(is.getFD());\\n } finally {\\n try {\\n if (is != null)\\n is.close();\\n } catch (Exception e) {}\\n }\\n \\n```\\n\\nNexus 5(Android4.4.3)で例外が発生します。特定の機種でエラーになるみたいで、他の機種では例外が発生しません。\\n\\nアドバイスをよろしくお願い致します。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T00:57:16.047\",\n \"favorite_count\": 0,\n \"id\": \"7165\",\n \"last_activity_date\": \"2015-11-24T18:14:45.290\",\n \"last_edit_date\": \"2015-02-27T03:59:24.583\",\n \"last_editor_user_id\": \"7926\",\n \"owner_user_id\": \"7212\",\n \"post_type\": \"question\",\n \"score\": 4,\n \"tags\": [\n \"android\",\n \"java\",\n \"android-mediaplayer\"\n ],\n \"title\": \"MediaPlayerで動画再生するとエラーが発生します\",\n \"view_count\": 1084\n}"},"answers":{"kind":"list like","value":[{"body":"自己レスです。ffmpegで音声と動画を結合した動画が再生できなかったのですが、音声のコーデック形式を mp3 から aac に変更したら再生されました。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T06:43:20.417","id":"7205","last_activity_date":"2015-02-27T06:43:20.417","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"7212","parent_id":"7165","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"自己レスです。ffmpegで音声と動画を結合した動画が再生できなかったのですが、音声のコーデック形式を mp3 から aac に変更したら再生されました。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T06:43:20.417\",\n \"id\": \"7205\",\n \"last_activity_date\": \"2015-02-27T06:43:20.417\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"7212\",\n \"parent_id\": \"7165\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7165"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"7205"}}},{"rowIdx":1619,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7190\",\n \"answer_count\": 1,\n \"body\": \"```\\n\\n var React = require('react');\\n module.exports = React.createClass({\\n renderActually: function() {\\n return

hoge

; \\n },\\n render: function() {\\n return {this.renderActually()};\\n }\\n });\\n \\n```\\n\\nのような`JSX`ファイルを利用しようとすると、コンパイル時にエラーが出ます。 \\n代わりに\\n\\n```\\n\\n render: function() {\\n return

hoge

;\\n }\\n \\n```\\n\\nあるいは\\n\\n```\\n\\n render: function() {\\n return
{this.renderActually()}
;\\n }\\n \\n```\\n\\nとすれば正常にコンパイルされて動作します。最初のコードでエラーが起こるのは`JSX`のどういった仕様あるいは制限によるものでしょうか。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T01:14:32.377\",\n \"favorite_count\": 0,\n \"id\": \"7166\",\n \"last_activity_date\": \"2015-02-27T04:47:31.020\",\n \"last_edit_date\": \"2015-02-27T02:55:12.223\",\n \"last_editor_user_id\": \"3313\",\n \"owner_user_id\": \"3313\",\n \"post_type\": \"question\",\n \"score\": 0,\n \"tags\": [\n \"reactjs\",\n \"react-jsx\"\n ],\n \"title\": \"JSXのrender()で別の関数の戻り値だけを出力することができない理由を知りたい\",\n \"view_count\": 841\n}"},"answers":{"kind":"list like","value":[{"body":"自己解決しました。 \nコードが評価される順序を気にする必要があります。\n\n```\n\n renderActually: function() {\n return

hoge

;\n },\n render: function() {\n return {this.renderActually()};\n }\n \n```\n\nは、コンパイル後\n\n```\n\n renderActually: function() {\n return React.createElement(\"p\", null, \"hoge\");\n },\n render: function() {\n return React.createElement(\"span\", null, this.renderActually());\n }\n \n```\n\nとなります。\n\n * コンパイル時に`this.renderActually()`は評価されない\n * `React.createElement`に置換される際の第1引数としてHTMLタグが必要\n\n上記の代わりに\n\n```\n\n render: function() {\n return this.renderActually();\n }\n \n```\n\nとした場合は、コンパイル後もコードは変更されませんでした。\n\n* * *\n\n実際は\n\n```\n\n render: function() {\n // arr は適当な配列\n return (\n { arr.map(function(elem) {\n return {this.anotherMethod(elem)};\n }.bind(this))\n }\n );\n }\n \n```\n\nのような事をしたくて遭遇していたエラーだったのですが \nそもそも使い方を間違えている(`{}`内で評価する必要がない)ということがわかりました。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T04:40:51.980","id":"7190","last_activity_date":"2015-02-27T04:47:31.020","last_edit_date":"2015-02-27T04:47:31.020","last_editor_user_id":"3313","owner_user_id":"3313","parent_id":"7166","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"自己解決しました。 \\nコードが評価される順序を気にする必要があります。\\n\\n```\\n\\n renderActually: function() {\\n return

hoge

;\\n },\\n render: function() {\\n return {this.renderActually()};\\n }\\n \\n```\\n\\nは、コンパイル後\\n\\n```\\n\\n renderActually: function() {\\n return React.createElement(\\\"p\\\", null, \\\"hoge\\\");\\n },\\n render: function() {\\n return React.createElement(\\\"span\\\", null, this.renderActually());\\n }\\n \\n```\\n\\nとなります。\\n\\n * コンパイル時に`this.renderActually()`は評価されない\\n * `React.createElement`に置換される際の第1引数としてHTMLタグが必要\\n\\n上記の代わりに\\n\\n```\\n\\n render: function() {\\n return this.renderActually();\\n }\\n \\n```\\n\\nとした場合は、コンパイル後もコードは変更されませんでした。\\n\\n* * *\\n\\n実際は\\n\\n```\\n\\n render: function() {\\n // arr は適当な配列\\n return (\\n { arr.map(function(elem) {\\n return {this.anotherMethod(elem)};\\n }.bind(this))\\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-27T04:40:51.980\",\n \"id\": \"7190\",\n \"last_activity_date\": \"2015-02-27T04:47:31.020\",\n \"last_edit_date\": \"2015-02-27T04:47:31.020\",\n \"last_editor_user_id\": \"3313\",\n \"owner_user_id\": \"3313\",\n \"parent_id\": \"7166\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7166"},"accepted_answer_id":{"kind":"string","value":"7190"},"popular_answer_id":{"kind":"string","value":"7190"}}},{"rowIdx":1620,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7170\",\n \"answer_count\": 2,\n \"body\": \"NSSetで \\nNSSet(objects: \\\"aaa\\\", \\\"bbb\\\", \\\"ccc\\\") \\nとセットしたく、ただし列挙部分は動的に生成したい場合、 \\nswiftではどのように列挙部分を生成すればよろしいのでしょうか。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T01:46:22.540\",\n \"favorite_count\": 0,\n \"id\": \"7168\",\n \"last_activity_date\": \"2015-02-27T02:45:48.510\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"7352\",\n \"post_type\": \"question\",\n \"score\": 0,\n \"tags\": [\n \"ios\",\n \"swift\"\n ],\n \"title\": \"NSSetで動的に複数セットしたい\",\n \"view_count\": 304\n}"},"answers":{"kind":"list like","value":[{"body":"以下でどうでしょうか?\n\n```\n\n // NSSet を作る際に array を使用して、その引数を動的に変更する方法\n var mary = [\"aaa\", \"bbb\"]\n mary.append(\"ccc\")\n var set = NSSet(array:mary)\n \n // NSMutableSet を使用して、動的に追加する方法\n var mset = NSMutableSet(objects:\"aaa\", \"bbb\")\n mset.addObject(\"ccc\")\n \n```","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T01:55:56.237","id":"7170","last_activity_date":"2015-02-27T01:55:56.237","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"5106","parent_id":"7168","post_type":"answer","score":1},{"body":"補足ですが、Swift1.2からはSwift用Setが使えますので、状況が許せば、以下のようにもかけます。\n\n```\n\n var set = Set()\n set.insert(\"aaa\")\n \n```","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T02:45:48.510","id":"7178","last_activity_date":"2015-02-27T02:45:48.510","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"7368","parent_id":"7168","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"以下でどうでしょうか?\\n\\n```\\n\\n // NSSet を作る際に array を使用して、その引数を動的に変更する方法\\n var mary = [\\\"aaa\\\", \\\"bbb\\\"]\\n mary.append(\\\"ccc\\\")\\n var set = NSSet(array:mary)\\n \\n // NSMutableSet を使用して、動的に追加する方法\\n var mset = NSMutableSet(objects:\\\"aaa\\\", \\\"bbb\\\")\\n mset.addObject(\\\"ccc\\\")\\n \\n```\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T01:55:56.237\",\n \"id\": \"7170\",\n \"last_activity_date\": \"2015-02-27T01:55:56.237\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"5106\",\n \"parent_id\": \"7168\",\n \"post_type\": \"answer\",\n \"score\": 1\n },\n {\n \"body\": \"補足ですが、Swift1.2からはSwift用Setが使えますので、状況が許せば、以下のようにもかけます。\\n\\n```\\n\\n var set = Set()\\n set.insert(\\\"aaa\\\")\\n \\n```\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T02:45:48.510\",\n \"id\": \"7178\",\n \"last_activity_date\": \"2015-02-27T02:45:48.510\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"7368\",\n \"parent_id\": \"7168\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7168"},"accepted_answer_id":{"kind":"string","value":"7170"},"popular_answer_id":{"kind":"string","value":"7170"}}},{"rowIdx":1621,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 1,\n \"body\": \"MonacaでCordva3.5.1のWebSocketServerプラグインを有効にし、Androidアプリのビルドをすると下記のエラーが発生します。\\n\\n同じCordva3.5.1のHttpServerを有効にした場合にも同様のエラーが発生しましたが、Shareを有効にした場合には問題ありませんでした。 \\nWebSocketServerやHttpServerを使う場合には何か他に設定が必要なのでしょうか?\\n\\n* * *\\n\\n> Temporary folder: /private/tmp/monaca/eec3fd17f324a81a \\n> Downloading project \\n> Download complete \\n> Running for 3.5 \\n> Installing \\\"mobi.monaca.plugins.Monaca\\\" for android \\n> cordova version not detected (lacks script\\n> \\\"/private/tmp/monaca/eec3fd17f324a81a/android/skeleton/platforms/android/cordova/version\\\"\\n> ), continuing. \\n> Installing \\\"mobi.monaca.plugins.WebSocketServer\\\" for android \\n> cordova version not detected (lacks script\\n> \\\"/private/tmp/monaca/eec3fd17f324a81a/android/skeleton/platforms/android/cordova/version\\\"\\n> ), continuing. \\n> Installing \\\"org.apache.cordova.splashscreen\\\" for android \\n> Plugin \\\"mobi.monaca.plugins.Monaca\\\" already installed on android. \\n> Plugin \\\"org.apache.cordova.splashscreen\\\" already installed on android. \\n> Fetching plugin\\n> \\\"/data/monaca_build_module/plugins/mobi.monaca.plugins.WebSocketServer@1.0.0\\\"\\n> via plugin registry \\n> Error: 404 Not Found: data \\n> at RegClient.\\n> (/data/monaca_build_module/3.5/node_modules/cordova/node_modules/cordova-\\n> lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:268:14) \\n> at Request.self.callback\\n> (/data/monaca_build_module/3.5/node_modules/cordova/node_modules/cordova-\\n> lib/node_modules/npm/node_modules/request/index.js:148:22) \\n> at Request.emit (events.js:98:17) \\n> at Request.\\n> (/data/monaca_build_module/3.5/node_modules/cordova/node_modules/cordova-\\n> lib/node_modules/npm/node_modules/request/index.js:876:14) \\n> at Request.emit (events.js:117:20) \\n> at IncomingMessage.\\n> (/data/monaca_build_module/3.5/node_modules/cordova/node_modules/cordova-\\n> lib/node_modules/npm/node_modules/request/index.js:827:12) \\n> at IncomingMessage.emit (events.js:117:20) \\n> at _stream_readable.js:929:16 \\n> at process._tickCallback (node.js:419:13) \\n> Build error: Error building project source code\\n\\nAndroidManifest.xmlは以下の通りです\\n\\n```\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n```\\n\\nMonacaを使うのが初めてなもので初歩的なミスだとしたら申し訳ありませんが、ご指導をお願いいたします。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T01:49:45.323\",\n \"favorite_count\": 0,\n \"id\": \"7169\",\n \"last_activity_date\": \"2015-07-27T16:21:08.130\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8562\",\n \"post_type\": \"question\",\n \"score\": 3,\n \"tags\": [\n \"monaca\"\n ],\n \"title\": \"MonacaでWebSocketServerプラグインを有効にするとビルドエラーが発生する\",\n \"view_count\": 539\n}"},"answers":{"kind":"list like","value":[{"body":"同じ現象に悩まされています。私は、Shareを有効にしても失敗します。 \nアプリの実行で、plugins.httpServer(); が、Uncaught TypeError: Object # has no method\n'httpServer' とコンソールに出力されてHTTPサーバーを起動することができません。 \nUSBデバッグしてみると、たしかに、plugins には、httpServer が含まれていません。 \n別のプラグイン DatePicker を有効にしてデバッグしてみると、plugins には、datePicker が含まれています。 \nどうやったら、httpServer が使えるようになるのか、私も知りたいです。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T11:59:45.843","id":"7227","last_activity_date":"2015-02-27T11:59:45.843","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"8595","parent_id":"7169","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"同じ現象に悩まされています。私は、Shareを有効にしても失敗します。 \\nアプリの実行で、plugins.httpServer(); が、Uncaught TypeError: Object # has no method\\n'httpServer' とコンソールに出力されてHTTPサーバーを起動することができません。 \\nUSBデバッグしてみると、たしかに、plugins には、httpServer が含まれていません。 \\n別のプラグイン DatePicker を有効にしてデバッグしてみると、plugins には、datePicker が含まれています。 \\nどうやったら、httpServer が使えるようになるのか、私も知りたいです。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T11:59:45.843\",\n \"id\": \"7227\",\n \"last_activity_date\": \"2015-02-27T11:59:45.843\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8595\",\n \"parent_id\": \"7169\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7169"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"7227"}}},{"rowIdx":1622,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7173\",\n \"answer_count\": 1,\n \"body\": \"`form`タグ内に`button`タグを配置したところ、クリックするとsubmitされてしまう様なのですが \\nこれをsubmitしないただのボタンとして扱いたい場合はどうすれば良いでしょうか?\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T01:57:52.240\",\n \"favorite_count\": 0,\n \"id\": \"7171\",\n \"last_activity_date\": \"2015-02-27T02:05:52.920\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"525\",\n \"post_type\": \"question\",\n \"score\": 1,\n \"tags\": [\n \"html\"\n ],\n \"title\": \"form内にsubmitしないbuttonを配置したい\",\n \"view_count\": 8232\n}"},"answers":{"kind":"list like","value":[{"body":"typeに\"button\"を指定してみてはどうでしょうか? \n[button要素で送信・リセット・汎用ボタンを自由に作ろう](http://honttoni.blog74.fc2.com/blog-\nentry-153.html)\n\n一部引用\n\n> type=\"部品の種類\" submit(送信ボタン)、reset(リセットボタン)、button(汎用ボタン)の3つ。 \n> デフォルトは「submit」なので、typeを指定しなければ送信ボタンになります。 \n> *ただ、IE7以下ではデフォルトが「button」になります。 \n> IE7以下でを送信ボタンとして使う場合は、キチンとtype=\"submit\"と書く必要があります。\n```\n\n \n \n \n \n```","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T02:05:52.920","id":"7173","last_activity_date":"2015-02-27T02:05:52.920","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"3516","parent_id":"7171","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"typeに\\\"button\\\"を指定してみてはどうでしょうか? \\n[button要素で送信・リセット・汎用ボタンを自由に作ろう](http://honttoni.blog74.fc2.com/blog-\\nentry-153.html)\\n\\n一部引用\\n\\n> type=\\\"部品の種類\\\" submit(送信ボタン)、reset(リセットボタン)、button(汎用ボタン)の3つ。 \\n> デフォルトは「submit」なので、typeを指定しなければ送信ボタンになります。 \\n> *ただ、IE7以下ではデフォルトが「button」になります。 \\n> IE7以下でを送信ボタンとして使う場合は、キチンとtype=\\\"submit\\\"と書く必要があります。\\n```\\n\\n \\n \\n \\n \\n```\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T02:05:52.920\",\n \"id\": \"7173\",\n \"last_activity_date\": \"2015-02-27T02:05:52.920\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"3516\",\n \"parent_id\": \"7171\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"7171"},"accepted_answer_id":{"kind":"string","value":"7173"},"popular_answer_id":{"kind":"string","value":"7173"}}},{"rowIdx":1623,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7192\",\n \"answer_count\": 3,\n \"body\": \"[ruby -\\n既存クラスのメソッドに追加のオプションをつける方法](https://ja.stackoverflow.com/questions/6938/%e6%97%a2%e5%ad%98%e3%82%af%e3%83%a9%e3%82%b9%e3%81%ae%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ab%e8%bf%bd%e5%8a%a0%e3%81%ae%e3%82%aa%e3%83%97%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e3%81%a4%e3%81%91%e3%82%8b%e6%96%b9%e6%b3%95)\\nにて既存クラスのメソッドの書き換えについてお聞きしたのですが、問題が書き換えの方法ではなくファイルの読み込み方にあったために別の質問として立てさせていただきました。\\n\\n以下のように`selenium-\\nwebdriver`の拡張をしたのですが、pry上で作業している時に`Selenium::Webdriver::Element`に他のメソッドを追加した時など何度も`load\\n'selenium_webdriver_ext.rb'` で呼び出すと2回目以降から `stack level too\\ndeep`のエラーが発生してしまいます。\\n\\n### selenium_webdriver_ext.rb\\n\\n```\\n\\n class Selenium::WebDriver::Element\\n alias_method :send_keys_orig, :send_keys \\n def send_keys(*args, clear: false)\\n __send__(:clear) if clear\\n send_keys_orig(*args)\\n end\\n end\\n \\n```\\n\\nメソッドの書き換えを行ったファイルを`pry`から何度も読みだす時に何か良い方法はないでしょうか?\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T02:06:15.010\",\n \"favorite_count\": 0,\n \"id\": \"7174\",\n \"last_activity_date\": \"2015-02-27T05:04:12.333\",\n \"last_edit_date\": \"2017-04-13T12:52:38.920\",\n \"last_editor_user_id\": \"-1\",\n \"owner_user_id\": \"3271\",\n \"post_type\": \"question\",\n \"score\": 3,\n \"tags\": [\n \"ruby\",\n \"pry\"\n ],\n \"title\": \"既存クラスのメソッドを書き換えたファイルを何度も読み込む時の扱い方\",\n \"view_count\": 202\n}"},"answers":{"kind":"list like","value":[{"body":"2回目以降の `alias_method :send_keys_orig, :send_keys`\nがまずいですね。オリジナルが消えてますし、メソッド自身を呼び出すことになってしまいます。\n\n[aliasによるメソッドの再定義は危険なのでUnboundMethodかextendを使おう -\nるびきち](http://d.hatena.ne.jp/rubikitch/20080504/1209835550) \nと、るびきちさんの著作[Ruby逆引きハンドブック](http://www.c-r.com/book/detail/705)「メソッドを再定義する」\n(p.630) を用いて書き直してみました。\n\n```\n\n def once\n unless instance_variable_defined? :@__once_executed__\n yield\n @__once_executed__ = true\n end\n end\n \n class Selenium::WebDriver::Element\n once do\n alias_method :send_keys_orig, :send_keys \n end\n def send_keys(*args, clear: false)\n __send__(:clear) if clear\n send_keys_orig(*args)\n end\n end\n \n```\n\n簡単に言えば、再読込したときに `once` メソッドの引数(ブロック)は読まないので `SystemStackError: stack level too\ndeep` が出ない、ということです。\n\n他にも、先ほどの引用のタイトル通り、 `Module#instance_method` で `UnboundMethod`\nを得てから再定義というやり方、及び `Object#extend`\nを使ってインスタンスに再定義メソッドを突っ込むやり方があります。それらに関しては引用先を見てください。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T03:52:38.227","id":"7189","last_activity_date":"2015-02-27T03:52:38.227","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"4114","parent_id":"7174","post_type":"answer","score":1},{"body":"ガード条件を付けてみました。 \n`send_keys_orig` がすでに存在していればエイリアスメソッドは作らないようにしています。\n\n```\n\n class Selenium::WebDriver::Element\n unless instance_methods.include?(:send_keys_orig)\n alias_method :send_keys_orig, :send_keys\n end \n \n def send_keys(*args, clear: false)\n __send__(:clear) if clear\n send_keys_orig(*args)\n end\n end\n \n```\n\n参考文献: [Effective\nRuby](http://www.amazon.co.jp/exec/obidos/ASIN/4798139823/junic05-22/ref=nosim/)\n第5章","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T04:50:26.523","id":"7191","last_activity_date":"2015-02-27T04:50:26.523","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"85","parent_id":"7174","post_type":"answer","score":2},{"body":"[Module#prepend](http://docs.ruby-\nlang.org/ja/2.2.0/method/Module/i/prepend.html)を使いましょう。\n\n```\n\n module SendKeysWithOption\n def send_keys(*args, clear: false)\n __send__(:clear) if clear\n super(*args)\n end\n end\n \n # 何度Module#prependが呼ばれても元のメソッドは消えないので問題なく動く\n Selenium::WebDriver::Element.prepend(SendKeysWithOption)\n \n```","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T05:04:12.333","id":"7192","last_activity_date":"2015-02-27T05:04:12.333","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"2599","parent_id":"7174","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"2回目以降の `alias_method :send_keys_orig, :send_keys`\\nがまずいですね。オリジナルが消えてますし、メソッド自身を呼び出すことになってしまいます。\\n\\n[aliasによるメソッドの再定義は危険なのでUnboundMethodかextendを使おう -\\nるびきち](http://d.hatena.ne.jp/rubikitch/20080504/1209835550) \\nと、るびきちさんの著作[Ruby逆引きハンドブック](http://www.c-r.com/book/detail/705)「メソッドを再定義する」\\n(p.630) を用いて書き直してみました。\\n\\n```\\n\\n def once\\n unless instance_variable_defined? :@__once_executed__\\n yield\\n @__once_executed__ = true\\n end\\n end\\n \\n class Selenium::WebDriver::Element\\n once do\\n alias_method :send_keys_orig, :send_keys \\n end\\n def send_keys(*args, clear: false)\\n __send__(:clear) if clear\\n send_keys_orig(*args)\\n end\\n end\\n \\n```\\n\\n簡単に言えば、再読込したときに `once` メソッドの引数(ブロック)は読まないので `SystemStackError: stack level too\\ndeep` が出ない、ということです。\\n\\n他にも、先ほどの引用のタイトル通り、 `Module#instance_method` で `UnboundMethod`\\nを得てから再定義というやり方、及び `Object#extend`\\nを使ってインスタンスに再定義メソッドを突っ込むやり方があります。それらに関しては引用先を見てください。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T03:52:38.227\",\n \"id\": \"7189\",\n \"last_activity_date\": \"2015-02-27T03:52:38.227\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"4114\",\n \"parent_id\": \"7174\",\n \"post_type\": \"answer\",\n \"score\": 1\n },\n {\n \"body\": \"ガード条件を付けてみました。 \\n`send_keys_orig` がすでに存在していればエイリアスメソッドは作らないようにしています。\\n\\n```\\n\\n class Selenium::WebDriver::Element\\n unless instance_methods.include?(:send_keys_orig)\\n alias_method :send_keys_orig, :send_keys\\n end \\n \\n def send_keys(*args, clear: false)\\n __send__(:clear) if clear\\n send_keys_orig(*args)\\n end\\n end\\n \\n```\\n\\n参考文献: [Effective\\nRuby](http://www.amazon.co.jp/exec/obidos/ASIN/4798139823/junic05-22/ref=nosim/)\\n第5章\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T04:50:26.523\",\n \"id\": \"7191\",\n \"last_activity_date\": \"2015-02-27T04:50:26.523\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"85\",\n \"parent_id\": \"7174\",\n \"post_type\": \"answer\",\n \"score\": 2\n },\n {\n \"body\": \"[Module#prepend](http://docs.ruby-\\nlang.org/ja/2.2.0/method/Module/i/prepend.html)を使いましょう。\\n\\n```\\n\\n module SendKeysWithOption\\n def send_keys(*args, clear: false)\\n __send__(:clear) if clear\\n super(*args)\\n end\\n end\\n \\n # 何度Module#prependが呼ばれても元のメソッドは消えないので問題なく動く\\n Selenium::WebDriver::Element.prepend(SendKeysWithOption)\\n \\n```\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T05:04:12.333\",\n \"id\": \"7192\",\n \"last_activity_date\": \"2015-02-27T05:04:12.333\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"2599\",\n \"parent_id\": \"7174\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7174"},"accepted_answer_id":{"kind":"string","value":"7192"},"popular_answer_id":{"kind":"string","value":"7191"}}},{"rowIdx":1624,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7331\",\n \"answer_count\": 2,\n \"body\": \"ウェブサイトを開発していますが、 \\n表示されるHTMLの幅が、実際のブラウザのサイズよりも小さいサイズで表示されるため困っています。\\n\\n![Chrome(問題が発生)](https://i.stack.imgur.com/J8vmv.png) \\n![Safari(問題なし)](https://i.stack.imgur.com/GPOAZ.png)\\n\\nChrome と Safari でキャプチャをとりました。 \\nChrome では定規のサイズと実際のブラウザサイズが異なっています。 \\nSafari ではウィンドウのサイズと body 要素の width が同じなので問題なしです。\\n\\n以下のブラウザで、上記の現象が起こります。\\n\\n・Google Chrome v40.0.2214.115 \\n・Fire Fox 33.0.2\\n\\n※ Safariは実際のブラウザのサイズで表示されています。\\n\\nOSは、Mac OSX 10.9.5 \\nディスプレイの解像度は、1680x1050 です。\\n\\n画像をブラウザで直接開いた場合は、 \\nこの現象は起こりません。\\n\\nブラウザやOSのズーム機能は使っていません。\\n\\n何が原因か全くわからないため、 \\nアドバイスお願いします。\",\n \"comment_count\": 2,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T02:48:19.260\",\n \"favorite_count\": 0,\n \"id\": \"7181\",\n \"last_activity_date\": \"2015-03-04T11:55:40.830\",\n \"last_edit_date\": \"2015-03-02T04:07:12.127\",\n \"last_editor_user_id\": \"8581\",\n \"owner_user_id\": \"8581\",\n \"post_type\": \"question\",\n \"score\": 4,\n \"tags\": [\n \"html\",\n \"google-chrome\",\n \"firefox\"\n ],\n \"title\": \"ブラウザの実際のウィンドウサイズと表示するHTMLのbodyのサイズが異なる\",\n \"view_count\": 2111\n}"},"answers":{"kind":"list like","value":[{"body":"画像を見てみると右上の三本線アイコンの幅が上25px・下22pxと異なります。 \nこれは数値で表示されている400pxとルーラーから読み取れる値の365pxの比率とほぼ同じであるので、上のブラウザの表示倍率がやや上がっており、横幅の数値には反映されていないのだと思います。","comment_count":2,"content_license":"CC BY-SA 3.0","creation_date":"2015-03-02T13:32:27.263","id":"7331","last_activity_date":"2015-03-02T13:32:27.263","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"5750","parent_id":"7181","post_type":"answer","score":5},{"body":"私もpgrho氏の言う通りかと思います。 \n検証のため画像を貼るために回答として投稿します。\n\n初めに、ルーラーを上下反転させてみました。 \n本来であれば、10ピクセル単位で均等になるはずなのでメモリが上下一致するはずです。 \n![ルーラーが不一致](https://i.stack.imgur.com/Dkfv5.png) \nご覧のとおりルーラーを反転させても一致していません。 \n一致していないということは、等倍表示ではないことになります。\n\n![ルーラー101px分](https://i.stack.imgur.com/KtdBD.png) \n次に、ルーラー100~200、つまり101ピクセル分取り出しました。 \nしかし、111pxとなり、これもまた等倍ではないことを意味しています。\n\n等倍表示にしてからもう一度ご確認いただいたほうがよいかもしれません。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-03-04T11:55:40.830","id":"7440","last_activity_date":"2015-03-04T11:55:40.830","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"8667","parent_id":"7181","post_type":"answer","score":3}],"string":"[\n {\n \"body\": \"画像を見てみると右上の三本線アイコンの幅が上25px・下22pxと異なります。 \\nこれは数値で表示されている400pxとルーラーから読み取れる値の365pxの比率とほぼ同じであるので、上のブラウザの表示倍率がやや上がっており、横幅の数値には反映されていないのだと思います。\",\n \"comment_count\": 2,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-03-02T13:32:27.263\",\n \"id\": \"7331\",\n \"last_activity_date\": \"2015-03-02T13:32:27.263\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"5750\",\n \"parent_id\": \"7181\",\n \"post_type\": \"answer\",\n \"score\": 5\n },\n {\n \"body\": \"私もpgrho氏の言う通りかと思います。 \\n検証のため画像を貼るために回答として投稿します。\\n\\n初めに、ルーラーを上下反転させてみました。 \\n本来であれば、10ピクセル単位で均等になるはずなのでメモリが上下一致するはずです。 \\n![ルーラーが不一致](https://i.stack.imgur.com/Dkfv5.png) \\nご覧のとおりルーラーを反転させても一致していません。 \\n一致していないということは、等倍表示ではないことになります。\\n\\n![ルーラー101px分](https://i.stack.imgur.com/KtdBD.png) \\n次に、ルーラー100~200、つまり101ピクセル分取り出しました。 \\nしかし、111pxとなり、これもまた等倍ではないことを意味しています。\\n\\n等倍表示にしてからもう一度ご確認いただいたほうがよいかもしれません。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-03-04T11:55:40.830\",\n \"id\": \"7440\",\n \"last_activity_date\": \"2015-03-04T11:55:40.830\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8667\",\n \"parent_id\": \"7181\",\n \"post_type\": \"answer\",\n \"score\": 3\n }\n]"},"id":{"kind":"string","value":"7181"},"accepted_answer_id":{"kind":"string","value":"7331"},"popular_answer_id":{"kind":"string","value":"7331"}}},{"rowIdx":1625,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7187\",\n \"answer_count\": 1,\n \"body\": \"文字の隣にテキストボックスを配置したいのですが、 \\n画面幅のせいかテキストボックスが文字の下段に移動してしまいます。 \\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-02-27T03:17:03.570\",\n \"favorite_count\": 0,\n \"id\": \"7182\",\n \"last_activity_date\": \"2015-02-27T03:36:50.003\",\n \"last_edit_date\": \"2015-02-27T03:30:54.537\",\n \"last_editor_user_id\": \"7926\",\n \"owner_user_id\": \"7626\",\n \"post_type\": \"question\",\n \"score\": 1,\n \"tags\": [\n \"html\",\n \"css\"\n ],\n \"title\": \"HTML 文字の隣にあるテキストボックスが一段下がってしまうのを防ぎたい\",\n \"view_count\": 6340\n}"},"answers":{"kind":"list like","value":[{"body":"```\n\n \n 文字\n \n \n \n```\n\nこれでいかがでしょうか。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T03:36:50.003","id":"7187","last_activity_date":"2015-02-27T03:36:50.003","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"7926","parent_id":"7182","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"```\\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-02-27T03:36:50.003\",\n \"id\": \"7187\",\n \"last_activity_date\": \"2015-02-27T03:36:50.003\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"7926\",\n \"parent_id\": \"7182\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7182"},"accepted_answer_id":{"kind":"string","value":"7187"},"popular_answer_id":{"kind":"string","value":"7187"}}},{"rowIdx":1626,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7188\",\n \"answer_count\": 1,\n \"body\": \"代用ボタンのクリックを、本物のボタンに適用したいのですが、 \\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-02-27T03:29:40.153\",\n \"favorite_count\": 0,\n \"id\": \"7184\",\n \"last_activity_date\": \"2015-02-27T03:41:01.237\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"7626\",\n \"post_type\": \"question\",\n \"score\": 1,\n \"tags\": [\n \"html\",\n \"css\"\n ],\n \"title\": \"代用ボタンのクリックを、本物のボタンに適用したい\",\n \"view_count\": 195\n}"},"answers":{"kind":"list like","value":[{"body":"JavaScriptを使わないと難しいと思います。\n\n```\n\n #honmono {display: none;}\n```\n\n```\n\n \r\n \n```\n\nこんな感じでしょうか。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T03:41:01.237","id":"7188","last_activity_date":"2015-02-27T03:41:01.237","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"2232","parent_id":"7184","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"JavaScriptを使わないと難しいと思います。\\n\\n```\\n\\n #honmono {display: none;}\\n```\\n\\n```\\n\\n \\r\\n \\n```\\n\\nこんな感じでしょうか。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T03:41:01.237\",\n \"id\": \"7188\",\n \"last_activity_date\": \"2015-02-27T03:41:01.237\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"2232\",\n \"parent_id\": \"7184\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"7184"},"accepted_answer_id":{"kind":"string","value":"7188"},"popular_answer_id":{"kind":"string","value":"7188"}}},{"rowIdx":1627,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 3,\n \"body\": \"DDDをベースに web\\nアプリケーションの設計を進めていて、DBの停止状態(メンテナンス等による一時休止)をどのレイヤーでチェックし、停止時/非停止時で処理を分岐させたら良いか悩んでいます。\\n\\n私の理解だと、「DBMSの稼働状態、また状態による処理の分岐」はアプリケーションレイヤーが持つべき責務で、これらの処理はコントローラー等に実装するのがいいと思ってます。ただ、実際にDBの状態をチェックし処理を分岐させる必要があるのは、リポジトリー経由でモデルを生成/保存するタイミングであり、リポジトリーを呼び出す際にコントローラー側でいちいち\\nDB の状態をチェックするというのは、DRY の観点からも良くないと感じています。リポジトリーに「DB\\nの状態をチェックせずに呼び出してはいけない」という事前条件を付与するのは、かなり危険です。\\n\\nこの観点から、DataBase の抽象クラスをインフラアーキテクチャレイヤーに作成し、リポジトリーに渡す設計を考えました。Database\\nの具象クラスはアプリケーションレイヤーに実装します。\\n\\n以下 PHP を例にとって実装例を挙げます。\\n\\nインフラアーキテクチャレイヤー\\n\\n```\\n\\n namespace sample\\\\infra;\\n abstract class Database {\\n public function __construct() {\\n if($this->is_maintenance()) {\\n throw new \\\\Exception;\\n }\\n }\\n \\n abstract protected function is_maintenance();\\n }\\n \\n```\\n\\nアプリケーションレイヤー\\n\\n```\\n\\n namespace sample\\\\application;\\n class HogeMasterDatabase extends \\\\sample\\\\infra\\\\Database {\\n protected function is_maintenance() { /* */ }\\n }\\n class HogeSlaveDatabase extends \\\\sample\\\\infra\\\\Database {\\n protected function is_maintenance() { /* */ }\\n }\\n \\n class HogeController {\\n public function read() {\\n $slave = new HogeSlaveDatabase; //ここの例外はRouter等でキャッチする\\n \\n $repository = new \\\\sample\\\\domain\\\\HogeRepository($slave);\\n $hoge = $repository->fetch($id);\\n \\n // カウンターをインクリメント\\n try {\\n $master = new HogeMasterDatabase;\\n $repository = new \\\\sample\\\\domain\\\\HogeRepository($master);\\n $factory = new HogeFactory($hoge);\\n $factory->setCounter(++$hoge->getCounter());\\n $repository->update($factory->create());\\n } catch (\\\\Exception $e) {\\n // masterがメンテナンスの時は無視する\\n } \\n }\\n }\\n \\n```\\n\\nドメインレイヤー\\n\\n```\\n\\n namespace sample\\\\domain;\\n class Hoge {\\n private $counter;\\n \\n public function getCounter() {\\n return $this->counter;\\n }\\n }\\n class HogeRepository {\\n private $db;\\n \\n public function __construct(\\\\sample\\\\infra\\\\Database $db) {\\n $this->db = $db;\\n }\\n \\n public function fetch($id) { }\\n public function update(Hoge $model) { }\\n }\\n \\n```\\n\\nこういったケースでは、どう設計&実装すべきでしょうか。アドバイスを頂けると嬉しいです。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T03:30:41.917\",\n \"favorite_count\": 0,\n \"id\": \"7186\",\n \"last_activity_date\": \"2015-11-09T02:57:47.357\",\n \"last_edit_date\": \"2015-03-05T06:13:50.570\",\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8583\",\n \"post_type\": \"question\",\n \"score\": 6,\n \"tags\": [\n \"php\",\n \"ドメイン駆動設計\"\n ],\n \"title\": \"DDDにおいてDBの停止状態をチェックするのはどのレイヤーか\",\n \"view_count\": 1427\n}"},"answers":{"kind":"list like","value":[{"body":"DBの例外等をどのレイヤーで扱うのかは、アプリケーションのポリシーにもよりますが、少なくともドメインレイヤーのリポジトリで直接管理することはないでしょう。何らかのユースケースにおいて管理されることになると思います。このユースケースがどのレイヤーに属するものなのかは、ここでは問いません。\n\nデータベースの状態については、おそらくアプリケーション全体にわたって共通した振る舞いが必要になると思います。質問に書かれているような個々のコントローラに条件分岐を書くアプローチ以外に、さまざまな選択肢があります。\n\n * 横断的関心事としてAOPで実装する (参考 [Ray.Aop](https://github.com/ray-di/Ray.Aop/blob/develop-2/README.ja.md))\n * テンプレートメソッド(デザインパターン)を基底クラスに用意して使う\n * フレームワークのコントローラ実行フローに組み込む\n\n質問に書かれているコードのように、master/slaveごとの判定等ある程度の手続きがある場合は2つ目のテンプレートメソッドが分かりやすいかと思います。\n\n最近のPHPではClosureが使えますので、DB状態に依存するような処理をClosureで定義して渡すようなやり方も可能です。似たようなことをやる例として、フレームワークLaravelのトランザクションブロックのための仕組みが参考になるかと思います。\n\n * [Database Transactions](http://laravel.com/docs/5.0/database#database-transactions)\n * [framework/Connection.php at 5.0 · laravel/framework](https://github.com/laravel/framework/blob/5.0/src/Illuminate/Database/Connection.php#L438)\n\nP.S. この内容は、ドメイン駆動設計とは関係無く、アプリケーションまたはフレームワークの設計一般に関する質問かと思います。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-03-08T08:36:43.023","id":"7607","last_activity_date":"2015-03-08T14:45:32.083","last_edit_date":"2015-03-08T14:45:32.083","last_editor_user_id":"5444","owner_user_id":"5444","parent_id":"7186","post_type":"answer","score":3},{"body":"DDDを実践するに当たって、まず実装の詳細から入りすぎているように思います。DDDでは、設計や実装の詳細よりまず「ユビキタス言語」を語ってみることが大事です。\n\n「DBの停止状態」という状況に対して、ビジネスドメインのユビキタス言語はどういったことを語るのでしょうか?\nDBが停止するということは、ドメインで行われている行為に何らかの影響が出るはずですが、その影響をユビキタス言語はどう語るのでしょうか?\n\nDBの停止はユビキタス言語の中では全く予期していない出来事で、そのときの振る舞いは完全に未定義でしょうか?\nだとしたら、それはドメインの関心事ではないので、インフラ層でチェックしてシステムエラーをアプリケーション層に投げればいいでしょう。\n\nもしユビキタス言語がその状況について語る何らかの言葉を持っているなら、それはドメイン層の関心事なのでドメインモデルの中に組み込むべきです。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-03-12T01:03:49.513","id":"7808","last_activity_date":"2015-03-12T01:03:49.513","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"244","parent_id":"7186","post_type":"answer","score":3},{"body":"リポジトリの実装クラス内でチェックすればよいとおもいます。レイヤーとしてはインフラストラクチャになると思います。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-11-09T02:57:47.357","id":"18557","last_activity_date":"2015-11-09T02:57:47.357","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"13179","parent_id":"7186","post_type":"answer","score":-1}],"string":"[\n {\n \"body\": \"DBの例外等をどのレイヤーで扱うのかは、アプリケーションのポリシーにもよりますが、少なくともドメインレイヤーのリポジトリで直接管理することはないでしょう。何らかのユースケースにおいて管理されることになると思います。このユースケースがどのレイヤーに属するものなのかは、ここでは問いません。\\n\\nデータベースの状態については、おそらくアプリケーション全体にわたって共通した振る舞いが必要になると思います。質問に書かれているような個々のコントローラに条件分岐を書くアプローチ以外に、さまざまな選択肢があります。\\n\\n * 横断的関心事としてAOPで実装する (参考 [Ray.Aop](https://github.com/ray-di/Ray.Aop/blob/develop-2/README.ja.md))\\n * テンプレートメソッド(デザインパターン)を基底クラスに用意して使う\\n * フレームワークのコントローラ実行フローに組み込む\\n\\n質問に書かれているコードのように、master/slaveごとの判定等ある程度の手続きがある場合は2つ目のテンプレートメソッドが分かりやすいかと思います。\\n\\n最近のPHPではClosureが使えますので、DB状態に依存するような処理をClosureで定義して渡すようなやり方も可能です。似たようなことをやる例として、フレームワークLaravelのトランザクションブロックのための仕組みが参考になるかと思います。\\n\\n * [Database Transactions](http://laravel.com/docs/5.0/database#database-transactions)\\n * [framework/Connection.php at 5.0 · laravel/framework](https://github.com/laravel/framework/blob/5.0/src/Illuminate/Database/Connection.php#L438)\\n\\nP.S. この内容は、ドメイン駆動設計とは関係無く、アプリケーションまたはフレームワークの設計一般に関する質問かと思います。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-03-08T08:36:43.023\",\n \"id\": \"7607\",\n \"last_activity_date\": \"2015-03-08T14:45:32.083\",\n \"last_edit_date\": \"2015-03-08T14:45:32.083\",\n \"last_editor_user_id\": \"5444\",\n \"owner_user_id\": \"5444\",\n \"parent_id\": \"7186\",\n \"post_type\": \"answer\",\n \"score\": 3\n },\n {\n \"body\": \"DDDを実践するに当たって、まず実装の詳細から入りすぎているように思います。DDDでは、設計や実装の詳細よりまず「ユビキタス言語」を語ってみることが大事です。\\n\\n「DBの停止状態」という状況に対して、ビジネスドメインのユビキタス言語はどういったことを語るのでしょうか?\\nDBが停止するということは、ドメインで行われている行為に何らかの影響が出るはずですが、その影響をユビキタス言語はどう語るのでしょうか?\\n\\nDBの停止はユビキタス言語の中では全く予期していない出来事で、そのときの振る舞いは完全に未定義でしょうか?\\nだとしたら、それはドメインの関心事ではないので、インフラ層でチェックしてシステムエラーをアプリケーション層に投げればいいでしょう。\\n\\nもしユビキタス言語がその状況について語る何らかの言葉を持っているなら、それはドメイン層の関心事なのでドメインモデルの中に組み込むべきです。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-03-12T01:03:49.513\",\n \"id\": \"7808\",\n \"last_activity_date\": \"2015-03-12T01:03:49.513\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"244\",\n \"parent_id\": \"7186\",\n \"post_type\": \"answer\",\n \"score\": 3\n },\n {\n \"body\": \"リポジトリの実装クラス内でチェックすればよいとおもいます。レイヤーとしてはインフラストラクチャになると思います。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-11-09T02:57:47.357\",\n \"id\": \"18557\",\n \"last_activity_date\": \"2015-11-09T02:57:47.357\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"13179\",\n \"parent_id\": \"7186\",\n \"post_type\": \"answer\",\n \"score\": -1\n }\n]"},"id":{"kind":"string","value":"7186"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"7607"}}},{"rowIdx":1628,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 1,\n \"body\": \"Mac OSX Yosemite のローカルに WordPress を置いてテストしてます。 \\n「サイト」フォルダのサブフォルダにバーチャルホストを設定してやってます。 \\nそれで WordPress のメディアライブラリで画像をアップロードする時なんですが、以下のエラーが出ます\\n\\n```\\n\\n ディレクトリ wp-content/uploads/2015/02 を作成できませんでした。この親ディレクトリのアクセス権はサーバーによる書き込みを許可していますか ?\\n \\n```\\n\\n先日、Macを移行しまして旧Macの方ではエラーが出てなかったんですが、新Macに移行してから出るようになりました。 \\nパーミッションは新旧同じになってると思います。 \\n所有者の問題なのかと思い、新しくフォルダを作って WordPress\\nもダウンロードしてきたものを置いて(旧Macでしていたのと同じように)みましたがインストールの段階で以下のように出ます。\\n\\n```\\n\\n wp-config.php ファイルに書き込むことができません。\\n \\n```\\n\\nそれでもインストールすることは出来るんですが、画像アップ時にはまた同様のエラーが出ます。 \\n旧Macで出来ていたことが新Macで出来なくなってしまった原因は何なんでしょうか?\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T05:12:11.497\",\n \"favorite_count\": 0,\n \"id\": \"7193\",\n \"last_activity_date\": \"2015-03-29T08:06:28.343\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"8439\",\n \"post_type\": \"question\",\n \"score\": 0,\n \"tags\": [\n \"macos\"\n ],\n \"title\": \"Mac ローカルの WordPress での 画像アップエラー\",\n \"view_count\": 1141\n}"},"answers":{"kind":"list like","value":[{"body":"パーミッションのエラーだと思います。 \n試しに、uploadsフォルダのバックアップを取った上でターミナルで該当フォルダまでアクセスして、以下のコマンドを叩くと正常にアップロードできることが確認できるかと思います。\n\n```\n\n $ cd /~~(サイトフォルダ)/wp-content/\n $ sudo chmod -R 777 uploads/ \n \n```\n\nバックアップを元に戻して、wordpress がインストールされているディレクトリのユーザー確認を行い、\n\n```\n\n $ cd /~~(サイトフォルダ)/\n $ ls -la\n $ sudo chown -R apache:apache (サイトフォルダ)\n \n```\n\nローカルの場合はmampをお使いかもしれませんので、 \nnginx や apache などではなく、 一般ユーザーになっていたら変更しましょう。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T06:33:15.647","id":"7204","last_activity_date":"2015-02-27T06:33:15.647","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"7641","parent_id":"7193","post_type":"answer","score":2}],"string":"[\n {\n \"body\": \"パーミッションのエラーだと思います。 \\n試しに、uploadsフォルダのバックアップを取った上でターミナルで該当フォルダまでアクセスして、以下のコマンドを叩くと正常にアップロードできることが確認できるかと思います。\\n\\n```\\n\\n $ cd /~~(サイトフォルダ)/wp-content/\\n $ sudo chmod -R 777 uploads/ \\n \\n```\\n\\nバックアップを元に戻して、wordpress がインストールされているディレクトリのユーザー確認を行い、\\n\\n```\\n\\n $ cd /~~(サイトフォルダ)/\\n $ ls -la\\n $ sudo chown -R apache:apache (サイトフォルダ)\\n \\n```\\n\\nローカルの場合はmampをお使いかもしれませんので、 \\nnginx や apache などではなく、 一般ユーザーになっていたら変更しましょう。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T06:33:15.647\",\n \"id\": \"7204\",\n \"last_activity_date\": \"2015-02-27T06:33:15.647\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"7641\",\n \"parent_id\": \"7193\",\n \"post_type\": \"answer\",\n \"score\": 2\n }\n]"},"id":{"kind":"string","value":"7193"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"7204"}}},{"rowIdx":1629,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 1,\n \"body\": \"Microsoft Azure クラウドサービスに固定IP(予約済みIP)を設定したく調査したところ、 \\nサービス構成ファイルに予約済みIPを指定することで固定IPが設定できるとの情報を得ました。 \\n\\n\\nさらに、サービス構成ファイルの編集方法について以下のサイトを確認したのですが、 \\n \\n管理ポータルのクラウドサービスの画面に「構成」のタブが見当たりません。 \\n「構成」タブは廃止されてしまったのでしょうか。\\n\\nサービス構成ファイルを取得するにはどうしたらよいのでしょうか。 \\nまた、この方法以外で固定IPを設定する方法があればご教授いただけないでしょうか。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T05:12:38.913\",\n \"favorite_count\": 0,\n \"id\": \"7194\",\n \"last_activity_date\": \"2015-09-16T23:58:19.597\",\n \"last_edit_date\": \"2015-09-16T23:58:19.597\",\n \"last_editor_user_id\": \"-1\",\n \"owner_user_id\": \"8584\",\n \"post_type\": \"question\",\n \"score\": 3,\n \"tags\": [\n \"azure\"\n ],\n \"title\": \"Microsoft Azureクラウドサービスサービス構成ファイルの取得方法\",\n \"view_count\": 509\n}"},"answers":{"kind":"list like","value":[{"body":"使われているサービスが「仮想マシン」であれば構成タブはありません。 \n※ややこしいのですが仮想マシンを作った場合でもクラウドサービスは作成されます\n\n仮想マシンの場合で予約済みIPアドレスを利用する場合は、同じURLの上部の仮想マシンの場合にやり方が記載されています。 \n\n\n現状、Azure PowerShellを使用して設定する形になるかと思います。","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T10:40:46.720","id":"7222","last_activity_date":"2015-08-25T01:59:08.710","last_edit_date":"2015-08-25T01:59:08.710","last_editor_user_id":"-1","owner_user_id":"2202","parent_id":"7194","post_type":"answer","score":1}],"string":"[\n {\n \"body\": \"使われているサービスが「仮想マシン」であれば構成タブはありません。 \\n※ややこしいのですが仮想マシンを作った場合でもクラウドサービスは作成されます\\n\\n仮想マシンの場合で予約済みIPアドレスを利用する場合は、同じURLの上部の仮想マシンの場合にやり方が記載されています。 \\n\\n\\n現状、Azure PowerShellを使用して設定する形になるかと思います。\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T10:40:46.720\",\n \"id\": \"7222\",\n \"last_activity_date\": \"2015-08-25T01:59:08.710\",\n \"last_edit_date\": \"2015-08-25T01:59:08.710\",\n \"last_editor_user_id\": \"-1\",\n \"owner_user_id\": \"2202\",\n \"parent_id\": \"7194\",\n \"post_type\": \"answer\",\n \"score\": 1\n }\n]"},"id":{"kind":"string","value":"7194"},"accepted_answer_id":{"kind":"null"},"popular_answer_id":{"kind":"string","value":"7222"}}},{"rowIdx":1630,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": \"7271\",\n \"answer_count\": 3,\n \"body\": \"スクリプトや、API,WMIなど、言語や手段は問いません。\\n\\nWindowsで現在ログインしているユーザーにパスワードが設定されているかどうかの情報を取得できる方法を教えて下さい。\\n\\nよろしくお願いします。\",\n \"comment_count\": 3,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T05:32:16.460\",\n \"favorite_count\": 0,\n \"id\": \"7197\",\n \"last_activity_date\": \"2015-03-01T09:13:18.093\",\n \"last_edit_date\": \"2015-03-01T09:13:04.130\",\n \"last_editor_user_id\": \"3715\",\n \"owner_user_id\": \"3715\",\n \"post_type\": \"question\",\n \"score\": 1,\n \"tags\": [\n \"c#\",\n \"windows\",\n \"vba\"\n ],\n \"title\": \"Windowsで現在ログイン中のユーザーにパスワードが設定されているか取得する方法ありますか?\",\n \"view_count\": 2592\n}"},"answers":{"kind":"list like","value":[{"body":"(2015/02/27 20:44追記)下記回答は使えないようです。\n\n* * *\n\nローカルドメインのユーザーであれば、Windowsのコマンド`net`を利用して\n\n```\n\n net user %USERNAME%\n \n```\n\nとすると、パスワードの有無を含む様々な情報が取得できます。","comment_count":3,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T09:57:36.940","id":"7217","last_activity_date":"2015-02-27T11:46:54.733","last_edit_date":"2015-02-27T11:46:54.733","last_editor_user_id":"3160","owner_user_id":"3160","parent_id":"7197","post_type":"answer","score":0},{"body":"酷い方法ですがSystem.DirectoryServices.AccountManagement.dllを参照して \n\n```\n\n bool HasPassword()\n {\n using (var pc = new PrincipalContext(ContextType.Machine))\n {\n try\n {\n return !pc.ValidateCredentials(Environment.UserName, \"\");\n }\n catch\n {\n return false;\n }\n }\n }\n \n```\n\nのようにログインしてみれば分かるかと。`ValidateCredentials`は`False`または例外を返します。","comment_count":1,"content_license":"CC BY-SA 3.0","creation_date":"2015-02-27T10:51:53.313","id":"7225","last_activity_date":"2015-02-27T10:51:53.313","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"5750","parent_id":"7197","post_type":"answer","score":0},{"body":"# 解決!\n\nC++ですが、下記のような感じで取得出来ました。ありがとうございました。(__)\n\n```\n\n wstring user = \"HogeHoge\";\n \n HANDLE h;\n CEdit* edit = (CEdit*)GetDlgItem(IDC_EDIT1);\n CString s;\n s.AppendFormat(L\"ユーザー: %s\\r\\n\", user.c_str());\n int res = LogonUser(user.c_str(), L\".\", L\"\", LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &h);\n if (res == 0) {\n DWORD error = GetLastError();\n s.AppendFormat(L\"Error: %d\\r\\n\", error);\n if (error == ERROR_ACCOUNT_RESTRICTION) {\n s.AppendFormat(L\"このユーザーにはパスワードが設定されていません\");\n }\n else if (error == ERROR_LOGON_FAILURE){\n s.AppendFormat(L\"このユーザーにはパスワードが設定されています\");\n }\n else {\n s.AppendFormat(L\"不明なエラー\");\n }\n edit->SetWindowTextW(s);\n }\n else {\n s.AppendFormat(L\"Result: %d\", res);\n edit->SetWindowTextW(s);\n }\n \n```","comment_count":0,"content_license":"CC BY-SA 3.0","creation_date":"2015-03-01T09:13:18.093","id":"7271","last_activity_date":"2015-03-01T09:13:18.093","last_edit_date":null,"last_editor_user_id":null,"owner_user_id":"3715","parent_id":"7197","post_type":"answer","score":0}],"string":"[\n {\n \"body\": \"(2015/02/27 20:44追記)下記回答は使えないようです。\\n\\n* * *\\n\\nローカルドメインのユーザーであれば、Windowsのコマンド`net`を利用して\\n\\n```\\n\\n net user %USERNAME%\\n \\n```\\n\\nとすると、パスワードの有無を含む様々な情報が取得できます。\",\n \"comment_count\": 3,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T09:57:36.940\",\n \"id\": \"7217\",\n \"last_activity_date\": \"2015-02-27T11:46:54.733\",\n \"last_edit_date\": \"2015-02-27T11:46:54.733\",\n \"last_editor_user_id\": \"3160\",\n \"owner_user_id\": \"3160\",\n \"parent_id\": \"7197\",\n \"post_type\": \"answer\",\n \"score\": 0\n },\n {\n \"body\": \"酷い方法ですがSystem.DirectoryServices.AccountManagement.dllを参照して \\n\\n```\\n\\n bool HasPassword()\\n {\\n using (var pc = new PrincipalContext(ContextType.Machine))\\n {\\n try\\n {\\n return !pc.ValidateCredentials(Environment.UserName, \\\"\\\");\\n }\\n catch\\n {\\n return false;\\n }\\n }\\n }\\n \\n```\\n\\nのようにログインしてみれば分かるかと。`ValidateCredentials`は`False`または例外を返します。\",\n \"comment_count\": 1,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-02-27T10:51:53.313\",\n \"id\": \"7225\",\n \"last_activity_date\": \"2015-02-27T10:51:53.313\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"5750\",\n \"parent_id\": \"7197\",\n \"post_type\": \"answer\",\n \"score\": 0\n },\n {\n \"body\": \"# 解決!\\n\\nC++ですが、下記のような感じで取得出来ました。ありがとうございました。(__)\\n\\n```\\n\\n wstring user = \\\"HogeHoge\\\";\\n \\n HANDLE h;\\n CEdit* edit = (CEdit*)GetDlgItem(IDC_EDIT1);\\n CString s;\\n s.AppendFormat(L\\\"ユーザー: %s\\\\r\\\\n\\\", user.c_str());\\n int res = LogonUser(user.c_str(), L\\\".\\\", L\\\"\\\", LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &h);\\n if (res == 0) {\\n DWORD error = GetLastError();\\n s.AppendFormat(L\\\"Error: %d\\\\r\\\\n\\\", error);\\n if (error == ERROR_ACCOUNT_RESTRICTION) {\\n s.AppendFormat(L\\\"このユーザーにはパスワードが設定されていません\\\");\\n }\\n else if (error == ERROR_LOGON_FAILURE){\\n s.AppendFormat(L\\\"このユーザーにはパスワードが設定されています\\\");\\n }\\n else {\\n s.AppendFormat(L\\\"不明なエラー\\\");\\n }\\n edit->SetWindowTextW(s);\\n }\\n else {\\n s.AppendFormat(L\\\"Result: %d\\\", res);\\n edit->SetWindowTextW(s);\\n }\\n \\n```\",\n \"comment_count\": 0,\n \"content_license\": \"CC BY-SA 3.0\",\n \"creation_date\": \"2015-03-01T09:13:18.093\",\n \"id\": \"7271\",\n \"last_activity_date\": \"2015-03-01T09:13:18.093\",\n \"last_edit_date\": null,\n \"last_editor_user_id\": null,\n \"owner_user_id\": \"3715\",\n \"parent_id\": \"7197\",\n \"post_type\": \"answer\",\n \"score\": 0\n }\n]"},"id":{"kind":"string","value":"7197"},"accepted_answer_id":{"kind":"string","value":"7271"},"popular_answer_id":{"kind":"string","value":"7217"}}},{"rowIdx":1631,"cells":{"question":{"kind":"string","value":"{\n \"accepted_answer_id\": null,\n \"answer_count\": 0,\n \"body\": \"Pythonでhtmlのframe内のデータを取得するにはどうすればいいのでしょうか? \\n私が取得したいWebページにはがあるのでframeの内容を取得せずにそちらの内容を取得してしまいます。こちらが<frame>に対応しているとサーバーに思わせるにはどうすればいいのでしょうか?\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T05:34:43.663\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7199\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T05:34:43.663\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5246\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;html\&quot;,\n \&quot;python\&quot;\n ],\n \&quot;title\&quot;: \&quot;python3でframe内のデータを取得する\&quot;,\n \&quot;view_count\&quot;: 465\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[],&quot;string&quot;:&quot;[]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7199&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;}}},{&quot;rowIdx&quot;:1632,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 0,\n \&quot;body\&quot;: \&quot;iOS8ではUITableViewのスタイルをグループにしても、セクション毎にグループになっているセルが角丸になりません。 \\nどうすれば、セクション毎に角丸になりますか?\&quot;,\n \&quot;comment_count\&quot;: 3,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T06:27:49.813\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7202\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T06:27:49.813\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8060\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;ios\&quot;,\n \&quot;uitableview\&quot;\n ],\n \&quot;title\&quot;: \&quot;TableViewのセルをセクション毎に角丸にしたい\&quot;,\n \&quot;view_count\&quot;: 2454\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[],&quot;string&quot;:&quot;[]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7202&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;}}},{&quot;rowIdx&quot;:1633,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;iOSのGoogleMapアプリのようにメニューのViewが開いてもそのViewController内で、常に最前面にUISearchbarを表示するにはどうすればよいですか?\\n\\n以下がイメージです。 \\n![メニューを開く前](https://i.stack.imgur.com/nO3Y3.png)\\n![メニューを開いた後](https://i.stack.imgur.com/DeVlQ.png)\&quot;,\n \&quot;comment_count\&quot;: 3,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T06:55:46.033\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7206\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-07T10:22:34.550\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-02-27T09:19:10.193\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8060\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8060\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;ios\&quot;\n ],\n \&quot;title\&quot;: \&quot;常にUISearchbarを表示\&quot;,\n \&quot;view_count\&quot;: 417\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;# はじめに\n\n`UIViewController`内で通常、ベースとなるViewはプロパティの`view`になります。 \nこの`view`に何かのViewを`addSubview:`すると、そのViewが最前面になります。\n\nつまり、一番最後に`addSubview:`したViewが最前面になる訳ですが、普通は画面の初期表示の後にもユーザーイベント等をトリガーとして`addSubview:`する事があります。\n\nここで、Viewを最前面にするメソッドとして、`bringSubviewToFront:`があります。 \nこのメソッドを使うとそのViewに貼られているSubViewを最前面にする事ができます。\n\n# 回答\n\n質問のひとつの解決手段として、 **viewプロパティにaddSubview:されるタイミングでbringSubviewToFront:を呼ぶ**\nを提案します。\n\nまず、対象の`UIViewController`のサブクラスのプロパティ`view`を下記のようなUIViewサブクラスで置き換えます。(xibやstoryboard上又はloadView等で)\n\n```\n\n @interface MyView : UIView\n // 最前面に置きたいView\n @property(nonatomic,weak)UIView* frontView;\n @end\n \n @implementation MyView\n // addSubview:される時に呼ばれる\n - (void)didAddSubview:(UIView *)subview\n {\n // 最前面にする\n if (self.frontView) {\n [self bringSubviewToFront:self.frontView];\n }\n }\n \n @end\n \n```\n\n次に、最前面に置きたいView(ここではUISearchbar)を生成時に、上記クラスのプロパティ`frontView`にセットしておく。(下記参照)\n\n```\n\n [(MyView*)self.view setFrontView:searchbar];\n \n```\n\nそうすると、設定したViewControllerの`view`に`addSubview:`される度に`didAddSubview:`が呼ばれ、`frontView`にセットしたViewが最前面になる処理が呼ばれます。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-07T10:22:34.550&quot;,&quot;id&quot;:&quot;7583&quot;,&quot;last_activity_date&quot;:&quot;2015-03-07T10:22:34.550&quot;,&quot;last_edit_date&quot;:&quot;2020-06-17T08:14:45.997&quot;,&quot;last_editor_user_id&quot;:&quot;-1&quot;,&quot;owner_user_id&quot;:&quot;7364&quot;,&quot;parent_id&quot;:&quot;7206&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;# はじめに\\n\\n`UIViewController`内で通常、ベースとなるViewはプロパティの`view`になります。 \\nこの`view`に何かのViewを`addSubview:`すると、そのViewが最前面になります。\\n\\nつまり、一番最後に`addSubview:`したViewが最前面になる訳ですが、普通は画面の初期表示の後にもユーザーイベント等をトリガーとして`addSubview:`する事があります。\\n\\nここで、Viewを最前面にするメソッドとして、`bringSubviewToFront:`があります。 \\nこのメソッドを使うとそのViewに貼られているSubViewを最前面にする事ができます。\\n\\n# 回答\\n\\n質問のひとつの解決手段として、 **viewプロパティにaddSubview:されるタイミングでbringSubviewToFront:を呼ぶ**\\nを提案します。\\n\\nまず、対象の`UIViewController`のサブクラスのプロパティ`view`を下記のようなUIViewサブクラスで置き換えます。(xibやstoryboard上又はloadView等で)\\n\\n```\\n\\n @interface MyView : UIView\\n // 最前面に置きたいView\\n @property(nonatomic,weak)UIView* frontView;\\n @end\\n \\n @implementation MyView\\n // addSubview:される時に呼ばれる\\n - (void)didAddSubview:(UIView *)subview\\n {\\n // 最前面にする\\n if (self.frontView) {\\n [self bringSubviewToFront:self.frontView];\\n }\\n }\\n \\n @end\\n \\n```\\n\\n次に、最前面に置きたいView(ここではUISearchbar)を生成時に、上記クラスのプロパティ`frontView`にセットしておく。(下記参照)\\n\\n```\\n\\n [(MyView*)self.view setFrontView:searchbar];\\n \\n```\\n\\nそうすると、設定したViewControllerの`view`に`addSubview:`される度に`didAddSubview:`が呼ばれ、`frontView`にセットしたViewが最前面になる処理が呼ばれます。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-07T10:22:34.550\&quot;,\n \&quot;id\&quot;: \&quot;7583\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-07T10:22:34.550\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2020-06-17T08:14:45.997\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7364\&quot;,\n \&quot;parent_id\&quot;: \&quot;7206\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7206&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7583&quot;}}},{&quot;rowIdx&quot;:1634,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 0,\n \&quot;body\&quot;: \&quot;画像をリクエストしているのですが、SkImageDecoder::Factory returned nullとなります。 \\nstatuscodeは200でした。 \\nURLはhttps://outlook.office365.com/owa/service.svc/s/GetFileAttachment?id=HOGEHOGE.です。\\n\\n```\\n\\n try {\\n HttpGet httpGet = new HttpGet(URL);\\n CookieManager cookie = CookieManager.getInstance();\\n String cookiestr = cookie.getCookie(URL);\\n httpGet.setHeader(\\\&quot;Cookie\\\&quot;, cookiestr);\\n DefaultHttpClient client = new DefaultHttpClient();\\n \\n HttpResponse httpResponse = client.execute(httpGet);\\n int statusCode = httpResponse.getStatusLine().getStatusCode();\\n Log.d(\\\&quot;\\\&quot;,\\\&quot;statusCode:\\\&quot;+statusCode);\\n HttpEntity entity = httpResponse.getEntity();\\n //String response = EntityUtils.toString(entity);\\n //Log.d(\\\&quot;\\\&quot;,\\\&quot;response:\\\&quot;+response);\\n BufferedHttpEntity bufferedEntity = new BufferedHttpEntity(entity);\\n final InputStream in = bufferedEntity.getContent();\\n \\n Bitmap bitm = BitmapFactory.decodeStream(in); \\n entity.consumeContent();\\n client.getConnectionManager().shutdown();\\n } catch (MalformedURLException e) {\\n e.printStackTrace();\\n } catch (IOException e) {\\n e.printStackTrace();\\n }\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 5,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T07:07:50.790\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7207\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T08:03:50.473\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-02-27T08:03:50.473\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8567\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8567\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;android\&quot;,\n \&quot;java\&quot;,\n \&quot;decode\&quot;\n ],\n \&quot;title\&quot;: \&quot;InputStreamからBitmapへの変換でのエラー\&quot;,\n \&quot;view_count\&quot;: 950\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[],&quot;string&quot;:&quot;[]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7207&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;}}},{&quot;rowIdx&quot;:1635,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;ウェブページでどうしても空白ができてしまい困っています。 \\npタグで囲みたいのですが、pタグを使うとどうしても上下に空白ができてしまいます。 \\nこの空白を消したいです。 \\nどうしたらよいのでしょうか?\\n\\n![header-boxの画像です](https://i.stack.imgur.com/l0cn3.jpg) \\n![青い海の画像と下の同じく海の画像との間に空白ができてしまいます。](https://i.stack.imgur.com/hhnZa.jpg)\\n\\n```\\n\\n <body>\\n <div id=\\\&quot;pc-wrapper\\\&quot;>\\n <div id=\\\&quot;pc-header-box\\\&quot;>\\n <p><img src=\\\&quot;aaa\\\&quot;></p>\\n </div>\\n <div id=\\\&quot;pc-logo-box\\\&quot;>\\n <img src=\\\&quot;logo\\\&quot;>\\n </div>\\n <div id=\\\&quot;pc-page-box1\\\&quot;>\\n <p><img src=\\\&quot;bbb\\\&quot;></p>\\n </div>\\n <div id=\\\&quot;pc-page-box2\\\&quot;>\\n <p><img src=\\\&quot;bbb\\\&quot;></p>\\n </div>\\n <div id=\\\&quot;pc-page-box3\\\&quot;>\\n <p><img src=\\\&quot;ccc\\\&quot;></p>\\n </div>\\n <div id=\\\&quot;pc-page-box4\\\&quot;>\\n <p><img src=\\\&quot;ddd\\\&quot;></p>\\n </div>\\n <div id=\\\&quot;pc-page-box5\\\&quot;>\\n <p><img src=\\\&quot;eee\\\&quot;></p>\\n </div>\\n <div id=\\\&quot;pc-page-box6\\\&quot;>\\n <p><img src=\\\&quot;fff\\\&quot;></p>\\n </div>\\n </div>\\n <body>\\n \\n```\\n\\ncss\\n\\n```\\n\\n #pc-wrapper\\n {\\n display:block;\\n width:1300px;\\n height:1800px;\\n margin:0 auto;\\n }\\n \\n #pc-header-box\\n {\\n display:block;\\n position:relative;\\n width:1300px;\\n height:800px;\\n vertical-align:bottom;\\n margin:0 auto;\\n }\\n \\n #pc-logo-box\\n {\\n display:block;\\n position:relative;\\n width:1300px;\\n height:200px;\\n background-color:#30F;\\n margin:0 auto;\\n }\\n \\n #pc-logo-box img\\n {\\n display:block;\\n position:relative;\\n top:50px;\\n margin:0 auto;\\n }\\n \\n #pc-page-box1\\n {\\n display:block;\\n position:relative;\\n background-color:#69C;\\n width:650px;\\n height:430px;\\n }\\n \\n #pc-page-box1 p\\n {\\n display:block;\\n background-color:#F99;\\n }\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T07:58:45.227\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7209\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2019-12-13T17:54:53.400\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-02-27T08:02:51.997\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;3639\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7647\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;css\&quot;\n ],\n \&quot;title\&quot;: \&quot;画像の上下に空欄出てしまいます。それを消したいです\&quot;,\n \&quot;view_count\&quot;: 2929\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;`<p>` タグには多くのブラウザで上下マージンが設定されていますから、それを上書きすればいいと思います。\n\n(追記)インライン要素である `<img>` はデフォルトで `vertical-align: baseline`\nになっているため、それでも若干の隙間が空くようでした。これを避けるには `vertical-align: bottom` で上書きするか、\n`display: block` とするのがよいでしょう。\n\n参考 [(アクセシビリティも考えて)画像の下にできる余白をなくす | 誠](http://daisukenagai.com/blog/4.html)\n\n上記2点を合わせて、こんな感じでいがかでしょうか。\n\n```\n\n #pc-wrapper p\n {\n margin: 0;\n }\n #pc-wrapper img\n {\n display: block;\n /* imgを横にも並べたい時など、 vertical-align: bottom でもOK */\n }\n \n```\n\nサンプル\n\n```\n\n p {\r\n margin: 0;\r\n }\r\n \r\n img {\r\n /* display: block; */\r\n vertical-align: bottom;\r\n }\n```\n\n```\n\n <p><img src=\&quot;http://dummyimage.com/100x100/000/fff\&quot; /><img src=\&quot;http://dummyimage.com/100x100/000/fff\&quot; /></p>\r\n <p><img src=\&quot;http://dummyimage.com/100x100/000/fff\&quot; /></p>\n```\n\n余談ですが、 `<div>` や `<p>` は元々ブロック要素ですから、どこかで上書きされていない限り `display: block`\nは不要ではないでしょうか。&quot;,&quot;comment_count&quot;:5,&quot;content_license&quot;:&quot;CC BY-SA 4.0&quot;,&quot;creation_date&quot;:&quot;2015-02-27T08:23:57.960&quot;,&quot;id&quot;:&quot;7211&quot;,&quot;last_activity_date&quot;:&quot;2019-12-13T17:54:53.400&quot;,&quot;last_edit_date&quot;:&quot;2019-12-13T17:54:53.400&quot;,&quot;last_editor_user_id&quot;:&quot;32986&quot;,&quot;owner_user_id&quot;:&quot;8000&quot;,&quot;parent_id&quot;:&quot;7209&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;`<p>` タグには多くのブラウザで上下マージンが設定されていますから、それを上書きすればいいと思います。\\n\\n(追記)インライン要素である `<img>` はデフォルトで `vertical-align: baseline`\\nになっているため、それでも若干の隙間が空くようでした。これを避けるには `vertical-align: bottom` で上書きするか、\\n`display: block` とするのがよいでしょう。\\n\\n参考 [(アクセシビリティも考えて)画像の下にできる余白をなくす | 誠](http://daisukenagai.com/blog/4.html)\\n\\n上記2点を合わせて、こんな感じでいがかでしょうか。\\n\\n```\\n\\n #pc-wrapper p\\n {\\n margin: 0;\\n }\\n #pc-wrapper img\\n {\\n display: block;\\n /* imgを横にも並べたい時など、 vertical-align: bottom でもOK */\\n }\\n \\n```\\n\\nサンプル\\n\\n```\\n\\n p {\\r\\n margin: 0;\\r\\n }\\r\\n \\r\\n img {\\r\\n /* display: block; */\\r\\n vertical-align: bottom;\\r\\n }\\n```\\n\\n```\\n\\n <p><img src=\\\&quot;http://dummyimage.com/100x100/000/fff\\\&quot; /><img src=\\\&quot;http://dummyimage.com/100x100/000/fff\\\&quot; /></p>\\r\\n <p><img src=\\\&quot;http://dummyimage.com/100x100/000/fff\\\&quot; /></p>\\n```\\n\\n余談ですが、 `<div>` や `<p>` は元々ブロック要素ですから、どこかで上書きされていない限り `display: block`\\nは不要ではないでしょうか。\&quot;,\n \&quot;comment_count\&quot;: 5,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 4.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T08:23:57.960\&quot;,\n \&quot;id\&quot;: \&quot;7211\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2019-12-13T17:54:53.400\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2019-12-13T17:54:53.400\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;32986\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8000\&quot;,\n \&quot;parent_id\&quot;: \&quot;7209\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7209&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7211&quot;}}},{&quot;rowIdx&quot;:1636,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7218\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;ボタンを押すと`TableView`のセルを拡大させようとしており、セルは拡大するのですが、その拡大したセルの下のセルが、拡大の影響で少し隠れてしまいます。なので隠れるセルを下にずらしたいのですが、現在のコードだとなぜか上のセルが下にずれてしまいます。 \\n下記にコードを記します。全て載せると長くなるので、大事だと思うところを載せました。 \\nなぜ一つ上のセルが下にずれてしまうのでしょうか? \\nどなたか分かる方がいれば教えていただきたいです。すみませんが、よろしくお願いします。\\n\\nViewController.m\\n\\n```\\n\\n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\\n \\n static const id identifiers[4] = {@\\\&quot;normalCell\\\&quot;, @\\\&quot;cell\\\&quot;, @\\\&quot;halfCell\\\&quot;, @\\\&quot;normalCell\\\&quot;};\\n NSString *CellIdentifier = identifiers[indexPath.row];\\n \\n UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];\\n if (cell == nil) {\\n switch (indexPath.row) {\\n case 0:\\n cell = [[NormalScrollCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];\\n break;\\n case 1:\\n cell = [[PagerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];\\n break;\\n case 2:\\n cell = [[HalfPager alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];\\n break;\\n default:\\n cell = [[NormalScrollCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];\\n break;\\n }\\n }\\n \\n PagerCell *pagerCell = (PagerCell*)cell;\\n NormalScrollCell *normalCell = (NormalScrollCell*)cell;\\n HalfPager *halfCell = (HalfPager*)cell;\\n \\n switch (indexPath.row) {\\n case 0:\\n [normalCell setNormalScrollPager:normalCell.normalScrollPager];\\n break;\\n case 1:\\n [pagerCell setViewPager:pagerCell.viewPager :pagerCell :halfCell];\\n break;\\n case 2:\\n [halfCell setHalfPager:halfCell.scrollView];\\n break;\\n default:\\n [normalCell setNormalScrollPager:normalCell.normalScrollPager];\\n break;\\n }\\n \\n return cell;\\n }\\n \\n```\\n\\nPagerCell.m\\n\\n```\\n\\n - (void)setViewPager:(UIScrollView *)scrollView :(PagerCell*)cell :(HalfPager*)halfPager{\\n _pagerCell = cell;\\n _halfCell = halfPager;\\n pagerScroll = scrollView;\\n \\n for (NSUInteger i = 1; i <= 3; i++) {\\n NSString *imageName = [NSString stringWithFormat:@\\\&quot;image%d.png\\\&quot;, i];\\n UIImage *image = [UIImage imageNamed:imageName];\\n UIImageView *imageView = [[UIImageView alloc] initWithImage:image];\\n \\n CGRect rect = imageView.frame;\\n rect.size.height = kScrollObjHeight;\\n rect.size.width = kScrollObjWidth;\\n imageView.frame = rect;\\n imageView.tag = i;\\n [scrollView addSubview:imageView];\\n \\n [self saveImageView:imageView :i];\\n }\\n \\n [self layoutScrollImages];\\n }\\n \\n - (void)changeImageViewSize:(UIImageView*)imageView { //ボタンが押された時の拡大処理\\n CGRect imageViewRect = imageView.frame;\\n imageViewRect.size.height = kScrollObjHeight * 1.5;\\n imageView.frame = imageViewRect;\\n \\n _halfCell.frame = CGRectOffset(_halfCell.frame, 0, 50); //セルを下にずらす処理を行っている\\n }\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T09:21:21.280\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7213\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T10:06:03.363\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5210\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 0,\n \&quot;tags\&quot;: [\n \&quot;objective-c\&quot;,\n \&quot;uitableview\&quot;\n ],\n \&quot;title\&quot;: \&quot;TableViewのセルを下にずらす\&quot;,\n \&quot;view_count\&quot;: 333\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;セルの高さだけ変更したのでは、だめですよ。テーブルの行の高さも、いっしょに変えないと。 \nテーブルの行の高さは、UITableViewDelegateプロトコルの、\n\n```\n\n - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath\n \n```\n\nに実装します。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-27T10:06:03.363&quot;,&quot;id&quot;:&quot;7218&quot;,&quot;last_activity_date&quot;:&quot;2015-02-27T10:06:03.363&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7362&quot;,&quot;parent_id&quot;:&quot;7213&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:0}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;セルの高さだけ変更したのでは、だめですよ。テーブルの行の高さも、いっしょに変えないと。 \\nテーブルの行の高さは、UITableViewDelegateプロトコルの、\\n\\n```\\n\\n - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath\\n \\n```\\n\\nに実装します。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T10:06:03.363\&quot;,\n \&quot;id\&quot;: \&quot;7218\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T10:06:03.363\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7362\&quot;,\n \&quot;parent_id\&quot;: \&quot;7213\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 0\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7213&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7218&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7218&quot;}}},{&quot;rowIdx&quot;:1637,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;html\\n\\n```\\n\\n <a href=\\\&quot;hoge\\\&quot;>1</a>\\n <a href=\\\&quot;huga\\\&quot;>2</a>\\n <a href=\\\&quot;hogehoge\\\&quot;>3</a>\\n <a href=\\\&quot;hugahuga\\\&quot;>4</a>\\n \\n```\\n\\njquery\\n\\n```\\n\\n $('a').onAttr('href', 'hoge'); // 1のjqueryオブジェクト\\n $('a').onAttr('href', 'huga'); // 2のjqueryオブジェクト\\n $('a').onAttr('href', /hoge/); // 1,4のjqueryオブジェクト\\n $('a').onAttr('href', /huga/); // 2,3のjqueryオブジェクト\\n \\n```\\n\\nこのように'href'がマッチした要素を取得したいのですが、どのようにしたらよいのでしょうか。 \\n`a`を取得して`each`で回してチェックするやり方しか思いつきません・・・。\&quot;,\n \&quot;comment_count\&quot;: 4,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T09:55:05.783\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7215\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-05-21T11:30:18.463\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7339\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;javascript\&quot;,\n \&quot;html\&quot;,\n \&quot;jquery\&quot;\n ],\n \&quot;title\&quot;: \&quot;jqueryで要素の属性で絞り込む方法はありますか?\&quot;,\n \&quot;view_count\&quot;: 493\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;[user7339さんコメント](https://ja.stackoverflow.com/questions/7215/#comment6369_7215):\n\n> 解決しました。ありがとうございます。`$('a[href*=\&quot;部分マッチ\&quot;]')`&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-05-21T11:30:18.463&quot;,&quot;id&quot;:&quot;10468&quot;,&quot;last_activity_date&quot;:&quot;2015-05-21T11:30:18.463&quot;,&quot;last_edit_date&quot;:&quot;2017-04-13T12:52:39.113&quot;,&quot;last_editor_user_id&quot;:&quot;-1&quot;,&quot;owner_user_id&quot;:&quot;49&quot;,&quot;parent_id&quot;:&quot;7215&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;[user7339さんコメント](https://ja.stackoverflow.com/questions/7215/#comment6369_7215):\\n\\n> 解決しました。ありがとうございます。`$('a[href*=\\\&quot;部分マッチ\\\&quot;]')`\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-05-21T11:30:18.463\&quot;,\n \&quot;id\&quot;: \&quot;10468\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-05-21T11:30:18.463\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2017-04-13T12:52:39.113\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;49\&quot;,\n \&quot;parent_id\&quot;: \&quot;7215\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7215&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;10468&quot;}}},{&quot;rowIdx&quot;:1638,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;Django の `django-social-auth` のプラグインを使ってます。\\n\\nこちらで Facebook で認証した後に生成されたユーザで Django の admin に入りたいと思ってます。\\n\\nまず、models.py にこのユーザを作成し、 \\nis_staff を無理やり True にしようと、以下のようにしました。\\n\\n```\\n\\n class CustomUser(User):\\n class Meta:\\n verbose_name = u'カスタムユーザ'\\n verbose_name_plural = verbose_name\\n \\n def __init__(self, *args, **kwargs):\\n super(User, self).__init__(*args, **kwargs)\\n # self._meta.get_field('is_staff').default = True # 試したが出来ない\\n super(User, self)._meta.get_field('is_staff').default = True\\n \\n # CustomUser._meta.get_field('is_staff').default = True\\n \\n```\\n\\nsettings.py にて\\n\\n```\\n\\n SOCIAL_AUTH_USER_MODEL = 'my_app.CustomUser' \\n \\n```\\n\\nのように行いました。 \\nコメントアウトしたものもいろいろ試しました。\\n\\nしかし、Facebook ユーザでログインできませんでした。\\n\\n次に、それらしき記事を見つけました。\\n\\n<https://djangosnippets.org/snippets/2856/>\\n\\nしかし、出来ませんでした。 \\nsettings.py の中では、 \\n`USE_SOCIAL_AUTH_AS_ADMIN_LOGIN` なのに、admin.pyで\\n`SOCIAL_AUTH_USE_AS_ADMIN_LOGIN` \\nとなってるものおかしいと思い同じ変数に変更しましたがそれでも出来ませんでした。\\n\\nもし解決策がありましたら、ご教示いただきたいです。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T09:55:50.773\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7216\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-07-29T12:48:58.477\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-02-28T08:28:42.167\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7934\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;python\&quot;,\n \&quot;oauth\&quot;,\n \&quot;social-framework\&quot;,\n \&quot;facebook-api\&quot;,\n \&quot;django\&quot;\n ],\n \&quot;title\&quot;: \&quot;Django の social_auth の Facebook ユーザで admin に入る\&quot;,\n \&quot;view_count\&quot;: 205\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;> しかし、Facebook ユーザでログインできませんでした。\n\nここが、Django側でユーザーが作成されているかで違ってくると思います。 \nので、\n\n> is_staff を無理やり True にしようと\n\nこの部分についてのみ回答します。以下、CutomUserの改善コードです。\n\n```\n\n class CustomUser(User):\n class Meta:\n verbose_name = u'カスタムユーザ'\n verbose_name_plural = verbose_name\n \n def __init__(self, *args, **kwargs):\n super(User, self).__init__(*args, **kwargs)\n self.is_staff = True \n \n```\n\n`__init__()` の最初の処理ですでに `is_staff` が `False` になっているので、次の処理で無条件に `True` にしています。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T10:22:21.137&quot;,&quot;id&quot;:&quot;7272&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T10:22:21.137&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;2784&quot;,&quot;parent_id&quot;:&quot;7216&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;> しかし、Facebook ユーザでログインできませんでした。\\n\\nここが、Django側でユーザーが作成されているかで違ってくると思います。 \\nので、\\n\\n> is_staff を無理やり True にしようと\\n\\nこの部分についてのみ回答します。以下、CutomUserの改善コードです。\\n\\n```\\n\\n class CustomUser(User):\\n class Meta:\\n verbose_name = u'カスタムユーザ'\\n verbose_name_plural = verbose_name\\n \\n def __init__(self, *args, **kwargs):\\n super(User, self).__init__(*args, **kwargs)\\n self.is_staff = True \\n \\n```\\n\\n`__init__()` の最初の処理ですでに `is_staff` が `False` になっているので、次の処理で無条件に `True` にしています。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T10:22:21.137\&quot;,\n \&quot;id\&quot;: \&quot;7272\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T10:22:21.137\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;2784\&quot;,\n \&quot;parent_id\&quot;: \&quot;7216\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7216&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7272&quot;}}},{&quot;rowIdx&quot;:1639,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 0,\n \&quot;body\&quot;: \&quot;memcachedで有効キー(期限切れではない)の総数を取得したいと思っています。 \\nただし、プログラム側で有効キー数を全て抽出してその数を出すということは、1回/秒という頻度で行いたいこともありサーバ負荷がかかるのでやりたくありません。 \\nstatsのcurr_itemsで現在のデータ数は取得できますが、有効期限切れてる/切れていないの総数のようです。 \\nどなたかサーバの負荷をあまりかけず有効キーの総数を取得する方法をご存知ないでしょうか。よろしくお願いします。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T10:09:51.363\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7219\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T12:18:58.157\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-02-27T12:18:58.157\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;76\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8593\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 5,\n \&quot;tags\&quot;: [\n \&quot;memcached\&quot;\n ],\n \&quot;title\&quot;: \&quot;memcachedの有効キー総数\&quot;,\n \&quot;view_count\&quot;: 132\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[],&quot;string&quot;:&quot;[]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7219&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;}}},{&quot;rowIdx&quot;:1640,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7233\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;XcodeのstoryboardでConstraintsで指定したオブジェクトの大きさを見ながら開発したいと思っています。 \\nsize inspectorのConstraintsで数字指定してもstoryboard上(Canvas)のオブジェクトには反映されません。逆に”Use\\ncanvas size”と指定するとCanvas上のサイズが反映されます。 \\nWidthやHeightに数字指定するとCanvas上のオブジェクトに反映されるということをやりたいのですが、どこかに設定でもあるのでしょうか。 \\nご存知の方、ご教示お願いします。\\n\\n----(設定状態追加) ---- \\n![Constraints設定](https://i.stack.imgur.com/RSpgR.png) \\n画面イメージを追加しました。右の方でConstraintsをUIWebViewに対し上下左右100pt設定していますが、Canvas上では反映されておらず右に174pt,\\n下に390pt設定された状態になっています。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T10:20:33.610\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7220\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T04:42:09.580\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T15:14:58.813\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8593\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8593\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;xcode\&quot;,\n \&quot;storyboard\&quot;\n ],\n \&quot;title\&quot;: \&quot;Xcodeのstoryboardでsize inspectorのConstraints指定したオブジェクトの大きさを把握したい\&quot;,\n \&quot;view_count\&quot;: 398\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;制約で指定されている値を修正する場合、以下の手順でどうでしょうか?\n\n![制約の値を修正](https://i.stack.imgur.com/dyhTn.png)\n\n* * *\n\n制約で指定されている値をフレームに反映する場合、以下の手順でどうでしょうか?\n\n![制約の値をフレームに反映](https://i.stack.imgur.com/qRIFB.png)&quot;,&quot;comment_count&quot;:4,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-27T14:58:01.243&quot;,&quot;id&quot;:&quot;7233&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T04:42:09.580&quot;,&quot;last_edit_date&quot;:&quot;2015-03-02T04:42:09.580&quot;,&quot;last_editor_user_id&quot;:&quot;7459&quot;,&quot;owner_user_id&quot;:&quot;7459&quot;,&quot;parent_id&quot;:&quot;7220&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;制約で指定されている値を修正する場合、以下の手順でどうでしょうか?\\n\\n![制約の値を修正](https://i.stack.imgur.com/dyhTn.png)\\n\\n* * *\\n\\n制約で指定されている値をフレームに反映する場合、以下の手順でどうでしょうか?\\n\\n![制約の値をフレームに反映](https://i.stack.imgur.com/qRIFB.png)\&quot;,\n \&quot;comment_count\&quot;: 4,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T14:58:01.243\&quot;,\n \&quot;id\&quot;: \&quot;7233\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T04:42:09.580\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T04:42:09.580\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7459\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7459\&quot;,\n \&quot;parent_id\&quot;: \&quot;7220\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7220&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7233&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7233&quot;}}},{&quot;rowIdx&quot;:1641,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7232\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;XcodeでViewの上にUIWebViewを置いています。 \\n画面いっぱいにUIWebViewを広げたく、Tailing Space, Leading Space, Bottom Space, Top\\nSpaceの値をSuperview(view)から”0”に設定すると左右に空白が発生します。Tailing Space, Leading\\nSpaceの値を”-16”にすると画面いっぱいになります。非常に違和感を感じます。これはpaddingか何かある状態なのでしょうか?通常の状態なのでしょうか?なぜ、このようなことになっているかわかりません。ご存知の方、ご教示お願いします。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T10:25:49.620\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7221\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T14:50:10.883\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8593\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 0,\n \&quot;tags\&quot;: [\n \&quot;xcode\&quot;,\n \&quot;storyboard\&quot;\n ],\n \&quot;title\&quot;: \&quot;UIWebViewのConstrains制限の違和感\&quot;,\n \&quot;view_count\&quot;: 263\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;マージンに設定された値を基準として使用するかどうか、AutoLayoutを指定する画面で設定出来るようになっています。\n\n![制約の対象をマージンにする](https://i.stack.imgur.com/NBlKU.png)\n\nチェックを付けた場合、-16で画面の端になります(モーダル表示した場合は変わってきますが)。チェックを外した場合、0が画面の端を表すようになります。\n\nさらに細かい情報については、こちらが参考になるかと。\n\nios - What is \&quot;Constrain to margin\&quot; in Storyboard in Xcode 6 - Stack Overflow \n<https://stackoverflow.com/questions/25807545/what-is-constrain-to-margin-in-\nstoryboard-in-xcode-6>&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-27T14:50:10.883&quot;,&quot;id&quot;:&quot;7232&quot;,&quot;last_activity_date&quot;:&quot;2015-02-27T14:50:10.883&quot;,&quot;last_edit_date&quot;:&quot;2020-06-17T08:14:45.997&quot;,&quot;last_editor_user_id&quot;:&quot;-1&quot;,&quot;owner_user_id&quot;:&quot;7459&quot;,&quot;parent_id&quot;:&quot;7221&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;マージンに設定された値を基準として使用するかどうか、AutoLayoutを指定する画面で設定出来るようになっています。\\n\\n![制約の対象をマージンにする](https://i.stack.imgur.com/NBlKU.png)\\n\\nチェックを付けた場合、-16で画面の端になります(モーダル表示した場合は変わってきますが)。チェックを外した場合、0が画面の端を表すようになります。\\n\\nさらに細かい情報については、こちらが参考になるかと。\\n\\nios - What is \\\&quot;Constrain to margin\\\&quot; in Storyboard in Xcode 6 - Stack Overflow \\n<https://stackoverflow.com/questions/25807545/what-is-constrain-to-margin-in-\\nstoryboard-in-xcode-6>\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T14:50:10.883\&quot;,\n \&quot;id\&quot;: \&quot;7232\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T14:50:10.883\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2020-06-17T08:14:45.997\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7459\&quot;,\n \&quot;parent_id\&quot;: \&quot;7221\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7221&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7232&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7232&quot;}}},{&quot;rowIdx&quot;:1642,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;あるサービスにプログラム上からPythonでログインしたいと思っています。 \\nしかし、「動作環境が対象外です」というページに飛ばされてしまいます。 \\nUser-Agentを偽装しても同じようなことが起こってしまいます。 \\nUser-Agent以外で環境を判定しているような箇所はないのでしょうか? \\n必要な情報は全て、POSTで送っています。 \\nちなみにリクエストを送る先は.jspファイルです。 \\n送っているデータはUserid, passwordでUserIdは8桁の数字、passwordは8文字の英数字です。 \\nちなみにこのサービスの実装がどうなっているのか、私はわかりません。 \\nStatusは200 OKを返しています。\\n\\n```\\n\\n \\n import urllib.request\\n import urllib.parse\\n \\n post_data = {\\\&quot;UserId\\\&quot;: 12345678, \\\&quot;Password\\\&quot;: \\\&quot;password\\\&quot;}\\n encoded_data = urllib.parse.urlencode(post_data).encode()\\n req = urllib.request.Request(\\\&quot;http://example.com/login\\\&quot;, \\n encoded_data,\\n headers={\\\&quot;User-Agent\\\&quot;: \\\&quot;Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\\\&quot;})\\n res = urllib.request.urlopen(req)\\n res_read = res.read().decode(\\\&quot;shift-jis\\\&quot;) # res_readに\\\&quot;動作環境が対象外です\\\&quot;の文字が含まれています。\\n \\n \\n```\\n\\n必要な動作環境は以下の通りです。\\n\\nWindows Vista SP2以上 \\n・Internet Explorer 7 \\n・Internet Explorer 8 \\n・Internet Explorer 9 \\n・Google Chrome\\n\\nWindows 7 \\n・Internet Explorer 8 \\n・Internet Explorer 9 \\n・Internet Explorer 10 \\n・Internet Explorer 11 \\n・Google Chrome\\n\\nWindows 8 (デスクトップUI) \\n・Internet Explorer 10\\n\\nWindows 8.1 (デスクトップUI) \\n・Internet Explorer 11\\n\\nMac OS X 10.6 \\n・Safari 5.1.7\\n\\nMac OS X 10.7 \\n・Safari 5.1.7\&quot;,\n \&quot;comment_count\&quot;: 9,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T10:42:56.110\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7223\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-06T12:53:05.813\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T10:03:38.750\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;5246\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;5246\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 0,\n \&quot;tags\&quot;: [\n \&quot;python\&quot;,\n \&quot;http\&quot;,\n \&quot;jsp\&quot;\n ],\n \&quot;title\&quot;: \&quot;ブラウザの動作環境の判定\&quot;,\n \&quot;view_count\&quot;: 942\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;> User-Agent以外で環境を判定しているような箇所はないのでしょうか?\n\nブラウザやOSを判別したい **だけ**\nならUAで事足りることも多いですが、それだけを理由に「動作環境が対象外です」というエラーが表示されるとは限りません。\n\nですから、エラーが出る原因となる箇所は **いくらでも考えられます**\n。また、これまでに質問者さんが提示している情報では、それが具体的に何かまではわかりません。\n\n## どうやって調べるか\n\nどのように実装されているかわからない以上、あなたがブラウザを操作してログインできた、という時に行われた通信が一番の参考資料になります。これを各種ツールで覗き見ることになるでしょう。\n\n * ブラウザのデバッグ機能(Chromeでいえば開発者ツールのNetworkタブ)\n * Fiddlerなどのデバッグプロキシ\n * Wiresharkなどのパケットキャプチャツール\n\n* * *\n\nというのが一般的な回答になると思いますが、個人的な想像としては・・・。\n\nログイン画面なのにIDとパスワードだけしかPOSTしないなんてのはセキュリティがーって言われそうなので、POSTするパラメータも足りてない気がします。`<input\ntype=\&quot;hidden\&quot;>` とかHTMLに書かれていませんか?CookieにもセッションIDとか入ってそうです。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-06T12:53:05.813&quot;,&quot;id&quot;:&quot;7556&quot;,&quot;last_activity_date&quot;:&quot;2015-03-06T12:53:05.813&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8000&quot;,&quot;parent_id&quot;:&quot;7223&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;> User-Agent以外で環境を判定しているような箇所はないのでしょうか?\\n\\nブラウザやOSを判別したい **だけ**\\nならUAで事足りることも多いですが、それだけを理由に「動作環境が対象外です」というエラーが表示されるとは限りません。\\n\\nですから、エラーが出る原因となる箇所は **いくらでも考えられます**\\n。また、これまでに質問者さんが提示している情報では、それが具体的に何かまではわかりません。\\n\\n## どうやって調べるか\\n\\nどのように実装されているかわからない以上、あなたがブラウザを操作してログインできた、という時に行われた通信が一番の参考資料になります。これを各種ツールで覗き見ることになるでしょう。\\n\\n * ブラウザのデバッグ機能(Chromeでいえば開発者ツールのNetworkタブ)\\n * Fiddlerなどのデバッグプロキシ\\n * Wiresharkなどのパケットキャプチャツール\\n\\n* * *\\n\\nというのが一般的な回答になると思いますが、個人的な想像としては・・・。\\n\\nログイン画面なのにIDとパスワードだけしかPOSTしないなんてのはセキュリティがーって言われそうなので、POSTするパラメータも足りてない気がします。`<input\\ntype=\\\&quot;hidden\\\&quot;>` とかHTMLに書かれていませんか?CookieにもセッションIDとか入ってそうです。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-06T12:53:05.813\&quot;,\n \&quot;id\&quot;: \&quot;7556\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-06T12:53:05.813\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8000\&quot;,\n \&quot;parent_id\&quot;: \&quot;7223\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7223&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7556&quot;}}},{&quot;rowIdx&quot;:1643,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7251\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;下記違いは何でしょうか?\\n\\n```\\n\\n Object.create(Object.prototype);\\n \\n Object.create({});\\n \\n```\\n\\n・上 … null をプロトタイプとするオブジェクト \\n・下 … 上 をプロトタイプとするオブジェクト?\\n\\n・それぞれメリットデメリットがあれば知りたいです\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T10:51:52.163\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7224\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-28T11:46:15.003\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7886\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;javascript\&quot;\n ],\n \&quot;title\&quot;: \&quot;Object.create(Object.prototype);とObject.create({});の違い\&quot;,\n \&quot;view_count\&quot;: 175\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;どちらも実質的には同じですので、メリットデメリットといったものはありません。\n\n厳密には、下の`Object.create({});`は以下のコードと等価です。\n\n```\n\n Object.create(Object.create(Object.prototype));\n \n```\n\n内部的にはプロトタイプチェーンの階層が異なります。\n\nつまり、`Object.create(Object.prototype);`は直接の`prototype`が`Object.prototype`であるオブジェクトを生成しますが、`Object.create({});`の場合は直接の`prototype`は`{}`によって生成されたオブジェクトになります。その`{}`によって生成されたオブジェクトの`prototype`は`Object.prototype`です。\n\n```\n\n a = {};\n \n b = Object.create(Object.prototype);\n a.isPrototypeOf(b); // false\n Object.prototype.isPrototypeOf(b); // true\n \n b = Object.create(a);\n a.isPrototypeOf(b); // true\n Object.prototype.isPrototypeOf(b); // true\n \n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-28T11:46:15.003&quot;,&quot;id&quot;:&quot;7251&quot;,&quot;last_activity_date&quot;:&quot;2015-02-28T11:46:15.003&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;3639&quot;,&quot;parent_id&quot;:&quot;7224&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:4}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;どちらも実質的には同じですので、メリットデメリットといったものはありません。\\n\\n厳密には、下の`Object.create({});`は以下のコードと等価です。\\n\\n```\\n\\n Object.create(Object.create(Object.prototype));\\n \\n```\\n\\n内部的にはプロトタイプチェーンの階層が異なります。\\n\\nつまり、`Object.create(Object.prototype);`は直接の`prototype`が`Object.prototype`であるオブジェクトを生成しますが、`Object.create({});`の場合は直接の`prototype`は`{}`によって生成されたオブジェクトになります。その`{}`によって生成されたオブジェクトの`prototype`は`Object.prototype`です。\\n\\n```\\n\\n a = {};\\n \\n b = Object.create(Object.prototype);\\n a.isPrototypeOf(b); // false\\n Object.prototype.isPrototypeOf(b); // true\\n \\n b = Object.create(a);\\n a.isPrototypeOf(b); // true\\n Object.prototype.isPrototypeOf(b); // true\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T11:46:15.003\&quot;,\n \&quot;id\&quot;: \&quot;7251\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-28T11:46:15.003\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;3639\&quot;,\n \&quot;parent_id\&quot;: \&quot;7224\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 4\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7224&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7251&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7251&quot;}}},{&quot;rowIdx&quot;:1644,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7229\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;Golangでsudoでコマンドを実行するにはどうすればいいのでしょうか? \\nPythonなどの他の言語では\\n\\n```\\n\\n \\n os.system(\\\&quot;echo 'mypassword' | sudo -S command\\\&quot;)\\n \\n \\n```\\n\\nとすれば \\n実行できますがGolangではどのようにすれば良いのでしょうか?\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T13:11:10.663\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7228\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T13:30:38.697\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5246\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;bash\&quot;,\n \&quot;go\&quot;\n ],\n \&quot;title\&quot;: \&quot;Golangでパスワードを入力せずにsudoでコマンドを実行する\&quot;,\n \&quot;view_count\&quot;: 1125\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;`exec.Command`を使用します。\n\n```\n\n package main\n \n import (\n \&quot;log\&quot;\n \&quot;os\&quot;\n \&quot;os/exec\&quot;\n \&quot;strings\&quot;\n )\n \n func main() {\n cmd := exec.Command(\&quot;sudo\&quot;, \&quot;-S\&quot;, \&quot;command\&quot;)\n cmd.Stdin = strings.NewReader(\&quot;mypassword\&quot; + \&quot;\\n\&quot;)\n cmd.Stdout = os.Stdout\n \n err := cmd.Run()\n if err != nil {\n log.Fatal(err)\n }\n }\n \n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-27T13:23:16.220&quot;,&quot;id&quot;:&quot;7229&quot;,&quot;last_activity_date&quot;:&quot;2015-02-27T13:23:16.220&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;3639&quot;,&quot;parent_id&quot;:&quot;7228&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;`exec.Command`を使用します。\\n\\n```\\n\\n package main\\n \\n import (\\n \\\&quot;log\\\&quot;\\n \\\&quot;os\\\&quot;\\n \\\&quot;os/exec\\\&quot;\\n \\\&quot;strings\\\&quot;\\n )\\n \\n func main() {\\n cmd := exec.Command(\\\&quot;sudo\\\&quot;, \\\&quot;-S\\\&quot;, \\\&quot;command\\\&quot;)\\n cmd.Stdin = strings.NewReader(\\\&quot;mypassword\\\&quot; + \\\&quot;\\\\n\\\&quot;)\\n cmd.Stdout = os.Stdout\\n \\n err := cmd.Run()\\n if err != nil {\\n log.Fatal(err)\\n }\\n }\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T13:23:16.220\&quot;,\n \&quot;id\&quot;: \&quot;7229\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T13:23:16.220\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;3639\&quot;,\n \&quot;parent_id\&quot;: \&quot;7228\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7228&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7229&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7229&quot;}}},{&quot;rowIdx&quot;:1645,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7237\&quot;,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;swiftで実装をしていて、ビルドは通るものの、 \\nアプリ起動後に、 \\nfatal error: unexpectedly found nil while unwrapping an Optional value \\nのエラーが出る場合、ソースコードのどこが原因かを探るデバッグはどのように進めていくのが定石なのでしょうか?\\n\\nよくこのエラーではまるのですが、どのファイルの何行目でこのエラーが起きているのかまで表示されないため、毎回ソースコードを全部見て原因を探っていて \\nもっと効率的なデバッグ方法があればと思い質問してみました。\\n\\n追記 \\n具体的には↓のような画面でとまります。 \\nbreakpoint navigator でException Breakpoint を追加しても特に変わりありません。\\n\\n![画像の説明をここに入力](https://i.stack.imgur.com/3JGWV.png)\\n\\nよろしくお願いします。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T13:58:22.580\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7231\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T01:54:11.417\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-02-27T15:55:28.217\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;5852\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;5852\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;objective-c\&quot;,\n \&quot;swift\&quot;,\n \&quot;xcode\&quot;\n ],\n \&quot;title\&quot;: \&quot;swiftでfatal error: unexpectedly found nil while unwrapping an Optional valueが出た時のデバッグ方法\&quot;,\n \&quot;view_count\&quot;: 4821\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;特に何も設定しなくても、以下の様な感じでエラーの原因となった行が表示されないでしょうか・・・?\n\n![エラーが発生](https://i.stack.imgur.com/gJaOv.png)\n\nうまく動作しない場合、以下の設定でどうにか出来るかもしれません。\n\n![例外にブレークポイントを設定](https://i.stack.imgur.com/5i8Pp.png)&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-27T15:21:30.160&quot;,&quot;id&quot;:&quot;7234&quot;,&quot;last_activity_date&quot;:&quot;2015-02-27T15:21:30.160&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7459&quot;,&quot;parent_id&quot;:&quot;7231&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;示されてる画面の左側のペインにはスタックフレーム(クラッシュが発生する地点までにどのようなメソッドが呼ばれたか)が表示されています。\n\n上の方が新しくて、下に行くほど、過去にさかのぼることになります。\n\n直接のクラッシュが発生しているのは運悪くシステムのコードに当たっていますが、一つさかのぼると、おそらくご自分で書かれたコードのクラッシュを引き起こしている箇所が表示されると思います。\n\n↓ 下記に示すように赤く囲ったところをクリックしてみてください。 \n画像では右が切れているので詳細はわかりませんが、おそらく、`iBeaconCentral`というクラスのテーブルビューのデリゲートメソッドのどこかが表示されると思います。\n\n基本的にはそこがクラッシュの直接の原因です。\n\n![画像の説明をここに入力](https://i.stack.imgur.com/x2Fxx.png)&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-27T18:17:00.630&quot;,&quot;id&quot;:&quot;7237&quot;,&quot;last_activity_date&quot;:&quot;2015-02-27T18:17:00.630&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5519&quot;,&quot;parent_id&quot;:&quot;7231&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;特に何も設定しなくても、以下の様な感じでエラーの原因となった行が表示されないでしょうか・・・?\\n\\n![エラーが発生](https://i.stack.imgur.com/gJaOv.png)\\n\\nうまく動作しない場合、以下の設定でどうにか出来るかもしれません。\\n\\n![例外にブレークポイントを設定](https://i.stack.imgur.com/5i8Pp.png)\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T15:21:30.160\&quot;,\n \&quot;id\&quot;: \&quot;7234\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T15:21:30.160\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7459\&quot;,\n \&quot;parent_id\&quot;: \&quot;7231\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;示されてる画面の左側のペインにはスタックフレーム(クラッシュが発生する地点までにどのようなメソッドが呼ばれたか)が表示されています。\\n\\n上の方が新しくて、下に行くほど、過去にさかのぼることになります。\\n\\n直接のクラッシュが発生しているのは運悪くシステムのコードに当たっていますが、一つさかのぼると、おそらくご自分で書かれたコードのクラッシュを引き起こしている箇所が表示されると思います。\\n\\n↓ 下記に示すように赤く囲ったところをクリックしてみてください。 \\n画像では右が切れているので詳細はわかりませんが、おそらく、`iBeaconCentral`というクラスのテーブルビューのデリゲートメソッドのどこかが表示されると思います。\\n\\n基本的にはそこがクラッシュの直接の原因です。\\n\\n![画像の説明をここに入力](https://i.stack.imgur.com/x2Fxx.png)\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T18:17:00.630\&quot;,\n \&quot;id\&quot;: \&quot;7237\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T18:17:00.630\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5519\&quot;,\n \&quot;parent_id\&quot;: \&quot;7231\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7231&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7237&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7237&quot;}}},{&quot;rowIdx&quot;:1646,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 0,\n \&quot;body\&quot;: \&quot;Symfony\\n2.6と、[FOSUserBundle](https://github.com/FriendsOfSymfony/FOSUserBundle)を使い、ユーザー登録が必要なサイトを作ろうとしています。 \\nデフォルトで用意されているフィールド以外に、String型のカスタムフィールドを持った上でカスタムバリデーションを設定し、指定のDB上のカラムへとORM経由で入力したいと考えました。\\n\\n<https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_forms.md> \\n上記、FOSUserBundleの公式ドキュメントに書いてある通り、src/Acme/UserBundle/Entity/User.php で\\nFOS\\\\UserBundle\\\\Model\\\\User をオーバーライドする方法でこの機能を実装しようと試みました。\\n\\n結果として、フォームとバリデーションに関しては正常に動作するようになりました。 \\nしかし、そこから入力された値が入るはずのカラムが生成されません。 \\n上記公式ドキュメントの指示通りにString型のカスタムフィールドを実装した後、[このサイト](http://old.ganchiku.com/blog/2012/05/1175.html)を参考に\\n\\n```\\n\\n php app/console doctrine:generate:entities Acme\\n \\n```\\n\\n> [以下出力] \\n> Generating entities for namespace \\\&quot;Acme\\\&quot; \\n> backing up User.php to User.php~ \\n> generating Acme\\\\UserBundle\\\\Entity\\\\User\\n\\nでアクセサを作成し、\\n\\n```\\n\\n php console doctrine:schema:update --force\\n \\n```\\n\\nでスキーマをアップデートし、この時点でカスタムフィールドを格納するカラムがDB上に生成されるはずでした。 \\nしかし、schema:updateでは以下のメッセージが出力されるのみで、カラムについても追加はされておりませんでした。\\n\\n> Nothing to update - your database is already in sync with the current entity\\n> metadata.\\n\\n結果として、今もバリデーションのみうまく動作しているフォームが/register/にあるのみで、そこに値を入れても保存されず素通りしてしまいます。 \\nこの場合、どうすればカスタムフィールドの値が保存されるようになりますでしょうか。\&quot;,\n \&quot;comment_count\&quot;: 3,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-27T16:45:09.883\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7236\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-27T16:45:09.883\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8050\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;symfony2\&quot;\n ],\n \&quot;title\&quot;: \&quot;Symfony2のFOSUserBundleで、fos_user_registration(登録フォーム)にオリジナルのフォーム及びそこから入力された情報を格納するORM上のカラムを生成したい\&quot;,\n \&quot;view_count\&quot;: 285\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[],&quot;string&quot;:&quot;[]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7236&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;}}},{&quot;rowIdx&quot;:1647,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7242\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;`<style>`タグは通常`<head></head>`内に置くものといった説明がされていますが、`<body>` \\n内に置いたときの動作がどうなるかの説明はどこかにないでしょうか? \\n対象はメジャーな最新ブラウザのみでよいです。 \\n試しに、Safari8.0.3で以下のhtmlを表示すると、`<div>hoge</div>`の内容が赤くスタイリングされました。\\n\\n```\\n\\n <!DOCTYPE html>\\n <html>\\n <head>\\n </head>\\n <body>\\n <div>hoge</div>\\n <style>\\n div { border: 2px solid red; }\\n </style>\\n </body>\\n </html>\\n \\n```\\n\\n![画像の説明をここに入力](https://i.stack.imgur.com/s3Nxp.png) \\nこちらのHTML5 `<style scoped>`の説明はscoped属性の説明なのでちょっと違う気がします。 \\n<http://hyper-text.org/archives/2013/02/style_scoped_attr.shtml>\\n\\n**`<head></head>`内におけばいいんだよ。細けえことはいいんだよ**という意見もありますが、HTML5で許可されている?ような気もして、気になったので。\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T00:38:51.063\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7241\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-28T02:12:00.627\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8601\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 4,\n \&quot;tags\&quot;: [\n \&quot;html\&quot;,\n \&quot;css\&quot;\n ],\n \&quot;title\&quot;: \&quot;<body>内に<style>を設定したときの動作仕様\&quot;,\n \&quot;view_count\&quot;: 19479\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;検証してみました。検証につかったページは[こちら](http://aduca.org/stackoverflow/7241/)です。\n\n結論を先に述べると、モダンブラウザにおいて、`<body>` 内の `<style>` がなんらかの特別扱い(`<head>`\nにあるのとないのとの違い)を受けることはなく、順当に上から順に評価されていくようです。\n\n`scoped` 属性を持ったものは Firefox 以外では考慮されず、平気で上書きされてしまいました(未対応なので当たり前ですね)。\n\n以下、とりあえず手元ですぐ出来そうな検証だけ行ないました。環境は OS X Yosemite 10.10.2 上です。Internet Explorer\nだけ、OS X 上の Parallels で起動した Windows 8.1 の中で動いたものを利用しています。\n\n各ブラウザのバージョンもぱっとわかる限り表記しておいたので、不足があれば[検証ページ](http://aduca.org/stackoverflow/7241/)をご自分でご覧になって確認してみてください。\n\n# Chrome\n\n40.0.2214.115(64-bit)\n\n![Chrome](https://i.stack.imgur.com/83HiA.png)\n\n# Safari\n\n8.0.3 (10600.3.18)\n\n![Safari](https://i.stack.imgur.com/JNJMl.png)\n\n# Firefox\n\n36.0\n\n![Firefox](https://i.stack.imgur.com/L9HLm.png)\n\n# Opera\n\n27.0.1689.76\n\n![Opera](https://i.stack.imgur.com/Y0GCf.png)\n\n# Internet Explorer\n\n11.0.9600.17631\n\n![IE](https://i.stack.imgur.com/rrrHS.png)\n\n# iOS Safari\n\niOS 8.1\n\n![iOS](https://i.stack.imgur.com/OgMMF.png)\n\n# Android 5\n\nGenymotion 上なので不正確な可能性があります。\n\n![Android](https://i.stack.imgur.com/7VW0K.png)&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-28T02:12:00.627&quot;,&quot;id&quot;:&quot;7242&quot;,&quot;last_activity_date&quot;:&quot;2015-02-28T02:12:00.627&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8602&quot;,&quot;parent_id&quot;:&quot;7241&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:7}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;検証してみました。検証につかったページは[こちら](http://aduca.org/stackoverflow/7241/)です。\\n\\n結論を先に述べると、モダンブラウザにおいて、`<body>` 内の `<style>` がなんらかの特別扱い(`<head>`\\nにあるのとないのとの違い)を受けることはなく、順当に上から順に評価されていくようです。\\n\\n`scoped` 属性を持ったものは Firefox 以外では考慮されず、平気で上書きされてしまいました(未対応なので当たり前ですね)。\\n\\n以下、とりあえず手元ですぐ出来そうな検証だけ行ないました。環境は OS X Yosemite 10.10.2 上です。Internet Explorer\\nだけ、OS X 上の Parallels で起動した Windows 8.1 の中で動いたものを利用しています。\\n\\n各ブラウザのバージョンもぱっとわかる限り表記しておいたので、不足があれば[検証ページ](http://aduca.org/stackoverflow/7241/)をご自分でご覧になって確認してみてください。\\n\\n# Chrome\\n\\n40.0.2214.115(64-bit)\\n\\n![Chrome](https://i.stack.imgur.com/83HiA.png)\\n\\n# Safari\\n\\n8.0.3 (10600.3.18)\\n\\n![Safari](https://i.stack.imgur.com/JNJMl.png)\\n\\n# Firefox\\n\\n36.0\\n\\n![Firefox](https://i.stack.imgur.com/L9HLm.png)\\n\\n# Opera\\n\\n27.0.1689.76\\n\\n![Opera](https://i.stack.imgur.com/Y0GCf.png)\\n\\n# Internet Explorer\\n\\n11.0.9600.17631\\n\\n![IE](https://i.stack.imgur.com/rrrHS.png)\\n\\n# iOS Safari\\n\\niOS 8.1\\n\\n![iOS](https://i.stack.imgur.com/OgMMF.png)\\n\\n# Android 5\\n\\nGenymotion 上なので不正確な可能性があります。\\n\\n![Android](https://i.stack.imgur.com/7VW0K.png)\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T02:12:00.627\&quot;,\n \&quot;id\&quot;: \&quot;7242\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-28T02:12:00.627\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8602\&quot;,\n \&quot;parent_id\&quot;: \&quot;7241\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 7\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7241&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7242&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7242&quot;}}},{&quot;rowIdx&quot;:1648,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;EclipseでAndroidアプリケーションを作りたいです。 \\nサーバ側もJava + Springで作成する予定です。\\n\\nAndroidとサーバの間はJSONを使って通信を行いたいので、プロジェクトを3つに分けられないかなと考えています。\\n\\n 1. Androidプロジェクト\\n 2. サーバサイドプロジェクト\\n 3. Json通信を行う際にデータを入れるPOJOのプロジェクト(1/2から共通で参照)\\n\\nEclipseを1つしか立ち上げないで開発すると大変そうなので、1/2は別のワークスペースにしてEclipseを2つ立ち上げて開発したいなと思います。\\n\\nこのような感じで開発したいのですが、Eclipseでどうやればマルチプロジェクトにできるかよくわからないんです。\\n\\nEclipseでプロジェクトを作ると、Androidはただのプロジェクトに、サーバ側(Sprint Tool\\nSuiteを使って作成したプロジェクト)はMavenプロジェクトになっちゃいます。\\n\\n普通に考えればMaven or Gradleのどちらで統一した方がいいと思うんです。 \\nだけれども、Maven/Gradleのどっちもよくわかりません。\\n\\nすいませんが、Eclipseを使ってマルチプロジェクト構成にする方法を教えて下さい。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T04:27:22.510\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7243\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-07-30T04:57:49.550\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8247\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;android\&quot;,\n \&quot;java\&quot;,\n \&quot;eclipse\&quot;,\n \&quot;gradle\&quot;,\n \&quot;maven\&quot;\n ],\n \&quot;title\&quot;: \&quot;Eclipseでマルチプロジェクトの作成方法がわからない\&quot;,\n \&quot;view_count\&quot;: 3064\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;1つのワークスペースに \n3つプロジェクトをいれる ではダメなんでしたっけ。。。?&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-28T07:03:49.057&quot;,&quot;id&quot;:&quot;7244&quot;,&quot;last_activity_date&quot;:&quot;2015-02-28T07:03:49.057&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;845&quot;,&quot;parent_id&quot;:&quot;7243&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;ワークスペースと、プロジェクトの関係であいまいのまま作業されているように思えますが…、 \nマルチプロジェクト(?)にしたい意図は何でしょうか。\n\n * 1つのワークスペースに3つのプロジェクトが並んでいる状態で何か問題ありますでしょうか。\n * 1つのプロジェクトから他のプロジェクト参照はビルドパスの設定で可能です。\n * mavenを使うのであれば、mavenのプロジェクトとして他プロジェクトを参照できます。\n\nなお、複数のプロジェクトを束ねるものとしてマルチ\&quot;モジュール\&quot;プロジェクトの形式がありますが、その前にmaven/gradleを使ったプロジェクトの構成について学習すべきと存じます。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T00:59:25.373&quot;,&quot;id&quot;:&quot;7296&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T00:59:25.373&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5778&quot;,&quot;parent_id&quot;:&quot;7243&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;1つのワークスペースに \\n3つプロジェクトをいれる ではダメなんでしたっけ。。。?\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T07:03:49.057\&quot;,\n \&quot;id\&quot;: \&quot;7244\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-28T07:03:49.057\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;845\&quot;,\n \&quot;parent_id\&quot;: \&quot;7243\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;ワークスペースと、プロジェクトの関係であいまいのまま作業されているように思えますが…、 \\nマルチプロジェクト(?)にしたい意図は何でしょうか。\\n\\n * 1つのワークスペースに3つのプロジェクトが並んでいる状態で何か問題ありますでしょうか。\\n * 1つのプロジェクトから他のプロジェクト参照はビルドパスの設定で可能です。\\n * mavenを使うのであれば、mavenのプロジェクトとして他プロジェクトを参照できます。\\n\\nなお、複数のプロジェクトを束ねるものとしてマルチ\\\&quot;モジュール\\\&quot;プロジェクトの形式がありますが、その前にmaven/gradleを使ったプロジェクトの構成について学習すべきと存じます。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T00:59:25.373\&quot;,\n \&quot;id\&quot;: \&quot;7296\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T00:59:25.373\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5778\&quot;,\n \&quot;parent_id\&quot;: \&quot;7243\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7243&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7244&quot;}}},{&quot;rowIdx&quot;:1649,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;またそれぞれ利点を教えてください。。。。\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T09:55:02.677\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7247\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-28T22:17:54.273\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-02-28T22:17:54.273\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;5005\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8269\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: -3,\n \&quot;tags\&quot;: [\n \&quot;android\&quot;,\n \&quot;unity3d\&quot;,\n \&quot;eclipse\&quot;\n ],\n \&quot;title\&quot;: \&quot;androidゲーム開発はeclipseよりunityのほうが効率いいですか?\&quot;,\n \&quot;view_count\&quot;: 989\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;Eclipseでもunityでもマニュアルやヘルプを読んで、分からない等具体的な問題が発生してから聞くといいと思います。\n\ngoogleはandroidStudioを薦めていますので、そちらも調べたほうが良さそうです。\n\nついでに「スタックオーバーフロー」のマニュアルも読んだほうがいいと思います。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-28T10:12:26.603&quot;,&quot;id&quot;:&quot;7250&quot;,&quot;last_activity_date&quot;:&quot;2015-02-28T10:24:08.440&quot;,&quot;last_edit_date&quot;:&quot;2015-02-28T10:24:08.440&quot;,&quot;last_editor_user_id&quot;:&quot;7256&quot;,&quot;owner_user_id&quot;:&quot;7256&quot;,&quot;parent_id&quot;:&quot;7247&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2},{&quot;body&quot;:&quot;圧倒的にUnityを使った方が簡単で早いです。 \nEclipseで0からゲームを作ろうと思ったら自分でUnity相当の機能を実装する必要があります。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-28T18:40:04.620&quot;,&quot;id&quot;:&quot;7257&quot;,&quot;last_activity_date&quot;:&quot;2015-02-28T18:40:04.620&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5005&quot;,&quot;parent_id&quot;:&quot;7247&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;Eclipseでもunityでもマニュアルやヘルプを読んで、分からない等具体的な問題が発生してから聞くといいと思います。\\n\\ngoogleはandroidStudioを薦めていますので、そちらも調べたほうが良さそうです。\\n\\nついでに「スタックオーバーフロー」のマニュアルも読んだほうがいいと思います。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T10:12:26.603\&quot;,\n \&quot;id\&quot;: \&quot;7250\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-28T10:24:08.440\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-02-28T10:24:08.440\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7256\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7256\&quot;,\n \&quot;parent_id\&quot;: \&quot;7247\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n },\n {\n \&quot;body\&quot;: \&quot;圧倒的にUnityを使った方が簡単で早いです。 \\nEclipseで0からゲームを作ろうと思ったら自分でUnity相当の機能を実装する必要があります。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T18:40:04.620\&quot;,\n \&quot;id\&quot;: \&quot;7257\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-28T18:40:04.620\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5005\&quot;,\n \&quot;parent_id\&quot;: \&quot;7247\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7247&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7257&quot;}}},{&quot;rowIdx&quot;:1650,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 0,\n \&quot;body\&quot;: \&quot;ただいまVBAを使ってExcelからRDSまたはEC2上のMySQL\\nDBに接続しようかとサーチしています。これまでローカルまたはオンプレミスのODBC接続は経験があるのですが、AWSに接続したことがありません。どなたかご存知な方がいらっしゃいましたら教えていただけると幸いです。\\n\\nVBAでSERVERを設定しますが、そこにAWSのDNS情報やRDSのエンドポイントを書いて試しましたがうまくいきませんでした。。。\\n\\n宜しくお願い致します。\&quot;,\n \&quot;comment_count\&quot;: 3,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T13:32:28.853\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7253\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-28T13:32:28.853\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8284\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;vba\&quot;,\n \&quot;aws\&quot;,\n \&quot;excel\&quot;\n ],\n \&quot;title\&quot;: \&quot;ExcelからRDS MySQLにODBC接続するために\&quot;,\n \&quot;view_count\&quot;: 1761\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[],&quot;string&quot;:&quot;[]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7253&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;}}},{&quot;rowIdx&quot;:1651,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7256\&quot;,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;先日PHPでよいデバッグ方法はないか、ここのサイトで質問してみました。 \\nそしてvar_dumpという関数を使う方法を教えていただいたので、早速使ってみました。\\n\\nそしたら添付画像のように文字化けを起こします。\\n\\nブラウザはFireFoxを使っていて、開発中のサイトを右クリック→「ページのソースを表示」でvar_dumpの結果を表示させています。\\n\\nなぜこのように文字化けを起こしてしまうのでしょうか? \\nまた、文字化けを起こさないよう何か良い方法がありましたら教えてください。\\n\\nよろしくお願い致します。\\n\\n【開発環境】 \\n・Windows7pro \\n・PHP \\n・HTML \\n・ブラウザ:FireFox \\n・エディタ:NoEditor ※PHPとHTMLを編集用として使用\\n\\n#\\n\\n【続報】 \\nFireFoxのメニューにある「文字エンコーディング」という箇所で \\n「日本語(EUC-JP)」を選択したらvar_dumpの結果が正しく表示 \\nされるようになりました。 \\nでも、別の問題が発生しました。 \\n今回、追加で添付した画像のように、今度は現在制作中のHPの方が \\n文字化けを起こすようになってしまいました。 \\nそもそも、これは仕方のないことなのでしょうか? \\nそれとも何か改善方法はありますでしょうか? \\n※PHPファイルはUTF8Nの形式で保存しております。\\n\\n![文字化けした画面](https://i.stack.imgur.com/PSres.jpg)\\n\\n![画像の説明をここに入力](https://i.stack.imgur.com/KcZdF.jpg)\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T14:24:35.643\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7254\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T01:56:58.297\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T12:03:52.187\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7634\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7634\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 4,\n \&quot;tags\&quot;: [\n \&quot;php\&quot;,\n \&quot;windows\&quot;,\n \&quot;firefox\&quot;\n ],\n \&quot;title\&quot;: \&quot;PHPのvar_dumpを使うと文字化けを起こします。\&quot;,\n \&quot;view_count\&quot;: 9803\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;ブラウザの文字エンコードが自動認識になっていて、出力のエンコード指定ヘッダより前にデータがあるからです。ブラウザの「表示」メニューあたりで日本語の自動認識を\nUTF-8 などと指定すると直ると思います。&quot;,&quot;comment_count&quot;:4,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-28T16:42:38.533&quot;,&quot;id&quot;:&quot;7255&quot;,&quot;last_activity_date&quot;:&quot;2015-02-28T16:42:38.533&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5299&quot;,&quot;parent_id&quot;:&quot;7254&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3},{&quot;body&quot;:&quot;asesino さんの回答をもう少し付け加えます。\n\nHTML のエンコード指定はこういったものです。\n\n```\n\n <meta http-equiv=\&quot;Content-Type\&quot; content=\&quot;text/html; charset=UTF-8\&quot; />\n \n```\n\nこれが存在しないのに文字化けしてしまう場合は、HTML (ないしは `.php` ファイル)\nの文字エンコードとブラウザの標準文字コードが合致していない場合に起こります。\n\n従って、表示させているファイル自身の文字コードを変えてみるといいと思います。 \n通例でよく利用されるのは `UTF-8` という文字コードです。(少し古いものだったら EUC-JP など、ガラケー用の\nwebサイトになるとキャリアにもよりますが Shift-JIS などもあります)\n\n* * *\n\n補足\n\nこれは推測でしかないのですが、Web_beginner さんがわざわざ\n\n> ブラウザはFireFoxを使っていて、開発中のサイトを右クリック→「ページのソースを表示」でvar_dumpの結果を表示させています。\n\n上記のようなことをしているのは、`var_dump()` の表示結果が崩れてしまっているからではないでしょうか?\n\nこれ、防ぐ手が幾つかあるんですが\n\n```\n\n echo '<pre>';\n var_dump($data);\n echo'</pre>';\n \n```\n\nとします。(改行すら面倒くさい場合はそういう関数を作ってしまうのもお勧めです)\n\nすると、ちゃんと `var_dump()` が改行付きの整形済みテキストで表示されますので、もし 「`var_dump()`\nを綺麗に表示させたいな」とお考えの時は上記を試してみてください。\n\n* * *\n\n# 追記:補足していただいた内容に対する回答\n\n※見にくくて申し訳ありません。別回答として分けたほうがよさそうであればそうさせて頂きますので遠慮なく仰ってください。\n\n恐らく、PHP の環境設定ファイル内で内部エンコーディングが `EUC-JP` で設定されているのだと思います。 \n問題点としては、`var_dump()` では `EUC-JP` 正しく表示され、Webサイト自体は `UTF-8`\nで正しく表示されるようになっている、ということですね。\n\n## 対処法 1. PHP の設定ファイルを変更する\n\nこれは以下のファイルを編集することで解決しますが、触れない環境であれば他の対処法を試してみてください。\n\n 1. 変更するファイル:`/etc/php.ini`\n 2. 変更する箇所:`[mbstring]`\n\nmbstring.language=Japanese \nmbstring.internal_encoding=\&quot;UTF-8\&quot; \nmbstring.http_output=\&quot;UTF-8\&quot;\n\n上記を設定し終えたら、Apache を再起動ないしは設定ファイルのリロードをしてください。\n\n## 対処法 2. meta タグで文字コードを指定する\n\n最初に述べたとおり\n\n```\n\n <meta http-equiv=\&quot;Content-Type\&quot; content=\&quot;text/html; charset=UTF-8\&quot; />\n \n```\n\n上記 meta タグを タグと タグの間に挿入することによって「この web ページは UTF-8\nで表示するつもりだよ」ということをブラウザに教えてあげることができます。\n\nその他の meta タグについてはこちらを参照してください。 \n<http://www.htmq.com/html5/meta.shtml>\n\nただ、var_dump() 自体が `EUC-JP` で表示されている場合、meta\nタグだと効果が無いかもしれません…。(今手元に試せる環境が無いので確認ができません)\n\n## 対処法 3. `var_dump()` の出力を文字エンコーディングして出力させるようにする\n\nもういっそ `var_dump()` を使わず、自前で `var_dump()` のような関数を用意する方法です。 \nこれは `mb_convert_encoding()` によって `var_dump()` で出力される文字コードを自前で変換します。\n\n例えば、以下のような関数を自前で作ってしまいます。\n\n```\n\n /**\n * var_dump 文字化け回避用.\n * @param mixed $variable 表示したいデータ\n * @return string var_dump() 文字列\n */\n function vd( $variable )\n {\n $dump_object = '';\n ob_start();\n {\n var_dump( $variable );\n $dump_object = ob_get_contents();\n }\n ob_end_clean();\n return mb_convert_encoding('<pre>'.$dump_object.'</pre>', 'UTF-8');\n }\n \n```\n\n使い方は、以下のように使います。\n\n```\n\n echo vd( array('ほげ','もげ','ぴよ','foo','baz','bar') );\n \n```\n\n`var_dump()` は使ったその場で出力されましたが、この関数は `var_dump()`\nで出力される内容をそのまま出力せずに、文字列として返します。 \nその為、関数の前に `echo` が必要になります。(もちろん vd 関数内で return せず、そのまま `echo` でもいいと思います。)\n\n以上、いかがでしょうか。 \nもし他に何か情報がありましたら、更に追記する形でお知らせください。&quot;,&quot;comment_count&quot;:4,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-02-28T16:52:05.533&quot;,&quot;id&quot;:&quot;7256&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T01:56:58.297&quot;,&quot;last_edit_date&quot;:&quot;2015-03-02T01:56:58.297&quot;,&quot;last_editor_user_id&quot;:&quot;7926&quot;,&quot;owner_user_id&quot;:&quot;7926&quot;,&quot;parent_id&quot;:&quot;7254&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;ブラウザの文字エンコードが自動認識になっていて、出力のエンコード指定ヘッダより前にデータがあるからです。ブラウザの「表示」メニューあたりで日本語の自動認識を\\nUTF-8 などと指定すると直ると思います。\&quot;,\n \&quot;comment_count\&quot;: 4,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T16:42:38.533\&quot;,\n \&quot;id\&quot;: \&quot;7255\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-02-28T16:42:38.533\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5299\&quot;,\n \&quot;parent_id\&quot;: \&quot;7254\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n },\n {\n \&quot;body\&quot;: \&quot;asesino さんの回答をもう少し付け加えます。\\n\\nHTML のエンコード指定はこういったものです。\\n\\n```\\n\\n <meta http-equiv=\\\&quot;Content-Type\\\&quot; content=\\\&quot;text/html; charset=UTF-8\\\&quot; />\\n \\n```\\n\\nこれが存在しないのに文字化けしてしまう場合は、HTML (ないしは `.php` ファイル)\\nの文字エンコードとブラウザの標準文字コードが合致していない場合に起こります。\\n\\n従って、表示させているファイル自身の文字コードを変えてみるといいと思います。 \\n通例でよく利用されるのは `UTF-8` という文字コードです。(少し古いものだったら EUC-JP など、ガラケー用の\\nwebサイトになるとキャリアにもよりますが Shift-JIS などもあります)\\n\\n* * *\\n\\n補足\\n\\nこれは推測でしかないのですが、Web_beginner さんがわざわざ\\n\\n> ブラウザはFireFoxを使っていて、開発中のサイトを右クリック→「ページのソースを表示」でvar_dumpの結果を表示させています。\\n\\n上記のようなことをしているのは、`var_dump()` の表示結果が崩れてしまっているからではないでしょうか?\\n\\nこれ、防ぐ手が幾つかあるんですが\\n\\n```\\n\\n echo '<pre>';\\n var_dump($data);\\n echo'</pre>';\\n \\n```\\n\\nとします。(改行すら面倒くさい場合はそういう関数を作ってしまうのもお勧めです)\\n\\nすると、ちゃんと `var_dump()` が改行付きの整形済みテキストで表示されますので、もし 「`var_dump()`\\nを綺麗に表示させたいな」とお考えの時は上記を試してみてください。\\n\\n* * *\\n\\n# 追記:補足していただいた内容に対する回答\\n\\n※見にくくて申し訳ありません。別回答として分けたほうがよさそうであればそうさせて頂きますので遠慮なく仰ってください。\\n\\n恐らく、PHP の環境設定ファイル内で内部エンコーディングが `EUC-JP` で設定されているのだと思います。 \\n問題点としては、`var_dump()` では `EUC-JP` 正しく表示され、Webサイト自体は `UTF-8`\\nで正しく表示されるようになっている、ということですね。\\n\\n## 対処法 1. PHP の設定ファイルを変更する\\n\\nこれは以下のファイルを編集することで解決しますが、触れない環境であれば他の対処法を試してみてください。\\n\\n 1. 変更するファイル:`/etc/php.ini`\\n 2. 変更する箇所:`[mbstring]`\\n\\nmbstring.language=Japanese \\nmbstring.internal_encoding=\\\&quot;UTF-8\\\&quot; \\nmbstring.http_output=\\\&quot;UTF-8\\\&quot;\\n\\n上記を設定し終えたら、Apache を再起動ないしは設定ファイルのリロードをしてください。\\n\\n## 対処法 2. meta タグで文字コードを指定する\\n\\n最初に述べたとおり\\n\\n```\\n\\n <meta http-equiv=\\\&quot;Content-Type\\\&quot; content=\\\&quot;text/html; charset=UTF-8\\\&quot; />\\n \\n```\\n\\n上記 meta タグを タグと タグの間に挿入することによって「この web ページは UTF-8\\nで表示するつもりだよ」ということをブラウザに教えてあげることができます。\\n\\nその他の meta タグについてはこちらを参照してください。 \\n<http://www.htmq.com/html5/meta.shtml>\\n\\nただ、var_dump() 自体が `EUC-JP` で表示されている場合、meta\\nタグだと効果が無いかもしれません…。(今手元に試せる環境が無いので確認ができません)\\n\\n## 対処法 3. `var_dump()` の出力を文字エンコーディングして出力させるようにする\\n\\nもういっそ `var_dump()` を使わず、自前で `var_dump()` のような関数を用意する方法です。 \\nこれは `mb_convert_encoding()` によって `var_dump()` で出力される文字コードを自前で変換します。\\n\\n例えば、以下のような関数を自前で作ってしまいます。\\n\\n```\\n\\n /**\\n * var_dump 文字化け回避用.\\n * @param mixed $variable 表示したいデータ\\n * @return string var_dump() 文字列\\n */\\n function vd( $variable )\\n {\\n $dump_object = '';\\n ob_start();\\n {\\n var_dump( $variable );\\n $dump_object = ob_get_contents();\\n }\\n ob_end_clean();\\n return mb_convert_encoding('<pre>'.$dump_object.'</pre>', 'UTF-8');\\n }\\n \\n```\\n\\n使い方は、以下のように使います。\\n\\n```\\n\\n echo vd( array('ほげ','もげ','ぴよ','foo','baz','bar') );\\n \\n```\\n\\n`var_dump()` は使ったその場で出力されましたが、この関数は `var_dump()`\\nで出力される内容をそのまま出力せずに、文字列として返します。 \\nその為、関数の前に `echo` が必要になります。(もちろん vd 関数内で return せず、そのまま `echo` でもいいと思います。)\\n\\n以上、いかがでしょうか。 \\nもし他に何か情報がありましたら、更に追記する形でお知らせください。\&quot;,\n \&quot;comment_count\&quot;: 4,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T16:52:05.533\&quot;,\n \&quot;id\&quot;: \&quot;7256\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T01:56:58.297\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T01:56:58.297\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;parent_id\&quot;: \&quot;7254\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7254&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7256&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7255&quot;}}},{&quot;rowIdx&quot;:1652,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7278\&quot;,\n \&quot;answer_count\&quot;: 3,\n \&quot;body\&quot;: \&quot;たとえば、aaa222が右に100px動いていて、bbbをクリックすると、その動いていたaaa222を元の0pxのポジションに戻して、bbb222を右に100px動かしたいです。 \\nccc222も同じように動いてほしいです。 \\nつまり、右側に動かすのは1つだけで、ほかの2つはクリックされたら、元の0pxに戻る、というプログラムにしたいのですが、どうしたらよいのでしょうか?\\n\\n```\\n\\n <script>\\r\\n $(function(){\\r\\n var duration=300;\\r\\n var $a2=$(\\\&quot;#aaa222\\\&quot;);\\r\\n $(\\\&quot;#aaa\\\&quot;).on(\\\&quot;click\\\&quot;,function(){\\r\\n $a2.toggleClass(\\\&quot;goA2\\\&quot;);\\r\\n if($a2.hasClass(\\\&quot;goA2\\\&quot;)){\\r\\n $a2.stop(true).animate({\\r\\n left:100},\\r\\n duration);\\r\\n }else{\\r\\n $a2.stop(true).animate({\\r\\n left:0},\\r\\n duration);\\r\\n }\\r\\n })\\r\\n \\r\\n });\\r\\n \\r\\n $(function(){\\r\\n var duration=300;\\r\\n var $b2=$(\\\&quot;#bbb222\\\&quot;);\\r\\n $(\\\&quot;#bbb\\\&quot;).on(\\\&quot;click\\\&quot;,function(){\\r\\n $b2.toggleClass(\\\&quot;goB2\\\&quot;);\\r\\n if($b2.hasClass(\\\&quot;goB2\\\&quot;)){\\r\\n $b2.stop(true).animate({\\r\\n left:100},\\r\\n duration);\\r\\n }else{\\r\\n $b2.stop(true).animate({\\r\\n left:0},\\r\\n duration);\\r\\n }\\r\\n })\\r\\n \\r\\n });\\r\\n \\r\\n $(function(){\\r\\n var duration=300;\\r\\n var $c2=$(\\\&quot;#ccc222\\\&quot;);\\r\\n $(\\\&quot;#ccc\\\&quot;).on(\\\&quot;click\\\&quot;,function(){\\r\\n $c2.toggleClass(\\\&quot;goC2\\\&quot;);\\r\\n if($c2.hasClass(\\\&quot;goC2\\\&quot;)){\\r\\n $c2.stop(true).animate({\\r\\n left:100},\\r\\n duration);\\r\\n }else{\\r\\n $c2.stop(true).animate({\\r\\n left:0},\\r\\n duration);\\r\\n }\\r\\n })\\r\\n \\r\\n });\\r\\n \\r\\n </script>\\n```\\n\\n```\\n\\n <style>\\r\\n #aaa{\\r\\n display:block;\\r\\n position:relative;\\r\\n width:500px;\\r\\n height:50px;\\r\\n background:rgba(0,0,255,1);\\r\\n }\\r\\n #aaa222{\\r\\n display:block;\\r\\n position:relative;\\r\\n top:20px;\\r\\n width:50px;\\r\\n height:10px;\\r\\n background:rgba(51,255,153,1);\\r\\n \\r\\n }\\r\\n #bbb{\\r\\n display:block;\\r\\n position:relative;\\r\\n width:500px;\\r\\n height:50px;\\r\\n background:rgba(0,255,255,1);\\r\\n }\\r\\n #bbb222{\\r\\n display:block;\\r\\n position:relative;\\r\\n top:20px;\\r\\n width:50px;\\r\\n height:10px;\\r\\n background:rgba(153,51,102,1);\\r\\n \\r\\n }\\r\\n #ccc{\\r\\n display:block;\\r\\n position:relative;\\r\\n width:500px;\\r\\n height:50px;\\r\\n background:rgba(50,100,100,1);\\r\\n }\\r\\n #ccc222{\\r\\n display:block;\\r\\n position:relative;\\r\\n top:20px;\\r\\n width:50px;\\r\\n height:10px;\\r\\n background:rgba(153,0,0,1);\\r\\n \\r\\n }\\r\\n \\r\\n \\r\\n \\r\\n </style>\\n```\\n\\n```\\n\\n <body>\\r\\n \\r\\n <div id=\\\&quot;aaa\\\&quot;><div id=\\\&quot;aaa222\\\&quot;></div></div>\\r\\n <div id=\\\&quot;bbb\\\&quot;><div id=\\\&quot;bbb222\\\&quot;></div></div>\\r\\n <div id=\\\&quot;ccc\\\&quot;><div id=\\\&quot;ccc222\\\&quot;></div></div>\\r\\n </body>\\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-02-28T22:51:37.347\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7258\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-04T12:55:25.573\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T00:24:56.753\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;85\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7647\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;javascript\&quot;,\n \&quot;jquery\&quot;\n ],\n \&quot;title\&quot;: \&quot;jQuery - 3つある要素の1つをクリックして右に動かし、残りの2つを元のポジションに戻すコードを書きたい\&quot;,\n \&quot;view_count\&quot;: 577\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;一つのイベントから3つのエレメントを動かしたいならそういうプログラムにする必要があると思います。 \nonのハンドラの中に\n\n```\n\n $('#aaa222,#bbb2222,#ccc222').each(function(i, bar){\n if(イベントが起きたのが自分か){\n $(bar).stop().animate({left:100, duration:300});\n } else {\n $(bar).stop().animate({left:0, duration:300});\n }\n });\n \n```\n\nのような処理を書く必要があるでしょう。 \n全部書くと、それはつまり私のためにプログラムを書いてくださいということとほぼ等しくなってしまうのでこれだけにしておきます。 \nアドバイスとして言えることは、バブリングに注意してください。というくらいですかね。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T01:00:14.780&quot;,&quot;id&quot;:&quot;7259&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T01:00:14.780&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8136&quot;,&quot;parent_id&quot;:&quot;7258&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2},{&quot;body&quot;:&quot;色々やり方はあると思いますが、 \n以下の様にすればいいかと思います。\n\n```\n\n $(function(){\n var duration=300;\n $(\&quot;#aaa222,#bbb222,#ccc222\&quot;).bind(\&quot;move\&quot;, function(e, myID){\n //クラスの代わりにIDを使うことにした。既に効果が適用されているかどうかのチェックは行わないことにしている。\n if($(this).attr(\&quot;id\&quot;)==myID){\n $(this).stop(true)\n .animate({left:100},duration);\n } else {\n $(this).stop(true)\n .animate({left:0},duration);\n }\n });\n \n $(\&quot;#aaa,#bbb,#ccc\&quot;).on(\&quot;click\&quot;,function(){\n var ID = $(this).attr(\&quot;id\&quot;) + 222;//親要素と規則性がある\n //それぞれに効果を呼び出す(カスタムイベント発火)\n $(\&quot;#aaa222\&quot;).triggerHandler(\&quot;move\&quot;, ID);\n $(\&quot;#bbb222\&quot;).triggerHandler(\&quot;move\&quot;, ID);\n $(\&quot;#ccc222\&quot;).triggerHandler(\&quot;move\&quot;, ID);\n });\n });\n \n```&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T12:41:22.533&quot;,&quot;id&quot;:&quot;7278&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T12:41:22.533&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5044&quot;,&quot;parent_id&quot;:&quot;7258&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;もう一つ`<div>`を追加して、各要素にクラスを割り当てれば以下のように書けます。 \n(`<div>`は追加する必要はないんですが、実用的ではないので・・・)\n\n```\n\n <script>\n $(function(){\n var duration=300;\n $(document).on('click', '.parent', function(){\n $(this).siblings().find('.child').stop(true).animate({left:0}, duration);\n $(this).find('.child').stop(true).animate({left:100}, duration);\n });\n });\n </script>\n \n```\n\n```\n\n <body>\n <div>\n <div id=\&quot;aaa\&quot; class=\&quot;parent\&quot;><div id=\&quot;aaa222\&quot; class=\&quot;child\&quot;></div></div>\n <div id=\&quot;bbb\&quot; class=\&quot;parent\&quot;><div id=\&quot;bbb222\&quot; class=\&quot;child\&quot;></div></div>\n <div id=\&quot;ccc\&quot; class=\&quot;parent\&quot;><div id=\&quot;ccc222\&quot; class=\&quot;child\&quot;></div></div>\n </div>\n </body>\n \n```&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T06:50:45.000&quot;,&quot;id&quot;:&quot;7319&quot;,&quot;last_activity_date&quot;:&quot;2015-03-04T12:55:25.573&quot;,&quot;last_edit_date&quot;:&quot;2015-03-04T12:55:25.573&quot;,&quot;last_editor_user_id&quot;:&quot;7214&quot;,&quot;owner_user_id&quot;:&quot;7214&quot;,&quot;parent_id&quot;:&quot;7258&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;一つのイベントから3つのエレメントを動かしたいならそういうプログラムにする必要があると思います。 \\nonのハンドラの中に\\n\\n```\\n\\n $('#aaa222,#bbb2222,#ccc222').each(function(i, bar){\\n if(イベントが起きたのが自分か){\\n $(bar).stop().animate({left:100, duration:300});\\n } else {\\n $(bar).stop().animate({left:0, duration:300});\\n }\\n });\\n \\n```\\n\\nのような処理を書く必要があるでしょう。 \\n全部書くと、それはつまり私のためにプログラムを書いてくださいということとほぼ等しくなってしまうのでこれだけにしておきます。 \\nアドバイスとして言えることは、バブリングに注意してください。というくらいですかね。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T01:00:14.780\&quot;,\n \&quot;id\&quot;: \&quot;7259\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T01:00:14.780\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8136\&quot;,\n \&quot;parent_id\&quot;: \&quot;7258\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n },\n {\n \&quot;body\&quot;: \&quot;色々やり方はあると思いますが、 \\n以下の様にすればいいかと思います。\\n\\n```\\n\\n $(function(){\\n var duration=300;\\n $(\\\&quot;#aaa222,#bbb222,#ccc222\\\&quot;).bind(\\\&quot;move\\\&quot;, function(e, myID){\\n //クラスの代わりにIDを使うことにした。既に効果が適用されているかどうかのチェックは行わないことにしている。\\n if($(this).attr(\\\&quot;id\\\&quot;)==myID){\\n $(this).stop(true)\\n .animate({left:100},duration);\\n } else {\\n $(this).stop(true)\\n .animate({left:0},duration);\\n }\\n });\\n \\n $(\\\&quot;#aaa,#bbb,#ccc\\\&quot;).on(\\\&quot;click\\\&quot;,function(){\\n var ID = $(this).attr(\\\&quot;id\\\&quot;) + 222;//親要素と規則性がある\\n //それぞれに効果を呼び出す(カスタムイベント発火)\\n $(\\\&quot;#aaa222\\\&quot;).triggerHandler(\\\&quot;move\\\&quot;, ID);\\n $(\\\&quot;#bbb222\\\&quot;).triggerHandler(\\\&quot;move\\\&quot;, ID);\\n $(\\\&quot;#ccc222\\\&quot;).triggerHandler(\\\&quot;move\\\&quot;, ID);\\n });\\n });\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T12:41:22.533\&quot;,\n \&quot;id\&quot;: \&quot;7278\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T12:41:22.533\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5044\&quot;,\n \&quot;parent_id\&quot;: \&quot;7258\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;もう一つ`<div>`を追加して、各要素にクラスを割り当てれば以下のように書けます。 \\n(`<div>`は追加する必要はないんですが、実用的ではないので・・・)\\n\\n```\\n\\n <script>\\n $(function(){\\n var duration=300;\\n $(document).on('click', '.parent', function(){\\n $(this).siblings().find('.child').stop(true).animate({left:0}, duration);\\n $(this).find('.child').stop(true).animate({left:100}, duration);\\n });\\n });\\n </script>\\n \\n```\\n\\n```\\n\\n <body>\\n <div>\\n <div id=\\\&quot;aaa\\\&quot; class=\\\&quot;parent\\\&quot;><div id=\\\&quot;aaa222\\\&quot; class=\\\&quot;child\\\&quot;></div></div>\\n <div id=\\\&quot;bbb\\\&quot; class=\\\&quot;parent\\\&quot;><div id=\\\&quot;bbb222\\\&quot; class=\\\&quot;child\\\&quot;></div></div>\\n <div id=\\\&quot;ccc\\\&quot; class=\\\&quot;parent\\\&quot;><div id=\\\&quot;ccc222\\\&quot; class=\\\&quot;child\\\&quot;></div></div>\\n </div>\\n </body>\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T06:50:45.000\&quot;,\n \&quot;id\&quot;: \&quot;7319\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-04T12:55:25.573\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-04T12:55:25.573\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7214\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7214\&quot;,\n \&quot;parent_id\&quot;: \&quot;7258\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7258&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7278&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7259&quot;}}},{&quot;rowIdx&quot;:1653,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7392\&quot;,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;ContentProvider(コンテンツプロバイダ)からAndroid端末のPlayストアアプリにアクセスし、Google\\nPlayの検索履歴を取得したいと思っています。Android4.*まではアクセス可能でしたが、Android5.0からは以下の例外が発生しアクセスできなくなってしまいました。 \\nPlayストアへのアクセスを許可する方法はありますでしょうか?\\n\\n例外:\\n\\n```\\n\\n java.lang.SecurityException: Permission Denial: opening provider com.google.android.finsky.providers.RecentSuggestionsProvider from ProcessRecord\\n \\n```\\n\\nJavaソースコード:\\n\\n```\\n\\n try{\\n Object obj = Uri.parse(\\\&quot;content://com.google.android.finsky.RecentSuggestionsProvider/suggestions\\\&quot;);\\n ContentResolver contentresolver = l.getContentResolver();\\n String as1[];\\n (as1 = new String[1])[0] = \\\&quot;_id || ',' || date || ',' || display1 as _id\\\&quot;;\\n String as2[];\\n (as2 = new String[1])[0] = \\\&quot;\\\&quot;;\\n if((obj1 = contentresolver.query(((Uri) (obj1)), as1, \\\&quot;''=?\\\&quot;, as2, \\\&quot;date desc\\\&quot;))== null)\\n }catch(Exception exception){\\n }\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T01:25:23.377\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7260\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T15:23:29.023\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T02:02:42.040\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8558\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8558\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;android\&quot;,\n \&quot;java\&quot;,\n \&quot;google-play\&quot;\n ],\n \&quot;title\&quot;: \&quot;ContentProviderでAndroid5.0のGoogle Play•Playストアへのアクセスを許可したい\&quot;,\n \&quot;view_count\&quot;: 408\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;手持ちのandroid 4.4.4で試したところ同様の結果(エラーメッセージ含む)になり、取得できませんでした。 \nコメントできないのでこちらにて報告します。\n\nもし解決できたら回答を編集します。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T12:06:25.640&quot;,&quot;id&quot;:&quot;7383&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T12:06:25.640&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7256&quot;,&quot;parent_id&quot;:&quot;7260&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;例外は最後まで記入することをおすすめします。 \nなぜ例外が出たのか重要な情報源となります。\n\n`java.lang.SecurityException: Permission Denial`は、アクセスが許可されていないということです。 \n記入された例外が途中で切れてるのですが、例外1行目の最後の方に、`is not exported`と出ているはずです。 \nこれは、アクセスしようとした`ContentProvider`が外部からのアクセスが許可されていないということです。\n\nなぜAndroid5.0で例外が出るのかは分かりません。以下は想像です。\n\nAPI Level17(Android4.2)から`ContentProvider`の`exported`のデフォルト値が変わりました。 \nAPI Level16までは、`exported`が指定されていない場合のデフォルト値は`true`です。 \nAPI Level17から、`exported`が指定されていない場合のデフォルト値は`false`です。\n\n`exported`が`true`の場合、他のアプリなどから利用できます。 \n`exported`が`false`の場合、他のアプリなどから利用できません。\n\n想像ですが、Playストアアプリの`<provider>`で`exported`が未指定になったいるため、Android4.2から例外が出ているのではないかと思われます。\n\n#しかし、4.1まで簡単にPlayストアアプリの検索履歴を取得出来たんですね。おっそろしいです。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T15:16:22.010&quot;,&quot;id&quot;:&quot;7392&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T15:23:29.023&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T15:23:29.023&quot;,&quot;last_editor_user_id&quot;:&quot;8216&quot;,&quot;owner_user_id&quot;:&quot;8216&quot;,&quot;parent_id&quot;:&quot;7260&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;手持ちのandroid 4.4.4で試したところ同様の結果(エラーメッセージ含む)になり、取得できませんでした。 \\nコメントできないのでこちらにて報告します。\\n\\nもし解決できたら回答を編集します。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T12:06:25.640\&quot;,\n \&quot;id\&quot;: \&quot;7383\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T12:06:25.640\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7256\&quot;,\n \&quot;parent_id\&quot;: \&quot;7260\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;例外は最後まで記入することをおすすめします。 \\nなぜ例外が出たのか重要な情報源となります。\\n\\n`java.lang.SecurityException: Permission Denial`は、アクセスが許可されていないということです。 \\n記入された例外が途中で切れてるのですが、例外1行目の最後の方に、`is not exported`と出ているはずです。 \\nこれは、アクセスしようとした`ContentProvider`が外部からのアクセスが許可されていないということです。\\n\\nなぜAndroid5.0で例外が出るのかは分かりません。以下は想像です。\\n\\nAPI Level17(Android4.2)から`ContentProvider`の`exported`のデフォルト値が変わりました。 \\nAPI Level16までは、`exported`が指定されていない場合のデフォルト値は`true`です。 \\nAPI Level17から、`exported`が指定されていない場合のデフォルト値は`false`です。\\n\\n`exported`が`true`の場合、他のアプリなどから利用できます。 \\n`exported`が`false`の場合、他のアプリなどから利用できません。\\n\\n想像ですが、Playストアアプリの`<provider>`で`exported`が未指定になったいるため、Android4.2から例外が出ているのではないかと思われます。\\n\\n#しかし、4.1まで簡単にPlayストアアプリの検索履歴を取得出来たんですね。おっそろしいです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T15:16:22.010\&quot;,\n \&quot;id\&quot;: \&quot;7392\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T15:23:29.023\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T15:23:29.023\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8216\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8216\&quot;,\n \&quot;parent_id\&quot;: \&quot;7260\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7260&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7392&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7392&quot;}}},{&quot;rowIdx&quot;:1654,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;APIを叩いた後にアラートを出し、そのイベントを拾ってから次のイベントに進みたいのですが、クロージャ内で`delegate:\\nself`を指定しても、イベントが拾われません。 \\nObjective-Cは触っておらず、swiftも初心者なので解決法が浮かばずに困っております。\\n\\n```\\n\\n typealias CompletionHandler = (result: Bool?) -> Void\\n \\n class hogeViewController: UIViewController, UIAlertViewDelegate {\\n \\n var completion: CompletionHandler?\\n \\n func test(completion: (result: Bool) -> Void) {\\n \\n let request = NSURLRequest(URL: NSURL(string: apiUrl)!)\\n NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue(), completionHandler:{ (response: NSURLResponse!, data: NSData!, error: NSError!) in\\n \\n let alert = UIAlertView(\\n message: testMessage\\n delegate: self,\\n cancelButtonTitle: nil,\\n otherButtonTitles: \\\&quot;test1\\\&quot;, \\\&quot;test2\\\&quot;)\\n alert.show()\\n return\\n })\\n }\\n \\n func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) {\\n println(\\\&quot;clickedButtonAtIndex\\\&quot;)\\n println(buttonIndex)\\n \\n self.completion!(result: true)\\n }\\n }\\n \\n```\\n\\nお詳しい方がいましたらご回答宜しくお願い致します。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T03:53:12.643\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7262\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T05:31:11.530\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8612\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 0,\n \&quot;tags\&quot;: [\n \&quot;swift\&quot;\n ],\n \&quot;title\&quot;: \&quot;クロージャ内で指定したdelegateでイベントが拾えない\&quot;,\n \&quot;view_count\&quot;: 442\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;コンパイルが通らなかったので細部を直しましたが、私の環境ではちゃんとUIAlertViewのボタンイベントが拾われました。 \n環境:iPhone6(iOS8.1.3)\n\nちなみに UIAlertView はiOS8から非推奨なので、iOS8以上なら代わりにUIAlertControllerを使うことを推奨します。\n\n```\n\n typealias CompletionHandler = (result: Bool?) -> Void\n \n class ViewController: UIViewController, UIAlertViewDelegate {\n \n let apiUrl = \&quot;https://www.google.co.jp\&quot;\n \n var completion: CompletionHandler? = {(result: Bool?) in\n println(\&quot;API completed! \\(result)\&quot;)\n }\n \n func test() {\n let request = NSURLRequest(URL: NSURL(string: apiUrl)!)\n NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue(), completionHandler:{ (response: NSURLResponse!, data: NSData!, error: NSError!) in\n \n let alert = UIAlertView(\n title: \&quot;アラートのタイトル\&quot;,\n message: \&quot;アラートのメッセージ\&quot;,\n delegate: self,\n cancelButtonTitle: nil,\n otherButtonTitles: \&quot;test1\&quot;, \&quot;test2\&quot;)\n alert.show()\n return\n })\n }\n \n func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) {\n println(\&quot;clickedButtonAtIndex\&quot;)\n println(buttonIndex)\n \n self.completion?(result: true)\n }\n }\n \n```&quot;,&quot;comment_count&quot;:3,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T05:31:11.530&quot;,&quot;id&quot;:&quot;7264&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T05:31:11.530&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8148&quot;,&quot;parent_id&quot;:&quot;7262&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;コンパイルが通らなかったので細部を直しましたが、私の環境ではちゃんとUIAlertViewのボタンイベントが拾われました。 \\n環境:iPhone6(iOS8.1.3)\\n\\nちなみに UIAlertView はiOS8から非推奨なので、iOS8以上なら代わりにUIAlertControllerを使うことを推奨します。\\n\\n```\\n\\n typealias CompletionHandler = (result: Bool?) -> Void\\n \\n class ViewController: UIViewController, UIAlertViewDelegate {\\n \\n let apiUrl = \\\&quot;https://www.google.co.jp\\\&quot;\\n \\n var completion: CompletionHandler? = {(result: Bool?) in\\n println(\\\&quot;API completed! \\\\(result)\\\&quot;)\\n }\\n \\n func test() {\\n let request = NSURLRequest(URL: NSURL(string: apiUrl)!)\\n NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue(), completionHandler:{ (response: NSURLResponse!, data: NSData!, error: NSError!) in\\n \\n let alert = UIAlertView(\\n title: \\\&quot;アラートのタイトル\\\&quot;,\\n message: \\\&quot;アラートのメッセージ\\\&quot;,\\n delegate: self,\\n cancelButtonTitle: nil,\\n otherButtonTitles: \\\&quot;test1\\\&quot;, \\\&quot;test2\\\&quot;)\\n alert.show()\\n return\\n })\\n }\\n \\n func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) {\\n println(\\\&quot;clickedButtonAtIndex\\\&quot;)\\n println(buttonIndex)\\n \\n self.completion?(result: true)\\n }\\n }\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 3,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T05:31:11.530\&quot;,\n \&quot;id\&quot;: \&quot;7264\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T05:31:11.530\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8148\&quot;,\n \&quot;parent_id\&quot;: \&quot;7262\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7262&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7264&quot;}}},{&quot;rowIdx&quot;:1655,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7265\&quot;,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;Range-based for loopで参照にした時としないときではどのような違いがあるでしょうか。 \\n特に速度的な面では違いがあるのでしょうか?例えばvectorをRange-based for\\nloopで回す場合、単に値を書き換えることなく使う場合、通常のケースでは下記のどのケースが良いのでしょうか?直感的には3だと思われるのですが、今まで常に1を使っていました。\\n\\n```\\n\\n vector<string> vec =\\n {\\n \\\&quot;foo\\\&quot;, \\\&quot;bar\\\&quot;, \\\&quot;baz\\\&quot;\\n };\\n // case 1\\n for ( auto it : vec )\\n {\\n cout << it << endl;\\n }\\n // case 2\\n for ( auto &amp;it : vec )\\n {\\n cout << it << endl;\\n }\\n // case 3\\n for ( const auto &amp;it : vec )\\n {\\n cout << it << endl;\\n }\\n \\n```\\n\\n追記 ------------- \\n皆さま、申し訳ございません。確かに質問として成り立っておりませんでした。 \\n私のほうでCygwin上のgcc 4.8.3でのベンチマークを追記いたします。 \\n100万行程度では差がほとんど見られなかったので \\nランダムなアルファベット文字列1000万行のテキストで最適化オプションなしで \\n計測いたしました。\\n\\nケース1 参照なしのパターン\\n\\n```\\n\\n #include <iostream>\\n #include <fstream>\\n #include <chrono>\\n #include <vector>\\n \\n using namespace std;\\n \\n int main()\\n {\\n vector<string> v;\\n \\n ifstream ifs(\\\&quot;test_mil.txt\\\&quot;);\\n if (ifs.fail()) return -1;\\n \\n for (string line; getline(ifs, line); )\\n {\\n v.push_back(line);\\n }\\n \\n const auto startTime = chrono::system_clock::now();\\n \\n string ss;\\n int i = 0;\\n for (auto s : v)\\n {\\n if (i % 2 == 0)\\n ss = s.substr(i % s.size()); \\n else\\n ss = s;\\n cout << (i % 2);\\n i++;\\n }\\n cout << '\\\\n';\\n \\n const auto endTime = chrono::system_clock::now();\\n const auto timeSpan = endTime - startTime;\\n cout << \\\&quot;処理時間: \\\&quot;\\n << chrono::duration_cast<chrono::milliseconds>(timeSpan).count() \\n << \\\&quot; [ms]\\\&quot; << std::endl;\\n \\n cout << ss << endl;\\n \\n return 0;\\n }\\n \\n```\\n\\nケース2 参照のパターン\\n\\n```\\n\\n #include <iostream>\\n #include <fstream>\\n #include <chrono>\\n #include <vector>\\n \\n using namespace std;\\n \\n int main()\\n {\\n vector<string> v;\\n \\n ifstream ifs(\\\&quot;test_mil.txt\\\&quot;);\\n if (ifs.fail()) return -1;\\n \\n for (string line; getline(ifs, line); )\\n {\\n v.push_back(line);\\n }\\n \\n const auto startTime = chrono::system_clock::now();\\n \\n string ss;\\n int i = 0;\\n for (auto &amp;s : v)\\n {\\n if (i % 2 == 0)\\n ss = s.substr(i % s.size()); \\n else\\n ss = s;\\n cout << (i % 2);\\n i++;\\n }\\n cout << '\\\\n';\\n \\n const auto endTime = chrono::system_clock::now();\\n const auto timeSpan = endTime - startTime;\\n cout << \\\&quot;処理時間: \\\&quot;\\n << chrono::duration_cast<chrono::milliseconds>(timeSpan).count() \\n << \\\&quot; [ms]\\\&quot; << std::endl;\\n \\n cout << ss << endl;\\n \\n return 0;\\n }\\n \\n```\\n\\n計測結果: \\nケース1 3123ms 3125ms 3135ms 平均 3128ms \\nケース2 2944ms 2927ms 2935ms 平均 2935ms \\nということでケース2のほうが速いことがわかりました。 \\nまた次のようなコードを書くと\\n\\n```\\n\\n #include <iostream>\\n #include <vector>\\n \\n using namespace std;\\n \\n class mystring : public std::string {\\n public:\\n \\n mystring(const char *str) : std::string(str) { }\\n \\n // コピーコンストラクタ\\n mystring(const mystring &amp;rhs) : string(rhs.c_str())\\n {\\n cout << \\\&quot;mystring copy constructor\\\&quot; << endl;\\n }\\n \\n };\\n \\n int main()\\n {\\n vector<mystring> v;\\n mystring m(\\\&quot;abc\\\&quot;);\\n v.push_back(m);\\n \\n cout << \\\&quot;test start\\\&quot; << endl;\\n for (auto &amp;s : v)\\n {\\n cout << s << endl;\\n }\\n cout << \\\&quot;test end\\\&quot; << endl;\\n \\n return 0;\\n }\\n \\n```\\n\\nこのケースではコピーコンストラクタが呼び出されず、 \\nfor (auto s : v)としたほうではコピーコンストラクタが呼び出されました。 \\nよって私の環境下につきましてはjoy1192さんの解答の通りとなりました。\&quot;,\n \&quot;comment_count\&quot;: 7,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T05:00:39.270\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7263\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T06:53:53.643\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T17:05:04.567\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7744\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7744\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 4,\n \&quot;tags\&quot;: [\n \&quot;c++\&quot;\n ],\n \&quot;title\&quot;: \&quot;Range-based for loopで参照にした時としない時の速度面での違い\&quot;,\n \&quot;view_count\&quot;: 2181\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;case 2,case 3は用途によって使い分けるべきですが、一般的な使い方の上ではcase 1は遅くなります。\n\ncase 1の場合、 \n`vector<T>`の要素を1つ1つ`auto\nit`にコピーしていきます。つまり、毎回コピーコンストラクタが呼び出されるため、単純なアクセス用途であれば無駄なコストが発生します。 \n`for`ループ内でコピーした値に対して破壊的な操作を行いたい場合に使用するケースは有るでしょう。\n\ncase 2, case 3の場合、 \n`vector<T>`内の要素に対する参照を渡しているだけなので、高速です。 \n原理的にはポインタのコピー程度のコストしか発生しません。constの有無は速度には大きく関係しないはずです。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T06:03:07.903&quot;,&quot;id&quot;:&quot;7265&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T06:03:07.903&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;6119&quot;,&quot;parent_id&quot;:&quot;7263&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:4},{&quot;body&quot;:&quot;質問文の要件にある通り、コンテナ型`vector<string>` かつ 要素書き換え無し ならば、 case 3:`cosnt auto&amp;`\n一択でよいでしょう。\n\n一般的に case 3:`const auto&amp;` と case 2:`auto&amp;`\nとで速度的な差異は生じませんが、要素の書き換えを伴わないforループならば、コーディング誤りを防ぐためにもconst修飾指定が望ましいです。case\n1:`auto`\nは、コンテナの要素型が基本型でもない限り避けるべきです。無駄な要素コピーによって速度的なペナルティを受けますし、要素型がコピー不可な場合はコンパイルエラーを引き起こします。\n\n一般論としては、目的に応じ下記2種類を使い分けるのがベターです。\n\n * `for (auto&amp;&amp; e : c)`:要素`e`を書き換える可能性がある\n * `for (const auto&amp; e : c)`:要素`e`を参照するだけ\n\n関連情報として、次期C++標準(C++14の次)に向けて提案さていた、Terse Range-Based\nforの[初期提案文書](http://www.open-\nstd.org/jtc1/sc22/wg21/docs/papers/2014/n3853.htm)にも次の言及があります。ただし、この提案は最終的に[却下されました](http://ezoeryou.github.io/blog/article/2014-12-11-tarse-\nrange-based-for-removed-from-clang.html)。\n\n> \&quot;for (auto elem : range)\&quot; is very tempting and very bad. It produces \&quot;auto\n> elem = *__begin;\&quot; (see 6.5.4 [stmt.ranged]/1), which copies each element,\n> which is bad because:\n>\n> * It might not compile - [...]\n> * It might misbehave at runtime - [...]\n> * It might be inefficient - [...]\n>\n\n余談ですが:`for (~ it :\nvec)`の変数名`it`はイテレータを連想させる名前なので、`s(tr)`とか`e(lem)`の方が良いかもしれませんね。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T01:48:33.623&quot;,&quot;id&quot;:&quot;7302&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T06:53:53.643&quot;,&quot;last_edit_date&quot;:&quot;2015-03-02T06:53:53.643&quot;,&quot;last_editor_user_id&quot;:&quot;49&quot;,&quot;owner_user_id&quot;:&quot;49&quot;,&quot;parent_id&quot;:&quot;7263&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;case 2,case 3は用途によって使い分けるべきですが、一般的な使い方の上ではcase 1は遅くなります。\\n\\ncase 1の場合、 \\n`vector<T>`の要素を1つ1つ`auto\\nit`にコピーしていきます。つまり、毎回コピーコンストラクタが呼び出されるため、単純なアクセス用途であれば無駄なコストが発生します。 \\n`for`ループ内でコピーした値に対して破壊的な操作を行いたい場合に使用するケースは有るでしょう。\\n\\ncase 2, case 3の場合、 \\n`vector<T>`内の要素に対する参照を渡しているだけなので、高速です。 \\n原理的にはポインタのコピー程度のコストしか発生しません。constの有無は速度には大きく関係しないはずです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T06:03:07.903\&quot;,\n \&quot;id\&quot;: \&quot;7265\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T06:03:07.903\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;6119\&quot;,\n \&quot;parent_id\&quot;: \&quot;7263\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 4\n },\n {\n \&quot;body\&quot;: \&quot;質問文の要件にある通り、コンテナ型`vector<string>` かつ 要素書き換え無し ならば、 case 3:`cosnt auto&amp;`\\n一択でよいでしょう。\\n\\n一般的に case 3:`const auto&amp;` と case 2:`auto&amp;`\\nとで速度的な差異は生じませんが、要素の書き換えを伴わないforループならば、コーディング誤りを防ぐためにもconst修飾指定が望ましいです。case\\n1:`auto`\\nは、コンテナの要素型が基本型でもない限り避けるべきです。無駄な要素コピーによって速度的なペナルティを受けますし、要素型がコピー不可な場合はコンパイルエラーを引き起こします。\\n\\n一般論としては、目的に応じ下記2種類を使い分けるのがベターです。\\n\\n * `for (auto&amp;&amp; e : c)`:要素`e`を書き換える可能性がある\\n * `for (const auto&amp; e : c)`:要素`e`を参照するだけ\\n\\n関連情報として、次期C++標準(C++14の次)に向けて提案さていた、Terse Range-Based\\nforの[初期提案文書](http://www.open-\\nstd.org/jtc1/sc22/wg21/docs/papers/2014/n3853.htm)にも次の言及があります。ただし、この提案は最終的に[却下されました](http://ezoeryou.github.io/blog/article/2014-12-11-tarse-\\nrange-based-for-removed-from-clang.html)。\\n\\n> \\\&quot;for (auto elem : range)\\\&quot; is very tempting and very bad. It produces \\\&quot;auto\\n> elem = *__begin;\\\&quot; (see 6.5.4 [stmt.ranged]/1), which copies each element,\\n> which is bad because:\\n>\\n> * It might not compile - [...]\\n> * It might misbehave at runtime - [...]\\n> * It might be inefficient - [...]\\n>\\n\\n余談ですが:`for (~ it :\\nvec)`の変数名`it`はイテレータを連想させる名前なので、`s(tr)`とか`e(lem)`の方が良いかもしれませんね。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T01:48:33.623\&quot;,\n \&quot;id\&quot;: \&quot;7302\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T06:53:53.643\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T06:53:53.643\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;49\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;49\&quot;,\n \&quot;parent_id\&quot;: \&quot;7263\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7263&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7265&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7265&quot;}}},{&quot;rowIdx&quot;:1656,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7297\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;ServersMan@VPS(DTI)のCentOS7のVPS上で、ファイアウォールを設定するためFirewallDの使い方を調べ、見つけたサイトのとおりに設定しました。\\n\\nところが、設定完了後にFirewallDをstartしても、`$ sudo systemctl status firewalld` の表示は\\n`Active: inactive(dead)` のままで、その下に赤い文字で\\n\\n```\\n\\n 2015-03-01 15:07:27 ERROR: Exception DBusException: \\n org.freedesktop.DBus.Error.AccessDenied: Connection \\\&quot;:1.71\\\&quot; is not \\n allowed to own the service \\\&quot;org.fedoraproject.FirewallD1\\\&quot; due to \\n security policies in the configuration file\\n \\n```\\n\\nと表示されています。\\n\\nどうすれば正常にFirewallDを起動できるのでしょうか?\\n\\n打ったコマンドは以下のとおりです。\\n\\n```\\n\\n $ yum -y install firewalld firewalld-service firewalld-config \\n $ sudo systemctl start firewalld\\n $ sudo systemctl enable firewalld\\n $ sudo systemctl status firewalld\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 4.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T06:20:59.687\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7266\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2020-06-05T05:19:47.607\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2020-06-05T05:19:47.607\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7500\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7500\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;centos\&quot;\n ],\n \&quot;title\&quot;: \&quot;FirewallDが動作しない(org.freedesktop.DBus.Error.AccessDeniedエラー)\&quot;,\n \&quot;view_count\&quot;: 1951\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;お使いの VPS はコンテナ型なのではないでしょうか。コンテナ型だと kernel は仮想化ホスト側と共通なので、kernel の機能は使えません。 \ndbus, firewalld だけでなく、iptables 自体も使えないのではないでしょうか。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T01:00:11.363&quot;,&quot;id&quot;:&quot;7297&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T01:00:11.363&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;4603&quot;,&quot;parent_id&quot;:&quot;7266&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;お使いの VPS はコンテナ型なのではないでしょうか。コンテナ型だと kernel は仮想化ホスト側と共通なので、kernel の機能は使えません。 \\ndbus, firewalld だけでなく、iptables 自体も使えないのではないでしょうか。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T01:00:11.363\&quot;,\n \&quot;id\&quot;: \&quot;7297\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T01:00:11.363\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;4603\&quot;,\n \&quot;parent_id\&quot;: \&quot;7266\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7266&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7297&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7297&quot;}}},{&quot;rowIdx&quot;:1657,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7269\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;こんにちわ。プログラミング初心者です。 \\nRubyのversion変更ができず困っています。\\n\\n```\\n\\n ruby -v\\n ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]\\n \\n```\\n\\nと出るのですが、 \\n下記を実行するとエラーが出てしまい、rails tutorialが進みません。 \\nどなたか知見のある方アドバイスいただけると嬉しいです。\\n\\n```\\n\\n rails generate scaffold User name:string email:string\\n Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2\\n \\n```\\n\\nよろしくお願いします。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T06:50:42.647\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7267\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T07:36:55.843\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T07:25:12.307\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;724\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8613\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;ruby-on-rails\&quot;,\n \&quot;rbenv\&quot;\n ],\n \&quot;title\&quot;: \&quot;Ruby on Rails - Rubyのversion変更ができない\&quot;,\n \&quot;view_count\&quot;: 2088\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;[rbenv](/questions/tagged/rbenv \&quot;'rbenv' のタグが付いた質問を表示\&quot;)タグがあるので rbenv を使って ruby\nをインストールしている前提とします。 \nおそらく `rails` コマンドは rbenv によってインストールされた ruby ではなく、別の場所にインストールされている Ruby 2.0.0\nでインストールされた rails を実行しているのが原因です。 \nrbenv によってインストールされる rails のほうが前になるように PATH を設定する必要があります。\n\n例えば `~/.rbenv` 以下に rbenv がインストールされており、PATH が以下である場合\n\n```\n\n $ echo $PATH\n /Users/itochan/.rbenv/shims:/Users/itochan/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin\n \n```\n\nrails コマンドを実行したときに `/usr/bin/rails` や `/usr/local/bin/rails` ではなく\n`/Users/itochan/.rbenv/shims/rails` が実行されます。\n\nPATH の設定方法は通常シェルの設定ファイルに\n\n```\n\n export PATH=~/foo/bar:$PATH\n \n```\n\nなどと書きますが、 rbenv であれば\n\n```\n\n eval \&quot;$(rbenv init -)\&quot;\n \n```\n\nをシェルの設定ファイル(`.bashrc` など)に追記すると PATH が追加されます。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T07:13:06.267&quot;,&quot;id&quot;:&quot;7269&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T07:36:55.843&quot;,&quot;last_edit_date&quot;:&quot;2015-03-01T07:36:55.843&quot;,&quot;last_editor_user_id&quot;:&quot;724&quot;,&quot;owner_user_id&quot;:&quot;724&quot;,&quot;parent_id&quot;:&quot;7267&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;[rbenv](/questions/tagged/rbenv \\\&quot;'rbenv' のタグが付いた質問を表示\\\&quot;)タグがあるので rbenv を使って ruby\\nをインストールしている前提とします。 \\nおそらく `rails` コマンドは rbenv によってインストールされた ruby ではなく、別の場所にインストールされている Ruby 2.0.0\\nでインストールされた rails を実行しているのが原因です。 \\nrbenv によってインストールされる rails のほうが前になるように PATH を設定する必要があります。\\n\\n例えば `~/.rbenv` 以下に rbenv がインストールされており、PATH が以下である場合\\n\\n```\\n\\n $ echo $PATH\\n /Users/itochan/.rbenv/shims:/Users/itochan/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin\\n \\n```\\n\\nrails コマンドを実行したときに `/usr/bin/rails` や `/usr/local/bin/rails` ではなく\\n`/Users/itochan/.rbenv/shims/rails` が実行されます。\\n\\nPATH の設定方法は通常シェルの設定ファイルに\\n\\n```\\n\\n export PATH=~/foo/bar:$PATH\\n \\n```\\n\\nなどと書きますが、 rbenv であれば\\n\\n```\\n\\n eval \\\&quot;$(rbenv init -)\\\&quot;\\n \\n```\\n\\nをシェルの設定ファイル(`.bashrc` など)に追記すると PATH が追加されます。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T07:13:06.267\&quot;,\n \&quot;id\&quot;: \&quot;7269\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T07:36:55.843\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T07:36:55.843\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;724\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;724\&quot;,\n \&quot;parent_id\&quot;: \&quot;7267\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7267&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7269&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7269&quot;}}},{&quot;rowIdx&quot;:1658,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7381\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;`X(数字)`という形式の識別子をパースするパーサーを`parsers`ライブラリで書こうと思い、`Text.Parser.Token.Style.emptyIdents`を使って以下のような`IdentifierStyle`を定義しましたが、型エラーになってしまいます。\\n\\n```\\n\\n import Text.Trifecta\\n import Text.Parser.Token.Style\\n \\n identStyle :: IdentifierStyle Parser\\n identStyle = emptyIdents {\\n _styleStart = char 'X' :: Parser Char,\\n _styleLetter = digit :: Parser Char\\n }\\n \\n -- パーサをこのように定義したい(例: \\\&quot;X3\\\&quot; -> Var 3)\\n ident = Var . (read . tail) <$> ident\\n \\n```\\n\\n現状はとりあえずnaiveに`ident = Var . read <$> (char 'X' >> many\\ndigit)`と定義していますが、何故上のコードで型エラーが出るのか知りたいです。\\n\\n具体的な型エラーは以下のようになります。\\n\\n```\\n\\n No instance for (Text.Parser.Token.TokenParsing t0)\\n arising from a use of Text.Parser.Token.Style.emptyIdents \\n The type variable t0 is ambiguous\\n Note: there are several potential instances:\\n instance (Text.Parser.Token.TokenParsing m,\\n Control.Monad.MonadPlus m) =>\\n Text.Parser.Token.TokenParsing\\n (transformers-0.3.0.0:Control.Monad.Trans.Identity.IdentityT m)\\n -- Defined in Text.Parser.Token \\n instance parsec-3.1.8:Text.Parsec.Prim.Stream\\n s m ghc-prim:GHC.Types.Char =>\\n Text.Parser.Token.TokenParsing\\n (parsec-3.1.8:Text.Parsec.Prim.ParsecT s u m)\\n -- Defined in Text.Parser.Token \\n instance attoparsec-0.12.1.3:Data.Attoparsec.Internal.Types.Chunk\\n t =>\\n Text.Parser.Token.TokenParsing\\n (attoparsec-0.12.1.3:Data.Attoparsec.Internal.Types.Parser t)\\n -- Defined in Text.Parser.Token \\n ...plus 12 others\\n In the expression: Text.Parser.Token.Style.emptyIdents\\n In the expression:\\n Text.Parser.Token.Style.emptyIdents\\n {Text.Parser.Token._styleStart = Text.Parser.Char.char 'X' ::\\n Text.Trifecta.Parser.Parser ghc-prim:GHC.Types.Char,\\n Text.Parser.Token._styleLetter = Text.Parser.Char.digit ::\\n Text.Trifecta.Parser.Parser ghc-prim:GHC.Types.Char}\\n In an equation for identStyle :\\n identStyle\\n = Text.Parser.Token.Style.emptyIdents\\n {Text.Parser.Token._styleStart = Text.Parser.Char.char 'X' ::\\n Text.Trifecta.Parser.Parser ghc-prim:GHC.Types.Char,\\n Text.Parser.Token._styleLetter = Text.Parser.Char.digit ::\\n Text.Trifecta.Parser.Parser ghc-prim:GHC.Types.Char}\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T07:54:54.953\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7270\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T10:07:32.660\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;2781\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;haskell\&quot;\n ],\n \&quot;title\&quot;: \&quot;Text.Parser.Token.StyleのemptyIdentsの使い方について\&quot;,\n \&quot;view_count\&quot;: 207\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;Haskellのレコード更新構文は、更新の前後で型が変わらないことを要求しません。このため、更新後の型が決まっていても更新前の型が完全には決まらないことがあります。この例では、`emptyIndents`の型が`TokenParsing\nm => IdentifierStyle m`ですが、この`m`を決める手掛りがないため曖昧エラーが発生しています。\n\n回避する方法はいくつかあります。\n\n * 明示的に型注釈を与える。\n``` identStyle' :: IdentifierStyle Parser\n\n identStyle' = (emptyIdents :: IdentifierStyle Parser) {\n _styleStart = char 'X',\n _styleLetter = digit\n }\n \n```\n\n * 更新を二回に分けることで型の自由度をなくす。\n``` identStyle'' :: IdentifierStyle Parser\n\n identStyle'' = emptyIdents {\n _styleStart = char 'X'\n } {\n _styleLetter = digit\n }\n \n```\n\n * 用意されているレンズを使う。\n``` identStyle''' :: IdentifierStyle Parser\n\n identStyle''' = emptyIdents\n &amp; styleStart .~ char 'X'\n &amp; styleLetter .~ digit\n \n```&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T10:07:32.660&quot;,&quot;id&quot;:&quot;7381&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T10:07:32.660&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8654&quot;,&quot;parent_id&quot;:&quot;7270&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:5}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;Haskellのレコード更新構文は、更新の前後で型が変わらないことを要求しません。このため、更新後の型が決まっていても更新前の型が完全には決まらないことがあります。この例では、`emptyIndents`の型が`TokenParsing\\nm => IdentifierStyle m`ですが、この`m`を決める手掛りがないため曖昧エラーが発生しています。\\n\\n回避する方法はいくつかあります。\\n\\n * 明示的に型注釈を与える。\\n``` identStyle' :: IdentifierStyle Parser\\n\\n identStyle' = (emptyIdents :: IdentifierStyle Parser) {\\n _styleStart = char 'X',\\n _styleLetter = digit\\n }\\n \\n```\\n\\n * 更新を二回に分けることで型の自由度をなくす。\\n``` identStyle'' :: IdentifierStyle Parser\\n\\n identStyle'' = emptyIdents {\\n _styleStart = char 'X'\\n } {\\n _styleLetter = digit\\n }\\n \\n```\\n\\n * 用意されているレンズを使う。\\n``` identStyle''' :: IdentifierStyle Parser\\n\\n identStyle''' = emptyIdents\\n &amp; styleStart .~ char 'X'\\n &amp; styleLetter .~ digit\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T10:07:32.660\&quot;,\n \&quot;id\&quot;: \&quot;7381\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T10:07:32.660\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8654\&quot;,\n \&quot;parent_id\&quot;: \&quot;7270\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 5\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7270&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7381&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7381&quot;}}},{&quot;rowIdx&quot;:1659,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7382\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;```\\n\\n myModule.controller('manager_information_controller', function($scope, member){\\n \\n //親画面から呼ばれる関数\\n $scope.showModalForMemberInformation = function(){\\n \\n modal_manager.show(); \\n $scope.test = \\\&quot;11\\\&quot;;\\n }\\n \\n //子(モーダル)画面から呼ばれる関数\\n $scope.selectMembers = function(){\\n \\n modal_manager.hide();\\n $scope.test = \\\&quot;22\\\&quot;;\\n \\n }\\n \\n <!-- ページ -->\\n <ons-page id=\\\&quot;manager_information\\\&quot; ng-controller=\\\&quot;manager_information_controller\\\&quot;>\\n \\n {{newGuest}}\\n \\n <ons-list-item modifier=\\\&quot;chevron\\\&quot; ng-click=\\\&quot;showModalForMember()\\\&quot;>\\n モーダルへ\\n </ons-list-item> \\n \\n </ons-page>\\n \\n <!-- モーダル -->\\n <ons-modal var=\\\&quot;modal_manager\\\&quot; ng-controller=\\\&quot;manager_information_controller\\\&quot;>\\n <ons-button ng-click=\\\&quot;selectMembers()\\\&quot;>検索</ons-button>\\n </ons-modal>\\n \\n```\\n\\n親画面が子画面の値を見る方法が分からなくて、困っています。 \\nよろしくお願いします。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T10:34:35.020\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7273\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T15:10:49.230\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T10:55:56.413\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;76\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8615\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;monaca\&quot;,\n \&quot;onsen-ui\&quot;\n ],\n \&quot;title\&quot;: \&quot;親画面が子画面の値を見る方法\&quot;,\n \&quot;view_count\&quot;: 1344\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;あるコントローラーからons-\nmodal中のコントローラーの値を見たいということで大丈夫でしょうか。あるコントローラーから別のコントローラーに値を渡したいのであれば、少なくとも方法は2つあります。\n\n * 一つはAngularJSのサービスを使って値を渡す方法です。あるサービスを作ってそのサービスを2つの両方のコントローラーにインジェクションします。1つ目のコントローラーで値を入力して、モーダル内のコントローラーで値を受け取ることができます。詳細は下の例をみてください。\n\n詳細コード:\n\n```\n\n //サービスを作ります。\n myApp.factory('SharedData', function () {\n return { example: 'example' };\n });\n \n //コントローラーを作ってサービスをインジェクションします。親画面\n myApp.controller('ParentScreenController', function( $scope, SharedData ){\n $scope.Data = SharedData;\n });\n \n //コントローラーを作ってサービスをインジェクションします。子画面 \n myApp.controller('ChildScreenController', function( $scope, SharedData ){\n $scope.Data = SharedData;\n });\n \n```\n\n * もう一つはイベントを発行して値を渡す方法です。 1つ目のコントローラーでイベントを発行することによって、他のコントローラーにそのイベントとともに値を渡すことができます。簡単ですが、例を用意しました(注意: $rootScopeを両方のコントローラーにインジェクションして下さい) 。\n\n詳細:\n\n```\n\n // イベントおよび値を発行するコントローラー 子画面\n myApp.controller('FirstController', function( $scope, SharedData, $rootScope ){\n $rootScope.$broadcast('updatingData', sharedData);\n alert('updatingDataイベントを発行しました!');\n });\n \n // イベントおよび値を受け取るコントローラー 親画面\n myApp.controller('SecondController', function( $scope, SharedData, $rootScope ){ \n $rootScope.$on('updatingData', function(event, sharedData) {\n alert('イベント受信完了!');\n $scope.sharedData = sharedData;\n });\n });\n \n```\n\nお役に立てれば嬉しいです。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T10:26:38.837&quot;,&quot;id&quot;:&quot;7382&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T15:10:49.230&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T15:10:49.230&quot;,&quot;last_editor_user_id&quot;:&quot;7871&quot;,&quot;owner_user_id&quot;:&quot;7871&quot;,&quot;parent_id&quot;:&quot;7273&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;あるコントローラーからons-\\nmodal中のコントローラーの値を見たいということで大丈夫でしょうか。あるコントローラーから別のコントローラーに値を渡したいのであれば、少なくとも方法は2つあります。\\n\\n * 一つはAngularJSのサービスを使って値を渡す方法です。あるサービスを作ってそのサービスを2つの両方のコントローラーにインジェクションします。1つ目のコントローラーで値を入力して、モーダル内のコントローラーで値を受け取ることができます。詳細は下の例をみてください。\\n\\n詳細コード:\\n\\n```\\n\\n //サービスを作ります。\\n myApp.factory('SharedData', function () {\\n return { example: 'example' };\\n });\\n \\n //コントローラーを作ってサービスをインジェクションします。親画面\\n myApp.controller('ParentScreenController', function( $scope, SharedData ){\\n $scope.Data = SharedData;\\n });\\n \\n //コントローラーを作ってサービスをインジェクションします。子画面 \\n myApp.controller('ChildScreenController', function( $scope, SharedData ){\\n $scope.Data = SharedData;\\n });\\n \\n```\\n\\n * もう一つはイベントを発行して値を渡す方法です。 1つ目のコントローラーでイベントを発行することによって、他のコントローラーにそのイベントとともに値を渡すことができます。簡単ですが、例を用意しました(注意: $rootScopeを両方のコントローラーにインジェクションして下さい) 。\\n\\n詳細:\\n\\n```\\n\\n // イベントおよび値を発行するコントローラー 子画面\\n myApp.controller('FirstController', function( $scope, SharedData, $rootScope ){\\n $rootScope.$broadcast('updatingData', sharedData);\\n alert('updatingDataイベントを発行しました!');\\n });\\n \\n // イベントおよび値を受け取るコントローラー 親画面\\n myApp.controller('SecondController', function( $scope, SharedData, $rootScope ){ \\n $rootScope.$on('updatingData', function(event, sharedData) {\\n alert('イベント受信完了!');\\n $scope.sharedData = sharedData;\\n });\\n });\\n \\n```\\n\\nお役に立てれば嬉しいです。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T10:26:38.837\&quot;,\n \&quot;id\&quot;: \&quot;7382\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T15:10:49.230\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T15:10:49.230\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7871\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7871\&quot;,\n \&quot;parent_id\&quot;: \&quot;7273\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7273&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7382&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7382&quot;}}},{&quot;rowIdx&quot;:1660,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;CodeEvalのReverseWordsが解けません。 \\n<https://www.codeeval.com/open_challenges/8/>\\n\\nsolve内でリストをreverseさせたいのですが、 \\nリスト内の要素を文字列を反復してしまいます。\\n\\nこういったとき、どういう風に考えれば解けますでしょうか?\\n\\n```\\n\\n import System.Environment (getArgs)\\n \\n solve :: [String] -> [String]\\n solve ss = fmap reverse ss\\n \\n main = do\\n contents <- getContents\\n mapM_ putStrLn $ solve $ lines contents\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T11:11:32.530\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7276\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T12:31:13.757\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8618\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 0,\n \&quot;tags\&quot;: [\n \&quot;haskell\&quot;\n ],\n \&quot;title\&quot;: \&quot;haskell で codeeval の問題が解けない\&quot;,\n \&quot;view_count\&quot;: 189\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;この場合、まずwhitespaceで区切って`[\&quot;Hello\&quot;, \&quot;World\&quot;]`のようなリストを作ってから反転させる、と考えるべきです。\n\n`words`で\n\n```\n\n > words \&quot;This is a pen\&quot;\n > [\&quot;This\&quot;, \&quot;is\&quot;, \&quot;a\&quot;, \&quot;pen\&quot;]\n \n```\n\n`unwords`で\n\n```\n\n > unwords [\&quot;pen\&quot;,\&quot;a\&quot;,\&quot;is\&quot;,\&quot;This\&quot;]\n > \&quot;pen a is This\&quot;\n \n```\n\nのような変換ができます。\n\n以下に正しい`solve`を掲載します。(マウスオーバーで表示します。)\n\n> `solve :: [String] -> [String]` \n> `solve = fmap (unwords . reverse . words)`&quot;,&quot;comment_count&quot;:3,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T12:02:01.420&quot;,&quot;id&quot;:&quot;7277&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T12:31:13.757&quot;,&quot;last_edit_date&quot;:&quot;2015-03-01T12:31:13.757&quot;,&quot;last_editor_user_id&quot;:&quot;2781&quot;,&quot;owner_user_id&quot;:&quot;2781&quot;,&quot;parent_id&quot;:&quot;7276&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;この場合、まずwhitespaceで区切って`[\\\&quot;Hello\\\&quot;, \\\&quot;World\\\&quot;]`のようなリストを作ってから反転させる、と考えるべきです。\\n\\n`words`で\\n\\n```\\n\\n > words \\\&quot;This is a pen\\\&quot;\\n > [\\\&quot;This\\\&quot;, \\\&quot;is\\\&quot;, \\\&quot;a\\\&quot;, \\\&quot;pen\\\&quot;]\\n \\n```\\n\\n`unwords`で\\n\\n```\\n\\n > unwords [\\\&quot;pen\\\&quot;,\\\&quot;a\\\&quot;,\\\&quot;is\\\&quot;,\\\&quot;This\\\&quot;]\\n > \\\&quot;pen a is This\\\&quot;\\n \\n```\\n\\nのような変換ができます。\\n\\n以下に正しい`solve`を掲載します。(マウスオーバーで表示します。)\\n\\n> `solve :: [String] -> [String]` \\n> `solve = fmap (unwords . reverse . words)`\&quot;,\n \&quot;comment_count\&quot;: 3,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T12:02:01.420\&quot;,\n \&quot;id\&quot;: \&quot;7277\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T12:31:13.757\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T12:31:13.757\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;2781\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;2781\&quot;,\n \&quot;parent_id\&quot;: \&quot;7276\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7276&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7277&quot;}}},{&quot;rowIdx&quot;:1661,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7285\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;A, B, C のアクティビティがあります。 \\nA は B の親、B は C の親になります。(AndroidManifest.xml に記述済み)\\n\\nA -> B -> C のように遷移をした時に UP ボタンを押すと、B に遷移します。期待通りです。 \\nしかし A -> C のように遷移をした時に UP ボタンを押すと、A に遷移してしまいます。\\n\\nコードは[Android のドキュメント](http://developer.android.com/training/implementing-\\nnavigation/ancestral.html#NavigateUp)と同じようにしています。\\n\\n```\\n\\n public boolean onOptionsItemSelected(MenuItem item) {\\n switch (item.getItemId()) {\\n case android.R.id.home:\\n NavUtils.navigateUpFromSameTask(this);\\n return true;\\n }\\n return super.onOptionsItemSelected(item);\\n }\\n \\n```\\n\\nそこで、次のように、startActivity を利用する形に変更したら、期待通り B に遷移することが出来ました。\\n\\n```\\n\\n public boolean onOptionsItemSelected(MenuItem item) {\\n switch (item.getItemId()) {\\n case android.R.id.home:\\n Intent intent = NavUtils.getParentActivityIntent(this);\\n startActivity(intent)\\n return true;\\n }\\n return super.onOptionsItemSelected(item);\\n }\\n \\n```\\n\\nnavigateUpFromSameTask の挙動は「親のアクティビティに遷移する」だと思っていたのですが、そうでないケースがあるようです。\\n\\nそこで質問なのですが、親のアクティビティに遷移したい場合、\\n\\n * 上記の startAcitivity を利用した方法で問題がないか\\n * なぜ navigateUpFromSameTask が期待通りに動かないか\\n\\nを知りたいです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T13:18:18.530\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7279\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T14:31:44.803\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;205\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;android\&quot;\n ],\n \&quot;title\&quot;: \&quot;navigateUpFromSameTask の挙動について\&quot;,\n \&quot;view_count\&quot;: 433\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;タスクの概念に関する理解が必要なように思います。\n\nざっくり説明すると、タスクというのは`Activity`のヒストリースタック、このケースで言えば、「A -> B ->\nC」のことをタスクと呼称します。詳細な説明は公式ドキュメントの[Tasks and Back\nStack](http://developer.android.com/guide/components/tasks-and-back-\nstack.html)を参照ください。\n\n### Q.上記の startAcitivity を利用した方法で問題がないか\n\n両者の挙動は全く異なるので、アプリケーションとしてどういう挙動を望むかによります。\n\n`AndroidManifest.xml`に`Activity`の`launchMode`をどう指定したかによりますが、ほとんどの場合はデフォルトの`standard`かと思います。この場合、\n\n```\n\n A -> B -> C\n \n```\n\nの状態から、Bを`startAcitivity()`した場合、\n\n```\n\n A -> B -> C -> B\n \n```\n\nとスタックが積み重ねられます。一方、`navigateUpFromSameTask()`を利用した場合、\n\n```\n\n A -> B\n \n```\n\nの状態になります。(`CLEAR_TOP`フラグが付与されて、Bが呼び出されます。また、Cの`Activity`を`finish()`する点も異なります)\n\n### Q.なぜ navigateUpFromSameTask が期待通りに動かないか\n\nこれについては[`navigateUpFromSameTask`のドキュメント](http://developer.android.com/reference/android/support/v4/app/NavUtils.html#navigateUpFromSameTask\\(android.app.Activity\\))に回答があります。\n\n> Note: This method should only be used when sourceActivity and the\n> corresponding parent are within the same task. If up navigation should cross\n> tasks in some cases, see shouldUpRecreateTask(Activity, Intent).\n\nこのメソッドは親となる`Activity`と呼び出し元`Activity`が同一のタスクに存在するときのみ利用すべきと記載されています。つまりAPIの利用目的から外れているのです。\n\nでは、このときの挙動はどうなっているのでしょう?\n\n実装はJBかそれ未満かで変わります。JB以降の場合、[`Activity#navigateUpTo()`](http://developer.android.com/reference/android/app/Activity.html#navigateUpTo\\(android.content.Intent\\))を呼び出しているだけなので、そちらのドキュメントより、\n\n> If the indicated activity does not appear in the history stack, this will\n> finish each activity in this task until the root activity of the task is\n> reached, resulting in an \&quot;in-app home\&quot; behavior.\n\n親`Activity`がヒストリースタックに存在しない場合、タスクのルートまで遡るとあります。このため、\n\n```\n\n A\n \n```\n\nの状態になるのです。(JB未満では挙動が異なり、恐らく期待通りBが起動すると思います)\n\n### 本来の利用想定ケース\n\n例えば以下のような、\n\n```\n\n A -> B -> C\n A -> B -> D -> C\n A -> B -> E -> C\n A -> B -> D -> E -> C\n \n```\n\nBからCへの遷移が複数パターンある場合、どのような遷移パターンであっても、`navigateUpFromSameTask()`を使うことで、\n\n```\n\n A -> B\n \n```\n\nの状態になります。C自身と、中途の`Activity`がクリアされているのがポイントです。複雑な階層構造を持っていても、確実に親のポイントまで戻せるのが`navigateUpFromSameTask()`の便利な点なのですが、単純な親子構造を実現したい場合には存外不便です。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T14:09:01.510&quot;,&quot;id&quot;:&quot;7285&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T14:31:44.803&quot;,&quot;last_edit_date&quot;:&quot;2020-06-17T08:14:45.997&quot;,&quot;last_editor_user_id&quot;:&quot;-1&quot;,&quot;owner_user_id&quot;:&quot;5337&quot;,&quot;parent_id&quot;:&quot;7279&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;タスクの概念に関する理解が必要なように思います。\\n\\nざっくり説明すると、タスクというのは`Activity`のヒストリースタック、このケースで言えば、「A -> B ->\\nC」のことをタスクと呼称します。詳細な説明は公式ドキュメントの[Tasks and Back\\nStack](http://developer.android.com/guide/components/tasks-and-back-\\nstack.html)を参照ください。\\n\\n### Q.上記の startAcitivity を利用した方法で問題がないか\\n\\n両者の挙動は全く異なるので、アプリケーションとしてどういう挙動を望むかによります。\\n\\n`AndroidManifest.xml`に`Activity`の`launchMode`をどう指定したかによりますが、ほとんどの場合はデフォルトの`standard`かと思います。この場合、\\n\\n```\\n\\n A -> B -> C\\n \\n```\\n\\nの状態から、Bを`startAcitivity()`した場合、\\n\\n```\\n\\n A -> B -> C -> B\\n \\n```\\n\\nとスタックが積み重ねられます。一方、`navigateUpFromSameTask()`を利用した場合、\\n\\n```\\n\\n A -> B\\n \\n```\\n\\nの状態になります。(`CLEAR_TOP`フラグが付与されて、Bが呼び出されます。また、Cの`Activity`を`finish()`する点も異なります)\\n\\n### Q.なぜ navigateUpFromSameTask が期待通りに動かないか\\n\\nこれについては[`navigateUpFromSameTask`のドキュメント](http://developer.android.com/reference/android/support/v4/app/NavUtils.html#navigateUpFromSameTask\\\\(android.app.Activity\\\\))に回答があります。\\n\\n> Note: This method should only be used when sourceActivity and the\\n> corresponding parent are within the same task. If up navigation should cross\\n> tasks in some cases, see shouldUpRecreateTask(Activity, Intent).\\n\\nこのメソッドは親となる`Activity`と呼び出し元`Activity`が同一のタスクに存在するときのみ利用すべきと記載されています。つまりAPIの利用目的から外れているのです。\\n\\nでは、このときの挙動はどうなっているのでしょう?\\n\\n実装はJBかそれ未満かで変わります。JB以降の場合、[`Activity#navigateUpTo()`](http://developer.android.com/reference/android/app/Activity.html#navigateUpTo\\\\(android.content.Intent\\\\))を呼び出しているだけなので、そちらのドキュメントより、\\n\\n> If the indicated activity does not appear in the history stack, this will\\n> finish each activity in this task until the root activity of the task is\\n> reached, resulting in an \\\&quot;in-app home\\\&quot; behavior.\\n\\n親`Activity`がヒストリースタックに存在しない場合、タスクのルートまで遡るとあります。このため、\\n\\n```\\n\\n A\\n \\n```\\n\\nの状態になるのです。(JB未満では挙動が異なり、恐らく期待通りBが起動すると思います)\\n\\n### 本来の利用想定ケース\\n\\n例えば以下のような、\\n\\n```\\n\\n A -> B -> C\\n A -> B -> D -> C\\n A -> B -> E -> C\\n A -> B -> D -> E -> C\\n \\n```\\n\\nBからCへの遷移が複数パターンある場合、どのような遷移パターンであっても、`navigateUpFromSameTask()`を使うことで、\\n\\n```\\n\\n A -> B\\n \\n```\\n\\nの状態になります。C自身と、中途の`Activity`がクリアされているのがポイントです。複雑な階層構造を持っていても、確実に親のポイントまで戻せるのが`navigateUpFromSameTask()`の便利な点なのですが、単純な親子構造を実現したい場合には存外不便です。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T14:09:01.510\&quot;,\n \&quot;id\&quot;: \&quot;7285\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T14:31:44.803\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2020-06-17T08:14:45.997\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;5337\&quot;,\n \&quot;parent_id\&quot;: \&quot;7279\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7279&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7285&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7285&quot;}}},{&quot;rowIdx&quot;:1662,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7283\&quot;,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;やりたいこと \\n・最後の`</div>`以降の文字列を取得したい\\n\\n対象文字列\\n\\n```\\n\\n 取得しない<div>取得しない</div><div>取得しない</div>取得する\\n \\n```\\n\\n* * *\\n\\n取得したい結果\\n\\n```\\n\\n 取得する\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T13:40:30.887\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7281\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T05:29:13.090\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T14:35:32.787\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;3313\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7886\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;php\&quot;\n ],\n \&quot;title\&quot;: \&quot;「最後に位置している指定文字列」以降の文字列を取得したい\&quot;,\n \&quot;view_count\&quot;: 1691\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;`strrpos`で部分文字列の最後の出現位置を検索できます。\n\n```\n\n <?php\n \n $search = \&quot;</div>\&quot;;\n $text = \&quot;取得しない<div>取得しない</div><div>取得しない</div>取得する\&quot;;\n \n $pos = strrpos($text, $search);\n if ($pos !== false) {\n echo substr($text, $pos + strlen($search));\n }\n \n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T13:47:09.280&quot;,&quot;id&quot;:&quot;7283&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T13:47:09.280&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;3639&quot;,&quot;parent_id&quot;:&quot;7281&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;```\n\n preg_replace('/.*<\\/div>/', '', '取得しない<div>取得しない</div><div>取得しない</div>取得する')\n \n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T05:29:13.090&quot;,&quot;id&quot;:&quot;7314&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T05:29:13.090&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5793&quot;,&quot;parent_id&quot;:&quot;7281&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;`strrpos`で部分文字列の最後の出現位置を検索できます。\\n\\n```\\n\\n <?php\\n \\n $search = \\\&quot;</div>\\\&quot;;\\n $text = \\\&quot;取得しない<div>取得しない</div><div>取得しない</div>取得する\\\&quot;;\\n \\n $pos = strrpos($text, $search);\\n if ($pos !== false) {\\n echo substr($text, $pos + strlen($search));\\n }\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T13:47:09.280\&quot;,\n \&quot;id\&quot;: \&quot;7283\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T13:47:09.280\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;3639\&quot;,\n \&quot;parent_id\&quot;: \&quot;7281\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;```\\n\\n preg_replace('/.*<\\\\/div>/', '', '取得しない<div>取得しない</div><div>取得しない</div>取得する')\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T05:29:13.090\&quot;,\n \&quot;id\&quot;: \&quot;7314\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T05:29:13.090\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5793\&quot;,\n \&quot;parent_id\&quot;: \&quot;7281\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7281&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7283&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7283&quot;}}},{&quot;rowIdx&quot;:1663,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7286\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;Node.jsでntwitterのパッケージを利用してbotを動かそうとしています。 \\nそこでbotに送られてきたリプライに対してリプライを返したいのですが、以下のように in_reply_to_status_id\\nオプションを送られてきたツイートのものを指定しても望んだ通りにツイートに対するリプライではなく単にユーザに対するリプライとなってしまします。\\n\\n```\\n\\n // twitter は ntwitter のオブジェクト\\n // reply は送られてきたツイートのオブジェクト\\n twitter.updateStatus(\\n \\\&quot;@example hoge\\\&quot;,\\n {\\n in_reply_to_status_id: reply.id\\n }, function(error, success){}\\n );\\n \\n```\\n\\n実際にhttpで送信されるデータをconsole.log等で確認したところタイポや指定の仕方が間違えているわけではありません。\\n\\nまた、rubyやphpでも同様のことを試してみましたがやはりツイートに対するリプライになりませんでした。\\n\\n各種クライアントや数あるbotではきちんとツイートに対するリプライができていることを考えると、何か原因があるのかもしれませんが、自分では解決できないので質問しています。\\n\\n根本的な原因を知っている方や、ツイートに対するリプライができるという方、ご教授お願いします。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T13:47:08.870\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7282\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T14:31:43.773\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T14:31:43.773\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8000\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;5317\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;javascript\&quot;,\n \&quot;node.js\&quot;,\n \&quot;twitter\&quot;\n ],\n \&quot;title\&quot;: \&quot;Twitter API の in_reply_to_status_id オプションを利用したリプライについて\&quot;,\n \&quot;view_count\&quot;: 2396\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;`id` プロパティにはツイートIDが数値として入っているのですが、現在のツイートIDは数字が大きすぎてJavascriptでは正確に扱うことができません。\n\n代わりに、IDが文字列として入っている `id_str` を使うようにしてください。\n\n```\n\n twitter.updateStatus(\n \&quot;@example hoge\&quot;,\n {\n in_reply_to_status_id: reply.id_str\n }, function(error, success){}\n );\n \n```\n\n## 参考\n\n * [TwitterのIDが64bitになるとJavaScript等で問題が出るので対策を - F.Ko-Jiの「一秒後は未来」](http://blog.fkoji.com/2010/10201250.html)\n * [Twitter IDs | Twitter Developers](https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake)&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T14:11:26.490&quot;,&quot;id&quot;:&quot;7286&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T14:11:26.490&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8000&quot;,&quot;parent_id&quot;:&quot;7282&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;`id` プロパティにはツイートIDが数値として入っているのですが、現在のツイートIDは数字が大きすぎてJavascriptでは正確に扱うことができません。\\n\\n代わりに、IDが文字列として入っている `id_str` を使うようにしてください。\\n\\n```\\n\\n twitter.updateStatus(\\n \\\&quot;@example hoge\\\&quot;,\\n {\\n in_reply_to_status_id: reply.id_str\\n }, function(error, success){}\\n );\\n \\n```\\n\\n## 参考\\n\\n * [TwitterのIDが64bitになるとJavaScript等で問題が出るので対策を - F.Ko-Jiの「一秒後は未来」](http://blog.fkoji.com/2010/10201250.html)\\n * [Twitter IDs | Twitter Developers](https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake)\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T14:11:26.490\&quot;,\n \&quot;id\&quot;: \&quot;7286\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T14:11:26.490\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8000\&quot;,\n \&quot;parent_id\&quot;: \&quot;7282\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7282&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7286&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7286&quot;}}},{&quot;rowIdx&quot;:1664,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;Swiftに関する質問です。 \\n下記のコードが何故結果のようになるのかわかりません。\\n\\nif let n = maybe のところはnという変数に変数maybeを代入しているんでしょうか?? \\n詳しい方、ご教示ください。よろしくお願いいたします。\\n\\n```\\n\\n var maybe : Int? = 1\\n if let n = maybe {\\n n + 1\\n // 2\\n }\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T14:02:49.503\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7284\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T14:41:17.537\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-01T14:41:17.537\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;3639\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8619\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;ios\&quot;,\n \&quot;swift\&quot;\n ],\n \&quot;title\&quot;: \&quot;Swiftのif文での代入に関する質問です。\&quot;,\n \&quot;view_count\&quot;: 544\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;> if let n = maybe のところはnという変数に変数maybeを代入しているんでしょうか??\n\n`let`ですので、`n`は変数ではなく定数ですが、代入しているという理解で正しいです。\n\nこの構文は`Optional Binding`といって、代入結果が`nil`の場合then節を実行しないという特徴があります。\n\n```\n\n var maybe : Int? = nil\n if let n = maybe {\n n + 1\n // do nothing\n }\n \n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T14:18:30.483&quot;,&quot;id&quot;:&quot;7287&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T14:18:30.483&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5337&quot;,&quot;parent_id&quot;:&quot;7284&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:9}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;> if let n = maybe のところはnという変数に変数maybeを代入しているんでしょうか??\\n\\n`let`ですので、`n`は変数ではなく定数ですが、代入しているという理解で正しいです。\\n\\nこの構文は`Optional Binding`といって、代入結果が`nil`の場合then節を実行しないという特徴があります。\\n\\n```\\n\\n var maybe : Int? = nil\\n if let n = maybe {\\n n + 1\\n // do nothing\\n }\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T14:18:30.483\&quot;,\n \&quot;id\&quot;: \&quot;7287\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T14:18:30.483\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5337\&quot;,\n \&quot;parent_id\&quot;: \&quot;7284\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 9\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7284&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7287&quot;}}},{&quot;rowIdx&quot;:1665,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7289\&quot;,\n \&quot;answer_count\&quot;: 8,\n \&quot;body\&quot;: \&quot;私はかつて(約10年前)VisualBasic6.0を使っていました。 \\nその当時はVBを使える人材が重宝されていました。\\n\\n最近、たまに求人広告を見ることがあるのですが、VisualBasic.NET \\nよりもC#の方が圧倒的に需要が高いように思います。\\n\\n私はVB.NETもC#も使ったことがありませんが、両者ともに開発環境の \\n雰囲気が似ていたような記憶があります。\\n\\nだとすると、文法等分かりやすいのはVB.NETだと直感的に思っていて \\nアプリケーションを開発しやすいのもVB.NETだと勝手に思っています。\\n\\nでも、多くの企業ではVB.NETよりもC#を使える人材の募集をしています。 \\nこれは何故でしょうか? \\nC#に特別な何かがあるのでしょうか?\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T15:30:05.487\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7288\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2016-11-26T14:09:31.517\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T12:12:31.510\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;85\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7634\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;c#\&quot;,\n \&quot;visual-studio\&quot;,\n \&quot;vb.net\&quot;\n ],\n \&quot;title\&quot;: \&quot;VB.NETよりもC#の方が求人が多いのはなぜ?\&quot;,\n \&quot;view_count\&quot;: 47401\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;文法が分かりやすいかどうか、アプリケーションが開発しやすいかどうかは主観的な問題ですので置いておきます。\n\n`C#`と`VB.net`は機能的に大きな差があるわけではありません。しかし言語の人気に[大きな差](http://goo.gl/H5ci7Z)がありますので、わざわざ人気がなく情報量の少ない`VB.net`を選ぶ理由があまりないと言えます。\n\nではなぜ`C#`の方に人気が出たのかという理由はちょっと難しいですが、私の思いつく限りでは、\n\n * `Java`や`C++`を利用している人には文法的に`C#`の方が馴染みやすい\n * `Mono`の`VB.net`への対応が`C#`に比べて遅いため、`Windows`以外の環境も考慮すると`C#`のほうが利用しやすい\n\nということになると思います。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T16:19:25.473&quot;,&quot;id&quot;:&quot;7289&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T16:19:25.473&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;3639&quot;,&quot;parent_id&quot;:&quot;7288&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:9},{&quot;body&quot;:&quot;現実問題として`C#`で開発されたプロジェクトや資産が多く、また`C#`を理解できる人間が多いというのが表向きの理由かと思います。\n\nではなぜ`C#`のほうが人気なのかという部分についてですが、これは客観的な理由よりも主観的な理由の方が大きい気がします。 \n私の周囲でも`Windows`向けの開発あるいは`Windows\nServer`を利用したWebアプリケーションの開発では、`C#`の採用数が`VB.NET`に比べるととても多いです。大抵の場合、\n\n * `VB.NET`は古い\n * `VB.NET`は遅い(実際には`C#`と違いが出るかは疑問です)\n * `VB.NET`は初心者向けなので、できることが限られている(どうなんでしょう)\n\nといった理由、あるいは暗黙の了解的なもので`C#`が選択されています。私自身もはじめて`.NET`を使うことになった際、あまり考えずに`C#`を採用しました。(`VB.NET`には初心者向けで本格的な業務用ではないというイメージはありました。)\n\nあるいは、書籍など情報の偏りもあるかもしれません。`C#`には初心者向けから中級者向けまで書籍は日本語でも充実していますが、`VB.NET`の本は`C#`ほど充実していないように思います。(O'Reillyも`VB.NET`の日本語の本は取り扱っていません。)\nただし卵(書籍)が先か鶏(人気)が先かはわかりません。\n\nもしかすると、物理学の世界で言う自発的対称性の破れのようなもので、最初はどちらに転がってもおかしくないような差だったのかもしれませんね。\n\n* * *\n\n調べもせずに書いていますので、ご注意ください。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T17:20:53.720&quot;,&quot;id&quot;:&quot;7290&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T02:40:04.223&quot;,&quot;last_edit_date&quot;:&quot;2015-03-02T02:40:04.223&quot;,&quot;last_editor_user_id&quot;:&quot;3313&quot;,&quot;owner_user_id&quot;:&quot;3313&quot;,&quot;parent_id&quot;:&quot;7288&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:4},{&quot;body&quot;:&quot;歴史的には.NET Framework 3.5の時期に\n\n * 言語機能の差が一時的に大きくなった(`yield`、自動実装プロパティ等)\n * Windows Phone SDKなどでVB対応が後回しにされた\n\nとVBが機能的に大きく劣っていた期間があり、VB.NETを利用していた企業もC#に流れたのもこの頃という印象です。 \n両言語機能は当時導入されようとしてたLINQやLINQベースのORMに欠かせないものであり、VB.NETでは最新技術を生かせないという状況がしばらく続いていました。 \nこのギャップは.NET4.5までに徐々に解消するのですが、その間にC#側に`dynamic`機能が追加されたため、VBのメリットも失われてしまった格好です。\n\n* * *\n\nなお個人の主観的な意見としては、C#で \n\n```\n\n public TItem this[TKey key] { get; }\n \n```\n\nと書けるプロパティがVBでは \n\n```\n\n Default Public Overloads ReadOnly Property Item(ByVal key As TKey) As TItem\n \n```\n\nとなってしまうようにVBはキーワード中心のためとにかく打鍵量が多く好きになれません。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T21:57:36.250&quot;,&quot;id&quot;:&quot;7293&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T12:53:33.737&quot;,&quot;last_edit_date&quot;:&quot;2015-03-02T12:53:33.737&quot;,&quot;last_editor_user_id&quot;:&quot;5750&quot;,&quot;owner_user_id&quot;:&quot;5750&quot;,&quot;parent_id&quot;:&quot;7288&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:14},{&quot;body&quot;:&quot;もうちょっと低いレベルの話題を出しておきます。\n\n個人的には、変数スコープの違いが言語の違いを作っているのではと考えています。 \n従来C言語では変数をスコープの先頭に記述する制限がありました。その制限を何をどう勘違いしたのか関数の先頭と思い込み、結果、C言語や(元より制限のない)C++言語において関数の先頭にずらずらと変数を並べるスタイルのソースコードをちょくちょく見かけます。仕様をきちんと理解している人から見ると「わかってない人が書いているな」とそのソースを避けたくも思うはずです。 \nスコープの概念そのものはとても重要でJavaScriptのようにブロックスコープが存在しない場合、強引な手を使ってでもスコープを実現するわけですし。\n\nさてVB言語も似たような状況で、ブロックスコープはありますが関数の先頭に書かれる傾向があるように思います。C#言語においてはC / C++ /\nVBと比較するとそのような傾向はかなり低いです。結果、言語仕様を理解せず、変数の有効期間及びそれに付随するオブジェクトの生存期間を考慮せずただ動けばいいという考えの人はVB言語を使う傾向にあり、仕様を理解しコードロジック、アルゴリズムを考える人はC#言語を使う傾向にある、というのが個人的な見解です。\n\nさてこのような状況でソフトウェアを作ろうとする場合にどちらの言語を選択し、その言語の求人を行うかとなればやはり後者でしょう。\n\n// VBのブロックスコープは[罠](https://msdn.microsoft.com/ja-\njp/library/1t0wsc67\\(v=vs.120\\).aspx#mt35)もありますしね。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T01:09:02.923&quot;,&quot;id&quot;:&quot;7298&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T01:09:02.923&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;4236&quot;,&quot;parent_id&quot;:&quot;7288&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:7},{&quot;body&quot;:&quot;プロジェクト規模が大きくなるとVB.NETのほうがVisualStudioが重くなりがちです。 \nデフォルト設定のVB.NETは記述中の未改行状態のコードもエラーチェックしていたり \nしてC#よりも重くなっていました。 \nコードの実行速度は変わらないはずです。\n\n変数宣言を強制しないことができたり、VB6の悪いところをイメージさせるものが \nあります。 \nVB6は素人プログラマが品質の悪いコードを量産したのが大変問題になりその \nイメージの悪さを引きずっているのでしょうか\n\nですので、C#になにかあるというよりはVB.NETが敬遠されているのだと感じます。\n\n実質の機能はほぼ同じですが、間違いを起こしにくいC#のほうが開発者から好まれています。 \nほかの方もおっしゃられるように差はとても小さいです。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T02:41:33.007&quot;,&quot;id&quot;:&quot;7306&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T02:41:33.007&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8239&quot;,&quot;parent_id&quot;:&quot;7288&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;概ね同じような回答になりますが、 \nVBを採用している開発部署は、コードの質を追究するプログラマが少ないように感じます。\n\nVB6.0の悪習を結構引き継いでるので、プログラマ次第ではバグ量産の温床になるから等も理由の一つかもしれません。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T11:46:50.247&quot;,&quot;id&quot;:&quot;7328&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T11:46:50.247&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7501&quot;,&quot;parent_id&quot;:&quot;7288&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;技術的な回答は多く出ているので、人的リソースの視点で書かせて頂きます。\n\nVB6→VB.NETの移行期に活躍したプログラマーは現在既にいいお年で、新たにC#を習得させるコストを払うより現状維持または職種変更してもらい、C#erは外から調達する企業が多いのではないでしょうか。\n\n一部の優秀なプログラマーは除外しますが、日本の人月ビジネスが消費してきた「コーダー」については上記のことが言えると思います。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T12:06:39.373&quot;,&quot;id&quot;:&quot;7330&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T12:06:39.373&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;2238&quot;,&quot;parent_id&quot;:&quot;7288&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3},{&quot;body&quot;:&quot;> 文法等分かりやすいのはVB.NETだと直感的に思っていて \n> アプリケーションを開発しやすいのもVB.NETだと勝手に思っています。\n\nそうは思いません。VBとVB.NETは別物です。 \n世の中に多く存在するであろうC/C++/Javaなどの開発者にとってC#の方がとっつきやすいと思います。\n\n(1)VB.NET登場時、旧VBとの言語的な差が大きく、どうせ覚えるなら.Netのために新しく作られてオープンな規格であるC#を勉強した方がいいよね、という流れになった。\n\n[補足] \n当時VBが流行っていたのは、プログラミングスキルの低い人でもGUIアプリケーションを簡単に作れる、Microsoft製言語というのが理由だと思います。 \nしかし、VB.NETになって本格的なオブジェクト指向言語になった結果、習得難易度も増し、GUIアプリの作りやすさ(C#でも簡単に作れる)というアドバンテージも無くなってしまいました。\n\n難易度は\n\n初心者→VB \n中級者→Delphi \n上級者→C/C++\n\nというイメージ。 \nBorland社(社名がコロコロ変わって現在は何になっているか知りませんが)のDelphiはVBより少し難しいがC/C++より簡単でGUIも簡単に作れて熱烈なファンもいましたが、OS開発元であるMicrosoft製の言語を使う人が圧倒的に多かったです。\n\n(2)文法がC/C++やJavaに似ているので、これらの言語を使っている人たちがC#に入りやすかった。\n\n[補足] \nVBブームの後はJavaブームが来ました。\n\n(3)VB系言語で開発されたアプリケーションは他の言語で作られたものに比べ、質の低いものが多い。 \nこれは実感した人、多いと思います。 \n他人がVB系言語で作った質の悪いアプリをメンテすることになった苦い経験から、VB使いの技術力は低い、と多くの人に思われるようになったのです。 \n実際、そう考えてあながち間違いではないでしょう。 \n「VB系しかできません」なんて開発者は全く信用されません。 \n趣味のプログラミングならいいのですが、仕事でやる場合、複数言語を使えるのは当たり前です。\n\n(4)2016年現在、Windows以外のプラットフォームも見据えた言語の存在感として、C#の圧勝です。今更VB.NETを選ぶ人はいないでしょう。\n\n(5)C#は書きやすい、使い勝手がよい \n「C#は書いていて気持ちがよい」「思考をそのままコードにできる」という表現を時折見ます。\n\n[C# と共に歩んだ 15 年 - Powered by C# - Microsoft Visual\nStudio](https://www.microsoft.com/ja-jp/dev/campaign/csharp/story.aspx)\n\n> C# は、当時よく使われていた C++ 開発者にとっては取り組みやすい夢のような言語で、それほど勉強しなくても使うことができました。\n>\n> C#\n> の文法は実用性とサイエンスが絶妙。コード生成しやすいし、オブジェクト指向をベースに、コンポーネント志向も関数型もパラレルコンカレントも動的も無理なく取り込まれている。\n\n[需要No. 1言語はどれ? 2016年度人気プログラミング言語を徹底比較 |\nReadWrite[日本版]](http://readwrite.jp/develop/33939/)\n\n> C#で働いた技術者たちはC#を好きになる傾向があり、この言語はとても強いコミュニティを持っている。 \n> C#はUnity 3Dの主要言語であり、iOSやLinux上で動くゲームエンジンにも使用されている。ゲームエンジンとしてのUnity\n> 3Dの台頭は、C#の存在を確固たるものにし、バーチャルリアリティアプリの開発を支えている。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2016-11-26T10:39:39.243&quot;,&quot;id&quot;:&quot;30687&quot;,&quot;last_activity_date&quot;:&quot;2016-11-26T14:09:31.517&quot;,&quot;last_edit_date&quot;:&quot;2016-11-26T14:09:31.517&quot;,&quot;last_editor_user_id&quot;:&quot;19725&quot;,&quot;owner_user_id&quot;:&quot;19725&quot;,&quot;parent_id&quot;:&quot;7288&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;文法が分かりやすいかどうか、アプリケーションが開発しやすいかどうかは主観的な問題ですので置いておきます。\\n\\n`C#`と`VB.net`は機能的に大きな差があるわけではありません。しかし言語の人気に[大きな差](http://goo.gl/H5ci7Z)がありますので、わざわざ人気がなく情報量の少ない`VB.net`を選ぶ理由があまりないと言えます。\\n\\nではなぜ`C#`の方に人気が出たのかという理由はちょっと難しいですが、私の思いつく限りでは、\\n\\n * `Java`や`C++`を利用している人には文法的に`C#`の方が馴染みやすい\\n * `Mono`の`VB.net`への対応が`C#`に比べて遅いため、`Windows`以外の環境も考慮すると`C#`のほうが利用しやすい\\n\\nということになると思います。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T16:19:25.473\&quot;,\n \&quot;id\&quot;: \&quot;7289\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T16:19:25.473\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;3639\&quot;,\n \&quot;parent_id\&quot;: \&quot;7288\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 9\n },\n {\n \&quot;body\&quot;: \&quot;現実問題として`C#`で開発されたプロジェクトや資産が多く、また`C#`を理解できる人間が多いというのが表向きの理由かと思います。\\n\\nではなぜ`C#`のほうが人気なのかという部分についてですが、これは客観的な理由よりも主観的な理由の方が大きい気がします。 \\n私の周囲でも`Windows`向けの開発あるいは`Windows\\nServer`を利用したWebアプリケーションの開発では、`C#`の採用数が`VB.NET`に比べるととても多いです。大抵の場合、\\n\\n * `VB.NET`は古い\\n * `VB.NET`は遅い(実際には`C#`と違いが出るかは疑問です)\\n * `VB.NET`は初心者向けなので、できることが限られている(どうなんでしょう)\\n\\nといった理由、あるいは暗黙の了解的なもので`C#`が選択されています。私自身もはじめて`.NET`を使うことになった際、あまり考えずに`C#`を採用しました。(`VB.NET`には初心者向けで本格的な業務用ではないというイメージはありました。)\\n\\nあるいは、書籍など情報の偏りもあるかもしれません。`C#`には初心者向けから中級者向けまで書籍は日本語でも充実していますが、`VB.NET`の本は`C#`ほど充実していないように思います。(O'Reillyも`VB.NET`の日本語の本は取り扱っていません。)\\nただし卵(書籍)が先か鶏(人気)が先かはわかりません。\\n\\nもしかすると、物理学の世界で言う自発的対称性の破れのようなもので、最初はどちらに転がってもおかしくないような差だったのかもしれませんね。\\n\\n* * *\\n\\n調べもせずに書いていますので、ご注意ください。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T17:20:53.720\&quot;,\n \&quot;id\&quot;: \&quot;7290\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T02:40:04.223\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T02:40:04.223\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;3313\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;3313\&quot;,\n \&quot;parent_id\&quot;: \&quot;7288\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 4\n },\n {\n \&quot;body\&quot;: \&quot;歴史的には.NET Framework 3.5の時期に\\n\\n * 言語機能の差が一時的に大きくなった(`yield`、自動実装プロパティ等)\\n * Windows Phone SDKなどでVB対応が後回しにされた\\n\\nとVBが機能的に大きく劣っていた期間があり、VB.NETを利用していた企業もC#に流れたのもこの頃という印象です。 \\n両言語機能は当時導入されようとしてたLINQやLINQベースのORMに欠かせないものであり、VB.NETでは最新技術を生かせないという状況がしばらく続いていました。 \\nこのギャップは.NET4.5までに徐々に解消するのですが、その間にC#側に`dynamic`機能が追加されたため、VBのメリットも失われてしまった格好です。\\n\\n* * *\\n\\nなお個人の主観的な意見としては、C#で \\n\\n```\\n\\n public TItem this[TKey key] { get; }\\n \\n```\\n\\nと書けるプロパティがVBでは \\n\\n```\\n\\n Default Public Overloads ReadOnly Property Item(ByVal key As TKey) As TItem\\n \\n```\\n\\nとなってしまうようにVBはキーワード中心のためとにかく打鍵量が多く好きになれません。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T21:57:36.250\&quot;,\n \&quot;id\&quot;: \&quot;7293\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T12:53:33.737\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T12:53:33.737\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;5750\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;5750\&quot;,\n \&quot;parent_id\&quot;: \&quot;7288\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 14\n },\n {\n \&quot;body\&quot;: \&quot;もうちょっと低いレベルの話題を出しておきます。\\n\\n個人的には、変数スコープの違いが言語の違いを作っているのではと考えています。 \\n従来C言語では変数をスコープの先頭に記述する制限がありました。その制限を何をどう勘違いしたのか関数の先頭と思い込み、結果、C言語や(元より制限のない)C++言語において関数の先頭にずらずらと変数を並べるスタイルのソースコードをちょくちょく見かけます。仕様をきちんと理解している人から見ると「わかってない人が書いているな」とそのソースを避けたくも思うはずです。 \\nスコープの概念そのものはとても重要でJavaScriptのようにブロックスコープが存在しない場合、強引な手を使ってでもスコープを実現するわけですし。\\n\\nさてVB言語も似たような状況で、ブロックスコープはありますが関数の先頭に書かれる傾向があるように思います。C#言語においてはC / C++ /\\nVBと比較するとそのような傾向はかなり低いです。結果、言語仕様を理解せず、変数の有効期間及びそれに付随するオブジェクトの生存期間を考慮せずただ動けばいいという考えの人はVB言語を使う傾向にあり、仕様を理解しコードロジック、アルゴリズムを考える人はC#言語を使う傾向にある、というのが個人的な見解です。\\n\\nさてこのような状況でソフトウェアを作ろうとする場合にどちらの言語を選択し、その言語の求人を行うかとなればやはり後者でしょう。\\n\\n// VBのブロックスコープは[罠](https://msdn.microsoft.com/ja-\\njp/library/1t0wsc67\\\\(v=vs.120\\\\).aspx#mt35)もありますしね。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T01:09:02.923\&quot;,\n \&quot;id\&quot;: \&quot;7298\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T01:09:02.923\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;4236\&quot;,\n \&quot;parent_id\&quot;: \&quot;7288\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 7\n },\n {\n \&quot;body\&quot;: \&quot;プロジェクト規模が大きくなるとVB.NETのほうがVisualStudioが重くなりがちです。 \\nデフォルト設定のVB.NETは記述中の未改行状態のコードもエラーチェックしていたり \\nしてC#よりも重くなっていました。 \\nコードの実行速度は変わらないはずです。\\n\\n変数宣言を強制しないことができたり、VB6の悪いところをイメージさせるものが \\nあります。 \\nVB6は素人プログラマが品質の悪いコードを量産したのが大変問題になりその \\nイメージの悪さを引きずっているのでしょうか\\n\\nですので、C#になにかあるというよりはVB.NETが敬遠されているのだと感じます。\\n\\n実質の機能はほぼ同じですが、間違いを起こしにくいC#のほうが開発者から好まれています。 \\nほかの方もおっしゃられるように差はとても小さいです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T02:41:33.007\&quot;,\n \&quot;id\&quot;: \&quot;7306\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T02:41:33.007\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8239\&quot;,\n \&quot;parent_id\&quot;: \&quot;7288\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;概ね同じような回答になりますが、 \\nVBを採用している開発部署は、コードの質を追究するプログラマが少ないように感じます。\\n\\nVB6.0の悪習を結構引き継いでるので、プログラマ次第ではバグ量産の温床になるから等も理由の一つかもしれません。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T11:46:50.247\&quot;,\n \&quot;id\&quot;: \&quot;7328\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T11:46:50.247\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7501\&quot;,\n \&quot;parent_id\&quot;: \&quot;7288\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;技術的な回答は多く出ているので、人的リソースの視点で書かせて頂きます。\\n\\nVB6→VB.NETの移行期に活躍したプログラマーは現在既にいいお年で、新たにC#を習得させるコストを払うより現状維持または職種変更してもらい、C#erは外から調達する企業が多いのではないでしょうか。\\n\\n一部の優秀なプログラマーは除外しますが、日本の人月ビジネスが消費してきた「コーダー」については上記のことが言えると思います。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T12:06:39.373\&quot;,\n \&quot;id\&quot;: \&quot;7330\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T12:06:39.373\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;2238\&quot;,\n \&quot;parent_id\&quot;: \&quot;7288\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n },\n {\n \&quot;body\&quot;: \&quot;> 文法等分かりやすいのはVB.NETだと直感的に思っていて \\n> アプリケーションを開発しやすいのもVB.NETだと勝手に思っています。\\n\\nそうは思いません。VBとVB.NETは別物です。 \\n世の中に多く存在するであろうC/C++/Javaなどの開発者にとってC#の方がとっつきやすいと思います。\\n\\n(1)VB.NET登場時、旧VBとの言語的な差が大きく、どうせ覚えるなら.Netのために新しく作られてオープンな規格であるC#を勉強した方がいいよね、という流れになった。\\n\\n[補足] \\n当時VBが流行っていたのは、プログラミングスキルの低い人でもGUIアプリケーションを簡単に作れる、Microsoft製言語というのが理由だと思います。 \\nしかし、VB.NETになって本格的なオブジェクト指向言語になった結果、習得難易度も増し、GUIアプリの作りやすさ(C#でも簡単に作れる)というアドバンテージも無くなってしまいました。\\n\\n難易度は\\n\\n初心者→VB \\n中級者→Delphi \\n上級者→C/C++\\n\\nというイメージ。 \\nBorland社(社名がコロコロ変わって現在は何になっているか知りませんが)のDelphiはVBより少し難しいがC/C++より簡単でGUIも簡単に作れて熱烈なファンもいましたが、OS開発元であるMicrosoft製の言語を使う人が圧倒的に多かったです。\\n\\n(2)文法がC/C++やJavaに似ているので、これらの言語を使っている人たちがC#に入りやすかった。\\n\\n[補足] \\nVBブームの後はJavaブームが来ました。\\n\\n(3)VB系言語で開発されたアプリケーションは他の言語で作られたものに比べ、質の低いものが多い。 \\nこれは実感した人、多いと思います。 \\n他人がVB系言語で作った質の悪いアプリをメンテすることになった苦い経験から、VB使いの技術力は低い、と多くの人に思われるようになったのです。 \\n実際、そう考えてあながち間違いではないでしょう。 \\n「VB系しかできません」なんて開発者は全く信用されません。 \\n趣味のプログラミングならいいのですが、仕事でやる場合、複数言語を使えるのは当たり前です。\\n\\n(4)2016年現在、Windows以外のプラットフォームも見据えた言語の存在感として、C#の圧勝です。今更VB.NETを選ぶ人はいないでしょう。\\n\\n(5)C#は書きやすい、使い勝手がよい \\n「C#は書いていて気持ちがよい」「思考をそのままコードにできる」という表現を時折見ます。\\n\\n[C# と共に歩んだ 15 年 - Powered by C# - Microsoft Visual\\nStudio](https://www.microsoft.com/ja-jp/dev/campaign/csharp/story.aspx)\\n\\n> C# は、当時よく使われていた C++ 開発者にとっては取り組みやすい夢のような言語で、それほど勉強しなくても使うことができました。\\n>\\n> C#\\n> の文法は実用性とサイエンスが絶妙。コード生成しやすいし、オブジェクト指向をベースに、コンポーネント志向も関数型もパラレルコンカレントも動的も無理なく取り込まれている。\\n\\n[需要No. 1言語はどれ? 2016年度人気プログラミング言語を徹底比較 |\\nReadWrite[日本版]](http://readwrite.jp/develop/33939/)\\n\\n> C#で働いた技術者たちはC#を好きになる傾向があり、この言語はとても強いコミュニティを持っている。 \\n> C#はUnity 3Dの主要言語であり、iOSやLinux上で動くゲームエンジンにも使用されている。ゲームエンジンとしてのUnity\\n> 3Dの台頭は、C#の存在を確固たるものにし、バーチャルリアリティアプリの開発を支えている。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2016-11-26T10:39:39.243\&quot;,\n \&quot;id\&quot;: \&quot;30687\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2016-11-26T14:09:31.517\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2016-11-26T14:09:31.517\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;19725\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;19725\&quot;,\n \&quot;parent_id\&quot;: \&quot;7288\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7288&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7289&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7293&quot;}}},{&quot;rowIdx&quot;:1666,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;Mac Yosemite 上の Apache でローカルで動かしてます。 \\nPHPで以下のように実行ユーザーを表示してみると、\\n\\n```\\n\\n echo get_current_user();\\n \\n```\\n\\nすると\\\&quot;_www\\\&quot;になるんですが、テキストファイルを保存してみるとその所有者は\\\&quot;自分の名前\\\&quot;になっています。 \\n実行ユーザーと所有者が別々(グループも別々です)になるわけですが、これはどういう設定からなっていることなんでしょうか? \\nちなみに、対象フォルダのパーミッションは0755で、suEXECは有効になっていません。それと、PHP はモジュール版です。\\n\\n* * *\\n\\n追記 \\n実行したコードです。\\n\\n```\\n\\n echo 'user:' . get_current_user() . '<br>';\\n \\n $file_handle = fopen(\\\&quot;test.txt\\\&quot;, \\\&quot;w\\\&quot;);\\n \\n if($file_handle){\\n $wr = fwrite($file_handle , \\\&quot;あいうえお\\\\nかきくけこ\\\&quot;);\\n \\n if($wr == FALSE){\\n echo \\\&quot;fwrite 失敗<br>\\\&quot;;\\n }else{\\n echo \\\&quot;fwrite 成功<br>\\\&quot;;\\n }\\n \\n fclose($file_handle);\\n }else{\\n echo \\\&quot;fopen 失敗<br>\\\&quot;;\\n }\\n \\n```\\n\\n所有者、グループの確認は Finder の「右クリック - 情報を見る」からしました。 \\nその後、httpd.conf も見てグループも違っていると思ったということです。\&quot;,\n \&quot;comment_count\&quot;: 12,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T17:40:30.113\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7291\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-05T05:22:22.070\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T06:09:51.887\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8439\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8439\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;php\&quot;,\n \&quot;macos\&quot;,\n \&quot;apache\&quot;\n ],\n \&quot;title\&quot;: \&quot;PHPで保存したファイルの所有者について\&quot;,\n \&quot;view_count\&quot;: 1288\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;ターミナルから設定ファイルを見るとこのようにでました\n\n```\n\n $ cat /private/etc/apache2/httpd.conf | grep -n \&quot;_www\&quot;\n 181:User _www\n 182:Group _www\n \n```&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-01T20:41:03.503&quot;,&quot;id&quot;:&quot;7292&quot;,&quot;last_activity_date&quot;:&quot;2015-03-01T20:41:03.503&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;4662&quot;,&quot;parent_id&quot;:&quot;7291&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:0},{&quot;body&quot;:&quot;OS\nX標準のapacheでmod_phpを有効にして、DocumentRootになっている/Library/WebServer/Documentsに上記スクリプトをおいて実行しましたが書き込みができませんでした。ディレクトリをchmod\n777したところ実行できました。ファイルの所有者は_wwwでした。\n\nということで、少なくとも標準状態+最低限の変更では質問のような動作にはなりません。\n\n一般論としてもapache+mod_php環境ではapacheの実行ユーザーでPHPスクリプトも実行されますので、上記動作に矛盾はありません。\n\nということで、その通りの動作になっていないと言うことはここに書いた以上の作業をされていると思いますがその詳細がわからないとこの回答が限界です。\n\nまた、「既存のファイルに書き込みを繰り返しているだけ」とか、「スクリプトが作成してるファイルと確認しているファイルが違う」とか、そういうところも疑ったほうがいいかとおもいます。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-05T05:22:22.070&quot;,&quot;id&quot;:&quot;7468&quot;,&quot;last_activity_date&quot;:&quot;2015-03-05T05:22:22.070&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5793&quot;,&quot;parent_id&quot;:&quot;7291&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;ターミナルから設定ファイルを見るとこのようにでました\\n\\n```\\n\\n $ cat /private/etc/apache2/httpd.conf | grep -n \\\&quot;_www\\\&quot;\\n 181:User _www\\n 182:Group _www\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-01T20:41:03.503\&quot;,\n \&quot;id\&quot;: \&quot;7292\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-01T20:41:03.503\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;4662\&quot;,\n \&quot;parent_id\&quot;: \&quot;7291\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 0\n },\n {\n \&quot;body\&quot;: \&quot;OS\\nX標準のapacheでmod_phpを有効にして、DocumentRootになっている/Library/WebServer/Documentsに上記スクリプトをおいて実行しましたが書き込みができませんでした。ディレクトリをchmod\\n777したところ実行できました。ファイルの所有者は_wwwでした。\\n\\nということで、少なくとも標準状態+最低限の変更では質問のような動作にはなりません。\\n\\n一般論としてもapache+mod_php環境ではapacheの実行ユーザーでPHPスクリプトも実行されますので、上記動作に矛盾はありません。\\n\\nということで、その通りの動作になっていないと言うことはここに書いた以上の作業をされていると思いますがその詳細がわからないとこの回答が限界です。\\n\\nまた、「既存のファイルに書き込みを繰り返しているだけ」とか、「スクリプトが作成してるファイルと確認しているファイルが違う」とか、そういうところも疑ったほうがいいかとおもいます。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-05T05:22:22.070\&quot;,\n \&quot;id\&quot;: \&quot;7468\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-05T05:22:22.070\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5793\&quot;,\n \&quot;parent_id\&quot;: \&quot;7291\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7291&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7468&quot;}}},{&quot;rowIdx&quot;:1667,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7312\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;お世話になります\\n\\nAndroidで地図の入ったFragmentのアプリを作っているのですが、ちょっとハマってしまったので \\n質問させてください。 \\n初期画面側が地図なのですが、一度別のタブに移動→また地図側に戻ると、以下のエラーを吐いて止まってしまいます。\\n\\n```\\n\\n 03-02 08:26:08.519 4221-4221/shiratsu.co.jp.cafesagashi E/AndroidRuntime﹕ FATAL EXCEPTION: main\\n java.lang.NullPointerException\\n at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:708)\\n at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)\\n at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:454)\\n at android.os.Handler.handleCallback(Handler.java:725)\\n at android.os.Handler.dispatchMessage(Handler.java:92)\\n at android.os.Looper.loop(Looper.java:137)\\n at android.app.ActivityThread.main(ActivityThread.java:5041)\\n at java.lang.reflect.Method.invokeNative(Native Method)\\n at java.lang.reflect.Method.invoke(Method.java:511)\\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)\\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)\\n at dalvik.system.NativeStart.main(Native Method)\\n \\n```\\n\\nいろいろ調べてはいるもののちょっと原因がつかめておらずでして。。。\\n\\n```\\n\\n public class CafeMapFragment extends Fragment {\\n \\n \\n //private OnFragmentInteractionListener mListener;\\n private SupportMapFragment fragment;\\n /*object of google map*/\\n public GoogleMap mGoogleMap;\\n \\n /**\\n * Use this factory method to create a new instance of\\n * this fragment using the provided parameters.\\n *\\n * @return A new instance of fragment CafeMapFragment.\\n */\\n // TODO: Rename and change types and number of parameters\\n public static CafeMapFragment newInstance() {\\n CafeMapFragment fragment = new CafeMapFragment();\\n Bundle args = new Bundle();\\n fragment.setArguments(args);\\n return fragment;\\n }\\n \\n public CafeMapFragment() {\\n // Required empty public constructor\\n }\\n \\n @Override\\n public void onCreate(Bundle savedInstanceState) {\\n super.onCreate(savedInstanceState);\\n \\n }\\n \\n @Override\\n public void onResume() {\\n super.onResume();\\n setUpMapIfNeeded();\\n }\\n \\n private void setUpMapIfNeeded() {\\n \\n if (mGoogleMap == null) {\\n mGoogleMap = fragment.getMap();\\n setUpMap();\\n }\\n }\\n \\n @Override\\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\\n Bundle savedInstanceState) {\\n \\n return inflater.inflate(R.layout.fragment_cafe_map, container, false);\\n }\\n \\n @Override\\n public void onActivityCreated(Bundle savedInstanceState) {\\n // TODO Auto-generated method stub\\n super.onActivityCreated(savedInstanceState);\\n FragmentManager fm = getChildFragmentManager();\\n fragment = (SupportMapFragment) fm.findFragmentById(R.id.fragmentMap);\\n if (fragment == null) {\\n fragment = SupportMapFragment.newInstance();\\n fm.beginTransaction().replace(R.id.fragmentMap, fragment).commit();\\n }\\n \\n }\\n \\n // とりあえず適当にピンたててみたり。\\n private void setUpMap() {\\n \\n // 現在位置表示の有効化\\n mGoogleMap.setMyLocationEnabled(true);\\n // 設定の取得\\n UiSettings settings = mGoogleMap.getUiSettings();\\n // コンパスの有効化\\n settings.setCompassEnabled(true);\\n // 現在位置に移動するボタンの有効化\\n settings.setMyLocationButtonEnabled(true);\\n // ズームイン・アウトボタンの有効化\\n settings.setZoomControlsEnabled(true);\\n // 回転ジェスチャーの有効化\\n settings.setRotateGesturesEnabled(false);\\n // スクロールジェスチャーの有効化\\n settings.setScrollGesturesEnabled(true);\\n // Tlitジェスチャー(立体表示)の有効化\\n settings.setTiltGesturesEnabled(false);\\n // ズームジェスチャー(ピンチイン・アウト)の有効化\\n settings.setZoomGesturesEnabled(true);\\n mGoogleMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {\\n @Override\\n public void onCameraChange(CameraPosition position) {\\n Log.d(\\\&quot;TEST\\\&quot;, \\\&quot;zoop:\\\&quot; + position.zoom);\\n }\\n });\\n }\\n \\n public void onDestroyView() {\\n super.onDestroyView();\\n \\n \\n try{\\n \\n FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();\\n ft.remove(fragment);\\n ft.commit();\\n }catch(Exception e){\\n }\\n }\\n \\n \\n \\n \\n \\n \\n }\\n \\n <FrameLayout\\n xmlns:android=\\\&quot;http://schemas.android.com/apk/res/android\\\&quot;\\n android:id=\\\&quot;@+id/fragmentMap\\\&quot;\\n android:layout_width=\\\&quot;match_parent\\\&quot;\\n android:layout_height=\\\&quot;match_parent\\\&quot;\\n class=\\\&quot;com.google.android.gms.maps.SupportMapFragment\\\&quot;>\\n \\n </FrameLayout>\\n \\n <FrameLayout xmlns:android=\\\&quot;http://schemas.android.com/apk/res/android\\\&quot;\\n xmlns:tools=\\\&quot;http://schemas.android.com/tools\\\&quot; android:layout_width=\\\&quot;match_parent\\\&quot;\\n android:layout_height=\\\&quot;match_parent\\\&quot;\\n tools:context=\\\&quot;shiratsu.co.jp.cafesagashi.LicenceFragment\\\&quot;>\\n \\n <!-- TODO: Update blank fragment layout -->\\n <TextView android:layout_width=\\\&quot;match_parent\\\&quot; android:layout_height=\\\&quot;match_parent\\\&quot;\\n android:text=\\\&quot;@string/hello_blank_fragment\\\&quot; />\\n \\n </FrameLayout>\\n \\n public class MainActivity extends FragmentActivity implements FragmentTabHost.OnTabChangeListener {\\n \\n @Override\\n protected void onCreate(Bundle savedInstanceState) {\\n super.onCreate(savedInstanceState);\\n setContentView(R.layout.activity_main);\\n \\n // FragmentTabHost を取得する\\n FragmentTabHost tabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);\\n tabHost.setup(this, getSupportFragmentManager(), R.id.container);\\n \\n TabHost.TabSpec tabSpec1, tabSpec2;\\n \\n // TabSpec を生成する\\n tabSpec1 = tabHost.newTabSpec(\\\&quot;tab1\\\&quot;);\\n tabSpec1.setIndicator(\\\&quot;tab1\\\&quot;);\\n // TabHost に追加\\n tabHost.addTab(tabSpec1, CafeMapFragment.class, null);\\n \\n // TabSpec を生成する\\n tabSpec2 = tabHost.newTabSpec(\\\&quot;tab2\\\&quot;);\\n tabSpec2.setIndicator(\\\&quot;tab2\\\&quot;);\\n // TabHost に追加\\n tabHost.addTab(tabSpec2, LicenceFragment.class, null);\\n \\n // リスナー登録\\n tabHost.setOnTabChangedListener(this);\\n }\\n \\n @Override\\n public void onTabChanged(String tabId) {\\n Log.d(\\\&quot;onTabChanged\\\&quot;, \\\&quot;tabId: \\\&quot; + tabId);\\n }\\n \\n \\n @Override\\n public boolean onCreateOptionsMenu(Menu menu) {\\n // Inflate the menu; this adds items to the action bar if it is present.\\n getMenuInflater().inflate(R.menu.menu_main, menu);\\n return true;\\n }\\n \\n @Override\\n public boolean onOptionsItemSelected(MenuItem item) {\\n // Handle action bar item clicks here. The action bar will\\n // automatically handle clicks on the Home/Up button, so long\\n // as you specify a parent activity in AndroidManifest.xml.\\n int id = item.getItemId();\\n \\n //noinspection SimplifiableIfStatement\\n if (id == R.id.action_settings) {\\n return true;\\n }\\n \\n return super.onOptionsItemSelected(item);\\n }\\n \\n \\n }\\n \\n```\\n\\nよろしくお願いいたします\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T00:08:12.797\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7294\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T04:45:16.280\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;403\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;android\&quot;,\n \&quot;fragment\&quot;\n ],\n \&quot;title\&quot;: \&quot;Tab付きFragmentで元のFragmentに戻るとエラー\&quot;,\n \&quot;view_count\&quot;: 1343\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;```\n\n public void onDestroyView() {\n super.onDestroyView();\n try{\n // FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();\n FragmentTransaction ft = getChildFragmentManager().beginTransaction();\n ft.remove(fragment);\n ft.commit();\n }catch(Exception e){\n }\n }\n \n```\n\n`remove`するときも`getChildFragmentManager()`で`FragmentManager`を取得してみてはいかかでしょうか?\n\n少し追記 \n`Fragment`に子供の`Fragment`を入れ子で配置する場合は、`getChildFragmentManager`を使います。 \n追加するときのコードは正しいのですが、`remove`するときに`getSupportFragmentManager`となっているため、エラーが起きているのではないかと。&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T03:55:33.373&quot;,&quot;id&quot;:&quot;7312&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T04:45:16.280&quot;,&quot;last_edit_date&quot;:&quot;2015-03-02T04:45:16.280&quot;,&quot;last_editor_user_id&quot;:&quot;8216&quot;,&quot;owner_user_id&quot;:&quot;8216&quot;,&quot;parent_id&quot;:&quot;7294&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;```\\n\\n public void onDestroyView() {\\n super.onDestroyView();\\n try{\\n // FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();\\n FragmentTransaction ft = getChildFragmentManager().beginTransaction();\\n ft.remove(fragment);\\n ft.commit();\\n }catch(Exception e){\\n }\\n }\\n \\n```\\n\\n`remove`するときも`getChildFragmentManager()`で`FragmentManager`を取得してみてはいかかでしょうか?\\n\\n少し追記 \\n`Fragment`に子供の`Fragment`を入れ子で配置する場合は、`getChildFragmentManager`を使います。 \\n追加するときのコードは正しいのですが、`remove`するときに`getSupportFragmentManager`となっているため、エラーが起きているのではないかと。\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T03:55:33.373\&quot;,\n \&quot;id\&quot;: \&quot;7312\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T04:45:16.280\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T04:45:16.280\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8216\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8216\&quot;,\n \&quot;parent_id\&quot;: \&quot;7294\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7294&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7312&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7312&quot;}}},{&quot;rowIdx&quot;:1668,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7308\&quot;,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;最初に適用した画像から他の画像に差し替えたのですが、 \\n最初の画像が常に表示されている状態です。 \\nこの問題の解決方法が分かる方がいましたら、ご教授お願いします。\\n\\n対象の画像はCSSにて、下記のように指定しているasc.gifです。\\n\\n```\\n\\n background-image: url(asc.gif);\\n \\n```\\n\\nまたasc.gifは下記画像のように配置されています。\\n\\n![画像の配置](https://i.stack.imgur.com/0yByj.png)\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T01:12:30.890\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7299\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T02:54:19.490\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7626\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;html\&quot;,\n \&quot;css\&quot;\n ],\n \&quot;title\&quot;: \&quot;htmlで画像の変更が適用されません\&quot;,\n \&quot;view_count\&quot;: 346\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;おそらくブラウザにキャッシュが残っています。 \nブラウザのキャッシュをクリアしてみてください。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T01:36:26.943&quot;,&quot;id&quot;:&quot;7300&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T01:36:26.943&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7214&quot;,&quot;parent_id&quot;:&quot;7299&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;CSSはリロードしても更新されないことがありますので、 \nCtrl+F5でスーパーリロードするか、クエリー文字を追加するなどして対処してください。\n\n<http://weboook.blog22.fc2.com/blog-entry-367.html>&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T02:54:19.490&quot;,&quot;id&quot;:&quot;7308&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T02:54:19.490&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;2232&quot;,&quot;parent_id&quot;:&quot;7299&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;おそらくブラウザにキャッシュが残っています。 \\nブラウザのキャッシュをクリアしてみてください。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T01:36:26.943\&quot;,\n \&quot;id\&quot;: \&quot;7300\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T01:36:26.943\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7214\&quot;,\n \&quot;parent_id\&quot;: \&quot;7299\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;CSSはリロードしても更新されないことがありますので、 \\nCtrl+F5でスーパーリロードするか、クエリー文字を追加するなどして対処してください。\\n\\n<http://weboook.blog22.fc2.com/blog-entry-367.html>\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T02:54:19.490\&quot;,\n \&quot;id\&quot;: \&quot;7308\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T02:54:19.490\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;2232\&quot;,\n \&quot;parent_id\&quot;: \&quot;7299\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7299&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7308&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7308&quot;}}},{&quot;rowIdx&quot;:1669,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;```\\n\\n <body>\\n <canvas width=\\\&quot;500px\\\&quot; height=\\\&quot;2000px\\\&quot;></canvas>\\n <script>\\n var canvas = document.querySelector('canvas')\\n var ctx = canvas.getContext('2d')\\n ctx.fillStyle = \\\&quot;rgb(200, 0, 0)\\\&quot;\\n ctx.fillRect(0, 0, 100, 100)\\n ctx.fillRect(400, 0, 100, 100)\\n ctx.fillRect(0, 1000, 100, 100)\\n </script>\\n </body>\\n \\n```\\n\\n上記のhtmlでは、縦2000px、横500pxのcanvasを表示しています。 \\nこれを印刷すると、ブラウザによって挙動が違います。\\n\\n * Google Chrome(40.0.2214.115) 2ページ目が印刷される。下端の四角は次のページに表示\\n * Firefox(35.0.1) 2ページ目が印刷されない。下の四角は表示されない\\n\\nFirefoxでChromeのように、画像のはみ出した部分を次ページに印刷する方法はありませんか?\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T01:41:05.447\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7301\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-09-09T00:15:49.317\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-09-08T02:25:51.350\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;10455\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;2325\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 4,\n \&quot;tags\&quot;: [\n \&quot;html\&quot;,\n \&quot;firefox\&quot;\n ],\n \&quot;title\&quot;: \&quot;Firefoxで画像のはみ出した部分を次のページに印刷するには?\&quot;,\n \&quot;view_count\&quot;: 330\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;複数の`canvas`に画像を分ければ、この問題を回避できます:\n\n```\n\n <head>\n <style type=\&quot;text/css\&quot; media=\&quot;screen\&quot;>\n div#insatsu {display: none;}\n </style>\n <style type=\&quot;text/css\&quot; media=\&quot;print\&quot;>\n canvas#displayCanvas {display: none;}\n </style>\n </head>\n \n <body>\n <canvas id=\&quot;displayCanvas\&quot; width=\&quot;500\&quot; height=\&quot;2000\&quot;></canvas>\n \n <div id=\&quot;insatsu\&quot;></div>\n \n <script>\n var canvas = document.querySelector('canvas'),\n ctx = canvas.getContext('2d');\n \n ctx.fillStyle = \&quot;rgb(200, 0, 0)\&quot;;\n ctx.fillRect(0, 0, 100, 100);\n ctx.fillRect(400, 0, 100, 100);\n ctx.fillRect(0, 1000, 100, 100);\n \n function createSplitCanvases(canvas, ctx, insatsu) {\n var y = 0,\n SPLIT_Y = 150;\n \n insatsu.innerHTML = '';\n \n while (y <= canvas.height) {\n var printCanvas = document.createElement('canvas');\n \n printCanvas.height = SPLIT_Y < (canvas.height-y) ? SPLIT_Y : (canvas.height-y);\n printCanvas.width = canvas.width;\n insatsu.appendChild(printCanvas);\n insatsu.appendChild(document.createElement('br'));\n var ctx2 = printCanvas.getContext('2d');\n \n ctx2.putImageData(ctx.getImageData(\n 0, y,\n canvas.width,\n (y+SPLIT_Y) > canvas.height ? canvas.height : (y+SPLIT_Y)\n ), 0, 0);\n y += SPLIT_Y;\n }\n }\n \n createSplitCanvases(\n canvas,\n ctx,\n document.querySelector('#insatsu')\n );\n </script>\n </body>\n \n```\n\nもちろん、あまり良くない解決策ですが、私の知っている限りでは、Firefoxでは他の方法はないです。`img`という要素を使えば、同じ問題が起こるようです。どなたかより良い方法を知れば是非投稿して下さい。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-09-09T00:15:49.317&quot;,&quot;id&quot;:&quot;16404&quot;,&quot;last_activity_date&quot;:&quot;2015-09-09T00:15:49.317&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;11003&quot;,&quot;parent_id&quot;:&quot;7301&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;複数の`canvas`に画像を分ければ、この問題を回避できます:\\n\\n```\\n\\n <head>\\n <style type=\\\&quot;text/css\\\&quot; media=\\\&quot;screen\\\&quot;>\\n div#insatsu {display: none;}\\n </style>\\n <style type=\\\&quot;text/css\\\&quot; media=\\\&quot;print\\\&quot;>\\n canvas#displayCanvas {display: none;}\\n </style>\\n </head>\\n \\n <body>\\n <canvas id=\\\&quot;displayCanvas\\\&quot; width=\\\&quot;500\\\&quot; height=\\\&quot;2000\\\&quot;></canvas>\\n \\n <div id=\\\&quot;insatsu\\\&quot;></div>\\n \\n <script>\\n var canvas = document.querySelector('canvas'),\\n ctx = canvas.getContext('2d');\\n \\n ctx.fillStyle = \\\&quot;rgb(200, 0, 0)\\\&quot;;\\n ctx.fillRect(0, 0, 100, 100);\\n ctx.fillRect(400, 0, 100, 100);\\n ctx.fillRect(0, 1000, 100, 100);\\n \\n function createSplitCanvases(canvas, ctx, insatsu) {\\n var y = 0,\\n SPLIT_Y = 150;\\n \\n insatsu.innerHTML = '';\\n \\n while (y <= canvas.height) {\\n var printCanvas = document.createElement('canvas');\\n \\n printCanvas.height = SPLIT_Y < (canvas.height-y) ? SPLIT_Y : (canvas.height-y);\\n printCanvas.width = canvas.width;\\n insatsu.appendChild(printCanvas);\\n insatsu.appendChild(document.createElement('br'));\\n var ctx2 = printCanvas.getContext('2d');\\n \\n ctx2.putImageData(ctx.getImageData(\\n 0, y,\\n canvas.width,\\n (y+SPLIT_Y) > canvas.height ? canvas.height : (y+SPLIT_Y)\\n ), 0, 0);\\n y += SPLIT_Y;\\n }\\n }\\n \\n createSplitCanvases(\\n canvas,\\n ctx,\\n document.querySelector('#insatsu')\\n );\\n </script>\\n </body>\\n \\n```\\n\\nもちろん、あまり良くない解決策ですが、私の知っている限りでは、Firefoxでは他の方法はないです。`img`という要素を使えば、同じ問題が起こるようです。どなたかより良い方法を知れば是非投稿して下さい。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-09-09T00:15:49.317\&quot;,\n \&quot;id\&quot;: \&quot;16404\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-09-09T00:15:49.317\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;11003\&quot;,\n \&quot;parent_id\&quot;: \&quot;7301\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7301&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;16404&quot;}}},{&quot;rowIdx&quot;:1670,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7307\&quot;,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;あるディレクトリに対し再帰的にゆっくり削除をかけていきたいと思っています。\\n\\n```\\n\\n find . -exec sleep 1 \\\\; -delete\\n \\n```\\n\\nこのコマンドでほぼ満たされるのですが、ディレクトリは削除せずに残しておきたいのです。 \\nどのようにするとできそうでしょうか?よろしくお願いします。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T02:25:33.087\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7304\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T03:13:01.567\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;2772\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;linux\&quot;,\n \&quot;bash\&quot;\n ],\n \&quot;title\&quot;: \&quot;再帰的にゆっくりファイルだけを削除するコマンド\&quot;,\n \&quot;view_count\&quot;: 2839\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;```\n\n find . ! -type d -exec sleep 1 \\; -delete\n \n```\n\nこれでいかがでしょうか。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T02:45:14.933&quot;,&quot;id&quot;:&quot;7307&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T02:45:14.933&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7926&quot;,&quot;parent_id&quot;:&quot;7304&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3},{&quot;body&quot;:&quot;別解です。 \nrm コマンドは、ディレクトリを消さないので、こういう書き方もあります。\n\n```\n\n find . -exec echo {} \\; | while read f; do sleep 1; rm $f; done\n \n```\n\n利点: do に複数コマンドを書けるのでログ出力つけたくなった時に便利です。 \nひとつのファイル/リンクを消すための待ち時間を揃えるには、Shirone さんの回答にある「! -type d」を使うのが良いです。&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T03:13:01.567&quot;,&quot;id&quot;:&quot;7309&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T03:13:01.567&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5299&quot;,&quot;parent_id&quot;:&quot;7304&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;```\\n\\n find . ! -type d -exec sleep 1 \\\\; -delete\\n \\n```\\n\\nこれでいかがでしょうか。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T02:45:14.933\&quot;,\n \&quot;id\&quot;: \&quot;7307\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T02:45:14.933\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;parent_id\&quot;: \&quot;7304\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n },\n {\n \&quot;body\&quot;: \&quot;別解です。 \\nrm コマンドは、ディレクトリを消さないので、こういう書き方もあります。\\n\\n```\\n\\n find . -exec echo {} \\\\; | while read f; do sleep 1; rm $f; done\\n \\n```\\n\\n利点: do に複数コマンドを書けるのでログ出力つけたくなった時に便利です。 \\nひとつのファイル/リンクを消すための待ち時間を揃えるには、Shirone さんの回答にある「! -type d」を使うのが良いです。\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T03:13:01.567\&quot;,\n \&quot;id\&quot;: \&quot;7309\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T03:13:01.567\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5299\&quot;,\n \&quot;parent_id\&quot;: \&quot;7304\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7304&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7307&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7307&quot;}}},{&quot;rowIdx&quot;:1671,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7311\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;XMLでは使用可能な文字が制限されています。([W3C Recommendation -Section2.2\\nCharacters](http://www.w3.org/TR/REC-xml/#charsets))\\n\\n```\\n\\n <a>&amp;#x3c;&amp;lt;</a>\\n \\n```\\n\\nは有効と判定されます。 \\nでは、以下のXMLとして有効ですか?無効ですか?\\n\\n```\\n\\n <a>&amp;#x01;</a>\\n \\n```\\n\\nMSXMLおよびlibxml2で試したところ無効なXMLと判定されました。(書き込みはできても読み取れない) \\nなぜ無効と判定されるのでしょうか?\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T02:41:20.660\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7305\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T03:55:15.727\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8629\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;xml\&quot;\n ],\n \&quot;title\&quot;: \&quot;XMLでテキスト部の文字参照\&quot;,\n \&quot;view_count\&quot;: 349\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;`&amp;#x01;`は文字参照の文法としては有効です。\n\n> **4.1 Character and Entity References**\n```\n\n> [66] CharRef ::= '&amp;#' [0-9]+ ';'\n> | '&amp;#x' [0-9a-fA-F]+ ';'\n> \n```\n\nしかし、文字参照が参照する文字は`Char`で定義されている文字集合にマッチしなければならないという制限があります。\n\n> **Well-formedness constraint: Legal Character**\n>\n> Characters referred to using character references must match the \n> production for Char.\n\n`Char`の定義は以下のとおりで、`#x1`は含まれていないので`&amp;#x01;`は結果的に無効です。\n\n> **2.2 Characters**\n```\n\n> [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] |\n> [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding\n> the surrogate blocks, FFFE, and FFFF. */\n> \n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T03:55:15.727&quot;,&quot;id&quot;:&quot;7311&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T03:55:15.727&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;3639&quot;,&quot;parent_id&quot;:&quot;7305&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;`&amp;#x01;`は文字参照の文法としては有効です。\\n\\n> **4.1 Character and Entity References**\\n```\\n\\n> [66] CharRef ::= '&amp;#' [0-9]+ ';'\\n> | '&amp;#x' [0-9a-fA-F]+ ';'\\n> \\n```\\n\\nしかし、文字参照が参照する文字は`Char`で定義されている文字集合にマッチしなければならないという制限があります。\\n\\n> **Well-formedness constraint: Legal Character**\\n>\\n> Characters referred to using character references must match the \\n> production for Char.\\n\\n`Char`の定義は以下のとおりで、`#x1`は含まれていないので`&amp;#x01;`は結果的に無効です。\\n\\n> **2.2 Characters**\\n```\\n\\n> [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] |\\n> [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding\\n> the surrogate blocks, FFFE, and FFFF. */\\n> \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T03:55:15.727\&quot;,\n \&quot;id\&quot;: \&quot;7311\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T03:55:15.727\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;3639\&quot;,\n \&quot;parent_id\&quot;: \&quot;7305\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7305&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7311&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7311&quot;}}},{&quot;rowIdx&quot;:1672,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;毎々お世話になっております。新米エンジニアです。\\n\\nNitrous でrailsのWEBアプリケーションを開発しております。 \\nネット上にあるソースを開発もしくはフォルダー毎にダウンロードする方法はございますか? \\n現在、ファイル上で右クリックでのダウンロード方法は把握しているのですが、フォルダー毎でのダウンロード方法をご存知の方、ご教示頂けると幸いです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T05:25:18.633\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7313\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T09:10:24.057\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T06:35:37.267\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;3639\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8635\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;ruby-on-rails\&quot;\n ],\n \&quot;title\&quot;: \&quot;Nitrousのファイルのダウンロード\&quot;,\n \&quot;view_count\&quot;: 128\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;今のところ Nitrous の Web IDE では一括ダウンロードできないようです。\n\n当方で確認したところ、[Nitrous デスクトップ](https://www.nitrous.io/desktop) から Nitrous Desktop\nをダウンロードし、起動します。 \nあとは接続して、下記のスクリーンショットのように File Sync を有効にします。 \n※これは Windows での解説です。Mac も若干違いはあれど同様だと思われます。\n\n![Nitrous Desctop - File sync](https://i.stack.imgur.com/DmDX0.gif)\n\nすると `C:\\\\{ユーザ名}\\Nitrous\\\\{マシン名}` にプロジェクトファイルが全て同期されています。 \nこれでダウンロードできますので、お試しください。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T09:10:24.057&quot;,&quot;id&quot;:&quot;7321&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T09:10:24.057&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7926&quot;,&quot;parent_id&quot;:&quot;7313&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;今のところ Nitrous の Web IDE では一括ダウンロードできないようです。\\n\\n当方で確認したところ、[Nitrous デスクトップ](https://www.nitrous.io/desktop) から Nitrous Desktop\\nをダウンロードし、起動します。 \\nあとは接続して、下記のスクリーンショットのように File Sync を有効にします。 \\n※これは Windows での解説です。Mac も若干違いはあれど同様だと思われます。\\n\\n![Nitrous Desctop - File sync](https://i.stack.imgur.com/DmDX0.gif)\\n\\nすると `C:\\\\\\\\{ユーザ名}\\\\Nitrous\\\\\\\\{マシン名}` にプロジェクトファイルが全て同期されています。 \\nこれでダウンロードできますので、お試しください。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T09:10:24.057\&quot;,\n \&quot;id\&quot;: \&quot;7321\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T09:10:24.057\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;parent_id\&quot;: \&quot;7313\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7313&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7321&quot;}}},{&quot;rowIdx&quot;:1673,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;イメージ図の黒いViewを透明にしたいと思ってます。\\n\\nイメージは search.barTintColor = [UIColor clearColor];\\n\\nとしたものです。わかる方いらっしゃいましたらよろしくおねがいします。\\n\\n![画像の説明をここに入力](https://i.stack.imgur.com/houVH.png)\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T05:30:14.527\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7315\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T06:14:19.553\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8060\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 0,\n \&quot;tags\&quot;: [\n \&quot;ios\&quot;\n ],\n \&quot;title\&quot;: \&quot;UISearchBarの背景のViewを透明にしたい。\&quot;,\n \&quot;view_count\&quot;: 1250\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;UISearchBarのSearch StyleをMinimalにすれば解決できるかと思います。\n\n* * *\n\n追記 \nコメント欄だと書ききれないのでこちらに追記します。\n\nUISearchBarにある\n\n・UISearchBarBackGround(UIImageViewのサブクラス) \n・UISearchBarTextField(UITextFieldのサブクラス)\n\nという2つのViewの設定をすれば実現できるかと思います。\n\nUISearchBarのSubViewを追いかけていくと該当のViewが見つかるので、 \n適宜必要な部分をいじってみてください。\n\n以下ソース\n\n```\n\n // UISearchBarのサブビューを取得\n for (UIView *subview in self.SearchBar.subviews) {\n \n // UISearchBarのサブビューのサブビューを取得\n for(UIView *secondSubView in subview.subviews) {\n \n // 背景部分のViewを取得\n if ([secondSubView isKindOfClass:[UIImageView class]]) {\n \n // setImageでnilを渡す\n [(UIImageView *)secondSubView setImage:nil];\n \n // 任意の色を指定\n [secondSubView setBackgroundColor:[UIColor clearColor]];\n }\n \n // テキストフィールド部分を取得\n if ([secondSubView isKindOfClass:[UITextField class]]) {\n [(UITextField *)secondSubView setBackgroundColor:[UIColor whiteColor]]; \n }\n } \n }\n \n```\n\n![サンプル](https://i.stack.imgur.com/7m2TE.jpg)&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T06:00:56.373&quot;,&quot;id&quot;:&quot;7317&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T06:14:19.553&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T06:14:19.553&quot;,&quot;last_editor_user_id&quot;:&quot;8521&quot;,&quot;owner_user_id&quot;:&quot;8521&quot;,&quot;parent_id&quot;:&quot;7315&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;UISearchBarのSearch StyleをMinimalにすれば解決できるかと思います。\\n\\n* * *\\n\\n追記 \\nコメント欄だと書ききれないのでこちらに追記します。\\n\\nUISearchBarにある\\n\\n・UISearchBarBackGround(UIImageViewのサブクラス) \\n・UISearchBarTextField(UITextFieldのサブクラス)\\n\\nという2つのViewの設定をすれば実現できるかと思います。\\n\\nUISearchBarのSubViewを追いかけていくと該当のViewが見つかるので、 \\n適宜必要な部分をいじってみてください。\\n\\n以下ソース\\n\\n```\\n\\n // UISearchBarのサブビューを取得\\n for (UIView *subview in self.SearchBar.subviews) {\\n \\n // UISearchBarのサブビューのサブビューを取得\\n for(UIView *secondSubView in subview.subviews) {\\n \\n // 背景部分のViewを取得\\n if ([secondSubView isKindOfClass:[UIImageView class]]) {\\n \\n // setImageでnilを渡す\\n [(UIImageView *)secondSubView setImage:nil];\\n \\n // 任意の色を指定\\n [secondSubView setBackgroundColor:[UIColor clearColor]];\\n }\\n \\n // テキストフィールド部分を取得\\n if ([secondSubView isKindOfClass:[UITextField class]]) {\\n [(UITextField *)secondSubView setBackgroundColor:[UIColor whiteColor]]; \\n }\\n } \\n }\\n \\n```\\n\\n![サンプル](https://i.stack.imgur.com/7m2TE.jpg)\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T06:00:56.373\&quot;,\n \&quot;id\&quot;: \&quot;7317\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T06:14:19.553\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T06:14:19.553\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8521\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8521\&quot;,\n \&quot;parent_id\&quot;: \&quot;7315\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7315&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7317&quot;}}},{&quot;rowIdx&quot;:1674,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 0,\n \&quot;body\&quot;: \&quot;あるシステムのオープンソース化のため、下記の通り構成を変更することとなりました。\\n\\n【現在】 【変更後】 \\nOS:RedHatEnterpriseLinux ⇒ RedHatEnterpriseLinux \\nAPサーバ:WebLogic 8.1 ⇒ tomcat \\nHTTPサーバ:Apache ⇒ Apache \\nDB:Oracle 10g ⇒ postgres\\n\\nAPサーバとDBが変わるため、プログラム改修が必要となるのですがまだ修正箇所・影響範囲は特定できておりません。\\n\\n調査・検討を進めるためにも環境が用意したいのですが、 \\n開発用ドキュメントや資材は用意されておらず、手元にあるのはソース一式のみです。\\n\\nソースを確認しましたところ、「.project」ファイルを見つけeclipseのプロジェクト一式のようだったので、とりあえずeclipseにその一式を入れてみたのですが当然そのままでは動きませんでした。\\n\\nエラーを確認すると、下記5件のエラーが出ておりました。\\n\\n> ビルド・パスのエラーが解決されるまで、プロジェクトをビルドできません\\n>\\n> プロジェクト 'xxxxx' に、必要なライブラリー 'C:\\\\bea\\\\weblogic81\\\\server\\\\lib\\\\ojdbc14.jar' \\n> がありません\\n>\\n> プロジェクト 'xxxxx' に、必要なライブラリー 'C:\\\\bea\\\\weblogic81\\\\server\\\\lib\\\\weblogic.jar' \\n> がありません\\n>\\n> プロジェクト 'xxxxx' のクラスパス変数 'JDK_TOOLS' がアンバインドされています\\n>\\n> プロジェクト 'xxxxx' のクラスパス変数 'WEBLOGIC81/webservices.jar' がアンバインドされています\\n\\nエラーを解消し、自分のWindows7(32bit)上でデバックできるようにしたいのですが、 \\nそもそもWeblogic 8.1を構築する資材が手元になく困っております。\\n\\n日本オラクル様にも問い合わせを行ってみたのですが、 \\n古いバージョンのWeblogicについてはダウンロードサイトでも公開していないとのことでした。\\n\\n環境構築のため、どこかWeblogic8.1の資材を入手できるところはないものでしょうか。 \\nまた、当方WeblogicおよびLinuxの経験も全くないもので、環境構築および調査・検討を進めるにあたり参考になりそうなドキュメントやサイトはないものでしょうか。\\n\\nよろしくお願いします。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T05:44:39.263\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7316\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T05:44:39.263\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8056\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;linux\&quot;,\n \&quot;apache\&quot;,\n \&quot;weblogic\&quot;\n ],\n \&quot;title\&quot;: \&quot;WebLogic 8.1環境構築資材の入手先\&quot;,\n \&quot;view_count\&quot;: 341\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[],&quot;string&quot;:&quot;[]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7316&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;}}},{&quot;rowIdx&quot;:1675,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;タイトルの件となります。 \\nWindowsデスクトップアプリでWinRTのAPIを利用できるということなので \\n<https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-\\napplications>\\n\\n(利用可能なAPI一覧) \\n[https://msdn.microsoft.com/en-\\nus/library/windows/desktop/dn554295%28v=vs.85%29.aspx?f=255&amp;MSPPError=-2147217396](https://msdn.microsoft.com/en-\\nus/library/windows/desktop/dn554295%28v=vs.85%29.aspx?f=255&amp;MSPPError=-2147217396)\\n\\nをみて、MediaCaptureクラスを利用しようと考えたのですが、Windowsストアアプリなどではカメラの利用を許可するために「package.appxmanifest」を変更していると思います。 \\nデスクトップアプリの場合はどのようにすればカメラが利用できるのでしょうか。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T06:34:03.070\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7318\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-07-30T14:00:42.227\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T07:09:39.563\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;49\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8636\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;windows\&quot;,\n \&quot;c++\&quot;,\n \&quot;visual-studio\&quot;\n ],\n \&quot;title\&quot;: \&quot;Win8(タブレット)向けWindowsデスクトップアプリにてカメラを利用する方法(package.appxmanifestの変更?)\&quot;,\n \&quot;view_count\&quot;: 5315\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;C#とVBですが[MSDNの日本フォーラム](https://social.msdn.microsoft.com/Forums/ja-\nJP/ebc89f7d-d6d6-4490-9602-088d84501d01)にMediaCaptureを使用したデスクトップアプリのサンプルコードがあり、githubからプロジェクト一式を入手できます。 \nサンプルではストアアプリのような許可は行わずにカメラを使用できています。\n\nC++では以下のように読み替えるのだと考えられます。\n\n * vcxprojを編集してTargetPlatformVersionを追加\n * 以下のdllを参照 \nSystem.Runtime.WindowsRuntime.dll System.Runtime.dll \nSystem.Runtime.InteropServices.WindowsRuntime.dll \nSystem.Threading.Tasks.dll \nSystem.IO.dll\n\n * Windows.winmdはプロジェクトのプロパティ->構成プロパティ->全般->Windowsストアアプリのサポート->[はい]で参照&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T10:17:01.287&quot;,&quot;id&quot;:&quot;7324&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T10:17:01.287&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8629&quot;,&quot;parent_id&quot;:&quot;7318&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;C#とVBですが[MSDNの日本フォーラム](https://social.msdn.microsoft.com/Forums/ja-\\nJP/ebc89f7d-d6d6-4490-9602-088d84501d01)にMediaCaptureを使用したデスクトップアプリのサンプルコードがあり、githubからプロジェクト一式を入手できます。 \\nサンプルではストアアプリのような許可は行わずにカメラを使用できています。\\n\\nC++では以下のように読み替えるのだと考えられます。\\n\\n * vcxprojを編集してTargetPlatformVersionを追加\\n * 以下のdllを参照 \\nSystem.Runtime.WindowsRuntime.dll System.Runtime.dll \\nSystem.Runtime.InteropServices.WindowsRuntime.dll \\nSystem.Threading.Tasks.dll \\nSystem.IO.dll\\n\\n * Windows.winmdはプロジェクトのプロパティ->構成プロパティ->全般->Windowsストアアプリのサポート->[はい]で参照\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T10:17:01.287\&quot;,\n \&quot;id\&quot;: \&quot;7324\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T10:17:01.287\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8629\&quot;,\n \&quot;parent_id\&quot;: \&quot;7318\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7318&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7324&quot;}}},{&quot;rowIdx&quot;:1676,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7327\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;「一定期間以上 既読状態なら未読に戻す」というクラスメソッドへのRSpecを書きたいのですが動作しません。\\n\\nテストはこのように書き\\n\\n```\\n\\n let(:company){ Company.create }\\n describe \\\&quot;.remove_old_read\\\&quot; do\\n before{ Timecop.freeze(Time.local(2014,10,10)) }\\n after{ Timecop.return }\\n context \\\&quot;既読で3ヶ月以上前なら\\\&quot; do\\n before do\\n company.update_attributes(read: true, read_at: Time.new(2014,7,9))\\n Company.remove_old_read\\n end\\n it \\\&quot;未読にする\\\&quot; do\\n expect(company.read).to eq(false)\\n end\\n end\\n end\\n \\n```\\n\\n対するメソッドはこのように書いています。\\n\\n```\\n\\n class Company < ActiveRecord::Base\\n def self.remove_old_read\\n Company.where(\\\&quot;read_at < ?\\\&quot;, Time.zone.now - 3.month).each do |c|\\n c.update_attributes({read: false}) #if c.read \\n end\\n end\\n end\\n \\n```\\n\\nどこが間違えているのでしょうか? \\n特にクラスメソッドの呼び出し方法が自信ありません…。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T10:15:33.713\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7323\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T11:40:03.870\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;3271\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;ruby\&quot;,\n \&quot;ruby-on-rails\&quot;\n ],\n \&quot;title\&quot;: \&quot;一括処理をするクラスメソッドに対するRspecの書き方\&quot;,\n \&quot;view_count\&quot;: 2106\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;僕が書くとしたらこんな感じですかねー。\n\n```\n\n describe \&quot;.remove_old_read\&quot; do\n context \&quot;既読で3ヶ月以上前なら\&quot; do\n before do\n company.update_attributes(read: true, read_at: Time.local(2014, 7, 9))\n end\n after{ Timecop.return }\n it \&quot;未読にする\&quot; do\n Timecop.freeze(Time.local(2014, 10, 10)) \n expect { Company.remove_old_read }.to change{ company.reload.read }.from(true).to(false)\n end\n end\n end\n \n```\n\n`Company.remove_old_read`はテストコード上は`company`と全く関連のないメソッドになっています。 \nなので`company`は`reload`してあげないとDBの状態とテストコード上の状態がシンクしません。 \nたぶんここがポイントじゃないかなと思います。\n\nそれから、`context\n\&quot;既読で3ヶ月以上前なら\&quot;`って書いているなら、Timecopを使ったシステム日時の変更はこのcontextブロックの中で書いてあげましょう。 \nまた、`remove_old_read`の近くで変更したほうが「これは2014-10-10にremove_old_readするんだな」というのが見た目にわかりやすくていいと思います。\n\nあと`change`マッチャについてはこちらを参照してください。\n\n * <http://qiita.com/jnchito/items/2e79a1abe7cd8214caa5#change--from--to--by>\n\n参考になれば幸いです。\n\n### 別解\n\nread_atを3ヶ月前の日時で更新すればTimecopはいらないですね。\n\n```\n\n describe \&quot;.remove_old_read\&quot; do\n context \&quot;既読で3ヶ月以上前なら\&quot; do\n before do\n # 3ヶ月前ピッタリだとタイミングによっては条件に合致しないかもしれないので、\n # さらに1分追加しておく。\n company.update_attributes(read: true, read_at: 3.months.ago - 1.minute)\n end\n it \&quot;未読にする\&quot; do\n expect { Company.remove_old_read }.to change{ company.reload.read }.from(true).to(false)\n end\n end\n end\n \n```&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T11:26:44.227&quot;,&quot;id&quot;:&quot;7327&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T11:40:03.870&quot;,&quot;last_edit_date&quot;:&quot;2015-03-02T11:40:03.870&quot;,&quot;last_editor_user_id&quot;:&quot;85&quot;,&quot;owner_user_id&quot;:&quot;85&quot;,&quot;parent_id&quot;:&quot;7323&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;僕が書くとしたらこんな感じですかねー。\\n\\n```\\n\\n describe \\\&quot;.remove_old_read\\\&quot; do\\n context \\\&quot;既読で3ヶ月以上前なら\\\&quot; do\\n before do\\n company.update_attributes(read: true, read_at: Time.local(2014, 7, 9))\\n end\\n after{ Timecop.return }\\n it \\\&quot;未読にする\\\&quot; do\\n Timecop.freeze(Time.local(2014, 10, 10)) \\n expect { Company.remove_old_read }.to change{ company.reload.read }.from(true).to(false)\\n end\\n end\\n end\\n \\n```\\n\\n`Company.remove_old_read`はテストコード上は`company`と全く関連のないメソッドになっています。 \\nなので`company`は`reload`してあげないとDBの状態とテストコード上の状態がシンクしません。 \\nたぶんここがポイントじゃないかなと思います。\\n\\nそれから、`context\\n\\\&quot;既読で3ヶ月以上前なら\\\&quot;`って書いているなら、Timecopを使ったシステム日時の変更はこのcontextブロックの中で書いてあげましょう。 \\nまた、`remove_old_read`の近くで変更したほうが「これは2014-10-10にremove_old_readするんだな」というのが見た目にわかりやすくていいと思います。\\n\\nあと`change`マッチャについてはこちらを参照してください。\\n\\n * <http://qiita.com/jnchito/items/2e79a1abe7cd8214caa5#change--from--to--by>\\n\\n参考になれば幸いです。\\n\\n### 別解\\n\\nread_atを3ヶ月前の日時で更新すればTimecopはいらないですね。\\n\\n```\\n\\n describe \\\&quot;.remove_old_read\\\&quot; do\\n context \\\&quot;既読で3ヶ月以上前なら\\\&quot; do\\n before do\\n # 3ヶ月前ピッタリだとタイミングによっては条件に合致しないかもしれないので、\\n # さらに1分追加しておく。\\n company.update_attributes(read: true, read_at: 3.months.ago - 1.minute)\\n end\\n it \\\&quot;未読にする\\\&quot; do\\n expect { Company.remove_old_read }.to change{ company.reload.read }.from(true).to(false)\\n end\\n end\\n end\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T11:26:44.227\&quot;,\n \&quot;id\&quot;: \&quot;7327\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T11:40:03.870\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T11:40:03.870\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;85\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;85\&quot;,\n \&quot;parent_id\&quot;: \&quot;7323\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7323&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7327&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7327&quot;}}},{&quot;rowIdx&quot;:1677,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;gitで差分が出続ける現象に悩まされています。git statusすると以下のメッセージが出たので対処しようとしますが、、、\\n\\n```\\n\\n Changes not staged for commit:\\n (use \\\&quot;git add <file>...\\\&quot; to update what will be committed)\\n (use \\\&quot;git checkout -- <file>...\\\&quot; to discard changes in working directory)\\n \\n modified: app/hoge.php\\n modified: app/fuga.css\\n \\n no changes added to commit (use \\\&quot;git add\\\&quot; and/or \\\&quot;git commit -a\\\&quot;)\\n \\n```\\n\\n`stash`しても`commit`しても`reset`しても差分が出続けます。SourceTreeやGitHubのアプリケーションなどのGUIで操作しようとしても出続けます。\\n\\n同様の現象に遭遇した方おりますでしょうか?\\n\\n解決策の分かる方いらっしゃいましたらご教示いただけると幸いです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T11:24:39.877\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7325\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T03:45:00.300\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T03:45:00.300\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;845\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;534\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 4,\n \&quot;tags\&quot;: [\n \&quot;git\&quot;\n ],\n \&quot;title\&quot;: \&quot;gitで差分が出続ける現象に困っています\&quot;,\n \&quot;view_count\&quot;: 2756\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;```\n\n git add app/hoge.php\n git add app/fuga.css\n git commit -m \&quot;<your commit message>\&quot;\n \n```\n\nで解決しないでしょうか?&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-02T11:26:15.963&quot;,&quot;id&quot;:&quot;7326&quot;,&quot;last_activity_date&quot;:&quot;2015-03-02T11:26:15.963&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;3313&quot;,&quot;parent_id&quot;:&quot;7325&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;```\\n\\n git add app/hoge.php\\n git add app/fuga.css\\n git commit -m \\\&quot;<your commit message>\\\&quot;\\n \\n```\\n\\nで解決しないでしょうか?\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T11:26:15.963\&quot;,\n \&quot;id\&quot;: \&quot;7326\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-02T11:26:15.963\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;3313\&quot;,\n \&quot;parent_id\&quot;: \&quot;7325\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7325&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7326&quot;}}},{&quot;rowIdx&quot;:1678,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7340\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;現在React.jsを使用してアプリケーションを作成しています。 \\nブラウザ側ではwebpackを使用してコンポーネントをrequireして使用しています。\\n\\nReact.jsのサーバサイドレンダリングを使用してレスポンスを返したいと考えているのですが、Nashornにはrequireが存在しないようなので、<https://github.com/nodyn/jvm-\\nnpm> を利用してrequireしようとしています。\\n\\nしかし以下のようにreactをrequireすると\\n\\n```\\n\\n engine.eval(\\\&quot;load('./dist/jsx/jvm-npm.js');\\\&quot;);\\n engine.eval(\\\&quot;var React = require('./node_modules/react/react');\\\&quot;);\\n \\n```\\n\\nエラーが発生してしまいます。Nashornでrequireを使う方法はないのでしょうか。\\n\\n> javax.script.ScriptException: ReferenceError: \\\&quot;process\\\&quot; is not defined \\n> in ./dist/jsx/jvm-npm.js at line number 106 at column number 11 at \\n>\\n> jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:564) \\n> at \\n>\\n> jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:548) \\n> at \\n>\\n> jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:528) \\n> at \\n>\\n> jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:524) \\n> at \\n>\\n> jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:194) \\n> at \\n> javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) \\n> at net.jirox.radarscope.RadarScope.render(RadarScope.java:35) at \\n> net.jirox.radarscope.RadarScopeTest.testRender(RadarScopeTest.java:32) \\n> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at \\n>\\n> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) \\n> at \\n>\\n> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) \\n> at java.lang.reflect.Method.invoke(Method.java:483) at \\n>\\n> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) \\n> at \\n>\\n> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) \\n> at \\n>\\n> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) \\n> at \\n>\\n> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) \\n> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at \\n>\\n> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) \\n> at \\n>\\n> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) \\n> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at \\n> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at \\n> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at \\n> org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at \\n> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at \\n> org.junit.runners.ParentRunner.run(ParentRunner.java:309) at \\n>\\n> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) \\n> at \\n>\\n> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) \\n> at \\n>\\n> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) \\n> at \\n>\\n> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) \\n> at \\n>\\n> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) \\n> at \\n>\\n> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) \\n> Caused by: ./dist/jsx/jvm-npm.js:106:11 ReferenceError: \\\&quot;process\\\&quot; is \\n> not defined at \\n> jdk.nashorn.internal.scripts.Script$jvm_npm._L21$Require(./dist/jsx/jvm-\\n> npm.js:106) \\n> at jdk.nashorn.internal.scripts.Script$\\\\^eval_.runScript(:1) \\n> at \\n>\\n> jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:498) \\n> at \\n> jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:206) \\n> at \\n> jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:378) \\n> at \\n>\\n> jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:546) \\n> ... 29 more\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T15:46:08.190\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7333\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T00:59:53.813\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-02T21:43:52.083\&quot;,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;2298\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;javascript\&quot;,\n \&quot;java\&quot;,\n \&quot;java8\&quot;,\n \&quot;reactjs\&quot;\n ],\n \&quot;title\&quot;: \&quot;Java8のNashornでrequireしたい\&quot;,\n \&quot;view_count\&quot;: 916\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;`ReferenceError: \&quot;process\&quot; is not defined`との事ですので、JavaScript\nのどこかでグローバル変数`process`を参照しようとして、未定義エラーになっていると推測されます。\n\n読み込んでいるファイル`react/react.js`は、Browserify等のコマンドラインツールから読み込むことを想定しているようで、内部で`process.env.NODE_ENV`を参照しています。\n\n読み込むファイルを`react/dist/react.js`か、`react/dist/react.min.js`に変更するとエラーは出なくなると思われます。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T00:59:53.813&quot;,&quot;id&quot;:&quot;7340&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T00:59:53.813&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;4809&quot;,&quot;parent_id&quot;:&quot;7333&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;`ReferenceError: \\\&quot;process\\\&quot; is not defined`との事ですので、JavaScript\\nのどこかでグローバル変数`process`を参照しようとして、未定義エラーになっていると推測されます。\\n\\n読み込んでいるファイル`react/react.js`は、Browserify等のコマンドラインツールから読み込むことを想定しているようで、内部で`process.env.NODE_ENV`を参照しています。\\n\\n読み込むファイルを`react/dist/react.js`か、`react/dist/react.min.js`に変更するとエラーは出なくなると思われます。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T00:59:53.813\&quot;,\n \&quot;id\&quot;: \&quot;7340\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T00:59:53.813\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;4809\&quot;,\n \&quot;parent_id\&quot;: \&quot;7333\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7333&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7340&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7340&quot;}}},{&quot;rowIdx&quot;:1679,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;`readystatechange` はイベントなのだから `addEventListener`\\nを使って登録できると思うんですが、大抵のAjaxサンプルでは `onreadystatechange` に代入する方法をとってると思います。\\n\\nなにか避ける理由でもあるんでしょうか。ちょっと長いから?\\n\\n```\\n\\n var xhr = new XMLHttpRequest();\\n xhr.open(\\\&quot;GET\\\&quot;, \\\&quot;/path/to/file\\\&quot;, true);\\n xhr.onreadystatechange = function(){\\n if( this.readyState === 4 &amp;&amp; this.status === 200 ){\\n console.log(xhr.responseText);\\n }\\n };\\n xhr.addEventListener('readystatechange', function(){\\n if( this.readyState === 4 &amp;&amp; this.status === 200 ){\\n console.log(xhr.responseText);\\n }\\n });\\n xhr.send(\\\&quot;\\\&quot;);\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T18:01:34.173\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7334\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-09-18T15:47:35.707\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T00:48:19.030\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;76\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8610\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 6,\n \&quot;tags\&quot;: [\n \&quot;javascript\&quot;,\n \&quot;ajax\&quot;\n ],\n \&quot;title\&quot;: \&quot;onreadystatechange に対して addEventListener を使わないのはなぜか\&quot;,\n \&quot;view_count\&quot;: 1921\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;(現在はどうか分かりませんが、)addEventListenerの方はOperaでは動かないみたいですね。 \nW3Cの仕様でいえばreadystatechangeを発火しないとダメなんですが、それに従っていないようです。\n\nズバリな質問がありました ↓\n\n<https://stackoverflow.com/questions/6971259/readystatechange-using-\naddeventlistener-versus-old-style-property>&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-08-19T15:34:47.583&quot;,&quot;id&quot;:&quot;14633&quot;,&quot;last_activity_date&quot;:&quot;2015-08-19T15:34:47.583&quot;,&quot;last_edit_date&quot;:&quot;2017-05-23T12:38:55.307&quot;,&quot;last_editor_user_id&quot;:&quot;-1&quot;,&quot;owner_user_id&quot;:&quot;9608&quot;,&quot;parent_id&quot;:&quot;7334&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;(現在はどうか分かりませんが、)addEventListenerの方はOperaでは動かないみたいですね。 \\nW3Cの仕様でいえばreadystatechangeを発火しないとダメなんですが、それに従っていないようです。\\n\\nズバリな質問がありました ↓\\n\\n<https://stackoverflow.com/questions/6971259/readystatechange-using-\\naddeventlistener-versus-old-style-property>\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-08-19T15:34:47.583\&quot;,\n \&quot;id\&quot;: \&quot;14633\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-08-19T15:34:47.583\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2017-05-23T12:38:55.307\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;9608\&quot;,\n \&quot;parent_id\&quot;: \&quot;7334\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7334&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;14633&quot;}}},{&quot;rowIdx&quot;:1680,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;PHP の `mysql_connect` を使って MySQL への接続を試みているのですがうまくいきません。\\n\\n以下コードです。\\n\\n```\\n\\n <?php\\n \\n $connect = mysql_connect(\\\&quot;hiroki_%\\\&quot;,\\\&quot;hiroki\\\&quot;,\\\&quot;\\\&quot;);\\n echo mysql_errno().\\\&quot;: \\\&quot;.mysql_error().\\\&quot;<BR>\\\&quot;;\\n \\n if ($connect) {\\n echo 1;\\n } else {\\n echo 2;\\n }\\n \\n ?>\\n \\n```\\n\\nこれの実行結果はこちらです。\\n\\n```\\n\\n > 2005: Unknown MySQL server host 'hiroki_%' (20)\\n 2\\n \\n```\\n\\n※ ご存知かと思いますが\\n\\n```\\n\\n echo mysql_errno().\\\&quot;: \\\&quot;.mysql_error().\\\&quot;<BR>\\\&quot;;\\n \\n```\\n\\nは直近のエラーを表示するコードです。\\n\\nphptest というデータベースを作成しています。\\n\\n確かにユーザー作成はできているはずだと思います。\\n\\n![確かにユーザー作成はできているはずだと思います](https://i.stack.imgur.com/RwIAN.png)\\n\\n一般的には\\n\\n```\\n\\n $connect = mysql_connect(\\\&quot;localhost\\\&quot;,\\\&quot;root\\\&quot;,\\\&quot;\\\&quot;);\\n \\n```\\n\\nで接続するのが普通だと思いますがこうした場合の実行結果は\\n\\n```\\n\\n > 1045: Access denied for user 'root'@'localhost' (using password: NO)\\n 2\\n \\n```\\n\\nとなってしまいます。 \\nユーザー認証とかの話になってくるので新しくhirokiというユーザーを作成して実行したのですが上記の通りです。\\n\\n解決策をどうかお力添えお願いいたします。\\n\\n--追記--\\n\\nlocalhostにパスワードを設定して\\n\\n```\\n\\n <?php\\n $connect = mysql_connect(\\\&quot;localhost\\\&quot;,\\\&quot;root\\\&quot;,\\\&quot;password\\\&quot;);\\n \\n echo mysql_errno().\\\&quot;: \\\&quot;.mysql_error();\\n \\n```\\n\\nを実行すると実行結果は\\n\\n```\\n\\n 0: \\n \\n```\\n\\nとなり、エラーなしで接続できたのですが、phpMyAdminのページを表示すると\\n\\n```\\n\\n #1045 - Access denied for user 'root'@'localhost' (using password: YES) \\n \\n```\\n\\nとエラー文が表示されてしまい、phpMyAdminに入れなくなってしまいました。\\n\\n```\\n\\n MySQL サーバに接続しようとしましたが拒否されました。config.inc.php のホスト、ユーザ名、パスワードが MySQL サーバの管理者から与えられた情報と一致するか確認してください。\\n \\n```\\n\\nといった表示も出てきます。\\n\\nconfig.inc.phpというファイルを編集しようと思いfinderで検索したのですが \\nconfig.inc.phpのファイルが14個ほど出てきてどれを編集すればいいのかわかりません。\&quot;,\n \&quot;comment_count\&quot;: 8,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 4.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T18:15:05.713\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7335\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2020-10-14T01:33:46.200\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2020-10-14T01:33:46.200\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;3060\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8643\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;php\&quot;,\n \&quot;mysql\&quot;,\n \&quot;phpmyadmin\&quot;\n ],\n \&quot;title\&quot;: \&quot;PHPからMySQLに接続がうまくできない\&quot;,\n \&quot;view_count\&quot;: 24203\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;エラーメッセージの通りで、ホスト名が間違っているか名前解決ができていないかでサーバを見つけられていません。\n\nそもそもホスト名には`%`は使えないのですが、指定されているホスト名は実在するのでしょうか\n\n * `mysql_connect()`の第一引数に指定するのは **接続先** のホスト名です。\n * 権限で指定するホスト名は、 **接続元** のホスト名です。\n\n質問の内容からはこの点が区別できていないように見受けられます。\n\nもっと手前の話として、mysql_*系の関数は非推奨になっていますので、そこから見直すことをお勧めします。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T00:01:39.897&quot;,&quot;id&quot;:&quot;7338&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T01:06:53.210&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T01:06:53.210&quot;,&quot;last_editor_user_id&quot;:&quot;5793&quot;,&quot;owner_user_id&quot;:&quot;5793&quot;,&quot;parent_id&quot;:&quot;7335&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;まずは切り分けとして、 \nMySQLもPHPも同じサーバーの中にいるんだね?\n\nであれば、 \nhirokiのホストは **localhost** であるべきだと思うのです。\n\n後、 \n私の記憶だけで申し訳ないけど、 \n昔はMySQLも root,パスなし で接続できたけど、 \n最近はrootにパスワードを必ずつけないと接続できなかった気がするのです。 \nそれが例え **localhost** であったとしても。\n\n**追記への返答** \nrootにパスワードを設定してしまったので、 \nphpMysqlAdminに入れなくなってしまったみたいね。\n\n下記のサイトをご参照ください。 \nphpMyAdminの設定ファイル(config.inc.php)を \nrootで設定したパスワードに書き換えれば \n繋がるようになると思うよ。\n\n<http://php1st.com/435/>\n\nconfig.inc.phpの場所だけど、 \nMacOSXでApacheを立ち上げてやっていると思うけど、 \nApacheで公開されているphpMyAdminフォルダーのにあると思う。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T00:31:33.293&quot;,&quot;id&quot;:&quot;7339&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T04:48:15.197&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T04:48:15.197&quot;,&quot;last_editor_user_id&quot;:&quot;127&quot;,&quot;owner_user_id&quot;:&quot;127&quot;,&quot;parent_id&quot;:&quot;7335&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;エラーメッセージの通りで、ホスト名が間違っているか名前解決ができていないかでサーバを見つけられていません。\\n\\nそもそもホスト名には`%`は使えないのですが、指定されているホスト名は実在するのでしょうか\\n\\n * `mysql_connect()`の第一引数に指定するのは **接続先** のホスト名です。\\n * 権限で指定するホスト名は、 **接続元** のホスト名です。\\n\\n質問の内容からはこの点が区別できていないように見受けられます。\\n\\nもっと手前の話として、mysql_*系の関数は非推奨になっていますので、そこから見直すことをお勧めします。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T00:01:39.897\&quot;,\n \&quot;id\&quot;: \&quot;7338\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T01:06:53.210\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T01:06:53.210\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;5793\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;5793\&quot;,\n \&quot;parent_id\&quot;: \&quot;7335\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;まずは切り分けとして、 \\nMySQLもPHPも同じサーバーの中にいるんだね?\\n\\nであれば、 \\nhirokiのホストは **localhost** であるべきだと思うのです。\\n\\n後、 \\n私の記憶だけで申し訳ないけど、 \\n昔はMySQLも root,パスなし で接続できたけど、 \\n最近はrootにパスワードを必ずつけないと接続できなかった気がするのです。 \\nそれが例え **localhost** であったとしても。\\n\\n**追記への返答** \\nrootにパスワードを設定してしまったので、 \\nphpMysqlAdminに入れなくなってしまったみたいね。\\n\\n下記のサイトをご参照ください。 \\nphpMyAdminの設定ファイル(config.inc.php)を \\nrootで設定したパスワードに書き換えれば \\n繋がるようになると思うよ。\\n\\n<http://php1st.com/435/>\\n\\nconfig.inc.phpの場所だけど、 \\nMacOSXでApacheを立ち上げてやっていると思うけど、 \\nApacheで公開されているphpMyAdminフォルダーのにあると思う。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T00:31:33.293\&quot;,\n \&quot;id\&quot;: \&quot;7339\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T04:48:15.197\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T04:48:15.197\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;127\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;127\&quot;,\n \&quot;parent_id\&quot;: \&quot;7335\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7335&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7338&quot;}}},{&quot;rowIdx&quot;:1681,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7360\&quot;,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;djangoで開発を進めています。djangoでmodelの設定が、runserverで立ち上げたadminページに反映されないことで困っています。どなたか原因のわかる方がいれば、ご教授いただけると幸いです。\\n\\n# 背景\\n\\n 1. model.pyにモデルクラス`TestModel(models.Model)`を記載しました。そのモデルは`sampleField = models.CharField(max_length='20')`のフィールドを含んでいます。\\n 2. admin.pyにその`TestModel`を`register`しました。syncdb、makemigrations等を行い、そして以下のコマンドで開発サーバーを立ち上げました。\\n``` python manage.py runserver\\n\\n \\n```\\n\\n 3. `http://localhost:8000/admin`からログインしました。そのモデルでレコードを追加していたところ、sampleFieldにブランクを設定したいということになりました。\\n\\n 4. model.pyの対応する`sampleField = models.CharField(max_length='20')`を`sampleField = models.CharField(max_length='20',blank=True,null=True)`に変更し、makemigrationsおよびsyncdbを実施しました。\\n 5. 再度adminページからレコードの追加を試みましたが、`sampleField`で以下のエラーが発生しました。\\n\\n> This field is required.\\n\\n 6. model.pycが存在することが原因かと考え、削除しました。また、開発サーバーを念のため以下のコマンドで再起動しました。しかし、同様のエラーが発生しました。\\n``` python manage.py runserver\\n\\n \\n```\\n\\n 7. htmlのキャッシュが原因かと考え、ブラウザのキャッシュを削除しました。しかし、同様にエラーが発生しました。\\n\\n 8. djangoのdbキャッシュがあるのかと考え、以下のコマンドで削除しました。ですが、エラーが発生しました。\\n``` python manege.py shell;from django.core.cache import\\ncache;cache.clear()\\n\\n \\n```\\n\\n 9. htmlが反映されていないようにたので、`TestModel(models.Model)`に`sampleField2 = models.CharField(max_length='20',blank=True,null=True)`を追加し、makemigrationsおよびsyncdbを実施し、開発サーバー再起動、adminページへのアクセスを実施しました。adminページでは、`sampleField2`の入力項目が表示されていませんでした。\\n\\nどこかにhtmlのキャッシュがたまっている?かと思っていますが、どこから削除すれ良いかわかりませんでした。どなたか上記問題の解決策がわかれば、ご教授ください。\\n\\nよろしくお願いします。\\n\\n# 追記\\n\\nローカル環境で、設定を実施していた際は、htmlが反映されなかったのですが、Apacheの立ち上がっているWEBサーバーにpushして、そこで確認してみると、問題なく起動されました。 \\nrunserverで立ち上げたサーバの挙動がイマイチ理解できていないようです。\\n\\n# 解決報告\\n\\n下記の流れで、本件が発生しておりました。私のミスでした。色々ご迷惑をおかけしました。\\n\\n 1. ターミナルAにて、bashを利用し、プロジェクトリポジトリ`/home/myname/myDjangoProject`にて`python manage.py runserver`を実行。\\n 2. 別にターミナルBを起動し、`/home/myname/myDjangoProject`で、model.py等を編集。\\n 3. サーバー上のリポジトリにpushする際に、コンフリクトが発生したので、ターミナルBにて`/home/myname/myDjangoProject`を`/home/myname/_myDjangoProject`にリネーム。サーバー上のリポジトリをローカルに再度、cloneし、作業を再開。\\n 4. ここまでが背景の1から3に隠れていました。その後、背景の4以降を実施。\\n\\nターミナルAが参照しているディレクトリは、実は、`/home/myname/_myDjangoProject`であったが、pwdの実行結果は`/home/myname/myDjangoProject`となるため、ワーキングディレクトリがズレていることに気付きませんでした。そのため、今回のように設定が反映されないと考えていました。\\n\\n参照先のDBがズレていないかとご指摘いただいたことで、参照していたsqlite3を確認しようと、ターミナルAでrunserverを停止し、`open\\n.`を実行したところ、今回の問題に気付きました。\\n\\nご迷惑おかけしました。そして、色々ありがとうございました。 \\n(タイトルは本質からズレていますが、どのように修正したら良いのでしょう。)\&quot;,\n \&quot;comment_count\&quot;: 3,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-02T22:24:24.630\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7337\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T12:58:22.387\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T12:58:22.387\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7834\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7834\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;python\&quot;,\n \&quot;django\&quot;\n ],\n \&quot;title\&quot;: \&quot;djangoのadminページのhtmlキャッシュ削除について\&quot;,\n \&quot;view_count\&quot;: 1556\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;(ドキュメントを読み返して、回答自体がドキュメントを誤読したうえで作成してしまっている可能性があるので、一旦取り消します)&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T02:14:59.047&quot;,&quot;id&quot;:&quot;7343&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T07:24:46.100&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T07:24:46.100&quot;,&quot;last_editor_user_id&quot;:&quot;2784&quot;,&quot;owner_user_id&quot;:&quot;2784&quot;,&quot;parent_id&quot;:&quot;7337&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;問題の状況が見えないので、示唆レベルの回答です。\n\n * `python manage.py runserver` で起動 &amp; デフォルトのキャッシュ設定の場合、キャッシュはとくに残りません。\n * `python manage.py runserver` で起動する場合はファイルに変更があればサーバーは自動で再起動されます。\n * Django 1.7 でしたら `syncdb` で問題ありません。内部的に `migrate` が実行されます。該当コード <https://github.com/django/django/blob/1.7.5/django/core/management/commands/syncdb.py#L27>\n\n以下の確認が必要そうです。\n\n * migrationファイルが正しく作成、適応されているか\n * 確認中のアプリサーバーは作成、適応したDBを正しく参照しているか\n * 確認中のアプリサーバーは正しく再起動しているか \n \n\n * とりあえずはローカル環境で、`runserver` と `sqlite` のデータベースで動作確認するのが良さそうです。\n \n\nまた、エラーが発生したのであればエラー内容を書いていただけると回答の役に立ちそうです。\n\n(信用度が足りなくて回答へのコメントとかができない!!)&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T05:55:07.297&quot;,&quot;id&quot;:&quot;7360&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T06:07:36.803&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T06:07:36.803&quot;,&quot;last_editor_user_id&quot;:&quot;2798&quot;,&quot;owner_user_id&quot;:&quot;2798&quot;,&quot;parent_id&quot;:&quot;7337&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:5}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;(ドキュメントを読み返して、回答自体がドキュメントを誤読したうえで作成してしまっている可能性があるので、一旦取り消します)\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T02:14:59.047\&quot;,\n \&quot;id\&quot;: \&quot;7343\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T07:24:46.100\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T07:24:46.100\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;2784\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;2784\&quot;,\n \&quot;parent_id\&quot;: \&quot;7337\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;問題の状況が見えないので、示唆レベルの回答です。\\n\\n * `python manage.py runserver` で起動 &amp; デフォルトのキャッシュ設定の場合、キャッシュはとくに残りません。\\n * `python manage.py runserver` で起動する場合はファイルに変更があればサーバーは自動で再起動されます。\\n * Django 1.7 でしたら `syncdb` で問題ありません。内部的に `migrate` が実行されます。該当コード <https://github.com/django/django/blob/1.7.5/django/core/management/commands/syncdb.py#L27>\\n\\n以下の確認が必要そうです。\\n\\n * migrationファイルが正しく作成、適応されているか\\n * 確認中のアプリサーバーは作成、適応したDBを正しく参照しているか\\n * 確認中のアプリサーバーは正しく再起動しているか \\n \\n\\n * とりあえずはローカル環境で、`runserver` と `sqlite` のデータベースで動作確認するのが良さそうです。\\n \\n\\nまた、エラーが発生したのであればエラー内容を書いていただけると回答の役に立ちそうです。\\n\\n(信用度が足りなくて回答へのコメントとかができない!!)\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T05:55:07.297\&quot;,\n \&quot;id\&quot;: \&quot;7360\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T06:07:36.803\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T06:07:36.803\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;2798\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;2798\&quot;,\n \&quot;parent_id\&quot;: \&quot;7337\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 5\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7337&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7360&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7360&quot;}}},{&quot;rowIdx&quot;:1682,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7370\&quot;,\n \&quot;answer_count\&quot;: 3,\n \&quot;body\&quot;: \&quot;元データhogeAry \\n・子に対する親を parent_id で指定 \\n・親は parent_id = 0\\n\\n```\\n\\n Array\\n (\\n [0] => Array\\n (\\n [hoge_id] => 2\\n [hoge] => 親2\\n [parent_id] => 0\\n )\\n [1] => Array\\n (\\n [hoge_id] => 3\\n [hoge] => 子2-1\\n [parent_id] => 2\\n )\\n [2] => Array\\n (\\n [hoge_id] => 4\\n [hoge] => 子7-1\\n [parent_id] => 7\\n )\\n [3] => Array\\n (\\n [hoge_id] => 7\\n [hoge] => 親7\\n [parent_id] => 0\\n )\\n [4] => Array\\n (\\n [hoge_id] => 1\\n [hoge] => 親1\\n [parent_id] => 0\\n )\\n )\\n \\n```\\n\\n希望出力結果\\n\\n```\\n\\n <ul>\\n <li>親1</li>\\n <li>親2\\n <ul>\\n <li>子2-1</li>\\n </ul>\\n </li>\\n <li>親7\\n <ul>\\n <li>子7-1</li>\\n </ul>\\n </li>\\n </ul>\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T01:25:16.077\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7341\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T08:08:32.537\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T03:46:22.523\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7886\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: -3,\n \&quot;tags\&quot;: [\n \&quot;php\&quot;,\n \&quot;html\&quot;\n ],\n \&quot;title\&quot;: \&quot;PHP多次元配列から階層リストタグ<ul><li></li><li><ul><li></li></ul></li></ul>を出力したい\&quot;,\n \&quot;view_count\&quot;: 4128\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;現状で細かい条件などが示されていないので、とりあえず例示されているデータでちゃんと出来るように適当に組んでみました。 \n`$data` に例示された配列としてみてください。\n\n```\n\n /**\n * hoge_id を比較して昇順にする.\n * @param array $a 左辺\n * @param array $b 右辺\n * @return integer $a['hoge_id'] が $b より大きい時は 1. $b['hoge_id'] が $a 以下の時は -1 を返す.\n */\n function id_cmp( array $a, array $b )\n {\n return ($a['hoge_id']>$b['hoge_id']) ? 1 : -1;\n }\n // リストデータ作成.\n $listed_data = array();\n foreach( $data as $datum )\n {\n // もしなんかの親だったら子供を探す\n if( $datum['parent_id'] === 0 ) {\n foreach( $data as $_child_datum ) {\n // 子を見つけたら子として拾っておく\n if( $datum['hoge_id'] == $_child_datum['parent_id'] ) {\n $datum['childs'] []= $_child_datum;\n }\n }\n $listed_data []= $datum;\n }\n }\n // hoge_id 順にソート.\n usort($listed_data,'id_cmp');\n \n // リスト化開始.\n $buffer='<ul>';\n foreach( $listed_data as $datum ) {\n $buffer.=\&quot;<li>{$datum['hoge']}\&quot;;\n if( isset($datum['childs']) ) {\n $buffer.='<ul>';\n $childs = $datum['childs'];\n foreach( $childs as $child ) {\n $buffer.=\&quot;<li>{$child['hoge']}</li>\&quot;;\n }\n $buffer.='</ul></li>';\n } else {\n $buffer.='</li>';\n }\n }\n // リスト表示.\n echo $buffer.='</ul>';\n \n```\n\n使い捨てコードなので汚くて済みません。 \n目的も他のデータパターンがあるのかどうか分かりませんでしたがこれでいかがでしょうか?&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T04:32:53.170&quot;,&quot;id&quot;:&quot;7352&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T04:32:53.170&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7926&quot;,&quot;parent_id&quot;:&quot;7341&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2},{&quot;body&quot;:&quot;宿題を手伝っている感じがしますが… \nオブジェクトを使って、ループ内のコードを簡単にしようとしてます。配列に比べると、オブジェクトだと持ち回しができるのでコードの見通しが良くなると思っています。その代わりHTML変換で再帰呼び出しになってしまいました。\n\nざっと書いただけなので、ちゃんと書くなら、 \n・stdClassではなくてHoge用のクラスを使う、 \n・エラー処理を行う、 \nなど必要なことはたくさんありそうです。\n\n```\n\n // オブジェクトに変換する\n $hogeAll = [];\n foreach($data as $hoge) {\n $hogeAll[$hoge['hoge_id']] = makeHoge($hoge);\n }\n // 階層構造を構築する\n $root = [];\n foreach($hogeAll as $hoge) {\n if($hoge->parent>0) {\n $hogeAll[$hoge->parent]->children[] = $hoge;\n } else {\n $root[] = $hoge;\n }\n }\n // HTMLに変換する\n echo listHoge($root);\n \n /**\n * @param stdClass[] $hogeList\n * @param string $head\n * @return string\n */\n function listHoge(array $hogeList, $head='') {\n $string = \&quot;{$head}<ul>\&quot;;\n foreach($hogeList as $hoge) {\n $string .= \&quot;\\n{$head} <li>\&quot;.$hoge->val;\n if($hoge->children) {\n $string .= \&quot;\\n{$head} \&quot;.listHoge($hoge->children, \&quot;{$head} \&quot;).\&quot;\\n{$head}\&quot;;\n }\n $string .= \&quot;</li>\&quot;;\n }\n return $string.\&quot;\\n{$head}</ul>\&quot;;\n }\n \n /**\n * @param array $data\n * @return stdClass\n */\n function makeHoge($data) {\n $hoge = new stdClass();\n $hoge->id = $data['hoge_id'];\n $hoge->val = $data['hoge'];\n $hoge->parent = $data['parent_id'];\n $hoge->children = [];\n return $hoge;\n }\n \n```&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T06:18:32.670&quot;,&quot;id&quot;:&quot;7361&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T06:37:04.553&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T06:37:04.553&quot;,&quot;last_editor_user_id&quot;:&quot;2571&quot;,&quot;owner_user_id&quot;:&quot;2571&quot;,&quot;parent_id&quot;:&quot;7341&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2},{&quot;body&quot;:&quot;他の方のアプローチのように、表示したい構造に合わせた木構造に変換してから表示用の組み立て処理を行うのも手ですが、今回示されているデータはある意味すでに木構造を表していますので、わざわざ表示向けのデータ構造に変換しないアプローチでもよいかと思います。\n\n下のコードでは、基本的な再帰のアプローチで、都度対象となる子を抽出してきてタグを組み立てています。\n\n```\n\n <?php\n \n $data = [\n [\n 'hoge_id' => 2,\n 'hoge' => '親2',\n 'parent_id' => 0,\n ],\n [\n 'hoge_id' => 8,\n 'hoge' => '孫',\n 'parent_id' => 4,\n ],\n [\n 'hoge_id' => 3,\n 'hoge' => '子2-1',\n 'parent_id' => 2,\n ],\n [\n 'hoge_id' => 4,\n 'hoge' => '子7-1',\n 'parent_id' => 7,\n ],\n [\n 'hoge_id' => 7,\n 'hoge' => '親7',\n 'parent_id' => 0,\n ],\n [\n 'hoge_id' => 1,\n 'hoge' => '親1',\n 'parent_id' => 0,\n ]\n ];\n \n class HtmlUlBuilder\n {\n private $data;\n \n public function __construct($data)\n {\n $this->data = $data;\n }\n \n public function buildFromParent($parent_id)\n {\n $children = array_filter($this->data, function ($element) use ($parent_id) {\n return $element['parent_id'] === $parent_id;\n });\n \n if (count($children) === 0) return '';\n \n return '<ul>' . array_reduce($children, function ($current, $element) {\n return $current . PHP_EOL . '<li>' . $element['hoge'] . $this->buildFromParent($element['hoge_id']) . '</li>';\n }, '') . '</ul>';\n }\n }\n \n usort($data, function ($a, $b) {\n return $a['hoge_id'] > $b['hoge_id'];\n });\n \n $builder = new HtmlUlBuilder($data);\n $html = $builder->buildFromParent(0);\n \n echo $html;\n \n```&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T08:08:32.537&quot;,&quot;id&quot;:&quot;7370&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T08:08:32.537&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5444&quot;,&quot;parent_id&quot;:&quot;7341&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:5}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;現状で細かい条件などが示されていないので、とりあえず例示されているデータでちゃんと出来るように適当に組んでみました。 \\n`$data` に例示された配列としてみてください。\\n\\n```\\n\\n /**\\n * hoge_id を比較して昇順にする.\\n * @param array $a 左辺\\n * @param array $b 右辺\\n * @return integer $a['hoge_id'] が $b より大きい時は 1. $b['hoge_id'] が $a 以下の時は -1 を返す.\\n */\\n function id_cmp( array $a, array $b )\\n {\\n return ($a['hoge_id']>$b['hoge_id']) ? 1 : -1;\\n }\\n // リストデータ作成.\\n $listed_data = array();\\n foreach( $data as $datum )\\n {\\n // もしなんかの親だったら子供を探す\\n if( $datum['parent_id'] === 0 ) {\\n foreach( $data as $_child_datum ) {\\n // 子を見つけたら子として拾っておく\\n if( $datum['hoge_id'] == $_child_datum['parent_id'] ) {\\n $datum['childs'] []= $_child_datum;\\n }\\n }\\n $listed_data []= $datum;\\n }\\n }\\n // hoge_id 順にソート.\\n usort($listed_data,'id_cmp');\\n \\n // リスト化開始.\\n $buffer='<ul>';\\n foreach( $listed_data as $datum ) {\\n $buffer.=\\\&quot;<li>{$datum['hoge']}\\\&quot;;\\n if( isset($datum['childs']) ) {\\n $buffer.='<ul>';\\n $childs = $datum['childs'];\\n foreach( $childs as $child ) {\\n $buffer.=\\\&quot;<li>{$child['hoge']}</li>\\\&quot;;\\n }\\n $buffer.='</ul></li>';\\n } else {\\n $buffer.='</li>';\\n }\\n }\\n // リスト表示.\\n echo $buffer.='</ul>';\\n \\n```\\n\\n使い捨てコードなので汚くて済みません。 \\n目的も他のデータパターンがあるのかどうか分かりませんでしたがこれでいかがでしょうか?\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T04:32:53.170\&quot;,\n \&quot;id\&quot;: \&quot;7352\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T04:32:53.170\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;parent_id\&quot;: \&quot;7341\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n },\n {\n \&quot;body\&quot;: \&quot;宿題を手伝っている感じがしますが… \\nオブジェクトを使って、ループ内のコードを簡単にしようとしてます。配列に比べると、オブジェクトだと持ち回しができるのでコードの見通しが良くなると思っています。その代わりHTML変換で再帰呼び出しになってしまいました。\\n\\nざっと書いただけなので、ちゃんと書くなら、 \\n・stdClassではなくてHoge用のクラスを使う、 \\n・エラー処理を行う、 \\nなど必要なことはたくさんありそうです。\\n\\n```\\n\\n // オブジェクトに変換する\\n $hogeAll = [];\\n foreach($data as $hoge) {\\n $hogeAll[$hoge['hoge_id']] = makeHoge($hoge);\\n }\\n // 階層構造を構築する\\n $root = [];\\n foreach($hogeAll as $hoge) {\\n if($hoge->parent>0) {\\n $hogeAll[$hoge->parent]->children[] = $hoge;\\n } else {\\n $root[] = $hoge;\\n }\\n }\\n // HTMLに変換する\\n echo listHoge($root);\\n \\n /**\\n * @param stdClass[] $hogeList\\n * @param string $head\\n * @return string\\n */\\n function listHoge(array $hogeList, $head='') {\\n $string = \\\&quot;{$head}<ul>\\\&quot;;\\n foreach($hogeList as $hoge) {\\n $string .= \\\&quot;\\\\n{$head} <li>\\\&quot;.$hoge->val;\\n if($hoge->children) {\\n $string .= \\\&quot;\\\\n{$head} \\\&quot;.listHoge($hoge->children, \\\&quot;{$head} \\\&quot;).\\\&quot;\\\\n{$head}\\\&quot;;\\n }\\n $string .= \\\&quot;</li>\\\&quot;;\\n }\\n return $string.\\\&quot;\\\\n{$head}</ul>\\\&quot;;\\n }\\n \\n /**\\n * @param array $data\\n * @return stdClass\\n */\\n function makeHoge($data) {\\n $hoge = new stdClass();\\n $hoge->id = $data['hoge_id'];\\n $hoge->val = $data['hoge'];\\n $hoge->parent = $data['parent_id'];\\n $hoge->children = [];\\n return $hoge;\\n }\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T06:18:32.670\&quot;,\n \&quot;id\&quot;: \&quot;7361\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T06:37:04.553\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T06:37:04.553\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;2571\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;2571\&quot;,\n \&quot;parent_id\&quot;: \&quot;7341\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n },\n {\n \&quot;body\&quot;: \&quot;他の方のアプローチのように、表示したい構造に合わせた木構造に変換してから表示用の組み立て処理を行うのも手ですが、今回示されているデータはある意味すでに木構造を表していますので、わざわざ表示向けのデータ構造に変換しないアプローチでもよいかと思います。\\n\\n下のコードでは、基本的な再帰のアプローチで、都度対象となる子を抽出してきてタグを組み立てています。\\n\\n```\\n\\n <?php\\n \\n $data = [\\n [\\n 'hoge_id' => 2,\\n 'hoge' => '親2',\\n 'parent_id' => 0,\\n ],\\n [\\n 'hoge_id' => 8,\\n 'hoge' => '孫',\\n 'parent_id' => 4,\\n ],\\n [\\n 'hoge_id' => 3,\\n 'hoge' => '子2-1',\\n 'parent_id' => 2,\\n ],\\n [\\n 'hoge_id' => 4,\\n 'hoge' => '子7-1',\\n 'parent_id' => 7,\\n ],\\n [\\n 'hoge_id' => 7,\\n 'hoge' => '親7',\\n 'parent_id' => 0,\\n ],\\n [\\n 'hoge_id' => 1,\\n 'hoge' => '親1',\\n 'parent_id' => 0,\\n ]\\n ];\\n \\n class HtmlUlBuilder\\n {\\n private $data;\\n \\n public function __construct($data)\\n {\\n $this->data = $data;\\n }\\n \\n public function buildFromParent($parent_id)\\n {\\n $children = array_filter($this->data, function ($element) use ($parent_id) {\\n return $element['parent_id'] === $parent_id;\\n });\\n \\n if (count($children) === 0) return '';\\n \\n return '<ul>' . array_reduce($children, function ($current, $element) {\\n return $current . PHP_EOL . '<li>' . $element['hoge'] . $this->buildFromParent($element['hoge_id']) . '</li>';\\n }, '') . '</ul>';\\n }\\n }\\n \\n usort($data, function ($a, $b) {\\n return $a['hoge_id'] > $b['hoge_id'];\\n });\\n \\n $builder = new HtmlUlBuilder($data);\\n $html = $builder->buildFromParent(0);\\n \\n echo $html;\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T08:08:32.537\&quot;,\n \&quot;id\&quot;: \&quot;7370\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T08:08:32.537\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5444\&quot;,\n \&quot;parent_id\&quot;: \&quot;7341\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 5\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7341&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7370&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7370&quot;}}},{&quot;rowIdx&quot;:1683,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7387\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;ASP.NET MVC2でCustomHelperを作っています。\\n\\n必要な情報が取得できない問題があったので、 \\n解決方法があればご教示ください。\\n\\nViewModelにDisplayName属性やValidationAttributeをつけています。\\n\\n属性を取得する際はModelMetadata.FromLambdaExpression()で取得できますが、 \\n対象のViewModelがBaseViewModelをoverrideしている場合、 \\nBaseViewModelの属性(たとえばDisplayName)を取得するようです。 \\n※今回の場合、BaseViewModelにはDisplayName属性をつけていないので \\n取得できない\\n\\n```\\n\\n public static MvcHtmlString LabelExFor<TModel, TProperty>(this HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression)\\n {\\n ModelMetadata metadata = ModelMetadata.FromLambdaExpression(expression, html.ViewData);\\n \\n return LabelExFor(html, expression, metadata.IsRequired);\\n }\\n \\n```\\n\\nViewではBaseViewModelをoverrideしたViewModelを用いているので \\nViewModelの属性を取得したいのですが、どのようにすればよいでしょうか?\\n\\n尚、ViewModelのプロパティをoverrideではなくnewで定義した場合は \\nViewModelの属性を取ってくるようです。\\n\\n# 最終的な回避方法\\n\\n標準の`LabelFor`は用いず、自作の`LabelExFor`で置き換える。`LabelExFor`では`FromLambdaExpression()`ではなく、`FromStringExpression()`を用いてmetadataの取得を行う。\\n\\n```\\n\\n public static MvcHtmlString LabelExFor<TModel, TProperty>(this HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression)\\n {\\n var htmlFieldName = ExpressionHelper.GetExpressionText(expression);\\n var metadata = ModelMetadata.FromStringExpression(ExpressionHelper.GetExpressionText(expression), html.ViewData);\\n \\n string labelText = metadata.DisplayName ?? \\n metadata.PropertyName ?? \\n htmlFieldName.Split('.').Last();\\n if (String.IsNullOrEmpty(labelText))\\n {\\n return MvcHtmlString.Empty;\\n }\\n (以下略)\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T02:11:01.320\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7342\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-19T03:08:42.557\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-19T03:08:42.557\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8647\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8647\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;c#\&quot;,\n \&quot;asp.net\&quot;,\n \&quot;mvc\&quot;\n ],\n \&quot;title\&quot;: \&quot;ModelMetadata.FromLambdaExpressionが親のメタデータを参照する\&quot;,\n \&quot;view_count\&quot;: 820\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;現行の`ModelMetadata.FromLambdaExpression`の[ソース](http://referencesource.microsoft.com/#System.Web/ModelBinding/ModelMetadata.cs)の290行目で、\n\n```\n\n containerType = memberExpression.Expression.Type;\n \n```\n\nとコンテナ型を求めている箇所が`System.Web.Mvc.dll`のバージョン2.0.0.0では\n\n```\n\n containerType = body.Member.DeclaringType;\n \n```\n\nとなっているため、過去に不具合修正が入っているのだと思われます。\n\n## 拡張メソッドでの回避方法\n\n例えば`LabelFor`の場合、以下のように拡張メソッドを実装すれば`ModelMetadata.FromStringExpression`を利用します。なお拡張メソッドの利用には`web.config`の編集が必要です。\n\n```\n\n public static class HtmlHelperExtensions\n {\n public MvcHtmlString LabelFor2<TModel, TProperty>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression)\n {\n return html.Label(ExpressionHelper.GetExpressionText(expression));\n }\n }\n \n```\n\nこれでもダメであれば自分で`ModelMetadata`と`HtmlHelper`を作って`LabelForModel`に渡すか、自分でHTMLを作るしかないように思われます。&quot;,&quot;comment_count&quot;:6,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T13:32:09.280&quot;,&quot;id&quot;:&quot;7387&quot;,&quot;last_activity_date&quot;:&quot;2015-03-18T11:56:50.403&quot;,&quot;last_edit_date&quot;:&quot;2020-06-17T08:14:45.997&quot;,&quot;last_editor_user_id&quot;:&quot;-1&quot;,&quot;owner_user_id&quot;:&quot;5750&quot;,&quot;parent_id&quot;:&quot;7342&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;現行の`ModelMetadata.FromLambdaExpression`の[ソース](http://referencesource.microsoft.com/#System.Web/ModelBinding/ModelMetadata.cs)の290行目で、\\n\\n```\\n\\n containerType = memberExpression.Expression.Type;\\n \\n```\\n\\nとコンテナ型を求めている箇所が`System.Web.Mvc.dll`のバージョン2.0.0.0では\\n\\n```\\n\\n containerType = body.Member.DeclaringType;\\n \\n```\\n\\nとなっているため、過去に不具合修正が入っているのだと思われます。\\n\\n## 拡張メソッドでの回避方法\\n\\n例えば`LabelFor`の場合、以下のように拡張メソッドを実装すれば`ModelMetadata.FromStringExpression`を利用します。なお拡張メソッドの利用には`web.config`の編集が必要です。\\n\\n```\\n\\n public static class HtmlHelperExtensions\\n {\\n public MvcHtmlString LabelFor2<TModel, TProperty>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression)\\n {\\n return html.Label(ExpressionHelper.GetExpressionText(expression));\\n }\\n }\\n \\n```\\n\\nこれでもダメであれば自分で`ModelMetadata`と`HtmlHelper`を作って`LabelForModel`に渡すか、自分でHTMLを作るしかないように思われます。\&quot;,\n \&quot;comment_count\&quot;: 6,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T13:32:09.280\&quot;,\n \&quot;id\&quot;: \&quot;7387\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-18T11:56:50.403\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2020-06-17T08:14:45.997\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;5750\&quot;,\n \&quot;parent_id\&quot;: \&quot;7342\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7342&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7387&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7387&quot;}}},{&quot;rowIdx&quot;:1684,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7348\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;Activityのフラグメントに`FragmentTabHost`を使ってリストフラグメントを入れ子にしたのですが、その入れ子にされたリストフラグメントから、Activityに情報を伝えることはできますか?\\nできるのであればその方法を教えて頂ければ嬉しいです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T02:27:52.540\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7344\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T03:43:33.243\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7232\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 0,\n \&quot;tags\&quot;: [\n \&quot;android\&quot;,\n \&quot;android-fragments\&quot;,\n \&quot;android-listfragment\&quot;\n ],\n \&quot;title\&quot;: \&quot;入れ子にしたフラグメントからActivityを操作する\&quot;,\n \&quot;view_count\&quot;: 527\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;子供の`ListFragment`の`getActivity()`を呼ぶと、FragmentがAttachされている`Activity`が取得できます。&quot;,&quot;comment_count&quot;:3,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T03:43:33.243&quot;,&quot;id&quot;:&quot;7348&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T03:43:33.243&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;845&quot;,&quot;parent_id&quot;:&quot;7344&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;子供の`ListFragment`の`getActivity()`を呼ぶと、FragmentがAttachされている`Activity`が取得できます。\&quot;,\n \&quot;comment_count\&quot;: 3,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T03:43:33.243\&quot;,\n \&quot;id\&quot;: \&quot;7348\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T03:43:33.243\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;845\&quot;,\n \&quot;parent_id\&quot;: \&quot;7344\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7344&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7348&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7348&quot;}}},{&quot;rowIdx&quot;:1685,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7354\&quot;,\n \&quot;answer_count\&quot;: 3,\n \&quot;body\&quot;: \&quot;Wiresharkのように、en0とen4を同時にキャプチャして1つのファイルとして出力する方法を模索しています。 \\nen0とen4を同時にキャプチャし、en0はモニターモードにすべく、下記のように書いてみました。\\n\\ntcpdump -Ini en0 -w WLAN.pcap -W1 -G30 &amp; tcpdump -i en4 -w LAN.pcap -W1 -G30 &amp;\\niperf -c 192.168.0.100 -i 1 -t30 -f m >> iperf.txt\\n\\nしかし、ファイルが別々になってしまう、という点で、期待する動作ではありません。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T03:01:35.243\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7346\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2022-04-13T04:52:25.030\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T06:35:24.260\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7590\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7590\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 0,\n \&quot;tags\&quot;: [\n \&quot;macos\&quot;,\n \&quot;tcpdump\&quot;,\n \&quot;wireshark\&quot;\n ],\n \&quot;title\&quot;: \&quot;en0とen4を同時にキャプチャして1つのファイルとして出力する方法\&quot;,\n \&quot;view_count\&quot;: 7431\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;WiresharkをインストールしてコマンドラインI/F(`tshark`)を使う\n\n`% tshark -i 1 2 -F pcap -w output.file`\n\n`-i` に指定するのはI/F名か`-D`を指定して得られるI/F一覧の番号\n\nもしくは、tcpdumpを2個動かして取得したファイルをWiresharkでマージする。GUIでやるほかにもmergecapというコマンドラインツールもあるようです。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T03:43:55.263&quot;,&quot;id&quot;:&quot;7349&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T03:43:55.263&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5793&quot;,&quot;parent_id&quot;:&quot;7346&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;## 追記\n\n回答後に、質問内容が編集され「en0はモニターモードに」という前提条件が追加されていますが、以下の方法はWi-\nFiインタフェースをモニターモードに設定するための `-I` オプションと併用することはできません。\n\n* * *\n\n`os-x` のタグが付いているので OS X 固有の回答です。\n\nOS X 10.9(Darwin 13.0)以降であれば、tcpdump を以下のように実行することで複数インタフェースをキャプチャできます。\n\n```\n\n $ sudo tcpdump -i pktap,en0,en4 -w mix.pcap\n \n```\n\nポイントは、`-i` オプションのインタフェース指定で、キャプチャしたい複数のインタフェースを `pktap`\nに続けてカンマ区切りで列挙することです。これで複数のインタフェースを同時にキャプチャできます。\n\nなお、OS X 付属の tcpdump のマニュアルに記載されているように、この機能は OS X(Darwin)固有の PKTAP\nという疑似インタフェースを利用しているため、他のOSでは使えません。\n\n> -i Listen on interface.\n>\n> If the -D flag is supported, an interface number as printed by that flag can\n> be used as the interface argument.\n>\n> On Darwin systems version 13 or later, when the interface is unspecified,\n> tcpdump will use a pseudo interface to capture packets on a set of\n> interfaces determined by the kernel (excludes by default loopback and tunnel\n> interfaces).\n>\n> Alternatively, to capture on more than one interface at a time, one may use\n> \&quot;pktap\&quot; as the interface parameter followed by an optional list of comma\n> separated interface names to include. For example, to capture on the\n> loopback and en0 interface:\n```\n\n> tcpdump -i pktap,lo0,en0\n> \n```\n\n>\n> An interface argument of \&quot;all\&quot; or \&quot;pktap,all\&quot; can be used to capture packets\n> from all interfaces, including loopback and tunnel interfaces.\n>\n> A pktap pseudo interface provides for packet metadata using the default\n> PKTAP data link type and files are written in the Pcap-ng file format. The\n> RAW data link type must be used to force to use the legacy pcap-savefile(5)\n> file format with a ptkap pseudo interface. Note that captures on a ptkap\n> pseudo interface will not be done in promiscuous mode.\n>\n> An interface argument of \&quot;iptap\&quot; can be used to capture packets from at the\n> IP layer. This capture packets as they are passed to the input and output\n> routines of the IPv4 and IPv6 protocol handlers of the networking stack.\n> Note that captures will not be done in promiscuous mode.\n>\n> On other OSes, if unspecified, tcpdump searches the system interface list\n> for the lowest numbered, configured up interface (excluding loopback). Ties\n> are broken by choosing the earliest match.\n>\n> On Linux systems with 2.2 or later kernels, an interface argument of \&quot;any\&quot;\n> can be used to capture packets from all interfaces. Note that captures on\n> the \&quot;any\&quot; device will not be done in promiscuous mode.&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T05:22:29.783&quot;,&quot;id&quot;:&quot;7354&quot;,&quot;last_activity_date&quot;:&quot;2015-03-04T02:00:58.087&quot;,&quot;last_edit_date&quot;:&quot;2020-06-17T08:14:45.997&quot;,&quot;last_editor_user_id&quot;:&quot;-1&quot;,&quot;owner_user_id&quot;:&quot;1024&quot;,&quot;parent_id&quot;:&quot;7346&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2},{&quot;body&quot;:&quot;以下ができるようになってます。\n\n```\n\n # tshark -i enp1s0f0 -i enp1s0f1\n Running as user \&quot;root\&quot; and group \&quot;root\&quot;. This could be dangerous.\n Capturing on 'enp1s0f0' and 'enp1s0f1'\n \n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 4.0&quot;,&quot;creation_date&quot;:&quot;2022-04-13T02:30:28.430&quot;,&quot;id&quot;:&quot;88311&quot;,&quot;last_activity_date&quot;:&quot;2022-04-13T04:52:25.030&quot;,&quot;last_edit_date&quot;:&quot;2022-04-13T04:52:25.030&quot;,&quot;last_editor_user_id&quot;:&quot;3060&quot;,&quot;owner_user_id&quot;:&quot;52203&quot;,&quot;parent_id&quot;:&quot;7346&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:0}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;WiresharkをインストールしてコマンドラインI/F(`tshark`)を使う\\n\\n`% tshark -i 1 2 -F pcap -w output.file`\\n\\n`-i` に指定するのはI/F名か`-D`を指定して得られるI/F一覧の番号\\n\\nもしくは、tcpdumpを2個動かして取得したファイルをWiresharkでマージする。GUIでやるほかにもmergecapというコマンドラインツールもあるようです。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T03:43:55.263\&quot;,\n \&quot;id\&quot;: \&quot;7349\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T03:43:55.263\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5793\&quot;,\n \&quot;parent_id\&quot;: \&quot;7346\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;## 追記\\n\\n回答後に、質問内容が編集され「en0はモニターモードに」という前提条件が追加されていますが、以下の方法はWi-\\nFiインタフェースをモニターモードに設定するための `-I` オプションと併用することはできません。\\n\\n* * *\\n\\n`os-x` のタグが付いているので OS X 固有の回答です。\\n\\nOS X 10.9(Darwin 13.0)以降であれば、tcpdump を以下のように実行することで複数インタフェースをキャプチャできます。\\n\\n```\\n\\n $ sudo tcpdump -i pktap,en0,en4 -w mix.pcap\\n \\n```\\n\\nポイントは、`-i` オプションのインタフェース指定で、キャプチャしたい複数のインタフェースを `pktap`\\nに続けてカンマ区切りで列挙することです。これで複数のインタフェースを同時にキャプチャできます。\\n\\nなお、OS X 付属の tcpdump のマニュアルに記載されているように、この機能は OS X(Darwin)固有の PKTAP\\nという疑似インタフェースを利用しているため、他のOSでは使えません。\\n\\n> -i Listen on interface.\\n>\\n> If the -D flag is supported, an interface number as printed by that flag can\\n> be used as the interface argument.\\n>\\n> On Darwin systems version 13 or later, when the interface is unspecified,\\n> tcpdump will use a pseudo interface to capture packets on a set of\\n> interfaces determined by the kernel (excludes by default loopback and tunnel\\n> interfaces).\\n>\\n> Alternatively, to capture on more than one interface at a time, one may use\\n> \\\&quot;pktap\\\&quot; as the interface parameter followed by an optional list of comma\\n> separated interface names to include. For example, to capture on the\\n> loopback and en0 interface:\\n```\\n\\n> tcpdump -i pktap,lo0,en0\\n> \\n```\\n\\n>\\n> An interface argument of \\\&quot;all\\\&quot; or \\\&quot;pktap,all\\\&quot; can be used to capture packets\\n> from all interfaces, including loopback and tunnel interfaces.\\n>\\n> A pktap pseudo interface provides for packet metadata using the default\\n> PKTAP data link type and files are written in the Pcap-ng file format. The\\n> RAW data link type must be used to force to use the legacy pcap-savefile(5)\\n> file format with a ptkap pseudo interface. Note that captures on a ptkap\\n> pseudo interface will not be done in promiscuous mode.\\n>\\n> An interface argument of \\\&quot;iptap\\\&quot; can be used to capture packets from at the\\n> IP layer. This capture packets as they are passed to the input and output\\n> routines of the IPv4 and IPv6 protocol handlers of the networking stack.\\n> Note that captures will not be done in promiscuous mode.\\n>\\n> On other OSes, if unspecified, tcpdump searches the system interface list\\n> for the lowest numbered, configured up interface (excluding loopback). Ties\\n> are broken by choosing the earliest match.\\n>\\n> On Linux systems with 2.2 or later kernels, an interface argument of \\\&quot;any\\\&quot;\\n> can be used to capture packets from all interfaces. Note that captures on\\n> the \\\&quot;any\\\&quot; device will not be done in promiscuous mode.\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T05:22:29.783\&quot;,\n \&quot;id\&quot;: \&quot;7354\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-04T02:00:58.087\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2020-06-17T08:14:45.997\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;1024\&quot;,\n \&quot;parent_id\&quot;: \&quot;7346\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n },\n {\n \&quot;body\&quot;: \&quot;以下ができるようになってます。\\n\\n```\\n\\n # tshark -i enp1s0f0 -i enp1s0f1\\n Running as user \\\&quot;root\\\&quot; and group \\\&quot;root\\\&quot;. This could be dangerous.\\n Capturing on 'enp1s0f0' and 'enp1s0f1'\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 4.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2022-04-13T02:30:28.430\&quot;,\n \&quot;id\&quot;: \&quot;88311\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2022-04-13T04:52:25.030\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2022-04-13T04:52:25.030\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;3060\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;52203\&quot;,\n \&quot;parent_id\&quot;: \&quot;7346\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 0\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7346&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7354&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7354&quot;}}},{&quot;rowIdx&quot;:1686,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7359\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;こんにちは\\n\\n[Detect if an Android app was downloaded from Google Play vs Amazon vs Other -\\nStack Overflow](https://stackoverflow.com/questions/15348671/detect-if-an-\\nandroid-app-was-downloaded-from-google-play-vs-amazon-vs-other)\\n\\n上記の記事のようにマーケットの判定を行いたいのですが`getInstallerPackageName`で`NULL`を返し、エラーになります。 \\n`getInstallerPackageName`でマーケット名を取得する方法をご教授お願いします。\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T03:23:52.320\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7347\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T05:50:21.403\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2017-05-23T12:38:55.250\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8649\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;android\&quot;\n ],\n \&quot;title\&quot;: \&quot;android マーケットの判定を行いたい\&quot;,\n \&quot;view_count\&quot;: 229\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;> リンク先の中に、ADBでインストールしたアプリの場合はnullになるとありますが、それではないでしょうか? – yuki 1 時間前\n\nADBで実行していたのが原因でした。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T05:50:21.403&quot;,&quot;id&quot;:&quot;7359&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T05:50:21.403&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8649&quot;,&quot;parent_id&quot;:&quot;7347&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;> リンク先の中に、ADBでインストールしたアプリの場合はnullになるとありますが、それではないでしょうか? – yuki 1 時間前\\n\\nADBで実行していたのが原因でした。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T05:50:21.403\&quot;,\n \&quot;id\&quot;: \&quot;7359\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T05:50:21.403\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8649\&quot;,\n \&quot;parent_id\&quot;: \&quot;7347\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7347&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7359&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7359&quot;}}},{&quot;rowIdx&quot;:1687,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7375\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;System.Windows.Controls.ContextMenuクラスをXAMLではなくC#のコードから生成しています。階層構造は以下のとおりで、カッコ内はバインドされたキーです。\\n\\nこのコンテキストメニューが開いた状態で、B→Aと押すとMenu2-1が実行されるようにしたいのですが、どのようにしたら良いのでしょうか。\\n\\n```\\n\\n ContextMenu\\n Menu1 (A)\\n Menu2 (B)\\n Menu2-1 (A)\\n Menu2-2 (B)\\n Menu3 (C)\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T03:50:56.847\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7350\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T08:55:26.680\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T04:56:30.927\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7722\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7722\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;c#\&quot;,\n \&quot;wpf\&quot;\n ],\n \&quot;title\&quot;: \&quot;階層構造を持ったコンテキストメニューをキーボードで操作する\&quot;,\n \&quot;view_count\&quot;: 1344\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;ご質問の意図として、\n\n 1. コンテキストメニューにアクセスキーを指定したい\n 2. コンテキストメニューにコマンドをバインドして実行したい\n\nのどちらなのか、意図を取りかねましたので分けてご回答いたします。 \n尚、前提として、\n\n```\n\n <Window x:Class=\&quot;WpfApplication2.MainWindow\&quot;\n xmlns=\&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation\&quot;\n xmlns:x=\&quot;http://schemas.microsoft.com/winfx/2006/xaml\&quot;\n Title=\&quot;MainWindow\&quot; Height=\&quot;350\&quot; Width=\&quot;525\&quot;/>\n \n```\n\nのような極めて単純なWindowを定義済みとご理解ください。\n\n## コンテキストメニューにアクセスキーを指定したい\n\nに関しては、ContextMenuの中に含ませるMenuItemのHeaderプロパティの中に、以下のように、アンダースコアに続いて、目的のキーを指定することで可能です。\n\n```\n\n var menuItem = new MenuItem {Header = \&quot;ファイル(_F)\&quot;};\n \n```\n\n## コンテキストメニューにコマンドをバインドして実行したい\n\nこの場合、Xamlではなく、CSharpにて定義したいとのことなので、MainWindowのCtorのタイミングでコンテキストメニューを生成して、MainWindowのコンテキストメニューとして登録するなら、以下のようなコードになるかと思います。\n\n```\n\n using System.Windows;\n using System.Windows.Controls;\n using System.Windows.Input;\n \n namespace WpfApplication2\n {\n /// <summary>\n /// MainWindow.xaml の相互作用ロジック\n /// </summary>\n public partial class MainWindow : Window\n {\n private static readonly ICommand ShowMessageCommand = new RoutedCommand(\&quot;ShowMessageCommand\&quot;, typeof (MenuItem));\n \n \n public MainWindow()\n {\n InitializeComponent();\n \n CommandBinding bind = new CommandBinding(ShowMessageCommand, ShowCommand);\n \n \n ContextMenu contextMenu = new ContextMenu();\n \n \n MenuItem menuItem = new MenuItem {Header = \&quot;A(_A)\&quot;, Command = ShowMessageCommand};\n menuItem.CommandBindings.Add(bind);\n contextMenu.Items.Add(menuItem);\n \n menuItem = new MenuItem {Header = \&quot;B(_B)\&quot;};\n \n MenuItem subItem = new MenuItem {Header = \&quot;A-A(_A)\&quot;, Command = ShowMessageCommand};\n subItem.CommandBindings.Add(bind);\n menuItem.Items.Add(subItem);\n \n subItem = new MenuItem {Header = \&quot;B-B(_B)\&quot;, Command = ShowMessageCommand};\n subItem.CommandBindings.Add(bind);\n menuItem.Items.Add(subItem);\n \n contextMenu.Items.Add(menuItem);\n \n \n menuItem = new MenuItem {Header = \&quot;C(_C)\&quot;, Command = ShowMessageCommand};\n menuItem.CommandBindings.Add(bind);\n contextMenu.Items.Add(menuItem);\n \n ContextMenu = contextMenu;\n }\n \n \n private void ShowCommand(object sender, ExecutedRoutedEventArgs e)\n {\n MenuItem item = sender as MenuItem;\n \n if (item != null)\n {\n MessageBox.Show(this, \&quot;コンテキストメニューの\\\&quot;\&quot; + item.Header + \&quot;\\\&quot;に対応するコマンドが実行されました。\&quot;);\n }\n }\n }\n \n```\n\n}\n\n上記サンプルでは、RoutedCommandを利用したCommandBindingを利用しておりますが、適宜そこは変更していただければと思います。 \nまた、蛇足ながら、コマンドではなく、特定のイベントに対応した処理をする場合は、MenuItemの当該イベントにイベントハンドラを登録すれば可能です。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T08:55:26.680&quot;,&quot;id&quot;:&quot;7375&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T08:55:26.680&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7287&quot;,&quot;parent_id&quot;:&quot;7350&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;ご質問の意図として、\\n\\n 1. コンテキストメニューにアクセスキーを指定したい\\n 2. コンテキストメニューにコマンドをバインドして実行したい\\n\\nのどちらなのか、意図を取りかねましたので分けてご回答いたします。 \\n尚、前提として、\\n\\n```\\n\\n <Window x:Class=\\\&quot;WpfApplication2.MainWindow\\\&quot;\\n xmlns=\\\&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation\\\&quot;\\n xmlns:x=\\\&quot;http://schemas.microsoft.com/winfx/2006/xaml\\\&quot;\\n Title=\\\&quot;MainWindow\\\&quot; Height=\\\&quot;350\\\&quot; Width=\\\&quot;525\\\&quot;/>\\n \\n```\\n\\nのような極めて単純なWindowを定義済みとご理解ください。\\n\\n## コンテキストメニューにアクセスキーを指定したい\\n\\nに関しては、ContextMenuの中に含ませるMenuItemのHeaderプロパティの中に、以下のように、アンダースコアに続いて、目的のキーを指定することで可能です。\\n\\n```\\n\\n var menuItem = new MenuItem {Header = \\\&quot;ファイル(_F)\\\&quot;};\\n \\n```\\n\\n## コンテキストメニューにコマンドをバインドして実行したい\\n\\nこの場合、Xamlではなく、CSharpにて定義したいとのことなので、MainWindowのCtorのタイミングでコンテキストメニューを生成して、MainWindowのコンテキストメニューとして登録するなら、以下のようなコードになるかと思います。\\n\\n```\\n\\n using System.Windows;\\n using System.Windows.Controls;\\n using System.Windows.Input;\\n \\n namespace WpfApplication2\\n {\\n /// <summary>\\n /// MainWindow.xaml の相互作用ロジック\\n /// </summary>\\n public partial class MainWindow : Window\\n {\\n private static readonly ICommand ShowMessageCommand = new RoutedCommand(\\\&quot;ShowMessageCommand\\\&quot;, typeof (MenuItem));\\n \\n \\n public MainWindow()\\n {\\n InitializeComponent();\\n \\n CommandBinding bind = new CommandBinding(ShowMessageCommand, ShowCommand);\\n \\n \\n ContextMenu contextMenu = new ContextMenu();\\n \\n \\n MenuItem menuItem = new MenuItem {Header = \\\&quot;A(_A)\\\&quot;, Command = ShowMessageCommand};\\n menuItem.CommandBindings.Add(bind);\\n contextMenu.Items.Add(menuItem);\\n \\n menuItem = new MenuItem {Header = \\\&quot;B(_B)\\\&quot;};\\n \\n MenuItem subItem = new MenuItem {Header = \\\&quot;A-A(_A)\\\&quot;, Command = ShowMessageCommand};\\n subItem.CommandBindings.Add(bind);\\n menuItem.Items.Add(subItem);\\n \\n subItem = new MenuItem {Header = \\\&quot;B-B(_B)\\\&quot;, Command = ShowMessageCommand};\\n subItem.CommandBindings.Add(bind);\\n menuItem.Items.Add(subItem);\\n \\n contextMenu.Items.Add(menuItem);\\n \\n \\n menuItem = new MenuItem {Header = \\\&quot;C(_C)\\\&quot;, Command = ShowMessageCommand};\\n menuItem.CommandBindings.Add(bind);\\n contextMenu.Items.Add(menuItem);\\n \\n ContextMenu = contextMenu;\\n }\\n \\n \\n private void ShowCommand(object sender, ExecutedRoutedEventArgs e)\\n {\\n MenuItem item = sender as MenuItem;\\n \\n if (item != null)\\n {\\n MessageBox.Show(this, \\\&quot;コンテキストメニューの\\\\\\\&quot;\\\&quot; + item.Header + \\\&quot;\\\\\\\&quot;に対応するコマンドが実行されました。\\\&quot;);\\n }\\n }\\n }\\n \\n```\\n\\n}\\n\\n上記サンプルでは、RoutedCommandを利用したCommandBindingを利用しておりますが、適宜そこは変更していただければと思います。 \\nまた、蛇足ながら、コマンドではなく、特定のイベントに対応した処理をする場合は、MenuItemの当該イベントにイベントハンドラを登録すれば可能です。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T08:55:26.680\&quot;,\n \&quot;id\&quot;: \&quot;7375\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T08:55:26.680\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7287\&quot;,\n \&quot;parent_id\&quot;: \&quot;7350\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7350&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7375&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7375&quot;}}},{&quot;rowIdx&quot;:1688,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7627\&quot;,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;PHP超初心者です。\\n\\n現在、問い合わせフォームを作っているのですが上手くいかない箇所があります。\\n\\n```\\n\\n function Conv2HtmlSpecialChars($value)\\n {\\n if (is_array($value)) {\\n foreach ($value as $k => $v) {\\n $value[$k] = Conv2HtmlSpecialChars($v);\\n }\\n } else {\\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\\n }\\n \\n return $value;\\n \\n }\\n \\n```\\n\\nという関数があります。\\n\\nそして、PHPファイルの中で、\\n\\n```\\n\\n $dataArray = Conv2HtmlSpecialChars($dataArray);\\n \\n```\\n\\nという使い方をします。\\n\\n上記の`$dataArray`という配列変数には、例えば、\\n\\n```\\n\\n $dataArray['氏名'] = \\\&quot;あいうえお\\\&quot;;\\n $dataArray['フリガナ'] = \\\&quot;アイウエオ\\\&quot;;\\n $dataArray['郵便番号'] = \\\&quot;999-9999\\\&quot;;\\n $dataArray['住所'] = \\\&quot;東京都大田区\\\&quot;;\\n $dataArray['E-mailアドレス'] = \\\&quot;test_test@example.com\\\&quot;;\\n $dataArray['お問い合わせ内容'] = \\\&quot;お尋ねしたいことがあります\\\&quot;;\\n \\n```\\n\\nがセットされているとします。\\n\\nそして実際に、PHPを動かしてみると・・・\\n\\n```\\n\\n $dataArray['氏名'] => \\\&quot;\\\&quot;\\n $dataArray['フリガナ'] => \\\&quot;\\\&quot;\\n $dataArray['郵便番号'] => \\\&quot;999-9999\\\&quot;\\n $dataArray['住所'] => \\\&quot;\\\&quot;\\n $dataArray['E-mailアドレス'] => \\\&quot;test_test@example.com\\\&quot;\\n $dataArray['お問い合わせ内容'] => \\\&quot;\\\&quot;\\n \\n```\\n\\nというように日本語の文字列が消えて、英数字だけしか残りません。\\n\\n```\\n\\n htmlentities($value, ENT_QUOTES, 'UTF-8');\\n \\n```\\n\\nでキチンと`UTF-8`を指定しているのに、なぜ日本語文字列が消えてしまうのでしょうか?\\n\\n原因をご存知の方、原因と適切な対処方法をご教授いただきたく存じます。 \\nもし、上記で私がチンプンカンプンなことを記述していたら、そこもご指定願います。\\n\\n**開発環境**\\n\\n * レンタルサーバー(CentOS 5)\\n * PHP(5.2.16)\\n * 作業環境(Windows7pro)\\n * PHP編集用(NoEditor)\\n\\nP.S. \\n他に誰も開発経験がなくPHPが分かる人が1人もいない中、何とか頑張っています。 \\n何卒、ご協力よろしくお願い致します。\\n\\n======================== 以下続報 ========================\\n\\n問題となっている`Conv2HtmlSpecialChars関数`に以下のようなデバッグを仕掛けました。\\n\\n```\\n\\n function Conv2HtmlSpecialChars($value)\\n {\\n \\n echo'<hr /><pre>fuction_Conv2HtmlSpecialChars_Start --> ';var_dump( $value );echo'</pre>';\\n \\n if (is_array($value)) {\\n foreach ($value as $k => $v) {\\n $value[$k] = Conv2HtmlSpecialChars($v);\\n }\\n } else {\\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\\n \\n echo'<hr /><pre>htmlentities_value --> ';var_dump( $value );echo'</pre>';\\n \\n }\\n \\n echo'<hr /><pre>fuction_Conv2HtmlSpecialChars_End --> ';var_dump( $value );echo'</pre>';\\n \\n return $value;\\n }\\n \\n```\\n\\nその結果、以下のように出力されました。 \\n※文字化けしている箇所は無視してください。\\n\\n```\\n\\n fuction_Conv2HtmlSpecialChars_Start --> array(9) {\\n [\\\&quot;羂���\\\&quot;]=>\\n string(10) \\\&quot;武田 進言\\\&quot;\\n [\\\&quot;��������\\\&quot;]=>\\n string(16) \\\&quot;タケダ シンゲン\\\&quot;\\n [\\\&quot;�灸梢���\\\&quot;]=>\\n string(8) \\\&quot;788-9999\\\&quot;\\n [\\\&quot;篏���\\\&quot;]=>\\n string(12) \\\&quot;東京都台東区\\\&quot;\\n [\\\&quot;�肢����\\\&quot;]=>\\n string(12) \\\&quot;03-9999-9999\\\&quot;\\n [\\\&quot;E-mail�≪������\\\&quot;]=>\\n string(21) \\\&quot;test-test@example.com\\\&quot;\\n [\\\&quot;E-mail�≪������(腆肴���)\\\&quot;]=>\\n string(21) \\\&quot;test-test@example.com\\\&quot;\\n [\\\&quot;��������������絎�\\\&quot;]=>\\n string(32) \\\&quot;テストコメント1テストコメント2\\\&quot;\\n [\\\&quot;date\\\&quot;]=>\\n string(27) \\\&quot;2015/03/03 Tuesday 23:59:29\\\&quot;\\n }\\n \\n fuction_Conv2HtmlSpecialChars_Start --> string(10) \\\&quot;武田 進言\\\&quot;\\n \\n htmlentities_value --> string(0) \\\&quot;\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_End --> string(0) \\\&quot;\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_Start --> string(16) \\\&quot;タケダ シンゲン\\\&quot;\\n \\n htmlentities_value --> string(0) \\\&quot;\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_End --> string(0) \\\&quot;\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_Start --> string(8) \\\&quot;788-9999\\\&quot;\\n \\n htmlentities_value --> string(8) \\\&quot;788-9999\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_End --> string(8) \\\&quot;788-9999\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_Start --> string(12) \\\&quot;東京都台東区\\\&quot;\\n \\n htmlentities_value --> string(0) \\\&quot;\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_End --> string(0) \\\&quot;\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_Start --> string(12) \\\&quot;03-9999-9999\\\&quot;\\n \\n htmlentities_value --> string(12) \\\&quot;03-9999-9999\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_End --> string(12) \\\&quot;03-9999-9999\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_Start --> string(21) \\\&quot;test-test@example.com\\\&quot;\\n \\n htmlentities_value --> string(21) \\\&quot;test-test@example.com\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_End --> string(21) \\\&quot;test-test@example.com\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_Start --> string(21) \\\&quot;test-test@example.com\\\&quot;\\n \\n htmlentities_value --> string(21) \\\&quot;test-test@example.com\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_End --> string(21) \\\&quot;test-test@example.com\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_Start --> string(32) \\\&quot;テストコメント1テストコメント2\\\&quot;\\n \\n htmlentities_value --> string(0) \\\&quot;\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_End --> string(0) \\\&quot;\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_Start --> string(27) \\\&quot;2015/03/03 Tuesday 23:59:29\\\&quot;\\n \\n htmlentities_value --> string(27) \\\&quot;2015/03/03 Tuesday 23:59:29\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_End --> string(27) \\\&quot;2015/03/03 Tuesday 23:59:29\\\&quot;\\n \\n fuction_Conv2HtmlSpecialChars_End --> array(9) {\\n [\\\&quot;羂���\\\&quot;]=>\\n string(0) \\\&quot;\\\&quot;\\n [\\\&quot;��������\\\&quot;]=>\\n string(0) \\\&quot;\\\&quot;\\n [\\\&quot;�灸梢���\\\&quot;]=>\\n string(8) \\\&quot;788-9999\\\&quot;\\n [\\\&quot;篏���\\\&quot;]=>\\n string(0) \\\&quot;\\\&quot;\\n [\\\&quot;�肢����\\\&quot;]=>\\n string(12) \\\&quot;03-9999-9999\\\&quot;\\n [\\\&quot;E-mail�≪������\\\&quot;]=>\\n string(21) \\\&quot;test-test@example.com\\\&quot;\\n [\\\&quot;E-mail�≪������(腆肴���)\\\&quot;]=>\\n string(21) \\\&quot;test-test@example.com\\\&quot;\\n [\\\&quot;��������������絎�\\\&quot;]=>\\n string(0) \\\&quot;\\\&quot;\\n [\\\&quot;date\\\&quot;]=>\\n string(27) \\\&quot;2015/03/03 Tuesday 23:59:29\\\&quot;\\n \\n```\\n\\nやはり、\\n\\n```\\n\\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\\n \\n```\\n\\nのロジックを通ると値が消えていって英数字のみ通過できるようです。\\n\\n何故このような動きになるのか、何かひらめいたことがあったらご教授ください。\\n\\n======================== 以下続報2(解決!) ========================\\n\\nコードを以下のようにしました。\\n\\n```\\n\\n function Conv2HtmlSpecialChars($value)\\n {\\n if (is_array($value)) {\\n foreach ($value as $k => $v) {\\n $value[$k] = Conv2HtmlSpecialChars($v);\\n }\\n } else {\\n \\n $value = mb_convert_encoding($value, 'UTF-8');\\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\\n \\n }\\n return $value;\\n }\\n \\n```\\n\\n要するに、\\n\\n`$value = htmlentities($value, ENT_QUOTES, 'UTF-8');`\\n\\nの関数で悩んでいたのですが、この関数すぐ上に、\\n\\n```\\n\\n $value = mb_convert_encoding($value, 'UTF-8');\\n \\n```\\n\\nを追加して値を`UTF-8`に変換するようにしました。\\n\\nこの方法が正しいかはよく分からないのですが、この方法で上手くロジックが動作するようになったので、結果オーライにしたいと思います。 \\nもう少しキレイにコードの記述方法をまとめられたらいいのですが、現在の私の力量ではこれが精一杯です。\&quot;,\n \&quot;comment_count\&quot;: 12,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T04:27:32.260\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7351\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-09T00:42:43.533\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-04T13:27:16.390\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7634\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7634\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;php\&quot;,\n \&quot;centos\&quot;\n ],\n \&quot;title\&quot;: \&quot;htmlentities関数を使うと、なぜ日本語文字列が消えてしまうのか?\&quot;,\n \&quot;view_count\&quot;: 6078\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;おそらく `$dataArray` に格納されたデータの文字コードが UTF-8 以外になっています。\n\n当方環境(CentOS6,PHP5.6)で確認したところ、文字コードが UTF-8 でないものを `htmlentities()`\nに通したら空文字となりました。 \n`htmlentities()`\nの[公式ドキュメント](http://php.net/manual/ja/function.htmlentities.php)を見てみると以下のように書いてありました。\n\n> 入力文字列の中に、指定した encoding で無効な符号単位シーケンスが含まれる場合は、 ENT_IGNORE あるいは \n> ENT_SUBSTITUTE フラグが設定されていない限りは空文字列を返します。\n\nただし、`ENT_IGNORE` 定数は `PHP5.3 から、`ENT_SUBSTITUTE` 定数は PHP5.4\nから使用可能ですので、Web_beginner さんの環境では使用できません。\n\nなので、`$dataArray` のデータ (POSTされたデータでしょうか?) を UTF-8 にすると、正常にデータとして変換できると思います。\n\n* * *\n\n## 補足\n\n検証に使ったコードは以下の通りです。 \n以下のコードは UTF-8 の文字エンコーディングで記述されています。\n\n```\n\n include dirname(__FILE__).DIRECTORY_SEPARATOR.'data.php';\n \n function Conv2HtmlSpecialChars( $value )\n {\n if (is_array($value)) {\n foreach ($value as $k => $v) {\n $value[$k] = Conv2HtmlSpecialChars($v);\n }\n } else {\n $value = htmlentities($value, ENT_QUOTES);\n }\n \n return $value;\n \n } \n var_dump( Conv2HtmlSpecialChars($dataArray) );\n \n```\n\ninclude で読み込んだ `data.php` に以下の定義がしてあります。 \n`data.php` の文字エンコーディングは Shift_JIS を指定しました。\n\n```\n\n $dataArray['氏名'] = \&quot;あいうえお\&quot;;\n $dataArray['フリガナ'] = \&quot;アイウエオ\&quot;;\n $dataArray['郵便番号'] = \&quot;999-9999\&quot;;\n $dataArray['住所'] = \&quot;東京都大田区\&quot;;\n $dataArray['E-mailアドレス'] = \&quot;test_test@example.com\&quot;;\n $dataArray['お問い合わせ内容'] = \&quot;お尋ねしたいことがあります\&quot;;\n \n```\n\n表示結果が、以下の通りです。 \n![文字が消えた再現のスクショ](https://i.stack.imgur.com/R8UD2.jpg)\n\ndata.php を UTF-8 に変換すると、ちゃんと表示されました。 \n![文字がちゃんと表示された再現のスクショ](https://i.stack.imgur.com/EdmES.jpg)\n\n* * *\n\n# 追記\n\nデバッグコード中の値を表示している箇所の一番最初の `Conv2HtmlSpecialChars_$v_Start` と、最後の\n`htmlentities_$value` の出力は配列ではない場合があります。\n\n`Conv2HtmlSpecialChars_$v_Start` は例でいえば \&quot;竹田 徹夜\&quot; だったり \&quot;222-3333\&quot; だったりするはずです。 \nまた、`htmlentities_$value` の値は `htmlentities()` からの返り値のはずなので、絶対に配列にはなりません。\n\nその為、誤った index のデータを表示しているような気がします。\n\nこのように配列か文字列か動的に変化してしまう変数を見る場合は \n`echo'<hr /><pre>Conv2HtmlSpecialChars_$v_Start --> ';var_dump( $value\n);echo'</pre>';` \nぐらいにしておいたほうが良いと思います。\n\n* * *\n\n追記2 :本回答のまとめとなります。\n\n当初回答したとおり、やはり文字化けが原因だと思われます。 \n文字化けした場合、場合によっては ASCII 制御コードなどが紛れ込んでしまう(誤って解釈されてしまう)\n可能性もあり、様々な意図しない挙動を示すことがあります。 \nなので、ここはまず文字化けしないように環境を整える必要があります。 \n(実際、私の環境では UTF-8 で揃えて以前つけたスクリーンショットのように正常にデータが表示・処理されておりますので)\n\n 1. HTML 上の form タグにて `accept-charset=\&quot;UTF-8\&quot;` を記述してみて頂けますでしょうか?\n 2. HTML の meta タグにて、`<meta http-equiv=\&quot;Content-Type\&quot; content=\&quot;text/html; charset=UTF-8\&quot; />` を指定してみてください。\n 3. PHP ファイル、HTML ファイル等、基本的にどんなファイルであれ UTF-8N (BOMなしです) で保存してください。\n 4. PHP の内部エンコーディングや出力エンコーディングを UTF-8 にしてください。 \n参考:[以前の質問 対処法 1. PHP\nの設定ファイルを変更する](https://ja.stackoverflow.com/a/7256/7926)をご覧ください\n\n以上となります。&quot;,&quot;comment_count&quot;:8,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T04:46:11.460&quot;,&quot;id&quot;:&quot;7353&quot;,&quot;last_activity_date&quot;:&quot;2015-03-04T01:38:37.660&quot;,&quot;last_edit_date&quot;:&quot;2017-04-13T12:52:38.920&quot;,&quot;last_editor_user_id&quot;:&quot;-1&quot;,&quot;owner_user_id&quot;:&quot;7926&quot;,&quot;parent_id&quot;:&quot;7351&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:4},{&quot;body&quot;:&quot;自己解決をしたので、質問に追記した内容のコピペになりますが、以下の通り報告します。\n\nコードを以下のようにしました。\n\n```\n\n function Conv2HtmlSpecialChars($value)\n {\n if (is_array($value)) {\n foreach ($value as $k => $v) {\n $value[$k] = Conv2HtmlSpecialChars($v);\n }\n } else {\n \n $value = mb_convert_encoding($value, 'UTF-8');\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\n \n }\n return $value;\n }\n \n```\n\n要するに、\n\n```\n\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\n \n```\n\nの関数で悩んでいたのですが、この関数すぐ上に、\n\n```\n\n $value = mb_convert_encoding($value, 'UTF-8');\n \n```\n\nを追加して値を`UTF-8`に変換するようにしました。\n\nこの方法が正しいかはよく分からないのですが、この方法で上手くロジックが動作するようになったので、結果オーライにしたいと思います。 \nもう少しキレイにコードの記述方法をまとめられたらいいのですが、現在の私の力量ではこれが精一杯です。\n\n------------------ その後の見解 ------------------ \nPHP.iniというのがあるのを知ったのですが、これを・・・\n\n```\n\n mbstring.language=Japanese\n mbstring.internal_encoding=\&quot;UTF-8\&quot;\n mbstring.http_output=\&quot;UTF-8\&quot;\n \n```\n\nというように設定しておけば済む話だったようです。 \nなんともむなしい独り相撲でした。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-09T00:42:43.533&quot;,&quot;id&quot;:&quot;7627&quot;,&quot;last_activity_date&quot;:&quot;2015-03-09T00:42:43.533&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7634&quot;,&quot;parent_id&quot;:&quot;7351&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;おそらく `$dataArray` に格納されたデータの文字コードが UTF-8 以外になっています。\\n\\n当方環境(CentOS6,PHP5.6)で確認したところ、文字コードが UTF-8 でないものを `htmlentities()`\\nに通したら空文字となりました。 \\n`htmlentities()`\\nの[公式ドキュメント](http://php.net/manual/ja/function.htmlentities.php)を見てみると以下のように書いてありました。\\n\\n> 入力文字列の中に、指定した encoding で無効な符号単位シーケンスが含まれる場合は、 ENT_IGNORE あるいは \\n> ENT_SUBSTITUTE フラグが設定されていない限りは空文字列を返します。\\n\\nただし、`ENT_IGNORE` 定数は `PHP5.3 から、`ENT_SUBSTITUTE` 定数は PHP5.4\\nから使用可能ですので、Web_beginner さんの環境では使用できません。\\n\\nなので、`$dataArray` のデータ (POSTされたデータでしょうか?) を UTF-8 にすると、正常にデータとして変換できると思います。\\n\\n* * *\\n\\n## 補足\\n\\n検証に使ったコードは以下の通りです。 \\n以下のコードは UTF-8 の文字エンコーディングで記述されています。\\n\\n```\\n\\n include dirname(__FILE__).DIRECTORY_SEPARATOR.'data.php';\\n \\n function Conv2HtmlSpecialChars( $value )\\n {\\n if (is_array($value)) {\\n foreach ($value as $k => $v) {\\n $value[$k] = Conv2HtmlSpecialChars($v);\\n }\\n } else {\\n $value = htmlentities($value, ENT_QUOTES);\\n }\\n \\n return $value;\\n \\n } \\n var_dump( Conv2HtmlSpecialChars($dataArray) );\\n \\n```\\n\\ninclude で読み込んだ `data.php` に以下の定義がしてあります。 \\n`data.php` の文字エンコーディングは Shift_JIS を指定しました。\\n\\n```\\n\\n $dataArray['氏名'] = \\\&quot;あいうえお\\\&quot;;\\n $dataArray['フリガナ'] = \\\&quot;アイウエオ\\\&quot;;\\n $dataArray['郵便番号'] = \\\&quot;999-9999\\\&quot;;\\n $dataArray['住所'] = \\\&quot;東京都大田区\\\&quot;;\\n $dataArray['E-mailアドレス'] = \\\&quot;test_test@example.com\\\&quot;;\\n $dataArray['お問い合わせ内容'] = \\\&quot;お尋ねしたいことがあります\\\&quot;;\\n \\n```\\n\\n表示結果が、以下の通りです。 \\n![文字が消えた再現のスクショ](https://i.stack.imgur.com/R8UD2.jpg)\\n\\ndata.php を UTF-8 に変換すると、ちゃんと表示されました。 \\n![文字がちゃんと表示された再現のスクショ](https://i.stack.imgur.com/EdmES.jpg)\\n\\n* * *\\n\\n# 追記\\n\\nデバッグコード中の値を表示している箇所の一番最初の `Conv2HtmlSpecialChars_$v_Start` と、最後の\\n`htmlentities_$value` の出力は配列ではない場合があります。\\n\\n`Conv2HtmlSpecialChars_$v_Start` は例でいえば \\\&quot;竹田 徹夜\\\&quot; だったり \\\&quot;222-3333\\\&quot; だったりするはずです。 \\nまた、`htmlentities_$value` の値は `htmlentities()` からの返り値のはずなので、絶対に配列にはなりません。\\n\\nその為、誤った index のデータを表示しているような気がします。\\n\\nこのように配列か文字列か動的に変化してしまう変数を見る場合は \\n`echo'<hr /><pre>Conv2HtmlSpecialChars_$v_Start --> ';var_dump( $value\\n);echo'</pre>';` \\nぐらいにしておいたほうが良いと思います。\\n\\n* * *\\n\\n追記2 :本回答のまとめとなります。\\n\\n当初回答したとおり、やはり文字化けが原因だと思われます。 \\n文字化けした場合、場合によっては ASCII 制御コードなどが紛れ込んでしまう(誤って解釈されてしまう)\\n可能性もあり、様々な意図しない挙動を示すことがあります。 \\nなので、ここはまず文字化けしないように環境を整える必要があります。 \\n(実際、私の環境では UTF-8 で揃えて以前つけたスクリーンショットのように正常にデータが表示・処理されておりますので)\\n\\n 1. HTML 上の form タグにて `accept-charset=\\\&quot;UTF-8\\\&quot;` を記述してみて頂けますでしょうか?\\n 2. HTML の meta タグにて、`<meta http-equiv=\\\&quot;Content-Type\\\&quot; content=\\\&quot;text/html; charset=UTF-8\\\&quot; />` を指定してみてください。\\n 3. PHP ファイル、HTML ファイル等、基本的にどんなファイルであれ UTF-8N (BOMなしです) で保存してください。\\n 4. PHP の内部エンコーディングや出力エンコーディングを UTF-8 にしてください。 \\n参考:[以前の質問 対処法 1. PHP\\nの設定ファイルを変更する](https://ja.stackoverflow.com/a/7256/7926)をご覧ください\\n\\n以上となります。\&quot;,\n \&quot;comment_count\&quot;: 8,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T04:46:11.460\&quot;,\n \&quot;id\&quot;: \&quot;7353\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-04T01:38:37.660\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2017-04-13T12:52:38.920\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;parent_id\&quot;: \&quot;7351\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 4\n },\n {\n \&quot;body\&quot;: \&quot;自己解決をしたので、質問に追記した内容のコピペになりますが、以下の通り報告します。\\n\\nコードを以下のようにしました。\\n\\n```\\n\\n function Conv2HtmlSpecialChars($value)\\n {\\n if (is_array($value)) {\\n foreach ($value as $k => $v) {\\n $value[$k] = Conv2HtmlSpecialChars($v);\\n }\\n } else {\\n \\n $value = mb_convert_encoding($value, 'UTF-8');\\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\\n \\n }\\n return $value;\\n }\\n \\n```\\n\\n要するに、\\n\\n```\\n\\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\\n \\n```\\n\\nの関数で悩んでいたのですが、この関数すぐ上に、\\n\\n```\\n\\n $value = mb_convert_encoding($value, 'UTF-8');\\n \\n```\\n\\nを追加して値を`UTF-8`に変換するようにしました。\\n\\nこの方法が正しいかはよく分からないのですが、この方法で上手くロジックが動作するようになったので、結果オーライにしたいと思います。 \\nもう少しキレイにコードの記述方法をまとめられたらいいのですが、現在の私の力量ではこれが精一杯です。\\n\\n------------------ その後の見解 ------------------ \\nPHP.iniというのがあるのを知ったのですが、これを・・・\\n\\n```\\n\\n mbstring.language=Japanese\\n mbstring.internal_encoding=\\\&quot;UTF-8\\\&quot;\\n mbstring.http_output=\\\&quot;UTF-8\\\&quot;\\n \\n```\\n\\nというように設定しておけば済む話だったようです。 \\nなんともむなしい独り相撲でした。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-09T00:42:43.533\&quot;,\n \&quot;id\&quot;: \&quot;7627\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-09T00:42:43.533\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7634\&quot;,\n \&quot;parent_id\&quot;: \&quot;7351\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7351&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7627&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7353&quot;}}},{&quot;rowIdx&quot;:1689,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7358\&quot;,\n \&quot;answer_count\&quot;: 3,\n \&quot;body\&quot;: \&quot;あるコードで\\n\\n```\\n\\n var a:Int = _\\n \\n```\\n\\nという感じのものを見たのですが、どういう意味(定義)なんでしょうか? \\n実際には 0 がはいるみたいですが。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T05:31:26.840\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7355\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T06:40:34.197\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T06:27:07.777\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;3466\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;3466\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;scala\&quot;\n ],\n \&quot;title\&quot;: \&quot;アンダースコアを代入する( var a:Int = _ )の意味(定義)は?\&quot;,\n \&quot;view_count\&quot;: 691\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;初期値(デフォルト値)が入ります。Intなら0ですがStringならnull, Booleanならfalseです。\n\n```\n\n var a:Int = _\n a: Int = 0\n \n var a:String = _\n a: String = null\n \n var a:Boolean = _\n a: Boolean = false\n \n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T05:37:09.753&quot;,&quot;id&quot;:&quot;7356&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T05:58:48.607&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T05:58:48.607&quot;,&quot;last_editor_user_id&quot;:&quot;56&quot;,&quot;owner_user_id&quot;:&quot;8335&quot;,&quot;parent_id&quot;:&quot;7355&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:0},{&quot;body&quot;:&quot;`_` によって初期値を表し、その変数が未定義であることを防ぐことができます。\n\n[参考](http://www.atmarkit.co.jp/ait/articles/1203/02/news118.html)&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T05:40:07.023&quot;,&quot;id&quot;:&quot;7357&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T06:10:50.650&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T06:10:50.650&quot;,&quot;last_editor_user_id&quot;:&quot;7926&quot;,&quot;owner_user_id&quot;:&quot;7926&quot;,&quot;parent_id&quot;:&quot;7355&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:0},{&quot;body&quot;:&quot;[言語仕様のVariable Declarations and Definitions](http://www.scala-\nlang.org/files/archive/spec/2.11/04-basic-declarations-and-\ndefinitions.html#variable-declarations-and-definitions \&quot;Variable Declarations\nand Definitions\&quot;)によれば、型によって\n\n * Int -- 0\n * Long -- 0L\n * Float -- 0.0f\n * Double -- 0.0d\n * Boolean -- false\n * Unit -- ()\n * 他の型 -- null\n\nがそれぞれ代入されます。\n\n動作は 0 などを代入した場合と同じです。\n\n次のコードをコンパイルして\n\n```\n\n class A1 {\n var i: Int = _\n var l: Long = _\n var f: Float = _\n var d: Double = _\n var b: Boolean = _\n var u: Unit = _\n var o: AnyRef = _\n }\n \n class A2 {\n var i: Int = 0\n var l: Long = 0L\n var f: Float = 0.0f\n var d: Double = 0.0d\n var b: Boolean = false\n var u: Unit = ()\n var o: AnyRef = null\n }\n \n```\n\njavap -c でコンストラクタみてみると A1 は\n\n```\n\n public A1();\n Code:\n 0: aload_0\n 1: invokespecial #63 // Method java/lang/Object.\&quot;<init>\&quot;:()V\n 4: return\n \n```\n\nと代入が行われていないのに対し、A2 は\n\n```\n\n public A2();\n Code:\n 0: aload_0\n 1: invokespecial #63 // Method java/lang/Object.\&quot;<init>\&quot;:()V\n 4: aload_0\n 5: iconst_0\n 6: putfield #25 // Field i:I\n 9: aload_0\n 10: lconst_0\n 11: putfield #33 // Field l:J\n // 以下代入が続く\n \n```\n\nというように代入が行われます。\n\nバイトコード上は代入が行われず、[Java言語仕様の初期値](https://docs.oracle.com/javase/specs/jls/se5.0/html/typesValues.html#4.12.5\n\&quot;Initial Values of Variables\&quot;) がそのまま利用されるようです。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T05:42:00.730&quot;,&quot;id&quot;:&quot;7358&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T06:40:34.197&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T06:40:34.197&quot;,&quot;last_editor_user_id&quot;:&quot;455&quot;,&quot;owner_user_id&quot;:&quot;455&quot;,&quot;parent_id&quot;:&quot;7355&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;初期値(デフォルト値)が入ります。Intなら0ですがStringならnull, Booleanならfalseです。\\n\\n```\\n\\n var a:Int = _\\n a: Int = 0\\n \\n var a:String = _\\n a: String = null\\n \\n var a:Boolean = _\\n a: Boolean = false\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T05:37:09.753\&quot;,\n \&quot;id\&quot;: \&quot;7356\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T05:58:48.607\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T05:58:48.607\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;56\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8335\&quot;,\n \&quot;parent_id\&quot;: \&quot;7355\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 0\n },\n {\n \&quot;body\&quot;: \&quot;`_` によって初期値を表し、その変数が未定義であることを防ぐことができます。\\n\\n[参考](http://www.atmarkit.co.jp/ait/articles/1203/02/news118.html)\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T05:40:07.023\&quot;,\n \&quot;id\&quot;: \&quot;7357\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T06:10:50.650\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T06:10:50.650\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;parent_id\&quot;: \&quot;7355\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 0\n },\n {\n \&quot;body\&quot;: \&quot;[言語仕様のVariable Declarations and Definitions](http://www.scala-\\nlang.org/files/archive/spec/2.11/04-basic-declarations-and-\\ndefinitions.html#variable-declarations-and-definitions \\\&quot;Variable Declarations\\nand Definitions\\\&quot;)によれば、型によって\\n\\n * Int -- 0\\n * Long -- 0L\\n * Float -- 0.0f\\n * Double -- 0.0d\\n * Boolean -- false\\n * Unit -- ()\\n * 他の型 -- null\\n\\nがそれぞれ代入されます。\\n\\n動作は 0 などを代入した場合と同じです。\\n\\n次のコードをコンパイルして\\n\\n```\\n\\n class A1 {\\n var i: Int = _\\n var l: Long = _\\n var f: Float = _\\n var d: Double = _\\n var b: Boolean = _\\n var u: Unit = _\\n var o: AnyRef = _\\n }\\n \\n class A2 {\\n var i: Int = 0\\n var l: Long = 0L\\n var f: Float = 0.0f\\n var d: Double = 0.0d\\n var b: Boolean = false\\n var u: Unit = ()\\n var o: AnyRef = null\\n }\\n \\n```\\n\\njavap -c でコンストラクタみてみると A1 は\\n\\n```\\n\\n public A1();\\n Code:\\n 0: aload_0\\n 1: invokespecial #63 // Method java/lang/Object.\\\&quot;<init>\\\&quot;:()V\\n 4: return\\n \\n```\\n\\nと代入が行われていないのに対し、A2 は\\n\\n```\\n\\n public A2();\\n Code:\\n 0: aload_0\\n 1: invokespecial #63 // Method java/lang/Object.\\\&quot;<init>\\\&quot;:()V\\n 4: aload_0\\n 5: iconst_0\\n 6: putfield #25 // Field i:I\\n 9: aload_0\\n 10: lconst_0\\n 11: putfield #33 // Field l:J\\n // 以下代入が続く\\n \\n```\\n\\nというように代入が行われます。\\n\\nバイトコード上は代入が行われず、[Java言語仕様の初期値](https://docs.oracle.com/javase/specs/jls/se5.0/html/typesValues.html#4.12.5\\n\\\&quot;Initial Values of Variables\\\&quot;) がそのまま利用されるようです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T05:42:00.730\&quot;,\n \&quot;id\&quot;: \&quot;7358\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T06:40:34.197\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T06:40:34.197\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;455\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;455\&quot;,\n \&quot;parent_id\&quot;: \&quot;7355\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7355&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7358&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7358&quot;}}},{&quot;rowIdx&quot;:1690,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;android5.0以降でDownloadListenerが呼ばれないのですが原因は何でしょうか? \\n何か対策はありますでしょうか?\\n\\nGmailの添付ファイルをクリックした時だけ呼ばれていないみたいです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T06:23:05.577\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7362\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-08-03T08:32:26.043\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-06T05:51:12.640\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8567\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8567\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;android\&quot;,\n \&quot;java\&quot;,\n \&quot;webview\&quot;\n ],\n \&quot;title\&quot;: \&quot;WebViewのDownloadListenerについて\&quot;,\n \&quot;view_count\&quot;: 427\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;onDownloadListener というインターフェースはないので、そこが間違っていると思います。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T09:18:14.050&quot;,&quot;id&quot;:&quot;7378&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T09:18:14.050&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7256&quot;,&quot;parent_id&quot;:&quot;7362&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;onDownloadListener というインターフェースはないので、そこが間違っていると思います。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T09:18:14.050\&quot;,\n \&quot;id\&quot;: \&quot;7378\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T09:18:14.050\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7256\&quot;,\n \&quot;parent_id\&quot;: \&quot;7362\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7362&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7378&quot;}}},{&quot;rowIdx&quot;:1691,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;Win8タブレットにおいて、縦スクロールバーが発生しているウィンドウをスワイプすることによってスクロールを端まで送ると、ウィンドウ自体が跳ね返る(何かにぶつかった?)ようなリアクションを取ります。\\n\\nこれが鬱陶しく感じてしまったため、開発中のアプリケーション(.Net4.5環境/WPF)では無効に出来るならしたいと考えております。 \\n<https://msdn.microsoft.com/ja-jp/library/ie/hh920761%28v=vs.85%29.aspx> \\nの方にcssで制御可能な項目として\\n\\n> スクロールされた領域が端に達したときに跳ね返る\\n\\nとされていたのですがWPF、もしくはWindowsフォームにおいてこの機能を与えることは可能なのでしょうか?\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T06:51:35.953\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7363\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-06T08:44:23.697\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;6051\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;c#\&quot;,\n \&quot;wpf\&quot;,\n \&quot;winforms\&quot;\n ],\n \&quot;title\&quot;: \&quot;Win8タブレットのスクロールをスワイプしたときの跳ね返りの無効化\&quot;,\n \&quot;view_count\&quot;: 3173\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;端的に言うと`WndProc`で`WM_GESTURE`を無視すれば「[境界域フィードバック](https://msdn.microsoft.com/ja-\njp/library/windows/desktop/dd371416%28v=vs.85%29.aspx)」は発生しません。しかしこれだけでは全てのジェスチャが無効になってしまうので、`lParam`から`GESTUREINFO`構造体を取得して状態を確認する必要があります。\n\np/invoke.netに`GESTUREINFO`の定義が無かったので試していませんが、[MSDN](https://msdn.microsoft.com/ja-\njp/library/windows/desktop/dd562167%28v=vs.85%29.aspx)によると`GID_PAN`や`GF_BEGIN`を確認すれば判定可能のようです。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T12:24:15.527&quot;,&quot;id&quot;:&quot;7385&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T12:24:15.527&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;5750&quot;,&quot;parent_id&quot;:&quot;7363&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;単にバウンドするエフェクトを無効化してしまいたいのであれば、WPFの場合、ListBox等のManipulationBoundaryFeedbackイベントをハンドルするのが一番手っ取り早いと思われます。\n\n```\n\n public partial class MainWindow : Window\n {\n public MainWindow()\n {\n InitializeComponent();\n \n list1.ManipulationBoundaryFeedback += list1_ManipulationBoundaryFeedback;\n }\n \n void list1_ManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)\n {\n e.Handled = true;\n }\n }\n \n```\n\n参考: \nUIElement.ManipulationBoundaryFeedback イベント (System.Windows) \n<https://msdn.microsoft.com/ja-\njp/library/system.windows.uielement.manipulationboundaryfeedback.aspx> \n連載:WPF入門:第10回 WPFの「入力イベントとアニメーション」を学ぼう (1/2) - @IT \n<http://www.atmarkit.co.jp/ait/articles/1103/01/news124.html>&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-06T08:44:23.697&quot;,&quot;id&quot;:&quot;7543&quot;,&quot;last_activity_date&quot;:&quot;2015-03-06T08:44:23.697&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;2947&quot;,&quot;parent_id&quot;:&quot;7363&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;端的に言うと`WndProc`で`WM_GESTURE`を無視すれば「[境界域フィードバック](https://msdn.microsoft.com/ja-\\njp/library/windows/desktop/dd371416%28v=vs.85%29.aspx)」は発生しません。しかしこれだけでは全てのジェスチャが無効になってしまうので、`lParam`から`GESTUREINFO`構造体を取得して状態を確認する必要があります。\\n\\np/invoke.netに`GESTUREINFO`の定義が無かったので試していませんが、[MSDN](https://msdn.microsoft.com/ja-\\njp/library/windows/desktop/dd562167%28v=vs.85%29.aspx)によると`GID_PAN`や`GF_BEGIN`を確認すれば判定可能のようです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T12:24:15.527\&quot;,\n \&quot;id\&quot;: \&quot;7385\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T12:24:15.527\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;5750\&quot;,\n \&quot;parent_id\&quot;: \&quot;7363\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;単にバウンドするエフェクトを無効化してしまいたいのであれば、WPFの場合、ListBox等のManipulationBoundaryFeedbackイベントをハンドルするのが一番手っ取り早いと思われます。\\n\\n```\\n\\n public partial class MainWindow : Window\\n {\\n public MainWindow()\\n {\\n InitializeComponent();\\n \\n list1.ManipulationBoundaryFeedback += list1_ManipulationBoundaryFeedback;\\n }\\n \\n void list1_ManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)\\n {\\n e.Handled = true;\\n }\\n }\\n \\n```\\n\\n参考: \\nUIElement.ManipulationBoundaryFeedback イベント (System.Windows) \\n<https://msdn.microsoft.com/ja-\\njp/library/system.windows.uielement.manipulationboundaryfeedback.aspx> \\n連載:WPF入門:第10回 WPFの「入力イベントとアニメーション」を学ぼう (1/2) - @IT \\n<http://www.atmarkit.co.jp/ait/articles/1103/01/news124.html>\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-06T08:44:23.697\&quot;,\n \&quot;id\&quot;: \&quot;7543\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-06T08:44:23.697\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;2947\&quot;,\n \&quot;parent_id\&quot;: \&quot;7363\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7363&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7543&quot;}}},{&quot;rowIdx&quot;:1692,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7373\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;XcodeでiTunes Connectへアプリケーションを提出する際、Valideの段階で次のエラーが表示されました。\\n\\n> this bundle is invalid. \\n> apps that include arm64 architecture cannot have Minimum OSversion set to\\n> less than 5.1.1. \\n> more information about 64-bit support for iOS is available at 64-bit\\n> transition guide for cocoa touch at developer.apple.com.\\n\\nSDKはiOS 8.1、Deployment Targetは5.0です。\\n\\n64bitアーキテクチャ(iPhone 5s以降)とiOS 5向けに同時に対応することはできないのでしょうか?\\n\\nこれはiTunesConnectへ提出時のエラーです。\\nxocdeのメニューのproductでarchiveでビルドし、そのあとに提出用のダイアログ(organizer)が表示され、そこでvalidationを押した時のチェックでエラーになりまし‌​た。\\nその前までは各種シュミレータやデバイスのテストで同様のエラーは出ていません。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T07:33:56.480\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7364\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T08:58:17.610\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T08:48:14.880\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;3496\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;3496\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;ios\&quot;,\n \&quot;xcode\&quot;,\n \&quot;iphone\&quot;\n ],\n \&quot;title\&quot;: \&quot;iOSのArchivesビルド後のvalidationでエラー。arm64とiOS5は同時にサポートできない?\&quot;,\n \&quot;view_count\&quot;: 1685\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;arm64を削除する手段が2015年2月までは合ったようですが、 \n現在その方法が通用するかどうかという問題と、arm64を削除すると当然ながら実機iPhone6などでは動作しません。 \nそれでは困るので、仕方ないのでメッセージの指示通りにGeneralの設定のDeployment\nTargetを「5.1.1」に指定(自分で書いた)しました。これでvalidationは通りました。\n\n![画像の説明をここに入力](https://i.stack.imgur.com/wtrkg.png)\n\n参考情報: [About 64-Bit Cocoa Touch\nApps](https://developer.apple.com/library/ios/documentation/General/Conceptual/CocoaTouch64BitGuide/Introduction/Introduction.html)([日本語版PDF](https://developer.apple.com/jp/documentation/CocoaTouch64BitGuide.pdf))\n\n> Xcode 5.0.1では、32ビット/64ビットのどちらにも対応したアプリケーションを構築できます。ただし、この混成バイナリが動作するのはiOS\n> 5.1.1以降です。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T08:46:54.333&quot;,&quot;id&quot;:&quot;7373&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T08:58:17.610&quot;,&quot;last_edit_date&quot;:&quot;2015-03-03T08:58:17.610&quot;,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;3496&quot;,&quot;parent_id&quot;:&quot;7364&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;arm64を削除する手段が2015年2月までは合ったようですが、 \\n現在その方法が通用するかどうかという問題と、arm64を削除すると当然ながら実機iPhone6などでは動作しません。 \\nそれでは困るので、仕方ないのでメッセージの指示通りにGeneralの設定のDeployment\\nTargetを「5.1.1」に指定(自分で書いた)しました。これでvalidationは通りました。\\n\\n![画像の説明をここに入力](https://i.stack.imgur.com/wtrkg.png)\\n\\n参考情報: [About 64-Bit Cocoa Touch\\nApps](https://developer.apple.com/library/ios/documentation/General/Conceptual/CocoaTouch64BitGuide/Introduction/Introduction.html)([日本語版PDF](https://developer.apple.com/jp/documentation/CocoaTouch64BitGuide.pdf))\\n\\n> Xcode 5.0.1では、32ビット/64ビットのどちらにも対応したアプリケーションを構築できます。ただし、この混成バイナリが動作するのはiOS\\n> 5.1.1以降です。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T08:46:54.333\&quot;,\n \&quot;id\&quot;: \&quot;7373\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T08:58:17.610\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-03T08:58:17.610\&quot;,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;3496\&quot;,\n \&quot;parent_id\&quot;: \&quot;7364\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7364&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7373&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7373&quot;}}},{&quot;rowIdx&quot;:1693,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 4,\n \&quot;body\&quot;: \&quot;JavaScriptで変数に入っている値が文字列か文字列の配列かによって処理を分けたいです。 \\n厳密に配列の中身が文字列であるかどうかまではチェックしなくて良いです。\\n\\n```\\n\\n var stringOrArray = someFunc();\\n \\n if (argumentIsString(stringOrArray)) {\\n // 文字列が渡された時の処理\\n \\n } else if (argumentIsArray(stringOrArray)) {\\n // 配列が渡された時の処理\\n \\n }\\n \\n```\\n\\n上記`argumentIsString`, `argumentIsArray`にあたる処理はどのようになりますか? \\nどちらか片方がわかればもう片方は `else` でも良いですが、できれば今後の変更を見据えて文字列・配列それぞれの判定をしたいです。\\n\\nちなみにIE8以上の対応が必要です。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T07:46:47.997\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7365\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-04T01:13:36.623\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;450\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 4,\n \&quot;tags\&quot;: [\n \&quot;javascript\&quot;\n ],\n \&quot;title\&quot;: \&quot;StringかArrayかを判定したい\&quot;,\n \&quot;view_count\&quot;: 3601\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;こちらが参考になると思います。 \n[JavaScript Garden](http://bonsaiden.github.io/JavaScript-\nGarden/#types.typeof) \n[日本語訳](http://bonsaiden.github.io/JavaScript-Garden/ja/#types.typeof)\n\n```\n\n function is(type, obj) {\n var clas = Object.prototype.toString.call(obj).slice(8, -1);\n return obj !== undefined &amp;&amp; obj !== null &amp;&amp; clas === type;\n }\n \n is('String', 'test'); // true\n is('String', new String('test')); // true\n \n```&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T08:00:05.240&quot;,&quot;id&quot;:&quot;7367&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T08:00:05.240&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7926&quot;,&quot;parent_id&quot;:&quot;7365&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:5},{&quot;body&quot;:&quot;本家に同様の質問がありました \n<https://stackoverflow.com/questions/1058427/how-to-detect-if-a-variable-is-\nan-array>\n\n`Array.isArray`ってIE8で使えるのかな。。。?&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T08:01:15.853&quot;,&quot;id&quot;:&quot;7368&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T08:01:15.853&quot;,&quot;last_edit_date&quot;:&quot;2017-05-23T12:38:55.307&quot;,&quot;last_editor_user_id&quot;:&quot;-1&quot;,&quot;owner_user_id&quot;:&quot;845&quot;,&quot;parent_id&quot;:&quot;7365&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:0},{&quot;body&quot;:&quot;あんまり汎用性はありませんが、 \nお手軽にするならこうでしょうか?\n\n```\n\n var stringOrArray = someFunc();\n \n if (typeof(stringOrArray) == \&quot;string\&quot; || stringOrArray instanceof String) {\n // 文字列が渡された時の処理\n } else if (stringOrArray instanceof Array) {\n // 配列が渡された時の処理\n }\n \n```\n\n[追記]\n\n既に他の回答のコメントで言及されていますが、 \nArrayやStringそのものを上書きされてしまった場合、この方法は破綻します。 \n方法は極めて単純で、判定前に\n\n```\n\n /* fooやbarの中身は適当 */\n String = foo\n Array = bar\n \n```\n\nと書かれた場合はアウトとなります。&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T08:06:20.477&quot;,&quot;id&quot;:&quot;7369&quot;,&quot;last_activity_date&quot;:&quot;2015-03-04T01:13:36.623&quot;,&quot;last_edit_date&quot;:&quot;2015-03-04T01:13:36.623&quot;,&quot;last_editor_user_id&quot;:&quot;70&quot;,&quot;owner_user_id&quot;:&quot;70&quot;,&quot;parent_id&quot;:&quot;7365&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3},{&quot;body&quot;:&quot;ちょっと変わった方向として [underscore.js\nのソース](https://github.com/jashkenas/underscore/blob/044ba5c3502dfac26c1a863a62c518b91e2a255d/underscore.js#L1210-L1215)\nを見ると、`Object.prototype.toString.call(v)` して、返ってきた文字列を比較してますね。\n\n```\n\n Object.prototype.toString.call(obj) === '[object Array]'\n \n Object.prototype.toString.call(obj) === '[object String]'\n \n```\n\n# なんでこうするんだろ… `instanceof` だけで十分に思うけれども&quot;,&quot;comment_count&quot;:2,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T16:16:27.737&quot;,&quot;id&quot;:&quot;7393&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T16:16:27.737&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;208&quot;,&quot;parent_id&quot;:&quot;7365&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;こちらが参考になると思います。 \\n[JavaScript Garden](http://bonsaiden.github.io/JavaScript-\\nGarden/#types.typeof) \\n[日本語訳](http://bonsaiden.github.io/JavaScript-Garden/ja/#types.typeof)\\n\\n```\\n\\n function is(type, obj) {\\n var clas = Object.prototype.toString.call(obj).slice(8, -1);\\n return obj !== undefined &amp;&amp; obj !== null &amp;&amp; clas === type;\\n }\\n \\n is('String', 'test'); // true\\n is('String', new String('test')); // true\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T08:00:05.240\&quot;,\n \&quot;id\&quot;: \&quot;7367\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T08:00:05.240\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7926\&quot;,\n \&quot;parent_id\&quot;: \&quot;7365\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 5\n },\n {\n \&quot;body\&quot;: \&quot;本家に同様の質問がありました \\n<https://stackoverflow.com/questions/1058427/how-to-detect-if-a-variable-is-\\nan-array>\\n\\n`Array.isArray`ってIE8で使えるのかな。。。?\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T08:01:15.853\&quot;,\n \&quot;id\&quot;: \&quot;7368\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T08:01:15.853\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2017-05-23T12:38:55.307\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;845\&quot;,\n \&quot;parent_id\&quot;: \&quot;7365\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 0\n },\n {\n \&quot;body\&quot;: \&quot;あんまり汎用性はありませんが、 \\nお手軽にするならこうでしょうか?\\n\\n```\\n\\n var stringOrArray = someFunc();\\n \\n if (typeof(stringOrArray) == \\\&quot;string\\\&quot; || stringOrArray instanceof String) {\\n // 文字列が渡された時の処理\\n } else if (stringOrArray instanceof Array) {\\n // 配列が渡された時の処理\\n }\\n \\n```\\n\\n[追記]\\n\\n既に他の回答のコメントで言及されていますが、 \\nArrayやStringそのものを上書きされてしまった場合、この方法は破綻します。 \\n方法は極めて単純で、判定前に\\n\\n```\\n\\n /* fooやbarの中身は適当 */\\n String = foo\\n Array = bar\\n \\n```\\n\\nと書かれた場合はアウトとなります。\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T08:06:20.477\&quot;,\n \&quot;id\&quot;: \&quot;7369\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-04T01:13:36.623\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-04T01:13:36.623\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;70\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;70\&quot;,\n \&quot;parent_id\&quot;: \&quot;7365\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n },\n {\n \&quot;body\&quot;: \&quot;ちょっと変わった方向として [underscore.js\\nのソース](https://github.com/jashkenas/underscore/blob/044ba5c3502dfac26c1a863a62c518b91e2a255d/underscore.js#L1210-L1215)\\nを見ると、`Object.prototype.toString.call(v)` して、返ってきた文字列を比較してますね。\\n\\n```\\n\\n Object.prototype.toString.call(obj) === '[object Array]'\\n \\n Object.prototype.toString.call(obj) === '[object String]'\\n \\n```\\n\\n# なんでこうするんだろ… `instanceof` だけで十分に思うけれども\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T16:16:27.737\&quot;,\n \&quot;id\&quot;: \&quot;7393\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T16:16:27.737\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;208\&quot;,\n \&quot;parent_id\&quot;: \&quot;7365\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7365&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7367&quot;}}},{&quot;rowIdx&quot;:1694,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;monacaでiosアプリを開発しています。 \\nホームボタンを押してもバックグラウンドでアプリが動いた状態になっている様で、 \\n再度アプリに戻ると、進行中だったゲームの画面に戻り、BGMも再送されます。\\n\\nホームボタンを押したらバックグラウンドに回らずにアプリを終了するようにするには、 \\nどうすればよいのでしょうか?\\n\\nxcodeの場合、UIApplicationExitsOnSuspend を Info.plist に設定すると、 \\nアプリが終了するようにできるようなのですが、monacaの場合どうすればよいかわかりません。 \\n参考: <http://d.hatena.ne.jp/paraches/20100715>\\n\\nCordovaのpause resumeで処理を書いてみましたが、うまくいきません。\\n\\nCordovaのイベント処理 \\n<http://docs.monaca.mobi/cur/ja/reference/phonegap_34/ja/events/events/#backbutton>\\n\\n解決方法を教えていただけると助かります。 \\nよろしくお願いいたします。\\n\\niosではうまくいかなかったが、Androidのみだとうまくいった方法を下記に記します。\\n\\n// ホームボタンを押すとBGMが停止し、再度アプリに戻ると再送する\\n\\n```\\n\\n document.addEventListener(\\\&quot;pause\\\&quot;, function() { audio.pause(); },false);\\n document.addEventListener(\\\&quot;resume\\\&quot;, function() { audio.play(); },false);\\n \\n```\\n\\n// ホームボタンを押すとバックグラウンドに回らずにアプリが終了\\n\\n```\\n\\n document.addEventListener(\\\&quot;pause\\\&quot;, onPause, false);\\n \\n function onPause() {\\n navigator.app.exitApp();\\n }\\n \\n```\\n\\n// バックボタンを押すとバックグラウンドに回らずにアプリが終了\\n\\n```\\n\\n document.addEventListener(\\\&quot;backbutton\\\&quot;, function(e){\\n e.preventDefault();\\n navigator.app.exitApp();\\n }, false);\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T07:52:39.890\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7366\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-07-09T16:34:12.170\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-04T10:05:49.660\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8053\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8053\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 3,\n \&quot;tags\&quot;: [\n \&quot;javascript\&quot;,\n \&quot;ios\&quot;,\n \&quot;monaca\&quot;,\n \&quot;html5\&quot;,\n \&quot;cordova\&quot;\n ],\n \&quot;title\&quot;: \&quot;ホームボタンを押したらアプリが終了するようにしたいです\&quot;,\n \&quot;view_count\&quot;: 4135\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;MonacaやCordovaではiOSでアプリを終了させるAPIは提供されていないようですので、自分でCordovaプラグインを書いて対応する必要があると思います。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-11T06:11:00.277&quot;,&quot;id&quot;:&quot;7761&quot;,&quot;last_activity_date&quot;:&quot;2015-03-11T06:11:00.277&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7871&quot;,&quot;parent_id&quot;:&quot;7366&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3},{&quot;body&quot;:&quot;iosの場合プログラムによるアプリの強制終了はリジェクト対象になる可能性があります。アプリを終了させるのではなくゲームやBGMを止める程度にするべきです。\n\n<http://ushisantoasobu.hateblo.jp/entry/2013/02/17/185403>&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-06-09T12:38:50.167&quot;,&quot;id&quot;:&quot;11189&quot;,&quot;last_activity_date&quot;:&quot;2015-06-09T12:38:50.167&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;9577&quot;,&quot;parent_id&quot;:&quot;7366&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:4}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;MonacaやCordovaではiOSでアプリを終了させるAPIは提供されていないようですので、自分でCordovaプラグインを書いて対応する必要があると思います。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-11T06:11:00.277\&quot;,\n \&quot;id\&quot;: \&quot;7761\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-11T06:11:00.277\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7871\&quot;,\n \&quot;parent_id\&quot;: \&quot;7366\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n },\n {\n \&quot;body\&quot;: \&quot;iosの場合プログラムによるアプリの強制終了はリジェクト対象になる可能性があります。アプリを終了させるのではなくゲームやBGMを止める程度にするべきです。\\n\\n<http://ushisantoasobu.hateblo.jp/entry/2013/02/17/185403>\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-06-09T12:38:50.167\&quot;,\n \&quot;id\&quot;: \&quot;11189\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-06-09T12:38:50.167\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;9577\&quot;,\n \&quot;parent_id\&quot;: \&quot;7366\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 4\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7366&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;11189&quot;}}},{&quot;rowIdx&quot;:1695,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7507\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;CentOS7 + Juno をpackstackでインストールを行いました。 \\n構成は、コントローラーノード(neutronを含む)1台、コンピュートノード2台で行っています。 \\nはじめにコントローラーノード台 + コンピュートノード1台の構成で行ったところ、 \\nインストールから、インスタンスの起動、FloatingIPの割り当てまですべてうまくいきました。\\n\\n続いて、コンピュートノードを一台増設しようと思い、 \\nanswerファイルの`CONFIG_COMPUTE_HOSTS`にIPアドレスを設定し、 \\nすでに構築済みの一台につきましては、`EXCLUDE_SERVERS`へ退避を致しました。\\n\\nこの状態で、`packstack`コマンドを実行し、インストールもうまくいったのですが、 \\nインスタンスの起動ができなくなってしまいました。\\n\\nコントローラー、コンピュートノードでログを確認すると、\\n\\n```\\n\\n NovaException: Unexpected vif_type=binding_failed\\n \\n```\\n\\nというエラーメッセージが各コンピュートノードで返ってきており起動にしているみたいです。\\n\\nお忙しいところ申し訳ございませんが、 \\nもし、お時間があればご教授頂ければ幸いです。\\n\\n### 追記\\n\\n$ neutron agent-list -F host -F agent_type \\n+--------------------+--------------------------+ \\n| agent_type | host | \\n+--------------------+--------------------------+ \\n| Open vSwitch agent | openstack.controller | \\n| L3 agent | openstack.controller | \\n| Open vSwitch agent | openstack.compute001 | \\n| DHCP agent | openstack.controller | \\n| Metadata agent | openstack.controller | \\n+--------------------+--------------------------+\\n\\ncomputeノードがもう一台稼働しているはずなのですが、 \\nここに出てこないのはおかしいですか?\\n\\n## 追記\\n\\nOpen vSwitch agentはコンピュートノードにおいて動作しておりましたが、 \\nagent-listでは表示されていません。 \\n動作はしているが、コントローラーが知らないという状況なのでしょうか....\\n\\n## 追記\\n\\n現状の設定ファイルです。\\n\\n<https://gist.github.com/tomomura/39a006413c6b390aefdd#file-gistfile2-txt>\&quot;,\n \&quot;comment_count\&quot;: 8,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T08:25:05.957\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7371\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-06T00:16:58.320\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-05T04:14:57.777\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;8652\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8652\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;centos\&quot;\n ],\n \&quot;title\&quot;: \&quot;[RDO]OpenStack構築後のインスタンス起動失敗について\&quot;,\n \&quot;view_count\&quot;: 2120\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;自己解決できました。\n\n原因は、サーバ間の時間の同期ができていなかった為です。\n\nNTPサーバを用意して、各サーバ間の時間を同期させたところ正常に動作しました。\n\nありがとうございました。&quot;,&quot;comment_count&quot;:1,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-06T00:16:58.320&quot;,&quot;id&quot;:&quot;7507&quot;,&quot;last_activity_date&quot;:&quot;2015-03-06T00:16:58.320&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8652&quot;,&quot;parent_id&quot;:&quot;7371&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:2}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;自己解決できました。\\n\\n原因は、サーバ間の時間の同期ができていなかった為です。\\n\\nNTPサーバを用意して、各サーバ間の時間を同期させたところ正常に動作しました。\\n\\nありがとうございました。\&quot;,\n \&quot;comment_count\&quot;: 1,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-06T00:16:58.320\&quot;,\n \&quot;id\&quot;: \&quot;7507\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-06T00:16:58.320\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8652\&quot;,\n \&quot;parent_id\&quot;: \&quot;7371\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 2\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7371&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7507&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7507&quot;}}},{&quot;rowIdx&quot;:1696,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;InterfaceBuilderでxibファイルを「iphone-4inch」(width:320px,height:568px)でUIViewを作りました。そのViewをViewControllerでaddSubViewするのですが、どの端末でシミュレートしても4インチのサイズです。画面に合わせるにはどうすればよいでしょうか。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T08:35:47.690\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7372\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T09:23:11.010\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8060\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 0,\n \&quot;tags\&quot;: [\n \&quot;ios\&quot;,\n \&quot;xib\&quot;\n ],\n \&quot;title\&quot;: \&quot;xibファイルのViewを画面サイズに合わせるには\&quot;,\n \&quot;view_count\&quot;: 3271\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;画面全体で良いのなら、\n\n```\n\n subView.frame = self.view.frame;\n [self.view addSubView:subView];\n \n```\n\nで大丈夫だと思います。 \nsubView内のコンテンツはAutoLayoutを設定しておけば、見た目も崩れないと思います。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T09:23:11.010&quot;,&quot;id&quot;:&quot;7379&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T09:23:11.010&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;3516&quot;,&quot;parent_id&quot;:&quot;7372&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;画面全体で良いのなら、\\n\\n```\\n\\n subView.frame = self.view.frame;\\n [self.view addSubView:subView];\\n \\n```\\n\\nで大丈夫だと思います。 \\nsubView内のコンテンツはAutoLayoutを設定しておけば、見た目も崩れないと思います。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T09:23:11.010\&quot;,\n \&quot;id\&quot;: \&quot;7379\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T09:23:11.010\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;3516\&quot;,\n \&quot;parent_id\&quot;: \&quot;7372\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7372&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7379&quot;}}},{&quot;rowIdx&quot;:1697,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: \&quot;7388\&quot;,\n \&quot;answer_count\&quot;: 1,\n \&quot;body\&quot;: \&quot;例えば、ページ内に\\n\\n```\\n\\n あいうえお\\n 単語\\n かきくけこ\\n 単語\\n \\n```\\n\\nとあった場合、capybaraで\\n\\n```\\n\\n expect(page).to have_content('単語')\\n \\n```\\n\\nとした場合、マッチしますがこの'単語'の数をテストすることは可能でしょうか?\\n\\n自分の場合、ひとつの'単語'のみ含まれていてほしいというようにしたいです。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T09:13:24.650\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7377\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T13:52:54.627\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;4971\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;ruby-on-rails\&quot;,\n \&quot;capybara\&quot;\n ],\n \&quot;title\&quot;: \&quot;capybaraのhave_contentなどで、含まれていてほしい単語の数を指定したい。\&quot;,\n \&quot;view_count\&quot;: 2526\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;`expect(page).to have_content('単語', count: 1)`\n\nでいかがでしょうか?\n\nhave_xxx には引数が渡せるようです。\n\n[capybara/matchers.rb at master ·\njnicklas/capybara](https://github.com/jnicklas/capybara/blob/master/lib/capybara/node/matchers.rb#L432-L449)\n\n下記に一部を抜粋します。\n\n```\n\n # @option options [Integer] :count (nil) Number of times the text is expected to occur\n # @option options [Integer] :minimum (nil) Minimum number of times the text is expected to occur\n # @option options [Integer] :maximum (nil) Maximum number of times the text is expected to occur\n # @option options [Range] :between (nil) Range of times that is expected to contain number of times text occurs\n \n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T13:52:54.627&quot;,&quot;id&quot;:&quot;7388&quot;,&quot;last_activity_date&quot;:&quot;2015-03-03T13:52:54.627&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;7471&quot;,&quot;parent_id&quot;:&quot;7377&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;`expect(page).to have_content('単語', count: 1)`\\n\\nでいかがでしょうか?\\n\\nhave_xxx には引数が渡せるようです。\\n\\n[capybara/matchers.rb at master ·\\njnicklas/capybara](https://github.com/jnicklas/capybara/blob/master/lib/capybara/node/matchers.rb#L432-L449)\\n\\n下記に一部を抜粋します。\\n\\n```\\n\\n # @option options [Integer] :count (nil) Number of times the text is expected to occur\\n # @option options [Integer] :minimum (nil) Minimum number of times the text is expected to occur\\n # @option options [Integer] :maximum (nil) Maximum number of times the text is expected to occur\\n # @option options [Range] :between (nil) Range of times that is expected to contain number of times text occurs\\n \\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T13:52:54.627\&quot;,\n \&quot;id\&quot;: \&quot;7388\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-03T13:52:54.627\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;7471\&quot;,\n \&quot;parent_id\&quot;: \&quot;7377\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7377&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7388&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7388&quot;}}},{&quot;rowIdx&quot;:1698,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;`[data-value=\\\&quot;1\\\&quot;]`のような要素の属性値によるセレクターでスタイルを指定しているのですが、IE8 (IE Tester使用)\\nで見た時に初期状態は正しく表示されるのですが、JavaScriptからDOMの属性値を変更した際に表示が更新されません。 \\n下記に簡単なサンプルを記載します。ボタンを押すたびに`data-\\nvalue`属性が変わり、`Hello`の背景色が変わるはずです(IE9以降、Chrome、Firefox等では)。\\n\\nボタンの上からマウスを外した際に遅れて表示が更新されるようなので、単に画面の再描画ができていないというだけの不具合だと思われるのですが、この現象への対処法(属性値を変更した際にすぐ画面に反映する)をご存知の方がいましたら教えてください。\\n\\n```\\n\\n var val=0;\\r\\n $('#btn').click(function(){\\r\\n val = (val + 1) % 4;\\r\\n $('#aaa').attr('data-value', val);\\r\\n });\\n```\\n\\n```\\n\\n [data-value=\\\&quot;0\\\&quot;]{\\r\\n background:cyan;\\r\\n }\\r\\n [data-value=\\\&quot;1\\\&quot;]{\\r\\n background:red;\\r\\n }\\r\\n [data-value=\\\&quot;2\\\&quot;]{\\r\\n background:green;\\r\\n }\\r\\n [data-value=\\\&quot;3\\\&quot;]{\\r\\n background:blue;\\r\\n }\\n```\\n\\n```\\n\\n <script src=\\\&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\\\&quot;></script>\\r\\n <div id=\\\&quot;aaa\\\&quot; data-value=\\\&quot;0\\\&quot;>Hello</div>\\r\\n <button id=\\\&quot;btn\\\&quot;>push</button>\\n```\&quot;,\n \&quot;comment_count\&quot;: 2,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T12:06:30.930\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7384\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-05T00:34:22.413\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;450\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 1,\n \&quot;tags\&quot;: [\n \&quot;javascript\&quot;,\n \&quot;css\&quot;,\n \&quot;internet-explorer\&quot;\n ],\n \&quot;title\&quot;: \&quot;IE8で[attribute=\\\&quot;value\\\&quot;]セレクターを使用した際に、DOMの属性の変更が画面が反映されない\&quot;,\n \&quot;view_count\&quot;: 1109\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;どうもブラウザ起因の動きのようです。 \n`css()`による色変更なら動きました。\n\n```\n\n var val=0;\r\n $('#btn').click(function(){\r\n val = (val + 1) % 4;\r\n var color = \&quot;\&quot;;\r\n switch(val){\r\n case 0: color = \&quot;cyan\&quot;; break;\r\n case 1: color = \&quot;red\&quot;; break;\r\n case 2: color = \&quot;green\&quot;; break;\r\n case 3: color = \&quot;blue\&quot;; break;\r\n }\r\n $('#aaa').css({'background': color});\r\n });\n```\n\n```\n\n #aaa{\r\n background:cyan;\r\n }\n```\n\n```\n\n <script src=\&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\&quot;></script>\r\n \r\n <div id=\&quot;aaa\&quot; data-value=\&quot;0\&quot;>Hello</div>\r\n <button id=\&quot;btn\&quot;>push</button>\n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-04T01:22:56.683&quot;,&quot;id&quot;:&quot;7401&quot;,&quot;last_activity_date&quot;:&quot;2015-03-05T00:34:22.413&quot;,&quot;last_edit_date&quot;:&quot;2015-03-05T00:34:22.413&quot;,&quot;last_editor_user_id&quot;:&quot;7214&quot;,&quot;owner_user_id&quot;:&quot;7214&quot;,&quot;parent_id&quot;:&quot;7384&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1},{&quot;body&quot;:&quot;本家 Stack Overflow の回答によれば、適当なCSSプロパティや class を再設定することで反映させることができるようです。\n\n[javascript - IE8 not refreshing class after attribute value change - Stack\nOverflow](https://stackoverflow.com/a/14222646/2818869)\n\n上の回答のように opacity でやるとこんな感じかと。IE11 の IE8 モードでは動作しました。\n\n```\n\n var val=0;\r\n $('#btn').click(function(){\r\n val = (val + 1) % 4;\r\n $('#aaa').attr('data-value', val).css('opacity', 1);\r\n });\n```\n\n```\n\n [data-value=\&quot;0\&quot;]{\r\n background:cyan;\r\n }\r\n [data-value=\&quot;1\&quot;]{\r\n background:red;\r\n }\r\n [data-value=\&quot;2\&quot;]{\r\n background:green;\r\n }\r\n [data-value=\&quot;3\&quot;]{\r\n background:blue;\r\n }\n```\n\n```\n\n <script src=\&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\&quot;></script>\r\n <div id=\&quot;aaa\&quot; data-value=\&quot;0\&quot;>Hello</div>\r\n <button id=\&quot;btn\&quot;>push</button>\n```&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-04T05:31:00.280&quot;,&quot;id&quot;:&quot;7417&quot;,&quot;last_activity_date&quot;:&quot;2015-03-04T05:31:00.280&quot;,&quot;last_edit_date&quot;:&quot;2017-05-23T12:38:55.250&quot;,&quot;last_editor_user_id&quot;:&quot;-1&quot;,&quot;owner_user_id&quot;:&quot;8000&quot;,&quot;parent_id&quot;:&quot;7384&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;どうもブラウザ起因の動きのようです。 \\n`css()`による色変更なら動きました。\\n\\n```\\n\\n var val=0;\\r\\n $('#btn').click(function(){\\r\\n val = (val + 1) % 4;\\r\\n var color = \\\&quot;\\\&quot;;\\r\\n switch(val){\\r\\n case 0: color = \\\&quot;cyan\\\&quot;; break;\\r\\n case 1: color = \\\&quot;red\\\&quot;; break;\\r\\n case 2: color = \\\&quot;green\\\&quot;; break;\\r\\n case 3: color = \\\&quot;blue\\\&quot;; break;\\r\\n }\\r\\n $('#aaa').css({'background': color});\\r\\n });\\n```\\n\\n```\\n\\n #aaa{\\r\\n background:cyan;\\r\\n }\\n```\\n\\n```\\n\\n <script src=\\\&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\\\&quot;></script>\\r\\n \\r\\n <div id=\\\&quot;aaa\\\&quot; data-value=\\\&quot;0\\\&quot;>Hello</div>\\r\\n <button id=\\\&quot;btn\\\&quot;>push</button>\\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-04T01:22:56.683\&quot;,\n \&quot;id\&quot;: \&quot;7401\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-05T00:34:22.413\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2015-03-05T00:34:22.413\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;7214\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;7214\&quot;,\n \&quot;parent_id\&quot;: \&quot;7384\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n },\n {\n \&quot;body\&quot;: \&quot;本家 Stack Overflow の回答によれば、適当なCSSプロパティや class を再設定することで反映させることができるようです。\\n\\n[javascript - IE8 not refreshing class after attribute value change - Stack\\nOverflow](https://stackoverflow.com/a/14222646/2818869)\\n\\n上の回答のように opacity でやるとこんな感じかと。IE11 の IE8 モードでは動作しました。\\n\\n```\\n\\n var val=0;\\r\\n $('#btn').click(function(){\\r\\n val = (val + 1) % 4;\\r\\n $('#aaa').attr('data-value', val).css('opacity', 1);\\r\\n });\\n```\\n\\n```\\n\\n [data-value=\\\&quot;0\\\&quot;]{\\r\\n background:cyan;\\r\\n }\\r\\n [data-value=\\\&quot;1\\\&quot;]{\\r\\n background:red;\\r\\n }\\r\\n [data-value=\\\&quot;2\\\&quot;]{\\r\\n background:green;\\r\\n }\\r\\n [data-value=\\\&quot;3\\\&quot;]{\\r\\n background:blue;\\r\\n }\\n```\\n\\n```\\n\\n <script src=\\\&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\\\&quot;></script>\\r\\n <div id=\\\&quot;aaa\\\&quot; data-value=\\\&quot;0\\\&quot;>Hello</div>\\r\\n <button id=\\\&quot;btn\\\&quot;>push</button>\\n```\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-04T05:31:00.280\&quot;,\n \&quot;id\&quot;: \&quot;7417\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-04T05:31:00.280\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2017-05-23T12:38:55.250\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;-1\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8000\&quot;,\n \&quot;parent_id\&quot;: \&quot;7384\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7384&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7417&quot;}}},{&quot;rowIdx&quot;:1699,&quot;cells&quot;:{&quot;question&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;{\n \&quot;accepted_answer_id\&quot;: null,\n \&quot;answer_count\&quot;: 2,\n \&quot;body\&quot;: \&quot;googleのurl検索で'http://'や'https://'を検索する方法はありますか?\\n\\n`inurl:http://`として検索をかけたいのですが。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T12:28:17.473\&quot;,\n \&quot;favorite_count\&quot;: 0,\n \&quot;id\&quot;: \&quot;7386\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2019-12-01T02:15:18.317\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2019-12-01T02:15:18.317\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;32986\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;5855\&quot;,\n \&quot;post_type\&quot;: \&quot;question\&quot;,\n \&quot;score\&quot;: 2,\n \&quot;tags\&quot;: [\n \&quot;google-search\&quot;\n ],\n \&quot;title\&quot;: \&quot;googleで'http://'や'https://'を検索する方法\&quot;,\n \&quot;view_count\&quot;: 287\n}&quot;},&quot;answers&quot;:{&quot;kind&quot;:&quot;list like&quot;,&quot;value&quot;:[{&quot;body&quot;:&quot;もし、`http`のサイトだけ検索したの場合には、\n\n```\n\n -\&quot;https://\&quot;\n \n```\n\nを使えば結構です。\n\n例えばhttpのFacebookを検索すると、こう成ります: \n[facebook\n-\&quot;https://\&quot;](https://www.google.co.jp/#q=facebook+-%22https:%2F%2F%22)&quot;,&quot;comment_count&quot;:3,&quot;content_license&quot;:&quot;CC BY-SA 4.0&quot;,&quot;creation_date&quot;:&quot;2015-03-03T19:43:56.210&quot;,&quot;id&quot;:&quot;7396&quot;,&quot;last_activity_date&quot;:&quot;2019-12-01T02:15:07.800&quot;,&quot;last_edit_date&quot;:&quot;2019-12-01T02:15:07.800&quot;,&quot;last_editor_user_id&quot;:&quot;32986&quot;,&quot;owner_user_id&quot;:&quot;8229&quot;,&quot;parent_id&quot;:&quot;7386&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:3},{&quot;body&quot;:&quot;これでどうだろう?\n\n```\n\n allinurl:https://* または allinurl:http://*\n \n```\n\nうーん。ページの後ろのほうになると「allinurlを無視した結果が必要かもしれない」とクエリオプションを無視した結果がでてきますね……。\n\nクエリオプションを無視した結果が出てくるのは、もはやどうすることも出来ないような……。&quot;,&quot;comment_count&quot;:0,&quot;content_license&quot;:&quot;CC BY-SA 3.0&quot;,&quot;creation_date&quot;:&quot;2015-03-04T09:15:41.177&quot;,&quot;id&quot;:&quot;7435&quot;,&quot;last_activity_date&quot;:&quot;2015-03-04T09:15:41.177&quot;,&quot;last_edit_date&quot;:null,&quot;last_editor_user_id&quot;:null,&quot;owner_user_id&quot;:&quot;8335&quot;,&quot;parent_id&quot;:&quot;7386&quot;,&quot;post_type&quot;:&quot;answer&quot;,&quot;score&quot;:1}],&quot;string&quot;:&quot;[\n {\n \&quot;body\&quot;: \&quot;もし、`http`のサイトだけ検索したの場合には、\\n\\n```\\n\\n -\\\&quot;https://\\\&quot;\\n \\n```\\n\\nを使えば結構です。\\n\\n例えばhttpのFacebookを検索すると、こう成ります: \\n[facebook\\n-\\\&quot;https://\\\&quot;](https://www.google.co.jp/#q=facebook+-%22https:%2F%2F%22)\&quot;,\n \&quot;comment_count\&quot;: 3,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 4.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-03T19:43:56.210\&quot;,\n \&quot;id\&quot;: \&quot;7396\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2019-12-01T02:15:07.800\&quot;,\n \&quot;last_edit_date\&quot;: \&quot;2019-12-01T02:15:07.800\&quot;,\n \&quot;last_editor_user_id\&quot;: \&quot;32986\&quot;,\n \&quot;owner_user_id\&quot;: \&quot;8229\&quot;,\n \&quot;parent_id\&quot;: \&quot;7386\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 3\n },\n {\n \&quot;body\&quot;: \&quot;これでどうだろう?\\n\\n```\\n\\n allinurl:https://* または allinurl:http://*\\n \\n```\\n\\nうーん。ページの後ろのほうになると「allinurlを無視した結果が必要かもしれない」とクエリオプションを無視した結果がでてきますね……。\\n\\nクエリオプションを無視した結果が出てくるのは、もはやどうすることも出来ないような……。\&quot;,\n \&quot;comment_count\&quot;: 0,\n \&quot;content_license\&quot;: \&quot;CC BY-SA 3.0\&quot;,\n \&quot;creation_date\&quot;: \&quot;2015-03-04T09:15:41.177\&quot;,\n \&quot;id\&quot;: \&quot;7435\&quot;,\n \&quot;last_activity_date\&quot;: \&quot;2015-03-04T09:15:41.177\&quot;,\n \&quot;last_edit_date\&quot;: null,\n \&quot;last_editor_user_id\&quot;: null,\n \&quot;owner_user_id\&quot;: \&quot;8335\&quot;,\n \&quot;parent_id\&quot;: \&quot;7386\&quot;,\n \&quot;post_type\&quot;: \&quot;answer\&quot;,\n \&quot;score\&quot;: 1\n }\n]&quot;},&quot;id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7386&quot;},&quot;accepted_answer_id&quot;:{&quot;kind&quot;:&quot;null&quot;},&quot;popular_answer_id&quot;:{&quot;kind&quot;:&quot;string&quot;,&quot;value&quot;:&quot;7396&quot;}}}],&quot;truncated&quot;:false,&quot;partial&quot;:false},&quot;paginationData&quot;:{&quot;pageIndex&quot;:16,&quot;numItemsPerPage&quot;:100,&quot;numTotalItems&quot;:30551,&quot;offset&quot;:1600,&quot;length&quot;:100}},&quot;jwt&quot;:&quot;eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sImlhdCI6MTc1NjE5MDA4Miwic3ViIjoiL2RhdGFzZXRzL3AxYXRkZXYvamEtc3RhY2tvdmVyZmxvdyIsImV4cCI6MTc1NjE5MzY4MiwiaXNzIjoiaHR0cHM6Ly9odWdnaW5nZmFjZS5jbyJ9.5hg3B6r6e-KwqtzOipr4VG87THJLL-VUgmVOJ93J6UGm4KKreoxNPU3vlo_sZMjkXLJAYJ8uWYOo5tkI0rk3BA&quot;,&quot;displayUrls&quot;:true},&quot;discussionsStats&quot;:{&quot;closed&quot;:0,&quot;open&quot;:0,&quot;total&quot;:0},&quot;fullWidth&quot;:true,&quot;hasGatedAccess&quot;:true,&quot;hasFullAccess&quot;:true,&quot;isEmbedded&quot;:false,&quot;savedQueries&quot;:{&quot;community&quot;:[],&quot;user&quot;:[]}}"><div><header class="bg-linear-to-t border-b border-gray-100 pt-4 xl:pt-0 from-purple-500/8 dark:from-purple-500/20 to-white to-70% dark:to-gray-950"><div class="mx-4 relative flex flex-col xl:flex-row"><h1 class="flex flex-wrap items-center max-md:leading-tight gap-y-1 text-lg xl:flex-none"><a href="/datasets" class="group flex items-center"><svg class="sm:mr-1 -mr-1 text-gray-400" style="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 25 25"><ellipse cx="12.5" cy="5" fill="currentColor" fill-opacity="0.25" rx="7.5" ry="2"></ellipse><path d="M12.5 15C16.6421 15 20 14.1046 20 13V20C20 21.1046 16.6421 22 12.5 22C8.35786 22 5 21.1046 5 20V13C5 14.1046 8.35786 15 12.5 15Z" fill="currentColor" opacity="0.5"></path><path d="M12.5 7C16.6421 7 20 6.10457 20 5V11.5C20 12.6046 16.6421 13.5 12.5 13.5C8.35786 13.5 5 12.6046 5 11.5V5C5 6.10457 8.35786 7 12.5 7Z" fill="currentColor" opacity="0.5"></path><path d="M5.23628 12C5.08204 12.1598 5 12.8273 5 13C5 14.1046 8.35786 15 12.5 15C16.6421 15 20 14.1046 20 13C20 12.8273 19.918 12.1598 19.7637 12C18.9311 12.8626 15.9947 13.5 12.5 13.5C9.0053 13.5 6.06886 12.8626 5.23628 12Z" fill="currentColor"></path></svg> <span class="mr-2.5 font-semibold text-gray-400 group-hover:text-gray-500 max-sm:hidden">Datasets:</span></a> <hr class="mx-1.5 h-2 translate-y-px rounded-sm border-r dark:border-gray-600 sm:hidden"> <div class="group flex flex-none items-center"><div class="relative mr-1 flex items-center"> <span class="inline-block "><span class="contents"><a href="/p1atdev" class="text-gray-400 hover:text-blue-600"><img alt="" class="size-3.5 rounded-full flex-none" src="https://aifasthub.com/avatars/v1/production/uploads/6305db1fcfbde33ef7d480ff/gy8VPvXYm_MiLmjwmuEPG.png" crossorigin="anonymous"></a></span> </span></div> <span class="inline-block "><span class="contents"><a href="/p1atdev" class="text-gray-400 hover:text-blue-600">p1atdev</a></span> </span> <div class="mx-0.5 text-gray-300">/</div></div> <div class="max-w-full xl:flex xl:min-w-0 xl:flex-nowrap xl:items-center xl:gap-x-1"><a class="break-words font-mono font-semibold hover:text-blue-600 text-[1.07rem] xl:truncate" href="/datasets/p1atdev/ja-stackoverflow">ja-stackoverflow</a> <button class="text-xs mr-3 focus:outline-hidden inline-flex cursor-pointer items-center text-sm mx-0.5 text-gray-600 " title="Copy dataset name to clipboard" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> </button></div> <div class="inline-flex items-center overflow-hidden whitespace-nowrap rounded-md border bg-white text-sm leading-none text-gray-500 mr-2"><button class="relative flex items-center overflow-hidden from-red-50 to-transparent dark:from-red-900 px-1.5 py-1 hover:bg-linear-to-t focus:outline-hidden" title="Like"><svg class="left-1.5 absolute" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32" fill="currentColor"><path d="M22.45,6a5.47,5.47,0,0,1,3.91,1.64,5.7,5.7,0,0,1,0,8L16,26.13,5.64,15.64a5.7,5.7,0,0,1,0-8,5.48,5.48,0,0,1,7.82,0L16,10.24l2.53-2.58A5.44,5.44,0,0,1,22.45,6m0-2a7.47,7.47,0,0,0-5.34,2.24L16,7.36,14.89,6.24a7.49,7.49,0,0,0-10.68,0,7.72,7.72,0,0,0,0,10.82L16,29,27.79,17.06a7.72,7.72,0,0,0,0-10.82A7.49,7.49,0,0,0,22.45,4Z"></path></svg> <span class="ml-4 pl-0.5 ">like</span></button> <button class="focus:outline-hidden flex items-center border-l px-1.5 py-1 text-gray-400 hover:bg-gray-50 focus:bg-gray-100 dark:hover:bg-gray-900 dark:focus:bg-gray-800" title="See users who liked this repository">8</button></div> </h1> <div class="flex flex-col-reverse gap-x-2 sm:flex-row sm:items-center sm:justify-between xl:ml-auto"><div class="-mb-px flex h-12 items-center overflow-x-auto overflow-y-hidden "> <a class="tab-alternate" href="/datasets/p1atdev/ja-stackoverflow"><svg class="mr-1.5 text-gray-400 flex-none" style="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg> Dataset card </a><a class="tab-alternate active" href="/datasets/p1atdev/ja-stackoverflow/viewer/"><svg class="mr-1.5 text-gray-400 flex-none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill="currentColor" d="M2.5 2h7a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm0 2v2h3V4h-3Zm4 0v2h3V4h-3Zm-4 3v2h3V7h-3Zm4 0v2h3V7h-3Z"></path></svg> Data Studio </a><a class="tab-alternate" href="/datasets/p1atdev/ja-stackoverflow/tree/main"><svg class="mr-1.5 text-gray-400 flex-none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-tertiary" d="M21 19h-8a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2zm0-4h-8a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2zm0-8h-8a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2zm0 4h-8a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M9 19a1 1 0 0 1-1-1V6a1 1 0 0 1 2 0v12a1 1 0 0 1-1 1zm-6-4.333a1 1 0 0 1-.64-1.769L3.438 12l-1.078-.898a1 1 0 0 1 1.28-1.538l2 1.667a1 1 0 0 1 0 1.538l-2 1.667a.999.999 0 0 1-.64.231z" fill="currentColor"></path></svg> <span class="xl:hidden">Files</span> <span class="hidden xl:inline">Files and versions</span> <span class="inline-block "><span class="contents"><div slot="anchor" class="shadow-purple-500/10 ml-2 inline-flex -translate-y-px items-center gap-0.5 rounded-md border bg-white px-1 py-0.5 align-middle text-xs font-semibold leading-none text-gray-800 shadow-sm dark:border-gray-700 dark:bg-gradient-to-b dark:from-gray-925 dark:to-gray-925 dark:text-gray-300"><svg class="size-3 " xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M6.14 3.64 5.1 4.92 2.98 2.28h2.06l1.1 1.36Zm0 4.72-1.1 1.36H2.98l2.13-2.64 1.03 1.28Zm4.9 1.36L8.03 6l3-3.72H8.96L5.97 6l3 3.72h2.06Z" fill="#7875FF"></path><path d="M4.24 6 2.6 8.03.97 6 2.6 3.97 4.24 6Z" fill="#FF7F41" opacity="1"></path></svg> <span>xet</span> </div></span> </span> </a><a class="tab-alternate" href="/datasets/p1atdev/ja-stackoverflow/discussions"><svg class="mr-1.5 text-gray-400 flex-none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M20.6081 3C21.7684 3 22.8053 3.49196 23.5284 4.38415C23.9756 4.93678 24.4428 5.82749 24.4808 7.16133C24.9674 7.01707 25.4353 6.93643 25.8725 6.93643C26.9833 6.93643 27.9865 7.37587 28.696 8.17411C29.6075 9.19872 30.0124 10.4579 29.8361 11.7177C29.7523 12.3177 29.5581 12.8555 29.2678 13.3534C29.8798 13.8646 30.3306 14.5763 30.5485 15.4322C30.719 16.1032 30.8939 17.5006 29.9808 18.9403C30.0389 19.0342 30.0934 19.1319 30.1442 19.2318C30.6932 20.3074 30.7283 21.5229 30.2439 22.6548C29.5093 24.3704 27.6841 25.7219 24.1397 27.1727C21.9347 28.0753 19.9174 28.6523 19.8994 28.6575C16.9842 29.4379 14.3477 29.8345 12.0653 29.8345C7.87017 29.8345 4.8668 28.508 3.13831 25.8921C0.356375 21.6797 0.754104 17.8269 4.35369 14.1131C6.34591 12.058 7.67023 9.02782 7.94613 8.36275C8.50224 6.39343 9.97271 4.20438 12.4172 4.20438H12.4179C12.6236 4.20438 12.8314 4.2214 13.0364 4.25468C14.107 4.42854 15.0428 5.06476 15.7115 6.02205C16.4331 5.09583 17.134 4.359 17.7682 3.94323C18.7242 3.31737 19.6794 3 20.6081 3ZM20.6081 5.95917C20.2427 5.95917 19.7963 6.1197 19.3039 6.44225C17.7754 7.44319 14.8258 12.6772 13.7458 14.7131C13.3839 15.3952 12.7655 15.6837 12.2086 15.6837C11.1036 15.6837 10.2408 14.5497 12.1076 13.1085C14.9146 10.9402 13.9299 7.39584 12.5898 7.1776C12.5311 7.16799 12.4731 7.16355 12.4172 7.16355C11.1989 7.16355 10.6615 9.33114 10.6615 9.33114C10.6615 9.33114 9.0863 13.4148 6.38031 16.206C3.67434 18.998 3.5346 21.2388 5.50675 24.2246C6.85185 26.2606 9.42666 26.8753 12.0653 26.8753C14.8021 26.8753 17.6077 26.2139 19.1799 25.793C19.2574 25.7723 28.8193 22.984 27.6081 20.6107C27.4046 20.212 27.0693 20.0522 26.6471 20.0522C24.9416 20.0522 21.8393 22.6726 20.5057 22.6726C20.2076 22.6726 19.9976 22.5416 19.9116 22.222C19.3433 20.1173 28.552 19.2325 27.7758 16.1839C27.639 15.6445 27.2677 15.4256 26.746 15.4263C24.4923 15.4263 19.4358 19.5181 18.3759 19.5181C18.2949 19.5181 18.2368 19.4937 18.2053 19.4419C17.6743 18.557 17.9653 17.9394 21.7082 15.6009C25.4511 13.2617 28.0783 11.8545 26.5841 10.1752C26.4121 9.98141 26.1684 9.8956 25.8725 9.8956C23.6001 9.89634 18.2311 14.9403 18.2311 14.9403C18.2311 14.9403 16.7821 16.496 15.9057 16.496C15.7043 16.496 15.533 16.4139 15.4169 16.2112C14.7956 15.1296 21.1879 10.1286 21.5484 8.06535C21.7928 6.66715 21.3771 5.95917 20.6081 5.95917Z" fill="#FF9D00"></path><path d="M5.50686 24.2246C3.53472 21.2387 3.67446 18.9979 6.38043 16.206C9.08641 13.4147 10.6615 9.33111 10.6615 9.33111C10.6615 9.33111 11.2499 6.95933 12.59 7.17757C13.93 7.39581 14.9139 10.9401 12.1069 13.1084C9.29997 15.276 12.6659 16.7489 13.7459 14.713C14.8258 12.6772 17.7747 7.44316 19.304 6.44221C20.8326 5.44128 21.9089 6.00204 21.5484 8.06532C21.188 10.1286 14.795 15.1295 15.4171 16.2118C16.0391 17.2934 18.2312 14.9402 18.2312 14.9402C18.2312 14.9402 25.0907 8.49588 26.5842 10.1752C28.0776 11.8545 25.4512 13.2616 21.7082 15.6008C17.9646 17.9393 17.6744 18.557 18.2054 19.4418C18.7372 20.3266 26.9998 13.1351 27.7759 16.1838C28.5513 19.2324 19.3434 20.1173 19.9117 22.2219C20.48 24.3274 26.3979 18.2382 27.6082 20.6107C28.8193 22.9839 19.2574 25.7722 19.18 25.7929C16.0914 26.62 8.24723 28.3726 5.50686 24.2246Z" fill="#FFD21E"></path></svg> Community </a></div> </div></div></header> </div> <div class="flex flex-col w-full"> <div class="flex h-full flex-1"> <div class="flex flex-1 flex-col overflow-hidden " style="height: calc(100vh - 48px)"><div class="flex flex-col overflow-hidden h-full "> <div class="flex flex-1 flex-col overflow-hidden "><div class="flex flex-1 flex-col overflow-hidden"><div class="flex min-h-0 flex-1"><div class="flex flex-1 flex-col overflow-hidden"><div class="md:shadow-xs dark:border-gray-800 md:my-4 md:ml-4 md:rounded-lg md:border flex min-w-0 flex-wrap "><div class="flex min-w-0 flex-1 flex-wrap"><div class="grid flex-1 grid-cols-1 overflow-hidden text-sm md:grid-cols-2 md:place-content-center md:rounded-lg"><label class="relative block flex-1 px-3 py-2 hover:bg-gray-50 dark:border-gray-850 dark:hover:bg-gray-950 md:border-r max-md:first:border-b md:border-r" title="default"><span class="text-gray-500">Subset (2)</span> <div class="flex items-center whitespace-nowrap"><span class="truncate">default</span> <span class="mx-2 text-gray-500">·</span> <span class="text-gray-500">30.6k rows</span> <svg class="ml-auto min-w-6 pl-2" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg></div> <select class="absolute inset-0 z-10 w-full cursor-pointer border-0 bg-white text-base opacity-0"><optgroup label="Subset (2)"><option value="default" selected>default (30.6k rows)</option><option value="simple" >simple (30.6k rows)</option></optgroup></select></label> <label class="relative block flex-1 px-3 py-2 hover:bg-gray-50 dark:border-gray-850 dark:hover:bg-gray-900 md:border-r md:border-r-0" title="train"><div class="text-gray-500">Split (1)</div> <div class="flex items-center overflow-hidden whitespace-nowrap"><span class="truncate">train</span> <span class="mx-2 text-gray-500">·</span> <span class="text-gray-500">30.6k rows</span> <svg class="ml-auto min-w-6 pl-2" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg></div> <select class="absolute inset-0 z-10 w-full cursor-pointer border-0 bg-white text-base opacity-0"><optgroup label="Split (1)"><option value="train" selected>train (30.6k rows)</option></optgroup></select></label></div></div> <div class="hidden flex-none flex-col items-center gap-0.5 border-l px-1 md:flex justify-end"> <span class="inline-block "><span class="contents"><div slot="anchor"><button class="group text-gray-500 hover:text-gray-700" aria-label="Hide sidepanel"><div class="rounded-xs flex size-4 items-center justify-center border border-gray-400 bg-gray-100 hover:border-gray-600 hover:bg-blue-50 dark:border-gray-600 dark:bg-gray-800 dark:hover:bg-gray-700 dark:group-hover:border-gray-400"><div class="float-left h-full w-[65%]"></div> <div class="float-right h-full w-[35%] bg-gray-400 group-hover:bg-gray-600 dark:bg-gray-600 dark:group-hover:bg-gray-400"></div></div></button></div></span> </span> <div class="relative "> <button class="btn px-0.5 py-0.5 " type="button"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="p-0.5" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><circle cx="16" cy="7" r="3" fill="currentColor"></circle><circle cx="16" cy="16" r="3" fill="currentColor"></circle><circle cx="16" cy="25" r="3" fill="currentColor"></circle></svg> </button> </div></div></div> <div class="flex min-h-0 flex-1 flex-col border dark:border-gray-800 md:mb-4 md:ml-4 md:rounded-lg"> <div class="bg-linear-to-r text-smd relative flex items-center dark:border-gray-900 dark:bg-gray-950 false rounded-t-lg [&amp;:has(:focus)]:from-gray-50 [&amp;:has(:focus)]:to-transparent [&amp;:has(:focus)]:to-20% dark:[&amp;:has(:focus)]:from-gray-900"><form class="flex-1"><svg class="absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none text-gray-400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M30 28.59L22.45 21A11 11 0 1 0 21 22.45L28.59 30zM5 14a9 9 0 1 1 9 9a9 9 0 0 1-9-9z" fill="currentColor"></path></svg> <input disabled class="outline-hidden h-9 w-full border-none bg-transparent px-1 pl-9 pr-3 placeholder:text-gray-400 " placeholder="Search this dataset" dir="auto"></form> <div class="flex items-center gap-2 px-2 py-1"><button type="button" class="hover:bg-yellow-200/70 flex items-center gap-1 rounded-md border border-yellow-200 bg-yellow-100 pl-0.5 pr-1 text-[.8rem] leading-normal text-gray-700 dark:border-orange-500/25 dark:bg-orange-500/20 dark:text-gray-300 dark:hover:brightness-110 md:hidden"><div class="rounded-sm bg-yellow-300 px-1 font-mono text-[.7rem] font-bold text-black dark:bg-yellow-700 dark:text-gray-200">SQL </div> Console </button></div></div> <div class="flex flex-1 flex-col overflow-hidden min-h-64 flex w-full flex-col border-t md:rounded-b-lg md:shadow-lg"> <div class="flex-1 relative overflow-auto"><table class="w-full table-auto rounded-lg font-mono text-xs text-gray-900"><thead class="shadow-xs sticky left-0 right-0 top-0 z-1 bg-white align-top"><tr class="space-y-54 h-full min-w-fit divide-x border-b text-left"><th class="h-full max-w-sm p-2 text-left relative w-auto"><div class="flex h-full flex-col flex-nowrap justify-between"><div><div class="flex items-center justify-between">question <form class="flex flex-col"><button id="asc" class="-mr-1 ml-2 h-[0.4rem] w-[0.8rem] transition ease-in-out"><svg class="-rotate-180 transform text-gray-300 hover:text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 64 256 128" fill="currentColor" aria-hidden="true"><path d="M213.65674,101.657l-80,79.99976a7.99945,7.99945,0,0,1-11.31348,0l-80-79.99976A8,8,0,0,1,48,88H208a8,8,0,0,1,5.65674,13.657Z"></path></svg></button> <button id="desc" class="-mr-1 ml-2 h-[0.4rem] w-[0.8rem] transition ease-in-out"><svg class="text-gray-300 hover:text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 64 256 128" fill="currentColor" aria-hidden="true"><path d="M213.65674,101.657l-80,79.99976a7.99945,7.99945,0,0,1-11.31348,0l-80-79.99976A8,8,0,0,1,48,88H208a8,8,0,0,1,5.65674,13.657Z"></path></svg></button></form></div> <div class="mb-2 whitespace-nowrap text-xs font-normal text-gray-500"><span>dict</span></div></div> <div></div></div> <div class="absolute right-0 top-0 z-10 h-full w-1 cursor-col-resize hover:bg-indigo-100 active:bg-indigo-500 dark:hover:bg-indigo-800 dark:active:bg-indigo-600/80"><div class="absolute right-0 top-0 h-full w-1"></div> </div> </th><th class="h-full max-w-sm p-2 text-left relative w-auto"><div class="flex h-full flex-col flex-nowrap justify-between"><div><div class="flex items-center justify-between">answers <form class="flex flex-col"><button id="asc" class="-mr-1 ml-2 h-[0.4rem] w-[0.8rem] transition ease-in-out"><svg class="-rotate-180 transform text-gray-300 hover:text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 64 256 128" fill="currentColor" aria-hidden="true"><path d="M213.65674,101.657l-80,79.99976a7.99945,7.99945,0,0,1-11.31348,0l-80-79.99976A8,8,0,0,1,48,88H208a8,8,0,0,1,5.65674,13.657Z"></path></svg></button> <button id="desc" class="-mr-1 ml-2 h-[0.4rem] w-[0.8rem] transition ease-in-out"><svg class="text-gray-300 hover:text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 64 256 128" fill="currentColor" aria-hidden="true"><path d="M213.65674,101.657l-80,79.99976a7.99945,7.99945,0,0,1-11.31348,0l-80-79.99976A8,8,0,0,1,48,88H208a8,8,0,0,1,5.65674,13.657Z"></path></svg></button></form></div> <div class="mb-2 whitespace-nowrap text-xs font-normal text-gray-500"><span>list</span></div></div> <div></div></div> <div class="absolute right-0 top-0 z-10 h-full w-1 cursor-col-resize hover:bg-indigo-100 active:bg-indigo-500 dark:hover:bg-indigo-800 dark:active:bg-indigo-600/80"><div class="absolute right-0 top-0 h-full w-1"></div> </div> </th><th class="h-full max-w-sm p-2 text-left relative w-auto"><div class="flex h-full flex-col flex-nowrap justify-between"><div><div class="flex items-center justify-between">id <form class="flex flex-col"><button id="asc" class="-mr-1 ml-2 h-[0.4rem] w-[0.8rem] transition ease-in-out"><svg class="-rotate-180 transform text-gray-300 hover:text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 64 256 128" fill="currentColor" aria-hidden="true"><path d="M213.65674,101.657l-80,79.99976a7.99945,7.99945,0,0,1-11.31348,0l-80-79.99976A8,8,0,0,1,48,88H208a8,8,0,0,1,5.65674,13.657Z"></path></svg></button> <button id="desc" class="-mr-1 ml-2 h-[0.4rem] w-[0.8rem] transition ease-in-out"><svg class="text-gray-300 hover:text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 64 256 128" fill="currentColor" aria-hidden="true"><path d="M213.65674,101.657l-80,79.99976a7.99945,7.99945,0,0,1-11.31348,0l-80-79.99976A8,8,0,0,1,48,88H208a8,8,0,0,1,5.65674,13.657Z"></path></svg></button></form></div> <div class="mb-2 whitespace-nowrap text-xs font-normal text-gray-500"><span>string</span><span class="italic text-gray-400 before:mx-1 before:content-['·']">lengths</span></div></div> <div><div class="" style="height: 40px; padding-top: 2px"><svg width="130" height="28"><g><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="0" y="25" width="31" height="5" fill-opacity="1"></rect><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="33" y="25" width="31" height="5" fill-opacity="1"></rect><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="66" y="23.605324530874384" width="31" height="6.394675469125614" fill-opacity="1"></rect><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="99" y="0" width="31" height="30" fill-opacity="1"></rect></g><rect class="fill-white dark:fill-gray-900" x="0" y="26" width="130" height="2" stroke-opacity="1"></rect><line class="stroke-gray-100 dark:stroke-gray-500/20" x1="0" y1="27.5" x2="130" y2="27.5" stroke-opacity="1"></line><g><rect class="fill-indigo-500 cursor-pointer" x="-1" y="0" width="33" height="30" fill-opacity="0"></rect><rect class="fill-indigo-500 cursor-pointer" x="32" y="0" width="33" height="30" fill-opacity="0"></rect><rect class="fill-indigo-500 cursor-pointer" x="65" y="0" width="33" height="30" fill-opacity="0"></rect><rect class="fill-indigo-500 cursor-pointer" x="98" y="0" width="33" height="30" fill-opacity="0"></rect></g></svg> <div class="relative font-light text-gray-400" style="height: 10px; width: 130px;"><div class="absolute left-0 overflow-hidden text-ellipsis whitespace-nowrap" style="max-width: 60px">2</div> <div class="absolute overflow-hidden text-ellipsis whitespace-nowrap" style="right: 0px; max-width: 60px">5</div> </div></div></div></div> <div class="absolute right-0 top-0 z-10 h-full w-1 cursor-col-resize hover:bg-indigo-100 active:bg-indigo-500 dark:hover:bg-indigo-800 dark:active:bg-indigo-600/80"><div class="absolute right-0 top-0 h-full w-1"></div> </div> </th><th class="h-full max-w-sm p-2 text-left relative w-auto"><div class="flex h-full flex-col flex-nowrap justify-between"><div><div class="flex items-center justify-between">accepted_answer_id <form class="flex flex-col"><button id="asc" class="-mr-1 ml-2 h-[0.4rem] w-[0.8rem] transition ease-in-out"><svg class="-rotate-180 transform text-gray-300 hover:text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 64 256 128" fill="currentColor" aria-hidden="true"><path d="M213.65674,101.657l-80,79.99976a7.99945,7.99945,0,0,1-11.31348,0l-80-79.99976A8,8,0,0,1,48,88H208a8,8,0,0,1,5.65674,13.657Z"></path></svg></button> <button id="desc" class="-mr-1 ml-2 h-[0.4rem] w-[0.8rem] transition ease-in-out"><svg class="text-gray-300 hover:text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 64 256 128" fill="currentColor" aria-hidden="true"><path d="M213.65674,101.657l-80,79.99976a7.99945,7.99945,0,0,1-11.31348,0l-80-79.99976A8,8,0,0,1,48,88H208a8,8,0,0,1,5.65674,13.657Z"></path></svg></button></form></div> <div class="mb-2 whitespace-nowrap text-xs font-normal text-gray-500"><span>string</span><span class="italic text-gray-400 before:mx-1 before:content-['·']">lengths</span></div></div> <div><div class="" style="height: 40px; padding-top: 2px"><svg width="130" height="28"><g><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="0" y="25" width="24.4" height="5" fill-opacity="1"></rect><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="26.4" y="25" width="24.4" height="5" fill-opacity="1"></rect><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="52.8" y="23.502050380785" width="24.4" height="6.497949619214998" fill-opacity="1"></rect><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="79.19999999999999" y="2.9244288224956065" width="24.4" height="27.075571177504393" fill-opacity="1"></rect><rect class=" fill-gray-200 dark:fill-gray-500/80" rx="2" x="105.6" y="0" width="24.4" height="30" fill-opacity="1"></rect></g><rect class="fill-white dark:fill-gray-900" x="0" y="26" width="130" height="2" stroke-opacity="1"></rect><line class="stroke-gray-100 dark:stroke-gray-500/20" x1="0" y1="27.5" x2="130" y2="27.5" stroke-opacity="1"></line><g><rect class="fill-indigo-500 cursor-pointer" x="-1" y="0" width="26.4" height="30" fill-opacity="0"></rect><rect class="fill-indigo-500 cursor-pointer" x="25.4" y="0" width="26.4" height="30" fill-opacity="0"></rect><rect class="fill-indigo-500 cursor-pointer" x="51.8" y="0" width="26.4" height="30" fill-opacity="0"></rect><rect class="fill-indigo-500 cursor-pointer" x="78.19999999999999" y="0" width="26.4" height="30" fill-opacity="0"></rect><rect class="fill-gray-200 cursor-pointer" x="104.6" y="0" width="26.4" height="30" fill-opacity="0"></rect></g></svg> <div class="relative font-light text-gray-400" style="height: 10px; width: 130px;"><div class="absolute left-0 overflow-hidden text-ellipsis whitespace-nowrap" style="max-width: 46.8px">2</div> <div class="absolute overflow-hidden text-ellipsis whitespace-nowrap" style="right: 26.4px; max-width: 46.8px">5</div> <div class="absolute -translate-x-1/2" style="left: 117.8px">⌀</div></div></div></div></div> <div class="absolute right-0 top-0 z-10 h-full w-1 cursor-col-resize hover:bg-indigo-100 active:bg-indigo-500 dark:hover:bg-indigo-800 dark:active:bg-indigo-600/80"><div class="absolute right-0 top-0 h-full w-1"></div> </div> </th><th class="h-full max-w-sm p-2 text-left relative w-auto"><div class="flex h-full flex-col flex-nowrap justify-between"><div><div class="flex items-center justify-between">popular_answer_id <form class="flex flex-col"><button id="asc" class="-mr-1 ml-2 h-[0.4rem] w-[0.8rem] transition ease-in-out"><svg class="-rotate-180 transform text-gray-300 hover:text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 64 256 128" fill="currentColor" aria-hidden="true"><path d="M213.65674,101.657l-80,79.99976a7.99945,7.99945,0,0,1-11.31348,0l-80-79.99976A8,8,0,0,1,48,88H208a8,8,0,0,1,5.65674,13.657Z"></path></svg></button> <button id="desc" class="-mr-1 ml-2 h-[0.4rem] w-[0.8rem] transition ease-in-out"><svg class="text-gray-300 hover:text-gray-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 64 256 128" fill="currentColor" aria-hidden="true"><path d="M213.65674,101.657l-80,79.99976a7.99945,7.99945,0,0,1-11.31348,0l-80-79.99976A8,8,0,0,1,48,88H208a8,8,0,0,1,5.65674,13.657Z"></path></svg></button></form></div> <div class="mb-2 whitespace-nowrap text-xs font-normal text-gray-500"><span>string</span><span class="italic text-gray-400 before:mx-1 before:content-['·']">lengths</span></div></div> <div><div class="" style="height: 40px; padding-top: 2px"><svg width="130" height="28"><g><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="0" y="25" width="24.4" height="5" fill-opacity="1"></rect><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="26.4" y="25" width="24.4" height="5" fill-opacity="1"></rect><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="52.8" y="23.490616621983914" width="24.4" height="6.509383378016086" fill-opacity="1"></rect><rect class="fill-gray-400 dark:fill-gray-500/80" rx="2" x="79.19999999999999" y="0" width="24.4" height="30" fill-opacity="1"></rect><rect class=" fill-gray-200 dark:fill-gray-500/80" rx="2" x="105.6" y="21.347184986595174" width="24.4" height="8.652815013404826" fill-opacity="1"></rect></g><rect class="fill-white dark:fill-gray-900" x="0" y="26" width="130" height="2" stroke-opacity="1"></rect><line class="stroke-gray-100 dark:stroke-gray-500/20" x1="0" y1="27.5" x2="130" y2="27.5" stroke-opacity="1"></line><g><rect class="fill-indigo-500 cursor-pointer" x="-1" y="0" width="26.4" height="30" fill-opacity="0"></rect><rect class="fill-indigo-500 cursor-pointer" x="25.4" y="0" width="26.4" height="30" fill-opacity="0"></rect><rect class="fill-indigo-500 cursor-pointer" x="51.8" y="0" width="26.4" height="30" fill-opacity="0"></rect><rect class="fill-indigo-500 cursor-pointer" x="78.19999999999999" y="0" width="26.4" height="30" fill-opacity="0"></rect><rect class="fill-gray-200 cursor-pointer" x="104.6" y="0" width="26.4" height="30" fill-opacity="0"></rect></g></svg> <div class="relative font-light text-gray-400" style="height: 10px; width: 130px;"><div class="absolute left-0 overflow-hidden text-ellipsis whitespace-nowrap" style="max-width: 46.8px">2</div> <div class="absolute overflow-hidden text-ellipsis whitespace-nowrap" style="right: 26.4px; max-width: 46.8px">5</div> <div class="absolute -translate-x-1/2" style="left: 117.8px">⌀</div></div></div></div></div> <div class="absolute right-0 top-0 z-10 h-full w-1 cursor-col-resize hover:bg-indigo-100 active:bg-indigo-500 dark:hover:bg-indigo-800 dark:active:bg-indigo-600/80"><div class="absolute right-0 top-0 h-full w-1"></div> </div> </th></tr></thead> <tbody class="h-16 overflow-scroll"><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1600"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7142", "answer_count": 1, "body": "アプリからiPadの画面をロックすることができないか調査しています。 \n色々調べてキオスクモードにたどりついたのですが、アプリからキオスクモードに切り替えることは可能なのでしょうか? \nそもそもアプリからiPadの画面をロックすることは可能なのでしょうか?\n\nアドバイスをよろしくお願い致します。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T06:42:49.477", "favorite_count": 0, "id": "7125", "last_activity_date": "2015-02-26T09:37:04.790", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7212", "post_type": "question", "score": 3, "tags": [ "objective-c" ], "title": "アプリからiPadの画面をロックするには", "view_count": 572 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "アプリからキオスクモードにすることはできないはずです。\n\n画面ロックですが、 **ユーザーが画面にタッチしても反応しない** という条件にするのであれば \nボタンなどの使用しないアプリにすれば良いと思います。\n\nまた、アプリから起動時iOSのロック画面の呼び出しはできません。 \nホームボタンを無効化する場合はキオスクモードにする必要があります。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T09:37:04.790", "id": "7142", "last_activity_date": "2015-02-26T09:37:04.790", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "356", "parent_id": "7125", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7125</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7142</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7142</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1601"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 2, "body": "rails 3.2 を使っています。\n\ndevelopment モードの時は\n\n```\n\n app/assets/javascripts/ajaxzip3.js\n \n```\n\nを\n\nproduction モードの時は\n\n```\n\n app/assets/javascripts/ajaxzip3-https.js\n \n```\n\nを使う。という事は可能でしょうか?\n\n[ajaxzip3 という郵便番号検索ライブラリ](https://code.google.com/p/ajaxzip3/)を使用しているのですが \nproduction 環境の時は https で、development 環境の時は http で使っているためです。\n\n上記のリンクサイトには以下の記述があります。本番環境のみ動作させるのは簡単ですが、やっぱり開発環境でも動いてくれないと楽しく無いです (^^;\n\n```\n\n # httpサーバの場合はhttp://ajaxzip3.googlecode.com/svn/trunk/ajaxzip3/ajaxzip3.js をご利用ください。\n # httpsサーバの場合はhttps://ajaxzip3.googlecode.com/svn/trunk/ajaxzip3/ajaxzip3-https.js をご利用ください。 \n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T06:51:41.623", "favorite_count": 0, "id": "7127", "last_activity_date": "2015-02-26T11:24:31.757", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7208", "post_type": "question", "score": 2, "tags": [ "javascript", "ruby-on-rails" ], "title": "本番環境と開発環境で読み込む js を使い分ける方法は?", "view_count": 760 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "`app/views` 内のHTMLで以下のように書くのはどうでしょう。\n\n```\n\n &lt;% if Rails.env.production? %>\n &lt;script src=\"https://ajaxzip3.googlecode.com/svn/trunk/ajaxzip3/ajaxzip3-https.js\">&lt;/script>\n &lt;% else %>\n &lt;script src=\"http://ajaxzip3.googlecode.com/svn/trunk/ajaxzip3/ajaxzip3.js\">&lt;/script>\n &lt;% end %>\n \n```\n\nSlim の場合はこんな感じでしょうか。\n\n```\n\n - if Rails.env.production?\n script src=\"https://ajaxzip3.googlecode.com/svn/trunk/ajaxzip3/ajaxzip3-https.js\"\n - else\n script src=\"http://ajaxzip3.googlecode.com/svn/trunk/ajaxzip3/ajaxzip3.js\"\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T07:21:39.390", "id": "7129", "last_activity_date": "2015-02-26T08:46:05.180", "last_edit_date": "2015-02-26T08:46:05.180", "last_editor_user_id": "85", "owner_user_id": "208", "parent_id": "7127", "post_type": "answer", "score": 1 }, { "body": "`request.protocol`とHelperメソッドを組み合わせるとスッキリ書けそうです。\n\n```\n\n # app/helpers/application_helper.rb\n module ApplicationHelper\n def ajaxzip3_include_tag\n file_name = ssl? ? 'ajaxzip3-https.js' : 'ajaxzip3.js'\n javascript_include_tag(file_name)\n end\n \n def ssl?\n request.protocol == 'https://'\n end\n end\n \n```\n\n```\n\n &lt;% # app/views/layouts/application.html.erb %>\n &lt;!DOCTYPE html>\n &lt;html>\n &lt;head>\n &lt;title>Your app name&lt;/title>\n &lt;%= stylesheet_link_tag 'application', media: 'all' %>\n &lt;%= javascript_include_tag 'application' %>\n &lt;%= ajaxzip3_include_tag %>\n &lt;%= csrf_meta_tags %>\n &lt;/head>\n &lt;body>\n \n &lt;%= yield %>\n \n &lt;/body>\n &lt;/html>\n \n```\n\nあと、productionで使うなら `config.assets.precompile` でファイルを指定しておく必要があるかもしれません。\n\n```\n\n # config/environments/production.rb\n config.assets.precompile += %w(ajaxzip3-https.js)\n \n```\n\n参考になれば幸いです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T08:39:18.530", "id": "7140", "last_activity_date": "2015-02-26T11:24:31.757", "last_edit_date": "2015-02-26T11:24:31.757", "last_editor_user_id": "85", "owner_user_id": "85", "parent_id": "7127", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7127</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7140</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1602"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "Full GC多発の現象調査をしているのですが \nGCログにFull GCとFull GC(System)が存在しております。\n\n前任者はFull GC(System)を外して集計しているのですが・・・ \n違いも判らず外すのも気持ち悪くて質問させていただきました。\n\nネットの海におちていなかったor2", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T07:27:22.157", "favorite_count": 0, "id": "7131", "last_activity_date": "2015-02-26T08:00:57.610", "last_edit_date": "2015-02-26T07:56:14.967", "last_editor_user_id": "208", "owner_user_id": "858", "post_type": "question", "score": 1, "tags": [ "java", "gc" ], "title": "GCログに記載されている「Full GC」 と「Full GC(System)」の違い", "view_count": 2278 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "[Does java garbage collection log entry “Full GC (System)” mean some class\ncalled System.gc()?](https://stackoverflow.com/questions/6626680/)\n\nに、まさにドンピシャな質問と回答があります。詳細はこの記事に譲るとして\n\n```\n\n System.gc();\n \n```\n\nを呼んだ時に記録されるもの、ということらしいです。申し訳ないですが、私自身が確かめたわけではありません。\n\nなお Google で `\"Full GC (System)\"` と言った感じでダブルクォーテーション付きで検索することで、この記事に行き当たりました。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T07:55:28.193", "id": "7137", "last_activity_date": "2015-02-26T08:00:57.610", "last_edit_date": "2017-05-23T12:38:56.083", "last_editor_user_id": "-1", "owner_user_id": "208", "parent_id": "7131", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7131</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7137</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1603"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7135", "answer_count": 1, "body": "macでAndroid Studioを起動した時に、選択しているクラスのメンバとメソッド一覧を表示する方法またはショートカットキーはありますか? \n`Android Stuido` -> `Preference` -> `Keymap` \nは参照しましたが、該当するキーを見つけられませんでした。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T07:32:34.840", "favorite_count": 0, "id": "7132", "last_activity_date": "2015-02-26T13:13:02.860", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "356", "post_type": "question", "score": 3, "tags": [ "android-studio" ], "title": "Android Studioでクラスのメンバとメソッド一覧を表示する方法", "view_count": 18856 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "※追記:キーを勘違いしていたので修正しました。 \n`⌘ (Command) + F12` でメンバ変数とメンバメソッドの一覧をポップアップさせることができます。 \n`⌘ (Command) + Shift + H` でメソッドヒエラルキーの表示を行います。\n\nこれでいかがでしょうか?\n\n* * *\n\n※追記\n\n参考:&lt;https://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard_Mac.pdf>\n\n上記は IntelliJ IDEA のショートカットキー一覧です。 \nAndroid Studio は IntelliJ IDEA をベースに Android 開発環境として特化した IDE なので、大方の keymap\nが一致します。 \n今後の参考になれば幸いです。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T07:50:03.450", "id": "7135", "last_activity_date": "2015-02-26T13:13:02.860", "last_edit_date": "2015-02-26T13:13:02.860", "last_editor_user_id": "7926", "owner_user_id": "7926", "parent_id": "7132", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7132</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7135</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7135</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1604"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7183", "answer_count": 2, "body": "アプリケーションでログイン機構を作るために、パスワードハッシュをDBに保存します。\n\nハッシュを生成する際、 salt を組み合わせたり、ストレッチングをするといいと聞きましたが、自分で実装するのは不安なので、\n`password_hash()` を使おうかと考えています。\n\n * [PHP: パスワードのハッシュ - Manual](http://php.net/manual/ja/faq.passwords.php)\n * [いまさら聞けないパスワードの取り扱い方](http://www.slideshare.net/ockeghem/ss-25447896/25)\n\nところが、[この関数のマニュアル](http://php.net/manual/ja/function.password-\nhash.php)にはこう書かれていました。\n\n> PASSWORD_BCRYPT を algo に指定すると、 password が最大 72 文字までに切り詰められます。\n\n調べてみると、この制約を回避するためにパスワードをあらかじめ別のハッシュ関数にかけておくとよい、という話が見つかりました。\n\n[password_hash()の重要な制限 | yohgaki's blog](http://blog.ohgaki.net/password_hash-\nimportant-limitation)\n\n追記:このあたりを書き直しました\n\nただこの記事を見たとき、この記事は `password_hash` に限定しているからこういう方法をとっているのではないかと思いました。\n\n72文字を超えるパスワードを許容し、尚かつほかの実装方法もいとわないのであれば、これは使わない方がいいのでしょうか。あるいはそういった前処理を加えたとしても、依然\n`password_hash` が推奨されるのでしょうか。\n\n// Openwall の PHPass がいいという話も見かけましたが、これも内部的に `$2a$` で `crypt()`\n関数を使っているようなので、同じ問題があると思っています。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T07:42:12.467", "favorite_count": 0, "id": "7133", "last_activity_date": "2019-02-27T02:26:34.160", "last_edit_date": "2015-02-27T04:00:20.193", "last_editor_user_id": "8000", "owner_user_id": "8000", "post_type": "question", "score": 10, "tags": [ "php" ], "title": "72文字を超えるパスワードを許容したい場合、password_hashを使うべきではない?", "view_count": 2236 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "「何を使うべきか」という質問であれば要件次第と言う答えにしかならないと思います\n\n * 73文字目以降が無視されるのは不可、複数のハッシュ関数を使うのは気持ち悪い→`crypt()`を使ってBROWFISH以外で自前実装。もしくはもっと低レイヤのハッシュ関数で自前実装\n * (この項について追記を読んでください)73文字目以降が無視されるのは不可だが複数のハッシュ関数という点は気にしない→ハッシュ関数を通してから`password_hash()`\n * 73文字目以降が無視されてもかまわない→そのまま`password_hash()`\n\nほとんどのアプリケーションでは72文字もあればパスワード強度としては十分でしょうから73文字以降が無視されたとしても現実的には問題ないと思います。\n\n* * *\n\n更新された質問に合わせて追記。\n\n`password_hash()`が依然としてベストプラクティスなのか、もしくはよりよい代替手段があるのか、ということですね。\n\n`password_hash()`を直接置き換える代替手段は提供されていない一方、`password_hash()`の文字数問題は前記の通り現実のアプリケーションに深刻な影響を与えるものとは言えず`password_hash()`を忌避する積極的な理由はないないので、結局は上に書いたとおりになると思います。\n\nいかなる場合もベストプラクティス、から、条件付きではあるがベストプラクティス、にニュアンスは変わっていますが、現実には深刻に捉えなければならない条件とは言えないので依然としてベストプラクティスには違いない、と言うことでいいのではないでしょうか。\n\n* * *\n\n余談。ASCIIの印字可能文字95種を72文字使うと約2.5e+142でbit数でいうと473bitになるので、SHA384とSHA512の間ぐらいになります。逆に、512bitを文字数に直すと78文字です。\n\n* * *\n\n(追記)PHPのbcrypt実装はバイナリセーフではないため、生のハッシュ値をpassword_hashに渡すと意図しない切り詰めが生じる場合があります。\n\n&lt;https://blog.tokumaru.org/2019/02/caution-bcrypt-with-sha512.html>\n\nハッシュ値をpassword_hashに渡すのは避けてください。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2015-02-27T03:20:46.550", "id": "7183", "last_activity_date": "2019-02-27T02:26:34.160", "last_edit_date": "2019-02-27T02:26:34.160", "last_editor_user_id": "5793", "owner_user_id": "5793", "parent_id": "7133", "post_type": "answer", "score": 9 }, { "body": "質問文にあるマニュアルのリンクに [ユーザーランドでの実装](https://github.com/ircmaxell/password_compat)\nがあったので、その近所を眺めていると、fork\n元がちょっと古いですが、[ここら](https://github.com/fredericve/password_compat) に crypt の\nSHA512 で真面目に実装してそうなものがあったりしました。\n\n最新のものにマージしても動きそうなので、独自実装をメンテする覚悟があるなら工夫してみるのも一つの手かもしれません。\n\n * 捨てコード\n``` &lt;?php\n\n require('lib/password.php');\n \n $pass = '0123456789012345678901234567890123456789012345678901234567890123456789012';\n \n $out = password_hash($pass, PASSWORD_DEFAULT);\n echo $out.\"\\n\";\n echo (password_verify($pass . \"test\", $out) ? \"true\" : \"false\") .\"\\n\";\n \n $out = password_hash($pass, PASSWORD_SHA512, array('rounds' => 8192));\n echo $out.\"\\n\";\n echo (password_verify($pass . \"test\", $out) ? \"true\" : \"false\") .\"\\n\";\n \n```\n\n * 実行\n``` $ php test.php\n\n $2y$10$xvbzRgk6P43krmuuV2bHE.4SYMHkiznz1eM628S1dknRRzQqIAVRm\n true\n $6$rounds=8192$32eHmy/jGehb/LS4$ICeAgh81FHnDEPSaUr8f4O9tk4l6EyDg0uif1r2XCSwcbpvLYYNltXB6QcyY6NARBLb6NzxBPKfbzw2DRyxrL/\n false\n $\n \n```\n\n以下は `git clone https://github.com/ircmaxell/password_compat` して\n[ここ](https://github.com/fredericve/password_compat/commit/9504ebcd1f0350b7e4f2c12bbe43f716bfaac8d9)\nとか\n[ここ](https://github.com/fredericve/password_compat/commit/11f8d5de164d96fe121a21ecc46f5ee6add2d910)\nを参考にしてお手当したものの `git diff`\n\n```\n\n diff --git a/lib/password.php b/lib/password.php\n index 805caa5..d2588a1 100644\n --- a/lib/password.php\n +++ b/lib/password.php\n @@ -17,6 +17,7 @@ namespace {\n * code.\n */\n define('PASSWORD_BCRYPT', 1);\n + define('PASSWORD_SHA512', 2);\n define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);\n define('PASSWORD_BCRYPT_DEFAULT_COST', 10);\n }\n @@ -67,6 +68,24 @@ namespace {\n // The expected length of the final crypt() output\n $resultLength = 60;\n break;\n + case PASSWORD_SHA512:\n + // Note that this is a C constant, but not exposed to PHP, so we don't define it here.\n + $rounds = 5000;\n + if (isset($options['rounds'])) {\n + $rounds = $options['rounds'];\n + if ($rounds &lt; 1000 || $rounds > 999999999) {\n + trigger_error(sprintf(\"password_hash(): Invalid sha512 rounds parameter specified: %d\", $rounds), E_USER_WARNING);\n + return null;\n + }\n + }\n + // The length of salt to generate\n + $raw_salt_len = 16;\n + // The length required in the final serialization\n + $required_salt_len = 22;\n + $hash_format = sprintf('$6$rounds=%d$', $rounds);\n + // The expected length of the final crypt() output\n + $resultLength = strlen($hash_format) + $raw_salt_len + 87;\n + break;\n default:\n trigger_error(sprintf(\"password_hash(): Unknown password hashing algorithm: %s\", $algo), E_USER_WARNING);\n return null;\n @@ -188,6 +207,11 @@ namespace {\n $return['algoName'] = 'bcrypt';\n list($cost) = sscanf($hash, \"$2y$%d$\");\n $return['options']['cost'] = $cost;\n + } else if (PasswordCompat\\binary\\_substr($hash, 0, 3) == '$6$') {\n + $return['algo'] = PASSWORD_SHA512;\n + $return['algoName'] = 'sha512';\n + list($rounds) = sscanf($hash, '$6$rounds=%d$');\n + $return['options']['rounds'] = $rounds;\n }\n return $return;\n }\n @@ -215,6 +239,12 @@ namespace {\n return true;\n }\n break;\n + case PASSWORD_SHA512:\n + $rounds = isset($options['rounds']) ? $options['rounds'] : 5000;\n + if ($rounds != $info['options']['rounds']) {\n + return true;\n + }\n + break;\n }\n return false;\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T08:19:14.527", "id": "7210", "last_activity_date": "2015-02-27T08:19:14.527", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2992", "parent_id": "7133", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7133</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7183</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7183</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1605"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7160", "answer_count": 2, "body": "`TableView`の各セルで横スクロールやページングを行いたいのですが、イマイチ考え方が分かりません。`Storyboard`に`UITableView`を乗せてその上に複数の`UITableViewCell`を乗せ、その各セル上に`UIScrollView`を置きました。それから`Storyboard`上の各`UIScrollView`に`UITableViewCell`を継承したクラスを紐付けました。一度この状態でビルドすると、空のセルを持った`TableView`が表示されるのですが、ここからどうすればいいのか分かりません。`TableView`の`cellForRowAtIndexPath`メソッド内で`ScrollView`に画像を置いたり、ページング処理を施すのでしょうか?または`UITableViewCell`を継承したクラス内で何か処理を行うのでしょうか?下に現在の途中まで書いているコードを記します。この先どういう風にプログラムを組んでいけばいいかアドバイスをいただきたいです。すみませんが、よろしくお願いします。\n\nViewController.h\n\n```\n\n @interface ViewController : UITableViewController\n \n @end\n \n```\n\nViewController.m\n\n```\n\n @interface ViewController () {\n \n IBOutlet UITableView *_tableView;\n }\n \n @end\n \n @implementation ViewController\n \n - (void)viewDidLoad {\n [super viewDidLoad];\n // Do any additional setup after loading the view, typically from a nib.\n \n UINib *nib = [UINib nibWithNibName:NSStringFromClass([PagerCell class]) bundle:nil];\n [_tableView registerNib:nib forCellReuseIdentifier:@\"cell\"];\n }\n \n - (void)didReceiveMemoryWarning {\n [super didReceiveMemoryWarning];\n // Dispose of any resources that can be recreated.\n }\n \n - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {\n return 4;\n }\n \n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n PagerCell *cell = [tableView dequeueReusableCellWithIdentifier:@\"cell\"];\n \n if (!cell) {\n cell = [[PagerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@\"cell\"];\n }\n \n switch (indexPath.row) {\n case 0:\n [self setTopPager];\n break;\n \n default:\n \n break;\n }\n \n return cell;\n }\n \n - (void)setTopPager {\n PagerCell *pagerCell = [[PagerCell alloc]init];\n [pagerCell setTopPager:self.view];\n }\n \n @end\n \n```\n\nPagerCell.h\n\n```\n\n @interface PagerCell : UITableViewCell\n \n @property (weak, nonatomic) IBOutlet UIScrollView *pager;\n \n - (void)setTopPager:(UIView*)_view;\n \n @end\n \n```\n\nPagerCell.m\n\n```\n\n @implementation PagerCell\n \n - (void)awakeFromNib {\n // Initialization code\n }\n \n - (void)setSelected:(BOOL)selected animated:(BOOL)animated {\n [super setSelected:selected animated:animated];\n \n // Configure the view for the selected state\n }\n \n - (void)setTopPager:(UIView*)_view {\n NSArray* imageNames = [NSArray arrayWithObjects:@\"android.png\", @\"android.png\", @\"android.png\", @\"android.png\", @\"android.png\", @\"android.png\", @\"android.png\", @\"android.png\", @\"android.png\", @\"android.png\", nil];\n int imageNum = [imageNames count];\n for (int i=0; i &lt; imageNum; i++) {\n UIImage* image = [UIImage imageNamed:[imageNames objectAtIndex:i]];\n UIImageView* imageView = [[UIImageView alloc] initWithImage:image];\n CGSize size = CGSizeMake(100, 100);\n imageView.frame = CGRectMake(160*i + (160 - size.width) / 2, 0 + (180 - size.height) / 2, size.width, size.height);\n [self.pager addSubview:imageView];\n }\n [self.pager setContentSize:CGSizeMake(100*imageNum, 120)];\n [_view addSubview:self.pager];\n }\n \n @end\n \n```", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T07:45:16.700", "favorite_count": 0, "id": "7134", "last_activity_date": "2015-02-27T01:09:35.607", "last_edit_date": "2015-02-26T22:57:55.727", "last_editor_user_id": "5210", "owner_user_id": "5210", "post_type": "question", "score": 1, "tags": [ "objective-c", "uitableview", "uiscrollview" ], "title": "TableViewの各セルで横スクロールやページング処理をしたい", "view_count": 1162 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "returnのcellがUITableViewCellのままなので、こんな感じでできるのではないでしょうか?\n\n```\n\n PagerCell *cell = [tableView dequeueReusableCellWithIdentifier:@\"cell\"];\n \n if (!cell) {\n cell = [[PagerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@\"cell\"];\n }\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T10:12:45.633", "id": "7146", "last_activity_date": "2015-02-26T10:12:45.633", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8567", "parent_id": "7134", "post_type": "answer", "score": 1 }, { "body": ">\n> TableViewのcellForRowAtIndexPathメソッド内でScrollViewに画像を置いたり、ページング処理を施すのでしょうか?またはUITableViewCellを継承したクラス内で何か処理を行うのでしょうか?\n\n後者(カスタムセル側で処理)の方が良いと思います。 \ncellForRowAtIndexPath内でカスタムセルに表示したいデータを渡して、 \nデータの加工や表示についてはカスタムセル側に任せた方が見やすいし変更もしやすいです。\n\nまた、個人的にはカスタムセル側で色々な処理をしたい場合は、別途`xib`を作成してカスタムセルと紐付ける方がやりやすいと思います。 \n※この場合は`Storyboard`上に`CustomCell`を配置する必要はありません。\n\nざっくり書くとこんな感じです。 \n※セルの再利用とかは考慮していません。\n\nViewController.m\n\n```\n\n - (void)viewDidLoad\n {\n [super viewDidLoad];\n // セルを登録\n UINib *nib = [UINib nibWithNibName:NSStringFromClass([CustomCell class]) bundle:nil];\n [_tableView registerNib:nib forCellReuseIdentifier:@\"cell\"];\n }\n \n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\n {\n CustomCell* cell = [tableView dequeueReusableCellWithIdentifier:@\"cell\" forIndexPath:indexPath];\n \n // 表示要素を設定\n [cell setElementsValue:datasource_[indexPath.row]];\n return cell;\n }\n \n```\n\nCustomCell.h\n\n```\n\n @interface CustomCell : UITableViewCell\n \n - (void)setElementsValue:(NSDictionary *)dic;\n \n @end \n \n```\n\nCustomCell.m\n\n```\n\n @interface CustomCell ()\n \n @property (weak, nonatomic) IBOutlet UILabel *title;\n @property (weak, nonatomic) IBOutlet UILabel *body;\n \n @end \n \n @implementation CustomCell\n \n - (void)setElementsValue:(NSDictionary *)dic\n {\n // タイトル\n [self setTitleText:dic[@\"title\"]];\n // 本文\n [self setBodyText:dic[@\"body\"]];\n }\n \n // タイトル設定\n - (void)setTitleText:(NSString *)text\n {\n _title.text = text;\n }\n \n // 本文設定\n - (void)setBodyText:(NSString *)text\n {\n _body.text = text;\n }\n \n // その他スクロール処理等\n \n @end\n \n```\n\n----- 質問追記部分に対する追記 -----\n```\n\n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n PagerCell *cell = [tableView dequeueReusableCellWithIdentifier:@\"cell\"];\n \n if (!cell) {\n cell = [[PagerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@\"cell\"];\n }\n \n switch (indexPath.row) {\n case 0:\n [self setTopPager];\n break;\n \n default:\n \n break;\n }\n \n return cell;\n }\n \n - (void)setTopPager {\n PagerCell *pagerCell = [[PagerCell alloc]init];\n [pagerCell setTopPager:self.view];\n }\n \n```\n\nここの処理がおかしいです。 \nせっかく`cellForRowAtIndexPath`内で`tableView`に紐付けたセルを取得しているのに \n`setTopPager`で不要なインスタンスを新たに作成しています。 \nまた`PagerCell`の`setTopPager`を不要なインスタンス側で実行しているため、 \n`tableView`に紐付けたセル側では何も起きません。\n\nこの辺りは`UITableView`を使用する際には重要な知識だと思いますので、 \n基本的な使い方を再確認しておくと良いと思います。", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T15:46:34.563", "id": "7160", "last_activity_date": "2015-02-27T01:09:35.607", "last_edit_date": "2015-02-27T01:09:35.607", "last_editor_user_id": "3516", "owner_user_id": "3516", "parent_id": "7134", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7134</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7160</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7146</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1606"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 2, "body": "WindowsPC/AndroidごとにWebページを用意するのではなく、 \n両方から1つのWebページを表示したいです。\n\nPCはWebページを参照するだけなのですが、タブレットはHTML5でバーコードをスキャンもさせたいです。\n\n① WindowsPC/AndroidでWebページを共有する際に発生する問題を教えて下さい。 \n→ レイアウトが崩れたりしませんか?ボタンサイズの問題 etc...\n\n② HTML5を使ってバーコードスキャンって、実際どうなんですか? \n→ HTML5を使ってバーコードスキャンするよりも、javaでAndroidアプリを作る方が安全だと思うんです", "comment_count": 5, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T07:50:24.527", "favorite_count": 0, "id": "7136", "last_activity_date": "2020-01-13T01:15:02.103", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8247", "post_type": "question", "score": -1, "tags": [ "android", "java", "html5" ], "title": "WindowsPC/Androidタブレットで同じWebページを表示したい", "view_count": 229 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "取りあえず、PCとスマホ兼用のページを作るのは如何でしょう? \n例えば、ALLAboutさんが「レスポンシブな2カラムレイアウトを作るCSSの書き方」 \nというのを書かれています。(2019年11月20日現在) \n&lt;https://allabout.co.jp/gm/gc/463388/> \nこれは、PC用とモバイル用と、css を別けるだけで、1つのhtml を兼用出来ます。 \n片方だけに必要なリンクを表示させることも出来ます。 \nただ、PCではメニューは左右・スマホでは上下等、 \n兼用出来るレイアウトを考える必要はあります。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2019-11-20T15:58:41.843", "id": "60707", "last_activity_date": "2019-11-20T16:21:05.493", "last_edit_date": "2019-11-20T16:21:05.493", "last_editor_user_id": "36568", "owner_user_id": "36568", "parent_id": "7136", "post_type": "answer", "score": 0 }, { "body": "WindowsPC/AndroidごとにWebページを用意するのではなく、 \n両方から1つのWebページを表示したいとのことですが、WordPressで作成すると、 \nPCではPCのフォーマットで、スマホではスマホのフォーマットで \n表示されるサイトを作ることができます。 \nこのようなやり方ではだめですか?", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2020-01-13T01:15:02.103", "id": "62198", "last_activity_date": "2020-01-13T01:15:02.103", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "24490", "parent_id": "7136", "post_type": "answer", "score": 0 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7136</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">60707</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1607"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7505", "answer_count": 2, "body": "[`ArrayAdapter`](http://developer.android.com/reference/android/widget/ArrayAdapter.html)\nのサブクラスで `getView` が呼び出される際、コンストラクタで渡した`ArrayList` のsize に関わらず position は 0\nのままで、 `ListView` に `ArrayList` の2つ目以降のアイテムのViewが渡されません。\n\nレイアウトは ListView1 が ListView2 を持つ入れ子の構造で、 ListView1 は問題なく動作しますが、 ListView2\nは上記のような状態です。\n\n```\n\n private class DayAdapter extends ArrayAdapter&lt;DayData> { \n private LayoutInflater inflater;\n private class ViewHolder{\n TextView textDate;\n ListView listItem;\n TextView textBalance;\n \n ViewHolder(View view){\n this.textDate = (TextView) view.findViewById(R.id.txtDate);\n this.listItem = (ListView) view.findViewById(R.id.lstItem);\n this.textBalance = (TextView) view.findViewById(R.id.txtBalance);\n }\n } \n \n public DayAdapter(Context context, int textViewResourceId, List&lt;DayData> objects) {\n super(context, textViewResourceId, objects);\n this.inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n }\n \n @Override\n // こちらのpositionは更新される\n public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder;\n \n if(convertView == null){\n convertView = inflater.inflate(R.layout.day, null);\n holder = new ViewHolder(convertView);\n convertView.setTag(holder);\n }else{\n holder = (ViewHolder)convertView.getTag();\n }\n \n DayData day = (DayData)getItem(position);\n if(day != null){ \n holder.textDate.setText(day.GetStringDate());\n holder.textBalance.setText(day.GetStringBalance());\n \n Log.d(\"ItemAdapter\", \"size=\"+day.GetItemList().size());\n ItemAdapter adapter = new ItemAdapter(Diary.this, 0, day.GetItemList());\n holder.listItem.setAdapter(adapter);\n }\n return convertView;\n }\n } \n \n private class ItemAdapter extends ArrayAdapter&lt;ItemData> {\n private LayoutInflater inflater;\n private class ViewHolder{\n TextView textDate;\n TextView textItem;\n TextView textPrice;\n \n ViewHolder(View view){\n this.textDate = (TextView) view.findViewById(R.id.textView1);\n this.textItem = (TextView) view.findViewById(R.id.textView2);\n this.textPrice = (TextView) view.findViewById(R.id.textView3);\n }\n }\n \n public ItemAdapter(Context context, int textViewResourceId, List&lt;ItemData> objects) {\n super(context, textViewResourceId, objects);\n this.inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n }\n \n @Override\n // こちらのpositionは0のまま\n public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder;\n if(convertView == null){\n convertView = inflater.inflate(R.layout.row, null);\n holder = new ViewHolder(convertView);\n convertView.setTag(holder);\n }else{\n holder = (ViewHolder)convertView.getTag();\n }\n \n Log.d(\"getView()\", \"position=\"+position);\n ItemData item = (ItemData)getItem(position);\n if(item != null){ \n holder.textDate.setText(item.GetStringDate());\n holder.textItem.setText(item.GetItem()); \n \n String sign = \"\";\n if(item.GetPrice() > 0) sign = \"+\";\n holder.textPrice.setText(sign + Integer.toString(item.GetPrice()) + \"円\");\n }\n return convertView;\n }\n }\n \n```\n\nday.xml\n\n```\n\n &lt;?xml version=\"1.0\" encoding=\"utf-8\"?>\n &lt;LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"vertical\" >\n \n &lt;TextView \n android:textSize=\"16sp\" \n android:id=\"@+id/txtDate\" \n android:layout_height=\"wrap_content\" \n android:layout_width=\"match_parent\"\n android:background=\"#003300\"\n android:textColor=\"#FFFFFF\" />\n \n &lt;ListView\n android:id=\"@+id/lstItem\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\" >\n &lt;/ListView>\n \n &lt;TextView \n android:textSize=\"16sp\" \n android:id=\"@+id/txtBalance\" \n android:layout_height=\"wrap_content\" \n android:layout_width=\"match_parent\"\n android:background=\"#33CC00\" />\n \n &lt;/LinearLayout>\n \n```\n\nrow.xml\n\n```\n\n &lt;?xml version=\"1.0\" encoding=\"utf-8\"?>\n &lt;LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"horizontal\" >\n \n &lt;TextView \n android:textSize=\"16sp\" \n android:id=\"@+id/textView1\" \n android:layout_height=\"wrap_content\" \n android:layout_width=\"0dp\"\n android:layout_weight=\"1\"/> \n &lt;TextView \n android:textSize=\"16sp\" \n android:id=\"@+id/textView2\" \n android:layout_height=\"wrap_content\" \n android:layout_width=\"0dp\"\n android:layout_weight=\"1\"/>\n &lt;TextView \n android:textSize=\"16sp\" \n android:id=\"@+id/textView3\" \n android:layout_height=\"wrap_content\" \n android:layout_width=\"0dp\"\n android:layout_weight=\"1\"/>\n \n &lt;/LinearLayout>\n \n```\n\nこの場合どのような原因が考えられるでしょうか?", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T09:37:36.510", "favorite_count": 0, "id": "7143", "last_activity_date": "2015-03-05T21:25:37.377", "last_edit_date": "2015-03-05T21:25:37.377", "last_editor_user_id": "5750", "owner_user_id": "8560", "post_type": "question", "score": 2, "tags": [ "android", "java", "android-layout" ], "title": "ArrayAdapter のサブクラス内の getView() の引数 position が 0 のままで加算されない", "view_count": 8531 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "原因は、ListView2 (@id/lstItem) の layout_height が wrap_content\nであるためではないでしょうか。リストビューの高さは子要素によって計算することができないため固定値または match_parent にする必要があります。\n\n下に TextView を続けるなら RelativeLayout に変えて、以下のようにすればなんとかなるのではないかと思います。\n\n```\n\n &lt;ListView\n android:id=\"@+id/lstItem\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:layout_below=\"@+id/txtDate\"\n android:layout_above=\"@+id/txtBalance\">\n &lt;/ListView>\n \n &lt;TextView \n android:textSize=\"16sp\" \n android:id=\"@+id/txtBalance\" \n android:layout_height=\"wrap_content\" \n android:layout_width=\"match_parent\"\n android:layout_alignParentBottom=\"true\"\n android:background=\"#33CC00\" />\n \n```\n\nただ、リストビューの入れ子というのはスクロールの面で難儀しそうなので、他の方法を取られたほうが得策かなという気はしますね。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T10:36:09.127", "id": "7147", "last_activity_date": "2015-02-26T10:46:18.497", "last_edit_date": "2015-02-26T10:46:18.497", "last_editor_user_id": "7558", "owner_user_id": "7558", "parent_id": "7143", "post_type": "answer", "score": 0 }, { "body": "## なぜか\n\n`position`値がゼロのままになる理由を説明します。 \nListViewにセットされた`ArrayAdapter`の`getView()`が呼び出されるのは、ListViewがスクロールされて画面内にはいってきた子要素に対応する`View`が必要になったタイミングです。 \nしたがって、`ListView`の初期状態に要素1個しか表示できない状態の場合、スクロールしないかぎり次の`getView()`は呼び出されません。\n\n## どのようにすればよいか\n\n今回は、内側の`ListView`をスクロールしたくないので、簡単にするために`LinearView`に置き換えれば良いです。\n\n`day.xml`レイアウトを変更。\n\n```\n\n &lt;?xml version=\"1.0\" encoding=\"utf-8\"?>\n &lt;LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"vertical\" >\n &lt;TextView\n android:textSize=\"16sp\"\n android:id=\"@+id/txtDate\"\n android:layout_height=\"wrap_content\"\n android:layout_width=\"match_parent\"\n android:background=\"#003300\"\n android:textColor=\"#FFFFFF\" />\n &lt;!-- スクロールもさせないし中身の再利用もできないのであればLinearLayoutで良い -->\n &lt;LinearLayout\n android:orientation=\"vertical\"\n android:id=\"@+id/lstItem\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\" >\n &lt;/LinearLayout>\n &lt;TextView\n android:textSize=\"16sp\"\n android:id=\"@+id/txtBalance\"\n android:layout_height=\"wrap_content\"\n android:layout_width=\"match_parent\"\n android:background=\"#33CC00\" />\n &lt;/LinearLayout>\n \n```\n\n`DayAdapter#getView()`を以下のように修正(ブロックコメントの箇所のみ)。\n\n```\n\n @Override\n // こちらのpositionは更新される\n public View getView(int position, View convertView, ViewGroup parent) {\n ViewHolder holder;\n \n if(convertView == null){\n convertView = inflater.inflate(R.layout.day, null);\n holder = new ViewHolder(convertView);\n convertView.setTag(holder);\n }else{\n holder = (ViewHolder)convertView.getTag();\n }\n \n DayData day = (DayData)getItem(position);\n if(day != null){\n holder.textDate.setText(day.GetStringDate());\n holder.textBalance.setText(day.GetStringBalance());\n \n Log.d(\"ItemAdapter\", \"size=\"+day.GetItemList().size());\n ItemAdapter adapter = new ItemAdapter(Diary.this, 0, day.GetItemList());\n \n /* listItemをクリアしてからadapterでrowレイアウトを必要なだけ作って追加する */\n holder.listItem.removeAllViews();\n for (int i = 0; i&lt;adapter.getCount(); i++) {\n holder.listItem.addView(\n adapter.getView(i, null, holder.listItem)\n );\n }\n }\n return convertView;\n }\n \n```\n\n実害は無いと思いますが、制限事項が1つあります。 \n上記のようにすると、外側の`ListView`の子要素の大きさが変わるたびにスクロールバーの長さを再計算するので、スクロールすると、スクロールバーが伸びたり縮んだりします。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-05T16:26:07.427", "id": "7505", "last_activity_date": "2015-03-05T16:26:07.427", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7572", "parent_id": "7143", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7143</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7505</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7505</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1608"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "WebViewでメールの添付ファイルをダウンロードしたいのですが、FileNotFoundExceptionのエラーが出ます。 \nちなみにテストはoutlookでしています。\n\nコード: \nImageGetTask.java\n\n```\n\n InputStream is;\n String url = \"https://example.com\";\n try {\n URL u = new URL(url);\n HttpURLConnection con = (HttpURLConnection) u.openConnection();\n con.setRequestMethod(\"GET\");\n con.setDoOutput(true);\n con.connect();\n int responseCode = con.getResponseCode();\n if (responseCode >= 400 &amp;&amp; responseCode &lt;= 499) {\n }else{\n is = con.getInputStream();\n String path = Environment.getExternalStorageDirectory() + \"/apdroid/\";\n String fileName = url.substring(url.lastIndexOf('/') + 1);\n File dir = new File(path);\n dir.mkdirs();\n File outputFile = new File(dir, fileName);\n FileOutputStream fos = new FileOutputStream(outputFile);\n \n byte[] buffer = new byte[1024];\n int len = 0;\n while ((len = is.read(buffer)) != -1) {\n fos.write(buffer, 0, len);\n }\n fos.close();\n is.close();\n \n image = BitmapFactory.decodeStream(is);\n }\n return image;\n \n }catch (IOException e) {\n e.printStackTrace();\n }\n \n```\n\n* * *\n\nこちらのコードに変更してやってみたらダウンロードはできるのですが、画像形式ではなくてHtmlで保存されてしまします。\n\n```\n\n Request request = new Request(Uri.parse(url));\n request.allowScanningByMediaScanner();\n request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);\n request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, \"download\");\n request.setVisibleInDownloadsUi(false);\n request.setDescription(contentDisposition);\n downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);\n query = new DownloadManager.Query();\n // ダウンロードフラグ\n query.setFilterByStatus(DownloadManager.STATUS_FAILED);\n query.setFilterByStatus(DownloadManager.STATUS_SUCCESSFUL);\n downloadid = downloadManager.enqueue(request);\n \n receiver = new BroadcastReceiver(){\n @Override\n public void onReceive(Context context, Intent intent) {\n String action = intent.getAction();\n if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {\n \n long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);\n Log.d(\"xxx\", \"End Download download Id = \" + id);\n \n query.setFilterById(id);\n Cursor c = downloadManager.query(query);\n \n if(c.moveToFirst()) {\n int status = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_STATUS));\n int reason = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_REASON));\n Log.d(\"status\", Integer.toString(status));\n Log.d(\"reason\", Integer.toString(reason));\n \n // ダウンロードに失敗した場合\n if (status == DownloadManager.STATUS_FAILED) {\n downloadManager.remove(downloadid);\n \n // ダウンロードに成功した場合\n } else if (status == DownloadManager.STATUS_SUCCESSFUL) {\n Log.d(\"\",\"SECCUSS\");\n try {\n ParcelFileDescriptor file =\n downloadManager.openDownloadedFile(downloadid);\n FileInputStream files =\n new ParcelFileDescriptor.AutoCloseInputStream(file);\n imageView.setImageBitmap(BitmapFactory.decodeStream(files));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n \n }\n }\n c.close();\n \n }\n }\n };\n registerReceiver(receiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T09:39:33.453", "favorite_count": 0, "id": "7144", "last_activity_date": "2016-03-25T04:11:18.843", "last_edit_date": "2015-02-28T14:14:45.023", "last_editor_user_id": "30", "owner_user_id": "8567", "post_type": "question", "score": 3, "tags": [ "java", "webview", "exception" ], "title": "FileNotFoundException:添付ファイルをダウンロード", "view_count": 670 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "DownloadManagerのことを調べていたらたどり着きました。 \nこちらの質問は9か月前のものなのですでに何かしら解決しているかわかりませんが、 \n多分私も以前似たような経験をしたので回答します。\n\nログインしておかなければ取得できないファイルを取得しようとしてはいませんか?\n\n私はそのファイルをAndroidアプリでWebViewからAsyncTaskでHttpURLConnectionなどを利用してダウンロードしようとした時、自分が指定したjpgファイルとして保存されたものの開くことができませんでした。 \nそのファイルをMacへ取り出して確かテキストエディタで見たところ、HTML形式で取得されていることがわかりました。 \n拡張子を変えてブラウザで見てみると、「アクセスするにはログインが必要です」的なログインフォームが表示されていました。\n\nfumikiさんがWebViewで何をしているかはわかりませんが、私の場合はWebViewでログイン処理を済ませていたので、その時のCookieをHttpURLConnectionに設定することにより無事画像としてダウンロードすることができたので、それを試してみるといいと思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-11-26T02:02:47.323", "id": "19308", "last_activity_date": "2015-11-26T02:02:47.323", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9710", "parent_id": "7144", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7144</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">19308</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1609"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7167", "answer_count": 2, "body": "Nagios を使って HTTP や HTTPS のコンテンツが変更されたことを \n検知する仕組みはどのようにすれば実現できるでしょうか。\n\ncheck_http には次のオプションがあり、「指定した時間より古い場合に警告」という動作をします。\n\n```\n\n -M, --max-age=SECONDS\n \n```\n\nこれとは逆に「新しい場合に警告」という動作ができれば問題を解決できると思っていますが実現方法がわかりません。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T10:05:55.183", "favorite_count": 0, "id": "7145", "last_activity_date": "2021-11-01T00:19:12.787", "last_edit_date": "2021-11-01T00:19:12.787", "last_editor_user_id": "3060", "owner_user_id": "5008", "post_type": "question", "score": 2, "tags": [ "linux", "http", "monitoring" ], "title": "Nagios で HTTP コンテンツが変更されたことを検知したい", "view_count": 584 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "別途、\"wget -N\" などでコンテンツをダウンロードしてから check_file_age でどうでしょうか。\n\nあるいは、ハッシュ値などを計算・保存しておいて、前回のものと比べる方法が考えられます。 \nNagios は過去の値を保存して比較するような用途には向いていませんが、プラグイン側で工夫すればできそうです。\n\n直接ファイルを参照できるのであれば、Tripwire, AIDE などの改竄検知ツールが良いと思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T15:23:30.153", "id": "7159", "last_activity_date": "2015-02-26T15:23:30.153", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4603", "parent_id": "7145", "post_type": "answer", "score": 1 }, { "body": "Nagiosのpluginはしかるべきステータスコードを返すプログラムというだけなので、たいていのことはちょっとしたシェルスクリプト程度で監視できます。\n\n```\n\n #!/bin/sh\n \n HOST=$1\n URL=$2\n \n SAVE=/var/tmp/${HOST}\n \n new_data=`curl -s $URL |sha256sum`\n new_data=`echo $new_data` #空白よけ\n \n if [ ! -e $SAVE ]; then\n status=3 #UNKNOWN\n else\n old_data=`cat $SAVE`\n \n if [ \"$old_data\" = \"$new_data\" ]; then\n status=0 #OK\n else\n status=2 #CRITICAL\n fi\n fi\n \n echo $new_data > $SAVE\n exit $status\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T01:44:11.530", "id": "7167", "last_activity_date": "2015-02-27T01:44:11.530", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5793", "parent_id": "7145", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7145</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7167</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7167</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1610"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7157", "answer_count": 1, "body": "Android StudioでModuleが2つある場合の優先順位についてです。\n\n1つのプロジェクトにappというアプリケーションとhogeというライブラリが存在しています。 \nappはbuild.gradleで`build.apply plugin: 'com.android.application'`宣言をしており \nhogeはbuild.gradleで`build.apply plugin: 'com.android.library'`宣言しています。 \napp、hogeともにjavaソース、res配下のvaluesやlayout、AndroidManifest.xmlを保持しています。\n\nProject Structureでappからhogeへの関連付けを行いappのコードでhogeを呼び出して実行していますが。 \nappの`values` -> `string.xml`がhogeのstring.xmlで実行時に上書きされているようで \n`string.xml`のapp_nameなどがhogeの値になっているので、 \nappの`string.xml`を優先するにするにはどんな関連付けを行えばよいでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T10:48:39.540", "favorite_count": 0, "id": "7148", "last_activity_date": "2015-03-04T16:07:59.127", "last_edit_date": "2015-02-26T14:05:42.403", "last_editor_user_id": "7572", "owner_user_id": "356", "post_type": "question", "score": 2, "tags": [ "android", "android-studio", "gradle" ], "title": "Androidでライブラリのstring.xmlが優先される問題", "view_count": 1651 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "Android Developers「[Managing Projects\nOverview](http://developer.android.com/tools/projects/index.html#LibraryProjects)」の抜粋です。\n\n> ### Resource conflicts\n>\n> Since the tools merge the resources of a library module with those of a\n> dependent application module, a given resource ID might be defined in both\n> modules. In this case, the tools select the resource from the application,\n> or the library with highest priority, and discard the other resource. As you\n> develop your applications, be aware that common resource IDs are likely to\n> be defined in more than one project and will be merged, with the resource\n> from the application or highest-priority library taking precedence.\n>\n> ### Use prefixes to avoid resource conflicts\n>\n> To avoid resource conflicts for common resource IDs, consider using a prefix\n> or other consistent naming scheme that is unique to the module (or is unique\n> across all project modules).\n\n要約すると、同じリソースIDがあると競合(ライブラリのものが優先される)するので気をつけましょう。モジュールごとに一貫性のあるプレフィクスを付ける等して衝突しないようにしたりする事も検討しましょう、とのこと。\n\n編集:認識違い・訳違いについてコメント頂いたので、原文段落を追加、要約に留めました。", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T15:01:26.580", "id": "7157", "last_activity_date": "2015-03-04T16:07:59.127", "last_edit_date": "2015-03-04T16:07:59.127", "last_editor_user_id": "7572", "owner_user_id": "7572", "parent_id": "7148", "post_type": "answer", "score": 5 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7148</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7157</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7157</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1611"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7201", "answer_count": 2, "body": "お世話になります\n\niOS8でadmobの6はサポートされてないよってログに出てくるので、7にしようと思ってます。 \nで、cocoapodsでインストールしてるのですが、 \nHeader Search Pathにある、admobのパスには、admobのファイルはおらず \n以下のエラーで困っております\n\n```\n\n 'GADBannerView.h' file not found\n \n```\n\nちなみに、現状はこちらです\n\n```\n\n {15-02-26 20:06}[ruby-2.1.0]server:~/Documents/NeoCafesagashi2015@master✗✗✗✗✗✗ shiratsu% open NeoCafesagashi2015.xcworkspace\n {15-02-26 20:08}[ruby-2.1.0]server:~/Documents/NeoCafesagashi2015@master✗✗✗✗✗✗ shiratsu% ls Pods/Headers/Public\n FMDB PonyDebugger SMCalloutView SocketRocket\n {15-02-26 20:10}[ruby-2.1.0]server:~/Documents/NeoCafesagashi2015@master✗✗✗✗✗✗ shiratsu% cat Podfile\n source 'https://github.com/CocoaPods/Specs.git'\n \n platform :ios, '7.0'\n \n pod 'Google-Mobile-Ads-SDK', '~> 7.0'\n pod 'SMCalloutView'\n pod 'PonyDebugger'\n pod 'FMDB'\n \n```\n\nヘッダサーチパスは以下です\n\n```\n\n \"${PODS_ROOT}/Headers/Public/Google-Mobile-Ads-SDK\"\n \n```\n\nたしかにそんなとこには、ないので、直接、admobのファイルがある場所に向けたのですが、 \n今度は、Admobが二重で定義されてると怒られ、もう何が何だかわからず。。。\n\n```\n\n import \"GADBannerView.h\"\n \n static const CGFloat CalloutYOffset = 10.0f;\n static NSString * const urlKey = @\"url\";\n \n @interface ViewController ()&lt;GMSMapViewDelegate>\n {\n BOOL _pinclflag;\n }\n \n```\n\nよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T11:20:58.487", "favorite_count": 0, "id": "7150", "last_activity_date": "2015-03-03T01:23:35.313", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "403", "post_type": "question", "score": 1, "tags": [ "xcode", "xcode6", "ios8", "admob" ], "title": "iOSでAdmobを最新にしたらエラー", "view_count": 1850 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "おそらくframeworkへ変更されたことが原因ではないでしょうか? \n”Release Notes”にあるように7.0.0から”Released SDK as a\nframework.”へ変更されています。それに伴いCocoapodsで追加されるファイルもframeworkへ変更されています。\n\n```\n\n //#import \"GADBannerView.h\"\n #import &lt;GoogleMobileAds/GADBannerView>\n \n```", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T06:19:54.487", "id": "7201", "last_activity_date": "2015-02-27T06:19:54.487", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4551", "parent_id": "7150", "post_type": "answer", "score": 2 }, { "body": "xcodeで`.h`ファイルを追加する必要があります。 \nGoogleMobileAds/GADBannerView.h", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T03:27:39.650", "id": "7310", "last_activity_date": "2015-03-03T01:23:35.313", "last_edit_date": "2015-03-03T01:23:35.313", "last_editor_user_id": "3313", "owner_user_id": "8632", "parent_id": "7150", "post_type": "answer", "score": -1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7150</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7201</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7201</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1612"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7156", "answer_count": 2, "body": "Djangoでモデルを作るとき、\n\n```\n\n class UserCustom(models.Model):\n hoge = models.AutoField(primary_key=True, help_text='hogeを入力して下さい', verbose_name=u'別名')\n \n```\n\nのようにすれば、別名をつけることが出来ます。\n\n```\n\n class UserCustom(models.Model):\n hoge = models.AutoField(primary_key=True, help_text='hogeを入力して下さい', verbose_name=u'別名')\n def custom_column(self):\n return 'bar'\n \n```\n\nのようにcustom_columnを追加した時に、 \ncustom_columnに別名を付けたいです。 \n※このテクニックをカスタムカラムというのかわかりませんが、便宜上こう名づけました。\n\n情報が無いため試しにこれらを行ってみましたが、\n\n```\n\n def custom_column(self):\n class Meta:\n verbose_name = u'カスタムカラム'\n \n```\n\nや\n\n```\n\n def custom_column(self):\n self.verbose_name = u'カスタムカラム'\n \n```\n\nダメでした。 \nよろしくおねがいします。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T12:17:20.573", "favorite_count": 0, "id": "7151", "last_activity_date": "2015-04-01T04:49:55.200", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7934", "post_type": "question", "score": 0, "tags": [ "python", "sqlite", "django" ], "title": "Djangoでモデルのカスタムカラムに名前を付けたい", "view_count": 1554 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "`admin.py`の`admin.ModelAdmin`で定義するようです:\n\n```\n\n class UserCustomAdmin(admin.ModelAdmin):\n list_display = (..., 'custom_column',)\n \n def custom_column(self):\n return 'bar'\n \n```\n\n参照 \n&lt;https://stackoverflow.com/a/2156277/24718>", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T14:56:39.123", "id": "7156", "last_activity_date": "2015-03-02T01:05:33.553", "last_edit_date": "2017-05-23T12:38:56.467", "last_editor_user_id": "-1", "owner_user_id": "2314", "parent_id": "7151", "post_type": "answer", "score": 1 }, { "body": "`メソッド名.short_description`を定義すれば、管理サイトのカラムのタイトルが変更できます。\n\nmodels.py\n\n```\n\n class UserCustom(models.Model):\n ...\n def custom_column(self):\n return 'bar'\n custom_column.short_description = u'カスタムカラム'\n \n```\n\nadmin.py\n\n```\n\n list_display = ('custom_column', ... )\n \n```\n\n参考URL: [Django admin サイト](http://django-docs-\nja.readthedocs.org/en/latest/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-04-01T04:49:55.200", "id": "8638", "last_activity_date": "2015-04-01T04:49:55.200", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9044", "parent_id": "7151", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7151</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7156</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7156</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1613"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7164", "answer_count": 1, "body": "初心者です。RoRでチャットを作っています。下記のコードで走らせても思ったように動きません。どこに問題がありますか?\n\nユーザーの新規のpostを1秒ごとに取得して、render_to_stringした後で送信しています。クライアント側では、それをpostが表示される\"post-\nlist\"にappendしています。しかし、ユーザーがpostを作成しても、作成は成功しますが、表示がされません。\n\n**chats.coffee**\n\n```\n\n $ ->\n chat_id = $(\"chat_id\").text()\n eventSource = new EventSource(chat_id+\"/stream\")\n eventSource.addEventListener 'push', (event) ->\n post = event.data\n $('#post-list').append(post)\n \n```\n\n**chats.controller.rb**\n\n```\n\n include ActionController::Live\n def stream\n @chat = Chat.find(params[:id])\n response.headers['Content-Type'] = 'text/event-stream'\n start = Time.zone.now\n loop do\n Post.uncached do\n Post.where('created_at > ?', start).where('chat_id = ?', @chat.id).each do |post|\n html = render_to_string partial:'shared/_post.html.erb', object:post\n response.stream.write(\"event:push\\n\")\n response.stream.write(\"data:#{html}\\n\\n\")\n start = post.created_at\n end\n end \n sleep 1\n end\n rescue\n ensure\n response.stream.close\n end\n \n```\n\nお願いします。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T12:59:26.813", "favorite_count": 0, "id": "7152", "last_activity_date": "2015-02-26T22:17:23.190", "last_edit_date": "2015-02-26T17:38:20.977", "last_editor_user_id": null, "owner_user_id": null, "post_type": "question", "score": 2, "tags": [ "javascript", "ruby-on-rails", "coffeescript" ], "title": "ActionController::Liveとjavascriptがうまく働かない", "view_count": 172 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "`ActionController::Live`は使ったことがないのですが、「ActionController::Live render\nrender_to_string」というキーワードでネットを検索したところ、`render_to_string`がそのままでは使えないのでモンキーパッチを当てた、という記事がありました。\n\n&lt;http://blog.sorah.jp/2013/07/28/render_to_string-in-ac-live>\n\n&lt;http://diary.sorah.jp/2013/07/28/render-to-string-actioncontroller-live>\n\n```\n\n # モンキーパッチのコード\n def render_to_string(*)\n orig_stream = response.stream\n super\n ensure\n if orig_stream\n response.instance_variable_set(:@stream, orig_stream)\n end\n end\n \n```\n\nただ、ちょっと情報が古いので最新のRailsではどうなっているのかよくわからないのと、以下のように「結局JS側はうまく動かない」という情報もあったりします。\n\n&lt;https://stackoverflow.com/questions/19858470/actioncontrollerlive-with-sse-\nnot-working-properly>\n\nですが、いずれにせよ「作成は成功しますが、表示がされません」だけだと回答する側も原因を予測しづらいです。 \nなのでChrome\nデベロッパーツールの「ネットワーク」タブやJavaScriptのデバッグ実行などを使って、正常な実行を妨げている箇所を絞り込んだ後に、その情報と一緒に質問を投げるのがベターだと思います。\n\nデベロッパーツールに関する参考情報: &lt;https://ja.stackoverflow.com/a/6898/85>\n\nちなみにコントローラーのコードで\n\n```\n\n rescue\n ensure\n response.stream.close\n \n```\n\nと書いていますが、`rescue`する場合は「発生が予想されるエラーのみ」に絞り込んでおいた方が良いです。\n\n```\n\n # See http://tenderlovemaking.com/2012/07/30/is-it-live.html\n rescue IOError\n # When the client disconnects, we'll get an IOError on write\n ensure\n response.stream.close\n \n```\n\n現状のコードだとあらゆるエラーを握りつぶしてしまうので、問題が起きていても気づけなくなります。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T22:06:41.810", "id": "7164", "last_activity_date": "2015-02-26T22:17:23.190", "last_edit_date": "2017-05-23T12:38:55.250", "last_editor_user_id": "-1", "owner_user_id": "85", "parent_id": "7152", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7152</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7164</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7164</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1614"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "あるファイルを、\n\n```\n\n git rm --cached text.php\n \n```\n\nとしてステージから削除したあとに、\n\n```\n\n git add -A\n \n```\n\nとして、\n\n```\n\n git diff \n \n```\n\nとすると、\n\n```\n\n old mode 100644\n new mode 100755\n \n```\n\nと出てきました。色々ぐぐって\n\n```\n\n [core]\n filemode = false\n \n```\n\nをconfigに追加すればパーミッションの変更が無視されて対処できることはわかったのですが、根本的な理由がわからず下記2つについて教えてほしいです。\n\n①なぜステージから削除→再度ステージにupをするとパーミッションが変わるのか \n②パーミッションが644→755に変わったと表示されているのにファイル自体を`ls -l`でみてみると、パーミッションが`-rw-r--\nr--`になっており、755になっていない \n③git diffで\n\n```\n\n old mode 100644\n new mode 100755\n \n```\n\nと出てしまっているものを削除したい\n\nどうぞよろしくお願い致します。\n\n[環境] \nゲストマシン:centOS6.6をvagrantで実行。 \nホストマシン:macOS \nで、vagrantの中身をmacOSから(vagrant sshせずに)phpstormをつかっていじっている、という環境です。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T14:55:58.103", "favorite_count": 0, "id": "7155", "last_activity_date": "2015-07-22T16:13:51.287", "last_edit_date": "2015-02-27T06:39:26.477", "last_editor_user_id": "288", "owner_user_id": "288", "post_type": "question", "score": 10, "tags": [ "git" ], "title": "git rm --cached 後に git add -Aするとファイルのパーミッションが変わる", "view_count": 1372 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "自分も同じ現象を経験し、同じ方法で解決しました。 \n結局のところ、 \nWindowsから参照・変更・作成したファイルと、 \nLinuxから参照・変更・作成したファイルのパーミッションが違うから、 \nWindowsエディタで作成したファイルをコミットしてあったらリポジトリもそのパーミッションになるし、 \nLinuxで作成したファイルをコミットしてあったら(略\n\nということではないでしょうか。 \nlocalでcygwinでgitをいじっているということであれば、 \nwindowsで編集したファイルは644になって、cygwinでコミットした時に755になる \ncygwinでcloneして、windowsで見るとwindows標準パーミッションと異なっているので> が付く。 \nwindowsでコミットしてcygwinでgit commit -aすればfile modeが変更される \nということですね。\n\nうまく説明できなくてすみません。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-24T08:45:40.890", "id": "8326", "last_activity_date": "2015-03-24T08:45:40.890", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8396", "parent_id": "7155", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7155</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">8326</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1615"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7245", "answer_count": 3, "body": "以下のコードはコンパイルし,動作します.(Wandboxのg++ 4.9.2,clang 3.5.0にて確認,以下同じ)\n\n```\n\n #include &lt;new>\n int main(){\n auto p = new int const(0);\n delete p;\n }\n \n```\n\nしかし,delete p;を::operator\ndelete(p);で置き換えた場合にはコンパイルエラーが発生してしまいます.(g++での例,clangでもコンパイルエラー)\n\n```\n\n prog.cc: In function 'int main()': \n prog.cc:4:24: error: invalid conversion from 'const void*' to 'void*' [-fpermissive] \n ::operator delete(p);\n \n```\n\n確かにconstなオブジェクトへのポインタは非constなオブジェクトへのポインタには変換できませんし,operator\ndeleteが非constなオブジェクトへのポインタを要求するのは理解できるのですが,ではなぜ最初のdelete式がコンパイル可能であるのかが分かりません.\n\nN3797の§5.3.5.7より,\n\n> Otherwise, the delete-expression will not call a deallocation function\n> (3.7.4.2).\n\nとあるので,`operator delete`の呼び出しが省略されたのかと考えましたが,以下のコードを実行してみたところ,`op\ndelete`が出力されました.(bは無関係なオブジェクトでの呼び出しを避けるために使用しています)\n\n```\n\n #include &lt;new>\n #include &lt;iostream>\n \n bool b = false;\n void operator delete(void*) noexcept{\n if(b){\n std::cout &lt;&lt; \"op delete\" &lt;&lt; std::endl;\n }\n }\n \n int main(){\n b = true;\n auto p = new int const(0);\n delete p;\n b = false;\n }\n \n```\n\nこの結果はどのように解釈すれば良いのでしょうか.", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T15:15:10.817", "favorite_count": 0, "id": "7158", "last_activity_date": "2015-02-28T07:10:07.533", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8573", "post_type": "question", "score": 12, "tags": [ "c++" ], "title": "constなオブジェクトへのポインタをdeleteしたときの挙動", "view_count": 2146 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "まず,`delete-expression` は const ポインタを渡すことができますが,(§5.3.5.2 の Note) `::operator\ndelete` の直接の呼び出しは delete-expression ではなく,単なる関数呼び出しなので,引数のポインタがそのまま渡され const\nポインタを渡すことができません. \n具体的には,`delete-expression`である delete はデストラクタの呼び出し後にオーバーロードを考慮した operator delete\nの呼び出しを行いますが, ::operator delete の直接の呼び出しではデストラクタが呼び出されず,引数のポインタがそのまま渡されます.", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T17:39:40.547", "id": "7162", "last_activity_date": "2015-02-26T17:39:40.547", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8577", "parent_id": "7158", "post_type": "answer", "score": 2 }, { "body": "ISO/IEC 14882:1998 によれば\n\n5.3.5 delete \n5.3.5-2 Note に const つき型へのポインタを渡してよい constness をキャストで除去する必要は無いとあります。\n\n12.1 constructor, 12.4 destructor にも \n12.1-4 constructor は const, volatile, const volatile オブジェクトに対して呼べる \nconstructor が完了するまで const/volatile-ness は適用されない \n12.4-2 destructor は const, volatile, const volatile オブジェクトに対して呼べる \ndestructor が開始した時点で const/volatile-ness は適用されなくなる \nとあります。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T05:28:04.847", "id": "7195", "last_activity_date": "2015-02-27T05:28:04.847", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8586", "parent_id": "7158", "post_type": "answer", "score": 3 }, { "body": "同じく ISO/IEC 14882:1998 より \n5.3.5 delete \n1 delete-式 は最派生オブジェクトの解体であり \n6 削除されるオブジェクトにデストラクタがあれば呼びだす \nなので\n\n> オブジェクトのdestructionであると解釈すれば\n\n「解釈すれば」は要らないでしょう。\n\nまた 12.4 destructors に \n「解体されるオブジェクトの占めている記憶域を解放する」系の文言は一切ありません。\n\n一方で 3.7.3.2 operator delete はその名 [ 解放関数 ] のとおり \n- デストラクタを起動するとは書かれていない \n- 記憶域を解放する (義務がある) と書かれている\n\n一般的実装としては operator delete が直ちに OS 等に直接資源を返すとは考えにくく \nいわゆる free-store (に類する何か) に「未使用」マークを付けるだけ、が多いでしょう。 \nなので operator delete に const T* を渡すことには意味が無いと解釈すべきでしょう。 \nconst だと「未使用」マークを付ける操作すらできないので。\n\nだから一般的 C++ 実装としては \ndelete-expression に const/volatile T* が渡されたときの処理系の挙動は \n1. cv 修飾を除去する \n2. デストラクタを呼ぶ (cv 修飾除去後の型で) \n3. 最適解放関数を呼ぶ (cv 修飾除去後の型で) \nとなるものと思われます。\n\n蛇足 \npandaman 氏は当然わかっていて故意に書かれているのでしょうが第三者読者のために追記しておくと \n提示サンプルの1 \n- new-式 + delete-式の組み合わせ=正しい \n- new-式 + operator delete の組み合わせ=デストラクタが呼ばれないので正しくない\n\n提示サンプルの2 \n- operator new は処理系提供のもので operator delete は自作=記憶域は正しく解放されていない \nすなわちメモリリークしている(デストラクタは呼ばれている)\n\nことだけ注意喚起しておきます。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T07:10:07.533", "id": "7245", "last_activity_date": "2015-02-28T07:10:07.533", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8589", "parent_id": "7158", "post_type": "answer", "score": 6 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7158</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7245</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7245</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1616"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "SwiftでMBaaSであるParseを使ってTextFieldに入力した文字をTableViewに表示するプログラムを作っているのですが、TableViewを引っ張って更新する部分がうまく行きません。\n\n```\n\n override func viewDidLoad() {\n super.viewDidLoad()\n \n //parseからデータ取得\n self.loadData()\n // DataSourceの設定をする.\n tableView.dataSource = self\n \n // Delegateを設定する.\n tableView.delegate = self\n \n //引っ張って更新\n self.pullrefresh()\n \n }\n \n //parseからデータ取得\n func loadData() {\n var query:PFQuery = PFQuery(className: \"Comment\")\n query.orderByDescending(\"createdAt\")\n query.findObjectsInBackgroundWithBlock{(objects: [AnyObject]!, error: NSError!) -> Void in\n if (error != nil){\n //error処理\n }\n \n //PFObjectのcommentsにparseのデータを収納\n for object in objects {\n self.comments.addObject(object)\n }\n self.tableView.reloadData()\n }\n \n }\n \n //引っ張って更新関数\n func pullrefresh(){\n self.refreshControl = UIRefreshControl()\n self.refreshControl.attributedTitle = NSAttributedString(string: \"↓引っ張る\")\n self.refreshControl.addTarget(self, action: \"refresh:\", forControlEvents: UIControlEvents.ValueChanged)\n self.tableView.addSubview(refreshControl)\n }\n //更新のデータ取得方法\n func refresh(sender:AnyObject)\n {\n self.loadData()\n //refreshを終える\n self.refreshControl.endRefreshing()\n }\n \n```\n\nこういうプログラムを書いたのですが、引っ張って更新すると、同じ内容がダブって表示されます。 \nもう画面に表示されているテキストはダブらずに表示されていないものだけ更新するにはどうすればいいでしょうか? \n回答よろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T16:37:29.967", "favorite_count": 0, "id": "7161", "last_activity_date": "2015-07-28T03:32:36.780", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8576", "post_type": "question", "score": 4, "tags": [ "ios", "swift", "xcode", "parse.com" ], "title": "SwiftでParse.comを使用しているのですが、TableViewの更新が上手くいきません", "view_count": 517 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "Parseは利用したことがないのですが、気付いたことを書きます。\n\nPFQueryで特に絞り込みがなされていないようなので、query.findObjectsInBackgroundWithBlockで毎回全件取得していますよね。それを既にデータが入っているself.commentsに追加しているので、重複して追加されているようです。\n\nですので可能であればPFQueryで日付で絞り込むか、それができなければself.commentsを取得した配列で置き換える\n\n```\n\n self.comments = objects\n \n```\n\nようにすれば良いと思います。\n\nそれからquery.findObjectsInBackgroundWithBlockはバックグラウンドで処理されるようですが、コールバックはどのスレッドで呼ばれるのでしょうか?メインスレッドなど常に特定のスレッドで呼ばれるのでしたらよいのですが、もしそうでなければ同時実行障害が発生する可能性があるように思います。それとtableView.reloadDataはメインスレッドで実行する必要があります。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T23:08:12.967", "id": "7239", "last_activity_date": "2015-02-27T23:08:12.967", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "238", "parent_id": "7161", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7161</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7239</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1617"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7240", "answer_count": 1, "body": "お世話になります。 \nSymfony2を勉強中です。全コントローラー(同じバンドル内)に共通で読み込ませるクラスはどんな手順で組み込むのでしょうか。\n\n```\n\n use bar\\fooBundle\\hogehoge;\n \n```\n\nこんなようにuseを使ってすべてのコントローラーの頭で読み込ませるのは何かしら合理的ではないような気がしております。 \nパスワードの暗号化や時間の比較、オブジェクトのキャストなどなど、汎用的に使う関数があるかと思うのですが、皆様はどのような形で実装しているのでしょうか。 \nよろしくお願いします。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-26T17:51:36.190", "favorite_count": 0, "id": "7163", "last_activity_date": "2015-02-28T00:29:27.190", "last_edit_date": "2015-02-26T21:23:31.057", "last_editor_user_id": "7926", "owner_user_id": "7154", "post_type": "question", "score": 3, "tags": [ "php", "symfony2" ], "title": "Symfony2で汎用的なクラスを作成する", "view_count": 1180 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "普通にOOPのアプローチが使えますので、例えばコントローラであればプロジェクト用のベースクラスを作り、そこにユーティリティメソッドを実装する方法があります。Standard\nEditionの標準のコントローラの場合はFrameworkBundleのControllerクラスを継承していますから、この継承階層の間に1つ、プロジェクト用のコントローラを挟む形になります。\n\n```\n\n // src/AppBundle/Controller/BaseController.php\n use Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller;\n \n /**\n * プロジェクト用ベースコントローラ\n */\n class BaseController extends Controller\n {\n /**\n * ユーティリティメソッド\n */\n public function someUtilityMethod($foo)\n {\n ...\n \n // src/AppBundle/Controller/FooController.php\n /**\n * 個々のコントローラ\n */\n class FooController extends BaseController\n {\n public function indexAction($bar)\n {\n // ベースクラスのユーティリティメソッド呼び出し\n $this->someUtilityMethod($bar);\n \n```\n\n注意点としまして、このアプローチだと手軽さのために、あらゆるものをBaseControllerに実装しがちになり、そこがウィークポイントになってしまいます。機能はできるだけ別のクラスにサービスとして実装し、利用するコントローラ側で明示的に取得するようにしておく方が、後々の管理等しやすいです。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T00:29:27.190", "id": "7240", "last_activity_date": "2015-02-28T00:29:27.190", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5444", "parent_id": "7163", "post_type": "answer", "score": 4 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7163</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7240</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7240</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1618"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "MediaPlayerを使って動画を再生したときに以下の例外が発生します。\n\n```\n\n E/MediaPlayer(18065): Unable to create media player\n E/DEBUG(18065): Error\n E/DEBUG(18065): java.io.IOException: setDataSourceFD failed.: status=0x80000000\n \n```\n\n以下を実行しています。\n\n```\n\n FileInputStream is = null;\n try {\n is = new FileInputStream(mPath);\n mMediaPlayer.setDataSource(is.getFD());\n } finally {\n try {\n if (is != null)\n is.close();\n } catch (Exception e) {}\n }\n \n```\n\nNexus 5(Android4.4.3)で例外が発生します。特定の機種でエラーになるみたいで、他の機種では例外が発生しません。\n\nアドバイスをよろしくお願い致します。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T00:57:16.047", "favorite_count": 0, "id": "7165", "last_activity_date": "2015-11-24T18:14:45.290", "last_edit_date": "2015-02-27T03:59:24.583", "last_editor_user_id": "7926", "owner_user_id": "7212", "post_type": "question", "score": 4, "tags": [ "android", "java", "android-mediaplayer" ], "title": "MediaPlayerで動画再生するとエラーが発生します", "view_count": 1084 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "自己レスです。ffmpegで音声と動画を結合した動画が再生できなかったのですが、音声のコーデック形式を mp3 から aac に変更したら再生されました。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T06:43:20.417", "id": "7205", "last_activity_date": "2015-02-27T06:43:20.417", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7212", "parent_id": "7165", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7165</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7205</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1619"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7190", "answer_count": 1, "body": "```\n\n var React = require('react');\n module.exports = React.createClass({\n renderActually: function() {\n return &lt;p>hoge&lt;/p>; \n },\n render: function() {\n return {this.renderActually()};\n }\n });\n \n```\n\nのような`JSX`ファイルを利用しようとすると、コンパイル時にエラーが出ます。 \n代わりに\n\n```\n\n render: function() {\n return &lt;p>hoge&lt;/p>;\n }\n \n```\n\nあるいは\n\n```\n\n render: function() {\n return &lt;div>{this.renderActually()}&lt;/div>;\n }\n \n```\n\nとすれば正常にコンパイルされて動作します。最初のコードでエラーが起こるのは`JSX`のどういった仕様あるいは制限によるものでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T01:14:32.377", "favorite_count": 0, "id": "7166", "last_activity_date": "2015-02-27T04:47:31.020", "last_edit_date": "2015-02-27T02:55:12.223", "last_editor_user_id": "3313", "owner_user_id": "3313", "post_type": "question", "score": 0, "tags": [ "reactjs", "react-jsx" ], "title": "JSXのrender()で別の関数の戻り値だけを出力することができない理由を知りたい", "view_count": 841 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "自己解決しました。 \nコードが評価される順序を気にする必要があります。\n\n```\n\n renderActually: function() {\n return &lt;p>hoge&lt;/p>;\n },\n render: function() {\n return &lt;span>{this.renderActually()}&lt;/span>;\n }\n \n```\n\nは、コンパイル後\n\n```\n\n renderActually: function() {\n return React.createElement(\"p\", null, \"hoge\");\n },\n render: function() {\n return React.createElement(\"span\", null, this.renderActually());\n }\n \n```\n\nとなります。\n\n * コンパイル時に`this.renderActually()`は評価されない\n * `React.createElement`に置換される際の第1引数としてHTMLタグが必要\n\n上記の代わりに\n\n```\n\n render: function() {\n return this.renderActually();\n }\n \n```\n\nとした場合は、コンパイル後もコードは変更されませんでした。\n\n* * *\n\n実際は\n\n```\n\n render: function() {\n // arr は適当な配列\n return (\n { arr.map(function(elem) {\n return {this.anotherMethod(elem)};\n }.bind(this))\n }\n );\n }\n \n```\n\nのような事をしたくて遭遇していたエラーだったのですが \nそもそも使い方を間違えている(`{}`内で評価する必要がない)ということがわかりました。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T04:40:51.980", "id": "7190", "last_activity_date": "2015-02-27T04:47:31.020", "last_edit_date": "2015-02-27T04:47:31.020", "last_editor_user_id": "3313", "owner_user_id": "3313", "parent_id": "7166", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7166</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7190</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7190</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1620"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7170", "answer_count": 2, "body": "NSSetで \nNSSet(objects: \"aaa\", \"bbb\", \"ccc\") \nとセットしたく、ただし列挙部分は動的に生成したい場合、 \nswiftではどのように列挙部分を生成すればよろしいのでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T01:46:22.540", "favorite_count": 0, "id": "7168", "last_activity_date": "2015-02-27T02:45:48.510", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7352", "post_type": "question", "score": 0, "tags": [ "ios", "swift" ], "title": "NSSetで動的に複数セットしたい", "view_count": 304 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "以下でどうでしょうか?\n\n```\n\n // NSSet を作る際に array を使用して、その引数を動的に変更する方法\n var mary = [\"aaa\", \"bbb\"]\n mary.append(\"ccc\")\n var set = NSSet(array:mary)\n \n // NSMutableSet を使用して、動的に追加する方法\n var mset = NSMutableSet(objects:\"aaa\", \"bbb\")\n mset.addObject(\"ccc\")\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T01:55:56.237", "id": "7170", "last_activity_date": "2015-02-27T01:55:56.237", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5106", "parent_id": "7168", "post_type": "answer", "score": 1 }, { "body": "補足ですが、Swift1.2からはSwift用Setが使えますので、状況が許せば、以下のようにもかけます。\n\n```\n\n var set = Set&lt;String>()\n set.insert(\"aaa\")\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T02:45:48.510", "id": "7178", "last_activity_date": "2015-02-27T02:45:48.510", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7368", "parent_id": "7168", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7168</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7170</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7170</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1621"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "MonacaでCordva3.5.1のWebSocketServerプラグインを有効にし、Androidアプリのビルドをすると下記のエラーが発生します。\n\n同じCordva3.5.1のHttpServerを有効にした場合にも同様のエラーが発生しましたが、Shareを有効にした場合には問題ありませんでした。 \nWebSocketServerやHttpServerを使う場合には何か他に設定が必要なのでしょうか?\n\n* * *\n\n> Temporary folder: /private/tmp/monaca/eec3fd17f324a81a \n> Downloading project \n> Download complete \n> Running for 3.5 \n> Installing \"mobi.monaca.plugins.Monaca\" for android \n> cordova version not detected (lacks script\n> \"/private/tmp/monaca/eec3fd17f324a81a/android/skeleton/platforms/android/cordova/version\"\n> ), continuing. \n> Installing \"mobi.monaca.plugins.WebSocketServer\" for android \n> cordova version not detected (lacks script\n> \"/private/tmp/monaca/eec3fd17f324a81a/android/skeleton/platforms/android/cordova/version\"\n> ), continuing. \n> Installing \"org.apache.cordova.splashscreen\" for android \n> Plugin \"mobi.monaca.plugins.Monaca\" already installed on android. \n> Plugin \"org.apache.cordova.splashscreen\" already installed on android. \n> Fetching plugin\n> \"/data/monaca_build_module/plugins/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7f12101d16511210111e1c1e510f130a1816110c51281a1d2c101c141a0b2c1a0d091a0d3f4e514f514f">[email&#160;protected]</a>\"\n> via plugin registry \n> Error: 404 Not Found: data \n> at RegClient.&lt;anonymous>\n> (/data/monaca_build_module/3.5/node_modules/cordova/node_modules/cordova-\n> lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:268:14) \n> at Request.self.callback\n> (/data/monaca_build_module/3.5/node_modules/cordova/node_modules/cordova-\n> lib/node_modules/npm/node_modules/request/index.js:148:22) \n> at Request.emit (events.js:98:17) \n> at Request.&lt;anonymous>\n> (/data/monaca_build_module/3.5/node_modules/cordova/node_modules/cordova-\n> lib/node_modules/npm/node_modules/request/index.js:876:14) \n> at Request.emit (events.js:117:20) \n> at IncomingMessage.&lt;anonymous>\n> (/data/monaca_build_module/3.5/node_modules/cordova/node_modules/cordova-\n> lib/node_modules/npm/node_modules/request/index.js:827:12) \n> at IncomingMessage.emit (events.js:117:20) \n> at _stream_readable.js:929:16 \n> at process._tickCallback (node.js:419:13) \n> Build error: Error building project source code\n\nAndroidManifest.xmlは以下の通りです\n\n```\n\n &lt;?xml version=\"1.0\" encoding=\"utf-8\"?>\n &lt;manifest android:hardwareAccelerated=\"true\" android:versionCode=\"%%%VERSION_CODE%%%\" android:versionName=\"%%%VERSION_NAME%%%\" android:windowSoftInputMode=\"adjustPan\" package=\"%%%PACKAGE_NAME%%%\" xmlns:android=\"http://schemas.android.com/apk/res/android\">\n &lt;supports-screens android:anyDensity=\"true\" android:largeScreens=\"true\" android:normalScreens=\"true\" android:resizeable=\"true\" android:smallScreens=\"true\" android:xlargeScreens=\"true\" />\n &lt;uses-permission android:name=\"android.permission.INTERNET\" />\n &lt;application android:hardwareAccelerated=\"true\" android:icon=\"@drawable/icon\" android:label=\"%%%APPLICATION_NAME%%%\">\n &lt;activity android:configChanges=\"orientation|keyboardHidden|keyboard|screenSize|locale\" android:label=\"%%%APPLICATION_NAME%%%\" android:name=\"MainActivity\" android:theme=\"@android:style/Theme.Black.NoTitleBar\">\n &lt;intent-filter>\n &lt;action android:name=\"android.intent.action.MAIN\" />\n &lt;category android:name=\"android.intent.category.LAUNCHER\" />\n &lt;/intent-filter>\n &lt;/activity>\n &lt;/application>\n &lt;uses-sdk android:minSdkVersion=\"10\" android:targetSdkVersion=\"19\" />\n &lt;/manifest>\n \n```\n\nMonacaを使うのが初めてなもので初歩的なミスだとしたら申し訳ありませんが、ご指導をお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T01:49:45.323", "favorite_count": 0, "id": "7169", "last_activity_date": "2015-07-27T16:21:08.130", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8562", "post_type": "question", "score": 3, "tags": [ "monaca" ], "title": "MonacaでWebSocketServerプラグインを有効にするとビルドエラーが発生する", "view_count": 539 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "同じ現象に悩まされています。私は、Shareを有効にしても失敗します。 \nアプリの実行で、plugins.httpServer(); が、Uncaught TypeError: Object # has no method\n'httpServer' とコンソールに出力されてHTTPサーバーを起動することができません。 \nUSBデバッグしてみると、たしかに、plugins には、httpServer が含まれていません。 \n別のプラグイン DatePicker を有効にしてデバッグしてみると、plugins には、datePicker が含まれています。 \nどうやったら、httpServer が使えるようになるのか、私も知りたいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T11:59:45.843", "id": "7227", "last_activity_date": "2015-02-27T11:59:45.843", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8595", "parent_id": "7169", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7169</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7227</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1622"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7173", "answer_count": 1, "body": "`form`タグ内に`button`タグを配置したところ、クリックするとsubmitされてしまう様なのですが \nこれをsubmitしないただのボタンとして扱いたい場合はどうすれば良いでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T01:57:52.240", "favorite_count": 0, "id": "7171", "last_activity_date": "2015-02-27T02:05:52.920", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "525", "post_type": "question", "score": 1, "tags": [ "html" ], "title": "form内にsubmitしないbuttonを配置したい", "view_count": 8232 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "typeに\"button\"を指定してみてはどうでしょうか? \n[button要素で送信・リセット・汎用ボタンを自由に作ろう](http://honttoni.blog74.fc2.com/blog-\nentry-153.html)\n\n一部引用\n\n> type=\"部品の種類\" submit(送信ボタン)、reset(リセットボタン)、button(汎用ボタン)の3つ。 \n> デフォルトは「submit」なので、typeを指定しなければ送信ボタンになります。 \n> *ただ、IE7以下ではデフォルトが「button」になります。 \n> IE7以下でを送信ボタンとして使う場合は、キチンとtype=\"submit\"と書く必要があります。\n```\n\n &lt;button type=\"submit\">送信する&lt;/button>\n &lt;button type=\"reset\">リセット&lt;/button>\n &lt;button type=\"button\">トップページへ&lt;/button>\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T02:05:52.920", "id": "7173", "last_activity_date": "2015-02-27T02:05:52.920", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3516", "parent_id": "7171", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7171</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7173</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7173</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1623"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7192", "answer_count": 3, "body": "[ruby -\n既存クラスのメソッドに追加のオプションをつける方法](https://ja.stackoverflow.com/questions/6938/%e6%97%a2%e5%ad%98%e3%82%af%e3%83%a9%e3%82%b9%e3%81%ae%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ab%e8%bf%bd%e5%8a%a0%e3%81%ae%e3%82%aa%e3%83%97%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92%e3%81%a4%e3%81%91%e3%82%8b%e6%96%b9%e6%b3%95)\nにて既存クラスのメソッドの書き換えについてお聞きしたのですが、問題が書き換えの方法ではなくファイルの読み込み方にあったために別の質問として立てさせていただきました。\n\n以下のように`selenium-\nwebdriver`の拡張をしたのですが、pry上で作業している時に`Selenium::Webdriver::Element`に他のメソッドを追加した時など何度も`load\n'selenium_webdriver_ext.rb'` で呼び出すと2回目以降から `stack level too\ndeep`のエラーが発生してしまいます。\n\n### selenium_webdriver_ext.rb\n\n```\n\n class Selenium::WebDriver::Element\n alias_method :send_keys_orig, :send_keys \n def send_keys(*args, clear: false)\n __send__(:clear) if clear\n send_keys_orig(*args)\n end\n end\n \n```\n\nメソッドの書き換えを行ったファイルを`pry`から何度も読みだす時に何か良い方法はないでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T02:06:15.010", "favorite_count": 0, "id": "7174", "last_activity_date": "2015-02-27T05:04:12.333", "last_edit_date": "2017-04-13T12:52:38.920", "last_editor_user_id": "-1", "owner_user_id": "3271", "post_type": "question", "score": 3, "tags": [ "ruby", "pry" ], "title": "既存クラスのメソッドを書き換えたファイルを何度も読み込む時の扱い方", "view_count": 202 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "2回目以降の `alias_method :send_keys_orig, :send_keys`\nがまずいですね。オリジナルが消えてますし、メソッド自身を呼び出すことになってしまいます。\n\n[aliasによるメソッドの再定義は危険なのでUnboundMethodかextendを使おう -\nるびきち](http://d.hatena.ne.jp/rubikitch/20080504/1209835550) \nと、るびきちさんの著作[Ruby逆引きハンドブック](http://www.c-r.com/book/detail/705)「メソッドを再定義する」\n(p.630) を用いて書き直してみました。\n\n```\n\n def once\n unless instance_variable_defined? :@__once_executed__\n yield\n @__once_executed__ = true\n end\n end\n \n class Selenium::WebDriver::Element\n once do\n alias_method :send_keys_orig, :send_keys \n end\n def send_keys(*args, clear: false)\n __send__(:clear) if clear\n send_keys_orig(*args)\n end\n end\n \n```\n\n簡単に言えば、再読込したときに `once` メソッドの引数(ブロック)は読まないので `SystemStackError: stack level too\ndeep` が出ない、ということです。\n\n他にも、先ほどの引用のタイトル通り、 `Module#instance_method` で `UnboundMethod`\nを得てから再定義というやり方、及び `Object#extend`\nを使ってインスタンスに再定義メソッドを突っ込むやり方があります。それらに関しては引用先を見てください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T03:52:38.227", "id": "7189", "last_activity_date": "2015-02-27T03:52:38.227", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4114", "parent_id": "7174", "post_type": "answer", "score": 1 }, { "body": "ガード条件を付けてみました。 \n`send_keys_orig` がすでに存在していればエイリアスメソッドは作らないようにしています。\n\n```\n\n class Selenium::WebDriver::Element\n unless instance_methods.include?(:send_keys_orig)\n alias_method :send_keys_orig, :send_keys\n end \n \n def send_keys(*args, clear: false)\n __send__(:clear) if clear\n send_keys_orig(*args)\n end\n end\n \n```\n\n参考文献: [Effective\nRuby](http://www.amazon.co.jp/exec/obidos/ASIN/4798139823/junic05-22/ref=nosim/)\n第5章", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T04:50:26.523", "id": "7191", "last_activity_date": "2015-02-27T04:50:26.523", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "85", "parent_id": "7174", "post_type": "answer", "score": 2 }, { "body": "[Module#prepend](http://docs.ruby-\nlang.org/ja/2.2.0/method/Module/i/prepend.html)を使いましょう。\n\n```\n\n module SendKeysWithOption\n def send_keys(*args, clear: false)\n __send__(:clear) if clear\n super(*args)\n end\n end\n \n # 何度Module#prependが呼ばれても元のメソッドは消えないので問題なく動く\n Selenium::WebDriver::Element.prepend(SendKeysWithOption)\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T05:04:12.333", "id": "7192", "last_activity_date": "2015-02-27T05:04:12.333", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2599", "parent_id": "7174", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7174</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7192</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7191</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1624"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7331", "answer_count": 2, "body": "ウェブサイトを開発していますが、 \n表示されるHTMLの幅が、実際のブラウザのサイズよりも小さいサイズで表示されるため困っています。\n\n![Chrome(問題が発生)](https://i.stack.imgur.com/J8vmv.png) \n![Safari(問題なし)](https://i.stack.imgur.com/GPOAZ.png)\n\nChrome と Safari でキャプチャをとりました。 \nChrome では定規のサイズと実際のブラウザサイズが異なっています。 \nSafari ではウィンドウのサイズと body 要素の width が同じなので問題なしです。\n\n以下のブラウザで、上記の現象が起こります。\n\n・Google Chrome v40.0.2214.115 \n・Fire Fox 33.0.2\n\n※ Safariは実際のブラウザのサイズで表示されています。\n\nOSは、Mac OSX 10.9.5 \nディスプレイの解像度は、1680x1050 です。\n\n画像をブラウザで直接開いた場合は、 \nこの現象は起こりません。\n\nブラウザやOSのズーム機能は使っていません。\n\n何が原因か全くわからないため、 \nアドバイスお願いします。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T02:48:19.260", "favorite_count": 0, "id": "7181", "last_activity_date": "2015-03-04T11:55:40.830", "last_edit_date": "2015-03-02T04:07:12.127", "last_editor_user_id": "8581", "owner_user_id": "8581", "post_type": "question", "score": 4, "tags": [ "html", "google-chrome", "firefox" ], "title": "ブラウザの実際のウィンドウサイズと表示するHTMLのbodyのサイズが異なる", "view_count": 2111 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "画像を見てみると右上の三本線アイコンの幅が上25px・下22pxと異なります。 \nこれは数値で表示されている400pxとルーラーから読み取れる値の365pxの比率とほぼ同じであるので、上のブラウザの表示倍率がやや上がっており、横幅の数値には反映されていないのだと思います。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T13:32:27.263", "id": "7331", "last_activity_date": "2015-03-02T13:32:27.263", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5750", "parent_id": "7181", "post_type": "answer", "score": 5 }, { "body": "私もpgrho氏の言う通りかと思います。 \n検証のため画像を貼るために回答として投稿します。\n\n初めに、ルーラーを上下反転させてみました。 \n本来であれば、10ピクセル単位で均等になるはずなのでメモリが上下一致するはずです。 \n![ルーラーが不一致](https://i.stack.imgur.com/Dkfv5.png) \nご覧のとおりルーラーを反転させても一致していません。 \n一致していないということは、等倍表示ではないことになります。\n\n![ルーラー101px分](https://i.stack.imgur.com/KtdBD.png) \n次に、ルーラー100~200、つまり101ピクセル分取り出しました。 \nしかし、111pxとなり、これもまた等倍ではないことを意味しています。\n\n等倍表示にしてからもう一度ご確認いただいたほうがよいかもしれません。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-04T11:55:40.830", "id": "7440", "last_activity_date": "2015-03-04T11:55:40.830", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8667", "parent_id": "7181", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7181</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7331</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7331</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1625"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7187", "answer_count": 1, "body": "文字の隣にテキストボックスを配置したいのですが、 \n画面幅のせいかテキストボックスが文字の下段に移動してしまいます。 \nこれを防ぐ方法はありませんか? \n分かる方がいましたらご教授をお願いします。\n\n```\n\n &lt;span>\n 文字\n &lt;input type=\"text\" style=\"width:450px;\">\n &lt;/span>\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T03:17:03.570", "favorite_count": 0, "id": "7182", "last_activity_date": "2015-02-27T03:36:50.003", "last_edit_date": "2015-02-27T03:30:54.537", "last_editor_user_id": "7926", "owner_user_id": "7626", "post_type": "question", "score": 1, "tags": [ "html", "css" ], "title": "HTML 文字の隣にあるテキストボックスが一段下がってしまうのを防ぎたい", "view_count": 6340 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "```\n\n &lt;span style=\"white-space:nowrap;\">\n 文字\n &lt;input type=\"text\" style=\"width:450px;\">\n &lt;/span>\n \n```\n\nこれでいかがでしょうか。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T03:36:50.003", "id": "7187", "last_activity_date": "2015-02-27T03:36:50.003", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7926", "parent_id": "7182", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7182</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7187</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7187</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1626"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7188", "answer_count": 1, "body": "代用ボタンのクリックを、本物のボタンに適用したいのですが、 \n方法が分かりません。 \n因みに本物のボタンは非表示になっています。\n\n```\n\n &lt;button type=\"button\">代用ボタン&lt;/button>\n &lt;input type=\"file\" id=\"本物のボタン\" name=\"fileselect[]\" multiple=\"multiple\" />\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T03:29:40.153", "favorite_count": 0, "id": "7184", "last_activity_date": "2015-02-27T03:41:01.237", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7626", "post_type": "question", "score": 1, "tags": [ "html", "css" ], "title": "代用ボタンのクリックを、本物のボタンに適用したい", "view_count": 195 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "JavaScriptを使わないと難しいと思います。\n\n```\n\n #honmono {display: none;}\n```\n\n```\n\n &lt;button type=\"button\" onclick=\"document.getElementById('honmono').click();\">代用ボタン&lt;/button>\r\n &lt;input type=\"file\" id=\"honmono\" name=\"fileselect[]\" multiple=\"multiple\" />\n```\n\nこんな感じでしょうか。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T03:41:01.237", "id": "7188", "last_activity_date": "2015-02-27T03:41:01.237", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2232", "parent_id": "7184", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7184</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7188</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7188</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1627"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 3, "body": "DDDをベースに web\nアプリケーションの設計を進めていて、DBの停止状態(メンテナンス等による一時休止)をどのレイヤーでチェックし、停止時/非停止時で処理を分岐させたら良いか悩んでいます。\n\n私の理解だと、「DBMSの稼働状態、また状態による処理の分岐」はアプリケーションレイヤーが持つべき責務で、これらの処理はコントローラー等に実装するのがいいと思ってます。ただ、実際にDBの状態をチェックし処理を分岐させる必要があるのは、リポジトリー経由でモデルを生成/保存するタイミングであり、リポジトリーを呼び出す際にコントローラー側でいちいち\nDB の状態をチェックするというのは、DRY の観点からも良くないと感じています。リポジトリーに「DB\nの状態をチェックせずに呼び出してはいけない」という事前条件を付与するのは、かなり危険です。\n\nこの観点から、DataBase の抽象クラスをインフラアーキテクチャレイヤーに作成し、リポジトリーに渡す設計を考えました。Database\nの具象クラスはアプリケーションレイヤーに実装します。\n\n以下 PHP を例にとって実装例を挙げます。\n\nインフラアーキテクチャレイヤー\n\n```\n\n namespace sample\\infra;\n abstract class Database {\n public function __construct() {\n if($this->is_maintenance()) {\n throw new \\Exception;\n }\n }\n \n abstract protected function is_maintenance();\n }\n \n```\n\nアプリケーションレイヤー\n\n```\n\n namespace sample\\application;\n class HogeMasterDatabase extends \\sample\\infra\\Database {\n protected function is_maintenance() { /* */ }\n }\n class HogeSlaveDatabase extends \\sample\\infra\\Database {\n protected function is_maintenance() { /* */ }\n }\n \n class HogeController {\n public function read() {\n $slave = new HogeSlaveDatabase; //ここの例外はRouter等でキャッチする\n \n $repository = new \\sample\\domain\\HogeRepository($slave);\n $hoge = $repository->fetch($id);\n \n // カウンターをインクリメント\n try {\n $master = new HogeMasterDatabase;\n $repository = new \\sample\\domain\\HogeRepository($master);\n $factory = new HogeFactory($hoge);\n $factory->setCounter(++$hoge->getCounter());\n $repository->update($factory->create());\n } catch (\\Exception $e) {\n // masterがメンテナンスの時は無視する\n } \n }\n }\n \n```\n\nドメインレイヤー\n\n```\n\n namespace sample\\domain;\n class Hoge {\n private $counter;\n \n public function getCounter() {\n return $this->counter;\n }\n }\n class HogeRepository {\n private $db;\n \n public function __construct(\\sample\\infra\\Database $db) {\n $this->db = $db;\n }\n \n public function fetch($id) { }\n public function update(Hoge $model) { }\n }\n \n```\n\nこういったケースでは、どう設計&amp;実装すべきでしょうか。アドバイスを頂けると嬉しいです。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T03:30:41.917", "favorite_count": 0, "id": "7186", "last_activity_date": "2015-11-09T02:57:47.357", "last_edit_date": "2015-03-05T06:13:50.570", "last_editor_user_id": null, "owner_user_id": "8583", "post_type": "question", "score": 6, "tags": [ "php", "ドメイン駆動設計" ], "title": "DDDにおいてDBの停止状態をチェックするのはどのレイヤーか", "view_count": 1427 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "DBの例外等をどのレイヤーで扱うのかは、アプリケーションのポリシーにもよりますが、少なくともドメインレイヤーのリポジトリで直接管理することはないでしょう。何らかのユースケースにおいて管理されることになると思います。このユースケースがどのレイヤーに属するものなのかは、ここでは問いません。\n\nデータベースの状態については、おそらくアプリケーション全体にわたって共通した振る舞いが必要になると思います。質問に書かれているような個々のコントローラに条件分岐を書くアプローチ以外に、さまざまな選択肢があります。\n\n * 横断的関心事としてAOPで実装する (参考 [Ray.Aop](https://github.com/ray-di/Ray.Aop/blob/develop-2/README.ja.md))\n * テンプレートメソッド(デザインパターン)を基底クラスに用意して使う\n * フレームワークのコントローラ実行フローに組み込む\n\n質問に書かれているコードのように、master/slaveごとの判定等ある程度の手続きがある場合は2つ目のテンプレートメソッドが分かりやすいかと思います。\n\n最近のPHPではClosureが使えますので、DB状態に依存するような処理をClosureで定義して渡すようなやり方も可能です。似たようなことをやる例として、フレームワークLaravelのトランザクションブロックのための仕組みが参考になるかと思います。\n\n * [Database Transactions](http://laravel.com/docs/5.0/database#database-transactions)\n * [framework/Connection.php at 5.0 · laravel/framework](https://github.com/laravel/framework/blob/5.0/src/Illuminate/Database/Connection.php#L438)\n\nP.S. この内容は、ドメイン駆動設計とは関係無く、アプリケーションまたはフレームワークの設計一般に関する質問かと思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-08T08:36:43.023", "id": "7607", "last_activity_date": "2015-03-08T14:45:32.083", "last_edit_date": "2015-03-08T14:45:32.083", "last_editor_user_id": "5444", "owner_user_id": "5444", "parent_id": "7186", "post_type": "answer", "score": 3 }, { "body": "DDDを実践するに当たって、まず実装の詳細から入りすぎているように思います。DDDでは、設計や実装の詳細よりまず「ユビキタス言語」を語ってみることが大事です。\n\n「DBの停止状態」という状況に対して、ビジネスドメインのユビキタス言語はどういったことを語るのでしょうか?\nDBが停止するということは、ドメインで行われている行為に何らかの影響が出るはずですが、その影響をユビキタス言語はどう語るのでしょうか?\n\nDBの停止はユビキタス言語の中では全く予期していない出来事で、そのときの振る舞いは完全に未定義でしょうか?\nだとしたら、それはドメインの関心事ではないので、インフラ層でチェックしてシステムエラーをアプリケーション層に投げればいいでしょう。\n\nもしユビキタス言語がその状況について語る何らかの言葉を持っているなら、それはドメイン層の関心事なのでドメインモデルの中に組み込むべきです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-12T01:03:49.513", "id": "7808", "last_activity_date": "2015-03-12T01:03:49.513", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "244", "parent_id": "7186", "post_type": "answer", "score": 3 }, { "body": "リポジトリの実装クラス内でチェックすればよいとおもいます。レイヤーとしてはインフラストラクチャになると思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-11-09T02:57:47.357", "id": "18557", "last_activity_date": "2015-11-09T02:57:47.357", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13179", "parent_id": "7186", "post_type": "answer", "score": -1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7186</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7607</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1628"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "Mac OSX Yosemite のローカルに WordPress を置いてテストしてます。 \n「サイト」フォルダのサブフォルダにバーチャルホストを設定してやってます。 \nそれで WordPress のメディアライブラリで画像をアップロードする時なんですが、以下のエラーが出ます\n\n```\n\n ディレクトリ wp-content/uploads/2015/02 を作成できませんでした。この親ディレクトリのアクセス権はサーバーによる書き込みを許可していますか ?\n \n```\n\n先日、Macを移行しまして旧Macの方ではエラーが出てなかったんですが、新Macに移行してから出るようになりました。 \nパーミッションは新旧同じになってると思います。 \n所有者の問題なのかと思い、新しくフォルダを作って WordPress\nもダウンロードしてきたものを置いて(旧Macでしていたのと同じように)みましたがインストールの段階で以下のように出ます。\n\n```\n\n wp-config.php ファイルに書き込むことができません。\n \n```\n\nそれでもインストールすることは出来るんですが、画像アップ時にはまた同様のエラーが出ます。 \n旧Macで出来ていたことが新Macで出来なくなってしまった原因は何なんでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T05:12:11.497", "favorite_count": 0, "id": "7193", "last_activity_date": "2015-03-29T08:06:28.343", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8439", "post_type": "question", "score": 0, "tags": [ "macos" ], "title": "Mac ローカルの WordPress での 画像アップエラー", "view_count": 1141 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "パーミッションのエラーだと思います。 \n試しに、uploadsフォルダのバックアップを取った上でターミナルで該当フォルダまでアクセスして、以下のコマンドを叩くと正常にアップロードできることが確認できるかと思います。\n\n```\n\n $ cd /~~(サイトフォルダ)/wp-content/\n $ sudo chmod -R 777 uploads/ \n \n```\n\nバックアップを元に戻して、wordpress がインストールされているディレクトリのユーザー確認を行い、\n\n```\n\n $ cd /~~(サイトフォルダ)/\n $ ls -la\n $ sudo chown -R apache:apache (サイトフォルダ)\n \n```\n\nローカルの場合はmampをお使いかもしれませんので、 \nnginx や apache などではなく、 一般ユーザーになっていたら変更しましょう。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T06:33:15.647", "id": "7204", "last_activity_date": "2015-02-27T06:33:15.647", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7641", "parent_id": "7193", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7193</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7204</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1629"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "Microsoft Azure クラウドサービスに固定IP(予約済みIP)を設定したく調査したところ、 \nサービス構成ファイルに予約済みIPを指定することで固定IPが設定できるとの情報を得ました。 \n&lt;https://azure.microsoft.com/documentation/articles/virtual-networks-reserved-\npublic-ip/>\n\nさらに、サービス構成ファイルの編集方法について以下のサイトを確認したのですが、 \n&lt;http://azure.microsoft.com/ja-jp/documentation/articles/cloud-services-how-\nto-configure/> \n管理ポータルのクラウドサービスの画面に「構成」のタブが見当たりません。 \n「構成」タブは廃止されてしまったのでしょうか。\n\nサービス構成ファイルを取得するにはどうしたらよいのでしょうか。 \nまた、この方法以外で固定IPを設定する方法があればご教授いただけないでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T05:12:38.913", "favorite_count": 0, "id": "7194", "last_activity_date": "2015-09-16T23:58:19.597", "last_edit_date": "2015-09-16T23:58:19.597", "last_editor_user_id": "-1", "owner_user_id": "8584", "post_type": "question", "score": 3, "tags": [ "azure" ], "title": "Microsoft Azureクラウドサービスサービス構成ファイルの取得方法", "view_count": 509 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "使われているサービスが「仮想マシン」であれば構成タブはありません。 \n※ややこしいのですが仮想マシンを作った場合でもクラウドサービスは作成されます\n\n仮想マシンの場合で予約済みIPアドレスを利用する場合は、同じURLの上部の仮想マシンの場合にやり方が記載されています。 \n&lt;https://azure.microsoft.com/documentation/articles/virtual-networks-reserved-\npublic-ip/>\n\n現状、Azure PowerShellを使用して設定する形になるかと思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T10:40:46.720", "id": "7222", "last_activity_date": "2015-08-25T01:59:08.710", "last_edit_date": "2015-08-25T01:59:08.710", "last_editor_user_id": "-1", "owner_user_id": "2202", "parent_id": "7194", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7194</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7222</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1630"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7271", "answer_count": 3, "body": "スクリプトや、API,WMIなど、言語や手段は問いません。\n\nWindowsで現在ログインしているユーザーにパスワードが設定されているかどうかの情報を取得できる方法を教えて下さい。\n\nよろしくお願いします。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T05:32:16.460", "favorite_count": 0, "id": "7197", "last_activity_date": "2015-03-01T09:13:18.093", "last_edit_date": "2015-03-01T09:13:04.130", "last_editor_user_id": "3715", "owner_user_id": "3715", "post_type": "question", "score": 1, "tags": [ "c#", "windows", "vba" ], "title": "Windowsで現在ログイン中のユーザーにパスワードが設定されているか取得する方法ありますか?", "view_count": 2592 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "(2015/02/27 20:44追記)下記回答は使えないようです。\n\n* * *\n\nローカルドメインのユーザーであれば、Windowsのコマンド`net`を利用して\n\n```\n\n net user %USERNAME%\n \n```\n\nとすると、パスワードの有無を含む様々な情報が取得できます。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T09:57:36.940", "id": "7217", "last_activity_date": "2015-02-27T11:46:54.733", "last_edit_date": "2015-02-27T11:46:54.733", "last_editor_user_id": "3160", "owner_user_id": "3160", "parent_id": "7197", "post_type": "answer", "score": 0 }, { "body": "酷い方法ですがSystem.DirectoryServices.AccountManagement.dllを参照して \n\n```\n\n bool HasPassword()\n {\n using (var pc = new PrincipalContext(ContextType.Machine))\n {\n try\n {\n return !pc.ValidateCredentials(Environment.UserName, \"\");\n }\n catch\n {\n return false;\n }\n }\n }\n \n```\n\nのようにログインしてみれば分かるかと。`ValidateCredentials`は`False`または例外を返します。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T10:51:53.313", "id": "7225", "last_activity_date": "2015-02-27T10:51:53.313", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5750", "parent_id": "7197", "post_type": "answer", "score": 0 }, { "body": "# 解決!\n\nC++ですが、下記のような感じで取得出来ました。ありがとうございました。(__)\n\n```\n\n wstring user = \"HogeHoge\";\n \n HANDLE h;\n CEdit* edit = (CEdit*)GetDlgItem(IDC_EDIT1);\n CString s;\n s.AppendFormat(L\"ユーザー: %s\\r\\n\", user.c_str());\n int res = LogonUser(user.c_str(), L\".\", L\"\", LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &amp;h);\n if (res == 0) {\n DWORD error = GetLastError();\n s.AppendFormat(L\"Error: %d\\r\\n\", error);\n if (error == ERROR_ACCOUNT_RESTRICTION) {\n s.AppendFormat(L\"このユーザーにはパスワードが設定されていません\");\n }\n else if (error == ERROR_LOGON_FAILURE){\n s.AppendFormat(L\"このユーザーにはパスワードが設定されています\");\n }\n else {\n s.AppendFormat(L\"不明なエラー\");\n }\n edit->SetWindowTextW(s);\n }\n else {\n s.AppendFormat(L\"Result: %d\", res);\n edit->SetWindowTextW(s);\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T09:13:18.093", "id": "7271", "last_activity_date": "2015-03-01T09:13:18.093", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3715", "parent_id": "7197", "post_type": "answer", "score": 0 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7197</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7271</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7217</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1631"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 0, "body": "Pythonでhtmlのframe内のデータを取得するにはどうすればいいのでしょうか? \n私が取得したいWebページには&lt;noframes>があるのでframeの内容を取得せずにそちらの内容を取得してしまいます。こちらが&lt;frame>に対応しているとサーバーに思わせるにはどうすればいいのでしょうか?", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T05:34:43.663", "favorite_count": 0, "id": "7199", "last_activity_date": "2015-02-27T05:34:43.663", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5246", "post_type": "question", "score": 1, "tags": [ "html", "python" ], "title": "python3でframe内のデータを取得する", "view_count": 465 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div> <span class="block ">[]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7199</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1632"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 0, "body": "iOS8ではUITableViewのスタイルをグループにしても、セクション毎にグループになっているセルが角丸になりません。 \nどうすれば、セクション毎に角丸になりますか?", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T06:27:49.813", "favorite_count": 0, "id": "7202", "last_activity_date": "2015-02-27T06:27:49.813", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8060", "post_type": "question", "score": 1, "tags": [ "ios", "uitableview" ], "title": "TableViewのセルをセクション毎に角丸にしたい", "view_count": 2454 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div> <span class="block ">[]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7202</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1633"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "iOSのGoogleMapアプリのようにメニューのViewが開いてもそのViewController内で、常に最前面にUISearchbarを表示するにはどうすればよいですか?\n\n以下がイメージです。 \n![メニューを開く前](https://i.stack.imgur.com/nO3Y3.png)\n![メニューを開いた後](https://i.stack.imgur.com/DeVlQ.png)", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T06:55:46.033", "favorite_count": 0, "id": "7206", "last_activity_date": "2015-03-07T10:22:34.550", "last_edit_date": "2015-02-27T09:19:10.193", "last_editor_user_id": "8060", "owner_user_id": "8060", "post_type": "question", "score": 2, "tags": [ "ios" ], "title": "常にUISearchbarを表示", "view_count": 417 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "# はじめに\n\n`UIViewController`内で通常、ベースとなるViewはプロパティの`view`になります。 \nこの`view`に何かのViewを`addSubview:`すると、そのViewが最前面になります。\n\nつまり、一番最後に`addSubview:`したViewが最前面になる訳ですが、普通は画面の初期表示の後にもユーザーイベント等をトリガーとして`addSubview:`する事があります。\n\nここで、Viewを最前面にするメソッドとして、`bringSubviewToFront:`があります。 \nこのメソッドを使うとそのViewに貼られているSubViewを最前面にする事ができます。\n\n# 回答\n\n質問のひとつの解決手段として、 **viewプロパティにaddSubview:されるタイミングでbringSubviewToFront:を呼ぶ**\nを提案します。\n\nまず、対象の`UIViewController`のサブクラスのプロパティ`view`を下記のようなUIViewサブクラスで置き換えます。(xibやstoryboard上又はloadView等で)\n\n```\n\n @interface MyView : UIView\n // 最前面に置きたいView\n @property(nonatomic,weak)UIView* frontView;\n @end\n \n @implementation MyView\n // addSubview:される時に呼ばれる\n - (void)didAddSubview:(UIView *)subview\n {\n // 最前面にする\n if (self.frontView) {\n [self bringSubviewToFront:self.frontView];\n }\n }\n \n @end\n \n```\n\n次に、最前面に置きたいView(ここではUISearchbar)を生成時に、上記クラスのプロパティ`frontView`にセットしておく。(下記参照)\n\n```\n\n [(MyView*)self.view setFrontView:searchbar];\n \n```\n\nそうすると、設定したViewControllerの`view`に`addSubview:`される度に`didAddSubview:`が呼ばれ、`frontView`にセットしたViewが最前面になる処理が呼ばれます。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-07T10:22:34.550", "id": "7583", "last_activity_date": "2015-03-07T10:22:34.550", "last_edit_date": "2020-06-17T08:14:45.997", "last_editor_user_id": "-1", "owner_user_id": "7364", "parent_id": "7206", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7206</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7583</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1634"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 0, "body": "画像をリクエストしているのですが、SkImageDecoder::Factory returned nullとなります。 \nstatuscodeは200でした。 \nURLはhttps://outlook.office365.com/owa/service.svc/s/GetFileAttachment?id=HOGEHOGE.です。\n\n```\n\n try {\n HttpGet httpGet = new HttpGet(URL);\n CookieManager cookie = CookieManager.getInstance();\n String cookiestr = cookie.getCookie(URL);\n httpGet.setHeader(\"Cookie\", cookiestr);\n DefaultHttpClient client = new DefaultHttpClient();\n \n HttpResponse httpResponse = client.execute(httpGet);\n int statusCode = httpResponse.getStatusLine().getStatusCode();\n Log.d(\"\",\"statusCode:\"+statusCode);\n HttpEntity entity = httpResponse.getEntity();\n //String response = EntityUtils.toString(entity);\n //Log.d(\"\",\"response:\"+response);\n BufferedHttpEntity bufferedEntity = new BufferedHttpEntity(entity);\n final InputStream in = bufferedEntity.getContent();\n \n Bitmap bitm = BitmapFactory.decodeStream(in); \n entity.consumeContent();\n client.getConnectionManager().shutdown();\n } catch (MalformedURLException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n \n```", "comment_count": 5, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T07:07:50.790", "favorite_count": 0, "id": "7207", "last_activity_date": "2015-02-27T08:03:50.473", "last_edit_date": "2015-02-27T08:03:50.473", "last_editor_user_id": "8567", "owner_user_id": "8567", "post_type": "question", "score": 3, "tags": [ "android", "java", "decode" ], "title": "InputStreamからBitmapへの変換でのエラー", "view_count": 950 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div> <span class="block ">[]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7207</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1635"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "ウェブページでどうしても空白ができてしまい困っています。 \npタグで囲みたいのですが、pタグを使うとどうしても上下に空白ができてしまいます。 \nこの空白を消したいです。 \nどうしたらよいのでしょうか?\n\n![header-boxの画像です](https://i.stack.imgur.com/l0cn3.jpg) \n![青い海の画像と下の同じく海の画像との間に空白ができてしまいます。](https://i.stack.imgur.com/hhnZa.jpg)\n\n```\n\n &lt;body>\n &lt;div id=\"pc-wrapper\">\n &lt;div id=\"pc-header-box\">\n &lt;p>&lt;img src=\"aaa\">&lt;/p>\n &lt;/div>\n &lt;div id=\"pc-logo-box\">\n &lt;img src=\"logo\">\n &lt;/div>\n &lt;div id=\"pc-page-box1\">\n &lt;p>&lt;img src=\"bbb\">&lt;/p>\n &lt;/div>\n &lt;div id=\"pc-page-box2\">\n &lt;p>&lt;img src=\"bbb\">&lt;/p>\n &lt;/div>\n &lt;div id=\"pc-page-box3\">\n &lt;p>&lt;img src=\"ccc\">&lt;/p>\n &lt;/div>\n &lt;div id=\"pc-page-box4\">\n &lt;p>&lt;img src=\"ddd\">&lt;/p>\n &lt;/div>\n &lt;div id=\"pc-page-box5\">\n &lt;p>&lt;img src=\"eee\">&lt;/p>\n &lt;/div>\n &lt;div id=\"pc-page-box6\">\n &lt;p>&lt;img src=\"fff\">&lt;/p>\n &lt;/div>\n &lt;/div>\n &lt;body>\n \n```\n\ncss\n\n```\n\n #pc-wrapper\n {\n display:block;\n width:1300px;\n height:1800px;\n margin:0 auto;\n }\n \n #pc-header-box\n {\n display:block;\n position:relative;\n width:1300px;\n height:800px;\n vertical-align:bottom;\n margin:0 auto;\n }\n \n #pc-logo-box\n {\n display:block;\n position:relative;\n width:1300px;\n height:200px;\n background-color:#30F;\n margin:0 auto;\n }\n \n #pc-logo-box img\n {\n display:block;\n position:relative;\n top:50px;\n margin:0 auto;\n }\n \n #pc-page-box1\n {\n display:block;\n position:relative;\n background-color:#69C;\n width:650px;\n height:430px;\n }\n \n #pc-page-box1 p\n {\n display:block;\n background-color:#F99;\n }\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T07:58:45.227", "favorite_count": 0, "id": "7209", "last_activity_date": "2019-12-13T17:54:53.400", "last_edit_date": "2015-02-27T08:02:51.997", "last_editor_user_id": "3639", "owner_user_id": "7647", "post_type": "question", "score": 1, "tags": [ "css" ], "title": "画像の上下に空欄出てしまいます。それを消したいです", "view_count": 2929 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "`&lt;p>` タグには多くのブラウザで上下マージンが設定されていますから、それを上書きすればいいと思います。\n\n(追記)インライン要素である `&lt;img>` はデフォルトで `vertical-align: baseline`\nになっているため、それでも若干の隙間が空くようでした。これを避けるには `vertical-align: bottom` で上書きするか、\n`display: block` とするのがよいでしょう。\n\n参考 [(アクセシビリティも考えて)画像の下にできる余白をなくす | 誠](http://daisukenagai.com/blog/4.html)\n\n上記2点を合わせて、こんな感じでいがかでしょうか。\n\n```\n\n #pc-wrapper p\n {\n margin: 0;\n }\n #pc-wrapper img\n {\n display: block;\n /* imgを横にも並べたい時など、 vertical-align: bottom でもOK */\n }\n \n```\n\nサンプル\n\n```\n\n p {\r\n margin: 0;\r\n }\r\n \r\n img {\r\n /* display: block; */\r\n vertical-align: bottom;\r\n }\n```\n\n```\n\n &lt;p>&lt;img src=\"http://dummyimage.com/100x100/000/fff\" />&lt;img src=\"http://dummyimage.com/100x100/000/fff\" />&lt;/p>\r\n &lt;p>&lt;img src=\"http://dummyimage.com/100x100/000/fff\" />&lt;/p>\n```\n\n余談ですが、 `&lt;div>` や `&lt;p>` は元々ブロック要素ですから、どこかで上書きされていない限り `display: block`\nは不要ではないでしょうか。", "comment_count": 5, "content_license": "CC BY-SA 4.0", "creation_date": "2015-02-27T08:23:57.960", "id": "7211", "last_activity_date": "2019-12-13T17:54:53.400", "last_edit_date": "2019-12-13T17:54:53.400", "last_editor_user_id": "32986", "owner_user_id": "8000", "parent_id": "7209", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7209</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7211</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1636"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7218", "answer_count": 1, "body": "ボタンを押すと`TableView`のセルを拡大させようとしており、セルは拡大するのですが、その拡大したセルの下のセルが、拡大の影響で少し隠れてしまいます。なので隠れるセルを下にずらしたいのですが、現在のコードだとなぜか上のセルが下にずれてしまいます。 \n下記にコードを記します。全て載せると長くなるので、大事だと思うところを載せました。 \nなぜ一つ上のセルが下にずれてしまうのでしょうか? \nどなたか分かる方がいれば教えていただきたいです。すみませんが、よろしくお願いします。\n\nViewController.m\n\n```\n\n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n \n static const id identifiers[4] = {@\"normalCell\", @\"cell\", @\"halfCell\", @\"normalCell\"};\n NSString *CellIdentifier = identifiers[indexPath.row];\n \n UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];\n if (cell == nil) {\n switch (indexPath.row) {\n case 0:\n cell = [[NormalScrollCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];\n break;\n case 1:\n cell = [[PagerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];\n break;\n case 2:\n cell = [[HalfPager alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];\n break;\n default:\n cell = [[NormalScrollCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];\n break;\n }\n }\n \n PagerCell *pagerCell = (PagerCell*)cell;\n NormalScrollCell *normalCell = (NormalScrollCell*)cell;\n HalfPager *halfCell = (HalfPager*)cell;\n \n switch (indexPath.row) {\n case 0:\n [normalCell setNormalScrollPager:normalCell.normalScrollPager];\n break;\n case 1:\n [pagerCell setViewPager:pagerCell.viewPager :pagerCell :halfCell];\n break;\n case 2:\n [halfCell setHalfPager:halfCell.scrollView];\n break;\n default:\n [normalCell setNormalScrollPager:normalCell.normalScrollPager];\n break;\n }\n \n return cell;\n }\n \n```\n\nPagerCell.m\n\n```\n\n - (void)setViewPager:(UIScrollView *)scrollView :(PagerCell*)cell :(HalfPager*)halfPager{\n _pagerCell = cell;\n _halfCell = halfPager;\n pagerScroll = scrollView;\n \n for (NSUInteger i = 1; i &lt;= 3; i++) {\n NSString *imageName = [NSString stringWithFormat:@\"image%d.png\", i];\n UIImage *image = [UIImage imageNamed:imageName];\n UIImageView *imageView = [[UIImageView alloc] initWithImage:image];\n \n CGRect rect = imageView.frame;\n rect.size.height = kScrollObjHeight;\n rect.size.width = kScrollObjWidth;\n imageView.frame = rect;\n imageView.tag = i;\n [scrollView addSubview:imageView];\n \n [self saveImageView:imageView :i];\n }\n \n [self layoutScrollImages];\n }\n \n - (void)changeImageViewSize:(UIImageView*)imageView { //ボタンが押された時の拡大処理\n CGRect imageViewRect = imageView.frame;\n imageViewRect.size.height = kScrollObjHeight * 1.5;\n imageView.frame = imageViewRect;\n \n _halfCell.frame = CGRectOffset(_halfCell.frame, 0, 50); //セルを下にずらす処理を行っている\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T09:21:21.280", "favorite_count": 0, "id": "7213", "last_activity_date": "2015-02-27T10:06:03.363", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5210", "post_type": "question", "score": 0, "tags": [ "objective-c", "uitableview" ], "title": "TableViewのセルを下にずらす", "view_count": 333 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "セルの高さだけ変更したのでは、だめですよ。テーブルの行の高さも、いっしょに変えないと。 \nテーブルの行の高さは、UITableViewDelegateプロトコルの、\n\n```\n\n - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath\n \n```\n\nに実装します。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T10:06:03.363", "id": "7218", "last_activity_date": "2015-02-27T10:06:03.363", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7362", "parent_id": "7213", "post_type": "answer", "score": 0 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7213</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7218</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7218</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1637"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "html\n\n```\n\n &lt;a href=\"hoge\">1&lt;/a>\n &lt;a href=\"huga\">2&lt;/a>\n &lt;a href=\"hogehoge\">3&lt;/a>\n &lt;a href=\"hugahuga\">4&lt;/a>\n \n```\n\njquery\n\n```\n\n $('a').onAttr('href', 'hoge'); // 1のjqueryオブジェクト\n $('a').onAttr('href', 'huga'); // 2のjqueryオブジェクト\n $('a').onAttr('href', /hoge/); // 1,4のjqueryオブジェクト\n $('a').onAttr('href', /huga/); // 2,3のjqueryオブジェクト\n \n```\n\nこのように'href'がマッチした要素を取得したいのですが、どのようにしたらよいのでしょうか。 \n`a`を取得して`each`で回してチェックするやり方しか思いつきません・・・。", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T09:55:05.783", "favorite_count": 0, "id": "7215", "last_activity_date": "2015-05-21T11:30:18.463", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7339", "post_type": "question", "score": 3, "tags": [ "javascript", "html", "jquery" ], "title": "jqueryで要素の属性で絞り込む方法はありますか?", "view_count": 493 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "[user7339さんコメント](https://ja.stackoverflow.com/questions/7215/#comment6369_7215):\n\n> 解決しました。ありがとうございます。`$('a[href*=\"部分マッチ\"]')`", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-05-21T11:30:18.463", "id": "10468", "last_activity_date": "2015-05-21T11:30:18.463", "last_edit_date": "2017-04-13T12:52:39.113", "last_editor_user_id": "-1", "owner_user_id": "49", "parent_id": "7215", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7215</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">10468</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1638"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "Django の `django-social-auth` のプラグインを使ってます。\n\nこちらで Facebook で認証した後に生成されたユーザで Django の admin に入りたいと思ってます。\n\nまず、models.py にこのユーザを作成し、 \nis_staff を無理やり True にしようと、以下のようにしました。\n\n```\n\n class CustomUser(User):\n class Meta:\n verbose_name = u'カスタムユーザ'\n verbose_name_plural = verbose_name\n \n def __init__(self, *args, **kwargs):\n super(User, self).__init__(*args, **kwargs)\n # self._meta.get_field('is_staff').default = True # 試したが出来ない\n super(User, self)._meta.get_field('is_staff').default = True\n \n # CustomUser._meta.get_field('is_staff').default = True\n \n```\n\nsettings.py にて\n\n```\n\n SOCIAL_AUTH_USER_MODEL = 'my_app.CustomUser' \n \n```\n\nのように行いました。 \nコメントアウトしたものもいろいろ試しました。\n\nしかし、Facebook ユーザでログインできませんでした。\n\n次に、それらしき記事を見つけました。\n\n&lt;https://djangosnippets.org/snippets/2856/>\n\nしかし、出来ませんでした。 \nsettings.py の中では、 \n`USE_SOCIAL_AUTH_AS_ADMIN_LOGIN` なのに、admin.pyで\n`SOCIAL_AUTH_USE_AS_ADMIN_LOGIN` \nとなってるものおかしいと思い同じ変数に変更しましたがそれでも出来ませんでした。\n\nもし解決策がありましたら、ご教示いただきたいです。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T09:55:50.773", "favorite_count": 0, "id": "7216", "last_activity_date": "2015-07-29T12:48:58.477", "last_edit_date": "2015-02-28T08:28:42.167", "last_editor_user_id": "7926", "owner_user_id": "7934", "post_type": "question", "score": 3, "tags": [ "python", "oauth", "social-framework", "facebook-api", "django" ], "title": "Django の social_auth の Facebook ユーザで admin に入る", "view_count": 205 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "> しかし、Facebook ユーザでログインできませんでした。\n\nここが、Django側でユーザーが作成されているかで違ってくると思います。 \nので、\n\n> is_staff を無理やり True にしようと\n\nこの部分についてのみ回答します。以下、CutomUserの改善コードです。\n\n```\n\n class CustomUser(User):\n class Meta:\n verbose_name = u'カスタムユーザ'\n verbose_name_plural = verbose_name\n \n def __init__(self, *args, **kwargs):\n super(User, self).__init__(*args, **kwargs)\n self.is_staff = True \n \n```\n\n`__init__()` の最初の処理ですでに `is_staff` が `False` になっているので、次の処理で無条件に `True` にしています。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T10:22:21.137", "id": "7272", "last_activity_date": "2015-03-01T10:22:21.137", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2784", "parent_id": "7216", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7216</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7272</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1639"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 0, "body": "memcachedで有効キー(期限切れではない)の総数を取得したいと思っています。 \nただし、プログラム側で有効キー数を全て抽出してその数を出すということは、1回/秒という頻度で行いたいこともありサーバ負荷がかかるのでやりたくありません。 \nstatsのcurr_itemsで現在のデータ数は取得できますが、有効期限切れてる/切れていないの総数のようです。 \nどなたかサーバの負荷をあまりかけず有効キーの総数を取得する方法をご存知ないでしょうか。よろしくお願いします。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T10:09:51.363", "favorite_count": 0, "id": "7219", "last_activity_date": "2015-02-27T12:18:58.157", "last_edit_date": "2015-02-27T12:18:58.157", "last_editor_user_id": "76", "owner_user_id": "8593", "post_type": "question", "score": 5, "tags": [ "memcached" ], "title": "memcachedの有効キー総数", "view_count": 132 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div> <span class="block ">[]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7219</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1640"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7233", "answer_count": 1, "body": "XcodeのstoryboardでConstraintsで指定したオブジェクトの大きさを見ながら開発したいと思っています。 \nsize inspectorのConstraintsで数字指定してもstoryboard上(Canvas)のオブジェクトには反映されません。逆に”Use\ncanvas size”と指定するとCanvas上のサイズが反映されます。 \nWidthやHeightに数字指定するとCanvas上のオブジェクトに反映されるということをやりたいのですが、どこかに設定でもあるのでしょうか。 \nご存知の方、ご教示お願いします。\n\n----(設定状態追加) ---- \n![Constraints設定](https://i.stack.imgur.com/RSpgR.png) \n画面イメージを追加しました。右の方でConstraintsをUIWebViewに対し上下左右100pt設定していますが、Canvas上では反映されておらず右に174pt,\n下に390pt設定された状態になっています。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T10:20:33.610", "favorite_count": 0, "id": "7220", "last_activity_date": "2015-03-02T04:42:09.580", "last_edit_date": "2015-03-01T15:14:58.813", "last_editor_user_id": "8593", "owner_user_id": "8593", "post_type": "question", "score": 1, "tags": [ "xcode", "storyboard" ], "title": "Xcodeのstoryboardでsize inspectorのConstraints指定したオブジェクトの大きさを把握したい", "view_count": 398 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "制約で指定されている値を修正する場合、以下の手順でどうでしょうか?\n\n![制約の値を修正](https://i.stack.imgur.com/dyhTn.png)\n\n* * *\n\n制約で指定されている値をフレームに反映する場合、以下の手順でどうでしょうか?\n\n![制約の値をフレームに反映](https://i.stack.imgur.com/qRIFB.png)", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T14:58:01.243", "id": "7233", "last_activity_date": "2015-03-02T04:42:09.580", "last_edit_date": "2015-03-02T04:42:09.580", "last_editor_user_id": "7459", "owner_user_id": "7459", "parent_id": "7220", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7220</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7233</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7233</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1641"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7232", "answer_count": 1, "body": "XcodeでViewの上にUIWebViewを置いています。 \n画面いっぱいにUIWebViewを広げたく、Tailing Space, Leading Space, Bottom Space, Top\nSpaceの値をSuperview(view)から”0”に設定すると左右に空白が発生します。Tailing Space, Leading\nSpaceの値を”-16”にすると画面いっぱいになります。非常に違和感を感じます。これはpaddingか何かある状態なのでしょうか?通常の状態なのでしょうか?なぜ、このようなことになっているかわかりません。ご存知の方、ご教示お願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T10:25:49.620", "favorite_count": 0, "id": "7221", "last_activity_date": "2015-02-27T14:50:10.883", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8593", "post_type": "question", "score": 0, "tags": [ "xcode", "storyboard" ], "title": "UIWebViewのConstrains制限の違和感", "view_count": 263 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "マージンに設定された値を基準として使用するかどうか、AutoLayoutを指定する画面で設定出来るようになっています。\n\n![制約の対象をマージンにする](https://i.stack.imgur.com/NBlKU.png)\n\nチェックを付けた場合、-16で画面の端になります(モーダル表示した場合は変わってきますが)。チェックを外した場合、0が画面の端を表すようになります。\n\nさらに細かい情報については、こちらが参考になるかと。\n\nios - What is \"Constrain to margin\" in Storyboard in Xcode 6 - Stack Overflow \n&lt;https://stackoverflow.com/questions/25807545/what-is-constrain-to-margin-in-\nstoryboard-in-xcode-6>", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T14:50:10.883", "id": "7232", "last_activity_date": "2015-02-27T14:50:10.883", "last_edit_date": "2020-06-17T08:14:45.997", "last_editor_user_id": "-1", "owner_user_id": "7459", "parent_id": "7221", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7221</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7232</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7232</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1642"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "あるサービスにプログラム上からPythonでログインしたいと思っています。 \nしかし、「動作環境が対象外です」というページに飛ばされてしまいます。 \nUser-Agentを偽装しても同じようなことが起こってしまいます。 \nUser-Agent以外で環境を判定しているような箇所はないのでしょうか? \n必要な情報は全て、POSTで送っています。 \nちなみにリクエストを送る先は.jspファイルです。 \n送っているデータはUserid, passwordでUserIdは8桁の数字、passwordは8文字の英数字です。 \nちなみにこのサービスの実装がどうなっているのか、私はわかりません。 \nStatusは200 OKを返しています。\n\n```\n\n \n import urllib.request\n import urllib.parse\n \n post_data = {\"UserId\": 12345678, \"Password\": \"password\"}\n encoded_data = urllib.parse.urlencode(post_data).encode()\n req = urllib.request.Request(\"http://example.com/login\", \n encoded_data,\n headers={\"User-Agent\": \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"})\n res = urllib.request.urlopen(req)\n res_read = res.read().decode(\"shift-jis\") # res_readに\"動作環境が対象外です\"の文字が含まれています。\n \n \n```\n\n必要な動作環境は以下の通りです。\n\nWindows Vista SP2以上 \n・Internet Explorer 7 \n・Internet Explorer 8 \n・Internet Explorer 9 \n・Google Chrome\n\nWindows 7 \n・Internet Explorer 8 \n・Internet Explorer 9 \n・Internet Explorer 10 \n・Internet Explorer 11 \n・Google Chrome\n\nWindows 8 (デスクトップUI) \n・Internet Explorer 10\n\nWindows 8.1 (デスクトップUI) \n・Internet Explorer 11\n\nMac OS X 10.6 \n・Safari 5.1.7\n\nMac OS X 10.7 \n・Safari 5.1.7", "comment_count": 9, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T10:42:56.110", "favorite_count": 0, "id": "7223", "last_activity_date": "2015-03-06T12:53:05.813", "last_edit_date": "2015-03-02T10:03:38.750", "last_editor_user_id": "5246", "owner_user_id": "5246", "post_type": "question", "score": 0, "tags": [ "python", "http", "jsp" ], "title": "ブラウザの動作環境の判定", "view_count": 942 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "> User-Agent以外で環境を判定しているような箇所はないのでしょうか?\n\nブラウザやOSを判別したい **だけ**\nならUAで事足りることも多いですが、それだけを理由に「動作環境が対象外です」というエラーが表示されるとは限りません。\n\nですから、エラーが出る原因となる箇所は **いくらでも考えられます**\n。また、これまでに質問者さんが提示している情報では、それが具体的に何かまではわかりません。\n\n## どうやって調べるか\n\nどのように実装されているかわからない以上、あなたがブラウザを操作してログインできた、という時に行われた通信が一番の参考資料になります。これを各種ツールで覗き見ることになるでしょう。\n\n * ブラウザのデバッグ機能(Chromeでいえば開発者ツールのNetworkタブ)\n * Fiddlerなどのデバッグプロキシ\n * Wiresharkなどのパケットキャプチャツール\n\n* * *\n\nというのが一般的な回答になると思いますが、個人的な想像としては・・・。\n\nログイン画面なのにIDとパスワードだけしかPOSTしないなんてのはセキュリティがーって言われそうなので、POSTするパラメータも足りてない気がします。`&lt;input\ntype=\"hidden\">` とかHTMLに書かれていませんか?CookieにもセッションIDとか入ってそうです。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-06T12:53:05.813", "id": "7556", "last_activity_date": "2015-03-06T12:53:05.813", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8000", "parent_id": "7223", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7223</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7556</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1643"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7251", "answer_count": 1, "body": "下記違いは何でしょうか?\n\n```\n\n Object.create(Object.prototype);\n \n Object.create({});\n \n```\n\n・上 … null をプロトタイプとするオブジェクト \n・下 … 上 をプロトタイプとするオブジェクト?\n\n・それぞれメリットデメリットがあれば知りたいです", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T10:51:52.163", "favorite_count": 0, "id": "7224", "last_activity_date": "2015-02-28T11:46:15.003", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7886", "post_type": "question", "score": 3, "tags": [ "javascript" ], "title": "Object.create(Object.prototype);とObject.create({});の違い", "view_count": 175 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "どちらも実質的には同じですので、メリットデメリットといったものはありません。\n\n厳密には、下の`Object.create({});`は以下のコードと等価です。\n\n```\n\n Object.create(Object.create(Object.prototype));\n \n```\n\n内部的にはプロトタイプチェーンの階層が異なります。\n\nつまり、`Object.create(Object.prototype);`は直接の`prototype`が`Object.prototype`であるオブジェクトを生成しますが、`Object.create({});`の場合は直接の`prototype`は`{}`によって生成されたオブジェクトになります。その`{}`によって生成されたオブジェクトの`prototype`は`Object.prototype`です。\n\n```\n\n a = {};\n \n b = Object.create(Object.prototype);\n a.isPrototypeOf(b); // false\n Object.prototype.isPrototypeOf(b); // true\n \n b = Object.create(a);\n a.isPrototypeOf(b); // true\n Object.prototype.isPrototypeOf(b); // true\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T11:46:15.003", "id": "7251", "last_activity_date": "2015-02-28T11:46:15.003", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3639", "parent_id": "7224", "post_type": "answer", "score": 4 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7224</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7251</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7251</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1644"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7229", "answer_count": 1, "body": "Golangでsudoでコマンドを実行するにはどうすればいいのでしょうか? \nPythonなどの他の言語では\n\n```\n\n \n os.system(\"echo 'mypassword' | sudo -S command\")\n \n \n```\n\nとすれば \n実行できますがGolangではどのようにすれば良いのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T13:11:10.663", "favorite_count": 0, "id": "7228", "last_activity_date": "2015-02-27T13:30:38.697", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5246", "post_type": "question", "score": 1, "tags": [ "bash", "go" ], "title": "Golangでパスワードを入力せずにsudoでコマンドを実行する", "view_count": 1125 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "`exec.Command`を使用します。\n\n```\n\n package main\n \n import (\n \"log\"\n \"os\"\n \"os/exec\"\n \"strings\"\n )\n \n func main() {\n cmd := exec.Command(\"sudo\", \"-S\", \"command\")\n cmd.Stdin = strings.NewReader(\"mypassword\" + \"\\n\")\n cmd.Stdout = os.Stdout\n \n err := cmd.Run()\n if err != nil {\n log.Fatal(err)\n }\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T13:23:16.220", "id": "7229", "last_activity_date": "2015-02-27T13:23:16.220", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3639", "parent_id": "7228", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7228</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7229</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7229</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1645"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7237", "answer_count": 2, "body": "swiftで実装をしていて、ビルドは通るものの、 \nアプリ起動後に、 \nfatal error: unexpectedly found nil while unwrapping an Optional value \nのエラーが出る場合、ソースコードのどこが原因かを探るデバッグはどのように進めていくのが定石なのでしょうか?\n\nよくこのエラーではまるのですが、どのファイルの何行目でこのエラーが起きているのかまで表示されないため、毎回ソースコードを全部見て原因を探っていて \nもっと効率的なデバッグ方法があればと思い質問してみました。\n\n追記 \n具体的には↓のような画面でとまります。 \nbreakpoint navigator でException Breakpoint を追加しても特に変わりありません。\n\n![画像の説明をここに入力](https://i.stack.imgur.com/3JGWV.png)\n\nよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T13:58:22.580", "favorite_count": 0, "id": "7231", "last_activity_date": "2015-03-01T01:54:11.417", "last_edit_date": "2015-02-27T15:55:28.217", "last_editor_user_id": "5852", "owner_user_id": "5852", "post_type": "question", "score": 2, "tags": [ "objective-c", "swift", "xcode" ], "title": "swiftでfatal error: unexpectedly found nil while unwrapping an Optional valueが出た時のデバッグ方法", "view_count": 4821 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "特に何も設定しなくても、以下の様な感じでエラーの原因となった行が表示されないでしょうか・・・?\n\n![エラーが発生](https://i.stack.imgur.com/gJaOv.png)\n\nうまく動作しない場合、以下の設定でどうにか出来るかもしれません。\n\n![例外にブレークポイントを設定](https://i.stack.imgur.com/5i8Pp.png)", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T15:21:30.160", "id": "7234", "last_activity_date": "2015-02-27T15:21:30.160", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7459", "parent_id": "7231", "post_type": "answer", "score": 1 }, { "body": "示されてる画面の左側のペインにはスタックフレーム(クラッシュが発生する地点までにどのようなメソッドが呼ばれたか)が表示されています。\n\n上の方が新しくて、下に行くほど、過去にさかのぼることになります。\n\n直接のクラッシュが発生しているのは運悪くシステムのコードに当たっていますが、一つさかのぼると、おそらくご自分で書かれたコードのクラッシュを引き起こしている箇所が表示されると思います。\n\n↓ 下記に示すように赤く囲ったところをクリックしてみてください。 \n画像では右が切れているので詳細はわかりませんが、おそらく、`iBeaconCentral`というクラスのテーブルビューのデリゲートメソッドのどこかが表示されると思います。\n\n基本的にはそこがクラッシュの直接の原因です。\n\n![画像の説明をここに入力](https://i.stack.imgur.com/x2Fxx.png)", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T18:17:00.630", "id": "7237", "last_activity_date": "2015-02-27T18:17:00.630", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5519", "parent_id": "7231", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7231</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7237</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7237</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1646"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 0, "body": "Symfony\n2.6と、[FOSUserBundle](https://github.com/FriendsOfSymfony/FOSUserBundle)を使い、ユーザー登録が必要なサイトを作ろうとしています。 \nデフォルトで用意されているフィールド以外に、String型のカスタムフィールドを持った上でカスタムバリデーションを設定し、指定のDB上のカラムへとORM経由で入力したいと考えました。\n\n&lt;https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_forms.md> \n上記、FOSUserBundleの公式ドキュメントに書いてある通り、src/Acme/UserBundle/Entity/User.php で\nFOS\\UserBundle\\Model\\User をオーバーライドする方法でこの機能を実装しようと試みました。\n\n結果として、フォームとバリデーションに関しては正常に動作するようになりました。 \nしかし、そこから入力された値が入るはずのカラムが生成されません。 \n上記公式ドキュメントの指示通りにString型のカスタムフィールドを実装した後、[このサイト](http://old.ganchiku.com/blog/2012/05/1175.html)を参考に\n\n```\n\n php app/console doctrine:generate:entities Acme\n \n```\n\n> [以下出力] \n> Generating entities for namespace \"Acme\" \n> backing up User.php to User.php~ \n> generating Acme\\UserBundle\\Entity\\User\n\nでアクセサを作成し、\n\n```\n\n php console doctrine:schema:update --force\n \n```\n\nでスキーマをアップデートし、この時点でカスタムフィールドを格納するカラムがDB上に生成されるはずでした。 \nしかし、schema:updateでは以下のメッセージが出力されるのみで、カラムについても追加はされておりませんでした。\n\n> Nothing to update - your database is already in sync with the current entity\n> metadata.\n\n結果として、今もバリデーションのみうまく動作しているフォームが/register/にあるのみで、そこに値を入れても保存されず素通りしてしまいます。 \nこの場合、どうすればカスタムフィールドの値が保存されるようになりますでしょうか。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-27T16:45:09.883", "favorite_count": 0, "id": "7236", "last_activity_date": "2015-02-27T16:45:09.883", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8050", "post_type": "question", "score": 3, "tags": [ "symfony2" ], "title": "Symfony2のFOSUserBundleで、fos_user_registration(登録フォーム)にオリジナルのフォーム及びそこから入力された情報を格納するORM上のカラムを生成したい", "view_count": 285 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div> <span class="block ">[]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7236</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1647"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7242", "answer_count": 1, "body": "`&lt;style>`タグは通常`&lt;head>&lt;/head>`内に置くものといった説明がされていますが、`&lt;body>` \n内に置いたときの動作がどうなるかの説明はどこかにないでしょうか? \n対象はメジャーな最新ブラウザのみでよいです。 \n試しに、Safari8.0.3で以下のhtmlを表示すると、`&lt;div>hoge&lt;/div>`の内容が赤くスタイリングされました。\n\n```\n\n &lt;!DOCTYPE html>\n &lt;html>\n &lt;head>\n &lt;/head>\n &lt;body>\n &lt;div>hoge&lt;/div>\n &lt;style>\n div { border: 2px solid red; }\n &lt;/style>\n &lt;/body>\n &lt;/html>\n \n```\n\n![画像の説明をここに入力](https://i.stack.imgur.com/s3Nxp.png) \nこちらのHTML5 `&lt;style scoped>`の説明はscoped属性の説明なのでちょっと違う気がします。 \n&lt;http://hyper-text.org/archives/2013/02/style_scoped_attr.shtml>\n\n**`&lt;head>&lt;/head>`内におけばいいんだよ。細けえことはいいんだよ**という意見もありますが、HTML5で許可されている?ような気もして、気になったので。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T00:38:51.063", "favorite_count": 0, "id": "7241", "last_activity_date": "2015-02-28T02:12:00.627", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8601", "post_type": "question", "score": 4, "tags": [ "html", "css" ], "title": "&lt;body>内に&lt;style>を設定したときの動作仕様", "view_count": 19479 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "検証してみました。検証につかったページは[こちら](http://aduca.org/stackoverflow/7241/)です。\n\n結論を先に述べると、モダンブラウザにおいて、`&lt;body>` 内の `&lt;style>` がなんらかの特別扱い(`&lt;head>`\nにあるのとないのとの違い)を受けることはなく、順当に上から順に評価されていくようです。\n\n`scoped` 属性を持ったものは Firefox 以外では考慮されず、平気で上書きされてしまいました(未対応なので当たり前ですね)。\n\n以下、とりあえず手元ですぐ出来そうな検証だけ行ないました。環境は OS X Yosemite 10.10.2 上です。Internet Explorer\nだけ、OS X 上の Parallels で起動した Windows 8.1 の中で動いたものを利用しています。\n\n各ブラウザのバージョンもぱっとわかる限り表記しておいたので、不足があれば[検証ページ](http://aduca.org/stackoverflow/7241/)をご自分でご覧になって確認してみてください。\n\n# Chrome\n\n40.0.2214.115(64-bit)\n\n![Chrome](https://i.stack.imgur.com/83HiA.png)\n\n# Safari\n\n8.0.3 (10600.3.18)\n\n![Safari](https://i.stack.imgur.com/JNJMl.png)\n\n# Firefox\n\n36.0\n\n![Firefox](https://i.stack.imgur.com/L9HLm.png)\n\n# Opera\n\n27.0.1689.76\n\n![Opera](https://i.stack.imgur.com/Y0GCf.png)\n\n# Internet Explorer\n\n11.0.9600.17631\n\n![IE](https://i.stack.imgur.com/rrrHS.png)\n\n# iOS Safari\n\niOS 8.1\n\n![iOS](https://i.stack.imgur.com/OgMMF.png)\n\n# Android 5\n\nGenymotion 上なので不正確な可能性があります。\n\n![Android](https://i.stack.imgur.com/7VW0K.png)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T02:12:00.627", "id": "7242", "last_activity_date": "2015-02-28T02:12:00.627", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8602", "parent_id": "7241", "post_type": "answer", "score": 7 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7241</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7242</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7242</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1648"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 2, "body": "EclipseでAndroidアプリケーションを作りたいです。 \nサーバ側もJava + Springで作成する予定です。\n\nAndroidとサーバの間はJSONを使って通信を行いたいので、プロジェクトを3つに分けられないかなと考えています。\n\n 1. Androidプロジェクト\n 2. サーバサイドプロジェクト\n 3. Json通信を行う際にデータを入れるPOJOのプロジェクト(1/2から共通で参照)\n\nEclipseを1つしか立ち上げないで開発すると大変そうなので、1/2は別のワークスペースにしてEclipseを2つ立ち上げて開発したいなと思います。\n\nこのような感じで開発したいのですが、Eclipseでどうやればマルチプロジェクトにできるかよくわからないんです。\n\nEclipseでプロジェクトを作ると、Androidはただのプロジェクトに、サーバ側(Sprint Tool\nSuiteを使って作成したプロジェクト)はMavenプロジェクトになっちゃいます。\n\n普通に考えればMaven or Gradleのどちらで統一した方がいいと思うんです。 \nだけれども、Maven/Gradleのどっちもよくわかりません。\n\nすいませんが、Eclipseを使ってマルチプロジェクト構成にする方法を教えて下さい。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T04:27:22.510", "favorite_count": 0, "id": "7243", "last_activity_date": "2015-07-30T04:57:49.550", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8247", "post_type": "question", "score": 3, "tags": [ "android", "java", "eclipse", "gradle", "maven" ], "title": "Eclipseでマルチプロジェクトの作成方法がわからない", "view_count": 3064 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "1つのワークスペースに \n3つプロジェクトをいれる ではダメなんでしたっけ。。。?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T07:03:49.057", "id": "7244", "last_activity_date": "2015-02-28T07:03:49.057", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "845", "parent_id": "7243", "post_type": "answer", "score": 1 }, { "body": "ワークスペースと、プロジェクトの関係であいまいのまま作業されているように思えますが…、 \nマルチプロジェクト(?)にしたい意図は何でしょうか。\n\n * 1つのワークスペースに3つのプロジェクトが並んでいる状態で何か問題ありますでしょうか。\n * 1つのプロジェクトから他のプロジェクト参照はビルドパスの設定で可能です。\n * mavenを使うのであれば、mavenのプロジェクトとして他プロジェクトを参照できます。\n\nなお、複数のプロジェクトを束ねるものとしてマルチ\"モジュール\"プロジェクトの形式がありますが、その前にmaven/gradleを使ったプロジェクトの構成について学習すべきと存じます。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T00:59:25.373", "id": "7296", "last_activity_date": "2015-03-02T00:59:25.373", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5778", "parent_id": "7243", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7243</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7244</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1649"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 2, "body": "またそれぞれ利点を教えてください。。。。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T09:55:02.677", "favorite_count": 0, "id": "7247", "last_activity_date": "2015-02-28T22:17:54.273", "last_edit_date": "2015-02-28T22:17:54.273", "last_editor_user_id": "5005", "owner_user_id": "8269", "post_type": "question", "score": -3, "tags": [ "android", "unity3d", "eclipse" ], "title": "androidゲーム開発はeclipseよりunityのほうが効率いいですか?", "view_count": 989 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "Eclipseでもunityでもマニュアルやヘルプを読んで、分からない等具体的な問題が発生してから聞くといいと思います。\n\ngoogleはandroidStudioを薦めていますので、そちらも調べたほうが良さそうです。\n\nついでに「スタックオーバーフロー」のマニュアルも読んだほうがいいと思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T10:12:26.603", "id": "7250", "last_activity_date": "2015-02-28T10:24:08.440", "last_edit_date": "2015-02-28T10:24:08.440", "last_editor_user_id": "7256", "owner_user_id": "7256", "parent_id": "7247", "post_type": "answer", "score": 2 }, { "body": "圧倒的にUnityを使った方が簡単で早いです。 \nEclipseで0からゲームを作ろうと思ったら自分でUnity相当の機能を実装する必要があります。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T18:40:04.620", "id": "7257", "last_activity_date": "2015-02-28T18:40:04.620", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5005", "parent_id": "7247", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7247</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7257</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1650"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 0, "body": "ただいまVBAを使ってExcelからRDSまたはEC2上のMySQL\nDBに接続しようかとサーチしています。これまでローカルまたはオンプレミスのODBC接続は経験があるのですが、AWSに接続したことがありません。どなたかご存知な方がいらっしゃいましたら教えていただけると幸いです。\n\nVBAでSERVERを設定しますが、そこにAWSのDNS情報やRDSのエンドポイントを書いて試しましたがうまくいきませんでした。。。\n\n宜しくお願い致します。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T13:32:28.853", "favorite_count": 0, "id": "7253", "last_activity_date": "2015-02-28T13:32:28.853", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8284", "post_type": "question", "score": 1, "tags": [ "vba", "aws", "excel" ], "title": "ExcelからRDS MySQLにODBC接続するために", "view_count": 1761 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div> <span class="block ">[]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7253</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1651"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7256", "answer_count": 2, "body": "先日PHPでよいデバッグ方法はないか、ここのサイトで質問してみました。 \nそしてvar_dumpという関数を使う方法を教えていただいたので、早速使ってみました。\n\nそしたら添付画像のように文字化けを起こします。\n\nブラウザはFireFoxを使っていて、開発中のサイトを右クリック→「ページのソースを表示」でvar_dumpの結果を表示させています。\n\nなぜこのように文字化けを起こしてしまうのでしょうか? \nまた、文字化けを起こさないよう何か良い方法がありましたら教えてください。\n\nよろしくお願い致します。\n\n【開発環境】 \n・Windows7pro \n・PHP \n・HTML \n・ブラウザ:FireFox \n・エディタ:NoEditor ※PHPとHTMLを編集用として使用\n\n#\n\n【続報】 \nFireFoxのメニューにある「文字エンコーディング」という箇所で \n「日本語(EUC-JP)」を選択したらvar_dumpの結果が正しく表示 \nされるようになりました。 \nでも、別の問題が発生しました。 \n今回、追加で添付した画像のように、今度は現在制作中のHPの方が \n文字化けを起こすようになってしまいました。 \nそもそも、これは仕方のないことなのでしょうか? \nそれとも何か改善方法はありますでしょうか? \n※PHPファイルはUTF8Nの形式で保存しております。\n\n![文字化けした画面](https://i.stack.imgur.com/PSres.jpg)\n\n![画像の説明をここに入力](https://i.stack.imgur.com/KcZdF.jpg)", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T14:24:35.643", "favorite_count": 0, "id": "7254", "last_activity_date": "2015-03-02T01:56:58.297", "last_edit_date": "2015-03-01T12:03:52.187", "last_editor_user_id": "7634", "owner_user_id": "7634", "post_type": "question", "score": 4, "tags": [ "php", "windows", "firefox" ], "title": "PHPのvar_dumpを使うと文字化けを起こします。", "view_count": 9803 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "ブラウザの文字エンコードが自動認識になっていて、出力のエンコード指定ヘッダより前にデータがあるからです。ブラウザの「表示」メニューあたりで日本語の自動認識を\nUTF-8 などと指定すると直ると思います。", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T16:42:38.533", "id": "7255", "last_activity_date": "2015-02-28T16:42:38.533", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5299", "parent_id": "7254", "post_type": "answer", "score": 3 }, { "body": "asesino さんの回答をもう少し付け加えます。\n\nHTML のエンコード指定はこういったものです。\n\n```\n\n &lt;meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n \n```\n\nこれが存在しないのに文字化けしてしまう場合は、HTML (ないしは `.php` ファイル)\nの文字エンコードとブラウザの標準文字コードが合致していない場合に起こります。\n\n従って、表示させているファイル自身の文字コードを変えてみるといいと思います。 \n通例でよく利用されるのは `UTF-8` という文字コードです。(少し古いものだったら EUC-JP など、ガラケー用の\nwebサイトになるとキャリアにもよりますが Shift-JIS などもあります)\n\n* * *\n\n補足\n\nこれは推測でしかないのですが、Web_beginner さんがわざわざ\n\n> ブラウザはFireFoxを使っていて、開発中のサイトを右クリック→「ページのソースを表示」でvar_dumpの結果を表示させています。\n\n上記のようなことをしているのは、`var_dump()` の表示結果が崩れてしまっているからではないでしょうか?\n\nこれ、防ぐ手が幾つかあるんですが\n\n```\n\n echo '&lt;pre>';\n var_dump($data);\n echo'&lt;/pre>';\n \n```\n\nとします。(改行すら面倒くさい場合はそういう関数を作ってしまうのもお勧めです)\n\nすると、ちゃんと `var_dump()` が改行付きの整形済みテキストで表示されますので、もし 「`var_dump()`\nを綺麗に表示させたいな」とお考えの時は上記を試してみてください。\n\n* * *\n\n# 追記:補足していただいた内容に対する回答\n\n※見にくくて申し訳ありません。別回答として分けたほうがよさそうであればそうさせて頂きますので遠慮なく仰ってください。\n\n恐らく、PHP の環境設定ファイル内で内部エンコーディングが `EUC-JP` で設定されているのだと思います。 \n問題点としては、`var_dump()` では `EUC-JP` 正しく表示され、Webサイト自体は `UTF-8`\nで正しく表示されるようになっている、ということですね。\n\n## 対処法 1. PHP の設定ファイルを変更する\n\nこれは以下のファイルを編集することで解決しますが、触れない環境であれば他の対処法を試してみてください。\n\n 1. 変更するファイル:`/etc/php.ini`\n 2. 変更する箇所:`[mbstring]`\n\nmbstring.language=Japanese \nmbstring.internal_encoding=\"UTF-8\" \nmbstring.http_output=\"UTF-8\"\n\n上記を設定し終えたら、Apache を再起動ないしは設定ファイルのリロードをしてください。\n\n## 対処法 2. meta タグで文字コードを指定する\n\n最初に述べたとおり\n\n```\n\n &lt;meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n \n```\n\n上記 meta タグを タグと タグの間に挿入することによって「この web ページは UTF-8\nで表示するつもりだよ」ということをブラウザに教えてあげることができます。\n\nその他の meta タグについてはこちらを参照してください。 \n&lt;http://www.htmq.com/html5/meta.shtml>\n\nただ、var_dump() 自体が `EUC-JP` で表示されている場合、meta\nタグだと効果が無いかもしれません…。(今手元に試せる環境が無いので確認ができません)\n\n## 対処法 3. `var_dump()` の出力を文字エンコーディングして出力させるようにする\n\nもういっそ `var_dump()` を使わず、自前で `var_dump()` のような関数を用意する方法です。 \nこれは `mb_convert_encoding()` によって `var_dump()` で出力される文字コードを自前で変換します。\n\n例えば、以下のような関数を自前で作ってしまいます。\n\n```\n\n /**\n * var_dump 文字化け回避用.\n * @param mixed $variable 表示したいデータ\n * @return string var_dump() 文字列\n */\n function vd( $variable )\n {\n $dump_object = '';\n ob_start();\n {\n var_dump( $variable );\n $dump_object = ob_get_contents();\n }\n ob_end_clean();\n return mb_convert_encoding('&lt;pre>'.$dump_object.'&lt;/pre>', 'UTF-8');\n }\n \n```\n\n使い方は、以下のように使います。\n\n```\n\n echo vd( array('ほげ','もげ','ぴよ','foo','baz','bar') );\n \n```\n\n`var_dump()` は使ったその場で出力されましたが、この関数は `var_dump()`\nで出力される内容をそのまま出力せずに、文字列として返します。 \nその為、関数の前に `echo` が必要になります。(もちろん vd 関数内で return せず、そのまま `echo` でもいいと思います。)\n\n以上、いかがでしょうか。 \nもし他に何か情報がありましたら、更に追記する形でお知らせください。", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T16:52:05.533", "id": "7256", "last_activity_date": "2015-03-02T01:56:58.297", "last_edit_date": "2015-03-02T01:56:58.297", "last_editor_user_id": "7926", "owner_user_id": "7926", "parent_id": "7254", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7254</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7256</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7255</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1652"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7278", "answer_count": 3, "body": "たとえば、aaa222が右に100px動いていて、bbbをクリックすると、その動いていたaaa222を元の0pxのポジションに戻して、bbb222を右に100px動かしたいです。 \nccc222も同じように動いてほしいです。 \nつまり、右側に動かすのは1つだけで、ほかの2つはクリックされたら、元の0pxに戻る、というプログラムにしたいのですが、どうしたらよいのでしょうか?\n\n```\n\n &lt;script>\r\n $(function(){\r\n var duration=300;\r\n var $a2=$(\"#aaa222\");\r\n $(\"#aaa\").on(\"click\",function(){\r\n $a2.toggleClass(\"goA2\");\r\n if($a2.hasClass(\"goA2\")){\r\n $a2.stop(true).animate({\r\n left:100},\r\n duration);\r\n }else{\r\n $a2.stop(true).animate({\r\n left:0},\r\n duration);\r\n }\r\n })\r\n \r\n });\r\n \r\n $(function(){\r\n var duration=300;\r\n var $b2=$(\"#bbb222\");\r\n $(\"#bbb\").on(\"click\",function(){\r\n $b2.toggleClass(\"goB2\");\r\n if($b2.hasClass(\"goB2\")){\r\n $b2.stop(true).animate({\r\n left:100},\r\n duration);\r\n }else{\r\n $b2.stop(true).animate({\r\n left:0},\r\n duration);\r\n }\r\n })\r\n \r\n });\r\n \r\n $(function(){\r\n var duration=300;\r\n var $c2=$(\"#ccc222\");\r\n $(\"#ccc\").on(\"click\",function(){\r\n $c2.toggleClass(\"goC2\");\r\n if($c2.hasClass(\"goC2\")){\r\n $c2.stop(true).animate({\r\n left:100},\r\n duration);\r\n }else{\r\n $c2.stop(true).animate({\r\n left:0},\r\n duration);\r\n }\r\n })\r\n \r\n });\r\n \r\n &lt;/script>\n```\n\n```\n\n &lt;style>\r\n #aaa{\r\n display:block;\r\n position:relative;\r\n width:500px;\r\n height:50px;\r\n background:rgba(0,0,255,1);\r\n }\r\n #aaa222{\r\n display:block;\r\n position:relative;\r\n top:20px;\r\n width:50px;\r\n height:10px;\r\n background:rgba(51,255,153,1);\r\n \r\n }\r\n #bbb{\r\n display:block;\r\n position:relative;\r\n width:500px;\r\n height:50px;\r\n background:rgba(0,255,255,1);\r\n }\r\n #bbb222{\r\n display:block;\r\n position:relative;\r\n top:20px;\r\n width:50px;\r\n height:10px;\r\n background:rgba(153,51,102,1);\r\n \r\n }\r\n #ccc{\r\n display:block;\r\n position:relative;\r\n width:500px;\r\n height:50px;\r\n background:rgba(50,100,100,1);\r\n }\r\n #ccc222{\r\n display:block;\r\n position:relative;\r\n top:20px;\r\n width:50px;\r\n height:10px;\r\n background:rgba(153,0,0,1);\r\n \r\n }\r\n \r\n \r\n \r\n &lt;/style>\n```\n\n```\n\n &lt;body>\r\n \r\n &lt;div id=\"aaa\">&lt;div id=\"aaa222\">&lt;/div>&lt;/div>\r\n &lt;div id=\"bbb\">&lt;div id=\"bbb222\">&lt;/div>&lt;/div>\r\n &lt;div id=\"ccc\">&lt;div id=\"ccc222\">&lt;/div>&lt;/div>\r\n &lt;/body>\n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-02-28T22:51:37.347", "favorite_count": 0, "id": "7258", "last_activity_date": "2015-03-04T12:55:25.573", "last_edit_date": "2015-03-01T00:24:56.753", "last_editor_user_id": "85", "owner_user_id": "7647", "post_type": "question", "score": 1, "tags": [ "javascript", "jquery" ], "title": "jQuery - 3つある要素の1つをクリックして右に動かし、残りの2つを元のポジションに戻すコードを書きたい", "view_count": 577 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "一つのイベントから3つのエレメントを動かしたいならそういうプログラムにする必要があると思います。 \nonのハンドラの中に\n\n```\n\n $('#aaa222,#bbb2222,#ccc222').each(function(i, bar){\n if(イベントが起きたのが自分か){\n $(bar).stop().animate({left:100, duration:300});\n } else {\n $(bar).stop().animate({left:0, duration:300});\n }\n });\n \n```\n\nのような処理を書く必要があるでしょう。 \n全部書くと、それはつまり私のためにプログラムを書いてくださいということとほぼ等しくなってしまうのでこれだけにしておきます。 \nアドバイスとして言えることは、バブリングに注意してください。というくらいですかね。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T01:00:14.780", "id": "7259", "last_activity_date": "2015-03-01T01:00:14.780", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8136", "parent_id": "7258", "post_type": "answer", "score": 2 }, { "body": "色々やり方はあると思いますが、 \n以下の様にすればいいかと思います。\n\n```\n\n $(function(){\n var duration=300;\n $(\"#aaa222,#bbb222,#ccc222\").bind(\"move\", function(e, myID){\n //クラスの代わりにIDを使うことにした。既に効果が適用されているかどうかのチェックは行わないことにしている。\n if($(this).attr(\"id\")==myID){\n $(this).stop(true)\n .animate({left:100},duration);\n } else {\n $(this).stop(true)\n .animate({left:0},duration);\n }\n });\n \n $(\"#aaa,#bbb,#ccc\").on(\"click\",function(){\n var ID = $(this).attr(\"id\") + 222;//親要素と規則性がある\n //それぞれに効果を呼び出す(カスタムイベント発火)\n $(\"#aaa222\").triggerHandler(\"move\", ID);\n $(\"#bbb222\").triggerHandler(\"move\", ID);\n $(\"#ccc222\").triggerHandler(\"move\", ID);\n });\n });\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T12:41:22.533", "id": "7278", "last_activity_date": "2015-03-01T12:41:22.533", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5044", "parent_id": "7258", "post_type": "answer", "score": 1 }, { "body": "もう一つ`&lt;div>`を追加して、各要素にクラスを割り当てれば以下のように書けます。 \n(`&lt;div>`は追加する必要はないんですが、実用的ではないので・・・)\n\n```\n\n &lt;script>\n $(function(){\n var duration=300;\n $(document).on('click', '.parent', function(){\n $(this).siblings().find('.child').stop(true).animate({left:0}, duration);\n $(this).find('.child').stop(true).animate({left:100}, duration);\n });\n });\n &lt;/script>\n \n```\n\n```\n\n &lt;body>\n &lt;div>\n &lt;div id=\"aaa\" class=\"parent\">&lt;div id=\"aaa222\" class=\"child\">&lt;/div>&lt;/div>\n &lt;div id=\"bbb\" class=\"parent\">&lt;div id=\"bbb222\" class=\"child\">&lt;/div>&lt;/div>\n &lt;div id=\"ccc\" class=\"parent\">&lt;div id=\"ccc222\" class=\"child\">&lt;/div>&lt;/div>\n &lt;/div>\n &lt;/body>\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T06:50:45.000", "id": "7319", "last_activity_date": "2015-03-04T12:55:25.573", "last_edit_date": "2015-03-04T12:55:25.573", "last_editor_user_id": "7214", "owner_user_id": "7214", "parent_id": "7258", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7258</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7278</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7259</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1653"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7392", "answer_count": 2, "body": "ContentProvider(コンテンツプロバイダ)からAndroid端末のPlayストアアプリにアクセスし、Google\nPlayの検索履歴を取得したいと思っています。Android4.*まではアクセス可能でしたが、Android5.0からは以下の例外が発生しアクセスできなくなってしまいました。 \nPlayストアへのアクセスを許可する方法はありますでしょうか?\n\n例外:\n\n```\n\n java.lang.SecurityException: Permission Denial: opening provider com.google.android.finsky.providers.RecentSuggestionsProvider from ProcessRecord\n \n```\n\nJavaソースコード:\n\n```\n\n try{\n Object obj = Uri.parse(\"content://com.google.android.finsky.RecentSuggestionsProvider/suggestions\");\n ContentResolver contentresolver = l.getContentResolver();\n String as1[];\n (as1 = new String[1])[0] = \"_id || ',' || date || ',' || display1 as _id\";\n String as2[];\n (as2 = new String[1])[0] = \"\";\n if((obj1 = contentresolver.query(((Uri) (obj1)), as1, \"''=?\", as2, \"date desc\"))== null)\n }catch(Exception exception){\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T01:25:23.377", "favorite_count": 0, "id": "7260", "last_activity_date": "2015-03-03T15:23:29.023", "last_edit_date": "2015-03-01T02:02:42.040", "last_editor_user_id": "8558", "owner_user_id": "8558", "post_type": "question", "score": 3, "tags": [ "android", "java", "google-play" ], "title": "ContentProviderでAndroid5.0のGoogle Play•Playストアへのアクセスを許可したい", "view_count": 408 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "手持ちのandroid 4.4.4で試したところ同様の結果(エラーメッセージ含む)になり、取得できませんでした。 \nコメントできないのでこちらにて報告します。\n\nもし解決できたら回答を編集します。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T12:06:25.640", "id": "7383", "last_activity_date": "2015-03-03T12:06:25.640", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7256", "parent_id": "7260", "post_type": "answer", "score": 1 }, { "body": "例外は最後まで記入することをおすすめします。 \nなぜ例外が出たのか重要な情報源となります。\n\n`java.lang.SecurityException: Permission Denial`は、アクセスが許可されていないということです。 \n記入された例外が途中で切れてるのですが、例外1行目の最後の方に、`is not exported`と出ているはずです。 \nこれは、アクセスしようとした`ContentProvider`が外部からのアクセスが許可されていないということです。\n\nなぜAndroid5.0で例外が出るのかは分かりません。以下は想像です。\n\nAPI Level17(Android4.2)から`ContentProvider`の`exported`のデフォルト値が変わりました。 \nAPI Level16までは、`exported`が指定されていない場合のデフォルト値は`true`です。 \nAPI Level17から、`exported`が指定されていない場合のデフォルト値は`false`です。\n\n`exported`が`true`の場合、他のアプリなどから利用できます。 \n`exported`が`false`の場合、他のアプリなどから利用できません。\n\n想像ですが、Playストアアプリの`&lt;provider>`で`exported`が未指定になったいるため、Android4.2から例外が出ているのではないかと思われます。\n\n#しかし、4.1まで簡単にPlayストアアプリの検索履歴を取得出来たんですね。おっそろしいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T15:16:22.010", "id": "7392", "last_activity_date": "2015-03-03T15:23:29.023", "last_edit_date": "2015-03-03T15:23:29.023", "last_editor_user_id": "8216", "owner_user_id": "8216", "parent_id": "7260", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7260</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7392</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7392</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1654"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "APIを叩いた後にアラートを出し、そのイベントを拾ってから次のイベントに進みたいのですが、クロージャ内で`delegate:\nself`を指定しても、イベントが拾われません。 \nObjective-Cは触っておらず、swiftも初心者なので解決法が浮かばずに困っております。\n\n```\n\n typealias CompletionHandler = (result: Bool?) -> Void\n \n class hogeViewController: UIViewController, UIAlertViewDelegate {\n \n var completion: CompletionHandler?\n \n func test(completion: (result: Bool) -> Void) {\n \n let request = NSURLRequest(URL: NSURL(string: apiUrl)!)\n NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue(), completionHandler:{ (response: NSURLResponse!, data: NSData!, error: NSError!) in\n \n let alert = UIAlertView(\n message: testMessage\n delegate: self,\n cancelButtonTitle: nil,\n otherButtonTitles: \"test1\", \"test2\")\n alert.show()\n return\n })\n }\n \n func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) {\n println(\"clickedButtonAtIndex\")\n println(buttonIndex)\n \n self.completion!(result: true)\n }\n }\n \n```\n\nお詳しい方がいましたらご回答宜しくお願い致します。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T03:53:12.643", "favorite_count": 0, "id": "7262", "last_activity_date": "2015-03-01T05:31:11.530", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8612", "post_type": "question", "score": 0, "tags": [ "swift" ], "title": "クロージャ内で指定したdelegateでイベントが拾えない", "view_count": 442 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "コンパイルが通らなかったので細部を直しましたが、私の環境ではちゃんとUIAlertViewのボタンイベントが拾われました。 \n環境:iPhone6(iOS8.1.3)\n\nちなみに UIAlertView はiOS8から非推奨なので、iOS8以上なら代わりにUIAlertControllerを使うことを推奨します。\n\n```\n\n typealias CompletionHandler = (result: Bool?) -> Void\n \n class ViewController: UIViewController, UIAlertViewDelegate {\n \n let apiUrl = \"https://www.google.co.jp\"\n \n var completion: CompletionHandler? = {(result: Bool?) in\n println(\"API completed! \\(result)\")\n }\n \n func test() {\n let request = NSURLRequest(URL: NSURL(string: apiUrl)!)\n NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue(), completionHandler:{ (response: NSURLResponse!, data: NSData!, error: NSError!) in\n \n let alert = UIAlertView(\n title: \"アラートのタイトル\",\n message: \"アラートのメッセージ\",\n delegate: self,\n cancelButtonTitle: nil,\n otherButtonTitles: \"test1\", \"test2\")\n alert.show()\n return\n })\n }\n \n func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) {\n println(\"clickedButtonAtIndex\")\n println(buttonIndex)\n \n self.completion?(result: true)\n }\n }\n \n```", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T05:31:11.530", "id": "7264", "last_activity_date": "2015-03-01T05:31:11.530", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8148", "parent_id": "7262", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7262</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7264</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1655"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7265", "answer_count": 2, "body": "Range-based for loopで参照にした時としないときではどのような違いがあるでしょうか。 \n特に速度的な面では違いがあるのでしょうか?例えばvectorをRange-based for\nloopで回す場合、単に値を書き換えることなく使う場合、通常のケースでは下記のどのケースが良いのでしょうか?直感的には3だと思われるのですが、今まで常に1を使っていました。\n\n```\n\n vector&lt;string> vec =\n {\n \"foo\", \"bar\", \"baz\"\n };\n // case 1\n for ( auto it : vec )\n {\n cout &lt;&lt; it &lt;&lt; endl;\n }\n // case 2\n for ( auto &amp;it : vec )\n {\n cout &lt;&lt; it &lt;&lt; endl;\n }\n // case 3\n for ( const auto &amp;it : vec )\n {\n cout &lt;&lt; it &lt;&lt; endl;\n }\n \n```\n\n追記 ------------- \n皆さま、申し訳ございません。確かに質問として成り立っておりませんでした。 \n私のほうでCygwin上のgcc 4.8.3でのベンチマークを追記いたします。 \n100万行程度では差がほとんど見られなかったので \nランダムなアルファベット文字列1000万行のテキストで最適化オプションなしで \n計測いたしました。\n\nケース1 参照なしのパターン\n\n```\n\n #include &lt;iostream>\n #include &lt;fstream>\n #include &lt;chrono>\n #include &lt;vector>\n \n using namespace std;\n \n int main()\n {\n vector&lt;string> v;\n \n ifstream ifs(\"test_mil.txt\");\n if (ifs.fail()) return -1;\n \n for (string line; getline(ifs, line); )\n {\n v.push_back(line);\n }\n \n const auto startTime = chrono::system_clock::now();\n \n string ss;\n int i = 0;\n for (auto s : v)\n {\n if (i % 2 == 0)\n ss = s.substr(i % s.size()); \n else\n ss = s;\n cout &lt;&lt; (i % 2);\n i++;\n }\n cout &lt;&lt; '\\n';\n \n const auto endTime = chrono::system_clock::now();\n const auto timeSpan = endTime - startTime;\n cout &lt;&lt; \"処理時間: \"\n &lt;&lt; chrono::duration_cast&lt;chrono::milliseconds>(timeSpan).count() \n &lt;&lt; \" [ms]\" &lt;&lt; std::endl;\n \n cout &lt;&lt; ss &lt;&lt; endl;\n \n return 0;\n }\n \n```\n\nケース2 参照のパターン\n\n```\n\n #include &lt;iostream>\n #include &lt;fstream>\n #include &lt;chrono>\n #include &lt;vector>\n \n using namespace std;\n \n int main()\n {\n vector&lt;string> v;\n \n ifstream ifs(\"test_mil.txt\");\n if (ifs.fail()) return -1;\n \n for (string line; getline(ifs, line); )\n {\n v.push_back(line);\n }\n \n const auto startTime = chrono::system_clock::now();\n \n string ss;\n int i = 0;\n for (auto &amp;s : v)\n {\n if (i % 2 == 0)\n ss = s.substr(i % s.size()); \n else\n ss = s;\n cout &lt;&lt; (i % 2);\n i++;\n }\n cout &lt;&lt; '\\n';\n \n const auto endTime = chrono::system_clock::now();\n const auto timeSpan = endTime - startTime;\n cout &lt;&lt; \"処理時間: \"\n &lt;&lt; chrono::duration_cast&lt;chrono::milliseconds>(timeSpan).count() \n &lt;&lt; \" [ms]\" &lt;&lt; std::endl;\n \n cout &lt;&lt; ss &lt;&lt; endl;\n \n return 0;\n }\n \n```\n\n計測結果: \nケース1 3123ms 3125ms 3135ms 平均 3128ms \nケース2 2944ms 2927ms 2935ms 平均 2935ms \nということでケース2のほうが速いことがわかりました。 \nまた次のようなコードを書くと\n\n```\n\n #include &lt;iostream>\n #include &lt;vector>\n \n using namespace std;\n \n class mystring : public std::string {\n public:\n \n mystring(const char *str) : std::string(str) { }\n \n // コピーコンストラクタ\n mystring(const mystring &amp;rhs) : string(rhs.c_str())\n {\n cout &lt;&lt; \"mystring copy constructor\" &lt;&lt; endl;\n }\n \n };\n \n int main()\n {\n vector&lt;mystring> v;\n mystring m(\"abc\");\n v.push_back(m);\n \n cout &lt;&lt; \"test start\" &lt;&lt; endl;\n for (auto &amp;s : v)\n {\n cout &lt;&lt; s &lt;&lt; endl;\n }\n cout &lt;&lt; \"test end\" &lt;&lt; endl;\n \n return 0;\n }\n \n```\n\nこのケースではコピーコンストラクタが呼び出されず、 \nfor (auto s : v)としたほうではコピーコンストラクタが呼び出されました。 \nよって私の環境下につきましてはjoy1192さんの解答の通りとなりました。", "comment_count": 7, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T05:00:39.270", "favorite_count": 0, "id": "7263", "last_activity_date": "2015-03-02T06:53:53.643", "last_edit_date": "2015-03-01T17:05:04.567", "last_editor_user_id": "7744", "owner_user_id": "7744", "post_type": "question", "score": 4, "tags": [ "c++" ], "title": "Range-based for loopで参照にした時としない時の速度面での違い", "view_count": 2181 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "case 2,case 3は用途によって使い分けるべきですが、一般的な使い方の上ではcase 1は遅くなります。\n\ncase 1の場合、 \n`vector&lt;T>`の要素を1つ1つ`auto\nit`にコピーしていきます。つまり、毎回コピーコンストラクタが呼び出されるため、単純なアクセス用途であれば無駄なコストが発生します。 \n`for`ループ内でコピーした値に対して破壊的な操作を行いたい場合に使用するケースは有るでしょう。\n\ncase 2, case 3の場合、 \n`vector&lt;T>`内の要素に対する参照を渡しているだけなので、高速です。 \n原理的にはポインタのコピー程度のコストしか発生しません。constの有無は速度には大きく関係しないはずです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T06:03:07.903", "id": "7265", "last_activity_date": "2015-03-01T06:03:07.903", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "6119", "parent_id": "7263", "post_type": "answer", "score": 4 }, { "body": "質問文の要件にある通り、コンテナ型`vector&lt;string>` かつ 要素書き換え無し ならば、 case 3:`cosnt auto&amp;`\n一択でよいでしょう。\n\n一般的に case 3:`const auto&amp;` と case 2:`auto&amp;`\nとで速度的な差異は生じませんが、要素の書き換えを伴わないforループならば、コーディング誤りを防ぐためにもconst修飾指定が望ましいです。case\n1:`auto`\nは、コンテナの要素型が基本型でもない限り避けるべきです。無駄な要素コピーによって速度的なペナルティを受けますし、要素型がコピー不可な場合はコンパイルエラーを引き起こします。\n\n一般論としては、目的に応じ下記2種類を使い分けるのがベターです。\n\n * `for (auto&amp;&amp; e : c)`:要素`e`を書き換える可能性がある\n * `for (const auto&amp; e : c)`:要素`e`を参照するだけ\n\n関連情報として、次期C++標準(C++14の次)に向けて提案さていた、Terse Range-Based\nforの[初期提案文書](http://www.open-\nstd.org/jtc1/sc22/wg21/docs/papers/2014/n3853.htm)にも次の言及があります。ただし、この提案は最終的に[却下されました](http://ezoeryou.github.io/blog/article/2014-12-11-tarse-\nrange-based-for-removed-from-clang.html)。\n\n> \"for (auto elem : range)\" is very tempting and very bad. It produces \"auto\n> elem = *__begin;\" (see 6.5.4 [stmt.ranged]/1), which copies each element,\n> which is bad because:\n>\n> * It might not compile - [...]\n> * It might misbehave at runtime - [...]\n> * It might be inefficient - [...]\n>\n\n余談ですが:`for (~ it :\nvec)`の変数名`it`はイテレータを連想させる名前なので、`s(tr)`とか`e(lem)`の方が良いかもしれませんね。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T01:48:33.623", "id": "7302", "last_activity_date": "2015-03-02T06:53:53.643", "last_edit_date": "2015-03-02T06:53:53.643", "last_editor_user_id": "49", "owner_user_id": "49", "parent_id": "7263", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7263</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7265</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7265</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1656"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7297", "answer_count": 1, "body": "ServersMan@VPS(DTI)のCentOS7のVPS上で、ファイアウォールを設定するためFirewallDの使い方を調べ、見つけたサイトのとおりに設定しました。\n\nところが、設定完了後にFirewallDをstartしても、`$ sudo systemctl status firewalld` の表示は\n`Active: inactive(dead)` のままで、その下に赤い文字で\n\n```\n\n 2015-03-01 15:07:27 ERROR: Exception DBusException: \n org.freedesktop.DBus.Error.AccessDenied: Connection \":1.71\" is not \n allowed to own the service \"org.fedoraproject.FirewallD1\" due to \n security policies in the configuration file\n \n```\n\nと表示されています。\n\nどうすれば正常にFirewallDを起動できるのでしょうか?\n\n打ったコマンドは以下のとおりです。\n\n```\n\n $ yum -y install firewalld firewalld-service firewalld-config \n $ sudo systemctl start firewalld\n $ sudo systemctl enable firewalld\n $ sudo systemctl status firewalld\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2015-03-01T06:20:59.687", "favorite_count": 0, "id": "7266", "last_activity_date": "2020-06-05T05:19:47.607", "last_edit_date": "2020-06-05T05:19:47.607", "last_editor_user_id": "7500", "owner_user_id": "7500", "post_type": "question", "score": 1, "tags": [ "centos" ], "title": "FirewallDが動作しない(org.freedesktop.DBus.Error.AccessDeniedエラー)", "view_count": 1951 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "お使いの VPS はコンテナ型なのではないでしょうか。コンテナ型だと kernel は仮想化ホスト側と共通なので、kernel の機能は使えません。 \ndbus, firewalld だけでなく、iptables 自体も使えないのではないでしょうか。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T01:00:11.363", "id": "7297", "last_activity_date": "2015-03-02T01:00:11.363", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4603", "parent_id": "7266", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7266</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7297</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7297</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1657"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7269", "answer_count": 1, "body": "こんにちわ。プログラミング初心者です。 \nRubyのversion変更ができず困っています。\n\n```\n\n ruby -v\n ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]\n \n```\n\nと出るのですが、 \n下記を実行するとエラーが出てしまい、rails tutorialが進みません。 \nどなたか知見のある方アドバイスいただけると嬉しいです。\n\n```\n\n rails generate scaffold User name:string email:string\n Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2\n \n```\n\nよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T06:50:42.647", "favorite_count": 0, "id": "7267", "last_activity_date": "2015-03-01T07:36:55.843", "last_edit_date": "2015-03-01T07:25:12.307", "last_editor_user_id": "724", "owner_user_id": "8613", "post_type": "question", "score": 1, "tags": [ "ruby-on-rails", "rbenv" ], "title": "Ruby on Rails - Rubyのversion変更ができない", "view_count": 2088 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "[rbenv](/questions/tagged/rbenv \"'rbenv' のタグが付いた質問を表示\")タグがあるので rbenv を使って ruby\nをインストールしている前提とします。 \nおそらく `rails` コマンドは rbenv によってインストールされた ruby ではなく、別の場所にインストールされている Ruby 2.0.0\nでインストールされた rails を実行しているのが原因です。 \nrbenv によってインストールされる rails のほうが前になるように PATH を設定する必要があります。\n\n例えば `~/.rbenv` 以下に rbenv がインストールされており、PATH が以下である場合\n\n```\n\n $ echo $PATH\n /Users/itochan/.rbenv/shims:/Users/itochan/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin\n \n```\n\nrails コマンドを実行したときに `/usr/bin/rails` や `/usr/local/bin/rails` ではなく\n`/Users/itochan/.rbenv/shims/rails` が実行されます。\n\nPATH の設定方法は通常シェルの設定ファイルに\n\n```\n\n export PATH=~/foo/bar:$PATH\n \n```\n\nなどと書きますが、 rbenv であれば\n\n```\n\n eval \"$(rbenv init -)\"\n \n```\n\nをシェルの設定ファイル(`.bashrc` など)に追記すると PATH が追加されます。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T07:13:06.267", "id": "7269", "last_activity_date": "2015-03-01T07:36:55.843", "last_edit_date": "2015-03-01T07:36:55.843", "last_editor_user_id": "724", "owner_user_id": "724", "parent_id": "7267", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7267</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7269</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7269</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1658"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7381", "answer_count": 1, "body": "`X(数字)`という形式の識別子をパースするパーサーを`parsers`ライブラリで書こうと思い、`Text.Parser.Token.Style.emptyIdents`を使って以下のような`IdentifierStyle`を定義しましたが、型エラーになってしまいます。\n\n```\n\n import Text.Trifecta\n import Text.Parser.Token.Style\n \n identStyle :: IdentifierStyle Parser\n identStyle = emptyIdents {\n _styleStart = char 'X' :: Parser Char,\n _styleLetter = digit :: Parser Char\n }\n \n -- パーサをこのように定義したい(例: \"X3\" -> Var 3)\n ident = Var . (read . tail) &lt;$> ident\n \n```\n\n現状はとりあえずnaiveに`ident = Var . read &lt;$> (char 'X' >> many\ndigit)`と定義していますが、何故上のコードで型エラーが出るのか知りたいです。\n\n具体的な型エラーは以下のようになります。\n\n```\n\n No instance for (Text.Parser.Token.TokenParsing t0)\n arising from a use of Text.Parser.Token.Style.emptyIdents \n The type variable t0 is ambiguous\n Note: there are several potential instances:\n instance (Text.Parser.Token.TokenParsing m,\n Control.Monad.MonadPlus m) =>\n Text.Parser.Token.TokenParsing\n (transformers-0.3.0.0:Control.Monad.Trans.Identity.IdentityT m)\n -- Defined in Text.Parser.Token \n instance parsec-3.1.8:Text.Parsec.Prim.Stream\n s m ghc-prim:GHC.Types.Char =>\n Text.Parser.Token.TokenParsing\n (parsec-3.1.8:Text.Parsec.Prim.ParsecT s u m)\n -- Defined in Text.Parser.Token \n instance attoparsec-0.12.1.3:Data.Attoparsec.Internal.Types.Chunk\n t =>\n Text.Parser.Token.TokenParsing\n (attoparsec-0.12.1.3:Data.Attoparsec.Internal.Types.Parser t)\n -- Defined in Text.Parser.Token \n ...plus 12 others\n In the expression: Text.Parser.Token.Style.emptyIdents\n In the expression:\n Text.Parser.Token.Style.emptyIdents\n {Text.Parser.Token._styleStart = Text.Parser.Char.char 'X' ::\n Text.Trifecta.Parser.Parser ghc-prim:GHC.Types.Char,\n Text.Parser.Token._styleLetter = Text.Parser.Char.digit ::\n Text.Trifecta.Parser.Parser ghc-prim:GHC.Types.Char}\n In an equation for identStyle :\n identStyle\n = Text.Parser.Token.Style.emptyIdents\n {Text.Parser.Token._styleStart = Text.Parser.Char.char 'X' ::\n Text.Trifecta.Parser.Parser ghc-prim:GHC.Types.Char,\n Text.Parser.Token._styleLetter = Text.Parser.Char.digit ::\n Text.Trifecta.Parser.Parser ghc-prim:GHC.Types.Char}\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T07:54:54.953", "favorite_count": 0, "id": "7270", "last_activity_date": "2015-03-03T10:07:32.660", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2781", "post_type": "question", "score": 2, "tags": [ "haskell" ], "title": "Text.Parser.Token.StyleのemptyIdentsの使い方について", "view_count": 207 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "Haskellのレコード更新構文は、更新の前後で型が変わらないことを要求しません。このため、更新後の型が決まっていても更新前の型が完全には決まらないことがあります。この例では、`emptyIndents`の型が`TokenParsing\nm => IdentifierStyle m`ですが、この`m`を決める手掛りがないため曖昧エラーが発生しています。\n\n回避する方法はいくつかあります。\n\n * 明示的に型注釈を与える。\n``` identStyle' :: IdentifierStyle Parser\n\n identStyle' = (emptyIdents :: IdentifierStyle Parser) {\n _styleStart = char 'X',\n _styleLetter = digit\n }\n \n```\n\n * 更新を二回に分けることで型の自由度をなくす。\n``` identStyle'' :: IdentifierStyle Parser\n\n identStyle'' = emptyIdents {\n _styleStart = char 'X'\n } {\n _styleLetter = digit\n }\n \n```\n\n * 用意されているレンズを使う。\n``` identStyle''' :: IdentifierStyle Parser\n\n identStyle''' = emptyIdents\n &amp; styleStart .~ char 'X'\n &amp; styleLetter .~ digit\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T10:07:32.660", "id": "7381", "last_activity_date": "2015-03-03T10:07:32.660", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8654", "parent_id": "7270", "post_type": "answer", "score": 5 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7270</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7381</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7381</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1659"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7382", "answer_count": 1, "body": "```\n\n myModule.controller('manager_information_controller', function($scope, member){\n \n //親画面から呼ばれる関数\n $scope.showModalForMemberInformation = function(){\n \n modal_manager.show(); \n $scope.test = \"11\";\n }\n \n //子(モーダル)画面から呼ばれる関数\n $scope.selectMembers = function(){\n \n modal_manager.hide();\n $scope.test = \"22\";\n \n }\n \n &lt;!-- ページ -->\n &lt;ons-page id=\"manager_information\" ng-controller=\"manager_information_controller\">\n \n {{newGuest}}\n \n &lt;ons-list-item modifier=\"chevron\" ng-click=\"showModalForMember()\">\n モーダルへ\n &lt;/ons-list-item> \n \n &lt;/ons-page>\n \n &lt;!-- モーダル -->\n &lt;ons-modal var=\"modal_manager\" ng-controller=\"manager_information_controller\">\n &lt;ons-button ng-click=\"selectMembers()\">検索&lt;/ons-button>\n &lt;/ons-modal>\n \n```\n\n親画面が子画面の値を見る方法が分からなくて、困っています。 \nよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T10:34:35.020", "favorite_count": 0, "id": "7273", "last_activity_date": "2015-03-03T15:10:49.230", "last_edit_date": "2015-03-01T10:55:56.413", "last_editor_user_id": "76", "owner_user_id": "8615", "post_type": "question", "score": 2, "tags": [ "monaca", "onsen-ui" ], "title": "親画面が子画面の値を見る方法", "view_count": 1344 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "あるコントローラーからons-\nmodal中のコントローラーの値を見たいということで大丈夫でしょうか。あるコントローラーから別のコントローラーに値を渡したいのであれば、少なくとも方法は2つあります。\n\n * 一つはAngularJSのサービスを使って値を渡す方法です。あるサービスを作ってそのサービスを2つの両方のコントローラーにインジェクションします。1つ目のコントローラーで値を入力して、モーダル内のコントローラーで値を受け取ることができます。詳細は下の例をみてください。\n\n詳細コード:\n\n```\n\n //サービスを作ります。\n myApp.factory('SharedData', function () {\n return { example: 'example' };\n });\n \n //コントローラーを作ってサービスをインジェクションします。親画面\n myApp.controller('ParentScreenController', function( $scope, SharedData ){\n $scope.Data = SharedData;\n });\n \n //コントローラーを作ってサービスをインジェクションします。子画面 \n myApp.controller('ChildScreenController', function( $scope, SharedData ){\n $scope.Data = SharedData;\n });\n \n```\n\n * もう一つはイベントを発行して値を渡す方法です。 1つ目のコントローラーでイベントを発行することによって、他のコントローラーにそのイベントとともに値を渡すことができます。簡単ですが、例を用意しました(注意: $rootScopeを両方のコントローラーにインジェクションして下さい) 。\n\n詳細:\n\n```\n\n // イベントおよび値を発行するコントローラー 子画面\n myApp.controller('FirstController', function( $scope, SharedData, $rootScope ){\n $rootScope.$broadcast('updatingData', sharedData);\n alert('updatingDataイベントを発行しました!');\n });\n \n // イベントおよび値を受け取るコントローラー 親画面\n myApp.controller('SecondController', function( $scope, SharedData, $rootScope ){ \n $rootScope.$on('updatingData', function(event, sharedData) {\n alert('イベント受信完了!');\n $scope.sharedData = sharedData;\n });\n });\n \n```\n\nお役に立てれば嬉しいです。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T10:26:38.837", "id": "7382", "last_activity_date": "2015-03-03T15:10:49.230", "last_edit_date": "2015-03-03T15:10:49.230", "last_editor_user_id": "7871", "owner_user_id": "7871", "parent_id": "7273", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7273</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7382</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7382</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1660"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "CodeEvalのReverseWordsが解けません。 \n&lt;https://www.codeeval.com/open_challenges/8/>\n\nsolve内でリストをreverseさせたいのですが、 \nリスト内の要素を文字列を反復してしまいます。\n\nこういったとき、どういう風に考えれば解けますでしょうか?\n\n```\n\n import System.Environment (getArgs)\n \n solve :: [String] -> [String]\n solve ss = fmap reverse ss\n \n main = do\n contents &lt;- getContents\n mapM_ putStrLn $ solve $ lines contents\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T11:11:32.530", "favorite_count": 0, "id": "7276", "last_activity_date": "2015-03-01T12:31:13.757", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8618", "post_type": "question", "score": 0, "tags": [ "haskell" ], "title": "haskell で codeeval の問題が解けない", "view_count": 189 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "この場合、まずwhitespaceで区切って`[\"Hello\", \"World\"]`のようなリストを作ってから反転させる、と考えるべきです。\n\n`words`で\n\n```\n\n > words \"This is a pen\"\n > [\"This\", \"is\", \"a\", \"pen\"]\n \n```\n\n`unwords`で\n\n```\n\n > unwords [\"pen\",\"a\",\"is\",\"This\"]\n > \"pen a is This\"\n \n```\n\nのような変換ができます。\n\n以下に正しい`solve`を掲載します。(マウスオーバーで表示します。)\n\n> `solve :: [String] -> [String]` \n> `solve = fmap (unwords . reverse . words)`", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T12:02:01.420", "id": "7277", "last_activity_date": "2015-03-01T12:31:13.757", "last_edit_date": "2015-03-01T12:31:13.757", "last_editor_user_id": "2781", "owner_user_id": "2781", "parent_id": "7276", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7276</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7277</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1661"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7285", "answer_count": 1, "body": "A, B, C のアクティビティがあります。 \nA は B の親、B は C の親になります。(AndroidManifest.xml に記述済み)\n\nA -> B -> C のように遷移をした時に UP ボタンを押すと、B に遷移します。期待通りです。 \nしかし A -> C のように遷移をした時に UP ボタンを押すと、A に遷移してしまいます。\n\nコードは[Android のドキュメント](http://developer.android.com/training/implementing-\nnavigation/ancestral.html#NavigateUp)と同じようにしています。\n\n```\n\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n NavUtils.navigateUpFromSameTask(this);\n return true;\n }\n return super.onOptionsItemSelected(item);\n }\n \n```\n\nそこで、次のように、startActivity を利用する形に変更したら、期待通り B に遷移することが出来ました。\n\n```\n\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n Intent intent = NavUtils.getParentActivityIntent(this);\n startActivity(intent)\n return true;\n }\n return super.onOptionsItemSelected(item);\n }\n \n```\n\nnavigateUpFromSameTask の挙動は「親のアクティビティに遷移する」だと思っていたのですが、そうでないケースがあるようです。\n\nそこで質問なのですが、親のアクティビティに遷移したい場合、\n\n * 上記の startAcitivity を利用した方法で問題がないか\n * なぜ navigateUpFromSameTask が期待通りに動かないか\n\nを知りたいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T13:18:18.530", "favorite_count": 0, "id": "7279", "last_activity_date": "2015-03-01T14:31:44.803", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "205", "post_type": "question", "score": 3, "tags": [ "android" ], "title": "navigateUpFromSameTask の挙動について", "view_count": 433 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "タスクの概念に関する理解が必要なように思います。\n\nざっくり説明すると、タスクというのは`Activity`のヒストリースタック、このケースで言えば、「A -> B ->\nC」のことをタスクと呼称します。詳細な説明は公式ドキュメントの[Tasks and Back\nStack](http://developer.android.com/guide/components/tasks-and-back-\nstack.html)を参照ください。\n\n### Q.上記の startAcitivity を利用した方法で問題がないか\n\n両者の挙動は全く異なるので、アプリケーションとしてどういう挙動を望むかによります。\n\n`AndroidManifest.xml`に`Activity`の`launchMode`をどう指定したかによりますが、ほとんどの場合はデフォルトの`standard`かと思います。この場合、\n\n```\n\n A -> B -> C\n \n```\n\nの状態から、Bを`startAcitivity()`した場合、\n\n```\n\n A -> B -> C -> B\n \n```\n\nとスタックが積み重ねられます。一方、`navigateUpFromSameTask()`を利用した場合、\n\n```\n\n A -> B\n \n```\n\nの状態になります。(`CLEAR_TOP`フラグが付与されて、Bが呼び出されます。また、Cの`Activity`を`finish()`する点も異なります)\n\n### Q.なぜ navigateUpFromSameTask が期待通りに動かないか\n\nこれについては[`navigateUpFromSameTask`のドキュメント](http://developer.android.com/reference/android/support/v4/app/NavUtils.html#navigateUpFromSameTask\\(android.app.Activity\\))に回答があります。\n\n> Note: This method should only be used when sourceActivity and the\n> corresponding parent are within the same task. If up navigation should cross\n> tasks in some cases, see shouldUpRecreateTask(Activity, Intent).\n\nこのメソッドは親となる`Activity`と呼び出し元`Activity`が同一のタスクに存在するときのみ利用すべきと記載されています。つまりAPIの利用目的から外れているのです。\n\nでは、このときの挙動はどうなっているのでしょう?\n\n実装はJBかそれ未満かで変わります。JB以降の場合、[`Activity#navigateUpTo()`](http://developer.android.com/reference/android/app/Activity.html#navigateUpTo\\(android.content.Intent\\))を呼び出しているだけなので、そちらのドキュメントより、\n\n> If the indicated activity does not appear in the history stack, this will\n> finish each activity in this task until the root activity of the task is\n> reached, resulting in an \"in-app home\" behavior.\n\n親`Activity`がヒストリースタックに存在しない場合、タスクのルートまで遡るとあります。このため、\n\n```\n\n A\n \n```\n\nの状態になるのです。(JB未満では挙動が異なり、恐らく期待通りBが起動すると思います)\n\n### 本来の利用想定ケース\n\n例えば以下のような、\n\n```\n\n A -> B -> C\n A -> B -> D -> C\n A -> B -> E -> C\n A -> B -> D -> E -> C\n \n```\n\nBからCへの遷移が複数パターンある場合、どのような遷移パターンであっても、`navigateUpFromSameTask()`を使うことで、\n\n```\n\n A -> B\n \n```\n\nの状態になります。C自身と、中途の`Activity`がクリアされているのがポイントです。複雑な階層構造を持っていても、確実に親のポイントまで戻せるのが`navigateUpFromSameTask()`の便利な点なのですが、単純な親子構造を実現したい場合には存外不便です。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T14:09:01.510", "id": "7285", "last_activity_date": "2015-03-01T14:31:44.803", "last_edit_date": "2020-06-17T08:14:45.997", "last_editor_user_id": "-1", "owner_user_id": "5337", "parent_id": "7279", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7279</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7285</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7285</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1662"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7283", "answer_count": 2, "body": "やりたいこと \n・最後の`&lt;/div>`以降の文字列を取得したい\n\n対象文字列\n\n```\n\n 取得しない&lt;div>取得しない&lt;/div>&lt;div>取得しない&lt;/div>取得する\n \n```\n\n* * *\n\n取得したい結果\n\n```\n\n 取得する\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T13:40:30.887", "favorite_count": 0, "id": "7281", "last_activity_date": "2015-03-02T05:29:13.090", "last_edit_date": "2015-03-01T14:35:32.787", "last_editor_user_id": "3313", "owner_user_id": "7886", "post_type": "question", "score": 1, "tags": [ "php" ], "title": "「最後に位置している指定文字列」以降の文字列を取得したい", "view_count": 1691 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "`strrpos`で部分文字列の最後の出現位置を検索できます。\n\n```\n\n &lt;?php\n \n $search = \"&lt;/div>\";\n $text = \"取得しない&lt;div>取得しない&lt;/div>&lt;div>取得しない&lt;/div>取得する\";\n \n $pos = strrpos($text, $search);\n if ($pos !== false) {\n echo substr($text, $pos + strlen($search));\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T13:47:09.280", "id": "7283", "last_activity_date": "2015-03-01T13:47:09.280", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3639", "parent_id": "7281", "post_type": "answer", "score": 1 }, { "body": "```\n\n preg_replace('/.*&lt;\\/div>/', '', '取得しない&lt;div>取得しない&lt;/div>&lt;div>取得しない&lt;/div>取得する')\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T05:29:13.090", "id": "7314", "last_activity_date": "2015-03-02T05:29:13.090", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5793", "parent_id": "7281", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7281</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7283</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7283</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1663"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7286", "answer_count": 1, "body": "Node.jsでntwitterのパッケージを利用してbotを動かそうとしています。 \nそこでbotに送られてきたリプライに対してリプライを返したいのですが、以下のように in_reply_to_status_id\nオプションを送られてきたツイートのものを指定しても望んだ通りにツイートに対するリプライではなく単にユーザに対するリプライとなってしまします。\n\n```\n\n // twitter は ntwitter のオブジェクト\n // reply は送られてきたツイートのオブジェクト\n twitter.updateStatus(\n \"@example hoge\",\n {\n in_reply_to_status_id: reply.id\n }, function(error, success){}\n );\n \n```\n\n実際にhttpで送信されるデータをconsole.log等で確認したところタイポや指定の仕方が間違えているわけではありません。\n\nまた、rubyやphpでも同様のことを試してみましたがやはりツイートに対するリプライになりませんでした。\n\n各種クライアントや数あるbotではきちんとツイートに対するリプライができていることを考えると、何か原因があるのかもしれませんが、自分では解決できないので質問しています。\n\n根本的な原因を知っている方や、ツイートに対するリプライができるという方、ご教授お願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T13:47:08.870", "favorite_count": 0, "id": "7282", "last_activity_date": "2015-03-01T14:31:43.773", "last_edit_date": "2015-03-01T14:31:43.773", "last_editor_user_id": "8000", "owner_user_id": "5317", "post_type": "question", "score": 3, "tags": [ "javascript", "node.js", "twitter" ], "title": "Twitter API の in_reply_to_status_id オプションを利用したリプライについて", "view_count": 2396 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "`id` プロパティにはツイートIDが数値として入っているのですが、現在のツイートIDは数字が大きすぎてJavascriptでは正確に扱うことができません。\n\n代わりに、IDが文字列として入っている `id_str` を使うようにしてください。\n\n```\n\n twitter.updateStatus(\n \"@example hoge\",\n {\n in_reply_to_status_id: reply.id_str\n }, function(error, success){}\n );\n \n```\n\n## 参考\n\n * [TwitterのIDが64bitになるとJavaScript等で問題が出るので対策を - F.Ko-Jiの「一秒後は未来」](http://blog.fkoji.com/2010/10201250.html)\n * [Twitter IDs | Twitter Developers](https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake)", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T14:11:26.490", "id": "7286", "last_activity_date": "2015-03-01T14:11:26.490", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8000", "parent_id": "7282", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7282</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7286</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7286</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1664"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "Swiftに関する質問です。 \n下記のコードが何故結果のようになるのかわかりません。\n\nif let n = maybe のところはnという変数に変数maybeを代入しているんでしょうか?? \n詳しい方、ご教示ください。よろしくお願いいたします。\n\n```\n\n var maybe : Int? = 1\n if let n = maybe {\n n + 1\n // 2\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T14:02:49.503", "favorite_count": 0, "id": "7284", "last_activity_date": "2015-03-01T14:41:17.537", "last_edit_date": "2015-03-01T14:41:17.537", "last_editor_user_id": "3639", "owner_user_id": "8619", "post_type": "question", "score": 1, "tags": [ "ios", "swift" ], "title": "Swiftのif文での代入に関する質問です。", "view_count": 544 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "> if let n = maybe のところはnという変数に変数maybeを代入しているんでしょうか??\n\n`let`ですので、`n`は変数ではなく定数ですが、代入しているという理解で正しいです。\n\nこの構文は`Optional Binding`といって、代入結果が`nil`の場合then節を実行しないという特徴があります。\n\n```\n\n var maybe : Int? = nil\n if let n = maybe {\n n + 1\n // do nothing\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T14:18:30.483", "id": "7287", "last_activity_date": "2015-03-01T14:18:30.483", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5337", "parent_id": "7284", "post_type": "answer", "score": 9 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7284</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7287</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1665"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7289", "answer_count": 8, "body": "私はかつて(約10年前)VisualBasic6.0を使っていました。 \nその当時はVBを使える人材が重宝されていました。\n\n最近、たまに求人広告を見ることがあるのですが、VisualBasic.NET \nよりもC#の方が圧倒的に需要が高いように思います。\n\n私はVB.NETもC#も使ったことがありませんが、両者ともに開発環境の \n雰囲気が似ていたような記憶があります。\n\nだとすると、文法等分かりやすいのはVB.NETだと直感的に思っていて \nアプリケーションを開発しやすいのもVB.NETだと勝手に思っています。\n\nでも、多くの企業ではVB.NETよりもC#を使える人材の募集をしています。 \nこれは何故でしょうか? \nC#に特別な何かがあるのでしょうか?", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T15:30:05.487", "favorite_count": 0, "id": "7288", "last_activity_date": "2016-11-26T14:09:31.517", "last_edit_date": "2015-03-02T12:12:31.510", "last_editor_user_id": "85", "owner_user_id": "7634", "post_type": "question", "score": 2, "tags": [ "c#", "visual-studio", "vb.net" ], "title": "VB.NETよりもC#の方が求人が多いのはなぜ?", "view_count": 47401 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "文法が分かりやすいかどうか、アプリケーションが開発しやすいかどうかは主観的な問題ですので置いておきます。\n\n`C#`と`VB.net`は機能的に大きな差があるわけではありません。しかし言語の人気に[大きな差](http://goo.gl/H5ci7Z)がありますので、わざわざ人気がなく情報量の少ない`VB.net`を選ぶ理由があまりないと言えます。\n\nではなぜ`C#`の方に人気が出たのかという理由はちょっと難しいですが、私の思いつく限りでは、\n\n * `Java`や`C++`を利用している人には文法的に`C#`の方が馴染みやすい\n * `Mono`の`VB.net`への対応が`C#`に比べて遅いため、`Windows`以外の環境も考慮すると`C#`のほうが利用しやすい\n\nということになると思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T16:19:25.473", "id": "7289", "last_activity_date": "2015-03-01T16:19:25.473", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3639", "parent_id": "7288", "post_type": "answer", "score": 9 }, { "body": "現実問題として`C#`で開発されたプロジェクトや資産が多く、また`C#`を理解できる人間が多いというのが表向きの理由かと思います。\n\nではなぜ`C#`のほうが人気なのかという部分についてですが、これは客観的な理由よりも主観的な理由の方が大きい気がします。 \n私の周囲でも`Windows`向けの開発あるいは`Windows\nServer`を利用したWebアプリケーションの開発では、`C#`の採用数が`VB.NET`に比べるととても多いです。大抵の場合、\n\n * `VB.NET`は古い\n * `VB.NET`は遅い(実際には`C#`と違いが出るかは疑問です)\n * `VB.NET`は初心者向けなので、できることが限られている(どうなんでしょう)\n\nといった理由、あるいは暗黙の了解的なもので`C#`が選択されています。私自身もはじめて`.NET`を使うことになった際、あまり考えずに`C#`を採用しました。(`VB.NET`には初心者向けで本格的な業務用ではないというイメージはありました。)\n\nあるいは、書籍など情報の偏りもあるかもしれません。`C#`には初心者向けから中級者向けまで書籍は日本語でも充実していますが、`VB.NET`の本は`C#`ほど充実していないように思います。(O'Reillyも`VB.NET`の日本語の本は取り扱っていません。)\nただし卵(書籍)が先か鶏(人気)が先かはわかりません。\n\nもしかすると、物理学の世界で言う自発的対称性の破れのようなもので、最初はどちらに転がってもおかしくないような差だったのかもしれませんね。\n\n* * *\n\n調べもせずに書いていますので、ご注意ください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T17:20:53.720", "id": "7290", "last_activity_date": "2015-03-02T02:40:04.223", "last_edit_date": "2015-03-02T02:40:04.223", "last_editor_user_id": "3313", "owner_user_id": "3313", "parent_id": "7288", "post_type": "answer", "score": 4 }, { "body": "歴史的には.NET Framework 3.5の時期に\n\n * 言語機能の差が一時的に大きくなった(`yield`、自動実装プロパティ等)\n * Windows Phone SDKなどでVB対応が後回しにされた\n\nとVBが機能的に大きく劣っていた期間があり、VB.NETを利用していた企業もC#に流れたのもこの頃という印象です。 \n両言語機能は当時導入されようとしてたLINQやLINQベースのORMに欠かせないものであり、VB.NETでは最新技術を生かせないという状況がしばらく続いていました。 \nこのギャップは.NET4.5までに徐々に解消するのですが、その間にC#側に`dynamic`機能が追加されたため、VBのメリットも失われてしまった格好です。\n\n* * *\n\nなお個人の主観的な意見としては、C#で \n\n```\n\n public TItem this[TKey key] { get; }\n \n```\n\nと書けるプロパティがVBでは \n\n```\n\n Default Public Overloads ReadOnly Property Item(ByVal key As TKey) As TItem\n \n```\n\nとなってしまうようにVBはキーワード中心のためとにかく打鍵量が多く好きになれません。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T21:57:36.250", "id": "7293", "last_activity_date": "2015-03-02T12:53:33.737", "last_edit_date": "2015-03-02T12:53:33.737", "last_editor_user_id": "5750", "owner_user_id": "5750", "parent_id": "7288", "post_type": "answer", "score": 14 }, { "body": "もうちょっと低いレベルの話題を出しておきます。\n\n個人的には、変数スコープの違いが言語の違いを作っているのではと考えています。 \n従来C言語では変数をスコープの先頭に記述する制限がありました。その制限を何をどう勘違いしたのか関数の先頭と思い込み、結果、C言語や(元より制限のない)C++言語において関数の先頭にずらずらと変数を並べるスタイルのソースコードをちょくちょく見かけます。仕様をきちんと理解している人から見ると「わかってない人が書いているな」とそのソースを避けたくも思うはずです。 \nスコープの概念そのものはとても重要でJavaScriptのようにブロックスコープが存在しない場合、強引な手を使ってでもスコープを実現するわけですし。\n\nさてVB言語も似たような状況で、ブロックスコープはありますが関数の先頭に書かれる傾向があるように思います。C#言語においてはC / C++ /\nVBと比較するとそのような傾向はかなり低いです。結果、言語仕様を理解せず、変数の有効期間及びそれに付随するオブジェクトの生存期間を考慮せずただ動けばいいという考えの人はVB言語を使う傾向にあり、仕様を理解しコードロジック、アルゴリズムを考える人はC#言語を使う傾向にある、というのが個人的な見解です。\n\nさてこのような状況でソフトウェアを作ろうとする場合にどちらの言語を選択し、その言語の求人を行うかとなればやはり後者でしょう。\n\n// VBのブロックスコープは[罠](https://msdn.microsoft.com/ja-\njp/library/1t0wsc67\\(v=vs.120\\).aspx#mt35)もありますしね。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T01:09:02.923", "id": "7298", "last_activity_date": "2015-03-02T01:09:02.923", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4236", "parent_id": "7288", "post_type": "answer", "score": 7 }, { "body": "プロジェクト規模が大きくなるとVB.NETのほうがVisualStudioが重くなりがちです。 \nデフォルト設定のVB.NETは記述中の未改行状態のコードもエラーチェックしていたり \nしてC#よりも重くなっていました。 \nコードの実行速度は変わらないはずです。\n\n変数宣言を強制しないことができたり、VB6の悪いところをイメージさせるものが \nあります。 \nVB6は素人プログラマが品質の悪いコードを量産したのが大変問題になりその \nイメージの悪さを引きずっているのでしょうか\n\nですので、C#になにかあるというよりはVB.NETが敬遠されているのだと感じます。\n\n実質の機能はほぼ同じですが、間違いを起こしにくいC#のほうが開発者から好まれています。 \nほかの方もおっしゃられるように差はとても小さいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T02:41:33.007", "id": "7306", "last_activity_date": "2015-03-02T02:41:33.007", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8239", "parent_id": "7288", "post_type": "answer", "score": 1 }, { "body": "概ね同じような回答になりますが、 \nVBを採用している開発部署は、コードの質を追究するプログラマが少ないように感じます。\n\nVB6.0の悪習を結構引き継いでるので、プログラマ次第ではバグ量産の温床になるから等も理由の一つかもしれません。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T11:46:50.247", "id": "7328", "last_activity_date": "2015-03-02T11:46:50.247", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7501", "parent_id": "7288", "post_type": "answer", "score": 1 }, { "body": "技術的な回答は多く出ているので、人的リソースの視点で書かせて頂きます。\n\nVB6→VB.NETの移行期に活躍したプログラマーは現在既にいいお年で、新たにC#を習得させるコストを払うより現状維持または職種変更してもらい、C#erは外から調達する企業が多いのではないでしょうか。\n\n一部の優秀なプログラマーは除外しますが、日本の人月ビジネスが消費してきた「コーダー」については上記のことが言えると思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T12:06:39.373", "id": "7330", "last_activity_date": "2015-03-02T12:06:39.373", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2238", "parent_id": "7288", "post_type": "answer", "score": 3 }, { "body": "> 文法等分かりやすいのはVB.NETだと直感的に思っていて \n> アプリケーションを開発しやすいのもVB.NETだと勝手に思っています。\n\nそうは思いません。VBとVB.NETは別物です。 \n世の中に多く存在するであろうC/C++/Javaなどの開発者にとってC#の方がとっつきやすいと思います。\n\n(1)VB.NET登場時、旧VBとの言語的な差が大きく、どうせ覚えるなら.Netのために新しく作られてオープンな規格であるC#を勉強した方がいいよね、という流れになった。\n\n[補足] \n当時VBが流行っていたのは、プログラミングスキルの低い人でもGUIアプリケーションを簡単に作れる、Microsoft製言語というのが理由だと思います。 \nしかし、VB.NETになって本格的なオブジェクト指向言語になった結果、習得難易度も増し、GUIアプリの作りやすさ(C#でも簡単に作れる)というアドバンテージも無くなってしまいました。\n\n難易度は\n\n初心者→VB \n中級者→Delphi \n上級者→C/C++\n\nというイメージ。 \nBorland社(社名がコロコロ変わって現在は何になっているか知りませんが)のDelphiはVBより少し難しいがC/C++より簡単でGUIも簡単に作れて熱烈なファンもいましたが、OS開発元であるMicrosoft製の言語を使う人が圧倒的に多かったです。\n\n(2)文法がC/C++やJavaに似ているので、これらの言語を使っている人たちがC#に入りやすかった。\n\n[補足] \nVBブームの後はJavaブームが来ました。\n\n(3)VB系言語で開発されたアプリケーションは他の言語で作られたものに比べ、質の低いものが多い。 \nこれは実感した人、多いと思います。 \n他人がVB系言語で作った質の悪いアプリをメンテすることになった苦い経験から、VB使いの技術力は低い、と多くの人に思われるようになったのです。 \n実際、そう考えてあながち間違いではないでしょう。 \n「VB系しかできません」なんて開発者は全く信用されません。 \n趣味のプログラミングならいいのですが、仕事でやる場合、複数言語を使えるのは当たり前です。\n\n(4)2016年現在、Windows以外のプラットフォームも見据えた言語の存在感として、C#の圧勝です。今更VB.NETを選ぶ人はいないでしょう。\n\n(5)C#は書きやすい、使い勝手がよい \n「C#は書いていて気持ちがよい」「思考をそのままコードにできる」という表現を時折見ます。\n\n[C# と共に歩んだ 15 年 - Powered by C# - Microsoft Visual\nStudio](https://www.microsoft.com/ja-jp/dev/campaign/csharp/story.aspx)\n\n> C# は、当時よく使われていた C++ 開発者にとっては取り組みやすい夢のような言語で、それほど勉強しなくても使うことができました。\n>\n> C#\n> の文法は実用性とサイエンスが絶妙。コード生成しやすいし、オブジェクト指向をベースに、コンポーネント志向も関数型もパラレルコンカレントも動的も無理なく取り込まれている。\n\n[需要No. 1言語はどれ? 2016年度人気プログラミング言語を徹底比較 |\nReadWrite[日本版]](http://readwrite.jp/develop/33939/)\n\n> C#で働いた技術者たちはC#を好きになる傾向があり、この言語はとても強いコミュニティを持っている。 \n> C#はUnity 3Dの主要言語であり、iOSやLinux上で動くゲームエンジンにも使用されている。ゲームエンジンとしてのUnity\n> 3Dの台頭は、C#の存在を確固たるものにし、バーチャルリアリティアプリの開発を支えている。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-11-26T10:39:39.243", "id": "30687", "last_activity_date": "2016-11-26T14:09:31.517", "last_edit_date": "2016-11-26T14:09:31.517", "last_editor_user_id": "19725", "owner_user_id": "19725", "parent_id": "7288", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7288</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7289</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7293</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1666"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 2, "body": "Mac Yosemite 上の Apache でローカルで動かしてます。 \nPHPで以下のように実行ユーザーを表示してみると、\n\n```\n\n echo get_current_user();\n \n```\n\nすると\"_www\"になるんですが、テキストファイルを保存してみるとその所有者は\"自分の名前\"になっています。 \n実行ユーザーと所有者が別々(グループも別々です)になるわけですが、これはどういう設定からなっていることなんでしょうか? \nちなみに、対象フォルダのパーミッションは0755で、suEXECは有効になっていません。それと、PHP はモジュール版です。\n\n* * *\n\n追記 \n実行したコードです。\n\n```\n\n echo 'user:' . get_current_user() . '&lt;br>';\n \n $file_handle = fopen(\"test.txt\", \"w\");\n \n if($file_handle){\n $wr = fwrite($file_handle , \"あいうえお\\nかきくけこ\");\n \n if($wr == FALSE){\n echo \"fwrite 失敗&lt;br>\";\n }else{\n echo \"fwrite 成功&lt;br>\";\n }\n \n fclose($file_handle);\n }else{\n echo \"fopen 失敗&lt;br>\";\n }\n \n```\n\n所有者、グループの確認は Finder の「右クリック - 情報を見る」からしました。 \nその後、httpd.conf も見てグループも違っていると思ったということです。", "comment_count": 12, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T17:40:30.113", "favorite_count": 0, "id": "7291", "last_activity_date": "2015-03-05T05:22:22.070", "last_edit_date": "2015-03-02T06:09:51.887", "last_editor_user_id": "8439", "owner_user_id": "8439", "post_type": "question", "score": 3, "tags": [ "php", "macos", "apache" ], "title": "PHPで保存したファイルの所有者について", "view_count": 1288 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "ターミナルから設定ファイルを見るとこのようにでました\n\n```\n\n $ cat /private/etc/apache2/httpd.conf | grep -n \"_www\"\n 181:User _www\n 182:Group _www\n \n```", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-01T20:41:03.503", "id": "7292", "last_activity_date": "2015-03-01T20:41:03.503", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4662", "parent_id": "7291", "post_type": "answer", "score": 0 }, { "body": "OS\nX標準のapacheでmod_phpを有効にして、DocumentRootになっている/Library/WebServer/Documentsに上記スクリプトをおいて実行しましたが書き込みができませんでした。ディレクトリをchmod\n777したところ実行できました。ファイルの所有者は_wwwでした。\n\nということで、少なくとも標準状態+最低限の変更では質問のような動作にはなりません。\n\n一般論としてもapache+mod_php環境ではapacheの実行ユーザーでPHPスクリプトも実行されますので、上記動作に矛盾はありません。\n\nということで、その通りの動作になっていないと言うことはここに書いた以上の作業をされていると思いますがその詳細がわからないとこの回答が限界です。\n\nまた、「既存のファイルに書き込みを繰り返しているだけ」とか、「スクリプトが作成してるファイルと確認しているファイルが違う」とか、そういうところも疑ったほうがいいかとおもいます。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-05T05:22:22.070", "id": "7468", "last_activity_date": "2015-03-05T05:22:22.070", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5793", "parent_id": "7291", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7291</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7468</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1667"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7312", "answer_count": 1, "body": "お世話になります\n\nAndroidで地図の入ったFragmentのアプリを作っているのですが、ちょっとハマってしまったので \n質問させてください。 \n初期画面側が地図なのですが、一度別のタブに移動→また地図側に戻ると、以下のエラーを吐いて止まってしまいます。\n\n```\n\n 03-02 08:26:08.519 4221-4221/shiratsu.co.jp.cafesagashi E/AndroidRuntime﹕ FATAL EXCEPTION: main\n java.lang.NullPointerException\n at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:708)\n at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)\n at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:454)\n at android.os.Handler.handleCallback(Handler.java:725)\n at android.os.Handler.dispatchMessage(Handler.java:92)\n at android.os.Looper.loop(Looper.java:137)\n at android.app.ActivityThread.main(ActivityThread.java:5041)\n at java.lang.reflect.Method.invokeNative(Native Method)\n at java.lang.reflect.Method.invoke(Method.java:511)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)\n at dalvik.system.NativeStart.main(Native Method)\n \n```\n\nいろいろ調べてはいるもののちょっと原因がつかめておらずでして。。。\n\n```\n\n public class CafeMapFragment extends Fragment {\n \n \n //private OnFragmentInteractionListener mListener;\n private SupportMapFragment fragment;\n /*object of google map*/\n public GoogleMap mGoogleMap;\n \n /**\n * Use this factory method to create a new instance of\n * this fragment using the provided parameters.\n *\n * @return A new instance of fragment CafeMapFragment.\n */\n // TODO: Rename and change types and number of parameters\n public static CafeMapFragment newInstance() {\n CafeMapFragment fragment = new CafeMapFragment();\n Bundle args = new Bundle();\n fragment.setArguments(args);\n return fragment;\n }\n \n public CafeMapFragment() {\n // Required empty public constructor\n }\n \n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n \n }\n \n @Override\n public void onResume() {\n super.onResume();\n setUpMapIfNeeded();\n }\n \n private void setUpMapIfNeeded() {\n \n if (mGoogleMap == null) {\n mGoogleMap = fragment.getMap();\n setUpMap();\n }\n }\n \n @Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n \n return inflater.inflate(R.layout.fragment_cafe_map, container, false);\n }\n \n @Override\n public void onActivityCreated(Bundle savedInstanceState) {\n // TODO Auto-generated method stub\n super.onActivityCreated(savedInstanceState);\n FragmentManager fm = getChildFragmentManager();\n fragment = (SupportMapFragment) fm.findFragmentById(R.id.fragmentMap);\n if (fragment == null) {\n fragment = SupportMapFragment.newInstance();\n fm.beginTransaction().replace(R.id.fragmentMap, fragment).commit();\n }\n \n }\n \n // とりあえず適当にピンたててみたり。\n private void setUpMap() {\n \n // 現在位置表示の有効化\n mGoogleMap.setMyLocationEnabled(true);\n // 設定の取得\n UiSettings settings = mGoogleMap.getUiSettings();\n // コンパスの有効化\n settings.setCompassEnabled(true);\n // 現在位置に移動するボタンの有効化\n settings.setMyLocationButtonEnabled(true);\n // ズームイン・アウトボタンの有効化\n settings.setZoomControlsEnabled(true);\n // 回転ジェスチャーの有効化\n settings.setRotateGesturesEnabled(false);\n // スクロールジェスチャーの有効化\n settings.setScrollGesturesEnabled(true);\n // Tlitジェスチャー(立体表示)の有効化\n settings.setTiltGesturesEnabled(false);\n // ズームジェスチャー(ピンチイン・アウト)の有効化\n settings.setZoomGesturesEnabled(true);\n mGoogleMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {\n @Override\n public void onCameraChange(CameraPosition position) {\n Log.d(\"TEST\", \"zoop:\" + position.zoom);\n }\n });\n }\n \n public void onDestroyView() {\n super.onDestroyView();\n \n \n try{\n \n FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();\n ft.remove(fragment);\n ft.commit();\n }catch(Exception e){\n }\n }\n \n \n \n \n \n \n }\n \n &lt;FrameLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:id=\"@+id/fragmentMap\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n class=\"com.google.android.gms.maps.SupportMapFragment\">\n \n &lt;/FrameLayout>\n \n &lt;FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\" android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n tools:context=\"shiratsu.co.jp.cafesagashi.LicenceFragment\">\n \n &lt;!-- TODO: Update blank fragment layout -->\n &lt;TextView android:layout_width=\"match_parent\" android:layout_height=\"match_parent\"\n android:text=\"@string/hello_blank_fragment\" />\n \n &lt;/FrameLayout>\n \n public class MainActivity extends FragmentActivity implements FragmentTabHost.OnTabChangeListener {\n \n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n \n // FragmentTabHost を取得する\n FragmentTabHost tabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);\n tabHost.setup(this, getSupportFragmentManager(), R.id.container);\n \n TabHost.TabSpec tabSpec1, tabSpec2;\n \n // TabSpec を生成する\n tabSpec1 = tabHost.newTabSpec(\"tab1\");\n tabSpec1.setIndicator(\"tab1\");\n // TabHost に追加\n tabHost.addTab(tabSpec1, CafeMapFragment.class, null);\n \n // TabSpec を生成する\n tabSpec2 = tabHost.newTabSpec(\"tab2\");\n tabSpec2.setIndicator(\"tab2\");\n // TabHost に追加\n tabHost.addTab(tabSpec2, LicenceFragment.class, null);\n \n // リスナー登録\n tabHost.setOnTabChangedListener(this);\n }\n \n @Override\n public void onTabChanged(String tabId) {\n Log.d(\"onTabChanged\", \"tabId: \" + tabId);\n }\n \n \n @Override\n public boolean onCreateOptionsMenu(Menu menu) {\n // Inflate the menu; this adds items to the action bar if it is present.\n getMenuInflater().inflate(R.menu.menu_main, menu);\n return true;\n }\n \n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n int id = item.getItemId();\n \n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }\n \n return super.onOptionsItemSelected(item);\n }\n \n \n }\n \n```\n\nよろしくお願いいたします", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T00:08:12.797", "favorite_count": 0, "id": "7294", "last_activity_date": "2015-03-02T04:45:16.280", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "403", "post_type": "question", "score": 1, "tags": [ "android", "fragment" ], "title": "Tab付きFragmentで元のFragmentに戻るとエラー", "view_count": 1343 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "```\n\n public void onDestroyView() {\n super.onDestroyView();\n try{\n // FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();\n FragmentTransaction ft = getChildFragmentManager().beginTransaction();\n ft.remove(fragment);\n ft.commit();\n }catch(Exception e){\n }\n }\n \n```\n\n`remove`するときも`getChildFragmentManager()`で`FragmentManager`を取得してみてはいかかでしょうか?\n\n少し追記 \n`Fragment`に子供の`Fragment`を入れ子で配置する場合は、`getChildFragmentManager`を使います。 \n追加するときのコードは正しいのですが、`remove`するときに`getSupportFragmentManager`となっているため、エラーが起きているのではないかと。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T03:55:33.373", "id": "7312", "last_activity_date": "2015-03-02T04:45:16.280", "last_edit_date": "2015-03-02T04:45:16.280", "last_editor_user_id": "8216", "owner_user_id": "8216", "parent_id": "7294", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7294</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7312</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7312</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1668"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7308", "answer_count": 2, "body": "最初に適用した画像から他の画像に差し替えたのですが、 \n最初の画像が常に表示されている状態です。 \nこの問題の解決方法が分かる方がいましたら、ご教授お願いします。\n\n対象の画像はCSSにて、下記のように指定しているasc.gifです。\n\n```\n\n background-image: url(asc.gif);\n \n```\n\nまたasc.gifは下記画像のように配置されています。\n\n![画像の配置](https://i.stack.imgur.com/0yByj.png)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T01:12:30.890", "favorite_count": 0, "id": "7299", "last_activity_date": "2015-03-02T02:54:19.490", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7626", "post_type": "question", "score": 1, "tags": [ "html", "css" ], "title": "htmlで画像の変更が適用されません", "view_count": 346 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "おそらくブラウザにキャッシュが残っています。 \nブラウザのキャッシュをクリアしてみてください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T01:36:26.943", "id": "7300", "last_activity_date": "2015-03-02T01:36:26.943", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7214", "parent_id": "7299", "post_type": "answer", "score": 1 }, { "body": "CSSはリロードしても更新されないことがありますので、 \nCtrl+F5でスーパーリロードするか、クエリー文字を追加するなどして対処してください。\n\n&lt;http://weboook.blog22.fc2.com/blog-entry-367.html>", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T02:54:19.490", "id": "7308", "last_activity_date": "2015-03-02T02:54:19.490", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2232", "parent_id": "7299", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7299</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7308</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7308</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1669"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "```\n\n &lt;body>\n &lt;canvas width=\"500px\" height=\"2000px\">&lt;/canvas>\n &lt;script>\n var canvas = document.querySelector('canvas')\n var ctx = canvas.getContext('2d')\n ctx.fillStyle = \"rgb(200, 0, 0)\"\n ctx.fillRect(0, 0, 100, 100)\n ctx.fillRect(400, 0, 100, 100)\n ctx.fillRect(0, 1000, 100, 100)\n &lt;/script>\n &lt;/body>\n \n```\n\n上記のhtmlでは、縦2000px、横500pxのcanvasを表示しています。 \nこれを印刷すると、ブラウザによって挙動が違います。\n\n * Google Chrome(40.0.2214.115) 2ページ目が印刷される。下端の四角は次のページに表示\n * Firefox(35.0.1) 2ページ目が印刷されない。下の四角は表示されない\n\nFirefoxでChromeのように、画像のはみ出した部分を次ページに印刷する方法はありませんか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T01:41:05.447", "favorite_count": 0, "id": "7301", "last_activity_date": "2015-09-09T00:15:49.317", "last_edit_date": "2015-09-08T02:25:51.350", "last_editor_user_id": "10455", "owner_user_id": "2325", "post_type": "question", "score": 4, "tags": [ "html", "firefox" ], "title": "Firefoxで画像のはみ出した部分を次のページに印刷するには?", "view_count": 330 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "複数の`canvas`に画像を分ければ、この問題を回避できます:\n\n```\n\n &lt;head>\n &lt;style type=\"text/css\" media=\"screen\">\n div#insatsu {display: none;}\n &lt;/style>\n &lt;style type=\"text/css\" media=\"print\">\n canvas#displayCanvas {display: none;}\n &lt;/style>\n &lt;/head>\n \n &lt;body>\n &lt;canvas id=\"displayCanvas\" width=\"500\" height=\"2000\">&lt;/canvas>\n \n &lt;div id=\"insatsu\">&lt;/div>\n \n &lt;script>\n var canvas = document.querySelector('canvas'),\n ctx = canvas.getContext('2d');\n \n ctx.fillStyle = \"rgb(200, 0, 0)\";\n ctx.fillRect(0, 0, 100, 100);\n ctx.fillRect(400, 0, 100, 100);\n ctx.fillRect(0, 1000, 100, 100);\n \n function createSplitCanvases(canvas, ctx, insatsu) {\n var y = 0,\n SPLIT_Y = 150;\n \n insatsu.innerHTML = '';\n \n while (y &lt;= canvas.height) {\n var printCanvas = document.createElement('canvas');\n \n printCanvas.height = SPLIT_Y &lt; (canvas.height-y) ? SPLIT_Y : (canvas.height-y);\n printCanvas.width = canvas.width;\n insatsu.appendChild(printCanvas);\n insatsu.appendChild(document.createElement('br'));\n var ctx2 = printCanvas.getContext('2d');\n \n ctx2.putImageData(ctx.getImageData(\n 0, y,\n canvas.width,\n (y+SPLIT_Y) > canvas.height ? canvas.height : (y+SPLIT_Y)\n ), 0, 0);\n y += SPLIT_Y;\n }\n }\n \n createSplitCanvases(\n canvas,\n ctx,\n document.querySelector('#insatsu')\n );\n &lt;/script>\n &lt;/body>\n \n```\n\nもちろん、あまり良くない解決策ですが、私の知っている限りでは、Firefoxでは他の方法はないです。`img`という要素を使えば、同じ問題が起こるようです。どなたかより良い方法を知れば是非投稿して下さい。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-09T00:15:49.317", "id": "16404", "last_activity_date": "2015-09-09T00:15:49.317", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11003", "parent_id": "7301", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7301</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">16404</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1670"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7307", "answer_count": 2, "body": "あるディレクトリに対し再帰的にゆっくり削除をかけていきたいと思っています。\n\n```\n\n find . -exec sleep 1 \\; -delete\n \n```\n\nこのコマンドでほぼ満たされるのですが、ディレクトリは削除せずに残しておきたいのです。 \nどのようにするとできそうでしょうか?よろしくお願いします。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T02:25:33.087", "favorite_count": 0, "id": "7304", "last_activity_date": "2015-03-02T03:13:01.567", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2772", "post_type": "question", "score": 2, "tags": [ "linux", "bash" ], "title": "再帰的にゆっくりファイルだけを削除するコマンド", "view_count": 2839 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "```\n\n find . ! -type d -exec sleep 1 \\; -delete\n \n```\n\nこれでいかがでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T02:45:14.933", "id": "7307", "last_activity_date": "2015-03-02T02:45:14.933", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7926", "parent_id": "7304", "post_type": "answer", "score": 3 }, { "body": "別解です。 \nrm コマンドは、ディレクトリを消さないので、こういう書き方もあります。\n\n```\n\n find . -exec echo {} \\; | while read f; do sleep 1; rm $f; done\n \n```\n\n利点: do に複数コマンドを書けるのでログ出力つけたくなった時に便利です。 \nひとつのファイル/リンクを消すための待ち時間を揃えるには、Shirone さんの回答にある「! -type d」を使うのが良いです。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T03:13:01.567", "id": "7309", "last_activity_date": "2015-03-02T03:13:01.567", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5299", "parent_id": "7304", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7304</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7307</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7307</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1671"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7311", "answer_count": 1, "body": "XMLでは使用可能な文字が制限されています。([W3C Recommendation -Section2.2\nCharacters](http://www.w3.org/TR/REC-xml/#charsets))\n\n```\n\n &lt;a>&amp;#x3c;&amp;lt;&lt;/a>\n \n```\n\nは有効と判定されます。 \nでは、以下のXMLとして有効ですか?無効ですか?\n\n```\n\n &lt;a>&amp;#x01;&lt;/a>\n \n```\n\nMSXMLおよびlibxml2で試したところ無効なXMLと判定されました。(書き込みはできても読み取れない) \nなぜ無効と判定されるのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T02:41:20.660", "favorite_count": 0, "id": "7305", "last_activity_date": "2015-03-02T03:55:15.727", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8629", "post_type": "question", "score": 2, "tags": [ "xml" ], "title": "XMLでテキスト部の文字参照", "view_count": 349 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "`&amp;#x01;`は文字参照の文法としては有効です。\n\n> **4.1 Character and Entity References**\n```\n\n> [66] CharRef ::= '&amp;#' [0-9]+ ';'\n> | '&amp;#x' [0-9a-fA-F]+ ';'\n> \n```\n\nしかし、文字参照が参照する文字は`Char`で定義されている文字集合にマッチしなければならないという制限があります。\n\n> **Well-formedness constraint: Legal Character**\n>\n> Characters referred to using character references must match the \n> production for Char.\n\n`Char`の定義は以下のとおりで、`#x1`は含まれていないので`&amp;#x01;`は結果的に無効です。\n\n> **2.2 Characters**\n```\n\n> [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] |\n> [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding\n> the surrogate blocks, FFFE, and FFFF. */\n> \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T03:55:15.727", "id": "7311", "last_activity_date": "2015-03-02T03:55:15.727", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3639", "parent_id": "7305", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7305</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7311</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7311</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1672"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "毎々お世話になっております。新米エンジニアです。\n\nNitrous でrailsのWEBアプリケーションを開発しております。 \nネット上にあるソースを開発もしくはフォルダー毎にダウンロードする方法はございますか? \n現在、ファイル上で右クリックでのダウンロード方法は把握しているのですが、フォルダー毎でのダウンロード方法をご存知の方、ご教示頂けると幸いです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T05:25:18.633", "favorite_count": 0, "id": "7313", "last_activity_date": "2015-03-02T09:10:24.057", "last_edit_date": "2015-03-02T06:35:37.267", "last_editor_user_id": "3639", "owner_user_id": "8635", "post_type": "question", "score": 1, "tags": [ "ruby-on-rails" ], "title": "Nitrousのファイルのダウンロード", "view_count": 128 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "今のところ Nitrous の Web IDE では一括ダウンロードできないようです。\n\n当方で確認したところ、[Nitrous デスクトップ](https://www.nitrous.io/desktop) から Nitrous Desktop\nをダウンロードし、起動します。 \nあとは接続して、下記のスクリーンショットのように File Sync を有効にします。 \n※これは Windows での解説です。Mac も若干違いはあれど同様だと思われます。\n\n![Nitrous Desctop - File sync](https://i.stack.imgur.com/DmDX0.gif)\n\nすると `C:\\\\{ユーザ名}\\Nitrous\\\\{マシン名}` にプロジェクトファイルが全て同期されています。 \nこれでダウンロードできますので、お試しください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T09:10:24.057", "id": "7321", "last_activity_date": "2015-03-02T09:10:24.057", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7926", "parent_id": "7313", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7313</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7321</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1673"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "イメージ図の黒いViewを透明にしたいと思ってます。\n\nイメージは search.barTintColor = [UIColor clearColor];\n\nとしたものです。わかる方いらっしゃいましたらよろしくおねがいします。\n\n![画像の説明をここに入力](https://i.stack.imgur.com/houVH.png)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T05:30:14.527", "favorite_count": 0, "id": "7315", "last_activity_date": "2015-03-03T06:14:19.553", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8060", "post_type": "question", "score": 0, "tags": [ "ios" ], "title": "UISearchBarの背景のViewを透明にしたい。", "view_count": 1250 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "UISearchBarのSearch StyleをMinimalにすれば解決できるかと思います。\n\n* * *\n\n追記 \nコメント欄だと書ききれないのでこちらに追記します。\n\nUISearchBarにある\n\n・UISearchBarBackGround(UIImageViewのサブクラス) \n・UISearchBarTextField(UITextFieldのサブクラス)\n\nという2つのViewの設定をすれば実現できるかと思います。\n\nUISearchBarのSubViewを追いかけていくと該当のViewが見つかるので、 \n適宜必要な部分をいじってみてください。\n\n以下ソース\n\n```\n\n // UISearchBarのサブビューを取得\n for (UIView *subview in self.SearchBar.subviews) {\n \n // UISearchBarのサブビューのサブビューを取得\n for(UIView *secondSubView in subview.subviews) {\n \n // 背景部分のViewを取得\n if ([secondSubView isKindOfClass:[UIImageView class]]) {\n \n // setImageでnilを渡す\n [(UIImageView *)secondSubView setImage:nil];\n \n // 任意の色を指定\n [secondSubView setBackgroundColor:[UIColor clearColor]];\n }\n \n // テキストフィールド部分を取得\n if ([secondSubView isKindOfClass:[UITextField class]]) {\n [(UITextField *)secondSubView setBackgroundColor:[UIColor whiteColor]]; \n }\n } \n }\n \n```\n\n![サンプル](https://i.stack.imgur.com/7m2TE.jpg)", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T06:00:56.373", "id": "7317", "last_activity_date": "2015-03-03T06:14:19.553", "last_edit_date": "2015-03-03T06:14:19.553", "last_editor_user_id": "8521", "owner_user_id": "8521", "parent_id": "7315", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7315</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7317</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1674"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 0, "body": "あるシステムのオープンソース化のため、下記の通り構成を変更することとなりました。\n\n【現在】 【変更後】 \nOS:RedHatEnterpriseLinux ⇒ RedHatEnterpriseLinux \nAPサーバ:WebLogic 8.1 ⇒ tomcat \nHTTPサーバ:Apache ⇒ Apache \nDB:Oracle 10g ⇒ postgres\n\nAPサーバとDBが変わるため、プログラム改修が必要となるのですがまだ修正箇所・影響範囲は特定できておりません。\n\n調査・検討を進めるためにも環境が用意したいのですが、 \n開発用ドキュメントや資材は用意されておらず、手元にあるのはソース一式のみです。\n\nソースを確認しましたところ、「.project」ファイルを見つけeclipseのプロジェクト一式のようだったので、とりあえずeclipseにその一式を入れてみたのですが当然そのままでは動きませんでした。\n\nエラーを確認すると、下記5件のエラーが出ておりました。\n\n> ビルド・パスのエラーが解決されるまで、プロジェクトをビルドできません\n>\n> プロジェクト 'xxxxx' に、必要なライブラリー 'C:\\bea\\weblogic81\\server\\lib\\ojdbc14.jar' \n> がありません\n>\n> プロジェクト 'xxxxx' に、必要なライブラリー 'C:\\bea\\weblogic81\\server\\lib\\weblogic.jar' \n> がありません\n>\n> プロジェクト 'xxxxx' のクラスパス変数 'JDK_TOOLS' がアンバインドされています\n>\n> プロジェクト 'xxxxx' のクラスパス変数 'WEBLOGIC81/webservices.jar' がアンバインドされています\n\nエラーを解消し、自分のWindows7(32bit)上でデバックできるようにしたいのですが、 \nそもそもWeblogic 8.1を構築する資材が手元になく困っております。\n\n日本オラクル様にも問い合わせを行ってみたのですが、 \n古いバージョンのWeblogicについてはダウンロードサイトでも公開していないとのことでした。\n\n環境構築のため、どこかWeblogic8.1の資材を入手できるところはないものでしょうか。 \nまた、当方WeblogicおよびLinuxの経験も全くないもので、環境構築および調査・検討を進めるにあたり参考になりそうなドキュメントやサイトはないものでしょうか。\n\nよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T05:44:39.263", "favorite_count": 0, "id": "7316", "last_activity_date": "2015-03-02T05:44:39.263", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8056", "post_type": "question", "score": 3, "tags": [ "linux", "apache", "weblogic" ], "title": "WebLogic 8.1環境構築資材の入手先", "view_count": 341 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div> <span class="block ">[]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7316</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1675"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "タイトルの件となります。 \nWindowsデスクトップアプリでWinRTのAPIを利用できるということなので \n&lt;https://software.intel.com/en-us/articles/using-winrt-apis-from-desktop-\napplications>\n\n(利用可能なAPI一覧) \n[https://msdn.microsoft.com/en-\nus/library/windows/desktop/dn554295%28v=vs.85%29.aspx?f=255&amp;MSPPError=-2147217396](https://msdn.microsoft.com/en-\nus/library/windows/desktop/dn554295%28v=vs.85%29.aspx?f=255&amp;MSPPError=-2147217396)\n\nをみて、MediaCaptureクラスを利用しようと考えたのですが、Windowsストアアプリなどではカメラの利用を許可するために「package.appxmanifest」を変更していると思います。 \nデスクトップアプリの場合はどのようにすればカメラが利用できるのでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T06:34:03.070", "favorite_count": 0, "id": "7318", "last_activity_date": "2015-07-30T14:00:42.227", "last_edit_date": "2015-03-02T07:09:39.563", "last_editor_user_id": "49", "owner_user_id": "8636", "post_type": "question", "score": 2, "tags": [ "windows", "c++", "visual-studio" ], "title": "Win8(タブレット)向けWindowsデスクトップアプリにてカメラを利用する方法(package.appxmanifestの変更?)", "view_count": 5315 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "C#とVBですが[MSDNの日本フォーラム](https://social.msdn.microsoft.com/Forums/ja-\nJP/ebc89f7d-d6d6-4490-9602-088d84501d01)にMediaCaptureを使用したデスクトップアプリのサンプルコードがあり、githubからプロジェクト一式を入手できます。 \nサンプルではストアアプリのような許可は行わずにカメラを使用できています。\n\nC++では以下のように読み替えるのだと考えられます。\n\n * vcxprojを編集してTargetPlatformVersionを追加\n * 以下のdllを参照 \nSystem.Runtime.WindowsRuntime.dll System.Runtime.dll \nSystem.Runtime.InteropServices.WindowsRuntime.dll \nSystem.Threading.Tasks.dll \nSystem.IO.dll\n\n * Windows.winmdはプロジェクトのプロパティ->構成プロパティ->全般->Windowsストアアプリのサポート->[はい]で参照", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T10:17:01.287", "id": "7324", "last_activity_date": "2015-03-02T10:17:01.287", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8629", "parent_id": "7318", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7318</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7324</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1676"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7327", "answer_count": 1, "body": "「一定期間以上 既読状態なら未読に戻す」というクラスメソッドへのRSpecを書きたいのですが動作しません。\n\nテストはこのように書き\n\n```\n\n let(:company){ Company.create }\n describe \".remove_old_read\" do\n before{ Timecop.freeze(Time.local(2014,10,10)) }\n after{ Timecop.return }\n context \"既読で3ヶ月以上前なら\" do\n before do\n company.update_attributes(read: true, read_at: Time.new(2014,7,9))\n Company.remove_old_read\n end\n it \"未読にする\" do\n expect(company.read).to eq(false)\n end\n end\n end\n \n```\n\n対するメソッドはこのように書いています。\n\n```\n\n class Company &lt; ActiveRecord::Base\n def self.remove_old_read\n Company.where(\"read_at &lt; ?\", Time.zone.now - 3.month).each do |c|\n c.update_attributes({read: false}) #if c.read \n end\n end\n end\n \n```\n\nどこが間違えているのでしょうか? \n特にクラスメソッドの呼び出し方法が自信ありません…。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T10:15:33.713", "favorite_count": 0, "id": "7323", "last_activity_date": "2015-03-02T11:40:03.870", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3271", "post_type": "question", "score": 1, "tags": [ "ruby", "ruby-on-rails" ], "title": "一括処理をするクラスメソッドに対するRspecの書き方", "view_count": 2106 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "僕が書くとしたらこんな感じですかねー。\n\n```\n\n describe \".remove_old_read\" do\n context \"既読で3ヶ月以上前なら\" do\n before do\n company.update_attributes(read: true, read_at: Time.local(2014, 7, 9))\n end\n after{ Timecop.return }\n it \"未読にする\" do\n Timecop.freeze(Time.local(2014, 10, 10)) \n expect { Company.remove_old_read }.to change{ company.reload.read }.from(true).to(false)\n end\n end\n end\n \n```\n\n`Company.remove_old_read`はテストコード上は`company`と全く関連のないメソッドになっています。 \nなので`company`は`reload`してあげないとDBの状態とテストコード上の状態がシンクしません。 \nたぶんここがポイントじゃないかなと思います。\n\nそれから、`context\n\"既読で3ヶ月以上前なら\"`って書いているなら、Timecopを使ったシステム日時の変更はこのcontextブロックの中で書いてあげましょう。 \nまた、`remove_old_read`の近くで変更したほうが「これは2014-10-10にremove_old_readするんだな」というのが見た目にわかりやすくていいと思います。\n\nあと`change`マッチャについてはこちらを参照してください。\n\n * &lt;http://qiita.com/jnchito/items/2e79a1abe7cd8214caa5#change--from--to--by>\n\n参考になれば幸いです。\n\n### 別解\n\nread_atを3ヶ月前の日時で更新すればTimecopはいらないですね。\n\n```\n\n describe \".remove_old_read\" do\n context \"既読で3ヶ月以上前なら\" do\n before do\n # 3ヶ月前ピッタリだとタイミングによっては条件に合致しないかもしれないので、\n # さらに1分追加しておく。\n company.update_attributes(read: true, read_at: 3.months.ago - 1.minute)\n end\n it \"未読にする\" do\n expect { Company.remove_old_read }.to change{ company.reload.read }.from(true).to(false)\n end\n end\n end\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T11:26:44.227", "id": "7327", "last_activity_date": "2015-03-02T11:40:03.870", "last_edit_date": "2015-03-02T11:40:03.870", "last_editor_user_id": "85", "owner_user_id": "85", "parent_id": "7323", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7323</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7327</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7327</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1677"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "gitで差分が出続ける現象に悩まされています。git statusすると以下のメッセージが出たので対処しようとしますが、、、\n\n```\n\n Changes not staged for commit:\n (use \"git add &lt;file>...\" to update what will be committed)\n (use \"git checkout -- &lt;file>...\" to discard changes in working directory)\n \n modified: app/hoge.php\n modified: app/fuga.css\n \n no changes added to commit (use \"git add\" and/or \"git commit -a\")\n \n```\n\n`stash`しても`commit`しても`reset`しても差分が出続けます。SourceTreeやGitHubのアプリケーションなどのGUIで操作しようとしても出続けます。\n\n同様の現象に遭遇した方おりますでしょうか?\n\n解決策の分かる方いらっしゃいましたらご教示いただけると幸いです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T11:24:39.877", "favorite_count": 0, "id": "7325", "last_activity_date": "2015-03-03T03:45:00.300", "last_edit_date": "2015-03-03T03:45:00.300", "last_editor_user_id": "845", "owner_user_id": "534", "post_type": "question", "score": 4, "tags": [ "git" ], "title": "gitで差分が出続ける現象に困っています", "view_count": 2756 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "```\n\n git add app/hoge.php\n git add app/fuga.css\n git commit -m \"&lt;your commit message>\"\n \n```\n\nで解決しないでしょうか?", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T11:26:15.963", "id": "7326", "last_activity_date": "2015-03-02T11:26:15.963", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3313", "parent_id": "7325", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7325</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7326</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1678"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7340", "answer_count": 1, "body": "現在React.jsを使用してアプリケーションを作成しています。 \nブラウザ側ではwebpackを使用してコンポーネントをrequireして使用しています。\n\nReact.jsのサーバサイドレンダリングを使用してレスポンスを返したいと考えているのですが、Nashornにはrequireが存在しないようなので、&lt;https://github.com/nodyn/jvm-\nnpm> を利用してrequireしようとしています。\n\nしかし以下のようにreactをrequireすると\n\n```\n\n engine.eval(\"load('./dist/jsx/jvm-npm.js');\");\n engine.eval(\"var React = require('./node_modules/react/react');\");\n \n```\n\nエラーが発生してしまいます。Nashornでrequireを使う方法はないのでしょうか。\n\n> javax.script.ScriptException: ReferenceError: \"process\" is not defined \n> in ./dist/jsx/jvm-npm.js at line number 106 at column number 11 at \n>\n> jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:564) \n> at \n>\n> jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:548) \n> at \n>\n> jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:528) \n> at \n>\n> jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:524) \n> at \n>\n> jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:194) \n> at \n> javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) \n> at net.jirox.radarscope.RadarScope.render(RadarScope.java:35) at \n> net.jirox.radarscope.RadarScopeTest.testRender(RadarScopeTest.java:32) \n> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at \n>\n> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) \n> at \n>\n> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) \n> at java.lang.reflect.Method.invoke(Method.java:483) at \n>\n> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) \n> at \n>\n> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) \n> at \n>\n> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) \n> at \n>\n> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) \n> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at \n>\n> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) \n> at \n>\n> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) \n> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at \n> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at \n> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at \n> org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at \n> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at \n> org.junit.runners.ParentRunner.run(ParentRunner.java:309) at \n>\n> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) \n> at \n>\n> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) \n> at \n>\n> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) \n> at \n>\n> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) \n> at \n>\n> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) \n> at \n>\n> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) \n> Caused by: ./dist/jsx/jvm-npm.js:106:11 ReferenceError: \"process\" is \n> not defined at \n> jdk.nashorn.internal.scripts.Script$jvm_npm._L21$Require(./dist/jsx/jvm-\n> npm.js:106) \n> at jdk.nashorn.internal.scripts.Script$\\^eval_.runScript(:1) \n> at \n>\n> jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:498) \n> at \n> jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:206) \n> at \n> jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:378) \n> at \n>\n> jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:546) \n> ... 29 more", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T15:46:08.190", "favorite_count": 0, "id": "7333", "last_activity_date": "2015-03-03T00:59:53.813", "last_edit_date": "2015-03-02T21:43:52.083", "last_editor_user_id": null, "owner_user_id": "2298", "post_type": "question", "score": 3, "tags": [ "javascript", "java", "java8", "reactjs" ], "title": "Java8のNashornでrequireしたい", "view_count": 916 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "`ReferenceError: \"process\" is not defined`との事ですので、JavaScript\nのどこかでグローバル変数`process`を参照しようとして、未定義エラーになっていると推測されます。\n\n読み込んでいるファイル`react/react.js`は、Browserify等のコマンドラインツールから読み込むことを想定しているようで、内部で`process.env.NODE_ENV`を参照しています。\n\n読み込むファイルを`react/dist/react.js`か、`react/dist/react.min.js`に変更するとエラーは出なくなると思われます。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T00:59:53.813", "id": "7340", "last_activity_date": "2015-03-03T00:59:53.813", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4809", "parent_id": "7333", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7333</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7340</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7340</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1679"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "`readystatechange` はイベントなのだから `addEventListener`\nを使って登録できると思うんですが、大抵のAjaxサンプルでは `onreadystatechange` に代入する方法をとってると思います。\n\nなにか避ける理由でもあるんでしょうか。ちょっと長いから?\n\n```\n\n var xhr = new XMLHttpRequest();\n xhr.open(\"GET\", \"/path/to/file\", true);\n xhr.onreadystatechange = function(){\n if( this.readyState === 4 &amp;&amp; this.status === 200 ){\n console.log(xhr.responseText);\n }\n };\n xhr.addEventListener('readystatechange', function(){\n if( this.readyState === 4 &amp;&amp; this.status === 200 ){\n console.log(xhr.responseText);\n }\n });\n xhr.send(\"\");\n \n```", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T18:01:34.173", "favorite_count": 0, "id": "7334", "last_activity_date": "2015-09-18T15:47:35.707", "last_edit_date": "2015-03-03T00:48:19.030", "last_editor_user_id": "76", "owner_user_id": "8610", "post_type": "question", "score": 6, "tags": [ "javascript", "ajax" ], "title": "onreadystatechange に対して addEventListener を使わないのはなぜか", "view_count": 1921 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "(現在はどうか分かりませんが、)addEventListenerの方はOperaでは動かないみたいですね。 \nW3Cの仕様でいえばreadystatechangeを発火しないとダメなんですが、それに従っていないようです。\n\nズバリな質問がありました ↓\n\n&lt;https://stackoverflow.com/questions/6971259/readystatechange-using-\naddeventlistener-versus-old-style-property>", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-08-19T15:34:47.583", "id": "14633", "last_activity_date": "2015-08-19T15:34:47.583", "last_edit_date": "2017-05-23T12:38:55.307", "last_editor_user_id": "-1", "owner_user_id": "9608", "parent_id": "7334", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7334</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">14633</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1680"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 2, "body": "PHP の `mysql_connect` を使って MySQL への接続を試みているのですがうまくいきません。\n\n以下コードです。\n\n```\n\n &lt;?php\n \n $connect = mysql_connect(\"hiroki_%\",\"hiroki\",\"\");\n echo mysql_errno().\": \".mysql_error().\"&lt;BR>\";\n \n if ($connect) {\n echo 1;\n } else {\n echo 2;\n }\n \n ?>\n \n```\n\nこれの実行結果はこちらです。\n\n```\n\n > 2005: Unknown MySQL server host 'hiroki_%' (20)\n 2\n \n```\n\n※ ご存知かと思いますが\n\n```\n\n echo mysql_errno().\": \".mysql_error().\"&lt;BR>\";\n \n```\n\nは直近のエラーを表示するコードです。\n\nphptest というデータベースを作成しています。\n\n確かにユーザー作成はできているはずだと思います。\n\n![確かにユーザー作成はできているはずだと思います](https://i.stack.imgur.com/RwIAN.png)\n\n一般的には\n\n```\n\n $connect = mysql_connect(\"localhost\",\"root\",\"\");\n \n```\n\nで接続するのが普通だと思いますがこうした場合の実行結果は\n\n```\n\n > 1045: Access denied for user 'root'@'localhost' (using password: NO)\n 2\n \n```\n\nとなってしまいます。 \nユーザー認証とかの話になってくるので新しくhirokiというユーザーを作成して実行したのですが上記の通りです。\n\n解決策をどうかお力添えお願いいたします。\n\n--追記--\n\nlocalhostにパスワードを設定して\n\n```\n\n &lt;?php\n $connect = mysql_connect(\"localhost\",\"root\",\"password\");\n \n echo mysql_errno().\": \".mysql_error();\n \n```\n\nを実行すると実行結果は\n\n```\n\n 0: \n \n```\n\nとなり、エラーなしで接続できたのですが、phpMyAdminのページを表示すると\n\n```\n\n #1045 - Access denied for user 'root'@'localhost' (using password: YES) \n \n```\n\nとエラー文が表示されてしまい、phpMyAdminに入れなくなってしまいました。\n\n```\n\n MySQL サーバに接続しようとしましたが拒否されました。config.inc.php のホスト、ユーザ名、パスワードが MySQL サーバの管理者から与えられた情報と一致するか確認してください。\n \n```\n\nといった表示も出てきます。\n\nconfig.inc.phpというファイルを編集しようと思いfinderで検索したのですが \nconfig.inc.phpのファイルが14個ほど出てきてどれを編集すればいいのかわかりません。", "comment_count": 8, "content_license": "CC BY-SA 4.0", "creation_date": "2015-03-02T18:15:05.713", "favorite_count": 0, "id": "7335", "last_activity_date": "2020-10-14T01:33:46.200", "last_edit_date": "2020-10-14T01:33:46.200", "last_editor_user_id": "3060", "owner_user_id": "8643", "post_type": "question", "score": 1, "tags": [ "php", "mysql", "phpmyadmin" ], "title": "PHPからMySQLに接続がうまくできない", "view_count": 24203 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "エラーメッセージの通りで、ホスト名が間違っているか名前解決ができていないかでサーバを見つけられていません。\n\nそもそもホスト名には`%`は使えないのですが、指定されているホスト名は実在するのでしょうか\n\n * `mysql_connect()`の第一引数に指定するのは **接続先** のホスト名です。\n * 権限で指定するホスト名は、 **接続元** のホスト名です。\n\n質問の内容からはこの点が区別できていないように見受けられます。\n\nもっと手前の話として、mysql_*系の関数は非推奨になっていますので、そこから見直すことをお勧めします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T00:01:39.897", "id": "7338", "last_activity_date": "2015-03-03T01:06:53.210", "last_edit_date": "2015-03-03T01:06:53.210", "last_editor_user_id": "5793", "owner_user_id": "5793", "parent_id": "7335", "post_type": "answer", "score": 1 }, { "body": "まずは切り分けとして、 \nMySQLもPHPも同じサーバーの中にいるんだね?\n\nであれば、 \nhirokiのホストは **localhost** であるべきだと思うのです。\n\n後、 \n私の記憶だけで申し訳ないけど、 \n昔はMySQLも root,パスなし で接続できたけど、 \n最近はrootにパスワードを必ずつけないと接続できなかった気がするのです。 \nそれが例え **localhost** であったとしても。\n\n**追記への返答** \nrootにパスワードを設定してしまったので、 \nphpMysqlAdminに入れなくなってしまったみたいね。\n\n下記のサイトをご参照ください。 \nphpMyAdminの設定ファイル(config.inc.php)を \nrootで設定したパスワードに書き換えれば \n繋がるようになると思うよ。\n\n&lt;http://php1st.com/435/>\n\nconfig.inc.phpの場所だけど、 \nMacOSXでApacheを立ち上げてやっていると思うけど、 \nApacheで公開されているphpMyAdminフォルダーのにあると思う。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T00:31:33.293", "id": "7339", "last_activity_date": "2015-03-03T04:48:15.197", "last_edit_date": "2015-03-03T04:48:15.197", "last_editor_user_id": "127", "owner_user_id": "127", "parent_id": "7335", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7335</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7338</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1681"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7360", "answer_count": 2, "body": "djangoで開発を進めています。djangoでmodelの設定が、runserverで立ち上げたadminページに反映されないことで困っています。どなたか原因のわかる方がいれば、ご教授いただけると幸いです。\n\n# 背景\n\n 1. model.pyにモデルクラス`TestModel(models.Model)`を記載しました。そのモデルは`sampleField = models.CharField(max_length='20')`のフィールドを含んでいます。\n 2. admin.pyにその`TestModel`を`register`しました。syncdb、makemigrations等を行い、そして以下のコマンドで開発サーバーを立ち上げました。\n``` python manage.py runserver\n\n \n```\n\n 3. `http://localhost:8000/admin`からログインしました。そのモデルでレコードを追加していたところ、sampleFieldにブランクを設定したいということになりました。\n\n 4. model.pyの対応する`sampleField = models.CharField(max_length='20')`を`sampleField = models.CharField(max_length='20',blank=True,null=True)`に変更し、makemigrationsおよびsyncdbを実施しました。\n 5. 再度adminページからレコードの追加を試みましたが、`sampleField`で以下のエラーが発生しました。\n\n> This field is required.\n\n 6. model.pycが存在することが原因かと考え、削除しました。また、開発サーバーを念のため以下のコマンドで再起動しました。しかし、同様のエラーが発生しました。\n``` python manage.py runserver\n\n \n```\n\n 7. htmlのキャッシュが原因かと考え、ブラウザのキャッシュを削除しました。しかし、同様にエラーが発生しました。\n\n 8. djangoのdbキャッシュがあるのかと考え、以下のコマンドで削除しました。ですが、エラーが発生しました。\n``` python manege.py shell;from django.core.cache import\ncache;cache.clear()\n\n \n```\n\n 9. htmlが反映されていないようにたので、`TestModel(models.Model)`に`sampleField2 = models.CharField(max_length='20',blank=True,null=True)`を追加し、makemigrationsおよびsyncdbを実施し、開発サーバー再起動、adminページへのアクセスを実施しました。adminページでは、`sampleField2`の入力項目が表示されていませんでした。\n\nどこかにhtmlのキャッシュがたまっている?かと思っていますが、どこから削除すれ良いかわかりませんでした。どなたか上記問題の解決策がわかれば、ご教授ください。\n\nよろしくお願いします。\n\n# 追記\n\nローカル環境で、設定を実施していた際は、htmlが反映されなかったのですが、Apacheの立ち上がっているWEBサーバーにpushして、そこで確認してみると、問題なく起動されました。 \nrunserverで立ち上げたサーバの挙動がイマイチ理解できていないようです。\n\n# 解決報告\n\n下記の流れで、本件が発生しておりました。私のミスでした。色々ご迷惑をおかけしました。\n\n 1. ターミナルAにて、bashを利用し、プロジェクトリポジトリ`/home/myname/myDjangoProject`にて`python manage.py runserver`を実行。\n 2. 別にターミナルBを起動し、`/home/myname/myDjangoProject`で、model.py等を編集。\n 3. サーバー上のリポジトリにpushする際に、コンフリクトが発生したので、ターミナルBにて`/home/myname/myDjangoProject`を`/home/myname/_myDjangoProject`にリネーム。サーバー上のリポジトリをローカルに再度、cloneし、作業を再開。\n 4. ここまでが背景の1から3に隠れていました。その後、背景の4以降を実施。\n\nターミナルAが参照しているディレクトリは、実は、`/home/myname/_myDjangoProject`であったが、pwdの実行結果は`/home/myname/myDjangoProject`となるため、ワーキングディレクトリがズレていることに気付きませんでした。そのため、今回のように設定が反映されないと考えていました。\n\n参照先のDBがズレていないかとご指摘いただいたことで、参照していたsqlite3を確認しようと、ターミナルAでrunserverを停止し、`open\n.`を実行したところ、今回の問題に気付きました。\n\nご迷惑おかけしました。そして、色々ありがとうございました。 \n(タイトルは本質からズレていますが、どのように修正したら良いのでしょう。)", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-02T22:24:24.630", "favorite_count": 0, "id": "7337", "last_activity_date": "2015-03-03T12:58:22.387", "last_edit_date": "2015-03-03T12:58:22.387", "last_editor_user_id": "7834", "owner_user_id": "7834", "post_type": "question", "score": 3, "tags": [ "python", "django" ], "title": "djangoのadminページのhtmlキャッシュ削除について", "view_count": 1556 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "(ドキュメントを読み返して、回答自体がドキュメントを誤読したうえで作成してしまっている可能性があるので、一旦取り消します)", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T02:14:59.047", "id": "7343", "last_activity_date": "2015-03-03T07:24:46.100", "last_edit_date": "2015-03-03T07:24:46.100", "last_editor_user_id": "2784", "owner_user_id": "2784", "parent_id": "7337", "post_type": "answer", "score": 1 }, { "body": "問題の状況が見えないので、示唆レベルの回答です。\n\n * `python manage.py runserver` で起動 &amp; デフォルトのキャッシュ設定の場合、キャッシュはとくに残りません。\n * `python manage.py runserver` で起動する場合はファイルに変更があればサーバーは自動で再起動されます。\n * Django 1.7 でしたら `syncdb` で問題ありません。内部的に `migrate` が実行されます。該当コード &lt;https://github.com/django/django/blob/1.7.5/django/core/management/commands/syncdb.py#L27>\n\n以下の確認が必要そうです。\n\n * migrationファイルが正しく作成、適応されているか\n * 確認中のアプリサーバーは作成、適応したDBを正しく参照しているか\n * 確認中のアプリサーバーは正しく再起動しているか \n \n\n * とりあえずはローカル環境で、`runserver` と `sqlite` のデータベースで動作確認するのが良さそうです。\n \n\nまた、エラーが発生したのであればエラー内容を書いていただけると回答の役に立ちそうです。\n\n(信用度が足りなくて回答へのコメントとかができない!!)", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T05:55:07.297", "id": "7360", "last_activity_date": "2015-03-03T06:07:36.803", "last_edit_date": "2015-03-03T06:07:36.803", "last_editor_user_id": "2798", "owner_user_id": "2798", "parent_id": "7337", "post_type": "answer", "score": 5 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7337</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7360</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7360</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1682"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7370", "answer_count": 3, "body": "元データhogeAry \n・子に対する親を parent_id で指定 \n・親は parent_id = 0\n\n```\n\n Array\n (\n [0] => Array\n (\n [hoge_id] => 2\n [hoge] => 親2\n [parent_id] => 0\n )\n [1] => Array\n (\n [hoge_id] => 3\n [hoge] => 子2-1\n [parent_id] => 2\n )\n [2] => Array\n (\n [hoge_id] => 4\n [hoge] => 子7-1\n [parent_id] => 7\n )\n [3] => Array\n (\n [hoge_id] => 7\n [hoge] => 親7\n [parent_id] => 0\n )\n [4] => Array\n (\n [hoge_id] => 1\n [hoge] => 親1\n [parent_id] => 0\n )\n )\n \n```\n\n希望出力結果\n\n```\n\n &lt;ul>\n &lt;li>親1&lt;/li>\n &lt;li>親2\n &lt;ul>\n &lt;li>子2-1&lt;/li>\n &lt;/ul>\n &lt;/li>\n &lt;li>親7\n &lt;ul>\n &lt;li>子7-1&lt;/li>\n &lt;/ul>\n &lt;/li>\n &lt;/ul>\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T01:25:16.077", "favorite_count": 0, "id": "7341", "last_activity_date": "2015-03-03T08:08:32.537", "last_edit_date": "2015-03-03T03:46:22.523", "last_editor_user_id": "7926", "owner_user_id": "7886", "post_type": "question", "score": -3, "tags": [ "php", "html" ], "title": "PHP多次元配列から階層リストタグ&lt;ul>&lt;li>&lt;/li>&lt;li>&lt;ul>&lt;li>&lt;/li>&lt;/ul>&lt;/li>&lt;/ul>を出力したい", "view_count": 4128 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "現状で細かい条件などが示されていないので、とりあえず例示されているデータでちゃんと出来るように適当に組んでみました。 \n`$data` に例示された配列としてみてください。\n\n```\n\n /**\n * hoge_id を比較して昇順にする.\n * @param array $a 左辺\n * @param array $b 右辺\n * @return integer $a['hoge_id'] が $b より大きい時は 1. $b['hoge_id'] が $a 以下の時は -1 を返す.\n */\n function id_cmp( array $a, array $b )\n {\n return ($a['hoge_id']>$b['hoge_id']) ? 1 : -1;\n }\n // リストデータ作成.\n $listed_data = array();\n foreach( $data as $datum )\n {\n // もしなんかの親だったら子供を探す\n if( $datum['parent_id'] === 0 ) {\n foreach( $data as $_child_datum ) {\n // 子を見つけたら子として拾っておく\n if( $datum['hoge_id'] == $_child_datum['parent_id'] ) {\n $datum['childs'] []= $_child_datum;\n }\n }\n $listed_data []= $datum;\n }\n }\n // hoge_id 順にソート.\n usort($listed_data,'id_cmp');\n \n // リスト化開始.\n $buffer='&lt;ul>';\n foreach( $listed_data as $datum ) {\n $buffer.=\"&lt;li>{$datum['hoge']}\";\n if( isset($datum['childs']) ) {\n $buffer.='&lt;ul>';\n $childs = $datum['childs'];\n foreach( $childs as $child ) {\n $buffer.=\"&lt;li>{$child['hoge']}&lt;/li>\";\n }\n $buffer.='&lt;/ul>&lt;/li>';\n } else {\n $buffer.='&lt;/li>';\n }\n }\n // リスト表示.\n echo $buffer.='&lt;/ul>';\n \n```\n\n使い捨てコードなので汚くて済みません。 \n目的も他のデータパターンがあるのかどうか分かりませんでしたがこれでいかがでしょうか?", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T04:32:53.170", "id": "7352", "last_activity_date": "2015-03-03T04:32:53.170", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7926", "parent_id": "7341", "post_type": "answer", "score": 2 }, { "body": "宿題を手伝っている感じがしますが… \nオブジェクトを使って、ループ内のコードを簡単にしようとしてます。配列に比べると、オブジェクトだと持ち回しができるのでコードの見通しが良くなると思っています。その代わりHTML変換で再帰呼び出しになってしまいました。\n\nざっと書いただけなので、ちゃんと書くなら、 \n・stdClassではなくてHoge用のクラスを使う、 \n・エラー処理を行う、 \nなど必要なことはたくさんありそうです。\n\n```\n\n // オブジェクトに変換する\n $hogeAll = [];\n foreach($data as $hoge) {\n $hogeAll[$hoge['hoge_id']] = makeHoge($hoge);\n }\n // 階層構造を構築する\n $root = [];\n foreach($hogeAll as $hoge) {\n if($hoge->parent>0) {\n $hogeAll[$hoge->parent]->children[] = $hoge;\n } else {\n $root[] = $hoge;\n }\n }\n // HTMLに変換する\n echo listHoge($root);\n \n /**\n * @param stdClass[] $hogeList\n * @param string $head\n * @return string\n */\n function listHoge(array $hogeList, $head='') {\n $string = \"{$head}&lt;ul>\";\n foreach($hogeList as $hoge) {\n $string .= \"\\n{$head} &lt;li>\".$hoge->val;\n if($hoge->children) {\n $string .= \"\\n{$head} \".listHoge($hoge->children, \"{$head} \").\"\\n{$head}\";\n }\n $string .= \"&lt;/li>\";\n }\n return $string.\"\\n{$head}&lt;/ul>\";\n }\n \n /**\n * @param array $data\n * @return stdClass\n */\n function makeHoge($data) {\n $hoge = new stdClass();\n $hoge->id = $data['hoge_id'];\n $hoge->val = $data['hoge'];\n $hoge->parent = $data['parent_id'];\n $hoge->children = [];\n return $hoge;\n }\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T06:18:32.670", "id": "7361", "last_activity_date": "2015-03-03T06:37:04.553", "last_edit_date": "2015-03-03T06:37:04.553", "last_editor_user_id": "2571", "owner_user_id": "2571", "parent_id": "7341", "post_type": "answer", "score": 2 }, { "body": "他の方のアプローチのように、表示したい構造に合わせた木構造に変換してから表示用の組み立て処理を行うのも手ですが、今回示されているデータはある意味すでに木構造を表していますので、わざわざ表示向けのデータ構造に変換しないアプローチでもよいかと思います。\n\n下のコードでは、基本的な再帰のアプローチで、都度対象となる子を抽出してきてタグを組み立てています。\n\n```\n\n &lt;?php\n \n $data = [\n [\n 'hoge_id' => 2,\n 'hoge' => '親2',\n 'parent_id' => 0,\n ],\n [\n 'hoge_id' => 8,\n 'hoge' => '孫',\n 'parent_id' => 4,\n ],\n [\n 'hoge_id' => 3,\n 'hoge' => '子2-1',\n 'parent_id' => 2,\n ],\n [\n 'hoge_id' => 4,\n 'hoge' => '子7-1',\n 'parent_id' => 7,\n ],\n [\n 'hoge_id' => 7,\n 'hoge' => '親7',\n 'parent_id' => 0,\n ],\n [\n 'hoge_id' => 1,\n 'hoge' => '親1',\n 'parent_id' => 0,\n ]\n ];\n \n class HtmlUlBuilder\n {\n private $data;\n \n public function __construct($data)\n {\n $this->data = $data;\n }\n \n public function buildFromParent($parent_id)\n {\n $children = array_filter($this->data, function ($element) use ($parent_id) {\n return $element['parent_id'] === $parent_id;\n });\n \n if (count($children) === 0) return '';\n \n return '&lt;ul>' . array_reduce($children, function ($current, $element) {\n return $current . PHP_EOL . '&lt;li>' . $element['hoge'] . $this->buildFromParent($element['hoge_id']) . '&lt;/li>';\n }, '') . '&lt;/ul>';\n }\n }\n \n usort($data, function ($a, $b) {\n return $a['hoge_id'] > $b['hoge_id'];\n });\n \n $builder = new HtmlUlBuilder($data);\n $html = $builder->buildFromParent(0);\n \n echo $html;\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T08:08:32.537", "id": "7370", "last_activity_date": "2015-03-03T08:08:32.537", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5444", "parent_id": "7341", "post_type": "answer", "score": 5 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7341</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7370</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7370</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1683"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7387", "answer_count": 1, "body": "ASP.NET MVC2でCustomHelperを作っています。\n\n必要な情報が取得できない問題があったので、 \n解決方法があればご教示ください。\n\nViewModelにDisplayName属性やValidationAttributeをつけています。\n\n属性を取得する際はModelMetadata.FromLambdaExpression()で取得できますが、 \n対象のViewModelがBaseViewModelをoverrideしている場合、 \nBaseViewModelの属性(たとえばDisplayName)を取得するようです。 \n※今回の場合、BaseViewModelにはDisplayName属性をつけていないので \n取得できない\n\n```\n\n public static MvcHtmlString LabelExFor&lt;TModel, TProperty>(this HtmlHelper&lt;TModel> html, Expression&lt;Func&lt;TModel, TProperty>> expression)\n {\n ModelMetadata metadata = ModelMetadata.FromLambdaExpression(expression, html.ViewData);\n \n return LabelExFor(html, expression, metadata.IsRequired);\n }\n \n```\n\nViewではBaseViewModelをoverrideしたViewModelを用いているので \nViewModelの属性を取得したいのですが、どのようにすればよいでしょうか?\n\n尚、ViewModelのプロパティをoverrideではなくnewで定義した場合は \nViewModelの属性を取ってくるようです。\n\n# 最終的な回避方法\n\n標準の`LabelFor`は用いず、自作の`LabelExFor`で置き換える。`LabelExFor`では`FromLambdaExpression()`ではなく、`FromStringExpression()`を用いてmetadataの取得を行う。\n\n```\n\n public static MvcHtmlString LabelExFor&lt;TModel, TProperty>(this HtmlHelper&lt;TModel> html, Expression&lt;Func&lt;TModel, TProperty>> expression)\n {\n var htmlFieldName = ExpressionHelper.GetExpressionText(expression);\n var metadata = ModelMetadata.FromStringExpression(ExpressionHelper.GetExpressionText(expression), html.ViewData);\n \n string labelText = metadata.DisplayName ?? \n metadata.PropertyName ?? \n htmlFieldName.Split('.').Last();\n if (String.IsNullOrEmpty(labelText))\n {\n return MvcHtmlString.Empty;\n }\n (以下略)\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T02:11:01.320", "favorite_count": 0, "id": "7342", "last_activity_date": "2015-03-19T03:08:42.557", "last_edit_date": "2015-03-19T03:08:42.557", "last_editor_user_id": "8647", "owner_user_id": "8647", "post_type": "question", "score": 1, "tags": [ "c#", "asp.net", "mvc" ], "title": "ModelMetadata.FromLambdaExpressionが親のメタデータを参照する", "view_count": 820 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "現行の`ModelMetadata.FromLambdaExpression`の[ソース](http://referencesource.microsoft.com/#System.Web/ModelBinding/ModelMetadata.cs)の290行目で、\n\n```\n\n containerType = memberExpression.Expression.Type;\n \n```\n\nとコンテナ型を求めている箇所が`System.Web.Mvc.dll`のバージョン2.0.0.0では\n\n```\n\n containerType = body.Member.DeclaringType;\n \n```\n\nとなっているため、過去に不具合修正が入っているのだと思われます。\n\n## 拡張メソッドでの回避方法\n\n例えば`LabelFor`の場合、以下のように拡張メソッドを実装すれば`ModelMetadata.FromStringExpression`を利用します。なお拡張メソッドの利用には`web.config`の編集が必要です。\n\n```\n\n public static class HtmlHelperExtensions\n {\n public MvcHtmlString LabelFor2&lt;TModel, TProperty>(this HtmlHelper&lt;TModel> html, Expression&lt;Func&lt;TModel, TValue>> expression)\n {\n return html.Label(ExpressionHelper.GetExpressionText(expression));\n }\n }\n \n```\n\nこれでもダメであれば自分で`ModelMetadata`と`HtmlHelper`を作って`LabelForModel`に渡すか、自分でHTMLを作るしかないように思われます。", "comment_count": 6, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T13:32:09.280", "id": "7387", "last_activity_date": "2015-03-18T11:56:50.403", "last_edit_date": "2020-06-17T08:14:45.997", "last_editor_user_id": "-1", "owner_user_id": "5750", "parent_id": "7342", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7342</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7387</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7387</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1684"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7348", "answer_count": 1, "body": "Activityのフラグメントに`FragmentTabHost`を使ってリストフラグメントを入れ子にしたのですが、その入れ子にされたリストフラグメントから、Activityに情報を伝えることはできますか?\nできるのであればその方法を教えて頂ければ嬉しいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T02:27:52.540", "favorite_count": 0, "id": "7344", "last_activity_date": "2015-03-03T03:43:33.243", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7232", "post_type": "question", "score": 0, "tags": [ "android", "android-fragments", "android-listfragment" ], "title": "入れ子にしたフラグメントからActivityを操作する", "view_count": 527 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "子供の`ListFragment`の`getActivity()`を呼ぶと、FragmentがAttachされている`Activity`が取得できます。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T03:43:33.243", "id": "7348", "last_activity_date": "2015-03-03T03:43:33.243", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "845", "parent_id": "7344", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7344</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7348</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7348</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1685"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7354", "answer_count": 3, "body": "Wiresharkのように、en0とen4を同時にキャプチャして1つのファイルとして出力する方法を模索しています。 \nen0とen4を同時にキャプチャし、en0はモニターモードにすべく、下記のように書いてみました。\n\ntcpdump -Ini en0 -w WLAN.pcap -W1 -G30 &amp; tcpdump -i en4 -w LAN.pcap -W1 -G30 &amp;\niperf -c 192.168.0.100 -i 1 -t30 -f m >> iperf.txt\n\nしかし、ファイルが別々になってしまう、という点で、期待する動作ではありません。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T03:01:35.243", "favorite_count": 0, "id": "7346", "last_activity_date": "2022-04-13T04:52:25.030", "last_edit_date": "2015-03-03T06:35:24.260", "last_editor_user_id": "7590", "owner_user_id": "7590", "post_type": "question", "score": 0, "tags": [ "macos", "tcpdump", "wireshark" ], "title": "en0とen4を同時にキャプチャして1つのファイルとして出力する方法", "view_count": 7431 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "WiresharkをインストールしてコマンドラインI/F(`tshark`)を使う\n\n`% tshark -i 1 2 -F pcap -w output.file`\n\n`-i` に指定するのはI/F名か`-D`を指定して得られるI/F一覧の番号\n\nもしくは、tcpdumpを2個動かして取得したファイルをWiresharkでマージする。GUIでやるほかにもmergecapというコマンドラインツールもあるようです。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T03:43:55.263", "id": "7349", "last_activity_date": "2015-03-03T03:43:55.263", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5793", "parent_id": "7346", "post_type": "answer", "score": 1 }, { "body": "## 追記\n\n回答後に、質問内容が編集され「en0はモニターモードに」という前提条件が追加されていますが、以下の方法はWi-\nFiインタフェースをモニターモードに設定するための `-I` オプションと併用することはできません。\n\n* * *\n\n`os-x` のタグが付いているので OS X 固有の回答です。\n\nOS X 10.9(Darwin 13.0)以降であれば、tcpdump を以下のように実行することで複数インタフェースをキャプチャできます。\n\n```\n\n $ sudo tcpdump -i pktap,en0,en4 -w mix.pcap\n \n```\n\nポイントは、`-i` オプションのインタフェース指定で、キャプチャしたい複数のインタフェースを `pktap`\nに続けてカンマ区切りで列挙することです。これで複数のインタフェースを同時にキャプチャできます。\n\nなお、OS X 付属の tcpdump のマニュアルに記載されているように、この機能は OS X(Darwin)固有の PKTAP\nという疑似インタフェースを利用しているため、他のOSでは使えません。\n\n> -i Listen on interface.\n>\n> If the -D flag is supported, an interface number as printed by that flag can\n> be used as the interface argument.\n>\n> On Darwin systems version 13 or later, when the interface is unspecified,\n> tcpdump will use a pseudo interface to capture packets on a set of\n> interfaces determined by the kernel (excludes by default loopback and tunnel\n> interfaces).\n>\n> Alternatively, to capture on more than one interface at a time, one may use\n> \"pktap\" as the interface parameter followed by an optional list of comma\n> separated interface names to include. For example, to capture on the\n> loopback and en0 interface:\n```\n\n> tcpdump -i pktap,lo0,en0\n> \n```\n\n>\n> An interface argument of \"all\" or \"pktap,all\" can be used to capture packets\n> from all interfaces, including loopback and tunnel interfaces.\n>\n> A pktap pseudo interface provides for packet metadata using the default\n> PKTAP data link type and files are written in the Pcap-ng file format. The\n> RAW data link type must be used to force to use the legacy pcap-savefile(5)\n> file format with a ptkap pseudo interface. Note that captures on a ptkap\n> pseudo interface will not be done in promiscuous mode.\n>\n> An interface argument of \"iptap\" can be used to capture packets from at the\n> IP layer. This capture packets as they are passed to the input and output\n> routines of the IPv4 and IPv6 protocol handlers of the networking stack.\n> Note that captures will not be done in promiscuous mode.\n>\n> On other OSes, if unspecified, tcpdump searches the system interface list\n> for the lowest numbered, configured up interface (excluding loopback). Ties\n> are broken by choosing the earliest match.\n>\n> On Linux systems with 2.2 or later kernels, an interface argument of \"any\"\n> can be used to capture packets from all interfaces. Note that captures on\n> the \"any\" device will not be done in promiscuous mode.", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T05:22:29.783", "id": "7354", "last_activity_date": "2015-03-04T02:00:58.087", "last_edit_date": "2020-06-17T08:14:45.997", "last_editor_user_id": "-1", "owner_user_id": "1024", "parent_id": "7346", "post_type": "answer", "score": 2 }, { "body": "以下ができるようになってます。\n\n```\n\n # tshark -i enp1s0f0 -i enp1s0f1\n Running as user \"root\" and group \"root\". This could be dangerous.\n Capturing on 'enp1s0f0' and 'enp1s0f1'\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2022-04-13T02:30:28.430", "id": "88311", "last_activity_date": "2022-04-13T04:52:25.030", "last_edit_date": "2022-04-13T04:52:25.030", "last_editor_user_id": "3060", "owner_user_id": "52203", "parent_id": "7346", "post_type": "answer", "score": 0 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7346</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7354</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7354</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1686"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7359", "answer_count": 1, "body": "こんにちは\n\n[Detect if an Android app was downloaded from Google Play vs Amazon vs Other -\nStack Overflow](https://stackoverflow.com/questions/15348671/detect-if-an-\nandroid-app-was-downloaded-from-google-play-vs-amazon-vs-other)\n\n上記の記事のようにマーケットの判定を行いたいのですが`getInstallerPackageName`で`NULL`を返し、エラーになります。 \n`getInstallerPackageName`でマーケット名を取得する方法をご教授お願いします。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T03:23:52.320", "favorite_count": 0, "id": "7347", "last_activity_date": "2015-03-03T05:50:21.403", "last_edit_date": "2017-05-23T12:38:55.250", "last_editor_user_id": "-1", "owner_user_id": "8649", "post_type": "question", "score": 1, "tags": [ "android" ], "title": "android マーケットの判定を行いたい", "view_count": 229 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "> リンク先の中に、ADBでインストールしたアプリの場合はnullになるとありますが、それではないでしょうか? – yuki 1 時間前\n\nADBで実行していたのが原因でした。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T05:50:21.403", "id": "7359", "last_activity_date": "2015-03-03T05:50:21.403", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8649", "parent_id": "7347", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7347</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7359</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7359</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1687"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7375", "answer_count": 1, "body": "System.Windows.Controls.ContextMenuクラスをXAMLではなくC#のコードから生成しています。階層構造は以下のとおりで、カッコ内はバインドされたキーです。\n\nこのコンテキストメニューが開いた状態で、B→Aと押すとMenu2-1が実行されるようにしたいのですが、どのようにしたら良いのでしょうか。\n\n```\n\n ContextMenu\n Menu1 (A)\n Menu2 (B)\n Menu2-1 (A)\n Menu2-2 (B)\n Menu3 (C)\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T03:50:56.847", "favorite_count": 0, "id": "7350", "last_activity_date": "2015-03-03T08:55:26.680", "last_edit_date": "2015-03-03T04:56:30.927", "last_editor_user_id": "7722", "owner_user_id": "7722", "post_type": "question", "score": 1, "tags": [ "c#", "wpf" ], "title": "階層構造を持ったコンテキストメニューをキーボードで操作する", "view_count": 1344 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "ご質問の意図として、\n\n 1. コンテキストメニューにアクセスキーを指定したい\n 2. コンテキストメニューにコマンドをバインドして実行したい\n\nのどちらなのか、意図を取りかねましたので分けてご回答いたします。 \n尚、前提として、\n\n```\n\n &lt;Window x:Class=\"WpfApplication2.MainWindow\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n Title=\"MainWindow\" Height=\"350\" Width=\"525\"/>\n \n```\n\nのような極めて単純なWindowを定義済みとご理解ください。\n\n## コンテキストメニューにアクセスキーを指定したい\n\nに関しては、ContextMenuの中に含ませるMenuItemのHeaderプロパティの中に、以下のように、アンダースコアに続いて、目的のキーを指定することで可能です。\n\n```\n\n var menuItem = new MenuItem {Header = \"ファイル(_F)\"};\n \n```\n\n## コンテキストメニューにコマンドをバインドして実行したい\n\nこの場合、Xamlではなく、CSharpにて定義したいとのことなので、MainWindowのCtorのタイミングでコンテキストメニューを生成して、MainWindowのコンテキストメニューとして登録するなら、以下のようなコードになるかと思います。\n\n```\n\n using System.Windows;\n using System.Windows.Controls;\n using System.Windows.Input;\n \n namespace WpfApplication2\n {\n /// &lt;summary>\n /// MainWindow.xaml の相互作用ロジック\n /// &lt;/summary>\n public partial class MainWindow : Window\n {\n private static readonly ICommand ShowMessageCommand = new RoutedCommand(\"ShowMessageCommand\", typeof (MenuItem));\n \n \n public MainWindow()\n {\n InitializeComponent();\n \n CommandBinding bind = new CommandBinding(ShowMessageCommand, ShowCommand);\n \n \n ContextMenu contextMenu = new ContextMenu();\n \n \n MenuItem menuItem = new MenuItem {Header = \"A(_A)\", Command = ShowMessageCommand};\n menuItem.CommandBindings.Add(bind);\n contextMenu.Items.Add(menuItem);\n \n menuItem = new MenuItem {Header = \"B(_B)\"};\n \n MenuItem subItem = new MenuItem {Header = \"A-A(_A)\", Command = ShowMessageCommand};\n subItem.CommandBindings.Add(bind);\n menuItem.Items.Add(subItem);\n \n subItem = new MenuItem {Header = \"B-B(_B)\", Command = ShowMessageCommand};\n subItem.CommandBindings.Add(bind);\n menuItem.Items.Add(subItem);\n \n contextMenu.Items.Add(menuItem);\n \n \n menuItem = new MenuItem {Header = \"C(_C)\", Command = ShowMessageCommand};\n menuItem.CommandBindings.Add(bind);\n contextMenu.Items.Add(menuItem);\n \n ContextMenu = contextMenu;\n }\n \n \n private void ShowCommand(object sender, ExecutedRoutedEventArgs e)\n {\n MenuItem item = sender as MenuItem;\n \n if (item != null)\n {\n MessageBox.Show(this, \"コンテキストメニューの\\\"\" + item.Header + \"\\\"に対応するコマンドが実行されました。\");\n }\n }\n }\n \n```\n\n}\n\n上記サンプルでは、RoutedCommandを利用したCommandBindingを利用しておりますが、適宜そこは変更していただければと思います。 \nまた、蛇足ながら、コマンドではなく、特定のイベントに対応した処理をする場合は、MenuItemの当該イベントにイベントハンドラを登録すれば可能です。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T08:55:26.680", "id": "7375", "last_activity_date": "2015-03-03T08:55:26.680", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7287", "parent_id": "7350", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7350</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7375</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7375</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1688"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7627", "answer_count": 2, "body": "PHP超初心者です。\n\n現在、問い合わせフォームを作っているのですが上手くいかない箇所があります。\n\n```\n\n function Conv2HtmlSpecialChars($value)\n {\n if (is_array($value)) {\n foreach ($value as $k => $v) {\n $value[$k] = Conv2HtmlSpecialChars($v);\n }\n } else {\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\n }\n \n return $value;\n \n }\n \n```\n\nという関数があります。\n\nそして、PHPファイルの中で、\n\n```\n\n $dataArray = Conv2HtmlSpecialChars($dataArray);\n \n```\n\nという使い方をします。\n\n上記の`$dataArray`という配列変数には、例えば、\n\n```\n\n $dataArray['氏名'] = \"あいうえお\";\n $dataArray['フリガナ'] = \"アイウエオ\";\n $dataArray['郵便番号'] = \"999-9999\";\n $dataArray['住所'] = \"東京都大田区\";\n $dataArray['E-mailアドレス'] = \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="483c2d3b3c173c2d3b3c082d30292538242d662b2725">[email&#160;protected]</a>\";\n $dataArray['お問い合わせ内容'] = \"お尋ねしたいことがあります\";\n \n```\n\nがセットされているとします。\n\nそして実際に、PHPを動かしてみると・・・\n\n```\n\n $dataArray['氏名'] => \"\"\n $dataArray['フリガナ'] => \"\"\n $dataArray['郵便番号'] => \"999-9999\"\n $dataArray['住所'] => \"\"\n $dataArray['E-mailアドレス'] => \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c6b2a3b5b299b2a3b5b286a3bea7abb6aaa3e8a5a9ab">[email&#160;protected]</a>\"\n $dataArray['お問い合わせ内容'] => \"\"\n \n```\n\nというように日本語の文字列が消えて、英数字だけしか残りません。\n\n```\n\n htmlentities($value, ENT_QUOTES, 'UTF-8');\n \n```\n\nでキチンと`UTF-8`を指定しているのに、なぜ日本語文字列が消えてしまうのでしょうか?\n\n原因をご存知の方、原因と適切な対処方法をご教授いただきたく存じます。 \nもし、上記で私がチンプンカンプンなことを記述していたら、そこもご指定願います。\n\n**開発環境**\n\n * レンタルサーバー(CentOS 5)\n * PHP(5.2.16)\n * 作業環境(Windows7pro)\n * PHP編集用(NoEditor)\n\nP.S. \n他に誰も開発経験がなくPHPが分かる人が1人もいない中、何とか頑張っています。 \n何卒、ご協力よろしくお願い致します。\n\n======================== 以下続報 ========================\n\n問題となっている`Conv2HtmlSpecialChars関数`に以下のようなデバッグを仕掛けました。\n\n```\n\n function Conv2HtmlSpecialChars($value)\n {\n \n echo'&lt;hr />&lt;pre>fuction_Conv2HtmlSpecialChars_Start --> ';var_dump( $value );echo'&lt;/pre>';\n \n if (is_array($value)) {\n foreach ($value as $k => $v) {\n $value[$k] = Conv2HtmlSpecialChars($v);\n }\n } else {\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\n \n echo'&lt;hr />&lt;pre>htmlentities_value --> ';var_dump( $value );echo'&lt;/pre>';\n \n }\n \n echo'&lt;hr />&lt;pre>fuction_Conv2HtmlSpecialChars_End --> ';var_dump( $value );echo'&lt;/pre>';\n \n return $value;\n }\n \n```\n\nその結果、以下のように出力されました。 \n※文字化けしている箇所は無視してください。\n\n```\n\n fuction_Conv2HtmlSpecialChars_Start --> array(9) {\n [\"羂���\"]=>\n string(10) \"武田 進言\"\n [\"��������\"]=>\n string(16) \"タケダ シンゲン\"\n [\"�灸梢���\"]=>\n string(8) \"788-9999\"\n [\"篏���\"]=>\n string(12) \"東京都台東区\"\n [\"�肢����\"]=>\n string(12) \"03-9999-9999\"\n [\"E-mail�≪������\"]=>\n string(21) \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f387968087de87968087b3968b929e839f96dd909c9e">[email&#160;protected]</a>\"\n [\"E-mail�≪������(腆肴���)\"]=>\n string(21) \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="89fdecfafda4fdecfafdc9ecf1e8e4f9e5eca7eae6e4">[email&#160;protected]</a>\"\n [\"��������������絎�\"]=>\n string(32) \"テストコメント1テストコメント2\"\n [\"date\"]=>\n string(27) \"2015/03/03 Tuesday 23:59:29\"\n }\n \n fuction_Conv2HtmlSpecialChars_Start --> string(10) \"武田 進言\"\n \n htmlentities_value --> string(0) \"\"\n \n fuction_Conv2HtmlSpecialChars_End --> string(0) \"\"\n \n fuction_Conv2HtmlSpecialChars_Start --> string(16) \"タケダ シンゲン\"\n \n htmlentities_value --> string(0) \"\"\n \n fuction_Conv2HtmlSpecialChars_End --> string(0) \"\"\n \n fuction_Conv2HtmlSpecialChars_Start --> string(8) \"788-9999\"\n \n htmlentities_value --> string(8) \"788-9999\"\n \n fuction_Conv2HtmlSpecialChars_End --> string(8) \"788-9999\"\n \n fuction_Conv2HtmlSpecialChars_Start --> string(12) \"東京都台東区\"\n \n htmlentities_value --> string(0) \"\"\n \n fuction_Conv2HtmlSpecialChars_End --> string(0) \"\"\n \n fuction_Conv2HtmlSpecialChars_Start --> string(12) \"03-9999-9999\"\n \n htmlentities_value --> string(12) \"03-9999-9999\"\n \n fuction_Conv2HtmlSpecialChars_End --> string(12) \"03-9999-9999\"\n \n fuction_Conv2HtmlSpecialChars_Start --> string(21) \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4a3e2f393e673e2f393e0a2f322b273a262f64292527">[email&#160;protected]</a>\"\n \n htmlentities_value --> string(21) \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a9ddccdadd84ddccdadde9ccd1c8c4d9c5cc87cac6c4">[email&#160;protected]</a>\"\n \n fuction_Conv2HtmlSpecialChars_End --> string(21) \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a2d6c7d1d68fd6c7d1d6e2c7dac3cfd2cec78cc1cdcf">[email&#160;protected]</a>\"\n \n fuction_Conv2HtmlSpecialChars_Start --> string(21) \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="71051402055c05140205311409101c011d145f121e1c">[email&#160;protected]</a>\"\n \n htmlentities_value --> string(21) \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="22564751560f5647515662475a434f524e470c414d4f">[email&#160;protected]</a>\"\n \n fuction_Conv2HtmlSpecialChars_End --> string(21) \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cbbfaeb8bfe6bfaeb8bf8baeb3aaa6bba7aee5a8a4a6">[email&#160;protected]</a>\"\n \n fuction_Conv2HtmlSpecialChars_Start --> string(32) \"テストコメント1テストコメント2\"\n \n htmlentities_value --> string(0) \"\"\n \n fuction_Conv2HtmlSpecialChars_End --> string(0) \"\"\n \n fuction_Conv2HtmlSpecialChars_Start --> string(27) \"2015/03/03 Tuesday 23:59:29\"\n \n htmlentities_value --> string(27) \"2015/03/03 Tuesday 23:59:29\"\n \n fuction_Conv2HtmlSpecialChars_End --> string(27) \"2015/03/03 Tuesday 23:59:29\"\n \n fuction_Conv2HtmlSpecialChars_End --> array(9) {\n [\"羂���\"]=>\n string(0) \"\"\n [\"��������\"]=>\n string(0) \"\"\n [\"�灸梢���\"]=>\n string(8) \"788-9999\"\n [\"篏���\"]=>\n string(0) \"\"\n [\"�肢����\"]=>\n string(12) \"03-9999-9999\"\n [\"E-mail�≪������\"]=>\n string(21) \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="95e1f0e6e1b8e1f0e6e1d5f0edf4f8e5f9f0bbf6faf8">[email&#160;protected]</a>\"\n [\"E-mail�≪������(腆肴���)\"]=>\n string(21) \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2450415750095041575064415c45495448410a474b49">[email&#160;protected]</a>\"\n [\"��������������絎�\"]=>\n string(0) \"\"\n [\"date\"]=>\n string(27) \"2015/03/03 Tuesday 23:59:29\"\n \n```\n\nやはり、\n\n```\n\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\n \n```\n\nのロジックを通ると値が消えていって英数字のみ通過できるようです。\n\n何故このような動きになるのか、何かひらめいたことがあったらご教授ください。\n\n======================== 以下続報2(解決!) ========================\n\nコードを以下のようにしました。\n\n```\n\n function Conv2HtmlSpecialChars($value)\n {\n if (is_array($value)) {\n foreach ($value as $k => $v) {\n $value[$k] = Conv2HtmlSpecialChars($v);\n }\n } else {\n \n $value = mb_convert_encoding($value, 'UTF-8');\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\n \n }\n return $value;\n }\n \n```\n\n要するに、\n\n`$value = htmlentities($value, ENT_QUOTES, 'UTF-8');`\n\nの関数で悩んでいたのですが、この関数すぐ上に、\n\n```\n\n $value = mb_convert_encoding($value, 'UTF-8');\n \n```\n\nを追加して値を`UTF-8`に変換するようにしました。\n\nこの方法が正しいかはよく分からないのですが、この方法で上手くロジックが動作するようになったので、結果オーライにしたいと思います。 \nもう少しキレイにコードの記述方法をまとめられたらいいのですが、現在の私の力量ではこれが精一杯です。", "comment_count": 12, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T04:27:32.260", "favorite_count": 0, "id": "7351", "last_activity_date": "2015-03-09T00:42:43.533", "last_edit_date": "2015-03-04T13:27:16.390", "last_editor_user_id": "7634", "owner_user_id": "7634", "post_type": "question", "score": 3, "tags": [ "php", "centos" ], "title": "htmlentities関数を使うと、なぜ日本語文字列が消えてしまうのか?", "view_count": 6078 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "おそらく `$dataArray` に格納されたデータの文字コードが UTF-8 以外になっています。\n\n当方環境(CentOS6,PHP5.6)で確認したところ、文字コードが UTF-8 でないものを `htmlentities()`\nに通したら空文字となりました。 \n`htmlentities()`\nの[公式ドキュメント](http://php.net/manual/ja/function.htmlentities.php)を見てみると以下のように書いてありました。\n\n> 入力文字列の中に、指定した encoding で無効な符号単位シーケンスが含まれる場合は、 ENT_IGNORE あるいは \n> ENT_SUBSTITUTE フラグが設定されていない限りは空文字列を返します。\n\nただし、`ENT_IGNORE` 定数は `PHP5.3 から、`ENT_SUBSTITUTE` 定数は PHP5.4\nから使用可能ですので、Web_beginner さんの環境では使用できません。\n\nなので、`$dataArray` のデータ (POSTされたデータでしょうか?) を UTF-8 にすると、正常にデータとして変換できると思います。\n\n* * *\n\n## 補足\n\n検証に使ったコードは以下の通りです。 \n以下のコードは UTF-8 の文字エンコーディングで記述されています。\n\n```\n\n include dirname(__FILE__).DIRECTORY_SEPARATOR.'data.php';\n \n function Conv2HtmlSpecialChars( $value )\n {\n if (is_array($value)) {\n foreach ($value as $k => $v) {\n $value[$k] = Conv2HtmlSpecialChars($v);\n }\n } else {\n $value = htmlentities($value, ENT_QUOTES);\n }\n \n return $value;\n \n } \n var_dump( Conv2HtmlSpecialChars($dataArray) );\n \n```\n\ninclude で読み込んだ `data.php` に以下の定義がしてあります。 \n`data.php` の文字エンコーディングは Shift_JIS を指定しました。\n\n```\n\n $dataArray['氏名'] = \"あいうえお\";\n $dataArray['フリガナ'] = \"アイウエオ\";\n $dataArray['郵便番号'] = \"999-9999\";\n $dataArray['住所'] = \"東京都大田区\";\n $dataArray['E-mailアドレス'] = \"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2c58495f587358495f586c49544d415c4049024f4341">[email&#160;protected]</a>\";\n $dataArray['お問い合わせ内容'] = \"お尋ねしたいことがあります\";\n \n```\n\n表示結果が、以下の通りです。 \n![文字が消えた再現のスクショ](https://i.stack.imgur.com/R8UD2.jpg)\n\ndata.php を UTF-8 に変換すると、ちゃんと表示されました。 \n![文字がちゃんと表示された再現のスクショ](https://i.stack.imgur.com/EdmES.jpg)\n\n* * *\n\n# 追記\n\nデバッグコード中の値を表示している箇所の一番最初の `Conv2HtmlSpecialChars_$v_Start` と、最後の\n`htmlentities_$value` の出力は配列ではない場合があります。\n\n`Conv2HtmlSpecialChars_$v_Start` は例でいえば \"竹田 徹夜\" だったり \"222-3333\" だったりするはずです。 \nまた、`htmlentities_$value` の値は `htmlentities()` からの返り値のはずなので、絶対に配列にはなりません。\n\nその為、誤った index のデータを表示しているような気がします。\n\nこのように配列か文字列か動的に変化してしまう変数を見る場合は \n`echo'&lt;hr />&lt;pre>Conv2HtmlSpecialChars_$v_Start --> ';var_dump( $value\n);echo'&lt;/pre>';` \nぐらいにしておいたほうが良いと思います。\n\n* * *\n\n追記2 :本回答のまとめとなります。\n\n当初回答したとおり、やはり文字化けが原因だと思われます。 \n文字化けした場合、場合によっては ASCII 制御コードなどが紛れ込んでしまう(誤って解釈されてしまう)\n可能性もあり、様々な意図しない挙動を示すことがあります。 \nなので、ここはまず文字化けしないように環境を整える必要があります。 \n(実際、私の環境では UTF-8 で揃えて以前つけたスクリーンショットのように正常にデータが表示・処理されておりますので)\n\n 1. HTML 上の form タグにて `accept-charset=\"UTF-8\"` を記述してみて頂けますでしょうか?\n 2. HTML の meta タグにて、`&lt;meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />` を指定してみてください。\n 3. PHP ファイル、HTML ファイル等、基本的にどんなファイルであれ UTF-8N (BOMなしです) で保存してください。\n 4. PHP の内部エンコーディングや出力エンコーディングを UTF-8 にしてください。 \n参考:[以前の質問 対処法 1. PHP\nの設定ファイルを変更する](https://ja.stackoverflow.com/a/7256/7926)をご覧ください\n\n以上となります。", "comment_count": 8, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T04:46:11.460", "id": "7353", "last_activity_date": "2015-03-04T01:38:37.660", "last_edit_date": "2017-04-13T12:52:38.920", "last_editor_user_id": "-1", "owner_user_id": "7926", "parent_id": "7351", "post_type": "answer", "score": 4 }, { "body": "自己解決をしたので、質問に追記した内容のコピペになりますが、以下の通り報告します。\n\nコードを以下のようにしました。\n\n```\n\n function Conv2HtmlSpecialChars($value)\n {\n if (is_array($value)) {\n foreach ($value as $k => $v) {\n $value[$k] = Conv2HtmlSpecialChars($v);\n }\n } else {\n \n $value = mb_convert_encoding($value, 'UTF-8');\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\n \n }\n return $value;\n }\n \n```\n\n要するに、\n\n```\n\n $value = htmlentities($value, ENT_QUOTES, 'UTF-8');\n \n```\n\nの関数で悩んでいたのですが、この関数すぐ上に、\n\n```\n\n $value = mb_convert_encoding($value, 'UTF-8');\n \n```\n\nを追加して値を`UTF-8`に変換するようにしました。\n\nこの方法が正しいかはよく分からないのですが、この方法で上手くロジックが動作するようになったので、結果オーライにしたいと思います。 \nもう少しキレイにコードの記述方法をまとめられたらいいのですが、現在の私の力量ではこれが精一杯です。\n\n------------------ その後の見解 ------------------ \nPHP.iniというのがあるのを知ったのですが、これを・・・\n\n```\n\n mbstring.language=Japanese\n mbstring.internal_encoding=\"UTF-8\"\n mbstring.http_output=\"UTF-8\"\n \n```\n\nというように設定しておけば済む話だったようです。 \nなんともむなしい独り相撲でした。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-09T00:42:43.533", "id": "7627", "last_activity_date": "2015-03-09T00:42:43.533", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7634", "parent_id": "7351", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7351</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7627</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7353</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1689"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7358", "answer_count": 3, "body": "あるコードで\n\n```\n\n var a:Int = _\n \n```\n\nという感じのものを見たのですが、どういう意味(定義)なんでしょうか? \n実際には 0 がはいるみたいですが。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T05:31:26.840", "favorite_count": 0, "id": "7355", "last_activity_date": "2015-03-03T06:40:34.197", "last_edit_date": "2015-03-03T06:27:07.777", "last_editor_user_id": "3466", "owner_user_id": "3466", "post_type": "question", "score": 2, "tags": [ "scala" ], "title": "アンダースコアを代入する( var a:Int = _ )の意味(定義)は?", "view_count": 691 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "初期値(デフォルト値)が入ります。Intなら0ですがStringならnull, Booleanならfalseです。\n\n```\n\n var a:Int = _\n a: Int = 0\n \n var a:String = _\n a: String = null\n \n var a:Boolean = _\n a: Boolean = false\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T05:37:09.753", "id": "7356", "last_activity_date": "2015-03-03T05:58:48.607", "last_edit_date": "2015-03-03T05:58:48.607", "last_editor_user_id": "56", "owner_user_id": "8335", "parent_id": "7355", "post_type": "answer", "score": 0 }, { "body": "`_` によって初期値を表し、その変数が未定義であることを防ぐことができます。\n\n[参考](http://www.atmarkit.co.jp/ait/articles/1203/02/news118.html)", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T05:40:07.023", "id": "7357", "last_activity_date": "2015-03-03T06:10:50.650", "last_edit_date": "2015-03-03T06:10:50.650", "last_editor_user_id": "7926", "owner_user_id": "7926", "parent_id": "7355", "post_type": "answer", "score": 0 }, { "body": "[言語仕様のVariable Declarations and Definitions](http://www.scala-\nlang.org/files/archive/spec/2.11/04-basic-declarations-and-\ndefinitions.html#variable-declarations-and-definitions \"Variable Declarations\nand Definitions\")によれば、型によって\n\n * Int -- 0\n * Long -- 0L\n * Float -- 0.0f\n * Double -- 0.0d\n * Boolean -- false\n * Unit -- ()\n * 他の型 -- null\n\nがそれぞれ代入されます。\n\n動作は 0 などを代入した場合と同じです。\n\n次のコードをコンパイルして\n\n```\n\n class A1 {\n var i: Int = _\n var l: Long = _\n var f: Float = _\n var d: Double = _\n var b: Boolean = _\n var u: Unit = _\n var o: AnyRef = _\n }\n \n class A2 {\n var i: Int = 0\n var l: Long = 0L\n var f: Float = 0.0f\n var d: Double = 0.0d\n var b: Boolean = false\n var u: Unit = ()\n var o: AnyRef = null\n }\n \n```\n\njavap -c でコンストラクタみてみると A1 は\n\n```\n\n public A1();\n Code:\n 0: aload_0\n 1: invokespecial #63 // Method java/lang/Object.\"&lt;init>\":()V\n 4: return\n \n```\n\nと代入が行われていないのに対し、A2 は\n\n```\n\n public A2();\n Code:\n 0: aload_0\n 1: invokespecial #63 // Method java/lang/Object.\"&lt;init>\":()V\n 4: aload_0\n 5: iconst_0\n 6: putfield #25 // Field i:I\n 9: aload_0\n 10: lconst_0\n 11: putfield #33 // Field l:J\n // 以下代入が続く\n \n```\n\nというように代入が行われます。\n\nバイトコード上は代入が行われず、[Java言語仕様の初期値](https://docs.oracle.com/javase/specs/jls/se5.0/html/typesValues.html#4.12.5\n\"Initial Values of Variables\") がそのまま利用されるようです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T05:42:00.730", "id": "7358", "last_activity_date": "2015-03-03T06:40:34.197", "last_edit_date": "2015-03-03T06:40:34.197", "last_editor_user_id": "455", "owner_user_id": "455", "parent_id": "7355", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7355</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7358</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7358</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1690"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "android5.0以降でDownloadListenerが呼ばれないのですが原因は何でしょうか? \n何か対策はありますでしょうか?\n\nGmailの添付ファイルをクリックした時だけ呼ばれていないみたいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T06:23:05.577", "favorite_count": 0, "id": "7362", "last_activity_date": "2015-08-03T08:32:26.043", "last_edit_date": "2015-03-06T05:51:12.640", "last_editor_user_id": "8567", "owner_user_id": "8567", "post_type": "question", "score": 2, "tags": [ "android", "java", "webview" ], "title": "WebViewのDownloadListenerについて", "view_count": 427 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "onDownloadListener というインターフェースはないので、そこが間違っていると思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T09:18:14.050", "id": "7378", "last_activity_date": "2015-03-03T09:18:14.050", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7256", "parent_id": "7362", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7362</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7378</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1691"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 2, "body": "Win8タブレットにおいて、縦スクロールバーが発生しているウィンドウをスワイプすることによってスクロールを端まで送ると、ウィンドウ自体が跳ね返る(何かにぶつかった?)ようなリアクションを取ります。\n\nこれが鬱陶しく感じてしまったため、開発中のアプリケーション(.Net4.5環境/WPF)では無効に出来るならしたいと考えております。 \n&lt;https://msdn.microsoft.com/ja-jp/library/ie/hh920761%28v=vs.85%29.aspx> \nの方にcssで制御可能な項目として\n\n> スクロールされた領域が端に達したときに跳ね返る\n\nとされていたのですがWPF、もしくはWindowsフォームにおいてこの機能を与えることは可能なのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T06:51:35.953", "favorite_count": 0, "id": "7363", "last_activity_date": "2015-03-06T08:44:23.697", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "6051", "post_type": "question", "score": 1, "tags": [ "c#", "wpf", "winforms" ], "title": "Win8タブレットのスクロールをスワイプしたときの跳ね返りの無効化", "view_count": 3173 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "端的に言うと`WndProc`で`WM_GESTURE`を無視すれば「[境界域フィードバック](https://msdn.microsoft.com/ja-\njp/library/windows/desktop/dd371416%28v=vs.85%29.aspx)」は発生しません。しかしこれだけでは全てのジェスチャが無効になってしまうので、`lParam`から`GESTUREINFO`構造体を取得して状態を確認する必要があります。\n\np/invoke.netに`GESTUREINFO`の定義が無かったので試していませんが、[MSDN](https://msdn.microsoft.com/ja-\njp/library/windows/desktop/dd562167%28v=vs.85%29.aspx)によると`GID_PAN`や`GF_BEGIN`を確認すれば判定可能のようです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T12:24:15.527", "id": "7385", "last_activity_date": "2015-03-03T12:24:15.527", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5750", "parent_id": "7363", "post_type": "answer", "score": 1 }, { "body": "単にバウンドするエフェクトを無効化してしまいたいのであれば、WPFの場合、ListBox等のManipulationBoundaryFeedbackイベントをハンドルするのが一番手っ取り早いと思われます。\n\n```\n\n public partial class MainWindow : Window\n {\n public MainWindow()\n {\n InitializeComponent();\n \n list1.ManipulationBoundaryFeedback += list1_ManipulationBoundaryFeedback;\n }\n \n void list1_ManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)\n {\n e.Handled = true;\n }\n }\n \n```\n\n参考: \nUIElement.ManipulationBoundaryFeedback イベント (System.Windows) \n&lt;https://msdn.microsoft.com/ja-\njp/library/system.windows.uielement.manipulationboundaryfeedback.aspx> \n連載:WPF入門:第10回 WPFの「入力イベントとアニメーション」を学ぼう (1/2) - @IT \n&lt;http://www.atmarkit.co.jp/ait/articles/1103/01/news124.html>", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-06T08:44:23.697", "id": "7543", "last_activity_date": "2015-03-06T08:44:23.697", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2947", "parent_id": "7363", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7363</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7543</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1692"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7373", "answer_count": 1, "body": "XcodeでiTunes Connectへアプリケーションを提出する際、Valideの段階で次のエラーが表示されました。\n\n> this bundle is invalid. \n> apps that include arm64 architecture cannot have Minimum OSversion set to\n> less than 5.1.1. \n> more information about 64-bit support for iOS is available at 64-bit\n> transition guide for cocoa touch at developer.apple.com.\n\nSDKはiOS 8.1、Deployment Targetは5.0です。\n\n64bitアーキテクチャ(iPhone 5s以降)とiOS 5向けに同時に対応することはできないのでしょうか?\n\nこれはiTunesConnectへ提出時のエラーです。\nxocdeのメニューのproductでarchiveでビルドし、そのあとに提出用のダイアログ(organizer)が表示され、そこでvalidationを押した時のチェックでエラーになりまし‌​た。\nその前までは各種シュミレータやデバイスのテストで同様のエラーは出ていません。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T07:33:56.480", "favorite_count": 0, "id": "7364", "last_activity_date": "2015-03-03T08:58:17.610", "last_edit_date": "2015-03-03T08:48:14.880", "last_editor_user_id": "3496", "owner_user_id": "3496", "post_type": "question", "score": 2, "tags": [ "ios", "xcode", "iphone" ], "title": "iOSのArchivesビルド後のvalidationでエラー。arm64とiOS5は同時にサポートできない?", "view_count": 1685 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "arm64を削除する手段が2015年2月までは合ったようですが、 \n現在その方法が通用するかどうかという問題と、arm64を削除すると当然ながら実機iPhone6などでは動作しません。 \nそれでは困るので、仕方ないのでメッセージの指示通りにGeneralの設定のDeployment\nTargetを「5.1.1」に指定(自分で書いた)しました。これでvalidationは通りました。\n\n![画像の説明をここに入力](https://i.stack.imgur.com/wtrkg.png)\n\n参考情報: [About 64-Bit Cocoa Touch\nApps](https://developer.apple.com/library/ios/documentation/General/Conceptual/CocoaTouch64BitGuide/Introduction/Introduction.html)([日本語版PDF](https://developer.apple.com/jp/documentation/CocoaTouch64BitGuide.pdf))\n\n> Xcode 5.0.1では、32ビット/64ビットのどちらにも対応したアプリケーションを構築できます。ただし、この混成バイナリが動作するのはiOS\n> 5.1.1以降です。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T08:46:54.333", "id": "7373", "last_activity_date": "2015-03-03T08:58:17.610", "last_edit_date": "2015-03-03T08:58:17.610", "last_editor_user_id": null, "owner_user_id": "3496", "parent_id": "7364", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7364</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7373</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7373</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1693"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 4, "body": "JavaScriptで変数に入っている値が文字列か文字列の配列かによって処理を分けたいです。 \n厳密に配列の中身が文字列であるかどうかまではチェックしなくて良いです。\n\n```\n\n var stringOrArray = someFunc();\n \n if (argumentIsString(stringOrArray)) {\n // 文字列が渡された時の処理\n \n } else if (argumentIsArray(stringOrArray)) {\n // 配列が渡された時の処理\n \n }\n \n```\n\n上記`argumentIsString`, `argumentIsArray`にあたる処理はどのようになりますか? \nどちらか片方がわかればもう片方は `else` でも良いですが、できれば今後の変更を見据えて文字列・配列それぞれの判定をしたいです。\n\nちなみにIE8以上の対応が必要です。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T07:46:47.997", "favorite_count": 0, "id": "7365", "last_activity_date": "2015-03-04T01:13:36.623", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "450", "post_type": "question", "score": 4, "tags": [ "javascript" ], "title": "StringかArrayかを判定したい", "view_count": 3601 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "こちらが参考になると思います。 \n[JavaScript Garden](http://bonsaiden.github.io/JavaScript-\nGarden/#types.typeof) \n[日本語訳](http://bonsaiden.github.io/JavaScript-Garden/ja/#types.typeof)\n\n```\n\n function is(type, obj) {\n var clas = Object.prototype.toString.call(obj).slice(8, -1);\n return obj !== undefined &amp;&amp; obj !== null &amp;&amp; clas === type;\n }\n \n is('String', 'test'); // true\n is('String', new String('test')); // true\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T08:00:05.240", "id": "7367", "last_activity_date": "2015-03-03T08:00:05.240", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7926", "parent_id": "7365", "post_type": "answer", "score": 5 }, { "body": "本家に同様の質問がありました \n&lt;https://stackoverflow.com/questions/1058427/how-to-detect-if-a-variable-is-\nan-array>\n\n`Array.isArray`ってIE8で使えるのかな。。。?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T08:01:15.853", "id": "7368", "last_activity_date": "2015-03-03T08:01:15.853", "last_edit_date": "2017-05-23T12:38:55.307", "last_editor_user_id": "-1", "owner_user_id": "845", "parent_id": "7365", "post_type": "answer", "score": 0 }, { "body": "あんまり汎用性はありませんが、 \nお手軽にするならこうでしょうか?\n\n```\n\n var stringOrArray = someFunc();\n \n if (typeof(stringOrArray) == \"string\" || stringOrArray instanceof String) {\n // 文字列が渡された時の処理\n } else if (stringOrArray instanceof Array) {\n // 配列が渡された時の処理\n }\n \n```\n\n[追記]\n\n既に他の回答のコメントで言及されていますが、 \nArrayやStringそのものを上書きされてしまった場合、この方法は破綻します。 \n方法は極めて単純で、判定前に\n\n```\n\n /* fooやbarの中身は適当 */\n String = foo\n Array = bar\n \n```\n\nと書かれた場合はアウトとなります。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T08:06:20.477", "id": "7369", "last_activity_date": "2015-03-04T01:13:36.623", "last_edit_date": "2015-03-04T01:13:36.623", "last_editor_user_id": "70", "owner_user_id": "70", "parent_id": "7365", "post_type": "answer", "score": 3 }, { "body": "ちょっと変わった方向として [underscore.js\nのソース](https://github.com/jashkenas/underscore/blob/044ba5c3502dfac26c1a863a62c518b91e2a255d/underscore.js#L1210-L1215)\nを見ると、`Object.prototype.toString.call(v)` して、返ってきた文字列を比較してますね。\n\n```\n\n Object.prototype.toString.call(obj) === '[object Array]'\n \n Object.prototype.toString.call(obj) === '[object String]'\n \n```\n\n# なんでこうするんだろ… `instanceof` だけで十分に思うけれども", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T16:16:27.737", "id": "7393", "last_activity_date": "2015-03-03T16:16:27.737", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "208", "parent_id": "7365", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7365</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7367</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1694"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 2, "body": "monacaでiosアプリを開発しています。 \nホームボタンを押してもバックグラウンドでアプリが動いた状態になっている様で、 \n再度アプリに戻ると、進行中だったゲームの画面に戻り、BGMも再送されます。\n\nホームボタンを押したらバックグラウンドに回らずにアプリを終了するようにするには、 \nどうすればよいのでしょうか?\n\nxcodeの場合、UIApplicationExitsOnSuspend を Info.plist に設定すると、 \nアプリが終了するようにできるようなのですが、monacaの場合どうすればよいかわかりません。 \n参考: &lt;http://d.hatena.ne.jp/paraches/20100715>\n\nCordovaのpause resumeで処理を書いてみましたが、うまくいきません。\n\nCordovaのイベント処理 \n&lt;http://docs.monaca.mobi/cur/ja/reference/phonegap_34/ja/events/events/#backbutton>\n\n解決方法を教えていただけると助かります。 \nよろしくお願いいたします。\n\niosではうまくいかなかったが、Androidのみだとうまくいった方法を下記に記します。\n\n// ホームボタンを押すとBGMが停止し、再度アプリに戻ると再送する\n\n```\n\n document.addEventListener(\"pause\", function() { audio.pause(); },false);\n document.addEventListener(\"resume\", function() { audio.play(); },false);\n \n```\n\n// ホームボタンを押すとバックグラウンドに回らずにアプリが終了\n\n```\n\n document.addEventListener(\"pause\", onPause, false);\n \n function onPause() {\n navigator.app.exitApp();\n }\n \n```\n\n// バックボタンを押すとバックグラウンドに回らずにアプリが終了\n\n```\n\n document.addEventListener(\"backbutton\", function(e){\n e.preventDefault();\n navigator.app.exitApp();\n }, false);\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T07:52:39.890", "favorite_count": 0, "id": "7366", "last_activity_date": "2015-07-09T16:34:12.170", "last_edit_date": "2015-03-04T10:05:49.660", "last_editor_user_id": "8053", "owner_user_id": "8053", "post_type": "question", "score": 3, "tags": [ "javascript", "ios", "monaca", "html5", "cordova" ], "title": "ホームボタンを押したらアプリが終了するようにしたいです", "view_count": 4135 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "MonacaやCordovaではiOSでアプリを終了させるAPIは提供されていないようですので、自分でCordovaプラグインを書いて対応する必要があると思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-11T06:11:00.277", "id": "7761", "last_activity_date": "2015-03-11T06:11:00.277", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7871", "parent_id": "7366", "post_type": "answer", "score": 3 }, { "body": "iosの場合プログラムによるアプリの強制終了はリジェクト対象になる可能性があります。アプリを終了させるのではなくゲームやBGMを止める程度にするべきです。\n\n&lt;http://ushisantoasobu.hateblo.jp/entry/2013/02/17/185403>", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-06-09T12:38:50.167", "id": "11189", "last_activity_date": "2015-06-09T12:38:50.167", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9577", "parent_id": "7366", "post_type": "answer", "score": 4 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7366</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">11189</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1695"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7507", "answer_count": 1, "body": "CentOS7 + Juno をpackstackでインストールを行いました。 \n構成は、コントローラーノード(neutronを含む)1台、コンピュートノード2台で行っています。 \nはじめにコントローラーノード台 + コンピュートノード1台の構成で行ったところ、 \nインストールから、インスタンスの起動、FloatingIPの割り当てまですべてうまくいきました。\n\n続いて、コンピュートノードを一台増設しようと思い、 \nanswerファイルの`CONFIG_COMPUTE_HOSTS`にIPアドレスを設定し、 \nすでに構築済みの一台につきましては、`EXCLUDE_SERVERS`へ退避を致しました。\n\nこの状態で、`packstack`コマンドを実行し、インストールもうまくいったのですが、 \nインスタンスの起動ができなくなってしまいました。\n\nコントローラー、コンピュートノードでログを確認すると、\n\n```\n\n NovaException: Unexpected vif_type=binding_failed\n \n```\n\nというエラーメッセージが各コンピュートノードで返ってきており起動にしているみたいです。\n\nお忙しいところ申し訳ございませんが、 \nもし、お時間があればご教授頂ければ幸いです。\n\n### 追記\n\n$ neutron agent-list -F host -F agent_type \n+--------------------+--------------------------+ \n| agent_type | host | \n+--------------------+--------------------------+ \n| Open vSwitch agent | openstack.controller | \n| L3 agent | openstack.controller | \n| Open vSwitch agent | openstack.compute001 | \n| DHCP agent | openstack.controller | \n| Metadata agent | openstack.controller | \n+--------------------+--------------------------+\n\ncomputeノードがもう一台稼働しているはずなのですが、 \nここに出てこないのはおかしいですか?\n\n## 追記\n\nOpen vSwitch agentはコンピュートノードにおいて動作しておりましたが、 \nagent-listでは表示されていません。 \n動作はしているが、コントローラーが知らないという状況なのでしょうか....\n\n## 追記\n\n現状の設定ファイルです。\n\n&lt;https://gist.github.com/tomomura/39a006413c6b390aefdd#file-gistfile2-txt>", "comment_count": 8, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T08:25:05.957", "favorite_count": 0, "id": "7371", "last_activity_date": "2015-03-06T00:16:58.320", "last_edit_date": "2015-03-05T04:14:57.777", "last_editor_user_id": "8652", "owner_user_id": "8652", "post_type": "question", "score": 1, "tags": [ "centos" ], "title": "[RDO]OpenStack構築後のインスタンス起動失敗について", "view_count": 2120 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "自己解決できました。\n\n原因は、サーバ間の時間の同期ができていなかった為です。\n\nNTPサーバを用意して、各サーバ間の時間を同期させたところ正常に動作しました。\n\nありがとうございました。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-06T00:16:58.320", "id": "7507", "last_activity_date": "2015-03-06T00:16:58.320", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8652", "parent_id": "7371", "post_type": "answer", "score": 2 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7371</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7507</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7507</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1696"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 1, "body": "InterfaceBuilderでxibファイルを「iphone-4inch」(width:320px,height:568px)でUIViewを作りました。そのViewをViewControllerでaddSubViewするのですが、どの端末でシミュレートしても4インチのサイズです。画面に合わせるにはどうすればよいでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T08:35:47.690", "favorite_count": 0, "id": "7372", "last_activity_date": "2015-03-03T09:23:11.010", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8060", "post_type": "question", "score": 0, "tags": [ "ios", "xib" ], "title": "xibファイルのViewを画面サイズに合わせるには", "view_count": 3271 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "画面全体で良いのなら、\n\n```\n\n subView.frame = self.view.frame;\n [self.view addSubView:subView];\n \n```\n\nで大丈夫だと思います。 \nsubView内のコンテンツはAutoLayoutを設定しておけば、見た目も崩れないと思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T09:23:11.010", "id": "7379", "last_activity_date": "2015-03-03T09:23:11.010", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3516", "parent_id": "7372", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7372</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7379</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1697"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": "7388", "answer_count": 1, "body": "例えば、ページ内に\n\n```\n\n あいうえお\n 単語\n かきくけこ\n 単語\n \n```\n\nとあった場合、capybaraで\n\n```\n\n expect(page).to have_content('単語')\n \n```\n\nとした場合、マッチしますがこの'単語'の数をテストすることは可能でしょうか?\n\n自分の場合、ひとつの'単語'のみ含まれていてほしいというようにしたいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T09:13:24.650", "favorite_count": 0, "id": "7377", "last_activity_date": "2015-03-03T13:52:54.627", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4971", "post_type": "question", "score": 1, "tags": [ "ruby-on-rails", "capybara" ], "title": "capybaraのhave_contentなどで、含まれていてほしい単語の数を指定したい。", "view_count": 2526 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "`expect(page).to have_content('単語', count: 1)`\n\nでいかがでしょうか?\n\nhave_xxx には引数が渡せるようです。\n\n[capybara/matchers.rb at master ·\njnicklas/capybara](https://github.com/jnicklas/capybara/blob/master/lib/capybara/node/matchers.rb#L432-L449)\n\n下記に一部を抜粋します。\n\n```\n\n # @option options [Integer] :count (nil) Number of times the text is expected to occur\n # @option options [Integer] :minimum (nil) Minimum number of times the text is expected to occur\n # @option options [Integer] :maximum (nil) Maximum number of times the text is expected to occur\n # @option options [Range] :between (nil) Range of times that is expected to contain number of times text occurs\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T13:52:54.627", "id": "7388", "last_activity_date": "2015-03-03T13:52:54.627", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7471", "parent_id": "7377", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7377</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7388</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7388</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1698"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 2, "body": "`[data-value=\"1\"]`のような要素の属性値によるセレクターでスタイルを指定しているのですが、IE8 (IE Tester使用)\nで見た時に初期状態は正しく表示されるのですが、JavaScriptからDOMの属性値を変更した際に表示が更新されません。 \n下記に簡単なサンプルを記載します。ボタンを押すたびに`data-\nvalue`属性が変わり、`Hello`の背景色が変わるはずです(IE9以降、Chrome、Firefox等では)。\n\nボタンの上からマウスを外した際に遅れて表示が更新されるようなので、単に画面の再描画ができていないというだけの不具合だと思われるのですが、この現象への対処法(属性値を変更した際にすぐ画面に反映する)をご存知の方がいましたら教えてください。\n\n```\n\n var val=0;\r\n $('#btn').click(function(){\r\n val = (val + 1) % 4;\r\n $('#aaa').attr('data-value', val);\r\n });\n```\n\n```\n\n [data-value=\"0\"]{\r\n background:cyan;\r\n }\r\n [data-value=\"1\"]{\r\n background:red;\r\n }\r\n [data-value=\"2\"]{\r\n background:green;\r\n }\r\n [data-value=\"3\"]{\r\n background:blue;\r\n }\n```\n\n```\n\n &lt;script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\">&lt;/script>\r\n &lt;div id=\"aaa\" data-value=\"0\">Hello&lt;/div>\r\n &lt;button id=\"btn\">push&lt;/button>\n```", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T12:06:30.930", "favorite_count": 0, "id": "7384", "last_activity_date": "2015-03-05T00:34:22.413", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "450", "post_type": "question", "score": 1, "tags": [ "javascript", "css", "internet-explorer" ], "title": "IE8で[attribute=\"value\"]セレクターを使用した際に、DOMの属性の変更が画面が反映されない", "view_count": 1109 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "どうもブラウザ起因の動きのようです。 \n`css()`による色変更なら動きました。\n\n```\n\n var val=0;\r\n $('#btn').click(function(){\r\n val = (val + 1) % 4;\r\n var color = \"\";\r\n switch(val){\r\n case 0: color = \"cyan\"; break;\r\n case 1: color = \"red\"; break;\r\n case 2: color = \"green\"; break;\r\n case 3: color = \"blue\"; break;\r\n }\r\n $('#aaa').css({'background': color});\r\n });\n```\n\n```\n\n #aaa{\r\n background:cyan;\r\n }\n```\n\n```\n\n &lt;script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\">&lt;/script>\r\n \r\n &lt;div id=\"aaa\" data-value=\"0\">Hello&lt;/div>\r\n &lt;button id=\"btn\">push&lt;/button>\n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-04T01:22:56.683", "id": "7401", "last_activity_date": "2015-03-05T00:34:22.413", "last_edit_date": "2015-03-05T00:34:22.413", "last_editor_user_id": "7214", "owner_user_id": "7214", "parent_id": "7384", "post_type": "answer", "score": 1 }, { "body": "本家 Stack Overflow の回答によれば、適当なCSSプロパティや class を再設定することで反映させることができるようです。\n\n[javascript - IE8 not refreshing class after attribute value change - Stack\nOverflow](https://stackoverflow.com/a/14222646/2818869)\n\n上の回答のように opacity でやるとこんな感じかと。IE11 の IE8 モードでは動作しました。\n\n```\n\n var val=0;\r\n $('#btn').click(function(){\r\n val = (val + 1) % 4;\r\n $('#aaa').attr('data-value', val).css('opacity', 1);\r\n });\n```\n\n```\n\n [data-value=\"0\"]{\r\n background:cyan;\r\n }\r\n [data-value=\"1\"]{\r\n background:red;\r\n }\r\n [data-value=\"2\"]{\r\n background:green;\r\n }\r\n [data-value=\"3\"]{\r\n background:blue;\r\n }\n```\n\n```\n\n &lt;script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\">&lt;/script>\r\n &lt;div id=\"aaa\" data-value=\"0\">Hello&lt;/div>\r\n &lt;button id=\"btn\">push&lt;/button>\n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-04T05:31:00.280", "id": "7417", "last_activity_date": "2015-03-04T05:31:00.280", "last_edit_date": "2017-05-23T12:38:55.250", "last_editor_user_id": "-1", "owner_user_id": "8000", "parent_id": "7384", "post_type": "answer", "score": 3 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7384</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7417</span></div> </div></div> </td> </tr><tr class="group cursor-pointer space-x-4 divide-x border-b outline-offset-[-2px] odd:bg-gray-50 hover:bg-gray-100 dark:odd:bg-gray-925 dark:hover:bg-gray-850 " tabindex="0" data-row-idx="1699"><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"> <div> <span class="block ">{ "accepted_answer_id": null, "answer_count": 2, "body": "googleのurl検索で'http://'や'https://'を検索する方法はありますか?\n\n`inurl:http://`として検索をかけたいのですが。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-03T12:28:17.473", "favorite_count": 0, "id": "7386", "last_activity_date": "2019-12-01T02:15:18.317", "last_edit_date": "2019-12-01T02:15:18.317", "last_editor_user_id": "32986", "owner_user_id": "5855", "post_type": "question", "score": 2, "tags": [ "google-search" ], "title": "googleで'http://'や'https://'を検索する方法", "view_count": 287 }</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="text-left" dir="auto"><div><button class="float-right ml-2 mr-0.5 mt-1 flex items-center justify-center rounded-full bg-white p-1.5 text-gray-700 ring-1 ring-gray-300 transition hover:bg-gray-50 hover:text-gray-900 hover:shadow-sm dark:bg-gray-800 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-700 dark:hover:text-white"><svg class="text-sm" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.917 2.25h-.834v.833h.834v2.084A.833.833 0 0 0 9.75 6a.833.833 0 0 0-.833.833v2.084h-.834v.833h.834c.446-.113.833-.375.833-.833V7.25a.833.833 0 0 1 .833-.833H11v-.834h-.417a.833.833 0 0 1-.833-.833V3.083a.833.833 0 0 0-.833-.833Zm-5.834 0a.833.833 0 0 0-.833.833V4.75a.833.833 0 0 1-.833.833H1v.834h.417a.833.833 0 0 1 .833.833v1.667a.833.833 0 0 0 .833.833h.834v-.833h-.834V6.833A.833.833 0 0 0 2.25 6a.833.833 0 0 0 .833-.833V3.083h.834V2.25h-.834ZM6 7.25a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm1.667 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Zm-3.334 0a.417.417 0 1 0 0 .833.417.417 0 0 0 0-.833Z" fill="currentColor"></path></svg></button> <span class="block min-h-[2rem]">[ { "body": "もし、`http`のサイトだけ検索したの場合には、\n\n```\n\n -\"https://\"\n \n```\n\nを使えば結構です。\n\n例えばhttpのFacebookを検索すると、こう成ります: \n[facebook\n-\"https://\"](https://www.google.co.jp/#q=facebook+-%22https:%2F%2F%22)", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2015-03-03T19:43:56.210", "id": "7396", "last_activity_date": "2019-12-01T02:15:07.800", "last_edit_date": "2019-12-01T02:15:07.800", "last_editor_user_id": "32986", "owner_user_id": "8229", "parent_id": "7386", "post_type": "answer", "score": 3 }, { "body": "これでどうだろう?\n\n```\n\n allinurl:https://* または allinurl:http://*\n \n```\n\nうーん。ページの後ろのほうになると「allinurlを無視した結果が必要かもしれない」とクエリオプションを無視した結果がでてきますね……。\n\nクエリオプションを無視した結果が出てくるのは、もはやどうすることも出来ないような……。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-03-04T09:15:41.177", "id": "7435", "last_activity_date": "2015-03-04T09:15:41.177", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8335", "parent_id": "7386", "post_type": "answer", "score": 1 } ]</span></div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7386</span></div> </div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"><div class="text-right text-gray-400">null</div></div></div> </td><td class="min-w-fit max-w-sm break-words p-2 "><div class="line-clamp-2 "><div class="" dir="auto"> <div> <span class="block ">7396</span></div> </div></div> </td> </tr></tbody></table> </div> <div class="bg-linear-to-b from-gray-100 to-white dark:from-gray-950 dark:to-gray-900 rounded-b-lg"><hr class="flex-none -translate-y-px border-t border-dashed border-gray-300 bg-white dark:border-gray-700 dark:bg-gray-950"> <nav><ul class="flex select-none items-center justify-between space-x-2 text-gray-700 sm:justify-center py-1 text-center font-mono text-xs "><li><a class="flex items-center rounded-lg px-2.5 py-1 hover:bg-gray-50 dark:hover:bg-gray-800 " href="/datasets/p1atdev/ja-stackoverflow/viewer/default/train?p=15"><svg class="mr-1.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M10 16L20 6l1.4 1.4l-8.6 8.6l8.6 8.6L20 26z" fill="currentColor"></path></svg> Previous</a></li> <li class="hidden sm:block"><a class="rounded-lg px-2.5 py-1 hover:bg-gray-50 dark:hover:bg-gray-800" href="/datasets/p1atdev/ja-stackoverflow/viewer/default/train?p=0">1</a> </li><li class="hidden sm:block"><a class="rounded-lg px-2.5 py-1 pointer-events-none cursor-default" href="#">...</a> </li><li class="hidden sm:block"><a class="rounded-lg px-2.5 py-1 hover:bg-gray-50 dark:hover:bg-gray-800" href="/datasets/p1atdev/ja-stackoverflow/viewer/default/train?p=14">15</a> </li><li class="hidden sm:block"><a class="rounded-lg px-2.5 py-1 hover:bg-gray-50 dark:hover:bg-gray-800" href="/datasets/p1atdev/ja-stackoverflow/viewer/default/train?p=15">16</a> </li><li class="hidden sm:block"><a class="rounded-lg px-2.5 py-1 bg-gray-50 font-semibold ring-1 ring-inset ring-gray-200 dark:bg-gray-900 dark:text-yellow-500 dark:ring-gray-900 hover:bg-gray-50 dark:hover:bg-gray-800" href="/datasets/p1atdev/ja-stackoverflow/viewer/default/train?p=16">17</a> </li><li class="hidden sm:block"><a class="rounded-lg px-2.5 py-1 hover:bg-gray-50 dark:hover:bg-gray-800" href="/datasets/p1atdev/ja-stackoverflow/viewer/default/train?p=17">18</a> </li><li class="hidden sm:block"><a class="rounded-lg px-2.5 py-1 hover:bg-gray-50 dark:hover:bg-gray-800" href="/datasets/p1atdev/ja-stackoverflow/viewer/default/train?p=18">19</a> </li><li class="hidden sm:block"><a class="rounded-lg px-2.5 py-1 pointer-events-none cursor-default" href="#">...</a> </li><li class="hidden sm:block"><a class="rounded-lg px-2.5 py-1 hover:bg-gray-50 dark:hover:bg-gray-800" href="/datasets/p1atdev/ja-stackoverflow/viewer/default/train?p=305">306</a> </li> <li><a class="flex items-center rounded-lg px-2.5 py-1 hover:bg-gray-50 dark:hover:bg-gray-800 " href="/datasets/p1atdev/ja-stackoverflow/viewer/default/train?p=17">Next <svg class="ml-1.5 transform rotate-180" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M10 16L20 6l1.4 1.4l-8.6 8.6l8.6 8.6L20 26z" fill="currentColor"></path></svg></a></li></ul></nav></div></div> </div></div></div></div></div></div></div> <div class="hidden items-center md:flex"> <div class="mx-1 flex items-center justify-center"><div class="h-8 w-1 cursor-ew-resize rounded-full bg-gray-200 hover:bg-gray-400 dark:bg-gray-700 dark:hover:bg-gray-600 max-sm:hidden" role="separator"></div></div> <div class="flex h-full flex-col" style="height: calc(100vh - 48px)"><div class="my-4 mr-4 h-full overflow-auto rounded-lg border shadow-lg dark:border-gray-800" style="width: 480px"><div class="flex h-full flex-col"><div class="flex flex-col "> <div class="px-4 md:mt-4"><div class="mb-4 flex justify-end"> <div class="flex w-full flex-col rounded-lg border-slate-200 bg-white p-2 shadow-md ring-1 ring-slate-200 dark:border-slate-700 dark:bg-slate-800 dark:ring-slate-700"> <div class="mt-0 flex items-start gap-1"><div class="flex items-center rounded-md bg-slate-100 p-2 dark:bg-slate-700"><svg class="size-4 text-gray-700 dark:text-gray-300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 11 11"><path fill="currentColor" d="M4.881 4.182c0 .101-.031.2-.087.283a.5.5 0 0 1-.242.18l-.65.217a1.3 1.3 0 0 0-.484.299 1.3 1.3 0 0 0-.298.484l-.222.639a.46.46 0 0 1-.18.242.5.5 0 0 1-.288.092.5.5 0 0 1-.294-.097.5.5 0 0 1-.175-.242l-.211-.644a1.26 1.26 0 0 0-.299-.48 1.14 1.14 0 0 0-.479-.298L.328 4.64a.48.48 0 0 1-.247-.18.515.515 0 0 1 .247-.758l.644-.21a1.28 1.28 0 0 0 .788-.789l.211-.634a.5.5 0 0 1 .165-.242.5.5 0 0 1 .283-.103.5.5 0 0 1 .294.083c.086.058.152.14.19.237l.217.659a1.28 1.28 0 0 0 .788.788l.644.222a.476.476 0 0 1 .237.18.5.5 0 0 1 .092.288"></path><path fill="currentColor" d="M10.031 7.458a.5.5 0 0 1-.098.314.5.5 0 0 1-.267.196l-.881.293c-.272.09-.519.242-.721.443a1.8 1.8 0 0 0-.443.721l-.31.876a.5.5 0 0 1-.185.263.56.56 0 0 1-.319.098.515.515 0 0 1-.515-.366l-.294-.88a1.8 1.8 0 0 0-.443-.722c-.204-.2-.45-.353-.72-.448l-.881-.288a.57.57 0 0 1-.263-.191.56.56 0 0 1-.014-.64.5.5 0 0 1 .271-.194l.886-.294A1.82 1.82 0 0 0 6.01 5.465l.293-.87a.515.515 0 0 1 .49-.377c.11 0 .219.03.314.088a.56.56 0 0 1 .206.263l.298.896a1.82 1.82 0 0 0 1.175 1.174l.875.31a.5.5 0 0 1 .263.195c.07.09.108.2.108.314"></path><path fill="currentColor" d="M7.775 1.684a.5.5 0 0 0 .088-.262.45.45 0 0 0-.088-.263.5.5 0 0 0-.21-.155L7.24.896a.5.5 0 0 1-.165-.103.5.5 0 0 1-.103-.17l-.108-.33a.5.5 0 0 0-.165-.21A.5.5 0 0 0 6.426 0a.5.5 0 0 0-.252.098.5.5 0 0 0-.145.206l-.108.32a.5.5 0 0 1-.103.17.5.5 0 0 1-.17.102L5.334 1a.45.45 0 0 0-.216.155.5.5 0 0 0-.088.262c0 .094.029.186.083.263a.5.5 0 0 0 .216.16l.32.103q.095.03.164.103a.37.37 0 0 1 .103.165l.108.319c.031.09.088.17.165.227a.56.56 0 0 0 .252.077.42.42 0 0 0 .268-.093.5.5 0 0 0 .15-.2l.113-.325a.43.43 0 0 1 .268-.268l.32-.108a.42.42 0 0 0 .215-.155"></path></svg></div> <div class="flex min-w-0 flex-1"><textarea placeholder="Ask AI to help write your query..." class="max-h-64 min-h-8 w-full resize-none overflow-y-auto border-none bg-transparent py-1 text-sm leading-6 text-slate-700 placeholder-slate-400 [scrollbar-width:thin] focus:ring-0 dark:text-slate-200 dark:placeholder-slate-400" rows="1"></textarea> </div> </div> </div></div> <div class="relative flex flex-col rounded-md bg-gray-100 pt-2 dark:bg-gray-800/50"> <div class="flex h-64 items-center justify-center "><svg class="animate-spin text-xs" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" fill="none" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 12 12"><path class="opacity-75" fill-rule="evenodd" clip-rule="evenodd" d="M6 0C2.6862 0 0 2.6862 0 6H1.8C1.8 4.88609 2.2425 3.8178 3.03015 3.03015C3.8178 2.2425 4.88609 1.8 6 1.8V0ZM12 6C12 9.3138 9.3138 12 6 12V10.2C7.11391 10.2 8.1822 9.7575 8.96985 8.96985C9.7575 8.1822 10.2 7.11391 10.2 6H12Z" fill="currentColor"></path><path class="opacity-25" fill-rule="evenodd" clip-rule="evenodd" d="M3.03015 8.96985C3.8178 9.7575 4.88609 10.2 6 10.2V12C2.6862 12 0 9.3138 0 6H1.8C1.8 7.11391 2.2425 8.1822 3.03015 8.96985ZM7.60727 2.11971C7.0977 1.90864 6.55155 1.8 6 1.8V0C9.3138 0 12 2.6862 12 6H10.2C10.2 5.44845 10.0914 4.9023 9.88029 4.39273C9.66922 3.88316 9.35985 3.42016 8.96985 3.03015C8.57984 2.64015 8.11684 2.33078 7.60727 2.11971Z" fill="currentColor"></path></svg></div></div> <div class="mt-2 flex flex-col gap-2"><div class="flex items-center justify-between max-sm:text-sm"><div class="flex w-full items-center justify-between gap-4"> <span class="flex flex-shrink-0 items-center gap-1"><span class="font-semibold">Subsets and Splits</span> <span class="inline-block "><span class="contents"><svg class="text-xs text-gray-500 dark:text-gray-400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M17 22v-8h-4v2h2v6h-3v2h8v-2h-3z" fill="currentColor"></path><path d="M16 8a1.5 1.5 0 1 0 1.5 1.5A1.5 1.5 0 0 0 16 8z" fill="currentColor"></path><path d="M16 30a14 14 0 1 1 14-14a14 14 0 0 1-14 14zm0-26a12 12 0 1 0 12 12A12 12 0 0 0 16 4z" fill="currentColor"></path></svg></span> </span> </span> <div class="ml-4 flex flex-1 items-center justify-end gap-1"> </div></div></div> <div class="flex flex-nowrap gap-1 overflow-x-auto"></div></div> <button type="button" class="btn mt-2 h-10 w-full text-sm font-semibold md:text-base" ><span class="flex items-center gap-1.5"> <span>Run Query</span> <span class="shadow-xs ml-2 hidden items-center rounded-sm border bg-white px-0.5 text-xs font-medium text-gray-700 sm:inline-flex">Ctrl+↵</span></span></button></div> <div class="flex flex-col px-2 pb-4"></div></div> <div class="mt-auto pb-4"><div class="flex justify-center"><div class="w-full sm:px-4"><div class="mb-3"><ul class="flex gap-1 text-sm "><li><button class="flex items-center whitespace-nowrap rounded-lg px-2 text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-900 dark:hover:text-gray-300">Saved Queries </button> </li><li><button class="flex items-center whitespace-nowrap rounded-lg px-2 bg-black text-white dark:bg-gray-800">Top Community Queries </button> </li></ul></div> <div class="h-48 overflow-y-auto"><div class="flex flex-col gap-2"><div class="flex h-48 flex-col items-center justify-center rounded border border-gray-200 bg-gray-50 p-4 text-center dark:border-gray-700/60 dark:bg-gray-900"><p class="mb-1 font-semibold text-gray-600 dark:text-gray-400">No community queries yet</p> <p class="max-w-xs text-xs text-gray-500 dark:text-gray-400">The top public SQL queries from the community will appear here once available.</p></div></div></div></div></div></div></div></div></div></div> </div></div></div></main> </div> <script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script> import("\/front\/build\/kube-41c4082\/index.js"); window.moonSha = "kube-41c4082\/"; window.__hf_deferred = {}; </script> <!-- Stripe --> <script> if (["hf.co", "huggingface.co"].includes(window.location.hostname)) { const script = document.createElement("script"); script.src = "https://js.stripe.com/v3/"; script.async = true; document.head.appendChild(script); } </script> </body> </html>