AWS |
AWS Database Blog |
Import and export CloudFormation templates and CSV sample data with NoSQL Workbench for Amazon DynamoDB |
https://aws.amazon.com/blogs/database/import-and-export-cloudformation-templates-and-csv-sample-data-with-nosql-workbench-for-amazon-dynamodb/
|
Import and export CloudFormation templates and CSV sample data with NoSQL Workbench for Amazon DynamoDBNoSQL Workbench for DynamoDB is a client side application with a point and click interface that helps you design visualize and query non relational data models for Amazon DynamoDB NoSQL Workbench clients are available for Windows macOS and Linux Over time NoSQL Workbench has added many features such as the ability to use it with Amazon Keyspaces for Apache … |
2022-03-23 15:04:34 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
SigfoxとRaspberry Piで、狩猟の罠通知装置を作成する。(その2) |
https://qiita.com/SAMisnotMydog/items/bbc27879e48cb8d2afb0
|
お品書きGPIOからの電源供給ZeroWへの移植シリアルコンソールの無効化UARTの設定プログラムの自動起動化Unitファイルの記述pyファイルへの実行権限の付与メール通知の設定ひとまず完成です。 |
2022-03-24 00:31:41 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
python+opencvで画像処理の勉強8 パターン・図形・特徴の検出とマッチング |
https://qiita.com/tanaka_benkyo/items/f65ffabc32538020ba20
|
参照画像の選択による高速化テンプレートに含まれるがそから同時生起行列を用いて選択された独自性の高い画素を用いて類似度計算することで、高速にマッチングを行います。 |
2022-03-24 00:18:42 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
Javascript GitHubトレンドデイリーランキング!!【自動更新】 |
https://qiita.com/higakin/items/7e2c2826f1320f43fbde
|
JavascriptGitHubトレンドデイリーランキング【自動更新】GitHubTrendingをキャッチアップする習慣をつけて、強強エンジニアになろう。 |
2022-03-24 00:52:57 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
NoodlのJavascriptノード変更点(2.1.0以降) |
https://qiita.com/macole/items/ec925834d85d5f69ab5b
|
下記の例では入力Lambdaが変更されると関数が実行されます。 |
2022-03-24 00:14:52 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
QNAP の Container Station のトラブルシューティングは ssh で入った方が楽 |
https://qiita.com/YKInoMT/items/8db2be5dab66cba5b167
|
続きというか、ある時giteaのwebコンテナが停止していることが判明し、どうやっても起動しなくなって困ったという話からの、結局ContainerStationだけで対応しようとすると無理があるので、素直にdockerコマンド使った方が楽ですよ、という話です。 |
2022-03-24 00:14:49 |
技術ブログ |
Mercari Engineering Blog |
メルカリ×エンジニアtypeイベント「Tech Update 2022」開催のお知らせ |
https://engineering.mercari.com/blog/entry/20220323-tech-update-2022-announcement/
|
typetechupdatehellip |
2022-03-23 15:25:44 |
海外TECH |
Ars Technica |
What we learned by driving the prototype Nissan Ariya EV crossover |
https://arstechnica.com/?p=1843033
|
appeal |
2022-03-23 15:18:31 |
海外TECH |
MakeUseOf |
8 IMDb Features You May Have Overlooked |
https://www.makeuseof.com/tag/useful-imdb-features/
|
features |
2022-03-23 15:45:14 |
海外TECH |
MakeUseOf |
11 Sites for Parenting Tips and Advice When You Need It |
https://www.makeuseof.com/tag/sites-parenting-tips-advice/
|
parents |
2022-03-23 15:31:15 |
海外TECH |
MakeUseOf |
The 5 Best Weightlifting Apps to Boost Your Muscle Gains |
https://www.makeuseof.com/best-weightlifting-apps-boost-muscle-gains/
|
The Best Weightlifting Apps to Boost Your Muscle GainsWeightlifting is tough no matter what stage you re at but these great workout apps can make the planning and tracking parts so much easier |
2022-03-23 15:31:14 |
海外TECH |
MakeUseOf |
How to Connect Two Sets of AirPods to the Same Mac |
https://www.makeuseof.com/how-to-connect-two-sets-of-airpods-to-one-mac/
|
airpods |
2022-03-23 15:15:17 |
海外TECH |
MakeUseOf |
A Brief History of Windows From 1985 to Present Day |
https://www.makeuseof.com/windows-brief-history/
|
windows |
2022-03-23 15:15:16 |
海外TECH |
MakeUseOf |
The Best Ways to Spend Your Google Opinion Rewards Balance |
https://www.makeuseof.com/spend-google-opinions-rewards-balance/
|
balancebuilt |
2022-03-23 15:15:17 |
海外TECH |
DEV Community |
How to wrap text in HTML Canvas |
https://dev.to/smpnjn/how-to-wrap-text-in-html-canvas-3369
|
How to wrap text in HTML CanvasAlthough adding text to HTML canvas is very common there is no built in line break functionality That means if our text is too long the text will run off the end Take the example below where the text is supposed to be Hello this text line is very long It will overflow Since it s too long to fit in the canvas it just overflows with no line breaks Code for this example let canvas document getElementById canvas let ctx canvas getContext d let grd ctx createLinearGradient grd addColorStop aff grd addColorStop cba ctx fillStyle grd ctx fillRect More textctx font px Helvetica ctx fillStyle white ctx fillText Hello this text line is very long It will overflow Our text above starts at px and continues with no line breaks As odd as it is we need to calculate ourselves where the line breaks should be in HTML Canvas To do that we can use a custom function and use the data from that function to put line breaks in place How to wrap text in HTML CanvasWhen we build our custom function to wrap text in HTML we need to consider when a line break occurs A line break typically occurs when the next word is going to overflow the width of the parent element in this case our canvas When we build our function to wrap the text we need to check if the next word in the sentence will cause an overflow As such we ll build a function which accepts a few different variables ctx the context for the canvas we want to wrap text on text the text we want to wrap x the X starting point of the text on the canvas y the Y starting point of the text on the canvas maxWidth the width at which we want line breaks to begin i e the maximum width of the canvas lineHeight the height of each line so we can space them below each other Let s take a look at the function I ve built for this description wrapText wraps HTML canvas text onto a canvas of fixed width param ctx the context for the canvas we want to wrap text on param text the text we want to wrap param x the X starting point of the text on the canvas param y the Y starting point of the text on the canvas param maxWidth the width at which we want line breaks to begin i e the maximum width of the canvas param lineHeight the height of each line so we can space them below each other returns an array of lineText x y for all linesconst wrapText function ctx text x y maxWidth lineHeight First start by splitting all of our text into words but splitting it into an array split by spaces let words text split let line This will store the text of the current line let testLine This will store the text when we add a word to test if it s too long let lineArray This is an array of lines which the function will return Lets iterate over each word for var n n lt words length n Create a test line and measure it testLine words n let metrics ctx measureText testLine let testWidth metrics width If the width of this test line is more than the max width if testWidth gt maxWidth amp amp n gt Then the line is finished push the current line into lineArray lineArray push line x y Increase the line height so a new line is started y lineHeight Update line and test line to use this word as the first word on the next line line words n testLine words n else If the test line is still less than the max width then add the word to the current line line words n If we never reach the full max width then there is only one line so push it into the lineArray so we return something if n words length lineArray push line x y Return the line array return lineArray This function works on a few premises We test a new line by using measureText If it s too long for the container then we start a new line Otherwise we stay on the current one We use a predefined line height so that we can have consistent line heights We return an array of lineText x y for each line where lineText is the text for that line and x y is the starting position of that particular line If there is only one line we just return that line in lineArray To apply it to our canvas we have to iterate over each element from the array Then we use ctx fillText to draw each line at the coordinates calculated by our wrapText function which will ultimately create line breaks for us Set up our font and fill stylectx font px Helvetica ctx fillStyle white we pass in ctx text x y maxWidth lineHeight to wrapText I am using a slightly smaller maxWidth than the canvas width since I wanted to add padding to either side of the canvas let wrappedText wrapText ctx This line is way too long It s going to overflow but it should line break wrappedTewrappedText forEach function item item is the text item is the x coordinate to fill the text at item is the y coordinate to fill the text at ctx fillText item item item And we end up with wrapped text Now we can wrap text in canvas The final code for the example above is shown below let canvas document getElementById canvas let ctx canvas getContext d canvas width canvas height description wrapText wraps HTML canvas text onto a canvas of fixed width param ctx the context for the canvas we want to wrap text on param text the text we want to wrap param x the X starting point of the text on the canvas param y the Y starting point of the text on the canvas param maxWidth the width at which we want line breaks to begin i e the maximum width of the canvas param lineHeight the height of each line so we can space them below each other returns an array of lineText x y for all linesconst wrapText function ctx text x y maxWidth lineHeight First start by splitting all of our text into words but splitting it into an array split by spaces let words text split let line This will store the text of the current line let testLine This will store the text when we add a word to test if it s too long let lineArray This is an array of lines which the function will return Lets iterate over each word for var n n lt words length n Create a test line and measure it testLine words n let metrics ctx measureText testLine let testWidth metrics width If the width of this test line is more than the max width if testWidth gt maxWidth amp amp n gt Then the line is finished push the current line into lineArray lineArray push line x y Increase the line height so a new line is started y lineHeight Update line and test line to use this word as the first word on the next line line words n testLine words n else If the test line is still less than the max width then add the word to the current line line words n If we never reach the full max width then there is only one line so push it into the lineArray so we return something if n words length lineArray push line x y Return the line array return lineArray Add gradientlet grd ctx createLinearGradient grd addColorStop aff grd addColorStop cba ctx fillStyle grd ctx fillRect More textctx font px Helvetica ctx fillStyle white let wrappedText wrapText ctx This line is way too long It s going to overflow but it should line break wrappedText forEach function item ctx fillText item item item ConclusionAlthough we have to write a custom function to wrap text in HTML canvas it s not too hard when you understand how it works I hope you ve enjoyed this guide on how to wrap text with HTML canvas For more on HTML canvas check out my full length guide here |
2022-03-23 15:44:41 |
海外TECH |
DEV Community |
Epic React: Hooks. UseState, useEffect. What I'm learning.. |
https://dev.to/buaiscia/epic-react-hooks-usestate-useeffect-what-im-learning-1a5j
|
Epic React Hooks UseState useEffect What I x m learning Back into Epic React useState useEffectOther notes Back into Epic ReactAfter a long break and quite more experience I managed to get back to EpicReact This is the second chapter of the series Here s the link to the first one Epic React Fundamentals What I m learning As in the other post this isn t a guide to React nor to EpicReact They are just my notes thoughts and learning on the course workshops Few things can appear as confusing for lack of context However I hope you can find some interesting points to reflect upon Repositories and solutions are anyway publicly available on Kent s Github Let s dive into hooks with a focus on useState and useEffect useStateA first good point is in controlled components value is changed updated by the state and uncontrolled by event handlers The interesting part of useState is how under the hood is nothing else but an array declaration When it s used it gets two elements of the array in which the first is the variable and the second one is the function to update the variable So a code like this const count setCount useState would be not destructured const array useState const count array const setCount array The first exercise is quite simple if one understands React states well Every time unless different specified the state changes in any part of the component there will be a re render of the component virtual DOM updating what appears on the page If I call a function on the onChange in the input and that function changes the state setCount event target value then I can call the updated state in any part of the render count lt strong gt Count is count lt strong gt Add a number to count In the second part the task would be to use a prop in the component as initial value to pass lt Counting initialCount I find there are different ways The best way is to setState to that initial value that is destructured in the function arguments function Counting initialCount Destructuring is necessary because initialCount is an object so if we re passing the argument just like it initialCount the result will be Object object The default value is also necessary in case we don t pass anything as a prop In this case we don t cause a crash because of undefined value unless we use Typescript and we define it as possible undefined So one way is to setState initialCount and value count in the input Another possible way is to set the defaultValue of the input to the initialCount This will have the same effect except that the state of the rendered text won t be updated until something is typed It s possible to create a check to use the count like a nested if but with ternary operator However it will make the code more difficult to read and follow in its flow useEffectThis hook is called at every render of the component whenever its dependencies change Or at any render if the dependency array is empty We can persist the state call the localstorage methods inside useEffect getter and or setter const name setName React useState window localStorage getItem name initialName However in doing so we can run into a performance issue Access to localstorage is slower than other methods There are some workarounds for this React s useState hook allows you to pass a function instead of the actual value and then it will only call that function to get the state value when the component is rendered the first time React useState gt someExpensiveComputation that s the same as the callback on setState in class componentsconst name setName React useState gt window localStorage getItem name initialName If we put a console inside the callback we cans see it s called only on the first render It should be used only for bottleneck functions that require sync timeOr using useEffect lazy initialization or not reading from localStorage at every render dependency array second argument on useEffect which signals to React that your effect callback function should be called when and only when those dependencies change React useEffect gt window localStorage setItem count count name If other states apart from name change setItem won t be calledIf left empty it ll be called only at the first render The state in the dependency array is an object that is compared on the render with the previous state through object comparison If they re the same useEffect won t run otherwise yes Custom hooks They are external functions called inside a method Their names start with use If we have different functions inside the component method we can externalize those even useEffect If we have a method like this function Greeting initialCount const count setCount React useState gt window localStorage getItem count initialCount React useEffect gt window localStorage setItem count count count function handleChange event setCount event target value We can convert it to this and then use it in the main method as custom hook function useLocalStorageWithState const count setCount React useState gt window localStorage getItem count initialCount React useEffect gt window localStorage setItem count count count return count setCount function Greeting initialCount const count setCount useLocalStorageWithState function handleChange event setCount event target value Other notesSetting up a callback inside useState makes the setting of the state as lazy as it compares the states and doesn t change it if it s the same If you ar getting an error that goes like React Hook is called in function which is neither a React function component or custom React Hook function then it s possible that you put a wrong name to the custom hook As a React convention your function should start with use and probably is not For example useGetItems So instead of syncLocalStorageWithState we call it useLocalStorageWithState useLocalStorageWithState should have the same use as the useState hook so it can return an array like useState and we can store it in a similar array So we have created a custom useState hook that does other stuff as well We pass as well count and initialCount as parameters useLocalStorageWithState count initialCount and then making useLocalStorageWithState more generic receiving as arguments key defaultValue so the method can be reused freely and not stay chained to a count state The same applies to the state We can set state setState and return the same Having two arguments means that also useEffect should have two in the dependency array The logic of the flexible localStorage hook is the following get the item from local storageif present JSON parse it and return the resultif not return the default valueThat s for getting the state For setting the changes using useEffect in this case for creating editing the local storage se can move forward like this once the state changes we can just stringify whatever the state will be and store it Serialize will be for stringify the JSON while deserialize for parsing it In case as argument of useLocalStorageWithState instead of a number we ll pass a function it s possible to create a check to return the results of another function const name setName useLocalStorageWithState name complexCounting gt pass a function as default valuereturn typeof defaultValue function defaultValue defaultValue gt return to useState the result of the methodThen it comes the complicated part In the above case we are passing two parameters to useLocalStorageWithState The first one the key is a string and the second a primitive value or a method What if somebody wants to pass another value to the key Now for example can be passed count as string but maybe somebody will want to pass something different to store a different thing in local storage for instance There s no direct way to change the state of the key so what could be done is storing the key into a variable that won t trigger the render using useRef Following that in useEffect we can compare the old key with the new one According to the docs useRef returns a mutable ref object whose current property is initialized to the passed argument initialValue The returned object will persist for the full lifetime of the component Note that useRef is useful for more than the ref attribute It s handy for keeping any mutable value around similar to how you d use instance fields in classes The difference with useState is then that useRef doesn t trigger a rerender so with this hook we can actually set the key without triggering the rerender The purpose of this is clear in the useEffectconst prevKey prevKeyRef current if prevKey key window localStorage removeItem prevKey Usually we store in localStorage a value But this value is in an object and that object has a key So for now it s count But if it will be sum and we don t remove the initial key we ll have two objects in localStorage So if the new key and the old one which is stored in the useRef var is different we will remove the object in localStorage with the old key |
2022-03-23 15:11:07 |
海外TECH |
DEV Community |
Best Books On Crypto |
https://dev.to/workshub/best-books-on-crypto-51ae
|
Best Books On CryptoBlockchain and cryptocurrencies have garnered a lot of popularity over the years And why not It s because they can be decentralized and the data is cryptographically encrypted meaning no one can access it Blockchain technology has revolutionarily changed everything the digital ownership and privacy revolution will someday permeate our daily lives Companies these days often use blockchain to secure how users send and receive money Banking and investment make the most of blockchain technology more than any other industry As a result of bitcoin blockchain has grabbed the curiosity of everyone wishing to invest in recent years You might purchase any random book about cryptocurrencies but you ve come to the correct spot if you re searching for professional guidance on which one is ideal for your requirements We have investigated in depth to include the best rated solutions ideal for various use demands and budget ranges Naturally if you re interested in it you ll want to learn more about it The following is a list of best books on crypto that should be read in no particular order Unlocking Digital Cryptocurrencies Mastering BitcoinMastering Bitcoin is a book by Andreas M Antonopoulos intended for anybody who has a basic grasp of blockchain technology This book takes a deep dive into bitcoin and at the end of it you ll be able to develop your cryptocurrency apps The Bitcoin Blockchain provides an altogether new foundation upon which our economy can develop one that will enable an ecosystem as vast and diversified as the Internet itself Andreas M Antonopoulos as one of the world s foremost thinkers is the ideal candidate to write this book ーRoger Ver Bitcoin investor and entrepreneur Another book by the same author Mastering Ethereum is a fascinating one to read as it explains smart contracts and adds an extra degree of security to Ethereum How the Technology Behind Bitcoin Is Changing Money Business and the World Blockchain Revolution This book by Don Tapscott and Alex Tapscott has been listed times out of times on the Best of List and it is by far the most popular Blockchain book Don Tapscott is the CEO of the Tapscott Group and one of the world s most important business and social theorists Don was rated the fourth most influential business thinker globally by Thinkers in November Don was named the most prominent management thinker globally by Forbes in prior social media research Alex Tapscott is the CEO and co founder of Northwest Passage Ventures a blockchain advising business He published the foundational study on controlling digital currencies for the Global Solutions Network program at the University of Toronto s Joseph L Rotman School of Management in A wonderfully written and meticulously researched book The Internet of Value according to the Blockchain Revolution will alter our lives This is a must read book for our turbulent times as quoted by McKinsey amp Company s worldwide managing director Dominic Barton Bitcoin and the Inside Story of the Misfits and Millionaires Trying to Reinvent Money Book Digital Gold Nathaniel Popper s book tells the exciting history of Bitcoin technology and its rapid rise to recognition as a digital currency system thanks to the help of several notable figures If you want to learn more about Bitcoin s history this book is for you It will take you on tour through Bitcoin s history beginning with its inception The author s background as a reporter at The New York Times lends itself to his ability to pull together unrelated events in a concise way The complicated tale of Bitcoin is told in an easy to understand manner with no jargon keeping the reader captivated by the book The development of Bitcoin technology is the subject of this book It is clear for beginners to set their best first step into cryptocurrencies more speculatively The Investor s Guide to Cryptocurrency and Defi the Decentralized Finance Revolution The Wall Street Era is Over The Wall Street Era is Over by the experts who had been in DeFi explains how to succeed in DeFi the industry that is paving the way for the Finance revolution and how to invest safely The Investor s Guide to Cryptocurrency and DeFi the Decentralized Finance Revolution is a comprehensive reference It includes the following primary subjects and many others like explaining the origins of DeFi and its function in cryptography The difference between DeFi from traditional finance DeFi s most essential protocols and how do DeFi protocols make money The DeFi investor s guide What is precisely yield farming and why is it important How to be a high yield with crypto assets the innovative investor How to invest in DeFi with confidence It also explains the scams involving DeFi how to avoid them and how to contract auditing s role smartly Finally defining the future of DeFi incorporating NFTs and other evolving technologies Idealism Greed Lies and the Making of the First Big Cryptocurrency Craze The Cryptopians This book by Laura Shin takes readers behind the scenes of creating this new type of cryptocurrency network which allowed users to create their new coins and sparked a new wave of crypto fever in the process You ll meet people like Vitalik Buterin the wunderkind whose idea grew into a billion empire in five months Charles Hoskinson the project s first CEO who left after five months and Joe Lubin a former Goldman Sachs VP who became one of crypto s most well known billionaires after his early involvement in Bitcoin and Ethereum As these colossal egos battled for a share of an ostensibly boundless new commercial opportunity sparks flared This book tries to explain how cryptocurrency s fortunes rise and fall but those striving to bring it mainstream make and lose futures and careers on it Does this exciting book portray the cryptocurrency market for what it is And explains how it s a highly personal fight to shape the coming revolution in money culture and power The Fiat Standard The Debt Slavery Alternative to Human Civilisation This book by Economist Saifedean Ammous s most recent book is widely recognized as one of the classic publications on digital tokens It discussed Bitcoin s monetary theory the gold standard fiat currencies and contemporary financial reform thought His follow up book The Fiat Standard The Debt Slavery Alternative to Human Civilisation is due out in and looks at national currencies as a technology how debt underpins them and how governments manage and add to this debt at no cost Mr Ammous connects the work to our current circumstances by examining the influence of fiat on family food health education and security Finally he considers how fiat currency and Bitcoin could coexist in the future and what would happen if one of them fails Cashless China s Digital Currency Revolution This book by Richard Turrin explains China s interoperable cashless society as an example of how digital currencies are already being deployed In just seven years digital technology has completely altered the monetary system of the world s second largest economy with the central bank s digital currency playing a pivotal role CBDC Mr Turrin a financial insider who spent several years in Shanghai describes how the new CBDC is being utilized from street sellers to international monetary transactions while zooming out to see the ramifications for other nations including the danger to the US dollar s supremacy The Everything Guide to Investing in Cryptocurrency From Bitcoin to Ripple the Safe and Secure Way to Buy Trade and my Digital Currencies This is the finest book by Ryan Derousseau if you want to learn all there is to know about cryptocurrencies Does it clarify all crypto fundamentals and point to many basics like the difference between BTC and XRP How is mining carried out How to make a wallet and much more Derousseau isn t trying to persuade you to invest in cryptocurrency He goes into great detail on why you should stay away from cryptocurrencies If you determine that crypto is the appropriate investment for you he has some advice on navigating such a turbulent market and how to lock in your profits Finally Seeking the best books on crypto we decided that a crypto book list was necessary because crypto assets have become such a large alternative asset class Cryptocurrency has gotten a lot of press and there are now hundreds of websites dedicated to crypto related news and marketing As a result every man and his dog seems to have written a book about this fascinating topic Most of these publications try to strike a decent balance between factual knowledge and personal opinion in our opinion Based on the market movement thus far in it appears like the current decade is also shaping up to be an age of additional cryptocurrency increases Still the cryptocurrency industry always has its fair share of bearish and short sellers who do not anticipate this to happen Which side do you support Will cryptocurrencies gain more general acceptability and credibility or are we approaching peak crypto Originally written by Fawzan Hussain for Blockchain Works |
2022-03-23 15:10:54 |
海外TECH |
DEV Community |
Artificial Intelligence in Manufacturing: Industrial AI Use Cases |
https://dev.to/evgeniykrasnokutsky/artificial-intelligence-in-manufacturing-industrial-ai-use-cases-501j
|
Artificial Intelligence in Manufacturing Industrial AI Use CasesAmong large industrial companies believe AI produces better resultsーbut only have adopted it according to The AspenTech Industrial AI Research Domain expertise is essential for successful adoption of artificial intelligence in the manufacturing industry Together they form Industrial AI which uses machine learning algorithms in domain specific industrial applications Let s explore some of the important trends in artificial intelligence technologies in the manufacturing industry to get a clearer picture of what you can do to keep your business up to date Image credit AI IS A BROAD DOMAINFor all of the technologies that we ll discuss that have applications in manufacturing industries artificial intelligence is not the most accurate way to describe them AI is a very broad subject that has many different methods and techniques that fall under its scope Robotics natural language processing machine learning computer vision and more are all different techniques that deserve a great deal of attention all on their own With that said and done let s move on to talk about the many applications of artificial intelligence in the manufacturing industry THE GOAL OF AI IN MANUFACTURINGArtificial intelligence studies ways that machines can process information and make decisions without human intervention A popular way to think about this is that the goal of AI is to mimic the way that humans think but this isn t necessarily the case Although humans are much more efficient at performing certain tasks they aren t perfect The best kind of AI is the kind that can think and make decisions rationally and accurately Probably the best example of this is that humans are not well equipped to process data and the complex patterns that appear within large datasets However an AI can easily sort through sensor data of a manufacturing machine and pick out outliers in the data that clearly indicate that the machine will require maintenance in the next several weeks AI can do this in a fraction of the time that a human would spend analyzing the data Robotics The Keystone of Modern ManufacturingMany if not most applications of artificial intelligence involve software instead of hardware However robotics is primarily focused on highly specialized hardware The manufacturing industry utilizes this technology a great deal for many different types of applications According to Global Market Insights Inc the industrial robotics market is forecasted to be worth more than billion by In many factories such as Japan s Fanuc plant the robot to human ratio is about This shows that it s possible to automate a great deal of a factory to reduce product cost protect human workers and achieve higher efficiency Industrial robotics requires very precise hardware and most importantly artificial intelligence software that can help the robot perform its tasks correctly These machines are extremely specialized and are not in the business of making decisions They can operate supervised by human technicians or they can be unsupervised Since they make fewer mistakes than humans the overall efficiency of a factory improves greatly when augmented by robotics When artificial intelligence is paired with industrial robotics machines can automate tasks such as material handling assembly and even inspection ROBOTIC PROCESSING AUTOMATIONA term that often gets thrown around related to artificial intelligence and robotics is robotic processing automation However it s important to note that this is not related to hardware machinery and is instead related to software Robotic processing automation is all about automating tasks for software not hardware It applies the principles of assembly line robots to software applications such as data extraction form completion file migration and processing and more Although these tasks play less overt roles in manufacturing they still play a significant role in inventory management and other business tasks This is even more important if the products you are producing require software installations on each unit Computer Vision AI Powering Visual InspectionWithin the manufacturing industry quality control is the most important use case for artificial intelligence Even industrial robots can make mistakes Although these are much more infrequent than humans it can be costly to allow defective products to roll off the assembly line and ship to consumers Humans can manually watch assembly lines and catch defective products but no matter how attentive they are some defective products will always slip through the cracks Instead artificial intelligence can benefit the manufacturing process by inspecting products for us Using hardware like cameras and IoT sensors products can be analyzed by AI software to detect defects automatically The computer can then make decisions on what to do with defective products automatically In the video below you can learn more about MobiDev s approach to AI based visual inspection system development Natural Language Processing Improving Issue Report EfficiencyChatbots powered by natural language processing are an important AI trend in manufacturing that can help make factory issue reporting and help requests more efficient This is a domain of AI that specializes in emulating natural human conversation If workers are able to use devices to communicate and report the issues and questions they have to chatbots artificial intelligence can help them file proficient reports more quickly in an easy to interpret format This makes workers more accountable and reduces the load for both workers and supervisors WEB SCRAPINGManufacturers can leverage NLP for better understanding of data gained with the help of a task called web scraping AI can scan online sources for relevant industry benchmark information as well as costs for transportation fuel and labor This can help optimize the entire business s operations EMOTIONAL MAPPINGMachines are far behind humans when it comes to emotional communication It s very difficult for a computer to understand the context of a user s emotional inflection However natural language processing is improving this area through emotional mapping This opens up a wide variety of possibilities for computers to understand the sentiments of customers and feelings of operators Machine Learning Neural Networks and Deep LearningThese three technologies are artificial intelligence techniques utilized in the manufacturing industry for many different solutions Machine Learning an artificial intelligence technique where an algorithm learns from training data to make decisions and recognize patterns in collected real world data Neural Networks using artificial neurons neural networks receive input in an input layer That input is passed to a hidden layer that assigns weight to the input and directs this to the output layer Deep Learning a method of applying machine learning where the software emulates the human brain just like a neural network but information passes from one layer to the next for higher processing Machine learning is a huge trend in manufacturing and we have an entire blog post about machine learning s applications in the manufacturing industry that you should read if you are interested in how ML is fundamentally changing the way that manufacturing operates Future of AI in ManufacturingWhat comes next for artificial intelligence s role in manufacturing There are many thoughts about this some coming from the realm of science fiction and others as extensions of technologies that are already being utilized The most immediate noticeable evolution will be an increased focus on data collection Artificial intelligence technologies and techniques that are being employed in the manufacturing sector can only do so much on their own As Industrial Internet of Things devices increase in popularity use and effectiveness more data can be collected that can be used by AI platforms to improve various tasks in manufacturing However as advances in AI take place over time we may see the rise of completely automated factories product designs made automatically with little to no human supervision and more However we will never reach this point unless we continue the trend of innovation All it takes is an idea It could be a unification of technologies or using a technology in a new use case Those innovations are what transform the manufacturing market landscape and help businesses stand out from the rest |
2022-03-23 15:10:26 |
海外TECH |
DEV Community |
Create a Distortion Effect Using GSAP |
https://dev.to/workshub/create-a-distortion-effect-using-gsap-40h5
|
Create a Distortion Effect Using GSAPAnimating DOM elements on the web has been one of the many topics with numerous solutions We have seen the rise of HTML and CSS classic design systems and how to structure keyframe animations accordingly Then we transitioned into using javascript libraries like jQuery only to now be trumped by more efficient and performant libraries one of which is GSAP IntroductionGSAP GreenSock Animation Platform as indicated by the Getting Started guide “is a suite of tools for scripted animations What that basically means is that it is one big ecosystem of ready made functions and methods you can use to animate literally anything on the DOM What makes GSAP so great is that it is fully optimized for performance and scaling even when building complex animation This is what makes it trump over jQuery as well as its minimal code style in contrast to jQuery s robust syntax What will we be building In this article you will learn how to build a cool looking webpage with a distortion effect that gets triggered on hover using GSAP and hover effect library This example will help us shorten the learning curve with GSAP Credits go to UI Designer Maxim Nilov DribbbleGithub codicts Fashion Landing Page github com PrerequisitesGSAP is a suite that makes rendering on the DOM a lot easier and this is made possible by using a few key concepts that are related to DOM manipulation much like every other framework for the web To this end you will need to know HTML CSS and JavascriptBasic React How does GSAP work GSAP has built in components to help create these animations and they come with methods that help us set the properties we want to animate For this example we will only need one of these components which is the TweenMax Please check out their docs TweenMaxThe Tween and TweenMax components are one of the more widely used ones in that they make it easy to do the simple transitions without writing complex keyframes The tween keyword is derived from between which basically means “change this property between a given duration from one value to another Let s take a look at some of the methods that exists within GSAP gsap to gsap from gsap staggerFrom gsap to Here we tell gsap to change the property of a given value to another as well but in this case we indicate the starting value of the animation Here s an example gsap from logo duration x Gsap staggerFrom Now staggerFrom works a bit differently from gsap to and gsap from With to and from we deal with a single HTML element that we want to animate but what if we want to animate a group of elements particularly children of a parent element With staggerFrom we can set an animation to take effect for a group of child elements and even set an interval or “stagger between the elements to give it this sequential feel as they get animated Here s an example of using this TweenMax staggerFrom media ul li TweenMax used in place of gsap delay opacity x ease Expo easeInOut First we call the gsap library TweenMax then we can use the “staggerFrom method to target the HTML lt li gt elements under the media class The value is used to indicate the stagger to be affected between the start time of each child s animation This stagger is what helps the animations to have a sequential feel between them Then we put in the properties we want for each element Note the ease property which you can learn more about in their documentation Getting Started with GSAPNow let s get started with building our distortion effect page Create your folder and in that new folder create your HTML and CSS files Then in your HTML file you set up your basic HTML markup lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset UTF gt lt meta http equiv X UA Compatible content IE edge gt lt meta name viewport content width device width initial scale gt lt title gt Document lt title gt lt head gt lt body gt lt body gt lt html gt Next our imports lt google fonts gt lt link href amp display swap rel stylesheet gt lt css gt lt link rel stylesheet href style css gt Then our scripts as well for GSAP and hover effect these go on the bottom of the html page lt icons gt lt script src dist ionicons js gt lt script gt lt gsap gt lt script src integrity sha lPEwjNaABWHbGz MKBJaykyzqCbUBJWjioU crossorigin anonymous gt lt script gt lt three js gt lt script src integrity sha mBEXIuMLF AUjJeTCelosuorzYpqwBMBPDTyQqY crossorigin anonymous gt lt script gt Now we are set to get started with our web page You can set up the views to your convenience but for this tutorial we will first set up the main webpage lt NAVBAR gt lt nav class navbar gt lt div class menu gt lt ion icon name ios menu gt lt ion icon gt lt div gt lt div class lang gt eng lt div gt lt div class search gt lt ion icon name ios search gt lt ion icon gt lt div gt lt nav gt lt SOCIAL MEDIA gt lt div class media gt lt ul gt lt li gt facebook lt li gt lt li gt instagram lt li gt lt li gt twitter lt li gt lt ul gt lt div gt lt TEXT gt lt div class text gt lt h gt lt span class hidetext gt toni amp guy lt span gt lt h gt lt h gt duality lt h gt lt h gt lt span class hidetext gt collection lt br gt duality lt span gt lt h gt lt p gt lt span class hidetext gt Lorem ipsum dolor sit amet consectetur adipisicing elit Unde quis delectus facere neque sunt commodi quae culpa dolores doloribus magnam lt span gt lt p gt lt div gt lt SPONSOR gt lt div class sponsor gt lt img src images sponsor logo png alt gt lt p gt official sponsor lt p gt lt div gt Then the CSS for the basic webpage margin padding box sizing border box body font family Poppins background DDBE width height vh overflow hidden ul list style none NAVBAR navbar display flex justify content space between height px align items center navbar gt div padding px font size px navbar menu margin right auto navbar lang font size px font weight text transform uppercase SOCIAL MEDIA media ul position absolute bottom px left px transform rotate deg media ul li font size px font weight letter spacing px display inline block padding px TEXT text position absolute top px left px transform rotate deg text h font size px text transform uppercase font weight letter spacing px margin bottom px position relative overflow hidden height px width px text h hidetext position absolute text h position absolute top px left px color EFDE z index font size px font weight letter spacing px text transform uppercase text h font size px text transform uppercase font weight line height position relative overflow hidden height px text h hidetext position absolute text p width px font size px margin top px font weight position relative overflow hidden height px text p hidetext position absolute SPONSOR sponsor position absolute right px bottom px text align center sponsor img width px transform rotate deg sponsor p margin top px font size px text transform uppercase font weight transform rotate deg Let s examine our webpage Here are a few things we can see squares animate from bottom to top to reveal the webpage Here we already know they will be divs to have a position absolute and then we use the “to method to animate between them Navbar above animate from top to bottom with changed opacity Text on the side changes from to and increases in height For the squares we create divs to represent them lt div class overlay first gt lt div gt lt div class overlay second gt lt div gt lt div class overlay third gt lt div gt Then we style accordingly in the styles css OVERLAY overlay position absolute width height top z index first background efde second background efde left third background efde left Now we can set up our animation with GSAP TweenMax to first delay top ease Expo easeInOut TweenMax to second delay top ease Expo easeInOut TweenMax to third delay top ease Expo easeInOut Notice that the delay has been varied by to have that effect You could also use the staggerFrom method to vary between the children and see how the effect varies Next we animate our navbar and various texts Here s a few things we can see squares animate from bottom to top to reveal the webpage Here we already know they will be divs to have a position absolute and then we use the “to method to animate between them Navbar above animate from top to bottom with changed opacity Text on the side changes from to and increases in height For the squares we create divs to represent them Then we style accordingly in the styles css OVERLAY overlay position absolute width height top z index first background efde second background efde left third background efde left Now we can set up our animation with GSAP TweenMax to first delay top ease Expo easeInOut TweenMax to second delay top ease Expo easeInOut TweenMax to third delay top ease Expo easeInOut Notice that the delay has been varied by to have that effect You could also use the staggerFrom method to vary between the children and see how the effect varies Next we animate our navbar and various texts NAVBAR TweenMax staggerFrom navbar div delay opacity y ease Expo easeInOut MEDIATweenMax staggerFrom media ul li delay opacity x ease Expo easeInOut TEXTTweenMax from text h hidetext delay y ease Expo easeInOut TweenMax from text h hidetext delay y ease Expo easeInOut TweenMax from text p hidetext delay y ease Expo easeInOut TweenMax from text h delay opacity x ease Expo easeInOut SPONSORTweenMax from sponsor img delay opacity y ease Expo easeInOut TweenMax from sponsor p delay opacity y ease Expo easeInOut Lastly for the distortion effect we will make use of the hover effect library You can get the hover effect library here then copy the code create a new file called hover effect umd js and paste the code Then we import our newly created script lt hover effect js gt Now how our distortion effect works is that the library will create a blur of the current image then transition into a displacement image we will need to provide then lastly transition to a blurred version of the second image to be transitioned into and then set the image from a blurred state to a regular state So first we create a div which will represent our distortion image container lt DISTORTION gt So we need to provide a displacement image which should look like a blur effect for convenience and then the two images to transition between new hoverEffect parent document querySelector distortion intensity image images png image images png displacementImage images diss png imagesRatio And that puts together the distortion effect with some animation Thanks for reading NAVBAR TweenMax staggerFrom navbar div delay opacity y ease Expo easeInOut MEDIA TweenMax staggerFrom media ul li delay opacity x ease Expo easeInOut TEXT TweenMax from text h hidetext delay y ease Expo easeInOut TweenMax from text h hidetext delay y ease Expo easeInOut TweenMax from text p hidetext delay y ease Expo easeInOut TweenMax from text h delay opacity x ease Expo easeInOut SPONSOR TweenMax from sponsor img delay opacity y ease Expo easeInOut TweenMax from sponsor p delay opacity y ease Expo easeInOut Lastly for the distortion effect we will make use of the hover effect library You can get the hover effect library here then copy the code create a new file called hover effect umd js and paste the code Then we import our newly created script lt hover effect js gt lt script src hover effect umd js gt lt script gt Now how our distortion effect works is that the library will create a blur of the current image then transition into a displacement image we will need to provide then lastly transition to a blurred version of the second image to be transitioned into and then set the image from a blurred state to a regular state So first we create a div that will represent our distortion image container lt DISTORTION gt lt div class distortion gt lt div gt So we need to provide a displacement image which should look like a blur effect for convenience and then the two images to transition between new hoverEffect parent document querySelector distortion intensity image images png image images png displacementImage images diss png imagesRatio And that puts together the distortion effect with some animation Thanks for reading Originally written by King Somto for JavaScript Works |
2022-03-23 15:10:26 |
海外TECH |
DEV Community |
A Complete Beginner's Guide to useEffect Hook [Part 3] |
https://dev.to/workshub/a-complete-beginners-guide-to-useeffect-hook-part-3-50o0
|
A Complete Beginner x s Guide to useEffect Hook Part IntroductionuseEffect is a React Hook that is used to handle side effects in React functional components Introduced in late October it provides a single API to handle componentDidMount componentDidUnmount componentDidUpdate as what was previously done in class based React components What is useEffect Hook According to React s official doc The Effect Hook useEffect adds the ability to perform side effects from a functional component But what are these side effects that we are talking about Well it means we need to do something after the component renders such as data fetching changes to the DOM network requests These kinds of operation are called effects and can be done using the useEffect hook A useEffect hook takes in two parameters a callback function and a dependency array respectively const callbackFunction gt dependencyArray value value value useEffect callbackFunction dependencyArray Or quite simply the above can be summed together and usually what we see in codebases useEffect gt value value value useEffect in action Suppose we have a counter button that increases the count by when clicked function App const count setCount React useState return lt div gt lt p gt count lt p gt lt button onClick gt setCount count gt click lt button gt lt div gt ReactDOM render lt App gt document getElementById root What if I want this count value to get dynamically reflected on the page title i e next to the favicon icon for every button click Now this does sound like we have to handle an effect triggered by the component hence a perfect use case for the useEffect hook Let s import useEffect at the top and call the hook inside the component just as we did for useState hook useEffect takes in two arguments a callback function to trigger and a dependency array which we will about later in this post function App const count setCount React useState React useEffect gt document title count return lt div gt lt p gt count lt p gt lt button onClick gt setCount count gt Increment lt button gt lt div gt ReactDOM render lt App gt document getElementById root Here s how the above React component will behave The App functional component will return the HTML and render it to the screen with an initial count of set by the useState hook Immediately the useEffect hook runs asynchronously and sets the document title to the initial count i e The rule of thumb is whenever something inside the component changes say click of a button the App component will re render itself with an updated value Suppose we click the increment button setting the count value from to It will force the App component to re render now with the updated value useEffect will run asynchronously setting the title to the updated value of count that is Adapting to Correct Mental Model While the useEffect hook seems easy to implement when working with isolated demo components it is highly likely to run into issues when dealing with large codebases The reason being poor understanding of underlying concepts and continuous comparison with class based React lifecycle methods Back in the day when we were using class based components no issues if you haven t the component side effects were handled using Lifecycle Methods and useEffect hook somewhat does the same thing what componentDidMount componentDidUpdate and componentWillUnmount APIs did in Lifecycle methods but they do differ in how the things get handled Applying Lifecycle s mental model to hooks could result in unnecessary amp unexpected behaviour To truly grasp useEffect we have to unlearn the lifecycle way of doing things as quoted by Dan Abramov It s only after I stopped looking at the useEffect Hook through the prism of the familiar class lifecycle methods that everything came together for me Let s create a class based component first class App extends React Component state name componentDidMount setTimeout gt console log MOUNT this state name render return lt div gt lt input value this state name onChange event gt this setState name event target value gt lt div gt As you can see the console message fires after s what if in between those seconds we type something to the lt input gt field Will the componentDidMount print empty this state name or would it capture the latest value from the input component The answer is it would capture the latest value the reason being how lifecycle methods work in a class based component render method creates a DOM node gt componentDidMount is called gt State is updated gt DOM is re rendered fetching the latest value from state Now if we translate the same code to a hook based functional component it works totally different The functional component returns a HTML node making initial state value to be empty on the very first mount useLayoutEffect is another hook that can replicate the class based example more accurately Kent C Dodds explains very well when to use each in this postPlay around with the code here here Dependency Array The second parameter for useEffect is a dependency array It is an array of all the values on which the side effect should run trigger itself For example let s see this counter component where when a button is clicked the count value increments by with the help of useState hook function App const count setCount React useState React useEffect gt console log Running Effect handleChange gt setCount prev gt prev return lt div gt console log COMPONENT RE RENDER lt h gt Hello lt h gt lt button onClick handleChange gt click lt button gt lt div gt ReactDOM render lt App gt document getElementById root Now what can we learn from the above example As we can notice there is an useEffect hook with no second argument This would result in re rendering of the App component whenever a value inside changes in this case the count value is changing Hence for every button click the component will keep on re rendering itself printing COMPONENT RE RENDER to the console How do we prevent this By adding a second argument to the useEffect hook function App const count setCount React useState React useEffect gt console log Running Effect handleChange gt setCount prev gt prev return lt div gt console log COMPONENT RE RENDER lt h gt Hello lt h gt lt button onClick handleChange gt click lt button gt lt div gt At the very first mount we will see both the logs to the console Running EffectCOMPONENT RE RENDERBut this time as we click on the button there won t be any log from the useEffect hook as the empty array makes sure to run it just once and all the subsequent logs will be from AppRunning EffectCOMPONENT RE RENDERCOMPONENT RE RENDER keep logging as many times as the button clicksLet s go a step further and try filling in the dependency array list with count value as React useEffect gt console log Running Effect count This time things get interesting as it logs both the console text Running EffectCOMPONENT RE RENDERRunning EffectCOMPONENT RE RENDER keep logging both the text for button clicksThe first text Running Effect is rendered as the effect is triggered whenever the array item modifies count as mentioned there and it does for button clicks while the second text COMPONENT RE RENDER is very much expected as the value inside the component itself is changing so naturally it has to re render to update the DOM with the latest value codepen Incorrect Dependency Array It is worth mentioning that incorrect use of dependency array items could lead to issues that are harder to debug React team strongly advises to always fill in items in the array and not to leave them out There is a very helpful exhaustive deps ESlint rule which helps us in issues such as stale closure which might be due to incorrect dependency or even several other reasons and helps us auto fix it Read more in depth about the announcement here useEffect with cleanup function As we have read earlier in this post useEffect expects either an undefined or an optional cleanup function as its return value A Cleanup function can be thought of as a way to clear out the side effects when the component unmounts useEffect gt side effect logic here cleanup functionreturn gt logic Let s see cleanup function into action into a very contrived example below function App const number setNumber useState useEffect gt console log number is number return gt console log running cleanup function number return lt div className App gt lt input type number value number onChange e gt setNumber e target value gt lt p gt number lt p gt lt div gt A Cleanup function is used in a very small number of use cases such as clearing out timers cleaning unnecessary event listeners unsubscribing to a post etc If not sanitized properly they could lead to something called a Memory leak in JavaScript Batching multiple useEffects What s best putting different side effect into one useEffect hook or in multiple Honestly it depends on the use case and how we are interacting with various components One important thing to note here is that react will apply effect in the order they were written in case we have multiple useEffect hooks It is perfectly fine to do this in a single component useEffect gt Second side effect useEffect gt First side effect Conceptual Pitfalls to Avoid useEffect hook does not truly mimic the componentDidMount lifecycle method Same goes for componentDidMount amp componentDidUpdate While the end result might look similar when implementing the order in which they are called and mounted is very distinctive as we ve already discussed in the above point The useEffect hook expects us to return a cleanup function to unmount clear the side effects after a certain condition has been fulfilled if not provided it returns undefined We have to make sure not to return anything else when dealing with an async function as an asynchronous function returns a promise The following code is wrong as it returns an unexpected promise from useEffect Hookconst App gt useEffect async gt const unsubsribe await subscriberFunction return gt unsubscribe return lt div gt lt div gt Now there are various ways to deal with an async function inside a useEffect hook we can use IIFE style technique such as const App gt useEffect gt async function subscriberFunction await fetchIds subscriberFunction return lt div gt lt div gt The order in which useEffect has been specified in a component matters while invoking Wrapping Up React useEffect hook deviates itself from the class based lifecycle approach It takes time and practice to grasp useEffect s best patterns and foundational concepts which when used correctly can prove to be incredibly powerful for handling side effects in React Applications Some Important Resources that I have collected over time Loved this post Have a suggestion or just want to say hi Reach out to me on Twitter Originally written by Abhinav Anshul for Blockchain Works |
2022-03-23 15:10:06 |
海外TECH |
DEV Community |
Building with React Context Provider Pattern |
https://dev.to/workshub/building-with-react-context-provider-pattern-315k
|
Building with React Context Provider Pattern IntroductionIn this article we will be going through the use of the React Context Providers in building React applications React uses the Context provider to share data across multiple children components in our React App without the need to pass data or functions across multiple components however it comes in handy when building applications with lots of dependencies and moving parts What is React Context APIAccording to the gospel or the React Docs in the book of Context it defines the context as “a way of passing data through the component tree without having to pass props down manually at every level React applications let parent components pass data long to children components but issues arise when that data is meant to be used by children components multiple layers deep but not by immediate children of that parent component Let s look at the diagram below Component A is clearly the main parent component with immediate children components B C D these components can receive params from component A and pass that data to the children components but what about a scenario where Component F needs data from component A and that data is not needed in component B then passing that data to component B becomes redundant Contex providers provide a cool way of making data readily available to every single child component in the React Application What is it used for Context API provides a way of sharing data with multiple components throughout our React Application this enables us to be creative in how we manage our application state in things likeAuthentication Knowing when a user is logged in or has an active user session or just hold user dataNotifications I normally use a Notification provider to expose a notification alert function to components in my application Theming A cool use of this is controlling night mode in applications look at a cool implementation of that hereLoading of data at start of the application React Context Provider exampleThis is a simple example of a React context Provider import React Component createContext useContext from react export const RandomContext createContext user null class RandomProvider extends Component state user Somto render return this props children const ComponentTest gt const user useContext RandomContext return user export default gt return The user Variable would contain the value Somto Adding useState to React Context Combining useState with react context helps to add extra functionality to our React app now components can interact and change the data present in the Context Provider and these changes can be seen in the entire app Building an example applicationFor our example application we are going to build a Simple React counter where we would be able to increase and decrease the value of a number stored in the Context this would be done by different components by accessing the usestate set Function to change the value Step Build and export the context providerLet s look at the example below of our new Context Provider jsimport React Component createContext useContext from react const CountContext createContext count setCount gt const CountProvider children gt const count setCount React useState return lt CountContext Provider value count setCount gt lt p gt count lt p gt children lt CountContext Provider gt export const useCountContext gt useContext CountContext export default CountProvider Let s break this down const CountContext createContext count setCount gt This part of the code is used to create a context to contain the count variable and the setCount function that would be available throughout the children component const count setCount React useState This initiates our useState variables return lt CountContext Provider value count setCount gt lt p gt count lt p gt children lt CountContext Provider gt Here we return our ContextProvider pass in the values variable and pass the children props variable as its own children export const useCountContext gt useContext CountContext export default CountProvider Export both the UserCountContext and the Context Provider Itself Step Using our provider and calling the setCount import styles css import React useContext from react import ReactDOM from react dom import CountProvider useCountContext from provider const Component gt const count setCount useCountContext return lt div gt lt button onClick e gt setCount count gt Add lt button gt lt button onClick e gt setCount count gt Subtract lt button gt lt div gt ReactDOM render lt CountProvider gt lt Component gt lt Component gt lt CountProvider gt document getElementById app ConclusionReact context provider offers a way of maintaining state globally across our application we can read and edit that state in any component we choose to without passing dependencies in through the tree hierarchy A working example of this code is available hereOriginally written by King Somto for JavaScript Works |
2022-03-23 15:09:31 |
海外TECH |
DEV Community |
Leetcode Daily Challenge - Broken Calculator |
https://dev.to/alimalim77/leetcode-daily-challenge-broken-calculator-11gm
|
Leetcode Daily Challenge Broken CalculatorToday s challenge on Leetcode in based on a Maths Greedy Problem It is a medium level problem and sounds easy but may leave you scratching your head in terms of an optimal solution Broken CalculatorProblem StatementThere is a broken calculator that has the integer startValue on its display initially In one operation you can multiply the number on display by orsubtract from the number on display Given two integers startValue and target return the minimum number of operations needed to display target on the calculatorInput startValue target Output Explanation Use double operation and then decrement operation gt gt Thought Process The immediate thought striking your mind would be to increase the startValue using operator in case of a smaller startValue or decrease it by subtracting to make it equal to target and count the steps we took in our journey It can lead to errors so the desired method is to do the otherwise backward approach To reduce the target using the exact opposite operators of division and subtraction to count the occurrences of operations In case target becomes lesser than startValue we will increment until the startValue and return the difference along with the actual counter Confused about this step proceed further and understand LogicThe approach is simple we declare a counter and run a loop which is terminated once our target value is no more greater than the startValue In case our target is odd we increment the value of target by else we will divide the target value into half Eventually once the loop is terminated we will return the summation count of times the loop ran and the difference between the startValue and target Difference between startValue and target will be decremented on other side of startValue to make it equal to the target along with the counter that ran along the loop CodeIn case you are looking to learn practice Python from scratch or want to practice DSA then do checkout my YouTube Channel for free lectures and code along sessions Code Broski Click here to redirect to Python Fundamentals playlist |
2022-03-23 15:04:33 |
海外TECH |
DEV Community |
11 Key Challenges & Solutions Of Mobile App Testing |
https://dev.to/rileenasanyal/11-key-challenges-solutions-of-mobile-app-testing-1cac
|
Key Challenges amp Solutions Of Mobile App TestingOver the last decade the usage of mobile devices has skyrocketed globally According to Statista s predictions the number of smartphone users will surpass billion in Hence it is not hard to envision the enormous mobile app testing challenges that the current and future backend teams will be dealing with Due to the surge in mobile devices the demand for mobile applications has escalated worldwide This has led to large organizations investing heavily in this domain thereby increasing the need for a more conducive mobile device cloud testing solution In this article on mobile app testing challenges and solutions we will explore the top mobile app testing challenges that riddle technical teams worldwide key mobile app testing challengesMobile app testing is definitely not an easy task It requires a lot of effort and time to test applications on all platforms There are various approaches to mobile app testing but the most important thing for every developer is to build the best quality product that will meet users expectations The main problem for testers is that there are lots of different ways to test apps Each approach has its pros and cons which can be tricky to determine in advance So let s take a closer look at the main challenges faced by mobile app testers Too many devices globally billion smartphones were sold worldwide in and billion so far in The numbers make it easy for us to guess the variety of mobile devices being used on the world forum However this creates trouble for the testing team since applications are expected to run smoothly on most such devices Hence each app has to be compatible with most of the mobile variants present worldwide To ensure an app will work on all or most devices an organization requires an extensive infrastructure consisting of mobile app testing solutions and a physical hub of popular devices As a whole it can pose a considerable investment ordeal that early age startups may not be prepared for Device fragmentationDevice fragmentation is one of the leading mobile app testing challenges since the number of active devices running an app at any given time increases every year This can pose a significant compatibility issue since testing teams have to ensure these applications can not only be deployed across different operating systems like Android iOS Windows etc but also across various versions of the same operating system like iOS X and X However you can overcome this challenge by using a cloud based mobile app testing solution A cloud based mobile app testing interface makes it easier to Upload the app with just one click Test the app on numerous Android emulators and iOS simulators Monitor the quality of the apps Rely on the cloud to make speedy deliveries and more Now you can test on mobile emulator for browser testing that too free Different screen sizesCompanies across the globe design smartphones of varying screen specifications Multiple variants of the same model have different resolutions and screen sizes to attract a broader range of consumers Hence there is a requirement for apps to be developed in conjunction with every new screen specification released in the market The screen size affects the way an application will appear on different devices It is one of the most complicated mobile app testing challenges since developers must now concentrate on its adaptability to various mobile screens This includes resizing the apps and adjusting to multiple screen resolutions to maintain consistency across all devices This might turn out to be a challenge unless an application is thoroughly tested Numerous types of mobile applicationsMobile app development is a great way to increase your brand s visibility bring in new customers and provide a better user experience for current customers With that in mind let s take a look at the three main types of mobile apps native web and hybrid Native apps Native mobile applications are those built for one specific operating system Hence apps built for iOS do not work on Android or other OS and vice versa Native applications are fast provide better phone specific features and have higher efficiency Here the mobile app testing challenges include ensuring such qualities are preserved and all features are compatible with the native UI of the device Web apps Web applications are much like native apps except users need not explicitly download the former Instead these apps are embedded within the website that users can access through web browsers on their phones Web apps are thus expected to provide excellent performance on all devices To ensure that they do testing teams have to thoroughly check the app on a large variety of models However this is not only a time consuming procedure but is also critical since failure to work on a few devices can significantly bring down the company s business revenues Hybrid apps Hybrid apps have the facilities of both web and native apps They are essentially web applications that have been designed like the native ones Such apps can be maintained easily and have a short loading time Mobile app testing teams are responsible for ensuring hybrid applications do not lag on some devices All their features are available on all operating systems with the capability to support said features Each type of mobile application poses a different kind of challenge for the technical teams When concatenated the complexity increases manifold thereby making it a cumbersome process in totality Testing mobile applications by automating repeated regression tests might ease the stress a little Mobile network bandwidthMobile network bandwidth testing is a significant part of mobile app testing Users expect high speed mobile applications that the backend team must ensure But that is not all An application that fumbles to produce faster results also performs poorly in terms of data communication An app that is not tested and optimized to suit the bandwidth of a variety of users will lag during the exchange of information between the end user and the server Therefore the testing team should ideally test their apps and mobile websites in various network conditions to understand their response time in each case This shall make the process a lot more efficient and the app much more sustainable Mercurial user expectationsUsers across the globe expect different things from their smartphones Companies comply by providing variations to attract their target audience With variations in models come expectations as to what various applications running on these devices should do and how Users have high demands from the apps they use They are constantly asking for new updates to make things easier for them For example users might want a separate button for their favorite feature at the top of the app s home screen display As application developers tech teams cannot help but bury their heads deep into giving their consumers what they want to ensure the user experience is stellar and business is on track This process however keeps the testing team on their toes and might tend to elongate the mobile app testing procedure in several cases Seamless user experienceThe success of an application depends mainly on how creative contextually specific and well defined the user interface is On the other hand ensuring an app has all the required features might make it bulky and slow Moreover the application runs a risk of working exceptionally well on some devices and not on others This would mean poor consistency and might hinder users from shifting devices when required Such things bring the user experience down A consumer has no patience to understand developer deadlines and testing complexities Hence the mobile app testing teams are always racing against time and other odds to ensure the user experience is not compromised This can become a significant challenge unless the right cloud based mobile app testing strategy is in place mainly because poor user experience deteriorates the company s credibility Security concernsSecurity concerns are a huge roadblock for the mobile app testing team Although private cloud based mobile app testing tools like LambdaTest are secure there are several concerns that app developers regularly face Easier access to the cache Mobile devices are more prone to breaches since it is simpler to access the cache Suspicious programs can therefore find easy routes to private information through mobile applications unless built and tested to nullify the vulnerabilities Poor encryption Encryptions are the first walls between user data and malignant sources Poor or no encryption in mobile applications can attract hackers like a moth to the flame The initial half of witnessed data breaches that disclosed billion records Therefore developers must build apps with more robust encryption coding and then the app testing team to ensure the encryption works well The process is one of the most crucial mobile app testing challenges since relevant teams have to run all possible test cases to ensure the application is going from the encryption side A cloud based cross device testing solution like LambdaTest which is GDPR ISO CCPA and SOC compliant can help QA testers to run their tests on the cloud to assure accuracy and proximity to real users conditions Strict deadlinesUser demands are often overbearing making companies run on a strict schedule to deliver apps Patchwork bug fixes and upgrades are other requirements that keep developer and testing teams on their toes All of this requires constant and fast mobile app testing procedures Given the complexity of testing mobile apps which includes testing not only on mobile app emulators and simulators but also on the available physical devices testing teams are often in a fix when it comes to deadlines More often than not the strict schedules make it difficult for the technical team to perform extensive tests Heavy battery usageMobile app testing involves testing for heavy battery usage This is challenging because a truly diverse application should run on almost any battery without draining the device Unfortunately the last few years witnessed a surge in apps that are hard on the battery To deal with this mobile manufacturing companies across the globe started providing stronger batteries However user dissatisfaction cannot be neglected in the case of apps that still seem to drain their batteries considerably One of the significant mobile app testing challenges is testing apps to see they are not drawing power even heavy Minimizing battery drainage is of utmost importance to ensure a stellar user experience Too many app testing toolsThere is a wide range of cloud based mobile app testing tools not built from a one size fits all perspective There are separate tools for the different kinds of applications some more which only test Android apps and others that check the ones for iOS There is no shortage of platforms and tools that test applications of all specifications However rather than being helpful they often make the process more complicated For example technical teams might find it confusing to select the perfect platform to test most of their apps if not all In addition subscribing to the many such paid software can be heavy on the company s budget while relying on free tools can invite other troubles like data breaches and below par results Overcoming mobile app testing challengesThe main issue with testing mobile apps is the limited availability of real devices for testing purposes Here are a few solutions to help you overcome the above mobile app testing challenges Mobile emulators Android and iOS Emulators are often used for speedy and cost effective mobile app testing but they don t always provide reliable test results The whole point of using an emulator is to run the software without actually installing it on a real device The mobile app emulators can be installed on your development machine and after that any number of tests can be run on the emulator without the need to install it on a real device Mobile emulators will never replace real devices but they provide a good way of running initial tests without dealing with all the hardware and OS differences among real devices You should also remember that emulators can never recreate all the features of a real device such as touch gestures accelerometer etc However it s better to understand the emulator vs simulator difference in detail before deciding which to choose Using standard protocols common to all devicesOne way to decrease the complexity of the mobile app testing process is to adhere first to the protocols common to all devices This can include features like GPS camera audio and video etc Prioritizing procedures like localization and internalization testing help users operate their apps better irrespective of where and what they are doing Once the standard tests are performed tests specific to the operating system or its different versions can be conducted Leverage cloud based platform for mobile app testingFor companies with stringent app testing requirements it might be good to set up an infrastructure to support the demands For example a physical lab consisting of mobile devices of various specifications and a cloud based mobile app testing system can together form a robust combination ideal for in house testing Otherwise mobile device cloud testing platforms like LambdaTest can be approached to help with the procedure LambdaTest is a cloud based cross browser testing tool that utilizes emulators and simulators to provide accurate app performance reports You can use iOS simulators for app testing now that too free LambdaTest provides you with a wide range of Android emulators and iOS and simulators that help you test and release bug free and performant apps Moreover you can upload your application s APK App or ZIP file in one click directly from the LambdaTest platform Here s a short glimpse of cloud based mobile app testing offered by LambdaTest ConclusionThe above article aimed to provide a holistic view of the top mobile app testing challenges that technical teams across the globe encounter We have also tried to explore the essential solutions to deal with the issues However readers need to remember that each challenge is unique to the team that experiences it Hence it is best to keep investigating and seeking help wherever necessary We have also seen how we can leverage cloud based mobile app testing tools like LambdaTest to overcome the challenges of mobile app testing |
2022-03-23 15:03:23 |
海外TECH |
DEV Community |
Figma + Flutter Complex Fills, Drop Shadows, SVGs and Borders - parabeac_core v2.5 |
https://dev.to/parabeac/figma-flutter-complex-fills-drop-shadows-svgs-and-borders-parabeaccore-v25-f8i
|
Figma Flutter Complex Fills Drop Shadows SVGs and Borders parabeac core vAs parabeac core matures as a continuous Figma to Flutter generator we wanted to add more robust support for styling In the latest release parabeac core v we did exactly that Some of the support we added were Complex Fill SupportMixed Solid ColorImageLinear GradientsRectangle and Text Drop Shadow SupportBorder SupportBorder RadiusBorder ThicknessBorder ColorImage Vectors map to SVGLet s walk through how some of this works If you d like to test any of this out feel free to duplicate this Figma file Complex Fill Support Mixed ColorRemember in grade school when the teacher asked you to mix colors to make a new color Well that s exactly what we added support for in Figma If you mix blue amp red you now get a magenta color in Flutter Container width height decoration BoxDecoration color Color xd Image FillSay you wanted to add an image to this mix Good news We make this easy by converting this fill into with into an image with a mixed green fill so you ll never have to miss out on the rock staring at you Image asset assets images imagewithtint png package foo width height fit BoxFit none Gradient FillFor the first time we re adding support for Gradients you can use Linear Gradient and we ll convert the code directly Diamond and Radial gradients are not supported directly yet but we do generate an image for them so that the output is still correct Linear Gradient Container width height decoration BoxDecoration gradient LinearGradient begin Alignment end Alignment colors lt Color gt Color xffff Color xccc stops tileMode TileMode clamp Radial Diamond Gradients get converted to images for now Rectangle and Text Drop Shadow SupportNow by adding a drop shadow in Figma to Rectangle s and Text we print that out directly to the code see below Text AutoSizeText Howdy style TextStyle fontFamily Roboto fontSize fontWeight FontWeight w letterSpacing color Colors black shadows Shadow color Color xe offset Offset blurRadius textAlign TextAlign left Rectangle Container width height decoration BoxDecoration color Color xc border Border all color Color xffff width boxShadow BoxShadow color Color x spreadRadius blurRadius offset Offset Border SupportPreviously our border support was limited but we now support border color border radius and border thickness Here s how it works Container width height decoration BoxDecoration color Color xc borderRadius BorderRadius all Radius circular border Border all color Color xffff width Image Vectors Map To SVGLastly previously complex shapes convert to images but when scaling these images they tend to be low quality images With our latest update these are not turned into amp used as SVGs so that you have pixel perfect scaling If you re reading this thanks for checking this out We d love to hear your thoughts amp feedback Be sure to join our community on Discord or email us for support at support parabeac com |
2022-03-23 15:02:18 |
海外TECH |
DEV Community |
Day 6: 100 Days of SwiftUI |
https://dev.to/johnkevinlosito/day-6-100-days-of-swiftui-5am1
|
Day Days of SwiftUI Loops summary and checkpoint Loops is when you need to perform repetitive actions codes over a list or a range For loopsUse for loops when you have a finite amount of data to go through let platforms iOS macOS tvOS watchOS for os in platforms print Swift works great on os If you need to loop through a range of numbersfor i in print i If you need to loop up to a number meaning excluding the last onefor i in lt print i You can also get the current index of a list in a looplet platforms iOS macOS tvOS watchOS for index os in platforms enumerated print index Swift works great on os While loopsYou use while loops when you need a custom condition or you don t know how many times to loop through var countdown while countdown gt print countdown … countdown ContinueYou use continue if you want to skip an item during the loop let filenames me jpg work txt you jpg logo psd for filename in filenames if filename hasSuffix jpg continue print Found picture filename BreakYou use break if you want to end the loop when a condition is met let number let number var multiples Int for i in if i isMultiple of number amp amp i isMultiple of number multiples append i if multiples count break print multiples Checkpoint Fizz BuzzThe goal is to loop from through and for each number If it s a multiple of print “Fizz If it s a multiple of print “Buzz If it s a multiple of and print “FizzBuzz Otherwise just print the number Solution here |
2022-03-23 15:01:35 |
Apple |
AppleInsider - Frontpage News |
Arizona is first state to launch drivers' licence in Apple Wallet |
https://appleinsider.com/articles/22/03/23/arizona-is-first-state-to-launch-drivers-licence-in-apple-wallet?utm_medium=rss
|
Arizona is first state to launch drivers x licence in Apple WalletArizona residents can now add their drivers license or state ID to Apple Wallet which lets them use an iPhone or Apple Watch to check in at selected TSA checkpoints As Apple continues to discuss bringing digital drivers licenses to US states Arizona has become the first to take the system live for its residents We re thrilled to bring the first driver s license and state ID in Wallet to Arizona today said Jennifer Bailey Apple s vice president of Apple Pay and Apple Wallet in a statement and provide Arizonans with an easy secure and private way to present their ID when traveling through just a tap of their iPhone or Apple Watch Read more |
2022-03-23 15:58:22 |
Apple |
AppleInsider - Frontpage News |
Apple still selling more iPhone 13 models than past lineups via carrier channels |
https://appleinsider.com/articles/22/03/23/apple-still-selling-more-iphone-13-models-than-past-lineups-via-carrier-channels?utm_medium=rss
|
Apple still selling more iPhone models than past lineups via carrier channelsSales of Apple s iPhone models remain elevated compared to prior lineups despite supply constraints according to new carrier research data obtained by JP Morgan Apple iPhone ProIn a note to investors seen by AppleInsider JP Morgan analyst Samik Chatterjee writes that incremental datapoints support the investment bank s positive outlook for iPhone demand in In fact Chatterjee predicts record volumes on the iPhone cycle which has eclipsed the iPhone Read more |
2022-03-23 15:11:13 |
海外TECH |
Engadget |
Apple Studio Display review: For Mac-loving eyes only |
https://www.engadget.com/apple-studio-display-review-mac-monitor-154504997.html?src=rss
|
Apple Studio Display review For Mac loving eyes onlyMuch like the Mac Studio Apple s new Studio Display is something its devoted fans have been begging for for years LG s Ultrafine K display was well just fine but it wasn t Apple quality hardware And while the company s Pro XDR K display has practically every feature you d want it also costs an eye watering It sure would be nice if Apple just sold the K screen from the inch iMac on its own Enter the Studio Display It s a bit brighter than the K iMac but otherwise it s pretty much the same inch screen we ve seen for years To make up for the lack of modern features ーlike the faster ProMotion refresh rate and Mini LED backlighting we saw on the latest MacBook Pros ーApple stuffed in an A Bionic chip to drive its webcam and speaker features It s not exactly a smart display as we d define one but it s certainly smarter than most screens Unfortunately the Studio Display s high starting price makes it out of reach for everyone but the Apple faithful What s truly maddening though is that Apple is seemingly oblivious to the display market in If you want a height adjustable stand for example you ll have to shell out an additional at the time of purchase This is the same company that priced the ProDisplay XDR s stand at don t forget That feature is practically standard today save for some truly budget offerings Making height adjustment cost extra on such an expensive monitor is simply inexcusable There s also a VESA mount option but you can only opt for that when you re buying the screen Heaven forbid your needs change after the fact And if you want Apple s nano texture glass option which helps to reduce reflections in bright environments be prepared to spend an additional Putting that screen technology along with a height adjustable stand brings the total cost of the Studio Display to Sigh That s just hard to stomach when I also have Alienware s QD OLED inch ultrawide monitor on my desk ーit s pretty much the ultimate gaming screen with a Hz refresh rate nits of peak brightness and actual HDR compatibility And when compared to the Studio Display the Alienware QD OLED is practically a bargain at Devindra Hardawar EngadgetI get it the Studio Display isn t made for me And really it s not meant for anyone who d consider a non Apple product It s a monitor built expressly for the company s devoteesーthe sort of user who demands a K screen that can accurately render MacOS and who scoffs at the cheap plastic frames that plague the competition I ve talked to several Mac fanatics who are still running the company s defunct Thunderbolt monitor and avoided upgrading to the issue plagued LG UltraFine K who immediately preordered the Studio Display For them there just isn t another option Despite my frustrations with so many aspects of the Studio Display it s still a very nice looking K LED screen Its wide P gamut support allows colors to pop off the screen which is particularly noticeable when working with high resolution photos The Studio Display isn t technically an HDR screen but it can still take advantage of the wider color range from HDR streams Its nits of brightness was also more than enough for my dimly lit office ーthat s a good thing if you re planning to use one right by a sunny window And even though it s an aging LED at least it s using an IPS panel so colors still looked great from extreme viewing angles Devindra Hardawar EngadgetNaturally the Studio Display also looks and feels like a premium Apple device with a smooth aluminum case and an attractive design that s striking from every angle Around the back there s a single Thunderbolt USB C connection that can charge a MacBook Pro and deliver audio data at the same time along with three USB C ports for accessories So sure Mac heads may be overpaying a ton but at least they re getting a very usable monitor that ll last for years Sometimes though using the Studio Display sometimes felt like I was trapped in a David Lynch esque nightmare where the beautiful veneer was covering subtle horrors Black levels never looked better than a dim gray for example because the screen relies on a single LED backlight A modern LCD screen in the same price range typically has dozens to hundreds of backlight zones The Mini LED backlights on the new MacBook Pros have thousands of local dimming zones OLED displays meanwhile don t even have to deal with backlight since their pixels can turn on and off individually delivering far better contrast than the Studio Display I also couldn t help but notice that scrolling through text and webpages just never looked as smooth as it does on my iPhone Pro and other Apple ProMotion screens Once you live with high refresh rates day to day it s hard to go back to any screen running at a mere Hz Devindra Hardawar EngadgetThe Studio Display s six speaker sound system is one of the most impressive things I ve ever heard from a monitor especially with the faux surround sound from Dolby Atmos tracks but it s also paired with a surprisingly grimy megapixel webcam Its output consistently looked like it was covered in a layer of Vaseline no matter if I was using it in a well lit or dim environment And yes I made sure the lens area wasn t dirty somehow Apple says it s working on a fix for the Studio Display s webcam quality but I m just shocked they didn t notice any issues until now Having Center Stage built into the Display was useful especially if I was moving around a lot during a video call but I can t fully judge its quality until Apple fixes the camera issues I m more intrigued by the potential behind the Studio Display s A chip though Twitter user quot Khaos Tian quot noticed that the monitor actually has GB of onboard storage same as the base model of the A equipped iPhone Devindra Hardawar EngadgetIt could just be that it was easier for Apple to throw in the same storage instead of bundling the A with a smaller disk But a part of me can t help but wonder what Apple could do with that hardware Imagine transforming the Studio Display into a true smart screen with the ability to take FaceTime calls and stream media over AirPlay without being physically connected to a Mac Apple is far too risk averse to throw in major new features down the line but I m interested to see if hardware tinkerers can work some sort of magic on the Studio Display I don t blame Mac fans for being excited about the Studio Display When you ve been stuck in a figurative desert for years you d be grateful for any kind of salvation I just wish Apple was as devoted to its loyal followers as they are to the brand Mac users are used to paying a premium but they still deserve a screen with modern technology and a stand that can reach eye level without a pile of books underneath |
2022-03-23 15:45:04 |
海外TECH |
Engadget |
Rocksteady delays 'Suicide Squad' game to 2023 |
https://www.engadget.com/rocksteady-suicide-squad-video-game-delay-151834338.html?src=rss
|
Rocksteady delays x Suicide Squad x game to You ll have to wait a while longer to slay Superman Rocksteady Studios has delayedSuicide Squad Kill the Justice League from sometime in to spring Company co founder Sefton Hill didn t explain the decision but promised the extra time would be used to quot make the best game quot possible The title has Harley Quinn King Shark and other Suicide Squad villians fight mind controlled superheroes like Superman and The Flash as they cause chaos Rocksteady hasn t shown gameplay but Kill the Justice League will be available for PC PlayStation and Xbox Series X S This isn t the only DC Comics game in the pipeline WB Games Montreal s open world RPG Gotham Knights is still due in October All the same this could prove frustrating for fans of Rocksteady s work The developer hasn t released a new game since s Batman Arkham VR and the last conventional release was s Arkham Knight Players have been waiting several years to see what the company will do next and the months long delay won t exactly quell any impatience We ve made the difficult decision to delay Suicide Squad Kill The Justice League to Spring I know a delay is frustrating but that time is going into making the best game we can I look forward to bringing the chaos to Metropolis together Thanks for your patience pic twitter com VOSwTMZakーSefton Hill Seftonhill March |
2022-03-23 15:18:34 |
海外TECH |
Engadget |
Instagram’s chronological feed is back |
https://www.engadget.com/instagram-chronological-feed-is-back-150050596.html?src=rss
|
Instagram s chronological feed is backA chronological feed is once again available on Instagram More than five years after the company first switched to an algorithmically ranked feed the app is bringing back the ability for users to see feed posts ordered by recency The app is rolling out the change now to all users globally after first confirming that new versions of the feed were in the works last December Importantly the new chronological option is not on by default and there s no way for users to ditch the algorithm entirely Instead people can now move between three different versions of their feeds the algorithmic “home feed which remains the default a “following feed which orders accounts you follow in reverse chronological order and “favorites which is a feed of up to favorited accounts You can move between the three feeds by tapping on the nbsp Even though the chronological feed isn t on by default the fact that it s coming back at all is a major reversal for Instagram which has for years defended its decision to switch to an algorithmic feed despite years of complaints and conspiracy theories about quot shadowbans quot As recently as last June Instagram published a lengthy blog post detailing how its ranking algorithm works In the blog post Instagram s top executive Adam Mosseri wrote that at the time Instagram moved away from a chronological feed in “people were missing of all their posts in Feed including almost half of posts from their close connections But “the algorithm has become a sticky subject for Instagram which is facing scrutiny for the impact it has on teens mental health In particular the way that the app ranks and suggests content to young people has gotten outsized attention from lawmakers some of whom have proposed legislation to regulate algorithms Instagram has also gotten more aggressive in inserting “suggested posts and Reels into users feeds in recent months as Facebook s popularity starts to dip By rolling out new versions of its feed now Instagram can both head off complaints about its new recommendations filled approach and claim that it s offering users a “choice about whether or not they use its ranking algorithm |
2022-03-23 15:00:50 |
海外科学 |
NYT > Science |
The Wreck of an 1830s Whaler Offers a Glimpse of America’s Racial History |
https://www.nytimes.com/2022/03/23/climate/industry-whaling-ship-found.html
|
multiracial |
2022-03-23 15:02:49 |
金融 |
◇◇ 保険デイリーニュース ◇◇(損保担当者必携!) |
保険デイリーニュース(03/24) |
http://www.yanaharu.com/ins/?p=4867
|
東京海上 |
2022-03-23 15:26:24 |
金融 |
金融庁ホームページ |
金融審議会「資金決済ワーキング・グループ」(第3回)議事録を公表しました。 |
https://www.fsa.go.jp/singi/singi_kinyu/shikinkessai_wg/gijiroku/20211126.html
|
金融審議会 |
2022-03-23 17:00:00 |
金融 |
金融庁ホームページ |
金融審議会「資金決済ワーキング・グループ」(第4回)議事録を公表しました。 |
https://www.fsa.go.jp/singi/singi_kinyu/shikinkessai_wg/gijiroku/20211217.html
|
金融審議会 |
2022-03-23 17:00:00 |
金融 |
金融庁ホームページ |
金融審議会「資金決済ワーキング・グループ」(第5回)議事録を公表しました。 |
https://www.fsa.go.jp/singi/singi_kinyu/shikinkessai_wg/gijiroku/20211228.html
|
金融審議会 |
2022-03-23 17:00:00 |
金融 |
金融庁ホームページ |
バーゼル銀行監督委員会による「人工知能と機械学習に関するニューズレター」について掲載しました。 |
https://www.fsa.go.jp/inter/bis/20220323/20220323.html
|
人工知能 |
2022-03-23 17:00:00 |
ニュース |
BBC News - Home |
People face biggest drop in living standards in 66 years |
https://www.bbc.co.uk/news/business-60846951?at_medium=RSS&at_campaign=KARANGA
|
meaning |
2022-03-23 15:47:58 |
ニュース |
BBC News - Home |
Angel Lynn: Kidnapped woman's abusive ex has sentence increased |
https://www.bbc.co.uk/news/uk-england-leicestershire-60847198?at_medium=RSS&at_campaign=KARANGA
|
abusive |
2022-03-23 15:28:24 |
ニュース |
BBC News - Home |
Spring Statement: Key points at a glance |
https://www.bbc.co.uk/news/business-60849054?at_medium=RSS&at_campaign=KARANGA
|
statement |
2022-03-23 15:04:20 |
ニュース |
BBC News - Home |
How Rishi Sunak's Spring Statement will affect you |
https://www.bbc.co.uk/news/business-60819205?at_medium=RSS&at_campaign=KARANGA
|
changes |
2022-03-23 15:35:00 |
ニュース |
BBC News - Home |
Plans for giant, lit-up dome approved for Olympics site |
https://www.bbc.co.uk/news/uk-england-london-60848732?at_medium=RSS&at_campaign=KARANGA
|
music |
2022-03-23 15:10:18 |
ニュース |
BBC News - Home |
Ukrainian orphans heading to Scotland after delay |
https://www.bbc.co.uk/news/uk-scotland-60850379?at_medium=RSS&at_campaign=KARANGA
|
paperwork |
2022-03-23 15:45:50 |
ニュース |
BBC News - Home |
Ash Barty: Australians react to world tennis number one's shock retirement |
https://www.bbc.co.uk/news/world-australia-60850780?at_medium=RSS&at_campaign=KARANGA
|
ashleigh |
2022-03-23 15:39:12 |
ニュース |
BBC News - Home |
How many Ukrainians have fled their homes and where have they gone? |
https://www.bbc.co.uk/news/world-60555472?at_medium=RSS&at_campaign=KARANGA
|
ukraine |
2022-03-23 15:36:16 |
北海道 |
北海道新聞 |
首相、G7会合のベルギーへ出発 |
https://www.hokkaido-np.co.jp/article/660373/
|
岸田文雄 |
2022-03-24 00:36:00 |
北海道 |
北海道新聞 |
坂本SP首位、樋口7位 世界フィギュアが開幕 |
https://www.hokkaido-np.co.jp/article/660394/
|
世界選手権 |
2022-03-24 00:31:00 |
北海道 |
北海道新聞 |
エネルギー安保を討議 IEA閣僚理事会 |
https://www.hokkaido-np.co.jp/article/660393/
|
閣僚 |
2022-03-24 00:28:00 |
北海道 |
北海道新聞 |
道内公立小中校長ら1273人異動(一覧を掲載) |
https://www.hokkaido-np.co.jp/article/660379/
|
小中学校 |
2022-03-24 00:19:17 |
北海道 |
北海道新聞 |
危機管理監に桜井氏 札幌市人事(特別職、局長職、部長職の一覧掲載) |
https://www.hokkaido-np.co.jp/article/660378/
|
人事異動 |
2022-03-24 00:19:52 |
北海道 |
北海道新聞 |
モスクワ取引所、再開へ 24日から、1カ月ぶり |
https://www.hokkaido-np.co.jp/article/660392/
|
株式 |
2022-03-24 00:18:00 |
北海道 |
北海道新聞 |
島耕作は「社外取締役」に 人気漫画、74歳の新展開 |
https://www.hokkaido-np.co.jp/article/660391/
|
弘兼憲史 |
2022-03-24 00:18:00 |
IT |
週刊アスキー |
さらなる高速化や難しさの引き上げに対応!『Relayer(リレイヤー)』3月25日0時より「DAY2パッチ」の配信が決定 |
https://weekly.ascii.jp/elem/000/004/087/4087048/
|
relayer |
2022-03-24 00:05:00 |
GCP |
Cloud Blog |
Meet AI’s multitool: Vector embeddings |
https://cloud.google.com/blog/topics/developers-practitioners/meet-ais-multitool-vector-embeddings/
|
Meet AI s multitool Vector embeddingsEmbeddings are one of the most versatile techniques in machine learning and a critical tool every ML engineer should have in their toolbelt It s a shame then that so few of us understand what they are and what they re good for The problem perhaps is that embeddings sound slightly abstract and esoteric In machine learning an embedding is a way of representing data as points in n dimensional space so that similar data points cluster together Sound boring and unimpressive Don t be fooled Because once you understand this ML multitool you ll be able to build everything from search engines to recommendation systems to chatbots and a whole lot more Plus you don t have to be a data scientist with ML expertise to use them nor do you need a huge labeled dataset Have I convinced you how neat these bad boys are Good Let s dive in In this post we ll explore What embeddings areWhat they re used forWhere and how to find open source embedding modelsHow to use themWhat can you build with embeddings Before we talk about what embeddings are let s take quick stock of what you can build with them Vector embeddings power Recommendation systems i e Netflix style if you like these movies you ll like this one too All kinds of searchText search like Google Search Image search like Google Reverse Image Search Chatbots and question answering systemsData preprocessing preparing data to be fed into a machine learning model One shot zero shot learning i e machine learning models that learn from almost no training data Fraud detection outlier detectionTypo detection and all manners of “fuzzy matching Detecting when ML models go stale drift So much more Even if you re not trying to do something on this list the applications of embeddings are so broad that you should probably keep reading just in case What are embeddings Embeddings are a way of representing data almost any kind of data like text images videos users music whatever as points in space where the locations of those points in space are semantically meaningful The best way to intuitively understand what this means is by example so let s take a look at one of the most famous embeddings WordVec WordVec short for word to vector was a technique invented by Google in for embedding words It takes as input a word and spits out an n dimensional coordinate or “vector so that when you plot these word vectors in space synonyms cluster Here s a visual Words plotted in dimensional space Embeddings can have hundreds or thousands of dimensions too many for humans to visualize With WordVec similar words cluster together in space so the vector point representing “king and “queen and “prince will all cluster nearby Same thing with synonyms “walked “strolled “jogged For other data types it s the same thing A song embedding would plot similar sounding songs nearby An image embedding would plot similar looking images nearby A customer embedding would plot customers with similar buying habits nearby You can probably already see how this is useful embeddings allow us to find similar data points I could build a function for example that takes as input a word i e “king and finds me its ten closest synonyms This is called a nearest neighbor search Not terribly interesting to do with single words but imagine instead if we embedded whole movie plots Then we could build a function that given the synopsis of one movie gives us ten similar movies Or given one news article recommends semantically similar articles Additionally embeddings allow us to compute numerical similarity scores between embedded data points i e “How similar is this news article to that one One way to do this is to compute the distance between two embedded points in space and say that the closer they are the more similar they are This measure is also known as Euclidean distance You could also use dot product cosine distance and other trigonometric measures Similarity scores are useful for applications like duplicate detection and facial recognition To implement facial recognition for example you might embed pictures of people s faces then determine that if two pictures have a high enough similarity score they re of the same person Or if you were to embed all the pictures on your cell phone camera and found photos that were very nearby in embedding space you could conclude those points were likely near duplicate photos Similarity scores can also be used for typo correction In WordVec common misspellings hello “helo “helllo “hEeeeelO tend to have high similarity scores because they re all used in the same contexts The graphs way above also illustrate an additional and very neat property of WordVec which is that different axes capture grammatical meaning like gender verb tense and so on This means that by adding and subtracting word vectors we can solve analogies like “man is to woman as king is to It s quite a neat feature of word vectors though this trait doesn t always translate in a useful way to embeddings of more complex data types like images and longer chunks of text More on that in a second What kinds of things can be embedded So many kinds of things TextIndividual words as in the case of WordVec but also entire sentences and chunks of text One of open source s most popular embedding models is called the Universal Sentence Encoder USE The name is a bit misleading because USE can be used to encode not only sentences but also entire text chunks Here s a visual from the TensorFlow website The heat map shows how similar different sentences are according to their distance in embedding space Imagine for example that I wanted to create a searchable database of New York Times articles My News Article DatabaseBoosters Effective in Averting Hospitalization C D C Data ShowHow to Make Your Own Animated GIFsWhat to Wear in the MetaverseHow Much Are You Willing to Pay for a Burrito Now suppose I search this database with the text query “food The most relevant result in the database is the article about the burrito even though the word “food doesn t appear in the article headline If we searched by the USE embeddings of the headlines rather than by the raw text itself we d be able to capture that because USE captures semantic similarity of text rather than overlap of specific words It s worth noting here that since we can associate many data types with text captions for images transcripts for movies we can also adapt this technique to use text search for multimedia As an example check out this searchable video archive Try it out How to do text similarity search and document clustering in BigQuery by Lak Lakshmanan Towards Data ScienceImagesImages can also be embedded which enables us to do reverse image search i e “search by image One example is vision product search which also happens to be a Google Cloud product by the same name Imagine for example that you re a clothing store and you want to build out a search feature You might want to support text queries like “leather goth studded mini skirt Using something like a USE embedding you might be able to match that text user query with a product description But wouldn t it be neat if you could let users search by image instead of just text So that shoppers could upload say a trending top from Instagram and see it matched against similar products in your inventory That s exactly what this tutorial shows you how to build One of my favorite products that uses image search is Google Lens It matches camera photos with visually similar products Here it tries to match online products that look similar to my pair of sneakers As with sentence embeddings there are lots of free to use image embedding models available This TensorFlow Hub page provides a bunch under the label “feature vector These embeddings were extracted from large deep learning models that were initially trained to do image classification on large datasets To see a demo of image search powered by MobileNet embeddings check out this demo that lets you upload a photo and searches all of Wikimedia to find similar images Unfortunately unlike sentence embeddings open source image embeddings often need to be tuned for a particular task to be high quality For example if you wanted to build a similarity search for clothing you d likely want a clothing dataset to train your embeddings on More on how to train embeddings in a bit Read More Compression search interpolation and clustering of images using machine learning by Lak Lakshmanan Towards Data ScienceProducts and ShoppersEmbeddings are especially useful in the retail space when it comes to making product recommendations How does Spotify know which songs to recommend listeners based on their listening histories How does Netflix decide which movies to suggest How does Amazon know what products to recommend shoppers based on purchase histories Nowadays the cutting edge way to build recommendation systems is with embeddings Using purchase listening watching history data retailers train models that embed users and items What does that mean Imagine for example that I m a frequent shopper at an imaginary high tech book selling site called BookShop Using purchase history data BookShop trained two embedding models The first its user embedding model maps me a book buyer to user space based on my purchase history I e because I buy a lot of O Reilly tech guides pop science books and fantasy books this model maps me close to other nerds in user space Meanwhile BookSpace also maintains an item embedding model that maps books to item space In item space we d expect books of similar genres and topics to cluster together So we d find the vector representing Philip K Dick s Do Androids Dream of Electric Sheep nearby to the vector representing William Gibson s Neuromancer since these books are topically stylistically similar How are embeddings created To recap so far we ve talked about What types of apps embeddings powerWhat embeddings are a mapping of data to points in space Some of the data types that can actually be embeddedWhat we haven t yet covered is where embeddings come from or more specifically how to build a machine learning model that takes in data and spits out semantically meaningful embeddings based on your use case Here as in most of machine learning we have two options the pre trained model route and the DIY train your own model route Pre Trained ModelsIf you d like to embed text i e to do text search or similarity search on text you re in luck There are tons and tons of pre trained text embeddings free and easily available for your using One of the most popular models is the Universal Sentence Encoder model I mentioned above which you can download here from the TensorFlow Hub model repository Using this model in code is pretty straightforward This sample is snatched directly from the TensorFlow website code block StructValue u code u import tensorflow hub as hub r nembed hub load r nembeddings embed r n The quick brown fox jumps over the lazy dog r n I am a sentence for which I would like to get its embedding r nprint embeddings u language u Personally I think it s absolutely mind blowing that you can accomplish something as sophisticated as sentence embeddings in so few lines of Python code To actually get use out of these text embeddings we ll need to implement nearest neighbor search and calculate similarity For that let me point you tothis blog post I wrote recently on this very topic building text semantically intelligent apps using sentence embeddings Open source image embeddings are easy to come by too Here s where you can find them on TensorFlow Hub Again to be useful for domain specific tasks it s often useful to fine tune these types of embeddings on domain specific data i e pictures of clothing items dog breeds etc Finally I d be remiss not to mention one of the most hype inducing embedding models released as of late OpenAI s CLIP model CLIP can take an image or text as input and map both data types to the same embedding space This allows you to build software that can do things like figure out which caption text is most fitting for an image Training Your Own EmbeddingsBeyond generic text and image embeddings we often need to train embedding models ourselves on our own data Nowadays one of the most popular ways to do this is with what s called a Two Tower Model From the Google Cloud website The Two Tower model trains embeddings by using labeled data The Two Tower model pairs similar types of objects such as user profiles search queries web documents answer passages or images in the same vector space so that related items are close to each other The Two Tower model consists of two encoder towers the query tower and the candidate tower These towers embed independent items into a shared embedding space which lets Matching Engine retrieve similarly matched items I m not going to go into detail about how to train a two tower model in this post For that I ll direct you to this guide on Training Your Own Two Tower Model on Google Cloud or this page on Tensorflow Recommenders which shows you how to train your own TensorFlow Two Tower recommendation models Special thanks to Kaz Sato for his early feedback Related ArticleFind anything blazingly fast with Google s vector search technologyHow do YouTube Google Search and Google Play instantly find what you want in the vast sea of web content Try the demo and find out Hi Read Article |
2022-03-23 15:30:00 |
コメント
コメントを投稿