python |
Pythonタグが付けられた新着投稿 - Qiita |
ABC 270 回答メモ |
https://qiita.com/Konini64/items/6e9bfc8a7224f79d2ee1
|
atest |
2022-09-24 23:59:25 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
【Salesforce】【資格】JavaScriptデベロッパー勉強メモ |
https://qiita.com/piepie1231/items/7b535c827489da4795e0
|
javascript |
2022-09-24 23:20:13 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
Amazon Comprehend とは |
https://qiita.com/miyuki_samitani/items/8c2dfc0445d899f11515
|
amazoncomprehend |
2022-09-24 23:54:05 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
Redshift Serverlessの使用制限を使ってみた |
https://qiita.com/m-duct/items/c99623fed0e457b88b90
|
redshiftserverless |
2022-09-24 23:43:03 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
VSCodeでTypeScript×Nodemon×Dockerのデバッグ環境構築 |
https://qiita.com/omukaik/items/b0e88dd8540798d9252c
|
docker |
2022-09-24 23:13:51 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
Azure Cosmos DBコミュニティチャンピオンの「Cosmos DBアンチパターン」 |
https://qiita.com/yyukawa/items/2fcf42dbb66532d0c757
|
azurecosmosdb |
2022-09-24 23:54:59 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
開発中にファイル名を変更した際にはgit mvコマンドを使う |
https://qiita.com/shuhei_m/items/cbcab614d5f3ee3397f3
|
gitmv |
2022-09-25 00:00:08 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
[Git] いいかげん理解したいgit reset ~ addの取り消し、commitの取り消し |
https://qiita.com/DaichiA/items/9dae68fe333679943f37
|
commit |
2022-09-24 23:37:27 |
技術ブログ |
Developers.IO |
TrelloのButlerを使って期限が2日前のカードをDoingリストに自動的に移動 |
https://dev.classmethod.jp/articles/use-trellos-butler-to-automatically-move-cards-that-are-due-2-days-ago-to-the-doing-list/
|
butler |
2022-09-24 14:50:34 |
海外TECH |
MakeUseOf |
Is the “Show Accent Color on Start and Taskbar” Option Disabled on Windows 11? Here’s How to Fix It |
https://www.makeuseof.com/windows-11-show-accent-color-disabled-fix/
|
Is the “Show Accent Color on Start and Taskbar Option Disabled on Windows Here s How to Fix ItIf you can t set the account color on the Start menu and taskbar it s an easy fix on Windows |
2022-09-24 14:15:13 |
海外TECH |
DEV Community |
ES Modules & Import Maps: Back to the Future |
https://dev.to/valeriavg/es-modules-import-maps-back-to-the-future-56o
|
ES Modules amp Import Maps Back to the FutureThere was a time when creating a web page meant creating an html file yet nowadays it seems impossible to build any frontend without the bottomless pit of node modules yielding a finely chewed yet hefty bundle xyz js Well I got to learn that it might not be the case soon and naturally I feel the urge to share it with the rest of you Start with HTMLThe barebones page in HTML looks like this 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 Hint I got this template by typing html in my VSCode thanks to Emmet abbreviations Add a moduleNow let s say we would like to add a framework to it Preact for example We could do it like this lt body gt lt div id app gt lt div gt lt script type module gt import h Component render from import htm from Initialize htm with Preact const html htm bind h function App props return html lt h gt Hello props name lt h gt render html lt App name World gt document getElementById app lt script gt lt body gt You can open the page in your browser as a simple file and see that it actually works And that is the power of modern ECMAScript modules that are defined by simply adding type module to a script tag For such a simple page it works great but it can quickly become hard to work with once we add more pages Let s create another 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 Counter lt title gt lt head gt lt body gt lt div id app gt lt div gt lt script type module gt import h Component render from import useState from hooks import htm from const html htm bind h function Counter const count setCount useState return html lt button onClick gt setCount n gt n gt Count count lt button gt render html lt Counter gt document getElementById app lt script gt lt body gt lt html gt It s a good practice to specify the exact version of dependencies to avoid breaking changes but updating those will be a mess right Gladly no Because we could write an import map Import MapsAn import map is a JSON that tells browser where to find a certain import by its alias For example we could create an import map with the following contents imports preact preact htm And include it on both pages like this lt body gt lt div id app gt lt div gt lt script type importmap gt imports preact preact htm lt script gt lt script type module gt import h Component render from preact import useState from preact hooks import htm from htm Initialize htm with Preact const html htm bind h function App props return html lt h gt Hello props name lt h gt render html lt App name World gt document getElementById app lt script gt lt body gt Quite neat right You could also use it to reference your own components and avoid long paths Ah future is bright But we re not quite there yet Unfortunately import maps are still unofficial draft and therefore some vital features like including an external import map from a json file is not supported or they are not supported at all in some browsers e g Safari But I want to use it RIGHT NOW I hear you so am I And I do have some good news for us there is a mature JavaScript runtime called deno that supports ESM and import maps out of the box And fresh framework for example is a delight to work with I ve recently migrated my blog to Fresh from Hugo and I can t wait to finally implement some of the dynamic features I have been postponing for too long |
2022-09-24 14:23:37 |
海外TECH |
DEV Community |
15 Problem Solving Steps to Improve Your Development Skills |
https://dev.to/marktecher/15-problem-solving-steps-to-improve-your-development-skills-1hak
|
Problem Solving Steps to Improve Your Development Skills IntroductionI will tell you everything I have learned about problem solving during my more than ten years of work experience in software engineering This guide follows the universal problem solving framework That is why this can also be helpful for people who aren t software engineers Here is a shortened list of points of the problem solving framework Define the problemGenerate potential solutions and choose one solutionImplement and follow upLet s dive into the points and implement the framework for the software engineering domain Define the problemThis is the most important step If we do not define the problem correctly we won t be able to solve it Often we don t formulate the problem correctly from the outset or we don t have enough data to know what the real problem is Not having a well defined problem from the beginning is an issue but as we will see in this article some of our steps will help us to do it Know that your setup is uniqueMaybe you are using an old version of a software or library The combination of different hardware operating systems software and different versions of the above will make each setup unique The uniqueness of each setup is one of the reasons that many software vendors ask you to send your system information when you create a bug report or report an issue on an open source project When defining the problem you need to consider the specifics of your system Reduce the scope of the issueYou need to isolate the problem This way you can find the root cause of the problem If you have a tricky issue and you think that your system contributes to the problem try to reproduce the issue on Isolated environmentAny software can be run in an isolated environment Here are some examples If you are working on a desktop application you can run the setup in a docker container If you re doing system development you can boot the operating system in safe mode If you re doing browser extension development you can disable other browser extensions In general if you re working with a source code you can isolate a feature logic or component from the rest of the system The previous version of the softwareYou might want to use previous stable versions of the software and see if the issue reproduces The art of searchTo ask the right question is already half the solution to a problem Carl Gustav JungYou have reduced the scope of the issue and have a great candidate for the root cause Great Now is the time to find the solution to the problem One of the fastest ways to find solutions to software problems is a Google search Sometimes we find the solutions pretty quickly But if the issue is not common we need some more work Here we need some searching skills First of all we need to find the language needed to describe the issue Many times Google will give hints on the language used by more advanced users Let s consider a trivial example Imagine that we are learning frontend development and we want to design our new website in a way that will look beautiful on all screen sizes and will be easy to use on all devices We will go to Google and type something like this change website structure based on screen sizes Quickly looking onto the search results page specifically onto the search results page s titles and the Related searches section we can find that the type of websites we are looking for is called responsive websites So if our initial query didn t have the industry term we can use the term responsive design in the subsequent queries This is the industry jargon Using industry jargon in your search queries is important Many articles videos and posts on the Q amp A websites use industry jargon You will certainly find great resources when you use industry jargon in your searches Our initial query change website structure based on screen sizes returned a lot of beginner friendly articles Some of these articles didn t use jargon in their titles You might think it is okay to use simple words and avoid jargon but that s not the best idea Industry jargon will help you find solutions to non trivial issues because they are written for professionals and advanced level users We ve seen a nice feature of the Google search Being a total newbie in the problem area we discovered terms used by professionals Similarly we can further improve our query step by step If we didn t find the answer with a simple search we could use Google Search operators One of the most used operators that will help us during the search is the text in double quotes like this problem solving in software engineering This will tell Google to fetch the pages only if they have the problem solving in software engineering phrase exactly as it is written exact match Variations and partial queries like problem solving will not be considered For example exact match search is helpful if you want to search with the exact error message Another helpful operator is the website name If you want to search only inside stackoverflow com website you can add site stackoverflow com before or after the search query For example You might think you can do the same if you search for the answer on the StackOverflow website You can do this but keep in mind that this is a completely different search engine This is Stackoverflow s internal search engine In general Google is superior to internal search engines because of the PageRank and RankBrain algorithms and because obviously Google possesses more data and advanced search algorithms Keep in mind that some articles might not be available on Google s search engine For example a search on StackOverflow might provide results you might not find in Google s search results This can happen if an article is new and Google hasn t yet added it to its index If I have lost you there don t worry If you check how Google search works you will improve your search game Generate potential solutions and choose one solutionNow that we have defined the problem it s time to generate potential solutions We did the steps before and eventually found the root cause of the problem The initial root cause can turn out not to be the actual one We might find that out if we start applying the potential solutions In practice potential solution generation consists of two phases The rapid phase We search for the solution on the internet and we apply the suggested solutions In a nutshell we check if the problem has occurred to other people Many issues are common and the solution is already provided on the internet We don t want to reinvent the wheel or stay longer with the problem so it s wise to look for a solution on the internet as the first step The strategic phase We accept that the problem is not simple and we give ourselves time to solve it We take the problem apart and do deeper research Here we formulate hypotheses isolate them check the isolated hypotheses and prove them wrong or right We can start fixing the problem as soon we have found the reason Apply fixesLet s talk about the rapid solution seeking process If we have a coding problem it s not a secret that many of the answers will come from the Stackoverflow website If there is an accepted answer chances are high that the proposed solution will work Note that the process is similar for all other helpful Q amp A websites even in different industries and domains Most of them have a notion of an accepted recommended solution and upvoted answers If the accepted answer doesn t work we tend to try out the other solutions that have been given positive usefulness points upvotes If popular Q amp A websites do not have the answers we are looking for we can check the other pages in the search results In many cases there are great blog posts addressing the issue with detailed explanations sometimes going into the fundamentals They may help us to find the solution Remember one thing though Everything on the internet does not come with the highest quality If an article for the solution to your problem ranks on the first page of Google that does not necessarily mean that the article is the best among the peers and that the solution will work Did you even read the docs So the answer wasn t on the community forum websites or even in the blogs That s bad That means you have a tricky problem Either it is a weird case or the software or library you are using is not that popular Now it is time to start the deep research phase It may be a good idea to read the docs now I would start with the topics around the issue If that is not enough and you have enough time you can read more and more about the library or software Note that the information in the docs should be up to date If it turns out that that s not the case then you can report an issue Ask your colleaguesThis is a crucial step Whether your colleagues will be able to give you an answer depends on the question The problem that you are facing today may be a well known problem for your colleagues Your team might forget to tell you about well known problems or shortcomings of the system Even if it s not a well known problem you might have a colleague who has deeper knowledge in the domain of the issue and can help you find the fix quickly You need to be shameless here Not asking questions can be counterproductive If your colleagues can help you solve the problem in a couple of minutes but you spend more time figuring it out yourself without asking the question then you re wasting time That means you are not working efficiently Ask the communityIf the rapid phase didn t help us to find the solution we must give ourselves time and change tactics This and the following steps show how we can do it We visited community Q amp A websites in the previous steps If nobody asked a question about the problem we are facing on the Q amp A websites like Stackoverflow and the community and support forums we can do it ourselves and ask the question Here s a way to maximize the chances of getting answers in the shortest possible time Official vendor websites point out recommended places for community support Many times you can find them in the Contact us section There you can find vendors recommended Q A websites for asking questions When a company indicates recommended places to ask questions that usually means that their employees or the most active community members are regularly checking the questions there which means there s a great chance to get quick and reliable answers to your questions You can see the React js framework s Where To Get Support page below In any case it won t hurt to ask questions on generic Q amp A websites stackoverflow com or on another related website of the Stack Exchange network in addition to the vendor forums Reading the documents as was stated in the previous steps would help us formulate the question in a way that would be easy for the community to answer it Additionally Stackoverflow and other websites suggest including minimal code snippets and environment details so that people can quickly reproduce the issue and check their answers before posting them This means that you would help people to help you The isolated hypothesis checking process discussed above might help us to generate a minimal isolated snippet and attach it to the question Time outYou did the previous steps as fast as possible and you posted the question on the community forums You probably never took a break while doing all the steps discussed above You may have been in such a rush that you didn t even notice how time passed But the whole world is not that interested in the problem you are solving Community members are living their lives and aren t impatiently waiting for questions Though in some cases you might be lucky and get a fast answer Now that you posted the question in the community forum it s time to take a break The break would help in the following ways You can have coffee or refreshments take a walk or speak with colleagues You can do other non work related stuff planned for the day etcetera Sometimes you need to slow down to understand the problem As surprising as this might sound you might not have thought enough about the problem while doing the previous steps I remember a day when a colleague of mine was honest and said he had tried to solve a problem without thinking about it He then realized that the problem was not trivial and that he needed to understand it to solve it The reason he confessed was he wanted to tell us that the problem was tricky and that we needed to allocate a lot more time for it and avoid entering autopilot mode Locate the source codeThe order of the steps can be different for different people For example some people love to check the source code even before they check the documentation The source code provides the most accurate documentation Documentation can be incorrect or obsolete but the source code cannot lie Note that you need to make sure you are checking the source code of the correct version of the software Obviously the source code needs to be readily available Fortunately the majority of popular software development tools are open source That means that you can easily find their source code on the internet If the software is not open source it s still possible to analyze its source code Here s how If the software is on your machine and is written in scripting and interpreting languages like Python or Bash then you already have the source on your machine Easy If it s written in Java or another bytecode language you can use bytecode decompilers to recover the code from the bytecode Here s what you can do if the software is hosted on the cloud or it s a software as a service SaaS If the problem occurs on the frontend you have the code because Javascript is a scripting language Your browser downloads the Javascript source code in order to execute it The easiest way to analyze what is happening with the Javascript code is by using a browser debugger During the frontend debug some requests would go to the backend with APIs If you see the wrong answer coming from the API backend you can check which endpoint it is When inspecting the Javascript in your browser you will have the endpoint and a request payload You can tweak and repeat the request and investigate the endpoint The backend behind the API unfortunately is a black box You can t see the code that runs the backend behind the API However sometimes you can get an idea of what s happening there Now that you have looked at the source code you can debug the code in your mind Many experienced software engineers can debug and run many lines of code in their minds You can use debuggers to debug it if the issue is in the software code you are working on If the issue happens on the library code debugging is harder It will take quite some time to set up a debugger on the library s source code In most cases this is unnecessary because you are not one of the library developers Overlooked support channelsThis step can be skipped by many of us Your company might have dedicated support channels with software and library vendors If this is the case you already guessed it Ping them When we were hosting a non trivial setup on Amazon Web Services AWS sometimes we needed to go deep into the documentation to check how to configure some tasks We were spending considerable time on this until a colleague checked and found that our company had dedicated support from Amazon This is not common and it makes sense for big accounts Instead of spending time figuring out how to do the next advanced config our colleague would fire an email to the support center The colleague didn t stop there Turned out that there was phone support as well Email support usually takes longer than phone support right So instead of sending emails our colleague would immediately pick up the phone and call them I think the support team at Amazon Web Services hated him but we loved him It is important to note that people working in support centers must know the documentation very well and the chances are higher that they will give you great advice in a much shorter amount of time Moreover support teams have access to powerful tools that are not meant to be shared with clients Remember ーwith great power comes great responsibility That s one of the reasons that companies don t give the public access to these sensitive tools For example the Amazon Web Services support team sometimes did the configuration for us instead of telling us how to do it They even made changes that wouldn t have been possible with the public user interface Call it a daySo you ve spent a lot of time on the issue and it still isn t resolved Well there s a weapon in this case Call it a day If it is time to go home you can go home Staying overtime to solve the problem during the day may be counterproductive for several reasons You have now stayed too long with the problem You have some crystalized ideas about how the problem should be solved It s difficult to come up with different approaches if you don t take a break Secondly you might be tired It is the end of the day and you have spent much more energy solving a difficult problem than you would spend on a regular day With a tired brain and body you can t perform efficiently You will need full energy tomorrow so you need a good rest If you get high quality sleep you can even go to work earlier than usual You will not be disturbed much when you work early in the morning and you will have a mind So it s a good idea to move the overtime hours to the next morning As a bonus since you will come earlier than usual the next morning you can leave sooner that day The solution or even several possible solutions may come to you while you re resting during the night As you might know this happens I listed some reasons you need to call it a day What if it s not the time to go home If it s around p m you might also want to call it a day and work on a routine task that you have to do anyway Choosing a solutionNo matter what process we use when generating solutions we will have one or many solutions We need to implement the solution that is the most efficient maintainable and doesn t change our existing system too much Sometimes the decision is evident and we can implement the solution Other times the solution might require significant or risky changes If that is the case it s a good idea to talk with the team and together decide which path to take to solve the problem Implement and follow upI ve already talked about defining the problem seeking the solution and choosing the best one The listed items are a critical part of problem solving The way a solution is implemented however is crucial as well In an ideal case the implementation would be reliable fundamental fitting in the design flow and clean There are situations when the best solution cannot be implemented because of shortcomings in our setup In this case we need to adjust the solution to the system or implement a suboptimal solution Remember that something that works today is better than something perfect that would work sometime in the future Note that sometimes we might be unable to apply the best solution not because of our system s shortcomings but because third party software and services are the blockers CleanupViola You have solved the problem by finding the root cause evaluating the solutions picking one of them and implementing it in our system What s next We need to revert the fixes that didn t work When we stay longer with the issue we tend to apply many changes even the ones that do not affect the system in any way or worse than that the changes may have a side effect on other system functions We need to clean up the code that didn t help Though it will help a lot when the cleanup is done during the evaluation process when the solutions are tried Delivering the solutionAfter the cleanup we can do the delivery process We need to After the cleanup we can start working on the delivery process We must ensure that we have thoroughly tested the change and that the code follows the accepted standards If everything is in place we can send the code to be reviewed so that team members can evaluate the final solution If everything is fine the solution can be delivered to end users Since the delivery process is different depending on the type of software I will not go into the details Follow upYou just have solved a problem You might have learned important lessons You can document what you ve learned because writing notes about the solution will crystalize the solution for you Since you might forget the solution after a year noting down the solution will help you if the problem occurs anywhere else I have a great advice for you that I have learned from one of my colleagues It s a good idea to start doing this if you aren t doing it already One day we were pair programming with a senior colleague of mine We were sitting in front of his computer I saw a file that day that would change the way I work What was inside this magic file It was a simple text file containing server URLs usernames workarounds fixes to common problems and everything you might need to look up regularly I could not believe my eyes How could I have been in the industry for five years and have not come up with such a brilliant idea Quickly after I created my version of the file I use this kind of file for each company and project If you want to create the file I suggest making it an offline plain text file The file should be as simple as possible and ideally accessible with just one click You may want to add the solution to the problem you just solved to the file In Addition if you posted a question in the Q amp A forums it would be great if you would provide the answer that worked for you You would help the community ConclusionSoftware engineers solve problems every day Many of the issues that we see are new This is because Software changes fast With version updates a piece of software can change drastically Software and libraries come and go and a different set of software combined with different project requirements often creates unseen before problems If we notice patterns in these problems and use a well defined process to solve them we will become great problem solvers in software engineering This guide introduced a framework for problem solving and an implementation of the framework with detailed sequential steps Hope that you liked it You can find my publications on my LinkedIn profile page Please feel free to add additional steps you use when solving problems in the comments below |
2022-09-24 14:14:05 |
海外TECH |
DEV Community |
Using React to create a Budget Manager |
https://dev.to/gbadeboife/using-react-to-create-a-budget-manager-59jh
|
Using React to create a Budget ManagerKeeping track of daily expenses can be difficult especially if a lot of items are purchased As a result we might not be aware of where particular expenses in our budget are allocated an app that keeps track of our spending and displays it in a concise precise manner is therefore essential The prerequisites for this project are Knowledge of CSS Javascript and ReactLatest version of Node js installed Getting startedFirst we create a new React app in the terminal using the code below npx create react app Budget managerNext we create a folder in the src directory to store all of our app s components and styles In Parent js file we import React the hooks required for our project and define our Parent component import React useState useEffect from react function Parent return export default ParentNext we utilize the usestate hook to store the the list of purchases made and input text const purchases setPurchases useState const purchase setPurchase useState const dates setDates useState const category setCategory useState const cost setCost useState Building the operations of the appWe have to define of the activities that can be done on the app We also define functions to update the values of the different sections of a purchase const purchase e gt setPurchase e target value const category e gt setCategory e target value const cost e gt setCost e target value const savePurchase gt setPurchases prevState gt prevState key uuid id uuid purchase purchase category category date current date cost cost setPurchase setCategory setCost setDates const deletePurchase id gt const filteredPurchases purchases filter purchase gt return purchase id id setPurchases filteredPurchases In the above code The savePurchase function appends a new object to the purchase array The key and id are generated with uuidv It is set up using npm install uuidv in the terminal and the following line of code imports it into the project import v as uuid from uuid The deletePurchase function takes in an id argument and returns a filtered purchases array Creating a statistics sectionOur app needs a statistics area to display the budget and total money spent The cost of each purchase is added to a totalSpent array and the array s sum is used to determine the total amount spent The useEffect hook is used to perform this so that the total is executed each time the purchases array is changed useEffect gt const totalArray purchases map item gt const value item cost const num parseFloat value return num setSpent totalArray reduce a b gt return a b purchases In order to load the app we want the proposed budget to be entered by the user In App js we import the Parent component and display the app if a condition is met import React useState from react import Parent from components Parent function App const budget setBudget useState const page setPage useState true const updateBudget e gt setBudget e target value const saveBudget gt setPage page return lt div className App gt page lt div className createbudget gt lt h gt Get started by creating a new budget lt h gt lt input onChange updateBudget type number gt lt button onClick gt saveBudget className createbudget gt create lt button gt lt div gt lt Parent budget budget gt lt div gt export default App The code above displays an input field when page is set to true the useState hook is used to update the value of the budget variable When the submit button is hit the value of page is changed to false making the app display the parent component Defining our componentsNext we ll define the Createpurchase Stats and Tablelist components which will be imported to the Parent component Our Createpurchase component displays a form that collects the information to be stored in a purchase it is passed a number of props each of which is allocated to a function in the Parent componentimport React from react function Createpurchase save pur categ cost update return lt div className create gt lt h gt New Purchase lt h gt lt div gt lt label gt Purchase lt label gt lt input type text onChange pur value update pur gt lt div gt lt div gt lt label gt Category lt label gt lt select onChange categ value update categ gt lt option gt Housing lt option gt lt option gt Food lt option gt lt option gt Transportation lt option gt lt option gt Utilities lt option gt lt option gt Medical lt option gt lt option gt Personal lt option gt lt select gt lt div gt lt div gt lt label gt Cost lt label gt lt input type number onChange cost value update cost gt lt div gt lt button onClick save gt save lt button gt lt div gt export default CreatepurchaseThe stats component displays both the total amount spent and the budget provided by the user import React from react function Stats spent budget return lt div className statistics gt lt span gt lt h gt Spent lt h gt lt p gt spent lt p gt lt span gt lt span gt lt h gt Budget lt h gt lt p gt budget lt p gt lt span gt lt div gt export default StatsAnd the Tablelist component comprises of the structure for a purchase saved in the app import React from react function Tablelist purchase category date cost del id return lt div className list gt lt p className purchase gt purchase lt p gt lt p className category gt category lt p gt lt p className date gt date lt p gt lt p className cost gt cost lt p gt lt button onClick gt del id gt delete lt button gt lt div gt export default TablelistThe Createpurchase Stat and Tablelist components have been successfully defined but they still need to be imported into the Parent js file We return our imported components in the Parent component and assign their props to our defined functions import Tablelist from Tablelist import Createpurchase from Createpurchase import Stats from Stats function Parent budget return lt div gt lt div className dashboard gt lt Stats spent spent budget budget gt lt div gt purchases map row gt lt Tablelist purchase row purchase key row key category row category date row date cost row cost del deletePurchase id row id gt lt Createpurchase save savePurchase pur purchase categ category cost cost update updateValues gt lt div gt Adding a cost tracker chartOur budget manager is almost complete and the final thing to be added is a chart that displays the total cost spent on each category of purchase The chart used in this project is gotten from Recharts it is installed with the following line of code in the terminal npm install rechartsTo accomplish this we first create a Chart js file in our components folder and then import the required resources to include a chart in our app Next we add the chart s content import React from react import PieChart Pie Tooltip from recharts function Chart data return lt PieChart width height gt lt Pie dataKey value isAnimationActive false data data cx cy outerRadius fill bbd label gt lt Tooltip gt lt PieChart gt export default ChartAn array of values will be assigned to the chart s data prop which will be displayed in the chart lt div className chart gt lt Chart data chartData gt lt div gt chartData in the code above is an array that sums the total cost for each category Storing purchases using LocalstorageWe ll utilize the javascript Localstorage method to ensure that the purchases are not lost if the user leaves the app useEffect gt const data JSON parse localStorage getItem Purchases setPurchases data useEffect gt localStorage setItem Purchases JSON stringify purchases purchases The first useEffect hook s second argument is an empty square bracket so it runs only when the app is first loaded while the second is only carried out when the purchases array is modified Next we style our app in the Parent css file located in the css folder ConclusionThis article demonstrates a simple way of utilising React to build a budget manager app We are able to do this using React hooks to store various data to be utilised later on and also perform functions when an array is updated You can get the source code for this project on Github a live demo of the site is on Vercel |
2022-09-24 14:04:10 |
海外TECH |
DEV Community |
Code Smell 165 - Empty Exception Blocks |
https://dev.to/mcsee/code-smell-165-empty-exception-blocks-27bg
|
Code Smell Empty Exception BlocksOn Error resume next was the first thing I learned in my first jobTL DR Don t avoid exceptions Handle Them ProblemsFail Fast Principle Violation SolutionsCatch the exception and deal with it explicitly ContextOn early programming days we privileged the systems running before error handling We have evolved Sample Code Wrong badimport loggingdef send email print Sending email raise ConnectionError Oops try send email except AVOID THISpass Rightimport logginglogger logging getLogger name try send email except ConnectionError as exc logger error f Cannot send email exc Detection X Automatic Many linters warn us on empty exception blocks ExceptionsIf we need to skip and ignore the exception we should document it explicitly TagsExceptions ConclusionPrepare to deal with the errors Even if you decide to do nothing you should be explicit with this decision Relations Code Smell Exception Try Too Broad Maxi Contieri・May ・ min read python programming cleancode webdev More Info Fail Fast Maxi Contieri・Dec ・ min read codenewbie programming webdev oop On Error Resume Next Package DisclaimerCode Smells are just my opinion CreditsPhoto by James Best on UnsplashThank you Jan Giacomelli Jan Giacomelli jangiacomelli mcsee testdrivenio You sure can PM Sep Optimization hinders evolution Everything should be built top down except the first time Simplicity does not precede complexity but follows it Alan Perlis Software Engineering Great Quotes Maxi Contieri・Dec ・ min read codenewbie programming quotes software This article is part of the CodeSmell Series How to Find the Stinky parts of your Code Maxi Contieri・May ・ min read codenewbie tutorial codequality beginners |
2022-09-24 14:02:05 |
海外TECH |
Engadget |
'Breaking Bad' creator's next series will stream on Apple TV+ |
https://www.engadget.com/breaking-bad-creators-next-series-will-stream-on-apple-tv-145016952.html?src=rss
|
x Breaking Bad x creator x s next series will stream on Apple TV Back in August Deadline reported that Vince Gilligan was pitching his next series after Better Call Saul to around eight or nine networks and platforms Now the upcoming show has found a home It will stream on Apple TV which has already put in an order for two seasons The still untitled project will star Rhea Seehorn who also played Saul Goodman s wife Kim Wexler in the Breaking Bad prequel quot After fifteen years I figured it was time to take a break from writing antiheroes…and who s more heroic than the brilliant Rhea Seehorn quot Gilligan said in a statement nbsp While official details about the upcoming show have yet to be released previous reports said it s completely unrelated to the Breaking Bad universe Deadline described it as something more akin to The Twilight Zone in that it will be set in our world but will bend reality as we know it Gilligan will be heavily involved in the show s creation as showrunner and executive producer And while the series may not be connected to Breaking Bad and its prequel it will still be part of Gilligan s overall deal with Sony Pictures Television In his statement Gilligan pointed out that the upcoming project will reunite him with Zack Van Amburg Jamie Erlicht and Chris Parnell All three used to be Sony TV co presidents who left the company to work at Apple The tech giant hired Van Amburg and Erlicht back in to give its TV ambitions a boost by making them its video programming division leaders They re quot the first two people to say yes to Breaking Bad all those years ago quot Gilligan said It s still very early days for his next project though so you may have to wait a while for a streaming date |
2022-09-24 14:50:16 |
海外科学 |
NYT > Science |
How a Hospital Chain Used a Poor Neighborhood to Turn Huge Profits |
https://www.nytimes.com/2022/09/24/health/bon-secours-mercy-health-profit-poor-neighborhood.html
|
How a Hospital Chain Used a Poor Neighborhood to Turn Huge ProfitsBon Secours Mercy Health a major nonprofit health system used the poverty of Richmond Community Hospital s patients to tap into a lucrative federal drug program |
2022-09-24 14:36:31 |
ニュース |
BBC News - Home |
Tax cuts: Kwasi Kwarteng's measures benefit richest, Labour says |
https://www.bbc.co.uk/news/uk-politics-63019307?at_medium=RSS&at_campaign=KARANGA
|
angela |
2022-09-24 14:02:28 |
ニュース |
BBC News - Home |
Hurricane Fiona: Canada braces for 'historic, extreme event' |
https://www.bbc.co.uk/news/world-us-canada-63011195?at_medium=RSS&at_campaign=KARANGA
|
storm |
2022-09-24 14:09:50 |
ニュース |
BBC News - Home |
Arsenal 4-0 Tottenham: Gunners cruise to victory in front of record crowd |
https://www.bbc.co.uk/sport/football/62937304?at_medium=RSS&at_campaign=KARANGA
|
Arsenal Tottenham Gunners cruise to victory in front of record crowdVivianne Miedema scores twice as Arsenal cruise to a north London derby victory against Tottenham in front of a record crowd at Emirates Stadium |
2022-09-24 14:48:20 |
ニュース |
BBC News - Home |
Sultan of Brunei pins RAF wings on son at Brize Norton |
https://www.bbc.co.uk/news/uk-england-oxfordshire-63021417?at_medium=RSS&at_campaign=KARANGA
|
sultan |
2022-09-24 14:16:21 |
北海道 |
北海道新聞 |
日本ハム 札幌ドーム最後の5連戦スタート |
https://www.hokkaido-np.co.jp/article/735789/
|
北広島市 |
2022-09-24 23:22:00 |
北海道 |
北海道新聞 |
追撃つかの間 救援陣崩壊 日本ハム(24日) |
https://www.hokkaido-np.co.jp/article/735788/
|
日本ハム |
2022-09-24 23:18:00 |
北海道 |
北海道新聞 |
ヤクルトM2、25日にも連覇 村上の56号は「持ち越し」 |
https://www.hokkaido-np.co.jp/article/735787/
|
持ち越し |
2022-09-24 23:14:00 |
北海道 |
北海道新聞 |
旭川いじめと自殺「ある程度関係」 最終報告で第三者委会見 教育長は引責辞任表明 |
https://www.hokkaido-np.co.jp/article/735773/
|
引責辞任 |
2022-09-24 23:09:14 |
北海道 |
北海道新聞 |
中2自殺との関係、断言せず 旭川いじめ第三者委会見 遺族側は相次ぎ説明否定 |
https://www.hokkaido-np.co.jp/article/735779/
|
関係 |
2022-09-24 23:08:37 |
北海道 |
北海道新聞 |
旭川いじめ遺族「あまりの内容にショック」 コメント全文 |
https://www.hokkaido-np.co.jp/article/735784/
|
旭川市内 |
2022-09-24 23:05:00 |
コメント
コメントを投稿