AWS |
AWS Big Data Blog |
Estimate Amazon EC2 Spot Instance cost savings with AWS Glue DataBrew, AWS Glue, and Amazon QuickSight |
https://aws.amazon.com/blogs/big-data/estimate-amazon-ec2-spot-instance-cost-savings-with-aws-glue-databrew-aws-glue-and-amazon-quicksight/
|
Estimate Amazon EC Spot Instance cost savings with AWS Glue DataBrew AWS Glue and Amazon QuickSightAWS provides many ways to optimize your workloads and save on costs For example services like AWS Cost Explorer and AWS Trusted Advisor provide cost savings recommendations to help you optimize your AWS environments However you may also want to estimate cost savings when comparing Amazon Elastic Compute Cloud Amazon EC Spot to On Demand Instances … |
2021-04-14 17:01:11 |
海外TECH |
Ars Technica |
Everything we know about Audi’s next electric crossover, the Q4 e-tron |
https://arstechnica.com/?p=1756615
|
crossover |
2021-04-14 17:15:40 |
海外TECH |
DEV Community |
TIP: Never leave your email address raw in the mailto link! Here's what to do instead |
https://dev.to/naseki/tip-never-leave-your-email-address-raw-in-the-mailto-link-here-s-what-to-do-instead-1c70
|
TIP Never leave your email address raw in the mailto link Here x s what to do insteadUsually when you leave your email address on your website for people to click on you may do something like this lt a href mailto name example com gt name example com lt a gt Right This is however the perfect recipe to get spam into your email This is how email harvesting worksIn order for spambots to get a nice long list of emails to annoy people to click their suspicious looking links they use email harvesters to curate these lists Emails are typically found on websites where people leave theirs to be contacted Some people think this is easy to solve simply by masking the email like name AT example DOT com This however doesn t solve anything due to two things The mailto link still contains the actual email address as you can t replace it with the one above Since email harvesters look into the source code of your website they d still be able to get your email Most email harvesters are advanced enough to detect common patterns like AT and AT and such so they won t do much So what now Encode your email addressFortunately there s a way to make your email address unreadable for email harvesters You may have seen characters like amp amp and amp gt in HTML before These are called HTML entities These are symbols that have been encoded so they won t be mistaken for HTML tags However what not many people know is that you can encode every single character into an HTML entity And even better putting these into your hrefs will convert them back into regular text for normal visitors that are visiting your website rather than looking at the source code It s perfect for this situation HTML entities for regular letters are made of HEX encoding The HTML entities would look like like amp HEXCODE Let s do it Use this handy tool to convert Make sure to copy the entire href link not just your email address After that copy paste that string into your href and you re done Here s how it should look like lt a href amp xd amp x amp x amp xc amp x amp xf amp colon amp xe amp x amp xd amp x amp commat amp x amp x amp x amp xd amp x amp xc amp x amp period amp x amp xf amp xd gt My email lt a gt This makes the whole thing a lot harder to decypher for most email harvesters That while still keeping the link clickable for others On top of that using inspect element to check the HTML gives you the decoded email even though the source code has it encoded This means that it still ends up being readable for humans It s even better if you use some non traditional way of masking your email address in the actual text or just don t use your email at all like in the sample above We re all good now No more disappointments that you think you just got a client but it turns out to be spam Thanks for reading If you wanna stay up to date with dev subscribe to my newsletter I send a couple of articles and resources once a week and will let you know when I ve written a new article as well Not sure if it s for you Read a sample newsletter here Subscribe here |
2021-04-14 17:36:09 |
海外TECH |
DEV Community |
5 Key Lessons React Tutorials Don't Teach |
https://dev.to/reedbarger/5-key-lessons-react-tutorials-don-t-teach-5pb
|
Key Lessons React Tutorials Don x t TeachThere are many essential concepts and lessons that React developers need to know that simply aren t covered in most tutorials I have handpicked the topics I believe are some of the most important for you to know but few articles have dedicated the time to cover in detail Let s take a look at five key React lessons worth knowing which you might not find elsewhere Want to learn all the skills you need to become a highly paid React developer Check out the React Bootcamp How React state is actually updatedAs a React developer you know that state can be created and updated with the useState and useReducer hooks But what happens exactly when you update a component s state with either of these hooks Is the state updated immediately or is it done at some later time Let s look at the following code which it s a very simple counter application As you would expect you can click on the button and our counter increases by import React from react export default function App const count setCount React useState function addOne setCount count return lt div gt lt h gt Count count lt h gt as we expect lt button onClick addOne gt lt button gt lt div gt But what if we attempt to add an additional line which also updates our count by one What do you think will happen When you click on the button will our displayed count increase by one or two import React from react export default function App const count setCount React useState function addOne setCount count setCount count return lt div gt lt h gt Count count lt h gt lt button onClick addOne gt lt button gt lt div gt If we run this code we see it s incremented only by one Despite attempting to increment the count by one twice with two separate state updates Why does our counter display despite clearly incrementing state by two times The reason for this is that React schedules a state update to be performed when we call when we update state the first time Because it is just scheduled and is not performed immediately it is asynchronous and not synchronous our count variable is not updated before we attempt to update it a second time In other words because the state updated is scheduled not performed immediately the second time we called setCount count is still just not The way that we can fix this to update state reliably despite state updates being asynchronous is to use the inner function that s available within the useState setter function This allows us to get the previous state and return the value that we want it to be in the body of the inner function When we use this pattern we see that it s incremented by two like we originally wanted import React from react export default function App const count setCount React useState function addOne setCount prevCount gt prevCount setCount prevCount gt prevCount return lt div gt lt h gt Count count lt h gt lt button onClick addOne gt lt button gt lt div gt It s better to use multiple effects instead of oneWhen performing a side effect most React developers will useEffect just once and attempt to perform multiple side effects within the same effect function What does that look like Below you can see where we are fetching both post and comment data in one useEffect hook to be put in their respective state variables import React from react export default function App const posts setPosts React useState const comments setComments React useState React useEffect gt fetching post data fetch then res gt res json then data gt setPosts data fetching comments data fetch then res gt res json then data gt setComments data return lt div gt lt PostsList posts posts gt lt CommentsList comments comments gt lt div gt Instead of attempting to cram all of your side effects into a single effect hook just as you can use the state hook more than once you can use several effects Doing so allows us to separate our different actions into different effects for a better separation of concerns A better separation of concerns is a major benefit that React hooks provide as compared to using lifecycle methods within class components In methods like componentDidMount for example it was necessary to include any action that we want it to be performed after our component mounted You could not break up your side effects into multiple methods each lifecycle method in classes can be used once and only once The major benefit of React hooks is that we are able to break up our code based upon what it s doing Not only can we separate actions that we are performing after render into separate into multiple effects but we can also co locate our state import React from react export default function App const posts setPosts React useState React useEffect gt fetch then res gt res json then data gt setPosts data const comments setComments React useState React useEffect gt fetch then res gt res json then data gt setComments data return lt div gt lt PostsList posts posts gt lt CommentsList comments comments gt lt div gt This means we can put the state hook with the effect hook that is related to this helps to organize our code much better and better understand what it s doing at a glance Don t optimize functions that update state useState useReducer A common task whenever we pass down a callback function from a parent component to a child component is to prevent it from being recreated unless its arguments have changed We can perform this optimization with the help of the useCallback hook useCallback was created specifically for callback functions that are passed to child components to make sure that they are not recreated needlessly which incurs a performance hit on our components whenever there is a re render The reason for this being whenever our parent component re renders it will cause all child components to re render as well This is what causes our callback functions to be recreated on every re render However if we are using a setter function to update state that we ve created with the useState or useReducer hooks We do not need to wrap that with useCallback In other words there is no need to do this import React from react export default function App const text setText React useState Don t wrap setText in useCallback it won t change as is const handleSetText React useCallback event gt setText event target value return lt form gt lt Input text text handleSetText handleSetText gt lt button type submit gt Submit lt button gt lt form gt function Input text handleSetText return lt input type text value text onChange handleSetText gt The reason is taken directly from the React documentation React guarantees that setState function identity is stable and won t change on re renders This is why it s safe to omit from the useEffect or useCallback dependency list Therefore not only do we not need to optimize it unnecessarily with useCallback but we also do not need to include it as a dependency within useEffect because it will not change This is important to note because in many cases it can cut down the code that we need to use and most importantly it is an unproductive attempt to optimize your code as it can incur performance problems of its own The useRef hook can preserve state across rendersAs React developers it s very helpful sometimes to be able to reference a given React element with the help of a ref We create refs in React with the help of the useRef hook It s important to note however that use ref isn t just helpful for referencing to a certain DOM element The React documentation says so itself The ref object that s created by useRef is a generic container with a current property that s mutable and can hold any value There are certain benefits to be able to store and update values with useRef The reason being is that it allows us to store a value that will not be in memory that will not be erased across re renders If we wanted to keep track of a value across renders with the help of a simple variable it would be reinitialized each time the component renders However if you use a ref the value stored in it will remain constant across renders of your component What is a use case for leveraging useRef in this way This could be helpful in the event that we wanted to perform a given side effect on the initial render only for example import React from react export default function App const count setCount React useState const ref React useRef hasRendered false React useEffect gt if ref current hasRendered ref current hasRendered true console log perform action only once return lt div gt lt button onClick gt setCount count gt Count count lt button gt lt div gt Try running this code yourself As you will see no matter how many times the button is clicked state is updated and a re render takes place the action we want to perform see console log is only performed once How to prevent your React app from crashingOne of the most important lessons for React developers to know especially if they haven t pushed a React application to the web is what to do with uncaught errors In the example below we are attempting to display a Header component in our app but are performing an action that results in an error Namely attempting to get a property from a null value import React from react export default function App return lt gt lt Header gt lt gt function Header const user null return lt h gt Hello user name lt h gt error If we push this code to production we will see a blank screen exactly like this Why do we see nothing Again we can find the answer for this within the React documentation As of React errors that were not caught by any error boundary will result in unmounting of the whole React component tree While in development you see a big red error message with a stack trace that tells you where the error When your application is live however you re just going to see a blank screen This is not the desired behavior that you want for your application But there is a way to fix it or at least show them something that tells the user that an error took place if the application accidentally crashes You can wrap your component tree in what s called an error boundary Error boundaries are components that allow us to catch errors and show users a fallback message that tells them that something wrong occurred That might include instructions on how to dismiss the error i e reloading the page The way that we can use an error boundary is with the help of the package react error boundary We can wrap it around the component we believe is error prone It can also be wrapped around our entire app component tree import React from react import ErrorBoundary from react error boundary export default function App return lt ErrorBoundary FallbackComponent ErrorFallback gt lt Header gt lt ErrorBoundary gt function Header const user null return lt h gt Hello user name lt h gt function ErrorFallback error return lt div role alert gt lt p gt Oops there was an error lt p gt lt p style color red gt error message lt p gt lt div gt You can also display the error message however you like and style it just like you would any normal component The result that we get when an error does occur is much better Enjoy this post Join The React BootcampThe React Bootcamp takes everything you should know about learning React and bundles it into one comprehensive package including videos cheatsheets plus special bonuses Gain the insider information hundreds of developers have already used to master React find their dream jobs and take control of their future Click here to be notified when it opens |
2021-04-14 17:15:50 |
海外TECH |
Engadget |
'Oxenfree II: Lost Signals' headlines a new crop of Switch indie games |
https://www.engadget.com/oxenfree-2-lost-signals-nintendo-switch-steam-indie-world-showcase-171749485.html
|
switch |
2021-04-14 17:17:49 |
海外TECH |
Engadget |
The Q4 e-tron and its Sportback sibling join Audi's European EV lineup this summer |
https://www.engadget.com/the-q-4-e-tron-and-its-sporback-sibling-join-audis-ev-lineup-this-summer-171523816.html
|
The Q e tron and its Sportback sibling join Audi x s European EV lineup this summerAudi s upcoming Q e tron and Q Sportback EV SUVs are ideal for daily errands and weekend getaways ーthough they ll only be available in Europe |
2021-04-14 17:15:23 |
海外TECH |
WIRED |
This WIRED-Approved Heated Massage Gun Is on Sale Now |
https://www.wired.com/story/skg-f5-massage-gun-deal-april-2021
|
percent |
2021-04-14 17:30:00 |
海外ニュース |
Japan Times latest articles |
Suga-Biden summit offers chance to hash out a plan on China |
https://www.japantimes.co.jp/news/2021/04/14/national/suga-biden-summit/
|
china |
2021-04-15 02:56:01 |
海外ニュース |
Japan Times latest articles |
Organizers celebrate 100 days until problem-plagued Tokyo Games |
https://www.japantimes.co.jp/news/2021/04/14/national/japan-100-days-olympics-tokyo/
|
Organizers celebrate days until problem plagued Tokyo GamesCountless controversial elements regarding restrictions on spectator attendance and the priority vaccination of competing athletes among others remain undecided |
2021-04-15 02:36:18 |
海外ニュース |
Japan Times latest articles |
Fukushima water release to be key issue in general election |
https://www.japantimes.co.jp/news/2021/04/14/national/fukushima-water-election/
|
Fukushima water release to be key issue in general electionOpposition parties aim to take the water disposal question to the election for the House of Representatives which is set to take place by autumn |
2021-04-15 02:29:49 |
海外ニュース |
Japan Times latest articles |
South Korea aims to fight Fukushima water release in world tribunal |
https://www.japantimes.co.jp/news/2021/04/14/national/south-korea-fukushima/
|
tribunal |
2021-04-15 02:22:45 |
海外ニュース |
Japan Times latest articles |
Tepco banned from restarting its largest nuclear plant over safety flaws |
https://www.japantimes.co.jp/news/2021/04/14/national/tepco-nuclear-plant-restart-ban/
|
Tepco banned from restarting its largest nuclear plant over safety flawsThe company has seen restarting the seven reactor Kashiwazaki Kariwa complex once one of the world s largest nuclear plants by output as a main pillar of its |
2021-04-15 02:20:12 |
海外ニュース |
Japan Times latest articles |
Takakeisho rises to top of sumo’s depth chart |
https://www.japantimes.co.jp/sports/2021/04/14/sumo/sumo-draft-2021-takakeisho-terunofuji/
|
titles |
2021-04-15 03:13:37 |
ニュース |
BBC News - Home |
Greensill row: Civil servants ordered to declare second jobs |
https://www.bbc.co.uk/news/uk-politics-56751997
|
whitehall |
2021-04-14 17:19:44 |
ニュース |
BBC News - Home |
Daunte Wright shooting: Officer Kim Potter to be charged over killing |
https://www.bbc.co.uk/news/world-us-canada-56752821
|
degree |
2021-04-14 17:44:35 |
ニュース |
BBC News - Home |
Afghanistan: Biden to call for end to 'America's longest war' |
https://www.bbc.co.uk/news/world-us-canada-56750439
|
biden |
2021-04-14 17:13:06 |
ニュース |
BBC News - Home |
Hundreds lose job in British Gas contracts row |
https://www.bbc.co.uk/news/business-56746656
|
contracts |
2021-04-14 17:49:06 |
ニュース |
BBC News - Home |
Prince Philip: Rehearsals take place for Duke of Edinburgh's funeral |
https://www.bbc.co.uk/news/uk-56746947
|
covid |
2021-04-14 17:07:57 |
ニュース |
BBC News - Home |
Prince Philip: Royals release new photos of the Duke of Edinburgh |
https://www.bbc.co.uk/news/uk-56753327
|
edinburgh |
2021-04-14 17:43:04 |
ニュース |
BBC News - Home |
Liverpool need to be our 'best selves' to knock out Real - Klopp |
https://www.bbc.co.uk/sport/football/56738030
|
Liverpool need to be our x best selves x to knock out Real KloppJurgen Klopp says Liverpool have to be their best selves to beat Real Madrid in the second leg of their Champions League quarter final |
2021-04-14 17:53:55 |
コメント
コメントを投稿