question
dict
answers
list
id
stringlengths
2
5
accepted_answer_id
stringlengths
2
5
popular_answer_id
stringlengths
2
5
{ "accepted_answer_id": "23268", "answer_count": 1, "body": "Unityで作成したゲームにランキングを導入しようと、面白法人カヤックさんが公開しているLobiを導入してみたのですが、iOSにコンパイルした場合のみBGMが割れたような音?すごくピッチが遅くなったような音になりました。\n\n現在導入しているプラグインをひとつずつ追加していき、確認したのでLobi導入による問題だとは特定したのですが、導入の仕方に問題があって起こった症状なのか、Lobiのバグなのかどちらかわからない状況です。\n\n新しいプロジェクト作ってただBGM流してるだけの最小構成のアプリでもなったので、 \nLobiのバグだと思いたいんですが。。。 \nこれ以上どうしたらいいかわからなかったので、質問させていただきました。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-18T10:57:38.360", "favorite_count": 0, "id": "23255", "last_activity_date": "2016-04-18T01:38:11.247", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13901", "post_type": "question", "score": 2, "tags": [ "ios", "unity3d" ], "title": "Unityで面白法人カヤックさんのLobiを使用するとBGMが割れる", "view_count": 372 }
[ { "body": "改めて回答として投稿しておきます。\n\nGithub上のLobiSDKのWikiに、各環境ごとの導入手順書が載っています。で、[iOS+Unity](https://github.com/kayac/Lobi/wiki/iOS-\nImplement-LobiRecSDK-Unity)の手順の中に、「Unity\n5での導入に関しては~」という記述があり、その[リンク先](https://github.com/kayac/Lobi/wiki/LobiSDK-\nUnity5)にこのように書かれています。\n\n> ## Unityプロジェクトの設定\n>\n> * (省略)\n> * ...
23255
23268
23268
{ "accepted_answer_id": "23260", "answer_count": 1, "body": "javaの場合、下記のような感じでOSのコマンドを実行可能なのですが、 \niosから実行する方法はあるのでしょうか。 \n#NSTaskで!と思ったのですがiosでは無理なようで…。\n\n```\n\n Runtime runtime = Runtime.getRuntime();\n Process proc = null;\n try{\n proc = runtime.exec(\"ping -c 5 www.google.com\");\n proc.waitFor();\n }catch(Exception e){}\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-18T11:19:46.357", "favorite_count": 0, "id": "23256", "last_activity_date": "2016-03-18T12:58:43.257", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12842", "post_type": "question", "score": 0, "tags": [ "ios" ], "title": "iosでOSのコマンドを実行することは可能なのでしょうか", "view_count": 1150 }
[ { "body": "できません。\n\n * shellを含む多くのOSコマンドがiOSには搭載されていません\n * 数少ない「OSコマンド」の存在するディレクトリにはアプリからアクセス出来ません\n * 何らかの実行ファイルをアプリとは別のプロセスとして起動することもできません\n\nUnix/Linux用のOSコマンドはほとんどオープンソースですから、使いたいコマンドのソースコードを入手して、ご自身のアプリの一部としてビルドし、その機能をアプリの一部として実行させる、と言うことでOSコマンドの実行内容と同じ処理をさせられるかも知れませんが、大変な手間がかかりますし、「OSのコマンドを実行」と言う言葉で語...
23256
23260
23260
{ "accepted_answer_id": "23264", "answer_count": 1, "body": "ReactJSとjQueryと[materialize](http://materializecss.com/)というjQueryを使ったフレームワークを使ったサイトを作成しています。\n\nそこで質問です。Reactにより生成されるgridにmaterializeによるgridレイアウトを使用していますが、スマホで観た時にグリッドが1カラムになってくれません。しかし、PCのブラウザ(クローム、サファリで確認)では画面幅を小さくした時に1カラム表示となります。画面が大きい場合は3カラムのグリッドです。\n\nこのようになってしまう原因としては何が考えられるでしょうか。また、ReactとjQuery(Bootstrapのようなフレームワーク)の共存は不可能なのでしょうか。react-\nbootstrapなどを使用しなければならないのでしょうか。\n\n以下にReactのコードを示します。一応jQueryがロードされた後にこのコードを実行するようにしましたが、効果ありませんでした。\n\n```\n\n (function($){\n var GridBox = React.createClass({\n loadData: function(){\n $.ajaxSetup({\n cache: false\n });\n $.getJSON(this.props.url, function(json){\n this.setState({data: json});\n }.bind(this));\n },\n getInitialState: function(){\n return {data: {\n \"items\": []\n }};\n },\n componentDidMount: function(){\n this.loadData();\n },\n render: function(){\n var rows = this.state.data.items.map(function(row){\n return (\n <Row data={row}/>\n );\n });\n return (\n <div>\n <h5>{this.state.data.title}</h5>\n {rows}\n </div>\n );\n }\n });\n \n var Row = React.createClass({\n render: function(item){\n var items = this.props.data.map(function(item){\n return (\n <Col item={item}/>\n );\n });\n return (\n <div className=\"row\">\n {items}\n </div>\n );\n }\n });\n \n var Col = React.createClass({\n render: function(){\n var imageURL = \"dist/images/\" + this.props.item.thumbnail;\n return (\n <div className=\"col s12 m4\">\n <div className=\"card\">\n <div className=\"card-image waves-effect waves-block waves-teal\">\n <a href={this.props.item.url} target=\"_blank\">\n <img src={imageURL} className=\"lazy\"/>\n </a>\n </div>\n <div className=\"card-content\">\n <p>{this.props.item.name}</p>\n </div>\n </div>\n </div>\n );\n }\n });\n \n \n ReactDOM.render(\n <GridBox url=\"data/item.json\"/>,\n document.getElementById('item')\n );\n \n \n })(jQuery);\n \n```\n\nまたこのコードはjsxでコンパイルしたあとでgulpにより、他のJavaScriptファイルと一緒にminify,uglifyして1つのJavaScriptにしてロードしています。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-18T14:52:40.730", "favorite_count": 0, "id": "23263", "last_activity_date": "2016-03-18T18:47:28.877", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7232", "post_type": "question", "score": 1, "tags": [ "javascript", "jquery", "reactjs" ], "title": "ReactjsとjQueryフレームワークを同時に使うには", "view_count": 825 }
[ { "body": "[このスレではtaylorさんが述べているように](https://stackoverflow.com/a/33044103/1167750)、この問題は[`viewport`](https://developer.mozilla.org/ja/docs/Mobile/Viewport_meta_tag)のことに関連していると私は思います。`meta`タグの`viewport`が使用されていない時は、スマホのブラウザはPCのブラウザのように振る舞うのです。\n\n下記のコード例のように、`viewport`を[使用すると](https://developer.mozilla.org/ja/doc...
23263
23264
23264
{ "accepted_answer_id": "24798", "answer_count": 1, "body": "iOSアプリ側 [ViewController.swift]\n\n```\n\n override func viewDidLoad() {\n super.viewDidLoad()\n \n let udForWatch = NSUserDefaults(suiteName: SuiteName)!\n let ary = [\"テスト\",\"テスト\"]\n \n udForWatch.setObject(ary, forKey: \"ary\")\n }\n \n```\n\nWatch Extension側 [InterfaceController.swift]\n\n```\n\n class InterfaceController: WKInterfaceController {\n \n \n override func awakeWithContext(context: AnyObject?) {\n super.awakeWithContext(context)\n \n let ud = NSUserDefaults(suiteName: SuiteName)!\n print(ud.objectForKey(\"ary\")) //nilになる。\n \n }\n }\n \n```\n\nとしているのですが、Watch Extension側のデータがnilになってしまいます。 \n何がおかしいのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-18T18:18:23.100", "favorite_count": 0, "id": "23266", "last_activity_date": "2016-05-12T12:33:07.223", "last_edit_date": "2016-03-19T03:55:40.770", "last_editor_user_id": "12297", "owner_user_id": "12297", "post_type": "question", "score": 0, "tags": [ "swift" ], "title": "watchOS2で、Watch Extension側に、iOSアプリ側からNSUserDefaults経由で、データが渡ってこない。", "view_count": 131 }
[ { "body": "watchOS2ではWatchConnectivityを使用する必要があります。上記のコードはいわゆるwatchOS1でしか使うことができません。\n\nこちらでその原因が述べられていますが、watchOS1ではiPhoneでExtensionが動作していましたが、watchOS2からはApple\nWatchで動作するようになったためです。 \n<http://qiita.com/koogawa/items/432b9c65035b6ba17c8b#3-app-\ngroups%E3%81%A7%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E5%85%B1%E6%...
23266
24798
24798
{ "accepted_answer_id": "23870", "answer_count": 1, "body": "Babelで特定の機能だけ有効にすることはできるのでしょうか?\n\narrow\nfunctionはすでに実装されているのでそちらを使い、classはまだ実装されていないのでbabelで変換する、というふうにESの機能ごとにbabelのon,\noffを切り替えることはできるのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-19T07:22:12.237", "favorite_count": 0, "id": "23271", "last_activity_date": "2018-09-28T22:33:54.707", "last_edit_date": "2018-09-28T22:33:54.707", "last_editor_user_id": "19110", "owner_user_id": "5246", "post_type": "question", "score": 2, "tags": [ "javascript", "babeljs" ], "title": "JavaScriptのBabelで特定の機能だけ有効にする", "view_count": 185 }
[ { "body": "最新のBabel(6.7.5\nで確認)ではプロジェクトのディレクトリに作成する`.babelrc`で設定する方法が[推奨されています](https://github.com/thejameskyle/babel-\nhandbook/blob/master/translations/en/user-handbook.md#toc-babelrc)。 \n必要な物だけ`presets`や`plugins`に指定します。 \n\n```\n\n {\n \"presets\": [\n ],\n \"plugins\": [\n ...
23271
23870
23870
{ "accepted_answer_id": "23277", "answer_count": 2, "body": "BEMでのクラス名のつけ方を確認して頂きたいのですが、下記でクラス名のつけ方全般に問題はないでしょうか?\n\n(簡易なBEMなので、すべては引き継がずという形を目指しています。) \nタグも間違ってなさそうでしょうか? \nいろいろな方の意見が聞きたいです。\n\n・ソース\n\n```\n\n <div class=\"wrap-skew1 first-section-skew1\">\n <div class=\"wrap-skew2 first-section-skew2\">\n <div class=\"wrap-inner\">\n <section class=section multicolumn \">\n <div class=\"content-wrap translate3d-to-upper-left \">\n <h2 id=\"js-about-me \" class=\"heading-primary \">ABOUT&nbsp;&nbsp;ME</h2>\n <p class=\"paragraph-oneline \">あああああああああああああああああああああああああああああああああああ</p>\n <p>いいいいいいいいいいいいいいいいいいいいいいいいいい。</p>\n </div><!-- /.contents-wrap -->\n <div class=\"img-wrap translate3d-lower-right \">\n <img class=\"my-image \" src=\"img/index/myimage.png \" alt=\"自身の写真 \">\n </div>\n </section><!-- /#about -->\n </div>\n </div>\n </div>\n \n```\n\n```\n\n 下記はinnerにするべきなのでしょうか?\n innerは中身ということですがいまいちはっきりしません。\n <section class=section-wrap multicolumn\">\n <div class=\"content-wrap translate3d-to-upper-left\">\n \n```\n\n・下記が実際の見た目です。 \n<https://jsfiddle.net/80od313c/24/>\n\n```\n\n $(function(){\r\n // 下記をクリックすると実行される\r\n $('#drawermenu, .overlay-haikeikurokari, .link-block, .showMenue, .modal-button-wrap').on('click', function() {\r\n // 下記の要素のセレクタにactiveクラスが足される。.modal-button-wrap__button.activeとなるので、.modal-button-wrap__buttonのみで良い。\r\n $('.modal-button-wrap__button').toggleClass('active');\r\n }); \r\n });\r\n \r\n $('.modal-button-wrap__button,.link-block').click(function(){\r\n //ulをクリックすると、メニューが出たり戻ったりする\r\n $('#drawermenu').toggleClass('showMenue');//モーダルのクラスを削除して、モーダルボディーを戻す\r\n });\r\n $('#drawermenu li').click(function(){\r\n //ulをクリックすると、メニューが出たり戻ったりする\r\n $('#drawermenu').toggleClass('showMenue');//モーダルのクラスを削除して、モーダルボディーを戻す\r\n });\r\n $(document).on('click', '.overlay-haikeikurokari, #js-drwar-action ,.showMenue', function(){ \r\n //.メニューが出る必要はなく、戻る動きだけ必要な場合\r\n $('#drawermenu').removeClass('showMenue');//モーダルのクラスを削除して、モーダルボディーを戻す\r\n });\r\n \r\n <!-- drawermenu-blackbackground -->\r\n $('.modal-button-wrap').click(function(){\r\n //透明の背景、オーバーレイのhtmlを作る\r\n $('body').append('<div class=\"overlay-haikeikurokari\"></div>');\r\n //透明の背景、オーバーレイをフェードイン\r\n $('.overlay-haikeikurokari').fadeIn('slow');\r\n //ここをクリックすると黒い背景がフェードアウト\r\n $('.overlay-haikeikurokari, .close, #drawermenu, .link-block ,.showMenue, .modal-button-wrap__button').click(function(){\r\n //透明の背景をフェードアウト\r\n $('.overlay-haikeikurokari').fadeOut('slow');\r\n // 透明の背景オーバーレイはフェードアウトしてから削除\r\n $('.overlay-haikeikurokari').fadeOut('slow', function(){\r\n $('.overlay-haikeikurokari').remove();\r\n });\r\n });\r\n });\n```\n\n```\n\n /* ---------------------------------------------------------\r\n MainContent-First\r\n ----------------------------------------------------------*/\r\n /* メインコンテンツの背景共通 */\r\n main {\r\n font-size: 1.6rem;\r\n }\r\n \r\n .wrap-skew1 {\r\n transform: skewY(-6deg);\r\n margin: 0px auto 10%;\r\n padding: 0px;\r\n background: rgba( 229, 228, 255, 0.9 );\r\n /*other-pattern*/\r\n /*background: rgba( 229, 228, 255, 0.7 );*/\r\n /*background: linear-gradient(to left bottom, rgba(0, 255, 255, 0.6), rgba(0, 0, 255, 0.6) 15%, rgba(0, 255, 255, 0.6) 33%, rgba(0, 0, 255, 0.6) 49%, rgba(0, 255, 255, 0.6) 67%, rgba(0, 0, 255, 0.6) 84%, rgba(0, 255, 255, 0.6));*/\r\n text-align: left;\r\n }\r\n \r\n @media (min-width: 640px) { \r\n .wrap-skew1 {\r\n transform: skewY(-5deg);\r\n } \r\n }\r\n \r\n @media (min-width: 960px) { \r\n .wrap-skew1 {\r\n transform: skewY(-3.5deg);\r\n margin: 0px auto 5%;\r\n } \r\n }\r\n \r\n .wrap-skew2 {\r\n transform: skewY(6deg);\r\n width: 100%;\r\n margin: 0px auto;\r\n padding: 0px;\r\n background: rgba( 190, 250, 255, 0.6 );\r\n /*background: linear-gradient(to left bottom, rgba(0, 255, 255, 0.1), rgba(0, 0, 255, 0.1) 15%, rgba(0, 255, 255, 0.1) 33%, rgba(0, 0, 255, 0.1) 49%, rgba(0, 255, 255, 0.1) 67%, rgba(0, 0, 255, 0.1) 84%, rgba(0, 255, 255, 0.1));*/\r\n }\r\n \r\n @media (min-width: 640px) { \r\n .wrap-skew2 {\r\n transform: skewY(5deg);\r\n } \r\n }\r\n \r\n @media (min-width: 960px) { \r\n .wrap-skew2 {\r\n transform: skewY(3.5deg);\r\n } \r\n }\r\n \r\n /* メインコンテンツのパッディング */\r\n .wrap-content {\r\n padding: 15% 8%;\r\n transform: skewY(0deg);\r\n }\r\n \r\n @media (min-width: 640px) { \r\n .wrap-content {\r\n padding: 11% 11%;\r\n } \r\n }\r\n \r\n @media (min-width: 960px) { \r\n .wrap-content {\r\n padding: 9% 11%;\r\n } \r\n }\r\n /* /メインコンテンツのパッディング */\r\n \r\n /* メインコンテンツの背景 */\r\n .first-section-skew1 {\r\n margin-top: 5%;\r\n padding: 0px;\r\n }\r\n \r\n /* 見出しの共通クラス */\r\n .common-heading {\r\n font-size: 2.8rem;\r\n text-shadow: \r\n 1px 1px rgba(0, 0, 0, .2),\r\n 2px 2px rgba(0, 0, 0, .1),\r\n 3px 3px rgba(0, 0, 0, .1),\r\n 4px 4px rgba(0, 0, 0, .05),\r\n 5px 5px rgba(0, 0, 0, .05),\r\n 6px 6px rgba(0, 0, 0, .05);\r\n }\r\n \r\n \r\n \r\n /* ---------------------------------------------------------\r\n Inquery\r\n ----------------------------------------------------------*/\r\n .inquiry {\r\n position: relative;\r\n padding: 34rem 0 35.5rem 0;\r\n width : 100%;\r\n background: url(../img/common-img/inquery-back.png) no-repeat;\r\n background-position: center center;\r\n background-size: cover;\r\n }\r\n \r\n @media (min-width: 960px) { \r\n .inquiry {\r\n padding: 53rem 0 28rem 0;\r\n } \r\n }\r\n \r\n /*入力フォーム一覧の位地*/\r\n .inquiry-wrap {\r\n position: absolute;\r\n top: 7.6%;\r\n left: 8%;\r\n }\r\n \r\n @media (min-width: 640px) { \r\n .inquiry-wrap {\r\n top: 7.6%;\r\n left: 11%;\r\n } \r\n }\r\n \r\n @media (min-width: 960px) { \r\n .inquiry-wrap {\r\n position: absolute;\r\n top: 10.3%;\r\n left: 11%;\r\n } \r\n }\r\n \r\n .inquiry__heading {\r\n text-shadow: \r\n 1px 1px rgba(0, 0, 0, .2),\r\n 2px 2px rgba(0, 0, 0, .1),\r\n 3px 3px rgba(0, 0, 0, .1),\r\n 4px 4px rgba(0, 0, 0, .05),\r\n 5px 5px rgba(0, 0, 0, .05),\r\n 6px 6px rgba(0, 0, 0, .05)\r\n ;\r\n }\r\n \r\n .inquiry__heading,.inquiry-form dt {\r\n color: white;\r\n }\r\n \r\n .inquiry-form dt {\r\n text-shadow:\r\n 0px 0px 10px #fff,\r\n 0px 0px 10px #fff,\r\n 0px 0px 10px #fff,\r\n 0px 0px 10px #fff,\r\n 0px 0px 10px #fff,\r\n 0px 0px 10px #fff,\r\n 0px 0px 10px #fff,\r\n 0px 0px 10px #fff,\r\n 0px 0px 10px #fff,\r\n 2px 2px 2px rgba(0,0,0,.9);\r\n color: #000;\r\n font-weight: bold;\r\n }\r\n \r\n /*フォーム~ボタンまでの横幅、行間一括指定、個人情報ボックス以外*/\r\n .inquiry-form__input-box input,#inquiry-form_body,.inquiry__submit-btn {\r\n width: 90%;\r\n line-height: 2;\r\n border-style: none;/*選択時の枠線を無くす*/\r\n }\r\n \r\n @media (min-width: 960px) { \r\n .inquiry-form__input-box input,#inquiry-form_body,.inquiry__submit-btn {\r\n width: 40%;\r\n } \r\n }\r\n \r\n .inquiry-form__input-box,.inquiry-form__input-box_kind_textarea {\r\n opacity: 0.7;\r\n }\r\n \r\n .inquiry-form__input-box {\r\n margin-bottom: 1rem;\r\n }\r\n \r\n .inquiry-form__input-box_kind_textarea #inquiry-form_body {\r\n margin-bottom: 2rem;\r\n resize: horizontal;/*横のみリサイズ可能*/\r\n }\r\n \r\n #inquiry-form_body {\r\n height: 5rem;\r\n }\r\n \r\n @media (min-width: 960px) { \r\n #inquiry-form_body {\r\n height: 10rem;\r\n } \r\n }\r\n \r\n .privacy {\r\n border: 0.1rem solid #03AFFF;\r\n width: 78%;\r\n padding: 2.3rem 3rem 0 3rem;\r\n height: 12rem;\r\n line-height: 2;\r\n overflow-y: scroll;\r\n background: #fff;\r\n opacity: 0.7;\r\n }\r\n \r\n @media (min-width: 960px) { \r\n .privacy {\r\n width: 37%;\r\n } \r\n }\r\n \r\n .inquiry__submit-btn {\r\n display: block;\r\n margin-top: 4rem;\r\n height: 5.5rem;\r\n background: rgb(0, 239, 123);\r\n color: #fff;\r\n font-size: 2.7rem;\r\n font-weight: bold;\r\n letter-spacing: 2px;\r\n line-height: 5.5rem;\r\n text-align: center;\r\n text-shadow: 1px 1px 0px #000,\r\n -1px 1px 0px #000,\r\n 1px -1px 0px #000,\r\n -1px -1px 0px #000;\r\n box-shadow: 2px 2px 2px rgba(0,0,0,.9);\r\n }\r\n \r\n \r\n \r\n /* ---------------------------------------------------------\r\n Footer\r\n ----------------------------------------------------------*/\r\n .footer-common {\r\n padding: 8% 10%;\r\n box-shadow: 0rem 0.6rem 0.6rem -0.6rem rgba(0,0,0,0.9) inset; \r\n text-align: center;\r\n font-size: 1.6rem;\r\n behavior: url(./plugin/PIE.htc);\r\n /*background: transparent linear-gradient(to right bottom, rgba(0, 255, 255, 0.2), rgba(0, 0, 255, 0.2) 15%, rgba(0, 255, 255, 0.2) 33%, rgba(0, 0, 255, 0.2) 49%, rgba(0, 255, 255, 0.2) 67%, rgba(0, 0, 255, 0.2) 84%, rgba(0, 255, 255, 0.2)) repeat scroll 0% 0%;*/\r\n background: transparent linear-gradient(to right bottom, rgba(0, 255, 255, 0.4), rgba(0, 0, 255, 0.4) 15%, rgba(0, 255, 255, 0.4) 33%, rgba(0, 0, 255, 0.4) 49%, rgba(0, 255, 255, 0.4) 67%, rgba(0, 0, 255, 0.4) 84%, rgba(0, 255, 255, 0.4)) repeat scroll 0% 0%; \r\n /*background: transparent linear-gradient(to right bottom, rgba(0, 255, 255, 1), rgba(0, 0, 255, 1) 15%, rgba(0, 255, 255, 1) 33%, rgba(0, 0, 255, 1) 49%, rgba(0, 255, 255, 1) 67%, rgba(0, 0, 255, 1) 84%, rgba(0, 255, 255, 1)) repeat scroll 0% 0%;*/\r\n /*background-image: linear-gradient(to right, rgb(52, 152, 219) 25%, rgb(41, 128, 185) 100%);*/\r\n /*-pie-background: linear-gradient(#8Fd537, #6Fb517);*/\r\n }\r\n \r\n @media (min-width: 960px) {\r\n .footer-common {\r\n padding: 6% 10%;\r\n box-shadow: 0rem 0.6rem 0.6rem -0.6rem rgba(0,0,0,0.9) inset; \r\n }\r\n }\r\n \r\n @media (min-width: 960px) {\r\n .footer-common {\r\n padding: 3.5% 10%;\r\n box-shadow: 0rem 0.6rem 0.6rem -0.6rem rgba(0,0,0,0.9) inset; \r\n }\r\n }\r\n \r\n /* address */\r\n .address {\r\n display: inline;\r\n font-size: 1.8rem;\r\n text-shadow: 1px 1px 1px rgba(0,0,0,.9);\r\n line-height: 1.5;/* Social-buttonとアドレスの間の隙間 */\r\n }\r\n \r\n @media (min-width: 640px) {\r\n .address {\r\n font-size: 2.5rem;\r\n }\r\n }\r\n \r\n @media (min-width: 960px) {\r\n .address {\r\n font-size: 2.7rem;\r\n }\r\n }\r\n \r\n /* ボタンやアドレスの色-はヘッダーと共通なのでヘッダーにある */\r\n .address__tel,.address__mail {\r\n color: #00ff8a;\r\n }\r\n /* address */\r\n \r\n /* Social-buttonのWEBfontの共通CSSはheaderにある */\r\n \r\n .social-btn {\r\n display: inline; \r\n line-height: .9;/* Social-buttonとアドレスの間の隙間 */\r\n text-shadow: .1rem .1rem .2rem rgba(0,0,0,.9);\r\n }\r\n /* /Social-button */\r\n \r\n /* gototop-footer */\r\n [id=\"gototop\"] i,[id=\"gototop\"] a:visited {\r\n font-size: 7rem!important;\r\n text-shadow: .1rem .1rem .2rem rgba(0,0,0,.9);\r\n color: #00bbff;\r\n }\r\n \r\n @media (min-width: 960px) {\r\n [id=\"gototop\"] {\r\n width: 9rem;\r\n margin: auto;\r\n }\r\n }\r\n \r\n [id=\"gototop\"] i,[id=\"gototop\"] a:visited {\r\n font-size: 7rem!important;\r\n text-shadow: .1rem .1rem .2rem rgba(0,0,0,.9);\r\n color: #00bbff;\r\n }\r\n \r\n @media (min-width: 960px) {\r\n [id=\"gototop\"] i,[id=\"gototop\"] a:visited {\r\n font-size: 9rem!important;\r\n text-shadow: .1rem .1rem .2rem rgba(0,0,0,.9);\r\n }\r\n }\r\n \r\n \r\n \r\n \r\n /* 左から出てくるdrawer-menu */\r\n [id=\"drawermenu\"] {\r\n z-index: 300;\r\n width: 100%;\r\n height: 100%;\r\n position: fixed;\r\n top: 0;\r\n overflow-y: hidden;\r\n padding-top: 0rem;\r\n text-align: center;\r\n cursor: pointer;\r\n margin-left: -100%;\r\n transition-propety:all;\r\n transition-duration:1s;\r\n }\r\n \r\n @media (min-width: 960px) {\r\n [id=\"drawermenu\"] {\r\n padding-top: 2.8rem;\r\n } \r\n }\r\n \r\n [id=\"drawermenu\"] ul {\r\n overflow-y: scroll;\r\n overflow-x: scroll;\r\n width: 105%;/* 横のスクロールバーをはみ出して、上記のhiddenで隠す */\r\n height: 101%;/* 下のスクロールバー */\r\n }\r\n \r\n [id=\"drawermenu\"] li {\r\n margin-bottom: 0.2rem;\r\n background: rgba( 229, 228, 255, 0.3 ); \r\n }\r\n \r\n [id=\"drawermenu\"] li a {\r\n height: 6rem;\r\n line-height: 6rem;\r\n margin: 0 auto;\r\n color: #fff;\r\n font-size: 2rem;\r\n text-decoration: none;\r\n text-shadow: 1px 1px 1px rgba(0,0,0,.9);\r\n }\r\n \r\n @media (min-width: 960px) {\r\n [id=\"drawermenu\"] li a {\r\n font-size: 2.5rem;\r\n }\r\n }\r\n \r\n .link-block {\r\n display: block;\r\n z-index: 99999;\r\n }\r\n \r\n /* .modal-button-wrap__buttonをクリックした際に加えられる */\r\n .showMenue {\r\n margin-left: 0%;\r\n }\r\n /* /.modal-button-wrap__buttonをクリックした際に加えられる */\r\n /* 左から出てくるdrawer-menu */\r\n \r\n /* modalwindow-button-white-threeborder */\r\n /*モーダルウィンドウのボタンの囲い*/\r\n .modal-button-wrap {\r\n position: fixed;\r\n top: 2%;\r\n right: 3%;\r\n z-index: 9999;\r\n }\r\n \r\n @media (min-width: 960px) {\r\n .modal-button-wrap {\r\n top: 5%;\r\n right: 5%;\r\n } \r\n }\r\n \r\n /*モーダルウィンドウのボタン*/\r\n /* shadow */\r\n .modal-button-wrap__border {\r\n box-shadow: 0 0.2rem 0.2rem rgba(0,0,0,.9);\r\n }\r\n /* /shadow */\r\n \r\n .modal-button-wrap__button,\r\n .modal-button-wrap__button span,.overlay-haikeikurokari {\r\n display: inline-block;\r\n transition: all .4s;\r\n box-sizing: border-box;\r\n }\r\n \r\n /*button-size*/\r\n .modal-button-wrap__button,.overlay-haikeikurokari {\r\n position: relative;\r\n width: 5rem;\r\n height: 4.4rem;\r\n }\r\n /* /button-size */\r\n \r\n .modal-button-wrap__button span,.overlay-haikeikurokari span {\r\n position: absolute;\r\n left: 0;\r\n width: 100%;\r\n height: 4px;\r\n background-color: #fff;\r\n border-radius: 4px;\r\n }\r\n \r\n /* threewhiteline */\r\n .modal-button-wrap__button span:nth-of-type(1) {\r\n top: 0;\r\n }\r\n .modal-button-wrap__button span:nth-of-type(2) {\r\n top: 20px;\r\n }\r\n .modal-button-wrap__button span:nth-of-type(3) {\r\n bottom: 0;\r\n }\r\n /* /threewhiteline */\r\n \r\n /*drawermenuのボタンのアニメーション*/\r\n .modal-button-wrap__button.active span:nth-of-type(1) {\r\n -webkit-transform: translateY(20px) rotate(-315deg);\r\n transform: translateY(20px) rotate(-315deg);\r\n }\r\n \r\n .modal-button-wrap__button.active span:nth-of-type(2) {\r\n opacity: 0;\r\n }\r\n \r\n .modal-button-wrap__button.active span:nth-of-type(3) {\r\n -webkit-transform: translateY(-20px) rotate(315deg);\r\n transform: translateY(-20px) rotate(315deg);\r\n }\r\n \r\n /* drawermenu-overlay-半透明のグレーバック */\r\n /* lightbox-overlay-半透明のグレーバックは別のcss(.overlay) */ \r\n .overlay-haikeikurokari {\r\n z-index: 100;\r\n display:none;\r\n position:fixed;\r\n top:0;\r\n left:0;\r\n width:100%;\r\n height:100%;\r\n background-color:rgba(0,0,0,.4);\r\n transition: all 3.3s;\r\n }\r\n \r\n .drawermenu__social-btn {\r\n font-size: 6.5rem!important; \r\n }\r\n \r\n .drawermenu__material-icons {\r\n font-size: 7rem; \r\n }\r\n \r\n .material-icons_large {\r\n font-size: 8rem;\r\n line-height: 0.75;\r\n }\r\n /* /drawermenu */\r\n \r\n /*Reset Stylesheet*/\r\n /* \r\n html5doctor.com Reset Stylesheet\r\n v1.6.1\r\n Last Updated: 2010-09-17\r\n Author: Richard Clark - http://richclarkdesign.com \r\n Twitter: @rich_clark\r\n */\r\n \r\n html, body, div, span, object, iframe,\r\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\r\n abbr, address, cite, code,\r\n del, dfn, em, img, ins, kbd, q, samp,\r\n small, strong, sub, sup, var,\r\n b, i,\r\n dl, dt, dd, ol, ul, li,\r\n fieldset, form, label, legend,\r\n table, caption, tbody, tfoot, thead, tr, th, td,\r\n article, aside, canvas, details, figcaption, figure, \r\n footer, header, hgroup, menu, nav, section, summary,\r\n time, mark, audio, video {\r\n margin:0;\r\n padding:0;\r\n border:0;\r\n outline:0;\r\n font-size:100%;\r\n vertical-align:baseline;\r\n background:transparent;\r\n }\r\n \r\n body {\r\n line-height:1;\r\n }\r\n \r\n article,aside,details,figcaption,figure,\r\n footer,header,hgroup,menu,nav,section { \r\n display:block;\r\n }\r\n \r\n ul {\r\n list-style:none;\r\n }\r\n \r\n blockquote, q {\r\n quotes:none;\r\n }\r\n \r\n blockquote:before, blockquote:after,\r\n q:before, q:after {\r\n content:'';\r\n content:none;\r\n }\r\n \r\n a {\r\n margin:0;\r\n padding:0;\r\n font-size:100%;\r\n vertical-align:baseline;\r\n background:transparent;\r\n text-decoration: none;\r\n }\r\n \r\n /* change colours to suit your needs */\r\n ins {\r\n background-color:#ff9;\r\n color:#000;\r\n text-decoration:none;\r\n }\r\n \r\n /* change colours to suit your needs */\r\n mark {\r\n background-color:#ff9;\r\n color:#000; \r\n font-style:italic;\r\n font-weight:bold;\r\n }\r\n \r\n del {\r\n text-decoration: line-through;\r\n }\r\n \r\n abbr[title], dfn[title] {\r\n border-bottom:1px dotted;\r\n cursor:help;\r\n }\r\n \r\n table {\r\n border-collapse:collapse;\r\n border-spacing:0;\r\n }\r\n \r\n /* change border colour to suit your needs */\r\n hr {\r\n display:block;\r\n height:1px;\r\n border:0; \r\n border-top:1px solid #cccccc;\r\n margin:1em 0;\r\n padding:0;\r\n }\r\n \r\n input, select {\r\n vertical-align:middle;\r\n }\n```\n\n```\n\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js\"></script>\r\n <div class=\"wrap-skew1 first-section-skew1\">\r\n <div class=\"wrap-skew2 first-section-skew2\">\r\n <div class=\"wrap-content\"> \r\n <section class=\"section-wrap multicolumn\">\r\n <div class=\"content-wrap translate3d-to-upper-left\">\r\n <h2 id=\"js-about-me\" class=\"heading-primary\">ABOUT&nbsp;&nbsp;ME</h2>\r\n <p class=\"paragraph-oneline\">あああああああああああああああああああああああああああああああああああ</p>\r\n <p>いいいいいいいいいいいいいいいいいいいいいいいいいい。</p>\r\n </div><!-- /.contents-wrap -->\r\n <div class=\"img-wrap translate3d-lower-right\">\r\n <img class=\"my-image\" src=\"img/index/myimage.png\" alt=\"自身の写真\">\r\n </div>\r\n </section><!-- /#about -->\r\n </div>\r\n </div>\r\n </div>\r\n \r\n \r\n \r\n \r\n <!-- drawermenu -->\r\n <nav>\r\n <div id=\"drawermenu\">\r\n <ul>\r\n <li class=\"link-block\">\r\n <a class='header__social-btn drawermenu__social-btn symbol animation-hover action-hover' href=\"https://plus.google.com/share?url=\" onclick=\"window.open(this.href, 'Gwindow', 'width=650, height=450, menubar=no, toolbar=no, scrollbars=yes'); return false;\" title='&#xe039;'></a>\r\n \r\n <a class='header__social-btn drawermenu__social-btn symbol animation-hover action-hover' href=\"http://www.facebook.com/share.php?u=\" onclick=\"window.open(this.href, 'FBwindow', 'width=650, height=450, menubar=no, toolbar=no, scrollbars=yes'); return false;\" title='&#xe027;'></a>\r\n \r\n <a class='header__social-btn drawermenu__social-btn symbol animation-hover action-hover' href=\"http://twitter.com/share?url=\" title='&#xe086;'></a> \r\n </li>\r\n <li><a class=\"link-block action-hover animation-hover\" href=\"#js-about-me\">ABOUTME</a></li>\r\n <li><a class=\"link-block action-hover animation-hover\" href=\"#js-gallary\">GALLARY</a></li>\r\n <li><a class=\"link-block action-hover animation-hover\" href=\"#js-gmap\">MAP</a></li>\r\n <li><a class=\"link-block action-hover animation-hover\" href=\"#js-inquiry\">CONTACT</a></li>\r\n <li id=\"js-drwar-action\"><a class=\"link-block drawermenu__gototop action-hover animation-hover\" href=\"#top\"><i class=\"material-icons material-icons_large action-hover animation-hover\">&#xE5CE;</i></a></li>\r\n <li><a class=\"link-block action-hover animation-hover\" href=\"\">TOPPAGE</a></li>\r\n <li><a class=\"link-block action-hover animation-hover\" href=\"\">BLOG</a></li>\r\n </ul>\r\n </div>\r\n </nav>\r\n <!-- /drawermenu -->\r\n \r\n \r\n \r\n <!-- drawermenu-button -->\r\n <div class=\"modal-button-wrap\">\r\n <a class=\"animation-hover action-hover modal-button-wrap__button kuruttosuru\">\r\n <span class=\"modal-button-wrap__border\"></span><!-- border -->\r\n <span class=\"modal-button-wrap__border\"></span><!-- border -->\r\n <span class=\"modal-button-wrap__border\"></span><!-- border -->\r\n </a>\r\n </div>\n```\n\nまた、BEMのclass名は「Block_key_value」で表します。とあるのですが、 \nkeyがvalue=色が赤=color_redということでしょうか? \n主語と目的語ということでしょうか? \nよくわかりません。\n\n<https://app.codegrid.net/entry/bem-basic-1>", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2016-03-19T07:43:12.830", "favorite_count": 0, "id": "23273", "last_activity_date": "2019-12-13T19:28:55.703", "last_edit_date": "2019-12-13T19:28:55.703", "last_editor_user_id": "32986", "owner_user_id": "14320", "post_type": "question", "score": 0, "tags": [ "css" ], "title": "BEMでのクラス名のつけ方を確認して頂きたいのですが、下記でクラス名のつけ方全般に問題はないでしょうか?", "view_count": 1588 }
[ { "body": "コメントする前にサンプルコードを修正しておきますね。\n\n```\n\n <div class=\"wrap-skew1 first-section-skew1\">\n <div class=\"wrap-skew2 first-section-skew2\">\n <div class=\"wrap-inner\">\n <section class=\"section multicolumn\">\n <div class=\"content-wrap translate3d-to-upper-left\">\n ...
23273
23277
23277
{ "accepted_answer_id": null, "answer_count": 1, "body": "swift2で日記アプリを作っています。\n\nアプリにApp ExtensionsのShare Extensionを追加したのですが、勘違いしていてやりたいことと違ったので削除したいです。\n\nこの場合、Targetのところと、追加されたフォルダを普通に削除するだけで良いのでしょうか。 \n何か他の部分で削除しないといけないものや、何かの設定を戻す等の操作が必要でしたら教えていただきたいです。\n\nよろしくお願いします。\n\n補足 \n他の質問サービスでも質問させていただきましたが、解決できなかったので質問させていただきます。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-19T10:15:39.240", "favorite_count": 0, "id": "23274", "last_activity_date": "2016-04-19T04:02:12.680", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10791", "post_type": "question", "score": 0, "tags": [ "swift", "xcode" ], "title": "shareExtensionの削除の仕方", "view_count": 105 }
[ { "body": "他サイトで教えていただき解決しました。 \n普通に消すだけで問題ありませんでした。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-20T03:06:47.150", "id": "23289", "last_activity_date": "2016-03-20T03:06:47.150", "last_edit_date": null, "last_editor_user_id": null, "owner_u...
23274
null
23289
{ "accepted_answer_id": null, "answer_count": 1, "body": "まず以下のようにして、 \nベクトルxとベクトルyの角度を計算する関数を書きます。\n\n```\n\n import numpy as np\n \n def angle(x, y):\n \n dot_xy = np.dot(x, y)\n norm_x = np.linalg.norm(x)\n norm_y = np.linalg.norm(y)\n cos = dot_xy / (norm_x*norm_y)\n rad = np.arccos(cos)\n theta = rad * 180 / np.pi\n \n return theta\n \n```\n\n次にこの関数を用いて、 \n以下のベクトルxとベクトルyの角度を計算します。\n\n```\n\n x = np.array([1, 0, 1])\n y = np.array([1, 1, 1])\n print angle(x, y)\n \n```\n\nこの結果はもちろん、45.0となります。\n\nここで、上記のベクトルxと以下のベクトルzの角度を計算します。\n\n```\n\n z = np.array([1, -1, 1])\n print angle(x, z)\n \n```\n\nこの場合ももちろん、上記と同じ角度である45.0が出力されます。\n\nしかしここで、 \nxとyで計算した時を「正の方向」とした上で、 \nxとzの角度は45.0ではなく、315.0と出力したいです。\n\nnumpyではどのようにすれば、 \nベクトルの向きを固定して角度を計算することができるでしょうか?\n\nよろしくお願いします。", "comment_count": 6, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-19T10:25:29.407", "favorite_count": 0, "id": "23275", "last_activity_date": "2016-04-18T13:46:17.893", "last_edit_date": "2016-03-19T11:12:06.470", "last_editor_user_id": "12874", "owner_user_id": "12874", "post_type": "question", "score": 3, "tags": [ "python", "numpy" ], "title": "numpyでベクトルの向きを考慮して2つのベクトル間の角度を計算したい", "view_count": 11307 }
[ { "body": "コメントを頂いた通り、符号の判定で解決できる問題でした。 \nお手数をおかけしました。ありがとうございます。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-19T11:14:40.157", "id": "23276", "last_activity_date": "2016-03-19T11:14:40.157", "last_edit_date": null, "last_editor_user_id": null,...
23275
null
23276
{ "accepted_answer_id": "23287", "answer_count": 2, "body": "PythonでのPyMySQLに関してですが、テーブルからユーザー名を取得する関数を作ったのですが、そのユーザーをmysqlから消しても、関数が返す値が同じです。何がいけないのでしょうか?\n\n以下が作った関数です\n\n```\n\n import sys\n import time\n import pymysql\n \n conn = pymysql.connect(host='localhost',\n user='user',\n password='password',\n db='database',\n charset='utf8')\n \n def get_user():\n cursor = conn.cursor()\n query = \"\"\"SELECT username FROM users WHERE username=testuser\"\"\"\n cursor.execute(query)\n result = cursor.fetchone()[0]\n cursor.close()\n return result\n \n \n def worker():\n try:\n while True:\n time.sleep(1)\n print(get_user())\n except KeyboardInterrupt:\n print(\"Stopeed\")\n \n \n if __name__ == '__main__':\n worker()\n \n```\n\ntestuserを消した後、get_user()を実行すると、テーブルには存在しないのに返ってきてます。なぜでしょうか?\n\nよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-19T12:07:57.310", "favorite_count": 0, "id": "23278", "last_activity_date": "2016-03-22T23:34:42.080", "last_edit_date": "2016-03-21T10:29:20.943", "last_editor_user_id": "3054", "owner_user_id": "14857", "post_type": "question", "score": 5, "tags": [ "python", "mysql" ], "title": "PyMySQLでの問合せ結果がテーブルデータ変更後も変化しない", "view_count": 2234 }
[ { "body": "コードを一目で見ると、一つの問題は`'`のマークのことにあると思います。特に、この行:\n\n```\n\n >>> testuser = \"me\"\n >>> query = 'SELECT username FROM users WHERE username='testuser''\n \n```\n\nこの関数を実行すると、`SyntaxError`が発生するでしょう。例えば:\n\n```\n\n >>> query = 'SELECT username FROM users WHERE username='testuser''\n File \"<...
23278
23287
23328
{ "accepted_answer_id": "23283", "answer_count": 2, "body": "```\n\n ary1 = [[2, 5, 9], [5, 5, 6], [2, 6, 8], [2, 5, 7]]\n ary2 = [[2, 9, 5], [5, 6, 5], [8, 6, 2], [7, 2, 5]]\n \n # 最大値の小さい順\n p ary1.sort{|a, b| a.max <=> b.max}\n p ary2.sort{|a, b| a.max <=> b.max}\n p ''\n # 最大値の大きい順\n p ary1.sort{|a, b| b.max <=> a.max}\n p ary2.sort{|a, b| b.max <=> a.max}\n p ''\n # 最小値の小さい順\n p ary1.sort{|a, b| a.min <=> b.min}\n p ary2.sort{|a, b| a.min <=> b.min}\n p ''\n # 最小値の大きい順\n p ary1.sort{|a, b| b.min <=> a.min}\n p ary2.sort{|a, b| b.min <=> a.min}\n \n```\n\n出力結果 \n[[5, 5, 6], [2, 5, 7], [2, 6, 8], [2, 5, 9]] \n[[5, 6, 5], [7, 2, 5], [8, 6, 2], [2, 9, 5]] \n\"\" \n[[2, 5, 9], [2, 6, 8], [2, 5, 7], [5, 5, 6]] \n[[2, 9, 5], [8, 6, 2], [7, 2, 5], [5, 6, 5]] \n\"\" \n[[2, 5, 9], [2, 5, 7], [2, 6, 8], [5, 5, 6]] \n[[2, 9, 5], [7, 2, 5], [8, 6, 2], [5, 6, 5]] \n\"\" \n[[5, 5, 6], [2, 6, 8], [2, 5, 9], [2, 5, 7]] \n[[5, 6, 5], [8, 6, 2], [2, 9, 5], [7, 2, 5]]\n\n四つ目が(たまたまかもしれませんが)[2, 6, 8], [2, 5, 9], [2, 5, 7]の順となっているのに、 \n三つめが[2, 5, 9], [2, 5, 7], [2, 6, 8]の順となっています。\n\nそこで質問なのですが、 \nブロックの部分を \na.min <=> b.min \nから \nb.min <=> a.min \nと逆にしても得られる結果は \nちょうど逆の並びにならない理由を教えてください。 \nまた、三つめの例で \n**最小値が同じ場合は、次に小さいもの同士を比べ、小さい順に並べ \nさらに同じ場合は、その次に小さいもの同士を比べ、小さい順に並べる** \nようにするにはどうすればいいですか?\n\n(追記) \n三つめの例を \n**最小値が同じ場合は、次に小さいもの同士を比べ、小さい順に並べ \nさらに同じ場合は、その次に小さいもの同士を比べ、小さい順に並べる** \nようにする簡単な方法はあるようですが、 \n一つ目の例を \n**最大値が同じ場合は、次に大きいもの同士を比べ、小さい順に並べ \nさらに同じ場合は、その次に大きいもの同士を比べ、小さい順に並べる** \nまた二つ目の例を \n**最大値が同じ場合は、次に大きいもの同士を比べ、大きい順に並べ \nさらに同じ場合は、その次に大きいもの同士を比べ、大きい順に並べる** \nさらに四つ目の例を \n**最小値が同じ場合は、次に小さいもの同士を比べ、大きい順に並べ \nさらに同じ場合は、その次に小さいもの同士を比べ、大きい順に並べる** \nようにする簡単な方法はあるのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-19T13:50:57.350", "favorite_count": 0, "id": "23279", "last_activity_date": "2016-03-20T15:49:56.267", "last_edit_date": "2016-03-19T17:33:35.300", "last_editor_user_id": "5363", "owner_user_id": "5363", "post_type": "question", "score": 1, "tags": [ "ruby" ], "title": "配列を最大値の小さい順、大きい順や最小値の小さい順、大きい順に並べ変えたときの結果について", "view_count": 971 }
[ { "body": "_ちょうど逆の並びにならない理由を教えてください。_ \nsortに用いられるアルゴリズムによってはキーに用いる値が同点と判定された場合の結果の並びが元の順序からは容易に判定できないものがあります。 \n(Wikipediaの[ソート](https://ja.wikipedia.org/wiki/%E3%82%BD%E3%83%BC%E3%83%88)や[安定ソート](https://ja.wikipedia.org/wiki/%E5%AE%89%E5%AE%9A%E3%82%BD%E3%83%BC%E3%83%88)などを参照してください。) \nrubyのsortメソッドでは、非安定ソ...
23279
23283
23280
{ "accepted_answer_id": null, "answer_count": 1, "body": "数年前に組んだCのコンパイルが通らなくなってしまい困っています。 \nどうやら、\n\n```\n\n #include \"mbctype.h\"\n #include \"stdafx.h\"\n \n```\n\nのコンパイルが通らないようです。\n\nこちらの2つは使うのに何か条件があるのでしょうか?\n\nよろしくおねがいします。\n\n* * *\n\nコメントによるとエラーメッセージは\n\n```\n\n $ gcc a.c\n a.c:3:10: fatal error: 'mbctype.h' file not found\n #include <mbctype.h>\n ^\n 1 error generated.\n \n```\n\nとのこと。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-19T16:10:02.883", "favorite_count": 0, "id": "23281", "last_activity_date": "2016-03-21T00:58:33.770", "last_edit_date": "2016-03-21T00:58:33.770", "last_editor_user_id": "4236", "owner_user_id": "8823", "post_type": "question", "score": -3, "tags": [ "c" ], "title": "\"mbctype.h\", \"stdafx.h\" のコンパイルが通らない", "view_count": 1754 }
[ { "body": "> コンパイルが通らない\n\nであれば質問文にエラーメッセージを加えるべきですし、そのエラーメッセージで検索し原因を探るべきです。\n\n以下は質問文から読み取れる問題について言及しますが、真の問題が何であるかはこの回答ではなくエラーメッセージを確認してください。\n\n* * *\n\n[`#include`ディレクティブ](https://msdn.microsoft.com/ja-\njp/library/36k2cdd4\\(v=vs.120\\).aspx)には`引用符形式`と`山かっこ形式`があり意味が異なります。その上で[`<mbctype.h>`は`_mbbtype`関数](h...
23281
null
23285
{ "accepted_answer_id": null, "answer_count": 2, "body": "**実行環境**\n\n```\n\n $ ruby -v\n ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]\n \n $ rails -v\n Rails 4.2.6\n \n```\n\n環境変数を定義する Gem として有名な [config](https://github.com/railsconfig/config) を使用しています\n\n`bundle install` で config をインストールして\n\n```\n\n $ rails g config:install\n create config/initializers/rails_config.rb\n create config/settings.yml\n create config/settings.local.yml\n create config/settings\n create config/settings/development.yml\n create config/settings/production.yml\n create config/settings/test.yml\n append .gitignore\n \n```\n\nを実行し環境変数を書いておく yml ファイルを作成しました \nしかし\n\n```\n\n $ vi config/settings.yml\n twitter:\n follow_target_name: 'mossmoss'\n text: 'mossmossmossmossmoss'\n url : 'http://mossmossmossmossmoss.com/'\n \n```\n\nとして環境変数を取得しようとすると `nil` となっていまいます\n\n```\n\n $ rails c\n > Settings.twitter\n => nil\n > Settings\n => #<Config::Options> \n \n```\n\nドキュメント通りにやったのですがなぜ どこかで環境変数の取得方法が間違っているのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-19T23:00:19.933", "favorite_count": 0, "id": "23286", "last_activity_date": "2016-11-02T17:15:10.667", "last_edit_date": "2016-03-19T23:06:05.803", "last_editor_user_id": "5505", "owner_user_id": "5505", "post_type": "question", "score": 2, "tags": [ "ruby-on-rails" ], "title": "rails_config の環境変数が反映されない", "view_count": 3826 }
[ { "body": "直接の質問の回答ではないのですが、[dotenv](https://github.com/bkeepers/dotenv)というgemもありまして、私はいつもそれを使っているのですが、環境変数をrails内に設定するということであればそちらを使ってもできると思います。 \n`.env`という名前のファイルを使って、シェル変数のように環境変数にしたい情報を設定するだけです。\n\n```\n\n S3_BUCKET=YOURS3BUCKET\n SECRET_KEY=YOURSECRETKEYGOESHERE\n \n```\n\nこの設定が済むと、railsプロジェクトのどこ...
23286
null
23309
{ "accepted_answer_id": null, "answer_count": 3, "body": "AdMobを導入するためにGoogleMobileAdsフレームワークをプロジェクトに追加しViewControllerに\n\n```\n\n @import GoogleMobileAds;\n \n```\n\nと記述したところ Use of '@import' when modules are disabled というエラーが出てしまいます。\n\n調べてみたところ Enable Modules(C and C-Objective-C) を NO から YES\nにすればエラーが消えると書いてあったので試してみましたがエラーは消えず。\n\n他に考えられる原因は何でしょうか?アドバイスいただけると助かります。", "comment_count": 5, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-20T02:34:06.417", "favorite_count": 0, "id": "23288", "last_activity_date": "2023-02-27T08:31:16.240", "last_edit_date": "2016-03-20T04:58:29.960", "last_editor_user_id": "76", "owner_user_id": "14860", "post_type": "question", "score": 0, "tags": [ "objective-c", "admob" ], "title": "エラー Use of '@import' when modules are disabled", "view_count": 2453 }
[ { "body": "Objctive-Cなら、 \n`@import <GoogleMobileAds>`または`@import\n\"GoogleMobileAds\"`なのではないでしょうか?投稿時の記述ミスでしたら済みません。\n\nそれ以外には、左側のファイルインスペクターでプロジェクトを選択、メインビューのビルドセッティングで、Build Phasesをクリック、Link\nBinary With Librariesに該当フレームワークが含まれているか確認してみてください。", "comment_count": 2, "content_license": "CC BY-SA 3.0", ...
23288
null
23319
{ "accepted_answer_id": "23296", "answer_count": 1, "body": "# 前提・実現したいこと\n\nrails+capybara(+Poltergeist)でスクレイピングをしようとしています。 \naタグをクリックして次のページに移動する動きしようとしているのですがうまく動きません。\n\n# 発生している問題・エラーメッセージ\n\n```\n\n Failures:\n \n 1) test next20\n Failure/Error: click_on \"次の20件\"\n \n Capybara::ElementNotFound:\n Unable to find link or button \"次の20件\"\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/node/finders.rb:43:in `block in find'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/node/base.rb:84:in `synchronize'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/node/finders.rb:32:in `find'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/node/actions.rb:13:in `click_link_or_button'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/session.rb:686:in `block (2 levels) in <class:Session>'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'\n # ./test3.rb:30:in `block (3 levels) in <top (required)>'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/session.rb:290:in `within'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'\n # ./test3.rb:28:in `block (2 levels) in <top (required)>'\n \n Finished in 7.06 seconds (files took 0.4783 seconds to load)\n 1 example, 1 failure\n \n Failed examples:\n \n```\n\n# ソースコード(test3.rb)\n\n```\n\n require 'capybara/rspec' \n require 'capybara/poltergeist' \n require 'capybara/dsl'\n \n Capybara.javascript_driver = :poltergeist \n Capybara.register_driver :poltergeist do |app| \n Capybara::Poltergeist::Driver.new(app, { \n js_errors: false, \n timeout: 1000, \n debug: true, \n phantomjs_options: [ \n '--load-images=no', \n '--ignore-ssl-errors=yes', \n '--ssl-protocol=any']}) \n end\n \n Capybara.configure do |config| \n config.run_server = false \n config.default_driver = :poltergeist \n config.app_host = 'http://www.mansion-review.jp/prefecture/20.html' \n end\n \n describe \"test\", :type => :feature do \n subject{ page } \n before { visit('/') }\n \n it \"next20\", js: true do \n within ('#saleHistorySoubaBlock') do \n have_text \"次の20件\" \n click_on \"次の20件\" \n end \n end \n end\n \n```\n\n# 補足情報\n\n * capybara (2.6.2)\n * globalid (0.3.6)\n * rails (4.2.6)\n * rspec-rails (3.4.2)\n\n# 追記\n\n広く意見を求めたい為,Stack Overflowとteratailにて同様の質問をしております。 \n解決しましたら、両方にて共有したいと思いますので、ご容赦ください。\n\n* * *\n\nコメントは改行できないのですね、教えていただきありがとうございます。 \nエラーメッセージが若干違うようですので、貼っておきます。\n\n# エラーメッセージ\n\n```\n\n Failures:\n \n 1) test next20\n Failure/Error: click_on \"次の20件\"\n \n Capybara::ElementNotFound:\n Unable to find link or button \"次の20件\"\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/node/finders.rb:43:in `block in find'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/node/base.rb:84:in `synchronize'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/node/finders.rb:32:in `find'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/node/actions.rb:13:in `click_link_or_button'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/session.rb:686:in `block (2 levels) in <class:Session>'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'\n # ./test3.rb:31:in `block (4 levels) in <top (required)>'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/session.rb:290:in `within'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'\n # ./test3.rb:29:in `block (3 levels) in <top (required)>'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/session.rb:290:in `within'\n # ~/vendor/bundler/ruby/2.3.0/gems/capybara-2.6.2/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'\n # ./test3.rb:28:in `block (2 levels) in <top (required)>'\n \n Finished in 7.67 seconds (files took 1.44 seconds to load)\n 1 example, 1 failure\n \n Failed examples:\n \n```\n\n# 修正部分\n\n```\n\n describe \"test\", :type => :feature do\n subject{ page }\n before { visit('/') }\n \n it \"next20\", js: true do\n within first('#resultBlock div p') do\n within all('a').last do\n should have_text '次の20件'\n click_on \"次の20件\"\n end\n end\n end\n end\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-20T03:47:12.763", "favorite_count": 0, "id": "23290", "last_activity_date": "2016-03-22T05:15:12.873", "last_edit_date": "2016-03-22T04:42:07.757", "last_editor_user_id": "8000", "owner_user_id": "14858", "post_type": "question", "score": 1, "tags": [ "ruby-on-rails", "ruby", "capybara", "phantomjs", "poltergeist" ], "title": "capybara(+ Poltergeist)でaタグがclick_on出来ない", "view_count": 2498 }
[ { "body": "そのページをブラウザで見てみましたが、エラーメッセージの通り、 `#saleHistorySoubaBlock` の中に `次の20件`\nはありません。というか、`#saleHistorySoubaBlock` は空っぽの `<div>` ですね。\n\nそれなら `click_on` じゃなくて `have_text`\nでエラーになりそうですが、これは「対象が指定した文字列を含むかどうかを検査するMatcher」を返すメソッドで、呼びだしただけでは何も起きません。RSpecの\n`should` や `expect(...).to` に渡して初めて実際の検査が行われます。\n\n例えば次の...
23290
23296
23296
{ "accepted_answer_id": "23362", "answer_count": 3, "body": "下記のソースコードは、marqueeで動いている文字の方向に応じて、その『方向指示ボタン』の \n矢印を\"赤\"に,反対側の矢印を\"白\"になるように設定したものです。 \nこの動いている方向の矢印を\"赤\"で示すのでなく、\"点滅\"で示すようにするには、どのように \n書き換えればいいでしょうか。ご教示ください。\n\n```\n\n <SCRIPT>\n \n function marLeft(){\n document.getElementById(\"blinkL\").style.color=\"red\";\n document.getElementById(\"blinkR\").style.color=\"white\";\n }\n function marRight(){\n document.getElementById(\"blinkR\").style.color=\"red\";\n document.getElementById(\"blinkL\").style.color=\"white\";\n }\n \n \n flg=false;\n function Stop_Start(){\n flg = !flg;\n document.myForm.stopStart.value=flg?\"START\":\"STOP\";\n if(flg) {\n document.getElementById(\"myMarquee\").stop();\n } else {\n document.getElementById(\"myMarquee\").start();\n }\n }\n </script>\n \n \n <marquee id=\"myMarquee\">TTTTT</marquee>\n <br><br>\n <form id=\"marFunction\" name=\"myForm\" style=\"text-align:center;\">\n <INPUT id=\"blinkL\" type=\"button\" style=\"color:red; background: black;\" onclick=\"myMarquee.direction='left'; marLeft();\" value=\"←\"> \n ☆\n <input type=\"button\" name=\"stopStart\" value=\" STOP \" onClick=\"Stop_Start()\">\n ☆\n <INPUT id=\"blinkR\" type=\"button\" style=\"color:white; background: black;\" onclick=\"myMarquee.direction='right'; marRight();\" value=\"→\"> \n </form>\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-20T05:03:43.507", "favorite_count": 0, "id": "23291", "last_activity_date": "2019-12-13T19:27:05.827", "last_edit_date": "2016-03-20T14:42:38.410", "last_editor_user_id": "9359", "owner_user_id": "9359", "post_type": "question", "score": -2, "tags": [ "javascript", "html" ], "title": "marqueeで動いている文字の方向に応じて、その『方向指示ボタン』の矢印を、\"点滅\"で示すようにするには", "view_count": 235 }
[ { "body": "専門的には分かりませんが、一応以下のようにすれば機能します。 \nただ、\"stop\"と\"start\"を切り替える『トグルボタン』ではうまくいきませんので、 \n普通の『ストップ』ボタンにしました。 \nまた、矢印のボタンを連打すると、その連打した回数だけ反対側の矢印のボタンを \n押さないと、正常な状態に戻らない点が難点です。\n\n```\n\n <html>\n <head>\n <title>ボタンのラベルを点滅させます</title>\n \n <script language=\"JavaScript\">\n <!--\...
23291
23362
23312
{ "accepted_answer_id": "23300", "answer_count": 1, "body": "現在MYSQLをソースからインストールしており、 \n今回、MYSQLにSSLで接続する必要が出てきたためmysqlを以下の手順で再インストールしようと考えております。 \nこの場合現在あるデータベースのデータに影響はありますでしょうか?\n\n```\n\n cd /usr/loca/src/mysql-5.7.11\n ; -DWITH_SSL=yesを追加\n cmake . -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_SSL=bundled -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/src/boost_1_60_0/boost -DWITH_SSL=yes\n make\n porg -lD \"make install\"\n```\n\nmy.cnfに以下を追加※httpdで使用しているssl証明書を使用する\n\n```\n\n [mysqld]\n ssl-ca = /opt/httpd/httpd-2.4.18/conf/ssl.crt/server-ca.crt\n ssl-cert = /opt/httpd/httpd-2.4.18/conf/ssl.crt/server.crt\n ssl-key = /opt/httpd/httpd-2.4.18/conf/ssl.key/server.key\n```\n\n```\n\n service mysqld restart\n```\n\nssl適応確認 \n\n```\n\n mysql -u root -p -e \"show variables like '%ssl%'\"\n```\n\n```\n\n cat /proc/version\n Linux version 2.6.32-573.12.1.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ) #1 SMP Tue Dec 15 21:19:08 UTC 2015\n mysql --version\n mysql Ver 14.14 Distrib 5.7.11, for Linux (x86_64) using EditLine wrapper\n \n```\n\n宜しくお願い致します。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-20T05:50:09.037", "favorite_count": 0, "id": "23292", "last_activity_date": "2016-03-20T12:43:10.937", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14864", "post_type": "question", "score": 0, "tags": [ "mysql" ], "title": "MYSQLの再インストール", "view_count": 270 }
[ { "body": "SSL関連以外に全く変更がないのであれば、影響はありません。\n\nただし、自分でソースコードからビルドしているとその「全く変更がない」事を保証できるかという話になってきますので、念のためデータベースのフルバックアップを取得しておくこと、作業前後のデータの整合性の確認方法、バックアップからのリカバリ方法を検討しておくことをお勧めします。\n\nまた、どうしても必要が無い限りソースコードからのビルドではなく、MySQL公式かディストリビュータが提供しているバイナリパッケージを利用されることも検討した方がよいでしょう。", "comment_count": 0, "content_l...
23292
23300
23300
{ "accepted_answer_id": null, "answer_count": 1, "body": "こんにちは。\n\n早速質問ですが、Macで「IntelliJ、バージョン15」にウェブサーバ(Tomcat 8.0) \n設定の際、1099ポートが使えません。\n\nコンソールに出力されるメッセージは下記のようです。\n\n> ”Application Server was not connected before run configuration \n> stop,reason: Unable to ping server at localhost:1099”\n\nちなみにStack Overflowから少し調べ、試したのが下記のようです。\n\n①/etc/hostsでホスト名を設定。 \n②自分のMacでホスト名を設定する。\n\n追記します。 \netc/hosts \n127.0.0.1 localhost\n\nマックに設定されているホスト名 : localhost \nJAVAはバージョン8です。\n\n上記処理を行った後、ウェブサーバーを再起動してみましたが結果はダメでした。\n\n宜しくお願いします。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-20T06:32:54.903", "favorite_count": 0, "id": "23294", "last_activity_date": "2016-05-10T09:11:19.567", "last_edit_date": "2016-03-23T17:01:23.487", "last_editor_user_id": "14882", "owner_user_id": "14865", "post_type": "question", "score": 0, "tags": [ "macos", "tomcat", "intellij-idea" ], "title": "IntelliJにTomcat設定の際、ポート1099エラー", "view_count": 496 }
[ { "body": "自分で解決した履歴です。\n\nIntelliJのjava設定にて、システムのJVMとして \nロードされるように変更して解決しました。\n\nIDE全体的な設定とproject設定を両方変更。\n\n(既存設定はIntelliJ基本のJVMでした。 \nおそらく、JVMのpath問題だったと思います。)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-04-09T05:57:51.953", "id": "23867", "last_act...
23294
null
23867
{ "accepted_answer_id": null, "answer_count": 1, "body": "Unity5.3を使って、AdMobを実装しようと思っています。 \niOSデバイスでは上手く機能しているのですが、Androidではコンパイルエラーになってしまいます。\n\nやったことは、 \n(1) AdMob管理画面からAndroid用のユニットIDを取得して広告を表示したいソースにコピー \n(2) AdMob Unityプラグインをプロジェクトにインポート \n(3) Android SDKにインストールされているgoogle-play-\nservices_libをAssets/Plugins/Android/配下にコピー\n\nCommandInvokationFailure: Failed to re-package resources. See the Console for\ndetails.\n\n似たようなエラーについての質問とその回答は幾つか見つけることができましたが、解決には至りませんでした(情報が古いためかもしれません)。\n\nAndroid上でAdMobを実装するためには、上記の手順以外にも何か必要な点があるのでしょうか? \nご教示いただけると幸いです。\n\nよろしくお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-20T07:23:25.840", "favorite_count": 0, "id": "23295", "last_activity_date": "2016-09-11T12:27:09.473", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13138", "post_type": "question", "score": 0, "tags": [ "unity3d", "admob" ], "title": "UnityでのAdMob実装について", "view_count": 728 }
[ { "body": "Assets\\PlayServicesResolver\\Editor にある AdMobDependencies.cs の中に\n\nsvcSupport.DependOn(\"com.android.support\", \"appcompat-v7\", \"23.1.0+\");\n\nと記述されている箇所を\n\nsvcSupport.DependOn(\"com.android.support\", \"appcompat-v7\", \"LATEST\");\n\nと書き替えたら、私の場合はうまくいきました。", "comment_count": 3, "cont...
23295
null
23377
{ "accepted_answer_id": "23428", "answer_count": 1, "body": "現在、monacaとniftymbaasを使用してプッシュ通知が使えるアプリを作成しています。 \nプログラムは作成済みなのですが、デバッグビルドをする際のiosビルド設定で困っております。 \niOS dev centerでprovisioning\nfile、証明書の取得をして秘密鍵とCSRのインポートまではうまくいったんですが、証明書のアップロードでこれはデペロッパーの証明書ではないですよと言うようなエラーが出てしまい先に進めません。何度も証明書を取得し試しているのですが同じエラーが出てしまいます。 \nmonacaの設定の問題でしょうか? \nそれとも証明書の取得がうまくいってないんでしょうか?\n\nどなたかわかる方ご教授お願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-20T08:32:30.717", "favorite_count": 0, "id": "23297", "last_activity_date": "2016-03-24T15:41:51.980", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13685", "post_type": "question", "score": 3, "tags": [ "ios", "monaca" ], "title": "monacaとniftymbaasを使用して、iOS でプッシュ通知を実装したい。", "view_count": 500 }
[ { "body": "wakuさん、こんにちは。 \n恐らく自分がはまったのと同じ個所かと思われますのでお助けになれば。。。\n\nデバッグビルドをする際の、[iOSのビルド設定]でアップロードする証明書は、 \nApple developerログイン \n→Member Center \n→Certificates, Identifiers & Profiles \n→Certificates \n→Development \n→iOS App Development \nこれです。\n\n自分は、「プッシュ通知をするんだから…」と思い込み \nCertificates \n→Developme...
23297
23428
23428
{ "accepted_answer_id": null, "answer_count": 1, "body": "生徒の教育のため `Github` で サイトのレポジトリを公開し、サーバーサイドのソースコードが生徒や第三者に見えるようにしたいです。 \n`Ruby on Rails`\n実装したウェブサイトのレポジトリを公開していて、実際にブラウザでアクセスできるサイトは検索などでもみつからなかったのですが、そもそもウェブサイトのサーバーサイドのソースコードを公開することは一般的にはあるんでしょうか?\n\nそしてサーバーサイドのソースコードを公開して全世界からのアクセスを許可した場合、どのような危険が考えられるのでしょうか?\n\nサーバーサイドの実装が丸見えになるので攻撃者などにも格好の餌食になるのではないかと思っていますが、サーバーサイド・エンジニアリングの教育のため広く第三者にみえるようにしたいんです。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-20T09:39:33.917", "favorite_count": 0, "id": "23299", "last_activity_date": "2016-03-21T00:03:14.407", "last_edit_date": "2016-03-20T13:19:50.997", "last_editor_user_id": "5505", "owner_user_id": "5505", "post_type": "question", "score": -1, "tags": [ "security" ], "title": "オープンソースでサーバーサイドのソースコードを公開することはどのような危険があるんでしょうか?", "view_count": 823 }
[ { "body": "> そもそもウェブサイトのサーバーサイドのソースコードを公開することは一般的にはあるんでしょうか?\n\nあります。複数人でそのウェブサイトを開発し運用していく上で、ソースコードを共有することは重要になります。その共有場所としてソースコードがオープンな状況になってしまう場所を選択することも多いです。GithubのPublicリポジトリが代表例ですね。また、WordPressなどのインストールして使うようなソフトウェアも同様です。\n\n> サーバーサイドのソースコードを公開して全世界からのアクセスを許可した場合、どのような危険が考えられるのでしょうか?\n\n結局のところ、「守りたいことは何か?...
23299
null
23311
{ "accepted_answer_id": null, "answer_count": 2, "body": "Swift 2.1 \nRealm 0.98\n\nイメージとしては、クイズアプリの様に複数の質問と回答がDBに格納されて、 \n質問一覧から選択すると、質問文が表示され、回答を出す。\n\nたった今Realmを導入したばかりで、全体の流れもあまり理解できておりません。\n\n更新ドキュメントを見ましたが、モデルを作成してそこでデータに関する処理ができます。 \nという形でしか理解できませんでした。\n\nイメージのものを作成する流れを教えて頂けますでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-20T18:19:26.620", "favorite_count": 0, "id": "23306", "last_activity_date": "2016-09-16T06:18:19.503", "last_edit_date": "2016-03-21T02:25:13.990", "last_editor_user_id": "5519", "owner_user_id": "14872", "post_type": "question", "score": 1, "tags": [ "ios", "swift", "realm" ], "title": "Realmで初期データを作成をしたいのですが、やり方がわかりません。", "view_count": 2999 }
[ { "body": "まずデータとなる質問と回答の構造を考えます。 \n最低限必要なのは問題文と回答のテキストですね。アプリの性質によっては順番や難易度などが必要かもしれません。必要なデータ項目を洗い出して、それを元にクラスを設計します。\n\nRealmではクラスがそのまま一般のデータベースでいうテーブルになります。\n\nクラスを作るところまでできれば、実際の問題文と回答のデータをRealmに保存していきます。\n\nこれが初期データとなります。初期データの作成は適当なプロジェクトを作ってシミュレータでやるのが簡単です。\n\n初期データの作成が完了したら、できたファイルを本当のアプリケーションのプロジェクトに...
23306
null
23499
{ "accepted_answer_id": null, "answer_count": 2, "body": "Windows8上のAndroidStudioでアプリ開発をしていたのですが、 \n先日パソコンのファイル整理をして以来、 \nAndroidStudioのエミュレーターでアプリを実行できなくなってしまいました。\n\n状況としては、 \nエミュレーターを立ち上げる(普通に立ち上がりますし、アイコン一覧からアプリのプロジェクトをクリックすればそのアプリが実行されます) \n→AndroidStudioの実行ボタン(◀)を押すが、何も起こらず、 \n実行ボタンは押されたまま\n\nという感じです。エラーも出ていません。\n\nAndroidSDKやJDK等はProjectStructureで示されている場所にありました。 \nまた、SDK Managerを確認しましたが、必要と思われるものはすべて入っていました。\n\nどうすれば、◀ボタンを押したときにAndroidStudioで開いているプロジェクトのアプリが \n実行されるでしょうか? \n何か解決策等ありましたら教えていただきたいです。\n\n* * *\n\n追記\n\nTarget Deviceを確認したところ、 \nエミュレーターの名前が赤文字になっていたので、これも関係しているかもしれません。\n\n[![エミュレーターのエラー](https://i.stack.imgur.com/BgPtd.png)](https://i.stack.imgur.com/BgPtd.png)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-21T05:09:21.737", "favorite_count": 0, "id": "23313", "last_activity_date": "2023-05-07T02:01:15.357", "last_edit_date": "2017-03-18T08:54:00.447", "last_editor_user_id": "8000", "owner_user_id": "12330", "post_type": "question", "score": 0, "tags": [ "android", "android-studio" ], "title": "AndroidStudioのエミュレーターでアプリを実行できない", "view_count": 5112 }
[ { "body": "windows/linux/Macよっても変わってくると思うので、それだけではなんとも。 \nファイル整理をしたとの事なので、AndroidSDKなどのフォルダを移動していないか確認してみては?", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-21T06:49:11.200", "id": "23314", "last_activity_date": "2016-03-21T06:49:11.200", "last_edit_da...
23313
null
23314
{ "accepted_answer_id": "23394", "answer_count": 1, "body": "BCrypt::Errors::InvalidHash in Devise::SessionsController#createとエラーが表示されました。 \nまたinvalid\nhashとも表示されました。これは、SessionsControllerのcreateアクションのhashが無効である、という意味かなと思いましたが、SessionsControllerなるものをつくっていないです。解釈が間違っているのでしょうか?\n\napplication_controller.rb\n\n```\n\n class ApplicationController < ActionController::Base\n \n before_action :configure_permitted_parameters, if: :devise_controller? \n # Prevent CSRF attacks by raising an exception. \n # For APIs, you may want to use :null_session instead. \n protect_from_forgery with: :exception\n \n # privateメソッドを定義し、deviseの新規登録フォームでnameを受け取れるようにしてください \n include ApplicationHelper\n \n private\n \n def configure_permitted_parameters \n devise_parameter_sanitizer.for(:sign_up) << [:name,:email,:username,:password] \n devise_parameter_sanitizer.for(:sign_in) << [:login,:username,:remember_me] \n end \n end \n \n```\n\nhome_controller.rb\n\n```\n\n class HomeController < ApplicationController \n def top \n if user_signed_in? \n # 変数@noteにNoteクラスのインスタンスを代入してください \n @note = Note.new \n # 変数@notesにNoteクラスのインスタンスの配列を降順で代入してください \n @notes = Note.all.order(created_at: :desc) \n else \n @message = \"ようこそKotoritterへ!\" \n end \n end\n \n def about \n end \n end \n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-21T07:54:03.810", "favorite_count": 0, "id": "23315", "last_activity_date": "2016-03-23T13:23:43.677", "last_edit_date": "2016-03-21T08:35:02.417", "last_editor_user_id": "8000", "owner_user_id": "14754", "post_type": "question", "score": 0, "tags": [ "ruby-on-rails" ], "title": "BCrypt::Errors::InvalidHash in Devise::SessionsController#createの意味", "view_count": 2820 }
[ { "body": "`Devise::SessionsController`はDeviseで実際に認証などの処理をしているControllerです。\n\nDeviseを使ってユーザー認証をする場合、ユーザー登録時、パスワードは元の文字列そのままではなく、元の文字列に戻せないよう変換した形でDBに保存されます。この処理をやっているのがBCryptというライブラリです。\n\nこの変換処理を施した後の文字列は、`$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW`こんな感じになっているのですが、一定の書式がある文字列になっています。\n\n`BCr...
23315
23394
23394
{ "accepted_answer_id": "23318", "answer_count": 1, "body": "いまTwitterのようなサイトを作っています。 \nつぶやきの投稿画面に文字を入力し保存ボタンを押したら、1件のエラー: \nUser can't be blankと表示されます。 \nユーザーの新規登録画面を作成し、そこにユーザー情報を入力し、正常ログインしたあとのエラーで、Userが空である訳がないのですが。。。 \nnotes_controller.rbのどこかに異常があるということなのでしょうか? \n(tweetをnoteと読んでいます) \nnotes_controller.rb\n\n```\n\n class NotesController < ApplicationController \n before_action :authenticate_user! \n before_action :correct_user, only: [:edit, :update] \n before_action :set_note,only:[:show,:edit,:update,:destroy]\n \n def create \n @note = Note.new(note_params) \n if @note.save \n redirect_to @note,notice:'投稿が保存されました' \n else \n @notes = Note.all.order(created_at: :desc) \n render 'home/top' \n end \n end\n \n def show \n @notes = Note.find(params[:id]) \n end\n def edit \n @notes = Note.find(params[:id]) \n end\n \n def update \n if @note.update(note_params) \n redirect_to @note, notice: \"投稿が更新されました\" \n else \n render :edit \n end \n end\n \n def destroy \n @note.destroy \n redirect_to notes_path \n end\n \n def liking_users \n @users = @note.liking_users \n end\n \n private\n \n def set_note \n @note = Note.find(params[:id]) \n end\n \n def note_params \n params.require(:note).permit(:content) \n end\n \n def correct_user \n note = Note.find(params[:id]) \n # noteを投稿したユーザーを取得し、current_user?メソッドの引数に渡してください \n if !current_user?(note.user) \n redirect_to root_path, alert: '許可されていないページです' \n end \n end\n \n end \n \n```\n\nnotes_controller.rb\n\n```\n\n class NotesController < ApplicationController \n before_action :authenticate_user! \n before_action :correct_user, only: [:edit, :update] \n before_action :set_note,only:[:show,:edit,:update,:destroy]\n def create \n @note = Note.new(note_params) \n if @note.save \n redirect_to @note,notice:'投稿が保存されました' \n else \n @notes = Note.all.order(created_at: :desc) \n render 'home/top' \n end \n end\n \n def show \n @notes = Note.find(params[:id]) \n end\n \n def edit \n @notes = Note.find(params[:id]) \n end\n \n def update \n if @note.update(note_params) \n redirect_to @note, notice: \"投稿が更新されました\" \n else \n render :edit \n end \n end\n \n def destroy \n @note.destroy \n redirect_to notes_path \n end\n \n def liking_users \n @users = @note.liking_users \n end\n \n private\n \n def set_note \n @note = Note.find(params[:id]) \n end\n \n def note_params \n params.require(:note).permit(:content) \n end\n \n def correct_user \n note = Note.find(params[:id]) \n # noteを投稿したユーザーを取得し、current_user?メソッドの引数に渡してください \n if !current_user?(note.user) \n redirect_to root_path, alert: '許可されていないページです' \n end \n end\n \n end \n \n```\n\nnoteのmodelのnote.rb\n\n```\n\n class Note < ActiveRecord::Base \n belongs_to :user \n has_many :likes, dependent: :destroy \n has_many :liking_users, through: :likes, source: :user\n \n validates :content, presence: true, length: { maximum: 140 } \n validates :user_id, presence: true \n end\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-21T08:00:54.530", "favorite_count": 0, "id": "23316", "last_activity_date": "2016-03-21T10:18:07.073", "last_edit_date": "2016-03-21T08:41:18.790", "last_editor_user_id": "8000", "owner_user_id": "14754", "post_type": "question", "score": 0, "tags": [ "ruby-on-rails" ], "title": "User can't be blankの解消方法", "view_count": 3137 }
[ { "body": "`user_id` (`user`) に代入している部分が見当たりません。おそらく Devise\nを使っていると思いますが、無関係のモデルに自動的に代入する機能はありません。\n\n`@note = Note.new(note_params)` の直後で、その値を確認してみると `user_id` は `nil`\nになっているはずです。その直後に次のようなコードを入れれば期待通りに動作するはずです。\n\n```\n\n @note.user = current_user\n \n```", "comment_count": 0, "content_license...
23316
23318
23318
{ "accepted_answer_id": "23321", "answer_count": 1, "body": "Railsで `rake foo` というタスクがあり、同一サーバー上に定期的にファイルを更新してる\n`/var/foo/data.yml`がある状態なのですが、この `data.yml`が更新された時に `rake foo`を走らせたく思っています。\n\n方法としては\n\n * `data.yml`を生成するスクリプトの最後の`rake foo`を外部から呼び出す方法\n * Railsで`data.yml`のファイルスタンプを常に見ておいて更新されたら`rake foo`を呼び出す方法\n\nの2通りが思いついたのですが、外部からRails内部を触りに行くよりは、Railsが外部ファイルを触りに行くほうが自然な気がするのでRailsで特定のファイルの更新を監視する方法があれば知りたいです。\n\n`data.yml`取得のスクリプト部分をRailsプロジェクト内に入れることも考えたのですが、下手に入れると複雑に絡み込んでしまいそうで全く別の物として使っています。\n\nこのような場合どうすれば`data.yml`の更新を検知してすぐにRakeタスクを走らせることができますか?\n\nRakeタスクの管理には`Whenever`を使い、外部スクリプトの定期実行には別ユーザーでの`cron`を使っています。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-21T09:22:58.090", "favorite_count": 0, "id": "23317", "last_activity_date": "2016-03-21T13:18:20.537", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3271", "post_type": "question", "score": 0, "tags": [ "ruby-on-rails", "rake" ], "title": "Railsのプロジェクト外の同一サーバー上のファイルの更新を検出してrakeタスクを走らせる", "view_count": 162 }
[ { "body": "Whenever から1分ごとに適当なスクリプトを呼び出し、その中でファイルが変更されたことをチェックしてはいかがでしょうか? (もしくは、`rake\nfoo` で呼び出される処理中で判定する。) ファイルの更新時刻やダイジェスト値などを保存しておき、現在のものと比較することで変更を検出できます。\n\n1分ごとのチェックでは粗すぎるのであれば、`inotify` (Linuxの場合) などのツールを使って検知するのが良い思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_da...
23317
23321
23321
{ "accepted_answer_id": "23324", "answer_count": 1, "body": "Unityのデフォルト状態ではウィンドウの色は灰色になっています。\n\nしかし、[この前unityのチュートリアル動画](https://www.youtube.com/watch?v=RFlh8pTf4DU)で、黒っぽい色に変更して\n\nいるのをみました。プレイモード時の色を変更するのは、\n\nPreferencesから設定することを知っていますが、\n\nウィンドウの色を変更するにはどうするのでしょうか?\n\n回答よろしくお願いします。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-21T12:51:13.597", "favorite_count": 0, "id": "23320", "last_activity_date": "2016-03-21T16:08:39.960", "last_edit_date": "2016-03-21T15:39:33.093", "last_editor_user_id": "4129", "owner_user_id": "14879", "post_type": "question", "score": 0, "tags": [ "unity3d" ], "title": "Unityウィンドウの色の変更について", "view_count": 8686 }
[ { "body": "残念ながら、Unityの`Preferences`の設定で少し色を変更することが出来るのに、ウインドウの色などを変更することにはUnityプロ・エディションが必要だと思います。私のUnityのバージョン(`4.3.2`)はちょっと古いのに、設定で、「ダーク・スキン」のそばで「Pro\nOnly」という注意がやはりありますよね。\n\nまた、[このUnityのページ](https://unity3d.com/get-\nunity)をご覧になると、プロ・エディションには「Professional editor skin」同梱の状態ようですが。", "comment_count": 0, ...
23320
23324
23324
{ "accepted_answer_id": "23331", "answer_count": 1, "body": "googleplayの以下のサイトのhtmlをpythonで取得したところ、アプリのランキングが60位までしかのっていないものでした。\n\n<https://play.google.com/store/apps/collection/topselling_free?hl=ja> \nでソースコードを表示すると同じく60位までしか表示されません。\n\n調べたところ、Javascriptか何かでレンダリングされているとのことだったのですが、どのようにしたら60以降のアプリの情報ものったhtmlが取得できるか知りたいです。\n\nhtmlを取得したい理由は個々のアプリの詳細ページへのリンクを取得したいからです。 \n個々のアプリの詳細ページのリンクさえ取得できれば、手段は問いません。\n\nseleniumなどを利用することも考えましたが、ド素人なのでうまい対策が分かりませんでした。\n\n回答の程、よろしくお願い致します。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-21T15:24:57.163", "favorite_count": 0, "id": "23322", "last_activity_date": "2016-03-22T08:52:38.607", "last_edit_date": "2016-03-22T07:42:06.963", "last_editor_user_id": "3054", "owner_user_id": "10111", "post_type": "question", "score": 3, "tags": [ "python", "ajax" ], "title": "無限スクロールでページの内容が随時読み込まれる場合のスクレイピング", "view_count": 3576 }
[ { "body": "例えば、このようなURLでアクセスすると \n[https://play.google.com/store/apps/collection/topselling_free?hl=ja&start=60&num=30](https://play.google.com/store/apps/collection/topselling_free?hl=ja&start=60&num=30) \n60位から90位が取得出来ます。\n\nこういったリクエストのパラメータを探すには、Webブラウザのデベロッパーツールなどで該当ページの挙動を観察すればよいです。 \nしかし、これからは多くのWebページ...
23322
23331
23331
{ "accepted_answer_id": null, "answer_count": 1, "body": "cakePHP 2.4.9を使用しています。 \n以下2つのテーブルをhasManyモデルを使用して結合し、追加、編集、更新を想定。\n\neventsテーブル\n\n```\n\n CREATE TABLE `events` (\n `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n `name` varchar(256) DEFAULT NULL,\n `latitude` decimal(18,15) DEFAULT NULL,\n `longitude` decimal(18,15) DEFAULT NULL,\n `adult_price` int(11) DEFAULT NULL,\n `adult_age` int(11) DEFAULT NULL,\n `child_price` int(11) DEFAULT NULL,\n `child_age` int(11) DEFAULT NULL,\n `access` text,\n `description` text,\n `minimun_participants_number` int(11) DEFAULT NULL,\n `child_policy_flag` int(11) DEFAULT NULL,\n `meals_flug` int(11) DEFAULT NULL,\n `time_of_day` int(11) DEFAULT NULL,\n `pickup_flag` int(11) DEFAULT NULL,\n `duration_hour` int(11) DEFAULT NULL,\n `pv` int(11) DEFAULT NULL,\n `rating` int(11) DEFAULT NULL,\n `created` timestamp NULL DEFAULT NULL,\n `modified` timestamp NULL DEFAULT NULL,\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n \n```\n\nevents_schedulesテーブル\n\n```\n\n CREATE TABLE `events_schedules` (\n `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n `event_id` int(10) DEFAULT NULL,\n `title` varchar(50) DEFAULT NULL,\n `description` text,\n `start_hour` int(11) DEFAULT NULL,\n `start_min` int(11) DEFAULT NULL,\n `end_hour` int(11) DEFAULT NULL,\n `end_min` int(11) DEFAULT NULL,\n `created` datetime DEFAULT NULL,\n `modified` datetime DEFAULT NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n \n```\n\nModel/Event.php\n\n```\n\n <?php \n class EventController extends AppModel\n {\n public $hasMany = array(\n 'Event' => array(\n 'className' => 'Event',\n 'foreignKey' => 'event_id',\n 'dependent' => true,\n 'conditions' => '',\n 'fields' => '',\n 'order' => '',\n 'limit' => '',\n 'offset' => '',\n 'exclusive' => '',\n 'finderQuery' => '',\n 'counterQuery' => '',\n ),\n );\n }\n \n```\n\nとなっており、一つのイベントIDにつき複数のスケジュールを追加できるようにしています。 \nコントローラー側の処理です。 \nController/EventController.php\n\n```\n\n <?php\n App::uses('AppController', 'Controller');\n App::uses('HttpSocket', 'Network/Http');\n \n class EventsController extends AppController\n {\n \n public $uses = array('Event', 'EventSchedule');\n \n public function edit($id = null)\n {\n if ($this->request->is('Event') || $this->request->is('post')) {\n if ($id == null) {\n $id = $this->Event->getLastInsertID();\n } else {\n $this->EventSchedule->deleteAll(array('EventSchedule.event_id' => $id));\n }\n $this->Event->id = $id;\n \n if ($this->Event->save($this->request->data)) {\n if ($this->request->data('EventsSchedule')) {\n $this->EventsSchedule->saveAll($this->request->data['EventsSchedule'], array('deep' => true));\n }\n {\n $this->Flash->success(__('登録が完了しました'));\n }\n \n $this->redirect(array('action' => 'edit', $this->Event->id));\n } else {\n $this->Flash->error(__('失敗しました'));\n }\n }\n \n $options = array('conditions' => array('Event.id' => $id));\n $this->request->data = $this->Event->find('first', $options);\n $this->set('event', $this->request->data);\n }\n \n```\n\nView側では複数のインプットを保存できるように用意 \nView/Events/edit.ctp\n\n```\n\n <?php echo $this->Form->create('Event', array('type' => 'button', 'action' => 'edit','div' => false)); ?>\n (中略)\n .\n .\n .\n <?php \n $count = 0; \n foreach($this->data['EventsSchedule'] as $Eventschedule): ?> \n <tr>\n <th rowspan=\"8\">スケジュール</th>\n <td>\n <div class=\"form-inline\">\n <div class=\"ui two fields\">\n <div class=\"form-group\">\n <label>日本語</label>\n <?php echo $this->Form->input('EventsSchedule.'. $count . '.title', array('type' => 'text', 'placeholder' => 'スケジュールタイトル(日本語)', 'div' => false, 'label' => false, 'class' => 'form-control', 'required' => false)) ;?>\n </div>\n <div class=\"form-group\">\n <label>詳細</label>\n <?php echo $this->Form->input('EventsSchedule.'. $count . '.description', array('type' => 'text', 'placeholder' => 'スケジュール詳細(日本語)', 'div' => false, 'label' => false, 'class' => 'form-control', 'required' => false)) ;?>\n </div>\n </div>\n </div>\n </td>\n </tr>\n <tr>\n <td>\n <div class=\"form-inline\">\n <div class=\"ui fields\">\n <div class=\"form-group\">\n <label>開始時間</label>\n <?php echo $this->Form->input('EventsSchedule.'.$count. '.start_hour',array('type' => 'select','options' => Configure::read('Hour.codes'),'class' => 'select', 'div' => false, 'label' => false, 'class' => 'form-control', 'required' => false)); ?>:\n <?php echo $this->Form->input('EventsSchedule.'.$count. '.start_min', array('type' => 'select','options' => Configure::read('Minute.codes'),'class' => 'select', 'div' => false, 'label' => false, 'class' => 'form-control', 'required' => false)); ?> 〜 \n </div>\n <div class=\"form-group\">\n <label>終了時間</label> \n <?php echo $this->Form->input('EventsSchedule.'.$count. '.end_hour',array('type' => 'select','options' => Configure::read('Hour.codes'),'class' => 'select', 'div' => false, 'label' => false, 'class' => 'form-control', 'required' => false)); ?>:\n <?php echo $this->Form->input('EventsSchedule.'.$count. '.end_min', array('type' => 'select','options' => Configure::read('Minute.codes'),'class' => 'select', 'div' => false, 'label' => false, 'class' => 'form-control', 'required' => false)); ?>\n </div>\n </div>\n </div>\n </td>\n </tr>\n <?php $count++; ?>\n <?php endforeach; ?>\n <?php echo $this->Form->end(array('label' => '登録・編集', 'class' => 'btn btn-primary')); ?>\n \n```\n\nここまではなんとかで用意でき、以下のことが実現できません。 \n・更新を押した際にEvents_scheduleテーブルにevent_idが保存されない \n・スケジュールの入力欄を動的に追加できるようにしたい\n\nどなたかご教示いただけると幸いです。 \n宜しくお願い致します。", "comment_count": 5, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-22T02:31:59.297", "favorite_count": 0, "id": "23330", "last_activity_date": "2016-04-24T01:30:52.403", "last_edit_date": "2016-03-23T04:03:13.903", "last_editor_user_id": "8500", "owner_user_id": "8500", "post_type": "question", "score": 0, "tags": [ "cakephp" ], "title": "CakePHPでhasManyを使った更新が上手くいかない", "view_count": 1686 }
[ { "body": "いろいろと例示コード上におかしな点がありますが、保存部分だけに絞って回答します。\n\n`EventsController::edit()`において`$this->Event->save()`の後に`$this->EventSchedule->saveAll()`を実行していますが、これはまとめて`saveAssociated`を使いましょう。\n\n<http://book.cakephp.org/2.0/ja/models/saving-your-data.html#model-\nsaveassociated-array-data-null-array-options-array>\n\n...
23330
null
23435
{ "accepted_answer_id": "23333", "answer_count": 3, "body": "割と量のある二次元配列に対して\n\n```\n\n print data\n \n```\n\nとした時に下記のように省略されるのですが、ファイルに書き出したいので全部出して欲しい時はどうすればよいですか?\n\n```\n\n [[a,b,c ..., x,y,z]\n [a,b,c ..., x,y,z]\n ....,\n [a,b,c ..., x,y,z]\n [a,b,c ..., x,y,z]]\n \n```", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2016-03-22T03:24:06.453", "favorite_count": 0, "id": "23332", "last_activity_date": "2021-07-10T08:03:17.990", "last_edit_date": "2021-07-10T08:03:17.990", "last_editor_user_id": "3060", "owner_user_id": "525", "post_type": "question", "score": 4, "tags": [ "python" ], "title": "Python で 二次元配列を print すると結果が省略されるが、全て表示させたい", "view_count": 63718 }
[ { "body": "`print <python-object>`\nとしたときにPythonのリストオブジェクトや辞書オブジェクトのプログラムコードのように出力されているのは、「たまたま」です。人間が見やすいように整形しているので、長い場合は途中で省略されます。\n\nデータを完全な状態でファイルに保存する、つまりシリアライズする方法はいくつかあります。このとき、どのようなフォーマットでファイルに書き出したいかによって実装方法は異なります。単に、人間が見るだけれあれば(再利用しないのであれば)、シリアライズをちゃんと考えるよりも楽に解決できそうです。\n\n人間が見やすければOKな出力(画面の横幅はきっと広い):...
23332
23333
23333
{ "accepted_answer_id": null, "answer_count": 1, "body": "HTML+JavaScriptで出来ることって何ですか? \nAndroidアプリ、iOSアプリ等は作れるんですか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-22T06:07:55.750", "favorite_count": 0, "id": "23338", "last_activity_date": "2016-03-22T06:30:44.250", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14888", "post_type": "question", "score": 0, "tags": [ "javascript" ], "title": "JavaScript+HTMLで開発", "view_count": 147 }
[ { "body": "HTMLはWebページを記述する言語です。それだけでは文章や画像、リンクを表示するといったことしかできませんが、Javascriptを組み合わせることで「ボタンを押したらメッセージを表示する」とか「別のサーバーから取得した情報を同じページに展開する」とか、Webページに動きを持たせることができます。\n\n基本的にはWebサーバーにブラウザからアクセスして表示・実行させるものですが、最近ではPC上やスマートフォン上で動くアプリを作るためにも使われるようになってきました。この場合、ブラウザの代わりに「HTMLを表示しJavascriptを実行する」土台が用意されているので、そこで動くように開発し、...
23338
null
23339
{ "accepted_answer_id": null, "answer_count": 2, "body": "MonacaからリリースビルドしたiOSアプリで \nApp Storeの情報で互換性の「iOS *.*以降。」のバージョンを変更したいのですが \nどのような設定をすれば変更する事が出来るのでしょうか。\n\nCordovaはバージョン5.2です。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-22T07:05:09.140", "favorite_count": 0, "id": "23342", "last_activity_date": "2016-04-21T02:55:44.633", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14889", "post_type": "question", "score": 0, "tags": [ "monaca" ], "title": "iOS互換性表記の指定方法", "view_count": 547 }
[ { "body": "`MonacaApp-Info.plist`を編集しましょう \n下記のように記載すれば最小の対応OSを指定できます。\n\n```\n\n <key>MinimumOSVersion</key>\n <string>4.1</string>\n \n```\n\n[参考](http://docs.monaca.mobi/3.5/ja/reference/config/ios_configuration/)", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date":...
23342
null
23347
{ "accepted_answer_id": "23345", "answer_count": 2, "body": "```\n\n <input type=\"text\" class=\"input\">\n <input type=\"text\" class=\"input\">  \n <input type=\"text\" class=\"input\">\n <input type=\"text\" class=\"input\">\n <input type=\"text\" class=\"input\">\n \n```\n\n上記のようなHTMLにて、 \n入力されているinputタグに処理をしたいのですが、\n\n```\n\n $('.input').each(function() {\n if ($(this).val()) {\n $(this).hogehoge;\n }\n });\n \n```\n\n↑のようにループ等使わずに、\n\n```\n\n $('xxxxxx').hogehoge;\n \n```\n\nと、1行で書く事はできないでしょうか。 \nよろしくお願いします。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-22T07:14:07.763", "favorite_count": 0, "id": "23343", "last_activity_date": "2016-03-22T08:34:49.130", "last_edit_date": "2016-03-22T07:35:49.097", "last_editor_user_id": "14688", "owner_user_id": "14688", "post_type": "question", "score": 2, "tags": [ "jquery" ], "title": "jQuery 同classのinputタグから入力済みのものだけへの処理をループを使わずに書く方法", "view_count": 1666 }
[ { "body": "input等の要素が入力済みであるか、あるいはvalueプロパティを検査できるようなセレクタはjQueryにもないと思います。処理の部分をループの外に追い出したいということであれば\n[`.filter()`](https://api.jquery.com/filter/)\nを使う手はありますが、判定の部分はやはり無名関数を使うことになります。\n\n```\n\n $('button').on('click', function() {\r\n $('.input')\r\n .css('background', '') //reset\r\n ....
23343
23345
23345
{ "accepted_answer_id": "23349", "answer_count": 1, "body": "windows7でnpm installするとエラーが発生します \n`C:\\Users\\username\\package.json`が存在していないというエラーのようです \nどうすれば解決できるのでしょうか?\n\nnode5.9.0 \nnpm3.7.3 \nを使っています\n\n```\n\n \n npm WARN enoent ENOENT: no such file or directory, open 'C:\\Users\\username\\package.json'\n npm WARN username No description\n npm WARN username No repository field.\n npm WARN username No README data\n npm WARN username No license field.\n \n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-22T11:39:44.323", "favorite_count": 0, "id": "23348", "last_activity_date": "2016-03-22T12:09:12.650", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5246", "post_type": "question", "score": 1, "tags": [ "node.js", "npm" ], "title": "Windows7でnpm installするとエラーになる", "view_count": 7423 }
[ { "body": "`npm install` は、カレントディレクトリにある package.json に書かれた全パッケージを、同カレントディレクトリの\nnode_modules/ ディレクトリにインスールするコマンドです。よって package.json\nが存在しない場合には、動作の前提条件を満たせないためそのようなエラーになります。もしも本当に `npm install`\nを実行したいのであれば、package.json が存在するディレクトリに `cd` で移動した上で `npm install` してください。\n\n特定のパッケージをカレントディレクトリの node_modules/ ディレクト...
23348
23349
23349
{ "accepted_answer_id": "37992", "answer_count": 3, "body": "プログラミングの問題ではないのかもしれませんが…質問させていただければと思います。\n\nHomebrew で Vim をインストールしようとすると \n下記のようなエラーが出て、インストールする事が出来ません。\n\n```\n\n $ brew install vim --with-lua\n ==> Downloading https://github.com/vim/vim/archive/v7.4.1589.tar.gz\n Already downloaded: /Library/Caches/Homebrew/vim-7.4.1589.tar.gz\n ==> ./configure --prefix=/usr/local --mandir=/usr/local/Cellar/vim/7.4.1589/share/man --enable-multibyte --with-tlib=ncurses --enable-cscope --with-compiledby=Homebrew --enable-luai\n ==> make\n Last 15 lines from /Users/akihiroyajima/Library/Logs/Homebrew/vim/02.make:\n /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/term.o term.c\n /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/ui.o ui.c\n /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/undo.o undo.c\n /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/window.o window.c\n /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/local/include -o objects/if_lua.o if_lua.c\n /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -g -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -o objects/if_perl.o auto/if_perl.c\n /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -g -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -o objects/if_perlsfio.o if_perlsfio.c\n /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/Applications/MAMP/Library/include/python2.7 -DPYTHON_HOME='\"/Applications/MAMP/Library\"' -fPIE -o objects/if_python.o if_python.c\n if_python.c:67:10: fatal error: 'Python.h' file not found\n #include <Python.h>\n ^\n 1 error generated.\n make[1]: *** [objects/if_python.o] Error 1\n make[1]: *** Waiting for unfinished jobs....\n make: *** [first] Error 2\n \n READ THIS: https://git.io/brew-troubleshooting\n \n These open issues may also help:\n Make Install fails for Vim 7.4.1525 https://github.com/Homebrew/homebrew/issues/50197\n vim 7.4.488 build fails if Homebrew ruby is installed but /usr/bin/ruby comes first in PATH https://github.com/Homebrew/homebrew/issues/33705\n \n```\n\nエラー文に表示されている issue なども見ながら改善しようと思いましたが、 \n中々決定打が見つからず…といった感じです。\n\nよろしくお願いします。", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-22T12:14:54.897", "favorite_count": 0, "id": "23350", "last_activity_date": "2017-09-16T13:35:29.613", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9617", "post_type": "question", "score": 2, "tags": [ "vim", "homebrew" ], "title": "Homebrew で Vim がインストールできない", "view_count": 1853 }
[ { "body": "`brew install python` で Python をインストールすると、Vim もインストールできるようになりました! \nご回答いただきありがとうございました。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T09:06:53.230", "id": "23450", "last_activity_date": "2016-03-25T09:06:53.230", "last_edit_date": null,...
23350
37992
23450
{ "accepted_answer_id": null, "answer_count": 1, "body": "カレンダー予約システムで、セッションに入ってる予約数を、在庫管理に組み込みたいのですがうまくいきません。 \nこちらの良いやり方があればアドバイスいただきたいです。\n\n【できているところ】 \nデータベースから商品番号を参照して、予約データの予約が入っている日の予約数を、在庫数$maxに参照して在庫の有る無しを判定\n\n在庫を調べるためのデータ \n$room_id 商品ID \n$reservday 日時 \n$max 在庫総数 ※ $max < $m で在庫無し\n\n1.予約データを取り出して、予約数を数える\n\n```\n\n $m =0;\n mysql_select_db($DBNAME, $connect);\n mysql_query(\"SET NAMES utf8\");\n $query = \"SELECT * FROM reserve_table WHERE type='$room_id' AND reserve_day='$reservday'\";\n $result = mysql_query($query) or die(mysql_error());\n while ($row = mysql_fetch_array($result)) {\n $m++;\n }\n \n```\n\n2.セッション$_SESSION[item]の中身\n\n```\n\n Array ( \n // [key]1商品×日程ごとの固有KEY [reserve_day]予約開始日 [renpaku]連泊数\n [0] => Array ( [key] => 1458583223 [type] => 5 [reserve_day] => 20160322 [renpaku] => 1 ) \n [1] => Array ( [key] => 1458583836 [type] => 5 [reserve_day] => 20160327 [renpaku] => 1 ) \n [2] => Array ( [key] => 1458584148 [type] => 1 [reserve_day] => 20160321 [renpaku] => 1 ) \n )\n \n```\n\n【やりたいこと】 \n1の$mに、セッション変数に入っている$mを予約数にプラスしたい。 \n下の書き方では正常な動作になりませんでした。こちらをどのように修正すればいいかアドバイスをいただけるとありがたいです。\n\n3.セッションの予約数をデータベースの予約数にプラスする\n\n```\n\n foreach ($_SESSION['item'] as $od => $val) {\n $type = $val[ room_id ];\n $reserve_day = $val[ reserve_Day ];\n $renpaku = $val[ renpaku ]; //連泊日数\n $ren = 0;\n \n if($type == $row[type]) {\n \n //連日予約用にreserve_dayを分断、月またぎの予約に対応\n $year = substr($reserve_day, 0, 4);\n $mon = substr($reserve_day, 4, 2);\n $day = substr($reserve_day, 6, 2);\n \n //連日予約の、全ての日が予約数に追加されるようにする\n for ($i = 1; $i <= $renpaku; $i++) {\n if ($renpaku >= 2) {\n $tomorrow = mktime(0, 0, 0, $mon, $day + $ren, $year);\n $reserve_day = date(Ymd, $tomorrow);\n }\n $ren++;\n }\n $m++; //ここが合っていない?\n }\n \n```", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-22T13:00:46.303", "favorite_count": 0, "id": "23351", "last_activity_date": "2016-03-23T02:03:51.667", "last_edit_date": "2016-03-22T14:15:18.707", "last_editor_user_id": "13755", "owner_user_id": "13755", "post_type": "question", "score": 0, "tags": [ "php", "session" ], "title": "宿泊予約で、セッションに入ってる予約数を在庫管理に組込みたい", "view_count": 295 }
[ { "body": "明らかな間違いや良くないところが多数あり、基本的な部分から勉強された方が良いように思います。\n\n * `mysql_*`系の関数は古すぎて非推奨です\n * `SET NAMES utf-8`で文字エンコーディングを指定してはいけません\n * SQLに変数が直接埋め込まれており、事前にエスケープしていない場合はSQLインジェクションが可能になります。プレースホルダを使いましょう。(勧められませんが)エスケープする場合は漏れを防ぐため組み立てと同時やるのがセオリーです。\n * コメントでも指摘があるとおり、行数が必要なら取得した結果をループで回すのではなく`COUNT`を使いましょ...
23351
null
23360
{ "accepted_answer_id": "23378", "answer_count": 1, "body": "行列をパディングするコードをGoで書きました。 \nそこで下記のように並列化するものとしないものを用いてベンチマークを実行しました。しかしgoroutineを使ったほうが使わかなった方よりも時間がかかりメモリも多く使うという結果になりました。\n\ngoroutineを使ったほうが速くなると考えましたがなぜこのようなことが起こったのでしょうか。 \n下記に作成したコード、ベンチマークのコード、コマンド、結果を記述します。\n\n**コード**\n\n```\n\n import (\n \"errors\"\n \"fmt\"\n \"sync\"\n )\n \n // Matrix is object for matrix.\n type Matrix struct {\n Rows uint\n Cols uint\n M [][]float64\n }\n \n const (\n Zero = iota + 1\n Edge\n )\n \n // NewMatrix is constructor of Matrix.\n func NewMatrix(m [][]float64) *Matrix {\n return &Matrix{\n M: m,\n Rows: uint(len(m)),\n Cols: uint(len(m[0])),\n }\n }\n \n func (m *Matrix) edgePad(rows, cols uint, newMatrix [][]float64, w uint, y int, wg *sync.WaitGroup) {\n col := make([]float64, m.Cols)\n for x := 0; x < int(m.Cols); x++ {\n if y < int(w) && x < int(w) {\n col[x] = m.M[0][0]\n } else if y < int(w) && x > int(w)-1 && x < int(cols+w) {\n col[x] = m.M[0][x-int(w)]\n } else if y < int(w) && x > int(cols+w)-1 {\n col[x] = m.M[0][cols-1]\n } else if y > int(w)-1 && y < int(rows+w) && x < int(w) {\n col[x] = m.M[y-int(w)][0]\n } else if y > int(w)-1 && y < int(rows+w) && x > int(cols+w)-1 {\n col[x] = m.M[y-int(w)][cols-1]\n } else if y > int(rows+w)-1 && x < int(w) {\n col[x] = m.M[rows-1][0]\n } else if y > int(rows+w)-1 && x > int(w)-1 && x < int(cols+w) {\n col[x] = m.M[rows-1][x-int(w)]\n } else if y > int(rows+w)-1 && x > int(cols+w)-1 {\n col[x] = m.M[rows-1][cols-1]\n } else {\n col[x] = m.M[y-int(w)][x-int(w)]\n }\n }\n newMatrix[y] = col\n wg.Done()\n }\n \n // Pad pads the Matrix.\n func (m *Matrix) Pad(w uint, mode int) error {\n newMatrix := make([][]float64, m.Rows+w*2)\n rows, cols := m.GetSize()\n m.Cols = m.Cols + w*2\n m.Rows = m.Rows + w*2\n var wg sync.WaitGroup\n for y := 0; y < int(m.Rows); y++ {\n wg.Add(1)\n switch mode {\n case Zero:\n //go m.zero(...)この部分をかえました。\n m.zeroPad(rows, cols, newMatrix, w, y, &wg)\n case Edge:\n //go m.Edge(...)\n m.edgePad(rows, cols, newMatrix, w, y, &wg)\n }\n }\n wg.Wait()\n m.M = newMatrix\n return nil\n }\n \n```\n\n**ベンチマーク**\n\n```\n\n func BenchmarkEdge(b *testing.B) {\n m := GetMatrix(480, 360)\n for i := 0; i < b.N; i++ {\n err := m.Pad(7, Edge)\n if err != nil {\n b.Fatal(err)\n }\n }\n }\n \n func GetMatrix(rows, cols int) *Matrix {\n rand.Seed(time.Now().UnixNano())\n s := make([][]float64, rows)\n for y := 0; y < rows; y++ {\n col := make([]float64, cols)\n for x := 0; x < cols; x++ {\n col[x] = rand.Float64()\n }\n s[y] = col\n }\n return NewMatrix(s)\n }\n \n```\n\n**コマンド**\n\n```\n\n go test -cpu 4 -bench . -benchmem\n \n```\n\n**結果**\n\n**goroutineなし**\n\n```\n\n BenchmarkEdge-4 100 11697971 ns/op 12066503 B/op 1198 allocs/op\n \n```\n\n**goroutineあり**\n\n```\n\n BenchmarkEdge-4 200 18919942 ns/op 33900980 B/op 1901 allocs/op\n \n```\n\n**実行時間**\n\n**goroutineなし** : 1.193s \n**goroutineあり** : 4.581s\n\n**動作環境** \nMBA Intel Core i7 2.2 GHz \nコア数: 2 \nメモリ:8GB\n\n**追記**\n\nちなみにzeroPadはパディ‌​‌​ング部をEdgeの値でなく0で埋めます。goroutineのコストがこの計算よりも負荷が高いのではと想像しています。もし実装を変える事でgoroutineを‌‌​​有効活用できる方法があれば知りたいです。あとgoroutineを使わなかった時の処理速度(np/op)が遅いのに、繰り返し回数は大きくなっているのはなぜなんでし‌​ょ‌​うか", "comment_count": 9, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-22T14:49:32.467", "favorite_count": 0, "id": "23353", "last_activity_date": "2016-03-23T09:14:15.650", "last_edit_date": "2016-03-23T07:04:06.543", "last_editor_user_id": "7232", "owner_user_id": "7232", "post_type": "question", "score": 3, "tags": [ "go" ], "title": "Goroutineを使うと性能が落ちるのはなぜか", "view_count": 543 }
[ { "body": "ベンチマークを取る場合、実行回数(`b.N`)を直接には指定できない様で、`-benchtime` オプションで調整するしかない様です。\n\n**動作環境**\n\nIntel Xeon E5-2640 2.6GHz \nコア数: 16 \nメモリ: 32GB \nGolang: 1.6\n\n**goroutineあり**\n\n```\n\n $ go test -cpu 4 -bench . -benchmem -benchtime=100ms\n testing: warning: no tests to run\n BenchmarkEdge-4 100...
23353
23378
23378
{ "accepted_answer_id": "23355", "answer_count": 1, "body": "unix のシェルスクリプトであれば、 [posix](http://pubs.opengroup.org/onlinepubs/9699919799/)\nなどを参照すれば、どのような仕様になっているかがわかります。\n\nWindows でのバッチファイルについて、このような仕様についてまとまっているサイト・資料はありますか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-22T14:51:40.527", "favorite_count": 0, "id": "23354", "last_activity_date": "2016-03-22T15:30:13.560", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "754", "post_type": "question", "score": 3, "tags": [ "windows", "batch-file" ], "title": "バッチファイルの仕様がまとまっているサイト(資料?)はありますか。", "view_count": 1255 }
[ { "body": "私が知っているものとして、コマンドラインリファレンスがあります。\n\nコマンド ライン リファレンス \n<https://msdn.microsoft.com/ja-jp/library/cc778084(v=ws.10).aspx>\n\nこのページに各種解説へのリンクがあり、例えば下記のようなページへ芋づる式にたどっていけます。\n\nコマンド シェルの概要 \n<https://msdn.microsoft.com/ja-jp/library/cc737438(v=ws.10).aspx>\n\nバッチ ファイルを使用する \n<https://msdn.microsoft.co...
23354
23355
23355
{ "accepted_answer_id": null, "answer_count": 2, "body": "Xcodeでpython3.5の実行をしようとしています. \nとりあえずインストールは終え,ターミナル\"which\npython3\"と入力すると,\"/Library/Frameworks/Python.framework/Versions/3.5/bin/python3\"と出力されています. \nインストール自体は数ヶ月前に行い,そのときは正しくXcodeでpython3.5を実行することができました.\n\nしかし現在,Xcodeでの設定がうまくいかなくなってしまいました. \n(おそらくEl Capitanに更新したためではないかと思われます.) \n具体的に言いますと,Xcodeで\"Product - Scheme - Edit\nScheme\"で上記,\"/Library/Frameworks/Python.framework/Versions/3.5/bin/python3\"のpython3.5を指定する必要があります. \nしかし,python3.5がExecutableではなく書類のファイルになっていて,指定することができません. \nどうやら\".5\"という拡張子だと判断されているようです.\n\nどうすればよいでしょうか? \n何か解決法があればお願いします.", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-22T21:51:12.167", "favorite_count": 0, "id": "23357", "last_activity_date": "2019-02-15T12:25:00.257", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13125", "post_type": "question", "score": 3, "tags": [ "xcode", "python", "macos" ], "title": "Mac(Xcode)でのpython3.5の設定について.", "view_count": 847 }
[ { "body": "右クリック→クイックルックで強引な気もしますが一応選択できましたよ", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-06-19T07:29:08.240", "id": "26856", "last_activity_date": "2016-06-19T07:29:08.240", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": ...
23357
null
26856
{ "accepted_answer_id": null, "answer_count": 1, "body": "お世話になります。\n\nmonacaで、Crosswalkプラグインを入れた状態で、 \nサーバと通信すると、下記エラーが出てしまいました。\n\n(できれば)サーバ側で何も設定すること無く、 \n正常に通信をする方法はありますでしょうか。\n\n===[エラー内容]=== \nXMLHttpRequest cannot load <http://xxxx.xxx.jp/xxxx.php/xxxxx> . No 'Access-\nControl-Allow-Origin' header is present on the requested resource. Origin\n'file://' is therefore not allowed access.", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T01:27:27.260", "favorite_count": 0, "id": "23361", "last_activity_date": "2016-07-07T10:00:52.760", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13702", "post_type": "question", "score": 0, "tags": [ "monaca", "cordova" ], "title": "Crosswalkプラグイン利用時、サーバ通信ができない", "view_count": 233 }
[ { "body": "残念ながら、Crosswalkプラグインの仕様上、サーバー側に\n\n```\n\n Access-Control-Allow-Origin: file://\n \n```\n\nや\n\n```\n\n Access-Control-Allow-Origin: *\n \n```\n\nの設定がないと、このエラーが出てしまうと思います。 \nビルドしたアプリでは、アプリのコード領域にindex.htmlがあるのでこのエラーが出ない \nのですが、Monacaデバッガーでは書き換え可能なファイル領域にindex.htmlがあるため、 \nこのエラーを避けられません...
23361
null
27421
{ "accepted_answer_id": null, "answer_count": 1, "body": "仮定: \n・ユーザA \n・ユーザAのフォロワーにユーザB \n・ユーザBのフォロワーにユーザC\n\nユーザAがツイートしたとき,そのツイートをユーザBがRT(リツイート)して,さらにそのツイートをユーザCがRTしたとき,この流れをTwitter REST\nAPI を利用して取得する方法はありますか?\n\nつまり,以下のような波及する様子を取得したいです. \nツイート -> ユーザBがRT -> ユーザCがRT", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T02:18:53.507", "favorite_count": 0, "id": "23363", "last_activity_date": "2016-07-02T12:08:06.973", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11142", "post_type": "question", "score": 0, "tags": [ "twitter" ], "title": "Twitter REST API を用いてRTのRTをした流れを取得", "view_count": 374 }
[ { "body": "現実的では無いかも知れませんが、可能かも知れません。 \nRTは\"RT @id\"という文字列で始まる別のツイートIDで管理されます。\n\n 1. `statuses/retweets/:id`にオリジナルのツイートのIDを指定してレスポンスを取得\n 2. 1で取得したレスポンスの各RTのIDを`statuses/retweets/:id`に設定して再びRTを取得\n\nこれを繰り返せば取れるだろうと思います。 \nただし`statuses/retweets/:id`は15回/15分しか使えませんし、一度に100ツイートしか取得できないので、取得できる限界は15回RTされたところま...
23363
null
27271
{ "accepted_answer_id": null, "answer_count": 1, "body": "> sudo mount -t cifs -o username=name,sec=ntlm //pass/共有したフォルダ /mnt/samba\n\nというコマンドを打ったのですがうまくいきませんでした。 \nWindowsから共有した場合はうまくいきました。 \nマウントできている方教えていただけると助かります。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T04:00:27.790", "favorite_count": 0, "id": "23367", "last_activity_date": "2016-03-24T06:24:26.243", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14899", "post_type": "question", "score": 1, "tags": [ "ubuntu" ], "title": "Macで共有したフォルダをUbuntu でマウントするにはどうすればいいですか", "view_count": 1354 }
[ { "body": "[Apple Support\nCommunitiesのスレッド](https://discussions.apple.com/thread/3196311?start=30&tstart=0)\nによると `nounix,sec=ntlmssp` オプションが必用だそうです。試してみてください。\n\n(例) \n`mount.cifs //192.168.xxx.xxx/test /mnt/test/ -o\nuser=******,password=******,nounix,sec=ntlmssp`", "comment_count": 0, "content_lice...
23367
null
23409
{ "accepted_answer_id": "23370", "answer_count": 2, "body": "Go言語で2次元配列を作成し、そこから部分的に取り出した配列を作りたい時にスライスを用いて下記のように記述しましたが、行は切り出せましたが列は切り出せませんでした。\n\n<https://play.golang.org/p/QSzCo8ffBw>\n\nつまり上の例では[5,5]を[3,3]になってほしいところが[3,5]になってしまっています。 \n列も含めスライスするにはどのようにすれば良いのでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T04:09:46.237", "favorite_count": 0, "id": "23368", "last_activity_date": "2016-03-23T05:04:35.817", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7232", "post_type": "question", "score": 0, "tags": [ "go" ], "title": "Goで2次元配列の部分配列を得たい", "view_count": 1075 }
[ { "body": "残念ながらこのプログラムですと\n\n```\n\n m := [][]float64{\n {1, 1, 1, 0, 0},\n {0, 1, 1, 1, 0},\n {0, 0, 1, 1, 1},\n {0, 0, 1, 1, 0},\n {0, 1, 1, 0, 0},\n }\n \n```\n\nに対して、 `m[0:3][0:3]` は\n\n```\n\n n := m[0:3]\n n[0:3]\n \n```\n\nの処理をしたことと同じになってしまいます。行と列が同じ数...
23368
23370
23370
{ "accepted_answer_id": "23670", "answer_count": 1, "body": "webフレームワークのbottleをインストールして、\n\n```\n\n from bottle import route, run\n \n @route('/')\n def home():\n return \"it is not fancy, but it is my home page\"\n \n run(host='localhost', port=9999)\n \n```\n\nを実行すると、\n\n```\n\n UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 0: invalid start byte\n \n```\n\nというエラーが出てしまいます。 \n調べてみると、socket.pyというスクリプトの\n\n```\n\n def getfqdn(name=''):\n \"\"\"Get fully qualified domain name from name.\n \n An empty argument is interpreted as meaning the local host.\n \n First the hostname returned by gethostbyaddr() is checked, then\n possibly existing aliases. In case no FQDN is available, hostname\n from gethostname() is returned.\n \"\"\"\n name = name.strip()\n if not name or name == '0.0.0.0':\n name = gethostname()\n try:\n hostname, aliases, ipaddrs = gethostbyaddr(name)\n except error:\n pass\n else:\n aliases.insert(0, hostname)\n for name in aliases:\n if '.' in name:\n break\n else:\n name = hostname\n return name\n \n```\n\nという箇所の\n\n```\n\n try:\n hostname, aliases, ipaddrs = gethostbyaddr(name)\n \n```\n\nという部分にエラーが出ているようです。 \nこのエラーを出なくするためにはどのようにすればいいのでしょうか? \nよろしくお願いします。", "comment_count": 10, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T07:22:55.650", "favorite_count": 0, "id": "23375", "last_activity_date": "2016-04-01T14:53:24.587", "last_edit_date": "2016-03-23T07:49:31.273", "last_editor_user_id": "216", "owner_user_id": "9597", "post_type": "question", "score": 3, "tags": [ "python", "bottle" ], "title": "PythonのフレームワークBottleを使用するとUnicodeDecodeErrorが出てしまいます。解決策を教えてください。", "view_count": 429 }
[ { "body": "マシン名(ホスト名)に日本語を使うのを止めると解決します。 \n現在のマシン名の確認は \n\n```\n\n import socket;\n print(socket.getfqdn())\n \n```\n\nで確認出来ます。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2016-04-01T14:53:24.587", "id": "23670", "last_activity_date": "2016-04-01T14:...
23375
23670
23670
{ "accepted_answer_id": null, "answer_count": 2, "body": "以下のオンクリックの時に、バリデーションアラートを作動させたいのですが、どのようにすればうまくいきますでしょうか。詳しい方、ご教示ください。宜しくお願い致します。\n\n```\n\n <a href=\"#\" onclick=\"document.insert.submit()\" id=\"senddiv\">保存する</a> \n \n \n <form id=\"form\" method=\"post\" name=\"insert\" action=\"\" enctype=\"multipart/form-data\">\n <input type=\"text\" name=\"tags\" id=\"tags\">\n </form>\n \n \n <script>\n $(function(){\n \n \n $('#form').submit(function() {\n \n if($('[name=\"tags\"]').val() == ''){\n alert(\"タグを記入してください。\");\n return false;\n }\n \n return true;\n \n });\n \n });\n </script>\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T07:29:46.670", "favorite_count": 0, "id": "23376", "last_activity_date": "2016-04-22T11:47:22.137", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8619", "post_type": "question", "score": -1, "tags": [ "javascript" ], "title": "javascriptでアラート表示", "view_count": 218 }
[ { "body": "aタグのonclick属性値を以下にすると良いと思います。\n\n```\n\n <a href=\"#\" onclick=\"$('#form').submit()\" id=\"senddiv\">保存する</a>\n \n```\n\nこれでJavaScript内で仕掛けているイベントハンドラが呼び出されるようになると思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T09:22:54.130", "id": "2...
23376
null
23382
{ "accepted_answer_id": "23380", "answer_count": 1, "body": "VBで特定の関数名を作成しようとするとVisual Studioがエラーも出ずに終了してしまいます。\n\n具体的には、Visual Studio\n2015上のVBでフォームアプリケーションを作成し、ボタン(Button1)を配置します。次にソースコードで以下のような関数を作成しようとすると\nset_Button1 まで入力したところでVisual Studioが終了してしまいます。\n\n```\n\n Private Sub set_Button1()\n \n End Sub\n \n```\n\n調べた限りでは set_ のほかに get_ でも落ちることからプロパティが関係しているのかとも思いますがよく分かりません。\n\nこの問題は関数名を入力するときに気をつけるしかないのでしょうか? \nあるいはなんらかの設定をすることでエラーを出すなどの対策が可能なのでしょうか? \nよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T08:26:49.930", "favorite_count": 0, "id": "23379", "last_activity_date": "2016-03-23T09:13:37.140", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14903", "post_type": "question", "score": 5, "tags": [ "visual-studio", "vb.net" ], "title": "VB.NET で特定の関数名を作成しようとするとVisual Studio が落ちる", "view_count": 641 }
[ { "body": "Visual Studioの不具合だと思われるので、[Microsoft\nConnect](https://connect.microsoft.com/VisualStudio/Feedback)かWindowsフィードバックに報告のうえ、修正されるまでは自分で回避するしかないと思います。\n\n* * *\n\n原因を説明するとフォーム上に`Button1`を配置すると、`.designer.vb`に以下のようなコードが生成されます。\n\n```\n\n Friend WithEvents Button1 As System.Windows.Forms.Button\n \n`...
23379
23380
23380
{ "accepted_answer_id": "23390", "answer_count": 2, "body": "`clojure`初心者です。 \n非常に初歩的な質問ですみませんが、`clojure`といえども、`var`に対する再束縛は問題なくできると考えてよいのでしょうか?\n\n```\n\n user => (def a 100)\n user => a\n ; 100と表示\n user => (def a 200)\n user => a\n ; 200と表示\n \n```\n\n`clojure`が変数(`var`のこと)の参照先オブジェクトを変更できないイミュータブルな性質を持つことは`java`等の経験から理解できます。\n\nその一方で、関数型言語では「再代入」はできない、なんていう言葉も何度もそれとなく聞いておりまして、それはなんとなくそういうものなのかと思っていました。それゆえ、本日思わぬ形で上記の例に出会ってしまい、今までも似たようなものは見てたのでしょうが、はたと気がついて混乱しております。\n\n私の拙い理解では、これだと再代入は「できている」、`clojure`流の言葉では「再束縛」が起きているとでも言えばいいのでしょうか、とにかく同じ`var`に別の値を結びつけることができています。\n\n```\n\n user=> (defn xyz [] \n (let [abc 100] \n (let [abc 200] (+ abc 100))))\n user=> (xyz)\n 300\n \n```\n\n`let` を使っても同じことです。\n\n変数の値の再代入は他の言語でも普通にありますし、この動作がおかしいなどと言うつもりは毛頭ないのですが、いわゆる「関数型言語に再代入はない」的な言説が何を言わんとしているのかがわからなくなりました。再代入ができないのではなく、再代入を避けやすい、という意味で使われることが多いのでしょうか。\n\n「プログラミングclojure」という本を読みながら学習しているのですが、このことについては特に記述がないか、見つけられません。なので、しょーもない質問とは思いますが、おかしな理解をするのも良くないので、どなたか教えてくださると嬉しいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T09:42:01.687", "favorite_count": 0, "id": "23384", "last_activity_date": "2018-04-29T02:53:02.010", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9403", "post_type": "question", "score": 1, "tags": [ "clojure" ], "title": "clojureで「再代入できない」と言われる意図は何なのか", "view_count": 717 }
[ { "body": "`def`は、その名前空間のトップレベルのvar(≒グローバル変数)を新しく作ります。まあこれは例外ですね。現代的なプログラミング言語では、グローバル変数の変更はあまり重要ではありませんし。\n\n`let`の入れ子の場合、「同じ名前だけど別の変数」を定義しているだけです。内側の`let`で`abc`に別の値を束縛しても、外側の`let`の`abc`は別の変数なので、影響を与えません。別の関数の仮引数の変数名が呼び出し元の変数名とカブっている場合(以下のコード片参照)とまったく同じです。\n\n```\n\n (defn foo [abc] (+ abc 100))\n (defn ...
23384
23390
23390
{ "accepted_answer_id": null, "answer_count": 1, "body": "依存が少なく(単体で動く)メール送信ライブラリはありますか? \nJavaMailなどではなく、通知用なのでとにかく送信だけのシンプルなものがいいです。 \n(メールサーバーを作らない、経由しない) \nCentOSでの`sendmail`コマンドのようなものが理想です。", "comment_count": 6, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T10:54:35.010", "favorite_count": 0, "id": "23389", "last_activity_date": "2016-09-29T16:07:43.093", "last_edit_date": "2016-09-29T16:07:43.093", "last_editor_user_id": "5519", "owner_user_id": "10346", "post_type": "question", "score": 6, "tags": [ "java" ], "title": "送信に特化したメール送信ライブラリ", "view_count": 1277 }
[ { "body": "Java で SMTP を扱うという観点なら [Apache Commons\nNet](http://commons.apache.org/proper/commons-net/) もあります。\n\nFTP や NNTP などのプロトコルも含まれていますので、jar は小さくはないですが。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-06-05T00:24:59.273", "id": "25463", "last_activity_da...
23389
null
25463
{ "accepted_answer_id": null, "answer_count": 1, "body": "拡張子wavやm4aの複数ファイルからmp4に一括変換したいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T11:12:28.153", "favorite_count": 0, "id": "23391", "last_activity_date": "2017-02-16T03:41:25.123", "last_edit_date": "2017-02-16T03:41:25.123", "last_editor_user_id": "49", "owner_user_id": "525", "post_type": "question", "score": -1, "tags": [ "ffmpeg" ], "title": "複数ファイルをffmpegで一括変換したい", "view_count": 9973 }
[ { "body": "```\n\n for f in *.wmv ; do ffmpeg -i $f $f.mp4; done\n \n```\n\nワンライナーでこのように書けると思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T11:12:28.153", "id": "23392", "last_activity_date": "2016-03-23T11:12:28.153", "last_edit_date": n...
23391
null
23392
{ "accepted_answer_id": null, "answer_count": 1, "body": "UnityでRigidBodyを使用せずに壁ずりを再現したいと考えているのですが、 \n2点わからないことがあり困っています。壁ずりについて調べたところ \n「進行方向ベクトル」と「衝突点の法線」を使用すれば、 \n「壁ずりベクトル」が出せるといことは理解できたのですが、 \n・衝突点の法線ベクトルの出し方 \n・実際に壁ずりベクトルを出した後にどのように使用すればいいのか \nが分かりません。出来れば計算式をコードで見せていただけるとすごく助かります…", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T11:37:43.560", "favorite_count": 0, "id": "23393", "last_activity_date": "2016-03-24T02:22:57.907", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14907", "post_type": "question", "score": 0, "tags": [ "unity3d" ], "title": "Unityでの壁ずり実装について質問させていただきます。", "view_count": 2368 }
[ { "body": "まず、衝突判定という面倒な計算を Unity や RigidBody(やCollider)\nコンポーネントなどが行っていることをご理解ください。それを使わないということは、同じことを自前で行うことになります。\n\n> ・衝突点の法線ベクトルの出し方\n\n壁と自分との衝突点を算出して、衝突した壁の法線を使います。 \nRigidbodyを使わないとなると Collider や Raycast\nも使わないとして、自前で壁の形状(メッシュの頂点や法線データ)を確認しつつ、自分の位置と移動ベクトルから衝突点を検索することになります。衝突判定にはポリゴンと線分の衝突か、2Dであれば線分同士の衝突...
23393
null
23405
{ "accepted_answer_id": null, "answer_count": 1, "body": "```\n\n <select class=\"form-control\" style=\"border-radius: 0!important;\">\n \n```\n\nを指定しました。\n\nMacのFirefoxでは四角になりましたが、MacのChromeでは角丸のままで変化がありませんでした。\n\n知ってらっしゃる方、方法など教えてください。 \nよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T13:40:08.300", "favorite_count": 0, "id": "23395", "last_activity_date": "2016-03-23T14:29:18.983", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14910", "post_type": "question", "score": 0, "tags": [ "html", "css", "bootstrap" ], "title": "Bootstrapテンプレートで、<select class=\"form-control\"> の角丸を四角にしたい", "view_count": 1850 }
[ { "body": "`-webkit-appearance:none;` を指定してください。\n\n```\n\n <select class=\"form-control\" style=\"border-radius: 0!important; -webkit-appearance:none;\">\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T14:29:18.983", "id": "23397", "last_a...
23395
null
23397
{ "accepted_answer_id": null, "answer_count": 1, "body": "<http://wisdom.sakura.ne.jp/system/winapi/win32/win85.html> \n上記のサンプルで二番目のリソースがエラーになる。\n\n```\n\n /*リソーススクリプト*/\n KITTY DIALOG 10 , 10 , 100 , 50\n FONT 12 , \"MS ゴシック\"\n CAPTION \"Magical nyan nyan TARUTO\" {\n LTEXT \"終了します\\nよろしいですか?\" , -1 , 5 , 5 , 90 , 20\n PUSHBUTTON \"OK\" , IDOK , 40 , 35 , 20 , 10\n PUSHBUTTON \"Cancel\" , IDCANCEL , 65 , 35 , 30 , 10\n }\n \n```\n\n上記の6行目のPUSHBUTTONでsynatx errorになります。また、これに付いては、`#include \"resource.h\"`で\n`#define IDOK 1001` の様にすると取り敢えずは動きますが。今度は、OKボタンを押してもIDOKを認識して来れません。\n\nなお、これに関しては7行目の\"Cancel\"に付いてもsyntax errorになります。何が悪いのでしょうか。\n\n済みません。悪い個所と正しい記述を回答願います。 \n宜しくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T13:55:36.887", "favorite_count": 0, "id": "23396", "last_activity_date": "2016-03-24T07:42:10.643", "last_edit_date": "2016-03-24T07:42:10.643", "last_editor_user_id": "49", "owner_user_id": "14909", "post_type": "question", "score": -1, "tags": [ "windows", "gcc" ], "title": "windows7 mingw windresでsyntax errorになる、修正個所を教えて下さい。", "view_count": 353 }
[ { "body": "> `#include \"resource.h\"`で `#define IDOK 1001`の様にすると取り敢えずは動きますが。\n\nWindows\nSDKでは`IDOK`は`1`に、`IDCANCEL`は`2`に予約されています。これらの定数を手動で`#define`しても誤りではありませんが、SDKが提供するヘッダファイル`winres.h`を`#include`した方がよいです。\n\n> 今度は、OKボタンを押してもIDOKを認識して来れません。\n\nリソース上でOKボタンに割り当てたID(あなたのコードでは`1001`)と、WindowsがOKボタンに期待するID(前述した`...
23396
null
23413
{ "accepted_answer_id": null, "answer_count": 0, "body": "Rを使って、図を作成する時に、 \nx-y座標のサイズを設定する方法について質問させていただいております。\n\n先に使用するサンプルデータ及び問題があるコードを書かせていただきます。\n\n以下のデータをsample.dataとして使用しています。\n\n```\n\n 1247211284201945,A-vector-1,0.028382835,0.327685692,0.288425494\n 1247211284201945,A-vector-10,-0.012618369,0.158331365,0.18369201\n 1247211284201945,A-vector-11,0.059614712,0.210239257,0.138845855\n 1247211284201945,A-vector-13,-0.07040885,-0.00684115,0.071109223\n 1247211284201945,A-vector-14,-0.043941759,0.166591033,0.223211813\n 1247211284201945,A-vector-15,0.026459552,-0.001095527,-0.023953769\n 1247211284201945,A-vector-16,0.054251654,-0.069467257,-0.11831891\n 1247211284201945,A-vector-17,0.058789968,0.021960568,-0.035599055\n 1247211284201945,A-vector-18,-0.035810968,0.029101298,0.05980141\n 1247211284201945,A-vector-19,-0.005040805,-0.020944664,-0.008700876\n \n```\n\nこのデータの3列目と4列目を使用する仮定してください。 \nそのときに使用したコードは、\n\n```\n\n library(hexbin)\n read.table(\"sample.data\", sep=',')->DATA\n bin<-hexbin(DATA[[3]], DATA[[4]], xbins=10, xbnds=range(-0.8,0.1), ybnds=range(-1,2))\n plot(bin, main=\"Hexagonal Binning\")\n \n```\n\nここでは、x座標を-0.8から0.1まで、y座標を-1から2までを想定しています。 \nしかし実際にplotしてみますと、 \nx座標は、-0.1から0.15、 \ny座標を、-0.4から0.4 \nになってしまっています。\n\nxbndsやc(),\nxlimなどいろいろなものを試したのですが、x-yのサイズを自分がほしいレンジに設定することができませした。webでも探してみましたが、設定の方法がわかりませんでした。\n\nもしhexbinを使用して図を作成するときに、x-yサイズを設定する方法をお知りの方は、ご教授をお願いします。よろしくお願いします。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T20:37:38.760", "favorite_count": 0, "id": "23398", "last_activity_date": "2016-03-23T20:37:38.760", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11048", "post_type": "question", "score": 4, "tags": [ "r" ], "title": "R {hexbin} libraryを使用してplotする時のx-y rangeの設定について", "view_count": 399 }
[]
23398
null
null
{ "accepted_answer_id": null, "answer_count": 2, "body": "制御が出来ません。何がいけないのですか?\n\n```\n\n package com.company;\n \n \n import java.io.*;\n import java.util.*;\n import java.util.concurrent.TimeUnit;\n \n \n public class Main {\n static boolean b = true;\n static Thread stdRun = null;\n public static void main(String[] args) {\n \n Runnable inputStreamThread = new Runnable(){\n public void run(){\n \n while(b){\n try{\n //System.out.println(\"Thread stdRun start\");\n TimerTask task = new TimerTask() {\n public void run() {\n b=false;\n }\n };\n Timer timer = new java.util.Timer();\n timer.schedule(task, TimeUnit.SECONDS.toMillis(1));\n while(true){\n System.out.println(\"テスト\");\n Thread.sleep(200);\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n b=false;\n }\n \n }\n \n };\n \n stdRun = new Thread(inputStreamThread);\n /* スレッドを開始します。 */\n stdRun.start();\n \n /* スレッドが終了するのを待機 */\n try {\n stdRun.join();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n \n System.out.println(\"スレッドは正常に終了\");\n \n }\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-23T21:14:38.670", "favorite_count": 0, "id": "23399", "last_activity_date": "2016-03-30T03:07:11.307", "last_edit_date": "2016-03-23T21:16:57.970", "last_editor_user_id": "3605", "owner_user_id": "14913", "post_type": "question", "score": -1, "tags": [ "java" ], "title": "スレッドをタイムスケジュールで終了させるプログラム", "view_count": 805 }
[ { "body": "もう少しやりたいことを明確にしていただけると助かるのですが、こういうことでしょうか?\n\n```\n\n import java.io.*;\n import java.util.*;\n import java.util.concurrent.TimeUnit;\n \n public class test {\n static boolean b = true;\n static Thread stdRun = null;\n public static void main(String[] args) {\n ...
23399
null
23400
{ "accepted_answer_id": null, "answer_count": 2, "body": "vmstat -a 5 で取得した、数日分のファイルがあります。 \nメモリ使用率の平均を算出するために、Freeの使用量平均を知りたいのですが、awkで加算すると桁溢れしてしまい、上手くいきません。\n\nシェルスクリプトの中で以下のように \nしています。\n\n```\n\n VAR=`awk '{m+=$4} END{print m/NR;}' ${myfile}`\n \n```\n\n良い方法がありましたら教えていただけないでしょうか。", "comment_count": 6, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T00:51:35.147", "favorite_count": 0, "id": "23401", "last_activity_date": "2016-03-24T07:47:03.250", "last_edit_date": "2016-03-24T03:59:29.767", "last_editor_user_id": "3054", "owner_user_id": "9807", "post_type": "question", "score": 4, "tags": [ "shellscript", "awk" ], "title": "awkで大きい数の平均を出そうとすると桁溢れしてしまう", "view_count": 2248 }
[ { "body": "### 表記の問題\n\n表示が指数表記(科学表記)になるのを避けるには、`printf`を使いフォーマットを指定する方法があります。\n\n```\n\n printf \"%d\\n\", m;\n \n```\n\n`OFMT`であらかじめ`print`(\"f\"が付かない方)が使うフォーマットを決めておく方法もあります。\n\n```\n\n BEGIN{OFMT=\"%d\"}\n \n```\n\n### データが巨大な場合\n\n今回の質問者さんのケースは違っていましたが、 \n巨大なデータの平均などを出す場合、一つの浮動小数点数に集積していく計算方法だ...
23401
null
23408
{ "accepted_answer_id": null, "answer_count": 0, "body": "php→mysqlへ接続ができず非常に困っています。 \nPHPのコードは以下になります。\n\n```\n\n <?php\n $mysqli=new mysqli('localhost','ユーザ名','ホスト名');\n \n if($mysqli->connect_error){\n die('Connect Error('.$mysqli->connect_errno.')'.$mysqli->connect_error);\n }else{\n echo \"接続成功\";\n }\n ?>\n \n```\n\n上記コードで試すとWarning: mysqli::mysqli(): (HY000/1045): Access denied for user\n'ユーザ名'@'localhost' (using password: YES) というエラーが発生します。 \n調べるとユーザ名かエラー名が間違っている際にこのエラーが発生すると記載があったので、DBからユーザ名、パスワードまで全て作り直して再度トライしたのですが、このエラーから抜け出せません。\n\nちなみに、パスワード名を空にすると接続成功になります。 \nもう長い間解決策を探し続けているのですが見つからず、、、どなたか教えていただければ大変助かります。\n\n宜しくお願いします。\n\n※※※ \nコメント有難うございました! \n先ほどphpmyadminをいじっていたら、PW有りで接続できました。 \n恐らく、ターミナル内ではなくphpmyadmin内でユーザ名、PW名を作成していなかったことが原因だと思います。\n\nただ、データベースへの接続はできたのですが、DBの選択ができません。 \nphpmyadmin内でDBを作成したのですが、php外部ファイルから指定するとエラーが起こります。 \nすみません、初心者なのでうまく説明できませんが、、、", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T01:14:34.447", "favorite_count": 0, "id": "23403", "last_activity_date": "2016-03-24T05:40:32.787", "last_edit_date": "2016-03-24T05:40:32.787", "last_editor_user_id": "14914", "owner_user_id": "14914", "post_type": "question", "score": 0, "tags": [ "php", "mysql" ], "title": "phpからmysqlへの接続", "view_count": 7016 }
[]
23403
null
null
{ "accepted_answer_id": null, "answer_count": 2, "body": "以前の質問の意図を簡略化するために改めて書いたコードですTimerTaskを使い制御するのでbreakなどの制御文は使えないです。何故Lをfalseにしてるのに終わらないのですか?\n\n```\n\n public class Main {\n \n public static void main(String[] args) {\n boolean K = true;\n boolean L = true;\n \n while(and(K,L)){\n System.out.println(\"test\");\n L = false;\n }\n }\n \n public static boolean and(boolean a, boolean b){\n if(a = true){\n if(b = true){\n return true;\n }\n }\n return false;\n }\n \n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T06:53:20.313", "favorite_count": 0, "id": "23410", "last_activity_date": "2016-05-14T04:53:51.683", "last_edit_date": "2016-03-24T07:25:22.837", "last_editor_user_id": "14913", "owner_user_id": "14913", "post_type": "question", "score": 4, "tags": [ "java" ], "title": "= での比較がうまくいかない", "view_count": 424 }
[ { "body": "`=`だと代入になります。比較演算子の `==` を使うと動くはずです。\n\n```\n\n if(a == true){\n \n```\n\nもしくは、\n\n```\n\n if(a){\n \n```\n\nだけでもいいですね。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T07:07:20.997", "id": "23411", "last_activity_date": "2016-03-24...
23410
null
23411
{ "accepted_answer_id": "23417", "answer_count": 1, "body": "以下のサイトの記事の右下にplusoneのカウント数が表示されていますが、この数字を取得したいです。 \n[https://play.google.com/store/apps/details?id=com.nintendo.zaaa&hl=ja](https://play.google.com/store/apps/details?id=com.nintendo.zaaa&hl=ja)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T07:28:35.763", "favorite_count": 0, "id": "23412", "last_activity_date": "2016-03-24T09:13:49.160", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10111", "post_type": "question", "score": 1, "tags": [ "python" ], "title": "Pythonでplusoneのカウント数取得する方法", "view_count": 88 }
[ { "body": "まず目的の要素をブラウザの開発ツールで調査します。 \nすると、G+のボタンは生成された`iframe`の中に入っている事が分かります。 \n`iframe`の`src`を見ると、パラメータがいろいろありますが、必要そうなのは`url`だけです。 \n`url`だけ残すとこの様になります。 \n<https://apis.google.com/u/0/_/+1/fastbutton?url=https%3A%2F%2Fmarket.android.com%2Fdetails%3Fid%3Dcom.nintendo.zaaa>\n\n後はこれをGETしてスクレイピングすればよいです。 \...
23412
23417
23417
{ "accepted_answer_id": "23467", "answer_count": 1, "body": "UITextFieldのテキストを省略表示させずにフォントサイズを小さくして、すべてのテキストを枠の中に表示させようとしています。 \nこのとき、minimumFontSizeとadjustsFontSizeToFitWidthを設定し、xibでも同様の設定を行いましたが、画像のようにUITextFieldの文字のフォントが変わらず省略表示されてしまいます。下記に添付したコードは、すべてviewDidLoadに書かれており、その他のライフサイクルのメソッドにはコードを書いておりません。\n\nUIButton,UILabelについてもadjustsFontSizeToFitWidthの設定を行い、比較すると、これら2つはフォントサイズが可変となり、枠内にすべて収まりました。 \n \n環境はiOS9.2, Xcode7.2.1となります。\n\nどなたか原因の分かる方いらっしゃいますでしょうか。\n\n```\n\n self.textField.minimumFontSize = 1.0f;\n self.textField.adjustsFontSizeToFitWidth = YES;\n [self.textField setText:@\"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW\"];\n self.textField.backgroundColor = [UIColor colorWithRed:241.0f/255.0f green:247.0f/255.0f blue:210.0f/255.0f alpha:1.0f];\n \n```\n\n[![UITextFieldとUIButton、UILabelの比較](https://i.stack.imgur.com/CN7fP.png)](https://i.stack.imgur.com/CN7fP.png)\n\n[![xib上での設定](https://i.stack.imgur.com/N4urW.png)](https://i.stack.imgur.com/N4urW.png)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T09:00:26.420", "favorite_count": 0, "id": "23415", "last_activity_date": "2016-03-26T00:42:29.597", "last_edit_date": "2016-03-25T00:48:18.670", "last_editor_user_id": "14923", "owner_user_id": "14923", "post_type": "question", "score": 1, "tags": [ "ios", "objective-c" ], "title": "UITextFieldですべてのテキストを枠に表示させたい", "view_count": 1705 }
[ { "body": "以下の質問は同様の現象ではないでしょうか。 \nこのページでの解決方法は、テキストをセットした、もしくはテキストが変化した時に適切なフォントを計算してフォントをセットし直しているようです。 \n[iphone - Can't get UITextField to autoshrink text - Stack\nOverflow](https://stackoverflow.com/questions/16350045/cant-get-uitextfield-\nto-autoshrink-text#comment35588809_16356147)", "comment_coun...
23415
23467
23467
{ "accepted_answer_id": null, "answer_count": 1, "body": "以下のリレーションのmodelがあります。\n\n```\n\n class Question\n has_many :answeres\n accepts_nested_attributes_for :answeres\n end\n \n \n class Answere\n belongs_to :question\n end\n \n \n```\n\nそのような前提の中、controller内で、 \n@question.answeres.attributes \nとしようとすると、\n\nNoMethodError: undefined method `attributes' for\n#Answere::ActiveRecord_Associations_CollectionProxy\n\nというエラーが出ます。\n\n```\n\n ※ ApplicationControllerは継承しております。記号をつけると、うまく表示されないため、省略\n \n class QuestionsController\n @question.answeres.attributes = answere_params\n \n private\n \n def answere_params\n xxxxxx\n end\n end\n \n \n```\n\n1対1のリレーションの時では、attributesメソッドは使用できるのですが、今回のような1対多の関係では、どのように実装するのが一般的なのでしょうか?\n\nなお、answere_paramsの実装は、デバッグ中に確認しており、動作は問題ありません。 \n期待する値が入っているのですが、それを、最終的に、answere内につめこみ保存したいです。\n\n不足点がございましたら補足致します。\n\n宜しくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T09:02:53.130", "favorite_count": 0, "id": "23416", "last_activity_date": "2016-04-23T11:09:39.683", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13175", "post_type": "question", "score": 0, "tags": [ "ruby-on-rails", "ruby" ], "title": "1対多の関係の際に、attributesメソッドがつかえず、次のエラーがでます。NoMethodError: undefined method `attributes' for #Answere::ActiveRecord_Associations_CollectionProxy", "view_count": 2366 }
[ { "body": "`@question.answers`は `answer`のコレクションになるので、`answer`\nの`attributes`を取得したい場合は以下のように呼び出せば良いと思います。\n\n```\n\n @question.answers.first.attributes\n \n```\n\nまた`@questions`に新しい`answer`を追加するには幾つかの方法がありますが、`build`を利用してみるはいかがでしょうか。\n\n```\n\n @anwser = @question.answers.build(answer_params)\n if @a...
23416
null
23418
{ "accepted_answer_id": "23466", "answer_count": 2, "body": "ActiveRecord::RecordNotFound in NotesController#showと表示されました。 \nCouldn't find Note with 'id'=showとさらに表示されました。 \nnotes_controller.rbのprivateメソット以下のset_noteメソットがおかしいようで \ndef set_note \n@note = Note.find(params[:id])←ここの部分がおかしい \nend \nと表示されました。 \nidがshowメソットに記されていないという認識で間違いないですよね? \nSequelProを見ても、notesテーブルにきちんと投稿したカラムにidが書かれています。 \n何かコマンドを打ち忘れ、データが反映されていないのでしょうか? \n回答お願いします。 \nroutes.rbは \nRails.application.routes.draw do\n\ndevise_for :users \nresources :users, only: [:index, :show, :edit, :update] \nresources :notes, only: [:show, :create, :edit, :update, :destroy]\n\nget'/top' => 'home#top'\n\nget'/connection' => 'home#connection' \nget'/notes/new' => 'notes#new' \npost'/notes' =>'notes#create' \nget'/notes' =>'notes#index' \nget'/show' =>\"notes#show\" \nget'/edit' =>'notes#edit' \npatch'/notes/:id' =>\"notes#update\",as:'update_note' \ndelete'/notes/:id' =>\"notes#destroy\",as:'destroy_note'\n\npost '/like/:note_id' => 'likes#like', as: 'like' \ndelete '/unlike/:note_id' => 'likes#unlike', as: 'unlike'\n\nroot 'home#top' \nget'/about' => 'home#about' \nend \nのようになっています。 \nidはshowである、のように記述していないのでは?と思って困っています。 \nお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T12:11:17.410", "favorite_count": 0, "id": "23420", "last_activity_date": "2016-03-25T23:57:34.960", "last_edit_date": "2016-03-25T01:56:12.323", "last_editor_user_id": "14754", "owner_user_id": "14754", "post_type": "question", "score": 0, "tags": [ "ruby-on-rails" ], "title": "ActiveRecord::RecordNotFound in NotesController#showの意味", "view_count": 3770 }
[ { "body": "`params[:id]`が\"show\"になっているようです。 \nこれは`http://server/notes/show`か`http://server/notes/show/1`のようなURLでnoteを表示(show)しようとしている、ということだと思います。実際は`http://server/notes/1`とか、`/notes/[id]`の形式で表示(show)します。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T21:00:3...
23420
23466
23432
{ "accepted_answer_id": null, "answer_count": 1, "body": "adb shellで使える実行可能なネイティブバイナリを作ったのですが、それをadb\nshellに入るコマンドと別に実行するとうまくいくのですが、一続きで実行するとうまくいきません。 \n解決策がお分かりの方是非教えていただけませんでしょうか。\n\nうまくいくコマンド\n\n```\n\n (C:\\user~)$ adb shell\n (adb shell上)$ /data/local/tmp/makeaction < /mnt/sdcard/testtap.txt\n \n```\n\nうまくいかないコマンド(これをうまくいかせたい)\n\n```\n\n (C:\\user~)$ adb shell /data/local/tmp/makeaction < /mnt/sdcard/testtap.txt\n 指定されたパスが見つかりません。\n \n```\n\nちなみに、どこまでうまくいっているか調べるために以下のように実行したところmakeactionが実行されているのは確認できました。\n\n```\n\n (C:\\user~)$ adb shell /data/local/tmp/makeaction\n \n```\n\nさらに以下のように実行するとエラーは出ないものの先程のmakeactionのみで実行したときと同じ実行結果となりました。\n\n```\n\n adb -s HT36MS908593 shell /data/local/tmp/makeaction < C:\\testtap.txt\n \n```\n\nこれらより「<」の右の指定先には何らかの制限があるのかと思うのですがここでつまずいております。 \nどうかよろしくお願いします。\n\nちなみに、こちらのサイトを参考にさせていただきました。 \n<http://techblog.qoncept.jp/?p=397>", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T12:53:50.227", "favorite_count": 0, "id": "23421", "last_activity_date": "2016-03-24T14:04:44.963", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14924", "post_type": "question", "score": 1, "tags": [ "adb" ], "title": "adb shell で「<」がうまくいかない", "view_count": 1563 }
[ { "body": "```\n\n adb shell ”/data/local/tmp/makeaction < /mnt/sdcard/testtap.txt”\n \n```\n\nのようにコマンド全体を「\"」や「'」でクォートしてみて下さい。\n\n`<`はリダイレクト記号で、これを解釈してファイルをコマンドの標準出力に繋げるのはシェルの役目です。 \n問題は「どちらの」シェルがこの記号を解釈して、リダイレクトを実行しているかです。\n\n```\n\n adb shell /data/local/tmp/makeaction < /mnt/sdcard/testtap.txt\n ...
23421
null
23423
{ "accepted_answer_id": "23434", "answer_count": 1, "body": "プログラミングの技術文章を書いているのですが、書いた文章のライセンスについて質問させてください。 \nプログラミングの技術文章には、ソースコードとソースコードに対する解説文章や図表などが含まれますが、それぞれに別々のライセンスをつけたいと考えています。\n\nソースコード: CC0(Public domain) \n解説文章や図表: CC-BY\n\nソースコードにはGPLやMITなどのライセンスがありますが、ここでは再配布時に著作権を表示不要なCC0(Public\nDomain)をつけたいと考えています。 \n一方文章や図表には、著作権表示が必要なCC-BYライセンスをつけたいと考えています。\n\nこの場合、ライセンスはどのように記載したらよいのでしょうか? \nそもそもこのようなライセンスのつけ方は認めてられないのでしょうか? \nライセンスに関して最近学び始めたばかりであまり詳しいことが分かっていないので、ご教授いただけると助かります。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T13:53:48.480", "favorite_count": 0, "id": "23422", "last_activity_date": "2016-03-25T04:20:56.613", "last_edit_date": "2016-03-24T15:37:31.377", "last_editor_user_id": "8000", "owner_user_id": "14114", "post_type": "question", "score": 4, "tags": [ "ライセンス" ], "title": "複数のクリエイティブ・コモンズ・ライセンスの併用について", "view_count": 317 }
[ { "body": "その技術文書、およびソースコードに適切なライセンスを明記すれば良いと思います。次はGo言語の例ですが、ウェブサイトの内容(文章と図表)はCC3.0、ソースコードはBSDライセンスであることが明記されています。\n\n> Except as noted, the content of this page is licensed under the \n> Creative Commons Attribution 3.0 License, and code is licensed under a \n> BSD license.\n\n<https://golang.org/> (フッターに...
23422
23434
23434
{ "accepted_answer_id": "23427", "answer_count": 2, "body": "Go の初心者です。\n\nGolang で、正しく動いている次のコードがあります。\n\n```\n\n package main\n \n import \"os/exec\"\n import fmt \"fmt\"\n \n func main() {\n \n c, _ := exec.Command(\"git\", \"log\", \"--first-parent\", \"--merges\").Output()\n s := string(c[:])\n fmt.Printf(s)\n }\n \n```\n\n* * *\n\nこれの、コマンド実行部分を関数に切り出そうとして、次のように変更を行いました。\n\n```\n\n package main\n \n import \"os/exec\"\n import fmt \"fmt\"\n \n func executeCommand(command ...string) string {\n c, _ := exec.Command(command...).Output()\n return string(c[:])\n }\n \n func main() {\n \n s := executeCommand(\"git\", \"log\", \"--first-parent\", \"--merges\")\n fmt.Printf(s)\n }\n \n```\n\nすると、次のエラーが発生します。\n\n```\n\n # command-line-arguments\n ./calc.go:7:27: error: argument 1 has incompatible type\n c, _ := exec.Command(command...).Output()\n ^\n ./calc.go:7: confused by earlier errors, bailing out\n \n```\n\n`command...` で、受け取った配列を展開して、 `exec.Command()`\nに引き渡せるものだと思っていたのですが、上記の通りそうはなっていないです。\n\n* * *\n\n質問:\n\n * 私は、何を間違えているのでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T14:54:57.740", "favorite_count": 0, "id": "23426", "last_activity_date": "2016-03-24T16:27:39.610", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "754", "post_type": "question", "score": 2, "tags": [ "go" ], "title": "golang で受け取った可変長引数を他の可変長引数に渡したい", "view_count": 2297 }
[ { "body": "エラーメッセージにあるとおりです。 `exec.Command` は第1引数は `string` なので、スライスではなく `string`\nを渡す必要があります。\n\n<https://golang.org/pkg/os/exec/#Command>\n\n```\n\n package main\n \n \n import (\n \"fmt\"\n \"os/exec\"\n )\n \n func executeCommand(command ...string) string {\n c, _ :...
23426
23427
23427
{ "accepted_answer_id": null, "answer_count": 0, "body": "現在作成中のアプリにて、解像度 1280 * 720 (16:9) で画面を設計しました。 \n解像度2560 * 1440 のアンドロイド端末で問題なく見ることができていました。 \n本日、ナビゲーションバーが出ていないことに気づいて、ナビゲーションバーを出すように設定したところ、表示がおかしくなりました。(縮小された) \n※ Unityのcanvasの設定で解像度設定をしているため、全体が入るように縮小されたと思われます。\n\nここで質問なのですが、 \n1\\.\n端末スペックなどで言われている解像度は、ナビゲーションバーを含んだ解像度であって、実際のアプリで使える範囲の解像度は、それより小さくなるということでしょうか? \n2.ナビゲーションバーを表示するアプリ(表示されているアプリが多いと思いますが)は、ナビゲーションバーの高さを考慮して作成されているのでしょうか? \n3\\. ナビゲーションバーの高さの取得仕方を調べたところ、Unityでは取得できないようなのですが、対処法はありますでしょうか?\n\n開発終盤で解像度が変わる自体になりそうで、大変困ってます。 \nよろしくお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T17:32:37.817", "favorite_count": 0, "id": "23430", "last_activity_date": "2016-03-24T17:32:37.817", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13198", "post_type": "question", "score": 1, "tags": [ "android" ], "title": "Android のナビゲーションバーと解像度の関係について", "view_count": 360 }
[]
23430
null
null
{ "accepted_answer_id": "23436", "answer_count": 1, "body": "monacaでスライディングメニュー機能が付いたアプリを作成しております。 \nそこにbxsliderをのせているのですが、bxsliderを操作しようとスワイプするとスライディングメニューが一緒に出てきてしまいます。 \nbxsliderのオプション等いろいろ試してみたのですが、うまくいきません。\n\nスライディングメニューを生かしたままでbxslider上のスワイプ操作だけはスライディングメニューが反応しないようにするにはどうしたらいいでしょうか?\n\nどなたかわかる方ご教授お願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-24T23:06:30.103", "favorite_count": 0, "id": "23433", "last_activity_date": "2016-03-25T01:20:57.530", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13685", "post_type": "question", "score": 0, "tags": [ "javascript", "monaca" ], "title": "monacaでスライディングメニューとbxsliderのスワイプ操作が干渉してしまう。", "view_count": 190 }
[ { "body": "`bxslider`の仕組みだけじゃ厳しいんじゃないかなぁ \n…と言うのもスワイプ操作時に親のドキュメントごと動いちゃうので \n親のドキュメント(`ons-page`)が動くとスライディングメニューが反応します。 \n対策は2つほどパッと思いつく感じですが、、、\n\n1.スワイプ判定を自分で行う \nこちらはややハードルが高いかもしれませんが \nタッチイベントを取得するとタッチされたエレメントを取得できます。 \nそのエレメントの親要素に`bxslider`が存在しなければスライド方向を認識して \n`sideMenu.open()`で開いてやれば良いんでないかな?\n\n...
23433
23436
23436
{ "accepted_answer_id": "23511", "answer_count": 1, "body": "Ruby で画像URLをスクレイピングしたいです。\n\n```\n\n <div> \n <a href=\"URL\" titile=\"xxx\"> \n <img alt=\"yyy\" src=\"ここのURLをクスレイピングしたいです> \n </a>\n \n```\n\n以下のように記述しました。\n\n```\n\n require 'mechanize'\n \n agent= Mechanize.new \n page = agent.get(\"取得したいサイトURL\") \n elements = page.search('a img')\n \n elements.each do |ele| \n puts ele.get_attribute('src') \n end \n \n```\n\nそして、`ruby\nscraping_image.rb`をターミナルに記載しENZTERキーを押したのですが、ターミナルにただ大きな空欄が出来るだけで、何も欲しい情報が得られませんでした。 \nエラーメッセージ等は表示されませんでした。\n\n違うタグを取得するように記述するべきだったでしょうか? \nお願いします。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T01:58:19.420", "favorite_count": 0, "id": "23437", "last_activity_date": "2016-03-27T14:07:17.790", "last_edit_date": "2016-03-27T13:35:55.567", "last_editor_user_id": "3054", "owner_user_id": "14754", "post_type": "question", "score": 2, "tags": [ "ruby" ], "title": "画像URLスクレイピング", "view_count": 640 }
[ { "body": "質問のコードは私の手元でも動きました。間違いは無さそうです。 \n下記のように`src`属性だけでなく、要素ごと出力して様子を見るとよいでしょう。 \n\n```\n\n puts ele\n puts ele.get_attribute('src') \n \n```\n\n問題があるとすれば、取得しているWebページの構造です。 \n「`a`タグの下に`img`タグがあり、それが`src`属性を持っている」というのが想定する構造ですが、そうはなっていないのでしょう。 \n「空欄」が出力されたという事は`img`タグは発見されているが、それに`src`属性が無いか`s...
23437
23511
23511
{ "accepted_answer_id": "23497", "answer_count": 2, "body": "Monacaのonsen uiを使用しています。 \nons-list-itemタグのmodifierの内容を動的に変更したいのですが、可能なのでしょうか?\n\npageinitで、$('#ons-list-item').attr('modifier',\n'chevron')をしても、console.log上は変更されていますが、画面は\">\"マークが出てこなく、クリックしても反応しません。\n\nどなたかご存知の方いましたら、ご教示ください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T02:16:38.093", "favorite_count": 0, "id": "23439", "last_activity_date": "2016-03-27T03:02:34.637", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14931", "post_type": "question", "score": 0, "tags": [ "monaca", "onsen-ui" ], "title": "onsen uiのons-list-itemタグのmodifierに関して", "view_count": 1544 }
[ { "body": "jQueryのattr('modifier', 'chevron')で追加できますよ。 \n他のコードに誤りはありませんか? \n$('#ons-list-item')とありますが、#はIDを指定するセレクタなので、ここが間違っているのではないでしょうか。\n\n```\n\n <ons-list-item class=\"hoge\">\n \n```\n\nのようにしておいて、\n\n```\n\n $('.hoge').attr('modifier', 'chevron');\n \n```\n\nで出来ると思います。", "comment_count"...
23439
23497
23457
{ "accepted_answer_id": null, "answer_count": 1, "body": "【環境】: CentOS or Ubuntu\n\n高トラフィック時にどこから攻撃が来ているか等をiptablesのハッシュリミットを用いて対策しています。 \nこちらで決めた閾値を超えたsrcipはログを取るようにしています。\n\n似たようなことになるかと思いますが、tcpdumpだけでリアルタイムにどこからアクセス(攻撃元)が来ているかどうかを判別することは可能でしょうか?\n\n普通にtcpdump -i IF名 オプションで実行しても、どれが攻撃元かを判別するのは難しいと思います。\n\n1分間(特に時間指定はいりませんが)に異常なアクセス(他のsrcipに比べて大量のアクセス)があるようなホストだけをしぼってtcpdumpさせるような技(オプションまたは手法)をご存じの方がいらっしゃいましたら、ご教示頂けませんでしょうか?\n\n不可能であるようならば、一言ムリと教えて頂くだけでも幸いです。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T02:35:19.530", "favorite_count": 0, "id": "23440", "last_activity_date": "2016-10-01T19:51:29.057", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14384", "post_type": "question", "score": -1, "tags": [ "linux", "tcpdump" ], "title": "高トラフィック時における tcpdump の使い方について", "view_count": 289 }
[ { "body": "Linuxでサクッと確認したいなら、 \ntcptrackやiftopなど。\n\nちゃんとやるならnetflowとかsflowとかですね。 \n<http://labs.gree.jp/blog/2015/12/15515/>\n\nあとはIDSですかね。\n\n>\n> 1分間(特に時間指定はいりませんが)に異常なアクセス(他のsrcipに比べて大量のアクセス)があるようなホストだけをしぼってtcpdumpさせるような技(オプションまたは手法)をご存じの方がいらっしゃいましたら、ご教示頂けませんでしょうか?\n\nありません。", "comment_count": 0, ...
23440
null
29290
{ "accepted_answer_id": null, "answer_count": 1, "body": "Ruby on Railsで管理画面を作っています。 \nリストページで全ての行の前にCheckBoxを置いて、Checkされた行を全部削除したいんです。\n\n下記は自分のコードです。\n\n```\n\n table.table.table-bordered.table-striped\n thead\n tr\n th\n th #\n th 会社コード\n tbody\n - @companies.each do |company|\n tr\n td.text-right = company.Id\n td = company.CompanyCode\n td.text-center = link_to '詳細', company, class: 'badge bg-green'\n td.text-center = link_to '修正', edit_company_path(company), class: 'badge bg-light-blue'\n td.text-center = link_to '削除', company, data: {:confirm => '本当に削除してもよろしいでしょうか?'}, :method => :delete, class: 'badge bg-red'\n \n```\n\ncontroller\n\n```\n\n before_action :set_company, only: [:show, :edit, :update, :destroy]\n \n # GET /company\n def index\n @companies = Company.all\n end\n \n # GET /company/1\n def show\n end\n \n # GET /company/new\n def new\n @company = Company.new\n end\n \n # GET /company/1/edit\n def edit\n end\n \n # POST /companies\n def create\n @company = Company.new(company_params)\n \n if @company.save\n redirect_to @company, notice: 'company was successfully created.'\n else\n render :new\n end\n end\n \n # PATCH/PUT /companies/1\n def update\n if @coupon2_type.update(coupon2_type_params)\n redirect_to @coupon2_type, notice: 'Coupon2 type was successfully updated.'\n else\n render :edit\n end\n end\n \n # DELETE /companies/1\n def destroy\n @company.destroy\n redirect_to companies_url, notice: 'Company was successfully destroyed.'\n end\n \n private\n \n # Use callbacks to share common setup or constraints between actions.\n def set_company\n @company = Company.find(params[:id])\n end\n \n # Only allow a trusted parameter \"white list\" through.\n def company_params\n params.require(:company).permit(:CompanyCode)\n end\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T02:55:46.243", "favorite_count": 0, "id": "23441", "last_activity_date": "2023-05-01T04:03:10.320", "last_edit_date": "2016-03-25T03:01:37.617", "last_editor_user_id": "10710", "owner_user_id": "10710", "post_type": "question", "score": 0, "tags": [ "ruby-on-rails" ], "title": "Railsでリストから複数の行を削除する方法", "view_count": 924 }
[ { "body": "`check_box_tag`の中に配列を置き、それを用いてコントローラ側で削除すればうまくいくと思います。 \n`<%= check_box_tag \"words_info[]\",word.id %>` \nこんな感じです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2017-01-25T07:30:52.710", "id": "32145", "last_activity_date": "2017-01-25T07:30:52.710"...
23441
null
32145
{ "accepted_answer_id": "23491", "answer_count": 1, "body": "`docker-machine create` コマンドで作成した VM に保存した `~/.ssh/my_id_rsa` ファイルが、VM\nの再起動時に消えてしまいます。ドキュメントを読んでもこの現象に該当する記述が見当たらず、どうしたものかと悩んでいます。\n\nホストマシンは Mac OS (El Capitan) で、docker-machine のバージョンは次の通りです。\n\n```\n\n $ docker-machine version\n docker-machine version 0.6.0, build e27fb87\n \n```\n\nまた、VM は次のオプションで作成しました。\n\n```\n\n $ docker-machine create --driver virtualbox dev\n \n```\n\nもし何か思い当たることがあれば、教えていただけると助かります。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T05:10:47.267", "favorite_count": 0, "id": "23443", "last_activity_date": "2016-03-26T14:10:23.940", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13623", "post_type": "question", "score": 1, "tags": [ "docker" ], "title": "Docker Machine で ~/.ssh/MY_KEY を正しく保存する方法", "view_count": 124 }
[ { "body": "一日待って回答を得られなかったので、[本家](https://stackoverflow.com/questions/36232018/how-can-i-\nsave-my-rsa-key-in-my-docker-machine)の方で質問してみました。\n\nこれによると、`boot2docker`は `/var/lib/boot2docker` ディレクトリにあるデータをのぞいて、起動時に\n`boot2docker.iso` の内容で初期化されるから次の二つの方法のいずれかで回避するといい、とのことでした。\n\n * 鍵をホストの `/Users/any/path/you/want...
23443
23491
23491
{ "accepted_answer_id": null, "answer_count": 1, "body": "以下の様な問題を考えます。\n\nxy平面上でまず、原点Oからx軸に沿って、長さr_1移動します(この時、角度θ_1=0)。 \n次に、角度θ_2で長さr_2移動し、さらに角度θ_3で長さr_3移動し、 \nその後も同様に続けていきます。 \n以下の図の青い線で、上記の移動を示しています。\n\n[![座標遷移の図](https://i.stack.imgur.com/qVLDK.jpg)](https://i.stack.imgur.com/qVLDK.jpg) \nここで例えば、 \n図の赤い点線の長さであるs_3やs_4、 \n赤い点線とx軸との角度であるφ_3やφ_4は、 \nrとθを用いてどのように計算できるでしょうか?\n\nまた、s_nやφ_nは、rとθを用いてどのような一般式で計算できるでしょうか?\n\n最終的には、三次元極座標系において一般化したいと思っています。\n\nよろしくお願いします。", "comment_count": 6, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T08:04:56.937", "favorite_count": 0, "id": "23447", "last_activity_date": "2016-03-25T10:39:07.640", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12874", "post_type": "question", "score": -1, "tags": [ "数学" ], "title": "極座標における点の移動を計算したい", "view_count": 1300 }
[ { "body": "iステップ後の位置を`p_i`としてベクトル表示をすると`p_i=(sum(r_i*cos(D_i),sum(r_i*sin(D_i)))`とかけます.\nここで`D_i`はiステップめの進行方向のx軸からみた角度でとします. `D_i`は`sum(pi-theta_i)` とかけます.\nこの`p_i`を使えばベクトルの長さ `s_i` は `s_i=sqrt(p_i_x**2+p_i_y**2)`とかけます.\n角度は`phi_i=arctan(p_i_y/p_i_x)`です.", "comment_count": 1, "content_license": "CC BY-S...
23447
null
23454
{ "accepted_answer_id": "23474", "answer_count": 1, "body": "お世話になります。タイトルで書いたことをやりたいのですがエラーが発生します。 \n最初から順に書きますので漏れなどあればご教示ください。\n\nMonacaを使用しています。\n\n1.新規プロジェクトから「Onsen UI最小限のテンプレート(ユニバーサルアプリ対応版)」を選択 \n2.「ファイル」-「Cordavaプラグインの管理」から「Cordovaプラグインのインポート」をクリック \n3.「ZIP形式のプラグイン」を選んで、[配布元](https://github.com/ch000/cordova-\nimagePicker)から落としたZipをインポート \nインポート結果が下記画像になります。 \n[![画像の説明をここに入力](https://i.stack.imgur.com/BhERD.png)](https://i.stack.imgur.com/BhERD.png)\n\n4.index.htmlのscript内を下記に変更\n\n```\n\n <script>\n ons.bootstrap();\n if(typeof device === 'undefined'){\n document.addEventListener(\"deviceready\", onDeviceReady, false);\n }else{\n onDeviceReady();\n }\n \n function onDeviceReady() {\n try{\n window.imagePicker.getPictures(\n function(results) {\n for (var i = 0; i < results.length; i++) {\n console.log('Image URI: ' + results[i]);\n }\n }, function (error) {\n console.log('Error: ' + error);\n }\n );\n } catch(e){\n alert(e);\n \n }\n }\n </script>\n \n```\n\nIOS9.3でMonacaデバッガーから起動すると下記エラーが発生 \n「TypeError: Cannot read property 'getPictures' of undefined」 \nカメラプラグインを有効にすると \n「TypeError: undefined is not an object (evaluating\n'window.imagePicker.getPictures')」となります。\n\n追記: \nDeviceプラグインとinAppBrowserプラグインも追加しております。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T08:06:51.877", "favorite_count": 0, "id": "23448", "last_activity_date": "2016-03-27T02:31:55.363", "last_edit_date": "2016-03-27T02:31:55.363", "last_editor_user_id": "13177", "owner_user_id": "13177", "post_type": "question", "score": 0, "tags": [ "monaca", "cordova" ], "title": "cordova-imagePickerで画像を表示・選択する方法", "view_count": 747 }
[ { "body": "冒頭のif文でdevicereadyが発火済みかどうかチェックしているのだと推測しますが、window.deviceが存在することはdevicereadyが完了していることを保証しません。したがってdevicereadyイベントの発火前にonDeviceReady()関数が呼ばれたためにエラーになっているのでしょう。 \nまた、\n\n```\n\n document.addEventListener(\"deviceready\", onDeviceReady, false);\n \n```\n\nで登録された関数はdevicereadyが既に発火済みの場合は即時実行されますの...
23448
23474
23474
{ "accepted_answer_id": null, "answer_count": 2, "body": "netbeans8.1でエラーでもない文が強調表示されます。 \nコンパイルすると普通に実行できます。 \nどうしたらいいですか \nウブンツ15.10\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/wJcKg.png)](https://i.stack.imgur.com/wJcKg.png)", "comment_count": 5, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T08:34:25.180", "favorite_count": 0, "id": "23449", "last_activity_date": "2016-03-26T12:31:41.297", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14937", "post_type": "question", "score": 0, "tags": [ "netbeans" ], "title": "エラーでもない文が強調表示される", "view_count": 605 }
[ { "body": "最近などコンパイラ周辺への変更を行った経験がある場合は\n\n```\n\n sudo apt-get autoremove\n \n```\n\nたいてい、複数のバージョンが存在します \n私は、アセンブラ命令のコンパイルでエラーが出た\n\nそれ以外の方はディレクトリの記述を確認してください(ほんとに記述されていないのならコンパイルはできないはずですが。。。)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T10:40:38.307...
23449
null
23484
{ "accepted_answer_id": null, "answer_count": 2, "body": "画面入力値の西暦を、和暦に変換する必要があり、質問します。 \n以下スースの通り作成したのですが、入力値の「月」が+1されてしまいます。 \n解決法を教えてください。\n\n入力値(以下ソースのcalender.set(2016, 3, 24);部分) → 2016, 3, 24 \n実行結果 → 平成28年4月30日\n\nとなり3月となってほしいのに4月となってしまいます。\n\n```\n\n import java.text.*;\n import java.util.*;\n \n public class MyTest {\n public static void main(String[] args) {\n Locale defaultLocale = new Locale(\"ja\", \"JP\", \"JP\");\n DateFormat japaneseFormat = new SimpleDateFormat(\"GGGGy年M月d日\",\n defaultLocale);\n \n Calendar calender = Calendar.getInstance();\n calender.set(2016, 3, 24);\n \n System.out.println(japaneseFormat.format(calender.getTime()));\n }\n }\n \n```\n\nポイントは、システム日付ではなく、外部から与えられた引数で西暦→和暦に変換したいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T10:19:12.190", "favorite_count": 0, "id": "23455", "last_activity_date": "2016-03-28T02:09:23.557", "last_edit_date": "2016-03-25T10:42:34.240", "last_editor_user_id": "46", "owner_user_id": "14939", "post_type": "question", "score": 1, "tags": [ "java" ], "title": "javaで西暦→和暦変換がうまくいかない", "view_count": 8085 }
[ { "body": "Javadocにもひっそり書いてあるのですが、月は0始まりのためですね。\n\n[Calendar#set(int, int, int) (Java Platform SE 8\n)](https://docs.oracle.com/javase/jp/8/docs/api/java/util/Calendar.html#set-\nint-int-int-)\n\n> month - MONTH カレンダフィールドの設定に使用する値。Month 値は 0 から始まる (1 月は 0 になる)。\n\n3月にするためには、\n\n```\n\n calender.set(2016,...
23455
null
23456
{ "accepted_answer_id": null, "answer_count": 1, "body": "最近, プログラミング言語を勉強し始めまして, pythonとrubyに興味を持ちました。\n\nその言語自体のソースコードを見てみると, C言語で記述されているのが分かったのですが, 多くのファイルから成っていることが分かり,\n途端に複雑さが増して混乱しています。\n\nこういった大きなプロジェクトのソースコードリーディングのやり方を教えてください。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T12:12:30.693", "favorite_count": 0, "id": "23458", "last_activity_date": "2016-03-26T13:59:19.733", "last_edit_date": "2016-03-25T17:02:02.563", "last_editor_user_id": "754", "owner_user_id": "14941", "post_type": "question", "score": 1, "tags": [ "c" ], "title": "ソースコードリーディングについて", "view_count": 520 }
[ { "body": "プログラムにはいろいろな種類がありますが、その中でもコンパイラやインタプリタといった言語処理系は特に複雑な部類に入りますので、そのソースコードを読むのも難易度が高くなります。処理する側(例えばC)と処理される側(RubyやPython)両方の知識が必要な上、構文解析などコンピュータ科学の幅広い知識も必要です。\n\nRubyやPythonで(または言語は問わずに)プログラムを書くのが目的なのであれば処理系自身のソースコードが読めることは必須ではありません。それぞれの言語の入門書やなどで勉強されるとよいでしょう。\n\nRubyやPythonがどのように動いているかという言語処理系としての仕組みが...
23458
null
23489
{ "accepted_answer_id": "23465", "answer_count": 2, "body": "Routing Errorを解決したいです。`No route matches [POST]\n\"/like/4\"`とさらに表示されました。POSTが合わないということですよね?\n\nroutes.rbには下記のように記述しました。\n\n```\n\n Rails.application.routes.draw do\n \n devise_for :users\n resources :users, only: [:index, :show, :edit, :update,:like]\n resources :notes, only: [:show, :create, :edit, :update, :destroy,:like]\n \n get'/top' => 'home#top'\n \n get'/connection' => 'home#connection'\n get'/notes/new' => 'notes#new'\n post'/notes' =>'notes#create'\n get'/notes' =>'notes#index'\n patch'/notes/:id' =>\"notes#update\",as:'update_note'\n delete'/notes/:id' =>\"notes#destroy\",as:'destroy_note'\n \n post '/like/notes/:id' => 'likes#like', as: 'like' # ←←\n delete '/unlike/notes/:id' => 'likes#unlike', as: 'unlike'\n \n root 'home#top'\n get'/about' => 'home#about'\n end\n \n```\n\n`←←`で示したところにpost のコードを記載し、rake routesを確認したところ、\n\n```\n\n like_path POST /like/notes/:id(.:format) likes#like \n unlike_path DELETE /unlike/notes/:id(.:format) likes#unlike \n \n```\n\nのようになっており、post と記載すべきなのになぜエラーが出るのか?と思いました。 \nどのように記述すべきなのでしょうか? \nお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T13:06:35.073", "favorite_count": 0, "id": "23459", "last_activity_date": "2016-03-25T23:45:14.613", "last_edit_date": "2016-03-25T16:09:37.703", "last_editor_user_id": "3068", "owner_user_id": "14754", "post_type": "question", "score": 0, "tags": [ "ruby-on-rails" ], "title": "Routing Error No route matches [POST] \"/like/4\"", "view_count": 1119 }
[ { "body": "routesに`post '/like/notes/:id'`で指定しているのですが、エラーに`/like/4`でアクセスしようとしていると書いてあります。 \n`post '/like/notes/:id'`を`post\n'/like/:id'`に変えるか、または`/like/4`でアクセスしようとしているコードを変えるかのどちらかで解決できます。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T14:05:12.317", "id":...
23459
23465
23460
{ "accepted_answer_id": null, "answer_count": 1, "body": "こんにちは。python3で作ったこちらの再帰関数が上手く機能しません。\n\n```\n\n def func(teleports_string):\n strings = [{n[0],n[1]} for n in teleports_string.split(',')]\n start = {'1'}\n \n def search(strings,point,totalpoint):\n for string in strings:\n \n if point <= string and not string.difference(point) <= totalpoint:\n \n if len(totalpoint.union(point)) >= 7:\n \n print(totalpoint)\n return totalpoint\n \n search(strings,string.difference(point),totalpoint.union(string))\n return search(strings,start,set())\n \n func(\"12,23,34,45,56,67,78,81\")\n \n```\n\n上記のコードの \n`return totalpoint` \nの行で`totalpoint`を戻り値として処理を終了させたいのですが、 \n残りの処理を始めてしまいます。 \nどのようにすれば、`return totalpoint`で処理を終わらせられるでしょうか。 \nご教授下さい。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T15:42:15.057", "favorite_count": 0, "id": "23461", "last_activity_date": "2016-03-25T17:00:36.723", "last_edit_date": "2016-03-25T16:14:40.247", "last_editor_user_id": "3605", "owner_user_id": "14943", "post_type": "question", "score": 0, "tags": [ "python", "アルゴリズム" ], "title": "python3で深さ優先探索の再帰関数が上手く機能しない", "view_count": 742 }
[ { "body": "`search` 関数の最後で自分自身を再帰的に呼び出していますが、\n\n```\n\n search(strings,string.difference(point),totalpoint.union(string))\n \n```\n\nここに `return` がないので、再帰から戻ってきた後も、外側の `for string in strings:`\nを続けて実行しています。しかも、最終的には return なしで関数が終了しているので、何も戻り値を返していません(厳密には `None`\nを返していますが)。", "comment_count": 0, ...
23461
null
23462
{ "accepted_answer_id": "23477", "answer_count": 1, "body": "git 上で、あるコミット A から別のコミット B までの間で、削除・追加・変更されたファイルについて、それぞれの一覧が取得したいです。\n\nこれを実現する方法はありますでしょうか。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T17:22:02.683", "favorite_count": 0, "id": "23463", "last_activity_date": "2016-03-26T06:57:37.327", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "754", "post_type": "question", "score": 5, "tags": [ "git" ], "title": "git で、削除・追加・変更されたファイル一覧を取得するには?", "view_count": 11011 }
[ { "body": "`git diff --name-status A..B` で一覧が表示されます。\n\n```\n\n A file1\n M file2\n D file3\n \n```\n\n行頭の A, M, D は、それぞれ追加, 変更, 削除されたことを意味します。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T06:57:37.327", "id": "23477", "last_activ...
23463
23477
23477
{ "accepted_answer_id": null, "answer_count": 1, "body": "anacondaをpyenv経由でインストールしようとしたら以下のエラーがでました。環境は Debian (jessie) です。\n\n```\n\n /tmp/python-build.20160326063823.3417 ~\n curl: (60) SSL certificate problem: unable to get local issuer certificate\n More details here: http://curl.haxx.se/docs/sslcerts.html\n \n curl performs SSL certificate verification by default, using a \"bundle\"\n of Certificate Authority (CA) public keys (CA certs). If the default\n bundle file isn't adequate, you can specify an alternate file\n using the --cacert option.\n If this HTTPS server uses a certificate signed by a CA represented in\n the bundle, the certificate verification probably failed due to a\n problem with the certificate (it might be expired, or the name might\n not match the domain name in the URL).\n If you'd like to turn off curl's verification of the certificate, use\n the -k (or --insecure) option.\n```\n\n調べてみたところ、ルート証明書が古いため出るエラーだそうですね。 \nそこで <https://curl.haxx.se/ca/cacert.pem>\nから、新しいルート証明書を引っぱり、以下に示したサイトの方法で解決を試みました。\n\n> 1. 使ってる認証局(globalsignとかverisign)のルート証明書を手に入れる。拡張子は.crtに。\n> 2. /usr/share/ca-certificates以下に、1のxxxx.crt を置く。\n> 3. /etc/ca-certificates.confに、2のpathを書\n> 4. update-ca-certificatesを実行して、更新 \n> (<http://kamatari.github.io/blog/2015/03/12/how-to-install-root-\n> certificate-on-debian/> より引用)\n>\n\nしかし結果は変わらず・・・解決手段を教えていただきたいです。", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-25T22:34:01.727", "favorite_count": 0, "id": "23464", "last_activity_date": "2016-04-04T10:15:42.920", "last_edit_date": "2016-04-04T10:15:11.837", "last_editor_user_id": "10666", "owner_user_id": "10666", "post_type": "question", "score": 0, "tags": [ "ssl", "debian" ], "title": "Debian (jessie) 環境での curl エラー: (60)", "view_count": 1956 }
[ { "body": "`export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt`\n\nで通るようになりました。とりあえずよかった。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-04-04T10:06:22.883", "id": "23736", "last_activity_date": "2016-04-04T10:15:42.920", "last_edit_date": "2016-04-...
23464
null
23736
{ "accepted_answer_id": "23471", "answer_count": 2, "body": "Railsで`whenever`を使い下記のように`time`で実行にかかった記録を残しながら定期処理を行っています。\n\n```\n\n path = 'PATH=\"/opt/rbenv/bin:$PATH\";'\n env = 'eval \"$(rbenv init -)\"; cd :path && :environment_variable=:environment nice -n 10 time'\n job_type :rbenv_rake, %Q{#{path} #{env} :bundle_command rake :task --silent :output}\n \n set :output, {error: 'log/error_foo.log', standard: 'log/foo.log'}\n every '0 8 * * *' do\n rbenv_rake 'foo:update'\n end\n \n```\n\nただ、`time`コマンドの出力が標準出力ではなく標準エラーに行われるため正常終了した時は`log/foo.log`に処理時刻を残しておきたいのに常に`error_foo.log`側に保存されてしまいます。\n\n`time`の結果を標準出力に飛ばす方法、もしくは`time`相当の処理を行い結果を標準出力に行うプログラムなどありますか?", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T01:26:57.380", "favorite_count": 0, "id": "23469", "last_activity_date": "2016-03-26T03:38:25.787", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3271", "post_type": "question", "score": 3, "tags": [ "ruby-on-rails", "linux" ], "title": "timeコマンドの出力を標準エラーではなく標準出力に行う方法", "view_count": 1733 }
[ { "body": "> `time` の結果を標準出力に飛ばす方法\n\n`time 2>&1` \nとすると、標準エラー出力が標準出力として出力されます。 \nRailsは詳しくないのですが、 \n`env = 'eval \"$(rbenv init -)\"; cd :path && :environment_variable=:environment\nnice -n 10 time 2>&1'` \nとすればできると思います。\n\n・[cmd > /dev/null 2>&1」の話](http://qiita.com/sue71/items/cef17fabd180f4121f9e) \n・[...
23469
23471
23471
{ "accepted_answer_id": null, "answer_count": 2, "body": "サンプルの RSSリーダーをそのまま起動しても loading.gif が表示され続けるか、 \nFailed to load RSS みたいなのが表示されるだけです。\n\n該当のサンプルは 現在使用できないのでしょうか? \nれとも 私の環境 利用の仕方が間違っていおるのでしょうか?\n\nご回答をお待ちしております。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T05:05:42.283", "favorite_count": 0, "id": "23473", "last_activity_date": "2016-12-09T20:12:33.943", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14948", "post_type": "question", "score": -1, "tags": [ "monaca" ], "title": "MONACA RSSリーダーがRSSを読み込まない", "view_count": 314 }
[ { "body": "monaca開発画面のpreviewではloading.gifが表示されるのみですが、デバッガーではちゃんと表示されましたよ。お試しくださいませ。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T07:49:31.387", "id": "23479", "last_activity_date": "2016-03-26T07:49:31.387", "last_edit_date": null, "last_edit...
23473
null
23479
{ "accepted_answer_id": "23481", "answer_count": 1, "body": "```\n\n remote: Permission to AAA/abc.git denied to BBB.\n fatal: unable to access 'https://github.com/AAA/abc.git/': The requested URL returned error: 403\n \n```\n\n`git add .` `git commit` した後に`git push`した結果上記のようなエラーがでてきました。 \nどこの設定を変更すれば解決しますか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T06:21:36.450", "favorite_count": 0, "id": "23475", "last_activity_date": "2016-03-30T05:54:14.640", "last_edit_date": "2016-03-26T07:44:15.607", "last_editor_user_id": "2808", "owner_user_id": "10088", "post_type": "question", "score": 1, "tags": [ "git", "github" ], "title": "githubへgit pushしようとすると403エラーとなる", "view_count": 15464 }
[ { "body": "そのリポジトリ(AAA/abc)にpushする権限を持たないユーザー(BBB)でログインしているようです。\n\nHTTPSをお使いのようですから、push時に入力したユーザー名・パスワードがそのリポジトリで使っているものかどうか、確認してみてください。\n\n* * *\n\nリモートリポジトリにhttp(s)で接続していて認証が必要な場合には、基本的には毎回ログインを求められます。ただそれでは面倒なので、資格情報を記憶する\ncredential helperという仕組みがあります。\n\nこれはURLごとに記憶するわけですが、デフォルトではパスを無視するため、前回 `https://git...
23475
23481
23481
{ "accepted_answer_id": null, "answer_count": 3, "body": "Rubyのスクリプトが一度でも巨大なメモリを確保してしまうと、ずっとメモリを保持し続けてしまう現象に悩んでいます。\n\n```\n\n require 'objspace'\n \n array = []\n (1..20).each_with_index do |i|\n array << 'a'*1000000\n puts \"memsize: #{ObjectSpace.memsize_of_all / 1024} KB, rss: #{`ps -o rss= #{Process.pid}`.chomp} KB\"\n \n if i % 5 == 0\n array = []\n GC.start\n puts \"memsize: #{ObjectSpace.memsize_of_all / 1024} KB, rss: #{`ps -o rss= #{Process.pid}`.chomp} KB\"\n end\n end\n \n```\n\nこんな感じのコードを書くと、実行結果は以下のようになります。\n\n```\n\n memsize: 4125 KB, rss: 8016 KB\n memsize: 5113 KB, rss: 9000 KB\n memsize: 6092 KB, rss: 10000 KB\n memsize: 7071 KB, rss: 11000 KB\n memsize: 8050 KB, rss: 11984 KB\n memsize: 2473 KB, rss: 11988 KB\n memsize: 3452 KB, rss: 11988 KB\n memsize: 4431 KB, rss: 11988 KB\n memsize: 5410 KB, rss: 11988 KB\n memsize: 6389 KB, rss: 11988 KB\n memsize: 7368 KB, rss: 11988 KB\n memsize: 2473 KB, rss: 11988 KB\n memsize: 3452 KB, rss: 11988 KB\n memsize: 4431 KB, rss: 11988 KB\n memsize: 5410 KB, rss: 11988 KB\n memsize: 6389 KB, rss: 11988 KB\n memsize: 7368 KB, rss: 11988 KB\n memsize: 2473 KB, rss: 11988 KB\n memsize: 3452 KB, rss: 11988 KB\n memsize: 4431 KB, rss: 11988 KB\n memsize: 5410 KB, rss: 11988 KB\n memsize: 6389 KB, rss: 11988 KB\n memsize: 7368 KB, rss: 11988 KB\n memsize: 2473 KB, rss: 11988 KB\n \n```\n\n時間を伸ばしたり、外からpsコマンドを実行したりしましたが、どうやってもRSSが減りません。 \nRubyオブジェクトに割り当てられたメモリは解放されているのに、せっかく開放したメモリをOSには返却してくれないようです。 \nこのプロセスに限れば確保したメモリを再利用できるからいいのですが、サーバー上には他のプロセスも動いてるわけでやはり使わなくなったメモリはOSに戻したいです。 \nRubyの仕様上、難しいことでしょうか?", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T07:36:19.417", "favorite_count": 0, "id": "23478", "last_activity_date": "2019-01-09T10:23:48.830", "last_edit_date": "2016-03-26T08:17:42.780", "last_editor_user_id": "14950", "owner_user_id": "14950", "post_type": "question", "score": 3, "tags": [ "ruby", "linux", "c", "memory-leaks" ], "title": "Rubyのプロセスが掴んでいる実メモリを解放する手段はありますか?", "view_count": 6924 }
[ { "body": "Ruby ではオブジェクトを破棄しても free されにくい実装と記憶しています。(結構前の話なので今は変わっているかも?)\nまたCレベルの話をすると、free を呼んでもOSにメモリを返さず、次に malloc した際に再割当するような実装も多く存在します。\n\nということで、一般的にはメモリの解放によっても占有メモリが減らない前提でプログラミングすることになろうかと思います。\n\nどうしてもということであれば、メモリが解放されるようなRubyのバージョン (もし存在すれば)\nとmalloc/freeの実装の組み合わせを固定して開発する必要があるでしょう。", "comment...
23478
null
23492
{ "accepted_answer_id": "23500", "answer_count": 2, "body": "以下のC++11のコードについて\n\n```\n\n #include <iostream>\n #include <tuple>\n #include <utility>\n #include <cxxabi.h>\n #include <typeinfo>\n \n class foo\n {\n public:\n template<typename... types_>\n void method1(types_&&... args) {\n int status;\n \n auto method2_args = std::make_tuple(\n std::forward<types_>(args)...\n );\n auto fp = &foo::method2<int, int, decltype(method2_args)>;\n std::cout << abi::__cxa_demangle(typeid(method2_args).name(), 0, 0, &status) << std::endl;\n std::cout << abi::__cxa_demangle(typeid(fp).name(), 0, 0, &status) << std::endl;\n // (this ->*fp)(1, 2, method2_args); // error: invalid initialization of reference of type ‘std::tuple<int, int, std::tuple<float, double> >&’ from expression of type ‘std::tuple<float, double>’\n }\n \n template<typename... types_>\n void method2(int a, int b, std::tuple<types_...> &args )\n {\n }\n };\n \n int main()\n {\n foo f;\n f.method1(1.0f, 2.0);\n }\n \n```\n\n(this ->*fp)(1, 2, method2_args);がエラーとなってコンパイルできません。 \nコンパイラはg++-4.8です。g++-5.0, clang++-3.4でもエラーでした。\n\n不思議に思い、エラー箇所をコメントアウトして、method2_argsとfpのtype_info::name()を表示させたところ\n\n```\n\n std::tuple&ltfloat;, double>\n void (foo::*)(int, int, std::tuple&ltint;, int, std::tuple&ltfloat;, double> >&)\n \n```\n\nでした。最初のがmethod2_argsで次がfpのtype_info::name()です。 \nmethod2_argsは期待どおりでした。 \nしかしfpは実に奇妙で期待していたものと違いました。\n\n```\n\n void (foo::*)(int, int, std::tuple&ltfloat;, double> >&)\n \n```\n\nを期待していました。\n\n * 質問1. \nfpはなぜこのような結果になるのでしょうか?\n\n * 質問2. \nfpを私が期待したものにするにはどうしたらよいでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T08:05:55.453", "favorite_count": 0, "id": "23480", "last_activity_date": "2016-03-27T06:21:32.927", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7844", "post_type": "question", "score": 0, "tags": [ "c++", "c++11" ], "title": "可変長引数テンプレートメンバ関数へのポインタ。その引数が期待通りにならない。", "view_count": 1030 }
[ { "body": "_fpはなぜこのような結果になるのでしょうか?_\n\n * method2の引数`int a, int b,`は、型パラメータ`types_`を使用していませんから`auto fp = &foo::method2<int, int, decltype(method2_args)>;`のようにそれらに対応する`int, int,`を実型引数に与えてはいけません。\n * `method2_args`のデータ型はすでに`std::tuple<float, double>`なのですから、そのデータ型を(method2の)`types_`に渡せば`std::tuple<types_...>`は当然...
23480
23500
23482
{ "accepted_answer_id": "23486", "answer_count": 1, "body": "windowsなどでプログラムが応答しないという記述が表示されることがありますが、 \nこのような応答の応答がないプログラムを検出するプログラムはどのようになっているのですか? \n毎回毎回プログラム以前の無知な質問ですみません\n\n【追記】 \n「イベントが一定時間以上の間処理されない」 \nC++/cliかC#の入門で一番最初にウインドウだけを作るプログラム(いわゆるhello\nworldプログラム)を作った経験があるのですが、あれにもイベントがあるのですか。 \nイベントはクリックしたりキーボード入力などの時に呼び出されることは知っていますが、あれ単体では何かしらのイベントがあるのか疑問です。 \nその回答がPeekMessageだとわかりました。 \nPeekMessageとはなんですか?プロセス間通信か何かの用語ですか?(非常に完結でかまいません残りは自力でどうにかします。というより調べたら関数だということがわかりました。)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T11:09:04.613", "favorite_count": 0, "id": "23485", "last_activity_date": "2016-03-27T09:09:05.297", "last_edit_date": "2016-03-26T12:07:46.330", "last_editor_user_id": "10455", "owner_user_id": "10455", "post_type": "question", "score": 4, "tags": [ "アルゴリズム" ], "title": "無限ループはどのようにして検出しているのですか?", "view_count": 2153 }
[ { "body": "一般的にアプリが何らかの無限ループにはまっていることを検出することはできず、単に「プログラムが応答しない」ことを検出しているにすぎません。 \nWindowsなどのGUI系アプリの場合、イベントキューを用いたイベントドリブンな書き方をするのが一般的ですから、「イベントが一定時間以上の間処理されない」ことで「応答がない」と判定できます。\n\nWindowsの場合[superuser](http://superuser.com)(本家stackoverflowのファミリーサイト)に[似た質問のスレッド](https://superuser.com/questions/961843/how-\nd...
23485
23486
23486
{ "accepted_answer_id": "23509", "answer_count": 1, "body": "ajaxを使って書いたいいね(likeと定義)リンクがおささりません。リンクは画面上に表示されているのですが。 \nコードに問題があるのでしょうか?それともPCに必要なアプリケーションが導入されていないのでしょうか? \nコードは、 \nlikes_controller.rbが\n\n```\n\n class LikesController < ApplicationController\n \n before_action :authenticate_user!\n \n def like\n @note = Note.find(params[:note_id])\n like = current_user.likes.build(note_id: @note.id)\n like.save \n end\n \n def unlike\n @note = Note.find(params[:id])\n like = current_user.likes.find_by(note_id: @note.id)\n like.destroy\n end\n end\n \n```\n\n_like_links.html.erbが\n\n```\n\n <% if current_user.likes.find_by(note_id: @note.id) %>\n <%= link_to 'いいね!を取り消す', unlike_path(@note.id), method: :delete, remote: true %>\n <% else %>\n <%= link_to 'いいね!', like_path(@note.id), method: :post, remote: true %>\n <% end %>\n \n```\n\nlike.js.erbが\n\n```\n\n $('#like-link').html('<%= escape_javascript(render(\"likes/like_links\", note: @note)) %>');\n $('#like-count').html('<%= @note.likes.count %>');\n \n```\n\nunlike.js.erbが\n\n```\n\n $('#like-link').html('<%= escape_javascript(render(\"likes/like_links\", note: @note)) %>');\n $('#like-count').html('<%= @note.likes.count %>');\n \n```\n\nusersフォルダのshow.html.erが\n\n```\n\n <p id=\"notice\" class=\"alert-success\"><%= notice %></p>\n \n <aside class=\"sidebar\">\n <section>\n <span class=\"label\">プロフィール画像</span>\n <h3 class=\"user-info\">\n <%= image_for(@user) %>\n </h3>\n </section>\n \n <section>\n <span class=\"label\">Name:</span>\n <h3 class=\"user-info\"><%= @user.name %></h3>\n </section>\n \n <section>\n <span class=\"label\">Email:</span>\n <h3 class=\"user-info\"><%= @user.email %></h3>\n </section>\n \n <%= link_to @user.likes.count, like_notes_user_path(@user.id) %>個の投稿にいいね!しています\n \n \n <% if current_user?(@user) %>\n <section>\n <small><%= link_to \"プロフィールを編集\",edit_user_path(@user) %></small>\n </section>\n <% end %>\n \n </aside>\n \n <ul class=\"notes\">\n <h2><%= @title %></h2>\n <%= render @notes %>\n </ul>\n \n```\n\nnotesフォルダのshow.html.erが\n\n```\n\n <p id=\"notice\" class=\"alert alert-success\">\n <%= notice %>\n </p>\n \n <h2>今何してる?</h2>\n <p><%= @note.content %></p>\n \n <div id=\"like-link\">\n <!-- 送信先とmethodを指定してください -->\n <%= render \"likes/like_links\", note: @note %>\n </div>\n \n <div>\n <small>\n <%= link_to @note.likes.count, liking_users_note_path(@note.id), id: \"like-count\" %>人がいいね!といっています\n </small>\n </div>\n \n <% if current_user?(@note.user) %>\n <%= link_to \"つぶやく\", edit_note_path(@note.id),class:\"edit\" %>\n <%= link_to \"削除\", destroy_note_path(@note.id), method: \"delete\", class: \"destroy\", \"data-confirm\" => \"本当に削除しますか?\" %>\n <% end %>\n \n```\n\nliking_users.html.erbが\n\n```\n\n <ul class='show-note'>\n <%= render @note %>\n </ul>\n \n <h2 class=\"heading\">いいねしているユーザー一覧 </h2>\n <ul class='user-list'>\n <!-- ここでパーシャルファイルを呼び出してください -->\n <%= render @users %> \n </ul>\n \n```\n\nです。\n\n追加です。 \nいいね!ボタンが正常におささると、 \n「いいね! \n0人がいいね!といっています」(いいね!と0人の所は押すことができます) \nと表示されているところが、 \n「いいね!を取り消す \n1人がいいね!といっています」(いいね!を取り消すと1人の所は押すことができます) \nと変化します。\n\nroutes.rbには\n\n```\n\n Rails.application.routes.draw do\n \n devise_for :users\n \n resources :users, only: [:index, :show, :edit, :update,:like] do\n member do\n get :like_notes\n end\n end   ←ここ\n \n resources :notes, only: [:show, :create, :edit, :update, :destroy] do\n member do\n get :liking_users\n end\n end    ←ここ\n \n \n get'/top' => 'home#top'\n \n get'/connection' => 'home#connection'\n get'/notes/new' => 'notes#new'\n post'/notes' =>'notes#create'\n get'/notes' =>'notes#index'\n get'/show/:id' => 'notes#show'\n patch'/notes/:id' =>\"notes#update\",as:'update_note'\n delete'/notes/:id' =>\"notes#destroy\",as:'destroy_note'\n \n \n post '/like/notes/:id' => 'likes#like', as: 'like'\n delete '/unlike/notes/:id' => 'likes#unlike', as: 'unlike'\n \n root 'home#top'\n get'/about' => 'home#about'\n end\n \n```\n\nで←ここでしめした所が該当するルーターです。 \nお願いいたします。", "comment_count": 7, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T12:53:22.257", "favorite_count": 0, "id": "23488", "last_activity_date": "2016-03-27T13:57:15.540", "last_edit_date": "2016-03-27T12:49:01.393", "last_editor_user_id": "14754", "owner_user_id": "14754", "post_type": "question", "score": 0, "tags": [ "ruby-on-rails" ], "title": "ajaxを使って書いたリンクがおささりません", "view_count": 271 }
[ { "body": "とりあえずこの部分に不整合がありますね。 \nlikes_controller.rb:\n\n```\n\n @note = Note.find(params[:note_id])\n \n```\n\n・`:note_id`でパラメータを取得している。\n\nroutes.rb:\n\n```\n\n post '/like/notes/:id' => 'likes#like', as: 'like'\n \n```\n\n・`:id`としてパラメータを定義している。\n\nこの両者は一致させておかないと正しくパラメータが取得できていないはずです。`unl...
23488
23509
23509
{ "accepted_answer_id": null, "answer_count": 0, "body": "OutlookのVBAを使って、会議開催通知の予約をキャンセルを受信したら予定表から予定を自動的に削除するコードを書いてみています。 \nしかし、★印のところからエラーに成って動かないようです。\n\nVBAの超初心者ですが教えて頂けませんでしょうか?\n\n```\n\n Set tmpItem = Application.Session.GetItemFromID(buf(i))\n If tmpItem.MessageClass = \"IPM.Schedule.Meeting.Request\" Then\n Set tmpAppoint = tmpItem.GetAssociatedAppointment(True)\n Set tmpMeeting = tmpAppoint.Respond(olResponseAccepted, True)\n tmpMeeting.Send\n ElseIf tmpItem.MessageClass = \"IPM.Schedule.Meeting.Canceled\" Then\n Dim meetItem As MeetingItem\n Dim apptItem As AppointmentItem\n Set meetItem = objItem\n Set apptItem = meetItem.GetAssociatedAppointment(False)★\n apptItem.MeetingStatus = olMeetingCanceled\n apptItem.Send\n apptItem.Delete\n End If\n \n```", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T15:03:34.977", "favorite_count": 0, "id": "23493", "last_activity_date": "2016-03-26T17:01:38.607", "last_edit_date": "2016-03-26T17:01:38.607", "last_editor_user_id": "6092", "owner_user_id": "14953", "post_type": "question", "score": 0, "tags": [ "vba" ], "title": "OutlookのVBAで予定表削除がされない", "view_count": 1425 }
[]
23493
null
null
{ "accepted_answer_id": "23587", "answer_count": 1, "body": "現在、monacaでタグでonclickを使用して遷移したい考えております。 \nonclickはタグで遷移させようとすると動作をしないことがわかりました. \nreturn falseを付け加えることで遷移させずに、onclickは起動しております。 \n自分の作成したい内容はonclickが動いて違うページに遷移させたいのでが、 \nこうするためにはどのようなプログラムにすればよろしいですか? \n以下にプログラム内容を載せます\n\nご教授よろしくお願いします。\n\nonclick.js\n\n```\n\n function onRegisterBtn(id){\n ncmb.Installation.fetchById(id).then(function(installation){\n var seibetu = $(\"#reg_seibetu option:selected\").val(); \n installation.set(\"seibetu\", seibetu);\n return installation.update();\n })\n .then(function(installation){\n alert('登録完了しました');\n })\n .catch(function(err){\n alert('登録完了できませんでした');\n });\n }\n \n```\n\nindex.html\n\n```\n\n <p>年齢<br>\n <select id=\"reg_nenrei\">\n <option value=\"10\">10代</option>\n <option value=\"20\">20代</option>\n <option value=\"30\">30代</option>\n <option value=\"40\">40代</option>\n <option value=\"50\">50代</option>\n <option value=\"60\">60代</option>\n <option value=\"その他\">その他</option>\n </select>\n </p> \n <a href=\"index.html\" onclick=\"onRegisterBtn('id')\">登録する</a>\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T15:19:05.017", "favorite_count": 0, "id": "23494", "last_activity_date": "2016-03-29T05:25:28.603", "last_edit_date": "2016-03-27T13:49:02.917", "last_editor_user_id": "13367", "owner_user_id": "13367", "post_type": "question", "score": 0, "tags": [ "javascript", "monaca", "html" ], "title": "onclickを使用して遷移したい", "view_count": 2370 }
[ { "body": "### onClick属性のイベントハンドラでデフォルト動作を抑止する\n\nリンクがクリックされた時には、ブラウザのデフォルト動作として自動で遷移が行なわれます。 \nこれを防ぐにはonClick属性の場合、返り値に`false`を指定します。\n\n```\n\n <a href=\"index.html\" onclick=\"onRegisterBtn('id'); return false;\">登録する</a>\n \n```\n\n### addEventListener等で登録したイベントハンドラでデフォルト動作を抑止する\n\nCordova・Monacaでは通常...
23494
23587
23587
{ "accepted_answer_id": null, "answer_count": 1, "body": "現在、OnsenUIでTwitterクライアントの制作に挑戦しております。参考としてhttp://docs.monaca.mobi/cur/ja/sampleapp/samples/twitter/のサンプルを基に制作しておりました。サンプルにはindex.htmlのページにConnect\nto Twitterを設置していました。このConnect to\nTwitterのボタンをアプリの起動時に開かれるログイン画面ページとしておきたいです。認証後にタイムラインが表示されたタブバー付きのページへと遷移するという形を作りたいのですがどうにもうまくいきません。ご教授お願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-26T17:50:17.497", "favorite_count": 0, "id": "23495", "last_activity_date": "2016-11-02T07:33:05.790", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13526", "post_type": "question", "score": 0, "tags": [ "monaca", "onsen-ui" ], "title": "ログイン画面とタブバー付きのホーム画面を分けたい", "view_count": 1334 }
[ { "body": "**4/11修正版** \nログイン画面を表示する場合、`ons-tabbar`の`ng-show`を`false`にしてタブバーを非表示にします。 \n認証後、`ng-show`を`true`にしてタブバーを表示させます。 \nとりあえず、サンプルコードをベースにそれらしく動作するようにコードを修正しました。 \nGapDebugなどを利用すれば、どの行で何が行われているか把握できるはずです。\n\n※`AngularJS`を使用。\n\n```\n\n <!DOCTYPE HTML>\n <html>\n <head>\n <meta charset=...
23495
null
23845
{ "accepted_answer_id": "23501", "answer_count": 1, "body": "```\n\n $ cat pseudo-yes.sh\n #!/bin/sh\n \n while true; do\n printf \"y\\n\"\n done\n $ \n \n```\n\n上記のような、 `pseudo-yes.sh`を記述しました。これを、例えば次のように使うと、問題無く `yes` コマンドのような動きをしてくれます。\n\n```\n\n $ ./pseudo-yes.sh | head -n 1\n y\n $ \n \n```\n\n* * *\n\nこの挙動を見る限り、 `printf` コマンドの実行に際して発生する`SIGPIPE`シグナルは、 `pseudo-\nyes.sh`が受信・処理しているはずだと理解できます。(でないと、 `while`文から抜け出せるはずがない)\n\n自分の理解ですと、`SIGPIPE` シグナルは、 `write`システムコールを行ったプロセスに対して発行されるものはずだと思っています。\n\n質問:\n\n * どうして、書き込みを行う主体のプロセスは `printf` なのに、`pseudo-yes.sh` が `SIGPIPE`を正しく処理できているのでしょうか?\n\n補足:\n\n * この挙動は、 ubuntu と mac-os-x の両方で観測されました。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-27T05:46:12.983", "favorite_count": 0, "id": "23498", "last_activity_date": "2017-05-08T16:41:22.667", "last_edit_date": "2016-03-27T05:58:07.553", "last_editor_user_id": "754", "owner_user_id": "754", "post_type": "question", "score": 14, "tags": [ "sh", "unix" ], "title": "擬似 yes コマンドを書いたのですが、 SIGPIPE がどうしてよろしく処理されるのかがわからない", "view_count": 910 }
[ { "body": "Ubuntu の `/bin/sh` (bash, dash または posh)、Mac OS X の `/bin/sh` (bash) どちらも\n`printf` はシェル組込みコマンドです。\n\n```\n\n $ /bin/sh -c 'type printf'\n printf is a shell builtin\n \n```\n\nまた `SIGPIPE` のデフォルトのシグナルハンドラーはプロセスの終了です。よって、件のコードを実行すると `/bin/sh` プロセスが\n`SIGPIPE` シグナルを受け、終了します。\n\nUbuntu であれば次のよう...
23498
23501
23501
{ "accepted_answer_id": "23512", "answer_count": 1, "body": "タイトル通りなんですが、iOSのミュージックアプリの曲タイトルなどのように自動で横スクロールさせる方法を教えていただきたいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-27T09:19:06.603", "favorite_count": 0, "id": "23502", "last_activity_date": "2016-04-02T04:59:55.033", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13963", "post_type": "question", "score": 0, "tags": [ "ios", "objective-c" ], "title": "テキストをオートスクロールさせたい", "view_count": 1289 }
[ { "body": "残念ながらiOSには、テキストを「自動で横スクロールさせる」ようなUI部品はないようです。\n\niOSのミュージックアプリでどのような方法がとられているかはわかりませんが、ご質問に書かれたようなことをやるために思いつくところを書いておきます。\n\n(1) 「自動で」は諦めて、あなたのコードで全てコントロールする\n\nコードでメインViewに貼り付けた子Viewの位置を変更するのは簡単ですし、UIScrollViewなんてものを使うこともできそうです。…と思ってコードを書きかけたのですが、思っていたより大変で、回答としては長すぎるのと、Swiftで書いてしまったので、掲載は控えておきます。\...
23502
23512
23512
{ "accepted_answer_id": "23505", "answer_count": 2, "body": "Segmentation Faultとはなんですか?スタックオーバーフローと違いはありますか?\n\n<https://stackoverflow.com/questions/2346806/what-is-segmentation-fault> \n(あと↑これ普通にコピペしただけでここのリンクと同じように扱われないの?(メタ的内容))\n\n英語版では \nSegmentation Faultとはなんですか?C/C++でのその定義はどうなっていますか?Dangling pointer都の関係性はありますか? \nといったところでしょう。\n\n最後に、 \nSegmentation Fault←これカタカナでどう書いたらいいですか \nDangling pointer←これカタカナでどう書いたらいいですか\n\n【追記】 \n自分で調べたこと \nSegmentation Faultはメモリアクセスによて起こされるエラーの一種です。\n\n<https://stackoverflow.com/questions/17997228/what-is-a-dangling-pointer>\n\nDangling pointerはデータが無効またはポインタそのものが無効なポインタのことといっている気がします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-27T10:22:01.537", "favorite_count": 0, "id": "23503", "last_activity_date": "2016-03-27T20:26:34.340", "last_edit_date": "2017-05-23T12:38:56.083", "last_editor_user_id": "-1", "owner_user_id": "10455", "post_type": "question", "score": 3, "tags": [ "c++", "c" ], "title": "Segmentation Faultとはなんですか?", "view_count": 66588 }
[ { "body": "> Segmentation Faultとはなんですか?\n\n使用しているシステム(主にCPUと言うか、そのCPUの採用するメモリ管理機構)により細部には違いがありますが、メモリの特定の領域に対するアクセス違反が検出された時に発生する例外(割り込みと言ったほうがいいかもしれません)をSegmentation\nFaultと総称して(元はUnix用語でしょう)いて、次のような場合に発生します。\n\n * メモリが割り当てられていない領域にアクセスしようとした(*)\n * 書き込みが禁止されている領域に書き込もうとした\n * 実行が禁止されている領域のコードを実行しようとした\n\n(...
23503
23505
23505
{ "accepted_answer_id": null, "answer_count": 2, "body": "`appinventor`というweb上で、好きなパーツをはめていくだけで \n手軽にAndroidアプリが作れるものがあります。\n\n<http://www.atmarkit.co.jp/ait/articles/1103/15/news087.html>\n\n手軽でびっくりしたのですが、 \nandroidアプリとして動く(apkファイルを作成する)までの流れが理解しきれず困っております。\n\n```\n\n GUIで操作及び、ブロックのロジックを設定する\n ↓\n ブラウザベースのサービスなので、\n そのロジックをもとに、javascriptでjavaのスクリプトに変換(翻訳?)する\n ↓\n GUIの部分はどういうプロセスを踏んでかは不明だが、xmlファイルに変換し、ボタンなどの位置を記憶する\n ↓\n apkファイル生成\n \n```\n\nといった漠然としたイメージは持っております。\n\n特にわからないのは、どうして、ブラウザ上で作成したロジックがandroidアプリで動くようになているのかという点です。\n\n前述のとおり、何かしらの方法で翻訳しているのだと思うのですが、 \nただ翻訳するだけでなく、javaのファイルとして生成しなければいけないと思います。\n\nその部分が私の今の理解度では追いついておらず、ブラックボックス化しております。\n\nソースコードを呼んだり、ググったりしていたのですが、よくわからず、質問させていただきました。 \n<https://github.com/mit-cml/appinventor-sources>\n\n興味本位の質問ではありますが、すごく面白いないようなので、車輪の開発にはなりますが、 \n自分でも同じようなことができるようになりたいと思っております。\n\nそのために何が必要なのかも差支えがなければ教えていただけると幸いです。\n\n拙い知識ではありますが\n\n * 構文解析器\n * コンパイル\n\nなどが肝になるのかなと思っております。\n\nまた、少し話がそれますが、 \n`rubymotion`という、rubyの文法で、iOS と Android のモバイルアプリが開発できる言語? \nがあります。\n\nこういうのも今回の質問内容に類似しており、気になるところではあります。\n\nrubyの文法で書いたロジックを何かしらの形で翻訳し、javaやobjective-\ncに変換するのだと思うのですが、ここでいうところのその変換方法が何なのかがわかりませんでした。\n\n不足事項などは都度追記させていただきます。 \n何卒よろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-27T13:30:33.293", "favorite_count": 0, "id": "23506", "last_activity_date": "2016-03-28T16:07:22.470", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13175", "post_type": "question", "score": 3, "tags": [ "android", "java", "ruby", "objective-c", "xcode" ], "title": "GUIでの操作だけでアプリが開発できるサービスがあるのですが、その理由がわかりません。(構文解析などが関係しうるのかもしれませんが)", "view_count": 407 }
[ { "body": "RubyMotion の場合は、JavaやObjective Cへの変換は行わずに直接バイナリ (より正確に言えば、LLVMのバイトコード)\nを出力します。つまり、Rubyコンパイラとして動作します。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-27T13:47:12.177", "id": "23508", "last_activity_date": "2016-03-27T13:47:12.177", "last_edit...
23506
null
23516
{ "accepted_answer_id": "23527", "answer_count": 1, "body": "タイトルの通りでどちらが一般的でどういった使い分けを本当はするのかを教えてください。 \n下のfooとbarのイベントは自由で勝手なタイミングに起きるものとします。\n\n 1. fooイベントが発生すると処理Aを行う。このときCを作成する。\n 2. barイベントが発生すると処理Bを行う。このときCを使う。\n\nCが存在しないと処理BがおかしくなってしまうのでCの存在を保証したいです。そこで次の二つのどちらかを自分は今まで気まぐれで使っていました。\n\n * 処理AでCを作成するまで、barイベントに処理Bを登録せずにおく\n * 処理Bの最初でCがあるかどうかを確認し、なければ処理を行わない\n\n前者は無駄な確認処理がありません。後者は可読性が高いような気がします。 \nどちらを使うのが一般的なのでしょうか?それとも別の解決法があるのでしょうか?", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-27T13:38:37.473", "favorite_count": 0, "id": "23507", "last_activity_date": "2016-03-28T15:30:48.543", "last_edit_date": "2016-03-27T14:03:55.263", "last_editor_user_id": "8000", "owner_user_id": "14222", "post_type": "question", "score": 3, "tags": [ "javascript", "可読性", "デザインパターン" ], "title": "イベントリスナーの登録の入れ子か存在チェック", "view_count": 301 }
[ { "body": "一般的にどうなのかは分かりませんが・・・\n\n先に、もう一つの選択肢として、NullObjectパターンを提示しておきます。 \n例えばCが関数ならば、最初の時点では「何もしない関数」(=NullObject)をCに入れておいて、処理Aで正規の関数を入れ直す、という感じです。 \n『無駄な確認処理』が不要になるのが利点です。\n\n以降は、私ならどうするか、ですが:\n\n> 処理AでCを作成するまで、barイベントに処理Bを登録せずにおく\n\n処理Aにおける興味の中心が「処理Bのリスナ登録」であるなら、この方法を採ります。 \n逆に「Cの作成」であるなら、これは避けます。\n\n私が...
23507
23527
23527
{ "accepted_answer_id": "40452", "answer_count": 1, "body": "TimelineMaxやTweenLiteは使えているのですが、同じようにしてもTweenMaxが使えません。\n\nwebpack.config.jsではresolveのaliasで以下のように設定しています。\n\n```\n\n alias: {\n TweenLite: 'gsap/src/uncompressed/TweenLite.js',\n TweenMax: 'gsap/src/uncompressed/TweenMax.js',\n TimelineLite: 'gsap/src/uncompressed/TimelineLite.js',\n TimelineMax: 'gsap/src/uncompressed/TimelineMax.js',\n EasePack: 'gsap/src/uncompressed/easing/EasePack.js',\n ScrollToPlugin: 'gsap/src/uncompressed/plugins/ScrollToPlugin.js'\n },\n \n```\n\ntsファイルでは以下のようにimportしています。\n\n```\n\n import TweenMax = require('TweenMax');\n \n```\n\nただ、`console.log(TweenMax)`としても空のobjectが返ってきており、 \n当然`TweenMax.to()`などはそんなfunctionは存在しないとerrorがでます。\n\n<https://github.com/greensock/GreenSock-JS/issues/91#issuecomment-148332900> \nこの人と同じように以下のようにしても空のobjectが返ってくることに変化なく。。\n\n```\n\n plugins: [ \n new webpack.ProvidePlugin({TweenMax: \"TweenMax\"})\n ]\n \n```\n\n読み込んでいるGSAPのnpm packageは 1.18.2です。 \nwebpackは1.12.14 \ntypescriptは1.8.7\n\nwebpackでのTweenMaxの使用方法ご教示いただければ幸いです。\n\nあわせて、 \nEasePackはTweenMaxがimportできれば使えると思っていますがまちがいないでしょうか? \nまた、ScrollToPluginも使用したいのですが、これはどのようにimportすればいいでしょうか。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-27T14:05:40.167", "favorite_count": 0, "id": "23510", "last_activity_date": "2017-12-21T13:52:29.947", "last_edit_date": "2016-03-27T15:27:33.273", "last_editor_user_id": "3131", "owner_user_id": "3131", "post_type": "question", "score": 1, "tags": [ "javascript", "typescript", "webpack" ], "title": "webpackでのTweenMax、EasePackの使い方(typescriptを使用)", "view_count": 1417 }
[ { "body": "自己解決した内容ですが、gsapがwebpackに対応したためです \nこちらを参照してください。 \n[Best way to use GSAP with\nWebpack](https://greensock.com/forums/topic/16676-best-way-to-use-gsap-with-\nwebpack/?tab=comments#comment-73795)\n\n私の方法が悪いのかもしれませんがScrollToPluginのみimportができないのでこのコメントのようにaliasを設定しています。 \n[GSAP & NPM/Webpack `import`...
23510
40452
40452
{ "accepted_answer_id": "23515", "answer_count": 1, "body": "メールを立ち上げることはできたのですが、閉じることができません。 \nswitch result.value のところにエラーメッセージが出ています。 \n調べてみても分からなかったので質問させていただきました。\n\nよろしくお願いします。\n\nfunc mailComposeController(controller: MFMailComposeViewController,\ndidFinishWithResult result: MFMailComposeResult, error: NSError?) {\n\n```\n\n switch result.value {\n case MFMailComposeResultCancelled.value:\n break\n case MFMailComposeResultSaved.value:\n break\n case MFMailComposeResultSent.value:\n break\n case MFMailComposeResultFailed.value:\n break\n default:\n break\n }\n \n self.dismissViewControllerAnimated(true, completion: nil)\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-27T14:42:04.457", "favorite_count": 0, "id": "23513", "last_activity_date": "2016-03-27T16:42:44.510", "last_edit_date": "2016-03-27T16:42:44.510", "last_editor_user_id": "11019", "owner_user_id": "11019", "post_type": "question", "score": 0, "tags": [ "ios", "swift", "iphone", "swift2" ], "title": "swift メール画面を閉じたい。", "view_count": 524 }
[ { "body": "どこで見つけられたコードか知りませんが、ずいぶん古い書き方をしていますね。Swift1.xのかなり初期の書き方になっています。\n\n現在の`MFMailComposeResult`型はSwiftに以下のようにimportされています。\n\n```\n\n public struct MFMailComposeResult : RawRepresentable, Equatable {\n public init(_ rawValue: UInt32)\n public init(rawValue: UInt32)\n public var ra...
23513
23515
23515
{ "accepted_answer_id": null, "answer_count": 1, "body": "`OLYCameraLiveViewListener`\nの以下のメソッドでライブビュー画像を処理する際に、同時に取得できるmetadataに格納されている情報について記載されているドキュメントはありませんでしょうか? \n常にOrientation情報しか入っていないようなのですが、これで正常なのでしょうか?\n\n```\n\n void onUpdateLiveView (OLYCamera camera, byte[] data, Map< String, Object > metadata)\n \n```\n\nOlympus Camera Kit ver 1.1.1\n\n宜しくお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-27T14:50:46.227", "favorite_count": 0, "id": "23514", "last_activity_date": "2016-04-01T05:51:02.290", "last_edit_date": "2016-03-28T17:20:28.560", "last_editor_user_id": "8000", "owner_user_id": "14960", "post_type": "question", "score": 1, "tags": [ "olympus-camerakit" ], "title": "ライブビュー受信時のmetadataの内容について", "view_count": 89 }
[ { "body": "OPCサポートです。\n\nご質問ありがとうございます。 \n現在のところ`metadata`に格納されている情報は回転情報のみです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-04-01T05:51:02.290", "id": "23661", "last_activity_date": "2016-04-01T05:51:02.290", "last_edit_date": null, "last_editor_us...
23514
null
23661
{ "accepted_answer_id": null, "answer_count": 2, "body": "AWSののdynamoDBを用いて、`loadUser()`データベースに上がってある画像のURLを持ってきて、`downloadImage()`で画像をダウンロードして、`addImage()`で`scrollView`に追加するようなことをしています。 \nしかし、`downloadImage()`内でダウンロードされた順番(loadCounter)を出力してみると \n0 \n2 \n1 \nなどのように出力されて、順番通りに出力されませんでした。 \n非同期処理で順番通りにダウンロードするにはどこを変更したらいいでしょうか。お願いします。\n\n```\n\n import UIKit\n import AWSCore\n import AWSS3\n import AWSDynamoDB\n \n class LoadViewController: UIViewController, UINavigationControllerDelegate,UIScrollViewDelegate {\n \n \n var loadImages:[UIImage] = []\n var loadItems:[DDBTableRow] = []\n \n var userId:String?\n var userName:String?\n var pagniatedOutput: AWSDynamoDBPaginatedOutput?\n \n @IBOutlet weak var scrollView: UIScrollView!\n \n let defaults = NSUserDefaults.standardUserDefaults()\n \n override func viewDidLoad() {\n super.viewDidLoad()\n \n self.scrollView.delegate = self\n \n self.userName = defaults.stringForKey(\"userName\")\n self.userId = defaults.stringForKey(\"userId\")\n \n \n loadUser()\n \n }\n override func didReceiveMemoryWarning() {\n super.didReceiveMemoryWarning()\n // Dispose of any resources that can be recreated.\n }\n \n \n func addImage(image:UIImage)\n {\n let sheight = self.scrollView.frame.height\n let swidth = self.scrollView.frame.width\n \n loadImages.append(image)\n let myImageView = UIImageView()\n myImageView.frame = CGRectMake(swidth * CGFloat(loadImages.count-1), 0, swidth, sheight)\n myImageView.image = image\n myImageView.contentMode = .ScaleAspectFit\n scrollView.addSubview(myImageView)\n scrollView.contentSize = CGSizeMake(swidth * CGFloat(loadImages.count), sheight)\n \n }\n \n \n \n func loadUser()\n {\n let dynamoDBObjectMapper = AWSDynamoDBObjectMapper.defaultDynamoDBObjectMapper()\n \n let queryExpression = AWSDynamoDBQueryExpression()\n queryExpression.hashKeyValues = userId\n queryExpression.scanIndexForward = false\n var loadCounter:Int = 0\n dynamoDBObjectMapper .query(DDBTableRow.self, expression: queryExpression) .continueWithExecutor(AWSExecutor.mainThreadExecutor(), withBlock: { (task:AWSTask!) -> AnyObject! in\n if (task.error != nil) {\n print(\"Error: \\(task.error)\")\n \n } else {\n if (task.result != nil) {\n self.pagniatedOutput = task.result as? AWSDynamoDBPaginatedOutput\n \n for item in (self.pagniatedOutput?.items)!\n {\n let tableRow = item as! DDBTableRow\n \n print(tableRow.Date)\n self.downloadImage(tableRow.ImageURL!,loadCounter: loadCounter)\n self.loadItems.append(tableRow)\n loadCounter += 1\n \n }\n }\n self.performSegueWithIdentifier(\"unwindToMainSegue\", sender: self)\n }\n return nil\n })\n }\n \n func downloadImage(S3DownloadKeyName: String,loadCounter:Int){\n \n var completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock?\n \n let queue:dispatch_queue_t = dispatch_queue_create(\"com.gologo13.gcd\", DISPATCH_QUEUE_SERIAL)\n \n let expression = AWSS3TransferUtilityDownloadExpression()\n expression.downloadProgress = {(task: AWSS3TransferUtilityTask, bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) in\n dispatch_async(dispatch_get_main_queue(), {\n let progress = Float(totalBytesSent) / Float(totalBytesExpectedToSend)\n NSLog(\"Progress is: %f\",progress)\n })\n }\n \n \n completionHandler = { (task, location, data, error) -> Void in\n dispatch_async(dispatch_get_main_queue(), {\n if ((error) != nil){\n NSLog(\"Failed with error\")\n NSLog(\"Error: %@\",error!)\n }\n else{\n print(Success)\n self.addImage(UIImage(data: data!)!)\n //loadCounterのデバック\n print(loadCounter)\n //loadCounterの出力される値が順番通りにならない\n }\n })\n }\n \n let transferUtility = AWSS3TransferUtility.defaultS3TransferUtility()\n \n transferUtility.downloadToURL(nil, bucket: S3BucketName, key: S3DownloadKeyName, expression: expression, completionHander: completionHandler).continueWithBlock { (task) -> AnyObject! in\n if let error = task.error {\n NSLog(\"Error: %@\",error.localizedDescription);\n // self.statusLabel.text = \"Failed\"\n }\n if let exception = task.exception {\n NSLog(\"Exception: %@\",exception.description);\n // self.statusLabel.text = \"Failed\"\n }\n if let _ = task.result {\n // self.statusLabel.text = \"Starting Download\"\n NSLog(\"Download Starting!\")\n // Do something with uploadTask.\n }\n return nil;\n }\n }\n \n }\n \n```", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-28T00:49:20.107", "favorite_count": 0, "id": "23519", "last_activity_date": "2016-09-01T09:15:27.483", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "post_type": "question", "score": 1, "tags": [ "ios", "swift", "objective-c", "xcode", "swift2" ], "title": "非同期処理での実行される順番について", "view_count": 1003 }
[ { "body": "取得したデータの\n\n> for(var i=0; i < image_list.length; i++){ \n> image.src=url[i]; \n> } \n> のiを \n> sortしてみてはどうですか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-28T15:41:26.923", "id": "23563", "last_activity_date": "2016-03-28T15:46:48.97...
23519
null
23563
{ "accepted_answer_id": "23526", "answer_count": 1, "body": "```\n\n where(\"id not in (?) AND id != ?\", current_user.friend_ids, current_user)\n \n```\n\nと書かれたコードがありまして、コードの記述の意味がわかりません。 \nこのコードはツイッターのようなサイトの”友達を探す”ページのコントローラーの一部です。 \nまず、`\"id not in (?) AND id != ?\"`の部分の意味がわかりません。なぜANDを使っているのか 、(?) はどのような意味なのかid\n!= ?がどんなことを意味しているのかさっぱりわかりません。どなたかこのコードの記述の仕方とその意味を教えてください。\n\nちなみにコントローラーのコードの全体は \nfind_friends_controller.rb\n\n```\n\n class FindFriendsController < ApplicationController\n \n before_action :authenticate_user!\n \n def index\n @users = User.where(\"id not in (?) AND id != ?\", current_user.friend_ids, current_user).paginate(page: params[:page])\n respond_to do |format|\n format.js\n format.html\n end\n end\n end\n \n```\n\nのようになっています。\n\nどうしてあんな複雑で難解なコードで友達が探せるのか疑問です。。。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-28T02:04:09.857", "favorite_count": 0, "id": "23523", "last_activity_date": "2016-03-28T02:30:51.037", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14754", "post_type": "question", "score": -1, "tags": [ "ruby-on-rails" ], "title": "where(\"id not in (?) AND id != ?\", current_user.friend_ids, current_user)のコードの意味", "view_count": 635 }
[ { "body": "```\n\n where(\"id not in (?) AND id != ?\", current_user.friend_ids, current_user)\n \n```\n\nこの `?` の部分には、後続のパラメータが順番に埋め込まれます。コメントとして埋め込んでみると、\n\n```\n\n id not in (/*friend_ids*/) AND id != /*current_user*/\n \n```\n\nといった形になります。このクエリはUserモデルに対して投げていますから、\n\n * `id not in (/*friend_id...
23523
23526
23526
{ "accepted_answer_id": "23542", "answer_count": 2, "body": "phpでmysqlデータベースに \ntest_id, test_title, test_contents,\ntest_date.test_imageのデータを保存しています。このデータのid毎に静的htmlに生成して書き出したいです。WordPressやMovable\nTypeの静的ファイルの書き出すとかに似ているイメージです。\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/ejhzH.png)](https://i.stack.imgur.com/ejhzH.png)\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/cy1lb.png)](https://i.stack.imgur.com/cy1lb.png)\n\n例えば:上記添付した画像(CMS.png)の書き出すボタンを押すと添付した画像(database.png)から、/Applications/MAMP/htdocs/test/のディレクトリーの下に静的htmlファイにて生成して書き出したいです \n/Applications/MAMP/htdocs/test/1.html \n/Applications/MAMP/htdocs/test/2.html\n\n1.htmlと2.htmlにはデータベースに保存されているtest_id, test_title, test_contents,\ntest_date.test_imageのデータ内容がそれぞれのhtmlに全部表示されるようにしたいです\n\nこれはphpや何かをして書き出すことは可能でしょうか? ご教授お願い致します。\n\n* * *\n\n@D.T さん \nsync.phpファイルは下記です。\n\n```\n\n <?php\n //require_once(\"db.php\");\n // 取得するIDをURLパラメータから取得\n if (!isset($_GET['test_id'])) {\n echo '{$test_id} param not found. please set param [id] to url params.';\n return;\n }\n $test_id = $_GET['test_id'];\n \n // データベースに接続\n //$db = new mysqli(\"localhost\", \"root\", \"root\", \"product\");\n $db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);\n if ($db->connect_error) {\n echo 'database connect failed.';\n return;\n }\n if ($db->set_charset('utf8') === false) {\n echo 'database connect failed. can not using utf-8.';\n return;\n }\n \n // データ取得とhtmlに変換\n $html = \"<!DOCTYPE html><html><head><meta charset=\\\"UTF-8\\\"><title>{$id} </title></head><body>\";\n //データベース名前はproductです, 今回の想定はいくつからのテーブルあって、その中のtestテーブルです\n $result = $db->query(\"select * from test where test_id = {$test_id};\"); // 本当はidのエスケープを考慮しないといけない でもselectなのでべつにこのままでも危険な事にはならない。\n $rows = array();\n for ($i=0; ($row=$result->fetch_assoc()) != null; $i++) { // 一応一致した全行出力する\n if ($i > 0) {\n $html .= '<br />';\n }\n $html .= 'test_id = ' . $row['test_id'] . ', ';\n $html .= 'test_title = ' . $row['test_title'] . ', ';\n $html .= 'test_contents = ' . $row['test_contents'] . ', ';\n $html .= 'test_date = ' . $row['test_date'] . ', ';\n $html .= 'test_image = ' . $row['test_image'];\n }\n $html .= \"</body></html>\";\n \n // ファイルに書き出し\n if (file_put_contents(\"/Applications/MAMP/htdocs/test/{$test_id}.html\", $html) === false) {\n echo 'write to file failed.';\n } else {\n echo 'write to file succeed.';\n }\n \n```\n\n* * *\n\n@D.Tさんこちらが全ファイルです。 \nsync.phpとadmin.phpとdb.phpは同じディレクトリ下にあります。\n\nsync.phpこちらは@D.Tさんのファイル \n\n```\n\n // 取得するIDを取得\n if (!isset($_GET['test_id']) && !isset($_POST['test_id'])) {\n print '[test_id] param not found. please set param [test_id] to url params or post values.';\n return;\n }\n $id = isset($_GET['test_id'])? $_GET['test_id']:$_POST['test_id'];\n \n // データベースに接続\n $db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);\n //$db = new mysqli(\"localhost\", \"root\", \"root\", \"product\");//ここだけを自分の環境に合わせてみました。\n if ($db->connect_error) {\n print 'database connect failed.';\n return;\n }\n if ($db->set_charset('utf8') === false) {\n print 'database connect failed. can not using utf-8.';\n return;\n }\n \n // データ取得とhtmlに変換\n $html = \"<!DOCTYPE html><html><head><meta charset=\\\"UTF-8\\\" /><title>{$id} </title></head><body>\";\n $result = $db->query(\"select * from test where test_id = {$id};\"); // 本当 はidのエスケープを考慮しないといけない でもselectなのでべつにこのままでも危険な事にはならない。\n for ($i=0; ($row=$result->fetch_assoc()) != null; $i++) { // 一応一致した全行出力する\n if ($i > 0) {\n $html .= '<br />';\n }\n $html .= 'test_id = ' . $row['test_id'] . ', ';\n $html .= 'test_title = ' . $row['test_title'] . ', ';\n $html .= 'test_contents = ' . $row['test_contents'] . ', ';\n $html .= 'test_date = ' . $row['test_date'] . ', ';\n $html .= 'test_image = ' . $row['test_image'];\n }\n $html .= \"</body></html>\";\n \n // ファイルに書き出し\n if (file_put_contents(\"/Applications/MAMP/htdocs/test/{$id}.html\", $html) === false) {\n print 'write to file failed.';\n } else {\n print 'write to file succeed.';\n ?>\n \n```\n\nadmin.php \n\n```\n\n $query = \"SELECT * FROM test ORDER BY test_id DESC\";\n $select = mysqli_query($db, $query);\n while($row = mysqli_fetch_assoc($select)){\n $test_id =$row['test_id'];\n $test_title = $row['test_title'];\n $test_contents =$row['test_contents'];\n $test_date =$row['test_date'];\n $test_image =$row['test_image'];\n echo \"<tr>\";\n ?>\n <?php \n echo \"<td>$test_id</td>\";\n echo \"<td>$test_title</td>\";\n echo \"<td>$test_contents</td>\";\n echo \"<td>$test_date</td>\";\n echo \"<td>$test_image</td>\";\n echo \"<td><a href=''>編集</td>\";\n echo \"<td><a rel=''>削除</td>\";\n echo \"<td><form action='sync.php' method='post'><div class='form-group'>\n <input type='hidden' name='test_id' value='\".$test_id.\"'>\n <input type='submit' class='btn' name='submit' value='書き出す'>\n </div></form></td>\";\n echo \"</tr>\";\n \n```\n\n}\n\ndb.php\n\n```\n\n <?php\n $db['db_host'] = \"localhost\";\n $db['db_user'] = \"root\";\n $db['db_pass'] = \"root\";\n $db['db_name'] = \"product\";\n \n foreach($db as $key => $value){\n define(strtoupper($key), $value);\n \n }\n $db = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);\n mysqli_set_charset($db,\"utf8\");\n ?>\n \n```", "comment_count": 6, "content_license": "CC BY-SA 3.0", "creation_date": "2016-03-28T02:29:00.323", "favorite_count": 0, "id": "23525", "last_activity_date": "2016-04-01T02:52:27.217", "last_edit_date": "2016-04-01T02:52:27.217", "last_editor_user_id": "30", "owner_user_id": "9013", "post_type": "question", "score": -2, "tags": [ "php", "mysql" ], "title": "phpでmysqlにデータを保存しているデータをid毎に静的フアィルhtmlに生成して書き出したいです", "view_count": 1093 }
[ { "body": "お待たせしました \nsync.phpの中身を下にまるまる書き換えて下さい。 \nまた、今回はエスケープを行うなどしてそのまま実用できるようにしました。\n\n```\n\n <?php\n // 取得するIDを取得(GET or POST name is test_id type:number)\n if (!isset($_GET['test_id']) && !isset($_POST['test_id'])) {\n print '[test_id] param not found. please set [test_id] param to url...
23525
23542
23542