python |
Pythonタグが付けられた新着投稿 - Qiita |
PyCharmでgoogleスタイルのdocstring形式を変更する |
https://qiita.com/maru3745/items/e96ba84b23da33c69426
|
toolsgtpythoni |
2023-08-13 15:25:19 |
海外TECH |
DEV Community |
HTML Interview Questions with Answers and Code Examples Part-3 |
https://dev.to/abidullah786/html-interview-questions-with-answers-and-code-examples-part-3-11i4
|
HTML Interview Questions with Answers and Code Examples Part IntroductionImagine you re building a house HTML Hypertext Markup Language is like the strong foundation that holds everything together Knowing some cool HTML tricks can make you a superstar in job interviews Welcome back to third part of our series We re going to start from the basics and gradually climb up to advanced concepts just like taking steps up a ladder of knowledge In this series we re unlocking the answers to the first tricky HTML interview questions Don t worry we ll keep it super easy with examples These answers will give you a boost of confidence during interviews showing off what you know Let s dive into these questions If you re curious to learn more about HTML and its magic check out the official guide from the World Wide Web Consortium WC at HTML ーWorld Wide Web Consortium For nifty tips and tricks on making HTML work like a charm the Mozilla Developer Network MDN has a user friendly guide just for you Discover it at HTML ーMozilla Developer Network And if you re interested in making your website easy for everyone to use the Web Accessibility Initiative WAI website is a goldmine of helpful resources Find them at Web Accessibility Initiative Remember these extra resources can provide more information to help you grasp HTML better along with the questions and examples we re covering Table Of ContentsHow can you create an unordered list with custom bullet points using HTML How can you create a dropdown menu in HTML How can you create a table with HTML How can you create a tooltip for an element using HTML Explain the purpose of the meter element in HTML Explain the purpose of the element in HTML What is the purpose of the element in HTML How can you disable the browser s default form validation in HTML What is the purpose of the tag in HTML How can you embed a YouTube video in HTML How can you create an unordered list with custom bullet points using HTML Answer You can customize the bullet points of an unordered list using CSS by assigning a specific image or shape to the list style image property lt style gt ul list style image url bullet png lt style gt lt ul gt lt li gt Item lt li gt lt li gt Item lt li gt lt li gt Item lt li gt lt ul gt How can you create a dropdown menu in HTML Answer To create a dropdown menu use the element along with elements to represent the menu items lt select gt lt option value option gt Option lt option gt lt option value option gt Option lt option gt lt option value option gt Option lt option gt lt select gt How can you create a table with HTML Answer Use the lt table gt lt tr gt and lt td gt tags to create a table structure where lt tr gt represents a table row and lt td gt represents a table data cell lt lt table gt lt tr gt lt td gt Cell lt td gt lt td gt Cell lt td gt lt tr gt lt tr gt lt td gt Cell lt td gt lt td gt Cell lt td gt lt tr gt lt table gt How can you create a tooltip for an element using HTML Answer To create a tooltip you can use the title attribute on an HTML element When the user hovers over the element the tooltip text will be displayed lt a href title This is a tooltip gt Hover me lt a gt Explain the purpose of the meter element in HTML Answer The lt meter gt element represents a scalar measurement within a known range It is commonly used to display measurements such as disk space usage or progress indicators lt meter value min max gt lt meter gt Explain the purpose of the lt datalist gt element in HTML Answer The lt datalist gt element provides a list of pre defined options for an field It offers autocomplete functionality and helps users select options easily lt input type text list options gt lt datalist id options gt lt option value Option gt lt option value Option gt lt option value Option gt lt datalist gt What is the purpose of the lt time gt element in HTML Answer The lt time gt element represents a specific point in time or a duration It helps provide semantic meaning to dates and times on a webpage lt p gt My birthday is on lt time datetime gt Oct lt time gt lt p gt How can you disable the browser s default form validation in HTML Answer Use the novalidate attribute on the lt form gt tag to disable the browser s default form validation This allows you to implement custom validation logic lt form novalidate gt lt Form fields gt lt form gt What is the purpose of the lt iframe gt tag in HTML Answer The lt iframe gt tag is used to embed external content such as web pages or videos within an HTML document lt iframe src width height gt lt iframe gt How can you embed a YouTube video in HTML gt Answer To embed a YouTube video use the lt iframe gt tag with the video s embed code provided by YouTube lt iframe width height src frameborder allowfullscreen gt lt iframe gt Conclusionn this part of our series on tricky HTML interview questions we ve explored important concepts These include making lists with custom styles creating dropdown menus building tables adding tooltips understanding the and elements using for dates and more By learning these you ll be better prepared for technical interviews Stay tuned for the next part where we ll dive into more advanced HTML questions We re curious to hear your thoughts Feel free to share your comments Let s connect on Twitter LinkedIn and GitHub to stay updated and join the conversation |
2023-08-13 06:56:33 |
海外TECH |
DEV Community |
Dive Into Docker part 3: Caching and Building Containers |
https://dev.to/klip_klop/dive-into-docker-part-3-caching-and-building-containers-17lb
|
Dive Into Docker part Caching and Building ContainersUsing Docker image layer caching to our advantage when building docker images can significantly speed up the build process To do this I first structure Dockerfiles in such a way that easily cached steps happen upfront in the build process and the final few steps are copying in application code An example would look like FROM ruby WORKDIR appCOPY package json RUN curl sL bash RUN apt get install y nodejsRUN npm installCOPY Gemfile Gemfile lock RUN bundle installCOPY CMD rails server b This example first sets a working directory then copies in the package json file This will be cached if the package json doesn t change so assuming dependencies have not changed we will get a cache hit and not have to re install dependencies each time Next I ll copy in the Gemfile and Gemfile lock again assuming they haven t changed it will be cache hit so there is no need to update dependencies Now the only thing that should not be a cache hit when creating the resulting image is copying in the application code This should happen fairly quickly and result in a really quick image build Why ephemeral environments Building Docker images in an environment that is not ephemeral can quickly lead to a sprawl of tools and machine specific settings that enable specific builds To eliminate this I prefer to use an entirely ephemeral build system Unfortunately this means re pulling and configuring the environment for each run that s not all that bad though especially with Docker Buildkit Ephemeral runners also ensure that artifacts from previous builds aren t hanging around and consuming storage space This approach also negates the need for the standard cleanup procedures one would use in a typical build pipeline such as clearing old artifacts build logs lingering docker images docker volumes and networks I do like to retain the images from the resulting builds though especially in the case that we would like to keep the history of images built for compliance reasons These are typically stored in an image repository such as ECR or Nexus Docker LayersWhat makes up the final docker image is a composition of its layers Each instruction in a Dockerfile that modifies the filesystem creates a new layer syntax docker dockerfile FROM golang alpineWORKDIR GOPATH src ARG cache invalidatorCOPY go mod go sum RUN go mod downloadCOPY RUN CGO ENABLED GOOS linux go build o go bin webserverENTRYPOINT go bin webserver Quick tip By supplying an argument titled cache invalidator I can easily invalidate the dockerfiles cache by providing it in a build argument such as docker build t golang caching build arg cache invalidator date u Y m dT H M SZ Supplying A datetime in UTC As long as a new argument is supplied the cache is invalidated If the argument matches one that was previously used it will use that layer as a cache This is useful especially when needing to download new security patches if one of the first steps of the Dockerfile is apt get update amp amp apt get upgrade y This can also be a source of frustration if there is a lot of build arguments and you are not sure why the cache is constantly being invalidated If I build the image from the Dockerfile above using the command docker build t golang caching and then inspect the image it shows a total of layers docker build t golang caching docker inspect golang caching jq RootFS Layers grep sha wc l Note To see the Dockerfile used to build the golang alpine image we can inspect it in Dockerhub The reason the resulting image has layers is a combination of the layers from the FROM golang alpine image and then the from the Dockerfile from above WORKDIR does not initially seem like it would add an additional layer but under the hood it is effectively creating and changing into that directory Docker build caching on ephemeral hostsOne of the larger challenges in a build system is caching image layers for future builds This is necessary so that the following builds of an image are significantly sped up This specifically presents a challenge when using hosts that run a single job then disappear Typically only builds done on the same machine are fully cached This is because of how the build cache is built using the build context that was provided at build time Docker BuildKit solves this problem by allowing us to export the cache to a few different storage backends Of course locally or on a shared volume such as an AWS Elastic Filesystem EFS mount would be the fastest but considering price and ease of use I prefer to cache the layers in a AWS S storage bucket Note To use a AWS S storage bucket to store the cache object lock must be turned off Example of the buildkit command to export the full cache to the s backend docker buildx build push t lt registry gt lt image gt cache to type s region us west bucket cicd image cache name app cache mode max cache from type s region us west bucket cicd image cache name app cache output type docker f Dockerfile More options to build with buildkit can be found here Converting the output type back to type docker does take a significant amount of time but is necessary when pushing to AWS s Elastic Container Repository ECR due to the inability to upload the image manifest that is exported by buildkit In my last few blog posts regarding docker I will try to go into more specific examples of caching using a multi stage build I will then give more examples on Dockerfiles that are uniquely hard to cache |
2023-08-13 06:33:16 |
海外TECH |
DEV Community |
JavaScript Intl API: The hidden gem of web internationalization |
https://dev.to/krtirtho/javascript-intl-api-the-hidden-gem-of-web-internationalization-2cd7
|
JavaScript Intl API The hidden gem of web internationalizationLots of time us web devs try to explore multiple libraries frameworks for solution to the biggest reason of debt Internationalization But we often overlook the default browser APIs and how capable these are JavaScript s Intl API is one of those hidden gems If you use Intl half of the time you can avoid those date currency etc formatting amp parsing libraries which are huge impact on the bundle size sometimes The advantage is that the API is designed to be locale agnostic so with internationalization we re also getting localization featuresLearn the difference between internationalization amp localization Formatting DatesWho doesn t remember the days of moment js Thank God date fns and dayjs like libs helped us getting of that bundle of latency Phew But dates can be tricky to format consistently across different locales and require heavy libraries to do soSo the Intl DateTimeFormat object saves the day By specifying locale specific options you can even present dates in a format that s both readable and familiar to users const date new Date const options year numeric month long day numeric const formattedDate new Intl DateTimeFormat en US options format date console log formattedDate Output August or if you give bengali localeconst formattedBnDate new Intl DateTimeFormat bn BD options format date console log formattedBnDate Output আগস্ট Relative Time formattingRelative times are a better UX It lets the user know the time in an instant But formatting relative time is a trouble amp datetime libraries provides us with an easy way to do so But did you know Intl already has an API that does the exact same job amp also respects locale Crazy right See this official example from MDNconst rtf new Intl RelativeTimeFormat en style short numeric always console log rtf format quarter Expected output in qtrs console log rtf format day Expected output day ago const rtf new Intl RelativeTimeFormat es numeric auto console log rtf format day Expected output pasado mañana Number Formatting across LocalesDisplaying numbers in a way that matches each user s language and cultural norms is crucial The Intl NumberFormat object allows you to achieve this effortlessly const number const formattedNumber new Intl NumberFormat bn BD format number console log formattedNumber Output const formattedNumber new Intl NumberFormat ar SA format number console log formattedNumber Output ٬٫ Currency FormattingThere s libraries that can handle currency formatting But the Intl NumberFormat API steps up by providing built in currency formatting eliminating the need for third party libs const amount const currency USD const formattedCurrency new Intl NumberFormat en US style currency currency currency format amount console log formattedCurrency Output PluralizationThe rules for pluralization vary across languages and the Intl PluralRules object helps you manage this intricacy const enOrdinalRules new Intl PluralRules en US type ordinal const suffixes new Map one st two nd few rd other th const formatOrdinals n gt const rule enOrdinalRules select n const suffix suffixes get rule return n suffix formatOrdinals th formatOrdinals st formatOrdinals nd formatOrdinals rd formatOrdinals th formatOrdinals th formatOrdinals st formatOrdinals nd formatOrdinals rd Believe me before Intl PluralRules we needed to utilize a algorithm to stuff like this Sorting Strings GloballyJavaScript alphanumeric sorting is a jock which everyone knows The Array sort works for mostly numbers For alphanumeric strings strings that include both numbers amp letters we need to do some manual works before so it acts correctly For example with sort const strings hundred good strings sort a b gt a localeCompare b console log strings good hundredTo fix this we need Intl Collator with numeric truevar collator new Intl Collator en US numeric true var strings hundred good strings sort a b gt collator compare a b console log strings good hundredBut i doesn t stop there Sorting strings can be surprisingly tricky due to varying language rules also The Intl Collator object comes to the rescue by ensuring your sorting stays true to the user s locale const strings apple banana cherry const collator new Intl Collator es ES const sortedStrings strings sort collator compare console log sortedStrings Output banana cherry apple Easy Time ZonesDealing with time zones can be complex but the Intl DateTimeFormat API simplifies it const date new Date const options year numeric month long day numeric timeZoneName short const formattedDate new Intl DateTimeFormat en US options format date console log formattedDate Output August GMT Embracing User LocaleUnderstanding your users preferred language and formatting preferences is key The Intl Locale object streamlines this process const userLocale new Intl Locale navigator language console log userLocale language Output enconsole log userLocale region Output USBy mastering the Intl API you can create applications that bridge cultural gaps and resonate with a diverse global audience amp fundamentally increases your revenue I hope this guide provides you with insights that can transform your internationalization efforts into a seamless and user centric experience But for full understanding of the API and mastering it visit the official MDN docs My socials X Formerly Twitter GithubDEVCommunity Support me amp my work |
2023-08-13 06:22:53 |
海外TECH |
DEV Community |
EKS Fargate supports additional Ephemeral Storage |
https://dev.to/aws-builders/eks-fargate-supports-additional-ephemeral-storage-6j6
|
EKS Fargate supports additional Ephemeral StorageCustomers can now specify the size in GiB of ephemeral storage that their workloads require using the storage parameter in their pod spec GiB of ephemeral storage is included with every EKS Fargate pod Additional ephemeral storage requested up to GB is charged in GB increments for the duration that the pod is running See the Fargate pricing page for more details Customers with data intensive workloads like machine learning inference data processing or with large container images can now use AWS Fargate with Amazon EKS to reduce their operational burden pay only for the resources used by their applications and get the security benefits of AWS Fargate s built in workload isolation Fargate storageA Pod running on Fargate automatically mounts an Amazon EFS file system You can t use dynamic persistent volume provisioning with Fargate nodes but you can use static provisioning For more information see Amazon EFS CSI Driver on GitHub When provisioned each Pod running on Fargate receives a default GiB of ephemeral storage This type of storage is deleted after a Pod stops New Pods launched onto Fargate have encryption of the ephemeral storage volume enabled by default The ephemeral Pod storage is encrypted with an AES encryption algorithm using AWS Fargate managed keys Note The default usable storage for Amazon EKS Pods that run on Fargate is less than GiB This is because some space is used by the kubelet and other Kubernetes modules that are loaded inside the Pod You can increase the total amount of ephemeral storage up to a maximum of GiB To configure the size with Kubernetes specify the requests of ephemeral storage resource to each container in a Pod When Kubernetes schedules Pods it ensures that the sum of the resource requests for each Pod is less than the capacity of the Fargate task For more information see Resource Management for Pods and Containers in the Kubernetes documentation Amazon EKS Fargate provisions more ephemeral storage than requested for the purposes of system use For example a request of GiB will provision a Fargate task with GiB ephemeral storage |
2023-08-13 06:05:45 |
ニュース |
BBC News - Home |
Suspected package thief pulled from drain after drone finds hiding spot |
https://www.bbc.co.uk/news/world-us-canada-66485045?at_medium=RSS&at_campaign=KARANGA
|
accident |
2023-08-13 06:05:31 |
ニュース |
BBC News - Home |
Co-hosts Australia creating sporting legacy at Women's World Cup |
https://www.bbc.co.uk/sport/football/66487364?at_medium=RSS&at_campaign=KARANGA
|
Co hosts Australia creating sporting legacy at Women x s World CupWhile England fans are already looking ahead to their Women s World Cup semi final Australia was still basking in the glory of one of its greatest sporting moments |
2023-08-13 06:34:00 |
ニュース |
BBC News - Home |
Neal Maupay: Everton condemn social media abuse of striker |
https://www.bbc.co.uk/sport/football/66488893?at_medium=RSS&at_campaign=KARANGA
|
goodison |
2023-08-13 06:12:16 |
IT |
週刊アスキー |
ポケモンスリープ×ピルクル!プレゼントがかわいすぎ♡ |
https://weekly.ascii.jp/elem/000/004/149/4149453/
|
sleep |
2023-08-13 15:35:00 |
コメント
コメントを投稿