question
dict | answers
list | id
stringlengths 2
5
| accepted_answer_id
stringlengths 2
5
⌀ | popular_answer_id
stringlengths 2
5
⌀ |
---|---|---|---|---|
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "UIImagePickerControllerのallowsEditing=YESにした時にクロップが出来ると思うのですが、背景透過のpngのリサイズをすると、画像の比率がおかしくなってしまいます。 \n\n\nこちらの元画像を、下記のような感じでクロップします。\n\n\n\nそうすると、背景が透過の部分がなくなってしまうためか、丸が潰れてimageviewに配置されてしまいます。 \n\n\nUIImagePickerControllerで選択後には140x140pxのUIImageViewにセットしています。 \n上記のキャプチャでいう、黒い部分が140x140pxのUIImageViewです。\n\n```\n\n func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) {\n self.uiimageview.image = image\n println(image)\n println(editingInfo)\n }\n \n```\n\nUIImageと、editingInfoのログは下記の通りでした。\n\n```\n\n <UIImage: 0x17409d100> size {1065, 1242} orientation 0 scale 1.000000\n {\n UIImagePickerControllerCropRect = \"NSRect: {{0, 6}, {243, 283}}\";\n UIImagePickerControllerOriginalImage = \"<UIImage: 0x17409c660> size {244, 500} orientation 0 scale 1.000000\";\n UIImagePickerControllerReferenceURL = \"assets-library://asset/asset.PNG?id=2AE8222F-5332-468D-BE25-5CE826E0ABEC&ext=PNG\";\n }\n \n```\n\nこれを、比率を変更せずにUIImageViewに設置する方法をご存知の方がいらっしゃいましたら、ご教授頂けますと幸いでございます。\n\n宜しくお願い致します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-05-31T14:11:23.290",
"favorite_count": 0,
"id": "10820",
"last_activity_date": "2015-08-11T09:55:28.520",
"last_edit_date": "2015-05-31T16:04:41.793",
"last_editor_user_id": "76",
"owner_user_id": "8755",
"post_type": "question",
"score": 2,
"tags": [
"swift"
],
"title": "UIImagePickerControllerのallowsEditing=YESにした時に背景透過のpngのリサイズの比率がおかしくなる",
"view_count": 1020
} | [
{
"body": "おそらくクロップや背景透過とは関係無いと思います。\n\nあらかじめ \n`uiimageview.contentMode = .ScaleAspectFit` \nとセットしておくとどうでしょうか。\n\nこうすることで、`UIImageView`の中にアスペクト比固定のまま最大のサイズで画像を表示することができます。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-12T08:18:39.633",
"id": "11284",
"last_activity_date": "2015-06-12T08:18:39.633",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5605",
"parent_id": "10820",
"post_type": "answer",
"score": 1
}
] | 10820 | null | 11284 |
{
"accepted_answer_id": "10836",
"answer_count": 1,
"body": "api/app/Http/routes.php\n\n```\n\n Route::resource('ranking', 'RankingController');\n \n```\n\napi/app/Http/Controllers/RankingController.php\n\n```\n\n class RankingController extends Controller {\n public function index()\n {\n return 'GET success';\n }\n \n public function store()\n {\n return 'POST success';\n }\n }\n \n```\n\n上記設定でリクエスト時のパスが/rankingのときにGETだった場合はindexを、POSTだったときはstoreを呼び出すようになっているかと思います。\n\nGETでリクエストした時は 200 okが帰ってくるのですが、POSTした時に500 internal server errorが帰ってきています。\n\nこれに関してサーバー側の問題か?laravelの設定の問題か?もわかっていません。。。 \nご助言お願い致します。\n\n【追記】 \nREST Client POST送信画像 \n",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-05-31T15:08:20.817",
"favorite_count": 0,
"id": "10823",
"last_activity_date": "2015-06-01T07:03:25.650",
"last_edit_date": "2015-06-01T04:53:14.783",
"last_editor_user_id": "5981",
"owner_user_id": "5981",
"post_type": "question",
"score": 1,
"tags": [
"php",
"http",
"laravel"
],
"title": "Laravel 5 でのPOSTでのルーティングがうまくいかない",
"view_count": 11498
} | [
{
"body": "`storage/logs/laravel-yyyy-mm-dd.log`ログファイルに以下のエラーが出ているようでしたら、 \ncsrf_tokenが設定されていないことによるエラーです。\n\n```\n\n [2015-06-01 06:50:23] local.ERROR: exception 'Illuminate\\Session\\TokenMismatchException' in /Users/who/projects/hoge_project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:46\n \n```\n\ncsrf_tokenのチェックをOFFにするには`app/Http/Karnel.php`内の'App\\Http\\Middleware\\VerifyCsrfToken'の行を削除するか、コメントにします。但し、この場合、アプリ全体でcsrf_tokenのチェックがOFFになってしまいます。\n\n```\n\n class Kernel extends HttpKernel {\n protected $middleware = [\n 'Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode',\n 'Illuminate\\Cookie\\Middleware\\EncryptCookies',\n 'Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse',\n 'Illuminate\\Session\\Middleware\\StartSession',\n 'Illuminate\\View\\Middleware\\ShareErrorsFromSession',\n // 'App\\Http\\Middleware\\VerifyCsrfToken',\n ];\n \n```\n\n特定のルートのみcsrf_tokenのチェックをOFFにしたい場合は、以下のサイトを参考にしてください。\n\n参考サイト \n<http://qiita.com/rana_kualu/items/3f9d0d6b9a363fd2108e> \n<http://qiita.com/zaburo/items/c054b47ed0a7be465bcf>\n\nもうすぐリリースされる、ver 5.1\nでは`app/Http/Middleware/VerifyCsrfToken.php`内で、`$except`を設定することで、特定のルートのみcsrf_tokenのチェックをOFFにするのが出来るようになります。\n\n<http://laravel.com/docs/master/routing#csrf-excluding-uris>\n\n```\n\n <?php namespace App\\Http\\Middleware;\n \n use Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken as BaseVerifier;\n \n class VerifyCsrfToken extends BaseVerifier\n {\n /**\n * The URIs that should be excluded from CSRF verification.\n *\n * @var array\n */\n protected $except = [\n 'stripe/*',\n ];\n }\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T07:03:25.650",
"id": "10836",
"last_activity_date": "2015-06-01T07:03:25.650",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9529",
"parent_id": "10823",
"post_type": "answer",
"score": 2
}
] | 10823 | 10836 | 10836 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "プログラミング、アプリ開発ともに初心者です。\n\nシンプルな歩数計を作りたいのですが、 \nどこかのblogでmonacaではバックグラウンドで動くアプリは作れないので、 \n歩数計とか無理だろうな、というような記述を見かけました。\n\n他のアプリからデータを取得するなどして、歩数計を \n作ることは出来ないのでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-05-31T20:05:38.880",
"favorite_count": 0,
"id": "10828",
"last_activity_date": "2015-07-07T15:18:56.417",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9940",
"post_type": "question",
"score": 0,
"tags": [
"monaca"
],
"title": "monacaで歩数計は作る方法はありますか?",
"view_count": 1314
} | [
{
"body": "できますよ!iOSなら比較的簡単にできます。 \n<http://plugins.telerik.com/cordova/plugin/healthkit>\nこのプラグインを使用すればヘルスケアのデータを読み出すことができます(歩数、距離データ等) \n外部プラグインを利用するには、Goldプランに入らなといけませんが、、、",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T14:24:18.210",
"id": "11080",
"last_activity_date": "2015-06-07T14:24:18.210",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8748",
"parent_id": "10828",
"post_type": "answer",
"score": 2
}
] | 10828 | null | 11080 |
{
"accepted_answer_id": "11453",
"answer_count": 1,
"body": "JavaやC#, Rubyなどである程度、1ファイルが大きくなる場合 \nセパレータや空行2行などを使って、関連性の薄いメソッドとメソッドなどの間隔を区切っています。\n\n普段、このようなコーディングスタイルでプログラムを書いているのですが、 \nVimのプラグイン 'vim-go' を使っていたところ、2行空行は1行の空行に圧縮されました。 ( gofmt?というものの機能でしょうか )\n\nそこで気になったのですが、このような形のプログラムの記述は見にくいでしょうか? \n( または、共同開発において弊害を起こす可能性などありますか? )\n\n空行以外でもリーダビリティに害をなす可能性のあるものがあればご指摘くだるとありがたいです。\n\n```\n\n public class BubbleSort {\n \n /* ---===---===---===---===---===---===--- */\n \n \n public static void main(String[] args) {\n int[] xs = { 1, 5, 2, 6, 4, 3 };\n \n BubbleSort sorter = new BubbleSort();\n \n sorter.sort(xs);\n sorter.arrayView(xs);\n }\n \n \n /* ---===---===---===---===---===---===--- */\n \n \n public BubbleSort() {\n System.out.println(\"new\");\n }\n \n \n /* ---===---===---===---===---===---===--- */\n \n \n /**\n * うんたら\n *\n * @param xs ソートを行う対象のint配列\n */\n public void sort(int[] xs) {\n // インデント増加対策\n for (int i = 0; i < xs.length; ++i) for (int j = i; j < xs.length - 1; ++j) {\n if (xs[j] > xs[j + 1]) {\n int tmp = xs[j];\n \n xs[j] = xs[j + 1];\n xs[j + 1] = tmp;\n }\n }\n }\n \n \n /**\n * かんたら\n *\n * @param xs 表示をする対象のint配列\n */\n public void arrayView(int[] xs) {\n for (int x : xs) {\n System.out.println(x);\n }\n }\n \n \n /* ---===---===---===---===---===---===--- */\n \n }\n \n```",
"comment_count": 8,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T04:51:44.093",
"favorite_count": 0,
"id": "10831",
"last_activity_date": "2015-08-31T14:47:00.860",
"last_edit_date": "2015-06-18T02:59:25.620",
"last_editor_user_id": "7214",
"owner_user_id": "9945",
"post_type": "question",
"score": 3,
"tags": [
"java",
"c#",
"可読性"
],
"title": "クラスベースな言語での空行について(リーダビリティ)",
"view_count": 419
} | [
{
"body": "コメントにて回答を頂けたのでこの質問はクローズします。 \nありがとうございました!\n\n以下に自分の結論を載せます。\n\n* * *\n\nセパレータはメンバの分類のみに使用します。 \n例\n\n```\n\n class Foo {\n /* ------ private final field ------ */\n \n private final String BAR = \"BAR\";\n \n /* ------ private field ------ */\n \n private String hoge;\n \n /* ------ public static method ------ */\n \n public static void aho() {}\n \n /* ------ public method ------ */\n \n public void neko() {}\n }\n \n```\n\nまた、各メソッドの間にはセパレータは挿入しませんが \n原則的に二行の空行を挿入します。 ( 感覚的に見やすかったため ) \n例\n\n```\n\n class Hoge {\n /* ------ public method ------ */\n \n public void inu() {\n System.out.println(\"wan wan !!!\");\n }\n \n \n public void sugoiInu() {\n System.out.println(\"won won !!!\");\n }\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-18T02:38:57.047",
"id": "11453",
"last_activity_date": "2015-08-31T14:47:00.860",
"last_edit_date": "2015-08-31T14:47:00.860",
"last_editor_user_id": "9945",
"owner_user_id": "9945",
"parent_id": "10831",
"post_type": "answer",
"score": 5
}
] | 10831 | 11453 | 11453 |
{
"accepted_answer_id": "10835",
"answer_count": 2,
"body": "JNAを用いてJavaからC++のライブラリの関数を使い、戻り値としてfloatとStringの配列を得たいのですが、floatは全く違う値になり、Stringは読み出そうとするとSIGSEGVが発生します。関数の呼び出しや、引数に与えた構造体がC++側で読めていることは確認しています。[このサイト](http://www.eshayne.com/jnaex/example14.html)などを参考に以下のようなコードを作成しています。どうすればエラーなく処理できるでしょうか?\n\nc++\n\n```\n\n typedef struct result {\n float* score;\n char** value;\n } result;\n \n result myfunc(){\n result *res = (result)malloc(sizeof(result));\n memset(res, 0, sizeof(result));\n \n (*res).score = (float*)malloc(sizeof(float) * 10);\n memset((*res).score, 0, sizeof(float) * 10);\n (*res).value = (char**)malloc(sizeof(char*) * 10);\n \n for (size_t i = 0; i < 10; ++i) {\n (*res).score[i] = getscore(i);\n \n char* val = getvalue(i);\n (*res).value[i] = (char *)malloc(sizeof(val));\n memset((*res).value[i], 0, sizeof(val));\n strcpy((*res).value[i], val);\n }\n /* ここでres.score[i], res.value[i]を出力すると正常な値になっているのを確認 */\n }\n \n```\n\njava\n\n```\n\n import com.sun.jna.*;\n import com.sun.jna.ptr.*;\n \n public interface MyLib extends Library {\n public static class result extends Structure {\n public static class ByValue extends result implements Structure.ByValue {}\n public Pointer value; // char**\n public Pointer score; // float*\n protected List getFieldOrder() {\n return Arrays.asList(new String[]{\n \"value\", \"score\",\n });\n }\n }\n \n MyLib INSTANCE = (MyLib) Native.loadLibrary(\"mylib\", MyLib.class);\n public result.ByValue myfunc();\n }\n \n public static void main(String[] args) {\n MyLib.result.ByValue res = MyLib.INSTANCE.myfunc();\n \n for(int i = 0; i < 10; i++){\n float score = res.score.getFloat(i * Native.getNativeSize(Float.TYPE));\n System.out.println(score); // 値が異なる\n }\n \n String[] strs = res.value.getStringArray(0, 10);// SIGSEGVが発生\n for (String s: strs){\n if(s != null){\n System.out.println(s);\n }\n }\n }\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T05:25:19.800",
"favorite_count": 0,
"id": "10832",
"last_activity_date": "2015-06-01T09:06:11.587",
"last_edit_date": "2015-06-01T09:06:11.587",
"last_editor_user_id": "49",
"owner_user_id": "9947",
"post_type": "question",
"score": 2,
"tags": [
"java",
"c++"
],
"title": "JNAでC++から文字列を受け取る",
"view_count": 5772
} | [
{
"body": "リンク先のサンプルのは、Cの構造体配列をそのままJavaから得る場合のサンプルです。 \nJava から安全に参照可能な構造体配列を取るのであれば、自分でインスタンスを作らなければなりません。例えば String の配列であれば以下の通り。\n\n```\n\n ret= (jobjectArray)env->NewObjectArray(3,\n env->FindClass(\"java/lang/String\"),\n env->NewStringUTF(\"\"));\n for(i=0; i<3; i++) {\n env->SetObjectArrayElement(ret, i, env->NewStringUTF(\"こんにちわ世界\")); \n } \n \n```\n\nこれをご自分の構造体をクラスとしてwrapした物で置き換えると出来上がるはずです。",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T06:27:57.367",
"id": "10835",
"last_activity_date": "2015-06-01T06:27:57.367",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "440",
"parent_id": "10832",
"post_type": "answer",
"score": 3
},
{
"body": "C++ myfunc()のコード見ただけですが気になったところ\n\n```\n\n (*res).value[i] = (char *)malloc(sizeof(val)); \n \n```\n\nこれだと 「char *」のサイズ分しか確保できてないので getvalue()\nの戻り値次第ですがstrcpy()実行時にバッファーオーバフローを起こしてる気がします。\n\n```\n\n (*res).value[i] = (char *)malloc(sizeof(char)*(strlen(val)+1)); \n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T07:52:04.770",
"id": "10837",
"last_activity_date": "2015-06-01T07:58:05.327",
"last_edit_date": "2015-06-01T07:58:05.327",
"last_editor_user_id": "7343",
"owner_user_id": "7343",
"parent_id": "10832",
"post_type": "answer",
"score": 1
}
] | 10832 | 10835 | 10835 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "下記にあるgoogle-api-objectivec-clientをCocoapodsでインストールしたいのですが、 \n<https://code.google.com/p/google-api-objectivec-client/>\n\nCocoapodsでは1.0.422(Rev422)がインストールされます。 \n<https://github.com/CocoaPods/Specs/tree/master/Specs/Google-API-Client>\n\nこれを現在では最新のRev446をインストールする方法を探しております。\n\ngithubでは:headをつければ最新のコミットになる認識ですが、 \nsvnだと方法が見つからず困っております。\n\n```\n\n Podfile\n source 'https://github.com/CocoaPods/Specs.git'\n \n platform :ios , '7.1'\n inhibit_all_warnings!\n \n pod 'google-api-objectivec-client', :head\n \n```\n\n環境 \nxcode6.3 \ncocoapods 0.37.2",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T06:13:35.307",
"favorite_count": 0,
"id": "10833",
"last_activity_date": "2015-07-01T10:54:42.997",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9948",
"post_type": "question",
"score": 1,
"tags": [
"ios",
"objective-c",
"cocoapods"
],
"title": "最新のgoogle-api-objectivec-clientをCocoapodsでインストール",
"view_count": 382
} | [
{
"body": "自分で最新のリビジョンを参照するPodspecを書いて、それを使ってインストールするのが簡単だと思います。\n\n下はおそらく最低限インストールできるであろうPodspecです。上のリンク先を見たところ、オリジナルのPodspecはもっとたくさんの記述がありましたので、おそらくもっと書く必要があると思います。\n\n```\n\n Pod::Spec.new do |s|\n s.name = \"Google-API-Client\"\n s.version = \"1.0.446\"\n s.ios.deployment_target = \"5.0\"\n \n s.source = { svn: 'http://google-api-objectivec-client.googlecode.com/svn/trunk/', revision: '446' }\n s.dependency 'gtm-http-fetcher', '~> 1.0.141'\n s.dependency 'gtm-oauth2', '~> 1.0.125'\n \n s.requires_arc = false\n end\n \n```\n\nこれをPodfileのほうからは次のような形で使用します。\n\n```\n\n pod 'Google-API-Client', :podspec => './Google-API-Client.podspec'\n \n```\n\nこれは`Podfile`と`Google-API-\nClient.podspec`が同じディレクトリにある、という例です。Gistなどを使って管理するひともいますし、`source`指定でカスタムのSpecリポジトリを指定できるのでそれを使うのもいいと思います。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T10:11:31.627",
"id": "10840",
"last_activity_date": "2015-06-01T10:11:31.627",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5519",
"parent_id": "10833",
"post_type": "answer",
"score": 1
}
] | 10833 | null | 10840 |
{
"accepted_answer_id": "10862",
"answer_count": 2,
"body": "下記のコードのsomeUtilをテスト時にスタブにできないか試行錯誤しています。\n\n```\n\n var someUtil = require('great-util');\n \n module.export = {\n \"action\": function() { someUtil.method(); }\n }\n \n```\n\n苦肉の策で現状はmoduleの実装とinterfaceを分割して行っています。\n\n```\n\n module.export = {\n \"action\": function() { Module.actiomImpl(someUtil) },\n \"actionImpl\": function(someUtil){ someUtil.method() }\n }\n \n```\n\nmoduleのsomeUtilをスタブにしたいと考えているのですが、上記のような実装のnode_moduleの依存性を解決する方法を教えていただけますか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T09:06:06.457",
"favorite_count": 0,
"id": "10839",
"last_activity_date": "2015-06-03T12:11:55.937",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4041",
"post_type": "question",
"score": 0,
"tags": [
"javascript",
"node.js"
],
"title": "node.jsのmoduleをmockする方法",
"view_count": 505
} | [
{
"body": "[proxyquire](https://www.npmjs.com/package/proxyquire)というモジュールを利用すると、便利です。\n\n```\n\n var proxyquire = require('proxyquire');\n \n proxyquire(\"./path/to/use/site\", {\"great-util\": {\n method: function() { /* this is mock */ }\n }});\n \n```\n\n第1引数に渡した文字列のモジュールから読み込む依存モジュールの実装が、第2引数に渡したオブジェクトになります。 \n第2引数は、キーがモジュール名、値が`module.exports`に与える実装オブジェクトです。\n\n[私の利用例](https://github.com/mysticatea/uptodate/blob/master/test/lib/override-\nopener.js)では、ブラウザを開くモジュールをSpyに置き換えています。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T00:39:49.720",
"id": "10862",
"last_activity_date": "2015-06-02T00:39:49.720",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4809",
"parent_id": "10839",
"post_type": "answer",
"score": 2
},
{
"body": "スタブをローカルモジュールとして用意する方法は使えませんか?\n\n`../stab_modules/great-util` など適当なディレクトリで、`npm init` して、package.json は\n`\"private\" : true` に、great-util のスタブモジュールを作成。\n\n使う側で、\n\n```\n\n npm install ../stab_modules/great-util\n \n```\n\n切り替えるには、`npm install great-util` が必要ですが \ngreat-util を使用する側は、スタブが作成できてれば、いつも通り使えるはず。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T12:11:55.937",
"id": "10951",
"last_activity_date": "2015-06-03T12:11:55.937",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4419",
"parent_id": "10839",
"post_type": "answer",
"score": 1
}
] | 10839 | 10862 | 10862 |
{
"accepted_answer_id": "10843",
"answer_count": 1,
"body": "Facebook や Twitter のよくあるシェアボタンを作成しています。\n\n[ここ](http://qiita.com/AkiraAlex/items/f224f8ee55a50ffe1a3f)などを参考にすると \nTwitter のシェアボタンを実装する場合は\n\n```\n\n <a class=\"twitter btn\" href=\"http://twitter.com/share?url=[共有したいURL]&text=[任意のテキスト]&via=[ツイート内に含まれるユーザー名]&related=[関連アカウント]\">tweetする</a>\n \n```\n\nと記載されているので、これを erb で記述しようとしているのですが\n\n```\n\n <%= link_to \"https://twitter.com/intent/tweet?source=#{ request.url }&text=#{ ここの [任意のテキスト] 部分に今いるページの <title> タグの中身を入れたい }&via=foobar\" %>\n \n```\n\nといった感じで、共有したい URL の取得方法は分かったのですが \nタグの中身の取得方法が分かりません…。\n\n他にもっと効率的な手法などあれば、ご教示いただきたいです。 \nよろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T10:13:35.123",
"favorite_count": 0,
"id": "10841",
"last_activity_date": "2015-06-01T10:55:16.300",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9617",
"post_type": "question",
"score": 0,
"tags": [
"javascript",
"ruby-on-rails",
"ruby",
"erb"
],
"title": "Rails で今いるページの <title> の中身を取得する方法",
"view_count": 859
} | [
{
"body": "provideヘルパーを使ってはどうでしょうか?\n\nまず、ページのタイトルを provideとyieldを使って表示するようにします。\n\nviews/layouts/application.html.erb\n\n```\n\n <!DOCTYPE html>\n <html>\n <head>\n <title><%= yield :title %></title>\n ...\n </head>\n <body>\n \n <%= yield %>\n \n </body>\n </html>\n \n```\n\nviews/static_pages/home.html.erb\n\n```\n\n <% provide :title, \"ホーム\" %>\n \n <h1><%= yield :title %></h1>\n <p>かくかく、しかじか</p>\n \n```\n\nこのようにすると、`<%= yield :title %>`を使うことでtitleを取得できます。\n\n```\n\n <a class=\"twitter btn\" href=\"http://twitter.com/share?url=<%= request.url %>&text=<%= yield :title >&via=foobar>tweetする</a>\n \n <%= link_to \"https://twitter.com/intent/tweet?source=#{ request.url }&text=#{ yield :title }&via=foobar\" %>\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T10:55:16.300",
"id": "10843",
"last_activity_date": "2015-06-01T10:55:16.300",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9529",
"parent_id": "10841",
"post_type": "answer",
"score": 1
}
] | 10841 | 10843 | 10843 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "Storyという名前のエンティティ名でCoreData保存しました。\n\n中身はattributeのみで、 \n\n\nこのような構成になっています。\n\nこれをNSPredicateのCONTAINSを使って\n\n>\n```\n\n> NSFetchRequest* request = [NSFetchRequest\n> fetchRequestWithEntityName:@\"Story\"];\n> request.predicate = [NSPredicate predicateWithFormat:@\"tap_count\n> CONTAINS '0'\"];\n> NSArray* result = [[DataBaseManager shared].moc\n> executeFetchRequest:request error:nil];\n> \n```\n\nと書いたところtap_countが0,10,20の3つのNSManagedObjectが取れました。\n\nでも本当はtap_count 0だけを取りたいので、\n\n>\n```\n\n> request.predicate = [NSPredicate predicateWithFormat:@\"tap_count ==\n> '%d'\",_tapCount];\n> \n```\n\nだとか\n\n>\n```\n\n> request.predicate = [NSPredicate predicateWithFormat:@\"tap_count\n> MATCHES '[%d]'\",_tapCount];\n> \n```\n\nとかいろいろ試してみたのですが、うまく取り出せません。\n\n取り出し方を教えてください。よろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T11:03:38.640",
"favorite_count": 0,
"id": "10844",
"last_activity_date": "2015-08-01T01:34:32.777",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9952",
"post_type": "question",
"score": 1,
"tags": [
"objective-c",
"coredata"
],
"title": "CoreDataでNSPredicate。CONTAINSでは取り出せるのに、他の方法で取り出せません。",
"view_count": 250
} | [
{
"body": "取り出せるようになりました。\n\n`=`演算子を使うときは `==`ではなく、`=`なんですね。\n\n```\n\n NSFetchRequest* request = [NSFetchRequest fetchRequestWithEntityName:@\"Story\"];\n NSString* predicateStr = [NSString stringWithFormat:@\"tap_count = '%d'\",_tapCount];\n request.predicate = [NSPredicate predicateWithFormat:predicateStr];\n NSArray* result = [[DataBaseManager shared].moc executeFetchRequest:request error:nil\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T23:53:36.127",
"id": "10858",
"last_activity_date": "2015-06-02T00:14:29.353",
"last_edit_date": "2015-06-02T00:14:29.353",
"last_editor_user_id": "7214",
"owner_user_id": "9956",
"parent_id": "10844",
"post_type": "answer",
"score": 1
}
] | 10844 | null | 10858 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "定期支払いで決済が失敗した場合、通常次回も定期支払いが行われますが、1回目の失敗でステータスを「一時停止(Suspended)」 にしたいです。\n\nCreateRecurringPaymentsProfileのパラメータ[MAXFAILEDPAYMENTS]に「0」を設定すれば、 \n1回目の決済失敗で状態が自動的に 「Suspended」 に変更されるのでしょうか?\n\nまた、「Suspended」 に変更されるタイミングは決済が失敗したときにリアルタイムに変更されますか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T11:07:17.620",
"favorite_count": 0,
"id": "10845",
"last_activity_date": "2015-06-08T04:47:45.007",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9215",
"post_type": "question",
"score": 2,
"tags": [
"paypal"
],
"title": "ペイパルの定期支払いでエラーがあった場合、即座に一時停止(Suspended)にする方法",
"view_count": 747
} | [
{
"body": "MAXFAILEDPAYMENTSはデフォルトで0で、これは定期支払いがエラーとなってもsuspendedにならない設定です。\n\n1回失敗するとsuspendedにしたい場合は、この値を1にします。 \nこのステータスになるのはリアルタイムに変更されます。\n\n注意していただきたいのは、 \nインターバルが週や半月、月の場合は5日ごとに最大2回まで(初回をいれて計3回)自動リトライされます。 \nこのリトライについてはやめる設定がないので、インターバルが日以外の定期支払いでは \n最大3回まで決済が試みられます。\n\nMAXFAILEDPAYMENTS=1の時はこの3回まで、 \n2の場合は、3x2=6回まで(ただし後半3回は次回定期決済のタイミング)決済が試みられることになります。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T04:47:45.007",
"id": "11102",
"last_activity_date": "2015-06-08T04:47:45.007",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9333",
"parent_id": "10845",
"post_type": "answer",
"score": 1
}
] | 10845 | null | 11102 |
{
"accepted_answer_id": "10960",
"answer_count": 4,
"body": "PHPでユーザログインのAPIを作成しています。以下のコードを作成し、クライントサイドからメールアドレスとパスワードをPOSTしたのですが、401エラーで正しく認証できませんでした。 \nユーザデータはデータベースにあるのでメールアドレスとパスワードの打ち間違いはありません。どこを間違えているかわかりますか。またデバッグ方法などありましたら教えて下さい。よろしくお願いします。\n\n**ソーズコード**\n\n```\n\n 1 <?php\n 2 header(\"Content-Type: application/json; charset=UTF-8\");\n 3 header(\"X-Content-Type-Option: nosniff\");\n 4 header(\"Access-Control-Allow-Origin: *\");\n 5 header(\"Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept\");\n 6 require_once 'functions.php'\n 7 $pdo = initDB()\n 8 switch($_SERVER['REQUEST_METHOD']){\n 9 case 'POST':\n 10 $in = json_decode(file_get_contents('php://input'), true);\n 11 if(isset($in['mail_address'])&&isset($in['password'])){\n 12 $st = $pdo->prepare(\"SELECT * FROM user WHERE (mail_address) VALUE (:mail_address)\");\n 13 $st->bindParam(':mail_address', $in['mail_address'], PDO::PARAM_STR);\n 14 $st->execute();\n 15 while($row = $st->fetch(PDO::FETCH_ASSOC)){\n 16 $password = $row['password'];\n 17 }\n 18 if($password==$in['password']){\n 19 onPostSuccess($in['mail_address']);\n 20 }else{\n 21 header(\"HTTP/1.0 401 Unauthorixed\");\n 22 }\n 23 }else{\n 24 header(\"HTTP/1.0 400 Bad Request\");\n 25 }\n 26 }\n 27\n 28 function onPostSuccess($mailAddress){\n 29 $accessToken = makeAccessToken();\n 30 $st = $pdo->prepare(\"UPDATE user SET accessToken=:accessToken WHERE mail_address=:mail_address\");\n 31 $st->bindParam(':accessToken', $accessToken, PDO::PARAM_STR);\n 32 $st->bindParam(':mail_address', $mailAddress, PDO::PARAM_STR);\n 33 $st->execute();\n 34 header(\"HTTP/1.0 200 OK\");\n 35 echo json_encode(array('accessToken' => $accessToken));\n 36 }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T12:37:56.717",
"favorite_count": 0,
"id": "10846",
"last_activity_date": "2015-06-04T01:12:30.317",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7232",
"post_type": "question",
"score": 0,
"tags": [
"php",
"api"
],
"title": "PHPでログイン用APIの作成",
"view_count": 1244
} | [
{
"body": "パスワードが生で保存されているっぽいのは、おいといて。\n\n個人的には、このコードから見て考えつくのは \n同一メールアドレスのパスワード違いが複数行あって、 \n`while($row = $st->fetch(PDO::FETCH_ASSOC)){}` \nのところでorderもかかっていない最終行のパスワードの何かが \n入力されたものと一致していない可能性がある。というところが疑わしいです。\n\nそれから「401 Unauthorixed」(Unauthorixed...?)が発生するのは、 \nif($password==$in['password'])のでの判定だけですよね。 \nこの直前で両方の変数を、出力でもして確認するのが最適だと思います。\n\n……ところで気になったのですが。 \nDBへの問い合わせクエリの中で、メールアドレスとパスワードの両方を渡せばいいのでは? \nなぜwhileで回しているのでしょうか。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T04:43:20.010",
"id": "10874",
"last_activity_date": "2015-06-02T04:43:20.010",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8335",
"parent_id": "10846",
"post_type": "answer",
"score": 1
},
{
"body": "16行目でwhile開始して、そのブロックが18行目で閉じているのが原因ではないでしょうか。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T22:12:58.797",
"id": "10914",
"last_activity_date": "2015-06-02T22:12:58.797",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8136",
"parent_id": "10846",
"post_type": "answer",
"score": 1
},
{
"body": "認証機構を正しく安全に実装するのは意外と難しいので、十分な知識が無いなら自前で実装するのは避けた方が良いです。\n\n認証情報を自前で持つ場合、認証情報の安全な保管、パスワードリカバリ、アカウントに対するブルートフォース攻撃対策等まで含めて自分で考える必要があります。それよりもGoogleなどの外部IDプロバイダを利用して認証情報を自分では持たないのがベストです。\n\n自前でで実装する場合でも既製のライブラリやフレームワーク等がないか検討しましょう。\n\nまた、HTTP認証で十分なところに複雑な認証機構を使うのはかえってリスクが高くなります。HTTP認証で十分ならそれを使えば良いです。\n\n質問については、\n\n```\n\n $st = $pdo->prepare(\"SELECT count(*) FROM user WHERE mail_address = :mail_address AND password = :password\");\n $st->bindParam(':mail_address', $in['mail_address'], PDO::PARAM_STR);\n $st->bindParam(':passowrd', $in['password'], PDO::PARAM_STR);\n $st->execute();\n if($st->fetchColumn() > 1){ \n //match\n }else{\n //don't match\n }\n \n```\n\nやりたいことはおそらくこれで十分だと思います。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T02:35:59.130",
"id": "10924",
"last_activity_date": "2015-06-03T02:35:59.130",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "10846",
"post_type": "answer",
"score": 1
},
{
"body": "最終的に以下のようになりました。回答をしてくださった方々に感謝します。パスワードのセキュリティの問題など勉強になりました。パスワードをハッシュ化して保存したり、サードパーティの認証ライブラリの使用も検討したいと思います。\n\n```\n\n <?php\n header(\"Content-Type: application/json; charset=UTF-8\");\n header(\"X-Content-Type-Option: nosniff\");\n header(\"Access-Control-Allow-Origin: *\");\n header(\"Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept\");\n require_once 'functions.php';\n $pdo = initDB();\n switch($_SERVER['REQUEST_METHOD']){\n case 'POST':\n $in = json_decode(file_get_contents('php://input'), true);\n $error = '';\n if(isset($in['mail_address'])&&isset($in['password'])){\n $st = $pdo->prepare(\"SELECT * FROM user WHERE mail_address=:mail_address\");\n $st->bindParam(':mail_address', $in['mail_address'], PDO::PARAM_STR);\n $st->execute();\n $row = $st->fetch(PDO::FETCH_ASSOC);\n $password = $row['password'];\n if($password!=null){\n if($password==$in['password']){\n onPostSuccess($pdo, $in['mail_address']);\n }else{\n header(\"HTTP/1.0 401 Unauthorixed\");\n $error = \"パスワードが違います。\";\n sendError($error);\n } \n }else{\n header(\"HTTP/1.0 401 Unauthorixed\");\n $error = \"メールアドレスが登録されていません。\";\n sendError($error);\n }\n }else{\n header(\"HTTP/1.0 400 Bad Request\");\n }\n break;\n }\n \n function onPostSuccess($pdo, $mailAddress){\n $accessToken = makeAccessToken();\n $st1 = $pdo->prepare(\"UPDATE user SET accessToken=:accessToken WHERE mail_address=:mail_address\");\n $st1->bindParam(':accessToken', $accessToken, PDO::PARAM_STR);\n $st1->bindParam(':mail_address', $mailAddress, PDO::PARAM_STR);\n $st1->execute();\n header(\"HTTP/1.0 200 OK\");\n echo json_encode(array('accessToken' => $accessToken));\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T01:12:30.317",
"id": "10960",
"last_activity_date": "2015-06-04T01:12:30.317",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7232",
"parent_id": "10846",
"post_type": "answer",
"score": 0
}
] | 10846 | 10960 | 10874 |
{
"accepted_answer_id": "10935",
"answer_count": 2,
"body": "C#側でtarからZipをMemoryStreamに取り出すことができたので、 \nこれをiOS側に渡してC++かobejective-cでunzipして、 \nunzipしたものをbyte配列もしくはStreamで持ちたいのですが、 \nC++かobejective-cでZipのByte配列をUnZipしてByte配列に変換する方法、 \nもしくはライブラリはないでしょうか?\n\nまだObejective-c側しか調査してないのですが、 \nSSZipArchiveやObjectiveZipというものを見つけたのですが \nファイル名を与えないと解凍できないようでして、 \nC#のZipInputStreamのようなものがなく悩んでおります。\n\n●SSZipArchive \n<https://github.com/soffes/ssziparchive> \n●ObjectiveZip \n<https://github.com/gianlucabertani/Objective-Zip>\n\n■追記(Zlib 使用)\n\n```\n\n #import <Foundation/Foundation.h>\n #include <zlib.h>\n \n \n extern \"C\"{\n void uncompressByGzip(const char** ptrSrc, const int srcLength);\n }\n \n \n void uncompressByGzip(const char** ptrSrc, const int srcLength)\n {\n NSData *source = [NSData dataWithBytes:(const void *)ptrSrc length:(sizeof(unsigned char) * srcLength)];\n \n NSString* str = [NSString stringWithFormat:@\"%d\",srcLength];\n NSLog(@\"src = %@\",str);\n if (source.length == 0)\n return;\n NSLog(@\"11111\");\n \n z_stream stream;\n stream.zalloc = Z_NULL;\n stream.zfree = Z_NULL;\n stream.opaque = Z_NULL;\n stream.avail_in = (uInt)source.length;\n stream.next_in = (Bytef *)source.bytes;\n stream.total_out = 0;\n stream.avail_out = 0;\n \n NSLog(@\"22222\");\n if (inflateInit2(&stream, 31) != Z_OK)\n return;\n \n NSLog(@\"33333\");\n NSMutableData *FileSystemData = [NSMutableData dataWithCapacity:0];\n while (stream.avail_out == 0) {\n NSLog(@\"12345\");\n Bytef buffer[16384];\n stream.next_out = buffer;\n stream.avail_out = sizeof(buffer);\n NSString* avail_outbef = [NSString stringWithFormat:@\"%d\",(NSInteger)stream.avail_out];\n NSLog(@\"avail_outbef = %@\",avail_outbef);\n \n // inflate(&stream, Z_FINISH);\n inflate(&stream,Z_NO_FLUSH);\n size_t length = sizeof(buffer) - stream.avail_out;\n \n avail_outbef = [NSString stringWithFormat:@\"%d\",(NSInteger)stream.avail_out];\n NSLog(@\"avail_outaft = %@\",avail_outbef);\n \n NSString* strlength = [NSString stringWithFormat:@\"%d\",(NSInteger)length];\n NSLog(@\"length = %@\",strlength);\n \n if (length > 0)\n [FileSystemData appendBytes:buffer length:length];\n }\n inflateEnd(&stream);\n NSLog(@\"44444\");\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T12:41:24.187",
"favorite_count": 0,
"id": "10848",
"last_activity_date": "2015-06-03T06:23:46.557",
"last_edit_date": "2015-06-02T11:43:16.463",
"last_editor_user_id": "5261",
"owner_user_id": "5261",
"post_type": "question",
"score": 2,
"tags": [
"objective-c",
"c#",
"c++"
],
"title": "C++かObjective-cでByte配列からByte配列にZip解凍したい",
"view_count": 1063
} | [
{
"body": "c のライブラリですが zlib はどうでしょうか? \n`inflate` 関数を使用すれば Stream で行うことができます。\n\nxcode のプロジェクトには `Linked Frameworks And Libraries` から `libz` (ややこしい)で追加できます。\n\n公式のサンプルは <http://www.zlib.net/zlib_how.html> \nまた日本語での解説は以下がわかりやすいと思います。 <http://s-yata.jp/docs/zlib/>",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T02:29:43.390",
"id": "10864",
"last_activity_date": "2015-06-02T02:29:43.390",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5106",
"parent_id": "10848",
"post_type": "answer",
"score": 2
},
{
"body": "SSZipArchiveもObjectiveZipも[Minizip](http://www.winimage.com/zLibDll/minizip.html)のラッパーなので、Minizipをそのまま使ったほうがいいと思います。 \nMiniZipを直接使えばファイルを介さずにメモリから読み書きできます。",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T06:23:46.557",
"id": "10935",
"last_activity_date": "2015-06-03T06:23:46.557",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3639",
"parent_id": "10848",
"post_type": "answer",
"score": 1
}
] | 10848 | 10935 | 10864 |
{
"accepted_answer_id": "10952",
"answer_count": 1,
"body": "C++の勉強のためにFirefoxのJS\nEngineである、SpiderMonkeyのコードを読みたいと思っているのですが、どこから読み始めればいいのか迷っています。 \nfunctionやobjectなどのJSの基本的なところや、ES6で新しく入るclassの実装などが気になっています。 \n将来的にはjsの実装みたいなことをやりたいと考えているのですが、js/srcのどこから始めればいいのでしょうか?",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T12:51:22.920",
"favorite_count": 0,
"id": "10849",
"last_activity_date": "2015-06-03T12:37:32.407",
"last_edit_date": "2015-06-03T10:55:27.357",
"last_editor_user_id": "5246",
"owner_user_id": "5246",
"post_type": "question",
"score": 2,
"tags": [
"c++",
"firefox",
"ecmascript-6"
],
"title": "FirefoxのSpidermonkeyのコードの読み方",
"view_count": 156
} | [
{
"body": "名前のままですが、functionは`src/jsfun.cpp`、Objectは`src/jsobj.cpp`に実装があります。arrayなども同様です。\n\nclassについては、基本的に文法が追加されているだけなので機能としての実装は存在しません。強いて言うなら、`src/frontend/Parser.cpp`でしょうか。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T12:37:32.407",
"id": "10952",
"last_activity_date": "2015-06-03T12:37:32.407",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3639",
"parent_id": "10849",
"post_type": "answer",
"score": 2
}
] | 10849 | 10952 | 10952 |
{
"accepted_answer_id": "10906",
"answer_count": 1,
"body": "IntelliJ IDEA 14 で[golang plugin](https://github.com/go-lang-plugin-org/go-\nlang-idea-plugin)を使おうとしているのですが、以下のエラーが消せません。\n\n類似の問題がネットで多数ありましたが、どれも解決されませんでした。\n\n\n\n当方環境\n\n * MacOSX 10.10.3\n * `echo $GOROOT` -> `/Users/otiai10/.go` (ソースから入れたもの)\n * `echo $GOPATH` -> `/Users/otiai10/proj/go`\n * sudo launchctl getenvでも同様のpathが得られます\n\n大変お恥ずかしいのですが、ご助言いただけると幸いですmm",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T13:01:53.107",
"favorite_count": 0,
"id": "10850",
"last_activity_date": "2015-06-02T14:08:12.213",
"last_edit_date": "2015-06-01T13:11:49.190",
"last_editor_user_id": "239",
"owner_user_id": "239",
"post_type": "question",
"score": 2,
"tags": [
"go",
"intellij-idea"
],
"title": "IntelliJ14でGolang PluginがGOROOT, GOPATHを認識しない",
"view_count": 218
} | [
{
"body": "カスタムでplugin repositoryを参照する必要がありました。詳細は以下にまとめました。 \n<http://otiai10.hatenablog.com/entry/2015/06/02/224636>\n\nお騒がせして申し訳ありませんでした。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T14:08:12.213",
"id": "10906",
"last_activity_date": "2015-06-02T14:08:12.213",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "239",
"parent_id": "10850",
"post_type": "answer",
"score": 1
}
] | 10850 | 10906 | 10906 |
{
"accepted_answer_id": "10871",
"answer_count": 4,
"body": "こんにちは。\n\nmonacaでアプリケーションを作っています。\n\nフォトスライダーを使っているのですが表示する端末に合わせスライダーのwidthを変更できないかと思っています。\n\n使用しているスライダーがレスポンシブルに対応していないためCSSの設定ファイルからpx指定するようになっています。(100%に設定するとおかしな表示になります。。)\n\n「レスポンシブルなスライダーに変更すればいい」とご指摘をいただきそうなのですが、処理が軽いことと先にスライダーの画像を別のアプリから動的に変更できるようにしてしまった為、できれば現状のスライダーを利用できればと思っています。\n\nscreen.widthで取得できる値をスライダーのwidthに設定したいのですがCSSファイルを \n動的に変更することは可能でしょうか。\n\nどなたかご教授いただけると幸いです。\n\nどうぞよろしくお願い致します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T15:37:54.680",
"favorite_count": 0,
"id": "10855",
"last_activity_date": "2015-06-02T08:45:28.733",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8389",
"post_type": "question",
"score": 2,
"tags": [
"javascript",
"monaca",
"css"
],
"title": "monacaでCSSファイルを動的に変えたい",
"view_count": 683
} | [
{
"body": "自分もそんなに詳しくはないのですが、画面サイズによって読み込むCSSを変えるのはどうでしょうか? \n画面の幅が900px未満はStyleA.css、幅が900px以上はStyleB.css といった感じに。\n\n```\n\n <link rel=\"stylesheet\" href=\"css/styleA.css\" media=\"screen and (max-width: 899px)\">\n <link rel=\"stylesheet\" href=\"css/styleB.css\" media=\"screen and (min-width: 900px)\">\n \n```\n\n画面幅に対し完全にレスポンシブルというわけではないですが。 \n何段階か設定すれば、それっぽくなるかと。 \nただ、求めているものとは少し違いますよね。。。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T02:34:43.123",
"id": "10866",
"last_activity_date": "2015-06-02T02:34:43.123",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9912",
"parent_id": "10855",
"post_type": "answer",
"score": 1
},
{
"body": "横幅だけ後で追加する方法はどうですか。\n\n```\n\n $(function() {\r\n $(\"#add\").click(function() {\r\n $(\"#box\").css({\"width\":\"50px\"});\r\n });\r\n $(\"#remove\").click(function() {\r\n $(\"#box\").css({\"width\":\"\"});\r\n });\r\n });\n```\n\n```\n\n .box {\r\n margin: 15px 0px 15px 0px;\r\n width: 200px;\r\n height: 150px;\r\n background-color: blue;\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 class=\"box\" id=\"box\"></div>\r\n <button type=\"button\" id=\"add\">スタイル追加</button>\r\n <button type=\"button\" id=\"remove\">スタイル削除</button>\n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T03:36:21.183",
"id": "10868",
"last_activity_date": "2015-06-02T03:36:21.183",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3516",
"parent_id": "10855",
"post_type": "answer",
"score": 1
},
{
"body": "わざわざ聞いているということは以下ではダメなんでしょうが \n質問の内容だけから判断してメディアクエリが一番手軽で \nスピードの問題もないように思いますが・・・\n\n```\n\n @media screen and (max-width: 480px) {\n div.slidebarholder { width: 90%; }\n }\n @media screen and (min-width: 481px) and (max-width: 1024px) {\n div.slidebarholder { width: 85%; }\n }\n @media screen and (min-width: 1025px) {\n div.slidebarholder { width: 80%%; }\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T04:11:48.703",
"id": "10871",
"last_activity_date": "2015-06-02T04:50:15.677",
"last_edit_date": "2015-06-02T04:50:15.677",
"last_editor_user_id": "8477",
"owner_user_id": "8477",
"parent_id": "10855",
"post_type": "answer",
"score": 2
},
{
"body": "JavaScriptで\n\n```\n\n var w = screen.width;\n // もしwの値に不満があるならここで演算\n $(\"#設定するID\").css({width: w});\n \n```\n\nとすれば、うまくいくはずです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T04:24:53.923",
"id": "10872",
"last_activity_date": "2015-06-02T08:45:28.733",
"last_edit_date": "2015-06-02T08:45:28.733",
"last_editor_user_id": "208",
"owner_user_id": "9959",
"parent_id": "10855",
"post_type": "answer",
"score": 0
}
] | 10855 | 10871 | 10871 |
{
"accepted_answer_id": "11075",
"answer_count": 1,
"body": "ffmpegでmp4からhlsの変換を行うためにインストールしたのですが `Unknown encoder 'libfdk_aac'`\nのエラーが出てしまいます。 \n何が原因でしょうか? \nOSはCentOS6.6です \nよろしくお願いします。\n\n 1. 下記サイトに従ってインストール\n\n<http://qiita.com/RyoIkarashi/items/48419f71f15f97c46123>\n\n * yasmは1.3.0のバージョンで行いました\n * libxvid(1.3.3)のインストールを追加しました\n * fdk-aac(0.1.4)のインストールを追加しました\n 2. サーバにinput.mp4を配置して下記コマンドを実行\n``` ffmpeg -i input.mp4 -vcodec libx264 -b:v 800k -acodec libfdk_aac\n-b:a 128k -flags +loop-global_header -map 0 -bsf h264_mp4toannexb -f segment\n-segment_format mpegts -segment_time 10 -segment_list output.m3u8\nstream%04d.ts\n\n \n```\n\n 3. Unknown encoder 'libfdk_aac'が表示されて正常に実行できません。1でfdk-aacを入れても変わりません。\n\n実行結果詳細\n\n``` ffmpeg version N-72570-gf104970 Copyright (c) 2000-2015 the FFmpeg\ndevelopers\n\n built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)\n configuration: --prefix=/usr/local --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-libfaac --enable-libx264 --enable-libxvid\n libavutil 54. 26.101 / 54. 26.101\n libavcodec 56. 41.101 / 56. 41.101\n libavformat 56. 34.100 / 56. 34.100\n libavdevice 56. 4.100 / 56. 4.100\n libavfilter 5. 16.101 / 5. 16.101\n libswscale 3. 1.101 / 3. 1.101\n libswresample 1. 1.100 / 1. 1.100\n libpostproc 53. 3.100 / 53. 3.100\n Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':\n Metadata:\n major_brand : mp42\n minor_version : 0\n compatible_brands: mp42mp41\n creation_time : 2015-04-06 03:26:23\n Duration: 00:00:06.02, start: 0.000000, bitrate: 1072 kb/s\n Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 904 kb/s, 29.97 fps, 29.97 tbr, 29970 tbn, 59.94 tbc (default)\n Metadata:\n creation_time : 2015-04-06 03:26:23\n handler_name : Mainconcept MP4 Video Media Handler\n encoder : AVC Coding\n Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 157 kb/s (default)\n Metadata:\n creation_time : 2015-04-06 03:26:23\n handler_name : Mainconcept MP4 Sound Media Handler\n Unknown encoder 'libfdk_aac'\n \n```",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T16:14:05.320",
"favorite_count": 0,
"id": "10856",
"last_activity_date": "2015-06-07T10:48:47.563",
"last_edit_date": "2015-06-01T22:49:36.640",
"last_editor_user_id": "208",
"owner_user_id": "8168",
"post_type": "question",
"score": 1,
"tags": [
"centos",
"ffmpeg"
],
"title": "ffmpegのインストールについて",
"view_count": 2804
} | [
{
"body": "エンコーダー名が異なる可能性はないでしょうか? 'libfdk_aac'ではなく、'fdk_aac'と指定する必要があるとか。`$ ffmpeg\n-formats`で確認できるみたいです。\n\n参考にしたページ \n<http://cagylogic.com/archives/2014/06/21134514.php> \n<http://yoshifumi.hateblo.jp/entry/20080119/p1>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T10:48:47.563",
"id": "11075",
"last_activity_date": "2015-06-07T10:48:47.563",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8621",
"parent_id": "10856",
"post_type": "answer",
"score": 1
}
] | 10856 | 11075 | 11075 |
{
"accepted_answer_id": "10891",
"answer_count": 2,
"body": "MySQL(InnoDB)を使って数日間の人気ランキングを作りたいと考えてます。そのテーブル構造なんですが、どのようにすると負担が少なくできるでしょうか。 \n私が考えたものは、流石に1つ1つのアクセスを単一のテーブルに保存するのは良くない気がして、以下のように数日分にまとめてみようと考えました。 \n商品(items)はすごくたくさんありまして、accessesをjoinするときに7日前までの日付と下記dateを比較します。もしjoin成功した場合には下記エントリのアクセス数を表示、そうでない場合にはアクセス数を0とします。 \nどんなものでしょうか。もしダメでしたら改善案をいただければと思います。\n\n```\n\n // 商品に対する日毎のアクセス数を保存\n テーブル名:accesses\n \n id primary integer auto_increment,\n item_id integer, //(商品のID)\n access integer, // (アクセス数)\n date date, // (アクセス情報の日付)\n created_at datetime, // (作成日時)\n updated_at datetime, // (更新日時)\n \n \n //itemsにおいて比較の方法(laravel 5コード)\n $item = Item::join('accesses' function($join){\n $join->on('items.id', '=', 'accesses.item_id')\n ->where('accesses.date', '>', date('Y-m-d', strtotime('-7 days')));\n })\n ....\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-01T22:33:06.343",
"favorite_count": 0,
"id": "10857",
"last_activity_date": "2015-06-02T08:30:40.980",
"last_edit_date": "2015-06-02T00:54:36.073",
"last_editor_user_id": "3516",
"owner_user_id": "9932",
"post_type": "question",
"score": 1,
"tags": [
"mysql",
"laravel"
],
"title": "1週間の人気ランキングをMySQL(InnoDB)+PHPで作りたい",
"view_count": 1292
} | [
{
"body": "最終的なランキング情報は、バッチ処理で作成するという前提で。\n\n## 1. データベースで何とかする\n\n`流石に1つ1つのアクセスを単一のテーブルに保存するのは良くない気がして` \nとのことですが。別に1つ1つで構いません。 \nSELECT して INSERT/UPDATE するよりも楽です。\n\n## 2. データベースで何とかしつつ、多少負荷も減らしたい。\n\nmemcachedやheapテーブルなどオンメモリ上で記録しておいて、 \nバッチで定期的に計算して、集計終わった分を削除しましょう。\n\n## 3. データベースを使わない (個人的に推奨)\n\nそもそもアクセス都度書き込むのは、いろいろアプリ側で考慮すべき責任が多くなるので好ましくありません。 \nそれに、アプリケーションがアクセス記録とらなくてもwebサーバーのアクセスログに、商品IDがクエリ文字列にありませんか?\nそれを利用すればアプリの責任は、集計処理だけです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T03:31:16.627",
"id": "10867",
"last_activity_date": "2015-06-02T03:31:16.627",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8335",
"parent_id": "10857",
"post_type": "answer",
"score": 1
},
{
"body": "質問のように項目ごとにをアクセス数を記録する方法だと、「該当レコードを探してきて`access`を+1」という処理になります。一方、1アクセスを1レコードで記録する場合、追加操作のみになります。表示の方を考えると、1アクセス1レコードの場合レコードをカウントしなければならないため質問の方法の方が負荷が低いでしょう。このあたりはどちらもメリットデメリットがあるので環境次第です。\n\nランキングを作るというのはRDBには不向きな処理で、アクセス数が膨大な場合はどちらの方法でも苦しくなってきますので、別の方法を検討する必要があります。[Redis](http://redis.io/)には「ソート済みセット型」というランキング処理の為に作られたようなデータ型があり、よく使われているようです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T08:30:40.980",
"id": "10891",
"last_activity_date": "2015-06-02T08:30:40.980",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "10857",
"post_type": "answer",
"score": 1
}
] | 10857 | 10891 | 10867 |
{
"accepted_answer_id": "10895",
"answer_count": 3,
"body": "**「数字」 と 「数値」 の違い について教えてください。**\n\nJavaScript もしくは 各プログラミング言語 において、上記を表記する場合は、 \n一般的に、型も含まれていると判断して良いのでしょうか?\n\n> ・数字の1 → string の '1' \n> ・数値の1 → integer の 1 \n> ・数値文字列の1 → string の '1'\n\nあるいは、「数字」「数値」は日本語表記の問題なので、型とは無関係?\n\nもしくは、使う人や文脈によって異なる?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T00:28:04.030",
"favorite_count": 0,
"id": "10860",
"last_activity_date": "2015-06-02T13:33:04.037",
"last_edit_date": "2015-06-02T05:12:23.713",
"last_editor_user_id": "8335",
"owner_user_id": "7886",
"post_type": "question",
"score": 0,
"tags": [
"プログラミング言語"
],
"title": "JavaScript もしくは プログラミング における 数字 と 数値 の違い",
"view_count": 12208
} | [
{
"body": "`もしくは、使う人や文脈によって異なる?`\n\n概ね。その理解で構いません。\n\n例えば「C言語プログラミングなるほど実験室」のようなテキストブックでは \n「数値」「数字(文字コードで表現するもの)」「数字列(文字列のうち数字だけで構成されているもの)」と分けて説明しています。\n\n例えばブラウザのフォーム入力は「数値」と表現されていても。一般的に、サーバー側では、文字列をパースして、それが「数字だろう/数字のはずだ」と処理します。逆に、ブラウザに表示された1桁の数字が「数値」なのか「数字」なのか「1文字だけの数字列」なのか。そんなのユーザーは意識しません。\n\n意識が低いと齟齬も起こしやすくなります。 \n例えば「数値を入力する」という場合に、-1,234,567.89\nという入力は、正しいのか正しくないのか。そういう揉め事がおきたりもします。また上記テキストブックの「数字」も内部的には「数値」でしかありません。\n\nこのように、意味自体が通用しても。見る(使う)立場によって、その意味が有用かどうか、意識するかどうかが別なのです。\n\nそれから実際には「定義の強弱」も問題になります。 \n例えば『Float型の数字』と **話し言葉の範囲で**\n伝えても怒鳴る人は、そうそういないでしょう。数字や数値が曖昧なのに対して、Float型が扱えるものは、ちゃんと定義されているからです。 \nこの場合、Float型がFloat型として処理する話である分には、全く問題ありません。別の型が影響してくると問題となる事例が発生するかもしれませんが。\n\nドキュメントには、まず真っ先に、この部分の定義を書け。と指導された経験があります。 \n型やクラスの概念が通用するのであれば「○○型で処理できるもの」とか「標準変換関数で対応する。対応できないものについては、都度説明する」みたいな記述も見たことがあります。\n\n私からは、こんな回答です。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T04:28:29.730",
"id": "10873",
"last_activity_date": "2015-06-02T04:28:29.730",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8335",
"parent_id": "10860",
"post_type": "answer",
"score": 2
},
{
"body": "日本語の言葉の意味合い的に分かれていますが、JS上での規定はありません。 \n数字と数値は混同されることが多いですね。\n\n数字(Number) = 数を表示するための文字(記号)。つまり文字列です。 \n'1'以外にも'一'や'壱'、'Ⅰ'も該当します。\n\n数値(Numeric value) = 数その物の値。例えばparseInt()の結果や(5*3)といった計算結果等の \n数を表す概念で表示形式は関係しません。\n\nこれだけだと文字列型と数値型に分かれているように見えますが、 \n1でも表示の意味で使えば'1'と同じように数字と呼びますし、その逆もありえます。 \nこういった使い方によって呼び方が違う部分が混同に拍車をかけていると思います。\n\n問題になりそうであれば前もって定義しておいたほうがいいでしょう。\n\n> デジタル大辞泉の解説 \n> すう‐じ【数字】 \n> 1 数を表すのに用いる記号や文字。アラビア数字(「1、2」など)・ローマ数字(「Ⅰ、Ⅱ」など)・漢数字(「一、二」など)の類。 \n> 2 統計・成績・計算など、数字によって表される事柄。「―に強い」「―がものを言う」 \n> 3 数個の文字。\n>\n> すう‐ち【数値】 \n> 1 計算や、計量・計測をして得られた数。 \n> 2 文字式の中の文字に当てはまる具体的な数。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T09:10:56.487",
"id": "10895",
"last_activity_date": "2015-06-02T09:10:56.487",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9262",
"parent_id": "10860",
"post_type": "answer",
"score": 2
},
{
"body": "「数字の1」はソースコード中の1という文字をイメージします \n1でも\"1\"でも/1/でも数字の1が含まれています",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T13:33:04.037",
"id": "10905",
"last_activity_date": "2015-06-02T13:33:04.037",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5721",
"parent_id": "10860",
"post_type": "answer",
"score": 0
}
] | 10860 | 10895 | 10873 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "pythonでwebアプリをつくったり、実用レベルまで独学でがんばろうと思います。\n\nPythonスタートブック \nみんなのPython 第3版\n\nはすべてコードも打ち込みました。 \nですがまだイマイチ何かを作れる気がしません。\n\n次はどういったものをやったほうがよいのでしょうか? \nお願い致します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T00:37:08.163",
"favorite_count": 0,
"id": "10861",
"last_activity_date": "2015-06-03T00:34:42.687",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9957",
"post_type": "question",
"score": 0,
"tags": [
"python"
],
"title": "pythonの独学の勉強順について",
"view_count": 1371
} | [
{
"body": "何か作りたいものを決めて、挑戦してみてはどうでしょうか? \nwebアプリをpythonで作りたいなら、djangoフレームワークを学ぶのが良いと思います。\n\n<https://www.djangoproject.com/>",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T05:43:50.933",
"id": "10880",
"last_activity_date": "2015-06-02T05:43:50.933",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9529",
"parent_id": "10861",
"post_type": "answer",
"score": 3
},
{
"body": "まずはやりたいことやるというのが大前提ですが、\n\n勉強する目的はなんなのでしょうか? \nつまり、職業としてプログラマーになることなのでしょうか?それとも趣味のプログラミングで他人の目に触れるところにプログラムを発表することなのでしょうか?\n\n少なくとも、趣味でプログラミングをする場合、サーバーサイド方面に進むのはあまりよろしくない気がします。というのは、今はサーバを用意しやすくなったとはいえ、他人に使ってもらうサーバをセットアップするのはプログラミング以外の要素がかなり多く、それに煩わされているという感覚を持つと続かなくなってしまうように思うので。\n\nでは何が、というと、アプリケーションのプラグインなんかが手軽に始められてすぐ結果が見えて、フィードバックが受けやすくモチベーション維持につながりやすいようにおもいます。\n\nではどのアプリケーションがオススメ?ということになるかと思うのですが、最初に言ったとおり自分でやってみたいものをやるのがいいとは思いますが、個人的な興味としては\n\nQGIS \n<http://qgis.org/ja/site/index.html>\n\nとかですかね",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T00:34:42.687",
"id": "10917",
"last_activity_date": "2015-06-03T00:34:42.687",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8136",
"parent_id": "10861",
"post_type": "answer",
"score": 0
}
] | 10861 | null | 10880 |
{
"accepted_answer_id": "10889",
"answer_count": 2,
"body": "ネットワーク初学者です。よろしくお願いします。 \nubuntu 15.04 をデスクトップOSとして使用しています。 \nこれをクライアントとし、Windowsファイルサーバー \n(Windows server2003)にアクセスして、共有フォルダを \n参照できるようにするにはどうすればいいのでしょうか。\n\nよろしくおねがいします。",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T00:51:26.897",
"favorite_count": 0,
"id": "10863",
"last_activity_date": "2015-06-02T07:38:50.683",
"last_edit_date": "2015-06-02T05:51:08.427",
"last_editor_user_id": "9403",
"owner_user_id": "9403",
"post_type": "question",
"score": 2,
"tags": [
"linux",
"network",
"ubuntu"
],
"title": "ubuntu クライアントからWindowsファイルサーバーにつなぎたい",
"view_count": 31743
} | [
{
"body": "cifs-utils を利用します。\n\n```\n\n sudo apt-get install cifs-utils\n \n```\n\nマウントポイントを作成します。\n\n```\n\n sudo mkdir /mnt/server-share\n \n```\n\nマウントします。\n\n```\n\n sudo mount -t cifs //[Windows Server Ip Addr]/[共有名] /mnt/server-share -o username=[Windows Serverのユーザー名],password=[Windows Serverのパスワード],uid=[ubuntuユーザーのuid],gid=[ubuntuユーザーのgid]\n \n```\n\nアクセスします。\n\n```\n\n ls -al /mnt/server-share\n \n```\n\nマウント解除します。\n\n```\n\n sudo umount /mnt/server-share \n \n```\n\ngoogle等で「ubuntu windows ファイル共有 cifs-util」あたりで検索するといろいろヒットするので参照ください。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T07:27:12.977",
"id": "10888",
"last_activity_date": "2015-06-02T07:27:12.977",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7343",
"parent_id": "10863",
"post_type": "answer",
"score": 1
},
{
"body": "ファイルマネージャ(という名称で正しいのかよくわかりませんが)を起動するとウィンドウ左側のメニューの一番下に「Connect to\nServer」という項目があります。これを選び、入力欄に\n\n```\n\n smb://198.51.100.1\n \n```\n\nなどと入力すれば共有フォルダに接続できます。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T07:38:50.683",
"id": "10889",
"last_activity_date": "2015-06-02T07:38:50.683",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "10863",
"post_type": "answer",
"score": 2
}
] | 10863 | 10889 | 10889 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "以下のソースのように自作のナビゲーションバーのボタンからTableビューを編集モードに切り替えております。しかし、editButtonを使った時は編集モードになる、左に赤いボタンが出てくるアニメーションがありましたが、この方法だとなくなってしまいました。アニメーションを付ける方法はありますか?\n\n```\n\n let anotherButton:UIBarButtonItem = UIBarButtonItem(title: \"Show\", style: UIBarButtonItemStyle.Plain, target: self, action: \"openMenu:\")\n \n self.navigationItem.rightBarButtonItem = anotherButton;\n \n func openMenu(sender: UIBarButtonItem) {\n \n self.setEditing(editing, animated: true)\n \n editing = !editing\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T03:55:55.767",
"favorite_count": 0,
"id": "10869",
"last_activity_date": "2017-08-18T06:01:48.500",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8060",
"post_type": "question",
"score": 2,
"tags": [
"swift",
"uitableview"
],
"title": "editButtonItemを使わずにTableViewをアニメーション付きで編集モードにしたい",
"view_count": 711
} | [
{
"body": "> self.setEditing(editing, animated: true)\n\nこの部分を以下のコードでアニメションがある編集モードになると思います\n\n> self.tableView.setEditing(b animated:true)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-11T08:10:10.120",
"id": "11254",
"last_activity_date": "2015-06-11T08:10:10.120",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9558",
"parent_id": "10869",
"post_type": "answer",
"score": 1
},
{
"body": "フラグを用意するのはどうでしょうか?\n\n```\n\n var flag = false\n \n let anotherButton:UIBarButtonItem = UIBarButtonItem(title: \"Show\", style: UIBarButtonItemStyle.Plain, target: self, action: \"openMenu:\")\n \n func openMenu(sender: UIBarButtonItem) {\n if flag{\n flag = false\n }else{\n flag = true\n }\n self.tableView.setEditing(flag, animated: flag)\n tableView.isEditing = flag\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2017-08-18T06:01:48.500",
"id": "37305",
"last_activity_date": "2017-08-18T06:01:48.500",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "19781",
"parent_id": "10869",
"post_type": "answer",
"score": 0
}
] | 10869 | null | 11254 |
{
"accepted_answer_id": null,
"answer_count": 3,
"body": "Monacaでスマホのアプリを作っています。\n\nある会場図をPDFで表示させたいのですが、どのようにさせたらよいでしょうか?\n\n試しに下記にしてみたら、Couldn't load plug-in が表示されました。\n\n```\n\n <ons-page>\n <object data=\"img/map.pdf\" id=\"info_map\" type=\"application/pdf\">/object>\n </ons-page>\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 4.0",
"creation_date": "2015-06-02T04:45:43.483",
"favorite_count": 0,
"id": "10875",
"last_activity_date": "2022-10-04T00:58:32.593",
"last_edit_date": "2022-10-04T00:58:32.593",
"last_editor_user_id": "3060",
"owner_user_id": "9675",
"post_type": "question",
"score": 2,
"tags": [
"monaca",
"onsen-ui"
],
"title": "スマホアプリでPDFを表示させたい",
"view_count": 4277
} | [
{
"body": "対象がiOSだけであれば[Inappbrowserプラグイン](http://docs.monaca.mobi/cur/ja/reference/phonegap_34/ja/inappbrowser/)を使えば開けると思います。 \nAndroidもサポートするのであればちょっと難易度が上がりそうですね。\n\n---- Androidユーザーではないため、以下全て動作未確認です -----\n\nこんな感じにしてGoogleDocsで開くなどの方法があるようです(詳細は下記の参考リンクを参照してください)。\n\n```\n\n window.open(encodeURI('https://docs.google.com/gview?embedded=true&url=<pdfuri>'), '_blank', 'location=yes,EnableViewPortScale=yes')\n \n```\n\nまた、まだbeta版のようですが[cordova-plugin-document-\nviewer](https://github.com/sitewaerts/cordova-plugin-document-\nviewer)はAndroidもサポートしているみたいです。\n\n参考:[Not able to launch a pdf file in inappbrowser in\nandroid](https://stackoverflow.com/questions/26304729/not-able-to-launch-a-\npdf-file-in-inappbrowser-in-android)\n\nローカルのPDFを開くのであれば[FileOpener](https://github.com/don/FileOpener)とかを使用すると良さそうです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T06:53:02.227",
"id": "10885",
"last_activity_date": "2015-06-02T06:53:02.227",
"last_edit_date": "2017-05-23T12:38:56.467",
"last_editor_user_id": "-1",
"owner_user_id": "3516",
"parent_id": "10875",
"post_type": "answer",
"score": 1
},
{
"body": "ご回答をありがとうございます。\n\nAndroidで出来ました。\n\nただ、ローカルのPDFを開きたいので、FileOpenerを試してみようと思いますが、ちょっと敷居が高そうです。\n\nありがとうございます。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T08:09:33.267",
"id": "10940",
"last_activity_date": "2015-06-03T08:09:33.267",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9675",
"parent_id": "10875",
"post_type": "answer",
"score": 1
},
{
"body": "もしMonacaのwebview内にpdfを表示したいのであればMozillaの[PDF.js](https://mozilla.github.io/pdf.js/)が使えるかもしれません。\n\nただ、webviewは[limited\nsupport](https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-\nQuestions#faq-support)のようです。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T11:16:50.120",
"id": "10948",
"last_activity_date": "2015-06-03T11:16:50.120",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "2376",
"parent_id": "10875",
"post_type": "answer",
"score": 1
}
] | 10875 | null | 10885 |
{
"accepted_answer_id": "10883",
"answer_count": 1,
"body": "Windowsのバッチファイルで、指定した時刻に処理を開始し、数秒ごとに同じ処理を繰り返す方法を教えてください。\n\nここではiperfを使っており、下記のようなスクリプトを考えました。 \n本当は00秒になったら起動するようにしたいですが、方法がわかりませんので15時に \nなったら起動するように書いています\n\n自動起動スクリプト\n\n```\n\n pause\n pause\n cd c:\\aaa\n at 15:00 /every:M,T,W,Th,F,S,Su c:\\aaa\\iperf.bat\n pause \n \n```\n\n数秒毎に同じ処理を繰り返すスクリプトiperf.bat\n\n```\n\n :top\n timeout 5\n iperf -c 10.0.0.3 -t 5\n \n goto top\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T05:36:29.343",
"favorite_count": 0,
"id": "10879",
"last_activity_date": "2015-06-02T06:01:35.203",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7590",
"post_type": "question",
"score": 1,
"tags": [
"windows",
"batch-file",
"iperf"
],
"title": "Windowsのバッチファイルで、指定した時刻に処理を開始し、数秒ごとに同じ処理を繰り返す方法",
"view_count": 5220
} | [
{
"body": "「指定した時刻に処理を開始」であれば、Windowsの「タスクスケジューラ」を使えるのではないかと思います。 \nWindows7であれば、「コントロールパネル」⇒「管理ツール」⇒「タスクスケジューラ」にありますよ(管理者権限が必要です)。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T06:01:35.203",
"id": "10883",
"last_activity_date": "2015-06-02T06:01:35.203",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9888",
"parent_id": "10879",
"post_type": "answer",
"score": 2
}
] | 10879 | 10883 | 10883 |
{
"accepted_answer_id": "11399",
"answer_count": 2,
"body": "RubyMineを使い始めたばかりで何か設定が足りていないのかもしれませんが、画像のように`before_save`の名前解決ができず警告が出されてしまいます。\n\n\n\nRails自体は正常に動いておりますが、どこを調べればエラーを修正できるでしょうか?\n\n### 追記\n\n`before_save`だけでなく`before_action`にも同様のエラーが出ます。また環境はrbenvを用いて`2.1.4`を使っています。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T06:07:29.303",
"favorite_count": 0,
"id": "10884",
"last_activity_date": "2015-06-16T07:31:40.937",
"last_edit_date": "2015-06-04T02:34:48.817",
"last_editor_user_id": "3271",
"owner_user_id": "3271",
"post_type": "question",
"score": 1,
"tags": [
"ruby-on-rails",
"ruby",
"rubymine"
],
"title": "RubyMineで `before_save`が未定義だとされてしまう。",
"view_count": 506
} | [
{
"body": "僕自身はこういう警告に遭遇したことはないのですが、ありそうな原因を考えてみます。\n\nRubyのバージョン管理は何を使われていますか?rvm? rbenv? \nrbenvの場合、`.ruby-version`ファイルをプロジェクトのルートディレクトリに置いてますか? \nもしなければ作成して適切なRubyのバージョンを指定し、RubyMineを再起動してください。 \n(rvmは最近使っていないのでわかりません)\n\nそれでもおかしい場合はPreferenceで現在使用中のRubyバージョンを確認してください。 \n異様に古いバージョンが選択されたりしていませんか? \n\n\nRubyのバージョンが適切であればもう一度RubyMine上からbundle installしてみてください。 \n(シフトキーを2回押して \"bundle\" と入力すれば install コマンドが選択できます)\n\nbundle installが正常に完了すると、しばらくの間インデックスの再構築が実行されます。(画面の下の方に表示されているはずです) \n再構築が完了したときに何かエラーメッセージは表示されませんか? \n特に何も起きなければ正常にインストールできたはずです。\n\nそれでもダメな場合はRubyMineのHelpをじっくり読んで、自分の環境で何かおかしなところはないか調べるぐらいしかないかなーと思います。\n\n<https://www.jetbrains.com/ruby/help/rails.html>\n\n以上ご参考までに。\n\n## 追記\n\nrbenvはどうやってインストールしましたか? Homebrew経由だった場合はシンボリックリンクの設定が必要になるようです。\n\n[RubyMineでHomebrewを使ってインストールしたrbenvを認識させる -\nQiita](http://qiita.com/otukutun/items/8029ad994bc516308ccd)",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T20:01:48.520",
"id": "10913",
"last_activity_date": "2015-06-04T02:42:06.440",
"last_edit_date": "2015-06-04T02:42:06.440",
"last_editor_user_id": "85",
"owner_user_id": "85",
"parent_id": "10884",
"post_type": "answer",
"score": 1
},
{
"body": "内部的に何かがおかしくなっていたのか該当のバージョンのRubyを再インストールしたら認識されるようになりました。\n\n以下のコマンドで修復しました。\n\n```\n\n rbenv uninstall 2.1.4\n rbenv install 2.1.4\n gem i bundle \n bundle\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-16T07:31:40.937",
"id": "11399",
"last_activity_date": "2015-06-16T07:31:40.937",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3271",
"parent_id": "10884",
"post_type": "answer",
"score": 0
}
] | 10884 | 11399 | 10913 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "以下の関数を使ってパスワードを暗号化&復号化をしたいのですが、vendorフォルダにCrypt.php \nとしてCryptクラスを作り、Controllerから\n\n```\n\n App::uses('Crypt', 'Vendor');\n \n```\n\nを呼び出しても、Securityクラスが見つかりませんとなってしまいます。 \nどのようにすればうまくいきますでしょうか。\n\n```\n\n class Crypt {\n static public function encrypt($text) {\n return base64_encode(Security::rijndael($text, Configure::read('constants.crypt_key'), 'encrypt'));\n }\n \n static public function decrypt($text) {\n return Security::rijndael(base64_decode($text), Configure::read('constants.crypt_key'), 'decrypt');\n }\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T07:06:43.957",
"favorite_count": 0,
"id": "10886",
"last_activity_date": "2015-06-03T04:11:50.943",
"last_edit_date": "2015-06-02T13:19:16.267",
"last_editor_user_id": "8000",
"owner_user_id": "8619",
"post_type": "question",
"score": 1,
"tags": [
"php",
"cakephp"
],
"title": "cakephpの暗号化復号化について",
"view_count": 1373
} | [
{
"body": "コントローラ内でコンポーネントを定義してみたらいかがでしょうか。\n\n> public $components = [ 'Security' ];",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T13:01:12.333",
"id": "10904",
"last_activity_date": "2015-06-02T13:01:12.333",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "1046",
"parent_id": "10886",
"post_type": "answer",
"score": 1
},
{
"body": "CryptがSecurityクラスに依存しているので\n\nCrypt.phpのクラス定義の前に\n\n`App::uses('Security', 'Utility');`\n\nを追記してください。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T04:11:50.943",
"id": "10932",
"last_activity_date": "2015-06-03T04:11:50.943",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "2668",
"parent_id": "10886",
"post_type": "answer",
"score": 2
}
] | 10886 | null | 10932 |
{
"accepted_answer_id": "10910",
"answer_count": 2,
"body": "Ruby初心者です。\n\nいくつかのWebアプリケーションフレームワークでは、サーバー起動後(boot時)や停止前(Ctrl+Cを押された場合など)にユーザーのカスタム処理を書くフックポイントが用意されていると思いますが、 \nRuby on Railsで同様のことがしたい場合のベストプラクティスはありますでしょうか? \n以下のサイトなどを見るとできそうではありますが、あまり正式な方法ではないように思います。 \n<http://guides.rubyonrails.org/initialization.html>\n\n複数サーバーでのスケールアウトが主流の世の中で、サーバーインスタンスの起動、停止にフックして処理すること自体、あまり必要性がないのかもしれませんが、参考までに質問です。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T07:22:22.297",
"favorite_count": 0,
"id": "10887",
"last_activity_date": "2015-06-03T02:49:29.957",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9260",
"post_type": "question",
"score": 1,
"tags": [
"ruby-on-rails",
"ruby"
],
"title": "Ruby on Railsでサーバー起動後と停止前に処理を書く場合のベストプラクティスを教えてください。",
"view_count": 2290
} | [
{
"body": "コメントより\n\n起動通知だけなら config/initializers配下でも良いと思いますが。 \n残念ながらconfig/finalizersのようなものがありません。\n\nベストプラクティスというのは、なかなか難しいものですが。 \n私の場合は、よくこういうrakeタスクを書きます。\n\n```\n\n [lib/tasks/server.rake]\n namespace :server do\n desc '[auto-pilot] Server Start'\n task start: :environment do\n # ここにサーバー起動前処理\n ` ここに サーバー起動コマンド `\n end\n desc '[auto-pilot] Server Stop'\n task stop: :environment do\n # ここにサーバー終了前処理\n ` ここに サーバー終了コマンド `\n end\n end\n \n $ rake server start\n $ rake server stop\n \n```\n\n一連のタスクの中でサーバー起動/終了だけ外部コマンド実行にする感じです。 \nrakeタスク化するのであれば「サーバー起動前処理」など1つ1つをタスク化して、単独でも呼べるようにしつつ一連実行のタスクを提供するというのが正しい気がします(私はstart/stopだけでサボりますが)。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T15:54:47.323",
"id": "10910",
"last_activity_date": "2015-06-02T15:54:47.323",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8335",
"parent_id": "10887",
"post_type": "answer",
"score": 1
},
{
"body": "at_exitを利用すればfinalizerのようなものができると思います。\n\n```\n\n config/initializers/任意のファイル.rb\n \n at_exit do\n puts '*** Stopped! ***'\n end\n \n```\n\n[参考] \n- <https://stackoverflow.com/questions/5545000/how-to-launch-a-thread-at-the-start-of-a-rails-app-and-terminate-it-at-stop> \n- <https://stackoverflow.com/questions/1610573/shutdown-hook-for-rails>",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T02:49:29.957",
"id": "10927",
"last_activity_date": "2015-06-03T02:49:29.957",
"last_edit_date": "2017-05-23T12:38:55.307",
"last_editor_user_id": "-1",
"owner_user_id": "9608",
"parent_id": "10887",
"post_type": "answer",
"score": 2
}
] | 10887 | 10910 | 10927 |
{
"accepted_answer_id": "10893",
"answer_count": 1,
"body": "例えばPHP 5.4.39で以下の様なコードを実行すると\n\n```\n\n $data = file_get_contents('https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=');\n var_dump($data);\n \n```\n\n期待している動作では、以下のjsonが返ってくると思っています。\n\n```\n\n {\n \"error\": \"invalid_token\",\n \"error_description\": \"Invalid Value\"\n }\n \n```\n\nところが、`bool(false)`となりデータが取得出来ません。 \nブラウザでアクセスした場合は問題がありません。 \n試しにUser-Agentを指定した場合でも挙動に変化はありませんでした。\n\nちなみに\n\n```\n\n $data = file_get_contents('http://www.yahoo.co.jp/');\n \n```\n\nとした場合には、問題無くHTMLが取得出来ております。\n\n対応方法としては`cURL`で実装すれば問題無いことはわかっていますが、 \nなぜ`file_get_contents()`で出来ないのか知りたいところです。 \n恐らくGoogleの場合だけこの問題が発生しております。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T08:11:07.033",
"favorite_count": 0,
"id": "10890",
"last_activity_date": "2015-06-02T08:52:11.583",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7306",
"post_type": "question",
"score": 1,
"tags": [
"php"
],
"title": "file_get_contents() を使ってGoogleのAPIからデータを取得出来ない",
"view_count": 4582
} | [
{
"body": "> ブラウザでアクセスした場合は問題がありません。\n\nブラウザでアクセスした場合もhttp statusは400で返ってきてると思います。 \nfile_get_contents() は既定値では http statusが400番台500番台のときはコンテンツを取得しません。 \n以下のようにすることでエラー時もコンテンツを取得するようになります。\n\n```\n\n $opt = array(\"http\" => array('ignore_errors' => true));\n $data = file_get_contents('https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=', false, stream_context_create($opt));\n var_dump($data);\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T08:52:11.583",
"id": "10893",
"last_activity_date": "2015-06-02T08:52:11.583",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7343",
"parent_id": "10890",
"post_type": "answer",
"score": 2
}
] | 10890 | 10893 | 10893 |
{
"accepted_answer_id": "11183",
"answer_count": 2,
"body": "LubuntuにChromeとFirefoxがインストールしてあります。 \n既定のブラウザをFirefoxからChromeに変更するにはどうしたらよいでしょうか? \nThunderbird(メーラー)でメールに記述されているURLをクリックしたら、Chromeが起動するようにしたいです。\n\n以下は、思い当たるところを調査した内容です。\n\n## # ブラウザの設定内容\n\nFirefoxの設定を見ると、Firefoxが既定のブラウザになっています。 \nChromeの設定を見ると、既定ブラウザの欄に「Google Chrome\nでは既定のブラウザを判断または設定できません。」と表示され、既定のブラウザに変更するボタンは見当たりませんでした。\n\n## # LXSession configration の設定内容\n\nメニュー>設定>LXSessionのデフォルトアプリケーション \n \nWebbrowserにはChromeが設定されています。\n\n## # update-alternatives --config x-www-browser\n\n```\n\n $ sudo update-alternatives --config x-www-browser\n alternative x-www-browser (/usr/bin/x-www-browser を提供) には 2 個の選択肢があります。\n \n 選択肢 パス 優先度 状態\n ------------------------------------------------------------\n * 0 /usr/bin/google-chrome-stable 200 自動モード\n 1 /usr/bin/firefox 40 手動モード\n 2 /usr/bin/google-chrome-stable 200 手動モード\n \n 現在の選択 [*] を保持するには Enter、さもなければ選択肢の番号のキーを押してください: 0\n \n```\n\n## # Lubuntu バージョン\n\n```\n\n $ lsb_release -a\n No LSB modules are available.\n Distributor ID: Ubuntu\n Description: Ubuntu 15.04\n Release: 15.04\n Codename: vivid\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T08:39:23.903",
"favorite_count": 0,
"id": "10892",
"last_activity_date": "2015-06-09T12:02:10.027",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9529",
"post_type": "question",
"score": 1,
"tags": [
"linux",
"google-chrome",
"ubuntu",
"firefox"
],
"title": "Lubuntuでchromeを既定のブラウザにしたい",
"view_count": 6913
} | [
{
"body": "現在ですと <https://archlinuxjp.kusakata.com/wiki/Xdg-open> あたりを参考に、\n\n```\n\n xdg-mime default google-chrome.desktop x-scheme-handler/http\n xdg-mime default google-chrome.desktop x-scheme-handler/https\n xdg-mime default google-chrome.desktop text/html\n \n```\n\nを実行して環境変数 `BROWSER` も設定しておけば、たいていの環境でうまくいくと思われます。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-09T08:16:28.590",
"id": "11175",
"last_activity_date": "2015-06-09T08:16:28.590",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3054",
"parent_id": "10892",
"post_type": "answer",
"score": 3
},
{
"body": "Lubuntuのデスクトップ環境であるLXDEでデフォルトアプリケーションを設定するのはLXSession configrationで行います。\n\nメニュー>設定>LXSessionのデフォルトアプリケーション\n\n\n\nまた、xdg-mimeコマンドを使ってデフォルトアプリケーションの設定や、設定内容の確認も可能です。\n\nデフォルトブラウザの設定\n\n```\n\n xdg-mime default google-chrome.desktop x-scheme-handler/http\n xdg-mime default google-chrome.desktop x-scheme-handler/https\n xdg-mime default google-chrome.desktop text/html\n \n```\n\nデフォルトブラウザの確認\n\n```\n\n xdg-mime query default text/html\n xdg-mime query default x-scheme-handler/http\n xdg-mime query default x-scheme-handler/https\n \n```\n\nただ、Thunderbird(メーラー)でメールに記述されているURLをクリックした時に起動されるブラウザの設定はLXDEとは別で、Thuderbird固有の環境設定になります。\n\n\n\n参考サイト \n<http://rest.seesaa.net/article/195829185.html> \n<http://www.nishishi.com/blog/2014/06/thunderbird_bro.html> \n※参考サイトの画像はWindowsの物になりますが、Linuxでもほぼ同様です。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-09T11:27:58.867",
"id": "11183",
"last_activity_date": "2015-06-09T12:02:10.027",
"last_edit_date": "2015-06-09T12:02:10.027",
"last_editor_user_id": "9529",
"owner_user_id": "9529",
"parent_id": "10892",
"post_type": "answer",
"score": 1
}
] | 10892 | 11183 | 11175 |
{
"accepted_answer_id": "10908",
"answer_count": 2,
"body": "下記の様なコードでボタン毎に読み込むjsonオブジェクトを切り替えて、画像を読み込みたいのですが、そもそもそういった事は可能でしょうか?\n\n```\n\n $(document).ready(function(){\r\n $('button').on('click', function(this){\r\n $.ajax({\r\n type: 'GET',\r\n url: 'data-url.json',\r\n datatype: 'json',\r\n success: function(json) {\r\n $.each(json, function(i, activity) {\r\n var imgUrl = activity[i].img;\r\n $('#output1').append('<img src=' + imgUrl + '>');\r\n })\r\n },\r\n error: function() {\r\n console.log('error');\r\n }\r\n });\r\n });\r\n });\n```\n\n```\n\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>\r\n \r\n <button data-attr=\"sports\">Load More</button>\r\n <button data-attr=\"workshop\">Load More</button>\r\n <button data-attr=\"culture\">Load More</button>\r\n \r\n <div id=\"output1\"></div>\r\n <div id=\"output2\"></div>\r\n <div id=\"output3\"></div>\n```\n\n```\n\n [{\r\n \"sports\" : [\r\n {\"name\" : \"soccer\", \"img\" : \"aaa.jpg\"},\r\n {\"name\" : \"baseball\", \"img\" : \"aaa.jpg\"},\r\n {\"name\" : \"tennis\", \"img\" : \"aaa.jpg\"},\r\n {\"name\" : \"swimming\", \"img\" : \"aaa.jpg\"}\r\n ]\r\n },\r\n {\r\n \"workshop\" : [\r\n {\"name\" : \"Traditional Craft\", \"img\" : \"bbb.jpg\"},\r\n {\"name\" : \"Ikebana\", \"img\" : \"bbb.jpg\"},\r\n {\"name\" : \"Washi\", \"img\" : \"bbb.jpg\"},\r\n {\"name\" : \"Miso Making\", \"img\" : \"bbb.jpg\"}\r\n ]\r\n },\r\n {\r\n \"culture\" : [\r\n {\"name\" : \"Zen\", \"img\" : \"ccc.jpg\"},\r\n {\"name\" : \"Ninja\", \"img\" : \"ccc.jpg\"},\r\n {\"name\" : \"Kimono\", \"img\" : \"ccc.jpg\"},\r\n {\"name\" : \"Cat Cafe\", \"img\" : \"ccc.jpg\"}\r\n ]\r\n }]\n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T09:07:40.620",
"favorite_count": 0,
"id": "10894",
"last_activity_date": "2019-12-13T18:08:35.503",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8500",
"post_type": "question",
"score": 2,
"tags": [
"javascript",
"jquery",
"json",
"ajax"
],
"title": "attrによって読み込むajaxを振り分けたい",
"view_count": 525
} | [
{
"body": "`append('<img src=' + imgUrl + '>')`での画像表示は可能です。 \nJSONデータの構造とアクセスの仕方が間違っています。\n\n`getJsonData`は実行確認のためのダミーメソッドです。 \n実際は`success: function(json)`で取れるデータですので適宜読み替えてください。\n\n画像のリンクは存在しないので`alt`属性の文字が表示されますが、正しい画像リンクであれば画像が表示されます。\n\n```\n\n $(document).ready(function(){\r\n $('button').on('click', function(){\r\n activityType = $(this).attr('data-attr');\r\n // JSONデータが取れた前提\r\n json = getJsonData()\r\n // success: function(json)内に書くロジック\r\n $.each(json, function(i, activity) {\r\n if(activityType != activity.type){\r\n return;\r\n }\r\n $.each(activity.list, function(j, list) {\r\n $('#output1').append('<img src=\"' + list.img + '\" alt=\"' + list.name + '\"><br />');\r\n });\r\n });\r\n });\r\n });\r\n \r\n // $.ajax()の代わり\r\n function getJsonData(){\r\n return [\r\n {\r\n \"type\" : \"sports\",\r\n \"list\" : [\r\n {\"name\" : \"soccer\", \"img\" : \"aaa.jpg\"},\r\n {\"name\" : \"baseball\", \"img\" : \"aaa.jpg\"},\r\n {\"name\" : \"tennis\", \"img\" : \"aaa.jpg\"},\r\n {\"name\" : \"swimming\", \"img\" : \"aaa.jpg\"}\r\n ]\r\n },\r\n {\r\n \"type\" : \"workshop\",\r\n \"list\" : [\r\n {\"name\" : \"Traditional Craft\", \"img\" : \"bbb.jpg\"},\r\n {\"name\" : \"Ikebana\", \"img\" : \"bbb.jpg\"},\r\n {\"name\" : \"Washi\", \"img\" : \"bbb.jpg\"},\r\n {\"name\" : \"Miso Making\", \"img\" : \"bbb.jpg\"}\r\n ]\r\n },\r\n {\r\n \"type\" : \"culture\",\r\n \"list\" : [\r\n {\"name\" : \"Zen\", \"img\" : \"ccc.jpg\"},\r\n {\"name\" : \"Ninja\", \"img\" : \"ccc.jpg\"},\r\n {\"name\" : \"Kimono\", \"img\" : \"ccc.jpg\"},\r\n {\"name\" : \"Cat Cafe\", \"img\" : \"ccc.jpg\"}\r\n ]\r\n }\r\n ];\r\n }\n```\n\n```\n\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>\r\n \r\n <button data-attr=\"sports\">Load More</button>\r\n <button data-attr=\"workshop\">Load More</button>\r\n <button data-attr=\"culture\">Load More</button>\r\n \r\n <div id=\"output1\"></div>\r\n <div id=\"output2\"></div>\r\n <div id=\"output3\"></div>\n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T09:58:56.480",
"id": "10898",
"last_activity_date": "2015-06-02T09:58:56.480",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7214",
"parent_id": "10894",
"post_type": "answer",
"score": 1
},
{
"body": "質問に書かれたJSONの場合、各要素には次のようにしてアクセスできます。\n\n```\n\n [ // json\n { // json[0]\n \"sports\" : [ // json[0][\"sports\"]\n {\"name\" : \"soccer\", \"img\" : \"aaa.jpg\"}, // json[0][\"sports\"][0]\n {\"name\" : \"baseball\", \"img\" : \"aaa.jpg\"}, // json[0][\"sports\"][1]\n {\"name\" : \"tennis\", \"img\" : \"aaa.jpg\"},\n {\"name\" : \"swimming\", \"img\" : \"aaa.jpg\"}\n ]\n },\n { // json[1]\n \"workshop\" : [ // json[1][\"workshop\"]\n ...\n \n```\n\nこの場合kotatsuさんの回答のように、配列を順番に見ないと `sports` や `workshop`\nにたどり着けません。代わりに次のようにしてはいかがでしょうか。\n\n```\n\n { // json\n \"sports\" : [ // json[\"sports\"]\n {\"name\" : \"soccer\", \"img\" : \"aaa.jpg\"}, // json[\"sports\"][0]\n {\"name\" : \"baseball\", \"img\" : \"aaa.jpg\"}, // json[\"sports\"][1]\n {\"name\" : \"tennis\", \"img\" : \"aaa.jpg\"},\n {\"name\" : \"swimming\", \"img\" : \"aaa.jpg\"}\n ],\n \"workshop\" : [ // json[\"workshop\"]\n {\"name\" : \"Traditional Craft\", \"img\" : \"bbb.jpg\"}, //json[\"workshop\"][0]\n ...\n \n```\n\nこうしておけば、以下のような流れで達成できるかと思います。\n\n```\n\n var activityType = $(this).attr('data-attr');\n \n // jsonを取得してから、\n var items = json[activityType];\n $.each(items, function(i, item) {\n var imgUrl = item.img;\n ...\n });\n \n```\n\nサンプル <http://jsfiddle.net/njr793vd/3/>\n\n```\n\n var sample = {\r\n \"sports\": [{\r\n \"name\": \"soccer\",\r\n \"img\": \"http://dummyimage.com/20x20/aaa/fff\"\r\n },\r\n {\r\n \"name\": \"baseball\",\r\n \"img\": \"aaa.jpg\"\r\n },\r\n {\r\n \"name\": \"tennis\",\r\n \"img\": \"aaa.jpg\"\r\n },\r\n {\r\n \"name\": \"swimming\",\r\n \"img\": \"aaa.jpg\"\r\n }\r\n ],\r\n \"workshop\": [{\r\n \"name\": \"Traditional Craft\",\r\n \"img\": \"http://dummyimage.com/20x20/afa/fff\"\r\n },\r\n {\r\n \"name\": \"Ikebana\",\r\n \"img\": \"bbb.jpg\"\r\n },\r\n {\r\n \"name\": \"Washi\",\r\n \"img\": \"bbb.jpg\"\r\n },\r\n {\r\n \"name\": \"Miso Making\",\r\n \"img\": \"bbb.jpg\"\r\n }\r\n ],\r\n \"culture\": [{\r\n \"name\": \"Zen\",\r\n \"img\": \"http://dummyimage.com/20x20/ffa/fff\"\r\n },\r\n {\r\n \"name\": \"Ninja\",\r\n \"img\": \"ccc.jpg\"\r\n },\r\n {\r\n \"name\": \"Kimono\",\r\n \"img\": \"ccc.jpg\"\r\n },\r\n {\r\n \"name\": \"Cat Cafe\",\r\n \"img\": \"ccc.jpg\"\r\n }\r\n ]\r\n };\r\n \r\n $('button').on('click', function() {\r\n // 省略しましたが、引数にはEventオブジェクトが渡されます\r\n \r\n // この時点でthisはイベントを受け取った要素\r\n var activityType = $(this).attr('data-attr');\r\n \r\n $.ajax({\r\n type: 'POST',\r\n url: '/echo/json/',\r\n data: {\r\n json: JSON.stringify(sample)\r\n },\r\n // ここまでテスト用の設定\r\n \r\n dataType: 'json',\r\n success: function(json) {\r\n var items = json[activityType];\r\n \r\n $.each(items, function(i, item) {\r\n var imgUrl = item.img;\r\n \r\n // 多少効率は落ちますが、文字列連結ではなく\r\n // 要素生成して属性を設定したほうが安全です\r\n var img = $('<img>').attr('src', imgUrl);\r\n // もし文字列連結でやるなら、\r\n // src=\"...\" のダブルクォートを忘れずに。\r\n \r\n $('#output1').append(img);\r\n })\r\n },\r\n error: function() {\r\n console.log('error');\r\n }\r\n });\r\n });\n```\n\n```\n\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n <button data-attr=\"sports\">Load More</button>\r\n <button data-attr=\"workshop\">Load More</button>\r\n <button data-attr=\"culture\">Load More</button>\r\n \r\n <div id=\"output1\"></div>\n```",
"comment_count": 4,
"content_license": "CC BY-SA 4.0",
"creation_date": "2015-06-02T14:31:43.217",
"id": "10908",
"last_activity_date": "2019-12-13T18:08:35.503",
"last_edit_date": "2019-12-13T18:08:35.503",
"last_editor_user_id": "32986",
"owner_user_id": "8000",
"parent_id": "10894",
"post_type": "answer",
"score": 2
}
] | 10894 | 10908 | 10908 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "CSS3で `transform:translate3d` などつかってアニメーションをした時 \niPhoneだけスクロール時止まってしまいます。\n\niOS6時代でしょうか\n\n```\n\n -webkit-transform-style: preserve-3d;\n \n```\n\nこの指定でなおったみたいですが、現在はダメそうです。\n\nちなみにAndroidだと問題なく動いています。\n\n対応策はあるのでしょうか?\n\nよろしくお願い致します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T09:15:18.883",
"favorite_count": 0,
"id": "10896",
"last_activity_date": "2015-07-03T02:48:19.587",
"last_edit_date": "2015-06-02T10:00:32.893",
"last_editor_user_id": "208",
"owner_user_id": "3786",
"post_type": "question",
"score": 2,
"tags": [
"html",
"css",
"iphone"
],
"title": "CSS3のアニメーションがスクロール時止まってしまう",
"view_count": 378
} | [
{
"body": "iOS8から改善されてたみたいです。\n\niOS7以下はダメみたいです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T01:06:06.197",
"id": "10919",
"last_activity_date": "2015-06-03T01:06:06.197",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3786",
"parent_id": "10896",
"post_type": "answer",
"score": 2
}
] | 10896 | null | 10919 |
{
"accepted_answer_id": "10900",
"answer_count": 1,
"body": "例えば以下のようにいくつかの関数に渡って同じコードを記述する場合、ひとつにまとめてスッキリさせる方法はないのでしょうか? \n詳しい方、ご教示ください。よろしくお願いいたします。\n\n```\n\n <?php\n App::uses('AppController', 'Controller');\n App::uses('Sanitize', 'Utility');\n \n class SampleController extends AppController {\n \n public $components = array('Session');\n public $uses = array('Sample', 'User');\n \n public function index() {\n \n $this -> autoLayout = false;\n \n /*以下のコードが同じ*/\n \n if($this->Session->check('my_id')){\n \n $get_session = $this->Session->read('my_id');\n \n $this->set('get_session_id',$get_session);\n \n } else{\n \n $this->set('get_session_id',false);\n }\n \n }\n \n public function a() {\n \n $this -> autoLayout = false;\n \n if($this->Session->check('my_id')){\n \n $get_session = $this->Session->read('my_id');\n \n $this->set('get_session_id',$get_session);\n \n } else{\n \n $this->set('get_session_id',false);\n }\n \n }\n \n public function b() {\n \n $this -> autoLayout = false;\n if($this->Session->check('my_id')){\n \n $get_session = $this->Session->read('my_id');\n \n $this->set('get_session_id',$get_session);\n \n } else{\n \n $this->set('get_session_id',false);\n }\n \n }\n \n public function c() {\n \n $this -> autoLayout = false;\n \n if($this->Session->check('my_id')){\n \n $get_session = $this->Session->read('my_id');\n \n $this->set('get_session_id',$get_session);\n \n } else{\n \n $this->set('get_session_id',false);\n }\n \n }\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T10:17:02.777",
"favorite_count": 0,
"id": "10899",
"last_activity_date": "2015-06-02T11:01:22.690",
"last_edit_date": "2015-06-02T10:43:42.120",
"last_editor_user_id": "5750",
"owner_user_id": "8619",
"post_type": "question",
"score": 1,
"tags": [
"php",
"cakephp"
],
"title": "cakephp 同じコードをまとめる",
"view_count": 229
} | [
{
"body": "該当箇所を別のメソッドに分離すればよいです。\n\n```\n\n class SampleController extends AppController {\n \n public function index() {\n \n $this->autoLayout = false;\n \n $this->someFunction();\n }\n \n private function someFunction()\n {\n if($this->Session->check('my_id')){\n \n $get_session = $this->Session->read('my_id');\n \n $this->set('get_session_id',$get_session);\n \n } else{\n \n $this->set('get_session_id',false);\n }\n }\n }\n \n```\n\nもし複数のコントローラーで共通化したい場合は`AppController`に定義してください。\n\n## AppController.php\n\n```\n\n class AppController extends Controller\n {\n protected function someFunction()\n {\n }\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T10:48:00.190",
"id": "10900",
"last_activity_date": "2015-06-02T11:01:22.690",
"last_edit_date": "2020-06-17T08:14:45.997",
"last_editor_user_id": "-1",
"owner_user_id": "5750",
"parent_id": "10899",
"post_type": "answer",
"score": 2
}
] | 10899 | 10900 | 10900 |
{
"accepted_answer_id": "10907",
"answer_count": 1,
"body": "あるクラスがAからZまでのメンバ変数を持っている場合、そのメンバ変数全てに値が格納されていることを判定する良い方法はないでしょうか。\n\n```\n\n class Test{\n public String A;\n public String B;\n public List<String> C;\n .\n .\n .\n }\n \n```\n\n上記のようなクラスを判定メソッドhasAllAttributes()を作成する場合\n\n```\n\n boolean hasAllAttributes(){\n if(A == null ||\n B == null ||\n .\n .\n .){\n return false;\n }\n return true;\n }\n \n```\n\nのように判定するしかないのでしょうか。 \nよろしくお願いします。",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T12:29:03.897",
"favorite_count": 0,
"id": "10902",
"last_activity_date": "2015-06-02T14:27:46.507",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9577",
"post_type": "question",
"score": 3,
"tags": [
"java"
],
"title": "メンバ変数全てに値が格納されていることを知る良い方法",
"view_count": 6242
} | [
{
"body": "@BLUEPIXさんの回答より \nClass#getDeclaredFields()で可能である。\n\n先ほどのhasAllAttributes()を改良すると以下になる。\n\n```\n\n boolean hasAllAttributes(){\n for (Field field : this.getClass().getDeclaredFields()) {\n if(field.get(this)==null){\n return false;\n }\n }\n return true;\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T14:27:46.507",
"id": "10907",
"last_activity_date": "2015-06-02T14:27:46.507",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9577",
"parent_id": "10902",
"post_type": "answer",
"score": 5
}
] | 10902 | 10907 | 10907 |
{
"accepted_answer_id": "10916",
"answer_count": 2,
"body": "pythonは以下のように簡潔に範囲の中にいる事が比較できますが、\n\n```\n\n 3 < x < 7\n \n```\n\nscalaではどうやったら綺麗にかけますか?",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-02T22:56:54.310",
"favorite_count": 0,
"id": "10915",
"last_activity_date": "2015-12-09T03:57:14.143",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8355",
"post_type": "question",
"score": 0,
"tags": [
"scala"
],
"title": "範囲の中にあるかどうかの比較の仕方",
"view_count": 459
} | [
{
"body": "綺麗かどうかはわからないけど \n`(4 until 7).contains(x)` \nとは書けます。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T00:30:38.443",
"id": "10916",
"last_activity_date": "2015-06-03T00:30:38.443",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5044",
"parent_id": "10915",
"post_type": "answer",
"score": 0
},
{
"body": "`(4 until 7).contains(x)` \nや \n`(4 to 6).contains(x)` \nと書けます。 \nこの様に書いた場合、内部的には`scala.collection.immutable.Range`の[`contains`メソッド](https://github.com/scala/scala/blob/v2.11.7/src/library/scala/collection/immutable/Range.scala#L333)が呼ばれるので、単に`4\n<= x && x < 7`を実行するのと同じく定数時間で動作します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-12-09T03:57:14.143",
"id": "19785",
"last_activity_date": "2015-12-09T03:57:14.143",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "13581",
"parent_id": "10915",
"post_type": "answer",
"score": 3
}
] | 10915 | 10916 | 19785 |
{
"accepted_answer_id": "10937",
"answer_count": 1,
"body": "最新のRails、Nginxで、SSLを使用しています。BREACH,\nCRIMEのセキュリティ的な問題から、Nginxのgzipをオフにしているのですが、gzip_types で text/css や\napplication/javascript だけなら、利用しても大丈夫なのでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T00:56:24.967",
"favorite_count": 0,
"id": "10918",
"last_activity_date": "2015-06-03T07:31:17.223",
"last_edit_date": "2015-06-03T07:31:10.907",
"last_editor_user_id": "8000",
"owner_user_id": "9860",
"post_type": "question",
"score": 2,
"tags": [
"nginx",
"security"
],
"title": "gzip_types を限定すれば BRACH・CRIME 攻撃を受ける心配はない?",
"view_count": 312
} | [
{
"body": "それらは、「ユーザーが制御可能な文字列」と「秘密の文字列」の両方がレスポンスに含まれる時に、二つの文字列が一致するかどうかで圧縮後のサイズが変化することを利用した攻撃です。\n\nこのような挙動を示すかどうかが重要であり、 **レスポンスの形式は関係ありません** 。動的に生成する場合、 CSS や Javascript\nであっても同様に注意が必要です。\n\nもしあなたが「このMIMEタイプは動的に生成することはない」と言い切れるのであれば、そのような設定でも構わないように思います。\n\n参考 [SSL暗号を無効化する仕組み – BREACH, CRIME, etc | yohgaki's\nblog](http://blog.ohgaki.net/breach-attack-explained-why-and-how)",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T07:31:17.223",
"id": "10937",
"last_activity_date": "2015-06-03T07:31:17.223",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8000",
"parent_id": "10918",
"post_type": "answer",
"score": 1
}
] | 10918 | 10937 | 10937 |
{
"accepted_answer_id": "10928",
"answer_count": 2,
"body": "現在カレンダーの日付をタップするとその日付のセルの色を変更させるプログラムを組んでいます。 \nセルをタップすると`NSMutableArray`に`IndexPath`を入れていき、`cellForItemAtIndexPath`でその`NSMutableArray`にある`IndexPath`のセルの色を変更しています。以下のような感じです。(ちなみにセルをタップすると一度別の画面に遷移する仕様になっています。)\n\n```\n\n - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {\n CalendarCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@\"cell\" forIndexPath:indexPath];\n \n if (self.isCellSelected) {\n \n NSLog(@\"%@\", self.dateArray);\n \n if (self.dateArray.count != 0) {\n for (NSNumber *item in self.dateArray) {\n \n if (indexPath.row == [item intValue]) {\n cell.backgroundColor = [UIColor redColor];\n }\n }\n }\n }\n \n```\n\nしかし、1つのセルの色は変更できるのですが、2つ以上のセルの色を変更しようとすると`if (indexPath.row == [item\nintValue])`の行で`[__NSCFArray intValue]: unrecognized selector sent to\ninstance`というエラーが返ってきてしまいます。...そもそも`NSCFArray`ってなんなのでしょうか? \nエラーが出た後、上記のコードの`NSLog`の箇所で`IndexPath`を格納した`NSMutableArray`のログをとってみると、以下のようになります。\n\n```\n\n (\n (\n 15\n ),\n 16\n )\n \n```\n\n`NSMutableArray`の使い方が間違っているのでしょうか? \n保存は値の保存は以下のようにしています。\n\n```\n\n NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:[ud arrayForKey:@\"array\"], nil];\n [array addObject:[NSNumber numberWithInt:self.selectedIndexPath]];\n \n```\n\n色々と調べたりしたもののどこが間違っているのかがわかりません。 \nどなたか分かる方がいれば教えていただきたいです。すみませんが、よろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T01:38:06.910",
"favorite_count": 0,
"id": "10921",
"last_activity_date": "2015-06-03T03:11:47.867",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5210",
"post_type": "question",
"score": 1,
"tags": [
"objective-c",
"uicollectionview"
],
"title": "[__NSCFArray intValue]: unrecognized selector sent to instance",
"view_count": 170
} | [
{
"body": "`NSMutableArray`のログをとって\n\n```\n\n (\n (\n 15\n ),\n 16\n )\n \n```\n\nこれが出てきた時点でおかしいと思います。 \n本来想定しているのは\n\n```\n\n (\n 15,\n 16\n )\n \n```\n\nではないですか?\n\n```\n\n NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:[ud arrayForKey:@\"array\"], nil];\n \n```\n\n画面遷移時に`UserDefaults`にタップされたセルの情報を`NSArray`で保存しているのだと思いますが、これだと2回目以降が\n\n```\n\n NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:@[@1], nil];\n \n```\n\nこんな感じになるので上手く動かないのだと思います。\n\n・`UserDefaults`にあったら取得してそのまま代入、なかったら通常の初期化 \n・まず初期化して`addObjectsFromArray`で`UserDefaults`の値を追加する\n\n等の方法に変更したら上手く動くのではないでしょうか?\n\n----- 補足 ----- \n`[__NSCFArray intValue]: unrecognized selector sent to\ninstance`が発生しているのは`NSMutableArray`のログを見れば分かると思いますが、\n\n```\n\n for (NSNumber *item in self.dateArray) {\n \n```\n\nで取得している`item`が実際には`NSArray`なので`intValue`を呼ぼうとした時に「そんなの無いよ」と言われています。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T02:50:12.383",
"id": "10928",
"last_activity_date": "2015-06-03T03:05:33.433",
"last_edit_date": "2015-06-03T03:05:33.433",
"last_editor_user_id": "3516",
"owner_user_id": "3516",
"parent_id": "10921",
"post_type": "answer",
"score": 2
},
{
"body": "```\n\n NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:[ud arrayForKey:@\"array\"], nil];\n [array addObject:[NSNumber numberWithInt:self.selectedIndexPath]];\n \n```\n\nこれの1行目を\n\n```\n\n NSMutableArray *array = [[ud arrayForKey:@\"array\"] mutableCopy];\n \n```\n\nに変更すれば、とりあえず原因はわからなくても、解決はすると思います。 \n原因解明については、別回答者さんの説明が詳しいので、ここでは触れません。\n\n> そもそもNSCFArrayってなんなのでしょうか?\n\nそれは「Objective-C **クラスクラスタ** 」をキーワードにして、ネット検索してください。Objective-\nCのクラスの構造は、あなたが想像している以上に、複雑な構造をしていることを、知ることができるでしょう。 \n(「NSCFArray」じゃなくて、「__NSCFArray」です。)",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T03:11:47.867",
"id": "10929",
"last_activity_date": "2015-06-03T03:11:47.867",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7362",
"parent_id": "10921",
"post_type": "answer",
"score": 2
}
] | 10921 | 10928 | 10928 |
{
"accepted_answer_id": "10963",
"answer_count": 2,
"body": "windows7でdokuwikiを使い始めたのですが、日本語のファイルをアップロードすると \n以下に置かれるファイル名が文字化けします。\n\ndokuwiki\\apps\\dokuwiki\\htdocs\\data\\media\n\nアップロードしたファイルを保存する際は、preservefilenamesプラグインを使えば文字化け \nしないことは見つけたのですが、アップロードされたファイル名自身が文字化けしないようにしたいです。アドバイスをいただきたく。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T01:40:23.220",
"favorite_count": 0,
"id": "10922",
"last_activity_date": "2015-06-04T03:26:31.977",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5818",
"post_type": "question",
"score": 0,
"tags": [
"php"
],
"title": "dokuwikiで日本語のファイルをアップロードすると文字化けする。",
"view_count": 1103
} | [
{
"body": "[preservefilenamesプラグインのページ](https://www.dokuwiki.org/ja:plugin:preservefilenames)にメディアファイルの格納の仕組みが書いてありますが、正規化されて格納する仕様になっていると思いますので、これを元のファイル名のまま格納したい、というのであればご自身で改造するなりするしかないと思います。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T01:39:02.020",
"id": "10961",
"last_activity_date": "2015-06-04T01:39:02.020",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9515",
"parent_id": "10922",
"post_type": "answer",
"score": 2
},
{
"body": "<https://github.com/kazmiya/dokuwiki-plugin-\npreservefilenames/blob/8b0cd3fc353ccfefd741685f7b0c548a23841e94/action_angua.php#L367>\n\n```\n\n $class = preg_replace('/[^_\\-a-z0-9]+/i','_',$ext);\n \n```\n\nここを見る限り、小文字の英字および数字 _ と - 以外は _ で置き換えられる様です。ですので @sugiyama-koichi\nさんが仰る様に文字化けではなく正規化ですね。 \nphp が稼働するシステムのエンコーディングが異なる為の処置だと思います。これをやらないと保存出来ない場合もありますので妥当な処置かと思います。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T03:26:31.977",
"id": "10963",
"last_activity_date": "2015-06-04T03:26:31.977",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "440",
"parent_id": "10922",
"post_type": "answer",
"score": 2
}
] | 10922 | 10963 | 10961 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "現在、電卓のアプリを開発しています。が、エラーが発生して進めなくなってしまったため、質問させていただきます。\n\n \nイメージ説明実装したい内容は、このボタンをタップしたときに、どのボタンがタップされたのかを表示するということです。\n\nエラーは以下のような内容です。\n\n> [Calculator.ViewController buttonTapped:]: unrecognized selector sent to\n> instance 0x7988fea0\n\nbuttonTappedメソッドが認識できないと言われてしまっています。 \n誤字脱字は確認したので、そちらは問題ないように思われます。認識できないのか、わかりません、、、。\n\nソースコード以下になります。 \n// \n// ViewController.swift \n// Calculator \n//\n\n```\n\n import UIKit\n \n class ViewController: UIViewController {\n \n //計算結果を表示するラベルを宣言\n var resultLabel = UILabel()\n let xButtonCount = 4 //一行に配置するボタンの数\n let yButtonCount = 4\n //画面の横幅サイズを格納するメンバ変数\n let screenWidth:Double = Double(UIScreen.mainScreen().bounds.size.width)\n //画面の縦\n let screenHeight:Double = Double(UIScreen.mainScreen().bounds.size.height)\n //ボタン間の余白\n let buttonMargin = 10.0\n //計算結果表示\n var resultArea = 0.0\n \n override func viewDidLoad() {\n super.viewDidLoad()\n //画面全体の縦幅に応じて計算結果表示エリアの縦幅を決定\n switch screenHeight{\n case 480:\n resultArea = 200.0\n case 568:\n resultArea = 250.0\n case 667:\n resultArea = 300.0\n case 736: \n resultArea = 350.0\n default:\n resultArea = 0.0\n }\n //計算結果のラベル\n resultLabel.frame = CGRect(x:10, y:30, width:screenWidth-20, height:resultArea-30)\n \n let buttonLabels = [\n \"7\",\"8\",\"9\",\"×\",\n \"4\",\"5\",\"6\",\"-\",\n \"1\",\"2\",\"3\",\"+\",\n \"0\",\"C\",\"÷\",\"=\"\n ]\n \n for var y=0; y<yButtonCount; y++ {\n for var x=0; x<xButtonCount; x++ {\n //計算機のボタン作成\n var button = UIButton()\n //ボタンの横幅\n var buttonWidth = (screenWidth - (buttonMargin * (Double(xButtonCount)+1)))/Double(xButtonCount)\n //ボタンの縦幅\n var buttonHeight = (screenHeight - resultArea - ((buttonMargin*Double(yButtonCount)+1)))/Double(yButtonCount)\n //ボタンのx座標\n var buttonPositionX = (screenWidth - buttonMargin) / Double(xButtonCount) * Double(x) + buttonMargin\n //ボタンのy座標\n var buttonPositionY = (screenHeight - resultArea - buttonMargin) / Double(yButtonCount) * Double(y) + buttonMargin + resultArea\n //ボタンの配置、サイズ\n button.frame = CGRect(x:buttonPositionX, y:buttonPositionY, width:buttonWidth, height:buttonHeight)\n //背景\n button.backgroundColor = UIColor.greenColor()\n //ボタンのラベルタイトル\n var buttonNumber = y * xButtonCount + x\n //ボタンのラベルタイトルを取り出すインデックス番号\n button.setTitle(buttonLabels[buttonNumber],forState: UIControlState.Normal)\n //ボタンタップ時のアクション\n button.addTarget(self, action: \"buttonTapped:\", forControlEvents: UIControlEvents.TouchUpInside)\n //ボタン配置\n self.view.addSubview(button)\n }\n }\n \n //計算結果ラベル設定する\n resultLabel.backgroundColor = UIColor.grayColor()\n resultLabel.font = UIFont(name:\"Arial\", size: 50)\n resultLabel.textAlignment = NSTextAlignment.Right\n resultLabel.numberOfLines = 4\n resultLabel.text = \"0\"\n \n //計算結果ラベルをviewcontrollerクラスのviewに設置\n self.view.addSubview(resultLabel)\n \n //ボタンタップメソッド\n func buttonTapped(sender:UIButton){\n var tappedButtonTitle:String = sender.titleLabel!.text!\n println(\"\\(tappedButtonTitle)ボタンがタップされました\")\n }\n }\n \n override func didReceiveMemoryWarning() {\n super.didReceiveMemoryWarning()\n // Dispose of any resources that can be recreated.\n }\n \n }\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T04:06:12.540",
"favorite_count": 0,
"id": "10931",
"last_activity_date": "2015-06-04T23:32:41.860",
"last_edit_date": "2015-06-04T23:32:41.860",
"last_editor_user_id": "5519",
"owner_user_id": "9427",
"post_type": "question",
"score": 0,
"tags": [
"ios",
"swift"
],
"title": "Swiftで電卓アプリ開発",
"view_count": 3477
} | [
{
"body": "buttonTapped メソッド内の、\n\n```\n\n var tappedButtonTitle: String = sender.currentTitle!\n \n```\n\nというステートメントを、以下のように変更してみてはいかがでしょう?\n\n```\n\n var tappedButtonTitle: String = sender.titleLabel!.text\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T05:36:46.760",
"id": "10934",
"last_activity_date": "2015-06-03T05:36:46.760",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9833",
"parent_id": "10931",
"post_type": "answer",
"score": 1
},
{
"body": "アクションメソッド`buttonTapped(sender: UIButton)`の実装を記述する場所を間違えてますね。\n\n```\n\n import UIKit\n \n class ViewController: UIViewController {\n \n //計算結果を表示するラベルを宣言\n var resultLabel = UILabel()\n let xButtonCount = 4 //一行に配置するボタンの数\n let yButtonCount = 4\n //画面の横幅サイズを格納するメンバ変数\n let screenWidth:Double = Double(UIScreen.mainScreen().bounds.size.width)\n //画面の縦\n let screenHeight:Double = Double(UIScreen.mainScreen().bounds.size.height)\n //ボタン間の余白\n let buttonMargin = 10.0\n //計算結果表示\n var resultArea = 0.0\n \n override func viewDidLoad() {\n super.viewDidLoad()\n //画面全体の縦幅に応じて計算結果表示エリアの縦幅を決定\n switch screenHeight{\n case 480:\n resultArea = 200.0\n case 568:\n resultArea = 250.0\n case 667:\n resultArea = 300.0\n case 736: \n resultArea = 350.0\n default:\n resultArea = 0.0\n }\n //計算結果のラベル\n resultLabel.frame = CGRect(x:10, y:30, width:screenWidth-20, height:resultArea-30)\n \n let buttonLabels = [\n \"7\",\"8\",\"9\",\"×\",\n \"4\",\"5\",\"6\",\"-\",\n \"1\",\"2\",\"3\",\"+\",\n \"0\",\"C\",\"÷\",\"=\"\n ]\n \n for var y=0; y<yButtonCount; y++ {\n for var x=0; x<xButtonCount; x++ {\n //計算機のボタン作成\n var button = UIButton()\n //ボタンの横幅\n var buttonWidth = (screenWidth - (buttonMargin * (Double(xButtonCount)+1)))/Double(xButtonCount)\n //ボタンの縦幅\n var buttonHeight = (screenHeight - resultArea - ((buttonMargin*Double(yButtonCount)+1)))/Double(yButtonCount)\n //ボタンのx座標\n var buttonPositionX = (screenWidth - buttonMargin) / Double(xButtonCount) * Double(x) + buttonMargin\n //ボタンのy座標\n var buttonPositionY = (screenHeight - resultArea - buttonMargin) / Double(yButtonCount) * Double(y) + buttonMargin + resultArea\n //ボタンの配置、サイズ\n button.frame = CGRect(x:buttonPositionX, y:buttonPositionY, width:buttonWidth, height:buttonHeight)\n //背景\n button.backgroundColor = UIColor.greenColor()\n //ボタンのラベルタイトル\n var buttonNumber = y * xButtonCount + x\n //ボタンのラベルタイトルを取り出すインデックス番号\n button.setTitle(buttonLabels[buttonNumber],forState: UIControlState.Normal)\n //ボタンタップ時のアクション\n button.addTarget(self, action: \"buttonTapped:\", forControlEvents: UIControlEvents.TouchUpInside)\n //ボタン配置\n self.view.addSubview(button)\n }\n }\n \n //計算結果ラベル設定する\n resultLabel.backgroundColor = UIColor.grayColor()\n resultLabel.font = UIFont(name:\"Arial\", size: 50)\n resultLabel.textAlignment = NSTextAlignment.Right\n resultLabel.numberOfLines = 4\n resultLabel.text = \"0\"\n \n //計算結果ラベルをviewcontrollerクラスのviewに設置\n self.view.addSubview(resultLabel)\n \n }\n \n override func didReceiveMemoryWarning() {\n super.didReceiveMemoryWarning()\n // Dispose of any resources that can be recreated.\n }\n \n //ボタンタップメソッド(viewDidLoad()メソッド内から、ここに移動)\n func buttonTapped(sender:UIButton){\n var tappedButtonTitle:String = sender.titleLabel!.text\n println(\"\\(tappedButtonTitle)ボタンがタップされました\")\n }\n }\n \n```",
"comment_count": 7,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T06:48:21.660",
"id": "10972",
"last_activity_date": "2015-06-04T06:48:21.660",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7362",
"parent_id": "10931",
"post_type": "answer",
"score": 1
}
] | 10931 | null | 10934 |
{
"accepted_answer_id": null,
"answer_count": 3,
"body": "class=\"n2\"からclass=\"n1\"に移動する際、滑らかにスーッと移動させたいのですが、うまくいきません。 \n今は、かくかくしています。 \njsでclassを変更してcssのpositionで位置をズラしているのですが、滑らかに移動(変更)させるには、どこにどのように書いたらよいでしょうか。ご教示の程よろしくお願いいたします。\n\n<https://jsfiddle.net/Lennxhjc/1/>\n\n```\n\n $(function() {\r\n var $wrapper = $('.wrapper');\r\n var classNameList = [\r\n 'n5', 'n4', 'n3', 'n2', 'n1',\r\n /*'n6', 'n7', 'n8', 'n9'*/\r\n ];\r\n setInterval(function() {\r\n var nodes = classNameList.map(function(className) {\r\n return {\r\n className: className,\r\n $node: $wrapper.find('.' + className)\r\n };\r\n });\r\n var nodes3 = new Array(classNameList.length);\r\n for (var i = 0; i < classNameList.length; i++) {\r\n \r\n var name = classNameList[i];\r\n nodes3[i] = {\r\n $node: $wrapper.find('.' + name),\r\n className: name\r\n }\r\n }\r\n nodes.forEach(function(current, currentIndex, whole) {\r\n var nextIndex = (currentIndex === whole.length - 1) ? 0 : currentIndex + 1;\r\n current.$node.removeClass(current.className);\r\n current.$node.addClass(whole[nextIndex].className);\r\n });\r\n }, 5000);\r\n })();\n```\n\n```\n\n #slide {\r\n width: 320px;\r\n margin: 0 auto;\r\n text-align: center;\r\n }\r\n \r\n #slide ul {\r\n position: relative;\r\n height: 300px;\r\n }\r\n \r\n #slide li {\r\n position: absolute;\r\n overflow: hidden;\r\n width: 320px;\r\n margin: 0 auto;\r\n text-align: center;\r\n background: #FFF;\r\n }\r\n \r\n #slide .n1 {\r\n /* アニメーション前はn2と同じ大きさ・位置にしておく */\r\n bottom: 0;\r\n z-index: 10;\r\n opacity: 1;\r\n }\r\n \r\n #slide .n2 {\r\n bottom: 18%;\r\n z-index: 9;\r\n opacity: 1;\r\n }\r\n \r\n #slide .n3 {\r\n bottom: 30%;\r\n z-index: 8;\r\n opacity: 0.9;\r\n }\r\n \r\n #slide .n4 {\r\n bottom: 40%;\r\n z-index: 7;\r\n opacity: 0.7;\r\n }\r\n \r\n #slide .n5 {\r\n bottom: 50%;\r\n z-index: 6;\r\n opacity: 0.4;\r\n }\r\n \r\n #slide .n1 img {\r\n width: 100%;\r\n }\r\n \r\n #slide .n2 img {\r\n width: 83%;\r\n }\r\n \r\n #slide .n3 img {\r\n width: 73%;\r\n }\r\n \r\n #slide .n4 img {\r\n width: 63%;\r\n }\r\n \r\n #slide .n5 img {\r\n width: 53%;\r\n }\r\n \r\n \r\n /* img仮の設定 */\r\n \r\n img {\r\n background: #ccc;\r\n width: 50px;\r\n height: 70px;\r\n }\r\n \r\n \r\n /* 3秒止めてから2秒かけてscaleoutのkeyframesを実行(足して5秒)。jsの5秒と同じ。 */\r\n \r\n .n1 {\r\n -webkit-animation: scaleout 2.0s ease-in-out 3.0s;\r\n animation: scaleout 2.0s ease-in-out 3.0s;\r\n }\r\n \r\n \r\n /* n1を1.5倍に拡大して消す */\r\n \r\n @-webkit-keyframes scaleout {\r\n 0% {\r\n -webkit-transform: scale(1.0)\r\n }\r\n 100% {\r\n -webkit-transform: scale(1.5);\r\n opacity: 0;\r\n }\r\n }\r\n \r\n @keyframes scaleout {\r\n 0% {\r\n transform: scale(1.0);\r\n -webkit-transform: scale(1.0);\r\n }\r\n 100% {\r\n transform: scale(1.5);\r\n -webkit-transform: scale(1.5);\r\n opacity: 0;\r\n }\r\n }\n```\n\n```\n\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js\"></script>\r\n <div id=\"slide\">\r\n <ul class=\"wrapper\">\r\n <li class=\"n1\">\r\n <img src=\"img/01.jpg\" width=\"\" height=\"\" alt=\"\">\r\n </li>\r\n \r\n <li class=\"n2\">\r\n <img src=\"img/02.jpg\" width=\"\" height=\"\" alt=\"\">\r\n </li>\r\n \r\n <li class=\"n3\">\r\n <img src=\"img/03.jpg\" width=\"\" height=\"\" alt=\"\">\r\n </li>\r\n \r\n <li class=\"n4\">\r\n <img src=\"img/04.jpg\" width=\"\" height=\"\" alt=\"\">\r\n </li>\r\n \r\n <li class=\"n5\">\r\n <img src=\"img/05.jpg\" width=\"\" height=\"\" alt=\"\">\r\n </li>\r\n </ul>\r\n </div>\n```",
"comment_count": 0,
"content_license": "CC BY-SA 4.0",
"creation_date": "2015-06-03T04:15:05.603",
"favorite_count": 0,
"id": "10933",
"last_activity_date": "2019-12-13T18:01:33.307",
"last_edit_date": "2019-12-13T18:01:33.307",
"last_editor_user_id": "32986",
"owner_user_id": "8745",
"post_type": "question",
"score": 3,
"tags": [
"javascript",
"jquery"
],
"title": "jQueryまたはJSまたはcss3のanimationで滑らかに移動させるには?",
"view_count": 3184
} | [
{
"body": "アニメーションしながらクラスを変更するのは難しそうな気がしたので、ちょっと違う感じでやってみました。 \nCSSの設定値をjavascriptにも書かないといけないので良い処理とは言えないかも知れませんが、参考になれば幸いです。\n\n```\n\n $(function() {\r\n var $wrapper = $('.wrapper');\r\n var idList = [\r\n '#n1', '#n5', '#n4', '#n3', '#n2'\r\n ];\r\n var indexArray = [4, 3, 2, 1, 0];\r\n var attrIndex = 0;\r\n var attrList = [\r\n {\r\n bottom: 0,\r\n 'z-index': 10,\r\n opacity: 1\r\n },\r\n {\r\n bottom: '18%',\r\n 'z-index': 9,\r\n opacity: 1\r\n },\r\n {\r\n bottom: '30%',\r\n 'z-index': 8,\r\n opacity: 0.9\r\n },\r\n {\r\n bottom: '40%',\r\n 'z-index': 7,\r\n opacity: 0.7\r\n },\r\n {\r\n bottom: '50%',\r\n 'z-index': 6,\r\n //opacity: 0.4\r\n }\r\n ];\r\n var childAttrList = [\r\n {width: '100%'},\r\n {width: '83%'},\r\n {width: '73%'},\r\n {width: '63%'},\r\n {width: '53%'}\r\n ];\r\n \r\n // webkitAnimationEndを使用する例\r\n var move = function() {\r\n var aIndex = attrIndex;\r\n attrIndex = (attrIndex === idList.length - 1) ? 0 : attrIndex + 1;\r\n var nodes = idList.map(function(id) {\r\n return {\r\n $node: $wrapper.find(id)\r\n };\r\n });\r\n nodes.forEach(function(current, currentIndex, whole) {\r\n var index = indexArray[aIndex];\r\n // 移動中は見えなくする場合はこの辺で調整する\r\n if (index === 4) current.$node.css({opacity:0});\r\n $('img', current.$node).animate(childAttrList[index], 1000);\r\n current.$node.animate(attrList[index], 1000, function() {\r\n // 移動中は見えなくする場合はこの辺で調整する\r\n if (index === 4) current.$node.animate({opacity:0.4}, 500);\r\n current.$node.removeClass('animate');\r\n if (index === 0) {\r\n animate(current.$node);\r\n }\r\n });\r\n aIndex = (aIndex === whole.length - 1) ? 0 : aIndex + 1;\r\n });\r\n }\r\n var animate = function(obj) {\r\n obj.one('animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd', function () {\r\n move();\r\n });\r\n obj.addClass('animate');\r\n }\r\n // 最初の1回を実行\r\n animate($('#n1'));\r\n /* \r\n // setIntervalを使用する例\r\n var move = function(isFirst) {\r\n var aIndex = attrIndex;\r\n attrIndex = (attrIndex === idList.length - 1) ? 0 : attrIndex + 1;\r\n var nodes = idList.map(function(id) {\r\n return {\r\n $node: $wrapper.find(id)\r\n };\r\n });\r\n nodes.forEach(function(current, currentIndex, whole) {\r\n var index = indexArray[aIndex];\r\n // 移動中は見えなくする場合はこの辺で調整する\r\n if (!isFirst && index === 4) current.$node.css({opacity:0});\r\n $('img', current.$node).animate(childAttrList[index], 1000);\r\n current.$node.animate(attrList[index], 1000, function() {\r\n // 移動中は見えなくする場合はこの辺で調整する\r\n if (!isFirst && index === 4) current.$node.animate({opacity:0.4}, 500);\r\n current.$node.removeClass('animate');\r\n if (index === 0) {\r\n current.$node.addClass('animate');\r\n }\r\n });\r\n aIndex = (aIndex === whole.length - 1) ? 0 : aIndex + 1;\r\n });\r\n }\r\n // 待ち時間が長いので最初の1回を実行\r\n move(true);\r\n setInterval(function() { move(false) }, 5100);\r\n */\r\n });\n```\n\n```\n\n #slide {\r\n width: 320px;\r\n margin: 0 auto;\r\n text-align: center;\r\n }\r\n #slide ul {\r\n position: relative;\r\n height: 300px;\r\n padding: 0;\r\n list-style-type: none;\r\n }\r\n #slide li {\r\n position: absolute;\r\n overflow: hidden;\r\n width: 320px;\r\n margin: 0 auto;\r\n text-align: center;\r\n background: #fff;\r\n }\r\n #slide #n1 {\r\n bottom: 0;\r\n z-index: 10;\r\n opacity: 1;\r\n }\r\n #slide #n1 img {\r\n width: 100%;\r\n }\r\n #slide #n2 {\r\n bottom: 18%;\r\n z-index: 9;\r\n opacity: 1;\r\n }\r\n #slide #n2 img {\r\n width: 83%;\r\n }\r\n #slide #n3 {\r\n bottom: 30%;\r\n z-index: 8;\r\n opacity: 0.9;\r\n }\r\n #slide #n3 img {\r\n width: 73%;\r\n }\r\n #slide #n4 {\r\n bottom: 40%;\r\n z-index: 7;\r\n opacity: 0.7;\r\n }\r\n #slide #n4 img {\r\n width: 63%;\r\n }\r\n #slide #n5 {\r\n bottom: 50%;\r\n z-index: 6;\r\n opacity: 0.4;\r\n }\r\n #slide #n5 img {\r\n width: 53%;\r\n }\r\n img {\r\n background: #ccc;\r\n width: 50px;\r\n height: 70px;\r\n }\r\n /* 3秒止めてから2秒かけてscaleoutのkeyframesを実行(足して5秒)。jsの5秒と同じ。 */\r\n .animate {\r\n -webkit-animation: scaleout 2s ease-in-out 3s;\r\n animation: scaleout 2s ease-in-out 3s;\r\n }\r\n /* n1を1.5倍に拡大して消す */\r\n @-webkit-keyframes scaleout {\r\n 0% {\r\n -webkit-transform: scale(1);\r\n }\r\n 100% {\r\n -webkit-transform: scale(1.5);\r\n opacity: 0;\r\n }\r\n }\r\n @-moz-keyframes scaleout {\r\n 0% {\r\n transform: scale(1);\r\n -webkit-transform: scale(1);\r\n }\r\n 100% {\r\n transform: scale(1.5);\r\n -webkit-transform: scale(1.5);\r\n opacity: 0;\r\n }\r\n }\r\n @-webkit-keyframes scaleout {\r\n 0% {\r\n transform: scale(1);\r\n -webkit-transform: scale(1);\r\n }\r\n 100% {\r\n transform: scale(1.5);\r\n -webkit-transform: scale(1.5);\r\n opacity: 0;\r\n }\r\n }\r\n @-o-keyframes scaleout {\r\n 0% {\r\n transform: scale(1);\r\n -webkit-transform: scale(1);\r\n }\r\n 100% {\r\n transform: scale(1.5);\r\n -webkit-transform: scale(1.5);\r\n opacity: 0;\r\n }\r\n }\r\n @keyframes scaleout {\r\n 0% {\r\n transform: scale(1);\r\n -webkit-transform: scale(1);\r\n }\r\n 100% {\r\n transform: scale(1.5);\r\n -webkit-transform: scale(1.5);\r\n opacity: 0;\r\n }\r\n }\n```\n\n```\n\n <div id=\"slide\">\r\n <ul class=\"wrapper\">\r\n <li id=\"n1\"><img src=\"\" alt=\"イメージ1\"/></li>\r\n <li id=\"n2\"><img src=\"\" alt=\"イメージ2\"/></li>\r\n <li id=\"n3\"><img src=\"\" alt=\"イメージ3\"/></li>\r\n <li id=\"n4\"><img src=\"\" alt=\"イメージ4\"/></li>\r\n <li id=\"n5\"><img src=\"\" alt=\"イメージ5\"/></li>\r\n </ul>\r\n </div>\r\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\n```",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T09:17:28.030",
"id": "10942",
"last_activity_date": "2015-09-09T02:05:18.530",
"last_edit_date": "2015-09-09T02:05:18.530",
"last_editor_user_id": "3516",
"owner_user_id": "3516",
"parent_id": "10933",
"post_type": "answer",
"score": 1
},
{
"body": "この辺のライブラリを使われると簡単だと思います。 \n<http://ricostacruz.com/jquery.transit/>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T13:01:29.620",
"id": "10954",
"last_activity_date": "2015-06-03T13:01:29.620",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9982",
"parent_id": "10933",
"post_type": "answer",
"score": -1
},
{
"body": "cssのanimationなら、transformを変化させると滑らかです。 \nz軸の移動をさせれば、重なり順もちゃんとシミュレートされます。 \nループする仕組みもjsより簡素・安全に書けるのでおすすめです。\n\n```\n\n body {\r\n overflow: hidden;\r\n }\r\n .wrapper {\r\n position: relative;\r\n width: 200px;\r\n margin: 1em auto;\r\n list-style: none;\r\n transform-style: preserve-3d;\r\n perspective: 500px;\r\n }\r\n .wrapper li {\r\n background-color: rgba(100,200,100,1);\r\n color: #fff;\r\n width: 100%;\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n text-align: center;\r\n line-height: 2;\r\n transform-origin: center top 0px;\r\n animation: maenideru 30s infinite both;\r\n }\r\n .wrapper li:nth-of-type(1) {\r\n animation-delay: -24s;\r\n }\r\n .wrapper li:nth-of-type(2) {\r\n animation-delay: -18s;\r\n }\r\n .wrapper li:nth-of-type(3) {\r\n animation-delay: -12s;\r\n }\r\n .wrapper li:nth-of-type(4) {\r\n animation-delay: -6s;\r\n }\r\n .wrapper li:nth-of-type(5) {\r\n animation-delay: 0s;\r\n }\r\n @keyframes maenideru {\r\n 0%,10% {\r\n transform: translateZ(-250px);\r\n opacity: 0;\r\n }\r\n 15%,30% {\r\n transform: translateZ(-200px) translateY(1em);\r\n }\r\n 35%,50% {\r\n transform: translateZ(-150px) translateY(2em);\r\n }\r\n 55%,70% {\r\n transform: translateZ(-100px) translateY(3em);\r\n }\r\n 75%,90% {\r\n transform: translateZ(-50px) translateY(4em);\r\n }\r\n 95% {\r\n transform: translateZ(0px) translateY(5em);\r\n opacity: 1;\r\n }\r\n 100% {\r\n transform: translateZ(100px) translateY(4em);\r\n opacity: 0;\r\n }\r\n }\n```\n\n```\n\n <ul class=\"wrapper\">\r\n <li>イメージ1</li>\r\n <li>イメージ2</li>\r\n <li>イメージ3</li>\r\n <li>イメージ4</li>\r\n <li>イメージ5</li>\r\n </ul>\n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-10-11T16:12:07.047",
"id": "17537",
"last_activity_date": "2015-10-11T16:12:07.047",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "12727",
"parent_id": "10933",
"post_type": "answer",
"score": 2
}
] | 10933 | null | 17537 |
{
"accepted_answer_id": "10939",
"answer_count": 1,
"body": "1.2345678901234567890123456789012 * 9.8765432109876543210987654321098\n\n32桁同士の小数を掛け算したときに、32桁で答えを表示するにはどうしたら良いですか?",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T06:55:40.883",
"favorite_count": 0,
"id": "10936",
"last_activity_date": "2015-06-03T07:55:45.727",
"last_edit_date": "2015-06-03T07:29:37.187",
"last_editor_user_id": "9596",
"owner_user_id": "9596",
"post_type": "question",
"score": 0,
"tags": [
"ruby"
],
"title": "rubyで小数の掛け算。桁指定。",
"view_count": 252
} | [
{
"body": "```\n\n require 'bigdecimal'\n n = BigDecimal.new(\"1.2345678901234567890123456789012\",32)\n n2 = BigDecimal.new(\"9.8765432109876543210987654321098\",32)\n n.mult(n2,32).to_s #=> \"12.193263113702179522618503273386\"\n \n```\n\nでいかがでしょうか。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T07:55:45.727",
"id": "10939",
"last_activity_date": "2015-06-03T07:55:45.727",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9403",
"parent_id": "10936",
"post_type": "answer",
"score": 2
}
] | 10936 | 10939 | 10939 |
{
"accepted_answer_id": "10957",
"answer_count": 1,
"body": "iOSのアプリケーション開発で現在Setting Bundleによる、アプリ設定画面の作成を行っています。 \nトグルスイッチのON/OFFの切り替えで、表示されているテキストフィールドやラベルの表示のON/OFFを切り替える為には、Root.plistでどのような設定を行えばよいのでしょうか?\n\n【作りたい動作】 \n・トグルスイッチ[ON/OFF] \n{ \n・項目A \n・項目B \n・項目C \n・項目D \n} \n※トグルスイッチがOFFの時は、{}内を非表示、ONの時は表示する。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T07:37:21.833",
"favorite_count": 0,
"id": "10938",
"last_activity_date": "2017-02-27T06:06:27.160",
"last_edit_date": "2017-02-27T06:06:27.160",
"last_editor_user_id": "5519",
"owner_user_id": "9978",
"post_type": "question",
"score": 1,
"tags": [
"ios",
"xcode"
],
"title": "SettingBundleの特定項目をスイッチのON/OFFで動的に表示/非表示を切り替えたい",
"view_count": 474
} | [
{
"body": "「設定」アプリ内でそういう挙動を実現したい、ということですよね? \n残念ながらできません。Settings Bundleによる「設定」アプリのカスタマイズは静的な構造しかつくれません。\n\nそのような動的な挙動を実現したい場合は、自分のアプリ内にてそのような画面を作る必要があります。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T17:42:59.810",
"id": "10957",
"last_activity_date": "2015-06-03T17:42:59.810",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5519",
"parent_id": "10938",
"post_type": "answer",
"score": 2
}
] | 10938 | 10957 | 10957 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "Androidで実装中に、以下のようなExceptionが発生します。\n\n```\n\n FATAL EXCEPTION: main\n Process: \"アプリ名\", PID: 19962\n java.lang.RuntimeException: Unable to instantiate receiver \"ClassA\": java.lang.InstantiationException: can't instantiate class \"ClassA\"\n at android.app.ActivityThread.handleReceiver(ActivityThread.java:2441)\n at android.app.ActivityThread.access$1700(ActivityThread.java:144)\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1322)\n at android.os.Handler.dispatchMessage(Handler.java:102)\n at android.os.Looper.loop(Looper.java:212)\n at android.app.ActivityThread.main(ActivityThread.java:5137)\n at java.lang.reflect.Method.invokeNative(Native Method)\n at java.lang.reflect.Method.invoke(Method.java:515)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)\n at dalvik.system.NativeStart.main(Native Method)\n Caused by: java.lang.InstantiationException: can't instantiate class \"ClassA\"\n at java.lang.Class.newInstanceImpl(Native Method)\n at java.lang.Class.newInstance(Class.java:1208)\n at android.app.ActivityThread.handleReceiver(ActivityThread.java:2436)\n ... 10 more\n \n```\n\nソースコード \nBroadcastReceiver\n\n```\n\n public abstract class ClassA extends BroadcastReceiver {\n \n public ClassA() {\n super();\n }\n \n @Override\n public final void onReceive(final Context context, final Intent intent) {\n String actionName = intent.getAction();\n if (actionName.equals(\"A\")) {\n }\n }\n }\n \n```\n\n送信元\n\n```\n\n public static void sendBroadcast(final Context context, Serializable obj) {\n \n Intent intent = new Intent();\n intent.setAction(\"A\");\n intent.putExtra(\"key\", obj);\n \n context.sendBroadcast(intent);\n }\n \n```\n\nマニフェスト\n\n```\n\n <receiver android:name=\".ClassA\" >\n <intent-filter>\n <action android:name=\"android.intent.action.PACKAGE_REPLACED\" />\n <data android:scheme=\"package\" />\n </intent-filter>\n <intent-filter>\n <action android:name=\"A\" />\n </intent-filter>\n </receiver>\n \n```\n\nIntentにSerializableをimplementsしたクラスをputExtraして送信しています。 \n端末はAndroid 4.4.4を使用しています。\n\n対処法がわかる方教えていただけないでしょうか。 \nよろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T09:54:26.433",
"favorite_count": 0,
"id": "10944",
"last_activity_date": "2015-06-03T11:16:15.697",
"last_edit_date": "2015-06-03T10:08:01.463",
"last_editor_user_id": "9936",
"owner_user_id": "9936",
"post_type": "question",
"score": 1,
"tags": [
"android",
"java"
],
"title": "Androidでjava.lang.RuntimeException: Unable to instantiate receiver",
"view_count": 1890
} | [
{
"body": "クラスの宣言が抽象クラスだからです。\n\nJavaの基礎的な話として、抽象クラスはインスタンス化できません。\n\n```\n\n public class ClassA extends BroadcastReceiver\n \n```\n\n`abstract`にする必然性がなければ、クラスの宣言を上のようにすれば解決します。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T11:16:15.697",
"id": "10947",
"last_activity_date": "2015-06-03T11:16:15.697",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5337",
"parent_id": "10944",
"post_type": "answer",
"score": 2
}
] | 10944 | null | 10947 |
{
"accepted_answer_id": "10955",
"answer_count": 1,
"body": "マウスストーカーのアナログ時計が気に入ってカスタマイズしています。 \nふと気になった箇所があって希望通りに修正しようといろいろ試したのですが、 \nうまくいきません。 \n\"付け消しボタン\"で _消しているとき_ は、\"色付けボタン\"も _水面下で機能しないように \nする_には、どうすればいいでしょうか?\n\nボタンの記号は、次の通りです。 \n・C=clock color(全体の色) \n・D=date color \n・F=face color \n・H=hours color \n・M=minutes color \n・S=seconds color\n\nなお、全体のソースコードは、次の通りです。\n\n```\n\n <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n <html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=shift_jis\"> \n \n <TITLE>妖怪クロック(アナログ) - JavaScript</TITLE>\n \n <style type=\"text/css\">\n <!--\n .butt{\n BACKGROUND:maroon; \n COLOR:gold;\n }\n //-->\n </style>\n \n \n <BODY bgcolor=\"black\" text=\"white\">\n \n <div id=\"clock\" style=\"visibility:hidden\">\n <div id=\"Od\" style=\"position:absolute;top:0px;left:0px\">\n <div style=\"position:relative\">\n </div>\n </div>\n \n <div id=\"Of\" style=\"position:absolute;top:0px;left:0px\">\n <div style=\"position:relative\">\n </div>\n </div>\n \n <div id=\"Oh\" style=\"position:absolute;top:0px;left:0px\">\n <div style=\"position:relative\">\n </div>\n </div>\n \n <div id=\"Om\" style=\"position:absolute;top:0px;left:0px\">\n <div style=\"position:relative\">\n </div>\n </div>\n \n <div id=\"Os\" style=\"position:absolute;top:0px;left:0px\">\n <div style=\"position:relative\">\n </div>\n </div>\n </div>\n \n <script type=\"text/javascript\">\n \n // 状態変数>\n var scale = 1;\n var transitionStarted = 0;\n var transitionFrom = 0;\n var transitionTo = 0;\n var transitionDuration = 0;\n \n // サイズの変更を開始する処理\n function changeSIZE(){\n {\n transitionStarted = new Date().getTime();\n transitionFrom = scale;\n transitionTo = 0.5; // 最終的な倍率。状態により変化\n transitionDuration = 400;\n document.getElementById(\"tog1\").value= \"\BIGGER/\";\n }\n if(transitionFrom==0.5){\n transitionTo = 2.5; // 最終的な倍率。状態により変化\n transitionDuration = 400;\n document.getElementById(\"tog1\").value= \"ORIGINAL\";\n }\n if(transitionFrom==2.5){\n transitionTo = 1; // 最終的な倍率。状態により変化\n transitionDuration = 400;\n document.getElementById(\"tog1\").value= \"/LESSER\\";\n }\n }\n \n (function(){\n \"use strict\";\n \n function $(sel)\n {\n return document.getElementById(sel);\n }\n \n function $$(sel)\n {\n if (typeof document.getElementsByClassName === 'undefined')\n {\n return document.getElementsByName(sel);\n }\n return document.getElementsByClassName(sel);\n }\n \n var dCol = '', //date colour.\n sCol = '', //seconds colour.\n mCol = '', //minutes colour.\n hCol = '', //hours colour.\n fCol = '', //face color\n \n ClockHeight = 65,\n ClockWidth = 65,\n ClockFromMouseY = 0,\n ClockFromMouseX = 100,\n d = [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n m = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n date = new Date(),\n day = date.getDate(),\n year = date.getYear() + 1900;\n var TodaysDate = \" \" + d[date.getDay()] + \" \" + day + \" \" + m[date.getMonth()] + \" \" + year;\n var D = TodaysDate.split('');\n var H = '☆☆☆';\n H = H.split('');\n var M = '☆☆☆☆';\n M = M.split('');\n var S = '・・・・・';\n S = S.split('');\n var Face = '1 2 3 4 5 6 7 8 9 10 11 12',\n font = 'Helvetica, Arial, sans-serif',\n size = 1,\n speed = 0.45;\n Face = Face.split(' ');\n var n = Face.length;\n var a = size * 10;\n var ymouse = 0,\n xmouse = 0,\n scrll = 0,\n props = '<span style=\"font-family:' + font + ';font-size:' + size + 'em; color:#' + fCol + '\">',\n props2 = '<span style=\"font-family:' + font + ';font-size:' + size + 'em; color:#' + dCol + '\">';\n var Split = 360 / n;\n var Dsplit = 360 / D.length;\n var HandHeight = ClockHeight / 4.5; \n var HandWidth = ClockWidth / 4.5;\n var HandY = -7,\n HandX = -2.5,\n step = 0.02,\n currStep = 0,\n y = [],\n x = [],\n Y = [],\n X = [],\n Dy = [],\n Dx = [],\n DY = [],\n DX = [];\n var i;\n \n for (i = 0; i < n; i++) \n {\n y[i] = 0;\n x[i] = 0;\n Y[i] = 0;\n X[i] = 0;\n }\n \n for (i = 0; i < D.length; i++) \n {\n Dy[i] = 0;\n Dx[i] = 0;\n DY[i] = 0;\n DX[i] = 0;\n }\n var wrapper = $('clock');\n var html = '';\n // Date wrapper\n \n html = '';\n \n for (i = 0; i < D.length; i++)\n {\n html += '<div class=\"Date\" name=\"Date\" style=\"position:absolute;top:0px;left:0;height:' + a + ';width:' + a + ';text-align:center\">' + props2 + D[i] + '</span></div>';\n }\n $('Od').children[0].innerHTML = html;\n \n // Face wrapper\n \n html = '';\n \n for (i = 0; i < n; i++) \n {\n html += '<div class=\"Face\" name=\"Face\" style=\"position:absolute;top:0px;left:0;height:' + a + ';width:' + a + ';text-align:center\">' + props + Face[i] + '</span></div>';\n }\n $('Of').children[0].innerHTML = html;\n // Hours wrapper\n \n html = '';\n \n for (i = 0; i < H.length; i++)\n {\n html += '<div class=\"Hours\" name=\"Hours\" style=\"position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:' + hCol + ';text-align:center;font-weight:bold\">' + H[i] + '</div>';\n } \n $('Oh').children[0].innerHTML = html;\n // Minute wrapper\n \n html = '';\n \n for (i = 0; i < M.length; i++)\n {\n html += '<div class=\"Minutes\" name=\"Minutes\" style=\"position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:' + mCol + ';text-align:center;font-weight:bold\">' + M[i] + '</div>';\n } \n $('Om').children[0].innerHTML = html;\n // Seconds wrapper\n \n html = '';\n \n for (i = 0; i < S.length; i++)\n {\n html += '<div class=\"Seconds\" name=\"Seconds\" style=\"position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:' + sCol + ';text-align:center;font-weight:bold\">' + S[i] + '</div>';\n } \n $('Os').children[0].innerHTML = html;\n // Mouse move event handler\n \n function Mouse(evnt) \n {\n if (typeof evnt === 'undefined')\n {\n ymouse = event.Y + ClockFromMouseY;\n xmouse = event.X + ClockFromMouseX;\n }\n else\n {\n ymouse = evnt.clientY + ClockFromMouseY;\n xmouse = evnt.clientX + ClockFromMouseX;\n }\n }\n \n document.onmousemove = Mouse;\n \n function ClockAndAssign() \n {\n var time = new Date();\n \n // 状態変更処理\n if(transitionStarted)\n {\n var d = time.getTime() - transitionStarted;\n if (d < transitionDuration)\n {\n scale = transitionFrom + (transitionTo - transitionFrom) * d / transitionDuration;\n }\n else\n {\n // トランジション終了\n scale = transitionTo;\n transitionStarted = 0;\n }\n }\n \n var secs = time.getSeconds();\n var sec = -1.57 + Math.PI * secs / 30;\n var mins = time.getMinutes();\n var min = -1.57 + Math.PI * mins / 30;\n var hr = time.getHours();\n var hrs = -1.575 + Math.PI * hr / 6 + Math.PI * parseInt(time.getMinutes(), 10) / 360;\n $('Od').style.top = window.document.body.scrollTop;\n $('Of').style.top = window.document.body.scrollTop;\n $('Oh').style.top = window.document.body.scrollTop;\n $('Om').style.top = window.document.body.scrollTop;\n $('Os').style.top = window.document.body.scrollTop;\n \n for (i = 0; i < n; i++)\n {\n var F = $$('Face')[i];\n F.style.top = y[i] + scale * ClockHeight * Math.sin(-1.0471 + i * Split * Math.PI / 180) + scrll;\n F.style.left = x[i] + scale * ClockWidth * Math.cos(-1.0471 + i * Split * Math.PI / 180);\n }\n \n for (i = 0; i < H.length; i++)\n {\n var HL = $$('Hours')[i];\n HL.style.top = y[i] + HandY + scale * (i * HandHeight) * Math.sin(hrs) + scrll;\n HL.style.left = x[i] + HandX + scale * (i * HandWidth) * Math.cos(hrs);\n }\n \n for (i = 0; i < M.length; i++)\n {\n var ML = $$('Minutes')[i].style;\n ML.top = y[i] + HandY + scale * (i * HandHeight) * Math.sin(min) + scrll;\n ML.left = x[i] + HandX + scale * (i * HandWidth) * Math.cos(min);\n }\n \n for (i = 0; i < S.length; i++)\n {\n var SL = $$('Seconds')[i].style;\n SL.top = y[i] + HandY + scale * (i * HandHeight) * Math.sin(sec) + scrll;\n SL.left = x[i] + HandX + scale * (i * HandWidth) * Math.cos(sec);\n }\n \n for (i = 0; i < D.length; i++)\n {\n var DL = $$('Date')[i].style;\n DL.top = Dy[i] + scale * ClockHeight * 1.5 * Math.sin(currStep + i * Dsplit * Math.PI / 180) + scrll;\n DL.left = Dx[i] + scale * ClockWidth * 1.5 * Math.cos(currStep + i * Dsplit * Math.PI / 180);\n }\n currStep -= step;\n }\n \n function Delay() \n {\n scrll = 0;\n Dy[0] = Math.round(DY[0] += ((ymouse) - DY[0]) * speed);\n Dx[0] = Math.round(DX[0] += ((xmouse) - DX[0]) * speed);\n \n for (i = 1; i < D.length; i++) {\n Dy[i] = Math.round(DY[i] += (Dy[i - 1] - DY[i]) * speed);\n Dx[i] = Math.round(DX[i] += (Dx[i - 1] - DX[i]) * speed);\n }\n y[0] = Math.round(Y[0] += ((ymouse) - Y[0]) * speed);\n x[0] = Math.round(X[0] += ((xmouse) - X[0]) * speed);\n \n for (i = 1; i < n; i++) {\n y[i] = Math.round(Y[i] += (y[i - 1] - Y[i]) * speed);\n x[i] = Math.round(X[i] += (x[i - 1] - X[i]) * speed);\n }\n ClockAndAssign();\n setTimeout(Delay, 20);\n }\n \n Delay();\n \n }());\n \n num = 1;\n function toggle(){\n num ^= 1; \n if(num == 1){\n document.getElementById('clock').style.visibility=\"hidden\";\n document.getElementById('tog1').onclick=null;\n } \n else {\n document.getElementById('clock').style.visibility=\"visible\";\n document.getElementById('tog1').onclick=changeSIZE;\n }\n document.getElementById(\"tog\").value = num ?\" APPEAR \":\"KILL(切る)\";\n }\n //-->\n </script>\n \n <br><br><br><br><br><br><br><br><br><br>\n <br><br><br><br><br><br><br><br><br><br>\n <center><p>\n <input class=\"butt\" type=\"button\" id=\"tog\" value=\"今何時?\" onclick=\"toggle()\">\n <input class=\"butt\" id=\"tog1\" type=\"button\" value=\"/LESSER\\" onclick=\"changeSIZE()\">\n </p></center>\n \n <div>\n <center>\n <div>\n <input type=\"button\" value=\"C\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:white\" onclick=\"document.getElementById('Od').style.color='white';document.getElementById('Of').style.color='white';document.getElementById('Oh').style.color='white';document.getElementById('Om').style.color='white';document.getElementById('Os').style.color='white'\">\n <input type=\"button\" value=\"C\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lightskyblue\" onclick=\"document.getElementById('Od').style.color='lightskyblue';document.getElementById('Of').style.color='lightskyblue';document.getElementById('Oh').style.color='lightskyblue';document.getElementById('Om').style.color='lightskyblue';document.getElementById('Os').style.color='lightskyblue'\">\n <input type=\"button\" value=\"C\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:yellow\" onclick=\"document.getElementById('Od').style.color='yellow';document.getElementById('Of').style.color='yellow';document.getElementById('Oh').style.color='yellow';document.getElementById('Om').style.color='yellow';document.getElementById('Os').style.color='yellow'\">\n <input type=\"button\" value=\"C\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lime\" onclick=\"document.getElementById('Od').style.color='lime';document.getElementById('Of').style.color='lime';document.getElementById('Oh').style.color='lime';document.getElementById('Om').style.color='lime';document.getElementById('Os').style.color='lime'\">\n <input type=\"button\" value=\"C\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:deeppink\" onclick=\"document.getElementById('Od').style.color='deeppink';document.getElementById('Of').style.color='deeppink';document.getElementById('Oh').style.color='deeppink';document.getElementById('Om').style.color='deeppink';document.getElementById('Os').style.color='deeppink'\">\n <input type=\"button\" value=\"C\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:mediumblue\" onclick=\"document.getElementById('Od').style.color='mediumblue';document.getElementById('Of').style.color='mediumblue';document.getElementById('Oh').style.color='mediumblue';document.getElementById('Om').style.color='mediumblue';document.getElementById('Os').style.color='mediumblue'\">\n <input type=\"button\" value=\"C\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:maroon\" onclick=\"document.getElementById('Od').style.color='maroon';document.getElementById('Of').style.color='maroon';document.getElementById('Oh').style.color='maroon';document.getElementById('Om').style.color='maroon';document.getElementById('Os').style.color='maroon'\">\n </div>\n <div>\n <input type=\"button\" value=\"D\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:maroon\" onclick=\"document.getElementById('Od').style.color='maroon'\">\n <input type=\"button\" value=\"D\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:mediumblue\" onclick=\"document.getElementById('Od').style.color='mediumblue'\">\n <input type=\"button\" value=\"D\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:deeppink\" onclick=\"document.getElementById('Od').style.color='deeppink'\">\n <input type=\"button\" value=\"D\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lime\" onclick=\"document.getElementById('Od').style.color='lime'\">\n <input type=\"button\" value=\"D\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:yellow\" onclick=\"document.getElementById('Od').style.color='yellow'\">\n <input type=\"button\" value=\"D\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lightskyblue\" onclick=\"document.getElementById('Od').style.color='lightskyblue'\">\n <input type=\"button\" value=\"D\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:white\" onclick=\"document.getElementById('Od').style.color='white'\">\n </div>\n <div>\n <input type=\"button\" value=\"F\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:maroon\" onclick=\"document.getElementById('Of').style.color='maroon'\">\n <input type=\"button\" value=\"F\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:mediumblue\" onclick=\"document.getElementById('Of').style.color='mediumblue'\">\n <input type=\"button\" value=\"F\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:deeppink\" onclick=\"document.getElementById('Of').style.color='deeppink'\">\n <input type=\"button\" value=\"F\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lime\" onclick=\"document.getElementById('Of').style.color='lime'\">\n <input type=\"button\" value=\"F\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:yellow\" onclick=\"document.getElementById('Of').style.color='yellow'\">\n <input type=\"button\" value=\"F\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lightskyblue\" onclick=\"document.getElementById('Of').style.color='lightskyblue'\">\n <input type=\"button\" value=\"F\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:white\" onclick=\"document.getElementById('Of').style.color='white'\">\n </div>\n <div>\n <input type=\"button\" value=\"H\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:maroon\" onclick=\"document.getElementById('Oh').style.color='maroon'\">\n <input type=\"button\" value=\"H\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:mediumblue\" onclick=\"document.getElementById('Oh').style.color='mediumblue'\">\n <input type=\"button\" value=\"H\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:deeppink\" onclick=\"document.getElementById('Oh').style.color='deeppink'\">\n <input type=\"button\" value=\"H\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lime\" onclick=\"document.getElementById('Oh').style.color='lime'\">\n <input type=\"button\" value=\"H\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:yellow\" onclick=\"document.getElementById('Oh').style.color='yellow'\">\n <input type=\"button\" value=\"H\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lightskyblue\" onclick=\"document.getElementById('Oh').style.color='lightskyblue'\">\n <input type=\"button\" value=\"H\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:white\" onclick=\"document.getElementById('Oh').style.color='white'\">\n </div>\n <div>\n <input type=\"button\" value=\"M\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:maroon\" onclick=\"document.getElementById('Om').style.color='maroon'\">\n <input type=\"button\" value=\"M\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:mediumblue\" onclick=\"document.getElementById('Om').style.color='mediumblue'\">\n <input type=\"button\" value=\"M\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:deeppink\" onclick=\"document.getElementById('Om').style.color='deeppink'\"> \n <input type=\"button\" value=\"M\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lime\" onclick=\"document.getElementById('Om').style.color='lime'\">\n <input type=\"button\" value=\"M\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:yellow\" onclick=\"document.getElementById('Om').style.color='yellow'\">\n <input type=\"button\" value=\"M\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lightskyblue\" onclick=\"document.getElementById('Om').style.color='lightskyblue'\">\n <input type=\"button\" value=\"M\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:white\" onclick=\"document.getElementById('Om').style.color='white'\">\n </div>\n <div>\n <input type=\"button\" value=\"S\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:maroon\" onclick=\"document.getElementById('Os').style.color='maroon'\">\n <input type=\"button\" value=\"S\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:mediumblue\" onclick=\"document.getElementById('Os').style.color='mediumblue'\">\n <input type=\"button\" value=\"S\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:deeppink\" onclick=\"document.getElementById('Os').style.color='deeppink'\">\n <input type=\"button\" value=\"S\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lime\" onclick=\"document.getElementById('Os').style.color='lime'\">\n <input type=\"button\" value=\"S\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:yellow\" onclick=\"document.getElementById('Os').style.color='yellow'\">\n <input type=\"button\" value=\"S\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:lightskyblue\" onclick=\"document.getElementById('Os').style.color='lightskyblue'\">\n <input type=\"button\" value=\"S\" style=\"BORDER-RIGHT: grey 1px solid; BORDER-TOP: grey 1px solid; FONT-SIZE: 8pt; FONT-WEIGHT:BOLD; BORDER-LEFT: grey 1px solid; COLOR: black; BORDER-BOTTOM: grey 1px solid;FONT-FAMILY: ms gothic; BACKGROUND-COLOR:white\" onclick=\"document.getElementById('Os').style.color='white'\">\n </div>\n </center></div>\n <br>\n \n </body>\n </html>\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T10:11:27.567",
"favorite_count": 0,
"id": "10945",
"last_activity_date": "2015-06-03T14:50:50.063",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9359",
"post_type": "question",
"score": 2,
"tags": [
"javascript",
"html",
"css"
],
"title": "\"付け消しボタン\"で*消しているとき*は、\"色付けボタン\"も*水面下で機能しないようにする方法",
"view_count": 95
} | [
{
"body": "ボタンを機能しないようにするには、HTMLでは \n`<button id=\"B\" type=\"button\" onclick=\"func()\" disabled>ボタン</button>` \nのように \n`disabled` 属性を指定します。(`<input type=\"button\"..`も同じ) \n(そうすると表示はされているがかすんだような表示(ブラウザによります)になってボタンを押しても反応しなくなります。) \njavascriptからは、 \n`dobument.getElementById('B').disabled=true;` \nの様に`true`を設定することで、機能しないようにすることができて、 \n`dobument.getElementById('B').disabled=false;` \nの様に`false`を設定することで、機能するように戻せます。 \n沢山のボタンを切り替える場合には、クラス付けをしておいて \n`getElementsByClassName`を使うか`jQuery`からそれぞれを設定しなおす。 \nようなことになるでしょうけど、 \n機能しない間は表示させておく必要も無いと思うので、 \n色つけボタン群を囲む`div`に`id`を付けて非表示にするのがいいと思います。",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T13:10:30.087",
"id": "10955",
"last_activity_date": "2015-06-03T14:50:50.063",
"last_edit_date": "2015-06-03T14:50:50.063",
"last_editor_user_id": "5044",
"owner_user_id": "5044",
"parent_id": "10945",
"post_type": "answer",
"score": 0
}
] | 10945 | 10955 | 10955 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "cakephpで暗号の復号化がうまくいきません。 \n詳しい方、ご教示ください。\n\n$this_password = strval($this->data['password']); \n$this->request->data['password'] = Security::cipher($this_password, PASS_SEC); \n上記をデータベースに登録。\n\nデータベースから取り出し、以下を実行 \n$decode_password = Security::cipher($check_login[0]['User']['password'],\nPASS_SEC);",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T10:51:31.023",
"favorite_count": 0,
"id": "10946",
"last_activity_date": "2015-06-04T00:53:25.890",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8619",
"post_type": "question",
"score": -1,
"tags": [
"php",
"cakephp"
],
"title": "cakephpの暗号の復号化",
"view_count": 1794
} | [
{
"body": "Seucity::cipher()はCakePHPのマニュアルによれば[「脆弱な XOR 暗号を利用しています。従って、重要で機密性の高いデータへ\n使うべきではありません」](http://book.cakephp.org/2.0/ja/core-utility-\nlibraries/security.html)だそうです。\n\nパスワードを扱っているようですが、自己の認証用のパスワードなら、暗号化ではなく非可逆のハッシュ値を保存しておくべきです。それもただ単にハッシュ関数を通すだけでは不十分なので、PHP標準の[password_hash()](http://php.net/manual/ja/function.password-\nhash.php)を使うと良いでしょう。認証の際は質問のようにDBに保存された値を復号して入力されたパスワードと比較するのではなく、入力されたパスワードを`password_hash`に通してその結果とDBに保存されたハッシュ値を比較します。\n\n復元可能な形式でパスワードを保存する必要がある(たとえば他のアプリケーションの認証のためのパスワードを保存している)のであれば、相当慎重に実装する必要があります。`cipher()`は問題外ですし、どんな強力なアルゴリズムを使っていても質問にあるように固定のキーで暗号化していればセキュリティ的にはほぼ無意味です。\n\n[体系的に学ぶ\n安全なWebアプリケーションの作り方](https://www.hash-c.co.jp/wasbook/)には認証やパスワードの保存についても解説がありますので一読されることをお勧めします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T00:53:25.890",
"id": "10959",
"last_activity_date": "2015-06-04T00:53:25.890",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "10946",
"post_type": "answer",
"score": 1
}
] | 10946 | null | 10959 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "Bitnamiからdokuwikiをインストールし、apacheも順調に動いていたのですが、dokuwiki manager\ntoolで起動してもUnable to start apacheがでて起動できなくなりました。 \nどうしたらよいでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T11:33:55.750",
"favorite_count": 0,
"id": "10949",
"last_activity_date": "2015-09-01T14:03:36.677",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5818",
"post_type": "question",
"score": 1,
"tags": [
"php"
],
"title": "Unable to start apacheがでてapacheがスタートできない。",
"view_count": 126
} | [
{
"body": "自己レスです。 \nwindowsの「サービス」にてApacheをスタートアップの種類を「自動」から「自動(遅延開始)」で今のところ動いているようです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T11:44:14.173",
"id": "10950",
"last_activity_date": "2015-06-03T11:44:14.173",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5818",
"parent_id": "10949",
"post_type": "answer",
"score": 1
}
] | 10949 | null | 10950 |
{
"accepted_answer_id": "10965",
"answer_count": 1,
"body": "gemのactiveadminを使っているのですが、activeadminから新規作成をする場合にレコード一個目は作成できるのですが、それ以降新規作成ができません\n\n新規作成を押すと`http://localhost:3000/admin/presses/new`に飛ぶのですがそれはすでに作成したレコードの編集画面なのです。\n\n原因はApplicationControllerで下記のコードをbefore_actionしているせいでした。\n\n```\n\n def press\n @press = Press.last\n end\n \n```\n\n上記をしないと新着ニュースがすべての画面で表示できなくなります。 \n何か良い方法はないでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-03T12:55:51.057",
"favorite_count": 0,
"id": "10953",
"last_activity_date": "2021-04-27T14:05:58.933",
"last_edit_date": "2021-04-27T14:05:58.933",
"last_editor_user_id": "754",
"owner_user_id": "9161",
"post_type": "question",
"score": 0,
"tags": [
"ruby-on-rails",
"activeadmin"
],
"title": "Rails4.2 gemのactiveadminについて",
"view_count": 93
} | [
{
"body": "`@press`ではなく`@recent_press`などに変数名を変えればいいのではないでしょうか。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T03:56:30.333",
"id": "10965",
"last_activity_date": "2015-06-04T03:56:30.333",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "10953",
"post_type": "answer",
"score": 1
}
] | 10953 | 10965 | 10965 |
{
"accepted_answer_id": "10986",
"answer_count": 2,
"body": "お世話になります。 \nPostfixのインストールを行っているのですが`php-imap`が入りません。 \n環境\n\n> CentOS 6.6 \n> PHP 5.4.41 (cli)\n\nエラーメッセージは出ていますがよくわかりません。 \nご教授のほどよろしくお願いします\n\nコマンド\n\n```\n\n [root@**** ~]# yum install php-imap --enablerepo=remi\n \n```\n\n> Loaded plugins: fastestmirror, priorities, security \n> Setting up Install Process \n> Loading mirror speeds from cached hostfile \n> * elrepo: ftp.ne.jp \n> * epel: ftp.kddilabs.jp \n> * remi: remi.kazukioishi.net \n> * rpmfusion-free-updates: mirrors.ustc.edu.cn \n> * rpmfusion-nonfree-updates: mirrors.ustc.edu.cn \n> 203 packages excluded due to repository priority protections \n> Resolving Dependencies \n> --> Running transaction check \n> ---> Package php-imap.x86_64 0:5.3.3-40.el6_6 will be installed \n> --> Processing Dependency: php-common(x86-64) = 5.3.3-40.el6_6 for package:\n> php-imap-5.3.3-40.el6_6.x86_64 \n> --> Processing Dependency: libc-client.so.2007()(64bit) for package: php-\n> imap-5.3.3-40.el6_6.x86_64 \n> --> Running transaction check \n> ---> Package libc-client.x86_64 0:2007e-11.el6 will be installed \n> ---> Package php-imap.x86_64 0:5.3.3-40.el6_6 will be installed \n> --> Processing Dependency: php-common(x86-64) = 5.3.3-40.el6_6 for package:\n> php-imap-5.3.3-40.el6_6.x86_64 \n> --> Finished Dependency Resolution \n> Error: Package: php-imap-5.3.3-40.el6_6.x86_64 (updates) \n> Requires: php-common(x86-64) = 5.3.3-40.el6_6 \n> Installed: php-common-5.4.41-1.el6.remi.x86_64 (@remi) \n> php-common(x86-64) = 5.4.41-1.el6.remi \n> Available: php-common-5.3.3-38.el6.x86_64 (base) \n> php-common(x86-64) = 5.3.3-38.el6 \n> Available: php-common-5.3.3-40.el6_6.x86_64 (updates) \n> php-common(x86-64) = 5.3.3-40.el6_6 \n> You could try using --skip-broken to work around the problem \n> You could try running: rpm -Va --nofiles --nodigest",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T03:44:59.640",
"favorite_count": 0,
"id": "10964",
"last_activity_date": "2015-08-27T06:44:22.407",
"last_edit_date": "2015-08-27T06:44:22.407",
"last_editor_user_id": "10945",
"owner_user_id": "8168",
"post_type": "question",
"score": 1,
"tags": [
"php",
"postfix"
],
"title": "Postfixのインストールでphp-imapが入らない",
"view_count": 4628
} | [
{
"body": "質問文の Postfix は PHP の Typo でしょうか? \nphp-imap が remi リポジトリのものが見つからず、CentOS 6 のものをインストールしようとして、既にインストール済みの remi の\nphp と競合しています。\n\n以下のコマンドで remi リポジトリのみ有効にして、php-imap が見つかるでしょうか。\n\n```\n\n yum info php-imap --disablerepo=\"*\" --enablerepo=remi\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T09:51:18.750",
"id": "10976",
"last_activity_date": "2015-06-04T09:51:18.750",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4603",
"parent_id": "10964",
"post_type": "answer",
"score": 2
},
{
"body": "すみません \nPHPのTypoがわかりません。\n\n```\n\n yum install -y postfix httpd mysql php dovecot dovecot-mysql\n \n```\n\nでインストールしました。\n\nコマンドを実行すると下記のように出力されました。 \nどのように見ればいいのでしょうか?\n\n```\n\n [root@*** ~]# yum info php-imap --disablerepo=\"*\" --enablerepo=remi\n \n```\n\n> Loaded plugins: fastestmirror, priorities, security Loading mirror \n> speeds from cached hostfile * remi: remi.kazukioishi.net Available \n> Packages Name : php-imap Arch : x86_64 Version : \n> 5.4.41 Release : 1.el6.remi Size : 82 k Repo : remi Summary : A module for\n> PHP applications that use IMAP URL \n> : <http://www.php.net/> License : PHP Description : The php-imap \n> package contains a dynamic shared object (DSO) for \n> : the Apache Web server. When compiled into Apache, the php-imap \n> : module will add IMAP (Internet Message Access Protocol) support to \n> : PHP. IMAP is a protocol for retrieving and uploading e-mail \n> : messages on mail servers. PHP is an HTML-embedded scripting \n> : language. If you need IMAP support for PHP applications, you will \n> : need to install this package and the php package.",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T17:32:59.207",
"id": "10986",
"last_activity_date": "2015-08-27T05:55:09.907",
"last_edit_date": "2015-08-27T05:55:09.907",
"last_editor_user_id": "10945",
"owner_user_id": "8168",
"parent_id": "10964",
"post_type": "answer",
"score": 2
}
] | 10964 | 10986 | 10976 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "すみません。アプリの中に地図を埋め込みたいのですが2か所以上マークを付ける方法が分かりません。 \niframeを使って手っ取り早く2か所以上のマークを付ける方法はありますでしょうか?\n\n```\n\n <div style=\"width: 360px; height:600px; overflow: hidden;\">\r\n <iframe src= \"http://maps.google.co.jp/maps?q=東京都新宿区西新宿2-8-1 &z=15&output=embed\" width=\"360px\" height=\"600px\" frameborder=\"0\" style=\"border:0; margin-top: -40%;\"></iframe>\r\n </div>\n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T04:37:41.867",
"favorite_count": 0,
"id": "10966",
"last_activity_date": "2015-08-04T10:58:07.990",
"last_edit_date": "2015-06-04T12:30:56.217",
"last_editor_user_id": "3639",
"owner_user_id": "7724",
"post_type": "question",
"score": 1,
"tags": [
"monaca",
"google-maps"
],
"title": "googlemapに2か所以上のマークを付ける。",
"view_count": 261
} | [
{
"body": "google map api を使ってはいかがでしょうか?\n\n■ Google Map API ドキュメント \n<https://developers.google.com/maps/documentation/javascript/tutorial?hl=ja> \n<https://developers.google.com/maps/documentation/javascript/examples/map-\nsimple?hl=ja>\n\n■ 日本語の参考サイト \n<http://www.nanchatte.com/map/showDifferentInfoWindowOnEachMarker.html> \n<http://tanaka8.com/2011/11/google-map-markers/> \n※他にも検索すると沢山出てきます。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T06:55:50.767",
"id": "11005",
"last_activity_date": "2015-06-05T06:55:50.767",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9529",
"parent_id": "10966",
"post_type": "answer",
"score": 1
}
] | 10966 | null | 11005 |
{
"accepted_answer_id": "10969",
"answer_count": 1,
"body": "ドットインストールでのつまずきです。 \n<http://dotinstall.com/lessons/basic_rails_v2/24906>\n\nrails consoleのコマンドでの編集を行う際に\n\np = Project.new(title: \"p1\")\n\nとタイトルをつけたところ\n\nActiveRecord::UnknownAttributeError: unknown attribute: title\n\nというエラーメッセジが。\n\n検索をかても理解できる記事が見つからず、 \n属性が不明というキーワードまでいきましたが、モデルが上手く生成できていないという意味なのでしょうか?\n\nよろしくお願いします。",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T05:01:58.447",
"favorite_count": 0,
"id": "10967",
"last_activity_date": "2015-06-04T05:17:35.357",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9988",
"post_type": "question",
"score": 1,
"tags": [
"ruby-on-rails"
],
"title": "rails console で モデルにtitleを付けれない",
"view_count": 335
} | [
{
"body": "モデルを作ったときにカラム名を間違えていませんか。db/migrate/*_create_projects.rbを確認してみてください。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T05:17:35.357",
"id": "10969",
"last_activity_date": "2015-06-04T05:17:35.357",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "10967",
"post_type": "answer",
"score": 1
}
] | 10967 | 10969 | 10969 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "[この記事](https://git-\nscm.com/book/ja/v1/Git-%E3%81%AE%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81%E6%A9%9F%E8%83%BD-%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81%E3%81%A8%E3%83%9E%E3%83%BC%E3%82%B8%E3%81%AE%E5%9F%BA%E6%9C%AC)で下記の記述がありましたが\n\n> 各ブランチが指すふたつのスナップショットとそれらの共通の先祖との間で三方向のマージを行いました。\n\nここでよくわからないのは、なぜマージするために、「共通の祖先」が必要なのかです。 \n2つのブランチの最後のコミットをマージすれば済む話だと思っていましたが、「共通の祖先」はどこで必要ですか??不思議です。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T05:13:37.180",
"favorite_count": 0,
"id": "10968",
"last_activity_date": "2015-06-05T07:41:41.263",
"last_edit_date": "2015-06-04T13:21:47.040",
"last_editor_user_id": "5288",
"owner_user_id": "9989",
"post_type": "question",
"score": 22,
"tags": [
"git"
],
"title": "Git のマージで「共通の祖先」は何故必要ですか?",
"view_count": 1293
} | [
{
"body": "例えば、 hoge.txt というファイルを2つのブランチでそれぞれ変更した結果、次のようになっているとします。\n\nbranchA での hoge.txt\n\n```\n\n A\n hoge\n B\n C\n \n```\n\nbranchB での hoge.txt\n\n```\n\n A\n B\n piyo\n C\n \n```\n\nこの二つをマージしてみてください。できますか?\n\n次のようなマージ結果が考えられますが、どれを選べばいいのでしょうか。\n\n * 「元々なかった `hoge` と `piyo` をそれぞれ追加した」 両方含むのが正しい\n * 「`hoge` と `piyo` をそれぞれ削除した」 どちらも含まないのが正しい\n * 「実は branchA は何も変更していない」 branchB が正しい\n * 「実は branchB は何も変更していない」 branchA が正しい\n * 「そもそも `B` すらなかった」 両方で追加された `B` はどうすれば?\n * etc...\n\nこれを判断するには、「 **共通の祖先** に対して、それぞれがどう変更したのか」という情報が必要です。",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T07:00:54.590",
"id": "10973",
"last_activity_date": "2015-06-05T07:41:41.263",
"last_edit_date": "2015-06-05T07:41:41.263",
"last_editor_user_id": "8000",
"owner_user_id": "8000",
"parent_id": "10968",
"post_type": "answer",
"score": 31
}
] | 10968 | null | 10973 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "Xcodeを使い、iphoneアプリを作ろうと考えています。 \nしかし、iOSシミュレータでマップ表示がうまくいかずつまづいています。 \nlocationはappleを指定しております。 \niOS7.1ではマップ表示がされ、現在地もappleとなって動作する。 \niOS8.2や8.3ではマップが表示されず、罫線のみの表示となっていまいます。\n\nMacOSはYosemite version10.10.3 \nXcodeのversionは6.3.2\n\nご教授お願いいたしいます。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T05:26:43.130",
"favorite_count": 0,
"id": "10970",
"last_activity_date": "2015-06-04T14:55:10.780",
"last_edit_date": "2015-06-04T14:55:10.780",
"last_editor_user_id": "845",
"owner_user_id": "9990",
"post_type": "question",
"score": 1,
"tags": [
"ios",
"xcode",
"iphone"
],
"title": "iOSシミュレーターでマップ表示ができない",
"view_count": 697
} | [] | 10970 | null | null |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "Chrome で以下のフォームをサブミットすると、コンソール上に `An invalid form control with name='foo' is\nnot focusable.` エラーが表示されました。 \nなぜ `fieldset` に対してこのエラーが出るのでしょうか?\n\n```\n\n <form name=\"test\">\n <fieldset name=\"foo\">\n <input type=\"text\" name=\"bar\" required=\"required\">\n </fieldset>\n <input type=\"submit\" name=\"button\" value=\"submit\">\n </form>\n \n```\n\n[jsfiddle](https://jsfiddle.net/pg942g58/)",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T06:37:15.763",
"favorite_count": 0,
"id": "10971",
"last_activity_date": "2015-06-04T06:37:15.763",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9992",
"post_type": "question",
"score": 3,
"tags": [
"html5",
"google-chrome"
],
"title": "fieldset タグに対する An invalid form control with name='xxx' is not focusable. エラー",
"view_count": 521
} | [] | 10971 | null | null |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "**背景** \n元々別サーバーにあったシステムを、新しく別のサーバーへ移管することになりました。\n\n**エクスポート**\n\n```\n\n mysqldump -u root -p DBNAME --default-character-set=binary > ~/DBNAME.sql \n \n```\n\n**インポート** \n直接コマンドを打ち込めないため、phpMyAdminを使ってインポートしました。 \nこの時、「ファイルの文字セット:」の項目はutf8やsjis、binaryなどを試していますが、結果は変わっておりません。\n\n**Perlで試験接続** \nPerlからデータベースへ接続したところでは、日本語にも文字化けは一切無く、移行したデータが綺麗に読み取れています。UTF8です。 \nしかし、実システムはPHPのため、あくまで動作確認でした。\n\n**PHPで接続** \nPHPで接続すると、phpMyAdminの時点ですでに文字化けしており、目的のシステムも日本語部分だけ文字化けして治る気配がありません。\n\n**試したこと** \nネット検索を利用するなどして試したことです。\n\n * エクスポート時に、binaryではなくsjisやutf8、eucなどを試してみました。\n * インポート時にも、考えられる文字コードの組み合わせを行いました\n * phpMyAdmin上のSQL発行を行っても文字化けが発生するため、「SET NAMES utf8」コマンドを先頭に置き、考えうる文字コードを指定し何度か試した結果、出力結果の文字化けの種類は変化するものの、正常に表示される組み合わせが無い\n * データベースのデフォルト文字コードを変更し、再度インポートを試すが結果変わらず\n\n**情報** \nMySQL:5.5.28 \nphpMyAdmin:3.3.10.5 \nPHP:PHP 5.4.40\n\n以上となります。 \nよろしくお願いいたします。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T07:51:49.403",
"favorite_count": 0,
"id": "10974",
"last_activity_date": "2020-06-22T04:37:30.983",
"last_edit_date": "2020-06-22T04:37:30.983",
"last_editor_user_id": "3060",
"owner_user_id": "8667",
"post_type": "question",
"score": 1,
"tags": [
"php",
"mysql",
"文字化け"
],
"title": "PHP + MySQLでの文字化けが直らない",
"view_count": 2774
} | [
{
"body": "おそらく自己解決したので回答しておきます。\n\n以下のコードを先頭に付け加えたところ、文字化け無く表示が行えるようになりました。\n\n```\n\n mysql_set_charset('utf8', $con);\n \n```\n\n* * *\n\n_この投稿は[@Monon さんが質問本文に追記した内容](https://ja.stackoverflow.com/revisions/10974/2)\nを元に、個別の回答として コミュニティwiki として投稿しました。_",
"comment_count": 0,
"content_license": "CC BY-SA 4.0",
"creation_date": "2020-06-22T04:37:09.163",
"id": "67896",
"last_activity_date": "2020-06-22T04:37:09.163",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3060",
"parent_id": "10974",
"post_type": "answer",
"score": 1
}
] | 10974 | null | 67896 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "Androidアプリ上でWebViewを使い、ローカルにあるhtml5のコードを実行していますが、 \nvideoがどうしても再生できません。\n\nhtml5WebViewというのも使って見ましたが、ダメでした。\n\nどなたか、html5のvideoをWebView上で再生する方法をご存知の方はいらっしゃいませんでしょうか? \nvideoはローカルに保存してあるものです。\n\nAndroidのバージョンは4.2以上を想定しています。\n\nよろしくお願いいたします。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T08:00:02.467",
"favorite_count": 0,
"id": "10975",
"last_activity_date": "2016-04-08T05:32:34.033",
"last_edit_date": "2015-06-04T08:28:06.673",
"last_editor_user_id": "9408",
"owner_user_id": "9408",
"post_type": "question",
"score": 4,
"tags": [
"android",
"html5",
"webview"
],
"title": "AndroidアプリでWebviewからhtml5のvideoタグの再生",
"view_count": 2535
} | [
{
"body": "「PluginStateをONにしていない」ということはないでしょうか?以下のようなコードを書いてPluginをONにして、videoタグが含まれるWebページを表示してみて下さい。\n\n```\n\n if (Build.VERSION.SDK_INT < 8) {\n webview.getSettings().setPluginsEnabled(true);\n } else {\n webview.getSettings().setPluginState(PluginState.ON);\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2016-01-09T02:34:28.410",
"id": "20767",
"last_activity_date": "2016-01-09T02:34:28.410",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "531",
"parent_id": "10975",
"post_type": "answer",
"score": 1
}
] | 10975 | null | 20767 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "ChromeやSafariではドラッグアンドドロップでファイルをフォームにセットできます。(下図参照)\n\n\n\nしかし、IEだとこれが実現できません。(ドロップするとその画像をブラウザで開いてしまう)\n\nJavaScriptを使ってIEでもドラッグアンドドロップでファイルをフォームにセットすることはできますか?\n\nAjaxでファイルアップロードをするプラグインやサンプルコードはたくさん見つかるのですが、「フォームにセットするだけ、サブミットは普通にボタンをクリックしてサブミットする」という情報は見つかりませんでした。\n\n[こちらの情報](https://stackoverflow.com/questions/25247197/is-it-possible-to-use-\nhtml-drag-and-drop-file-uploads-but-without-ajax-\nxhr)は目的に近かったですが、IEでは機能しませんでした。\n\n何か参考になりそうな情報があれば教えてください。 \nよろしくお願いします。\n\nちなみにIEはIE11のような最近のバージョンを対象にしてもOKです。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T10:08:40.127",
"favorite_count": 0,
"id": "10977",
"last_activity_date": "2015-09-09T13:11:04.217",
"last_edit_date": "2017-05-23T12:38:56.083",
"last_editor_user_id": "-1",
"owner_user_id": "85",
"post_type": "question",
"score": 3,
"tags": [
"javascript",
"html",
"internet-explorer"
],
"title": "IEでフォームにファイルをドラッグアンドドロップでセットしたい",
"view_count": 15678
} | [
{
"body": "以前に似たようなことをやろうとしてハマった経験がありますので、直接の回答ではないのですがご参考になればと思い投稿いたします。\n\n結論から言うと、私の場合もフォームに直接ドロップする事はできませんでした。そのため回避策としてドロップ領域を別途用意(divタグで領域を作りました)して、addEventListenerでdropイベントを追加し、dropイベント内でドロップされたファイル名を取得して表示する、というようなことをやりました。\n\nただ、私の場合ファイルを複数選択する必要があったため、ファイル名入力フィールドは使用せずに、テーブル要素として表示させていましたので、ファイル名入力フィールドだと取得したファイル名をスクリプト等で表示させることができるかわかりません(確かできなかったように記憶しています、ちょっと自信ないですが)。\n\nこのため、submitボタンのイベントにも細工をして、表示している複数のファイルをそれぞれPOSTするような処理を追加しました。\n\n回りくどいようですが、こういう回避策もあるということで。",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T13:17:49.680",
"id": "10979",
"last_activity_date": "2015-06-04T13:17:49.680",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9515",
"parent_id": "10977",
"post_type": "answer",
"score": 1
},
{
"body": "[IE10 (Win7 32bit)](https://www.modern.ie/ja-jp/virtualization-\ntools#downloads)で確認しましたが、[ng-file-\nupload](http://jsfiddle.net/3t50b3fw/)を利用すれば実現可能です。\n\n",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T03:00:06.357",
"id": "11064",
"last_activity_date": "2015-06-07T03:00:06.357",
"last_edit_date": "2017-03-10T09:42:49.003",
"last_editor_user_id": "-1",
"owner_user_id": "9834",
"parent_id": "10977",
"post_type": "answer",
"score": 1
}
] | 10977 | null | 10979 |
{
"accepted_answer_id": null,
"answer_count": 3,
"body": "rubyで任意のURLに対してpostやgetなどでパラメータを投げるにはどうしたらよいのでしょうか",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T12:56:09.163",
"favorite_count": 0,
"id": "10978",
"last_activity_date": "2015-06-08T08:11:07.197",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9149",
"post_type": "question",
"score": 0,
"tags": [
"ruby"
],
"title": "rubyからgetやpostを行う方法",
"view_count": 640
} | [
{
"body": "HTTP Client ライブラリを使うと簡単にできます。 \nHTTP Client ライブラリの実装は幾つかあり、以下の物が有名です。\n\n[rest-client](https://github.com/rest-client/rest-client) \n[faraday](https://github.com/lostisland/faraday) \n[httpclient](https://github.com/nahi/httpclient)\n\ngithubでは上から順に、スターの数が多いです。 \n使い方は、githubのページを参照するか、Googleで検索すると幾つか出てきます。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T15:03:09.050",
"id": "10982",
"last_activity_date": "2015-06-04T15:03:09.050",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9529",
"parent_id": "10978",
"post_type": "answer",
"score": 2
},
{
"body": "たいていの用途には[net/http](http://docs.ruby-\nlang.org/ja/2.2.0/library/open=2duri.html)か、GET限定であれば[open-\nuri](http://docs.ruby-\nlang.org/ja/2.2.0/library/open=2duri.html)でよいでしょう。いずれもruby本体の添付ライブラリなのでrubyが入っている環境では間違いなく使えます。\n\n標準ライブラリでは不都合がある、という前提での質問なら、どういう目的で何をしたいのか、その用途には標準ライブラリではどういう点が不都合なのか、を追記してもらえればよりよい回答が得られると思います。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T07:42:53.633",
"id": "11108",
"last_activity_date": "2015-06-08T07:42:53.633",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "10978",
"post_type": "answer",
"score": 2
},
{
"body": "Rubyをつい最近はじめた者ですが、net/http内の \nNet::HTTP \nNet::HTTP::Post \nNet::HTTP::Get \nあたりでできるかとおもいます。\n\n他の言語で同様の実装経験があれば、別の方がシェアされているリンクと検索してでてくるTIPSを参考にして比較的簡単に実装できると思います。\n\n以下は私の書いたコードで、同一メソッド内でPOST/GETを切り替えて外部URL(この場合PayPal\nAPIですが)にパラメータを渡して結果を取得しています。\n\n<https://github.com/benzookapi/PayPalRubyDemo/blob/master/app/models/pp_rest.rb#L38>\n\n(エラーハンドリングはちゃんとしてないですが)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T08:11:07.197",
"id": "11111",
"last_activity_date": "2015-06-08T08:11:07.197",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9260",
"parent_id": "10978",
"post_type": "answer",
"score": 0
}
] | 10978 | null | 10982 |
{
"accepted_answer_id": "10988",
"answer_count": 1,
"body": "rails4.2 + Deviseで,本番環境のみで発生するエラーです.\n\n`rake assets:precompile` \nでプリコンパイル後に\n\n```\n\n git push heroku master\n \n```\n\nで立ち上げると,ログイン画面が表示されるところまでは確認しました. \nログイン後,ログアウトを図ると\n\n```\n\n The page you were looking for doesn't exist.\n You may have mistyped the address or the page may have moved.\n If you are the application owner check the logs for more information.\n \n```\n\nというエラーが吐かれてしまいます.\n\nこちらがGemfileの一部抜粋になります.\n\n```\n\n # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' \n gem 'rails', '4.2.1'\n # Use sqlite3 as the database for Active Record \n group :development do\n gem 'sqlite3'\n end\n group :production do\n gem 'pg'\n gem 'rails_12factor'\n end\n \n # devise and admin \n gem 'devise'\n gem 'rails_admin'\n \n # devise-bootstrap \n gem 'devise-bootstrap-views'\n gem 'devise-i18n'\n gem 'devise-i18n-views'\n \n```\n\nこちらがroutesです.\n\n```\n\n Prefix Verb URI Pattern Controller#Action\n new_user_session GET /users/sign_in(.:format) devise/sessions#new\n user_session POST /users/sign_in(.:format) devise/sessions#create\n destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy\n \n```\n\n/users/sign_outの際に上記のエラーが起きています. \nなお,localの環境下では正常にlogin,logoutの動作が確認できています. \n確認すべき箇所,提示したコード以外に必要なコード等ありましたらご指摘をお願いします. \nよろしくお願いします.",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T13:28:55.390",
"favorite_count": 0,
"id": "10980",
"last_activity_date": "2015-06-04T22:10:04.403",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9996",
"post_type": "question",
"score": 1,
"tags": [
"ruby-on-rails",
"ruby",
"heroku",
"devise"
],
"title": "Heroku + rails4.2 + Deviseで本番環境,ログアウト画面に遷移する際にエラー",
"view_count": 895
} | [
{
"body": "JavaScriptが正常に読み込まれていないのが原因だと思います。\n\n`git push heroku master`すると自動的にassets precompileされるはずなのでローカルでassets\nprecompileする必要はないはずです。 \nむしろ、(今回のような)予期せぬトラブルの原因になるのでしない方がいいでしょう。\n\nローカルにpublic/assetsディレクトリはありませんか? \nもしあればそのディレクトリを削除して、git commitしてください。 \nそれから`git push heroku master`すれば、Heroku上で正常にJSが読み込まれると思うのですが、いかがでしょうか?\n\nそれでもダメな場合はHerokuのヘルプをしっかり読んでいって、手順が間違っていないかチェックしてみてください。\n\n<https://devcenter.heroku.com/articles/getting-started-with-rails4>",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T22:10:04.403",
"id": "10988",
"last_activity_date": "2015-06-04T22:10:04.403",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "85",
"parent_id": "10980",
"post_type": "answer",
"score": 1
}
] | 10980 | 10988 | 10988 |
{
"accepted_answer_id": "11022",
"answer_count": 1,
"body": "カメラとカメラロールを使って写真をコレクションビューに保存することのできるアプリを作っているのですが、画像を保存する箇所で処理が遅く数秒かかってしまい非常に煩わしいです。\n\nSubViewController.m\n\n```\n\n - (void)addSelectedPicture:(SubjectViewController *)controller item: (UIImage *)item\n {\n //_records(NSMutableArray)\n Record *record = _records[_imageSelectionIndexPath.section];\n [record.images addObject:item];\n \n //ここが時間かかる$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$①\n [[LessonManager sharedManager] saveLessons];\n \n [self.collectionView reloadData];\n }\n \n```\n\nLessonManager.h\n\n```\n\n #import <Foundation/Foundation.h>\n #import \"Lesson.h\"\n \n @interface LessonManager : NSObject\n \n @property (nonatomic) NSMutableArray *lessons;\n \n + (instancetype)sharedManager;\n - (void)saveLessons;\n \n @end\n \n```\n\nLessonManager.m\n\n```\n\n #import \"LessonManager.h\"\n \n @implementation LessonManager\n \n + (instancetype)sharedManager {\n static LessonManager *manager = nil;\n static dispatch_once_t onceToken;\n dispatch_once(&onceToken, ^{\n manager = [[self alloc] init];\n });\n NSLog(@\"1場所\");\n return manager;\n }\n \n - (instancetype)init\n {\n self = [super init];\n if (self) {\n self.lessons = [NSMutableArray arrayWithArray:[Lesson fetchLessons]];\n }\n NSLog(@\"2場所\");\n return self;\n }\n \n - (void)saveLessons\n {\n NSLog(@\"4場所\");\n //ここが遅い$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$②\n [Lesson saveLessons:self.lessons];\n NSLog(@\"3場所\");\n }\n \n @end\n \n```\n\nLesson.h\n\n```\n\n #import <Foundation/Foundation.h>\n #import \"Record.h\"\n \n @interface Lesson : NSObject <NSCoding>\n \n @property (nonatomic) NSString *name;\n @property (nonatomic) NSString *teacher;\n @property (nonatomic) NSString *room;\n @property (nonatomic) NSMutableArray *records;\n \n + (NSArray *)fetchLessons;\n + (void)saveLessons:(NSArray *)lessons;\n \n @end\n \n```\n\nLesson.m\n\n```\n\n #import \"Lesson.h\"\n \n @implementation Lesson\n \n + (NSArray *)fetchLessons\n {\n NSLog(@\"8場所\");\n NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];\n NSData *data = [userDefaults dataForKey:@\"lessons\"];\n NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data];\n if (!array) {\n array = [NSArray array];\n }\n return array;\n }\n \n + (void)saveLessons:(NSArray *)lessons\n {\n //ここが遅い$$$$$$$$$$$$$$$$$$$$$$$$③\n NSData *data = [NSKeyedArchiver archivedDataWithRootObject:lessons];\n NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];\n [userDefaults setObject:data forKey:@\"lessons\"];\n [userDefaults synchronize];\n }\n \n - (instancetype)init\n {\n self = [super init];\n if (self) {\n self.records = [NSMutableArray array];\n }\n return self;\n }\n \n @end\n \n```\n\n順番としては①②③と実行されていくと思うのですが、Lesson.mの \n+ (void)saveLessons:(NSArray *)lessons{} \nの③のうちの \nNSData *data = [NSKeyedArchiver archivedDataWithRootObject:lessons]; \nの部分が遅くアプリが数秒固まったようになってしまいます。\n\nメモリは③の処理の部分で最大になります。メモリの使いすぎなのでしょうか... \n\n\nなにか解決する方法はありませんか、どなたかよろしくお願いします。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T14:49:45.540",
"favorite_count": 0,
"id": "10981",
"last_activity_date": "2015-06-06T02:08:47.390",
"last_edit_date": "2015-06-04T16:23:43.807",
"last_editor_user_id": "8802",
"owner_user_id": "8802",
"post_type": "question",
"score": 0,
"tags": [
"ios",
"objective-c",
"iphone"
],
"title": "画像保存の際の処理速度が遅い",
"view_count": 920
} | [
{
"body": "どうしてもNSUserDefaultsに保存しないといけないのであれば別ですが、そうでなければ、dataを直接ファイルに保存するようにしてはどうでしょうか?\n\nたぶん、こんな感じになるかと思います。\n\n```\n\n + (NSArray*)fetchLessons\n {\n NSLog(@\"8場所\");\n NSString* path = [self makeLibraryPath];\n NSData* data = [[NSData alloc] initWithContentsOfFile:path];\n \n NSArray* array = [NSKeyedUnarchiver unarchiveObjectWithData:data];\n if (!array) {\n array = [NSArray array];\n }\n return array;\n }\n \n + (void)saveLessons:(NSArray*)lessons\n {\n //ここが遅い$$$$$$$$$$$$$$$$$$$$$$$$③\n NSData* data = [NSKeyedArchiver archivedDataWithRootObject:lessons];\n \n NSString* path = [self makeLibraryPath];\n [data writeToFile:path atomically:YES];\n }\n \n /// LibraryDirectoryのファイルへのパスを生成\n + (NSString*)makeLibraryPath\n {\n NSArray* paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);\n NSString* dir = [paths objectAtIndex:0];\n return [dir stringByAppendingPathComponent:@\"data.dat\"];\n }\n \n```\n\n保存するパスやファイル名は、適当なものをいれてあるので自分で確認して下さい。サイズがさらに大きくなるのであれば、配列をまとめて保存するのではなく、それぞれ別に保存したほうがいいかもしれません。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T02:08:47.390",
"id": "11022",
"last_activity_date": "2015-06-06T02:08:47.390",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7459",
"parent_id": "10981",
"post_type": "answer",
"score": 1
}
] | 10981 | 11022 | 11022 |
{
"accepted_answer_id": "11036",
"answer_count": 1,
"body": "Devise+OmniAuthでユーザ認証を実装しました。 \nメールアドレスとパスワードで登録を行う場合に認証フローを追加したのですが \nfacebook認証時は上記を省略したいのですがどうしたら良いでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T15:47:22.563",
"favorite_count": 0,
"id": "10983",
"last_activity_date": "2015-06-06T07:57:02.450",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9161",
"post_type": "question",
"score": 1,
"tags": [
"ruby-on-rails"
],
"title": "Rails4 facebook認証時はメール認証を行わない方法",
"view_count": 273
} | [
{
"body": "対象のコントローラに`@user.skip_confirmation!`を追記する\n\n私の場合は下記\n\nclass Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController\n\n```\n\n def facebook\n # You need to implement the method below in your model (e.g. app/models/user.rb)\n @user = User.from_omniauth(request.env[\"omniauth.auth\"])\n @user.skip_confirmation!\n if @user.persisted?\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Facebook\") if is_navigational_format?\n else\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url\n end\n end\n end\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T07:57:02.450",
"id": "11036",
"last_activity_date": "2015-06-06T07:57:02.450",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9161",
"parent_id": "10983",
"post_type": "answer",
"score": 1
}
] | 10983 | 11036 | 11036 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "ToDoアプリのテンプレートにある写真撮影機能にiPhoneのフォルダにある写真を選べる機能を追加したいのですが、\n\n```\n\n function addTodoPicture() {\n navigator.camera.getPicture(addTodo, function() {\n alert(\"Failed to get camera.\");\n }, {\n quality : 50,\n destinationType : Camera.DestinationType.FILE_URI,\n targetWidth : 100,\n targetHeight : 100\n });\n }\n function addTodo(camera_url) {\n var title = $(\"#todo-title\").val();\n var body = $(\"#todo-body\").val();\n var img_tag = \"\";\n if (camera_url) {\n img_tag = \"<img src='\" + camera_url + \"'>\";\n }\n $.mobile.changePage($(\"#list-page\"));\n $(\"#todo-list\").append(\"<li>\" + img_tag + \"<h3>\" + title + \"</h3><p>\" + body + \"</p></li>\")\n $(\"#todo-list\").listview('refresh');\n };\n \n```\n\nこのテンプレートに、Camera.PictureSourceType.PHOTOLIBRARY をどのように組み込めば良いのでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T17:22:34.610",
"favorite_count": 0,
"id": "10985",
"last_activity_date": "2015-06-05T02:46:43.140",
"last_edit_date": "2015-06-05T02:20:34.830",
"last_editor_user_id": "3516",
"owner_user_id": "9962",
"post_type": "question",
"score": 0,
"tags": [
"monaca",
"api"
],
"title": "画像をiPhoneのフォルダから取得する",
"view_count": 420
} | [
{
"body": "写真撮影とアルバムからの選択については自分で分岐をつくるとして、 \n選択処理自体は[ここ(Monaca\nDocs)](http://docs.monaca.mobi/2.9/en/sampleapp/tips/camera/)の「Obtain Pictures\nfrom a Device’s Album」に書いてあるコードをコピペしてcallbackの部分だけ変更すればいけませんか? \n※とりあえずデバッガで写真選択するところまでは確認できました。\n\n```\n\n function getPhoto () {\n //Specify the source to get the photos.\n navigator.camera.getPicture(onSuccess, onFail, \n { quality: 50,destinationType: Camera.DestinationType.FILE_URI,\n sourceType: navigator.camera.PictureSourceType.SAVEDPHOTOALBUM });\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T02:46:43.140",
"id": "10992",
"last_activity_date": "2015-06-05T02:46:43.140",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3516",
"parent_id": "10985",
"post_type": "answer",
"score": 1
}
] | 10985 | null | 10992 |
{
"accepted_answer_id": "20490",
"answer_count": 1,
"body": "`vagrant`がバージョン1.7以降になってから \n初回のbox作成・起動時に`insecure_private_key` を \n置き換えていると説明されていますが、具体的に何がどうなっているのでしょうか。\n\n質問の経緯は以下のとおりです。\n\n現在`ubuntu 15.04`で`vagrant 1.7.2`を使っています。 \n以前、ホストOSに`windows7`を使っていた頃、 \n`vagrant`が1.7になってからのことですが、boxを新規作成させた後、 \n`teraterm`等からログインできなくなるという現象が起こり、 \nそれについてはネットの情報を参考に`Vagrantfile`に\n\n```\n\n config.ssh.insert_key = false\n \n```\n\nという1文を挿入することでさしあたりの問題は解決しました。\n\nいくつかの説明を読んでいると、どうやら`vagrant`が1.7になってからの仕様変更で、 \n[vagrantの提供する共通公開鍵](https://github.com/mitchellh/vagrant/blob/master/keys/vagrant.pub)を持つboxを使ったゲストOS作成時では \nそれに対応するホスト側の秘密鍵(`~/.vagrant.d/insecure_private_key`)が \n自動的に置き換えられてしまう……らしい……みたいなことになっていると \nなんとなく理解していました。\n\nところが今日、OSを`ubuntu`に変えてから初めて、\n\n```\n\n vagrant init chef/centos-6.6\n \n```\n\nとした後に、`Vagrantfile`を全く編集しない状態でも\n\n```\n\n vagrant ssh\n \n```\n\nとすると、普通にログインできてしまいました。 \nこれは以前、`windows7`で`vagrant 1.7`を使っていた時には \n`teraterm`でエラーになっていたはずでした。\n\nこれはもしかして1.7.2では何らかのバグが治ったのだろうか? \nくらいに考え、でも気になるので、試しに \n`~/.vagrant.d/insecure_private_key`と\n\n```\n\n https://github.com/mitchellh/vagrant/blob/master/keys/\n \n```\n\nに置いてある、[vagrantという名前のファイル](https://github.com/mitchellh/vagrant/blob/master/keys/vagrant) \n(共通公開鍵に対応する秘密鍵のはず) \nの中身を比較してみると、中身が全く同じです。\n\n**ランダムに置き換えられた秘密鍵に変わるんじゃなかったのか??** \nと、これまでの理解か、確認の方法、またはその両方が間違っているらしいと \n気が付いた次第。\n\n元々公開鍵暗号の仕組みも、秘密鍵を持つ人だけが公開鍵を使って暗号を解ける、 \nくらいの理解しかなかったので、そもそもそれが間違いなのかもしれませんが、 \n結局、`vagrant` が初回のbox作成・起動時に`insecure_private_key`を \n置き換えていると説明されているのは、具体的に何がどうなっているのでしょうか。\n\n愚問かと思いますが、教えていただけると嬉しいです。 \nよろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-04T21:42:09.927",
"favorite_count": 0,
"id": "10987",
"last_activity_date": "2015-12-30T22:40:39.547",
"last_edit_date": "2015-12-30T22:24:47.203",
"last_editor_user_id": "9403",
"owner_user_id": "9403",
"post_type": "question",
"score": 4,
"tags": [
"security",
"vagrant",
"ssh"
],
"title": "insecure_private_key の置き換えについて",
"view_count": 5345
} | [
{
"body": "自己解決しました。 \n確かに現在の`vagrant`はゲストOSの初回起動時にホストOS側の鍵情報を自動で変更し、ゲストOSと暗号の再調整を行っています。 \nただし、その置換後に使う秘密鍵ファイルの場所は`vagrant ssh-config`というコマンドを使わないと分からないようになっていました。\n\n```\n\n $ vagrant up\n ...\n ...\n (ゲストOS起動中)\n ...\n (ゲストOS起動後に以下を実行)\n $ vagrant ssh-config\n HostName 127.0.0.1\n User vagrant\n Port 2222\n UserKnownHostsFile /dev/null\n StrictHostKeyChecking no\n PasswordAuthentication no\n IdentityFile /home/xxxx/.vagrant/machines/www/virtualbox/private_key\n IdentitiesOnly yes\n LogLevel FATAL\n \n```\n\n`IdentityFile\n/home/xxxx/.vagrant/machines/www/virtualbox/private_key`の部分が置き換えられた秘密鍵ファイルです。 \nしたがってこのファイルを指定して`ssh`コマンドを実行すると`vagrant ssh`としたときと全く同じ動作をします。\n\n```\n\n ssh -p 2222 -l vagrant -i /home/xxxx/.vagrant/machines/www/virtualbox/private_key 127.0.0.1\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-12-30T22:21:51.050",
"id": "20490",
"last_activity_date": "2015-12-30T22:40:39.547",
"last_edit_date": "2015-12-30T22:40:39.547",
"last_editor_user_id": "9403",
"owner_user_id": "9403",
"parent_id": "10987",
"post_type": "answer",
"score": 3
}
] | 10987 | 20490 | 20490 |
{
"accepted_answer_id": "11006",
"answer_count": 1,
"body": "iPerfでTCPのパケットを投げっぱなしにしています。 \n繋がったり切れたりする様子をTCPモニタに表示したいため、 \n通信のセッションが復旧したら通信を再開させたいです。\n\nクライアント側\n\n```\n\n iperf -c 10.0.0.3 -t 86400\n \n```\n\nサーバ側\n\n```\n\n iperf -s \n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T01:48:56.587",
"favorite_count": 0,
"id": "10989",
"last_activity_date": "2015-08-04T07:58:09.680",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7590",
"post_type": "question",
"score": 0,
"tags": [
"windows",
"iperf"
],
"title": "iperfがタイムアウトしないようにしたい",
"view_count": 1314
} | [
{
"body": "「繋がったり切れたり」というのは、`-t`で指定している`86400`秒を過ぎて終了した iperf を再度実行しているということでしょうか。\n\nということであれば、今のところ iperf に「終了したら再実行」といった機能はありませんので、bat や PowerShell で iperf\nが終了したら再度実行するようなものを作成するのはいかがでしょう。 \n指定期間(`86400`秒x10 など)が決まっているのなら、`for`文で回してもよいかもしれません。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T07:25:32.397",
"id": "11006",
"last_activity_date": "2015-06-05T07:25:32.397",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10006",
"parent_id": "10989",
"post_type": "answer",
"score": 1
}
] | 10989 | 11006 | 11006 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "Python Django の モデルマネージャを使って、MySQL のバルクREPLACE を実行する方法をご存知であれば教えてください。\n\n```\n\n class SpamModel(models.Model):\n ...\n \n SpamModel.objects.bulk_create([\n SpamModel(**item) for item in items])\n \n```\n\nこのようにバルクインサートを行っていますが、ここで INSERT ではなく REPLACE をしたいのです。\n\nこのようなイメージです。\n\n```\n\n SpamModel.objects.bulk_create([\n SpamModel(**item) for item in items], mysql_replace=True)\n \n```\n\nこんなコードでできないものかと。\n\n```\n\n REPLACE INTO spam_spammodel (a, b) VALUES (...), (...), (...), ...\n \n```\n\nこのようなSQLが出ることを想定しています\n\n※ UPSERT ではありません。また、DELETE してからの INSERT でもありません。あくまで、MySQL の REPLACE\n文での実行をしたいのです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T02:08:36.960",
"favorite_count": 0,
"id": "10990",
"last_activity_date": "2015-08-07T01:54:01.210",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10001",
"post_type": "question",
"score": 1,
"tags": [
"python",
"mysql",
"django"
],
"title": "Django で、バルクREPLACE をする方法が知りたい",
"view_count": 320
} | [
{
"body": "目的は、SpamModel.somefieldで\"X\"の場合、\"z\"に変えるなら、`.update()`が使えるかと思います:\n\n```\n\n SpamModel.objects.filter(somefield='x').update(somefield='z')\n \n```\n\n> REPLACE works exactly like INSERT, except that if an old row in the \n> table has the same value as a new row for a PRIMARY KEY or a UNIQUE \n> index, the old row is deleted before the new row is inserted.\n>\n> **Note:** \n> _REPLACE makes sense only if a table has a PRIMARY KEY or UNIQUE \n> index. Otherwise, it becomes equivalent to INSERT, because there is no \n> index to be used to determine whether a new row duplicates another._\n\n<https://dev.mysql.com/doc/refman/5.0/en/replace.html>\n\nならば、Djangoで実現したいなら、DELETE してからの INSERT\nになると思います。なければ、自分で[SQL文を発行する](https://docs.djangoproject.com/en/1.8/topics/db/sql/#executing-\ncustom-sql-directly)しかないでしょうか?\n\n<https://docs.djangoproject.com/en/1.8/topics/db/sql/#executing-custom-sql-\ndirectly>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T00:33:09.583",
"id": "11086",
"last_activity_date": "2015-06-08T00:33:09.583",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "2314",
"parent_id": "10990",
"post_type": "answer",
"score": 1
}
] | 10990 | null | 11086 |
{
"accepted_answer_id": "11031",
"answer_count": 1,
"body": "Quickを使ってテストがうまくいきません。どうしてでしょうか?\n\nボタンを押すとラベルに「Hello」と表示する機能をテストしたいのです。\n\n## 作業環境\n\n * Mac OS X 10.10\n * Xcode 6.3.2 (Swift 1.2)\n\n## StoryBoard\n\n\n\n上のラベルオブジェクト「????」が`myLabel`です。 \n下のボタンオブジェクト「Button」が`myButton`です。\n\n## テスト対象のViewController\n\n```\n\n import UIKit\n \n class ViewController: UIViewController {\n @IBOutlet weak var myLabel: UILabel!\n @IBOutlet weak var myButton: UIButton!\n override func viewDidLoad() {\n super.viewDidLoad()\n }\n @IBAction func pushButton(sender: AnyObject) {\n self.myLabel.text = \"Hello\"\n }\n override func didReceiveMemoryWarning() {\n super.didReceiveMemoryWarning()\n }\n }\n \n```\n\n## テストの内容\n\n```\n\n import UIKit\n import Quick\n import Nimble\n import TestApp\n \n class ViewControllerSpec: QuickSpec {\n override func spec() {\n var vc : ViewController!\n beforeEach{\n vc = ViewController()\n }\n describe(\"ボタンを押す\") {\n beforeEach{\n vc.beginAppearanceTransition(true, animated: false)\n vc.endAppearanceTransition()\n }\n it(\"myLabelのtextが変わる\") {\n vc.myButton?.sendActionsForControlEvents(UIControlEvents.TouchUpInside)\n expect(vc.myLabel?.text).to(equal(\"Hello\"))\n }\n }\n }\n }\n \n```\n\n## テスト結果\n\n> failed - expected to equal , got (user beNil() to match nils)\n\n`vc.beginAppearanceTransition(true, animated: false)` と\n`vc.endAppearanceTransition()` によって、`viewDidAppear`\nされているので、`vc.myLabel`には`nil`が含まれないという認識なんですが、どうして`got <nil>`と返ってくるのかわかりません。\n\n教えてください。よろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T02:19:46.530",
"favorite_count": 0,
"id": "10991",
"last_activity_date": "2015-06-06T04:42:47.357",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "277",
"post_type": "question",
"score": 1,
"tags": [
"ios",
"swift"
],
"title": "SwiftとQuickを使って、ボタンを押すとラベルの表示が変わるUIテストをしたい",
"view_count": 675
} | [
{
"body": "`myLabel`および`myButton`はStoryBoardによって設定されるので、`vc =\nViewController()`のようにStoryBoardを使わずに直接クラスをインスタンス化しているため、`nil`のままなのです。\n\nビューコントローラをインスタンス化しているところをStoryBoardからインスタンス化するように変えれば動くと思いますよ。\n\n```\n\n vc = UIStoryboard(name: \"Main\", bundle: NSBundle(forClass: ViewController.self)).instantiateInitialViewController() as! ViewController\n \n```",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T04:42:47.357",
"id": "11031",
"last_activity_date": "2015-06-06T04:42:47.357",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5519",
"parent_id": "10991",
"post_type": "answer",
"score": 1
}
] | 10991 | 11031 | 11031 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "CollectionViewのセルに`cellForItemAtIndexPath`が呼ばれるたび、毎回違ったidentifierを持たせたいのですが、やり方が分かりません。もしくはできないのでしょうか? \n例えば最初の画面読み込みで、ある`identifier`を持った再利用可能なセルを30個生成し、次に画面が読み込まれた時は別の`identifier`を持った再利用可能なセルを30個生成するといったようなことです。\n\n```\n\n CalendarCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];\n \n```\n\n`cellForItemAtIndexPath`メソッド内の上記の行で、「`must register a nib or a class for the\nidentifier or connect a prototype cell in a\nstoryboard'`」とエラーが返ってきます。(上記の行の`identifier`には画面が読み込まれるたびに違う文字列が入ります。)しかし`Storyboard`の`Collection\nReusable\nView`の`Identifier`にはあらかじめ指定した一つの文字列しか入れることができないので、`cellForItemAtIndexPath`内の`identifier`と`Collection\nReusable View`の`identifier`を一致させることができません。 \nなので、どうすれば都度都度違った`identifier`を持ったセルを生成することができるでしょうか? \nどなたか分かる方がいれば教えていただきたいです。すみませんが、よろしくお願いします。",
"comment_count": 5,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T03:29:23.873",
"favorite_count": 0,
"id": "10993",
"last_activity_date": "2015-06-05T08:58:10.463",
"last_edit_date": "2015-06-05T04:49:14.197",
"last_editor_user_id": "5210",
"owner_user_id": "5210",
"post_type": "question",
"score": 0,
"tags": [
"ios",
"xcode",
"uicollectionview",
"uicollectionviewcell"
],
"title": "CollectionViewのセルに毎回違ったidentifierを持たせる",
"view_count": 992
} | [
{
"body": "下図のようにStoryboardで、Collection ViewのAttributes Inspectorで、 **Items**\nの値を変えれば、CellのIdentifierを複数作ることができます。Itemを2にすると、Collection\nViewのCellのプロトタイプが2つになることがわかります。\n\n\n\n質問者さんの意図に添えないまま終わってしまいましたが、私の回答をこのまま削除するのも、もったいない気がするので、「\n**セルをタップするたびに、セルが入れ替わるプログラム** 」のサンプルを掲載して、回答を完結させておこうと思います。(Swiftにて失礼)\n\nStoryboard上で、セルのプロトタイプを7つ作り、`Identifier`をそれぞれ`CellA`、`CellB`、〜、`CellF`、`CellG`とします。\n\n\n\n`ViewController`のコードを編集します。\n\n```\n\n import UIKit\n \n class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {\n // セルのIdentifierを配列で定数化しておく。\n let identifiers: [String] = [\"CellA\", \"CellB\", \"CellC\", \"CellD\", \"CellE\", \"CellF\", \"CellG\"]\n // 配列identifiersのなん番目かを示す整数型の変数。\n var num: Int = 0\n \n override func viewDidLoad() {\n super.viewDidLoad()\n // Do any additional setup after loading the view, typically from a nib.\n }\n \n override func didReceiveMemoryWarning() {\n super.didReceiveMemoryWarning()\n // Dispose of any resources that can be recreated.\n }\n \n // Collection ViewのDatasourceとDelegate\n func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {\n return 1\n }\n \n func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n return 30 // セルの個数は30固定\n }\n \n func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {\n // num番目のIdentifierのセルを配置する。\n let cell = collectionView.dequeueReusableCellWithReuseIdentifier(identifiers[num], forIndexPath: indexPath) as! UICollectionViewCell\n return cell\n }\n \n func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {\n // セルをタップするごとにCellA→CellB→〜→CellF→CellG→CellA→CellB→〜と切り替わる。\n num = (num + 1) % 7\n collectionView.reloadData()\n }\n \n }\n \n```\n\n",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T03:47:53.383",
"id": "10994",
"last_activity_date": "2015-06-05T08:58:10.463",
"last_edit_date": "2015-06-05T08:58:10.463",
"last_editor_user_id": "7362",
"owner_user_id": "7362",
"parent_id": "10993",
"post_type": "answer",
"score": 1
}
] | 10993 | null | 10994 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "<開発環境> \nOS:windows7 \njava:java SE1.7 \neclipse:3.4.2\n\n<概要> \nwindows環境で開発したjavaプログラムを実行可能jarファイルにして、linuxでクーロンを使用して実行しています \nwindows環境ではVM引数にフォルダパスを設定して実行していましたが、そのまま実行可能jarファイルにしてlinux環境に移すと実行できませんでした \n現在実行環境停止中のため詳細なエラーログは貼れませんが、log4jのプロセス作成エラーがでていました \nlog4jが読み込めていない為かと思い、 \nvm引数をすべて削除後に実行可能jarファイルを作ると、linux環境でも問題なく実行できました\n\nわかりづらい説明and質問になりますが、 \n実行構成に設定するvm引数はjar作成時に引数として含まれるのでしょうか?",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T04:56:54.463",
"favorite_count": 0,
"id": "10995",
"last_activity_date": "2015-06-05T04:56:54.463",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8711",
"post_type": "question",
"score": 1,
"tags": [
"java",
"linux",
"eclipse"
],
"title": "【Eclipse】実行構成のVM引数は実行可能jarファイル作成時に情報として含まれるのか",
"view_count": 2391
} | [] | 10995 | null | null |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "Gitのremoteサーバーを運用したくてAWSのEC2にubuntu linuxをインストール、Gitサーバーを作りました。\n\nGitサーバーを運用する他の目的としてpushされたソースがApacheにすぐ反映されるため (デプロイ) `/var/www/html` の `git\ninit --bare --shared` して他の端末機からclone, pushができるように設定しました。\n\nこの設定の上でユーザーを追加し、試してみたら他のパソコンからcloneやadd, commit\npushまでうまくできました。だがEC2のremoteサーバーに接続して確認したところ `/var/www/html`\nにpushされたファイルが見えないです。(find / 'ファイル名'で検索しても見つけないです。)\n\nさらにもっとおかしいことは他のrepositoryを作ってcloneしたらremotoサーバーの/var/www/htmlには見えないpushされたファイルが普通にcheck\noutされ、見えます。\n\nずっとバタバタしながら試していますが、一体何が間違ったかよくわからないです。\n\n懸念としては\n\n 1. そもそもApacheのフォルダー (`/var/www/html`) はGitのremote用フォルダーとして使えない。\n 2. 何か権限の問題か?remote Gitサーバーを設定した時、間違ったことがあったか?\n\nぐらいです。\n\nもしかして同じような経験をしたことがある方は教えていただけませんか? よろしくお願い致します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T05:41:36.703",
"favorite_count": 0,
"id": "10998",
"last_activity_date": "2015-06-05T05:51:04.837",
"last_edit_date": "2015-06-05T05:51:04.837",
"last_editor_user_id": "76",
"owner_user_id": "5853",
"post_type": "question",
"score": 2,
"tags": [
"git"
],
"title": "Git remoteサーバーにpushされたファイルが見えない",
"view_count": 1813
} | [
{
"body": "`git init` に `\\--bare` オプションを付けた場合は、管理情報のみを持つリポジトリが作成されます。実際の (管理対象の)\nファイルが見られるようにしたい場合、`\\--bare` を付けないでリポジトリを作成してください。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T05:47:58.223",
"id": "11000",
"last_activity_date": "2015-06-05T05:47:58.223",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "76",
"parent_id": "10998",
"post_type": "answer",
"score": 2
}
] | 10998 | null | 11000 |
{
"accepted_answer_id": "11001",
"answer_count": 4,
"body": "```\n\n #include <stdio.h>\n #include <string.h>\n \n int main(){\n int len, i;\n char ch[] = \"today\";\n len = strlen(ch);\n \n for(i = 0; i < len; i++){\n if(i % 2 == 0){\n printf(\"%s\\n\", ch[i]);\n }\n }\n \n return 0;\n }\n \n```\n\nといったプログラムを作りました。 \nこれを実行すると偶数目であるoとaが表示されると思ったのですが、表示されません。 \nなぜでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T05:47:38.070",
"favorite_count": 0,
"id": "10999",
"last_activity_date": "2015-06-10T01:22:17.600",
"last_edit_date": "2015-06-05T05:52:41.440",
"last_editor_user_id": "3639",
"owner_user_id": "9850",
"post_type": "question",
"score": 2,
"tags": [
"c"
],
"title": "C言語で偶数目の文字を表示する",
"view_count": 497
} | [
{
"body": "`ch[i]` は文字ですので、`printf` の書式文字列には `%c` を指定します。(なお、\"o\" と \"a\"\nを表示したい場合は、条件を少し変更する必要があります。)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T05:54:33.410",
"id": "11001",
"last_activity_date": "2015-06-05T05:54:33.410",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "76",
"parent_id": "10999",
"post_type": "answer",
"score": 0
},
{
"body": "i が 0 から始まっているからです。 \n以下の様な条件にすると期待する動きになります。\n\n```\n\n if ((i + 1) % 2 == 0) {\n \n```\n\nあと、printf文は %c を使うよう、修正する必要があります。\n\n```\n\n printf(\"%c\\n\", ch[i]);\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T06:02:53.747",
"id": "11002",
"last_activity_date": "2015-06-05T06:02:53.747",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9529",
"parent_id": "10999",
"post_type": "answer",
"score": 7
},
{
"body": "配列の添え字は0から始まります。\n\n```\n\n ch[0] : t\n ch[1] : o\n ch[2] : d\n ch[3] : a\n ch[4] : y\n \n```\n\nです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T02:04:41.500",
"id": "11021",
"last_activity_date": "2015-06-10T01:22:17.600",
"last_edit_date": "2015-06-10T01:22:17.600",
"last_editor_user_id": "440",
"owner_user_id": "8823",
"parent_id": "10999",
"post_type": "answer",
"score": 0
},
{
"body": "~/test cat tst11.c\n\n```\n\n #include <stdio.h>\n \n int main()\n {\n char *str= \"today\";\n //\n for( int i= 0; *str; i++ ){\n if(( i & 1 ) != 0){\n putchar(*str);\n }\n str++;\n }\n //\n putchar('\\n');\n \n return 0;\n }\n \n```\n\n~/test ./a.out \noa \n~/test",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-09T21:51:49.300",
"id": "11195",
"last_activity_date": "2015-06-09T21:51:49.300",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9528",
"parent_id": "10999",
"post_type": "answer",
"score": 1
}
] | 10999 | 11001 | 11002 |
{
"accepted_answer_id": "11007",
"answer_count": 1,
"body": "Rails4を使ってホテル検索システムのようなものを作成しています。 \nそしてこのシステムの検索機能として、特定の設備を持つ(複数選択可)ホテルを検索して表示する、といったことをRansackを使って実装しようとしています。\n\n例えば、検索画面にて「大浴場」、「レストラン」、「売店」などのチェックボックスを用意してチェックしてもらい、検索するようなシステムです。 \nここで問題なのですが、「大浴場」、「レストラン」、「売店」全てにチェックボックスにチェックして、これら3つ全てを持つホテルのみを検索させることができておりません。 \n3つ全てにチェックしても、3つの内いずれかを持つホテルが表示される状況です。\n\nどのようにしたら解決できるのか、ご教授頂きたいです。 \nまたそもそも前提がおかしいなどありましたらご指摘頂きたいです。 \n詳細を以下に記載致します。 \n\n* * *\n\napp/model/hotel.rb\n\n```\n\n # == Schema Information\n #\n # Table name: hotels\n #\n # id :integer not null, primary key\n # name :string(50) not null # ホテル名\n # address :string(50) not null # ホテル住所\n # created_at :datetime\n # updated_at :datetime\n \n \n class Hotel < ActiveRecord::Base\n has_many :equipments, dependent: :destroy\n end\n \n```\n\n* * *\n\napp/model/equipment.rb\n\n```\n\n # == Schema Information\n #\n # Table name: equipments\n #\n # id :integer not null, primary key\n # hotel_id :integer not null # ホテルid\n # equipmentlist_id :integer not null # 設備リストid\n # note :string(100) # 設備に関するメモ(利用可能時間等)\n # created_at :datetime\n # updated_at :datetime\n \n \n class Branch < ActiveRecord::Base\n belongs_to :company\n belongs_to :equipmentlist\n end\n \n```\n\n* * *\n\napp/model/equipmentlist.rb\n\n```\n\n # == Schema Information\n #\n # Table name: equipmentlists\n #\n # id :integer not null, primary key\n # name :string(50) not null # 設備名\n # created_at :datetime\n # updated_at :datetime\n class Equipmentlist < ActiveRecord::Base\n end\n \n```\n\n* * *\n\napp/controller/hotels_controller.rb\n\n```\n\n class HotelsController < ApplicationController\n def index\n @q = Hotel.ransack(params[:q])\n @q.sorts = 'updated_at desc' if @q.sorts.empty?\n @hotels = @q.result.uniq.page(params[:page])\n @equipmentlists = Equipmentlist.all\n end\n \n```\n\n* * *\n\napp/views/index.html.erb(検索部分のみ抜粋)\n\n```\n\n ...\n <ul>\n <% @equipmentlist.each do |item| %>\n <li>\n <%= f.check_box :equipments_equipmentlist_id_eq, { multiple: true }, item.id, nil %>\n <%= f.label item.name %>\n </li>\n <% end %>\n </ul>\n ...\n \n```\n\n* * *\n\n \n以上になります。 \nなお、コンソールにて以下のようにすれば、目的の結果が得られるのですが、これをどうやってRansackで実現するのかわかっておりません。\n\n```\n\n Equipment.where(Equipment.arel_table[:equipmentlist_id].in([8,10])).group(:hotel_id).having(\"count(*) = ?\", 2)\n \n```\n\n大変初歩的な質問かもしれませんが、どんなことでも結構ですので教えて頂ければ幸いです。 \nよろしくお願い致します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T06:04:29.043",
"favorite_count": 0,
"id": "11003",
"last_activity_date": "2015-06-05T08:51:34.007",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9875",
"post_type": "question",
"score": 3,
"tags": [
"ruby-on-rails"
],
"title": "Rails4でRansackを用いた検索にて複数のカテゴリ全てに所属するレコードを検索したい",
"view_count": 3068
} | [
{
"body": "おそらく、ransackのSimple Modeだけでは実現できないと思います。 \n「チェックされた設備を全て持つ」という複雑な条件はscopeにしてしまえば良いと思います。 \nscopeやクラスメソッドはransackから呼び出すことが出来ますし、単体テストもしやすくなります。\n\n[Using Scopes/Class Methods](https://github.com/activerecord-\nhackery/ransack#using-scopesclass-methods) \n[Ransack で ActiveRecord の Scope\nを利用して検索を行う方法](http://qiita.com/ruzia/items/f6003547ca18377a1508)\n\n以下の様なイメージになるかと思います。\n\napp/model/hotel.rb\n\n```\n\n class Hotel < ActiveRecord::Base\n has_many :equipments, dependent: :destroy\n \n scope :having_all_equipmentlists_of, ->(equipmentlist_ids) {\n joins(xxx)\n .group(xxxx)\n .having(xxxx)\n }\n \n private\n \n def self.ransackable_scopes(auth_object = nil)\n %i(having_all_equipmentlists_of)\n end\n end\n \n ~~~~~\n \n Hotel.ransack({ having_all_equipmentlists_of: [8, 9, 10] }).result\n \n```\n\nあとはチェックボックスのパラメータ名をscope名に合わせてあげれば良いかと。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T08:51:34.007",
"id": "11007",
"last_activity_date": "2015-06-05T08:51:34.007",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9608",
"parent_id": "11003",
"post_type": "answer",
"score": 1
}
] | 11003 | 11007 | 11007 |
{
"accepted_answer_id": "11017",
"answer_count": 1,
"body": " \n上記画像について\n\n * 青い枠線で囲まれたもの = 名前空間\n * 赤い枠線で囲まれたもの = クラス\n\nとして\n\n**Foo::FooFormクラスはFoo::Module::Mathクラスを使用し \nBar::BarFormクラスはBar::Module::Mathクラスを使用します。**\n\n**Foo::Module::MathクラスはFoo名前空間にあるクラス以外からは使用されないようなメソッドが、 \nBar::Module::MathクラスはBar名前空間にあるクラス以外からは使用されないようなメソッドが \n書かれている**\n\nとします。\n\nまた、 \n**Module::Mathクラスはあらゆるクラスから使用されるようなメソッドが** \n書かれています。\n\nこのようなFoo名前空間とBar名前空間のような、 \n名前空間自体の配置を似通ったようなものにするのは \n設計的に正しいでしょうか?",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T06:19:40.470",
"favorite_count": 0,
"id": "11004",
"last_activity_date": "2015-06-05T22:50:31.733",
"last_edit_date": "2015-06-05T15:39:06.553",
"last_editor_user_id": "3639",
"owner_user_id": "9945",
"post_type": "question",
"score": 1,
"tags": [
"詳細設計"
],
"title": "名前空間とクラスの配置について ( 一部分のクラスから参照されやすい名前空間の配置 )",
"view_count": 302
} | [
{
"body": "開発規模にもよると思いますが、複数人で開発する際などは各担当箇所ごとにばらばらな構成になるよりは、多少冗長でもご質問のようにルール化して進めた方があとあと開発メンバの入れ替えなどが発生した場合混乱が少なくて済むことが多いです。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T22:50:31.733",
"id": "11017",
"last_activity_date": "2015-06-05T22:50:31.733",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9515",
"parent_id": "11004",
"post_type": "answer",
"score": 1
}
] | 11004 | 11017 | 11017 |
{
"accepted_answer_id": "11015",
"answer_count": 1,
"body": "以下のHaskellコードはGHCで問題なくコンパイルされます。\n\n```\n\n f :: String -> MaybeT IO String\n f x =\n MaybeT $ do\n s <- getLine\n case s of\n \"y\" ->\n pure . pure =<< getLine\n _ ->\n empty\n \n```\n\n実行すると`empty`のケースのときエラーになってしまいます。\n\n```\n\n > runMaybeT $ f \"a\"\n b\n *** Exception: user error (mzero)\n \n```\n\n`empty`のケースの型が間違っているので、そこを修正すれば動作します。\n\n```\n\n f :: String -> MaybeT IO String\n f x =\n MaybeT $ do\n s <- getLine\n case s of\n \"y\" ->\n pure . pure =<< getLine\n _ ->\n pure empty\n \n```\n\n期待どおりになります。\n\n```\n\n > runMaybeT $ f \"a\"\n b\n Nothing\n \n```\n\n最初のコードを型エラーとしてコンパイル時にはじいてほしいのですが、どうして型チェックをすりぬけてしまうのでしょうか。 \nGHCに与えるオプションの調整が必要でしょうか。`-Wall`は付けています。\n\n環境は以下です。\n\n> uname -v \n> Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015;\n> root:xnu-2782.20.48~5/RELEASE_X86_64 \n> ghc -V \n> The Glorious Glasgow Haskell Compilation System, version 7.10.1\n\n* * *\n\n追記: `import`しているモジュールの定義による影響であるという指摘がありましたので、どれが該当するのか調べました\n\nLibZip-0.11.1パッケージの\n\n```\n\n import Codec.Archive.LibZip\n \n```\n\nまたは ListLike-4.2.0パッケージの\n\n```\n\n import System.Process.ListLike\n \n```\n\nのいづれかの行を追加したときにコンパイルエラーにならず、実行時エラーになりました。 \nどちらもimportしなければ、期待どおりコンパイルエラーになります。\n\nどちらでも発生するので、このモジュールそのものではなく、内部でimportしている別のモジュールが影響しているのだろうと思いましたが、それがどれなのかまでは僕のスキルでは特定できませんでした。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T09:05:18.783",
"favorite_count": 0,
"id": "11009",
"last_activity_date": "2015-06-06T03:19:00.487",
"last_edit_date": "2015-06-05T17:24:56.257",
"last_editor_user_id": "9731",
"owner_user_id": "9731",
"post_type": "question",
"score": 2,
"tags": [
"macos",
"haskell"
],
"title": "実行時にエラーが出る次のプログラムのコンパイルが通ってしまうのはどうしてでしょうか",
"view_count": 344
} | [
{
"body": "提示されたコードに必要な`import`を追加しただけで試すと、GHC-7.10.1ではコンパイルエラーになります。\n\n```\n\n import Control.Applicative\n import Control.Monad.Trans.Maybe\n \n f :: String -> MaybeT IO String\n f x =\n MaybeT $ do\n s <- getLine\n case s of\n \"y\" ->\n pure . pure =<< getLine\n _ ->\n empty\n \n```\n\nエラーメッセージは以下の通りです。\n\n```\n\n a.hs:21:14:\n No instance for (Alternative IO) arising from a use of ‘empty’\n In the expression: empty\n In a case alternative: _ -> empty\n In a stmt of a 'do' block:\n case s of {\n \"y\" -> pure . pure =<< getLine\n _ -> empty }\n \n```\n\n提示された実行時のエラーメッセージ(`*** Exception: user error\n(mzero)`)から想像すると、他にインポートしているモジュールの中で、以下の様な形のIOに対するAlternativeのインスタンスが宣言されているのではないかと思います。\n\n```\n\n instance MonadPlus IO where\n mzero = fail \"mzero\"\n mplus = undefined -- 実行時例外をキャッチするような実装(省略)\n \n instance Alternative IO where\n empty = mzero\n (<|>) = mplus\n \n```\n\nこのようなインスタンス宣言を追加した上で試すと、コンパイルエラーにはなりませんし、実行時には提示されたエラーが発生します。\n\n* * *\n\n追記\n\nインスタンスがどのモジュールで定義されているかは、ghciの`:info`コマンドを使うと確認できます。例えば、`System.Process.ListLike`をインポートした状態で試すと以下の様な出力が得られ、該当のインスタンスは、`Control.Monad.Trans.Error`で定義されていることがわかります。\n\n```\n\n Prelude> :m Control.Applicative Control.Monad System.Process.ListLike\n Prelude Control.Applicative Control.Monad System.Process.ListLike> :info IO\n newtype IO a\n = GHC.Types.IO (GHC.Prim.State# GHC.Prim.RealWorld\n -> (# GHC.Prim.State# GHC.Prim.RealWorld, a #))\n -- Defined in ‘GHC.Types’\n instance Monad IO -- Defined in ‘GHC.Base’\n instance Functor IO -- Defined in ‘GHC.Base’\n instance Applicative IO -- Defined in ‘GHC.Base’\n instance MonadPlus IO -- Defined in ‘Control.Monad.Trans.Error’\n instance Alternative IO -- Defined in ‘Control.Monad.Trans.Error’\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T14:11:24.213",
"id": "11015",
"last_activity_date": "2015-06-06T03:19:00.487",
"last_edit_date": "2015-06-06T03:19:00.487",
"last_editor_user_id": "3066",
"owner_user_id": "3066",
"parent_id": "11009",
"post_type": "answer",
"score": 5
}
] | 11009 | 11015 | 11015 |
{
"accepted_answer_id": "11051",
"answer_count": 1,
"body": "matplotlibで表示した3Dグラフ上で,クリックなどのイベントにより座標を取得する方法を探しています.\n\n二次元のグラフですと下記のようなコードで正しく座標を得ることができます.\n\n```\n\n from numpy.random import rand\n from pylab import figure, show\n \n def onclick(event):\n print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(event.button, event.x, event.y, event.xdata, event.ydata)\n \n fig = figure()\n ax = fig.add_subplot(111)\n ax.plot(rand(5))\n \n fig.canvas.mpl_connect('button_press_event', onclick)\n show()\n \n```\n\n<http://retrofocus28.blogspot.jp/2012/07/matplotlib.html>\n\nしかし,同様のことを3Dグラフで行うと,x,y 座標が正しく表示されません.\n\n```\n\n from mpl_toolkits.mplot3d import Axes3D\n import matplotlib.pyplot as plt\n import numpy as np\n \n def onclick(event):\n print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(event.button, event.x, event.y, event.xdata, event.ydata)\n \n \n X = [[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]]\n Y = [[1,1,1,1,1],[2,2,2,2,2],[3,3,3,3,3]]\n Z = [[10,11,13,14,16],[5,8,7,7,7,],[0,0,0,9,8]]\n fig = plt.figure()\n ax = Axes3D(fig)\n ax.scatter3D(np.ravel(X),np.ravel(Y),np.ravel(Z))\n \n fig.canvas.mpl_connect('button_press_event', onclick)\n plt.show()\n \n```\n\n3Dグラフで正しい座標を得るにはどうしたらよいでしょうか. \nできればz座標も表示したいと思っています.",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T09:54:28.563",
"favorite_count": 0,
"id": "11011",
"last_activity_date": "2015-06-06T16:42:01.437",
"last_edit_date": "2015-06-05T15:07:58.540",
"last_editor_user_id": "7214",
"owner_user_id": "9744",
"post_type": "question",
"score": 1,
"tags": [
"python",
"matplotlib"
],
"title": "matplotlibの3Dグラフ上の座標を得る",
"view_count": 2633
} | [
{
"body": "3次元のデータを平面に投影すると次元が縮退するので、その平面から元の座標を得ることはできません。任意のクリックした座標ではなくて、プロットされたデータをクリックするなら、値を表示可能です。\n\n```\n\n from mpl_toolkits.mplot3d import Axes3D\n import matplotlib.pyplot as plt\n import numpy as np\n \n def onclick(event):\n ind = event.ind[0]\n x, y, z = event.artist._offsets3d\n print x[ind], y[ind], z[ind]\n \n \n X = [[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]]\n Y = [[1,1,1,1,1],[2,2,2,2,2],[3,3,3,3,3]]\n Z = [[10,11,13,14,16],[5,8,7,7,7,],[0,0,0,9,8]]\n fig = plt.figure()\n ax = Axes3D(fig)\n ax.scatter3D(np.ravel(X),np.ravel(Y),np.ravel(Z), picker=5)\n \n fig.canvas.mpl_connect('pick_event', onclick)\n plt.show()\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T16:42:01.437",
"id": "11051",
"last_activity_date": "2015-06-06T16:42:01.437",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7837",
"parent_id": "11011",
"post_type": "answer",
"score": 1
}
] | 11011 | 11051 | 11051 |
{
"accepted_answer_id": "11013",
"answer_count": 1,
"body": "TomcatとApacheとの連携について、以下の条件の時はTomcatに転送しないようにする方法を考えております。\n\n1 基本的にはtomcat側に転送する \n(例:<http://hogehoge.com> と入力されたらtomcat側に渡す) \n2 例外的に特定のURLの時のみApache側で処理する \n(例:<http://hogehoge.com/ownCloud/> と入力されたらApacheで処理する)\n\n現在はmod_proxy_ajpを使って、ttp://hogehoge.com/と入力されたらすべてtomcat側に飛ばしています。\n\n```\n\n <Location / >\n ProxyPass ajp://localhost:8009/\n </Location>\n \n```\n\nしかしこれではすべてtomcat側に転送されてしまってPHPで動くownCloudをApacheで処理できません。\n\n最終目標としては、通常はtomcatのサイトをメインで使いつつ、ownCloudを導入したいと考えております。ですので、Tomcat上でownCloudを導入する方法などがあればご指南いただけると幸いです。 \nよろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T10:33:07.060",
"favorite_count": 0,
"id": "11012",
"last_activity_date": "2015-06-07T03:19:31.317",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10012",
"post_type": "question",
"score": 2,
"tags": [
"php",
"apache",
"tomcat"
],
"title": "TomcatとApacheの連携について",
"view_count": 1579
} | [
{
"body": "これで/hogehoge/配下はapacheで処理されます。\n\n```\n\n # /hogehoge/ は 除外\n ProxyPass /hogehoge/ !\n <Location / >\n ProxyPass ajp://localhost:8009/\n </Location>\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T10:46:47.073",
"id": "11013",
"last_activity_date": "2015-06-05T10:46:47.073",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7343",
"parent_id": "11012",
"post_type": "answer",
"score": 2
}
] | 11012 | 11013 | 11013 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "誰かお解る方がいましたらぜひご教授お願いいたします。\n\n下記の場合は.htaccessを使用する場合どうしたらできますか? \n<http://xxxx.jp/book/vol1/#!6> ==>\n<http://xxxx.jp/sp/book/vol1/index.html#present>\n\nお願いいたします.",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T11:33:34.207",
"favorite_count": 0,
"id": "11014",
"last_activity_date": "2015-06-08T09:14:02.877",
"last_edit_date": "2015-06-07T07:22:18.330",
"last_editor_user_id": "5519",
"owner_user_id": "9013",
"post_type": "question",
"score": -1,
"tags": [
".htaccess"
],
"title": ".htaccessでPC_URLからredirect SP",
"view_count": 93
} | [
{
"body": "※動作は未確認です\n\nhtaccessの詳細な設定方法は別途お調べ頂くとして、恒久的なリダイレクトは下記です。\n\n```\n\n Redirect permanent http://xxxx.jp/book/vol1/#!6 http://xxxx.jp/sp/book/vol1/index.html#present\n \n```\n\n一時的にリダイレクトする場合は`permanent`部を`temp`としてください。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T09:14:02.877",
"id": "11117",
"last_activity_date": "2015-06-08T09:14:02.877",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10006",
"parent_id": "11014",
"post_type": "answer",
"score": 1
}
] | 11014 | null | 11117 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "NetBeans8.0.2を使用しています。OSはMac OS X 10.10.3です。\n\nGoogle App Engine for PHPを使用するため[サービス]-[サーバー]で \nステップ1.サーバーを選択・・・Google App Engine \nとしたのですが、次の \nステップ2.Server Locationになにを入力すればいいのかわかりません。\n\n```\n\n /usr/local/google_appengine\n \n```\n\nや\n\n```\n\n /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine\n \n```\n\nを入力しても\n\n> Provide a valid Google App Engine Location\n\nと出たままで次のステップへ進めません。\n\nGoogle App Engine for PHPは \n<https://cloud.google.com/appengine/downloads> \nからMac用の1.9.21をダウンロードしています。\n\nNetBeansのプラグインは \n<https://code.google.com/p/nb-gaelyk-plugin/downloads/list> \nから\n\n```\n\n nbappengine-7.4.x-gae1.8.x-3.0.2.zip\n \n```\n\nをダウンロードし\n\n```\n\n org-netbeans-modules-j2ee-appengine-deployment.nbm\n org-netbeans-modules-j2ee-appengine-editor.nbm\n org-netbeans-modules-j2ee-appengine-hints.nbm\n org-netbeans-modules-j2ee-appengine-kit.nbm\n org-netbeans-modules-j2ee-appengine-samples.nbm\n org-netbeans-modules-j2ee-appengine.nbm\n \n```\n\nをインストール済みです。\n\nちなみにGoogleAppEngineLauncherからは問題なくデプロイできています。\n\n以上、よろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-05T16:45:53.293",
"favorite_count": 0,
"id": "11016",
"last_activity_date": "2016-11-05T13:28:37.167",
"last_edit_date": "2015-09-13T17:41:20.940",
"last_editor_user_id": "10455",
"owner_user_id": "10014",
"post_type": "question",
"score": 1,
"tags": [
"php",
"google-app-engine",
"netbeans"
],
"title": "NetBeans8.0.2でのGoogle App Engine for PHPの設定について",
"view_count": 162
} | [
{
"body": "ちょっと、NetBeansを触ったことが無いので想像でしかありませんが、 \nEUかUSでは無いでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-15T03:50:45.080",
"id": "11356",
"last_activity_date": "2015-06-15T03:50:45.080",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4989",
"parent_id": "11016",
"post_type": "answer",
"score": 1
}
] | 11016 | null | 11356 |
{
"accepted_answer_id": "11019",
"answer_count": 1,
"body": "A~Zまでのアルファベットを格納しているカラムcolに対して、下記のように記述しているSQLがあるのですが、どういう意味でしょうか?\n\n```\n\n WHERE T1.col < T2.col\n \n```\n\n* * *\n\n< > を数値ではなく文字列に適用する意味を教えてください。 \nもしかして、!= ってこと?\n\n```\n\n WHERE T1.col != T2.col\n \n```\n\n* * *\n\n**対象SQL**\n\n```\n\n SELECT\n T1.col t1, \n T2.col t2 \n FROM\n Tbl T1, \n Tbl T2 \n WHERE\n T1.col < T2.col \n \n```\n\n**知りたいこと**\n\n・「WHERE T1.col < T2.col」の意味 \n・「WHERE T1.col > T2.col」との違い \n・「WHERE T1.col != T2.col」との違い",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T00:26:20.150",
"favorite_count": 0,
"id": "11018",
"last_activity_date": "2015-06-06T00:54:45.720",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7886",
"post_type": "question",
"score": 2,
"tags": [
"mysql"
],
"title": "WHERE T1.col < T2.col … < > を数値ではなく文字列に適用した場合、!=と同じ結果を得る?",
"view_count": 104
} | [
{
"body": "文字列には辞書順と呼ばれる比較方法が適用されます。大雑把に言うと文字列`A`と`B`を比較する場合\n\n * 先頭の文字`A[0]`と`B[0]`の大小を比較する\n * `A[0]` < `B[0]`であれば`A` < `B`、`A[0]` > `B[0]`であれば`A` > `B`とする\n * `A[0]` = `B[0]`の場合、次の桁`A[1]`、`B[1]`について同様の比較を行う\n * 片方の文字列の末尾まで比較して差が無かった場合、`A`と`B`の長さの比較結果を使用する\n\nというようなルールで順序が決定され、もちろん結果は`!=`とは異なります。\n\nなお上の比較で文字同士の比較を行っていますが、その結果はデータベースの場合カラムの **照合順序** で指定されているルールによって決まります。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T00:54:45.720",
"id": "11019",
"last_activity_date": "2015-06-06T00:54:45.720",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5750",
"parent_id": "11018",
"post_type": "answer",
"score": 3
}
] | 11018 | 11019 | 11019 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "こちらのサイト(<http://play-in-hell.com/>)ではページが遷移すると一番下から表示されるようになっています。 \nこのように指定した場所からトップページを表示させるにはどのようにしたらよいでしょうか?\n\n私がやりたいのは、トップページに画像が貼ってありその画像の一番下の部分が必ず見えるようにしたいです。どうしてもブラウザ表示の拡大やディスプレイの解像度によって画像の一番下の部分が隠れて表示されてしまうことがあるので、隠れてしまう場合はすこしスクロールした状態で表示させれないものかと思っています。\n\nよろしくおねがいします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T02:00:37.393",
"favorite_count": 0,
"id": "11020",
"last_activity_date": "2021-08-30T01:51:18.320",
"last_edit_date": "2015-06-06T03:30:17.917",
"last_editor_user_id": "3639",
"owner_user_id": "8823",
"post_type": "question",
"score": 3,
"tags": [
"javascript",
"jquery",
"html",
"css"
],
"title": "ページを最初から指定の位置にスクロールする",
"view_count": 24781
} | [
{
"body": "スクロール自体は`scrollTop()`を使えば可能なので、画像の座標を計算してやればOKです。\n\n```\n\n $(function(){\r\n var $img = $('#screenshot');\r\n var bottom = $img.offset().top + $img.height();\r\n var height = $(window).height();\r\n if (bottom > height)\r\n $(document).scrollTop(bottom - height);\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 \r\n <h1>一番上</h1>\r\n \r\n <img id=\"screenshot\" width=\"500\" height=\"955\" src=\"https://i.stack.imgur.com/gRkqm.png\"></img>\r\n \r\n <h1>一番下</h1>\n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T03:20:18.790",
"id": "11026",
"last_activity_date": "2015-06-06T08:33:41.343",
"last_edit_date": "2015-06-06T08:33:41.343",
"last_editor_user_id": "556",
"owner_user_id": "3639",
"parent_id": "11020",
"post_type": "answer",
"score": 1
},
{
"body": "一番下に表示するためには以下のコードで実装できます:\n\n```\n\n window.scrollTo(0,document.body.scrollHeight);\n```\n\n```\n\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\n \n <h1>一番上</h1>\n \n <img id=\"screenshot\" width=\"500\" height=\"955\" src=\"https://i.stack.imgur.com/gRkqm.png\"></img>\n \n <h1>一番下</h1>\n```\n\n## 参照\n\n * [Scroll automatically to the bottom of the page](https://stackoverflow.com/questions/11715646/scroll-automatically-to-the-bottom-of-the-page)\n * [Javascript scroll to bottom of page](https://web.archive.org/web/20150316210758/http://www.sourcetricks.com/2010/07/javascript-scroll-to-bottom-of-page.html)\n * [Javascript: scroll to bottom of page/window](http://www.alecjacobson.com/weblog/?p=753)\n * [How to Scroll a Page With JavaScript](http://www.mediacollege.com/internet/javascript/page/scroll.html)\n\n**Note** : スニペット内のHTMLには\n[@h2so5](https://ja.stackoverflow.com/users/3639/h2so5)\nさんのものを使わせて頂きました。ありがとうございます。",
"comment_count": 2,
"content_license": "CC BY-SA 4.0",
"creation_date": "2015-06-06T08:30:23.903",
"id": "11039",
"last_activity_date": "2021-08-30T01:51:18.320",
"last_edit_date": "2021-08-30T01:51:18.320",
"last_editor_user_id": "3060",
"owner_user_id": "556",
"parent_id": "11020",
"post_type": "answer",
"score": 2
}
] | 11020 | null | 11039 |
{
"accepted_answer_id": "11028",
"answer_count": 1,
"body": "**Bootstrap3 アイコンを増やしたい** のですが、どうすれば良いでしょうか?\n\n**Font Awesome** \n・クラス指定ではなく、iタグで指定しなければいけないのでしょうか? \n・既存の「Bootstrap3 アイコン」と併用可能でしょうか?\n\n**Font Awesome 以外** \n・「Bootstrap3 アイコン」として使用可能なフォントはあるでしょうか?",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T03:12:53.753",
"favorite_count": 0,
"id": "11025",
"last_activity_date": "2015-06-11T22:33:19.153",
"last_edit_date": "2015-06-11T22:33:19.153",
"last_editor_user_id": "7886",
"owner_user_id": "7886",
"post_type": "question",
"score": 2,
"tags": [
"css",
"bootstrap"
],
"title": "Bootstrap3 のファントアイコンを増加したい",
"view_count": 174
} | [
{
"body": "> クラス指定ではなく、iタグで指定しなければいけないのでしょうか?\n\nFont Awesome はインライン要素で利用することが想定されており、i 以外 (span など) を利用することもできます: [Font\nAwesome is designed to be used with inline elements (we like the <i> tag for\nbrevity, but using a <span> is more semantically correct).\n](http://fortawesome.github.io/Font-Awesome/examples/)\n\n> 既存の「Bootstrap3 アイコン」と併用可能でしょうか?\n\nBootstrap のアイコンと併用可能です。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T03:36:23.917",
"id": "11028",
"last_activity_date": "2015-06-06T11:34:14.313",
"last_edit_date": "2015-06-06T11:34:14.313",
"last_editor_user_id": "556",
"owner_user_id": "76",
"parent_id": "11025",
"post_type": "answer",
"score": 1
}
] | 11025 | 11028 | 11028 |
{
"accepted_answer_id": "11029",
"answer_count": 1,
"body": "アルゴリズムとデータ構造という書籍を買い、下記よりC/C++のソースコードをダウンロードしました。 \n<http://www.sbcr.jp/books/img/takarabako/>\n\n以前した質問([CのソースコードをVisual Studio\nExpressを利用してコンパイル・実行したい](https://ja.stackoverflow.com/questions/2981/c%E3%81%AE%E3%82%BD%E3%83%BC%E3%82%B9%E3%82%B3%E3%83%BC%E3%83%89%E3%82%92visual-\nstudio-\nexpress%E3%82%92%E5%88%A9%E7%94%A8%E3%81%97%E3%81%A6%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB-%E5%AE%9F%E8%A1%8C%E3%81%97%E3%81%9F%E3%81%84))の回答と同様に、\n\n> cl list2-6.cpp enter\n\nとすると、\n\n> /out:list2-6.exe \n> list2-6.obj \n> LINK : fatal error LNK1561: エントリー ポイントを定義しなければなりません。\n\nという表示が出てきて上手くコンパイルできません。 \nどこで問題が生じているか教えていただけないでしょうか? \nちなみに list2-6.cpp は以下のようなコードです。\n\n```\n\n // <C++版蔵書検索>\n // ※インクルードファイルやmain()関数はC言語版と同じ\n \n // 蔵書クラス\n class CBook\n {\n public:\n char *title;\n char *author;\n int bookID;\n int available; /* 貸し出し中なら0,そうでなければ1 */\n \n // 比較演算子のオーバロード\n // sortbook()のなかでCBookどうしを比較\n bool operator<(CBook&book)\n {\n return bookID<book.bookID;\n }\n bool operator>(CBook&book)\n {\n return bookID>book.bookID;\n }\n // int型へのキャストをオーバロード\n // searchbook()のなかでkeyとbookIDを比較\n operator int()\n {\n return bookID;\n }\n };\n \n #define N 5\n \n CBook*bookarray[N]; /* 蔵書データのポインタの配列 */\n \n /* 蔵書のデータを初期化する */\n void initdata()\n {\n int n;\n \n for(n=0;n<N;++n)\n bookarray[n]=new CBook;\n \n bookarray[0]->title=\"book0\";\n bookarray[1]->title=\"book1\";\n bookarray[2]->title=\"book2\";\n bookarray[3]->title=\"book3\";\n bookarray[4]->title=\"book4\";\n \n bookarray[0]->author=\"author0\";\n bookarray[1]->author=\"author1\";\n bookarray[2]->author=\"author2\";\n bookarray[3]->author=\"author3\";\n bookarray[4]->author=\"author4\";\n \n bookarray[0]->bookID=1000;\n bookarray[1]->bookID=502;\n bookarray[2]->bookID=731;\n bookarray[3]->bookID=628;\n bookarray[4]->bookID=1;\n \n bookarray[0]->available=1;\n bookarray[1]->available=0;\n bookarray[2]->available=0;\n bookarray[3]->available=1;\n bookarray[4]->available=1;\n }\n \n /* 蔵書データのメモリを解放 */\n void cleanupdata()\n {\n int n;\n for(n=0;n<N;++n)\n delete bookarray[n];\n }\n \n /* 本のデータをbookIDの順に昇順でクイックソートする */\n void sortbook(int bottom,int top)\n {\n int lower,upper;\n CBook *div,*temp;\n \n if(bottom>=top)\n return;\n \n div=bookarray[bottom]; /* 適当な基準値を選択 */\n for(lower=bottom,upper=top;lower<upper;)\n {\n // オブジェクトの大小を直接比較\n while(*bookarray[lower]<*div)\n ++lower;\n while(*bookarray[upper]>*div)\n --upper;\n if(lower<upper)\n {\n /* データ(へのポインタ)の順番を入れ替える */\n temp=bookarray[lower];\n bookarray[lower]=bookarray[upper];\n bookarray[upper]=temp;\n ++lower;\n --upper;\n }\n }\n sortbook(bottom,upper);\n sortbook(upper+1,top);\n }\n \n /* booksのなかからbookIDがkeyと一致するデータをバイナリサーチで\n 検索して,その添え字を返す。見つからなければ-1を返す */\n int searchbook(CBook *books[],int size,int key)\n {\n int left,mid,right;\n \n left=0;\n right=size;\n while(left<right)\n {\n mid=(left+right)/2;\n if(*books[mid]<key) // CBookのbookIDとkey を比較\n left=mid+1;\n else\n right=mid;\n }\n if(*books[left]==key) // 同上\n return left;\n \n return -1; /* 見つからなかった場合 */\n }\n \n```\n\n(追記)\n\n```\n\n // <C++版蔵書検索>\n // ※インクルードファイルやmain()関数はC言語版と同じ\n \n```\n\nとあるように、この部分のコードが抜けていたのが原因でした。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T03:30:20.703",
"favorite_count": 0,
"id": "11027",
"last_activity_date": "2015-06-06T04:07:08.067",
"last_edit_date": "2017-04-13T12:52:38.920",
"last_editor_user_id": "-1",
"owner_user_id": "5363",
"post_type": "question",
"score": 1,
"tags": [
"c++",
"visual-studio"
],
"title": "C++のソースコードをVisual Studio Expressを利用してコンパイル・実行したい",
"view_count": 996
} | [
{
"body": "> C++ Source をコンパイル&実行する方法を教えてください。\n\nとのことですが、main()関数が見当たりません。何を実行したいとお考えなのでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T03:58:05.467",
"id": "11029",
"last_activity_date": "2015-06-06T03:58:05.467",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4236",
"parent_id": "11027",
"post_type": "answer",
"score": 1
}
] | 11027 | 11029 | 11029 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "`ShutdownBlockReasonCreate()` を呼び出し `WM_QUERYENDSESSION` に `FALSE`\nを返すことでシャットダウンをブロックすることができますが、シャットダウンをキャンセルすると、ブロックしたアプリケーションでIMEの未確定文字列が表示されなくなってしまいました。\n\n\n\nWin7 のマシンでは再現しなかったので、8(.1) で仕様が変わったのかなと考えています。\n\nアプリケーションを起動しなおせば直るのですが、この挙動を回避する方法はあるのでしょうか?\n\n```\n\n // スクリーンショットに使ったサンプルコード\n // VisualStudio の Win32 Project から以下のように変更した\n LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\n {\n switch (message)\n {\n case WM_CREATE:\n CreateWindow(\n _T(\"EDIT\"), _T(\"hoge\"),\n WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT,\n 0, 0, 600, 400, hWnd, NULL, hInst, NULL\n );\n break;\n case WM_QUERYENDSESSION:\n ShutdownBlockReasonCreate(hWnd, _T(\"test\"));\n return FALSE;\n case WM_DESTROY:\n PostQuitMessage(0);\n break;\n default:\n return DefWindowProc(hWnd, message, wParam, lParam);\n }\n return 0;\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T04:34:48.957",
"favorite_count": 0,
"id": "11030",
"last_activity_date": "2022-04-16T18:02:25.210",
"last_edit_date": "2015-07-12T00:58:25.093",
"last_editor_user_id": "8616",
"owner_user_id": "8000",
"post_type": "question",
"score": 9,
"tags": [
"c",
"winapi",
"windows-8"
],
"title": "シャットダウンをキャンセルすると、IMEの未確定文字列が表示されなくなる?",
"view_count": 654
} | [
{
"body": "もしそのソフトでしか起きない事象であるなら関係ないかもしれませんので参考程度に。\n\n実際には確認していませんが、恐らく先に何らかのIME関連のプロセスが終了してしまったのではないでしょうか。\n\n[`SetProcessShutdownParameters`](https://msdn.microsoft.com/ja-\njp/library/cc429338.aspx)でシャットダウンの通知の優先順位を上げてみてはいかがでしょう。\n\nただし対象のプロセスが同様に優先順位を上げている場合、確実に先に通知を受け取る保証はできません。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2017-06-20T11:00:28.593",
"id": "35747",
"last_activity_date": "2017-06-20T11:00:28.593",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": null,
"parent_id": "11030",
"post_type": "answer",
"score": 1
}
] | 11030 | null | 35747 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "htmlの`<input type=\"text\">`で変換キーを押しても、ひらがなが漢字などに変換できないようにしたいのですが、どうすればいいのでしょうか? \nSpace key なら Keycodeをつかってやればいいのですが、変換キーはどうすればいいのでしょうか?",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T05:23:03.967",
"favorite_count": 0,
"id": "11032",
"last_activity_date": "2015-08-18T19:25:18.087",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5246",
"post_type": "question",
"score": 3,
"tags": [
"javascript",
"html"
],
"title": "<input type=\"text\">で漢字変換を無効にする",
"view_count": 1899
} | [
{
"body": "あまり良い方法ではないかも知れませんが、このようにした所それらしく動きました。\n\n```\n\n // input要素を取得する\n var input = document.getElementById(\"input\");\n \n // input要素にイベントリスナを追加する\n input.addEventListener(\"keyup\", function(){\n // inputの値が[ぁ-ん]のみで構成されている、つまり全てひらがなであれば\n if( this.value.match(/^[ぁ-ん]+$/) ){\n // フォーカスを奪って\n this.blur();\n // フォーカスを返す\n this.focus();\n }\n });\n \n```\n\n`input`の入力値をみて、それが全てひらがなであれば、フォーカスを奪って返すことで一瞬フォーカスが離れるので、その時に入力値が確定されます。 \n全てひらがなというのは、例えば\"漢字\"と打つ時に、最初の\"k\"の状態では確定しないためです。 \n\"か\"になって初めて確定するということですね。 \n`addEventListener`で指定している`keyup`はキーを離した時です。\n\nただこの方法だと、コピペで漢字を貼り付けられた時などには対処できませんね。 \nリスナで値にひらがな以外が含まれていたらそれを除外するような処理が必要かもしれません。\n\nお役に立てれば幸いです。\n\n\\--追記 \nGoogle Chrome 44.0.2403.155 m で動作確認をしました。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-08-18T19:10:40.537",
"id": "14602",
"last_activity_date": "2015-08-18T19:25:18.087",
"last_edit_date": "2015-08-18T19:25:18.087",
"last_editor_user_id": "10963",
"owner_user_id": "10963",
"parent_id": "11032",
"post_type": "answer",
"score": 2
}
] | 11032 | null | 14602 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "```\n\n aPromise.then(function taskA(value){\n // task A ~何らかの処理~\n }).then(function taskB(value){\n // task B\n // taskBのvalueが最終結果です。\n // この最終結果のtaskBのvalueを格納したい。\n }).catch(function onRejected(error){\n console.log(error);\n });\n \n```\n\n例となるコードを書いてみました。 \nここのタスクBのvalueを格納したいので試行錯誤したのですが、 \n結果下に書いたコードになりました。\n\n```\n\n var result = '最終結果が入る変数result';\n aPromise.then(function taskA(value){\n // task A ~何らかの処理~\n }).then(function taskB(value){\n // task B \n //ここのvalueを格納したい。\n result = value;\n }).catch(function onRejected(error){\n console.log(error);\n });\n \n```\n\nプログラミング初心者で、自信が無く、 \nこれがスマートな方法なのかが気になって質問しました。\n\nよければ回答をお願いします。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T05:39:29.217",
"favorite_count": 0,
"id": "11033",
"last_activity_date": "2019-07-29T01:02:36.290",
"last_edit_date": "2019-07-28T02:02:38.100",
"last_editor_user_id": "9008",
"owner_user_id": "10023",
"post_type": "question",
"score": 0,
"tags": [
"javascript",
"promise"
],
"title": "javascriptでpromiseの最終結果をスマートに変数へ格納する方法",
"view_count": 15276
} | [
{
"body": "promise内での計算値(result, AJAXの取得値など)を他モジュール(DOM操作とか)で利用したい、ということだと思います. \nグローバル変数の危険さ、タイミング調整の難しさを考慮すると、then内で完結するように書くのが望ましいです. \nresultを使った処理中に起こるエラーもcatch内で処理できるようになるので、処理が一箇所にまとまって幸福度が高くなります.\n\n```\n\n // ----otherModule.js----\n OtherModule.otherModuleFunction1_UseTaskB_Result = function(result) {\n // がんばってresultを使う処理部分を固めて、モジュール化します\n // taskBの計算値を引数経由で渡すと安全です\n };\n OtherModule.otherModuleFunction2_UseTaskB_Result = function(result){\n // 適度に分割\n }\n \n // ----promiseHandle.js----\n aPromise.then(function taskA(resolvedValue){\n // task A ~何らかの処理~\n return doSomething1(resolvedValue);\n }).then(function taskB(valueFromTaskA){\n var result = doSomething2(valueFromTaskA);\n OtherModule.otherModuleFunction1_UseTaskB_Result(result);\n OtherModule.otherModuleFunction2_UseTaskB_Result(result);\n }).catch(function onRejected(error){\n console.log(error);\n });\n \n```\n\n複数のPromiseを使う場合は、全員の完了を待ち合わせをするPromise.allも併用するといい感じに実現できると思います.",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T04:04:03.837",
"id": "11098",
"last_activity_date": "2015-06-08T04:04:03.837",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9796",
"parent_id": "11033",
"post_type": "answer",
"score": 1
},
{
"body": "最近では、`async` `await` を使うのがスマートかと思います。\n\n```\n\n async function myFunction(aPromise) {\n try {\n // もし taskA() も Promise を返すのだったら、'await taskA(...)'.\n let result = taskB(taskA(await aPromise));\n ...\n } catch (error) {\n console.log(error);\n }\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 4.0",
"creation_date": "2019-07-28T23:45:27.493",
"id": "56995",
"last_activity_date": "2019-07-29T01:02:36.290",
"last_edit_date": "2019-07-29T01:02:36.290",
"last_editor_user_id": "3475",
"owner_user_id": "3475",
"parent_id": "11033",
"post_type": "answer",
"score": 0
}
] | 11033 | null | 11098 |
{
"accepted_answer_id": "11949",
"answer_count": 2,
"body": "サーバ管理用に使う、スクリプトや設定ファイルは、どのように変更管理してますか。 \n共用アカウントを使い、本番サーバしか無い状態で、変更管理をする場合は、みなさんはどのように管理されていますか?\n\n私は、社内向けに提供するデータ分析用のサーバの管理及びデータ解析を任される事になりました。 \nただ、規模が小さいので、開発-ステージング-本番といったアプリ開発の様な構成も取れず、 \n直接本番サーバのスクリプトや設定を弄っている状態です。\n\n現状の管理方法としては、同一フォルダにディレクトリを用意して、「~.pl.r1」の様にして過去分を管理しているのですが、これはさすがに色々マズ過ぎと考えています。\n\nまた、簡単な構成は下記の様になります。\n\nログの集約サーバがあり、そこのログで必要な分を、機能ごとに分けた分析用サーバ(複数)はマウントして使用する(どちらのサーバもすべて仮想マシン)。\n\nまた、ログの集約サーバには分析用サーバ用の共有ライブラリ(perl、sh)もあり、 \n各分析サーバはそこをマウントして共用する。\n\nと言った状態です。\n\n私なりの答えとしては、 \nログの集約サーバにリポジトリを作成して、各分析サーバはそれをチェックアウトして使用する。 \nと言うものですが、アプリ屋あがりなので、インフラ管理という視点ではどうなのか検討がつきません。\n\nさらに、githubの様な外部のホスティングサービスは、上司の許可が下りないので、 \n使えるとしても、subversionやGitLab、GitBucketあたりのオンプレミスなバージョン管理ツールしか使用出来ません。\n\nまた、個人情報を扱うログデータもある為、それを加工するスクリプトには、一部の人しか触れないようにロール管理も必要です。\n\nみなさんならどう対応しますか?",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T05:48:03.357",
"favorite_count": 0,
"id": "11034",
"last_activity_date": "2015-09-30T07:26:28.947",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9291",
"post_type": "question",
"score": 6,
"tags": [
"linux",
"svn",
"gitlab",
"デプロイ"
],
"title": "[インフラ管理者向け]本番サーバのスクリプトや設定ファイルの変更管理ってどうしてますか?",
"view_count": 1762
} | [
{
"body": "何が課題であるか、説明ごとに論点がズレているようにも感じます。 \n例えば過去分をリネームで管理していることが課題なのかと思えば、分散サーバにチェックアウト…という話が挙がってくるので、なぜチェックアウトが必要なのか、という疑問が生じてしまうのです。 \nリポジトリ管理とデプロイは別の話です。\n\n「インフラ管理という視点ではどうなのか」と言われても、共用アカウントで開発環境すら用意できないという前提では、制約の中でしか考えられません(つまりベターですらない)。\n\n読み解ける情報からだけ判断すれば、サーバにリポジトリを作るというのは、「過去分を管理」という観点では正しいと思います。 \nもし、共有ライブラリ以外のスクリプトも、分散サーバに「コピー」しないといけないと言うのであれば、タグからしてLinuxをお使いのようですから、rsyncでデプロイしてもよいのではないでしょうか。\n\nロール管理も、現時点でサーバへアクセス権がない人には、引き続きアクセス権がないので問題ありませんし、今は正しくないアクセス権があって困っているというのなら(そうは書いてありませんが)、まずはアクセス権を正しく設定するところから始めないと意味がありません。\n\ngitで履歴を管理するだけであれば、リモートサーバを置く必要はありません。ローカルリポジトリを他と共有するために置く場所ですから、共有する必要がなければ必要ないと思います。 \nオンプレミスで置くのであれば、今はGitLabが一番容易だと思いますが、サーバは丸一台仮想で用意した方がよいです。Javaを動かすことができるウェブサーバ(tomcatなど)があるのであれば、GitBucketも容易です。jarファイルの設置だけで使えます。\n\nただし、本番サーバに乗せよう…というなら、いずれにしてもお勧めはしません。 \n「インフラの観点」からいえば、一つのサーバに何でもてんこ盛りにするのはリスクです。仮想化で運用されているのなら、新しいサーバを立てます。",
"comment_count": 6,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T08:35:07.070",
"id": "11073",
"last_activity_date": "2015-06-07T08:35:07.070",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3858",
"parent_id": "11034",
"post_type": "answer",
"score": 1
},
{
"body": "私ならですが、 \nまず共有アカウントの運用をやめ、個別アカウントの運用に変えます。 \nroot の直接ログインを全面的に禁止して sudo などを使うようにします。\n\nロール管理はファイルパーミッション、sudoers、などで制御します。 \nこれられではロール管理が不十分であれば selinux を使います。\n\n/etc 以下のファイルであれば etckeeper を使いバージョン管理を行います。 \netckeeper は VCS のラッパーで Git/SVN などが使えます。 \n/etc 以外のファイルは Git/SVN でローカルリポジトリで管理する感じです。",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-07-02T06:20:24.410",
"id": "11949",
"last_activity_date": "2015-07-02T06:20:24.410",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5008",
"parent_id": "11034",
"post_type": "answer",
"score": 1
}
] | 11034 | 11949 | 11073 |
{
"accepted_answer_id": "11044",
"answer_count": 2,
"body": "complete-itemsのinfoキーの値に改行を含まない折り返し4行以上の長い文字列を書き込むと、 \npreview windowに表示された時に先頭から3行分の文字列しか表示されません。 \nset previewheigthを実行すると12と表示されました。 \npreview windowに長い文字列だったとしても表示させる方法を教えてください。\n\n```\n\n \" vimrc最小内容\n fun! CompleteSample(findstart, base)\n if a:findstart\n let line = getline('.')\n let start = col('.') - 1\n while start > 0 && line[start - 1] =~ '\\a'\n let start -= 1\n endwhile\n return start\n else\n let res = []\n \" 当方の環境は15インチディスプレイを使っておりターミナルを最大化していないので、先頭の「あ」から最後の「い」まで折り返して4行分になります。\n call add(res, {\"word\": \"test\", \"info\": \"ああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああいあああああああああああああああああああああああうあああああああああああああああえああああああおいああああああああああああああああああああああああい\"})\n call add(res, {\"word\": \"dummy\", \"info\": \"dummy\"})\n return res\n endif\n endfun\n set completefunc=CompleteSample\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T06:26:29.843",
"favorite_count": 0,
"id": "11035",
"last_activity_date": "2015-10-23T14:15:24.990",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10022",
"post_type": "question",
"score": 2,
"tags": [
"vim"
],
"title": "preview windowに全ての文字列が表示されない",
"view_count": 196
} | [
{
"body": "ヘルプを見る限り補完時に開かれるプレビューウィンドウの高さは最大3行というのは仕様のようです。 \n`:h 'completefunc'`の文中から`:h complete-\nfunctions`へ飛んで80行(jaの場合は73行)ほど読み進めると以下の記述があります。\n\n```\n\n プレビューウィンドウの大きさは 3 行だが、'previewheight' が 1 か 2 のときはその高さで表示される。\n \n```\n\nじゃぁ、'previewheight'の12はいつ使われるかですが `:h 'previewheight'`を見ると`:ptag`関連(:pedit,\n:psearch, :ptj, :ptselect)で新規にプレビューウィンドウが開かれる時に使われるとの記述があります。\n\nそれで、今回の解決策ですが「補完操作を行う前にあらかじめプレビューウィンドウを開いておく」とかでしょうか。もしかしたらautocmdを使って何とか出来るかもしれませんがそこは他の方にお任せしたいと思います。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T09:57:21.060",
"id": "11043",
"last_activity_date": "2015-10-23T14:15:24.990",
"last_edit_date": "2015-10-23T14:15:24.990",
"last_editor_user_id": "2687",
"owner_user_id": "2687",
"parent_id": "11035",
"post_type": "answer",
"score": 2
},
{
"body": "これでどうでしょうか。\n\n```\n\n autocmd WinEnter * if &previewwindow | execute 'resize' &previewheight | endif\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T11:19:45.473",
"id": "11044",
"last_activity_date": "2015-06-06T11:19:45.473",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9575",
"parent_id": "11035",
"post_type": "answer",
"score": 2
}
] | 11035 | 11044 | 11043 |
{
"accepted_answer_id": "11083",
"answer_count": 1,
"body": "例えば以下のコードのように、メソッド以外で`return;`や`retrun false;`を実行するとそこで処理が止まってしまうのはなぜですか?\n\n```\n\n var n = 0;\n // 出力される\n console.log(\"hoge\");\n \n if ( n == 0 ) return;\n \n // 出力されない\n console.log(\"foo\");\n \n```\n\nよろしくお願いします。\n\n## UPDATE Mon 8 June\n\nnodejsでの実行環境になります。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T08:12:48.373",
"favorite_count": 0,
"id": "11037",
"last_activity_date": "2015-06-08T04:32:41.083",
"last_edit_date": "2015-06-08T04:32:41.083",
"last_editor_user_id": "556",
"owner_user_id": "556",
"post_type": "question",
"score": 2,
"tags": [
"javascript",
"node.js"
],
"title": "NodeJSでの return; もしくは return false; の挙動について",
"view_count": 1198
} | [
{
"body": "もし、Node.jsで実行しているのであれば... \nNode.jsではファイルごとに1つの関数としてコンパイルされるため、サンプルコードの`return`文は有効なコードとなります。本来の意味通り、関数の実行を中断して呼び出し元に帰ります。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T20:47:25.993",
"id": "11083",
"last_activity_date": "2015-06-07T20:47:25.993",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4809",
"parent_id": "11037",
"post_type": "answer",
"score": 3
}
] | 11037 | 11083 | 11083 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "UnityのC#(Mono)でサーバー側でgzip圧縮されたデータをHttpWebRequestのGetResponse()メソッドを使用して受け取りたいです。\n\n下記のソースの \n**using (HttpWebResponse wres = (HttpWebResponse)req.GetResponse())** \nを実行すると、 \n**DllNotFoundException: MonoPosixHelper** \nというエラーが出てレスポンスを受け取ることができません。\n\n調査したところ、MonoにはGZipStreamの名前空間はいるようなのですが実装部はいないようです。 \n※なぜならコンパイルは通りますが、GzipStreamを使用しようとすると落ちるのでInterFaceのみいるのではないかと思ってます。\n\nリクエスト側はIonic.Zip.CF.dllを使用してgzip圧縮し、サーバー側にデータを送信する事はできたのですが、下記スタックトレースを見たところGetResponse()メソッドはSystem.IO.Compression.GZipStream\nをコールするようにできているみたいで回避する方法がわかりません。\n\n開発環境:Windows7 Unity5.0.2f1\n\n \n●ソースコード\n\n```\n\n string serialized = Json.Serialize(JsonDataDic);\n HttpWebRequest req = (HttpWebRequest)WebRequest.Create(\"APIのURL\");\n \n req.ContentType = \"application/json; charset=UTF-8\";\n req.Method = \"POST\";\n req.Accept = \"application/json\";\n req.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;\n req.Headers.Add(HttpRequestHeader.ContentEncoding, \"gzip\");\n byte[] text = Encoding.UTF8.GetBytes(serialized);\n byte[] compress = Compress(text);\n req.ContentLength = compress.Length;\n // データの設定\n var s = req.GetRequestStream();\n s.Write(compress, 0, compress.Length);\n s.Close();\n \n HttpWebResponse wresa = (HttpWebResponse)req.GetResponse();\n \n using (HttpWebResponse wres = (HttpWebResponse)req.GetResponse())\n {\n using (Stream st = wres.GetResponseStream())\n {\n using (MemoryStream memoryStream = new MemoryStream())\n {\n byte[] buffer = new byte[4096];\n int count = 0;\n do\n {\n count = st.Read(buffer, 0, buffer.Length);\n memoryStream.Write(buffer, 0, count);\n \n } while (count != 0);\n string str = Encoding.UTF8.GetString(memoryStream.ToArray());\n \n var deserializedDoubleList = Json.Deserialize(str) as Dictionary<string, object>;\n }\n }\n }\n \n```\n\n●スタックトレース\n\n```\n\n DllNotFoundException: MonoPosixHelper\n System.IO.Compression.DeflateStream..ctor (System.IO.Stream compressedStream, CompressionMode mode, Boolean leaveOpen, Boolean gzip)\n (wrapper remoting-invoke-with-check) System.IO.Compression.DeflateStream:.ctor (System.IO.Stream,System.IO.Compression.CompressionMode,bool,bool)\n System.IO.Compression.GZipStream..ctor (System.IO.Stream compressedStream, CompressionMode mode, Boolean leaveOpen)\n System.IO.Compression.GZipStream..ctor (System.IO.Stream compressedStream, CompressionMode mode)\n (wrapper remoting-invoke-with-check) System.IO.Compression.GZipStream:.ctor (System.IO.Stream,System.IO.Compression.CompressionMode)\n System.Net.HttpWebResponse..ctor (System.Uri uri, System.String method, System.Net.WebConnectionData data, System.Net.CookieContainer container)\n (wrapper remoting-invoke-with-check) System.Net.HttpWebResponse:.ctor (System.Uri,string,System.Net.WebConnectionData,System.Net.CookieContainer)\n System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data)\n Rethrow as WebException: MonoPosixHelper\n System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)\n System.Net.HttpWebRequest.GetResponse ()\n \n```",
"comment_count": 4,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T08:38:14.443",
"favorite_count": 0,
"id": "11040",
"last_activity_date": "2021-01-20T00:08:55.883",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5261",
"post_type": "question",
"score": 1,
"tags": [
"c#",
"unity3d"
],
"title": "C#(Mono)でgzip圧縮データをHttpWebRequest.GetResponseで取得するには",
"view_count": 2083
} | [
{
"body": "`Accept-Encoding:\ngzip`を含まないようにリクエストを作り、サーバー側でgzip圧縮して返してもらうことで、圧縮したデータを送り・圧縮されたデータを受け取るAPIが実現できました。\n\n* * *\n\nこの投稿は @user3732298\nさんの[コメント](https://ja.stackoverflow.com/questions/11040/cmono%e3%81%a7gzip%e5%9c%a7%e7%b8%ae%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92httpwebrequest-\ngetresponse%e3%81%a7%e5%8f%96%e5%be%97%e3%81%99%e3%82%8b%e3%81%ab%e3%81%af#comment10170_11040)などを元に編集し、[コミュニティWiki](https://ja.meta.stackoverflow.com/q/1583)として投稿しました。",
"comment_count": 0,
"content_license": "CC BY-SA 4.0",
"creation_date": "2021-01-20T00:08:55.883",
"id": "73419",
"last_activity_date": "2021-01-20T00:08:55.883",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9820",
"parent_id": "11040",
"post_type": "answer",
"score": 1
}
] | 11040 | null | 73419 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "現在、macでphpのフレームワークslimを使って、 \nビルトインウェブサーバーであるサイトの開発を試みています。\n\nmacのブラウザからは、そのサイトにアクセスできるのですが、 \niPhoneからはできません。 \n2週間前は同じ手法でできていたのですが、 \n二週間いじらなかったら、こうなってました。\n\n# macでサーバー起動\n\nphp -S 0.0.0.0:8080\n\n# ifconfigでmacのIPアドレスを確認\n\n192.168.11.3\n\n# macのブラウザでhttp://127.0.0.1:8080にアクセス\n\n普通にサイトが見れる\n\n# 同じネットワークにつながってるiPhoneで192.168.11.3:8080にアクセス\n\n「ページを開けません。Safariはサーバーに接続できませんでした」と表示されます。 \nそして、サーバーを起動してるターミナルに↓のエラーが出ます。 \n[Sat Jun 6 21:15:11 2015] 192.168.11.1:3424 Invalid request (Unexpected EOF)\n\nちなみに、同じネットワークの別PCから同じURLにアクセスしても、 \nやはりアクセスできず、↑と同じエラーが出ます。\n\niPhoneとPCが同じネットワークにつながっていることは確認済みです。\n\n以前は、 \nそもそもこの方法を知らずに、 \n外部からアクセスする方法を調べてアクセスできていたのに、 \n二週間位ぶりに同じ方法をやったらアクセスできませんでした。\n\n他に何か設定がおかしかったり、原因のあたりがつくところがあれば教えて下さい。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T12:28:22.210",
"favorite_count": 0,
"id": "11045",
"last_activity_date": "2015-08-06T01:01:42.753",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9593",
"post_type": "question",
"score": 2,
"tags": [
"php",
"slim"
],
"title": "phpのビルトインウェブサーバーに外部からアクセスが出来ません",
"view_count": 4182
} | [
{
"body": "ターミナルに「Invalid request (Unexpected EOF)」と出るということは、ビルトインサーバへのアクセスは来ているような気がします。\n\n問題を切り分ける為に、まずは slim\nと関係の無いディレクトリを作成し、echoだけするindex.phpを置いてみて試してみてはいかがでしょうか?echoが表示されるようなら、問題は slim\n側の設定や実装にあるかもしれません。\n\nindex.php\n\n```\n\n <?php \n echo \"Hello, World\";\n \n```",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T14:01:33.507",
"id": "11048",
"last_activity_date": "2015-06-06T14:07:21.767",
"last_edit_date": "2015-06-06T14:07:21.767",
"last_editor_user_id": "9529",
"owner_user_id": "9529",
"parent_id": "11045",
"post_type": "answer",
"score": 1
},
{
"body": "Apache や nginx ではいかがでしょうか?\n\nほかにトンネルサービスの ngrok を使った方法があります。私の環境では動作を確認できました。ngrok を使ったやり方は次のようになります。\n\n最初にコマンドツールの ngrok をインストールしてコマンドラインから実行できるようにします。\n\n次に ngrok のアカウントを作成します。Github や Google アカウントによる Oauth 認証が利用できます。\n\n今度は ngrok のダッシュボードのページ (dashboard)\nで表示される認証トークンを引数にして次のコマンドを実行します。コピペできるようにコードが表示されています。\n\n```\n\n ./ngrok authtoken 認証トークン\n \n```\n\n最後に http サブコマンドを実行してサーバーを公開します。引数にはポート番号を指定します。\n\n```\n\n ./ngrok http 8080\n \n```\n\n「Forwarding」の右側にアクセスできる URL が示されるので、ブラウザーでその URL にアクセスしてページが表示されることを確認します。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-08-06T01:01:42.753",
"id": "13088",
"last_activity_date": "2015-08-06T01:01:42.753",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "568",
"parent_id": "11045",
"post_type": "answer",
"score": 0
}
] | 11045 | null | 11048 |
{
"accepted_answer_id": "11180",
"answer_count": 3,
"body": "PHPでサインインAPIを作成したのですが、以下のコードに書かれている箇所でmysqlへのインサートが失敗してしまいます。いろいろ試してみたのですが、どこが間違っているのかわかりません。 \nいろいろ試した結果以下のことがわかりました。\n\n * `lastInsertId()`は正しく呼ばれていてidを取得出来ている。\n * 1つ前のINSERTは成功している。\n * テーブル名、カラム名は正しい。\n * エラーは出ない。\n\nどなたか、どこが間違っているのかわかりますか?\n\n**ソースコード**\n\n```\n\n <?php\n header(\"Content-Type: application/json; charset=UTF-8\");\n header(\"X-Content-Type-Option: nosniff\");\n header(\"Access-Control-Allow-Origin: *\");\n header(\"Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept\");\n require_once 'functions.php';\n require_once 'session_util.php';\n \n $pdo = initDB();\n switch($_SERVER['REQUEST_METHOD']){\n case 'POST':\n $in = json_decode(file_get_contents('php://input'), true);\n $error = '';\n if(isset($in['mail_address'])&&isset($in['password'])&&isset($in['username'])){\n if(!checkEmail($pdo, $in['mail_address'])){\n $error = \"メールアドレスが登録済みです。\";\n header(\"HTTP/1.0 402 Unauthexed\");\n sendError($error);\n }else{\n $st = $pdo->prepare(\"INSERT INTO user (mail_address, password, username) VALUES (:mail_address, :password, :username)\");\n $st->bindParam(':mail_address', $in['mail_address'], PDO::PARAM_STR);\n $hashedPassword = makeHash($in['password']);\n $st->bindParam(':password', $hashedPassword, PDO::PARAM_STR);\n $st->bindParam(':username', $in['username'], PDO::PARAM_STR);\n if($st->execute()){\n $userId = $pdo->lastInsertId('id');\n $st2 = $pdo->prepare(\"INSERT INTO user_profile (user_id, username) VALUES (:user_id, :username)\");\n $st2->bindValue(\":user_id\", $userId, PDO::PARAM_INT);\n $st2->bindParam(\":username\", $in['username'], PDO::PARAM_STR);\n //このif文で失敗する。\n if($st2->execute()){\n header(\"HTTP/1.0 200 OK\");\n onSuccess($pdo, $in['mail_address'], $userId);\n }else{\n $error=\"Un known error.\";\n sendError($error);\n }\n }else{\n $error = \"server error\";\n header(\"HTTP/1.0 500 Internal Server Error\");\n sendError($error);\n }\n }\n }else{\n $error = \"メールアドレスとパスワードを入力してください。\";\n header(\"HTTP/1.0 400 Bad Request\");\n sendError($error);\n }\n break;\n }\n \n```",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T12:32:09.707",
"favorite_count": 0,
"id": "11046",
"last_activity_date": "2023-07-05T19:08:21.477",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "7232",
"post_type": "question",
"score": 2,
"tags": [
"php",
"mysql",
"pdo"
],
"title": "PHP、PDOでINSERTできない。",
"view_count": 5158
} | [
{
"body": "SQL文がエラーになっていそうなので\n\n```\n\n //このif文で失敗する。\n if($st2->execute()){\n header(\"HTTP/1.0 200 OK\");\n onSuccess($pdo, $in['mail_address'], $userId);\n }else{\n $error=\"Un known error.\";\n sendError($error);\n }\n \n```\n\nのelse節の中で\n\n```\n\n $st2->errorInfo();\n \n```\n\nによって実際のエラー原因を調べてみたほうが良いと思います。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T10:06:40.943",
"id": "11119",
"last_activity_date": "2015-06-08T10:06:40.943",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5518",
"parent_id": "11046",
"post_type": "answer",
"score": 1
},
{
"body": "自己解決いたしました。原因はuser_profileテーブルのidがauto_incrementになっていませんでした。 \nお騒がせしてしまい申し訳ありませんでした。",
"comment_count": 0,
"content_license": "CC BY-SA 4.0",
"creation_date": "2015-06-09T10:28:34.667",
"id": "11180",
"last_activity_date": "2023-07-05T19:07:11.010",
"last_edit_date": "2023-07-05T19:07:11.010",
"last_editor_user_id": "3060",
"owner_user_id": "7232",
"parent_id": "11046",
"post_type": "answer",
"score": 1
},
{
"body": "エラーの原因はわかり易くなるために毎度以下のlogファイルを見たほうがいいと思います。\n\n```\n\n SHOW VARIABLES LIKE '%log_file%';\n \n```\n\n[](https://i.stack.imgur.com/np8ub.png)\n\n**すみません、日本語は少しだけしゃべれます。",
"comment_count": 0,
"content_license": "CC BY-SA 4.0",
"creation_date": "2023-07-05T16:35:50.513",
"id": "95489",
"last_activity_date": "2023-07-05T19:08:21.477",
"last_edit_date": "2023-07-05T19:08:21.477",
"last_editor_user_id": "3060",
"owner_user_id": "58988",
"parent_id": "11046",
"post_type": "answer",
"score": -1
}
] | 11046 | 11180 | 11119 |
{
"accepted_answer_id": "11057",
"answer_count": 1,
"body": "Symfony2.7を使っています。 \ngmailでメールを送信する為に、config.ymlとparameters.ymlに設定を追加しています。 \nところが、`composer\nrequire`コマンドでパッケージの追加を実行すると、パッケージインストール後のスクリプトの実行でエラーがでます。この時、parameters.ymlをチェックすると、追加したはずのパラメータがなくなっています。\n\nこの現象の原因と、対応方法を教えてください。\n\n## # composer require の実行結果\n\ncomposer require でパッケージを追加インストールしました。 \nインストール後のスクリプトの実行で mailer_encryption が無いといった感じで、エラーになっています。\n\n```\n\n $ composer require 'doctrine/doctrine-migrations-bundle:1.0.*'\n ./composer.json has been updated\n Loading composer repositories with package information\n Updating dependencies (including require-dev)\n - Installing doctrine/migrations (dev-master 67f0268)\n Cloning 67f02686c6c779ae50489728b91026bc8199720c\n \n - Installing doctrine/doctrine-migrations-bundle (1.0.1)\n Downloading: 100% \n \n Writing lock file\n Generating autoload files\n Updating the \"app/config/parameters.yml\" file\n \n \n \n [Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException] \n You have requested a non-existent parameter \"mailer_encryption\". \n \n \n \n Script Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception\n \n \n \n [RuntimeException] \n An error occurred when executing the \"'cache:clear --no-warmup'\" command. \n \n```\n\n## # composer実行前の設定ファイル\n\ncomposer require を実行すると、parameters.yml 内の mailer_encryption と mailer_auth_mode\nが消えてしまいます。\n\napp/config/comfig.yml\n\n```\n\n swiftmailer:\n ...\n encryption: \"%mailer_encryption%\"\n auth_mode: \"%mailer_auth_mode%\"\n ...\n \n```\n\napp/config/parameters.yml\n\n```\n\n parameters:\n ...\n mailer_encryption: ssl\n mailer_auth_mode: login\n ...\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T15:27:42.363",
"favorite_count": 0,
"id": "11050",
"last_activity_date": "2015-06-07T00:33:12.850",
"last_edit_date": "2015-06-06T16:58:01.680",
"last_editor_user_id": "5444",
"owner_user_id": "9529",
"post_type": "question",
"score": 2,
"tags": [
"php",
"symfony2",
"composer"
],
"title": "Symfonyでcomposer requireすると、parameters.yml内のパラメータが消えてしまう",
"view_count": 1144
} | [
{
"body": "Symfony 2.3 以降、 parameters.yml は parameters.yml.dist から自動生成されるようになっています。\n\n * dist側で新しいものが追加されていればその値をユーザーに尋ねて設定\n * dist側でパラメータが削除されていれば **parameters.yml からも削除する**\n\nこの処理が `composer install` 時に行われます。\n\nこのため、パラメータを追加する際はdist側にも追加しないと、そのような現象が発生するかと思います。\n\ncomposer.json 内で `extra.incenteev-parameters.keep-outdated`\nを設定すればこの挙動は回避できるようですが、これは「パラメータが削除されたときにも値を残しておきたい」という時に使うものでしょうから、今回の場合は\nparameters.yml.dist に追加されることをお勧めします。\n\n参考\n\n * [Configuration (Symfony Best Practices)](http://symfony.com/doc/current/best_practices/configuration.html)\n * [Symfony2 stop Composer installing parameters.yml.dist into parameters.yml - Stack Overflow](https://stackoverflow.com/a/19126638/2818869)\n * [New in Symfony 2.3: Interactive Management of the parameters.yml File (Symfony Blog)](http://symfony.com/blog/new-in-symfony-2-3-interactive-management-of-the-parameters-yml-file)\n * [ParameterHandler/Processor.php at v2.1.1 · Incenteev/ParameterHandler](https://github.com/Incenteev/ParameterHandler/blob/v2.1.1/Processor.php#L98-100)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T00:33:12.850",
"id": "11057",
"last_activity_date": "2015-06-07T00:33:12.850",
"last_edit_date": "2017-05-23T12:38:55.307",
"last_editor_user_id": "-1",
"owner_user_id": "8000",
"parent_id": "11050",
"post_type": "answer",
"score": 2
}
] | 11050 | 11057 | 11057 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "現在アプリを開発しており、APIに現在位置情報(緯度、経度)と現在時間をURLのパラメータとして渡す処理を行いたいのですが、処理がうまくいきません。\n\nA:現在位置を取得するクラス \nB:現在時間を取得するクラス \nC:APIからデータを取得するクラス\n\n以上3つ(A,B,C)のクラスをViewControllr内でインスタンス化しviewDidload()内にA,B,Cの順に呼び出したいのですが、どうもデバックを見る限りB,C,Aの順に処理が行われているため現在位置情報をパラメータとして渡せていないのでAPIからデータを得ることができません。 \nA,B,Cの順で処理を行う良い方法はないでしょうか? \n教えていただけると幸いです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T19:32:08.240",
"favorite_count": 0,
"id": "11053",
"last_activity_date": "2015-08-06T00:41:13.613",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10024",
"post_type": "question",
"score": 1,
"tags": [
"swift"
],
"title": "swiftでの非同期通信",
"view_count": 572
} | [
{
"body": "ということは、Aの処理が非同期であるのだが、同期処理したい。ということのようですが、非同期処理のAppleの手続きを使っているかぎり、viewDidLoadのなかで、A\nB Cの完了を待つような事をするのは、禁忌です。というのは、メインスレッド(UI)の処理をブロックしているから。 \nAを始めることは、viewDidLoadの中でも出来ますが。\n\nその為、Aの処理の完了を待つためには、NSNotificationをつかうか、completion\nhandlerを使うなどして、Aの完了後に、viewDidLoadではないところで。B,Cを呼ぶようにしないといけないです。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T23:42:05.087",
"id": "11055",
"last_activity_date": "2015-06-06T23:42:05.087",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "75",
"parent_id": "11053",
"post_type": "answer",
"score": 1
}
] | 11053 | null | 11055 |
{
"accepted_answer_id": null,
"answer_count": 2,
"body": "端末に関係なく1インチの正方形を描くプログラムが組みたいです。 \n私が考えたのは \n①1dpiを出し、1インチの正方形のpxを取得\n\n```\n\n int dpi = getResources().getDisplayMetrics().densityDpi;\n \n```\n\n②仮に100pxだとしたら10×10ということになるので√pxをする。\n\n```\n\n int ippenn = (int)Math.sqrt(dpi);\n \n```\n\n③正方形の1辺に√pxを指定する\n\n```\n\n rect.set(0, 0, ippenn, ippenn);\n \n```\n\nという書き方なのですが全くうまくいかず正方形そのものが表示されませんでした。 \n変数`ippenn`を100などに書き換えると(`rect.set(0, 0, 100,\n100);`)正方形が表示されたので正方形を描くこと自体に間違いはないと思います。 \nどのようにしたら作れるでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T23:41:00.037",
"favorite_count": 0,
"id": "11054",
"last_activity_date": "2015-06-09T03:50:23.410",
"last_edit_date": "2015-06-09T03:50:23.410",
"last_editor_user_id": "49",
"owner_user_id": "8823",
"post_type": "question",
"score": 1,
"tags": [
"android",
"java"
],
"title": "Androidで1インチの正方形を描く",
"view_count": 247
} | [
{
"body": "DPIは長さ1インチあたりのピクセル数です。[DisplayMetrics](http://developer.android.com/reference/android/util/DisplayMetrics.html#densityDpi)の仕様でも120、160、240のいずれかを返すとあるので平方根を取る必要はありません。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-06T23:49:35.580",
"id": "11056",
"last_activity_date": "2015-06-06T23:49:35.580",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5750",
"parent_id": "11054",
"post_type": "answer",
"score": 1
},
{
"body": "x方向とy方向でdpi値は異なる可能性があるので、`DisplayMetrics`の`xdpi`と`ydpi`を使ったほうがよいかもしれません。\n\n<http://developer.android.com/intl/ja/reference/android/util/DisplayMetrics.html>",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T01:55:40.683",
"id": "11061",
"last_activity_date": "2015-06-07T01:55:40.683",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "845",
"parent_id": "11054",
"post_type": "answer",
"score": 1
}
] | 11054 | null | 11056 |
{
"accepted_answer_id": "11069",
"answer_count": 4,
"body": "MySQL で ORDER BY を指定しない時、SELECT結果並び順 の法則性に関するドキュメントは公開されているでしょうか?\n\n・必要なら、ORDER BY を 指定した方がよいとは思うのですが、 **指定しない場合は、どういう基準で、並び順を決定** しているのでしょうか? \n・インデックスは関係する? \n・バージョンによって異なる? \n・それに関する資料はどこかにない?\n\n* * *\n\n質問背景を追記しました。\n\n・単なる興味本位です \n・ORDER BY を 指定しない場合、MySQL\nはどういう思考に基づいて処理を行うのか、そこには一定の法則があると思うのですが、そこを開示していないのかな、と思いました \n(オープンソースだけど、処理内容を読み解くことは実質的に不可能?) \n・また、標準SQLで、「ORDER BY を指定しない」場合の取り扱いについて具体的にどう言及しているか、について知りたかったです",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T00:35:57.143",
"favorite_count": 0,
"id": "11058",
"last_activity_date": "2018-08-29T04:01:12.937",
"last_edit_date": "2015-06-07T22:52:53.483",
"last_editor_user_id": "7886",
"owner_user_id": "7886",
"post_type": "question",
"score": 12,
"tags": [
"mysql"
],
"title": "ORDER BY を指定しない時 / SELECT結果表示並び順 の法則性",
"view_count": 74241
} | [
{
"body": "ORDER BY を指定しない場合の並び順には **何の保証もありません** 。\n\nRDBMS\nがやりやすいように抽出した結果をそのまま返すわけですから、ストレージエンジンと実行計画による影響が大きいように思います。当然バージョンやインデックスによっても変化します。極論を言えば、パフォーマンスを追求した結果、キャッシュの状態で結果が変化する実装になるかもしれません。\n\n「何らかの基準で並び順が決定」されることを望むなら ORDER BY を使ってください。\n\n* * *\n\n前述のように、「デフォルトの並び順」は利用者からすれば気にしてはならないものですし、開発者からしても気にする必要のない物ですから、まとまった資料は開発者向けとしても存在しない気がします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T01:38:11.597",
"id": "11059",
"last_activity_date": "2015-06-07T01:38:11.597",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8000",
"parent_id": "11058",
"post_type": "answer",
"score": 5
},
{
"body": "こちらに似たような議論があります。\n\n[MySQL row order for \"SELECT * FROM table_name;\" - Stack\nOverflow](https://stackoverflow.com/questions/1949641/mysql-row-order-for-\nselect-from-table-name)\n\nこれを読むとやはり、結論としては法則性も保証もない、ということになりますね。\n\n単純な興味で「どうなるの?」って思うのは良いと思いますが、実務で使うSQLでは「ORDER\nBYを指定しない場合の法則性」に期待するのはNGだと思います。ORDER BYはちゃんと指定すべきです。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T01:43:00.837",
"id": "11060",
"last_activity_date": "2015-06-07T01:43:00.837",
"last_edit_date": "2017-05-23T12:38:56.083",
"last_editor_user_id": "-1",
"owner_user_id": "85",
"parent_id": "11058",
"post_type": "answer",
"score": 6
},
{
"body": "SQLの仕様上SELECTで取得できる列の並びが保証されているのはORDER\nBYが指定されている場合のみです。指定されていない場合の挙動は仕様には定義されていないので、実装依存となります。\n\nそこで実装側を考えると、一定の並びを保証するということはその通りに並び替えるコストが生じることになりますので、ORDER\nBYを指定しないというのは利用者からすれば余計な処理はするなという意思表示でもあります。従って多くの実装ではORDER\nBYが指定されない場合は特別に並び替えをしません。\n\nしたがって、\n\n> 指定しない場合は、どういう基準で、並び順を決定しているのでしょうか?\n\nという疑問への答えは、「並び順を決定していない」となります。\n\n実際に列の順番がどうなるかはストレージ上の並びかもしれませんしインデックス順かもしれません。実行計画によっても変わるでしょうからエンジンのバージョンにって変わるのも当然あり得ることです。\n\n具体的な記述としては以下のようなものがありました。\n\nJIS X 3005-2:2010 4.14.2にはこう書かれています。\n\n> 問合せ式によって指定される表の行の順序付けは,ORDER BY 句を直に含む問合せ式に対してだけ保証される。\n\n[こちらのSQL99の解説書](https://mariadb.com/kb/en/sql-99/order-by-\nclause/)には以下の記述があります。\n\n> An ORDER BY clause may optionally appear after a : it specifies the order\n> rows should have when returned from that query (if you omit the clause, your\n> DBMS will return the rows in some random order).\n\n実装側だと、[PostgreSQLのマニュアル](https://www.postgresql.jp/document/9.4/html/sql-\nselect.html)\n\n> ORDER BYが指定されない場合は、システムが計算過程で見つけた順番で行が返されます",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T06:19:50.513",
"id": "11069",
"last_activity_date": "2015-06-07T23:57:44.307",
"last_edit_date": "2015-06-07T23:57:44.307",
"last_editor_user_id": "5793",
"owner_user_id": "5793",
"parent_id": "11058",
"post_type": "answer",
"score": 10
},
{
"body": "こと mysql に限っていうと、 explain して得られる実行計画にしたがってレコードを取得していって、見つけた順に返ってきています。\n\nmysql + innodb であった場合、 innodb はあらゆるデータアクセスがなにかしらの index を経由して行われるため、 order by\nを付与しなくても結果は何かしら(システムが決定した順序に従い)ソートされているように見えたりもします。\n\nただ、これは innodb がたまたまそういう構造であったからそうなっているだけで、たとえば mysql + MyISAM\nであった場合は、本当にディスクの空いているところに行を詰めこんで行ったレコードたちが、そのディスクに格納されている順に返ってきている様子が、\n@JunichiIto さんの回答から飛べる stackoverflow の回答にて記述されています。",
"comment_count": 0,
"content_license": "CC BY-SA 4.0",
"creation_date": "2018-08-29T04:01:12.937",
"id": "47903",
"last_activity_date": "2018-08-29T04:01:12.937",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "754",
"parent_id": "11058",
"post_type": "answer",
"score": 1
}
] | 11058 | 11069 | 11069 |
{
"accepted_answer_id": "11095",
"answer_count": 3,
"body": "お世話になっております。 \nVPS環境にownCloudを実現すべく、php-mysqlをインストールしたいのですが、以下のようなエラーが出て困っております。\n\n```\n\n # yum install --enablerepo=remi php-mysql\n Loaded plugins: fastestmirror, security\n Setting up Install Process\n Loading mirror speeds from cached hostfile\n * base: ftp.tsukuba.wide.ad.jp\n * extras: ftp.tsukuba.wide.ad.jp\n * remi: remi.kazukioishi.net\n * updates: ftp.tsukuba.wide.ad.jp\n Resolving Dependencies\n --> Running transaction check\n ---> Package php-mysql.x86_64 0:5.4.41-1.el6.remi will be installed\n --> Processing Dependency: libmysqlclient.so.18(libmysqlclient_16)(64bit) for package: php-mysql-5.4.41-1.el6.remi.x86_64\n Package mysql-libs-5.5.44-1.el6.remi.x86_64 is obsoleted by mysql-community-libs-5.6.25-2.el6.x86_64 which is already installed\n --> Finished Dependency Resolution\n Error: Package: php-mysql-5.4.41-1.el6.remi.x86_64 (remi)\n Requires: libmysqlclient.so.18(libmysqlclient_16)(64bit)\n Available: mysql-libs-5.5.43-1.el6.remi.x86_64 (remi)\n libmysqlclient.so.18(libmysqlclient_16)(64bit)\n Available: mysql-libs-5.5.44-1.el6.remi.x86_64 (remi)\n libmysqlclient.so.18(libmysqlclient_16)(64bit)\n Available: mysql-libs-5.1.73-3.el6_5.i686 (base)\n Not found\n You could try using --skip-broken to work around the problem\n You could try running: rpm -Va --nofiles --nodigest\n \n```\n\n何か競合している?と考えているのですが対処方法が今ひとつ分かりません。 \nご指南いただけると幸いです。 \nよろしくお願いします。\n\nインストール済みのパッケージは以下です。\n\n```\n\n CentOS release 6.6\n # rpm -qa | grep php\n php-cli-5.4.41-1.el6.remi.x86_64\n php-xml-5.4.41-1.el6.remi.x86_64\n php-mbstring-5.4.41-1.el6.remi.x86_64\n php-common-5.4.41-1.el6.remi.x86_64\n php-5.4.41-1.el6.remi.x86_64\n php-process-5.4.41-1.el6.remi.x86_64\n php-gd-5.4.41-1.el6.remi.x86_64\n php-ldap-5.4.41-1.el6.remi.x86_64\n php-pdo-5.4.41-1.el6.remi.x86_64\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T03:36:41.750",
"favorite_count": 0,
"id": "11066",
"last_activity_date": "2015-06-09T01:14:51.733",
"last_edit_date": "2015-06-07T04:57:29.823",
"last_editor_user_id": "10012",
"owner_user_id": "10012",
"post_type": "question",
"score": 1,
"tags": [
"php",
"mysql",
"centos"
],
"title": "php-mysqlがインストールができない",
"view_count": 13040
} | [
{
"body": "remi の php-mysql-5.4.41 が、以下の libmysqlclient\nのバージョンを必要とするようコンパイルされています。該当バージョンのライブラリは remi の mysql-libs-5.5.44-1.el6.remi\nで提供されています。\n\n```\n\n $ yumdownloader --enablerepo=remi php-mysql\n $ rpm -qpR php-mysql-5.4.41-1.el6.remi.x86_64.rpm | grep libmysql\n libmysqlclient.so.18()(64bit)\n libmysqlclient.so.18(libmysqlclient_16)(64bit)\n libmysqlclient.so.18(libmysqlclient_18)(64bit)\n \n```\n\nしかし、このサーバーでは既に mysql-community-libs-5.6.25-2.el6 (mysql.com の Community\n版)がインストールされており、libmysqlclient_16 の提供が無くなっています。 \nmysql-community-libs と mysql-libs-5.5.44-1.el6.remi は共存できません。 \nphp-mysql をインストールしようとすると、libmysqlclient_16 が必要 → mysql-libs-5.5.44-1.el6.remi\nが必要 → mysql-community-libs と共存できないためエラー、となります。\n\n解決方法としては、このサーバー上(mysql-community-libs 環境)で SRPM\n(<http://rpms.remirepo.net/SRPMS/php-5.4.41-1.remi.src.rpm>)をビルドしインストールする方法が考えられます。 \nまた、依存関係だけの問題であれば、以下の手順で mysql-libs の情報だけ rpmdb\nに反映させ、インストールすることができますが、実際に動作するかどうかはわかりません。\n\n```\n\n # yumdownloader --enablerepo=remi mysql-libs-5.5.44-1.el6.remi.x86_64\n # rpm -ivh --justdb --force mysql-libs-5.5.44-1.el6.remi.x86_64.rpm\n # yum install --enablerepo=remi php-mysql\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T06:24:49.367",
"id": "11070",
"last_activity_date": "2015-06-07T06:24:49.367",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "4603",
"parent_id": "11066",
"post_type": "answer",
"score": 2
},
{
"body": "Taichi Yanagiyaさん、回答ありがとうございます。 \n早速、まず後者の方法を実行したところインストール自体は成功したのですが、ownCloudは未だにmySqlを認識してくれませんでした。\n\nそこで\n\n```\n\n #yum remove php-mysql\n \n```\n\nでいったん削除した後、前者の方法を試みようと、適当なフォルダで\n\n```\n\n # wget http://rpms.remirepo.net/SRPMS/php-5.4.41-1.remi.src.rpm\n # rpmbuild --rebuild php-5.4.41-1.remi.src.rpm\n \n```\n\nと実行したところ\n\n```\n\n warning: user remi does not exist - using root\n warning: group remi does not exist - using root\n <------ 省略-------->\n \n warning: group remi does not exist - using root\n error: Failed build dependencies:\n bzip2-devel is needed by php-5.4.41-1.el6.x86_64\n curl-devel >= 7.9 is needed by php-5.4.41-1.el6.x86_64\n gmp-devel is needed by php-5.4.41-1.el6.x86_64\n httpd-devel >= 2.0.46-1 is needed by php-5.4.41-1.el6.x86_64\n pam-devel is needed by php-5.4.41-1.el6.x86_64\n openssl-devel is needed by php-5.4.41-1.el6.x86_64\n sqlite-devel >= 3.6.0 is needed by php-5.4.41-1.el6.x86_64\n <------ 省略-------->\n \n```\n\nと出てしまいうまくいきませんでした。 \n初歩的な操作が分からずエラーになってしまっているかもしれませんがご指南いただけると幸いです。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T07:42:19.613",
"id": "11072",
"last_activity_date": "2015-06-07T07:42:19.613",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10012",
"parent_id": "11066",
"post_type": "answer",
"score": 0
},
{
"body": "Taichi Yanagiya さんのご回答で owncloud を利用するために`php-\nmysql`をインストールするという問題は解決できると思いますが、とりあえず動かしたい!ということであれば代替案として、一旦`php`と`mysql`の関連パッケージも`remove`してから\nowncloude の必要パッケージをまとめて入れなおしてみてはいかがでしょうか。\n\n```\n\n ** CentOS6.X系で、レポジトリの準備とWebサーバ・ライブラリはインストールされているものとします **\n // 関連パッケージの入れ直し\n # yum remove php*\n # yum remove mysql mysql-server mysql-lib\n # yum install --enablerepo=remi php php-mysql php-pdo php-gd php-mbstring mod_ssl mysql-server mysql\n \n // Owncloudのインストール\n # yum install owncloud --enablerepo=isv_ownCloud_community,remi\n \n // MySQLのセットアップ\n # /etc/init.d/mysqld start\n # chkconfig mysqld on\n # mysql_secure_installation\n \n // OwncloudのDB作成\n # mysql -u root -p\n \n // my.cnfの編集\n # cp /usr/share/mysql/my-large.cnf /etc/my.cnf\n # vi /etc/my.cnf\n # /etc/init.d/mysqld restart\n \n```\n\nライブラリ系が不安であれば、`yum groupinstall\n\"DevelopmentTools\"`でまとめていれてしまうか、下記な感じで個別に確認してみてください。\n\n```\n\n //ライブラリのインストール\n # yum install libzip libzip-devel zlib-devel libaio pcre pcre-devel gcc\n \n```",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T03:11:11.067",
"id": "11095",
"last_activity_date": "2015-06-09T01:14:51.733",
"last_edit_date": "2015-06-09T01:14:51.733",
"last_editor_user_id": "10006",
"owner_user_id": "10006",
"parent_id": "11066",
"post_type": "answer",
"score": 2
}
] | 11066 | 11095 | 11070 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "厳密に言うと質問というか確認したいことが2つ(か3つ)あるのですが、かなり関連することなので、まとめて書きます、ご了承ください。\n\n以下のような経緯で、`scalaz.ListT` (Listのモナドトランスフォーマー)が、Haskellの標準のものと同じく間違っていることが発覚しました \n(本当は以前から知ってる人はいたのかも知れませんが)\n\n * <http://togetter.com/li/800229>\n\nとりあえずissueを作り\n\n * <https://github.com/scalaz/scalaz/issues/921>\n\n「同型のStreamTが存在して、そちらは正しいので、ListTは消せばいいのでは?」という意見がでました。\n\n(個人的に消すこと自体にはそれほど反対でもないのですが)、それとは別に、現状のListTは間違ってるとはいえ、パフォーマンス面で有利な点がありそうなので、\n\n「ListT自体はあまり変えずに、可換な場合のみListTの使用を許可するように、新しい型クラスを作ればいいのでは?」\n\nと[自分が思いつきました。](https://github.com/scalaz/scalaz/compare/scalaz:9a99616...xuwei-k:23cb0ef)\n\nそうした場合、Haskellのwikiに可換なモナドの説明として、以下の2つが同じなら可換なモナド\n\n```\n\n do\n a <- actA\n b <- actB\n m a b\n \n do\n b <- actB\n a <- actA\n m a b\n \n```\n\nという説明がありますが、\n\n<https://wiki.haskell.org/Monad>\n\n * Haskellやscalazの間違った`ListT`が要求する\"可換なモナド\"とは、上記のコードで必要十分条件でしょうか?(制約が、強すぎない? or 弱すぎない?)\n\n * もし必要十分条件でないのなら、どのような条件が足りないか(or もっと弱めるにはどうすればいいか?)を、(できれば)具体的なHaskell(もしくはscalaz)のコードで示してもらいたいです。\n\nというのが1つ目(と2つ目)の質問です。\n\nまた、もし上記の方針でscalazに可換なモナドの型クラスを新規に追加するとなると、 \n(可換 or 可換でない)モナド同士を合成した場合に\n\n * 合成後のモナドは、どういう条件がそろえば可換になるのか?\n\nを考えないといけなくなりますが、そのあたりがある程度簡単に説明できそうなら教えてもらいたいです(もし長くなりそうだったり、ここに書くのは難しそうなら、参考文献を教えてもらえると助かります)\n\n以上、よろしくお願いします。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T05:23:48.820",
"favorite_count": 0,
"id": "11067",
"last_activity_date": "2015-06-07T05:42:43.347",
"last_edit_date": "2015-06-07T05:42:43.347",
"last_editor_user_id": "56",
"owner_user_id": "56",
"post_type": "question",
"score": 11,
"tags": [
"scala",
"haskell"
],
"title": "モナドの可換性(commutative)とモナドの合成",
"view_count": 777
} | [] | 11067 | null | null |
{
"accepted_answer_id": "11126",
"answer_count": 1,
"body": "下記コードの出力が文字化けしてしまってレスポンスのbodyが読めない状態です。 \nNode.jsのrequestモジュールの使い方になるのかもしれませんが、もし分かる方いたら教えてください。 \n引数にはbase64でエンコードされた文字列を渡しています。\n\nコード\n\n```\n\n var request = require('request')\n var receipt = process.argv[2]\n console.log(receipt)\n request.post({url: 'https://sandbox.itunes.apple.com/verifyReceipt',\n json: true,\n headers: {\"User-Agent\":\"MySampleApp/5.3.0 CFNetwork/711.1.12 Darwin/14.0.0\",\n \"Content-Type\":\"application/x-www-form-urlencoded\",\n \"Accept-Encoding\":\"gzip, deflate\",\n \"Accept-Language\":\"ja-jp\"},\n form: {\"receipt-data\":receipt}\n }, function(err,httpResponse,body) {\n console.log(httpResponse.statusCode)\n if (err) {\n console.log(\"ERR\")\n console.log(err)\n } else {\n console.log(body)\n console.log(JSON.stringify(body))\n console.log(JSON.parse(body))\n } \n } \n ) \n \n```\n\n出力\n\n```\n\n �V*.I,)-V�22400�s�\n \"\\u001f�\\b\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000�V*.I,)-V�22400�\\u0005\\u0000s�\\u0010\\u0000\\u0000\\u0000\"\n undefined:1\n � \n ^ \n SyntaxError: Unexpected token\n at Object.parse (native)\n at Request._callback (/Users/tsuzuki/dvideo/dummyshop/receipt-verify-test/verifyReceipt.js:19:24)\n at Request.self.callback (/Users/tsuzuki/dvideo/dummyshop/receipt-verify-test/node_modules/request/request.js:354:22)\n at Request.emit (events.js:110:17)\n at Request.<anonymous> (/Users/tsuzuki/dvideo/dummyshop/receipt-verify-test/node_modules/request/request.js:1207:14)\n at Request.emit (events.js:129:20)\n at IncomingMessage.<anonymous> (/Users/tsuzuki/dvideo/dummyshop/receipt-verify-test/node_modules/request/request.js:1153:12)\n at IncomingMessage.emit (events.js:129:20)\n at _stream_readable.js:908:16\n at process._tickCallback (node.js:355:11)\n \n```\n\nサンプルコード \n<https://github.com/toshi0383/iap-verify-receipt-sample>\n\n# 詳細\n\nIn-App Purchaseのレシート検証の試験をしています。\n\nアプリ=>自分のサーバ=>Appleという風にレシートを送って検証したいのですが、21002(The data in the receipt-data\nproperty was malformed or missing)のステータスコードで返ってきてしまっていました。 \nアプリから直接レシートを送る(レシート検証プログラミングガイドに載っているサンプルを使う)とうまく行くのですが、それは非推奨です。 \n問題を単純化するために、Charlesを使って端末から送られたPOSTリクエストを取得して、再現してみたのが、上記コードです。 \n(OSXではcurlコマンドでhttpsにPOSTする場合不具合があるため、Node.jsを使っています。)\n\nいろいろ試したところ、なんとか21002のステータスコードではないものが返ってくるようになったのですが、bodyが文字化けしてしまって、結果OKなのかどうかわからない。。という状態です。\n\nよろしくお願いいたします。",
"comment_count": 6,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T10:31:46.400",
"favorite_count": 0,
"id": "11074",
"last_activity_date": "2015-06-08T12:13:30.777",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "257",
"post_type": "question",
"score": 2,
"tags": [
"ios",
"node.js"
],
"title": "In-App Purchase: サーバ経由のレシート検証がうまくいかない",
"view_count": 4545
} | [
{
"body": "コメントで解決したようですが、一応回答をしておきます。\n\ngzipで圧縮されたレスポンスを自動的にデコードするには、requestのオプションで`gzip: true`を指定する必要があります。\n\n> gzip - If true, add an Accept-Encoding header to request compressed \n> content encodings from the server (if not already present) and decode \n> supported content encodings in the response.\n\n<https://github.com/request/request#requestoptions-callback>\n\nちなみに、`gzip: true`を指定した場合は、`Accept-Encoding`が自動的に設定されますので、質問内のコードの`\"Accept-\nEncoding\":\"gzip, deflate\",`は不要です。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T12:13:30.777",
"id": "11126",
"last_activity_date": "2015-06-08T12:13:30.777",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3639",
"parent_id": "11074",
"post_type": "answer",
"score": 3
}
] | 11074 | 11126 | 11126 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "Google App Engine(PHP)を初めて触ることになったの者です。\n\nGoogle App Engine\nLauncherを利用しwindows8.1上でテストを行っているのですが、memchachedのset()などで保存したデータは、全てローカル(windows8.1上)に保存されているようです。\n\nローカル(windows8.1上)ではなく契約しているGAEのmemchacheに値を保存することはできないのでしょうか?\n\nヘルプを見たのですが見当たりません。宜しくお願い致します。",
"comment_count": 3,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T11:00:13.853",
"favorite_count": 0,
"id": "11076",
"last_activity_date": "2015-06-07T11:00:13.853",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10032",
"post_type": "question",
"score": 1,
"tags": [
"google-app-engine",
"memcached"
],
"title": "ローカル(開発環境windows8.1)からGoogle App Engineのmemchacheに接続する方法はありますか?",
"view_count": 114
} | [] | 11076 | null | null |
{
"accepted_answer_id": "11089",
"answer_count": 2,
"body": "Postクラスがあり、Where句を使って複数Postを検索するとそのオブジェクト型はPost型に入っています。\n\n```\n\n @posts.where(state: 'published')\n \n pry> @posts\n => [#<Post id: 12, name: \"1st post\" state: \"published\", user_id: 4, created_at: \"2015-06-05 08:03:09\", updated_at: \"2015-06-05 12:41:53\">,\n #<Post id: 23, name: \"14th post\" state: \"published\", user_id: 3, created_at: \"2015-06-15 18:30:08\", updated_at: \"2015-06-15 18:30:08\">]\n \n pry> @posts.class\n => Post::ActiveRecord_Relation\n \n```\n\nこの状態だと、Postクラスに指定したメソッドが使えます。\n\nところが、あるインスタンス変数(@instance)でそれは配列の中にPost型が入っている状態で得られます。\n\n```\n\n pry> @instance\n => [#<Post id: 12, name: \"1st post\" state: \"published\", user_id: 4, created_at: \"2015-06-05 08:03:09\", updated_at: \"2015-06-05 12:41:53\">,\n #<Post id: 23, name: \"14th post\" state: \"published\", user_id: 3, created_at: \"2015-06-15 18:30:08\", updated_at: \"2015-06-15 18:30:08\">]\n \n pry> @instance.class\n => Array\n \n```\n\nこの型だと当然ながらPostクラスに指定したメソッドが使えません。 \n`NoMethodError - undefined method 'search' for #<Array:` \nではじかれます。 \n解決するには配列の型をPost型に変換するべきと思うのですが、どうすればいいのでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T13:24:43.847",
"favorite_count": 0,
"id": "11078",
"last_activity_date": "2015-06-08T02:03:37.510",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "9202",
"post_type": "question",
"score": 0,
"tags": [
"ruby-on-rails",
"ruby",
"rails-activerecord"
],
"title": "配列の中にオブジェクト型が入っているインスタンス変数をWhere句で得られる結果と同じオブジェクト型に変換する方法は?",
"view_count": 4621
} | [
{
"body": "> Postクラスがあり、Where句を使って複数Postを検索するとそのオブジェクト型はPost型に入っています。\n\n正確には`Post`クラスではなく`Post::ActiveRecord_Relation`クラスでこれは`ActiveRecord::Relation`のサブクラスです。\n\nさて、一度配列になったものを`ActiveRecord::Relation`に戻す機能は無かったと思います。\n\nただ、勝手に配列に変換されることもないので、どこかの処理で配列にしてしまっているのだと思います。その処理を見直すことでしょうか。\n\nまたは配列から`id`だけ引っ張り出して検索しなおすかです。\n\nところで、`search`メソッドは`ActiveRecord::Relation`にもないので、質問の例では`@posts.search`とやってもやはりundefined\nmethodになるはずです。",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T01:04:18.730",
"id": "11087",
"last_activity_date": "2015-06-08T01:04:18.730",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5793",
"parent_id": "11078",
"post_type": "answer",
"score": 1
},
{
"body": "本当はinstanceが配列になる前に、\n\n```\n\n @posts = Post.where(state: 'published')\n @instance = @posts.to_a\n \n```\n\nというようにし、`@posts`を使って別のクエリは扱うようにするのがいいと思います。\n\nただ、そういうのが難しい、もしくはめんどくさい場合、\n\n```\n\n Post.where(id: @instance)\n \n```\n\nとすれば、解決できます。\n\n結局idを元にDBを引き直しているだけですが。",
"comment_count": 1,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T02:03:37.510",
"id": "11089",
"last_activity_date": "2015-06-08T02:03:37.510",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "5962",
"parent_id": "11078",
"post_type": "answer",
"score": 1
}
] | 11078 | 11089 | 11087 |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "BaseAdapterに、独自のフィルター機能を付け加えたAdapterにフィルターを掛けると以下のエラーが発生してクラッシュしてしまいます。 \n具体的なクラッシュ箇所は明示されませんが、ログを見る限り、WebViewがあやしいのか?と勘ぐりたくなりますが、アプリ内でのWebViewの使用箇所はありません。\n\n以下のログは私のアプリケーション内のログです。\n\n> 06-07 22:28:33.778: W/art(9064): static void\n> art::Dbg::DdmSendHeapSegments(bool) unimplemented Not counting objects in\n> space SpaceTypeImageSpace\n> begin=0x6f4da000,end=0x6fe4ea88,size=9MB,name=\"/data/dalvik-\n> cache/arm/system@[email protected]\"] \n> 06-07 22:28:33.779: W/art(9064): static void\n> art::Dbg::DdmSendHeapSegments(bool) unimplemented Not counting objects in\n> space SpaceTypeZygoteSpace\n> begin=0x72e29000,end=0x745ae000,size=23MB,name=\"Zygote space\"] \n> 06-07 22:28:33.821: D/BoardListAdapter(9064): setFilterItems \n> 06-07 22:28:33.961: W/google-breakpad(9064): ### ### ### ### ### ### ###\n> ### ### ### ### ### ### \n> 06-07 22:28:33.961: W/google-breakpad(9064): Chrome build fingerprint: \n> 06-07 22:28:33.961: W/google-breakpad(9064): 1.0 \n> 06-07 22:28:33.961: W/google-breakpad(9064): 1 \n> 06-07 22:28:33.961: W/google-breakpad(9064):\n> 92675e2e-3e24-4fdd-9bc9-d979deace950 \n> 06-07 22:28:33.961: W/google-breakpad(9064): ### ### ### ### ### ### ###\n> ### ### ### ### ### ### \n> 06-07 22:28:33.961: E/chromium(9064): ### WebView Version 43.0.2357.121\n> (code 2357121) \n> 06-07 22:28:33.962: A/libc(9064): Fatal signal 11 (SIGSEGV), code 1, fault\n> addr 0x0 in tid 9064 (****.********)\n\nフィルター機能は、以下のようになっています。 \nBaseAdapterを継承したクラス\n\n```\n\n private ArrayList<BoardItem> mOriginalList;//元データ\n private ArrayList<BoardItem> mFilterdlList;//フィルターを適用したデータ\n private ArrayList<BoardItem> mPublishList;//表示するデータ\n private ArrayList<FilterItem> mFilterList;//フィルターデータ\n \n public void setData(Collection<? extends BoardItem> data) {\n \n synchronized (mLock) {\n mOriginalList.clear();\n mOriginalList.addAll(data);\n filter();\n }\n \n notifyDataSetChanged();\n }\n \n public void clear() {\n synchronized (mLock) {\n mOriginalList.clear();\n filter();\n }\n notifyDataSetChanged();\n }\n \n public void addAll(Collection<? extends BoardItem> items) {\n synchronized (mLock) {\n mOriginalList.addAll(items);\n filter();\n }\n notifyDataSetChanged();\n }\n \n /**\n * FilterItemをアダプターにセットして、フィルターを反映させます\n * \n * @param filterItems\n */\n public void setFilterItems(ArrayList<FilterItem> filterItems) {\n Log.d(TAG, \"setFilterItems\");\n synchronized (mLock) {\n mFilterList.clear();\n mFilterList.addAll(filterItems);\n filter();\n }\n \n notifyDataSetChanged();\n }\n \n /**\n * FilterItemをアダプターにセットして、フィルターを反映させます\n * \n * @param filterItems\n */\n public void addFilterItem(FilterItem filter) {\n Log.d(TAG, \"addFilterItem\");\n synchronized (mLock) {\n mFilterList.clear();\n mFilterList.add(filter);\n filter();\n }\n \n notifyDataSetChanged();\n }\n \n /**\n * 時間制約(公開一秒前)によるフィルタリングを行います\n */\n private void filterByTime() {\n // 時間制限によるフィルター\n ArrayList<BoardItem> filterdList = new ArrayList<>();\n ArrayList<BoardItem> copyList = null;\n \n copyList = new ArrayList<>(mFilterdlList);\n \n for (Iterator<BoardItem> ite = copyList.iterator(); ite.hasNext();) {\n BoardItem boardItem = (BoardItem) ite.next();\n // 現在の日時\n Calendar nowcal = Calendar.getInstance();\n // 比較対象日時\n Calendar dateCal = Calendar.getInstance();\n try {\n dateCal.setTime(mSimpleDateFormat.parse(boardItem.getPublishDate()));\n } catch (ParseException e) {\n e.printStackTrace();\n }\n // long型の差分(ミリ秒)\n long diffTime = nowcal.getTimeInMillis() - dateCal.getTimeInMillis();\n if (diffTime > -1000) {\n filterdList.add(boardItem);\n }\n }\n mPublishList = filterdList;\n }\n \n /**\n * フィルター作業を行います\n */\n private void filter() {\n \n ArrayList<FilterItem> filterList = null;\n \n filterList = new ArrayList<>(mFilterList);\n \n if (filterList.size() == 0) {\n mFilterdlList = new ArrayList<>(mOriginalList);\n filterByTime();\n return;\n }\n \n ArrayList<BoardItem> filterdList = new ArrayList<>();\n ArrayList<BoardItem> copyList = null;\n \n copyList = new ArrayList<>(mOriginalList);\n \n BoardItem: for (Iterator<BoardItem> ite = copyList.iterator(); ite.hasNext();) {\n BoardItem item = (BoardItem) ite.next();\n for (Iterator<FilterItem> iteFilter = filterList.iterator(); iteFilter.hasNext();) {\n FilterItem filterItem = (FilterItem) iteFilter.next();\n if (filterItem.isSelected()) {\n if (filterItem.match(item.get(filterItem.getGroupName()))) {\n filterdList.add(item);\n break BoardItem;\n }\n }\n }\n }\n \n mFilterdlList = filterdList;\n \n filterByTime();\n return;\n }\n \n```",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T13:47:51.107",
"favorite_count": 0,
"id": "11079",
"last_activity_date": "2016-07-21T00:23:32.860",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3693",
"post_type": "question",
"score": 1,
"tags": [
"android",
"java",
"webview"
],
"title": "AndroidにてFatal Signal 11 (SIGSEGV), code 1,",
"view_count": 5243
} | [
{
"body": "自己解決いたしました。\n\n```\n\n filterItem.match(item.get(filterItem.getGroupName()))\n \n```\n\n内部では、PatternクラスからMattcherを生成して、メンバ変数にもたせていましたが、それが原因のようです。都度Mattcherを生成するようにしたところ、Fatal\nSignal Errorはでなくなりました。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-09T05:50:19.637",
"id": "11159",
"last_activity_date": "2015-06-09T05:50:19.637",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "3693",
"parent_id": "11079",
"post_type": "answer",
"score": 1
}
] | 11079 | null | 11159 |
{
"accepted_answer_id": null,
"answer_count": 0,
"body": "iBeacon発信機のNear圏内に入ったら、プッシュ通知を行いたいのですが、(よくあるクーポンを表示する処理など) \n<http://docs.monaca.mobi/cur/ja/sampleapp/samples/ibeacon>/などを見ても、Cordovaでバックグラウンドでビーコンを検知し処理を行う方法がわかりません。何か参考になるページなどはありませんでしょうか。よろしくお願いします。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T14:32:59.603",
"favorite_count": 0,
"id": "11081",
"last_activity_date": "2015-06-07T14:48:14.977",
"last_edit_date": "2015-06-07T14:48:14.977",
"last_editor_user_id": "3639",
"owner_user_id": "8748",
"post_type": "question",
"score": 1,
"tags": [
"monaca",
"ibeacon"
],
"title": "iBeaconを使ったアプリについて",
"view_count": 234
} | [] | 11081 | null | null |
{
"accepted_answer_id": null,
"answer_count": 1,
"body": "Android用アプリでMP3ファイルを効果音として再生するためにcordovaのMediaプラグインを有効にしたところ、ビルドした際に以下のパーミッションが自動的に設定されてしまいます。(プロジェクト内のAndroidManifest.xmlには追加していません)\n\n * 端末ステータスと端末IDの読み込み\n * 録音\n * ユーザーメモリ(本体)内のコンテンツを変更/削除\n * 保護されたストレージへのテストアクセス\n * オーディオ設定を変更\n\nMP3を再生したいだけなので上記のパーミッションは不要なのですが、全て無効(設定なし)にするにはどうすればいいのでしょうか。\n\nご存知の方がいらっしゃいましたら、ご教示いただけますでしょうか。\n\nなお、cordovaのバージョンは4.1.0を利用しています。",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T16:10:20.767",
"favorite_count": 0,
"id": "11082",
"last_activity_date": "2016-01-14T12:03:55.907",
"last_edit_date": "2016-01-14T03:01:46.440",
"last_editor_user_id": "76",
"owner_user_id": "10035",
"post_type": "question",
"score": 3,
"tags": [
"android",
"monaca",
"cordova",
"mp3"
],
"title": "Androidでアプリ内のMP3を再生する際のPermission設定",
"view_count": 525
} | [
{
"body": "残念ながら `cordova-plugin-media`\nを使用する場合には、当該プラグインが多機能をサポートしている関係で全て無効にする、ということは難しいかと思います。\n\n直接の回答にはなりませんが、別のプラグインを使用してみると良いかもしれません。プラグインは\n[Cordovaのプラグインページ](https://cordova.apache.org/plugins/)から探すこともできます。\n\nまた、使用しようとしているプラグインがどのようなパーミッションを求めているかを事前に知りたい場合に調べる方法としては、公開されているソースコードの\n`plugin.xml` 内で `uses-permission` を調べてみるとわかるかと思います。\n\n参考までに、 `cordova-plugin-media`\nのリンクを載せておきますが、質問に記載されている通り、このプラグインでは、録音、オーディオの設定変更、書き込み、端末の状態の読み込みの権限を要求しているようですね。\n\n参考情報:[cordova-plugin-media/plugin.xml](https://github.com/apache/cordova-\nplugin-media/blob/master/plugin.xml)",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2016-01-14T02:59:40.433",
"id": "20905",
"last_activity_date": "2016-01-14T12:03:55.907",
"last_edit_date": "2016-01-14T12:03:55.907",
"last_editor_user_id": "7423",
"owner_user_id": "7423",
"parent_id": "11082",
"post_type": "answer",
"score": 1
}
] | 11082 | null | 20905 |
{
"accepted_answer_id": "11090",
"answer_count": 2,
"body": "IEのCookieの設定(プライバシ)で以下のような設定があります\n\n\n\n * 個人を特定できる情報を明示的な同意なしに保存するCookie\n * 個人を特定できる情報を暗黙的な同意なしに保存するCookie\n\nこれらはどのように作ったCookieの事を言うのでしょうか?",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-07T23:03:22.757",
"favorite_count": 0,
"id": "11084",
"last_activity_date": "2015-06-08T02:20:28.877",
"last_edit_date": "2015-06-08T01:15:10.353",
"last_editor_user_id": "8000",
"owner_user_id": "4191",
"post_type": "question",
"score": 10,
"tags": [
"internet-explorer",
"cookie"
],
"title": "「個人を特定できる情報を明示的/暗黙的な同意なしに保存するCookie」とは?",
"view_count": 675
} | [
{
"body": "そもそも Cookie というのは Web Server が作成して Web UA に送りつけたデータを Web UA が Web Server\nに送り返すだけの代物です。 \nなので Cookie は「個人を特定できる情報」をブラウザ等から「盗み出す」ことはありません。 \nというわけで Cookie 自体は危険なものではありません。これをふまえて:\n\nその辺の文言の意味は P3P (The Platform for Privacy Preferences) という文書が規定しています。 \n<https://www.iajapan.org/trans2japanese/w3c/rec-p3p-20020416j.html> \n端的には Web Contents 提供側が「ウチはプライバシーを尊重しています」という宣言をユーザー側に自動的に提供するものです。 \n(サイト運営者が本当に宣言どおりに守っているかどうかはまったく別の話ですけど)\n\n具体的にどういうものなのかは提示 P3P 文書の 1.1.2 P3P 利用例とか 3.1 ポリシーの例とかを参照。\n\nプライバシー宣言は XML で完全記述してもいいのですけどサイズがでかくなるので \nコンパクトな表現が規定されていて (同 4) \n提示のダイアログにも「コンパクトなプライバシーポリシー」なる用語が出ていますね。\n\nなので質問の\n\n> どのように作った Cookie\n\nに対する回答は「 P3P 文書に基づいて必要な宣言を行って作った Cookie 」となるでしょうか。 \nWeb サイトに P3P プライバシー ポリシーを導入する方法 \n<https://msdn.microsoft.com/ja-jp/library/ms537341(v=vs.85).aspx>",
"comment_count": 2,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T02:11:48.483",
"id": "11090",
"last_activity_date": "2015-06-08T02:11:48.483",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "8589",
"parent_id": "11084",
"post_type": "answer",
"score": 9
},
{
"body": "774RRさんの回答が全てだと思います。\n\nこの回答は補足的なものとして見て頂ければ幸いですが、「 **明示的な同意**\n」とは、最初は空欄だった「プライバシ情報の収集・利用許可」チェックボックスをユーザーが自身の操作でオンにしたような場合(オプトイン属性の要件)で、「\n**暗黙的な同意**\n」とは、デフォルトでオンになっている「プライバシ情報の収集・利用許可」チェックボックスをそのままにして[OK]ボタンを押したような場合(オプトアウト属性の要件)のことです。\n\n<http://www.atmarkit.co.jp/fwin2k/experiments/ie6privacy/ie6privacy_09.html>",
"comment_count": 0,
"content_license": "CC BY-SA 3.0",
"creation_date": "2015-06-08T02:20:28.877",
"id": "11092",
"last_activity_date": "2015-06-08T02:20:28.877",
"last_edit_date": null,
"last_editor_user_id": null,
"owner_user_id": "10006",
"parent_id": "11084",
"post_type": "answer",
"score": 4
}
] | 11084 | 11090 | 11090 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.