AWS |
AWS Government, Education, and Nonprofits Blog |
AMILI helps advance precision medicine by building microbiome library on AWS |
https://aws.amazon.com/blogs/publicsector/amili-helps-advance-precision-medicine-building-microbiome-library-aws/
|
AMILI helps advance precision medicine by building microbiome library on AWSAMILI is a healthcare technology HealthTech company based in Singapore that seeks to advance precision medicine and personalized health and nutrition by harnessing the potential of the microbiome AMILI uses artificial intelligence AI and machine learning ML on AWS to comprehensively quantify and characterize gut microbiomes AMILI aims to build and curate the world s largest multi ethnic Asia microbiome database |
2023-01-30 13:27:59 |
Google |
Official Google Blog |
Get to know our privacy and data tools |
https://blog.google/products/admanager/get-to-know-our-privacy-and-data-tools/
|
relevant |
2023-01-30 15:00:00 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
コーディング時間を節約できる JavaScript1行コード20点 |
https://qiita.com/iikitty/items/61226ea047e9e302ae46
|
mathmaxarr |
2023-01-30 22:13:18 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS認定資格 Developer Associate 受験体験記 試験日延期ミスのちに合格 |
https://qiita.com/meijab/items/544e948009ac223fa301
|
developerassociate |
2023-01-30 22:14:04 |
海外TECH |
DEV Community |
React Hook Form vs Formik |
https://dev.to/refine/react-hook-form-vs-formik-5ln
|
React Hook Form vs FormikAuthor Joseph Mawa IntroductionForms are a handy feature for collecting data from users Unfortunately creating styling and validating forms is not always straightforward especially when using front end frameworks such as React Fortunately packages such as React Hook Form and Formik exist to simplify working with forms in React and React frameworks Among other benefits most form libraries simplify working with forms by handling form validation and submission out of the box for you Despite the advantages of using a library for form management each library has strengths and weaknesses Formik and React hook form are among the most popular libraries for form management in the React ecosystem This article will compare Formik and React hook form by highlighting their strengths and weaknesses Hopefully it will help you choose a form library that will meet your project s requirements The most popular React form librariesAs mentioned above there are several React packages that you can use when working with forms However React Hook Form and Formik are the most popular We will explore the two libraries in this section We will highlight how to use them and their pros and cons React Hook FormReact Hook Form is another library for managing forms in React and React frameworks like Next and Gatsby Similar to Formik React Hook Form is a free open source library It is MIT licensed Therefore you can use it pretty much any way you want You can use it to manage your form state and field validation You can integrate it with some popular UI libraries like Material UI As its name suggests React Hook Form was built using React hooks Therefore you can t use it directly in class components How to use React Hook FormYou can install React Hook Form from the NPM package registry like any other package before using it Run one of the commands below in an existing React or React Native project npmnpm install react hook form yarnyarn add react hook formThe code below shows a simple login form demonstrating the most basic usage of React Hook Form In the example code below we are using the useForm hook It is one of the hooks that simplifies form management and you will almost always use it when working with React Hook Form The useForm hook takes an optional object as an argument and returns several methods The method worth mentioning is the register function You can use it to register input elements and apply validation rules It takes a unique input name string as the first argument and an optional object as the second You can use the second argument to add input validation fields like the example below import useForm from react hook form export function Form const register handleSubmit watch formState useForm const submitHandler data gt console log data return lt form onSubmit handleSubmit submitHandler gt lt p gt lt label htmlFor username gt Username lt label gt lt input type text id username register username required true minLength gt lt p gt lt p gt lt label htmlFor Password gt Password lt label gt lt input type password id password register password required true minLength required gt lt p gt lt button gt Submit lt button gt lt form gt The example above is a basic illustration of React Hook Form Do check out the React Hook Form documentation for more advanced features Pros of React Hook FormIt is free and open source React Hook Form has no dependencies and a small bundle size It has a gzipped bundle size of KB according to bundlejs It is MIT licensedIt is easy to pick up Good documentationIt is performantYou can use it in both React and React Native It validates form fields out of the box It is in active maintenance It has an active community You can integrate React Hook Form with UI libraries like Material UI and refine With refine you can use the pankod refine react hook form adapter You can handle forms using useForm hook in your refine CRUD apps with React Hook Form Refer to article on using React Hook Form dynamic form fields with refine Cons of React Hook Form libraryReact Hook Form uses React hooks Therefore you can t use it directly in class components Building a side project Meet the headless React based solution to build sleek CRUD applications refine expertly combines cutting edge technologies under a robust architecture so you don t have to spend time researching and evaluating solutions Try refine to rapidly build your next CRUD project whether it s an admin panel dashboard internal tool or storefront FormikFormik is a free popular open source package for building forms in React and React Native It has built in features for managing form validation error messages and form submissions It has a minimal API surface area Therefore it shouldn t be hard to start using even for an absolute beginner to Formik It has over thirty thousand GitHub stars two million weekly downloads on the NPM package registry and is Apache Licensed How to use FormikDepending on your package manager of choice you can install Formik in any React or React Native project using one of the commands below npmnpm install formik yarnyarn add formikIf you are not using a package bundler like webpack you can also load it from the unpkg CDN using an HTML script tag like so lt script src gt lt script gt The code below illustrates the most basic use of Formik for building a simple login form The login form comprises text and email input fields It uses the built in Form Formik and Field components The Formik component is one of the built in components you use when building forms with Formik It internally uses render props Therefore you can pass a render prop to the Formik component or use it to wrap a child component In addition to the render prop the Formik Component also takes several other props you can look up in the documentation Form is another built in component that wraps the HTML form element Internally it has access to the onSubmit prop and several other props you pass to Formik Field is a built in component for adding input elements to your form For a complete list of props it takes and how to use them check the Formik documentation import Form Formik Field from formik export function LoginForm return lt gt lt h gt Login form lt h gt lt Formik initialValues userName password onSubmit values gt console log values values gt lt Form gt lt p gt lt label htmlFor username gt Username lt label gt lt Field id username required type text name userName gt lt p gt lt p gt lt label htmlFor password gt Password lt label gt lt Field id password required type password name password gt lt p gt lt button type submit gt Login lt button gt lt Form gt lt Formik gt lt gt Formik leaves form validation to you You can do it yourself or use a third party library like Yup The above code illustrates a simple use case of the Formik library It has several complex features for solving a variety of problems Check the Formik documentation for all the other features I have not hinted at in this article Pros of FormikYou can use it with both React and React Native It is freeIt is performantIt has a flexible licensing requirement Released under the terms of the Apache License version It is lightweight According to bundlejs com the gzipped bundle size of Formik is KB It has excellent documentation It is easy to pick up It has bindings for popular UI frameworks like Ant design MUI and Semantic UI Cons of FormikFormik is not actively maintained at the moment The last Git commit to the project repository was a year ago Similarly there hasn t been any new version released for at least one year Comparing Formik and React Hook FormFormikReact Hook FormGzipped bundle sizeKBKBDependenciesGitHub starskkActive maintenanceNoYesPerformanceGoodGoodDocumentationGoodGoodLicenseApache License version MITNPM weekly downloads Million MillionPricingFreeFreeCommunity supportGoodGoodOpen GitHub issuesClosed GitHub issues ConclusionForm management is an area of web development that may be difficult to get right especially when using front end frameworks like React The HTML built in form functionality comes in handy when validating form fields managing errors and submitting forms However solutions like Formik and React Hook Form also exist to simplify form management in React and React frameworks Formik and React Hook Form are popular free open source mature and battle tested They are both excellent packages for form management You can use them alongside the native HTML form functionality On the flip side judging by its commit and release history on GitHub Formik is not actively maintained While writing this article the Formik GitHub repository has not had a recent Git commit or new release in the last year Additionally Formik has a relatively larger bundle size than React Hook Form According to bundlejs the gzipped bundle size of Formik is KB while that of React Hook Forms is KB Furthermore Formik internally relies on seven dependencies while React Hook Form has no dependency Given the pros and cons of both packages highlighted above your best bet is React Hook Form when looking to use one of the two libraries in a new project Hopefully this article has given you insights into which form library to pick for your next project |
2023-01-30 13:24:31 |
海外TECH |
DEV Community |
package a poetry project in a docker container for production |
https://dev.to/farcellier/package-a-poetry-project-in-a-docker-container-for-production-3b4m
|
package a poetry project in a docker container for productionDocker become the preferred mode of application distribution For python applications it has become mandatory because it virtually guarantees that if an image works on one environment then it will work on the others This strategy also makes it possible to finely manage deployments Docker allows the promotion of an image from environment to environment by playing on version number and allow devops practices as gitops or canary deployment As I explain in the article I move from pipenv to poetry in Am I right I move my projects from pipenv to poetry I also had to upgrade the docker packaging I will try to share what I learn I will describe practices I ve used to build docker images from poetry projects install a virtual environment in the docker imagecopy only what is strictly necessary by filtering files and folders with dockerignoreignore dev libraries when installing dependenciesadd the virtual environment in the PATHuse a multi stage docker build to exclude poetry install a virtual environment in the docker imageIn docker image we will install a virtual environment in the project as we would locally The environment will be installed in app venv folder Doing that is required to be able to exclude poetry dependency thank to a docker multi stage build To ensure that the virtual environment of a project is created next to the sources in a predictable folder poetry must be configured We can do it with this command poetry config virtualenvs in project true localI have doubt first on this practice I had the impression that creating a virtual environment in a container is counterproductive However it was necessary to be able to exclude poetry from the final image copy only what is strictly necessary by filtering files and folders with dockerignoreIn a production image it is not a good idea to drag all files and folders that are used for development The dockerignore file is a manifest that specifies files and folders to exclude when adding a folder to an image with the ADD or COPY statement The dockerignore uses the same syntax as gitignore In general we ll ignore the package that contains the tests build artifacts venv folder You can ignore all artifacts that are produced by utilities like mypy coverage dockerignore venv tests buildHere is an example dockerfile The code is deployed in the app folder The COPY app does not copy all items specified in manifest dockerignoreDockerfileFROM python slimRUN pip install poetry RUN mkdir p app COPY appWORKDIR appRUN poetry installCMD poetry run python m app main ignore dev libraries when installing dependenciespoetry allows us to install project dependencies while ignoring development dependencies These dependencies take up space and are unnecessary when the application is running in production In addition they remain accessible at runtime and can degrade the security of your application FROM python slimRUN pip install poetry RUN mkdir p app COPY appWORKDIR appRUN poetry install without devCMD poetry run python m app main add the virtual environment in the PATHBy default the docker image uses system python It s not practical to always prefix the command with poetry run We will add the python of the virtual environment of poetry to the PATH to use it in priority This trick makes the container more robust because you won t need to think about poetry anymore to place a custom command to the container ENV PATH app venv bin PATH RUN poetry install without devCMD python m app main I prefer this technique to the entrypoint overload because it makes using commands like sh or bash intuitive when we need to connect on the container use a multi stage docker build to exclude poetryThis practice makes it possible to exclude all the libraries used during the build The container environment will no longer contain poetry or the dependencies that this toolkit pulls This practice has the same effect as avoiding installing dev dependencies It makes it possible to reduce the size of the container to pass it from a container of Mb to Mb FROM python slim as builderRUN pip install poetryRUN mkdir p appCOPY appWORKDIR appRUN poetry install without devFROM python slim as baseCOPY from builder app appWORKDIR appENV PATH app venv bin PATH CMD python m app main These practices may help you build your workflow to distribute a docker image from a poetry project If you use other workflows or tips on a daily basis share them with us in the comments Finally I have discarded several practices from this article that you can also apply You can make your own base image instead of using an already packaged base image The python image is updated regularly It has positive effects like being up to date but also negative like redownloading all the layers at each deployment In a context where bandwidth is precious it is interesting to better plan the update of the base image to reduce bandwidth consumption In the same vein another practice is to install external dependencies and application code separately It s always the same desire to save bandwidth by only downloading the layer that has been modified A last practice that I do not use at all and which may interest you is to use slim toolkit to keep only the useful elements in your final image |
2023-01-30 13:10:00 |
金融 |
金融庁ホームページ |
入札公告等を更新しました。 |
https://www.fsa.go.jp/choutatu/choutatu_j/nyusatu_menu.html
|
公告 |
2023-01-30 14:00:00 |
ニュース |
BBC News - Home |
Nadhim Zahawi: Sunak says he handled case decisively |
https://www.bbc.co.uk/news/uk-politics-64453740?at_medium=RSS&at_campaign=KARANGA
|
nadhim |
2023-01-30 13:35:20 |
ニュース |
BBC News - Home |
Review of BBC economic coverage finds concerns but no systematic bias |
https://www.bbc.co.uk/news/entertainment-arts-64453200?at_medium=RSS&at_campaign=KARANGA
|
systemic |
2023-01-30 13:04:33 |
ニュース |
BBC News - Home |
Laura Winham: Investigators seek whereabouts of gas engineer |
https://www.bbc.co.uk/news/uk-england-surrey-64454909?at_medium=RSS&at_campaign=KARANGA
|
skeletal |
2023-01-30 13:21:56 |
ニュース |
BBC News - Home |
Nicola Bulley: Huge police search for missing dog walker |
https://www.bbc.co.uk/news/uk-england-lancashire-64450243?at_medium=RSS&at_campaign=KARANGA
|
morning |
2023-01-30 13:30:18 |
ニュース |
BBC News - Home |
No trans prisoners have attacked women, says justice minister |
https://www.bbc.co.uk/news/uk-scotland-scotland-politics-64431383?at_medium=RSS&at_campaign=KARANGA
|
units |
2023-01-30 13:01:01 |
ニュース |
BBC News - Home |
JD Sports says 10 million customers hit by cyber-attack |
https://www.bbc.co.uk/news/business-64452986?at_medium=RSS&at_campaign=KARANGA
|
attackthe |
2023-01-30 13:43:38 |
ニュース |
BBC News - Home |
Greater Manchester Police didn't care I was abused, woman says |
https://www.bbc.co.uk/news/uk-england-manchester-64410912?at_medium=RSS&at_campaign=KARANGA
|
woman |
2023-01-30 13:01:01 |
ニュース |
BBC News - Home |
Bayern in talks to sign Man City defender Cancelo |
https://www.bbc.co.uk/sport/football/64452933?at_medium=RSS&at_campaign=KARANGA
|
munich |
2023-01-30 13:20:15 |
コメント
コメントを投稿