投稿時間:2022-02-26 20:14:51 RSSフィード2022-02-26 20:00 分まとめ(18件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT ITmedia 総合記事一覧 [ITmedia News] ウクライナへのDDoS攻撃、日本でも兆候見えていた 観測のカギは「Backscatter」 https://www.itmedia.co.jp/news/articles/2202/26/news086.html backscatter 2022-02-26 19:50:00
python Pythonタグが付けられた新着投稿 - Qiita KerasでLSTMを用いた多クラス分類 https://qiita.com/katoh5160/items/28c2c13264df7b3ea986 以下記事を参考にクリーニングクラスを定義しています。 2022-02-26 19:06:06
Git Gitタグが付けられた新着投稿 - Qiita xoffice2txt (jom、nmake版) gitで管理しているExcelやWordファイルをテキスト化して差分を見れるようにするためのアプリ(Windows用) https://qiita.com/egg-sandwich/items/dcfb4ae22de2fad44ae2 xofficetxtjom、nmake版gitで管理しているExcelやWordファイルをテキスト化して差分を見れるようにするためのアプリWindows用処理の概要LibreOfficeでExcelなどのオフィス系ファイルをhtml化し、それをlynxでテキスト化します。 2022-02-26 19:05:19
技術ブログ Developers.IO Bastion Host에서 Private EC2 Windows로 접속해 보기 https://dev.classmethod.jp/articles/access-private-ec2-windows-from-bastion-host/ Bastion Host에서Private EC Windows로접속해보기안녕하세요클래스메소드김재욱 Kim Jaewook 입니다 이번에는Bastion Host에서Private EC Windows로접속해보는과정을정리해봤습니다 현재환경간단하게퍼블 2022-02-26 10:36:27
技術ブログ Developers.IO 単一リージョンでCloudTrailの証跡を作成してみた。 https://dev.classmethod.jp/articles/create-single-region-trail/ becominn 2022-02-26 10:11:21
海外TECH DEV Community Telegraf VS Node-Telegram-Bot-API https://dev.to/maklut/telegraf-vs-node-telegram-bot-api-36fk Telegraf VS Node Telegram Bot APIToday the most popular ways to build telegram chat bots in node js are Telegraf and Node Telegram Bot Api The second is more popular by weekly downloads but in this post I don t want to equalize them by stats I want to talk about my experience with them in which cases I used them and show you really nice guide especially for Telegraf cause they haven t readable docs for newbies or people who don t use typescript Node Telegram Bot APISo let s start with this package It is really easy but due to it we can t use it in really big projects cause it will be hard to understand structure of bot without comments or million javascript files To download type npm i node telegram bot apiAfter this as said in documentation you need to initialize it with your telegram token which you received from Bot Fatherconst TelegramBot require node telegram bot api const token YOUR TELEGRAM BOT TOKEN Create a bot that uses polling to fetch new updatesconst bot new TelegramBot token polling true And there are two main methods in this package bot sendMessage chatId message options and bot on one of params from api like message or text function which contains message param and returns response bot on message msg gt const chatId msg chat id send a message to the chat acknowledging receipt of their message bot sendMessage chatId Received your message Here is message object with all fields So if we need to react on start command we need to make something like this bot on message async function msg const text msg text const chatId msg chat id if text start bot sendMessage chatId Hello msg from username Choose your language reply markup one time keyboard true keyboard ua en We checked if our text is equal to our command and responded with message It is all main logic from this package more sendMessage methods or params you can see here Also we used reply markup option in which we can use our keyboard which will be sent with our message And then we can check if text equal to en we will change our language to english and response with message In addition if you have a question like can you send message without getting message from user you can do it All that you need is to save your user to database like MongoDB with chatId field and use something like express to make CRUD methods to send your message Here is my example of this bot mailer app get async req res gt await TelegramUser find cursor eachAsync async user gt bot sendMessage user chatId lt b gt Hi lt b gt parse mode HTML disable web page preview false So here we sent our message Hi in async forEach mongodb method when we got request to our app TelegramUser is a mongodb model where I store user chatId Also you can see two the most useful options from this package parse mode which parses our message to HTML but can t parse all tags like img video cause there are methods like sendPhoto sendVideo and disable web page preview which you can use when in message you send link and you don t want to see preview of it I hope you got it let s move to telegraf TelegrafLet s talk about telegram bot library which I prefer to use in big projects To download npm i telegrafIn this library we can see similar methods with node telegram bot api const Telegraf require telegraf const bot new Telegraf process env BOT TOKEN bot start ctx gt ctx reply Welcome bot help ctx gt ctx reply Send me a sticker bot on sticker ctx gt ctx reply bot hears hi ctx gt ctx reply Hey there bot launch To initialize we use new Telegraf token To react on start command we type bot start which is more readable than in previous package Here instead of message object we have ctx context object which almost doesn t have big difference from first one but has many another methods ctx reply is function with response message here if we want to parse HTML or reply with audio or photo etc we can use methods like ctx replyWithHTML or ctx replyWithPhoto all methods you can see in previous link bot on is the same as in node telegram bot api all params which can receive this function you can see here bot hears is just a function which reacts on user s message And to launch our bot we use bot launch It would seem that it is the end but in fact it is one part of opportunities which this library gives Here you can use scenes Telegraf ScenesLet s imagine that telegram bot is a theatre with one viewer our user When performance starts the first scene is beginning let s name it start scene There are some actions take place in this scene for some time and then the scene ends in another words we left the scene So this interval from beginning of our scene and ending is our scene Telegraf Scene is the same but let s display it in code This library has two types of scene Base Scene and Wizard Scene To set up our scenes we need to register them with Stage Let s do it in our main file app jsconst Scenes Telegraf require telegraf const start require controllers start scene file const about require controllers about scene file const settings require controllers settings scene file const contact require controllers contact scene file const search require controllers search scene file const bot new Telegraf process env TELEGRAM TOKEN const stage new Scenes Stage start about settings contact search Register our scenesbot use stage middleware Stage middlewarebot hears settings Scenes Stage enter settings Entering the settings scene when listener workedHere we imported our scenes and registered them in array Also we added a stage middleware without which our scenes won t work And to enter our scene we set bot listener with bot hears and then as a first param we type our scene id see in next paragraph and then we enter the scene with Scenes Stage enter Base SceneHere is an example of this scene settings jsconst Scenes require telegraf const Scene Scenes BaseScene const getMainKeyboard getBackKeyboard require util keyboards const leave Scenes Stage const settings new Scene settings settings enter async ctx gt const backKeyboard getBackKeyboard await ctx reply settings what to change backKeyboard settings leave async ctx gt const mainKeyboard getMainKeyboard await ctx reply shared what next mainKeyboard await ctx scene leave settings hears Back leave settings action backButtonId console log Back button was clicked module exports settings util keyboardsconst Markup require telegraf exports getMainKeyboard gt let mainKeyboard Markup keyboard Movies Settings mainKeyboard mainKeyboard oneTime return mainKeyboard exports getBackKeyboard gt let backKeyboard Markup keyboard Back backKeyboard backKeyboard oneTime return backKeyboard It is file with our settings scene To initialize it we use new Scene scene id When user entered our scene he will receive response from settings enter async function ctx in which we make our first step of scene Then all actions in our scene will be in settings on or in settings hears Then when scene is ending we use settings leave in which we have function with moving back to default scene start scene and ctx scene leave which is required to leave scene Without it you have a risk to stay in this scene forever Also if we have keyboard which can be created by Markup keyboard all our buttons there are strings in array If we want to make many rows in our keyboard we can make many arrays like if we have two arrays with two strings buttons we will get keyboard with rows with buttons in each When we tap on button we can handle this tap in scene action buttonId where buttonId is our button s second param in Markup button callback Also we can create inline keyboard with Markup inlineKeyboardMarkup inlineKeyboard Markup button callback Back backButtonId oneTime resize Wizard SceneAll logic of this scene is the same as in previous but here we have a chain with scene s steps To go to our next step we use ctx wizard next and ctx wizard steps ctx wizard cursor ctx too cause in last versions of Telegraf without it our step won t change To leave from scene we use ctx scene leaveconst Scenes require telegraf const getMainKeyboard require util keyboards const Wizard Scenes WizardScene const about new Wizard about Our wizard scene id which we will use to enter the scene async ctx gt await ctx reply ctx in t scenes about main ctx wizard next return ctx wizard steps ctx wizard cursor ctx async ctx gt const mainKeyboard getMainKeyboard ctx await ctx reply ctx in t shared what next mainKeyboard return ctx scene leave module exports about SessionAnd the last main thing in this library is session It is like local storage in web but for telegram bots Here we can save params that we need to save and use them in future To set up let s change our main file const Scenes session Telegraf require telegraf const start require controllers start scene file const about require controllers about scene file const settings require controllers settings scene file const contact require controllers contact scene file const search require controllers search scene file const bot new Telegraf process env TELEGRAM TOKEN const stage new Scenes Stage start about settings contact search Register our scenesbot use session Session middlewarebot use stage middleware Stage middlewarebot hears settings Scenes Stage enter settings Entering the settings scene when listener workedHere we imported our session from telegraf and made a session middleware Then we can use it in our scenes For example const Scenes session require telegraf const getMainKeyboard getBackKeyboard require util keyboards const User require models const getMoviesBySearch getMovieKeyboard require helpers const Base Scenes BaseScene const search new Base search const leave Scenes Stage search enter async ctx gt const backKeyboard getBackKeyboard ctx await ctx replyWithHTML scenes search welcome to search backKeyboard search hears Back leave search on text async ctx gt const user await User findById ctx from id const movies getMoviesBySearch user language ctx message text const movieKeyboard getMovieKeyboard ctx ctx session movies movies Set session field ctx session index Set session field ctx replyWithHTML movieKeyboard search leave async ctx gt const mainKeyboard getMainKeyboard ctx await ctx reply shared what next mainKeyboard delete ctx session index Delete session field delete ctx session movies Delete session field await ctx scene leave module exports search ConclusionsIn this post I explained how to deal with the most popular js telegram libraries step by step As I said I prefer Telegraf to Node Telegram Bot Api because it is more interesting and readable If you have any thoughts about it write at the comments below and correct me if I made some mistakes in this post cause I don t speak English fluently In additionToday in my country in Ukraine is a war which caused by Russia s aggression I want to have a peace in my country our army does their best and it would be great if you can support us writing nowarinukraine in your dev posts I hope that soon I will be able to write any posts here and make code projects again cause now I am sitting in basement and just wait 2022-02-26 10:36:29
海外TECH DEV Community Building an offer notification service on AWS https://dev.to/arszen123/building-an-offer-notification-service-on-aws-587e Building an offer notification service on AWSLet s build a simple web crawler application on AWS that sends a notification when there is a special offer for a product I love peanut butter and whenever there is an offer for it I would like to stock up some So I thought I will create a simple application that sends me a notification whenever there is an offer for this product What I need to create this application is The product URL And the exact location where the offer is located on the webpage so I can extract this information For this product the offer is located in the pap banner text value HTML element Probably you want to get notified by different things so you can customize the application logic Perhaps you would like to get notifications when a GPU XBOX PS is back in stock or you want to pull data from an API and send notifications based on predefined criteria It s up to you what the application sends notifications about ArchitectureThe AWS services we will use to create this application are AWS EventBridge For scheduling lambda function invocationsAWS Lambda    For crawling the website and publishing messages to an SNS topicAWS SNS   For sending email notificationsWe ll also use NodeJS for the Lambda function and Serverless for managing the infrastructure and deploying the application Setting up the development environmentFirst we have to install the Serverless CLI npm install g serverlessAfter installation we have to configure the credentials If you don t have it you can generate new credentials on the AWS console serverless config credentials provider aws key secret After we have installed the CLI we can create a new project serverless create template aws nodejs path offer notification applicationThe above command creates a skeleton project with a serverless yml file where we ll define our infrastructure and a handler js where we ll implement our Lambda function ImplementationBased on the above architecture diagram we ll have a Lambda function which will be invoked every day This Lambda function will fetch the target website content and whenever an offer is found it publishes a message to an SNS topic Because our Lambda function will publish to an SNS topic therefore it must have the necessary permissions to do this We also need an SNS topic where the offers will be published and an email subscriber which needs to be notified whenever a new message is published on this topic  The following serverless yml file describes the above mentioned architecture We also need a  env file with an EMAIL environment variable in it set to the desired email address where we want to receive the notifications Now that we have defined our infrastructure we can move on and write our application logic We should create a new src directory and move the handler js file under the newly created directory to make it better structured What our Lambda function needs to do is fetch the target website content and check whether there is an interesting offer For this we need some additional packages to fetch the site axios and parse the HTML content cheerio so let s install them with the following command npm install axios cheerioNow we have everything to implement the application core logic For this product it will look like the following As you can see the fetchOffer function fetches the website content and as we already know that the offer is located in the pap banner text value HTML element with cheerio we can easily extract the content of it Because I only want to get notifications when the offer is something like FOR or off I need to check if the offer matches with one of the regular expressions In the handler function the fetchOffer function is invoked and whenever it returns an offer it will be published to the SNS topic It s very simple isn t it DeploymentNow we can deploy the application to AWS with a single command serverless deployAfter it s successfully deployed we should receive a confirmation email to the configured email address After we have confirmed the subscription we ll receive an email from every message published on that SNS topic To remove the deployed application run the following command serverless remove TestingWe can easily test the deployed application manually by invoking the Lambda function with the following command serverless invoke function crawlIf there is an offer on the site we should receive an email about the offer SummaryFor creating this application we have used Serverless to define the infrastructure and deploy our application We also used AWS Lambda for running our code scheduled events for triggering the Lambda function invocation and SNS for sending email notifications to subscribers As you have seen it was very easy to implement and deploy this application to AWS with Serverless You can check out the repository on GitHub 2022-02-26 10:18:20
海外TECH DEV Community Work Productivity?💻💻 https://dev.to/slimpotatoboy/work-productivity-37pf Work Productivity Do you guys listen to music during work Does it increase your productivity during your work or does it distract you For me personally I feel like it somehow increases my productivity and focus When I am working without any music or songs my focus goes from coding to someone s dancing videos or thinking about some other stuffs rather than coding and it really distracts me But when I am listening to stuffs I focus on that music song and my focus is more on that music or code time to time Do you guys feel the same Please let me know about your work habits while coding Would love to know and connect Thank you Keep coding 2022-02-26 10:07:29
海外TECH Engadget US sanctions against Russia will limit its access to technology from overseas https://www.engadget.com/us-sanctions-russia-technology-105132550.html?src=rss US sanctions against Russia will limit its access to technology from overseasThe US government has imposed harsh export restrictions against Russia designed to drastically limit its access to both low and high tech goods from overseas As first reported by Reuters the Commerce Department has posted a list of expanded licensing policies and requirements implemented in response to Russia s further invasion of Ukraine nbsp Under the expanded sanctions US suppliers that want to ship to Russia will have to obtain licenses for goods that didn t require one in the past Those goods include microelectronics telecommunications items sensors navigation equipment avionics marine equipment and aircraft components nbsp In addition the US is adding companies designated as quot military end users quot due to their alleged ties to the Russian military to the entity list Any company seeking to ship products made abroad to those military end users will have to obtain licenses from the United States if they re using US made tools technology and software for their products The government says these sanctions should quot significantly impact Russia s ability to acquire items it cannot produce itself quot The new rules state that license requests will be reviewed quot under a policy of denial quot which means the Commerce Department will deny almost all of them The administration will only approve licenses in rare exceptions such as applications related to aviation and maritime safety as well as humanitarian needs Smartphone exports to Russia are also allowed so long as they re not shipped to Russian government employees and state owned enterprises nbsp Former Commerce Department official Kevin Wolf told Reuters that the rules are so complex many companies might simply stop dealing with Russia completely to avoid mistakes despite the carveouts However Cordell Hull another former official predicted that the rules would be difficult to enforce During a speech announcing the new measures President Joe Biden said partner countries are adopting or have expressed intent to adopt similar sanctions The list of partner countries includes members of the European Union such as Italy France and Germany along with Canada Australia Japan and the UK to name a few quot Between our actions and those of our allies and partners we estimate that we will cut off more than half of Russia s high tech imports quot he said 2022-02-26 10:51:32
海外ニュース Japan Times latest articles Sanctions war over Ukraine invasion triggers concern for some Japanese companies https://www.japantimes.co.jp/news/2022/02/26/business/japanese-companies-ukraine-russia-sanctions/ Sanctions war over Ukraine invasion triggers concern for some Japanese companiesDomestic firms are worried that a potential sanctions war between Western countries and Russia could have a considerable economic impact on their bottom lines 2022-02-26 19:40:54
海外ニュース Japan Times latest articles Russian forces pound Ukraine for third day as Interfax says they capture first city https://www.japantimes.co.jp/news/2022/02/26/world/russia-ukraine-putin-sanctions/ Russian forces pound Ukraine for third day as Interfax says they capture first cityIf the Interfax report citing the Russian defense ministry is confirmed it would be the first significant population center the Russians have seized since their 2022-02-26 19:17:21
ニュース BBC News - Home Poland boycotts Russia World Cup game over invasion https://www.bbc.co.uk/sport/football/60536030?at_medium=RSS&at_campaign=KARANGA Poland boycotts Russia World Cup game over invasionPoland will boycott their World Cup play off against Russia in March because of the invasion of Ukraine with captain Robert Lewandowski saying we can t pretend that nothing is happening 2022-02-26 10:46:43
ニュース BBC News - Home In pictures: Kyiv under attack as fighting rages on https://www.bbc.co.uk/news/in-pictures-60536824?at_medium=RSS&at_campaign=KARANGA ukraine 2022-02-26 10:36:27
ニュース BBC News - Home Ukraine maps: Tracking Russia's invasion https://www.bbc.co.uk/news/world-europe-60506682?at_medium=RSS&at_campaign=KARANGA districts 2022-02-26 10:36:54
ビジネス ダイヤモンド・オンライン - 新着記事 プーチン氏の「標的No1」 戦時下で再び変身 - WSJ発 https://diamond.jp/articles/-/297495 標的 2022-02-26 19:13:00
北海道 北海道新聞 宗谷7人感染 留萌管内3人 新型コロナ https://www.hokkaido-np.co.jp/article/650325/ 宗谷管内 2022-02-26 19:19:00
北海道 北海道新聞 ウクライナ情勢、北京パラに影 参加不透明、開幕まで1週間切る https://www.hokkaido-np.co.jp/article/650320/ 開幕 2022-02-26 19:10:00
北海道 北海道新聞 ウクライナ、北京パラに参加意思 情勢緊迫、平和のため戦う https://www.hokkaido-np.co.jp/article/650319/ 緊迫 2022-02-26 19:10: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件)