js |
JavaScriptタグが付けられた新着投稿 - Qiita |
Firestoreでリアルタイム更新+無限スクロールの実装方法、2つのパターン:その1 |
https://qiita.com/kontikun/items/f4326928cbe1c8134408
|
firestore |
2023-01-11 22:53:02 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
TypeScriptの{readonly a: number}型で、aプロパティが変更不可になると思っている人はいますか? |
https://qiita.com/aiya000/items/65e31b02ca543b7c15df
|
haskell |
2023-01-11 22:51:56 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
Git管理しているCF2の関数をJestでテストする |
https://qiita.com/yuya_yuzen/items/cbbfdc4f5c9e2a9d310d
|
moduleexports |
2023-01-11 22:34:49 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
【Ruby】reduceメソッド(injectメソッド)を深める |
https://qiita.com/yamaBBB/items/1ece13e6ec9218552889
|
inject |
2023-01-11 22:53:31 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
テーブルのレコード内でNULLではないレコードの列名のみ取得する |
https://qiita.com/masahiro-yamaguchi/items/7dd92dd528a21fb5a8e2
|
azure |
2023-01-11 22:14:58 |
海外TECH |
DEV Community |
🔦 Community Spotlight - Building Thumbuptech, a Job and Content Network🔦 |
https://dev.to/appwrite/community-spotlight-building-thumbuptech-a-job-and-content-network-4560
|
Community Spotlight Building Thumbuptech a Job and Content NetworkHighlighting projects from the Appwrite community IntroductionWith Appwrite s developer community growing significantly we want to take the time to appreciate and showcase some amazing applications built by our community Maybe you ll be inspired by these projects to build something amazing with Appwrite too This month we d like to give the spotlight to Sebastein who built a successful app called Thumbuptech Let s get started by interviewing them to learn more about their project and journey Tell us more about who you areHi I am Sebastien Pastor the founder of Thumbup tech I ve been working in IT for some time now Originally I am more of a System guy I worked first as system administrator on Windows systems then fell in Love with Linux and in all things open source I then moved to positions where I designed and implemented architectures in private and public clouds but not without starting the next project I have in mind every chance I got because the entrepreneurial spirit is deeply rooted in me Socials Thumup techLinkedInTwitter What is the name of the project you built My project is called thumbup tech Why did you decide to build this What inspired you Thumbup tech is a tech job amp tech content network It first started as an add on of another project I had named afreelancersworld com which was an ecosystem for freelancers in Tech I wanted to add a way to find gigs but in a more innovative way So I designed Thumbup tech to do just that The main objective is to save time for everyone candidates and recruiters alike plus in a fun way The way it works is super simple Candidates receive offers they will most likely be interested in by emailIf they are interested all they need to do is it Doing so will make their profile available to recruiters who can back to book a video call directly in the candidate s calendar At the end of the day candidates avoid the dubious practices of some recruiters by being the one who contacts them and recruiters are delighted because they can secure in one click profiles that they know are interested in their offers and available Once the job board part was done I quickly added the Content network part aka Community Because to me jobs amp content go together everything goes very fast in Tech and we need tokeep an eye on both aspects so as not to miss any good opportunities Thumbup tech is now the place to find it all quality job and quality content I did not want to create yet another social network in Community the focus is the content Articles need to be longer than most simple posts on other networksWe can start a discussion on every article and even specify our mood loved it I have a question etc Every article are tagged to make sure you find the subjects you are interested inMicro communities are available as well They are called Circles and allow people who share similar interests to communicate easily What is the Thumbuptech Thumbup tech is the place to go to keep an eye on the tech job market and get recruited in a zen way It s also the network to get your tech dose and exchange with passionate professionals on tech topics What technologies did you use to create it and how did you use each technology The front end is written in Sveltekit The backend is obviously Appwrite The front end is using Appwrite SDK for Node js which makes it super easy to communicate with Appwrite In the backend we are using functions a lot to manage our logic for the job part but also for the content part sending emails reaction to thumb up thumb downs etc are some of the logic handled by functions Who is your target audience and how will it help them to learn more about your project Our target audience is Everyone in Tech developers product owners project managers system administrators architects employees and freelancers Everyone in tech who is looking for curated tech content and tech jobs and obviously any company wishing to talk about their tech to tech enthusiasts and recruit among them What issues did you run into while building this project and how did you solve them Main problem was the fact that Apprwrite was in an early stage when we started using it We have had many break changes bugs which cost us some time But thanks to the amazing support of the community we always managed to overcome those issues quickly The logic was different as well compared to traditional databases and backend it led us sometimes to design things differently to make it work with Appwrite How did Appwrite help your project I chose Appwrite because it really is a backend with battery included from logic to databases and authentication to storage All you need to develop a web application is available When it is not you can most of the time add it using functions That was a huge time saver I specifically remember selecting Appwrite vs Supabase for instance because we had a fine grained data control system which usually takes a lot of time and effort when developing a backend What are a couple of things you wish you knew before starting the project When we started the project Appwrite had the ability to use sub document that would make relations between collections possible It has been removed quickly and that s when we realized a simple SQL JOIN was not that easy to implement with Appwrite We managed to overcome this limitation by changing our way of thinking and by using functions to aggregate data in different collections We hope the Query system will improve to allow the selection of different collections Where can others find your app Link to the website Please share screenshots of your projectScreen displaying a job offer With Thumbs up and down Pictures of the homepage |
2023-01-11 13:44:28 |
海外TECH |
DEV Community |
How to use Node JS with your Project? |
https://dev.to/darkxenium/how-to-use-node-js-with-your-project-5gfe
|
How to use Node JS with your Project To use Node js in a project you will first need to install Node js on your computer You can download the installer for your operating system from the official Node js website Once Node js is installed you can use it to run JavaScript code outside of a web browser Here is an example of a simple Node js script that logs Hello World to the console console log Hello World You can run this script by saving it to a file with a js extension such as hello js and then running it from the command line with the node command node hello jsThis will output Hello World to the console To use Node js in a larger project you will typically organize your code into modules and use require and exports to include and share code between files For example you can create a file add js that exports a function add jsconst add a b gt a b module exports add And then you can include that module in another file and use the exported function app jsconst add require add console log add You can run it via command line as wellnode app jsThis is just a very very very basic example of how to use Node js in a project but it should give you an idea of how to get started As your project grows in complexity you may want to use a framework such as Express js to help organize your code or a package manager such as npm or yarn to manage dependencies Best of luck |
2023-01-11 13:38:45 |
海外TECH |
DEV Community |
Get the count of affected rows with ease: The power of the RETURNING clause |
https://dev.to/asifroyal/get-the-count-of-affected-rows-with-ease-the-power-of-the-returning-clause-3g2j
|
Get the count of affected rows with ease The power of the RETURNING clauseWhen working with databases it is frequently vital to know how many rows have been changed by a query and this is especially true when conducting operations such as updates or removals Through its RETURNING clause Postgres offers a method that is both powerful and versatile for doing this task Postgres s RETURNING clause makes it possible to retrieve both the data of the impacted rows and the total number of rows that were modified or deleted The RETURNING clause is used to get certain columns from a database It is appended at the end of a query For example to update all rows in a table where a certain condition is true and return the number of affected rows you would use the following query UPDATE mytable SET mycolumn new value WHERE mycondition true RETURNING This query would update the data of all rows that fit the condition mycondition true and it would return the data of the rows that were changed In the same way that you would use the following query if you wanted to use the RETURNING clause with the DELETE statement you also have the option to do so DELETE FROM mytable WHERE mycondition true RETURNING It s important to remember that the RETURNING clause only works with update and delete statements not with select statements It s also only available in Postgres not in other RDBMS In conclusion the RETURNING clause in Postgres is a powerful tool that makes it easy to find out how many rows are affected by update and delete queries it can make it much easier to write robust and reliable code that works with databases |
2023-01-11 13:19:29 |
海外TECH |
DEV Community |
Creating a website aggregator with ChatGPT, React, and Node.js 🚀 |
https://dev.to/novu/creating-a-website-aggregator-with-chatgpt-react-and-nodejs-4dij
|
Creating a website aggregator with ChatGPT React and Node js A website aggregator is a website that collects data from other websites across the internet and puts the information in one place where visitors can access it There are many versions of website aggregators some are search engines such as Google and Duck Duck go and some can have more of a Product Hunt structure where you can see a picture and a short text You will usually scrape the website take their metatags and h tags scan their sitemap xml and use some pattern to sort the information Today I am going to use a different solution I will take the entire website content send it to ChatGPT and ask them to give me the information I need It s kinda crazy to see ChatGPT parses the website contentSo lettttsss do it In this article you ll learn how to build a website aggregator which scrapes content from a website and determines the website s title and description using ChatGPT What is ChatGPT ChatGPT is an AI language model trained by OpenAI to generate text and interact with users in a human like conversational manner It is worth mentioning that ChatGPT is free and open to public use Users can submit requests and get information or answers to questions from a wide range of topics such as history science mathematics and current events in just a few seconds ChatGPT performs other tasks such as proofreading paraphrasing and translation It can also help with writing debugging and explaining code snippets Its wide range of capabilities is the reason why ChatGPT has been trending ChatGPT is not available as an API yet In order to use we will have to scrape our way in Novu the first open source notification infrastructureJust a quick background about us Novu is the first open source notification infrastructure We basically help to manage all the product notifications It can be In App the bell icon like you have in Facebook Websockets Emails SMSs and so on I would be super happy if you could give us a star And let me also know in the comments ️ Limitation with ChatGPTAs previously mentioned ChatGPT is not accessible through a public API Instead we can use web scraping techniques to access it This involves automating the process of logging in to the OpenAI website solving the captcha you can use captcha for this and sending an API request with the OpenAI cookies Fortunately there is a public library that can handle these tasks for us Keep in mind that this is not a formal API so you may encounter limitations if you attempt to make a large number of requests Additionally it is not suitable for real time requests If you want to use it consider implementing a queue system for background processing Project Set upHere I ll guide you through creating the project environment for the web application We ll use React js for the front end and Node js for the backend server Create the project folder for the web application by running the code below mkdir website aggregatorcd website aggregatormkdir client server Setting up the Node js serverNavigate into the server folder and create a package json file cd server amp npm init yInstall Express Nodemon and the CORS library npm install express cors nodemonExpressJS is a fast minimalist framework that provides several features for building web applications in Node js CORS is a Node js package that allows communication between different domains and Nodemon is a Node js tool that automatically restarts the server after detecting file changes Create an index js file the entry point to the web server touch index jsSet up a Node js server using ExpressJS The code snippet below returns a JSON object when you visit the http localhost api in your browser index jsconst express require express const cors require cors const app express const PORT app use express urlencoded extended true app use express json app use cors app get api req res gt res json message Hello world app listen PORT gt console log Server listening on PORT Install the unofficial ChatGPT API library and Puppeteer The ChatGPT API uses Puppeteer as an optional peer dependency to automate bypassing the Cloudflare protections npm install chatgpt puppeteerTo use the ChatGPT API within the server index js file you need to configure the file to use both the require and import keywords for importing libraries Therefore update the server package json file to contain the type keyword type module Add the code snippet below at the top of the server index js file import createRequire from module const require createRequire import meta url other code statementsOnce you have completed the last two steps you can now use ChatGPT within the index js file Configure Nodemon by adding the start command to the list of scripts in the package json file The code snippet below starts the server using Nodemon In server package json scripts test echo Error no test specified amp amp exit start nodemon index js Congratulations You can now start the server by using the command below npm start Setting up the React applicationNavigate into the client folder via your terminal and create a new React js project cd clientnpx create react app Delete the redundant files such as the logo and the test files from the React app and update the App js file to display Hello World as below function App return lt div gt lt p gt Hello World lt p gt lt div gt export default App Navigate into the src index css file and copy the code below It contains all the CSS required for styling this project import url Grotesk wght amp display swap box sizing border box margin padding font family Space Grotesk sans serif input padding px width margin px outline none button width px cursor pointer padding px px outline none border none background color d home home form website item loading display flex align items center justify content center flex direction column home form gt h home form margin bottom px text align center width home min height vh padding px width website container width min height vh border radius px display flex align items center justify content center flex wrap wrap padding px website item width margin px background color fff border radius px padding px box shadow px px rgba website item gt img width border radius px website item gt h margin px website item gt p text align center opacity loading height vh background color fed Update the App js file to display an input field that allows you to provide the website s URL import React useState from react const App gt const url setURL useState const handleSubmit e gt e preventDefault console log url setURL return lt div className home gt lt form className home form gt lt h gt Website Aggregator lt h gt lt label htmlFor url gt Provide the website URL lt label gt lt input type url name url id url value url onChange e gt setURL e target value gt lt button onClick handleSubmit gt ADD WEBSITE lt button gt lt form gt lt div gt export default App Congratulations You ve successfully created the application s user interface In the following sections I ll walk you through scraping data from websites using Puppeteer and getting a website s description and title via ChatGPT How to scrape data using Puppeteer in Node jsPuppeteer is a Node js library that automates several browser actions such as form submission crawling single page applications UI testing and in particular web scraping and generating screenshots of web pages Here I ll guide you through scraping the website s content via Puppeteer in Node js We ll send the website url provided by the user to the Node js server and scrape the website s content via its URL Create an endpoint on the server that accepts the website s URL from the React app app post api url req res gt const url req body The URL from the React app console log url Import the Puppeteer library and scrape the website s content as done below Import Puppeteer at the topconst puppeteer require puppeteer app post api url req res gt const url req body Puppeteer webscraping function async gt const browser await puppeteer launch const page await browser newPage await page goto url returns all the website content const websiteContent await page evaluate gt return document documentElement innerText trim returns the website meta image const websiteOgImage await page evaluate gt const metas document getElementsByTagName meta for let i i lt metas length i if metas i getAttribute property og image return metas i getAttribute content console log websiteContent websiteOgImage await browser close Add a function within the React app that sends the URL to the api url endpoint const handleSubmit e gt e preventDefault setLoading true setURL Calls the function sendURL async function sendURL try const request await fetch http localhost api url method POST body JSON stringify url headers Accept application json Content Type application json const data await request json toggles the loading state if the request is successful if data message setLoading false catch err console error err From the code snippet above we added a loading state that describes the state of the API request const loading setLoading useState false Create a Loading component that is shown to the users when the request is pending import React from react const Loading gt return lt div className loading gt lt h gt Loading please wait lt h gt lt div gt export default Loading Display the Loading component whenever the content is yet to be available import Loading from Loading Add this code within the App js componentif loading return lt Loading gt Congratulations You ve learnt how to scrape content from websites using Puppeteer In the upcoming section you ll learn how to communicate with ChatGPT in Node js by generating websites descriptions and brand names How to communicate with ChatGPT in Node jsChatGPT is not yet available as a public API Therefore to use it we have to scrape our way in meaning we ll perform a full browser automation that logs in to the OpenAI website solves the captcha and send an API request with the OpenAI cookies Fortunately a public library that does this is available and has been installed as part of the project requirement Import the ChatGPT API library and create a function that sends a request to ChatGPT import ChatGPTAPIBrowser from chatgpt async function chatgptFunction content use puppeteer to bypass cloudflare headful because of captchas const api new ChatGPTAPIBrowser email lt CHATGPT EMAIL ADDRESS gt password lt CHATGPT PASSWORD gt await api initSession Extracts the brand name from the website content const getBrandName await api sendMessage I have a raw text of a website what is the brand name in a single word content Extracts the brand description from the website content const getBrandDescription await api sendMessage I have a raw text of a website can you extract the description of the website from the raw text I need only the description and nothing else content Returns the response from ChatGPT return brandName getBrandName response brandDescription getBrandDescription response Chat GPT is super intelligent and it will answer any question we will ask it So basically we will send it to write us the brand name and the description based on the complete website HTML The brand name can usually be found on the og site name but to show you how cool it is we will let ChatGPT extract it As for the description it s pretty crazy It will tell us what the site is about and summarize everything Next Update the api url route to as done below holds all the ChatGPT resultconst database generates a random string as IDconst generateID gt Math random toString substring app post api url req res gt const url req body async gt const browser await puppeteer launch const page await browser newPage await page goto url const websiteContent await page evaluate gt return document documentElement innerText trim const websiteOgImage await page evaluate gt const metas document getElementsByTagName meta for let i i lt metas length i if metas i getAttribute property og image return metas i getAttribute content accepts the website content as a parameter let result await chatgptFunction websiteContent adds the brand image and ID to the result result brandImage websiteOgImage result id generateID adds the result to the array database push result returns the results return res json message Request successful database await browser close To display the response within the React application create a state that holds the server s response const websiteContent setWebsiteContent useState async function sendURL try const request await fetch http localhost api url method POST body JSON stringify url headers Accept application json Content Type application json const data await request json if data message setLoading false update the state with the server response setWebsiteContent data database catch err console error err Lastly update the App js layout to display the server s response to the user const App gt other code statements remove the quotation marks around the descriptionconst trimDescription content gt content match replace g return lt div className home gt lt form className home form gt lt h gt Website Aggregator lt h gt lt label htmlFor url gt Provide the website URL lt label gt lt input type url name url id url value url onChange e gt setURL e target value gt lt button onClick handleSubmit gt ADD WEBSITE lt button gt lt form gt lt main className website container gt websiteContent map item gt lt div className website item key item id gt lt img src item brandImage alt item brandName gt lt h gt item brandName lt h gt lt p gt trimDescription item brandDescription lt p gt lt div gt lt main gt lt div gt Congratulations You ve completed the project for this tutorial Here is a sample of the result gotten from the application ConclusionSo far we have covered what ChatGPT is how to scrape website content using Puppeteer andhow to communicate with ChatGPT in a Node js applicationThis tutorial walks you through an example of an application you can build using Puppeteer and ChatGPT ChatGPT can be seen as the ultimate personal assistant very useful in various fields to enable us to work smarter and better The source code for this tutorial is available here Thank you for reading Help me out If you feel like this article helped you understand WebSockets better I would be super happy if you could give us a star And let me also know in the comments ️ |
2023-01-11 13:07:35 |
海外TECH |
DEV Community |
ChatGPT Is Helping Me Do Code Reviews |
https://dev.to/codewithbernard/chatgpt-is-helping-me-do-code-reviews-3a0o
|
ChatGPT Is Helping Me Do Code ReviewsI have a confession to make I m not a big fan of doing code review Especially not those big ones But lately I ve had a great idea The idea was to ask GPT model for help And I can proudly say the help I received My Problem With Code ReviewsWhat I really hate about code reviews is looking at a completely new file with undocumented code I have no idea what is going on there And this is exactly where GPT model comes into play I built a simple Github bot that do the following Analyze new pull requestsProcess newly added filesWrite brief description of the codeAdd description as a comment to pull requestI tested this whole flow on one of my projects and I was very satisfied with the result Here s a brief description that the model wrote This code is a React functional component that renders an affiliate ad using a combination of React hooks and DOM manipulation The component uses the useAffiliateAssets hook to fetch assets for the ad useMediaQuery to determine the device type then it renders the ad using ReactDOM createPortal and inserting the ad before the heading variable in the HTML document If any of the required assets heading mediumBox or mediumLandscape are not available the component returns null My Possible Next StepsI just built the prototype together to prove that the concept is working But I can t help to wonder Is this something that could help the others Should I build this into a fully featured product I know this would be a really fun project to work on but I m not sure if the idea is valid If you think it is please let me know in the comments If you think it s not let me know as well And if you feel like you really need this you can pre order a lifetime deal by using this link Note You ll be redirected to Stripe checkout |
2023-01-11 13:02:40 |
Apple |
AppleInsider - Frontpage News |
Ender-3 V2 Neo review: 3D printing, with the beginner in mind |
https://appleinsider.com/articles/23/01/11/ender-3-v2-neo-review-3d-printing-with-the-beginner-in-mind?utm_medium=rss
|
Ender V Neo review D printing with the beginner in mindIf you re looking to get started in D printing Creality s Ender V Neo D has some great features for beginners worth checking out A decade ago D printing was a niche hobby but that s no longer the case That s why I agreed to try out Creality s Ender V Neo D Printer a D printer designed for beginners and professionals alike Creality says the Ender V Neo is a human centered device and suggests nearly anyone could use it I wanted to see if it was indeed the case Read more |
2023-01-11 13:52:05 |
Apple |
AppleInsider - Frontpage News |
Drone-mounted Apple Watch Ultra used for gunshot detection |
https://appleinsider.com/articles/23/01/11/drone-mounted-apple-watch-ultra-used-for-gunshot-detection?utm_medium=rss
|
Drone mounted Apple Watch Ultra used for gunshot detectionA firm in Norway has mounted Apple Watch Ultra onto a drone to use its three microphone array and precision GPS feature to detect and locate gunshots Drone with Apple Watch Ultra Source Triangula While some regular users of Apple Watch Ultra initially reported problems with its three microphone system Oslo based company Triangula is using it as part of the firm s security services Read more |
2023-01-11 13:25:01 |
Apple |
AppleInsider - Frontpage News |
Apple Watch infringes Masimo pulse oximetry patent, rules judge |
https://appleinsider.com/articles/23/01/11/judge-rules-apple-watch-infringes-masimo-pulse-oximetry-patent?utm_medium=rss
|
Apple Watch infringes Masimo pulse oximetry patent rules judgeThe International Trade Commission ITC has backed medical firm Masimo in its case alleging patent infringement in the blood oxygen sensors of the Apple Watch Masimo s complaint with the ITC followed its lawsuit against Apple over the same accusation The filing with the ITC was then in June and the aim in both cases is to see a ban on the Apple Watch Series and later The number of specific patents concerned varies between the lawsuit and the ITC complaint The ITC judge has ruled that Apple violated Section of the Tariff Act of by infringing on one of Masimo s patents Read more |
2023-01-11 13:33:22 |
Cisco |
Cisco Blog |
Realizing the Value of Privacy Investment |
https://blogs.cisco.com/security/realizing-the-value-of-privacy-investment
|
Realizing the Value of Privacy InvestmentThis CIPL Cisco research report offers insights into the material business benefits that organizations are realizing from their Data Privacy Management Programs |
2023-01-11 13:00:42 |
海外TECH |
CodeProject Latest Articles |
BlazorForms Low-Code Open-Source Framework - CrmLight Project |
https://www.codeproject.com/Articles/5351772/BlazorForms-Low-Code-Open-Source-Framework-CrmLigh
|
advantages |
2023-01-11 13:01:00 |
ニュース |
BBC News - Home |
Andrew Bridgen suspended as Tory MP over Covid vaccine comments |
https://www.bbc.co.uk/news/uk-politics-64236687?at_medium=RSS&at_campaign=KARANGA
|
conservative |
2023-01-11 13:37:53 |
ニュース |
BBC News - Home |
Rishi Sunak admits to having used private healthcare |
https://www.bbc.co.uk/news/uk-politics-64237830?at_medium=RSS&at_campaign=KARANGA
|
minister |
2023-01-11 13:21:51 |
ニュース |
BBC News - Home |
Soledar: Ukraine battle hints at rift in pro-Russian forces |
https://www.bbc.co.uk/news/world-europe-64235712?at_medium=RSS&at_campaign=KARANGA
|
soledar |
2023-01-11 13:27:22 |
ニュース |
BBC News - Home |
'Number of defects' led to fatal fire at Cameron House hotel |
https://www.bbc.co.uk/news/uk-scotland-64236252?at_medium=RSS&at_campaign=KARANGA
|
december |
2023-01-11 13:49:15 |
ニュース |
BBC News - Home |
Chelsea transfer news: Joao Felix signs for Blues on loan from Atletico Madrid |
https://www.bbc.co.uk/sport/football/64226705?at_medium=RSS&at_campaign=KARANGA
|
felix |
2023-01-11 13:18:54 |
仮想通貨 |
BITPRESS(ビットプレス) |
[Bloomberg] コインベースが日本事業の大半から撤退、人員も削減-相場低迷で |
https://bitpress.jp/count2/3_9_13522
|
bloomberg |
2023-01-11 22:52:00 |
仮想通貨 |
BITPRESS(ビットプレス) |
日本暗号資産ビジネス協会、1/17に「JCBA 1月度勉強会」開催(会員対象) |
https://bitpress.jp/count2/3_15_13521
|
開催 |
2023-01-11 22:35:12 |
仮想通貨 |
BITPRESS(ビットプレス) |
DMM Bitcoin、1/25よりBitMatch注文の取引手数料を改定 |
https://bitpress.jp/count2/3_10_13520
|
bitmatch |
2023-01-11 22:28:12 |
コメント
コメントを投稿