投稿時間:2023-01-04 21:31:07 RSSフィード2023-01-04 21:00 分まとめ(36件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
TECH Techable(テッカブル) 紅白歌合戦、視聴者が注目したシーンは?視聴“質”測るREVISIOが調査 https://techable.jp/archives/188376 revisio 2023-01-04 11:00:20
AWS lambdaタグが付けられた新着投稿 - Qiita Lambda ローカルでサンプルアプリを動かす https://qiita.com/nobumichi/items/c2ce1b44e493016b97d2 lambda 2023-01-04 20:46:53
python Pythonタグが付けられた新着投稿 - Qiita Lambda ローカルでサンプルアプリを動かす https://qiita.com/nobumichi/items/c2ce1b44e493016b97d2 lambda 2023-01-04 20:46:53
AWS AWSタグが付けられた新着投稿 - Qiita Lambda ローカルでサンプルアプリを動かす https://qiita.com/nobumichi/items/c2ce1b44e493016b97d2 lambda 2023-01-04 20:46:53
AWS AWSタグが付けられた新着投稿 - Qiita RDS for Oracle のハンズオン (Immersion Day) をやってみて気づきを整理してみた https://qiita.com/sugimount-a/items/1a8ae772d79fc52686ee immersionday 2023-01-04 20:43:11
golang Goタグが付けられた新着投稿 - Qiita gqlgenでDataLoaderを用いてN+1 問題対処 (1対多のデータの取得)【実装編-Part4-2】 https://qiita.com/shion0625/items/e967f55af69dfc79f2e8 dataloader 2023-01-04 20:06:28
海外TECH MakeUseOf A Beginner's Guide to Using Apple Books on Your iPhone https://www.makeuseof.com/apple-books-beginners-guide/ apple 2023-01-04 11:30:15
海外TECH MakeUseOf Political Ads Are Returning to Your Twitter Feed https://www.makeuseof.com/political-ads-returning-to-twitter/ twitter 2023-01-04 11:23:44
海外TECH MakeUseOf Snag a MacBook Pro 14" Now and Save $400 https://www.makeuseof.com/macbook-pro-14-deal/ macbook 2023-01-04 11:16:14
海外TECH DEV Community Building a Video Player in React https://dev.to/documatic/building-a-video-player-in-react-1mlf Building a Video Player in React IntroductionReact has been the most popular JavaScript framework for building frontend As a web developer I recommend you learn React For learning nothing is better than building a project with that I have written many articles about building stuff in React In this last one I wrote about Building a Music Player in React This time I will guide you on building a video player in React In this article we are going to look into the following topics Prerequisite and Setting up the EnvironmentPlaying Video with the default playerBuilding a Custom player with Play Pause functionalityAdding the current time and duration of the video in the playerAdding a range timeline to display the videoIn the end our player will look like this I hope that the above topics got you excited Now let s get started with the project Prerequisite and Setting up the EnvironmentI assume that you know of the following technologies as a prerequisite JavaScriptHTML CSSBasic ReactThe environment setup is easy You should have node js pre installed for running the node related command in the terminal Navigate to the directory in which you want to create the project Now run the terminal and enter the below command to install react project npx create react app video playerRemove all the boilerplate and unnecessary code DependienciesWe need only one library to install Here it is react icons For adding icons of play pause next and previous into our player Install it with the below command npm i react iconsNow We are good to go Playing Video with the default playerLet s first import and play a video file in the browser We can do that with the video HTML tag Open App js Here is the code for it import video from assets video mp return lt video controls width className videoPlayer src video gt lt video gt This will play the video in the browser with the default player It will be able to do the post of the work Now it s time to build our own controls with custom icons Builiding Custom player with Play Pause functionalityFirst we need to hide the controls from the default player We can do that by removing controls properties from the video tag Now it s to add custom icons to the player lt div className controls gt lt IconContext Provider value color white size em gt lt BiSkipPrevious gt lt IconContext Provider gt isPlaying lt button className controlButton onClick handlePlay gt lt IconContext Provider value color white size em gt lt BiPause gt lt IconContext Provider gt lt button gt lt button className controlButton onClick handlePlay gt lt IconContext Provider value color white size em gt lt BiPlay gt lt IconContext Provider gt lt button gt lt IconContext Provider value color white size em gt lt BiSkipNext gt lt IconContext Provider gt We also need to store the video properties in useRef hook to prevent re render on changes Also we need some states to store data running Here is the code for imports and useState import useEffect useRef useState from react import IconContext from react icons import BiPlay BiSkipNext BiSkipPrevious BiPause from react icons bi function App const videoRef useRef null const isPlaying setIsPlaying useState false a boolean for storing state of the play To useRef we just need to use the ref attribute in the video tag lt video className videoPlayer width ref videoRef src video gt lt video gt We can do the play pause of the video with the handlePlay function I have added it as the onClick button event in the icon s parent div Here is the code for the handlePlay const handlePlay gt if isPlaying videoRef current pause setIsPlaying false else videoRef current play setIsPlaying true For CSS you can see the below code container display flex margin auto justify content center width overflow hidden playerContainer display flex flex direction column margin top em border radius em overflow hidden videoPlayer border radius em z index controlsContainer margin top em controls display flex z index color white width px justify content space between controlButton border none background none timeline width duration display flex justify content center align items center controlButton hover cursor pointer Now our custom player can play pause the video with our custom icon Adding the current time and duration of the video in the playerLet s first add a few more states for storing data related to the duration of the video I have used the const currentTime setCurrentTime useState current time of the video in array The first value represents the minute and the second represents seconds const currentTimeSec setCurrentTimeSec useState current time of the video in seconds const duration setDuration useState total duration of the video in the array The first value represents the minute and the second represents seconds const durationSec setDurationSec useState current duration of the video in secondsTo get all the above data we have the useEffect function useEffect gt const min sec secMin videoRef current duration setDurationSec videoRef current duration setDuration min sec console log videoRef current duration const interval setInterval gt const min sec secMin videoRef current currentTime setCurrentTimeSec videoRef current currentTime setCurrentTime min sec return gt clearInterval interval isPlaying To update the current time of the video we have passed it as setTimeout function This will update the current time of the video every second Also there is a function secMin for converting seconds into minutes Here is the code for it const secMin sec gt const min Math floor sec const secRemain Math floor sec return min min sec secRemain Let s add it to the return of the app lt div className duration gt currentTime currentTime duration duration lt div gt Adding a range timeline to display the videoNow let s add a timeline to our player We can do that by adding an input with type range Here the second of the current time and duration time will be helpful lt input type range min max durationSec default value currentTimeSec className timeline onChange e gt videoRef current currentTime e target value gt CodeSandboxYou look for the code and the output in the below codesandbox Adding more features to the playerYou can extend the project to add features such as Making the player more responsiveImplementing full screen button on the rightShow controls only when hoveringMore features for your player according to what you ConclusionWe have created our own custom video player with play pause and a timeline I hope that the project has helped you in handling video in React Thanks for reading the article 2023-01-04 11:30:00
海外TECH DEV Community Regression Modeling 101: Understanding Different Types of Models and How to Choose the Right One https://dev.to/anurag629/a-comprehensive-guide-to-regression-modeling-types-techniques-and-applications-7nb Regression Modeling Understanding Different Types of Models and How to Choose the Right OneA regression model is a statistical model that is used to predict a continuous variable based on one or more predictor variables The goal of a regression model is to identify the relationship between the predictor variables and the response variable and then use that relationship to make predictions about the response variable based on new data There are several different types of regression models including Linear regression Linear regression is a statistical method used to model the relationship between a continuous response variable also known as the dependent variable and one or more predictor variables also known as independent variables The goal of linear regression is to identify the best fitting line that describes the relationship between the predictor and response variables The best fitting line is determined by finding the values of the coefficients also known as slopes that minimize the sum of squared errors between the predicted values and the observed values of the response variable Polynomial regression Polynomial regression is a type of regression model that allows for more complex relationships between the predictor variables and the response variable by using polynomial terms in the model For example a quadratic term x can be included in the model to allow for a relationship that is not linear Higher order polynomial terms e g x x can also be included to allow for even more complex relationships Logistic regression Logistic regression is a type of regression model that is used for predicting a binary response variable i e a response variable that can only take on two values The goal of logistic regression is to model the probability of the response variable taking on one of the two values given the predictor variables The model is fit by maximizing the likelihood of the observed data given the model assumptions Multivariate regression Multivariate regression is a type of regression model that allows for multiple predictor variables to be used in the model This type of model is useful for examining the relationships between multiple predictor variables and the response variable and for identifying which predictor variables are the most important for predicting the response variable Ridge regression Ridge regression is a type of regression model that is used to address overfitting in linear regression models Overfitting occurs when the model is too complex and has too many parameters resulting in poor generalization to new data Ridge regression addresses overfitting by adding a regularization term to the model that penalizes large coefficients forcing some of the coefficients to be closer to zero This helps to reduce the complexity of the model and improve its generalization ability Lasso regression Lasso regression is similar to ridge regression in that it is used to address overfitting in linear regression models However instead of using a regularization term that penalizes large coefficients lasso regression uses a regularization term that sets some of the coefficients exactly to zero This can be useful for identifying a subset of important predictor variables and eliminating less important variables from the model Elastic net regression Elastic net regression is a type of regression model that combines the regularization terms of both ridge and lasso regression This allows the model to both shrink some of the coefficients towards zero and set some coefficients exactly to zero depending on the relative importance of the predictor variables Stepwise regression Stepwise regression is a type of regression model that is used to select the most important predictor variables for the model The process involves gradually adding or removing variables based on their statistical significance with the goal of finding the most parsimonious model that best explains the variation in the response variable Multivariate adaptive regression splines MARS MARS is a type of regression model that is used to model complex non linear relationships between the predictor variables and the response variable The model uses piecewise linear functions to model the relationship and is particularly useful for modeling relationships that are not well described by a single linear equation Random forest regression Random forest regression is a type of ensemble model that uses multiple decision trees to make predictions Each decision tree in the random forest is trained on a different subset of the data and makes predictions based on the variables that are most important for that particular tree The final prediction is made by averaging the predictions of all of the decision trees in the forest Random forest regression is particularly useful for modeling complex non linear relationships and can also be used to identify important predictor variables Overall the choice of which type of regression model to use will depend on the characteristics of the data and the specific goals of the analysis It is important to carefully consider the assumptions of each type of regression model and choose the one that is most appropriate for the data at hand Now we will be going to take an example for the model listed above and train the model for the same with the given data Linear regressionHere is an example of linear regression using the Python library scikit learn The data used for this example is a synthetic dataset of two predictor variables x and x and a response variable y Here is a sample dataset that can be used for linear regression xxyTo use this data for linear regression you would simply need to load it into a pandas DataFrame and follow the steps outlined in the previous example For example you could load the data into a DataFrame like this import pandas as pd Load the data into a DataFramedata pd DataFrame x x y First we can start by importing the necessary libraries and loading the data from sklearn linear model import LinearRegression Split the data into predictor and response variablesX data x x y data y Next we can split the data into training and test sets using scikit learn s train test split function from sklearn model selection import train test split Split the data into training and test setsX train X test y train y test train test split X y test size random state Now that we have our data split into training and test sets we can create a linear regression model and fit it to the training data Create a linear regression modelmodel LinearRegression Fit the model to the training datamodel fit X train y train Finally we can use the model to make predictions on the test data and evaluate the model s performance using scikit learn s mean squared error function from sklearn metrics import mean squared error Make predictions on the test datay pred model predict X test Calculate the mean squared errormse mean squared error y test y pred print Mean Squared Error mse This is just a basic example of linear regression using scikit learn but there are many other features and options that you can use to fine tune your model and improve its performance Polynomial regressionHere is an example of how to perform polynomial regression using Python and the scikit learn library Here is the sample data we use in a tabular form XyFirst we need to import the necessary libraries and load the data import numpy as npfrom sklearn preprocessing import PolynomialFeaturesfrom sklearn linear model import LinearRegression Load the dataX np array y np array Next we can use the PolynomialFeatures function to transform the data into polynomial features Transform the data into polynomial featurespoly PolynomialFeatures degree X poly poly fit transform X Finally we can fit the polynomial regression model using the transformed data Fit the polynomial regression modelmodel LinearRegression model fit X poly y Make predictions on new dataX new np array X new poly poly transform X new y pred model predict X new poly print y pred The output of this code will be an array of predictions for the values of y for the new data points Note that this is just a simple example and in practice you may want to perform additional steps such as cross validation and hyperparameter tuning to optimize the performance of the model Logistic regressionHere is an example of logistic regression using sample data in a tabular form Sample data AgeGenderIncomeCredit ScoreApproved for LoanMale YesFemale YesMale NoFemale YesMale NoExplanation In this example we are trying to predict whether an individual will be approved for a loan based on their age gender income and credit score The response variable is Approved for Loan which is a binary variable either Yes or No The predictor variables are Age Gender Income and Credit Score Code for logistic regression using Python Import necessary librariesimport pandas as pdfrom sklearn linear model import LogisticRegression Load sample data into a Pandas DataFramedata pd DataFrame Age Gender Male Female Male Female Male Income Credit Score Approved for Loan Yes Yes No Yes No Create feature matrix X and response vector y X data Age Gender Income Credit Score y data Approved for Loan Convert categorical variables to dummy variablesX pd get dummies X Create a logistic regression modelmodel LogisticRegression Fit the model to the training datamodel fit X y Predict whether a new individual with the following characteristics will be approved for a loannew individual age male income credit score prediction model predict new individual print prediction Output Yes Explanation In this example we first load the sample data into a Pandas DataFrame and then create a feature matrix X and response vector y We then convert the categorical variables Gender to dummy variables using the get dummies function in Pandas Next we create a logistic regression model using the LogisticRegression function from the sklearn library We then fit the model to the training data using the fit function and finally use the model to make a prediction for a new individual using the predict function The output of the model is that the new individual is predicted to be approved for a loan It is important to note that this is just a basic example of logistic regression and there are many other considerations and techniques that can be used to improve the model s performance For example you may want to normalize the predictor variables or use cross validation to evaluate the model s performance You may also want to consider using other evaluation metrics such as the confusion matrix or the AUC area under the curve score to assess the model s accuracy Additionally it is important to carefully consider the assumptions of logistic regression and ensure that they are met before using the model For example logistic regression assumes that there is a linear relationship between the predictor variables and the log odds of the response variable and that the errors in the model are independent and normally distributed If these assumptions are not met the model may not be appropriate for the data Overall logistic regression is a powerful and widely used tool for predicting binary outcomes and can be a valuable addition to any data scientist s toolkit By carefully considering the characteristics of the data and the assumptions of the model you can use logistic regression to make accurate and reliable predictions Multivariate regressionHere is an example of multivariate regression using Python with sample data in a tabular form YearSalesAdvertisingPriceIn this example we are trying to predict sales the response variable based on two predictor variables advertising and price We can build a multivariate regression model in Python using the following code import pandas as pdfrom sklearn linear model import LinearRegression read in the datadf pd read csv sample data csv create a Linear Regression model objectmodel LinearRegression fit the model using the Advertising and Price columns as predictor variables and the Sales column as the response variableX df Advertising Price y df Sales model fit X y view the model coefficientsprint model coef view the model interceptprint model intercept view the model R squared valueprint model score X y The output of the model coefficients will give us the estimated effect of each predictor variable on the response variable i e how much the response variable is expected to change for each unit increase in the predictor variable The output of the model intercept will give us the estimated value of the response variable when all predictor variables are equal to zero The output of the model R squared value will give us a measure of how well the model explains the variance in the response variable Using this multivariate regression model we can make predictions about sales based on new values of advertising and price For example if we wanted to predict sales for a year with of advertising and a price of we could use the following code create a new data frame with the new values of advertising and pricenew data pd DataFrame Advertising Price make the predictionprediction model predict new data print prediction This would give us the predicted value of sales based on the values of advertising and price in the new data frame It is important to note that this is just a basic example of multivariate regression using Python and there are many other considerations and techniques that may be relevant depending on the specific goals of the analysis and the characteristics of the data Some additional considerations for multivariate regression might include Handling missing data If there are missing values in the data we may need to impute missing values or use techniques such as multiple imputation to handle missing data Feature scaling If the scale of the predictor variables is very different it may be beneficial to scale the variables so that they are on the same scale This can help the model converge more quickly and may improve the model s performance Model evaluation It is important to evaluate the performance of the model using appropriate metrics and techniques such as cross validation to ensure that the model is not overfitting the data Model selection If there are multiple potential predictor variables we may need to select the most important variables to include in the model using techniques such as stepwise regression or regularization methods Overall multivariate regression is a powerful tool for predicting a continuous response variable based on multiple predictor variables and can be a useful addition to any data analysis toolkit Ridge regressionhere is an example of using ridge regression on sample data using Python First we can start by importing the necessary libraries import numpy as npfrom sklearn linear model import RidgeNext let s define our sample data in a tabular form Predictor Predictor ResponseWe can then convert this data into arrays that can be used by the ridge regression model X np array y np array Now we can create a ridge regression model and fit it to the data model Ridge alpha model fit X y The alpha parameter in the model specifies the amount of regularization to apply A larger alpha value will result in a model with more regularization which can help to reduce overfitting Finally we can use the model to make predictions on new data predictions model predict print predictions This will output an array with the prediction for the response variable based on the given predictor variables In this case the prediction would be Overall ridge regression is a useful tool for modeling linear relationships with one or more predictor variables while also being able to address the issue of overfitting Lasso regressionBelow is an example of lasso regression using a sample dataset of housing prices in a city The goal is to predict the price of a house based on its size in square feet and number of bedrooms Size sqft BedroomsPrice Here is the Python code for implementing lasso regression using the sample data import pandas as pdfrom sklearn linear model import Lasso Load the data into a pandas DataFramedf pd read csv housing prices csv Define the predictor variables and the response variableX df Size sqft Bedrooms y df Price Fit the lasso regression model to the datalasso Lasso alpha lasso fit X y Make predictions using the lasso modelpredictions lasso predict X Print the model s coefficientsprint lasso coef In this example the lasso model is fit to the data using an alpha value of which determines the strength of the regularization term The model is then used to make predictions for the response variable housing prices based on the predictor variables size and number of bedrooms Finally the model s coefficients are printed which indicate the importance of each predictor variable in the model Lasso regression is useful in situations where there may be a large number of predictor variables and we want to select only the most important ones for the model The regularization term helps to shrink the coefficients of the less important variables towards zero effectively eliminating them from the model This can improve the interpretability and generalizability of the model Elastic net regressionHere is an example of the sample data in tabular form predictor variable predictor variable predictor variable response variableIn this example we are using elastic net regression to predict the response variable based on the three predictor variables The alpha parameter in the ElasticNet model controls the amount of regularization and the l ratio parameter controls the balance between the L and L regularization terms In this example we set alpha to and l ratio to which means that the model will use a combination of L and L regularization The model is then fit to the training data using the fit method and the mean absolute error is used to evaluate the model s performance on the test set First we will start by importing the necessary libraries and the sample data import pandas as pdfrom sklearn linear model import ElasticNetfrom sklearn model selection import train test split load the sample datadata pd read csv sample data csv Next we will split the data into a training set and a test set split the data into a training set and a test setX data drop response variable axis y data response variable X train X test y train y test train test split X y test size random state Then we will fit the elastic net regression model to the training data fit the elastic net model to the training datamodel ElasticNet alpha l ratio model fit X train y train Finally we can use the model to make predictions on the test set and evaluate its performance make predictions on the test setpredictions model predict X test evaluate the model s performancefrom sklearn metrics import mean absolute errorprint mean absolute error y test predictions Stepwise regressionhere is an example of stepwise regression using the scikit learn library in Python First we will import the necessary libraries and generate some sample data import numpy as npimport pandas as pdfrom sklearn datasets import make regressionX y make regression n samples n features random state This generates samples with predictor variables and a continuous response variable Next we will split the data into training and test sets and standardize the predictor variables from sklearn model selection import train test splitfrom sklearn preprocessing import StandardScalerX train X test y train y test train test split X y test size random state scaler StandardScaler X train scaler fit transform X train X test scaler transform X test Now we can fit a stepwise regression model using the StepwiseRegressor class from scikit learn from sklearn linear model import StepwiseRegressormodel StepwiseRegressor direction backward max iter model fit X train y train The direction parameter specifies whether we want to add or remove variables from the model and the max iter parameter specifies the maximum number of iterations for the stepwise selection process We can then use the model to make predictions on the test set y pred model predict X test Finally we can evaluate the performance of the model using metrics like mean squared error from sklearn metrics import mean squared errormse mean squared error y test y pred print f Mean Squared Error mse f This will print out the mean squared error of the model on the test set Here is a sample of the data in tabular form Predictor Predictor Predictor Predictor Predictor Predictor Predictor Predictor Predictor Predictor Response Multivariate adaptive regression splines MARS Here is an example of using the Multivariate adaptive regression splines MARS model in Python with sample data First we will need to install the py earth package which provides the MARS model in Python pip install py earthNext we will import the necessary libraries and load the sample data import pandas as pdfrom pyearth import Earth Load sample data from a CSV filedf pd read csv sample data csv The sample data might look something like this XXXYWe can then fit the MARS model to the data using the Earth function from the py earth package Create the MARS modelmars model Earth Fit the model to the datamars model fit df X X X df Y We can then make predictions using the predict function Make predictions using the modelpredictions mars model predict df X X X Finally we can evaluate the performance of the model using a metric such as mean squared error from sklearn metrics import mean squared error Calculate the mean squared error of the predictionsmse mean squared error df Y predictions print f Mean squared error mse This is a simple example of using the MARS model with sample data but keep in mind that this model is particularly useful for modeling complex non linear relationships so it may be necessary to tune the model parameters or transform the data in order to get good results Random forest regressionHere is an example of random forest regression using sample data in tabular form with Python code and an explanation Sample Data XXYExplanation In this example we have a dataset with two predictor variables X and X and a response variable Y We want to use random forest regression to model the relationship between X and X and predict the value of Y Python Code Import necessary librariesfrom sklearn ensemble import RandomForestRegressorfrom sklearn model selection import train test split Split the data into training and testing setsX y X train X test y train y test train test split X y test size Train the model using the training datamodel RandomForestRegressor model fit X train y train Make predictions on the testing datay pred model predict X test Evaluate the model s performancescore model score X test y test print Model score score Explanation In the code above we first import the necessary libraries for random forest regression and splitting the data into training and testing sets Then we split the data into training and testing sets using the train test split function Next we create a random forest regression model and fit it to the training data using the fit function After that we use the model to make predictions on the testing data using the predict function Finally we evaluate the model s performance by calculating the score on the testing data using the score function The output of this code will be the model s score which is a measure of how well the model was able to predict the response variable based on the predictor variables If you liked the post then please 2023-01-04 11:21:55
海外TECH DEV Community Learning from Real Projects: AWS Beyond the Certifications (1/10) https://dev.to/aws-builders/learning-from-real-projects-aws-beyond-the-certifications-110-41g7 Learning from Real Projects AWS Beyond the Certifications It requires some skill to mug up the names of AWS services Yet another to clear certifications However building well architected enterprise scale applications requires a different metal I have seen many newcomers spend themselves acquiring the first two and find themselves in a mess when they face the real world It is not rocket science but it requires a different mindset some training and a lot of learning A lot of good training material is available on the internet However it is buried beneath the SEO optimized content that talks of nothing beyond the certifications This series of blogs is based on my experience and interaction with such projects I have gathered a list of common points that can help you avoid problems and simplify the process Such a list can not be complete Please append your experiences in the comments The series will cover the following topics Creating the AWS Account Protecting the AWS Account Setting up the development environment Infrastructure as Code ーyou need it Servers Containers or Lambda Everything fails all the time Event driven architecture Monitoring ーnow or never Reduce your bills Data ーcost complexity and opportunity Creating the AccountLet us start with day zero You have a brilliant idea and you want to implement that Being wise you naturally choose to build it on AWS You gather a team of bright young minds who cracked the AWS certification and are eager to work on the new start up Now you need an AWS account so that you can dive in So you tell that motivated fresher to go ahead and create that account quickly Wait The mistakes begin at this point How do you create that AWS account Which plan do you choose Which country do you specify How many AWS accounts should you create How do you manage access to those accounts How do you manage passwords What about the compliances Now is the time to think and plan for it These points are often ignored in the hurry and excitement “We can check that later And that later never arrives If you procrastinate now you will soon end up in a mess that is impossible to resolve Which Country AWS has a similar infrastructure across the globe Any account can use services from any region However the legal constraints of each country enforce some differences in the billing structure Each country has its own taxation rules and your bills can vary depending on where you register the account Some of the services are blocked in some countries Once your account is registered in one country it is difficult if not impossible to migrate it to another This can cause problems especially if you hope to sell your work someday Sometimes we do not have a choice so we have to live with this problem However if you have a choice with an international team do some research and make a smart choice about the country where you register the AWS account Root UserGreat So you decided on the country and went ahead to create the account Which Email ID do you use to create the account Obviously you don t want all the spam in your inbox so you try to delegate the task to someone else However make sure you think well before choosing this email id You should be able to monitor that inbox Anyone having access to that mailbox can hijack your AWS account Anyone accessing that mailbox can reset your password and break into your AWS account In an unfortunate scenario if your account is compromised AWS can detect it They have algorithms that can identify unusual activity and alert the user by emailing the registered id You should not miss such emails I know a friend who used an unmonitored mailbox to keep his inbox clean Unfortunately a hacker found his way into the account and created a fleet of EC instances AWS generated several alarm emails However they were ignored it was too late when he saw the problem I like to use group emails for this purpose That reduces the chance of missing important emails and even if one person turns into a traitor or tries to misuse the access to reset a password the others will be able to jump in and protect the account Support PlanYou choose the appropriate email id and then complete the account setup Being a bootstrapped startup you are short of funds so you choose the free basic plan and finally create the account successfully The basic plan is good enough to start your work But once you are ready don t forget to upgrade it at least for a month The cost is low and the benefits are pretty high Of course you don t have to stay on the higher plan for all your life However it makes sense to consult the experts for their advice to make sure you are on the right path There are a lot of things that you are doing for the first time and the experts have seen every day for the last few years They will point out some problems you have yet to think of I have always had a great experience with them I was surprised when they told me how to reduce my bills and avoid vendor lock ins Don t forget to switch back to the basic plan once you are done CredentialsNow is the time for the next big mistake This is a horrible one But unfortunately a lot of educated people do this Once the account is ready they shoot out an email to the team ーproviding the root user credentials Yes you were born lucky Grace has always saved you from the greatest disasters However that does not mean you invite more of them Never share the root credentials with anyone You should set up a huge ugly and impossible password for the root user Top it with MFA and save the credentials in the safest possible place Use the root id only if you must Additionally protect your root account with appropriate alarms Even if you are the only user do not use the root account for your regular tasks When you use an account frequently it is more likely to fall into the wrong hands And if you share the root credentials with the whole team it will undoubtedly land in the wrong hands In an unfortunate case if an IAM user or SSO user is compromised you can log in with the root user and delete the IAM SSO user However if the root user is compromised the only thing you can do is pay the bill I had witnessed the chaos when an account was compromised AWS support was highly cooperative and they helped us in every possible way That was because we had followed all the prescribed best practices If you miss out on those only God can help you How many Accounts Foremost understand that any meaningful enterprise needs more than one account If you are a loaner just learning AWS or working on a POC don t complicate your life with more accounts More accounts imply more risk of getting hacked However you better get organized now if you hope to do anything beyond the POC It is now or never Never ever have development test and production deployments in the same AWS account That is the key to disaster Sooner or later you are bound to face the fire when someone deletes a production resource “by mistake thinking it was a test Yes you can have precise access control with granular policies With extreme caution you can create the right user groups resource tags and policies based on tags You can ensure that all the account resources are appropriately classified into the correct environments You can have a smart resource naming and tagging strategy to make sure there are no clashes With all the effort you can ensure that all the users can do just what they are supposed to do and nothing more than that With rigorous discipline we can have a secure system with dev test prod in the same AWS account However I feel it is better to save that rigor for something more useful Be practical and don t test your fate Just follow the AWS guidelines and stay safe Even within the production environment a multi account approach has several advantages AWS OrganizationThis is often ignored in most tutorials It has little weightage in the associate certification exams So most architects know little beyond the name If that is you I suggest you invest a day and get your hands dirty You will thank yourself a year down the line Okay so how many accounts should we create You need two accounts on day zero if you have just started your development The management account and a development account Immediately after you have created the first account and secured the root user go ahead and Create an organization That will take a few seconds to process Meanwhile go back to your mailbox and verify the email address for the organization root Now the organization has only one account ーthe management account This is the account you created some time back Like the root user the management account should be handled with absolute care Never use it for anything other than managing the organization Set up the correct alarms so that we can track any activity there Check out this tutorial to see how AWS is generous ーespecially with startups Throughout the development process you will gather a lot of billing credits Make sure you apply them to the management account Development AccountOnce the organization is initiated we add the development account to it Navigate to the Organization accounts page and “Add an AWS Account Select “Create an AWS Account Again we must provide an email id for the new AWS account Choose this carefully as discussed above Give a name to this account ーDevelopment This will take a few minutes to create Once it is done you can start developing using this account You will surely mess up its configuration in the development process It is best to keep that mess isolated You can create testing staging and production accounts when your application matures Multiple Accounts per StageSplitting it into multiple accounts per stage makes sense if you build a more extensive application Security Different parts of the enterprise have different security requirements Some are inherently more sensitive than others We can simplify an auditor s and hence our own job by separating them For example if all the credit card data can be held in an isolated account that reduces the auditor s work We are happy if the auditor is happy Isolating data in different AWS accounts can simplify the process and ownership An account boundary isolates different units of the application Thus any risk or loss can be contained within the isolated unit Multiple Teams More often than not enterprise scale applications are developed and maintained by multiple teams Each of them has different responsibilities They require different resources and they follow different processes Business units or products often have entirely different purposes and processes Individual accounts can be established to serve business specific needs If we have multiple accounts for the different teams we can reduce the chaos of teams interfering with one another Each team can own its policies and processes without sacrificing anything for account level discipline Billing An account is the simplest way to split the bills among components We can have billing tags that help us identify the cost breakdown However that requires more effort than the benefit it provides Of course it is easy to “forget a tag to stay within the budget Multiple accounts make it easy to enforce discipline We can have quotas and detailed tracking At the same time we can use organizations to have centralized billing Please watch this video to understand organizations in detail Identity Center Single Sign on When you have too many accounts naturally you have too many passwords to remember Naturally we are tempted to reduce the stress on our memory by choosing simpler passwords which is wrong Also it is a difficult task for the administrator to track and manage multiple users in multiple accounts It gets messy very soon Single Sign on is a convenience feature that helps us solve this problem We can create granular groups and users with specific access to individual AWS accounts It requires some effort for the admin to set up However like most of the points above you should invest in this A few hours at this time will save you a lot of trouble and risk in the years to come AWS ActivateIf you are a startup working on a promising application AWS would be happy to help you begin They are very generous with startups Once you have the basics ready apply for help from AWS Activate Not just free credits you will get help on several other fronts It makes sense to understand the opportunities they provide Invest a few hours reading through it and chat with them to understand more possibilities They are eager to hand hold you to success 2023-01-04 11:20:44
海外TECH DEV Community How to Fetch Data in React with useSWR https://dev.to/refine/how-to-fetch-data-in-react-with-useswr-3dbe How to Fetch Data in React with useSWRAuthor Michael Hungbo IntroductionData is unquestionably an important component of any modern web application today And as the web evolves and innovates new methods of interacting with this data must emerge in order to provide users with a better experience when interacting with our applications There have been a variety of technologies used for client side data fetching JavaScript for example has the native Fetch API for data fetching Axios is a promised based HTTP client library for making asynchronous HTTP requests and fetching any data on the client side SWR is one of the most powerful client side data fetching libraries for frontend frameworks today In this article we will explore the features and benefits of using SWR in an example Next js application and provide a step by step guide for getting started with the library Whether you are new to React js or an experienced developer looking to optimize your data fetching strategy SWR is a powerful tool worth considering Now let s get started Steps we ll cover What is SWR and useSWR Setting up an Example App With SWRAdditional Features of SWR PrerequisitesTo follow along well with this tutorial it s essential that you have basic knowledge of JavaScript and React SWR is a library for use with React and its frameworks so it s required that you re familiar with the basics of both of these technologies In addition make sure you have Node installed on your computer before continuing What is SWR and useSWR SWR is an acronym for stale while revalidate It s a lightweight React js library with hooks for data fetching on the client side SWR is bootstrapped with various hooks that are used for various performance improvement techniques such as data caching re validation pagination and many others The latest version of SWR SWR was released on December and it features some new and exciting updates such as data preloading new mutation APIs improved optimistic UI capabilities and a brand new DevTools for better developer experience useSWR on the other hand is the most basic hook from the SWR library for data fetching A basic example using the hook is shown below const data error useSWR key fetcher The useSWR hook accepts two arguments One a key value usually the API endpoint to fetch data from and a fetcher which is an async function that contains the logic for fetching the data From the above example useSWR returns two values data which is the value returned from the resource you re fetching and a error which contains error if any is caught It also returns two additional values isLoading and isValidating depending on the state of the fetcher function In the next section we ll see how we can use this powerful hook as well as the other capabilities of SWR in an example application Setting up an Example App With SWRWe ll create an example application in React to get started with understanding how SWR works and how to start using it Basically we ll compare and contrast fetching data with the native Fetch API or other client side data fetching libraries such as Axios you re used to and fetching data with SWR You can check out the complete code for the application on GitHub Run the following command in your terminal to create a new React project with create react app npx create react app my swror with Yarn yarn create react app my swrNOTE I named the app my swr for brevity but you can also choose any name you re okay with After the installation is complete cd into the project directory and start the development server with npm start or yarn start Next run the following command to install the necessary packages for our example application npm install styled components swror with Yarn yarn add styled components swr Creating a ServerFor the example application we ll be building we ll set up a server with express running on http localhost The server basically returns a list of users that will be rendered on the client side In the project root folder create a new server folder navigate to it on the command line and run the following command to create a new Node js project with an auto generated package json file npm init yor with Yarn yarn init yNext we ll install the necessary packages to build up our server npm install express cors nodemonwith Yarn yarn add express cors nodemonStill in the server folder create a file named index js with the following code server index jsconst express require express const cors require cors const app express app use cors const data name Kim Doe age avatar name Mary Jane age avatar name Ken Joe age avatar app get req res gt res json data app listen gt console log App listening on port In the above code we re basically creating a server in express js and also we created a dummy data array for the list of users we ll render on the client side We also added cors to allow our client application communicate with the server without running into errors Next we ll edit the content of server package json to the following server package json name server version main index js license MIT dependencies cors express scripts dev nodemon index js NOTE I have nodemon installed globally so it s not included in the list of dependencies but you ll find it included in yours Also if you re using git you may want to create a gitignore file in the server folder to avoid pushing the files in node modules We can now run npm dev or yarn dev depending on the package manager you used to start up the server If everything works correctly you should see App listening on port logged to the console Data Fetching with Fetch APILet s go back to the client side code now that we have the server up and running In this part we ll fetch the users from our backend the server we created earlier and display them in a simple component Navigate to the src folder in the root directory and create a folder named components In the components folder create a Home js file with the following code src components Home jsimport React from react import useState useEffect from react const Home gt const users setUsers useState null useEffect gt async function fetchUsers const response await fetch http localhost const data await response json setUsers data fetchUsers if users return lt h gt Loading lt h gt return lt gt lt div gt users map user index gt return lt h key index gt user name lt h gt lt div gt lt gt export default HomeNext edit the content of src App js to the following src App jsimport App css import Home from components Home function App return lt div className App gt lt header className App header gt lt Home gt lt header gt lt div gt export default App In the code above we re importing the Home js component we created to render it in the homepage of our application Now if you navigate to http localhost the list of users from the server should be displayed as shown below Our app works correctly Awesome Now let s see how the application behaves when we add a new user to the user list on the server In the server index js file add a new user to the data array like below server index js const data highlight start name John Doe age avatar highlight end Notice how the list isn t updated with the new user when we navigate back to http localhost It s only when we reload the page before we get the updated list of users The GIF below shows this even better Inconsistencies in UI updates and data fetching behavior could be disastrous for applications that rely on real time data to provide a reactive and seamless experience to users This is one major problem that SWR aims to solve Data Fetching With SWRIn this part we ll see how SWR outshines other data fetching methods by automatically re validating and updating data without requiring us to manually refresh or reload the application Edit the content of src components Home js to the following src components Home jsimport React from react import useSWR from swr const Home gt const fetcher args gt fetch args then res gt res json const data error isLoading useSWR http localhost fetcher if error return lt div gt Failed to fetch users lt div gt if isLoading return lt h gt Loading lt h gt return lt gt lt div gt data map user index gt return lt h key index gt user name lt h gt lt div gt lt gt export default HomeLet s go through the code above to understand what s going on From the code above we import the useSWR hook from SWR The hooks take a key that is the URL of our server and a fetcher function that contains the logic for fetching the data The hook then returns three values based on the state of the result from the server The data object contains the list of users and the error will contain any error that is thrown Next we map through the users array that is returned in the data object and render them on the page Now if you navigate to http localhost the list of users should be displayed like below So far so good Now let s also add a new user to the list on the server and see how the application behaves Open the server index js file and add a new user to the data array like so server index js const data highlight start name Peter Pan age avatar highlight end Go to http localhost in the browser and note how the users list is automatically updated with the new user we added without us reloading the page The GIF below shows this in action Notice how fast and consistent the UI is updated with the new user This example shows one of the incredible powers of SWR over other client side data fetching methods It shows how SWR is able to auto re validate and update the UI instantly using cached data and returning the latest user from the server How SWR is able to infer that the data has been updated and then re validating and updating the UI is beyond the scope of this article However if you re curious to know you can read more about it here in the docs Is your CRUD app overloaded with technical debt Meet the headless React based solution to build sleek CRUD applications With refine you can be confident that your codebase will always stay clean and boilerplate free Try refine to rapidly build your next CRUD project whether it s an admin panel dashboard internal tool or storefront Additional Features of SWRWe saw one of SWR s best features in action in the previous section this section will show you even more of what SWR is made and capable of PaginationSWR simplifies paginating data using the useSWR hook We ll see a basic example of paginating data with useSWR using the Rick and Morty Character API In the components folder of our example application create a file named Characters js and add the following code to it src components Characters jsimport React from react import useState from react import useSWR from swr import styled from styled components const Wrapper styled div margin px auto const Character styled div width px height px border radius px outline none border none const Button styled button width px height px border radius px background color cce margin inline px outline none border none color white font weight bold const Container styled div width margin auto display grid gap px padding block px grid template columns fr fr fr fr const Characters gt const pageIndex setPageIndex useState const fetcher args gt fetch args then res gt res json const data error isLoading useSWR pageIndex fetcher if error return lt div gt Failed to fetch characters lt div gt if isLoading return lt h gt Loading lt h gt return lt gt lt Container gt data results map character gt lt Character key character id gt lt img width height src character image gt lt div gt character name lt div gt lt Character gt lt Container gt lt Wrapper gt lt Button onClick gt setPageIndex pageIndex gt Previous lt Button gt lt Button onClick gt setPageIndex pageIndex gt Next lt Button gt lt Wrapper gt lt gt export default Characters In the above code we are fetching characters from the Rick and Morty API The endpoint returns characters per request We also used a React state to keep track of the pages so we can simply move forward and backward through the fetched characters to create a pagination effect Next open the App js file in the root folder and edit its content to this App jsimport App css import Home from components Home import Characters from components Characters function App return lt div className App gt lt header className App header gt lt Home gt lt Characters gt lt header gt lt div gt export default App Basically what we re doing is commenting out the previous Home component and then import and render the Characters component on the homepage instead Navigate to http localhost and you should see the characters rendered as shown in the GIF below with pagination enabled You can read more about pagination in SWR in the docs Preloading Data With SWRAnother notable use case of SWR is data preloading With SWR we can prefetch data for example fetching blog posts from a CMS or prefetching page routes in Next js for faster and smooth client side transitions We can prefetch data using the preload API from SWR The following example from the docs shows how you can preload a user component on the click of a button import useState from react import useSWR preload from swr const fetcher url gt fetch url then res gt res json Preload the resource before rendering the User component below this prevents potential waterfalls in your application You can also start preloading when hovering the button or link too preload api user fetcher function User const data useSWR api user fetcher export default function App const show setShow useState false return lt div gt lt button onClick gt setShow true gt Show User lt button gt show lt User gt null lt div gt SWRDevToolsThe newest version of SWR comes with developer tools for debugging and writing your code more efficiently and confidently You can install the SWRDevTools extensions for both Chrome and Firefox from their respective stores Chrome Firefox Be aware that SWRDevTools is not an official project of Vercel You can learn more about the project from their website TypeScript SupportSWR also comes with full TypeScript support out of the box If you re using TypeScript you can be rest assured of type safety in your application For example SWR will infer the argument types of fetcher from key so you can have the preferred types automatically You can also explicitly specify the types for key and fetcher s arguments like so import useSWR Key Fetcher from swr const uid Key lt user id gt const fetcher Fetcher lt User string gt id gt getUserById id const data useSWR uid fetcher data will be User undefined You can read more about using TypeScript with SWR here This section only touched on a few of SWR s many capabilities so your first encounter with it will not be overwhelming You can however check the documentation for other features that might interest you ConclusionIn this article we learned about the basics of SWR its importance in developing modern web applications and how you can get started with it We also created an example application in React and explored some capabilities of SWR to see its use cases and benefits over other conventional client side data fetching methods I hope you found this article useful and that you will begin using SWR to achieve the performance improvements you ve always desired in your applications 2023-01-04 11:14:52
海外TECH DEV Community Why Django in 2023 https://dev.to/jagroop2000/why-django-in-2023-2knk Why Django in Well my reason to explore Django is purely Official Requirement as at office I would also start working on Full Stack Based Project whose Backend is powered with Django But After Exploring Python and Django in few days I have observed that Django is so popular and a person have great career in Django if He She go with this Why Django Let s Discuss Django is a popular web framework for building web applications with Python It is free and open source and has a large and active community of developers There are several reasons why you might want to learn Django in Django is a powerful web framework that makes it easy to build complex database backed web applications quickly It provides a lot of the functionality that you would normally have to build yourself such as user authentication and authorization database ORM Object Relational Mapping and more Django is highly customizable and flexible You can use it to build almost any type of web application from a simple blog to a complex social media platform Django is well documented and has a large community of users which means that it is easy to find help and resources online when you are learning Python is a popular programming language that is used in a wide variety of fields from data science to web development Learning Django will not only give you the skills to build web applications but it will also give you a strong foundation in Python that you can use in other areas Django is a mature and well established framework with a long history and a strong track record It has been used to build many high profile websites and applications including Instagram Pinterest and The Washington Times Django is scalable and performant It is designed to handle high levels of traffic and data and has a number of built in tools for optimizing performance Django follows the batteries included philosophy meaning that it includes a lot of functionality out of the box This can save you a lot of time and effort when building an application as you don t have to spend as much time integrating different libraries and frameworks Django has a large and active community of developers and users which means that it is constantly being improved and updated There are also many resources and tutorials available online making it easier to learn and get help when you need it Finally Django is a great choice for building web applications because it is easy to use and has a friendly welcoming community Whether you are a beginner or an experienced developer you will find it enjoyable and rewarding to work with Django 2023-01-04 11:02:02
海外TECH DEV Community Amazon Lex: Conversations in the Cloud https://dev.to/aws-builders/amazon-lex-conversations-in-the-cloud-hm Amazon Lex Conversations in the CloudConversational interface is the way of the future Nothing can beat the user experience of a user talking to your application Any amount of color optimization and responsive design on a website or mobile app is trivial when it is compared to the experience of a conversation Naturally such a conversation is difficult to implement However it is not so difficult either We have an array of tools and utilities to help us construct the chatbots as per our requirements This blog introduces you to Amazon Lex covering the following topics Introduction ーWhat is Lex Core conceptsCreate a simple botImproving the botLex vs ChatGPT ーUtility customization and integration IntroductionAmazon Lex is a service provided by Amazon Web Services AWS that enables users to build and deploy chatbots for use in a variety of applications These chatbots also known as conversational interfaces allow users to interact with a system or service through natural language input and output One of the key benefits of Amazon Lex is its integration with other AWS services This allows users to leverage the power of the AWS ecosystem to build and deploy their chatbots For example Amazon Lex chatbots can be integrated with Amazon Connect a cloud based contact center service to provide customer service through a chatbot interface In addition to its integration with other AWS services Amazon Lex also offers a variety of features to help users build and deploy high quality chatbots These features include Automatic speech recognition ASR Amazon Lex uses ASR to recognize spoken input from users and translate it into text This allows users to speak to their chatbot as they would to a human making the chatbot experience more natural and intuitive Natural language understanding NLU Amazon Lex uses NLU to understand the meaning and context of user input This allows the chatbot to respond appropriately to user requests and requests for information Text to speech TTS Amazon Lex offers TTS capabilities allowing chatbots to speak to users in a natural human like voice This can be particularly useful for applications such as customer service or information kiosks Customization Amazon Lex allows users to customize their chatbots through the use of Amazon Lex ML models and AWS Lambda functions This enables users to tailor their chatbots to their specific needs and build in custom logic and functionality Overall Amazon Lex is a powerful tool for building and deploying chatbots for a variety of applications Its integration with other AWS services and extensive customization options make it an ideal choice for users looking to build conversational interfaces for their business or service Core conceptsBefore we get into implementation we should understand a few important concepts involved in building chatbots IntentsAn intent represents the intention of the end user ーwhat does the user want The primary task of the chatbot is to try and guess this intent and map it with the intents it is programmed to process UtterancesThe chatbot tries to guess the intent based on the utterances of the user These are spoken or typed phrases in the user input The chatbot tries to relate them with the utterances configured for each of its known intents to identify the current intent SlotsThe intent alone is not enough The chatbot needs specific details related to the intent so that it can work on it These details should be identified from the user s input We call them slots They are specific words and phrases that appear in the long sentences that the user utters FulfillmentThis is the actual mechanism for your intent Once the intent and the slots are identified the chatbot invokes the fulfillment mechanism that we have configured Note that the utterances intents and slots come in free flowing text from the user They do not have a fixed format or sequence Here we cannot use the traditional techniques of text matching or regular expressions We need intense NLP using trained models to get these details That is why we need Amazon Lex With Lex we have readymade models that help us with these tedious tasks We just configure the basics and it takes care of the rest Create a botWith the basic theoretical understanding let us now implement a simple bot using Amazon Lex Let us create a chatbot that can tell us the latest news related to a given keyword It is a simple process that involves a few core concepts Let us check it out Jump to the Amazon Lex Console Click on “Create bot to start the process The configuration is straightforward We will start with the blank botProvide a name and optional description to identify the botLet AWS take care of creating the IAM RolesWe need not worry about the COPPA in the tutorialWe should be good with a minute session timeout To start with let us focus on text interaction in US English Finally click Done to create the bot That brings us to the intent creation Provide a name and description for the new intent Scroll down to slots and click on “Add slot Expand the “Prompt for slot city to provide more details Click on “Additional options Scroll down on the popup that opens on the right side of the screen to provide the slot capture success response Click on “Update Slot That will get you back to the intent configuration Scroll up again and add Sample utterances Type in the text field and click on “Add utterance to add individual utterances Note that city in curly braces is related to the slot ーcity that we added above Now scroll down further to enable fulfillment Click on “Advanced options That opens a popup on the right half of the screen Select the check box to “Use a lambda function for fulfillment Click on “Update options to close the popup and get back to the intent configuration Click on “Save Intent and then click on “Build to build the chatbot The build takes some time Once it is done add another intent for getting news related to a keyword The same steps as above with minor differences This time the slot is “keyword and its type is alphanumeric The utterances should be related to the news Again save the intent and build it Confirm the list of intents in the bot Note that there is a third intent that we did not create This is the Fallback intent which is triggered when the bot is not able to classify our request into any of the other intents If our bot frequently lands here it means we need to enrich the set of “Sample utterances Lex is capable of extending the set of utterances we provide into a more generic collection However it makes sense to apply minds here to do our best in providing the data set That is one of the points that differentiate a well crafted bot from a poorly developed one Now we have to work on the Lambda function that can fulfill our intent So jump to the Lambda console and create a new Lambda function Give it a name and choose Runtime as NodeJS Leave everything else as default and click “Create function Check out this link for the required source code in the Lambda function Clone or download the repository There is a deploy zip file that must be uploaded to the Lambda function On the lambda code tab click on “Update from and upload this zip file into the lambda function The Lambda function uses public APIs for the weather and news You will have to visit those websites and get the API keys for them It is simple and free Once done add those keys to the lambda environment Note that the lambda environment variable is not the best place to save API keys However it is okay for a demo application like this Deploy it and we are ready to go Now come back to the Lex console where the bot is ready for us Click on Test and it will open a popup Click on the gear icon to open the settings It will open another popup for the settings There add the Lambda function that should process the fulfillment requests Type into it to see how our bot works Here is my conversation with the bot Wow Try out different ways of asking the same question If something fails try to update the intent utterances and save the intent and build the bot again We can easily integrate this with our website or mobile app using AWS Amplify Improving the botThat was good for a simple demo bot It gives a glimpse of what we can do with Lex Obviously there is a lot more to Lex and to chatbot development For example we can configure several other aspects of the intent The confirmation closing remarks etc We can build up the session context as the user chats with the bot So the user can refer to an object used in a few commands before For example the user can ask about the weather in a city Then ask for news with a pronoun The bot can “remember the context and give the news about the same city Or the user can ask about the weather after a few minutes ーhow is the weather now The bot can remember the previous request and fulfill it without asking for the city again These are the interaction aspects of the bot We can also enhance it functionally For example instead of invoking free APIs for the news and weather we could have a bot that queries the real prices of the share market The user can just query the share prices and instruct a buy or sell from the chat console And of course we can use a voice interface to make this even more interesting In the above example we have used the text only interface We can enable a voice to make it even more interesting The sky is the limit for the variety of use cases and possibilities we have with the Amazon Lex bots It is an absolutely trivial task to configure and get the basic structure working Once it is ready we can add more and more features to it Lex vs ChatGPTChatGPT has hit many headlines and also many minds in the last few weeks However there is a big difference between the two ChatGPT no doubt has great features for generating awesome text content However when it comes to functionality utility and configurability it is far behind Lex FunctionalityAmazon Lex is a fully featured chatbot platform that allows developers to build test and deploy chatbots for various applications It includes natural language understanding NLU and automatic speech recognition ASR capabilities as well as integration with other AWS services ChatGPT on the other hand is an open source chatbot toolkit based on the GPT language model It is designed for generating human like text and can be used to build chatbots that can hold conversations with users CustomizationAmazon Lex offers a high level of customization allowing developers to fine tune the chatbot s behavior and responses based on their specific needs ChatGPT on the other hand is more limited in terms of customization It generates text based on the input it receives but developers have less control over the specific responses the chatbot provides IntegrationAmazon Lex integrates seamlessly with other AWS services such as Lambda and Amazon Connect This allows developers to build chatbots that can access data from other AWS services and perform various actions ChatGPT on the other hand does not have this level of integration with other tools and services Overall Amazon Lex is a more comprehensive chatbot platform while ChatGPT is a more specialized tool that is primarily focused on generating human like text Both can be useful for building chatbots but the best choice will depend on the specific needs and goals of the project 2023-01-04 11:01:31
Apple AppleInsider - Frontpage News Apple Watch blood oxygen sensor saves skier's life https://appleinsider.com/articles/23/01/04/apple-watch-blood-oxygen-sensor-saves-skiers-life?utm_medium=rss Apple Watch blood oxygen sensor saves skier x s lifeA San Diego news anchor has revealed how her year old son s potentially fatal high altitude pulmonary edema was uncovered by her Apple Watch Marcella Lee and her sonMarcella Lee anchor on San Diego s CBS news channel has told viewers how a recent skiing trip to Colorado almost killed her son Despite the whole family having regularly skied before and being familiar with Colorado they initially all experienced high altitude issues Read more 2023-01-04 11:47:39
Apple AppleInsider - Frontpage News Keychron S1 review: Minimal, mechanical, modern https://appleinsider.com/articles/23/01/04/keychron-s1-review-minimal-mechanical-modern?utm_medium=rss Keychron S review Minimal mechanical modernThe Keychron S is a low key mechanical keyboard alternative for those starting out in the field of enthusiast level peripherals The S is Keychron s attempt at a minimal yet high quality mechanical and wired keyboard that offers the same customization as others from the manufacturer Those new to mechanical keyboards will find the S to be highly accessible with the option for hot swappable keys and easily customizable key mapping with QMK VIA software Read more 2023-01-04 11:31:17
Apple AppleInsider - Frontpage News Plugable reveals first Thunderbolt 4 dock, 11 port USB-C hub, 240W cable during CES 2023 https://appleinsider.com/articles/23/01/04/plugable-reveals-first-thunderbolt-4-dock-11-port-usb-c-hub-240w-cable-during-ces-2023?utm_medium=rss Plugable reveals first Thunderbolt dock port USB C hub W cable during CES The Plugable in Thunderbolt Quad Dock is the first of its kind from the company which was revealed during CES alongside a USB C dock and W cable Plugable s new docks and cables from CESThunderbolt has permeated through many popular consumer products like the MacBook Pro and various Windows PCs To take advantage of this Plugable has announced its first Thunderbolt dock alongside some other high end accessories Read more 2023-01-04 11:15:59
Apple AppleInsider - Frontpage News Apple's MagSafe is foundation for new Qi2 wireless charging standard https://appleinsider.com/articles/23/01/03/apples-magsafe-is-the-foundation-for-new-wireless-charging-standard?utm_medium=rss Apple x s MagSafe is foundation for new Qi wireless charging standardApple has provided MagSafe as the basis for the upcoming wireless charging standard Qi making it universal across platforms MagSafe goes universal with QiThe Wireless Power Consortium has announced that Qi pronounced chee two will replace the existing wireless charging standard in Apple has provided MagSafe as the basis for Qi which should lead to more universal interoperability of accessories and chargers Read more 2023-01-04 11:14:51
Apple AppleInsider - Frontpage News Apple's AR headset to automatically adjust lenses for perfect images https://appleinsider.com/articles/23/01/03/apples-ar-headset-to-automatically-adjust-lenses-for-perfect-images?utm_medium=rss Apple x s AR headset to automatically adjust lenses for perfect imagesApple s long rumored AR and VR headset will use motors to automatically adjust lenses for the user new details about the inbound product surface as Apple gets even closer to launching it A render of a potential Apple headset AppleInsider The mixed reality headset has been the subject of many rumors over time and despite an extended development time is still thought to be on the way In a Tuesday report on the head mounted device the headset is expected to include many quality of life improvements to the existing augmented reality and virtual reality headset format Read more 2023-01-04 11:38:38
海外TECH Engadget Future Android phones will feature MagSafe-like wireless fast charging https://www.engadget.com/qi-2-charging-borrowed-from-apple-is-coming-to-android-phones-in-2023-114738401.html?src=rss Future Android phones will feature MagSafe like wireless fast chargingThe Wireless Power Consortium WPC has unveiled Qi the wireless charging successor to Qi that borrows some tricks from Apple s MagSafe charging The idea is to create a unified system that should work with both Android and Apple devices the WPC wrote in a press releaseQi will replace the current Qi standard that has been around for over years It ll be built off of Apple s MagSafe technology that came along with the iPhone using a similar system of magnets and a wireless charging coil However it will introduce something called the Magnetic Power Profile that ensures phones and other devices are perfectly aligned to maximum charging speed and efficiency It also assures compatibility among brands nbsp quot Qi s perfect alignment improves energy efficiency by reducing the energy loss that can happen when the phone or the charger is not aligned quot said WPC s executive director Paul Struhsaker in a statement quot Just as important Qi will greatly reduce the landfill waste associated with wired charger replacement due to plugs breaking and the stress placed on cords from daily connecting and disconnecting quot The first Qi version will launch this year with support for watt charging foreign object detection and more It ll also provide faster charging for some devices improve safety and prevent device damage or battery life shortening nbsp The Magnetic Power Profile standard also makes improvements easier down the road Future iterations will quot significantly quot raise charging levels past watts WPC told The Verge It could also allow wireless charging for unusually shaped accessories that aren t compatible with the current crop of flat charging pads There are still some question marks like whether Qi will be backwards compatible with the current Qi standard or Apple s MagSafe It will reportedly also require authentication which may allow manufacturers to refuse charging from non certified devices nbsp nbsp Hopefully device and charger manufacturers will strive to main compatibility The Qi spec should be ready by this summer and products are set to arrive by the holidays in nbsp 2023-01-04 11:47:38
ニュース BBC News - Home Warm winter may lower energy bills later this year https://www.bbc.co.uk/news/business-64162811?at_medium=RSS&at_campaign=KARANGA april 2023-01-04 11:47:00
ニュース BBC News - Home What is the energy price cap and what will happen to bills? https://www.bbc.co.uk/news/business-58090533?at_medium=RSS&at_campaign=KARANGA april 2023-01-04 11:24:46
ニュース BBC News - Home Rishabh Pant accident: India wicketkeeper to be flown to Mumbai for surgery following car crash https://www.bbc.co.uk/sport/cricket/64160804?at_medium=RSS&at_campaign=KARANGA Rishabh Pant accident India wicketkeeper to be flown to Mumbai for surgery following car crashIndia wicketkeeper Rishabh Pant will be flown to Mumbai by air ambulance to undergo surgery after being injured in a car crash last week 2023-01-04 11:02:27
ニュース BBC News - Home Michael Smith: PDC world champion on being world number one & Catchphrase preparation https://www.bbc.co.uk/sport/darts/64161833?at_medium=RSS&at_campaign=KARANGA Michael Smith PDC world champion on being world number one amp Catchphrase preparationNew PDC world champion Michael Smith reflects on his title win and how TV quiz shows became a regular part in his preparation 2023-01-04 11:46:42
サブカルネタ ラーブロ 旭川ラーメン 梅光軒 神居店 味噌篇 http://ra-blog.net/modules/rssc/single_feed.php?fid=206516 旭川ラーメン 2023-01-04 11:35:23
サブカルネタ ラーブロ らぁめん 鴇@藤沢(神奈川県) 「塩」 http://ra-blog.net/modules/rssc/single_feed.php?fid=206517 続きを読む 2023-01-04 11:11:47
GCP Google Cloud Platform Japan 公式ブログ IT 業界の予測: マルチクラウドは 1 つの段階であって、最終ゴールではない https://cloud.google.com/blog/ja/topics/hybrid-cloud/predicting-the-future-of-multicloud/ 予測パブリッククラウドを使用している組織の半数以上が、マルチクラウド機能を利用できるようになった結果、プライマリクラウドプロバイダを自由に切り替えるようになる今後数年間で企業は、リスクを分散させる手段としてだけでなく、最初のクラウドから次のクラウドに切り替える方法としても、マルチクラウド戦略を利用するようになるでしょう。 2023-01-04 11:30:00
北海道 北海道新聞 ふるさと納税、根室市170億円 7年連続の最多更新 https://www.hokkaido-np.co.jp/article/783499/ 連続 2023-01-04 20:38:18
北海道 北海道新聞 冬山遭難、北海道内で急増 大半はバックカントリー 道警「注意を」 https://www.hokkaido-np.co.jp/article/783542/ 北海道内 2023-01-04 20:36:12
北海道 北海道新聞 レバンガに東海大4年の島谷が加入 特別指定選手、釧路生まれ https://www.hokkaido-np.co.jp/article/783427/ 特別指定選手 2023-01-04 20:23:53
北海道 北海道新聞 主要企業のトップが年頭所感 逆境に向かい成長目指す https://www.hokkaido-np.co.jp/article/783541/ 仕事始め 2023-01-04 20:20:00
北海道 北海道新聞 安全操業交渉「めど立っていない」 外務省ロシア課長 羅臼漁協で説明 https://www.hokkaido-np.co.jp/article/783538/ 課長 2023-01-04 20:11:00
北海道 北海道新聞 道内企業仕事始め 変化への対応力向上、難局越え意欲 https://www.hokkaido-np.co.jp/article/783537/ 仕事始め 2023-01-04 20:05:00
北海道 北海道新聞 「子育てしやすい町に」 白老町長選に広地氏が出馬表明 https://www.hokkaido-np.co.jp/article/783519/ 記者会見 2023-01-04 20:03:12
GCP Cloud Blog JA IT 業界の予測: マルチクラウドは 1 つの段階であって、最終ゴールではない https://cloud.google.com/blog/ja/topics/hybrid-cloud/predicting-the-future-of-multicloud/ 予測パブリッククラウドを使用している組織の半数以上が、マルチクラウド機能を利用できるようになった結果、プライマリクラウドプロバイダを自由に切り替えるようになる今後数年間で企業は、リスクを分散させる手段としてだけでなく、最初のクラウドから次のクラウドに切り替える方法としても、マルチクラウド戦略を利用するようになるでしょう。 2023-01-04 11:30:00

コメント

このブログの人気の投稿

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

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

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)