Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
discordのbot製作の計算式 |
https://teratail.com/questions/332912?rss=all
|
|
2021-04-13 04:27:56 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS認定ソリューションアーキテクト・アソシエイト(SAA)を一度落ちてからなんとか合格した話 |
https://qiita.com/HiroyaEnd/items/e4d5aa0b432990149ac2
|
各最後の一回は再受験直前に行いました模擬試験①⇨⇨⇨模擬試験②⇨⇨⇨【SAAC版】AWS認定ソリューションアーキテクトアソシエイト模擬試験問題集回分問受験の週間前頃からガンガン問題演習して仕上げをするために活用しました。 |
2021-04-13 04:00:51 |
海外TECH |
Ars Technica |
Charter must pay $19 million for tricking customers into switching ISPs |
https://arstechnica.com/?p=1756311
|
windstream |
2021-04-12 19:25:11 |
海外TECH |
Ars Technica |
Archaeologists find “lost golden city” buried under sand for 3,400 years |
https://arstechnica.com/?p=1756218
|
tutankhamun |
2021-04-12 19:06:51 |
海外TECH |
DEV Community |
Ember 3.26 Released |
https://dev.to/emberjs/ember-3-26-released-2mef
|
Ember ReleasedToday the Ember project is releasing version of Ember js Ember Data and Ember CLI This release kicks off the beta cycle for all sub projects We encourage our community especially addon authors to help test these beta builds and report any bugs before they are published as a final release in six weeks time The ember try addon is a great way to continuously test your projects against the latest Ember releases You can read more about our general release process here Release DashboardThe Ember Release CycleThe Ember ProjectEmber LTS Releases Ember jsEmber js is the core framework for building ambitious web applications Changes in Ember js Ember js is an incremental backwards compatible release of Ember with bug fixes performance improvements and minor deprecations Bug FixesEmber js introduced bug fixes Here are a few notable ones The Ember router and the router service have been updated so that an infinite recursion does not occur when the router service is injected into app router js You can pass to an observer a dependent key whose name includes a colon The Glimmer VM has been updated to prevent eagerly consuming arguments during modifier destruction FeaturesEmber js introduced features DeprecationsEmber js introduced several deprecations in preparation for v release To learn more how to update your code please check the provided link to the Deprecations Guide Transition methods of controllers and routes have been deprecated Inject the router service and use the service s methods instead Deprecations Guide Invoking the lt LinkTo gt component with positional arguments has been deprecated Please provide named arguments such as route model models and query Deprecations Guide The with helper has been deprecated in favor of using let Deprecations Guide Implicit injection has been deprecated In particular the store service from Ember Data must be explicitly injected into controllers and routes if they refer to this store Deprecations Guide Browser support of Internet Explorer has been deprecated Deprecations Guide Property fallback for implicit this has been deprecated Please review the templates in your app and write this when it is appropriate e g change localProperty to this localProperty Deprecations Guide Ember Classic has been deprecated Deprecations Guide In preparation for v release developers are encouraged to update their app to Ember Octane by following these steps In config optional features json update the feature flags for Octane application template wrapper false jquery integration false template only glimmer components true Specify the Octane edition in package json ember edition octane Check the official upgrade guide and seek help in the help channel on Ember Discord list continued from above Component managers that use the v capabilities should update to the most recent component capabilities available which is currently v Deprecations Guide Modifier managers that use the v capabilities should update to the most recent modifier capabilities available which is currently v Deprecations Guide The hasBlock and hasBlockParams properties have been deprecated Use has block and has block params helpers instead Deprecations Guide Passing classBinding and classNameBindings as arguments has been deprecated Deprecations Guide Accessing named arguments via attrs has been deprecated Deprecations Guide Array observers have been deprecated Deprecations Guide Deprecations are added to Ember js when an API will be removed at a later date Each deprecation has an entry in the deprecation guide describing the migration path to a more stable API Deprecated public APIs are not removed until a major release of the framework Consider using the ember cli deprecation workflow addon if you would like to upgrade your application without immediately addressing deprecations For more details on changes in Ember js please review the Ember js release page Ember DataEmber Data is the official data persistence library for Ember js applications Changes in Ember Data Bug FixesEmber Data introduced bug fixes FeaturesEmber Data introduced features DeprecationsEmber Data introduced deprecations For more details on changes in Ember Data please review theEmber Data release page Ember CLIEmber CLI is the command line interface for managing and packaging Ember js applications Upgrading Ember CLIYou may upgrade Ember CLI using the ember cli update project npx ember cli updateThis utility will help you to update your app or addon to the latest Ember CLI version You will probably encounter merge conflicts in which the default behavior is to let you resolve conflicts on your own For more information on the ember cli update project see the GitHub README While it is recommended to keep Ember CLI versions in sync with Ember and Ember Data this is not required After updating ember cli you can keep your current version s of Ember or Ember Data by editing package json to revert the changes to the lines containing ember source and ember data Changes in Ember CLI Bug FixesEmber CLI introduced bug fixes Issue a better error message for add on s missing an entry point andAdd Prettier files to npmignore file in addon blueprint FeaturesEmber CLI introduced feature ember try test scenarios for embroider safe and embroider optimized for addons are now enabled using embroider test setup allowing Embroider compatibility testing for addons test matrix DeprecationsEmber CLI introduced deprecations For more details on the changes in Ember CLI and detailed upgradeinstructions please review the Ember CLI release page Thank You As a community driven open source project with an ambitious scope each of these releases serves as a reminder that the Ember project would not have been possible without your continued support We are extremely grateful to our contributors for their efforts |
2021-04-12 19:34:53 |
海外TECH |
DEV Community |
Axios PUT Verb |
https://dev.to/denvercoder/axios-put-verb-4d0f
|
Axios PUT Verb Axios PUT Verb And Why I SuckSo this is one of those posts where I had such a hard time I just wanted to document it so I would have a note for myself in the future Here s the issue I was having We have a project that uses React for the frontend and Azure Functions for the API One of our Azure functions for submitting an order required GET PUT POST DELETE I got the function setup and all of the backend code was working using Postman to submit requests to the API When I started working on the front end everything was working except for the PUT verb The DELETE verb code looked like this const handleOrderDelete async orderId gt const token await getTokenSilently var response axios delete http localhost orderId headers Authorization Bearer token content type application json x functions key AZURE FUNCTION KEY HERE if response statusCode console log response else console error response The PUT verb code looked like this const handleOrderEdit async orderId gt const token await getTokenSilently var response axios put http localhost orderId headers Authorization Bearer token content type application json x functions key AZURE FUNCTION KEY HERE if response statusCode console log response else console error response Now at this point it s important to note that I copied the handleOrderEdit code from the handleOrderDelete code They are VERY similar the only main difference being the put and delete verbs themselves Now if you re astute and you are familiar with Axios you may already see the issue If not see if you can figure it out So the DELETE was working but when I ran the PUT I was getting a on the Network tab in chrome devtools In my C console I was getting the error NO TOKEN ERROR When I looked at the request payload I saw that I had a token Bearer dfsafdsafdsafsafsaf or whatever Most importantly my breakpoint I set in Visual Studio right on the opening bracket of the PUT method was not being hit I replaced the axios put call with a fetch call since they use a similar API I had narrowed my search down to some issue with axios at this point because it was working in Postman I added the fetch like so fetch http localhost orderId headers Authorization Bearer token content type application json x functions key AZURE FUNCTION KEY HERE and it worked just fine I started looking a bit closer and I noticed something When I submitted my request with axios the Bearer token was in the Payload not in the Request Header Hmm So to make a long story short too late amirite I didn t realize that the PUT verb requires a body We re not sending a body because all we re doing is setting the order back to a different status but we re using the PUT because all of the other verbs are being used Typically you would ALWAYS send a body with a PUT because you re updating a record and you need to send the information your replacing Ours is a unique usecase and since we re sending the orderId in the url then we didn t need to send a body The code that fixed this whole thing is const handleOrderSign async orderId gt const token await getTokenSilently var response axios put api order url orderId orderId lt this headers Authorization Bearer token content type application json x functions key api order key if response statusCode console log response else console error response Even though I don t need to send a body I m sending the orderId in the body just so I better conform to the axios standard So this is either one of those things that everyone knows and I m just slow on the uptake or this is something that happened because we re not using the tool the way it was intended or it s a lack of documentation on axios side Anyway Thanks for reading and that s all y all |
2021-04-12 19:19:49 |
海外TECH |
DEV Community |
React - mouse button press and hold example |
https://dev.to/diraskreact/react-mouse-button-press-and-hold-example-1eck
|
React mouse button press and hold exampleHi there In this article I would like to show you mouse button press and hold example in React Before we start I would highly recommend you to check out the runnable example for the solution on our website React mouse button press and hold exampleIn the beginning I wanted to tell you that unfortunately there is no press and hold mouse button event in React However I will show you how to perform some logic when the mouse button is pressed and held and how to break this logic when we stop pressing the button or when our cursor leaves the button field Final result Below example presents how to create a counter which increments on button press and hold every s As the counter increases the height and width of my element also increase as they depend precisely on the counter In the example I ve used useState hook to manage the counter as App component s state useRef hook to create a reference that will help us to set and clear the interval onMouseDown event to start incrementing the counter onMouseUp onMouseLeave events to stop incrementing the counter useEffect hook to stop the counter when App component is destroyed Practical example import React from react const App gt const counter setCounter React useState const intervalRef React useRef null React useEffect gt return gt stopCounter when App is unmounted we should stop counter styles const containerStyle height px width px const elementStyle margin px height counter px width counter px background radial gradient at bc bc ffcac border px solid black borderRadius boxShadow px px px BEBEBE functions const startCounter gt if intervalRef current return intervalRef current setInterval gt setCounter prevCounter gt prevCounter const stopCounter gt if intervalRef current clearInterval intervalRef current intervalRef current null return lt div style containerStyle gt lt div onMouseDown startCounter onMouseUp stopCounter onMouseLeave stopCounter style elementStyle gt lt div gt export default App You can run this example hereThat s my version of handling mouse press and hold event in React Let me know what you think in the comments Maybe you have a better solution I would be glad if you share it with me Thanks for your time and see you in the next posts Write to us If you have any problem to solve or questions that no one can answer related to a React or JavaScript topic or you re looking for a mentoring write to us on dirask com gt QuestionsYou can also join our facebook group where we share coding tips and tricks with others |
2021-04-12 19:19:45 |
海外TECH |
DEV Community |
A Beginner's Guide to Unit-testing with Jest |
https://dev.to/dsasse07/a-beginner-s-guide-to-unit-testing-with-jest-45cc
|
A Beginner x s Guide to Unit testing with JestUnit testing is an integral part of Test Driven Development TDD which is the process of defining the desired actions of a function and what we expect it to do or not do before we begin work on the actual function Approaching software development in this fashion serves a number of purposes this process can help define a path to success by outlining the tasks that must be done over the course of the function this process can help identify edge case scenarios and ensure that your code continues to function as expected in these situations As the codebase continues to grow and be modified this process also ensures that changes to other parts of the codebase do not negatively effect the performance of the tested function Programming languages have their own frameworks for developing unit tests For Javascript Jest is one of the most widely used testing frameworks and I hope this blog serves as a beginner s guide for those looking to get started in writing their own Jest tests We will walk through the process of setting up basic Jest tests and the files but you can view the repo containing all of the code here ContentsSetting Up JestIdentifying Desired ActionsInitializing the Test FileWriting TestsRunning the TestsWriting the FunctionsConclusionResources Setting Up JestSteps Create a new directory and cd into that directory Set up the NPM environmentmkdir jest example amp amp cd jest example npm init yInstall Jestnpm i jest save devConfigure the NPM environment to use Jest by modifying the package json file created earlier This edit will cause the command npm test to run the tests we will be building In package json scripts test jest Identify Desired ActionsTo begin writing the tests we must define what the function we will be building should do and what the expected outcome should be when the function is invoked For our example let s consider an object containing information about a user s blog posts const user username user blogs title Entry likes content Blog Content title Entry likes content Blog Content We will be writing two functions getTotalLikes to get the total number of likes of the given user s posts getMostPopularBlog to return the blog object of a specified user with the most likes Following the TDD process we will develop tests for these functions prior to working out the logic for the functions themselves Initializing the Test FileTypically tests are written in a tests or tests subdirectory of the app and we will follow this same convention From the root of our example project let s create a tests directory and the file which will contain our tests mkdir tests amp amp cd tests amp amp touch exampleFunctions test jsThe first thing we must do in this new file is to import the functions that we will be testing it s ok that they have not yet been written For the sake of this blog we will be writing both of the sample functions into the same js file and we will use destructuring in the import to get access to both of those functions jest example tests exampleFunctions test jsconst getTotalLikes getMostPopularBlog require exampleFunctions Both of the example functions discussed above will be tested using the same sample user object mentioned previously so we can define this globally for our tests file as well jest example tests exampleFunctions test jsconst getTotalLikes getMostPopularBlog require exampleFunctions const user username user blogs title Entry likes content Blog Content title Entry likes content Blog Content Writing testsTests typically contain these general components a describe function is invoked which accepts two arguments a string a description that will appear in the terminal when tests are run which describes the test block a callback function which will contain the individual tests One or more test function which accepts two arguments a string describing the action of the specific test a callback function containing an expect function and a matcher function The expect function accepts the function invocation being tested and is chained to the matcher which describes the expected results In the getTotalLikes function we expect that when the function is passed a user object the return value will be an integer that is the sum of the likes on all of the blogs of that user Including this into our test file would look like this jest example tests exampleFunctions test jsconst getTotalLikes getMostPopularBlog require exampleFunctions const user username user blogs title Entry likes content Blog Content title Entry likes content Blog Content describe getTotalLikes gt test should return the total likes of a user gt expect getTotalLikes user toBe Here the toBe matcher is used to define the expected output of the function invocation written in the preceeding expect statement The toBe matcher returns truthy if the output of the function is equal to the value passed into the matcher The Jest framework has a number of defined matchers such as toBeNull matches only nulltoBeUndefined matches only undefinedtoBeDefined is the opposite of toBeUndefinedtoBeTruthy matches anything that an if statement treats as truetoBeFalsy matches anything that an if statement treats as falsetoBeGreaterThan or toBeLessThan for number value comparisonstoMatch accepts a Regex pattern to match a string outputtoContain can be used to see if a value is contained in an ArrayMore common Jest Matchers can be found in the official introduction here or a complete list can be found in the official docs hereFor our second function we can define the expected output object within the describe block s scope and pass this object into our matcher Doing this we will again be checking for equality however when dealing with objects we must use toEqual instead which iterates through all of the values of the objects to check for equality With this in mind we must add this final describe block to our test file describe getMostPopularBlog gt test should return the most popular blog of a user gt const output title Entry likes content Blog Content expect getMostPopularBlog user toEqual output Running the TestsThe tests we have written should clearly fail because we have not yet written the functions however we can run the test to ensure that they are properly set up To run the tests run npm test which matches the command we defined in the package json We are wonderfully greeted with the expected failures that our functions are not defined and it indicates that our test file is prepared FAIL tests exampleFunctions test js getTotalLikes ✕ should return the total likes of a user ms getMostPopularBlog ✕ should return the most popular blog of a user getTotalLikes › should return the total likes of a user TypeError getTotalLikes is not a function Writing the functionsCreate a new file in jest example which will contain our functions The name of the file should match the filename of the test file minus the test extension In jest exampletouch exampleFunctions jsIn this file we need to define out two functions and ensure that we export those functions so that our test file can access them function getTotalLikes user function getMostPopularBlog user module exports getTotalLikes getMostPopularBlog If we save and run our tests again we will see that all four tests still fail which is expected but Jest provides a ne message to us indicating what happened getTotalLikes ✕ should return the total likes of a user ms getMostPopularBlog ✕ should return the most popular blog of a user ms getTotalLikes › should return the total likes of a user expect received toBe expected Object is equality Expected Received undefinedThis message indicates that our test is able to find the matching function unlike before but now instead of getting the expected value that was passed to the matcher no value is being returned from our function Let s implement the logic for our two functions as shown below function getTotalLikes user iterate through the blog entries and sum the like values const totalLikes user blogs reduce total blog gt return total blog likes return totalLikes function getMostPopularBlog user Iterate through users blogs and update the tracking object to continually have the index of the blog with most likes and the number of likes for comparison const maxLikes user blogs reduce max blog index gt if blog likes gt max likes return index index likes blog likes else return max index undefined likes Select get the blog object by looking up the index stored in the tracker const topBlog user blogs maxLikes index return topBlog module exports getTotalLikes getMostPopularBlog Now if we run the tests one final time we are greeted with pass indicators PASS tests exampleFunctions test js getTotalLikes ✓ should return the total likes of a user ms getMostPopularBlog ✓ should return the most popular blog of a user ms Test Suites passed totalTests passed totalSnapshots totalTime s estimated s ConclusionTesting is powerful Even with these limited tests we would would be able to see if changes further along in the development process negatively impact the work we have already done For example if the structure of the API response that we used to build the user object changed running the test file would indicate an issue prior to that change going into effect This is especially important in development teams where multiple developers are working on the same codebase The tests help ensure that new code remains compatible and functional with the codebase and with that of other developers However the reliability and power of testing is limited by the comprehensiveness of the test scenarios As you are building tests remember to consider the edge case scenarios that could break the function of your application and write tests to simulate those For example What would we expect to happen if the user was not found What is the expected behavior if two posts have the same number of likes What is the expected behavior if a user has no blogs The topic of testing goes very deep but hopefully this helps you get started with understanding the testing process and developing your own tests Resources Getting Started in JestCommon Jest MatchersJest DocsJest TutorialBlog Repo |
2021-04-12 19:12:23 |
Apple |
AppleInsider - Frontpage News |
China smartphone data shows solid iPhone 12 demand, but no 'super cycle' |
https://appleinsider.com/articles/21/04/12/china-smartphone-data-shows-solid-iphone-12-demand-but-no-super-cycle
|
China smartphone data shows solid iPhone demand but no x super cycle x Analysts are weighing in on the latest smartphone shipment data out of China which suggests solid demand for iPhone models but casts doubt on a super cycle Credit Andrew O Hara AppleInsiderThe latest shipment disclosure from the Chinese Academy of Information and Communications Technology CAICT shows that shipments of international smartphone brands mostly composed of Apple devices clocked in at million devices in March Read more |
2021-04-12 19:58:10 |
海外TECH |
Engadget |
Google's Nest Audio smart speaker is 20 percent off across the web |
https://www.engadget.com/google-nest-audio-20-percent-off-deal-best-buy-walmart-bh-photo-193059225.html
|
walmart |
2021-04-12 19:30:59 |
海外科学 |
NYT > Science |
Parents, Stop Talking About the ‘Lost Year’ |
https://www.nytimes.com/2021/04/11/health/pandemic-middle-school-mental-health.html
|
adults |
2021-04-12 19:41:50 |
ニュース |
BBC News - Home |
Prince Philip: William and Harry pay tribute to grandfather |
https://www.bbc.co.uk/news/uk-56721559
|
harry |
2021-04-12 19:33:49 |
ニュース |
BBC News - Home |
Covid lockdown eases: Celebrations as pub gardens and shops reopen |
https://www.bbc.co.uk/news/uk-56710858
|
street |
2021-04-12 19:28:19 |
ニュース |
BBC News - Home |
Minneapolis: Daunte Wright shooting by police 'accidental' |
https://www.bbc.co.uk/news/world-us-canada-56724798
|
taser |
2021-04-12 19:12:30 |
ニュース |
BBC News - Home |
West Brom beat Southampton to keep slim survival hopes alive |
https://www.bbc.co.uk/sport/football/56635783
|
hawthorns |
2021-04-12 19:28:42 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ソニー新技術とLGスマホ撤退に見る、日本と韓国の「モノづくり力」格差 - 今週のキーワード 真壁昭夫 |
https://diamond.jp/articles/-/268060
|
真壁昭夫 |
2021-04-13 04:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
コロナ感染者に対する差別が起きる、根本的な理由 - 自分だけは損したくない人のための投資心理学 |
https://diamond.jp/articles/-/268057
|
自分 |
2021-04-13 04:45:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
なんでも会議で決める組織は、なぜ間違いを犯しやすいのか - イライラ・モヤモヤ職場の改善法 榎本博明 |
https://diamond.jp/articles/-/268097
|
なんでも会議で決める組織は、なぜ間違いを犯しやすいのかイライラ・モヤモヤ職場の改善法榎本博明近頃、健全な組織にするために、何でも会議にかけて、みんなで検討して決めようとする組織運営者が多いようだ。 |
2021-04-13 04:40:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「相続税の非課税枠」が使える生命保険とは、税制改正の動向にも注目 - News&Analysis |
https://diamond.jp/articles/-/268100
|
「相続税の非課税枠」が使える生命保険とは、税制改正の動向にも注目NewsampampAnalysis日本は「保険大国」といわれる。 |
2021-04-13 04:35:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
JTB、ヤフー…テレワーク先進企業に学ぶ、働きがいを高める6つのヒント - 新時代のマネジメント&組織戦略 |
https://diamond.jp/articles/-/268114
|
働きがい |
2021-04-13 04:30:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
デザインカンパニー・グッドパッチの若手デザイナーが注目した「3月の6大トレンド」 - DOL特別レポート |
https://diamond.jp/articles/-/268054
|
話題 |
2021-04-13 04:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
誘導質問で気づかぬ間に情報漏洩、人間の弱さを突くソーシャルエンジニアリングの怖さ - セキュリティ心理学入門 内田勝也 |
https://diamond.jp/articles/-/266416
|
情報漏洩 |
2021-04-13 04:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
新校長人事で見る首都圏「中高一貫校」の将来、ミッションスクールならではの事情とは - 中学受験への道 |
https://diamond.jp/articles/-/268132
|
中学受験 |
2021-04-13 04:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
精神科医が「これだけは食べていい!」と断言する5つの食べ物 - ストレスフリー超大全 |
https://diamond.jp/articles/-/267832
|
精神科医が「これだけは食べていい」と断言するつの食べ物ストレスフリー超大全コロナ禍や自粛生活などの「環境の変化」により、多くの人が将来への不安を抱え、「大きなストレス」を感じています。 |
2021-04-13 04:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「辛くても努力できる人」と「途中でやめてしまう人」を分ける決定的な差【新年度におすすめの記事】 - 独学大全 |
https://diamond.jp/articles/-/268167
|
「辛くても努力できる人」と「途中でやめてしまう人」を分ける決定的な差【新年度におすすめの記事】独学大全インターネットの「知の巨人」、読書猿さん。 |
2021-04-13 04:05:00 |
ビジネス |
東洋経済オンライン |
新駅設置に路線延伸、地方鉄道「元気の秘訣」 ひたちなか海浜鉄道社長が明かす経営の軌跡 | ローカル線・公共交通 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/421201?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
地方鉄道 |
2021-04-13 04:30:00 |
コメント
コメントを投稿