海外TECH |
MakeUseOf |
How to Reinstall macOS Without Losing Any Data |
https://www.makeuseof.com/how-to-reinstall-macos-without-losing-any-data-mac/
|
datareinstalling |
2022-03-12 19:30:13 |
海外TECH |
DEV Community |
Automatically Serve WebP Images with Silverstripe and NGINX |
https://dev.to/theloveduckie/automatically-serve-webp-images-with-silverstripe-and-nginx-beg
|
Automatically Serve WebP Images with Silverstripe and NGINX OverviewFast page load times are vital for any modern website with heavy traffic To achieve quick response times it often this means having to compress minify and cache static page assets that are served regularly on page load including JavaScript plain HTML or images in particular However the problem with heavy compression often comes with a loss of quality in image assets which can compromise aesthetics or styling and detract from overall user experience WebPFortunately there s a solution to serving mostly lossless images with small payloads Quoting from WebP s homepage WebP is a modern image format that provides superior lossless and lossy compression for images on the web Using WebP webmasters and web developers can create smaller richer images that make the web faster The WebP image file format is not anything terribly new and has been for a while now however many websites have yet to implement steps for generating webp images from their existing image assets Integrating with SilverstripeAs a case study for this blog I ve decided to talk about how to integrate the usage of this image file format with Silverstripe What is Silverstripe For those of you who don t already know Silverstripe CMS is a free and open source content management system and framework for creating and maintaining websites and web applications It provides an out of the box web based administration panel that enables users to make modifications to parts of the website which includes a WYSIWYG website editor You can otherwise consider it as an alternative CMS to WordPress although arguably better and less bloated Assuming that you already are working on a Silverstripe project you can install a convenient module that I ve developed that will automatically convert any image asset that has been rasterized resized or scaled from your Silverstripe project through using Silverstripe s image templating syntax You can install the module with the following command composer require loveduckie silverstripe webp imageAfter installing this with the Composer package manager simply run dev build flush all Without having done anything else your Silverstripe project is now automatically generating and serving webp assets on page load Woah Let s take a look at how it s achieving this If we take a look at the repository for the module you will see that we are using a LibGD function made available as part of PHP for converting PNG images when intercepting requests for serving assets This line in particular public function createWebPImage path filename hash variant false if function exists imagewebp amp amp function exists imagecreatefromjpeg amp amp function exists imagecreatefrompng amp amp function exists imagecreatefromgif orgpath this gt getAsURL filename hash variant list width height type attr getimagesize path switch type case img imagecreatefromjpeg path imagewebp img this gt createWebPName orgpath this gt webp quality break case img imagecreatefrompng path imagesavealpha img true save alphablending setting important imagewebp img this gt createWebPName orgpath this gt webp quality break imagedestroy img After the conversion is made in memory using imagewebp it then gets served to disk using the file path generated by createWebPName orgPath This path is something along the lines of this silverstripe project root public assets Upload your image filename png webpThe way that the file is named is important to note for later on Serving Generated WebP Images from NGINXYou can use the following NGINX configuration for serving WebP images automatically from your Silverstripe project s public assets directory You can compare this configuration to the default one that Silverstripe has on their documentation pages for NGINX connectivity with PHP FPM map http accept webp suffix default webp webp server listen listen server name WEBSITE DOMAIN NAMES server tokens off include etc nginx mime types location try files uri index php query string location assets lt extension gt jpe g png gif webp gzip static on gzip types image png image x icon image webp image svg xml image jpeg image gif add header Vary Accept expires max sendfile on try files request uri webp suffix uri location index php fastcgi read timeout fastcgi buffers k fastcgi buffer size k fastcgi busy buffers size k fastcgi keep conn on fastcgi pass your php fpm server goes here fastcgi index index php fastcgi param SCRIPT FILENAME document root fastcgi script name include etc nginx fastcgi params From the snippet above WEBSITE DOMAIN NAMES is automatically replaced when the NGINX server starts by using envsubst but you can replace it with your own domain names too I ve simply taken this configuration from my own webserver as I am using the Alpine Linux Docker container image for NGINX The most important part of this configuration is this section map http accept webp suffix default webp webp You can think of it as a switch statement in most languages Depending on what http accept resolves to when a request is served will ultimately determine whether the resulting variable webp suffix will resolve to either webp or nothing This resulting variable will then be used when serving static files from the assets directory which occurs in this part of the configuration location assets lt extension gt jpe g png gif webp gzip static on gzip types image png image x icon image webp image svg xml image jpeg image gif add header Vary Accept expires max sendfile on try files request uri webp suffix uri This configuration block basically instructs NGINX to respond to requests that end with the suffix of jpeg png gif or webp It will then attempt to locate and serve the webp of the same requesting asset if the Accept header has been defined to include webp You can see that happening on this line try files request uri webp suffix uri Depending on what the incoming browser request has in their Accept header will automatically determine if the webp suffix is populated which will in turn decide which version of the same asset is retrieved from your server s filesystem Once you ve applied this configuration you can then run the following command to test it nginx tFollowed by this one to reload it assuming that the previous one did not fail nginx s reloadNow when you navigate to your running Silverstripe project you should notice something interesting if you open up your Developer Console in Chrome You ll notice that even though your browser is loading an image asset with a jpeg extension the MIME type for the response is that of image webp This means that NGINX was able to locate the generated webp image asset and was able to serve it back This is good news ConclusionAnd there you have it An end to end solution for integrating webp image assets with your Silverstripe project and how to serve them through a modern web server such as NGINX Using some clever NGINX configuration trickery we can automatically pick and serve webp should it be discoverable on the filesystem These image assets are being automatically generated by Silverstripe whenever templates are being rendered that make use of the syntax for manipulating images Useful LinksNGINX configuration for Silverstripe with WebP image servingThanks for reading Feel free to follow me on Twitter or check out my website where I often blog about other topics |
2022-03-12 19:47:42 |
海外TECH |
DEV Community |
Basic HTML Document Structure |
https://dev.to/worldofdev/basic-html-document-structure-15ja
|
Basic HTML Document StructureIf you re new to coding building a website from scratch can be daunting But don t worry it s quite simple In this post we ll look at the basic structure of an HTML document The basic HTML document structure is the skeleton on which all websites are built and once you understand this you ll be well on your way to creating your own beautiful website Ready to get started Let s go When developing a web page it s critical to use the right HTML document structure Web pages may break or the search engine crawlers may not read the page if the Basic HTML document structure is incorrect The basic HTML document structure includes the lt html gt lt head gt and lt body gt tags where a lt title gt tag is required to be nested inside the lt head gt tag In this article we will break down what you should include in each one of these and why HTML is a markup language which means it s used to “mark up material in a document In this instance a webpage with structural and semantic information instructs a browser on how to display it Please note that this article references HTML which is the latest version and if you are starting to learn now we suggest you start on this version Table Of ContentsBasic HTML Document StructureBasic HTML Document Structure TagsDoctype TagThe Root TagThe Head TagThe Title TagThe Body TagWhat is Semantic HTMLConclusion Basic HTML Document StructureIf you are looking for a quick copy and paste of the basic HTML Document structure and understand the meaning of all the tags feel free to use the below If you want to understand the detail behind these tags and find out what should be included please continue reading Basic HTML Document Structure TagsThe Basic HTML Document structure is pretty simple and is for the most part made up of different tags the and When you dive deeper into HTML you will realise that the page structure can get a bit more complex due to new semantic features in HTML known as Semantic HTML tags Doctype TagThe first line of code lt DOCTYPE html gt is referred to as a doctype declaration that informs the browser of the page s HTML version We are using the HTML doctype the most recent version of the HTML language Several distinct doctype declarations correlate to different HTML versions In HTML alone different doctype declarations could be used just by starting with HTML Basic HTML Page Structure is already much easier The Doctype declaration is not case sensitive and therefore all of the below versions will work To learn more about the Basic HTML Document Structure Click Here |
2022-03-12 19:21:11 |
海外TECH |
DEV Community |
Learning natural languages, IT way |
https://dev.to/nikitakoselev/learning-natural-languages-it-way-2hji
|
Learning natural languages IT wayIT related jobs are one of the most interesting and best paid in the world Unfortunately these come at a huge cost Which one Well staying up to date with IT news may consume all your time It also might be not so easy to stay mentally healthy using your numerical part of the brain all the time I have found a way to exercise the “artistic part of the brain just to let the numerical one get some rest How Natural language studies OK “language studies is a terrific idea but how can I find time given I work in IT which means I spend a good chunk of my free time studying IT My “magic answer is…IT meetups in the natural language of your choice For example I am interested in Spanish I like the language I like the culture I like “la comida I have discovered that Codurance consultancy not only does meetups in English but also does meetups in Spanish Joining is easy attendance is free Attendees speak Spanish but you are welcome to ask questions in English Also everybody is very friendly and will not go crazy over your grammatical mistakes Well now you know my secret Now there is no “I have nobody to practice with excuse Many thanks to Ignacio Saporiti His “Primera kata con Go meetup last week was absolutely amazing You can subscribe to more Codurance meetups both English and Spanish ones here Many thanks to the Codurance team for sharing with the community |
2022-03-12 19:15:03 |
海外TECH |
DEV Community |
Code Quality Assurance? “In Simple English” |
https://dev.to/yannmjl/code-quality-assurance-in-simple-english-324h
|
article |
2022-03-12 19:13:10 |
海外TECH |
DEV Community |
How to add Custom Network to Metamask |
https://dev.to/afozbek/how-to-add-custom-network-to-metamask-l1n
|
How to add Custom Network to MetamaskHello guys this will be a post where I will show you how to add custom local network to Metamask This article assumes that you already installed metamask and you have been created an account before If you don t installed yet go to Metamask and download it to your browser Interacting with MetamaskClick on the extension and go the settings if you scroll down a little bit you will see network option Click on that and press add network button This should open a form in the new tab It should be something like this Adding Custom NetworkIn our tutorial we will add custom local network to metamask Ganache or Hardhat can be an example for that If you want to add other EVM compatible networks you can also do that Network Name Localhost New RPC URL http localhost Chain Id Currency Symbol ETHAfter you saved that you can see something like this Wait whaaat I can t see my ETH in there Don t freak out It is because we do not imported our local accounts that node gives us Installing GanacheFor this tutorial you need to install ganache in order follow along Go to Ganache and download the CLI After you installed it you can run the CLI on your machine You should see something like this Click quickstart and you have everything you need Importing Accounts to MetamaskWhat we need to grab the private key of one of our test accounts and import it to Metamask For Ganache you can grab it inside it Ganache CLI for hardhat and other nodes you can copy them right through the console once you start the node in your terminal Click the show keys account that is inside accounts tab It will open a modal and you grab private key from there Do not ever use test accounts in real blockchainCopy that private key and click on the Metamask extention again Go profile gt import account and you will see this screen and paste that private key to that input and click import You should see that your active account is changed and it is labeled as imported And you can also see that it contains test balances inside of the account Great Now you can build your dream application and test using local nodes Optional Labeling the AccountMetamask also offers labeling the account so that if you use it for development it will be easier to differenciate them from real accounts Once you clicked the extension again click the three dots and go to account details This should open a modal which you see the account informationFrom there just click the pencil icon and change the name whatever you want And save it Now you should see the updated names in myAccounts sectionAnd that is all from my side Thank you so much for reading this far and if you want to learn more topics like this feel free to subscribe my youtube channel which I started last week That s all and have a wonderful day TwitterYoutubeInstagramGithub |
2022-03-12 19:07:21 |
ニュース |
BBC News - Home |
Sarah Everard: Protesters demand 'radical change' to Met Police |
https://www.bbc.co.uk/news/uk-england-london-60720907?at_medium=RSS&at_campaign=KARANGA
|
everard |
2022-03-12 19:45:48 |
ニュース |
BBC News - Home |
Six Nations: Ireland see off brave 14-man England |
https://www.bbc.co.uk/sport/rugby-union/60722384?at_medium=RSS&at_campaign=KARANGA
|
england |
2022-03-12 19:12:28 |
ニュース |
BBC News - Home |
Manchester United 3-2 Tottenham Hotspur: Cristiano Ronaldo scores hat-trick in thriller |
https://www.bbc.co.uk/sport/football/60628394?at_medium=RSS&at_campaign=KARANGA
|
Manchester United Tottenham Hotspur Cristiano Ronaldo scores hat trick in thrillerCristiano Ronaldo scores a hat trick as Manchester United beat Tottenham to move into the Champions League places |
2022-03-12 19:39:36 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
1人で空回りしてしまう部長と、部下を巻き込める部長の「決定的な違い」[見逃し配信] - 見逃し配信 |
https://diamond.jp/articles/-/298935
|
関連 |
2022-03-13 04:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
グリコ・森永事件の脅迫状はなぜ執拗に送られ続けたのか?日本中を恐怖に陥れた犯人像 - from AERAdot. |
https://diamond.jp/articles/-/298392
|
グリコ・森永事件の脅迫状はなぜ執拗に送られ続けたのか日本中を恐怖に陥れた犯人像fromAERAdot訴状、蹶起趣意書、宣言、遺書、碑文、天皇のおことば……。 |
2022-03-13 04:45:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
フランスの最新事情、コロナ規制が緩和でも戦禍の影響は?【地球の歩き方】 - 地球の歩き方ニュース&レポート |
https://diamond.jp/articles/-/298390
|
地球の歩き方 |
2022-03-13 04:40:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「マスタングGT」のせいで、アラサー不良ドライバーになった米国人男性の告白 - 男のオフビジネス |
https://diamond.jp/articles/-/298355
|
米国人 |
2022-03-13 04:35:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
新日本酒紀行「真上」 - 新日本酒紀行 |
https://diamond.jp/articles/-/297163
|
村井醸造 |
2022-03-13 04:30:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
5~11歳へのファイザー製コロナワクチン、12~17歳に比べて有効性は限定的 - ヘルスデーニュース |
https://diamond.jp/articles/-/298395
|
covid |
2022-03-13 04:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「成果を出せるリーダー、全く出せないリーダー」の根本的な差とは? - 採用基準 |
https://diamond.jp/articles/-/296200
|
違い |
2022-03-13 04:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ひろゆき呆れる「頭の悪い親の特徴」ワースト1 - 1%の努力 |
https://diamond.jp/articles/-/298334
|
youtube |
2022-03-13 04:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【外科医が教える】数ある診察の中で患者がもっとも慌てる「身体診察法」とは? - すばらしい人体 |
https://diamond.jp/articles/-/298520
|
【外科医が教える】数ある診察の中で患者がもっとも慌てる「身体診察法」とはすばらしい人体累計万部突破唾液はどこから出ているのか、目の動きをコントロールする不思議な力、人が死ぬ最大の要因、おならはなにでできているか、「深部感覚」はすごい…。 |
2022-03-13 04:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【精神科医が教える】 自分で自分を不幸にする 残念な人の特徴とは? - 精神科医Tomyが教える 心の荷物の手放し方 |
https://diamond.jp/articles/-/298857
|
voicy |
2022-03-13 04:05:00 |
ビジネス |
東洋経済オンライン |
燃えるゴミは3カ月に1度しか出さない人の「末路」 ゴミを減らしたら増えていく「意外なもの」 | 買わない生活 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/538278?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
東洋経済オンライン |
2022-03-13 04:30:00 |
コメント
コメントを投稿