question
dict
answers
list
id
stringlengths
2
5
accepted_answer_id
stringlengths
2
5
popular_answer_id
stringlengths
2
5
{ "accepted_answer_id": "15135", "answer_count": 2, "body": "ons-listと、ons-list-itemを使って、リスト表示するアプリを作りました。 \nlistの下の方まで閲覧しているとき、メニューの「先頭を表示」ボタンを押すことで、listを巻き戻し、先頭のlist-\nitemから表示できるようにしたいと思っています。 \nどのようにすれば良いのでしょうか?\n\n初歩的なことかもしれませんが、よろしくお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-01T17:16:38.250", "favorite_count": 0, "id": "15125", "last_activity_date": "2015-09-02T02:34:11.990", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11105", "post_type": "question", "score": 0, "tags": [ "monaca", "onsen-ui" ], "title": "ons-listでボタンを押したとき、先頭のlist-itemを表示させたい。", "view_count": 751 }
[ { "body": "[ons-list の初期位置](https://ja.stackoverflow.com/questions/14722/ons-\nlist-%E3%81%AE%E5%88%9D%E6%9C%9F%E4%BD%8D%E7%BD%AE)\n\nと同様に、AngularJSを利用して、先頭のons-list-\nitemにidを設定し、「先頭を表示」ボタン押下時に$location.hash()、$anchorScroll()を実行すれば、先頭から表示させることができます。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T01:55:44.967", "id": "15131", "last_activity_date": "2015-09-02T01:55:44.967", "last_edit_date": "2017-04-13T12:52:39.113", "last_editor_user_id": "-1", "owner_user_id": "9566", "parent_id": "15125", "post_type": "answer", "score": 1 }, { "body": "対象ノードの`scrollTop`を設定する方法もあるようなので参考程度に記載しておきます。 \nせっかくなので、oTakさんの記載している方法も盛り込んでみました。\n\n```\n\n ons.bootstrap()\r\n .controller('ListCtrl', ['$scope', '$location', '$anchorScroll', function($scope, $location, $anchorScroll) {\r\n $scope.top = function() {\r\n // もっと上手い取り方があるかもしれません\r\n var elem = myList._element[0];\r\n elem.parentNode.scrollTop = 0;\r\n }\r\n $scope.top2 = function() {\r\n $location.hash(\"scrollTop\");\r\n $anchorScroll();\r\n }\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-navigator title=\"Navigator\" var=\"myNavigator\">\r\n <ons-page ng-controller=\"ListCtrl\">\r\n <ons-toolbar>\r\n <div class=\"left\">\r\n <ons-toolbar-button ng-click=\"top()\">scrollTop</ons-toolbar-button>\r\n <ons-toolbar-button ng-click=\"top2()\">anchorScroll</ons-toolbar-button>\r\n </div>\r\n <div class=\"center\">Basic List</div>\r\n </ons-toolbar>\r\n <ons-scroller>\r\n <ons-list var=\"myList\">\r\n <ons-list-header id=\"scrollTop\">Numbers</ons-list-header>\r\n <ons-list-item>One</ons-list-item>\r\n <ons-list-item>Two</ons-list-item>\r\n <ons-list-item>Three</ons-list-item>\r\n <ons-list-item>Four</ons-list-item>\r\n <ons-list-item>Five</ons-list-item>\r\n <ons-list-item>Six</ons-list-item>\r\n <ons-list-item>One</ons-list-item>\r\n <ons-list-item>Two</ons-list-item>\r\n <ons-list-item>Three</ons-list-item>\r\n <ons-list-item>Four</ons-list-item>\r\n <ons-list-item>Five</ons-list-item>\r\n <ons-list-item>Six</ons-list-item>\r\n <ons-list-item>One</ons-list-item>\r\n <ons-list-item>Two</ons-list-item>\r\n <ons-list-item>Three</ons-list-item>\r\n <ons-list-item>Four</ons-list-item>\r\n <ons-list-item>Five</ons-list-item>\r\n <ons-list-item>Six</ons-list-item>\r\n <ons-list-item>One</ons-list-item>\r\n <ons-list-item>Two</ons-list-item>\r\n <ons-list-item>Three</ons-list-item>\r\n <ons-list-item>Four</ons-list-item>\r\n <ons-list-item>Five</ons-list-item>\r\n <ons-list-item>Six</ons-list-item>\r\n \r\n <ons-list-header>Tappable Numbers</ons-list-header>\r\n <ons-list-item modifier=\"tappable\">Tap Me</ons-list-item>\r\n <ons-list-item modifier=\"tappable\">Tap Me</ons-list-item>\r\n <ons-list-item modifier=\"tappable\">Tap Me</ons-list-item>\r\n <ons-list-item modifier=\"tappable\">Tap Me</ons-list-item>\r\n <ons-list-item modifier=\"tappable\">Tap Me</ons-list-item>\r\n <ons-list-item modifier=\"tappable\">Tap Me</ons-list-item>\r\n </ons-list>\r\n </ons-scroller>\r\n </ons-page>\r\n </ons-navigator>\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": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T02:34:11.990", "id": "15135", "last_activity_date": "2015-09-02T02:34:11.990", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3516", "parent_id": "15125", "post_type": "answer", "score": 1 } ]
15125
15135
15131
{ "accepted_answer_id": null, "answer_count": 2, "body": "タイマーをjsで作る際に下記のように再帰呼び出しで作ることがよくあると思います。 \nこの処理がうまくいくことが疑問です。\n\n```\n\n function timers(){\n timerId = setTimeout(function() {\n //処理\n timers();\n }, 10);\n }\n \n function stoptimers() {\n clearTimeout(timerId);\n }\n \n```\n\n変数timerIdに入ったタイマーIDを引数にclearTimeoutをしているのでタイマーが止まる仕組みなのはわかるのですが、再帰呼び出しで無限ループしていると=の右の処理が終了していないので代入は行われないのではないでしょうか?どのタイミングで変数timerIdに値が入っているのか不明です。\n\nご存知の方教えてください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T00:16:37.023", "favorite_count": 0, "id": "15127", "last_activity_date": "2015-09-02T16:08:25.863", "last_edit_date": "2015-09-02T00:41:42.163", "last_editor_user_id": "5044", "owner_user_id": "8823", "post_type": "question", "score": 3, "tags": [ "javascript" ], "title": "js timer処理の再帰呼び出しループの疑問", "view_count": 1862 }
[ { "body": "代入の時点では再帰呼び出し(?)は起こっていなくて、単に関数式として保持されるだけ(指定時間経過後に呼び出されて実行される)なので、呼び出す処理が終わっていなくても代入を完了できます。\n\n* * *\n\n関数式は引数として渡された時に実行されてその結果に置き換えられるのではなくて単に関数オブジェクトなので、これを再帰呼び出しというかは疑問に思います。 \nおそらくは、キューのようなものに \n[`function() {timers(); }`,`function() {別の関数とか(); }`,`function() {timers();\n}/*※同時には積まれない。次の(つまり未来の)やつのつもり*/`,...]//キューのつもり \nのように並びで格納されて先から呼び出されて消費される。 \nというようなイメージで実行されるかと思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T00:36:03.837", "id": "15128", "last_activity_date": "2015-09-02T01:01:47.960", "last_edit_date": "2015-09-02T01:01:47.960", "last_editor_user_id": "5044", "owner_user_id": "5044", "parent_id": "15127", "post_type": "answer", "score": 1 }, { "body": "一番分かりやすいのは、ブラウザで実際にsetTimeout関数を実行してみることです。Google\nChromeのコンソールなどで以下のコードを実行してみてください。\n\n```\n\n setTimeout(function() { console.debug('done'); }, 1000)\n \n```\n\n実行直後に表示される数値がsetTimeout関数の戻り値であるtimeoutIDです。その1秒後に、コンソール上に「done」と表示されるはずです。\n\njavascriptの関数は第1級オブジェクトと呼ばれ、変数に代入したり、関数の引数や戻り値にしたりできます。setTimeout関数の第1引数は関数です。例のソースでは、その場で無名関数を定義をし引数として渡しているので、慣れないうちはややこしく感じるかもしれません。\n\n以下のソースを見れば理解しやすいかと思います。(処理としては等価です)\n\n```\n\n function timers() {\n timerId = setTimeout(next, 10);\n // ↑ next関数を呼び出しているのではなく、関数定義を渡している\n // next関数を呼び出したい場合はnext()のように括弧が必要\n }\n \n function next() {\n console.debug('next');\n timers();\n }\n ....\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T15:57:53.770", "id": "15154", "last_activity_date": "2015-09-02T16:08:25.863", "last_edit_date": "2015-09-02T16:08:25.863", "last_editor_user_id": "9608", "owner_user_id": "9608", "parent_id": "15127", "post_type": "answer", "score": 1 } ]
15127
null
15128
{ "accepted_answer_id": null, "answer_count": 1, "body": "非常に長いのですが、一向に解決しないので質問させてください。 \n迷路ゲームを参考書をもとにscriptを描いたのですが、\n\n```\n\n UnityException: Tag: sphere is not defined!\n MazeAppScript.ReSet () (at Assets/MazeAppScript.cs:73)\n MazeAppScript.Start () (at Assets/MazeAppScript.cs:19)\n \n```\n\nのエラーが出てしまいました。 \n`CreateSphere()`メソッドでタグは追加してるのですが、どうにもうまくいきません、恐縮ですがご指摘どうかお願いいたします。\n\n```\n\n using UnityEngine;\n using System.Collections;\n \n public class MazeAppScript : MonoBehaviour {\n private System.Random rnd;\n private bool endFlg = false;\n public int power = 100;\n public int gameTime = 300;\n private int playTime = 300;\n private int endTime = 300;\n public int mazeSize = 10;\n public float mazeLevel = 1;\n private int hiScore = 0;\n private bool toolFlg = false;\n // Use this for initialization\n void Start () {\n rnd = new System.Random (System.Environment.TickCount);\n LoadPref ();\n ReSet ();\n }\n \n // Update is called once per frame\n void Update () {\n if (Input.GetKeyDown (KeyCode.Space)) {\n toolFlg = !toolFlg; \n if(!toolFlg){SavePref();}\n }\n if (endFlg) { return; }\n playTime = endTime - (int)Time.time;\n CheckTime ();\n }\n \n void OnGuI(){\n GUI.Box (new Rect (10, 10, 100, 100), \"POWRE/TIME\");\n GUI.Label (new Rect (20, 40, 80, 20), \"power:\" + power);\n GUI.Label (new Rect (20, 70, 80, 20), \"TIME:\" + playTime);\n if (toolFlg) {\n GUI.Box (new Rect(120,10,100,40),\"Size\");\n mazeSize = (int)(GUI.HorizontalSlider(new Rect(130,30,80,20),\n mazeSize,5f,30f));\n GUI.Box(new Rect(120,60,100,40),\"Level\");\n mazeLevel = GUI.HorizontalSlider(new Rect(130,30,80,20)\n ,mazeLevel,0,10f);\n GUI.Box(new Rect(120,110,100,50),\"Restart\");\n if(GUI.Button (new Rect(130,130,80,20),\"DO-IT!\")){\n ReSet();\n }\n \n \n }\n }\n \n void LoadPref(){\n int loadSize = PlayerPrefs.GetInt (\"mazeSize\");\n mazeLevel = PlayerPrefs.GetFloat (\"mazeLevel\");\n hiScore = PlayerPrefs.GetInt (\"hiScore\");\n if (loadSize != 0) {\n mazeSize = loadSize;\n }\n }\n \n void SavePref(){\n PlayerPrefs.SetInt (\"mazeSize\", mazeSize);\n PlayerPrefs.SetFloat (\"mazeLevel\", mazeLevel);\n }\n \n void ReSet(){\n SavePref ();\n GameObject[] walls = GameObject.FindGameObjectsWithTag(\"ob_wall\");\n foreach (GameObject obj in walls) {\n GameObject.Destroy(obj); \n }\n GameObject[] sps = GameObject.FindGameObjectsWithTag(\"sphere\");\n foreach (GameObject obj in sps) {\n GameObject.Destroy(obj);\n }\n GameObject.Find (\"GUI Text\").guiText.text = \"\";\n CreateMazeData ();\n CreateSphere ();\n power = 100;\n endTime = gameTime + (int)Time.time;\n toolFlg = false;\n endFlg = false;\n }\n \n void CreateMazeData(){\n int mazeW = mazeSize * 4 + 2;\n bool[,] fdata = new bool[mazeW, mazeW];\n for (int i = 0; i < mazeW; i++) {\n for (int j = 0; j < mazeW; i++) {\n if(i == 0 || i == (mazeW - 1)||\n j == 0 || j == (mazeW - 1)){\n fdata[i,j] = true;\n }else{\n fdata[i,j] = false;\n }\n }\n }\n int[,] arw = new int[,]{\n {0,-1},{0,1},{-1,0},{1,0}\n };\n for (int i = 0; i < (mazeSize / 2)*(mazeSize / 2); i++) {\n while(true){\n int x = rnd.Next (1, mazeSize) * 4;\n int y = rnd.Next (1, mazeSize) * 4;\n int n = i % 4;\n fdata[x,y] = true;\n while(true){\n x += arw[n,0];\n y += arw[n,1];\n if(fdata[x,y]){\n break;\n }else{\n fdata[x,y] = true;\n }\n }\n break;\n }\n }\n int cp = mazeW / 2;\n fdata[cp,cp] = false;\n GameObject.Find(\"DefaultAvatar\").transform.position = new Vector3(cp, 0, cp);\n CreateMaze (fdata);\n \n int [,] gdatas = new int[,]{\n {1,1},{1,mazeW},{mazeW - 2,1},{mazeW - 2 ,mazeW - 2}\n };\n int gn = rnd.Next (4);\n Vector3 goalpos = new Vector3 (gdatas [gn, 0], 1.5f, gdatas [gn, 1]);\n GameObject.Find (\"goal\").transform.position = goalpos;\n \n }\n void CreateMaze(bool[,] data){\n int mazeW = mazeSize * 4 + 2;\n Texture txtr = (Texture)Resources.Load(\"Grass&Rock\");\n for (int i = 0; i < mazeW; i++) {\n for(int j = 0; j < mazeW ; j++){ \n if(data[i,j]){\n GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Cube);\n obj.tag = \"ob_wall\";\n obj.transform.localScale = new Vector3(1,2,1);\n obj.transform.position = new Vector3(i,1,j);\n obj.renderer.material.mainTexture = txtr;\n obj.collider.isTrigger = true;\n GameObject obj2 = GameObject.CreatePrimitive(PrimitiveType.Cube);\n obj2.tag = \"ob_wall\";\n obj2.transform.localScale = new Vector3(0.9f,0.9f,0.9f);\n obj2.transform.position = new Vector3(i,1,j);\n }\n }\n }\n }\n \n void CreateSphere(){\n for (int i = 0; i < (mazeSize / 2); i++) {\n GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Sphere);\n obj.tag = \"sphere\";\n obj.renderer.material.color = new Color(1,0,0,0.5f);\n obj.renderer.material.shader = Shader.Find(\"Transparent/Diffuse\");\n obj.AddComponent(\"Rigidbody\");\n obj.transform.position = new Vector3(rnd.Next(mazeSize) * 4 + 2, 0, rnd.Next(mazeSize) * 4 + 1);\n obj.AddComponent(\"MazeSphereScript\");\n }\n }\n \n public bool IsEnd(){\n return endFlg;\n }\n \n public void LossPower(int n){\n power -= n;\n if(power <= 0){\n power = 0;\n BadEnd();\n }\n }\n \n public void CheckTime(){\n if (playTime <= 0) {\n BadEnd(); \n }\n }\n \n public void BadEnd(){\n endFlg = true;\n int score = (int)(power * mazeLevel + playTime * mazeSize);\n GameObject obj = GameObject.Find (\"GUI TEXT\");\n obj.guiText.color = Color.blue;\n obj.guiText.text = \"GAME OVER\" + \"\\n\" + \"SCORE:\" + score;\n PlayerPrefs.SetInt (\"hiscore\", 1);\n \n }\n \n public void GoodEnd(){\n endFlg = true;\n GameObject obj = GameObject.Find(\"GUI Text\");\n int score = (int)(power * mazeLevel * 2 + playTime * mazeSize * 2);\n string msg = \"CLEAR!!\";\n obj.guiText.color = Color.yellow;\n if (score > hiScore) {\n hiScore = score;\n msg = \"Hi-score\";\n PlayerPrefs.SetInt (\"hiScore\", hiScore);\n obj.guiText.color = Color.red;\n }\n msg += \"\\n\" + \"SCORE:\" + score;\n obj.guiText.text = msg;\n }\n \n```", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T02:11:14.030", "favorite_count": 0, "id": "15133", "last_activity_date": "2015-09-20T07:53:44.120", "last_edit_date": "2015-09-04T00:42:45.623", "last_editor_user_id": "7290", "owner_user_id": "11175", "post_type": "question", "score": 0, "tags": [ "c#", "unity3d" ], "title": "Unity 迷路ゲーム", "view_count": 710 }
[ { "body": "コメント欄の皆様の意見にもあるように、タグマネージャーに\"sphere\"のタグが登録されていないからだと思われます。 \nFindGameObjectsWithTag関数は登録されていないタグを引数として指定すると例外を発生させるようです。 \n<http://docs.unity3d.com/ja/current/ScriptReference/GameObject.FindGameObjectsWithTag.html> \n \nEditor上でタグを追加するには、メニュー > Edit > Project Setting > Tags and Layers から設定できます。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-20T07:53:44.120", "id": "16794", "last_activity_date": "2015-09-20T07:53:44.120", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12383", "parent_id": "15133", "post_type": "answer", "score": 1 } ]
15133
null
16794
{ "accepted_answer_id": "15148", "answer_count": 1, "body": "PHP+MySQLでWebアプリケーションを開発しています。 \nスマホからの絵文字がutf8では保存できないので、utf8mb4に変更しました。これでハートや太陽などは入るようになったのですが、人の顔のような絵文字は??になります。そこで、質問があります。\n\n * utf8mb4でも、保存できる絵文字とできない絵文字が存在するのでしょうか。\n * それとも、設定に不足か間違いがあって、本来全て保存できるものでしょうか?\n * 保存できるものとできないものがある場合、違いは何でしょうか。見分ける方法等はありますか?\n\nぐぐっても回答が見つからず、困っております。情報へのポインタだけでも構いませんので、何卒よろしくお願いします。\n\n追記:環境 \nCentOS6.5 \nApache2.2.15 \nPHP5.6.12 \nMySQL5.5.28 \nフレームワーク 自作\n\nmy.cnfより抜粋\n\n```\n\n [mysqld]\n \n # character-set\n character-set-server=utf8mb4\n skip-character-set-client-handshake\n \n [client]\n #default-character-set=utf8\n \n [mysql]\n default-character-set=utf8\n \n [mysqldump]\n default-character-set=utf8\n \n```\n\nphp.ini内に特に文字コードの設定なし \n([mbstring]セクションはすべてコメントアウトされている)", "comment_count": 5, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T02:21:13.920", "favorite_count": 0, "id": "15134", "last_activity_date": "2015-09-02T13:48:26.143", "last_edit_date": "2015-09-02T13:48:26.143", "last_editor_user_id": "11176", "owner_user_id": "11176", "post_type": "question", "score": 5, "tags": [ "php", "mysql", "database" ], "title": "MySQLの文字コードをutf8mb4に変更したが、絵文字がうまく入らない", "view_count": 11151 }
[ { "body": "utf8mb4 はすべての絵文字が入ります。\n\n「?」になってしまうということは、テーブルやカラムの charset がちゃんと utf8mb4 になっていないか、クライアントからの接続が utf8mb4\nになっていないということが考えられます。\n\n接続の charset は `SHOW VARIABLES LIKE '%char%'` クエリで確認できます。\n\n接続の charset は接続毎に設定されるので、mysql コマンドで接続したときの charset がちゃんと utf8mb4 だったとしても、PHP\nアプリケーションからの接続では異なっている場合があります。\n\n自分は PHP には詳しくないのですが、PHP アプリケーション内で MySQL 接続用の charset\nを指定できるパラメータがあると思いますので、それがちゃんと utf8mb4 になっているのかを確認してみるのが良いと思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T12:51:59.753", "id": "15148", "last_activity_date": "2015-09-02T12:51:59.753", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3249", "parent_id": "15134", "post_type": "answer", "score": 4 } ]
15134
15148
15148
{ "accepted_answer_id": null, "answer_count": 0, "body": "Cordova でiOS向けのハイブリッドアプリを開発しています。 \n標準のUIWebViewだと動作が遅いため、WKWebViewを利用しています。\n\n現状、Cordovaは、まだWKWebViewに正式対応していないため、開発中のwkwebview-engineを利用してます。 \n<https://github.com/apache/cordova-plugins/tree/master/wkwebview-engine>\n\n## 問題\n\nこのwkwebview-\nengineは開発バージョンですが、アプリは問題なく動作しています。ただ、input要素(type=text)や、textareaに日本語を入力しようとすると、WKWebViewがcrashして落ちてしまいます。\n\nCordova+WKWebViewの環境は以下のようにして作成してます。\n\n```\n\n $ cordova create hello com.example.hello \"HelloWorld\"\n $ cd hello\n $ cordova platform add ios@4.0.x --usegit\n $ cordova plugin add https://github.com/apache/cordova-plugins.git#master:wkwebview-engine\n \n```\n\nwww/index.html にinput type=\"text\"\nの要素を追加して実機で動作させ、input要素に対して日本語入力をするとWKWebViewがcrashします。\n\n## これまでに調査した内容\n\nWKWebView単体で利用した場合、日本語入力はできました。 \nCordovaと併用してWKWebViewを利用した場合に発生する問題のようです。 \nなお、エミュレータでは問題なく入力できました。実機で動作させた場合のみ発生します。\n\n## 環境\n\n私の環境は以下の通りです。 \niPad Air2 (iOS 8.4.1) \nCordova 5.2.0 \ncordova-ios: 4.0.x\n\n## クラッシュログ\n\n```\n\n Incident Identifier: DE387028-4C20-4E1E-B3E2-3B90B6160C8B\n CrashReporter Key: 8efab59a8f19fbe4dc7c57c0483ef6ceba677767\n Hardware Model: iPad5,4\n Process: com.apple.WebKit.WebContent [1506]\n Path: /System/Library/Frameworks/WebKit.framework/XPCServices/com.apple.WebKit.WebContent.xpc/com.apple.WebKit.WebContent\n Identifier: com.apple.WebKit.WebContent\n Version: 8600.1.4.17.9 (8600)\n Code Type: ARM-64 (Native)\n Parent Process: launchd [1]\n \n Date/Time: 2015-09-10 14:42:20.820 +0900\n Launch Time: 2015-09-10 14:42:01.103 +0900\n OS Version: iOS 8.4.1 (12H321)\n Report Version: 105\n \n Exception Type: EXC_BAD_ACCESS (SIGSEGV)\n Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000018\n Triggered by Thread: 0\n \n Thread 0 name: Dispatch queue: com.apple.main-thread\n Thread 0 Crashed:\n 0 WebCore 0x00000001954fa9bc WebCore::VisibleSelection::VisibleSelection(WebCore::Range const*, WebCore::EAffinity, bool) + 40\n 1 WebKit 0x000000018b3e0670 WebKit::WebPage::setCompositionAsync(WTF::String const&, WTF::Vector<WebCore::CompositionUnderline, 0ul, WTF::CrashOnOverflow>, WebKit::EditingRange const&, WebKit::EditingRange const&) + 136\n 2 WebKit 0x000000018b3e0670 WebKit::WebPage::setCompositionAsync(WTF::String const&, WTF::Vector<WebCore::CompositionUnderline, 0ul, WTF::CrashOnOverflow>, WebKit::EditingRange const&, WebKit::EditingRange const&) + 136\n 3 WebKit 0x000000018b3ef2cc void IPC::callMemberFunctionImpl<WebKit::WebPage, void (WebKit::WebPage::*)(WTF::String const&, WTF::Vector<WebCore::CompositionUnderline, 0ul, WTF::CrashOnOverflow>, WebKit::EditingRange const&, WebKit::EditingRange const&), std::__1::tuple<WTF::String, WTF::Vector<WebCore::CompositionUnderline, 0ul, WTF::CrashOnOverflow>, WebKit::EditingRange, WebKit::EditingRange>, 0ul, 1ul, 2ul, 3ul>(WebKit::WebPage*, void (WebKit::WebPage::*)(WTF::String const&, WTF::Vector<WebCore::CompositionUnderline, 0ul, WTF::CrashOnOverflow>, WebKit::EditingRange const&, WebKit::EditingRange const&), std::__1::tuple<WTF::String, WTF::Vector<WebCore::CompositionUnderline, 0ul, WTF::CrashOnOverflow>, WebKit::EditingRange, WebKit::EditingRange>&&, std::index_sequence<0ul, 1ul, 2ul, 3ul>) + 80\n 4 WebKit 0x000000018b3ee4d0 void IPC::handleMessage<Messages::WebPage::SetCompositionAsync, WebKit::WebPage, void (WebKit::WebPage::*)(WTF::String const&, WTF::Vector<WebCore::CompositionUnderline, 0ul, WTF::CrashOnOverflow>, WebKit::EditingRange const&, WebKit::EditingRange const&)>(IPC::MessageDecoder&, WebKit::WebPage*, void (WebKit::WebPage::*)(WTF::String const&, WTF::Vector<WebCore::CompositionUnderline, 0ul, WTF::CrashOnOverflow>, WebKit::EditingRange const&, WebKit::EditingRange const&)) + 80\n 5 WebKit 0x000000018b3ec1fc WebKit::WebPage::didReceiveWebPageMessage(IPC::Connection*, IPC::MessageDecoder&) + 11936\n 6 WebKit 0x000000018b31ad28 IPC::MessageReceiverMap::dispatchMessage(IPC::Connection*, IPC::MessageDecoder&) + 116\n 7 WebKit 0x000000018b428790 WebKit::WebProcess::didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) + 36\n 8 WebKit 0x000000018b2a56d8 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::MessageDecoder, std::__1::default_delete<IPC::MessageDecoder> >) + 124\n 9 WebKit 0x000000018b2a7684 IPC::Connection::dispatchOneMessage() + 116\n 10 JavaScriptCore 0x0000000187702ab8 WTF::RunLoop::performWork() + 440\n 11 JavaScriptCore 0x00000001877030f0 WTF::RunLoop::performWork(void*) + 36\n 12 CoreFoundation 0x0000000185da7f88 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20\n 13 CoreFoundation 0x0000000185da722c __CFRunLoopDoSources0 + 260\n 14 CoreFoundation 0x0000000185da52dc __CFRunLoopRun + 708\n 15 CoreFoundation 0x0000000185cd0f70 CFRunLoopRunSpecific + 392\n 16 Foundation 0x0000000186c094c4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 312\n 17 Foundation 0x0000000186c6380c -[NSRunLoop(NSRunLoop) run] + 92\n 18 libxpc.dylib 0x0000000198250180 _xpc_objc_main + 664\n 19 libxpc.dylib 0x0000000198251eec xpc_main + 196\n 20 com.apple.WebKit.WebContent 0x000000010006ba7c 0x100068000 + 14972\n 21 libdyld.dylib 0x000000019806aa04 start + 0\n \n```\n\nこの問題の回避方法があれば、教えていただけますでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T04:55:59.457", "favorite_count": 0, "id": "15136", "last_activity_date": "2015-09-10T05:49:09.397", "last_edit_date": "2015-09-10T05:49:09.397", "last_editor_user_id": "11166", "owner_user_id": "11166", "post_type": "question", "score": 1, "tags": [ "cordova" ], "title": "Cordova+WKWebViewで日本語入力するとWKWebViewがcrashする", "view_count": 524 }
[]
15136
null
null
{ "accepted_answer_id": null, "answer_count": 1, "body": "タイトルの通りです。 \ncordova上で写真画像を編集できるPluginまたはJSを探しております。 \n以下の画像編集機能があるものが条件です。\n\n 1. 画像切り取り\n 2. ペンでのペインティング\n 3. スタンプ貼り付け\n 4. 画像のモザイク\n 5. 画像のタグ付け\n\nもしご存知でしたらご教授ください。 \nよろしくお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T07:23:24.840", "favorite_count": 0, "id": "15138", "last_activity_date": "2015-09-08T07:10:59.867", "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": "cordovaで画像編集できるPluginまたはJSを教えて下さい。", "view_count": 859 }
[ { "body": "自己回答します。 \nimg.lyの「Photo Editor SDK for HHTML5」を見つけて実装してみました。\n\n切り取りや回転、フィルター等の機能がありある程度使えそうです。 \nまたある程度のカスタマイズができるようです。\n\n[詳細はこちら](https://www.photoeditorsdk.com/documentation/html5/getting-started)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T07:10:59.867", "id": "16372", "last_activity_date": "2015-09-08T07:10:59.867", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9561", "parent_id": "15138", "post_type": "answer", "score": -1 } ]
15138
null
16372
{ "accepted_answer_id": "15155", "answer_count": 1, "body": "[How to use libapt (or libept) in debian-like system to list packages and get\ntheir infos?](https://stackoverflow.com/questions/341520/how-to-use-libapt-or-\nlibept-in-debian-like-system-to-list-packages-and-get-the)\n\nのページの回答にパッケージの一覧を表示するサンプルコードがありますが \n依存関係の一覧を表示するコードがありません。\n\nSynapticやlibaptのコードを追いかけたりしていますがわかりませんでした。 \nlibapt-pkg-docをみても大した記述がなく当てになりませんでした。\n\n依存関係を表示するためのサンプルがあればお教えください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T08:02:46.103", "favorite_count": 0, "id": "15139", "last_activity_date": "2015-09-04T08:11:17.883", "last_edit_date": "2017-05-23T12:38:55.250", "last_editor_user_id": "-1", "owner_user_id": "7844", "post_type": "question", "score": 6, "tags": [ "c++", "debian" ], "title": "debian系システムにおいてlibapt(or libept)を使ってpackageの依存関係を取得するにはどうすればよいですか", "view_count": 191 }
[ { "body": "apt のソースコード `apt/cmdline/apt-cache.cc` にある [DumpPackage\n関数](https://github.com/Debian/apt/blob/debian/experimental/cmdline/apt-\ncache.cc#L202)がサンプルとしては丁度良いのではないでしょうか。これは `apt-cache showpkg` の実行本体に当たります。\n\n関数の引数である `CmdL` は main 関数の `char *argv[]` と同等の変数(オブジェクト)です。内部で使用されている\n`CmdL.FileList + 1` は `argv + 1` に当たりますので、DumpPackage\n関数を取り出して単一のプログラムにすることができます(初期化コードを追加する必要はありますが)。\n\nただ、私の方で使用している Ubuntu 15.04 では libapt-private 関連のインクルードファイルなどがインストールされないので、前述の\ngithub リポジトリから取得した apt パッケージをビルド、別ディレクトリにインストールして、そちらのライブラリなどを使う様にする必要がありました。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T16:37:22.800", "id": "15155", "last_activity_date": "2015-09-02T16:37:22.800", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "parent_id": "15139", "post_type": "answer", "score": 8 } ]
15139
15155
15155
{ "accepted_answer_id": null, "answer_count": 0, "body": "monacaでアプリ制作が一段落ついたので、アプリと連携したブラウザで動くWebサービスを開発しようとしています。 \nWebサプリのひな形はyeoman-angularで作成し、\n\n```\n\n bower install onsenui --save\n \n```\n\nとしonsenuiをダウンロードし、index.htmlでonsenui.jsとonsenui.cssとonsen-css-\ncomponents.cssをインクルードしました。その後モジュールの追加をしました。\n\n```\n\n angular\n .module('confit1App', [ \n 'ngAnimate',\n 'ngCookies',\n 'ngResource',\n 'ngRoute',\n 'ngSanitize',\n 'ngTouch',\n      'onsen.directives'\n ])\n \n```\n\nここまできてindex.htmlに\n\n```\n\n <ons-sliding-menu main-page=\"views/main.html\" menu-page=\"views/menu.html\" max-slide-distance=\"300px\" type=\"push\" var=\"app.menu\">\n </ons-sliding-menu>\n \n```\n\nとし、main.htmlにナビゲーションバーを追加しました。\n\n```\n\n grunt serve\n \n```\n\nとしクロームで確認すると何の問題もなく表示、動作するのですが、デプロイするために\n\n```\n\n grunt build\n grunt serve:dist\n \n```\n\nとしプロダクション状態をクロームでに確認すると、スライディングメニュー自体は動くのですが(ドラッグすると右へページがスライドする。)肝心のナビゲーションバーが表示されません。 \nこれはgruntのminifyのせいなのでしょうか。 \nだとしたら、公式ブログが記述しているようにgulpでやった方がいいのでしょうか? \n(<http://blog.asial.co.jp/1370>) \nyeoman-angularとonsenuiを使ってWebアプリを作ったことがある方や、何か分かる人アドバイスお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T08:05:21.917", "favorite_count": 0, "id": "15140", "last_activity_date": "2015-09-02T12:23:35.363", "last_edit_date": "2015-09-02T12:23:35.363", "last_editor_user_id": "3639", "owner_user_id": "8748", "post_type": "question", "score": 1, "tags": [ "monaca", "onsen-ui", "angularjs" ], "title": "Webサービスでonsenuiを使いたいのですが、buildするとcssが適用されません。", "view_count": 307 }
[]
15140
null
null
{ "accepted_answer_id": "15150", "answer_count": 1, "body": "こんにちは。よろしくお願いします。\n\n`rbenv`をgitからクローンし、ドキュメントに書いてあるようにパスを設定して`eval \"$(rbenv init\n-)\"`これを`.bashrc`に追加したんですが、シェルを再起動すると以下のようなメッセージが出てしまいます。どう対応すればよいでしょうか。\n\nこの問題は調べても情報が一切見つからなかったので、Stackoverflowに質問させていただきました。\n\nOS: `Linux alice1017 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC\n2014 x86_64 x86_64 x86_64 GNU/Linux`\n\n```\n\n bash: export: `'/home/username/.rbenv/libexec/../completions/rbenv.bash'': not a valid identifier\n bash: export: `2>/dev/null': not a valid identifier\n bash: export: `rbenv()': not a valid identifier\n bash: export: `{': not a valid identifier\n bash: export: `[': not a valid identifier\n bash: export: `\"$#\"': not a valid identifier\n bash: export: `-gt': not a valid identifier\n bash: export: `0': not a valid identifier\n bash: export: `];': not a valid identifier\n bash: export: `\"$command\"': not a valid identifier\n bash: export: `rehash|shell)': not a valid identifier\n bash: export: `\"`rbenv': not a valid identifier\n bash: export: `\"sh-$command\"': not a valid identifier\n bash: export: `\"$@\"`\";;': not a valid identifier\n bash: export: `*)': not a valid identifier\n bash: export: `\"$command\"': not a valid identifier\n bash: export: `\"$@\";;': not a valid identifier\n bash: export: `}': not a valid identifier```\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T08:48:24.550", "favorite_count": 0, "id": "15142", "last_activity_date": "2015-09-02T14:25:06.727", "last_edit_date": "2015-09-02T11:55:18.960", "last_editor_user_id": "5337", "owner_user_id": "11178", "post_type": "question", "score": 0, "tags": [ "ruby", "rbenv" ], "title": "rbenv init - が正常に動かない", "view_count": 1415 }
[ { "body": "```\n\n $ rbenv init -\n \n```\n\nの実行結果はどうなるでしょうか?\n\n手元の環境(Mac OS X)では、\n\n```\n\n export PATH=\"/Users/xxxx/.rbenv/shims:${PATH}\"\n export RBENV_SHELL=bash\n source '/Users/xxxx/.rbenv/libexec/../completions/rbenv.bash'\n rbenv rehash 2>/dev/null\n rbenv() {\n local command\n command=\"$1\"\n if [ \"$#\" -gt 0 ]; then\n shift\n fi\n \n case \"$command\" in\n rehash|shell)\n eval \"`rbenv \"sh-$command\" \"$@\"`\";;\n *)\n command rbenv \"$command\" \"$@\";;\n esac\n }\n \n```\n\nとなりました。出ているエラーメッセージに近いフレーズが見受けられます。 \n( 手元の環境では、`eval \"$(rbenv init -)\"` はエラーとなっていません。 ) \nこれの実行結果がおかしいためevalするとエラーメッセージとなるのか、evalコマンド実行前後で何か別の文字が紛れてしまっているのではないかと予想します。", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T14:25:06.727", "id": "15150", "last_activity_date": "2015-09-02T14:25:06.727", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8621", "parent_id": "15142", "post_type": "answer", "score": 2 } ]
15142
15150
15150
{ "accepted_answer_id": null, "answer_count": 1, "body": "AndroidでWebView表示の前に`uri`の値を条件によって変更させたいです。\n\n```\n\n override fun onCreate(savedInstanceState: Bundle?) {\n \n super<DefaultActivity>.onCreate(savedInstanceState)\n setContentView(R.layout.activity_webview)\n \n setupUri()\n \n if (savedInstanceState == null) {\n \n val newFragment = WebViewFragment.newFragment(uri!!)\n \n getFragmentManager()\n .beginTransaction()\n .add(R.id.web_view_container, newFragment)\n .commit()\n \n }\n \n getSupportActionBar().hide()\n \n }\n \n }\n \n```\n\n参考にしたiOSの場合はこうなってます。\n\n```\n\n - (void)viewDidLoad\n {\n [super viewDidLoad];\n \n [self registerEventHandlers:[self prefferedEventhandlers]];\n }\n \n```\n\n↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓呼び出し↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓\n\n```\n\n override func prefferedEventhandlers() -> [AnyObject]! {\n \n return [\n LSGAdEventHandler(webViewController: self),\n LSGLoginPageEventHandler(webViewController: self),\n LSGOtherEventHandler(webViewController: self)\n ]\n \n }\n \n```\n\nこれはviewDidLoadで画面描画する前にEventHandlerを走らせる処理だと思うのですが、onCreateが該当するでしょうか。", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2015-09-02T10:05:03.340", "favorite_count": 0, "id": "15143", "last_activity_date": "2021-03-07T05:28:24.977", "last_edit_date": "2021-03-07T05:28:24.977", "last_editor_user_id": "3060", "owner_user_id": "10715", "post_type": "question", "score": 1, "tags": [ "java", "android", "kotlin" ], "title": "onCreate前にEventHandlerで値を変化させるには?", "view_count": 165 }
[ { "body": "urlを読み込む前にフックするのが目的で、oncreateが走らないとwebviewが生成されず、質問自体が間違っていました。\n\nwebviewが持ってるメソッドのonPageStartedでEventHandlerを走らせる方法をとります。\n\n* * *\n\n_この投稿は[@hai123\nさんのコメント](https://ja.stackoverflow.com/questions/15143/oncreate%e5%89%8d%e3%81%abeventhandler%e3%81%a7%e5%80%a4%e3%82%92%e5%a4%89%e5%8c%96%e3%81%95%e3%81%9b%e3%82%8b%e3%81%ab%e3%81%af#comment13758_15143)\nの内容を元に コミュニティwiki として投稿しました。_", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-03-07T05:28:01.437", "id": "74472", "last_activity_date": "2021-03-07T05:28:01.437", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "15143", "post_type": "answer", "score": 1 } ]
15143
null
74472
{ "accepted_answer_id": null, "answer_count": 0, "body": "titanium mobileで開発しています。 \nandroid版で、環境はwindows8.1です。\n\nパブリッシュの際に、titanium SDKのバージョンを変えたのですが、 \nそれが原因なのか、以下のようなエラーが出てビルドできなくなりました。 \nほかのプロジェクトをビルドしても同様なエラーが出るようになりました。\n\n> [ERROR] Application Installer abnormal process termination. Process \n> exit value was 1 \n> [ERROR] : : Cannot find module 'C:\\WINDOWS\\system32\\alloy.cmd' \n> [ERROR] : Alloy compiler failed\n\n対処として、\n\n・プロジェクトを一度削除して再インポート \n・titanium studio をアンインストールして再インストール \n・本来alloy.cmdが置かれていた場所にpathを通してみた \n・C:\\WINDOWS\\system32\\ に ドライブ内を検索して見つけたalloy.cmdを置く\n\n等をしましたが、状況変わらず。\n\nどなたか対処を知っていましたら教えていただけないでしょうか。 \nどうぞよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T12:22:23.477", "favorite_count": 0, "id": "15145", "last_activity_date": "2015-09-02T12:22:23.477", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11181", "post_type": "question", "score": 1, "tags": [ "android", "windows-8" ], "title": "titanium mobile で Cannot find module 'C:\\WINDOWS\\system32\\alloy.cmd'", "view_count": 87 }
[]
15145
null
null
{ "accepted_answer_id": null, "answer_count": 0, "body": "日記的なノートアプリを作っている初心者です。swift1.2で開発しています。\n\n現在、写真付きのノートを投稿するテキストエディター機能を製作しています。 \nやりたいことはユーザーが写真を複数選択したときに、編集中のUITextViewの下に選んだ写真を表示することです。また、それぞれの写真の下にもUITextViewを配置し、写真のキャプションを書き込めるようにしたいです。 \n仕上がりとしては以下ようなfacebookの投稿画面をイメージしています。 \n[![](https://i.stack.imgur.com/FGRmV.jpg)](https://i.stack.imgur.com/FGRmV.jpg)\n\n[![下のスクロール](https://i.stack.imgur.com/aLtGv.jpg)](https://i.stack.imgur.com/aLtGv.jpg)\n\nそこで、StoryBoardでUITextViewを画面上部に配置し、その下にUIImageViewとUITextView(キャプション用)を追加したUITableViewを配置したいのですが、UITextViewは高さが可変ですし、写真が選択されるまではUITableViewも表示しません。 \nとりあえず、UITextViewとUITableViewを上下左右余白0で配置して、UITableViewはhiddenにしてみたのですが、高さが決まらないためかエラーになってしまいます。\n\nこのような実装の場合、どのようにstoryboardとAutoLayoutを使用すればよいのかがわかりません。どのようにすれば、上記の機能を実装できるのでしょうか。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T14:16:13.763", "favorite_count": 0, "id": "15149", "last_activity_date": "2015-09-04T16:48:43.793", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10791", "post_type": "question", "score": 1, "tags": [ "ios", "swift", "storyboard", "uitableview", "uiimage" ], "title": "高さが可変のUITextViewとUITableViewを縦に配置したい", "view_count": 507 }
[]
15149
null
null
{ "accepted_answer_id": "15158", "answer_count": 1, "body": "**現状** \nフォント名を含む一覧は取得できたのですが、これをループで回して画像出力するにはどうすればよいでしょうか?\n\n```\n\n exec(\"convert -list font\", $output);\n print_r($output);\n \n```\n\n* * *\n```\n\n Array\n (\n [0] => \n [1] => Path: /usr/lib64/ImageMagick-6.5.4/config/type-ghostscript.xml\n [2] => Font: AvantGarde-Book\n [3] => family: AvantGarde\n [4] => style: Normal\n [5] => stretch: Normal\n [6] => weight: 400\n [7] => glyphs: /usr/share/fonts/default/Type1/a010013l.pfb\n [8] => Font: AvantGarde-BookOblique\n [9] => family: AvantGarde\n [10] => style: Oblique\n [11] => stretch: Normal\n [12] => weight: 400\n [13] => glyphs: /usr/share/fonts/default/Type1/a010033l.pfb\n [14] => Font: AvantGarde-Demi\n [15] => family: AvantGarde\n [16] => style: Normal\n [17] => stretch: Normal\n [18] => weight: 600\n [19] => glyphs: /usr/share/fonts/default/Type1/a010015l.pfb\n [20] => Font: AvantGarde-DemiOblique\n [21] => family: AvantGarde\n [22] => style: Oblique\n [23] => stretch: Normal\n [24] => weight: 600\n [25] => glyphs: /usr/share/fonts/default/Type1/a010035l.pfb\n [26] => Font: Bookman-Demi\n [27] => family: Bookman\n [28] => style: Normal\n [29] => stretch: Normal\n [30] => weight: 600\n [31] => glyphs: /usr/share/fonts/default/Type1/b018015l.pfb\n [32] => Font: Bookman-DemiItalic\n \n```\n\n* * *\n\n**環境** \n・CentOS 6.4 \n・ImageMagick-6.5.4 \n・PHP 5.4.32", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T15:10:36.117", "favorite_count": 0, "id": "15151", "last_activity_date": "2015-09-03T12:28:29.637", "last_edit_date": "2015-09-03T00:43:04.177", "last_editor_user_id": "7290", "owner_user_id": "7886", "post_type": "question", "score": 3, "tags": [ "php", "imagemagick" ], "title": "PHP + ImageMagick / サーバにインストールされている全てのフォント毎に、ダミー文字列を一覧でテキスト画像化したい", "view_count": 886 }
[ { "body": "exec を使うのであればシェルスクリプト(one-liner)でも良いかと思います。\n\n```\n\n exec(\"convert -list font | grep -Po '(?<=Font: ).+' | xargs -I@ convert -background white -fill black -font '@' -pointsize 64 label:'StackOverFlow' 'output/@.png'\")\n \n```\n\n`label:` に文字列を指定します。また、画像ファイルの出力先を `./output`\nディレクトリにしていますが、実際には絶対パスで指定する方が良いかと思います(予めディレクトリを作成しておくのをお忘れなく)。\n\nただ、フォントの種類によっては変換できない(文字コードに対応するフォントグリフを持っていないか、別のグリフが割り当てられている)場合があって、その場合には俗に言う「豆腐」になったり、「文字化け」の様な状態になりますのでご留意下さい。\n\n * Analecta \n[![Analecta](https://i.stack.imgur.com/FvIey.png)](https://i.stack.imgur.com/FvIey.png)\n\n * Impact \n[![Impact](https://i.stack.imgur.com/YxUHJ.png)](https://i.stack.imgur.com/YxUHJ.png)\n\n * mry_KacstQurn\n\n[![mry_KacstQurn](https://i.stack.imgur.com/YvT5h.png)](https://i.stack.imgur.com/YvT5h.png)\n\n * msam10\n\n[![msam10](https://i.stack.imgur.com/FzWxU.png)](https://i.stack.imgur.com/FzWxU.png)\n\n**追記**\n\nexec() を使わないで同様の処理を行う場合、PHP のプログラムから ImageMagick のライブラリを利用することになるかと思います。Ubuntu\nLinux では `php5-imagick` パッケージがそれに当たります。まずはそのパッケージをインストールします。\n\n```\n\n $ sudo apt-get install php5-imagick\n \n```\n\nコードとしては以下で、これは前述のシェルスクリプトと同じ処理を行います。\n\n```\n\n <?php\n \n function draw_text($text, $font, $size, $output_dir) {\n $draw = new ImagickDraw();\n $draw->setFont($font);\n $draw->setFontSize($size);\n $draw->setFillColor('black');\n $draw->setGravity(Imagick::GRAVITY_CENTER);\n \n $bg = new ImagickPixel();\n $bg->setColor('white');\n \n $img = new Imagick();\n $metrics = $img->queryFontMetrics($draw, $text);\n $img->newImage($metrics['textWidth'], $metrics['textHeight'], $bg);\n $img->annotateImage($draw, 0, 0, 0, $text);\n \n $img->setImageFormat('png');\n $img->writeImage($output_dir . \"/\" . $font . '.png');\n \n $img->destroy();\n }\n \n $text = 'StackOverFlow';\n $size = 64;\n $output_dir = './output';\n \n $fonts = (new Imagick)->queryFonts();\n foreach($fonts as $font){\n draw_text($text, $font, $size, $output_dir);\n }\n ?>\n \n```\n\nPHP でプログラムを書くのは初めてなので、非効率的な書き方になっていると思いますが、参考にしてみて下さい。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T17:30:22.197", "id": "15158", "last_activity_date": "2015-09-03T12:28:29.637", "last_edit_date": "2015-09-03T12:28:29.637", "last_editor_user_id": null, "owner_user_id": null, "parent_id": "15151", "post_type": "answer", "score": 3 } ]
15151
15158
15158
{ "accepted_answer_id": null, "answer_count": 2, "body": "googleが配布しているアイコンを使いたいと思いました。 \nしかし、Android Studioにどうやってimportすればよいのか、詰まりました。\n\n[このサイト](https://www.google.com/design/icons/)からダウンロードしてきたものを、どこにどうやって入れて使えばいいのですか?\n\n初歩的な質問かもしれませんが、回答よろしくお願い致します。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T15:42:30.573", "favorite_count": 0, "id": "15152", "last_activity_date": "2015-09-02T17:30:02.087", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "post_type": "question", "score": 1, "tags": [ "android", "android-studio" ], "title": "Android Studioで googleが配布しているmaterial iconを使う方法", "view_count": 4030 }
[ { "body": "**`(プロジェクトのルート)/app/src/main/res/drawable`**\n\nに置くのが基本です。\n\nデバイスの画面密度(dpi)によって PNG (JPG, GIF) ファイルを使い分ける場合は、さらに、デフォルトの **`drawable`** 以外に、\n**`drawable-mdpi`** 、 **`drawable-hdpi`** 、 **`drawable-xhdpi`** 、\n**`drawable-xxhdpi`** 、 **`drawable-xxxhdpi`** などを使い分けることもできます。\n\nダウンロードしたファイルの Android フォルダの下に、それぞれの `drawable-XXX` があると思うので、中の PNG\nのうち必要なものをプロジェクト側の同じ `drawable-XXX`\nの中にコピーします。面倒臭くなければ、全部移しておけばいいと思いますが、最低一つだけコピーしておいても、一応 Android\nの方で自動で拡大縮小してくれるので、とりあえずは使えます。\n\nちなみに、5.0 (Lollipop; API-21) からはベクターデータのアイコンも使えるので、ベクターのものであれば、特に画面密度毎に PNG\nファイルを用意せずとも、デフォルトの `drawable` に一つだけ配置しておけば ok です。SVG\nから変換して使えるようになります。→[参考サイト](http://watercelldev.hatenablog.jp/entry/2014/10/30/164959)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T16:59:53.227", "id": "15156", "last_activity_date": "2015-09-02T17:30:02.087", "last_edit_date": "2015-09-02T17:30:02.087", "last_editor_user_id": "7290", "owner_user_id": "7290", "parent_id": "15152", "post_type": "answer", "score": 0 }, { "body": "1. アイコンを1つ選びます\n 2. サイズや色を選び、PNGSでzipとしてダウンロードします\n 3. zipを展開すると、`android`というフォルダが出てきます(`iOS`や`web`用のもでてきます)\n 4. `android`フォルダの中に、ピクセル密度毎(`xhdpi`とか)にpngファイルがあるので、面倒ですが1つずつ`res/drawable-ピクセル密度`にAndroidStudioで貼り付けていきます\n\n最近のAndroid Studioだと、プロジェクトテンプレートに`res/drawable-\nhdpi`などの、drawableフォルダがなかったりするので1つずつ作ってください。。。", "comment_count": 6, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T17:01:11.320", "id": "15157", "last_activity_date": "2015-09-02T17:01:11.320", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "845", "parent_id": "15152", "post_type": "answer", "score": 1 } ]
15152
null
15157
{ "accepted_answer_id": "15162", "answer_count": 1, "body": "Shakespear Programming\nLanguage(spl)というプログラミング言語をやってみたいと思っているのですが、そのsplコードをc言語コードに変換するspl2cを実行しても、毎回プロンプトの下に空行ができるだけで止まってしまいます。 \nまた、Ctrl-Dで終了させると以下のようなメッセージが表示されます。\n\n```\n\n Unrecognized error encountered. No code output.\n \n```\n\n実行環境はVirtualBoxでうごかしているChromixiumOSです。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-02T19:38:09.043", "favorite_count": 0, "id": "15159", "last_activity_date": "2015-09-03T00:33:37.227", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11182", "post_type": "question", "score": 1, "tags": [ "compiler" ], "title": "spl2cでc言語コードが生成されません", "view_count": 87 }
[ { "body": "面白そうだったので検索してみたのですがほとんど情報がなく、本家に全く同じ質問が見つかったくらいでした。\n\n<https://stackoverflow.com/questions/21815043/how-to-run-shakespeare-spl-file-\nin-c>\n\nこれ(の引用部分)によるとリダイレクト(<)を使って標準入力から読ませればいいみたいですが、それで動かないですか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T00:33:37.227", "id": "15162", "last_activity_date": "2015-09-03T00:33:37.227", "last_edit_date": "2017-05-23T12:38:55.307", "last_editor_user_id": "-1", "owner_user_id": "8136", "parent_id": "15159", "post_type": "answer", "score": 1 } ]
15159
15162
15162
{ "accepted_answer_id": null, "answer_count": 4, "body": "お世話になります。\n\n一般的には、フォームを立ち上げていても、ログオフやシャットダウンをすれば \n一緒に閉じるものなのですが、単体起動するフォームのアプリをdllにし、 \n別のアプリから参照してdll化したフォームを立ち上げると、ログオフ、及び \nシャットダウンしたときには親フォームはきちんと閉じるのに、dll化した \nアプリの方が閉じずに、『このアプリが再起動を妨げています。』のような \nメッセージが出て、シャットダウンが止まってしまいます。\n\nそのため、ネットで調べ、下記のイベントを実装して、シャットダウン、ログオフを \nしようとしたときに、併せてフォームが閉じるようにしようとしたのですが、これでも駄目。\n\n```\n\n //ログオフ、シャットダウンしようとしているとき\n private void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)\n {\n Application.Exit();\n }\n \n```\n\nちなみに、dll化したフォームはデジタル時計を作ったアプリで、Timerで \n一秒ごとフォームを再描画する仕様のものですが、それが何かの原因なのでしょうか? \nこのフォームは、単体のexeのままなら、きちんとシャットダウン時に閉じてくれます。\n\n原因と対策をご指導いただけますでしょうか。\n\nよろしくお願いいたします。\n\n追記・すみません。原因の探り方が甘かったみたいです。 \n試してみたところ、原因はdll化した方ではなく、呼び出している親アプリの方でした。 \n一度、ゼロからフォームを立ち上げて、そこに時計のdllフォームを呼び出せば、無事 \nシャットダウンに併せてクローズ、しかし、空のフォームをdll化して既存の親のアプリで \n呼び出すと、時計の時と同じように再起動を妨げました。 \ndllは一切問題はないようです。確認の方法が不足しており、申し訳ありませんでした。\n\nさて、そこで親元のアプリの方ですが、クローズボタンを押しても終了させず、 \n最小化させて、タスクトレイに常駐、アプリの終了はCotentMenuStripのメニューから \n『終了』を選ぶことで、Application.Exit()を呼び出して終了させる流れを作っています。\n\nこれが原因になっているのでしょうか。\n\n更に追記・どうも原因がいろいろと重なっているらしく、親アプリの方でFormClisingで \nクローズをキャンセルするとシャットダウンの時にも終了されることがないようです。 \nしかし、シャットダウン時の例の警告画面には親アプリの名前は出てきません。どういうわけか、 \n親、子とも閉じられていないのに警告は子供のみ表示されるようです。\n\nまた、クローズをキャンセルすることで、上記SystemEvents_SessionEndingも \n実行されないようです。\n\n更に問題は、例のシャットダウンの警告画面がSystemEvents_SessionEndingメソッドが \n走るより前に表示されてしまうため、たとえこのメソッドでクローズさせようとしても \nもう遅いということです(Windows10にて)。\n\n初めの表題の内容とは意味合いが異なってしまいましたが、システムのシャットダウン時に、 \n親アプリがきちんと終了させられれば解決できそうですが、 \nそういった方法はありますでしょうか。\n\n何度も申し訳ありませんが、よろしくお願いいたします。", "comment_count": 9, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T00:36:53.393", "favorite_count": 0, "id": "15163", "last_activity_date": "2015-09-04T07:21:51.923", "last_edit_date": "2015-09-04T04:40:40.810", "last_editor_user_id": "9374", "owner_user_id": "9374", "post_type": "question", "score": 4, "tags": [ "c#" ], "title": "C# dllで表示したフォームをシャットダウン時に閉じたい", "view_count": 2151 }
[ { "body": "`FormClosing` イベントにて `FormClosingEventArgs` の `Cancel` プロパティを `false`\nにするといいと思います。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T07:51:26.343", "id": "15185", "last_activity_date": "2015-09-03T07:51:26.343", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8870", "parent_id": "15163", "post_type": "answer", "score": 0 }, { "body": "Timer はメインスレッドではないスレッドで Elapsed をコールします。 \nそのため、もし Elapsed\nイベントハンドラ内で単純にその外部フォームを表示しているようでしたら、そのフォームはメッセージループのないフォームになってしまい、終了その他のイベントに応答できなくなりそうです。(ここらへんの結果的挙動は調べないと自信がありませんが。)\n\n現状、フォーム表示のために Elapsed\nイベント内で特になにもしていないようであれば、[マーシャリングの質問](https://stackoverflow.com/questions/709187/accessing-\nui-in-a-thread)などを参考に、UIスレッド上でフォームを作成するようにするとよいと思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T17:13:26.073", "id": "15210", "last_activity_date": "2015-09-03T17:13:26.073", "last_edit_date": "2017-05-23T12:38:56.467", "last_editor_user_id": "-1", "owner_user_id": "623", "parent_id": "15163", "post_type": "answer", "score": 1 }, { "body": "SystemEvent.SessionEndingイベントがUIスレッドで発生しない可能性がある場合は、次のように対処できます。\n\n```\n\n private void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e){\n if( Application.OpenForms.Count > 0 ){\n var mainForm = Application.OpenForms[0];\n if( mainForm.InvokeRequired )\n mainForm.Invoke( new Action( Application.Exit ) );\n else\n Application.Exit();\n }\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T04:30:54.883", "id": "16222", "last_activity_date": "2015-09-04T04:30:54.883", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2207", "parent_id": "15163", "post_type": "answer", "score": 1 }, { "body": "FormClosing の FormClosingEventArgs e.CloseReason の値で判定できませんか? \nCloseReason.WindowsShutDown, CloseReason.TaskManagerClosing\n以外の時は最小化・タスクトレイ常駐・Cancel=Trueする \n(質問に記載の要件だけであれば CloseReason.WindowsShutDown以外の時だけでもいいかもしれません )", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T06:50:23.193", "id": "16234", "last_activity_date": "2015-09-04T07:21:51.923", "last_edit_date": "2015-09-04T07:21:51.923", "last_editor_user_id": "7343", "owner_user_id": "7343", "parent_id": "15163", "post_type": "answer", "score": 0 } ]
15163
null
15210
{ "accepted_answer_id": null, "answer_count": 1, "body": "「ここ書き換えたのどのタイミングだっけ?」となり、 \nGitHubでそのファイルのHistoryを見に行きました。 \nそのファイルは以前リネームしており、 \n私が見たかったコミットはリネーム前のに行っていたものだったようで、 \nそこには表示されていませんでした。\n\n例えばGitHubでリネーム時のコミットへ行き、 \nそこから全体のHistoryを見てリネーム前のコミットへ行った後に該当のファイルを開いて \nそのHistoryを見るということをすればリネーム前のコミットログを見ることができますが、 \nいちいちそのようなことをするのは不便だと感じています。\n\n調べていて以下のgitコマンドを入力すれば \nリネーム前のコミットログも一緒に見れることはわかりましたが、 \nGitHubでリネーム前のコミットログも一緒に見ることはできないのでしょうか?\n\n```\n\n git log --follow ファイルパス\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T01:45:29.057", "favorite_count": 0, "id": "15164", "last_activity_date": "2015-09-03T02:26:27.697", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9710", "post_type": "question", "score": 10, "tags": [ "git", "github" ], "title": "リネームしたファイルのリネーム前のコミットログが見たいのですが", "view_count": 2286 }
[ { "body": "Qiitaに手順を載せました。 \n<http://qiita.com/7of9/items/1984f3857672a10821f0>\n\n前提として「rename直後のコミットがわかる」のがあります。\n\n手順は以下です \n1\\. リポジトリに移動 [github](https://github.com/yasokada/150903-renamedFileFollow) \n2\\. ファイル名 ( renamed.txt )をクリック \n3\\. Blameをクリック \n4\\. renameする直前のコミットをクリック (add 3Test) \n5\\. Viewをクリック \n6\\. Histroyをクリック\n\n結構クリックが多いので、もっと楽な方法があればいいですね。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T02:26:27.697", "id": "15168", "last_activity_date": "2015-09-03T02:26:27.697", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4840", "parent_id": "15164", "post_type": "answer", "score": 2 } ]
15164
null
15168
{ "accepted_answer_id": "15167", "answer_count": 3, "body": "jspのsubmit時、postだとformの日本語がはてなマークに文字化けしてしまいます。 \nまた、getだとform情報が文字化けは起きません。 \nJSPに設定している項目↓\n\n```\n\n ・<%@ page contentType=\"text/html; charset=Windows-31J\" %>\n ・<html lang=\"ja\">\n ・<form method=\"GET\" accept-charset=\"UTF-8\">\n \n```\n\n他に設定しなければいけない項目があるのかなと思い調査中なのですが、解決しておりません。 \n解決方法の分かる方がいましたら、ご教授をお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T01:46:20.720", "favorite_count": 0, "id": "15165", "last_activity_date": "2015-09-17T11:37:37.757", "last_edit_date": "2015-09-17T11:37:37.757", "last_editor_user_id": "8000", "owner_user_id": "7626", "post_type": "question", "score": 2, "tags": [ "jsp", "servlet" ], "title": "POSTされたフォームの日本語がはてなマークに文字化けしてしまう", "view_count": 11390 }
[ { "body": "受け取ったdoPostメソッド内で、form情報を取得する前に\n\n```\n\n setCharacterEncoding(utf-8)\n \n```\n\nを設定すると、正しくエンコードされます。\n\nまた、Windows-31Jでpostしたい場合には、既にpageエンコード設定でWindows-31Jが指定されているので、formタグでaccept-\ncharsetにWindows-31Jを指定する必要はありません。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T02:04:16.980", "id": "15167", "last_activity_date": "2015-09-03T02:20:34.827", "last_edit_date": "2015-09-03T02:20:34.827", "last_editor_user_id": "7626", "owner_user_id": "7626", "parent_id": "15165", "post_type": "answer", "score": 1 }, { "body": "ご質問からはTomcatをご利用かわかりませんでしが \nこの辺とかいかがでしょうか? \n<http://www.javaroad.jp/servletjsp/sj_servlet13.htm>", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T02:46:11.530", "id": "15173", "last_activity_date": "2015-09-03T02:46:11.530", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4377", "parent_id": "15165", "post_type": "answer", "score": 0 }, { "body": "Formを使う頁数が多い場合や複数人でページを作るときは、Tomcatや下記のサイトのような設定で一律に扱うCharsetを固定すると楽になります。 \n<http://s2container.seasar.org/2.4/ja/garble.html>", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T23:52:36.370", "id": "16356", "last_activity_date": "2015-09-07T23:52:36.370", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12233", "parent_id": "15165", "post_type": "answer", "score": 1 } ]
15165
15167
15167
{ "accepted_answer_id": "15171", "answer_count": 2, "body": "Rubyでは引数の順序を気にしないで、 \n下記のように書くことができます。 \nこれをキーワード引数というそうです。\n\n```\n\n def self.piyo(msg: 'hello', name: 'Yamada')\n p \"#{msg}, #{name}\"\n end\n \n```\n\n```\n\n Hoge.piyo #=>\"hello, Yamada\"\n Hoge.piyo(msg: 'Hi', name: 'Sato') #=> \"Hi, Sato\"\n Hoge.piyo( name: 'Sato', msg: 'Hi') #=> \"Hi, Sato\"\n \n```\n\nそこで質問なのですが、PHPではこの機能はありますでしょうか? \nご存知の方がいらっしゃいましたら、教えて頂けると幸いです。\n\nコードは↓を参考にしています。 \n<http://qiita.com/rtoya/items/33617078501776fdcad7>\n\nよろしくお願いします。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T01:49:29.683", "favorite_count": 0, "id": "15166", "last_activity_date": "2015-09-03T03:16:05.837", "last_edit_date": "2015-09-03T02:22:08.857", "last_editor_user_id": "7918", "owner_user_id": "7918", "post_type": "question", "score": 2, "tags": [ "php", "ruby", "可読性" ], "title": "PHPでRubyのようなキーワード引数はできますでしょうか?", "view_count": 827 }
[ { "body": "今のところ配列かオブジェクトで擬似的に表現するしかないかもですね。\n\n```\n\n function piyo($k) {\n echo $k['msg'] . \", \" . $k['name'];\n }\n piyo(['msg' => 'hello', 'name' => 'Yamada']);\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T02:27:57.463", "id": "15169", "last_activity_date": "2015-09-03T02:27:57.463", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2232", "parent_id": "15166", "post_type": "answer", "score": 3 }, { "body": "PHPでは、[キーワード引数を言語に加えるという提案](https://wiki.php.net/rfc/named_params)がありますが、キーワード引数は今のまま[不可能](https://stackoverflow.com/questions/6800379/named-\narguments-in-php)です。\n\nしかし、配列を使えます。例えば:\n\n```\n\n function piyo($args) {\n // 初期値を足す\n $args += array(\n 'msg' => 'hello',\n 'name' => 'Yamada'\n );\n \n echo(\"$args[msg], $args[name]\");\n }\n \n piyo(array('msg' => 'Hi', 'name' => 'Sato')); // => \"Hi, Sato\"\n piyo(array('name' => 'Sato', 'msg' => 'Hi')); // => \"Hi, Sato\"\n \n```\n\nPHP5.4では、`piyo(['msg' => 'Hi', 'name' => 'Sato']);`というシンタックスも使えます。\n\n* * *\n\n補足:JavaScriptのFunction.applyのように、[`call_user_func_array`](http://php.net/manual/ja/function.call-\nuser-func-array.php)も使えるようです。例えば:\n\n```\n\n function piyo($msg = 'hello', $name = 'Yamada') {\n echo(\"$msg, $name\");\n }\n \n // => \"Hi, Sato\"\n call_user_func_array(\n 'piyo', array('msg' => 'Hi', 'name' => 'Sato')\n ); \n // => \"Hi, Sato\"\n call_user_func_array(\n 'piyo', array('name' => 'Sato', 'msg' => 'Hi')\n );\n \n```\n\nこの[SOの回答](https://stackoverflow.com/a/29282838)のように、[`extract`](http://php.net/manual/ja/function.extract.php)も使えるようです:\n\n```\n\n function piyo($args = array(), $msg = 'hello', $name = 'Yamada') {\n extract($args);\n echo(\"$msg, $name\");\n }\n \n piyo(array('msg' => 'Hi', 'name' => 'Sato')); // => \"Hi, Sato\"\n piyo(array('name' => 'Sato', 'msg' => 'Hi')); // => \"Hi, Sato\"\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T02:34:42.947", "id": "15171", "last_activity_date": "2015-09-03T03:16:05.837", "last_edit_date": "2017-05-23T12:38:56.467", "last_editor_user_id": "-1", "owner_user_id": "11003", "parent_id": "15166", "post_type": "answer", "score": 5 } ]
15166
15171
15171
{ "accepted_answer_id": null, "answer_count": 3, "body": "Qiitaの以下のエントリをみて、これができるとログの解析が捗りそうと思い色々試してみています。 \n<http://qiita.com/hakobera/items/5e280ad33d72f82de39c>\n\nJSON_EXTRACT,\nJSON_EXTRACT_SCALARを使えば値を取り出せるのでこれで集計用のテーブルを作れば要件満たせそうと思っていたのですが、保存されているJSONデータに配列がありました。\n\nたとえば以下のような感じのログデータがBigQueryのテーブルのlogdataというカラムに入っているとして、\n\n```\n\n {\n \"date\": \"2015-08-31\",\n \"time\": \"00:00:00\",\n \"type\": \"RESPONSE\",\n \"userno\": 12345,\n \"friends\":[{\"userno\":1, \"nickname\":\"hogehoge\"}, {\"userno\":1, \"nickname\":\"fugafuga\"}]\n }\n \n```\n\n最悪は、\n\n```\n\n select \n JSON_EXTRACT_SCALAR(logdata, '$.friends[0].userno') friend0,\n JSON_EXTRACT_SCALAR(logdata, '$.friends[1].userno') friend1\n from serverlog_20150831\n \n```\n\nのようにして配列の数だけ並べたらいいのかもしれませんが \nFLATTENのように配列の数分だけ別のレコードになるように取り出すうまい方法がないだろうかと思い調べています。\n\nどなたか良いアイディアがありましたらご教示ください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T02:31:40.993", "favorite_count": 0, "id": "15170", "last_activity_date": "2018-03-09T09:20:48.107", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4377", "post_type": "question", "score": 1, "tags": [ "google-bigquery" ], "title": "BigQueryでJSON文字列を保存して配列になっている値を集計したい場合のやり方", "view_count": 6966 }
[ { "body": "がんばってやってみました!\n\n```\n\n SELECT\n JSON_EXTRACT (logdata, '$.userno') AS userno,\n \"{\"+ REGEXP_REPLACE ( SPLIT ( JSON_EXTRACT (json, '$.friends'), \"},{\"), \"^\\\\[\\\\{|\\\\}\\\\]$\",\"\") + \"}\" AS friend\n FROM\n serverlog_20150831\n \n```\n\nこれの結果が以下です。\n\n```\n\n Row userno friend \n 1 12345 {\"userno\":1,\"nickname\":\"hogehoge\"} \n 2 12345 {\"userno\":1,\"nickname\":\"fugafuga\"}\n \n```\n\nそして、更にここからjsonをばらしていって\n\n```\n\n SELECT\n JSON_EXTRACT (logdata, '$.userno') AS userno,\n JSON_EXTRACT(\"{\"+ REGEXP_REPLACE ( SPLIT ( JSON_EXTRACT (logdata, '$.friends'), \"},{\"), \"^\\\\[\\\\{|\\\\}\\\\]$\",\"\") + \"}\",'$.userno') AS friend.userno,\n SUBSTR(JSON_EXTRACT(\"{\"+ REGEXP_REPLACE ( SPLIT ( JSON_EXTRACT (logdata, '$.friends'), \"},{\"), \"^\\\\[\\\\{|\\\\}\\\\]$\",\"\") + \"}\",'$.nickname'), 2,LENGTH(JSON_EXTRACT(\"{\"+ REGEXP_REPLACE ( SPLIT ( JSON_EXTRACT (logdata, '$.friends'), \"},{\"), \"^\\\\[\\\\{|\\\\}\\\\]$\",\"\") + \"}\",'$.nickname')) -2) AS friend.nickname\n FROM\n serverlog_20150831\n \n```\n\nとすると、以下になります。\n\n```\n\n Row userno friend_userno friend_nickname \n 1 12345 1 hogehoge \n 2 12345 1 fugafuga\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T09:23:03.830", "id": "15192", "last_activity_date": "2015-09-03T09:23:03.830", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4361", "parent_id": "15170", "post_type": "answer", "score": 2 }, { "body": "StandardSQL版を作成しました。 \nDebug用にすごいばらしてあるけど、やってることは基本的に同じ。\n\n```\n\n #standardSQL\n SELECT\n userno,\n JSON_EXTRACT_SCALAR(friend, \"$.userno\") AS friend_userno,\n JSON_EXTRACT_SCALAR(friend, \"$.nickname\") AS friend_nickname\n FROM (\n SELECT\n userno,\n CONCAT(\"{\",REGEXP_REPLACE(friend, \"^\\\\[\\\\{|\\\\}\\\\]$\",\"\"), \"}\") AS friend\n FROM (\n SELECT\n userno,\n friend\n FROM (\n SELECT\n userno,\n SPLIT( friends, \"},{\") AS friends\n FROM (\n SELECT\n JSON_EXTRACT('{\"userno\":12345,\"friends\":[{\"userno\":1, \"nickname\":\"hogehoge\"}, {\"userno\":1, \"nickname\":\"fugafuga\"}] }}', \"$.userno\") AS userno,\n JSON_EXTRACT('{\"userno\":12345,\"friends\":[{\"userno\":1, \"nickname\":\"hogehoge\"}, {\"userno\":1, \"nickname\":\"fugafuga\"}] }}', \"$.friends\") AS friends ))\n CROSS JOIN\n UNNEST(friends) AS friend))\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2018-03-09T08:37:42.680", "id": "42267", "last_activity_date": "2018-03-09T08:37:42.680", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4361", "parent_id": "15170", "post_type": "answer", "score": 0 }, { "body": "UDF で JSON.parse する手はどうでしょう。\n\n```\n\n #standardSQL\n # STRUCT の型は JSON に合わせる\n CREATE TEMPORARY FUNCTION\n parse_logdata(logdata STRING)\n RETURNS STRUCT>>\n LANGUAGE js AS \"\"\"\n return JSON.parse(logdata);\n \"\"\";\n # LOGDATA_TABLE にログが入っている前提\n WITH\n LOGDATA_TABLE AS (\n SELECT\n '{ \"date\": \"2015-08-31\", \"time\": \"00:00:00\", \"type\": \"RESPONSE\", \"userno\": 12345, \"friends\":[{\"userno\":1, \"nickname\":\"hogehoge\"}, {\"userno\":1, \"nickname\":\"fugafuga\"}]}' AS logdata\n UNION ALL\n SELECT\n '{ \"date\": \"2015-08-31\", \"time\": \"00:00:00\", \"type\": \"RESPONSE\", \"userno\": 12346, \"friends\":[{\"userno\":1, \"nickname\":\"foobar\"}, {\"userno\":1, \"nickname\":\"piyopiyo\"}]}')\n SELECT\n logdata.userno AS userno,\n friends.userno AS friend_no,\n nickname\n FROM (\n SELECT\n parse_logdata(logdata).*\n FROM\n LOGDATA_TABLE) AS logdata\n INNER JOIN\n UNNEST(logdata.friends) AS friends\n \n```\n\n追記: UDF の入ったクエリの同時実行数には注意する必要があるかも。 \n<https://cloud.google.com/bigquery/quotas?hl=en> \n<https://cloud.google.com/bigquery/docs/reference/standard-sql/user-defined-\nfunctions?hl=en#limits> \nまた、 VIEW では使えないし BI ツールでも使えないのが普通ですね。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2018-03-09T09:03:08.917", "id": "42270", "last_activity_date": "2018-03-09T09:20:48.107", "last_edit_date": "2018-03-09T09:20:48.107", "last_editor_user_id": "27680", "owner_user_id": "27680", "parent_id": "15170", "post_type": "answer", "score": 0 } ]
15170
null
15192
{ "accepted_answer_id": null, "answer_count": 0, "body": "アプリ内部に保存しているPDFファイルとUIImageをMargeさせてから \n新たなPDFファイルを作成したいです。\n\n※ vfr/Readerのライブラリを使用しています\n\n```\n\n ReaderDocument *document = [[ReaderDocument alloc] initWithFilePath:SamplePdfPath] password:nil];\n \n UIGraphicsBeginPDFContextToFile(newPdfPath, CGRectZero, nil);\n \n for (NSInteger page = 1; page <= [[document pageCount] integerValue]; page++) \n {\n ReaderContentPage *contentPage = [[ReaderContentPage alloc] initWithURL:document.fileURL page:page password:nil];\n \n UIGraphicsBeginPDFPageWithInfo(contentPage.bounds, nil);\n CGContextRef context = UIGraphicsGetCurrentContext();\n CGContextDrawPDFPage(context, contentPage.getPageRef);\n \n if ([fileManager fileExistsAtPath:drawFilePath]) {\n NSData *imgData = [NSData dataWithContentsOfFile:drawFilePath];\n [[UIImage imageWithData:imgData] drawAsPatternInRect:contentPage.bounds];\n }\n }\n \n UIGraphicsEndPDFContext();\n \n```\n\nこの処理で作成したPDFファイルを解析すると、 フォント情報が元PDFファイルの2倍になっていました。\n\nおそらくこれが起因して、作成した PDFファイルのサイズが約1.5倍になってしまいます。\n\nフォント情報を元ファイルと同じ数にするにはどうしたらよいでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T02:40:23.387", "favorite_count": 0, "id": "15172", "last_activity_date": "2015-09-03T08:29:54.150", "last_edit_date": "2015-09-03T08:29:54.150", "last_editor_user_id": "7362", "owner_user_id": "9913", "post_type": "question", "score": 4, "tags": [ "ios", "objective-c", "pdf" ], "title": "PDFファイルを作成した際、フォント情報が肥大してしまう", "view_count": 241 }
[]
15172
null
null
{ "accepted_answer_id": null, "answer_count": 3, "body": "・jQueryセレクタ結果は、jQueryオブジェクトでしょうか? \n・それとも配列? \n・あるいは、DOMのような、配列っぽいけど厳密には配列ではないオブジェクト?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T03:38:14.723", "favorite_count": 0, "id": "15175", "last_activity_date": "2015-09-09T14:28:43.207", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7886", "post_type": "question", "score": 3, "tags": [ "javascript", "jquery" ], "title": "jQueryセレクタ結果は、jQueryオブジェクト? それとも配列? もしくはそれ以外?", "view_count": 3346 }
[ { "body": "jQueryオブジェクトです。\n\njQueryのメソッドを指定できる(例:$(\".classname\").css(\"display\",\"none\")のようにできる、もし$(\".classname\")の結果が配列とかDOMエレメントリストのようなものなら実行できない)ことからも明らかですね。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T03:56:22.223", "id": "15176", "last_activity_date": "2015-09-03T03:56:22.223", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5044", "parent_id": "15175", "post_type": "answer", "score": 1 }, { "body": "微妙に認識が異なる気がしたので補足しますが、 \n結論だけでよければ読まなくても大丈夫です。\n\n返却値の話ですが、jQueryオブジェクトだとは思います。 \nですが、これは自身(コンストラクタでセレクタを元に継承された`$`)を返却しています。 \nなので`$(\".classname\").css(\"display\",\"none\")`の`css`の実際の関数は \n`$.css`にあり、これを継承した自身を返しているので実行できるのです。\n\nですので、返却値を変数に入れる事で継承することが可能で、 \n継承した後の変数では、jQueryオブジェクトで呼び出せる関数を実行する事が出来ます。\n\n```\n\n //ただ単に代入してみよう\r\n var work = $(\"#sample_data\");\r\n \r\n //返却値がjqueryオブジェクトならHTMLとれるよね?\r\n $(\"#res\").append(\"[\"+work.html()+\"]\");\r\n $(\"#res\").append(\"<br />\");\r\n \r\n //DOMなら出せるよね\r\n $(\"#res\").append(\"[\"+work.innerHTML+\"]\");\r\n $(\"#res\").append(\"<br />\");\r\n \r\n //ところで貴方の型は?\r\n $(\"#res\").append(\"[\"+(typeof work)+\"]<br />\");\r\n \r\n \r\n \r\n $(\"#res\").append(\"<hr />\");\r\n //存在しないElement呼んだらどうするのよ\r\n $(\"#res\").append(\"[\"+(typeof $(\"#not_found\"))+\"]<br />\");\r\n \r\n \r\n \r\n //継承してみる\r\n work = new $(\"#sample_data\");\r\n \r\n $(\"#res\").append(\"<hr />\");\r\n //代入と同じことしてみよう\r\n $(\"#res\").append(\"[\"+work.html()+\"]\");\r\n $(\"#res\").append(\"<br />\");\r\n $(\"#res\").append(\"[\"+work.innerHTML+\"]\");\r\n $(\"#res\").append(\"<br />\");\r\n $(\"#res\").append(\"[\"+(typeof work)+\"]<br />\");\n```\n\n```\n\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\"></script>\r\n <div id=\"sample_data\"><span>span_node</span></div>\r\n <hr />\r\n <pre>\r\n <code id=\"res\">\r\n </code>\r\n </pre>\n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T05:25:28.277", "id": "15178", "last_activity_date": "2015-09-03T05:25:28.277", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7676", "parent_id": "15175", "post_type": "answer", "score": 0 }, { "body": "そういったことを調べるには、APIドキュメントを参照します。\n\n~~\n\n> 戻り値 \n> jQuery \n> 抽出されたjQueryオブジェクト\n\n[jQuery(expression, context) -\njQuery日本語リファレンス](http://semooh.jp/jquery/api/core/jQuery/expression%2C+context/)\n\n~~\n\n> jQuery( selector [, context ] ) Returns: jQuery\n\n<http://api.jquery.com/jQuery/>\n\nしたがってjQueryオブジェクトです。\n\n* * *\n\nこういった疑問は、自分で調べられるようになれば30秒もかからずにわかることです。 \n結論を知るより、調べ方を知ったほうが有用です。\n\nなお、「`$(\".classname\").css(\"display\",\"none\")`というコードを書いた覚えがあるからJQueryオブジェクトであるような気がする」というような曖昧な根拠でコードを書くのはやめたほうがいいです。APIは変わることがあるし、入力次第で別種のオブジェクトが返ってくることもあるし、似たようなAPIを備えた異なるオブジェクトも存在することがあります。唯一信用できるのは公式のAPIドキュメントだけです。\n\nまた、実験で確認するのは最後の手段です。APIドキュメントに記載されておらず、ソースコードを読んでも複雑すぎてわからないなら、仕方ないので実験して振る舞いを推測します。運が良ければ動きます。運が良ければ。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-09T13:25:12.757", "id": "16448", "last_activity_date": "2015-09-09T14:28:43.207", "last_edit_date": "2015-09-09T14:28:43.207", "last_editor_user_id": "10330", "owner_user_id": "10330", "parent_id": "15175", "post_type": "answer", "score": -1 } ]
15175
null
15176
{ "accepted_answer_id": null, "answer_count": 2, "body": "Activityを起動するかしないかフィルタリングしたいです。 \nonCreateでfinishするのもダメで、それより前にActivityの起動を阻止したいです。\n\n一瞬で終了ではなく、そもそもActivityの開始自体を事前にフィルタリングして \n状況に応じて阻止したいです。\n\nなんとなく Application でできるかなとも思いましたが無理でした。 \nなにか方法はありませんか?\n\n実際やりたいことは、特定のスキームを無効化したいので、intent\nfilterで横取りしたいのですが、とにかく一瞬足りともActivityを起動したくありません。 \nスタックが入れ替わってしまってcurrentのアクティビティが背後に入ってしまうからです。\n\nなのでServiceでintent filterでスキームを受け取ろうと思いましたが、 \nスキームはActivityしか受け取れないようです。\n\nなので、マニフェストではActivityでスキームを受け取るように書いておいて、 \n実際はそのアクティビティがコールされる前に阻止できればと思いました。\n\nなんかゴチャゴチャなりましてすいません…\n\n追記 \nもう必要なくなったのですがなぜこのようなことを実現したいかというと、 \nUFJのアプリ知ってますか? \n今は改善されましたが長い間以下のようなうざい事をしてくれたのでUFJアプリからユーザーのご機嫌を維持するアプリを作ろうと思ってました。\n\nUFJアプリが行っていた事 \n・開発者モードがONかUSBデバッグがONになっているときとにかくUSBを接続すると \n勝手にブラウザを表示して警告を表示する。 \n(どんなときでもUSBをつなぐ度に勝手にブラウザを表示するのでとにかく迷惑) \nこの動作をブロックしたかったです。\n\nそのため、UFJが発行するブラウザ起動インテントをオーバーライドというか、吸収するため、 \nそのURIを自分のアクティビティが横取りします。 \nしかし、仕組み上、今度は必ず自分のアクティビティが起動してしまいます。 \n自分のアクティビティを即終了してもユーザーが起動していたアプリはバックグラウンドに移動し、ホームに戻ってしまいます。 \nなので阻止出来てもユーザーのアプリが中断されるという問題は解決できませんでした。\n\nサービスでインテントを吸収できればよかったのですが、この手のインテントはアクティビティしか吸収できなかったのです。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T06:20:31.517", "favorite_count": 0, "id": "15180", "last_activity_date": "2023-06-16T23:04:05.493", "last_edit_date": "2020-02-14T08:55:12.963", "last_editor_user_id": "3060", "owner_user_id": "10346", "post_type": "question", "score": 6, "tags": [ "android", "android-activity" ], "title": "Android Activity起動を阻止する", "view_count": 2339 }
[ { "body": "> 特定のスキームを無効化したい\n\nというユースケースがよく分からないのですが、例えば「電話をかける」インテントに反応するアプリを作るには、 `NEW_OUTGOING_CALL` を\nActivity の intent-filter に仕掛けると思います。\n\nこれでユーザーが、「電話をかける」アクションをしたときに、あなたのアプリが選択肢に表示されるわけですが、それを選択しても無反応なのは、ユーザビリティ的に良くないと思います。\n\nどうしてもそうしたい理由が開示できるのであれば、それを書かれた方がアドバイスは集まりやすいと思います。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2016-09-20T07:31:20.570", "id": "28997", "last_activity_date": "2016-09-20T07:31:20.570", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "15190", "parent_id": "15180", "post_type": "answer", "score": 0 }, { "body": "```\n\n <activity\n android:name=\".TranslucentActivity\"\n android:launchMode=\"singleInstance\"\n android:theme=\"@android:style/Theme.Translucent\">\n <intent-filter>\n <action android:name=\"android.intent.action.VIEW\" />\n \n <category android:name=\"android.intent.category.DEFAULT\" />\n <category android:name=\"android.intent.category.BROWSABLE\" />\n \n <data\n android:host=\"test.com\"\n android:scheme=\"http\" />\n </intent-filter>\n </activity>\n \n```\n\n上記のように、AndroidManifest上でIntentを吸収する`Activity`を透明に設定後、 \n`onCreate`で`Activity#finish()`すれば、あたかも起動していないかのようにできるかと思います。\n\nこの場合、ユーザには指定のURLをデフォルト設定をブロッカー用アプリに指定して貰う必要があります。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2017-08-31T05:11:29.747", "id": "37634", "last_activity_date": "2017-08-31T05:11:29.747", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "22792", "parent_id": "15180", "post_type": "answer", "score": 0 } ]
15180
null
28997
{ "accepted_answer_id": "15186", "answer_count": 1, "body": "Goでstring型の変数とuint型の変数の比較を行いたいのですが、どのように書けばいいのでしょうか\n\n例えば下記にように書いたところ、同じなのにfalseになってしまいました。\n\n```\n\n if srtId == string(uintId){}\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T06:39:39.857", "favorite_count": 0, "id": "15181", "last_activity_date": "2015-09-03T11:38:15.413", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7232", "post_type": "question", "score": 1, "tags": [ "go" ], "title": "Goの文字列比較", "view_count": 637 }
[ { "body": "文字列で比較したい場合は、`unitId`を ~~`fmt.Sprintf(\"%d\",\nuintId)`~~`strconv.Itoa(unitId)`で文字列に変換する必要がありそうです。\n\n`string(unitId)`は、unitIdの文字コードを元に変換するので、例えば、\n\n```\n\n a := uint(33)\n fmt.Printf(\"Hello, playground %s\", string(a))\n \n```\n\nを実行すると\n\n```\n\n Hello, playground !\n \n```\n\nと表示されます。", "comment_count": 5, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T07:58:15.443", "id": "15186", "last_activity_date": "2015-09-03T11:38:15.413", "last_edit_date": "2015-09-03T11:38:15.413", "last_editor_user_id": "845", "owner_user_id": "845", "parent_id": "15181", "post_type": "answer", "score": 2 } ]
15181
15186
15186
{ "accepted_answer_id": "16245", "answer_count": 1, "body": "```\n\n public class WebViewActivity(var uri: Uri? = null): DefaultActivity() {\n \n private class WebViewFragment():\n WebFragment(),\n AdEventHandlerDelegate,\n FavorEventHandlerDelegate,\n ShareEventHandlerDelegate,\n NewPageEventHandlerDelegate,\n LoginPageEventHandlerDelegate,\n LogoutPageEventHandlerDelegate\n {\n private object KeyName {\n \n val Uri = \"Uri\"\n \n }\n \n \n \n public companion object {\n //Function型 fun\n public fun newFragment(uri: Uri): WebViewFragment {\n \n val fragment = WebViewFragment()\n \n val args = Bundle()\n args.putString(KeyName.Uri, uri.toString())\n \n fragment.setArguments(args)\n \n return fragment\n \n }\n \n }\n \n private fun getWebViewActivity(): WebViewActivity {\n \n return getActivity() as WebViewActivity\n \n }\n \n override fun getEventHandlers(): Collection<EventHandler> {\n \n return arrayListOf(\n AdEventHandler(this),\n FavorEventHandler(this),\n ShareEventHandler(this),\n CurrentPageEventHandler(this),\n NewPageEventHandler(this),\n LoginPageEventHandler(this),\n LogoutPageEventHandler(this)\n )\n \n } \n \n```\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n```\n\n override fun onCreate(savedInstanceState: Bundle?) {\n \n super<DefaultActivity>.onCreate(savedInstanceState)\n setContentView(R.layout.activity_webview)\n \n //\n setupUri()\n \n if (savedInstanceState == null) {\n \n val newFragment = WebViewFragment.newFragment(uri!!)\n \n getFragmentManager()\n .beginTransaction()\n .add(R.id.web_view_container, newFragment)\n .commit()\n \n }\n \n getSupportActionBar().hide()\n \n }\n \n }\n \n```\n\nこの場合ですと、 \nval newFragment = WebViewFragment.newFragment(uri!!) \nの部分でHandlerDelegateが全て呼び出されているのでしょうか?\n\nEventHandler(this)の部分は何を行っているんでしょうか?\n\n[EventHandlerにWebViewでリクエストをフックして強制的に任意のURLに遷移させる処理を入れることは可能ですか?](https://ja.stackoverflow.com/questions/12879/webview%E3%81%A7%E3%83%AA%E3%82%AF%E3%82%A8%E3%82%B9%E3%83%88%E3%82%92%E3%83%95%E3%83%83%E3%82%AF%E3%81%97%E3%81%A6%E5%BC%B7%E5%88%B6%E7%9A%84%E3%81%AB%E4%BB%BB%E6%84%8F%E3%81%AEurl%E3%81%AB%E9%81%B7%E7%A7%BB%E3%81%95%E3%81%9B%E3%81%9F%E3%81%84)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T07:28:29.353", "favorite_count": 0, "id": "15183", "last_activity_date": "2021-03-07T05:25:28.937", "last_edit_date": "2021-03-07T05:25:28.937", "last_editor_user_id": "3060", "owner_user_id": "10715", "post_type": "question", "score": -1, "tags": [ "java", "android", "kotlin" ], "title": "HandlerDelegateは呼び出しでしょうか?", "view_count": 117 }
[ { "body": "javaやandroidの標準クラスでない、実装部分のコードが示されていないAdEventHandlerDelegateのような独自インターフェースの挙動を聞かれても「回答できない」というのが回答になるのではないでしょうか。\n\n他の質問も拝見いたしましたが、質問文で使われている「クラス、メソッド、呼び出し」といった用語を理解されていないように見受けられます。\n\n故に質問の意図が伝わらず、意味不明になっているため、回答が難しくなっているのだと思います。\n\n一度javaやandroid、kotlinの入門サイトや本などで復習するのが近道だと思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T09:15:21.663", "id": "16245", "last_activity_date": "2015-09-04T09:15:21.663", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7256", "parent_id": "15183", "post_type": "answer", "score": 1 } ]
15183
16245
16245
{ "accepted_answer_id": "15191", "answer_count": 1, "body": "HttpServletRequestをActionRedirectに入れ、リクエストを受取った先では、上記HttpServletRequestを使用したいと考えています。 \nActionRedirectのaddParameterでHttpServletRequestを入れようと思ったのですが、String型になってしまうため上手くいきませんでした。\n\n解決方法の分かる方がいましたら、ご教授をお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T08:25:34.893", "favorite_count": 0, "id": "15187", "last_activity_date": "2015-09-03T09:16:14.293", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7626", "post_type": "question", "score": 1, "tags": [ "java", "struts" ], "title": "HttpServletRequestをActionRedirectに入れたい", "view_count": 310 }
[ { "body": "おそらくStruts1.2または1.3での話と推察されますので、それを前提で回答します。\n\nActionRedirectは、リダイレクト用のクラスです。 \naddParameterは「リクエストパラメータを追加する」メソッドですので、HttpServletRequestインスタンスを詰めることができません。\n\nおそらく実現したいことは、遷移先のURLでもHttpServletRequestに格納した属性などを共有したいのではないかと思いますが、その場合はForwardingActionForwardを使います。\n\n以下のドキュメントも参考にしてください。\n\n * ActionRedirect ( ActionRedirect - Techscore様 ) \n<http://www.techscore.com/tech/Java/ApacheJakarta/Struts/24-2/>\n\n * ForwardingActionForward ( Struts1.2 - 日本語Javadoc ) \n<http://www.jajakarta.org/struts/struts1.2/documentation/ja/target/api/org/apache/struts/action/ForwardingActionForward.html>\n\n * リダイレクトとフォワードの違いを知る \n<http://www.atmarkit.co.jp/fjava/javatips/062jspservlet029.html>\n\n参考になれば幸いです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T09:16:14.293", "id": "15191", "last_activity_date": "2015-09-03T09:16:14.293", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5778", "parent_id": "15187", "post_type": "answer", "score": 1 } ]
15187
15191
15191
{ "accepted_answer_id": null, "answer_count": 1, "body": "TableViewCell上にUILabelを設置し、 \nLineを3行固定とし、 \nLineBreakModeをTrancateTailで設定して、 \nJSONで可変長の文字を表示させようとしています。\n\nですが、4行以上になる場合、省略文字の三点リーダ(…)が表示されてくれません。 \n以下のように、行間を指定したい意図がありまして、このようにしているのですが、 \nどうにもできません。 \nラベルの上に三点リーダのみ自分で付け加える方法も検討したのですが、 \n綺麗に3行目の文字が切れる前の最終文字の座標も取れないと思っており、、、 \nお知恵をお貸し頂けないでしょうか。。。\n\n宜しくお願いします。\n\n```\n\n // カスタムLineHeightを指定\n CGFloat customLineHeight = 19.0f;\n \n // パラグラフスタイルにlineHeightをセット\n NSMutableParagraphStyle *paragrahStyle = [NSMutableParagraphStyle new];\n paragrahStyle.minimumLineHeight = customLineHeight;\n paragrahStyle.maximumLineHeight = customLineHeight;\n \n // NSAttributedStringを生成してパラグラフスタイルをセット\n NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:printLabel];\n [attributedText addAttribute:NSParagraphStyleAttributeName\n value:paragrahStyle\n range:NSMakeRange(0, attributedText.length)];\n \n self.printLabel.attributedText = attributedText;\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T08:34:43.160", "favorite_count": 0, "id": "15188", "last_activity_date": "2015-09-04T00:27:27.443", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9791", "post_type": "question", "score": 3, "tags": [ "ios", "objective-c" ], "title": "NSMutableAttributedStringを使用し、UILabelで複数行表示させると、…(三点リーダ)が表示されない", "view_count": 4456 }
[ { "body": "まさかとは思うんだがスタイルで改行モードを指定せずラベルに指定してないか?\n\n```\n\n NSMutableParagraphStyle *paragrahStyle = [NSMutableParagraphStyle new];\n paragrahStyle.minimumLineHeight = customLineHeight;\n paragrahStyle.maximumLineHeight = customLineHeight;\n paragrahStyle.lineBreakMode = NSLineBreakByTruncatingTail; // 追加\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T00:27:27.443", "id": "15216", "last_activity_date": "2015-09-04T00:27:27.443", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "parent_id": "15188", "post_type": "answer", "score": 1 } ]
15188
null
15216
{ "accepted_answer_id": "15190", "answer_count": 1, "body": "java内での入力\n\n```\n\n import java.io.*;\n class sample61{\n public static void main(String[] args) throws IOException{\n System.out.println(\"テストの受験者数を入力してください。\");\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \n String str = br.readLine();\n int num = Integer.parseInt(str);\n \n int[] test;\n test = new int[num];\n int total = 0;\n int max = 0;\n int min = 100;\n int ave = 0;\n \n System.out.println(\"人数分の点数を入力してください。\");\n for(int i=0; i<num; i++){\n str = br.readLine();\n int tmp = Integer.parseInt(str);\n test [i] = tmp;\n }\n \n for(int i=0; i<num; i++){\n System.out.println((i+1) + \"番目の人の点数は\" + test[i] + \"です。\");\n total = total + test[i];\n }\n System.out.println(\"合計点:\" + total + \"点\");\n System.out.println(\"最高得点:\" + max + \"点\");\n System.out.println(\"最低得点:\" + min + \"点\");\n System.out.println(\"平均得点:\" + total/num + \"点\");\n \n }\n }\n \n```\n\n以上のプログラムを実行すると以下のようになります。 \n(入力を含む)\n\n```\n\n テストの受験者数を入力してください。\n 5\n 人数分の点数を入力してください。\n 90\n 79\n 1\n 55\n 78\n 1番目の人の点数は90です。\n 2番目の人の点数は79です。\n 3番目の人の点数は1です。\n 4番目の人の点数は55です。\n 5番目の人の点数は78です。\n 合計点:303点\n 最高得点:0点\n 最低得点:100点\n 平均得点:60点\n \n```\n\n結果の最高得点と最低得点を以下のように表示したいです。\n\n```\n\n 最高得点:90点\n 最低得点:1点\n \n```\n\nしかし上記の実行例で示したように以下のようになってしまいます。\n\n```\n\n 最高得点:0点\n 最低得点:100点\n \n```\n\n改善するところがあれば指摘してください。\n\nよろしくお願いします。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T08:39:22.017", "favorite_count": 0, "id": "15189", "last_activity_date": "2015-09-08T03:21:47.823", "last_edit_date": "2015-09-08T03:21:47.823", "last_editor_user_id": "208", "owner_user_id": "10289", "post_type": "question", "score": -6, "tags": [ "java" ], "title": "最高得点と最低得点を出したいのですが・・・", "view_count": 4177 }
[ { "body": "変数 max と min を計算していないため、初期値が表示されていますね。\n\n表示する前に計算しましょう。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T09:02:49.513", "id": "15190", "last_activity_date": "2015-09-03T09:02:49.513", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5778", "parent_id": "15189", "post_type": "answer", "score": 5 } ]
15189
15190
15190
{ "accepted_answer_id": "18393", "answer_count": 1, "body": "しても記事が反映されるのは普段使っているChromeだけで、IEや別のブラウザに表示させるにはNginxのキャッシュをすべて削除とNginx再起動の\n\n```\n\n rm -rf /var/cache/nginx/*\n systemctl restart nginx\n \n```\n\nを行わないとだめですが、いい方法はないですか? \nというかリバースプロキシを使うならこれが普通なんですかね?\n\nNginxの設定はこちらを参考にしました。\n\nNginxのリバースプロキシを使った設定 \n<http://oxynotes.com/?p=8438#3>", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T09:32:57.017", "favorite_count": 0, "id": "15194", "last_activity_date": "2015-11-04T03:28:30.027", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7973", "post_type": "question", "score": 0, "tags": [ "wordpress", "nginx" ], "title": "NginxリバースプロキシでWordpress記事更新", "view_count": 156 }
[ { "body": "AWS上で動作するAMIMOTO AMIがNginxリバースプロキシを使用しているのですが、 \nそちらでは「Nginx Cache Controller」というプラグインを利用しています。 \n<http://ja.amimoto-ami.com/2013/12/03/how-to-use-nginx-cache-controller/>\n\n質問者の環境でそのまま使えるかどうかはわかりませんが、 \nGitHubにソースコードもあるので参考にはなるのではないかと思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-11-04T03:28:30.027", "id": "18393", "last_activity_date": "2015-11-04T03:28:30.027", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3555", "parent_id": "15194", "post_type": "answer", "score": 1 } ]
15194
18393
18393
{ "accepted_answer_id": "15215", "answer_count": 1, "body": "デフォルトでRubyMineの`Reformat`を使うと `when foo then bar` を一行で書いてると\n`bar`の部分が改行されてしまいます。\n\n`when` で設定内を検索しても RubyのCodeStyleにヒットしないようですが、何かこの設定を変更する方法はありますか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T09:33:44.377", "favorite_count": 0, "id": "15195", "last_activity_date": "2015-09-03T23:37:35.447", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3271", "post_type": "question", "score": 1, "tags": [ "ruby", "rubymine" ], "title": "RubyMineで when ~ then を一行で書く", "view_count": 66 }
[ { "body": "こちらでも確認してみましたが、現状のRubyMineではカスタマイズできないようですね。 \nIssue trackerからnew featureをリクエストするぐらいしかないかもしれません。\n\n<https://youtrack.jetbrains.com/issues/RUBY>", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T23:37:35.447", "id": "15215", "last_activity_date": "2015-09-03T23:37:35.447", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "85", "parent_id": "15195", "post_type": "answer", "score": 0 } ]
15195
15215
15215
{ "accepted_answer_id": null, "answer_count": 1, "body": "Xcode6.4、言語:Swiftで開発を行っています。 \nStoryboardで縦のみスクロールのページを作っており、ScrollViewの上にUILabelやUIImageをのせています。 \nUILabelは複数あり、サーバーからAPI経由でLabelのテキストを動的に変更しています。 \n上から順にAutoLayoutの制約を決めているのですが、条件によって一部のUILabelを表示させたくない場合があり、それのAutoLayout設定がわかりません。\n\nUIImageView ← 絶対に存在する\n\nUILabel_1 ← 絶対に存在する\n\nUILabel_2 ← 場合によって有無が変わる\n\nUILabel_3 ← 絶対に存在する\n\nUIImageViewから下に5pxの位置にUILabel_1 \nUILabel_1から下に5pxの位置にUILabel_2 \nUILabel_2から下に5pxの位置にUILabel_3\n\n仮にViewが上のようになっており、上から順にAutoLayout制約を設定している場合 \nUILabel_2がなかった場合レイアウトが崩れてしまいます。\n\nUILabel_2のtextが空の場合はhidden=true、もしくはUILabel_2.text=\"\"にすると、UILabel_2がある場所に余計な隙間ができてしまいます。\n\nUILabel_2のtextが空の場合はUILabel_3の位置を \nUILabel_1から下に5pxの位置にしたいです。(上につめるイメージ)\n\nどのように実装したらよいのでしょうか。 \nご教示お願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T09:45:08.917", "favorite_count": 0, "id": "15196", "last_activity_date": "2015-09-03T10:29:16.987", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10996", "post_type": "question", "score": 2, "tags": [ "swift", "xcode", "xcode6", "storyboard", "autolayout" ], "title": "Xcode6 Swift 動的なアイテムに対してのAutoLayout", "view_count": 854 }
[ { "body": "ラベルとトップスペースの制約をアウトレット接続し、テキストの有無で`constant`の値を変更すればよい\n\n```\n\n @IBOutlet weak var label: UILabel!\n @IBOutlet weak var topSpaceConstraint: NSLayoutConstraint!\n \n ... ... ...\n \n // テキストをサーバーから受け取るなどした後\n \n if (label.text!.isEmpty) {\n topSpaceConstraint.constant = 0\n } else {\n topSpaceConstraint.constant = 5\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T10:21:08.447", "id": "15197", "last_activity_date": "2015-09-03T10:29:16.987", "last_edit_date": "2015-09-03T10:29:16.987", "last_editor_user_id": null, "owner_user_id": null, "parent_id": "15196", "post_type": "answer", "score": 3 } ]
15196
null
15197
{ "accepted_answer_id": "15204", "answer_count": 1, "body": "こちらを参考に不要サービスを全て停止した後にrebootすると起動エラーとなり起動しなくなってしまいました。 \n<http://qiita.com/dumpty-alma@github/items/091862834317229559f1> \nこれをこのまま実行しました。\n\n```\n\n [root@crown ~]# systemctl disable abrt-ccpp.service\n rm '/etc/systemd/system/multi-user.target.wants/abrt-ccpp.service'\n [root@crown ~]# systemctl disable abrtd.service\n rm '/etc/systemd/system/multi-user.target.wants/abrtd.service'\n [root@crown ~]# systemctl disable abrt-oops.service\n rm '/etc/systemd/system/multi-user.target.wants/abrt-oops.service'\n [root@crown ~]# systemctl disable abrt-vmcore.service\n rm '/etc/systemd/system/multi-user.target.wants/abrt-vmcore.service'\n [root@crown ~]# systemctl disable abrt-xorg.service\n rm '/etc/systemd/system/multi-user.target.wants/abrt-xorg.service'\n [root@crown ~]# systemctl disable atd.service\n rm '/etc/systemd/system/multi-user.target.wants/atd.service'\n [root@crown ~]# systemctl disable auditd.service\n rm '/etc/systemd/system/multi-user.target.wants/auditd.service'\n [root@crown ~]# systemctl disable avahi-daemon.service \n rm '/etc/systemd/system/multi-user.target.wants/avahi-daemon.service'\n rm '/etc/systemd/system/sockets.target.wants/avahi-daemon.socket'\n rm '/etc/systemd/system/dbus-org.freedesktop.Avahi.service'\n [root@crown ~]# systemctl disable kdump.service\n rm '/etc/systemd/system/multi-user.target.wants/kdump.service'\n [root@crown ~]# systemctl disable NetworkManager\n rm '/etc/systemd/system/multi-user.target.wants/NetworkManager.service'\n rm '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service'\n rm '/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service'\n [root@crown ~]# systemctl disable smartd.service\n rm '/etc/systemd/system/multi-user.target.wants/smartd.service'\n [root@crown ~]# systemctl disable tuned.service\n rm '/etc/systemd/system/multi-user.target.wants/tuned.service'\n \n```\n\n消去できないのもいくつかありますが、全て消したあとは普通に正常に動いていました。 \nなんとなくrebootすると起動できなくなりました。\n\nGoogleConsoleを見ると\n\n```\n\n Sep 3 20:44:14 localhost google: Waiting for metadata server, attempt 328\n Sep 3 20:44:15 localhost accounts-from-metadata: WARNING error while trying to update accounts: <urlopen error [Errno 101] Network is unreachable>\n \n```\n\nというエラーが1秒ごとに連続で表示されています。\n\nどうすればよろしいでしょうか?\n\nもうひとつ考えられるのは、Nginxのworker_connectionsを1024から65535に変更しました。\n\nunalistさんにチャットで1時間以上教えて頂いていたんですが、不可能でした。 \nGoogleCloudShellを使用していたのですが、/var/www/htmlにファイルが無く、もしかするとと思ったんですが、GoogleCloudShellは今のインスタンスとは全く関係のないものだったのかもしれません。\n\nsshでnetworkをenableとかしていたんですが、SSH接続は不可能でした。\n\nディスクのスナップショットを作成し、そのスナップショットから新しいインスタンスを作成したんですが同じ症状で起動できませんでした。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T11:49:36.527", "favorite_count": 0, "id": "15198", "last_activity_date": "2017-06-19T05:08:23.797", "last_edit_date": "2017-06-19T05:08:23.797", "last_editor_user_id": "5793", "owner_user_id": "7973", "post_type": "question", "score": 0, "tags": [ "centos", "google-compute-engine" ], "title": "CentOS7 サービスを停止させたところ起動しなくなりました", "view_count": 4133 }
[ { "body": "Google Compute Engine を使っているのですね?\n\nだとすれば、 Network Manager\nを止めたのが原因ではないでしょうか。このサービスはネットワークの設定を行うものですから、これを止めるとネットワークにつながらなくなります。\n\nあなたが参考にされたQiitaの記事にも書かれていますね。\n\n> 補足)NetworkManagerを停止すると、ifcfg-ens*で書いていたGATEWAY0が有効になってませんでした。 \n> \\--- <http://qiita.com/dumpty-alma@github/items/091862834317229559f1> より引用\n\nで、 Google Compute Engine 上でこれをやってしまうと、起動時に行われる Google\nのサーバーとの通信が行えないために、エラーが出ているのだと思います。\n\n類似の例 \n<https://stackoverflow.com/q/28492368/2818869> \n<https://stackoverflow.com/q/30915528/2818869>\n\nVPS等であればネットワークが死んでいても仮想コンソールから対処できると思いますが、GCEでそれができるのかはわからないです。もし無理であれば、VMを作り直すほかないかと。\n\n* * *\n\n仮想コンソールが使えたようなのでチャットで復活を試みていましたが、解決には至りませんでした。上記も可能性の一つではあると思うので残しておきますが、今回はこれが直接の原因ではなかったかもしれません。", "comment_count": 9, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T14:19:30.937", "id": "15204", "last_activity_date": "2015-09-03T16:17:15.370", "last_edit_date": "2017-05-23T12:38:55.250", "last_editor_user_id": "-1", "owner_user_id": "8000", "parent_id": "15198", "post_type": "answer", "score": 2 } ]
15198
15204
15204
{ "accepted_answer_id": "15203", "answer_count": 1, "body": "リソースが足りなくなってきたので、instanceのMachine\ntypeを変更してスケールアップしたいのですが、IPアドレスを変えずに実現する方法はありますか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T12:01:14.160", "favorite_count": 0, "id": "15199", "last_activity_date": "2015-09-03T12:37:05.293", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10067", "post_type": "question", "score": 1, "tags": [ "google-compute-engine" ], "title": "vm instanceのMachine type変更方法", "view_count": 221 }
[ { "body": "IPアドレスを変更したくないのであれば、現在利用しているIPアドレスをリザーブする必要があります。 \nDeveloper ConsoleからNetworking -> External IP\naddressesを選んで、現在使っているIPアドレスをStaticに変更してください。\n\nその後、以下の手順を行います。\n\ninstanceのboot diskを削除しない設定に変更 \ninstanceを削除 \n希望のmachine typeでip addrはリザーブしてあるものを指定して、boot diskを元のdiskを指定して、instanceを作成\n\nもし、今回boot diskを残したまま、instanceを削除するのが初めてなのであれば、作業前にboot\ndiskのsnapshotを作っておくことをおすすめします。 \nまた、instanceを1回削除しますので、再度作りなおすまでの間は、applicationがdownすることに注意してください。", "comment_count": 5, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T12:37:05.293", "id": "15203", "last_activity_date": "2015-09-03T12:37:05.293", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4361", "parent_id": "15199", "post_type": "answer", "score": 1 } ]
15199
15203
15203
{ "accepted_answer_id": "16261", "answer_count": 2, "body": "共有PC内でユーザ名とメールアドレスに他人の物が設定されていることに気づかずにコミットすることを避けるため、以下のようなフックスクリプトを作成しました。 \n<https://github.com/DaikiMaekawa/git-commit-checker>\n\nこれにより、コミットする毎に設定されているユーザ情報が正しいかどうか確認することができます。\n\nしかし、git\ncommitに`--author`オプションが指定されている時にはこの機能を無効にしたいのですが、フックスクリプト内でその判定を行うにはどうすれば良いでしょうか?", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T12:01:15.003", "favorite_count": 0, "id": "15200", "last_activity_date": "2015-09-05T06:55:15.607", "last_edit_date": "2015-09-03T20:04:44.853", "last_editor_user_id": "10492", "owner_user_id": "11187", "post_type": "question", "score": 2, "tags": [ "python", "git" ], "title": "Git hook script内でコマンドのオプションを取得したい", "view_count": 696 }
[ { "body": "`git commit` に `--author` が指定されたかどうかを直接的に判定する方法は無いと思います。\n\n間接的には環境変数をチェックする方法が考えられます。フックスクリプト内において、環境変数 `GIT_AUTHOR_NAME` と\n`GIT_AUTHOR_EMAIL` には最終的にコミットに含まれるユーザ情報がセットされます。 `git commit` に `--author`\nが指定されていればその値がセットされ、そうでなければ gitconfig の値が反映されます。\n\nフックスクリプト内で `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL` の値を `git config user.name`,\n`git config user.email` と比較し、異なっていれば `--author` が指定されたと考えればよさそうです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T09:36:46.467", "id": "16246", "last_activity_date": "2015-09-04T09:36:46.467", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2259", "parent_id": "15200", "post_type": "answer", "score": 0 }, { "body": "お使いのシステムが **Linux 系 OS であれば** 方法があります。\n\nLinux では `/proc/PID/cmdline` から、プロセスのコマンドライン引数を取得することが可能です。ですので、`pre-commit`\nスクリプト(プロセス)の親プロセスである git のコマンドライン引数を調べることによって `--author`\nオプションが指定されているのかどうかを知ることができます。\n\n**pre-commit**\n\n```\n\n #!/usr/bin/env python\n \n import os\n import sys\n \n ppid = os.getppid()\n cmdline = open('/proc/' + str(ppid) + '/cmdline', 'r').readline()\n \n if '\\x00--author' in cmdline:\n print \"--author option specified.\"\n else:\n print \"--author option not specified.\"\n \n sys.exit(0)\n \n```\n\n`\\x00--author` となっているのは、引数が `NULL(\\x00)` で区切られているためです。\n\n**追記**\n\npsutil というライブラリがあって、上記と同等の処理を Linux 以外の環境でも実現できることが判りました。\n\n[giampaolo/psutil](https://github.com/giampaolo/psutil)\n\n> It currently supports Linux, Windows, OSX, FreeBSD and Sun Solaris, both\n> 32-bit and 64-bit architectures, with Python versions from 2.6 to 3.5.\n\npsutil を利用する場合の `pre-commit` スクリプトは以下の様になります。\n\n```\n\n #!/usr/bin/env python\n \n import os\n import sys\n import psutil\n \n cmdline = '\\x00'.join(psutil.Process(os.getppid()).cmdline())\n \n if '\\x00--author' in cmdline:\n print \"--author option specified.\"\n else:\n print \"--author option not specified.\"\n \n sys.exit(0)\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T14:42:47.693", "id": "16261", "last_activity_date": "2015-09-05T06:55:15.607", "last_edit_date": "2015-09-05T06:55:15.607", "last_editor_user_id": null, "owner_user_id": null, "parent_id": "15200", "post_type": "answer", "score": 2 } ]
15200
16261
16261
{ "accepted_answer_id": "15211", "answer_count": 2, "body": "`rspec 3.3` を使いテストを書いていたのですが、シンプルなテストだったので\n\n```\n\n it \"condition1\" do\n expect{foo[:hoge}.eq 1\n end\n it \"condition2\" do\n expect{foo[:moge}.eq 2\n end\n \n```\n\nをそれぞれ一行で\n\n```\n\n it \"condition1\"{ expect{foo[:hoge}.eq 1 }\n it \"condition2\"{ expect{foo[:moge}.eq 2 }\n \n```\n\nと書いた所\n\n```\n\n syntax error, unexpected '{', expecting keyword_end (SyntaxError)\n \n```\n\nのエラーになってしまいました。`do ~ end` と `{ ~ }` は等価だと思っていたのですがRSpecでは違うのでしょうか?\n\n何かRSpecのオプションなどによって一行での記述を行えるようにすることはできますか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T12:07:36.697", "favorite_count": 0, "id": "15201", "last_activity_date": "2015-09-03T23:35:07.340", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3271", "post_type": "question", "score": 1, "tags": [ "ruby", "rspec" ], "title": "RSpec3.3 で it を 一行で記述する方法", "view_count": 782 }
[ { "body": "RSpec 固有の話ではなく、Ruby の文法の問題です。 \n次のように書けばよいです。\n\n```\n\n it(\"condition1\"){ expect(foo[:hoge]).to eq 1 }\n \n```\n\nRuby のリファレンスマニュアル <http://docs.ruby-\nlang.org/ja/2.2.0/doc/spec=2fcall.html#block> に記述があります。\n\n> { ... } の方が do ... end ブロックよりも強く結合します", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T14:28:46.167", "id": "15205", "last_activity_date": "2015-09-03T23:35:07.340", "last_edit_date": "2015-09-03T23:35:07.340", "last_editor_user_id": "3249", "owner_user_id": "3249", "parent_id": "15201", "post_type": "answer", "score": 2 }, { "body": "Rubyの仕様で、メソッドに引数と中括弧のブロックを同時に渡す場合はメソッドを丸括弧で囲む必要があります。 \n他にも同じようなパターンを下にまとめてみました。\n\n```\n\n # 引数あり、丸括弧なし、中括弧ブロックあり => NG\n irb(main):001:0> puts 'x' { 'y' }\n SyntaxError: (irb):1: syntax error, unexpected '{', expecting end-of-input\n puts 'x' { 'y' }\n ^\n \n # 引数あり、丸括弧あり、中括弧ブロックあり => OK\n irb(main):002:0> puts('x') { 'y' }\n x\n => nil\n irb(main):003:0> puts { 'y' }\n \n # 引数なし、丸括弧あり、中括弧ブロックあり => OK\n => nil\n irb(main):004:0> puts() { 'y' }\n \n => nil\n \n # ハッシュが引数(中括弧あり)、丸括弧なし => NG\n irb(main):005:0> puts { a: 1 }\n SyntaxError: (irb):5: syntax error, unexpected ':', expecting '}'\n puts { a: 1 }\n ^\n \n # ハッシュが引数(中括弧あり)、丸括弧あり => OK\n irb(main):006:0> puts({ a: 1 })\n {:a=>1}\n => nil\n \n # ハッシュが引数(中括弧あり)、丸括弧あり => OK\n irb(main):006:0> puts({ a: 1 })\n {:a=>1}\n => nil\n \n # ハッシュが引数(中括弧なし)、丸括弧あり => OK\n irb(main):007:0> puts(a: 1)\n {:a=>1}\n => nil\n \n # ハッシュが引数(中括弧なし)、丸括弧なし => OK\n irb(main):008:0> puts a: 1\n {:a=>1}\n => nil\n \n```\n\nただ、いずれにしても元のRSpecの構文が少しおかしいです。正しくはこうなります。\n\n```\n\n it(\"condition1\"){ expect(foo[:hoge]).to eq 1 }\n it(\"condition2\"){ expect(foo[:moge]).to eq 2 }\n \n```\n\nまた、上のコードでもかまいませんが、itを一行で書きたいときはsubjectを使うこともよくあります。\n\n```\n\n describe 'foo' do\n subject { foo[key] }\n context 'with hoge' do\n let(:key) { :hoge }\n it { is_expected.to eq 1 }\n end\n context 'with moge' do\n let(:key) { :moge }\n it { is_expected.to eq 2 }\n end\n end\n \n```\n\nテストコードが大きくなってくると、このようにしてテストコードのDRYさを求めた方が保守性が上がることもあります。\n\n詳しくは以前書いたこちらのQiita記事を参照してください。\n\n[subject\nを使ってテスト対象のオブジェクトを1箇所にまとめる](http://qiita.com/jnchito/items/42193d066bd61c740612#subject-%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E3%83%86%E3%82%B9%E3%83%88%E5%AF%BE%E8%B1%A1%E3%81%AE%E3%82%AA%E3%83%96%E3%82%B8%E3%82%A7%E3%82%AF%E3%83%88%E3%82%921%E7%AE%87%E6%89%80%E3%81%AB%E3%81%BE%E3%81%A8%E3%82%81%E3%82%8B)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T18:41:00.477", "id": "15211", "last_activity_date": "2015-09-03T22:04:08.800", "last_edit_date": "2015-09-03T22:04:08.800", "last_editor_user_id": "85", "owner_user_id": "85", "parent_id": "15201", "post_type": "answer", "score": 4 } ]
15201
15211
15211
{ "accepted_answer_id": "15213", "answer_count": 1, "body": "Modelからデータを引っ張ってきたとき,ブラウザで確認すると \nArticle:0x9fhu3u...と表示されます。 \nこれは、データベースからデータがオブジェクトの16進数で帰ってきているという解釈で良いでしょうか。なぜこのような形になるのですか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T12:13:27.610", "favorite_count": 0, "id": "15202", "last_activity_date": "2015-09-03T23:26:19.413", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11188", "post_type": "question", "score": 0, "tags": [ "ruby-on-rails" ], "title": "Article Modelからデータを引っ張ってきたときの#<Article:0x9fhu3u...>", "view_count": 135 }
[ { "body": "`<%= blog %>` のように書くと、`<%= blog.to_s %>`を書いたことと同じになります。\n\n16進数の部分はデータベースのデータというより、モデルのインスタンスのobject_idをベースにした値が表示されています。 \n下のコードのように object_id を左に1ビットシフトし(2倍しても同じです)、その値を16進数表示すると、 to_s\nと同じ値が得られます。(厳密には to_s には \"0x00\" が付いていますが)\n\n```\n\n >> blog.to_s \n \"#<Blog:0x007f83fa09a328>\"\n >> blog.object_id \n 70102406189460\n >> (blog.object_id << 1).to_s(16)\n \"7f83fa09a328\"\n \n```\n\nちなみに to_sの結果がこのようになるのは、Railsの仕様ではなく、Ruby標準の挙動です。\n\n参考:\n\n * [Class: Object (Ruby 2.2.3)](http://ruby-doc.org/core-2.2.3/Object.html#method-i-to_s)\n * [In Ruby, why does inspect() print out some kind of object id which is different from what object_id() gives? - Stack Overflow](https://stackoverflow.com/questions/2818602/in-ruby-why-does-inspect-print-out-some-kind-of-object-id-which-is-different)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T23:26:19.413", "id": "15213", "last_activity_date": "2015-09-03T23:26:19.413", "last_edit_date": "2017-05-23T12:38:55.307", "last_editor_user_id": "-1", "owner_user_id": "85", "parent_id": "15202", "post_type": "answer", "score": 2 } ]
15202
15213
15213
{ "accepted_answer_id": null, "answer_count": 5, "body": "以下に示すコードが何故実行できるのかわかりません. \n`(2)` において、添字は`-1` になっていると思いますが、何故エラーが発生しないのですか?\n\n```\n\n #include <stdio.h>\n #include <string.h>\n \n int main()\n {\n char s[] = \"hello\";\n \n int len = strlen(s);\n printf(\"len: %d\\n\", len); // (1)\n \n printf(\"%c\\n\", s[strlen(s) - 1 - len]); // (2)\n // printf(\"%c\\n\", s[-1]); -> compile error\n // printf(\"%c\\n\", s[strlen(s) - 6]); -> (2) と同じ\n \n return 0;\n }\n \n```\n\n実行結果 `(2)` の `printf` は改行のみの印字です.\n\n```\n\n len: 5\n \n```\n\nコメントの通り、`s[-1]` では警告が表示されるだけで、コンパイルエラーにはなりませんでした.", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T14:35:10.260", "favorite_count": 0, "id": "15206", "last_activity_date": "2015-09-04T20:53:09.580", "last_edit_date": "2015-09-04T01:22:37.243", "last_editor_user_id": "11191", "owner_user_id": "11190", "post_type": "question", "score": 9, "tags": [ "c" ], "title": "C : 配列の添字について", "view_count": 8432 }
[ { "body": "strlen()の結果が、コンパイル時ではなく実行時に返ってくるからでは? \nゴリゴリに最適化すればコンパイル時に計算してしまうかもしれないけど。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T15:07:48.350", "id": "15207", "last_activity_date": "2015-09-03T15:07:48.350", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5203", "parent_id": "15206", "post_type": "answer", "score": -3 }, { "body": "まず最初に: 発生しているのは、 h2so5 さんのおっしゃる通り、 warning だと思います。コンパイラのオプション次第で、 warning は\nerror になります。\n\n次に、(2) でコンパイル時に warning\nが発生しない理由ですが、むしろ、`s[-1]`の場合には、明らかに間違っていそうなコードであると、コンパイラがたまたま理解できたので、 warning\nを出力している、と考えた方がいいかもしれません。\n\n最後に、実際に実行してなぜエラーにならないか、ですが、`s[-1]`は、「メモリ上に配置されている\"hello\"の、hの一つ手前の番地(hの一つ前)」を参照しに行きます。そのメモリ上に格納されていた何かしらが、`s[-1]`の結果として取得され、`printf`で文字コードとして出力されます。\n\n結果には、「改行のみの印字」とありますが、端末で表示できない文字コードが出力されている可能性が高いです。(自分の環境では [DEL\nコード](http://www.theasciicode.com.ar/ascii-control-characters/delete-ascii-\ncode-127.html)でした)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T16:50:58.927", "id": "15209", "last_activity_date": "2015-09-03T16:59:34.637", "last_edit_date": "2015-09-03T16:59:34.637", "last_editor_user_id": "754", "owner_user_id": "754", "parent_id": "15206", "post_type": "answer", "score": 6 }, { "body": "提示例は [c](/questions/tagged/c \"'c' のタグが付いた質問を表示\") や\n[c++](/questions/tagged/c%2b%2b \"'c++' のタグが付いた質問を表示\")\nでいうところの「未定義動作」を引き起こしています。 \n言語仕様書による専門用語「未定義動作 (undefined behavior) 」とは \n\\- 誤ったプログラム、または誤ったデータに対する動作であって \n\\- 言語仕様書はその動作に対して何も規定しない \nです。\n\n起こりうる動作としては \n\\- 処理系が独自の正しい動作を規定する (Visual C の `fflush(stdin);` 等) \n\\- コンパイラが翻訳時点で診断し、指摘する (提示例 `s[-1]` ) \n\\- 診断の結果、コンパイルエラーになるかもしれない \n\\- 診断の結果、警告になるかもしれない \n\\- リンカがリンク時点で診断し、指摘する (結果は同上) \n\\- 実行時にライブラリ関数や OS 等が診断し、実行時エラーで強制終了となる \n\\- 診断等が一切なされずにプログラムとしては動作を続けるが \n\\- あたかも「プログラマが勝手に期待している通りに」動作する \n\\- プログラマの期待に背いて変な動作をする (提示例 (2)) \n\\- いわゆる「暴走」をする \n\\- その他の動作\n\nということで\n\n> 何故エラーが発生しないのですか?\n\nそもそも「エラーとして検出される」ことは期待してはいけないのです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-03T23:30:32.180", "id": "15214", "last_activity_date": "2015-09-03T23:30:32.180", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8589", "parent_id": "15206", "post_type": "answer", "score": 15 }, { "body": "`strlen(s) - 1 - len`は実行時にしか値は確定しませんので、コンパイラーがエラーもしくは警告できるとは限りません。\n\nなお、Visual C++の場合ですが、コンパイラー本体では警告されませんでしたが、コード分析による静的解析では\n\n> warning C6385: Reading invalid data from 's': the readable size is '6'\n> bytes, but '-1' bytes may be read.\n\nと[C6385警告](https://msdn.microsoft.com/ja-\njp/library/ms182088\\(v=vs.100\\).aspx)が出力されることを確認しました。\n\n* * *\n\nなお、`s`がポインターでなく固定文字列であることを利用して`strlen(s)`の代わりに`sizeof s -\n1`を使用すると、実行時でなくコンパイル時に計算が行われるようになりますので、警告できるコンパイラーの種類は増えるはずです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T01:45:10.390", "id": "16216", "last_activity_date": "2015-09-04T20:53:09.580", "last_edit_date": "2015-09-04T20:53:09.580", "last_editor_user_id": "4236", "owner_user_id": "4236", "parent_id": "15206", "post_type": "answer", "score": 4 }, { "body": "gcc に限って言えば、以下の様なマクロを追加して `-O2` オプション(optimize level 2)を付けてコンパイルすると warning\nを表示してくれます。\n\n```\n\n #define strlen(s) (sizeof(s)/sizeof(s[0]))\n \n```\n\n# まぁ、何の意味も無い事ではありますが\n\n```\n\n $ gcc -O2 -Wall -o example example.c\n example.c: In function ‘main’:\n example.c:12:19: warning: array subscript is above array bounds [-Warray-bounds]\n printf(\"%c\\n\", s[strlen(s) - 1 - len]); // (2)\n \n```\n\nところで、gcc には実行時に配列の領域外アクセスをチェックするためのオプションスイッチがあります(`-fsanitize=address` オプション)。\n\n```\n\n $ gcc --version\n gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2\n \n $ gcc -O2 -g -Wall -fsanitize=address -o example example.c\n $ ./example \n len: 6\n =================================================================\n ==18994==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7ffd971e6c1f at pc 0x400940 bp 0x7ffd971e6bf0 sp 0x7ffd971e6be0\n READ of size 1 at 0x7ffd971e6c1f thread T0\n #0 0x40093f in main example.c:12\n #1 0x7f5778126a3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)\n #2 0x4009d8 in _start (example+0x4009d8)\n \n Address 0x7ffd971e6c1f is located in stack of thread T0 at offset 31 in frame\n #0 0x40086f in main example.c:7\n \n This frame has 1 object(s):\n [32, 38) 's' <== Memory access at offset 31 underflows this variable\n HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext\n (longjmp and C++ exceptions *are* supported)\n SUMMARY: AddressSanitizer: stack-buffer-underflow example.c:12 main\n Shadow bytes around the buggy address:\n 0x100032e34d30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 0x100032e34d40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 0x100032e34d50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 0x100032e34d60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 0x100032e34d70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n =>0x100032e34d80: f1 f1 f1[f1]06 f4 f4 f4 00 00 00 00 00 00 00 00\n 0x100032e34d90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 0x100032e34da0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 0x100032e34db0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 0x100032e34dc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 0x100032e34dd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n Shadow byte legend (one shadow byte represents 8 application bytes):\n Addressable: 00\n Partially addressable: 01 02 03 04 05 06 07 \n Heap left redzone: fa\n Heap right redzone: fb\n Freed heap region: fd\n Stack left redzone: f1\n Stack mid redzone: f2\n Stack right redzone: f3\n Stack partial redzone: f4\n Stack after return: f5\n Stack use after scope: f8\n Global redzone: f9\n Global init order: f6\n Poisoned by user: f7\n Contiguous container OOB:fc\n ASan internal: fe\n ==18994==ABORTING\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T07:01:06.353", "id": "16237", "last_activity_date": "2015-09-04T07:01:06.353", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "parent_id": "15206", "post_type": "answer", "score": 2 } ]
15206
null
15214
{ "accepted_answer_id": "16215", "answer_count": 1, "body": "この[\n**リンク先**](https://github.com/0xfffffff7/HelloHttp2ssl/blob/master/hellohttp2.cpp)のコードをコンパイルしようとすると,下記のようなエラーが出てコンパイル出来ません。Opensslのバージョンが1.0.2以上じゃないとalpnが使えないというのは、調べた結果わかったので、[\n**この方法**](https://sandilands.info/sgordon/upgrade-latest-version-openssl-on-\nubuntu)で1.0.2dにあげたのですがダメでした。 \nどなたか解決方法知っている方がいましたら教えて下さい。 \nubuntuのバージョンは、14.04.3です。\n\n```\n\n root@ubuntu:~$ g++ -g -Wall -I/usr/local/include -lssl -lcrypto -lstdc++ -o hellohttp2.o hellohttp2.cpp\n hellohttp2.cpp: In function ‘int main(int, char**)’:\n hellohttp2.cpp:133:49: error: ‘SSL_set_alpn_protos’ was not declared in this scope\n SSL_set_alpn_protos(_ssl, protos, protos_len);\n ^\n hellohttp2.cpp:146:54: error: ‘SSL_get0_alpn_selected’ was not declared in this scope\n SSL_get0_alpn_selected(_ssl, &ret_alpn, &alpn_len);\n ^\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T00:50:13.213", "favorite_count": 0, "id": "15217", "last_activity_date": "2015-09-04T02:31:43.770", "last_edit_date": "2015-09-04T02:31:43.770", "last_editor_user_id": null, "owner_user_id": "11194", "post_type": "question", "score": 2, "tags": [ "ubuntu", "openssl" ], "title": "Ubuntu上でOpenSSLのalpnの関数を使う方法", "view_count": 297 }
[ { "body": "Ubuntu 15.04 で openssl 1.0.2d を /usr/local 以下にインストールした後で、以下を実行しました。\n\n```\n\n $ g++ -g -O2 -Wall -I/usr/local/include -o hellohttp2 hellohttp2.cpp -lstdc++ -L/usr/local/lib -lssl -lcrypto -ldl\n \n```\n\nこれで `hellohttp2` が作成されます。\n\nおそらく、`-o hellohttp2 hellohttp2.cpp` をライブラリのリンク指定(`-ssl -lcrypto\n-dl`)よりも前に置く必要があります。", "comment_count": 6, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T01:44:09.793", "id": "16215", "last_activity_date": "2015-09-04T01:44:09.793", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "parent_id": "15217", "post_type": "answer", "score": 1 } ]
15217
16215
16215
{ "accepted_answer_id": "16217", "answer_count": 1, "body": "以下の条件の正規表現を作成したいです。\n\n1はじめと終わりはひらがな \n2文字列中には空白1つまたは「ぁ」から「ん」。 \n3空白は0〜1つ続いていい \n4文字列中に空白は任意の数現れてもよい\n\n例\n\n```\n\n やまだたろう=>OK\n やまだ たろう=>OK\n やま だ たろう=>OK\n や ま だ た ろ う=>OK\n 山田たろう=>NG //漢字\n 山田 たろう=>NG //漢字、空白\n ヤマダ たろう=>NG //カタカナ\n Yamada Tarou=>NG //英語\n やまだ たろう=>NG //スペースではじまる\n やまだ たろう=>NG //スペース2つ\n \n```\n\n以上を踏まえて下記の正規表現を作成しましたが、空白が2連続以上でもマッチしてしまいます。どこを直せばいいのかご教授いただけないでしょうか。\n\n作成した正規表現\n\n```\n\n ^[ぁ-ん][ぁ-ん]*|\\s?[ぁ-ん]+$\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T01:40:40.833", "favorite_count": 0, "id": "16214", "last_activity_date": "2015-09-04T02:17:11.163", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7232", "post_type": "question", "score": 2, "tags": [ "正規表現" ], "title": "正規表現の作り方", "view_count": 587 }
[ { "body": "まずグループ化されない `|` は\n\n```\n\n ^[ぁ-ん][ぁ-ん]*\n |\n \\s?[ぁ-ん]+$\n \n```\n\nと全体を分解しますからほとんど意図しないものになっています。「1. はじめと終わりはひらがな」なので\n\n```\n\n ^[ぁ-ん]\n (\n [ぁ-ん]*\n |\n \\s?\n )\n [ぁ-ん]$\n \n```\n\nが求めるものに近いです。これでも`[ぁ-ん]*`と`\\s?`のどちらかが出現してもよいという意味ですので、「空白が2連続以上」を認めています。発想を少しひねって\n\n> 2. 文字列中には空白1つまたは「ぁ」から「ん」。\n> 3. 空白は0〜1つ続いていい\n>\n\nを\n\n 2. 文字列中には空白1つまたは「ぁ」から「ん」。\n 3. 空白は「ぁ」から「ん」の直後に0~1つ\n\nと捉えることができます。これを表す正規表現は\n\n```\n\n ^[ぁ-ん]\n (\n [ぁ-ん]\n \\s?\n )*\n [ぁ-ん]$\n \n```\n\nただしこのままでは2文字目が空白となれませんので、最終的に\n\n```\n\n ^([ぁ-ん]\\s?)+[ぁ-ん]$\n \n```\n\nとなるでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T02:17:11.163", "id": "16217", "last_activity_date": "2015-09-04T02:17:11.163", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4236", "parent_id": "16214", "post_type": "answer", "score": 3 } ]
16214
16217
16217
{ "accepted_answer_id": "16225", "answer_count": 1, "body": "モデルにおけるリレーションでthroughにエラーが起きます。\n\nArgumentError: Unknown key: :through. Valid keys are: :class_name,\n:anonymous_class..\n\nエラーでググったのですが、throughがkeyとして認識されていないというような記事は見当たりませんでした。\n\n(User)モデルから(Article)モデルに中間テーブル(Review)を介して、リレーションをしようと\n\n`model/user.rb` \n`has_many :articles, through: :reviews`\n\nこのような形で指定しています。\n\n原因が分からず。よろしくお願いいたします", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T02:54:16.610", "favorite_count": 0, "id": "16218", "last_activity_date": "2015-09-04T05:16:34.763", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11188", "post_type": "question", "score": 0, "tags": [ "ruby-on-rails" ], "title": "ArgumentError: Unknown key: :through.", "view_count": 1356 }
[ { "body": "実際に使っている user.rb 、 review.rb 、 article.rb のコードをそのまま載せてください。 \nどこかに間違いや特殊な設定が隠れているのかもしれません。(関連の定義に別名を使っている等)\n\n通常であれば次のようなコードになっていれば普通に動くはずです。\n\n```\n\n class User < ActiveRecord::Base\n has_many :reviews\n has_many :articles, through: :reviews\n end\n \n class Review < ActiveRecord::Base\n belongs_to :user\n belongs_to :article\n end\n \n class Article < ActiveRecord::Base\n has_many :reviews\n has_many :users, through: :reviews\n end\n \n```", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T05:16:34.763", "id": "16225", "last_activity_date": "2015-09-04T05:16:34.763", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "85", "parent_id": "16218", "post_type": "answer", "score": 0 } ]
16218
16225
16225
{ "accepted_answer_id": "16239", "answer_count": 1, "body": "cocos2d-objCで書いたtiledMapを使ったゲームを、cocos2d-x(v3.7.1)で書き直しています。\n\nobjC版では、Tiledのオブジェクトグループからプロパティを読み込んで、 \nそのnameプロパティによって、ゲームに追加するキャラクター等オブジェクトのクラスを決定していました。\n\n例えば、nameプロパティには\"Player\"や\"Serpent\"(敵キャラ)が設定されており、 \nNSClassFromStringでPlayerクラスやSerpentクラスのクラスオブジェクトを取得して、 \nオブジェクトを生成しています。\n\nRRGLevel.m\n\n```\n\n for (NSDictionary* property in tiledMap.objectGroup.objects) {\n NSString* name = property[@\"name\"];\n \n RRGCharacter* character = [RRGCharacter levelObjectWithName:name level:self];\n [character setAttributesWithProperties:property];\n \n int x = [property[@\"x\"] intValue];\n int y = [property[@\"y\"] intValue];\n CGPoint tileCoord = [tiledMap tileCoordForTilePoint:ccp(x,y)];\n [self addCharacter:character atTileCoord:tileCoord];\n }\n \n```\n\nRRGLevelObject.m (RRGCharacterの親クラス)\n\n```\n\n +(instancetype)levelObjectWithName:(NSString *)name\n level:(RRGLevel *)level\n {\n Class class = NSClassFromString(name);\n \n RRGLevelObject* obj = [class levelObjectWithLevel:level];\n NSAssert(obj != nil, @\"Invalid name : %@\", name);\n return obj;\n }\n \n```\n\nしかしcocos2d-xではNSClassFromStringのような関数がないので、 \n同様のことをやろうとすると、数十個のクラスについて場合分けを書かねばならず、 \nまた、クラスが追加された時に、いちいち場合分け文を追加しなければなりません。\n\ncocos2d-xで、Tiledのプロパティに設定したnameから、対応したクラスのオブジェクトを生成する効率的な方法がありましたら教えてください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T03:37:12.567", "favorite_count": 0, "id": "16221", "last_activity_date": "2015-09-06T10:50:08.550", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8825", "post_type": "question", "score": 2, "tags": [ "c++", "cocos2d-x" ], "title": "cocos2d-xで文字列によって生成するオブジェクトのクラスを決定する", "view_count": 461 }
[ { "body": "効率的とは言えないかもしれませんが、C++ではFactory Methodパターンを使う場面だと思います。 \n例えば、[Loki::Factory](http://loki-\nlib.sourceforge.net/html/a00621.html)を使うと以下のように書けます。\n\n```\n\n enum RRGLevel {RRGLevel_normal};\n \n // RRGCharacter.hpp\n struct RRGCharacter {\n virtual const char *type_name() const = 0;\n };\n \n // RRGCharacterFactory.hpp\n #include <string>\n #include \"loki/Factory.h\"\n #include \"loki/Singleton.h\"\n typedef Loki::SingletonHolder<Loki::Factory<RRGCharacter, std::string, Loki::Seq<RRGLevel> > > RRGCharacterFactory;\n \n // Player.hpp\n struct Player: RRGCharacter {\n Player(RRGLevel level) {}\n virtual const char *type_name() const { return \"Player\"; };\n };\n \n // Player.cpp\n namespace {\n RRGCharacter *createPlayer(RRGLevel level) { return new Player(level); }\n const bool registered = RRGCharacterFactory::Instance().Register(\"Player\", createPlayer);\n }\n \n // Serpent.hpp\n struct Serpent: RRGCharacter {\n Serpent(RRGLevel level) {}\n virtual const char *type_name() const { return \"Serpent\"; };\n };\n \n // Serpent.cpp\n namespace {\n RRGCharacter *createSerpent(RRGLevel level) { return new Serpent(level); }\n const bool registered = RRGCharacterFactory::Instance().Register(\"Serpent\", createSerpent);\n }\n \n // main.cpp\n #include <iostream>\n #include <string>\n \n int main()\n {\n std::string name(\"Player\");\n RRGLevel level = RRGLevel_normal;\n std::auto_ptr<RRGCharacter> character(\n RRGCharacterFactory::Instance().CreateObject(name, level));\n std::cout << character->type_name() << \"\\n\";\n \n name = \"Serpent\";\n character.reset(\n RRGCharacterFactory::Instance().CreateObject(name, level));\n std::cout << character->type_name() << \"\\n\";\n }\n \n```\n\n◇追記 \n`RRGCharacterFactory`は、`Register(識別子,\n関数ポインター)`で指定された識別子とそれに対応する関数ポインターを保持し、`CreateObject(識別子,\n対応する関数への引数)`で対応する関数を検索して呼び出します。 \n従って、キャラクタークラスを増やす場合に`RRGCharacterFactory`を一切変更する必要はありません。 \nファクトリクラスを自分で一々作るのは面倒だし同じような実装になるので、Lokiライブラリではクラステンプレートで汎用的なファクトリクラステンプレートを定義しています。\n\n自分でRRGCharacterFactoryを作る場合は、例えば以下のようになります。\n\n```\n\n // RRGCharacterFactory.hpp\n #include <map>\n #include <stdexcept>\n #include <string>\n #include <utility>\n \n class RRGCharacterFactory\n {\n public:\n typedef RRGCharacter *(*CharacterCreator)(RRGLevel);\n private:\n typedef std::map<std::string, CharacterCreator> NameToCharacterMap;\n \n public:\n //! @attention コンパイラーによってはスレッドアンセーフ\n static RRGCharacterFactory &Instance() {\n static RRGCharacterFactory instance;\n return instance;\n }\n \n private:\n NameToCharacterMap m_associations;\n \n private:\n RRGCharacterFactory() {}\n ~RRGCharacterFactory() {}\n RRGCharacterFactory(const RRGCharacterFactory &);\n RRGCharacterFactory &operator=(const RRGCharacterFactory &);\n \n public:\n //! @attention スレッドアンセーフ\n bool Register(const std::string &name, CharacterCreator creator) {\n return m_associations.insert(\n std::make_pair(name, creator)).second;\n }\n \n //! @attention スレッドアンセーフ\n bool Unregister(const std::string &name) {\n return m_associations.erase(name) != 0;\n }\n \n RRGCharacter *CreateObject(const std::string &name, RRGLevel level) {\n NameToCharacterMap::const_iterator i = m_associations.find(name);\n if ( i == m_associations.end() ) {\n throw std::invalid_argument(\"Unknown Name\");\n }\n return (i->second)(level);\n }\n };\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T07:11:47.060", "id": "16239", "last_activity_date": "2015-09-06T10:50:08.550", "last_edit_date": "2015-09-06T10:50:08.550", "last_editor_user_id": "7291", "owner_user_id": "7291", "parent_id": "16221", "post_type": "answer", "score": 2 } ]
16221
16239
16239
{ "accepted_answer_id": "16412", "answer_count": 2, "body": "GoogleCloudPlatformのVMインスタンスでCentOS7が入っています。 \n誤ってこ下記URLを参考に下記コードを実行し、rebootしたところ、SSH接続できなくなってしまいました。\n\n備忘録)CentOS 7 で最初やってそうなことのまとめ。 \n不要サービスを停止 \n<http://qiita.com/dumpty-alma@github/items/091862834317229559f1>\n\n```\n\n systemctl disable NetworkManager\n rm '/etc/systemd/system/multi-user.target.wants/NetworkManager.service'\n rm '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service' \n rm '/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service'\n \n```\n\nGoogleのシリアルコンソール出力はこちらです。今も連続的にこのような文字列が発生しています。\n\n```\n\n Sep 4 13:42:29 localhost accounts-from-metadata: WARNING error while trying to update accounts: <urlopen error [Errno 101] Network is unreachable> Sep 4 \n 13:42:30 localhost google: Waiting for metadata server, attempt 18316 Sep 4 \n 13:42:30 localhost google: There is likely a problem with the network.\n \n```\n\nスナップショットを取り、新しくインスタンスを作成しましたが、起動できませんでした。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T05:01:06.783", "favorite_count": 0, "id": "16223", "last_activity_date": "2015-09-09T02:43:06.823", "last_edit_date": "2015-09-04T09:23:05.737", "last_editor_user_id": "4361", "owner_user_id": "7973", "post_type": "question", "score": 0, "tags": [ "centos", "google-compute-engine" ], "title": "GoogleCloudEngineで起動エラー", "view_count": 159 }
[ { "body": "NetworkManagerを止めるとnetworkの起動は従来通りchkconfig 経由になります。よって、`chkconfig network\non`されていなければネットワークはたちあがりませんよ。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T23:55:32.257", "id": "16274", "last_activity_date": "2015-09-04T23:55:32.257", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8136", "parent_id": "16223", "post_type": "answer", "score": 1 }, { "body": "スタートアップスクリプトでchkconfigを起ち上げるようなものを入れ込むことで解決したりしませんか? \n一応、スタートアップスクリプトは外部から渡せます。以下参照。 \n<https://cloud.google.com/compute/docs/startupscript>", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-09T02:43:06.823", "id": "16412", "last_activity_date": "2015-09-09T02:43:06.823", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4989", "parent_id": "16223", "post_type": "answer", "score": 1 } ]
16223
16412
16274
{ "accepted_answer_id": null, "answer_count": 1, "body": "API通信を高速化するためMessagePackを使用したいと考えており \nシリアライズ・デシリアライズの速度がどれだけ違うかを \nMessagePackとJSONを使用して、 \n下記処理で速度比較を行っています。\n\n**■追記** \n**計測に誤りがあったのでソースコード書き直し、計測値を再計測 \nシリアライズ後のサイズを追加** \n\n**データ作成→時間計測→シリアライズ→時間計測→デシリアライズ→時間計測**\n\n \n**■使用したMsgPack**\n\n<https://github.com/msgpack/msgpack-cli/releases>\n\n上記URLのバージョン **0.62** 内にあるzipファイルを展開して \n**unity3d** フォルダ内にある **MsgPack.dll** を使用しています。\n\n**■使用したJson**\n\nMiniJSON\n\n**■テストケース** \n1: \n(0-10000までのintのListを100回シリアライズ・デシリアライズした平均値)を \nAndroid実機で確認\n\n2: \n(0-10000までのstringのListを100回シリアライズ・デシリアライズした平均値)を \nAndroid実機で確認\n\n**■テスト結果** \n■ケース1 \nMsgPack(Array): \nシリアライズ後のバイト数:29747 \nシリアライズ時間 :24.6msec \nデシリアライズ時間:165.2msec\n\nJson: \nシリアライズ後のバイト数:48891 \nシリアライズ時間 :31.1msec \nデシリアライズ時間:74.7msec\n\n■ケース2 \nMsgPack(Array): \nシリアライズ後のバイト数:48893 \nシリアライズ時間 :37.6 msec \nデシリアライズ時間:277.0 msec \nJson: \nシリアライズ後のバイト数:68891 \nシリアライズ時間 :22.2 msec \nデシリアライズ時間:57.5 msec\n\n**■ソースコード**\n\n```\n\n using UnityEngine;\n using System;\n using System.IO;\n using System.Collections;\n using System.Collections.Generic;\n using MiniJSON;\n using MsgPack;\n using MsgPack.Serialization;\n using System.Linq;\n \n public class MsgPackAndJsonCompare : MonoBehaviour {\n \n public int SampleCount = 100;\n \n private string MsgLog = \"\";\n private int SampleIndex = 0;\n \n \n List<long> ArrayListLong = new List<long>();\n List<string> ArrayListString = new List<string>();\n \n \n \n /// <summary>\n /// intデータ作成処理\n /// </summary>\n public void OnClickArrayInt()\n {\n for(int i = 0; i < 10000; i++)\n {\n ArrayListLong.Add(i);\n }\n Debug.Log(\"OnClickArrayInt End\");\n }\n \n \n /// <summary>\n /// Stringデータ作成処理\n /// </summary>\n public void OnClickArrayString()\n {\n for (int i = 0; i < 10000; i++)\n {\n ArrayListString.Add(i.ToString());\n }\n Debug.Log(\"OnClickArrayString End\");\n \n }\n \n \n /// <summary>\n /// 100回ループするテスト開始\n /// </summary>\n /// <param name=\"sendMode\"></param>\n public void OnClickCompare(int sendMode)\n {\n SampleIndex = 0;\n \n for (int i = SampleIndex; i < SampleCount; i++)\n {\n MsgLog = MsgLog + \",LoopCnt=\" + i.ToString();\n MsgLog = MsgLog + \",StartTime=\" + DateTime.Now.Ticks.ToString();\n \n MainFunc(sendMode);\n \n MsgLog = MsgLog + \" ,EndTime=\" + DateTime.Now.Ticks.ToString() + \"\\n\";\n }\n \n Debug.Log(\"Function End\");\n \n \n }\n \n /// <summary>\n /// メイン処理\n /// </summary>\n /// <param name=\"compareMode\"></param>\n private void MainFunc(int compareMode)\n {\n // ArrayInt-MsgPack\n if (compareMode == 0)\n {\n MsgLog = MsgLog + \",シリアライズStartTime=\" + DateTime.Now.Ticks.ToString();\n var stream = new MemoryStream();\n // Create serializer instance.\n var serializer = MessagePackSerializer.Get<List<long>>();\n serializer.Pack(stream, ArrayListLong);\n \n //long datalen = stream.Length;\n \n MsgLog = MsgLog + \",シリアライズEndTime=\" + DateTime.Now.Ticks.ToString();\n stream.Position = 0;\n List<long> deserializedObject = serializer.Unpack(stream);\n MsgLog = MsgLog + \",デシリアライズEndTime=\" + DateTime.Now.Ticks.ToString();\n }\n // ArrayInt-Json\n else if (compareMode == 1)\n {\n MsgLog = MsgLog + \",シリアライズStartTime=\" + DateTime.Now.Ticks.ToString();\n string serialized = Json.Serialize(ArrayListLong);\n \n int ilenb = System.Text.Encoding.GetEncoding(65001).GetByteCount(serialized);\n \n MsgLog = MsgLog + \",シリアライズEndTime=\" + DateTime.Now.Ticks.ToString();\n List<System.Object> deserializedDoubleList = Json.Deserialize(serialized) as List<System.Object>;\n List<long> longList = deserializedDoubleList.OfType<long>().ToList();\n MsgLog = MsgLog + \",デシリアライズEndTime=\" + DateTime.Now.Ticks.ToString();\n \n }\n // ArrayString-MsgPack\n else if (compareMode == 2)\n {\n MsgLog = MsgLog + \",シリアライズStartTime=\" + DateTime.Now.Ticks.ToString();\n var stream = new MemoryStream();\n // Create serializer instance.\n var serializer = MessagePackSerializer.Get<List<string>>();\n serializer.Pack(stream, ArrayListString);\n \n long datalen = stream.Length;\n \n MsgLog = MsgLog + \",シリアライズEndTime=\" + DateTime.Now.Ticks.ToString();\n stream.Position = 0;\n List<string> deserializedObject = serializer.Unpack(stream);\n MsgLog = MsgLog + \",デシリアライズEndTime=\" + DateTime.Now.Ticks.ToString();\n }\n // ArrayString-Json\n else if (compareMode == 3)\n {\n MsgLog = MsgLog + \",シリアライズStartTime=\" + DateTime.Now.Ticks.ToString();\n string serialized = Json.Serialize(ArrayListString);\n \n int ilenb = System.Text.Encoding.GetEncoding(65001).GetByteCount(serialized);\n \n MsgLog = MsgLog + \",シリアライズEndTime=\" + DateTime.Now.Ticks.ToString();\n List<System.Object> deserializedDoubleList = Json.Deserialize(serialized) as List<System.Object>;\n List<string> longList = deserializedDoubleList.OfType<string>().ToList();\n MsgLog = MsgLog + \",デシリアライズEndTime=\" + DateTime.Now.Ticks.ToString();\n \n }\n }\n \n \n public void OnclickLog()\n {\n StartCoroutine(LogDisp());\n \n }\n \n \n IEnumerator LogDisp()\n {\n string[] LogArray = MsgLog.Split('\\n');\n \n int maxloop = LogArray.Length;\n int i = 0;\n while (i < maxloop)\n {\n Debug.Log(\"Log=\" + LogArray[i]);\n \n yield return 0;\n \n i++;\n \n }\n }\n \n```\n\n■問題点 \nネットなどで情報を集めているとMessagePackの方が早いという記述が \n多くみられるのですが、私のソースではMessagePackで処理するよりも \nJSONの方が速度が速いため、やり方が間違っているのではと疑っています。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T05:14:45.883", "favorite_count": 0, "id": "16224", "last_activity_date": "2015-09-07T07:29:36.410", "last_edit_date": "2015-09-07T06:03:23.127", "last_editor_user_id": "5261", "owner_user_id": "5261", "post_type": "question", "score": 3, "tags": [ "c#", "unity3d", "json" ], "title": "MessagePackのシリアライズ・デシリアライズ時間がJsonよりが遅くなる", "view_count": 5287 }
[ { "body": "シリアライズとは入力データをバイナリなどに変換することです。 \nデシリアライズとはその逆でバイナリなどを入力データの形に戻すことです。\n\n`MessagePackSerializer`は`List<int>`をシリアライズし、また`List<int>`へとデシリアライズしています。 \nしかし`Json.Serialize`は`List<int>`をシリアライズはしますが、`Json.Deserialize`は`List<int>`へとは戻しておらず、JSON文字列をデコードしかしていません。(返されるのは`object[]`かな?)\n\nですので対等な比較になっていません。\n\n* * *\n\nさっぱり通じていないようなので追記します。 \n`MessagePackSerializer`は条件を満たせば任意の型対応しています。例えば\n\n```\n\n public struct Color {\n public int R;\n public int G;\n public int B;\n public override string ToString() { return \"Hoge\"; }\n }\n \n```\n\nを渡しても型を解釈し、パブリックプロパティをシリアライズしますし、デシリアライズ時には各プロパティ値を復元したものを返します。 \n対して`MiniJSON`は、型を維持しません。[未知の型に対してはToString()](https://gist.github.com/darktable/1411710#file-\nminijson-cs-L542)した結果をシリアライズしますし、数値は`double`や`int64`にデシリアライズします。 \n結果、`MiniJSON`で上記`Color`をシリアライズするとJSON文字列は `\"Hoge\"`\nになりますし、デシリアライズしても文字列しか得られません。\n\nですので対等な比較になっていません。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T05:22:32.550", "id": "16279", "last_activity_date": "2015-09-07T07:29:36.410", "last_edit_date": "2015-09-07T07:29:36.410", "last_editor_user_id": "4236", "owner_user_id": "4236", "parent_id": "16224", "post_type": "answer", "score": 1 } ]
16224
null
16279
{ "accepted_answer_id": "16240", "answer_count": 2, "body": "現在、servletで\n\n```\n\n <error-page>\n <error-code>404</error-code>\n <location>/エラーページ.jsp</location>\n </error-page>\n \n <error-page>\n <error-code>405</error-code>\n <location>/エラーページ.jsp</location>\n </error-page>\n \n```\n\nという設定をしており、ページ遷移後に何のエラーによって遷移してきたかを判断したいと考えております。 \nそのために、エラーコードまたはエラー名をエラーページ.jspで取得したいのですが、方法が分かりません。 \n解決方法の分かる方がいましたらご教授をお願いします。\n\nまた、<%= exception\n%>やリクエストの中身には、目的のデータは格納されていないようでした。servletの設定方法で、パラメータを渡す設定が出来ないか調査しています。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T05:41:16.173", "favorite_count": 0, "id": "16226", "last_activity_date": "2015-09-04T08:03:49.860", "last_edit_date": "2015-09-04T05:52:13.000", "last_editor_user_id": "7626", "owner_user_id": "7626", "post_type": "question", "score": 1, "tags": [ "jsp", "exception", "servlet" ], "title": "servlet <error-page>によって、エラー用JSPに遷移した時にエラーコード、またはエラー名を受け取りたい", "view_count": 4370 }
[ { "body": "エラー用のJSPファイルのヘッダにて、\n\n```\n\n <%@ page isErrorPage=\"true\" %>\n \n```\n\nとすることで、JSP内で 暗黙オブジェクトである exception が扱えるようになります。 \nexceptionオブジェクトには、サーブレットやJSPで発生した例外が入っていますので、例外クラスによって表示を切り替えるのも可能でしょう。\n\nただし、exceptionで拾うのはサーブレットやJSPなどJava内で発生した例外を扱うものです。 \n具体的な例を挙げると、HTTPレスポンスコード404のようにリソースが存在しないURLを指定した場合にはサーブレットが実行されませんので適しません。\n\n以下の記事も参考にしてください。\n\n2.5. exception - Techscore様 \n<http://www.techscore.com/tech/Java/JavaEE/JSP/2-5/>", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T05:54:58.397", "id": "16228", "last_activity_date": "2015-09-04T05:54:58.397", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5778", "parent_id": "16226", "post_type": "answer", "score": 1 }, { "body": "error-pageで制御せず、servletでfilterを設定します。 \nfilterで指定したクラス内の処理で、リクエストにエラー文言を入れます。\n\nerror-pageを使用していないので、エラー種別はjava側で判定し割り出すしかないです。 \n例えあ、アクセスURL内に特定の文言が含まれていない場合は不正アクセスとする など・・", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T08:03:49.860", "id": "16240", "last_activity_date": "2015-09-04T08:03:49.860", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7626", "parent_id": "16226", "post_type": "answer", "score": 1 } ]
16226
16240
16228
{ "accepted_answer_id": "16230", "answer_count": 1, "body": "[ons.notification](http://ja.onsen.io/reference/ons.notification.html).alertのメッセージ内で改行したいのですが、うまく動作しません。 \n「`<br>`」「`\\n`」「`\\\\n`」の3つを試してみたのですが、そのまま文字として表示されてしまい、改行できませんでした。 \nどうすれば改行できるのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T05:57:51.607", "favorite_count": 0, "id": "16229", "last_activity_date": "2015-09-04T06:08:29.517", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11028", "post_type": "question", "score": 1, "tags": [ "monaca", "onsen-ui" ], "title": "ons.notification内で改行したい", "view_count": 2200 }
[ { "body": "[アラートダイアログを使う](http://ja.onsen.io/guide/overview.html#UsingAlert)\n\nのサンプルにコメントで書いてありますが、messageではなくmessageHTMLを使用します。\n\n```\n\n ons.notification.alert({\n // message: 'メッセージ',\n messageHTML: 'メッセージが<br>改行されました。',\n // もしくはmessageHTML: '<div>HTML形式のメッセージ</div>',\n title: 'ダイアログのタイトル',\n buttonLabel: 'OK',\n animation: 'default', // もしくは'none'\n // modifier: 'optional-modifier'\n callback: function() {\n // ボタンがタップされた\n }\n });\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T06:08:29.517", "id": "16230", "last_activity_date": "2015-09-04T06:08:29.517", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9566", "parent_id": "16229", "post_type": "answer", "score": 2 } ]
16229
16230
16230
{ "accepted_answer_id": "16233", "answer_count": 1, "body": "```\n\n var a: Int = { 10 + 20 }() // (1)\n var b: Int { return 10 + 20 } // (2)\n \n println(a)\n println(b)\n \n```\n\n上記コードの場合、変数a, bともに30と表示されます。\n\n(1)はclosureの結果がaに格納されていると理解できるのですが、(2)でbに値が入るのが理解できません。\n\n(2)もclosureなのでしょうか? \nなぜ「=」がないのでしょうか? \nなぜ式の末尾に「()」がないのでしょうか?\n\nご教授お願い致します。\n\nまた、参考になるサイトがあれば教えて下さい。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T06:10:47.413", "favorite_count": 0, "id": "16231", "last_activity_date": "2015-09-04T06:40:51.020", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "post_type": "question", "score": 1, "tags": [ "swift" ], "title": "swiftの値の格納方法について", "view_count": 84 }
[ { "body": "(2)は、 **Computed Property** (計算プロパティ)です。省略せず定義を記述すると、\n\n```\n\n var b: Int {\n get {\n return 10 + 20\n }\n }\n \n```\n\nComputed Propertyの定義は、基本Getter(`get {}`)とSetter(`set()\n{}`)がセットになりますが、Setterは省略可能で、省略した場合、ご質問にあるように、\n\n```\n\n var b: Int { return 10 + 20 }\n \n```\n\nという省略構文が使えます。\n\n> また、参考になるサイトがあれば教えて下さい。\n\nApple Developer \n[The Swift Programming Language -\nProperties](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Properties.html#//apple_ref/doc/uid/TP40014097-CH14-ID254)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T06:35:33.203", "id": "16233", "last_activity_date": "2015-09-04T06:40:51.020", "last_edit_date": "2015-09-04T06:40:51.020", "last_editor_user_id": "7362", "owner_user_id": "7362", "parent_id": "16231", "post_type": "answer", "score": 1 } ]
16231
16233
16233
{ "accepted_answer_id": null, "answer_count": 2, "body": "AWSのAmazon Linuxにcakephpをアップロードしたのですが、cakephpの初期画面が出ずに以下のようなエラーが出現しています。 \nAWSのサーバーにはphpをインストール済みです。 \n詳しい方、ご教示ください。よろしくお願いいたします。\n\n```\n\n Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function.\n In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.\n We selected 'UTC' for 'UTC/0.0/no DST' instead in /var/www/html/cakephp/lib/Cake/Cache/CacheEngine.php on line 60\n Warning: _cake_core_ cache was unable to write 'cake_dev_ja' to File cache in /var/www/html/cakephp/lib/Cake/Cache/Cache.php on line 328\n Warning: /var/www/html/cakephp/app/tmp/cache/persistent/ is not writable in /var/www/html/cakephp/lib/Cake/Cache/Engine/FileEngine.php on line 385\n Fatal error: Uncaught exception 'CacheException' with message 'Cache engine \"_cake_core_\" is not properly configured.\n Ensure required extensions are installed, and credentials/permissions are correct' in /var/www/html/cakephp/lib/Cake/Cache/Cache.php:186\n Stack trace:\n #0 /var/www/html/cakephp/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_') \n #1 /var/www/html/cakephp/app/Config/core.php(374): Cache::config('_cake_core_', Array) \n #2 /var/www/html/cakephp/lib/Cake/Core/Configure.php(72): include('/var/www/html/c...') \n #3 /var/www/html/cakephp/lib/Cake/bootstrap.php(175): Configure::bootstrap(true) \n #4 /var/www/html/cakephp/app/webroot/index.php(104): include('/var/www/html/c...') \n #5 /var/www/html/cakephp/index.php(41): require('/var/www/html/c...') \n #6 {main} thrown in /var/www/html/cakephp/lib/Cake/Cache/Cache.php on line 186\n \n```\n\n追記:nginxを再起動したら、画面が出たのですが、CSSが効いていないようです。。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T06:29:27.880", "favorite_count": 0, "id": "16232", "last_activity_date": "2015-09-04T09:21:26.943", "last_edit_date": "2015-09-04T09:21:26.943", "last_editor_user_id": "10492", "owner_user_id": "8619", "post_type": "question", "score": 1, "tags": [ "php", "linux", "cakephp", "aws" ], "title": "cakephpの初期画面が表示されない", "view_count": 2460 }
[ { "body": "エラーメッセージを見る限りではキャッシュを書き込むディレクトリの書き込み権限に問題があるようです。\n\n> Warning: /var/www/html/cakephp/app/tmp/cache/persistent/ is not writable\n\nということのようですから、上記のディレクトリにおいてnginxを実行するユーザの書き込み権限の有無を確認してみてください。\n\ncssについてはnginxの設定でドキュメントルートが `/var/www/html/cakephp/app/webroot`\nを指しているかどうかの確認が必要かと思われます。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T07:08:24.460", "id": "16238", "last_activity_date": "2015-09-04T07:08:24.460", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10492", "parent_id": "16232", "post_type": "answer", "score": -1 }, { "body": "書き込み権限以外にもPHPの設定が足りていないようですね。\n\n> Warning: strtotime(): It is not safe to rely on the system's timezone\n> settings. You are _required_ to use the date.timezone setting or the\n> date_default_timezone_set() function. In case you used any of those methods\n> and you are still getting this warning, you most likely misspelled the\n> timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in\n> /var/www/html/cakephp/lib/Cake/Cache/CacheEngine.php on line 60\n\nようするにdate.timezoneの設定がされていないからUTCとして認識してるということです。 \n日本で運用する場合は以下の設定をphp.iniなどにすればいいです。\n\n```\n\n date.timezone = Asia/Tokyo\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T08:41:45.853", "id": "16244", "last_activity_date": "2015-09-04T08:41:45.853", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4262", "parent_id": "16232", "post_type": "answer", "score": 1 } ]
16232
null
16244
{ "accepted_answer_id": null, "answer_count": 1, "body": "Monacaで英単語アプリの開発を考えているのですが、単語の音声として、Media\nAPIを使ってローカルにある音声ファイルを再生させるようにしたいと思っています。ファイルサイズ的にどの程度の容量がおけるなどの制限はあったりするのでしょうか?(ローカルなので制限はなさそうとも考えていますが。。。)Monacaは初めてさわるので、初歩的な質問で大変恐れ入りますが、どなたかご教示頂けましたら幸いです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T06:52:39.400", "favorite_count": 0, "id": "16235", "last_activity_date": "2015-09-07T02:00:59.853", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12197", "post_type": "question", "score": -2, "tags": [ "monaca" ], "title": "Media APIでのローカルの音声ファイル呼び出しに関して", "view_count": 149 }
[ { "body": "プログラム、リソースを含めて50MB以内を推奨します。 \n現在は4GBまでパッケージに出来ますが、 \nダウンロードに時間がかかるのと、端末の容量を圧迫するのでお勧めしません。 \nどれくらいの単語数を登録するのか分かりませんが、 \n相当量の音声ファイルでしたらストリーミングした方が良いかと思います。 \nまた、ファイルを端末に保存し、その後再生する方法もありますので、 \n再生する際に逐次ダウンロードを考察するのもありかもしれません。 \nFileTransfer( <http://docs.monaca.mobi/3.5/ja/reference/phonegap_34/ja/file-\ntransfer/> )を確認してください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T02:00:59.853", "id": "16335", "last_activity_date": "2015-09-07T02:00:59.853", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7676", "parent_id": "16235", "post_type": "answer", "score": 1 } ]
16235
null
16335
{ "accepted_answer_id": "16260", "answer_count": 1, "body": "```\n\n class Hoge {\n var a: Int\n \n init(a: Int) {\n self.a = a // (1)\n }\n \n var b: Int {\n return self.a // (2)\n }\n \n func c() -> Int {\n return self.a // (3)\n }\n \n var d = { self.a * 2 }() // (4)\n }\n \n```\n\n上記コードで、(1),(2),(3)のselfは正しく自分を参照しますが、(4)は以下エラーが表示されます。\n\n```\n\n <stdin>:17:19: error: use of unresolved identifier 'self'\n var d = { self.a * 2 }() // (4)\n ^\n \n```\n\nまた、selfを外し、\n\n```\n\n var d = { a * 2 }() // (4)\n \n```\n\nとすると、以下エラーが表示されます。\n\n```\n\n <stdin>:17:19: error: 'Hoge.Type' does not have a member named 'a'\n var d = { a * 2 }() // (4)\n ^\n \n```\n\n実行環境は、以下になるのですが、この環境のバグでしょうか? \nそれとも、何か間違っているのでしょうか?\n\n<http://swiftstub.com/>\n\nよろしくお願いします。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T06:57:08.810", "favorite_count": 0, "id": "16236", "last_activity_date": "2015-09-04T13:42:27.770", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "post_type": "question", "score": 1, "tags": [ "swift" ], "title": "selfの参照について", "view_count": 1292 }
[ { "body": "Swiftの言語仕様上、参照型の`self`へアクセスできるタイミングは決まっているためだと思います。\n\n> **Safety check 4** \n> An initializer cannot call any instance methods, read the values of any\n> instance properties, or refer to self as a value until after the first phase\n> of initialization is complete.\n>\n> [Initialization - The Swift Programming\n> Language](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Initialization.html)\n\n初期化処理の第一段階が完了するまでは、`self`は無効な識別子です。これはベースクラスのプロパティが初期化されていない、不定状態のインスタンスへアクセスする可能性を防ぐためです。\n\n* * *\n\nまた、その記述が合法だとすると、別な問題がありえます。\n\nクロージャが参照型であり、プロパティはARCによるメモリ管理がされることを考えると、`self`とクロージャは互いに強参照し、循環参照となり、一度生成したインスタンスは絶対に解放されないことになります。\n\nこの問題は遅延初期化プロパティにしていても変わらないため、\n\n```\n\n lazy var d :() -> Int = {\n [unowned self] in\n self.a * 2\n }\n \n```\n\nと書くのが望ましいです。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T13:42:27.770", "id": "16260", "last_activity_date": "2015-09-04T13:42:27.770", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5337", "parent_id": "16236", "post_type": "answer", "score": 1 } ]
16236
16260
16260
{ "accepted_answer_id": null, "answer_count": 1, "body": "```\n\n try{\n FileInputStream fis = new FileInputStream(file1);\n BufferedInputStream bis = new BufferedInputStream(fis);\n bis.read(binaryData1);\n bis.close();\n fis.close();\n fis = new FileInputStream(file2);\n bis = new BufferedInputStream(fis);\n bis.read(binaryData2);\n bis.close();\n fis.close();\n \n byte[] outputBinary = new byte[(int)(binaryData1.length+binaryData2.length-44)];\n System.arraycopy(binaryData1,0, outputBinary, 0, binaryData1.length);\n System.arraycopy(binaryData2,44, outputBinary, binaryData1.length, binaryData2.length-44);\n \n int fileSize = outputBinary.length-8;\n outputBinary[4]=(byte)(fileSize & 0xff);\n outputBinary[5]=(byte)((fileSize >>> 8)&0xff);\n outputBinary[6]=(byte)((fileSize >>> 16)&0xff);\n outputBinary[7]=(byte)((fileSize >>> 24)&0xff);\n \n int fileData = outputBinary.length-44;\n outputBinary[4]=(byte)(fileData & 0xff);\n outputBinary[5]=(byte)((fileData << 8)&0xff);\n outputBinary[6]=(byte)((fileData << 16)&0xff);\n outputBinary[7]=(byte)((fileData << 24)&0xff);\n \n```\n\n2つのwavファイルを結合させるプログラムを作っているのですが、一つ目の音声ファイルを再生し終えると再生が止まってしまいます。ファイルデータの更新がないことに気がついたのですが、どのように直したらいいでしょうか。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T08:12:44.037", "favorite_count": 0, "id": "16241", "last_activity_date": "2015-10-05T02:56:10.133", "last_edit_date": "2015-09-04T14:23:13.760", "last_editor_user_id": "11127", "owner_user_id": "11127", "post_type": "question", "score": 3, "tags": [ "java" ], "title": "Javaでのwavファイル結合について", "view_count": 973 }
[ { "body": "fileData の方、シフトの向きが逆なのと、書き込み位置が間違ってますね。\n\n```\n\n outputBinary[40]=(byte)(fileData & 0xff);\n outputBinary[41]=(byte)((fileData >> 8)&0xff);\n outputBinary[42]=(byte)((fileData >> 16)&0xff);\n outputBinary[43]=(byte)((fileData >> 24)&0xff);\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T02:52:26.010", "id": "16277", "last_activity_date": "2015-09-05T02:52:26.010", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5288", "parent_id": "16241", "post_type": "answer", "score": 3 } ]
16241
null
16277
{ "accepted_answer_id": "16248", "answer_count": 1, "body": "web.xmlでフィルタ設定を行うと、起動中の例外が発生します。 \n(フィルタで指定したクラスの動作をデバックで確認すると正常動作している。jsp表示時にcssの読み込みが出来なくなってしまう)\n\nweb.xmlの設定状況↓\n\n```\n\n ---web.xml---\n <filter>\n <filter-name>abcFilter</filter-name>\n <filter-class>filterclass</filter-class>\n </filter>\n <filter-mapping>\n <filter-name>abcFilter</filter-name>\n <url-pattern>*.jsp</url-pattern>\n </filter-mapping>\n \n```\n\nコンソール出力↓\n\n```\n\n ---コンソール---\n ~前半省略~\n 情報: Using a shared selector for servlet write/read [金 9 04 17:30:56 JST 2015]\n 情報: Initialization processed in 549 ms [金 9 04 17:30:56 JST 2015]\n 情報: サービス Catalina を起動します [金 9 04 17:30:56 JST 2015]\n 情報: Starting Servlet Engine: Apache Tomcat/8.0.24 [金 9 04 17:30:56 JST 2015]\n 情報: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. [金 9 04 17:30:56 JST 2015]\n 重大: フィルタfilterClass の起動中の例外です [金 9 04 17:30:57 JST 2015]\n 重大: One or more Filters failed to start. Full details will be found in the appropriate container log file [金 9 04 17:30:57 JST 2015]\n 重大: 以前のエラーのためにコンテキストの起動が失敗しました [] [金 9 04 17:30:57 JST 2015]\n 警告: Name = postgres Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of \"30\" for \"maxActive\" property, which is being ignored. [金 9 04 17:30:57 JST 2015]\n 警告: Name = postgres Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of \"108000000\" for \"maxWait\" property, which is being ignored. [金 9 04 17:30:57 JST 2015]\n 情報: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. [金 9 04 17:30:57 JST 2015]\n 情報: Starting ProtocolHandler [\"http-nio-8080\"] [金 9 04 17:30:57 JST 2015]\n 情報: Starting ProtocolHandler [\"ajp-nio-8009\"] [金 9 04 17:30:57 JST 2015]\n 情報: Server startup in 1436 ms [金 9 04 17:30:57 JST 2015]\n \n```\n\n解決方法の分かる方がいましたら、ご教授をお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T08:38:26.463", "favorite_count": 0, "id": "16243", "last_activity_date": "2015-09-17T11:32:22.800", "last_edit_date": "2015-09-17T11:32:22.800", "last_editor_user_id": "8000", "owner_user_id": "7626", "post_type": "question", "score": 1, "tags": [ "java", "tomcat", "servlet" ], "title": "web.xmlでフィルタ設定を行うと、起動中の例外が発生する(フィルタで指定したクラスの動作をデバックで確認すると正常動作している)", "view_count": 23733 }
[ { "body": "filterclassを含むプロジェクトの配置がなされていません。 \nfilterclassを含むプロジェクトをTomcatのlib内にエクスポートします。 \nそうすると、エラーが解消されます。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T10:06:06.583", "id": "16248", "last_activity_date": "2015-09-04T10:06:06.583", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7626", "parent_id": "16243", "post_type": "answer", "score": 0 } ]
16243
16248
16248
{ "accepted_answer_id": null, "answer_count": 2, "body": "AngularJSでGoogleMapAPIを用いてJSON形式のレスポンスを取得したいのですが、 \nコンソールに\"Uncaught SyntaxError: Unexpected token :\"とエラー表示されます。 \nレスポンスのJSONに\":\"が存在する為、このエラーが発生するのでしょうか? \n解決方法はありますでしょうか?\n\nどなたかわかる方いらっしゃいましたら、 \nご教示いただけると幸いです。\n\nよろしくお願いいたします。\n\n\\---------- ソース ----------\n\n```\n\n var deferred = $q.defer();\n \n $http.jsonp('https://maps.googleapis.com/maps/api/distancematrix/json?origins=Tokyo&destinations=Kyoto&mode=Driving&sensor=false', {\n params: {\n callback: 'JSON_CALLBACK'\n }\n }).success(function(response){\n console.dir(data,status,headers,config);\n deferred.resolve(data); \n }).error(function(data,status,headers,config){\n deferred.reject(status);\n });\n \n return deferred.promise;\n \n```\n\n\\---------- コンソール出力 ----------\n\n```\n\n Uncaught SyntaxError: Unexpected token : (18:20:02:095 | error, javascript)\n at https://maps.googleapis.com/maps/api/distancematrix/json?origins=Tokyo&destinations=Kyoto&mode=Driving&sensor=false&callback=angular.callbacks._0:2\n \n```\n\n\\---------- コンソールのリンク先(GoogleMapsAPIのレスポンス) ----------\n\n```\n\n {\n \"destination_addresses\" : [ \"Kyoto, Kyoto Prefecture, Japan\" ],\n \"origin_addresses\" : [ \"Tokyo, Japan\" ],\n \"rows\" : [\n {\n \"elements\" : [\n {\n \"distance\" : {\n \"text\" : \"457 km\",\n \"value\" : 456931\n },\n \"duration\" : {\n \"text\" : \"5 hours 39 mins\",\n \"value\" : 20338\n },\n \"status\" : \"OK\"\n }\n ]\n }\n ],\n \"status\" : \"OK\"\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T10:04:35.420", "favorite_count": 0, "id": "16247", "last_activity_date": "2016-10-03T12:03:31.503", "last_edit_date": "2015-10-10T15:51:18.770", "last_editor_user_id": "76", "owner_user_id": "12198", "post_type": "question", "score": 2, "tags": [ "angularjs", "google-maps" ], "title": "GoogleMapsAPIをJSON形式で取得 → ”Uncaught SyntaxError: Unexpected token : ”", "view_count": 2086 }
[ { "body": "レスポンスのJSONは問題ないように見えます。 \nそれよりは実際に使われるURLの末尾 \n`&callback=angular.callbacks._0:2` \nの`:2`が怪しい気がします。\n\nJsonpメソッド呼び出しを次のようにしてみてはいかがでしょうか。\n\n```\n\n $http.jsonp('https://maps.googleapis.com/maps/api/distancematrix/json?origins=Tokyo&destinations=Kyoto&mode=Driving&sensor=false&callback=JSON_CALLBACK')\n .[ここから先は同じ]\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-10T15:00:37.093", "id": "16482", "last_activity_date": "2016-10-03T12:03:31.503", "last_edit_date": "2016-10-03T12:03:31.503", "last_editor_user_id": "3974", "owner_user_id": "12233", "parent_id": "16247", "post_type": "answer", "score": 1 }, { "body": "AngularJSを使用した経験がないため、的はずれであればごめんなさい。\n\nコンソール出力にある、APIのリクエストに使われたURLをブラウザで表示すると、質問者さんの投稿にあるとおりのレスポンスが返ってきています。しかし、Googleマップが返しているレスポンスはJSON形式であるのに対し、[Qiitaに投稿されていたこちらの記事](http://qiita.com/laiso/items/19c722b5bea6838f5ad8)では、`$http.jsonp`メソッドが受け取るレスポンスは、メソッド名の通りJSONP形式であるべきなように見えます。\n\nJSONPとJSONの差は、JSON形式ではデータ全体が純粋なJSONフォーマットに準拠しているのに対し、JSONP形式では、リクエスト時に指定されたJavascript関数の呼び出しの際に、引数としてJSONフォーマットのデータを呼び出す\n**Javascriptコード**\nである点です(詳しくは[こちらの記事](http://taiju.hatenablog.com/entry/20090902/1251851867)がわかりやすいかと思われます)。エラーメッセージとの整合性がとれるかよくわからないのですが、JSONP形式のデータが渡されるべきところにJSON形式のデータが渡されているのが原因ではないかと考えています。\n\n[こちらの記事](http://qiita.com/hkusu/items/61127838300d1b429091)では、`$http`を使用してJSONを取得しています。souzさんの回答のようなURLの修正をされてなお動いていなければ、こちらをお試しいただければと思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2016-04-08T00:23:06.220", "id": "23832", "last_activity_date": "2016-04-08T00:23:06.220", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7229", "parent_id": "16247", "post_type": "answer", "score": 1 } ]
16247
null
16482
{ "accepted_answer_id": "16258", "answer_count": 1, "body": "```\n\n private object RegexPattern {\n \n val ArticlePattern = \"-?\\\\d+(\\\\.\\\\d+)?\"\n \n }\n \n private val articleRegex by Delegates.lazy {\n \n WebViewActivity.RegexPattern.ArticlePattern.toRegex()\n \n }\n \n private fun setupUri() {\n \n if (this.uri == null) {\n \n val u = getIntent()\n .getStringExtra(\n getResources()\n .getString(R.string.default_webview_activity_uri)\n )\n //urlがnullじゃない場合\n if (u != null) {\n \n //もしuがnullの場合NullPointerException\n val parsedUri = Uri.parse(u)\n \n //ドメインがぐーぐる(teru or false)\n val isGoogle = Constants.isGoogleDomain(parsedUri)\n \n //ドメインがぐーぐるのの場合\n val newUri: Uri = if (isGoogle) {\n \n \n val isArticle = parsedUri.getLastPathSegment().matches(articleRegex)\n \n //articleの場合?\n val builder: Uri.Builder = if (isArticle) {\n \n val identifier = parsedUri.getLastPathSegment().toInt()\n \n User.addHistory(identifier)\n \n val favored = User.containsInBookmark(identifier)\n \n val flag = if (favored) {\n 1\n } else {\n 0\n }\n \n parsedUri.buildUpon()\n .appendQueryParameter(\"favored\", \"$flag\")\n \n```\n\n質問です。\n\n```\n\n val isArticle = parsedUri.getLastPathSegment().matches(articleRegex)\n \n```\n\nの部分について、どんな処理でしょうか?\n\n`getLastPathSegment()`について調べたところ、\n\n> \"URIのpath部から最後のセグメントをデコードして抽出する。\"\n\nこれはどうゆう意味でしょうか?\n\nURLによっては`isArticle`にtureかfalse返す前にエラーで落ちてしまいますが、エラー発生条件がわかりません。デバッグでは`Uri.java`を通過したあとにエラーになります。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T10:09:16.993", "favorite_count": 0, "id": "16249", "last_activity_date": "2015-09-04T12:34:58.547", "last_edit_date": "2015-09-04T11:45:50.917", "last_editor_user_id": "5337", "owner_user_id": "10715", "post_type": "question", "score": 2, "tags": [ "android", "java", "android-studio", "kotlin" ], "title": ".getLastPathSegment().matchesについて教えて下さい。", "view_count": 724 }
[ { "body": "複数の質問がありますが、何を尋ねたいのか不明瞭になるので、一つに絞ると良いと思います。\n\n`getLastPathSegment()`の処理は文字通り、最後のセグメントを取得するものです。この意味について理解するには、`Uniform\nResource\nIdentifier`の構造を参照する必要があります。完全な仕様については、[RFC3986](http://www.ietf.org/rfc/rfc3986.txt)などを参照されると良いと思います。\n\nURLの構造について、回答に必要な最小限を説明すると、以下のようになっています。\n\n```\n\n [schema]://[host]/[path]\n \n```\n\nURLはURIの一種で、インターネット上のリソースであることを示します。スキーム部には通信に使うプロトコルを記述します。`http://`であればhttpプロトコルで通信を行います。ホスト部はリソースを提供するホストマシン名を記述します。\n\nそして、ホストマシンに対して「何のリソースを要求するのか?」を示すのがパス部です。見慣れたインターネットアドレスはパス部が階層的になっていると思います。\n\n```\n\n http://www.example.com/segment1/segment2/segment3\n \n```\n\nパス部は上の階層から順に、「第1セグメント」「第2セグメント」…と呼ばれます。`getLastPathSegment()`は最後のセグメントを取得するので、ここでは`segment3`を返します。\n\nまたこのとき、URLデコードを行います。URLは仕様上使える文字種が規定されています。使用できない文字をURLに含める場合には、パーセントエンコーディングによる符号化を行います。デコードはその逆の処理で、符号化した文字列を元の文字列に復号します。\n\n* * *\n\n`matches(articleRegex)`は正規表現のマッチング処理です。取得したセグメントが数字として表現可能かどうかの判定を行っています。\n\nエラーについては情報が不足しています。どのようなURLで、何のエラーが起きるのか明記しないと発生条件は分かりません。`getLastPathSegment()`はパス部のないURLを渡した場合に`null`が返却されますが、それを考慮していないコードですので、`NullPointerException`が発生しえますが、あくまで推測です。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T12:34:58.547", "id": "16258", "last_activity_date": "2015-09-04T12:34:58.547", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5337", "parent_id": "16249", "post_type": "answer", "score": 3 } ]
16249
16258
16258
{ "accepted_answer_id": "16254", "answer_count": 1, "body": "Android NDKを使ったライブラリのコードを読んでいたところ、\n\n```\n\n JNIEXPORT jlong JNICALL\n Java_org_gearvrf_NativeShaderManager_ctor(JNIEnv * env, jobject obj);\n \n```\n\nのようにJNIメソッドの前に`JNIEXPORT 戻り値の型 JNICALL`のように宣言してある箇所が多数ありました。 \n単に`戻り値`だけにしても動作は変わらないようなのですが、この`JNIEXPORT`と`JNICALL`の意味は何なのでしょう?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T10:24:34.213", "favorite_count": 0, "id": "16250", "last_activity_date": "2015-09-04T12:54:22.747", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "450", "post_type": "question", "score": 4, "tags": [ "android", "java", "jni" ], "title": "JNIEXPORT JNICALL とは何ですか?", "view_count": 4556 }
[ { "body": "JNIEXPORTは、共有ライブラリ(*.so)が作られる際、その関数を外部に公開するという宣言のようなものです。逆にこれがなければ、Javaから呼ばれる関数ではないということになります。あと、ソースがC++で書かれている場合は、特別な指示が無いと、関数の名前がC++の型情報を含む特有な関数名に変更(マングル、マングリング)されてしまいます。それを避け、C言語の関数として公開(エクスポート)するために、JNIEXPORTに\nextern \"C\" の様な指令が含まれている場合があります。\n\nJNICALLは、Javaの仮想マシンがC言語の関数を呼び出す際、どのような方法(関数の呼び出しルール)を採用すべきかが定義されます。引数をスタックで渡すかレジスタで渡すかといったルールを、Java側とC側で合意しておくための指示で、、Wikipedia等で「呼出規約」「ABI\n(Application Binary Interface)」を調べていただけるとわかるかと思います。\n\nもし、JNIEXPORTやJNICALLを省略しても正常に動作したとすると、たまたま運が良かったということです。CPUやOSが違っても、同じソースのままでも、JNIEXPORTやJNICALLが、動作環境の差異を吸収してくれます。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T11:39:04.003", "id": "16254", "last_activity_date": "2015-09-04T12:54:22.747", "last_edit_date": "2015-09-04T12:54:22.747", "last_editor_user_id": "3337", "owner_user_id": "3337", "parent_id": "16250", "post_type": "answer", "score": 6 } ]
16250
16254
16254
{ "accepted_answer_id": null, "answer_count": 0, "body": "Visual Studio Community 2015でビルドしたところ下記のようなエラーが出ました。\n\n[wandbox](http://melpon.org/wandbox) でclang、gccを使ってビルドした限りではエラーは出ませんでした。 \nなぜVisual Studioでだけエラーが出るのか教えてください。\n\n**エラーメッセージ**\n\n```\n\n error C3493: 既定のキャプチャ モードが指定されていないため、'value' を暗黙的にキャプチャできません\n \n```\n\n**ソースコード**\n\n```\n\n #include <forward_list>\n \n using namespace std;\n \n int main()\n {\n []{\n forward_list<int> list;\n int value;\n auto &ref = list;\n list.remove_if(\n [](const remove_reference_t<decltype(ref)>::value_type &value)\n { return value < 0; });\n }();\n }\n \n```", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2015-09-04T11:01:11.730", "favorite_count": 0, "id": "16251", "last_activity_date": "2020-02-18T16:50:56.513", "last_edit_date": "2020-02-18T16:50:56.513", "last_editor_user_id": "3060", "owner_user_id": "11012", "post_type": "question", "score": 6, "tags": [ "c++", "visual-studio", "c++11" ], "title": "Visual Studioで特定の条件でラムダ式がビルドエラーを起こす", "view_count": 2279 }
[]
16251
null
null
{ "accepted_answer_id": "16255", "answer_count": 1, "body": "秀丸やWindowsメモ帳やブラウザのコピペのテキストをPuTTYのVimでコピペすると(右クリック)改行の数が多くなってしまいます。Vimの設定をすべて空白にすると普通にコピペされます。\n\n設定はこちらです\n\n```\n\n ~/.vimrc\n 1 set number\n 2 set title\n 3 set ambiwidth=double\n 4 set tabstop=4\n 5 set expandtab\n 6 set shiftwidth=4\n 7 set smartindent\n 8 set list\n 9 set listchars=tab:»-,trail:-,eol:↲,extends:»,precedes:«,nbsp:%\n 10 set nrformats-=octal\n 11 set hidden\n 12 set history=50\n 13 set virtualedit=block\n 14 set whichwrap=b,s,[,],<,>\n 15 set backspace=indent,eol,start\n 16 set wildmenu\n 17 set display=lastline↲\n 18 set pumheight=10↲\n 19 set showmatch\n 20 set matchtime=1\n 21 set encoding=utf-8\n 22 set fileformats=unix,dos,mac\n \n```\n\n[![画像の説明をここここに入力](https://i.stack.imgur.com/n4IPs.png)](https://i.stack.imgur.com/n4IPs.png)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T11:08:57.413", "favorite_count": 0, "id": "16252", "last_activity_date": "2017-01-17T08:40:21.030", "last_edit_date": "2017-01-17T08:40:21.030", "last_editor_user_id": "3054", "owner_user_id": "7973", "post_type": "question", "score": 4, "tags": [ "vim" ], "title": "Vim にペーストすると改行の数が多くなってしまいます", "view_count": 3888 }
[ { "body": "vim は自動インデント機能を持ったテキストエディタです。mintty のペースト等は文字をキーとしてそのまま貼り付けますので、改行コードが来た際に vim\nが自動インデントを行います。よって期待しない結果となります。\n\nvim ではこの自動インデントを一時的に無効にする為のオプションが用意されています。\n\n```\n\n :set paste\n \n```\n\nこれを実行した後でインサートモードからペーストすると正しくペーストされるはずです。 \nまたいちいちメンドクサイという事であれば\n\n```\n\n :set pastetoggle=<f2>\n \n```\n\nの様にペーストモードに移る専用のキーを定義出来、押すとペーストモードがトグルして切り替わります。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T11:42:13.607", "id": "16255", "last_activity_date": "2015-09-04T11:42:13.607", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "440", "parent_id": "16252", "post_type": "answer", "score": 13 } ]
16252
16255
16255
{ "accepted_answer_id": "16275", "answer_count": 1, "body": "# 【jQuery】jsonファイル読み込み後にプラグインを実行させるには?\n\n## 使用したいプラグイン\n\n▼BookBlock \n<http://tympanus.net/codrops/2012/09/03/bookblock-a-content-flip-plugin/>\n\n### やりたいこと\n\n画像のパスが書かれたjsonファイルを読み込み、 \nこのプラグインを適応させる。\n\n### できた事\n\n * jsonの読み込み\n * jsonを読み込まずにプラグインの使用\n\n### できない事\n\n * jsonファイルを読み込んだ後に実行されない。 \n※ devtoolを使用すると、html側にjsonファイルから読み込んだ情報が反映されているのは確認できる。\n\n### 質問\n\n以下のように組んでみたのですが、うまく動きませんでした。 \nどなたかアドバイスを頂けると助かります。\n\n```\n\n $.getJSON(\"hogehoge.json\", function(data){\n ~\n }).done(function(){\n \n //ここでプラグインを読み込み\n \n }).done(function(){\n //ここでconfig設定\n });\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T11:35:29.210", "favorite_count": 0, "id": "16253", "last_activity_date": "2015-09-05T00:11:21.857", "last_edit_date": "2020-06-17T08:14:45.997", "last_editor_user_id": "-1", "owner_user_id": "12200", "post_type": "question", "score": 3, "tags": [ "javascript", "jquery", "json" ], "title": "【jQuery】jsonファイル読み込み後にプラグインを実行させるには?", "view_count": 593 }
[ { "body": "プラグインの読み込みを$.getJSON()より前にやらない明確な理由があるのでしょうか?先に読み込みすればたぶん動くと思いますが。 \n.done()は実行をキューイングするだけなので必ずしも書いた通りにコールバックが呼ばれるとは限りません。また、コールバックの中でプラグインを読み込むと、一時的にそのスレッドは止まって実行はもう一方のスレッド(=ここでconfig設定)、に移ってしまうでしょう。しかし、まだプラグイン読み込まれていないのでたぶん初期化は失敗するでしょう。 \nプラグインをちゃんと読み込んでからconfigするようにイベントをネストさせる方法もありますが、見た目に美しくないのでメンテしづらいです。 \n最初にプラグインを読み込んでしまえばいいのではないでしょうか。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T00:11:21.857", "id": "16275", "last_activity_date": "2015-09-05T00:11:21.857", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8136", "parent_id": "16253", "post_type": "answer", "score": 1 } ]
16253
16275
16275
{ "accepted_answer_id": null, "answer_count": 1, "body": "自分のPC上で2つのプロジェクトを開発していて、使ってるrailsのバージョンが同じ場合、それぞれのプロジェクトのディレクトリで同じバージョンのrailsをインストールするのは容量てきに無駄に感じるのですが、どうなのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T11:55:08.647", "favorite_count": 0, "id": "16256", "last_activity_date": "2015-09-04T23:02:13.280", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12201", "post_type": "question", "score": 1, "tags": [ "ruby-on-rails", "ruby", "rubygems", "bundler" ], "title": "複数のプロジェクトのgemの管理にbundlerを使用する場合について", "view_count": 279 }
[ { "body": "bundle install実行時に--\npathでインストール先を指定しなければ、Ruby本体にインストールされたgemを利用するので、共通で使用可能です。ただ、この場合は実行ユーザがgemでパッケージをインストールできる権限が必要です。rbenvでRuby自体を管理していれば、システムのRubyを汚すことも無いですから、開発環境では\n--pathは指定しないがいいと思います。\n\nどうしてもRuby本体のgemを使いたくなければ、--pathで共通のディレクトリを絶対パスで指定すれば共通で利用できると思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T23:02:13.280", "id": "16273", "last_activity_date": "2015-09-04T23:02:13.280", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7347", "parent_id": "16256", "post_type": "answer", "score": 1 } ]
16256
null
16273
{ "accepted_answer_id": null, "answer_count": 1, "body": "bundlerを使ってgemをローカルインストールする場合、グローバルインストールされているgemとの依存関係はどうなるのでしょうか? \n同じgemだったらローカルの方のバージョンが優先され、ローカルにインストールされていないgemだったらグローバルのgemが反映されるのでしょうか?", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T12:11:12.517", "favorite_count": 0, "id": "16257", "last_activity_date": "2017-05-16T05:38:17.753", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12201", "post_type": "question", "score": 1, "tags": [ "ruby-on-rails", "ruby", "rubygems", "bundler" ], "title": "bundlerを使用する際のローカルインストールとグローバルインストールの依存関係について", "view_count": 458 }
[ { "body": "> bundlerを使ってgemをローカルインストールする場合、グローバルインストールされているgemとの依存関係はどうなるのでしょうか?\n\nたとえば、 `bundle install --path vendor/bundle` などでローカルにGemをインストールすると必要なGemは全て\n`vendor/bundle` 以下にインストールされるためグローバルにインストールされたGemとは干渉しません。\n\n蛇足ですが、 `bundle install --path vendor/bundle` のように `--path`\nをつける方が好ましいです。(以下でも説明しています)\n\n[bundle install\nsudoつけない方法](https://ja.stackoverflow.com/questions/34310/bundle-install-\nsudo%E3%81%A4%E3%81%91%E3%81%AA%E3%81%84%E6%96%B9%E6%B3%95/34314#34314)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2017-05-16T05:38:17.753", "id": "34749", "last_activity_date": "2017-05-16T05:38:17.753", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "22531", "parent_id": "16257", "post_type": "answer", "score": 2 } ]
16257
null
34749
{ "accepted_answer_id": "16347", "answer_count": 4, "body": "Cocos2d-xでプログラミングをしていると、関数の返り値は1つしか指定できないことに気付きました。返り値が2つ以上あった場合はどのように指定すれば良いのでしょうか? \n以下のchangeTwoSpritePositionX()は、2つのSpriteのX座標を指定された値に変更し、2つのSpriteを返しくれる関数です。正常に動作させるには、どのような修正を加えればよいでしょうか?詳しい方、ご教示ください。\n\n```\n\n void changeTwoSpritePositonX(Sprite *spriteA,Sprite *spriteB,float positionX){\n spriteA->setPosition(Point(positionX,spriteA->getPositionY()));\n spriteB->setPosition(Point(positionX,spriteB->getPositionY()));\n // return ここでspriteAとspriteBを返したい\n }\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T12:52:05.947", "favorite_count": 0, "id": "16259", "last_activity_date": "2015-09-08T04:46:59.817", "last_edit_date": "2015-09-08T04:46:59.817", "last_editor_user_id": "76", "owner_user_id": "7699", "post_type": "question", "score": 2, "tags": [ "c++", "cocos2d-x" ], "title": "関数において返り値を2つ以上指定する方法", "view_count": 10755 }
[ { "body": "配列を返すか返値用の構造体を定義して返すといいと思います", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T15:07:45.007", "id": "16262", "last_activity_date": "2015-09-04T15:07:45.007", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7566", "parent_id": "16259", "post_type": "answer", "score": 0 }, { "body": "alphaさんが仰っていますが、spriteAとspriteBのポインターを渡しているので返さなくても変更されています。spriteAとspriteBは、中身が変わっているのでcinやprintf等でご確認ください。\n\n後、2つの値を返すのは無理なので、ポインタや参照というものがあるのです。(それ以外の理由もありますが!)", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T04:46:22.390", "id": "16298", "last_activity_date": "2015-09-06T04:46:22.390", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11194", "parent_id": "16259", "post_type": "answer", "score": 1 }, { "body": "まず、複数の戻り値を指定することは現在のC++ではできません。提示されたコードの場合は、ポインターが引数となっているためそのままでも利用できます。\n\n```\n\n #include<iostream>\n using namespace std;\n \n void f(int * i)\n {\n *i = 6;\n }\n int main()\n {\n int * int_ptr = new int(5);\n cout << *int_ptr << endl;\n f(int_ptr);\n cout << *int_ptr << endl;\n }\n \n```\n\nこのように上記のコードを実行すればほかの方の回答が理解できると思います。\n\nとりあえず以下が元の質問への回答です。 \nstructなどを利用することにより、戻り値に複数に要素を持たせることができます。\n\n1.container(例えばvectorなど)に格納して返す\n\n```\n\n std::vector<Sprite*> return_val;\n return_val.push_back(spriteA);\n return_val.push_back(spriteB);\n return(return_val);\n \n```\n\nただし、containerにポインターを格納するのは一般的に良い考えではありません。なお要素はoperator[]でアクセスできます。また、iteratorなどでもアクセスできます。\n\n2.std::pairもしくはstd::tuppleを返す\n\n```\n\n return(std::make_pair(spriteA,spriteB));\n \n```\n\nもしくは\n\n```\n\n return(std::make_tuple(spriteA,spriteB));\n \n```\n\nまた、pairの場合は.first、.second、tupleの場合はgetで要素にアクセスできます。\n\n3.struct、classを使う\n\n```\n\n struct sprite_ptr_container\n {\n sprite * _ptr1;\n sprite * _ptr2;\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T11:38:07.340", "id": "16347", "last_activity_date": "2015-09-07T11:38:07.340", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "parent_id": "16259", "post_type": "answer", "score": 2 }, { "body": "\"複数の戻り値を関数で返すこと\" だけを考えると、C++ で行うのは STL の`std::pair` や `std::tuple` を使う方法です。\n\n```\n\n std::pair<int, int> double_result()\n {\n return std::make_pair(1, 10);\n }\n \n int a, b;\n std::tie(a, b) = double_result();\n \n```\n\nのように、複数の結果を `std::pair` でラップし、`std::tie` 関数で取り出すことをよく行っています。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T04:30:59.167", "id": "16365", "last_activity_date": "2015-09-08T04:30:59.167", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "264", "parent_id": "16259", "post_type": "answer", "score": 1 } ]
16259
16347
16347
{ "accepted_answer_id": "16270", "answer_count": 1, "body": "DBは使わず配列でcsv出力をしたいと思っています。\n\n現在アンケートフォームを作っていて、\n\n```\n\n <form action=\"confirm_enq.php\" method=\"get\">\n <p>名前: <input type=\"text\" name=\"name\" /></p>\n <p>Email: <input type=\"text\" name=\"email\" /></p>\n \n <p>年齢: <input type=\"text\" name=\"age\"></p>\n <p>性別: \n 男<input type=\"radio\" name=\"gender\" value=\"男\">\n 女<input type=\"radio\" name=\"gender\" value=\"女\">\n </p>\n \n <p>趣味:</p>\n <p>\n 料理<input type=\"checkbox\" name=\"hobby[]\" value=\"料理\">\n 旅行<input type=\"checkbox\" name=\"hobby[]\" value=\"旅行\">\n プログラミング<input type=\"checkbox\" name=\"hobby[]\" value=\"プログラミング\">\n 野球観戦<input type=\"checkbox\" name=\"hobby[]\" value=\"野球観戦\">\n ダンス<input type=\"checkbox\" name=\"hobby[]\" value=\"ダンス\">\n カメラ<input type=\"checkbox\" name=\"hobby[]\" value=\"カメラ\">\n カフェ巡り<input type=\"checkbox\" name=\"hobby[]\" value=\"カフェ巡り\">\n 読書<input type=\"checkbox\" name=\"hobby[]\" value=\"読書\">\n ゲーム<input type=\"checkbox\" name=\"hobby[]\" value=\"ゲーム\">\n カラオケ<input type=\"checkbox\" name=\"hobby[]\" value=\"カラオケ\">\n </p>\n <input type=\"submit\" />\n </form>\n \n```\n\n上記のファイルを\n\n```\n\n <?php \n $name=htmlspecialchars($_GET[\"name\"],ENT_QUOTES);\n $email=htmlspecialchars($_GET['email'],ENT_QUOTES);\n $age=htmlspecialchars($_GET['age'],ENT_QUOTES);\n $gender=htmlspecialchars($_GET['gender'],ENT_QUOTES);\n ?>\n <body>\n \n <?php echo $_GET[\"name\"]; ?>\n \n <br>\n <?php echo $_GET[\"email\"]; ?>\n <br>\n <?php echo $_GET[\"age\"]; ?>\n <br>\n <?php echo $_GET[\"gender\"]; ?>\n <br>\n <?php foreach($_GET[\"hobby\"] as $value){\n echo \"{$value}, \"; \n } ?>\n \n```\n\nこのconfirm_enq.phpでgetしています。\n\nやりたいことは、ここで得た回答をdata.csvで出力したいのですが、 \n配列に入れて出力する書き方がわかりません。\n\nよろしくお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T15:41:40.277", "favorite_count": 0, "id": "16265", "last_activity_date": "2015-09-05T06:07:29.427", "last_edit_date": "2015-09-05T06:07:29.427", "last_editor_user_id": "2238", "owner_user_id": "8415", "post_type": "question", "score": -1, "tags": [ "php" ], "title": "formで得たデータを配列に入れてcsvで出力したい", "view_count": 8836 }
[ { "body": "ほとんど完成しているように見えます。 \nただ単に、ファイルに書き出したいだけであれば、 \nconfirm_enq.phpの一番したのphpの部分に、数行ファイル操作用のコマンドを書き加えればよいはずです。\n\n具体的には、\n\n```\n\n foreach($_GET[\"hobby\"] as $value){\n echo \"{$value}, \"; \n }\n \n```\n\nの部分を、下記に変えてください。\n\n```\n\n $myfile = fopen(\"data.csv\", \"a\") or die(\"Unable to open file!\");\n foreach($_GET[\"hobby\"] as $value){\n $content = \"{$value}, \";\n echo $content;\n fwrite($myfile, $content);\n }\n fwrite($myfile, \"\\n\");\n fclose($myfile)\n \n```\n\n説明としましては、 \nfopenを使用して、ファイルにアクセスする変数(ファイルハンドル=$myfile)を作成します。 \nその後、fwriteコマンドを使用し、どのファイルにsaveしたいのか(ファイルハンドル$myfile)を指定し、そのあとに、記入したい内容(ここでは($content)を書いておきます。 \n最後にfcloseを使って、ファイルの書き出し終了を指示しています。\n\n補足としては、上記のものでは、書き出すたびにdata.csvの一番下に新しい情報と付け加えていくという形にしています。(たぶんKojimaさんはそのようにしたいのではないかと思いまして。)\n\nしかし、data.csvを毎回書き換えたい(overwrite)したい場合は、\n\n```\n\n 変更前:\n fopen(\"data.csv\", \"a\") //\"a\"は、\"append(書き足し)\"\n \n 変更後:\n fopen(\"data.csv\", \"w\") //\"w\"は、\"write(書き出し)\"\n \n```\n\nに変更すればいいですよ。\n\n良いアンケートフォームができるといいですね。頑張ってください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T18:51:25.837", "id": "16270", "last_activity_date": "2015-09-04T19:01:52.173", "last_edit_date": "2015-09-04T19:01:52.173", "last_editor_user_id": "11048", "owner_user_id": "11048", "parent_id": "16265", "post_type": "answer", "score": 2 } ]
16265
16270
16270
{ "accepted_answer_id": "16271", "answer_count": 1, "body": "ユーザーがsubmitして、パラメーターが以下のハッシュの形でコントローラーに届いています。\n\n{\"review\"=>{\"star\"=>\"3\",\"comment\"=>\"ok\"},\"commit\"=>\"登録\",\"id\"=>\"1\"}\n\nしかし、param is missing or the value is empty: review \nとreviewが空であると怒られます。。 \nなぜでしょうか。よろしくお願いいたします。\n\n```\n\n controllers/articles_controller.rb\n \n def show\n @review = Review.new(review_params)\n @review.save\n end\n \n private\n \n def review_params\n params.require(:review).permit(:star, :comment)\n end\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T17:09:51.617", "favorite_count": 0, "id": "16268", "last_activity_date": "2015-09-04T21:39:19.363", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11188", "post_type": "question", "score": 1, "tags": [ "ruby-on-rails" ], "title": "Strong Paramaterのエラー", "view_count": 79 }
[ { "body": "コントローラーのメソッドがshowになっています。 \n通常はcreateかupdateを使うはずです。\n\n参考までにscaffoldを使えばたぶんこうなるだろうと思われるコードを載せておきます。\n\n```\n\n def create\n @review = Review.new(review_params)\n \n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end\n \n def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end\n \n```\n\n## EDIT\n\n> この処理をcreateメソッドをとして利用する場合は、showメソッドにはどう対応させるのがベスト・プラクティスなのでしょうか?\n\nRailsチュートリアルの[10.3.2マイクロポストを作成する](http://railstutorial.jp/chapters/user-\nmicroposts?version=4.0#sec-creating_microposts)が参考になるかと思います。\n\nStaticPagesControllerのhomeをArticlesControllerのshowに、MicropostsControllerのcreateをReviewsControllerのcreateとして考えるとおそらく答えに近くなるはずです。\n\nただし、この話は最初の質問(Strong Paramaterのエラー)とは別のテーマになってくるので、あまり深入りしないようにします。 \n自分でやってみてわからない点があれば、新しい質問を立てる方が良いと思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T19:21:15.137", "id": "16271", "last_activity_date": "2015-09-04T21:39:19.363", "last_edit_date": "2015-09-04T21:39:19.363", "last_editor_user_id": "85", "owner_user_id": "85", "parent_id": "16268", "post_type": "answer", "score": 1 } ]
16268
16271
16271
{ "accepted_answer_id": "16272", "answer_count": 1, "body": "現在、Google Sheets API を使って、Google スプレッドシートの情報を JSON で取得し、その結果をパースして TableView\nに一覧表示するようなものを作ろうとしています。\n\n現在書いている Swift 2 のコードはこちらです。\n\n```\n\n let makeStatusUrl = \"https://spreadsheets.google.com/feeds/list/1BCAOfRDmoFLyV-bcvjFQZ2St-qg7wAUQa7o_9cn-oL8/od6/public/basic?alt=json\"\n let statusUrl = NSURL(string: makeStatusUrl)\n let task = NSURLSession.sharedSession().dataTaskWithURL(statusUrl!, completionHandler: { data, response, error in\n do {\n let dict = try NSJSONSerialization.JSONObjectWithData(data!, options: .MutableContainers) as! NSDictionary\n var feed = dict[\"feed\"] as! NSDictionary\n var entry = feed[\"entry\"] as! NSArray\n \n for content in entry {\n let content = content[\"content\"] as! NSDictionary\n print(content)\n }\n } catch {\n }})\n task.resume()\n \n```\n\n上記のコードだと、\n\n```\n\n print(content)\n \n```\n\nの部分で次の結果が吐き出されます。\n\n```\n\n {\n \"$t\" = \"name: iOS, index: 12\";\n type = text;\n }\n {\n \"$t\" = \"name: Android, index: -11\";\n type = text;\n }\n {\n \"$t\" = \"name: LINE, index: 20\";\n type = text;\n }\n \n```\n\nここからが本題なのですが、上記出力結果の name と index の値をセットで取り出し、TableView に一覧表示させたいと思っています。\n\n具体的には次のような感じです。画像では1行セットしていますが、この「iOS 12」の下に同じ形式で「Android -11」、「LINE\n20」と続いていく感じです。 \n[![](https://i.stack.imgur.com/oWcfa.png)](https://i.stack.imgur.com/oWcfa.png)\n\n自分としては name と index を NSDictionary でセットし、それを表示するようにコードを書けばよいのでは\nと思っていますが、初心者のためどのように書いたらよいか分かりません。\n\nご教授願います。\n\nまた、スタック・オーバーフロー も初心者ですので、不備などがありましたら回答、および編集などをしていただけると幸いです。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T17:22:08.757", "favorite_count": 0, "id": "16269", "last_activity_date": "2015-10-16T16:09:29.337", "last_edit_date": "2015-10-16T16:09:29.337", "last_editor_user_id": "5519", "owner_user_id": "10947", "post_type": "question", "score": 2, "tags": [ "ios", "swift" ], "title": "Swift 2、NSDictionary から値を取り出す", "view_count": 2685 }
[ { "body": "前提\n\n 1. テーブルビューのアウトレット接続とデリゲート設定が済んでいるものとする\n 2. JSONダウンロードの実行ボタンとして「Reload」(`reload`関数が実行される)ボタンがあるものとする\n\n* * *\n\nデータソース\n\nテーブルビューに表示するデータは順序が必要なため、一般的には配列を使用する \n今回は`feed[\"entry\"]`で取得できる配列をデータソースとして`var dataSource: [NSDictionary]`プロパティへ格納する\n\n* * *\n\nJSONのダウンロード\n\nダウンロードはバックグラウンドで行う \nダウンロードの完了通知を受け取るためビューコントローラは`NSURLSessionDownloadDelegate`プロトコルを採用し`URLSession(session:\nNSURLSession, downloadTask: NSURLSessionDownloadTask,\ndidFinishDownloadingToURL location: NSURL)`関数を実装する\n\n* * *\n\nJSONの解析\n\n 1. テーブルのデータソースとして都合のよい配列を取得する\n 2. 配列を`dataSource`プロパティへ格納する\n 3. メインスレッドでテーブルを更新する(UIの更新はメインスレッドで行う)\n\n* * *\n\nテーブルのための整形\n\nテーブルを更新したことで`tableView(tableView: UITableView, cellForRowAtIndexPath\nindexPath: NSIndexPath) -> UITableViewCell`関数がデータソースの内容を元に実行される\n\nここでは配列から取り出したデータを表示に適したものへ整形しセルのラベルへセットする \n例)`name: iOS, index: 12` -> `iOS`と`12`へ\n\n* * *\n\n`ViewController.swift`:\n\n```\n\n import UIKit\n \n class ViewController: UIViewController, NSURLSessionDownloadDelegate, UITableViewDelegate, UITableViewDataSource {\n \n @IBOutlet weak var tableView: UITableView!\n var dataSource: [NSDictionary]! = []\n \n override func viewDidLoad() {\n super.viewDidLoad()\n }\n \n @IBAction func reload(sender: AnyObject) {\n let url = \"https://spreadsheets.google.com/feeds/list/1BCAOfRDmoFLyV-bcvjFQZ2St-qg7wAUQa7o_9cn-oL8/od6/public/basic?alt=json\"\n let configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(\"Configuration\")\n let session = NSURLSession(configuration: configuration, delegate: self, delegateQueue: nil)\n let task = session.downloadTaskWithURL(NSURL(string: url)!)\n \n task.resume()\n }\n \n func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didFinishDownloadingToURL location: NSURL) {\n let json = NSData(contentsOfURL: location)\n do {\n let dict = try NSJSONSerialization.JSONObjectWithData(json!, options: NSJSONReadingOptions.MutableContainers)\n let feed = dict[\"feed\"] as! NSDictionary\n self.dataSource = feed[\"entry\"] as! [NSDictionary]\n \n NSOperationQueue.mainQueue().addOperationWithBlock({ () -> Void in\n self.tableView?.reloadData()\n })\n } catch {\n print(\"JSON parse error\")\n }\n session.finishTasksAndInvalidate()\n }\n \n func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {\n return 44;\n }\n \n func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n return dataSource.count;\n }\n \n func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {\n let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: \"cellId\")\n \n let content = self.dataSource[indexPath.row][\"content\"] as! NSDictionary\n let raw = content[\"$t\"] as? String\n let values = raw?.componentsSeparatedByString(\", \") as [String]!\n let name = values[0].substringFromIndex(values[0].rangeOfString(\": \")!.endIndex)\n let index = values[1].substringFromIndex(values[1].rangeOfString(\": \")!.endIndex)\n \n cell.textLabel?.text = name\n cell.detailTextLabel?.text = index\n \n return cell\n }\n }\n \n```\n\n* * *\n\n実行画面:\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/5i8Bk.png)](https://i.stack.imgur.com/5i8Bk.png)", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-04T20:52:43.780", "id": "16272", "last_activity_date": "2015-09-05T15:10:29.150", "last_edit_date": "2015-09-05T15:10:29.150", "last_editor_user_id": null, "owner_user_id": null, "parent_id": "16269", "post_type": "answer", "score": 4 } ]
16269
16272
16272
{ "accepted_answer_id": null, "answer_count": 2, "body": "Vagrantでローカルフォルダを同期して開発環境を整えていますが、`http://192.168.33.10/App`にアクセスすると白い画面になってしまいます。\n\nついでに可能であれば`App`ディレクトリではなくて、`http://192.168.33.10/`をDocument\nRootに設定したく、/etc/httpd/conf/httpd.confファイルを\n\n```\n\n <Directory \"/var/www/html/App\">\n Options Indexes FollowSymLinks\n AllowOverride All\n Order allow,deny\n Allow from all\n </Directory>\n \n```\n\nに変更して試してみても白い画面になってしまいます。\n\nディレクトリ構造は以下の通りです。 \n/home/vagrant/【appName】/App\n\n【appName】内 \nApp Plugin Vagrantfile Vendor composer.json composer.lock\n\nApp内 \nConfig Console Controller Lib Model Plugin Test Vendor View index.php webroot\n\nといった構造になっていて、Vagrantfile内で \n`config.vm.synced_folder \"/Users/hoge/Vagrant/【appName】/\",\n\"/home/vagrant/【appName】\"` \nで同期設定しています。\n\nどなたか解決方法をご存知のかたご教授をいただけると幸いです。\n\n追記:以下各バージョンになります。 \nMax OSX Yosemite \nVagrant 1.7.2 \nBox CentOS64 \nApache Apache/2.2.15 (Unix) \ncakePHP 2.7.2\n\n//////////// \n`DocumentRoot \"/var/www/html\"`に設定してあります。", "comment_count": 6, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T00:51:54.347", "favorite_count": 0, "id": "16276", "last_activity_date": "2016-09-28T19:14:56.163", "last_edit_date": "2015-09-09T05:04:23.440", "last_editor_user_id": "2668", "owner_user_id": "8500", "post_type": "question", "score": 1, "tags": [ "cakephp", "apache", "vagrant" ], "title": "Vagrant + CakePHP で192.168.33.10/Appにアクセスした際に画面が白くなる", "view_count": 688 }
[ { "body": "Apache httpdのドキュメントルートがCakePHPのwebrootに設定されていないことが原因と考えられます。\n\napacheの設定として、\n\n```\n\n DocumentRoot /home/vagrant/【appName】/App/webroot\n \n <Directory \"/home/vagrant/【appName】/App/webroot\">\n Options FollowSymLinks\n AllowOverride All\n Order allow,deny\n Allow from all\n </Directory>\n \n```\n\nと設定しましょう。\n\nまた、`/home/vagrant`のパーミッションが`0700`になっていれば`0755`へ変更してください。\n\nなお、上記はとりあえずの対策となります。 \n本来であれば、仮想環境でも本番環境と同一の構成とすべきですから、synced_folderの設定は\n\n```\n\n config.vm.synced_folder \"/Users/hoge/Vagrant/【appName】/\", \"/var/www/【appName】\"\n \n```\n\nにして、DocumentRootを`/var/www/【appName】/App/webroot`にしたほうが良いでしょう。", "comment_count": 5, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T01:06:07.593", "id": "16331", "last_activity_date": "2015-09-07T01:06:07.593", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2668", "parent_id": "16276", "post_type": "answer", "score": 1 }, { "body": "short_open_tag が true でないのに `<?` を使ってしまっているという可能性ありますかね?\nその場合、画面は真っ白ですが、ブラウザでソースを見ると、php のソースが見えたりします。\n\nあとは、いずれかのライブラリ的な php ソースの末尾や頭に余分な空白があるとか。冒頭の `<?php` の前とか、末尾の `?>`\nの後とか。余分な空白があると、header 出力前に空白が body として出力されて、画面が白くなることがあったきがします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-12-26T01:05:22.330", "id": "20385", "last_activity_date": "2015-12-26T01:05:22.330", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5163", "parent_id": "16276", "post_type": "answer", "score": 0 } ]
16276
null
16331
{ "accepted_answer_id": null, "answer_count": 1, "body": "はじめまして。 \n私は個人でSwiftによるiOSアプリ開発を勉強中です。\n\nGoogleMapのSDKを使用して、ある地点からの動いた距離をカウントし \n履歴に保存する機能を実装中なのですが、 \nその履歴データの保存にRealmを使おうと思い試行錯誤しています。\n\nアプリ内で以下のコードの部分でSIGABRTが出力され終了してしまいます。\n\n間違っている部分をご教示ください。\n\n```\n\n inport UIKit\n import GoogleMaps\n import Spring\n import RealmSwift\n \n class Record: Object {\n dynamic var distance = Double()\n dynamic var average = Double()\n dynamic var createdDate = Double()\n }\n \n class GMapViewController: BaseViewController, CLLocationManagerDelegate {\n // 中略\n @IBAction override func onClickSpButton(sender: SpringButton) {\n // ボタンが押されたらデータを保存\n let myRecord = Record()\n myRecord.distance = sumDistance\n myRecord.average = 0.0\n myRecord.createdDate = NSDate().timeIntervalSince1970\n let realm = Realm() // ここでエラー\n realm.beginWrite()\n realm.add(myRecord)\n realm.commitWrite()\n }\n }\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T03:10:28.413", "favorite_count": 0, "id": "16278", "last_activity_date": "2015-09-05T08:21:53.607", "last_edit_date": "2015-09-05T04:02:03.333", "last_editor_user_id": "12205", "owner_user_id": "12205", "post_type": "question", "score": 2, "tags": [ "swift", "realm" ], "title": "Swift1.2 let realm = Realm() でSIGABRTになる", "view_count": 224 }
[ { "body": "このコードに特に問題はありません。 \nRealmの初期化でエラーになるということですので、セットアップが間違っているのではないでしょうか?\n\nどのようにRealmをセットアップしましたか?\n\nもし、Webサイトからダウンロードしたフレームワークを使っているなら、下記のEmbedded Binariesに設定されているかどうか確認してください。\n\nDynamic Frameworkは動的にリンクされるので、アプリケーションに含まれている必要があります。\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/wLMIJ.png)](https://i.stack.imgur.com/wLMIJ.png)", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T08:21:53.607", "id": "16283", "last_activity_date": "2015-09-05T08:21:53.607", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5519", "parent_id": "16278", "post_type": "answer", "score": 2 } ]
16278
null
16283
{ "accepted_answer_id": null, "answer_count": 1, "body": "いつもお世話になっております。\n\n表題の通り、navigatorにてpushpageに移動後pushpage内をリロードさせる事は可能でしょうか? \nこちらはpushpageにて外部DBから情報を抽出するにあたり、ネットワークエラー等が生じた場合にページをリロードさせたい為です。\n\nどなたかご教示いただけると幸いです。 \nよろしくお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T05:40:14.790", "favorite_count": 0, "id": "16280", "last_activity_date": "2015-09-05T06:58:34.437", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11129", "post_type": "question", "score": 1, "tags": [ "monaca", "onsen-ui" ], "title": "OnsenUI Navigatorのpushpage内をリロードさせたい", "view_count": 3962 }
[ { "body": "`animation: 'none'`を指定して`replacePage()`でどうでしょうか。 \n \n\n**修正** \n第2階層以下で`animation:\nnone;`の`replacePage()`を呼んだ場合、popPage時のアニメーションまで消えてしまうので、リロード後にanimationをリセットする必要があります。 \n \n`<ons-back-button>`を使わない場合は、リセットしなくても下記のように`animation:\n'default'`を指定して`popPage()`でOKです。\n\n```\n\n $scope.nav.popPage({animation: 'default'});\n \n```\n\n```\n\n ons.bootstrap()\r\n .controller('IndexController', function($scope){\r\n function resetAnimation(){\r\n var options = $scope.nav.getCurrentPage().options;\r\n options.animation = 'default';\r\n options.animator = $scope.nav._getAnimatorOption(options);\r\n }\r\n $scope.count = 0;\r\n $scope.reload = function(){\r\n $scope.nav.replacePage('page2.html', {animation: 'none', onTransitionEnd: resetAnimation});\r\n };\r\n });\n```\n\n```\n\n <link href=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.8/build/css/onsen-css-components.css\" rel=\"stylesheet\"/>\r\n <link href=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.8/build/css/onsenui.css\" rel=\"stylesheet\"/>\r\n <script src=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.8/build/js/angular/angular.min.js\"></script>\r\n <script src=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.8/build/js/onsenui.min.js\"></script>\r\n \r\n <ons-navigator var=\"nav\" page=\"page1.html\">\r\n \r\n </ons-navigator>\r\n \r\n <ons-template id=\"page1.html\">\r\n <ons-page>\r\n <ons-toolbar>\r\n <div class=\"left\"><ons-back-button>Back</ons-back-button></div>\r\n </ons-toolbar>\r\n <ons-button ng-click=\"nav.pushPage('page2.html')\">Push</ons-button>\r\n </ons-page>\r\n </ons-template>\r\n \r\n <ons-template id=\"page2.html\">\r\n <ons-page ng-controller=\"IndexController\">\r\n <ons-toolbar>\r\n <div class=\"left\"><ons-back-button>Back</ons-back-button></div>\r\n </ons-toolbar>\r\n <p>Count: {{count}}</p>\r\n <ons-button ng-click=\"count = count+1\">Count up</ons-button><br><br>\r\n <ons-button ng-click=\"reload()\">Reload</ons-button>\r\n </ons-page>\r\n </ons-template>\n```", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T06:14:15.690", "id": "16282", "last_activity_date": "2015-09-05T06:58:34.437", "last_edit_date": "2015-09-05T06:58:34.437", "last_editor_user_id": "8532", "owner_user_id": "8532", "parent_id": "16280", "post_type": "answer", "score": 3 } ]
16280
null
16282
{ "accepted_answer_id": null, "answer_count": 2, "body": "書籍のサンプルコードに関して、2点ご教示ください。 \n参考文献:iPhone/iPadプログラミングバイブル:著 布留川英一\n\n```\n\n //パズルゲームの作成\n class ViewController: UIViewController {\n let BTN_START = 0\n let sCREEn = UIScreen.mainScreen().bounds.size\n // →Q1「この1文は、どういう文法を使って、何をアウトプットしようとしているのか?」\n \n var _GAMEVIEW: UIView?\n var _TITLELABEL: UILabel?\n var _piece = [UIImageView]()\n var _data = [Int]()\n // →Q2「上の2文の『[xxxx]()』はどういう意味(文法)でしょうか?」\n var _SHUFFLE: Int = 0\n \n // 続く、、、、、、、、\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T05:46:07.080", "favorite_count": 0, "id": "16281", "last_activity_date": "2015-09-05T12:41:28.737", "last_edit_date": "2015-09-05T12:41:28.737", "last_editor_user_id": "2238", "owner_user_id": "12207", "post_type": "question", "score": 1, "tags": [ "swift" ], "title": "書籍のサンプルコードについて:「bounds」の意味、「[xxxx]()」の意味", "view_count": 245 }
[ { "body": "```\n\n let sCREEn = UIScreen.mainScreen().bounds.size\n // →Q1「この1文は、どういう文法を使って、何をアウトプットしようとしているのか?」\n \n```\n\nこの質問の主眼は、「boundsの意味」にはありません。boundsの意味は、UIScreenのプロパティで、画面の四囲の座標ですが、詳しくはUIScreenのクラスリファレンスで調べる(Xcodeのヘルプウインドウからアクセス可)か、「UIScreen\nbounds」などをキーワードにして、ネット検索してください。 \nこの質問の主眼は、3つあるドットにあります。習熟したプログラマでも気にする人は少ないと思いますが、3つとも意味が異なります。まず、この1行を3行に分割してみていきましょう。\n\n```\n\n let screen: UIScreen = UIScreen.mainScreen()\n let screenRectangle: CGRect = screen.bounds\n let screenSize: CGSize = screenRectangle.size\n \n```\n\n1行目のドット(.)は、Receiver(クラスあるいはインスタンス)とMethod(メソッド)を結びつけます。Receiverに対して、メソッドを実行しなさいという意味を持ちます。ここでは、UIScreenクラスに対し、メインのスクリーンインスタンスを返しなさいという命令をしています。PCやMacでは、複数のディスプレイを接続して、使用することができ、メインのスクリーンを取得するというのは、イメージしやすいですが、iPhone/iPadではむずかしいかもしれません。が、iPhone/iPadを、テレビゲームのコントローラにするという用途は、ありそうです。そういう使い方なら、マルチスクリーン環境ということになります。\n\n2行目のドットは、screenインスタンスのProperty(プロパティ)boundsにアクセスする意味を持ちます。プロパティはメソッドと同様、値を返します。boundsは、CGRect型の値を返します。 \n3行目のドットは、Structure(構造体)CGRectのプロパティsizeにアクセスします。プロパティへのアクセスという意味は共通なので、2行目と大きく異なることはありません。プロパティsizeは、CGSize型を返します。\n\n以上から、Q1に対する回答は、「ドット文法(Dot Syntax)を使って、画面のサイズを、CGSize型で出力する」となります。\n\n```\n\n var _piece = [UIImageView]()\n var _data = [Int]()\n // →Q2「上の2文の『[xxxx]()』はどういう意味(文法)でしょうか?」\n \n```\n\nSwiftでは、大括弧([])を、Array(配列)とDictionary(辞書)に対して使用します。 \nC言語では、配列の宣言を\n\n```\n\n int array[];\n \n```\n\nとします。同様の宣言をSwiftで行うと、\n\n```\n\n var array: [Int]\n \n```\n\nとなります。配列の要素の型を大括弧で囲む形で、配列の型とします。 \nSwiftでは、オブジェクト(クラス、インスタンス、構造体、列挙子、配列、辞書、文字列、整数、実数などを包括した表現)のイニシアライザ(Javaでは、コンストラクタと呼ぶのだと思います。)を、\n\n```\n\n 型名()\n \n```\n\nという書式で行います。\n\n```\n\n // 整数Intのイニシアライズ\n var value = Int()\n // 文字列Stringのイニシアライズ\n var string = String()\n \n```\n\nなので、Q2の答えは、\n\n```\n\n var _piece = [UIImageView]()\n // UIImageView型を要素とする配列のイニシアライザ\n var _data = [Int]()\n // Int型を要素とする配列のイニシアライザ\n \n```\n\nとなります。 \nちなみに、かっこの中を空のままにすると、要素数0(空)の配列を生成します。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T10:16:38.797", "id": "16289", "last_activity_date": "2015-09-05T10:16:38.797", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7362", "parent_id": "16281", "post_type": "answer", "score": 4 }, { "body": "**A1** : `let sCREEn = UIScreen.mainScreen().bounds.size`の意味\n\n**端末の画面のサイズを変数`sCREEn`に代入している**\n\n 1. `UIScreen.mainScreen()`で端末の画面* をオブジェクトとして取得\n 2. `UIScreen`オブジェクトのプロパティ`bounds`は端末の画面のローカル領域を示す\n 3. `bounds`に含まれる`size`は領域の広さを示す\n\n* `UIScreen.mainScreen()`で取得できるオブジェクトは **端末の画面** のそれであると決められている\n\n* * *\n\n**A2** : `[xxxx]()`の意味\n\n**`xxxx`型の空の配列を作成している**\n\n以下のように書くと「`xxxx`型の配列を作成し、空の配列で初期化」となる\n\n```\n\n var array: [xxxx] = [] // arrayは任意の変数名\n \n```\n\n以下のように書くと「型が未定な変数を作成し、`xxxx`型の空の配列で初期化」となる\n\n```\n\n var array = [xxxx]()\n \n```\n\n結果、どちらも同様に`xxxx`型の配列が作成される", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T10:47:29.210", "id": "16290", "last_activity_date": "2015-09-05T11:02:16.547", "last_edit_date": "2015-09-05T11:02:16.547", "last_editor_user_id": null, "owner_user_id": null, "parent_id": "16281", "post_type": "answer", "score": 2 } ]
16281
null
16289
{ "accepted_answer_id": null, "answer_count": 1, "body": "時計アプリを作成し、デスクトップ上で動かしたいのですが、ウィジェットアプリの作成方法がわかりませんでした。 \nmonocaで作成可能でしょうか? \n可能な場合、方法を教えていただけますでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T08:30:29.393", "favorite_count": 0, "id": "16284", "last_activity_date": "2015-09-05T23:02:30.913", "last_edit_date": "2015-09-05T23:02:30.913", "last_editor_user_id": "2238", "owner_user_id": "12208", "post_type": "question", "score": -1, "tags": [ "monaca" ], "title": "monacaでウィジェットアプリが作成できますか?", "view_count": 489 }
[ { "body": "Cordovaプラグインを自分で作成するか、どこかオープンソースなものをとってくればできると思います。\n\nですが、確かmonacaの場合、自作プラグインを使う場合は有料だったと記憶しています。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T08:37:47.363", "id": "16285", "last_activity_date": "2015-09-05T08:37:47.363", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "845", "parent_id": "16284", "post_type": "answer", "score": 2 } ]
16284
null
16285
{ "accepted_answer_id": "16447", "answer_count": 1, "body": "Facebook SDK for PHP や Opauth を\n使用してFacebookのアカウントでログインする仕組みを作ろうとしていますが、scopeでemailを指定してもメールアドレスが取得できず困っています。\n\n①「developers.facebook.com」でアプリを作成し、「App ID」「App Secret」は取得しています。(v2.4)\n\n②下記URLのFacebookの認証画面で「メールアドレスを受け取る」と書いてあり、OKを押しますが・・・ \n<https://www.facebook.com/dialog/oauth?client_id=>【App ID】&redirect_uri=【App\nSecret】&scope=email\n\n③返ってきたアクセストークンを使用して下記URLから情報を取得しますが、ユーザー名とIDしか取得できません。 \n<https://graph.facebook.com/me?access_token=>【ACCESS_TOKEN】\n\n④Facebook SDK for PHPの設定\n\n```\n\n $config = array(\n 'appId' => '【App ID】',\n 'secret' => '【App Secret】'\n );\n \n $facebook = new Facebook($config);\n \n if ($facebook->getUser()) {\n try {\n $user = $facebook->api('/me','GET');\n } catch(FacebookApiException $e) {\n //取得に失敗したら例外をキャッチしてエラーログに出力\n error_log($e->getType());\n error_log($e->getMessage());\n }\n }\n \n ・\n ・\n ・\n \n if (isset($user)) {\n //ログイン済みでユーザー情報が取れていれば表示\n echo '<pre>';\n var_dump($user);\n echo '</pre>';\n } else {\n //未ログインならログイン URL を取得してリンクを出力\n $params = array('scope' => 'email', 'redirect_uri' => '【URL】');\n $loginUrl = $facebook->getLoginUrl($params);\n echo '<a href=\"' . $loginUrl . '\">Login with Facebook</a>';\n }\n \n```\n\n⑤Opauthの設定\n\n```\n\n // opauth.conf.php\n \n ・\n ・\n ・\n \n 'Strategy' => array(\n // Define strategies and their respective configs here\n \n 'Facebook' => array(\n 'app_id' => '【App ID】',\n 'app_secret' => '【App Secret】',\n 'scope' => array('email')\n ),\n \n ),\n ・\n ・\n ・\n \n```\n\n以上、的を得た質問になっているかわかりませんが、よろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T08:53:34.813", "favorite_count": 0, "id": "16286", "last_activity_date": "2015-09-09T12:40:17.287", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10545", "post_type": "question", "score": -1, "tags": [ "php", "facebook" ], "title": "Facebook SDK for PHP や Opauth でFacebookからメールアドレスが取得できません。", "view_count": 1656 }
[ { "body": "ご指摘いただいたので解決方法を記載します。\n\nおそらくFacebookの仕様変更が原因だと思われます。\n\n<https://graph.facebook.com/me?access_token=>【ACCESS_TOKEN】 \n上記ではメールアドレスは取得できませんが、\n\n<https://graph.facebook.com/me?fields=id,name,email?access_token=>【ACCESS_TOKEN】 \nとすることでメールアドレスを取得することができました。\n\n具体的には、 Opauth の場合だと、\n\n/lib/Opauth/Strategy/Facebook/FacebookStrategy.phpの\n\n```\n\n $me = $this->serverGet('https://graph.facebook.com/me', array('access_token' => $access_token), null, $headers);\n \n```\n\nを\n\n```\n\n $me = $this->serverGet('https://graph.facebook.com/me', array('fields' => 'id,name,email','access_token' => $access_token), null, $headers);\n \n```\n\nにすることで取得できると思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-09T12:40:17.287", "id": "16447", "last_activity_date": "2015-09-09T12:40:17.287", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10545", "parent_id": "16286", "post_type": "answer", "score": 3 } ]
16286
16447
16447
{ "accepted_answer_id": "16291", "answer_count": 1, "body": "Goのテンプレートでテンプレート変数の値によって表示するViewを分けたいのですがテンプレート内での`if`の使用方法がよくわかりません。調べて見ましたが公式リファレンス以外の例を見つけられず、それを参考にしましたができませんでした。例えば以下のばあい\n\n```\n\n {{ if .Num ne 1}}\n <p>Num is not 1</p>\n {{else}}\n <p>Num is 1</p>\n {{end}}\n \n```\n\nと書いてみましたが、実行するとこの部分以降が表示されなくなってしまいました。GoのTempleteでのif文の使い方についておしえてください。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T09:32:37.733", "favorite_count": 0, "id": "16287", "last_activity_date": "2015-09-05T12:09:38.393", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7232", "post_type": "question", "score": 2, "tags": [ "go", "templates" ], "title": "Goのテンプレートのif文で表示を分けたい", "view_count": 3492 }
[ { "body": "テンプレート内で利用できる`eq`、`ne`などの演算子は実際には関数として実装されているので、オペランドを演算子の後に配置する必要があります。(ポーランド記法)\n\n例えば、`.Num != 1`のような式は`ne(.Num, 1)`のような関数呼び出しとして扱う必要があるので、正しい書き方は以下のようになります。\n\n```\n\n {{ if ne .Num 1 }}\n <p>Num is not 1</p>\n {{else}}\n <p>Num is 1</p>\n {{end}}\n \n```", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T11:21:50.887", "id": "16291", "last_activity_date": "2015-09-05T12:09:38.393", "last_edit_date": "2015-09-05T12:09:38.393", "last_editor_user_id": "3639", "owner_user_id": "3639", "parent_id": "16287", "post_type": "answer", "score": 0 } ]
16287
16291
16291
{ "accepted_answer_id": null, "answer_count": 1, "body": "`Microsoft Excel 2000`に付属の`Visual Basicリファレンス`を`HTML形式`に変換したいと考えております。\n\n`hh.exe` にてHTMLファイルの取り出しは行えましたが、`CHM形式`と比べ一部のリンクが欠落しておりました。\n\n例として『Add メソッド』の場合は下記のリンクが欠落します。\n\n```\n\n | 関連項目 | 使用例 | 対象 | アプリケーション情報 |\n \n```\n\nまた、`HTMLファイル(vamthadd.htm)`の該当の箇所にはリンクではなく、`OBJECT`タグが記載されておりました。\n\n```\n\n <OBJECT ID=\"hhobj_1\" TYPE=\"application/x-oleobject\"\n CLASSID=\"clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11\">\n <PARAM NAME=\"Command\" VALUE=\"ALink\">\n <PARAM NAME=\"Text\" VALUE=\"Text:関連項目\">\n <PARAM NAME=\"Flags\" VALUE=\",,1\">\n <PARAM NAME=\"Item1\" VALUE=\"\">\n <PARAM NAME=\"Item2\" VALUE=\"vamthAddC\">\n </OBJECT>\n \n```\n\nこちらをネットで検索したところ、`HTML Help\nWorkshop`にて挿入される[ActiveXを使用するリンク](https://msdn.microsoft.com/en-\nus/library/windows/desktop/ms644643\\(v=vs.85\\).aspx)であり`HTML形式`と互換性がありませんでした。\n\nそこで、`OBJECT`タグを自前でパースし、`HTML`形式のリンクに置換しようと考えたのですが、肝心のリンク先が確認できませんでした。\n\n上記の`OBJECT`タグの場合、文字列 `\"vamthAddC\"`\nが関係しているように思えますが、そのようなHTMLファイル及び、文字列を含むファイルは存在しませんでした。\n\n念のため、`hh.exe`での展開以外にも`HTML Help\nWorkshop`や`7-Zip`での展開も試しましたが生成されるHTMLファイルに差異は認められませんでした。\n\n加えて`CHMLib`のソースコードも確認を行いましたが`hh.exe`と同等程度であり、`OBJECT`タグの処理は行われておりませんでした。\n\n長々とした質問になってしまいましたが上記問題の対処方法をご存知の方はおられるでしょうか?\n\n以上、よろしくお願いいたします。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-05T17:30:31.273", "favorite_count": 0, "id": "16294", "last_activity_date": "2015-10-11T13:58:15.947", "last_edit_date": "2015-09-06T01:47:48.127", "last_editor_user_id": null, "owner_user_id": null, "post_type": "question", "score": 5, "tags": [ "html" ], "title": "Windowsヘルプ形式(.CHM)からHTMLファイルを取得する方法について", "view_count": 976 }
[ { "body": "解決策ではないのですが、調査の参考になればと思って書いています。\n\nご質問のタグは確かにHTMLにActiveXを埋め込んだものです。\n\nだとすると、このタグが何を指すか調査する場合\n\n> CLASSID=\"clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11\"\n\nの部分をまずレジストリエディタで検索します。この場合「adb880a6-d8ff-11cf-9377-00aa003b7a11」の部分を検索することになりますが、私の環境ではヒットしたのがHKEY_CLASSES_ROOT\\CLSID{ADB880A6-D8FF-11CF-9377-00AA003B7A11}というキーで、これは「HHCtrl\nObject」という文字列が設定されていました。\n\n直接は知らないのですが、名前からおそらくHTML Help Workshop\n向けのコントロールオブジェクトとして登録されているActiveXモジュールで、ヘルプではボタンだとか、リンクだとかの機能を受け持つ部品だと思います。\n\n次に\n\n>\n```\n\n> <PARAM NAME=\"Command\" VALUE=\"ALink\">\n> <PARAM NAME=\"Text\" VALUE=\"Text:関連項目\">\n> <PARAM NAME=\"Flags\" VALUE=\",,1\">\n> <PARAM NAME=\"Item1\" VALUE=\"\">\n> <PARAM NAME=\"Item2\" VALUE=\"vamthAddC\">\n> \n```\n\nの部分は、このActiveXオブジェクトが受け取るパラメータを意味します。それぞれ名前から推測すると、\"Comand\"が機能でアンカー(リンク)を指定、”Text\"が表示する文字列を指定、あとの\"Flags\",\"Item1\",\"Item2\"でなにがしかの情報を指定しています。\n\nただ、追えるのはここまでで、おそらくItem2の値\"vamthAddC\"が関連項目の実体を指し示す何かではないかと思いますが、レジストリエディタでも、この値を持っている項目は見つかりませんでした。ActiveX内部で解釈される情報なのだと思います。\n\nと、こんな風に調べていくしかないと思いますが、あとは上記のタグと必要最小限のタグを書いたHTMLファイルを作って、それをInternet\nExplorerで表示した際に現れるActiveXオブジェクトを実際に操作してみて何か情報となるものがないか調べる、という地道な作業をすることになると思います。\n\n以上、ご参考まで。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-11T12:36:14.107", "id": "16524", "last_activity_date": "2015-09-11T12:36:14.107", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9515", "parent_id": "16294", "post_type": "answer", "score": 1 } ]
16294
null
16524
{ "accepted_answer_id": "16334", "answer_count": 1, "body": "javamail-androidでGmailのOAuthのトークンによる認証を行う方法を教えてください。\n\n詳細: \nお世話なっております。\n\n<http://kawaidesu.hatenablog.com/entry/2015/01/04/071658> \n<http://diary.syarihu.net/2015/05/androidandroidoauthoauthhelper.html> \n上記のサイトを参考にさせて頂き「安全性の高いアプリ」として、gmailを介してメール送信を行いたいのですが難航しております。\n\nGmailのトークン習得までは進めたのですが、それをどのようにコードに組み込めばいいのかがわからず困っております。 \nWebを調査して辿り着いた断片的なコードを組み合わせて試してはいるのですが動作せず途方にくれております。\n\nご存知の方がおられましたらアドバイスをいただけないでしょうか? \nよろしくお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T04:15:44.253", "favorite_count": 0, "id": "16296", "last_activity_date": "2015-09-07T01:59:03.677", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8670", "post_type": "question", "score": 2, "tags": [ "android", "oauth", "gmail" ], "title": "javamail-androidでGmailのOAuthのトークンによる認証を行う方法を教えてください。", "view_count": 973 }
[ { "body": "Labs閉鎖に伴ってコードが無くなったらしいですね。 \n検索したらいっぱい出てきましたが、 \n<http://qiita.com/daisy1754/items/788cf32d9379746bba14> \nのサイトがご希望のものに近いかと思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T01:59:03.677", "id": "16334", "last_activity_date": "2015-09-07T01:59:03.677", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8136", "parent_id": "16296", "post_type": "answer", "score": 1 } ]
16296
16334
16334
{ "accepted_answer_id": "16355", "answer_count": 4, "body": "JavaScript, html, cssでカメラのフラッシュのようなアニメーションをしたいと思っています。 \nbuttonを押したときに画面全体を一瞬だけ白く光らせるにはどうすればいいのでしょうか? \njQueryなどを使えばできるようですが、学習のため、ライブラリを使わずに実現したいと考えています。\n\n```\n\n \n <!DOCTYPE html>\n <html lang=\"ja\">\n <head>\n <title&gtCamera; flash</title>\n <meta charset=\"utf-8\">\n </head>\n <body>\n <div id=\"cameraflash\">\n <button>Camera flash</button>\n <p>Camera flash</p>\n </div>\n </body>\n </html>\n \n \n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T04:15:58.220", "favorite_count": 0, "id": "16297", "last_activity_date": "2015-10-11T09:10:42.857", "last_edit_date": "2015-09-07T14:23:27.187", "last_editor_user_id": "5246", "owner_user_id": "5246", "post_type": "question", "score": 4, "tags": [ "javascript", "html", "css", "html5" ], "title": "JavaScriptでライブラリを使わずにカメラのフラッシュのようなアニメーションをする", "view_count": 2076 }
[ { "body": "残念ながらHTMLの機能だけで希望のアニメーションをすることができないようです。 \nただし、JavascriptとCSSも使えば、カメラのフラッシュみたいなアニメーションが簡単にできます。\n\n以下のポストは英語なんですけど、一番上のvihanさんによる回答には使えるコードが載っています \n<https://stackoverflow.com/questions/29594023/getting-camera-like-shutter-\nflash-effect-on-button-click-with-html5-and-jquery>\n\nこれらの言語に詳しくない場合、以下の入門サイトを参照すればすぐ分かると思っております。 \njQueryに関する入門サイトはこちらです:<http://ponk.jp/jquery/basic/> \nそしてCSS : <http://www.ink.or.jp/~bigblock/css/>\n\n以上、頑張ってください", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T18:44:44.783", "id": "16323", "last_activity_date": "2015-09-06T18:44:44.783", "last_edit_date": "2017-05-23T12:38:55.250", "last_editor_user_id": "-1", "owner_user_id": "12223", "parent_id": "16297", "post_type": "answer", "score": 2 }, { "body": "**jQueryを使わずに** ……ですよね? \n特に理由が無ければjQueryを使えば楽なので使えばいいと思いますが…… \n基本は下記ですかね。\n\n```\n\n var isLock = false;\r\n var target_elm = document.getElementById(\"flash\");\r\n var perc = 0.1;\r\n var timer = null;\r\n function run_flash(){\r\n //処理中じゃないか\r\n if(!isLock){\r\n //処理ロック\r\n isLock=true;\r\n //透過度リセット\r\n perc=0.1;\r\n //0.1秒間隔(本当は三角関数使うなどして自然な上昇率にするといい)\r\n timer = setInterval(\r\n function(){\r\n if(1<=perc){\r\n //IE\r\n target_elm.style.filter = 'alpha(opacity=100)';\r\n //FF\r\n target_elm.style.MozOpacity = 1.0;\r\n //other\r\n target_elm.style.opacity = 1.0;\r\n //処理ロック解除\r\n isLock = false;\r\n //タイマー削除\r\n clearInterval(timer);\r\n }else{\r\n //IE\r\n target_elm.style.filter = 'alpha(opacity='+(100*perc)+')';\r\n //FF\r\n target_elm.style.MozOpacity = perc;\r\n //other\r\n target_elm.style.opacity = perc;\r\n perc+=0.1;\r\n }\r\n },\r\n 100\r\n );\r\n }\r\n }\n```\n\n```\n\n #flash{\r\n width:128px;\r\n height:128px;\r\n background-color:#a0a0a0;\r\n }\n```\n\n```\n\n <div id=\"flash\">私だぁ!</div>\r\n <button onclick=\"run_flash();\">ピカァ!</button>\n```\n\n* * *\n\n \n一応jQuery版は下記になります。 \nコード量からして楽なのは断然下記ですね。 \n他のライブラリを汚してしまうなど理由があれば仕方ないですが……\n\n```\n\n function run_flash(){\r\n $(\"#flash\").css(\"opacity\", \"0.1\");\r\n $(\"#flash\").css(\"filter\", \"alpha(opacity=10)\");\r\n $(\"#flash\").fadeTo(\"middle\", 1.0);\r\n }\n```\n\n```\n\n #flash{\r\n width:128px;\r\n height:128px;\r\n background-color:#a0a0a0;\r\n }\n```\n\n```\n\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\r\n <div id=\"flash\">私だぁ!</div>\r\n <button onclick=\"run_flash();\">ピカァ!</button>\n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T19:12:29.517", "id": "16355", "last_activity_date": "2015-09-07T19:12:29.517", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7676", "parent_id": "16297", "post_type": "answer", "score": 1 }, { "body": "CSS Transition を活用して、最小限のスクリプトでフラッシュさせてみました。\n\n 1. 透明で当たり判定を持たない白いカバーを作っておく\n 2. 遷移時間ゼロで不透明にする\n 3. これが表示されたら、すぐに 500ms の遷移時間で透明に戻す\n\n```\n\n flashButton.addEventListener(\"click\", function() {\r\n flashCover.classList.add(\"active\");\r\n requestAnimationFrame(function() {\r\n flashCover.classList.remove(\"active\");\r\n });\r\n });\n```\n\n```\n\n html, body {\r\n height: 100%;\r\n background: gray;\r\n }\r\n \r\n .flash-cover {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n background: white;\r\n opacity: 0;\r\n pointer-events: none;\r\n \r\n transition: opacity 500ms;\r\n }\r\n \r\n .flash-cover.active {\r\n opacity: 1;\r\n transition: none;\r\n }\n```\n\n```\n\n <button id=\"flashButton\">フラッシュさせる</button>\r\n <div id=\"flashCover\" class=\"flash-cover\"></div>\n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T06:36:43.353", "id": "16370", "last_activity_date": "2015-09-08T07:16:07.353", "last_edit_date": "2015-09-08T07:16:07.353", "last_editor_user_id": "4809", "owner_user_id": "4809", "parent_id": "16297", "post_type": "answer", "score": 1 }, { "body": "アニメーションの再生精度にこだわらないのであれば、cssだけでも、 \nactive擬似クラスとanimationでできますね。 \n\n```\n\n html,body {\r\n margin: 0;\r\n padding: 0;\r\n }\r\n body {\r\n background-color: #333;\r\n color: #eee;\r\n font-size: 3em;\r\n text-align: center;\r\n }\r\n button::after {\r\n content: \"\";\r\n display: block;\r\n height: 100%;\r\n width: 100%;\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n background-color: #fff;\r\n opacity: 0;\r\n pointer-events: none;\r\n z-index: 3;\r\n }\r\n button {\r\n font-size: 1rem;\r\n }\r\n button:active::after {\r\n animation:flash 0.5s 1;\r\n }\r\n @keyframes flash {\r\n 50% {\r\n opacity: 1;\r\n }\r\n }\n```\n\n```\n\n <button>Camera flash</button>\r\n <p>Camera flash</p>\n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-10-11T09:10:42.857", "id": "17531", "last_activity_date": "2015-10-11T09:10:42.857", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12727", "parent_id": "16297", "post_type": "answer", "score": 0 } ]
16297
16355
16323
{ "accepted_answer_id": "16300", "answer_count": 1, "body": "iPhone(swift)で以下のようなメニューを作りたいと思っています。\n\n[![作りたいメニュー](https://i.stack.imgur.com/hUHrC.png)](https://i.stack.imgur.com/hUHrC.png)\n\nUITableviewで作れそうな感じですが、 \nfunc tableView(tableView: UITableView, cellForRowAtIndexPath indexPath:\nNSIndexPath) -> UITableViewCell { \nなどを用いて作るのは非常に大変そうで、もっと簡単に作ることはできないかと思っています。 \nまたこのメニューの中にON/OFFの切り替えスイッチ以外にも、直接値を入力できるフィールドを設置できないかとも思っています。\n\nもし簡単に作ることができるのならご教示お願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T05:05:12.283", "favorite_count": 0, "id": "16299", "last_activity_date": "2015-09-06T07:58:05.950", "last_edit_date": "2015-09-06T07:58:05.950", "last_editor_user_id": "7362", "owner_user_id": "8593", "post_type": "question", "score": 2, "tags": [ "ios", "swift", "xcode" ], "title": "swiftでメニューを作りたい", "view_count": 1072 }
[ { "body": "Storyboard上で、 **Tableの属性を「Static Cells」** にすれば、セル上の編集をすべてStoryboardで行えます。\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/65dqv.png)](https://i.stack.imgur.com/65dqv.png)\n\nセル上に配置したインスタンスと、View Controllerに宣言した`@outlet`インスタンスを、直接接続できます。\n\n注意点は、Static\nCellsの設定をするには、`UITableViewController`のサブクラスが必要な点です。`UIViewController`のサブクラスに`UITableView`インスタンスを設置しては、Static\nCellsにすることはできません。", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T06:18:20.743", "id": "16300", "last_activity_date": "2015-09-06T07:00:12.087", "last_edit_date": "2015-09-06T07:00:12.087", "last_editor_user_id": "7362", "owner_user_id": "7362", "parent_id": "16299", "post_type": "answer", "score": 1 } ]
16299
16300
16300
{ "accepted_answer_id": "16307", "answer_count": 1, "body": "数理パズルの一つにナイト・ツアー(<https://en.wikipedia.org/wiki/Knight%27s_tour>) \nというものがあります。\n\nnが6以下のときについてn×n board における directed open tour を \n以下のコードで数時間かけて数えあげたのですが、 \nn = 6 のとき0通り(正しくは6637920通り)になるのはどうしてでしょうか?\n\n```\n\n #include <stdio.h>\n \n int used = 0;\n \n int search(int x, int y, int w, int h, int depth){\n int cnt = 0;\n // はみ出したり、一度通った場所に来てはダメ\n if (x < 0 || w <= x || y < 0 || h <= y || (used & (1 << (x + y * w))) > 0) return 0;\n if (depth == w * h) return 1;\n used += 1 << (x + y * w);\n cnt += search(x + 2, y - 1, w, h, depth + 1);\n cnt += search(x + 2, y + 1, w, h, depth + 1);\n cnt += search(x - 2, y - 1, w, h, depth + 1);\n cnt += search(x - 2, y + 1, w, h, depth + 1);\n cnt += search(x + 1, y - 2, w, h, depth + 1);\n cnt += search(x + 1, y + 2, w, h, depth + 1);\n cnt += search(x - 1, y - 2, w, h, depth + 1);\n cnt += search(x - 1, y + 2, w, h, depth + 1);\n used -= 1 << (x + y * w);\n return cnt;\n }\n \n int main(void){\n int w;\n for (w = 1; w < 7; w++){\n int total = 0;\n int i;\n // (i % w, i / w)を始点とする経路\n for (i = 0; i < w * w; i++){\n total += search(i % w, i / w, w, w, 1);\n }\n printf(\"%d\\n\", total);\n }\n return 0;\n }\n \n```\n\n実行結果 \n1 \n0 \n0 \n0 \n1728 \n0", "comment_count": 4, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T06:56:57.477", "favorite_count": 0, "id": "16301", "last_activity_date": "2015-09-06T11:00:12.553", "last_edit_date": "2015-09-06T10:46:03.947", "last_editor_user_id": "5363", "owner_user_id": "5363", "post_type": "question", "score": 2, "tags": [ "c", "アルゴリズム" ], "title": "n×n board におけるナイト・ツアーの数えあげについて", "view_count": 650 }
[ { "body": "`int used`が32ビット整数で6×6=36ビットの状態を表せていないのでは?", "comment_count": 6, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T11:00:12.553", "id": "16307", "last_activity_date": "2015-09-06T11:00:12.553", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5750", "parent_id": "16301", "post_type": "answer", "score": 2 } ]
16301
16307
16307
{ "accepted_answer_id": null, "answer_count": 1, "body": "Go言語のgormというORMでpostgreSQLのLIKE文を使用しましたが、なぜかデータがとれません。\n\nモデルは以下のものを想定します。\n\n```\n\n type Model struct{\n ID int\n Name string \n Phonetic string //Nameのひらがな\n }\n \n```\n\nここでPhoneticがあ行で始まるものを取得したいので、下記のSQLを発行します。 \n`db.Where(\"phonetic LIKE ?\", \"[あ-お|ぁ-ぉ]%\").Find(&models)`\n\nしかし、データ内にPhoneticがあ行で始まるもの(例えば「おーろら」など)があるのですが、取得できません。どのようなSQLを発行すれば取れるのでしょうか。", "comment_count": 8, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T07:22:50.770", "favorite_count": 0, "id": "16302", "last_activity_date": "2022-08-20T17:05:24.343", "last_edit_date": "2015-09-06T07:47:29.440", "last_editor_user_id": "7232", "owner_user_id": "7232", "post_type": "question", "score": 4, "tags": [ "go", "sql", "postgresql", "gorm" ], "title": "曖昧検索のLIKE文にヒットしない", "view_count": 494 }
[ { "body": "`LIKE` 演算子が行うのはとても単純なパターンマッチであり、正規表現によるマッチではありません:\n<https://www.postgresql.org/docs/current/functions-matching.html>\n\nPostgreSQL では `~` 演算子で正規表現を使ったマッチができるので、これを利用することは一応できます。`phonetic ~\n'^[あ-お|ぁ-ぉ]'` といった感じです。\n\nただし正規表現を使ったマッチはインデックスを利用しづらいなどのデメリットがあり、レコード数が多くなるとクエリ実行に時間がかかりがちです。実行時間で困る場合、1\n文字目しか利用しないのであればそのためのカラムを作るとか、色々な検索パターンがありえるのであれば全文検索エンジンの利用を検討するとかが考えられます。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2022-08-20T17:05:24.343", "id": "90655", "last_activity_date": "2022-08-20T17:05:24.343", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "19110", "parent_id": "16302", "post_type": "answer", "score": 1 } ]
16302
null
90655
{ "accepted_answer_id": null, "answer_count": 1, "body": "お願いします。 \n循環参照を防ぐための、弱い参照の使い方でいろいろと試しています。弱い参照のみで参照してるオブジェクトが解放されないように思える現象があり、質問させて頂きます。 \n(アップルのPrograming with Objective-Cの中のpropertyのところを参考にしています)\n\n```\n\n //date1に現在の時刻を参照させる。(強い参照で)\n NSDate *date1 = [[NSDate alloc] init]; \n \n //date2にも同じ時刻を参照させる。(弱い参照で)\n NSDate * __weak date2 = date1; \n \n //date1に別の時刻を参照させる。(最初に参照していた現在の時刻への強い参照はなくなる)\n date1 = [[NSDate alloc] initWithString:@\"2000-01-01 00:00:00 +0000\"]; \n \n NSLog(@\"date1 is %@\", date1); //date1は変更後の時刻(2000年1月1日)を参照\n NSLog(@\"date2 is %@\", date2); //date2はnullになる\n \n```\n\n上記のようにdate2を弱い参照にすると、date1の参照先が変わるとdate2がnullになることが \n確認できました。(強い参照だと現在の時刻を保持します)しかし、1行目のコードを日付を指定してNSDateを生成するコードに変更すると、例えば、\n\n```\n\n NSDate *date1 = [[NSDate alloc] initWithString:@\"2000-12-31 23:59:59 +0000\"];\n \n```\n\nとするとdate1の参照先が変わってもdate2はこの日付を保持し、nullになりません。なぜでしょうか。また扱うデータの型をNSString型にしても、同じように弱い参照のみで参照しているオブジェクトが解放されないようです。よろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T08:00:44.750", "favorite_count": 0, "id": "16303", "last_activity_date": "2015-09-06T15:01:51.247", "last_edit_date": "2015-09-06T12:50:26.853", "last_editor_user_id": "7362", "owner_user_id": "12218", "post_type": "question", "score": 9, "tags": [ "objective-c", "arc" ], "title": "強い参照、弱い参照について", "view_count": 575 }
[ { "body": "```\n\n NSLog(@\"%d\", (int)CFGetRetainCount((__bridge CFTypeRef)date1));\n \n```\n\nで参照カウンタを見れば分かりますが、`initWithString:`で生成した`NSDate`は`-1`(解放不要)が返却されます。\n\n弱参照がゼロ化される条件は、ランタイムが管理しているオブジェクト毎の参照カウントが0になった場合なので、解放されないオブジェクトに対しては`__weak`は機能しません。\n\n同じ`NSDate`でも挙動が違うのは、クラスクラスタにより生成されるクラスそのものが違うためです。\n\n```\n\n [[NSDate alloc] init];\n \n```\n\nで生成されるのは、`__NSDate`です。対して、\n\n```\n\n [[NSDate alloc] initWithString:@\"2015-09-06 00:00:00 +0000\"];\n \n```\n\nで生成されるクラスは`__NSTaggedDate`です。\n\n* * *\n\nここからはフレームワークのプライベート領域なので推測でしかないのですが、`__NSTaggedDate`はタグ付きポインタで実装されているのだと思われます(同様の推察はいろいろ出てきます)。\n\nタグ付きポインタを使うメリットは、ポインタの余った`bit`に日付情報を持たせることで、単一のインスタンスで複数の日付を表現できる、ヒープに優しい実装にできることです。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T10:23:08.897", "id": "16306", "last_activity_date": "2015-09-06T15:01:51.247", "last_edit_date": "2015-09-06T15:01:51.247", "last_editor_user_id": "5337", "owner_user_id": "5337", "parent_id": "16303", "post_type": "answer", "score": 10 } ]
16303
null
16306
{ "accepted_answer_id": "16318", "answer_count": 1, "body": "bashにおいて、任意の関数のソースファイルを取得する方法を探しています。\n\n例えば、以下のような関数を適当なファイルに書き込んで`source`するとします。\n\n```\n\n somefunc () {\n echo \"${BASH_SOURCE[@]}\"\n }\n \n```\n\n該当の関数それ自体においては`BASH_SOURCE`変数からソースファイルを取得できますが、外部からこれを取得する方法はないでしょうか?", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T12:25:10.730", "favorite_count": 0, "id": "16311", "last_activity_date": "2015-09-10T23:52:58.343", "last_edit_date": "2015-09-10T23:52:58.343", "last_editor_user_id": "5851", "owner_user_id": "5851", "post_type": "question", "score": 2, "tags": [ "bash" ], "title": "bash関数のソースを、該当関数スコープの外部から取得する", "view_count": 357 }
[ { "body": "「別のプロセス」というのがよく分からないのですが、これは「当該関数スコープの外側」という意味でしょうか? その場合は以下の様にして調べる事ができます。\n\n```\n\n ## Enable debugging mode\n $ shopt -s extdebug\n ## Show the sourced file path where a function is defined\n $ declare -F ord\n ord 96 /home/nemo/.bash_functions/00.sh\n \n /home/nemo/.bash_functions/00.sh:\n =================================\n 96: function ord {\n 97: echo $(printf '%d' \\'$1)\n 98: }\n =================================\n \n```\n\n勘違いをしていたらすみません。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T15:02:42.910", "id": "16318", "last_activity_date": "2015-09-06T15:02:42.910", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "parent_id": "16311", "post_type": "answer", "score": 4 } ]
16311
16318
16318
{ "accepted_answer_id": null, "answer_count": 1, "body": "swiftにおける開発業務を分担しようと思っています。\n\nAさん: 画面1〜3(storyboardで作成) \nBさん: 画面4〜6(storyboardで作成) \nCさん: 画面7〜9(storyboardで作成)\n\nのようにstoryboardの画面とその画面のclassファイル(.swift)ファイルをそれぞれの担当として、また別担当にまたがる処理は結合処理のあとにと考えています。\n\nそれぞれ開発が終わり、いざ結合しようとするとstoryboard上の画面がコピー& \nペーストできません。仮にできたとしても各画面からつながるclassファイル(.swift)のIBOutletなどがリンクしていてくれるのか不明です。\n\n一般的に分担して開発する際にはみなさんどうしているのでしょうか?", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T13:01:37.600", "favorite_count": 0, "id": "16315", "last_activity_date": "2015-09-09T01:21:02.700", "last_edit_date": "2015-09-08T03:10:12.267", "last_editor_user_id": "8000", "owner_user_id": "8593", "post_type": "question", "score": 1, "tags": [ "swift", "xcode", "storyboard" ], "title": "swiftにおける分担開発", "view_count": 351 }
[ { "body": "初めての回答です。質問内容とかけ離れていたらごめんなさい。。\n\n> 一般的に分担して開発する際にはみなさんどうしているのでしょうか?\n\nstoryboardを使用した開発と使用しない開発(コードでUIを組む)の2通りがあり、 \nそれぞれプロジェクトの規模やUIの複雑さにより使い分けます。 \nまた、storyboardを使用した開発ではStoryBoardファイルを分割し、肥大化を回避するような開発が一般的かと思います。\n\n前提として、例えばAutoLayoutを使用する設定やStoryBoardのバージョン等はメンバー間で合わせておく必要があるかと思います。\n\n**基本的に複数の作業者が同じStoryBoardを使用した場合でも、XCode上からpullすることで自動マージ出来ます。**\n\nコンフリクトした場合、StoryBoardファイルの中身はXMLですので直接修正しなければならないシーンが発生するかもしれません。ヘタするとレイアウトが崩れ、ある時点のCOMMITまで戻すような状況になりますが、以下の様な対策を行うことで回避できます。(あくまで一部です)\n\n * COMMITの粒度を小さくする \n1つのCOMMITによるStoryBoardの変更数を小さくし、適宜問題がないことを確認する\n\n * StoryBoardを分割する \nex) \nA-B-C間のレイアウトをStoryBoard1とする \nD-E-F間のレイアウトをStoryBoard2とする\n\nStoryBoardを切り替える場合、コードでStoryBoardを読込んでViewControllerへ渡す処理が必要になります。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-09T01:12:58.607", "id": "16406", "last_activity_date": "2015-09-09T01:21:02.700", "last_edit_date": "2015-09-09T01:21:02.700", "last_editor_user_id": "12256", "owner_user_id": "12256", "parent_id": "16315", "post_type": "answer", "score": 1 } ]
16315
null
16406
{ "accepted_answer_id": null, "answer_count": 1, "body": "インストールやアンインストールを適切に行えなかったようで、依存関係を良くない状態にしてしまったようです。\n\n>\n> エラーが発生しました。右クリックでパッケージマネージャーを実行するか、端末で何が問題か確認してください。エラーメッセージは次のとおりです。'エラー:BrokenCount>\n> 0 'これは、インストールしたパッケージの依存性が満たせない状態です。\n\nパッケージマネージャーでアップデートをしたところエラーで完了できませんでした。 \nどのような手順でエラーを回復したらいいですか", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T17:42:59.367", "favorite_count": 0, "id": "16321", "last_activity_date": "2015-09-06T23:13:13.743", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10945", "post_type": "question", "score": 1, "tags": [ "linux", "ubuntu" ], "title": "ubuntuの通知領域に’エラー:BrokenCount> 0’が表示されています。", "view_count": 3608 }
[ { "body": "多分、自己解決しました。\n\n```\n\n sudo apt-get -f upgrade\n \n```\n\nを実行すると以下のような表示は出ますが\n\n> 以下のパッケージが自動でインストールされましたが、もう必要とされていません: \n> libbaloocore4 libbaloofiles4 libbalooxapian4 libepub0 libkactivities-\n> models1 libkidletime4 \n> libnepomukcleaner4 libnepomukcore4abi1 libqmobipocket1 libzip2 \n> nepomuk-core-data nepomuk-core-runtime shared-desktop-ontologies \n> これを削除するには 'apt-get autoremove' を利用してください。 \n> アップグレード: 0 個、新規インストール: 0個、削除: 0 個、保留: 0 個。\n\n`autoremove` で`libbaloocore4`最初のファイルを指定するだけでこの文は消せました。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T23:13:13.743", "id": "16327", "last_activity_date": "2015-09-06T23:13:13.743", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10945", "parent_id": "16321", "post_type": "answer", "score": 1 } ]
16321
null
16327
{ "accepted_answer_id": "16326", "answer_count": 2, "body": "オブジェクトを座標Aから座標Bへ、以下の条件に基づいて移動させようとしています。\n\n・座標Aでの速度は定数Va \n・座標Bでの速度は定数Vb \n・AからBまで移動するのにかかる時間は定数T \n・AからBまでの距離は定数D\n\nこの条件下で、速度をVaからVbへスムーズに変化させながら移動させたいのですが、どうすれば特定時刻での速度を求めることができるでしょうか? \n(座標Bに到着する前に速度がVbに達していても構いません)", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T18:18:59.623", "favorite_count": 0, "id": "16322", "last_activity_date": "2015-09-07T14:44:39.183", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12224", "post_type": "question", "score": 7, "tags": [ "アルゴリズム" ], "title": "初速・最終速度・移動時間・移動距離が決まっている状況で、速度をスムーズに変化させる", "view_count": 791 }
[ { "body": "「スムース」の条件は何ですか? 単に「速度が連続であれば良い」なら折れ線で良いので比較的簡単です。\n\n下図において、影の面積が距離Dになります。\n\n[![速度のグラフ](https://i.stack.imgur.com/2pDFT.png)](https://i.stack.imgur.com/2pDFT.png)\n\nVa <= Vb, T・Va <= D <= T・Vb もしくは Va > Vb, T・Va >= D >= T・Vb の場合は、\n\nD = T・Va + T1・(Vb - Va)/2 + (T - T1)・(Vb - Va) を満たすT1を求めて、\n\n```\n\n V(t) = Va + (Vb - Va)t (t < T1)\n Vb (t >= T1)\n \n```\n\nとします。\n\n上の条件にあてはまらない場合は、Hidekiさんのコメントにあるように、一旦min(Va, Vb)より遅くしてからまた速くする、あるいはmax(Va,\nVb)より速くしてからまた減速する、といった操作が必要になりますが、計算は基本的に三角形と長方形の面積の組み合わせですので丁寧に場合分けしてゆけば同様に求まります。\n\n(「スムース」の条件が「加速度が連続」だと曲線で囲まれた面積になるのでうんとややこしくなりますが、どうですか?\n例えば加速度が折れ線なら、速度のグラフは二次曲線と直線を \nつなげたものになります)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-06T22:15:57.287", "id": "16326", "last_activity_date": "2015-09-06T22:15:57.287", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5258", "parent_id": "16322", "post_type": "answer", "score": 9 }, { "body": "与えられた条件で速度もなめらかに変化させたい場合、位置を3次関数で表すのが簡単だと思います。\n\nすなわち時刻tにおける位置(初期位置からの距離)をp(t)、速度をv(t)とすると \np(t) = At3 \\+ Bt2 \\+ Ct ・・・(1) \n(1)を微分して \nv(t) = 3At2 \\+ 2Bt + C ・・・(2)\n\n(1)(2)に条件を当てはめれば係数A、B、Cを求めることができます。\n\np(T) = D = AT3 \\+ BT2 \\+ CT ・・・(3) \nv(0) = Va = C ・・・(4) \nv(T) = Vb = 3AT2 \\+ 2BT + C ・・・(5)\n\n計算過程は省きますが(3)~(5)を連立して解くと、\n\nA = -2D / T3 \\+ (Va + Vb) / T2 \nB = 3D / T2 \\- (2Va + Vb) / T \nC = Va \nが得られます。\n\nこれを(1)、(2)に当てはめれば任意の時刻における位置と速度が求まります。\n\nT=10、Va=10、Vb=0、D=100でExcelでプロットしてみました。\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/Fv83X.png)](https://i.stack.imgur.com/Fv83X.png)\n\n* * *\n\n一応題意は満たしていると思いますが、パラメータによっては途中の速度が負(つまり位置が後戻り)になります。ときには目標地点を行き過ぎて戻ることも。それでよければということで。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T12:16:01.313", "id": "16348", "last_activity_date": "2015-09-07T14:44:39.183", "last_edit_date": "2015-09-07T14:44:39.183", "last_editor_user_id": "4765", "owner_user_id": "4765", "parent_id": "16322", "post_type": "answer", "score": 7 } ]
16322
16326
16326
{ "accepted_answer_id": "16329", "answer_count": 1, "body": "monacaにサンプルでメモアプリがありますが、ローカル(ios上)にテキストドキュメントを残していないようなのでファイルをFileRead/Writeするような形でメモアプリを作成したいです。\n\nhtmlは\n\n```\n\n <textarea id=\"text\" placeholder=\"テキストを入力してください。\"></textarea>\n <br />\n <button id=\"btndownWrite\">ファイル作成/書き込み</button>\n <button id=\"btndownRead\">ファイル読み込み</button>\n \n```\n\nというのを考えており、 \nとりあえずでいいので \nbtndownWriteを押したらローカルにファイル(テキストドキュメント[.txt])を作成しtextの文字を書き込む(すでにあったら追記する)、 \nbtndownReadを押したらローカルにあるファイル(テキストドキュメント[.txt])をtextに表示する。 \nようなものを作りたいです。\n\n無知ですがよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T00:13:46.887", "favorite_count": 0, "id": "16328", "last_activity_date": "2015-09-07T01:20:10.347", "last_edit_date": "2015-09-07T01:20:10.347", "last_editor_user_id": "3516", "owner_user_id": "12225", "post_type": "question", "score": 3, "tags": [ "ios", "monaca", "jquery", "html5" ], "title": "monacaでローカルにテキストドキュメント(.txt)を残しそれを読み書きしたいです。", "view_count": 1629 }
[ { "body": "Cordovaのファイルプラグインというものを使って実現できますので、まずはご自身でもう少しお調べになってみてください。下記ページなどが参考になると思います。 \n<http://docs.monaca.mobi/cur/ja/reference/phonegap_34/ja/file/> \n<http://gihyo.jp/dev/serial/01/phonegap2/0004>", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T00:32:46.210", "id": "16329", "last_activity_date": "2015-09-07T00:32:46.210", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8532", "parent_id": "16328", "post_type": "answer", "score": 1 } ]
16328
16329
16329
{ "accepted_answer_id": "16341", "answer_count": 1, "body": "monacaで初のアプリ習作を作っています。 \n16x20程度のテーブルを作り、セルをタップしたらフォーカスを移すという機能を実装しようとしている最中で、急に思った通りの動作をしてくれなくなってしまいました。 \n具体的にいうと、indexが-1のtd要素からクリックイベントが呼ばれたきり、それ以降クリックに反応しなくなってしまいます。 \nあれ・・・さっきまで動いてたのにナンデ・・・。 \nいろいろ試しているのですが行き詰っています。どなたか解決策ご存じありませんか?\n\n```\n\n function cellClick(){\n console.log(\"clicked\"+$(\"td\").index(this)+\"/\"+$(\"td\").length);\n //ここで\"clicked-1/352\"のログが出て、それ以降クリックに反応しなくなる。\n $(\".focus\").removeClass(\"focus\");\n $(this).addClass(\"focus\");\n }\n \n $(function(){\n console.log(\"load complete.\");\n showTable();//テーブルを構築して表示\n $(\"td\").click(cellClick());\n });\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T00:57:40.000", "favorite_count": 0, "id": "16330", "last_activity_date": "2015-09-07T05:03:23.143", "last_edit_date": "2015-09-07T05:03:23.143", "last_editor_user_id": "76", "owner_user_id": "12226", "post_type": "question", "score": 2, "tags": [ "monaca", "jquery" ], "title": "謎のクリックイベントが呼ばれる", "view_count": 212 }
[ { "body": "$(\"td\").click(cellClick()); は間違いでは?\n\njQuery.click() の引数は function\nですので、cellClickという関数がfunctionを返すのであれば意味は通りますが、cellClick自体をクリックイベントのコールバック関数として登録するのであれば、 \n$(\"td\").click(cellClick); \nとする必要がありますよね。\n\n\"clicked-1/352\"のログが吐き出されたのは、$(\"td\").click(cellClick());を実行した時に \ncellClick関数が呼ばれたため、と思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T05:00:28.467", "id": "16341", "last_activity_date": "2015-09-07T05:00:28.467", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9888", "parent_id": "16330", "post_type": "answer", "score": 4 } ]
16330
16341
16341
{ "accepted_answer_id": "16333", "answer_count": 1, "body": "通知領域に!と三角の赤い色の通知がでました。 \nUbuntu 14.04を使っていますが、ネットワークかレポジトリが原因でエラーがでています。 \nアップデートを試みましたが最新の状態ということで何も起きませんでした。どのようにしたらエラーを回避できますか。\n\n> The update information is outdated.This may be caused by network problems or\n> by a repository that is no longer available.Please update manually selecting\n> 'Show updates'from the indicator menu,and watching for any failing\n> repositories.\n\n<https://askubuntu.com/questions/481789/unknown-error-in-my-system14-04> \nを試したところ\n\n> @ubuntu:~$ sudo apt-add-repository --remove ppa:upubuntu-com/office \n> [sudo] password for aaa: 詳しい情報: \n> <https://launchpad.net/~upubuntu-com/+archive/ubuntu/office> [ENTER] \n> を押すと続行します。ctrl-c で削除をキャンセルできます\n>\n> @ubuntu:~$ sudo ppa-purge ppa:upubuntu-com/office sudo: ppa-purge: \n> command not found \n> @ubuntu:~$\n\nとでてきました。\n\n```\n\n sudo apt-get install ppa-purge\n \n```\n\nでどうにかなりましたけど\n\n> @ubuntu:~$ sudo ppa-purge ppa:upubuntu-com/office Updating packages \n> lists W: \n> <http://ppa.launchpad.net/jon-\n> severinsson/ffmpeg/ubuntu/dists/trusty/main/source/Sources> \n> の取得に失敗しました 404 Not Found\n>\n> W: \n> <http://ppa.launchpad.net/jon-\n> severinsson/ffmpeg/ubuntu/dists/trusty/main/binary-amd64/Packages> \n> の取得に失敗しました 404 Not Found\n>\n> W: \n> <http://ppa.launchpad.net/jon-\n> severinsson/ffmpeg/ubuntu/dists/trusty/main/binary-i386/Packages> \n> の取得に失敗しました 404 Not Found\n>\n> W: \n>\n> <http://ppa.launchpad.net/directhex/monoxide/ubuntu/dists/trusty/main/source/Sources> \n> の取得に失敗しました 404 Not Found\n>\n> W: \n>\n> <http://ppa.launchpad.net/directhex/monoxide/ubuntu/dists/trusty/main/binary-\n> amd64/Packages> \n> の取得に失敗しました 404 Not Found\n>\n> W: \n>\n> <http://ppa.launchpad.net/directhex/monoxide/ubuntu/dists/trusty/main/binary-i386/Packages> \n> の取得に失敗しました 404 Not Found\n>\n> E: いくつかのインデックスファイルのダウンロードに失敗しました。これらは無視されるか、古いものが代わりに使われます。 \n> Warning: apt-get update failed for some reason \n> PPA to be removed: upubuntu-com office \n> Warning: Could not find package list for PPA: upubuntu-com office\n\nなんか警告出てますけど大丈夫ですか?\n\n追記\n\n今朝確認したところまたエラーが出ていました。 \n重篤ではないので放置します。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T01:24:56.833", "favorite_count": 0, "id": "16332", "last_activity_date": "2015-09-08T02:30:57.143", "last_edit_date": "2017-04-13T12:25:24.820", "last_editor_user_id": "-1", "owner_user_id": "10945", "post_type": "question", "score": -1, "tags": [ "linux", "ubuntu" ], "title": "ネットワークかレポジトリが原因でエラーがでています。", "view_count": 1239 }
[ { "body": "そのエラーでそのまま検索すると、stak overflowにいくつか答えがありましたがそちらは試してみましたか? \n下のurlは、それらの一つです。 \n<https://askubuntu.com/questions/481789/unknown-error-in-my-system14-04>", "comment_count": 3, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T01:51:20.327", "id": "16333", "last_activity_date": "2015-09-07T01:51:20.327", "last_edit_date": "2017-04-13T12:25:24.820", "last_editor_user_id": "-1", "owner_user_id": "11194", "parent_id": "16332", "post_type": "answer", "score": 1 } ]
16332
16333
16333
{ "accepted_answer_id": null, "answer_count": 1, "body": "[SourceTree](https://www.atlassian.com/ja/software/sourcetree/overview)の樹形図の見方がいまいち分からず、皆様のお力を借りたく投稿しました。\n\n仕事で今度からSourceTreeを使っていくという事で、色々といじくっていたのですが、樹形図の一番左にあるブランチは何を示しているのでしょうか? \n現在チェックアウトしているブランチかと思ってましたが、切り替えても別にブランチの列は変わらず…。最新コミットを持つブランチかな?とも思ったのですが、ある方のブログでは「一番コミット数が多いブランチ」などとも書いてあり、混乱しております。\n\n直接作業には関わらない事ではありますが、今後SourceTreeを十分に活用してきたいので、どなたかご存知の方はご教授のほど、よろしくお願い致します。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T02:10:44.257", "favorite_count": 0, "id": "16336", "last_activity_date": "2015-09-07T04:15:45.817", "last_edit_date": "2015-09-07T02:19:27.237", "last_editor_user_id": null, "owner_user_id": "12227", "post_type": "question", "score": 6, "tags": [ "git" ], "title": "SourceTreeの樹形図について", "view_count": 4400 }
[ { "body": "\"default branch\"と設定したものが一番左 (leftmost one)になるのではないでしょうか。\n\nこのあたりで議論されています (詳細は読み切れてません) \n[Atlassian Answers](http://answers.atlassian.com/questions/310287)\n\n> Any other branch can be configured to be the default branch. Saying this, it\n> does not make sense to have master branch displayed always leftmost.\n\n(訳: どのブランチでもdefault branchにできます。 つまり、一番左が常にmasterブランチとは限らないよ)\n\ndefault branchの設定方法は以下に投稿しました。 \n[default branchの設定方法](http://qiita.com/7of9/items/d6b0fea5c3a171553e12)", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T04:07:07.473", "id": "16339", "last_activity_date": "2015-09-07T04:15:45.817", "last_edit_date": "2015-09-07T04:15:45.817", "last_editor_user_id": "4840", "owner_user_id": "4840", "parent_id": "16336", "post_type": "answer", "score": 3 } ]
16336
null
16339
{ "accepted_answer_id": null, "answer_count": 1, "body": "MonacaでiOS\nbuild(AdHoc)した際に発行されるQRコードですが、一定の時間が経過しQRコードを読み取りインストールをしようとした場合に次のメッセージが表示されますが\n\"The package has already been expired. Please make build again\"\n一体どの程度の時間が経つとQRコードは無効になるのでしょうか。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T02:58:13.843", "favorite_count": 0, "id": "16337", "last_activity_date": "2015-09-07T04:01:58.140", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "11149", "post_type": "question", "score": 0, "tags": [ "monaca" ], "title": "QRコードからのインストールについて", "view_count": 443 }
[ { "body": "一定時間経過でMonacaのサーバよりアプリのパッケージは削除されてしまいます。 \n再度ビルドすることによりインストールできますが、前のURLは無効になります。 \n自身で配布したい場合は \nSSLでサーバ証明書を発行した上でサーバでインストールページを作るのが良いでしょう。 \nまた、ipaファイルを保存して置いて、iTunesでインストールしてもらうのも1つの手です。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T04:01:58.140", "id": "16338", "last_activity_date": "2015-09-07T04:01:58.140", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7676", "parent_id": "16337", "post_type": "answer", "score": 2 } ]
16337
null
16338
{ "accepted_answer_id": "16407", "answer_count": 4, "body": "WindowsからIBM i上に存在するソースコードをFTPで一括して取得しようと考えていますが、 \nmgetコマンドを使用するとファイル中の日本語部分が文字化けします。 \ngetコマンドを使用した場合はこの問題は起こらず、mgetコマンドを使用したときのみ起こります。 \nこれを文字化けしないで取得する方法はないでしょうか?\n\n実行したFTPコマンドは以下の通りです。\n\n```\n\n ID\n PASSWORD\n QUOTE SITE NAMEFMT 1\n QUOTE TYPE B 1\n CD /QSYS.LIB/QXXXLIB.LIB/TEST.FILE/\n PROMPT OFF\n MGET *.MBR\n QUIT\n \n```\n\n上記コードの`MGET *.MBR`の部分を`GET HELLO.MBR`に変えると文字化けが起こりません。 \nまた、IBM i側のファイルの文字コード(CCSID)は5035です。\n\n* * *\n\n追記 \ndebugモードでのログを記載します。\n\n```\n\n ftp> debug\n デバッグ オン。\n ftp> quote site namefmt 1\n ---> site namefmt 1\n 250 NOW USING NAMING FORMAT \"1\".\n ftp> quote type b 1\n ---> type b 1\n 200 REPRESENTATION TYPE IS SHIFT JIS KANJI.\n ftp> cd /qsys.lib/QXXXSRC.lib/TEST.file/\n ---> CWD /qsys.lib/QXXXSRC.lib/TEST.file/\n 250 \"/QSYS.LIB/QXXXSRC.LIB/TEST.FILE\" IS CURRENT DIRECTORY.\n ftp> prompt off\n 対話モード オフ。\n ftp> mget *.mbr\n ---> TYPE A\n ---> PORT 192,168,***,***,195,100\n ---> NLST *.mbr\n ---> TYPE A\n 200 REPRESENTATION TYPE IS ASCII NONPRINT.\n ---> PORT 192,168,***,***,195,101\n 200 PORT SUBCOMMAND REQUEST SUCCESSFUL.\n ---> RETR A.MBR\n 150 RETRIEVING MEMBER A IN FILE TEST IN LIBRARY QXXXSRC.\n 226 FILE TRANSFER COMPLETED SUCCESSFULLY.\n ftp: 197 バイトが受信されました 0.00秒 197000.00KB/秒。\n ---> PORT 192,168,***,***,195,102\n 200 PORT SUBCOMMAND REQUEST SUCCESSFUL.\n ---> RETR B.MBR\n 150 RETRIEVING MEMBER B IN FILE TEST IN LIBRARY QXXXSRC.\n 226 FILE TRANSFER COMPLETED SUCCESSFULLY.\n ftp: 197 バイトが受信されました 0.00秒 197.00KB/秒。\n ---> PORT 192,168,***,***,195,103\n 200 PORT SUBCOMMAND REQUEST SUCCESSFUL.\n ---> RETR C.MBR\n 150 RETRIEVING MEMBER C IN FILE TEST IN LIBRARY QXXXSRC.\n 226 FILE TRANSFER COMPLETED SUCCESSFULLY.\n ftp: 41 バイトが受信されました 0.00秒 41000.00KB/秒。\n ---> PORT 192,168,***,***,195,104\n 200 PORT SUBCOMMAND REQUEST SUCCESSFUL.\n ---> RETR D.MBR\n 150 RETRIEVING MEMBER D IN FILE TEST IN LIBRARY QXXXSRC.\n 226 FILE TRANSFER COMPLETED SUCCESSFULLY.\n ftp: 197 バイトが受信されました 0.00秒 197000.00KB/秒。\n ftp> quit\n ---> QUIT\n 221 QUIT SUBCOMMAND RECEIVED.\n \n```", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T04:15:20.530", "favorite_count": 0, "id": "16340", "last_activity_date": "2015-09-09T01:40:39.430", "last_edit_date": "2015-09-09T00:37:29.627", "last_editor_user_id": "12195", "owner_user_id": "12195", "post_type": "question", "score": 2, "tags": [ "windows", "文字化け", "ftp" ], "title": "IBM iからFTPのMGETコマンドでファイルを取得した際に文字化けが発生する", "view_count": 7523 }
[ { "body": "`prompt off`と`MGET *.MBR`の間に`ascii`というコマンドを入れればうまくいきませんか。\n\nこれでうまくいかない場合、IBMにもっと具体的にどのコードで送ってほしいか指示する必要があるのですが、生憎windowsのftpクライアントにはそのようなものはありません。そういった場合、`quote`というコマンドを使って任意の文字列をホストに送ることができます。 \n問題は何を送ればいいか、ということなのですが、検索していたらAS400のftpの使い方というページがありました \n<http://publib.boulder.ibm.com/html/as400/v4r5/ic2962/info/RZAIQTYPE.HTM#HDRRZAIQTYPE> \nこの`TYPE\nB4R`を実行したときにホストに送られるものと同じものを送ればいいのですが、実機が無い場合、うまく転送できるgetのログやトレースなどから推定するか、`remotehelp`などを見ながらあれこれ試すしかありません。 \n仮に`TYPE B4R`を入れると`site mode b4r`というコマンドが送られるなら`quote 'site mode\nb4r'`のように使います。このあたりから、IBMのサポートに聞く方が早いという解が現実味を帯びてくると思います。\n\nこれをやってもだめな場合、それはクライアント側のgetとmgetの機能が違うということなのでftpコマンドを使う限りどうにもなりません。その可能性は決して低くないと思います。", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T01:46:55.883", "id": "16362", "last_activity_date": "2015-09-08T01:46:55.883", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8136", "parent_id": "16340", "post_type": "answer", "score": 3 }, { "body": "Windows側で文字コードを別途変換出来る手段があるのであれば、バイナリモードでダウンロードした方が確実だと思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-09T00:15:21.117", "id": "16403", "last_activity_date": "2015-09-09T00:15:21.117", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "10115", "parent_id": "16340", "post_type": "answer", "score": 1 }, { "body": "```\n\n ftp> quote type b 1\n ---> type b 1\n 200 REPRESENTATION TYPE IS SHIFT JIS KANJI.\n \n```\n\nまではうまくいっているようですが、当初の予想に反し、NLST でファイルのリストを取得した後、\n\n```\n\n ---> NLST *.mbr\n ---> TYPE A\n 200 REPRESENTATION TYPE IS ASCII NONPRINT.\n \n```\n\nで ASCII モードになってますね。`quote type b 1` が FTP クライアントに type\nコマンドの亜種として認識されないので、よくよく考えれば不思議な動作ではないですね。\n\n考えうる対処としては\n\n 1. binary で転送して、Windows 上で文字コード変換\n 2. `mget` の前後で発行するコマンドを細かく制御できる FTP クライアントを使う\n 3. `ls` コマンドを使ってファイルリストを取得し、それを自前でパースし逐次 get コマンドで取得するような .BAT なり PowerShell を書く\n 4. Ruby やら Python といった LL を使う\n\nあたりでしょうか。ご自分の仕事環境で一番楽な方法を選べばいいと思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-09T01:24:06.533", "id": "16407", "last_activity_date": "2015-09-09T01:24:06.533", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2521", "parent_id": "16340", "post_type": "answer", "score": 1 }, { "body": "自己回答 \nWindows側からIBM i側へ`mget`するのではなく、 \nIBM i側からWindows側へ`ltype c 943`コマンドを使用した後で`mput`することで \n文字化けせずに転送することが可能。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-09T01:40:39.430", "id": "16408", "last_activity_date": "2015-09-09T01:40:39.430", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12195", "parent_id": "16340", "post_type": "answer", "score": 1 } ]
16340
16407
16362
{ "accepted_answer_id": null, "answer_count": 2, "body": "いつもお世話になっております。 \nonsenuiとjqueryでアプリを開発しているのですが、pushpage内でのjsの扱いで困っています。\n\n現在ons-navigator内でjsによりアイテムの一覧をデータベースより取得・表示させています。 \n一覧の各アイテムをクリックでpushPage(詳細ページ)に移動する仕様にしております。\n\npushPage(詳細ページ)に移動した際リストページで取得したキーを元に再度データベースへデータを取りに行きたいのですが、ページ読み込み時にajax通信エラーが出てしまいます。\n\n一旦親ページでデータを取得したpushPage内では再度データの取得はできないのでしょうか?\n\n参考までに詳細ページ内でのjsは以下のように記載しております。\n\n```\n\n $(document.body).on(\"pageinit\", '#hoge', function() {\n var options = myNavigator.getCurrentPage().options;\n var param = { \"id\": options.itemid};\n $.ajax({\n url: \"http://sample.com/app/sample.php\",\n type:\"POST\",\n dataType: JSON.stringify(param),\n success:function(xml){\n $(\"#done\").html('<br><br>サーバーへの接続に成功');\n },\n error:function(){\n $(\"#err\").html('<br><br>サーバーへの接続に失敗しました');\n }\n });\n });\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T06:12:32.207", "favorite_count": 0, "id": "16342", "last_activity_date": "2015-09-08T00:47:56.433", "last_edit_date": "2015-09-07T07:11:55.810", "last_editor_user_id": "7676", "owner_user_id": "11129", "post_type": "question", "score": -1, "tags": [ "onsen-ui" ], "title": "onsenui ons-navigatorのpushPage内でajax通信(jquery )は可能ですか?", "view_count": 1351 }
[ { "body": "OnsenUIで遷移した後もAjax通信をすることは可能です。\n\n上記コードではHTMLのBODYが読み込み完了した際にしかよばれません。 \n似たような回答を下記でも行っていますが、 \nOnsenUIの遷移完了時に呼ばれる`ons.ready`を使用する必要があります。\n\n「[タブバーの推移先のhtmlファイルでjsを実行する](https://ja.stackoverflow.com/questions/12982/)」\n\n```\n\n var module = ons.bootstrap('my-app', ['onsen']);\r\n module.controller('page1_controller', function($scope) {\r\n ons.ready(function() {\r\n var today = new Date();\r\n $(\"#target\").prepend(today.getDate());\r\n });\r\n });\n```\n\n```\n\n <!DOCTYPE HTML>\r\n <html lang=\"ja\" ng-app=\"my-app\"><!--モジュール名を指定-->\r\n <head>\r\n <script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js\"></script>\r\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js\"></script>\r\n </head>\r\n <body>\r\n <ons-page ng-controller=\"page1_controller\"><!--コントローラークラスを割り当て-->\r\n <ons-toolbar> <div id=\"target\" class=\"center\"> 日 </div> </ons-toolbar> \r\n </ons-page>\r\n </body>\r\n </html>\n```\n\nまた、Ajax通信でエラーが出ていると言う事ですが、エラー内容はどのような物でしょうか? \n詳細を記述して頂ければ、もっと詳しい回答が出来るかもしれません。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T06:27:38.943", "id": "16343", "last_activity_date": "2015-09-07T06:27:38.943", "last_edit_date": "2017-04-13T12:52:39.113", "last_editor_user_id": "-1", "owner_user_id": "7676", "parent_id": "16342", "post_type": "answer", "score": 2 }, { "body": "Ajaxの通信エラーの原因は、$.ajax のオプション指定が間違っているためではないかと思います。 \nどのようなリクエストを送っているのかわからないので、paramが正しいリクエストパラメータを表現したオブジェクトだとすると、\n\n```\n\n $.ajax({\n url: \"http://sample.com/app/sample.php\",\n type:\"POST\",\n dataType: \"json\", // <---- ※ここ\n data: param, // <---- ※ここ\n success:function(xml){\n $(\"#done\").html('<br><br>サーバーへの接続に成功');\n },\n error:function(){\n $(\"#err\").html('<br><br>サーバーへの接続に失敗しました');\n }\n });\n \n```\n\nと指定しないといけないのではないかと思います。ご確認ください。\n\nまた、「ページ遷移の度に取得」であれば、pageinitイベントではなく、ons-navigatorのpostpushイベントを使えば良いと思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T00:47:56.433", "id": "16359", "last_activity_date": "2015-09-08T00:47:56.433", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9888", "parent_id": "16342", "post_type": "answer", "score": 2 } ]
16342
null
16343
{ "accepted_answer_id": null, "answer_count": 2, "body": "ダブルタップでタップした箇所をズームする機能を実装したいのですが、scrollViewに乗せたUIImageViewをズームできません。 \n(参考サイトはこちらです。) \n<http://cocoadays.blogspot.jp/2010/09/3.html>\n\nimageViewをズームさせるにはどのようにすれば良いでしょうか?\n\n```\n\n - (void)viewDidLoad {\n scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];\n scrollView.frame = self.view.bounds;\n scrollView.backgroundColor = [UIColor blueColor];\n scrollView.conteimgViewntSize = CGSizeMake(imgView.bounds.size.width+100, imgView.bounds.size.height);\n scrollView.frame = CGRectMake(0,50,320,500);\n scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n scrollView.pagingEnabled = YES;\n scrollView.bouncesZoom = YES;\n scrollView.minimumZoomScale = 1.0;\n scrollView.maximumZoomScale = 2.0;\n scrollView.showsHorizontalScrollIndicator = NO;\n scrollView.showsVerticalScrollIndicator = NO;\n [self.view addSubview:scrollView];\n \n img =[UIImage imageNamed:[NSString stringWithFormat:@\"a.jpg\"]];\n imgView = [[UIImageView alloc]initWithImage:img];\n imgView.frame = CGRectMake(0, 0, self.view.frame.size.width, 448);\n imgView.userInteractionEnabled = YES;\n [scrollView addSubview:imgView];\n }\n \n - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event\n {\n UITouch* touch = [touches anyObject];\n if ([touch tapCount] == 2) {\n scrollView = (UIScrollView*)self.view;\n \n CGRect zoomRect;\n if (scrollView.zoomScale > 1.0) {\n zoomRect = scrollView.bounds;\n } else {\n zoomRect = [self zoomRectForScrollView:scrollView\n withScale:2.0\n withCenter:[touch locationInView:nil]];\n }\n [scrollView zoomToRect:zoomRect animated:YES];\n } \n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T08:41:52.843", "favorite_count": 0, "id": "16344", "last_activity_date": "2015-09-09T07:22:52.157", "last_edit_date": "2015-09-07T09:55:57.883", "last_editor_user_id": "7362", "owner_user_id": "11010", "post_type": "question", "score": -2, "tags": [ "ios", "objective-c", "xcode", "c", "iphone" ], "title": "「ダブルタップでUIImageViewをズーム」ができません", "view_count": 743 }
[ { "body": "ビューコントローラでUIScrollViewDelegateを継承してスクロールビューのdelegateと接続し、viewForZoomingInScrollView:メソッドでスクロールビューのコンテンツとなるUIImageViewを返す必要があると思います。\n\nまた、ダブルタップでズームインアウトするのはタッチイベントで書くよりもUITapGestureRecognizerを使って書いた方が、ほかのジェスチャにも対応したくなったときに楽できるんではないかと思います。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T09:59:05.043", "id": "16345", "last_activity_date": "2015-09-07T09:59:05.043", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7283", "parent_id": "16344", "post_type": "answer", "score": 0 }, { "body": "```\n\n - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event\n {\n UITouch* touch = [touches anyObject];\n if ([touch tapCount] == 2) {\n // scrollView = (UIScrollView*)self.view;\n // この行が間違い。\n UIScrollView *scrollView = self.scrollView; // こう修正。\n CGRect zoomRect;\n if (scrollView.zoomScale > 1.0) {\n zoomRect = scrollView.bounds;\n } else {\n zoomRect = [self zoomRectForScrollView:scrollView\n withScale:2.0\n withCenter:[touch locationInView:nil]];\n }\n [scrollView zoomToRect:zoomRect animated:YES];\n } \n }\n \n```\n\nほかにも間違いがあるかもしれませんが、とりあえず上記の修正をしないと、話が始まりません。\n\n* * *\n\nそもそも参考になさったリンク先の情報は、2010年のもの。約5年前では古いといわざるをえません。 \n最大の問題は、タップイベントの取得に`touchesEnded`メソッドを使っている点です。`UIScrollView`は、画面のフリックやパンに応じてスクロールするため、タッチイベントの処理が実装済みなので、Responder\nChainを伝って、タッチイベントが`UIScrollView`から`UIViewController`に伝播してきません。 \n現時点で主流と考えられる方法は、`UITapGestureRecognizer`クラスを使って、ダブルタップイベントを取得する方法です。 \n以下サンプルコードです。320×320の`Scroll Viewに、おなじく320×320の`Image\nView`を乗せ、ダブルタップで、2倍に拡大と、等倍に戻るを繰り返します。\n\n_ViewController.h_\n\n```\n\n #import <UIKit/UIKit.h>\n \n @interface ViewController : UIViewController <UIScrollViewDelegate>\n // UIScrollViewDelegateプロトコルを実装 注1\n \n @end\n \n```\n\n_ViewController.m_\n\n```\n\n #import \"ViewController.h\"\n \n @interface ViewController ()\n \n @property (nonatomic) UIScrollView *scrollView; // Scroll View\n @property (nonatomic) UIImageView *imageView; // Image View\n \n @end\n \n @implementation ViewController\n \n - (void)viewDidLoad {\n [super viewDidLoad];\n \n self.scrollView = [[UIScrollView alloc] initWithFrame: CGRectMake(0.0, 40.0, 320.0, 320.0)];\n // Tap Gesture Recognizerインスタンスを生成。\n UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget: self action: @selector(doubleTap:)];\n tapGestureRecognizer.numberOfTapsRequired = 2;\n // ダブルタップだけに反応する。(4連続タップしたら、2回反応しますけど)\n [self.scrollView addGestureRecognizer: tapGestureRecognizer];\n // Tap Gesture RecognizerをScroll Viewに組み込む。\n self.scrollView.delegate = self; // 注1\n self.scrollView.maximumZoomScale = 2.0;\n self.scrollView.minimumZoomScale = 0.5;\n // 拡大・縮小の限界値を設定\n [self.view addSubview: self.scrollView];\n \n self.imageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @\"image.png\"]];\n // Image Viewを生成\n [self.scrollView addSubview: self.imageView];\n }\n \n // ダブルタップで呼ばれるアクションメソッド\n - (void)doubleTap: (UITapGestureRecognizer *)recognizer {\n // ダブルタップが終わったら\n if (recognizer.state == UIGestureRecognizerStateEnded) {\n // Scroll Viewの拡大率が等倍なら\n if (self.scrollView.zoomScale < 1.5) {\n CGPoint tappedPoint = [recognizer locationInView: self.imageView];\n // タップ位置を中心にして拡大するよう、タップ位置を取得\n [self.scrollView zoomToRect: CGRectMake(tappedPoint.x / 2.0, tappedPoint.y / 2.0, 160.0, 160.0) animated: YES];\n // 拡大\n } else { // 倍だったら\n [self.scrollView zoomToRect: CGRectMake(0.0, 0.0, 320.0, 320.0) animated: YES];\n // 等倍に戻る\n }\n }\n }\n \n // Scroll View Delegate 注1\n - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {\n return self.imageView;\n }\n \n @end\n \n```\n\n**注1:** \n`UIScrollView`で、ズームを有効にするには、ズームの対象の`UIView`(のサブクラス)を指定しなければいけません。指定の仕方は、Delegateメソッド`viewForZoomingInScrollView:`を使います。なので、`Scroll\nView`のDelegate先を設定する必要があります。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T10:06:42.400", "id": "16346", "last_activity_date": "2015-09-09T07:22:52.157", "last_edit_date": "2015-09-09T07:22:52.157", "last_editor_user_id": "7362", "owner_user_id": "7362", "parent_id": "16344", "post_type": "answer", "score": 1 } ]
16344
null
16346
{ "accepted_answer_id": "16354", "answer_count": 2, "body": "ダメ元で元号を`Date.parse`で変換できるかと思い試してみたところ\n\n```\n\n Date.parse(\"平成26年10月27日\")\n # => Sat, 26 Sep 2015\n \n```\n\nになりました。”平成”を抜いても結果は同じなのは確認したのと`26`が使われているのはわかるのですが年と月に関してはどうしてこのような結果になるのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T14:58:28.423", "favorite_count": 0, "id": "16350", "last_activity_date": "2015-09-07T23:40:26.837", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3271", "post_type": "question", "score": 1, "tags": [ "ruby" ], "title": "Date.parseの解析について Date.parse(\"26年10月27日\") #=> Sat, 26 Sep 2015", "view_count": 494 }
[ { "body": "ruby の Date.parse は iso8601 と jisx0301 をサポートしています。 \n詳しくは jisx0301 の規格書を参照下さい。以下でも参考になります。\n\n<http://wiki.suikawiki.org/n/JISX0301>\n\niso8601 形式であれば YY-MM-DD が扱えるフォーマットの一つなので\n\n```\n\n p Date.parse(\"15-10-27\")\n \n```\n\nは\n\n```\n\n 2015-10-27\n \n```\n\nとして扱われます。また JISX0301 では S や H 等の年号記号が接頭で付き SYY.MM.DD が扱えるフォーマットの一つなので\n\n```\n\n p Date.parse(\"H26.10.27\")\n \n```\n\nは\n\n```\n\n 2014-10-27\n \n```\n\nとして扱われます。和暦の和名を扱いたいならば予め `平成` を `H` に置換するなどが必要かと思います。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T15:26:59.723", "id": "16353", "last_activity_date": "2015-09-07T23:40:26.837", "last_edit_date": "2015-09-07T23:40:26.837", "last_editor_user_id": "440", "owner_user_id": "440", "parent_id": "16350", "post_type": "answer", "score": 4 }, { "body": "最初の数字である 26 を日として扱った結果だと思います。年と月に関しては、今が 2015年9月だからそれが使われたのでしょう。\n\n```\n\n Date.parse(\"26\")' \n #=> #<Date: 2015-09-26 ((2457292j,0s,0n),+0s,2299161j)>\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T15:57:59.147", "id": "16354", "last_activity_date": "2015-09-07T15:57:59.147", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3249", "parent_id": "16350", "post_type": "answer", "score": 4 } ]
16350
16354
16353
{ "accepted_answer_id": "16394", "answer_count": 2, "body": "ハードディスクが 2 個あり、A と B だとします。\n\n 1. AとBのそれぞれに CentOS 7 を入れて、AとBどちらからでも起動できるようにする\n 2. AからB、BからAのように異なるパーティションのデータを見えるようにする\n\nどうすればよいですか?", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T14:59:45.263", "favorite_count": 0, "id": "16351", "last_activity_date": "2015-09-08T14:57:22.830", "last_edit_date": "2015-09-07T23:17:12.587", "last_editor_user_id": "7676", "owner_user_id": "12221", "post_type": "question", "score": 1, "tags": [ "linux", "centos" ], "title": "CentOS 7 のパーティションの分け方", "view_count": 1872 }
[ { "body": "RAID1的なものを求めているのでは、ないとして。\n\nAに、CentOSをinstallする。 \nBにも、CentOSをinstallする。\n\nで、2つめのCentOSをインストールすれば、普通は、boot selectorのGRUBのメニューに、boot対象の2つのCentOSが、載っている。\n\nで、普通は、FSの問題はないから、それぞれの/etc/fstab\nの記述をいじってやれば、Aでbootしても、BのFSはmountされてるし、Bでbootしても、AのFSは、mountできる。\n\nしかし、こういうシステムは、あんまり感心しない。というのも、今、Aでbootしているのか、Bでbootしているのか、間違えて、消してはいけないファイルを消したりしかねないので。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T08:00:36.700", "id": "16376", "last_activity_date": "2015-09-08T08:00:36.700", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "75", "parent_id": "16351", "post_type": "answer", "score": 0 }, { "body": "> AとBのそれぞれに CentOS 7 を入れて、AとBどちらからでも起動できるようにする\n\nEFI が前提ですが EFI ブートエントリーに A,B それぞれの ブートローダを登録すれば マザーボードの 起動デバイスの選択で A, B\nどちらからでも起動できます。以下 Disk A = sda、Disk B = sdb とします。\n\nsda に OS-A をインストール\n\n```\n\n インストール先\n /boot sda2\n /boot/efi sda1\n / sda の好きなところに (※1)\n swap sda の好きなところに (※1)\n \n```\n\nsdb に OS-B をインストール\n\n```\n\n インストール先\n /boot sdb2\n /boot/efi sdb1\n / sdb の好きなところに (※2)\n swap sdb の好きなところに (※2)\n \n```\n\n(※1) 今回は sda 上に Logical Volume「centos7a」を作成 \n(※2) 今回は sdb 上の Logical Volume「centos7b」を作成\n\nインストールしたOSにログインして EFI Boot Manager のエントリを確認\n\n```\n\n # efibootmgr -v\n BootCurrent: 0004\n BootOrder: 0004,0005,0000,0001,0002,0003\n Boot0000* EFI DVD/CDROM ACPI(a0341d0,0)PCI(1,1)ATAPI(1,0,0)\n Boot0001* EFI Hard Drive ACPI(a0341d0,0)PCI(d,0)SATA(0,0,0)\n Boot0002* EFI Hard Drive 1 ACPI(a0341d0,0)PCI(d,0)SATA(1,0,0)\n Boot0003* EFI Internal Shell MM(b,3fc4f000,3ffbefff)FvFile(7c04a583-933e-4f1c-ad65-e05268d0b4d1)\n Boot0004* CentOS HDD(1,800,64000,bd4164f0-88fc-4d71-b3ee-64b246027aab)File(\\EFI\\centos\\shim.efi)\n \n```\n\nデフォルトのエントリを消して「CentOS7 A」と「CentOS7 B」というエントリを作ります。\n\n```\n\n # efibootmgr -b 4 -B ← 0004 のエントリを消す\n # efibootmgr -c -d /dev/sda -p 1 -l '\\EFI\\centos\\shim.efi' -L 'CentoOS7 A'\n # efibootmgr -c -d /dev/sdb -p 1 -l '\\EFI\\centos\\shim.efi' -L 'CentoOS7 B'\n \n```\n\n最終的に次のようになります。\n\n```\n\n # efibootmgr -v\n BootCurrent: 0004\n BootOrder: 0005,0004,0000,0001,0002,0003\n Boot0000* EFI DVD/CDROM ACPI(a0341d0,0)PCI(1,1)ATAPI(1,0,0)\n Boot0001* EFI Hard Drive ACPI(a0341d0,0)PCI(d,0)SATA(0,0,0)\n Boot0002* EFI Hard Drive 1 ACPI(a0341d0,0)PCI(d,0)SATA(1,0,0)\n Boot0003* EFI Internal Shell MM(b,3fc4f000,3ffbefff)FvFile(7c04a583-933e-4f1c-ad65-e05268d0b4d1)\n Boot0004* CentOS7 A HDD(1,800,64000,e2f4a240-71e1-45da-9822-1dc34e42247f)File(\\EFI\\centos\\shim.efi)\n Boot0005* CentOS7 B HDD(1,800,64000,bd4164f0-88fc-4d71-b3ee-64b246027aab)File(\\EFI\\centos\\shim.efi)\n \n```\n\n再起動して、マザーボードの 起動デバイスを選ぶメニューを開きます。 \nマザーボードによって 操作方法が違うのでマニュアル等で確認してください。 \n( F8とかF10、F12あたりのキーだと思います )\n\n起動デバイスの一覧に `efibootmgr` で登録したエントリが表示されるので \n`CentOS7 A` か `CentOS7 B` を選択して OS(と言うかそれぞれのGrub)を起動します。\n\n> AからB、BからAのように異なるパーティションのデータを見えるようにする\n\nOS-A から B のデバイスをマウントします。\n\n 1. マウントポイトを作成 \n * `mkdir /centos7b`\n 2. B の 論理ボリューム または パーティションをマウント \n * `mount -t xfs /dev/mapper/centos7b-root /centos7b`\n 3. 起動時に自動マウントしたいなら /etc/fstab に記述 \n * `vi /etc/fstab`\n\n> /dev/mapper/centos7b-root /centos7b xfs defaults 0 0\n\nOS-B から A をマウントします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T14:57:22.830", "id": "16394", "last_activity_date": "2015-09-08T14:57:22.830", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "5008", "parent_id": "16351", "post_type": "answer", "score": 0 } ]
16351
16394
16376
{ "accepted_answer_id": null, "answer_count": 0, "body": "onsen-uiの`<ons-\npage>`を使用すると、ページが1画面以上ある場合もスクロールバーが表示されないのですが、表示させるにはどのような方法があるでしょうか?\n\n※onsen-uiをスマホ/PCのレスポンシブで製作を行っております。 \nスマホの場合はスクロールバーがなくてもよいのですが、PCの場合は、ユーザビリティの観点でスクロールバーを表示させたいと考えております。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-07T15:23:38.443", "favorite_count": 0, "id": "16352", "last_activity_date": "2015-09-07T20:11:15.157", "last_edit_date": "2015-09-07T20:11:15.157", "last_editor_user_id": "7676", "owner_user_id": "12234", "post_type": "question", "score": 1, "tags": [ "onsen-ui" ], "title": "<ons-page>でのスクロールバーの表示", "view_count": 748 }
[]
16352
null
null
{ "accepted_answer_id": "16364", "answer_count": 2, "body": "```\n\n var gazoui:[UIImage]!\n var gazouiii:UIImage\n gazouiii = UIImage(named: \"m1.gif\")!\n gazoui[1] = UIImage(named: \"m1.gif\")!\n \n```\n\nm1.gifはプロジェクトに入ってます \nエンコードはできるんですがすぐにシミュレーターが落ちます \n`gazouiii` のほうの代入はできていて `gazouiii` は `nil` ではなくなるんですが`gazoui[1]` のほうで \"fatal\nerror: unexpectedly found nil while unwrapping an Optional value\" のエラーで落ちます \nなぜですか?\n\nfor文で配列に一気に連番の画像をUIImageで入れるのが目的です", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T01:37:49.153", "favorite_count": 0, "id": "16361", "last_activity_date": "2015-09-08T08:20:10.643", "last_edit_date": "2015-09-08T02:34:52.083", "last_editor_user_id": "7831", "owner_user_id": "10854", "post_type": "question", "score": -2, "tags": [ "swift", "uiimage" ], "title": "Swiftで配列にUIImage!を代入→nilだから代入できない?", "view_count": 4583 }
[ { "body": "gazouiがnilになってるのが原因ではないでしょうか? \nこれが配列を参照するようにすれば、正常に動作すると思われます。\n\n```\n\n var gazoui:[UIImage]! = Array<UIImage>(count: 2, repeatedValue: UIImage())\n var gazouiii:UIImage\n gazouiii = UIImage(named: \"m1.gif\")!\n gazoui[1] = UIImage(named: \"m1.gif\")!\n \n```", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T02:17:42.053", "id": "16363", "last_activity_date": "2015-09-08T02:17:42.053", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7459", "parent_id": "16361", "post_type": "answer", "score": 1 }, { "body": "オブジェクトの宣言とイニシアライズの基礎について、まず説明します。 \n非Optional型と、Optional型では、イニシアライズのしかたが異なります。\n\n```\n\n var images: [UIImage]?\n // var images: [UIImage]! でもおなじ\n println(images == nil)\n \n```\n\n出力は`true`になります。Optional型を宣言すると、初期値がに`nil`になります。対して非Optional型は、宣言しても変数には`nil`は入らず、「処理が完結していない」状態になります。\n\n```\n\n var images: [UIImage] // このままでは未完のコード\n images = [UIImage]()\n \n```\n\n* * *\n```\n\n import UIKit\n \n var images: [UIImage] = [UIImage]() // (1)\n let image1 = UIImage(named: \"picture1.png\")\n images.append(image1) // (2)\n let image2 = UIImage(named: \"picture2.png\")\n images.append(image2)\n \n```\n\n非Optional型なら、オブジェクトが`nil`でないことが保証されますので、`nil`のオブジェクトを操作することで起きるエラーを、心配しなくてよくなります。(1) \n配列に要素を追加するには、メソッド`append()`を使うと便利。(2)\n\n> エンコードはできるんですがすぐにシミュレーターが落ちます\n\n「エンコード」じゃなくて **ビルド** といいますね。", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T02:28:48.197", "id": "16364", "last_activity_date": "2015-09-08T08:20:10.643", "last_edit_date": "2015-09-08T08:20:10.643", "last_editor_user_id": "7362", "owner_user_id": "7362", "parent_id": "16361", "post_type": "answer", "score": 0 } ]
16361
16364
16363
{ "accepted_answer_id": "16395", "answer_count": 1, "body": "調べたんですけど調べ方が悪いのか出てこなくて \nMonacaデバッガーでiosのアプリをステップ実行したいのですが、できますでしょうか。\n\nAndroidのほうは下の記事でやれることがわかっているのですが \n<http://blog.asial.co.jp/1333>\n\n大変申し訳ございませんが、よろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T05:32:49.117", "favorite_count": 0, "id": "16366", "last_activity_date": "2015-09-08T15:13:54.087", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "12225", "post_type": "question", "score": 0, "tags": [ "monaca" ], "title": "Monacaデバッガーの機能について", "view_count": 218 }
[ { "body": "カスタムビルド版デバッガーが必要ですが、iOS版もsafariを用いたUSBデバッグが可能みたいです。下記の記事をお読みください。 \n<http://docs.monaca.mobi/ja/manual/debugger/debug/#monaca-debugger-with-usb-\ndebugging>", "comment_count": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T15:13:54.087", "id": "16395", "last_activity_date": "2015-09-08T15:13:54.087", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8532", "parent_id": "16366", "post_type": "answer", "score": 0 } ]
16366
16395
16395
{ "accepted_answer_id": "16369", "answer_count": 1, "body": "プロトコルを定義してそのプロトコルに準拠したクラスの配列を定義したいのですが、良い書き方はありますでしょうか?\n\nプロトコルの定義は以下のような実装で、複数のプロパティとメソッドが定義されています。\n\n```\n\n protocol ProtocolA {\n var property: AnyObject { get }\n func someMethod() \n }\n \n```\n\n実際にはこのような形でViewにプロトコルに準拠したクラスの配列を保持したいです。\n\n```\n\n class View: UIView {\n var objects ← これをProtocolAに準拠したクラスの配列にしたい\n }\n \n```\n\nこのような形も考えましたが、Storyboard上での使用も考え諦めました。\n\n```\n\n class View<T: ProtocolA>: UIView {\n var objects = [T]()\n }\n \n```\n\n使用用途としては\n\n```\n\n class View: UIView {\n func someMethod<T: ProtocolA>(objects: [T]) {\n // このobjectsをプロパティとして保持したい\n } \n }\n \n```\n\nジェネリクスを使用したプログラミング経験があまりなく不可解な説明があるかもしれませんが、よろしくおねがいします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T05:47:30.730", "favorite_count": 0, "id": "16367", "last_activity_date": "2019-06-29T08:53:08.723", "last_edit_date": "2019-06-29T08:53:08.723", "last_editor_user_id": "9008", "owner_user_id": "12242", "post_type": "question", "score": 2, "tags": [ "swift", "ios", "ジェネリクス" ], "title": "Swiftでプロトコルに準拠したクラスの配列を定義したい", "view_count": 1664 }
[ { "body": "普通に、ProtocolAの配列を使う形でどうでしょうか? \n(Xcode7 beta6で動作を確認)\n\n```\n\n protocol ProtocolA {\n var property: AnyObject { get }\n func someMethod()\n }\n \n class View: UIView {\n // var objects ← これをProtocolAに準拠したクラスの配列にしたい\n var objects = [ProtocolA]() // ProtocolAの配列を作成\n \n func someMethod(objects: [ProtocolA]) {\n // このobjectsをプロパティとして保持したい\n self.objects = objects // ProtocolAの配列をコピー\n }\n \n // MARK: - 以下、コメントへの回答として追加\n \n /// 保存したプロパティをメソッド引数として渡す\n func execOtherMethod() {\n if let obj = objects.last {\n otherMethod(obj)\n }\n }\n \n /// Protocolを直接使用する\n func otherMethod(object: ProtocolA) {\n object.someMethod()\n }\n \n /// Genericsを使うパターン(コンパイルエラーになる)\n // func otherMethod<T: ProtocolA>(object: T) {\n // object.someMethod()\n // }\n \n }\n \n /// ProtocolAに準拠したクラス\n class ClassA: ProtocolA {\n var property: AnyObject { return \"A\" }\n func someMethod() { print(\"A\") }\n }\n \n // someMethodを呼び出し\n let vi = View()\n let obj = ClassA()\n vi.someMethod([obj])\n \n // Protocolを引数に使うテスト\n vi.execOtherMethod()\n \n```", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T06:31:26.987", "id": "16369", "last_activity_date": "2015-09-09T02:11:27.760", "last_edit_date": "2015-09-09T02:11:27.760", "last_editor_user_id": "7459", "owner_user_id": "7459", "parent_id": "16367", "post_type": "answer", "score": 1 } ]
16367
16369
16369
{ "accepted_answer_id": null, "answer_count": 2, "body": "以下のinput要素をボタンを押すと要素が増えるといった仕組みを作りたいと思っています。 \nただ、新しく生成した要素のnameはtext_title1やtext_html1といったユニークなものにしたいです。 \nどのようにすればうまくいきますでしょうか。 \n詳しい方、ご教示下さい。宜しくお願い致します。\n\n```\n\n <li><input type=\"text\" placeholder=\"タイトル\" name=\"text_title\" style=\"width:400px;height:20px;margin-bottom:10px;\"></li>\n <li><textarea placeholder=\"内容\" name=\"text_html\" style=\"width:400px;height:300px;\"></textarea></li>\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T06:29:09.470", "favorite_count": 0, "id": "16368", "last_activity_date": "2015-09-09T11:11:36.130", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8619", "post_type": "question", "score": 1, "tags": [ "javascript", "jquery", "html" ], "title": "formの要素を増やして、ユニークなnameを付ける", "view_count": 428 }
[ { "body": "JavaScriptとhtmlで書いてみました。 \nbuttonを押すと要素が追加されていき、nameもユニークです。\n\n```\n\n var button = document.getElementById(\"button\");\r\n var number = 1; //ユニークなnameのための数字\r\n var list = document.getElementById(\"list\"); // li要素を追加するul要素を取得\r\n \r\n button.onclick = function () { // buttonをクリックしたらこの関数が呼ばれる\r\n var li = document.createElement(\"li\"); //<input type=\"text\">を入れるli要素を生成\r\n var li2 = document.createElement(\"li\"); //<input type=\"textarea\">を入れるli要素を生成\r\n var input_text = document.createElement(\"input\"); //inputの生成\r\n var input_textarea = document.createElement(\"input\");\r\n \r\n /********** inputのいろいろな属性の設定 ***********/ \r\n input_text.type = \"text\"; \r\n input_text.placeholder = \"タイトル\";\r\n input_text.name = \"text_title\" + String(number); //numberを追加してnameをユニークにする\r\n input_text.style.width = \"400px\";\r\n input_text.style.height = \"20px\";\r\n input_text.style.marginBottom = \"10px\";\r\n \r\n input_textarea.type = \"textarea\";\r\n input_textarea.placeholder = \"内容\";\r\n input_textarea.name = \"text_html\" + String(number); //numberを追加してnameをユニークにする\r\n input_textarea.style.width = \"400px\";\r\n input_textarea.style.height = \"300px\";\r\n \r\n /********** 属性の設定終わり **********/\r\n \r\n li.appendChild(input_text); //liにinput_textを追加\r\n li2.appendChild(input_textarea);\r\n \r\n list.appendChild(li); //bodyにliを追加\r\n list.appendChild(li2);\r\n \r\n number++; //numberに1を足す\r\n \r\n }\n```\n\n```\n\n <!DOCTYPE html>\r\n <html lang=\"ja\">\r\n <head>\r\n <meta charset=\"utf-8\">\r\n <title>add Input Element</title>\r\n </head>\r\n <body>\r\n <button id=\"button\">要素を追加</button>\r\n <ul id=\"list\">\r\n </ul>\r\n </body>\r\n </html>\n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T11:56:35.237", "id": "16385", "last_activity_date": "2015-09-09T11:11:36.130", "last_edit_date": "2015-09-09T11:11:36.130", "last_editor_user_id": "5246", "owner_user_id": "5246", "parent_id": "16368", "post_type": "answer", "score": 0 }, { "body": "タグにjQueryがあるので、その例です。`.append()`で親要素`ul`の中に`li`を追加します。\n\n```\n\n var number = 1;\n \n $(function(){\n $(\"#button\").click(function(){\n $(\"#ul\").append('<li><input name=\"text_title' + String(number) + '\" type=\"text\" placeholder=\"タイトル\" style=\"width:400px;height:20px;margin-bottom:10px;\"></li>');\n $(\"#ul\").append('<li><textarea name=\"text_html' + String(number) + '\" placeholder=\"内容\" style=\"width:400px;height:300px;\"></textarea></li>');\n number++;\n });\n });\n \n```", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T12:33:09.260", "id": "16386", "last_activity_date": "2015-09-08T12:33:09.260", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "2238", "parent_id": "16368", "post_type": "answer", "score": 1 } ]
16368
null
16386
{ "accepted_answer_id": null, "answer_count": 1, "body": "iOSアプリでログインフォームを作成したいと思っています。 \n作成したいイメージとしては以下の画面です。 \n[![画像の説明をここに入力](https://i.stack.imgur.com/Ccs5u.png)](https://i.stack.imgur.com/Ccs5u.png)\n\nこの「メールアドレス」と「パスワード」の入力部分をTableViewのContents:Static cellsで作成しようとしています。 \n(1) UITableViewが元のclassでなければならない \n(2) UITableViewでは[ログイン]ボタンを置くことも難しい(Constraintsが設定できない) \n(3) TableViewの横幅が縮められない。 \n(4) そもそもTableViewのContents:Static cellsで作ったほうがいいのかがわからない。\n\n上記の疑問があります。(4)が違う方法がいいということであればその方法をご教示お願いしたく。 \n(4)がTableViewのContents:Static cellsで作った方がいいということであれば(2)(3)の手法を教えていただけると幸いです。\n\nよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T07:06:25.367", "favorite_count": 0, "id": "16371", "last_activity_date": "2015-09-08T07:41:41.297", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8593", "post_type": "question", "score": -1, "tags": [ "swift", "storyboard", "uitableview" ], "title": "iOSアプリで、ログインフォーム作成", "view_count": 1242 }
[ { "body": "通常この用途でテーブルビューは使わない\n\nこの場合\n\n * UIScrollView \n * UIImageView(ロゴ)\n * UITextField(メールアドレス)\n * UITextField(パスワード)\n * UIButton(ログイン)\n\nのようなビュー構造とする\n\nなお、スクロールビューをスーパービューとするのはキーボードの表示に合わせて表示位置を調整する為である", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T07:41:41.297", "id": "16374", "last_activity_date": "2015-09-08T07:41:41.297", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "parent_id": "16371", "post_type": "answer", "score": 1 } ]
16371
null
16374
{ "accepted_answer_id": null, "answer_count": 1, "body": "タイトルだけではイメージがつかないと思いますので画像を表示します。 \n[![サブウィンドウイメージ](https://i.stack.imgur.com/LL3Yn.png)](https://i.stack.imgur.com/LL3Yn.png)\n\n実装イメージはインフォメーションアイコンをタップすると、画像のサブウィンドウを \n表示し、カルーセルでアプリの操作説明を表示させようと考えております。 \nまた、右上の×アイコンのタップでサブウィンドウが消えます。\n\nネイティブでは上記UIを実装したことがあるのですが、ONSEN UIで実装可能でしょうか? \nこのような実装方法をご存知でしたらご教示のほどお願いします。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T07:31:03.787", "favorite_count": 0, "id": "16373", "last_activity_date": "2015-09-08T10:16:37.847", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9561", "post_type": "question", "score": 1, "tags": [ "javascript", "onsen-ui", "angularjs", "cordova" ], "title": "ONSEN UIでカルーセルのサブウィンドウを表示したい。", "view_count": 513 }
[ { "body": "`ons-dialog`と組み合わせるならこんな感じですかね。 \nダイアログのスタイルは`ons-dialog`配下に`<div\nclass=\"dialog\">`で設定されるみたいなので、このやり方だとスタイルの調整はちょっと面倒かもしれないです(一応サンプルは大きさと大きさ変更に伴う位置だけ変更しています)。\n\n```\n\n ons.bootstrap()\r\n \r\n .controller('DialogController', function($scope) {\r\n $scope.dialogs = {};\r\n \r\n $scope.show = function(dlg) {\r\n if (!$scope.dialogs[dlg]) {\r\n ons.createDialog(dlg).then(function(dialog) {\r\n $scope.dialogs[dlg] = dialog;\r\n dialog.show();\r\n });\r\n }\r\n else {\r\n $scope.dialogs[dlg].show();\r\n }\r\n }\r\n });\n```\n\n```\n\n ons-dialog.sub .dialog {\r\n top: 50%;\r\n left: 50%;\r\n width: 80%;\r\n height: 80%;\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>\r\n <ons-toolbar>\r\n <div class=\"center\">Dialog</div>\r\n </ons-toolbar>\r\n <ons-list ng-controller=\"DialogController\">\r\n <ons-list-item ng-click=\"show('login.html')\" modifier=\"tappable\">\r\n Show SubWindow\r\n </ons-list-item>\r\n </ons-list>\r\n </ons-page>\r\n \r\n <ons-template id=\"login.html\">\r\n <ons-dialog var=\"dialog\" cancelable class=\"sub\">\r\n <ons-carousel swipeable overscrollable auto-scroll fullscreen var=\"carousel\">\r\n <ons-carousel-item style=\"background-color: gray;\">\r\n <div class=\"item-label\">GRAY</div>\r\n </ons-carousel-item>\r\n <ons-carousel-item style=\"background-color: #085078;\">\r\n <div class=\"item-label\">BLUE</div>\r\n </ons-carousel-item>\r\n <ons-carousel-item style=\"background-color: #373B44;\">\r\n <div class=\"item-label\">DARK</div>\r\n </ons-carousel-item>\r\n <ons-carousel-item style=\"background-color: #D38312;\">\r\n <div class=\"item-label\">ORANGE</div>\r\n </ons-carousel-item>\r\n </ons-carousel>\r\n </ons-dialog> \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": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T08:23:28.523", "id": "16377", "last_activity_date": "2015-09-08T10:16:37.847", "last_edit_date": "2015-09-08T10:16:37.847", "last_editor_user_id": "3516", "owner_user_id": "3516", "parent_id": "16373", "post_type": "answer", "score": 1 } ]
16373
null
16377
{ "accepted_answer_id": null, "answer_count": 2, "body": "ons-tabbarをアプリケーション下部もしくは最上部へ配置する場合は、ons-tabbarタグは一つ書けばアプリケーション全体で表示されるかと思います。\n\nこのons-tabbarを上段ツールーバー下へ配置する場合はons-\npage内に書く必要があるため、非常に冗長的なコードになってしまいますし、タブ状態の集中管理が出来ません。\n\nIonicでのタブバー上段配置のような形にしたいのですが、OnsenUIではons-page毎にons-\ntabbarを書く以外ツールバー下へ表示する方法はないのでしょうか?\n\n現状のHTML構造はTab barテンプレートベースになっており、body > ons-tabbar > ons-tab > ons-navigator >\nons-page > ons-toolbarといった構造です。", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T07:50:21.307", "favorite_count": 0, "id": "16375", "last_activity_date": "2015-09-09T02:50:00.630", "last_edit_date": "2015-09-09T00:15:00.613", "last_editor_user_id": "10563", "owner_user_id": "10563", "post_type": "question", "score": 1, "tags": [ "onsen-ui" ], "title": "ons-tabbarを冗長なコードを書かず上部ツールバー下へ配置したい", "view_count": 949 }
[ { "body": "OnsenUIにそのようなオプションは用意されていませんが、CSSを適当に指定すれば可能です。 \n以下はons-toolbarをons-tabbarの外に置くパターンです。\n\n```\n\n ons.bootstrap();\n```\n\n```\n\n .tab-bar {\r\n top: 44px;\r\n border-top: none;\r\n border-bottom: 1px solid rgba(0,0,0,0);\r\n }\r\n \r\n .tab-bar__content {\r\n top: 93px !important;\r\n bottom: 0 !important;\r\n }\n```\n\n```\n\n <link href=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.8/build/css/onsen-css-components.css\" rel=\"stylesheet\"/>\r\n <link href=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.8/build/css/onsenui.css\" rel=\"stylesheet\"/>\r\n <script src=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.8/build/js/angular/angular.min.js\"></script>\r\n <script src=\"https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.8/build/js/onsenui.min.js\"></script>\r\n \r\n <ons-toolbar>\r\n <div class=\"center\">My App</div>\r\n </ons-toolbar>\r\n \r\n <ons-tabbar>\r\n <ons-tab page=\"nav.html\" icon=\"home\" label=\"Home\" active=\"true\"></ons-tab>\r\n <ons-tab page=\"page2.html\" icon=\"camera\" label=\"Camera\"></ons-tab>\r\n <ons-tab page=\"page3.html\" icon=\"gear\" label=\"Settings\"></ons-tab>\r\n </ons-tabbar>\r\n \r\n <ons-template id=\"nav.html\">\r\n <ons-navigator page=\"page1.html\" var=\"nav\"></ons-navigator>\r\n </ons-template>\r\n \r\n <ons-template id=\"page1.html\">\r\n <h1>Page1</h1>\r\n <ons-button ng-click=\"nav.pushPage('page1-2.html')\">Push</ons-button>\r\n </ons-template>\r\n \r\n <ons-template id=\"page1-2.html\">\r\n <h1>Page1-2</h1>\r\n <ons-button ng-click=\"nav.popPage()\">Pop</ons-button>\r\n </ons-template>\r\n \r\n <ons-template id=\"page2.html\">\r\n <h1>Page2</h1>\r\n </ons-template>\r\n \r\n <ons-template id=\"page3.html\">\r\n <h1>Page3</h1>\r\n </ons-template>\n```", "comment_count": 2, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T11:53:36.820", "id": "16384", "last_activity_date": "2015-09-08T11:53:36.820", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8532", "parent_id": "16375", "post_type": "answer", "score": 2 }, { "body": "`ons-page`の配下に`ons-tabbar`を書いてしまっていますが、こんな感じにすれば`ons-\ntabbar`の記述は1カ所でいけるかなと思います。\n\n * あるタブの中で画面遷移が頻繁に発生する\n * 選択したタブによってツールバーの内容が大きく異なる\n\nといった場合にはこれだと難しいかもしれません。\n\n```\n\n ons.bootstrap()\r\n .controller('MainCtrl', [\"$scope\", function($scope) {\r\n $scope.show = false;\r\n $scope.title = \"Home\";\r\n $scope.test = function() {\r\n $scope.title = \"Tab \" + tab.getActiveTabIndex();\r\n };\r\n $scope.pushFeed = function() {\r\n $scope.show = true;\r\n $scope.title = \"Feed\";\r\n }\r\n $scope.popFeed = function() {\r\n $scope.show = false;\r\n $scope.title = \"Home\";\r\n }\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=\"MainCtrl\">\r\n <ons-toolbar>\r\n <div class=\"left\">\r\n <ons-toolbar-button ng-click=\"navi.popPage()\" ng-if=\"show\">Back</ons-toolbar-button>\r\n </div>\r\n <div class=\"center\">{{title}}</div>\r\n </ons-toolbar>\r\n <ons-tabbar position=\"top\" ons-postchange=\"test()\" var=\"tab\">\r\n <ons-tab page=\"home.html\" label=\"Home\" icon=\"ion-home\" active=\"true\"></ons-tab>\r\n <ons-tab page=\"comments.html\" label=\"Comments\" icon=\"ion-chatbox-working\"></ons-tab>\r\n <ons-tab page=\"tags.html\" label=\"Tags\" icon=\"ion-ios-pricetag\"></ons-tab>\r\n <ons-tab page=\"settings.html\" label=\"Settings\" icon=\"ion-ios-cog\"></ons-tab>\r\n </ons-tabbar>\r\n </ons-page>\r\n \r\n <ons-template id=\"home.html\">\r\n <ons-navigator var=\"navi\" ons-prepush=\"pushFeed()\" ons-prepop=\"popFeed()\">\r\n <p style=\"padding-top: 20px; color: #999; text-align: center\">\r\n Home Page Contents<br />\r\n </p>\r\n <div style=\"padding-top: 10px; text-align: center\">\r\n <ons-button ng-click=\"navi.pushPage('feed.html')\">Push</ons-button>\r\n </div>\r\n </ons-navigator>\r\n </ons-template>\r\n \r\n <ons-template id=\"comments.html\">\r\n <p style=\"padding-top: 20px; color: #999; text-align: center\">\r\n Comments Page Contents\r\n </p>\r\n </ons-template>\r\n \r\n <ons-template id=\"tags.html\">\r\n <p style=\"padding-top: 20px; color: #999; text-align: center\">\r\n Tags Page Contents\r\n </p>\r\n </ons-template>\r\n \r\n <ons-template id=\"settings.html\">\r\n <p style=\"padding-top: 20px; color: #999; text-align: center\">\r\n Settings Page Contents\r\n </p>\r\n </ons-template>\r\n \r\n <ons-template id=\"feed.html\">\r\n <p style=\"padding-top: 20px; color: #999; text-align: center\">\r\n Feed Page Contents\r\n </p>\r\n <div style=\"padding-top: 10px; text-align: center\">\r\n <ons-button ng-click=\"navi.popPage()\">Pop</ons-button>\r\n </div>\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": 1, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T14:48:06.810", "id": "16391", "last_activity_date": "2015-09-09T02:50:00.630", "last_edit_date": "2015-09-09T02:50:00.630", "last_editor_user_id": "3516", "owner_user_id": "3516", "parent_id": "16375", "post_type": "answer", "score": 3 } ]
16375
null
16391
{ "accepted_answer_id": null, "answer_count": 0, "body": "来年から必須となるためIPv6の確認をしようとmac OSX 10.11 beta8にて \nCreate NAT64 Networkの設定にし、wifiでiPhone5S(iOS8.4)を繋げました。\n\niPhone側の設定>Wi-Fi>で確認したところ \nDNSはIPv6になっていましたがIPアドレスはIPv4のままでした。 \nちゃんと端末→mac間でIPv6になっているのか疑問です。 \nこれは正常動作なのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 3.0", "creation_date": "2015-09-08T10:32:20.590", "favorite_count": 0, "id": "16382", "last_activity_date": "2015-09-08T12:06:19.113", "last_edit_date": "2015-09-08T12:06:19.113", "last_editor_user_id": "3639", "owner_user_id": "12244", "post_type": "question", "score": 2, "tags": [ "swift", "objective-c", "iphone", "ipv6" ], "title": "Create NAT64 Networkでデバイスをwifi接続した際に、IPアドレスがIPv4のままです。", "view_count": 458 }
[]
16382
null
null