投稿時間:2021-07-27 00:42:16 RSSフィード2021-07-27 00:00 分まとめ(48件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Architecture Blog Analyze Fraud Transactions using Amazon Fraud Detector and Amazon Athena https://aws.amazon.com/blogs/architecture/analyze-fraud-transactions-using-amazon-fraud-detector-and-amazon-athena/ Analyze Fraud Transactions using Amazon Fraud Detector and Amazon AthenaOrganizations with online businesses have to be on guard constantly for fraudulent activity such as fake accounts or payments made with stolen credit cards One way they try to identify fraudsters is by using fraud detection applications Some of these applications use machine learning ML A common challenge with ML is the need for a … 2021-07-26 14:33:01
AWS AWS Compute Blog Creating a single-table design with Amazon DynamoDB https://aws.amazon.com/blogs/compute/creating-a-single-table-design-with-amazon-dynamodb/ Creating a single table design with Amazon DynamoDBThis post looks at implementing common relational database patterns using DynamoDB Instead of using multiple tables the single table design pattern can use adjacency lists to provide many to many relational functionality 2021-07-26 14:55:14
python Pythonタグが付けられた新着投稿 - Qiita Djangoの旅 ~Part8~ モデルの更新編 https://qiita.com/Yuki-max/items/dc7ce43fee090e891797 Djangoの旅Partモデルの更新編目的新しいカラムを追加した時のモデルの更新流れ・モデルに新しいカラム追加・マイグレーションファイル作成・マイグレートコード解説APPtestappmodelspyfromdjangodbimportmodelsfromdjangodbmodelsfieldsimportCharFieldclassLikeFoodmodelsModelcontentCharFieldmaxlengthcolorCharFieldmaxlengthnullTrue追加defselfselfreturnselfcontent・モデルに新しいカラム追加今回はcolorカラムを追加ここでは元から更新以前のデータで生じる欠損値の扱い方が重要になってくるnullTrueを記述することにより空白のデータを欠損値nullとして認識してくれる。 2021-07-26 23:40:55
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) circleciの自動テストビルド時に失敗する(自動デプロイの手順も不足している気がする) https://teratail.com/questions/351360?rss=all CirclenbspCIで自動テストと自動デプロイ環境を作ろうと思ったのですが、自動テストのところでうまくいきません。 2021-07-26 23:59:07
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) コマンドの実行結果をファイルに出力したいのですが、「許可がありません。」と表示されて実行できない https://teratail.com/questions/351359?rss=all ファイルへの出力を実施すると「許可がありません」と表示されます。 2021-07-26 23:54:05
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) wordpressでswiperが実装できない https://teratail.com/questions/351358?rss=all wordpressでswiperが実装できない前提・実現したいことwordpressでswiperを実装しようとしております。 2021-07-26 23:51:54
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) AWS ELB アクセスエラー「このサイトにアクセス出来ません」 https://teratail.com/questions/351357?rss=all AWSELBアクセスエラー「このサイトにアクセス出来ません」上の図を元に、インターネット向けのロードバランサーALBを作成した後、説明にあるDNS名Aレコードをコピペしてアクセスすれば、「nbspBadnbspGateway」のエラーが出るようになるはずなのですが、下の画像のようなエラーが出てしまいます。 2021-07-26 23:45:06
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) CSSで要素に色を付けたときに各要素の幅が揃っていない https://teratail.com/questions/351356?rss=all CSSで要素に色を付けたときに各要素の幅が揃っていないはじめまして。 2021-07-26 23:38:43
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) シーン切り替えの際にゲームオブジェクトの座標について https://teratail.com/questions/351355?rss=all シーン切り替えの際にゲームオブジェクトの座標についてunitychanを移動させて、黄色の壁をクリックすると、Quizシーンに切り替わって、クイズをしていきます。 2021-07-26 23:32:33
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Pythonで機械学習を行っているのですが、エラーがでてしまい困っています https://teratail.com/questions/351354?rss=all Pythonで機械学習を行っているのですが、エラーがでてしまい困っています前提・実現したいこと機械学習で為替の予測をしているのですが、特徴量であるADXRを用いて学習をさせようとしたら、エラーメッセージがでてしまい先に進めることができません。 2021-07-26 23:08:56
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) sourcetreeのリモートリポジトリにプッシュ出来ない https://teratail.com/questions/351353?rss=all sourcetreeのリモートリポジトリにプッシュ出来ない必要事項入力後このようなエラーコードが出てきます。 2021-07-26 23:08:42
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) CSS overlayが他要素まで伸びることを解消 https://teratail.com/questions/351352?rss=all CSSoverlayが他要素まで伸びることを解消困っていることoverlayが他の要素に被ってしまいます。 2021-07-26 23:03:40
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Windowsサーバ(IIS)でDjangoアプリを公開しようとした際にHTTP エラー 403.14 - Forbiddenとなります。 https://teratail.com/questions/351351?rss=all WindowsサーバIISでDjangoアプリを公開しようとした際にHTTPエラーForbiddenとなります。 2021-07-26 23:03:18
Linux Ubuntuタグが付けられた新着投稿 - Qiita Ubuntu20.04 で ClamAV を使ってウイルススキャン https://qiita.com/kannkyo/items/1cc32231afad88c11d8e clamavデーモンは、clamdscanコマンドからの指示を受信してマルチスレッドでウイルススキャンをするサービス。 2021-07-26 23:09:54
AWS AWSタグが付けられた新着投稿 - Qiita AWS Cloud9 でAmazon Linux 2でLaravelの設定 https://qiita.com/mako0104/items/c1163514d3ca5ef686df 手動でEPELを有効にするこの通りにやれば大丈夫っぽい。 2021-07-26 23:18:41
Docker dockerタグが付けられた新着投稿 - Qiita Docker上で動かしたASP.NET Coreアプリで"no such table: テーブル名"となる場合の対処法 https://qiita.com/Ooooooomin_365/items/4d24de0f8d71db77c0ed 対処法以下のstackoverflowにも記載されていますが、DbContextのコンストラクタへ「DatabaseEnsureCreated」を追記するとテーブルが作成されるとのことでした。 2021-07-26 23:49:25
Git Gitタグが付けられた新着投稿 - Qiita TortoiseGit備忘録 https://qiita.com/kazuki_kuriyama/items/b62511a4dbd2be43d375 TortoiseGit備忘録TortoiseGitについてハマったことなどのメモアイコンオーバーレイが表示されない通常TortoriseGitをインストールすると以下のようなアイコンが表示される様になるが、表示されないことがあった。 2021-07-26 23:57:57
技術ブログ Developers.IO GitHubからAWS CodeCommitにリポジトリを複製してみた https://dev.classmethod.jp/articles/duplicating-a-git-repository-from-github-to-aws-codecommit/ github 2021-07-26 14:52:58
技術ブログ Developers.IO Contentfulのアプリを自作してみよう! 単語数カウンターを導入してみる。 https://dev.classmethod.jp/articles/contentful-apps-tutorial/ contentful 2021-07-26 14:47:19
海外TECH Ars Technica Come talk with us about machine-learning experiments gone right—and wrong https://arstechnica.com/?p=1783029 eastern 2021-07-26 14:48:20
海外TECH DEV Community Deploying podman images using running container in centos -8 https://dev.to/ingoleanirudha/deploying-podman-images-using-running-container-in-centos-8-1i60 Deploying podman images using running container in centos What is podman What is Podman Podman is a daemonless container engine for developing managing and running OCI Containers on your Linux System Containers can either be run as root or in rootless mode People associate running pods with Kubernetes And when they run containers in their development runtimes they do not even think about the role pods could playーeven in a localized runtime Most people coming from the Docker world of running single containers do not envision the concept of running pods There are several good reasons to consider using pods locally other than using pods to naturally group your containers Podman installation process in centos sudo dnf y module disable container toolssudo dnf y install dnf command copr sudo dnf y copr enable rhcontainerbot container selinuxsudo curl L o etc yum repos d devel kubic libcontainers testing repo kubic libcontainers testing CentOS devel kubic libcontainers testing repo OPTIONAL FOR RUNC USERS crun will be installed by default Install runc first if you prefer runcsudo dnf y refresh install runc Install Podmansudo dnf y refresh install podman 2021-07-26 14:55:20
海外TECH DEV Community How To Make WebSites Load Faster https://dev.to/lucidmach/how-to-make-websites-load-faster-524i How To Make WebSites Load FasterIn today s ultra fast paced world Seconds of a not yet loaded website is more than enough for the user to click that close buttonThis is especially important if you re trying to build a web based startup Having an optimized website could lead to significantly more revenue Components of a WebSiteAnything on the Web has main componentsFrontEndBackEndNetworkNo Matter How Optimized the backend is a common huge mistake kinda End of the day it is the network that impacts of a website s performanceSo by Pareto s Rule We focus on the NETWORK The network is what connects the frontend to the backend Most sites make s of requests in the background as the site loads If each response carries a lot of dataThe time for the data to reach the client increasesThe time for each resource to render increasesbasically the website take forever to load SolutionReduce the size of files bySending only what the user and not the website needs aka code splittingRemoving whitespaces or uglifying the fileIf you use webpack this is automatically done for youBONUS You could PWA and cache data on the client But That Topic Is For Another Blog Reducing the size of images by optimizing them Reducing the size of images by optimizing them What does this mean We don t reduce the size by reducing resolution We reduce the size by reducing the scale of colors Let me explain The human eye can t distinguish between and So when we optimize images we re reducing the bits used to store color data of pixels How do we do that There are libraries that take care of this for us However we can t create a program to do this every time for every image so I created a CLI Tool My First CLI Application called Shirmkage which stands for shrink image You can check out play around with the source code on my github npm install g shrimkage Shrimkage makes optimizing images in bulk easyYou can use it directly in the terminal that s what a CLI is tho shrimkage folderThe default level of reduction is so if you want more optimization you can shrimkage folder level Shimkage also give you the option to apply optimizations to individual imagesshrimkage file path test pngAnd That is The Effort to gain an increase in web performanceIf You ️This Follow Me on Twitter Where you can see updates on all my work including blogs Also Don t forget to DM MeLet s have small dev talk 2021-07-26 14:49:27
海外TECH DEV Community The Death of Browser Games https://dev.to/codesphere/the-death-of-browser-games-25af The Death of Browser GamesThose of us that grew up in the late s to mid s likely spent a good chunk of our time playing browser games While most prior gaming required a console and disc the internet opened up the opportunity to try out thousands of online games often for free with minimal setup time On the dev side tools like Adobe Flash allowed developers with minimal resources to create and publish their own games for users By the end of the s however this viral sensation had largely died down and today with the exception of online gambling the browser game market is nearly completely gone So what exactly caused this The apparent death of browser games is an interesting story of weak technologies Silicon Valley feuds and shifting consumer trends The Problems with FlashWhile many of us probably think back at Adobe Flash with a lot of nostalgia we might not remember that the technology had a good amount of issues For starters having to manage different versions of Adobe Flash created a difficult hurdle for new internet users In addition the need to update your Adobe Flash Player created an opportunity for malicious developers to trick users into downloading malware In addition throughout its lifespan Flash was riddled with security vulnerabilities especially on Android devices In Symantec s Internet Security Threat Report stated that remote code execution in Flash Player was the second most attacked vulnerability by hackers The Poison AppleIn April of Steve Jobs while CEO of Apple published an open letter criticizing Adobe Flash and explaining why it would not be allowed on Apple s increasingly popular iOS products While it s speculated that the decision to open the letter may have had some anti competitive and or egotistic reasons behind it Jobs listed the following six reasons behind his decision It s a proprietary product and Apple prefers open web standardsWebsites are switching to better video formatsFlash has bad security reliability and performanceFlash unnecessarily drains batteryFlash was not designed for a mobile formatIt s an unnecessary layer that holds back innovationThis letter and the corresponding ban on Flash essentially stopped any chance of Flash cornering the new mobile market which we ll talk about next New MediumsPerhaps the greatest nail in browser gaming s coffin was the rise of the mobile gaming market kicked off by the release of the iPhone in More specifically mobile gaming offered the same sort of simplicity as browser games with increased safety Not to mention that you could play anywhere on the go By the early s mobile gaming completely dominated the casual gaming market and arguably has ever since The Death of FlashThough we re told things on the internet last forever on December th Adobe officially stopped support for Adobe Flash As a result most remnants of the browser game era are no longer accessible While shifting markets removed the need for Flash on the consumer side the improvement of HTML deprecated the need for Flash on the development side Animations and games could now be made with some pretty boilerplate HTML CSS and Javascript not to mention the plethora of game development libraries that now exist without any need for third party software like Flash What Does the Future Hold Nostalgia aside the story of browser games can give us an important insight into building successful software The technology landscape is always evolving so don t bet on what tech looks like now bet on what you think tech is going to look like So what do you think Are browser games going to make a comeback What do you think the future of casual gaming looks like Thanks for reading If you re trying to build your own game on the web and want a simple and powerful way to deploy it checkout Codesphere the next generation cloud provider 2021-07-26 14:47:37
海外TECH DEV Community Amazing CSS Tips & Tricks https://dev.to/tarandeep_singh/amazing-css-tips-tricks-1jl0 Amazing CSS Tips amp TricksWanna know how to use modern CSS features to write clean code by using some stunning CSS tricks You have just landed at the right place A Tip For BeginnersHere s a quick tip for those who have just started to learn CSS DON T use Bootstrap or Tailwind No doubt they are great tools to get a nice looking UI quickly but using these will mean that you ll be missing on CSS fundamentals I have personally done this mistake amp oh boy did I regret it Grid is GreatUnlike flexbox which only deals with individual columns amp rows Grid allows you to think about the big picture When you set an element to display grid you can then define its children as a bunch of columns amp rows Have a look at the amount of code we have eliminated by using grid instead of flexbox in the image below Click here to read more about CSS Grid Layout CSS DebuggingWe often use Chrome developer tools for debugging our code including CSS but you ll be surprised to know that Firefox developer tools are much superior especially when it comes to CSS On inspecting an element in Firefox you ll have a break down of the box model like you have in Chrome but you can also edit properties on it directly for instance changing the padding or margin and it will also give you a breakdown of all the properties that are influencing the box model Not only this Firefox also provides really nice graphics for flex amp grid layouts Image FiltersIt s fun to play around with images in CSS but did you know that we can apply amazing effects to those images In fact CSS allows using lots of filters on the images to help developers play with the graphics without changing it in Photoshop Let s have a look at some of the filters image img max width px blur filter blur px grayscale filter grayscale brightness filter brightness saturate filter saturate invert filter invert huerotate filter hue rotate deg I have much more to write and share with you guys but it s getting a little long so comment below if you want part of Amazing CSS Tips amp Tricks You can follow me on Twitter and LinkedIn 2021-07-26 14:32:14
海外TECH DEV Community Let's talk about python https://dev.to/alichraghi/let-s-talk-about-python-2im3 Let x s talk about pythonIf I did not make some people angry in the previous post I am sure they now report me to be banned python now is very popular As far as I can say the most popular in history because JS is coercion to web developers but python is widely used idk python i just tried it and i can t understand why programmers love it Keep Your Python Versionyou should keep python with your project with venv because your project may not be compatible with later versions of Python at least rust keeps the functions and syntax and just make it a warning but your python project is risky i had lot of problems with python based tools and packages for that Memory Leakspython memory leaks are amazing just in a fibonacci app omg thre s no variable python have more than Kb memory leak just imagine python for a web framework like Django just checkout lua it s safe Error Detectionerror handling is a important part of development but python as the most popular language can t detect errors during the interpretion Huge Source Codeyes i think this is a problem python source code have M lines of code and cause of the most problems huge source code makes more mistakes and bugs just checkout lua it s very same to python a interpreter language without but without any thirdparty library lua is safe minimal have t memory leak in a fibonacci app and just have K lines pls don t comment delete this post or this is most shi t post i ever seen they are my reasons so pls just say your reasons 2021-07-26 14:16:50
海外TECH DEV Community Mutation is life / Boring Technology https://dev.to/rekki/mutation-is-life-boring-technology-11h0 Mutation is life Boring TechnologyTLDR We had horrible outage where rabbitmq node ran out of memory because Iforgot to unbind a queue one of s or so and we lost a whole bunchof in producer memory state this made our whole infrastructurecompletely probabilistic and it took us hours of blood sweat andtears to recover the lost data We should ve just used postgres as aqueue In almost any system being built today we have users that performactions to mutate state This is life to create side effects yes mutation is life I will illustrate it like this user U lt action A v receiver R world change v state S receiver this is usually a backend endpointuser in our case is a chefstate in our case creating an orderYou can move those pieces in any way for example the action can be afunction of the state mutation instead of the other way around orthe receiver of the action can be the user itself and the userdirectly mutates the state etc This however is what technicalimplementation means looks the same to the outside but has verydifferent emergent properties This is what this post is about emergent behavior and chaos Lets a possible technical implementation of user creating an order user sends action to an endpoint create orderbackend code pushes to order new a consumer of order new order is picked up transformed a bit and written to a databaseanother message is sent to order created queuea consumer of order created create audit log of who when whatb consumer order created send email to the interested partiesc consumer order created builds an email and sends it to email created logs the email for archiving purposesd consumer order created create chat message with the orderpush to message created e consumer order created extract features for DScopy to salesforce etca consumer of message created send push notificationa consumer of email created sends the email and then pushes to a queueemail senta consumer of email sent marks the email as sentThis is pretty much what we have now maybe a bit more complicated butnot much you can trivially add more reactive components listening tospecific topics and you can fanout and etc just with rabbitmq It is super flexible and extendible re triable etc Of course it was not designed like that but it grew over the years adding bits and pieces here and there it is very easy tounconsciously complicate it Everything was really good until I did some refactor and stoppedconsuming one of the topics that was a clone of order created and Iforgot to unbind the queue so it kept getting messages but nobody wasdraining it and a the RMQ node ran out of memory Only out of because we still use elixir for that process we were relaying onelixir s in memory stability to keep a buffer of messages to resend ifneed which of course I killed when I restarted the cluster because Iwasn t sure what the fuck is going on That meant that of all requests went to the abyss the true abyss We had to stay to am to glue bits and pieces and to connect the state Caused the worse outage I have ever been firefighting and once I wasinvolved in solving an outage that we were selling hotels for thof the price losing millions of euros Now lets discuss another implementation of the same thing user creating an order user sends action to an endpoint create orderbackend code begin insert the order insert the message push notification sent at null insert the email sent at null delivered at null insert log commita secondly cronjob select for update messages where push notification sent at is null send the push notification update the messageb secondly cronjob select for update email where sent at is null send the email update the email tableUse the database as a queue works totally fine we can scalepostgress vertically forever Why forever you ask Because there are restaurants in London and we can geo shard it and there isphysical upper bound on amount of data in a region Fucking queues it is so easy to overuse them without knowing itcreeps up on you and in the end you have infrastructure spaghetti Anyway We are migrating from queues to transactions and fuck it I cant keepit in my head ultimately it all ends up in postgres anyway just withextra steps Fuck The morale of the story is If shit ends up in postgres anyway and you can afford to directlywrite to it which is not always the case just write to it Do boring technologoy the way we wrote php shit years ago getthe state and write it in the database even though mysql didn t havetransactions it was helpfully accepting to BEGIN COMMIT though haha it was ok PS There were missed deliveries but CS handled them like aking Sending uber to pick up the things form the supplier and sendingit to the chef and etc It is much easier to firefight when you knowCustomerSuccess has your back PPS I think outages are the best everyone groups up and we solve theproblem some panic some adrenalin some pressure but in the end thewhole company becomes more of a team 2021-07-26 14:12:11
海外TECH DEV Community First steps with Rust declarative macros! https://dev.to/rogertorres/first-steps-with-rust-declarative-macros-1f8m First steps with Rust declarative macros Macros are one of the ways to extend Rust syntax As The Book calls it “a way of writing code that writes other code Here I will talk about declarative macros or as it is also called macros by example Examples of declarative macros are vec println and format The macros I will not talk about are the procedural macros but you can read about them here As usual I am writing for beginners If you want to jump to the next level check The Book s section on macros The chapter about macros in Rust by ExampleThe Little Book of Rust Macros which is the most complete material I found about the topic the second chapter is specially amusing Why do I need macros The actual coding start in the next section Declarative macros from now on just “macros are not functions but it would be silly to deny the resemblance Like functions we use them to perform actions that would otherwise require too many lines of code or quirky commands I am thinking about vec and println respectively These are two of the reasons to use macros but what about the reasons to create them Well maybe you are developing a crate and want to offer this feature to the users like warp did with path Or maybe you want to use a macro as a boilerplate so you don t have to create several similar functions as I did here It might be also the case that you need something that cannot be delivered by usual Rust syntax like a function with initial values or structurally different parameters such as vec that allows calls like vec or vec ーmore on this later That being said I believe that the best approach is to learn how to use them try them a few times and when the time comes when they might be useful you will remember this alternative Declaring macrosThis is how you declare a macro macro rules etwas gt You could call this macro with the commands etwas etwas or etwas There s no way to force one of those When we call a macro always using one or the otherーlike parenthesis in println text or square brackets in vec ーit is just a convention of usage a convention that we should keep But what is happening in this macro Nothing Let s add something to make it easier to visualize its structure macro rules double value expr gt value fn main println double The left side of gt is the matcher the rules that define what the macro can receive as input The right side is the transcriber the output processing Not very important but both matcher and transcriber could be writen using either or The matchingThis will become clear later but let me tell you right the way the matching resembles regex You may ask for specific arguments fixed values define acceptable repetition etc If you are familiar with it you should have no problems picking this up Let s go through the most important things you should know about the matching Variable argumentVariable arguments begin with e g value expr Their structure is name designator Both and are fixed The name follows Rust variables convention When used in the transcriber see below they will be called metavariables Designators are not variable types You may think of them as “syntax categories Here I will stick with expressions expr since Rust is “primarily an expression language A list of possible designators can be found here Note There seems to be no consensus on the name designator The little book calls it capture The Rust reference calls it fragment specifier and you will also find people referring them as types Just be aware of that when jumping from source to source Here I will stick with designator as proposed in Rust by example Fixed argumentsNo mystery here Just add them without For example macro rules exp value expr squared gt value pow fn main println power i squared I know there are things here that I have not explained yet I will talk about them now SeparatorSome designators require some specific follow up Expressions require one of these gt or That is why I had to add a comma between value expr and the fixed value squared You will find a complete list of follow ups here Multiple matchingWhat if we want our macro to not only calculate a number squared but also a number cubed We do this macro rules exp value expr squared gt value pow i value expr cubed gt value pow i Multiple matching can be used to capture different levels of specificity Usually you will want to write the matching rules from the most specific to the least specific so your call doesn t fall in the wrong matching A more technical explanation can be found here RepetitionMost macros that we use allow for a flexible number of inputs For example we may call vec or vec This is where the matching resembles Regex the most Basically we wrap the variable inside and follow up with a repetition operator ーindicates any number of repetitions ーindicates any number but at least one ーindicates an optional with zero or one occurrence Let s say we want to add n numbers We need at least two addends so we will have a single first value and one or more second value This is what such a matching would look like macro rules adder left expr right expr gt fn main adder We will work on the transcriber latter Repetition separatorAs you can see in the example above I added a comma before the repetition operator That s how we add a separator for each repetition without a trailing separator But what if we want a trailing separator Or maybe we want it to be flexible allowing the user to have a trailing separator or not You may have any of the three possibilities like this macro rules no trailing e expr gt macro rules with trailing e expr gt macro rules either e expr gt fn main no trailing with trailing either either VersatilityUnlike functions you may pass rather different arguments to macros Let s consider the vec macro example For that I will omit the transcriber macro rules vec gt elem expr n expr gt x expr gt It deals with three kinds of calls vec which creates an empty Vector vec text which repeats the first value text n times where n is the second value vec which creates a vector with all the listed elements If you want to see the implementation of the vec macro check Jon s stream about macros The transcriberThe magic happens after the gt Most of what you are going to do here is regular Rust but I would like to bring your attention to some specificities TypeWhen I called the exponentiation macro power I did this power i squared I had to specify the type i because I used the pow function which cannot be called on ambiguous numeric type and as we do not define types in macros I had to let the compiler know this information somehow This is something to be aware when dealing with macros Of course I could have forced it by declaring a variable and passing the metavariable value to it and thus fixing the variable type However to do such a thing we need multiple statements Multiple statementsTo have more than one line in your transcriber you have to use double curly brackets macro rules etwas v this one value expr squared gt let x u value x pow and this one Easy Using repetitionLet us finish our adder macro macro rules adder right expr gt let mut total i total right total fn main assert eq adder To handle repetition all we have to do is to place the statement we want to repeat within the repetition operator should match that is why I am using here as well But what if we have multiple repetitions Consider the following code macro rules operations add addend expr mult multiplier expr gt let mut sum sum addend let mut product product multiplier println Sum Product sum product fn main operations add mult How does Rust know that it must repeat four times during the first repetition block and only three times in the second one By context It checks the variable that is being use and figure out what to do Clever huh Sure you can make things harder to Rust In fact you may turn them indecipherable like this macro rules operations add addend expr mult multiplier expr gt let mut sum let mut product sum addend product multiplier println Sum Product sum product What does “clever Rust do with something like this Well one of the things it does best it gives you a clear compile error error meta variable addend repeats times but multiplier repeats times gt src main rs sum addend product multiplier Neat ExpandAs mentioned earlier macros are syntax extensions which means that Rust will turn them into regular Rust code Sometimes to understand what is going wrong on it is very helpful to see how rust pull that transformation off To do so use the following command cargo rustc profile check Zunstable options pretty expandedThis command however is not only verbose but it will also call for the nightly compiler To avoid this and get the same result you may install cargo expand cargo install cargo expandOnce it is installed you just have to run the command cargo expand Note Although you don t have to be using the nightly compiler I guess and you may call me on this you got to have it installed To do so run the command rustup instal nightly Look at how the macro operations is expanded fn main let mut sum sum sum sum sum let mut product product product product std io print core fmt Arguments new v amp Sum Product n amp match amp sum amp product arg arg gt core fmt ArgumentV new arg core fmt Display fmt core fmt ArgumentV new arg core fmt Display fmt As you can see even println was expanded And that s all for today There is certainly more to cover but I will leave you with the readings I recommended earlier Cover image by Thom Milkovic 2021-07-26 14:09:13
Apple AppleInsider - Frontpage News Find My, Photos, iCloud services experiencing issues https://appleinsider.com/articles/21/07/26/find-my-photos-icloud-services-experiencing-issues?utm_medium=rss Find My Photos iCloud services experiencing issuesApple s System Status dashboard indicates users may be experiencing issues with Find My iCloud syncing services Mail and other tools Find My is experiencing a service issueProblems with various Apple services began at approximately am Apple indicates only some users are affected by the intermittent issues Read more 2021-07-26 14:50:14
Apple AppleInsider - Frontpage News iPhone strength in the US will offset China weakness in Q3 and Q4, analyst says https://appleinsider.com/articles/21/07/26/iphone-strength-in-the-us-will-offset-china-weakness-in-q3-and-q4-analyst-says?utm_medium=rss iPhone strength in the US will offset China weakness in Q and Q analyst saysInvestment bank Goldman Sachs expects Apple to report a strong June quarter and guide well for Q driven largely by solid Q U S iPhone shipments and September quarter build estimates Credit Andrew O Hara AppleInsiderIn a note to investors seen by AppleInsider Goldman Sachs lead analyst Rod Hall believes that the re opening environment in the U S could have driven a short lived pulse in iPhone demand similar to a shipment surge in China earlier in Read more 2021-07-26 14:21:11
Apple AppleInsider - Frontpage News Best deals for July 26 - $30 off Apple Pencil, $100 off Netgear Orbi https://appleinsider.com/articles/21/07/26/best-deals-for-july-26---30-off-apple-pencil-100-off-netgear-orbi?utm_medium=rss Best deals for July off Apple Pencil off Netgear OrbiMonday s best deals include off the popular Bitdo wireless controller off a DJI drone and a new week of iTunes movie sales Deals Monday July Shopping online for the best discounts and deals can be a difficult and annoying task Rather than sifting through miles of advertisements check out this list of sales we ve hand picked just for the AppleInsider audience Read more 2021-07-26 14:59:26
Apple AppleInsider - Frontpage News Amazon could take bitcoin payments in 2021 as it prepares own cryptocurrency https://appleinsider.com/articles/21/07/26/amazon-could-take-bitcoin-payments-in-2021-as-it-prepares-own-cryptocurrency?utm_medium=rss Amazon could take bitcoin payments in as it prepares own cryptocurrencyAmazon may soon start taking bitcoin as payment for goods and services according to a report with the retailer also potentially looking into creating its own cryptocurrency Cryptocurrencies like bitcoin and others continue to be popular if volatile as a form of investment with more companies accepting bitcoin for payments as time marches on If a report is to be believed bitcoin payments may get a considerable boost from Amazon Citing an anonymous source of City A M Amazon has posted a job advertisement for a Senior Blockchain Specialist in the United Kingdom The role is based in Amazon Web Services for its Amazon Managed Blockchain Service rather than for its retail arm Read more 2021-07-26 14:02:12
海外科学 NYT > Science Steven Weinberg, Groundbreaking Nobelist in Physics, Dies at 88 https://www.nytimes.com/2021/07/25/science/steven-weinberg-groundbreaking-nobelist-in-physics-dies-at-88.html Steven Weinberg Groundbreaking Nobelist in Physics Dies at His discoveries deepened understanding of the basic forces at play in the universe and he took general readers back to its dawn in his book “The First Three Minutes 2021-07-26 14:52:45
海外科学 NYT > Science Why Some Americans Are Still Hesitant to Get Vaccinated https://www.nytimes.com/2021/07/24/us/covid-vaccine-hesitant.html Why Some Americans Are Still Hesitant to Get VaccinatedThe U S vaccine rollout has plateaued and the course of the coronavirus pandemic in this country may depend on how many people are ultimately swayed to get vaccinated 2021-07-26 14:16:30
金融 RSS FILE - 日本証券業協会 株券等貸借取引状況(週間) https://www.jsda.or.jp/shiryoshitsu/toukei/kabu-taiw/index.html 貸借 2021-07-26 15:30:00
金融 RSS FILE - 日本証券業協会 J-IRISS https://www.jsda.or.jp/anshin/j-iriss/index.html iriss 2021-07-26 15:17:00
ニュース BBC News - Home Man tried to save wife and son from drowning in Loch Lomond https://www.bbc.co.uk/news/uk-scotland-glasgow-west-57972950 lomond 2021-07-26 14:51:08
ニュース BBC News - Home Whipps Cross Hospital patients evacuated after flooding https://www.bbc.co.uk/news/uk-england-london-57971381 london 2021-07-26 14:52:24
ニュース BBC News - Home Joey Barton denies assaulting his wife Georgia https://www.bbc.co.uk/news/uk-england-bristol-57969765 london 2021-07-26 14:25:58
ニュース BBC News - Home Tokyo Olympics: Day-by-day guide to the key events, big stars and British medal hopes https://www.bbc.co.uk/sport/olympics/57778808 japan 2021-07-26 14:01:28
北海道 北海道新聞 水谷・伊藤組が混合ダブルスV 卓球日本初の金メダル https://www.hokkaido-np.co.jp/article/571296/ 東京五輪 2021-07-26 23:19:50
北海道 北海道新聞 男子日本、黒星スタート バスケットボール・26日 https://www.hokkaido-np.co.jp/article/571309/ 世界ランキング 2021-07-26 23:08:00
北海道 北海道新聞 イラクで戦闘任務終了へ 年内に米軍、IS掃討 https://www.hokkaido-np.co.jp/article/571308/ 駐留米軍 2021-07-26 23:07:00
北海道 北海道新聞 チュニジア議会停止で緊張 民主化逆行と議長ら猛反発 https://www.hokkaido-np.co.jp/article/571306/ 新型コロナウイルス 2021-07-26 23:06:00
北海道 北海道新聞 水谷・伊藤組が日本初の金メダル 卓球・26日 https://www.hokkaido-np.co.jp/article/571304/ 木下グループ 2021-07-26 23:06:13
北海道 北海道新聞 弁護士、偽ヴィトン保管疑い 愛知県警が逮捕 https://www.hokkaido-np.co.jp/article/571303/ 愛知県警 2021-07-26 23:04:00
北海道 北海道新聞 アフガンで民間人2千人超が死傷 米軍撤退開始後に https://www.hokkaido-np.co.jp/article/571300/ unama 2021-07-26 23:02:00
仮想通貨 BITPRESS(ビットプレス) 日本ブロックチェーン協会(JBA)、7/29に「西野亮廣&国光宏尚 NFT対談会!エンタメ業界におけるNFTの可能性やトレンドについて語る 」開催 https://bitpress.jp/count2/3_15_12665 西野亮廣 2021-07-26 23:20:16
仮想通貨 BITPRESS(ビットプレス) ブロックチェーンハブ、8/23に「Blockchain:Rethink / いまこそ、その根本を再考する」開催 https://bitpress.jp/count2/3_15_12664 blockchainrethink 2021-07-26 23:17:05

コメント

このブログの人気の投稿

投稿時間: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件)