IT |
気になる、記になる… |
Microsoft、「Surface Duo 2」向けに2021年12月のアップデートを配信開始 − タッチ操作・カメラなどを改善&新機能も |
https://taisy0.com/2021/12/07/149494.html
|
microsoft |
2021-12-07 12:35:55 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] ポケモンGOに「クリムガン」初登場 色違いが出現しないトラブルも |
https://www.itmedia.co.jp/news/articles/2112/07/news161.html
|
itmedia |
2021-12-07 21:20:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
フォルダでほぼ完結する開発環境を0から整えて実装してみた(Python+VSCocde) |
https://qiita.com/pocokhc/items/105368dc33e3cf534540
|
settingsjson略pythonformattingproviderblack使うフォーマッタpythonファイルのフォーマッタの設定pythoneditorformatOnSavetrueファイル保存時にフォーマッタ実行editorcodeActionsOnSaveisortの実行isortは標準でvscodeに入ってるsourceorganizeImportstrueblackへの引数追加設定pythonformattingblackArgslinelengthdefaultは、はgit向け略pyファイル保存時にblackがインストールされていないと以下のメッセージが出るのでインストールします。 |
2021-12-07 21:36:18 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
yamlファイルを作ってpythonで使用してみる |
https://qiita.com/msh/items/1977ab9cc8169b8fc466
|
yamlファイルを作ってpythonで使用してみる目的yamlファイルの利用になれる注意点yaml実務未経験者が書いているので、不備等あればご指摘いただければ幸いです。 |
2021-12-07 21:20:16 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
【JS】配列操作のまとめ(map, filter, forEach, find, findIndex) |
https://qiita.com/Yuji_6523/items/b84fcaeea8b932d757ac
|
returnで返り値を代入した場合constnumbersconstnewNumbersnumbersforEachnumbergtreturnnumber出力consolelognewNumbersundefinedどんな時に使う返り値を必要とせず、配列内の要素を用いて何かしらの処理を行いたい時mapやfilterなどでは、実現したい処理を実装できない場合使わない方がいいケース配列のループ処理で、返り値を必要とする場合mapやfilterなどで実装できる場合ループ中に中断させるような処理の場合は、適切ではないため、arrayのメソッドのeverysomefindfindIndexを使うように検討する。 |
2021-12-07 21:57:00 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Swiftの画面遷移、Segueとコードについて |
https://teratail.com/questions/372748?rss=all
|
Swiftの画面遷移、Segueとコードについて前提・実現したいことSwiftで開発中なのですが、こちらのボタンについて教えていただきたいです。 |
2021-12-07 21:52:03 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
typescriptのインストールでtsc -vでnot foundと出てくる |
https://teratail.com/questions/372747?rss=all
|
typescriptのインストールでtscvでnotfoundと出てくる前提・実現したいことtypescriptの勉強を始めようとし、ターミナルでnpmnbspinstallnbspgnbsptypescriptを実行したのですがchangednbspnbsppackagenbspandnbspauditednbspnbsppackagesnbspinnbspsfoundnbspnbspvulnerabilitiesとターミナルに出たのでtscnbspvnbspでインストールできているか確かめたのですがzshnbspcommandnbspnotnbspfoundnbsptscと出てきます。 |
2021-12-07 21:39:52 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
ブログのコンテンツなど、データを提供するAPIのURLを取得する |
https://teratail.com/questions/372746?rss=all
|
apinbspurlnbsp |
2021-12-07 21:33:16 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
JavaScriptでオブジェクトが含まれる2つの配列を結合したい |
https://teratail.com/questions/372745?rss=all
|
JavaScriptでオブジェクトが含まれるつの配列を結合したい前提・実現したいことJavaScriptでオブジェクトが含まれる配列の結合をしたいです。 |
2021-12-07 21:28:34 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
AutoCAD Lisp 入力した文字を含む文字オブジェクトの選択 |
https://teratail.com/questions/372744?rss=all
|
|
2021-12-07 21:02:51 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
配列に含まれる重複した要素を取得する |
https://qiita.com/QUANON/items/6b2601f32596bcbb502a
|
animalsselectanimalsindexanimalsrindexuniqgtパフォーマンス比較geminstallbenchmarkipsrequirebenchmarkipsnumbersArraynewsampleBenchmarkipsdoxxreportdonumberseachwithindexinjectdoduplicatednumbersnumberinextduplicatednumbersifduplicatednumbersincludenumberduplicatednumbersltltnumberifnumbersiincludenumberduplicatednumbersendendxreportdonumbersgroupbyampitselfselectsizegtkeysendxreportdonumbersselectnumberscountgtuniqendxreportdonumbersselectnumbersindexnumbersrindexuniqendxcompareend念のためすべての方法の結果が等しいことを確認する。 |
2021-12-07 21:26:42 |
Linux |
CentOSタグが付けられた新着投稿 - Qiita |
Azure の CentOS 8.3 を無料になった Miracle Linux 8.4 にマイグレーションしてみた |
https://qiita.com/mnrst/items/78894f0603a6e3f1402e
|
AzureのCentOSを無料になったMiracleLinuxにマイグレーションしてみた背景と目的CentOSのサポート終了に向けて、既存のCentOSを簡単にMiracleLinuxへマイグレーション出来るのか試してみました。 |
2021-12-07 21:18:32 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
Azure の CentOS 8.3 を無料になった Miracle Linux 8.4 にマイグレーションしてみた |
https://qiita.com/mnrst/items/78894f0603a6e3f1402e
|
AzureのCentOSを無料になったMiracleLinuxにマイグレーションしてみた背景と目的CentOSのサポート終了に向けて、既存のCentOSを簡単にMiracleLinuxへマイグレーション出来るのか試してみました。 |
2021-12-07 21:18:32 |
技術ブログ |
Developers.IO |
re:Invent 期間中の開発者向けのアップデートを話してきました #cmregrowth #reinvent |
https://dev.classmethod.jp/articles/cm-regrowth-2021-developers-updates/
|
cmregrowthonline |
2021-12-07 12:30:28 |
海外TECH |
MakeUseOf |
Where to Learn Piano Online: The 5 Best Free Piano Learning Sites |
https://www.makeuseof.com/tag/top-5-sites-for-learning-piano-online/
|
Where to Learn Piano Online The Best Free Piano Learning SitesCheck out these free piano learning websites If you ve ever dreamed of playing the piano start learning with these free resources |
2021-12-07 12:30:12 |
海外TECH |
MakeUseOf |
3 Ways to Create a Bootable Windows 11 USB With a Mac |
https://www.makeuseof.com/how-to-make-a-bootable-windows-11-usb-on-mac/
|
Ways to Create a Bootable Windows USB With a MacNeed to install Windows from a USB drive but don t have a working Windows PC to create it from Follow this guide to make it with a Mac instead |
2021-12-07 12:00:26 |
海外TECH |
DEV Community |
Simplifying Event Filtering and Value Aggregation with RudderStack |
https://dev.to/rudderstack/simplifying-event-filtering-and-value-aggregation-with-rudderstack-44gc
|
Simplifying Event Filtering and Value Aggregation with RudderStackDealing with event data is dirty work at times Developers may transmit events with errors because of a change a developer made Also sometimes errors could be introduced if the data engineering team decides to change something on the data warehouse schema Due to these changes to the schema data type conflict may occur How can someone deal with all the different event data issues that might arise in a production environment This blog discusses how RudderStack handles event filtering and value aggregation without introducing manual errors RudderStack s solution is a sophisticated mechanism Here you can implement custom logic using JavaScript to define transformations You can apply these transformations to the incoming events Having an expressive environment like RudderStack offers endless possibilities of how a data engineering team can interact with the data In this blog post we will explore just two of the most common use cases we ve encountered among the RudderStack community Event filtering and value aggregation are universal simple to implement yet very powerful User Transformation for Event Filtering and Value AggregationYou can define user transformations in the Configuration Plane of your RudderStack setup Few sample user transformations are available on our GitHub This blog provides an insight into one such sample transformation that you can use for Event Filtering This stops events from passing to a destination You might need to filter events where an organization employs multiple tools platforms for addressing different business requirements Also you may want to route only specific events to specific tool platform destinations Value Aggregation This allows aggregation of values on specific attributes of particular event types You might need to aggregate values where an organization is not looking to employ a tool platform to perform transaction level record keeping and or analysis Instead they want consolidated records analytics So this kind of transformation helps in reducing the network traffic and request message volume This is because the system can replace multiple events of a particular type by a single event of the same type with the aggregated value s This transformation also helps in cost reduction where the destination platform charges by volume of events messages You can view the sample transformation on our GitHub page ImplementationYou need to contain all logic within the transform function which takes an array of events as input and returns an array of transformed events The transform function is the entry point function for all user transformations function transform events const filterEventNames Add list of event names that you want to filter out game load time lobby fps remove events whose name match those in above list const filteredEvents events filter event gt const eventName event event return eventName amp amp filterEventNames includes eventName The code snippet above shows how you can use the filter function of JavaScript arrays to filter out events based on the event name A variation of this code is also possible Here the values in the array of event names are the ones you want to retain and you remove the not condition from the return statement in the penultimate line Below code shows event removal based on a simple check like event name match but more complex logic involving checking the presence of value for a related attribute remove events of a certain type if related property value does not satisfy the pre defined condition in this example if total payment for a spin event is null or then it would be removed Only non null non zero spin events would be considered const nonSpinAndSpinPayerEvents filteredEvents filter event gt const eventName event event spin events if eventName toLowerCase indexOf spin gt if event userProperties amp amp event userProperties total payments amp amp event userProperties total payments gt return true else return false else return true As you can see from the above examples you can use the filtered array available as output from one step as the input to the next As a result you can daisy chain the transformation conditions Finally the following code shows how you can prepare aggregates for specific attributes across events of a particular type present in a batch After this the code returns a single event of the concerned type Also the code returns the aggregated values for the corresponding attributes remove events of a certain type if related property value does not satisfy the pre defined condition in this example if total payment for a spin event is null or then it would be removed Only non null non zero spin events would be considered const nonSpinAndSpinPayerEvents filteredEvents filter event gt const eventName event event spin events if eventName toLowerCase indexOf spin gt if event userProperties amp amp event userProperties total payments amp amp event userProperties total payments gt return true else return false else return true ConclusionIn the above snippet First the code collects the spin result events into an array Then the code aggregates the values for three attributes bet amount win amount and no of spin by iterating over the elements of the above array After this the system assigns the aggregated values to the respective attributes of the first spin result event in the array Now the code separates the events that are not of the target type spin result in this case into another array If there were no such events an empty array is created Finally the system adds the single spin result event to the array created in the previous step and the result is returned Sign up for Free and Start Sending DataTest out our event stream ELT and reverse ETL pipelines Use our HTTP source to send data in less than minutes or install one of our SDKs in your website or app Get started |
2021-12-07 12:55:23 |
海外TECH |
DEV Community |
Creating Super Buttons for Like, Share and Subscribe |
https://dev.to/mohitm15/creating-super-buttons-for-like-share-and-subscribe-gef
|
Creating Super Buttons for Like Share and SubscribeWhenever you watches any YouTube video I m sure you have come across the terms Like Share and Subscribe I wanted to create a cool html css button that represents the feeling of Like Share Subscribe For this we require a html file index html css file style css and javaScript file index js The end result for Like button is like this Setting up the input structureLets get started by setting up the basic structure We had used lt input gt of type checkbox here which is also known as toggle So for our index html file all we need is the following code lt body gt lt label id Likebtn for myBtn class star button onclick fillheart gt lt input type checkbox id myBtn gt lt div class heart gt lt i id un filled heart class far fa heart gt lt i gt lt div gt lt div class btn text gt lt span gt Like lt span gt lt span gt Liked lt span gt lt div gt lt div class active heart gt lt i class fas fa heart gt lt i gt lt div gt lt label gt lt br gt lt script src src index js type text javascript gt lt script gt lt body gt Note just define the fillheart function with a console log statement as of now in index js or under script tag Since we have defined the ids and classes for the html components so now its time to add some styling and animations to them Adding the StylesWe first add styling to input checkbox label star button and the icon Note I have used the cdn link of FontAwesome to use the icons Check here for the cdn link body height vh display grid place items center overflow hidden background rgb input display none star button position relative width px height px margin top px border radius px cursor pointer background rgb z index box shadow px px rgba heart position absolute left top font size px transform translateY color rgb z index Now we add some styling to the text over the button and on the span component of it btn text position absolute left width px height background rgb display flex flex direction row justify content center align items center border radius px overflow x hidden btn text span color rgb transform translateX font size px padding px font family sans serif transition s user select none active heart position absolute right top font size px z index color rgb Now we add the styling to all the corresponding components when the input checkbox is checked input checked heart animation move s ease in forwards color rgb input checked active heart color rgb transition delay s animation shake s s forwards animation delay s input checked btn text span transform translateX transition delay s input checked btn text left In the above code you observed that we have used two types of animation named move and shake for the icon heart So now we define the above mentioned animation using keyframes move animation keyframes move transform translateX scale left opacity transform translateY transform translateX opacity transform translateY left opacity left transform translateY left opacity shake animation keyframes shake transform scaled text shadow px ff px ff transform scaled text shadow px ff px ff transform scaled text shadow px ff px ff transform scaled text shadow px ff px ff transform scaled text shadow px ff px ffb transform scaled text shadow px ff px ff transform scaled text shadow px rgb px rgb Now we only left to add javascript Adding JavaScript LogicEither create a seperate index js file or write within lt script gt in index html Add the following code let myBtn document getElementById myBtn function fillheart if myBtn checked document getElementById un filled heart setAttribute class fas fa heart else document getElementById un filled heart setAttribute class far fa heart ConclusionCheers you have build the SuperLike button Now you can come up with as many stylings to this small application You can take up some challenges by making SuperShare and SuperSubcribe button as given below SuperShare SuperSubscribeThank you for your time Since this is my second post please share your valuable feedback in comments also Happy Coding ️ |
2021-12-07 12:46:59 |
海外TECH |
DEV Community |
Top 10 DevOps Tools You Should Know |
https://dev.to/kuldeeptarapara/top-10-devops-tools-you-should-know-4nb8
|
Top DevOps Tools You Should KnowDevOps is a method to integrate IT operations and software development So in this article we will see the Top DevOps Tools You Should Know for Flutter App Development Top DevOps Tools You Should Know DevOps allows businesses to use automation to release new software and make changes to their users as soon as possible Due to the rapid adoption of DevOps practices the demand for DevOps tools is very high DevOps software tools ensure that automation transparency and collaboration are top priorities These tools provide teams with a variety of options for efficiently sharing and exchanging data and technical knowledge among all involved parties in order to develop efficient products Nowadays many DevOps automation tools are available to suit your DevOps needs Take a look at these important DevOps automation tools for Kubernetes or KsKubernetes is an open source system to automate the deployment scaling and management of containerized applications This open source system treats containers extensively and seeks to take containerization to another level Manage containerized apps in logical units to facilitate discovery and management scaling and deployment automation DockerDocker is a lightweight DevOps tool that uses a combination of methods to simplify and accelerate various SDLC workflows A Docker container image is an applicable standalone package that contains everything you need to run your app You can access the container using the Docker Engine This allows the app to run in a remote environment NagiosThis is another popular DevOps tool that acts as a watchdog for your infrastructure and your entire system The IT infrastructure monitoring team uses Nagios to troubleshoot infrastructure related issues and provide solutions before the team is at risk Therefore monitor databases networks logs apps and event logs AnsibleThis tool was developed for automation processes and collaboration Increase productivity by helping you integrate and automate testing development performance management and deployment Ansible makes it easy to automate the entire IT process and app lifecycle Ansible contains several modules to enable various apps You can avoid complexity at all stages GitGit is one of the most affordable tools for open source workers and remote teams It is also one of the most popular and widely used DevOps tools This is a distributed source code management SCM tool that developers can use to track the progress of app development by maintaining different source code versions Developers can easily revert to previous versions if needed BitBucket and GitHub are currently two popular hosting services in Git repositories BitBucket provides an unlimited private repository for teams of up to members GitHub on the other hand only provides free access to public repositories PuppetThis open source tool is designed to quickly monitor manage and maintain your infrastructure As the most successful cross platform configuration management tool Puppet can be deployed safely and quickly It s also the perfect DevOps program for handling multiple servers The puppet contains a master slave infrastructure It allows you to manage many resources and teams Includes various modules that facilitate problem management and combine with other popular DevOps tools By treating the entire infrastructure as code Puppet can automate infrastructure management SeleniumSelenium is primarily used to automate web based apps You can automate testing and management tasks for web based apps It consists of three main components Grid Run tests on different devices to extend your testing work and handle many environments from the core IDE is a Firefox and Chrome add on that makes it easy to record and play browser actions You can create your own browser based regression automation suite to help you examine WebDriver scripts and distribute them to multiple sources PrometheusPrometheus is an open source community driven toolkit for monitoring systems and performance It is based on a time series data model and generates warnings based on this In addition it also supports container monitoring The Prometheus monitoring process is widely used by the entire DevOps team and cloud organizations SplunkThis DevOps tool provides a great analytical solution with a functional understanding that gives the DevOps team operational awareness This allows you to compare logs from various sources such as devices websites and applications that are part of your entire IT infrastructure to identify problems Splunk is the perfect platform for a smooth entry into IoT integration It collects and interprets data and provides insights to help you make systematic business decisions JenkinsJenkins is a persistent built in server tool that you can use to run various jobs repeatedly This software is provided on the main server where the software development takes place As the leading open source automation server the Jenkins automation engine allows DevOps teams to easily access and integrate project changes and quickly identify problems Jenkins is tailored for projects of all sizes and complexity Written in Java Jenkins has hundreds of add ons and plugins Conclusion There are many DevOps tools are available for DevOps development In this article we have listed the Top DevOps Tools You Should Know The choice of tool which you want to choose will depend on the teams involved and the environment Do let us know your feedback comments on the same Flutter Agency is the best Flutter App development company dedicated to Flutter Technology and Flutter Developers The portal is full of cool resources from Flutter like Flutter Widget Guide Flutter Projects Code libs and etc So contact us for your next project |
2021-12-07 12:31:40 |
海外TECH |
DEV Community |
How to join MySQL and Postgres in a live materialized view |
https://dev.to/bobbyiliev/how-to-join-mysql-and-postgres-in-a-live-materialized-view-5864
|
How to join MySQL and Postgres in a live materialized view IntroductionThis is a self contained demo using Materialize This demo would show you how to use Materialize to join MySQL and Postgres in a live materialized view For this demo we are going to monitor the orders on our demo website and generate events that could later on be used to send notifications when a cart has been abandoned for a long time PrerequisitesBefore you get started you need to make sure that you have Docker and Docker Compose installed You can follow the steps here on how to install Docker Installing Docker OverviewAs shown in the diagram above we will have the following components A mock service to continually generate orders The orders would be stored in a MySQL database As the database writes occur Debezium streams the changes out of MySQL to a Redpanda topic We also would have a Postgres database where we would get our users from We would then ingest this Redpanda topic into Materialize directly along with the users from the Postgres database In Materialize we will join our orders and users together do some filtering and create a materialized view that shows the abandoned cart information We will then create a sink to send the abandoned cart data out to a new Redpanda topic You could later on use the information from that new topic to send out notifications to your users and remind them that they have an abandoned cart As a side note here you would be perfectly fine using Kafka instead of Redpanda I just like the simplicity that Redpanda brings to the table as you can run a single Redpanda instance instead of all of the Kafka components Running the demoFirst start by cloning the repository git clone After that you can access the directory cd mz abandoned cart demoLet s start by first running the Redpanda container docker compose up d redpandaBuild the images docker compose buildFinally start all of the services docker compose up dIn order to Launch the Materialize CLI you can run the following command docker compose run mzcliThis is just a shortcut to a docker container with postgres client pre installed if you already have psql you could run psql U materialize h localhost p materialize instead Create a Materialize Kafka SourceNow that you re in the Materialize CLI let s define the orders tables in the mysql shop database as Redpanda sources CREATE SOURCE ordersFROM KAFKA BROKER redpanda TOPIC mysql shop orders FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY http redpanda ENVELOPE DEBEZIUM If you were to check the available columns from the orders source by running the following statement SHOW COLUMNS FROM orders You would be able to see that as Materialize is pulling the message schema data from the Redpanda registry it knows the column types to use for each attribute name nullable type id f bigint user id t bigint order status t integer price t numeric created at f text updated at t timestamp Create materialized viewsNext we will create our first Materialized View to get all of the data from the orders Redpanda source CREATE MATERIALIZED VIEW orders view ASSELECT FROM orders CREATE MATERIALIZED VIEW abandoned orders AS SELECT user id order status SUM price as revenue COUNT id AS total FROM orders view WHERE order status GROUP BY You can now use SELECT FROM abandoned orders to see the results SELECT FROM abandoned orders For more information on creating materialized views check out the Materialized Views section of the Materialize documentation Create Postgres sourceThere are two ways to create a Postgres source in Materialize Using Debezium just like we did with the MySQL source Using the Postgres Materialize Source which allows you to connect Materialize direct to Postgres so you don t have to use Debezium For this demo we will use the Postgres Materialize Source just as a demonstration on how to use it but feel free to use Debezium instead To create a Postgres Materialize Source run the following statement CREATE MATERIALIZED SOURCE mz source FROM POSTGRESCONNECTION user postgres port host postgres dbname postgres password postgres PUBLICATION mz source A quick rundown of the above statement MATERIALIZED Materializes the PostgreSQL source s data All of the data is retained in memory and makes sources directly selectable mz source The name for the PostgreSQL source CONNECTION The PostgreSQL connection parameters PUBLICATION The PostgreSQL publication containing the tables to be streamed to Materialize Once we ve created the PostgreSQL source in order to be able to query the PostgreSQL tables we would need to create views that represent the upstream publication s original tables In our case we only have one table called users so the statement that we would need to run is CREATE VIEWS FROM SOURCE mz source users To see the available views execute the following statement SHOW FULL VIEWS Once that is done you can query the new views directly SELECT FROM users Next let s go ahead and create a few more views Create Kafka sinkSinks let you send data from Materialize to an external source For this Demo we will be using Redpanda Redpanda is a Kafka API compatible and Materialize can process data from it just as it would process data from a Kafka source Let s create a materialized view that will hold all of the high volume unpaid orders CREATE MATERIALIZED VIEW high value orders AS SELECT users id users email abandoned orders revenue abandoned orders total FROM users JOIN abandoned orders ON abandoned orders user id users id GROUP BY HAVING revenue gt As you can see here we are actually joining the users view which is ingesting the data directly from our Postgres source and the abandond orders view which is ingesting the data from the Redpanda topic together Let s create a Sink where we will send the data of the above materialized view CREATE SINK high value orders sink FROM high value orders INTO KAFKA BROKER redpanda TOPIC high value orders sink FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY http redpanda Now if you were to connect to the Redpanda container and use the rpk topic consume command you will be able to read the records from the topic However as of the time being we won t be able to preview the results with rpk because it s AVRO formatted Redpanda would most likely implement this in the future but for the moment we can actually stream the topic back into Materialize to confirm the format First get the name of the topic that has been automatically generated SELECT topic FROM mz kafka sinks Output topic high volume orders sink u For more information on how the topic names are generated check out the documentation here Then create a new Materialized Source from this Redpanda topic CREATE MATERIALIZED SOURCE high volume orders testFROM KAFKA BROKER redpanda TOPIC high volume orders sink u FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY http redpanda Make sure to change the topic name accordingly Finally query this new materialized view SELECT FROM high volume orders test LIMIT Now that you have the data in the topic you can have other services connect to it and consume it and then trigger emails or alerts for example MetabaseIn order to access the Metabase instance visit http localhost if you are running the demo locally or http your server ip if you are running the demo on a server Then follow the steps to complete the Metabase setup Make sure to select Materialize as the source of the data Once ready you will be able to visualize your data just as you would with a standard PostgreSQL database Stopping the DemoTo stop all of the services run the following command docker compose down ConclusionAs you can see this is a very simple example of how to use Materialize You can use Materialize to ingest data from a variety of sources and then stream it to a variety of destinations As a second part of this demo we will build upon the current demo and add more functionality to make represent a more realistic eCommerce website and a more realistic data pipeline To learn more about SQL I could suggest this free eBook here Introduction to SQL eBook Helpful resources CREATE SOURCE PostgreSQLCREATE SOURCECREATE VIEWSSELECT |
2021-12-07 12:27:48 |
海外TECH |
DEV Community |
Using Elixir's "with" statement. |
https://dev.to/martinthenth/using-elixirs-with-statement-5e36
|
Using Elixir x s quot with quot statement Elixir has many features to make code readable maintainable and correct One of them is the with statement Unfortunately the with statement can be confusing to work with because there are some hidden assumptions on how it s used Today I will introduce you to why where and when you would want to use a with statement and how you can deal with some of the challenges and underlying assumptions Additionally you ll read about a readability and differentiation trick using annotation tuples The worst case The use case for with statements is apparent when we look at the worst case statement implementation Nesting case statements quickly leads to a pyramid of unreadable code literally tilt your head ° case is email address email do true gt case String length code do true gt case EmailConfirmations get email confirmation email do EmailConfirmation gt case EmailAddresses get email address email do nil gt case Users create user data do ok user gt case EmailAddresses create email address user email do ok email address gt error error gt error end error error gt error end email address gt error end nil gt error end false gt error end false gt errorendWhat this code does well is matching all possible returns from every function that is called therefore the code is correct What this code does badly is it s unreadable for you me and any other developer looking at it We need something better to maintain readability while keeping the case statement s functionality and correctness Simple with statements with statements work like case statements but with a focus on successful function call results The following statements are equivalent case Users create user attrs do ok user gt error changeset gt endwith ok user lt Users create user attrs do else error changeset gt endLet s see some examples Implicit handling of non matching results with statements do not need to handle non matching clauses Instead the with statement will return the non matching clause directly to the parent scope The Phoenix framework comes with context generators that will output controller functions with with statements like this def create conn params do with ok user lt Users create user params do conn gt put status accepted gt render show json user user endendWhere the function Users create user can return either ok user or error changeset As you can see the clause error changeset is not caught in the with statement Let s see what this with statement does When the expected clause matches because it is ok user we continue with the function inside the with statement and user is available within the scope When the expected clause does not match for example we receive error changeset then the result is immediately returned to the parent scope i e create Therefore the function create returns either the result of the successful clause an updated conn or error changeset Explicit handling of non matching results We can explicitly handle the non matching clauses in a with statement by using the else clause The else clause requires us to pattern match on all non matching results def create conn params do with ok user lt Users create user params do conn gt put status accepted gt render show json user user else error changeset gt error changeset endendThis does the same as the previous example It will return either the result of the successful clause an updated conn or error changeset Because we are explicitly handling non matching clauses we must add pattern matches for all non matching clauses in the else block If we miss a returned clause we will receive a WithClauseError no with clause matching error This is the reason why Dialyzer will complain The pattern can never match the type because if a returned clause is not explicitly handled it may crash the process at runtime Chained functions in with statements Chaining function calls in a with statement is fairly straightforward We can rewrite the case pyramid from the introduction by chaining the consecutive expressions in a with statement Returns or error with true lt is email address email true lt String length code EmailConfirmation lt EmailConfirmations get email confirmation email nil lt EmailAddresses get email address email ok user lt Users create user data ok email address lt EmailAddresses create email address user email do endMuch cleaner and shorter than the original And with syntax highlighting in an IDE this code will be much more readable Challenges In the previous examples we always return error when a function call does not return the desired result But this is rarely what we want in practice We may want to differentiate between similar clauses in the else block We need to handle all non matching clauses in the else block of every chained function call or we will introduce app crashing bugs Dialyzer will definitely complain if any of the functions does not return an expected clause i e error in this example Advanced with statements Let s add custom error handling differentiation of function calls and results and readability improvements Custom error handling Let s introduce some custom error handling to the rewritten case pyramid in a with statement with true lt is email address email true lt String length code EmailConfirmation lt EmailConfirmations get email confirmation email nil lt EmailAddresses get email address email ok user lt Users create user data ok email address lt EmailAddresses create email address user email do else false gt error bad request nil gt error not found EmailAddress gt error conflict error changeset gt error changeset endGreat Now we can return different error messages depending on which non matching clause is returned But what if the with statement has multiple functions that return the same non matching results and we want to handle each return differently For example when two functions can return false and one version must return error bad request and the other must return error conflict like so with true lt is email address email true lt EmailAddresses is available email do else false gt Return either error bad request or error conflict endLet s see how we can differentiate the returned false clause Differentiating non matching clauses We can use a simple mathematical trick to differentiate the returned results If x y z then x y c z c must be true as well Therefore we can add some annotation tuples to the function calls and clauses and write the previous example as with is email true lt is email is email address email is available true lt is available EmailAddresses is available email do else is email false gt error bad request is available false gt error conflict endBy using tuples on both sides of the function calls we can differentiate the returning values Improving readability for large with statements We can improve readability of large with statements by using the trick from the previous section That is by annotating function calls and pattern matches in the with and else block with tuples Let s rewrite the case pyramid with statement with annotation tuples with is email true lt is email is email address email is code true lt is code String length code confirmation fetch EmailConfirmation lt confirmation fetch EmailConfirmations get email confirmation email email fetch nil lt email fetch EmailAddresses get email address email user create ok user lt user create Users create user data email create ok email address lt email create EmailAddresses create email address user email do else false gt error bad request confirmation fetch nil gt error not found email fetch EmailAddress gt error conflict error changeset gt error changeset endIn this with statement we chain six functions and add the following tuples to make the code more readable is email is code confirmation fetch email fetch user create and email create Once again in an IDE with syntax highlighting this will look much better Common issues and how to solve them Be mindful of all the possible returned values from the functions you call in a with statement Properly handling matching and non matching clauses will solve most of your issues Use formatting to make with blocks more readable Use the else block in a with statement to handle non matching results manually Always pattern match all possible returned non matching values in else blocks to prevent app crashing bugs Use pattern matches on structs For example with User is banned false lt Users get user id do To differentiate function calls and results annotate the function call and their results with tuples e g is email true and is available true To make large with statements more readable consider annotating function calls and their results with tuples e g user fetch user and user update updated user Dialyzer may show the warning The pattern can never match the type This means you ve missed a result from one or multiple of the called functions in the else block Add the missing return clause and the warning will resolve I hope you learned something today I m a big fan of Elixir s with clause and of all the other readability maintainability and code correctness features that Elixir offers The next post will be about Dialyzer and why you should always use it for development Follow me to get a notification in January |
2021-12-07 12:22:04 |
海外TECH |
DEV Community |
Emoji Bug in Heading Tags or Wherever The Emoji Has 500+ Font Weight 🤔 |
https://dev.to/syaufy/emoji-bug-in-heading-tags-or-wherever-the-emoji-has-500-font-weight-533n
|
Emoji Bug in Heading Tags or Wherever The Emoji Has Font Weight Well well wellHave you realized it This started weeks ago when I created a landing page for my app I noticed that the emoji on my landing page suddenly turned black and white I searched for a solution for several hours and realized that the emojis in the p tags are still the same but the heading h h h tags and tags that have a font weight class that has a value of and above will create emojis are black and white Bugged emoji because the bold font weight I try to change the font weight to and it works and the emoji has a color nowBut how to get emoji color without losing the tags font weight Well you can go use span between the emojis and make write the inline style to make the span has a font weight img alt Well you can go use span between the emojis and make write the inline style to make the span has a font weight height src dev to uploads s amazonaws com uploads articles yzqrgrmhmfbix png width Have you experienced it too or is it just me experiencing it Let me know in the comments |
2021-12-07 12:15:58 |
海外TECH |
DEV Community |
Get Comfortable With CSS Selectors |
https://dev.to/cesscode/get-comfortable-with-css-selectors-1b8p
|
Get Comfortable With CSS SelectorsHTML and CSS to a front end developer are like a knife and a fork to a chef The more you get used to using HTML and CSS skills together the better a front end developer you will become And the best way to learn how to use these skills together is to understand the different CSS Selectors This blog will look at the different types of CSS selectors and how you can use them to build efficient CSS code let s get started What are CSS Selectors CSS selectors is the opening part of a CSS ruleset it determines how you apply styles to HTML elements on a web page There are many different types of CSS selectors each with its own unique syntax These tell the browser which elements to apply CSS property values to The element or elements targeted by a CSS selector are the “subject of the selector You can select a subject based on its element type class ID name or pseudo state CSS selectors are case sensitive they must match element names and attribute values exactly A coding class selector is not the same as CODINGIt is advisable to use small letters to avoid making mistakes The syntax for CSS Selector is selector CSS property value There are two types of CSS selectors Basic CSS selectors Advanced CSS selectors BASIC CSS SELECTORSBasic CSS selectors are the most common type of CSS selectors They style specific elements on a website in the basic selectors we have selectors such as CSS class SelectorsCSS ID SelectorsElement Type SelectorsCSS Universal Selectors The CSS Class SelectorThe CSS class selector identifies an element based on its class attribute You can use CSS class selectors to style many HTML elements You can use the CSS class selector on any HTML element To select elements with a specific class write a period character followed by the class name The syntax for CSS Class Selector is class name property value Examples of CSS Class selector In the example below ️the lt p gt element has a class text lt p class text gt When will manchester united win a trophy again lt p gt To select the lt p gt element using the CSS class selector we text text align center color orange font size px All Html element with class text will align to the center have orange text color and a font size of px Remember you can use the CSS class selector to style many HTML elements right let us see how it works I want both the lt p gt and the lt button gt element to have the same exact CSS style so I give both the same class code lt h gt Football lt h gt lt p class code gt When will manchester united win a trophy again lt p gt lt h gt Rejoice lt h gt lt button class code gt Submit lt button gt I hope you noticed that both the lt p gt and the lt button gt element have the same class code in the above example code text align center color green font size px The lt p gt and lt button gt in the example above will have the same text color font size and will align to the center of the web page You can also specify that a class should affect only a specific HTML elementIn the example below ️both the lt p gt and the lt button gt element have the same class code lt h gt Football lt h gt lt p class code gt When will manchester united win a trophy again lt p gt lt h gt Rejoice lt h gt lt button class code gt Submit lt button gt I want to style only the lt p gt element How do we do that Remember both the lt p gt and lt button gt have the same class name p code text transform capitalize color orange font size px In the example above only paragraph lt p gt elements with class code will be orange and have a font size of px It won t affect the lt button gt element The CSS Id SelectorThe CSS Id selector identifies an element based on its ID attribute ID selector is unique and you should only use them once per page to select one unique element To select an element with a specific id write a hash character followed by the id of the element The syntax for CSS id Selector is id name property value Example of CSS Id SelectorIn the example below the lt p gt element has a id coding lt p id coding gt football is no longer fun lt p gt To select the lt p gt element using the CSS Id selector we coding text align center color red In the example above the CSS rule will apply to the HTML element with id coding Remember that the Id Class selector is a unique identifier It means that in an HTML document you can t have more than one element with the same id you can only select one element Use Id selectors rarely and only on elements that need to always appear the same What Is the Difference Between CSS Class selectors and Id selector You can repeat the same CSS class selector value across many Html elements but you can only use an ID once Element Type SelectorsElement Type Selectors are the most common basic CSS selectors They select HTML elements based on the element name The syntax for Element Type Selector is element property value Example of Element Type Selectors p text align center font size px color red In the above example all paragraph lt p gt elements will align to the center have a font size of px and text color of red The CSS Universal SelectorThe universal selector selects all HTML elements on the page Every HTML element from the lt header gt to the lt footer gt follows the universal selector s style The asterisk character represents Universal selectors The syntax for Universal Selector is CSS Property value Example of CSS Universal Selector text align center text transform Uppercase Every single element on the web page will align to the center of the page and have uppercase letters The CSS Grouping SelectorCSS grouping selectors select all the HTML elements with the same style definitions CSS grouping selectors save time and help you to write clearer codes You may want to apply the same exact styles to several Html components at times For example all your lt h gt lt h gt and lt h gt elements should have a red background a font weight of and a font size of px One approach is to style each HTML element in your CSS stylesheet lt h gt lt h gt and lt h gt as different selectors There s nothing wrong with this but if you do it you ll get a CSS stylesheet full of repeated declarations A better solution is to use one CSS ruleset with many declarations separated by a comma Take a close look at the CSS codes below ️ you ll see that the lt h gt lt h gt and lt h gt elements all have the same CSS style h background color red color white font weight font size px text align center h background color red color white font weight font size px text align center h background color red color white font weight font size px text align center In the example above ️we gave lt h gt lt h gt lt h gt the same exact CSS style will it work that way Yes it will work but it will be better to group the selectors to avoid repetition and make our codes easier to read To group selectors we separate each selector with a comma Let s group the above CSS codes with a Comma h h h background color red color white font weight font size px text align center It s possible for us to use comma to group them together because lt h gt lt h gt lt h gt have the same exact CSS styles The selectors don t have to match before you group them as long as you give them the same exact CSS styling For example we can group lt h gt with lt button gt with lt p gt as long as we give them the same styles We can also group a CSS Class selector with ID selectors if we want them to have the same exact CSS styling lt h id tech gt Coding is life lt h gt lt p class future gt Coding is fun lt p gt To group the above Example tech future font size px color red text transform capitalize Remember we use the Comma cause we want them to have the same exact CSS style What do we do when lt h gt lt h gt and lt h gt have a few comparable CSS stylings but different font sizes and colors group the selectors cause they have the same styles h h h text align center text transform uppercase apply individual styles to all selectors h font size px color red h font size px color orangered h font size px color green h h and h all have text align center text transform uppercase so I grouped them font size and color are different for h h h so I applied the font size and color to all three selectors I hope you understand basic CSS selectors Let s move on to Advanced CSS Selectors ADVANCED CSS SELECTORSAdvanced CSS selectors enable us to do more than what Basic CSS allows us to do In advanced CSS selectors we have the following Combination Selectors Pseudo class selectors CSS Attribute Selectors COMBINATION SELECTORSCombination Selectors select elements based on a specific relationship between them There are types of combination selectors Descendant selectors Child selectors Adjacent sibling selectors General sibling selectors CSS selectors rely on the HTML Family Tree It s vital to grasp the relationships between HTML elements before I go further The HTML family tree is also referred to as the HTML document tree The family tree consists of descendants parents children and sibling elements A parent element contains other elements The child element is an element that is immediately contained by another element A sibling is an element that shares the same parent with another element lt div gt lt img src alt gt lt article gt lt h gt coding is life lt h gt lt p gt Code everyday lt p gt lt article gt lt aside gt lt h gt Make out time to take care of yourself as a developer lt h gt lt p gt It s okay to read something else other than a coding book lt p gt lt aside gt lt div gt In the example above The lt div gt is the parent The lt img gt in line lt article gt in line and the lt aside gt element in line are the children of the lt div gt The lt article gt element in line is the parent of the lt h gt in line and the lt p gt element in line The lt h gt in line and the lt p gt element in line are siblings with the same parent lt article gt element The lt h gt in line and the lt p gt element in line are the children of the lt article gt and the grandchildren of the lt div gt elementThe lt aside gt element in line is the parent of the lt h gt in line and the lt p gt element in line Let s take a look at each of these selectors one by one using examples to help us grasp how they function Descendant Combinator SelectorsDescendant Combinator selectors match all elements that are descendants of a specified element Descendant Combinator selectors select the children grand children e tc when used To select Descendants use multiple selectors separated by spaces The syntax for Descendant Combinator Selector is selector selector property value Example f Descendant Combinator selector lt h gt Coding is Fun lt h gt lt article gt lt h gt Cess The Frontend Web developer lt h gt lt p gt I will be working as a full time frontend web developer by this time next year lt p gt lt div gt lt h gt Coding is life lt h gt lt p gt I prefer using CSS flexbox to Grid lt p gt lt div gt lt article gt In the above example lt h gt element in line is outside the lt article gt element lt h gt in line lt p gt in line and lt div gt elements in line are the children of the lt article gt element lt h gt in line and lt p gt element in line are the children of the lt div gt element in line which makes them the grandchildrenof the lt article gt elementRemember Descendant selector selects both the children and the grand children when used let s style all the lt h gt inside the article element using the Descendant selector article h text align center color orange font size px The above ️example selects all lt h gt elements within the lt article gt element because they are within the lt h gt element Child Combinator SelectorsChild selectors match an element that is an immediate child of another element The Child Combinator Selectors selects only the child elements Child combinator selector does not select the grandchildren elements like the Descendant selector The greater than sign gt character is often used to represent a child selector You place the greater than sign gt between the parent and child element The syntax for Child Combinator Selector is Parent selector gt Child selector property value Example f Child Combinator selector lt h gt Coding is Fun lt h gt lt article gt lt h gt Cess The Frontend Web developer lt h gt lt p gt I will be working as a full time frontend web developer by this time next year lt p gt lt div gt lt h gt Coding is life lt h gt lt p gt I prefer using CSS flexbox to Grid lt p gt lt div gt lt article gt Styling the above ️Html code article gt h text align center color orange font size px The above ️example will target only the lt h gt element in line cause it falls within the lt article gt element It will ignore any lt h gt that is outside of the lt article gt element or contained inside another element What is the difference between Descendant Combinator Selector and Child Combinator Selector The child combinator selector gt targets an element that is a child of its parent It does not target descendants beyond the children The descendant combinator selects all the children or grandchildren of a given element Adjacent sibling selectorsThe Adjacent sibling selects an element that is after another specific element Sibling elements must have the same parents They must be immediately following each other The plus character represents adjacent sibling selectors The syntax for Adjacent sibling selector is first sibling selector second sibling selector property value The way you read this combinator is from right to left The first sibling element comes first The second sibling element comes second and is the targeted element the targeted element is the element you intend styling Example f Adjacent sibling selector lt h gt Coding is Fun lt h gt lt article gt lt h gt Cess The Frontend Web developer lt h gt lt p gt I will be working as a full time frontend web developer by this time next year lt p gt lt div gt lt h gt Coding is life lt h gt lt div gt lt article gt Styling the above ️Html code h P text align center color orange font size px The above ️example will target only the lt p gt element in line It is exactly after the lt h gt element and they both share the same parent element Remember the Adjacent sibling selects the second sibling when it appears right after the first sibling element and they share the same parent General sibling selectorsGeneral sibling selectors select the elements that follow and share the same parent It is not necessary that the second element immediately follows the first element The tilde character represents general sibling selectors The syntax for General sibling selector is first sibling selector second sibling selector property value The first sibling element comes first The second sibling element comes second and is the targeted element The targeted element is the element you intend styling Example f General sibling selector lt h gt Coding is Fun lt h gt lt article gt lt h gt Cess The Frontend Web developer lt h gt lt img src alt gt lt p gt I will be working as a full time frontend web developer by this time next year lt p gt lt div gt lt h gt Coding is life lt h gt lt div gt lt article gt Styling the above ️Html code h p text align center color orange font size px The above ️example will target only the lt p gt element in line It is exactly after the lt h gt element in line and they both share the same parent element General sibling selector will operate when both sibling elements have the same parent As long as the siblings have the same parent it doesn t matter if they are born immediately after each other CSS ATTRIBUTE SELECTORSAttribute selectors select all elements that have a given attribute or attribute value An attribute is a piece of the markup language used to change how an HTML element behaves or displays You include attributes in an HTML element s opening tag Example lt a href target blank gt Connect with me on twitter lt a gt In the example above target blank is an attribute of the anchor tag The syntax for Attribute Selector is selector attribute property value There are types of Attribute selectors Present Attribute SelectorEquals Attribute SelectorBegins With Attribute Selector Ends With Attribute Selector Contains Attribute Selector Attribute Spaced Attribute Selector Hyphen Attribute Selector Present Attribute SelectorPresent attribute selector select elements with a specified attribute The syntax for Present Attribute Selector is selector attribute property value Example f Present attribute selector lt a href target blank gt Code everyday lt a gt Styling the above ️Html code a target color orange font size px The CSS styles above ️will work on any lt a gt element with a target attribute Styles will not apply to all other a elements that don t have a target attribute Equals Attribute SelectorEquals attribute selectors select elements with a specified attribute and value The equals character represents Equals attribute selectors The syntax for Equals Attribute Selector is selector attribute value property value Example f Equals attribute selector lt a href www codecademy com target blank gt Code everyday lt a gt Styling the above ️Html code a href www codecademy com color orange font size px The example above ️will find any lt a gt element with a href attribute set to www codecademy com and apply the CSS styles to it Begins With Attribute SelectorBegins with selector select elements whose attribute value begins with a specific value You don t have to write down the whole word of the value you specify when using Begins with selector The circumflex accent character represents Begins with selector The syntax for Begins with selector is selector attribute value property value Example f Begins with attribute selector lt a href target blank gt Code everyday lt a gt Styling the above ️Html code a href https color orange font size px The example above ️will find any lt a gt element with a href attribute that starts with https and apply the CSS styles to it Ends With Attribute SelectorEnds with selector select elements whose attribute value ends with a specific value You don t have to write down the whole word of the value you specify when using Ends with selector Ends with selector is the opposite of the begins with selector The dollar sign character represents Ends with selectorThe syntax for Ends with selector is selector attribute value property value Example f Ends with attribute selector lt a href gt Code documentation lt a gt Styling the above ️Html code a href pdf color orange font size px The example above ️will find any lt a gt element with a href attribute that ends with pdf and apply the CSS styles to it Attribute spaced SelectorAttribute spaced Selector is also called white space attribute selector It matches any element whose attribute value is a list of space separated values One of the values used will be equal to any of the values in the space separated values By space seperated values I mean attribute values like class fun coding The tilde character represents the attribute spaced selector The syntax for Attribute spaced selector is selector attribute value property value Example f Attribute spaced selector lt a href rel tag nofollow gt Code documentation lt a gt Styling the above ️Html code a rel tag color orange font size px The example above ️will find any lt a gt element with a rel attribute with a value of tag and apply the CSS styles to it Contains Attribute SelectorContains attribute selector select elements whose attribute value contains a specified value The asterisk character represents Contains Attribute selectorThe syntax for Contains Attribute selector is selector attribute value property value Example f Contains Attribute selector lt a href signin com gt Code documentation lt a gt Styling the above ️Html code a href signin color orange font size px The CSS styles will work on any lt a gt element with a href attribute that contains a value of signin Hyphen Attribute SelectorHyphen attribute selector select elements with the specified attribute starting with the specified value It selects all elements whose attribute has a hyphen seperated list of values The value has to be a whole word either alone like class top or followed by a hyphen like class top text The vertical line character represents Hyphen Attribute SelectorThe syntax for Hyphen Attribute Selector is selector attribute value property value Example f Hyphen Attribute selector lt a href lang en US gt Code documentation lt a gt Styling the above ️Html code a lang en color orange font size px The CSS styles will work on any lt a gt element with a lang attribute that contains a value of en It matches the elements with the lang attribute that has the values en en US en GB and so on but not US en GB en PSEUDO SELECTORSThere are two types of pseudo selectors Pseudo Class Selectors Pseudo Element Selectors PSEUDO CLASS SELECTORSA pseudo class is used to define a special state of an element For example it can be used to style an element when a user mouses over it style visited and unvisited links style an element when it focus wschools Pseudo class names are not case sensitive Hover is the same as hover I will advise you always use small letters when writing selectors The colon character represents Pseudo class selectors The syntax for Pseudo class selector is selector pseudo class property value There are main types of Pseudo class selectors User Action Pseudo classes link Pseudo classes Structural And Positional Pseudo classes USER ACTION PSEUDO CLASSESUser Action Pseudo classes works when the user interacts with your web page The most used User Action Pseudo classes are hover hover works when the user moves their cursor over an element but does not select it The syntax for hover selector is selector hover property value In the example above the color of the link will change to red when you hover over the link ActiveThe active selector is used to select and style the active link A link becomes active when you click on it active selector can be used on all elements not only links The syntax for active selector is selector active property value focusThe focus selects an element that is being focused on by the user focused on by the user means it accepts keyboard or any other user input It works on user input elements used in forms and is triggered as soon as the user clicks on it The syntax for focus selector is selector focus property value The background color of the input field when focused changes to yellow in the example above ️ link Pseudo classesThere are two link pseudoclasses linkLink Pseudo class selector selects a link that the user has not visited before The syntax for link selector is selector link property value visited visited selects a link that the user has clicked on Use them to control the colors of the links and also whether they are to appear underlined or not The syntax for visited selector is visited property value visited can be overridden by a link pseudo class with equal specificity If there are two or more conflicting CSS rules that point to the same element the browser follows some rules to determine which one is most specific and therefore wins out Think of specificity as a score rank that determines which style declarations are ultimately applied to an element Wschools To make link pseudo class work It is advisable to use the LVHA rule in the exact order to style themLVHA stands for a linka visiteda hovera activea focus Structural And Positional Pseudo classes The most common structural and positional pseudo classes you will likely come across are the first child Applies style to the first child of the element The syntax for first child selector is first child property value last child Applies style to an element if is the last child within its parent The syntax for last child selector is last child property value In the above example li first child selects line cause is the first list item within the list li last child selects line cause is the last item within the list Only child Applies style to an element if is the only element within a parent The syntax for only child selector is only child property value Example The first child will be red Styling the above ️Html code li only child background color red color white padding em The above ️CSS styles will apply background color red to the lt li gt element cause is the only child PSEUDO ELEMENTSA CSS pseudo element is a keyword added to a selector that lets you style a specific part of the selected element s MDN The double colon represents pseudo element selectors The syntax for Pseudo element selector is selector pseudo element property value Textual Pseudo elementsThe textual pseudo elements consist of the first letter pseudo element first letter applies the style to the first letter of the elementThe syntax for first letter Pseudo element selector is selector first letter property value first line pseudo element first line applies the style to the first line of the elementThe syntax for first line Pseudo element selector is selector first line property value Both the first line and the first letter pseudo element work only for block elements Generated Content Pseudo elementsThe generated pseudo element consist of the before pseudo element before adds content before the HTML element The syntax for before Pseudo element selector is selector before property value after pseudo element after adds content after the HTML element The syntax for after Pseudo element selector is selector first line property value When using the after and before pseudo elements you must use the content property to make your styles visible In the example above ️ I added to before and after the lt p gt element You can also add images using the content URL image link jpg Difference between pseudo class and pseudo elementThe two main differences between a pseudo class and pseudo element are Pseudo elements are preceded with two colons instead of one although these days modern browsers are more forgiving and support both and double colons for the pseudo elements It is best practice to use double colons Pseudo classes are all about the state states like a visited link a focused input field an image that is being hovered upon e tc While pseudo elements are used to style sections or a particular part of an element things like the first letter in a word first line e tc Check out some of these resources for a more in depth look into CSS pseudo classes and pseudo elements Wschools CSS Pseudo elementsMDN CSS Pseudo elementsMDN CSS Pseudo classes CONCLUSIONI hope you enjoyed this post and that it helps you on your way to becoming a better front end developer Start experimenting with the various CSS selectors to see how you can improve your CSS code If you found this article helpful please like and share it That s all for today You reached the end of the article |
2021-12-07 12:05:39 |
Apple |
AppleInsider - Frontpage News |
The best board game conversions to play on your new iPad |
https://appleinsider.com/articles/20/12/25/the-best-digital-board-game-conversions-to-play-on-your-new-ipad?utm_medium=rss
|
The best board game conversions to play on your new iPadWhether you are playing with your family in the living room or with friends across the world these are the best digital board games to play on your iPad Best board games for iPadBoard games have always been a great way to pass the time and many are made better with digital conversion Playing on your iPad means a quick start no setup no cleanup and no missing pieces Read more |
2021-12-07 12:34:44 |
Apple |
AppleInsider - Frontpage News |
Apple's AirPods evolution shown off in CT scan series |
https://appleinsider.com/articles/21/12/07/apples-airpods-evolution-shown-off-in-ct-scan-series?utm_medium=rss
|
Apple x s AirPods evolution shown off in CT scan seriesA collection of detailed CT scans of most models of AirPods reveal Apple s design evolution in beautiful color Source Scan of the MonthApple s latest AirPods do bear a strong resemblance to the AirPods Pro ーbut even more so than it appears on the surface As part of a series of CT scans of popular consumer electronics a new collection has been made showing the insides of AirPods AirPods Pro and AirPods Read more |
2021-12-07 12:35:07 |
Apple |
AppleInsider - Frontpage News |
Apple aims to sell over 300 million iPhones in 2022 |
https://appleinsider.com/articles/21/12/07/apple-aims-to-sell-over-300-million-iphones-in-2022?utm_medium=rss
|
Apple aims to sell over million iPhones in A new industry report claims that Apple intends to boost production of the iPhone range in the first half of and exceed million iPhones sold by the end of the year Apple s iPhone rangePrevious conflicting reports have said that Apple is warning suppliers that iPhone demand has slowed but also that sales are still healthy Now a new report says that Apple expects to need to increase production in early and sell more than million in all of Read more |
2021-12-07 12:24:31 |
海外TECH |
Engadget |
The Morning After: The latest Unreal Engine demo is ‘The Matrix Awakens’ |
https://www.engadget.com/the-morning-after-the-latest-unreal-engine-demo-is-the-matrix-awakens-121518809.html?src=rss
|
The Morning After The latest Unreal Engine demo is The Matrix Awakens That s a digital Keanu and yes Epic Games interactive demo ties into The Matrix Resurrections feature film landing later this month On December th nbsp The Matrix Awakens will be available on your PlayStation or Xbox Series X S console ahead of its debut at The Game Awards Epic GamesIt appears to be a slick technical demo of Unreal Engine showing what the next generation engine is capable of with some help from Neo et al For most this will be the first chance to see UE in action Epic previewed the engine partway through last year with a stunning PS demo but has been largely quiet since The Game Awards this Thursday sounds like a good time to show off ーMat SmithSamsung s major shake upIt s replaced all its CEOs Samsung has merged its mobile business the company s biggest moneymaker with its consumer electronics division in a major restructuring meant to quot strengthen its business competitiveness quot The tech giant has also replaced all of its CEOs and shuffled many around Jong Hee Han head of its TV business has been named as Vice Chairman and co CEO of the newly merged mobile and consumer electronics divisions Han won t be leaving his duties as Head of Visual Display though and will instead lead both businesses Han reportedly has no experience in mobile but Samsung credits him with playing a key role in the company dominating global TV sales over the past years Continue reading The SEC is investigating Tesla over defective solar panelsThe probe stems from a whistleblower complaint The US Securities and Exchange Commission is investigating Tesla after a whistleblower complaint alleging the company failed to disclose a variety of safety risks associated with its rooftop solar panels According to a Reuters report the agency acknowledged the probe in a Freedom of Information Act request made by Steven Henkes pictured above a former Tesla employee The investigation follows several years of reports of safety concerns with Tesla s solar panels In Walmart sued the company after its solar panels led to seven store fires While the two companies eventually settled the retailer claimed at the time that Tesla regularly sent inspectors who “lacked basic solar training and knowledge quot That same year Tesla solar panels at an Amazon warehouse in California reportedly caught fire as well Continue reading Concept hydrogen powered plane could fly halfway around the world without refuelingBut the main word is concept for now Aerospace Technology InstituteElectric planes won t be feasible until batteries become more powerful and lightweight but hydrogen powered flight is another possible way to reduce the flight industry s carbon emissions The FlyZero project led by the Aerospace Technology Institute and funded by the UK government came up with a concept for a liquid hydrogen powered midsize aircraft It said the plane would be able to fly passengers non stop from London to San Francisco or from London to Auckland New Zealand with one stop for refueling We re years away from commercial hydrogen aircrafts with refueling infrastructure non existent and hydrogen more expensive and difficult to store than standard kerosene fuel The FlyZero project plans to publish more detailed findings early next year Continue reading Instagram launches Take a Break and other safety features for teensJust in time for Adam Mosseri s Senate testimony Instagram has launched a number of new and experimental features meant to make its app a safer place for teens ahead of Instagram head Adam Mosseri s Senate testimony The previously announced Take a Break feature has now launched in the US UK Canada and Australia Now when a user ーteens in particular ーscolls through Instagram for a long while the app will ask them to take a break and to set reminders for the future In March Instagram will be launching tools for parents and guardians to give them a way to view how much time their kids are spending on the app and to set time limits Adam Mosseri is set to testify this week as part of a series of hearings about protecting kids online Instagram and Facebook have come under fire in recent months after whistleblower Frances Haugen told Congress about the social networks effect on teens based on Meta s own research Haugen revealed that quot engagement based ranking on Instagram can lead children from very innocuous topics like healthy recipes…to anorexia promoting content over a very short period of time quot Continue reading nbsp The biggest news stories you might have missedWilliam Shatner s space voyage is becoming an Amazon documentaryToshiba s flagship Fire TV set has hands free AlexaFirefox enhances the browser s protection against malicious codeDoorDash tests minute grocery deliveries in New York CityGoogle Pixel update delivers time saving improvements on new and older modelsYouTube says most disputed copyright claims are resolved in the uploader s favor |
2021-12-07 12:15:18 |
ラズパイ |
Raspberry Pi |
Snapshots from the history of AI, plus AI education resources |
https://www.raspberrypi.org/blog/machine-learning-education-snapshots-history-ai-hello-world-12/
|
Snapshots from the history of AI plus AI education resourcesIn Hello World issue our free magazine for computing educators George Boukeas DevOps Engineer for the Astro Pi Challenge here at the Foundation introduces big moments in the history of artificial intelligence AI to share with your learners The story of artificial intelligence AI is a story about humans trying to understand what makes The post Snapshots from the history of AI plus AI education resources appeared first on Raspberry Pi |
2021-12-07 12:25:36 |
海外科学 |
NYT > Science |
After 8 Wolves Are Poisoned, Oregon Police Ask for Help |
https://www.nytimes.com/2021/12/06/us/oregon-wolves-poisoned.html
|
entire |
2021-12-07 12:13:36 |
ニュース |
BBC News - Home |
Afghanistan: Foreign Office chaotic during Kabul evacuation - whistleblower |
https://www.bbc.co.uk/news/uk-59549868?at_medium=RSS&at_campaign=KARANGA
|
secretary |
2021-12-07 12:30:41 |
ニュース |
BBC News - Home |
Vishal Garg: US boss fires 900 employees over Zoom |
https://www.bbc.co.uk/news/business-59554585?at_medium=RSS&at_campaign=KARANGA
|
lender |
2021-12-07 12:08:01 |
ニュース |
BBC News - Home |
In-play clips, highlights and ball-by-ball commentary - follow the Ashes on the BBC |
https://www.bbc.co.uk/sport/cricket/59443111?at_medium=RSS&at_campaign=KARANGA
|
ashes |
2021-12-07 12:30:13 |
ニュース |
BBC News - Home |
Ashes: England in Australia - all you need to know about the 2021-22 series |
https://www.bbc.co.uk/sport/cricket/59491461?at_medium=RSS&at_campaign=KARANGA
|
australia |
2021-12-07 12:38:31 |
ニュース |
BBC News - Home |
Bellingham fined £34,000 for referee comments |
https://www.bbc.co.uk/sport/football/59564618?at_medium=RSS&at_campaign=KARANGA
|
behaviour |
2021-12-07 12:11:20 |
北海道 |
北海道新聞 |
医師や看護師、6千人派遣可能に コロナ「第6波」備え、2千施設 |
https://www.hokkaido-np.co.jp/article/620214/
|
厚生労働省 |
2021-12-07 21:18:00 |
北海道 |
北海道新聞 |
インフルワクチン不足、接種予約の打ち切りも 帯広の医療機関 供給減で配給に遅れ |
https://www.hokkaido-np.co.jp/article/620213/
|
予防接種 |
2021-12-07 21:16:00 |
北海道 |
北海道新聞 |
日勝峠 山スキーの季節到来 愛好家ら楽しむ |
https://www.hokkaido-np.co.jp/article/620212/
|
山スキー |
2021-12-07 21:15:00 |
北海道 |
北海道新聞 |
道南米在庫だぶつき 過去最大規模 豊作、外食需要減退響く |
https://www.hokkaido-np.co.jp/article/620207/
|
最大規模 |
2021-12-07 21:03:00 |
ビジネス |
東洋経済オンライン |
中国の「出生率」、建国後の最低記録を更新の衝撃 2020年は人口1000人当たり10人を割り込む | 「財新」中国Biz&Tech | 東洋経済オンライン |
https://toyokeizai.net/articles/-/472757?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
biztech |
2021-12-07 21:30:00 |
コメント
コメントを投稿