投稿時間:2022-08-15 14:22:43 RSSフィード2022-08-15 14:00 分まとめ(27件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT ITmedia 総合記事一覧 [ITmedia News] 会話に使えそうな「ラピュタ」画像をスタジオジブリが公開 「常識の範囲内で、自由につかってください」 https://www.itmedia.co.jp/news/articles/2208/15/news102.html itmedia 2022-08-15 13:45:00
IT ITmedia 総合記事一覧 [ITmedia Mobile] 「二子玉川 蔦屋家電」がオンラインストアで耳をふさがないワイヤレスイヤフォンの限定カラーを予約を受付 https://www.itmedia.co.jp/mobile/articles/2208/15/news083.html ITmediaMobile「二子玉川蔦屋家電」がオンラインストアで耳をふさがないワイヤレスイヤフォンの限定カラーを予約を受付二子玉川蔦屋家電のオンラインストアが、耳をふさがないオープンイヤー型のワイヤレスイヤフォン「ambiesoundearcuffs」の限定カラーを予約を受け付け始めた。 2022-08-15 13:45:00
IT ITmedia 総合記事一覧 [ITmedia News] DMM、2つのメタバース関連サービスを終了へ 「Connect Chat」と「VR Connect」 https://www.itmedia.co.jp/news/articles/2208/15/news100.html connect 2022-08-15 13:44:00
IT ITmedia 総合記事一覧 [ITmedia Mobile] KDDIと沖縄セルラー電話が7月の障害に伴う「返金案内」を開始 8月16日から対象ユーザーに“URLのないSMS”で通知 https://www.itmedia.co.jp/mobile/articles/2208/15/news099.html itmediamobilekddi 2022-08-15 13:40:00
IT ITmedia 総合記事一覧 [ITmedia エンタープライズ] ニューラルネットワークによるグラフィックス生成技術も: NVIDIAが3Dシーン記述言語「USD」の標準化へ 産業向けデジタルツイン実現に道 https://www.itmedia.co.jp/enterprise/articles/2208/11/news056.html ITmediaエンタープライズニューラルネットワークによるグラフィックス生成技術もNVIDIAがDシーン記述言語「USD」の標準化へ産業向けデジタルツイン実現に道NVIDIAは、Dコンテンツ制作を容易にするツール群「NeuralGraphicsSDK」を発表した。 2022-08-15 13:30:00
IT ITmedia 総合記事一覧 [ITmedia PC USER] アーク、Ryzen Threadripper PRO搭載ワークステーションの受注を開始 https://www.itmedia.co.jp/pcuser/articles/2208/15/news092.html itmediapcuser 2022-08-15 13:08:00
IT ITmedia 総合記事一覧 [ITmedia ビジネスオンライン] 昨年売れた「飲む缶カレー」の“進化版”が登場 「じっくりコトコト」を発売 https://www.itmedia.co.jp/business/articles/2208/15/news089.html itmedia 2022-08-15 13:03:00
python Pythonタグが付けられた新着投稿 - Qiita Python自作パッケージのimport時にVSCodeで警告が出る問題の解決 https://qiita.com/ezmscrap/items/1e66d67524228231da74 vscode 2022-08-15 13:28:00
python Pythonタグが付けられた新着投稿 - Qiita DjangoFormsのファイル指定でvalidationする方法 https://qiita.com/muiyuta/items/29ff8a4fdcd9f7026a87 django 2022-08-15 13:17:29
Docker dockerタグが付けられた新着投稿 - Qiita Docker-composeでmariaDBコンテナが立ち上がらない https://qiita.com/ITTYO99/items/8da9f88f473061d3ee76 nginxphpdbph 2022-08-15 13:27:24
技術ブログ Developers.IO fivetranでsync実行時、BigQuery Dataset Not Foundエラーが出た場合(Locationの設定違い) https://dev.classmethod.jp/articles/fivetran-bigquery-dataset-not-found/ bigquery 2022-08-15 04:53:34
技術ブログ Developers.IO 【9/2(金)リモート】データエンジニア特化の会社説明会を開催します https://dev.classmethod.jp/news/jobfair-220902/ 会社説明会 2022-08-15 04:19:25
海外TECH DEV Community Better Golang Error Handling https://dev.to/wspowell/better-golang-error-handling-182m Better Golang Error HandlingTL DR Skip to the end to see the code MotivationI recently reviewed various reasons why the built in golang error is not great In fact if you Google golang error handling you will find many other blogs with various takes on how to navigate errors in golang Even though the topic has seen lots of conversation there really has not been much progress So I will throw out yet another blog post on golang error handling Start FreshFirst thing I will propose though controversial is to throw out everything there is about golang errors Do not use error Do not use the errors package Just throw it all away it was probably just giving you anxiety anyway error was more like a guideline anyway Now that we have no error handling we are open to a new world of possibilities What does an error look like What data should be contained in an error Once created how do we handle an error Can we extend errors now In this blog I propose an error of the simplest possible terms so that it may be extended only as needed The Error Typetype Error T string stringYep Let us just start with a new type called Error Note that we could also just reuse error since it is not a keyword but that gets slightly messy This new Error is simply just a string string is a great starting point because errors messages are usually strings that are human readable Right away we essentially have everything we need An error could be whoops and no error would be empty string To make the usage around this a bit nicer to read we can attach IsSome bool and IsNone bool These two helper functions would just check if the value is For example Create an errorerr errors New string whoops Handle the error if err IsSome Do something useful with the error While this sufficiently covers creating errors and error handling there is more that we can do In fact while these helper functions may remain on a possible real implementation I would propose never using them The reason There is actually an even better approach that utilizes that generic T on the Error type Error EnumsOne major issue with golang is the lack of enums However there are ways to make enums that linters will recognize This usually follows in the form of const EnumType lt some type gt const EnumTypeA EnumType lt some value gt EnumTypeB EnumType lt some value gt and so on Taking some inspiration from rust it would be amazing if we could have something similar to match that would force us to cover all enum cases Fortunately the next best thing is the exhaustive linter In the current version of golang error the only way to create a sentinel error is to do var ErrMyError errors New whoops But there is a problem with this it is a variable not constant So this is not a real fake enum that linters recognize It also does not make sense for these to be mutable globals The proposed new Error type solves this issue by accepting a T string This means the type of the Error itself is different depending on T T is also constrained to string which means two things T can be cast to string T can be const Note that even though T is not stored as a value in the Error type we can still reference it because it is part of the type definition This allows us to keep Error as a simple string while being able to cast it into T Taking some more inspiration from rust we can add a function to Error that does this func self Error T Into T return T self While this all feel like over complicated code since it is all just syntax sugar around string it enables us to now have error handling like this switch err StringError err Into default fmt Println err case errors ErrNone fmt Println no error For a simple Error string default catches an error if it exists and case errors ErrNone catches the no error case However if we have an error enum then that enum type is the T and Into T returns the error of that type This looks like err EnumError switch err Into case ErrMyErrorOne fmt Println err case ErrMyErrorTwo fmt Println err case ErrMyErrorThree fmt Println err case errors ErrNone fmt Println no error Notice there is a case for each enum that was defined and there is no default Technically to be thorough default should be included but if you have to return an error of a certain type then that should not happen but it could What about missing cases If there is a missing case the exhaustive linter will point it out and let you know that you did not include everything Extending ErrorThe golang error will let you extend it and do whatever you want and any viable replacement should allow the same functionality It very well may be that a string is not sufficient for some use cases In that case we still need a way of extending Error without having to change the pattern Let us assume that we desire a unique error code for tracking debugging purposes that is assigned to each Error We can extend Error by creating our new type MyError T string struct and embedding Error in it MyError now has access to the same functionality that Error does while also having the benefit of storing an extra value for an error ID type MyError T string struct errors Error T Other data defined here errId int func New T string err T errId int MyError T return MyError T Error errors New err errId errId The usage is exactly the same except MyError T is returned from a function instead of Error T Advantages BenefitsSo why go through all this effort Maybe you are satisfied with golang error and need more convincing Aside from what has already been stated in the sections above there are more benefits gained from this proposed approach PerformanceThe proposed Error is actually more performant than error This is because error is an interface which means that literally every error ever created requires a memory allocation In straight up benchmark comparisons this is not all that much but all of those allocations add up Here is my non official benchmark comparison between creating a new golang error and an Error error ns op B op allocs opError ns op B op allocs opA x improvement is not too shabby even though we are talking about nanoseconds here Self Documenting CodeDocumentation is always a struggle The moment code changes the documentation must be updated However using enums as types in Error allows us to clearly see what errors a function returns I have used some comments like this before but it just does not feel great Foo does stuff Errors ErrFooFailurefunc Foo error Instead we can now have something like this type SampleError stringconst ErrMyErrorOne SampleError error one ErrMyErrorTwo SampleError error two ErrMyErrorThree SampleError error three func EnumError which int int errors Error SampleError switch which case return errors New ErrMyErrorOne case return errors New ErrMyErrorTwo case return errors New ErrMyErrorThree default return errors None SampleError This is clear ties in with the compiler and is easy to understand The code simply documents itself Accept interfaces return structs This is a general rule in golang code but error completely breaks this since it is an interface Once returned there is no way to operate on the error except through helper functions like errors As Being required to call Unwrap errors As etc means there is uncertainty which usually leads to bugs The uncertainty I am referring to is all of the issues mentioned in my previous post such as error formatting Since Error is not an interface we can operate on it with certainty No WrappingThis touches on another small performance benefit When errors was abandoned for this proposal we also dumped all of that error wrapping insanity error is used as a linked list Since Error is intended to be immutable and one shot there is no chain of errors that must be traversed to check if we got some type of error And with the recent release of go if you happened to have a large set of errors then the proposed switch error handling pattern would benefit from a switch jump table Next StepsThis is proposal is something I am still flushing out but I feel like it shows real promise In fact in just writing this I changed a few things but the core concept remains I will keep iterating and experimenting my personal projects though it may take some some convincing to use an iteration of this in actual projects TL DR Just Show Me The Code error gopackage errorsimport fmt const ErrNone func None T string Error T return Error T func New T string format T values any Error T return newError format values type Error T string stringfunc newError T string format T values any Error T var err string if len values Do not call fmt Sprintf if not necessary Major performance improvement Only necessary if there are any values err fmt Sprintf string format values else err string format return Error T err func self Error T IsNone bool return self func self Error T IsSome bool return self IsNone func self Error T Into T return T self error example test gopackage errors testimport fmt experimentation errors func StringError which int errors Error string switch which case return errors New error s whoops default return errors None string func ExampleStringError switch err StringError err Into default fmt Println err case errors ErrNone fmt Println no error switch err StringError err Into default fmt Println err case errors ErrNone fmt Println no error Output no error error whoops type SampleError stringconst ErrMyErrorOne SampleError error one ErrMyErrorTwo SampleError error two ErrMyErrorThree SampleError error three func EnumError which int int errors Error SampleError switch which case return errors New ErrMyErrorOne case return errors New ErrMyErrorTwo case return errors New ErrMyErrorThree default return errors None SampleError func ExampleEnumError err EnumError switch err Into default fmt Println err case errors ErrNone fmt Println no error err EnumError switch err Into case ErrMyErrorOne fmt Println err case ErrMyErrorTwo fmt Println err case ErrMyErrorThree fmt Println err case errors ErrNone fmt Println no error Output no error error three type MyError T string struct errors Error T Other data defined here errId int func New T string err T errId int MyError T return MyError T Error errors New err errId errId func self MyError T String string return fmt Sprintf error s id d self Error self errId func MyErrorFn MyError string return New whoops func ExampleMyError switch err MyErrorFn err Into default fmt Println err case errors ErrNone fmt Println no error Output error whoops id 2022-08-15 04:11:12
金融 ニッセイ基礎研究所 QE速報:4-6月期の実質GDPは前期比0.5%(年率2.2%)-消費主導のプラス成長 https://www.nli-research.co.jp/topics_detail1/id=72050?site=nli nbsp目次月期は前期比年率と四半期連続のプラス成長・経済の正常化には距離がある本日発表された年月期の実質GDP次速報値は、前期比前期比年率と四半期連続のプラス成長となった当研究所予測月日前期比、年率。 2022-08-15 13:46:56
金融 ニッセイ基礎研究所 グリーンウォッシュを乗り越える~ESGを短期のブームにしないために~ https://www.nli-research.co.jp/topics_detail1/id=72052?site=nli 既に理解されているものとは思うが、ESGやSDGsは私たちが生活している地球や社会のために取り組んでいるものであり、中長期的には、ESGやSDGsに取り組むことが企業の持続可能性を高めるとともに、投資家には収益をもたらすものであるというものである。 2022-08-15 13:29:24
ニュース BBC News - Home Changing kidney blood type may boost transplants https://www.bbc.co.uk/news/uk-62545147?at_medium=RSS&at_campaign=KARANGA changer 2022-08-15 04:46:20
ニュース BBC News - Home Paul O'Grady signs off final Radio 2 show https://www.bbc.co.uk/news/entertainment-arts-62543036?at_medium=RSS&at_campaign=KARANGA beckett 2022-08-15 04:24:43
北海道 北海道新聞 「夫から『一緒に死のう』と」 札幌・白石区、刺殺容疑の妻供述 https://www.hokkaido-np.co.jp/article/717842/ 札幌市白石区 2022-08-15 13:30:00
北海道 北海道新聞 米俳優アン・ヘッシュさんが死去 事故で脳死状態、延命措置を停止 https://www.hokkaido-np.co.jp/article/717870/ 交通事故 2022-08-15 13:13:00
北海道 北海道新聞 名称変更、政治家問い合わせなし 旧統一教会巡り答弁書 https://www.hokkaido-np.co.jp/article/717868/ 統一教会 2022-08-15 13:14:19
ビジネス 東洋経済オンライン 3つの家族の選択の過ちが生む家庭の不和と再生 イタリアの巨匠ナンニ・モレッティ氏の最新作 | 映画・音楽 | 東洋経済オンライン https://toyokeizai.net/articles/-/610530?utm_source=rss&utm_medium=http&utm_campaign=link_back 東洋経済オンライン 2022-08-15 13:30:00
ニュース Newsweek 激変する「成績が良い」の基準──世界に遅れていた日本の初等中等教育が変わる https://www.newsweekjapan.jp/stories/carrier/2022/08/post-99350.php 『Googleが教えてくれた英語が好きになる子の育てかた』村上憲郎著CCCメディアハウス※画像をクリックするとアマゾンに飛びます「先生が教える」という考えはもう古い新しい教育の何が「大改革」なのかといえば、明治維新以来年続いてきた、「先生が一方的に何かを教える」という教育のありかたが、変わってしまうということです。 2022-08-15 13:02:18
マーケティング MarkeZine Nexal上島千鶴氏登壇!BtoBマーケティング組織の成熟度を上げるための理論と実践【参加無料】 http://markezine.jp/article/detail/39689 参加無料 2022-08-15 13:15:00
IT 週刊アスキー SNSなどでも話題! そごう横浜店の富澤商店、イタリア発祥の冷たいデザート「カッサータ」のレシピを紹介するイベント開催 https://weekly.ascii.jp/elem/000/004/101/4101734/ 富澤商店 2022-08-15 13:40:00
IT 週刊アスキー ミニライブやグッズ販売も! メディアミックスプロジェクト「IDOLY PRIDE」と「横浜・八景島シーパラダイス」のコラボ企画を実施 https://weekly.ascii.jp/elem/000/004/101/4101732/ idolypride 2022-08-15 13:30:00
IT 週刊アスキー Yostarの新作アプリ『エーテルゲイザー』がクローズドβテストの参加者募集を開始! https://weekly.ascii.jp/elem/000/004/101/4101741/ android 2022-08-15 13:30:00
海外TECH reddit A Japanese Idol Keeps Messaging Me Unprovoked for the Last 2 Years and has even Sent Me Her Address Twice. Is This Normal? https://www.reddit.com/r/japanlife/comments/wopppp/a_japanese_idol_keeps_messaging_me_unprovoked_for/ 2022-08-15 04:03:53

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)