python |
Pythonタグが付けられた新着投稿 - Qiita |
Adafruit_DHTがError accessing GPIOで失敗する場合の対処 |
https://qiita.com/Asyley_/items/db1656b575d9beca1bac
|
|
2021-09-04 23:55:01 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
【rails6】 webpack-dev-serverを起動するとCSSが効かなくなる |
https://teratail.com/questions/357775?rss=all
|
【rails】webpackdevserverを起動するとCSSが効かなくなるwebpackerでcssを読み込ませて、webpackdevserverでホットリロードして開発したいのですが、起動するとCompilednbspsuccessfullyは表示されず下記になります。 |
2021-09-05 00:00:01 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
redisによって生成されるdump.rdbをgitignoreに追加してもgit管理される |
https://teratail.com/questions/357774?rss=all
|
redisによって生成されるdumprdbをgitignoreに追加してもgit管理されるrailsでアプリ開発中です。 |
2021-09-04 23:46:02 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
【PHP】<img>タグでURLの画像が読み込まれない。 |
https://teratail.com/questions/357773?rss=all
|
ですが、上にも書いた通り、右クリックをして「新しいタブで画像を開く」を押すと画像が見れるのはなぜでしょうか。 |
2021-09-04 23:23:04 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
pythonでの回帰分析について |
https://teratail.com/questions/357772?rss=all
|
pythonでの回帰分析について前提・実現したいこと初心者なのですがpythonで積分関数を用いた回帰分析を行いたく、web上に掲載されているコードを参考にいくつか検証してみたのですが、まったく歯が立ちませんでした。 |
2021-09-04 23:20:01 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
PHPの宇宙船演算子についての質問です |
https://teratail.com/questions/357771?rss=all
|
PHPの宇宙船演算子についての質問です前提・実現したいことPHPの宇宙船演算子についての質問です。 |
2021-09-04 23:15:25 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
railsチュートリアル 第4章 titleヘルパー、再び |
https://qiita.com/masatom86650860/items/223ece68168645e282e0
|
モジュールは、関連したメソッドをまとめる方法他のデータ構造Railsアプリケーションを書くために重要となる、いくつかのRubyのデータ構造について説明配列と範囲演算子配列arrayは、特定の順序を持つ要素のリスト配列を理解することは、ハッシュやRailsのデータモデルを理解するための重要な基盤配列gtgtfoobarbazsplit文字列をつの要素を持つ配列に分割するgtfoobarbazsplitgtgtfooxbarxbazsplitxgtfoobarbazゼロオリジンこれは、配列の最初の要素のインデックスがから始まり、番目はと続くことを意味gtgtagtgtgtaRubyでは角カッコで配列にアクセスするgtgtgtagtgtgtagtgtgta配列の添字はマイナスにもなれるgtgtgta配列「a」の内容を確認するgtgtgtafirstgtgtgtasecondgtgtgtalastgtgtgtalastaを使って比較するgttruegtgtxalength配列も文字列と同様lengthメソッドに応答するgtgtgtxgttruegtgtxgtfalsegtgtxgttruegtgtxgtgttruegtgtxltgtfalse様々なメソッドgtgtagtgtgtaemptygtfalsegtgtaincludegttruegtgtasortgtgtgtareversegtgtgtashufflegtgtgtagt破壊的メソッドgtgtagtgtgtasortgtgtgtagt配列に要素追加pushgtgtapushを配列に追加するgtgtgtaltltを配列に追加するgtgtgtaltltfooltltbar配列に連続して追加するgtfoobarjoin繋げるsplit分けるgtgtagtfoobargtgtajoin単純に連結するgtfoobargtgtajoinカンマスペースを使って連結するgtfoobarrange範囲toa配列に変換gtgtgtgtgttoaおっと、に対してtoaを呼んでしまっていますねNoMethodErrorundefinedmethodtoaforFixnumgtgttoa丸カッコを使い、範囲オブジェクトに対してtoaを呼びましょうgtは範囲として有効ですが、上の番目の表記ではメソッドを呼ぶ際にカッコを追加する必要取り出すgtgtawfoobarbazquuxwを使って文字列の配列に変換gtfoobarbazquuxgtgta範囲を指定して取り出すgtfoobarbaz範囲の可変gtgtatoagtgtgtaalength明示的に配列の長さを使って選択gtgtgta添字にを使って選択gtこんなことができるgtgtaetoagtabcde演習文字列を分解し、配列にしろ。 |
2021-09-04 23:30:10 |
技術ブログ |
Developers.IO |
[Material-UI] マウスホバー/クリック時に色が変わるスタイルをmakeStyleで作る |
https://dev.classmethod.jp/articles/make-a-style-that-changes-color-with-mouse-operation-trigger-in-makestyle-of-material-ui/
|
cssin |
2021-09-04 14:40:13 |
海外TECH |
Ars Technica |
The best Labor Day tech deals we can find this weekend |
https://arstechnica.com/?p=1791144
|
games |
2021-09-04 14:14:59 |
海外TECH |
Ars Technica |
How a flight-sim cockpit helps me get away from it all (figuratively) |
https://arstechnica.com/?p=1791282
|
rabbit |
2021-09-04 14:00:50 |
海外TECH |
DEV Community |
How to make a slash commands bot with Discord.js V13 |
https://dev.to/kb24x7/how-to-make-a-slash-commands-bot-with-discord-js-v13-3l6k
|
How to make a slash commands bot with Discord js VSo Discord has implemented a pretty big change in their API starting from early which will make message content a privileged intent and verified bots will have to request that intent additionally So I m here to share how you can migrate your bot to slash commands entirely so that it doesn t stop working Before we get started if you d like to hang out with the community you can join our Discord server here DevHQIf you are here just for the resulting code you can find out the repository here RepositoryLet s get started You have to invite your bot with an updated scope of application commands which is required to register slash commands First things first its always recommended to use yarn since its much better than npm so you can install that using npm g install yarnLet s make a new directory for our bot cd it and initialize it using yarn init yesLet s install Discord js and some other dependencies yarn add discord js discordjs rest discord api types v discordjs buildersTime to create an index js file and import the following stuff const fs require fs const REST require discordjs rest Require the necessary discord js classesconst Client Intents Collection require discord js Create a new client instanceconst client new Client intents Intents FLAGS GUILDS Now we have created a client instance which only uses the Guild intent required to respond for slash commands it is much less memory intensive than processing every single message throughout Discord Now we will create a dynamic command structure for our bot so lets create a directory called commands and add this to the index js file Loading commands from the commands folderconst commandFiles fs readdirSync commands filter file gt file endsWith js Now it s time for tokens pushing tokens into GitHub is very not recommended so we have to use env files to store our tokens safely yarn add dotenvCreate a env file and add your token and your test guild server id here we ll talk about the test server later TOKEN YOUR TOKEN HERETEST GUILD ID YOUR GUILD ID HEREYou can copy the Guild ID like thisCreate a gitignore file and add this to the file envTime to configure it in our index file Loading the token from env fileconst dotenv require dotenv dotenv config const TOKEN process env TOKEN Now that we have finally gotten our token it s time to talk about the Test Guild ID so slash commands in Discord requires us to register it first and we can t register it globally every time in development or we are gonna get rate limited and potentially banned from accessing their API for some time We only need this in development we don t need to do this when we are deploying our bot in production So please don t add the Test Guild ID when you want your commands globally available Now let s add the Guild ID to the index file const TEST GUILD ID process env TEST GUILD ID It s time to register our commands now we will make a condition that will automatically switch between global and development registration depending upon whether the Test Guild ID is available const commands Creating a collection for commands in clientclient commands new Collection for const file of commandFiles const command require commands file commands push command data toJSON client commands set command data name command When the client is ready this only runs onceclient once ready gt console log Ready Registering the commands in the client const CLIENT ID client user id const rest new REST version setToken TOKEN async gt try if TEST GUILD ID await rest put Routes applicationCommands CLIENT ID body commands console log Successfully registered application commands globally else await rest put Routes applicationGuildCommands CLIENT ID TEST GUILD ID body commands console log Successfully registered application commands for development guild catch error if error console error error Now that we have registered our commands in Discord it s time to listen and respond to themclient on interactionCreate async interaction gt if interaction isCommand return const command client commands get interaction commandName if command return try await command execute interaction catch error if error console error error await interaction reply content There was an error while executing this command ephemeral true Finally for our index file we need to log in to our bot Login to Discord with your client s tokenclient login TOKEN We can now move into the commands sub directory and let s make a ping js file with the following code const SlashCommandBuilder require discordjs builders module exports data new SlashCommandBuilder setName ping setDescription Replies with pong async execute interaction interaction reply content Pong We have now successfully created a working ping pong bot in Discord js V Now you can create as many commands as you want for your bot by following the same format as the ping command The code for embeds are same and there are a lot of new features like buttons and select menus which we haven t talked about here If you want to send an embed you just need to do interaction reply embeds embed Hope you like this short tutorial and you can follow me on Twitter here Free Deployment Platforms RailwayQoveryOpeNodeHerokuHope to see you on the next one |
2021-09-04 14:14:17 |
海外TECH |
DEV Community |
How to create Music player with pure HTML, CSS, JS |
https://dev.to/kunaal438/how-to-create-music-player-with-pure-html-css-js-c1j
|
How to create Music player with pure HTML CSS JSHello Today we ll see how we can easily create a music player using HTML CSS and JS only No other library Our music player has modern looking designs with cool animations like play pause animation disk rotating animation and pulse animation Our music player has working forward backward buttons with seek able song slider To see demo or you want full coding tutorial video for better understanding You can watch the tutorial below Video TutorialI appreciate if you can support me by subscribing my youtube channel CodeBefore we start writing our code Although it s not a Nodejs app but we should see its folder structure at least So now let s start designing our music player First of course write basic HTML template inside index html file and link style css app js to it Then make a music player container lt div class music player gt lt div gt margin padding box sizing border box body width height vh display flex justify content center align items center background fa font family roboto sans serif music player width px height px border radius px background rgba box shadow px px rgba padding px overflow hidden color deebb OutputNow make song name artist name lt Inside music player element gt lt h class music name gt song one lt h gt lt p class artist name gt artist lt p gt And of course style them music name artist name text align center text transform capitalize music name font size px font weight margin bottom px artist name font size px here comma is used to give same style to more than one element OutputGreat Now make disk cover image of the song For that we use just a single div and will give background image to set song cover image lt div class disk gt lt div gt Remember all the elements we are adding inside music player container disk position relative display block margin px auto width px height px border radius background image url images cover png background size cover box shadow px rgba here I am using box shadow to create outer circle for the disk OutputBut how we make a hole at the center For that we ll use before pseudo element You can find more about it here disk before content position absolute top left transform translate width px height px border radius background fa OutputHmm It looking great Now make seek bar for the music player of course lt div class song slider gt lt input type range value class seek bar gt lt div gt song slider width position relative seek bar webkit appearance none width height px border radius px background fca overflow hidden cursor pointer seek bar webkit slider thumb webkit appearance none width px height px box shadow px px deebb webkit appearance this is used to hide all the default styles of the element done by browser webkit slider thumb this will select the thumb or head of the slider that we drag OutputMake music current time and duration element now lt div class song slider gt lt input type range value class seek bar gt lt span class current time gt lt span gt lt span class song duration gt lt span gt lt div gt current time song duration font size px song duration position absolute right OutputNow make controls We ll make play button icon with CSS and forward backward button will be the images lt div class controls gt lt button class play btn gt lt span gt lt span gt lt span gt lt span gt lt button gt lt div gt controls width display flex justify content space between align items center margin auto margin top px play btn position relative width px height px border radius background deebb cursor pointer border none play btn span position absolute top left transform translateY width px height px border radius px background fa transition s clip path polygon play btn span nth child left transform origin center If you notice here in the span selector I am setting default clip path this is because I want smooth transition when using clip path for that I need to define a default value as well And the the value of clip path is just a rectangle OutputNow I want to make this pause logo to a play logo For that I ll use an extra class pause play btn pause span nth child transform translateY scaleY play btn pause span nth child width left transform translate border radius clip path polygon When you have some thing like this class class or class id or id class have multiple selector without space This means you are selecting the elements when having both classes ids What we did in the above CSS is when the play icon have pause class we are scaling down its nd span to making it fully disappear And using clip path to make a triangle shape for the first span OutputOutput when toggling the play btn element s pause class from chrome inspector Now make pulse animation and add it to play btn when having pause class play btn pause animation pulse s linear infinite keyframes pulse box shadow box shadow px rgba box shadow px rgba Add pause class to the play btn element as default Great Now make forward backward buttons lt div class controls gt lt button class btn backward btn gt lt img src images pre png alt gt lt button gt lt button class play btn pause gt lt span gt lt span gt lt span gt lt span gt lt button gt lt button class btn forward btn gt lt img src images nxt png alt gt lt button gt lt div gt btn width px height px background deebb border radius display flex justify content center align items center border none cursor pointer OutputNow the last animation we want is disk rotation For that make an animation keyframes rotate transform rotate transform rotate deg But how to give this animation Give this animation as default to disk element But set its animation play state to paused animation play state is used to set animation state In this case we want animation to be paused at start And change the state to running when disk element have class play disk previous styles animation rotate s linear infinite animation play state paused disk play animation play state running We are done with designing the player Now let s make this player function Before writing JS make sure you do these things Make an audio source We of course need an audio source to play the music For that just make an empty audio element at the very start and give it a id so we can access it in JS lt audio src id audio gt lt audio gt And nd thing is make sure you add data js file before app js because our data is in data js but we can only access it in app js if we import it before app js Now we can write JS Initialize a variable to store current music index Set it default value to let currentMusic Now select each and every element that we need to add some behaviour const music document querySelector audio const seekBar document querySelector seek bar const songName document querySelector music name const artistName document querySelector artist name const disk document querySelector disk const currentTime document querySelector current time const musicDuration document querySelector song duration const playBtn document querySelector play btn const forwardBtn document querySelector forward btn const backwardBtn document querySelector backward btn Once you are done selecting all the elements make a function to setup the music setup musicconst setMusic i gt seekBar value set range slide value to let song songs i currentMusic i music src song path songName innerHTML song name artistName innerHTML song artist disk style backgroundImage url song cover currentTime innerHTML setTimeout gt seekBar max music duration musicDuration innerHTML formatTime music duration Here we are setting up the song Thing to notice here is setTimeout I am using this because there is a slight time difference in setting up the music and accessing it Which causing an error while accessing its duration formatTime This is a function that we ll create next This function will take time as an argument and return us the formatted value For instance is we pass formatTime then it will return Don t forget to call the setMusic once with as an argument setMusic Create format time function formatting time in min and seconds formatconst formatTime time gt let min Math floor time if min lt min min let sec Math floor time if sec lt sec sec return min sec Now we can add click event to our play button playBtn addEventListener click gt if playBtn className includes pause music play else music pause playBtn classList toggle pause disk classList toggle play element className returns its classes and includes method is used to find a particular string is inside the text or not Now make seek bar update to song s current time after every ms seek barsetInterval gt seekBar value music currentTime currentTime innerHTML formatTime music currentTime This will update the seek bar after every ms Now we also want to jump in between song time For that add change event to the seek bar seekBar addEventListener change gt music currentTime seekBar value We are almost done Now create forward backward click events forward and backward buttonforwardBtn addEventListener click gt if currentMusic gt songs length currentMusic else currentMusic setMusic currentMusic playMusic backwardBtn addEventListener click gt if currentMusic lt currentMusic songs length else currentMusic setMusic currentMusic playMusic And yes if you see we have playMusic function Its purpose in life is to play music every time const playMusic gt music play playBtn classList remove pause disk classList add play And the last thing to make song forward when the current song end Code this inside ms interval setInterval gt seekBar value music currentTime currentTime innerHTML formatTime music currentTime if Math floor music currentTime Math floor seekBar max forwardBtn click And that s it Great Job we are done with our music player I hope you understood each and everything If you have doubt or I missed something let me know in the comments Articles you may find UsefulBest CSS EffectInfinte CSS loaderDisney CloneYoutube API Youtube CloneTMDB Netflix CloneI really appreciate if you can subscribe my youtube channel I create awesome web contents Download the assets Source Code Donate me on PaypalMy next upcoming tutorials which you might don t want to miss Fully working e commerce website FullstackResponsive Personal PortfolioVisiting card designer with download feature Your donation really motivates me to do more amazing tutorials like this Support me on patreon Buy me a coffee Donate me on paypalThanks For reading |
2021-09-04 14:12:06 |
海外TECH |
Engadget |
Amazon Eero 6 WiFi router packs are up to 38 percent off for Labor Day |
https://www.engadget.com/amazon-eero-6-wifi-router-labor-day-sale-144448441.html?src=rss
|
Amazon Eero WiFi router packs are up to percent off for Labor DayYou might not have to pay much to get a modern mesh WiFi network up and running Amazon is selling three packs of its Eero router at heavily discounted prices as part of a Labor Day sale starting at percent off for one router with two extenders You can also buy three routers for percent off and individual extenders have dropped to percent off These are the best prices we ve seen short of a Lightning Deal from June and could easily make sense if you want coverage across your whole home Buy Eero pack router extenders on Amazon Buy Eero pack routers on Amazon The sale also includes discounts on smaller Eero setups including an individual router for and a two unit combo at This isn t the Eero Pro with tri band networking and a larger square foot coverage for each unit The three Eero units you get should easily cover a typical home though and the Mbps peak bandwidth of the WiFi system will be more than enough for most home internet connections and local data transfers There s also a built in Zigbee hub that should make it that much easier to connect smart home devices These won t be your picks if you need a lot of wired networking the router has two Ethernet ports the extender has none but they re otherwise solid choices if you want fast local wireless with small unintrusive hardware Follow EngadgetDeals on Twitter for the latest tech deals and buying advice |
2021-09-04 14:44:48 |
海外TECH |
WIRED |
BrakTooth Flaws Affect Billions of Bluetooth Devices |
https://www.wired.com/story/braktooth-bluetooth-whatsapp-fine-omg-cable
|
security |
2021-09-04 14:03:25 |
ニュース |
BBC News - Home |
Heathrow criticises Border Force for 'unacceptable' queues |
https://www.bbc.co.uk/news/uk-58448565?at_medium=RSS&at_campaign=KARANGA
|
control |
2021-09-04 14:17:20 |
LifeHuck |
ライフハッカー[日本版] |
【楽天スーパーSALE】本日スタート! iPhoneがセール特価、三菱コードレス掃除機やヘルシオホットクックも半額に! |
https://www.lifehacker.jp/2021/09/rakuten-sale-0904-1.html
|
iphone |
2021-09-04 23:30:00 |
北海道 |
北海道新聞 |
25自治体がコロナ臨時医療施設 第5波で開設、患者受け皿 |
https://www.hokkaido-np.co.jp/article/585832/
|
医療施設 |
2021-09-04 23:13:52 |
北海道 |
北海道新聞 |
当別の遺棄遺体 死因特定できず 容疑の男送検 |
https://www.hokkaido-np.co.jp/article/585800/
|
死体遺棄 |
2021-09-04 23:09:04 |
北海道 |
北海道新聞 |
鈴木孝幸がIPC選手委員に 日本人初、競泳メダル5個 |
https://www.hokkaido-np.co.jp/article/585855/
|
国際パラリンピック委員会 |
2021-09-04 23:08:00 |
海外TECH |
reddit |
2021 Dutch Grand Prix - Post Qualifying Discussion |
https://www.reddit.com/r/formula1/comments/phsdrk/2021_dutch_grand_prix_post_qualifying_discussion/
|
Dutch Grand Prix Post Qualifying DiscussionROUND Netherlands FORMULA HEINEKEN DUTCH GRAND PRIX Fri Sep Sun Sep Zandvoort Session UTC Free Practice Fri Free Practice Fri Free Practice Sat Qualifying Sat Race Sun Click here for start times in your area Circuit Zandvoort Length km mi Distance laps km mi Lap record Alain Prost McLaren TAG pole Nelson Piquet Brabham BMW fastest lap Alain Prost McLaren TAG winner Niki Lauda McLaren TAG Qualifying results Pos No Driver Team Q Q Q Laps Max Verstappen Red Bull Racing Honda Lewis Hamilton Mercedes Valtteri Bottas Mercedes Pierre Gasly AlphaTauri Honda Charles Leclerc Ferrari Carlos Sainz Ferrari Antonio Giovinazzi Alfa Romeo Racing Ferrari Esteban Ocon Alpine Renault Fernando Alonso Alpine Renault Daniel Ricciardo McLaren Mercedes George Russell Williams Mercedes Lance Stroll Aston Martin Mercedes Lando Norris McLaren Mercedes Nicholas Latifi Williams Mercedes Yuki Tsunoda AlphaTauri Honda Sergio Perez Red Bull Racing Honda Sebastian Vettel Aston Martin Mercedes Robert Kubica Alfa Romeo Racing Ferrari Mick Schumacher Haas Ferrari Nikita Mazepin Haas Ferrari Useful links F com Race Wiki Race Circuit Zandvoort Streaming amp Downloads For information on downloads please visit r MotorSportsReplays Please do not post information about downloads in this thread Thank you submitted by u F Bot to r formula link comments |
2021-09-04 14:19:14 |
海外TECH |
reddit |
Max Verstappen takes pole for the 2021 Dutch Grand Prix |
https://www.reddit.com/r/formula1/comments/phsfpr/max_verstappen_takes_pole_for_the_2021_dutch/
|
Max Verstappen takes pole for the Dutch Grand Prix submitted by u overspeeed to r formula link comments |
2021-09-04 14:22:26 |
コメント
コメントを投稿