投稿時間:2021-04-11 03:11:36 RSSフィード2021-04-11 03:00 分まとめ(16件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) could not convert string to float: 'retired' https://teratail.com/questions/332618?rss=all couldnotconvertstringtofloatxretiredxPythonで決定木モデルの学習をしています。 2021-04-11 02:03:37
Linux Ubuntuタグが付けられた新着投稿 - Qiita Ubuntuでタッチパッドの2本指スクロールができない https://qiita.com/sekishoku/items/d307ea279a1d07ef3050 2021-04-11 02:38:11
Linux Ubuntuタグが付けられた新着投稿 - Qiita 「skl_hd_dsp_generic skl_hda_dsp_generic: ASoC: failed to init link iDisp1: -517」の解決法 https://qiita.com/sekishoku/items/b43428aa4f49527f0867 2021-04-11 02:14:41
AWS AWSタグが付けられた新着投稿 - Qiita AWSでWebアプリをデプロイする方法(Java)⑨ https://qiita.com/kunrenyouAcount/items/3b17275e9b1f9de8d990 AWSでWebアプリをデプロイする方法Java⑨参考サイトTomcatのインストールTomcatをインストールすることでJavaサーブレットを動かせる環境を整えます利用環境OSMacOSブラウザChrome前提条件Apacheがインストールできている状態まだ、Apacheがインストールできていない方はこちらTomcatをインストールする接続する下記のsshコマンドを入力して接続します※キーペアのファイルのパスと、ecuser以降は、変更して使用してくださいsshiUserskoyamatakumiDocumentsDevelopmentpracticeawsmyserverkeypemecuser接続確認下記のように表示されていれば、接続完了ですSSHでの操作とrootユーザーへの切り替えrootユーザーのサインインソフトウェアのインストールはrootユーザーで行います下記コマンドを入力し、rootユーザーへサインインしますsudoiTomcatをインストールするためのユーザーを追加するuseraddssbinnologintomcatTomcatのダウンロードディレクトリを移動、curlコマンドでURLを入力し、コンソールからURLにリクエストを送り、ダウンロードcdusrlocalsrcwgetダウンロードしたファイルを解凍して配置ファイルを解凍、配置、所有者変更tarxzvfapachetomcattargzmvapachetomcatoptchownRtomcattomcatoptapachetomcat省略可Tomcatのシンボリックリンク作成yumを用いたインストールを行っていない為、将来手動でTomcatバージョンを変更する際にも設定に影響が少なくなるようにシンボリックリンクを作成します。 2021-04-11 02:34:31
AWS AWSタグが付けられた新着投稿 - Qiita AWSでWebアプリをデプロイする方法(Java)⑧ https://qiita.com/kunrenyouAcount/items/4ca08c9ac3e2e262e7b1 2021-04-11 02:31:32
海外TECH DEV Community MLOPs Lifecycles https://dev.to/slimdestro/mlops-lifecycles-441h MLOPs LifecyclesMLOPs life cycle Define business need Getting datasets ready This phase includes data cleaning labelling pixel optimisation open source datasets and enterprise data lakesModel development code part Training and optimisations of model Deployment uat prod User interface and API development to let user interact with the model Monitoring both model and system resourcesInsights and analyticsContinuous model training deployed one time model can work for few time frames and hence it needs retraining on new data world has changed We use CI CD tools like Jenkins and Docker cubectl for code automation Security and protection of ML model against known vulnerability This is the point most people ignore Thanks 2021-04-10 17:52:34
海外TECH DEV Community Learn by Doing: Practice PHP OOP (level 3) https://dev.to/ericchapman/learn-by-doing-practice-php-oop-level-3-539d Learn by Doing Practice PHP OOP level If you like this post and want more connect with me on Twitter Follow justericchapmanYou want to learn PHP OOP for a long time but you keep postponing Now is the time For the next days I will post php OOP exercises solution Your challenge is to try to solve the small exercise without looking at the solution You can use the web to search for concept but please dont look at the solution before at least try to solve the exercise We will start very easy but don t be bored because exercises will quickly became more and more challenging Challenge accepted Exercise In exercise we created a class with a constructor using property promotion lt phpclass Product public function construct private name private description private price Today your challenge is to create a getter and setter to modify the name property Hint Getter and Setter are methods The getter method is a method that get return the object instance property value The setter method is setting the current instance property value to a new supply value Let s do it Exercise A quick one When setting the property name Make sure that the name first letter is Uppercase Solution STOP Do the exercises first It s the only way you will really learn If you have done your exercise here my solution Noted most of the times more than one solution will be possible If you have something different that me leave your solution in the comment to share and discuss Exercise solution class Product public function construct private name private description private price public function setName name this gt name name public function getName return this gt name Exercise solution public function setName name this gt name ucfirst name ConclusionThat s it for today Tomorrow the journey continue see you later If you want to be contribute you can re tweet this post on tweeter Follow justericchapman 2021-04-10 17:33:43
海外TECH DEV Community 144 day long countdown timer with no JavaScript 😲?!? My GIFt to you [how to dynamically generate animated GIFs with text]! https://dev.to/inhuofficial/this-gif-is-accurate-to-within-a-minute-how-to-create-a-dynamic-gif-countdown-3fhd day long countdown timer with no JavaScript My GIFt to you how to dynamically generate animated GIFs with text The GIF below is counting down to the st September at GMT I think it is pretty cool that for the next days at time of writing that Gif will always be within one or two minutes of an actual countdown timer In fact you can check timeanddate com for the accuracy of my timer here it should be within a minute when you first load this page Obviously it isn t one massive file it would need MILLION frames so it would be quite large so how did I do it In this article I cover how I created the image sequence converted it to a GIF update the article where it is useful in the real world and Why I created a countdown final thought before we get cracking If you are returning to this article you may end up with a broken image link occassionally Refreshing the page will sort that out I don t think I can do anything about it as it is dev to caching that appears to be the issue Right with all that out of the way let s begin Generating an image sequence with text The first part of the puzzle was creating an image sequence that I could later turn into a GIF But before we create a sequence of images we have to work out how to make one image Creating an image with text over it Now with GD image library installed this isn t actually as difficult as it first seems Most PHP hosting and environments have GD image library installed so you should be able to do this even on shared hosting First we grab the source image the background we are going to write our text on imagecreatefromjpeg img inhu countdown jpg I created a super simple image with a large white space to the left This is our canvas to work on It also creates the image object that we can work with The next thing we need to do is add the text For this we use imagettftext We need to pass it The image objectThe font size unitless The angle we want the text at in degrees the x position in pixels from the left the y position in pixels from the top the colour of the text in RGB more on that in a sec the font family the path to the chosen font the text what we want it to say Now the only thing that is a little bit confusing is how you pass RGB colours to the function To do that we have to use another function imagecolorallocate This function needs us to pass it The image objectthe Red channel value the Green channel value the Blue channel value Ok that is fine but I prefer Hex values when working with colours No problem I have a snippet sat in my library for converting Hex to an RGB array function hexToRGB colour if colour colour substr colour if strlen colour list r g b array colour colour colour colour colour colour elseif strlen colour list r g b array colour colour colour colour colour colour else return false r hexdec r g hexdec g b hexdec b return array r gt r g gt g b gt b Right so the process is straight forward Convert our Hex colour to RGBPass our RGB colours to imagecolorallocate to set that colour into the image palletteCreate our text using imagettftext and pass the relevant values All in all a simple example might look like this our hex to RGB functionfunction hexToRGB colour if colour colour substr colour if strlen colour list r g b array colour colour colour colour colour colour elseif strlen colour list r g b array colour colour colour colour colour colour else return false r hexdec r g hexdec g b hexdec b return array r gt r g gt g b gt b create the image object image imagecreatefromjpeg img inhu countdown jpg convert our Hex to RGB textColour this gt hexToRGB textColourImage imagecolorallocate image textColour r textColour g textColour b finally create our imageimagettftext image font size angle x coord px from left y coord px from top textColourImage colour we allocated earlier fonts arial ttf font path Hello Text the text we wantThen all we have to do is save the image as our chosen file type imagepng image image with text Adjusting the code so we can create multiple images and add text in different locations Right so we have worked out how to create an image with some text on but that is just one piece of text We are also hard wiring all of our values which is obviously useless if we want to dynamically generate a countdown Time to turn this into a class we can use namespace GifMake class gifMake private image public texts array function hexToRGB colour if colour colour substr colour if strlen colour list r g b array colour colour colour colour colour colour elseif strlen colour list r g b array colour colour colour colour colour colour else return false r hexdec r g hexdec g b hexdec b return array r gt r g gt g b gt b function createImg this gt image imagecreatefromjpeg img inhu countdown jpg foreach this gt texts AS item fontSize item angle item x item y item textColourHex item fontFamily item text item textColourRGB this gt hexToRGB textColourHex textColourImg imagecolorallocate this gt image textColourRGB r textColourRGB g textColourRGB b add the text imagettftext this gt image fontSize angle x y textColor fontFamily text return true function saveAsPng fileName text image location fileName fileName png fileName empty location location fileName fileName return imagepng this gt image fileName function saveAsJpg fileName text image location fileName fileName jpg fileName empty location location fileName fileName return imagejpeg this gt image fileName function showImage header Content Type image png return imagepng this gt image Most of the code is the same as before but this time we have made adjustments so we can pass values in via an array of texts we want adding Another thing added are three methods for returning an image savePng saveJpg and show which save the image as a PNG or save it as a JPG or just output the image to view in the browser which is useful for testing Another thing to notice is that we now have an array declared at the start of the class called texts This is where we are going to store each item of text that we want drawn onto the image This way we can set and then loop through an array of instructions using foreach this gt texts AS item to set text in multiple places and multiple colours sizes etc One thing to note is if we wanted to make this truly reusable the image path would need to be set externally but this is a quick project so hard wiring it is fine for now Using our new class First we include it in our script and set the namespacenamespace GifMake include gifmake php Now we can create an image with multiple blocks of text easily img new gifMake img gt texts array font inhu ttf InHu Launches in img gt texts array font inhu ttf img gt texts array font inhu ttf Days img gt texts array font inhu ttf img gt texts array font inhu ttf Hours img gt texts array font inhu ttf img gt texts array font inhu ttf Minutes img gt texts array font inhu ttf img gt texts array font inhu ttf Seconds img gt createImg fileName img test img gt saveAsPng fileName The output looks something like this Now it took a little bit of work placing the text but other than that it was pretty plain sailing The final step for an image sequenceNow that we have a design that works all we have to do now is create a sequence of images where each image has second removed I went for a minute images as a nice balance between file size and people seeing it loop So we just have to grab the difference between our target date and now convert it to days hours minutes and seconds and then feed those values into our template we designed earlier The following code is a little messy but it was what I ended up with namespace GifMake use GifCreator use Datetime include giflib php include gifcreator php get our current time and our target time then find the difference now new DateTime ends new DateTime Sep left now gt diff ends grab the days hours minutes and seconds DIFFERENCE between our two dates days left gt format a hours left gt format h minutes left gt format i seconds left gt format s loop times subtracting a second each time and drawing our textfor x x lt x if seconds lt seconds minutes if minutes lt minutes hours if hours lt hours days we have a check to ensure our countdown date hasn t passed Useful to add an else clause later with a different image for countdown over if now lt ends img new gifMake img gt texts array font inhu ttf InHu Launches in we use str pad to make sure our days minutes etc have at least figures img gt texts array font inhu ttf str pad days STR PAD LEFT img gt texts array font inhu ttf Days img gt texts array font inhu ttf str pad hours STR PAD LEFT img gt texts array font inhu ttf Hours img gt texts array font inhu ttf str pad minutes STR PAD LEFT img gt texts array font inhu ttf Minutes img gt texts array font inhu ttf str pad seconds STR PAD LEFT img gt texts array font inhu ttf Seconds call our build function to add the text and then save it img gt createImg fileName img sequence img x img gt savePng fileName seconds Voila images each with second less than the previous on them Creating a GIFNow I may have made my own little class for adding text but I wasn t going to write a class for creating GIFs there are too many things I would need to polish up on I found this great GIF creation library by Sybio that seemed super simple Here is the entirety of the code required to create our GIF frames array for x x lt x frames img sequence img x png durations Initialize and create the GIF gc new GifCreator GifCreator gc gt create frames durations gifBinary gc gt getGif file put contents img countdown gif gifBinary The key part of it is the gc gt create function It expectsAn array of images I used relative paths but it handles files as well an array of durations per framethe number of times to repeat One quirk I found was that a duration of is a second I was expecting to be a second Putting that all together we end up with our GIF Updating the dev to articleNow this one is also pretty straight forward To update a dev to article you need the article ID The proper way to get this is to query the API for your articles or store the article ID when we create an article But yet again this is a one off project so all I need is to get the ID and hard wire it in Luckily you can just create an article with basic information such as a title which we can change save it to draftgo to the Dashboard and find the article you just createdclick the dots for more options and right click on Archive post gt inspect You will find the ID of your article in the lt form gt that surrounds the Archive post button id edit article the ID of your article Once we have that ID all we have to do is send a PUT request to our article id we found earlier with the following parameters title article titlepublished whether the article is published true false body markdown our article content tags an array of tags relevant to the article vars array vars article array vars article title Your Article Title vars article published false set to true to publish vars article body markdown Your article markdown vars article tags array up to four related tags vars send json encode vars convert to JSON ch curl init curl setopt ch CURLOPT URL your article id curl setopt ch CURLOPT CUSTOMREQUEST PUT curl setopt ch CURLOPT POSTFIELDS vars send Post Fields headers api key Your API key found under settings gt account Content Type application json curl setopt ch CURLOPT HTTPHEADER headers add the headers to the requestcurl exec ch go go go For most purposes that should be sufficient However I want the article cover image to be my countdown GIF Unfortunately that means we can t send our data as a JSON encoded array of variables instead we have to send just Markdown and include something called front matter Front matter is basically just meta data about the article It s format is quite simple title our article titlepublished true of falsetags up to tags that are relevantdescription for twitter cards and open graph social sharing cover image URL of the cover image this is what we need All of our article content Once we have that built that we can send just the body markdown now with our front matter added to the start vars array vars article array vars article body markdown bodyMarkdownIncludingFrontMatter vars send json encode vars same as before All being well that will complete without errors If you do get an error most of the time the API gives a meaningful error message so you know what to fix what to search for when trying to solve the problem I had a couple where my markdown was mangled but other than that it was plain sailing except for a problem that you likely won t encounter under normal use An unexpected gotchya I got all of the above working and then ran my update script a few times It generated a fresh image it updated the article correctly but something wasn t quite right My GIF was not using the latest time for the countdown i checked my server yup the image is generating correctly so what was the problem It turns out that I was being a bit naive I thought that if I pointed the URL for the image at my server I could control the image But dev to is far cleverer than me and actually grabs the image from my server and caches it You can t even get around it with classic cache busting techniques like appending t to the end of the image URL After a head scratch and a grumble I found a super simple solution When I generate the image I just give it a random number as part of the file name The only issue with this is that I don t want my server having a new image generated every minute and stored for the next days So I also have to remove the old image when I generate a new one My final issue is that this actually runs on two separate scripts one to generate the image and one to update the document and I want to keep them separate so I can run the create script for the next minute while posting the last post as the creation can take seconds So in the end I hacked in a quick solution In the GIF creation script I added the following code delete the existing file files glob img countdown holder foreach files as file if is file file unlink file generate a random number to bust the cache cacheBuster rand add our file back into the directory with a new file namefile put contents img countdown holder countdown cacheBuster gif gifBinary And in the article update script I did the following directory img countdown holder files scandir directory ourImageURL directory files So that we could grab the file with a random name without having to pass information directly between the two scripts Would I put this into a mission critical process No Will it do for what I need and probably work without any issues Yes and that is good enough for me The final bitsUpload the two files to the server Go set up a cron job for each of them to run every minute Sit and check it all works and it does if you are reading this article and the timer is in sync to the st September at GMT That is it hopefully now you know how you can create an image sequence with dynamically added text stitch those images together to form a GIF and kind of know how to update an article using the dev to API I plan on doing a detailed article soon on the dev to API so if this last section wasn t detailed enough for you then give me a follow and hopefully my API article will help So how in sync are weWell if you have actually read the article this far you will probably have noticed the GIFs are either several minutes out or may even have stopped entirely However if you refresh the page the GIF should be accurate within a minute two at the most If it wasn t for the caching issue I could have made it perfect to the second with a bit of extra work but you know what it is close enough for me Does it have any practical applications You might think with JavaScript being a much better and far more lightweight solution for something like this it is just a waste of time and a fun project But there is one situation where this is useful Email marketing Being able to count down to an offer or special event accurately is quite engaging and engagement is key As we can t run JavaScript in emails our only option is a GIF There may be other uses but that is why I wanted to learn how to do this as I plan on using it in the future to countdown to any events I am hosting involved in So what am I counting down to The launch of my company InHu That is all I am going to say for now you will have to follow me if you want to find out more as I will slowly be releasing details of what I have been planning and orchestrating for the last year ltag user id follow action button background color caa important color important border color caa important InHuOfficial Specialising in accessibility and website load speed performance If you have a question about accessibility or page speed insights ask away and I will help any way I can 2021-04-10 17:24:09
海外TECH DEV Community Pluralsight is FREE in April!! https://dev.to/pluralsight/pluralsight-is-free-in-april-57el Pluralsight is FREE in April Great news Pluralsight is FREE for the entire month of April If you ve been wanting to skill up and have never tried the platform here s your chance Try out Pluralsight Now If you sign up now here are a few things you can do to take advantage of Free April Here are some things you can do right now if you sign up and get started Learn AngularWith the Angular Getting Started course you can finally jump in and learn some Angular Deborah Kurata teaches things like nobody else I know Her expert instruction will get you on the right track Artificial IntelligenceCurious about AI Do you want to get into it but don t know where to start Artificial Intelligence The Big Picture of AI will get you where you need to go fast Learn CC is one of my favorite languages of all time I absolutely love coding in it and if it s something you ve been curious about The C Path at Pluralsight will get you where you need to be FAST Get Started with PythonOK if you know me you already know about my love of Python The ultimate “glue language that empowers you to do SO many things You can take this Getting Started with Python course and hit the ground running You ll be amazed at what you can accomplish with this Learn Some ReactReact is undoubtedly one of the hottest front end frameworks out there and it s taking over the world React Getting Started is the course that will launch you into this world head first and you ll understand the basics of React FAST What s So Great About Pluralsight You might ask what s the difference between Pluralsight and just going on to YouTube and learning stuff Courses are Organized Finding tutorials and videos online and trying to piece things together is difficult It s tough to know what you need to know find it all and get full coverage of a topic Pluralsight does that for you and puts together a solid package of the right knowledge Taught by Experts Not anyone can just record a few videos and put a course up on Pluralsight Expert authors are recruited from the field and vetted They are experienced knowledgeable folks who have done real work in the field Courses Meet Strict Standards Every course goes through a quality control process to make sure they are clear and accurate The content is thoroughly checked to make sure you re getting accurate useful information about a topic You can Take a CourseCheck Your Knowledge with SkillIQGet HANDS ON with Cloud Labs and SandboxesSo what are you waiting for Give it a shot It s Free during the month of April Try out Pluralsight Now 2021-04-10 17:13:52
海外ニュース Japan Times latest articles Osaka posts record 918 new COVID-19 cases Saturday as Tokyo cases hit 2-month high https://www.japantimes.co.jp/news/2021/04/10/national/japan-coronavirus-april-10/ Osaka posts record new COVID cases Saturday as Tokyo cases hit month highThe daily figures in Osaka which had a quasi emergency measure imposed earlier this week have topped those of Tokyo for consecutive days 2021-04-11 02:52:49
海外ニュース Japan Times latest articles Leonys Martin, Manabu Mima help Marines tame Lions https://www.japantimes.co.jp/sports/2021/04/10/baseball/japanese-baseball/martin-mima-marines-lions/ lionsmartin 2021-04-11 03:24:09
ニュース BBC News - Home Prince Philip: Charles says dear papa was very special https://www.bbc.co.uk/news/uk-56702886 edinburgh 2021-04-10 17:30:00
ニュース BBC News - Home Rachael Blackmore makes Grand National history https://www.bbc.co.uk/sport/horse-racing/56701659 aintree 2021-04-10 17:34:50
ニュース BBC News - Home Big Brother star Nikki Grahame dies aged 38 https://www.bbc.co.uk/news/entertainment-arts-56705671 brother 2021-04-10 17:20:22
ニュース BBC News - Home Prince Philip tributes: 'I wanted my grandchildren to remember this day' https://www.bbc.co.uk/news/uk-56703427 philip 2021-04-10 17:36:22
ニュース BBC News - Home Prince Philip: What are the plans for his funeral? https://www.bbc.co.uk/news/uk-56694327 edinburgh 2021-04-10 17:01:01

コメント

このブログの人気の投稿

投稿時間: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件)