question
dict
answers
list
id
stringlengths
2
5
accepted_answer_id
stringlengths
2
5
popular_answer_id
stringlengths
2
5
{ "accepted_answer_id": "77867", "answer_count": 1, "body": "CSVファイルをSQLServerに取り込もうとしています。\n\nデータベース内のカラムが「char(2)not\nnull」で定義しているカラムにデータを挿入する際、CSV上では半角スペース2文字のカラムがnullと判定されてしまい、以下のメッセージがスローされてしまいます。\n\n```\n\n Column 'ColumnNameX' で DBNull.Value を使用できません。\n \n```\n\nCSVファイルの中では (こんな感じで `\" \"` )\nダブルクォーテーションで囲い、明示的に空白であることを示したつもりなのですが、空白を空白として処理するのには何かオプションの指定があるのでしょうか?\n\n```\n\n public static void DoConnect()\n {\n //接続文字列の構成\n string connectionString = @\"Driver={Microsoft Text Driver (*.txt; *.csv)}; DBQ=.\\\";\n string dbStr = @\"Persist Security Info = False; database = MYDB; server = localserver; UID = sa; PWD = xxxxxx;\";\n \n using (OdbcConnection conn = new OdbcConnection(connectionString))\n {\n try\n {\n //データベース接続のOpen\n conn.Open();\n \n //CSVを読む\n OdbcCommand command = new OdbcCommand(\"SELECT * FROM TABLE_NAME.csv\", conn);\n OdbcDataReader reader = command.ExecuteReader();\n //データ型をキチンとするならSchemaを使う事!\n //DataTable t = reader.GetSchemaTable();\n \n //入れ込む先のDBへ接続\n using (SqlConnection scon = new SqlConnection(dbStr))\n {\n //接続\n scon.Open();\n SqlTransaction trn = scon.BeginTransaction(); //トランザクション開始\n try\n {\n SqlBulkCopy copy = new SqlBulkCopy(scon, SqlBulkCopyOptions.KeepNulls, trn); //コピーするときにトランザクションを結びつける\n copy.DestinationTableName = \"TABLE_NAME\";\n //そのままダイレクトに入れ込むべし\n copy.WriteToServer(reader); //★★★★ 半角スペースがnullになってしまう\n \n trn.Commit(); //コミット \n }catch(SqlException ex)\n {\n trn.Rollback();\n }\n catch(Exception ex)\n {\n trn.Rollback();\n }\n }\n }\n finally\n {\n if (conn != null)\n {\n conn.Close();\n }\n }\n }\n }\n \n```\n\n**追記:**\n\n最初の質問に以下のようなコードを追加して取得してきたデータの中身を確認したところ、半角スペースのところがnullで読み込まれていました。\n\n半角スペースをNULLではなく、半角スペースのまま読み込むことは出来ないでしょうか。\n\n```\n\n DataTable t = new DataTable();\n t.Load(reader);\n \n //結果表示\n foreach (DataRow row in t.Rows)\n {\n foreach (object item in row.ItemArray)\n {\n Console.Write(item.ToString() + \",\");\n }\n Console.WriteLine(\" \");\n }\n \n```", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-24T11:28:36.773", "favorite_count": 0, "id": "77761", "last_activity_date": "2021-06-29T22:59:16.600", "last_edit_date": "2021-06-29T00:44:00.243", "last_editor_user_id": "3060", "owner_user_id": "15047", "post_type": "question", "score": 0, "tags": [ "c#" ], "title": "CSVを読み込む際、半角スペースがnullに変換されてしまう", "view_count": 1679 }
[ { "body": "あまり詳しくないのですが、SQLにおいて末尾の空白の扱いは割と曖昧です。例えばSQL Serverにおいても[`SET\nANSI_PADDING`](https://docs.microsoft.com/ja-jp/sql/t-sql/statements/set-ansi-\npadding-transact-sql?view=sql-server-ver15)という設定が用意されており、`OFF`にすると末尾の空白を削ります。\n\n[Microsoft Text Driver (*.txt; *.csv)](https://docs.microsoft.com/en-\nus/sql/odbc/microsoft/microsoft-odbc-desktop-database-drivers?view=sql-server-\nver15)についてドキュメントを確認しましたが、この辺りを制御するオプションは用意されていませんでした。例えば[Schema.ini](https://docs.microsoft.com/en-\nus/sql/odbc/microsoft/schema-ini-file-text-file-driver?view=sql-server-\nver15)を用意して、`char(2)`等と明示しても末尾の空白は削られることを確認しました。\n\n結局、\n\n * 読み込んだ後で`char(2) not null`を満たすようにC#側で編集する\n * CsvHelperなど他のライブラリを使用する\n\nしかなさそうです。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T22:59:16.600", "id": "77867", "last_activity_date": "2021-06-29T22:59:16.600", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4236", "parent_id": "77761", "post_type": "answer", "score": 1 } ]
77761
77867
77867
{ "accepted_answer_id": null, "answer_count": 0, "body": "パソコンとモバイルでWebレイアウトを分けたいです。 \ndisplay:flex;のorderプロパティやメディアクエリを試してみたのですが、どうしてもうまくいきません。 \nHTML階層構造が異なるからだということに気が付きました。 \nモバイルでアクセスしたときだけ、HTML階層構造を変更することはできますか?\n\n* * *\n\nPCからのアクセスを想定。前提となるhtml\n\n```\n\n <div class=\"wrapper\">\n <a href=\"a\">\n <img src=\"1.jpg\">\n <p><span></span></p>\n </a>\n \n <h2><svg></svg><a href=\"\"></a></h2>\n \n <div>\n <a href=\"\"><button></button></a>\n </div>\n \n <a href=\"a\"> \n <img src=\"2.jpg\">\n <h3></h3>\n <p></p>\n <p></p>\n </a>\n \n <a href=\"b\"></a>\n <a href=\"c\"></a>\n </div>\n \n```\n\nモバイル用アクセスとして変更したいこと。 \n画像を横に並べたいです。 \n上の画像を下の画像の所へ移動させ、横に表示させたいです。 \n2つあるimgタグのリンク先は、同じです。\n\n* * *\n\nモバイルからのアクセスで表示させたいhtmlを追記しました。\n\n```\n\n <div class=\"wrapper\">\n <h2><svg></svg><a href=\"\"></a></h2>\n \n <div>\n <a href=\"\"><button></button></a>\n </div>\n \n <a href=\"a\"> \n <img src=\"1.jpg\"><img src=\"2.jpg\">\n <h3></h3>\n <p></p>\n <p></p>\n </a>\n \n <a href=\"b\"></a>\n <a href=\"c\"></a>\n </div>\n \n```", "comment_count": 7, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-24T12:05:18.180", "favorite_count": 0, "id": "77762", "last_activity_date": "2021-06-27T12:17:18.397", "last_edit_date": "2021-06-27T12:17:18.397", "last_editor_user_id": "7886", "owner_user_id": "7886", "post_type": "question", "score": 0, "tags": [ "html", "css" ], "title": "モバイルでアクセスしたときは、HTML階層構造を変更したい", "view_count": 128 }
[]
77762
null
null
{ "accepted_answer_id": null, "answer_count": 0, "body": "Windows10 HomeにVisual Studio Build Tools 2019のインストールを試みていますが、 \n存在しないディスク領域に対する容量不足の警告により、インストールできない状況です。 \nなお管理者権限で実行しています。\n\nダウンロードは [Visual Studio for Windows および Mac\nのダウンロード](https://visualstudio.microsoft.com/ja/downloads/) から行いました。\n\n### 問題\n\n画像の通り、Visual Studio Build Tools 2019 存在しないディスクドライブ (`G:`)\nの領域不足を指摘し、インストールが終了してしまいます。\n\n[![](https://i.stack.imgur.com/TTCVT.png)](https://i.stack.imgur.com/TTCVT.png)\n\n[![](https://i.stack.imgur.com/Lgysj.png)](https://i.stack.imgur.com/Lgysj.png)\n\n[![](https://i.stack.imgur.com/rCQGo.png)](https://i.stack.imgur.com/rCQGo.png)\n\nなお、C:\\ドライブには200GB以上空き領域があり、その状況で空き領域不足と指摘されるのは理解が及びません。 \nその他にもD:\\を指定すると「パスが適切ではない」とのエラー表示が出てしまい、先に進めない状況です。 \n[![](https://i.stack.imgur.com/Wb0Zx.png)](https://i.stack.imgur.com/Wb0Zx.png)\n\n### 試した・判明した事柄\n\n * 仮想マシン上に構築したWindows10にはインストールできました。\n * [同様のエラー](https://developercommunity.visualstudio.com/t/packageidmicrosoftvisualstudiobrandingenterprisepa-6/784899) に遭遇している報告をUS版コミュニティフォーラムで発見したものの、投稿者の情報不足により進展はなし。\n\n### 個人的な考察\n\n仮想マシン上のWindows10にはBitLockerが走っていないが、問題が起きているSurface 7\nProではBitlockerが適用されている為、Bitlocker特有の領域保護は障壁になっているのではないかと推測しています。\n\n### エラーログ\n\n```\n\n インストールに問題が発生しました。\n \n 次の手順に従って、パッケージ エラーのトラブルシューティングを行うことができます。\n \n 1. 個々のパッケージ エラーに対して、以下の検索 URL を使ってソリューションを検索する\n 2. 影響を受けるワークロードまたはコンポーネントの選択内容を変更してから、インストールをやり直す\n 3. マシンから製品を削除してから、もう一度インストールする\n \n この問題が既に Developer Community に報告されている場合は、そこからソリューションまたは回避策を見つ\n けることができます。問題が報告されていない場合は、他の開発者がソリューションまたは回避策を見つけることができるように新しい問題を作成することをお勧めします。Visual Studio インストーラーでは、右上隅の [フィードバックの提供] ボタンを使って新しい問題を作成できます。\n \n ================================================================================\n \n パッケージ 'Microsoft.Build.UnGAC,version=16.10.2.2130804,chip=neutral,language=neutral' のインスト\n ールに失敗しました。\n 検索 URL\n https://aka.ms/VSSetupErrorReports?q=PackageId=Microsoft.Build.UnGAC;PackageAction=Install;ReturnCode=10069\n 詳細\n リターン コード: 10069\n リターン コードの詳細: \"Microsoft.Build.UnGAC\" をインストールするための十分な領域がありませ\n ん。ドライブ G:\\ には 20000000 が必要ですが、0 しかありません。\n 影響を受けたワークロード\n C++ によるデスクトップ開発 (Microsoft.VisualStudio.Workload.VCTools,version=16.10.31205.180)\n MSBuild Tools (Microsoft.VisualStudio.Workload.MSBuildTools,version=16.0.28516.191)\n 影響を受けたコンポーネント\n C++ コア デスクトップ機能 (Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core,version=16.2.29012.281)\n C++ コア機能 (Microsoft.VisualStudio.Component.VC.CoreIde,version=16.10.31205.252)\n MSBuild (Microsoft.Component.MSBuild,version=16.5.29515.121)\n テキスト テンプレート変換 (Microsoft.VisualStudio.Component.TextTemplating,version=16.0.28625.61)\n \n```\n\n### 補足\n\n空き領域を写した画像を貼り忘れていました。\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/ebLQl.png)](https://i.stack.imgur.com/ebLQl.png)\n\nG:\\という把握していない領域について。正直当方も把握しておりません。いつ頃から存在したのかも不明です。またディスクの一覧は次の通りです。\n\n[![](https://i.stack.imgur.com/ZVyaK.png)](https://i.stack.imgur.com/ZVyaK.png)", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-24T12:16:35.033", "favorite_count": 0, "id": "77763", "last_activity_date": "2021-06-24T16:34:35.557", "last_edit_date": "2021-06-24T16:34:35.557", "last_editor_user_id": "3060", "owner_user_id": "47014", "post_type": "question", "score": 0, "tags": [ "windows", "visual-studio" ], "title": "Windows10にVisual Studio Build Tools 2019をインストールできない", "view_count": 576 }
[]
77763
null
null
{ "accepted_answer_id": null, "answer_count": 1, "body": "## やりたいこと\n\n複数オーディオトラックの入ったmp4ファイルのトラックを指定して再生がしたく、 \n最終的にはトラック1をLで再生、トラック2をRで再生というようなことがしたいです。 \nブラウザはChromeです。\n\nWebAudioAPI を使えばなんとなくできそうだと思っていたのですが、うまくいきません。(ドキュメントの読み込みが甘いかもしれません)\n\n下記で試してみたのはとりあえずトラックを指定してLRで再生させようとしています。\n\nもしWebAudioAPIでできないのであれば、代案はありますでしょうか?\n\n## ためしたこと\n\n```\n\n <html>\n <head>\n <script type=\"text/javascript\" src=\"./jquery/jquery-1.11.3.min.js\"></script>\n </head>\n <body>\n <video id=\"player\" src=\".test.mp4\" height=\"300\" controls></video>\n <br />\n <button type=\"button\" class=\"track\" data-track=\"0\">1</button>\n <button type=\"button\" class=\"track\" data-track=\"1\">2</button>\n <button type=\"button\" class=\"track\" data-track=\"2\">3</button>\n <button type=\"button\" class=\"track\" data-track=\"3\">4</button>\n <button type=\"button\" class=\"track\" data-track=\"4\">5</button>\n <button type=\"button\" class=\"track\" data-track=\"5\">6</button>\n <button type=\"button\" class=\"track\" data-track=\"6\">7</button>\n <button type=\"button\" class=\"track\" data-track=\"7\">8</button>\n \n <script type=\"text/javascript\">\n var player = document.getElementById('player');\n var audioCtx = new (window.AudioContext || window.WebKitAudioContext)();\n var audioSource = audioCtx.createMediaElementSource(player);\n \n trackSelect = function (track) {\n var splitter = audioCtx.createChannelSplitter(8); // ここで8トラックに分けている・・・つもり\n var merger = audioCtx.createChannelMerger(2);\n \n audioSource.disconnect();\n audioSource.connect(splitter);\n \n splitter.connect(merger, track, 0); // L指定\n splitter.connect(merger, track, 1); // R指定\n merger.connect(audioCtx.destination);\n };\n player.onplay = function () {\n audioCtx.resume();\n };\n player.onpause = function () {\n audioCtx.suspend();\n };\n \n trackSelect(0);\n \n $('.track').on('click', function () {\n trackSelect(+$(this).data('track'));\n });\n </script>\n </body>\n </html>\n \n```", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T01:49:50.920", "favorite_count": 0, "id": "77770", "last_activity_date": "2021-07-01T01:36:02.943", "last_edit_date": "2021-06-27T06:40:06.600", "last_editor_user_id": "3060", "owner_user_id": "29651", "post_type": "question", "score": 1, "tags": [ "javascript", "動画" ], "title": "ブラウザ上で複数オーディオトラックのmp4のトラックを指定して再生できますか?", "view_count": 489 }
[ { "body": "コメントいただきありがとうございました。 \nmp4ファイルからffmpegでトラックごとに音声を抽出し \nトラック数分のaudio(video)タグを用意し、同時再生することで対応しようと思います。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T01:36:02.943", "id": "77893", "last_activity_date": "2021-07-01T01:36:02.943", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "29651", "parent_id": "77770", "post_type": "answer", "score": 1 } ]
77770
null
77893
{ "accepted_answer_id": "77873", "answer_count": 1, "body": "ASP.NET Core MVC(.NET 5)にて、単一のClientかつ、開いた1ページから複数のAjaxリクエストを実行しています。\n\nAjaxリクエストを受けるControllerにて、リクエスト毎に異なるキーのセッション書き込みを行っています。 \n同一のClientから次のリクエストを行った際にセッションの状態を確認すると、ひとつのキーのみが書き込まれている状態です(場合によってはふたつになることもありますが)。\n\n単一のClientから異なるキーのセッション情報を書き込んだのですからセッションは同一のものが使われ、キーの競合は発生していないので、すべてのキーが書き込まれて欲しいと考えています。\n\nMicrosoftのドキュメントでは次のように書いてあります。\n\n<https://docs.microsoft.com/ja-jp/aspnet/core/fundamentals/app-\nstate?view=aspnetcore-5.0#session-options>\n\n> セッション状態は \"ロックなし\" です。 2 つの要求がセッションの内容を同時に変更しようとした場合、最後の要求が最初の要求をオーバーライドします。\n> Session は 一貫性のあるセッション として実装されます。つまり、コンテンツは全部まとめて保管されます。 2\n> つの要求が異なるセッション値を変更しようとしたとき、最後の要求が最初の要求によって行われたセッションの変更をオーバーライドすることがあります。\n\nつまり、セッションでは同時リクエストによるキーの同時書き込みはできないという結論になるでしょうか?もし、そうであるとすればセッションの代わりにどのような仕組みを使えばよいでしょうか?\n\nControllerのコード例\n\n```\n\n public async Task<IActionResult> SessionSet01Async()\n {\n await HttpContext.Session.LoadAsync();\n HttpContext.Session.SetString(\"key01\", \"001\");\n Thread.Sleep(1);\n await HttpContext.Session.CommitAsync();\n return Content(\"\");\n }\n public async Task<IActionResult> SessionSet02Async()\n {\n await HttpContext.Session.LoadAsync();\n HttpContext.Session.SetString(\"key02\", \"002\");\n Thread.Sleep(1);\n await HttpContext.Session.CommitAsync();\n return Content(\"\");\n }\n public async Task<IActionResult> SessionSet03Async()\n {\n await HttpContext.Session.LoadAsync();\n HttpContext.Session.SetString(\"key03\", \"003\");\n Thread.Sleep(1);\n await HttpContext.Session.CommitAsync();\n return Content(\"\");\n }\n public async Task<IActionResult> SessionSet04Async()\n {\n await HttpContext.Session.LoadAsync();\n HttpContext.Session.SetString(\"key04\", \"004\");\n Thread.Sleep(1);\n await HttpContext.Session.CommitAsync();\n return Content(\"\");\n }\n \n```\n\n`LoadAsync()`及び`CommitAsync()`は、無くても同じ結果です。 \n`Thread.Sleep(1)`は同時実行となるように追加しています。\n\n```\n\n <script src=\"~/lib/jquery/dist/jquery.min.js\"></script>\n <script>\n $(function () {\n $.get('/SetSession/SessionSet01');\n $.get('/SetSession/SessionSet02');\n $.get('/SetSession/SessionSet03');\n $.get('/SetSession/SessionSet04');\n });\n </script>\n \n```", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T02:18:26.107", "favorite_count": 0, "id": "77772", "last_activity_date": "2021-06-30T02:10:18.783", "last_edit_date": "2021-06-30T02:10:18.783", "last_editor_user_id": "3060", "owner_user_id": "8647", "post_type": "question", "score": 0, "tags": [ "c#", "mvc", "asp.net-core", "session" ], "title": "ASP.NET Core MVC で単一クライアントからの同時セッション書き込みは可能か?", "view_count": 660 }
[ { "body": "Microsoftのドキュメントの通り、下図のような状態でセッションデータが更新される。セッションはキー毎ではなくセッションデータ全体をまとめて保存する仕様のため同時リクエストでの書き込みはできない。\n\n[![セッションの更新状態](https://i.stack.imgur.com/8bHiP.png)](https://i.stack.imgur.com/8bHiP.png)\n\n同時リクエストで一時データの保存を行いたい場合は、RDB, Memcached,\nRedisなどの別のデータストアを用いる。(Sessionプロバイダーとしてではなく、独立したCacheとして用いる)\n\n※この内容が間違っていた場合はご指摘ください。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T02:08:35.147", "id": "77873", "last_activity_date": "2021-06-30T02:08:35.147", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8647", "parent_id": "77772", "post_type": "answer", "score": 0 } ]
77772
77873
77873
{ "accepted_answer_id": null, "answer_count": 1, "body": "Lambda (Python) を使用して、S3に保存されたことをトリガーとして FSx for Windows にファイルをコピーしたいです。\n\nしかし、検索エンジンで調べても対象の検索結果が見つかりません。\n\n公式ドキュメントには記載なし: \n<https://docs.aws.amazon.com/ja_jp/fsx/latest/WindowsGuide/what-is.html>\n\nそもそも S3 から FSx for Windows のファイルコピーはLambdaで実装できるのでしょうか?", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T02:45:15.670", "favorite_count": 0, "id": "77773", "last_activity_date": "2023-01-11T13:02:35.313", "last_edit_date": "2021-06-25T16:45:26.510", "last_editor_user_id": "3060", "owner_user_id": "37279", "post_type": "question", "score": 0, "tags": [ "python", "amazon-s3", "aws-lambda" ], "title": "Amazon S3 から FSx for Windows へのファイルコピー方法を教えて下さい", "view_count": 585 }
[ { "body": "コピーするということは、実はS3からFSx for Windowsへミラーリングしたいということになりますでしょうか? \nそうであれば、いっそ [AWS\nDataSync](https://docs.aws.amazon.com/datasync/latest/userguide/how-datasync-\nworks.html) でS3からFSx for\nWindowsへ同期してしまえばいいかと思います。あとはこの同期タスクをいつ起動するかで、Lambdaからでも実行すればいいかと。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T13:58:26.210", "id": "77791", "last_activity_date": "2021-06-25T13:58:26.210", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4236", "parent_id": "77773", "post_type": "answer", "score": 0 } ]
77773
null
77791
{ "accepted_answer_id": "77792", "answer_count": 1, "body": "メニューをクリックすると画像がメニュー文字の背後に出てくるものを作ったのですが、画像が出てくると同時に文字が左に押し出されてしまって不自然になってしまっています。z-indexで上下をいじってみたりしましたがよくわからず…わかる方ご教示していただけると助かります。画像が出てくるのはjQueryでクラスをつけたり消したりする処理をしています。\n\n```\n\n <!DOCTYPE html>\n <html lang=\"ja\">\n <head>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <title>タイトル</title>\n <link rel=\"stylesheet\" href=\"style.css\">\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js\"></script>\n </head>\n <body>\n <nav>\n <div class=\"flex_\">\n <a href=\"#\">top</a>\n <div class=\"huwahuwa\"></div>\n <a href=\"#one\">関連記事</a>\n <div class=\"huwahuwa\"></div>\n <a href=\"#two\">みなさんのメッセージ</a>\n <div class=\"huwahuwa\"></div>\n </div>\n </nav>\n <section id=\"one\">\n <p>ここはoneだよ</p>\n </section>\n <section id=\"two\">\n <p>ここはtwoだよ</p>\n </section>\n <script>\n $('.flex_ a').on('click',function(){\n $('.flex_ a').removeClass('active');\n $(this).addClass('active');\n })\n </script>\n </body>\n \n @charset \"utf-8\";\n \n html{\n scroll-behavior: smooth;\n }\n \n body{\n width:960px;\n margin:0 auto;\n font-size: 16px;\n position: relative ;\n }\n \n a {\n -webkit-transition: 0.3s;\n -moz-transition: 0.3s;\n -o-transition: 0.3s;\n -ms-transition: 0.3s;\n transition: 0.3s;\n }\n \n nav{\n height:90px;\n width:90%;\n margin:0 auto;\n position: fixed;\n top:0;\n left:0;\n }\n \n .flex_{\n max-width: 1200px;\n width:46%;\n margin:0 0 0 54%;\n height:80px;\n line-height:80px;\n display: flex;\n justify-content: space-between;\n }\n \n @media(max-width: 1100px){\n body{\n width:100%;\n }\n nav{\n width:100%;\n }\n .flex_{\n width:90%;\n margin:0 auto;\n justify-content: center;\n }\n }\n \n @media(max-width: 467px){\n .flex_{\n width:90%;\n margin:0 auto;\n justify-content:flex-start;\n flex-flow: column;\n line-height:55px;\n }\n }\n \n .flex_ a{\n display: block;\n font-size:1.25rem;\n padding:0 0 0 30px;\n color:#000;\n text-decoration: none;\n }\n \n .huwahuwa{\n animation:huwahuwa 3s infinite ease-in-out .8s alternate;\n background:url(icon.png) no-repeat center center / 60px auto;\n display:inline-block;\n transition:1.5s ease-in-out;\n width:100px;\n height:100px;\n margin-left:-100px;\n z-index:-99;\n }\n .huwahuwa{\n display: none;\n }\n .active+.huwahuwa{\n display: inline-block;\n }\n \n @keyframes huwahuwa {\n 0%{\n transform:translate(0,0) rotate(-7deg);\n }\n 50%{\n transform:translate(0,-7px) rotate(0deg);\n }\n 100%{\n transform:translate(0,0) rotate(7deg);\n }\n }\n \n .flex_ a:hover{\n opacity:0.6;\n transition: .6s;\n }\n \n #one,#two,#three{\n width:100%;\n height:600px;\n }\n #one{\n margin-top:80px;\n background:pink;\n z-index:-100;\n }\n #two{\n background:skyblue;\n z-index:-100;\n }\n \n```\n\n```\n\n $('.flex_ a').on('click',function(){\n $('.flex_ a').removeClass('active');\n $(this).addClass('active');\n })\n```\n\n```\n\n @charset \"utf-8\";\n body{\n width:960px;\n margin:0 auto;\n font-size: 16px;\n position: relative ;\n }\n \n a {\n -webkit-transition: 0.3s;\n -moz-transition: 0.3s;\n -o-transition: 0.3s;\n -ms-transition: 0.3s;\n transition: 0.3s;\n }\n \n nav{\n height:90px;\n width:90%;\n margin:0 auto;\n position: fixed;\n top:0;\n left:0;\n }\n \n .flex_{\n max-width: 1200px;\n width:40%;\n margin:0 0 0 60%;\n height:80px;\n line-height:80px;\n display: flex;\n position: relative;\n justify-content: space-between;\n }\n \n @media(max-width: 959px){\n body{\n width:100%;\n }\n .flex_{\n width:50%;\n margin:0 auto;\n }\n }\n \n .flex_ a{\n display: block;\n font-size:1.5rem;\n padding:0 0 0 15px;\n color:#000;\n text-decoration: none;\n }\n \n .huwahuwa{\n animation:huwahuwa 3s infinite ease-in-out .8s alternate;\n background:url(http://placehold.jp/150x150.png?text=icon.png) no-repeat center center / 60px auto;\n display:inline-block;\n transition:1.5s ease-in-out;\n width:100px;\n height:100px;\n margin-left:-100px;\n z-index:-99;\n }\n .huwahuwa{\n display: none;\n }\n .active+.huwahuwa{\n display: inline-block;\n }\n \n @keyframes huwahuwa {\n 0%{\n transform:translate(0,0) rotate(-7deg);\n }\n 50%{\n transform:translate(0,-7px) rotate(0deg);\n }\n 100%{\n transform:translate(0,0) rotate(7deg);\n }\n }\n \n .flex_ a:hover{\n opacity:0.6;\n transition: .6s;\n }\n \n #one,#two,#three{\n width:100%;\n height:600px;\n }\n #one{\n margin-top:80px;\n background:pink;\n z-index:-100;\n }\n #two{\n background:skyblue;\n z-index:-100;\n }\n #three{\n background:green;\n z-index:-100;\n }\n \n .hidden_box {\n margin: 0;/*前後の余白*/\n padding: 0;\n position: relative;\n }\n \n /*ボタン装飾*/\n .hidden_box label {\n padding: 15px;\n cursor :pointer;\n font-size:1.5rem;\n line-height:1.5rem;\n }\n \n /*ボタンホバー時*/\n .hidden_box label:hover {\n opacity:0.6;\n }\n \n /*チェックは見えなくする*/\n .hidden_box input {\n display: none;\n }\n \n /*中身を非表示にしておく*/\n .hidden_box .hidden_show {\n height: 0;\n padding: 0;\n overflow: hidden;\n opacity: 0;\n transition: 0.8s;\n }\n \n /*クリックで中身表示*/\n .hidden_box input:checked ~ .hidden_show {\n padding:0;\n height: 100px;\n opacity: 1;\n position: absolute;\n top:0;\n left:0;\n z-index: -99;\n }\n```\n\n```\n\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\n <nav>\n <div class=\"flex_\">\n <a href=\"#\">top</a>\n <div class=\"huwahuwa\"></div>\n <a href=\"#one\">one</a>\n <div class=\"huwahuwa\"></div>\n <a href=\"#two\">two</a>\n <div class=\"huwahuwa\"></div>\n <a href=\"#three\">three</a>\n <div class=\"huwahuwa\"></div>\n </div>\n </nav>\n <section id=\"one\">\n <p>ここはoneだよ</p>\n </section>\n <section id=\"two\">\n <p>ここはtwoだよ</p>\n </section>\n <section id=\"three\">\n <p>ここはthreeだよ</p>\n </section>\n```", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T03:06:50.627", "favorite_count": 0, "id": "77774", "last_activity_date": "2021-06-26T04:44:23.793", "last_edit_date": "2021-06-26T04:44:23.793", "last_editor_user_id": "46944", "owner_user_id": "46994", "post_type": "question", "score": 1, "tags": [ "jquery", "css", "html5" ], "title": "メニューをクリックするとメニュー文字が動いてしまう", "view_count": 107 }
[ { "body": "クリックした要素の右側に不自然な余白ができる原因は、\n\n * 画像がふわふわする要素 `div.huwahuwa` がフレックスアイテムとして認識されている。 \nこれは記載場所の関係で、`div.flex_`要素の子要素として、a要素と同等の兄弟要素として扱われるからです。\n\n * `justfy-content: space-between`が影響している。 \nこのCSSプロパティはフレックスアイテムの要素間に均等な空白を付与します。`div.huwahuwa`もフレックスアイテムの一要素となっているので、他のa要素と同様の余白が付与されます。 \nネガティブマージンの影響で`div.huwahuwa`は左側へ100pxずれますが、余白はそのまま残ります。\n\nこの2点が原因です。検証ツールでフレックスボックスの余白をチェックすると、クリックした要素の隣に余白の領域が2つあることが分かります。画像の斜線部分が`justfy-\ncontent: space-between`による余白です。\n\n[![フレックスアイテムの余白](https://i.stack.imgur.com/qpL2e.png)](https://i.stack.imgur.com/qpL2e.png)\n\n解決方法としては、ふわふわの画像をa要素と兄弟要素になるようなdivで実装するのではなく、a要素のbefore疑似要素かafter疑似要素で作成し、フレックスアイテムの扱いから外すようにすることです。before/after疑似要素は、その要素の子要素として扱われます。 \nその際、a要素には`position:relative`でスタッキングコンテキストを生成し、before/after疑似要素側は`position:absolute`と`left`,`top`\nを適切な値に指定することで両者の位置関係を容易に調整することが可能です。\n\nスニペットで再現させましたので参考にしてください。\n\n * `<div class=\"huwahuwa\">`は削除\n * 回答通りのCSSを追加\n\n```\n\n $('.flex_ a').on('click',function(){\n $('.flex_ a').removeClass('active');\n $(this).addClass('active');\n })\n```\n\n```\n\n @charset \"utf-8\";\n body {\n width: 960px;\n margin: 0 auto;\n font-size: 16px;\n position: relative;\n }\n \n a {\n -webkit-transition: 0.3s;\n -moz-transition: 0.3s;\n -o-transition: 0.3s;\n -ms-transition: 0.3s;\n transition: 0.3s;\n }\n \n nav {\n height: 90px;\n width: 90%;\n margin: 0 auto;\n position: fixed;\n top: 0;\n left: 0;\n }\n \n .flex_ {\n max-width: 1200px;\n width: 40%;\n margin: 0 0 0 60%;\n height: 80px;\n line-height: 80px;\n display: flex;\n position: relative;\n justify-content: space-between;\n }\n \n @media (max-width: 959px) {\n body {\n width: 100%;\n }\n .flex_ {\n width: 50%;\n margin: 0 auto;\n }\n }\n \n .flex_ a {\n display: block;\n font-size: 1.5rem;\n padding: 0 0 0 15px;\n color: #000;\n text-decoration: none;\n }\n \n /* 不要になったのでコメントアウト\n .huwahuwa{\n animation:huwahuwa 3s infinite ease-in-out .8s alternate;\n background:url(http://placehold.jp/150x150.png?text=icon.png) no-repeat center center / 60px auto;\n display:inline-block;\n transition:1.5s ease-in-out;\n width:100px;\n height:100px;\n margin-left:-100px;\n z-index:-99;\n }\n .huwahuwa{\n display: none;\n }\n */\n .active + .huwahuwa {\n display: inline-block;\n }\n \n @keyframes huwahuwa {\n 0% {\n transform: translate(0, 0) rotate(-7deg);\n }\n 50% {\n transform: translate(0, -7px) rotate(0deg);\n }\n 100% {\n transform: translate(0, 0) rotate(7deg);\n }\n }\n \n .flex_ a:hover {\n opacity: 0.6;\n transition: 0.6s;\n }\n \n #one,\n #two,\n #three {\n width: 100%;\n height: 600px;\n }\n #one {\n margin-top: 80px;\n background: pink;\n z-index: -100;\n }\n #two {\n background: skyblue;\n z-index: -100;\n }\n #three {\n background: green;\n z-index: -100;\n }\n \n .hidden_box {\n margin: 0; /*前後の余白*/\n padding: 0;\n position: relative;\n }\n \n /*ボタン装飾*/\n .hidden_box label {\n padding: 15px;\n cursor: pointer;\n font-size: 1.5rem;\n line-height: 1.5rem;\n }\n \n /*ボタンホバー時*/\n .hidden_box label:hover {\n opacity: 0.6;\n }\n \n /*チェックは見えなくする*/\n .hidden_box input {\n display: none;\n }\n \n /*中身を非表示にしておく*/\n .hidden_box .hidden_show {\n height: 0;\n padding: 0;\n overflow: hidden;\n opacity: 0;\n transition: 0.8s;\n }\n \n /*クリックで中身表示*/\n .hidden_box input:checked ~ .hidden_show {\n padding: 0;\n height: 100px;\n opacity: 1;\n position: absolute;\n top: 0;\n left: 0;\n z-index: -99;\n }\n \n .flex_ > a {\n /* クリック時のbefore疑似要素をa要素にスタッキングするため、positionをrelativeに */\n position: relative;\n }\n \n .flex_ > a.active::before {\n /* huwahuwaは疑似要素で表現。内容はほぼ従来のhuwahuwaと同じ。 */\n /* posotionをabsoluteに。配置位置を親のa要素基準とする。*/\n position: absolute;\n /* leftとtopを0にすることで親要素の左上と同一の位置に移動。調整したい場合はこの数値をいじってください */\n left: 0;\n top: 0;\n content: \"\";\n animation: huwahuwa 3s infinite ease-in-out 0.8s alternate;\n background: url(http://placehold.jp/150x150.png?text=icon.png) no-repeat\n center center / 60px auto;\n display: inline-block;\n transition: 1.5s ease-in-out;\n width: 100px;\n height: 100px;\n z-index: -99;\n }\n```\n\n```\n\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\n <nav>\n <div class=\"flex_\">\n <a href=\"#\">top</a>\n <a href=\"#one\">one</a>\n <a href=\"#two\">two</a>\n <a href=\"#three\">three</a>\n </div>\n </nav>\n <section id=\"one\">\n <p>ここはoneだよ</p>\n </section>\n <section id=\"two\">\n <p>ここはtwoだよ</p>\n </section>\n <section id=\"three\">\n <p>ここはthreeだよ</p>\n </section>\n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T18:40:01.513", "id": "77792", "last_activity_date": "2021-06-25T18:40:01.513", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46944", "parent_id": "77774", "post_type": "answer", "score": 0 } ]
77774
77792
77792
{ "accepted_answer_id": "77779", "answer_count": 1, "body": "### 環境\n\nruby 2.6.5 \nrails 6 \nMySQL \nM1チップ搭載macOS\n\n### 解決したいこと\n\nCircleCI起動時、’command not found'のエラーでtestが最後まで実行されません。 \nyarnがインストールできません。 \nどういった解決策がありますか? \n教えていただきたいです!\n\n### 発生している問題・エラー\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/vAMkX.png)](https://i.stack.imgur.com/vAMkX.png)\n\nまた、”run: yarn install”の記述を取り除いてしまうと下記のエラーができます。\n\n```\n\n Failure/Error: <%= javascript_pack_tag 'application'%>\n \n ActionView::Template::Error:\n Webpacker can't find application in /home/circleci/sample_app/public/packs-test/manifest.json. Possible causes:\n 1. You want to set webpacker.yml value of compile to true for your environment\n unless you are using the `webpack -w` or the webpack-dev-server.\n 2. webpack has not yet re-run to reflect updates.\n 3. You have misconfigured Webpacker's config/webpacker.yml file.\n 4. Your webpack configuration is not creating a manifest.\n Your manifest contains:\n {\n }\n \n```\n\n### 該当するソースコード\n\n**config.yml**\n\n```\n\n version: 2.1\n orbs:\n ruby: circleci/[email protected]\n \n jobs:\n build:\n docker:\n - image: circleci/ruby:2.6.5\n working_directory: ~/fridge_app\n steps:\n - checkout:\n path: ~/fridge_app\n - ruby/install-deps\n \n test:\n docker:\n - image: circleci/ruby:2.6.5\n - image: circleci/mysql:5.5\n environment:\n MYSQL_ROOT_PASSWORD: password\n MYSQL_DATABASE: fridge_app_test\n environment:\n BUNDLE_JOBS: \"3\"\n BUNDLE_RETRY: \"3\"\n FRIDGE_APP_DATABASE_HOST: \"127.0.0.1\"\n RAILS_ENV: test\n working_directory: ~/fridge_app\n steps:\n - checkout:\n path: ~/fridge_app\n - ruby/install-deps\n - run:\n name: Database setup\n command: bundle exec rails db:migrate\n - run: yarn install\n - run:\n name: test\n command: bundle exec rspec\n \n workflows:\n version: 2\n build_and_test:\n jobs:\n - build\n - test:\n requires:\n - build\n \n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T04:17:04.767", "favorite_count": 0, "id": "77777", "last_activity_date": "2021-06-25T05:14:39.823", "last_edit_date": "2021-06-25T04:34:38.293", "last_editor_user_id": "44865", "owner_user_id": "44865", "post_type": "question", "score": 0, "tags": [ "docker", "circleci" ], "title": "CircleCI実行時、’command not found' yarnがインストールできません。", "view_count": 518 }
[ { "body": "<https://circleci.com/docs/2.0/docker-image-tags.json>\n\nに、 circleci が用意する docker イメージの一覧がありますが、 ruby 系で `yarn` ないし nodejs\n系のコマンドを利用したい場合には、 `-node` がついているイメージを利用する必要があります。\n\nなので、`circleci/ruby:2.6.5` を `circleci/ruby:2.6.5-node` に変更すると、この問題は解消すると思います。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T05:14:39.823", "id": "77779", "last_activity_date": "2021-06-25T05:14:39.823", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "754", "parent_id": "77777", "post_type": "answer", "score": 1 } ]
77777
77779
77779
{ "accepted_answer_id": "78066", "answer_count": 1, "body": "初歩的なことのように思うのですが、詰まってしまったのでご教示いただきたいです。\n\n以下のような売上Tableがあったときに、月のカラムの「2021-01-01」と「2021-03-01」にそれぞれレコードがある店舗名のみを抽出したい場合、どのようなクエリを書けば良いでしょうか。\n\n**売上Table**\n\n```\n\n 月, 店舗名, 売上\n 2021-01-01, AA, 3000\n 2021-02-01, AA, 4000\n 2021-03-01, AA, 5000\n 2021-04-01, AA, 2000\n 2021-01-01, BB, 1000\n 2021-02-01, BB, 2000\n 2021-04-01, BB, 5000\n \n```\n\n**望ましい出力結果**\n\n```\n\n 店舗名\n AA\n \n```\n\n**試したクエリ** \nあたり前なのですが、下記のようにしてしまうと、どちらかに該当するデータが取れてしまいますので、該当しません。 \nまた、ANDにしてしまうとこちらも当たり前ですが、レコードが0になります。\n\n```\n\n SELECT 店舗名\n FROM 売上Table\n WHERE\n 月 = '2021-01-01'\n or\n 月 = '2021-03-01'\n \n```\n\nこのクエリで出力した店舗名をサブクエリとして活用していきたいのですが、何かうまく出力できる方法ありませんでしょうか。", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T04:40:44.043", "favorite_count": 0, "id": "77778", "last_activity_date": "2021-07-09T04:01:43.820", "last_edit_date": "2021-06-25T05:01:46.127", "last_editor_user_id": "3060", "owner_user_id": "23420", "post_type": "question", "score": 1, "tags": [ "sql" ], "title": "SQL X月とY月それぞれにレコードがあるもののみを抽出したい場合", "view_count": 84 }
[ { "body": "「店舗名」でグループ化して、マッチした「月」の個数で判断するなど。\n\n```\n\n select `店舗名` from `売上Table` where `月` in ('2021-01-01', '2021-03-01') group by `店舗名` having count(distinct `月`) = 2\n \n```\n\n* * *\n\n_この投稿は @user39889 さんのコメント の内容を元に コミュニティwiki として投稿しました。_", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-09T04:01:43.820", "id": "78066", "last_activity_date": "2021-07-09T04:01:43.820", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77778", "post_type": "answer", "score": 1 } ]
77778
78066
78066
{ "accepted_answer_id": null, "answer_count": 0, "body": "お世話になります。\n\nMicrosoftAccess2019を使用して、社内で使用するシステムを作成しているのですが、 \nデータ本体をOneDriveに配置できないかと試行錯誤しているのですが、なかなかうまくいかずに \n困っています。\n\nOneDriveにサインインし、ネットワークドライブを割り当て、そのファイルにアクセスして \nリンクを張ろうとしたのですが、下記のようなエラーが出てしまい、先に進めませんでした。\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/9Nrgt.jpg)](https://i.stack.imgur.com/9Nrgt.jpg)\n\n社内だけであれば、既存の共有ドライブにファイルを置いておけば良いのですが、 \n外から使用するためにクラウドからアクセスできればと思い、試してみました。\n\n解決方法を教えていただきたいのですが、もしかするとVPNを使用してファイルアクセスを \nしたほうのが良いのかとも考えています。\n\nOneDriveからアクセスする方法をお教えいただけますでしょうか。\n\nよろしくお願いいたします。", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T05:27:03.797", "favorite_count": 0, "id": "77780", "last_activity_date": "2021-06-25T05:36:34.720", "last_edit_date": "2021-06-25T05:36:34.720", "last_editor_user_id": "3060", "owner_user_id": "9374", "post_type": "question", "score": 0, "tags": [ "ms-access" ], "title": "MsAccessで、OneDrive上に保存してあるaccdbファイルにリンクして操作する方法", "view_count": 1130 }
[]
77780
null
null
{ "accepted_answer_id": "77783", "answer_count": 1, "body": "昨日まで正常に動いたコードが今朝動かなくなってしまいました。 \nselectで選択するとボタンの値が変更され、間にconsole.logなどを入れるとそれも表示されるのでJavascript自体は正常に動いています。 \nしかしjsファイルの一番最後の行のclickイベントだけが動きません。 \nclickイベントの中にconsole.logを入れても何も表示されないため、clickイベントが動いていないことだけは確かです。 \n昨日動いた時はをformの中に入れていた時は動いたのですが、数時間後にボタンをクリックしたところ$(\"#sm\").html(\"決定\");と同じ動きをしたためformの外に出しましがそれでもダメでした。 \nどうすればよろしいでしょうか? \n皆様の知恵をお借りしたいです。\n\n$(\"#sm\").html(\"決定\"); \n→クリックすると別ページに飛ぶ\n\nクリックイベント \n→クリックするとchange_taglineを呼び出し、ボタンのテキストをtaglines配列の中からランダムに選んで変更する\n\nfortune.ejs\n\n```\n\n <html>\n <head>\n <meta charset=\"utf8\">\n <script src=\"https://code.jquery.com/jquery-3.5.1.min.js\"></script>\n <script type=\"text/javascript\" src=\"siren.js\"></script>\n <link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\">\n <title>SIREN占い</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0\">\n </head>\n <body>\n <div id=\"contents\">\n <h3>SIREN占いのページです。</h3>\n <p>シリーズを選択してください</p>\n <form action=\"/result\" method=\"POST\" id=\"form\">\n <select id=\"select_series\" name=\"selected_series\">\n <option value=\"none\" name=\"series\">--選択してください--</option>\n <option value=\"one\" name=\"series\">SIREN</option>\n <option value=\"two\" name=\"series\">SIREN2</option>\n <option value=\"nt\" name=\"series\">SIREN:NT</option>\n <option value=\"all\" name=\"series\">全シリーズ</option>\n </select>\n <p><input type=\"number\" min=\"1\" max=\"5\" value=\"1\" name=\"times\" id=\"number\">回占う</p>\n <div id=\"sm\"></div>\n \n </form>\n <div id=\"tagline\"></div>\n <a href=\"/top\">TOPに戻る</a>\n </div>\n </body>\n </html>\n \n```\n\nsiren.js\n\n```\n\n $(function(){\n const taglines = [\"どうあがいても、絶望\", \"逃げ場なんて、ないよ\", \"息をすることさえ、恐怖\"];\n //selectが変化した場合、ボタンの文字も変える\n $(\"#select_series\").change(function(){\n let select = $(\"#select_series\").val();\n switch(select){\n case \"one\":\n $(\"#sm\").html(\"<button type='submit' id='select'>決定</button>\");\n $(\"#select\").text(\"全部…消してやる!\");\n $(\"#tagline\").html(\"\");\n \n break;\n \n case \"two\":\n $(\"#sm\").html(\"<button type='submit' id='select'>決定</button>\");\n $(\"#select\").text(\"神風見せてやるよ!\");\n $(\"#tagline\").html(\"\");\n \n break;\n \n case \"nt\":\n $(\"#sm\").html(\"<button type='submit' id='select'>決定</button>\");\n $(\"#select\").text(\"Go To Hell!\");\n $(\"#tagline\").html(\"\");\n break;\n \n case \"all\":\n $(\"#sm\").html(\"<button type='submit' id='select'>決定</button>\");\n change_tagline();\n $(\"#tagline\").html(\"<button id='change'>変更</button>\");\n break;\n \n default:\n $(\"#sm\").html(\"\");\n $(\"#tagline\").html(\"\");\n \n }\n });\n \n //全シリーズ選択時に、ランダムにボタンの文字をキャッチコピーに変換\n function change_tagline(){\n $(\"#select\").text(taglines[Math.floor(Math.random() * taglines.length)]);\n }\n \n $(\"#change\").click(function(){\n change_tagline();\n });\n \n });\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T06:37:43.523", "favorite_count": 0, "id": "77782", "last_activity_date": "2021-06-25T07:01:32.453", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46953", "post_type": "question", "score": 0, "tags": [ "javascript", "html", "jquery", "node.js" ], "title": "jQueryのクリックイベントのみ動かなくなりました", "view_count": 171 }
[ { "body": "[click()](https://api.jquery.com/click/)はそのページに存在しているDOMに対してクリックイベントを検知する仕組みとその処理を付与します。 \n動的に要素が追加されるDOMの場合追加される場合は、追加されるたびにクリックイベントを付与する必要があります。\n\nそれを解決するためには[on()](https://api.jquery.com/on/)と呼ばれるものを利用して親要素に対してクリックイベントを検知してそのうえで該当の要素だった場合に処理を行う仕組みがあります。\n\n```\n\n $(function(){\n const taglines = [\"どうあがいても、絶望\", \"逃げ場なんて、ないよ\", \"息をすることさえ、恐怖\"];\n //selectが変化した場合、ボタンの文字も変える\n $(\"#select_series\").change(function(){\n let select = $(\"#select_series\").val();\n switch(select){\n case \"one\":\n $(\"#sm\").html(\"<button type='submit' id='select'>決定</button>\");\n $(\"#select\").text(\"全部…消してやる!\");\n $(\"#tagline\").html(\"\");\n \n break;\n \n case \"two\":\n $(\"#sm\").html(\"<button type='submit' id='select'>決定</button>\");\n $(\"#select\").text(\"神風見せてやるよ!\");\n $(\"#tagline\").html(\"\");\n \n break;\n \n case \"nt\":\n $(\"#sm\").html(\"<button type='submit' id='select'>決定</button>\");\n $(\"#select\").text(\"Go To Hell!\");\n $(\"#tagline\").html(\"\");\n break;\n \n case \"all\":\n $(\"#sm\").html(\"<button type='submit' id='select'>決定</button>\");\n change_tagline();\n $(\"#tagline\").html(\"<button id='change'>変更</button>\");\n break;\n \n default:\n $(\"#sm\").html(\"\");\n $(\"#tagline\").html(\"\");\n \n }\n });\n \n //全シリーズ選択時に、ランダムにボタンの文字をキャッチコピーに変換\n function change_tagline(){\n $(\"#select\").text(taglines[Math.floor(Math.random() * taglines.length)]);\n }\n \n $(\"#tagline\").on(\"click\", \"#change\", function(){\n change_tagline();\n });\n \n });\n```\n\n```\n\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\n <div id=\"contents\">\n <h3>SIREN占いのページです。</h3>\n <p>シリーズを選択してください</p>\n <form action=\"/result\" method=\"POST\" id=\"form\">\n <select id=\"select_series\" name=\"selected_series\">\n <option value=\"none\" name=\"series\">--選択してください--</option>\n <option value=\"one\" name=\"series\">SIREN</option>\n <option value=\"two\" name=\"series\">SIREN2</option>\n <option value=\"nt\" name=\"series\">SIREN:NT</option>\n <option value=\"all\" name=\"series\">全シリーズ</option>\n </select>\n <p><input type=\"number\" min=\"1\" max=\"5\" value=\"1\" name=\"times\" id=\"number\">回占う</p>\n <div id=\"sm\"></div>\n \n </form>\n <div id=\"tagline\"></div>\n <a href=\"/top\">TOPに戻る</a>\n </div>\n```\n\nちなみに、昨日までは正しく動いていて今日から急に動かなくなったということはなくて、同じソースコードであれば時間経過で変わることはないでしょう。 \nおそらく動的にボタンを追加したかイベントの設定を変えたかで何かしら動かなくなったと推察されます。 \n何をどう変更したのか、理解することで原因を追うことも容易になります。 \n是非質問をする際には、何をどう変えたかも記述するとより良いでしょう。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T07:01:32.453", "id": "77783", "last_activity_date": "2021-06-25T07:01:32.453", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "22665", "parent_id": "77782", "post_type": "answer", "score": 2 } ]
77782
77783
77783
{ "accepted_answer_id": "77787", "answer_count": 2, "body": "mysql等のDBではデータベース毎ではなくテーブル毎にパスワードをかけることはできますか?", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T08:40:42.043", "favorite_count": 0, "id": "77786", "last_activity_date": "2021-07-03T06:42:42.973", "last_edit_date": "2021-07-03T06:42:42.973", "last_editor_user_id": "3060", "owner_user_id": "39481", "post_type": "question", "score": 0, "tags": [ "mysql" ], "title": "データベースの各テーブルに対してパスワードを設定することは可能?", "view_count": 342 }
[ { "body": "データベースやテーブルに対してパスワードを設定するのではなく、あくまで **アカウントに対して** パスワードを付与して権限を管理します。\n\n権限は以下のようなレベルに応じて参照/変更などを設定することができます。\n\n(代表的なもの)\n\n * データベースレベル\n * テーブルレベル\n * カラムレベル\n\n参考: \n[ユーザーに設定できる権限の種類と一覧](https://www.dbonline.jp/mysql/user/index5.html#section1)", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T09:01:18.100", "id": "77787", "last_activity_date": "2021-06-25T09:01:18.100", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77786", "post_type": "answer", "score": 4 }, { "body": "MySQLではテーブルごとに透過的テーブルスペース暗号化することができます。 \n[テーブルごとのファイルテーブルスペースの暗号化](https://dev.mysql.com/doc/refman/8.0/ja/innodb-data-\nencryption.html#innodb-data-encryption-enabling-disabling)\n\n```\n\n mysql> CREATE TABLE t1 (c1 INT) ENCRYPTION = 'Y';\n \n```\n\nこの仕組みで簡単にデータベースファイルを暗号化できるので、ファイル自体を盗まれたり悪用するためにダウンロードされても読めません。 \nただしSQL文を発行して中身を読むことは防げないのでSQLインジェクションなどの対策にはなりません。\n\n参考: [MySQL と MariaDB\nのテーブルスペース暗号化について](https://blog.s-style.co.jp/2017/06/783/)", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T09:17:57.437", "id": "77788", "last_activity_date": "2021-06-25T09:17:57.437", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9820", "parent_id": "77786", "post_type": "answer", "score": 2 } ]
77786
77787
77787
{ "accepted_answer_id": "77801", "answer_count": 1, "body": "### 環境\n\nruby 2.6.5 \nrails 6 \nMySQL \nM1チップ搭載macOS\n\n### 解決したいこと\n\nCircleCI起動時、\"Error: Missing required flag\"のエラーが発生し、Herokuに自動デプロイできません。 \nアプリが紐付いていないエラーだと思います。 \ngithubのリポジトリ名とHerokuのアプリ名が違うのですが、これが原因でしょうか? \n他にどういったことが考えられますか?\n\n教えていただきたいです!\n\n### 発生している問題・エラー\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/o8iSI.png)](https://i.stack.imgur.com/o8iSI.png)\n\n### 該当するソースコード\n\n**config.yml**\n\n```\n\n version: 2.1\n orbs:\n ruby: circleci/[email protected]\n heroku: circleci/[email protected]\n \n jobs:\n build:\n docker:\n - image: circleci/ruby:2.6.5-node\n working_directory: ~/fridge_app\n steps:\n - checkout:\n path: ~/fridge_app\n - ruby/install-deps\n - run:\n name: yarn Install\n command: yarn install\n \n test:\n docker:\n - image: circleci/ruby:2.6.5-node\n - image: circleci/mysql:5.5\n environment:\n MYSQL_ROOT_PASSWORD: password\n MYSQL_DATABASE: fridge_app_test\n environment:\n BUNDLE_JOBS: \"3\"\n BUNDLE_RETRY: \"3\"\n FRIDGE_APP_DATABASE_HOST: \"127.0.0.1\"\n RAILS_ENV: test\n working_directory: ~/fridge_app\n steps:\n - checkout:\n path: ~/fridge_app\n - ruby/install-deps\n - run:\n name: yarn Install\n command: yarn install\n - run:\n name: Database setup\n command: bundle exec rails db:migrate\n - run:\n name: test\n command: bundle exec rspec\n deploy:\n docker:\n - image: circleci/ruby:2.6.5-node\n steps:\n - checkout\n - setup_remote_docker:\n version: 19.03.13\n - heroku/install\n - run:\n name: heroku login\n command: heroku container:login\n - run:\n name: push docker image\n command: heroku container:push web -a $HEROKU_APP_NAME\n - run:\n name: release docker image\n command: heroku container:release web -a $HEROKU_APP_NAME\n - run:\n name: datebase setup\n command: heroku run bundle exec rails db:migrate\n \n workflows:\n version: 2\n build_test_and_deploy:\n jobs:\n - build\n - test:\n requires:\n - build\n - deploy:\n requires:\n - test\n filters:\n branches:\n only: master\n \n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-25T10:57:22.197", "favorite_count": 0, "id": "77790", "last_activity_date": "2021-06-26T08:22:22.907", "last_edit_date": "2021-06-25T11:14:43.860", "last_editor_user_id": "44865", "owner_user_id": "44865", "post_type": "question", "score": 0, "tags": [ "docker", "heroku", "circleci" ], "title": "CircleCIでデプロイ自動化のとき”Error: Missing required flag”のエラーが発生します", "view_count": 211 }
[ { "body": "`heroku run` を、どの heroku app に対して実行するのか、が指定されていないがために発生しています。他の `heroku`\nコマンドと同じように、`-a $HEROKU_APP_NAME` を付与すれば解消すると思いますので、\n\n```\n\n heroku run -a $HEROKU_APP_NAME bundle exec rails db:migrate\n \n```\n\nでいけると思います。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T08:22:22.907", "id": "77801", "last_activity_date": "2021-06-26T08:22:22.907", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "754", "parent_id": "77790", "post_type": "answer", "score": 1 } ]
77790
77801
77801
{ "accepted_answer_id": null, "answer_count": 1, "body": "vscodeを使っていて、\n\ngo to definition\n\ngo to declaration\n\nが変わらないようにみえますが、\n\nインタプリタ言語であるPythonではあまり重要ではない違い、もしくは、区別されませんか?", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T01:23:36.537", "favorite_count": 0, "id": "77794", "last_activity_date": "2021-07-31T03:10:46.090", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "40961", "post_type": "question", "score": 0, "tags": [ "python" ], "title": "Pythonにおいて「宣言」と「定義」は区別されますか?", "view_count": 176 }
[ { "body": "他の言語では、\"宣言\" の定義は、変数のデータ型と共に変数の存在を示すために使用されます。Pythonでは、変数をそれぞれの値で初期化するだけです。\n\n**Python**\n\n```\n\n #初期化\n number = 10\n data = [\"hello\", 1, \"naokiri\", 16, (1,2)]\n \n```\n\n**Java**\n\n```\n\n //宣言\n int number;\n number = 10; //使う\n //宣言と使用\n string letter = \"naokiri\";\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-31T03:10:46.090", "id": "80496", "last_activity_date": "2021-07-31T03:10:46.090", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47532", "parent_id": "77794", "post_type": "answer", "score": 1 } ]
77794
null
80496
{ "accepted_answer_id": "77798", "answer_count": 1, "body": "文字列から、値部分のみを抽出したいのですが、実現するための正規表現が上手く書けず困っています。\n\n※とあるデータのなかに、本来は【数値】のカラムがあるのですが、場合によっては「#」や「)」といった文字列が一緒に含まれているレコードがあるため、csv読み込み時に文字列と読み込まれてしまうので、数値部分のみを抽出したいと考えています。\n\n例えば、\"#5.3\" や \"5.3)\" という文字列から、5.3 のみを抽出したいイメージです。\n\n以下が試しているコードですが、こちらだと数字のみが抽出されてしまうため、「.(ドット)」を含めて抽出したいです。\n\n```\n\n import re\n s = \"5.3)\"\n result = res = re.sub(r\"\\D\", \"\", s)\n print(result)\n # 53\n \n```\n\nアドバイスいただけますと幸いです。", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T04:50:18.187", "favorite_count": 0, "id": "77797", "last_activity_date": "2021-06-26T05:09:34.437", "last_edit_date": "2021-06-26T05:09:34.437", "last_editor_user_id": "3060", "owner_user_id": "47038", "post_type": "question", "score": 1, "tags": [ "python", "正規表現" ], "title": "Python の正規表現で . (ドット) を含む数値のみを抽出したい", "view_count": 5158 }
[ { "body": "不要な文字の対象に `.` は含まれないと仮定して、例えば以下のような書き方ができると思います。\n\n```\n\n result = res = re.sub(r\"[^\\d.]\", \"\", s)\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T05:08:35.190", "id": "77798", "last_activity_date": "2021-06-26T05:08:35.190", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77797", "post_type": "answer", "score": 1 } ]
77797
77798
77798
{ "accepted_answer_id": "77809", "answer_count": 2, "body": "静的プロパティの学習をしていました。 \n遊び心なのですが、サイトを見て円周率 $pi に30桁ほど代入してみました。\n\nすると返って来た結果は小数点以下13桁で止まっています。 \nコンピュータは無限ではなくどこかで丸められるのはわかっています。 \nブロックアウト(`//`)してある部分が自分の予想でした。\n\n計算結果ならいざ知らず、代入した値もどこかで丸められるのですか?\n\n少し気になります。 \nご存じの方いらっしゃいましたら教えて下さい。 \nよろしくお願いいたします。\n\n(Area1.php)\n\n```\n\n <?php\n class Area {\n public static $pi = 3.141592653589793238462643383279;\n \n public static function circle (float $radius):float{\n return pow($radius, 2) * self::$pi;\n }\n }\n ?>\n \n```\n\n(Static1.php)\n\n```\n\n <?php\n require_once('Area1.php');\n \n print '円周率:'.Area::$pi.'<br>';\n //円周率:3.141592653589793238462643383279;\n print '円の面積:'.Area::circle(10).'cm^2';\n // 円の面積:314.159…cm^2\n ?>\n \n```\n\n<表示結果>\n\n```\n\n 円周率:3.1415926535898\n 円の面積:314.15926535898cm^2\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T07:33:53.387", "favorite_count": 0, "id": "77799", "last_activity_date": "2021-06-26T17:54:14.850", "last_edit_date": "2021-06-26T07:39:50.130", "last_editor_user_id": "3060", "owner_user_id": "42150", "post_type": "question", "score": 2, "tags": [ "php" ], "title": "PHP で小数点以下の桁数はどこで丸められるのですか?", "view_count": 433 }
[ { "body": "PHPでは、小数は「浮動小数点」で表されます。 \nコード内でも`float`型を使われているので、それはご存じだと思います。 \nPHPにおける浮動小数点数の扱いの詳細はマニュアルの以下のページに記載されています。 \n<https://www.php.net/manual/ja/language.types.float.php> \n浮動小数点数の仕様そのものについてはWikipediaをはじめ詳解しているドキュメントがあるのでそちらも合わせてお読みください。 \n<https://ja.wikipedia.org/wiki/%E6%B5%AE%E5%8B%95%E5%B0%8F%E6%95%B0%E7%82%B9%E6%95%B0> \n<https://ja.wikipedia.org/wiki/IEEE_754> \n本件ではこのような情報は質問の本質ではないと思われるので詳細解説は割愛します。\n\n質問は「小数を含む数値がどのタイミングで丸められるか」と言うのが本題と読み取ります。 \n丸められるタイミングは、「式として評価(evaluate)」された時です。\n\n例えば、\n\n```\n\n $pi = 3.141592653589793238462643383279;\n \n```\n\nという式が与えられたとします。本文のコードそのままですね。 \n変数に値を代入する際、まず `=` の右辺の式を評価します。 \nつまり、`3.141592653589793238462643383279` という数値リテラルがまず評価されます。 \nこの数値リテラルは小数を表すのでfloat型に自動的に変換されます。 \nその結果、`3.1415926535898` になります(floatの内部表現を10進数に変換して表示したものなので、内部の数値を正確には表していません)\n\n右辺式の評価が終了したので、評価結果の値を左辺の変数へ代入します。 \nこの時、`$pi`と先ほどの左辺の評価結果は同じ値になります。\n\n### 結論\n\n> 計算結果ならいざ知らず、代入した値もどこかで丸められるのですか?\n\nという質問に対しては、 \n「代入する前に既に丸められている」 \nが回答となります。それは数値リテラルを評価する際にfloat型に収まるよう丸められるからです。そして、式は評価されるたびに結果型に適合するように丸められます。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T08:55:45.283", "id": "77802", "last_activity_date": "2021-06-26T08:55:45.283", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46944", "parent_id": "77799", "post_type": "answer", "score": 5 }, { "body": "Lexical analysis(字句解析)の時点で丸め処理が行われます。具体的には以下の部分です。\n\n[php-src/Zend/zend_language_scanner.l](https://github.com/php/php-\nsrc/blob/master/Zend/zend_language_scanner.l#L2131)\n\n```\n\n <ST_IN_SCRIPTING>{DNUM}|{EXPONENT_DNUM} {\n :\n \n ZVAL_DOUBLE(zendlval, zend_strtod(dnum, &end));\n :\n \n RETURN_TOKEN_WITH_VAL(T_DNUMBER);\n }\n \n```\n\n[zend_strtod()](https://github.com/php/php-\nsrc/blob/master/Zend/zend_strtod.c#L2524)は1000行を超える長大な関数ですが、浮動小数点数(文字列)を抽出する処理は以下になります(この後に\nIEEE 754 format に変換する処理が続きます)。\n\n[zend_strtod](https://github.com/php/php-\nsrc/blob/master/Zend/zend_strtod.c#L2609)\n\n```\n\n for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)\n if (nd < 9)\n y = 10*y + c - '0';\n else if (nd < DBL_DIG + 2)\n z = 10*z + c - '0';\n :\n \n if (c == '.') {\n :\n \n if (!nd) {\n for(; c == '0'; c = *++s)\n nz++;\n if (c > '0' && c <= '9') {\n :\n \n goto have_dig;\n }\n goto dig_done;\n }\n for(; c >= '0' && c <= '9'; c = *++s) {\n have_dig:\n nz++;\n if (c -= '0') {\n nf += nz;\n for(i = 1; i < nz; i++)\n if (nd++ < 9)\n y *= 10;\n else if (nd <= DBL_DIG + 2)\n z *= 10;\n if (nd++ < 9)\n y = 10*y + c;\n else if (nd <= DBL_DIG + 2)\n z = 10*z + c;\n nz = nz1 = 0;\n }\n }\n }\n dig_done:\n \n```\n\nこの処理部分にある `DBL_DIG` ですが、PHP の定義済み定数である `PHP_FLOAT_DIG` に割り当てられています。\n\n[php-src/main/main.c](https://github.com/php/php-\nsrc/blob/master/main/main.c#L2140)\n\n```\n\n REGISTER_MAIN_LONG_CONSTANT(\"PHP_FLOAT_DIG\", DBL_DIG, CONST_PERSISTENT | CONST_CS);\n \n```\n\n[PHP: Predefined\nConstants](https://www.php.net/manual/en/reserved.constants.php)\n\n> **PHP_FLOAT_DIG** (int)\n>\n> Number of decimal digits that can be rounded into a float and back without\n> precision loss. Available as of PHP 7.2.0.\n```\n\n $ php -r 'echo PHP_FLOAT_DIG . PHP_EOL;'\n 15\n \n```\n\n`15` という値は IEEE 754 format(倍精度)の仮数部が 52 bits 長である事に依るものです(`log10(2^(52+1)) ≒\n15.9546`)。\n\n```\n\n echo \"円周率: 3.141592653589793238462643383279\\n\";\n printf(\"円周率: %.14f\\n\", Area::$pi);\n printf(\"円周率: %.15f\\n\", Area::$pi);\n printf(\"円周率: %.16f\\n\", Area::$pi);\n \n // 出力結果\n 円周率: 3.141592653589793238462643383279\n 円周率: 3.14159265358979\n 円周率: 3.141592653589793\n 円周率: 3.1415926535897931\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T17:54:14.850", "id": "77809", "last_activity_date": "2021-06-26T17:54:14.850", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "parent_id": "77799", "post_type": "answer", "score": 3 } ]
77799
77809
77802
{ "accepted_answer_id": null, "answer_count": 1, "body": "CentOSでMediawikiを運用中。\n\nブラウザでMediawiki(`http://wiki.example.com`)にアクセス、 \nメールアドレスを登録すると、一般ユーザーがwikiに書き込みができるようなシステムです。\n\n* * *\n\nシステム: `[email protected]`\n\nユーザー1: `[email protected]` \nユーザー2: `[email protected]` \n(@よりも前の部分はダミー、ドメイン名は実際のもの)\n\n* * *\n\nアカウント作成時、パスワードリセット時などに、Mediawikiのシステム(`[email protected]`)からユーザーにメールが自動送信されます。\n\nアカウント作成時は、`メールアドレスの確認`という件名のメールが送信されます。 \n`ユーザー1`と`ユーザー2`、2つのユーザーを作成し、どちらも`メールアドレスの確認`を受信できています。\n\nパスワードリセット時は、`アカウントの詳細`という件名のメールが送信されます。 \n`ユーザー1`と`ユーザー2`、2つのユーザーで試しましたが、どちらも`アカウントの詳細`を受信できませんでした。\n\n<https://outlook.live.com/> \n上記サイトへ`[email protected]`でログインし、送信済みボックスを確認しました。 \n`アカウントの詳細`のメールが送信済みになっています。 \n`ユーザー1`宛てと`ユーザー2`宛ての2通あります。\n\n送信済みなのに、相手にメールが届かないのはなぜ?\n\n* * *\n\nメールがまったく届かないのならばMediawikiのSMTP設定が間違っている可能性が高い。 \nしかし、`メールアドレスの確認`の方のメールは、ユーザー側で受信できているので、SMTPの設定ミスではないと思われる。\n\n迷惑メールに振り分けられているのかと思ったが、迷惑メールフォルダには該当メールはなし。\n\n`ユーザー1`は`ヤフーメール`、`ユーザー2`は`捨てメアド`というメールサービスを利用している。\n\n`メールアドレスの確認`は、迷惑メールに分類されないが、 \n`アカウントの詳細`の方だけ迷惑メールに分類されるという挙動はあり得るかもしれないが、 \n`ヤフーメール`と`捨てメアド`でまったく同じ挙動というのは不自然か?\n\n違うメールサービスでも同じフィルタリングエンジンを使っていたらあり得るかも?\n\nそもそも届いていないのか、 \n受信側のサーバーまでは届いているがユーザーに届く前に捨てられているのか \nを切り分けたいが、どうすればいいのか分からず。\n\nまたは、SMTP(outlook.live.com)側で何らかのフィルタがかかっていて、 \n送信したと見せかけて実際には送信していないというようなことがありえるのか?\n\n* * *\n\nまとめ\n\n送信済みになっているのに、相手にメールが届かない場合、\n\n・本当の本当に送信されているのか確認するには? \n(送信済みボックスにメールが残っていたら、確実に送信されていると判断していいのか?)\n\n・仮に迷惑メールに分類されているとしたら、迷惑メールに分類されたことを検知するには? \n(`ヤフーメール`や`捨てメアド`のサービスでは、迷惑メールフォルダにすら表示されず、暗黙的にメールを消去していたりするかも?) \nフリーのメールサービスで、自動で迷惑メールに分類せず、ノーガードでメールを受信できるようなものがあったら紹介してください。 \nそもそも届いていないのか、届いたけどフィルタリングされてユーザーからは見えないのかを切り分けたいです。\n\n・「アカウント作成時のメール」は届くけど、「パスワードリセット時のメール」は届かない今回の現象について、その他アドバイスがあればお願い致します。", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T12:39:22.967", "favorite_count": 0, "id": "77804", "last_activity_date": "2022-05-06T13:00:45.060", "last_edit_date": "2021-06-26T17:10:44.447", "last_editor_user_id": "3060", "owner_user_id": "45540", "post_type": "question", "score": 0, "tags": [ "linux", "centos", "mail" ], "title": "SMTP、特定のメールだけ「送信済みになるのに相手に届かない」のはなぜ?", "view_count": 847 }
[ { "body": "相手に届かなかったメール、 \n件名、本文が同じものを同じ宛先に`https://outlook.live.com/`のWebメール上から送ってみました。\n\nすると、`[email protected]`から下記のようなメールが返ってきました。\n\n`Remote Server returned '550 5.7.520 Message blocked because it contains\ncontent identified as spam. AS(4810)'`\n\nというわけでスパム判定されていたので届かないということが判明。\n\nMediawikiのシステムから自動送信した時は、 \n・送信済みにはなる \n・相手には届かない \n・[email protected]からメールがこない\n\nWebメールから手動で送信した時は、 \n・送信済みにはなる \n・相手には届かない \n・[email protected]からメールがくる\n\nMediawikiからSMTPで送信した時に、[email protected]からのメールが届かない原因は謎。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-27T11:32:22.200", "id": "77816", "last_activity_date": "2021-06-27T11:32:22.200", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "45540", "parent_id": "77804", "post_type": "answer", "score": 1 } ]
77804
null
77816
{ "accepted_answer_id": "77819", "answer_count": 1, "body": "お世話になっております。 \n以下の事象について質問します。\n\n任意のフォルダに「PAUSE」一行のみのBATファイルを作成し、 \nそれをEmEditorで開き、メニューの「関連付けられたプログラム」で実行すると、 \nカレントディレクトリがEmEditorのインストールされたディレクトリで \nコマンドプロンプトが起動してしまいます。 \n※この事象は.jsファイルや.vbsファイルでも同様のようです。\n\n上記は正常な挙動でしょうか。 \n私としては、BATファイルが保存されてあるフォルダを \nカレントディレクトリとして起動して欲しいのですが、 \n設定変更などで対応可能でしょうか。", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T12:58:38.023", "favorite_count": 0, "id": "77805", "last_activity_date": "2021-06-27T13:08:11.063", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47049", "post_type": "question", "score": 0, "tags": [ "emeditor" ], "title": "カレントディレクトリの扱いについて", "view_count": 139 }
[ { "body": "[ツール] メニュー -> [外部ツール] -> [外部ツールの設定] で <外部ツールダイアログ> を開いて \n[関連付けられたプログラム] -> [プロパティ] で <外部ツールのプロパティ> を開いて \n[初期ディレクトリ] に `$(Dir)` を設定てみてください。 \n(他にもツールバーのアイコンを右クリックでも <外部ツールのプロパティ> を呼び出せます)\n\n余談ですが \nBATファイルで自身のあるドライブとディレクトリは容易に取得できるので `\"%~d0%~p0\"` \n個人的には BATファイルの1行目に \n`@Echo off & chcp 65001>nul & cd /d \"%~d0%~p0\"` \nとしてコードページの設定等と一緒にカレントディレクトリの設定をしてます。 \nこれで他のアプリケーションから呼び出しても問題なくなります。\n\n※コメントに思いつき書きましたが、検証して回答とし書き直しました。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-27T13:08:11.063", "id": "77819", "last_activity_date": "2021-06-27T13:08:11.063", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "40304", "parent_id": "77805", "post_type": "answer", "score": 3 } ]
77805
77819
77819
{ "accepted_answer_id": null, "answer_count": 0, "body": "Xcodeのplaygroundでファイルのpathを取得しようとBundle.main.url()を使用しているのですがnilが返ってきてしまいます。ファイルはResourcesフォルダの中に置いています。 \nどうすればよいでしょうか?\n\n```\n\n import UIKit\n import Vision\n // 学習済みモデルを読み込む\n // ビルド時にmlmodelをコンパイルしたmlmodelcが作られるのでそれをロードする\n //TOLOv3Tiny.mlmodelのURLを取得//ここでnilが返ってくる\n let modelURL: URL? = Bundle.main.url(forResource: \"YOLOv3Tiny\", withExtension: \"mlmodel\")\n \n guard let model = try?VNCoreMLModel(for: MLModel(contentsOf: modelURL!))else{\n fatalError()\n }\n \n```\n\n[![ファイル](https://i.stack.imgur.com/XRxUD.png)](https://i.stack.imgur.com/XRxUD.png)", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T13:04:19.883", "favorite_count": 0, "id": "77806", "last_activity_date": "2021-06-26T13:28:06.227", "last_edit_date": "2021-06-26T13:28:06.227", "last_editor_user_id": "3060", "owner_user_id": "47051", "post_type": "question", "score": 0, "tags": [ "swift", "xcode", "swift5" ], "title": "Bundle.main.urlでpathが取得できずnilが返ってくる", "view_count": 631 }
[]
77806
null
null
{ "accepted_answer_id": "77808", "answer_count": 1, "body": "チェックボックスにチェックを入れると文字を隠すというコードを作成しています。 \n選択肢数は変動するため、Javascriptのfor文でonclickの関数を登録しています。\n\n下記のようなコードを作成したのですが、どのチェックボックスをクリックしても、IDがtxt3を指しています。(connecttext()のclonsole.logで確認) \niの変更がすべてのonclickに適用されているみたいです。 \n修正方法や回避策を教えていただきたいです。\n\n```\n\n <div id=\"txt0\">りんご</div>\n <input type=\"checkbox\" id=\"0\" value=\"on\"><br>\n <div id=\"txt1\">みかん</div>\n <input type=\"checkbox\" id=\"1\" value=\"on\"><br>\n <div id=\"txt2\">その他</div>\n <input type=\"checkbox\" id=\"2\" value=\"on\"><br>\n \n <script>\n // onclickの関数を登録\n function mod_form(){\n for (var i=0; i<3; i++){\n document.getElementById(i).onclick = function(){connecttext(\"txt\"+i, this.checked)};\n }\n };\n // ページ読み込み時に実行\n mod_form();\n \n function connecttext( textid, ischecked ) {\n console.log(textid);\n if( ischecked == true ) {\n // チェックが入っていたら有効化\n document.getElementById(textid).disabled = false;\n }\n else {\n // チェックが入っていなかったら無効化\n document.getElementById(textid).disabled = true;\n }\n }\n </script>\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T14:57:11.833", "favorite_count": 0, "id": "77807", "last_activity_date": "2021-06-26T15:09:17.733", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "37419", "post_type": "question", "score": 0, "tags": [ "javascript", "html" ], "title": "HTML内onclickの関数をscriptで変更したいが、引数が書き換わる", "view_count": 854 }
[ { "body": "`onclick`に関数を登録するときに`connecttext`への引数を解決しておけば良いでしょう。\n\n```\n\n for (var i=0; i<3; i++){\n const textid = \"txt\"+i;\n document.getElementById(i).onclick = function(){\n connecttext(textid, this.checked);\n };\n }\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-26T15:09:17.733", "id": "77808", "last_activity_date": "2021-06-26T15:09:17.733", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "45045", "parent_id": "77807", "post_type": "answer", "score": 0 } ]
77807
77808
77808
{ "accepted_answer_id": null, "answer_count": 1, "body": "Vueの監視プロパティを用いて表示を更新しようと思っているのですが、inputでテキストを変更した際、下記の{{ newMessage }}、{{\noldMessage }}部分が更新されません。({{ message }}部分は更新されます。) \n初歩的な質問で恐縮ですがどのようにすれば動作するかお分かりになりましたら教えていただきたいです。\n\nHTML\n\n```\n\n <p>\n {{ message }}   // inputに入れた値で更新される\n {{ newMessage }} // nullのまま更新されない\n {{ oldMessage }} // nullのまま更新されない\n </p>\n <input type=\"text\" v-model=\"message\" />\n <pre>\n {{ $data }} // newMessage、oldMessageの値が更新されない\n </pre>\n \n```\n\nJavaScript\n\n```\n\n var app = new Vue({\n el: '#app',\n data: {\n message: 'Hello Vue.js!',\n newMessage: '',\n oldMessage: ''\n },\n watch: {\n message: (newValue, oldValue) => {\n this.newMessage = newValue\n this.oldMessage = oldValue\n console.log(this.newMessage, newValue) // 共に新しい値がコンソールで表示されている\n }\n }\n }) \n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-27T04:41:35.880", "favorite_count": 0, "id": "77811", "last_activity_date": "2021-06-27T07:10:55.273", "last_edit_date": "2021-06-27T04:47:28.327", "last_editor_user_id": "3060", "owner_user_id": "47056", "post_type": "question", "score": 0, "tags": [ "javascript", "vue.js" ], "title": "Vueのマスタッシュ部分が更新されない", "view_count": 140 }
[ { "body": "`watch` の中を\n\n```\n\n message: function (newValue, oldValue) {\n ...\n }\n \n```\n\nとしてください。\n\n`function`による関数と異なり、アロー関数の`this`は生成時に決まります。そのため、`this`は、期待しているVueインスタンスになりません。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-27T07:10:55.273", "id": "77812", "last_activity_date": "2021-06-27T07:10:55.273", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9464", "parent_id": "77811", "post_type": "answer", "score": 1 } ]
77811
null
77812
{ "accepted_answer_id": null, "answer_count": 1, "body": "以下のプログラムは六角形を書くプログラムですが、それに書き加えることで \n一辺一辺の色を変えて、六色の辺からなる六角形を書くプログラムを作成したいのですが、 \nどうすればいいのかがよくわかりませんでした。\n\nとりあえず、プログラムをいかに示します。\n\n```\n\n public class SolidOrDot {\n \n public static void main(String args[]) {\n Turtle t;\n \n if (args.length > 0 && args[0].equals(\"dot\")) {\n DotTurtle dt = new DotTurtle();\n dt.setLength(5);\n t = dt;\n }\n else {\n t = new Turtle(); \n }\n \n t.move(100,200);\n t.penDown();\n t.go(100);\n t.rotate(60);\n t.go(100);\n t.rotate(60);\n t.go(100);\n t.rotate(60);\n t.go(100);\n t.rotate(60);\n t.go(100);\n t.rotate(60);\n t.go(100);\n }\n }\n \n```\n\nちなみに、色を付けるメソッドは、\n\n```\n\n public void setColor(java.awt.Color c){\n this.t.setColor(c);\n }\n \n```\n\nで与えられています。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-27T08:01:18.533", "favorite_count": 0, "id": "77813", "last_activity_date": "2021-07-02T01:38:28.613", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46879", "post_type": "question", "score": -1, "tags": [ "java" ], "title": "rotateするごとに辺の色を変えていきたい", "view_count": 197 }
[ { "body": "現状でどのような問題が発生しているのか(「メソッドをどこにどう書けばいいのか分からない」「`setColor`を記述しても実行すると黒い六角形が表示される」「コンパイルエラーが発生する」など)が分からないので回答に推測を含みます。\n\n```\n\n t.go(100); // 100ドット前へ進む = 線分を描く\n t.rotate(60); // 60度回転する\n \n```\n\n「メソッドをどこにどう書けばいいのか分からない」ならば、上記メソッドの前か後に`setColor`メソッドを引数([java.awt.Color](https://docs.oracle.com/javase/jp/11/docs/api/java.desktop/java/awt/Color.html))付きで6箇所に異なる色を渡すよう記述すればいいです。 \nメソッドの定義や構文については教材やご自身の質問への[回答](https://ja.stackoverflow.com/a/77653)などを確認してください。 \n`setColor`メソッドの具体的な使い方は[Rotateするごとに長方形の辺の色を変える](https://ja.stackoverflow.com/q/77815)質問が参考になるかもしれません。\n\n「`t.setColor(java.awt.Color.RED);`のようにコードを書き足しても色が変わらない」場合や、「下記のようなエラーでコンパイルできない」場合は質問文を更新してください。\n\n```\n\n C:\\test\\java\\SolidOrDot.java:6: エラー: シンボルを見つけられません\n this.t.setColor(c);\n ^\n シンボル: 変数 t\n エラー1個\n エラー: コンパイルが失敗しました\n \n```\n\n老婆心ながらJavaのコードは各行に意味があって何かを実行しているので、コードを消したり増やしたりしながら何が起こるのかを確認すると教材の理解につながります。 \nきちんとバックアップを取っておけばコード変更は怖くないです。がんばってください。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T01:38:28.613", "id": "77914", "last_activity_date": "2021-07-02T01:38:28.613", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9820", "parent_id": "77813", "post_type": "answer", "score": 0 } ]
77813
null
77914
{ "accepted_answer_id": null, "answer_count": 1, "body": "題名にも書きましたが、Rotateするごとに長方形の辺の色を \n赤→オレンジ→黄→緑→青→紫 \nと変えていきたいのですが、以下のプログラムでは、長方形左下からスタートし、 \n赤→オレンジ→黄→緑→青→紫 \nと色が変化していくのですが、紫が終了した時点で(亀が長方形右上に到達した時点で)また最初に戻って(長方形左下につまりスタート地点に戻る)しまいます。\n\nどんなプログラムにしたいかといいますと、紫が書き終わった時点でも、続けざまに、つまり、 \n赤→オレンジ→黄→緑→青→紫→赤→オレンジ→黄→緑→青→紫→赤→オレンジ→黄→緑… \nとしていきたいのです。\n\n現時点でのプログラム\n\n```\n\n public class RainbowTurtle {\n public void draw() {\n Turtle t1 = new Turtle();\n t1.move(100, 200);\n t1.penDown();\n t1.setColor(java.awt.Color.RED);\n t1.go(100);\n \n Turtle t2 = t1;\n t2.rotate(90);\n t2.setColor(java.awt.Color.ORANGE);\n t2.go(100);\n \n Turtle t3 = t2;\n t3.rotate(90);\n t3.setColor(java.awt.Color.YELLOW);\n t3.go(100);\n \n Turtle t4 = t3;\n t4.rotate(90);\n t4.setColor(java.awt.Color.GREEN);\n t4.go(100);\n \n Turtle t5 = t4;\n t5.rotate(90);\n t5.setColor(java.awt.Color.BLUE);\n t5.go(100);\n \n Turtle t6 = t5;\n t6.rotate(90);\n t6.setColor(java.awt.Color.MAGENTA);\n t6.go(100);\n }\n \n public static void main(String[] args) {\n RainbowTurtle rect = new RainbowTurtle();\n \n while(true){\n rect.draw();\n }\n }\n }\n \n```\n\nこのプログラムをどうやって書き換えれば、期待している結果となるのでしょうか。 \nご指摘よろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-27T11:27:32.807", "favorite_count": 0, "id": "77815", "last_activity_date": "2021-06-27T16:15:49.740", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "45103", "post_type": "question", "score": 0, "tags": [ "java" ], "title": "Rotateするごとに長方形の辺の色を変える", "view_count": 169 }
[ { "body": "whileの無限ループ中に`draw`をコールするのではなく、`draw`の中で無限ループさせれば目的の動作は達成できるはずです。 \n亀が\n\n * 色変更する\n * 直進する\n * 90度回転する\n\nという動作が繰り返し行われるよう意識してコーディングしていきましょう。\n\n```\n\n public void draw() {\n Turtle t1 = new Turtle();\n t1.move(100, 200);\n t1.penDown();\n //初期位置設定とpenDownまではループの外\n while(true){\n t1.setColor(java.awt.Color.RED);\n t1.go(100);\n t1.rotate(90);\n (以下略)\n }\n }\n \n```\n\nmainメソッド側の`while`は必要ありません。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-27T16:15:49.740", "id": "77822", "last_activity_date": "2021-06-27T16:15:49.740", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46944", "parent_id": "77815", "post_type": "answer", "score": 0 } ]
77815
null
77822
{ "accepted_answer_id": "77826", "answer_count": 1, "body": "**現象** \nWSL2のUbuntuのbashで`npm install vue`を実行したときに、`-bash: /mnt/c/Program\nFiles/nodejs/npm: /bin/sh^M: bad interpreter: No such file or directory`が出現する\n\nそこで、`cat -e /bin/sh`コマンドを使って、改行コードを確認しようとすると、出力された物が全て文字化けしてしまっている\n\n**期待値** \n`cat -e /bin/sh`コマンドを使って、改行コードを確認したい\n\n**再現手順**\n\n 1. node.jsをインストールする\n 2. npmをインストールする\n 3. `npm install vue`を実行する\n 4. すると、`-bash: /mnt/c/Program Files/nodejs/npm: /bin/sh^M: bad interpreter: No such file or directory`が出現する\n 5. 改行コードを調べるために、`cat -e /bin/sh`を実行する\n\n**参考リンク** \n[/bin/bash^M: bad interpreter: そのようなファイルやディレクトリはありません (No such file or\ndirectory)](https://totech.hateblo.jp/entry/2014/03/19/174129)", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-27T16:17:33.033", "favorite_count": 0, "id": "77823", "last_activity_date": "2021-06-28T05:38:58.557", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "36906", "post_type": "question", "score": 0, "tags": [ "bash", "vue.js", "npm", "wsl" ], "title": "-bash: /mnt/c/Program Files/nodejs/npm: /bin/sh^M: bad interpreter: No such file or directoryが出現したときに、改行コードを確認する方法を知りたいです", "view_count": 637 }
[ { "body": "なんか限りなく XY 問題な気がしますが\n\n> `cat -e /bin/sh` コマンドを使って、改行コードを確認したい\n\nあなたが確認したいのは `/mnt/c/Program Files/nodejs/npm` の改行コードであって `/bin/sh`\nの改行コードではないはず。\n\n> 文字化け\n\nそりゃバイナリファイルである `/bin/sh` をコンソールに表示すれば化けているに決まっています。\n\n`/bin/sh^M: bad interpreter` のメッセージはシェルスクリプトファイルの1行目 `shebang` (シバンともシェバンとも)\nの改行コードが `CR LF` かつ、そのシバンを解釈する何か (\n[execve](https://linuxjm.osdn.jp/html/LDP_man-pages/man2/execve.2.html)\nカーネル関数と `/bin/sh` の合わせ技なんだけど) が LF 改行のみ対応の場合に `#!/bin/sh<CR><LF>` のシバン行を\n`/bin/sh<CR>`\nなファイルを起動すると解釈し、そんなファイルはないのでエラーになるという現象です。なのであなたのところで発生したそのエラーメッセージの原因は\n`/mnt/c/Program Files/nodejs/npm` のシバン行の改行コードが `CR LF` であることです。 `/bin/sh`\n側ではありません。\n\nなので使うツールも確認する対象ファイルも違うっス。こういう場合は普通 `file` なり `od` なりで確認すればいいです。ウチの WSL2 Ubuntu\n20.04 TLS の場合\n\n```\n\n $ file /bin/sh /bin/dash abc.sh\n /bin/sh: symbolic link to dash\n /bin/dash: ELF 64-bit LSB shared object, x86-64, <以下略>\n abc.sh: POSIX shell script, ASCII text executable, with CRLF terminators\n $ od -tx1 abc.sh\n 0000000 23 21 2f 62 69 6e 2f 73 68 0d 0a 65 63 68 6f 20\n 0000020 61 62 63 0d 0a\n 0000025\n $ ./abc.sh\n abc\n $ \n \n```\n\nってことで追及すべきはなぜ `npm` コマンドの内部改行コードが `CR LF` なのか、だけどその辺は別途コメントにある通りなのだろうと思われます。\n\n* * *\n\nまあシバン評価するルーチン( [linux](/questions/tagged/linux \"'linux' のタグが付いた質問を表示\") kernel\nですね)側が改行コード `CR LF` に対応してくれていればいいだけですし、オイラんところの Ubuntu 20.04 TLS ストア更新日\n2021/06/12 では前述のとおりシバン行の改行が `CR LF` である `abc.sh`\nも期待通り動いているわけで、質問者さんもストアアプリの更新で WSL2 Ubuntu を更新すればそのまま動くかもしれないです。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T00:40:07.247", "id": "77826", "last_activity_date": "2021-06-28T05:38:58.557", "last_edit_date": "2021-06-28T05:38:58.557", "last_editor_user_id": "8589", "owner_user_id": "8589", "parent_id": "77823", "post_type": "answer", "score": 2 } ]
77823
77826
77826
{ "accepted_answer_id": null, "answer_count": 1, "body": "chef infra serverに対してworkstationからknifeコマンドでnodeを作成したいのですが,\n\n```\n\n knife node create [node_name]\n \n```\n\nとするとその後エディターでnodeの情報の入力が求められると思います. \nこの部分を自動化したいのですがcliのみでnodeの作成をする方法はあるのでしょうか.", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-27T20:03:12.207", "favorite_count": 0, "id": "77825", "last_activity_date": "2021-06-28T06:24:25.563", "last_edit_date": "2021-06-28T00:06:00.680", "last_editor_user_id": "3060", "owner_user_id": "47064", "post_type": "question", "score": 0, "tags": [ "chef" ], "title": "chef の knife node create をエディターへの入力なしで実行したい", "view_count": 47 }
[ { "body": "ドキュメントを見る限り、予め用意した JSON ファイルを指定してノードを作成する方法があるようです。\n\n<https://docs.chef.io/workstation/knife_node/#from-file>\n\n> Use the `from file` argument to create a node using existing node data as a\n> template.\n>\n> **Example: Create a node using a JSON file**\n```\n\n> knife node from file \"PATH_TO_JSON_FILE\"\n> \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T06:24:25.563", "id": "77833", "last_activity_date": "2021-06-28T06:24:25.563", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77825", "post_type": "answer", "score": 0 } ]
77825
null
77833
{ "accepted_answer_id": null, "answer_count": 0, "body": "現在、C#(VisualStudio)で開発しておりSQLServerから値を取得し、帳票(PDF)を作成しようと考えています。 \nデータベースのテーブル内から、ID、氏名、性別、電話番号を取得し帳票を作成します。 \nSealReportで上記の動作について実現できる方法を知っている方、解決策をご教授いただけると助かります。 \nよろしくお願いいたします。\n\n※追記 \n実現したい動きは帳票作成です。以下リンク先の紹介にあるようにSealReportを利用し帳票作成が行えるようなのですが、その方法が把握できていない状況です。その方法を知っている方、解決策をご教授いただけると助かります。よろしくお願いいたします。 \n<https://www.ossnews.jp/oss_info/article.html?oid=9408> \n<https://finereport.hatenablog.com/?page=1566286401>", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T01:27:48.960", "favorite_count": 0, "id": "77827", "last_activity_date": "2021-06-28T01:27:48.960", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "44575", "post_type": "question", "score": 0, "tags": [ "c#" ], "title": "SealReportの利用方法について", "view_count": 305 }
[]
77827
null
null
{ "accepted_answer_id": null, "answer_count": 1, "body": "現在郵便番号検索サイトを作成しております。 \nそのなかでGETで取得したデータをもとに次のページ、前のページで遷移できるようにする必要があり、10件ずつデータを表示する必要があります。 \n次のページ、前のページは完成したのですが、 \nGETの値をSQLに渡すやり方がいまいちわかりません。 \nどうすれば渡すことが出来るでしょうか。 \n参考程度までにソースコード添付いたします。 \nご教授お願い致します。 \n**ソースコード**\n\n```\n\n $post_num = '';\n $area ='';\n $city ='';\n $town ='';\n $error1 = [];\n $error2 = [];\n $user_data = [];\n $abc_data = [];\n $query = '';\n $host = 'localhost';\n $username = 'codecamp46846';\n $passwd = 'codecamp46846';\n $dbname = 'codecamp46846';\n $link= mysqli_connect($host, $username, $passwd, $dbname);\n $count = 0;\n $page = 1;\n /*変数が存在する確認*/ \n if(isset($_POST['submit1']) === true || isset($_POST['submit2']) === true) {\n if(isset($_POST['post_num']) === true) {\n $post_num = htmlspecialchars($_POST['post_num'], ENT_QUOTES, 'UTF-8');\n }\n if(isset($_POST['area']) === true) {\n $area = htmlspecialchars($_POST['area'], ENT_QUOTES, 'UTF-8');\n }\n if(isset($_POST['city']) === true) {\n $city = htmlspecialchars($_POST['city'], ENT_QUOTES, 'UTF-8');\n }\n if(isset($_POST['town']) === true) {\n $town = htmlspecialchars($_POST['town'], ENT_QUOTES, 'UTF-8');\n }\n if(isset($_GET['page']) === true) {\n $page = htmlspecialchars($_POST['page'], ENT_QUOTES, 'UTF-8');\n }\n /*空白削除*/\n $post_num = str_replace(array(\" \",\" \"),\"\", $post_num);\n $area = str_replace(array(\" \",\" \"),\"\", $area);\n $town = str_replace(array(\" \",\" \"),\"\", $town);\n /*エラーメッセージ*/\n if(empty($post_num) === true && \n ($area === '都道府県を選択' || empty($city) === true)) {\n $error1[] = '郵便番号を入力してください';\n }else if ((preg_match('/^[0-9]{7}$/', $post_num) !== 1) && \n ($area === '都道府県を選択' || empty($city) === true)) {\n $error1[] = '7桁の数字で入力してください';\n }else {\n print \"\";\n }\n if ($area === '都道府県を選択' && \n (empty($post_num) === true ||(preg_match('/^[0-9]{7}$/', $post_num) !== 1))) {\n $error2[] = '都道府県を選択してください';\n }\n if(empty($city) === true && \n (empty($post_num) === true ||(preg_match('/^[0-9]{7}$/', $post_num) !== 1))){\n $error2[] = '市区町村名をを入力してください';\n }\n /*データベースに接続*/ \n if(count($error1) === 0 || count($error2) === 0) {\n if($link) {\n $query = \"SELECT COUNT(*) FROM test_table\" . (empty($post_num) ? \"\" : \" WHERE post_num = '$post_num'\");\n mysqli_set_charset($link, 'utf8');\n if(isset($_POST['submit1']) === true) {\n $query = \"SELECT post_num, area , city, town FROM test_table \n WHERE post_num = '$post_num'\";\n } else {\n $limit = 10*$page-10;\n $query = \"SELECT post_num, area , city, town FROM test_table LIMIT \".$limit.\",10\";\n $abc = \"SELECT post_num, area , city, town FROM test_table\";\n $result = mysqli_query($link, $abc);\n while($row = mysqli_fetch_array($result)) {\n $abc_data[] = $row;\n }\n } \n // var_dump($query);\n $result = mysqli_query($link, $query);\n while($row = mysqli_fetch_array($result)) {\n $user_data[] = $row;\n }\n mysqli_free_result($result);\n mysqli_close($link);\n }else {\n echo 'DB接続失敗';\n }\n }\n }\n $count = count($abc_data);\n \n if (\n isset($_GET[\"page\"]) &&\n $_GET[\"page\"] > 0 &&\n $_GET[\"page\"] <= 10\n ) {\n $page = (int)$_GET[\"page\"];\n } else {\n $page = 1;\n }\n \n $limit = 10*$page-10;\n $paging = \"SELECT post_num, area , city, town FROM test_table LIMIT \".$limit.\",10\";\n echo $paging;\n \n \n ?>\n <!DOCTYPE html>\n <html lang=\"ja\">\n <head>\n <meta charset=\"UTF-8\">\n <title>郵便</title>\n </head>\n <body>\n <form action=\"practice_post_code_advanced.php\" method=\"post\">\n <h1>郵便番号検索</h1>\n <h2>郵便番号から検索</h2>\n <?php print \"総件数\" . htmlspecialchars($count,ENT_QUOTES,'UTF-8') . \"件\";?>\n <input id=\"post_numer\" name=\"post_num\" value=\"\">\n <input type=\"submit\" name=\"submit1\" value=\"検索\">\n <form action=\"practice_post_code_advanced.php\" method=\"post\">\n <h2>地名から検索</h2>\n <label>都道府県を選択\n <select name=\"area\" value=\"\">\n <option>都道府県を選択</option>\n <option value=\"北海道\">北海道</option>\n <option value=\"兵庫県\">兵庫県</option>\n <option value=\"新潟県\">新潟県</option>\n </select>\n </label>\n <label>市区町村\n <input type=\"seach\" name=\"city\" value=\"\">\n <input type=\"submit\" name=\"submit2\" value=\"検索\">\n </label>\n </form>\n <p><?php foreach($error1 as $key1 => $string1) {\n print htmlspecialchars($string1,ENT_QUOTES,'UTF-8');\n }\n ?></p>\n <p><?php foreach($error2 as $key2 => $string2) {\n print htmlspecialchars($string2,ENT_QUOTES,'UTF-8');;\n }\n ?></p>\n <?php \n foreach($user_data as $read) {?>\n <table>\n <style type=\"text/css\">\n table, td, th {\n border: solid black 1px;\n }\n table {\n width: 600px;\n }\n tr td {\n width: 150px;\n }\n </style>\n <tr>\n <th>郵便番号</th>\n <th>都道府県</th>\n <th>市町村</th>\n <th>町域</th>\n </tr>\n <tr>\n <td><?php print htmlspecialchars($read['post_num'],ENT_QUOTES,'UTF-8'); ?></td>\n <td><?php print htmlspecialchars($read['area'],ENT_QUOTES,'UTF-8'); ?></td> \n <td><?php print htmlspecialchars($read['city'],ENT_QUOTES,'UTF-8'); ?></td> \n <td><?php print htmlspecialchars($read['town'],ENT_QUOTES,'UTF-8'); ?></td> \n </tr>\n </table>\n <?php } ?> \n <!-- hyperlink to previous and next page -->\n <form name=\"pagination\" action=\"practice_post_code_advanced.php\" method=\"get\">\n <input type=\"hidden\" name=\"post_num\" value=\"<?php echo $post_num; ?>\">\n <input type=\"hidden\" name=\"area\" value=\"<?php echo $area; ?>\">\n <input type=\"hidden\" name=\"city\" value=\"<?php echo $city; ?>\">\n <input type=\"hidden\" name=\"town\" value=\"<?php echo $town; ?>\">\n <input type=\"hidden\" name=\"page\">\n </form>\n \n <p>\n <?php if ($page > 1) : ?>\n <a href=\"?page=<?php echo ($paging - 1); ?>\">前のページへ</a>\n <?php endif; ?>\n <?php if ($page < 10) : ?>\n   <a href=\"?page=<?php echo ($paging + 1); ?>\">次のページへ</a>\n <?php endif; ?>\n </p>\n </body>\n </html>\n \n```", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T04:42:58.737", "favorite_count": 0, "id": "77828", "last_activity_date": "2021-06-28T06:54:27.883", "last_edit_date": "2021-06-28T06:34:00.470", "last_editor_user_id": "46886", "owner_user_id": "46886", "post_type": "question", "score": 0, "tags": [ "php", "mysql" ], "title": "PHPでGETの値をSQLに渡すやり方", "view_count": 648 }
[ { "body": "GET か POST かはあまり重要じゃなく、フォームデータを受け取れているのであれば予め定義された変数と変わりなく扱えばよいだけで、受け取ったパラメータ\n(の変数) を適切な形でクエリに組み込むだけではないでしょうか?\n\n* * *\n\n質問のコードに当てはめると…\n\n * `$_GET['page']` でパラメータは受け取れており、扱いやすいよう適当な変数に入れ直す等して\n\n * クエリを組み立てている部分に変数を埋め込む (以下のコードは原文ママ)\n\n```\n\n /*データベースに接続*/ \n if(count($error1) === 0 || count($error2) === 0) {\n if($link) {\n $query = \"SELECT COUNT(*) FROM test_table\" . (empty($post_num) ? \"\" : \" WHERE post_num = '$post_num'\");\n \n```", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T06:54:27.883", "id": "77834", "last_activity_date": "2021-06-28T06:54:27.883", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77828", "post_type": "answer", "score": 3 } ]
77828
null
77834
{ "accepted_answer_id": null, "answer_count": 1, "body": "VSCode の Remote Development Extension で、Windows 10 上 の VSCode から Linux\nサーバにアクセスして開発しています。\n\nサーバ上には Intel のコンパイラがあり、これのエラーメッセージを VSCode で読み取ろうとしていますが、一つも検知できません。\n\nエラーメッセージは今のところ2形式見かけています。\n\n * エラーコードのないタイプ:\n``` src/Data.cpp(163): error: class \"Node\" has no member \"local_index_\"\n\n \n```\n\n * エラーコードのあるタイプ:\n``` src/Data.cpp(82): error #308: member \"Node::m_\" (declared at line\n56 of \"include/Node.h\") is inaccessible\n\n \n```\n\nこれに対して、vscodeのタスク定義の中で、以下のようにproblemMatcherを書いてみていますが、これで一件も検出されません。何がいけない・足りないのでしょうか?\n\nドキュメントは [Defining a problem matcher | Tasks in Visual Studio\nCode](https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-\nmatcher) を見ながら挑戦しています。\n\n```\n\n {\n \"version\": \"2.0.0\",\n \"tasks\": [\n {\n \"type\": \"cppbuild\",\n \"label\": \"C/C++: make all\",\n \"command\": \"make\",\n \"args\": [\n \"all\",\n ],\n \"options\": {\n \"cwd\": \"${workspaceFolder}\"\n },\n \"problemMatcher\": {\n \"fileLocation\":\"relative\",\n \"pattern\": {\n \"regexp\": \"^([^(]+)\\\\(\\\\d+\\\\):\\\\s+(warning|error)( #\\\\d+)?:\\\\s+(.*)$\",\n /* 以下もダメでした */\n /* \"regexp\": \"^(.*)\\\\(\\\\d+\\\\):\\\\s+(warning|error)( #\\\\d+)?:\\\\s+(.*)$\", */\n /* \"regexp\": \"^([-/._A-Za-z0-9]+)\\\\(\\\\d+\\\\):\\\\s+(warning|error)( #\\\\d+)?:\\\\s+(.*)$\", */\n \"file\": 1,\n \"line\": 2,\n \"severity\": 3,\n \"message\": 5\n }\n },\n \"group\":{\n \"kind\": \"build\",\n \"isDefault\": true\n },\n }\n ]\n }\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T06:02:30.747", "favorite_count": 0, "id": "77829", "last_activity_date": "2021-06-29T00:50:28.583", "last_edit_date": "2021-06-29T00:50:28.583", "last_editor_user_id": "3060", "owner_user_id": "40200", "post_type": "question", "score": 0, "tags": [ "正規表現", "vscode" ], "title": "VSCode で Intel コンパイラのエラーメッセージ向けに problemMatcher を書こうとしているがマッチしてくれない", "view_count": 169 }
[ { "body": "kunif さんのコメントに答えの核心がありました。\n\n私の書いていたものでは、 \"(123)\" のように、かっこで囲まれた行数の部分を \"\\\\(\\d+\\\\)\" というパターンでとらえようとしていました。\n\nしかし、これではあとで数字の部分をマッチした部分文字列(なんて言うんでしたっけ)として取り出せません。取り出せるようにするには、部分文字列の目印のためのカッコが必要なので\n\"\\\\((\\d+)\\\\)\" と書く必要があったのでした。\n\n目に見えるかっこのことは気にしていましたが見えない方のかっこを忘れておりました。\n\nおかげで通るようになりました!", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T11:15:49.397", "id": "77837", "last_activity_date": "2021-06-28T11:15:49.397", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "40200", "parent_id": "77829", "post_type": "answer", "score": 1 } ]
77829
null
77837
{ "accepted_answer_id": null, "answer_count": 0, "body": "あまり機械に強くなく、でも音楽制作をしてみたく \n様々な説明サイトや動画を見ながらおこなっているのですが、つまずき先に進めなくなってしまいました。 \n藁にもすがる思いでこちらのサイトにたどり着き、質問させていただきます。 \nカテゴリ違いなどでしたら削除しますのでお教え願います。\n\nMacBook Airを使っており、「NEUTRINO」という音楽制作ソフトと「muse score」という楽譜作成ソフトをダウンロードしました。 \nmuse\nscoreで作成した楽譜を、NEUTRINOのファイル→score→musicxml内のサンプルが3つ入っているファイルに、楽譜のエクスポートはできていると思われます。\n\nRun.shで、BASENAMEの箇所も書き換えています。\n\nこのあとMacの「ターミナル」を開き、ここでサイトや動画の説明と同じく `cd Documents/NEUTRNO` と打ちエンター、`sh Run.sh`\nと打っているのですが、この先が何も出てきません。 \n他のサイトや動画と見比べても、ターミナルを開いた時に元から入っている文章も違うように感じるのですが・・・。\n\nこの場合、どこをどう直すと先へ進めるのでしょうか。 \n分かる方いましたら、ご教授お願いいたします。\n\n**追記:**\n\nファイルにカーソルを合わせて新規ターミナルを開く、ができていなかったので、こちらを行ったところ、エラーメッセージが出るようになりました。 \nただ、ここからまた進めず、楽譜を最初から読み直したり、試しているのですが、同じエラーが出て進めません。\n\n・・追記・・ \nコメントありがとうございます。遅くなりすみません。\n\n新規ターミナルを開いて cd Documents/NEUTRNO →エンターで sh Run.sh \nと打った場合のエラーは下記です。\n\n```\n\n Last login: Wed Jun 30 10:15:53 on console\n MacBook-Air:NEUTRINO $ sh Run.sh\n 18:37 : start MusicXMLtoLabel\n Convert MusicXML to label -> score/musicxml/atamesi.musicxml\n [ERR] Cannot open Xml file\n [ERROR] failed to load score from MusicXML file : score/musicxml/atamesi.musicxml\n 18:37 : start NEUTRINO\n error: Can not open full label file.\n 18:37 : start WORLD\n error: Can not open file.\n 18:37 : END\n MacBook-Air:NEUTRINO $ \n \n```\n\nまたcd Documents/NEUTRNOなしで、sh Run.shを打つという情報もありましたので \nその場合のエラーは以下の通りです。\n\n```\n\n Last login: Wed Jun 30 10:18:26 on ttys000\n MacBook-Air:NEUTRINO $ cd Documents/NEUTRNO\n -bash: cd: Documents/NEUTRNO: No such file or directory\n MacBook-Air:NEUTRINO $ sh Run.sh\n 19:49 : start MusicXMLtoLabel\n Convert MusicXML to label -> score/musicxml/atamesi.musicxml\n [ERR] Cannot open Xml file\n [ERROR] failed to load score from MusicXML file : score/musicxml/atamesi.musicxml\n 19:49 : start NEUTRINO\n error: Can not open full label file.\n 19:49 : start WORLD\n error: Can not open file.\n 19:49 : END\n MacBook-Air:NEUTRINO $ \n \n```\n\nターミナル内やRun.sh内の書き換え方が問題なのか、そもそもの楽譜ファイルが悪いのか、どこに原因があるのかよく分からない状態です。", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T08:45:24.250", "favorite_count": 0, "id": "77835", "last_activity_date": "2021-06-30T02:04:18.713", "last_edit_date": "2021-06-30T02:04:18.713", "last_editor_user_id": "3060", "owner_user_id": "47073", "post_type": "question", "score": 0, "tags": [ "macos" ], "title": "MacBook AirでNEUTRINOを使い、音楽制作途中ですがつまずいています。", "view_count": 1072 }
[]
77835
null
null
{ "accepted_answer_id": "77850", "answer_count": 1, "body": "背景にbeforeを使って画像を表示させたaを、fixedで追従するメニューのようにしました。 \nしかし背景に画像を表示させる関係でbeforeのz-indexを-1にしてしまったため、他のdiv要素が邪魔して追従時に隠れてしまいます。 \nあれこれz-indexを変えたりpositionを入れてみたりしているのですが解決できません。 \nこの場合は階層順をどのようにすればいいのでしょうか?\n\nご教示いただけると助かります。\n\naを隠してしまうdivのコードは以下\n\n```\n\n $('.flex_ a').on('click',function(){\n $('.flex_ a').removeClass('active');\n $(this).addClass('active');\n })\n```\n\n```\n\n @charset \"UTF-8\";\n \n html{\n scroll-behavior: smooth;\n }\n \n * {\n box-sizing: border-box;\n }\n \n body {\n color: #3e3e3e;\n background:\n linear-gradient(217deg, rgba(255,242,192,1), rgba(255,210,179,1)),\n linear-gradient(127deg, rgba(255,210,179,1), rgba(255,229,180,1));\n }\n \n a:link, a:visited, a:hover, a:active{\n text-decoration: none;\n color: #3e3e3e;\n }\n \n p {\n font-family: \"メイリオ\",Meiryo,\"ヒラギノ角ゴ Pro W3\",\"Hiragino Kaku Gothic Pro\",Osaka,\"MS Pゴシック\",\"MS PGothic\",sans-serif;\n line-height:1.5;\n letter-spacing:0.1em;\n }\n \n .sp_br{\n display:none;\n }\n \n /*パンくずリスト周りの調整ここから*/\n #g_nav {\n margin: 0;\n }\n \n ul#topic_path {\n max-width: 100%;\n padding: 15px 0 0 15px;\n margin-bottom: 20px;\n text-align: center;\n }\n \n ul#topic_path li a:hover {\n color: #ff6c00; \n }\n /*パンくずリスト周りの調整ここまで*/\n \n #contents {\n border: none;\n padding: 0px;\n margin: 0;\n background-color: transparent;\n border-radius: 5px;\n }\n \n \n section {\n padding: 60px 10px;\n }\n \n /*見出しデザインここから*/\n .section-title {\n max-width: 400px;\n width: 100%;\n height: auto;\n margin: 0 auto 30px;\n display: block;\n }\n \n /*メインビジュアルここから*/\n .mainvisual {\n max-width: 1920px;\n width: 100%;\n height: auto;\n display: block;\n margin: auto;\n \n }\n \n .mainvisual img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n }\n /*メインビジュアルここまで*/\n \n /*リード文ここから*/\n .lead-box {\n max-width: 1200px;\n background-color: #fff;\n border-radius: 5px;\n padding: 50px;\n margin: auto;\n }\n \n .lead-box p {\n /*max-width: 1200px;*/\n margin: 0 auto;\n font-weight:bold;\n line-height: 1.8;\n display: block;\n }\n /*リード文ここまで*/\n \n \n /*投稿ボタンここから*/\n a.btn-hv:link, a.btn-hv:visited, a.btn-hv:hover, a.btn-hv:active{\n text-decoration: none;\n }\n \n a.btn-hv {\n font-weight: bold;\n text-align: center; \n text-decoration: none;\n color: #fff;\n background:\n linear-gradient(217deg, rgba(174,220,255,1), rgba(189,190,255,1));\n padding: 15px;\n display: block;\n margin: -44px auto 0;\n max-width: 350px;\n transition: .3s ease;\n font-size: 1.8em;\n border-radius: 10px;\n letter-spacing: 0.25rem;\n border: solid 1.9px rgba(189,190,255,1);\n box-sizing: border-box;\n font-family: \"ヒラギノ丸ゴ Pro W4\",\"ヒラギノ丸ゴ Pro\",\"Hiragino Maru Gothic Pro\",\"ヒラギノ角ゴ Pro W3\",\"Hiragino Kaku Gothic Pro\",\"HG丸ゴシックM-PRO\",\"HGMaruGothicMPRO\";\n }\n \n a.btn-hv:hover,a.btn-hv2:hover {\n text-align: center; \n text-decoration: none;\n color: rgba(189,190,255,1);\n background:transparent;\n }\n \n .flex_box {\n max-width: 1200px;\n width: 100%;\n height: auto;\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n margin: 0 auto;\n position: relative;\n }\n \n .fex_ a:hover{\n opacity:0.6;\n transition:0.6s;\n }\n \n .box {\n width: 32%;\n background-color: #FFFFFF;\n border-radius: 5px;\n margin-bottom: 3%;\n text-align: center;\n position: relative;/*更新バッジ用*/\n }\n \n .box:nth-of-type(3) {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n \n .badge{\n border-radius: 5px 0 0 0;\n font-weight: bold;\n font-size: 1.3em;\n color: #fff;\n background-color: #ff931d;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1000;\n padding: 10px 20px; \n }\n \n .box a {\n display: block;\n transition: .2s ease;\n }\n \n .box a:hover {\n color: #ff931d;\n opacity: 0.8;\n }\n \n \n .box img {\n max-width: 700px;\n width: 100%;\n height: auto;\n border-radius: 5px 5px 0 0;\n transition: .2s ease;\n position: relative;\n \n }\n \n .flex_box::after {\n display: block;\n content:\"\";\n width: 32%;\n }\n \n .blog_title {\n text-align: center;\n font-size: 1.2em;\n font-weight: bold;\n margin: 10px 5px;\n transition: .2s ease;\n }\n \n h2{\n text-align: center;\n font-size:2.25rem;\n padding:20px;\n text-decoration: none;\n border:none;\n font-family: \"ヒラギノ丸ゴ Pro W4\",\"ヒラギノ丸ゴ Pro\",\"Hiragino Maru Gothic Pro\",\"ヒラギノ角ゴ Pro W3\",\"Hiragino Kaku Gothic Pro\",\"HG丸ゴシックM-PRO\",\"HGMaruGothicMPRO\";\n color:#3e3e3e;\n }\n \n .come{\n text-align:center;\n display:block;\n font-weight: bold;\n font-size:1.7rem;\n }\n \n .flex_ctn{\n display: flex;\n flex-wrap: wrap;\n }\n \n .box__ img{\n object-fit: cover;\n display:block;\n width:100%;\n }\n \n .photo__{\n width:31.6%;\n object-fit: cover;\n margin:1%;\n box-sizing: border-box;\n }\n \n .photo__:nth-child(3n){\n margin:1% 0 1% 1%;\n }\n \n .box__ img:hover{\n opacity:0.7;\n }\n \n \n @media(max-width: 690px) {\n /*パンくずリスト周りの調整*/\n #g_nav {\n margin: 0;\n }\n \n .sp_br{\n display:block;\n }\n \n section {\n padding: 20px 10px;\n }\n \n #contents {\n margin: 0;\n }\n \n .mainvisual {\n padding: 0;\n }\n \n .mainvisual img {\n padding: 0;\n }\n \n .lead-box {\n padding: 20px;\n }\n \n .lead-box p {\n font-size: 95%;\n }\n \n .blog_title {\n font-size: 1em;\n }\n \n a.btn-hv {\n font-size: 1.5em;\n }\n .box__ img{\n object-fit: cover;\n display:block;\n width:100%;\n }\n .photo__{\n width:48%;\n object-fit: cover;\n margin:1%;\n box-sizing: border-box;\n }\n .photo__:nth-child(3n){\n margin:1%;\n }\n }\n \n @media(max-width: 620px) {\n \n .col_1 {\n background-color: #fff;\n border-radius: 5px;\n border: 1px solid #8E8E8E;\n padding: 20px;\n }\n \n .box {\n width: 100%;\n margin-bottom: 10%;\n }\n \n \n a.btn-hv {\n padding:10px;\n margin: 5px auto 0;\n }\n }\n \n .nav {\n height: 90px;\n width: 100%;\n margin: 0 auto;\n position: fixed;\n top: 130px;\n left: 0;\n }\n \n .flex_ {\n max-width: 1200px;\n width: 45%;\n margin: 0 5% 0 50%;\n height: 80px;\n line-height: 80px;\n display: flex;\n position: relative;\n justify-content: space-between;\n }\n \n .flex_ a {\n display: block;\n font-size: 1.5rem;\n padding: 0 0 0 20px;\n color: #000;\n text-decoration: none;\n overflow: visible;\n }\n \n @media (max-width: 1092px) {\n body {\n width: 100%;\n }\n .flex_ {\n width:60%;\n margin: 0 auto;\n }\n }\n \n @media (max-width: 823px) {\n \n .flex_ {\n width:90%;\n margin: 0 auto;\n }\n .flex_ a {\n font-size: 1.25rem;\n }\n }\n \n @media (max-width: 553px) {\n \n .flex_ {\n flex-direction:column;\n height: 65px;\n line-height: 65px;\n }\n \n .flex_ a {\n font-size: 1rem;\n }\n }\n \n .active + .huwahuwa {\n display: inline-block;\n }\n \n @keyframes huwahuwa {\n 0% {\n transform: translate(0, 0) rotate(-7deg);\n }\n 50% {\n transform: translate(0, -7px) rotate(0deg);\n }\n 100% {\n transform: translate(0, 0) rotate(7deg);\n }\n }\n \n .flex_ a:hover {\n opacity: 0.6;\n transition: 0.6s;\n }\n \n .flex_ > a {\n /* クリック時のbefore疑似要素をa要素にスタッキングするため、positionをrelativeに */\n position: relative;\n }\n \n .flex_ > a.active::before {\n /* huwahuwaは疑似要素で表現。内容はほぼ従来のhuwahuwaと同じ。 */\n /* posotionをabsoluteに。配置位置を親のa要素基準とする。*/\n position: absolute;\n /* leftとtopを0にすることで親要素の左上と同一の位置に移動。調整したい場合はこの数値をいじってください */\n left: 0;\n top: 0;\n content: \"\";\n animation: huwahuwa 3s infinite ease-in-out 0.8s alternate;\n background: url(https://i.stack.imgur.com/FXBqw.png) no-repeat\n center center / 60px auto;\n display: inline-block;\n transition: 1.5s ease-in-out;\n width: 100px;\n height: 100px;\n z-index:-1;\n }\n \n @media (max-width: 553px) {\n \n .flex_ > a.active::before {\n /* huwahuwaは疑似要素で表現。内容はほぼ従来のhuwahuwaと同じ。 */\n /* posotionをabsoluteに。配置位置を親のa要素基準とする。*/\n position: absolute;\n /* leftとtopを0にすることで親要素の左上と同一の位置に移動。調整したい場合はこの数値をいじってください */\n left: 0;\n top: -17px;\n }\n }\n \n #portal{\n position: relative;\n background-color: #abe;\n }\n #photo{\n background-color: #bea;\n }\n```\n\n```\n\n <!DOCTYPE html>\n <html lang=\"ja\">\n <!--<![endif]-->\n <head>\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta charset=\"utf-8\">\n <title></title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1\">\n <meta name=\"format-detection\" content=\"telephone=no\" />\n \n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js\"></script>\n <link rel=\"stylesheet\" href=\"css/style.css\">\n \n </head>\n <body>\n <header id=\"header\"> \n </header>\n \n \n <ul id=\"topic_path\">\n <li><a href=\"\">トップページ</a></li>\n <li></li>\n </ul>\n \n \n <div class=\"nav\">\n <div class=\"flex_\">\n <a href=\"#\">top</a>\n <a href=\"#portal\">one</a>\n <a href=\"#photo\">two</a>\n </div>\n </div>\n \n <div id=\"contents\">\n \n <div class=\"mainvisual\">\n <img src=\"\" alt=\"\">\n </div>\n \n <a href=\"\" class=\"btn-hv\" target=\"_blank\">投稿はこちら</a>\n \n <section>\n \n <div class=\"lead-box\">\n <p>aaa</p>\n \n <p>&nbsp;</p>\n \n <p>aaa</p>\n \n <p>&nbsp;</p>\n \n <p>aaa</p>\n \n <p>&nbsp;</p>\n \n <p>aaa</p>\n </div>\n \n </section>\n \n <section id=\"portal\">\n <h2>one</h2>\n <div class=\"flex_box\">\n \n <div class=\"box\">\n <span class=\"badge\"> NEW! </span>\n <a href=\"\" target=\"_blank\">\n <img src=\"\" alt=\"\">\n <p class=\"blog_title\"></p></a>\n </div>\n \n </div>\n </section>\n \n <section id=\"photo\">\n <h2>two</h2>\n </section>\n \n <div id=\"go_to_top\">\n <div class=\"wrap\"><a href=\"#header\">▲ ページの先頭へ</a></div>\n </div>\n </body>\n </html>\n```", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T10:03:03.780", "favorite_count": 0, "id": "77836", "last_activity_date": "2021-07-05T15:40:31.870", "last_edit_date": "2021-07-05T15:40:31.870", "last_editor_user_id": "19110", "owner_user_id": "46994", "post_type": "question", "score": 1, "tags": [ "css", "html5" ], "title": "position:fixed;のaの階層を一番上にする方法", "view_count": 372 }
[ { "body": "ナビゲーション部が他のdiv要素の下に隠れてしまう(隠れてしまうのは`#portal`だけですが)原因はbefore疑似要素の`z-index`が原因ではなく、`#portal`に`position:\nrelative`が付与されているためこのdiv要素がナビ部と同レベルのスタッキングコンテキストとなり、`#portal`の方がHTML上後から記述されているので`#portal`の方が上側に描画されているからです。 \nスタッキングコンテキストについてはドキュメントを読んでも難解かもしれませんが、ちゃんと理解していないと複雑なレイアウトが意図通り作成できません。必ず理解するようにしてください。 \n<https://developer.mozilla.org/ja/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context>\n\n今回の問題も解決策は複数ありますが、最も手軽な方法はナビ部分をhtml文書の一番最後に記載することです。 \nhtmlでは同じレベルの重ね合わせ順序が設定されている場合、後から書いた方が上に来ます。ナビ部分が常に`fixed`であるならば基本的にどの場所に記載しても画面上は固定位置なので、文書の最後に記載することでz-\nindexを意識しなくても最も上に描画させることが可能です。\n\n```\n\n $('.flex_ a').on('click',function(){\n $('.flex_ a').removeClass('active');\n $(this).addClass('active');\n })\n```\n\n```\n\n @charset \"UTF-8\";\n \n html{\n scroll-behavior: smooth;\n }\n \n * {\n box-sizing: border-box;\n }\n \n body {\n color: #3e3e3e;\n background:\n linear-gradient(217deg, rgba(255,242,192,1), rgba(255,210,179,1)),\n linear-gradient(127deg, rgba(255,210,179,1), rgba(255,229,180,1));\n }\n \n a:link, a:visited, a:hover, a:active{\n text-decoration: none;\n color: #3e3e3e;\n }\n \n p {\n font-family: \"メイリオ\",Meiryo,\"ヒラギノ角ゴ Pro W3\",\"Hiragino Kaku Gothic Pro\",Osaka,\"MS Pゴシック\",\"MS PGothic\",sans-serif;\n line-height:1.5;\n letter-spacing:0.1em;\n }\n \n .sp_br{\n display:none;\n }\n \n /*パンくずリスト周りの調整ここから*/\n #g_nav {\n margin: 0;\n }\n \n ul#topic_path {\n max-width: 100%;\n padding: 15px 0 0 15px;\n margin-bottom: 20px;\n text-align: center;\n }\n \n ul#topic_path li a:hover {\n color: #ff6c00; \n }\n /*パンくずリスト周りの調整ここまで*/\n \n #contents {\n border: none;\n padding: 0px;\n margin: 0;\n background-color: transparent;\n border-radius: 5px;\n }\n \n \n section {\n padding: 60px 10px;\n }\n \n /*見出しデザインここから*/\n .section-title {\n max-width: 400px;\n width: 100%;\n height: auto;\n margin: 0 auto 30px;\n display: block;\n }\n \n /*メインビジュアルここから*/\n .mainvisual {\n max-width: 1920px;\n width: 100%;\n height: auto;\n display: block;\n margin: auto;\n \n }\n \n .mainvisual img {\n max-width: 100%;\n height: auto;\n margin: 0 auto;\n display: block;\n }\n /*メインビジュアルここまで*/\n \n /*リード文ここから*/\n .lead-box {\n max-width: 1200px;\n background-color: #fff;\n border-radius: 5px;\n padding: 50px;\n margin: auto;\n }\n \n .lead-box p {\n /*max-width: 1200px;*/\n margin: 0 auto;\n font-weight:bold;\n line-height: 1.8;\n display: block;\n }\n /*リード文ここまで*/\n \n \n /*投稿ボタンここから*/\n a.btn-hv:link, a.btn-hv:visited, a.btn-hv:hover, a.btn-hv:active{\n text-decoration: none;\n }\n \n a.btn-hv {\n font-weight: bold;\n text-align: center; \n text-decoration: none;\n color: #fff;\n background:\n linear-gradient(217deg, rgba(174,220,255,1), rgba(189,190,255,1));\n padding: 15px;\n display: block;\n margin: -44px auto 0;\n max-width: 350px;\n transition: .3s ease;\n font-size: 1.8em;\n border-radius: 10px;\n letter-spacing: 0.25rem;\n border: solid 1.9px rgba(189,190,255,1);\n box-sizing: border-box;\n font-family: \"ヒラギノ丸ゴ Pro W4\",\"ヒラギノ丸ゴ Pro\",\"Hiragino Maru Gothic Pro\",\"ヒラギノ角ゴ Pro W3\",\"Hiragino Kaku Gothic Pro\",\"HG丸ゴシックM-PRO\",\"HGMaruGothicMPRO\";\n }\n \n a.btn-hv:hover,a.btn-hv2:hover {\n text-align: center; \n text-decoration: none;\n color: rgba(189,190,255,1);\n background:transparent;\n }\n \n .flex_box {\n max-width: 1200px;\n width: 100%;\n height: auto;\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n margin: 0 auto;\n position: relative;\n }\n \n .fex_ a:hover{\n opacity:0.6;\n transition:0.6s;\n }\n \n .box {\n width: 32%;\n background-color: #FFFFFF;\n border-radius: 5px;\n margin-bottom: 3%;\n text-align: center;\n position: relative;/*更新バッジ用*/\n }\n \n .box:nth-of-type(3) {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n \n .badge{\n border-radius: 5px 0 0 0;\n font-weight: bold;\n font-size: 1.3em;\n color: #fff;\n background-color: #ff931d;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1000;\n padding: 10px 20px; \n }\n \n .box a {\n display: block;\n transition: .2s ease;\n }\n \n .box a:hover {\n color: #ff931d;\n opacity: 0.8;\n }\n \n \n .box img {\n max-width: 700px;\n width: 100%;\n height: auto;\n border-radius: 5px 5px 0 0;\n transition: .2s ease;\n position: relative;\n \n }\n \n .flex_box::after {\n display: block;\n content:\"\";\n width: 32%;\n }\n \n .blog_title {\n text-align: center;\n font-size: 1.2em;\n font-weight: bold;\n margin: 10px 5px;\n transition: .2s ease;\n }\n \n h2{\n text-align: center;\n font-size:2.25rem;\n padding:20px;\n text-decoration: none;\n border:none;\n font-family: \"ヒラギノ丸ゴ Pro W4\",\"ヒラギノ丸ゴ Pro\",\"Hiragino Maru Gothic Pro\",\"ヒラギノ角ゴ Pro W3\",\"Hiragino Kaku Gothic Pro\",\"HG丸ゴシックM-PRO\",\"HGMaruGothicMPRO\";\n color:#3e3e3e;\n }\n \n .come{\n text-align:center;\n display:block;\n font-weight: bold;\n font-size:1.7rem;\n }\n \n .flex_ctn{\n display: flex;\n flex-wrap: wrap;\n }\n \n .box__ img{\n object-fit: cover;\n display:block;\n width:100%;\n }\n \n .photo__{\n width:31.6%;\n object-fit: cover;\n margin:1%;\n box-sizing: border-box;\n }\n \n .photo__:nth-child(3n){\n margin:1% 0 1% 1%;\n }\n \n .box__ img:hover{\n opacity:0.7;\n }\n \n \n @media(max-width: 690px) {\n /*パンくずリスト周りの調整*/\n #g_nav {\n margin: 0;\n }\n \n .sp_br{\n display:block;\n }\n \n section {\n padding: 20px 10px;\n }\n \n #contents {\n margin: 0;\n }\n \n .mainvisual {\n padding: 0;\n }\n \n .mainvisual img {\n padding: 0;\n }\n \n .lead-box {\n padding: 20px;\n }\n \n .lead-box p {\n font-size: 95%;\n }\n \n .blog_title {\n font-size: 1em;\n }\n \n a.btn-hv {\n font-size: 1.5em;\n }\n .box__ img{\n object-fit: cover;\n display:block;\n width:100%;\n }\n .photo__{\n width:48%;\n object-fit: cover;\n margin:1%;\n box-sizing: border-box;\n }\n .photo__:nth-child(3n){\n margin:1%;\n }\n }\n \n @media(max-width: 620px) {\n \n .col_1 {\n background-color: #fff;\n border-radius: 5px;\n border: 1px solid #8E8E8E;\n padding: 20px;\n }\n \n .box {\n width: 100%;\n margin-bottom: 10%;\n }\n \n \n a.btn-hv {\n padding:10px;\n margin: 5px auto 0;\n }\n }\n \n .nav {\n height: 90px;\n width: 100%;\n margin: 0 auto;\n position: fixed;\n top: 130px;\n left: 0;\n }\n \n .flex_ {\n max-width: 1200px;\n width: 45%;\n margin: 0 5% 0 50%;\n height: 80px;\n line-height: 80px;\n display: flex;\n position: relative;\n justify-content: space-between;\n }\n \n .flex_ a {\n display: block;\n font-size: 1.5rem;\n padding: 0 0 0 20px;\n color: #000;\n text-decoration: none;\n overflow: visible;\n }\n \n @media (max-width: 1092px) {\n body {\n width: 100%;\n }\n .flex_ {\n width:60%;\n margin: 0 auto;\n }\n }\n \n @media (max-width: 823px) {\n \n .flex_ {\n width:90%;\n margin: 0 auto;\n }\n .flex_ a {\n font-size: 1.25rem;\n }\n }\n \n @media (max-width: 553px) {\n \n .flex_ {\n flex-direction:column;\n height: 65px;\n line-height: 65px;\n }\n \n .flex_ a {\n font-size: 1rem;\n }\n }\n \n .active + .huwahuwa {\n display: inline-block;\n }\n \n @keyframes huwahuwa {\n 0% {\n transform: translate(0, 0) rotate(-7deg);\n }\n 50% {\n transform: translate(0, -7px) rotate(0deg);\n }\n 100% {\n transform: translate(0, 0) rotate(7deg);\n }\n }\n \n .flex_ a:hover {\n opacity: 0.6;\n transition: 0.6s;\n }\n \n .flex_ > a {\n /* クリック時のbefore疑似要素をa要素にスタッキングするため、positionをrelativeに */\n position: relative;\n }\n \n .flex_ > a.active::before {\n /* huwahuwaは疑似要素で表現。内容はほぼ従来のhuwahuwaと同じ。 */\n /* posotionをabsoluteに。配置位置を親のa要素基準とする。*/\n position: absolute;\n /* leftとtopを0にすることで親要素の左上と同一の位置に移動。調整したい場合はこの数値をいじってください */\n left: 0;\n top: 0;\n content: \"\";\n animation: huwahuwa 3s infinite ease-in-out 0.8s alternate;\n background: url(https://placehold.jp/3d4070/ffffff/150x150.png?text=huwahuwa) no-repeat\n center center / 60px auto;\n display: inline-block;\n transition: 1.5s ease-in-out;\n width: 100px;\n height: 100px;\n z-index:-1;\n }\n \n @media (max-width: 553px) {\n \n .flex_ > a.active::before {\n /* huwahuwaは疑似要素で表現。内容はほぼ従来のhuwahuwaと同じ。 */\n /* posotionをabsoluteに。配置位置を親のa要素基準とする。*/\n position: absolute;\n /* leftとtopを0にすることで親要素の左上と同一の位置に移動。調整したい場合はこの数値をいじってください */\n left: 0;\n top: -17px;\n }\n }\n \n #portal{\n position: relative;\n background-color: #abe;\n \n }\n #photo{\n background-color: #bea;\n }\n```\n\n```\n\n <!DOCTYPE html>\n <html lang=\"ja\">\n <!--<![endif]-->\n <head>\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta charset=\"utf-8\">\n <title></title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1\">\n <meta name=\"format-detection\" content=\"telephone=no\" />\n \n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js\"></script>\n <link rel=\"stylesheet\" href=\"css/style.css\">\n \n </head>\n <body>\n <header id=\"header\"> \n </header>\n \n \n <ul id=\"topic_path\">\n <li><a href=\"\">トップページ</a></li>\n <li></li>\n </ul>\n \n \n <div id=\"contents\">\n \n <div class=\"mainvisual\">\n <img src=\"\" alt=\"\">\n </div>\n \n <a href=\"\" class=\"btn-hv\" target=\"_blank\">投稿はこちら</a>\n \n <section>\n \n <div class=\"lead-box\">\n <p>aaa</p>\n \n <p>&nbsp;</p>\n \n <p>aaa</p>\n \n <p>&nbsp;</p>\n \n <p>aaa</p>\n \n <p>&nbsp;</p>\n \n <p>aaa</p>\n </div>\n \n </section>\n \n <section id=\"portal\">\n <h2>one</h2>\n <div class=\"flex_box\">\n \n <div class=\"box\">\n <span class=\"badge\"> NEW! </span>\n <a href=\"\" target=\"_blank\">\n <img src=\"\" alt=\"\">\n <p class=\"blog_title\"></p></a>\n </div>\n \n </div>\n </section>\n \n <section id=\"photo\">\n <h2>two</h2>\n </section>\n \n <div id=\"go_to_top\">\n <div class=\"wrap\"><a href=\"#header\">▲ ページの先頭へ</a></div>\n </div>\n <!-- navを文書の一番下へ移動 -->\n <div class=\"nav\">\n <div class=\"flex_\">\n <a href=\"#\">top</a>\n <a href=\"#portal\">one</a>\n <a href=\"#photo\">two</a>\n </div>\n </div>\n \n </body>\n </html>\n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T09:18:44.590", "id": "77850", "last_activity_date": "2021-06-29T09:18:44.590", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46944", "parent_id": "77836", "post_type": "answer", "score": 0 } ]
77836
77850
77850
{ "accepted_answer_id": null, "answer_count": 1, "body": "現在、IDY社製のWi-Fiモジュールを使ってspresenseの無線化を試しています。 \nWi-Fi本体の名称は、GM2200Mといいます。 \n<https://qiita.com/Inoue_Minoru/items/d6513670c5988884f0b0> \nこちらのサイトを参考にやっていますが、 \n[![プログラム書き込み後のシリアルモニターの応答](https://i.stack.imgur.com/TI5kQ.png)](https://i.stack.imgur.com/TI5kQ.png)\n\nこのような返事しか帰ってきません。またモジュールを外した状態でも同じ応答になります。 \nnode.jsは、Hello Worldをlocalhostで表示できることを確認してから使っています。 \nテスターで電源は供給されていることが確認できたので、初期不良ではない?と思います。 \n何かしら分かる方いらっしゃいましたら、回答頂けますと幸いです。\n\nよろしくお願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T12:42:36.537", "favorite_count": 0, "id": "77838", "last_activity_date": "2021-06-30T01:11:18.987", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "44392", "post_type": "question", "score": 0, "tags": [ "spresense", "wifi" ], "title": "spresense Wi-Fiモジュール is110b によるデータの送信について", "view_count": 468 }
[ { "body": "1点、気になるところがあります。\n\nこのボードは、下記のページを見ると、発売時期によってバージョンが異なるようです。 \n<https://idy-design.com/product/is110b.html>\n\n自分の手持ちは、V1.0A なので、こちらの記事どおりで動作するのするのですが、 \n<https://qiita.com/Inoue_Minoru/items/d6513670c5988884f0>\n\nおそらく、新しく購入されたものの場合、V1.0C などになっているのかと思います。 \nその場合、GitHub上のリポジトリで使うのではなく、下記のパッチを使うようです。\n\n<https://idy-design.com/wp-content/uploads/2020/11/0001-Support-iS110B-typeC-\nmodule.zip>\n\n自分は、V1.0C を持っていないので、確認はできていないのですが、このあたりを試してみてはどうでしょうか?", "comment_count": 8, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T01:11:18.987", "id": "77871", "last_activity_date": "2021-06-30T01:11:18.987", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "32281", "parent_id": "77838", "post_type": "answer", "score": 0 } ]
77838
null
77871
{ "accepted_answer_id": "77840", "answer_count": 1, "body": "# やりたいこと\n\n自作ライブラリで、列挙型クラスを公開しています。 \nクラスの名前をより良い名前に変更したいのですが、すでに公開しているクラスなので、変更前の名前も利用できるようにしたいです。\n\n# 質問\n\n以下のコードで、ひとまず変更前の名前も利用できるようになりました。\n\n```\n\n from enum import Enum\n class NewColor(Enum):\n \"\"\"色\"\"\"\n RED = 1\n GREEN = 2\n BLUE = 3\n \n OldColor = NewColor\n \n```\n\nしかし、上記のコードでは以下の要件を満たせません。\n\n * `OldColor.__doc__`に、非推奨である旨のメッセージを追加したい\n * `OldColor`を参照した場合(`OldColor.RED`,`OldColor(1)`)は、警告メッセージを出力したい \nこの要件を満たすには、どのようなコードを書けばよいでしょうか?\n\n# 補足\n\n通常のクラス場合は、以下のコードで、次の要件を満たせることは分かりました。\n\n * 変更前のクラスの`__doc__`に、非推奨である旨のメッセージを追加する\n * 変更前のクラスを使ってインスタンス生成する際に、警告メッセージを出力\n\n```\n\n def moved_class(new_class, old_class_name, old_module_name,\n message=None, version=None, removal_version=None,\n stacklevel=3, category=None):\n # ...\n def decorator(f):\n \n @six.wraps(f, assigned=_utils.get_assigned(f))\n def wrapper(self, *args, **kwargs):\n _utils.deprecation(out_message, stacklevel=stacklevel,\n category=category)\n return f(self, *args, **kwargs)\n \n return wrapper\n \n old_class = type(old_class_name, (new_class,), {})\n old_class.__module__ = old_module_name\n old_class.__init__ = decorator(old_class.__init__)\n return old_class\n \n```\n\n<https://opendev.org/openstack/debtcollector/src/branch/master/debtcollector/moves.py#L164>\n引用\n\n# 環境\n\n * Python3.8", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T15:04:52.973", "favorite_count": 0, "id": "77839", "last_activity_date": "2021-06-28T21:27:33.317", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "19524", "post_type": "question", "score": 3, "tags": [ "python" ], "title": "ライブラリで公開している列挙型クラスの名前を変更したいです。変更前と変更後の", "view_count": 116 }
[ { "body": "`Enum` インスタンスの内容を参照する場合は `__getattribute__()` メソッドをラップします。\n\n```\n\n from my_color import OldColor, NewColor\n \n warning_message = \"`OldColor' has moved to `NewColor'\"\n def deprecation_warning():\n import warnings\n warnings.warn(\n warning_message, DeprecationWarning, stacklevel=4)\n return True\n \n OldColor.__getattribute__ = (\n lambda cls, name:\n deprecation_warning() and\n super(type(cls), cls).__getattribute__(name)\n )\n \n OldColor.__doc__ += f'\\nWarning: {warning_message}.'\n \n if __name__ == '__main__':\n print(OldColor.RED)\n print(OldColor['RED'])\n print(OldColor(1))\n \n print('\\ndocstring:')\n print(OldColor.__doc__)\n \n```\n\n#### 実行結果\n\n```\n\n deprecated_color.py:19: DeprecationWarning: `OldColor' has moved to `NewColor'\n print(OldColor.RED)\n OldColor.RED\n deprecated_color.py:20: DeprecationWarning: `OldColor' has moved to `NewColor'\n print(OldColor['RED'])\n OldColor.RED\n deprecated_color.py:21: DeprecationWarning: `OldColor' has moved to `NewColor'\n print(OldColor(1))\n OldColor.RED\n \n docstring:\n 色\n Warning: `OldColor' has moved to `NewColor'.\n \n```", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-28T20:08:29.730", "id": "77840", "last_activity_date": "2021-06-28T21:27:33.317", "last_edit_date": "2021-06-28T21:27:33.317", "last_editor_user_id": null, "owner_user_id": null, "parent_id": "77839", "post_type": "answer", "score": 2 } ]
77839
77840
77840
{ "accepted_answer_id": null, "answer_count": 2, "body": "Latexを使って「有理数、無理数は実数に含まれる」という形を波括弧を使って表したいと考えています。\n\nつまり以下のアスキーアートを画像のような形で表したいのですが、都合よく左大波括弧だけを出力する方法がわからず悩んでいます。\n\n```\n\n   / 有理数\n 実数 -|\n   \\ 無理数 \n \n```\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/0NGI6.png)](https://i.stack.imgur.com/0NGI6.png)\n\n### 試してみたこと\n\n[【LaTeX】括弧類のかき方一覧と大きさの変更方法まとめ](https://mathlandscape.com/latex-bracket/) を参考に\n\n```\n\n 実数\\biggm {\n 有理数\\\\\n 無理数\\\\\n \n```\n\nと感覚で試してみましたが効果なしで、同じ試みをしているページも見つからず、途方に暮れています。\n\nまとめると\n\n * 有理数、無理数のような2項が1つの集合に含まれるという意味で波括弧を使いたい\n\nお時間をいただき感謝します。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T05:18:05.253", "favorite_count": 0, "id": "77846", "last_activity_date": "2021-08-01T11:48:51.647", "last_edit_date": "2021-06-29T05:57:17.393", "last_editor_user_id": "3060", "owner_user_id": "47014", "post_type": "question", "score": 0, "tags": [ "latex", "数学" ], "title": "Latexで\"含まれる\"を表す波括弧を表現するには?", "view_count": 236 }
[ { "body": "以下ページの一覧にある「{ による場合わけ表示」が当てはまりそうです。\n\n[http://www1.kiy.jp/~yoka/LaTeX/latex.html](http://www1.kiy.jp/%7Eyoka/LaTeX/latex.html)\n\n> 記述例:\n```\n\n> \\begin{equation}\n> f(x)= \\left \\{\n> \\begin{array}{l}\n> 1 (x=1のとき) \\\\\n> 0 (x≠1のとき)\n> \\end{array}\n> \\right.\n> \\end{equation}\n> \n```\n\n>\n> 表示例: \n>\n> [![画像の説明をここに入力](https://i.stack.imgur.com/pLn4d.png)](https://i.stack.imgur.com/pLn4d.png)", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T05:52:48.033", "id": "77848", "last_activity_date": "2021-06-29T05:52:48.033", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77846", "post_type": "answer", "score": 2 }, { "body": "一番簡単なのは、`amsmath`パッケージの`cases`環境を使うことだと思われます。\n\n```\n\n \\documentclass{article}\n \n \\usepackage{amsmath}\n \n \\begin{document}\n \n \\begin{equation}\n f(x) =\n \\begin{cases}\n x & \\text{if $x \\ge 0$}, \\\\\n - x & \\text{if $x < 0 $}.\n \\end{cases}\n \\end{equation}\n \n \\end{document}\n \n```\n\n[![Example](https://i.stack.imgur.com/vCNMA.png)](https://i.stack.imgur.com/vCNMA.png)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-08-01T11:48:51.647", "id": "80519", "last_activity_date": "2021-08-01T11:48:51.647", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "36010", "parent_id": "77846", "post_type": "answer", "score": 2 } ]
77846
null
77848
{ "accepted_answer_id": null, "answer_count": 2, "body": "Arduinoを使った可視光通信の実装をしているのですが、調歩同期式通信においてデータのビット幅を100msecから70msec等に狭めていくと、正しく受信することができません。 \nこの理由を知りたいです。\n\nここで、ストップビットから次のデータのスタートビットまで(データの送信間隔)は1000msecに設定しています。\n\n追記: \nご指摘があったのでより詳細な状況を説明します。 \n送信者はスタートビットから100msecで次々にビットを送り、受信者はスタートビットを確認すると、100msecで信号を読み取るとるようにしており、 \nそのビット間隔100msecを70msec等に狭めていくと、データが抜け落ちたりと正しく受信することができないということです。\n(すなわち、送信者においてビット間の送信間隔を狭め、受信者においてもビットの検出間隔を同じだけ狭めるという意味合いです。)\n\nまた、この可視光通信の実装は、自然光の全くない暗室で行っています。\n\n具体的なスケッチを簡単に述べると、送信側が送った可視光の明滅に対して、受信側においては可視光の強度をセンサによって数値化したものを、analogRead()で読み取り、その値が閾値を超えていれば\"1\"とし超えていなければ\"0\"としています。また、スタートビットを受信すると、データの読み取りをはじめ、データの読み取りごとにdelay(ビット間隔時間)を複数回行うことによって、ビット列を受信するようにしています。", "comment_count": 10, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T05:52:44.477", "favorite_count": 0, "id": "77847", "last_activity_date": "2021-06-30T02:07:18.060", "last_edit_date": "2021-06-29T10:24:58.110", "last_editor_user_id": null, "owner_user_id": null, "post_type": "question", "score": 0, "tags": [ "arduino", "シリアル通信" ], "title": "Arduinoにおける可視光による調歩同期式通信のデータビット幅", "view_count": 226 }
[ { "body": "まずはオシロスコープを用意して、受信側の波形がどうなっているのか、というのを確認しましょう。 \n可視光を使っている、といってますが、送信側はどういう発光体を使って、受信側はどういうセンサを使っているのか全く記述がないところを見ると、ハードウエアについては全く頓着してなさそうに思えます。\n\n当てずっぽで、推測で物事をすすめるのではなく、確実な観測事実を積み重ねていきましょう。 \nそうでないと、なにかわからないけど、だめでした、という結果にしかなりませんよ。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T13:59:25.393", "id": "77860", "last_activity_date": "2021-06-29T13:59:25.393", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "27481", "parent_id": "77847", "post_type": "answer", "score": 0 }, { "body": "送信側つまり発光側の光波形と、受信側つまり受光素子自体 (フォトトランジスタとか CdS とか)\nと復調装置の回路設計によっては、発光側で与えた波形と受光側で得られた波形の信号形状が違う(単に変形しているレベルではなくて全く似ても似つかないものになる)なんてのはごく普通にあります。なので\n100msec = 10bit/sec で送受信できているシステムであっても実はハードウエア的・ソフトウエア的に余裕が全くなくて速度アップ 70msec =\n14bit/sec を図ると破綻するなんてのはおかしな事態であるとは思いません。\n\n> 理由を知りたい\n\n実に様々な個所に様々な原因がありえて、現状の質問文では推測すらできないです。\n\nというわけで現状の質問文からは「推定不能」としか答えられません。なのでエビデンス(証拠)を集めてください。設計者の意図と異なる動きをしている個所がわからないと直しようが無いです。\n\n * 送信プログラム的にはこんな駆動波形を出しているつもり⇒本当にそうなっている証拠が必要\n * 送信素子からこんな光が発しているはず⇒本当に以下略\n * 受光素子からこんな信号が出ているはず\n * マイコンの入力にこんな信号が来ているはず\n\nそのためにはオシロスコープとかアナライザとか測定装置が必要ですし、使う側にも知識と経験が必要になるでしょう。\n\nハードウエア側は触れないということなら、現状の回路でどこまでできるかとか、現ソフトは現回路の挙動を理解して最適仕様なものを作れているかなどなど、検討できることはいくつもあるでしょう。でもいかんせん今の質問内容だと情報量が足らないです。\n\n質問内の情報量を増せば答えられるかというと、そうとも限らなくて仕事の丸投げになりかねないです。範囲の広すぎる質問は SO\nではクローズ対象になってしまいます。質問範囲を絞って1問1答が可能な範囲を探ってみてください。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T02:07:18.060", "id": "77872", "last_activity_date": "2021-06-30T02:07:18.060", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8589", "parent_id": "77847", "post_type": "answer", "score": 0 } ]
77847
null
77860
{ "accepted_answer_id": null, "answer_count": 2, "body": "Word文書内の複数の文字列をイタリックに変換する方法を探しております。 \n例えばword文書内に\n\n```\n\n 文字列1\n 文字列2\n 文字列1\n 文字列3\n ・\n ・\n ・\n \n```\n\nとある場合に、\"文字列1\"のみであれば、以下のWordVBAのコードで変換できるのですが、複数単語(\"文字列2\",\"文字列3\"のように)でもイタリックに変換できるようなコードを書きたいと思っております。 \n方法をお教えいただけますと幸いです。 \n何卒よろしくお願い申し上げます。\n\n```\n\n Sub findText()\n \n With Selection.Find\n .Text = \"文字列1\"\n Do While .Execute\n Selection.Font.Italic = True\n Loop\n End With\n \n End Sub\n \n```", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T06:54:15.047", "favorite_count": 0, "id": "77849", "last_activity_date": "2021-06-30T07:43:13.747", "last_edit_date": "2021-06-29T07:01:46.540", "last_editor_user_id": "2238", "owner_user_id": "47088", "post_type": "question", "score": 1, "tags": [ "vba", "ms-word" ], "title": "Word文書内の複数の文字列をイタリックに変換する方法", "view_count": 363 }
[ { "body": "cubik♦さま、kunifさま、コメント頂きありがとうございました。 \nVBAは初めてで完全に横着して質問をしてしまったのですが、少し勉強して以下のように解決することができました。\n\n斜体にしたい文字列のレコードをcsvで作成し、VBA上でcsvファイルの参照・一致を確認・イタリックに置換の3ステップを経ました。\n\nなお、list.csvの中身は、1列目に\"文字列1\"、\"文字列2\"、\"文字列3\"を記載したものとなっております。もう少しやり方があるのかもしれませんが、目的は一旦達成しました。\n\n```\n\n Sub 斜体変換()\n \n '参照元のcsvファイルを開く\n Open \"list.csv\" For Input As #1\n While Not EOF(1)\n Line Input #1, a\n s = Split(a, \",\")\n MsgBox s(0) & \" \" & s(0)\n 'イタリックに変換したい変数Targetの宣言\n Dim Target As String\n \n '文書の先頭を選択\n ActiveDocument.Range(0, 0).Select\n \n 'Targetにcsvファイルの1列目を指定\n Target = s(0)\n \n '条件クリア\n Selection.Find.ClearFormatting\n Selection.Find.Replacement.ClearFormatting\n \n '斜体設定\n Selection.Find.Replacement.Font.Italic = True\n \n '斜体変換を実行\n With Selection.Find\n .Text = Target\n .Replacement.Text = \"\"\n .Forward = True\n .Wrap = wdFindStop\n .MatchCase = True\n .Execute Replace:=wdReplaceAll\n End With\n Selection.Find.Execute Replace:=wdReplaceAll\n Wend\n Close #1\n End Sub\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T06:52:34.940", "id": "77876", "last_activity_date": "2021-06-30T07:33:32.133", "last_edit_date": "2021-06-30T07:33:32.133", "last_editor_user_id": "3060", "owner_user_id": "47088", "parent_id": "77849", "post_type": "answer", "score": 2 }, { "body": "下記のサンプルコードでも実現できます。\n\n配列に対してループする`findArray`関数と、正規表現マッチに対してループする`findRegexp`です。 \nどちらもカーソルで選択中の範囲内の指定文字列を斜体に変更します。\n\n考え方自体はコメントの通りなのですが、単純にループすることで実現できるかと思いきや案外つまづくポイントがありました。 \nポイントはサンプルコードのコメントに記載しました。\n\n**サンプルコード**\n\n```\n\n '多重ループ\n Sub findArray()\n '検索対象の定義\n Dim words(3) As String\n words(0) = \"文字列1\" \n words(1) = \"文字列2\" \n words(2) = \"文字列3\" \n \n Dim selRange As Range\n For Each w In words\n Set selRange = Selection.Range.Duplicate 'ループ開始時に選択範囲をDuplicateしておく ※しておかないと選択範囲がクリアされて\"文字列2\"以降が選択できない\n selRange.Find.Text = w\n Do While selRange.Find.Execute\n If selRange.InRange(Selection.Range) Then '選択範囲の終端より前のみ対象とする ※このIf文がないとカーソル選択範囲の後ろまで処理を継続する\n selRange.Italic = True\n End If\n Loop\n Next\n End Sub\n \n '正規表現\n Sub findRegexp()\n '事前バインディング: Microsoft VBScript Regular Expressions\n 'Dim re As New RegExp\n '遅延バインディング\n Dim re As Object\n Set re = CreateObject(\"VBScript.RegExp\")\n \n re.Pattern = \"文字列1|文字列2|文字列3\" \n re.Global = True 'マッチ対象をすべて取得 ※しないと1文字しか対象にできない\n \n Dim start As Integer\n For Each m In re.Execute(Selection)\n start = Selection.start + m.FirstIndex '選択開始位置 + 選択範囲内でヒットした相対位置\n Range(start, start + m.Length).Italic = True\n Next\n End Sub\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T07:43:13.747", "id": "77879", "last_activity_date": "2021-06-30T07:43:13.747", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9820", "parent_id": "77849", "post_type": "answer", "score": 1 } ]
77849
null
77876
{ "accepted_answer_id": null, "answer_count": 0, "body": "ある Linux 環境では日本語が表示できておらず、調べたところ環境変数の LANG の指定が必要という情報を見つけました。 \n`C.UTF-8` を `ja_JP.UTF-8` にしたところ、日本語は表示できたのですが、この設定をすることで `ls -l` の日付部分や\n`date` コマンドの出力まで日本語になってしまいます。 \nこれまで問題なく使えていた環境の設定を確認すると、 `C.UTF-8` なのに日本語が表示できています。 \nコマンドの出力は英語のままとして、日本語を表示するにはどうすればよいでしょうか?\n\n環境変数を設定していない状態で、日本語が表示される環境とされない環境の `locale` コマンドの結果はどちらも以下のとおりでした。\n\n```\n\n LANG=C.UTF-8\n LC_CTYPE=\"C.UTF-8\"\n LC_NUMERIC=\"C.UTF-8\"\n LC_TIME=\"C.UTF-8\"\n LC_COLLATE=\"C.UTF-8\"\n LC_MONETARY=\"C.UTF-8\"\n LC_MESSAGES=\"C.UTF-8\"\n LC_PAPER=\"C.UTF-8\"\n LC_NAME=\"C.UTF-8\"\n LC_ADDRESS=\"C.UTF-8\"\n LC_TELEPHONE=\"C.UTF-8\"\n LC_MEASUREMENT=\"C.UTF-8\"\n LC_IDENTIFICATION=\"C.UTF-8\"\n LC_ALL=\n \n```\n\n環境によっては `LANGUAGE=` の行があるものもありました。\n\nまた、 `localectl status` で得られる System Locale はどちらも `ja_JP.utf8` でした。\n\n一応接続方法についてですが、すべて同じクライアントから ssh で接続しています。", "comment_count": 5, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T09:24:07.843", "favorite_count": 0, "id": "77851", "last_activity_date": "2021-06-29T12:50:42.200", "last_edit_date": "2021-06-29T12:50:42.200", "last_editor_user_id": "47090", "owner_user_id": "47090", "post_type": "question", "score": 0, "tags": [ "linux", "日本語" ], "title": "LANG 環境変数と日本語表示について", "view_count": 1554 }
[]
77851
null
null
{ "accepted_answer_id": null, "answer_count": 1, "body": "以下のコードで突然ValueError: Length\nmismatchが出てきて、対処の方法が分かりません。同じ証券コードを繰り返し取得したからかと思ったのですがそうではなく、昨日までは問題なく動作していたためどこを改善してよいかも不明です。 \n解決策を教えていただけますでしょうか。\n\n```\n\n %matplotlib inline\n import pandas as pd\n import matplotlib.pyplot as plt\n import seaborn as sns\n from pandas_datareader.stooq import StooqDailyReader\n from datetime import datetime\n import numpy as np\n import sys\n import matplotlib.dates as mdate\n \n \n a=[0]\n codes=[1301,1332,1333,1352]\n \n codes = sorted(codes)\n start = datetime(2021, 4, 1)\n end = datetime(2021, 6, 22)\n \n dfc = (\n StooqDailyReader([f'{n}.JP' for n in codes], start, end).read()\n .Close.iloc[::-1].reset_index(drop=True)\n .set_axis([codes]*len(a), axis=1)\n )\n \n print(dfc)\n \n print(dfc.corr())\n plt.figure(figsize=(20,20))\n sns.heatmap(dfc.corr(),annot=True, vmax =1,vmin=-1,cmap ='coolwarm',center =0)\n \n```\n\n以下エラー内容\n\n```\n\n ValueError Traceback (most recent call last)\n <ipython-input-33-4bb2b2d041c0> in <module>()\n 20 StooqDailyReader([f'{n}.JP' for n in codes], start, end).read()\n 21 .Close.iloc[::-1].reset_index(drop=True)\n ---> 22 .set_axis([codes]*len(a), axis=1)\n 23 )\n 24 \n \n 6 frames\n pandas/_libs/properties.pyx in pandas._libs.properties.AxisProperty.__set__()\n \n /usr/local/lib/python3.7/dist-packages/pandas/core/internals/managers.py in set_axis(self, axis, new_labels)\n 225 if new_len != old_len:\n 226 raise ValueError(\n --> 227 f\"Length mismatch: Expected axis has {old_len} elements, new \"\n 228 f\"values have {new_len} elements\"\n 229 )\n \n ValueError: Length mismatch: Expected axis has 2 elements, new values have 3 elements\n \n```\n\nよろしくお願いいたします。", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T09:29:43.390", "favorite_count": 0, "id": "77852", "last_activity_date": "2022-07-21T00:04:45.617", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47011", "post_type": "question", "score": 0, "tags": [ "python", "pandas", "numpy", "matplotlib" ], "title": "Python でのValueError: Length mismatchへの対処が分かりません。", "view_count": 3906 }
[ { "body": "> 証券コードに重複がある場合(例えば `codes=[1301,1301,1333,1352]`\n> など)、同じ証券コードのデータは一度だけしか取得しませんのでデータフレームの列数が少なくなります。\n\n> 考えられる状況として、存在しない証券コードが `codes` に含まれているのかもしれません。例えば `codes = [1301, 1302,\n> 1332]` として実行すると同様のエラーが発生します(`1302.JP` は存在しません)。\n\n証券コードに重複があったり、存在しない証券コードを指定している場合を考慮して書き直してみました。\n\n```\n\n import pandas as pd\n import re\n from pandas_datareader.stooq import StooqDailyReader\n from datetime import datetime\n \n codes = [1301, 1332, 1333]\n ## codes = [1301, 1301, 1332, 1333] # 重複\n ## codes = [1301, 1302, 1332, 1333] # 欠番\n \n codes = sorted(codes)\n start = datetime(2021, 6, 1)\n end = datetime(2021, 6, 22)\n \n dfc = (\n StooqDailyReader([f'{n}.JP' for n in codes], start, end).read()\n .Close.astype(int).sort_index()\n .rename_axis(index=None, columns=None)\n .rename(columns=lambda c: re.sub(r'\\.JP$', '', c))\n )\n \n```\n\n#### 実行結果\n\n * 重複\n\n```\n\n # 1301.JP が重複\n codes = [1301, 1301, 1332, 1333]\n \n print(dfc.head())\n \n 1301 1332 1333\n 2021-06-01 2974 514 2435\n 2021-06-02 2918 516 2435\n 2021-06-03 2936 534 2465\n 2021-06-04 2935 540 2455\n 2021-06-07 2942 548 2448\n \n```\n\n * 欠番\n\n```\n\n # 1302.JP は存在しない\n codes = [1301, 1302, 1332, 1333]\n \n print(dfc.head())\n \n 1301 1332 1333\n 2021-06-01 2974 514 2435\n 2021-06-02 2918 516 2435\n 2021-06-03 2936 534 2465\n 2021-06-04 2935 540 2455\n 2021-06-07 2942 548 2448\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T18:15:55.047", "id": "77865", "last_activity_date": "2021-06-29T18:15:55.047", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": null, "parent_id": "77852", "post_type": "answer", "score": 1 } ]
77852
null
77865
{ "accepted_answer_id": null, "answer_count": 1, "body": "Ubuntu 20.04 + Python3 にて、 pip を導入する方法の違いが理解できず、困っております。\n\nUbuntu上で pip を導入する場合には、apt を利用する or get-pip.py を利用するの、どちらが良いでしょうか?\n\n最終的には、Rundeck の WinRM Node Executor を利用したく pywinrm の導入を行おうとしていました。\n\n## apt を利用\n\nインストールコマンド :\n\n * `sudo apt install python3-pip`\n * インストール先 : /usr/bin/pip3\n\nパッケージ導入先:\n\n * `apt` で入れたもの: \n * /usr/lib/python3/dist-packages/\n * `sudo pip3 install` で入れたもの: \n * /usr/local/lib/python3.8/dist-packages\n * `pip3 install` で入れたもの: \n * /home/username/.local/lib/python3.8/site-packages\n\n上記のように設定したところ、コンソールで python CLI を使う場合、いずれの方法でいれたパッケージも利用できました。\n\nしかし Rundeck の WinRM Node Executor からは apt でいれた pywinrm (python3-winrm)\n以外は、利用が出来ませんでした。\n\n3番目の .local 配下はともかく /usr/local/lib/ 配下のパッケージも利用出来ないのが何故かが、わかりません。\n\nUbuntuで pip を使うときには、apt を使わず、次の get-pip.py を使った導入を行うのが良いのでしょうか?公式に\nUbuntuが管理しているのであれば、そちらから試すべきと思って各種試したのですが、納得の行く情報がつかめず。\n\nお知恵を拝借できれば幸いです。\n\n## get-pip.py を利用(案)\n\nインストールコマンド :\n\n * `curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py`\n * `python3 get-pip.py`\n\n参考 : <https://pip.pypa.io/en/stable/installing/>", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T10:01:10.537", "favorite_count": 0, "id": "77853", "last_activity_date": "2021-06-29T11:31:03.353", "last_edit_date": "2021-06-29T11:31:03.353", "last_editor_user_id": "3060", "owner_user_id": "15301", "post_type": "question", "score": 1, "tags": [ "python3", "ubuntu", "pip" ], "title": "Ubuntu への pip の導入は、どの選択が良いでしょうか? apt or get-pip.py", "view_count": 1806 }
[ { "body": "参照している [インストールガイド](https://pip.pypa.io/en/stable/installing) の冒頭で、Unix (Linux)\nの場合には以下のような注意書きがあります。\n\n> **Warning**\n>\n> If you installed Python from a package manager on Linux, you should always\n> install pip for that Python installation using the same source.\n\n利用している Python が OS のパッケージマネージャーを通してインストールしたものであれば、pip も同じ提供元\n(=パッケージマネージャー、今回の例なら `apt`) を通じてインストールしてください。\n\n* * *\n\n\"get-pip.py\" でのインストールは、ディストリビューションのパッケージマネージャーに pip が存在しない、もしくはソースコード等から独自に\nPython をインストールした場合などに利用すればよいのだと思います。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T11:09:37.093", "id": "77855", "last_activity_date": "2021-06-29T11:09:37.093", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77853", "post_type": "answer", "score": 1 } ]
77853
null
77855
{ "accepted_answer_id": "77870", "answer_count": 2, "body": "プログラミングと直接は関係ないのですが\n\nサーバー会社のストレージはどうなっているのでしょう?\n\n100GBで契約してその後200GBにアップグレードするとアップグレードされますが\n\nサーバーの容量は決まっているはずです\n\nアップグレードするかどうかわからないユーザーのためにサーバーの大半を空けておくわけにはいかないとおもいます\n\nとなるとやはりゲートウェイで管理操作しているのでしょうか?", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T11:07:34.393", "favorite_count": 0, "id": "77854", "last_activity_date": "2021-07-02T06:12:49.780", "last_edit_date": "2021-07-02T06:12:49.780", "last_editor_user_id": "3060", "owner_user_id": "39481", "post_type": "question", "score": 3, "tags": [ "filesystems" ], "title": "レンタルサーバー等のストレージ (ディスク容量) はどのように管理されている?", "view_count": 201 }
[ { "body": "この手のサーバ業者は事前に見込まれる顧客数と、各顧客がどの程度容量を使うかの予測等から、十分な容量の物理記憶装置を用意しているはず。更には物理装置の一部が故障しても顧客のデータが失われないようにバックアップなり\nRAID 構成なりを維持しなきゃならないので、業者の規模によりけりだけど普通にペタの単位の記憶容量は用意しているものと推定されます。そのうちのどのくらいが\nSSD\n等高速ランダムアクセス可能な装置で、どのくらいが真にバックアップなテープ等のシーケンシャルアクセスな装置かは、その業者の経営ノウハウでもあり外部からは推測すらできないでしょう。\n\nそんな超巨大記憶装置を、顧客1契約につき1つの物理装置があるようにみせかける仮想化によって分割して貸し出しているわけです。契約変更したら仮想化ドライバの設定値を変更するだけで\n100G → 200G の容量変更とか自由自在。\n\n> サーバーの大半を空けておくわけにはいかない\n\n世代バックアップまで考えると、顧客に貸し出している記憶容量の数倍の記憶装置をレンタル業者は保有しているので、そういう意味で「大半は空いている」んだと思いますよ。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T01:05:07.390", "id": "77870", "last_activity_date": "2021-06-30T01:05:07.390", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8589", "parent_id": "77854", "post_type": "answer", "score": 4 }, { "body": "> サーバーの容量は決まっているはずです\n\nこれが実際には異なっていて、「サーバの容量」は割と自由です。\n\n一般的には、「ストレージ装置」を複数台のサーバで共用している構成になっています。ユーザーからの見え方は大雑把には二通りあって\n\n * いわゆる「共有フォルダ」みたいなイメージ\n * ストレージ装置の中に「論理的なHDD」が存在していてサーバはそれに接続している\n\n前者の場合は「ユーザーの契約容量=フォルダごとの容量制限」なので、その制限を書き換えれば容量は変更できます。\n\n後者の場合は「ユーザーの契約容量=論理的なHDDのサイズ」で、これはストレージ装置の機能で変更できます。\n\nこれは仮想化以前の時代から使われている技術で、ストレージ装置の基本的な機能です。\n\n今時の仮想化技術を使ったレンタルサーバ(VPS)では間に仮想化のレイヤが入るので少し複雑になります。物理サーバの中の仮想マシンごとにストレージ装置の「論理的なHDD」に接続する場合は仮想化なしの時と同じです。もう一つ、物理サーバごとに「論理的なHDD」に接続して、その中に仮想マシンごとの「仮想HDD」を作る場合もあります。この場合、HDDの容量の変更は仮想基盤の機能で仮想HDDをリサイズすることになります。といっても、仮想HDDは単なるファイルなので、単純にはファイルのリサイズをやっているだけです。\n\n> アップグレードするかどうかわからないユーザーのためにサーバーの大半を空けておくわけにはいかないとおもいます\n\nストレージ装置は一般的にはあとからディスクを増設して容量を増やすことができるのでそうはならない、といいたいところですが、無尽蔵に増やせるわけではないですし、様々な理由で増設は最初から選択肢とならない場合もあります。\n\nところで、ストレージ装置につなげるサーバの台数にも限りがあるので、普通は「1台のストレージ装置に複数のサーバ」のグループを需要によって増やしていくような形になります。\n\nどんどん契約が増えていく前提であれば、複数のグループにバランスを見ながらユーザーを割り振っていくことで、\n\n * 途中で「アップグレード」するユーザーが予想より多ければ単にそのグループに割り当てられるユーザーが減る\n * 逆に予想より少なければ、後からそのグループに追加でユーザーを割り当てる\n\nとすれば使用量は割とコントロールできることになります。少なくとも、10GB~1TBまでプランがあるので、全員が1TBにアップグレードする前提でディスクを用意しておく、などということはどこもしていません。\n\n* * *\n\nAWSのようなクラウドサービスの場合はまた考え方が違って、見かけ上は「無限の容量を持ち無限のサーバを接続できるストレージ装置」があります。実際にはプロバイダが複数のストレージ装置をよしなに運用することで実現しているわけですが、「よしなに運用する」コストがかかるので、その分割高です。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T12:33:28.620", "id": "77884", "last_activity_date": "2021-07-02T06:10:00.447", "last_edit_date": "2021-07-02T06:10:00.447", "last_editor_user_id": "5793", "owner_user_id": "5793", "parent_id": "77854", "post_type": "answer", "score": 2 } ]
77854
77870
77870
{ "accepted_answer_id": null, "answer_count": 1, "body": "直線が、x軸又はy軸に平行の時、場合分けの対応が必要ですか?何ケースに分ければいいですか? \nよろしくお願いします。 \n以下のエラーが、 例7ででます。 \nUnboundLocalError: local variable 'a' referenced before assignment\n\n(オリジナルポスト)2本の線分が交差しているか調べる \n<https://qiita.com/tydesign/items/405f1345a437b03b6403> \n(参考)「2本の線分が交差しているか調べる」を参考にpycharmでやってみた。> sympyのintersection(entity1, entity2) \n<https://qiita.com/mrrclb48z/items/c1fe2d1f3e7cd12d07cd>\n\n```\n\n from sympy import *\n var('Ax Ay Bx By Cx Cy Dx Dy Kx Ky')\n var('a b c d e f')\n var('x y')\n def myKoutenLine(lineSeg):\n (myAx, myAy), (myBx, myBy), (myCx, myCy), (myDx, myDy) = lineSeg\n if (myAx != myBx and myCx != myDx):\n a=1.0\n d=1.0\n ans = solve([a * Ax + b * Ay + c, \\\n a * Bx + b * By + c, \\\n d * Cx + e * Cy + f, \\\n d * Dx + e * Dy + f, \\\n a * Kx + b * Ky + c, \\\n d * Kx + e * Ky + f], \\\n [Kx, Ky,b, c, e, f])\n myKx = ans[0][0].subs({Ax: myAx, Ay: myAy, Bx: myBx, By: myBy, Cx: myCx, Cy: myCy, Dx: myDx, Dy: myDy})\n myKy = ans[0][1].subs({Ax: myAx, Ay: myAy, Bx: myBx, By: myBy, Cx: myCx, Cy: myCy, Dx: myDx, Dy: myDy})\n return myKx,myKx\n # 例1\n lineSeg=((2,3),(11,12),(10, 5),(3,11))\n print('# 例1 ',lineSeg,'->',myKoutenLine(lineSeg))\n # 例7(追加)\n lineSeg=((-10,0),(10,0),(0,-10),( 0,10))\n print('# 例7(追加) ',lineSeg,'->',myKoutenLine(lineSeg))\n \n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T12:05:56.870", "favorite_count": 0, "id": "77856", "last_activity_date": "2021-07-22T10:49:44.717", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "17199", "post_type": "question", "score": -1, "tags": [ "python", "アルゴリズム", "sympy" ], "title": "2本の直線の交点計算をsolveでやってみたい。", "view_count": 721 }
[ { "body": "※ [ヘルプセンター] [よくある質問] に次のように記されています \nどんな質問を聞けば良いですか? \nプログラミングに関する質問はもちろん何でも大歓迎です!ただし以下のことに気をつけてください。\n\n * 内容が具体的で詳細であること\n * 質問内容をわかりやすく説明すること\n * 誰か一人でも世の中の他のプログラマーに役に立つような内容であること\n\n何を行おうとしているのか, など分かりづらかったために \nこちらで適当に補足してみました\n\n* * *\n\n* * *\n\n#### 概要\n\n記事:\n「[2本の線分が交差しているか調べる](https://qiita.com/tydesign/items/405f1345a437b03b6403)」によると\n\n * AutoLISP を用い, 交差判定の方法に「[3点の回転方向を調べる](https://qiita.com/tydesign/items/d41ac74b5effd87141b8)」を利用している\n\nこれを, \nPythonで(同様に?) 2本の線分が交差しているか調べるために,\n数式処理ライブラリー『[SymPy](https://www.sympy.org/)』を利用する\n\n 1. intersection メソッドによる, 交差判定\n 2. 線分ではなく直線の交点を求め, (なんやかやして)判定する\n\n* * *\n\n#### どんな場合分けが必要か? (質問から)\n\n(1) に関して, intersection メソッド呼び出すだけなので, コーディングミスしてないか確認は必要だけど,\n交差判定の方法を実装するわけではなく, 必要ないでしょう\n\n(2) では, 線分ではなく直線を用いるので, 交点が線分に含まれているかどうか … 実装によるのでは?\n\n* * *\n\n#### intersection メソッドを利用するコード\n\nQiita 記事のコードを簡素化してみました \n(質問には現れないが, 以下の処理で一部利用するので)\n\n```\n\n from sympy import Segment\n \n def myKousaHantei(p1, p2, p3, p4):\n seg_p12 = Segment(p1, p2)\n seg_p34 = Segment(p3, p4)\n pt_i = seg_p12.intersection(seg_p34)\n if pt_i:\n return pt_i[0] # 曲線ではないので, 交点は最大でも 1つ\n \n p1,p2,p3,p4 = ((2,3), (11,12), (10, 5), (3,11))\n myKousaHantei(p1,p2,p3,p4)\n \n```\n\n[![実行結果](https://i.stack.imgur.com/YZBfU.png)](https://i.stack.imgur.com/YZBfU.png)\n\n#### 直線の交点を求めるコード\n\nSymPy には `Segment` (線分)の他に `Line` (直線)もあり \n指定の 2点を通る, もしくは 1点と角度を指定することで得られる\n\n```\n\n from sympy import Line, solve, symbols\n from sympy.plotting import plot\n \n p1,p2,p3,p4 = ((2,3), (11,12), (10, 5), (3,11))\n ln_p12 = Line(p1, p2)\n ln_p34 = Line(p3, p4)\n \n expr_a = ln_p12.equation()\n display(expr_a)\n expr_b = ln_p34.equation()\n display(expr_b)\n print(f'交点座標: {solve([expr_a, expr_b])}')\n \n x,y = symbols('x y')\n plot(solve(ln_p12.equation(x, y), y)[0], solve(ln_p34.equation(x, y), y)[0])\n \n```\n\n[![実行結果&グラフ](https://i.stack.imgur.com/kanNx.png)](https://i.stack.imgur.com/kanNx.png) \n直線からそれぞれ方程式を得ることができ\n\n * `-9*x + 9*y - 9 = 0`\n * `-6*x - 7*y + 95 = 0`\n\n交点の座標は `{x: 88/13, y: 101/13}` と分かる\n\n* * *\n\n質問のエラー発生部分については\n\n * グローバル変数なのにローカル変数として変更しようとした\n * SymPy の Symbol として定義してるにも拘らず, 数値を代入している\n\nなどの問題があり, 直接のエラー原因は前者だけど何を行いたいか今ひとつ分かりづらいところ", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-21T09:46:49.377", "id": "78342", "last_activity_date": "2021-07-22T10:49:44.717", "last_edit_date": "2021-07-22T10:49:44.717", "last_editor_user_id": "43025", "owner_user_id": "43025", "parent_id": "77856", "post_type": "answer", "score": 1 } ]
77856
null
78342
{ "accepted_answer_id": null, "answer_count": 0, "body": "実際に変更してみて(あるいはコピーの作成を試みるなどして)try/exceptするのではなく \nst_file_attributesで属性確認 等、何らかの値を取得して判定することはできるでしょうか?", "comment_count": 6, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T12:49:30.150", "favorite_count": 0, "id": "77858", "last_activity_date": "2021-06-29T12:49:30.150", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47094", "post_type": "question", "score": 0, "tags": [ "python", "windows", "windows-10" ], "title": "pythonを使って、Windows10上の「名前の変更ができないファイル/フォルダ」の判定はできますか?", "view_count": 102 }
[]
77858
null
null
{ "accepted_answer_id": null, "answer_count": 1, "body": "`re.sub()` の中でマッチした文字列を置換先の文字列として使用したい場合、どのように書けばよいでしょうか。\n\nドキュメントに書いてある方法に従っていますが、うまく出力されません。\n\n### 現状のコード\n\n```\n\n import re\n \n if __name__ == '__main__':\n tmp = re.sub('(a|b)', '\\1\\n', 'aiueobcd')\n print(tmp)\n \n```\n\n### 期待する出力\n\n```\n\n a\n iueob\n cd\n \n```\n\n### 実際の出力\n\n[![出力結果](https://i.stack.imgur.com/M3C1M.png)](https://i.stack.imgur.com/M3C1M.png)\n\n### 参考にしたサイト\n\n[re --- 正規表現操作 — Python 3.9.4\nドキュメント](https://docs.python.org/ja/3/library/re.html) \n[Python | 正規表現にマッチした文字列を新しい文字列に置換する(Pattern.sub,\nPattern.subn)](https://www.javadrive.jp/python/regex/index10.html)\n\n### 環境\n\n```\n\n ❯ python --version \n Python 3.9.5\n \n```\n\nよろしくお願いします。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T14:03:17.800", "favorite_count": 0, "id": "77861", "last_activity_date": "2023-02-13T08:08:36.023", "last_edit_date": "2021-06-29T17:53:35.857", "last_editor_user_id": "44648", "owner_user_id": "44648", "post_type": "question", "score": 0, "tags": [ "python", "正規表現" ], "title": "Python re.sub() の正規表現内でグループと`|`を使用した際、 置換させる文字列内でマッチした文字列を使用したい", "view_count": 600 }
[ { "body": "metropolis さんのコメントの Raw 文字列の使用をお勧めしますが、Raw 文字列を使用しない場合は\n\n```\n\n #tmp = re.sub('(a|b)', '\\1\\n', 'aiueobcd')\n tmp = re.sub('(a|b)', '\\\\1\\n', 'aiueobcd')\n \n```\n\nとしてください。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T15:56:05.897", "id": "77863", "last_activity_date": "2021-06-29T15:56:05.897", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "41756", "parent_id": "77861", "post_type": "answer", "score": 0 } ]
77861
null
77863
{ "accepted_answer_id": "77864", "answer_count": 1, "body": "SELECT文のWHERE句の条件でインデックスが張られているカラムに対して、LIKEを用いた場合、前方一致であればインデックスは有効になる認識ですが、C#のプログラムでODP.NETを用いて、LIKEの条件をパラメータバインドにより前方一致指定した場合でもインデックスは有効でしょうか?\n\n試してみればよいのですが、C#のプログラム上でSQL文を実行した際にインデックスが効いているかどうか確認する方法もわからないため、そちらも含めてご教示いただけると幸いです。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T14:06:06.947", "favorite_count": 0, "id": "77862", "last_activity_date": "2021-06-30T13:24:54.427", "last_edit_date": "2021-06-30T13:24:54.427", "last_editor_user_id": "9228", "owner_user_id": "9228", "post_type": "question", "score": 0, "tags": [ "c#", "sql", "oracle" ], "title": "SQL 文のLIKEの条件をバインド変数でバインドしてもインデックスは効きますか?", "view_count": 588 }
[ { "body": "パラメータを含むSQLを実行する場合もパラメータを含まないSQLを実行する場合も「パラメータが具体的にセットされた状態」で実行計画を作成するので、本質的にはどちらも変わりません。\n\n実際に実行計画を取得すればインデックスが有効に作用しているか確認することができます。\n\n * Oracle databaseであればSQLDeveloperを使って開発することが多いかと思います。 \nSQLDeveloperであれば、ツールバーに「実行計画の取得」ボタンがあると思いますので、実行したいSQLにキャレットを当てて実行計画の取得ボタンを押せば実行結果欄に実行計画の詳細が出力されます。\n\n * A5:M2を使用されいている現場もあると思います。その場合も右クリックメニューより「SQLの実行計画」を選択すれば同様に実行計画を取得できます。\n * その他のデータベースツールでも実行計画を取得する方法は何かしらあるかと思います。マニュアルで確認してください。\n * いずれのツールも使用されていない場合は、CI(sql*plus)で実行計画を取得することも可能です。前出のツールほど簡単に実行できないので、以下の記事を参考に実行計画を取得してください。 \n[EXPLAIN PLAN を使って実行計画を取得する | shift-the-oracle.com](https://www.shift-the-\noracle.com/sql/explain-plan.html)\n\n注1: \nパラメータを記載しているSQLでは正しい実行計画を取得できない可能性があります。パラメータを具体的な値に書き直したSQLで実行計画を取得したほうが確実です(特に\n`LIKE` 句が絡むSQLであれば)。 \n注2: \n実行ユーザーの権限によってはEXPLAINの実行ができない場合があります。SYSで実行するか、管理者にお願いして動的パフォーマンスビューを閲覧する権限をもらってください。前出のリンクに関連する情報が記載されていますのでご覧ください。", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T16:07:20.940", "id": "77864", "last_activity_date": "2021-06-29T16:07:20.940", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46944", "parent_id": "77862", "post_type": "answer", "score": 1 } ]
77862
77864
77864
{ "accepted_answer_id": "77869", "answer_count": 1, "body": "LinuxとWindowsの入ったUSBを作るためにUSBにパーティションを割り当てようとしています. \nそこで質問ですがパーティションとは一度作ってしまうと再変更することはできないものなのでしょうか?というのもUSBの中身を消さずにということです.\n\n例えば,私はdiskutilを使ってUbuntuとWindowsようにそれぞれ10Gのパーティションを割り当てました.また,残りの領域は一つのパーティションとして残しています.そういった場合,その残されたパーティションはのちに2つに分けたり,UbuntuとWindowsのパーティションにOSを入れた後にそのパーティションの大きさを変更したりすることは後になってから可能でしょうか?", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T22:30:23.253", "favorite_count": 0, "id": "77866", "last_activity_date": "2021-06-30T02:42:02.003", "last_edit_date": "2021-06-30T00:58:43.437", "last_editor_user_id": "3060", "owner_user_id": "47099", "post_type": "question", "score": 0, "tags": [ "macos", "ubuntu", "usb" ], "title": "Mac で USB メモリ上のデータを維持したままパーティションを操作したい", "view_count": 210 }
[ { "body": "パーティションのデータを維持したままの操作は `parted` コマンドや、その GUI フロントエンドの GParted が有名です。\n\nMac 環境では試したことがありませんが、Windows であれば実際にリサイズ等を実施したことがあります。 \nただし元のファイルシステムによっては移動やリサイズが不可な場合もありますし、この手の操作を行う場合には万一に備えて事前にバックアップを取っておくことをお勧めします。\n\nMac だと直接 GParted を入れるのは難しそうですが、VirtualBox や Docker\n上で動かしたという方法もあるようです。コマンドでの操作でもよければ若干操作の難易度は挙がりますが、parted コマンドを試してもよさそうです。\n\n**参考:** \n[Install GParted on a mac with Homebrew or Macports? - Super\nUser](https://superuser.com/q/621579)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T00:57:05.023", "id": "77869", "last_activity_date": "2021-06-30T02:42:02.003", "last_edit_date": "2021-06-30T02:42:02.003", "last_editor_user_id": "3060", "owner_user_id": "3060", "parent_id": "77866", "post_type": "answer", "score": 1 } ]
77866
77869
77869
{ "accepted_answer_id": null, "answer_count": 0, "body": "下記のサイトを参考にしながら、React×Typscriptでプロフィールサイトを作成しています。 \nSkills.tsx内の `<Box display='flex' justifyContent='center' p={1} >`\n以下をコンポーネント化したく、Technic.tsxを作成し、色々調べて実装したのですが、エラー表示が出て、これ以上積んでわからない状態です。 \n何方かアドバイスをお願いします。\n\n[スキル一覧(Skills)を作成 | React × TypeScriptで作ったポートフォリオサイトをGitHub\nPagesで公開してみる](https://qiita.com/kazama1209/items/868c09393007cc9b234f#%E3%82%B9%E3%82%AD%E3%83%AB%E4%B8%80%E8%A6%A7skills%E3%82%92%E4%BD%9C%E6%88%90)\n\n* * *\n\n※下記のソースコードは引用テキストを雛形として参考にし、装飾等はサイトを検索して、カスタムをしています。\n\n**App.tsx**\n\n```\n\n import React from 'react';\n import Navbar from './components/Navbar';\n import MyAvatar from './components/MyAvatar';\n import About from './components/About';\n import Skills from './components/Skills';\n import Technic from './components/Technic';\n ※エラー文'./components/Technic' またはそれに対応する型宣言が見つかりません。\n \n const App: React.FC = () => {\n return (\n <>\n <section>\n <Navbar/>\n </section>\n <section>\n <MyAvatar />\n </section>\n <section id='about'>\n <About />\n </section>\n <section id='skills'>\n <Skills />\n </section>\n <section id='Technic'>\n <Technic />\n </section>\n </>\n );\n }\n \n export default App;\n \n```\n\n**Skills.tsx**\n\n```\n\n import React from \"react\";\n import Box from '@material-ui/core/Box';\n import { makeStyles } from \"@material-ui/core/styles\";\n // import Card from '@material-ui/core/Card';\n // import CardContent from \"@material-ui/core/CardContent\";\n import Typography from \"@material-ui/core/Typography\";\n import './Skills.module.scss';\n \n const useStyles = makeStyles({\n root: {\n width: 730,\n maxWidth: '100%', \n },\n });\n \n const Skills: React.FC = () => {\n \n const classes = useStyles();\n \n return (\n  <>\n <Box p={2}>\n <Box display='flex' justifyContent='center' p={1} >\n <Typography variant='h5' >\n Skills\n </Typography>\n </Box>\n \n \n ※ コンポーネント化(Tecnic.tsx)したい箇所\n {/* <Box display='flex' justifyContent='center' p={1} >\n <Card className={classes.root}>\n <CardContent>\n <Typography variant=\"h6\">\n Programming language\n </Typography>\n <Typography color=\"textSecondary\">\n Ruby / JavaScript / TypeScript\n </Typography>\n </CardContent>\n </Card>\n </Box>\n <Box display='flex' justifyContent='center' p={1} >\n <Card className={classes.root}>\n <CardContent>\n <Typography variant=\"h6\">\n Framework \n </Typography>\n <Typography color=\"textSecondary\">\n Ruby on Rails / React\n </Typography>\n </CardContent>\n </Card>\n </Box>\n <Box display='flex' justifyContent='center' p={1} >\n <Card className={classes.root}>\n <CardContent>\n <Typography variant=\"h6\">\n Database\n </Typography>\n <Typography color=\"textSecondary\">\n MySQL / PostgreSQL\n </Typography>\n </CardContent>\n </Card>\n </Box>\n <Box display='flex' justifyContent='center' p={1} >\n <Card className={classes.root}>\n <CardContent>\n <Typography variant=\"h6\">\n AWS\n </Typography>\n <Typography color=\"textSecondary\">\n EC2 / ECS / ECR / Lambda / SQS / SNS / Elastic Beanstalk / S3 / Cloud9 / CloudWatch / CloudFormation / RDS / Route53\n </Typography>\n </CardContent>\n </Card>\n </Box> */}\n ※ コンポーネント化(Tecnic.tsx)したい箇所(ここまで)\n \n </Box>\n </>\n );\n }\n \n export default Skills;\n \n```\n\n**※ コンポーネント化 (Tecnic.tsx) したファイル**\n\n```\n\n import React from \"react\";\n import Box from '@material-ui/core/Box';\n import { makeStyles } from \"@material-ui/core/styles\";\n import Card from '@material-ui/core/Card';\n import CardContent from \"@material-ui/core/CardContent\";\n import Typography from \"@material-ui/core/Typography\";\n \n const useStyles = makeStyles({\n root: {\n width: 730,\n maxWidth: '100%', \n },\n });\n \n const Technic: React.FC = () => {\n      ※エラー文 : 'Technic' が宣言されていますが、その値が読み取られることはありません。\n const classes = useStyles();\n \n return (\n <>\n <Box p={2}>\n < Box display='flex' justifyContent='center' p={1} >\n <Card className={classes.root}>\n <CardContent>\n <Typography variant=\"h6\">\n Programming language\n </Typography>\n <Typography color=\"textSecondary\">\n Ruby / JavaScript / TypeScript\n </Typography>\n </CardContent>\n </Card>\n </Box>\n <Box display='flex' justifyContent='center' p={1} >\n <Card className={classes.root}>\n <CardContent>\n <Typography variant=\"h6\">\n Framework \n </Typography>\n <Typography color=\"textSecondary\">\n Ruby on Rails / React\n </Typography>\n </CardContent>\n </Card>\n </Box>\n <Box display='flex' justifyContent='center' p={1} >\n <Card className={classes.root}>\n <CardContent>\n <Typography variant=\"h6\">\n Database\n </Typography>\n <Typography color=\"textSecondary\">\n MySQL / PostgreSQL\n </Typography>\n </CardContent>\n </Card>\n </Box>\n <Box display='flex' justifyContent='center' p={1} >\n <Card className={classes.root}>\n <CardContent>\n <Typography variant=\"h6\">\n AWS\n </Typography>\n <Typography color=\"textSecondary\">\n EC2 / ECS / ECR / Lambda / SQS / SNS / Elastic Beanstalk / S3 / Cloud9 / CloudWatch / CloudFormation / RDS / Route53\n </Typography>\n </CardContent>\n </Card>\n </Box>\n </Box>\n \n </>\n );\n }\n \n export default Box;\n \n```", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-29T23:51:28.610", "favorite_count": 0, "id": "77868", "last_activity_date": "2021-07-01T00:35:42.750", "last_edit_date": "2021-07-01T00:35:42.750", "last_editor_user_id": "3060", "owner_user_id": "43770", "post_type": "question", "score": 0, "tags": [ "reactjs" ], "title": "コンポーネント化しようとするとエラーが発生する", "view_count": 438 }
[]
77868
null
null
{ "accepted_answer_id": null, "answer_count": 0, "body": "現在、XcodeのプロジェクトをGithubに公開しようとしています。 \nここで問題が起きました。 \nプロジェクトをGithubにあげることはできたのですが、言語がrubyで登録されてしまいました。 \nどうやらpodfileの言語で認識してしまったようです。 \nこの場合はどのような操作をすれば、Swiftのファイルを正しく認識してくれるでしょうか? \n回答よろしくお願いします。\n\n上手く上げられなかったプロジェクト \n<https://github.com/hirokei-camel/Password.git>", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T06:41:24.280", "favorite_count": 0, "id": "77875", "last_activity_date": "2021-06-30T06:41:24.280", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46975", "post_type": "question", "score": 0, "tags": [ "swift", "xcode", "git", "github" ], "title": "xcodeのプロジェクトをGithubに公開しようとしたが、言語がrubyで登録されてしまう", "view_count": 120 }
[]
77875
null
null
{ "accepted_answer_id": null, "answer_count": 0, "body": "何度もためしたのですが\n\nphpからmysqlへの接続ができません\n\n環境はmampです ファイルの置き方がおかしいのでしょうか?\n\n.phpはhtdocsの下です\n\nmysqlはターミナルからダウンロードしてphp接続しなかったらログインできます\n\nphp1.php\n\n```\n\n <!DOCTYPE html>\n <html>\n <head>\n <title>フォーム画面</title>\n <meta charset=\"utf-8\">\n </head>\n <body>\n <h1>フォーム画面</h1> \n \n <form action=\"php2.php\" method=\"post\">\n 名前を入力:<input type=\"text\" name=\"yourname\">\n <input type=\"submit\" value=\"登録する\">\n </form>\n \n </body>\n </html>\n \n```\n\nphp2.php\n\n```\n\n <?php\n header(\"Content-type: text/html; charset=utf-8\");\n \n if(empty($_POST)) {\n header(\"Location: php1.php\");\n exit();\n }else{\n //名前入力判定\n if (!isset($_POST['yourname']) || $_POST['yourname'] === \"\" ){\n $errors['name'] = \"名前が入力されていません。\";\n }\n }\n \n if(count($errors) === 0){\n \n $dsn = 'mysql:host=my;dbname=sample01;charset=utf8';\n $user = 'use';\n $password = 'pass';\n \n try{\n $dbh = new PDO($dsn, $user, $password);\n $statement = $dbh->prepare(\"INSERT INTO name (name) VALUES (:name)\");\n \n if($statement){\n $yourname = $_POST['yourname'];\n //プレースホルダへ実際の値を設定する\n $statement->bindValue(':name', $yourname, PDO::PARAM_STR);\n \n if(!$statement->execute()){\n $errors['error'] = \"登録失敗しました。\";\n }\n \n //データベース接続切断\n $dbh = null; \n }\n \n }catch (PDOException $e){\n print('Error:'.$e->getMessage());\n $errors['error'] = \"データベース接続失敗しました。\";\n }\n }\n \n ?>\n \n <!DOCTYPE html>\n <html>\n <head>\n <title>登録画面</title>\n <meta charset=\"utf-8\">\n </head>\n <body>\n \n <?php if (count($errors) === 0): ?>\n <p><?=htmlspecialchars($yourname, ENT_QUOTES, 'UTF-8').\"さんで登録いたしました。\"?></p>\n <?php elseif(count($errors) > 0): ?>\n <?php\n foreach($errors as $value){\n echo \"<p>\".$value.\"</p>\";\n }\n ?>\n <?php endif; ?>\n \n </body>\n </html>\n \n```\n\nエラーは記述どおり\n\nデータベース接続失敗しました。\n\nです\n\nmysqlはダウンロードのものとmampのものとあるようですが 適したものはあるのでしょうか\n\nまたlocalhost側でもサーバー側でもmysql phpはosのもとでうごいているとおもいますが\n\nphpがmysqlへつなぐのは\n\nサーバー側でもおなじでしょうか\n\nおなじサーバー内でおこっているのでしょうこ", "comment_count": 8, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T09:35:51.740", "favorite_count": 0, "id": "77880", "last_activity_date": "2021-06-30T11:04:38.350", "last_edit_date": "2021-06-30T11:04:38.350", "last_editor_user_id": "39481", "owner_user_id": "39481", "post_type": "question", "score": 0, "tags": [ "php", "mysql" ], "title": "mysqlへのinsert", "view_count": 141 }
[]
77880
null
null
{ "accepted_answer_id": null, "answer_count": 0, "body": "pytorchをインストールして、インストールできたことも確認したのですが、以下のエラーが発生してしまいます。どなたか解決法をご教示お願い致します。\n\n**エラーメッセージ**\n\n```\n\n import torch.nn as nn\n ModuleNotFoundError: No module named 'torch.nn'; 'torch' is not a packages\n \n```\n\n**ソースコード**\n\n```\n\n import torch\n import torch.nn as nn\n import torch.nn.functional as F\n import numpy as np\n # # 初期重みの関数\n def init_weight(size):\n f = size[0]\n v = 1. / np.sqrt(f)\n return torch.tensor(np.random.uniform(low=v, high=v, size=size), dtype=torch.float)\n \n```\n\n**実行環境** \nPython 3.7.9 \ntorch 1.9.0 \ntorchaudio 0.9.0 \ntorchvision 0.10.0", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T10:01:49.410", "favorite_count": 0, "id": "77881", "last_activity_date": "2021-06-30T11:18:22.480", "last_edit_date": "2021-06-30T11:18:22.480", "last_editor_user_id": "3060", "owner_user_id": "41671", "post_type": "question", "score": 0, "tags": [ "python", "pytorch" ], "title": "No module named 'torch.nn'; 'torch' is not a packageのエラーを直したい", "view_count": 1208 }
[]
77881
null
null
{ "accepted_answer_id": null, "answer_count": 1, "body": "AppleのiOS dev tutorialsで、会議の情報を表示するレッスンでエラーが出ました。 \n改善策を教えてください、よろしくお願いします。\n\n[Creating a CardView — iOS App Dev Tutorials | Apple Developer\nDocumentation](https://developer.apple.com/tutorials/app-dev-\ntraining/creating-a-cardview)\n\n* * *\n\n**エラー**\n\n```\n\n Value of type 'Color' has no member 'accessibleFontColor'\n \n```\n\n**参照する会議の情報**\n\n```\n\n import SwiftUI\n \n struct DailyScrum {\n var title: String\n var attendees: [String]\n var lengthInMinutes: Int\n var color: Color\n }\n \n extension DailyScrum {\n static var data: [DailyScrum] {\n [\n DailyScrum(title: \"Design\", attendees: [\"Cathy\", \"Daisy\", \"Simon\", \"Jonathan\"], lengthInMinutes: 10, color: Color(\"Design\")),\n DailyScrum(title: \"App Dev\", attendees: [\"Katie\", \"Gray\", \"Euna\", \"Luis\", \"Darla\"], lengthInMinutes: 5, color: Color(\"App Dev\")),\n DailyScrum(title: \"Web Dev\", attendees: [\"Chella\", \"Chris\", \"Christina\", \"Eden\", \"Karla\", \"Lindsey\", \"Aga\", \"Chad\", \"Jenn\", \"Sarah\"], lengthInMinutes: 1, color: Color(\"Web Dev\"))\n ]\n }\n }\n \n```\n\n**カードのUI**\n\n```\n\n import SwiftUI\n \n struct CardView: View {\n let scrum: DailyScrum\n var body: some View {\n VStack (alignment: .leading){\n Text(scrum.title)\n .font(.headline)\n Spacer()\n HStack {\n Label(\"\\(scrum.attendees.count)\", systemImage: \"person.3\")\n Spacer()\n Label(\"\\(scrum.lengthInMinutes)\", systemImage: \"clock\")\n .padding(.trailing, 20)\n }\n .font(.caption)\n }\n .padding()\n .foregroundColor(scrum.color.accessibleFontColor)\n }\n }\n \n struct CardView_Previews: PreviewProvider {\n static var scrum = DailyScrum.data[0]\n static var previews: some View {\n CardView(scrum: scrum)\n .background(scrum.color)\n .previewLayout(.fixed(width: 400, height: 60))\n }\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T13:26:15.377", "favorite_count": 0, "id": "77885", "last_activity_date": "2022-11-21T06:08:05.930", "last_edit_date": "2021-06-30T16:31:21.943", "last_editor_user_id": "3060", "owner_user_id": "47109", "post_type": "question", "score": 0, "tags": [ "swift", "ios", "xcode", "swiftui" ], "title": "AppleのチュートリアルでValue of type 'Color' has no member 'accessibleFontColor'とエラーが出る", "view_count": 536 }
[ { "body": "おそらくゼロから自分でプロジェクトを作っていないでしょうか。\n\nチュートリアルと読むと\n\n> accessibleFontColor is a property defined in the starting project. It\n> returns either black or white, depending on how light or dark the scrum\n> color is.\n\nとあります。\n\n`the starting project` が何を指すのかここだけ読むと意味不明ですが、 \nチュートリアルの冒頭に\n\n> Download the starter project and follow along with this tutorial, or open\n> the finished project and explore the code on your own.\n\nとあり\n\n`Project files`と下向き矢印があるところからプロジェクトをダウンロードできます。\n\nダウンロードが終わって開いてみると\n\n`Complete` と `StartingPoint` というフォルダがあります。\n\nこの`StartingPoint`にあるプロジェクトに結構すでにコードが書かれています。 \nこのすでに書かれたコードに`'accessibleFontColor'`の定義がありました。\n\nですので、このチュートリアルは、`StartingPoint`にあるプロジェクトからはじめて、それに手を加えていってください。\n\nもし他にわからないことがチュートリアル途中で出た場合は、`Complete`が完成品のようですので、こちらと照らし合わせるとよいかと思います。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-06-30T13:49:11.763", "id": "77886", "last_activity_date": "2021-06-30T13:49:11.763", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9008", "parent_id": "77885", "post_type": "answer", "score": 0 } ]
77885
null
77886
{ "accepted_answer_id": "77894", "answer_count": 2, "body": "dictionary型のlistがあります。中身は以下のようにnode、feature、labelというキーがあります。\n\n```\n\n sample_list = [\n {'node': 12345, 'feature': [0.0, 1.0, 0.0, 0.0], 'label': 'b'},\n {'node': 9921821, 'feature': [0.0, 0.0, 1.0, 0.0], 'label': 'c'},\n {'node': 122, 'feature': [1.0, 0.0, 0.0, 0.0], 'label': 'a'},\n ]\n \n```\n\nこのlistからfeatureキーの値を取り出してnumpyのndarrayとしたいです。 \n上の`sample_list`を例にとると、欲しいものは以下のようになります。\n\n```\n\n [[0.0 1.0 0.0 0.0], [0.0 0.0 1.0 0.0], [1.0 0.0 0.0 0.0]] # type numpy.ndarray, shape = (3, 4)\n \n```\n\nどなたかわかる方いらっしゃいましたら教えてください。よろしくお願いします\n\n**追記** \n`node`キーの値と`label`キーの値を`pandas.Series`型に保存する方法も教えてください。 \n上記の例ですと欲しいものは以下のデータになります。\n\n```\n\n 12345 b\n 9921821 c\n 122 a\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T00:57:59.463", "favorite_count": 0, "id": "77892", "last_activity_date": "2021-07-01T05:55:33.587", "last_edit_date": "2021-07-01T05:49:43.747", "last_editor_user_id": null, "owner_user_id": "36750", "post_type": "question", "score": 1, "tags": [ "python", "python3" ], "title": "dictionaryのlistから数値を取り出してnumpyのndarrayに変換する方法", "view_count": 1113 }
[ { "body": "内包表記の例です。\n\n```\n\n sample_list = [\n {'node': 12345, 'feature': [0.0, 1.0, 0.0, 0.0], 'label': 'b'},\n {'node': 9921821, 'feature': [0.0, 0.0, 1.0, 0.0], 'label': 'c'},\n {'node': 122, 'feature': [1.0, 0.0, 0.0, 0.0], 'label': 'a'},\n ]\n \n import numpy as np\n \n ar = np.array([d['feature'] for d in sample_list])\n print(ar)\n \n import pandas as pd\n \n sl = pd.Series([d['label'] for d in sample_list], index=[d['node'] for d in sample_list])\n print(sl)\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T02:16:32.317", "id": "77894", "last_activity_date": "2021-07-01T02:16:32.317", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9820", "parent_id": "77892", "post_type": "answer", "score": 1 }, { "body": "以下は `sample list` を `pandas.DataFrame` に変換して処理する方法です。\n\n```\n\n import pandas as pd\n import numpy as np\n \n df = pd.DataFrame(sample_list)\n \n features = np.vstack(df.feature)\n print(f'features:\\n{features}')\n print(f'\\ntype: {type(features)}, shape={features.shape}')\n \n nodes_label = df.set_index('node').label\n print(f'\\nnodes label:\\n{nodes_label}')\n print(f'\\ntype: {type(nodes_label)}')\n \n ##\n features:\n [[0. 1. 0. 0.]\n [0. 0. 1. 0.]\n [1. 0. 0. 0.]]\n \n type: <class 'numpy.ndarray'>, shape=(3, 4)\n \n nodes label:\n node\n 12345 b\n 9921821 c\n 122 a\n Name: label, dtype: object\n \n type:<class 'pandas.core.series.Series'>\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T05:43:03.103", "id": "77899", "last_activity_date": "2021-07-01T05:55:33.587", "last_edit_date": "2021-07-01T05:55:33.587", "last_editor_user_id": null, "owner_user_id": null, "parent_id": "77892", "post_type": "answer", "score": 1 } ]
77892
77894
77894
{ "accepted_answer_id": "77904", "answer_count": 1, "body": "# やりたいこと\n\nデータクラスを使用した際、非推奨である旨を警告メッセージとして出力したいです。 \n具体的には、データクラスのインスタンスを生成したときにメッセージを出力したいです。\n\n# 試したこと\n\nデータクラス`Human`の`__init__`メソッドに、警告メッセージを出力する処理を追加したいです。 \n以下のようなコードを書きました。\n\n```\n\n import warnings\n from functools import wraps\n from typing import Optional\n from dataclasses import dataclass\n \n def _process_class(cls, deprecated_date: str, new_class_name: Optional[str] = None):\n def decorator(function):\n @wraps(function)\n def wrapped(*args, **kwargs):\n message = f\"deprecated: {deprecated_date}以降に廃止します。\"\n if new_class_name is not None:\n message += f\"替わりに'{new_class_name}'を使用してください。\"\n warnings.warn(\n message,\n DeprecationWarning,\n )\n \n return wrapped\n \n cls.__init__ = decorator(cls.__init__) # type: ignore\n return cls\n \n \n def deprecated_class(_cls=None, *, deprecated_date: str, new_class_name: Optional[str] = None):\n \"\"\"クラスを非推奨にします。\"\"\"\n \n def wrap(cls):\n return _process_class(cls, deprecated_date=deprecated_date, new_class_name=new_class_name)\n \n if _cls is None:\n return wrap\n return wrap(_cls)\n \n \n @deprecated_class(deprecated_date=\"2021-09-01\")\n @dataclass\n class Human:\n \"\"\"非推奨なクラス\"\"\"\n name:str\n age:int\n \n \n```\n\nしかし`Human`クラスのインスタンスを生成しようとすると、以下のエラーが出ました。\n\n```\n\n Human(\"alice\",18)\n \n```\n\n```\n\n ...\n /usr/lib/python3.8/dataclasses.py in wrapper(self)\n 366 repr_running.add(key)\n 367 try:\n --> 368 result = user_function(self)\n 369 finally:\n 370 repr_running.discard(key)\n \n /usr/lib/python3.8/dataclasses.py in __repr__(self)\n \n AttributeError: 'Human' object has no attribute 'name'\n \n \n```\n\n# 質問\n\nエラーの原因は何で、どうすれば解決できるでしょうか?", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T02:55:48.100", "favorite_count": 0, "id": "77895", "last_activity_date": "2021-07-01T07:45:48.810", "last_edit_date": "2021-07-01T07:29:12.310", "last_editor_user_id": "19524", "owner_user_id": "19524", "post_type": "question", "score": 1, "tags": [ "python" ], "title": "データクラスのインスタンス生成時に警告メッセージを出したい", "view_count": 100 }
[ { "body": "`wrapperd`関数に`function(*args, **kwargs)`が必要でした。\n\n`wrapped`関数を以下の通り書き換えたら、期待通りの動きになりました。\n\n```\n\n def wrapped(*args, **kwargs):\n message = f\"deprecated: {deprecated_date}以降に廃止します。\"\n if new_class_name is not None:\n message += f\"替わりに'{new_class_name}'を使用してください。\"\n warnings.warn(\n message,\n DeprecationWarning,\n )\n return function(*args, **kwargs)\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T07:45:48.810", "id": "77904", "last_activity_date": "2021-07-01T07:45:48.810", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "19524", "parent_id": "77895", "post_type": "answer", "score": 1 } ]
77895
77904
77904
{ "accepted_answer_id": null, "answer_count": 0, "body": "laravelでボタン押下後に画面遷移できない。\n\n設置したボタンを押下すると、指定のページに遷移するようにしたいがうまくいかない。エラーは表示されず、同じhomeにとどまるのみ。\n\nweb.php のルーティング設定がうまくいっていない?\n\n**実行環境:** \nlaravel 6 \nphp 7.4\n\n* * *\n\n**web.php**\n\n```\n\n Route::group(['middleware' => ['auth']], function () {\n Route::get('/home', function() { return view('home');});\n //追加\n Route::get('/edit', 'Auth\\AuthController@edit');\n \n```\n\n**Authcontroller**\n\n```\n\n public function edit()\n {\n $hello = 'Guten Morgen';\n return view('auth.edit', compact('hello'));\n }\n \n```\n\n**views/auth/edit**\n\n```\n\n <!DOCTYPE html>\n <html lang=\"en\" dir=\"ltr\">\n <head>\n <meta charset=\"utf-8\">\n <title>HelloHello</title>\n </head>\n <body>\n <h1>{{ $hello }}</h1>\n </body>\n </html>\n \n```\n\n**views/partials/header**\n\n```\n\n <li><a href=\"{{url('/edit')}}\">テスト</a></li>\n \n```", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T05:00:51.970", "favorite_count": 0, "id": "77898", "last_activity_date": "2021-07-01T06:16:51.317", "last_edit_date": "2021-07-01T06:16:51.317", "last_editor_user_id": "3060", "owner_user_id": "41150", "post_type": "question", "score": 0, "tags": [ "php", "laravel" ], "title": "laravelでボタン押下後に画面遷移できない", "view_count": 1050 }
[]
77898
null
null
{ "accepted_answer_id": null, "answer_count": 0, "body": "[AWS の IAM ロールと GCP のサービスアカウントを紐付けて鍵なしでアクセスする方法](https://blog.yuu26.com/gcp-\nidentity-federation/)\n\n上記サイトを参考に構築し、Node.jsでは正常に動作します。\n\nPHPで実装をしていると、「Google\\Cloud\\Core\\Exception\\ServiceException」が発生します。 \n場所は、「vendor/google/cloud/Core/src/RequestWrapper.php」の368行目とでます。\n\n問題が見つかりません。\n\nどのようにしたらアクセスできるかお力を貸していただけないでしょうか?\n\nサービスアカウントのtypeは「external_account」となります。\n\nPHP 7.3.28\n\n```\n\n <?php\n require 'autoload.php';\n use Google\\Cloud\\BigQuery\\BigQueryClient;\n use Google\\Cloud\\core\\ExponentialBackoff;\n \n class BqService\n {\n public function excute()\n {\n try {\n $projectId = 'pj-id';\n \n $config = [\n 'keyFilePath' => 'credentials.json',\n 'projectId' => 'pj-id'\n ];\n $bigquery = new BigQueryClient($config);\n $query = \"SELECT 'http://abc.com/' AS url\";\n $queryJobConfig = $bigquery->queryConfig(\n $query\n );\n $queryExcute = $bigquery->runQuery($queryJobConfig);\n foreach ($queryExcute as $row) {\n var_dump($row);\n }\n } catch (Exception $e) {\n var_dump($e)\n }\n }\n }\n \n \n```\n\n上記のソースでエラーを取得しようとするも別の箇所でエラーが出てしまい、確認ができない状況でした。\n\n```\n\n dev.ERROR 28e68f8: {\n \"error\": {\n \"code\": 401,\n \"message\": \"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.\",\n \"errors\": [\n {\n \"message\": \"Login Required.\",\n \"domain\": \"global\",\n \"reason\": \"required\",\n \"location\": \"Authorization\",\n \"locationType\": \"header\"\n }\n ],\n \"status\": \"UNAUTHENTICATED\"\n }\n }\n {\"exception\":\"[object] (Google\\\\Cloud\\\\Core\\\\Exception\\\\ServiceException(code: 401): {\n \\\"error\\\": {\n \\\"code\\\": 401,\n \\\"message\\\": \\\"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.\\\",\n \\\"errors\\\": [\n {\n \\\"message\\\": \\\"Login Required.\\\",\n \\\"domain\\\": \\\"global\\\",\n \\\"reason\\\": \\\"required\\\",\n \\\"location\\\": \\\"Authorization\\\",\n \\\"locationType\\\": \\\"header\\\"\n }\n ],\n \\\"status\\\": \\\"UNAUTHENTICATED\\\"\n }\n }\n at vendor/google/cloud/Core/src/RequestWrapper.php:368)\"}\n \n```", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T05:48:21.343", "favorite_count": 0, "id": "77900", "last_activity_date": "2021-07-01T10:24:56.653", "last_edit_date": "2021-07-01T10:24:56.653", "last_editor_user_id": "35484", "owner_user_id": "35484", "post_type": "question", "score": 0, "tags": [ "php", "laravel", "google-cloud", "google-bigquery" ], "title": "AWSからGCPへSTSを利用したアクセス時にNode.jsでは正常だが、PHPではエラーになる", "view_count": 77 }
[]
77900
null
null
{ "accepted_answer_id": "77902", "answer_count": 1, "body": "初心者ですが、企業の財務諸表分析のためにPythonコードを勉強しております。\n\n[pythonで財務分析:EDINETから四半期ごとの情報を取得する](https://kiseno-\nlog.com/2020/08/23/python%E3%81%A7%E8%B2%A1%E5%8B%99%E5%88%86%E6%9E%90edinet%E3%81%8B%E3%82%89%E5%9B%9B%E5%8D%8A%E6%9C%9F%E6%B1%BA%E7%AE%97%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B/)\n\n上記のwebサイトを参考に、まずサンプル(企業名などもサンプルと同じままにしています)と同じように自分のPCでデータが得られるか検証しているのですが、下記のエラーが出てしまいます。\n\n**エラーメッセージ:**\n\n```\n\n ---------------------------------------------------------------------------\n NameError Traceback (most recent call last)\n <ipython-input-10-a5273144dfbe> in <module>\n 142 \n 143 # XBRLからデータ形式を変換\n --> 144 df_dic = zip_to_df(file_path_list)\n 145 \n 146 # 営業利益部分抽出\n \n NameError: name 'file_path_list' is not defined\n \n```\n\nコードを一つずつ確認すると、 \n#zipファイルパスのリストの作成 \nの部分でfile_path_listは作成しているつもりなのですが、なぜnot definedと出てしまうか分からず苦戦しております。 \n分かる方がいらっしゃいましたら、教えていただけますでしょうか(初心者でも分かるようにしてくれると嬉しいです)。 \n宜しくお願い致します。\n\n**ソースコード:**\n\n```\n\n from datetime import date,timedelta\n import requests\n import json\n from zipfile import ZipFile\n import os\n import sys\n import pandas as pd\n import glob\n #XBRLをpython形式に変換するライブラリのフォルダパス\n sys.path.append(r'C://Users//junji//AppData//Roaming//Microsoft//Windows//Start Menu//Programs//Python 3.9')\n from xbrl_proc import read_xbrl_from_zip\n import urllib3\n from urllib3.exceptions import InsecureRequestWarning\n urllib3.disable_warnings(InsecureRequestWarning)\n \n def get_list(start,end,company_list):\n '''指定した期間、報告書種類、会社で報告書を取得し、取得したファイルのパスの辞書を返す'''\n #取得期間の日付リストを作成\n day_term = [start + timedelta(days=i) for i in range((end - start).days)]\n \n #データ抜出時に使用する、有価証券報告書および四半期報告書のコードの設定\n ordinance_code = \"010\"\n form_code_quart =\"043000\" # 四半期報告書\n form_code_securities =\"030000\" #有価証券報告書\n \n #EDINETのAPIで、書類一覧を取得し、各日ごとに必要な書類の項目を抜き出し\n quart_list =[] # 四半期報告書のリスト\n securities_list =[] # 四半期報告書のリスト\n \n print('EDINETへのアクセスを開始')\n for i,day in enumerate(day_term):\n url = \"https://disclosure.edinet-fsa.go.jp/api/v1/documents.json\"\n params = {\"date\": day, \"type\": 2}\n \n #進捗表示\n if i % 50 == 0:\n print(f'{i}日目:{day}を開始')\n \n #EDINETから1日の書類一覧を取得\n res = requests.get(url, params=params, verify=False)\n \n #必要な書類の項目を抜き出し\n if res.ok:\n json_data = res.json()\n \n for data in json_data['results']:\n #指定した会社の指定した書類を抜き出し\n if data['ordinanceCode'] == ordinance_code and data['formCode'] == form_code_quart and data['filerName'].replace('株式会社', '') in company_list:\n quart_list.append(data)\n elif data['ordinanceCode'] == ordinance_code and data['formCode'] == form_code_securities and data['filerName'].replace('株式会社', '') in company_list:\n securities_list.append(data)\n \n else:\n print(f'アクセス失敗かも{day}')\n \n list_dic = {'四半期報告書':quart_list,'有価証券報告書':securities_list} \n \n return list_dic\n \n def get_zip(list_dic,quart_dir_path,securities_dir_path):\n '''取得したいデータをzipファイルで取得してファイルパスのリストを返す'''\n \n dir_path_dic = {'四半期報告書':quart_dir_path,'有価証券報告書':securities_dir_path}\n file_path_dic = {'四半期報告書':[],'有価証券報告書':[]} # ダウンロードした有価証券報告書のパスを格納する辞書 \n \n for key in list_dic.keys():\n \n #すでにzipをDLしている場合のため、既存のdocIDリストを取得\n files = os.listdir(dir_path_dic[key])\n existing_docID_list = [file.split('.')[0].split('_')[1] for file in files if os.path.isfile(os.path.join(dir_path_dic[key], file))]\n \n print(f'{key}ファイルのDLを開始')\n for i, doc in enumerate(list_dic[key]):\n #zipファイルパスのリストの作成\n file_name = doc['filerName'].replace('株式会社', '') + '_' + doc['docID']\n file_path = os.path.join(dir_path_dic[key], file_name + \".zip\")\n file_path_dic[key].append(file_path)\n \n #所有していないファイルの場合はDLを行う\n if doc['docID'] not in existing_docID_list:\n #ファイルを取得\n url_zip = \"https://disclosure.edinet-fsa.go.jp/api/v1/documents/\" + doc['docID']\n params_zip = {\"type\": 1}\n \n #進捗表示\n if i % 100 == 0:\n print(f'{i}ファイル目を開始')\n \n #データのDL\n res_zip = requests.get(url_zip, params=params_zip, verify=False, stream=True)\n \n #zipとして保存\n if res_zip.status_code == 200:\n with open(file_path, 'wb') as f:\n for chunk in res_zip.iter_content(chunk_size=1024):\n if chunk:\n f.write(chunk)\n f.flush()\n \n return file_path_dic\n \n def zip_to_df(file_path_dic):\n '''ダウンロードしたzipをdfに変換して各会社のdicにして返す'''\n \n all_df_dic = {}\n for key in file_path_dic.keys():\n print(f'{key}データの変換を開始') \n df_dic = {}\n for i,company_zip in enumerate(file_path_dic[key]):\n # 進捗表示\n if i % 100 == 0:\n print(f'{i}ファイル目を開始')\n company_name = os.path.splitext(os.path.basename(company_zip))[0].split('_')[0]\n doc_name = os.path.splitext(os.path.basename(company_zip))[0].split('_')[1]\n \n if company_name not in df_dic:# 会社が辞書中に存在しない場合\n df_dic[company_name] = {}\n df_dic[company_name] = read_xbrl_from_zip(company_zip)[0]\n elif company_name in df_dic:# 会社が辞書中に存在する場合\n df_dic[company_name] = pd.concat( [df_dic[company_name],read_xbrl_from_zip(company_zip)[0]])\n \n all_df_dic[key] = df_dic\n \n return all_df_dic\n \n #会社のリストを読み込み\n company_list = ['ホウスイ','カネコ種苗']\n \n #取得期間の設定:直近n日分\n delta_day = 100\n end = date.today()\n start = date.today() - timedelta(days=delta_day)\n \n #ダウンロードしたデータのフォルダパス\n quart_dir_path = r'C://Users//junji//Desktop//Kabu//CompanyXBRL2//'\n securities_dir_path = r'C://Users//junji//Desktop//Kabu//CompanyXBRL2//'\n \n \n #XBRLデータの取得 \n list_dic = get_list(start,end,company_list)\n file_path_dic = get_zip(list_dic,quart_dir_path,securities_dir_path)\n \n #XBRLからデータ形式を変換\n df_dic = zip_to_df(file_path_list)\n \n #営業利益部分抽出\n quart = all_df_dic['四半期報告書']['カネコ種苗']\n quart_oi = quart[(quart['tag'] == 'OperatingIncome') & (quart['context'] == 'CurrentYTDDuration')]\n quart_oi = quart_oi[['第N期','終了日','値']].sort_values('終了日')\n quart_oi = quart_oi.rename({'終了日':'Date','値':'OperatingIncome'},axis=1).reset_index(drop=True)\n quart_oi['type'] = '四半期報告書'\n \n securities = all_df_dic['有価証券報告書']['カネコ種苗']\n securities_oi = securities[(securities['tag'] == 'OperatingIncome') & (securities['context'] == 'CurrentYearDuration')]\n securities_oi = securities_oi[['第N期','終了日','値']].sort_values('終了日')\n securities_oi = securities_oi.rename({'終了日':'Date','値':'OperatingIncome'},axis=1).reset_index(drop=True)\n securities_oi['type'] = '有価証券報告書'\n \n oi_df = pd.concat([quart_oi,securities_oi]).sort_values('Date').reset_index(drop=True)\n \n #各四半期ごとの営業利益や、前年同期比の売上高営業利益率の変化を計算\n oi_df['tempOperatingIncome'] = oi_df['OperatingIncome'] - oi_df['OperatingIncome'].shift(1)\n oi_df['CalcOperatingIncome'] = oi_df['OperatingIncome'].mask(oi_df['第N期'] == 0, oi_df['tempOperatingIncome'])\n oi_df['CalcOperatingIncome'] = oi_df['CalcOperatingIncome'].mask(oi_df['第N期'] == 3, oi_df['tempOperatingIncome'])\n oi_df['CalcOperatingIncome'] = oi_df['CalcOperatingIncome'].mask(oi_df['第N期'] == 2, oi_df['tempOperatingIncome'])\n oi_df['CalcOperatingIncome_YoYchangerate'] = oi_df['CalcOperatingIncome'] / oi_df['CalcOperatingIncome'].shift(4)\n \n #棒グラフで可視化\n oi_df.plot.bar(x='Date', y='CalcOperatingIncome', rot=45)\n \n oi_df.plot.bar(x='Date', y='CalcOperatingIncome_YoYchangerate', rot=45)\n \n```", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T07:13:09.343", "favorite_count": 0, "id": "77901", "last_activity_date": "2021-07-01T07:29:13.510", "last_edit_date": "2021-07-01T07:19:32.910", "last_editor_user_id": "3060", "owner_user_id": "47120", "post_type": "question", "score": 0, "tags": [ "python", "edinet" ], "title": "Pythonのコードで定義したつもりが、not definedと表示される", "view_count": 3417 }
[ { "body": "\"zipファイルパスのリストの作成\" が含まれているのは `get_zip` の中であり、これを呼び出した結果は以下の `file_path_dic`\nで通り受け取っているように見えます。\n\n```\n\n file_path_dic = get_zip(list_dic,quart_dir_path,securities_dir_path)\n \n```\n\n`zip_to_df` の引数に適切な引数を設定すればよさそうです。\n\n```\n\n df_dic = zip_to_df(file_path_dic)\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T07:29:13.510", "id": "77902", "last_activity_date": "2021-07-01T07:29:13.510", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77901", "post_type": "answer", "score": 0 } ]
77901
77902
77902
{ "accepted_answer_id": "77908", "answer_count": 1, "body": "MySQL の起動の確認はどのようにしたらいいですか?\n\nダウンロードはターミナルから homebrew bash を用いました\n\nまたパッケージ MAMPもオフィシャルからインストールしました", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T07:32:05.940", "favorite_count": 0, "id": "77903", "last_activity_date": "2021-07-01T16:25:20.637", "last_edit_date": "2021-07-01T16:25:20.637", "last_editor_user_id": "3060", "owner_user_id": "39481", "post_type": "question", "score": -2, "tags": [ "mysql", "macos" ], "title": "MySQL の起動を確認するには?", "view_count": 257 }
[ { "body": "サーバに直接ログインできる管理者ならばMySQLの起動状況を確認する方法はいくつかあります。\n\n * ターミナルから`mysql.server status`を実行する(Homebrewインストールした場合) \n * [【MacOS - Homebrew版】MySQLの設定方法(インストール→MySQLサーバー立ち上げ→パスワード設定等)](https://qiita.com/miketa_webprgr/items/ba7210ac57e2086fc5b6#c-mysql%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%AE%E7%8A%B6%E6%85%8B%E3%82%92%E7%A2%BA%E8%AA%8D%E3%81%99%E3%82%8B)\n * ターミナルから[`mysqladmin status`](https://dev.mysql.com/doc/refman/5.6/ja/mysqladmin.html)を実行する(OS問わず)\n * 「コントロールパネル」-「システムとメンテナンス」-「管理ツール」-「サービス」からMySQLの状態が「実行中」か確認する(Windows) \n * [MySQLサービスの開始と停止 - Windows環境](https://webkaru.net/mysql/windows-service-start-stop/)\n * [phpMyAdmin](https://www.phpmyadmin.net/)にブラウザからアクセスし「状態」タブから起動状況を確認する(phpMyAdminインストール済の場合) \n * [phpMyAdmin の赤い警告もこれで怖くない!MySQL 状態変数の徹底ガイド](https://www.infiniteloop.co.jp/blog/2017/03/phpmyadmin-status-variables/)\n * [MAMPからphpMyAdminをブラウザに表示するまで](https://qiita.com/mako0104/items/cb677d04922a3d9672ae)\n * レンタルサーバやクラウドサービスの管理者向けWebサイトから起動確認(外部サービス利用の場合) \n * サーバやサービスの種類によって確認画面の有無や確認方法が異なる", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T10:25:48.493", "id": "77908", "last_activity_date": "2021-07-01T10:25:48.493", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9820", "parent_id": "77903", "post_type": "answer", "score": 3 } ]
77903
77908
77908
{ "accepted_answer_id": "77906", "answer_count": 2, "body": "値が昇順にソートされたリスト`A`とMかけるN行の`numpy.ndarray`型の行列`M`があります。 \nこの`M`から`A`にある数字に対応する行を削除したいです。 \n例として、5かける3の行列から2行目と4行目を削除する場合を考えます。\n\n```\n\n import numpy as np\n A = [2, 4]\n B = np.array(\n [[1, 2, 3],\n [4, 5, 6],\n [7, 8, 9],\n [10, 11, 12],\n [13, 14, 15]]\n )\n \n # new_array = \n \n```\n\n`new_arrray`をこの例の期待する出力とした時、中身は\n\n```\n\n [[1, 2, 3],\n [7, 8, 9],\n [13, 14, 15]]\n \n```\n\nとなるような方法を教えてください。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T08:02:07.440", "favorite_count": 0, "id": "77905", "last_activity_date": "2021-07-02T01:17:29.173", "last_edit_date": "2021-07-01T08:32:23.793", "last_editor_user_id": null, "owner_user_id": "36832", "post_type": "question", "score": 3, "tags": [ "python", "python3", "numpy" ], "title": "numpyのndarrayの指定した複数の行を取り除く方法", "view_count": 543 }
[ { "body": "[numpy.delete](https://numpy.org/doc/stable/reference/generated/numpy.delete.html)で特定の行を削除できます。\n\n[NumPyで任意の行・列を削除するnp.deleteの使い方](https://note.nkmk.me/python-numpy-delete/) \n[SO本家の類似回答](https://stackoverflow.com/a/47622289)\n\n```\n\n import numpy as np\n A = [2, 4]\n B = np.array([[1, 2, 3],\n [4, 5, 6],\n [7, 8, 9],\n [10, 11, 12],\n [13, 14, 15]])\n A = [i - 1 for i in A] # 0始まりの行番号を削除するのでAから1を減じた配列を渡す\n B = np.delete(B, A, axis=0)\n print(B)\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T08:19:41.507", "id": "77906", "last_activity_date": "2021-07-01T08:19:41.507", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9820", "parent_id": "77905", "post_type": "answer", "score": 1 }, { "body": "NumPyの[Boolean配列によるIndexing機能](https://numpy.org/doc/stable/user/quickstart.html#indexing-\nwith-boolean-arrays)を利用した別解です。\n\n```\n\n import numpy as np\n A = [2, 4]\n B = np.array([[1, 2, 3],\n [4, 5, 6],\n [7, 8, 9],\n [10, 11, 12],\n [13, 14, 15]])\n \n # Bからの行選択用フィルタ配列を用意\n selector = np.ones(len(B), dtype=bool)\n selector[np.array(A) - 1] = False\n # array([ True, False, True, False, True])\n \n print(B[selector])\n # array([[ 1, 2, 3],\n # [ 7, 8, 9],\n # [13, 14, 15]])\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T01:17:29.173", "id": "77913", "last_activity_date": "2021-07-02T01:17:29.173", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "49", "parent_id": "77905", "post_type": "answer", "score": 0 } ]
77905
77906
77906
{ "accepted_answer_id": null, "answer_count": 1, "body": "CentOS7でSquid3.5を使用しています。 \nバージョンを4.10にアップグレードしたい場合ってどのようにしたらいいでしょうか。 \nもしご存知の方がいらっしゃったら教えていただけると助かります\n\n```\n\n [root@localhost]# cat /etc/os-release \n NAME=\"CentOS Linux\"\n VERSION=\"7 (Core)\"\n ID=\"centos\"\n ID_LIKE=\"rhel fedora\"\n VERSION_ID=\"7\"\n PRETTY_NAME=\"CentOS Linux 7 (Core)\"\n ANSI_COLOR=\"0;31\"\n CPE_NAME=\"cpe:/o:centos:centos:7\"\n HOME_URL=\"https://www.centos.org/\"\n BUG_REPORT_URL=\"https://bugs.centos.org/\"\n \n CENTOS_MANTISBT_PROJECT=\"CentOS-7\"\n CENTOS_MANTISBT_PROJECT_VERSION=\"7\"\n REDHAT_SUPPORT_PRODUCT=\"centos\"\n REDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\n \n [root@localhost]# squid -v\n Squid Cache: Version 3.5.20\n Service Name: squid\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T09:15:39.727", "favorite_count": 0, "id": "77907", "last_activity_date": "2023-03-28T16:01:15.220", "last_edit_date": "2021-07-01T11:02:37.857", "last_editor_user_id": "3060", "owner_user_id": "47121", "post_type": "question", "score": 0, "tags": [ "linux", "centos", "yum", "squid" ], "title": "CentOS7でSquid3.5を使用しています。4.10にアップグレードしたい場合ってどのようにしたらいいでしょうか。", "view_count": 768 }
[ { "body": "CentOS 7 のディストリビューションとしてサポートしている Squid パッケージは **v3.5** までのようです。 \n(CentOS 8 であれば Squid-v4.0.x がパッケージとして見つかりました)\n\n選択肢としては…\n\n * Squid 公式サイトのドキュメントを見ると、CentOS 7 向けの Squid-4.x パッケージがコミュニティリポジトリでいくつか公開されていますが、こちらは **v4.1-5** まででした。\n\n[SquidFaq/BinaryPackages - Squid Web Proxy Wiki](https://wiki.squid-\ncache.org/SquidFaq/BinaryPackages#KnowledgeBase.2FCentOS.Squid-4_release)\n\n * どうしても **v4.10** 以降が必要、というのであればソースコードからコンパイルしてインストールする形になると思います。\n\n[Download | squid : Optimising Web Delivery](http://www.squid-\ncache.org/Versions/v4/)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T11:09:26.553", "id": "77909", "last_activity_date": "2021-07-01T11:09:26.553", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77907", "post_type": "answer", "score": 0 } ]
77907
null
77909
{ "accepted_answer_id": null, "answer_count": 1, "body": "### やりたいこと\n\n処理対象のドキュメントを mongoDB のコマンドで、下記した期待する結果を出力したいです。 \n(一部配列を含まないドキュメントもあります)\n\n### 処理対象のドキュメント\n\n```\n\n {\n \"_id\": ObjectId(\"60ddc26b03edfb7a6b424f10\"),\n \"member\": [\n {\n \"joinDate\": \"2021-07-01 12:00:00.000\",\n \"username\": \"John\"\n },\n {\n \"joinDate\": \"2021-07-01 13:00:00.000\",\n \"username\": \"Maria\"\n }\n ],\n \"createdAt\": \"2021-07-01 11:00\",\n \"roomName\": \"roomA\",\n }\n {\n \"_id\": ObjectId(\"60ddbcccd495870939756dcb\"),\n \"member\": [\n {\n \"joinDate\": \"2021-07-01 14:00:00.000\",\n \"userName\": \"Jack\"\n },\n {\n \"joinDate\": \"2021-07-01 11:00:00.000\",\n \"userName\": \"George\"\n }\n ],\n \"createdAt\": \"2021-07-01 10:00\",\n \"roomName\": \"roomB\"\n }\n {\n \"_id\": ObjectId(\"60ddbcccd495870939756dcc\"),\n \"createdAt\": \"2021-07-01 12:00\",\n \"roomName\": \"roomC\"\n }\n \n```\n\n以下の条件を満たす結果を出力する\n\n * joinDateが最も新しい要素のみドキュメント内の配列の2つの要素をドキュメントに展開する\n * 更に配列の要素名を変更し(接頭辞にlatestを付与)する\n * ドキュメントをlatestJoinDateの降順に並び替える\n * memberの要素が存在しないドキュメントは出力しない\n\n### 期待する結果\n\n```\n\n {\n \"_id\": ObjectId(\"60ddbcccd495870939756dcb\"),\n \"latestJoinDate\": \"2021-07-01 14:00:00.000\",\n \"latestUserName\": \"Jack\",\n \"createdAt\": \"2021-07-01 10:00\",\n \"roomName\": \"roomB\"\n }\n {\n \"_id\": ObjectId(\"60ddc26b03edfb7a6b424f10\"),\n \"latestJoinDate\": \"2021-07-01 13:00:00.000\",\n \"latestUserName\": \"Maria\",\n \"createdAt\": \"2021-07-01 11:00\",\n \"roomName\": \"roomA\",\n }\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-01T14:52:39.503", "favorite_count": 0, "id": "77911", "last_activity_date": "2021-07-03T11:58:20.150", "last_edit_date": "2021-07-01T16:23:39.883", "last_editor_user_id": "3060", "owner_user_id": "16974", "post_type": "question", "score": 0, "tags": [ "json", "mongodb" ], "title": "配列を含むドキュメントの配列内要素に対する並び替えとフィルター", "view_count": 77 }
[ { "body": "こちら自己解決しました!\n\n以下が私が求めていたQueryです。\n\n```\n\n db.collection.aggregate([\n {\n $match: {\n member: {\n $exists: true\n }\n }\n },\n {\n $addFields: {\n member: {\n $arrayElemAt: [\n \"$member\",\n {\n $indexOfArray: [\n \"$member.joinDate\",\n {\n $max: \"$member.joinDate\"\n }\n ]\n }\n ]\n }\n }\n },\n {\n $project: {\n createdAt: 1,\n roomName: 1,\n latestJoinDate: \"$member.joinDate\",\n latestUserName: \"$member.userName\"\n }\n },\n {\n $sort: {\n latestJoinDate: -1\n }\n }\n ])\n \n```\n\n<https://mongoplayground.net/p/mYE2Q1tk4ij>", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T11:58:20.150", "id": "77938", "last_activity_date": "2021-07-03T11:58:20.150", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "16974", "parent_id": "77911", "post_type": "answer", "score": 0 } ]
77911
null
77938
{ "accepted_answer_id": null, "answer_count": 1, "body": "Xcode 12 で Swift を最近学び始めました。\n\n下の画像にあるような赤いと黄色いエラーが出ました、ネットでいろいろ調べましたが解決策が分かりませんでした。このエラーを解決するにはどのようにすればよろしいのでしょうか?\n\n**赤いエラー:**\n\n```\n\n Cannot use instance member 'bottunPath' within property initializer; property initializers run before 'self' is available\n \n```\n\n**黄色い警告:**\n\n```\n\n 'catch' block is unreachable because no errors are thrown in 'do' block\n \n```\n\n* * *\n\n**ソースコード:**\n\n```\n\n import UIKit\n import AVFoundation\n \n class ViewController: UIViewController {\n \n override func viewDidLoad() {\n super.viewDidLoad()\n // Do any additional setup after loading the view.\n \n }\n \n let bottunPath =\n Bundle.main.bundleURL.appendingPathComponent(\"BOTTUN.mp3\")\n var bottunPlayer = AVAudioPlayer(contentsOf: bottunPath, fileTypeHint: nil)\n \n @IBAction func BOTTUN(_ sender: Any) {\n do {\n bottunPlayer = try AVAudioPlayer(contentsOf: bottunPath, fileTypeHint: nil)\n \n bottunPlayer.play()\n } catch {\n print(\"BOTTUNでエラー\")\n }\n }\n }\n \n```\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/hymfM.png)](https://i.stack.imgur.com/hymfM.png)", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T00:59:27.560", "favorite_count": 0, "id": "77912", "last_activity_date": "2022-12-28T22:02:35.387", "last_edit_date": "2021-07-02T01:29:27.043", "last_editor_user_id": "3060", "owner_user_id": "47128", "post_type": "question", "score": 0, "tags": [ "swift", "xcode12" ], "title": "Xcode で表示されたエラーを解決したい", "view_count": 587 }
[ { "body": "> ネットでいろいろ調べましたが解決策が分かりませんでした。\n\nそのような場合、ネットで調べてどのような情報を得て、何を試したのかを記載された方がいいでしょう。エラーメッセージの`Cannot use instance\nmember 'bottunPath' within property initializer; property initializers run\nbefore 'self' is\navailable`でそのまま検索しても、あなたの場合にも当てはまる記事が多数見つかりました。もちろん日本語のものも多くあります。\n\n* * *\n\nで、そのエラーメッセージの後半は、なんでそんなことをエラーにするのか、と言ったSwiftコンパイラ作成陣からの言い訳なのであまり気にしないでください。\n\n`Cannot use instance member 'bottunPath' within property initializer`\n\nあなたのコードでは、2つのインスタンスプロパティ`bottunPath`と`bottunPlayer`を宣言していますが、そのうち`bottunPlayer`の初期化式(property\ninitializer)である`AVAudioPlayer(contentsOf: bottunPath, fileTypeHint:\nnil)`の中で、別のインスタンスプロパティ`bottunPath`を使おうとしています。\n\n**(Swift言語では)インスタンスプロパティ宣言時の初期化式の中で、別のインスタンスメンバー(instance member --\nインスタンスプロパティやインスタンスメソッド)は使うことはできない**\n\nこれは、プログラミング言語としてのSwiftの決まりなので守ってやらないと仕方ありません。\n\n* * *\n\n具体的には、あなたのコードの場合、ボタンが押されるまで`bottunPlayer`には意味のある値は設定されないのですから、Optional型にしておくべきでしょう。\n\nその他にも不適切なコードの書き方になっているところを改めるとこんな感じになります。\n\n```\n\n import UIKit\n import AVFoundation\n \n class ViewController: UIViewController {\n \n override func viewDidLoad() {\n super.viewDidLoad()\n // Do any additional setup after loading the view.\n \n }\n \n //アプリ内リソースへのURL取得には普通`url(forResource:withExtension:)`を使う\n //間違えてたらクラッシュして知らせてほしい、と言う意味で意図的に強制アンラップ(`!`)を使用\n let buttonUrl = Bundle.main.url(forResource: \"BUTTON\", withExtension: \"mp3\")!\n //適切な初期値が設定できないなら、Optional型にしておく、初期値は自動的にnilとなる\n var buttonPlayer: AVAudioPlayer?\n \n //Swiftでは型名以外には大文字で始まる名称は使わない\n @IBAction func buttonTapped(_ sender: Any) {\n do {\n buttonPlayer = try AVAudioPlayer(contentsOf: buttonUrl, fileTypeHint: nil)\n \n //`buttonPlayer`をOptional型にしたので、Optional Chainingを使う\n buttonPlayer?.play()\n } catch {\n //エラーをキャッチした場合、そのエラーの情報を出さないとデバッグしにくい\n print(\"BUTTONでエラー:\\(error)\")\n }\n }\n }\n \n```\n\n一度接続してしまったアクションメソッドの名前を書き換えるといろいろ苦労することになる(大抵の入門書には「間違えた場合の修正の仕方」はあまり書いていないです)んですが、いずれは身につけなければいけないことなので、思い切ってやって見たほうがいいかもしれません。\n\n丸写しにするのではなく、参考にするつもりでやって見てください。\n\n* * *\n\nちなみに2個目の警告は、1つ目のエラーのせいで一部の文が存在しないものと扱われて発生している(do-\ncatchの中にtryを使う文がない時の警告)ようです。まずはエラーを解消してみてください。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T03:53:42.563", "id": "77920", "last_activity_date": "2021-07-02T03:53:42.563", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "13972", "parent_id": "77912", "post_type": "answer", "score": 0 } ]
77912
null
77920
{ "accepted_answer_id": "77919", "answer_count": 1, "body": "# 現状\n\nGoogle Search Console のカバレッジの項に、「robots.txt\nによりブロックされましたが、インデックスに登録しました」という警告が表示されました。\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/jGkZe.jpg)](https://i.stack.imgur.com/jGkZe.jpg)\n\n当画面下部の詳細を押し遷移したページ例の項に、下記のように該当しているページのURLと思われるものが表示されていました。\n\n```\n\n https://example.com/bar/baz.php\n \n```\n\nこの `baz.php` は、呼び出し元のphpファイルにデータを吐き出したHTMLを挿入するファイルです。 \n使途は、記事の概要の一覧を表示するページで「記事をもっと表示する」ボタンを押して、さらに記事の概要を表示する、という機能です。 \n「記事をもっと表示する」ボタンを押下時に `baz.php` を実行します。 \n下記のような内容になっています。\n\n```\n\n // 省略\n white($data = mysql_fetch_array($rst)) {\n $output = '\n <li>'.$data[\"name\"]'</li>\n '\n // 省略\n }\n \n```\n\n呼び出し元\n\n```\n\n <? /* 省略 */ ?>\n \n <script>\n function readmore() {\n $.get(\"<? echo $articleurl; ?>bar/baz.php\",\n { st: st, article: <? echo $article[\"articleid\"] ?> },\n function(article) {\n $(\"#articles\").append(article);\n }\n }\n </script>\n \n </body>\n \n```\n\nまた、警告文にもありますが、`robots.txt` で /bar 以下のディレクトリはブロックするように記述しています。\n\n```\n\n User-agent: *\n Disallow: /bar/\n \n Sitemap : https://example.com/sitemap.xml\n \n```\n\n# 目標\n\n * `https://example.com/bar/baz.php` をインデックスしないようにしたい\n * Google Search Console で表示される警告「robots.txt によりブロックされましたが、インデックスに登録しました」が表示されないようにしたい\n\n# 調べた解決策\n\nググると、noindexを追加するか、認証を導入する方法を見つけられました。\n\n * [「robots.txtによりブロックされましたが、インデックスに登録しました」の原因と対処法 | 株式会社クリエル creal](https://www.creal.co.jp/column/1730/)\n * [「robots.txt によりブロックされましたが、インデックスに登録しました」とSearch Consoleに表示された時の対処方法 - アイオイクスの社員ブログ](https://clm.seojapan.com/946#index_id3)\n\nただ、警告対象のファイルは、ページに挿入するファイルであるため、上記解決策を実施するにあたり、下記の問題点が考えられます。\n\n * 呼び出し元のページが `noindex` になる\n * headタグの外でmetaタグを書いても有効にならない可能性がある\n * headタグの外でmetaタグを書いて有効になっても、SEOに悪影響がでる可能性がある\n * 呼び出すたびに認証を求められる\n * 呼び出し元のページにアクセスした際に認証を求められる", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T01:40:10.577", "favorite_count": 0, "id": "77915", "last_activity_date": "2021-07-02T02:34:57.663", "last_edit_date": "2021-07-02T02:20:30.240", "last_editor_user_id": "32275", "owner_user_id": "32275", "post_type": "question", "score": 0, "tags": [ "php", "google-search" ], "title": "DOMを挿入するPHPファイルに対して警告された「robots.txt によりブロックされましたが、インデックスに登録しました」を解決したい", "view_count": 66 }
[ { "body": "noindexをつけたり、robotで排除するのではなく \nHTMLを返さずに、JSONを返してしまってはいかがですか?\n\nHTMLを生成しているファイルで\n\n```\n\n header(\"Content-Type: application/json; charset=utf-8\");\n echo json_encode($output);\n \n```\n\nとJSONに書き換えて出力します。\n\nまた呼び出し先では、`$.get`ではなく`$.getJSON`に書き換えればJSONファイルとして取得できます。\n\nそもそもHTMLの形式ではなくてJSON配列としてデータだけを渡してJavascriptでDOMの生成をしてもいいとは思いますが、それは改修の手間等を考えてみたほうがいいかも、呼び出し元が結構あるとコストの面で現実的ではないかもしれないです。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T02:34:57.663", "id": "77919", "last_activity_date": "2021-07-02T02:34:57.663", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "22665", "parent_id": "77915", "post_type": "answer", "score": 1 } ]
77915
77919
77919
{ "accepted_answer_id": null, "answer_count": 1, "body": "cloneした後、ファイルを編集しaddとcommitをしてpushしようとしたらpushでユーザー名もパスワードも尋ねられないまま処理が止まってしまいます。エラーメッセージも何も出力されないです。どうすればいいでしょうか。 \nちなみに仮想マシンのUbuntu上で上記の作業を行うとうまくいきました。\n\n環境はWindows10のGit Bushで作業しています。 \nどうすればいいでしょうか、ご教示お願い致します。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T02:06:34.750", "favorite_count": 0, "id": "77917", "last_activity_date": "2021-07-04T16:08:44.410", "last_edit_date": "2021-07-02T02:37:33.283", "last_editor_user_id": "3060", "owner_user_id": "30707", "post_type": "question", "score": 0, "tags": [ "git", "windows-10", "git-bash" ], "title": "git push で固まる", "view_count": 1588 }
[ { "body": "質問するときは環境に関する情報を詳しく記述しましょう。\n\n * [技術系メーリングリストで質問するときのパターン・ランゲージ](https://www.hyuki.com/writing/techask.html#env)\n\nGit for Windowsのバージョンによって、手順が異なることがあります。\n\nおそらく資格情報マネージャーのモジュールが正常に動作していないことが原因と思われます。似たような報告が英語版Stack Overflowにも挙がっています。\n\n * [github - git 2.32 git push -u origin master Nothing happens - Stack Overflow](https://stackoverflow.com/questions/67960886/git-2-32-git-push-u-origin-master-nothing-happens)\n\n古いバージョンのGit for Windowsでは、インストーラーの「Configuring extra options」画面にて「Enable Git\nCredential Manager」にチェックを入れておくことで、.NET Frameworkベースの「Git Credential\nManager」がデフォルトで使用されるようになっていましたが、現在はGitHubの旧パスワード認証の廃止に伴い、後継となる.NET\nCoreベースの「[Git Credential Manager Core](https://github.com/microsoft/Git-\nCredential-Manager-Core)」が推奨されています。\n\n * [build-extra/ReleaseNotes.md at main · git-for-windows/build-extra](https://github.com/git-for-windows/build-extra/blob/main/ReleaseNotes.md#changes-since-git-for-windows-v2290-october-19th-2020)\n\n新しいGit for Windowsのインストーラーの「Choose a credential helper」画面では、新しいGit Credential\nManager Coreがデフォルトで選択されていますが、Git for Windows v2.32.0 現在、この新しいManager\nCoreが正常に機能していないように思われます。 \n(該当モジュールは \"C:\\Program Files\\Git\\mingw64\\libexec\\git-core\\git-credential-\nmanager-core.exe\")\n\nManager Coreの問題の解決方法は不明ですが、代替として「wincred」を使用することで暫定回避できると思います。 \n(該当モジュールは \"C:\\Program Files\\Git\\mingw64\\libexec\\git-core\\git-credential-\nwincred.exe\")\n\nTortoiseGitでは「Settings」→「Git」→「Credential」の、「Helper」にて \n「wincred」/「manager」/「manager-core」を選択できるようになっています。\n\n```\n\n $ git config --global credential.helper wincred\n \n```\n\n認証ダイアログで入力した認証情報は、Windowsの「資格情報マネージャー」で管理されます。 \n認証情報を削除したい場合は、「コントロールパネル」→「ユーザーアカウント」→「資格情報マネージャー」→「Windows資格情報」にて削除することができます。", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T15:45:07.823", "id": "77973", "last_activity_date": "2021-07-04T16:08:44.410", "last_edit_date": "2021-07-04T16:08:44.410", "last_editor_user_id": "15413", "owner_user_id": "15413", "parent_id": "77917", "post_type": "answer", "score": 1 } ]
77917
null
77973
{ "accepted_answer_id": "77922", "answer_count": 2, "body": "以下画像のように`UserControl`を積み重ねたいのですが、親要素?には何を使えばいいでしょうか? \nスクロールが可能なもので、軽量なものを探しています。\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/Xkkyn.png)](https://i.stack.imgur.com/Xkkyn.png)", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T02:30:22.153", "favorite_count": 0, "id": "77918", "last_activity_date": "2022-06-05T19:04:47.590", "last_edit_date": "2021-07-02T02:42:37.217", "last_editor_user_id": "40856", "owner_user_id": "40856", "post_type": "question", "score": -3, "tags": [ "c#", ".net" ], "title": "C# .Net FrameworkにてUserControlを縦積みにしたいのですが、なにを使用するのがよいのでしょうか?", "view_count": 824 }
[ { "body": "WindowsFormsではコントロールごとにウィンドウハンドルが生成される関係で大量のコントロール配置をするUIデザインは解決策のない状況になります。\n\n昔からコントロールが多いと重い、遅いという話題は尽きません。 \n[http://bbs.wankuma.com/index.cgi?mode=al2&namber=9554&KLOG=22](http://bbs.wankuma.com/index.cgi?mode=al2&namber=9554&KLOG=22) \n<https://dobon.net/vb/bbs/log3-19/11327.html> \n[https://www.atmarkit.co.jp/bbs/phpBB/viewtopic.php?topic=15749&forum=7&start=16](https://www.atmarkit.co.jp/bbs/phpBB/viewtopic.php?topic=15749&forum=7&start=16)\n\nこのため、大量のコントロールを配置するような画面仕様を避けることを考えた方が良いでしょう。\n\nたとえば、UserControlは10個くらいにして、スクロールしたら中身を入れ換えて表示して、擬似的にスクロールしているように見せるなど。 \n(実際には、1ページに10個表示、ページ切り換えボタンで11個目~、21個目~からと表示を切り替えるようなUIが良いかもしれません)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T10:13:46.020", "id": "77922", "last_activity_date": "2021-07-02T10:13:46.020", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "4684", "parent_id": "77918", "post_type": "answer", "score": 1 }, { "body": "コントロールが多くなると描画回数と裏で発生するウィンドウメッセージの送受信量が膨大になり、それだけで相当な負荷になるので、どうしても速度は低下します。 \nDataGridView、スプレッドシート系のコンポーネント(有償のが殆どですが…)、組み込みブラウザ等をカスタマイズして、それっぽい入力画面を作るのも手かもしれません。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T02:01:58.320", "id": "77928", "last_activity_date": "2021-07-03T02:01:58.320", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "41943", "parent_id": "77918", "post_type": "answer", "score": 0 } ]
77918
77922
77922
{ "accepted_answer_id": "77935", "answer_count": 2, "body": "### やりたいこと\n\nRuby2.7.2をインストールしたい\n\nなかなかうまくいかないので教えていただきたいです。 \nよろしくお願いします!\n\n### 環境\n\nRuby 2.6.5 \nM1チップ搭載MacOS\n\n### 前提条件\n\nHomebrewインストール済 \nrbenvインストール済\n\n### 発生したエラー\n\n```\n\n Downloading openssl-1.1.1i.tar.gz...\n -> https://dqw8nmjcqpjn7.cloudfront.net/e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242\n Installing openssl-1.1.1i...\n Installed openssl-1.1.1i to /Users/yunyun_jp/.rbenv/versions/2.7.2\n \n Downloading ruby-2.7.2.tar.bz2...\n -> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2\n Installing ruby-2.7.2...\n ruby-build: using readline from homebrew\n \n BUILD FAILED (macOS 11.4 using ruby-build 20210119)\n \n Inspect or clean up the working tree at /var/folders/s2/bcsz8yb94990dsrrg332gxw40000gn/T/ruby-build.20210702152126.84842.ESLM2k\n Results logged to /var/folders/s2/bcsz8yb94990dsrrg332gxw40000gn/T/ruby-build.20210702152126.84842.log\n \n Last 10 log lines:\n compiling date_parse.c\n installing default console libraries\n compiling date_strftime.c\n compiling date_strptime.c\n linking shared-object objspace.bundle\n linking shared-object io/nonblock.bundle\n linking shared-object io/console.bundle\n linking shared-object nkf.bundle\n linking shared-object date_core.bundle\n make: *** [build-ext] Error 2\n \n```\n\n/var/folders/s2/bcsz8yb94990dsrrg332gxw40000gn/T/ruby-\nbuild.20210702152126.84842.log \n文字数制限のため一部抜粋\n\n```\n\n linking shared-object gdbm.bundle\n readline.c:1904:37: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?\n rl_username_completion_function);\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n rl_username_completion_function\n readline.c:79:42: note: expanded from macro 'rl_username_completion_function'\n # define rl_username_completion_function username_completion_function\n ^\n /opt/homebrew/opt/readline/include/readline/readline.h:485:14: note: 'rl_username_completion_function' declared here\n extern char *rl_username_completion_function PARAMS((const char *, int));\n ^\n compiling nonblock.c\n 1 error generated.\n make[2]: *** [readline.o] Error 1\n make[1]: *** [ext/readline/all] Error 2\n make[1]: *** Waiting for unfinished jobs....\n compiling date_parse.c\n installing default console libraries\n compiling date_strftime.c\n compiling date_strptime.c\n linking shared-object objspace.bundle\n linking shared-object io/nonblock.bundle\n linking shared-object io/console.bundle\n linking shared-object nkf.bundle\n linking shared-object date_core.bundle\n make: *** [build-ext] Error 2\n \n Configuration summary for ruby version 2.7.2\n \n * Installation prefix: /Users/yunyun_jp/.rbenv/versions/2.7.2\n * exec prefix: ${prefix}\n * arch: x86_64-darwin20\n * site arch: ${arch}\n * RUBY_BASE_NAME: ruby\n * enable shared: yes\n * ruby lib prefix: ${libdir}/${RUBY_BASE_NAME}\n * site libraries path: ${rubylibprefix}/${sitearch}\n * vendor path: ${rubylibprefix}/vendor_ruby\n * target OS: darwin20\n * compiler: clang\n * with pthread: yes\n * with coroutine: amd64\n * enable shared libs: yes\n * dynamic library ext: bundle\n * CFLAGS: ${optflags} ${debugflags} ${warnflags}\n * LDFLAGS: -L. -L/Users/yunyun_jp/.rbenv/versions/2.7.2/lib \\\n -fstack-protector-strong -L/usr/local/lib\n * DLDFLAGS: -L/Users/yunyun_jp/.rbenv/versions/2.7.2/lib \\\n -Wl,-undefined,dynamic_lookup \\\n -Wl,-multiply_defined,suppress\n * optflags: -O3\n * debugflags: -ggdb3\n * warnflags: -Wall -Wextra -Wdeprecated-declarations \\\n -Wdivision-by-zero \\\n -Wimplicit-function-declaration -Wimplicit-int \\\n -Wmisleading-indentation -Wpointer-arith \\\n -Wshorten-64-to-32 -Wwrite-strings \\\n -Wmissing-noreturn -Wno-constant-logical-operand \\\n -Wno-long-long -Wno-missing-field-initializers \\\n -Wno-overlength-strings -Wno-parentheses-equality \\\n -Wno-self-assign -Wno-tautological-compare \\\n -Wno-unused-parameter -Wno-unused-value \\\n -Wunused-variable -Wextra-tokens\n * strip command: strip -A -n\n * install doc: rdoc\n * JIT support: yes\n * man page type: doc\n * BASERUBY -v: ruby 2.6.5p114 (2019-10-01 revision 67812) \\\n [x86_64-darwin20]\n \n ---\n BASERUBY = /Users/yunyun_jp/.rbenv/shims/ruby --disable=gems\n CC = clang\n LD = ld\n LDSHARED = clang -dynamiclib\n CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -std=gnu99 -fno-common -pipe \n XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/x86_64-darwin20 -I./include -I. -I./enc/unicode/12.1.0\n CPPFLAGS = -I/Users/yunyun_jp/.rbenv/versions/2.7.2/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT \n DLDFLAGS = -L/Users/yunyun_jp/.rbenv/versions/2.7.2/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -install_name /Users/yunyun_jp/.rbenv/versions/2.7.2/lib/libruby.2.7.dylib -compatibility_version 2.7 -current_version 2.7.2 -fstack-protector-strong -framework Security -framework Foundation -fstack-protector-strong -framework Security -framework Foundation \n SOLIBS = -lpthread -ldl -lobjc\n LANG = ja_JP.UTF-8\n LC_ALL = \n LC_CTYPE = \n MFLAGS = - --jobserver-fds=6,7 -j\n Apple clang version 12.0.5 (clang-1205.0.22.9)\n Target: x86_64-apple-darwin20.5.0\n Thread model: posix\n InstalledDir: /Library/Developer/CommandLineTools/usr/bin\n compiling ./main.c\n compiling dmydln.c\n compiling miniinit.c\n compiling dmyext.c\n translating probes probes.d\n compiling ast.c\n compiling bignum.c\n compiling class.c\n compiling compar.c\n . ./vm_opts.h\n compiling complex.c\n compiling compile.c\n compiling cont.c\n compiling debug.c\n In file included from cont.c:16:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n compiling debug_counter.c\n compiling dir.c\n compiling dln_find.c\n compiling encoding.c\n compiling enum.c\n 1 warning generated.\n compiling enumerator.c\n compiling error.c\n compiling eval.c\n compiling file.c\n In file included from eval.c:20:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n compiling gc.c\n In file included from gc.c:41:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n compiling hash.c\n 1 warning generated.\n compiling inits.c\n compiling io.c\n compiling iseq.c\n compiling load.c\n In file included from iseq.c:30:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n iseq.c:3097:27: warning: implicit conversion loses integer precision: 'st_data_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]\n int traced_insn = insn;\n ~~~~~~~~~~~ ^~~~\n compiling marshal.c\n compiling math.c\n making mjit_config.h\n compiling mjit_compile.c\n In file included from mjit_compile.c:19:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n compiling node.c\n compiling numeric.c\n compiling object.c\n 2 warnings generated.\n compiling pack.c\n 1 warning generated.\n compiling parse.c\n compiling proc.c\n compiling process.c\n compiling random.c\n 1 warning generated.\n compiling range.c\n compiling rational.c\n compiling re.c\n compiling regcomp.c\n compiling regenc.c\n compiling regerror.c\n compiling regexec.c\n compiling regparse.c\n compiling regsyntax.c\n compiling ruby.c\n In file included from ruby.c:55:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n compiling safe.c\n compiling signal.c\n compiling sprintf.c\n compiling st.c\n 1 warning generated.\n compiling strftime.c\n compiling string.c\n compiling struct.c\n compiling symbol.c\n compiling thread.c\n In file included from thread.c:77:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n compiling time.c\n compiling transcode.c\n compiling transient_heap.c\n compiling util.c\n compiling variable.c\n compiling vm.c\n compiling vm_backtrace.c\n compiling vm_dump.c\n In file included from vm.c:341:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n compiling vm_trace.c\n 1 warning generated.\n compiling ./missing/explicit_bzero.c\n compiling ./missing/setproctitle.c\n In file included from vm_trace.c:28:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n In file included from vm.c:350:\n ./vm_method.c:291:32: warning: cast to smaller integer type 'enum method_optimized_type' from 'void *' [-Wvoid-pointer-to-enum-cast]\n def->body.optimize_type = (enum method_optimized_type)opts;\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n compiling addr2line.c\n compiling dmyenc.c\n compiling dln.c\n compiling localeinit.c\n compiling array.c\n compiling mjit.c\n 1 warning generated.\n In file included from mjit.c:18:\n In file included from ./mjit_worker.c:76:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n assembling coroutine/amd64/Context.S\n compiling enc/ascii.c\n config.status: creating ruby-runner.h\n compiling enc/us_ascii.c\n compiling enc/unicode.c\n 1 warning generated.\n compiling enc/utf_8.c\n compiling enc/trans/newline.c\n ./revision.h unchanged\n compiling version.c\n In file included from version.c:15:\n ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]\n switch ((enum rb_mjit_iseq_func)func) {\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\n 1 warning generated.\n 2 warnings generated.\n building rb_mjit_header.h\n linking miniruby\n rb_mjit_header.h updated\n generating encdb.h\n building .ext/include/x86_64-darwin20/rb_mjit_min_header-2.7.2.h\n ./miniruby -I./lib -I. -I.ext/common ./tool/transform_mjit_header.rb \"clang -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -std=gnu99 -fno-common -pipe \" rb_mjit_header.h .ext/include/x86_64-darwin20/rb_mjit_min_header-2.7.2.h\n compiling builtin.c\n encdb.h updated\n ./tool/ifchange \"--timestamp=.rbconfig.time\" rbconfig.rb rbconfig.tmp\n rbconfig.rb updated\n generating enc.mk\n creating verconf.h\n making srcs under enc\n make[1]: Nothing to be done for `srcs'.\n generating transdb.h\n verconf.h updated\n compiling loadpath.c\n linking static-library libruby.2.7-static.a\n \n Transforming external functions to static:\n transform_mjit_header: making external definition of 'rb_vm_lvar_exposed' static inline\n transform_mjit_header: making external definition of 'Init_vm_stack_canary' static inline\n transform_mjit_header: making external definition of 'rb_vm_opt_struct_aset' static inline\n transform_mjit_header: making external definition of 'rb_vm_opt_struct_aref' static inline\n transform_mjit_header: making external definition of 'rb_eql_opt' static inline\n transform_mjit_header: changing definition of 'rb_equal_opt' to declaration\n transform_mjit_header: changing definition of 'rb_vm_search_method_slowpath' to declaration\n transform_mjit_header: making external definition of 'rb_vm_rewrite_cref' static inline\n transform_mjit_header: making external definition of 'rb_vm_block_ep_update' static inline\n transform_mjit_header: making external definition of 'rb_vm_cref_new_toplevel' static inline\n transform_mjit_header: making external definition of 'rb_vm_frame_block_handler' static inline\n transform_mjit_header: making external definition of 'rb_vm_cframe_empty_keyword_p' static inline\n transform_mjit_header: making external definition of 'rb_vm_cframe_keyword_p' static inline\n transform_mjit_header: making external definition of 'rb_vm_ep_local_ep' static inline\n transform_mjit_header: making declaration of 'rb_vm_lvar_exposed' static inline\n transform_mjit_header: making declaration of 'rb_vm_rewrite_cref' static inline\n transform_mjit_header: making declaration of 'rb_vm_frame_block_handler' static inline\n transform_mjit_header: making declaration of 'rb_vm_block_ep_update' static inline\n transform_mjit_header: making declaration of 'rb_vm_ep_local_ep' static inline\n transform_mjit_header: SKIPPED to transform __sigbits\n transform_mjit_header: making declaration of 'Init_vm_stack_canary' static inline\n transform_mjit_header: making declaration of 'rb_eql_opt' static inline\n transform_mjit_header: SKIPPED to transform __sincospi\n transform_mjit_header: SKIPPED to transform __sincospif\n transform_mjit_header: SKIPPED to transform __sincos\n transform_mjit_header: SKIPPED to transform __sincosf\n transform_mjit_header: SKIPPED to transform __inline_isnormall\n transform_mjit_header: SKIPPED to transform __inline_isnormald\n transform_mjit_header: SKIPPED to transform __inline_isnormalf\n transform_mjit_header: SKIPPED to transform __inline_signbitl\n transform_mjit_header: SKIPPED to transform __inline_signbitd\n transform_mjit_header: SKIPPED to transform __inline_signbitf\n transform_mjit_header: SKIPPED to transform __inline_isnanl\n transform_mjit_header: SKIPPED to transform __inline_isnand\n transform_mjit_header: SKIPPED to transform __inline_isnanf\n transform_mjit_header: SKIPPED to transform __inline_isinfl\n transform_mjit_header: SKIPPED to transform __inline_isinfd\n transform_mjit_header: SKIPPED to transform __inline_isinff\n transform_mjit_header: SKIPPED to transform __inline_isfinitel\n transform_mjit_header: SKIPPED to transform __inline_isfinited\n transform_mjit_header: SKIPPED to transform __inline_isfinitef\n transform_mjit_header: SKIPPED to transform __darwin_fd_clr\n transform_mjit_header: SKIPPED to transform __darwin_fd_set\n transform_mjit_header: SKIPPED to transform __darwin_fd_isset\n transform_mjit_header: SKIPPED to transform __darwin_check_fd_set\n transform_mjit_header: SKIPPED to transform __sputc\n linking shared-library libruby.2.7.dylib\n transdb.h updated\n ln -sf ../../../.ext/include/x86_64-darwin20/rb_mjit_min_header-2.7.2.h include/ruby-2.7.0/x86_64-darwin20/rb_mjit_min_header-2.7.2.h\n generating makefiles ext/configure-ext.mk\n making enc\n making trans\n compiling ./enc/trans/transdb.c\n compiling ./enc/encdb.c\n compiling ./enc/big5.c\n compiling ./enc/cesu_8.c\n compiling ./enc/trans/big5.c\n ext/configure-ext.mk updated\n compiling ./enc/trans/cesu_8.c\n compiling ./enc/cp949.c\n compiling ./enc/emacs_mule.c\n configuring strscan\n compiling ./enc/trans/chinese.c\n compiling ./enc/euc_jp.c\n compiling ./enc/trans/ebcdic.c\n compiling ./enc/euc_kr.c\n configuring monitor\n compiling ./enc/euc_tw.c\n compiling ./enc/trans/emoji.c\n compiling ./enc/gb2312.c\n configuring syslog\n compiling ./enc/trans/emoji_iso2022_kddi.c\n configuring gdbm\n compiling ./enc/gb18030.c\n compiling ./enc/gbk.c\n configuring pty\n compiling ./enc/iso_8859_1.c\n compiling ./enc/iso_8859_2.c\n configuring objspace\n compiling ./enc/trans/emoji_sjis_docomo.c\n compiling ./enc/iso_8859_3.c\n compiling ./enc/trans/emoji_sjis_kddi.c\n compiling ./enc/iso_8859_4.c\n compiling ./enc/iso_8859_5.c\n configuring nkf\n compiling ./enc/trans/emoji_sjis_softbank.c\n compiling ./enc/iso_8859_6.c\n configuring digest\n configuring digest/bubblebabble\n configuring digest/md5\n compiling ./enc/iso_8859_7.c\n compiling ./enc/trans/escape.c\n configuring date\n compiling ./enc/iso_8859_8.c\n compiling ./enc/trans/gb18030.c\n configuring readline\n compiling ./enc/iso_8859_9.c\n compiling ./enc/iso_8859_10.c\n compiling ./enc/trans/gbk.c\n compiling ./enc/iso_8859_11.c\n compiling ./enc/iso_8859_13.c\n compiling ./enc/trans/iso2022.c\n compiling ./enc/trans/japanese.c\n compiling ./enc/iso_8859_14.c\n compiling ./enc/iso_8859_15.c\n configuring io/console\n compiling ./enc/iso_8859_16.c\n compiling ./enc/trans/japanese_euc.c\n configuring etc\n compiling ./enc/koi8_r.c\n compiling ./enc/trans/japanese_sjis.c\n compiling ./enc/koi8_u.c\n compiling ./enc/shift_jis.c\n compiling ./enc/utf_16be.c\n compiling ./enc/utf_16le.c\n configuring io/nonblock\n compiling ./enc/utf_32be.c\n configuring bigdecimal\n compiling ./enc/trans/korean.c\n compiling ./enc/utf_32le.c\n configuring io/wait\n configuring digest/rmd160\n compiling ./enc/windows_31j.c\n compiling ./enc/windows_1250.c\n compiling ./enc/trans/single_byte.c\n compiling ./enc/windows_1251.c\n compiling ./enc/windows_1252.c\n compiling ./enc/windows_1253.c\n compiling ./enc/trans/utf8_mac.c\n compiling ./enc/windows_1254.c\n configuring -test-/arith_seq/extract\n configuring -test-/array/resize\n configuring -test-/bignum\n configuring -test-/bug-14834\n configuring -test-/bug-3571\n configuring -test-/bug-5832\n configuring -test-/bug_reporter\n configuring -test-/class\n configuring -test-/cxxanyargs\n compiling ./enc/windows_1257.c\n linking encoding encdb.bundle\n linking encoding big5.bundle\n configuring -test-/debug\n configuring -test-/dln/empty\n configuring -test-/enumerator_kw\n configuring -test-/exception\n configuring -test-/fatal\n configuring -test-/file\n linking encoding cesu_8.bundle\n configuring fiddle\n linking encoding cp949.bundle\n linking encoding emacs_mule.bundle\n configuring digest/sha1\n linking encoding euc_jp.bundle\n linking encoding euc_kr.bundle\n linking encoding euc_tw.bundle\n linking encoding gb2312.bundle\n compiling ./enc/trans/utf_16_32.c\n linking encoding gb18030.bundle\n linking encoding gbk.bundle\n linking transcoder transdb.bundle\n linking encoding iso_8859_1.bundle\n linking transcoder big5.bundle\n libffi_version: 3.3.0\n linking encoding iso_8859_2.bundle\n linking transcoder cesu_8.bundle\n linking encoding iso_8859_3.bundle\n linking transcoder chinese.bundle\n linking encoding iso_8859_4.bundle\n linking transcoder ebcdic.bundle\n linking encoding iso_8859_5.bundle\n configuring rubyvm\n linking transcoder emoji.bundle\n linking encoding iso_8859_6.bundle\n configuring zlib\n linking transcoder emoji_iso2022_kddi.bundle\n linking encoding iso_8859_7.bundle\n linking transcoder emoji_sjis_docomo.bundle\n linking encoding iso_8859_8.bundle\n configuring -test-/float\n configuring -test-/funcall\n configuring -test-/gvl/call_without_gvl\n configuring -test-/hash\n configuring -test-/integer\n configuring -test-/iseq_load\n configuring -test-/iter\n configuring -test-/load/dot.dot\n configuring -test-/load/protect\n linking transcoder emoji_sjis_kddi.bundle\n configuring -test-/marshal/compat\n configuring -test-/marshal/internal_ivar\n configuring -test-/marshal/usr\n configuring -test-/memory_status\n configuring -test-/method\n configuring -test-/notimplement\n configuring -test-/num2int\n configuring -test-/path_to_class\n configuring -test-/popen_deadlock\n configuring -test-/postponed_job\n configuring -test-/printf\n configuring -test-/proc\n configuring -test-/rational\n configuring -test-/rb_call_super_kw\n linking encoding iso_8859_9.bundle\n configuring -test-/recursion\n configuring -test-/regexp\n configuring -test-/scan_args\n configuring -test-/st/foreach\n configuring -test-/st/numhash\n configuring -test-/st/update\n configuring -test-/string\n configuring -test-/struct\n configuring -test-/symbol\n linking transcoder emoji_sjis_softbank.bundle\n linking encoding iso_8859_10.bundle\n linking transcoder escape.bundle\n configuring digest/sha2\n linking encoding iso_8859_11.bundle\n linking transcoder gb18030.bundle\n linking encoding iso_8859_13.bundle\n linking transcoder gbk.bundle\n configuring -test-/thread_fd_close\n configuring -test-/time\n configuring -test-/tracepoint\n linking encoding iso_8859_14.bundle\n configuring -test-/typeddata\n configuring -test-/vm\n configuring -test-/wait_for_single_fd\n linking transcoder iso2022.bundle\n linking encoding iso_8859_15.bundle\n linking transcoder japanese.bundle\n linking encoding iso_8859_16.bundle\n linking transcoder japanese_euc.bundle\n linking encoding koi8_r.bundle\n linking transcoder japanese_sjis.bundle\n linking encoding koi8_u.bundle\n linking transcoder korean.bundle\n linking encoding shift_jis.bundle\n linking transcoder single_byte.bundle\n linking encoding utf_16be.bundle\n configuring psych\n linking encoding utf_16le.bundle\n linking transcoder utf8_mac.bundle\n linking encoding utf_32be.bundle\n configuring cgi/escape\n linking transcoder utf_16_32.bundle\n configuring json\n configuring json/generator\n configuring json/parser\n linking encoding utf_32le.bundle\n linking encoding windows_31j.bundle\n configuring stringio\n linking encoding windows_1250.bundle\n linking encoding windows_1251.bundle\n linking encoding windows_1252.bundle\n linking encoding windows_1253.bundle\n configuring racc/cparse\n linking encoding windows_1254.bundle\n linking encoding windows_1257.bundle\n configuring fiber\n making encs\n make[1]: Nothing to be done for `encs'.\n configuring sdbm\n configuring continuation\n configuring rbconfig/sizeof\n configuring dbm\n configuring fcntl\n configuring ripper\n configuring openssl\n configuring pathname\n configuring coverage\n configuring socket\n header: ndbm.h\n library: libc\n generating makefile exts.mk\n exts.mk updated\n compiling monitor.c\n compiling strscan.c\n compiling syslog.c\n compiling gdbm.c\n compiling pty.c\n compiling nkf.c\n compiling digest.c\n compiling object_tracing.c\n installing default monitor libraries\n compiling objspace.c\n linking shared-object monitor.bundle\n installing default pty libraries\n linking shared-object syslog.bundle\n linking shared-object pty.bundle\n installing default digest libraries\n linking shared-object digest.bundle\n installing digest libraries\n compiling objspace_dump.c\n installing default syslog libraries\n linking shared-object strscan.bundle\n compiling readline.c\n compiling date_core.c\n compiling console.c\n linking shared-object gdbm.bundle\n readline.c:1904:37: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?\n rl_username_completion_function);\n ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n rl_username_completion_function\n readline.c:79:42: note: expanded from macro 'rl_username_completion_function'\n # define rl_username_completion_function username_completion_function\n ^\n /opt/homebrew/opt/readline/include/readline/readline.h:485:14: note: 'rl_username_completion_function' declared here\n extern char *rl_username_completion_function PARAMS((const char *, int));\n ^\n compiling nonblock.c\n 1 error generated.\n make[2]: *** [readline.o] Error 1\n make[1]: *** [ext/readline/all] Error 2\n make[1]: *** Waiting for unfinished jobs....\n compiling date_parse.c\n installing default console libraries\n compiling date_strftime.c\n compiling date_strptime.c\n linking shared-object objspace.bundle\n linking shared-object io/nonblock.bundle\n linking shared-object io/console.bundle\n linking shared-object nkf.bundle\n linking shared-object date_core.bundle\n make: *** [build-ext] Error 2\n \n```", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T06:37:06.270", "favorite_count": 0, "id": "77921", "last_activity_date": "2021-07-03T15:12:52.863", "last_edit_date": "2021-07-03T15:12:52.863", "last_editor_user_id": "3060", "owner_user_id": "44865", "post_type": "question", "score": 2, "tags": [ "ruby", "macos", "rbenv" ], "title": "M1Macでrbenv install 2.7.2を実行時、エラーが発生してインストールできません", "view_count": 3018 }
[ { "body": "以下のコマンドで自己解決しました。\n\n```\n\n arch -arm64 rbenv install 2.7.2\n \n```\n\n成功時のログ\n\n```\n\n Downloading openssl-1.1.1i.tar.gz...\n -> https://dqw8nmjcqpjn7.cloudfront.net/e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242\n Installing openssl-1.1.1i...\n Installed openssl-1.1.1i to /Users/yunyun_jp/.rbenv/versions/2.7.2\n \n Downloading ruby-2.7.2.tar.bz2...\n -> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2\n Installing ruby-2.7.2...\n ruby-build: using readline from homebrew\n Installed ruby-2.7.2 to /Users/yunyun_jp/.rbenv/versions/2.7.2\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T04:09:20.840", "id": "77931", "last_activity_date": "2021-07-03T04:09:20.840", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "44865", "parent_id": "77921", "post_type": "answer", "score": 2 }, { "body": "エラーメッセージから察するに、この issue で track されている問題です <https://github.com/rbenv/ruby-\nbuild/issues/1691>。この回答の投稿時点でまだ open です。\n\n手元に M1 Mac が無く詳しくは調べられていませんが、Rosetta 2 絡みでライブラリか何かの取り扱いに不整合が起こっているように見えます。\n\n[上の issue にあるコメント](https://github.com/rbenv/ruby-\nbuild/issues/1691#issuecomment-750688557)のように Rosetta 2 を使わずに native の ARM\nを使うようにするか、他のコメントで触れられている別の workaround を入れると動きそうです。個人的には速度の問題があるので前者がオススメです。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T07:27:01.747", "id": "77935", "last_activity_date": "2021-07-03T07:27:01.747", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "19110", "parent_id": "77921", "post_type": "answer", "score": 3 } ]
77921
77935
77935
{ "accepted_answer_id": "77924", "answer_count": 1, "body": "以下3つのJavaプログラムを実行したとき、想定とは異なる結果になりました。\n\n**想定していた結果:**\n\n```\n\n 計算開始\n comb(5, 0)=1\n comb(5, 3)=10\n comb(5, 2)=10\n NegativeNumberException was thrown: -3! can't be calculated.\n BadCombinationException was thrown: 5C6 can't be calculated.\n 計算終了\n \n```\n\n**実際の実行結果:**\n\n```\n\n :~/java$ java Comb\n 計算開始\n comb(5, 0) = 1\n comb(5, 3) = 10\n NegativeNumberException was thrown: -3! can't be calculated.\n \n```\n\n### 疑問点\n\nなぜ以下の行がそれぞれ出力されなかったのかを知りたいです。お願いします。\n\n * `comb(5, 2)=10`\n * `BadCombinationException was thrown: 5C6 can't be calculated.`\n * `計算終了`\n\n* * *\n\n**対象のプログラム:**\n\n```\n\n public class NegativeNumberException extends Exception {\n public NegativeNumberException() {\n super();\n }\n \n public NegativeNumberException(String message) {\n super(message);\n }\n }\n \n```\n\n```\n\n public class BadCombinationException extends Exception {\n public BadCombinationException() {\n super();\n }\n \n public BadCombinationException(String message) {\n super(message);\n }\n }\n \n```\n\n```\n\n public class Comb {\n public static int fact(int n) throws NegativeNumberException {\n if (n < 0) { // 負の数の階乗\n // エラーなので、例外を作成して投げる\n throw new NegativeNumberException(n + \"! can't be calculated.\");\n }\n else if (n == 0) {\n return 1;\n }\n else {\n return n*fact(n-1);\n }\n }\n \n public static int comb(int n, int k)\n throws NegativeNumberException, BadCombinationException {\n if (n < k) {\n throw new BadCombinationException(n + \" C \" + k \n + \" can't be calculated.\");\n }\n \n /* nCk = n!/((n-k)!k!) */\n return fact(n)/(fact(n-k)*fact(k));\n }\n \n /** テスト用mainメソッド */\n public static void main(String args[]) {\n try {\n System.out.println(\"計算開始\");\n \n int result;\n \n result = Comb.comb(5, 0);\n System.out.println(\"comb(5, 0) = \" + result);\n \n result = Comb.comb(5, 3);\n System.out.println(\"comb(5, 3) = \" + result);\n \n result = Comb.comb(5, -3);\n System.out.println(\"comb(5, -3) = \" + result);\n \n result = Comb.comb(5, 2);\n System.out.println(\"comb(5, 2) = \" + result);\n \n result = Comb.comb(5, 6);\n System.out.println(\"comb(5, 6) = \" + result);\n \n System.out.println(\"計算終了\");\n }\n catch (NegativeNumberException e) {\n System.err.println(\"NegativeNumberException was thrown: \"\n + e.getMessage());\n }\n catch (BadCombinationException e) {\n System.err.println(\"BadCombinationException was thrown: \"\n + e.getMessage());\n }\n }\n }\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T12:33:04.213", "favorite_count": 0, "id": "77923", "last_activity_date": "2021-07-02T16:37:41.637", "last_edit_date": "2021-07-02T16:37:41.637", "last_editor_user_id": "3060", "owner_user_id": "46879", "post_type": "question", "score": 0, "tags": [ "java" ], "title": "Javaプログラムの出力結果がなぜそうなるのかよくわからない", "view_count": 135 }
[ { "body": "try-catch節で例外が発生した時点でcatch節に処理が移り、例外発生からcatch節までの正常系の処理は **実行されません。** \n参考: [Javaのtry-catch文を基本から! より良いエラー処理の方法を身に着けよう](https://engineer-club.jp/java-\ntry-catch#i)\n\nそれはtry-catch節の中から呼び出したメソッドでthrowされた例外でも上記の挙動となります。 \nデバッガを使ってステップ実行すると分かりやすいですが、今回は`result = Comb.comb(5,\n-3);`のコードから呼び出される`fact(-3)`の処理で`NegativeNumberException`例外が発生しています。 \nその直後に`catch (NegativeNumberException e)`ブロックに処理が移動するので\n\n> comb(5, 2)=10 \n> と \n> BadCombinationException was thrown: 5C6 can't be calculated. \n> と \n> 計算終了\n\nを出力する処理は全てスキップされます。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T12:57:24.927", "id": "77924", "last_activity_date": "2021-07-02T12:57:24.927", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9820", "parent_id": "77923", "post_type": "answer", "score": 0 } ]
77923
77924
77924
{ "accepted_answer_id": "77927", "answer_count": 1, "body": "ローカルpcでlaravelのサイトを作って動かしています。 \nphpのバージョンを上げて新しい機能が使いたいので、現在のphpを残して更に上のバージョンをインストールするつもりなのですが、laravelはどのphpを使うかをどうやって判断しているのでしょうか。 \nどのように紐づいているのでしょうか。\n\nlaravelプロジェクト内をphpのディレクトリ名でいろいろ検索してみたのですが、引っかかりませんでした。\n\nOSはwindowsでとくにサーバーアプリやhomestead等は使っていません。 \nphpのサーバー機能を使っています。 \n(追記:実際にはphp artisan serveコマンドを使用) \nインストールしてあるディレクトリは `c:\\abc\\php7.2` といった感じです。\n\n新しいphpを入れたときにそちらを使うような指定方法はあるのでしょうか。", "comment_count": 5, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T14:07:34.060", "favorite_count": 0, "id": "77925", "last_activity_date": "2021-07-03T01:31:52.133", "last_edit_date": "2021-07-03T01:31:52.133", "last_editor_user_id": "34267", "owner_user_id": "34267", "post_type": "question", "score": 0, "tags": [ "php", "windows", "laravel" ], "title": "Laravelが使うphpの指定方法", "view_count": 165 }
[ { "body": "Laravel に限らず、単に `php` とコマンドを呼び出した時に PHP のインストール先を指定するには、環境変数 PATH\nに設定しておく必要があります。\n\nWindows 10 の場合には、以下の手順で環境変数の確認・変更が可能です。\n\n**環境変数の確認・設定手順:**\n\n * スタートメニュー → 「Windows システムツール」 → 「コントロールパネル」\n * 「システムとセキュリティ」 → 「システム」\n * 画面右側にある「システムの詳細設定」をクリック\n * 「システムのプロパティ」ダイアログが開いたら「詳細設定」タブの「環境変数 ... 」をクリック\n * 「システム環境変数」の一覧から変数が \"Path\" を探して「編集 ...」をクリック\n * 一覧に PHP のインストール先が含まれているか確認 \n * 別のバージョンをデフォルトとして認識させたい場合は、ここでインストール先の指定を変更する\n * 環境変数の設定を変更した後には、Windows を念のため再起動する\n\n**参考:** \n[PHPのPATHを設定する |\nLet'sプログラミング](https://www.javadrive.jp/php/install/index3.html#section2)", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T16:31:30.837", "id": "77927", "last_activity_date": "2021-07-02T16:31:30.837", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77925", "post_type": "answer", "score": 1 } ]
77925
77927
77927
{ "accepted_answer_id": "77942", "answer_count": 1, "body": "お世話になります. \n普段XSLTばかりで、JavaでXPathとかやったことがほとんどないので勝手がわかりません.具体的にはある要素に`@xml:base`属性があるのですが、その値をXPathで拾えないのです.(といいますか属性をXPathで拾えません.)ここを教えていただきたくお願いします.\n\n## 前提要件\n\n以下のような部分を持つXMLファイルをDOMで読み込んでいます.丁度`<plugin>`の要素に位置付けているとお考えください.\n\n```\n\n <plugin id=\"org.dita.pdf2\" version=\"3.6.1\" xml:base=\"../plugins/org.dita.pdf2/plugin.xml\">\n <!-- extension points -->\n <extension-point id=\"dita.xsl.xslfo\" name=\"PDF XSLT import\"/>\n <extension-point id=\"dita.xsl.xslfo.i18n-postprocess\" name=\"PDF I18N postprocess import\"/>\n <extension-point id=\"org.dita.pdf2.xsl.topicmerge\" name=\"PDF2 topic merge XSLT import\"/>\n <extension-point id=\"depend.org.dita.pdf2.init.pre\" name=\"Initialization pre-target\"/>\n <extension-point id=\"depend.org.dita.pdf2.format.pre\" name=\"Formatting pre-target\"/>\n <extension-point id=\"depend.org.dita.pdf2.format\" name=\"Formatting target\"/>\n <extension-point id=\"depend.org.dita.pdf2.format.post\" name=\"Formatting post-target\"/>\n <extension-point id=\"depend.org.dita.pdf2.index\" name=\"Indexing target\"/>\n <extension-point id=\"org.dita.pdf2.catalog.relative\" name=\"Configuration XML catalog\"/>\n <extension-point id=\"dita.conductor.pdf2.param\" name=\"PDF XSLT parameters\"/>\n <extension-point id=\"dita.conductor.pdf2.formatter.check\" name=\"Formatter check\"/>\n <!-- extensions -->\n <feature extension=\"dita.conductor.lib.import\" file=\"lib/fo.jar\"/>\n <transtype desc=\"PDF\" name=\"pdf\">\n <param desc=\"Specifies the base file name of the generated PDF file.\" name=\"outputFile.base\"/>\n ...\n </transtype>\n <transtype desc=\"PDF2\" extends=\"pdf\" name=\"pdf2\"/>\n <feature extension=\"dita.transtype.print\" value=\"pdf\"/>\n ...\n </plugin>\n \n```\n\n## やっている処理\n\n次のようにXPathを生成しています.\n\n```\n\n XPath xpath = XPathFactory.newInstance().newXPath();\n xpath.setNamespaceContext(new NamespaceContext() {\n public String getNamespaceURI(String prefix) {\n return prefix.equals(\"xml\") ? XMLConstants.XML_NS_URI : XMLConstants.NULL_NS_URI;\n }\n public Iterator<?> getPrefixes(String val) {\n return null;\n }\n public String getPrefix(String uri) {\n return null;\n }\n });\n \n```\n\nで、以下のコードで`@xml:base`を拾おうとしています.コンテキストのpluginElemは、前提条件で書いたところの`<plugin>`の要素です.(この前提が崩れちゃうと動かなくて当然なんですが、pluginElemは正しく位置付けられています)\n\n```\n\n // Get plug-in location\n String XPathGetPluginBase = \"@xml:base\";\n expr = xpath.compile(XPathGetPluginBase);\n Attr pluginBaseAttr = (Attr)expr.evaluate(pluginElem, XPathConstants.NODE);\n String pluginBase = pluginBaseAttr.getValue();\n \n```\n\n結果は`pluginBaseAttr`がnullで、pluginBaseAttr.getValue()でNPEでこけちゃいます.\n\nわかる方おられましたらアドバイスをお願いいたします.\n\n以上\n\n## 追記\n\n今XPathを書き換えてみたら\n\n```\n\n String XPathGetPluginBase = \"@*[local-name()='base' and namespace-uri()='http://www.w3.org/XML/1998/namespace']\";\n \n```\n\nは従来通りNPEで\n\n```\n\n String XPathGetPluginBase = \"@*[local-name()='base']\";\n \n```\n\nはなんと通ってしまいました.\n\n```\n\n String pluginBase = pluginBaseAttr.getValue();\n \n```\n\nは`../plugins/org.dita.pdf2/plugin.xml`の値になっています.でもこれって本来邪道ですよね(??)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-02T14:53:30.633", "favorite_count": 0, "id": "77926", "last_activity_date": "2021-07-03T14:30:39.443", "last_edit_date": "2021-07-02T15:06:10.513", "last_editor_user_id": "9503", "owner_user_id": "9503", "post_type": "question", "score": 0, "tags": [ "java", "xml", "xpath" ], "title": "XPathで@xml:baseの値が拾えないです.", "view_count": 78 }
[ { "body": "すみません.自己解決しました.\n\nもっと上位の問題.元々のDOMを作るときにnamespace-awareにしていませんでした.以下で解決しました.\n\n```\n\n FileInputStream is = new FileInputStream(Paths.get(pluginsXmlPath).toFile());\n DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n factory.setNamespaceAware(true);\n DocumentBuilder builder = factory.newDocumentBuilder();\n document = builder.parse(is);\n \n```\n\n`@xml:base`の取得もわざわざXPath使うまでもありません.\n\n```\n\n String pluginBase = pluginElem.getAttributeNS(XMLConstants.XML_NS_URI, \"base\");\n \n```\n\nDOMを作ってゴリゴリやるなんて何年ぶりなのですっかり忘れておりました.\n\n大変失礼いたしました.", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T14:30:39.443", "id": "77942", "last_activity_date": "2021-07-03T14:30:39.443", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9503", "parent_id": "77926", "post_type": "answer", "score": 1 } ]
77926
77942
77942
{ "accepted_answer_id": null, "answer_count": 1, "body": "Windows10からVirtualBox上のUbuntuにscpコマンドでファイルを転送しました。 \nすると、ファイル内の日本語がUbuntu上で文字化けしてしまいます。 \n理由と対策が知りたいです。ご教示お願い致します。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T02:29:19.000", "favorite_count": 0, "id": "77929", "last_activity_date": "2021-07-03T02:43:48.803", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "30707", "post_type": "question", "score": 0, "tags": [ "ubuntu", "windows-10", "scp" ], "title": "ファイル転送での文字化けについて", "view_count": 568 }
[ { "body": "どうやら文字コードが違っていたようです。 \nアップロードされたUbuntu側でコマンドで文字コードを変換しました。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T02:43:48.803", "id": "77930", "last_activity_date": "2021-07-03T02:43:48.803", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "30707", "parent_id": "77929", "post_type": "answer", "score": 0 } ]
77929
null
77930
{ "accepted_answer_id": null, "answer_count": 0, "body": "Swiftについて以下の内容について困っております。\n\n## 発生したこと\n\nNavigationLinkで2回遷移できる以下のようなアプリを作成しました。 \n[![ダメな例](https://i.stack.imgur.com/GMHtL.gif)](https://i.stack.imgur.com/GMHtL.gif)\n\n上記の通り挙動としては\n\n 1. `subsubへ`で`SubsubTestView`に遷移(`SubsubTestView`のViewModelは`SubTestView`で渡してます)\n 2. リストのどれかを指定すると、`DetailView`に遷移\n 3. 編集して`submit`を押すと強制的に`SubsubTestView(ListのView)`に戻される ← ★これが問題\n\nソースコードは以下です\n\n * TestApp.swift\n\n```\n\n import SwiftUI\n \n @main\n struct TestApp: App {\n var body: some Scene {\n WindowGroup {\n ContentView().environmentObject(EnvObj())\n }\n }\n }\n \n```\n\n * ContentView.swift\n\n```\n\n import SwiftUI\n \n class EnvObj: ObservableObject {\n @Published var users = [User(name: \"a\"), User(name: \"b\"), User(name: \"c\")]\n }\n \n struct User: Hashable, Identifiable, Equatable {\n var id = UUID()\n var name = \"\"\n \n static func == (lhs: User, rhs: User) -> Bool{\n return lhs.id == rhs.id\n }\n }\n \n struct ContentView: View {\n @EnvironmentObject var envObj: EnvObj\n \n var body: some View {\n NavigationView {\n VStack {\n NavigationLink(\"subsubへ\", destination: SubsubTestView(vm: VM(envObj: envObj)))\n }\n }\n }\n }\n \n struct SubsubTestView: View {\n @EnvironmentObject var envObj: EnvObj\n @ObservedObject var vm: VM\n \n var body: some View {\n List {\n ForEach(self.vm.envObj.users) { user in\n NavigationLink(\n user.name,\n destination: DetailView(vm: self.vm.vmd),\n tag: user,\n selection: self.$vm.vmd.selectedUser\n )\n .onTapGesture {\n self.vm.vmd.selectedUser = user\n }\n }\n }\n }\n }\n \n class VM: ObservableObject {\n var envObj: EnvObj = .init()\n @Published var vmd: VMD = .init()\n \n init(envObj: EnvObj) {\n self.envObj = envObj\n self.vmd.envObj = envObj\n }\n }\n \n struct DetailView: View {\n @ObservedObject var vm: VMD\n \n var body: some View {\n VStack {\n TextField(\"名前\", text: (self.$vm.selectedUser ?? User()).name)\n Text(self.vm.selectedUser?.name ?? User().name)\n Button(\"submit\", action: self.vm.submit)\n }\n }\n }\n \n class VMD: ObservableObject {\n var envObj: EnvObj = .init()\n @Published var selectedUser: User?\n \n private(set) lazy var submit = {\n if let user = self.selectedUser {\n self.update(user: user)\n }\n }\n \n func update(user: User) {\n self.envObj.users = self.envObj.users.map {\n return $0 == user ? user : $0\n }\n }\n }\n \n func ??<T>(binding: Binding<T?>, fallback: T) -> Binding<T> {\n return Binding(get: {\n binding.wrappedValue ?? fallback\n }, set: {\n binding.wrappedValue = $0\n })\n }\n \n```\n\n## お聞きしたいこと\n\n * 強制的に戻る現象の理由と解決方法を知りたいです。\n\n## こちらで試したこと\n\n * 最初の`subsubへ`の行程をなくしてみたら、更新後の強制的な遷移は無くなりました。(EnvironmentObjectの設定のため一覧ページのVMが若干変わっています)\n\n```\n\n class VM2: ObservableObject {\n @Published var envObj: EnvObj = .init()\n @Published var vmd: VMD = .init()\n var settingDone = false\n \n func setting(envObj: EnvObj) {\n if !settingDone {\n self.envObj = envObj\n self.vmd.envObj = envObj\n self.settingDone = true\n }\n }\n }\n \n struct EnvTestView: View {\n @EnvironmentObject var envObj: EnvObj\n @ObservedObject var vm: VM2 = .init()\n \n var body: some View {\n NavigationView {\n List {\n ForEach(self.vm.envObj.users, id: \\.id) { user in\n NavigationLink(\n user.name,\n destination: DetailView(vm: self.vm.vmd),\n tag: user,\n selection: self.$vm.vmd.selectedUser\n )\n .onTapGesture {\n self.vm.vmd.selectedUser = user\n }\n }\n }\n }\n .onAppear(perform: {\n self.vm.setting(envObj: envObj)\n })\n }\n }\n \n```\n\n長文申し訳ないです。よろしくお願いいたします。", "comment_count": 5, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T05:02:59.490", "favorite_count": 0, "id": "77933", "last_activity_date": "2021-07-03T06:43:35.270", "last_edit_date": "2021-07-03T06:43:35.270", "last_editor_user_id": "24870", "owner_user_id": "24870", "post_type": "question", "score": 2, "tags": [ "swift", "ios", "swiftui" ], "title": "SwiftUI: NavigationLinkで遷移後の画面でデータを更新すると前に戻される", "view_count": 1556 }
[]
77933
null
null
{ "accepted_answer_id": "77954", "answer_count": 3, "body": "下記のようなマークダウンファイルからサムネイルに使う用として、記事の最初20文字くらい取得したいです。\n\n最初の `---~---` で囲われてるのはメタ情報なのでまずここを取り除きます。 \n次に `##`に続く改行までの文字列や `index.html`を囲ってるクオーテーション、 `[記事][1]`のようなリンクも取り除きたいです。 \nそれらを取り除いた文字列20文字くらいを取り出したいです。 \n複雑な正規表現になるためどのように書き始めたらよいか分かりません。 \nご教授願いできないでしょうか? \nよろしくお願いします。\n\n```\n\n ---\n title: \"シンプルに生のJavascriptでSVGを外部ファイル化する方法(jQuery, Ajax通信を使用しない)\" # 記事のタイトル\n emoji: \"\" # アイキャッチとして使われる絵文字(1文字だけ)\n type: \"tech\" # tech: 技術記事 / idea: アイデア記事\n topics: [\"javascript\", \"svg\"] # タグ。[\"markdown\", \"rust\", \"aws\"]のように指定する\n published: true # 公開設定(falseにすると下書き)\n date: '2020.09.30'\n ---\n SVGを`index.html`に直書きするのが嫌でネットで調べたら、PHPかjQueryの`load()`、Javascriptの`XHttpRequest()`しかなかった(ローカル内でget通信するのは気持ち悪い)ので自分なりにベストプラクティスを考えてみた。\n \n ## まえがき\n 私は新卒2ヶ月で会社を辞めて、今無職である。今日がちょうど無職になってから91日目である。詳しくはideatrendに上げた[記事][1]に書いてある。\n そして前職はエンジニアとは関係なく、今は趣味プログラマーで在宅でクラウドワークスでもらったPythonで書かれたシステムのコード解析・エラー改修を継続して行ってる。ほぼボランティアに近い。CS学士ない、文系卒、エンジニア職の未経験の人間が書いている。\n \n なのでこの記事は知見の共有として成り立てばこれほど嬉しい事はないが、こんな方法考えたけど、これってセキュリティ的とかエンジニアとしてはこういった書き方はしないな等、確かめる意味合いが強いので現役のエンジニアからアドバイスが頂けると嬉しい。\n \n ### Javascriptでしか書けない理由\n ...続く\n \n```", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T06:31:09.330", "favorite_count": 0, "id": "77934", "last_activity_date": "2021-07-04T05:46:12.717", "last_edit_date": "2021-07-04T05:45:55.427", "last_editor_user_id": "22565", "owner_user_id": "22565", "post_type": "question", "score": -1, "tags": [ "javascript", "正規表現" ], "title": "JavaScriptで正規表現を使って余分な記号等を取り除きながら、記事の最初20文字くらいを取得したい。", "view_count": 379 }
[ { "body": "正規表現を使わないことをお勧めします。与えられる Markdown に特に制約が無い場合、その内容を正規表現だけでパースするのは困難です。たとえばリンク記法\n`[title](url)`\nを取り除きたいということですが、同じ文字列がインラインコードの中にある場合はおそらく取り除きたくないでしょう。こういった細かい問題に個別に対処していくのに、正規表現だと長大になりすぎますし、メンテナンス性も落ちてしまいます。\n\nその代わりに、専用のパーサーを使うことをお勧めします。おそらくこの Markdown\nファイルは先頭の内容の部分だけが使われるのではなく、全体としても何らかのシステムを使って整形され、何かしらのページになるのでしょう。もしそうであれば、このファイルをパースするためのライブラリやフレームワークをお使いのはずです。そこで使われているパーサーをそのまま使えないでしょうか?\nたとえば GitHub Pages で使える Jekyll という静的サイトジェネレーターでは [`strip_html`\nなどのフィルター関数](https://jekyllrb.com/docs/liquid/filters/)を使うことでこの問題を解決できます。\n\nまた、そこまで厳密にやらなくても良くて、単に見栄えがそれっぽくなれば良いというだけであれば、ファイルの内容を `^---$` が 2\n回現れた後から数行取ってきて、``~[]()#` あたりの記号を雑に削除し、先頭から 20 文字取ってくる、というのでも良さそうです。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T07:39:16.093", "id": "77936", "last_activity_date": "2021-07-03T12:53:22.997", "last_edit_date": "2021-07-03T12:53:22.997", "last_editor_user_id": "19110", "owner_user_id": "19110", "parent_id": "77934", "post_type": "answer", "score": 3 }, { "body": "> 最初の ---~--- で囲われてるのはメタ情報なのでまずここを取り除きます。 \n> 次に ##に続く改行までの文字列や index.htmlを囲ってるクオーテーション、 [記事][1]のようなリンクも取り除きたいです。 \n> それらを取り除いた文字列20文字くらいを取り出したいです。\n\nまとめると以下の様な手順になるかと思います。\n\n 1. `---~---` で囲われてるメタ情報を除去\n 2. `##` に続く改行までの文字列(heading)を除去\n 3. `index.html` を囲ってるクオーテーション(backquotes in inline code)を除去\n 4. `[記事][1]` のようなリンク(annotation)を除去\n 5. 先頭20文字くらいを取得\n\nこの様な順次加工処理には [Array.prototype.reduce()](https://developer.mozilla.org/en-\nUS/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) が適当かと思います。\n\n```\n\n const article = `\n ---\n title: \"シンプルに生のJavascriptでSVGを外部ファイル化する方法(jQuery, Ajax通信を使用しない)\" # 記事のタイトル\n :\n \n ### Javascriptでしか書けない理由\n ...続く\n `;\n \n const regexps = [\n [/^\\n*---[^]*?\\n---\\n+/, ''], // delete title\n [/(?!\\n)#+.*?\\n\\s*/g, ''], // delete headings\n [/`(.*?)`/g, '$1'], // unquote inline code\n [/\\[(.*?)\\]\\[.*?\\]/g, '$1'], // delete annotation index\n [/\\n+/g, ''], // delete newline\n [/^(.{0,20}).*/, '$1'], // first upto 20 characters\n ];\n \n const thumbnail = regexps.reduce((acc, r) => acc.replace(r[0], r[1]), article);\n console.log(thumbnail);\n \n =>\n SVGをindex.htmlに直書きする\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T14:20:12.897", "id": "77941", "last_activity_date": "2021-07-03T14:20:12.897", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47127", "parent_id": "77934", "post_type": "answer", "score": 0 }, { "body": "こんな感じにコードを書く事で目的の正規表現を書くことができました。\n\n```\n\n const text = '---\\ntitle: \"シンプルに生のJavascriptでSVGを外部ファイル化する方法(jQuery, Ajax通信を使用しない)\" # 記事のタイトル\\nemoji: \"\" # アイキャッチとして使われる絵文字(1文字だけ)\\ntype: \"tech\" # tech: 技術記事 / idea: アイデア記事\\ntopics: [\"javascript\", \"svg\"] # タグ。[\"markdown\", \"rust\", \"aws\"]のように指定する\\npublished: true # 公開設定(falseにすると下書き)\\ndate: \"2020.09.30\"\\n---\\nSVGを`index.html`に直書きするのが嫌でネットで調べたら、PHPかjQueryの`load()`、Javascriptの`XHttpRequest()`しかなかった(ローカル内でget通信するのは気持ち悪い)ので自分なりにベストプラクティスを考えてみた。\\n\\n## まえがき\\n私は新卒2ヶ月で会社を辞めて、今無職である。今日がちょうど無職になってから91日目である。詳しくはideatrendに上げた[記事][1]に書いてある。\\nそして前職はエンジニアとは関係なく、>今は趣味プログラマーで在宅でクラウドワークスでもらったPythonで書かれたシステムのコード解析・エラー改修を継続して行ってる。ほぼボランティアに近い。CS学士ない、文系卒、エンジニア職の未経験の人間が書いている。\\n\\nなのでこの記事は知見の共有として成り立てばこれほど嬉しい事はないが、こんな方法考えたけど、これってセキュリティ的とかエンジニアとしてはこういった書き方はしないな等、確かめる意味合いが強いので現役のエンジニアからアドバイスが頂けると嬉しい。\\n\\n### Javascriptでしか書けない理由';\n \n const metadate = text.match(/^---[\\s\\S]*---/)\n //console.log(metadate)\n const lastNumber = text.lastIndexOf(metadate[0])\n const removedMeta = text.slice(metadate.index + metadate[0].length, text.length)\n const text140 = removedMeta.slice(0, 140)\n const removedSymbol = text140.replace(/\\`|\\[記事\\]\\[[0-9]\\]|\\n#+[\\s\\S]*?\\n|#+[\\s\\S]*|\\n|-|>/g, '')\n console.log(removedSymbol)\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T05:46:12.717", "id": "77954", "last_activity_date": "2021-07-04T05:46:12.717", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "22565", "parent_id": "77934", "post_type": "answer", "score": 0 } ]
77934
77954
77936
{ "accepted_answer_id": "77943", "answer_count": 1, "body": "Unity を用いてオリジナルゲームを制作しています。 \nプレイヤーの操作するキャラクターに足音を実装する作業を行っており、 \n現在は[こちらのサイトを参考](https://acua-piece.com/post/186042580240/game-audio-with-\nunity-footsteps)に、キャラクターの足が接触したオブジェクトの tag を検知して \n再生するクリップを切り替えるプログラムを書いています。\n\nこれまでに発生していたエラーは初心者の知識でも対処できる単純な物だったので順調に進んでいたのですが、\n\n`CS0029 型'FootStepSEHandler.AudioClips[] を UnityEngine.AudioClip[]に変換できません`\n\nというエラーコードが発生し初めて見るものということもあり、 \n何が原因でどこをどのように直せばよいのか一切わからず手詰まりの状態です。\n\n検索をかけてみたりしたのですが、素人に毛が生えたような程度の知識しかないためよくわからず丸投げという形には \nなってしまいますが質問させていただくことにしました。 \nお手柔らかにご教示お願いします。\n\n```\n\n public class FootStepSEHandler : MonoBehaviour\n {\n [System.Serializable]\n public class AudioClips\n {\n public string groundTypeTag;\n public AudioClips[] audioClips;\n }\n \n [SerializeField] List<AudioClips> listAudioClips = new List<AudioClips>();\n \n private Dictionary<string, int> tagToIndex = new Dictionary<string, int>();\n private int groundIndex = 0;\n \n protected AudioSource source;\n \n public void PlayFootStepSE()\n {\n AudioClip[] clips = listAudioClips[groundIndex].audioClips;\n \n source.PlayOneShot(clips[Random.Range(0, clips.Length)]);\n }\n }\n \n```\n\n※コードは全文ではありません\n\n赤い波線は PlayFootStepSE という関数内の listAudioClips[groundIndex].audioClips\nというところに出ています。\n\n`AudioClip[] clips = listAudioClips[groundIndex].audioClips;`", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T10:35:48.633", "favorite_count": 0, "id": "77937", "last_activity_date": "2021-07-03T15:06:46.360", "last_edit_date": "2021-07-03T15:06:46.360", "last_editor_user_id": "3060", "owner_user_id": "43447", "post_type": "question", "score": 0, "tags": [ "c#", "unity3d", "visual-studio" ], "title": "\"暗黙的に変換できません\"というエラーコードの対処方法", "view_count": 10678 }
[ { "body": "`audioClips` フィールドの定義を、以下のように書き換えてみてください。s が無くなって `AudioClips[]` が\n`AudioClip[]` になっています。\n\n```\n\n public AudioClip[] audioClips;\n \n```\n\nあるいは、この回答の最後の方に書くように `AudioClips` クラス自体を無くしてみてください。\n\n以下、詳しい説明です。\n\n## 暗黙的な変換\n\n「暗黙的に変換できません」というエラーの「変換」というのは、型変換のことです。型変換には明示的なものと暗黙的なものがあります。\n\n明示的な型変換は、型のキャストとも呼ばれ、キャスト式を使って「この値を型として扱ってください」と明示的に型を変換するものです。以下の例では浮動小数点数型の変数\n`d` を明示的に整数型に変換しています。\n\n```\n\n double d = 12.3;\n int i = (int)d;\n \n```\n\n暗黙的な型変換とは、そうではなくて、プログラムに明示的には書かれていないけれど裏ではこっそり変換が行われているような型変換のことです。よくあるのは代入時に行われるもので、たとえば以下のように書いたときに行われています。\n\n```\n\n double d = 42;\n \n```\n\n上のプログラムでは整数リテラルによって表現された整数型の値を浮動小数点数型の変数に代入しようとしています。両者の型は違いますが、整数型から浮動小数点数型へ暗黙の型変換ができるので、暗黙的に浮動小数点数型に型変換されて代入部分の型チェックが通るようになっています。\n\n逆に、以下のように書くと「暗黙的に変換できません」というエラーに繋がります。浮動小数点数型から整数型には暗黙的に型変換できないからです(値の変換に小数点以下の丸めが必要なためです)。この代入をするには明示的に型変換をする必要があります。\n\n```\n\n int i = 12.3; // このように書くとエラーになる。\n \n```\n\n## `AudioClips` は自分自身\n\nいま `FootStepSEHandler.AudioClips` は以下のように定義されています。\n\n```\n\n [System.Serializable]\n public class AudioClips\n {\n public string groundTypeTag;\n public AudioClips[] audioClips;\n }\n \n```\n\nここで、`audioClips` フィールドの型に書かれている `AudioClips` とは、`UnityEngine.AudioClip`\nではなく、今定義がなされている `FootStepSEHandler.AudioClips` 自身を指しています。おそらく想定された型としては\n`UnityEngine.AudioClip` が正しくて打ち間違いが起こっていたのでしょうが、再帰的な定義と解釈されてエラーが出なかった訳です。\n\nこの状態で、今回エラーが出た行のように `UnityEngine.AudioClip[]` 型の変数に対して `audioClips`\nフィールドを代入しようとすると、それは `FootStepSEHandler.AudioClips[]`\n型であり、この型は名前が似ているだけで中身は全然異なるものなので暗黙的な型変換が行えず型チェックが失敗し、今回のように「暗黙的に変換できません」というエラーが出る訳です。\n\nこうなってしまうのを回避するため、正しい名前である `AudioClip` と書けば、今回のエラーは出なくなるはずです。\n\nもっというと、`FootStepSEHandler.AudioClips` は不要なクラスかもしれません。今回やりたいことにはそれぞれの\n`groundTypeTag` ごとに `UnityEngine.AudioClip[]` があれば充分なので、`groundTypeTag`\nをキーとして覚えておけば充分ではないでしょうか。つまり、タグから直接 `UnityEngine.AudioClip[]` が取得できる仕組みです。\n\n```\n\n Dictionary<string, List<AudioClip>> tagToAudioClips = new Dictionary<string, List<AudioClip>>();\n \n```\n\nあるいはシリアライズが欲しければ以下のようなものも考えられます。\n\n```\n\n List<List<AudioClip>> tagToAudioClips = new List<List<AudioClip>>();\n List<string> tags = new List<string>(); // あるいは enum でも。\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T14:43:49.050", "id": "77943", "last_activity_date": "2021-07-03T14:43:49.050", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "19110", "parent_id": "77937", "post_type": "answer", "score": 2 } ]
77937
77943
77943
{ "accepted_answer_id": null, "answer_count": 1, "body": "PostgreSQL 12です。 \nPostgreSQLサーバーは、AWS RDSを利用しております。\n\n凡例) \nユーザー:SQL実行者 \nグループ:アクセスできる範囲を意味しています。 \nグループ配下には、DB、スキーマ、テーブルが存在するとします。\n\nグループA:ユーザー1、ユーザー2 \nグループB:ユーザー3、ユーザー4\n\nグループA配下のテーブルは、ユーザー1、ユーザー2がSQLコマンドを実行でき、ユーザー3、ユーザー4SQLコマンドを実行できない。 \nグループB配下のテーブルは、ユーザー3、ユーザー4がSQLコマンドを実行でき、ユーザー1、ユーザー2SQLコマンドを実行できない。\n\nこの時、PostgreSQLの考え方として、グループを\n\n * 複数のDBで分ける\n * 1つのDBで複数のスキーマで分ける\n\nの2つの方法があるかと思います。\n\n各ユーザーは、グループごとの DB or スキーマ\nの設定をGRANTで行うことで制御できるかと思いますが、DBで分ける場合とスキーマで分ける場合について、メリットデメリットをご教授いただきたいです。\n\n一つのDATABASEに対して、複数のスキーマ(この場合グループA、グループBの計2つ)を作成し、アクセス制御を行う方法と、複数のDATABASE(この場合グループA、グループBの計2つ)を作成し、アクセス制御を行う方法は、どちらを選択するべきでしょうかといったご質問となります。\n\n基本的には、「1つのDBで複数のスキーマで分ける」の方が運用が楽という意味で、メリットがあるかと思いますが、それくらいしか思いつかないため、何かそれ以外の根拠となる明確なご回答をいただきたいです。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-03T12:46:49.493", "favorite_count": 0, "id": "77939", "last_activity_date": "2021-07-04T08:00:12.443", "last_edit_date": "2021-07-03T16:52:55.380", "last_editor_user_id": "3060", "owner_user_id": "37263", "post_type": "question", "score": 0, "tags": [ "postgresql" ], "title": "PostgreSQL によるアクセス制御を「DBで分ける」と「スキーマで分ける」違いは?", "view_count": 3157 }
[ { "body": "DBによる分割とスキーマによる分割について普通は「どちらでも要件は満たせる」ということはあまりないので、例えば\n\n * 「ユーザー5」は両方の「グループ」をJOINしたSQLを実行しないといけない\n * 両方の「グループ」を整合性のあるかたちで統合したバックアップをとらないといけない\n * 逆に、「グループ」ごとに独立してバックアップ・レストアできないといけない\n * 他のRDBMSとの互換性を考慮しないといけない\n\nなど、考慮しないといけない要件が検討されていないだけでないでしょうか。\n\nなお、権限はテーブルに対しても設定できるので、その点も含めて見直されるとよいと思います。\n\n* * *\n\n> バックアップなどの観点は全てAWS RDSの機能により、考慮不要となります。\n\nグループAのデータをリストアしないといけないときに、グループBも使えなくなってよいのか、だめなのか、データが一緒に巻き戻ってよいのかいけないのか巻き戻らないといけないのか、RDSだからといってあなたの都合のよいように動くわけではありません。\n\nこの点だけ見ても考慮不足だと思います。\n\nまた、本当に質問に書いてある条件以外を考慮しなくてよいという前提なら、メリットデメリットを論じる意味もないのでどちらでもよい、という話にしかなりません。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T04:32:31.457", "id": "77950", "last_activity_date": "2021-07-04T08:00:12.443", "last_edit_date": "2021-07-04T08:00:12.443", "last_editor_user_id": "5793", "owner_user_id": "5793", "parent_id": "77939", "post_type": "answer", "score": 1 } ]
77939
null
77950
{ "accepted_answer_id": null, "answer_count": 0, "body": "anyenvをインストールしたコンテナを作成するDockerfileを書いています。\n\n```\n\n FROM ubuntu:latest\n RUN apt update\n RUN apt -y upgrade\n RUN apt install -y sudo git\n RUN git clone https://github.com/anyenv/anyenv ~/.anyenv\n RUN echo 'export PATH=\"$HOME/.anyenv/bin:$PATH\"' >> ~/.bash_profile\n RUN echo 'eval \"$(anyenv init -)\"' >> ~/.bash_profile\n RUN exec $SHELL -l\n RUN anyenv install --init\n \n```\n\n上記を実行するとエラーが発生しました。\n\n```\n\n => [internal] load build definition from Dockerfile 0.1s \n => => transferring dockerfile: 541B 0.0s \n => [internal] load .dockerignore 0.0s \n => => transferring context: 2B 0.0s \n => [internal] load metadata for docker.io/library/ubuntu:latest 0.0s \n => [1/9] FROM docker.io/library/ubuntu:latest 0.0s \n => CACHED [2/9] RUN apt update 0.0s \n => CACHED [3/9] RUN apt -y upgrade 0.0s \n => CACHED [4/9] RUN apt install -y sudo git 0.0s \n => CACHED [5/9] RUN git clone https://github.com/anyenv/anyenv ~/.anyenv 0.0s \n => CACHED [6/9] RUN echo 'export PATH=\"$HOME/.anyenv/bin:$PATH\"' >> ~/.bash_profile 0.0s \n => CACHED [7/9] RUN echo 'eval \"$(anyenv init -)\"' >> ~/.bash_profile 0.0s \n => ERROR [8/9] RUN exec $SHELL -l \n ------\n > [8/9] RUN exec $SHELL -l:\n #11 0.414 /bin/sh: 1: exec: -l: not found\n ------\n executor failed running [/bin/sh -c exec $SHELL -l]: exit code: 127\n \n```\n\nエラーメッセージは exec,-l がないと言っているようですが、どうすればいいの?という状態です。\n\nanyenvのインストール手順は以下のサイトを参考にしています\n\n[anyenvの環境構築 - Qiita](https://qiita.com/282Haniwa/items/71a48a10952413416d18)\n\n**環境**\n\nDocker version 20.10.7\n\n### 試したこと\n\n**1.エラー直前までのImageを作成し、以降起動したコンテナ内で手動でコマンドを実行する** \n下記でビルドするとビルド成功\n\n```\n\n FROM ubuntu:latest\n RUN apt update\n RUN apt -y upgrade\n RUN apt install -y sudo git\n RUN git clone https://github.com/anyenv/anyenv ~/.anyenv\n RUN echo 'export PATH=\"$HOME/.anyenv/bin:$PATH\"' >> ~/.bash_profile\n RUN echo 'eval \"$(anyenv init -)\"' >> ~/.bash_profile\n \n```\n\nパスを確認するとない\n\n```\n\n root@6543e84c449a:/# echo $PATH\n /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n \n```\n\nシェルを再起動\n\n```\n\n root@6543e84c449a:/# exec $SHELL -l\n ANYENV_DEFINITION_ROOT(/root/.config/anyenv/anyenv-install) doesn't exist. You can initialize it by:\n > anyenv install --init\n \n```\n\nもう一度パスを確認すると設定できている\n\n```\n\n root@6543e84c449a:/# echo $PATH\n /root/.anyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n \n```\n\nanyenvのインストール完了\n\n```\n\n root@6543e84c449a:/# anyenv install --init\n Manifest directory doesn't exist: /root/.config/anyenv/anyenv-install\n Do you want to checkout https://github.com/anyenv/anyenv-install.git? [y/N]: y\n Cloning https://github.com/anyenv/anyenv-install.git master to /root/.config/anyenv/anyenv-install...\n Cloning into '/root/.config/anyenv/anyenv-install'...\n remote: Enumerating objects: 62, done.\n remote: Counting objects: 100% (5/5), done.\n remote: Compressing objects: 100% (5/5), done.\n remote: Total 62 (delta 1), reused 1 (delta 0), pack-reused 57\n Unpacking objects: 100% (62/62), 10.50 KiB | 155.00 KiB/s, done.\n \n Completed!\n \n```\n\n**2.anyenvのフルパスを指定してコマンドを実行する** \n下記でビルドするとビルド成功\n\n```\n\n FROM ubuntu:latest\n RUN apt update\n RUN apt -y upgrade\n RUN apt install -y sudo git\n RUN git clone https://github.com/anyenv/anyenv ~/.anyenv\n RUN echo 'export PATH=\"$HOME/.anyenv/bin:$PATH\"' >> ~/.bash_profile\n RUN echo 'eval \"$(anyenv init -)\"' >> ~/.bash_profile\n RUN ~/.anyenv/bin/anyenv install --force-init\n \n```\n\nただし、この方法だと、以降anyenvコマンドすべてフルパスを記述することになります。 \nこれは、Dockerfileとしては不適切な気がします。\n\n**3.ENVでパスを設定する** \n下記でビルドするとビルドエラー\n\n```\n\n FROM ubuntu:latest\n RUN apt update\n RUN apt -y upgrade\n RUN apt install -y sudo git\n RUN git clone https://github.com/anyenv/anyenv ~/.anyenv\n ENV PATH $HOME/.anyenv/bin:$PATH\n RUN anyenv install --init\n \n```\n\nパスが反映されてないためanyenvが見つからないとなりました\n\n```\n\n => [internal] load build definition from Dockerfile 0.1s \n => => transferring dockerfile: 545B 0.0s \n => [internal] load .dockerignore 0.1s \n => => transferring context: 2B 0.0s \n => [internal] load metadata for docker.io/library/ubuntu:latest 0.0s \n => [1/6] FROM docker.io/library/ubuntu:latest 0.0s \n => CACHED [2/6] RUN apt update 0.0s \n => CACHED [3/6] RUN apt -y upgrade 0.0s \n => CACHED [4/6] RUN apt install -y sudo git 0.0s \n => CACHED [5/6] RUN git clone https://github.com/anyenv/anyenv ~/.anyenv 0.0s \n => ERROR [6/6] RUN anyenv install --init 0.5s \n ------\n > [6/6] RUN anyenv install --init:\n #9 0.425 /bin/sh: 1: anyenv: not found\n ------\n executor failed running [/bin/sh -c anyenv install --init]: exit code: 127\n \n```\n\n```\n\n exec $SHELL -l\n \n```\n\nこのコマンドさえエラーにならなければ、問題ないと思いますが、 \n調べても有益な情報が見つけることができませんでした。 \nわかる方がいらっしゃれば、ご教示頂きたいです。 \nよろしくお願いいたします。", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T01:54:53.320", "favorite_count": 0, "id": "77946", "last_activity_date": "2021-07-04T02:44:40.693", "last_edit_date": "2021-07-04T02:44:40.693", "last_editor_user_id": "3060", "owner_user_id": "47142", "post_type": "question", "score": 0, "tags": [ "docker", "nodenv" ], "title": "Dockerfileでanyenvのインストールを記述したがパスが反映されない", "view_count": 317 }
[]
77946
null
null
{ "accepted_answer_id": null, "answer_count": 0, "body": "Blazor webassemblyをVS2019のテンプレートを使ってHello, world!が表示するWebアプリを作成しています。 \nWebアプリをiisの[アプリケーションの追加]でWebアプリケーションとして追加をしたいですが、「Loading... An unhandled\nerror has occurred. Reload」と表示されて動きません。 \n[Webサイトの追加]から追加するとHello, world!が表示されます。 \n[アプリケーションの追加]でBlazor webassemblyアプリを動作させる方法を知っていれば教えて下さい。", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T02:30:34.120", "favorite_count": 0, "id": "77948", "last_activity_date": "2021-07-04T02:47:00.180", "last_edit_date": "2021-07-04T02:47:00.180", "last_editor_user_id": "3060", "owner_user_id": "47145", "post_type": "question", "score": 0, "tags": [ "iis", "webassembly" ], "title": "Blazor webassemblyアプリをIISの[アプリケーションの追加]で追加する方法", "view_count": 518 }
[]
77948
null
null
{ "accepted_answer_id": null, "answer_count": 1, "body": "## 状況\n\nRaspberryPi 3B+を赤外線リモコンとして,照明の操作などに使用していました. \nあるとき,更新に失敗して3B+が起動しなくなってしまったため,OSを入れ直しました. \nすると,それまで正常に操作できていた赤外線による操作ができなくなってしまいました. \n信号が正常に送信できないようですが,どのような原因が考えられるでしょうか?\n\n## 設定\n\nRaspberry Pi 3B+ \ndebian_version: 10.10 \npython: 3.7.3 \npigpio: 1.78 \n送信部: 赤外線LEDをトランジスタで制御,電源には乾電池を使用(3V) \n受信部: 赤外線受信モジュールOSRB38C9AAを使用 \nプログラム: [irrp.py](https://abyz.me.uk/rpi/pigpio/examples.html)を改変せずに使用 \nリモコン: Panasonic HK9478\n\n```\n\n $ vcgencmd measure_temp\n temp=54.8'C\n $ vcgencmd get_config arm_freq\n arm_freq=1400\n $ vcgencmd measure_volts\n volt=1.3688V // 連続で入力すると1.2688V/1.3688Vがころころ変わる,1.2Vより高い\n $ vcgencmd get_config over_voltage\n over_voltage=0 // 電圧の設定なし\n \n```\n\nキーボード,マウスなどは取り外し,wifiからssh接続しました. \nSDカードではなくusbで接続したSSDにOSを搭載しています.\n\n## 生じている問題\n\n赤外線で信号を送信すると,on/offそれぞれの時間が2倍に伸びてしまう.\n\n## 具体的な状況\n\n手元にRaspberry Pi zeroもあったので,送信={リモコン,3B+,zero},受信={3B+,zero}の組み合わせを試すことにしました. \nすると3B+で信号を送信した場合,信号が倍に伸びてしまっていました. \nなお,zeroで照明を操作することはできましたが,用途の都合上3B+で扱いたいです.\n\n* * *\n```\n\n // リモコンで信号を送信\n (リモコンのボタンを押す)\n \n```\n\n```\n\n // リモコンで送信した信号を3B+で受信\n $ python irrp.py -g 5 -f org_3b light:off -r\n $ cat org_3b\n {\"light:off\": [3466, 1732, 440, 433, 440, 433, 440, 1298, 440, 1298, 440, 433, 440, 1298, 440, 433, 440, 433, 440, 433, 440, 1298, 440, 433, 440, 433, 440, 1298, 440, 433, 440, 1298, 440, 433, 440, 1298, 440, 433, 440, 433, 440, 1298, 440, 433, 440, 433, 440, 433, 440, 433, 440, 1298, 440, 1298, 440, 1298, 440, 1298, 440, 433, 440, 1298, 440, 433, 440, 433, 440, 433, 440, 1298, 440, 1298, 440, 433, 440, 433, 440, 1298, 440, 433, 440, 433, 440]}\n \n```\n\n```\n\n // リモコンで送信した信号をzeroで受信\n $ python irrp.py -g 17 -f org_0 light:off -r\n $ cat org_0\n {\"light:off\": [3482, 1718, 441, 441, 441, 441, 441, 1286, 441, 1286, 441, 441, 441, 1286, 441, 441, 441, 441, 441, 441, 441, 1286, 441, 441, 441, 441, 441, 1286, 441, 441, 441, 1286, 441, 441, 441, 1286, 441, 441, 441, 441, 441, 1286, 441, 441, 441, 441, 441, 441, 441, 441, 441, 1286, 441, 1286, 441, 1286, 441, 1286, 441, 441, 441, 1286, 441, 441, 441, 441, 441, 441, 441, 1286, 441, 1286, 441, 441, 441, 441, 441, 1286, 441, 441, 441, 441, 441]}\n \n```\n\n* * *\n```\n\n // 3B+で信号を送信\n $ python irrp.py -g 17 -f org_3b light:off -p\n \n```\n\n```\n\n // 3B+で送信した信号を3B+で受信\n // --no-confirmなしでは一致せず,--postなしでは途中で打ち切られる\n $ python irrp.py -g 5 -f 3b_3b light:off -r --post 100 --no-confirm\n $ cat 3b_3b\n {\"light:off\": [6685, 3816, 560, 1229, 560, 1229, 560, 2872, 560, 2872, 730, 1229, 560, 2872, 560, 1229, 560, 1053, 730, 1053, 730, 2872, 730, 1229, 560, 1229, 481, 2872, 560, 1229, 560, 2872, 560, 1229, 560, 2872, 730, 1229, 560, 1229, 560, 2872, 560, 1229, 560, 1229, 560, 1229, 560, 1053, 730, 2872, 560, 2872, 730, 2872, 560, 2872, 730, 1053, 730, 2872, 730, 1229, 560, 1229, 560, 1229, 560, 2872, 730, 2872, 560, 1053, 730, 1229, 560, 2872, 560, 1053, 730, 1229, 560]}\n \n```\n\n```\n\n // 3B+で送信した信号をzeroで受信\n $ python irrp.py -g 17 -f 3b_0 light:off -r\n $ cat 3b_0\n {\"light:off\": [7012, 3490, 901, 873, 901, 873, 901, 2618, 901, 2618, 901, 873, 901, 2618, 901, 873, 901, 873, 901, 873, 901, 2618, 901, 873, 901, 873, 901, 2618, 901, 873, 901, 2618, 901, 873, 901, 2618, 901, 873, 901, 873, 901, 2618, 901, 873, 901, 873, 901, 873, 901, 873, 901, 2618, 901, 2618, 901, 2618, 901, 2618, 901, 873, 901, 2618, 901, 873, 901, 873, 901, 873, 901, 2618, 901, 2618, 901, 873, 901, 873, 901, 2618, 901, 873, 901, 873, 901]}\n \n```\n\n* * *\n```\n\n // zeroで信号を送信\n $ python irrp.py -g 26 -f org_0 light:off -p\n \n```\n\n```\n\n // zeroで送信した信号を3B+で受信\n $ python irrp.py -g 5 -f 0_3b light:off -r\n $ cat 0_3b\n {\"light:off\": [3478, 1713, 433, 465, 433, 465, 433, 1286, 433, 1286, 433, 465, 433, 1286, 433, 465, 433, 465, 433, 465, 433, 1286, 433, 465, 433, 465, 433, 1286, 433, 465, 433, 1286, 433, 465, 433, 1286, 433, 465, 433, 465, 433, 1286, 433, 465, 433, 465, 433, 465, 433, 465, 433, 1286, 433, 1286, 433, 1286, 433, 1286, 433, 465, 433, 1286, 433, 465, 433, 465, 433, 465, 433, 1286, 433, 1286, 433, 465, 433, 465, 433, 1286, 433, 465, 433, 465, 433]}\n \n```\n\n```\n\n // zeroで送信した信号をzeroで受信\n $ python irrp.py -g 17 -f 0_0 light:off -r\n $ cat 0_0\n {\"light:off\": [3420, 1770, 393, 495, 393, 495, 393, 1340, 393, 1340, 393, 495, 393, 1340, 393, 495, 393, 495, 393, 495, 393, 1340, 393, 495, 393, 495, 393, 1340, 393, 495, 393, 1340, 393, 495, 393, 1340, 393, 495, 393, 495, 393, 1340, 393, 495, 393, 495, 393, 495, 393, 495, 393, 1340, 393, 1340, 393, 1340, 393, 1340, 393, 495, 393, 1340, 393, 495, 393, 495, 393, 495, 393, 1340, 393, 1340, 393, 495, 393, 495, 393, 1340, 393, 495, 393, 495, 393]}\n \n```\n\n* * *\n\nまた,3B+が送信して倍になった信号を更に3B+で送信した結果が次の通りです. \n受信した結果はさらに倍となっていました.\n\n```\n\n // 3B+で「3B+が送信して3B+が受信した信号」を送信\n $ python irrp.py -g 17 -f 3b_3b light:off -p\n \n```\n\n```\n\n // 3B+で送信した「3B+が送信して3B+が受信した信号」を3B+で受信\n $ python irrp.py -g 5 -f 3b3b_3b light:off -r --post 100 --no-confirm\n $ cat 3b3b_3b\n {\"light:off\": [13605, 6952, 1381, 2668, 860, 2668, 1099, 12715, 1381, 2182, 1381, 5780, 1381, 2182, 1381, 2668, 1099, 3283, 387, 5780, 1381, 2668, 1099, 2182, 1381, 5780, 1099, 9550, 1099, 9550, 1381, 2668, 1099, 2182, 1381, 5780, 1381, 2668, 860, 2182, 1381, 2668, 1381, 9550, 1099, 5780, 1381, 5780, 1099, 6952, 387, 9550, 1381, 2668, 160, 2668, 1381, 3283, 279, 6952, 210, 6952, 387, 2668, 387, 9550, 387, 5780, 1381]}\n // len: 69\n \n```\n\n```\n\n // 3B+で送信した「3B+が送信して3B+が受信した信号」をzeroで受信\n $ python irrp.py -g 17 -f 3b3b_0 light:off -r --no-confirm --post 1000\n $ cat 3b3b_0\n {\"light:off\": [13465, 7135, 1250, 2598, 888, 2598, 1250, 12880, 1250, 2112, 1480, 5958, 1250, 2598, 1060, 2598, 888, 9669, 1250, 2598, 888, 2598, 1250, 5958, 888, 9669, 1250, 9669, 1250, 2598, 1250, 2112, 888, 420, 140, 5958, 1250, 2598, 888, 2112, 1250, 2598, 1250, 9669, 888, 5958, 1250, 5958, 888, 7135, 265, 9669, 1250, 2598, 645, 2598, 1250, 16905, 265, 2598, 395, 16905, 1060]}\n // len: 63\n \n```\n\n* * *\n\n## 他に試していたこと\n\n 1. GPIOは正常か? \n * 赤外線LEDの代わりに赤色LEDを使用する\n * 赤色LEDは点灯した\n 2. 赤外線LEDは正常か? \n * カメラで確認\n * 赤外線LEDは点灯していた\n 3. 他のGPIOはどうか \n * 送信のピンを他のピンに変える\n * 改善せず", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T02:54:30.860", "favorite_count": 0, "id": "77949", "last_activity_date": "2021-07-08T04:57:21.267", "last_edit_date": "2021-07-08T04:52:23.740", "last_editor_user_id": "6055", "owner_user_id": "6055", "post_type": "question", "score": 1, "tags": [ "python", "python3", "raspberry-pi", "gpio" ], "title": "irrp.pyで赤外線を送信すると信号が倍に伸びる", "view_count": 612 }
[ { "body": "要約:理由は分からないが直った\n\n> 他の任意のプログラムも動作速度 1/2 になっていますか? なっていればクロック初期化のところで誤って動作周波数が 1/2\n> になっているものと推定されます。\n\n使用感に変化は感じておらず,他のプログラムが遅くなったような気はしません. \n体感だけでは何とも言えないので,現在のクロック周波数を調べるためにcpufrequtilsを入れてみました.\n\nまず,クロック周波数を測ってみると900MHzで,遅めの値が出ました. \nこれが原因だったのかと(機能しないこと前提に)irrp.pyを操作したところ,正常に消灯され,驚きました. \nこの直後に測ったクロック周波数は1.4GHzでした. \nこのことから,クロック周波数が原因だと考えました.\n\nしかし,その後も何回か追加で操作してみると,クロック周波数が700MHzを指しているときでも正常に消灯しました. \nただ,cpufreq-\ninfoを連続で使用すると`800M→1.4G→700M→1.4G→700M→1.4G→700M→1000M`と,ころころと値が変わっていたため.この結果が正確なのか疑問に思っています. \n(クロック周波数は基本一定で,温度やCPU使用率によって段階的に切り替えられるといったイメージを持っていました)\n\n```\n\n $ sudo apt-get install cpufrequtils\n $ cpufreq-info | grep \"current CPU frequency\"\n current CPU frequency is 900 MHz.\n current CPU frequency is 900 MHz.\n current CPU frequency is 900 MHz.\n current CPU frequency is 900 MHz.\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-08T04:57:21.267", "id": "78040", "last_activity_date": "2021-07-08T04:57:21.267", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "6055", "parent_id": "77949", "post_type": "answer", "score": 1 } ]
77949
null
78040
{ "accepted_answer_id": null, "answer_count": 1, "body": "CLLocationManagerを使って、delegateを使って通知を受ける際に、なぜプロパティとして、 \nCLLocationManager型のプロパティを持たなければいけないのでしょうか?\n\n```\n\n class LocationService: NSObject {\n private let locationManager = CLLocationManager()\n private var tag = \"\"\n \n override init() {\n super.init()\n locationManager.delegate = self\n }\n \n convenience init(tag: String) {\n self.init()\n self.tag = tag\n }\n \n func startUpdating() {\n print(\"tag:\\(tag) startUpdating\")\n locationManager.startUpdatingLocation()\n }\n \n func stopUpdating() {\n print(\"tag:\\(tag) stopUpdating\")\n locationManager.stopUpdatingLocation()\n }\n \n func checkPermisson() {\n switch CLLocationManager.authorizationStatus() {\n case .notDetermined:\n print(\"notDetermined\")\n case .restricted:\n print(\"restricted\")\n case .denied:\n print(\"denied\")\n case .authorizedAlways:\n print(\"authorizedAlways\")\n case .authorizedWhenInUse:\n print(\"authorizedWhenInUse\")\n }\n }\n }\n \n extension LocationService: CLLocationManagerDelegate {\n \n // このメソッドは locationManager.delegate = self を実行したタイミングでまず1回呼ばれる\n func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {\n print(\"tag:\\(tag) didChangeAuthorization -> \", status.rawValue)\n if status == .notDetermined {\n locationManager.requestWhenInUseAuthorization()\n }\n }\n \n func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {\n if let location = locations.last {\n let latitude = location.coordinate.latitude\n let longitude = location.coordinate.longitude\n let timestamp = location.timestamp.description\n print(\"tag:\\(tag) didUpdateLocations -> latitude:\\(latitude) longitude:\\(longitude) timestamp:\\(timestamp)\")\n }\n }\n \n func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {\n print(\"tag:\\(tag) didFailWithError -> \", error)\n }\n }\n \n```\n\n自分として、以下のように書いてもいい気もしますが、\n\n```\n\n override init() {\n super.init()\n let locationManager = CLLocationManager()\n locationManager.delegate = self\n }\n \n```\n\n様々な資料を読んでも全てプロパティにセットしてあります。 \n分かる方いましたら、ご教授お願い致します。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T05:29:11.640", "favorite_count": 0, "id": "77953", "last_activity_date": "2021-07-04T06:47:50.353", "last_edit_date": "2021-07-04T06:47:50.353", "last_editor_user_id": "3060", "owner_user_id": "47147", "post_type": "question", "score": 0, "tags": [ "swift", "delegate" ], "title": "CLLocationManagerの使い方について", "view_count": 311 }
[ { "body": "下の書き方では、`init`が終了した時に`locationManager`のインスタンスが解放され、`delegate`に`self`を保持した`locationManager`のインスタンスが無くなってしまうからです。\n\nプロパティにすると言うことは、そのクラスのインスタンスが存在する間、プロパティが破棄されないことの保証になります。\n\nしかし、インスタンスを`init`の中のローカル変数にしてしまうと、`init`が終了した際にローカル変数は破棄されますので、`locationManager`(特に`delegate`に自身を保持した)がどこにも無くなってしまうからです。", "comment_count": 8, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T05:53:25.617", "id": "77955", "last_activity_date": "2021-07-04T05:53:25.617", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "14745", "parent_id": "77953", "post_type": "answer", "score": 1 } ]
77953
null
77955
{ "accepted_answer_id": "77957", "answer_count": 1, "body": "基本的な質問にて失礼します。 \n以下のリストの中から、0番目のリストの中の、さらにインデックス0の値を **一行のコード**\nで取得するにはどうしたら良いでしょうか。よろしく、お願いいたします。\n\n```\n\n lst=[[12,18,30],[12,18,30],[24,36,60]]\n \n # やったこと: 2行のコードではできました。\n lst0=lst[0]\n lst0[0]\n \n # 12\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T06:55:31.280", "favorite_count": 0, "id": "77956", "last_activity_date": "2021-07-04T07:05:31.660", "last_edit_date": "2021-07-04T07:05:31.660", "last_editor_user_id": "3060", "owner_user_id": "47148", "post_type": "question", "score": 0, "tags": [ "python", "python3" ], "title": "リストの中の、リストの値を抽出するには", "view_count": 398 }
[ { "body": "いわゆる「多次元配列」などと呼ばれるもので、以下の通り参照すれば実現と思います。\n\n```\n\n print (lst[0][0])\n # 12\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T07:00:42.967", "id": "77957", "last_activity_date": "2021-07-04T07:00:42.967", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77956", "post_type": "answer", "score": 2 } ]
77956
77957
77957
{ "accepted_answer_id": "77961", "answer_count": 2, "body": "1行ごとに整数が入力され、最後の行がピリオド.で終了するとします。そして、入力された数の平均を計算して出力したいと思っています。イメージとしては、このように入力されたとします\n\n```\n\n 5 \n 2 \n 10 \n 1\n .\n \n```\n\nそれをこのように出力したいのです\n\n```\n\n 4.5\n \n```\n\nこのようなコードを書きました。\n\n```\n\n num = input()\n res = []\n while num != \".\":\n res.appen(num)\n if num = \".\":\n break\n print(mean(res))\n \n```\n\nその結果このようなエラーメッセージを受け取りました。\n\n```\n\n Error:\n File \"jailed_code\", line 5\n if num = \".\":\n ^\n SyntaxError: invalid syntax\n \n```\n\nこの場合、5行目が問題なのは明らかなのですが、それ以外にも問題があるかもしれません。どのようにすれば改善すれば良いでしょうか。よろしくお願いいたします。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T07:32:08.433", "favorite_count": 0, "id": "77958", "last_activity_date": "2021-07-04T09:15:06.170", "last_edit_date": "2021-07-04T08:07:43.530", "last_editor_user_id": "26370", "owner_user_id": "47136", "post_type": "question", "score": 0, "tags": [ "python", "python3" ], "title": "pythonでwhileループなどを使って平均計算の出力をする方法は?", "view_count": 637 }
[ { "body": "質問の直接の答えは`比較演算子が違う`からです。以下2つの記事を良く見てください。 \n問題の箇所は`==`が正しく、つまり`=`が一つ足らないことが原因です。\n\n[4.1. if 文](https://docs.python.org/ja/3/tutorial/controlflow.html#if-\nstatements) \n[6.10.\n比較](https://docs.python.org/ja/3/reference/expressions.html#comparisons)\n\n* * *\n\n他にはこれらの課題があります。\n\n * 数値を入力できるのが先頭行の1回だけで、複数の数値を繰り返し入力出来るようになっていません。ループの中(の先頭)に移動する必要があるでしょう。\n * `while`の条件部と、途中の`if`文の両方でループ終了を判定するのは冗長で間違いやすいので判定は1ヵ所に絞りましょう。\n * `appen()`というメソッドはありません。`append()`のtypoですね。\n * 最後の`.`を入力したら、結果を出力せずにプログラムを終了する形になっています。\n * `mean()`メソッドは`statistics`を`import`しないと使えるようにはなりません。\n * `mean()`メソッドは数値の平均を計算するものなので、`res`リストには文字列ではなくintの数値が入っていなければなりません。 \n`res`に`append`する際に`int`に変換しておくか、`mean`を計算する際または直前に`int`に変換する必要があります。\n\n * 数値を繰り返し入力出来るようになったとしても今の`print(mean(res))`の位置では数値を入力する毎に平均値を表示することになります。平均値表示の処理はどこで行うのが良いか考え直してください。\n\n[5.1.\nリスト型についてもう少し](https://docs.python.org/ja/3/tutorial/datastructures.html#more-\non-lists)\n\n> list.append(x) \n> リストの末尾に要素を一つ追加します。a[len(a):] = [x] と等価です。\n\n[statistics ---\n数理統計関数](https://docs.python.org/ja/3.9/library/statistics.html) \n[Pythonで平均、中央値、最頻値、分散、標準偏差を算出](https://note.nkmk.me/python-statistics-mean-\nmedian-mode-var-stdev/)\n\n[数値型 int, float,\ncomplex](https://docs.python.org/ja/3/library/stdtypes.html#numeric-types-int-\nfloat-complex)\n\n> 演算 結果 \n> int(x) x の整数への変換\n\n* * *\n\n`mean`を使わずに済ませるなら、直接の答えは提示していませんが、こんな記事もあります。 \n[無限ループからの平均値を出したい](https://ja.stackoverflow.com/q/70598/26370)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T08:45:52.067", "id": "77961", "last_activity_date": "2021-07-04T08:52:59.947", "last_edit_date": "2021-07-04T08:52:59.947", "last_editor_user_id": "26370", "owner_user_id": "26370", "parent_id": "77958", "post_type": "answer", "score": 1 }, { "body": "> それ以外にも問題があるかもしれません。どのようにすれば改善すれば良いでしょうか。\n\n`input()` を使用する場合、`EOF(End of File)` を検出すると `EOFError` が発生します。以下の様に\n`iteration` を利用すれば `EOF` で for loop が自動的に停止します。\n\n[7.2.1. Methods of File\nObjects](https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-\nobjects)\n\n> For reading lines from a file, you can loop over the file object. This is\n> memory efficient, fast, and leads to simple code:\n```\n\n> >>> for line in f:\n> ... print(line, end='')\n> ...\n> \n```\n\nまた、入力文字列を数値への変換する場合にエラーになる場合(非数値な文字列を入力する)を考慮して例外処理を追加します。その他に、入力値が全くない(最初に\n`.` を入力してしまう)場合に `ZeroDivisionError` が発生してしまいますので、`res` リストの要素数をチェックします。\n\n※ 以下、walrus operator(`:=`, セイウチ演算子)を使っていますので Python 3.8 以降でのみ動作します\n\n**mean.py**\n\n```\n\n import sys\n \n res = []\n for num in sys.stdin:\n num = num.strip()\n if num == '.': break\n try:\n n = float(num)\n except ValueError as e:\n print(e, file=sys.stderr)\n sys.exit(1)\n res.append(n)\n \n if (l := len(res)) > 0:\n mean = sum(res)/l\n print(f'{mean = }')\n else:\n print('there is no numbers', file=sys.stderr)\n \n```\n\nPython3 における `float`型には表現可能な数値に最小値・最大値が存在します(`int`型にはなし)。\n\n```\n\n $ python3 --version\n Python 3.9.5\n \n $ python3 -c 'import sys;print(sys.float_info)'\n sys.float_info(max=1.7976931348623157e+308, max_exp=1024,\n max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021,\n min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)\n \n```\n\nしたがって、計算結果にオーバーフローが発生する可能性があるのですが、実際には `inf`(infinity) が返ります。\n\n```\n\n $ python3 mean.py\n 1e+500\n 1e+1000\n .\n mean = inf\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T09:15:06.170", "id": "77962", "last_activity_date": "2021-07-04T09:15:06.170", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47127", "parent_id": "77958", "post_type": "answer", "score": 1 } ]
77958
77961
77961
{ "accepted_answer_id": "77974", "answer_count": 1, "body": "[前回のコメントの続き](https://ja.stackoverflow.com/questions/77953/cllocationmanager%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6)\n\n前回の質問で、CLLocationManagerクラスを使った質問を行いました。 \nその際、チャイカ様に質問に答えて頂きましたが、疑問を生じました。\n\n```\n\n class LocationService: NSObject,CLLocationManagerDelegate {\n private let locationManager = CLLocationManager()\n private var tag = \"\"\n \n override init() {\n super.init()\n locationManager.delegate = self\n }\n \n convenience init(tag: String) {\n self.init()\n self.tag = tag\n }\n \n func startUpdating() {\n print(\"tag:\\(tag) startUpdating\")\n locationManager.startUpdatingLocation()\n }\n \n func stopUpdating() {\n print(\"tag:\\(tag) stopUpdating\")\n locationManager.stopUpdatingLocation()\n }\n \n func checkPermisson() {\n switch CLLocationManager.authorizationStatus() {\n case .notDetermined:\n print(\"notDetermined\")\n case .restricted:\n print(\"restricted\")\n case .denied:\n print(\"denied\")\n case .authorizedAlways:\n print(\"authorizedAlways\")\n case .authorizedWhenInUse:\n print(\"authorizedWhenInUse\")\n }\n }\n }\n \n extension LocationService: CLLocationManagerDelegate {\n \n // このメソッドは locationManager.delegate = self を実行したタイミングでまず1回呼ばれる\n func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {\n print(\"tag:\\(tag) didChangeAuthorization -> \", status.rawValue)\n if status == .notDetermined {\n locationManager.requestWhenInUseAuthorization()\n }\n }\n \n func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {\n if let location = locations.last {\n let latitude = location.coordinate.latitude\n let longitude = location.coordinate.longitude\n let timestamp = location.timestamp.description\n print(\"tag:\\(tag) didUpdateLocations -> latitude:\\(latitude) longitude:\\(longitude) timestamp:\\(timestamp)\")\n }\n }\n \n func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {\n print(\"tag:\\(tag) didFailWithError -> \", error)\n }\n }\n \n \n```\n\n以上のコードで、必ずCLLocationManager型のインスタンスを持つプロパティを生成し、init関数が行われても削除されないためにと、CLLocationManagerクラスが持つdelegateプロパティをセットするためには、CLLocationManager型のインスタンスを生成しないといけないことを理解しました。 \nその際、delegateプロパティで指定するselfは、LocationServiceを指しており、これはCLLocationManagerDelegateプロトコルを継承しており、delegateの呼び出し先を自身に設定していることと認識致しました。LocationServiceクラスには、delegate機能の位置情報を取得した際のような具体的な処理が書かれていると認識しています。\n\nその際、チャイカ様のコメントで、 \n「ではLocationServiceクラスは何のためにあるの?という話になりませんか?」という質問を頂きました。 \n自分では、このLocationServiceクラスを他のクラスやメソッド、構造体から呼び、\n\n```\n\n var locationManager = LocationService()\n \n```\n\nのように、任意の場所で位置情報を取得するメソッドとしてこのクラスを定義していると認識しています。 \nご意見やご教授よろしくお願い致します。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T11:43:00.717", "favorite_count": 0, "id": "77964", "last_activity_date": "2021-07-04T19:26:52.827", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47147", "post_type": "question", "score": 0, "tags": [ "swift", "delegate" ], "title": "Delegateの際の、呼び出し元クラスの意味とは?", "view_count": 174 }
[ { "body": "その認識でほぼ間違い無いと思います。 \n前回の質問のコメントでは、`LocationService`に`CLLocationManagerDelegate`プロトコルをサポートした別クラスのインスタンスもプロパティに持ちたいという意図を感じました。 \nそうすると、クラス設計は\n\n```\n\n class LocationDelegates: CLLocationManagerDelegate {\n func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {\n // 中略\n }\n \n func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {\n // 中略\n }\n \n func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {\n // 中略\n }\n }\n \n```\n\nと、`CLLocationManagerDelegate`から委譲される処理を担うクラスと\n\n```\n\n class LocationService: NSObject {\n private let locationManager = CLLocationManager()\n private let locationDelegates: LocationDelegates = LocationDelegates()\n \n override init() {\n super.init()\n locationManager.delegate = locationDelegates\n }\n // 以下略\n }\n \n```\n\nと、`Core Location`をハンドリングするだけのクラスの2つのクラスの様になり、クラスが一つ増えてしまい、管理や分割の手間が増えます。 \nこれでは、`LocationService`クラスが無駄だよね?と言いたかったわけですが、今回の質問のコードで必要な内容を理解されていることが解りましたので「`LocationService`クラスは何のためにあるの?」という質問に関しては理解しておられるようなので解決済みとさせてください。\n\nもちろん、`Delegates`を複数のインスタンスから呼ばせたいが処理は共通で問題無い時には本回答のように管理・保持クラスと`Delegate`を担うクラスを分けた方がトータルでのコード量が少なくなる場合もありますが、そういうケースはレアケースだと思って下さい。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T19:21:23.930", "id": "77974", "last_activity_date": "2021-07-04T19:26:52.827", "last_edit_date": "2021-07-04T19:26:52.827", "last_editor_user_id": "14745", "owner_user_id": "14745", "parent_id": "77964", "post_type": "answer", "score": 0 } ]
77964
77974
77974
{ "accepted_answer_id": "77967", "answer_count": 3, "body": "Jupyter Notebookにて、pandas.DataFrameで作成した2つの表を、 \n同じセル内に表示させるのは可能でしょうか。\n\nもし可能なら、その方法を、ご教示ください。\n\n具体的には...\n\n以下の場合、最後のDataFrame(lst2のみ)が表示されます。\n\n```\n\n lst1=[[1,2,3],[4,5,6]]\n lst2=[[2,3,4],[5,6,7]]\n import pandas as pd\n pd.DataFrame(lst1)\n pd.DataFrame(lst2)\n \n```\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/oxW2j.png)](https://i.stack.imgur.com/oxW2j.png)\n\nそうではなく、同じセル内に、\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/dMW3D.png)](https://i.stack.imgur.com/dMW3D.png)\n\nあるいは、\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/Guetn.png)](https://i.stack.imgur.com/Guetn.png)\n\nと表示させたいと思っています。 \nよろしく、お願いいたします。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T12:20:04.173", "favorite_count": 0, "id": "77966", "last_activity_date": "2021-07-10T23:12:15.453", "last_edit_date": "2021-07-05T22:59:01.797", "last_editor_user_id": "15413", "owner_user_id": "47148", "post_type": "question", "score": 0, "tags": [ "python", "pandas", "jupyter-notebook" ], "title": "同じセル内に2つのDataFrameを表示させたい", "view_count": 803 }
[ { "body": "表示に `display()` を使用すると整った形で表示されます \n(`print()` でも内容確認する程度は可能)\n\n```\n\n import pandas as pd\n # print(df)\n display(pd.DataFrame(lst1))\n display(pd.DataFrame(lst2))\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T12:35:38.193", "id": "77967", "last_activity_date": "2021-07-04T12:35:38.193", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "43025", "parent_id": "77966", "post_type": "answer", "score": 0 }, { "body": "[28 Jupyter Notebook Tips, Tricks, and Shortcuts for Data\nScience](https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-\nshortcuts/) から引用します。\n\n> ### 2\\. Pretty Display of Variables\n>\n> What is known less, is that you can alter a modify the\n> ast_note_interactivity kernel option to make Jupyter do this for any\n> variable or statement on its own line, so you can see the value of multiple\n> statements at once.\n```\n\n> from IPython.core.interactiveshell import InteractiveShell\n> InteractiveShell.ast_node_interactivity = \"all\"\n> \n```\n\n[![display](https://i.stack.imgur.com/FoZET.png)](https://i.stack.imgur.com/FoZET.png)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T12:37:08.880", "id": "77969", "last_activity_date": "2021-07-04T12:58:54.760", "last_edit_date": "2021-07-04T12:58:54.760", "last_editor_user_id": "47127", "owner_user_id": "47127", "parent_id": "77966", "post_type": "answer", "score": 0 }, { "body": "```\n\n matplotlib.pyplot as plt\n plt.show\n \n```\n\nを利用する方法もありました。\n\n```\n\n import pandas as pd\n \n lst1=[[1,2,3],[4,5,6]]\n lst2=[[2,3,4],[5,6,7]]\n \n import matplotlib.pyplot as plt\n \n df1=pd.DataFrame(lst1)\n df1.plot()\n plt.show()\n \n df2=pd.DataFrame(lst2)\n df2.plot()\n plt.show()\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-10T23:12:15.453", "id": "78099", "last_activity_date": "2021-07-10T23:12:15.453", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47148", "parent_id": "77966", "post_type": "answer", "score": 0 } ]
77966
77967
77967
{ "accepted_answer_id": "78081", "answer_count": 2, "body": "# 前置き\n\nUnity を用いてオリジナルゲームを制作しています。 \nプレイヤーの操作するキャラクターに足音を実装する作業を行っており、 \n現在は以下のサイトを参考に、キャラクターの足が接触したオブジェクトの tag を検知して再生するクリップを切り替えるプログラムを書いています。\n\n[Unityで効果音とBGMを付ける (1) ~足音の基本と応用~](https://acua-\npiece.com/post/186042580240/game-audio-with-unity-footsteps)\n\n* * *\n\n# 本題\n\nDictionaryでtagの名前(string)と対応する番号(int)を決めて置き、if文を使って取得したtagの名前に一致するKeyがあるか調べてクリップを再生するメソッドをつくりました。\n\n```\n\n public void RelayedTrigger(Collider other)\n {\n if(tagToIndex.ContainsKey(other.gameObject.tag))\n {\n groundIndex = tagToIndex[other.gameObject.tag];\n }\n }\n \n```\n\n`tagToIndex`にtagの名前と番号を対応させたDictionaryを代入しており、 \n`groundIndex`で最終的に再生するクリップを決定しています。\n\n## 期待\n\n実際に動作させたときには、if文中の内容が実行されてほしいのですが↓\n\n## 結果\n\nなぜか実行されません(elseで確認)。 \nなので、取得したtag名はtagToIndexのKeyに含まれていないということなのだと思いますが、 \nしかし↓\n\n## 詳細\n\ntagToIndexはちゃんと宣言・初期化できており(foreachで確認)、 \nKey名とtag名も一致しています。\n\n## 補足\n\n### 追記1 : tagToIndex\n\n`tagToIndex` ディクショナリに関連しているものを集めました。 \n`listAudioClips` にオブジェクトのtagと同名の要素を格納しています。\n\n```\n\n public class FootStepSEHandler : MonoBehaviour\n {\n [System.Serializable]\n public class AudioClips\n {\n public string groundTypeTag;\n }\n \n [SerializeField] List<AudioClips> listAudioClips = new List<AudioClips>();\n \n private Dictionary<string, int> tagToIndex = new Dictionary<string, int>();\n \n private void Awake()\n {\n for (int i = 0; i < listAudioClips.Count(); ++i)\n tagToIndex.Add(listAudioClips[i].groundTypeTag, i);\n }\n }\n \n```\n\n### 追記2\n\nどうやら足が地面に接触し、地面の`tag`を取得する前に足の親要素であるオブジェクトのコライダに判定をとられてしまい、その親のオブジェクトの`tag`を`tagToIndex`の`Key`と照らし合わせてしまっているようです。\n\n### 追記3\n\nレイヤーと _LeyerCollisionMatrix_ を用いてプレイヤーと足のコライダとの間で判定が \n起こらないようにしました。 \nしかし、そもそも足のコライダが地面のコライダと接触していないようです。(`OnTriggerEnter()`が呼び出されていない)", "comment_count": 8, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T14:27:42.077", "favorite_count": 0, "id": "77971", "last_activity_date": "2021-07-09T13:56:34.733", "last_edit_date": "2021-07-09T13:09:09.380", "last_editor_user_id": "43447", "owner_user_id": "43447", "post_type": "question", "score": 1, "tags": [ "c#", "unity3d" ], "title": "if文とDictionary.ContainsKey", "view_count": 413 }
[ { "body": "本題に提示されているコードに不審な点は見つかりません。 \n単純に tagToIndex に other.gameObject.tag のキーが存在しないことを疑うべきでしょう。\n\nAwake() で存在確認できていても、RelayedTrigger()\n実行時にそのキーが存在するとは限りません。実行前に他のコードによって変更される可能性が否定できないためです。 \nなので、検証コードは RelayedTrigger() に実装して確認するのがよいと思います。\n\n例えば、以下のようにします。\n\n```\n\n using System;\n using System.Linq;\n \n public void RelayedTrigger(Collider other)\n {\n if (tagToIndex.ContainsKey(other.gameObject.tag))\n {\n groundIndex = tagToIndex[other.gameObject.tag];\n }\n else\n {\n // 検証用コード:見つからないときに詳細にチェックする\n string tag = other.gameObject.tag;\n bool exists = false;\n Debug.Log(\"Check...\");\n foreach (var key in tagToIndex.Keys)\n {\n Debug.Log($\"Key: {GetStringWithHex(key)}\");\n if (key == tag)\n {\n Debug.Log(\"** Find !! **\");\n exists = true;\n }\n }\n Debug.Log(\"Check done.\");\n Debug.Log($\"{GetStringWithHex(tag)} は\" + (exists ? \"見つかりました\" : \"見つかりませんでした\"));\n Debug.Break(); // 実行を中断\n }\n }\n \n // 文字列に16新数表示を追加\n private string GetStringWithHex(string input)\n {\n return $\"{input}({string.Join(\"-\", input.ToCharArray().Select(e => Convert.ToInt32(e).ToString(\"X2\")))})\";\n }\n \n```", "comment_count": 6, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T11:06:06.727", "id": "78007", "last_activity_date": "2021-07-07T01:04:43.177", "last_edit_date": "2021-07-07T01:04:43.177", "last_editor_user_id": "14817", "owner_user_id": "14817", "parent_id": "77971", "post_type": "answer", "score": 4 }, { "body": "# 感謝\n\n皆様の提案をもとに自己解決いたしました。ありがとうございます。\n\n# 解決方法\n\nコライダと`OnCollisionEnter()`、`OnTriggerEnter()`などの関数を使う際は、 \n衝突・侵入するコライダのアタッチされたオブジェクトのどちらか一方にリジッドボディ \nコンポーネントがなければいけないようです。\n\n判定を取得しているコライダのアタッチされたオブジェクト(プレイヤキャラクタの足)に \nリジッドボディをアタッチすることですべて解決しました。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-09T13:56:34.733", "id": "78081", "last_activity_date": "2021-07-09T13:56:34.733", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "43447", "parent_id": "77971", "post_type": "answer", "score": 0 } ]
77971
78081
78007
{ "accepted_answer_id": "77975", "answer_count": 1, "body": "現在、社内で依頼されて、C#のWPFで一覧にチェック入れて保存する画面を作成しています。 \nWPFは初めてなのですが、調べながらすすめています。 \nイベントハンドリングやDBへの登録の仕組みは作ることができました。\n\nしかし、動的レイアウトで画面に記載した赤枠内の1段2段構成の表が動的に作成できません。(静的でもうまくいきません)\n\nGRIDを作成して、行を追加するプログラム(RowDefinitions.Add)を組めば、赤枠の中が1セットで次々連続になることはわかっています。\n\nこのレイアウト部分について、どのように書けばいいのか教えていただけないでしょうか。\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/2zjYo.png)](https://i.stack.imgur.com/2zjYo.png)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T15:40:03.713", "favorite_count": 0, "id": "77972", "last_activity_date": "2021-07-05T22:13:27.180", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47156", "post_type": "question", "score": 0, "tags": [ "c#", "wpf" ], "title": "WPFでの表の動的レイアウト生成の方法について", "view_count": 2221 }
[ { "body": "質問するときは環境に関する情報を詳しく記述しましょう。\n\n * [技術系メーリングリストで質問するときのパターン・ランゲージ](https://www.hyuki.com/writing/techask.html#env)\n\nまずはVisual Studioのバージョンや、ターゲットフレームワークのバージョン (.NET Frameworkまたは.NET Coreのバージョン)\nを提示してください。バージョンによって利用できる機能が変わるため、回答も変わる可能性があります。\n\nひとまずVisual Studio 2015以降、.NET Framework 4.5以降の環境であると仮定します。\n\nテーブル内のすべてのレコードについて、カラムの数と種別が同じなのであれば、 \nわざわざ[Grid](https://docs.microsoft.com/en-\nus/dotnet/api/system.windows.controls.grid)を使うまでもなく、[ListView](https://docs.microsoft.com/en-\nus/dotnet/api/system.windows.controls.listview)を使って[GridViewColumn](https://docs.microsoft.com/en-\nus/dotnet/api/system.windows.controls.gridviewcolumn)の`Header`と`CellTemplate`を指定すればよいと思います。\n\nまた、WPFではデータバインディングを使い、MVVMパターンで実装するのがセオリーです。 \n[INotifyPropertyChanged](https://docs.microsoft.com/en-\nus/dotnet/api/system.componentmodel.inotifypropertychanged)インターフェイスを実装することで双方向バインディングもできます。 \n双方向バインディングでは、バインディングターゲット (View) への操作がバインディングソース (ViewModel)\nに直接反映され、またバインディングソースへの操作がバインディングターゲットに直接反映されるので、コードビハインドで個々の[Control](https://docs.microsoft.com/en-\nus/dotnet/api/system.windows.controls.control)や[UIElement](https://docs.microsoft.com/en-\nus/dotnet/api/system.windows.uielement)を操作するコードを書く必要がありません。\n\nMVVM実装を簡素化する[Prism](https://prismlibrary.com/index.html)などの外部フレームワークもありますが、とりあえず標準ライブラリのみを使用したオーソドックスなコードを書いておきます。\n\nMainWindow.xaml:\n\n```\n\n <Window x:Class=\"WpfApplication1.MainWindow\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n xmlns:local=\"clr-namespace:WpfApplication1\"\n mc:Ignorable=\"d\"\n Title=\"MainWindow\" Width=\"550\" Height=\"350\"\n WindowStartupLocation=\"CenterScreen\"\n >\n <Grid Margin=\"10\">\n <Grid.RowDefinitions>\n <RowDefinition Height=\"Auto\"/>\n <RowDefinition Height=\"*\"/>\n <RowDefinition Height=\"10\"/>\n <RowDefinition Height=\"Auto\"/>\n </Grid.RowDefinitions>\n <Label Grid.Row=\"0\" Content=\"チェック表:\"/>\n <ListView Grid.Row=\"1\" x:Name=\"listView1\" ItemsSource=\"{Binding}\" VirtualizingPanel.IsVirtualizing=\"True\" ScrollViewer.VerticalScrollBarVisibility=\"Visible\">\n <ListView.ItemContainerStyle>\n <Style TargetType=\"ListViewItem\">\n <Setter Property=\"HorizontalContentAlignment\" Value=\"Stretch\" />\n </Style>\n </ListView.ItemContainerStyle>\n <ListView.View>\n <GridView>\n <GridViewColumn Header=\"要約\" DisplayMemberBinding=\"{Binding Path=Summary}\">\n </GridViewColumn>\n <GridViewColumn Header=\"チェック時刻\">\n <GridViewColumn.CellTemplate>\n <DataTemplate>\n <TextBox Width=\"100\" Text=\"{Binding Path=CheckedDateTime, StringFormat={}{0:yyyy-MM-dd HH:mm}}\"/>\n </DataTemplate>\n </GridViewColumn.CellTemplate>\n </GridViewColumn>\n <GridViewColumn Header=\"チェック内容1\">\n <GridViewColumn.CellTemplate>\n <DataTemplate>\n <CheckBox HorizontalAlignment=\"Center\" IsChecked=\"{Binding IsItem1Checked}\"/>\n </DataTemplate>\n </GridViewColumn.CellTemplate>\n </GridViewColumn>\n <GridViewColumn Header=\"チェック内容2\">\n <GridViewColumn.CellTemplate>\n <DataTemplate>\n <CheckBox HorizontalAlignment=\"Center\" IsChecked=\"{Binding IsItem2Checked}\"/>\n </DataTemplate>\n </GridViewColumn.CellTemplate>\n </GridViewColumn>\n <GridViewColumn Header=\"チェック内容3\">\n <GridViewColumn.CellTemplate>\n <DataTemplate>\n <CheckBox HorizontalAlignment=\"Center\" IsChecked=\"{Binding IsItem3Checked}\"/>\n </DataTemplate>\n </GridViewColumn.CellTemplate>\n </GridViewColumn>\n <GridViewColumn Header=\"チェック内容4\">\n <GridViewColumn.CellTemplate>\n <DataTemplate>\n <CheckBox HorizontalAlignment=\"Center\" IsChecked=\"{Binding IsItem4Checked}\"/>\n </DataTemplate>\n </GridViewColumn.CellTemplate>\n </GridViewColumn>\n </GridView>\n </ListView.View>\n <ListView.ItemsPanel>\n <ItemsPanelTemplate>\n <VirtualizingStackPanel Orientation=\"Vertical\" CanVerticallyScroll=\"True\"/>\n </ItemsPanelTemplate>\n </ListView.ItemsPanel>\n </ListView>\n <Button Grid.Row=\"3\" x:Name=\"buttonRegister\" Content=\"登録\" HorizontalAlignment=\"Right\" Padding=\"15,0\" Click=\"buttonRegister_Click\"/>\n </Grid>\n </Window>\n \n```\n\nMainWindow.xaml.cs:\n\n```\n\n using System;\n using System.Collections.Generic;\n using System.Collections.ObjectModel;\n using System.ComponentModel;\n using System.Linq;\n using System.Runtime.CompilerServices;\n using System.Text;\n using System.Threading.Tasks;\n using System.Windows;\n using System.Windows.Controls;\n using System.Windows.Data;\n using System.Windows.Documents;\n using System.Windows.Input;\n using System.Windows.Media;\n using System.Windows.Media.Imaging;\n using System.Windows.Navigation;\n using System.Windows.Shapes;\n \n namespace WpfApplication1\n {\n /// <summary>\n /// MainWindow.xaml の相互作用ロジック\n /// </summary>\n public partial class MainWindow : Window\n {\n public MainWindow()\n {\n InitializeComponent();\n \n // バインディングソースの作成。\n for (int i = 0; i < 10; ++i)\n {\n var obj = new MyViewModel() { Summary = $\"{i} についての確認\" };\n _viewModel.Add(obj);\n }\n \n // バインディングソースの設定。\n // ItemsSource に対応する。\n this.listView1.DataContext = _viewModel;\n }\n \n private readonly ObservableCollection<MyViewModel> _viewModel = new ObservableCollection<MyViewModel>();\n \n private static string ToYorN(bool x)\n {\n return x ? \"Y\" : \"N\";\n }\n \n private void buttonRegister_Click(object sender, RoutedEventArgs e)\n {\n // テスト。\n var sb = new StringBuilder();\n foreach (var obj in _viewModel)\n {\n string line = $\"{obj.Summary}: Time={obj.CheckedDateTime:yyyy-MM-dd HH:mm}, #1={ToYorN(obj.IsItem1Checked)}, #2={ToYorN(obj.IsItem2Checked)}, #3={ToYorN(obj.IsItem3Checked)}, #4={ToYorN(obj.IsItem4Checked)}\";\n System.Diagnostics.Debug.WriteLine(line);\n sb.Append(line);\n sb.Append(\"\\n\");\n }\n MessageBox.Show(sb.ToString());\n }\n }\n \n public class MyViewModel : INotifyPropertyChanged\n {\n public event PropertyChangedEventHandler PropertyChanged;\n protected void NotifyPropertyChanged([CallerMemberName] string propertyName = \"\")\n {\n this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));\n }\n \n private string _summary = \"\";\n private DateTime _checkedDateTime = new DateTime();\n private bool _isItem1Checked = false;\n private bool _isItem2Checked = false;\n private bool _isItem3Checked = false;\n private bool _isItem4Checked = false;\n \n public string Summary\n {\n get { return _summary; }\n set\n {\n _summary = value;\n this.NotifyPropertyChanged();\n }\n }\n \n public DateTime CheckedDateTime\n {\n get { return _checkedDateTime; }\n set\n {\n _checkedDateTime = value;\n this.NotifyPropertyChanged();\n }\n }\n \n public bool IsItem1Checked\n {\n get { return _isItem1Checked; }\n set\n {\n _isItem1Checked = value;\n this.NotifyPropertyChanged();\n }\n }\n \n public bool IsItem2Checked\n {\n get { return _isItem2Checked; }\n set\n {\n _isItem2Checked = value;\n this.NotifyPropertyChanged();\n }\n }\n \n public bool IsItem3Checked\n {\n get { return _isItem3Checked; }\n set\n {\n _isItem3Checked = value;\n this.NotifyPropertyChanged();\n }\n }\n \n public bool IsItem4Checked\n {\n get { return _isItem4Checked; }\n set\n {\n _isItem4Checked = value;\n this.NotifyPropertyChanged();\n }\n }\n }\n }\n \n```\n\nもしレコードごとにチェックボックスの説明テキストを変えたいのであれば、例えばViewModelクラスに`string`型のプロパティ\n(`Item1Description`, `Item2Description`, ...)\nを別途用意して、[CheckBox](https://docs.microsoft.com/en-\nus/dotnet/api/system.windows.controls.checkbox)の`Content`プロパティにバインディングするなどの方法があります。 \nあとは自分で応用してください。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-04T19:41:46.487", "id": "77975", "last_activity_date": "2021-07-05T22:13:27.180", "last_edit_date": "2021-07-05T22:13:27.180", "last_editor_user_id": "15413", "owner_user_id": "15413", "parent_id": "77972", "post_type": "answer", "score": 2 } ]
77972
77975
77975
{ "accepted_answer_id": "77981", "answer_count": 2, "body": "OS: CentOS \nWebサーバ: nginx \nフレームワーク: DokuWiki\n\nDokuWikiでサイトを作っています。 \nDokuWikiの機能でサイトマップを自動生成してくれるのですが、ファイル名が`sitemap.xml.gz`となっています。\n\nブラウザで`http://example.com/sitemap.xml.gz`にアクセスすると、画面には何も表示されず、`sitemap.xml.gz`のダウンロードが始まります。\n\nこの、ファイルが勝手にダウンロードされる状態は正常動作なのでしょうか? \n(このままで検索エンジンはサイトマップを認識できるのでしょうか?)\n\n* * *\n\nドキュメントルート: `/home/user1/dokuwiki` \nサイトマップのパス: `/home/user1/dokuwiki/data/cache/sitemap.xml.gz`\n\n```\n\n lication = /sitemap.xml.gz {\n root /home/user1/dokuwiki/data/cache\n }\n \n```\n\nnginxの.confには上記のような設定をしています。\n\n* * *\n\nたとえば`.php`の場合、 \nnginxの設定が不十分だと、アクセスしたときにダウンロードになってしまいます。 \nしかし、fastcgiの設定をしてやるとphpが実行されてページが表示されます。\n\n`.gz`の場合も、 \n何か設定してやると、gzipが展開されて中身がブラウザで表示されたりするのでしょうか?\n\n* * *\n\n質問\n\n 1. `.gz`がダウンロードされるのは正常動作なのか? \n(このままで検索エンジンがサイトマップを認識できるのか?)\n\n 2. `.gz`を自動的に展開してブラウザ上にサイトマップを表示させることは可能か?\n\n`.gz`のままで検索エンジンが認識できたとしても、ブラウザ上で人の目で見えるサイトマップは欲しいなと思いまして。 \n新規に作成したページがサイトマップに反映しているか目視で確認したいので。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T00:26:01.327", "favorite_count": 0, "id": "77977", "last_activity_date": "2021-07-05T04:35:45.777", "last_edit_date": "2021-07-05T04:35:45.777", "last_editor_user_id": "3060", "owner_user_id": "45540", "post_type": "question", "score": 0, "tags": [ "nginx", "google-search" ], "title": "ブラウザでsitemap.xml.gzが表示されない。勝手にダウンロードが始まるが正常動作なのか?", "view_count": 974 }
[ { "body": "[sitemaps](https://www.sitemaps.org/ja/protocol.html#index)の仕様によると、\n\n> 複数のサイトマップ ファイルを送信できますが、各サイトマップ ファイルにリストする URL は 50,000 個まで、ファイル サイズは50 MB\n> (52,428,800 バイト) 以下とする必要があります。 \n> 必要な場合は、サイトマップ ファイルを gzip 形式で 50 MB 以下に圧縮して、サーバーの負荷を軽減できます。 \n> 50,000 個以上の URL をリストする場合は、複数のサイトマップファイルを作成する必要があります。\n\nとあります。 \n[Google](https://developers.google.com/search/docs/advanced/sitemaps/large-\nsitemaps?hl=ja)のほうも\n\n> 構文について詳しくは、サイトマップ プロトコルのページをご覧ください。\n\nとありますので、gzで圧縮されていてもサーチエンジンで解析してもらえるようです。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T02:12:35.467", "id": "77978", "last_activity_date": "2021-07-05T02:12:35.467", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "22665", "parent_id": "77977", "post_type": "answer", "score": 1 }, { "body": "拡張子 `.gz` は gzip と呼ばれる圧縮形式の一つであり、基本的にはブラウザで直接表示することはありません (URL\nを指定してダウンロードが始まるのは正常です)。\n\n`sitemap.xml` 自体は主に検索エンジン (クローラ) に読ませるのが目的なので、正常に中身が出力されているかを確認したければ、いったん\n`sitemap.xml.gz` をローカルに保存してアーカイバで展開すれば `sitemap.xml` を取り出すことができるはずです。\n\n**参考:** \n<https://www.dokuwiki.org/ja:sitemap>\n\n> サイトマップファイルは DokuWiki の cache サブディレクトリに設置されます。 ファイルは\n> http://your_domain/dokuwiki/doku.php?do=sitemap という URL でアクセスできます。\n> インストールされている PHP で gzip が利用可能かによって、ファイル名は sitemap.xml.gz (gzip が利用可能な場合) または\n> sitemap.xml (gzip が利用できない場合) となります。 最近の PHP は gzip サポートが有効な場合が多いので、ほとんどが\n> sitemap.xml.gz です。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T03:21:43.143", "id": "77981", "last_activity_date": "2021-07-05T03:21:43.143", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77977", "post_type": "answer", "score": 1 } ]
77977
77981
77978
{ "accepted_answer_id": "77983", "answer_count": 1, "body": "python+streamlitで、短期間にWebアプリを作ろうとしてします。 \n又、短いコードで描画を行えるライブラリとして、plotlyを候補にしています。そこで、件名の質問に至った次第です。\n\n現状は、自由に描画できる機能を探し出せていません。グラフに特化した描画機能のみです \n(これはplotlyの目的がそうだからかもしれません)。 \nので、何とか自由に描画を行えないか探しています。\n\n\"自由に描画\"する処理とは、下記の通りです。 \n・実在しない地図画像を1枚 Webブラウザのクライアント領域に描く \n・その上に、●と直線を数百本描く \n・上述は、Google Mapのようの拡縮と指定移動ができるようにする \n・●と直線は、クリックで操作できるようにする\n\nplotlyで出来ないなら、「皆様が経験済」のお勧めのライブラリを教えて頂けると幸いです。\n\n※極力自分で調べましたが、調査時間が無い為 経験者の皆様の知恵をお借りしたい次第です。\n\n【環境】 \npython3.9 \nstreamlit 0.83.0 \nWin10 20H2 \n仮想環境 未使用\n\nどうぞよろしくお願いします。", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T03:04:57.060", "favorite_count": 0, "id": "77980", "last_activity_date": "2022-01-11T06:58:39.777", "last_edit_date": "2022-01-11T06:58:39.777", "last_editor_user_id": "3060", "owner_user_id": null, "post_type": "question", "score": 1, "tags": [ "python", "python3", "plotly-python" ], "title": "plotly には、自由に点や線や画像を描画する機能はあるでしょうか?", "view_count": 1644 }
[ { "body": "「plotlyでCanvasに自由に描画」する機能はあります。 \n[点や線](https://plotly.com/python/shapes/)や[画像](https://plotly.com/python/images/)を描画可能です。 \nしかしサンプルコードの通りグラフに特化した描画機能の延長で描画しているので、若干無理やりな感じは否めません。\n\n目的や用途、そしてPythonコードのみで解決すべきかThree.jsなどjavascript側の描画フレームワークを使って良いのかなどの条件を質問文に追記していただけるとより的確な回答を得やすいかもしれません。\n\nコメントにあるように「利用者が自由に描画」できる仕組みは[streamlit-drawable-\ncanvas](https://discuss.streamlit.io/t/drawable-canvas/3671)などのライブラリが用意されています。\n\n**サンプルコード**\n\n```\n\n import plotly.graph_objects as go\n \n fig = go.Figure()\n \n # Create scatter trace of text labels\n fig.add_trace(go.Scatter(\n x=[1, 1.75, 2.5],\n y=[1, 1, 1],\n text=[\"$Stack$\", \"$Stackoverflow$\", \"$overflow$\"],\n mode=\"text\",\n textfont=dict(\n color=\"black\",\n size=18,\n family=\"Arail\",\n )\n ))\n \n # Update axes properties\n fig.update_xaxes(\n showticklabels=False,\n showgrid=False,\n zeroline=False,\n )\n \n fig.update_yaxes(\n showticklabels=False,\n showgrid=False,\n zeroline=False,\n )\n \n # Add image\n fig.add_layout_image(\n dict(\n source=\"https://raw.githubusercontent.com/michaelbabyn/plot_data/master/benzene.png\",\n x=0.8,\n y=0.65,\n ))\n \n fig.update_layout_images(dict(\n sizex=0.3,\n sizey=0.3,\n xanchor=\"left\",\n yanchor=\"top\" \n ))\n \n # Add circles\n fig.add_shape(type=\"circle\",\n line_color=\"blue\", fillcolor=\"yellow\",\n x0=0, y0=0, x1=2.25, y1=2\n )\n fig.add_shape(type=\"circle\",\n line_color=\"gray\", fillcolor=\"orange\",\n x0=1.25, y0=0, x1=3.5, y1=2\n )\n \n # Add rect\n fig.add_shape(type=\"rect\", x0=0,y0=0.178,x1=3.5,y1=1.83)\n \n fig.update_shapes(opacity=0.3, xref=\"x\", yref=\"y\")\n \n fig.update_layout(\n margin=dict(l=20, r=20, b=100),\n height=600, width=800,\n plot_bgcolor=\"white\" \n )\n \n fig.show()\n \n```\n\n![サンプルコード実行結果](https://i.stack.imgur.com/n5fyH.png)", "comment_count": 5, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T05:24:46.633", "id": "77983", "last_activity_date": "2021-07-05T05:24:46.633", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9820", "parent_id": "77980", "post_type": "answer", "score": 0 } ]
77980
77983
77983
{ "accepted_answer_id": null, "answer_count": 2, "body": "プログラミングに関しては初心者です。 \n現在、ラズベリーパイの起動と同時にpythonプログラムを実行したいと考えております。\n\nインターネット等を検索調査し、systemdを使うと起動と同時にpythonプログラムも起動できる事が解り、作成しましたが、何度やってもエラーが出てきます。\n\nsystemed,pythonを見直しても原因が分からないので、ご教示お願いいたします。\n\nラズベリーパイの電源on/offはRPZ-PowerMGRを購入し対応しました。\n\nsystemdコード \n/etc/systemd/system\n\n```\n\n [Unit]\n Description = test\n [Service]\n ExecStart=/opt/RasPiSample/bin/2.2.1_Photoresistor.py\n Restart=always\n Type=simple\n [Install]\n WantedBy=multi-user.target\n \n```\n\nPythonのコード\n\n```\n\n #!usr/bin/python3.7.3\n import RPi.GPIO as GPIO\n import ADC0834\n import datetime\n \n```\n\n**エラーメッセージ:**\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/HbywF.png)](https://i.stack.imgur.com/HbywF.png)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T06:37:46.393", "favorite_count": 0, "id": "77985", "last_activity_date": "2022-08-12T03:10:21.020", "last_edit_date": "2021-07-05T07:44:52.500", "last_editor_user_id": "3060", "owner_user_id": "47165", "post_type": "question", "score": 0, "tags": [ "python", "raspberry-pi", "systemd" ], "title": "ラズベリーパイにてsystemdを用い、pythonプログラムを自動起動させたいです。", "view_count": 713 }
[ { "body": "質問に貼られた Python コードでは、1行目 (`#!` 行) に誤りがあるように見えます。 \n先頭の `/` が足りないようなので、こちらを追加して試してみてください。\n\n**元のコード:**\n\n```\n\n #!usr/bin/python3.7.3\n \n```\n\n**修正後:**\n\n```\n\n #!/usr/bin/python3.7.3\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T07:47:18.527", "id": "77988", "last_activity_date": "2021-07-05T07:47:18.527", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "77985", "post_type": "answer", "score": 0 }, { "body": "遅くなってしまい申し訳ございません。\n\nsystemd と Python に関しては下記で問題なく稼働しました。\n\n何をやりたかったかというと、光センサーを用いて機械についている信号灯を読み取り稼働率の調査を行っております。\n\n* * *\n\n**/etc/systemd/system/RasPiAuto.service**\n\n```\n\n [Unit]\n Description = test\n \n [Service]\n ExecStart = /usr/bin/env python3 /opt/RasPiSample/bin/2.2.1_Photoresistor.py\n \n Restart = no\n Type=simple\n \n [Install]\n WantedBy = multi-user.target\n \n```\n\n**Python スクリプト**\n\n```\n\n #!/usr/bin/env python3\n \n import RPi.GPIO as GPIO\n import ADC0834\n import datetime\n import csv\n import time\n \n LedPin = 22\n \n def setup():\n global led_val\n # Set the GPIO modes to BCM Numbering\n GPIO.setmode(GPIO.BCM)\n # Set all LedPin's mode to output and initial level to High(3.3v)\n GPIO.setup(LedPin, GPIO.OUT, initial=GPIO.HIGH)\n ADC0834.setup()\n # Set led as pwm channel and frequece to 2KHz\n led_val = GPIO.PWM(LedPin, 2000)\n \n # Set all begin with value 0\n led_val.start(0)\n \n def nowtime():\n now = datetime.datetime.now()\n nowtime = '{0:%Y/%m/%d %H:%M:%S}'.format(now)\n \n \n def save():\n with open('/home/pi/Desktop/cp_log.csv','a') as f:\n writer = csv.writer(f)\n writer.writerow([datetime.datetime.now(), ADC0834.getResult()])\n \n def destroy():\n # Stop all pwm channel\n led_val.stop()\n # Release resource\n GPIO.cleanup()\n \n def loop():\n while True:\n analogVal = ADC0834.getResult()\n now = datetime.datetime.now()\n nowTime = '{0:%Y/%m/%d %H:%M:%S}'.format(now)\n save()\n print (nowTime, end=' ')\n print ('CP1 = %d' % analogVal)\n led_val.ChangeDutyCycle(analogVal*100/255)\n time.sleep(0.975)\n \n if __name__ == '__main__':\n setup()\n try:\n loop()\n except KeyboardInterrupt: # When 'Ctrl+C' is pressed, the program destroy() will be executed.\n destroy()\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-08-05T05:00:50.063", "id": "80608", "last_activity_date": "2021-08-05T06:19:21.603", "last_edit_date": "2021-08-05T06:19:21.603", "last_editor_user_id": "3060", "owner_user_id": "47166", "parent_id": "77985", "post_type": "answer", "score": 1 } ]
77985
null
80608
{ "accepted_answer_id": "77990", "answer_count": 3, "body": "pandas.DatFrameで作成したクロス図について、以下のように、 \na行、b行それぞれの比率を表すクロス図に再構築したいと思っています。\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/5qd2y.png)](https://i.stack.imgur.com/5qd2y.png)\n\n作業を何ステップに分け(無理やり)できましたが、 \nもっと、シンプルに記述する方法は、ないでしょうか。 \nよろしく、お願いいたします。\n\n```\n\n import pandas as pd\n lst=[[120,80,300],[280,120,400]]\n df1=pd.DataFrame(lst,index=['a','b'],columns=['A','B','合計'])\n df1\n \n```\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/AAUb4.png)](https://i.stack.imgur.com/AAUb4.png)\n\n```\n\n #A列、B列を抽出する\n df2=df1.loc[:,['A','B']]\n df2\n \n```\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/KEPlr.png)](https://i.stack.imgur.com/KEPlr.png)\n\n```\n\n #それぞれを比率にする\n df3= ((df.div(df.sum(1),axis=0)))\n df3\n \n```\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/ZPYjP.png)](https://i.stack.imgur.com/ZPYjP.png)\n\n```\n\n # 「合計」列を追加する\n df4=df3.assign(合計=1.0)\n df4\n \n```\n\n[![画像の説明をここに入力](https://i.stack.imgur.com/MVdjZ.png)](https://i.stack.imgur.com/MVdjZ.png)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T06:49:51.103", "favorite_count": 0, "id": "77986", "last_activity_date": "2021-07-05T07:55:17.523", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47148", "post_type": "question", "score": 2, "tags": [ "python3", "pandas" ], "title": "pd.DataFrameを、比率を示す図に再構築したい", "view_count": 372 }
[ { "body": "各行に対してapplyすることでlambda式で列の比率を求めることができます。\n\n```\n\n import pandas as pd\n \n lst = [[120,80,200],[280,120,400]]\n df1 = pd.DataFrame(lst, index=['a','b'], columns=['A','B','合計'])\n df2 = df1.apply(lambda x : [x[c] / x['合計'] for c in df1], axis=1)\n print(df2)\n \n #出力結果\n a [0.6, 0.4, 1.0]\n b [0.7, 0.3, 1.0]\n dtype: object\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T07:41:39.263", "id": "77987", "last_activity_date": "2021-07-05T07:41:39.263", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "9820", "parent_id": "77986", "post_type": "answer", "score": 0 }, { "body": "まず, 合計を算出するところから。 \n割合は, 前の行との比較・割合なら pandasで用意されてるものがあるけど, このような場合は見つからなかったので普通に計算\n\n```\n\n import pandas as pd\n lst=[[120,80], [280,120]]\n df = pd.DataFrame(lst, index=['a','b'], columns=['A','B'])\n \n df['合計'] = df.sum(axis=1)\n for item in ['A', 'B']:\n df[f'{item}(割合)'] = df[item] / df['合計']\n \n display(df)\n print()\n df[['A(割合)', 'B(割合)', '合計']]\n \n```\n\n[![結果](https://i.stack.imgur.com/cs6Le.png)](https://i.stack.imgur.com/cs6Le.png)", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T07:47:22.930", "id": "77989", "last_activity_date": "2021-07-05T07:47:22.930", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "43025", "parent_id": "77986", "post_type": "answer", "score": 0 }, { "body": "以下は\n[pandas.DataFrame.div](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.div.html#pandas-\ndataframe-div) を使う方法です。\n\n※ `120 + 80 = 200` なので `lst` を一部修正しています。\n\n```\n\n lst = [[120,80,200],[280,120,400]]\n df1 = pd.DataFrame(lst,index=['a','b'],columns=['A','B','合計'])\n \n pd.set_option('display.unicode.east_asian_width', True)\n print(df1.div(df1['合計'], axis=0))\n \n #\n A B 合計\n a 0.6 0.4 1.0\n b 0.7 0.3 1.0\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T07:48:42.330", "id": "77990", "last_activity_date": "2021-07-05T07:55:17.523", "last_edit_date": "2021-07-05T07:55:17.523", "last_editor_user_id": "47127", "owner_user_id": "47127", "parent_id": "77986", "post_type": "answer", "score": 0 } ]
77986
77990
77987
{ "accepted_answer_id": "77994", "answer_count": 1, "body": "C言語による開発を行っているのですが、C言語のヘッダーファイル(*.h)をSublimeText3で開くとC++のシンタックス・ハイライトが適用されてしまいます。 \nハイライトがうまく行っていれば別に良いのですが、`#pragma once`以降のハイライトがうまくいっておらずプレインなテキストになってしまっています。 \nそのたびにC言語のシンタックス・ハイライトに戻しているのですが、これをどうにかしたいです。 \n一番いいのは`*.h`なファイルを開いたときにC言語のシンタックス・ハイライトが適用されることです。\n\n使っているSublimeText3は`build 4107`です。 \nよろしくお願いします。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T11:44:47.877", "favorite_count": 0, "id": "77993", "last_activity_date": "2021-07-05T11:52:32.753", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "25852", "post_type": "question", "score": 1, "tags": [ "sublimetext" ], "title": "SublimeText3でC++のシンタックスを無効化するには?", "view_count": 43 }
[ { "body": "自己解決しました。 \n右下の言語名から「Open all with current extension as\n...」をクリックし、言語名をクリックすると、その拡張子のファイルが指定の言語名になりました。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T11:52:32.753", "id": "77994", "last_activity_date": "2021-07-05T11:52:32.753", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "25852", "parent_id": "77993", "post_type": "answer", "score": 2 } ]
77993
77994
77994
{ "accepted_answer_id": "77997", "answer_count": 1, "body": "### 現状\n\nドキュメントルートより上に、(実質的にはsvgである)hoge.phpを配置しています。 \n出力したい箇所(html)で、hoge.phpを読み込み、svgを表示しています。\n\nhoge.php\n\n```\n\n <svg height=\"\" viewBox=\"\" width=\"\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"\"/></svg>\n \n```\n\nindex.html\n\n```\n\n <?php include('hoge.php'); ?>\n \n```\n\n### やりたいこと\n\nCSSで、hoge.phpを読み込み、SVG表示したい\n\n### 試したこと\n\nindex.html\n\n```\n\n <style>\n .test:before {\n background-image: url(\"<?php include('hoge.php'); ?>\");\n \n```\n\ninvalid property errorになりました。\n\n`background-image: url(ファイルパス/ファイル名.svg);` にする必要があるからだと思うのですが、\n\n * svgタグそのものを読み込んで表示する方法はありますか?\n * あるいは、PHPで疑似的にSVGファイルを出力したように見せかけ、そのファイルパスを指定するようなことはできますか?\n * そもそもの大前提として、background-image: url()で、ドキュメントルートより上に配置しているファイルを指定することはできますか?", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T12:26:07.863", "favorite_count": 0, "id": "77995", "last_activity_date": "2021-07-05T19:26:53.817", "last_edit_date": "2021-07-05T15:16:57.677", "last_editor_user_id": "3060", "owner_user_id": "7886", "post_type": "question", "score": 1, "tags": [ "php", "css", "svg" ], "title": "CSSで、ドキュメントルートより上に配置しているSVGタグそのものを読み込む方法はありますか?", "view_count": 142 }
[ { "body": "質問文の2番目の方法が実現できます。 \n質問文の様な`hoge.php`が存在するとして、ヘッダに`Content-type`を適切にセットすればphpファイルも画像扱いになります。 \nすなわち、\n\n```\n\n <?php\n header(\"Content-type: image/svg+xml\");\n ?>\n <svg height=\"\" viewBox=\"\" width=\"\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"\"/></svg>\n \n```\n\n(当然ですがsvgタグの内容は単体でsvgファイルとして適切なフォーマットである必要があります) \nあとはCSSのbackground-imageでphpファイルを直接指定すれば良いです。\n\n```\n\n <style>\n .test:before {\n background-image: url(./hoge.php);\n (以下省略)\n \n```\n\n###### 補足\n\nドキュメント中の要素をIDで指定して背景にしてしまう`element`という指定も仕様で勧告されていますが対応しているのは2021年現在firefoxのみです。 \n<https://developer.mozilla.org/en-US/docs/Web/CSS/element()>", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T19:26:53.817", "id": "77997", "last_activity_date": "2021-07-05T19:26:53.817", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46944", "parent_id": "77995", "post_type": "answer", "score": 1 } ]
77995
77997
77997
{ "accepted_answer_id": "77999", "answer_count": 1, "body": "経験者の皆様に、タイトルの事について、識者の皆様の意見を伺わせて頂けないでしょうか。 \nあれこれ考えたり検証している時間が無く、周りに気軽に聞ける経験者がいないため、投稿させて頂きました。 \nどうぞ宜しくお願いします。\n\n### 要件\n\n下記のWebアプリを新しく作りたい。\n\n * できればpythonだけで実現し、JavaScript HTML CSSを使う事は避けたい\n * クライアント領域は左右2つに分け、 \n * 左にリストボックスやボタン等のウィジェットを付けたい\n * 右に任意の地図画像(png)を描き、その上に点や線も描きたい \nこの描画物は、マウスクリックに反応する=ヒットテストを行うようにしたい。\n\n * 長く使う=保守し続ける事になりそう。\n\n### 私の状況\n\n * Webアプリ作成経験ナシ\n * pythonは初心者\n * VC++とMFCとDirect3DとOpenGLでWinのGUIツールを作った事はある\n * 素早い実装を要求されてる\n\n### 検証中の事\n\n開発速度を重視し下記を試している。しかし適切といえるか確信できなくなった。\n\n * streamlit \nWebアプリ作成をpythonで行うための基本ライブラリ。 \nコード量は少ないが、シバリ・できない事が多い。敷かれたレールの範囲内の処理しかできない。 \n例えば、プログラムからリロード=画面再描画ができない。\n\n * plotly \nstreamlitと連携し、描画するライブラリ。グラフ描画用で、自由な描画には向かないかも。\n\n * streamlit-drawable-canvas \n<https://pypi.org/project/streamlit-drawable-canvas/>\nのサンプルコードを実行して調べようとした。がpython3.9の環境ではエラーで実行不能だった。\n\n### 環境\n\n * Python 3.9\n * Windows 10 Pro. x64 20H2\n * Docker等の仮想環境は未使用\n\n**過去の関連質問:** \n[plotly には、自由に点や線や画像を描画する機能はあるでしょうか?](https://ja.stackoverflow.com/q/77980)", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T17:28:19.633", "favorite_count": 0, "id": "77996", "last_activity_date": "2021-07-06T11:00:13.683", "last_edit_date": "2021-07-06T11:00:13.683", "last_editor_user_id": "3060", "owner_user_id": null, "post_type": "question", "score": 1, "tags": [ "python", "python3" ], "title": "python で、あるWebアプリを早く作る必要がある時の、お勧めのライブラリの組み合わせはあるでしょうか?", "view_count": 485 }
[ { "body": "[The Bokeh Visualization Library](https://bokeh.org/) を使うのはどうでしょうか。\n\nただし、\n\n> できればpythonだけで実現し、JavaScript HTML CSSを使う事は避けたい\n\nクリックイベントを検出してコールバックを実行するので `JavaScript` や `CSS` を使用しています。\n\n```\n\n import os\n import random\n from bokeh.plotting import figure, output_file, show\n from bokeh.models.widgets import Select, Button, Div\n from bokeh.models.layouts import Spacer\n from bokeh.models.callbacks import CustomJS\n from bokeh.layouts import Column, Row\n from bokeh.io import curdoc\n \n # data view\n width, height = 800, 800\n num_range = (0, 100)\n plot = figure(\n title='東京23区',\n plot_width=width, plot_height=height,\n x_range=num_range, y_range=num_range,\n tools='pan,wheel_zoom,reset', toolbar_location='above',\n active_scroll='wheel_zoom')\n \n # background image\n plot.image_url(\n url=['https://livedoor.blogimg.jp/unnyas31-sougou/imgs/8/b/8bcba2f3.gif'],\n x=0, y=0, w=num_range[1], h=num_range[1], anchor='bottom_left')\n \n # draw 20 circles\n k = 40\n c = random.sample(range(*num_range), k=k)\n plot.circle(\n x=c[:k//2], y=c[k//2:], size=15, color='blue', alpha=0.5)\n \n # draw 20 lines\n p = random.sample(range(*num_range), k=2*k)\n for i in range(0, 2*k, 4):\n plot.line(\n x=p[i:i+2], y=p[i+2:i+4],\n line_width=2, line_color='red', line_alpha=0.5)\n \n # callback on click event\n def callback(div):\n return CustomJS(args=dict(div=div), code=\"\"\"\n var line = \"<span>\" +\n \"x=\" + Number(cb_obj.x).toFixed(2) + \", \" +\n \"y=\" + Number(cb_obj.y).toFixed(2) +\n \"</span>\\\\n\";\n var text = div.text.concat(line);\n var lines = text.split(\"\\\\n\")\n if (lines.length > 10) lines.shift();\n div.text = lines.join(\"\\\\n\");\n \"\"\")\n click_pos = Div(style={\n 'width': '120px', 'height':'170px', 'background': '#E2DCF4',\n 'text-align': 'center'\n })\n plot.js_on_event('tap', callback(click_pos))\n \n # selection box\n select = Select(\n title='Option:', value='午前',\n options=['午前', '午後', '深夜'])\n \n # button\n button = Button(label='Push me', button_type='success')\n \n # layout \n layout = Row(\n Column(Spacer(height=50), button, select, click_pos, width=100),\n Spacer(width=50),\n plot\n )\n curdoc().add_root(layout)\n \n os.environ['BOKEH_LOG_LEVEL'] = 'error'\n output_file('plot.html')\n show(layout)\n \n```\n\n以下は `Bokeh` の `output_file` で出力した HTML+JavaScript\nファイルになりますが、地図上のポイントをクリックすると左側の表示領域にその座標が表示されます(最新10ポイント分)。\n\n**plot.html** \n\n```\n\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <title>Bokeh Plot</title>\n <script type=\"text/javascript\" src=\"https://cdn.bokeh.org/bokeh/release/bokeh-2.3.2.min.js\" integrity=\"sha384-XypntL49z55iwGVUW4qsEu83zKL3XEcz0MjuGOQ9SlaaQ68X/g+k1FcioZi7oQAc\" crossorigin=\"anonymous\"></script>\n <script type=\"text/javascript\" src=\"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.3.2.min.js\" integrity=\"sha384-TX0gSQTdXTTeScqxj6PVQxTiRW8DOoGVwinyi1D3kxv7wuxQ02XkOxv0xwiypcAH\" crossorigin=\"anonymous\"></script>\n <script type=\"text/javascript\">\n Bokeh.set_log_level(\"error\");\n </script>\n </head>\n <body>\n <div class=\"bk-root\" id=\"7765f21b-c784-43ae-9371-9e005d5ffef7\" data-root-id=\"1145\"></div>\n <script type=\"application/json\" id=\"1605\">\n {\"b1a4274d-e7bb-42ce-ab03-d72628b910ed\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"data_source\":{\"id\":\"1063\"},\"glyph\":{\"id\":\"1064\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1065\"},\"view\":{\"id\":\"1067\"}},\"id\":\"1066\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"1133\"},\"glyph\":{\"id\":\"1134\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1135\"},\"view\":{\"id\":\"1137\"}},\"id\":\"1136\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1063\"}},\"id\":\"1067\",\"type\":\"CDSView\"},{\"attributes\":{\"children\":[{\"id\":\"1142\"},{\"id\":\"1141\"},{\"id\":\"1140\"},{\"id\":\"1138\"}],\"width\":100},\"id\":\"1143\",\"type\":\"Column\"},{\"attributes\":{\"source\":{\"id\":\"1068\"}},\"id\":\"1072\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1185\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"args\":{\"div\":{\"id\":\"1138\"}},\"code\":\"\\n var line = \\\"&lt;span&gt;\\\" +\\n \\\"x=\\\" + Number(cb_obj.x).toFixed(2) + \\\", \\\" +\\n \\\"y=\\\" + Number(cb_obj.y).toFixed(2) +\\n \\\"&lt;/span&gt;\\\\n\\\";\\n var text = div.text.concat(line);\\n var lines = text.split(\\\"\\\\n\\\")\\n if (lines.length &gt; 10) lines.shift();\\n div.text = lines.join(\\\"\\\\n\\\");\\n \"},\"id\":\"1139\",\"type\":\"CustomJS\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1069\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[55,52],\"y\":[90,16]},\"selected\":{\"id\":\"1170\"},\"selection_policy\":{\"id\":\"1169\"}},\"id\":\"1068\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"1133\"}},\"id\":\"1137\",\"type\":\"CDSView\"},{\"attributes\":{\"options\":[\"\\u5348\\u524d\",\"\\u5348\\u5f8c\",\"\\u6df1\\u591c\"],\"title\":\"Option:\",\"value\":\"\\u5348\\u524d\"},\"id\":\"1140\",\"type\":\"Select\"},{\"attributes\":{\"source\":{\"id\":\"1073\"}},\"id\":\"1077\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1074\",\"type\":\"Line\"},{\"attributes\":{\"height\":50},\"id\":\"1142\",\"type\":\"Spacer\"},{\"attributes\":{\"data\":{\"x\":[5,51],\"y\":[10,93]},\"selected\":{\"id\":\"1172\"},\"selection_policy\":{\"id\":\"1171\"}},\"id\":\"1073\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1186\",\"type\":\"Selection\"},{\"attributes\":{\"button_type\":\"success\",\"icon\":null,\"label\":\"Push me\"},\"id\":\"1141\",\"type\":\"Button\"},{\"attributes\":{\"data_source\":{\"id\":\"1068\"},\"glyph\":{\"id\":\"1069\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1070\"},\"view\":{\"id\":\"1072\"}},\"id\":\"1071\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1070\",\"type\":\"Line\"},{\"attributes\":{\"width\":50},\"id\":\"1144\",\"type\":\"Spacer\"},{\"attributes\":{\"source\":{\"id\":\"1078\"}},\"id\":\"1082\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1079\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[37,88],\"y\":[23,94]},\"selected\":{\"id\":\"1174\"},\"selection_policy\":{\"id\":\"1173\"}},\"id\":\"1078\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"children\":[{\"id\":\"1143\"},{\"id\":\"1144\"},{\"id\":\"1002\"}]},\"id\":\"1145\",\"type\":\"Row\"},{\"attributes\":{\"formatter\":{\"id\":\"1152\"},\"major_label_policy\":{\"id\":\"1151\"},\"ticker\":{\"id\":\"1018\"}},\"id\":\"1017\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data_source\":{\"id\":\"1033\"},\"glyph\":{\"id\":\"1034\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1035\"},\"view\":{\"id\":\"1037\"}},\"id\":\"1036\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"1073\"},\"glyph\":{\"id\":\"1074\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1075\"},\"view\":{\"id\":\"1077\"}},\"id\":\"1076\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1075\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1083\"}},\"id\":\"1087\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1187\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1084\",\"type\":\"Line\"},{\"attributes\":{\"axis\":{\"id\":\"1017\"},\"dimension\":1,\"ticker\":null},\"id\":\"1020\",\"type\":\"Grid\"},{\"attributes\":{\"data\":{\"x\":[30,67],\"y\":[43,44]},\"selected\":{\"id\":\"1176\"},\"selection_policy\":{\"id\":\"1175\"}},\"id\":\"1083\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1018\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"1078\"},\"glyph\":{\"id\":\"1079\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1080\"},\"view\":{\"id\":\"1082\"}},\"id\":\"1081\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1043\"}},\"id\":\"1047\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1080\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1188\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1022\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"source\":{\"id\":\"1088\"}},\"id\":\"1092\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"PanTool\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1089\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1023\",\"type\":\"ResetTool\"},{\"attributes\":{\"data\":{\"x\":[69,89],\"y\":[24,84]},\"selected\":{\"id\":\"1178\"},\"selection_policy\":{\"id\":\"1177\"}},\"id\":\"1088\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"1083\"},\"glyph\":{\"id\":\"1084\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1085\"},\"view\":{\"id\":\"1087\"}},\"id\":\"1086\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1014\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data\":{\"x\":[98,34],\"y\":[77,66]},\"selected\":{\"id\":\"1158\"},\"selection_policy\":{\"id\":\"1157\"}},\"id\":\"1038\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"text\":\"\\u6771\\u4eac23\\u533a\"},\"id\":\"1003\",\"type\":\"Title\"},{\"attributes\":{\"style\":{\"background\":\"#E2DCF4\",\"height\":\"170px\",\"text-align\":\"center\",\"width\":\"120px\"}},\"id\":\"1138\",\"type\":\"Div\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1085\",\"type\":\"Line\"},{\"attributes\":{\"axis\":{\"id\":\"1013\"},\"ticker\":null},\"id\":\"1016\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"1093\"}},\"id\":\"1097\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"1038\"},\"glyph\":{\"id\":\"1039\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1040\"},\"view\":{\"id\":\"1042\"}},\"id\":\"1041\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"anchor\":\"bottom_left\",\"h\":{\"value\":100},\"url\":{\"field\":\"url\"},\"w\":{\"value\":100},\"x\":{\"value\":0},\"y\":{\"value\":0}},\"id\":\"1029\",\"type\":\"ImageURL\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1094\",\"type\":\"Line\"},{\"attributes\":{\"below\":[{\"id\":\"1013\"}],\"center\":[{\"id\":\"1016\"},{\"id\":\"1020\"}],\"height\":800,\"js_event_callbacks\":{\"tap\":[{\"id\":\"1139\"}]},\"left\":[{\"id\":\"1017\"}],\"renderers\":[{\"id\":\"1031\"},{\"id\":\"1036\"},{\"id\":\"1041\"},{\"id\":\"1046\"},{\"id\":\"1051\"},{\"id\":\"1056\"},{\"id\":\"1061\"},{\"id\":\"1066\"},{\"id\":\"1071\"},{\"id\":\"1076\"},{\"id\":\"1081\"},{\"id\":\"1086\"},{\"id\":\"1091\"},{\"id\":\"1096\"},{\"id\":\"1101\"},{\"id\":\"1106\"},{\"id\":\"1111\"},{\"id\":\"1116\"},{\"id\":\"1121\"},{\"id\":\"1126\"},{\"id\":\"1131\"},{\"id\":\"1136\"}],\"title\":{\"id\":\"1003\"},\"toolbar\":{\"id\":\"1024\"},\"toolbar_location\":\"above\",\"width\":800,\"x_range\":{\"id\":\"1005\"},\"x_scale\":{\"id\":\"1009\"},\"y_range\":{\"id\":\"1007\"},\"y_scale\":{\"id\":\"1011\"}},\"id\":\"1002\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"blue\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"blue\"},\"size\":{\"value\":15},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1035\",\"type\":\"Circle\"},{\"attributes\":{\"data\":{\"x\":[53,0],\"y\":[80,50]},\"selected\":{\"id\":\"1180\"},\"selection_policy\":{\"id\":\"1179\"}},\"id\":\"1093\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1189\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"data_source\":{\"id\":\"1088\"},\"glyph\":{\"id\":\"1089\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1090\"},\"view\":{\"id\":\"1092\"}},\"id\":\"1091\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1039\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1044\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1090\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1059\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1098\"}},\"id\":\"1102\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1099\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[41,13],\"y\":[62,21]},\"selected\":{\"id\":\"1182\"},\"selection_policy\":{\"id\":\"1181\"}},\"id\":\"1098\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1190\",\"type\":\"Selection\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"blue\"},\"line_alpha\":{\"value\":0.5},\"line_color\":{\"value\":\"blue\"},\"size\":{\"value\":15},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1034\",\"type\":\"Circle\"},{\"attributes\":{\"data_source\":{\"id\":\"1093\"},\"glyph\":{\"id\":\"1094\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1095\"},\"view\":{\"id\":\"1097\"}},\"id\":\"1096\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[56,71],\"y\":[97,60]},\"selected\":{\"id\":\"1166\"},\"selection_policy\":{\"id\":\"1165\"}},\"id\":\"1058\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1095\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1033\"}},\"id\":\"1037\",\"type\":\"CDSView\"},{\"attributes\":{\"source\":{\"id\":\"1103\"}},\"id\":\"1107\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1050\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1104\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"1048\"},\"glyph\":{\"id\":\"1049\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1050\"},\"view\":{\"id\":\"1052\"}},\"id\":\"1051\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[76,33],\"y\":[18,38]},\"selected\":{\"id\":\"1184\"},\"selection_policy\":{\"id\":\"1183\"}},\"id\":\"1103\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"1098\"},\"glyph\":{\"id\":\"1099\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1100\"},\"view\":{\"id\":\"1102\"}},\"id\":\"1101\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[79,26],\"y\":[81,58]},\"selected\":{\"id\":\"1164\"},\"selection_policy\":{\"id\":\"1163\"}},\"id\":\"1053\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data\":{\"x\":[0,78,90,10,15,49,45,17,47,48,69,3,70,98,92,96,35,58,46,56],\"y\":[79,50,9,34,77,2,40,27,81,8,26,64,43,65,28,32,62,25,24,36]},\"selected\":{\"id\":\"1156\"},\"selection_policy\":{\"id\":\"1155\"}},\"id\":\"1033\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1100\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1108\"}},\"id\":\"1112\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1191\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1054\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1109\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1053\"}},\"id\":\"1057\",\"type\":\"CDSView\"},{\"attributes\":{\"data\":{\"x\":[65,59],\"y\":[86,63]},\"selected\":{\"id\":\"1186\"},\"selection_policy\":{\"id\":\"1185\"}},\"id\":\"1108\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1148\",\"type\":\"AllLabels\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1045\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"1043\"},\"glyph\":{\"id\":\"1044\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1045\"},\"view\":{\"id\":\"1047\"}},\"id\":\"1046\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"1103\"},\"glyph\":{\"id\":\"1104\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1105\"},\"view\":{\"id\":\"1107\"}},\"id\":\"1106\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"end\":100},\"id\":\"1007\",\"type\":\"Range1d\"},{\"attributes\":{},\"id\":\"1149\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1105\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1192\",\"type\":\"Selection\"},{\"attributes\":{\"data\":{\"x\":[36,35],\"y\":[48,78]},\"selected\":{\"id\":\"1162\"},\"selection_policy\":{\"id\":\"1161\"}},\"id\":\"1048\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"1113\"}},\"id\":\"1117\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1009\",\"type\":\"LinearScale\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1049\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1114\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1151\",\"type\":\"AllLabels\"},{\"attributes\":{\"source\":{\"id\":\"1048\"}},\"id\":\"1052\",\"type\":\"CDSView\"},{\"attributes\":{\"data\":{\"x\":[40,4],\"y\":[85,82]},\"selected\":{\"id\":\"1188\"},\"selection_policy\":{\"id\":\"1187\"}},\"id\":\"1113\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1152\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"1108\"},\"glyph\":{\"id\":\"1109\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1110\"},\"view\":{\"id\":\"1112\"}},\"id\":\"1111\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1110\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1028\"}},\"id\":\"1032\",\"type\":\"CDSView\"},{\"attributes\":{\"source\":{\"id\":\"1118\"}},\"id\":\"1122\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"1028\"},\"glyph\":{\"id\":\"1029\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1030\"},\"view\":{\"id\":\"1032\"}},\"id\":\"1031\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1119\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1040\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[39,72],\"y\":[28,8]},\"selected\":{\"id\":\"1190\"},\"selection_policy\":{\"id\":\"1189\"}},\"id\":\"1118\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1193\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"data_source\":{\"id\":\"1113\"},\"glyph\":{\"id\":\"1114\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1115\"},\"view\":{\"id\":\"1117\"}},\"id\":\"1116\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"anchor\":\"bottom_left\",\"global_alpha\":0.1,\"h\":{\"value\":100},\"url\":{\"field\":\"url\"},\"w\":{\"value\":100},\"x\":{\"value\":0},\"y\":{\"value\":0}},\"id\":\"1030\",\"type\":\"ImageURL\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1115\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1123\"}},\"id\":\"1127\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1124\",\"type\":\"Line\"},{\"attributes\":{\"source\":{\"id\":\"1038\"}},\"id\":\"1042\",\"type\":\"CDSView\"},{\"attributes\":{\"data\":{\"x\":[61,46],\"y\":[27,32]},\"selected\":{\"id\":\"1192\"},\"selection_policy\":{\"id\":\"1191\"}},\"id\":\"1123\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1194\",\"type\":\"Selection\"},{\"attributes\":{\"data_source\":{\"id\":\"1118\"},\"glyph\":{\"id\":\"1119\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1120\"},\"view\":{\"id\":\"1122\"}},\"id\":\"1121\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data\":{\"x\":[6,83],\"y\":[11,14]},\"selected\":{\"id\":\"1160\"},\"selection_policy\":{\"id\":\"1159\"}},\"id\":\"1043\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1120\",\"type\":\"Line\"},{\"attributes\":{\"formatter\":{\"id\":\"1149\"},\"major_label_policy\":{\"id\":\"1148\"},\"ticker\":{\"id\":\"1014\"}},\"id\":\"1013\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"1128\"}},\"id\":\"1132\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1011\",\"type\":\"LinearScale\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1129\",\"type\":\"Line\"},{\"attributes\":{\"active_multi\":null,\"active_scroll\":{\"id\":\"1022\"},\"tools\":[{\"id\":\"1021\"},{\"id\":\"1022\"},{\"id\":\"1023\"}]},\"id\":\"1024\",\"type\":\"Toolbar\"},{\"attributes\":{\"data\":{\"url\":[\"https://livedoor.blogimg.jp/unnyas31-sougou/imgs/8/b/8bcba2f3.gif\"]},\"selected\":{\"id\":\"1154\"},\"selection_policy\":{\"id\":\"1153\"}},\"id\":\"1028\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data\":{\"x\":[73,75],\"y\":[57,54]},\"selected\":{\"id\":\"1194\"},\"selection_policy\":{\"id\":\"1193\"}},\"id\":\"1128\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"1053\"},\"glyph\":{\"id\":\"1054\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1055\"},\"view\":{\"id\":\"1057\"}},\"id\":\"1056\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"1123\"},\"glyph\":{\"id\":\"1124\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1125\"},\"view\":{\"id\":\"1127\"}},\"id\":\"1126\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1055\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1125\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1065\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1195\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"source\":{\"id\":\"1058\"}},\"id\":\"1062\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1134\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[1,47],\"y\":[95,49]},\"selected\":{\"id\":\"1168\"},\"selection_policy\":{\"id\":\"1167\"}},\"id\":\"1063\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data\":{\"x\":[91,42],\"y\":[15,22]},\"selected\":{\"id\":\"1196\"},\"selection_policy\":{\"id\":\"1195\"}},\"id\":\"1133\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.5,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1064\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1135\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"1128\"},\"glyph\":{\"id\":\"1129\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1130\"},\"view\":{\"id\":\"1132\"}},\"id\":\"1131\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"1058\"},\"glyph\":{\"id\":\"1059\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1060\"},\"view\":{\"id\":\"1062\"}},\"id\":\"1061\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1060\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1130\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1196\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1173\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"end\":100},\"id\":\"1005\",\"type\":\"Range1d\"},{\"attributes\":{},\"id\":\"1174\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1163\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1164\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1175\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1153\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1176\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1154\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1165\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1166\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1177\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1155\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1178\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1156\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1167\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1168\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1179\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1157\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1180\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1158\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1169\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1170\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1181\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1159\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1182\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1160\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1171\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1172\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1183\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1161\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1184\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1162\",\"type\":\"Selection\"}],\"root_ids\":[\"1145\"]},\"title\":\"Bokeh Application\",\"version\":\"2.3.2\"}}\n </script>\n <script type=\"text/javascript\">\n (function() {\n var fn = function() {\n Bokeh.safely(function() {\n (function(root) {\n function embed_document(root) {\n var docs_json = document.getElementById('1605').textContent;\n var render_items = [{\"docid\":\"b1a4274d-e7bb-42ce-ab03-d72628b910ed\",\"root_ids\":[\"1145\"],\"roots\":{\"1145\":\"7765f21b-c784-43ae-9371-9e005d5ffef7\"}}];\n root.Bokeh.embed.embed_items(docs_json, render_items);\n }\n if (root.Bokeh !== undefined) {\n embed_document(root);\n } else {\n var attempts = 0;\n var timer = setInterval(function(root) {\n if (root.Bokeh !== undefined) {\n clearInterval(timer);\n embed_document(root);\n } else {\n attempts++;\n if (attempts > 100) {\n clearInterval(timer);\n console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n }\n }\n }, 10, root)\n }\n })(window);\n });\n };\n if (document.readyState != \"loading\") fn();\n else document.addEventListener(\"DOMContentLoaded\", fn);\n })();\n </script>\n </body>\n </html>\n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T23:01:18.153", "id": "77999", "last_activity_date": "2021-07-06T10:34:36.157", "last_edit_date": "2021-07-06T10:34:36.157", "last_editor_user_id": "47127", "owner_user_id": "47127", "parent_id": "77996", "post_type": "answer", "score": 2 } ]
77996
77999
77999
{ "accepted_answer_id": null, "answer_count": 1, "body": "IJCAD2021 Proが入っている環境でC#.Netアプリ開発をしています。参照は\"GcadVbaLib\"を使っています。 \nそこでリリースビルドしたアプリを別のPC(IJCAD2020\nStd)環境で実行すると、IJCADを動かすところで「クラスが登録されていない」エラーになってしまいます。これは上位バージョンで作ったことが原因と考えられるでしょうか?AutoCadを使っていた時もバージョン違いによるエラーはよくあった記憶があります。", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T21:37:00.807", "favorite_count": 0, "id": "77998", "last_activity_date": "2021-07-06T00:50:05.897", "last_edit_date": "2021-07-06T00:50:05.897", "last_editor_user_id": "15413", "owner_user_id": "47173", "post_type": "question", "score": 0, "tags": [ "c#", "ijcad" ], "title": "IJCAD のバージョン違いによる参照設定の互換性", "view_count": 201 }
[ { "body": "IJCADのVBAコンポーネントは前方互換性も後方互換性も保証していません。バージョンを完全に一致させる必要があります。\n\n * [VBA によるプログラミングの概要 – IJCAD ヘルプセンター](https://support.ijcad.jp/hc/ja/articles/205153293)\n\n> ※ 参照する Object Library は製品のバージョンに合わせたものを有効にしてください。\n\n一応、C#ではリフレクションAPIまたは`dynamic`型を使って、動的ダックタイピングをすることができます。 \nこれらを活用することで、参照設定を追加することなく、互換性のあるCOMクライアントコードを書くこともできますが、コンパイル時の型チェックやシンボルチェックができず、実行時にすべてのシンボル解決を試みるため、開発効率や実行効率は大幅に低下します。\n\n * [.NET - COMの機能を使用する – IJCAD ヘルプセンター](https://support.ijcad.jp/hc/ja/articles/115000168981)\n * [dynamic 型の使用 - C# プログラミング ガイド | Microsoft Docs](https://docs.microsoft.com/ja-jp/dotnet/csharp/programming-guide/types/using-type-dynamic)\n\n一般論として、世の中にあるほとんどのライブラリは、後方互換性はあるものの前方互換性はない、ということがほとんどです。前方互換性に配慮すると、ライブラリへの新しい機能(新しいクラスやメソッド)の追加が難しくなるからです。つまり、新しいバージョンの動的リンクライブラリを利用することを前提としたアプリケーションは、古いバージョンの動的リンクライブラリがインストールされている環境では正常に動作しません。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-05T23:26:58.817", "id": "78000", "last_activity_date": "2021-07-05T23:26:58.817", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "15413", "parent_id": "77998", "post_type": "answer", "score": 1 } ]
77998
null
78000
{ "accepted_answer_id": "78004", "answer_count": 2, "body": "SpresenseのUSB_DP(N1),USB_DM(P1)を使用して、外部回路を設けることでUSB HOSTを実現することは可能なのでしょうか?", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T05:54:58.927", "favorite_count": 0, "id": "78003", "last_activity_date": "2021-10-21T02:28:29.857", "last_edit_date": "2021-07-06T05:58:50.460", "last_editor_user_id": "3060", "owner_user_id": "46882", "post_type": "question", "score": 1, "tags": [ "spresense", "usb" ], "title": "SpresenseでUSBホスト機能を実現することは可能?", "view_count": 335 }
[ { "body": "Spresense のマイコン CXD5602 の[マニュアル](https://www.sony-\nsemicon.co.jp/products/common/pdf/CXD5602GG_technical_manual.pdf) (PDF) によると\nUSB 2.0 Device support とはありますが Host の記述はないので無理っス。 Host コントローラを外付けするのは非現実的っスね。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T06:23:11.953", "id": "78004", "last_activity_date": "2021-07-06T06:23:11.953", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "8589", "parent_id": "78003", "post_type": "answer", "score": 0 }, { "body": "このような商品を生産している会社がありますよ。\n\n<https://twitter.com/p_art_lab/status/1444422439396589571>\n\n> USBホスト基板 \n> SPRESENSE基板に重ねることで、USB Type-A端子を搭載することができます! \n> (受注生産計画中)\n\n受注生産のようですが、問い合わせれば入手できるかもしれません。 \n一般販売してもらえると良いのですが…。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-10-20T16:58:32.010", "id": "83192", "last_activity_date": "2021-10-21T02:28:29.857", "last_edit_date": "2021-10-21T02:28:29.857", "last_editor_user_id": "3060", "owner_user_id": "32281", "parent_id": "78003", "post_type": "answer", "score": 0 } ]
78003
78004
78004
{ "accepted_answer_id": "78058", "answer_count": 1, "body": "ブラウザに表示されたボタンを選択してファイルを持たせるのではなく、JavaScriptを使用しファイルを持たせるやり方を探しています。 \nよろしくお願いします。", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T10:29:27.433", "favorite_count": 0, "id": "78006", "last_activity_date": "2021-07-08T15:50:49.833", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47016", "post_type": "question", "score": 0, "tags": [ "javascript", "html", "vue.js" ], "title": "vueで<input type='file'>にファイルを持たせたい", "view_count": 334 }
[ { "body": "抽象的な回答となります\n\nまずJSを使ったローカルファイルの扱いはセキュリティのため自由度は低いです。特定のファイルパスを知っていたとしてもそのファイルをJSでinputタグに設定するということはできません\n\nこのためinputにファイルを設定してもらうには必ずユーザの操作が必要です\n\nページ遷移をしてもファイルを保持したいという要望を満たす場合は、ページ遷移後もユーザに設定しもらったinputのDOMを保持し続ける必要があります\n\nSPAなどの場合は表示制御とhistory APIを使ってそういったことを行うことが可能です(自前でやるのはつらいですが) \nIonicやjQuery MobileなどはDOMを残しながらページ遷移の振る舞いを行うフレームワークです(アプリのナビゲーションUIを実現するため)\n\n一般的なフォーム、たとえばお問い合わせページなどでファイルを添付し確認画面を出したいというケースの場合はダイアログを画面上に出すことが多いと思います。実際にページ遷移してdomを破棄するとファイル情報がなくなるためです\n\nあとは投機的に添付ファイルが設定されたものはすぐにサーバにアップロードして、利用がなければ破棄するという実装も考えられます\n\n要件次第だとは思いますが参考になれば幸いです", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-08T15:50:49.833", "id": "78058", "last_activity_date": "2021-07-08T15:50:49.833", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "298", "parent_id": "78006", "post_type": "answer", "score": 0 } ]
78006
78058
78058
{ "accepted_answer_id": "78009", "answer_count": 1, "body": "CentOSで複数個のターミナルを開き、各ターミナルごとに異なるコマンドを実行したいのです。\n\n単純に並列でコマンドを実行した場合、一つのターミナルに一気に表示され、何が何だか理解できません。 \nそこで、ターミナルを別々に起動させ、各ターミナルごとに異なるコマンドを実行させることで、このグチャグチャになる事柄の解決方法は理解できたのですが、どうすれば実現できるのかが分かりません。\n\n現状、手動で複数のターミナルを稼働させて実行していますが、面倒で仕方がありません。\n\nプログラミング言語は、PythonかBashでお願いしたいです。 \nよろしくお願いします。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T11:21:47.610", "favorite_count": 0, "id": "78008", "last_activity_date": "2021-07-06T11:49:36.687", "last_edit_date": "2021-07-06T11:36:36.047", "last_editor_user_id": "3060", "owner_user_id": "42741", "post_type": "question", "score": 1, "tags": [ "python", "linux" ], "title": "Linuxでターミナルを開き、自動でコマンドを入力できるようにしたい", "view_count": 1394 }
[ { "body": "デスクトップ環境は何ですか? \nGnomeなら下記のページが参考になると思います。\n\n[新しい「GNOME端末」を開いてコマンドを実行する方法 | LFI](https://linuxfan.info/gnome-terminal-with-\ncommand)\n\n違うデスクトップ環境でも同様のやり方はあると思いますのでターミナルコマンドのパスとオプションを確認してみては。", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T11:49:36.687", "id": "78009", "last_activity_date": "2021-07-06T11:49:36.687", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "45045", "parent_id": "78008", "post_type": "answer", "score": 1 } ]
78008
78009
78009
{ "accepted_answer_id": null, "answer_count": 1, "body": "PythonでスクレイピングするならJupyter Notebookよりもコマンドプロンプトで書いた方がいいのですか?理由も含めてお願いします。 \n※スクレイピングに関する本を何冊か読んだところJupyter notebookでスクレイピングしているものが見当たらなかったため質問させていただきました!", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T12:16:04.173", "favorite_count": 0, "id": "78010", "last_activity_date": "2021-07-07T06:33:57.180", "last_edit_date": "2021-07-06T22:54:45.330", "last_editor_user_id": "47180", "owner_user_id": "47180", "post_type": "question", "score": 0, "tags": [ "python", "web-scraping" ], "title": "Python スクレイピング環境", "view_count": 181 }
[ { "body": "どんなことでもそうですが、単純なあるいは絶対的な優劣というものはそうそう無いでしょう。 \nあるソフトウェアを統合開発環境(IDE)やデバッガから動作させるか、単独で動作させるか程度の違いと思われます。 \nちょっとした性能差や動作環境の違いを考慮する必要があるかもしれませんが、それらが特に気にならない場合はどちらの方法でもたいして変わりはありません。\n\n* * *\n\n書籍として書かれたものには少ないのかもしれませんが、Web上で検索すれば以下のように割と直ぐに見つかります。 \n[python + JupyterLab で Web スクレイピング](https://qiita.com/takiguchi-\nyu/items/1911252d97321c1f9d9b) \n[Pythonでスクレイピングして遊んでみる](https://inglow.jp/techblog/python-scraping/) \n[【Win10】Python で スクレイピング【Jupyter Notebook 第4回】](https://tks-\nkan.com/2019/06/14/5318/) \n[プログラミング Pythonを始める!\n第3回Webスクレイピングやってみる<Windows用>](https://rakumoke.hatenablog.com/entry/2020/09/13/130000) \n[データ収集を大幅に効率化する「スクレイピング」とは?\n手法やルール・注意点を解説!](https://data.wingarc.com/scraping-27053) \n[面倒な「ブラウザ操作」や「データ収集」の作業はPythonで自動化しよう|スクレイピングとは何か?できることや使い方をわかりやすく解説【PythonでやるRPA】](https://kino-\ncode.com/python_automation_web_scraping/) \n[Pythonのスクレイピングを勉強しています。](https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q12237487512)\n\n* * *\n\nなのであなたの調べた範囲に見当たらず、質問のように思えたのは「たまたま」そうだった、と考えられます。\n\n実際には、使っていくうちに何か問題に遭遇したり、評価の優先順位が変わったりして他に切り替えた方が良いという可能性も考えられますが、それはその時に考えても遅くは無いでしょう。 \n例えばこんな要求が出てくることもあります。 \n[Pythonのスクレイピングをクラウド上で(できれば並列化して)行いたい](https://ja.stackoverflow.com/q/54243/26370)\n\n今あなたのやりたいこと、既に分かっている各環境の機能・性能の有無・優劣、あなたが何を重視するか等を詳細化(必要ならば調査を継続)して、それらを元に判断すれば良いと思われます。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-07T06:33:57.180", "id": "78018", "last_activity_date": "2021-07-07T06:33:57.180", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "26370", "parent_id": "78010", "post_type": "answer", "score": 1 } ]
78010
null
78018
{ "accepted_answer_id": null, "answer_count": 1, "body": "LPを制作しています。\n\nswiperを利用してスライドショーを設置しようと思っています。 \nネットで調べて試してみましたが、動作しません。\n\n```\n\n <!DOCTYPE html>\n <html lang=\"ja\">\n <head>\n <meta charset=\"UTF-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"css/style.css\">\n <link rel=\"stylesheet\" href=\"https://unpkg.com/swiper/swiper-bundle.min.css\" />\n <script src=\"https://unpkg.com/swiper/swiper-bundle.min.js\"></script>\n <title>Document</title>\n </head>\n \n (中略)\n ~</footer>\n \n <script src=\"js/script.js\"></script>\n <script>\n var mySwiper = new Swiper ('.swiper-container', {\n // 以下にオプションを設定\n loop: true,\n autoplay:{\n delay: 5000,\n }, \n });\n </script> \n </body>\n </html>\n```\n\n```\n\n .card-slider {\n display: flex;\n justify-content: space-between;\n }\n \n .slider {\n width: 322px;\n background: #FFFFFF 0% 0% no-repeat padding-box;\n border: 1px solid #DDDDDD;\n border-radius: 8px;\n }\n \n .slider img {\n width: 100%;\n }\n \n .slider-txt {\n padding-top: 18px;\n padding-left: 18px;\n padding-right: 17px;\n text-align: left;\n height: 196px;\n position: relative;\n }\n \n .slider-txt h3 {\n font-size: 16px;\n line-height: 24px;\n font-weight: bold;\n }\n \n .slider-txt p {\n bottom: 30px;\n position: absolute;\n }\n```\n\n```\n\n <!-- スライダーのメインコンテナの div 要素 -->\n <div class=\"swiper-container\">\n \n <!-- ラッパー(クラス名=slider)の(スライドを囲む) div 要素 -->\n <div class=\"card-slider\">\n \n <!-- それぞれのスライドの div 要素(1) -->\n <div class=\"slider\">\n <img src=\"img/digital-marketing-1433427_1280.png\" alt=\"実績画像1\">\n <div class=\"slider-txt\">\n <h3>株式会社サンプル採用サイトのコーディングを行いました!</h3>\n <p></p>\n </div>\n </div>\n \n <!-- それぞれのスライドの div 要素(2) -->\n <div class=\"slider\">\n <img src=\"img/arnel-hasanovic-MNd-Rka1o0Q-unsplash.png\" alt=\"実績画像2\">\n <div class=\"slider-txt\">\n <h3>コーディングカンファレンスのイベント LPの制作を行いました!</h3>\n <p>採用技術:jQuery,WordPress<br>実装期間:4週間<br>担当コーダー:石井</p>\n </div>\n </div>\n \n <!-- それぞれのスライドの div 要素(3) -->\n <div class=\"slider\">\n <img src=\"img/digital-marketing-1433427_1280.png\" alt=\"実績画像3\">\n <div class=\"slider-txt\">\n <h3>株式会社サンプル様採用サイトのコーデ ィングを行いました!</h3>\n <p>採用技術:jQuery,Bootstrap4<br>実装期間:2週間<br>担当コーダー:石井</p>\n </div>\n </div>\n \n <!-- それぞれのスライドの div 要素(4) -->\n <div class=\"slider\">\n <img src=\"img/hal-gatewood-tZc3vjPCk-Q-unsplash.png\" alt=\"実績画像4\">\n <div class=\"slider-txt\">\n <h3>株式会社サンプル様通販サイトのコーデ ィングを行いました!</h3>\n <p>採用技術:jQuery,Bootstrap4<br>実装期間:6週間<br>担当コーダー:石井</p>\n </div>\n </div>\n \n <!-- それぞれのスライドの div 要素(5) --> \n <div class=\"slider\">\n <img src=\"img/digital-marketing-1433427_1280.png\" alt=\"実績画像5\">\n <div class=\"slider-txt\">\n <h3>株式会社サンプル採用サイトのコーディ ングを行いました!</h3>\n <p>採用技術:jQuery,Bootstrap4<br>実装期間:2週間<br>担当コーダー:石井</p>\n </div>\n </div>\n \n </div><!-- ラッパー(クラス名=slider)の(スライドを囲む) div 要素 -->\n </div><!-- スライダーのメインコンテナの div 要素 -->\n```\n\n**エラーメッセージ:**\n\n```\n\n autoplay.js:87 Uncaught TypeError: Cannot read property 'addEventListener' of undefined\n at autoplay.js:87\n at Array.forEach (<anonymous>)\n at t.pause (autoplay.js:86)\n at t.onVisibilityChange (autoplay.js:95)\n (anonymous) @ autoplay.js:87\n pause @ autoplay.js:86\n onVisibilityChange @ autoplay.js:95\n \n utils.js:28 Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.\n at utils.js:28\n at T (utils.js:45)\n at t.getTranslate (getTranslate.js:15)\n at t.loopFix (loopFix.js:20)\n at autoplay.js:36\n \n```", "comment_count": 1, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T12:44:47.983", "favorite_count": 0, "id": "78011", "last_activity_date": "2023-05-17T03:15:42.073", "last_edit_date": "2021-07-06T15:12:41.123", "last_editor_user_id": "3060", "owner_user_id": "43659", "post_type": "question", "score": 0, "tags": [ "javascript", "swiper" ], "title": "swiper が動作しません", "view_count": 867 }
[ { "body": "## エラー内容\n\nエラーの内容はHTML内のクラス名が適切でないので、指定のElementが取得できず(undefined)参照エラーになっている、というものです。\n\n## Swiperの使用方法\n\n[Swiperの公式ドキュメント](https://swiperjs.com/get-started)はご覧になっていますか? \n巷のブログを検索するよりずっと信頼性の高いドキュメントです。 \n基本的には、公式ドキュメントのGetting Started 通りにHTMLを実装していけば問題なく動作します。 \n[公式ドキュメントのHTML Layout](https://swiperjs.com/get-started#add-swiper-html-\nlayout)はこのように記載されています。\n\n```\n\n <!-- Slider main container -->\n <div class=\"swiper-container\">\n <!-- Additional required wrapper -->\n <div class=\"swiper-wrapper\">\n <!-- Slides -->\n <div class=\"swiper-slide\">Slide 1</div>\n <div class=\"swiper-slide\">Slide 2</div>\n <div class=\"swiper-slide\">Slide 3</div>\n ...\n </div>\n <!-- If we need pagination -->\n <div class=\"swiper-pagination\"></div>\n \n <!-- If we need navigation buttons -->\n <div class=\"swiper-button-prev\"></div>\n <div class=\"swiper-button-next\"></div>\n \n <!-- If we need scrollbar -->\n <div class=\"swiper-scrollbar\"></div>\n </div>\n \n```\n\nここから、実際のスライドとなる`div.swiper-slide`要素の中身を記載していくだけです。 \n他のタグやクラス名を変更してはいけません。(厳密には変更可能ですが、初心者向けのカスタマイズではないのでまずはテンプレート通りの実装で慣れてください)\n\n## 補足\n\nクラス名の付け方で察するに、slickと混同しているのではないかと思われます。 \nslickとswiperは全く別物です。注意してください。\n\n以下、クラス名を適切に変更したスニペットです。スタイルも若干いじっています。 \n\n```\n\n var mySwiper = new Swiper ('.swiper-container', {\n // 以下にオプションを設定\n loop: true,\n autoplay:{\n delay: 5000,\n }, \n });\n```\n\n```\n\n .card-slider {\n display: flex;\n justify-content: space-between;\n }\n \n .swiper-slide{\n width: 100%;\n background-color: #abe;\n }\n \n .slider-txt {\n padding-top: 18px;\n padding-left: 18px;\n padding-right: 17px;\n text-align: left;\n height: 196px;\n position: relative;\n }\n \n .slider-txt h3 {\n font-size: 16px;\n line-height: 24px;\n font-weight: bold;\n }\n \n .slider-txt p {\n bottom: 30px;\n position: absolute;\n }\n```\n\n```\n\n <script src=\"https://unpkg.com/swiper/swiper-bundle.min.js\"></script>\n <link rel=\"stylesheet\" href=\"https://unpkg.com/swiper/swiper-bundle.min.css\" />\n <!-- スライダーのメインコンテナの div 要素 -->\n <div class=\"swiper-container\">\n \n <!-- ラッパー(クラス名=slider)の(スライドを囲む) div 要素 -->\n <div class=\"swiper-wrapper\">\n \n <!-- それぞれのスライドの div 要素(1) -->\n <div class=\"swiper-slide\">\n <img src=\"img/digital-marketing-1433427_1280.png\" alt=\"実績画像1\">\n <div class=\"slider-txt\">\n <h3>株式会社サンプル採用サイトのコーディングを行いました!</h3>\n <p></p>\n </div>\n </div>\n \n <!-- それぞれのスライドの div 要素(2) -->\n <div class=\"swiper-slide\">\n <img src=\"img/arnel-hasanovic-MNd-Rka1o0Q-unsplash.png\" alt=\"実績画像2\">\n <div class=\"slider-txt\">\n <h3>コーディングカンファレンスのイベント LPの制作を行いました!</h3>\n <p>採用技術:jQuery,WordPress<br>実装期間:4週間<br>担当コーダー:石井</p>\n </div>\n </div>\n \n <!-- それぞれのスライドの div 要素(3) -->\n <div class=\"swiper-slide\">\n <img src=\"img/digital-marketing-1433427_1280.png\" alt=\"実績画像3\">\n <div class=\"slider-txt\">\n <h3>株式会社サンプル様採用サイトのコーデ ィングを行いました!</h3>\n <p>採用技術:jQuery,Bootstrap4<br>実装期間:2週間<br>担当コーダー:石井</p>\n </div>\n </div>\n \n <!-- それぞれのスライドの div 要素(4) -->\n <div class=\"swiper-slide\">\n <img src=\"img/hal-gatewood-tZc3vjPCk-Q-unsplash.png\" alt=\"実績画像4\">\n <div class=\"slider-txt\">\n <h3>株式会社サンプル様通販サイトのコーデ ィングを行いました!</h3>\n <p>採用技術:jQuery,Bootstrap4<br>実装期間:6週間<br>担当コーダー:石井</p>\n </div>\n </div>\n \n <!-- それぞれのスライドの div 要素(5) --> \n <div class=\"swiper-slide\">\n <img src=\"img/digital-marketing-1433427_1280.png\" alt=\"実績画像5\">\n <div class=\"slider-txt\">\n <h3>株式会社サンプル採用サイトのコーディ ングを行いました!</h3>\n <p>採用技術:jQuery,Bootstrap4<br>実装期間:2週間<br>担当コーダー:石井</p>\n </div>\n </div>\n \n </div><!-- ラッパー(クラス名=slider)の(スライドを囲む) div 要素 -->\n </div><!-- スライダーのメインコンテナの div 要素 -->\n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T17:03:10.077", "id": "78012", "last_activity_date": "2021-07-06T17:03:10.077", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46944", "parent_id": "78011", "post_type": "answer", "score": 1 } ]
78011
null
78012
{ "accepted_answer_id": null, "answer_count": 1, "body": "プログラミングに関して素人もいいところなのですが \n腸内細菌の研究をやる必要がありqiime2を使用しています。 \n解析途中で躓いてしまい教えていただけたらと思います。\n\ndenoiseの作業のところで、以前は問題なくできていたのですが \n別のことでezRをダウンロードしてから?(関係あるかわかりませんが) \nストップするようになってしまいました。 \n`--verbose` でエラーをみると\n\n```\n\n (qiime2-2021.2) ユーザー名@MacBook-Air start2 % qiime dada2 denoise-paired --i-demultiplexed-seqs paired-end-demux.qza --o-table table.qza --o-representative-sequences rep-seqs.qza --p-trim-left-f 17 --p-trim-left-r 21 --p-trunc-len-f 280 --p-trunc-len-r 250 --o-denoising-stats stats-dada2.qza --verbose\n Running external command line application(s). This may print messages to stdout and/or stderr.\n The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.\n \n Command: run_dada_paired.R /var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/forward /var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/reverse /var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/output.tsv.biom /var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/track.tsv /var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/filt_f /var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/filt_r 280 250 17 21 2.0 2.0 2 independent consensus 1.0 1 1000000\n \n library(Rcmdr) でエラー: ‘Rcmdr’ という名前のパッケージはありません \n 実行が停止されました \n Traceback (most recent call last):\n File \"/Users/ユーザー名/opt/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/q2_dada2/_denoise.py\", line 264, in denoise_paired\n run_commands([cmd])\n File \"/Users/ユーザー名/opt/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/q2_dada2/_denoise.py\", line 36, in run_commands\n subprocess.run(cmd, check=True)\n File \"/Users/ユーザー名/opt/miniconda3/envs/qiime2-2021.2/lib/python3.6/subprocess.py\", line 438, in run\n output=stdout, stderr=stderr)\n subprocess.CalledProcessError: Command '['run_dada_paired.R', '/var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/forward', '/var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/reverse', '/var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/output.tsv.biom', '/var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/track.tsv', '/var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/filt_f', '/var/folders/_6/sz481stn0wd8c75djm0kql6m0000gn/T/tmpsazbpz18/filt_r', '280', '250', '17', '21', '2.0', '2.0', '2', 'independent', 'consensus', '1.0', '1', '1000000']' returned non-zero exit status 1.\n \n During handling of the above exception, another exception occurred:\n \n Traceback (most recent call last):\n File \"/Users/ユーザー名/opt/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/q2cli/commands.py\", line 329, in __call__\n results = action(**arguments)\n File \"<decorator-gen-522>\", line 2, in denoise_paired\n File \"/Users/ユーザー名/opt/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/sdk/action.py\", line 245, in bound_callable\n output_types, provenance)\n File \"/Users/ユーザー名/opt/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/sdk/action.py\", line 390, in _callable_executor_\n output_views = self._callable(**view_args)\n File \"/Users/ユーザー名/opt/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/q2_dada2/_denoise.py\", line 279, in denoise_paired\n \" and stderr to learn more.\" % e.returncode)\n Exception: An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.\n \n Plugin error from dada2:\n \n An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.\n \n```\n\nRをいじったりしてからということで\n\n```\n\n library(Rcmdr) でエラー: ‘Rcmdr’ という名前のパッケージはありません\n \n```\n\nこれがなにか関係しているのかもと思いezRを消去したのち再度インストールなどをしても治りません。 \nちなみにRのコンソールにも同じ文言がでるようになりました。\n\nなにか対処法などご存知の方がいたらお教えいただけたらと思います。 \nよろしくお願いいたします。", "comment_count": 6, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T21:46:05.410", "favorite_count": 0, "id": "78013", "last_activity_date": "2021-07-12T10:10:23.913", "last_edit_date": "2021-07-07T00:23:15.703", "last_editor_user_id": "3060", "owner_user_id": "47185", "post_type": "question", "score": 2, "tags": [ "r" ], "title": "library(Rcmdr) でエラー: ‘Rcmdr’ という名前のパッケージはありません", "view_count": 1416 }
[ { "body": "返信が遅れてすいません.\n\n`~/.Rprofile` のEZR関係の記述を消して使用してください. EZR も併用したい場合は, Rcmdr\n起動のたびにウィンドウから「プラグイン読み込み」を選ぶか, [EZRの公式チュートリアル](https://www.jichi.ac.jp/saitama-\nsct/SaitamaHP.files/manual.html)にあるような起動コマンドをスクリプトやエイリアスとして保存することになると思います.\n\n> ezRのHPの最後のあたりにある、ターミナルに以下のコマンドの設定をしてからおかしくなった?\n\nという疑念はおそらく正しく, `~/.Rprofile` のこの設定はどうやらEZR用に修正した Rcmdr\nのプログラムを上書きする形で読み込ませているようです. EZRはほぼ国内でのみの通用のため qiime2 開発側は想定しておらず,\nかつEZR側も他ソフトとの競合を考慮していないようなのでこのような事が起こっているのだと思います.\n\n(EZR をあまり使ってないだけでなく) qiime2 にも生物学にも詳しくないので `denoise-paired` の入力データの形式がわからず,\n代わりに[公式チュートリアル](https://docs.qiime2.org/2021.4/tutorials/fmt/)を参考に `denoise-\nsingle` を試してみだけですが, 同様のエラーが発生し, `.Rprofile` の記述を消すと動作することを確認したため, このように結論します.", "comment_count": 4, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-12T10:10:23.913", "id": "78132", "last_activity_date": "2021-07-12T10:10:23.913", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "40575", "parent_id": "78013", "post_type": "answer", "score": 1 } ]
78013
null
78132
{ "accepted_answer_id": null, "answer_count": 1, "body": "VARCHAR型で、格納最大字数を300文字~500文字ぐらいの範囲でどうしようか検討しているのですが、 \n格納最大字数と必要なバイト数は、完全な相関関係ではないのですが?\n\n[バイトの分かれ目](http://cafe.76bit.com/creative/web-design/2142/)\n\nVARCHAR(1)とVARCHAR(255)は、格納可能な文字数は異なるが、文字数を保持する領域は同じ1バイトですか? \n→だったら、VARCHAR(255)に設定した方が良いと解釈してよいですか?\n\nVARCHAR(256)とVARCHAR(65,535)は、格納可能な文字数は異なるが、文字数を保持する領域は同じ2バイトですか? \n→だったら、VARCHAR(65,535)に設定した方が良いと解釈してよいですか? \n※後から設定変更するのは手間なので、同じバイト数なら最大文字数が多い設定にあらかじめしておいた方がよいのでは、と思いました。\n\nMySQL5.7 \nInnoDB \nutf8mb4_general_ci", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-06T23:44:10.513", "favorite_count": 0, "id": "78014", "last_activity_date": "2022-11-14T13:05:45.823", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "7886", "post_type": "question", "score": 2, "tags": [ "mysql" ], "title": "VARCHAR(256)とVARCHAR(65,535)の違いについて", "view_count": 1354 }
[ { "body": "何をもって「だったら、VARCHAR(255)に設定した方が良いと解釈」するのかが曖昧ですが\n(余裕を持たせる?)、マニュアルには以下の様な記載があるので、こちらを一つの判断材料にしてみてはいかがでしょうか。\n\n[11.4.1 CHAR および VARCHAR 型](https://dev.mysql.com/doc/refman/5.6/ja/char.html)\n\n> VARCHAR 値は、1 バイトまたは 2\n> バイト長のプリフィクスの付いたデータとして格納されます。長さプリフィクスは、値に含まれるバイト数を示します。255 バイト以下の値を格納するカラムでは\n> 1 バイト長のプリフィクスを使用し、255 バイトよりも大きい値を格納するカラムでは 2 バイト長のプリフィクスを使用します。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-07T03:20:36.927", "id": "78015", "last_activity_date": "2021-07-07T03:20:36.927", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "3060", "parent_id": "78014", "post_type": "answer", "score": 1 } ]
78014
null
78015
{ "accepted_answer_id": "78017", "answer_count": 1, "body": "この場合、rowsに対して期待された結果[[right, black], [right, red]]が得られていないようです。誰か問題点を指摘できますか ?\n\n```\n\n const values = [[,,],[,'right','black'],[,'right','red'], [,'left','black'],[,'left', 'black']];\n const cols=[];\n const rows=[];\n for(let row=1;row<5;row=row+1){\n if(values[row][1]=='right'){\n cols.splice(0);\n for(let i=1;i<3;i=i+1){cols.push(values[row][i]);}\n rows.push(cols);\n }\n }\n Logger.log(rows)// [[right, red], [right, red]]\n \n```", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-07T05:52:32.487", "favorite_count": 0, "id": "78016", "last_activity_date": "2021-07-07T06:19:06.347", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47188", "post_type": "question", "score": 1, "tags": [ "google-apps-script" ], "title": "特定要素が存在する配列のみ別の配列に追加する", "view_count": 65 }
[ { "body": "## 問題点\n\n`rows` に constで宣言した配列`cols`をpushしているのがミステイクです。 \n配列Aに配列Bをpushする場合、実際に配列Aにpushされるデータは配列Bの参照です。 \nなので、質問文のコードのrowsに入っているデータは`[cols, cols]`と同義です。 \n試しに、質問文のコードに続いて以下のコードを実行してみてください。\n\n```\n\n cols.push('foo');\n Logger.log(rows)\n \n```\n\n結果は、`[[right, red, foo], [right, red, foo]]` になるはずです。 \nこのことで、rowsの中に入っているのはcolsの参照でしかないことが分かります。\n\nこの現象を回避するには、rowsにpushする配列colsをif文のスコープ中で毎回新しく作成すれば良いです。\n\n```\n\n const values = [[,,],[,'right','black'],[,'right','red'], [,'left','black'],[,'left', 'black']];\n // const cols は不要。\n const rows=[];\n for(let row=1;row<5;row=row+1){\n if(values[row][1]=='right'){\n let cols = []; // if内でブロックスコープとしてcolsを定義する。\n for(let i=1;i<3;i=i+1){cols.push(values[row][i]);}\n rows.push(cols);\n }\n };\n Logger.log(rows) // [ [ 'right', 'black' ], [ 'right', 'red' ] ]\n \n```", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-07T06:19:06.347", "id": "78017", "last_activity_date": "2021-07-07T06:19:06.347", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "46944", "parent_id": "78016", "post_type": "answer", "score": 0 } ]
78016
78017
78017
{ "accepted_answer_id": "78024", "answer_count": 1, "body": "**概要** \nWindowsでWSL2を有効化し、UbuntuにChromeをインストールして、bashのコマンドラインで起動すると、以前はUbuntu版のChromeが起動していたが、ある日急にWindows版が起動されるようになってしまった。Ubuntu版が起動するように戻したい。\n\n**詳細** \nWindows 10において、WSL2を有効化し、Ubuntu 20.04をインストールしました。 \n目的はPython3+Selenium+ChromeDriverを使って、Chromeブラウザーを自動化することです。\n\nXサーバーとしてVcXsrvをインストールし、設定しました。 \nxeyesおよびEmacsは正常に動作しているので、ここまでに問題はないと思います。\n\n次に、以下のコマンドによって、UbuntuにChromeをインストールしました。\n\n```\n\n $ sudo sh -c 'echo \"deb http://dl.google.com/linux/chrome/deb/ stable main\" >> /etc/apt/sources.list.d/google-chrome.list' # 供給元を追加する\n $ sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - # 公開鍵を追加する\n $ sudo apt update\n $ sudo apt install google-chrome-stable\n \n```\n\n次に、Chromeを起動しました。\n\n```\n\n $ google-chrome&\n \n```\n\nこれで、最初のうちは、Ubuntu側のChromeが起動していました。\n\nしかし、ある日急に、同じコマンドでWindowsのChromeが起動してしまうようになりました。\n\n```\n\n $ google-chrome\n \n```\n\nとフォアグラウンド実行しても$プロンプトが表示され、`ps`コマンドを入力してもgoogle-\nchromeプロセスが見えません。(以前Ubuntu側のChromeが実行できていたときは見えていました)\n\n```\n\n $ which google-chrome\n \n```\n\nで`/home/user_name/bin/google-chrome`と返るので、フルパスを指定して\n\n```\n\n $ /home/user_name/bin/google-chrome\n \n```\n\nと書いて起動しても同じ結果になります。\n\n関係あるかどうか分かりませんが、WindowsのChromeをすべて閉じても、Windowsのタスクマネージャーでプロセスを見ると「Google\nChrome」というプロセスが11個走っています。これが問題かと思いすべて右クリックしてプロセスを殺して、再度Ubuntuで\n\n```\n\n $ /home/user_name/bin/google-chrome\n \n```\n\nと書いても同じ結果になります。\n\nWindowsを再起動して、まったくChromeを起動しない状態でも、Windowsのタスクマネージャーでプロセスを見ると「Google\nChrome」というプロセスが11個走っています。この時点で\n\n```\n\n $ /home/user_name/bin/google-chrome\n \n```\n\nと書いても同じ結果になります。\n\nWindowsを再起動して、まったくChromeを起動しない状態で、タスクマネージャーを開いて「Google\nChrome」というプロセスをすべて右クリックしてプロセスを殺して、再度Ubuntuで\n\n```\n\n $ /home/user_name/bin/google-chrome\n \n```\n\nと書いても同じ結果になります。\n\nSeleniumはFirefoxもサポートしているので、Chromeを使わなければいいような気がしますが、Google\nDriveなどのサービスと連携するワークフローを設計している関係で、出来ればChromeを使いたい状態です。\n\n元のようにUbuntu側のChromeを起動するにはどうすればいいのでしょうか。", "comment_count": 3, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-07T09:40:43.530", "favorite_count": 0, "id": "78021", "last_activity_date": "2021-07-09T08:29:33.697", "last_edit_date": "2021-07-09T08:29:33.697", "last_editor_user_id": "-1", "owner_user_id": "26673", "post_type": "question", "score": 1, "tags": [ "ubuntu", "windows-10", "google-chrome", "wsl-2" ], "title": "WSL2にChromeをインストールしたのにWindows側が起動されてしまう", "view_count": 1623 }
[ { "body": "質問者自己回答です。 \nいただいたコメントをきっかけに真相に到達しましたが、もとの問題は完全に私の失敗でした。 \n(質問ごと消したほうがいいか、バカ事例として残すのも意味があるのか思案中です。ご教示賜れば幸いです)\n\n**まとめ** \n結論としては、`/home/user_name/bin/google-chrome`という名前で、以下のようなシェルスクリプトを作っていました。\n\n```\n\n #! /bin/sh\n \n exec /mnt/c/Program\\ Files\\ \\(x86\\)/Google/Chrome/Application/chrome.exe \"$@\"\n \n```\n\nこちらは、WSL1を使っていた頃に、Windows版のChromeを起動するために、わざわざ置いていたものでした。\n\n質問の中で書いた`apt install`でインストールされたUbuntu版の実体は`/usr/bin/google-\nchrome`にありますが、`/home/user_name/bin`の方が`PATH`に先に入っていたので優先実行されていました。\n\n**判明までの過程** \nどうやって分かったかは以下の通りです。\n\nWSL2のUbuntuからWindowsのexeファイルを実行するのはWSL2の相互運用性という機能を使います。\n\n<https://docs.microsoft.com/ja-jp/windows/wsl/interop#disable-\ninteroperability>\n\nこれを無効化してみました。\n\n上記のドキュメントによると以下のコマンドをsuとして実行します。\n\n```\n\n # echo 0 > /proc/sys/fs/binfmt_misc/WSLInterop\n \n```\n\nこちらは、一般ユーザーとしてログインした状態で`sudo`を使っても「/proc/sys/fs/binfmt_misc/WSLInteropの権限がありません」と言われ、`su`でスーパーユーザーとしてログインしないと操作できません。\n\nUbuntuでは、デフォルトでrootユーザーのパスワードが設定されていないので、以下の操作を行います(xxxxxは任意のパスワード)。\n\n```\n\n $ sudo su -\n # passwd\n Enter new UNIX password: xxxxx\n Retype new UNIX password: xxxxx\n passwd: password updated successfully\n \n```\n\nそして以下のようにsuとしてログインして以下の操作を行います。\n\n```\n\n $ su\n Password: \n # echo 0 > /proc/sys/fs/binfmt_misc/WSLInterop\n # exit\n \n```\n\nこれで、Windows版のChromeをUbuntu側から実行できなくなりました。 \nこの状態でもう一度google-chromeを起動してみました。 \nエラーが発生します。\n\n```\n\n $ /home/user_name/bin/google-chrome: 3: exec: /mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe: Exec format error\n \n [1]+ 終了 2 /home/user_name/bin/google-chrome\n \n```\n\nこれで、さすがの私も、`/home/user_name/bin/google-\nchrome`はシェルスクリプトであると分かったので変名し、改めてgoogle-chromeの場所を探しました。\n\n```\n\n $ which google-chrome\n /usr/bin/google-chrome\n \n```\n\nで、`/usr/bin/google-chrome`を改めて起動すると、ちゃんとUbuntu版のChromeが起動しました。\n\n以上です。すみませんでした。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-07T11:31:20.917", "id": "78024", "last_activity_date": "2021-07-09T08:19:10.607", "last_edit_date": "2021-07-09T08:19:10.607", "last_editor_user_id": "26673", "owner_user_id": "26673", "parent_id": "78021", "post_type": "answer", "score": 1 } ]
78021
78024
78024
{ "accepted_answer_id": null, "answer_count": 1, "body": "TeX Live 2018とAtomのLaTeXパッケージでupLaTeXを利用しています。 \n作成している文書に索引を付けるため、プリアンブルに \n\\usepackage{makeidx} \n\\makeindex \nを、本文に\\printindexを書いています。索引は作れるものの、日本語パートが一塊になってしまいます。つまり、「あ」で始まる単語と「い」で始まる単語の間に空行が入っていない状態です(英字パートは適切に空行が入っています)。\n\n調べたところ、idxファイルからindファイルを作るのに、mendexではなくmakeindexが使われているのが原因らしいことが分かりました。実際、コマンドプロンプトでuplatex,\nmendex,\nuplatexの順に実行すると、望んだ出力が得られました。自分にできたのはここまでで、どうすればAtomでbuildする際にmendexを使うように設定できるかが分かりません。どうすればいいか教えていただけると助かります。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-07T09:59:48.507", "favorite_count": 0, "id": "78022", "last_activity_date": "2021-07-09T05:49:56.000", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47192", "post_type": "question", "score": 1, "tags": [ "atom-editor", "latex" ], "title": "AtomのLaTeXにmendexを使わせるには?", "view_count": 119 }
[ { "body": "自己解決しました。具体的には、[latex:latexmkの設定\n[雑多な記録]](http://www2.yukawa.kyoto-u.ac.jp/%7Ekoudai.sugimoto/dokuwiki/doku.php?id=latex:latexmk%E3%81%AE%E8%A8%AD%E5%AE%9A)の方法を使ったところ上手くいきました。\n\nAtomのlatexパッケージはlatexmkを利用しているので、latexパッケージの設定ではなくlatexmkの設定を変えます。そのために、C:User\\Usernameの下に.latexmkrcという名称のファイルを作成し、そこに設定を書き込みます。今回はmakeindexをmendexに変えたかったので、\n\n```\n\n $makeindex = 'mendex -U %O -o %D %S';\n \n```\n\nとだけ書きました。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-09T05:49:56.000", "id": "78068", "last_activity_date": "2021-07-09T05:49:56.000", "last_edit_date": null, "last_editor_user_id": null, "owner_user_id": "47192", "parent_id": "78022", "post_type": "answer", "score": 1 } ]
78022
null
78068
{ "accepted_answer_id": null, "answer_count": 1, "body": "以下の様なリストがあるとします。\n\n```\n\n a=list(range(1,6))\n a.reverse()\n \n```\n\nこの時、以下のコードでは成功するのですが\n\n```\n\n b=[i+g for i,g in enumerate(a)]\n print(b)\n \n```\n\n以下のコードだと `i` が \"can not assign to operator\" と出ます。\n\n```\n\n b=[]\n for i,g in enumerate(a):\n i+g=c\n b.append(c)\n print(b)\n \n```\n\n内包表記だと上手くいくのに、分けて書くとNGなのはなぜですか? \n初歩的なところだと思いますが、回答よろしくお願いします。", "comment_count": 2, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-07T10:33:25.220", "favorite_count": 0, "id": "78023", "last_activity_date": "2021-07-07T13:16:58.520", "last_edit_date": "2021-07-07T13:16:58.520", "last_editor_user_id": "3060", "owner_user_id": "47194", "post_type": "question", "score": 1, "tags": [ "python" ], "title": "enumerateでindexと数字を+時の質問", "view_count": 58 }
[ { "body": "`i+g=c` の代入方向が間違いで、正しくは `c=i+g` でした。 \nコメントありがとうございました。", "comment_count": 0, "content_license": "CC BY-SA 4.0", "creation_date": "2021-07-07T12:13:00.087", "id": "78027", "last_activity_date": "2021-07-07T13:13:57.143", "last_edit_date": "2021-07-07T13:13:57.143", "last_editor_user_id": "3060", "owner_user_id": "47194", "parent_id": "78023", "post_type": "answer", "score": 1 } ]
78023
null
78027