question
dict | answers
list | id
stringlengths 2
5
| accepted_answer_id
stringlengths 2
5
⌀ | popular_answer_id
stringlengths 2
5
⌀ |
---|---|---|---|---|
{
"accepted_answer_id": "16389",
"answer_count": 1,
"body": "現在Google App Engine(GAE)とAndroidを連携させたアプリの開発をしています。 \n主な処理内容としてはAndroid端末から画像をGAEのBlobStoreにアップロードするというものです。\n\n手順としましては、 \n①Androidからサーバーにアクセスし、Blobkeyを取得 \n②取得したBlobkeyに画像データをアップロード\n\nそして問題としましては、 \nHttpPost httpPost = new HttpPost(URL); \nを行った時にIllegalArgumentExceptionが発生してしまいます。 \nJava.lang.IllegalArgumentException: Illegal character in path index 256:\n\nおそらく引数のURLが長すぎる為と考えているのですが、こちらの対処法または別の方法をご存知の方がいらっしゃいましたら教えていただきたいです。 \nちなみにURLの部分に入る文字の長さはlengthで測ったところ257文字でした。\n\n以下がソースとなります。\n\nクライアント側(Android4.0)\n\n```\n\n public void run() {\n /*▼▼▼BlobKey取得▼▼▼*/\n String url = \"http://xxxxxxxx.appspot.com/android\";\n String bkey = \"\";\n HttpClient httpClient = new DefaultHttpClient();\n HttpGet httpGet = new HttpGet(url);\n \n try {\n HttpResponse response = httpClient.execute(httpGet);\n HttpEntity entity = response.getEntity();\n bkey = EntityUtils.toString(entity);\n } catch (IOException e) {\n throw new RuntimeException(e);\n } finally {\n httpClient.getConnectionManager().shutdown();\n }\n /*▲▲▲ここまで▲▲▲*/\n \n \n /*▼▼▼アップロード▼▼▼*/\n try {\n String fileName = \"xxx.png\";\n httpClient = new DefaultHttpClient();\n if(bkey != null) {\n HttpPost httpPost = new HttpPost(bkey);\n ResponseHandler<String> responseHandler = new BasicResponseHandler();\n MultipartEntityBuilder builder = MultipartEntityBuilder.create();\n builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);\n File file = new File(fileName);\n FileBody fileBody = new FileBody(file);\n builder.addPart(\"myFile\", fileBody);\n httpPost.setEntity(builder.build());\n httpClient.execute(httpPost, responseHandler);\n }\n } catch (ClientProtocolException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n /*▲▲▲ここまで▲▲▲*/\n }}\n \n```\n\nサーバー側(servret JDK1.7)\n\n```\n\n public class BlobUploadServlet extends HttpServlet {\n private BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();\n BlobInfoFactory factory = new BlobInfoFactory();\n \n public void doPost(HttpServletRequest req, HttpServletResponse resp)\n throws IOException {\n \n Map<String, List<BlobKey>> blobs = blobstoreService.getUploads(req);\n List<BlobKey> bkList = blobs.get(\"myFile\");\n BlobKey blobKey = bkList.get(0); // type=\"file\"の name\n if ( blobKey == null ) {\n // 失敗\n resp.sendRedirect(\"/\");\n } else {\n PersistenceManagerFactory pmf = PMF.get();\n PersistenceManager pm = PMF.get().getPersistenceManager();\n \n //datastore\n BlobInfo blobInfo = factory.loadBlobInfo(blobKey);\n String filename = blobInfo.getFilename();\n String fileurl = blobKey.getKeyString();\n Date date = Calendar.getInstance().getTime();\n SampleData2 data = new SampleData2(filename,fileurl,date);\n \n try {\n pm.makePersistent(data);\n } finally {\n pm.close();\n }\n //resp.sendRedirect(\"/viewer?blob-key=\" + blobKey.getKeyString()); //直接画像へジャンプ\n resp.sendRedirect(\"/viewersd2\");\n }\n }}\n \n```",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-08T11:32:17.093",
"favorite_count": 0,
"id": "16383",
"last_activity_date": "2015-09-08T14:02:57.630",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12246",
"post_type": "question",
"score": 2,
"tags": [
"android",
"google-app-engine"
],
"title": "GAEとAndroidの連携について",
"view_count": 328
} | [
{
"body": "まず、 \nHttpPost httpPost = new HttpPost(bkey); \nとしていますが、bkeyに入ってるのはキー文字列だけで、URLになっていないと予想しますがいかがでしょう。 \nもし、変数bkeyがブロブキーをパラメータに持つURLならURLとブロブキーを分ける必要があります。\n\n分けた上で、 \nHttpPost httpPost = new HttpPost(bkey); \nhttpPost.getParameters().put(\"blob-key\", bkey); \nといった感じでパラメータとして渡してあげればURLが長くなることは無くなるはずです。 \n※末尾のコードはうろ覚えなのでコンパイルエラーが出ないように調整してみてください",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-08T14:02:57.630",
"id": "16389",
"last_activity_date": "2015-09-08T14:02:57.630",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12233",
"parent_id": "16383",
"post_type": "answer",
"score": 3
}
] | 16383 | 16389 | 16389 |
{
"accepted_answer_id": "16446",
"answer_count": 1,
"body": "タイトルの通りです。 \nご存知の方教えてください。\n\nNetbeansは8.0を使っています。\n\n**追記** \n今回の目的は、Netbeansの「宣言へ移動」機能を使用した際に、ソースが読めること。 \nまた、UMLでグラフィカルにクラス図を見ることもできるならば、その方法を教えてください。\n\n現在、JavaEEでWebシステムを作っており、 \n依存性はいずれもMavenで管理しています。\n\n```\n\n POM.xml\n \n <dependencies>\n <dependency>\n <groupId>javax</groupId>\n <artifactId>javaee-web-api</artifactId>\n <version>7.0</version>\n <scope>provided</scope>\n </dependency>\n <dependency>\n <groupId>org.primefaces</groupId>\n <artifactId>primefaces</artifactId>\n <version>5.2</version>\n </dependency>\n <dependency>\n <groupId>org.apache.logging.log4j</groupId>\n <artifactId>log4j-web</artifactId>\n <version>2.3</version>\n <scope>runtime</scope>\n </dependency>\n </dependencies>\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-08T14:48:15.707",
"favorite_count": 0,
"id": "16392",
"last_activity_date": "2017-04-30T09:14:30.427",
"last_edit_date": "2017-04-30T09:14:30.427",
"last_editor_user_id": "19110",
"owner_user_id": "12251",
"post_type": "question",
"score": 5,
"tags": [
"java",
"maven",
"netbeans",
"uml"
],
"title": "Netbeansで依存しているプロジェクトのソースを確認したい。",
"view_count": 2050
} | [
{
"body": "mavenで依存しているライブラリのソースを参照したいという話であれば、ソースを参照したいjarを右クリックして「ソースをダウンロード」を選択すればOKです。 \nなおNetBeansプロジェクト自体がmavenプロジェクトとなっていることが前提です。\n\n[](https://i.stack.imgur.com/LNJF0.png)\n\n依存するライブラリのソースをまとめてダウンロードしたい場合は「依存性」を右クリックしてから開くメニューからでも可能です。\n\n* * *\n\nソースのダウンロードが完了すればclassファイルのダブルクリックでソースを参照できます。もちろんユーザが開発しているソースから「宣言へ移動」でもジャンプできます。\n\n[](https://i.stack.imgur.com/x09Uq.png)\n\n* * *\n\nなおライブラリの依存関係についてはUMLとはちょっと違いますが、「アーティファクトの詳細表示」→「グラフ」タブ→「グラフの表示」という手順で図示可能です。\n\n[](https://i.stack.imgur.com/iVu5t.png)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T12:28:27.470",
"id": "16446",
"last_activity_date": "2015-09-09T12:28:27.470",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10492",
"parent_id": "16392",
"post_type": "answer",
"score": 6
}
] | 16392 | 16446 | 16446 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "次のHPを参考に、ElasticsearchにImage Pluginを追加したいと考えております。\n\n<https://medium.com/@kwendomi/elasticsearch-4812fc11c5ca>\n\n導入先の環境がネットワークに接続できないため、プラグインを別環境からダウンロードして追加しようと試みているのですが、インストールエラーが発生してしまいます。\n\n導入先環境\n\n```\n\n centOS\n install file:elasticsearch-image-master.zip\n java : 1.8.0_60\n ElasticSearch : 1.1.0\n lucene version : 4.7\n \n```\n\nインストールコマンド\n\n```\n\n elasticsearch/bin/plugin -u file///bin/elasticsearch/bin/elasticsearch-image-master.zip -i com.github.kzwang/elasticsearch-image/1.3.0\n \n```\n\nエラーメッセージ\n\n```\n\n Message:\n Error while installing plugin, reason: IllegalArgumentException:\n Plugin installation assumed to be site plugin, but contains source\n code, aborting installation.\n \n```\n\nどうか、ご教示のほどお願い致します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-08T14:56:53.380",
"favorite_count": 0,
"id": "16393",
"last_activity_date": "2015-11-08T17:00:18.417",
"last_edit_date": "2015-09-09T15:54:50.813",
"last_editor_user_id": "754",
"owner_user_id": "12250",
"post_type": "question",
"score": 2,
"tags": [
"java",
"centos",
"elasticsearch"
],
"title": "ElasticsearchにImage Pluginを追加したい",
"view_count": 185
} | [
{
"body": "GitHubからソースコードをZipでダウンロードしてないでしょうか。 \nソースはMavanでビルドしないといけません。 \nちょうど類似の質問があったのでこちらを参考にして下さい。\n\n<https://stackoverflow.com/questions/24283057/elasticsearch-building-and-\ninstalling-plugins>",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T03:33:46.987",
"id": "16415",
"last_activity_date": "2015-09-09T03:33:46.987",
"last_edit_date": "2017-05-23T12:38:56.467",
"last_editor_user_id": "-1",
"owner_user_id": "5008",
"parent_id": "16393",
"post_type": "answer",
"score": 1
}
] | 16393 | null | 16415 |
{
"accepted_answer_id": "16510",
"answer_count": 2,
"body": "java の .class ファイルは、 `javap`コマンドなどで型情報を取得できます。 \nスクリプトで処理を行いたいため、 javap で取得できるような情報を、 json や xml など、スクリプトで処理しやすい形に変換したいと考えています。\n\nこれを実現する方法はありますでしょうか。\n\n* * *\n\n(追記 9/11)\n\n欲しいものは、コマンドラインから起動するツールです。誤解を与えてしまったらすいません。\n\nイメージとしては、次のような java ファイルをコンパイルした .class ファイルがあったときに、\n\n```\n\n public class HelloWorld {\n private String name;\n \n HelloWorld(String name) {\n this.name = name;\n }\n \n public void hello() {\n System.out.println(\"Hello, \" + name);\n }\n \n public static void main (String[] args) {\n HelloWorld helloWorld = new HelloWorld(\"Foo\");\n helloWorld.hello();\n }\n }\n \n```\n\n次のような出力をしてくれるツールです。\n\n```\n\n {\n \"type\": \"class\",\n \"name\": \"HelloWorld\",\n \"visibility\": \"public\",\n \"fields\": [\n {\n \"name\": \"name\",\n \"type\": \"java.lang.String\",\n \"visibility\": \"private\",\n \"static\": false\n }\n ],\n \"methods\": [\n {\n \"name\": \"HelloWorld\",\n \"visibility\": \"package\",\n \"static\": false,\n \"args\": [\n \"java.lang.String\"\n ]\n },\n {\n \"name\": \"hello\",\n \"visibility\": \"public\",\n \"static\": false,\n \"args\": [],\n \"ret\": \"void\"\n },\n {\n \"name\": \"main\",\n \"visibility\": \"public\",\n \"static\": true,\n \"args\": [\n \"java.lang.String[]\"\n ],\n \"ret\": \"void\"\n }\n ]\n }\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-08T15:51:41.397",
"favorite_count": 0,
"id": "16396",
"last_activity_date": "2015-09-11T05:52:48.220",
"last_edit_date": "2015-09-10T15:40:34.467",
"last_editor_user_id": "754",
"owner_user_id": "754",
"post_type": "question",
"score": 4,
"tags": [
"java"
],
"title": ".class ファイルに含まれる型情報を json などスクリプトで扱いやすい形式に変換するには?",
"view_count": 383
} | [
{
"body": "まずRuntime使ってcmd.exeを実行しそのコマンドとしてjavapを動かす \n実行結果を文字列として受け取って、あとはDocumentBuilderとかElementクラスを使って書き出せば出来る気がする",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T05:15:32.017",
"id": "16461",
"last_activity_date": "2015-09-10T05:15:32.017",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10810",
"parent_id": "16396",
"post_type": "answer",
"score": -4
},
{
"body": "Javadocを出す仕組みをカスタマイズすることで実現できます。 \n<http://argius.hatenablog.jp/entry/2014/01/07/222423>\n\nDocletを実装したクラスでは、例示していただいたJSONの内容にかなり近い、次のようなクラスをハンドリングできます。 \n<https://docs.oracle.com/javase/jp/6/jdk/api/javadoc/doclet/com/sun/javadoc/MethodDoc.html> \n<https://docs.oracle.com/javase/jp/6/jdk/api/javadoc/doclet/com/sun/javadoc/ClassDoc.html>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T05:52:48.220",
"id": "16510",
"last_activity_date": "2015-09-11T05:52:48.220",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12233",
"parent_id": "16396",
"post_type": "answer",
"score": 5
}
] | 16396 | 16510 | 16510 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "以前の質問([n×n board\nにおけるナイト・ツアーの数えあげについて](https://ja.stackoverflow.com/questions/16301/n%C3%97n-board-%E3%81%AB%E3%81%8A%E3%81%91%E3%82%8B%E3%83%8A%E3%82%A4%E3%83%88-%E3%83%84%E3%82%A2%E3%83%BC%E3%81%AE%E6%95%B0%E3%81%88%E3%81%82%E3%81%92%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6)) \nでナイトツアーの数えあげを行いました。\n\nこのコードにさらに以下の二点を行うにはどうすればよろしいでしょうか? \n①条件を満たす経路を保持する。 \n②これらをリスト化して名前をつけてテキストファイルとして保存する。\n\n特に①については、 \n定義したsearchに対し、新たな変数(経路のログ)を加えるだけで解決しそうなのですが \n上手くいっていません。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-08T22:31:16.710",
"favorite_count": 0,
"id": "16399",
"last_activity_date": "2015-09-10T13:22:16.407",
"last_edit_date": "2017-04-13T12:52:38.920",
"last_editor_user_id": "-1",
"owner_user_id": "5363",
"post_type": "question",
"score": -1,
"tags": [
"ruby",
"c",
"アルゴリズム"
],
"title": "n×n board におけるナイト・ツアーを記録するには?",
"view_count": 213
} | [
{
"body": "座標を格納するスタックを作って、search に入るたびに座標を push して記録し、search から出るときに pop\nするのが常道かとも思いましたが、今回は経路の最大の深さが、あらかじめ分かっていますし、最後まで行かなければ答えが出せないので、最大の深さの要素を入れられる配列を用意して記録していくのがいいと思います。\n\nどこかに\n\n```\n\n struct Point {\n int x;\n int y;\n };\n \n struct Point path[36];\n \n```\n\nを定義して (path は必要に応じて配列にしたり、動的にアロケートしたりしてください ) 、\n\nsearch の中では\n\n```\n\n int search(int x, int y, int w, int h, int depth, struct Point * path){\n \n // ... 略 ...\n \n if (x < 0 || w <= x || y < 0 || h <= y || (used & (1 << (x + y * w))) > 0) return 0;\n path[depth-1].x = x; /* 配列に x 座標を記録 */\n path[depth-1].y = y; /* 配列に y 座標を記録 */\n if (depth == w * h) {\n // path の中に経路の座標が順番に入っているので保存する\n return 1;\n }\n \n // ... 略 ...\n }\n \n```\n\nのような感じでいいと思います。search を再帰的に呼び出しているところにも path を追加するのをお忘れなく。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-08T23:55:26.390",
"id": "16402",
"last_activity_date": "2015-09-08T23:55:26.390",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3605",
"parent_id": "16399",
"post_type": "answer",
"score": 1
},
{
"body": "(途中経過) \nとりあえず①についてはRubyなら以下のように書ける。 \n(Cではどう書くかわからなかった。)\n\nw = 5 のとき\n\n```\n\n def search(x, y, w, h, used, depth, path)\n return 0 if x < 0 || w <= x || y < 0 || h <= y || (used & (1 << (x + y * w))) > 0\n if depth == w * h\n path[depth - 1] = [x, y]\n p path\n return 1 \n end\n path[depth - 1] = [x, y]\n cnt = 0\n used += 1 << (x + y * w)\n cnt += search(x + 2, y - 1, w, h, used, depth + 1, path)\n cnt += search(x + 2, y + 1, w, h, used, depth + 1, path)\n cnt += search(x - 2, y - 1, w, h, used, depth + 1, path)\n cnt += search(x - 2, y + 1, w, h, used, depth + 1, path)\n cnt += search(x + 1, y - 2, w, h, used, depth + 1, path)\n cnt += search(x + 1, y + 2, w, h, used, depth + 1, path)\n cnt += search(x - 1, y - 2, w, h, used, depth + 1, path)\n cnt += search(x - 1, y + 2, w, h, used, depth + 1, path)\n used -= 1 << (x + y * w)\n return cnt\n end\n \n def main\n w = 5\n total = 0\n (0..w * w - 1).each{|i|\n path = []\n total += search(i % w, i / w, w, w, 0, 1, path)\n }\n p total\n end\n \n main\n \n```\n\n実行結果 \n(中略) \n[[4, 4], [3, 2], [2, 4], [0, 3], [1, 1], [3, 0], [4, 2], [3, 4], [1, 3], [0,\n1], [2, 0], [4, 1], [3, 3], [1, 4], [0, 2], [1, 0], [2, 2], [4, 3], [3, 1],\n[2, 3], [0, 4], [1, 2], [0, 0], [2, 1], [4, 0]] \n[[4, 4], [3, 2], [2, 4], [0, 3], [1, 1], [3, 0], [2, 2], [4, 3], [3, 1], [1,\n0], [0, 2], [1, 4], [3, 3], [4, 1], [2, 0], [0, 1], [1, 3], [3, 4], [4, 2],\n[2, 3], [0, 4], [1, 2], [0, 0], [2, 1], [4, 0]] \n1728",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T13:21:33.533",
"id": "16477",
"last_activity_date": "2015-09-10T13:21:33.533",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5363",
"parent_id": "16399",
"post_type": "answer",
"score": 0
}
] | 16399 | null | 16402 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "Gulpを使って8000番ポートでサーバーを立てて作業していたのですが、そのあとで他のプロジェクトを同じ8000番ポートでGulpでないサーバーを建てると以前のプロジェクトのhtmlが読み込まれ、新しいプロジェクトのテンプレートが一部表示されなくなってしまいました。 \n表示されなくなったURLは/ルートです。直し方を教えて下さい。\n\ngulpfileは以下のようになっています。\n\n```\n\n 1 var gulp = require('gulp'),\n 2 webserver = require('gulp-webserver');\n 3\n 4\n 5 gulp.task('webserver', function(){\n 6 gulp.src('app')\n 7 .pipe(webserver({\n 8 livereload: true,\n 9 }));\n 10 });\n 11\n 12 gulp.task('default', ['webserver']);\n 13\n 14\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T00:26:13.610",
"favorite_count": 0,
"id": "16405",
"last_activity_date": "2015-09-09T00:32:51.357",
"last_edit_date": "2015-09-09T00:32:51.357",
"last_editor_user_id": "7232",
"owner_user_id": "7232",
"post_type": "question",
"score": 3,
"tags": [
"html",
"gulp"
],
"title": "Gulpで建てたサーバのページがキャッシュされている?",
"view_count": 146
} | [] | 16405 | null | null |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "別のクラスの配列の要素数が変化した場合にViewControllerで処理を行いたいです。\n\n```\n\n //ViewController\n dataSource.addObserver(self, forKeyPath: \"dataArray\", options: .New, context: nil)\n \n override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer<Void>) {\n if(keyPath == \"dataArray\"){\n println(\"変化!\")\n \n }\n }\n \n```\n\nこの方法ではobserveValueForKeyPath内の処理が呼ばれませんでした。",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T01:41:59.690",
"favorite_count": 0,
"id": "16409",
"last_activity_date": "2015-10-09T07:19:39.357",
"last_edit_date": "2015-09-09T05:00:42.437",
"last_editor_user_id": "8060",
"owner_user_id": "8060",
"post_type": "question",
"score": 2,
"tags": [
"ios",
"swift"
],
"title": "SwiftでArrayの要素数を監視したい",
"view_count": 681
} | [
{
"body": "KVOではなく、Swiftの格納型プロパティのdidSetを使うのはどうでしょうか?\n\n```\n\n import Foundation\n \n protocol CountObserver {\n func didChange(newCount :Int)\n }\n \n class ArrayContainer {\n weak var delegate :CountObserver?\n \n var dataArray = [Int]() {\n didSet {\n if(oldValue.count != dataArray.count){\n delegate?.didChange(dataArray.count)\n }\n }\n }\n \n func doChange(){\n dataArray.append(Int(arc4random_uniform(100)))\n }\n }\n \n```\n\n* * *\n\nSwiftでObjective-CのKVO機構を使い、配列の要素を監視したい場合、\n\n * 監視元のオブジェクトはObjective-Cクラスでなければならない\n * 監視対象のプロパティはObjective-CのKVC準拠でなければならない\n\nという2点の問題があり、特に厄介なのが`NSMutableArray`の`count`は監視不可能なプロパティということです。対処法としては手動で通知メソッドを書くか、`mutableArrayValueForKeyPath:`を使うかですが、どちらも表題の要件を簡単に満たすのは難しいです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T05:03:22.323",
"id": "16421",
"last_activity_date": "2015-09-09T06:25:27.497",
"last_edit_date": "2015-09-09T06:25:27.497",
"last_editor_user_id": "5337",
"owner_user_id": "5337",
"parent_id": "16409",
"post_type": "answer",
"score": 3
}
] | 16409 | null | 16421 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": ".NET Framework4.0にて開発を行っております。 \nクラス内にロギング用の記述がいたるところに散らばってしまい、 \nまた、クラス内にログ出力記述が入る事によって、クラスが汎用的に使用できなくなり、 \n可読性も下がってしまっているので、そこを解決したいと思い、質問させて頂きます。\n\n現状は以下の通りです。\n\n```\n\n private class x\n private sub exec()\n --処理開始のログ出力記述\n --処理1\n ----クラスX.メソッドA\n ----クラスX.メソッドAでXX件のデータを処理\n ----クラスX.メソッドAが正常終了しました\n --処理2\n ----クラスY.メソッドA\n ----クラスY.メソッドAでXX件のデータを処理\n ----クラスY.メソッドAが正常終了しました\n --処理終了のログ出力記述\n End sub\n end class\n \n```\n\nロギング出力用のクラスを用意してあり、そのクラスのメソッドを、ログ出力のタイミングで \n引数を渡して呼び出しているのですが、複数のクラスに記述がまたがってしまったりと、 \nとにかく煩雑になってしまいます。 \nまた、問題解決の目的がロギングのみではなく、処理進行を表すフォームウィンドを操作する際にも同じ仕組が必要となってきています。\n\n<http://www.itmedia.co.jp/im/articles/0410/20/news086.html> \nこのサイトを参考にAOPやDIに関して色々と調べてみたのですが、具体的な解決策にたどり着けませんでした。\n\n何か具体的な解決策をご存知でしたら、お願いいたします。",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T01:47:26.290",
"favorite_count": 0,
"id": "16410",
"last_activity_date": "2015-09-10T15:51:49.240",
"last_edit_date": "2015-09-09T07:26:13.547",
"last_editor_user_id": "5008",
"owner_user_id": "12258",
"post_type": "question",
"score": 3,
"tags": [
"visual-studio",
"vb.net",
"delegate"
],
"title": "クラス内に存在するロギング用の記述について",
"view_count": 2158
} | [
{
"body": ".NETであれば、[PostSharp](https://www.postsharp.net/)はいかがでしょうか。 \n商用目的でも無料([このページ](https://www.postsharp.net/purchase/faq)の「Can I use PostSharp\nExpress for commercial products?」)で使えます。 \n無料版は機能制限がありますが、ログ出力であれば十分だと思います。\n\nC#の例で申し訳ないですが、こんな感じで使います:\n\n```\n\n [MyLogging]\n public class ClassX\n {\n public int MethodA(...)\n {\n ...\n }\n }\n \n```\n\n`MyLogging`属性はPostSharpのライブラリにあるクラスを継承して自分で作ります。\n\n```\n\n public sealed class MyLoggingAttribute : OnMethodBoundaryAspect\n {\n public override void OnEntry(MethodExecutionArgs args)\n {\n // 対象のメソッドの処理の前に呼ばれる\n // args に引数とか対象クラスのインスタンスとか入ってる\n }\n public override void OnExit(MethodExecutionArgs args)\n {\n // 対象のメソッドの処理の後(returnの後)に呼ばれる\n // args はOnEntryのものと同じだが、戻り値も入ってる\n }\n }\n \n```\n\nこの属性をクラスに付けると、そのクラスのメソッドが呼ばれるたびに、`OnEntry`と`OnExit`が呼ばれるので、そこでログ出力処理とか書けばOKです。 \nクラスではなくメソッドに属性をつければ、そのメソッドだけログ出力できます。\n\nただ、「XX件のデータを処理」のような出力をするには何らかの工夫が必要だと思います。 \n必ず件数を戻り値で返すようにするとか・・・\n\nPostSharpは、Visual Studioの「拡張機能と更新プログラム」で、「オンライン」から検索してインストールすればすぐ使えます。\n\n補足ですが、AOPフレームワークには色々な実現方法があり、PostSharpは「ビルド時にILを書き換える」という方式を採っています。 \nなので、量次第ですが、ビルドは遅くなります。 \nしかし、「プロキシクラスを使う」方式に比べて、「あるクラスを継承しなければならない」とかの制限が無いですし、実行時のパフォーマンスも有利です。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T11:24:35.857",
"id": "16475",
"last_activity_date": "2015-09-10T15:51:49.240",
"last_edit_date": "2015-09-10T15:51:49.240",
"last_editor_user_id": "2238",
"owner_user_id": "8078",
"parent_id": "16410",
"post_type": "answer",
"score": 2
},
{
"body": "設計例の参考になるのと、もしくは独自実装からの置き換えも検討できると思い、[NLog](http://nlog-project.org/)を紹介します。\n\n```\n\n using NLog;\n \n public class MyClass\n {\n private static Logger logger = LogManager.GetCurrentClassLogger();\n \n public void MyMethod1()\n {\n logger.Trace(\"Sample trace message\");\n logger.Debug(\"Sample debug message\");\n logger.Info(\"Sample informational message\");\n logger.Warn(\"Sample warning message\");\n logger.Error(\"Sample error message\");\n logger.Fatal(\"Sample fatal error message\");\n \n // alternatively you can call the Log() method \n // and pass log level as the parameter.\n logger.Log(LogLevel.Info, \"Sample informational message\");\n }\n }\n \n```\n\nクラスの静的メンバーに Logger\nを生成して各クラスで利用します。その他の例は[Wiki](https://github.com/nlog/nlog/wiki/Tutorial)に良くまとまっているのでご一読ください。 \nコードに記述するログ出力処理は、ログのメッセージとレベル(`Fatal,Error,・・・`)だけで、その出力先(`Target`)やフォーマットは[NLog.Config](https://github.com/nlog/nlog/wiki/Configuration-\nfile)でコントロールします。デザインが明快で気に入っています。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T13:17:16.027",
"id": "16476",
"last_activity_date": "2015-09-10T13:17:16.027",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "2238",
"parent_id": "16410",
"post_type": "answer",
"score": 0
}
] | 16410 | null | 16475 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "Unity Remote 4でAndroidで実機再生しましたが、Unityでは画面は横長だったのに \nAndroidでは縦長になっています。その際、画面が横幅縮小され解像度が下がるのですが \nこれは実機再生しながら調整するのが好ましいということですか? \nまた、Androidの端末によって解像度、API?も違うのでそれぞれの端末に合わせる方法 \nはありますか?\n\nまた大きいサイズ(769×1000)のような画像を解像度を落とさずに小さく表示するには \nカメラの位置を移動する必要がありますか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T02:41:04.827",
"favorite_count": 0,
"id": "16411",
"last_activity_date": "2015-09-11T00:16:05.077",
"last_edit_date": "2015-09-09T05:39:55.663",
"last_editor_user_id": "7290",
"owner_user_id": "9268",
"post_type": "question",
"score": 4,
"tags": [
"android",
"c#",
"unity3d"
],
"title": "Androidの端末ごとの解像度",
"view_count": 671
} | [
{
"body": "僕の方では UI\nのButtonが画面にあるとして、そのButtonの幅がある割合(表示幅の50%)になるように解像度を変更する、という自作のスクリプトを用意しています。\n\n[ScreenSizeKeeper.cs](https://github.com/yasokada/unity-150825-TELChecker/blob/master/Assets/ScreenSizeKeeper.cs)\n\n```\n\n using UnityEngine;\n using System.Collections;\n using UnityEngine.UI;\n \n public class ScreenSizeKeeper : MonoBehaviour {\n \n public Button myButton; // set UI>Button whose width is used as standard\n \n bool isRunningOnAndroid() {\n return (Application.platform == RuntimePlatform.Android);\n }\n \n void Start () {\n if (isRunningOnAndroid () == false) {\n return;\n }\n float aspect = (float)Screen.height / (float)Screen.width;\n float buttonRatio = 0.5f; // 50%\n int buttonWidth = (int)myButton.GetComponent<RectTransform> ().rect.width;\n float newWidth, newHeight;\n \n newWidth = buttonWidth / buttonRatio;\n newHeight = newWidth * aspect;\n \n Screen.SetResolution ((int)newWidth, (int)newHeight, false);\n } \n }\n \n```\n\n上記スクリプトをEmptyなGameObject(名前: ScreenSizeKeeper)に関連付けして画面解像度を調整しています。\n\nVerticalとHorizontalの切替は考慮されていません。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T06:11:11.770",
"id": "16424",
"last_activity_date": "2015-09-09T06:11:11.770",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4840",
"parent_id": "16411",
"post_type": "answer",
"score": 2
},
{
"body": "Unity Remote\n4はGameViewの画面を端末に転送します。なので、横長の画面を縦長の端末へ転送すると端末が縦長になります。なので横長の画面をUnity\nRemoteで再生したい場合は、端末を回して横長にする必要があると思います。 \n基本的にGameViewの解像度を引き延ばすので、レイアウトを確認したい場合はGameViewも端末のレイアウト(解像度ではなくアスペクト比)と同じものにするか、端末へ転送するのが良い気がします。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T00:16:05.077",
"id": "16489",
"last_activity_date": "2015-09-11T00:16:05.077",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8492",
"parent_id": "16411",
"post_type": "answer",
"score": 3
}
] | 16411 | null | 16489 |
{
"accepted_answer_id": null,
"answer_count": 3,
"body": "以下のようなXMLサンプルがあるとき、XSLでHTMLタグに変換したいと思っています。\n\n```\n\n <root>\n <section>\n <container>\n aaa\n <box>\n book\n </box>\n bbb\n <box>\n pen\n </box>\n ccc\n <superscript>\n 3\n </superscript>\n ddd\n </container>\n </section>\n </root>\n \n```\n\nXSLで、以下のような結果を得ることは出来るでしょうか?「aaa」「bbb」「ccc3ddd」をpタグでラップし、「box」にはdivタグを、「superscript」にはspanタグを割り当てたいと考えています。よろしければ、アドバイスお願いします。\n\n```\n\n <div>\n <p>aaa</p>\n <div>book</div>\n <p>bbb</p>\n <div>pen</div>\n <p>ccc<span>3</span>ddd</p>\n </div>\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T02:45:22.037",
"favorite_count": 0,
"id": "16413",
"last_activity_date": "2015-09-12T05:52:07.953",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12259",
"post_type": "question",
"score": 2,
"tags": [
"xml",
"xsl"
],
"title": "XMLのテキストノードを要素ノードでラップしたい(条件あり)",
"view_count": 499
} | [
{
"body": "XSLは実際に使ったことが無いのですが、DOMのパース方法をメタに記述できるものだというざっくりした理解でお話させていてだくと、 \n一般的にDOM操作でテキストノードをパースさせようとすると記述が非常に冗長になりますよ。 \n例えばboxタグの内容、実際のテキストノードとしては[CR][TAB][TAB][TAB][TAB]book[CR]のようにテキストノードに入っています。ブラウザで扱うとbookだけが見えますが、それはブラウザのレンダリングの規則がそうなっているからでしかないのです。 \nたとえばsectionタグ、厳密にパースするとcontainerの後ろに[CR][TAB]というテキストノードが入っていると報告されます。タグの終わりに限らず、ヒトが見やすいように入れた改行も全部CRがあるといって報告されます。 \nこういったものの解釈は結局人が手で与えなければいけなくて、かなり大変ですよ。\n\nできればデータ構造をみなおして意味のあるテキストノードにはタグを振った方がいいと思います。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T01:07:09.717",
"id": "16455",
"last_activity_date": "2015-09-10T01:07:09.717",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8136",
"parent_id": "16413",
"post_type": "answer",
"score": 0
},
{
"body": "sken2 さんの回答を読んでいて思いついたのですが、強引にやればできなくはない、といった所でしょうか…。\n\n**sample.xslt**\n\n```\n\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <xsl:stylesheet version=\"2.0\"\n xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n \n <xsl:output method=\"html\" encoding=\"UTF-8\"/>\n \n <xsl:template match=\"/\">\n <html>\n <body>\n <xsl:apply-templates/>\n </body>\n </html>\n </xsl:template>\n \n <xsl:template match=\"section\">\n <xsl:for-each select=\"container\">\n <xsl:variable name=\"item\" select=\"tokenize(normalize-space(.), ' ')\"/>\n <div>\n <xsl:for-each select=\"text()|*\">\n <xsl:choose>\n <xsl:when test=\"name(.)='box'\">\n <xsl:variable name=\"n\" select=\"position()-1\"/>\n <p><xsl:value-of select=\"$item[$n]\"/></p>\n <div><xsl:value-of select=\"normalize-space(.)\"/></div>\n </xsl:when>\n <xsl:when test=\"name(.)='superscript'\">\n <xsl:variable name=\"n\" select=\"position()-1\"/>\n <xsl:variable name=\"m\" select=\"position()+1\"/>\n <p>\n <xsl:value-of select=\"$item[$n]\"/>\n <span><xsl:value-of select=\"normalize-space(.)\"/></span>\n <xsl:value-of select=\"$item[$m]\"/>\n </p>\n </xsl:when>\n </xsl:choose>\n </xsl:for-each>\n </div>\n </xsl:for-each>\n </xsl:template>\n \n </xsl:stylesheet>\n \n```\n\nXSLT プロセッサとして [saxonb-xslt](http://saxon.sourceforge.net/) を使用しています。`tokenize`\n関数を利用していますので、XSLT 2.0 対応のプロセッサが必要です。\n\n`for-each` 〜 `choose` としているのはノードの順序保持のためです。ただ、やはり sken2\nさんの言うとおり、データ構造を変更する方が良いかと思います。例えば、`aaa` や `ccc` を属性(attribute)にすればパースは簡単になります。\n\n```\n\n <box id=\"aaa\">book</box>\n <superscript id1=\"ccc\" id2=\"ddd\">3</superscript>\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T03:16:50.627",
"id": "16459",
"last_activity_date": "2015-09-10T03:16:50.627",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": null,
"parent_id": "16413",
"post_type": "answer",
"score": 0
},
{
"body": "今までいろいろXSLTで変換をやっていますが、入力XMLでもう少しちゃんとタグ付けをしていてくれたら良いのにと思ってもなかなかお客様の元データを直すわけにはいかず、XSLTスタイルイート側で吸収しなければならないことが多々ありました.\n\n今回のご質問も\"aaa\",\"bbb\",\"ccc\"~\"ddd\"がpでタグ付けされていれば電車道ですね.でもそう行かないのでしょう.このような場合グルーピングの問題として解決することが出来るのではないか?と思います.つまりcontainer要素以下のnode()をbox要素かそうでないものかによってグルーピングするのです.\n\n * box要素の場合は個々にdiv要素に変換します.\n * 他のノードの場合はp要素にグルーピングして変換します\n\nargusさんのスタイルシートを参考にさせていただき、XSLT 2.0のxsl:for-each-groupで実現したのが以下のコードです.\n\n```\n\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n exclude-result-prefixes=\"xs\"\n version=\"2.0\">\n <xsl:output method=\"html\" encoding=\"UTF-8\"/>\n \n <xsl:template match=\"/\">\n <html>\n <body>\n <xsl:apply-templates/>\n </body>\n </html>\n </xsl:template>\n \n <xsl:template match=\"section\">\n <xsl:for-each select=\"container\">\n <div>\n <xsl:for-each-group select=\"node()\" group-adjacent=\"name(.) eq 'box'\">\n <xsl:choose>\n <xsl:when test=\"current-group()[self::box]\">\n <xsl:apply-templates select=\"current-group()\"/>\n </xsl:when>\n <xsl:otherwise>\n <p>\n <xsl:apply-templates select=\"current-group()\"/>\n </p>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:for-each-group>\n </div>\n </xsl:for-each>\n </xsl:template>\n \n <xsl:template match=\"box\">\n <div>\n <xsl:apply-templates/>\n </div>\n </xsl:template>\n \n <xsl:template match=\"superscript\">\n <span>\n <xsl:apply-templates/>\n </span>\n </xsl:template>\n \n <xsl:template match=\"text()\">\n <xsl:value-of select=\"normalize-space(.)\"/>\n </xsl:template>\n \n </xsl:stylesheet>\n \n```\n\n結果は以下のようになります.\n\n```\n\n <html>\n <body>\n <div>\n <p>aaa</p>\n <div>book</div>\n <p>bbb</p>\n <div>pen</div>\n <p>ccc<span>3</span>ddd\n </p>\n </div>\n </body>\n </html>\n \n```\n\nそれなりに自然な流れのスタイルシートになっていると思います.(何故か\"ddd\"のあとで改行されていてそれだけ疑問ですが???)\n\n参考にしていただければ幸いです.",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T05:43:58.727",
"id": "16541",
"last_activity_date": "2015-09-12T05:52:07.953",
"last_edit_date": "2015-09-12T05:52:07.953",
"last_editor_user_id": "9503",
"owner_user_id": "9503",
"parent_id": "16413",
"post_type": "answer",
"score": 3
}
] | 16413 | null | 16541 |
{
"accepted_answer_id": "16433",
"answer_count": 1,
"body": "[bitbucket](https://bitbucket.org/)にてプライベートリポジトリをいくつも作っているのですが、いくつかのリポジトリにて同じファイル(例:\nFolderCopyUnit.cpp )をそれぞれのリポジトリに持たせています。\n\nFolderCopyUnit.cpp という名前がわかっている時に、それを含めているリポジトリがどれかを知りたいと思います。\n\nbitbucketのヘルプなど探したり検索ボックスらしきものを試しましたが、今のところ方法は見つかっていません。\n\nご存じの方おられますでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T02:53:03.230",
"favorite_count": 0,
"id": "16414",
"last_activity_date": "2015-09-09T08:30:24.080",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4840",
"post_type": "question",
"score": 2,
"tags": [
"git",
"bitbucket"
],
"title": "bitbucket > プライベートリポジトリ > ファイル名からそのファイルを含むリポジトリの探索",
"view_count": 606
} | [
{
"body": "Atlassianのサポートに問い合わせたところ、「そのようなツールはありません」との回答をいただいた。\n\n検索対象としたいリポジトリを全部プルしてから、Windows上でエクスプローラーの検索などを使うことになりそう。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T08:30:24.080",
"id": "16433",
"last_activity_date": "2015-09-09T08:30:24.080",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4840",
"parent_id": "16414",
"post_type": "answer",
"score": 1
}
] | 16414 | 16433 | 16433 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "[Olympus Camera Kit](https://opc.olympus-\nimaging.com/sdkdocs/index.html)経由で傾き(roll,\npitch)を取得しようとしています。Android版の[OAModeDial](http://app.olympus-\nimaging.com/oamodedial/ja/)を見ると水準器の表示は微妙な角度の変化に追随しています。\n\nCAMERA\nKITを使ったアプリでは、カメラの傾きが変化するにつれて`onUpdateStatus()`が`LevelGauge`で呼ばれるのだろうと思うのですが、コードを書いて動かしてみると得られたmapから`orientation`で引いた値(`landscape`とか`portrait_left`とか)が変化した場合にしか、角度の通知が行われません。そのような仕様なのでしょうか。\n\nなお、`onUpdateStatus()`が呼ばれない場合、例えば`onUpdateLiveView()`から\n`getLevelGauge()`を呼んでみても、角度値は更新されていないようで、角度を得る方法がありません。\n\nコードは以下のような感じです。\n\n```\n\n void onUpdateStatus(OLYCamera camera, final String name) {\n ...\n } else if (name.equalsIgnoreCase(\"LevelGauge\")) {\n updateAngles();\n } ...\n \n private void updateAngles() {\n ....\n Map<String, Object> map = camera.getLevelGauge();\n if (map != null) {\n Float rolling = (Float)map.get(OLYCamera.LEVEL_GAUGE_ROLLING_KEY );\n Float pitching = (Float)map.get(OLYCamera.LEVEL_GAUGE_PITCHING_KEY);\n }\n ....\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T03:48:14.817",
"favorite_count": 0,
"id": "16416",
"last_activity_date": "2015-10-07T23:51:51.767",
"last_edit_date": "2015-09-09T05:42:41.130",
"last_editor_user_id": "5337",
"owner_user_id": "12261",
"post_type": "question",
"score": 4,
"tags": [
"android",
"olympus-camerakit"
],
"title": "Olympus Camera Kitによる傾きの取得",
"view_count": 162
} | [
{
"body": "OPCサポートです。\n\nご質問ありがとうございます。 \nCamera Kitを調査しましたところ、不具合があることが判明いたしました。 大変失礼いたしました。\n\nアップデート版を公開予定ですので、もうしばらくお待ちください。\n\n(2015.10.08追記) \n大変お待たせいたしました。 \nver. 1.1.1にて対応いたしました。\n\nよろしくお願いします。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T08:06:54.263",
"id": "16515",
"last_activity_date": "2015-10-07T23:51:51.767",
"last_edit_date": "2015-10-07T23:51:51.767",
"last_editor_user_id": "8370",
"owner_user_id": "8370",
"parent_id": "16416",
"post_type": "answer",
"score": 3
}
] | 16416 | null | 16515 |
{
"accepted_answer_id": "16425",
"answer_count": 1,
"body": "AngularJS×OnsenUIで開発を行っています。 \nOnsenUIのpopover内にng-clickをセットしても、イベントとして検知されません。 \n([Plunker](http://plnkr.co/edit/u51GvOcAyUHeq5pSttIa?p=preview)にソースを置いています) \n解決方法はありますでしょうか?\n\nどなたかわかる方いらっしゃいましたら、ご教示いただけると幸いです。 \nplunkerにソースがあります。\n\n何卒、よろしくお願い申し上げます。\n\n\\---------- HTML(index) ----------\n\n```\n\n <!DOCTYPE html>\n <html ng-app=\"myApp\">\n \n <head>\n <script data-require=\"angular.js@*\" data-semver=\"1.2.28\" src=\"https://code.angularjs.org/1.2.28/angular.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/onsen/1.2.1/js/onsenui.min.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.4/ui-bootstrap-tpls.min.js\"></script>\n <link rel=\"stylesheet\" href=\"style.css\" />\n <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/onsen/1.2.1/css/onsenui.min.css\" />\n <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/onsen/1.2.1/css/onsen-css-components.css\" />\n <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/onsen/1.2.1/css/onsen-css-components-blue-basic-theme.css\" />\n <link rel=\"stylesheet\" href=\"http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css\" />\n <!--<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\"/>-->\n <link rel=\"stylesheet\" href=\"bootstrap.css\" />\n <script src=\"script.js\"></script>\n </head>\n \n <body>\n <ons-page ng-controller=\"AppController\" class=\"page\">\n <div class=\"navigation-bar\">\n <div class=\"navigation-bar__left\"></div>\n <div class=\"navigation-bar__center\">\n Popover \n </div>\n </div>\n <div style=\"text-align: center\">\n <br />\n <br />\n <ons-button id=\"button\" ng-click=\"showMenu('#button')\">Click me!</ons-button>\n </div>\n </ons-page>\n \n </body>\n \n </html>\n \n```\n\n\\---------- HTML(popoverに表示する内容) ----------\n\n```\n\n <ons-template id=\"popover_menu\">\n <div ng-controller=\"AppController\">\n <ons-popover cancelable style=\"width: 95%; max-width: 300px;\" direction=\"down\">\n <ons-row>\n <ons-col class=\"pop-menu-item-col\" ng-click=\"hideMenu()\">\n <ons-icon icon=\"ion-upload\" class=\"pop-menu-item-icon\"></ons-icon>\n <div class=\"pop-menu-item-label\">アップロード</div>\n </ons-col>\n <ons-col class=\"pop-menu-item-col\" ng-click=\"hideMenu()\">\n <ons-icon icon=\"ion-folder\" class=\"pop-menu-item-icon\"></ons-icon>\n <div class=\"pop-menu-item-label\">フォルダを作成</div>\n </ons-col>\n <ons-col class=\"pop-menu-item-col\" ng-click=\"hideMenu()\">\n <ons-icon icon=\"ion-edit\" class=\"pop-menu-item-icon\"></ons-icon>\n <div class=\"pop-menu-item-label\">編集</div>\n </ons-col>\n </ons-row>\n </ons-popover>\n </div>\n </ons-template> \n \n```\n\n\\---------- Javascript ----------\n\n```\n\n var app = angular.module('myApp',['onsen','ui.bootstrap']);\n \n app.controller('AppController',function($scope){\n ons.createPopover('./popover-menu.html').then(function(popover) {\n $scope.popmenu = popover;\n });\n \n $scope.showMenu = function(e) {\n $scope.popmenu.show(e);\n };\n \n $scope.hideMenu = function(){\n $scope.popmenu.hide();\n }\n \n });\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T04:13:10.360",
"favorite_count": 0,
"id": "16417",
"last_activity_date": "2015-09-09T06:39:43.500",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12198",
"post_type": "question",
"score": 1,
"tags": [
"onsen-ui",
"angularjs"
],
"title": "OnsenUIのpopover内でng-clickが効かない?",
"view_count": 2111
} | [
{
"body": "```\n\n <ons-page ng-controller=\"AppController\" class=\"page\">\n \n```\n\nと\n\n```\n\n <ons-template id=\"popover_menu\">\n <div ng-controller=\"AppController\">\n \n```\n\nで`ng-controller`の名前が重複しています。 \nまた、`<ons-popover>`は新しいスコープを作るようなので2つ目の`ng-controller`は`<ons-\npopover>`に付けた方が良さそうです。\n\n上記を踏まえてとりあえず動くサンプルを作成しました。 \nただ、このサンプルだと\n\n```\n\n $scope.hideMenu = function() {\n $scope.$parent.$$childHead.popover.hide();\n }\n \n```\n\nの辺りが強引なので、やり方を検討する余地があるかと思います。 \n[こちらの回答](https://ja.stackoverflow.com/questions/9134/ons-\npopover%E5%88%A9%E7%94%A8%E6%99%82%E3%81%AEjavascript%E3%81%AE%E5%A4%89%E6%95%B0%E3%81%AE%E5%80%A4%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6/9144#9144)に記載しているようにポップオーバーを外出しするのも一案かもしれません。\n\n```\n\n var module = ons.bootstrap();\r\n module.controller('AppController', function($scope) {\r\n ons.createPopover('popover.html').then(function(popover) {\r\n $scope.popover = popover;\r\n });\r\n \r\n $scope.showMenu = function(e) {\r\n $scope.popover.show(e);\r\n };\r\n });\r\n module.controller('PopupController', function($scope) {\r\n $scope.hideMenu = function() {\r\n // ここは強引なのでやり方を変えた方が良さそう\r\n $scope.$parent.$$childHead.popover.hide();\r\n }\r\n });\n```\n\n```\n\n .pop-menu-item-col {\r\n text-align: center;\r\n padding: 12px 0 12px 0;\r\n }\r\n \r\n .pop-menu-item-col:not(:first-child) {\r\n border-left: 1px solid #eee;\r\n }\r\n \r\n .pop-menu-item-col:active {\r\n background-color: #eee;\r\n }\r\n \r\n .pop-menu-item-label {\r\n font-size: 11px;\r\n color: #333;\r\n margin-top: 3px;\r\n }\r\n \r\n .pop-menu-item-icon {\r\n color: #999;\r\n font-size: 38px;\r\n }\r\n \r\n .popover__content {\r\n min-height: 0;\r\n }\n```\n\n```\n\n <link href=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.6/build/css/onsenui.css\" rel=\"stylesheet\"/>\r\n <link href=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.6/build/css/onsen-css-components.css\" rel=\"stylesheet\"/>\r\n \r\n <ons-page ng-controller=\"AppController\">\r\n <ons-toolbar>\r\n <div class=\"center\">Popover</div>\r\n </ons-toolbar>\r\n <div style=\"text-align: center\">\r\n <br />\r\n <br />\r\n <ons-button id=\"button\" ng-click=\"showMenu('#button')\">Click me!</ons-button>\r\n </div> \r\n </ons-page>\r\n \r\n <ons-template id=\"popover.html\">\r\n <ons-popover cancelable style=\"width: 95%; max-width: 300px;\" direction=\"down\" ng-controller=\"PopupController\">\r\n <ons-row>\r\n <ons-col class=\"pop-menu-item-col\" ng-click=\"hideMenu()\">\r\n <ons-icon icon=\"ion-upload\" class=\"pop-menu-item-icon\"></ons-icon>\r\n <div class=\"pop-menu-item-label\">アップロード</div>\r\n </ons-col>\r\n <ons-col class=\"pop-menu-item-col\" ng-click=\"hideMenu()\">\r\n <ons-icon icon=\"ion-folder\" class=\"pop-menu-item-icon\"></ons-icon>\r\n <div class=\"pop-menu-item-label\">フォルダを作成</div>\r\n </ons-col>\r\n <ons-col class=\"pop-menu-item-col\" ng-click=\"hideMenu()\">\r\n <ons-icon icon=\"ion-edit\" class=\"pop-menu-item-icon\"></ons-icon>\r\n <div class=\"pop-menu-item-label\">編集</div>\r\n </ons-col>\r\n </ons-row>\r\n </ons-popover>\r\n </ons-template>\r\n \r\n <script src=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.6/build/js/angular/angular.min.js\"></script>\r\n <script src=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.6/build/js/onsenui.min.js\"></script>\n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T06:39:43.500",
"id": "16425",
"last_activity_date": "2015-09-09T06:39:43.500",
"last_edit_date": "2017-04-13T12:52:39.113",
"last_editor_user_id": "-1",
"owner_user_id": "3516",
"parent_id": "16417",
"post_type": "answer",
"score": 0
}
] | 16417 | 16425 | 16425 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "monacaを使ってハイブリッドアプリケーションの開発を行っています. \nAndriod内で,他にインストールされているアプリケーションを起動したいのですが,うまくいきません. \nWebIntentプラグインを用いて,以下のようなものを試してみました. \nurlを`package:/data/app/package.apk`にした場合でもうまくいきませんでした.\n\n```\n\n window.plugins.webintent.startActivity({\n action: window.plugins.webintent.ACTION_VIEW,\n url: 'package://package_name'\n },\n function() {},\n function() {alert('Failed to open URL via Android Intent')}\n )}\n \n```\n\nmonacaでインストールされている他のアプリケーションを起動する方法はないでしょうか.よろしくお願いします.",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T04:23:30.130",
"favorite_count": 0,
"id": "16418",
"last_activity_date": "2015-09-09T04:23:30.130",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12263",
"post_type": "question",
"score": 1,
"tags": [
"monaca",
"cordova"
],
"title": "monacaにて他のインストールされているアプリケーションの起動方法について",
"view_count": 597
} | [] | 16418 | null | null |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "[ons-carouselのメソッド](http://ja.onsen.io/reference/ons-carousel.html#methods-\nsummary)を幾つか試しています。 \nons-carouselから以下の情報が取得できるのでしょうか\n\n 1. ons-carousel-item要素数\n 2. 自ons-carousel-itemが最終かどうか(true,false)\n\nもし上記情報の取得情報がご存知でしたら、ご教示のほどお願いいたします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T05:03:34.933",
"favorite_count": 0,
"id": "16422",
"last_activity_date": "2016-11-09T22:26:13.250",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9561",
"post_type": "question",
"score": 1,
"tags": [
"javascript",
"jquery",
"onsen-ui",
"angularjs",
"cordova"
],
"title": "<ons-carousel>のメソッドについて教えて下さい。",
"view_count": 255
} | [
{
"body": "要素数については以下で取得できるようです。 \n`_getCarouselItemCount()`\n\nただしこのメソッドは、見て分かる通りOnsenUIの内部用のメソッドであるため、今後のバージョンアップ等で名前の変更や、削除されることもあるのを覚悟しておく必要が有ります。\n\n後は、現在のindex番号(0から始まる数値)は取得できるので、上のメソッドで取得した要素数と比較して最終のアイテムであるかどうかは判断できると思います。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T07:12:01.517",
"id": "16427",
"last_activity_date": "2015-09-09T07:12:01.517",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9474",
"parent_id": "16422",
"post_type": "answer",
"score": 1
},
{
"body": "`ons-carousel-item`の要素数を取得するだけなら \n`document.getElementsByTagName('ons-carousel-item').length` \nとかでも良い気がします。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T07:54:02.167",
"id": "16431",
"last_activity_date": "2015-09-09T07:54:02.167",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3516",
"parent_id": "16422",
"post_type": "answer",
"score": 1
}
] | 16422 | null | 16427 |
{
"accepted_answer_id": "16542",
"answer_count": 3,
"body": "今現在、SQLのnewsというテーブルに7,8つデータが入っています。 \nサイト上の表示ではlimit5で5つまでを表示しているのですが、もっと読むというボタンをつけて、6以降のデータも表示したいと思っています。\n\nいろいろ調べてみるとajaxを使うなどがあったのですが、このページにjqueryを加えるだけで出来ないものでしょうか?\n\n```\n\n <dl class=\"clearfix\">\n $sql = \"SELECT * FROM news\";\n $sql = \"SELECT * FROM news LIMIT 5\";\n $stmt = $pdo->prepare($sql);\n $stmt->execute();\n $results = $stmt->fetchAll(PDO::FETCH_ASSOC);\n foreach($results as $row) {\n echo'<dt class=\"news-date\">'.$row[\"create_date\"].'</dt>';\n echo '<dd class=\"news-description\"><a href=\"news.php?news_id=' . $row[\"news_id\"] . '\">' .mb_substr($row[\"news_title\"],0,10).\"...\". '</a>';\n echo \"<hr>\";\n } \n $pdo = null;\n ?> \n <p id=\"loading\" style=\"display:none;\">loading...</p>\n <input type=\"button\" id=\"more\" value=\"もっと読む\">\n </dl>\n \n \n \n <script>\n $(function(){\n $(\"#more\").click(function(){\n $(\"#loading\").show();\n });\n });\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T07:18:40.153",
"favorite_count": 0,
"id": "16429",
"last_activity_date": "2015-09-12T05:46:23.347",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8415",
"post_type": "question",
"score": 0,
"tags": [
"php",
"jquery",
"mysql"
],
"title": "PHPでもっと見る機能の実装",
"view_count": 1927
} | [
{
"body": "的外れな回答かもしれませんが、\n\n```\n\n $sql = \"SELECT * FROM news LIMIT 5\";\n \n```\n\nを\n\n```\n\n $sql = \"SELECT * FROM news LIMIT \".5*$count;\n \n```\n\nとし、 \nもっと読むボタン押下時に$countをインクリメントすれば \nLIMIT 5, LIMIT 10, LIMIT 15・・・ と増やせるのかもしれません。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T14:09:46.010",
"id": "16449",
"last_activity_date": "2015-09-09T14:09:46.010",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12198",
"parent_id": "16429",
"post_type": "answer",
"score": 1
},
{
"body": "SQLでリミットをかけずに全て読み込み、javascriptでその値を読み込めばいいのではないでしょうか? \njQueryのみで実装するのであればjavascriptでその値を持っておく必要があると思います。 \nまた、初期表示はPHPで出力すれば良いかと思いますが、 \n下記のような感じで、もっと読む押下時にjQueryで動的に追加すれば良いかと思います。\n\n```\n\n <dl class=\"clearfix\">\n <div id=\"data\">\n <?php\n $sql = \"SELECT * FROM news\";\n $stmt = $pdo->prepare($sql);\n $stmt->execute();\n $results = $stmt->fetchAll(PDO::FETCH_ASSOC);\n \n $counter=0;\n $defLoad=5;\n foreach($results as $row) {\n if($counter < $defLoad){\n echo'<dt class=\"news-date\">'.$row[\"create_date\"].'</dt>';\n echo '<dd class=\"news-description\"><a href=\"news.php?news_id=' . $row[\"news_id\"] . '\">' .mb_substr($row[\"news_title\"],0,10).\"...\". '</a>';\n echo \"<hr>\";\n }else{break;}\n $counter++;\n }\n $pdo = null;\n ?> \n </div>\n <p id=\"loading\" style=\"display:none;\">loading...</p>\n <input type=\"button\" id=\"more\" value=\"もっと読む\">\n </dl>\n \n <script>\n var loadData = JSON.parse(\"<?php echo json_encode($results); ?>\");\n var defLoad = <?php echo $defLoad; ?>;\n var loadPage = 0;\n $(function(){\n $(\"#more\").click(function(){\n loadPage++;\n for(var n=(defLoad*loadPage);n<(defLoad*(loadPage+1));n++){\n var rowData = loadData[n];\n $(\"#data\").append(\n $(\"<dt>\").addClass(\"news-date\").append(rowData[\"create_date\"])\n ).append(\n $(\"<dd>\").addClass(\"news-description\").append(\n $(\"<a>\").attr(\"href\",\"news.php?news_id=\"+rowData[\"news_id\"]).html(rowData[\"news_title\"].substr(0,10)+\"...\")\n )\n ).append($(\"<hr />\"));\n }\n });\n });\n </script>\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T01:25:58.917",
"id": "16456",
"last_activity_date": "2015-09-10T01:25:58.917",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7676",
"parent_id": "16429",
"post_type": "answer",
"score": 2
},
{
"body": "jqueryのload使った実装です。 \nload自体はajaxで取ってきた内容を要素内に追加するのではなく、既存の中身は削除して置き換えを行います。 \nですので、最後に空のdl要素を追加して(38)、そこ(`.clearfix:last`、これは表示されてる内容に対して)にdl要素の子要素(`.clearfix>*`、これはloadで取ってきた内容に対して)を展開するようにしています(46)。 \nなお`\"&time=\"+$.now()`のくだりはキャッシュ対策です。キャッシュが問題なければなくても構いません。 \nloadを使うにあたり、php側でページング機能は実装しておく必要があります(11-14)。javascript側との連系も必要です(29,39)。 \nその他、エラー処理関係(24,33-34,45)や、最終の処理(35-36)あたりもざっくり付けてありますが、適宜チューンしてください。 \nまた、最初の所(1-8)はテストデータの準備です。気にしないでください。\n\n未実装部分としては \n\\- データ出力の際は適切なエスケープ処理を行ってください。 \n\\- 途中で増減した場合はズレます。更新頻度が低いなら許容しても良いかと思います。\n\n```\n\n <?php\n $pdo = new PDO(\"sqlite::memory:\");\n $pdo->exec(\"CREATE TABLE news (news_id INTEGER PRIMARY KEY AUTOINCREMENT, news_title TEXT, create_date TEXT DEFAULT CURRENT_TIMESTAMP)\");\n $stmt = $pdo->prepare(\"INSERT INTO news (news_title) VALUES (?)\");\n foreach (range('A', 'Z') as $i) {\n $stmt->execute(array(\"The $i article!\"));\n }\n ?><head><script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js\"></script></head><body>\n <dl class=\"clearfix\">\n <?php\n $page = (int) $_GET[\"page\"];\n $sql = \"SELECT * FROM news LIMIT 5 OFFSET ?\";\n $stmt = $pdo->prepare($sql);\n $stmt->execute(array($page * 5));\n $results = $stmt->fetchAll(PDO::FETCH_ASSOC);\n foreach($results as $row) {\n echo'<dt class=\"news-date\">'.$row[\"create_date\"].'</dt>';\n echo '<dd class=\"news-description\"><a href=\"news.php?news_id=' . $row[\"news_id\"] . '\">' .mb_substr($row[\"news_title\"],0,10).\"...\". '</a>';\n echo \"<hr>\";\n } \n $pdo = null;\n ?> \n </dl>\n <p id=\"loading\" style=\"display:none;\">loading...</p>\n <p id=\"error\" style=\"display:none;\">!!! error !!!</p>\n <input type=\"button\" id=\"more\" value=\"もっと読む\">\n \n <script>\n page = <?php echo $page ?>;\n $(function(){\n function load_cb(response, status, xhr) {\n $(\"#loading\").hide();\n if (status == \"error\") {\n $(\"#error\").show();\n } else if ($(\".clearfix:last dt\").length < 5) {\n $(\"#more\").prop(\"disabled\", true);\n } else {\n $(\".clearfix:last\").after('<dl class=\"clearfix\">');\n page = page + 1;\n }\n }\n load_cb(null, null, null);\n $(\"#more\").click(function(){\n $(\"#loading\").show();\n $(\"#error\").hide();\n $(\".clearfix:last\").load(\"list.php?page=\"+page+\"&time=\"+$.now()+\" .clearfix>*\", load_cb);\n });\n });\n </script></body>\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T05:46:23.347",
"id": "16542",
"last_activity_date": "2015-09-12T05:46:23.347",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12301",
"parent_id": "16429",
"post_type": "answer",
"score": 2
}
] | 16429 | 16542 | 16456 |
{
"accepted_answer_id": "16441",
"answer_count": 1,
"body": "[AngularGoogleMaps](http://angular-ui.github.io/angular-google-\nmaps/)を使用して、出発地A,中継地B,目的地Cのルート表示を試みています。 \nしかし、以下の動作になり困っています。\n\n 1. Aを設定、Bを設定、Cを設定。実行→ルート表示される (これはOK)\n 2. Bを変更、A・Cはそのまま。実行→ルート表示されるが、1で表示したルートも表示されたままになる(NG。1のルート軌跡は消えてほしい)\n\nどなたか解決方法がわかる方、ご教示いただけますと幸いです。\n\n[plunkerにソース](http://plnkr.co/edit/GCXBPYIWp11jI9XC7q5Y?p=preview)を置いています。\n\nよろしくお願いいたします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T08:27:17.673",
"favorite_count": 0,
"id": "16432",
"last_activity_date": "2015-09-09T11:36:32.417",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12198",
"post_type": "question",
"score": 4,
"tags": [
"angularjs",
"google-maps"
],
"title": "AngularGoogleMaps 以前表示したルートが残ったままになる",
"view_count": 114
} | [
{
"body": "servGoogleMaps.calcRoute()を呼ぶたびにDirectionsRendererを生成していることが原因です。\n\n```\n\n var directionsDisplay = new google.maps.DirectionsRenderer();\n \n```\n\nの宣言をcalcRouteの外に出して、`new\ngoogle.maps.DirectionRenderer()`を一度だけ呼ぶようにすれば動きます。ついでに`new\ngoogle.maps.DirectionsService()`の呼び出しも外に出したほうが良いかと思います。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T11:17:11.513",
"id": "16441",
"last_activity_date": "2015-09-09T11:36:32.417",
"last_edit_date": "2015-09-09T11:36:32.417",
"last_editor_user_id": "8532",
"owner_user_id": "8532",
"parent_id": "16432",
"post_type": "answer",
"score": 2
}
] | 16432 | 16441 | 16441 |
{
"accepted_answer_id": "16450",
"answer_count": 3,
"body": "Ruby初心者です. \n元のCSVファイル \"test.CSV\" A, 100, test があるとします. \n2列目の値を10~0に変更し,計11個のCSVを新たに出力するために, \n以下のプログラムを作成しました.\n\n```\n\n require 'csv'\n \n # CSVを読み込んで二次元配列にする\n array = CSV.read('filepath\\test.csv')\n puts(array.to_s)\n \n # x=ループ処理回数\n x =10\n while x >= 0 \n \n array[0][1]= x\n \n #,ごとに分割して出力\n strAry = array.to_s.split(\",\")\n \n #保存するファイル名\n #配列1行目を取得\n y = array[0][0]\n file_name = y.to_s + \"+\" + x.to_s + '.csv'\n \n s = strAry.to_csv\n p s\n File.write(file_name, s)\n \n x = x - 1\n end\n \n```\n\n上記を実行すると,A+0.csv ~A+10.csvまでの計11個のファイルが作成されます. \n(出力ファイルに [[\" が含まれてしまうなど不完全ですが,ここまでは作成できました.)\n\nこれを応用して,元のCSVファイル(3行) \n\"test2.CSV\" A1, 100, test \nA2, 100, test \nA3, 100, test \nがある場合に,各行の2列目に数字を割り当てるファイルを作成したいと考えています, \n例えば,6を割り当てる場合, \nA1 A2 A3 \n6 0 0 \n5 1 0 \n5 0 1 \n4 2 0 \n4 0 2 \n4 1 1 \n・ \n・ \n1 0 5 \n0 1 5 \n0 0 6 (3H6= 28通り)\n\n計28個のCSVファイルを作成したいと考えています.\n\n例:1個目の出力ファイル \"A1_600.csv\" \n内容 \nA1, 6, test \nA2, 0, test \nA3, 0, test \n例:2個目の出力ファイル \"A1_510.csv\" \n内容 \nA1, 5, test \nA2, 1, test \nA3, 0, test\n\nこの場合のコードの書き方をご教示頂ければ幸いです.\n\n**追加情報** \n \n実際にはA1...A6まで用意し,最初の質問文以上の数(5)を割り当てようとしています. \n \nA1 A2 A3 A4 A5 A6 \n5 0 0 0 0 0 \n4 1 0 0 0 0 \n4 0 1 0 0 0 \n・ \n・ \n0 0 0 0 0 4 (6H5= 252通り)\n\n252通りなら,ゴリ押しでもいけるように思います. \n今回,私が実行していることは,\n\n\"test3.CSV\"\n\nA1, 0, test \nA2, 0, test \nA3, 0, test \nA4, 0, test \nA5, 0, test \nA6, 0, test \nB1, 0, test \nB2, 0, test \nB3, 0, test \nB4, 0, test \nB5, 0, test \nB6, 0, test \nC1, 0, test \nC2, 0, test \nC3, 0, test \nC4, 0, test \nD1, 0, test \n・ \n・ \nおそらく,合計44行程度\n\nを用意した場合に, \nA 6,0,0,0,0,0 (252通り) \nB 6,0,0,0,0,0 (252通り) \nC 6,0,0,0 (56通り) \nD …\n\n252×252×56… 通りのCSVファイルを作成しようとしています. \nそうなると,ゴリ押しではおそらく難しく, \n別の方法を検討する必要があるかもしれません.\n\n**追加情報2**\n\n元の管理ファイル\"test3.csv\" 例 \n\n\n変更したいのは緑色,太枠で囲った部分のみです. \n1,2列目のTEST,A はお伝えしやすくするために記載してありますが, \n値の変更は行いません. \n \nこの場合,出力CSVは \nタイトル \"A500000_B50000_C5000_D5000_E500_F500~.csv\" \nとなるのが理想です.\n\n\"A500000_B50000_C5000_D5000_E500_F500~.csv\" \n\"A410000_B50000_C5000_D5000_E500_F500~.csv\" \n・ \n・ \n・ \n\"A000005_B00005_C0005_D0005_E005_F005~.csv\"\n\nファイル数は,252*252*56*56*21*... 出来上がる.という感じです.\n\n元の管理ファイル\"test3.csv\"内のA,B,C,D~の行数は変更しないため, \n地道にループ処理をしていくという方法でも良いように考えます.",
"comment_count": 6,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T08:44:18.640",
"favorite_count": 0,
"id": "16434",
"last_activity_date": "2015-09-11T03:51:30.357",
"last_edit_date": "2015-09-10T12:58:49.120",
"last_editor_user_id": "12266",
"owner_user_id": "12266",
"post_type": "question",
"score": 3,
"tags": [
"ruby",
"アルゴリズム"
],
"title": "重複組み合わせ・CSVファイルへの記載方法",
"view_count": 955
} | [
{
"body": "とりあえず「ゴリ押し実装」で作ってみました。 \n組み合わせの作成は「ループで回しながら合致するものを抽出」というロジックになっています。 \nこの質問の個数ぐらいであれば問題にはならないですが、もっと個数が増えると非常に遅くなるかもしれません。(が、増える見込みがないのであれば、これでもいいのでは?と思います)\n\n以下、実装とテストコード(RSpec)です。\n\n```\n\n require 'csv'\n require 'spec_helper'\n \n class CombinationCsv\n def self.generate_csv(input_path, output_dir, assigned_number, col_size)\n input_arrays = CSV.read(input_path)\n generate_combination(assigned_number, col_size).each do |numbers|\n output_path = File.join(output_dir, \"A1_#{numbers.join}.csv\")\n CSV.open(output_path, 'w') do |csv|\n input_arrays.each_with_index do |input_cols, i|\n output_cols = input_cols.dup\n output_cols.each(&:strip!)\n output_cols[1] = numbers[i]\n csv << output_cols\n end\n end\n end\n end\n \n # ゴリ押し実装なので、もっとスマートなロジックがあるはず\n def self.generate_combination(assigned_number, col_size)\n max = \"#{assigned_number}#{'0' * (col_size - 1)}\".to_i\n (assigned_number..max).map { |number|\n target = number.to_s.chars.map(&:to_i).inject(:+) == assigned_number\n number.to_s.rjust(3, '0').chars.map(&:to_i) if target\n }.compact\n end\n end\n \n describe CombinationCsv do\n describe '::generate_csv' do\n let(:input_dir) { File.expand_path('../input', __FILE__) }\n let(:input_path) { File.join(input_dir, 'test2.csv') }\n let(:output_dir) { File.expand_path('../output', __FILE__) }\n \n def output_files\n Dir.glob(File.join(output_dir, '*.csv'))\n end\n \n before do\n FileUtils.rm(output_files)\n end\n example do\n expect {\n CombinationCsv.generate_csv(input_path, output_dir, 6, 3)\n }.to change { output_files.size }.from(0).to(28)\n \n output_path = File.join(output_dir, 'A1_600.csv')\n result = CSV.read(output_path)\n expect(result).to eq([\n %w(A1 6 test),\n %w(A2 0 test),\n %w(A3 0 test)\n ])\n \n output_path = File.join(output_dir, 'A1_510.csv')\n result = CSV.read(output_path)\n expect(result).to eq([\n %w(A1 5 test),\n %w(A2 1 test),\n %w(A3 0 test)\n ])\n end\n end\n \n describe '::generate_combination' do\n let(:expected) do\n [\n [6, 0, 0],\n [5, 1, 0],\n [5, 0, 1],\n [4, 2, 0],\n [4, 0, 2],\n [4, 1, 1],\n [3, 3, 0],\n [3, 0, 3],\n [3, 2, 1],\n [3, 1, 2],\n [2, 4, 0],\n [2, 0, 4],\n [2, 3, 1],\n [2, 1, 3],\n [2, 2, 2],\n [1, 5, 0],\n [1, 0, 5],\n [1, 4, 1],\n [1, 1, 4],\n [1, 3, 2],\n [1, 2, 3],\n [0, 6, 0],\n [0, 0, 6],\n [0, 5, 1],\n [0, 1, 5],\n [0, 4, 2],\n [0, 2, 4],\n [0, 3, 3]\n ]\n end\n example do\n result = CombinationCsv.generate_combination(6, 3)\n expect(result).to contain_exactly(*expected)\n end\n end\n end\n \n```\n\nGithubにもコードをアップしているので、手元で動かすことも可能です。\n\n<https://github.com/JunichiIto/combination-csv>\n\n以上、ご参考までに。\n\n### EDIT\n\n最初のバージョンだと10以上の数を割り当てたときにおかしくなるので、ロジックを修正しました。\n\n```\n\n require 'csv'\n require 'spec_helper'\n \n class CombinationCsv\n def self.generate_csv(input_path, output_dir, assigned_number, col_size)\n input_arrays = CSV.read(input_path)\n generate_combination(assigned_number, col_size).each do |numbers|\n output_path = File.join(output_dir, \"A1_#{numbers.join}.csv\")\n CSV.open(output_path, 'w') do |csv|\n input_arrays.each_with_index do |input_cols, i|\n output_cols = input_cols.dup\n output_cols.each(&:strip!)\n output_cols[1] = numbers[i]\n csv << output_cols\n end\n end\n end\n end\n \n def self.generate_combination(assigned_number, col_size)\n return [assigned_number] if col_size == 1\n assigned_number.downto(0).each_with_object([]) do |n, result|\n next_number = assigned_number - n\n child_results = generate_combination(next_number, col_size - 1)\n child_results.each do |numbers|\n result << [n, *numbers]\n end\n end\n end\n end\n \n describe CombinationCsv do\n describe '::generate_csv' do\n let(:input_dir) { File.expand_path('../input', __FILE__) }\n let(:input_path) { File.join(input_dir, 'test2.csv') }\n let(:output_dir) { File.expand_path('../output', __FILE__) }\n \n def output_files\n Dir.glob(File.join(output_dir, '*.csv'))\n end\n \n before do\n FileUtils.rm(output_files)\n end\n example do\n expect {\n CombinationCsv.generate_csv(input_path, output_dir, 6, 3)\n }.to change { output_files.size }.from(0).to(28)\n \n output_path = File.join(output_dir, 'A1_600.csv')\n result = CSV.read(output_path)\n expect(result).to eq([\n %w(A1 6 test),\n %w(A2 0 test),\n %w(A3 0 test)\n ])\n \n output_path = File.join(output_dir, 'A1_510.csv')\n result = CSV.read(output_path)\n expect(result).to eq([\n %w(A1 5 test),\n %w(A2 1 test),\n %w(A3 0 test)\n ])\n end\n end\n \n describe '::generate_combination' do\n let(:expected) do\n [\n [6, 0, 0],\n [5, 1, 0],\n [5, 0, 1],\n [4, 2, 0],\n [4, 0, 2],\n [4, 1, 1],\n [3, 3, 0],\n [3, 0, 3],\n [3, 2, 1],\n [3, 1, 2],\n [2, 4, 0],\n [2, 0, 4],\n [2, 3, 1],\n [2, 1, 3],\n [2, 2, 2],\n [1, 5, 0],\n [1, 0, 5],\n [1, 4, 1],\n [1, 1, 4],\n [1, 3, 2],\n [1, 2, 3],\n [0, 6, 0],\n [0, 0, 6],\n [0, 5, 1],\n [0, 1, 5],\n [0, 4, 2],\n [0, 2, 4],\n [0, 3, 3]\n ]\n end\n example do\n result = CombinationCsv.generate_combination(6, 3)\n expect(result).to contain_exactly(*expected)\n end\n \n context 'assigned_number is 10' do\n let(:expected) do\n [\n [10, 0],\n [9, 1],\n [8, 2],\n [7, 3],\n [6, 4],\n [5, 5],\n [4, 6],\n [3, 7],\n [2, 8],\n [1, 9],\n [0, 10]\n ]\n end\n example do\n result = CombinationCsv.generate_combination(10 ,2)\n expect(result).to contain_exactly(*expected)\n end\n end\n end\n end\n \n```\n\nコードはこちらにも置いています。\n\n<https://github.com/JunichiIto/combination-csv/tree/not-loop>\n\n### EDIT2\n\nA, B, Cといったグループごとに組み合わせを作り、さらにそれを掛け合わせてそれぞれ別ファイルとして出力する場合のサンプルコードを作ってみました。 \nテストコードで使っているtest3-1.csvはA1,A2,B1,B2,C1の5行で、割り当てる数字は2です。 \n3x3x1で9通りのファイルが生成されます。\n\n```\n\n require 'csv'\n require 'spec_helper'\n \n class CombinationCsv\n def self.generate_csv(input_path, output_dir, assigned_number)\n input_arrays = CSV.read(input_path)\n all_combinations = generate_all_combinations(input_arrays, assigned_number)\n all_combinations.each do |combination|\n file_name = combination.map { |k, v| \"#{k}#{v.join}\" }.join('_') + '.csv'\n output_path = File.join(output_dir, file_name)\n CSV.open(output_path, 'w') do |csv|\n numbers = combination.values.flatten\n write_csv_rows(csv, input_arrays, numbers)\n end\n end\n end\n \n def self.generate_all_combinations(input_arrays, assigned_number)\n count_by_group = generate_count_by_group(input_arrays)\n combination_hash = generate_combination_by_group(count_by_group, assigned_number)\n all_arrays = combination_hash.values\n first = all_arrays.shift\n all_combinations = first.product(*all_arrays)\n names = combination_hash.keys\n all_combinations.map {|combinations| names.zip(combinations).to_h }\n end\n \n def self.generate_combination_by_group(count_by_group, assigned_number)\n count_by_group.map {|name, count|\n [name, generate_combination(assigned_number, count)]\n }.to_h\n end\n \n def self.generate_count_by_group(input_arrays)\n name_and_numbers = input_arrays.map{|cols|\n /(?<name>[A-Z]+)(?<number>\\d+)/ =~ cols.first\n [name, number.to_i]\n }\n groups_by_name = name_and_numbers.each_with_object(Hash.new { |h,k| h[k] = [] }) do |(name, number), hash|\n hash[name] << number\n end\n groups_by_name.map{|name, values| [name, values.max]}.to_h\n end\n \n def self.write_csv_rows(csv, input_arrays, numbers)\n input_arrays.each_with_index do |input_cols, i|\n csv << input_cols.dup.tap do |output_cols|\n output_cols.each(&:strip!)\n output_cols[1] = numbers[i]\n end\n end\n end\n \n def self.generate_combination(assigned_number, col_size)\n return [[assigned_number]] if col_size == 1\n assigned_number.downto(0).flat_map do |n|\n child_results = generate_combination(assigned_number - n, col_size - 1)\n child_results.map { |numbers| [n, *numbers] }\n end\n end\n end\n \n describe CombinationCsv do\n describe '::generate_csv' do\n let(:input_dir) { File.expand_path('../input', __FILE__) }\n let(:input_path) { File.join(input_dir, 'test3-1.csv') }\n let(:output_dir) { File.expand_path('../output', __FILE__) }\n \n def output_files\n Dir.glob(File.join(output_dir, '*.csv'))\n end\n \n before do\n FileUtils.rm(output_files)\n end\n example do\n expect {\n CombinationCsv.generate_csv(input_path, output_dir, 2)\n }.to change { output_files.size }.from(0).to(9)\n \n output_path = File.join(output_dir, 'A20_B20_C2.csv')\n result = CSV.read(output_path)\n expect(result).to eq([\n %w(A1 2 test),\n %w(A2 0 test),\n %w(B1 2 test),\n %w(B2 0 test),\n %w(C1 2 test),\n ])\n \n output_path = File.join(output_dir, 'A02_B02_C2.csv')\n result = CSV.read(output_path)\n expect(result).to eq([\n %w(A1 0 test),\n %w(A2 2 test),\n %w(B1 0 test),\n %w(B2 2 test),\n %w(C1 2 test),\n ])\n end\n end\n \n # 以下省略\n end\n \n```\n\nソースコードはこちらにあります。\n\n<https://github.com/JunichiIto/combination-csv/blob/multiple-\noutput/spec/combination_csv_spec.rb>\n\n実際にやろうとしているのはこれよりももっと大きな組み合わせのようですが、252*252*56*56*21を計算するだけでも4,182,119,424(400億以上!)のファイルが作成されることになります。 \nこれだけのファイルを一気に作成しようとすると、普通のPCでは処理能力の限界を超えてしまいそうです。(怖いので試していません)\n\nなので、そもそものアプローチを変える必要があるんじゃ無いかと思います。",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T14:29:02.637",
"id": "16450",
"last_activity_date": "2015-09-10T23:51:29.387",
"last_edit_date": "2015-09-10T23:51:29.387",
"last_editor_user_id": "85",
"owner_user_id": "85",
"parent_id": "16434",
"post_type": "answer",
"score": 2
},
{
"body": "こんな感じでどうでしょうか。ちょっとややこしい箇所はコメントを付けてますので参考にしてください。 \n全体的に「Array祭り」みたいな作りになってますので、見慣れないメソッドは適宜お調べになってみてください。\n\n```\n\n require 'csv'\n \n class CombinationCsvGenerator\n def initialize(src_path, total)\n @src = CSV.read(src_path).each { |columns| columns.each(&:strip!) }\n @total = total\n @rows = @src.size\n end\n \n def generate(dest_path)\n combination.each do |numbers|\n filepath = File.join(dest_path, \"A1_#{numbers.join}.csv\")\n # 元ネタ(@src)と組み合わせ数字(numbers)を組み合わせて、2列目だけをすり替える\n body = @src.zip(numbers).map {|columns| columns.flatten.values_at(0, -1, 2..-2) }\n output filepath, body\n end\n end\n \n private\n \n def combination\n # 重複順列を作成し、合計値が指定した値になるもののみselectする\n (0..@total).to_a\n .repeated_permutation(@rows)\n .select { |values| values.reduce(:+) == @total }\n end\n \n def output(path, body)\n CSV.open(path, 'w') do |csv|\n body.each { |columns| csv << columns }\n end\n end\n end\n \n \n if __FILE__ == $0\n generator = CombinationCsvGenerator.new('test2.csv', 6)\n generator.generate('output/')\n end\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T05:01:35.130",
"id": "16460",
"last_activity_date": "2015-09-10T05:01:35.130",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9608",
"parent_id": "16434",
"post_type": "answer",
"score": 1
},
{
"body": "ruby は不案内なのでアルゴリズムの説明だけします。\n\nA1, A2, A3 に 6を割り当てる場合を例に説明します。これは A1, A2, A3 という三つの箱に\n6つのボールを、個々のボールは区別せずに割り振る問題と同じです。これを解くために、ボールを一列に並べ、さらに三つに分けるために仕切りを二つ、S1 と S2\nを用意します。仕切りをボールの間に置き三つに分けたら、一番左の組を A1 に、真ん中を A2 に、一番右を A3 に入れます。例えば ボールを O\nで表すと、\n\n```\n\n O S1 O O S2 O O O\n \n```\n\nの場合はA1 = 1, A2 = 2, A3 = 3 で、\n\n```\n\n O O S1 S2 0 0 0 0\n \n```\n\nの場合は A1 = 2, A2 = 0, A3 = 4 になります。\n\n仕切りの置ける場所は、一番左、個々のボールの間、一番右の、合計 7ヶ所です。この\n7ヶ所に置く、仕切りの置き方をすべて数え上げれば、三つの箱へのボールの割り振り方がすべて求められることになります。ただし、仕切りを単に入れ替えただけの場合は重複してしまうので、S2\nは S1 の左には来ないという制約が必要になります。\n\n具体的には、まず仕切りを二つとも左端に置き、S2 を一つずつ右に動かしていきます。\n\n```\n\n A1 A2 A3\n 0 0 6 S1 S2 O O O O O O\n 0 1 5 S1 O S2 O O O O O\n 0 2 4 S1 O O S2 O O O O\n ...\n 0 6 0 S1 O O O O O O S2\n \n```\n\nこれで仕切り S1 が一番左、つまり A1 が 0 の場合がすべて求まりました。\n\n次に S1 を一つ右に動かします。S2 は 、S1 の左には来れないので S1 と同じ場所に置き、前と同じように一つずつ右に動かしていきます。\n\n```\n\n A1 A2 A3\n 1 0 5 O S1 S2 O O O O O\n 1 1 4 O S1 O S2 O O O O\n ...\n 1 5 0 O S1 O O O O O S2\n \n```\n\nこれで A1 が 1 の場合がすべて求まりました。\n\nこのように S1 を一つ右に動かしては S2 を動かし、ということを繰り返し、最後に\n\n```\n\n A1 A2 A3\n 6 0 0 O O O O O O S1 S2\n \n```\n\nとなったところで終わりです。\n\n以上を擬似コードで表すと、\n\n```\n\n for S1 = 0 to 6 do\n for S2 = S1 to 6 do\n A1 = S1\n A2 = S2 - S1\n A3 = 6 - S2\n end for\n end for\n \n```\n\nA1...A6 に 5 を割り当てる場合は\n\n```\n\n for S1 = 0 to 5 do\n for S2 = S1 to 5 do\n for S3 = S2 to 5 do\n for S4 = S3 to 5 do\n for S5 = S4 to 5 do\n A1 = S1\n A2 = S2 - S1\n A3 = S3 - S2\n A4 = S4 - S3\n A5 = S5 - S4\n A6 = 5 - S5\n end for\n end for\n end for\n end for\n end for\n \n```\n\nです。\n\nこの方法なら、きっちり必要な回数だけの繰り返しになるので、速く求められると思います。 \n任意の個数の A に、任意の数を割り当てられるようにするのも、少し面倒ですができます。\n\nただ Junichi Ito さんもおっしゃっているように、252*252*56*56*21 はほぼ 4G です。test ファイルが 1 block\nしか使わなくても、1block 1k バイトとしても、4Tバイトのディスク容量が必要になります。また 1秒間に1000 ファイル処理したとしても、4G\n個だと 50日近く掛かる計算になります。\n\nファイルを経由せずに、パラメータを生成しては、シミュレーションのモジュールに直接渡せるなら、そっちの方がいいような気がします。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T03:51:30.357",
"id": "16506",
"last_activity_date": "2015-09-11T03:51:30.357",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3605",
"parent_id": "16434",
"post_type": "answer",
"score": 1
}
] | 16434 | 16450 | 16450 |
{
"accepted_answer_id": "16438",
"answer_count": 2,
"body": "apiで取得した情報にオリジナルな情報を追加することはできますか?\n\n例えば、 \nhotpepperグルメのapiを取得してその情報に口コミ等を追加する。\n\napiの情報をデータベースに保存(キャッシュ)して、そこに新しく情報を追加すればいいのかな?と思ったんですけど、そうするとapiの情報が更新されなくなってしまうので。(規約違反でもある)\n\nどういう方法がありますか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T08:56:11.490",
"favorite_count": 0,
"id": "16435",
"last_activity_date": "2018-01-11T07:22:05.707",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "11113",
"post_type": "question",
"score": 3,
"tags": [
"api"
],
"title": "apiで取得した情報にオリジナルな情報を追加することはできますか?",
"view_count": 237
} | [
{
"body": "hotpepperのAPI仕様で回答させていただきます。 \n下記がhotpepperAPIのリクエストサンプルで、指定した地点データ周囲1000mの店舗データを取得しています。 \n(引用:<http://api.hotpepper.jp/regulation.html>)\n\n```\n\n http://api.hotpepper.jp/GourmetSearch/V110/?key=guest&Latitude=35.660818&Longitude=139.775426&Range=3\n \n```\n\n上記APIのレスポンスは下記となります。\n\n```\n\n ...\n <ShopIdFront>J999999999</ShopIdFront>\n <ShopName>xxxxxx</ShopName>\n <ShopNameKana>xxxxxx</ShopNameKana>\n <ShopAddress>東京都中央xxxxxx</ShopAddress>\n <StationName>xxxxx</StationName>\n <KtaiCoupon>1</KtaiCoupon>\n <LargeServiceAreaCD>xxxxx</LargeServiceAreaCD>\n <LargeServiceAreaName>関東</LargeServiceAreaName>\n ...\n \n```\n\nこのレスポンスの中で、店舗に割り当てられている **一意なキーがShopIdFront** となります。 \n口コミ等の情報を独自DBで管理する際に、上記キーも口コミ情報等と併せて管理します。\n\nデータの保存はNGということなので、独自管理している口コミデータ等へのアクセスの際に下記APIのように指定店舗のデータを取得して組み合わせればいいかと思います。\n\n```\n\n http://api.hotpepper.jp/GourmetSearch/V110/?key=guest&ShopIdFront=J999999999\n \n```\n\n口コミDB(例)\n\n```\n\n |id|口コミ内容|ShopIdFront|\n |xx|xxxxxxxxx|J999999999 |\n ...\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T09:27:03.260",
"id": "16438",
"last_activity_date": "2015-09-09T09:27:03.260",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12256",
"parent_id": "16435",
"post_type": "answer",
"score": 4
},
{
"body": "すみません。 \napiの登録がありませんか。例えば:私のサイトからhotpepperAPIに新情報を申し込みができませんか。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2018-01-11T07:22:05.707",
"id": "40880",
"last_activity_date": "2018-01-11T07:22:05.707",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "26948",
"parent_id": "16435",
"post_type": "answer",
"score": -4
}
] | 16435 | 16438 | 16438 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "laravelのbladeにて出力するときに常に htmlspecialchars を通したいです。 \nbladeを拡張、または上書きするような形になると思うのですが、どう実装すればよいか教えていただけますでしょうか? \nlaravel4.2を使用しております。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T09:02:47.310",
"favorite_count": 0,
"id": "16436",
"last_activity_date": "2016-10-14T05:25:57.490",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7641",
"post_type": "question",
"score": 1,
"tags": [
"laravel"
],
"title": "laravel4.2のbladeで常にhtmlspecialcharsを通して{{ & }} で & が出力されるようにしたい",
"view_count": 578
} | [
{
"body": "データをエスケープして出したいだけでしたら、{{{ }}}でエスケープされて表示されます。\n\n<http://readouble.com/laravel/4/2/0/ja/templates.html#other-blade-control-\nstructures>",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T10:38:38.583",
"id": "16638",
"last_activity_date": "2015-09-15T10:38:38.583",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10904",
"parent_id": "16436",
"post_type": "answer",
"score": 1
}
] | 16436 | null | 16638 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "```\n\n <a href=\"\" onclick=\"return csvDownload();\"\n onmouseout=\"chgImg('/misc/csv.gif','csv');\"\n onmouseover=\"chgImg('/misc/csv_on.gif','csv');\">\n <img src=\"/misc/csv.gif\" width=\"106\" height=\"19\" alt=\"CSVダウンロード\" \n title=\"CSVダウンロード\" border=\"0\" name=\"csv\"></a> \n \n```\n\n上記のhtmlのコードがあり、マクロでそのボタンを押したいですが、 \nどうした方がいいでしょうか?",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T09:08:20.217",
"favorite_count": 0,
"id": "16437",
"last_activity_date": "2020-07-23T12:02:30.223",
"last_edit_date": "2015-09-10T04:49:49.963",
"last_editor_user_id": "7978",
"owner_user_id": "12268",
"post_type": "question",
"score": 1,
"tags": [
"vba"
],
"title": "VBAとIEの操作",
"view_count": 615
} | [
{
"body": "こことか、こことかですかね。(下記URL)\n\n再現できるサイトとか、ソースとかがあれば、動作確認できますが、 \nそうじゃないと、アドバイスしにくいです。\n\nVBAでIEのtagクリックサブルーチン化 | IE操作の自動化 \n<http://www.vba-ie.net/form/subroutine-tagclick.html>\n\n画像をクリックする - VBAによるIE自動制御 \n<http://vba-code.net/ie/click-an-image/>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2017-07-04T10:39:30.273",
"id": "36092",
"last_activity_date": "2017-07-04T10:39:30.273",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "21047",
"parent_id": "16437",
"post_type": "answer",
"score": 0
}
] | 16437 | null | 36092 |
{
"accepted_answer_id": "16480",
"answer_count": 1,
"body": "uiautomatorのテストを作成しましたが、コマンドラインより与えるパラメータの受け取り方がわかりません。\n\n```\n\n $ adb shell am instrument -w -e class com.example.etc -e loop 2 com.example.etc.test/android.support.test.runner.AndroidJUnitRunner\n \n```\n\n上記は、パラメータ名\"loop\"、値\"2\"としてテスト実行しているつもりです。\n\n```\n\n @RunWith(AndroidJUnit4.class)\n @SdkSuppress(minSdkVersion = 18)\n public class LoopTest {\n private int mLoopCnt;\n @Before\n public void before() {\n mLoopCnt = ???\n }\n }\n \n```\n\nこのパラメータをテストコード側で受け取るには、どのようなコードを書けばよいでしょうか。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T09:40:19.430",
"favorite_count": 0,
"id": "16439",
"last_activity_date": "2015-09-10T14:03:21.780",
"last_edit_date": "2015-09-09T12:01:17.653",
"last_editor_user_id": "33",
"owner_user_id": "7241",
"post_type": "question",
"score": 4,
"tags": [
"android",
"junit",
"uiautomator"
],
"title": "uiautomatorのテストを実行する際にパラメータを受け取りたい",
"view_count": 700
} | [
{
"body": "まず、`AndroidJUnitRunner`継承クラスを作成します。(`InstrumentationTestRunner`継承だとJUnit3になってしまうので)\n\n```\n\n public class MyTestRunner extends AndroidJUnitRunner{\n \n @Override\n public void onCreate(Bundle arguments) {\n super.onCreate(arguments);\n \n if (arguments != null) {\n String loop = arguments.getString(\"loop\", \"1\");\n System.setProperty(\"loop\", loop);\n }\n }\n }\n \n```\n\nコマンドラインから渡した引数は、`onCreate()`にて、`getString()`で受け取ることができます。\n\nテストランナーからテストクラスに値を引き渡す方法として、ここでは`System.setProperty()`を使っていますが、どのような方法でも構わないです。\n\n`build.gradle`の`defaultConfig`に次の記述を追加します。\n\n```\n\n defaultConfig {\n ...\n testApplicationId \"yourpackage.test\"\n testInstrumentationRunner \"yourpackage.MyTestRunner\"\n }\n \n```\n\nそして、`Run/Debug Configurations`から、`Android Tests`を追加します。`Specific\ninstrumentation runnner`に自作テストランナーを指定します。\n\n実行すると、`Empty test suite`と言われますが、\n\n```\n\n adb shell pm list instrumentation\n \n```\n\nで確認すると、\n\n```\n\n instrumentation:yourpackage.test/yourpackage.MyTestRunner (target=yourpackage)\n \n```\n\nがインストールされていると思います。あとはコマンドラインからテストを実行します。\n\n```\n\n @RunWith(AndroidJUnit4.class)\n public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {\n public MainActivityTest() {\n super(MainActivity.class);\n }\n \n @Test\n public void loopValueCheck() throws Exception {\n int loopValue = Integer.parseInt(System.getProperty(\"loop\"));\n assertThat(2, is(loopValue));\n }\n }\n \n```\n\n`System.getProperty()`で引数の値を受け渡して、テストに利用できます。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T14:03:21.780",
"id": "16480",
"last_activity_date": "2015-09-10T14:03:21.780",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5337",
"parent_id": "16439",
"post_type": "answer",
"score": 2
}
] | 16439 | 16480 | 16480 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "getのURLのパラメーターをスラッシュで渡すにはどのような設定をすれば宜しいでしょうか。 \nwww.example.com/?id=1 \n上記を下記のようにしたいと考えています。 \nwww.example.com/id/1 \n言語はphpでserverはnginxを使っています。\n\n詳しい方、ご教示頂けますと幸いです。 \n宜しくお願い致します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T11:02:23.633",
"favorite_count": 0,
"id": "16440",
"last_activity_date": "2015-09-09T11:58:49.260",
"last_edit_date": "2015-09-09T11:06:16.633",
"last_editor_user_id": null,
"owner_user_id": "8619",
"post_type": "question",
"score": 3,
"tags": [
"php",
"nginx"
],
"title": "HTTP GET のパラメーターをスラッシュで渡す方法",
"view_count": 1848
} | [
{
"body": "nginxにてrewriteの設定定義を行えば解決すると思います。\n\n例)\n\n```\n\n rewrite ^/(.*)/(.*)$ /?$1=$2 last;\n \n```\n\n(実際に動かしたわけではありません)\n\n<https://yhmwss.yhm.kyocera.co.jp/android/default.aspx>\n\nPHP側は以下で動作しているのであれば特に変更する必要はありません。 \nwww.example.com/?id=1",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T11:28:28.387",
"id": "16442",
"last_activity_date": "2015-09-09T11:58:49.260",
"last_edit_date": "2015-09-09T11:58:49.260",
"last_editor_user_id": "7241",
"owner_user_id": "7241",
"parent_id": "16440",
"post_type": "answer",
"score": 3
}
] | 16440 | null | 16442 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "表題の通りなのですが、Appleのofficeアプリケーションの「Numbers」を利用して \nCSVデータをインポートすると、電話番号データの先頭のゼロが削除されてしまいます。\n\n```\n\n 09012341234 → 9012341234\n \n```\n\nこれを回避するために、いろいろと調べてみたのですが \n英文での説明しか出てこなくて、なんとか和訳して読み取ってみると \n数字の先頭に`'`をつけると良いというような記述があったりしたので \n大量のデータの該当箇所に`'`を付けてみたのですが、 \n先頭のゼロは削除されることはなくなったものの \n今度は先頭に`'`が付いてしまいます(当たり前か)\n\nどうすればNumbersでcsvを開くときに、すべてのデータを文字列として読み込むことができるのでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T11:34:10.543",
"favorite_count": 0,
"id": "16443",
"last_activity_date": "2015-09-11T00:13:49.963",
"last_edit_date": "2015-09-11T00:13:49.963",
"last_editor_user_id": "8000",
"owner_user_id": "5840",
"post_type": "question",
"score": 1,
"tags": [
"macos"
],
"title": "Numbersでcsvをインポートすると電話番号の先頭のゼロが削除される",
"view_count": 703
} | [] | 16443 | null | null |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "OS Xで Google IMEを使い `¥`のキーで`\\`が入力されるように設定してるのですが、 \nRubyMineでは`¥`が入力されてしまいます。\n\nキーボードカスタマイズツールを使って対策をされている方の記事は見つかったのですが、RubyMineのバグだと思いIssuesに登録しました。 \n<https://youtrack.jetbrains.com/issue/IDEA-144798>\n\nですが英語環境では、恐らくキー配列の違いが原因だと思いますが、そもそもGoogleIMEの英数入力モードで円記号が入力されないようです。\n\n再現しないことにはバグ対策は取られないでしょうし、何か再現するための手段はないでしょうか? \n日本語で質問したほうが方法を知ってる人がいるかと思いここに質問させていただきました。\n\n## 追記\n\n「¥キーで入力する文字」に円記号を設定していてもアプリによってはバックスラッシュが入力される事がわかりました。私の環境では iTerm\nでは常にバックスラッシュが入力されます。\n\nGoogle IMEの英数モードを使っている時に iTerm で円記号を入力する方法を教えて下さい。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T16:17:18.920",
"favorite_count": 0,
"id": "16451",
"last_activity_date": "2015-09-10T07:54:09.847",
"last_edit_date": "2015-09-10T04:35:18.333",
"last_editor_user_id": "3271",
"owner_user_id": "3271",
"post_type": "question",
"score": 1,
"tags": [
"macos",
"rubymine"
],
"title": "英語環境のMacでGoogle IMEを使い ¥ を入力する方法",
"view_count": 273
} | [
{
"body": "optionキー併用で入力できませんか?",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T16:40:24.020",
"id": "16453",
"last_activity_date": "2015-09-09T16:40:24.020",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5203",
"parent_id": "16451",
"post_type": "answer",
"score": 1
},
{
"body": "> Google IMEの英数モードを使っている時に iTerm で円記号を入力する方法を教えて下さい。\n\nターミナルでも円記号を入力できません。Option+Yとキーを打つと、バックスラッシュが入力されます。おそらくiTermは、ターミナルのこの挙動に準拠しているのだと推測できます。 \nIMEは、Google IMEかどうかは関係ありません。システム環境設定で、入力ソースをU.S.にして入力しても、円記号はバックスラッシュになります。\n\n> iTermなど恐らく環境設定が英語になってるソフト上ではバックスラッシュが入力されてしまうようです。\n\nその判断は正しいのでしょうか?むしろ、ターミナルとiTermのみの挙動と、私は推測します。こういうことは、統計学的にとまではいいませんが、相当数のサンプルをピックアップしてから、結論を出さなくてはいけないと思います。 \n話の発端の「RubyMine」では、どうなんですか?",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T07:54:09.847",
"id": "16465",
"last_activity_date": "2015-09-10T07:54:09.847",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7362",
"parent_id": "16451",
"post_type": "answer",
"score": 0
}
] | 16451 | null | 16453 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "NavigationControllerで画面遷移(A→B)をしています。\n\nAの画面にはテーブルビューで複数行セルがあります。 \nBの画面にはコレクションビューで画像(写真)を並べています。 \n(BににはAで選択されたセルごとにB,B',B\",...とそれぞれ異なる画像を並べています)\n\n例えば、画面をA→B→A→B’と遷移するときに、メモリが画面遷移の度に増え続けてしまい減りません。 \nB→A→B’のときにBの画面のオブジェクトを解放するべきなのでしょうか。 \nそのようにすればメモリ使用量を減らすことができるでしょうか。\n\nまた、解放するときは画面が消えたとき \n\\- (void)viewDidDisappear:(BOOL)animated \nここで解放すれはよいのでしょうか。\n\nその際は、どのように解放すればよいのでしょうか。 \nメモリが増えてしまいパフォーマンスが遅くて困っています。\n\n初歩的な質問かもしれませんが、どなたかわかる方がいらっしゃいましたらよろしくお願いします。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-09T18:10:49.530",
"favorite_count": 0,
"id": "16454",
"last_activity_date": "2015-09-09T18:10:49.530",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8802",
"post_type": "question",
"score": 1,
"tags": [
"objective-c",
"xcode",
"iphone"
],
"title": "画面遷移の際のメモリの解放",
"view_count": 1242
} | [] | 16454 | null | null |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "現在、同じシステムが複数の別々のサイトとして稼働しています。\n\n仕組みは **apache+tomcat+postgres** のwebサービスです。\n\nこの複数のサイトを1つのサイトに統合することになった場合に \n複数のデータを同じDBにひとまとめにするとして、 \n問題の一つとして **ログテーブルのプライマリーキー(連番)が重複してしまう** ことが考えられます\n\nプライマリーキーが他のテーブルのカラムにも紐づいたりして、作業量としてかなり重く、 \nデータベース構成も複雑なためリスクの高い対応になってしまいます。\n\nそこで、既存のテーブル構成をあまり変えずに、データを統合するいい方法はないでしょうか。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T01:51:02.897",
"favorite_count": 0,
"id": "16457",
"last_activity_date": "2015-09-11T04:28:05.233",
"last_edit_date": "2015-09-10T04:24:40.353",
"last_editor_user_id": "10492",
"owner_user_id": "10838",
"post_type": "question",
"score": 3,
"tags": [
"apache",
"postgresql",
"tomcat",
"データベース設計",
"database"
],
"title": "システムの統合について",
"view_count": 180
} | [
{
"body": "「複数のサイトを1つのサイトに統合」がただ単に「一つのサーバで複数サイトを運営したい」という話であればDBの統合は不要です。今あるDBを単純に移行すればよいでしょう。\n\n逆に、DBの統合をするために「複数のサイトを1つのサイトに統合」するのであれば、システム全体の要件ありきの話なので、誰にも答えられない質問です。例としてあげられている「ログテーブル」にしても、それは一つにしなければならないのか複数のままで良いのかは要件次第です。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T04:28:05.233",
"id": "16507",
"last_activity_date": "2015-09-11T04:28:05.233",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "16457",
"post_type": "answer",
"score": 1
}
] | 16457 | null | 16507 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "Xcode6.4、Swiftでiosアプリ開発中です。\n\nSwift製のライブラリ[「PageMenu」](https://github.com/uacaps/PageMenu)を使用しているのですが、 \nPageMenuを使用しているFirstView → PegeMenuを使用していないNextView \nへの遷移ができません。\n\nFirstViewにUIButtonを設置しており、タップアクション時に \n`self.navigationController?.pushViewController(NextView(), animated: true)` \nで、遷移させたいのですがボタンをタップしても何も起こりません。\n\n```\n\n var modalView = UINavigationController(rootViewController: NextView())\n modalView.modalTransitionStyle = UIModalTransitionStyle.CoverVertical\n self.presentViewController(modalView, animated: true, completion: nil)\n \n```\n\nとした時は、モーダルで遷移できます。が、モーダルの場合はNextViewで \n`self.dismissViewControllerAnimated(true, completion: nil)` \nでモーダルを閉じた際に、FirstViewに設置してあるPegeMenuのタブバーがNavigationBarの後ろに隠れてしまいます。(正常時はNavigationBarの下にPageMenuのタブがあります)\n\n何か解決策はありますでしょうか。 \nよろしくお願いいたします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T03:07:53.157",
"favorite_count": 0,
"id": "16458",
"last_activity_date": "2015-09-11T06:25:07.187",
"last_edit_date": "2015-09-10T04:48:56.577",
"last_editor_user_id": "3516",
"owner_user_id": "10996",
"post_type": "question",
"score": 2,
"tags": [
"ios",
"swift",
"xcode",
"xcode6",
"ios8"
],
"title": "SwiftライブラリPageMenu使用時、self.navigationController?.pushViewControllerによる画面遷移ができない",
"view_count": 919
} | [
{
"body": "モーダル遷移の際は\n\n```\n\n var modalView = UINavigationController(rootViewController: NextView()) \n modalView.modalTransitionStyle = UIModalTransitionStyle.CoverVertical \n self.view.window?.rootViewController!.presentViewController(modalView, animated: true, completion: nil)\n \n```\n\nとすることで、NextViewから戻ってきた際もレイアウト崩れをしなくなりました。\n\nNavigationContorollerを使った遷移の方は未解決です。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T06:25:07.187",
"id": "16511",
"last_activity_date": "2015-09-11T06:25:07.187",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10996",
"parent_id": "16458",
"post_type": "answer",
"score": 1
}
] | 16458 | null | 16511 |
{
"accepted_answer_id": "16478",
"answer_count": 1,
"body": "PEP8に違反している箇所、具体的には1行の文字数超過をしている部分に、 \n# noinspection PyPep8 \nをつけても警告が解除できないのはなぜでしょう?\n\nPreferencesのInspectionの方で解除することはなるべくやりたくありません。 \nPEP8違反に対して、その部分だけ警告解除する手段はないのでしょうか?",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T06:07:13.037",
"favorite_count": 0,
"id": "16462",
"last_activity_date": "2015-09-10T14:28:28.333",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12274",
"post_type": "question",
"score": 4,
"tags": [
"python"
],
"title": "PyCharmでPEP8違反をnoinspectionで抑止したい",
"view_count": 760
} | [
{
"body": "[ヘルプでの説明](https://www.jetbrains.com/pycharm/help/suppressing-\ninspections.html#1)に従ってみたけど、1行の文字数超過をしている場合では例の説明は働きませんでした。\n\nでも、以下のように` #\nnoqa`を行末に入力すれば、警告解除できるようです。Pep8の違反警告のために外部ツールを使って、`.py`ファイルの全体を確認しているので、pycharmの`#\nnoinspection`が働かないと思います。\n\n>\n> `long_line_long_line_long_line_long_line_long_line_long_line_long_line_long_line_long_line_long_line_long_line_long_line_long_line_\n> = 8 # noqa`\n\n[How to disable a pep8 error in a specific\nfile?](https://stackoverflow.com/questions/18444840/how-to-disable-a-\npep8-error-in-a-specific-file)というSO質問をご参照下さい。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T13:22:39.500",
"id": "16478",
"last_activity_date": "2015-09-10T14:28:28.333",
"last_edit_date": "2017-05-23T12:38:55.250",
"last_editor_user_id": "-1",
"owner_user_id": "11003",
"parent_id": "16462",
"post_type": "answer",
"score": 2
}
] | 16462 | 16478 | 16478 |
{
"accepted_answer_id": "16464",
"answer_count": 4,
"body": "環境 \nMac1(192.168.0.5) ----------Mac2(192.168.0.10)\n\nにおいて \nssh hoge@192.168.0.10\n\nした環境上でログインされたMac、シェルスクリプトを実行する予定です。\n\nサーバ側で\n\n```\n\n iperf -c 192.168.0.5 \n \n```\n\nは実行できましたが\n\n```\n\n iperf -c 192.168.0.5 >>hoge.txt\n \n```\n\nとしたところ、問題が発生しました。 \nただしくファイルを出力するにはどうすればよいでしょうか。\n\n実際の動作\n\n```\n\n error: nodename nor servname provided, or not known\n \n```\n\n期待した動作\n\n```\n\n hoge.txtが出力される\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T07:07:09.627",
"favorite_count": 0,
"id": "16463",
"last_activity_date": "2015-09-11T03:33:37.030",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7590",
"post_type": "question",
"score": 3,
"tags": [
"macos",
"bash"
],
"title": "sshでログインした環境でコマンドの実行結果をファイルに出力するには",
"view_count": 1090
} | [
{
"body": "本家SOにも似たような質問がありました。 \n<https://stackoverflow.com/questions/20252294/>\n\n恐らくSSHの実行時のポートの問題だったりしないのかなぁと思います。 \n`ssh -p 22 hoge@192.168.0.10`か、 \n`ssh -l hoge -p 22 192.168.0.10`ではどうでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T07:51:32.713",
"id": "16464",
"last_activity_date": "2015-09-10T07:51:32.713",
"last_edit_date": "2017-05-23T12:38:56.083",
"last_editor_user_id": "-1",
"owner_user_id": "7676",
"parent_id": "16463",
"post_type": "answer",
"score": 1
},
{
"body": "不思議な現象ですね。 \n特に根拠もなく、タダの感ですが、bash の構文を変えてみて動作が変わるか試して見て下さい。\n\n```\n\n iperf -c 192.168.0.5 >> hoge.txt\n \n (iperf -c 192.168.0.5) >> hoge.txt\n \n bash -c \"iperf -c 192.168.0.5\" >> hoge.txt\n \n echo \"iperf -c 192.168.0.5\" | bash >> hoge.txt\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T09:26:13.357",
"id": "16471",
"last_activity_date": "2015-09-10T09:26:13.357",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5008",
"parent_id": "16463",
"post_type": "answer",
"score": 1
},
{
"body": "「5」が file descriptor と解釈されたと考えて、\n\n```\n\n iperf -c '192.168.0.5' >>hoge.txt\n \n```\n\nでいかがでしょうか。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T10:18:50.070",
"id": "16473",
"last_activity_date": "2015-09-10T10:18:50.070",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5288",
"parent_id": "16463",
"post_type": "answer",
"score": 1
},
{
"body": "iperfを実行したタイミングでエラーになるということでいいですかね。だとするとsshで接続しているのは無関係です。\n\n提示されているエラーはホスト名の解決に失敗したときのものです。IPアドレスを指定しているように見えますが、実際には何かが違うのではないでしょうか。\n\n```\n\n コメントで指摘されているように空白が全角になっている。\n % iperf -c 192.168.1.1 >> ...\n ^^ ^^\n error: hostname nor servname provided, or not known\n \n IPアドレスとしてあり得ない値\n % iperf -c 192.168.1.999\n error: hostname nor servname provided, or not known\n \n ピリオドがカンマになっている\n % iperf -c 192.168.1,1\n error: hostname nor servname provided, or not known\n \n 全角ピリオドが混じっている\n % iperf -c 192.168.1.1\n error: hostname nor servname provided, or not known\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T03:33:37.030",
"id": "16504",
"last_activity_date": "2015-09-11T03:33:37.030",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "16463",
"post_type": "answer",
"score": 3
}
] | 16463 | 16464 | 16504 |
{
"accepted_answer_id": "20525",
"answer_count": 2,
"body": "UIWebViewの幅を変更した際に黒いボーダーが右側に現れます。 \nViewの幅に比例して大きくなるようです。 \nXcodeのDebug View Hierarchyで確認したところレイアウトの問題ではなさそうです。 \n(UIWebView>UIScrollView>UIWebBrowserViewという部分に隙間ができていました。)\n\n解決方法をご存知の方、教えて下さい。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T07:59:13.150",
"favorite_count": 0,
"id": "16466",
"last_activity_date": "2016-01-01T21:51:29.583",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12276",
"post_type": "question",
"score": 2,
"tags": [
"ios",
"swift",
"xcode",
"webview"
],
"title": "UIWebViewのサイズを変更した際に黒いボーダーが出現する。",
"view_count": 1396
} | [
{
"body": "UIWebViewに対して、以下のプロパティを設定してみてください。\n\n```\n\n webView.opaque = true\n webView.backgroundColor = UIColor.clearColor()\n \n```\n\n似たような質問が本家SOにもありましたので載せておきます。ご参考までに。\n\n * [Black line appearing at bottom of UIWebView. How to remove?](https://stackoverflow.com/questions/21420137/black-line-appearing-at-bottom-of-uiwebview-how-to-remove)\n * [Black area on UIWebView during load](https://stackoverflow.com/questions/23732594/black-area-on-uiwebview-during-load)",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T08:23:46.220",
"id": "16467",
"last_activity_date": "2015-09-10T08:23:46.220",
"last_edit_date": "2017-05-23T12:38:55.250",
"last_editor_user_id": "-1",
"owner_user_id": "12256",
"parent_id": "16466",
"post_type": "answer",
"score": 0
},
{
"body": "```\n\n webView.opaque = true\n \n```\n\nではなく\n\n```\n\n webView.opaque = false\n \n```\n\nでうまくいかないでしょうか? \n同様の現象が起こり、opaque = false, backgroundColor = UIColor.clearColor()\nの設定で黒い線の表示が消えました。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2016-01-01T21:51:29.583",
"id": "20525",
"last_activity_date": "2016-01-01T21:51:29.583",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "13858",
"parent_id": "16466",
"post_type": "answer",
"score": 0
}
] | 16466 | 20525 | 16467 |
{
"accepted_answer_id": "16469",
"answer_count": 1,
"body": "現在以下の実装になっており\n\n```\n\n document.getElementsByName(name)[0].selectedOptions[0].textContent;\n \n```\n\nchromeはこれで動作しますが、IEでは動作しません。IEではselectedOptionsが使えないみたいです。 \nIEで動作するソースがしりたいのですが、方法の分かる方がいましたら、ご教授お願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T09:03:47.940",
"favorite_count": 0,
"id": "16468",
"last_activity_date": "2015-09-22T10:13:36.827",
"last_edit_date": "2015-09-17T11:18:56.630",
"last_editor_user_id": "8000",
"owner_user_id": "7626",
"post_type": "question",
"score": 2,
"tags": [
"javascript",
"internet-explorer"
],
"title": "IEで動作する、プルダウンで選択されている値のテキストを取得する方法",
"view_count": 1023
} | [
{
"body": "以下で取得出来ます\n\n```\n\n var s = document.getElementById(id);\n var item1 = s.options[s.selectedIndex].**text**;\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T09:11:06.403",
"id": "16469",
"last_activity_date": "2015-09-22T10:13:36.827",
"last_edit_date": "2015-09-22T10:13:36.827",
"last_editor_user_id": "-1",
"owner_user_id": "7626",
"parent_id": "16468",
"post_type": "answer",
"score": 3
}
] | 16468 | 16469 | 16469 |
{
"accepted_answer_id": "16490",
"answer_count": 3,
"body": "`C++11`で`std::stoi`が追加されていますが、`std::stoui`がありません。これはなぜですか? \n`std::stoul`や`std::stoull`はあるのに…\n\nまた`unsigned int`に入れるためにはどうするのがベストでしょうか。",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T09:15:43.280",
"favorite_count": 0,
"id": "16470",
"last_activity_date": "2015-09-11T02:33:11.133",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7214",
"post_type": "question",
"score": 4,
"tags": [
"c++",
"c++11"
],
"title": "C++11にstd::stouiがないのはなぜ?",
"view_count": 3946
} | [
{
"body": "長文につき回答欄を使いますが回答にあらず\n\n「なぜ」に答えられるのは [c++](/questions/tagged/c%2b%2b \"'c++' のタグが付いた質問を表示\") 規格委員会\nJTC1/SC22 の委員ぐらいのもので、 \nオイラたち一般ユーザとしては推して知るべしに留まるわけです。 \nRationale (根拠) が公開議事録に残っていればいいのですが探すのは困難です。\n\nここは日本語 SO なので本家の記事をちょっと意訳すると \n<https://stackoverflow.com/questions/8715213/> \n<https://stackoverflow.com/questions/7895583/>\n\n[c](/questions/tagged/c \"'c' のタグが付いた質問を表示\") 規格書 ISO/IEC 9899:1999 の 7.20\nが定めている [strto系] [ato系] 標準関数は \n`atof` (名前に反して `double` に変換する) \n`atoi` `atol` `atoll` \n`strtod` `strtof` `strtold` `strtol` `strtoll` `strtoul` `strtoull` \nだけであり [c++](/questions/tagged/c%2b%2b \"'c++' のタグが付いた質問を表示\")\nもそれに倣ったのではないか、と推測されています。\n\nオイラの注釈:要するに [c](/questions/tagged/c \"'c' のタグが付いた質問を表示\") に strtoui (unsigned\nint) や strtos (short) は欠けている \n同様に [c++](/questions/tagged/c%2b%2b \"'c++' のタグが付いた質問を表示\") も stoui や stos\nが欠けている\n\nこの辺から、なんとなく \n\\- [c](/questions/tagged/c \"'c' のタグが付いた質問を表示\") で要らないと判断された型への変換は\n[c++](/questions/tagged/c%2b%2b \"'c++' のタグが付いた質問を表示\") でも要らないと判断したとか \n(疑問が「なぜ [c](/questions/tagged/c \"'c' のタグが付いた質問を表示\") で要らないと判断したか」に移るだけですが) \n\\- [c++](/questions/tagged/c%2b%2b \"'c++' のタグが付いた質問を表示\") で書かれたソースコードを\n[c](/questions/tagged/c \"'c' のタグが付いた質問を表示\") に移植する際に [c](/questions/tagged/c\n\"'c' のタグが付いた質問を表示\") 側に適切な変換関数が無いものは移植困難になるから、わざと搭載しなかったとか \n\\- [c](/questions/tagged/c \"'c' のタグが付いた質問を表示\") の標準関数の変換関数の挙動と厳密に同じ変換関数が欲しかったから\n[c](/questions/tagged/c \"'c' のタグが付いた質問を表示\") に無い変換は無いべきと判断したとか\n\nまあ何の役にも立たないただの妄想ですけど\n\nで、ではどうやって `unsigned int` `short` に値を格納すると良いか、ですが \n\\- 昔からある `std::istringstream` でもよさそうですし \n\\- [boost](/questions/tagged/boost \"'boost' のタグが付いた質問を表示\") を使ってよいなら\n`boost::lexical_cast` でもよさそうですし \n\\- `std` の中の実装まで追っかけて自前で類似の `stoui` `stos` を実装してもよさそうですし \n(処理系を超える互換性はなくなりますが) \n\\- 既にある `stoul` を使い `unsigned long` の値を得た後 `numeric_limits<unsigned int>`\nで上下限を切る wrapper を実装してもよさそうですし\n\nっていうか [c++](/questions/tagged/c%2b%2b \"'c++' のタグが付いた質問を表示\") 的には\n`template<typename T> T fromstring(...)` なんてほうが自然っぽいし、 \nそういう選択をしなかった根拠は提示されてもよさそうな気がします。",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T00:46:19.883",
"id": "16490",
"last_activity_date": "2015-09-11T01:28:22.600",
"last_edit_date": "2017-05-23T12:38:56.083",
"last_editor_user_id": "-1",
"owner_user_id": "8589",
"parent_id": "16470",
"post_type": "answer",
"score": 6
},
{
"body": "一応`std::istringstream`での実装を回答しておきます。 \nエラーチェックが必要ならば`std::istringstream::fail()`や`std::istringstream::eof()`を使います。\n\n参考URL: \n<http://d.hatena.ne.jp/xanthus/20071011/p1>\n\n```\n\n unsigned int StringToUInt(const std::string& input)\n {\n std::istringstream iss(input);\n unsigned int output = 0;\n iss >> output;\n return output;\n }\n \n```\n\nテンプレート版も一応… \nただ、`std::stoi`等を無視することになるため、悩ましいところです。\n\n```\n\n template<typename T> T StringToNumericalValue(const std::string& input)\n {\n std::istringstream iss(input);\n T output = 0;\n iss >> output;\n return output;\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T02:31:42.563",
"id": "16501",
"last_activity_date": "2015-09-11T02:31:42.563",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7214",
"parent_id": "16470",
"post_type": "answer",
"score": 1
},
{
"body": "C++11で追加された`stoXX`変換関数群では、初期提案 [N1803 Simple Numeric Access](http://www.open-\nstd.org/jtc1/sc22/wg21/docs/papers/2005/n1803.html)\n時点から`stoui`は存在しなかったようです。残念ながら一連の提案文書にRationale記載もなく、「なぜ?」に答えることができません。\n\n本当に`stoui`が必要なら、下記コードでエミュレーションできます。([libstdc++](https://github.com/gcc-\nmirror/gcc/blob/gcc-5-branch/libstdc++-v3/include/ext/string_conversions.h#L50-L78)実装を参考にしました)\n\n```\n\n #include <string>\n #include <limits>\n #include <exception>\n #include <cstdlib>\n #include <cerrno>\n \n unsigned int stoui(const std::string& str, std::size_t* pos = 0, int base = 10)\n {\n const char *s = str.c_str();\n char *endptr;\n errno = 0;\n unsigned long val = std::strtoul(s, &endptr, base);\n if (endptr == s)\n throw std::invalid_argument(\"stoui\");\n if (errno == ERANGE || std::numeric_limits<unsigned int>::max() < val)\n throw std::out_of_range(\"stoui\");\n if (pos)\n *pos = endptr - s;\n return static_cast<unsigned int>(val);\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T02:33:11.133",
"id": "16502",
"last_activity_date": "2015-09-11T02:33:11.133",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "49",
"parent_id": "16470",
"post_type": "answer",
"score": 1
}
] | 16470 | 16490 | 16490 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "I created HTML5 animation by Google Swiffy. \nAnd tryed displaying on Browser with Samsung GalaxyS3(Android4.0) and other\nGalaxy series, but it was not displayed. \nThere was no problem in the other devices. (iPhone, other Android4.0)\n\nThis problem has occurred from Google Swiffy version7.3. \nDo people have to worry about the same phenomenon? \nGalaxy series not support HTML5 created by new Google Swiffy?",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T09:29:50.817",
"favorite_count": 0,
"id": "16472",
"last_activity_date": "2015-09-11T00:15:45.750",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12277",
"post_type": "question",
"score": 0,
"tags": [
"html5"
],
"title": "Cannot display HTML5 created by Google Swiffy on Samsung Galaxy series",
"view_count": 88
} | [
{
"body": "ごめんなさい。 \nGoogle Swiffy を使ってアニメーション(SWF)をHTML5に変換します。 \nGoogle Swiffyのバージョンは7.3です。 \nGalaxyS3とGalaxyNoteではブラウザの上で表示したが、黒のままでした。 \niPhoneとGalaxy seriesを除いたAndroidでは表示しました。 \n7.3より前では全て問題ありませんでした。 \n同じ症状に悩む方はいらっしゃいませんか?",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T00:15:45.750",
"id": "16488",
"last_activity_date": "2015-09-11T00:15:45.750",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12282",
"parent_id": "16472",
"post_type": "answer",
"score": -1
}
] | 16472 | null | 16488 |
{
"accepted_answer_id": "16500",
"answer_count": 2,
"body": "WEBアプリケーションを前提としています。\n\n通常、HTMLへの埋め込み、CSSでの埋め込みで画像を表示しますが、 \nクライアントが(※完全な画像を)ダウンロードできない画像を表示するWEBサービスを発見しました。 \n解像度の落ちた画像はDL可能なようです。\n\n携帯用写真アップローダーのようですが、先日発見したアップローダーが下記になります。 \n<http://vpic.to/150810H6O6>\n\n右上に、再配布NGとなっており、NGの場合は写真をクリックできないようになっているようです。 \n再配布可の場合は写真をクリックすると、完全な解像度の画像を表示するようになっています。\n\n解像度を落とした画像と、通常のアップロードされた画像の2種類を作成すれば可能かと思われますが、このサイトの場合、正規画像のURLを見つけてしまえば正規画像はDL可能なのでしょうか?\n\nまた、アップロードされた正規画像を参照(ブラウザで表示)することはできても、DLすることはできない(PC・モバイル問わず)ということは技術的に可能なのでしょうか?",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T11:05:17.227",
"favorite_count": 0,
"id": "16474",
"last_activity_date": "2015-09-11T02:24:37.163",
"last_edit_date": "2015-09-11T01:30:38.380",
"last_editor_user_id": "8396",
"owner_user_id": "8396",
"post_type": "question",
"score": 13,
"tags": [
"画像"
],
"title": "画像の無断ダウンロードを禁止する仕組みは可能なのでしょうか?",
"view_count": 4958
} | [
{
"body": "ダウンロードしないと表示もできないので、ダウンロードを技術的に防ぐ事は(一般的なブラウザを対象とする限り)出来ません。 \n画像の保存を面倒にする方法はいろいろあると思います。\n\n例として出されたURLですと、まず再配布NGの物には画像ファイルへのリンクが設定されてません(これは、まあ普通の事です)。 \n多少こっているのは、画像が表示されている位置に以下の二つの DOM が生成されている事です。\n\n```\n\n <img class=\"protect\" src=\"http://image.vpic.to/mail/data/150810/150810H6O6/01.gif\" border=\"0\">\n <img style=\"top: 115px; left: 80px; position: absolute; z-index: 10;\" name=\"blank\" src=\"/img/blank.gif\" height=\"175\" width=\"160\">\n \n```\n\n最初の`img`要素が本物の画像であり、次の`img`要素は`blank.gif`という名からも明らかですが、ダミーです。 \nダミー要素の生成には`JavaScript`を使っているようですね。 \nブラウザには、これらが重ねて表示されます。ユーザが操作しようとすると、手前(Z軸で上)に設定されているダミーへの操作になるので、通常の手順では画像の保存が出来ないという仕組みです。\n\nどちらにせよ、一手間かければ保存できますので、ちょっとした嫌がらせといった所です。\n\n(もちろん、表示している物とは別に高解像度の画像があるのなら、それはダウンロードを制限できます。だだ、表示もダウンロードもさせないのですから、サーバに置いておく必要もないことになります)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T02:15:46.593",
"id": "16499",
"last_activity_date": "2015-09-11T02:24:37.163",
"last_edit_date": "2015-09-11T02:24:37.163",
"last_editor_user_id": "3054",
"owner_user_id": "3054",
"parent_id": "16474",
"post_type": "answer",
"score": 15
},
{
"body": "先に言いますと、Webアプリケーションで完全に無断ダウンロードを禁止することは不可能です。\n\n画像を表示するために画像の情報を絶対にダウンロードしなくてはならないためです。 \nただ、そのダウンロードを減らす意味合いでなら色々と方法があります。\n\n1.画像の表示方法を考察する \n画像をバイナリで取得してcanvasなどでレンダリングするとかですかね \ncanvasでレンダリングする事で単純に画像をダウンロードする事を防ぐ事が出来ます。 \n\\----- \nバイナリからでも、データを取得出来れば出力できます。 \n通信を傍受されたりすれば解析されます。 \n2.画像にオブジェクトをオーバーレイする \n要素をクリックなど要素にアクセスしづらくさせることで \n右クリックなども防げます。 \n\\----- \n邪魔な要素を削除していけば画像にたどり着けるのであまり意味は無いです。 \n3.マウスイベントを無効にする \nマウスイベントを無効に出来れば、右クリックからのメニューなどを防げます。 \n\\----- \nJavascriptなどスクリプトの実行を制限することで無効化可能です。 \nただし\"1\"と組み合わせればスクリプトを実行しなければ画像を表示できない状態に持っていけます。 \nこれも絶対ではないですが、結局Webコンソールで解析されるとダメですね。\n\nこんな感じでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T02:22:58.570",
"id": "16500",
"last_activity_date": "2015-09-11T02:22:58.570",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7676",
"parent_id": "16474",
"post_type": "answer",
"score": 11
}
] | 16474 | 16500 | 16499 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "ゲームオブジェクトをスクリプト上で生成する方法はありますか? \n具体的には元にあったgameobjectをdestroyしたあと、別のgameobjectをその場に \n生成するといったものですが\n\nInstantiate(gameobject)で実行してみましたが、gameobject(clone)となるだけで \ngameobjectは画面上にはないので、生成はできてないようです。\n\n上記を実行する方法はありますか? unity2d c#です",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T14:23:22.147",
"favorite_count": 0,
"id": "16481",
"last_activity_date": "2015-12-10T05:04:41.553",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9268",
"post_type": "question",
"score": 1,
"tags": [
"c#",
"unity3d"
],
"title": "gameobjectを生成する",
"view_count": 146
} | [
{
"body": "UnityとC#始めて2カ月目の者ですが、僕の理解の範囲で回答します。\n\nGameObjectとは「魂」のようなののだと思います。魂には肉体がないので、GameObjectを作っても画面上には見えません。 \n肉体に対応するMeshやMesh\nRendererのようなものをGameObjectに追加すれば見えるようになりますが、以下がとりあえず簡単な方法として実行できます。\n\n```\n\n GameObject myGO = GameObject.CreatePrimitive (PrimitiveType.Cube);\n \n```\n\n上記ではCubeの外装(+色々)を持つGameObjectを作成できます。\n\n<http://docs.unity3d.com/ScriptReference/GameObject.CreatePrimitive.html>\n\nなお、GameObjectには外装を持たずにスクリプトだけを付けて処理させることもできます。デザインにおいてはEmptyGameObjectを作って、それにスクリプトを追加することに対応します。これは目に見えないお化け(天使、悪魔,\nwhatever)が裏で何かやってくれる、というのに対応します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T03:34:16.327",
"id": "16505",
"last_activity_date": "2015-09-11T03:39:55.957",
"last_edit_date": "2015-09-11T03:39:55.957",
"last_editor_user_id": "4840",
"owner_user_id": "4840",
"parent_id": "16481",
"post_type": "answer",
"score": 1
}
] | 16481 | null | 16505 |
{
"accepted_answer_id": "18804",
"answer_count": 1,
"body": "Maven の multi module project で eclipse プラグインによって eclipse へプロジェクトを import\nした際には、モジュール間の dependency は eclipse 上で project でのビルドパス追加という形で解決されます。 \nしかし、その形ですと、依存しているモジュールは、依存先モジュールの`src/test/*`フォルダまでビルド・コンパイル時に検索してしまい、これは `mvn\ncompile` や`mvn test` での挙動と異なってしまいます。\n\n他のモジュールを依存しているモジュールにおいて、依存先の `src/test/*` を検索しないようにすることはできないでしょうか。\n\n* * *\n\nこれで何が問題かというと、例えば次の挙動が挙げられます。\n\n * リソースをクラスパスから検索する系の処理が、該当モジュールにて記述されている場合などに、本来は検索して欲しくない、依存先モジュールの`src/test/resource` を検索してしまう。 eclipse 上でのデバッグが、それゆえに困難になったりする。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T17:32:42.240",
"favorite_count": 0,
"id": "16486",
"last_activity_date": "2015-11-14T05:49:48.273",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "754",
"post_type": "question",
"score": 1,
"tags": [
"eclipse",
"maven"
],
"title": "multi module project での eclipse:eclipse において、依存モジュールの src/test を釣ってしまう",
"view_count": 915
} | [
{
"body": "Eclipse ProjectとMaven\nModuleという別のものを1対1で対応付けようとすること自体に無理があるので、どこかで妥協する必要があると思います。\n\n以下、\n\nプロジェクトX <\\--[依存]-- プロジェクトY\n\nというような関係がある場合の妥協案について考えてみました。 \n(ハイブリッドで運用する方法もありますし、どれが最適かは適用しようとしているプロジェクトの状況にも依存するでしょう。)\n\n## 案A. Maven側に寄せる\n\n### 案A.1. Eclipseプロジェクト同士で依存関係を設定しない\n\n_Eclipseプロジェクトとして依存関係を設定しているためにそのような問題が発生しているのであって、逆に言えば依存関係を設定しなければ問題は発生しない。_\n\npom.xml インポート時に Advancedオプションの **Resolve Workspace projects \nチェックを外す**(日本語版だと「ワークスペース・プロジェクトから依存関係を解決」のようです)ことで実現できます。 \nプロジェクトXに対する依存関係はMavenの(ローカル)リポジトリで解決することになります。\n\n### 案A.2. テスト実行はMavenのみで行う\n\n_Eclipse設定はあくまでIDEで開発する上での利便性のためのものであり正確なものではない、と割り切って差異を許容する。_\n\nEclipseが認識できないgoalを持ったMavenプラグインを使用する場合など、どっちみち同じようにはいかないことは他にもあります。 \n今回の場合ですと、リソースに依存するこのクラスのテストはEclipse上では上手く行かないのでMavenで実行すること、と取り決めておくことになるでしょう。\n\n## 案B. Eclipse側に寄せる\n\n### 案B.1. 本体とテストとを別Moduleとする\n\n_Eclipse的には本体とテストが同じプロジェクトに同居していることに問題があるので、「プロジェクトXのテスト」Mavenモジュールを新たに作り、 \nプロジェクトX <\\--[依存]-- プロジェクトY \nプロジェクトX <\\--[依存]-- プロジェクトXテスト \nとし、EclipseプロジェクトとMavenモジュールを1対1で対応付ける。_\n\nMavenモジュールとしては一般的ではないですが、プライベートなプロジェクトであり、かつEclipse依存度が高いのであればEclipseの流儀に合わせるのが楽では無いかと思います。 \n(その場合Maven化する必要があるのか、ということにもなりますが…)\n\n### 案B.2. pom.xml設定とは異なる設定を別途Eclipseで設定する\n\n * _プロジェクトXでテストディレクトリのinclude設定を削除_\n * _pom.xmlには無いプロジェクトXテストプロジェクトをEclipseで作成しプロジェクトXのテストディレクトリをinclude_\n\n_のような設定をEclipse側で別途行う。_\n\nEclipse依存度は高いがMaven化もしたい場合には、B.1.よりはこちらのほうが良いかと思います。 \nただし、pom.xmlとEclipse設定が一部乖離するので管理は煩雑になるでしょう。\n\n## 案C. その他\n\n### 案C.1. プロファイルでリソースディレクトリを切り替える\n\n_プロジェクトXのテストリソースディレクトリをダミーディレクトリにすげ替えるようなプロファイルをpom.xml上に作成しておき、プロジェクトYの開発時にはそのプロファイルを用いる。_\n\npom.xmlにはEclipse用の設定が入り込むし、Eclipse上での開発時にもひと手間必要になるという点で両方に妥協してもらう案です。 \nプロファイル名をそれと分かるようにしておけば混乱もないでしょうし、m2e1.5.0以降であれば(でなければ \n[Maven Profiles Management](https://marketplace.eclipse.org/content/maven-\nprofiles-management)を導入すれば)Eclipse上でのプロファイルの切換も以前ほど煩雑では無くなったので、無理筋では無いと考えます。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-11-14T05:49:48.273",
"id": "18804",
"last_activity_date": "2015-11-14T05:49:48.273",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "2808",
"parent_id": "16486",
"post_type": "answer",
"score": 1
}
] | 16486 | 18804 | 18804 |
{
"accepted_answer_id": "16512",
"answer_count": 1,
"body": "```\n\n $ echo $PATH\n /usr/bin:/home/user1/bin\n $ sudo echo $PATH\n /usr/bin\n $ sudo -E echo $PATH\n /usr/bin:/home/user1/bin\n \n```\n\nこんなかんじだとします。 \nここで、test.shに以下のように書き込んで\n\n```\n\n echo $PATH\n \n```\n\n実行すると、sudoの-Eオプションが効いてないように振る舞います。\n\n```\n\n $ sudo -E /bin/sh ./test.sh\n /usr/bin\n \n```\n\nシェルスクリプト内にもsudo元ユーザの環境変数を引き継いでやりたいのですが、そういうことはできますか? \nシェルスクリプトは定期的に更新されるような類のものなので、できればそちらは弄らずにコマンドを工夫する形でどうにかしたいです。\n\n実行環境はubuntu 14.04.3 LTSの`/bin/sh`です。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-10T23:20:51.197",
"favorite_count": 0,
"id": "16487",
"last_activity_date": "2015-09-11T06:52:59.203",
"last_edit_date": "2015-09-10T23:31:39.630",
"last_editor_user_id": "10685",
"owner_user_id": "10685",
"post_type": "question",
"score": 2,
"tags": [
"linux",
"sh",
"shellscript"
],
"title": "シェルスクリプトをsudoしても環境変数を引き継ぎたい",
"view_count": 4075
} | [
{
"body": "/etc/sudoers ファイルで secure_path が設定されていると PATH は上書きされて引き継がれません。 \nexempt_group で secure_path を除外するグループを設定することができます。\n\n```\n\n (設定例)\n Defaults exempt_group=adm\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T06:52:59.203",
"id": "16512",
"last_activity_date": "2015-09-11T06:52:59.203",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4603",
"parent_id": "16487",
"post_type": "answer",
"score": 4
}
] | 16487 | 16512 | 16512 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "<https://nanapi.jp/123443> \n上記のサイトの構造はどうなっているのでしょうか。 \nIDを名前にしたファイルをIDの数だけ生成しているのでしょうか? \n例)上記であれば123443.phpといった風に \nそれとも、別の方法で上記のようなURLを実現しているのでしょうか。 \n詳しい方、ご教示下さい。よろしくお願いいたします。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T00:47:04.567",
"favorite_count": 0,
"id": "16491",
"last_activity_date": "2015-09-11T01:07:16.347",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8619",
"post_type": "question",
"score": 2,
"tags": [
"php",
"html"
],
"title": "サイトの構造について",
"view_count": 162
} | [
{
"body": "[HTTP GET のパラメーターをスラッシュで渡す方法](https://ja.stackoverflow.com/questions/16440/) \nみたいに URL の一部を変換することで `?` を使う URL パラメータに変換してるんでしょう。 \nパラメータ変数の値からデータベースにアクセスすればよくなるので、ファイルにする必要はなくなります。\n\nnanapi.jp が本当にそういう実装であるかは知りません。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T01:07:16.347",
"id": "16492",
"last_activity_date": "2015-09-11T01:07:16.347",
"last_edit_date": "2017-04-13T12:52:39.113",
"last_editor_user_id": "-1",
"owner_user_id": "8589",
"parent_id": "16491",
"post_type": "answer",
"score": 2
}
] | 16491 | null | 16492 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "```\n\n temp = [\n {\n :hoge => 1,\n :huga => []\n },\n {\n :hoge => 2,\n :huga => []\n },\n ]\n \n```\n\nこの配列の「`hoge`が`1`のオブジェクトを参照する」方法はありますか?\n\nイメージとしては以下のような操作を行いたいです。\n\n```\n\n temp[{:hoge == 2}][:huga] << 123\n \n```\n\n↓\n\n```\n\n [\n {\n :hoge => 1,\n :huga => []\n },\n {\n :hoge => 2,\n :huga => [123]\n },\n ]\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T01:48:46.313",
"favorite_count": 0,
"id": "16493",
"last_activity_date": "2015-09-11T02:05:46.353",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10439",
"post_type": "question",
"score": 5,
"tags": [
"ruby"
],
"title": "配列の中にあるオブジェクトの参照の仕方",
"view_count": 92
} | [
{
"body": "`Enumerable#find` を使って次のようにできます:\n\n```\n\n temp.find{|h| h[:hoge] == 1}[:huga] << 123\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T02:05:46.353",
"id": "16496",
"last_activity_date": "2015-09-11T02:05:46.353",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3249",
"parent_id": "16493",
"post_type": "answer",
"score": 3
}
] | 16493 | null | 16496 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "websocketを使ってmousemoveのタイミングで位置を送信、位置が送られて来たら画像の座標に反映させる処理を書いています。\n\n最初は重くないのですが、しばらく使っているとだんだん重くなってきます。(というか、飛び飛びになる)\n\n原因になってそうなことはありますでしょうか。ご教授願います。\n\n環境等\n\n * websocket 0.2.1\n * Node.js 0.10.25\n * nodeサーバーで動かしています\n\nマウス位置の送信(bodyタグに対してmousemoveのイベントの都度呼び出すようにしています)\n\n```\n\n var data = {\n type: 'mouse_point',\n mousePoint: {x: e.clientX, y: e.clientY}\n };\n ws.send(JSON.stringify(data));\n \n```\n\nマウスの位置情報が送信されたときにのみ反映されます\n\n```\n\n cursorTag.style.left = data.mousePoint.x + \"px\";\n cursorTag.style.top = data.mousePoint.y + \"px\";\n \n```\n\n現状報告 ---- 11/17 追記 \n回答等ありがとうございます。この問題発生後にコードのリファクタリングを行った際に \nいつの間にか現象が発生しなくなっておりました・・・。マウス位置の送信、受信部分の記載しているコードには \n問題なかったようなので、別の問題が影響していたと考えられます。 \n折角助言等頂いたにもかかわらず、このような結果になってしまい大変申し訳ございません。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T01:51:41.983",
"favorite_count": 0,
"id": "16494",
"last_activity_date": "2016-08-08T10:19:47.530",
"last_edit_date": "2015-11-17T00:21:47.907",
"last_editor_user_id": "9336",
"owner_user_id": "9336",
"post_type": "question",
"score": 2,
"tags": [
"websocket"
],
"title": "マウス位置の同期でだんだん処理が重くなる",
"view_count": 420
} | [
{
"body": "mousemoveイベントハンドラを何らかのイベント発生のたびに追加してしまい、たくさんリクエストを送ってしまっている可能性はありませんか?\n\nマウスの位置情報を受信するたびに出力する等すれば、1イベントで複数回送信しているかどうかを確認できるものと思います。 \nChromeを使っている場合はconsole.log(\"文字列\")でコンソールに出力できます。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T02:35:38.943",
"id": "16503",
"last_activity_date": "2015-09-11T02:35:38.943",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12233",
"parent_id": "16494",
"post_type": "answer",
"score": 2
}
] | 16494 | null | 16503 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "```\n\n import UIKit\n \n class ViewController: UITableViewController {\n \n var entries = NSMutableArray()\n \n let newsUrlStrings = [\n \"http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://www3.nhk.or.jp/rss/news/cat0.xml&num=8\",\n \"http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://www3.nhk.or.jp/rss/news/cat6.xml&num=8\",\n \"http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://www3.nhk.or.jp/rss/news/cat7.xml&num=8\"\n ]\n \n let imageNames = [\n \"japan.jpg\",\n \"world.jpg\",\n \"sport.jpg\",\n ]\n \n @IBAction func refresh(sender: AnyObject) {\n entries.removeAllObjects()\n \n \n for newsUrlString in newsUrlStrings{\n \n var url = NSURL(string: newsUrlString)!\n var task = NSURLSession.sharedSession().dataTaskWithURL(url, completionHandler: { data, respinse, error in\n \n var dict = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as! NSDictionary\n \n if var responseData = dict[\"responseData\"] as? NSDictionary {\n if var feed = responseData[\"feed\"] as? NSDictionary {\n if var entries = feed[\"entries\"] as? NSArray {\n \n var formatter = NSDateFormatter()\n formatter.locale = NSLocale(localeIdentifier: \"en-US\")\n formatter.dateFormat = \"EEE, dd MMMM yyyy HH:mm:ss zzzz\"\n \n for var i = 0; i < entries.count; i++ {\n var entry = entries[i] as! NSMutableDictionary\n \n entry[\"url\"] = newsUrlString\n \n var dateStr = entry[\"publishedDate\"] as! String\n var date = formatter.dateFromString(dateStr)\n entry[\"date\"] = date\n }\n \n self.entries.addObjectsFromArray(entries as[AnyObject])\n \n self.entries.sortUsingComparator({ object1, object2 in\n \n var date1 = object1[\"date\"] as! NSDate\n var date2 = object2[\"date\"] as! NSDate\n \n var order = date1.compare(date2)\n \n if order == NSComparisonResult.OrderedAscending {\n return NSComparisonResult.OrderedAscending\n }\n else if order == NSComparisonResult.OrderedAscending{\n return NSComparisonResult.OrderedAscending\n }\n \n return order\n })\n }\n }\n }\n \n \n \n dispatch_async(dispatch_get_main_queue(),{\n \n self.tableView.reloadData()\n \n })\n })\n \n \n task.resume()\n }\n }\n \n override func viewDidLoad() {\n super.viewDidLoad()\n // Do any additional setup after loading the view, typically from a nib.\n }\n \n override func didReceiveMemoryWarning() {\n super.didReceiveMemoryWarning()\n // Dispose of any resources that can be recreated.\n }\n override func tableView(tableView: UITableView, numberOfRowsInSection\n section: Int) -> Int {\n return entries.count\n }\n \n override func tableView(tableView: UITableView, cellForRowAtIndexPath\n indexPath: NSIndexPath) -> UITableViewCell {\n \n var cell = tableView.dequeueReusableCellWithIdentifier(\"news\") as! UITableViewCell\n \n var entry = entries[indexPath.row] as! NSDictionary\n \n var titleLabel = cell.viewWithTag(1) as! UILabel\n titleLabel.text = entry[\"title\"] as? String\n \n var descriptionLabel = cell.viewWithTag(2) as! UILabel\n descriptionLabel.text = entry[\"contentSnippet\"] as? String\n \n var urlString = entry[\"url\"] as! String\n var index = find(newsUrlStrings, urlString)\n var imageName = imageNames[index!]\n var image = UIImage(named: imageName)\n \n var imageView = cell.viewWithTag(4) as! UIImageView\n imageView.image = image\n return cell\n }\n \n override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {\n performSegueWithIdentifier(\"detail\", sender: entries[indexPath.row])\n }\n \n override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?){\n if segue.identifier == \"detail\" {\n var detailController = segue.destinationViewController as! DetailController\n \n detailController.entry = sender as! NSDictionary\n }\n }\n }\n \n```\n\nこうなっています。 \nタイトルの通り、アプリを開いた瞬間にニュース記事を読み込みたいとき、どうすればいよいのでしょうか",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T01:55:03.130",
"favorite_count": 0,
"id": "16495",
"last_activity_date": "2015-09-12T01:16:24.350",
"last_edit_date": "2015-09-11T02:00:10.530",
"last_editor_user_id": "7362",
"owner_user_id": "12283",
"post_type": "question",
"score": 2,
"tags": [
"ios",
"swift"
],
"title": "更新ボタンを押すとニュースを読み込むアプリを作っているのですが、アプリを開いた瞬間にニュースを読み込むようにするにはどのようにすればいいのでしょうか",
"view_count": 463
} | [
{
"body": "以下のようにviewWillAppearメソッドを追加して実行してみてください。 \n`viewWillAppear`は画面が表示される直前に実行されるライフサイクルイベントになります。\n\n```\n\n override func viewWillAppear() {\n super.viewWillAppear()\n refresh() // 読込実行\n }\n \n```\n\nモバイルアプリの開発を進めていくうえで、必ずViewのライフサイクルの理解が必要になります。 \nライフサイクルは上記`viewWillAppear`以外にも様々あり、用途やタイミングによって使い分けることが必要になってきます。\n\n以下に素晴らしい記事へのリンクを載せておきます。ご覧になってみてください。\n\n[Viewのライフサイクル](http://qiita.com/yamagh/items/8a7cf2cabf4da3ea471a)",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T02:08:52.163",
"id": "16498",
"last_activity_date": "2015-09-11T02:08:52.163",
"last_edit_date": "2020-06-17T08:14:45.997",
"last_editor_user_id": "-1",
"owner_user_id": "12256",
"parent_id": "16495",
"post_type": "answer",
"score": 2
},
{
"body": "「アプリがバックグラウンドからフォアグラウンドに変わるときに読み込み処理を実行したい」という意図であると理解しました。\n\nその場合、「アプリがフォアグランドに移行した」ことをイベントで取得する必要があります。これは、2つの方法があります。ひとつはAppDelegateにある\napplicationWillResignActive:\nが実行されるのでそのタイミングで更新を掛ける方法。もう一つはNSNotificationCenter を使って通知を受け取る方法です。\n\n<http://crunchtimer.jp/blog/technology/ios/700/>\n\nその他のアプリのライフサイクルについては以下のURLを参考にしてください。 \n<http://d.hatena.ne.jp/glass-_-onion/20100630/1277909762>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T01:16:24.350",
"id": "16534",
"last_activity_date": "2015-09-12T01:16:24.350",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9558",
"parent_id": "16495",
"post_type": "answer",
"score": 3
}
] | 16495 | null | 16534 |
{
"accepted_answer_id": "16521",
"answer_count": 1,
"body": "サーバーサイドプログラムが生成した値をJavascriptに渡す際、直接scriptタグ内に変数を出力すべきか、<head>の<meta>タグのcontentとして持たせるべきか決めかねています。\n\n具体例として、CSRF対策用のトークンを使って非同期通信などでデータを取得する際、最初は次のようにしてデータをHTMLに直接出力していました。\n\n```\n\n <script>\n var config = {\n api_url: '<?php echo $apiUrl;?>',\n token: '<?php echo $csrfToken;?>',\n };\n </script>\n \n```\n\n複数のリンクされたJSファイルからこの情報を利用するため、グローバル変数を定義する必要がありました。(ブラウザ要件によりconstは使えません)\n\nしかし使用しているフレームワーク(Laravel)の[公式ドキュメント](http://laravel.com/docs/master/routing#csrf-\nx-csrf-token)によるとこのような変数を用いず、<meta>のcontentを使うよう説明がありました。\n\n```\n\n <meta name=\"csrf-token\" content=\"<?php echo $token;?>\">\n \n // jQueryでの使用例\n <script>\n $.ajaxSetup({\n headers: {\n 'X-CSRF-TOKEN': $('meta[name=\"csrf-token\"]').attr('content')\n }\n });\n </script>\n \n```\n\nたしかにこちらの方法のほうが書き換えられる心配が少ないのでグローバル変数を使うよりも綺麗にかけるので良いのですが、Javascript\nの定数を宣言するために積極的に meta タグを利用すべきなのでしょうか?\n\n似たものとして例を挙げると\nAPIサーバーのURL、認証用のアプリケーションIDやワンタイムパスワード、ログイン中のユーザーIDなどがあると思います。これらの値を複数のJSファイルで使いまわす可能性がある場合どのような形で定義すべきかのルールや傾向などありましたら教えて下さい。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T02:08:41.247",
"favorite_count": 0,
"id": "16497",
"last_activity_date": "2015-09-11T11:46:23.720",
"last_edit_date": "2015-09-11T09:08:30.097",
"last_editor_user_id": "8000",
"owner_user_id": "10083",
"post_type": "question",
"score": 19,
"tags": [
"javascript",
"security"
],
"title": "クライアント側のJavascriptにトークン等を渡したい時、どうやってHTMLに埋め込むべきか",
"view_count": 4861
} | [
{
"body": "うろ覚えですが「このデータはこれで送信しないとエラー扱いになる」というような \n厳密な規定の仕様は無かったような気がします…\n\nmetaタグや平文のjavascriptはそれぞれデータの持ち方に大きな違いが有ります。\n\n「javascriptの変数だから」という切り分け方よりも \nその受け渡したい「データがどういった属性や性質等を持つか」によって \n適合しやすい方法へ切り分けるべきかと思います。\n\n平文のjavascriptへの埋め込みはjavascriptでしか使わないデータや \n数式とかjavascriptの関数を埋め込むような使い方に向いています。\n\n認証IDやトークン等は文字長が比較的少なく \nクライアント側javascript以外にサーバー側アプリケーションや \nネットワーク間の機器(キャッシュサーバー等)も使用することが有ります。 \nこういった言語や機械の垣根を超えた使われ方をする少量データで \n外部に漏れても殆ど困らないものはmetaタグに向いています。\n\n漏れて困るセッションID等やサイト内のあちこちで横断的に使い回すデータならクッキーに。\n\n項目数やデータ量が多い構造的なデータだとxmlかjsonで。\n\n質問にある使い方で例文にある「URLとトークンIDの2つだけ」の埋め込みであれば \nmetaタグに埋め込む方が適切だと思います。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T11:46:23.720",
"id": "16521",
"last_activity_date": "2015-09-11T11:46:23.720",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9262",
"parent_id": "16497",
"post_type": "answer",
"score": 4
}
] | 16497 | 16521 | 16521 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "Cordova(Ver.5.2.0)からcordova-plugin-camera経由で取得した \nimage/jpegのEXIF情報を取得したいと思っております。\n\nググったところ、[「cordova-exif」](https://github.com/guilhermefarias/cordova-\nexif)を見つけ、JSをLoadした上で \n下記の実装をしております。\n\n```\n\n navigator.camera.getPicture(onSuccess, onFail, options);\n \n function onSuccess(imageURI){\n CordovaExif.readData(imageURI, function(exifObject) {\n alert(exifObject);\n });\n }\n \n```\n\nまた、iOS8での検証前に「config.xml」に下記設定を行っております。\n\n```\n\n <preference name=\"CameraUsesGeolocation\" value=\"true\" />\n \n```\n\n上記の状態でシミュレータおよび実機で動作確認したところ、alertダイアログが \n表示しません。もしかして、EXIF情報の有無が原因がと思い、EXIF情報がある \njpegファイルでも確認しましたが、それでもだめでした。\n\n何か新たな設定が必要なのでしょうか? \nもし解決方法がご存知でしたらご教授のほどお願いいたします。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T04:42:40.703",
"favorite_count": 0,
"id": "16508",
"last_activity_date": "2017-02-28T08:40:20.920",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9561",
"post_type": "question",
"score": 3,
"tags": [
"javascript",
"android",
"ios",
"cordova",
"exif"
],
"title": "CordovaからEXIF情報が取得できない。",
"view_count": 878
} | [
{
"body": "少し確認をさせて下さい。\n\n 1. ソースのインポートはしていますか?\n``` <script type=\"text/javascript\" src=\"cordova-exif.js\"></script>\n\n \n```\n\n 2. `Cordova Exif`が必要としているプラグインはインストールしていますでしょうか??\n``` cordova plugin add org.apache.cordova.camera\n\n cordova plugin add org.apache.cordova.file\n \n```\n\n 3. `onSuccess`メソッド自体が呼び出されていないなんてことはありませんか? \n(onFailなんてことは。。。)\n\n``` function onSuccess(imageURI){\n\n console.log(\"func onSuccess\"); // Log\n CordovaExif.readData(imageURI, function(exifObject) {\n alert(exifObject);\n });\n }\n navigator.camera.getPicture(onSuccess, onFail, options);\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T05:16:10.790",
"id": "16509",
"last_activity_date": "2015-09-11T05:16:10.790",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12256",
"parent_id": "16508",
"post_type": "answer",
"score": 1
},
{
"body": "コールバック関数の中で、JavaScript の alert() を使用すると、問題が生じる場合があるようです。 \n<https://docs.monaca.io/ja/reference/cordova_3.5/camera/>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2017-02-28T08:40:20.920",
"id": "32987",
"last_activity_date": "2017-02-28T08:40:20.920",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "20863",
"parent_id": "16508",
"post_type": "answer",
"score": 0
}
] | 16508 | null | 16509 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "下記のコーディングで画面遷移しているのですが、`window.Hide()`をしてから遷移しますので、 \n今のwindowが隠れる為に、なにもない状態となって、次に遷移先のwindowが開きます。 \nよってちらつきが発生してしまいます。 \nちらつきの回避と思って`window.Hide()`を画面遷移後(`Messenger.Raise()`の後)にすると \n制御が戻っていない為に、遷移元のwindowも残ってしまいます。 \n遷移元のwindowが残らずに画面遷移する方法を教えて下さい。\n\n```\n\n // 現在の View のインスタンスを取得\n var window = Application.Current.Windows.OfType<Window>().SingleOrDefault((w) => w.IsActive);\n try\n {\n // 現在の View を非表示\n window.Hide();\n // View にメッセージを送信~子画面をモーダルで起動\n Messenger.Raise(new TransitionMessage(new \n ViewModel2(),ShowCommand2\")); \n }\n finally\n {\n // View を再表示する\n window.ShowDialog();\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T07:00:50.097",
"favorite_count": 0,
"id": "16513",
"last_activity_date": "2016-01-15T08:37:50.800",
"last_edit_date": "2015-09-11T09:00:12.180",
"last_editor_user_id": "8000",
"owner_user_id": "5735",
"post_type": "question",
"score": 3,
"tags": [
"c#",
"wpf"
],
"title": "Livetでの画面遷移でちらつかない方法",
"view_count": 1377
} | [
{
"body": "本来は単一ウィンドウで画面遷移したいという事でしょうか。\n\nそれならば、 `ContentControl` を使うとDataContextにセットされたデータ型に応じて表示(View)を変えることが可能です。\n\n以下は、Window.DataContextに連動してContentControlのViewを変えるサンプルです。\n\nMainWindow.Xaml の Content部分\n\n```\n\n <Grid>\n <Grid.RowDefinitions>\n <RowDefinition Height=\"Auto\"/>\n <RowDefinition/>\n </Grid.RowDefinitions>\n <StackPanel Grid.Row=\"0\" Orientation=\"Horizontal\">\n <Button Content=\"ViewModel1\" Click=\"Button1_Click\"/>\n <Button Content=\"ViewModel2\" Click=\"Button2_Click\" Margin=\"10,0,0,0\"/>\n </StackPanel>\n \n <!-- Window.DataContextとContentControl.DataContextを同期 -->\n <ContentControl Grid.Row=\"1\" Content=\"{Binding}\">\n <ContentControl.Resources>\n <!-- 中身がViewModel1の時のView定義 -->\n <DataTemplate DataType=\"{x:Type vm:ViewModel1}\">\n <Label Content=\"ViewModel1\" Background=\"PaleGreen\"/>\n </DataTemplate>\n <!-- 中身がViewModel2の時のView定義 -->\n <DataTemplate DataType=\"{x:Type vm:ViewModel2}\">\n <Label Content=\"ViewModel2\" Background=\"PaleVioletRed\"/>\n </DataTemplate>\n </ContentControl.Resources>\n </ContentControl>\n </Grid>\n \n```\n\nMainWindow.Xaml.cs\n\n```\n\n public partial class MainWindow : Window\n {\n public MainWindow()\n {\n InitializeComponent();\n }\n \n private void Button1_Click(object sender, RoutedEventArgs e)\n {\n DataContext = new ViewModel1();\n }\n \n private void Button2_Click(object sender, RoutedEventArgs e)\n {\n DataContext = new ViewModel2();\n }\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-17T05:57:40.920",
"id": "16701",
"last_activity_date": "2015-09-17T05:57:40.920",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3022",
"parent_id": "16513",
"post_type": "answer",
"score": 1
}
] | 16513 | null | 16701 |
{
"accepted_answer_id": "16527",
"answer_count": 1,
"body": "多対多関係のOrderモデルとProductモデルを持っていて、\n\n一つのorderは複数のproductsと紐付いています。\n\norderを持っているproductsの中で一番値段の高いproductの価格を見て、orderをソートしたいです。\n\n自分が書いたコードはこんな感じです: \n`@orders =\nOrder.group(arel_table[:id]).order(Product.arel_table[:price].maximum)`\n\nこうやって昇順のソートはうまく行けましたが、以下のように降順でordersをソートをかけると \n`@orders =\nOrder.group(arel_table[:id]).order(Product.arel_table[:price].maximum.desc)`\n\nこんなエラーメッセージが返された : \n`undefined method ``desc' for #<Arel::Nodes::Max:0x007fb2ab9104a0>`\n\n降順にソートするにはどう書けばいいですか?\n\n<https://stackoverflow.com/questions/32517474/rails-4-error-when-trying-to-\nsort-by-using-arel-table-maximum-desc> \n↑英語のstackoverflowにも質問してます。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T08:00:46.360",
"favorite_count": 0,
"id": "16514",
"last_activity_date": "2015-09-11T23:06:40.430",
"last_edit_date": "2017-05-23T12:38:55.307",
"last_editor_user_id": "-1",
"owner_user_id": "12285",
"post_type": "question",
"score": 2,
"tags": [
"ruby-on-rails",
"mysql"
],
"title": "Rails 4 : arel_table.maximum.descでソートを行うときエラー発生",
"view_count": 737
} | [
{
"body": "SQLが2回発行されますが、こんな感じで実現できるのでは?\n\n```\n\n order_ids = Order.joins(:products).group('orders.id').order('maximum_products_price desc').maximum('products.price').keys\n sanitized_query = ActiveRecord::Base.send(:sanitize_sql_array, [\"field(id, ?)\", order_ids])\n Order.order(sanitized_query)\n \n```\n\n集計処理が絡むSELECTはActiveRecordとあまり相性が良くないのでクエリを分けたり、生SQLを書いたりして、コードのスマートさをあえて捨てた方が素早く実装できる気がします。\n\n参考: [Rails - MySQL+ActiveRecordで、与えられた配列順にorderしたい時 -\nQiita](http://qiita.com/chezou/items/8c0481044c954c4bca3b)\n\n### EDIT\n\nArelで完結させるのであれば、こんなふうに書けそうです。\n\n```\n\n @orders = Order\n .group(arel_table[:id]) # Order.arel_table[:id] の間違い?\n .order(Arel::Nodes::Descending.new(Product.arel_table[:price].maximum))\n \n```\n\n上のコードはArelのコードを参考にしています。\n\n[Module: Arel::OrderPredications — Documentation for rails/arel\n(master)](http://www.rubydoc.info/github/rails/arel/Arel/OrderPredications#desc-\ninstance_method)\n\n試してみてください。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T13:26:59.177",
"id": "16527",
"last_activity_date": "2015-09-11T23:06:40.430",
"last_edit_date": "2015-09-11T23:06:40.430",
"last_editor_user_id": "85",
"owner_user_id": "85",
"parent_id": "16514",
"post_type": "answer",
"score": 2
}
] | 16514 | 16527 | 16527 |
{
"accepted_answer_id": "16520",
"answer_count": 1,
"body": "PDO で binValue を使ってもバインドされないバグが起きています.\n\nbinValue の後に errorinfo を挟んだ結果 \"HY093\" とでました.debugDumpParams\nもしたのですが,バインドされていない文字列が結果として帰って来ました.\n\nbindValue している変数は実数なので,調べた結果 PARAM_STR にしたのですが,PARAM_INT で試してもダメでした.\n\n```\n\n $pdo = new PDO($dsn['host'], $dsn['user'], $dsn['pass'], $dsn['driver_options']);\n try {\n $pdo->exec('SET NAMES utf8');\n $sql = \"SELECT * FROM location WHERE MBRContains(GeomFromText('LineString(? ?, ? ?)'), latlng)\";\n $select_loc = $pdo->prepare($sql);\n $select_loc->bindValue(1, $ne_lng, PDO::PARAM_STR);\n $select_loc->bindValue(2, $ne_lat, PDO::PARAM_STR);\n $select_loc->bindValue(3, $sw_lng, PDO::PARAM_STR);\n $select_loc->bindValue(4, $sw_lat, PDO::PARAM_STR);\n $select_loc->execute();\n \n $loc = $select_loc->fetch();\n \n } catch(PDOException $e) {\n $error = $e->getMessage();\n }\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T10:00:22.650",
"favorite_count": 0,
"id": "16518",
"last_activity_date": "2015-09-11T10:52:25.673",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "11142",
"post_type": "question",
"score": 1,
"tags": [
"php",
"pdo"
],
"title": "PDO で binValue を使ってもバインドされない.",
"view_count": 428
} | [
{
"body": "`'LineString(? ?, ? ?)'`がただの文字列と扱われているのだと思います。\n\n```\n\n CONCAT('LineString(', ?, ' ', ?, ', ', ?, ' ', ?, ')')\n \n```\n\nのように結合するか、あるいはPHP側でパラメーターを埋め込めばいいのではないでしょうか。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T10:52:25.673",
"id": "16520",
"last_activity_date": "2015-09-11T10:52:25.673",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5750",
"parent_id": "16518",
"post_type": "answer",
"score": 2
}
] | 16518 | 16520 | 16520 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "Unity4.6を使用してiOS/Android向けアプリを開発しています。 \naudioSource.Play() でサウンドを鳴らし、 \nyield return new WaitForSeconds(1.0f); で鳴っている間待機させています。\n\n端末側のスピーカーの音量がゼロの時、またはiOSでミュートスイッチがオンになっている時は \n音を鳴らさず(待機せず)先に進ませたいのですが、 \nUnityのスクリプトからスピーカーにアクセスする方法はあるのでしょうか? \n(あくまで音量やスイッチの「値の取得」のみで、変更はしなくて構いません) \nまた、ネイティブプラグインなら対処できるのでしょうか?\n\n調べた結果マイクの音量取得はあったのですが、スピーカーの情報が見付からず質問させて頂きました。 \n何かご存知の方がいらっしゃいましたら、教えて頂けると幸いです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T12:01:01.403",
"favorite_count": 0,
"id": "16522",
"last_activity_date": "2016-10-11T09:42:22.827",
"last_edit_date": "2015-09-11T12:06:17.340",
"last_editor_user_id": "8940",
"owner_user_id": "8940",
"post_type": "question",
"score": 7,
"tags": [
"android",
"ios",
"unity3d"
],
"title": "Unityにて、スマートフォン端末のスピーカー音量とミュートスイッチの値を取得したい",
"view_count": 1240
} | [
{
"body": "Audioはやったことないので間違っているかもしれませんが、AudioListenerというのがあるようです。\n\n<https://stackoverflow.com/questions/30859693/how-do-i-mute-the-audio-in-\nunity-3d>\n\n> AudioListener.volume = 0;\n\n.volumeを0にできるので、もしかしたら、.volume==0の判別ができるかもしれません。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T12:14:55.007",
"id": "16523",
"last_activity_date": "2015-09-11T12:14:55.007",
"last_edit_date": "2017-05-23T12:38:56.467",
"last_editor_user_id": "-1",
"owner_user_id": "4840",
"parent_id": "16522",
"post_type": "answer",
"score": 1
}
] | 16522 | null | 16523 |
{
"accepted_answer_id": "16530",
"answer_count": 2,
"body": "以前の質問([n×n board\nにおけるナイト・ツアーの数えあげについて](https://ja.stackoverflow.com/questions/16301/n%C3%97n-board-%E3%81%AB%E3%81%8A%E3%81%91%E3%82%8B%E3%83%8A%E3%82%A4%E3%83%88-%E3%83%84%E3%82%A2%E3%83%BC%E3%81%AE%E6%95%B0%E3%81%88%E3%81%82%E3%81%92%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6)) \nでナイトツアーの数えあげを行いました。\n\nさて、一般に \nm×n board におけるナイト・ツアーの数えあげを高速に行うには \nどうすればよろしいでしょうか?\n\n以下のコードは、長方形の対称性を利用することで以前の計算の約1/4位になっています。\n\n```\n\n #include <stdio.h>\n \n int search(int x, int y, int w, int h, long long used, int depth){\n int cnt = 0;\n if (x < 0 || w <= x || y < 0 || h <= y || (used & (1LL << (x + y * w))) > 0) return 0;\n if (depth == w * h) return 1;\n used += 1LL << (x + y * w);\n cnt += search(x + 2, y - 1, w, h, used, depth + 1);\n cnt += search(x + 2, y + 1, w, h, used, depth + 1);\n cnt += search(x - 2, y - 1, w, h, used, depth + 1);\n cnt += search(x - 2, y + 1, w, h, used, depth + 1);\n cnt += search(x + 1, y - 2, w, h, used, depth + 1);\n cnt += search(x + 1, y + 2, w, h, used, depth + 1);\n cnt += search(x - 1, y - 2, w, h, used, depth + 1);\n cnt += search(x - 1, y + 2, w, h, used, depth + 1);\n used -= 1LL << (x + y * w);\n return cnt;\n }\n \n int directed_open_tours(int w, int h){\n int x;\n int y;\n long long used;\n int total = 0;\n for (y = 0; y < h / 2; y++){\n for (x = 0; x < w / 2; x++){\n used = 0LL;\n total += search(x, y, w, h, used, 1) * 4;\n }\n if (w % 2 == 1){\n x = w / 2;\n used = 0LL;\n total += search(x, y, w, h, used, 1) * 2;\n }\n }\n if (h % 2 == 1){\n y = h / 2;\n for (x = 0; x < w / 2; x++){\n used = 0LL;\n total += search(x, y, w, h, used, 1) * 2;\n }\n if (w % 2 == 1){\n x = w / 2;\n used = 0LL;\n total += search(x, y, w, h, used, 1) * 1;\n } \n }\n return total;\n }\n \n int main(void){\n int w;\n int h;\n printf(\"%d\\n\", directed_open_tours(4, 5));\n printf(\"%d\\n\", directed_open_tours(5, 4));\n printf(\"%d\\n\", directed_open_tours(4, 6));\n printf(\"%d\\n\", directed_open_tours(6, 4));\n printf(\"%d\\n\", directed_open_tours(4, 7));\n printf(\"%d\\n\", directed_open_tours(7, 4));\n return 0;\n }\n \n```\n\n実行結果 \n164 \n164 \n1488 \n1488 \n12756 \n12756",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T12:37:04.193",
"favorite_count": 0,
"id": "16525",
"last_activity_date": "2015-09-13T21:08:13.223",
"last_edit_date": "2017-04-13T12:52:39.113",
"last_editor_user_id": "-1",
"owner_user_id": "5363",
"post_type": "question",
"score": 4,
"tags": [
"c",
"アルゴリズム"
],
"title": "m×n board におけるナイト・ツアーの数えあげを高速に行うには?",
"view_count": 1577
} | [
{
"body": "## 盤面の対称性を利用する\n\n元質問での工夫にもある通り、縦横半分に4分割すると、それぞれ線対称・点対称の関係にありますので、各部分の解の数は同数になります。そのため、 1/4\nの部分の各マスを始点とした解の数の合計を求めて4倍すると全体の解が求まります。 \nただし、辺の長さが奇数の場合は工夫が必要です。中央の一列は、上記の 1/4 の部分の計算に含めず、後から改めて求めるとよいです。\n\n 1. 縦 / 2 × 横 / 2 (それぞれ切り捨て) の部分について、各マスを始点とした解の数を求め、それを4倍する。\n 2. 縦の数が奇数の場合、その中央の列について、横の半分 (切り捨て) までの各マスを始点とした解の数を求め、それを2倍する。\n 3. 横の数が奇数の場合も縦横を読み替えて同様にする。\n 4. 縦、横共に奇数の場合、これまでの手順で、中央の1マスが未計算になるので、中央のマスを始点とした解の数を求める。\n 5. 上記すべてを合計する。\n\n## 各マスから/各マスへ飛べる未訪問のマス数を用いて枝刈りを行う\n\n元のコードでは、各マスを既に訪問したか否かだけを管理していますが、マス毎に、そのマスに到達できる、あるいはそこから飛べる未訪問のマスの数 (*)\nを管理することで枝刈りを行えます。\n\n(*) 言い替えると、各マスをノードとし、ナイトが1回移動できるマス間を繋いだ双方向グラフの、ノードから延びる辺の数です。 \n例えば、5x5 の盤面の、まだどこにも訪問していない状態での数は以下のようになります。\n\n```\n\n +--+--+--+--+--+\n | 2| 3| 4| 3| 2|\n +--+--+--+--+--+\n | 3| 4| 6| 4| 2|\n +--+--+--+--+--+\n | 4| 6| 8| 6| 4|\n +--+--+--+--+--+\n | 3| 4| 6| 4| 2|\n +--+--+--+--+--+\n | 2| 3| 4| 3| 2|\n +--+--+--+--+--+\n \n```\n\n今回考えついた、カウントを元にした枝刈りの方法は以下の通りです。\n\nまず、解の探索のために、あるマスを訪問して、それによってそこから飛べるマスのカウントを減らします。 \nその時の状態によって、以下のように枝刈りを行います。\n\n### 飛び先候補のマスで、カウントが0になったマスがあったら、それが最後の未訪問マスでなければ、その探索は失敗。\n\n次の飛び先として、カウントが0のマスを選んだら、それ以上移動できなくなります。かといって、他のマスを優先すると、カウント0のマスに入ることができなくなります。 \nそのため、カウントが0となった場合、それが最後の未訪問マスでなければ失敗となります。\n\n### 盤面全体で、カウントが1のマスが3つ以上あったら、その探索は失敗。\n\nカウント1のマスとは、そこに飛び込んだら、もうそれ以上移動できなくなるマスのことです。 \nつまり、そこを最後の訪問先としなくてはなりません。 \nそれだけなら、3つ以上ではなく、2つ以上の時点で失敗ですが、現在の訪問先からカウント1のマスに飛んだ場合はまだ移動できるので詰みません。3つの場合は、現在の訪問先からそのうちひとつに飛べたとしても、残りふたつを同時に最後にすることはできないため詰みます。\n\n### カウントが1のマスが2つの場合、次の飛び先は必ずカウント1のマスのみとする。\n\nひとつ前の枝刈りでも説明した通り、カウント1のマスが2つ存在した時点で探索失敗となりますが、現在の訪問先からカウント1のマスに飛べばまだ目があります。逆に言うと、カウント1以外のマスに飛んでしまうと、ふたつのマスを同時に最後にする必要が出てきてしまうので解がなくなります。\n\n## コード\n\n以上の工夫を取り入れたプログラムを書いてみました。無闇に煩雑で長々としているのは私のセンスのなさゆえですが大目に見て下さい。 \nまた、1 x 1 の結果が 0 となるバグがあります。1 x 1だけ特別扱いすればよいだけではありますが……\n\n```\n\n #include <stdio.h>\n #include <stdlib.h>\n #include <stdbool.h>\n #include <assert.h>\n \n \n struct board {\n // 盤面の大きさ\n int num_rows, num_cols;\n \n //counts[行インデックス][列インデックス]:\n //そのマスから/マスへ移動可能なマスがいくつあるか。\n //解の探索で、利き筋のマスが訪問済になると減少する。\n //また、訪問済のマスは -1 とする。\n int **counts;\n \n // カウントが1のマスの数。これが3以上になると\n // そのすべてを訪問することはできないため解なしとなる。\n int num_ones;\n };\n \n \n // マスの位置を表す構造体。\n struct board_index {\n int row, col;\n };\n \n \n // ナイトの利き筋。\n const struct board_index g_knight_movement[] = {\n { 1, 2}, {-1, 2}, { 1, -2}, {-1, -2},\n { 2, 1}, {-2, 1}, { 2, -1}, {-2, -1},\n };\n // g_knight_movement の要素数。\n #define NUM_KNIGHT_MOVEMENTS ((sizeof(g_knight_movement) / sizeof(g_knight_movement[0])))\n \n \n // 指定されたインデックスが盤面の範囲に入っているか。\n inline static bool in_board(const struct board *restrict brd, struct board_index index)\n {\n return ((0 <= index.row) && (index.row < brd->num_rows))\n && ((0 <= index.col) && (index.col < brd->num_cols));\n }\n \n \n // 指定したマスの利き筋の数の初期値を求める。\n int initial_count_at(const struct board *restrict brd, int row, int col)\n {\n int count = 0;\n for(size_t i = 0; i < NUM_KNIGHT_MOVEMENTS; i++) {\n struct board_index next = { // (row, col) から一回動いた位置\n .row = g_knight_movement[i].row + row,\n .col = g_knight_movement[i].col + col,\n };\n count += in_board(brd, next);\n }\n return count;\n }\n \n \n // init_board_result() の戻り値。\n enum init_board_result {\n IB_SUCCESS, // 初期化成功\n IB_ERROR, // エラー発生\n IB_NO_SOLUTION, // 初期化時に解がないことが確定して初期化を中断した\n };\n \n \n // 盤面の情報を初期化する。\n enum init_board_result init_board(struct board *restrict brd, int num_rows, int num_cols)\n {\n enum init_board_result err_retval;\n brd->num_rows = num_rows;\n brd->num_cols = num_cols;\n brd->num_ones = 0;\n brd->counts = (int **)malloc(sizeof(brd->counts[0]) * num_rows);\n if(brd->counts == NULL) {\n err_retval = IB_ERROR;\n goto err_alloc_baseptr;\n }\n int row;\n for(row = 0; row < num_rows; row++) {\n brd->counts[row] = (int *)malloc(sizeof(brd->counts[0][0]) * num_cols);\n if(brd->counts[row] == NULL) {\n err_retval = IB_ERROR;\n goto err_alloc_row;\n }\n for(int col = 0; col < num_cols; col++) {\n brd->counts[row][col] = initial_count_at(brd, row, col);\n switch(brd->counts[row][col]) {\n case 1:\n brd->num_ones++;\n break;\n \n case 0:\n err_retval = IB_NO_SOLUTION;\n goto no_solution;\n \n default:\n break;\n }\n }\n }\n return IB_SUCCESS;\n \n // error or no solution\n no_solution:\n free(brd->counts[row]);\n err_alloc_row:\n while(row-- > 0) {\n free(brd->counts[row]);\n }\n free(brd->counts);\n err_alloc_baseptr:\n return err_retval;\n }\n \n \n // 盤面を破棄する。\n void destray_board(struct board *restrict brd)\n {\n for(int row = 0; row < brd->num_rows; row++) {\n free(brd->counts[row]);\n }\n free(brd->counts);\n }\n \n \n // 後述の update_next_counts_and_enum_available_indices() とペアで使う。\n // 上記関数で列挙されたマスのカウントを元に戻す。\n void restore_next_counts(\n struct board *restrict brd,\n const struct board_index nexts[restrict],\n size_t num_nexts)\n {\n for(size_t i = 0; i < num_nexts; i++) {\n // カウント戻し + 1のマス数の調整\n switch(brd->counts[nexts[i].row][nexts[i].col]++) {\n case 1:\n brd->num_ones--;\n break;\n \n case 0:\n brd->num_ones++;\n break;\n }\n }\n }\n \n \n // 現在位置から到達できるマスのカウントを減らしつつ、\n // 指定された位置から次に動ける候補一覧を列挙する。\n // nexts[] に候補が格納され、候補数が返される。解がないと判断されたら\n // カウントの変更はキャンセルされ、0が返されら。\n size_t update_next_counts_and_enum_available_indices(\n struct board *restrict brd,\n struct board_index index,\n bool is_last_step,\n struct board_index nexts[restrict])\n {\n size_t num_nexts = 0;\n for(size_t i = 0; i < NUM_KNIGHT_MOVEMENTS; i++) {\n struct board_index next = {\n .row = g_knight_movement[i].row + index.row,\n .col = g_knight_movement[i].col + index.col,\n };\n if(!in_board(brd, next)) {\n // 盤面の範囲外は候補たり得ないので何もしない\n continue;\n }\n int count = brd->counts[next.row][next.col];\n if(count < 0) {\n // 訪問済のマスは触らない。\n continue;\n }\n // 以降、すべて正の数となる。(0となるパターンは存在しない)\n assert(count != 0);\n // カウントを減らす。\n brd->counts[next.row][next.col] = count - 1;\n if(count == 1) {\n // 1のマス (今回0になった) が見付かった時点で、それが唯一の候補。\n // ただし、それが最後の空きマスでなければ、さらに\n // 次の一歩を移動できないので解なしとなる。\n if(is_last_step) {\n num_nexts = 1;\n nexts[0] = next;\n brd->num_ones--;\n // 他のマスはすべて訪問済なので、これ以上見る必要はない。\n break;\n }\n else {\n // 解なし。変更を元に戻して0を返す。\n brd->counts[next.row][next.col] = count;\n restore_next_counts(brd, nexts, num_nexts);\n return 0;\n }\n }\n else {\n nexts[num_nexts++] = next;\n if(count == 2) {\n // 減算の結果、1になるので、記録してある1の数を増やす。\n brd->num_ones++;\n }\n }\n }\n assert(num_nexts > 0);\n return num_nexts;\n }\n \n \n long long solve_knight_tour_impl(\n struct board *restrict brd,\n int depth,\n struct board_index index)\n {\n if(depth == brd->num_rows * brd->num_cols - 1) {\n // 解がひとつ見付かった\n return 1;\n }\n \n struct board_index nexts[NUM_KNIGHT_MOVEMENTS]; // 移動先候補は最大でナイトの利き筋の数。\n size_t num_nexts = update_next_counts_and_enum_available_indices(\n brd, index,\n depth == brd->num_rows * brd->num_cols - 2,\n nexts);\n if(num_nexts == 0) {\n // この探索では解がない。\n return 0;\n }\n // 現在位置を無効化する。\n // 後で戻せるように値の退避もしておく。\n int saved_count = brd->counts[index.row][index.col];\n if(saved_count == 1) {\n brd->num_ones--;\n }\n brd->counts[index.row][index.col] = -1;\n \n long long found = 0;\n // ここで、現在の1のマスの数を調べる。\n if(brd->num_ones >= 3) {\n // 3以上なら解なしとなるので何もしない。\n }\n else {\n if(brd->num_ones >= 2) {\n // カウントが1の移動先候補それぞれについて解を探索。\n for(size_t i = 0; i < num_nexts; i++) {\n if(brd->counts[nexts[i].row][nexts[i].col] == 1) {\n found += solve_knight_tour_impl(brd, depth + 1, nexts[i]);\n }\n }\n }\n else {\n // 移動先候補それぞれについて解を探索。\n for(size_t i = 0; i < num_nexts; i++) {\n found += solve_knight_tour_impl(brd, depth + 1, nexts[i]);\n }\n }\n }\n // [A] の変更元に戻す。\n brd->counts[index.row][index.col] = saved_count;\n if(saved_count == 1) {\n brd->num_ones++;\n }\n restore_next_counts(brd, nexts, num_nexts);\n \n return found;\n }\n \n \n // num_rows × num_cols の盤面のナイトツアーを満たす解の数を返す。\n // エラー発生時は -1 。\n // なお、回転・線対称・逆周りはすべて別個の解として数えている。\n long long solve_knight_tour(size_t num_rows, size_t num_cols)\n {\n struct board brd;\n switch(init_board(&brd, num_rows, num_cols)) {\n case IB_SUCCESS:\n break;\n \n case IB_ERROR:\n return -1;\n \n case IB_NO_SOLUTION:\n return 0;\n }\n long long found = 0;\n \n // 各座標を視点とした解の個数を合計する。\n // なお、縦横2等分すれば、それぞれ線対称の位置になるので、\n // その 1/4 の部分だけ計算し、4倍することで全体の結果が求められる。\n // ただし、奇数の場合は、中央の行・列の追加計算も必要。\n for(int row = 0; row < num_rows / 2; row++) {\n for(int col = 0; col < num_cols / 2; col++) {\n found += solve_knight_tour_impl(&brd, 0, (struct board_index){ .row = row, .col = col });\n }\n }\n found *= 4;\n // 奇数の場合の追加パターン\n if(num_rows & 1) {\n long long extra_found = 0;\n // 行数が奇数 → 真ん中の行を追加計算。これも半分だけ計算して2倍する。\n for(int col = 0; col < num_cols / 2; col++) {\n extra_found += solve_knight_tour_impl(&brd, 0, (struct board_index){ .row = num_rows / 2, .col = col });\n }\n found += extra_found * 2;\n }\n if(num_cols & 1) {\n long long extra_found = 0;\n // 列数が奇数 → 真ん中の列を追加計算。これも半分だけ計算して2倍する。\n for(int row = 0; row < num_rows / 2; row++) {\n extra_found += solve_knight_tour_impl(&brd, 0, (struct board_index){ .row = row, .col = num_cols / 2 });\n }\n found += extra_found * 2;\n }\n if((num_rows & 1) && (num_cols & 1)) {\n // どちらも奇数 → 中央のマスを追加計算。\n found += solve_knight_tour_impl(&brd, 0, (struct board_index){ .row = num_rows / 2, .col = num_cols / 2 });\n }\n destray_board(&brd);\n return found;\n }\n \n \n // 引数に盤面のサイズを指定する。\n // 不正な引数が渡された場合のエラー処理はしていない(手抜き)。\n int main(int argc, char *argv[])\n {\n if(argc < 3) {\n printf(\"Usage: %s #-rows #-cols\\n\", argv[0]);\n return 1;\n }\n int num_rows = strtol(argv[1], NULL, 0);\n int num_cols = strtol(argv[2], NULL, 0);\n \n // 探索本体\n long long num_solutions = solve_knight_tour(num_rows, num_cols);\n if(num_solutions == -1) {\n perror(\"\");\n return 1;\n }\n printf(\"# of solutions = %lld\\n\", num_solutions);\n return 0;\n }\n \n```\n\n## 実行結果\n\n### 環境\n\n * CPU: Core i5 2520M (2.50Ghz)\n * OS: Gentoo Linux (カーネル 4.0.5)\n * コンパイラ: gcc-4.8.5\n\n### コンパイル & 実行\n\n```\n\n $ gcc -Wall -std=c11 -O3 -march=native -mtune=native knight-tour.c \n $ for arg in \"4 5\" \"5 4\" \"4 6\" \"6 4\" \"4 7\" \"7 4\" \"6 6\"; do echo \"$arg:\"; time ./a.out $arg; echo; echo; done \n 4 5:\n # of solutions = 164\n \n real 0m0.001s\n user 0m0.000s\n sys 0m0.000s\n \n \n 5 4:\n # of solutions = 164\n \n real 0m0.001s\n user 0m0.000s\n sys 0m0.000s\n \n \n 4 6:\n # of solutions = 1488\n \n real 0m0.002s\n user 0m0.001s\n sys 0m0.001s\n \n \n 6 4:\n # of solutions = 1488\n \n real 0m0.002s\n user 0m0.001s\n sys 0m0.000s\n \n \n 4 7:\n # of solutions = 12756\n \n real 0m0.016s\n user 0m0.015s\n sys 0m0.000s\n \n \n 7 4:\n # of solutions = 12756\n \n real 0m0.015s\n user 0m0.014s\n sys 0m0.000s\n \n \n 6 6:\n # of solutions = 6637920\n \n real 0m3.978s\n user 0m3.976s\n sys 0m0.001s\n \n```",
"comment_count": 6,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T15:38:03.177",
"id": "16530",
"last_activity_date": "2015-09-12T03:26:43.910",
"last_edit_date": "2015-09-12T03:26:43.910",
"last_editor_user_id": "7831",
"owner_user_id": "7831",
"parent_id": "16525",
"post_type": "answer",
"score": 6
},
{
"body": "**(質問した経緯)** \n<http://magictour.free.fr/enum> \n上記サイトにm×n board におけるナイト・ツアーの数が正しいものと不明なものを含めて載っているのですが、 \n**3×16の場合に誤りがある** ※ことに一週間ほど前気づき質問させていただきました。 \n※正しい結果自体は以下に投稿したが、投稿するコミュニティを間違っていたため今は保留中になっています。 \n(<https://math.stackexchange.com/questions/1426623/how-many-open-knights-\ntours-are-possible-in-a-3%C3%9716-chessboard>)\n\n**(yoh2 さんのコードによるナイトツアーの数えあげの結果)** \nm = 4, 5のときはOEISに十分なほど載っているので、 \nm = 3, 6, 7のときについて載せておきます。\n\nm = 3のとき\n\n```\n\n C:\\Users\\Seiichi>20150912.exe 3 1\n # of solutions = 0\n \n C:\\Users\\Seiichi>20150912.exe 3 2\n # of solutions = 0\n \n C:\\Users\\Seiichi>20150912.exe 3 3\n # of solutions = 0\n \n C:\\Users\\Seiichi>20150912.exe 3 4\n # of solutions = 16\n \n C:\\Users\\Seiichi>20150912.exe 3 5\n # of solutions = 0\n \n C:\\Users\\Seiichi>20150912.exe 3 6\n # of solutions = 0\n \n C:\\Users\\Seiichi>20150912.exe 3 7\n # of solutions = 104\n \n C:\\Users\\Seiichi>20150912.exe 3 8\n # of solutions = 792\n \n C:\\Users\\Seiichi>20150912.exe 3 9\n # of solutions = 1120\n \n C:\\Users\\Seiichi>20150912.exe 3 10\n # of solutions = 6096\n \n C:\\Users\\Seiichi>20150912.exe 3 11\n # of solutions = 21344\n \n C:\\Users\\Seiichi>20150912.exe 3 12\n # of solutions = 114496\n \n C:\\Users\\Seiichi>20150912.exe 3 13\n # of solutions = 257728\n \n C:\\Users\\Seiichi>20150912.exe 3 14\n # of solutions = 1292544\n \n C:\\Users\\Seiichi>20150912.exe 3 15\n # of solutions = 3677568\n \n C:\\Users\\Seiichi>20150912.exe 3 16\n # of solutions = 17273760\n \n C:\\Users\\Seiichi>20150912.exe 3 17\n # of solutions = 46801984\n \n C:\\Users\\Seiichi>20150912.exe 3 18\n # of solutions = 211731376\n \n C:\\Users\\Seiichi>20150912.exe 3 19\n # of solutions = 611507360\n \n C:\\Users\\Seiichi>20150912.exe 3 20\n # of solutions = 2645699504\n \n C:\\Users\\Seiichi>20150912.exe 3 21\n # of solutions = 7725948608\n \n```\n\nm = 6のとき\n\n```\n\n C:\\Users\\Seiichi>20150912.exe 6 1\n # of solutions = 0\n \n C:\\Users\\Seiichi>20150912.exe 6 2\n # of solutions = 0\n \n C:\\Users\\Seiichi>20150912.exe 6 3\n # of solutions = 0\n \n C:\\Users\\Seiichi>20150912.exe 6 4\n # of solutions = 1488\n \n C:\\Users\\Seiichi>20150912.exe 6 5\n # of solutions = 37568\n \n C:\\Users\\Seiichi>20150912.exe 6 6\n # of solutions = 6637920\n \n C:\\Users\\Seiichi>20150912.exe 6 7\n # of solutions = 779938932\n \n```\n\nm = 7のとき\n\n```\n\n C:\\Users\\Seiichi>20150912.exe 7 1\n # of solutions = 0\n \n C:\\Users\\Seiichi>20150912.exe 7 2\n # of solutions = 0\n \n C:\\Users\\Seiichi>20150912.exe 7 3\n # of solutions = 104\n \n C:\\Users\\Seiichi>20150912.exe 7 4\n # of solutions = 12756\n \n C:\\Users\\Seiichi>20150912.exe 7 5\n # of solutions = 1245736\n \n C:\\Users\\Seiichi>20150912.exe 7 6\n # of solutions = 779938932\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T05:37:45.913",
"id": "16540",
"last_activity_date": "2015-09-13T20:33:28.063",
"last_edit_date": "2017-04-13T12:22:09.800",
"last_editor_user_id": "-1",
"owner_user_id": "5363",
"parent_id": "16525",
"post_type": "answer",
"score": 3
}
] | 16525 | 16530 | 16530 |
{
"accepted_answer_id": "16539",
"answer_count": 1,
"body": "DBの高負荷状態が続いたため、SHOW PROCESSLISTを実行したところ、 \nCommand が Sleep 、また query endの状態のプロセスが多く発生していること確認できました。\n\n上記のプロセスが増加してしまう原因および対策方法(できれば暫定と恒久)をご教示願います。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T13:42:21.620",
"favorite_count": 0,
"id": "16528",
"last_activity_date": "2015-09-12T04:19:43.983",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12295",
"post_type": "question",
"score": 1,
"tags": [
"mysql"
],
"title": "mysql sleep、query end プロセスについて",
"view_count": 13747
} | [
{
"body": "Sleep\nは接続されたまま何のコマンドも発行していない状態です。これが多くて困る場合はクライアントアプリの処理を見なおしたほうがいいかもしれません。クライアントアプリを終了させればその状態のスレッドは無くなりますし、サーバー側から強制的に切断したい場合は\nKILL コマンドを使用できます。\n\nquery end の方は、マニュアル <http://dev.mysql.com/doc/refman/5.6/ja/general-thread-\nstates.html> によると、\n\n> この状態は、クエリーを処理したあと、ただし freeing items 状態の前に発生します\n\nということのようです。普通は長時間この状態のままということはないと思うので、もしそうなっていたら mysqld\nがおかしな状態になっているか、サーバーの負荷が高いのかもしれません。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T04:19:43.983",
"id": "16539",
"last_activity_date": "2015-09-12T04:19:43.983",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3249",
"parent_id": "16528",
"post_type": "answer",
"score": 1
}
] | 16528 | 16539 | 16539 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "ons-carousel-itemコンポーネントをons-\ncarouselコンポーネントにjsで追加した場合refresh()メソッドを読んでレイアウトを更新する必要があります。\n\nとonsenuiのガイドに記載されているのですが、具体的にどのようにjsに組み込めば良いのかわかりません。\n\nお分かりになる方ご教示ください。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T15:28:18.560",
"favorite_count": 0,
"id": "16529",
"last_activity_date": "2015-09-11T17:36:07.400",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "11129",
"post_type": "question",
"score": 2,
"tags": [
"onsen-ui"
],
"title": "<ons-carousel-item>コンポーネントを追加した場合refresh()メソッドの使い方",
"view_count": 1530
} | [
{
"body": "[Let’s Build a Weather App using AngularJS and Onsen\nUI!](http://monaca.mobi/en/blog/weather-app/)\n\nを参考に、実例のサンプルを改造してみました。 \nAddボタンをタップすると、ons-carousel-itemがGRAYから順に追加されます。 \nこの場合、ng-repeatで配列分を回していますが、配列に追加しただけではons-carousel-\nitemに反映されないため、refresh()を実行してons-carousel-itemを更新します。 \nsetImmediate()は、待機中のタスクがない状態でコールバックする関数で、これを使わないとうまく画面に反映されませんでした。\n\n```\n\n <!DOCTYPE HTML>\n <html la=\"ja\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\">\n <script src=\"components/loader.js\"></script>\n <link rel=\"stylesheet\" href=\"components/loader.css\">\n <script>\n var app = ons.bootstrap(\"myApp\", [\"onsen\"]);\n app.controller(\"page1Controller\", [\"$scope\", function($scope) {\n var colorTable = [\n {\n style: \"background-color: gray;\",\n name: \"GRAY\"\n },\n {\n style: \"background-color: #085078;\",\n name: \"BLUE\"\n },\n {\n style: \"background-color: #373B44;\",\n name: \"DARK\"\n },\n {\n style: \"background-color: #D38312;\",\n name: \"ORANGE\"\n },\n {\n style: \"background-color: red;\",\n name: \"RED\"\n },\n ];\n ons.ready(function() {\n $scope.colorTable = [];\n });\n $scope.addColor = function() {\n if ($scope.colorTable.length < colorTable.length) {\n $scope.colorTable.push(colorTable[$scope.colorTable.length]);\n setImmediate(function() {\n myCarousel.refresh();\n if ($scope.colorTable.length > 1) { \n myCarousel.setActiveCarouselItemIndex($scope.colorTable.length);\n }\n });\n }\n };\n }]);\n </script>\n <style>\n ons-carousel-item {\n display: table;\n text-align: center;\n }\n .item-label {\n display: table-cell;\n vertical-align: middle;\n color: white;\n line-height: 1;\n font-size: 48px;\n font-weight: bold;\n }\n .cover-label {\n text-align: center;\n position: absolute;\n left: 0px;\n width: 100%;\n bottom: 10px;\n color: white;\n }\n </style>\n </head>\n <body>\n <ons-navigator var=\"myNavigator\">\n <ons-page ng-controller=\"page1Controller\">\n <ons-toolbar>\n <div class=\"center\">Carousel</div>\n <div class=\"right\"><ons-toolbar-button ng-click=\"addColor()\">Add</ons-toolbar-button></div>\n </ons-toolbar>\n <ons-carousel swipeable overscrollable auto-scroll fullscreen var=\"myCarousel\">\n <ons-carousel-item style=\"{{color.style}}\" ng-repeat=\"color in colorTable\">\n <div class=\"item-label\">{{color.name}}</div>\n </ons-carousel-item>\n <ons-carousel-cover><div class=\"cover-label\">Swipe left or right</div></ons-carousel-cover>\n </ons-carousel>\n </ons-page>\n </ons-navigator> \n </body>\n </html>\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T17:16:32.127",
"id": "16533",
"last_activity_date": "2015-09-11T17:36:07.400",
"last_edit_date": "2015-09-11T17:36:07.400",
"last_editor_user_id": "9566",
"owner_user_id": "9566",
"parent_id": "16529",
"post_type": "answer",
"score": 2
}
] | 16529 | null | 16533 |
{
"accepted_answer_id": "16581",
"answer_count": 1,
"body": "`UIScreenEdgePanGestureRecognizer`を`ViewController`の`view`に追加しても認識しません。\n\n通常の`GestureRecognizer`のように、ビューに追加するだけでは使えないのでしょうか?\n\n * `Left`などの方向を設定しています。\n * `view`の`userInteractionEnabled` は `true`です。\n * 一本指でのPan認識ができればいいです。\n * `UIGestureRecognizerDelegate`プロトコルを`ViewController`に適用して、 \n`edgePanGestureRecognizer`の`delegate`に`ViewController`を指定しています。\n\nそのほかに何か設定が必要でしょうか?\n\nよろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T16:53:02.900",
"favorite_count": 0,
"id": "16531",
"last_activity_date": "2015-09-16T11:39:40.327",
"last_edit_date": "2015-09-16T11:39:40.327",
"last_editor_user_id": "12297",
"owner_user_id": "12297",
"post_type": "question",
"score": 3,
"tags": [
"ios",
"swift",
"xcode"
],
"title": "UIScreenEdgePanGestureRecognizerをViewControllerのviewに追加しても認識されません。",
"view_count": 953
} | [
{
"body": "Xcode6.4にて。\n\n新規に「Single View Application」Projectを作成し、ViewController.swiftに以下を記述。 \n単純にUIScreenEdgePanGestureRecognizerを追加しているだけのコードです。\n\niPhone6シミュレータを起動し、画面左端部分をパン操作することで当該メソッドが呼ばれログが出ました。\n\n```\n\n import UIKit\n \n class ViewController: UIViewController {\n \n override func viewDidLoad() {\n super.viewDidLoad()\n \n let screenEdgeRecognizer = UIScreenEdgePanGestureRecognizer(target: self, action: \"edgePanGesture:\")\n screenEdgeRecognizer.edges = .Left\n self.view.addGestureRecognizer(screenEdgeRecognizer)\n }\n \n internal func edgePanGesture(sender: UIScreenEdgePanGestureRecognizer) {\n NSLog(\"called\");\n if sender.state == .Ended {\n NSLog(\"ended\");\n }\n }\n }\n \n```\n\n他の要素が動作を阻害しているのかも。 \n該当部分のコードを貼ることで解決に近付くかもしれません。\n\n他の要素をコメントアウトし問題を切り分けてみてください。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T03:58:35.127",
"id": "16581",
"last_activity_date": "2015-09-14T03:58:35.127",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "11109",
"parent_id": "16531",
"post_type": "answer",
"score": 3
}
] | 16531 | 16581 | 16581 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "コレクションビューをスクロールすると、 \n他のビューのレイアウトが変わってしまいます。\n\nコレクションビューのスクロールで、 \nオートレイアウトが、 \n更新されることはありますか?\n\nこのタイミングで、 \n`viewDidLayoutSubviews`が呼ばれます。\n\nデバイスを回転した後の \n一回だけこのような挙動となります。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-11T17:00:04.443",
"favorite_count": 0,
"id": "16532",
"last_activity_date": "2015-09-11T17:00:04.443",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12297",
"post_type": "question",
"score": 1,
"tags": [
"swift",
"uicollectionview"
],
"title": "コレクションビューのスクロールで、オートレイアウトが、更新されることはありますか?",
"view_count": 85
} | [] | 16532 | null | null |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "以下の5で困っています。\n\n 1. XcodeでIBを使い、ButtonをStoryboardに配置して\n 2. 紐付けするときに、actionでなくて、誤ってoutletで紐付けしてしまう\n 3. ビルド(Cmd+r)すると問題なく実行される\n 4. Cmd+zで戻ってビルド(Cmd+r)\n 5. [困りポイント]`Thread1: signal SIGABRT`が出てしまう\n\nXcodeはversion6.4でswiftで作っています。 \niOSシミュレーターでReset contents and settings...を実行しても特に変化はないです。\n\n不明な点は、 \na.4でCmd+zで前の状態にもどってビルドが通るはずなのに、なぜ通らないのか。 \nButtonでoutletで紐付けするのはNGということでしょうか? \n今回は誤って紐付けしてしまいましたが、Labelなどと同じようにoutletを使いたい時もあるのかなと。\n\nよろしくお願いします。\n\n\\----- コメントから転記 ----- \nエラーログ\n\n> Terminating app due to uncaught exception 'NSUnknownKeyException', reason:\n> '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant\n> for the key myButton.'\n\n\\----- ここまで -----\n\n9/12 22:48 追記 \nどうやら、紐付けが残っていたようです↓で言うと MyButton。これをdeleteしたら、無事動きました。cmd*zの回数が足りなかったのですかね。。。 \n[](https://i.stack.imgur.com/ZFNty.png)",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T01:21:35.107",
"favorite_count": 0,
"id": "16535",
"last_activity_date": "2015-09-14T01:21:13.820",
"last_edit_date": "2015-09-14T01:21:13.820",
"last_editor_user_id": "3516",
"owner_user_id": "12299",
"post_type": "question",
"score": 3,
"tags": [
"ios",
"swift",
"xcode"
],
"title": "Xcodeで、Buttonでactionでなくてoutletで紐付けしてしまってビルドでのエラー",
"view_count": 2568
} | [
{
"body": "ちょうどMAC触ってたので画像を踏まえて回答させていただきます。\n\n> a.4でCmd+zで前の状態にもどってビルドが通るはずなのに、なぜ通らないのか。\n\nこちらでも試してみたところ、 \nIBOutletやIBActionの変更を元に戻すには、StoryBoard上でCmd+zすれば元に戻せました。 \nコードペインをアクティブにしてCmd+zしてもStoryBoardファイルには影響がないようです。\n\n> Buttonでoutletで紐付けするのはNGということでしょうか?\n\n全くNGではありません。 \nむしろ必要な手順であって、UI部品とコードを対応させる行為がIBOutletです。\n\n* * *\n\nそれで解決方法なんですが、推測で書かせていただきます。 \nXCodeのログに`unrecognized selector sent to instance`と出ていますでしょうか?\n\n[](https://i.stack.imgur.com/S9YJw.png)\n\n画像について説明させていただくと、 \n* UIButtonをIBOutletで`button`として定義しています。 \n* UIButtonのActionメソッドとして、`aaa`を定義しています。\n\nこの状態でアプリを起動し、buttonを押下すると`signal SIGABRT`が発生します。 \nログは以下のとおりです。\n\n```\n\n 2015-09-12 10:49:59.041 16535[1319:25886] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_6535.ViewController onButtonTapped:]: unrecognized selector sent to instance 0x7fee70d65ef0'\n \n```\n\nなぜエラーが発生するかと言いますと、UIButtonには`onButtonTapped:`が定義されているものの、ViewControllerクラスに`onButtonTapped:`が存在しないためです。\n\n※上記の画像の様に、存在しないIBActionの定義が残っていてはダメ\n\nCtrlキーを押しながら対象のUI部品をクリックし、接続一覧(黒いポップアップ画面)を表示したら、不要な接続が残っていないか確認してみてください。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T02:21:47.007",
"id": "16537",
"last_activity_date": "2015-09-12T02:34:01.190",
"last_edit_date": "2015-09-12T02:34:01.190",
"last_editor_user_id": "12256",
"owner_user_id": "12256",
"parent_id": "16535",
"post_type": "answer",
"score": 2
}
] | 16535 | null | 16537 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "こんにちは、いつもお世話になってます。\n\n今、私はmac版UnityにOPENCVを入れようとしています。そこでこのサイトを見ながらやったのですが、↓\n\n[UnityでOpenCVを動かしてみよう(主にMac対応)](http://warapuri.tumblr.com/post/70283352060/unity%E3%81%A7opencv%E3%82%92%E5%8B%95%E3%81%8B%E3%81%97%E3%81%A6%E3%81%BF%E3%82%88%E3%81%86%E4%B8%BB%E3%81%ABmac%E5%AF%BE%E5%BF%9C)\n\nlibcxcore.dylibがないというエラーでうまく動作させれませんでした。libcxcore.dylibについていろいろサイトにあることを参考にやったのですがうまくできませんでした。\n\nぜひご教示お願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T01:55:36.310",
"favorite_count": 0,
"id": "16536",
"last_activity_date": "2015-09-12T03:01:51.057",
"last_edit_date": "2015-09-12T03:01:51.057",
"last_editor_user_id": null,
"owner_user_id": "12300",
"post_type": "question",
"score": 1,
"tags": [
"unity3d",
"opencv"
],
"title": "mac版Unityに於けるOPENCVについてうまくできない。",
"view_count": 142
} | [] | 16536 | null | null |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "iOSでDistribution時にPush通知が届きません。\n\n下記、状況でございます。\n\n・サーバサイドはApnsPHP(<https://github.com/immobiliare/ApnsPHP>) を使用\n\n・Development環境では届く\n\n・Distribution環境では届かない\n\n・試しにgrowthpush(<https://growthpush.com>)\nを使いDistributionでPushを送ると届く。なので、app証明書,push証明書,アプリ設定は問題ないと思ってます。\n\n・ApnsPHPは本番時はENVIRONMENT_PRODUCTIONに設定している。コードは下記です。\n\n```\n\n $push = new ApnsPHP_Push(\n ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION,\n <CERTIFICATES_FILE>\n );\n \n```\n\n・ApnsPHP_PushのsetRootCertificationAuthorityには開発と本番で同じものを使用\n\n・Push送信時のログに下記が残る\n\n```\n\n STATUS: Sending message ID 1 [custom identifier: <数字のID>] (1/3): 129 bytes.\n \n```\n\n・push通知を送るデバイスは1回のプッシュで1台です。\n\nよろしくお願いします。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T03:30:32.653",
"favorite_count": 0,
"id": "16538",
"last_activity_date": "2015-09-12T09:51:01.307",
"last_edit_date": "2015-09-12T09:51:01.307",
"last_editor_user_id": "9948",
"owner_user_id": "9948",
"post_type": "question",
"score": 4,
"tags": [
"ios",
"php",
"push-notification"
],
"title": "iOS Push通知 Distribution時のみ届かない",
"view_count": 766
} | [] | 16538 | null | null |
{
"accepted_answer_id": "16747",
"answer_count": 1,
"body": "MonacaでWeb SQLを使用したアプリを開発しましたが、Androidにおいて次の現象が解決できません。 \n※Cordova InAppBrowserプラグイン有効。 \n※Monacaデバッガー、リリースビルドで現象を確認。\n\n下記の例を起動すると、page1で10件分のリストが表示されます。 \npage2に切り替え、「stackoverflow」ボタンをタップするとWebViewが表示されます。 \n「×」ボタンまたは「戻る」ボタンをタップして閉じ、page1に切り替えると、エラーコード:5 メッセージ:\"no such table:\nt_test\"が発生します。\n\n実際は、Dropbox datastore APIの認証でWebViewを使用しています。 \nログイン画面で「×」ボタンまたは「戻る」ボタンをタップして閉じ、一覧などの表示画面に切り替えると上記エラーが発生します。 \n※API内のwindow.openで\"_blank\"以外は認証に失敗します。 \nまた、appC\ncloudプラグインでもカットイン広告の画面遷移にWebViewを使用しており、「戻る」ボタンで戻ると同様のエラーが発生するため、導入を断念しました。\n\n作りが悪いのか、諦めるしかないのか、ご教示のほどよろしくお願いします。\n\n関連した内容と思われるリンク \n1.[inAppbrowser and webSql\nfailure](http://community.phonegap.com/nitobi/topics/inappbrowser_and_websql_failure) \n2.[Apache\nCordova](https://issues.apache.org/jira/browse/CB-3550?jql=project%20%3D%20CB%20AND%20text%20~%20%22inappbrowser%20database%22)\n\n```\n\n <!DOCTYPE HTML>\n <html la=\"ja\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\">\n <script src=\"components/loader.js\"></script>\n <link rel=\"stylesheet\" href=\"components/loader.css\">\n <script>\n var app = ons.bootstrap(\"myApp\", [\"onsen\"]);\n // DB初期化\n initData();\n // page1\n app.controller(\"page1Controller\", [\"$scope\", function($scope) {\n ons.ready(function() {\n $scope.listTable = [];\n getData($scope);\n });\n }]);\n // page2\n app.controller(\"page2Controller\", [\"$scope\", function($scope) {\n $scope.goUrl = function() {\n window.open(\"http://ja.stackoverflow.com/\", \"_blank\", \"location=yes\");\n };\n }]);\n // DB初期化\n function initData() {\n var sql = null;\n var db = window.openDatabase(\"testdb\", \"1.0\", \"testdb\", 1024 * 1024);\n db.transaction(function(t) {\n sql = \"CREATE TABLE IF NOT EXISTS t_test (\";\n sql += \" id INTEGER,\";\n sql += \" name TEXT)\";\n t.executeSql(sql, [], function(t) {\n sql = \"DELETE FROM t_test\";\n t.executeSql(sql, []);\n sql = \"INSERT INTO t_test (id, name) VALUES(?, ?)\";\n t.executeSql(sql, [1, \"佐藤\"]);\n t.executeSql(sql, [2, \"鈴木\"]);\n t.executeSql(sql, [3, \"高橋\"]);\n t.executeSql(sql, [4, \"田中\"]);\n t.executeSql(sql, [5, \"伊藤\"]);\n t.executeSql(sql, [6, \"山本\"]);\n t.executeSql(sql, [7, \"渡辺\"]);\n t.executeSql(sql, [8, \"中村\"]);\n t.executeSql(sql, [9, \"小林\"]);\n t.executeSql(sql, [10, \"加藤\"]);\n });\n });\n }\n // 名簿データ取得\n function getData($scope) {\n var sql = null;\n var list = [];\n var db = window.openDatabase(\"testdb\", \"1.0\", \"testdb\", 1024 * 1024);\n db.transaction(function(t) {\n sql = \"SELECT *\";\n sql += \" FROM t_test\";\n sql += \" ORDER BY id\";\n t.executeSql(sql, [], function(t, r) {\n for (i = 0; i < r.rows.length; i++) {\n list.push({\n id: r.rows.item(i).id,\n name: r.rows.item(i).name\n });\n }\n $scope.listTable = list;\n $scope.$apply();\n },\n function(t, err) {\n console.log(err.code + \" \" + err.message);\n });\n });\n }\n </script>\n </head>\n <body>\n <ons-template id=\"page1.html\">\n <ons-page ng-controller=\"page1Controller\">\n <ons-toolbar fixed-style>\n <div class=\"center\">Page1</div>\n </ons-toolbar>\n <ons-list>\n <ons-list-header>\n 名簿\n </ons-list-header>\n <ons-list-item ng-repeat=\"item in listTable\">\n <ons-row>\n <ons-col width=\"20%\">\n {{item.id}}\n </ons-col>\n <ons-col width=\"80%\">\n {{item.name}}\n </ons-col>\n </ons-row>\n </ons-list-item>\n </ons-list>\n </ons-page>\n </ons-template>\n \n <ons-template id=\"page2.html\">\n <ons-page ng-controller=\"page2Controller\">\n <ons-toolbar fixed-style>\n <div class=\"center\">Page2</div>\n </ons-toolbar>\n <br>\n <div style=\"text-align: center;\">\n <ons-button ng-click=\"goUrl()\">stackoverflow</ons-button>\n </div>\n </ons-page>\n </ons-template>\n \n <ons-tabbar>\n <ons-tab page=\"page1.html\" label=\"Page1\" icon=\"ion-home\" active=\"true\"></ons-tab>\n <ons-tab page=\"page2.html\" label=\"Page2\" icon=\"ion-earth\"></ons-tab>\n </ons-tabbar>\n </body>\n </html>\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T08:59:51.800",
"favorite_count": 0,
"id": "16543",
"last_activity_date": "2015-09-18T09:25:08.443",
"last_edit_date": "2015-09-12T09:41:01.210",
"last_editor_user_id": "9566",
"owner_user_id": "9566",
"post_type": "question",
"score": 4,
"tags": [
"monaca",
"angularjs",
"cordova",
"sql"
],
"title": "Monaca InAppBrowserプラグインでWebView表示後、Web SQLで「no such table」エラーが発生する",
"view_count": 1096
} | [
{
"body": "自己回答です。 \nInAppBrowserプラグインを使用してブラウザを表示すると、DB参照先が\n\n```\n\n /data/data/パッケージ名/app_database\n \n```\n\nから\n\n```\n\n /data/data/パッケージ名/app_inAppBrowserDB\n \n```\n\nに変わってしまうため、`\"no such table\"`が発生するようです。\n\n[table not found when coming back from in app browser link:\nPhonegap](https://stackoverflow.com/questions/16871103/table-not-found-when-\ncoming-back-from-in-app-browser-link-phonegap)\n\nカスタマイズしたCordovaプラグインを導入すれば解決しそうですが、BASICプランなのでそれ以外の方法を考えました。\n\n起動時に`hidden=yes`でブラウザを表示させ、数秒待ってブラウザを閉じた後にテーブルを作成します。 \nDB参照先が`app_inAppBrowserDB`に切り替わった後にテーブルを作成するため、以降は`\"no such\ntable\"`が発生せずに動作するようです。\n\n書き直したコードを載せておきます。\n\n```\n\n <!DOCTYPE HTML>\n <html la=\"ja\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\">\n <script src=\"components/loader.js\"></script>\n <link rel=\"stylesheet\" href=\"components/loader.css\">\n <script>\n var app = ons.bootstrap(\"myApp\", [\"onsen\"]);\n // index\n app.controller(\"indexController\", [\"$scope\", function($scope) {\n $scope.ready = false;\n ons.ready(function() {\n var w = window.open(\"\", \"_blank\", \"location=no,hidden=yes\");\n console.log(\"open browser\");\n setTimeout(function() {\n w.close();\n console.log(\"close browser\");\n initData($scope);\n }, 500);\n });\n $scope.$on(\"initData\", function(e) {\n $scope.ready = true;\n $scope.$apply();\n console.log(\"ready\");\n });\n }]);\n // page1\n app.controller(\"page1Controller\", [\"$scope\", function($scope) {\n $scope.listTable = [];\n // indexControllerのreadyを監視\n $scope.$watch(\"ready\", function(newVal, oldVal) {\n if (newVal == true) {\n getData($scope);\n }\n });\n $scope.$on(\"getData\", function(e, list) {\n $scope.listTable = list;\n $scope.$apply();\n console.log(\"get data\");\n });\n }]);\n // page2\n app.controller(\"page2Controller\", [\"$scope\", function($scope) {\n $scope.goUrl = function() {\n window.open(\"http://ja.stackoverflow.com/\", \"_blank\", \"location=yes\");\n };\n }]);\n // DB初期化\n function initData($scope) {\n var sql = null;\n var db = window.openDatabase(\"testdb\", \"1.0\", \"testdb\", 1024 * 1024);\n db.transaction(function(t) {\n sql = \"CREATE TABLE IF NOT EXISTS t_test (\";\n sql += \" id INTEGER,\";\n sql += \" name TEXT)\";\n t.executeSql(sql, [], function(t) {\n sql = \"SELECT COUNT(*) AS rowcount\";\n sql += \" FROM t_test\";\n t.executeSql(sql, [], function(t, r) {\n console.log(\"reccount = \" + r.rows.item(0).rowcount);\n if (r.rows.item(0).rowcount == 0) {\n sql = \"INSERT INTO t_test (id, name) VALUES(?, ?)\";\n t.executeSql(sql, [1, \"佐藤\"]);\n t.executeSql(sql, [2, \"鈴木\"]);\n t.executeSql(sql, [3, \"高橋\"]);\n t.executeSql(sql, [4, \"田中\"]);\n t.executeSql(sql, [5, \"伊藤\"]);\n t.executeSql(sql, [6, \"山本\"]);\n t.executeSql(sql, [7, \"渡辺\"]);\n t.executeSql(sql, [8, \"中村\"]);\n t.executeSql(sql, [9, \"小林\"]);\n t.executeSql(sql, [10, \"加藤\"]);\n console.log(\"insert data\");\n }\n });\n });\n },\n function(err) {\n console.log(err.code + \" \" + err.message);\n },\n function() {\n $scope.$emit(\"initData\");\n });\n }\n // 名簿データ取得\n function getData($scope) {\n var sql = null;\n var list = [];\n var db = window.openDatabase(\"testdb\", \"1.0\", \"testdb\", 1024 * 1024);\n db.transaction(function(t) {\n sql = \"SELECT *\";\n sql += \" FROM t_test\";\n sql += \" ORDER BY id\";\n t.executeSql(sql, [], function(t, r) {\n for (i = 0; i < r.rows.length; i++) {\n list.push({\n id: r.rows.item(i).id,\n name: r.rows.item(i).name\n });\n }\n },\n function(t, err) {\n console.log(err.code + \" \" + err.message);\n });\n },\n function(err) {\n console.log(err.code + \" \" + err.message);\n },\n function() {\n $scope.$emit(\"getData\", list);\n });\n }\n </script>\n </head>\n <body ng-controller=\"indexController\">\n <ons-template id=\"page1.html\">\n <ons-page ng-controller=\"page1Controller\">\n <ons-toolbar fixed-style>\n <div class=\"center\">Page1</div>\n </ons-toolbar>\n <ons-list>\n <ons-list-header>\n 名簿\n </ons-list-header>\n <ons-list-item ng-repeat=\"item in listTable\">\n <ons-row>\n <ons-col width=\"20%\">\n {{item.id}}\n </ons-col>\n <ons-col width=\"80%\">\n {{item.name}}\n </ons-col>\n </ons-row>\n </ons-list-item>\n </ons-list>\n </ons-page>\n </ons-template>\n \n <ons-template id=\"page2.html\">\n <ons-page ng-controller=\"page2Controller\">\n <ons-toolbar fixed-style>\n <div class=\"center\">Page2</div>\n </ons-toolbar>\n <br>\n <div style=\"text-align: center;\">\n <ons-button ng-click=\"goUrl()\">stackoverflow</ons-button>\n </div>\n </ons-page>\n </ons-template>\n \n <ons-tabbar>\n <ons-tab page=\"page1.html\" label=\"Page1\" icon=\"ion-home\" active=\"true\"></ons-tab>\n <ons-tab page=\"page2.html\" label=\"Page2\" icon=\"ion-earth\"></ons-tab>\n </ons-tabbar>\n </body>\n </html>\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-18T09:25:08.443",
"id": "16747",
"last_activity_date": "2015-09-18T09:25:08.443",
"last_edit_date": "2017-05-23T12:38:55.307",
"last_editor_user_id": "-1",
"owner_user_id": "9566",
"parent_id": "16543",
"post_type": "answer",
"score": 1
}
] | 16543 | 16747 | 16747 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "現在スマホから閲覧した場合はスマホ用テーマ、 \nPCから閲覧した場合はPC用テーマ表示しております。 \nスマホ用テーマのみ、無効化したいプラグインがあります。 \nfunction.phpなどに記載して無効化したいのですが、こういったことは可能でしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T11:05:34.737",
"favorite_count": 0,
"id": "16544",
"last_activity_date": "2015-09-12T11:05:34.737",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7641",
"post_type": "question",
"score": 1,
"tags": [
"wordpress"
],
"title": "WordPress にて 特定のプラグインをテーマから無効化することは可能ですか?",
"view_count": 99
} | [] | 16544 | null | null |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "ffmpegを使用してセグメントファイルを作ろうとしているんですが、試しにテスト用ファイルでやるとsegmentのつくオプションが使えないとでます。例えばsegment_timeとかのオプションです。 \nffmpeg -hでffmpegのオプションが見れますが、そこにはsegmentはありませんでした。 \nsegmentのオプションが使えるffmpegの場合はそこにsegmentがでるんでしょうか?\n\nもしなかった場合ffmpegをコンパイルし直す必要があるんでしょうか?",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T11:59:10.690",
"favorite_count": 0,
"id": "16545",
"last_activity_date": "2015-09-13T14:25:08.047",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9349",
"post_type": "question",
"score": 1,
"tags": [
"ffmpeg"
],
"title": "ffmpegのsegmentオプションについて質問です。",
"view_count": 417
} | [
{
"body": "`ffmpeg -formats 2>/dev/null | grep segment` を実行してみて、`E segment segment`\nなどの文字列が表示されるのであれば使用できるはずです。\n\nそれと、`ffmpeg -h full` とすれば、(segment 関連の機能が使えるのであれば) `segment_time`\nなどが表示されることになります。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T14:25:08.047",
"id": "16569",
"last_activity_date": "2015-09-13T14:25:08.047",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10455",
"parent_id": "16545",
"post_type": "answer",
"score": 1
}
] | 16545 | null | 16569 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "onCreateWindow で作った WebView で loadUrl を使って次の URL に遷移すると\nshouldOverrideUrlLoading が呼ばれず、onPageStarted がいきなり呼ばれます。\n\n親ウインドウ (つまり、onCreateWindow を呼んだ方)では、\n\n * shouldOverrideUrlLoading\n * onPageStarted\n\nの順番で呼ばれますが、 \n子ウインドウは、onPageStarted がいきなり呼ばれてしまいます。 \nそのため、loadURL で次の URL へ遷移したり、location.href にカスタム URL スキームが入ったものを実行する JavaScript\nを loadURL で実行すると、shouldOverrideUrlLoading が呼ばれないので、 \nカスタム URL スキームの処理ができず、 \nnet::ERR_UNKNOWN_URL_SCHEME \nのエラーが発生します。 \nonPageStarted で、カスタム URL スキームの処理ができればいいのですが、 \nできないので困っています。\n\nどなたか同じようなケースで解決された方がいらっしゃいましたら、 \n解決方法を教えていただけませんでしょうか?\n\nよろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T13:48:35.913",
"favorite_count": 0,
"id": "16546",
"last_activity_date": "2015-09-12T22:46:46.813",
"last_edit_date": "2015-09-12T22:46:46.813",
"last_editor_user_id": "12304",
"owner_user_id": "12304",
"post_type": "question",
"score": 3,
"tags": [
"android",
"webview",
"android-webview"
],
"title": "onCreateWindowで作ったWebViewでloadUrlを呼ぶとshouldOverrideUrlLoadingが呼ばれません",
"view_count": 1690
} | [] | 16546 | null | null |
{
"accepted_answer_id": "16555",
"answer_count": 2,
"body": "環境はMac OS X 10.9です。 \nエディタで検索置換するか、コンソールでするかなどは問いません。 \nテキストは上書きされてもされなくても構いません。\n\n> 例、以下のようなテキストを複数の検索置換ワードにバッチでかけて処理したい \n> `<p>aaaaa</p>` \n> ↓ \n> `<p class=\"hoge\">bbbbb</p>`\n>\n> 検索ワード:aaaaa 置換ワード:bbbbb \n> 検索ワード:`^<p>` 置換ワード:`<p class=\"hoge\">`\n\n今のところ、CotEditor付属のrubyスクリプトが簡単にできたのですが、 \n環境が異なると動作しなくなるなど少し不安定のようで、 \nもっとシンプルな方法がないかを知りたく質問いたしました。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T14:28:12.497",
"favorite_count": 0,
"id": "16547",
"last_activity_date": "2015-09-13T06:53:22.833",
"last_edit_date": "2015-09-13T06:53:22.833",
"last_editor_user_id": "10492",
"owner_user_id": "12308",
"post_type": "question",
"score": 5,
"tags": [
"macos",
"正規表現"
],
"title": "テキストに対して正規表現を含む複数の検索置換をバッチでかけたい",
"view_count": 353
} | [
{
"body": "二つに分けずとも、検索ワード:`^<p>aaaaa<\\/p>` 置換ワード:`<p\nclass=\"hoge\">bbbbb<\\/p>`で行けると思いますが、行頭を示す`^`を除いて正規表現の必要もほとんどないと思いますが、求めている回答とは主旨が違いますか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T16:27:24.933",
"id": "16552",
"last_activity_date": "2015-09-12T16:33:07.313",
"last_edit_date": "2015-09-12T16:33:07.313",
"last_editor_user_id": "7290",
"owner_user_id": "7290",
"parent_id": "16547",
"post_type": "answer",
"score": 1
},
{
"body": "`sed` を使うなどどうでしょうか。 \nターミナルから次を実行します。\n\n```\n\n sed -i .bk -e 's/aaaaa/bbbbb/g' -e 's/^<p>/<p class=\"hoge\">/g' TARGET_FILE\n \n```\n\nこのコマンドは、対象ファイルに上書きします。またその際元ファイルのバックアップ(`TARGET.bk`)を作成します。 \nバックアップファイルが不要の場合は、\n\n```\n\n sed -i .bk -e 's/aaaaa/bbbbb/g' -e 's/^<p>/<p class=\"hoge\">/g' TARGET_FILE && rm TARGET_FILE.bk\n \n```\n\nなどするとよいです。",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T06:03:47.790",
"id": "16555",
"last_activity_date": "2015-09-13T06:32:53.030",
"last_edit_date": "2015-09-13T06:32:53.030",
"last_editor_user_id": "754",
"owner_user_id": "754",
"parent_id": "16547",
"post_type": "answer",
"score": 4
}
] | 16547 | 16555 | 16555 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "自作テンキーを作成する他ないのでしょうか?inputで\n\n```\n\n type=\"tel\" pattern=\"\\d+(\\.\\d*)?\"\n \n```\n\nとすると、* ; ,は入力できるテンキーが出るのですが、ドットが入力できません。 \nどうすればいいでしょうか?\n\n<http://forum.ionicframework.com/t/showing-decimal-point-and-negative-sign-in-\nnumeric-keyboard/13488/4>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T14:54:32.640",
"favorite_count": 0,
"id": "16548",
"last_activity_date": "2015-12-20T02:27:58.627",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8748",
"post_type": "question",
"score": 3,
"tags": [
"monaca",
"cordova"
],
"title": "monacaでテンキーを実装するには(\".\"を使った小数を入力したい)",
"view_count": 500
} | [
{
"body": "はい、入力のレイアウトに拘るのであれば自作するしかありません。 \n想像しているのは3x4の入力フォームですよね?\n\n質問に記載されている`type=\"tel\"`は電話番号に関係する文字列しか入力できません。 \n(※数値、*#+) \nまた、`type=\"number\"`ではレイアウトが想定の物と違うものになってしまうかと思います。 \nINPUTのみで制御するのは難しいでしょう。\n\nあと`pattern`の要素を追加しておりますが、 \nそれは入力値を保証するものではございません。 \n`pattern`で制限をかけても入力できます。 \n此方は当てにならないので私は使用しておりません。 \n(※と言うより使用する用途が見つかりません。)",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-10-21T00:58:26.267",
"id": "17878",
"last_activity_date": "2015-10-21T00:58:26.267",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7676",
"parent_id": "16548",
"post_type": "answer",
"score": 1
}
] | 16548 | null | 17878 |
{
"accepted_answer_id": "16553",
"answer_count": 2,
"body": "文字列を区切りたいのですが、区切り文字列を含めたままリストなどに分割する方法を教えてください\n\n入力: `\"aaa,bbb,,\"` \n出力: `\"aaa,\"` と `\"bbb,\"` と `\",\"`",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T15:56:31.890",
"favorite_count": 0,
"id": "16549",
"last_activity_date": "2015-09-14T00:22:49.247",
"last_edit_date": "2015-09-13T10:04:32.897",
"last_editor_user_id": "8870",
"owner_user_id": "8870",
"post_type": "question",
"score": 1,
"tags": [
"c#",
"正規表現"
],
"title": "区切り文字列を含めたまま分割する方法",
"view_count": 6721
} | [
{
"body": "正規表現を使えば目的の文字列に分割できます\n\n```\n\n foreach (Match m in Regex.Matches(item, @\"((?!,).*?,?|(?!,).+)\"))\n {\n Debug.WriteLine(m.Value);\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T15:56:31.890",
"id": "16550",
"last_activity_date": "2015-09-13T10:05:41.833",
"last_edit_date": "2015-09-13T10:05:41.833",
"last_editor_user_id": "8870",
"owner_user_id": "8870",
"parent_id": "16549",
"post_type": "answer",
"score": 1
},
{
"body": "質問が`\\n`区切りから`,`区切りと別物に差し替えられたので全面的に修正しました。\n\n[String.Split()](https://msdn.microsoft.com/ja-\njp/library/system.string.split\\(v=vs.110\\).aspx)で機能が足りない場合は[Regex.Split()](https://msdn.microsoft.com/ja-\njp/library/system.text.regularexpressions.regex.split\\(v=vs.110\\).aspx)で分割できます。\n\n```\n\n Regex.Split(\"aaa,bbb,,\", \",\");\n // => \"aaa\", \"bbb\", \"\", \"\"\n \n```\n\n区切り文字を含めたい場合は正規表現をグループ化します。\n\n```\n\n Regex.Split(\"aaa,bbb,,\", \"([^,]*,)\");\n // => \"\", \"aaa\", \"\", \"bbb,\", \"\", \",\", \"\"\n \n```\n\nこれでは区切り文字に挟まれた部分が空文字列として挿入されてしまいますので、発想を変えます。正規表現で文字をマッチさせるのではなくゼロ幅アサーションで区切り位置だけを指定します。今回の場合、`,`の後ろ、つまりゼロ幅の正の後読みアサーションで`,`を探してやることです。\n\n```\n\n Regex.Split(\"aaa,bbb,,\", \"(?<=,)\");\n // => { \"aaa,\", \"bbb,\", \",\", \"\" }\n \n```\n\n`Split`で区切るという都合上、末尾にゴミとなる空文字列が付いてしまいましたが、これについてもゼロ幅の肯定先読みアサーションで回避できます。\n\n```\n\n var splitted = Regex.Split(\"aaa,bbb,,\", \"(?<=,)(?=.)\");\n // => { \"aaa,\", \"bbb,\", \",\" }\n \n```\n\n* * *\n\n区切り文字を含めたままという本題からは外れますが、[StringReader.ReadLine()](https://msdn.microsoft.com/ja-\njp/library/system.io.stringreader.readline\\(v=vs.110\\).aspx)を使って文字列を文字列に分割することもできます。(当初の質問文では`\\n`区切りでしたので`ReadLine`を紹介しましたが、`,`区切りには使えません。)",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T21:12:47.757",
"id": "16553",
"last_activity_date": "2015-09-13T21:31:46.457",
"last_edit_date": "2015-09-13T21:31:46.457",
"last_editor_user_id": "4236",
"owner_user_id": "4236",
"parent_id": "16549",
"post_type": "answer",
"score": 4
}
] | 16549 | 16553 | 16553 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "環境は \njava8 \nTomcat8 \nSpringMVC \nです。\n\nWEBアプリケーションを作成したさい、VIEWのスタイルシート、JavaScriptの相対パスがずれる対策についてです。\n\nコンテキストパスを、\"/\"にし、 \n[http://ドメイン/](http://%E3%83%89%E3%83%A1%E3%82%A4%E3%83%B3/) \nでTOPページにアクセスするようにしたいのですが、 \nserver.xmlにDocBaseを書かないと、\n\n```\n\n http://ドメイン/コンテキストパス/\n \n```\n\nにしないとつながらないと思います。 \nそのため、apacheのAJPプロキシをつかって、\n\n```\n\n http://ドメイン/\n \n```\n\nを\n\n```\n\n http://ドメイン:8080/コンテキストパス\n \n```\n\nに転送するようにしましたが、 \n取り込むjs, cssのパスが\n\n```\n\n http://ドメイン/js/~~~.js\n \n```\n\nとか、\n\n```\n\n http://ドメイン/css/~~~.css\n \n```\n\nになってしまい、うまく取り込めません。\n\nしぶしぶserver.xmlにDocBaseを追記し、 \nコンテキストパスを/にしました。 \nほかに稼働サーバーに依存しないいい設定方法はないのでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-12T22:42:31.467",
"favorite_count": 0,
"id": "16554",
"last_activity_date": "2015-12-13T16:35:08.957",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8396",
"post_type": "question",
"score": 5,
"tags": [
"java",
"apache",
"spring",
"tomcat"
],
"title": "AJPProxyを使用しコンテキストパスを/にすると、css/js等の相対パスがうまく読み込めない",
"view_count": 1947
} | [
{
"body": "Apacheのhttpd.confないしはproxy_ajpの設定にて\n\n```\n\n <IfModule proxy_ajp_module>\n <Location / >\n ProxyPass ajp://localhost:8009/warのコンテキストパス/\n </Location>\n </IfModule>\n \n```\n\nを記載すれば大丈夫かと存じます。 \nポイントはLocationがルートパス(/)→Tomcatのwarのコンテキストパスを指定しているところです。\n\nもちろん、Webアプリケーション側のcss/jsのパスの記述にコンテキストパスなど記載しているとマズいですが。\n\n参考になれば幸いです",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T13:50:47.570",
"id": "16602",
"last_activity_date": "2015-09-14T13:50:47.570",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5778",
"parent_id": "16554",
"post_type": "answer",
"score": 1
}
] | 16554 | null | 16602 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "AmazonウェブサービスのRDSに最近デビューしました。そこでMySQLを使用してみましたがどうにも外部キーを指定してあるテーブルに制約違反で挿入できません。バージョンも変えてみましたが変わりません。どなたかご存じありませんか?\n\nローカルでは問題なく動いているのと、それとは別に単純な外部制約を定義した挿入はRDSでも動くことを確認いますのでなにかRDS特有のものがあるのではと思い質問させていただきました。",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T06:09:18.690",
"favorite_count": 0,
"id": "16556",
"last_activity_date": "2015-09-15T11:26:48.743",
"last_edit_date": "2015-09-15T11:26:48.743",
"last_editor_user_id": "5008",
"owner_user_id": "12310",
"post_type": "question",
"score": -2,
"tags": [
"mysql",
"sql",
"aws"
],
"title": "AWSのRDSのMySQL",
"view_count": 600
} | [
{
"body": "ローカルは Windows か Mac OSX でしょうか。 \nもしそうであれば、RDS では 大文字小文字を区別するので SQLクエリを 実際のテーブル名と同じように変更してください。\n\n例えば `CREATE TABLE` で `MyTable` としてるのに SQLで `mytable` とした場合にエラーになります。\n\n別の回避方法としては RDS のパラメータグループから\n[`lower_case_table_names`](http://dev.mysql.com/doc/refman/5.6/ja/identifier-\ncase-sensitivity.html) の値を `1`\nに変更してください。ただし、[RDSのドキュメント](http://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.ParameterNotes.lower-\ncase-table-names)によるとDB インスタンスの作り直しが必要なようです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T11:24:57.290",
"id": "16641",
"last_activity_date": "2015-09-15T11:24:57.290",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5008",
"parent_id": "16556",
"post_type": "answer",
"score": 2
}
] | 16556 | null | 16641 |
{
"accepted_answer_id": "16560",
"answer_count": 1,
"body": "Google Maps JavaScript API でどのマーカーがクリックされたかに応じて処理を変更したいのですが,マーカーを識別することができません.\n\nソースは以下のように書いています.locations は JSON データで,location['id']\nには固有のIDと緯度経度が含まれていることは確認しました.markers はグローバル変数です.\n\n```\n\n for (var i = 0; i < locations.length; i++) {\n var location = locations[i];\n if (!markers[location['id']]) {\n var marker = new google.maps.Marker({\n position: {lat: location['lat'], lng: location['lng']},\n map: map,\n title: '\"' + location['name'] + '\"'\n });\n markers[location['id']] = marker;\n google.maps.event.addListener(marker, 'click', function(e) {\n console.log(location['id']);\n });\n }\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T06:47:35.737",
"favorite_count": 0,
"id": "16558",
"last_activity_date": "2015-09-13T07:53:57.370",
"last_edit_date": "2015-09-13T07:29:59.437",
"last_editor_user_id": "11142",
"owner_user_id": "11142",
"post_type": "question",
"score": 1,
"tags": [
"javascript",
"google-maps"
],
"title": "Google Maps JavaScript API でマーカーを識別できない",
"view_count": 604
} | [
{
"body": "自己解決しました.\n\n```\n\n var location = locations[i]\n \n```\n\n上記の箇所で参照になっていて,表示している location['id']\nも書き換わってしまっているということでした.for文内を別の関数にして実行したところうまくいきました.",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T07:53:57.370",
"id": "16560",
"last_activity_date": "2015-09-13T07:53:57.370",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "11142",
"parent_id": "16558",
"post_type": "answer",
"score": 1
}
] | 16558 | 16560 | 16560 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "CNNを使いたく思い、Caffeのインストールを試みました。 \n[こちらのサイト](http://qiita.com/t-hiroyoshi/items/3bba01dd11b1241f1336)を参考にし、記載されていることはひと通り行ったつもりですが、make\nall でエラーが発生してしまいます。 \nおそらくboostまわりのエラーだとは思うのですが、調べてもわからなかったため質問しました。 \nOS:mac OS X Yosemite 10.10.3 \nCPU: 3.1 GHz Intel Core i7 \nboost:1.55 \npython-boost:1.55 \n(依存ライブラリに関しては全てbrewでインストールしました) \n以下にエラーメッセージを記載します。 \n何か対処法をご存知のかたいましたらよろしくお願いします。\n\n```\n\n CXX .build_release/src/caffe/proto/caffe.pb.cc\n CXX src/caffe/common.cpp\n In file included from src/caffe/common.cpp:1:\n In file included from /usr/local/include/boost/thread.hpp:17:\n In file included from /usr/local/include/boost/thread/once.hpp:20:\n In file included from/usr/local/include/boost/thread/pthread/once_atomic.hpp:20:\n In file included from /usr/local/include/boost/atomic.hpp:12:\n In file included from /usr/local/include/boost/atomic/atomic.hpp:17:\n In file included from /usr/local/include/boost/atomic/detail/platform.hpp:22:\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:961:64: error: no matching constructor for initialization of 'storage_type' (aka 'boost::atomics::detail::storage128_type')\n explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)\n ^ ~\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const boost::atomics::detail::storage128_type' for 1st argument\n struct BOOST_ALIGNMENT(16) storage128_type\n ^\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:968:22: error: no viable conversion from 'int' to 'storage_type' (aka 'boost::atomics::detail::storage128_type')\n storage_type tmp = 0;\n ^ ~\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument\n struct BOOST_ALIGNMENT(16) storage128_type\n ^\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:983:22: error: no viable conversion from 'int' to 'storage_type' (aka 'boost::atomics::detail::storage128_type')\n storage_type tmp = 0;\n ^ ~\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument\n struct BOOST_ALIGNMENT(16) storage128_type\n ^\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:997:22: error: no viable conversion from 'int' to 'storage_type' (aka 'boost::atomics::detail::storage128_type')\n storage_type expected_s = 0, desired_s = 0;\n ^ ~\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument\n struct BOOST_ALIGNMENT(16) storage128_type\n ^\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:997:38: error: no viable conversion from 'int' to 'storage_type' (aka 'boost::atomics::detail::storage128_type')\n storage_type expected_s = 0, desired_s = 0;\n ^ ~\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument\n struct BOOST_ALIGNMENT(16) storage128_type\n ^\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:1013:22: error: no viable conversion from 'int' to 'storage_type' (aka 'boost::atomics::detail::storage128_type')\n storage_type expected_s = 0, desired_s = 0;\n ^ ~\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument\n struct BOOST_ALIGNMENT(16) storage128_type\n ^\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:1013:38: error: no viable conversion from 'int' to 'storage_type' (aka 'boost::atomics::detail::storage128_type')\n storage_type expected_s = 0, desired_s = 0;\n ^ ~\n /usr/local/include/boost/atomic/detail/gcc-atomic.hpp:932:28: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const boost::atomics::detail::storage128_type &' for 1st argument\n struct BOOST_ALIGNMENT(16) storage128_type\n ^\n 7 errors generated.\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T08:26:22.633",
"favorite_count": 0,
"id": "16561",
"last_activity_date": "2015-09-13T09:30:18.277",
"last_edit_date": "2015-09-13T09:30:18.277",
"last_editor_user_id": "3639",
"owner_user_id": "10694",
"post_type": "question",
"score": 1,
"tags": [
"c++",
"macos",
"boost"
],
"title": "deeplearningのフレームワークCaffeのビルドに関して",
"view_count": 274
} | [] | 16561 | null | null |
{
"accepted_answer_id": "16574",
"answer_count": 3,
"body": "(Stack Overflow metaの方でも質問させていただきました.以下は質問内容です.)\n\n拡張子が.7zのファイルの解凍し閲覧したいと考えています。 \n現在teratermを使っています。 \nたとえば展開したいファイルとしましてstack exchange data dumpの右側に表示されているdownload\noptionの7Zと表示されている中の.7zファイルです。 \nそれらの277ファイルをteratermに移行する方法、閲覧する方法を詳しく教えてください。\n\nstack exchange data dumpのURL↓ \n<https://archive.org/details/stackexchange>\n\n使用するデータ \n<https://archive.org/download/stackexchange>\n\n関連する質問 \n1.[Stack Exchange Data Explorer\nの使い方を教えてください](https://ja.meta.stackoverflow.com/questions/1953/stack-exchange-\ndata-\nexplorer-%E3%81%AE%E4%BD%BF%E3%81%84%E6%96%B9%E3%82%92%E6%95%99%E3%81%88%E3%81%A6%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84/1954#1954) \n2.[stack\noverflowの公開データについて利用法やデータ詳細やどのような形で提供されているか等を教えていただきたい(API以外の方法も希望する)](https://ja.meta.stackoverflow.com/questions/1947/stack-\noverflow%E3%81%AE%E5%85%AC%E9%96%8B%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E5%88%A9%E7%94%A8%E6%B3%95%E3%82%84%E3%83%87%E3%83%BC%E3%82%BF%E8%A9%B3%E7%B4%B0%E3%82%84%E3%81%A9%E3%81%AE%E3%82%88%E3%81%86%E3%81%AA%E5%BD%A2%E3%81%A7%E6%8F%90%E4%BE%9B%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B%E3%81%8B%E7%AD%89%E3%82%92%E6%95%99%E3%81%88%E3%81%A6%E3%81%84%E3%81%9F%E3%81%A0%E3%81%8D%E3%81%9F%E3%81%84-api%E4%BB%A5%E5%A4%96%E3%81%AE%E6%96%B9%E6%B3%95%E3%82%82%E5%B8%8C%E6%9C%9B%E3%81%99%E3%82%8B/1948?noredirect=1#comment1161_1948) \n3.[Stack Exchange Data Explorer\nの使い方を教えてください](https://ja.meta.stackoverflow.com/questions/1953/stack-exchange-\ndata-\nexplorer-%E3%81%AE%E4%BD%BF%E3%81%84%E6%96%B9%E3%82%92%E6%95%99%E3%81%88%E3%81%A6%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84/1954#1954)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T08:39:06.550",
"favorite_count": 0,
"id": "16562",
"last_activity_date": "2015-10-16T21:49:37.700",
"last_edit_date": "2017-03-16T14:42:13.233",
"last_editor_user_id": "-1",
"owner_user_id": "9505",
"post_type": "question",
"score": -2,
"tags": [
"linux",
"windows",
"xml"
],
"title": "teraterm(Linuxのコマンドライン)で.7zファイルを展開・閲覧・管理方法について教えてください。",
"view_count": 731
} | [
{
"body": "展開方法は[過去の質問](https://ja.meta.stackoverflow.com/questions/1958/)で回答があったようなので、ダウンロード方法の例のみ示します。 \nテスト目的であれば`--accept=japanese.stackexchange.com.7z`などで十分かもしれませんね。\n\n```\n\n wget --recursive --continue --no-parent --level=1 --accept=.7z https://archive.org/download/stackexchange\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T16:24:01.667",
"id": "16574",
"last_activity_date": "2015-09-13T16:24:01.667",
"last_edit_date": "2017-03-16T14:42:13.233",
"last_editor_user_id": "-1",
"owner_user_id": "3054",
"parent_id": "16562",
"post_type": "answer",
"score": 2
},
{
"body": "まずそもそも。 \nteraterm は、回線で繋がったPCへログインして操作するためのツールです。 \nですので、 teraterm へのデータの移行という表現はおかしく、(接続先の) linux へのデータの移行を意味しているのだと理解しました。\n\nまた同時に、そうだとするとやりたいことは linux 上に対象の .7z ファイルを配置することであると理解できます。だとすると、linux 上で web\nから直接取得した方が早いので、 mjy さんがその方法を説明しています。\n\nまた、.7z ファイルを展開する方法は、 mjy さんが示しているリンク先にあるコマンドを実行すれば、中身を展開できます。具体的には、`7z x\nname.7z`です。`7z`がインストールされてないことによるエラーが発生した場合は、`sudo apt-get install p7zip-full`\nを実行します。\n\nどうやら、xml ファイルが取得できるようですが、これをteraterm\nから閲覧するのであれば、端末上で動くテキストビューワー・エディターなどを用いてテキストファイルとして閲覧するのが常套だと思います。\n\nその目的では、`less`をお勧めします。`less TARGETFILE`で対象ファイルのテキストが表示されます。 \nスペースで進む、`b`で戻る、`q`で終了です。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T17:50:03.490",
"id": "16576",
"last_activity_date": "2015-09-13T18:18:20.697",
"last_edit_date": "2015-09-13T18:18:20.697",
"last_editor_user_id": "754",
"owner_user_id": "754",
"parent_id": "16562",
"post_type": "answer",
"score": 4
},
{
"body": "SSH限定ですが\n\n**ローカルPCからリモートホストにファイル転送する方法**\n\n 1. Teraterm でリモートホストにSSH で接続\n 2. ファイル → SSH SCP を選ぶ\n 3. `From:` にローカルPCのファイルパスを記述\n 4. `To:` にリモートホストの転送先パスを記述\n 5. `Send` ボタンを押す\n\nするとリモートホスト上にファイルがコピーされます。\n\n逆方向の場合は\n\n**リモートホストからローカルPCにファイル転送する方法**\n\n 1. Teraterm でリモートホストにSSH で接続\n 2. ファイル → SSH SCP を選ぶ\n 3. `From:` にリモートホストのファイルパスを記述\n 4. `To:` にローカルPCの保存先パスを記述\n 5. `Receive` ボタンを押す\n\n`From:` と `To:` が二箇所ずつあるのでボタンの位置で判断してください。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T12:57:47.020",
"id": "16649",
"last_activity_date": "2015-09-15T12:57:47.020",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5008",
"parent_id": "16562",
"post_type": "answer",
"score": 1
}
] | 16562 | 16574 | 16576 |
{
"accepted_answer_id": "16568",
"answer_count": 2,
"body": "文字列の部分置換を行いたいと思うのですが \n簡単な方法を教えてください。\n\n例えば\n\n`String data = \"かきくけこさしくせそあいくえお\";`\n\n最後の\"く\"を \"う\" に置換したい。 \n次は、\"く\" を \"す\" に置換したい。\n\n例では、規則性があるように見えますが、実際の \nデータは、置換する文字列の前後は、規則性がありませんので \n正規表現は、使用できません。\n\n以上",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T13:07:24.670",
"favorite_count": 0,
"id": "16564",
"last_activity_date": "2022-02-13T23:11:19.543",
"last_edit_date": "2022-02-13T23:11:19.543",
"last_editor_user_id": "4236",
"owner_user_id": "7505",
"post_type": "question",
"score": -7,
"tags": [
"c#",
".net",
"正規表現"
],
"title": "文字列の部分置換",
"view_count": 4389
} | [
{
"body": "> 最後の\"く\"を \"う\" に置換したい。 \n> 次は、\"く\" を \"す\" に置換したい。\n\nを文字通り実現すれば正規表現でも構わないでしょうか?\n\n```\n\n String data = \"かきくけこさしくせそあいくえお\";\n \n // 最後の\"く\"を \"う\" に置換したい。 => 「く」以降は末尾まで全て「く」以外\n data = Regex.Replace(data, \"く(?=[^く]+$)\", \"う\");\n \n // 次は、\"く\" を \"す\" に置換したい。 => 同上\n data = Regex.Replace(data, \"く(?=[^く]+$)\", \"す\");\n \n Console.WriteLine(data);\n // \"かきくけこさしすせそあいうえお\"\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T13:21:25.670",
"id": "16565",
"last_activity_date": "2015-09-13T13:21:25.670",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4236",
"parent_id": "16564",
"post_type": "answer",
"score": 7
},
{
"body": "通常、このような条件だとsayuriさんの例のように正規表現で処理するのが常道かと思います。\n\nが、どうしても、System.Text.RegularExpressions名前空間は親の仇で使えない等の理由があるのであれば、お手軽なメソッドは用意されていないと思われるので、String.LastIndexOf()と.Substring()を使ってちまちま切張りするのがおそらく一番ストレートなアプローチになるでしょう。\n\n```\n\n static void Main(string[] args)\n {\n var source = \"かきくけこさしくせそあいくえお\";\n var a1 = ReplaceLastMatch(source, \"く\", \"う\");\n var a2 = ReplaceLastMatch(a1, \"く\", \"す\");\n Console.WriteLine(a2);\n }\n \n private static string ReplaceLastMatch(string str, string target, string alternative)\n {\n var pos = str.LastIndexOf(target);\n if (pos >= 0)\n return str.Substring(0, pos) + alternative + str.Substring(pos + target.Length);\n return str;\n }\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T14:22:35.180",
"id": "16568",
"last_activity_date": "2015-09-13T14:22:35.180",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "2947",
"parent_id": "16564",
"post_type": "answer",
"score": 2
}
] | 16564 | 16568 | 16565 |
{
"accepted_answer_id": "16571",
"answer_count": 1,
"body": "環境 : \n\\- Playframework 2.4.2\n\n実現したい事:\n\n * マルチセレクトのチェックボックスを、Play 標準の helper のように定義したい。\n * 動作仕様として下記のように使いたい\n\n@myhelper.multipleCheckBox(c(\"multiSelect\"), Map(\"first\" -> \"1\", \"second\" ->\n\"2\", \"third\" -> \"3\"))\n\n作成したコード:\n\n```\n\n (field: play.api.data.Field, keyValues: Map[String, String])(implicit messages: play.api.i18n.Messages)\n @helper.input(field) { (id, name, value, htmlArgs) =>\n \n @{value.toString}\n @{value.getClass.toString}\n \n @defining(keyValues.toList.zipWithIndex){ results =>\n @for(kv_i <- results){\n <label class=\"checkbox-inline\">\n <input id=\"@{id}_@{kv_i._2}\" name=\"@{name}[@{kv_i._2}]\" type=\"checkbox\"\n value=\"@{kv_i._1._2}\" @if(value.exists(v => {keyValues.exists(_._2 == v)})){checked=\"true\"}> @kv_i._1._1\n </label>\n }\n }\n }\n \n```\n\n問題点:\n\n * バインドした際に、「selected」属性がつかない。\n\nval checkBoxes = Form(single(\"multiSelect\" -> list(longNumber))) \nval test = checkBoxes.bind(Map(\"multiSelect[0]\" -> \"2\")) \nprintln(test.value) // Some(List(2)) が表示 \nprintln(test(\"multiSelect\")) \n// 下記が出力(Form には value 値があるものの、Field にはない) \n// Field(Form(play.api.data.ObjectMapping1@58b5f405,Map(multiSelect[0] ->\n2),List(),Some(List(2))),multiSelect,List(),None,List(),None)\n\nしかし、この form を画面テンプレートに送っても、value 値は「None class scala.None$」の表示。\n\nそもそも target にバインドされた時の型が Option[List[String]] や、Option[List[Long]]\nのような気がしないでもないので、target に値が入っても上記コードで出ない気はしますが、そもそも target が None のままで困っています。 \nこれは自分のコード上のミスなのか、仕様なのかバグなのか…それすらわからない状況なので、知っている方是非ご教授下さい。\n\n尚、レンダリング時は、下記の様な html が吐かれていて、チェックした時にサーバでバインド→値の取得はできています。\n\n```\n\n <div class=\"col-sm-10\">\n None\n class scala.None$\n <label class=\"checkbox-inline\">\n <input id=\"multiSelect_0\" name=\"multiSelect[0]\" type=\"checkbox\" value=\"1\"> first\n </label>\n <label class=\"checkbox-inline\">\n <input id=\"multiSelect_1\" name=\"multiSelect[1]\" type=\"checkbox\" value=\"2\"> second\n </label>\n <label class=\"checkbox-inline\">\n <input id=\"multiSelect_2\" name=\"multiSelect[2]\" type=\"checkbox\" value=\"3\"> third\n </label>\n </div>\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T13:29:16.893",
"favorite_count": 0,
"id": "16566",
"last_activity_date": "2015-09-13T14:51:00.937",
"last_edit_date": "2015-09-13T14:28:27.997",
"last_editor_user_id": "380",
"owner_user_id": "380",
"post_type": "question",
"score": 1,
"tags": [
"scala",
"playframework"
],
"title": "Playframework2.4 の Form で list(number) をバインドした時のフィールドコンストラクタ挙動で、value 値が取得できない。",
"view_count": 882
} | [
{
"body": "[select.html.scala](https://github.com/playframework/playframework/blob/master/framework/src/play/src/main/scala/views/helper/select.scala.html\n\"select.scala.html\") の実装が参考になります。\n\nList 値を含む Field の場合、\n[Field#indexes](https://github.com/playframework/playframework/blob/master/framework/src/play/src/main/scala/views/helper/select.scala.html)\nで値が定義されているインデックス一覧を得ることができます。\n[Field#apply](https://www.playframework.com/documentation/2.4.x/api/scala/index.html#play.api.data.Field@apply\\(key:String\\):play.api.data.Field)\nを使うと相対的な指定で Field が取得できます。渡されてくる Field は、今回の場合 `\"multiSelect\"`\nのキーを含みますので、`\"[0]\"` などのインデックスを付与して、`\"multiSelect[0]\"` などの Field にアクセスします。値は\n`\"multiSelect[0]\"` などが持つため、これを比較対象として用います。\n\nまた Map は順序を保持しないため keyValues は `Seq[(String, String)]` などのほうがよいでしょう。\n\n次のような感じになると思います。\n\n```\n\n @(field: play.api.data.Field, keyValues: Seq[(String, String)])(implicit messages: play.api.i18n.Messages)\n @helper.input(field) { (id, name, value, htmlArgs) =>\n @defining(field.indexes.flatMap(i => field(s\"[$i]\").value).toSet) { values =>\n @keyValues.zipWithIndex.map { case ((k, v), idx) =>\n <label class=\"checkbox-inline\">\n <input id=\"@{id}_@{idx}\" name=\"@{name}[@{idx}]\" type=\"checkbox\"\n value=\"@{v}\" @if(values(idx.toString)){checked}> @k\n </label>\n }\n }\n }\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T14:51:00.937",
"id": "16571",
"last_activity_date": "2015-09-13T14:51:00.937",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "455",
"parent_id": "16566",
"post_type": "answer",
"score": 1
}
] | 16566 | 16571 | 16571 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "こんばんは。毎度お世話になっております。 \nXcode 7.0 beta 6とSwift 2を使用してiOS開発を行っている者です。\n\nXcode付属のGameテンプレートのOpenGL ESを使ったサンプルプロジェクト(青い立方体と赤い立方体が回るプログラム)が、 \niPhone 5以下(iOS 8.4)のシュミレータ上でうまく動作しない \n(実行はできるが描画がおかしくなる。特にランタイムエラーなどは起こっていない)のですが、 \n正常に動作させるにはどのような修正を施せば良いでしょうか\n\nちなみに、Objective-C版や、Swift版のiPhone 5s以上のシュミレータでは正常に動作することを確認しています。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T13:35:39.840",
"favorite_count": 0,
"id": "16567",
"last_activity_date": "2015-09-13T13:35:39.840",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12231",
"post_type": "question",
"score": 3,
"tags": [
"ios",
"swift",
"xcode",
"opengl",
"debugging"
],
"title": "Xcode 7.0 beta 6でSwift版のGameテンプレートプロジェクト(OpenGL ES)がiPhone5以下でうまく動かない",
"view_count": 190
} | [] | 16567 | null | null |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "MultipartEntityBuilderを用いてAndroidから画像のアップロードを行いたいと思い開発しております。\n\nそんな中NoClassDefFoundErrorが中々消えてくれません。 \njava.lang.NoClassDefFoundError:\norg.apache.http.entity.mime.MultipartEntityBuilder\n\n何かご存知の方がいらっしゃいましたら教えていただきたいです。\n\n以下自分で試したこと \n・libsファイルを作成し中に外部jarを追加(下の位置です) \nAplicationName \n-src \n-gen \n中略 \n-libs \n-res\n\n・外部jarのビルドパス構成\n\n使用している外部jar \n・httpcore-4.4.2.jar \n・httpmime-4.5.jar\n\n```\n\n public class HttpThread extends Thread{\n String muri = null;\n public HttpThread(String guri){\n muri = guri;\n }\n \n public void run() {\n /*▼▼▼BlobKey取得用▼▼▼*/\n String url = \"http://xxxx.appspot.com/bandroid\";\n String bkey = \"\";\n HttpClient httpClient = new DefaultHttpClient();\n HttpGet httpGet = new HttpGet(url);\n \n try {\n HttpResponse response = httpClient.execute(httpGet);\n HttpEntity entity = response.getEntity();\n bkey = EntityUtils.toString(entity);\n } catch (IOException e) {\n throw new RuntimeException(e);\n } finally {\n httpClient.getConnectionManager().shutdown();\n }\n /*▲▲▲ここまで▲▲▲*/\n \n /*▼▼▼GAEアクセス用▼▼▼*/\n try {\n httpClient = new DefaultHttpClient();\n if(bkey != null) {\n bkey = bkey.substring(0, bkey.length()-1);\n HttpPost httpPost = new HttpPost(bkey);\n ResponseHandler<String> responseHandler = new BasicResponseHandler();\n Log.v(\"test\", \"path=\" + muri);\n MultipartEntityBuilder builder = MultipartEntityBuilder.create();\n builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);\n \n File file = new File(muri);\n FileBody fileBody = new FileBody(file);\n \n builder.addPart(\"myFile\", fileBody);\n httpPost.setEntity(builder.build());\n httpClient.execute(httpPost, responseHandler);\n }\n } catch (ClientProtocolException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n /*▲▲▲ここまで▲▲▲*/\n }\n \n```\n\n}",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T14:49:29.010",
"favorite_count": 0,
"id": "16570",
"last_activity_date": "2015-09-13T14:49:29.010",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12246",
"post_type": "question",
"score": 1,
"tags": [
"android"
],
"title": "NoClassDefFoundErrorについて",
"view_count": 197
} | [] | 16570 | null | null |
{
"accepted_answer_id": "16575",
"answer_count": 1,
"body": "PowerShell3.0でtry-catchを含むスクリプトを実行するとエラーが発生します。Windows7では問題なく実行できました。 \n以下、実行環境情報です。\n\n・実行マシン\n\n```\n\n Windows Server 2008 R2\n \n```\n\n・PSバージョン \nPS C:\\ZabbixPowerShellScript> $PSVersionTable\n\n```\n\n Name Value\n ---- -----\n PSVersion 3.0\n \n```\n\n・スクリプト\n\n```\n\n Write-Host\n Write-Host 'Hello World!'\n Write-Host \"Good-bye World! `n\"\n try{}catch[Exception]{}\n \n```\n\n・結果\n\n```\n\n PS C:\\ZabbixPowerShellScript> .\\test.ps1\n At C:\\ZabbixPowerShellScript\\test.ps1:6 char:2\n + }\n + ~\n The Try statement is missing its Catch or Finally block.\n + CategoryInfo : ParserError: (:) [], ParseException\n + FullyQualifiedErrorId : MissingCatchOrFinally\n \n```\n\nよろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T15:42:34.163",
"favorite_count": 0,
"id": "16572",
"last_activity_date": "2015-09-13T17:11:30.257",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9577",
"post_type": "question",
"score": 1,
"tags": [
"windows",
"powershell"
],
"title": "Power Shellでtry-catchを使用するとエラー",
"view_count": 730
} | [
{
"body": "`catch` と `[Exception]` の間にはスペースが必要です。\n\n```\n\n try {} catch [Exception] {}\n \n```\n\nシンタックスエラーの類ですが、Powershell ISE を利用するとこの手の間違いを指摘してくれるので便利です。 \n[](https://i.stack.imgur.com/Qh7gI.png)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-13T17:11:30.257",
"id": "16575",
"last_activity_date": "2015-09-13T17:11:30.257",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10106",
"parent_id": "16572",
"post_type": "answer",
"score": 4
}
] | 16572 | 16575 | 16575 |
{
"accepted_answer_id": "16714",
"answer_count": 2,
"body": "ons-popover内にons-listを使用していくつかの機能を提供する、ドロップダウンメニューを作っています。 メニューの項目数が多いので、ons-\nscrollerでスクロールさせたいのですが、スクロールが機能せず、一部分のみしか表示されません。低い解像度の端末でも表示できるよう、スクロール機能を付けたいのですが、どのようにすればよいのでしょうか?\n\n```\n\n ons.bootstrap();\r\n ons.ready(function(){\r\n onReady();\r\n });\r\n \r\n function onReady(){\r\n ons.createPopover(\"PopOver.html\");\r\n }\r\n \r\n function PopOverShowBtn(Target){\r\n var options={\r\n animation : \"none\"\r\n };\r\n PopOver.show(Target,options);\r\n \r\n }\n```\n\n```\n\n <ons-navigator var=\"app_navi\">\r\n \r\n <ons-page id=\"TopPage\">\r\n <ons-button onclick=\"PopOverShowBtn(this);\">ポップオーバー表示</ons-button>\r\n </ons-page>\r\n </ons-navigator>\r\n \r\n <ons-template id=\"PopOver.html\">\r\n <ons-popover var=\"PopOver\" cancelable style='width:300px'>\r\n <ons-scroller style=\"width:100%;height:400px;\">\r\n <ons-list style=\"text-align:center\">\r\n <ons-list-item modifier='tappable'>項目1</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目2</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目3</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目4</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目5</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目6</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目7</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目8</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目9</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目10</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目11</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目12</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目13</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目14</ons-list-item>\r\n <ons-list-item modifier='tappable'>項目15</ons-list-item>\r\n \r\n </ons-list>\r\n </ons-scroller>\r\n </ons-popover>\r\n </ons-template>\n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T01:06:27.080",
"favorite_count": 0,
"id": "16578",
"last_activity_date": "2015-09-17T12:31:18.343",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "11105",
"post_type": "question",
"score": 2,
"tags": [
"monaca",
"onsen-ui"
],
"title": "ons-popover 内で ons-scrollerが使えない",
"view_count": 1258
} | [
{
"body": "質問に記載してあるコードで手元(プレビューとiOS版のデバッガ)ではスクロールが確認できましたが、それ以外の環境でのみ発生する事象でしょうか?\n\nもしかしたらファイル構成やコードの記載場所等が問題の改善に繋がるかもしれないので、こちらで動作確認したコードを下記に記載します。\n\nindex.html\n\n```\n\n <!DOCTYPE HTML>\n <html>\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\">\n <script src=\"components/loader.js\"></script>\n <link rel=\"stylesheet\" href=\"components/loader.css\">\n <link rel=\"stylesheet\" href=\"css/style.css\">\n <script src=\"js/popover.js\"></script>\n <script>\n ons.bootstrap();\n ons.ready(function(){\n onReady();\n });\n </script>\n </head>\n <body>\n <ons-navigator var=\"app_navi\">\n <ons-page id=\"TopPage\">\n <ons-button onclick=\"PopOverShowBtn(this);\">ポップオーバー表示</ons-button>\n </ons-page>\n </ons-navigator>\n </body>\n </html>\n \n```\n\npopover.js\n\n```\n\n function onReady(){\n ons.createPopover(\"PopOver.html\");\n }\n \n function PopOverShowBtn(Target){\n var options={\n animation : \"none\"\n };\n PopOver.show(Target,options);\n }\n \n```\n\nPopover.html\n\n```\n\n <ons-popover var=\"PopOver\" cancelable style='width:300px'>\n <ons-scroller style=\"width:100%; height:300px;\">\n <ons-list style=\"text-align:center\">\n <ons-list-item modifier='tappable'>項目1</ons-list-item>\n <ons-list-item modifier='tappable'>項目2</ons-list-item>\n <ons-list-item modifier='tappable'>項目3</ons-list-item>\n <ons-list-item modifier='tappable'>項目4</ons-list-item>\n <ons-list-item modifier='tappable'>項目5</ons-list-item>\n <ons-list-item modifier='tappable'>項目6</ons-list-item>\n <ons-list-item modifier='tappable'>項目7</ons-list-item>\n <ons-list-item modifier='tappable'>項目8</ons-list-item>\n <ons-list-item modifier='tappable'>項目9</ons-list-item>\n <ons-list-item modifier='tappable'>項目10</ons-list-item>\n <ons-list-item modifier='tappable'>項目11</ons-list-item>\n <ons-list-item modifier='tappable'>項目12</ons-list-item>\n <ons-list-item modifier='tappable'>項目13</ons-list-item>\n <ons-list-item modifier='tappable'>項目14</ons-list-item>\n <ons-list-item modifier='tappable'>項目15</ons-list-item>\n </ons-list>\n </ons-scroller>\n </ons-popover>\n \n```",
"comment_count": 8,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T02:25:32.887",
"id": "16579",
"last_activity_date": "2015-09-14T06:14:30.567",
"last_edit_date": "2015-09-14T06:14:30.567",
"last_editor_user_id": "3516",
"owner_user_id": "3516",
"parent_id": "16578",
"post_type": "answer",
"score": 0
},
{
"body": "自己解決できましたので、要点をまとめておきます。\n\n問題点(調査中に発見した問題点を含む) \n・Ons-Popover内のOns-Scrollerが機能しない。 \n・コンソール画面に「Onsen UI require jqLite. Load jQuery after loading AngularJS to fix\nthis error. jQuery may break Onsen UI\nbehavior.」と警告があった。(jQueryとOnsenUI(AngularJs)の併用、ロードの順番に関する警告)\n\n対処法 \n・loader.jsファイルの削除 \n・必要なJSコンポーネントの再インストール\n\nこれにより、loader.jsが再作成され、警告の解消、Scrollerも機能するようになりました。\n\n※loadr.jsの働きを良く理解していないため、削除によって及ぶ影響があるのかもしれません。乱暴な方法かもしれませんが、今のところ問題なく(ビルドも試しました)動作しています。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-17T12:31:18.343",
"id": "16714",
"last_activity_date": "2015-09-17T12:31:18.343",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "11105",
"parent_id": "16578",
"post_type": "answer",
"score": 2
}
] | 16578 | 16714 | 16714 |
{
"accepted_answer_id": "17641",
"answer_count": 4,
"body": "> `意見やディスカッションを求める質問`に該当する場合は、クローズ票を入れていただければ、直ちにクローズ致します。\n\n例えば、ユーザーの設定により通知のオン・オフを切り替えるシステムを考えます。\n\nデータベース設計として2通りを考えました。\n\n 1. ステータス列を作成して、オン・オフ表現する\n 2. レコードの有無で、オン・オフを表現する\n\n具体例として、ユーザー1は通知が有効、ユーザー2は通知が無効、を考えます。\n\n1の例\n\n```\n\n | user_id | enabled |\n |:-------:|:-------:|\n | 1 | true |\n | 2 | false |\n \n```\n\n2の例\n\n```\n\n | user_id |\n |:-------:|\n | 1 |\n \n```\n\n1の場合、メリットとして、下記が考えられます。\n\n * オフであるということが明確にわかります。\n * 通知をオフにした人は何人?などの集計も簡単です。\n\n一方で、デメリットは、量が多いことです。\n\n * データ量が多い (ユーザー数 x 通知の種類)\n\n2の場合、メリットとして、\n\n * データ量は少ないです。\n\nデメリットは、下記を考えました。\n\n * INSERT / DELETE で更新する(DELETEは遅い)\n * オフに対する集計ができない (全てからオンを引く、という状態)\n * オフに対する状態が保持できない (x日にオフになった等)\n\nとはいえ決定打となる要素がなく、現状は、ケースバイケースで対応してしまいます。\n\nデータベース設計に関するデファクトスタンダード、 \nまたは、書籍、積極的に発信をしいるウォッチ推奨のエンジニア、など \nご教授願えれば幸いです。\n\n# 参考にしたもの\n\n[データベース設計徹底指南](http://www.slideshare.net/nippondanji/db-engineerstudyanim)\n\n> ある物事に対する事実の集合\n\n「通知を受け取るユーザーの集合」だと考えれば、1? \n「ユーザーの通知設定」というデータの集合だと考えれば、2?\n\n[第1回 データベース設計とは:初めてのデータベース設計|gihyo.jp …\n技術評論社](http://gihyo.jp/dev/feature/01/database/0001)\n\n> 概念設計では,データベースによって管理の対象とするものを現実の世界から抽出して概念モデルを作成します。\n\n管理の対象は、ユーザーごとの通知設定。 \nレコードで管理するのか、行で管理するのかは、概念モデルの時点では判明しない?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T03:41:09.737",
"favorite_count": 0,
"id": "16580",
"last_activity_date": "2015-10-24T11:06:50.973",
"last_edit_date": "2015-09-14T05:14:45.040",
"last_editor_user_id": "10492",
"owner_user_id": "7471",
"post_type": "question",
"score": 10,
"tags": [
"database",
"データベース設計"
],
"title": "有効無効を表現するためのデータベース設計にデファクトスタンダードはありますか?",
"view_count": 2856
} | [
{
"body": "2.の場合のデメリットをもう少し追加しておきましょう。\n\n * ワーストケースでは1.とデータ量が変わらない\n * データ変更を繰り返した場合フラグメントを起こしやすい\n * user_idをキーにしてオフのデータを検索した場合は遅くなる\n\n1.の実装は「データ量が多い」以外にデメリットがないという点で優れています。逆に2.の実装は欠点が多く、ワーストケースでは1.と変わらないデータ量で1.よりも遅くなるリスクをはらんでいます。私なら迷わず1.の実装にするところです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-10-14T09:06:59.437",
"id": "17641",
"last_activity_date": "2015-10-14T09:06:59.437",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12774",
"parent_id": "16580",
"post_type": "answer",
"score": 4
},
{
"body": "私の場合は、 \nユーザー通知可否以外にもコードや名称などのユーザー情報があり、まだ設計段階であるのならば \n既存のユーザーマスタに通知可否フラグの列を追加して真偽値を登録します。 \nカットオーバー後に気軽にDBの列を加えられない状態であれば、 \nやむを得ずコンスタントマスタに \nフィールド:\"TUCHIOKFLG\"(=通知可フラグを意味するもの)、 \nキー:\"(ユーザーID)\" \nで登録してレコードの有無で判断します。 \nステータスが考え中であり既存のユーザーマスタがあるのであれば\"1\"かなぁと思います。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-10-14T10:17:40.043",
"id": "17646",
"last_activity_date": "2015-10-14T10:17:40.043",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12753",
"parent_id": "16580",
"post_type": "answer",
"score": 2
},
{
"body": "デフォクトスタンダードは無いでしょうね。\n\n書かれているように概念モデルに合わせて設計するべきとは思いますが、それがスタンダードとして確立していれば、メリットやデメリットで指摘されている事は判断基準にならないはずですが、実際のシステムの実装を考えると、速いとか重いとかは重要で軽視出来ませんので、実装重視の設計も「あり」だと思います。\n\n概念モデルでは判明しないかどうかですが「ユーザ一人ひとりが持つ属性」なのか「『ある特定のユーザ一覧』という属性」なのか等で判明するのではないでしょうか。\n\n例えば、ニコニコ動画のNGユーザという機能は後者のような気がします。(憶測です)\n\n例として書かれている、ユーザごとの設定項目の有効、無効の場合を考えますと、「設定項目が無効という状態」もシステムは保持するべきですので前者だと思います。\n\n後者の場合は、設定が無効である状態を保持しませんので、概念モデルを表して無いと思います。\n\n(回答になってるか自身がありませんが)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-10-14T14:58:54.267",
"id": "17654",
"last_activity_date": "2015-10-14T14:58:54.267",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5008",
"parent_id": "16580",
"post_type": "answer",
"score": 6
},
{
"body": "2の場合のデメリットとして、設定の種類が増えるたびに、 \nこのようなテーブルが増大してしまうことが考えられます。\n\n対して、1の場合は新たな設定項目に対する列を追加するだけで済みます。 \n増大するのがテーブルではなく列になるだけといってしまえばそれまでですが、 \nこの手の設定は一度に複数利用することも多いので、 \n1ユーザの設定を1レコードの問い合わせで取得できるこちらの方が性能上有利になります。\n\nまた、細かいテーブルが大量に増えると、リバースツールでER図を生成した際 \nごちゃごちゃするなど、設計情報を共有する観点からもいいことはありません。 \nとはいえ、USERテーブルに設定項目の列だらけになって名前や住所など、 \nより重要度の高いはずの列が埋もれてしまうのも、個人的にはあまり好きではありません。 \n私の場合は、USERテーブルと1:1対応するUSER_SETTINGSなどのテーブルを別途作ると思います。 \n(また、焦点がぼやけないよう、USER_SETTINGSの詳細は概念モデリング時には省略しておきます)\n\nデータベース設計の際には、起こりうる変更の可能性にどれだけ耐えられるかという \n観点からも設計検討されるとよいかと思います。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-10-24T11:06:50.973",
"id": "18019",
"last_activity_date": "2015-10-24T11:06:50.973",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12943",
"parent_id": "16580",
"post_type": "answer",
"score": 1
}
] | 16580 | 17641 | 17654 |
{
"accepted_answer_id": "16584",
"answer_count": 1,
"body": "/usr/lib 等にlibhage.soがあるとして\n\n```\n\n g++ libhoeg.cc -lhage -fPIC -shared -o libhoge.so\n \n```\n\nとして、とりあえずlibhoge.soは生成されます。\n\nしかしlddでみるかぎりlibhoge.soはlibhage.soをリンクしていませんでした。\n\nどのようにしてリンクすればよろしいでしょうか",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T04:29:15.107",
"favorite_count": 0,
"id": "16582",
"last_activity_date": "2015-11-13T07:34:07.497",
"last_edit_date": "2015-09-14T06:07:17.773",
"last_editor_user_id": "49",
"owner_user_id": "7844",
"post_type": "question",
"score": 2,
"tags": [
"c++",
"linux"
],
"title": ".soファイル生成時に他の.soファイルをリンクする方法",
"view_count": 1557
} | [
{
"body": "クラスを宣言・定義するだけで使用していないからでしょう。\n\n```\n\n #include <apt-pkg/init.h>\n #include <apt-pkg/cachefile.h>\n #include <apt-pkg/pkgcache.h>\n #include <apt-pkg/cacheiterators.h>\n class Init {\n public:\n static Configuration* getConfigration() { return _config; }\n static pkgSystem* getSysstem() { return _system; }\n };\n \n Configuration *func() { return Init::getConfigration(); }\n \n```\n\nこういうソースならリンクされます。\n\n```\n\n $ g++ -o libhoge.so -fPIC -shared libhoge.cc -lapt-pkg\n $ ldd libhoge.so\n linux-vdso.so.1 => (0x00007fff9f7a3000)\n libapt-pkg.so.4.12 => /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12 (0x00007f393e4cf000)\n libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f393e1c0000)\n libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f393ddf6000)\n libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f393dbf2000)\n libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f393d9d7000)\n libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f393d7c7000)\n liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f393d5a5000)\n libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f393d38f000)\n libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f393d087000)\n /lib64/ld-linux-x86-64.so.2 (0x00007f393ea37000)\n \n```",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T04:59:41.827",
"id": "16584",
"last_activity_date": "2015-09-14T04:59:41.827",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9873",
"parent_id": "16582",
"post_type": "answer",
"score": 0
}
] | 16582 | 16584 | 16584 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "チュートリアルで作ったようなブログに画像アップロード機能を実装しようとしています。 \n入力フォームに画像アップロードのフォームは作りました。 \nそれを次の確認画面で表示させたいのですが、なぜか表示されません(chromeなのですが絵文字のようなマークでしか出ません)。\n\n今考えている方法は、 \n■記事投稿画面のController \n1.postされたらsessionに記入 \n2.`$_file`の`tmp_name`を取得 \n3.`tempnam()`で`app/webroot`下のimgフォルダ内に一時ファイルを作成 \n4.`move_uploaded_file()`でアップロードした画像を、作成した一時ファイルに移す \n5.作成した一時ファイルのディレクトリをsessionに記入 \n■確認画面のController \n6.session から`$_file`のnameと一時ファイルのディレクトリを取得 \n7.`$this->set`してview画面で使えるようにする \n■確認画面のView \n8.`html->image`で取得\n\nこんな感じにすればできるのではないかと考えたのですが、 \n3のimg下にディレクトリを作ることがなぜかできません。/tmp下になって出てきてしまいます。 \n権限は777にしてありますが、ほかにどんな原因があるのでしょう。\n\nまたよりよい方法があれば教えていただきたいです。 \n(勉強を兼ねているのでpluginはできるだけ使わない方針で)\n\n追加:contorllerのソースはこんな感じです。\n\n```\n\n > public function add() {\n if ($this->request->is('post')) {\n $this->Post->set($this->request->data);\n if($this->Post->validates()){\n $this->request->data['Post']['user_id'] = $this->Auth->user('id');\n $this->Session->write('Session',$this->request->data);\n if(isset($this->request->data['Post']['image'])){\n $file_name = $this->request->data('Post.image.tmp_name');\n $tmpfile = tempnam(\"/var/www/html/share/cake/cakephp-2.6.7/app/webroot/img/tmp\",\"xxx\");\n $this->Session->write('Session.xxx',$tmpfile);\n if(move_uploaded_file($file_name,$tmpfile)){\n return $this->redirect(array('action'=>'confirm'));\n }else{ $this->Session->setFlash(__('ファイルをtmpに保存できませんでした。'));}\n }\n }\n }\n }\n \n public function confirm() {\n if ($this->Session->check('Session')) {\n $title = $this->Session->read('Session.Post.title');\n $body = $this->Session->read('Session.Post.body');\n //画像処理\n $file_name = $this->Session->read('Session.Post.image.name');\n if(isset($file_name)){\n //move_uploaded_file($file_name,$tmpfile);\n $image = $this->Session->read('Session.xxx');\n //mkdir($image,0777);\n $this->set('image',$image);\n }\n $this->set('title',$title);\n $this->set('body',$body);\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T06:11:02.843",
"favorite_count": 0,
"id": "16585",
"last_activity_date": "2015-09-18T01:26:22.023",
"last_edit_date": "2015-09-18T01:26:22.023",
"last_editor_user_id": "12316",
"owner_user_id": "12316",
"post_type": "question",
"score": 1,
"tags": [
"php",
"cakephp"
],
"title": "cakephp2でアップロードした画像の表示",
"view_count": 1622
} | [
{
"body": "該当箇所のソースがまったく提示されていないために憶測でしか書けませんが、手順3において `tempnam()` で一時ファイルを\n`app/webroot/img`\n配下に作成しようとしているときに、まだ存在しないディレクトリを指定していませんか。あるいは相対pathを指定していませんか。\n\ntempnam()\nは指定したディレクトリが存在しない場合や、あるいはディレクトリが存在しても書き込み権限がない場合は、代わりにシステムのテンポラリディレクトリにファイルを作成しに行きます。\n\n[PHP: tempnam - Manual](http://php.net/manual/ja/function.tempnam.php)\n\n> **説明** \n> 一意なテンポラリファイル名を、パーミッションを 0600 に設定し、 指定したディレクトリに作成します。\n> 指定したディレクトリが存在しない場合やディレクトリに書き込めない場合は、tempnam() はシステムのテンポラリディレクトリにあるファイル名を生成し、\n> そのファイルへのフルパスを (名前を含めて) 返します。\n\n`img` よりさらに深い階層に一時ファイルを置きたいのであれば、あらかじめその階層のディレクトリを作っておく必要があります。Cakeの場合は\n[Folder::create()](http://book.cakephp.org/2.0/ja/core-utility-libraries/file-\nfolder.html#Folder::create) を使うと便利でしょう。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T15:34:21.377",
"id": "16654",
"last_activity_date": "2015-09-15T15:34:21.377",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10492",
"parent_id": "16585",
"post_type": "answer",
"score": 1
}
] | 16585 | null | 16654 |
{
"accepted_answer_id": "16587",
"answer_count": 1,
"body": "cocos2d-xでiphone用のアプリを開発しているものです。 \n今回クロスプラットフォームに対応するため、端末の画面の大きさを取得し、 **表示する文字サイズと位置を取得** するメソッドを作成しました。 \nそのメソッドをメインプログラムから呼び出して、return fontsize position;としているのですが \nその値がそのままメインに返ってこないのです。\n\n例) \n**ヘッダ**\n\n```\n\n public int serifuSize(int fontsize,int position);\n \n```\n\n**メイン** \nmain.cpp\n\n```\n\n int fontsize;\n int position;\n \n this ->serifu(fontsize,position);\n \n```\n\n**serifメソッド**\n\n```\n\n int MainScene::serifu(int fontsize,int position){\n \n //ここで画面幅から端末の情報を受け取り、それを元にfontsizeとpositionを設定する処理(省略)\n \n return fontsize,position;\n }\n \n```\n\nとしており、serifu内ではきちんとした値が入っているのにもかかわらず、メインの方に処理が戻り、fontsize内の値とpositionの値を確認したところ、-1074098144こんな感じのデタラメな数字が入っています。\n\n引数のあるメソッドの呼び出し方を調べてみたところCC_CALLBACK_2というものがあり、それを使ってみたのですが\n\nthis -> CC_CALLBACK_2(MainScene::serifu, this);\n\nQualified member access refers to a member in namesepace 'std'\n\nというエラーが出ます。\n\n今一度目的だけを書き出すと、\n\n*int値(引数は2つ)をメソッドで取得 \n*取得したその値を呼び出し元のクラスで使いたい\n\nなのですが、上の内容でどのような問題があるでしょうか。\n\nお願いします。",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T06:15:26.343",
"favorite_count": 0,
"id": "16586",
"last_activity_date": "2015-09-14T07:56:21.277",
"last_edit_date": "2015-09-14T07:56:21.277",
"last_editor_user_id": "2383",
"owner_user_id": "10529",
"post_type": "question",
"score": 1,
"tags": [
"c++",
"cocos2d-x"
],
"title": "メソッドの返り値が変な値になる",
"view_count": 646
} | [
{
"body": "その書き方だと、どちらの変数も値は変化しません。試しに初期値を与えてみれば分かります。\n\n```\n\n int fontsize = 12345;\n int position = 67890;\n this ->serifu(fontsize,position);\n \n```\n\n正しい書き方ですが、とりあえず参照渡しで書いてみます。\n\n```\n\n void MainScene::serifu(int& fontsize, int& position)\n {\n /*\n いろいろ求める\n */\n fontsize = (求めたフォントサイズ);\n position = (求めたポジション);\n return;\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T06:49:56.233",
"id": "16587",
"last_activity_date": "2015-09-14T06:49:56.233",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10966",
"parent_id": "16586",
"post_type": "answer",
"score": 2
}
] | 16586 | 16587 | 16587 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "全くのMonaca初心者です。初歩的な質問で申し訳ありません。 \nアプリから外部HPを表示させた後,アプリに戻りたいのですが,下記のコマンドでDebuggerではスマホの戻るボタンで戻るのですが,ビルドするとアプリに戻れません。 \n戻れるようにするにはどうすればよいかどなたかアドバイスをお願いします。 \nonclick=\"window.open('URL', '_blank') \nあるいは, \nonclick=\"window.open('URL', '_system')",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T08:26:07.107",
"favorite_count": 0,
"id": "16589",
"last_activity_date": "2015-09-14T10:10:44.453",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12319",
"post_type": "question",
"score": 0,
"tags": [
"monaca"
],
"title": "外部HPへのリンク",
"view_count": 759
} | [
{
"body": "Monacaで「ファイル」→「Cordovaプラグインの管理」を選択して、InAppBrowserプラグインを有効にして試してみてください。\n\nまた、過去の質問にも似たような内容があるので、参考にして試すことも解決策の一つだと思います。\n\n[onsenでボタンを押したら外部リンクに飛ぶようにしたいのですが](https://ja.stackoverflow.com/questions/11106/onsen%E3%81%A7%E3%83%9C%E3%82%BF%E3%83%B3%E3%82%92%E6%8A%BC%E3%81%97%E3%81%9F%E3%82%89%E5%A4%96%E9%83%A8%E3%83%AA%E3%83%B3%E3%82%AF%E3%81%AB%E9%A3%9B%E3%81%B6%E3%82%88%E3%81%86%E3%81%AB%E3%81%97%E3%81%9F%E3%81%84%E3%81%AE%E3%81%A7%E3%81%99%E3%81%8C/11151#11151)\n\n[monacaデバッガーでは正常に見えるのに実機にインストールすると外部リンクが正常に表示されない](https://ja.stackoverflow.com/questions/6966/monaca%E3%83%87%E3%83%90%E3%83%83%E3%82%AC%E3%83%BC%E3%81%A7%E3%81%AF%E6%AD%A3%E5%B8%B8%E3%81%AB%E8%A6%8B%E3%81%88%E3%82%8B%E3%81%AE%E3%81%AB%E5%AE%9F%E6%A9%9F%E3%81%AB%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E3%81%A8%E5%A4%96%E9%83%A8%E3%83%AA%E3%83%B3%E3%82%AF%E3%81%8C%E6%AD%A3%E5%B8%B8%E3%81%AB%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%81%AA%E3%81%84/8065#8065)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T10:10:44.453",
"id": "16593",
"last_activity_date": "2015-09-14T10:10:44.453",
"last_edit_date": "2017-04-13T12:52:39.113",
"last_editor_user_id": "-1",
"owner_user_id": "9566",
"parent_id": "16589",
"post_type": "answer",
"score": 0
}
] | 16589 | null | 16593 |
{
"accepted_answer_id": "16642",
"answer_count": 1,
"body": "UIWebView上でYoutubeを再生する際に、イヤホンを使用しない場合でも端末本体から音声が出力されるようにしたいのですが、実現可能なプロパティなどありますでしょうか?\n\nWebViewのmediaPlaybackRequireUserActionはNOにしています。\n\n以下のようにJavascriptで再生する方法も試してみる予定です。 \n<http://qiita.com/babukuma/items/bc6ba19e814d8bb6ca91>\n\nその他にシンプルな実装方法でイヤホン使用時、未使用時ともに音声が出力される方法がありましたら教えていただきたく思います。\n\nよろしくお願いいたします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T09:53:39.433",
"favorite_count": 0,
"id": "16591",
"last_activity_date": "2015-09-15T11:35:15.740",
"last_edit_date": "2015-09-14T15:17:22.977",
"last_editor_user_id": "76",
"owner_user_id": "8682",
"post_type": "question",
"score": 1,
"tags": [
"ios",
"objective-c",
"iphone"
],
"title": "UIWebView上でYoutubeを再生する際の音声について",
"view_count": 795
} | [
{
"body": "Youtubeの再生と本体スピーカー/イヤホンの音の出力先を変更する実装です。\n\nAVAudioSessionのoverrideOutputAudioPortメソッドで値設定することで制御しています。\n\nAVAudioSessionPortOverrideSpeakerを設定すると本体スピーカーからの出力となります。\n\nリファレンスは以下です。\n\n[AVAudioSession Class\nReference](https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/)\n\n```\n\n #import \"ViewController.h\"\n #import <AVFoundation/AVFoundation.h>\n #import <AudioToolbox/AudioServices.h>\n \n @interface ViewController ()\n \n @property (nonatomic, strong) UIWebView *webView;\n @property (nonatomic, strong) UIButton *loadBtn;\n @property (nonatomic, strong) UISwitch *portSwitch;\n \n @end\n \n @implementation ViewController\n \n - (void)viewDidLoad\n {\n [super viewDidLoad];\n \n AVAudioSession *audioSession = [AVAudioSession sharedInstance];\n [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];\n [audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];\n [audioSession setActive:YES error:nil];\n \n self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];\n [self.view addSubview:self.webView];\n \n self.loadBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];\n self.loadBtn.frame = CGRectMake(40, 400, 80, 32);\n [self.loadBtn setTitle:@\"load\" forState:UIControlStateNormal];\n [self.loadBtn addTarget:self action:@selector(loadBtn_action:) forControlEvents:UIControlEventTouchUpInside];\n [self.view addSubview:self.loadBtn];\n \n self.portSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(200, 400, 120, 32)];\n [self.portSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];\n [self.view addSubview:self.portSwitch];\n }\n \n - (void)loadBtn_action:(UIButton *)sender\n {\n NSURL *url = [NSURL URLWithString:@\"https://www.youtube.com/watch?v=NB_gAf4wP-I\"];\n NSURLRequest *request = [NSURLRequest requestWithURL:url];\n [self.webView loadRequest:request];\n }\n \n - (void)switchValueChanged:(UISwitch *)sender\n {\n AVAudioSession *audioSession = [AVAudioSession sharedInstance];\n \n if (sender.on) {\n [audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:nil];\n }\n else {\n [audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];\n }\n }\n \n @end\n \n```\n\nXcode6.4で作成。\n\n「Single View Application」で新Projectを作りViewController.mに上記を記述。 \nアプリ起動後、loadボタンでYoutube動画を読み込み再生してみてください。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T11:35:15.740",
"id": "16642",
"last_activity_date": "2015-09-15T11:35:15.740",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "11109",
"parent_id": "16591",
"post_type": "answer",
"score": 0
}
] | 16591 | 16642 | 16642 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "Visual Studio 2015 Community\nEditionのMFCでwin32ダイアログベースアプリを作成していて、release版でのddx_textの不可解な挙動に困っています。Debug版では正常に見えます。 \n以下、double変数を表示するエディットボックス3個と更新用ボタン1個をもつアプリをbugcheck.exeとして、挙動を説明します。\n\nアプリ起動直後、エディットボックスにはdouble変数f1, f2, f3の初期値が表示されます(f3は0)。 \nf2のエディットボックスに0を入力するとその表示は0になります。 \nしかしその後ボタンを押してダイアログをUpdateData(false)すると、f2とf3の表示値が5になります。(入れた場所と数字で若干バリエーションあり) \nどうやらDDX_Text(pDX, IDC_EDIT1,\nm_f1)等の第三パラメーターに0を入れると結果がおかしくなる場合があるのではないかと辺りを付けましたが、0を使わない訳には行かないので、困っています。\n\n以下bugcheckについて、自動生成部分からの差分相当のコードを示します。\n\n\\--bugcheckDlg.h--\n\n```\n\n class CbugcheckDlg : public CDialogEx\n {\n 略\n public:\n double m_f1;\n double m_f2;\n double m_f3; // Read only\n afx_msg void OnBnClickedButton1(); //Update controls\n afx_msg void OnEnChangeEdit1();\n afx_msg void OnEnChangeEdit2();\n \n }\n \n```\n\n\\--bugcheckDlg.cpp--\n\n```\n\n CbugcheckDlg::CbugcheckDlg(CWnd* pParent /*=NULL*/)\n : CDialogEx(IDD_BUGCHECK_DIALOG, pParent)\n , m_f1(1.5)\n , m_f2(0.1)\n , m_f3(0.0)\n {\n m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);\n }\n \n void CbugcheckDlg::DoDataExchange(CDataExchange* pDX)\n {\n CDialogEx::DoDataExchange(pDX);\n DDX_Text(pDX, IDC_EDIT1, m_f1);\n DDX_Text(pDX, IDC_EDIT2, m_f2);\n DDX_Text(pDX, IDC_EDIT3, m_f3);\n }\n \n BEGIN_MESSAGE_MAP(CbugcheckDlg, CDialogEx)\n ON_WM_PAINT()\n ON_WM_QUERYDRAGICON()\n ON_BN_CLICKED(IDC_BUTTON1, &CbugcheckDlg::OnBnClickedButton1)\n ON_EN_CHANGE(IDC_EDIT1, &CbugcheckDlg::OnEnChangeEdit1)\n ON_EN_CHANGE(IDC_EDIT2, &CbugcheckDlg::OnEnChangeEdit2)\n END_MESSAGE_MAP()\n \n void CbugcheckDlg::OnBnClickedButton1()\n {\n UpdateData(false);\n }\n \n void CbugcheckDlg::OnEnChangeEdit1()\n {\n UpdateData(true);\n }\n \n void CbugcheckDlg::OnEnChangeEdit2()\n {\n UpdateData(true);\n }\n \n```\n\n\\--resource.h--\n\n```\n\n #define IDC_EDIT1 1000\n #define IDC_BUTTON1 1001\n #define IDC_EDIT2 1002\n #define IDC_EDIT3 1003\n \n```\n\n\\--bugcheck.rc--\n\n```\n\n IDD_BUGCHECK_DIALOG DIALOGEX 0, 0, 202, 129\n STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION\n EXSTYLE WS_EX_APPWINDOW\n CAPTION \"bugcheck\"\n FONT 9, \"MS UI Gothic\", 0, 0, 0x1\n BEGIN\n DEFPUSHBUTTON \"OK\",IDOK,67,91,50,14\n PUSHBUTTON \"キャンセル\",IDCANCEL,121,91,50,14\n EDITTEXT IDC_EDIT1,44,31,40,14,ES_AUTOHSCROLL\n PUSHBUTTON \"UpdateData(false)\",IDC_BUTTON1,99,33,63,14\n EDITTEXT IDC_EDIT2,44,52,40,14,ES_AUTOHSCROLL\n EDITTEXT IDC_EDIT3,44,71,40,14,ES_AUTOHSCROLL | ES_READONLY\n LTEXT \"f1\",IDC_STATIC,28,34,8,8\n LTEXT \"f2\",IDC_STATIC,29,55,8,8\n LTEXT \"f3\",IDC_STATIC,30,75,8,8\n END\n \n```\n\n\\--ソースはここまで--",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T09:55:20.067",
"favorite_count": 0,
"id": "16592",
"last_activity_date": "2015-10-30T21:32:17.833",
"last_edit_date": "2015-09-14T11:35:04.083",
"last_editor_user_id": "2383",
"owner_user_id": "12321",
"post_type": "question",
"score": 13,
"tags": [
"c++",
"visual-studio",
"mfc"
],
"title": "VC2015で、double変数ddx_textのトラブル",
"view_count": 3057
} | [
{
"body": "`DDX_Text(...,\ndouble&)`→`AfxTextFloatFormat()`で呼んでいる`_sntscanf_s()`の動作がおかしいようです。 \nMFCでなくても以下のWin32コンソールアプリケーションで再現します。\n\n```\n\n #include <stdio.h>\n #include <stdlib.h>\n #include <tchar.h>\n \n int main()\n {\n const int TEXT_BUFFER_SIZE = 400;\n TCHAR szBuffer[TEXT_BUFFER_SIZE] = _T(\"2.3\");\n double d;\n if (_sntscanf_s(szBuffer, _countof(szBuffer), _T(\"%lf\"), &d) != 1) {\n return 1;\n }\n else {\n _tprintf_s(_T(\"%f\\n\"), d);\n }\n _tcscpy_s(szBuffer, _T(\"0\"));\n if (_sntscanf_s(szBuffer, _countof(szBuffer), _T(\"%lf\"), &d) != 1) {\n return 1;\n }\n else {\n _tprintf_s(_T(\"%f\\n\"), d);\n }\n return 0;\n }\n \n```\n\nDebugビルドでは、\n\n```\n\n 2.300000\n 0.000000\n \n```\n\nと正常に表示されますが、Releaseビルドでは\n\n```\n\n 2.300000\n 3.000000\n \n```\n\nと表示されます。\n\n`DDX_Text(...,\nCString&)`で取り出して、自分で`stringstream`等で`double`へ変換するぐらいしか、回避方法は浮かびません。",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T08:03:08.643",
"id": "16629",
"last_activity_date": "2015-09-15T08:03:08.643",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7291",
"parent_id": "16592",
"post_type": "answer",
"score": 11
},
{
"body": "alphaさんの説明を読んでもう少し調べました。\n\n```\n\n char buffer[] = { '0', '\\0', '1', '2', '3', '\\0' };\n double d;\n snscanf(buffer, std::size(buffer), \"%lf\", &d);\n \n```\n\nとやると`\"0\\0\"`を通り越して`\"123\"`をパースしてしまうようです。 \nこの問題が発生するのは`scanf()`系の中でもバッファーサイズを指定するsnバージョンのようです。バッファーサイズを指定しない`sscanf()`などでは`\"0\\0\"`で停止するため発生しませんでした。\n\n`DDX_Text()`がテンプレート関数やインライン関数であれば`snscanf()`などを再定義する回避策もありましたがそうもいかないようで、`DDX_Text()`を直接再定義するくらいしか手はなさそうです。\n\n* * *\n\n[bug in\n_sntscanf_s](https://connect.microsoft.com/VisualStudio/feedback/details/1773279/bug-\nin-sntscanf-s)にてバグ報告がなされており、Windows 10 Build\n10576で修正されていることを確認しました。(Windowsに含まれているDLLを使用する必要があるためMulti-threaded\nDLLでリリースビルドを行う必要があります。デバッグビルドではVS付属のDLLを使ってしまいます。) \n今後、Windows UpdateでDLLの更新、VS2015 Update1等でDebug DLLやソースコードの更新が行われるものと思われます。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-16T12:24:49.960",
"id": "16697",
"last_activity_date": "2015-10-30T21:32:17.833",
"last_edit_date": "2015-10-30T21:32:17.833",
"last_editor_user_id": "4236",
"owner_user_id": "4236",
"parent_id": "16592",
"post_type": "answer",
"score": 6
}
] | 16592 | null | 16629 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "Pythonを勉強中なのですが、メタクラスという概念が出てきました。 \nメソッドの動作を変更するという認識であっておりますでしょうか。 \nそうであれば、継承との違いを教えて頂ければ幸いです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T10:22:33.837",
"favorite_count": 0,
"id": "16594",
"last_activity_date": "2015-09-14T14:41:38.650",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7918",
"post_type": "question",
"score": 4,
"tags": [
"python"
],
"title": "メタクラスと継承の違いについて教えてください",
"view_count": 1001
} | [
{
"body": "`__new__`の動作を置き換えるものではないでしょうか?\n\n>\n> objectを継承した新スタイルクラスに`__metaclass__`というアトリビュートが設定されていると,クラスは特別な動きをします。クラス生成時に,`__metaclass__`のアトリビュートに設定されたクラスを起動し,`__new__()`メソッドを呼び出すのです。\n\n<http://coreblog.org/ats/lerning-metaclass-by-reading-javascript-like-\nprototype-in-python/>\n\nさらに、\n\n>\n> `type.__new__()`で作ってクラスアトリビュートを割り当てられたクラスは,`Prototype`クラス,およびそのサブクラスの実体として機能します。\n\nとあり、`__metaclass__`を使うことにより、上記ページの例では同じ`TestClass`から作られたインスタンスは同じPrototypeを共有できているのだと思います。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T11:59:20.790",
"id": "16598",
"last_activity_date": "2015-09-14T11:59:20.790",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5246",
"parent_id": "16594",
"post_type": "answer",
"score": 1
},
{
"body": "メタクラスは、クラスの雛形です。 \nクラスは、インスタンスの雛形です。\n\nクラスの実装が違えばインスタンスの挙動は変わります。 \nクラスを継承して異なる実装を与えた場合、その継承クラスのインスタンスは、継承元クラスのインスタンスと事なる挙動になります。\n\nクラスの元になるメタクラスとして、標準では type が使われます。 \ntypeがクラスの挙動を決めています。 \n一般的なクラスの挙動とは、クラス実装によってメソッドを定義できたり、インスタンス化する毎に異なるメモリを割り当てられる、とったものです。\n\nメタクラスとしてtype以外を指定した場合、「一般的なクラスの挙動」ではない動作を行わせることができます。インスタンス化をなんどしても同じメモリをもつインスタンスを生成したり、クラスにメソッド定義をしてもメソッドを見えなくしたり、あるいは、メソッドや属性値の定義順に意味を持たせたり、などです。\n\n * クラス継承は、継承元の一部の実装を変更するために行います\n * メタクラスの変更は、Pythonにおけるクラス定義の解釈そのものを変更するために行います",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T14:41:38.650",
"id": "16605",
"last_activity_date": "2015-09-14T14:41:38.650",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "806",
"parent_id": "16594",
"post_type": "answer",
"score": 7
}
] | 16594 | null | 16605 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "MVCをベースに現在後述のようにクラス分けを行っていて、 \n最後の`その他Fragment関連のもの`にあるクラスをどうすべきか悩んでいます。\n\n主に`1画面1Fragment1カスタムViewGroup[1DataLoader1Data]`という感じで設計してきました。 \n`カスタムViewGroup`を作成したのはviewに当たるクラスを自分でnewしたくなかったというのと、 \nこうすることによってそのクラスにFragmentからrootViewを渡す必要がなくなるからです。 \nそんなFragmentは、主に`DataLoader系`や`Setting系`の生成をしているだけです。\n\n分類に悩んでいるクラス群はそんな`カスタムViewGroup`や画面の設定等を定義したクラス群です。 \n`HeaderViewCreator`も`カスタムViewGroup`にしてCreatorを取るつもりでしたが、 \ncontrollerにやらせるべきだろう記述があるのでそのままになっています。 \n他にも`PagerView`や`PhotoListView`などにもcontrollerにやらせるべきだろう記述が \n混ざっていたりします。 \nまた、`Setting系`はカスタムViewにすべきでない?したとしても名前どうする? \nという感じでそのままになっています。 \nまた、`LoginFragment`や`DialogFragment系`については分離することに意味があるのかわからず \nそのままになっています。\n\n少なくとも厳密にMVCでなくても`その他Fragment関連のもの`にあるクラスを自分で納得できる形で \n必要に応じて中身を整理するなどして1つのパッケージもしくは複数のパッケージに分類できたらと考えているのですが、どうすれば良いかがわかりません。\n\n`View系`はcontrollerが混ざっていたとしてもview_controllerとしてまとめればいい \nと考えていますが、他の`Setting系`はどうする?そもそも`SettingPhoto`はいらないのでは? \nという感じです。\n\nそもそもの設計に良くない部分があるかもしれませんが、 \nどうかどなたかアドバイス等よろしくお願い致します。\n\n```\n\n ルート\n ├── MainActivity ----------------------- UserEventによる画面遷移等を定義\n ├── base ------------------------------- ベースクラス用\n │ ├── BaseDialogFragment ------------- DialogFragmentのベースクラス\n │ ├── BaseFragment ------------------- Fragmentのベースクラス\n │ └── BindableAdapter ---------------- Adapterのベースクラス\n ├── fragment --------------------------- FragmentやDialogFragment用\n │ ├── HeaderFragment ----------------- ヘッダーを含む画面のベースクラス\n │ ├── LoginFragment ------------------ ログイン画面\n │ ├── PhotoFragment ------------------ 写真拡大画面\n │ ├── PhotoListFragment -------------- 写真一覧画面\n │ ├── PriceListFragment -------------- 価格表画面\n │ ├── WebViewFragment ---------------- WebView画面\n │ └── dialog ------------------------- DialogFragment用\n │ ├── ConfirmDialogFragment ------ 確認ダイアログ\n │ └── MessageDialogFragment ------ 表示ダイアログ\n ├── model------------------------------- モデル用\n │ ├── Api ---------------------------- APIを叩くのに使用\n │ ├── AppController ------------------ Application Volleyの管理\n │ ├── PagerData ---------------------- ページャ表示に必要なデータを保持\n │ ├── PagerDataLoader ---------------- ページャ表示に必要なデータをロード\n │ ├── PhotoDownloader ----- ---------- 写真をSDにダウンロード\n │ ├── PhotoItem ---------------------- 写真一覧の1アイテムのデータを保持\n │ ├── PhotoListData ------------------ 写真一覧表示に必要なデータを保持\n │ ├── PhotoListDataLoader ------------ 写真一覧表示に必要なデータをロード\n │ ├── PriceItem ---------------------- 価格表の1アイテムのデータを保持\n │ ├── PriceListData ------------------ 価格表表示に必要なデータを保持\n │ ├── PriceListDataLoader ------------ 価格表表示に必要なデータをロード\n │ ├── User --------------------------- ログイン・ログアウト処理を定義 状態を保持\n │ ├── UserEvent ---------------------- ユーザーイベント(○○画面へ行くなど)\n │ └── Watermark ---------------------- PhotoView系のBitmapに透かしをつける\n ├── utility ---------------------------- ユーティリティー用\n │ ├── Animation ---------------------- 画面遷移時に使うアニメーションを定義\n │ └── UrlUtility --------------------- URLに関するユーティリティーメソッドを定義\n ├── view ------------------------------- カスタムViewやAdapter用\n │ ├── CategoryView ------------------- カテゴリ名用のカスタムTextView\n │ ├── PhotoView ---------------------- 写真用のカスタムImageView\n │ ├── ScalingPhotoView --------------- 写真拡大用のカスタムPhotoView\n │ └── adapter ------------------------ Adapter用\n │ ├── PhotoListAdapter ----------- 写真一覧用カスタムBindableAdapter\n │ └── PriceListAdapter ----------- 価格表用カスタムBindableAdapter\n └── その他Fragment関連のもの ------------------------ 以下を一括りにするか、もしくは-\n ├── HeaderViewCreator -------------- ヘッダーの設定と挙動の定義\n ├── PagerView ---------------------- 写真一覧のページャ用カスタムFrameLayout\n ├── PhotoItemView ------------------ 写真一覧の1アイテム用カスタLinearLayout\n ├── PhotoListView ------------------ PhotoListFragmentのカスタムLinerLayout\n ├── PriceListView ------------------ PriceListFragmentのカスタムLinerLayout\n ├── SettingPhoto ------------------- ScalingPhotoViewにロードを頼むだけ\n └── SettingWebView ----------------- WebViewの設定とURLによる挙動を定義\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T10:34:01.273",
"favorite_count": 0,
"id": "16595",
"last_activity_date": "2016-11-04T10:27:08.017",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9710",
"post_type": "question",
"score": 1,
"tags": [
"android",
"mvc"
],
"title": "パッケージの分類に悩んでいるクラス群があるのですが",
"view_count": 175
} | [
{
"body": "MVCに関しては様々なご意見がありますのでご参考まで。\n\n今のところ私は以下のように分類しています。\n\n * Controller \n * 処理のエントリーポイント (onCreate, onClick など)\n * UI操作などのイベントを受けて Model に処理を指示する\n * Activity, Fragment などが主に該当する\n * 設計次第では BroadcastReceiver や Service が該当する場合もある\n * View \n * View を継承したクラス (カスタム View)\n * ModelViewAdapter \n * ArrayAdapter など、 Model と View の橋渡し役\n * Model \n * Controller にも View にも属さないものすべて\n * Model が更新されたら View などに通知して更新する",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2016-11-04T10:27:08.017",
"id": "30099",
"last_activity_date": "2016-11-04T10:27:08.017",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "19425",
"parent_id": "16595",
"post_type": "answer",
"score": 1
}
] | 16595 | null | 30099 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "`gem 'activerecord-import'` \n`gem 'paperclip'` \nを使用してattachmentカラムを含むテーブルをbulk updateしようとしていますが、 \n`Missing column for value <photo>` \nとなってしまいます。 \nattachmentカラムをbulk updateすることは不可能なのでしょうか?\n\n\\-- 追記 -- \npaperclipのモデル\n\n```\n\n include Paperclipable\n has_attached_file :photo, {\n styles: {\n w_100px: [\"100x100>\", :jpg],\n },\n default_url: 'http://dummyimage.com/100x100/eee/eee'\n }.merge(PAPERCLIP_STORAGE_OPTIONS)\n validates_attachment_content_type :photo, content_type: /\\Aimage\\/.*\\Z/\n \n```\n\nコントローラー\n\n```\n\n spot_update_values = []\n params.require(:spots).map do |i, spot|\n spot_update_values << [ spot[:id].to_i, spot[:name], spot[:content], photo, article_content_id ]\n end\n Spot.import [ :id, :name_ja, :content_ja, :photo, :article_content_id ], spot_update_values, on_duplicate_key_update: [ :name_ja, :content_ja, :photo, :article_content_id ]\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T11:14:56.587",
"favorite_count": 0,
"id": "16596",
"last_activity_date": "2016-11-19T04:57:28.457",
"last_edit_date": "2015-09-15T01:30:11.497",
"last_editor_user_id": "12322",
"owner_user_id": "12322",
"post_type": "question",
"score": 0,
"tags": [
"ruby-on-rails"
],
"title": "paperclipで作成したattachmentカラムをbulk updateする方法",
"view_count": 259
} | [
{
"body": "<https://github.com/thoughtbot/paperclip#usage> \nによれば、database のレコードは、下記の4つが使用されているようです。\n\n> The basics of Paperclip are quite simple: Declare that your model has \n> an attachment with the has_attached_file method, and give it a name.\n>\n> Paperclip will wrap up to four attributes (all prefixed with that \n> attachment's name, so you can have multiple attachments per model if \n> you wish) and give them a friendly front end. These attributes are:\n>\n> <attachment>_file_name <attachment>_file_size \n> <attachment>_content_type <attachment>_updated_at\n\nよって、photo ではなく、photo_file_name などにすれば、バルクアップデートは出来ると考えます。 \nただ、更新はできますが、paperclip とは連携しないため、お望みの結果にはならないかもしれないと推察します。\n\nPS. active-import で bulk update が可能であることを知らず失礼しました。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T11:55:00.800",
"id": "16644",
"last_activity_date": "2015-09-15T11:55:00.800",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7471",
"parent_id": "16596",
"post_type": "answer",
"score": 1
}
] | 16596 | null | 16644 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "全くのMonaca初心者です。初歩的な質問で申し訳ありません。 \ncontroller等を設けず、OnsenUIを利用して \nonclick等で普段通りのJSで関数を書いて行ってしまいました。 \nPushpageでページを切り替えていくことができましたが、切り替えたページでは \nDOMを書き換えることもできませんでした。 \nPsuhpage後にロードされたDOMに対して、データを表示させたりするにはどうしたらよいでしょうか",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T12:07:47.190",
"favorite_count": 0,
"id": "16599",
"last_activity_date": "2016-08-23T03:30:55.560",
"last_edit_date": "2015-09-15T06:44:38.237",
"last_editor_user_id": "8532",
"owner_user_id": "12324",
"post_type": "question",
"score": 1,
"tags": [
"monaca",
"onsen-ui"
],
"title": "OnsenUIの基本的な構成方法",
"view_count": 713
} | [
{
"body": "私も初心者ですので、初心者の視点から・・・。 \nコードがないのではっきりしたことは言えませんが、JavaScriptが実行されるタイミングが問題かもしれません。ページ切り替えボタンをタッチした瞬間など、各要素が構築される「前」にDOMに対する制御をかけてしまうと、望んだ結果が得られません。 \n試行錯誤でしたが、私は以下のイベントリスナーをセットすることで対処しました。\n\n```\n\n document.addEventListener('pageinit',function(page){\n if(page.target.id==\"Page1\"){\n initPage1(); //ページ1の初期化処理\n } \n if(page.target.id==\"Page2\"){\n initPage2();//ページ2の初期化処理\n }\n }\n \n```\n\n※`page.target.id==\"Page1\"` で比較されているページ名は、 `<ons-page id=\"Page1\">`\nで指定したIdが入ります。\n\n”pageinit”は、各要素が構築されたのちに実行されるイベントですので、Pushされたページに対しても、各要素にアクセスできると思います。",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T14:23:15.947",
"id": "16604",
"last_activity_date": "2015-09-16T12:31:07.397",
"last_edit_date": "2015-09-16T12:31:07.397",
"last_editor_user_id": "8000",
"owner_user_id": "11105",
"parent_id": "16599",
"post_type": "answer",
"score": 1
}
] | 16599 | null | 16604 |
{
"accepted_answer_id": "16609",
"answer_count": 2,
"body": "ホテルの予約システムを実装しています。\n\n```\n\n # 予約テーブル\n class Reservation < ActiveRecord::Base\n belongs_to :plan, inverse_of: :reservations\n delegate :room, to: :plan, allow_nil: true\n end\n \n # 予約プランテーブル\n class Plan < ActiveRecord::Base\n has_many :reservations, inverse_of: :plan\n belongs_to :room, inverse_of: :plans\n end\n \n # 部屋テーブル\n class Room < ActiveRecord::Base\n has_many :plans, inverse_of: :room\n has_many :reservations, through: :plans\n end\n \n```\n\nこのような関連の時、[ある部屋の予約状況を知りたい]時 \n`ReservationsController`では\n\n```\n\n @reservation = Room.find(params[:id]).reservations\n \n```\n\nのようにしておくと 中間テーブルの役割を果たす`plans`が中でJoinされて \n[予約プランが一つでもないと予約状況が参照できない]状態となります。\n\nそのため `reservations`に`room_id`を追加して直接参照したいのですが \n`plans`にも`room_id`があるためDB設計的に冗長なのではと感じてます。\n\nこの場合、どのように設計をすれば良いでしょうか。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T13:30:26.617",
"favorite_count": 0,
"id": "16601",
"last_activity_date": "2015-09-15T00:52:56.920",
"last_edit_date": "2015-09-15T00:06:42.907",
"last_editor_user_id": "9177",
"owner_user_id": "9177",
"post_type": "question",
"score": 1,
"tags": [
"ruby-on-rails",
"rails-activerecord"
],
"title": "through:オプション以外でアクセスするために外部キーを追加してもよいか",
"view_count": 202
} | [
{
"body": "要件に依ると思います。\n\n今のモデルの設計だと、「プランなしでは予約できない」というルールに見えます。 \nもし本当にそうだとしたら、「プランがないなら予約は参照できない」という状況でも困らないはずです。\n\nですが、「プランがなくても予約を参照したい」ということなので、実際は「プランなしでも予約は可能」なんだと思います。(ふつうのホテルの業務を想像してもたぶんそんな気がします)\n\nさらにいうと、「部屋がプランを持つ」点に少し違和感があります。 \nこれはプランによって使える部屋が限定されるということなんでしょうか?\n\n個人的な感覚でいうと、こんなモデル設計になる気がします。\n\n * Room has many reservations\n * Plan has many reservations\n * Reservation has room (必須:予約は必ず部屋を持つ)\n * Reservation has plan (任意:プランなしで予約されることもある)\n * 部屋とプランは直接関連しない\n\nいずれにしても、部屋と予約とプランの関係性(業務ルール)を考えて、今のモデル構造が妥当かどうかを検証することが先かなと思います。 \n妥当であれば、Reservationにroom_idを追加するのもアリだと思います。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T19:15:28.347",
"id": "16609",
"last_activity_date": "2015-09-14T19:15:28.347",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "85",
"parent_id": "16601",
"post_type": "answer",
"score": 1
},
{
"body": "`Reservation`に`room_id`を追加した場合、`Reservation`と`Room`の間に`Reservation`-`Plan`-`Room`という関連と、`Reservation`-`Room`という2経路の関連が出来ることになるので、この整合性を担保する必要があります。\n\n整合性の担保は\n\n * モデルを使う側に押しつける\n * モデルの側でコールバックなどを使って実現する\n * DB側でトリガなどで実現する\n\n等考えられますが、いずれにせよ結構面倒です\n\n複数経路での関連が生じるのは直ちにNGではないのですが、本当に必要性があるのか、設計で回避できないのかは検討する必要があるでしょう。\n\n* * *\n\nところで、このモデル設計では、一般的には可能でなければならないはずの「一つの予約で複数の部屋を申し込む」ということが管理できません。また「予約プラン」というのが単なる中間テーブルなのか、いわゆる「スタンダードプラン」とか「レディースプラン」とかの「プラン」なのかどちらとも読み取れるのですが、どちらであるにしても違和感があります。そもそもの設計に問題があるような気がします。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T00:52:56.920",
"id": "16611",
"last_activity_date": "2015-09-15T00:52:56.920",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "16601",
"post_type": "answer",
"score": 1
}
] | 16601 | 16609 | 16609 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "表題の通りなのですが、NSURLConnectionを利用して、 \nプロキシ設定を行い特定のURLに接続する方法はないのでしょうか? \niOSシステム側の設定ではなく、NSURLConnectionの特定の通信の時だけ \nプロキシ経由で接続するようにしたいです。\n\n※既存ソース改修の都合上、NSURLSessionを利用することが厳しいです。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T13:57:19.860",
"favorite_count": 0,
"id": "16603",
"last_activity_date": "2015-09-14T13:57:19.860",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12325",
"post_type": "question",
"score": 3,
"tags": [
"ios",
"nsurlsession",
"network"
],
"title": "NSURLConnectionでプロキシ経由での通信",
"view_count": 255
} | [] | 16603 | null | null |
{
"accepted_answer_id": "16643",
"answer_count": 2,
"body": "2部グラフ(V1, V2, E)があります。 \nV2から点をいくつか削除し、それら点に紐付いていた枝を削除することで、すべてのv∈V1が1本のみの枝を持つ部分グラフ(V1, V',\nE')を作りたいのですが、 \nそのようなV'の存在の有無を判定し、また、その条件を満たすV'を少なくとも1つ得るには、どうすればいいでしょうか。\n\n図のように、V2からいくつか点を削除したV'を得たいです。 \nこのようなV'が複数ある場合も、1通りのみ得られたら構いません。\n\n[](https://i.stack.imgur.com/voDmO.jpg)",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T14:58:23.743",
"favorite_count": 0,
"id": "16606",
"last_activity_date": "2020-02-18T15:05:53.817",
"last_edit_date": "2015-09-14T16:17:44.997",
"last_editor_user_id": "754",
"owner_user_id": "12269",
"post_type": "question",
"score": 8,
"tags": [
"アルゴリズム",
"グラフ理論"
],
"title": "2部グラフ(V1, V2, E)で、V2からいくつか頂点を削除し、すべてのv∈V1が、1本のみの枝をもつようにするには?",
"view_count": 344
} | [
{
"body": "グラフを、対応する論理式に落とし込んで変形していくことにより解けそうです。\n\n## 考え方\n\nまず、v1,i ∈ V1 と v2,j ∈ V2 がどう繋っているか、表にしてみます。 \n質問で例示されたグラフでは以下のようになります。`o` の印があるところが辺で繋がっている組み合わせです。添字 i, j\nは、図の一番上を1として順番に振りました。\n\n```\n\n V2\n v2,1|v2,2|v2,3|v2,4\n -----+----+----+-----\n v1,1| o | o | |\n -----+-----+----+----+-----\n v1,2| | o | o |\n V1 -----+-----+----+----+-----\n v1,3| o | o | | o\n -----+-----+----+----+-----\n v1,4| | | o |\n \n```\n\nさて、一行目に着目してみると、 v1,1 は、v2,1 と v2,2 に繋っていますから、v1,1 に 1 本だけ枝が伸びた状態を実現するには、 v2,1\nと v2,2 のどちらか一方のみが残されている必要があります。 \nここで、 v2,j の状態を以下のように表します。\n\n * xj : v2,j が残された状態\n * ¬xj : v2,j が削除された状態\n\nこれを用いて、「v2,1 と v2,2 のどちらか一方のみが残されている」状態を表すと、以下のようになります。\n\n> (x1 ∧ ¬x2) ∨ (¬x1 ∧ x2)\n\nつまり、関連する xj のうち、ひとつのみを肯定形、残りを否定形にして and で繋いだ形の全パターンを or で繋いだものです。 \n二行目以降も同様に、それぞれ以下のように表せます。\n\n> (x2 ∧ ¬x3) ∨ (¬x2 ∧ x3) \n> (x1 ∧ ¬x2 ∧ ¬x4) ∨ (¬x1 ∧ x2 ∧ ¬x4) ∨ (¬x1 ∧ ¬x2 ∧ x4) \n> x3\n\n目的の条件を満足するためには、これらすべてを満たす必要がありますから、すべて and で繋げます。\n\n> ((x1 ∧ ¬x2) ∨ (¬x1 ∧ x2)) \n> ∧ ((x2 ∧ ¬x3) ∨ (¬x2 ∧ x3)) \n> ∧ ((x1 ∧ ¬x2 ∧ ¬x4) ∨ (¬x1 ∧ x2 ∧ ¬x4) ∨ (¬x1 ∧ ¬x2 ∧ x4)) \n> ∧ (x3)\n\nこれを展開していきます。途中、 ⊥ になったもの、つまり、論理積の中に xj と ¬xj が同時に表れたものはどんどん消していきます。\n\n> ((x1 ∧ ¬x2 ∧ x2 ∧ ¬x3) ∨ (x1 ∧ ¬x2 ∧ ¬x2 ∧ x3) \n> ∨ (¬x1 ∧ x2 ∧ x2 ∧ ¬x3) ∨(¬x1 ∧ x2 ∧ ¬x2 ∧ x3)) \n> ∧ ((x1 ∧ ¬x2 ∧ ¬x4) ∨ (¬x1 ∧ x2 ∧ ¬x4) ∨ (¬x1 ∧ ¬x2 ∧ x4)) \n> ∧ (x3)\n>\n> = ((x1 ∧ ¬x2 ∧ x3) ∨ (¬x1 ∧ x2 ∧ ¬x3)) \n> ∧ ((x1 ∧ ¬x2 ∧ ¬x4) ∨ (¬x1 ∧ x2 ∧ ¬x4) ∨ (¬x1 ∧ ¬x2 ∧ x4)) \n> ∧ (x3) \n> ... \n> = x1 ∧ ¬x2 ∧ x3 ∧ ¬x4\n\n最終的に得られた式に残っている否定形は ¬x2 と ¬x4 ですから、v2,2 と v2,4 を削除すればよいことが分かります。\n\n## 例 - 解なし\n\n以下の例を考えます。\n\n[](https://i.stack.imgur.com/XjPA4.png)\n\nこのグラフの枝情報を同様に表にします。\n\n```\n\n V2\n v2,1|v2,2|v2,3\n -----+----+-----\n v1,1| o | o |\n -----+-----+----+----\n V1 v1,2| | o | o\n -----+-----+----+----\n v1,3| o | | o\n \n```\n\nこれを論理式に落とし込んで変形すると\n\n> ((x1 ∧ ¬x2) ∨ (¬x1 ∧ x2)) \n> ∧ ((x2 ∧ ¬x3) ∨ (¬x2 ∧ x3)) \n> ∧ ((x3 ∧ ¬x1) ∨ (¬x3 ∧ x1))\n>\n> = ⊥\n\nとなり、解なしとなります。\n\n## 例 - 重解\n\n以下の例を考えます。\n\n[](https://i.stack.imgur.com/rPz9q.png)\n\nこのグラフの枝情報を同様に表にします。\n\n```\n\n V2\n v2,1|v2,2|v2,3\n -----+----+-----\n v1,1| o | o |\n -----+-----+----+----\n V1 v1,2| o | o |\n -----+-----+----+----\n v1,3| o | | o\n \n```\n\nこれを論理式に落とし込んで変形すると\n\n> ((x1 ∧ ¬x2) ∨ (¬x1 ∧ x2)) \n> ∧ ((x1 ∧ ¬x2) ∨ (¬x1 ∧ x2)) \n> ∧ ((x1 ∧ ¬x3) ∨ (¬x1 ∧ x3))\n>\n> = (x1 ∧ ¬x2 ∧ ¬x3) ∨ (¬x1 ∧ x2 ∧ x3)\n\nとなります。ふたつの項が残るので、\n\n * v2,2 と v2,3 を削除する (x1 ∧ ¬x2 ∧ ¬x3 に対応)\n * v2,1 を削除する (¬x1 ∧ x2 ∧ x3 に対応)\n\nの2通りの解があることが分かります。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T11:38:06.400",
"id": "16643",
"last_activity_date": "2015-09-15T12:20:14.283",
"last_edit_date": "2015-09-15T12:20:14.283",
"last_editor_user_id": "7831",
"owner_user_id": "7831",
"parent_id": "16606",
"post_type": "answer",
"score": 9
},
{
"body": "Exact Cover という Wikipedia にも載ってる有名問題です.",
"comment_count": 0,
"content_license": "CC BY-SA 4.0",
"creation_date": "2020-02-18T15:05:53.817",
"id": "63160",
"last_activity_date": "2020-02-18T15:05:53.817",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "37877",
"parent_id": "16606",
"post_type": "answer",
"score": 1
}
] | 16606 | 16643 | 16643 |
{
"accepted_answer_id": "16608",
"answer_count": 1,
"body": "UIWevViewのdelegateメソッドでフックして処理を行います。 \nコードの見通しをよくするため、UIWebViewのviewとcontrollerを切り離してプログラムする方法を教えていただきたいです。 \n具体的には、UIWebViewのdelegateメソッドでの処理を、他クラスで定義(コードを外出し)したいです。\n\n単純にwebViewのデリゲートに他クラスインスタンスをセットすればよいだけかと思っていたのですが、私の実装した方法ですと以下のエラーが表示されました。\n\nThread 1:EXC_BAD_ACCESS(code=1,address=0x0)\n\nソースはgithubにコミットしました。 \nお力添えいただけると幸いです。\n\n<https://github.com/siroop/test_webview.git>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T15:57:21.253",
"favorite_count": 0,
"id": "16607",
"last_activity_date": "2015-09-14T17:05:37.427",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12326",
"post_type": "question",
"score": 3,
"tags": [
"ios",
"objective-c"
],
"title": "UIWebViewのdelegate処理を別クラスに切り離す方法について",
"view_count": 544
} | [
{
"body": "読んでみました\n\n```\n\n - (void)viewDidLoad {\n [super viewDidLoad];\n \n webViewController *vc = [webViewController new];\n self.webView.delegate = vc;\n \n [self loadContents];\n }\n \n```\n\n`UIWebView`の`delegate`プロパティはドキュメントによると次のように定義されていました。\n\n```\n\n @property(nonatomic, assign) id< UIWebViewDelegate > delegate\n \n```\n\nということは、代入しても参照カウンタは増えません。なので、変数`*vc`に入っているオブジェクトは、この`viewDidLoad`を抜けると破棄されてしまいます。\n\n`ViewController`にプロパティとして追加し、次のようにしてみてはどうでしょうか?\n\n```\n\n - (void)viewDidLoad {\n [super viewDidLoad];\n \n self.vc = [webViewController new];\n self.webView.delegate = self.vc;\n \n [self loadContents];\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-14T17:05:37.427",
"id": "16608",
"last_activity_date": "2015-09-14T17:05:37.427",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "845",
"parent_id": "16607",
"post_type": "answer",
"score": 2
}
] | 16607 | 16608 | 16608 |
{
"accepted_answer_id": "16623",
"answer_count": 3,
"body": "```\n\n <select>\n <option>test1</option>\n <option>test2</option>\n </select>\n \n```\n\nのtest1を非表示にしたいのですが、javascript 、jqueryで可能でしょうか? \nfirefoxでは、cssのdisplay:noneで非表示になりますが、IEでは実現できませんでした。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T01:19:57.047",
"favorite_count": 0,
"id": "16612",
"last_activity_date": "2017-06-15T02:01:18.283",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12327",
"post_type": "question",
"score": 1,
"tags": [
"javascript",
"jquery",
"html"
],
"title": "セレクトボックス内の要素を非表示にしたい",
"view_count": 31338
} | [
{
"body": "非表示にするという意味では`display:none` をセットするというのが正しい処置だと思います。 \nなので、IEは動作がおかしいように思います。 \nそうは言っても仕方ないので、 \nIEでの処理を振り分けてDOM要素を削除してしまうしかないのかなと思います。(再び表示する場合は要素を差し込む必要がある) \n削除自体はjQueryの`remove`メソッドで`$(\"option:first\").remove();`\n(なんならIDを付けてID指定でセレクト)でできると思います。\n\nHTML文書自体を変更してoptionを1つ削除したりはしたくないので \n一時的にCSSを変更してCSSのスタイルで非表示にしたかった。 \nというようなことなら、HTMLの一部を削除するのではなくコメントアウトすることで無くすることができます。 \n`<!--` と`-->`で該当部分を囲む。 \n例:\n\n```\n\n <!-- <option>test1</option> -->\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T05:37:44.713",
"id": "16622",
"last_activity_date": "2015-09-15T05:48:53.713",
"last_edit_date": "2015-09-15T05:48:53.713",
"last_editor_user_id": "5044",
"owner_user_id": "5044",
"parent_id": "16612",
"post_type": "answer",
"score": 0
},
{
"body": "IEのドキュメント[option element](https://msdn.microsoft.com/en-\nus/library/ms535877\\(v=vs.85\\).aspx)には\n\n> Except for `background-color` and `color`, style settings applied through\n> the `style` object for the `option` element are ignored. In addition, style\n> settings applied directly to individual `options` override those applied to\n> the containing `select` element as a whole.\n\nとありスタイルを指定できない仕様のようです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T05:51:27.593",
"id": "16623",
"last_activity_date": "2015-09-15T05:51:27.593",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4236",
"parent_id": "16612",
"post_type": "answer",
"score": 2
},
{
"body": "一応、`hidden`属性を指定する事で消せるようです。 \nただ下の様に`selected`で選択状態にしておくとユーザが操作するまで表示されていたりと、あまりスマートではありません。\n\n```\n\n <option selected hidden>test2</option>\n \n```\n\nまた、この属性は古いブラウザではサポートされないでしょう。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T06:56:03.027",
"id": "16624",
"last_activity_date": "2015-09-15T06:56:03.027",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3054",
"parent_id": "16612",
"post_type": "answer",
"score": 0
}
] | 16612 | 16623 | 16623 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "Cocos2d-x 3.2で、Objective-\nCのUIViewを使用する機会があったのですが、UIViewの位置がすべてSpriteより手前になってしまいます。 \nUIViewだけでなく、Objective-Cから呼ばれるすべてのビューはCocos2d-xのビューより階層構造上、手前に配置されてしまいます。 \naddChildメソッドを呼ぶときに、ZOrderの値を大きくしても、結果は同じでした。 \n階層構造で、UIViewより上の位置にSpriteを配置することはできるのでしょうか? \n詳しい方、ご教示ください。\n\n```\n\n // UIViewを配置\n UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];\n [view setBackgroundColor:[UIColor blueColor]];\n UIView *rootView = (UIView*)cocos2d::Director::getInstance()->getOpenGLView()->getEAGLView();\n [rootView addSubview:view];\n \n // Spriteを配置\n Sprite *sprite = Sprite::create(\"sprite.png\");\n sprite->setPosition(Point(430,320));\n this->addChild(sprite,100,100);\n \n```\n\n[](https://i.stack.imgur.com/4O2UD.png)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T01:42:53.440",
"favorite_count": 0,
"id": "16613",
"last_activity_date": "2015-09-15T08:07:54.927",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7699",
"post_type": "question",
"score": 1,
"tags": [
"ios",
"objective-c",
"cocos2d-x"
],
"title": "Cocos2d-xの階層構造で、SpriteをUIViewより上にしたい。",
"view_count": 471
} | [
{
"body": "cocos2d-xのスプライトはViewとして追加されているのではなくOpenGLを使って \n直接特定のView(あなたのコードで言うrootView)に描画されています。 \nですので、rootViewの上に付けたUIViewより上に表示することは出来ないのではないでしょうか。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T07:59:40.907",
"id": "16627",
"last_activity_date": "2015-09-15T07:59:40.907",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "849",
"parent_id": "16613",
"post_type": "answer",
"score": 1
},
{
"body": "確実に優先を付けたいなら下図のような構成にして、普通のViewはunderViewにAddしましょう。\n\n```\n\n +-[rootView]-------+\n | |\n | +-[underView]-----+\n | | |\n | | +-[EAGLView]-----+\n +--| | |\n | | |\n +--| |\n | |\n +----------------+\n \n```\n\nざっくりコード。\n\n```\n\n CGRect frame = (画面一杯?);\n //Root view\n UIView *rootView = [[UIView alloc] initWithFrame:frame];\n rootView.backgroundColor = UIColor.clearColor;\n //Low prio view\n UIView *underView = [[UIView alloc] initWithFrame:frame];\n rootView.backgroundColor = UIColor.clearColor;\n //EAGLView\n UIView *EAGLView = (略);\n //Add subview\n [rootView addSubview:underView];\n [rootView addSubview:EAGLView];\n \n //青いの\n UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];\n [view setBackgroundColor:[UIColor blueColor]];\n [underView addSubview:view];\n \n```\n\nrootViewとunderViewの背景色は透明じゃなくて黒とかにした方がいいかも。(速度的に)\n\n【追記】 \n通常、rootViewは生成するんじゃなくて、ViewControllerのviewを使うんじゃないかな。 \n今回、どういう構成になっているか分からないのでなんとも言えませんが。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T08:02:13.317",
"id": "16628",
"last_activity_date": "2015-09-15T08:07:54.927",
"last_edit_date": "2015-09-15T08:07:54.927",
"last_editor_user_id": "10966",
"owner_user_id": "10966",
"parent_id": "16613",
"post_type": "answer",
"score": 1
}
] | 16613 | null | 16627 |
{
"accepted_answer_id": "16891",
"answer_count": 1,
"body": "以下のコードをSWIG3を使用してclass Foo を Javaで使用できるようにしたいとしています。 \n元のC++コードは以下のようになっています。 \nC++側のコードは変更することはできないとします。\n\n```\n\n class Foo {\n public:\n static Foo* getFoo(return &_Foo;}\n /* some method */\n };\n static Foo _Foo;\n \n```\n\nこれをJavaで\n\n```\n\n Foo _foo = Foo.getFoo();\n \n```\n\nとします。 \nSWIG3はそのまま_Fooをreturnするコードを出力しますが、 \nにしてもclass FooはJavaのObjectから継承されていないので \nExceptionになります。\n\n```\n\n java.lang.Error: Unresolved compilation problems: \n The type java.lang.Object cannot be resolved.\n \n```\n\nではSWIGにたよらず自力でJNIを作成するとしても \nすでにstaticなオブジェクトがあるわけですから、JNIEnv::NewObject()で新規オブジェクトを \nつくることもできません。 \nstaticですからガーベジコレクション時の挙動も謎です。\n\nどのようにしてstaticオブジェクトを返せば良いのでしょうか? \nやはり、不可能なのでしょうか。",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T01:48:23.893",
"favorite_count": 0,
"id": "16614",
"last_activity_date": "2015-09-24T07:37:13.847",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7844",
"post_type": "question",
"score": 2,
"tags": [
"java",
"c++",
"jni"
],
"title": "staticなオブジェクトをSWIG, JNIでreturnするにはどうすればよいでしょうか",
"view_count": 523
} | [
{
"body": ">\n> C++のクラスオブジェクトをJavaの世界から直接扱うことは出来ないため、両者の\"対応付け\"を行うコードをJNIで書くことになります。C++側がシングルトンなのであれば、Java側にもシングルトン的な動きをするラッパーを用意するのが素直な(≒力技)実装です。\n\n上記をそのまま実装したコードです。(期待されるスマートな解法からは程遠いと思われます...)\n\n```\n\n // C++コード: FooImpl.cpp/h\n class Foo {\n public:\n static Foo* getFoo() { return &_Foo; }\n int someMethod() { /*...*/ }\n };\n static Foo _Foo;\n \n```\n\nJava側のラッパークラス`FooWrapper`を用意します。ここでは`native`メソッドを`static`にしています。最終的にはC++側シングルトン・インスタンスのメンバ関数呼び出しを行うため、Java側APIは`static`メソッドにしても意味論上は等価という考え方に基づきます。\n\n```\n\n // Javaコード: FooWrapper.java\n package com.example;\n \n public class FooWrapper {\n public static native int someMethod();\n static { System.loadLibrary(\"FooWrapper\"); }\n }\n \n```\n\n上記`FooWrapper.java`を元に、`javah`ツールを用いてC/C++用ヘッダファイル`com_example_FooWrapper.h`を生成します。\n\n```\n\n /* DO NOT EDIT THIS FILE - it is machine generated */\n #include <jni.h>\n /* Header for class com_example_FooWrapper */\n // [...]\n /*\n * Class: com_example_FooWrapper\n * Method: someMethod\n * Signature: ()I\n */\n JNIEXPORT jint JNICALL Java_com_example_FooWrapper_someMethod\n (JNIEnv *, jclass);\n // [...]\n \n```\n\nJNIブリッジ層では自動生成`com_example_FooWrapper.h`の関数群を実装し、`FooImpl.h`にある本体コードを呼び出します。\n\n```\n\n // JNIブリッジコード: FooWrapper.cpp\n #include \"com_example_FooWrapper.h\"\n #include \"FooImpl.h\"\n \n JNIEXPORT jint JNICALL Java_com_example_FooWrapper_someMethod(JNIEnv *, jclass)\n {\n return static_cast<jint>(Foo::getFoo()->someMethod());\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-24T05:40:42.973",
"id": "16891",
"last_activity_date": "2015-09-24T07:37:13.847",
"last_edit_date": "2015-09-24T07:37:13.847",
"last_editor_user_id": "49",
"owner_user_id": "49",
"parent_id": "16614",
"post_type": "answer",
"score": 1
}
] | 16614 | 16891 | 16891 |
{
"accepted_answer_id": null,
"answer_count": 3,
"body": "SQL文を教えて下さい。 \nuser_id 毎の最新の bills 一覧を得る SELECT 文はどう書けば良いのでしょうか?\n\n## テーブル定義\n\n```\n\n mysql> desc bills;\n +---------------------+--------------+------+-----+---------+----------------+\n | Field | Type | Null | Key | Default | Extra |\n +---------------------+--------------+------+-----+---------+----------------+\n | id | int(11) | NO | PRI | NULL | auto_increment |\n | user_id | int(11) | YES | MUL | NULL | |\n | created_at | datetime | YES | | NULL | |\n +---------------------+--------------+------+-----+---------+----------------+\n \n```\n\n## サンプル\n\n```\n\n +----+---------+------------+\n | id | user_id | created_at |\n +----+---------+------------+\n | 1 | 111 | 2015-01-01 |\n +----+---------+------------+\n | 2 | 111 | 2015-01-02 |\n +----+---------+------------+\n | 3 | 111 | 2015-01-03 | ← 111 の中で最新の日付\n +----+---------+------------+\n | 4 | 222 | 2015-01-02 | ← 222 の中で最新の日付\n +----+---------+------------+\n | 5 | 222 | 2015-01-01 |\n +----+---------+------------+\n \n```\n\n## 期待する結果\n\n```\n\n +----+---------+------------+\n | id | user_id | created_at |\n +----+---------+------------+\n | 3 | 111 | 2015-01-03 |\n +----+---------+------------+\n | 4 | 222 | 2015-01-02 |\n +----+---------+------------+\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T02:31:52.160",
"favorite_count": 0,
"id": "16616",
"last_activity_date": "2019-06-19T08:18:43.860",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7208",
"post_type": "question",
"score": 4,
"tags": [
"mysql",
"sql"
],
"title": "指定したカラム毎で最新のリストが欲しい(SQL, SELECT文)",
"view_count": 9832
} | [
{
"body": "結合し直してどの行が該当したのかを探すことでしょうか。\n\n```\n\n SELECT bills.*\n FROM bills\n INNER JOIN (SELECT user_id, MAX(created_at) AS created_at\n FROM bills\n GROUP BY user_id) AS max\n ON bills.user_id = max.user_id AND bills.created_at = max.created_at\n \n```\n\nこのクエリからわかりますが、あくまで`user_id`毎に`created_at`の最大値を選んだだけですので、最大値が複数行存在した場合は結果も複数になります。 \nそれでは困るという場合は再度グループ化し、どのような`id`を選択するかを考える必要があります。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T03:00:21.443",
"id": "16618",
"last_activity_date": "2015-09-15T03:00:21.443",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4236",
"parent_id": "16616",
"post_type": "answer",
"score": 0
},
{
"body": "既に回答は出されていますが、別の方法でやってみます。\n\n```\n\n SELECT * FROM bills AS b WHERE created_at = (\n SELECT MAX(created_at) FROM bills AS bs WHERE b.user_id = bs.user_id\n );\n \n```\n\nこの場合も最大値を持つレコードが複数ある場合は全て選択されることになります。\n\n**追記**\n\n最大値を持つレコードが複数ある場合に、例えば `id` が最も大きいレコードを抽出するには以下の様にします。\n\n```\n\n SELECT * FROM bills AS b WHERE id = (\n SELECT MAX(id) FROM bills AS bs\n WHERE b.user_id = bs.user_id AND\n created_at = (\n SELECT MAX(created_at) FROM bills AS bs\n WHERE b.user_id = bs.user_id)) ORDER BY user_id;\n \n```\n\n最小値の `id` を持つレコードを抽出する場合は、上記の `MAX(id)` を `MIN(id)` に変更します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T03:52:50.710",
"id": "16620",
"last_activity_date": "2015-09-15T05:17:47.820",
"last_edit_date": "2015-09-15T05:17:47.820",
"last_editor_user_id": null,
"owner_user_id": null,
"parent_id": "16616",
"post_type": "answer",
"score": 2
},
{
"body": "id 列が不要ならば、以下のSQLで取得できます。\n\n```\n\n SELECT user_id, MAX(created_at) FROM bills GROUP BY user_id\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 4.0",
"creation_date": "2019-06-19T08:18:43.860",
"id": "55917",
"last_activity_date": "2019-06-19T08:18:43.860",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "14334",
"parent_id": "16616",
"post_type": "answer",
"score": 0
}
] | 16616 | null | 16620 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "ローカルにpython2.7が入っていたのですがpython3を使いたいためhomebrewを用いpython3をインストールしました。 \nそしてNumPyをインストールしようと\n\n```\n\n $ pip3 install numpy\n \n```\n\nと実行したら以下のようなエラーが発生しました。\n\n```\n\n .\n .\n \n File \"numpy/core/setup.py\", line 293, in check_types\n \"Cannot compile 'Python.h'. Perhaps you need to \"\\\n SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.\n \n ----------------------------------------\n Command \"/usr/local/opt/python3/bin/python3.5 -c \"import setuptools, tokenize;__file__='/private/var/folders/3s/sq3306n57rgf5539s6bw67qm0000gn/T/pip-build-b_r_jvk6/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))\" install --record /var/folders/3s/sq3306n57rgf5539s6bw67qm0000gn/T/pip-vjiol_uu-record/install-record.txt --single-version-externally-managed --compile\" failed with error code 1 in /private/var/folders/3s/sq3306n57rgf5539s6bw67qm0000gn/T/pip-build-b_r_jvk6/numpy\n \n```\n\npython-devをインストールすればいいのかと思い調べてみたのですが、インストール方法がよくわかりませんでした。\n\n環境はmac,python3.5です。よろしくお願いします。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T02:54:58.493",
"favorite_count": 0,
"id": "16617",
"last_activity_date": "2015-09-15T04:14:30.077",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4971",
"post_type": "question",
"score": 3,
"tags": [
"python"
],
"title": "python 3でpipからNumPyがインストールできない。",
"view_count": 6433
} | [
{
"body": "コメントの[リンク](https://github.com/Homebrew/homebrew/issues/43916)を参考に\n\n```\n\n brew install homebrew/python/numpy --with-python3\n \n```\n\nで無事インストールできました。ありがとうございました。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T04:14:30.077",
"id": "16621",
"last_activity_date": "2015-09-15T04:14:30.077",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4971",
"parent_id": "16617",
"post_type": "answer",
"score": 2
}
] | 16617 | null | 16621 |
{
"accepted_answer_id": "16632",
"answer_count": 1,
"body": "サーバーに ServerSoket を使用して、 クライアントに Socket を使用して通信するとします。 \nサーバーはクライアントに10M程度(なんでもいいですけど)のデータを送信して \nすぐflushして、すぐにsocketをcloseします。 \nこれって、以下の場合正常に処理されるのですか? \n(flush&closeしたからと言って相手に届いているわけではないので)\n\n相手が一時的に電波不良などで受信できない状態になっていた時や、 \nTCPのため、データ再送リクエストも深い層で行われるかもしれません。 \nですがその場合、サーバー側でsocketはcloseされているので、クライアントが上記の状態になった場合は通信は失敗するのでしょうか? \nそれとも、closeしても、クライアントが正常受信完了するまではVMなどで生きているのでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T07:00:24.000",
"favorite_count": 0,
"id": "16625",
"last_activity_date": "2015-09-17T02:41:20.497",
"last_edit_date": "2015-09-17T02:41:20.497",
"last_editor_user_id": "10346",
"owner_user_id": "10346",
"post_type": "question",
"score": 8,
"tags": [
"java",
"tcp",
"socket"
],
"title": "Java Socket通信サーバーがcloseした場合クライアントは正常に受信できるのか",
"view_count": 1998
} | [
{
"body": "socketはOSで管理されていて、正常完了 または 失敗(タイムアウト)\nまで裏で頑張ります。仮に一時的電波不良があっても、再送の繰り返すうちに成功すれば、データは無事届くことでしょう。繋がらない状態が続き、再送がタイムアウト設定時間以内に成功しなければ、失敗です。 \nそのため、「電波不良や地理的に遠い通信相手を考慮して、○秒待ってからcloseしよう」などとアプリケーションが考える必要はありません。\n\n余談として、この挙動を変えたいとき、すなわちclose()から指定時間後に結果にかかわらず接続を殺してしまいたいときには、SO_LINGER\nという、一般的には推奨されないオプションが一応あります。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T09:19:40.633",
"id": "16632",
"last_activity_date": "2015-09-15T09:19:40.633",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "799",
"parent_id": "16625",
"post_type": "answer",
"score": 5
}
] | 16625 | 16632 | 16632 |
{
"accepted_answer_id": "16657",
"answer_count": 1,
"body": "Androidアプリ開発において、ListViewとTextViewをLinearLayoutで並べたい。 \nAndroidStudioでNavigation Drawerを用いたアプリ開発を行っていて、 \n左から出てくるメニューのカスタマイズを行いたくて、 \n上にTextViewで文字(見出し)を表示、下にListViewでリストを表示というのをやるために、 \n**fragment_navigation_drawer.xml** ファイル内に\n\n[](https://i.stack.imgur.com/5ix0L.png)\n\nと書いたのですが、文字は表示されて、リストの方の文字は表示されませんでした。(場所の確保はされている) \nListViewだけ抜き出して書くとちゃんと文字も表示されていて、LinearLayoutの中に入れてしまうと表示されなくなります。 \nどうすればリストが表示されるか分からないので、どなたか教えていただけると嬉しいです。\n\n* * *\n\n`activity_main.xml`\n\n```\n\n <android.support.v4.widget.DrawerLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:id=\"@+id/drawer_layout\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n tools:context=\".MainActivity\">\n \n <FrameLayout\n android:id=\"@+id/container\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\" />\n \n <fragment\n android:id=\"@+id/navigation_drawer\"\n android:name=\"com.example.yuriyuri.toolbar.NavigationDrawerFragment\"\n android:layout_width=\"@dimen/navigation_drawer_width\"\n android:layout_height=\"match_parent\"\n android:layout_gravity=\"start\"\n tools:layout=\"@layout/fragment_navigation_drawer\" />\n \n```\n\n`listlayout.xml`\n\n```\n\n <TextView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:id=\"@android:id/text1\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:textAppearance=\"?android:attr/textAppearanceLarge\"\n android:gravity=\"center_vertical\"\n android:textColor=\"#282828\"\n android:paddingLeft=\"6dip\"\n android:minHeight=\"?android:attr/listPreferredItemHeight\"\n />\n \n```\n\n`color.xml`\n\n```\n\n <selector xmlns:android=\"schemas.android.com/apk/res/android\">\n <item android:state_pressed=\"true\">\n <shape android:shape=\"rectangle\">\n <solid android:color=\"#fdc6ce\">\n </solid>\n </shape>\n </item>\n <item android:state_focused=\"true\">\n <shape android:shape=\"rectangle\">\n <solid android:color=\"#44F08000\">\n </solid>\n <stroke android:color=\"#fdc6ce\" android:width=\"2dp\">\n </stroke>\n </shape>\n </item>\n </selector>\n \n```\n\n'ListAdapterの実装部'\n\n```\n\n @Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n mDrawerListView = (ListView) inflater.inflate(\n R.layout.fragment_navigation_drawer, container, false);\n mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n selectItem(position);\n }\n });\n mDrawerListView.setAdapter(new ArrayAdapter<String>(\n getActionBar().getThemedContext(),\n R.layout.listlayout,\n android.R.id.text1,\n //android.R.layout.simple_list_item_1,\n new String[]{\n getString(R.string.title_section1),\n getString(R.string.title_section2),\n getString(R.string.title_section3),\n }));\n mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);\n return mDrawerListView;\n }\n \n```",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T08:26:14.663",
"favorite_count": 0,
"id": "16630",
"last_activity_date": "2015-09-16T09:59:00.090",
"last_edit_date": "2015-09-15T16:18:59.877",
"last_editor_user_id": "12330",
"owner_user_id": "12330",
"post_type": "question",
"score": 3,
"tags": [
"android",
"java",
"xml"
],
"title": "Androidアプリ開発において、ListViewとTextViewをLinearLayoutで並べたい。",
"view_count": 1556
} | [
{
"body": "`mDrawerListView`は以下のように取得しています。\n\n```\n\n mDrawerListView = (ListView) inflater.inflate(\n R.layout.fragment_navigation_drawer, container, false);\n \n```\n\n`inflater.inflate()`がレイアウトのルート要素を返しますので、テンプレートの\n**fragment_navigation_drawer.xml**\nの場合は、ルート要素である`ListView`をそのままキャストして利用することができるのです。\n\nそこに階層を追加して`TextView`を追加したい場合、`inflater.inflate()`で返却されるものもルート要素である`LinearLayout`になってしまいますので、その対応をする必要があります。\n\nまず、 **fragment_navigation_drawer.xml** の`ListView`に適当な`id`を付与します。\n\n```\n\n <LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:orientation=\"vertical\">\n <TextView\n android:layout_width=\"wrap_content\"\n android:layout_height=\"0dp\"\n android:layout_weight=\"1\"\n android:text=\"@string/title\"/>\n <ListView\n android:id=\"@+id/listView\" <!-- idで名前を付ける -->\n android:layout_width=\"match_parent\"\n android:layout_height=\"0dp\"\n android:layout_weight=\"4\"\n android:choiceMode=\"singleChoice\"/>\n </LinearLayout>\n \n```\n\nあとは、`onCreateView()`でリストビューを取得する処理を、以下のように修正します。\n\n```\n\n @Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n // ルート要素はLinearLayoutになっている\n View rootView = inflater.inflate(R.layout.fragment_navigation_drawer, container, false);\n // そこからレイアウトで付けた\"listView\"という名前でリストビューを取得する\n mDrawerListView = (ListView) rootView.findViewById(R.id.listView);\n mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n selectItem(position);\n }\n });\n mDrawerListView.setAdapter(new ArrayAdapter<String>(\n getActionBar().getThemedContext(),\n R.layout.listlayout,\n android.R.id.text1,\n //android.R.layout.simple_list_item_1,\n new String[]{\n getString(R.string.title_section1),\n getString(R.string.title_section2),\n getString(R.string.title_section3),\n }));\n mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);\n return rootView;\n }\n \n```",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T16:28:18.933",
"id": "16657",
"last_activity_date": "2015-09-16T09:59:00.090",
"last_edit_date": "2015-09-16T09:59:00.090",
"last_editor_user_id": "5337",
"owner_user_id": "5337",
"parent_id": "16630",
"post_type": "answer",
"score": 1
}
] | 16630 | 16657 | 16657 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "# 環境\n\n * Visual Studio 2015 Community\n * 使用したプロジェクトテンプレート:JavaScript\\Apache Cordova Apps\\空のアプリ(Apache Cordova)\n * アプリを開発している環境:Windows 10 Professional\n * アプリをデプロイしている環境:同PC\n * 使用しているプラグイン:cordova-plugin-media\n * 使用しているNuモジュール:WinJS、Processing.js\n\n# やりたいこと\n\n上記環境で開発したアプリに配置するアプリに、以下のアイコンおよびスプラッシュスクリーンを設定したいと考えています。\n\n * タイル:アプリを示すアイコンを中央に表示、背景は透過(PCのシステム設定に依存した色)\n * スプラッシュスクリーン:画面全体が白色\n\n# そのためにやったこと\n\n以下の質問を参考に、config.xmlにBackgroundColorを設定しました。\n\n * <https://stackoverflow.com/questions/27807491/splash-background-color-windows-8-cordova-tools>\n\n```\n\n <platform name=\"windows\">\n <icon src=\"res/icons/windows/Square150x150Logo.scale-100.png\" width=\"150\" height=\"150\" />\n <icon src=\"res/icons/windows/Square150x150Logo.scale-240.png\" width=\"360\" height=\"360\" />\n <icon src=\"res/icons/windows/Square30x30Logo.scale-100.png\" width=\"30\" height=\"30\" />\n <icon src=\"res/icons/windows/Square310x310Logo.scale-100.png\" width=\"310\" height=\"310\" />\n <icon src=\"res/icons/windows/Square44x44Logo.scale-240.png\" width=\"106\" height=\"106\" />\n <icon src=\"res/icons/windows/Square70x70Logo.scale-100.png\" width=\"70\" height=\"70\" />\n <icon src=\"res/icons/windows/Square71x71Logo.scale-240.png\" width=\"170\" height=\"170\" />\n <icon src=\"res/icons/windows/StoreLogo.scale-100.png\" width=\"50\" height=\"50\" />\n <icon src=\"res/icons/windows/StoreLogo.scale-240.png\" width=\"120\" height=\"120\" />\n <icon src=\"res/icons/windows/Wide310x150Logo.scale-100.png\" width=\"310\" height=\"150\" />\n <icon src=\"res/icons/windows/Wide310x150Logo.scale-240.png\" width=\"744\" height=\"360\" />\n <preference name=\"BackgroundColor\" value=\"0x00ffffff\"/> <!-- 追加 -->\n </platform>\n <platform name=\"windows\">\n <splash src=\"res/screens/windows/SplashScreen.scale-100.png\" width=\"620\" height=\"300\" />\n <splash src=\"res/screens/windows/SplashScreen.scale-240.png\" width=\"1152\" height=\"1920\" />\n <splash src=\"res/screens/windows/SplashScreenPhone.scale-240.png\" width=\"1152\" height=\"1920\" />\n <preference name=\"BackgroundColor\" value=\"0x00ffffff\"/> <!-- 追加 -->\n </platform>\n \n```\n\nしかし、最初のiconを指定している部分に指定したBackgroundColorが無視され、タイルアイコンもスプラッシュスクリーンもすべて白背景で描画されてしまいました。\n\n[](https://i.stack.imgur.com/fQsiG.png)\n\n# 質問\n\nスプラッシュスクリーンとタイルに異なる色を指定したい場合は、どのようにすればよいのでしょうか? \nApache Cordovaのリファレンスや、Monacaの開発ドキュメント、Visual\nStudioでHTML5アプリを開発するためのドキュメントを見た限り、解決策は見つかりませんでした。 \nもしご存じの方いらっしゃいましたら、アドバイスいただければと思います。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T08:42:14.330",
"favorite_count": 0,
"id": "16631",
"last_activity_date": "2016-02-06T10:08:09.037",
"last_edit_date": "2017-05-23T12:38:56.467",
"last_editor_user_id": "-1",
"owner_user_id": "12329",
"post_type": "question",
"score": 2,
"tags": [
"cordova",
"visual-studio"
],
"title": "VS Tools for Apache Cordovaで、スプラッシュスクリーンとタイルアイコンに異なる背景色を設定するには",
"view_count": 282
} | [
{
"body": "自己解決しました。 \n結果、res/native/windows/配下に、platforms/windows/配下に出力されたpackage.windows.appxmanifestファイルをコピーして編集することで対応可能なことがわかりました。 \n(解決したファイルは→ですので、よろしければご確認ください。\n<https://github.com/TakamiChie/WSAcerola/tree/master/WSAcerola/res/native/windows>)\n\n以上で本問題解決としたいと思います。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-10-09T07:23:44.250",
"id": "17471",
"last_activity_date": "2015-10-09T07:23:44.250",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12329",
"parent_id": "16631",
"post_type": "answer",
"score": 1
}
] | 16631 | null | 17471 |
{
"accepted_answer_id": "16653",
"answer_count": 2,
"body": "Navigator.replacePageでページ移動する際にアニメーションなどを指定できますが毎回右から左になっているので逆からの遷移を表現できません。左から右にする方法はあるのでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T09:27:31.220",
"favorite_count": 0,
"id": "16634",
"last_activity_date": "2015-09-17T14:01:10.517",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3965",
"post_type": "question",
"score": 4,
"tags": [
"onsen-ui"
],
"title": "replacePageで画面遷移する際のアニメーションの方向を変えたい",
"view_count": 1794
} | [
{
"body": "理解できる範囲で解析しただけなので詳しく説明できませんが、onsenui.jsをカスタマイズしないと左から右は無理のようです。 \nSimpleSlideTransitionAnimator()、IOSSlideTransitionAnimator()を直接改造するか、新たに左から右用を追加すれば実現できると思います。\n\n```\n\n // Preset transition animators.\n NavigatorView._transitionAnimatorDict = {\n 'default': $onsen.isAndroid() ? new SimpleSlideTransitionAnimator() : new IOSSlideTransitionAnimator(),\n 'slide': $onsen.isAndroid() ? new SimpleSlideTransitionAnimator() : new IOSSlideTransitionAnimator(),\n 'simpleslide': new SimpleSlideTransitionAnimator(),\n 'lift': new LiftTransitionAnimator(),\n 'fade': new FadeTransitionAnimator(),\n 'none': new NullTransitionAnimator()\n };\n \n```\n\nSimpleSlideTransitionAnimator()だけ試してみましたが、translate3D()のX軸の値を左から右に変更したところ、実現できました。 \n※11908行にSimpleSlideTransitionAnimatorのfactoryを定義した行があります。 \npushの部分だけ抜粋しますが、enterPageは100%(右)から0(左)に移動するので、-100%(左)に変更すれば0(右)に向かって移動します。 \n押し出されるleavePageは0(右)から-45%(左)に移動するので、45%(右)に変更すれば0(左)から右に移動します。\n\n```\n\n push: function(enterPage, leavePage, callback) {\n var mask = this.backgroundMask.remove();\n leavePage.element[0].parentNode.insertBefore(mask[0], leavePage.element[0].nextSibling);\n \n animit.runAll(\n \n animit(mask[0])\n .queue({\n opacity: 0,\n transform: 'translate3d(0, 0, 0)'\n })\n .queue({\n opacity: this.blackMaskOpacity\n }, {\n duration: this.duration,\n timing: this.timing\n })\n .resetStyle()\n .queue(function(done) {\n mask.remove();\n done();\n }),\n \n animit(enterPage.element[0])\n .queue({\n css: {\n transform: 'translate3D(-100%, 0, 0)', //'translate3D(100%, 0, 0)',\n },\n duration: 0\n })\n .queue({\n css: {\n transform: 'translate3D(0, 0, 0)',\n },\n duration: this.duration,\n timing: this.timing\n })\n .resetStyle(),\n \n animit(leavePage.element[0])\n .queue({\n css: {\n transform: 'translate3D(0, 0, 0)'\n },\n duration: 0\n })\n .queue({\n css: {\n transform: 'translate3D(45%, 0px, 0px)' //'translate3D(-45%, 0px, 0px)'\n },\n duration: this.duration,\n timing: this.timing\n })\n .resetStyle()\n .wait(0.2)\n .queue(function(done) {\n callback();\n done();\n })\n );\n },\n \n```\n\n**追記** \ncitherさんにコメントをいただいたので、onsenui.jsをカスタマイズしないやり方を試してみました。 \nSimpleSlideTransitionAnimatorのfactoryをコピー、値を変更して\"slideLtoR\"というアニメーションとして動作させます。\n\n参考にしたページ \n[pushPage animation for sliding from right to left\n#410](https://github.com/OnsenUI/OnsenUI/issues/410)\n\n```\n\n app.factory('SimpleSlideTransitionAnimatorLtoR', ['NavigatorTransitionAnimator', function(NavigatorTransitionAnimator) {\n var SimpleSlideTransitionAnimatorLtoR = NavigatorTransitionAnimator.extend({\n //\n // 省略\n //\n });\n return SimpleSlideTransitionAnimatorLtoR;\n }]);\n app.run(function(NavigatorView, SimpleSlideTransitionAnimatorLtoR) {\n NavigatorView.registerTransitionAnimator(\"slideLtoR\", new SimpleSlideTransitionAnimatorLtoR());\n });\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T15:28:45.443",
"id": "16653",
"last_activity_date": "2015-09-16T02:07:53.007",
"last_edit_date": "2015-09-16T02:07:53.007",
"last_editor_user_id": "9566",
"owner_user_id": "9566",
"parent_id": "16634",
"post_type": "answer",
"score": 2
},
{
"body": "ありがとうございます動きました\n\nonsenuiのSimpleSlideTransitionAnimatorの部分を使用してパラメータを一部調整すればいけました。\n\nslideの向きが片方しかないのでなんとかする方法はないかと悩んでいましたがonsenuiのソースをあまり弄りたくなかったので独自にfactoryを利用する方法は助かります。\n\n```\n\n <!doctype html>\n <html lang=\"ja\">\n <head>\n <meta charset=\"utf-8\">\n <link rel=\"stylesheet\" href=\"onsenui/css/onsenui.css\"/>\n <link rel=\"stylesheet\" href=\"onsenui/css/onsen-css-components.css\"/>\n <script src=\"onsenui/js/angular/angular.js\"></script>\n <script src=\"onsenui/js/onsenui.js\"></script>\n <script>\n var module = ons.bootstrap('my-app', ['onsen']);\n \n module.factory('SimpleSlideTransitionAnimatorLtoR', ['NavigatorTransitionAnimator', function(NavigatorTransitionAnimator) {\n var SimpleSlideTransitionAnimatorLtoR = NavigatorTransitionAnimator.extend({\n /** Black mask */\n backgroundMask : angular.element(\n '<div style=\"z-index: 2; position: absolute; width: 100%;' +\n 'height: 100%; background-color: black; opacity: 0;\"></div>'\n ),\n \n timing: 'cubic-bezier(.1, .7, .4, 1)',\n duration: 0.3,\n blackMaskOpacity: 0.4,\n \n init: function(options) {\n options = options || {};\n \n this.timing = options.timing || this.timing;\n this.duration = options.duration !== undefined ? options.duration : this.duration;\n },\n \n /**\n * @param {Object} enterPage\n * @param {Object} leavePage\n * @param {Function} callback\n */\n push: function(enterPage, leavePage, callback) {\n var mask = this.backgroundMask.remove();\n leavePage.element[0].parentNode.insertBefore(mask[0], leavePage.element[0].nextSibling);\n \n animit.runAll(\n \n animit(mask[0])\n .queue({\n opacity: 0,\n transform: 'translate3d(0, 0, 0)'\n })\n .queue({\n opacity: this.blackMaskOpacity\n }, {\n duration: this.duration,\n timing: this.timing\n })\n .resetStyle()\n .queue(function(done) {\n mask.remove();\n done();\n }),\n \n animit(enterPage.element[0])\n .queue({\n css: {\n transform: 'translate3D(-100%, 0, 0)',\n },\n duration: 0\n })\n .queue({\n css: {\n transform: 'translate3D(0, 0, 0)',\n },\n duration: this.duration,\n timing: this.timing\n })\n .resetStyle(),\n \n animit(leavePage.element[0])\n .queue({\n css: {\n transform: 'translate3D(0, 0, 0)'\n },\n duration: 0\n })\n .queue({\n css: {\n transform: 'translate3D(45%, 0px, 0px)'\n },\n duration: this.duration,\n timing: this.timing\n })\n .resetStyle()\n .wait(0.2)\n .queue(function(done) {\n callback();\n done();\n })\n );\n },\n \n /**\n * @param {Object} enterPage\n * @param {Object} leavePage\n * @param {Function} done\n */\n pop: function(enterPage, leavePage, done) {\n var mask = this.backgroundMask.remove();\n enterPage.element[0].parentNode.insertBefore(mask[0], enterPage.element[0].nextSibling);\n \n animit.runAll(\n \n animit(mask[0])\n .queue({\n opacity: this.blackMaskOpacity,\n transform: 'translate3d(0, 0, 0)'\n })\n .queue({\n opacity: 0\n }, {\n duration: this.duration,\n timing: this.timing\n })\n .resetStyle()\n .queue(function(done) {\n mask.remove();\n done();\n }),\n \n animit(enterPage.element[0])\n .queue({\n css: {\n transform: 'translate3D(-45%, 0px, 0px)',\n opacity: 0.9\n },\n duration: 0\n })\n .queue({\n css: {\n transform: 'translate3D(0px, 0px, 0px)',\n opacity: 1.0\n },\n duration: this.duration,\n timing: this.timing\n })\n .resetStyle(),\n \n animit(leavePage.element[0])\n .queue({\n css: {\n transform: 'translate3D(0px, 0px, 0px)'\n },\n duration: 0\n })\n .queue({\n css: {\n transform: 'translate3D(100%, 0px, 0px)'\n },\n duration: this.duration,\n timing: this.timing\n })\n .wait(0.2)\n .queue(function(finish) {\n done();\n finish();\n })\n );\n }\n });\n return SimpleSlideTransitionAnimatorLtoR;\n }]);\n module.run(function(NavigatorView, SimpleSlideTransitionAnimatorLtoR) {\n NavigatorView.registerTransitionAnimator(\"slideLtoR\", new SimpleSlideTransitionAnimatorLtoR());\n });\n \n module.controller('AppController', function($scope) {\n $scope.page1Move = function(){\n myNavigator.replacePage('page1.html', {animation: 'slideLtoR'});\n };\n \n $scope.page2Move = function(){\n myNavigator.replacePage('page2.html', {animation: 'slide'});\n };\n });\n \n </script>\n </head>\n <body ng-controller=\"AppController\">\n <ons-navigator var=\"myNavigator\" page=\"page1.html\"></ons-navigator>\n <ons-template id=\"page1.html\">\n <ons-page>\n <ons-toolbar>\n <div class=\"center\">Title</div>\n </ons-toolbar>\n \n <p style=\"text-align: center\">\n <ons-button modifier=\"light\" ng-click=\"page1Move()\">Push1</ons-button>\n <ons-button modifier=\"light\" ng-click=\"page2Move()\">Push2</ons-button>\n </p>\n </ons-page>\n </ons-template>\n <ons-template id=\"page2.html\">\n <ons-page>\n <ons-toolbar>\n <div class=\"center\">Title</div>\n </ons-toolbar>\n \n <p style=\"text-align: center\">\n <ons-button modifier=\"light\" ng-click=\"page1Move()\">Push1</ons-button>\n <ons-button modifier=\"light\" ng-click=\"page2Move()\">Push2</ons-button>\n </p>\n </ons-page>\n </ons-template>\n </body>\n </html>\n \n```\n\n<https://youtu.be/dp3F75f-pAM>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-17T14:01:10.517",
"id": "16720",
"last_activity_date": "2015-09-17T14:01:10.517",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3965",
"parent_id": "16634",
"post_type": "answer",
"score": 1
}
] | 16634 | 16653 | 16653 |
{
"accepted_answer_id": "16651",
"answer_count": 1,
"body": "下記のようにvar属性にcarouselコンポーネントを指定しております。\n\n```\n\n <ons-carousel swipeable overscrollable auto-scroll fullscreen var=\"app.carousel\" ng-controller=\"FooController\">\n \n```\n\n次にコントローラーでcarouselをログに出力しました所、undefinedが返って来てしまいます。 \nこちらのコードの問題点わかりましたらご教示頂ければと思います。\n\nよろしくお願いいたします。\n\n```\n\n (function(){\n 'use strict';\n \n app.controller('FooController', ['$scope', function($scope) {\n console.log(app.carousel);\n }]);\n })();\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T10:08:43.487",
"favorite_count": 0,
"id": "16636",
"last_activity_date": "2015-09-15T14:56:45.487",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10753",
"post_type": "question",
"score": 1,
"tags": [
"onsen-ui"
],
"title": "var属性に指定したコンポーネントをコントローラーで使用できない",
"view_count": 300
} | [
{
"body": "コンポーネントにアクセスするにはOnsenUIの初期化完了を待つ必要がありますので、`ons.ready()`関数を利用してください。\n\n```\n\n (function(){\n 'use strict';\n \n app.controller('FooController', ['$scope', function($scope) {\n ons.ready(function(){\n console.log(app.carousel);\n });\n }]);\n })();\n \n```\n\n参考 \n<http://ja.onsen.io/guide/overview.html#UsingVarAttributeToSpecifyAComponent>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T14:16:22.447",
"id": "16651",
"last_activity_date": "2015-09-15T14:56:45.487",
"last_edit_date": "2015-09-15T14:56:45.487",
"last_editor_user_id": "8532",
"owner_user_id": "8532",
"parent_id": "16636",
"post_type": "answer",
"score": 1
}
] | 16636 | 16651 | 16651 |
{
"accepted_answer_id": "16640",
"answer_count": 2,
"body": "DataGridViewに表示したデータに対し、選択したレコードを処理するメソッドと \nDataGridViewに表示した全てのレコードを処理するメソッドを共通にしたいのですが、 \nタイトルの二つのCollectionはどちらかにキャストしたりできないでしょうか? \n(共通メソッドの引数を同じにできればと考えています。)\n\n最悪、全てのレコードを処理する場合には全て選択させてDataGridViewSelectedRowCollectionを \n処理する方法もあるかと思いますが、なんかきれいじゃない気がしまして。。\n\nお知恵を拝借できれば幸いです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T10:40:10.493",
"favorite_count": 0,
"id": "16639",
"last_activity_date": "2015-09-15T12:28:56.130",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9228",
"post_type": "question",
"score": 2,
"tags": [
"c#",
"winforms"
],
"title": "C# DataGridViewSelectedRowCollectionとDataGridViewRowCollection",
"view_count": 1182
} | [
{
"body": "それぞれの値に`.Cast<DataGridViewRow>()`を付ければ`IEnumerable<DataGridViewRow>`型にラップ出来ます。`foreach`のみであればこの型で十分です。\n\nまたリストであることが必要なのであれば、`IList`型を引数にするのが良いと思います。この場合コレクションは変換不要ですが、各要素を`DataGridViewRow`にキャストする必要があります。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T10:49:48.273",
"id": "16640",
"last_activity_date": "2015-09-15T10:49:48.273",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5750",
"parent_id": "16639",
"post_type": "answer",
"score": 3
},
{
"body": "LINQを用いてDataGridViewRowの配列に変換すれば良いでしょう。\n\n```\n\n IList<DataGridViewRow> list = rows\n .OfType<DataGridViewRow>() // DataGridViewRowに変換できた要素のみ通す\n .ToArray(); // 配列化する。\n \n```\n\nOfTypeと似ているものにCastがありますが、Castは、キャストできない場合に例外がスローされます。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-09-15T12:28:56.130",
"id": "16645",
"last_activity_date": "2015-09-15T12:28:56.130",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "2207",
"parent_id": "16639",
"post_type": "answer",
"score": 2
}
] | 16639 | 16640 | 16640 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.