投稿時間:2022-02-11 02:37:39 RSSフィード2022-02-11 02:00 分まとめ(43件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Architecture Blog Optimize AI/ML workloads for sustainability: Part 1, identify business goals, validate ML use, and process data https://aws.amazon.com/blogs/architecture/optimize-ai-ml-workloads-for-sustainability-part-1-identify-business-goals-validate-ml-use-and-process-data/ Optimize AI ML workloads for sustainability Part identify business goals validate ML use and process dataTraining artificial intelligence AI services and machine learning ML workloads uses a lot of energyーand they are becoming bigger and more complex As an example the Carbontracker Tracking and Predicting the Carbon Footprint of Training Deep Learning Models study estimates that a single training session for a language model like GPT can have a nbsp carbon footprint … 2022-02-10 16:58:36
AWS AWS Database Blog How to sign Ethereum EIP-1559 transactions using AWS KMS https://aws.amazon.com/blogs/database/how-to-sign-ethereum-eip-1559-transactions-using-aws-kms/ How to sign Ethereum EIP transactions using AWS KMSEthereum is a popular public blockchain that enables you to create decentralized applications across a variety of use cases In and it became widely used for decentralized finance DeFi apps and non fungible token NFT apps Due to its permissionless nature it s available to every user by just setting up an Ethereum account These … 2022-02-10 16:38:23
AWS AWS Media Blog Now Available: AWS Virtual Waiting Room solution https://aws.amazon.com/blogs/media/now-available-aws-virtual-waiting-room-solution/ Now Available AWS Virtual Waiting Room solutionThis post from the AWS Compute blog explains how to use the new AWS Virtual Waiting Room solution to buffer user requests to your website during times of peak demand and sudden bursts of traffic preventing system resource exhaustion and providing an improved user experience For retail or event sales medical appointments and vaccine registrations … 2022-02-10 16:53:26
python Pythonタグが付けられた新着投稿 - Qiita FastAPI入門 〜環境構築からMySQL連携まで〜 https://qiita.com/hkyo/items/65321d7015121ccf369f ディレクトリ構造fastapisample└ーmainpyhelloworldそれではFastAPIでHelloWorldしてみましょうmainpyFastAPIをインポートfromfastapiimportFastAPIFastAPIのインスタンス作成appFastAPIGETメソッドでルートURLにアクセスされたときの処理appgetasyncdefrootreturnmessageHelloWorldサーバー起動uvicornmainappreloadportmainappの部分はファイル名インスタンス名です。 2022-02-11 01:23:01
技術ブログ Mercari Engineering Blog Istio が解決する私達の問題 https://engineering.mercari.com/blog/entry/20220210-how-istio-solved-our-problems/ networhellip 2022-02-10 16:36:26
海外TECH Ars Technica Factory contamination ruins “at least” 7 billion gigabytes of flash memory https://arstechnica.com/?p=1833071 kioxia 2022-02-10 16:33:08
海外TECH MakeUseOf 7 Free Apps to Create Memes on Your iPhone or iPad https://www.makeuseof.com/tag/7-free-apps-create-memes-iphone-ipad/ creator 2022-02-10 16:46:44
海外TECH MakeUseOf How to See File Extensions in Windows 11 https://www.makeuseof.com/windows-11-see-file-extensions/ windows 2022-02-10 16:17:01
海外TECH DEV Community How to collect data via forms like a boss https://dev.to/abhirajb/how-to-collect-data-via-forms-like-a-boss-2l15 How to collect data via forms like a bossForms are an integral part of our lifeThey are literally everywhere be it when you re signing up for a new social media app or you re applying for anything But do you know what actually goes on behind forms The ancient way ‍ ️Now earlier forms were used to collect data on an HTML file and save it to a MySQL Database For this method you need to have a basic understanding of PHP too But as you know we ain t taking the hard way A short disclaimerI know you might just use Google Forms or Typeform or any other no code tool for that matter But this tutorial is for people who d like to have control over how their form functions and also large scale purposes to be implemented inside your code What we re gonna be using So what we re gonna learn today is how you can collect data easily by just adding an endpoint to your HTML code and getting the data served to you beautifully The app we re gonna be using today is Formbold not sponsored Now let s get started Step ️⃣Make a form LolNo seriously We need to make a form to collect dataHere s a form I made with Tailwind we ll be using this to collect our data lt Tailwind Form gt lt div class bg white py sm py lg py gt lt div class max w screen xl px md px mx auto gt lt text start gt lt div class mb md mb gt lt h class text gray text xl lg text xl font bold text center mb md mb gt Get in touch lt h gt lt p class max w screen md text gray md text lg text center mx auto gt This is a section of some simple filler text also known as placeholder text It shares some characteristics of a real written text but is random or otherwise generated lt p gt lt div gt lt text end gt lt form start gt lt form class max w screen md grid sm grid cols gap mx auto gt lt div gt lt label for first name class inline block text gray text sm sm text base mb gt First name lt label gt lt input name first name class w full bg gray text gray border focus ring ring indigo rounded outline none transition duration px py gt lt div gt lt div gt lt label for last name class inline block text gray text sm sm text base mb gt Last name lt label gt lt input name last name class w full bg gray text gray border focus ring ring indigo rounded outline none transition duration px py gt lt div gt lt div class sm col span gt lt label for company class inline block text gray text sm sm text base mb gt Company lt label gt lt input name company class w full bg gray text gray border focus ring ring indigo rounded outline none transition duration px py gt lt div gt lt div class sm col span gt lt label for email class inline block text gray text sm sm text base mb gt Email lt label gt lt input name email class w full bg gray text gray border focus ring ring indigo rounded outline none transition duration px py gt lt div gt lt div class sm col span gt lt label for subject class inline block text gray text sm sm text base mb gt Subject lt label gt lt input name subject class w full bg gray text gray border focus ring ring indigo rounded outline none transition duration px py gt lt div gt lt div class sm col span gt lt label for message class inline block text gray text sm sm text base mb gt Message lt label gt lt textarea name message class w full h bg gray text gray border focus ring ring indigo rounded outline none transition duration px py gt lt textarea gt lt div gt lt div class sm col span flex justify between items center gt lt button class inline block bg indigo hover bg indigo active bg indigo focus visible ring ring indigo text white text sm md text base font semibold text center rounded lg outline none transition duration px py gt Send lt button gt lt span class text gray text sm gt Required lt span gt lt div gt lt p class text gray text xs gt By signing up to our newsletter you agree to our lt a href class hover text indigo active text indigo underline transition duration gt Privacy Policy lt a gt lt p gt lt form gt lt form end gt lt div gt lt div gt You can check out how the form looks here Step ️⃣Now let s add the endpoint After you ve signed up for Formbold you need to make a new form Now you need to name your form and choose an email address to receive notifications for every submission By default you can only receive notifications on the registered email but you can also add new addresses on the linked emails tab After making a new form go to its integration tab and you have the endpoint Now you need to add two attributes to your form tag in HTML The two attributes are action and method Your form tag should now look like this lt form action endpoint url method POST class max w screen md grid sm grid cols gap mx auto gt Step ️⃣Our work is mostly done now Let us test the form After you ve submitted the response gets recorded and will not show up on the submissions tab of the form on FormboldAnd voila Now you know how to collect form data in three super easy steps Thank you for readingIf you liked this post subscribe to my newsletterto never miss out on my blogs product launches and tech news and follow me on Twitter for daily threads on web dev resources 2022-02-10 16:52:33
海外TECH DEV Community React Interview Questions to Gauge Understanding https://dev.to/jesusrmoreno94/react-interview-questions-to-gauge-understanding-3lnn React Interview Questions to Gauge UnderstandingRecently I had to come up with a list of interview questions to ask potential candidates I tried to come up with questions that showed understanding rather than memorization This list will be refined as I test these out What problem does React solve React is a way to develop UIs in a predictable declarative way Rather than wiring up changes to the DOM yourself you simply describe what the UI should look like for a given state and React handles the DOM patching What is the role of the virtual dom in React what problems does it attempt to solve React makes the assumption that DOM manipulation is expensive kudos if they explain why so it holds a copy of the DOM in an in memory data structure known as the virtual dom Differences in the component tree between renders are computed against this virtual representation and React tries to apply the minimal number of changes to the DOM Speak briefly on the component lifecycleAt the very least should mention mounting rendering unmounting Extra points if they can talk about the class based lifecycle and why it is no longer as relevant In the context of React what does one way data flow refer to and what are some of the advantages disadvantages of this One way data flow describes how information moves through a react application information always moves down the tree from parent to child One of the advantages of this is that it makes application state easier to reason about since we know information will either be local or coming from a parent node One of the disadvantages is that it makes communication between sibling components impossible without an intermediary parent state store context Also makes prop drilling a thing which isn t necessarily bad but can be messy Elaborate on a few common approaches to sharing state between sibling componentsLifting state up using an outside store react context How would you share state between components at different levels of the component tree Lifting state up using an outside store prop drilling is also an option but has the disadvantage of introducing noise into component APIs and potentially causing extra renders which can be an issue in performance critical applications React Context is also an option but setting the value of a context provider will cause the entire subtree to re render so it is a tool which should be used for values which do not change as often and not for general state management state usually changes frequently What is a pure component and why would you want to use one Pure components are components with no side effects this allows us to use shouldComponentUpdate or React memo to compare props and prevent re renders in performance critical parts of the application Pure components are not without cost in some situations re rendering the component without comparing props is faster than doing the comparison this is especially true for smaller components In the context of a react component what is a key Keys are required when rendering a list of items Keys help react keep track of components between renders extra points You can force react to unmount mount a component by changing the component s key What problems do refs solve and when would you want to use them The value of the reference is persisted stays the same between component re renders Updating a reference doesn t trigger a component re render Refs provide a way to access DOM nodes or React elements created in the render method You would want to use refs for Managing focus text selection or media playback Triggering imperative animations Integrating with third party DOM libraries What is memoization and why would you want to use it Memoization is a programming technique that accelerates performance by caching the return values of expensive function calls A “memoized function will immediately output a pre computed value if it s given inputs that it s seen before You would want to use it to store expensive components values and make sure they are only computed when necessary Memoizing trades memory for computation time Describe what the role of the useEffect hook is how you would use it and some common pitfalls useEffect is used to encapsulate side effects such as data fetching logging handling route changes etc useEffect takes in a dependency array and will re run the body of the hook when those dependencies change You can provide a return function that will be called when when the dependencies change before the next body is called Gotchas around useEffect usually come from not passing in the required dependencies leading to stale values or from dependencies changing on every render How does the useEffect hook compare dependencies across renders and what does this mean for complex types useEffect uses reference shallow equality for complex data types this leads to a common bug in useEffect where the dependencies are complex types and are redeclared on each render this can cause the effect to fire more times than the developer intends 2022-02-10 16:36:47
海外TECH DEV Community How (and how not) to make better Discord bots https://dev.to/deathvenom54/how-and-how-not-to-make-better-discord-bots-4172 How and how not to make better Discord botsYou clicked on this blog which probably means you too make bots like me Or you want to Before I get into this article I want to clarify that this is not a guide but a bunch of ways in which you can improve your bots Curb your prefixIt is very common among bot developers to come up with complex and unique command prefixes for their bot to perhaps stand out While thinking of a prefix keep mobile users in mind A simple symbol like serves the purpose very well and easy to locate on any keyboard A short word prefix letters is also a good idea Avoid having multiple symbols or a combination of letters and symbols Some notable examples are help bot name help Better yet use slash commands Use slash commandsSlash commands are somewhat new to Discord and still evolving I believe that they are the future of bot interaction in Discord Unless you have been living under a rock you must have seen or used slash commands By pressing you can see all the available commands for a bot along with its description When you use a command you can see all its parameters And that s not all You can even specify what type each parameter should be so that oblivious users don t enter a string in an integer type parameter However every coin has two sides slash commands need to be registered beforehand and handled according to their custom id which makes it a tedious job to implement them To solve this problem I wrote djs marshal check it out Use Message ComponentsSimilar to the point above message components such as Buttons and Select Menus are a much better way to take input from the user Are you making the user send a particular reaction to make a choice or to proceed Toss that crap out and use buttons or select menus Make a help commandUnless your bot is meant to be used by a single person you should try to add a help command to your bot This should give a brief description of what the bot does list all the available commands of your bot as well as some related links like support server invite and bot invite Pro tip Make the bot say something along the lines of Use help for help when the bot is pinged Pro tip Set the bot s description and activity to a message that includes its help command This way no matter how a Discord user finds the bot they will be able to get relevant information about the bot without having to search it up Don t add vote wallsA lot of bots block their commands behind a vote wall This means that you must vote for the bot on some bot list in order to use it Though it might bring you a lot of votes fast it is an asshole thing to do This may even trigger people to write negative reviews and use an alternative bot By all means promote your bot by requesting users to vote for it but forcing them to do so is not a good idea 2022-02-10 16:34:03
海外TECH DEV Community 5 Best Open Source Libraries and APIs for Speaker Diarization https://dev.to/kelseyefoster/5-best-open-source-libraries-and-apis-for-speaker-diarization-60e Best Open Source Libraries and APIs for Speaker DiarizationIn Automatic Speech Recognition or ASR Speaker Diarization refers to labeling speech segments in an audio or video file transcription with corresponding speaker identities It s also sometimes referred to as Speaker Labels and at its most basic form helps answer the question who spoke when In order to accurately predict a speaker a Speaker Diarization model must perform two actions Determine the number of speakers that can be found in an audio or video file Attribute each speaker to their appropriate speech segment Why is Speaker Diarization useful When reading a transcription text with multiple speakers your mind automatically tries to sort the text by speaker Speaker Diarization does this automatically to make a transcript much more readable In addition organizations like call centers might use Speaker Diarization to automatically label an “agent or a “customer in a transcription text for a help hotline Medical professionals might use Speaker Diarization to automatically label “doctor and “patient in the transcription text for a virtual appointment and attach this transcript to a patient file While this can seem like a complicated task today s best open source libraries and APIs for Speaker Diarization are trained using the latest Deep Learning and Machine learning research making the process much simpler than it was in the past This article looks at the five best open source libraries and APIs available today to perform Speaker Diarization KaldiKaldi ASR is a well known open source Speech Recognition platform To use its Speaker Diarization library you ll need to either download their PLDA backend or pre trained X Vectors or train your own models Familiar with Kaldi but need help getting Speaker Diarization set up This tutorial can help If you ve never used Kaldi ASR before this Kaldi Speech Recognition Tutorial for Beginners is a great jumping off point AssemblyAIAssemblyAI s Speech to Text and Audio Intelligence APIs offer accurate Speech Recognition without the need to pre train a model To perform Speaker Diarization you can sign up for a free account for its Core Transcription API though note that there is a limit to how much you can transcribe per month before having to upgrade your account to a paid option The API s detailed easy to follow documentation library can help you get started as well PyAnnoteSimilar to Kaldi ASR PyAnnote is another open source Speaker Diarization toolkit written in Python and built based on the PyTorch Machine Learning framework For optimal use you will need to train PyAnnote s end to end neural building blocks to tailor your Speaker Diarization model though some pre trained models are also available Google Speech to TextGoogle Speech to Text is a popular Speech Recognition API that also offers Speaker Diarization The API has good accuracy and language support though using it to transcribe a large volume of files can be quite pricey You ll need to enable Speaker Diarization when you are transcribing an audio or video stream either via a file or the Google Cloud Storage Bucket This documentation can walk you through the necessary steps AWS TranscribeAWS Transcribe also offers Speaker Diarization for either batch or real time transcription Though AWS Transcribe can also be expensive the API does offer one hour free per month so it can be a good option for low volume transcription To enable Speaker Diarization you ll need to login to your Amazon Transcribe console and create a transcription job This documentation page can show you how 2022-02-10 16:33:06
海外TECH DEV Community Day 6: How Undo a Git Add All https://dev.to/mccurcio/day-6-how-undo-a-git-add-all-2ck3 Day How Undo a Git Add All BEFORE committingI use git add a lot Actually I use gits gita gitcm gitp as they are my Bash Aliases Next time when you git add all and dozen files are inadvertently added Try these git reset Deducts ALL the files you just stagedWhilegit reset file name ext Deducts ONE from the last staging Jus Remember The problem with using aliases is that they can become habitual Not a bad thing just something to watch for next time 2022-02-10 16:30:25
海外TECH DEV Community Passing data from React Router's Link to another component. https://dev.to/iamchiki/passing-data-from-react-routers-link-to-another-component-3boa Passing data from React Router x s Link to another component Hey everyone In this article let us understand how to pass data from one route to another route Suppose we have a user list on the home page all users are listed as User components We need to go to the ViewUser component to see the detail of the user on which we clicked How we will implement this There may be different approaches but I will focus on approach in which data will be passed from one route to another route To do this with React Router we can pass data from one Link to new Route that is being rendered Let s take an example to understand this approach more clearly const Home gt const userList id name ajay age country India id name john age country US id name kamal age country UK return lt div gt userList map user gt return lt User user user gt lt User gt lt div gt const User props gt const name id props user return lt Link to user id state props user gt lt div gt lt p gt Name name lt p gt lt p gt User id id lt p gt lt div gt lt Link gt In the above example there are two components in Home components all users are listed and another is the User component which is using Link to go to another route When the user clicks on the user component it will navigate to the ViewUser component const ViewUser gt const location useLocation const user location state return lt div gt lt p gt Name user name lt p gt lt p gt Age user age lt p gt lt p gt Country user country lt p gt lt div gt As mentioned in the above ViewUser component we need user s other details name age country So how we will pass this information to ViewUser Component from User Component To do this we have to include a state prop with the data we want to pass along in our case it is user data lt Link to user id state props user gt lt div gt lt p gt Name name lt p gt lt p gt User id id lt p gt lt div gt lt Link gt So how do we get access to the data on state in ViewUser When we pass data along via the state property that will be available on the location s state property which we can get using React Router s custom hook const location useLocation const user location state 2022-02-10 16:28:58
海外TECH DEV Community Glass Effect in React https://dev.to/shubhamtiwari909/glass-effect-in-react-36p7 Glass Effect in ReactHello Guys Today i am going to show you a contact page template which you might like and can use for your project This tutorial is straightforward and i am assuming you are already familiar with ReactLets get started Here is the working Demo Open the Webpage and Click on Contact button First run this npm command in your terminal npm i react icons tailwindcssnpx tailwindcss init Add this cdn in your html file lt script src gt lt script gt Structure of the pageimport React useState from react import AiOutlineWhatsApp from react icons ai import MdOutgoingMail from react icons md import AiFillLinkedin from react icons ai import BsInstagram from react icons bs import Contact css const Contact gt const display setDiplay useState false return lt div gt lt div className bg image gt lt div gt lt div className bg text gt lt h className text xl py gt I am Shubham Tiwari lt h gt lt h className text xl py postTitle gt WEB DEVELOPER at DevRonnins lt h gt lt div style display display flex none className flex justify center align middle my p gt lt p className flex justify center align middle my p space x gt lt a className text xl linkText href gt lt AiOutlineWhatsApp color ffcec className contactIcons gt lt a gt lt p gt lt p className flex justify center align middle my p space x gt lt a className text xl linkText href mailto shubhmtiwri gmail com gt lt MdOutgoingMail color ffcec className contactIcons gt lt a gt lt p gt lt p className flex justify center align middle my p space x gt lt a className text xl linkText href target blank rel noreferrer gt lt AiFillLinkedin color ffcec className contactIcons gt lt a gt lt p gt lt p className flex justify center align middle my p space x gt lt a className text xl linkText href target blank rel noreferrer gt lt BsInstagram color ffcec className contactIcons gt lt a gt lt p gt lt div gt lt button onClick gt setDiplay display className ring ring red bg none text slate rounded md px py my gt Contacts lt button gt lt div gt lt div gt export default Contact ExaplainationFirst We have imported the required modules Icons from react icon and our CSS file named Contact css Then we created a state named display to create a button which will show and hide the contact icons Then we created a div with class bg image it will have the image as background which we are going to give blur effect The image link is provided in the CSS code below Then we created a div with class bg text it will have the text part and icons and button part Then we created the text inside icons and a button to toggle icons show and hide In the button we have used the onClick method to toggle the state of display and we have placed all the icons inside a div and that div has a style attribute inside which we have used the ternary operator which sets the display property of that div if the display state is set to false the div will be hidden and if the display stats is set to true the div will be shown as flexbox Inside all the anchor tags we have passed the links related to icons for whatsapp icon we have used the whatsApp link with your phone number and when the user click the icon it will redirect to your whatsapp chat and same for other icons linkedin instagram and gmail you can add icons according to your need like github or any other thing which you want your users to redirect to We have given some elements additional class names to use that class name to style the element in CSS file Tailwindcss is best but has some limitations which can be solved by pure css NOTE The classes used for styling here is tailwindcss classes CSS File box sizing border box bg image background properties background image url background position center background size cover background repeat no repeat display properties height vh filter blur px bg text width position absolute top left transform translate z index text align center color aliceblue font weight box shadow px px px black padding rem border px solid white border radius px text shadow px px px black contactIcons font size rem media screen and min width px and max width px bg text width top postTitle font size rem linkText font size rem contactIcons font size rem Explaination First we have set the background image and other background properties of bg image class then we have blurred the element using filter property Then we have styled the bg text class The properties position top left transform is used to put the element inside the element with class bg image and z index means it will be in upper layer and the blurred element will be in lower layer and rest of the styling is normal css Then we have set the size of icons using the class name contactIcons and we have given this classname to all the icons elements Then we have used the media queries to adjust the elements size according to screen breakpoint Output PC View Output Phone ViewThats it for this post THANK YOU FOR READING THIS POST AND IF YOU FIND ANY MISTAKE OR WANTS TO GIVE ANY SUGGESTION PLEASE MENTION IT IN THE COMMENT SECTION You can help me by some donation at the link below Thank you gt lt Also check these posts as well 2022-02-10 16:27:18
海外TECH DEV Community Simple Angular To Do App - part 2 https://dev.to/lorenzojkrl/simple-angular-to-do-app-part-2-554m Simple Angular To Do App part In the previous post we started building a simple to do app and we were able to log data from the input element to the console If you click on the Add button you should see the value of userInput in the console In this post we will do the following create an array to store a list of elementssave amp display data from the input elementadd functionality to remove items from the list Create an array to store a list of elementsWe need to add some code to our application to display a list of items Let s start from the template file app component html Immediately under the form we add the following code app component html lt ul gt lt li ngFor let item of todoList gt item lt li gt lt ul gt I am assuming you are familiar with lt ul gt and lt li gt tags What is more interesting is that ngFor stuff If you are not familiar with it read the ngFor syntax like this For each item inside todoList create a new lt li gt and add that item into the newly created lt li gt Where is todoList We don t have it yet But as the name suggests todoList will contain a list of items Later we will add the data coming from the input element to todoList Let s define an array that we call todoList into AppComponent app component ts export class AppComponent title string Ng To Do subtitle string Write something to do in the form userInput string undefined todoList string Study Angular Add one elememt Correct typo onSubmit void console log this userInput Note that the type of todoList is string is typescript and you can read it as an array of strings Save amp display data from the input elementWe will work with the onSubmit method to add the user input to todoList app component ts onSubmit void console log this userInput this todoList this todoList concat this userInput You could use push instead of the concat method but I prefer to follow a functional programming pattern For the purpose of this exercise either one is fine Now you can see the items coming fromt the input element in your app Remove items from the listWe will remove items brutally First of all we add an onDelete method to app component ts onDelete takes one parameter of type string Then we use the javascript filter method and the functional programming pattern to create a copy of todoList that contains only the items left after the user decides to delete some items app component ts onDelete itemToDelete string void this todoList this todoList filter item gt item itemToDelete Finally to make magic happen we need to add some code into the template As we did before we will use event binding click onDelete item app component html lt ul gt lt li ngFor let item of todoList click onDelete item item lt li gt lt ul gt This is kinda working Now you can remove items by clicking on them In other words by clicking on the text you trigger the onDelete method that executes the javascript code to filter out the item you want to delete You can find the code here Conclusion amp New BeginningThe app is working but it is definitely a raw piece of code Accessibility is bad items with the same text get deleted together style well you see that However since there are many ways to proceed I need some push So here are some options what do you prefer Add some CSS to this crappy styleImprove accessibilityImprove functionality one click one deleteAdd validations to the input Rewrite this app to use proper Angular FormsWrite your preference in the comments You can also propose something different 2022-02-10 16:24:37
海外TECH DEV Community The guide to cloning objects in JavaScript https://dev.to/nicozerpa/the-guide-to-cloning-objects-in-javascript-5agn The guide to cloning objects in JavaScriptCopying and cloning objects in JavaScript is tricky It s one of those things that look easy but can cause unexpected bugs and errors that are difficult to solve if you don t know well how the language works Let s begin with what doesn t work If you try to copy an object or an array remember arrays are objects in JavaScript like this const originalObject name Sarah favouriteFoods chicken pizza pasta Attempt to copy an objectconst copyObject originalObject It doesn t really work because you aren t actually copying anything If you change something in copyObject that change will also appear in originalObject Look Changing a property in the copy copyObject name Jon The change is also in the original objectconsole log originalObject name Outputs Jon Why does this happen When you create a new object the JavaScript engine allocates space in the memory and stores the object there Then you get a number known as the address that indicates the exact location of that object in memory The JavaScript variable becomes a reference to that position in the memory where the object is stored When you re using the assignment operator to attempt to copy an object what you re actually copying is the memory address not the object itself So you end up with two different variables that refer to the very same object Creating shallow copiesJavaScript now provides two ways to create copies One way is to use the spread operator const copyObject originalObject And another one popular when the spread operator didn t exist is to use the Object assign method const originalObject name Sarah favouriteFoods chicken pizza pasta const copyObject Object assign originalObject Both approaches work well You are actually creating a new object this time Now copyObject is in fact a different object than originalObject Changing a property in the copycopyObject name Alexandria The original object remains unaffectedconsole log originalObject name Outputs Sarah But there s a problem when you try to change the favourite food list Adding a new favourite food to the copycopyObject favouriteFoods push sushi The new food was also added to the original console log originalObject favouriteFoods Outputs chicken pizza pasta sushi What happened here was originalObject favouriteFoods is an array object and when we created the new copyObject we copied again the memory address of favouriteFoods Thus we have two properties originalObject favouriteFoods and copyObject favouriteFoods that are references to the same object in memory That s why this type of copy is known as a shallow copy If the object only has primitives i e values that aren t objects they re copied just fine But it fails if it has nested objects inside Deep copiesThe solution to this problem is creating deep copies A deep copy is a copy that also clones nested objects resulting in an object that is completely separate from the original There are a couple of ways to create this kind of copy You can convert the object to a JSON expression and then convert it back to an object That creates an entirely new object but it doesn t work well if you have some special types of values e g NaN Infinity regular expressions dates and a couple of others This is how it works const copyObject JSON parse JSON stringify originalObject Another alternative is using an external library like lodash s cloneDeep method Install it by using the command npm i save lodash clonedeep import cloneDeep from lodash clonedeep const copyObject cloneDeep originalObject A very new function that is being added to most platforms is structuredClone This function is still not available everywhere probably you ll have to wait until it s safe to use const copyObject structuredClone originalObject If you handle simple objects and you know it doesn t have any nested objects or arrays using shallow copies especially using the spread operator is OK But if those objects have more objects inside it s a better idea to create a deep copy using one of the techniques above p s Did you like what you ve read Every week I send an email with free tips and insights to become a better JavaScript dev If you re interested 2022-02-10 16:21:51
海外TECH DEV Community Do Possums Eat Chickens? Here’s How to Protect Your Poultry https://dev.to/khurshi23363103/do-possums-eat-chickens-heres-how-to-protect-your-poultry-3412 Do Possums Eat Chickens Here s How to Protect Your PoultryDo possums eat chickens Truly Whether you see the opossum as a good friend or a monster discovering one in your poultry cage is never ever an enjoyable experience Although the marsupial is an easy pet it s likewise opportunistic and might be a danger to your smaller sized hens and their eggs Standing concerning the height of a domestic feline possums have actually been described as having a “head like a swine …tail like a rat …of the amplitude of a cat These marsupials originated in South America however their versatile diet regimen and also ability to bring to life as much as young each time have made them versatile to a large range of environments With long directed faces as well as round hairless ears possums are in some cases mistaken for rats Not only is the possum no rodent but it s also not averse to the occasional rat treat need to such a possibility emerge Along with the occasional rodent possums will gladly feed on grain fruits and also a variety of plants Possums are also partial to frogs and roadkill ーboth of which supply them with much needed calcium Watch on your pet food too possums will put right into anything from hen mash to pet dog food if it s very easy sufficient to access One last point the American opossum is not like the Australian possum They re not also relevant but do possums kill chickens really With their strong sharp teeth possums are definitely efficient in attacking as well as eating hens Basic response Yes they do They take pleasure in a different diet as well as will happily take advantage of young chicks and also take eggs While uncommon it has been known for possums to take on mature chickens which are typically also huge as well as daunting for the typical possum It is generally thought that given access and chance a possum will help himself to as lots of poultry eggs as he can stand in a solitary resting Scientific researches as well as field experiments state or else Andi Cockcroft executed a collection of area experiments previously this year overlooking nibbles of bread as well as chicken eggs rubbed with syrup While the possums chewed enthusiastically on the bread as well as licked off the syrup they really did not try to break or eat any one of the eggs Research is all well and also good however there are lots of people around who will certainly demonstrate catching possums in the act of consuming hen eggs Either way the very best method is to be careful and protect your eggs as fervently as you do your chickens Possums could be a little a pest in some scenarios yet they additionally bring advantages to the yard farm or homestead Not just do these potential insects take part in pest management themselves hunting down and eliminating roaches rats as well as computer mice they likewise help to maintain tick populaces in control A single possum can eliminate about ticks in a season damaging of those that try to eat them and over of those it finds on the ground Although some fear for their feline buddies believing they can become possum victims instances of a possum eliminating a cat are very scarce It s even more likely your cat will certainly frighten the possum into surrendering than your possum having the final say Do possums eat chickens Normally too passive to be social climbers when it concerns scaling physical structures the possum remains in a league of its own Efficient in climbing concrete wall surfaces along with fencings possums are some of the animal kingdom s most steadfast mountain climbers Possums have solid hind feet and are blessed with an opposable digit that makes climbing a wind A prehensile tail makes them as experienced in a tree as monkeys are possums are more established than nearly any other tiny animal when it concerns climbing up smooth surfaces Possums can climb high trees with significant ability as well as are equally proficient at getting into attics and roofing They allow fans of dark ground level dens but rarely dig their own depending rather on the obsolete burrows of other animals like skunks and also raccoons Possums choose to burrow on open fields and also close to water Their slim hair supplies little insulation so they line their dens with a completely dry yard and also other soft materials to keep out the cold Possums will certainly utilize the crawl space under a house or even an attic room or smoke shaft To make their residences which is much from ideal given their capacity to bring condition In lots of locations it s illegal to harm or kill a possum so finding non lethal types of protection is the only way to go Proper cage safety and security are crucial specifically as possums can squeeze via some surprisingly little spaces to get Possums will not come into your chicken coop with blazing guns or samurai swords They ll probably be pretty sneaky about their nocturnal invasion leaving little proof behind You can however recognize a possum strike by looking out for these indications Easily identifiable impacts with their clawless opposable thumbs on the hind feet there s no mistaking the possum s footprint Possum droppings are relatively large and also similar to dog feces Extra spherical than rat droppings possum feces often tend to be around two inches long as well as around of an inch broad Noticeable bite marks on the bird s neck upper leg or bust Partial remains of their kill Baby chicks missing Eggs missing or damaged coverings visible How to keep possums away from chickensHow to keep away from Possum Killing ChickensElectric FenceMotion Activated LightsUnique Predator LightingObtain Your Animals to Safeguard Your ChickenUltrasonic Possum RepellentGet Your Possum Professionally EliminatedCans with Ammonia Soaked Dust clothsGarlicLeave the Radio OnCoop Protection and also a Little IngenuityAs possums are outstanding mountain climbers wire mesh fences do little to discourage them And for possums eating chickens Below are some ways you can shield your hens from marsupials An electric fence wire around the top of the fencing about three inches from the fence itself will certainly suffice A lot of predators are discouraged by an electrical shock as we are when we touch an electrical fence Motion activated lights in your lawn or around your cage are superb deterrents versus nighttime predators yet If that seems like also a hefty financial investment You could festoon your poultry coop with economical Christmas lights rather You can obtain evening lights that are particularly made to prevent killers in the evening Essentially it imitates a larger killer s eyes which terrifies smaller sized predators like marsupials away Not all canines see chickens as a free meal so if you have pet dogs who live gladly in the yard placed their kennels or beds near the poultry cage They ll quickly raise the alarm system if a possum comes as well close Guinea chickens are remarkably efficient at securing chickens as are donkeys and alpacas Possibly the easiest remedy nonetheless is to get a medium sized fowl to shield your flock Displays of hostility from a Rhode Island Red or Disallowed Rock will be more than enough to frighten off the boldest possum This solution is a trial and error sort of possum repellent Some people have reported excellent success with ultrasonic repellent while others aren t persuaded at all Your local band of possums from targeting your group it s time to contact the specialists Wild animal services use humane catches to capture the possum before relocating it This isn t always the most effective service While moving is stressful for the possum and can be deadly defense is far better than cure Many people promote the use of ammonia to keep possums at bay Garlic is a much more natural alternative and also has the included advantage of keeping bloodsuckers You might try leaving a radio playing in your hen cage overnight The noise must be enough to prevent the possum from keeping your chickens awake all night Just ensure it s a weatherproof radio appropriate for outside use Removing a possum who s located your stockpile of hen eggs is never misting likely to be straightforward And to stop them from accessing your chicken coop in the top place is much more effective Cage safety and security as well as a little resourcefulness can go along It will ensure you have a unified relationship with your neighborhood possums Now I have told everything about possums and do opossums kill chickens Really 2022-02-10 16:15:27
海外TECH DEV Community Refactoring 004 - Remove Unhandled Exceptions https://dev.to/mcsee/refactoring-004-remove-unhandled-exceptions-21kc Refactoring Remove Unhandled ExceptionsCreating YAGNI exception classes pollutes our environment Let s remove them TL DR Remove unnecessary and not references empty exception classes Problems AddressedEmpty ClassesNamespace Polluted Related Code Smells Code Smell Exceptions Polluting Maxi Contieri・Nov ・ min read oop exceptions tutorial programming StepsCheck there are no references to the empty exception class Replace the throw sentence with a generic one Sample Code Beforeclass RangeNotSatisfiedException lt StandardErrorendbegin raise RangeNotSatisfiedException new Range must be betweet and rescue RangeNotSatisfiedException gt e puts e message puts e exception type end After Check there are no references to the empty exception class Replace the throw sentence with a generic one begin raise StandardError new Range must be betweet and rescue StandardError gt exception puts exception message puts exception exception type end Type X AutomaticIf the Exception class has no references we can perform a Safe Remove and replace it with Exception class Why the code is better We remove an empty class nobody uses We shrink the code LimitationsIf we need to declare an empty exception class as documentation for an API module our clients might need to catch it This is a gold plating and YAGNI example TagsClean up Related RefactoringsSafe Remove CreditsImage by danielkirsch from PixabayThis article is part of the Refactoring Series 2022-02-10 16:06:03
海外TECH DEV Community Umbraco Setup/teardown PowerShell scripts. https://dev.to/kevinjump/umbraco-setupteardown-powershell-scripts-2lol Umbraco Setup teardown PowerShell scripts Umbraco embraces dotnet core and all the goodness that brings This includes creating your umbraco site from the command line dotnet new umbraco n myUmbracoSitewhich is super cool and after some intial setup screens you will have your new Umbraco site up and running locally How fast can you go So a while back this meant I got into invented a whole Umbraco speed run challenge KevinJump kevinjump cultiv dAmazingNut rgmbarendse I got it to approx seconds ️if you pre create the db with powershell DBATools amp I now have a nice numbraco ps to create and unumbraco ps to clean up PM Oct And it resulted in me writing some PowerShell scripts that allow me to setup and tear down Umbraco sites really quickly around seconds Now I have shared these scripts before but I ve updated them a bit since then and I need to update what they do gist script is here The SetupIf you save that file somewhere on your computer You can then import this module into your powershell command line Import Module Name C Source Tools umbraco tools psmIf you place that line in your profile ps file usually documents powershell profile ps it will be avalible everytime you start up a terminal For unattended install to work you need to create three environmental variables on your PC UMB USERUMB EMAILUMB PASSWORD The commandsWith the script installed you get three new commands new umbraco create an new umbraco siteremove umbraco remove an umbraco site and the db clear umbracodbs remove all dbs gt New UmbracoCreates a new umbraco site installs packages and sets up unattended installtion so you don t have to do the setup afterwards New Umbraco lt SITE NAME gt options n name name of the project p package list of packages to install f framework framework to use default net nostarter don t install the starter kit package donotrun don t immediately run the site when complete prerelease fetch pre release versions of any packages we ask forFor Example I do this quite often when testing Create a new site don t install the starter kit install uSync package and open the site in VsCode when you have finished New Umbraco MyNewSite noStarter packages uSync codeUsually this is super fast and I can start work right away gt Remove UmbracoRemove an Umbraco installation from disk and remove the db Remove Umbraco lt SITE NAME gt RemoveFolder n name name of site RemoveFolder also delete the folder for the umbraco site gt Clear UmbracoDbsthrough the scripts all umbraco databaswes are created with an umb prefix so the Clear UmbracoDbs command simply removes all these dbs from your local instance good if you know you ve just created a load of trash dbs you need to get rid off 2022-02-10 16:05:58
海外TECH Network World Garter: By 2025 half of enterprise IT spending will be for cloud https://www.networkworld.com/article/3649791/garter-by-2025-half-of-enterprise-it-spending-will-be-for-cloud.html#tk.rss_all Garter By half of enterprise IT spending will be for cloud By of IT spending by enterprise IT groups that can transition to cloudーapplication and infrastructure software business process services and system infrastructureーwill shift to the cloud according to Gartner  Accelerating levels of cloud adoption are expected as organizations respond to a new business and social dynamics according to Michael Warrilow research vice president at Gartner and this is driving a faster rate of cloud shift than pre COVID forecasts predicted To read this article in full please click here 2022-02-10 16:50:00
Cisco Cisco Blog It has been 703 days since we were in the office together. What’s next for Hybrid work? https://blogs.cisco.com/innovation/it-has-been-703-days-since-we-were-in-the-office-together-whats-next-for-hybrid-work It has been days since we were in the office together What s next for Hybrid work As we enter a new era of work businesses need to focus on how to best harness the intellectual capital of digital workers and provide a hyper collaborative environment to help them deliver their best no matter where they are 2022-02-10 16:05:32
海外科学 NYT > Science Snare and Shotgun Injuries Found in Lion and Leopard Teeth and Bones https://www.nytimes.com/2022/02/10/science/lions-teeth-bones-injuries.html Snare and Shotgun Injuries Found in Lion and Leopard Teeth and BonesA study shows that even in a country that is considered a bastion of conservation many big cats were severely wounded in encounters with humans 2022-02-10 16:13:03
金融 金融庁ホームページ 第18回金融審議会公認会計士制度部会議事録について公表しました。 https://www.fsa.go.jp/singi/singi_kinyu/kounin/gijiroku/2021_1224.html 公認会計士制度 2022-02-10 18:00:00
金融 金融庁ホームページ 金融庁職員の新型コロナウイルス感染について公表しました。 https://www.fsa.go.jp/news/r3/sonota/20220210.html 新型コロナウイルス 2022-02-10 18:00:00
金融 金融庁ホームページ 令和4年1月に開催された業界団体との意見交換会において金融庁が提起した主な論点を公表しました。 https://www.fsa.go.jp/common/ronten/index.html 意見交換会 2022-02-10 17:00:00
金融 金融庁ホームページ 第144回自動車損害賠償責任保険審議会議事要旨について公表しました。 https://www.fsa.go.jp/singi/singi_zidousya/gijiyosi/20220124.html 自動車損害賠償責任保険 2022-02-10 17:00:00
金融 金融庁ホームページ 金融審議会「ディスクロージャーワーキング・グループ」(第6回)を開催します。 https://www.fsa.go.jp/news/r3/singi/20220218.html 金融審議会 2022-02-10 17:00:00
金融 金融庁ホームページ 「ソーシャルボンドのインパクト指標(社会的な効果に係る指標)等に関する委託調査」の最終報告書について公表しました。 https://www.fsa.go.jp/common/about/research/20211221/20211221-1.html 調査 2022-02-10 17:00:00
金融 金融庁ホームページ 金融審議会「ディスクロージャーワーキング・グループ」(第5回) の議事録を公表しました。 https://www.fsa.go.jp/singi/singi_kinyu/disclose_wg/gijiroku/20220119.html 金融審議会 2022-02-10 17:00:00
金融 金融庁ホームページ プレス・リリース「中央銀行総裁・銀行監督当局長官グループは、バーゼルⅢ枠組みの実施に関する合意を一致して再確認するとともに、パブロ・エルナンデス・デ・コス氏をバーゼル銀行監督委員会の議長に再任」について掲載しました。 https://www.fsa.go.jp/inter/bis/20220210/20220210.html 中央銀行 2022-02-10 17:00:00
ニュース BBC News - Home Covid: Charles met Queen two days before testing positive https://www.bbc.co.uk/news/uk-60334842?at_medium=RSS&at_campaign=KARANGA royal 2022-02-10 16:54:38
ニュース BBC News - Home Johnson broke law over No 10 parties, says ex-PM Sir John Major https://www.bbc.co.uk/news/uk-politics-60331189?at_medium=RSS&at_campaign=KARANGA johnson 2022-02-10 16:41:16
ニュース BBC News - Home £150 cost of living payments for Scottish households https://www.bbc.co.uk/news/uk-scotland-scotland-politics-60336046?at_medium=RSS&at_campaign=KARANGA extra 2022-02-10 16:41:07
ニュース BBC News - Home Dagenham drop Zouma brother over cat video https://www.bbc.co.uk/sport/football/60339439?at_medium=RSS&at_campaign=KARANGA kicking 2022-02-10 16:24:47
ニュース BBC News - Home Sting sells all of his songs to Universal https://www.bbc.co.uk/news/entertainment-arts-60330420?at_medium=RSS&at_campaign=KARANGA sting 2022-02-10 16:01:30
ニュース BBC News - Home Vettel wants F1 to put sport before show as Aston Martin launch 2022 car https://www.bbc.co.uk/sport/formula1/60325767?at_medium=RSS&at_campaign=KARANGA Vettel wants F to put sport before show as Aston Martin launch carSebastian Vettel says the controversy over last year s title decider shows Formula needs to focus on sport rather than entertainment 2022-02-10 16:08:43
ニュース BBC News - Home 'We didn't anticipate the level of fallout' - Raith boss McGlynn 'sorry' over Goodwillie signing https://www.bbc.co.uk/sport/football/60337753?at_medium=RSS&at_campaign=KARANGA x We didn x t anticipate the level of fallout x Raith boss McGlynn x sorry x over Goodwillie signingJohn McGlynn apologises to Raith Rovers fans for the enormous error in signing David Goodwillie 2022-02-10 16:13:22
ビジネス ダイヤモンド・オンライン - 新着記事 身近な人が亡くなったら、免許証やパスポートは放置OK? リスクは? - ぶっちゃけ相続「手続大全」 https://diamond.jp/articles/-/296014 運転免許証 2022-02-11 01:55:00
ビジネス ダイヤモンド・オンライン - 新着記事 【不動産投資こそFIREへの近道】 金融機関を味方につける最強のツールとは? - 元証券ウーマンが不動産投資で7億円 https://diamond.jp/articles/-/295984 2022-02-11 01:50:00
ビジネス ダイヤモンド・オンライン - 新着記事 「死ぬ前に後悔する人、しない人」の決定的な差 - Invent & Wander https://diamond.jp/articles/-/295918 inventampampwander 2022-02-11 01:45:00
北海道 北海道新聞 NY株、反落 https://www.hokkaido-np.co.jp/article/644536/ 工業 2022-02-11 01:15:00
北海道 北海道新聞 スウェーデンが白星発進 アイスホッケー・10日 https://www.hokkaido-np.co.jp/article/644535/ 白星発進 2022-02-11 01:07:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

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

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