python |
Pythonタグが付けられた新着投稿 - Qiita |
Raspberry Pi でタッチパネル用の画面を表示して簡単に操作できるようにする |
https://qiita.com/yukataoka/items/2fce7f61b05b117d0c37
|
今回はタッチパネルで操作できる簡単な表示画面をPythonで開発するため、Tkinterをインストールします。 |
2021-06-28 01:56:24 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Rのnnetのコードの使い方が分からない。 |
https://teratail.com/questions/346482?rss=all
|
Rのnnetのコードの使い方が分からない。 |
2021-06-28 01:47:28 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Rubyのディレクトリの作成方法 |
https://teratail.com/questions/346481?rss=all
|
Rubyのディレクトリの作成方法プログラム本体と、テストコードを分離して管理したいので、ディレクトリを作成したいのですが、作成方法がわかりません。 |
2021-06-28 01:34:35 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
PowerShellで作成したクラスを修正しても反映されない |
https://teratail.com/questions/346480?rss=all
|
PowerShellで作成したクラスを修正しても反映されないPowerShellにて自作サイトのWebAPIを実行して、値の取得や更新を行えるようにしたいと考えています。 |
2021-06-28 01:26:27 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Pixel Perfect CameraのUpscale Render Textureがライティングに影響しない。 |
https://teratail.com/questions/346479?rss=all
|
PixelPerfectCameraのUpscaleRenderTextureがライティングに影響しない。 |
2021-06-28 01:23:15 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
エラー 解決法 Missing right curly bracket "}" |
https://teratail.com/questions/346478?rss=all
|
エラー解決法Missingrightcurlybracketquotquot前提・実現したいことprocessingで以下のようなコードを打ち込んだんですが、エラーが出ます。 |
2021-06-28 01:11:21 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
justify-content: space-between と widthの関係性について |
https://teratail.com/questions/346477?rss=all
|
justifycontentspacebetweenとwidthの関係性についてdisplayflexnbspをした後justifynbspcontentnbspspacenbspbetweennbspを行ったのですがcssが適用されないのでwidthを入力したところcssが適用されました。 |
2021-06-28 01:10:23 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
AWSにてLaravelで開発中で、PHPコマンドをどこで打つか分からない状態です |
https://teratail.com/questions/346476?rss=all
|
AWSにてLaravelで開発中で、PHPコマンドをどこで打つか分からない状態です初心者ですが、悪戦苦闘しながら開発しておりますサーバーAmazonnbspWebnbspService言語PHPフレームワークLaravel根本的なことを理解できてないんだと思うのですが、サーバ側でのPHPコマンドの打ち方がわかりません。 |
2021-06-28 01:00:51 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
[Ruby]メソッドが定義されているクラスを調べる方法 |
https://qiita.com/Jackson123/items/f203304bf3469396c354
|
Rubyメソッドが定義されているクラスを調べる方法環境Ruby本題Rubyではメソッドはクラスまたはモジュール内に定義されています。 |
2021-06-28 01:49:35 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
とりあえずgolang+nginx+mysql+docker-composeの環境構築 |
https://qiita.com/greenteabiscuit/items/ef4ed1dfda0d396d9d0f
|
もっと新しくしたほうがいいのでしょうか、、FROMnginxalpineADDnginxconfetcnginxconfddefaultconfこちらhttpgoとしているのは、dockercomposeにてserviceの名前がgoとなっているからです。 |
2021-06-28 02:00:07 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
DjangoでDatabase is uninitialized and superuser password is not specified.となった |
https://qiita.com/koshi1971/items/0ddc4e3c0650ad89268c
|
DjangoでDatabaseisuninitializedandsuperuserpasswordisnotspecifiedとなった環境wsldockerdockercomposepostgresqldjangoエラーメッセージDatabaseisuninitializedandsuperuserpasswordisnotspecifieddbYoumustspecifyPOSTGRESPASSWORDtoanonemptyvalueforthedbsuperuserForexampleePOSTGRESPASSWORDpasswordondockerrundbdbYoumayalsousePOSTGRESHOSTAUTHMETHODtrusttoallowalldbconnectionswithoutapasswordThisisnotrecommendedPOSTGRESHOSTAUTHMETHODという環境変数をtrustとすれば一応できるみたいなので解決法dockercomposeymlをdbimagepostgresenvironmentPOSTGRESHOSTAUTHMETHODtrustのようにしました。 |
2021-06-28 01:40:36 |
golang |
Goタグが付けられた新着投稿 - Qiita |
とりあえずgolang+nginx+mysql+docker-composeの環境構築 |
https://qiita.com/greenteabiscuit/items/ef4ed1dfda0d396d9d0f
|
もっと新しくしたほうがいいのでしょうか、、FROMnginxalpineADDnginxconfetcnginxconfddefaultconfこちらhttpgoとしているのは、dockercomposeにてserviceの名前がgoとなっているからです。 |
2021-06-28 02:00:07 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
RailsとMySQL5.7を使ったアプリでDISTINCTで重複を削除した後にORDERクエリ使ったところエラーが発生した |
https://qiita.com/Sato37/items/236676afe01070ade9a3
|
RailsとMySQLを使ったアプリでDISTINCTで重複を削除した後にORDERクエリ使ったところエラーが発生したきっかけSNS的なWebアプリを作成しており、投稿一覧ページで最新の投稿を一番上に表示させるために、postテーブルのcreatedatをキーにOrderクエリを実行したところ下記のエラーが発生した。 |
2021-06-28 01:54:42 |
海外TECH |
DEV Community |
Chrome Extensions 101 |
https://dev.to/venkyakshaya/chrome-extensions-101-3dif
|
Chrome Extensions This blog will discuss how to setup build and run your own Chrome extension At the end you will be able to create a simple Day Count Down extension that will display the number of days left to a particular date Lets go Chrome Extension Terminologies manifest jsonJSON file that tells Chrome what the extension does what permissions it needs and the files it will use Background scriptA script that runs independent of and parallel to the web page the user is on It is used for state management and always has only one active instance Content scriptA script that runs in the context of the web page that the user is on It can access read and or modify the DOM of the page that the user visits SetupCreate a folder for your extension say Count Down and in it a file called manifest json In the file add the manifest version name of the extension a description and the version of the extension to begin with The file should now look similar to this manifest version name Count Down Days version description Takes a date input and displays the number of days left until the given date Files and Folder structureNow we go about creating the rest of the elements A file called background js in the root folder This will be our background script A folder called content in the root folder which will hold a HTML file called popup html This file will contain the markup for the extension s dropdown menu a JS file called popup js This is our content script a CSS file called popup css to style the elements in our dropdownA folder for images extension icon and others optional Link the files to the manifest jsonWe will be referencing the background script and the HTML file in the manifest json as follows background service worker background js action default popup content popup html default icon images icon png optional images icon png optional images icon png optional The icon is initially set by the default icon key in the action entry in the manifest json file This key takes a dictionary that contains size to image paths If the icon is not given Chrome automatically assigns an icon The manifest json should now look like this manifest version name Count Down Days version description Takes a date input and displays the day count left to the given date background service worker background js action default popup content popup html default icon images timer png images timer png images timer png images timer png Running the ExtensionOpen the Chrome browser and hit the following URL chrome extensionsIn the top right corner you should see a toggle button titled Developer mode Check the toggle Now you should see a set of options to load pack and update extension Select the Load unpacked option From the file system now select the root folder of the extension The extension will have loaded in the browser Giving permissions to the ExtensionFor this extension we will be using the following permissions activeTab gives access to the currently active Chrome tab In our case we need this permission as we are adding to the current active tab scripting allows running scripts in the context of the current web page We use this permission to inject listener events that perform the date operations storage allows the storage of objects in Chrome We will use this permission to store a date string in Chrome storage Add the following line in the manifest json permissions activeTab storage scripting Adding the logicOpen the background js and add the following code let date chrome runtime onInstalled addListener gt chrome storage sync set date console log Default Date set to Aug chrome runtime is an API that lets the extension retrieve the background page listen and respond to events What we are essentially doing here is using the API to save a default date String in the Chrome storage This value can be accessed by our content script later We have also added a log statement which we will use for testing In the popup html we add two buttons one for displaying number of days left and the other to accept a new Date We refer our styles popup css and content script popup js in this file as follows lt DOCTYPE html gt lt html gt lt head gt lt link rel stylesheet href popup css gt lt head gt lt body gt lt div class buttons gt lt button id showDays gt lt img class img icon src images timer png alt Sand Clock gt lt button gt lt button id changeDate gt lt img class img icon src images change date png alt Change Date Icon gt lt button gt lt div gt lt script src popup js gt lt script gt lt body gt lt html gt I have used image icons for the buttons Assets are available in the Github link below Let s add some basic styles in the popup css as follows button height px width px outline none margin px border none border radius px button img width height auto These styles cannot be accessed by the current page Once this is saved we go back to the browser in the chrome extensions tab we find our extension Each extension tile will have a refresh icon at the bottom right corner Refresh the extension and hit the service worker hyperlink to view the logs of our service worker i e background js In this console we will now be able to see our Default date log Next step is to view the extension s dropdown Open out a different tab in the top right corner of Chrome the new extension will now be a clickable option On click of the same we will be able to see the dropdown menu as follows Note The Chrome extension CANNOT be opened on chrome URL The buttons will not do anything yet so let s add the listeners that will perform the magic In the popup js add the following two functions Content script followsfunction showDaysLeft get the date string from Chrome storage chrome storage sync get date date gt create a new div that will be appended to the body let daysElement document createElement div adding styles to the new div daysElement style cssText position absolute color black top px left transform translateX background color pink z index padding rem border radius px box shadow px px px Date parse converts Date string to milliseconds To get the number of days left we get the difference in milliseconds and divide by milliseconds in a day noOfDaysLeft parseInt Date parse new Date date Date parse new Date let content if noOfDaysLeft lt content document createTextNode Deadline has already passed Please set a new one D alert daysElement else content document createTextNode noOfDaysLeft days until go time B Append the text node to the div daysElement appendChild content Append the div to the body tag document body appendChild daysElement setTimeout gt document body removeChild daysElement function resetDate let newDate let daysElement document createElement div daysElement style cssText position absolute color black top px left transform translateX background color pink z index padding rem border radius px box shadow px px px Get the date string input through window prompt newDate window prompt Enter date in the dd mm yyyy format dateArray newDate split dateString dateArray dateArray dateArray newDate Date parse new Date dateString let content Check if the format is right if newDate noOfDaysLeft parseInt Date parse new Date newDate Date parse new Date if noOfDaysLeft lt content document createTextNode Are you time travelling to the past I am not ready for you yet D else content document createTextNode New date saved n noOfDaysLeft days until go time B save the new date chrome storage sync set date newDate else content document createTextNode Enter a valid date date month full year daysElement appendChild content document body appendChild daysElement setTimeout gt document body removeChild daysElement The function logic is explained in the comments Now we cannot directly attach the listeners to the buttons We make use of the chrome scripting API to inject the listeners into the current page as follows Initialize buttonslet showDays document getElementById showDays let changeDate document getElementById changeDate When the button is clicked inject showDaysLeft and resetDate into current pageshowDays addEventListener click async gt let tab await chrome tabs query active true currentWindow true chrome scripting executeScript target tabId tab id function showDaysLeft changeDate addEventListener click async gt let tab await chrome tabs query active true currentWindow true chrome scripting executeScript target tabId tab id function resetDate Note Apart from the injected listeners other functions variables cannot be directly run And we are done Now the extension is ready to be tested Go back to the browser refresh the extension and test the extension on a fresh tab The output should be similar to the gif below Hope this was helpful The complete project is available on Github Please reach me on Twitter in case of questions or let me know in the comments below ️ |
2021-06-27 16:47:16 |
海外TECH |
DEV Community |
Introduction to Next.JS |
https://dev.to/ponikar/introduction-to-next-js-26c0
|
Introduction to Next JSHello there I hope you are doing well So today we are going to talk about the Next JS Why Developers suddenly started to use Next JS to make web apps and not Create React App Don t worry today we are going to tackle all your doubts about Next JS For those who are thinking Ahh Again new framework new Syntax Let me clear Next JS use React Library under the hood So Why Next JS over CRA Create React App Before we get started with Next JS Let s understand what kinda issues developers are facing while working with Create React App Reason SEO First Web AppWe all know that SEO Search Engine Optimization is one of the core feature of the website and If you are not aware the fact that the CRA apps is not suitable for SEO friendly website Why We all know that React is a JavaScript library which means that every single thing happens at Client Side So unless user is going not going to open the website there will be only the empty HTML page with div tag like this lt div id app gt lt div gt Google Search Engine Bots will dig into your website They will get nothing but the empty index html page Although they are claiming they can run JS on while digging the page but this is not true Reason Bundling The AppImagine you are working with massive large scale application hundreds of line of JavaScript code into a single file to will causes performance to avoid this you need manually splitting your bundling into different files Reason Performance issueIf some users are trying to open your website in low end devices there might be cases that the website will take time to load in that devices Because Traditional react app loads everything at Client Side and not server side Next JS Production Ready FrameworkNext JS is a Production Ready framework Which support Server Side Rendering SSR along with Hybrid Rendering Page RoutingNext JS has inbuilt routing system which allows us to create page without integrating any library like react router dom You can also create nested routing Which is tie breaker This is not enough Next JS bundle your project pages wise So if you are having different pages Next JS automatically does code splitting for us You can read more about routing in Documentation For those people who aren t aware of this term Server Side Rendering means you can run your JavaScript files at server side and delivered your HTML content directly to the browser like the Server side languages like PHP Now you probably going to wonder will my React app work as same as it used to Yeah This process call Hydration This will make sure that your JavaScript files are loaded successfully in the browser along with the HTML contents So you can make SEO friendly website easily So this was about SSR but Next js allows you to pick how we want to fetch data If you have used Gastby before You know that you can make Static Website with React Next JS provide Hybrid Rendering Data Fetching in Next JSWe can fetch data in ways in Next JS Instead of going in the theory I will show directly How to fetch data in Next JS Server Side Rendering SSR export const getServerSideProps async context gt const cakes await myFavoriteCakesAPI return props cakes You can export getServerSideProps method in each page This method runs on Every request and users will always get fresh data Below we are returning props cakes This will pass props as a default Component of Page As I said earlier this method runs on every single request So this can be a little anti performance method But there is situation in which the data gets updated often like Score Board Stock Market etc Static Site Generation SSG export const getStaticProps async context gt const journals await myLastYearJournals return props journals This method runs only at build time But in development environment this method will run on every single request Since This method runs only build time in Production environment Your web application can speedily deliver content to the users You can also deliver the website over CDN and that s the cool thing about Next JS Everything will be fast Since the method runs at only build time even though the data gets updated users will have the old cached data Incremental Static Site Generation ISSG export const getStaticProps async context gt const journals await myLastYearJournals return props journals revalidate This method is my favourite method this method is same as the above method getStaticProps The only difference is that we are now pass new property revalidate Which means you request will re validate after the given amount of second in this case it is This is one the suitable way to fetch data This will make sure that you website will deliver fast and users will also get updated data If you have understand this data fetching methodology You are now ready to make SEO friendly and fast website But I have bonus for you Image Optimization with Next jsYou can also optimize images in Next JS We all know that Image loading can take a while Especially if you are loading high quality images Which can take long time Next Js provides Image components which allow us to lazy load images Optimize images quality according to the Layout So this way we can also optimize the performance of the website FeatureChanges Quality of ImagesPlaceholder blur image while loading the actual ImagePrioritize Image Loading and many more Integration of Third Party Scriptimport Script from next script lt Script id stripe js src strategy lazyOnload onLoad gt this setState stripe window Stripe pk test gt In recent of Next js Now we can add on third party script easily with Script Component Also It let you to decide when you want to load the website like Before Interactive after Interactive and lazy loading So that was introduction of Next js Let me know in the comment which part of the blog you like most and also are you planing to use next js in your next project or not If you want to add up something Feel free to comment Wanna get started with Next js Check out the DocumentationThank you for reading Happy Coding |
2021-06-27 16:14:59 |
海外TECH |
DEV Community |
Learn React with this free GitHub book I wrote |
https://dev.to/azure/learn-react-with-this-free-github-book-i-wrote-792
|
Learn React with this free GitHub book I wroteHi all I moved my free React book to GitHubcan also be read hereI hope you benefit from it Chris TwitterIt contains a lot of things likeFormsRoutingLazy loadingTesting with JestTesting Library EE HooksRender propsContext APIAlso check ouut these resources from Microsft LEARN |
2021-06-27 16:06:34 |
海外TECH |
Engadget |
Microsoft signed a driver loaded with rootkit malware |
https://www.engadget.com/microsoft-signed-netfilter-malware-driver-164228266.html?src=rss_b2c
|
impact |
2021-06-27 16:42:28 |
海外科学 |
NYT > Science |
Helping Drug Users Survive, Not Abstain: ‘Harm Reduction’ Gains Federal Support |
https://www.nytimes.com/2021/06/27/health/overdose-harm-reduction-covid.html
|
Helping Drug Users Survive Not Abstain Harm Reduction Gains Federal SupportOverdoses have surged during the pandemic Now for the first time Congress has appropriated funds specifically for programs that distribute clean syringes and other supplies meant to protect users |
2021-06-27 16:28:59 |
ニュース |
BBC News - Home |
Matt Hancock video leak will be investigated - Brandon Lewis |
https://www.bbc.co.uk/news/uk-politics-57628523
|
office |
2021-06-27 16:50:59 |
ニュース |
BBC News - Home |
Florida building collapse: Nine dead as hunt for survivors continues |
https://www.bbc.co.uk/news/world-us-canada-57626978
|
design |
2021-06-27 16:23:35 |
ニュース |
BBC News - Home |
Beaumont & Sciver star as England cruise to one-day win over India |
https://www.bbc.co.uk/sport/cricket/57629552
|
bristol |
2021-06-27 16:30:31 |
ニュース |
BBC News - Home |
Teenager Hodgkinson beats Muir & Reekie to claim Olympic spot |
https://www.bbc.co.uk/sport/athletics/57630226
|
Teenager Hodgkinson beats Muir amp Reekie to claim Olympic spotTeenage sensation Keely Hodgkinson will compete at the Olympics after upsetting Jemma Reekie and Laura Muir in the m at the British trials |
2021-06-27 16:30:06 |
ニュース |
BBC News - Home |
Van der Poel wins stage two of Tour de France |
https://www.bbc.co.uk/sport/cycling/57630542
|
brittany |
2021-06-27 16:54:58 |
ニュース |
BBC News - Home |
Covid-19 in the UK: How many coronavirus cases are there in my area? |
https://www.bbc.co.uk/news/uk-51768274
|
cases |
2021-06-27 16:21:16 |
北海道 |
北海道新聞 |
クマが飼い犬3頭襲う 羅臼の民家、住民が室内から目撃 18、19年にも被害 |
https://www.hokkaido-np.co.jp/article/560482/
|
根室管内 |
2021-06-28 01:01:11 |
北海道 |
北海道新聞 |
道産子男子3人が五輪初代表 陸上200の小池、110障害の金井、走り幅跳びの城山 |
https://www.hokkaido-np.co.jp/article/560395/
|
日本選手権 |
2021-06-28 01:02:52 |
IT |
IT号外 |
コロナウィルスのワクチン摂取について私見を述べようかと思います。covid-19 |
https://figreen.org/it/%e3%82%b3%e3%83%ad%e3%83%8a%e3%82%a6%e3%82%a3%e3%83%ab%e3%82%b9%e3%81%ae%e3%83%af%e3%82%af%e3%83%81%e3%83%b3%e6%91%82%e5%8f%96%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e7%a7%81%e8%a6%8b%e3%82%92%e8%bf%b0/
|
コロナウィルスのワクチン摂取について私見を述べようかと思います。 |
2021-06-27 16:43:04 |
コメント
コメントを投稿