python |
Pythonタグが付けられた新着投稿 - Qiita |
【Paiza問題集】標準出力メニュー/半角スペース区切りの出力 |
https://qiita.com/norma2627/items/4fb9c9658d90ccf6cab0
|
paiza |
2023-05-21 21:44:58 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
RubyでAtCoder ABC302(A, B, C, D)を解いてみた |
https://qiita.com/shoya15/items/e498bd48b178a3f669fc
|
atcoder |
2023-05-21 21:43:44 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
[AWS Q&A 365][SQS]AWSのよくある問題の毎日5選 #62 |
https://qiita.com/shinonome_taku/items/cd0f875203aececba2e5
|
amazonsimplequeueservice |
2023-05-21 21:25:56 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
[AWS Q&A 365][SQS]Daily Five Common Questions #62 |
https://qiita.com/shinonome_taku/items/9113de50358453b0734a
|
amazon |
2023-05-21 21:24:19 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
【Azure OpenAI開発】簡易版エンタープライズサーチを自作して理解を深める (2) プロンプトエンジニアリング |
https://qiita.com/sakue_103/items/d5685664393cfdccd773
|
https |
2023-05-21 21:11:32 |
海外TECH |
DEV Community |
How to scrape google maps using Python, Selenium and Bose Framework |
https://dev.to/chetanam/how-to-scrape-google-maps-using-python-selenium-and-bose-framework-20g
|
How to scrape google maps using Python Selenium and Bose Framework IntroductionIn today s digital era businesses are constantly seeking innovative ways to generate leads and gain a competitive edge One incredibly powerful tool that has become indispensable for lead generation is Google Maps With its vast database of businesses and geolocation information scraping Google Maps can provide valuable insights and opportunities for various industries It allows businesses to extract information such as business names contact details addresses customer reviews and more This data can serve as a goldmine for web developers and marketers in their quest for BB leads To Scrape Google Maps we will use Bose Framework a Selenium based Bot Development Framework that provides a comprehensive set of tools and functionalities specifically aimed at making the Bot Development Process easy for Developers Let s dive into the fascinating world of lead generation and explore how web developers can leverage the Bose Framework and Google Maps scraping to discover BB leads How to scrape google mapsI have written a Python script that allows you to scrape information from Google Maps including business names addresses phone numbers websites ratings and reviews The script can be configured to search for specific queries and can scrape either the first page of results or all pages of results Let s get started with Installation InstallationClone Starter Templategit clone google maps scrapercd google maps scraperInstall dependenciespython m pip install r requirements txtRun Projectpython main pyThe script will start running and output progress updates to the console When the scraper is complete it will generate a CSV file named finished csv in the output directory The CSV file will contain the business name address phone number website rating and review for each result Additionaly you don t have to configure the Selenium driver as it will automatically download the appropriate driver based on your Chrome browser version ConfigurationTo specify the Google search queries to be used in the scraper open the src scraper py file in your preferred text editor and update the Task queries list with your desired queries To specify whether to scrape the first page of Google Maps results or all pages of results open the src scraper py file and set the Task GET FIRST PAGE variable to True or False as appropriate |
2023-05-21 12:23:48 |
海外TECH |
DEV Community |
[Node.js] Using callback-based functions when the rest of the code uses Promises |
https://dev.to/gaurang847/nodejs-using-callback-based-functions-when-the-rest-of-the-code-uses-promises-gl5
|
Node js Using callback based functions when the rest of the code uses PromisesHey My name is Gaurang and I ve been working with Node js for the past years This article is part of the My Guide to Getting through the Maze of Callbacks and Promises series It s a part series where I talk about writing asynchronous code with Node js The articles are intermediate level and it is expected that the reader already has basic familiarity with Node js syntax and the constructs related to asynchronous programming in it Such as callbacks promises and async await Table of ContentsIntroductionUsing util promisifyCreating a new PromiseCreate a Promise callback dual behaviour wrapper Introduction Promises were introduced in JavaScript in just years back from the date of writing this article Async await was introduced in just years back That was not a very long time ago At least not enough to eradicate the use of callbacks As a working professional you often need to work with legacy code So as a JavaScript Node js developer God forbid you may have to work with callbacks at some point And I m assuming that you ve had enough exposure to callbacks to understand the general dread that they bring It takes time to get a hang of writing code with callbacks For those without prior experience with asynchronous programming it is no different than bullfighting for the first time For this reason I believe they try to stick to the sync version of async functions If you ve read my previous article in the series you would know that this approach is more damaging than it is helpful My personal opinion is that the best way to deal with callback based functions is to convert them into promise returning ones Suppose you re working on a Node js based project You created new modules it could be APIs controllers utility services etc everything using promises and async await However there are some legacy functions written using the callback approach You need to call one such function but don t want to give birth to a callback hell There are ways of going ahead with this Use util promisify My favourite Create a new promise Create a smart wrapper that can get you either a callback or a Promise based on your requirement Using util promisify A lot of people don t know about this gem that was introduced in Node js version If the legacy callback based function uses the standard error first callback style and the callback is the last argument you can create a promise returning function with minimal code using util promisify You have to be careful using it with functions that belong to a class object though If you re new to the bind function and are not sure what the object context is here are a few great resources that may help MDN docs on bind functionMPJ s explainer video on bind and thisJavaScript Tutorial article on bind functionOne of the best things about util promisify is that it works flawlessly with Node js native library methods such as functions belonging to modules fs child process etc You can use it to promisify setTimeout as well Creating a new Promise If the callback based function doesn t follow proper conventions Or for some reason util promisify doesn t work for you you can always create a custom new Promise You can move the Promise creation to a separate function if doing it inline looks shabby Note Here promisifiedAsyncFunction does not use async await But it returns a Promise So we have to use await in the main function while calling promisifiedAsyncFunctionIf the callback based function belongs to a class object you ll need to take care of the context Create a Promise callback dual behaviour wrapper If you have access to the source code of the original callback based function And the authority to modify it you can create a wrapper around it This wrapper will work as a callback based function if a callback is provided If not it ll return a Promise This dual behaviour wrapper lets you work with Promises in new code that you write Without disturbing the old code where the function is expected to work with a callback Thus it provides Promise support with backward compatibility for callback based legacy code Previously if the module exported the callbackBasedAsyncFunc function now it can export the dualBehaviourWrapper Previouslymodule exports callbackBasedAsyncFunc callbackBasedAsyncFunc Nowmodule exports callbackBasedAsyncFunc dualBehaviourWrapper Thus with minimal modification you can add Promise support to a legacy module And all the other existing modules that are calling callbackBasedAsyncFunc by passing a callback remain unaffected Win win You might have noticed that a lot of popular NPM libraries give similar dual behaviour support for their functions where they use a callback if it is passed and return a Promise if a callback is not passed Their implementation may be different though For example mocha js Footnote fs version introduced Promises API which has promise based versions of functions Have a look at the documentation So you don t need to struggle with callbacks or manually convert fs functions to Promise based ones |
2023-05-21 12:08:58 |
海外TECH |
DEV Community |
OpenCommit: GitHub Action to improve commits with meaningful messages on every `git push` 🤯🔫 |
https://dev.to/disukharev/opencommit-github-action-to-improve-commits-with-meaningful-messages-on-every-git-push-1i3a
|
OpenCommit GitHub Action to improve commits with meaningful messages on every git push Hi Hackers About days ago I came across the GitHubHack post and then I thought Hmm ain t I got something to contribute ーsquinting my eyes like this What I BuiltMeet OpenCommit as a GitHub Action 🪅With OpenCommit action set in a repository every commit pushed is automatically improved with a meaningful message about what was changed and the rationale behind those changes You can find the Action in the GitHub marketplace here and follow the instructions to set it up in your repository Category Submission I m submitting the Action for the Maintainer Must Haves category as it helps maintainers follow a rational behind the changes contributed by reading clean and meaningful commit messages And I m also submitting the Action for the DIY Deployments category as a custom CI script that improves open source collaboration experience App LinkYou can access the Action page here and the repository here Screenshots DescriptionWith the Action set in a repository all commits are automatically improved with meaningful clear and easy to follow messages on every push to any branch You may exclude branches like main and dev from the Action via a custom setting Here s how to set up Link to Source CodeFind the source code for the Action here Permissive LicenseOpenCommit is distributed under the MIT License ーyou can find the license here BackgroundI was inspired to create OpenCommit from my experiences as a maintainer It s a true joy to review PRs with clean coherent commit messages that are easy to follow It s magical to open a PR and follow a trail of meaningful commit messages that tell you what changed and why And now if some of the contributions lack clear and concise commit messages ーyou set OpenCommit GitHub Action to solve this problem How I Built ItWow it s a long story The journey of creating this GitHub Action started with identifying a problem space in the current GitHub ecosystem the quality and consistency of commit messages depends on a collaborator I decided to develop a solution leveraging GitHub Actions and OpenAI s GPT model via OpenCommit functionality to generate enhanced commit messages Thanks to mishmanners explaining that building great things on top of great things is great The StackThe Action is built using TypeScript and Node js popular choices for GitHub Actions due to their excellent support for asynchronous operations a crucial requirement considering the multiple I O operations involved In the initial setup I used the actions toolkit package which provides useful utilities to streamline the creation of GitHub Actions I picked actions core for basic functionalities such as inputs outputs and error handling actions github to interact with GitHub s REST API and actions exec to execute shell commands The AlgorithmThe core function of the action is improving commit messages I achieved this by combining GitHub s APIs with the openAI s GPT model ーcheap and powerful I utilized Octokit GitHub s official client library for Node js to fetch commit messages from the PR context These commit messages are then passed as prompts to the openAI API which then generates an enhanced version of each commit message Workflow and UsageThe action is designed to run on push events specifically when a new commit is pushed to a PR This triggers the action which then fetches the commit messages improves them as per Conventional Commits concept and finally replaces the original ones You may also turn on GitMoji convention if you prefer your messages baked with emojis Testing and RefactoringThe initial prototype had some shortcomings for instance it did not handle errors and exceptions well making it less robust Therefore a significant amount of time was spent on refactoring the codebase The action was thoroughly tested across a variety of scenarios to ensure its reliability and robustness Challenges and LearningsThroughout the journey there were numerous challenges However they presented learning opportunities One significant challenge was ensuring the correct handling of Git commands in different environments I learned a great deal about GitHub Actions internal workings and how to manage and manipulate commit histories Another challenge was working with the GPT API and optimize the calls to make the tool run cheap Future ImprovementsBuilding on an already powerful package that offers an array of features was a pivotal part of this GitHub Action The base package supports more than ten languages incorporates GitMoji and offers robust algorithms to manage any size commit diffs This combined with smart prompts for GPT to generate the best commit message results provides a solid foundation for future enhancements Looking ahead I plan to introduce more customization options allowing users to specify the level of verbosity and the style of their commit messages with prefixes and postfixes Additionally I aim to enhance language support further catering to global non English speaking users thus broadening the action s reach I m also adding GitHub Codespaces configs to the repo to make open source collaboration experience easier ーyou would just click Run in a Codespace on the README and instantly create a PR from your browser In conclusion the development of this GitHub Action has been a highly rewarding process full of valuable learnings about GitHub s ecosystem CI CD practices Git operations and the power of AI in automating mundane tasks Additional Resources InfoHere are some helpful resources that guided me in this project GitHubHack dev to postGitHub Actions documentationJavaScript Actions Toolkit LibraryA big thank you to mishmanners github and dev to for such a fun days Feel free to give OpenCommit a try in your projects and any feedback is welcomed I need to get some sleep now GitHubHack 🪩 |
2023-05-21 12:02:07 |
Apple |
AppleInsider - Frontpage News |
Tim Cook visits Cannes for 'Killers of the Flower Moon' debut |
https://appleinsider.com/articles/23/05/21/tim-cook-visits-cannes-for-killers-of-the-flower-moon-debut?utm_medium=rss
|
Tim Cook visits Cannes for x Killers of the Flower Moon x debutApple CEO Tim Cook has been spotted in Cannes attending the film festival at the same time the Martin Scorsese film Killers of the Flower Moon made its debut Lily Gladstone and Leonardo DiCaprio in Killers of the Flower Moon Surfacing in a video of star Leonardo DiCaprio at a festival event Cook is seen talking to the celebrity As a black tie affair both men are wearing tuxedos with DiCaprio also sporting shades Read more |
2023-05-21 12:19:42 |
Apple |
AppleInsider - Frontpage News |
Top 10 biggest Apple product heists of all time |
https://appleinsider.com/articles/23/05/21/ten-of-the-biggest-apple-product-heists-of-all-time?utm_medium=rss
|
Top biggest Apple product heists of all timeThe recent Washington state Apple Store theft is one of a long list of massive heists of Apple products Here are some of the biggest including upgrade scams truck hijacking and warehouse thefts The Apple Store at Alderwood in WashingtonIn a particularly brazen theft in early April thieves broke into the Apple Store at the Alderwood Mall in Lynwood Wash After cutting through the wall of an adjacent coffee shop the thieves stole hundreds of items at a total reported cost of over Read more |
2023-05-21 12:33:14 |
ニュース |
BBC News - Home |
Braverman speeding course claim prompts calls for inquiry |
https://www.bbc.co.uk/news/uk-politics-65659053?at_medium=RSS&at_campaign=KARANGA
|
attorney |
2023-05-21 12:41:07 |
ニュース |
BBC News - Home |
Labour's NHS plan will offer patients more choice, Wes Streeting says |
https://www.bbc.co.uk/news/uk-politics-65663464?at_medium=RSS&at_campaign=KARANGA
|
hospital |
2023-05-21 12:54:29 |
ニュース |
BBC News - Home |
Andy Murray withdraws from French Open to prioritise Wimbledon |
https://www.bbc.co.uk/sport/tennis/65663508?at_medium=RSS&at_campaign=KARANGA
|
court |
2023-05-21 12:12:34 |
コメント
コメントを投稿