AWS |
lambdaタグが付けられた新着投稿 - Qiita |
Inspector v2の脆弱性診断内容を「Slackベース」で管理する |
https://qiita.com/gahirosan/items/4a87f695a92cb387a6c2
|
amazoninspectorclassic |
2022-07-17 23:24:50 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Bokeh グラフ再利用時のRuntimeError:Models must be ...に対応する |
https://qiita.com/TKfumi/items/2c9c51a714dd11708164
|
wnedbyonlyasingledocument |
2022-07-17 23:48:06 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Inspector v2の脆弱性診断内容を「Slackベース」で管理する |
https://qiita.com/gahirosan/items/4a87f695a92cb387a6c2
|
amazoninspectorclassic |
2022-07-17 23:24:50 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
Inspector v2の脆弱性診断内容を「Slackベース」で管理する |
https://qiita.com/gahirosan/items/4a87f695a92cb387a6c2
|
amazoninspectorclassic |
2022-07-17 23:24:50 |
海外TECH |
MakeUseOf |
The Feel Better App Offers a Holistic Approach to Wellness and Plant-Based Eating |
https://www.makeuseof.com/review-feel-better-app-wellness/
|
The Feel Better App Offers a Holistic Approach to Wellness and Plant Based EatingFeel Better is a well rounded wellness app that can help you with everything from exercise and a plant based diet to mindfulness and sleep |
2022-07-17 14:30:14 |
海外TECH |
DEV Community |
MACHINE LEARNING ON AWS |
https://dev.to/shyam1409/machine-learning-on-aws-oed
|
MACHINE LEARNING ON AWSFirst question come in our mind is that why we choose AWS machine learning What is AWS machine learning AWS Machine Learning algorithm discovers pattern and data and constructs the mathematical model using this data These models are used to make predictions in new data Machine Learning can be implemented in an ample amount of applications AWS Machine Learning helps the user to quickly build smart applications that can help to perform important tasks such as fraud detection demand forecasting predictive customer support and quick prediction Amazon Machine Learning synchronizes the previous data and utilizes it further to provide the necessary information to the user AWS ML is used to review customer feedback in email product reviews forum and phone transcripts This further recommends the product action to the service team or connects the customer with customer care specialist AWS Machine Learning is easy to use as the user can locate the data within Amazon Web Services Benefits of Amazon Machine Learning SagemakerAmazon Sagemaker helps data scientists and developers very efficiently It helps to build train and deploy Machine Learning models Sagemaker has a new architecture which can help with all of its capabilities in your existing Machine Learning workflows DeepLensIt is a Deep Learning enabled video camera which is made for developers Integrating this with Amazon Sagemaker will help to get up and running with Deep Learning quickly and easily EconomicalIt is a Deep Learning enabled video camera which is made for developers Integrating this with Amazon Sagemaker will help to get up and running with Deep Learning quickly and easily More SecureControl access to resources with granular permission policies Storage and database services provide sturdy coding to stay your data secure Versatile key management choices enable you to settle on whether or not you or AWS can manage the encryption keys Deep Platform IntegrationsML services are deeply integrated with the rest of the platform together with the data lake and database tools you wish to run Machine Learning workloads The data on AWS offers you access to the foremost complete platform for large data API Driven Machine Learning ServiceDevelopers will simply add intelligence to any application with a various choice of pre trained services that give computer vision speech language analysis and chatbot practicality Open Source PlatformMachine Learning is suitable for the data researcher Machine Learning researcher or developer AWS offers Machine Learning services and tools tailored to fulfill your wants and level of expertise Advantages of AWS Machine LearningAmazon s AWS Machine Learning suite of services can help cut down the time and expense it typically takes to develop test and deploy ML models For instance adding specifics to pre trained models can help a company quickly deploy a chatbot to help with customer service tasks AWS also supports all of the major machine learning frameworks such as TensorFlow and Caffe It s also secure with end to end encryption and provides a “pay as you go model that allows organizations of all sizes to scale as needed Also AWS provides numerous data analysis services to help make the best business decisions possible A known leader in cloud computing Amazon offers a fantastic end to end solution for companies implementing machine learning into their products services and operations References Thanks For Reading Connect With Me on |
2022-07-17 14:31:24 |
海外TECH |
DEV Community |
Android Studio: Guide For Beginners |
https://dev.to/crazycodigo/android-studio-guide-for-beginners-3mmn
|
Android Studio Guide For Beginners By Samrat ChakrabortyWhen you start Android Studio it provides you with a number of templates that you can use while making your very first Android Studio project To create a new project in Android Studio click on new project After that select from the number of predefined templates that you can use in your project without coding for the same If the desired template is not present then you can select Basic or Empty Activity template After selecting the desired template click on next and then enter the name of the application package name location the language in which you want to write your code java kotlin and minimum API level this is the minimum API supported by your app After this click on finish Now after you have completed making the basics of your project you can run this project on your device by connecting the device with an USB and then run your first android application Now below you can see the workspace of android studio to modify your app according to your needs Then coming to the workspace that Android Studio provides here you can see different sections The Top part is also known as the Menu Part Here you will get various options like File where you can create a new project open an existing project etc You also have an option Build which will build your APK In the mid section on the right you can see the Coding Area where you can actually write code for your kotlin or java file The left side of the mid section is called as Project Structure This is the part from where you can access all the files present in your project The bottom part is called the Terminal or the Current execution part This is the most import part of Android Studio Here you can see the currently executing processes or activity If your code has errors then it will show up in the Terminal Coming to the Designing partYou can create the UI of your Android application by writing your code in your xml file You can access this file in your res gt layout gt activity main xml Here you can design your Apk in two ways i e either the text way or the design way In text way you can write the xml code for your android application and you can see the preview on your mobile screen Android Studio provides a way to drag and drop various widgets and use it in making your application This is the Design way To Run the App u can use keyboard shortcut SHIFT F or press the play button next to your virtual device name ConclusionIn this blog we looked at the basics of Android Studio and learned some features of how to use it We learnt how to design the UI of our apk and run it If you want to discuss your app ideas with me directly you can join the Crazy Codigo server Follow our socials to get updated whenever we post Hope you liked this blog Sam |
2022-07-17 14:30:14 |
海外TECH |
DEV Community |
React Hook: useRunOnce |
https://dev.to/perssondennis/react-hook-userunonce-48a8
|
React Hook useRunOnceSometimes we need to run code only once useRunOnce is a hook that runs a function one time when a component mounts or one time per browser session The article explains common use cases of this hook and when not to use it In This ArticleuseRunOnce HookRun Once on MountRun Once per SessionUse CasesWhen Not To UseExamplesSummary useRunOnce HookBelow you can see how useRunOnce hook is implemented in JavaScript and typescript The hook can be used to run a function once either on mount or per browser session The hook takes an object as an argument with two available properties Firstly a required fn property that is the callback function that will run If no other property is passed the callback function will run once every time the component mounts If the second property sessionKey is passed the hook will instead utilize session storage to run the callback function just once per browser session That is further explained later in this article The code is also available at CodeSandbox and GitHub You can try it out on CodeSandbox but I will explain more about how it works here in the article JavaScriptimport useEffect useRef from react const useRunOnce fn sessionKey gt const triggered useRef false useEffect gt const hasBeenTriggered sessionKey sessionStorage getItem sessionKey triggered current if hasBeenTriggered fn triggered current true if sessionKey sessionStorage setItem sessionKey true fn sessionKey return null export default useRunOnce TypeScriptimport React useEffect useRef from react export type useRunOnceProps fn gt any sessionKey string const useRunOnce React FC lt useRunOnceProps gt fn sessionKey gt const triggered useRef lt boolean gt false useEffect gt const hasBeenTriggered sessionKey sessionStorage getItem sessionKey triggered current if hasBeenTriggered fn triggered current true if sessionKey sessionStorage setItem sessionKey true fn sessionKey return null export default useRunOnce Forest Gump has never heard about segmentation fault Run Once on MountIf you want to run a function once a component mounts simply pass a callback function to the argument object s fn attribute The callback will only fire one time Unless the component is being unmounted and mounted again in that case it will fire again useRunOnce fn gt console log Runs once on mount Run Once per SessionIf you would like to run a function only one time per session you can pass a sessionKey to the hook The hook will then use session storage to ensure that the callback function only runs once per session In other words when passing a sessionKey the passed in function will only run one single time when a user visits your website The callback function won t be triggered again not even when the user reloads the website using the browser s reload button For the callback function to run one more time the user will need to close the browser tab or the browser and then revisit the website in another tab or browser session This is all according to the session storage documentationuseRunOnce fn gt This will not rerun when reloading the page console log Runs once per session Session storage key ensures that the callback only runs once per session sessionKey changeMeAndFnWillRerun Note A common problem with session and local storage is that you cannot force users to close their browsers Although in some cases it may be necessary to clear the storage Easiest way to do that is to use another storage key So if you are using this hook with a sessionKey and want all clients to rerun the hook even if they aren t closing their browser just make another deployment of your application with another sessionKey Use CasesWhen would one want to use this hook Here are some example use cases Send analytics data when a component mounts Send analytics data when a user visits your site once per session Fetch data when a component mounts Fetch data when a user visits your site once per session Count how many times a user visits your site Run code that should run once on client side and not at all on server side Other kind of logic you want to run when a component mounts Regarding fetching data there s one thing that is important to mention there In React Strict Mode useEffects will run twice when mounting a component in development mode For that reason you should most often avoid sending network requests in useEffects It may be fine to fetch data in useEffects but when doing that you must ensure to handle the case when data is received twice In other words your callback function must be idempotent React have documented how to handle such cases in their docs make sure to read it you will need to learn it eventually Furthermore React supports server side rendering SSR and there exist multiple frameworks that is built on React which supports SSR and even static site generation SSG one of those is Next js When rendering React on server side the global window and document objects aren t available Trying to access one of those objects on the server would throw an error This hook can therefore be very useful when dealing with frameworks that run server side since this hook only will trigger the callback function on client side Easiest way to fix a bug is to remove code When Not To UseOccationally when I think I need this hook I think twice about it and realize that I really don t Here follows some cases when I wouldn t use the hook Write a greeting message in web console when a user first visits your page Initialize a third party library by calling one of their init functions Send analytics data when a user visits your site and resend it when user reloads the page Fetch data when a user visits your site and refetching when user reloads the page The reason you may not need the hook is because it s unnecessary to use a hook useEffect if you don t need to read or set an internal state in a component Writing a greeting message to the web console has nothing to do with React components or its life cycle you can do that in pure JavaScript and there is no reason to do that within a React component The same applies to initializing third party libraries That may include registering plugins to a date library configuring languages in a in library or whatsoever Such logic is rarely dependent on data in a React component and should therefore be initialized outside your components Simply place the code in a file right above a React component and it will run once and only once that s how ES modules are designed See examples of when not to use an useEffect in Reacts documentation Also I know I mentioned sending analytics data or fetching data when a user visits your site among the use cases as well It really depends on what you want to measure or fetch Do you want to refetch your data when the user reloads a page with the web browser s reload button In that case you may be able to fetch the data outside your React components as described above if you don t need to read or set a component s internal state On the other hand if you don t want to refetch the data when a page is being reloaded you should use the useRunOnce hook and provide a sessionKey to it ExamplesThe code below illustrates a use case when useRunOnce hook is used to fetch data when a component mounts It stores the data to an internal state in the component and renders it when completed import React from react import useRunOnce from hooks useRunOnce import fetchData from services fetchData const MyComponent gt const dataToShow setDataToShow useState null useRunOnce fn gt const data fetchData setDataToShow data return lt gt dataToShow lt gt export default MyComponentIn the example below when storing data to local storage you probably don t need to use the hook The reason is that the data isn t used in an internal state in the component The code within the callback function is pure JavaScript and can be lifted out of the React component import React from react import useRunOnce from hooks useRunOnce import fetchData from services fetchData const MyComponent gt useRunOnce fn gt const data fetchData localStorage setItem fetched data data return lt gt MyComponent lt gt export default MyComponentThis is how the above code would look if we removed the hook and lifted out the code that fetches data and stores it in local storage import React from react import fetchData from services fetchData const data fetchData localStorage setItem fetched data data const MyComponent gt return lt gt MyComponent lt gt export default MyComponentIf we don t need to refetch the data when the website is reloaded we could use the hook to ensure that it only stores data to local storage once per browser session it would then look as this import React from react import useRunOnce from hooks useRunOnce import fetchData from services fetchData const MyComponent gt useRunOnce fn gt const data fetchData localStorage setItem fetched data data sessionKey anyStringHere return lt gt MyComponent lt gt export default MyComponent SummaryuseRunOnce is a hook you can use for two use cases When you want to run some code every time a component mounts or remounts When you want to run some code once per browser session Since the hooks wraps a useEffect running code when a function mount can infer side effects in React Strict Mode Read React s documentation to see how to handle that The hook uses session storage to run code once per browser session The hook will therefore run its code as soon as a new session is initiated see session storage documentation for details or read through this article Dennis PerssonFollow I m a former teacher writing articles about software development and everything around it My ambition is to provide people all around the world with free education and humorous reading |
2022-07-17 14:23:40 |
海外TECH |
DEV Community |
A refreshing way to test the frontend |
https://dev.to/noriller/a-refreshing-way-to-test-the-frontend-5a6c
|
A refreshing way to test the frontendI gave it an earnest try All of that was in Better Specs and Better Tests as much as I could especially the parts I had my doubts about Guess what I liked it The projectJust so we are on the same page here s the deployed version so you can just see what it does And the Github repo How it should workBasically it s just a form with two inputs and a button Fill in the inputs click the button and you get the ID of the created resource I m using jsonplaceholder API so nothing is actually created And if you don t fill something it shows you errors How it was doneI ve used Vite to create a React project and took the chance to try out Vitest for testing I m also using Testing Library Inside the test files it s no different than Jest so no problem there The setup was easy enough but I also didn t need to do any special configuration The running of the tests is fast And they also have a VSCODE extension that makes it easy to run and debug them I use Wallaby which is paid and totally worth it but I m really impressed and already recommending you to use their extension if your project is using Vitest The testingNow that we re on the same page the testing The two biggest things I have changed from my previous approach were to use the “single expectation tests this also lead me to use a lot more nesting with describe blocks where I could use two of the A s of testing arrange act and then let the final one for the it test blocks assert I ve also stopped using “should and end up with the “describing the expected behavior The resultThe result is this test file On the describe blocks I either arrange or act then on the it I assert I m using the beforeEach to either render or do something and if you use ESLINT with the recommended rules for Testing Library you should probably see some error if you try that I understand the reasons behind this but even then with the current API of Testing Library you don t really need to initialize anything since you can do everything using screen What I do agree with is that in text format you might be lost as to what is being done and at which point But on a code editor where you can just collapse things and easily navigate this shouldn t be a problem But in any case you can still do something like this This way you know exactly what s going on on each test at the cost of having to copy the steps everywhere In this example I hoisted everything I would need and gave them names easy to understand but when they didn t fit or it was just a “one off then I just used what I needed So…which one did you like more or which one do you use or got interested enough to try The consoleAs you run the tests check the README you will see something like this ✓src app version spec jsx ✓ lt App gt ✓on default render ✓renders text of not submitted ✓renders input for title ✓renders input for body ✓renders a button ✓with submit text ✓that is enabled ✓dont render the title error label ✓dont render the body error label ✓when you submit a form ✓inputting both values ✓the title input has the input value ✓the body input has the input value ✓when submitting ✓disables the button ✓after api call complete ✓reenables the button ✓renders the id ✓has called the API once ✓has called the API with ✓changes the text with the id ✓clears the form ✓without inputting values ✓shows a title error ✓shows a body error ✓doesnt call the API ✓inputting only the title ✓dont show a title error ✓shows a body error ✓doesnt call the API ✓dont clear the form ✓inputting only the body ✓shows a title error ✓dont show a body error ✓doesnt call the API ✓dont clear the formOr you can end up with something like this lt App gt on default render renders text of not submitted lt App gt on default render renders input for title lt App gt on default render renders input for body lt App gt on default render renders a button with submit text lt App gt on default render renders a button that is enabled lt App gt on default render dont render the title error label lt App gt on default render dont render the body error label lt App gt on default render when you submit a form inputting both values the title input has the input value lt App gt on default render when you submit a form inputting both values the body input has the input value lt App gt on default render when you submit a form inputting both values when submitting disables the button lt App gt on default render when you submit a form inputting both values when submitting after api call complete reenables the button lt App gt on default render when you submit a form inputting both values when submitting after api call complete renders the id lt App gt on default render when you submit a form inputting both values when submitting after api call complete has called the API once lt App gt on default render when you submit a form inputting both values when submitting after api call complete has called the API with lt App gt on default render when you submit a form inputting both values when submitting after api call complete changes the text with the id lt App gt on default render when you submit a form inputting both values when submitting after api call complete clears the form lt App gt on default render when you submit a form without inputting values shows a title error lt App gt on default render when you submit a form without inputting values shows a body error lt App gt on default render when you submit a form without inputting values doesnt call the API lt App gt on default render when you submit a form inputting only the title dont show a title error lt App gt on default render when you submit a form inputting only the title shows a body error lt App gt on default render when you submit a form inputting only the title doesnt call the API lt App gt on default render when you submit a form inputting only the title dont clear the form lt App gt on default render when you submit a form inputting only the body shows a title error lt App gt on default render when you submit a form inputting only the body dont show a body error lt App gt on default render when you submit a form inputting only the body doesnt call the API lt App gt on default render when you submit a form inputting only the body dont clear the formWhich is not unlike what you would get in case of an error FAIL src app version spec jsx gt lt App gt gt on default render gt when you submit a form gt inputting both values gt when submitting gt after api call complete gt clears the formAs much as I want to have tests saying what they are doing I hardly manage to make something this specific But that is something that was just a happy accident it simply happen and I was as surprised as you Pros and cons ProsSince you split the arrange and act into blocks I feel it makes it easier to catch cases because at each new nested block you can focus on the current block and see all the what if s that you can do More than that it lets you think on a smaller step each time I feel like I don t need to think about the entire behavior of a block just on the individual one I m on This atomicity also helps with TDD This also makes it possible to use something like BDD to write specifications on the user journey for each part of the application ConsVerbosity is a given with this approach I m not even talking about the two different versions but more about that you explode the assertion blocks that would normally live in one test block to multiple ones Another one would probably be performance Something that you would do one time in one test now is done over and over again in multiple Are you refreshed This is a different way of testing this even changed the way I ve approached some tests I ve made While this can be used on the backend and I m using it on the frontend I feel like it s TDD I ve tried TDD on the frontend before but that hasn t gone well But with this approach after the code is done I can still think back step by step of what is going on find edge cases and fill in the others Considering the test is usually done this doesn t really fit the norm ✓src app version spec jsx ✓ lt App gt ✓on default render ✓renders the component ✓when you submit a form ✓inputting both values ✓has both values ✓when submitting ✓disables the button ✓after api call complete ✓get the id and clears the form ✓without inputting values ✓shows errors ✓inputting only the title ✓shows error for the body ✓inputting only the body ✓shows error for the titleI ve just refactored the third version I hate it It s smaller and runs faster yes But I couldn t express what the tests actually do I have to use some generic wording or just omit a lot of stuff that is happening Not only that I know I did even worse than that because in this one I at least kept the describe blocks so there s at least some separation but I know I would usually have even less than that Tests are also code and code should be clean and legible For the third one you would be inclined to maybe add a lot of comments or just let it be as is Meanwhile the first two you could maybe call “self documenting code With this I just urge you to try it Try it and then come back and say what you think better yet…leave a comment for yourself here Say what you think of it now and then come back to check if it continues or if you re going to change something Cover Photo by National Cancer Institute on Unsplash |
2022-07-17 14:11:15 |
海外TECH |
CodeProject Latest Articles |
Running FTP, SFTP, SMTP, Cache, LDAP, SSO and other servers in docker |
https://www.codeproject.com/Tips/5337112/Running-FTP-SFTP-SMTP-Cache-LDAP-SSO-and-other-ser
|
cache |
2022-07-17 14:10:00 |
ニュース |
BBC News - Home |
Ryan Jones dementia: Ex-captain legal action against rugby governing bodies |
https://www.bbc.co.uk/news/uk-wales-62197134?at_medium=RSS&at_campaign=KARANGA
|
action |
2022-07-17 14:33:38 |
ニュース |
BBC News - Home |
Camber Sands beach queues for miles as amber heat warning begins |
https://www.bbc.co.uk/news/uk-england-sussex-62198021?at_medium=RSS&at_campaign=KARANGA
|
warning |
2022-07-17 14:15:47 |
ニュース |
BBC News - Home |
Lisandro Martinez: Man Utd agree to sign Argentina centre-back from Ajax in £57m deal |
https://www.bbc.co.uk/sport/football/62170735?at_medium=RSS&at_campaign=KARANGA
|
Lisandro Martinez Man Utd agree to sign Argentina centre back from Ajax in £m dealManchester United agree to sign Argentina central defender Lisandro Martinez from Ajax in a deal worth up to m euros £m |
2022-07-17 14:29:26 |
北海道 |
北海道新聞 |
魔の六回、8連勝逃す 日本ハム伊藤乱調 後続も痛打(17日) |
https://www.hokkaido-np.co.jp/article/706981/
|
日本ハム |
2022-07-17 23:30:00 |
北海道 |
北海道新聞 |
育て最北端ウイスキー 米国人起業家が利尻に蒸留所オープン 25年発売へ |
https://www.hokkaido-np.co.jp/article/706950/
|
宗谷管内 |
2022-07-17 23:26:01 |
北海道 |
北海道新聞 |
金内さんら4強 全道将棋選手権が開幕 |
https://www.hokkaido-np.co.jp/article/706903/
|
開幕 |
2022-07-17 23:21:22 |
コメント
コメントを投稿