Python: singledispatch

singledispatch PEP 443 – Single-dispatch generic functions single-dispatch generic functions : form of generic programming 記事 Generic Function in Python with Singledispatch

2021年5月24日 · 1 分

Vue.js: 再描画

Vue.js: DOMの再描画 Vue.jsでビューの変更がされないときに疑うこと+主な解決策方法 Vue.jsでビューの変更がされないときに疑うこと+主な解決策方法 List Rendering リストレンダリング The correct way to force Vue to re-render a component 配列: 配列自体を置き換えて変更すること オブジェクト Object.assign / スプレッド構文 など使って新しいオブジェクトで代入し直す key属性を使う DOMを再利用させないようにする v-if でゲートをかける true で再レンダリング nextTick で変更 1 2 3 this.$nextTick(() => { // do modify })

2021年5月22日 · 1 分

Laravel: マイグレーション

Laravel マイグレーション Laravel マイグレーションを1つずつ戻す 1 $ php artisan migrate:rollback --step=1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 MySQL [mysite]> select * from migrations; +----+--------------------------------------------------------------+-------+ | id | migration | batch | +----+--------------------------------------------------------------+-------+ | 1 | 2014_10_12_000000_create_users_table | 1 | | 2 | 2014_10_12_100000_create_password_resets_table | 1 | | 3 | 2019_08_19_000000_create_failed_jobs_table | 1 | | 4 | 2019_12_14_000001_create_personal_access_tokens_table | 1 | | 5 | 2021_01_27_074301_create_sessions_table | 1 | | 6 | 2021_02_03_055949_create_products_table | 1 | | 7 | 2021_02_03_060047_create_news_table | 1 | | 8 | 2021_02_08_024947_create_credit_cards_table | 1 | | 9 | 2021_02_08_025236_create_licenses_table | 1 | | 10 | 2021_02_08_060434_create_orders_table | 1 | | 11 | 2021_02_18_124506_create_options_table | 1 | | 12 | 2021_03_10_093455_update_string_fields_to_text | 2 | | 13 | 2021_04_09_123358_add_users_deleted_at_field | 3 | | 14 | 2021_04_09_123459_add_licenses_subscription_cancelled_fields | 3 | +----+--------------------------------------------------------------+-------+ 14 rows in set (0.002 sec) 1 % php artisan migrate:rollback --step=1 ************************************** * Application In Production! * ************************************** Do you really wish to run this command? (yes/no) [no]: > yes Rolling back: 2021_04_09_123459_add_licenses_subscription_cancelled_fields Rolled back: 2021_04_09_123459_add_licenses_subscription_cancelled_fields (165.69ms) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 MySQL [mysite]> select * from migrations; +----+-------------------------------------------------------+-------+ | id | migration | batch | +----+-------------------------------------------------------+-------+ | 1 | 2014_10_12_000000_create_users_table | 1 | | 2 | 2014_10_12_100000_create_password_resets_table | 1 | | 3 | 2019_08_19_000000_create_failed_jobs_table | 1 | | 4 | 2019_12_14_000001_create_personal_access_tokens_table | 1 | | 5 | 2021_01_27_074301_create_sessions_table | 1 | | 6 | 2021_02_03_055949_create_products_table | 1 | | 7 | 2021_02_03_060047_create_news_table | 1 | | 8 | 2021_02_08_024947_create_credit_cards_table | 1 | | 9 | 2021_02_08_025236_create_licenses_table | 1 | | 10 | 2021_02_08_060434_create_orders_table | 1 | | 11 | 2021_02_18_124506_create_options_table | 1 | | 12 | 2021_03_10_093455_update_string_fields_to_text | 2 | | 13 | 2021_04_09_123358_add_users_deleted_at_field | 3 | +----+-------------------------------------------------------+-------+ 13 rows in set (0.002 sec)

2021年5月17日 · 2 分

Python:Exception

Python: Exception Python Exceptions: An Introduction 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 try: # 処理 linux_interaction() except AssertionError as error: # 例外 print(error) else: ## 例外がない場合 try: with open('file.log') as file: read_data = file.read() except FileNotFoundError as fnf_error: print(fnf_error) finally: # 最後に必ず実行 print('Cleaning up, irrespective of any exceptions.') Python Exception Base Classes 組み込み例外 8.6. ユーザー定義例外

2021年5月14日 · 1 分

Radio

Radio 曜日 Ch 時間 番組 月 J-Wave 22:00 - 24:00 SONAR MUSIC 月 NHK 24:00 - 24:50 夜のプレイリスト 火 J-Wave 22:00 - 24:00 SONAR MUSIC 火 NHK 24:00 - 24:50 夜のプレイリスト 水 J-Wave 22:00 - 24:00 SONAR MUSIC 水 NHK 24:00 - 24:50 夜のプレイリスト 木 J-Wave 22:00 - 24:00 SONAR MUSIC 木 NHK 24:00 - 24:50 夜のプレイリスト 金 InterFM 897 20:00 - 22:00 TOKYO SCENE 金 NHK 24:00 - 24:50 夜のプレイリスト 金 InterFM 897 24:00 - 25:00 beatDAYZ 土 Fm yokohama84.7 24:00 - 25:00 Bayside Reggae Lounge 日 J-Wave 20:00 - 21:00 Travelling without Moving Station Apple Music Radio BBC Sound nts worldwidefm soundcloud mixcloud

2021年5月10日 · 1 分

Django: Request.encodingについて

HttpRequest.encoding django.http.request.HttpRequest cgi.parse_header で、Content-Typeヘッダーから content_type と content_params(dict) を取得。 conent_paramsに charset が入っている可能性がある codecs.lookup を使って、charset の存在を確認。 存在したらHttpRequest.encodingプロパティに設定する 実態は, HttpRequest._encoding

2021年4月24日 · 1 分

DRF: CSVを送信するするときに WindowsだとBOMをつけないとExcelで文字化けする問題

BOM(byte order mark) ファイルの先頭3バイトが ‘EF BB BF’ の UTF-8 rest_framework_csv rendererで、 コンテキストの encoding を判定している encodingに utf-8-sig を 指定する viewset: get_renderer_context をオーバーライドする 1 2 3 4 5 6 7 8 9 10 11 def get_renderer_context(self): """(override)""" context = super().get_renderer_context() # ここで、以下の条件の時に utf-8-sigにセット # 1) text/csv を求めている # 2) utf-8 でエンコードが指定されている(デフォルト) if self.request.META.get('HTTP_ACCEPT', '').startswith('text/csv'): context['encoding'] = 'utf-8-sig' return context 記事 bom付きutf-8に変換するnkfコマンド PythonでUTF-8 with BOMを開く Declaring character encodings in HTML The byte-order mark (BOM) in HTML Accept-Encoding HttpRequest.META

2021年4月24日 · 1 分

XCode: A valid provisioning profile for this executable was not found

原因 時間がおかしい(有効期限切れ) Legacy Build System にする (File >Project Settings...>Build System) (今回はこれ) テスト実機端末のスキーマがおかしい(Products > Schema > Edit Schema で Run, Profile の Build Configuration を DEBUG にする) ~/Library/MobileDevice/Provisioning Profiles 1 2 3 4 % ls -l ~/Library/MobileDevice/Provisioning\ Profiles total 456 -rw-r--r-- 1 hdknr staff 10352 4 17 13:52 0179a51b-7303-4fef-b1a0-4a3cf541b737.mobileprovision ..... 記事 【Xcode】ビルドは成功するが、実機にインストールできない問題 エラー:A valid provisioning prof… の対処法 Unable to install iOS app on device. Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402653179 Easy fix! “A valid provisioning profile for this executable was not found” A valid provisioning profile for this executable was not found

2021年4月24日 · 1 分

gistpad-scratch

‎‎​

2021年4月22日 · 1 分

Windows Termnal

https://docs.microsoft.com/ja-jp/windows/terminal/customize-settings/color-schemes https://qiita.com/y-tsutsu/items/833020344aa03539856e

2021年2月26日 · 1 分