投稿時間:2023-02-24 11:18:16 RSSフィード2023-02-24 11:00 分まとめ(23件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT @IT Smart & Socialフォーラム 最新記事一覧 “AIチャット検索=イケてない彼氏”説 「新しいBing」とケンカしながら考えた https://atmarkit.itmedia.co.jp/ait/articles/2302/23/news038.html 人工知能 2023-02-24 10:25:00
IT InfoQ CloudNativeSecurityCon 2023: SBOMs, VEX, and Kubernetes https://www.infoq.com/news/2023/02/sboms-vex-kubernetes/?utm_campaign=infoq_content&utm_source=infoq&utm_medium=feed&utm_term=global CloudNativeSecurityCon SBOMs VEX and KubernetesAt CloudNativeSecrityCon in Seattle WA Kiran Kamity founder and CEO of Deepfactor led a panel discussion on software supply chain security the practical side of SBOMs and VEX By Mostafa Radwan 2023-02-24 02:00:00
IT @IT 全フォーラム 最新記事一覧 “AIチャット検索=イケてない彼氏”説 「新しいBing」とケンカしながら考えた https://atmarkit.itmedia.co.jp/ait/articles/2302/23/news038.html 人工知能 2023-02-24 10:25:00
TECH Techable(テッカブル) 大容量&高出力!11台のデバイスに同時出力、1.5時間でフル充電できるポータブル電源が登場 https://techable.jp/archives/197054 amazon 2023-02-24 01:30:17
TECH Techable(テッカブル) 目覚まし機能つき!4デバイス同時充電可能なワイヤレス充電器がリリース https://techable.jp/archives/197076 gloture 2023-02-24 01:00:18
python Pythonタグが付けられた新着投稿 - Qiita Pythonでgoogletrans使用時の「AttributeError: 'NoneType' object has no attribute 'group'」解決方法 https://qiita.com/yuki343/items/6447368366fd0381705b 2023-02-24 10:02:01
js JavaScriptタグが付けられた新着投稿 - Qiita 画像を押すだけで紹介コードをコピーできるサイト https://qiita.com/yu1ezweb/items/a01b5a3de376f81de8cc 紹介 2023-02-24 10:03:45
Docker dockerタグが付けられた新着投稿 - Qiita Elixir 挑戦記 - 開発環境構築 https://qiita.com/SF-28/items/8f31465eef33d5b105c3 elixir 2023-02-24 10:03:22
Git Gitタグが付けられた新着投稿 - Qiita TortoiseGitプルできない解決方法 https://qiita.com/aonim/items/f66bf28a9e67597750d1 pportedauthenticationmeth 2023-02-24 10:57:41
技術ブログ Developers.IO 【UI分析】デジタルウェルビーイングに向き合うInstagramの機能が素晴らしい! https://dev.classmethod.jp/articles/ui_instagram_design/ instagram 2023-02-24 01:28:32
技術ブログ Developers.IO Google Cloud:プロジェクト、組織の削除方法 https://dev.classmethod.jp/articles/google-cloud-delete-orgproject/ cloud 2023-02-24 01:25:22
技術ブログ Developers.IO Control Tower が作った IAM Identity Center グループを消しても問題無いか確かめる https://dev.classmethod.jp/articles/ct-sso-group-kesitemo-ok/ 割り当て 2023-02-24 01:12:40
技術ブログ Developers.IO ECS클러스터 서비스 배포 옵션 블루/그린 배포 설정이 안될 때 해결 방법 https://dev.classmethod.jp/articles/ecs-cluster-can-not-setting-bluegreen/ 2023-02-24 01:00:31
海外TECH DEV Community Creating and Publishing a VS Code Extension: A Step-by-Step Guide with JavaScript https://dev.to/tylerasa/creating-and-publishing-a-vs-code-extension-a-step-by-step-guide-with-javascript-5ep1 Creating and Publishing a VS Code Extension A Step by Step Guide with JavaScriptI recently stumbled upon a unique and entertaining extension for VS Code called vscode pets created by Anthony Shaw This extension adds a virtual pet such as a dog to your screen providing a fun distraction from coding However there are many other pet options to choose from VS Code extensions are plugins that can enhance your coding experience with the Visual Studio Code editor They offer a range of features including syntax highlighting code formatting debugging testing linting snippets themes icons and more VS Code is designed with extensibility in mind making it easy to personalize and tailor to your needs The VS Code marketplace currently offers over extensions spanning from language and theme extensions to integration extensions and even fun and whimsical options To begin creating your own VS Code extension you will need to have Node js installed on your system Once you have Node js set up you can use a command line tool called yo short for Yeoman to generate a project template This template will provide you with a basic structure and files for your extension including a manifest file that defines the extension s metadata and dependencies You can then customize and build on this template to create your desired functionality The ProblemReact is my favorite JavaScript framework because of its versatility and powerful features However sometimes creating component state in React can be a bit of a hassle and require a lot of typing In today s post we will be addressing this issue and exploring ways to make this process less tedious While we won t be attempting to fix the entire framework we will be creating an extension that can simplify the creation of state in React components const counter setCounter useState Creating a simple counter state in React can involve a lot of typing which can be tedious and time consuming We all know how exhausting it can be to type out the same code repeatedly right That s where our new extension react setstate comes in With this extension we can create state variables in just a few keystrokes saving us time and effort Setting Up the Development EnvironmentTo get started with creating a Visual Studio Code extension we will need to install two packages yo and generator code These can be installed globally using npm with the following command npm install g yo generator codeyo is a popular scaffolding tool that helps developers generate new projects by using customizable generators generator code is a generator specifically designed for creating Visual Studio Code extensions By installing these two packages we will be able to quickly generate a new extension project and get started with coding right away Now that we have installed the necessary packages we can start creating our project To do this open up your terminal and run the following command yo codeThis will launch an interactive shell that will guide us through the process of creating our new extension We will be prompted to enter various details about our extension such as its name description and the type of extension we want to create By following the prompts and answering the questions we will be able to quickly generate the scaffolding for our new extension and start building our code ╭ー╮ │Welcome to the Visual │ o │Studio Code Extension │ ´│generator │ ´U ╰ー╯ A ´ °´Y What type of extension do you want to create New Extension JavaScript What s the name of your extension react setstate What s the identifier of your extension react setstate What s the description of your extension set state in react Enable JavaScript type checking in jsconfig json No Initialize a git repository Yes Which package manager to use npmOnce we have answered all the prompts in the yo interactive shell it will generate a new project for us based on our inputs We can open this project in Visual Studio Code by navigating to its directory in the terminal and running the following command code Anatomy of the project Our project structure should look something like this you might have some additional files if you selected TypeScript We will go over all the files and explain why they are present ├ー vscode launch a new window for testing │ ├ー launch json │ └ー tasks json ├ー node modules node modules├ー test tests│ ├ー suite│ ├ー ├ー extension test js │ └ー runTest js ├ー eslintrc json ESLint config├ー gitignore ignore node modules and other specified files├ー vscodeignore ignore files we don t have published├ー CHANGELOG md keep track of changes├ー extension js source code├ー jsconfig json JS config ├ー package lock json generated by npm ├ー package json manifest ├ー README md info about extension├ー vsc extension quickstart md quick start guide The launch json and the tasks json are used to launch a new window of VS code for testing the extension node modules node modules for our project The test folder will contain all the tests for our extension eslintrc json will contain ESLint configuration for this project gitignore will contain a list of names of files and or folders that we don t to be included when you push our extension to version control platform like Github vscodeignore will contain a list of names of files and or folders that should be published when we finally publish our extension CHANGELOG md will be used to keep track of changes we make to our extension extension js this is where we will be writing the code logic behind our extension entry point jsconfig json will contain our Javascript configurationpackage json is the manifest file of any Node js project and contains the metadata of the project README md will contain the info about our extension vsc extension quickstart md is the default quick start guide that comes with our project Entry PointOpen extension js file which contains boilerplate code and comments Let s briefly understand the code before we proceed to clean it up const vscode require vscode Imports the vscode extensibility API module function activate context console log Congratulations your extension react setstate is now active let disposable vscode commands registerCommand react setstate helloWorld function vscode window showInformationMessage Hello World from react setstate context subscriptions push disposable The above is the activate function which get call when our extenison is activated let disposable vscode commands registerCommand react setstate helloWorld function vscode window showInformationMessage Hello World from react setstate The react setstate helloWorld is a unique identifier for a command that performs a specific action when triggered For instance when the react setstate helloWorld command is invoked it shows a message displaying Hello World from react setstate However command IDs can be lengthy and typing them out every time can be tedious Therefore we can assign simpler names to these command IDs for ease of use package jsonIn the package json file under the contributes field there is an array called commands which includes the default command ID By default the title of the react setstate helloWorld command has been set to something memorable Hello World Any new command IDs we register can be added to this array To run our extension we can press Ctrl F which will open a new VS Code window with the name Extension Development Host To launch our extension we can press Ctrl Shift P to open the command palette type in the name we gave the extension in this case Hello World and press Enter This will launch our extensionWe can stop the Extension Development Host by pressing the red square extension jsThis tutorial has become quite lengthy so to save time I ll paste the code and then explain what each part does const vscode require vscode param vscode ExtensionContext context function activate context let disposable vscode commands registerCommand react setstate setState async function const inputText await vscode window showInputBox placeHolder Eg show modal prompt Enter the name of your state if inputText vscode window showErrorMessage You need to type in something for this to work return if inputText null return const words inputText split const stateList const actionList for let i i lt words length i if i stateList push capitalize words i else stateList push words i actionList push capitalize words i const transformedState stateList join const transformedAction set actionList join const text const transformedState transformedAction useState null const editor vscode window activeTextEditor if editor const selection editor selection editor edit editBuilder gt editBuilder replace selection text context subscriptions push disposable This method is called when your extension is deactivatedfunction deactivate function capitalize word return word charAt toUpperCase word slice module exports activate deactivate The activate function registers the react setstate setState command id which we defined earlier in the extension js file Next we need to update the package json file to reflect this change We should rename our command to react setstate setState and give it a suitable title For now we will call it React setState but you can choose any name you prefer commands command react setstate setState title React setState Don t forget to update the activationEvents array as well activationEvents onCommand react setstate setState After the extension is activated the user will be prompted to enter the name of the state they want to create which will be stored in the inputText variable const inputText await vscode window showInputBox placeHolder Eg show modal prompt Enter the name of your state If the user didn t type anything in and left the prompt empty we will close the prompt and return a message indicating that no state was created if inputText vscode window showErrorMessage You need to type in something for this to work return if inputText null return The reason for splitting the text based on space is that a state name could potentially have multiple words such as show modal and we want to be able to capitalize each word individually const words inputText split The capitalize function is a helper function that takes a string and capitalizes the first letter of each word in the string We will use this function to ensure that the state name entered by the user is properly capitalized function capitalize word return word charAt toUpperCase word slice The conventional way of creating states in React involves defining a variable using the useState hook which typically looks like this const showModal setShowModal useState false On the left hand side we have the state itself and on the right hand side we have the action That is why we have two arrays stateList will store the capitalized versions of all the words the user typed except for the first word for let i i lt words length i if i stateList push capitalize words i else stateList push words i actionList push capitalize words i const stateList show Modal const actionList Show Modal After the code above the stateList array should contain all the capitalized words from the user input except for the first one The actionList array should contain the capitalized version of the first word followed by the word Modal if i stateList push capitalize words i We can concatenate the elements in our stateList array to form a string Since stateList already has all the capitalized words we need we can join them together directly without any further processing const transformedState stateList join showModalHere we are joining the elements of actionList array to form a string with the prefix set const transformedAction set actionList join Now we should have two separate strings const transformedState showModal const transformedAction setShowModal All we have to do now it bring them together const text const transformedState transformedAction useState null This is insert transformedState and transformedAction string into the string above const text const showModal setShowModal useState null Our string should now look like the above Now that we have our state we need a way to paste that text in our editor VS Code const editor vscode window activeTextEditor To get the current active text editor we use vscode window activeTextEditor Then we can use selection active to get the position of the cursor in the text editor const selection editor selection Finally we use the line below to replace the text on that line with our text if editor const selection editor selection editor edit editBuilder gt editBuilder replace selection text To test if everything is working as expected you can run the extension by pressing Ctrl F Publishing our extensionWith everything working as expected it s time to publish our extension and make it available for others to use To do this we ll need a personal access token from Azure DevOps and a publisher account Once you ve set up your organization in Azure DevOps you can follow these steps to generate your personal access token Personal Access TokenClick on the user icon next to the profile image Click on Personal access token This should take you to a page to generate new token Click on New Token to open a modal On the modal provide the necessary info for your token Click on Show more scopes and look for Marketplace and check the option for Manage Click create to create your token Make sure to copy the token as we will need it later PublisherWe need to create a publisher to publish our extension under Follow these steps Go to the publisher registration page Click on Create Publisher to create a new publisher Remember to copy and paste the unique publisher name somewhere safe as we will need it later for logging in With the publisher name copied we need to update create the publisher field in the package json file with our publisher name publisher your publisher name Installing vscenpm install g vscode vscevsce is a CLI tool for managing VS Code extensions Use it to login with your publisher name and personal access token vsce login lt unique publisher name gt vsce publishIf you encounter an error message instructing you to update the README md file you can either use the following template or create your own README md text react setstate READMEreact setstate is an extension that allows react developers to create state quickly Once the extension has been published it will undergo verification on the VS Code Marketplace which may take several minutes You can check the status of the verification process here Congratulations Your extension has been successfully created and published on the VS Code marketplace for anyone to download and use Checkout source code here Download the extension here 2023-02-24 01:44:24
海外TECH DEV Community How to integrate Stripe into your React application https://dev.to/haszankauna/how-to-integrate-stripe-into-your-react-application-2fn9 How to integrate Stripe into your React application IntroductionStripe is a popular payment gateway that allows you to securely accept customer online payments In this tutorial we ll use the stripe react stripe js package to integrate Stripe into a React application This package contains a set of React components that make it simple to integrate Stripe into your application PrerequisitesBefore we begin you must have the following items ready You must have Node js installed on your machine A Stripe account Getting startedLet s start by creating a new React application Launching your terminal and entering the following commands npx create react app stripe integrationcd stripe integrationThe stripe react stripe js and stripe stripe js packages will be installed next npm install stripe react stripe js stripe stripe js Setting up StripeYou must provide your Stripe API keys in order to use Stripe in your application Your API keys can be found in the Developers section of your Stripe Dashboard To store our API keys we ll create a env file in the root of our project Include the following in your env file REACT APP STRIPE PUBLISHABLE KEY lt your publishable key gt REACT APP STRIPE SECRET KEY lt your secret key gt lt your publishable key gt and lt your secret key gt should be replaced with your actual API keys Integrating StripeNow that we ve set up Stripe let s build a simple form for users to enter their payment information To begin we ll add a new component called PaymentForm This component will display a form where users can enter their payment information import React from react const PaymentForm gt return lt form gt lt label gt Card number lt input type text gt lt label gt lt label gt Expiration date lt input type text gt lt label gt lt label gt CVC lt input type text gt lt label gt lt button type submit gt Pay lt button gt lt form gt export default PaymentForm Next we ll use the stripe react stripe js package s useStripe and useElements hooks to create a handleSubmit function that will handle the form submission and create a payment intent import React from react import useStripe useElements from stripe react stripe js const PaymentForm gt const stripe useStripe const elements useElements const handleSubmit async event gt event preventDefault const error paymentMethod await stripe createPaymentMethod type card card elements getElement card if error console log error else console log paymentMethod return lt form onSubmit handleSubmit gt lt label gt Card number lt input type text id cardNumber gt lt label gt lt label gt Expiration date lt input type text id cardExpiry gt lt label gt lt label gt CVC lt input type text id cardCvc gt lt label gt lt button type submit gt Pay lt button gt lt form gt export default PaymentForm In the handleSubmit function we first use event preventDefault to prevent the default form submission behavior Then with the user s card information we use the stripe createPaymentMethod method to create a payment method elements getElement card is used to pass in the card element If there is an error when creating the payment method the error is logged to the console Otherwise the paymentMethod object is logged to the console The PaymentForm component will then be updated to use Stripe s CardElement component to render the card input fields import React from react import useStripe useElements CardElement from stripe react stripe js const PaymentForm gt const stripe useStripe const elements useElements const handleSubmit async event gt event preventDefault const error paymentMethod await stripe createPaymentMethod type card card elements getElement CardElement if error console log error else console log paymentMethod return lt form onSubmit handleSubmit gt lt label gt Card details lt CardElement options gt lt label gt lt button type submit gt Pay lt button gt lt form gt export default PaymentForm In the updated PaymentForm component we import the CardElement component from stripe react stripe js We then render the CardElement component in place of the individual card input fields The CardElement component provides a pre built UI for entering credit card information and it handles all formatting and validation automatically To prevent customization we pass an empty options object to the CardElement component Finally we update the handleSubmit function to use elements Instead of elements getElement card use elements getElement CardElement Testing Stripe IntegrationTo put our Stripe integration to the test we ll need to create a payment intent on the server To generate the payment intent you can use any server side technology To create the payment intent in this tutorial we ll use Node js and the stripe package First we will install the stripe package npm install stripeNext in the root of our project we ll create a new file called server js with the following contents require dotenv config const stripe require stripe process env REACT APP STRIPE SECRET KEY const express require express const app express app use express json app post create payment intent async req res gt const amount req body const paymentIntent await stripe paymentIntents create amount currency usd res json client secret paymentIntent client secret app listen gt console log Server listening on port In the server js file we first use dotenv to load our Stripe secret key from the env file The stripe packageis then installed and an Express server is set up The create payment intent route generates a new payment intent for the specified amount and returns the client secret To put our Stripe integration to the test we ll need to start the server and update our handleSubmit function to send a POST request to the server in order to create the payment intent Updating PaymentForm ComponentWe ll modify the PaymentForm component to send a POST request to the server in order to create a payment intent and pass the client secret to Stripe in order to complete the payment import React useState from react import useStripe useElements CardElement from stripe react stripe js const PaymentForm gt const stripe useStripe const elements useElements const clientSecret setClientSecret useState null const handleSubmit async event gt event preventDefault const error paymentMethod await stripe createPaymentMethod type card card elements getElement CardElement if error console log error return const response await fetch create payment intent method POST headers Content Type application json body JSON stringify amount Replace with actual amount const client secret await response json const error paymentError await stripe confirmCardPayment client secret payment method paymentMethod id if paymentError console log paymentError else console log Payment succeeded return lt form onSubmit handleSubmit gt lt label gt Card details lt CardElement options gt lt label gt lt button type submit gt Pay lt button gt lt form gt export default PaymentForm We use the useState hook from React in the updated PaymentForm component to store the client secret returned by the server To create a payment intent we update the handleSubmit function to send a POST request to the server In the request body we include the amount as a JSON payload Substitute for the actual amount you want to charge We then extract the client secret from the response and pass it to stripe confirmCardPayment along with the payment method ID returned by stripe createPaymentMethod If there is a problem with the payment we record it in the console Otherwise we will log Payment successful to the console Creating a PaymentIntent on the ServerWe need to create an endpoint on the server to handle the request and create a payment intent now that we ve updated the PaymentForm component to make a request to our server To create the payment intent on the server we ll use the stripe node library It can be installed by running npm install stripe nodeIn the root of your project directory create a new file called server js and add the following code const express require express const app express const stripe require stripe sk test Replace with your actual secret keyapp use express json app post create payment intent async req res gt const amount req body const paymentIntent await stripe paymentIntents create amount currency usd Replace with your actual currency res json client secret paymentIntent client secret app listen gt console log Server running on port We import the express module and create a new Express app instance in the server js file We also include the stripe library which we initialize with our secret key sk test should be replaced with your actual secret key With express json we add middleware to parse JSON requests At create payment intent we create a new endpoint that expects an amount parameter in the request body We then create a payment intent with the stripe paymentIntents create method passing in the amount and currency as options In the response we return the client secret of the payment intent Finally we use app listen to start the server listening on port Testing the IntegrationTo test the integration start the server by running node server jsStart the React app in a separate terminal window by running npm startNavigate to http localhost in your browser and fill out the payment form with your test card information Card number Expiration date any date in the futureCVC any digitsTo complete the payment form click the Pay button If everything is in order you should see Payment succeeded in the browser console and a new payment in the Stripe Dashboard ConclusionWe learned how to integrate Stripe into a React application using the stripe react stripe js library in this tutorial To initialize the Stripe API and render a PaymentForm component with a CardElement we created a StripeProvider component The PaymentForm component was then updated to make a POST request to our server to create a payment intent and pass the client secret to Stripe to complete the payment Finally we used the stripe node library to create a new endpoint on the server to handle the request and create a payment intent You should be able to integrate Stripe into your own React applications and begin accepting payments with this knowledge 2023-02-24 01:43:15
医療系 医療介護 CBnews 三菱電機、働き方改革支援に搬送ロボットで挑戦-薬剤、検体…病院内の搬送業務負荷軽減へ https://www.cbnews.jp/news/entry/20230224100633 ldquo 2023-02-24 10:06:00
金融 ニッセイ基礎研究所 消費者物価(全国23年1月)-コアCPI上昇率は4.2%となったが、2月には3%程度まで低下する見込み https://www.nli-research.co.jp/topics_detail1/id=73997?site=nli 消費者物価全国年月ーコアCPI上昇率はとなったが、月には程度まで低下する見込み総務省が月日に公表した消費者物価指数によると、年月の消費者物価全国、生鮮食品を除く総合、以下コアCPIは前年比月同となり、上昇率は前月からポイント拡大した。 2023-02-24 10:06:42
海外ニュース Japan Times latest articles North Korea fires strategic cruise missiles as U.S.-South Korea hold nuclear attack drill https://www.japantimes.co.jp/news/2023/02/24/asia-pacific/north-korea-strategic-cruise-missiles/ North Korea fires strategic cruise missiles as U S South Korea hold nuclear attack drillNorth Korea says it has conducted a rare strategic cruise missile drill as Washington and Seoul announces a tabletop military exercise focusing on nuclear weapons 2023-02-24 10:39:47
ニュース BBC News - Home Is it cheaper to study in a coffee shop or at home? https://www.bbc.co.uk/news/business-64708230?at_medium=RSS&at_campaign=KARANGA prices 2023-02-24 01:08:24
ビジネス 東洋経済オンライン ウイグル人監視カメラに「日本企業の部品」の衝撃 使用が判明したのは7社、人権侵害加担のおそれも | 災害・事件・裁判 | 東洋経済オンライン https://toyokeizai.net/articles/-/654596?utm_source=rss&utm_medium=http&utm_campaign=link_back 人権ngo 2023-02-24 10:30:00
ビジネス 東洋経済オンライン 「5類移行」で暗転する、病院経営の収益構造 コロナ体制からの転換で、経営難が続出!? | 最新の週刊東洋経済 | 東洋経済オンライン https://toyokeizai.net/articles/-/653158?utm_source=rss&utm_medium=http&utm_campaign=link_back 東洋経済オンライン 2023-02-24 10:20:00
マーケティング MarkeZine コロナ禍での暮らしの自由度は63.4点、昨年同月と比べ6.0pt増加【博報堂生活総合研究所調査】 http://markezine.jp/article/detail/41451 博報堂生活総合研究所 2023-02-24 10:30:00
マーケティング AdverTimes 懐かしのあの企画も『販促会議』通巻300号企画 時代をつくったキャンペーン https://www.advertimes.com/20230224/article412102/ 宣伝会議 2023-02-24 01:46:03

コメント

このブログの人気の投稿

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

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

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