IT |
MOONGIFT |
satellite-viewer - 30行で作られた衛星トラッカー |
http://feedproxy.google.com/~r/moongift/~3/5pRYqWAIxg8/
|
satelliteviewer行で作られた衛星トラッカー夜空の星を見上げると、ISSが見えることがあります。 |
2021-05-30 21:00:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
最新のdata augmentationのCutPasteをOpenCV-Pythonで実装する |
https://qiita.com/zippowriter/items/f120e734b619cf6dafc3
|
|
2021-05-30 19:46:46 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
第10回 今更だけど基礎から強化学習を勉強する モデルベース編(Dyna) |
https://qiita.com/pocokhc/items/bcebc4b7b2454028baf9
|
モデルフリーモデルベース報酬が疎な環境チェス等経験から価値を推定しにくい学習しにくい近似モデルから将来がある程度予想できるのでまだ学習できる経験の収集環境に依存し、場合によっては高コスト実際に動かすわけではないので低コスト誤差直接得られた経験なので誤差が小さい推定した近似モデルを使って推定するので誤差が大きくなるアルゴリズムモデルフリーなアルゴリズムのみモデルフリーだけではなく、モデルベースなアルゴリズムも使用可能実装における環境テーブル型モデル第回と同じく以下の環境GridEnvを使います。 |
2021-05-30 19:17:14 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
laravel nuxt.js s3に保存されている画像の表示 |
https://teratail.com/questions/341232?rss=all
|
laravelnuxtjssに保存されている画像の表示LaravelでSに画像を保存し、その画像をnuxtjsで表示させたいのですが、表示されなくて困っています。 |
2021-05-30 19:49:10 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
チャットCGIとそのCGIで利用可能なボットを教えてください。 |
https://teratail.com/questions/341231?rss=all
|
|
2021-05-30 19:45:37 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
他のオブジェクトで表される変数をほかのスクリプトで使用したい。 |
https://teratail.com/questions/341230?rss=all
|
他のオブジェクトで表される変数をほかのスクリプトで使用したい。 |
2021-05-30 19:44:31 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
【MW WP Form】選択した値によって動的にセレクトボックスの値を生成 |
https://teratail.com/questions/341229?rss=all
|
【MWWPForm】選択した値によって動的にセレクトボックスの値を生成解決したいこと「MWnbspWPnbspForm」を使用して問い合わせフォームを作成中で、選択した値によって動的にセレクトボックスの値を生成するような動きを実現したい。 |
2021-05-30 19:42:02 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
checkboxのクリックで任意のdivの表示・非表示を切り替えたいです。 |
https://teratail.com/questions/341228?rss=all
|
checkboxのクリックで任意のdivの表示・非表示を切り替えたいです。 |
2021-05-30 19:41:48 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Rubyの全てのオブジェクトが持つmethodを取得したい |
https://teratail.com/questions/341227?rss=all
|
class |
2021-05-30 19:36:29 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
NodejsのAdonisフレームワークでビューに変数を渡したい |
https://teratail.com/questions/341226?rss=all
|
NodejsのAdonisフレームワークでビューに変数を渡したいお疲れ様です。 |
2021-05-30 19:27:14 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
文字列で表された数値の足し算 |
https://teratail.com/questions/341225?rss=all
|
文字列で表された数値の足し算前提・実現したいことC言語で、キーボードから二つの数を入力し、その二つの数を基に足し算を行うプログラムの作成を行いたいと思っています。 |
2021-05-30 19:22:29 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
windowsにおけるapacheサーバを介したユーザディレクトリへのアクセス方法 |
https://teratail.com/questions/341224?rss=all
|
windowsにおけるapacheサーバを介したユーザディレクトリへのアクセス方法apacheconfにて以下のような設定があっりました。 |
2021-05-30 19:21:42 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
macでPythonをバージョンアップできない |
https://teratail.com/questions/341223?rss=all
|
macでPythonをバージョンアップできない現在のPythonのバージョンがであり、homebrewを使用して最新のバージョンにインストールしようとしていますが、エラーがでてインストールできない状態となっています。 |
2021-05-30 19:12:08 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
webアプリでスマートフォンのライト(カメラの横にあるフラッシュライト)を点灯させることは可能でしょうか。 |
https://teratail.com/questions/341222?rss=all
|
webアプリでスマートフォンのライトカメラの横にあるフラッシュライトを点灯させることは可能でしょうか。 |
2021-05-30 19:02:49 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
Webアプリ公開のためのインフラ環境をCloudFormationで構築してみた |
https://qiita.com/Unimaru/items/7cecb9bea2a7a078d295
|
Webアプリ公開のためのインフラ環境をCloudFormationで構築してみた目次はじめに前提独自ドメインの取得ネットワークの設定セキュリティの設定仮想サーバおよび独自ドメインの設定通信のhttps化およびデータベースの設定稼働確認まとめcloudformationテンプレート参考はじめにWebアプリをAWSのEC上へデプロイする場合、インフラ環境には以下のような様々なAWSリソースを使用することになり、毎回手作業で設定をしていくと、時間もかかりますし、設定ミスをする可能性も出てきます。 |
2021-05-30 19:56:21 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
JenkinsをAWS上で動かす① |
https://qiita.com/jda7407/items/31111dfa131abceaa56d
|
環境UbuntuLTS初期セットアップ状態JavaやJenkinsなどはインストールされていないDocker環境の用意Dockerを使うため最低限Dockerを入れる必要があります。 |
2021-05-30 19:39:04 |
技術ブログ |
Developers.IO |
[アップデート] CloudWatch Logs メトリクスフィルターでディメンションがサポートされました! |
https://dev.classmethod.jp/articles/amazon-cloudwatch-logs-announces-dimension-support-for-metric-filters/
|
sannouncesdimensionsuppor |
2021-05-30 10:49:21 |
海外TECH |
DEV Community |
Daily Share Price Notifications using Python, SQL and Africas Talking - Part Two |
https://dev.to/ken_mwaura1/daily-share-price-notifications-using-python-sql-and-africas-talking-part-two-37db
|
Daily Share Price Notifications using Python SQL and Africas Talking Part Two Previously To recap abit in Part One of this article Created a folder to hold all of our code Used pip to install the required packages including africastalking beautifulsoup scrapy psycopg binary sqlachemy python dotenv Created our first project and spider using scrapy cli Scraped the afx website for stock prices We followed that by cleaning the data removing html tags and unnecessary styling Finally we defined our data pipeline as required by scrapy and database parameters This was enable data to be insterted and therefore persisted across different sessions We ran our scraper to ensure everything is working as it should We also saved the scraped data as a JSON file for quick preview For this article we will cover creating a SMS notification script once a certain stock reaches a specified price threshold This will be enabled by Africas Talking SMS api through the python SDK To wrap up we ll deploy our project to a heroku server and it have run The full code for this tutorial is on github NotificationsIn this section we ll create a script that queries the database retrieves a specified stock price checks against set constraints and if the specified condition is met a notification text is sent Our current file structure is as shown below python projects tree nse scrapernse scraper├ーLICENSE├ーnse scraper│ ├ー init py│ ├ーitems py│ ├ーmiddlewares py│ ├ーmodels py│ ├ーpipelines py│ ├ーsettings py│ ├ーspiders│ │ ├ーafx scraper py│ │ └ー init py│ └ーtest json├ーREADME md├ーrequirements txt├ーscrapy cfg└ーtest json directories filesInside the nse scraper nse scraper folder lets create a stock notification py file This will hold all of query and notification code Inside add the following code stock notification pyfrom typing import List Anyfrom models import StockData db connectfrom sqlalchemy orm import sessionmakerfrom sqlalchemy import descimport africastalking as atimport osThe above block code imports our required libraries ranging from africastalking python sdk to the os package We also import the required classes Stockdata and db connect from models py file We also import the List and Any objects fron the typing library For the next part ensure you have an Africas Talking account and a Heroku account stock notification pyat username os environ get at username at api key os environ get at api key mobile number os environ get mobile number print at username at api key Initialize the Africas sdk py passing the api key and username from the env fileat initialize at username at api key sms at SMSaccount at ApplicationThe above code retrieves the required credentials from enviroment variables Usually I prefer to use env files however since we are deploying to Heroku We need to specify environment variables that we will define in Heroku We the initialize the Africas Talking Sdk using our appropriate credentials We further assign the SMS class to a variable We also assign the Application class to a account variable The snippet below assigns engine variable to the db connect function following it up by binding sessionmaker to the engine variable This implements a session when doing database operations We finally define an empty ticker data list to hold all of our stock data stock notification pydef stock query sq session query StockData id StockData stock ticker StockData stock name StockData stock price filter StockData stock ticker SCOM for id ticker name price in sq order by desc StockData id limit print id name ticker price new data stock id id stock name name stock ticker ticker stock price price return new dataWe define a stock query function to query our specific stock data We then define a query for the database using our pre defined StockData class we are checking specifically checking for the latest Safaricom PLC stock data This is however just for demonstration purposes you are free to choose any other stock or counter We then unpack the returned data into the new data dictionary stock notification py Create a function to send a message containing the stock ticker and pricedef stock notification message str number int try response sms send stock data number print account fetch application data print response except Exception as e print f Houston we have a problem e In the snippet above we create a stock notification function and pass stock data argument specified as a list We also pass a number argument of the integer type As the name suggests this function will effectively send a text message to the us once a stock reaches a certain criteria We throw in a try catch block this ensures incase the message fails to send we have a way to catch and debug the error We also output our account balance inorder to ensure we get a balance check on each run stock notification py message f stock query stock name is now Kes stock query stock price per share check if Safaricom share price is more than Kes and send a notification if stock query get stock price gt Call the function passing the message and mobile number as a arguments print message stock notification message mobile number In the final block of code above we define a message variable to hold the data we ll send as a text message We want to send the stock name and the current stock price We then define the criteria inorder to send the message in this case its when the price is above Kes When the criteria is achieved the stock notification function is called To recap your project should now look as shown below nse scraper├ーLICENSE├ーnse scraper│ ├ー init py│ ├ーitems py│ ├ーmiddlewares py│ ├ーmodels py│ ├ーpipelines py│ ├ーsettings py│ ├ーspiders│ │ ├ーafx scraper py│ │ └ー init py│ ├ーstock notification py│ └ーtest json├ーREADME md├ーrequirements txt├ーruntime txt├ーscrapy cfg└ーtest json directories files Deployment Lets now deploy our scraper to Heroku and have it run in one hour intervals Heroku account registrationFirst and foremost you would need to register an account with Heroku it s free Installing Heroku CLIAfter your account registration let s use Heroku CLI to create and manage our project You may check out the installation steps for other OS here for arch linuxsudo pacman S heroku LoginTo log in using Heroku s CLI simply cd to your project folder and run heroku login cd nse scraper heroku login heroku Press any key to open up the browser to login or q to exit Opening browser to xxxx xxxx xxxxLogging in doneLogged in as amp gmail com GitAt this stage you should already have set up your project with git init and git commit etc The next steps are to turn your project into a git repository and push it to Heroku i To create a Heroku application heroku apps create daily nse scrape ii Add a remote to your local repository heroku git remote a daily nse scraper iii Deploy your code git push heroku mainOnce we re done here let s open up our Heroku dashboard page for your newly created Heroku application Setup free tier managed PostgreSQL service on HerokuTake note that the free tier only has a limit of rows at the time of writing this This step is fairly simple simply go to the Resources tab on your Heroku dashboard and look for Heroku Postgres select the free tier or whichever you deem fit To look for your database credentials simply click on your Heroku Postgres add on →select Settings → View Credentials Finally adjust your Scrapy project s connection to your database accordingly settings py POSTGRES SETTINGShost os environ get POSTGRES HOST port os environ get POSTGRES PORT username os environ get POSTGRES USER password os environ get POSTGRES PASS database os environ get POSTGRES DB drivername postgresql DATABASE f drivername username password host port database Or alternatively DATABASE CONNECTION STRING postgres xxxx xxxx ec xx xxx xxx xx compute amazonaws com xxxxxxEnsure you add your configuration variables in Settings → Reveal Config Vars This will allow Heroku to get and set the required environment configuration for our web scraper to run As shown belowEnd ResultsBy the end of this if you were to visit your Heroku dashboard activity feed you should see your application there where the latest activity says that your app has been deployed If you try to run heroku run scrapy crawl afx scraper on your local terminal you should see that it will attempt to run the crawler on your Heroku server If everything ran as expected You should see output on your terminal In the database addon we can run a simple query to check our database tables Note I also added a runtime txt file at the root of our project this tells Heroku what python version to use for our project By default it uses the latest python version this may introduce errors during execution thus its better to opt for a fixed version In this case I specified python Heroku SchedulerThis section of the article shows you how you can run your crawlers spiders periodically Though Heroku offers several different schedulers that could run your application periodically I personally prefer Heroku Scheduler as it has a free tier and it is super simple to use To use the free tier of this add on Heroku requires you to add a payment method to your account ConfigurationInside your newly added Heroku Scheduler add on simply select Add Job on the top right corner and you should see the screen as shown in the picture beside To run thescrapy crawl afx scraper command periodically simply select a time interval and save job How do I schedule a daily job Simply configure our Heroku Scheduler to run our python script every day at a specified time In our case its every hour at minutes Then it should run our command scrapy crawl afx scraper Scheduling Text NotificationsNow we need add a scheduler for Heroku to run our notifiction script which will inturn send us texts Since we already have an instance of Heroku running in our app we need an alternative Advanced scheduler is a good option as it offers a free trial and if need be a per month for an upgrade Setup Inside our daily nse scraper app search for the advanced scheduler addon Select the trail free plan and submit order form ConfigurationClick on the Advanced Scheduler addon Inside the overview page Click on Create trigger button The free trial allows up to triggers We ll set a trigger for am each day specify the command python nse scraper stock notification py to run Remember to select the correct timezone in my case its Africa Nairobi and save the changes TestingTo ensure the scheduler will execute as expected We can manually run the trigger on the overview page click on the more button and select execute trigger You should now have received a notification text if everything went as expected Wrap Up To wrap things up I have found a lot of success in deploying and running my spiders periodically with this method The only downside here is the free tier version of Heroku Postgres which only supports up to database rows In this case we can easily opt in for the paid version of it and scale our database accordingly based on our demand On a side note we could also easily swap out our Scrapy project s database instance to use another cloud RDS solution such as Amazon RDS On top of these you can also easily opt in for other available Heroku add ons for logging and monitoring purposes Another Free Alternative MethodWhile I am aware that we could use Scrapyd to host your spiders and actually send requests alongside with ScrapydWeb I personally prefer to keep my scraper deployment simple quick and free If you are interested in this alternative instead check out this post written by Harry Wang If you have any question or comments Let me know in the comments or on Twitter Happy Coding |
2021-05-30 10:17:30 |
海外TECH |
DEV Community |
Making a custom toggle/switch button with Tailwindcss and Vue.js |
https://dev.to/fayaz/making-a-custom-toggle-switch-button-with-tailwindcss-and-vue-js-9cm
|
Making a custom toggle switch button with Tailwindcss and Vue jsNot sure what you call them toggles or switches but here s how you make a toggle button with Tailwindcss and Vue Here s how it looks and works Let s make a new component called toggle vue and add the below code lt template gt lt div class w h flex items center bg gray rounded full p duration cursor pointer class bg green value aria checked value toString click emit input this value gt lt div class bg white w h rounded full shadow md transform duration class translate x value gt lt div gt lt div gt lt template gt lt script gt export default props value type Boolean default false lt script gt Now use the component in your code whoever you d like to lt template gt lt div gt lt toggle v model toggleValue gt lt div gt lt template gt lt script gt export default data return toggleValue false lt script gt Let s break down the component and try to understand Sorry for the bad image quality not sure why is dev reducing the quality even if it s hosted somewhere else here s the link to a higher resolution picAn outer which acts as a container for our toggle button styled with rounded corners and display flex properties Here s the thing when we want to add v model to custom events there are two important things involved a prop named value and a event named input to emit so technically you custom component should look like this lt custom component value variable input doSomething gt The interesting thing is v model directive is a shorthand for the above attributes which would make our component markup like this lt custom component v model variable gt That is exactly what we re doing here with our toggle component Add a rounded div and bind this class to it translate x so it is gets slided to the right when value true class translate x value The final thing just add a receive a prop with name value which is very important that it be named value We now have a working custom toggle component Just call it wherever you need like below Here s a demo if you d like to test it and here s the source codeShameless plug do follow me on twitter for more articles and announcements |
2021-05-30 10:00:50 |
ニュース |
BBC News - Home |
Boris Johnson marries Carrie Symonds at Westminster Cathedral |
https://www.bbc.co.uk/news/uk-57296472
|
ceremony |
2021-05-30 10:25:42 |
ニュース |
BBC News - Home |
Poots: European Union treating NI as a political play-thing |
https://www.bbc.co.uk/news/uk-northern-ireland-57299360
|
peace |
2021-05-30 10:12:46 |
ニュース |
BBC News - Home |
Travis Perkins warns of price rises amid shortage of raw materials |
https://www.bbc.co.uk/news/business-57299350
|
cement |
2021-05-30 10:42:56 |
ニュース |
BBC News - Home |
South Western Ambulance Service declares 'critical incident' |
https://www.bbc.co.uk/news/uk-england-57298467
|
blames |
2021-05-30 10:52:34 |
ニュース |
BBC News - Home |
Moto3 rider Dupasquier dies after crash in qualifying |
https://www.bbc.co.uk/sport/motorsport/57299713
|
italy |
2021-05-30 10:47:17 |
LifeHuck |
ライフハッカー[日本版] |
Apple Musicの7500万曲以上が対応予定。「ロスレスオーディオ」とは? |
https://www.lifehacker.jp/2021/05/why-apple-musics-lossless-audio-isnt-that-big-of-a-deal.html
|
apple |
2021-05-30 20:00:00 |
北海道 |
北海道新聞 |
岩の斜面、純白に染めて テシオコザクラ満開 幌延の北大研究林で |
https://www.hokkaido-np.co.jp/article/549718/
|
宗谷管内 |
2021-05-30 19:09:00 |
北海道 |
北海道新聞 |
ジャマイカ戦へ軽めの練習 日本代表、伊東は別調整 |
https://www.hokkaido-np.co.jp/article/549716/
|
千葉市内 |
2021-05-30 19:04:00 |
北海道 |
北海道新聞 |
女性2人死亡、飛び降りか 東京・八重洲 |
https://www.hokkaido-np.co.jp/article/549702/
|
東京都中央区八重洲 |
2021-05-30 19:02:04 |
コメント
コメントを投稿