投稿時間:2023-06-11 20:10:38 RSSフィード2023-06-11 20:00 分まとめ(11件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita ChatGPTにLlamaindexを使って独自情報を回答させる https://qiita.com/atsuto/items/7807dd69fe649e6e8848 pipinstallllamaindexp 2023-06-11 19:40:44
python Pythonタグが付けられた新着投稿 - Qiita マイクラのチャットからコマンドみたいな感じでAPI呼んでchatGPTみたいなことをできるようにした話 https://qiita.com/panderson/items/9a9f52bdc3e688dbf88f chatgpt 2023-06-11 19:33:26
python Pythonタグが付けられた新着投稿 - Qiita FlaskでAIとおしゃべりするインターフェースを作る https://qiita.com/MokonaSato/items/09ba9e5e21698cd21a52 flask 2023-06-11 19:12:45
js JavaScriptタグが付けられた新着投稿 - Qiita FlaskでAIとおしゃべりするインターフェースを作る https://qiita.com/MokonaSato/items/09ba9e5e21698cd21a52 flask 2023-06-11 19:12:45
AWS AWSタグが付けられた新着投稿 - Qiita 閉鎖環境にてCloudFormationを実行するEC2インスタンスを構築しよう https://qiita.com/miyabiz/items/ad3b086fd9591085f29c cloudformation 2023-06-11 19:12:30
海外TECH MakeUseOf Top 4 Unbiased Independent World News Sources https://www.makeuseof.com/top-unbiased-news-sources/ censorship 2023-06-11 10:15:19
海外TECH DEV Community How to test your app using Docker Containers and Postman https://dev.to/francescoxx/how-to-test-your-app-using-docker-containers-and-postman-3j04 How to test your app using Docker Containers and PostmanLet s test our API using Docker Containers and Postman We will test a simple CRUD application created using Node js Express and Postgres In this example we will use Postman to test our API Newman to run our Postman collection Play with Docker to deploy our application Docker to run our application If you prefer a video version Step by step procedureIntroClone the repository and modify the docker compose yml fileRun and test the application locallyDeploy our application Create and export the Postman collectiontest the app using containersConclusion IntroWe will use Docker and Postman Docker to run our application Postman to test it ‍PostmanPostman is a popular collaboration platform and API Application Programming Interface client that allows developers to design test and document APIs It provides a user friendly interface that enables users to request an API and inspect the response and create and manage automated tests for APIs Additionally Postman allows teams to share collections of requests and collaborate on API development and testing Postman is very cool but we will make it even more incredible in this article by using it with Docker DockerDocker is a containerization platform that allows developers to package applications and their dependencies into self contained units called containers Containers are isolated from each other and the underlying host system making them portable and easy to deploy across different environments Docker provides a simple and consistent way to build distribute and run applications which helps to streamline the development process and reduce the time and effort required to set up and manage complex application architectures In this article we will use docker both to run our application and to test the application using Postman Clone the repositoryWe will use a JavaScript project I created in another video It is a simple CRUD application using Node js Express and Postgres git clone now step into the repositorycd crud node liveAnd open this folder with your favorite IDE I am using VSCode code We will not go into the details of this application If you want to know how this was built check this link Modify the docker compose yml file To test this application you can build your own image or use the image I created and pushed to Dockerhub To use mine remove the build instruction on line as we will use an existing image from DockerhubThis is the final docker compose yml file note that there is no build instruction version services node app container name node app image francescoxx node live app ports environment PG DB node live db PG USER francesco PG PASSWORD PG HOST node db depends on node db node db container name node db image postgres ports environment POSTGRES DB node live db POSTGRES USER francesco POSTGRES PASSWORD volumes node db data var lib postgresql datavolumes node db data Run and Test the application locally Run the application locallyLet s run both the Docker services containers locally Run the Postgres container docker compose up d node dbRun the node app docker compose up d node appAnd check if both of them are up and running docker ps aThe output should be similar to this Test the application locallyIn this example we will test just two endpoints Using Postman we can make a GET request to http localhost And we can make a GET request to http localhost usersWe don t have any users so we get an empty array Now we are ready to deploy this service and test it using containers Deploy the applicationYou can use any Container service such as AWS Azure or Google Cloud platform The important part is to have a final public IP address to test it using Postman I will use Play with Docker which is free and easy to use Play with DockerVisit this link and click StartThis will create a hour session where you can create and test your containers Click on Add new instanceAnd on the right you should see a terminal and the instance This instance has a public address Deploy the applicationDeploying the application is very easy We need to copy the docker compose yml file and paste it on the playground You can do it using ssh or you can drag and drop the file on the playground Check if the docker compose file is there by typinglsNow let s run the same two commands we ran before locally docker compose up d node dbdocker compose up d node appAnd let s check itdocker ps aNote that now there are ports open and If you click on the next to OPEN PORT you should see the application running on a public IP If you use any a cloud provider check the public IP let s get an example ️Postman CollectionOpen Postman and if you don t have it already create a New public space named whatever you want In my case I created a workspace named public francescoNow create a new collection by clicking Create CollectionRename it as postman dockerAdd a new GET request at the public IP address of the application and SAVE it top right corner Duplicate it right click on the first request and name the new one Get All UsersThis request will be a GET request to lt public server ip gt users️Remember to SAVE the requestsYou can test this Collection by running it directly in Postman We are now ready to export this collection and test it using containers Test the app using containersWe will use Newman a command line collection runner for Postman It allows you to run and test a Postman Collection directly from the command line It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems Export the Postman CollectionNow export this collection as a JSON file You can do it by clicking on the three dots on the right of the collection name and then clicking on ExportSave it as node collection no extension Now it s time to run this collection run the Postman Collection using Newman️For Windows users use the Command Prompt or Powershellnavigate to the folder where the file node collection is locatedAnd run this command docker run v lt postman collection path gt etc newman t postman newman run node collectionReplace lt postman collection path gt with the path of the folder where the file node collection is located In my case it s c workspace postman collection testand you will get a list of the requests ConclusionWe made it We tested the application using the following Postman collectionNewmanDockerVideo version 2023-06-11 10:28:45
海外TECH DEV Community vim editor shortcuts https://dev.to/irishgeoff11/vim-editor-shortcuts-57p8 vim editor shortcutsVim is a highly customizable and powerful text editor that offers a wide range of shortcuts to help you navigate and edit text more efficiently Here are some of the most commonly used and highly recommended Vim shortcuts Navigation h j k l Move the cursor left down up and right respectively gg Go to the beginning of the file G Go to the end of the file Move the cursor to the beginning of the current line Move the cursor to the end of the current line Ctrl f Move forward one screen Ctrl b Move backward one screen Editing i Enter insert mode at the current cursor position a Enter insert mode after the current cursor position o Open a new line below the current line and enter insert mode O Open a new line above the current line and enter insert mode dd Delete the current line yy Yank copy the current line p Paste the most recently yanked or deleted text u Undo the last change Ctrl r Redo the last change Search and Replace Search forward for a pattern Search backward for a pattern n Move to the next occurrence of the search pattern N Move to the previous occurrence of the search pattern s old new g Replace all occurrences of old with new in the entire file Saving and Quitting w Save the current file q Quit Vim wq Save the file and quit Vim q Quit Vim without saving changes Visual Mode v Start visual mode to select text character by character V Start visual mode to select text line by line Ctrl v Start visual block mode to select text in a block These shortcuts are just a starting point and Vim offers many more features and commands You can explore further by referring to Vim s documentation experimenting with different plugins and customizing your own shortcuts based on your workflow and preferences 2023-06-11 10:17:23
海外TECH DEV Community Download HTML as a PDF in React https://dev.to/mohammadfaisal/download-html-as-a-pdf-in-react-4g7a Download HTML as a PDF in ReactTo read more articles like this visit my blogDownloading PDF is a common use case in modern front end applications But building PDF on the client side can be painful In React we have some awesome libraries like react pdf renderer to help us Problems With the Traditional Librariesreact pdf renderer is an awesome library and provides lots of customization but it comes with its own cost For exampleYou have to design a separate component for your PDF documentSometimes the rendering fails if you don t handle edge cases properlyYou have to style separately and according to their specification All of these are okay if you want to build a data heavy and customized PDF But what if you want something simpler What if you just want to print the component that is being rendered as it is Let s see how we can download any component as a PDF using a neat trick and some JavaScript knowledge OverviewThe process that we are going to follow is converting the HTML element into an image and then putting the image into another powerful PDF library HTML document gt Image gt PDFFor this we need two libraries htmlcanvas gt will convert our HTML document to imagejspdf gt will insert the generated image into a PDF fileThe fullomplete code is at the bottom If you are interested only in that go there directly Otherwise bear with me It won t take long Step Install DependenciesFirst install the required dependencies yarn add jspdf htmlcanvas STEP Add The Downloader FunctionNow Either create a separate component for your GenericPdfdownloader or put the following code inside the component you want to download const downloadPdfDocument rootElementId gt const input document getElementById rootElementId htmlcanvas input then canvas gt const imgData canvas toDataURL image png const pdf new jsPDF pdf addImage imgData JPEG pdf save download pdf What the code is doingInput gt This function takes rootElementId as input This will be the id of the downloadable component We can define the id of any element like the followingreturn lt div id divToDownload gt YOUR OTHER COMPONENT CODE GOES HERE lt div gt So if we want to download the component inside the div with the id divToDownload then we have to pass divToDownload into the function Getting the HTML ElementIn the next step we are getting the HTML element with the passed Id const input document getElementById rootElementId Converting HTML to ImageNext we pass the element into the htmlcanvas which gives us back an imagehtmlcanvas input then canvas gt const imgData canvas toDataURL image png Putting The Image into PDFNext we create a new PDF document and put the image inside that const pdf new jsPDF pdf addImage imgData JPEG pdf save download pdf Here the two zeroes are padding for the generated PDF document You can change them as you want Also you can modify the downloadable file name Complete codeHere is the full code for a custom PDF downloader which takes two arguments The root elements id as rootElementIdDownload filename downloadFileNameimport React from react import htmlcanvas from htmlcanvas import jsPDF from jspdf const GenericPdfDownloader rootElementId downloadFileName gt const downloadPdfDocument gt const input document getElementById rootElementId htmlcanvas input then canvas gt const imgData canvas toDataURL image png const pdf new jsPDF pdf addImage imgData JPEG pdf save downloadFileName pdf return lt button onClick downloadPdfDocument gt Download Pdf lt button gt export default GenericPdfDownloader Now you can just place this component anywhere in your project like the following import React from react import GenericPdfDownloader from views GenericPdfDownloader function App return lt gt lt GenericPdfDownloader downloadFileName CustomPdf rootElementId testId gt lt div id testId gt This is A Downloadable Component lt div gt lt gt export default App ConclusionThere you go Now you have your custom PDF downloader that can be used anywhere in your project Thank you for reading Have something to say Get in touch with me via LinkedIn or my Personal Website 2023-06-11 10:12:23
海外ニュース Japan Times latest articles BOJ is said to see little need to tweak yield controls for now https://www.japantimes.co.jp/news/2023/06/11/business/japanese-economy-2/ BOJ is said to see little need to tweak yield controls for nowThe officials say inflation is running stronger than expected a factor that raises the chance of the BOJ upgrading its inflation forecast in a quarterly 2023-06-11 19:49:03
ニュース BBC News - Home SNP could make life difficult for Labour - Humza Yousaf https://www.bbc.co.uk/news/uk-scotland-scotland-politics-65866154?at_medium=RSS&at_campaign=KARANGA powers 2023-06-11 10:51:00

コメント

このブログの人気の投稿

投稿時間: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件)