投稿時間:2021-10-05 05:20:00 RSSフィード2021-10-05 05:00 分まとめ(20件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
海外TECH Ars Technica FCC plans to rein in “gateway” carriers that bring foreign robocalls to US https://arstechnica.com/?p=1800615 companies 2021-10-04 19:18:59
海外TECH Ars Technica Scientists are still learning cool new things about gooey hagfish slime https://arstechnica.com/?p=1800292 cells 2021-10-04 19:07:50
海外TECH DEV Community Build a web traffic monitor with Django and IPStack https://dev.to/paulwababu/build-a-web-traffic-monitor-with-django-and-ipstack-3n2g Build a web traffic monitor with Django and IPStackIn today s online world it is important to know where your website traffic comes from in order to help website owners understand their visitors better In this tutorial we build a very basic traffic monitor the traffic monitor will display details about visitors on the website For every visitor there will multiple columns such as time of visit continent country and city Getting started with IPStack APIIPStack offers a powerful real time IP to geolocation API capable of looking up accurate location data and assessing security threats originating from risky IP addresses Results are delivered within milliseconds in JSON or XML format Using the ipstack API you will be able to locate website visitors at first glance and adjust your user experience and application accordingly The documentation outlines in detail the API features available options and integration guides in different programming languages Get a free API access key to proceed using this API Sample API ResponseIPStack API responses come with comprehensive location related data currency related data timezone related data connection related data and security related data Have a look at the example below Please note For illustration purposes we have included both Hostname Lookup and the Security Module in the above API response Please refer to the sections Hostname Lookup and Security Module for details ip hostname type ipv continent code NA continent name North America country code US country name United States region code CA region name California city Los Angeles zip latitude longitude location geoname id capital Washington D C languages code en name English native English country flag country flag emoji country flag emoji unicode U FFA U FF calling code is eu false time zone id America Los Angeles current time T gmt offset code PDT is daylight saving true currency code USD name US Dollar plural US dollars symbol symbol native connection asn isp Los Angeles Department of Water amp Power security is proxy false proxy type null is crawler false crawler name null crawler type null is tor false threat level low threat types null PrerequisitesFollowing Python best practices we will create a virtual environment for our project and install the required packages First create the project directory mkdir djangoapp cd djangoappNow create a virtual environment and install the required packages For macOS and Unix systems python m venv myenv source myenv bin activate myenv pip install django requests cloudinaryFor Windows python m venv myenv myenv Scripts activate myenv pip install django requests Setting Up Your Django ApplicationFirst navigate to the directory djangoapp we created and establish a Django project myenv django admin startproject mainappThis will auto generate some files for your project skeleton mainapp manage py mainapp init py settings py urls py asgi py wsgi pyNow navigate to the directory you just created make sure you are in the same directory as manage py and create your app directory myenv python manage py startapp monitorThis will create the following monitor init py admin py apps py migrations init py models py tests py views pyOn the mainapp settings py file look for the following line and add the app we just created above INSTALLED APPS django contrib admin django contrib auth django contrib contenttypes django contrib sessions django contrib messages django contrib staticfiles monitor new line Ensure you are in the monitor directory then create a new directory called templates and a new file called urls py Your directory structure of monitor application should look like thismonitor init py admin py apps py migrations templates init py models py tests py urls py views pyEnsure your mainapp urls py file add our monitor app URL to include the URLs we shall create next on the monitor app from django contrib import adminfrom django urls import path includeurlpatterns path admin admin site urls path include monitor urls monitor app url Now on the monitor urls py file add our website there from django urls import path includefrom import viewsurlpatterns path views home name home path monitor views monitor name monitor system monitor view to be created next Create our database models which we shall use to store our website visitors information On the monitor models py file from django db import models Create your models here class Monitor models Model continent models CharField max length blank True null True country models CharField max length blank True null True city models CharField max length blank True null True capital models CharField max length blank True null True datetime models DateField max length blank True null True ip models CharField max length blank True null True def str self return self ipNow on the monitor views py file add the lines below from django shortcuts import render redirectimport requestsimport timeimport psutilimport osfrom datetime import datetimefrom models import Monitorfrom urllib parse import urlparseimport cloudinary uploaderfrom django core paginator import Paginator traffic monitordef traffic monitor request dataSaved Monitor objects all order by datetime Getting loadover minutes load load load psutil getloadavg cpu usage int load os cpu count ram usage int psutil virtual memory p Paginator dataSaved shows number of items in page totalSiteVisits p count find unique page viewers amp Duration pageNum request GET get page page p page pageNum unique page viewers a Monitor objects order by values ip distinct pp Paginator a shows number of items in page unique pp count update time now datetime now data now now unique unique totalSiteVisits totalSiteVisits cpu usage cpu usage ram usage ram usage dataSaved page return render request traffic monitor html data home pagedef home request x forwarded for request META get HTTP X FORWARDED FOR if x forwarded for ip x forwarded for split else ip request META get REMOTE ADDR response requests get ip access key GETYOURACCESSKEY change from HTTP to HTTPS on the IPSTACK API if you have a premium account rawData response json print rawData print this out to look at the response continent rawData continent name country rawData country name capital rawData city city rawData location capital now datetime now datetimenow now strftime Y m d H M S saveNow Monitor continent continent country country capital capital city city datetime datetimenow ip ip saveNow save return render request home html In the code above on the home view the code starts by getting the users IP address On getting the visitors IP we then make a request to IPStack with the IP address above appended to the request and store the results to the database If you wish to collect more information just add them on the models and add the variable like so above with the respective data you are collecting eg country For the traffic monitor view the code starts buy getting all data on the Monitor table and renders the data on the HTML page which we shall create below The code also collects the cpu and ram usage of the system Let us now proceed to rendering the data above on our webpage On the monitor templates folder create traffic monitor html and home html web page and add the lines below monitor templates traffic monitor html file lt doctype html gt lt html lang en gt lt head gt lt meta charset utf gt lt meta name viewport content width device width initial scale shrink to fit no gt lt meta name description content gt lt meta name author content gt lt title gt ALienx amp Connections lt title gt lt link rel canonical href gt lt link rel stylesheet href gt lt Bootstrap core CSS gt lt link href rel stylesheet gt lt Custom styles for this template gt lt link href rel stylesheet gt lt head gt lt body gt lt header gt lt div class collapse bg dark id navbarHeader gt lt div class container gt lt div class row gt lt div class col sm col md py gt lt h class text white gt About lt h gt lt p class text muted gt Add some information about the album below the author or any other background context Make it a few sentences long so folks can pick up some informative tidbits Then link them off to some social networking sites or contact information lt p gt lt div gt lt div class col sm offset md py gt lt h class text white gt Contact lt h gt lt ul class list unstyled gt lt li gt lt a href class text white gt Follow on Twitter lt a gt lt li gt lt li gt lt a href class text white gt Like on Facebook lt a gt lt li gt lt li gt lt a href class text white gt Email me lt a gt lt li gt lt ul gt lt div gt lt div gt lt div gt lt div gt lt div class navbar gt lt div class container d flex justify content between gt lt a href class navbar brand d flex align items center gt lt i class fa fa desktop aria hidden true gt lt i gt lt strong gt Site Visitors lt strong gt lt a gt lt button class navbar toggler type button data toggle collapse data target navbarHeader aria controls navbarHeader aria expanded false aria label Toggle navigation gt lt span class navbar toggler icon gt lt span gt lt button gt lt div gt lt div gt lt header gt lt main role main gt lt section class jumbotron text center gt lt div class container gt lt h class jumbotron heading gt lt i class fa fa desktop aria hidden true gt lt i gt Site Visitors and Resources Monitor lt h gt lt p class lead text muted gt Contact lt a href gt developer lt a gt if CPU amp RAM USAGE exceeds lt p gt lt div gt lt section gt lt div class album py bg light gt lt div class content wrapper gt lt div class container fluid gt lt ol class breadcrumb gt lt li class breadcrumb item gt lt a href gt Dashboard lt a gt lt li gt lt li class breadcrumb item active gt Site Traffic amp Resources Monitor lt li gt lt ol gt lt br gt lt Icon Cards gt lt div class container gt lt div class row gt lt div class col sm block gt lt div class circle a gt lt p gt lt b gt CPU Usage lt b gt lt br gt lt b gt cpu usage lt b gt lt p gt lt div gt lt div gt lt div class col sm block gt lt div class circle b gt lt p gt lt b gt RAM Usage lt b gt lt br gt lt b gt ram usage lt b gt lt p gt lt div gt lt div gt lt div class col sm block gt lt div class circle c gt lt p gt lt b gt Total Site Visits lt b gt lt br gt totalSiteVisits lt p gt lt div gt lt div gt lt div class col sm block gt lt div class circle d gt lt p gt lt b gt Unique Page Views lt b gt lt br gt unique lt p gt lt div gt lt div gt lt div gt lt div gt lt style gt block bottom px text align center vertical align middle circle font size px background white border radius px color white height px font weight bolder width px display table margin px auto circle p vertical align middle display table cell a background color cdc b background color darkorange c background color cdfd d background color fce g background color greenyellow f background color fuchsia lt style gt lt Example contextTables Card gt lt div class card mb gt lt div class card header gt lt b style color c gt lt i class fa fa table gt lt i gt User Sessions lt b gt lt div gt lt div class card body gt lt div class table responsive gt lt table class table table bordered id contextTable width cellspacing gt lt thead gt lt tr gt lt th gt Time lt th gt lt th gt IP Address lt th gt lt th gt Continent lt th gt lt th gt Country lt th gt lt th gt City lt th gt lt tr gt lt thead gt lt tfoot gt lt tr gt lt th gt Time lt th gt lt th gt IP Address lt th gt lt th gt Continent lt th gt lt th gt Country lt th gt lt th gt City lt th gt lt tr gt lt tfoot gt lt tbody id customer table gt for data in dataSaved object list lt tr gt lt td gt data datetime lt td gt lt td gt data ip lt td gt lt td gt data continent lt td gt lt td gt data country lt td gt lt td gt data city lt td gt lt tr gt endfor lt tbody gt lt table gt lt div gt lt br gt lt nav aria label gt if dataSaved has other pages lt ul class pagination justify content center gt if dataSaved has previous lt li class page item gt lt a class page link href page dataSaved previous page number tabindex gt Previous lt a gt lt li gt endif for i in dataSaved paginator page range if dataSaved number i lt li class page item active gt lt a class page link href gt i lt span class sr only gt current lt span gt lt a gt lt li gt endif endfor lt li class page item gt if dataSaved has next lt a class page link href page dataSaved next page number gt Next lt a gt endif lt li gt lt ul gt endif lt nav gt lt div gt lt div class card footer small text muted gt Updated at lt span id session update time gt now lt span gt lt div gt lt div gt lt div gt lt div gt lt main gt lt footer class text muted gt lt div class container gt lt p class float right gt lt a href gt Back to top lt a gt lt p gt lt p gt Need help lt a href gt Contact site developer lt a gt or the lt a href gt site admin lt a gt lt p gt lt div gt lt footer gt lt Bootstrap core JavaScript gt lt Placed at the end of the document so the pages load faster gt lt script src integrity sha KJoDKtIkvYIKUENzmMKCkRr rE QpgaAZGJwFDMVNA GpGFFhXpGKkN crossorigin anonymous gt lt script gt lt script gt window jQuery document write lt script src assets js vendor jquery slim min js gt lt script gt lt script gt lt script src gt lt script gt lt script src gt lt script gt lt script src gt lt script gt lt body gt lt html gt On the monitor templates home html file lt doctype html gt lt html lang en gt lt head gt lt Required meta tags gt lt meta charset utf gt lt meta name viewport content width device width initial scale gt lt Bootstrap CSS gt lt link href dist css bootstrap min css rel stylesheet integrity sha EVSTQN azprGAnmQDgpJLImNaoYzztcQTwFspdyDVohhpuuCOmLASjC crossorigin anonymous gt lt title gt Hello world lt title gt lt head gt lt body gt lt h gt Hello world lt h gt lt Optional JavaScript choose one of the two gt lt Option Bootstrap Bundle with Popper gt lt script src dist js bootstrap bundle min js integrity sha MrcWZMFYlzcLANl NtUVFsAMsXsPUyJoMpYLEuNSfAP JcXn tWtIaxVXM crossorigin anonymous gt lt script gt lt Option Separate Popper and Bootstrap JS gt lt lt script src popperjs core dist umd popper min js integrity sha IQsoLXlPILFhosVNubqLCQbDXgDAi tQZjiwWAwPtgFTxbJNTGNRp crossorigin anonymous gt lt script gt lt script src dist js bootstrap min js integrity sha cVKIPhGWiCAlu LWgxfKTRIcfuJTxR EQDz bgldoEylHzUFQKbrJEcQF crossorigin anonymous gt lt script gt gt lt body gt lt html gt Testing if it Works Migrate then run the server by running the commands below then navigating to the respective port myenv python manage py makemigrations myenv python manage py migrate myenv python manage py runserverBelow is a snapshot of my implementation Thanks for reading I hope you enjoyed this blog as much as i did incase of any question feel free to ask on the comment section below Note you can play with this data as you like like adding a date range filter to show visitors by date or showing the visitors by country 2021-10-04 19:54:37
海外TECH DEV Community How to play a video with VideoPlayer in SwiftUI https://dev.to/toni777772/how-to-play-a-video-with-videoplayer-in-swiftui-o0c How to play a video with VideoPlayer in SwiftUIVideoPlayer is a view that displays content from a player and a native user interface to control playback Available iOS macOS Mac Catalyst tvOS watchOS Xcode How to use the VideoPlayer view Go to the code below import AVKit import SwiftUIstruct ContentView View let videoUrl URL fileURLWithPath Bundle main path forResource PexelsSea ofType mp var body some View VideoPlayer player AVPlayer url videoUrl frame height The first step is to import the AVKit framework The second step is create video URL The URL can be created for local video or remote In our code case a URL was created for local video from the bundle Final step is to pass AVPlayer as the first parameter to VideoPlayer view The VideoPlayer view has playback controls Result Video Overlay Watermark A VideoPlayer has another init function with two parameters init player AVPlayer ViewBuilder videoOverlay gt VideoOverlay First parameter is AVPlayer Second parameter is videoOverlay closure The closure returns a VideoOverlay view to present over the player s video content second parameter The important thing is this overlay view is fully interactive but is placed below the system provided playback controls and only receives unhandled events Let s go to the code As an example will add a simple text in the lower right corner import AVKit import SwiftUIstruct ContentView View let videoUrl URL fileURLWithPath Bundle main path forResource PexelsSea ofType mp var body some View VideoPlayer player AVPlayer url url videoOverlay VStack Spacer HStack Spacer Text Code sample by ToniDevBlog foregroundColor white padding frame height Result Full source code available on GitHubArticle originally published at ToniDevBlogThanks for reading See you soon 2021-10-04 19:27:22
Apple AppleInsider - Frontpage News How to see if your Apple Watch is backed up https://appleinsider.com/articles/21/10/04/how-to-see-if-your-apple-watch-is-backed-up?utm_medium=rss How to see if your Apple Watch is backed upYou need an iCloud backup of your Apple Watch data when you move to a new iPhone and the process is usually simple ーbut there s a catch Here s how to know for sure you ve got a backup Some day these will really be two entirely separate devicesLearn from us Before you even take your new iPhone out of the box unpair your Apple Watch from your old one Read more 2021-10-04 19:38:20
Apple AppleInsider - Frontpage News Apple's Lisa Jackson & Deirdre O'Brien in Fortune's 'Most Powerful Women' list https://appleinsider.com/articles/21/10/04/apples-lisa-jackson-deirdre-obrien-in-fortunes-most-powerful-women-list?utm_medium=rss Apple x s Lisa Jackson amp Deirdre O x Brien in Fortune x s x Most Powerful Women x listFortune has released its list of the most powerful women for with two Apple execs Deirdre O Brien and Lisa Jackson earning a place on the list Every year since Fortune has released a list of what it considers to be the most powerful women of the year The list often comprises women leaders in business philanthropy government education and the arts Two of Apple s executives have earned a spot in the top for s Most Powerful Women list Apple s SVP of Retail and People Deirdre O Brien secures the th spot O Brien joined Apple in but did not take over her current position until April Read more 2021-10-04 19:29:24
Apple AppleInsider - Frontpage News Five-year breach gave hackers access to billions of text messages https://appleinsider.com/articles/21/10/04/five-year-breach-gave-hackers-access-to-billions-of-text-messages?utm_medium=rss Five year breach gave hackers access to billions of text messagesA company that handles text messaging and general telecommunications infrastructure for carriers around the world has confirmed it has been hacked with introducers potentially gaining access to some sensitive customer information for years Disclosed in an SEC filing on September Syniverse advises an individual or organization gained unauthorized access to databases within its network and that its systems accessed by customers had been compromised As Syniverse provides a communications backend and each of those customers could be a carrier in their own right this could involve a breach affecting hundreds of millions of people if not billions Syniverse declined to disclose the scale of the breach to Motherboard nor the kind of data was affected by it Read more 2021-10-04 19:23:07
海外科学 NYT > Science How Old is the Maltese Dog Breed? https://www.nytimes.com/2021/10/04/science/dogs-DNA-breeds-maltese.html different 2021-10-04 19:15:28
海外科学 NYT > Science Nobel Prize in Medicine Awarded to David Julius and Ardem Patapoutian https://www.nytimes.com/2021/10/04/health/nobel-prize-medicine-physiology-temperature-touch.html Nobel Prize in Medicine Awarded to David Julius and Ardem PatapoutianDavid Julius and Ardem Patapoutian were honored for their discoveries about how heat cold and touch can initiate signals in the nervous system 2021-10-04 19:49:49
ニュース BBC News - Home Facebook, Whatsapp and Instagram suffer outage https://www.bbc.co.uk/news/technology-58793174?at_medium=RSS&at_campaign=KARANGA facebook 2021-10-04 19:00:50
ビジネス ダイヤモンド・オンライン - 新着記事 NEC・富士通に迫る「次のリストラ」、大手ITベンダー“再編&淘汰後”の未来図 - 不要?生き残る? ITベンダー&人材 大淘汰 https://diamond.jp/articles/-/283449 淘汰 2021-10-05 04:55:00
ビジネス ダイヤモンド・オンライン - 新着記事 将棋の現役最強棋士「3つのAI活用法」、AIの最善の一手に“なぜ?”と問え【入山章栄×渡辺明・動画】 - 入山章栄×超一流対談 https://diamond.jp/articles/-/283558 入山章栄 2021-10-05 04:45:00
ビジネス ダイヤモンド・オンライン - 新着記事 キーエンス・ファナックよりもコロナ前比の増収率で勝る「ある企業」とは? - ダイヤモンド 決算報 https://diamond.jp/articles/-/283824 2021-10-05 04:40:00
ビジネス ダイヤモンド・オンライン - 新着記事 岸田新政権は日銀に何を求める?日銀ウォッチャーによる「3大予想」 - 金融市場異論百出 https://diamond.jp/articles/-/283675 岸田文雄 2021-10-05 04:35:00
ビジネス ダイヤモンド・オンライン - 新着記事 JAL出資の国際線LCC、スタートは貨物便でも「あなどれない」理由 - コロナ後のエアライン https://diamond.jp/articles/-/283545 zipair 2021-10-05 04:30:00
ビジネス ダイヤモンド・オンライン - 新着記事 【広島大学附属高校】華麗なる卒業生人脈!「令和」の名付け親、財界四天王、有名女子アナ… - 日本を動かす名門高校人脈 https://diamond.jp/articles/-/280610 名付け親 2021-10-05 04:20:00
ビジネス ダイヤモンド・オンライン - 新着記事 「今の歴史的円安はいずれ修正される」との為替予想が危険な理由 - 政策・マーケットラボ https://diamond.jp/articles/-/283822 外国為替市場 2021-10-05 04:15:00
ビジネス ダイヤモンド・オンライン - 新着記事 ためるお金がないと嘆く人が知るべき4つの「貯蓄資金の見つけ方」 - News&Analysis https://diamond.jp/articles/-/283821 newsampampanalysis 2021-10-05 04:10:00
ビジネス ダイヤモンド・オンライン - 新着記事 CAが青ざめた痛恨のミスにファーストクラスの社長が見せた「一流の懐の深さ」 - ファーストクラスに乗る人の共通点 https://diamond.jp/articles/-/283352 2021-10-05 04:05:00
ビジネス 東洋経済オンライン 人気でも激減、最新「駅弁」販売駅数ランキング 時刻表で判明、販売する駅は毎年減少が続く | 旅・趣味 | 東洋経済オンライン https://toyokeizai.net/articles/-/457982?utm_source=rss&utm_medium=http&utm_campaign=link_back 東洋経済オンライン 2021-10-05 04:30:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)