IT |
気になる、記になる… |
Anker、楽天市場のブラックフライデーセールに合わせて対象製品を最大30%オフで販売するセールを開催中 |
https://taisy0.com/2021/11/18/148781.html
|
anker |
2021-11-18 11:12:35 |
IT |
気になる、記になる… |
楽天市場、ポイント最大43倍のブラックフライデーのセールを開始 |
https://taisy0.com/2021/11/18/148778.html
|
楽天市場 |
2021-11-18 11:04:10 |
TECH |
Engadget Japanese |
『ピクミン ブルーム』デコピクミンの集めかた。基本の攻略ガイド |
https://japanese.engadget.com/pikmin-bloom-114733248.html
|
niantic |
2021-11-18 11:47:33 |
TECH |
Engadget Japanese |
英Amazon、2022年1月19日から英国発行のVisaカードが利用不可に |
https://japanese.engadget.com/amazon-stop-visa-113020312.html
|
amazon |
2021-11-18 11:30:20 |
TECH |
Engadget Japanese |
配信ソフトStreamlabs OBS、名称から「OBS」削除 。Lightstreamページ盗用疑惑からの流れ |
https://japanese.engadget.com/streamlabs-drops-obs-from-its-app-name-110021941.html
|
light |
2021-11-18 11:00:21 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
[小報告]BiopythonのTm値計算結果がバージョンによって少し違う |
https://qiita.com/KazukiNakamae/items/bdda6123cafbd6bfb8bc
|
小報告BiopythonのTm値計算結果がバージョンによって少し違うBiopythonだとgtgtgtmtTmNNACAGAAAnntablemtRDNANNでしたが、BiopythonだとgtgtgtmtTmNNACAGAAAnntablemtRDNANNになります。 |
2021-11-18 20:44:25 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
XMLHttpRequestでAPIを叩きCSVをローカルにダウンロード |
https://qiita.com/shinka1235/items/ba961a3b6e214243155e
|
|
2021-11-18 20:35:33 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
unityでTwitter APIを使用したい。エラー401 |
https://teratail.com/questions/369982?rss=all
|
unityでTwitterAPIを使用したい。 |
2021-11-18 20:58:14 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
smtp op25b 25ポートにsmtp接続できてしまう |
https://teratail.com/questions/369981?rss=all
|
smtpopbポートにsmtp接続できてしまう前提・実現したいことsmtpのopbについての疑問があります。 |
2021-11-18 20:46:56 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Djangoでログイン後の遷移先を複数指定したい |
https://teratail.com/questions/369980?rss=all
|
Djangoでログイン後の遷移先を複数指定したい前提・実現したいことDjangoにてアプリケーションを開発しています。 |
2021-11-18 20:46:49 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Python 内包表記 |
https://teratail.com/questions/369979?rss=all
|
Python内包表記内包表記の仕方で困っています。 |
2021-11-18 20:45:35 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
時刻が過去の日付でセットされてしまう |
https://teratail.com/questions/369978?rss=all
|
時刻が過去の日付でセットされてしまうterraformで現在時刻を設定して所定の箇所にセットしようとしています。 |
2021-11-18 20:37:47 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
railsのrescue_fromの使い方 |
https://teratail.com/questions/369977?rss=all
|
|
2021-11-18 20:33:58 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
ローカルネットワーク上でマインクラフトのマルチプレイができないです。 |
https://teratail.com/questions/369976?rss=all
|
ローカルネットワーク上でマインクラフトのマルチプレイができないです。 |
2021-11-18 20:32:42 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
background-image が出ない |
https://teratail.com/questions/369975?rss=all
|
干渉しそうなソースもCSSも全て消して素っ裸にしてもでてきません。 |
2021-11-18 20:24:23 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
gas getTime() で TypeError |
https://teratail.com/questions/369974?rss=all
|
gasgetTimeでTypeErrorはじめて質問させて頂きます。 |
2021-11-18 20:19:32 |
GCP |
gcpタグが付けられた新着投稿 - Qiita |
GCP Machine Learning Engineer 知識チェック 100本ノック 問題編 Part1 |
https://qiita.com/qwerty1234/items/cef146bd0545425ea1e3
|
GCPの資格試験は受験後のなんとも言えない手ごたえのなさを感じつつも「Submit」ボタンを押していたのですが、なぜか「Pass」の表示が出てきてくれていたので、GCPの資格は簡単なんだという錯覚に陥ってしまっていました。 |
2021-11-18 20:03:34 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
環境変数を使い、API KEYをアプリケーション内に隠す |
https://qiita.com/JrPageboy/items/bba469a19353540c6231
|
環境変数を使い、APIKEYをアプリケーション内に隠す概要youtubeAPIを使いgithubにpushした際、不正利用させると怒られたのでアプリケーション内に隠す方法の議事録です初めにyoutubeAPIの取得方法完了してるものとします。 |
2021-11-18 20:41:05 |
海外TECH |
MakeUseOf |
The Best Smart Humidifiers for Cool or Warm Mist |
https://www.makeuseof.com/best-smart-humidifiers/
|
device |
2021-11-18 11:50:22 |
海外TECH |
MakeUseOf |
Here's Why Black Friday 2021 Will Be Different and How You Can Prepare |
https://www.makeuseof.com/black-friday-prepare/
|
online |
2021-11-18 11:30:48 |
海外TECH |
MakeUseOf |
The 7 Best OLED Laptops |
https://www.makeuseof.com/best-oled-laptops/
|
colors |
2021-11-18 11:10:21 |
海外TECH |
DEV Community |
The Ternary operator with React! |
https://dev.to/ziratsu/the-ternary-operator-with-react-3b9c
|
The Ternary operator with React Hey fellow creators The Ternary operator is a great way to do some conditional rendering with React Let s learn how to do that If you prefer to watch the video version it s right here What is the Ternary operator Let s say we have this code import App css function App const toggle return lt div className container gt lt div gt We can use console log to use a ternary operator console log toggle true false Then in the console you will have true since toggle is not null or undefined Great so let s now use the power of the ternary operator combined with React Let s implement some state Let s import the hook useState from React import useState from React and create the state function App const toggle setToggle useState false return lt div className container gt lt div gt We ll start the state with false and then add a button to trigger the change in the state return lt div className container gt lt button gt Toggle lt button gt lt div gt Now let s add the function which will reverse the value of toggle every time you click on the button const toggleFunc gt setToggle toggle Obviously you now need to add that function to the button lt button onClick toggleFunc gt Toggle lt button gt In order to see the change in state you can add a console log beneath the toggleFunc const toggleFunc gt setToggle toggle console log Update Now you can see that every time you click on the button it re enders your component and changes the value from false to true Use the Ternary operator to go from one classname to another Here s a recap of the code you have for now import useState from React import App css function App const toggle setToggle useState false const toggleFunc gt setToggle toggle console log Update return lt div className container gt lt button onClick toggleFunc gt Toggle lt button gt lt div gt Now modify the className of the div that contains the button with a ternary operator lt div className toggle container salmon container gt lt button onClick toggleFunc gt Toggle lt button gt lt div gt If the toggle is false then the background of the container will be dark if it s true then it ll turn salmon It s pretty simple but is actually really useful especially if you want to use animations interactions or even to show or hide some content You can also render some CSS You can also modify the height of your div for example lt div className toggle container salmon container style height toggle px px gt lt button onClick toggleFunc gt Toggle lt button gt lt div gt The same goes for some text Let s add a const to toggle the text of a title that you ll then add in the div const txt toggle Lorem Ipsum lt div className toggle container salmon container style height toggle px px gt lt button onClick toggleFunc gt Toggle lt button gt lt h gt txt lt h gt lt div gt As before you ll see that the text changes You can now see how useful the Ternary operator can be with React Come and take a look at my Youtube channel Have fun looking at my other tutorials Enzo |
2021-11-18 11:56:10 |
海外TECH |
DEV Community |
Introduction to Kubernetes Storage |
https://dev.to/squadcast/introduction-to-kubernetes-storage-p3n
|
Introduction to Kubernetes StorageAs Kubernetes Pods don t store data persistently it offers different storage components to prevent this data loss In this blog learn how Volume works in Kubernetes how to create it and how to attach it to the Pod Figure Kubernetes VolumeBefore exploring Kubernetes volumes let s first understand Docker Docker containers are meant to be transient which means they will only last for a short period They are called upon when required to process data and are destroyed once finished The same is true for the data within the container The data is destroyed along with the container To persist data processed by the container we attach a volume to the containers created Now even if the container is deleted the data generated or processed by it remains Now let s look at how it works in the case of Kubernetes In Kubernetes when a pod is created to process data and then deleted the data processed by it gets deleted as well Kubernetes offers many storage components to prevent this data loss These components are Volume Persistent Volume Persistent Volume Claim and Storage Class In this blog we will learn how Volume works in Kubernetes how to create it and how to attach it to the Pod Figure Kubernetes hostPath VolumeLet s understand how volume works with the help of a simple example using hostPath apiVersion vkind Podmetadata name my test podspec containers image nginx name my test container volumeMounts mountPath my test pd name my test volume volumes name my test volume hostPath path data type DirectoryIn this example we are creating a pod named my test pod and mounting a volume using hostPath To create the Pod there are four mandatory fields apiVersion which is set to V kind refers to the resource we are creating in this case it s Pod other resources can be deployments services daemonset etc We have metadata where we are giving a name to the Pod Finally we have a spec where we define the properties of a container like an image name nginx in this case and the container s name When we create a volume you can choose to configure storage in different ways Kubernetes supports several volumes such as awsElasticBlockStore azureDisk cephfs gcePersistentDisk emptyDir NFS hostPath etc For this example we are going to choose a hostPath volume volumeMounts mountPath my test pd name my test volumemountPath mountPath is the folder inside the pod whose data is mapped to the worker node volumes name my test volume hostPath path data type Directoryvolumes Defines in which location the pod data is stored in the worker node Let s dig more into it with the help of the above example In the above example hostPath mounts a file or directory in this case data from the host node file system into your pod using volumeMounts in this case we are mounting it under my test pd but this can be any path In this way files created in the volume would be stored in the data directory on your node Now if your pod is deleted the data inside it persists on your host node NOTE hostPath works fine with a single node cluster but it s not recommended to use with a multi cluster environment That is because POD will expect the data directory to be present in every node in the cluster If data directory is not present in any node then the POD creation will fail Either you can create data directory in every worker node in the cluster or a better approach to dealing with these types of problems is to use storage classes discussed later Save the above code in a file volume yaml and execute the below command Kubectl create command is used to create a resource either by using file or file stdin kubectl create f volume yamlSimilarly if you want to use AWS EBS volume in your pod you need to use awsElasticBlockStore volume mounts Then we need to define the volumeID which is the id EBS volume for e g vol efcd and filesystem type for e g ext or xfs volumes name test volume awsElasticBlockStore volumeID lt volume id gt fsType extNOTE EBS Volume must already exist and its volume zone must match the zone where you bring up the cluster Persistent Volume PV and Persistent Volume Claim PVC The volumes that we have created so far have been defined under the Pod definition file In case of a large environment users need to configure the storage every time for each pod when dealing with multiple pods A better solution is to manage storage centrally where an administrator can create a large pool of storage and then carve out pieces from it as and when required This is where Persistent Volume PV can help us A persistent volume is a cluster wide pool of storage volumes configured by the administrator to be used by users deploying applications on the cluster The main idea behind Persistent Volume is to provide an API for users and administrators that abstracts details of how storage is provided from how it is consumed Persistent Volume acts as a resource in a cluster just like a node in a cluster resource The users can then select storage from this pool using Persistent Volume Claim PVC Save the below code in the pv yaml file File name can be anything e g persistentvol yaml but it must end with yaml extension apiVersion vkind PersistentVolumemetadata name mypvspec capacity storage Gi accessModes ReadWriteOnce hostPath path mnt data The template for persistent volume is similar to the Pod definition with some changes based on the resource We can start with the base template and update the apiVersion set to v and kind to PersistentVolume Under metadata name it as mypv under spec specify the accessModes which defines how the volume will be mounted on the host The access modes are ReadWriteOnce the volume can be mounted as read write by a single nodeReadOnlyMany the volume can be mounted read only by many nodesReadWriteMany the volume can be mounted as read write by many nodesReadWriteOncePod the volume can be mounted as read write by a single Pod This is only supported for CSI volumes and Kubernetes version In the CLI the access modes are abbreviated to RWO ReadWriteOnceROX ReadOnlyManyRWX ReadWriteManyRWOP ReadWriteOncePodReference Then specify the capacity which is the amount of storage to be reserved for this persistent volume Next comes the volume type which is hostPath which uses storage from the node s local directory To create a volume use the kubectl create command and specify the persistent volume file we have created earlier pv yaml kubectl create f pv yamlpersistentvolume mypv createdTo list the persistent volume use kubectl get and pass the resource name persistent volume in this case kubectl get persistentvolumeNAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGEmypv Gi RWO Retain Available sNow we have Persistent Volume in place In the next step we will use Persistent Volume Claim PVC to make the storage available to a node Persistent Volume and Persistent Volume Claim are two separate objects in the Kubernetes namespace An administrator creates a set of Persistent Volumes and a user creates Persistent Volume Claims to use the storage Once the Persistent Volume Claims are created Kubernetes binds the Persistent Volumes to claims based on the request and properties set on the volume Every Persistent Volume Claims is bound to a single Persistent Volume During the binding process Kubernetes tries to find a persistent volume with sufficient capacity as requested by the claim and any other request properties such as access modes volume modes storage class etc In case if there are multiple matches you can use labels and selectors to bind to a specific volume In case if there is no volume available persistent volume claim will remain in pending state until the newer volume is made available Save the below code in the pvc yaml file apiVersion vkind PersistentVolumeClaimmetadata name my pv claimspec accessModes ReadWriteOnce resources requests storage GiThis Persistent Volume Claim manifest looks similar to Persistent Volume but the difference is kind is PersistentVolumeClaim and in this case we are requesting storage of Gi To create Persistent Volume Claim use kubectl create command and pass the persistent volume claim filename created earlier pvc yaml kubectl create f pvc yamlpersistentvolumeclaim my pv claim createdTo list the persistent volume claim use kubectl get command kubectl get persistentvolumeclaimsNAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEmy pv claim Bound mypv Gi RWO sWhen the claim is created Kubernetes looks at the volume created previously The accessmode should match ReadWriteOnce and the capacity requested is Gi but the volume is configured with Gi Since there are no other volumes available the Persistent Volume Claim is bound to Persistent Volume For your Pod to use this persistent volume claim under volumes specify the claimName under persistentVolumeClaim parameter apiVersion vkind Podmetadata name my podspec volumes name my pv storage persistentVolumeClaim claimName my pv claim containers name my container image nginx volumeMounts mountPath usr share nginx html name my pv storage Storage ClassesEarlier when we discussed EBS Volumes we mentioned that we could create volume like below which applied to create a persistent volume using EBS volumes name test volume awsElasticBlockStore volumeID lt volume id gt fsType extThe problem with the approach is that we first need to provision EBS volume manually before we create volume or persistent volume To create an EBS volume use aws ec create volume command and pass the parameter like availability zone which us west a depending upon the region where you are creating the resource size of the volume depend upon your requirement GB in this case and volume type gp other possible options are io gp st sc etc aws ec create volume availability zone us west a size volume type gpFor more info refer to below linkThis is called static provisioning volumes It will have been nice if the volume gets provisioned automatically when the application requires it where storage classes come in Using storage classes provisional storage such as AWS EBS that can automatically provision and attach it to a pod when a claim is made That is called dynamic provisioning of volumes To create a storage class we can start with apiVersion set to storage ks io v kind to StorageClass name to aws ebs provisioner to kubernetes io aws ebs and type to gp or io depending upon your requirement apiVersion storage ks io vkind StorageClassmetadata name aws ebsprovisioner kubernetes io aws ebsparameters type gpNow as we have a storage class we no longer need a PV because the PV and associated storage will be created automatically For Persistent Volume Claim to use the storage class we need to define the storage class aws ebs under PVC metadata definition This is how PVC knows which storage class to use Then we can specify the amount of storage we need to request Gi in this case apiVersion vkind PersistentVolumeClaimmetadata name my pvc aws claimspec accessModes ReadWriteOnce storageClassName aws ebs resources requests storage GiFor more information please refer to Below are some other examples of Storage Classes using Google Cloud Persistent Disk and Azure Disk Google Cloud Persistent DiskGoogle Cloud Persistent disk provides durable network storage for your instances Their lifecycle is independent of the VM instance and can be moved or detached to persist the data even if it is deleted The storage class definition is almost similar to AWS EBS with provisioner value now changed to kubernetes io gce pd and with all the other changes as discussed below apiVersion storage ks io vkind StorageClassmetadata name my gce pdprovisioner kubernetes io gce pdparameters type pd standard fstype ext replication type nonetype Can be pd standard or pd ssd default is pd standard fstype Can be ext or xfs default is ext replication type Can be none or regional pd In case it s set to none regular zonal PD will be provisioned Azure Disk StorageAzure Disk Storage is the shared block storage provided by Azure which supports both Windows and Linux based instances The storage class definition is almost similar to AWS EBS and Google Cloud Persistent Disk with provisioner value now changed to kubernetes io azure disk and with all the other changes as discussed below apiVersion storage ks io vkind StorageClassmetadata name my azure pdprovisioner kubernetes io azure diskparameters storageaccounttype Standard LRS kind managedstorageaccounttype This is the Azure storage account Sku tier Default value is empty kind Can be managed dedicated or shared Default value is managed To create the storage class let say for ebs the procedure will remain the same for google persistent disk and azure storage disk save the file for example to storageclass yaml it can be any name but it should end with yaml extension and run the below command kubectl create f storageclass yamlstorageclass storage ks io aws ebs createdTo verify if the storage class is created successfully run this command kubectl get storageclasses storage ks ioNAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGEaws ebs kubernetes io aws ebs Delete Immediate false s ConclusionIn this blog we have learned that Kubernetes Pod doesn t store data persistently If the Pod is deleted or restarted there will be a data loss To address this problem Kubernetes offers different storage components like Volume Persistent Volume Persistent Volume Claim and Storage Class Persistent Volume is helpful if we want to manage storage centrally outside the pod lifecycle and then we can use Persistent Volume Claim to carve out the Volume of it Then we looked at Storage Classes which is helpful in case of dynamic provisioning of storage Squadcast is an incident management tool that s purpose built for SRE Your team can get rid of unwanted alerts receive relevant notifications work in collaboration using the virtual incident war rooms and use automated tools like runbooks to eliminate toil |
2021-11-18 11:52:12 |
海外TECH |
DEV Community |
Day 41 of 100 Days of Code & Scrum: Next.js Contact Form HTML, useState, and Validation |
https://dev.to/rammina/day-41-of-100-days-of-code-scrum-nextjs-contact-form-html-usestate-and-validation-2i69
|
Day of Days of Code amp Scrum Next js Contact Form HTML useState and ValidationGood day everyone I m feeling a lot better today than yesterday so I managed to get more things done this time I spent most of my time working on the contact form for my company website Most of the functional frontend aspects of it are nearly complete I just need to have it communicate with the AWS serverless backend After that comes styling the contact form Anyway let s move on to my daily report YesterdayI didn t have much time to work yesterday from feeling sick I finished the styling of the portfolio section s skeleton layout TodayHere are the things I learned and worked on today Next jsfinished most of the HTML of the contact form added state management of each input field using React useState hooks put form validation methods and state changes for the required fields on change blur and submit events display error messages as needed ScrumI did some practice flashcards for Scrum reviewed some of the things I ve learned before Thank you for reading and I wish everyone the best Resources Recommended ReadingsOfficial Next js tutorialScrum Master learning pathway Scrum orgThe Scrum GuideMikhail Lapshin s Scrum Quizzes DISCLAIMERThis is not a guide it is just me sharing my experiences and learnings This post only expresses my thoughts and opinions based on my limited knowledge and is in no way a substitute for actual references If I ever make a mistake or if you disagree I would appreciate corrections in the comments Other MediaFeel free to reach out to me in other media |
2021-11-18 11:36:14 |
海外TECH |
DEV Community |
An Introduction to Algorithms in Computer Science |
https://dev.to/temitopeasama/an-introduction-to-algorithms-in-computer-science-4nng
|
An Introduction to Algorithms in Computer Science Table of Content What are Algorithms and why are they so important Picking the right algorithm What makes a good algorithm Correctness vs Efficiency How to measure the efficiency of an algorithm Conclusion What are Algorithms and why are they so important An algorithm is a specific procedure for solving a well defined computational problem In simpler terms we can say that an algorithm is a set of step by step instructions or finite processes which if followed solve a specific problem Algorithms are useful in analyzing huge data sets or selecting intelligently from a vast number of possible options They allow massive computational power to be harnessed into meeting people s needs and solving problems Let s talk about a few applications of algorithms Say for example you wanted to buy groceries at the nearest grocery store two streets away from your house You could write an algorithm to perform this task as thus Write a grocery list Leave the house Drive to the store Pick up a grocery basket Go to the aisle where every item you have on your list is and put them in the basket Go to the checkout point to pay for your items Drive back home What about an algorithm for making tea In this order you d want to Boil water If using an electric kettle with temperature setting set it to about °F for black tea Warm up teapot Put the tea into a teapot and add hot water Cover teapot and steep tea for minutes Strain tea solids and pour hot tea into teacups There you have it You have successfully written out a set of step by step instructions to carry out two different tasks Let s take a few practical examples Have you ever wondered how Zoom transmits live videos between people in different parts of the world If you guessed audio and video compression algorithms then you re correct Google Maps uses route finding algorithms to help you locate the shortest route to places you want to go Twitter curates your feed by monitoring your engagement through optimization algorithms These and so on are practical applications of algorithms in building scalable and reliable software and services that make our everyday lives quite interesting While of course algorithms in Computer Science are more complex than our day to day applications of algorithms like grocery shopping or starting up your car they all boil down to the same process of following steps of instructions to solve problems Picking the right algorithm What makes a good algorithm So how do you know what algorithm to pick if you ll be picking an existing algorithm or writing a new one it is important to apply one that saves you time and effort It is quite helpful to know how to design algorithms and to analyze them for correctness and efficiency Now not all algorithms are made equal Two things qualify a good algorithm Correctness If you re going to be writing an algorithm to carry out a specific task You want to be sure it can carry out that task error free A good algorithm carries out the task at hand accurately Efficiency Asides from carrying out the task correctly you d also want an algorithm that would do so efficiently as well saving us space and most importantly time A good algorithm not only performs a task correctly but efficiently too Correctness vs EfficiencyMost of the time you want to pick an algorithm based on its ability to solve problems correctly or produce correct answers only Other times you could live with an algorithm that doesn t give you the best answer because the one that does takes a really long time to run Take for example Say we want to write a program to find the most efficient route to your favorite cloth store after delivering milk to different locations It would take days or even weeks to run But you could settle for an algorithm that finds a good route maybe not the best and it would run in seconds Let s re examine our grocery shopping example again While of course the previous algorithm helps you perform your grocery shopping task quite correctly it could be better You could go with the online shopping option Then our algorithm will look like this Go to the store s website Find the item you want using their search option Add all the items on your list to your cart Proceed to checkout to pay for your goods Get your goods delivered to your doorstep In this case you get to perform the same task without leaving your bed saving you both time and energy which could have been spent driving back and forth and walking around the supermarket searching manually for the items on your list So it is in Computer Science we constantly seek ways to perform a task in the least time consuming the lowest storage possible Sometimes complete accuracy is a must so we have to use a certain algorithm no matter how long it takes to run Other times good is good enough and saves us a lot of time and unnecessary stress How to measure the efficiency of an algorithm You could time how long it takes an algorithm to run but that would only tell us about that particular implementation in a certain programming language on a particular local machine That is to say The actual running time depends on factors like The speed of the computer The compiler and compiler options The quantity of data Programming language used Lower level languages like C run faster than Higher level languages like Java Available memory size Algorithm time complexity we ll get to this later in this series Hence the measure of the amount of time for an algorithm to execute which is the Time Efficiency of the algorithm due to the variable factors on which it is dependent is not enough metric to conclude the overall efficiency of an algorithm What about space Earlier in this article we learned that efficiency is measured in relation to time and space We could also measure the Space Efficiency which is a measure of how much memory an algorithm uses in its execution but it still isn t the most reliable way to measure the overall efficiency of the algorithm How then do we measure the efficiency of an algorithm One technique scientists employ is called Asymptotic Analysis This technique allows algorithms to be compared independently of programming language or hardware so that we can conclude correctly what algorithms are more efficient than the others In the next article we ll be looking at Asymptotic Analysis and how it can help us analyze and choose the right algorithm for a specific task ConclusionIn this article we discussed the basics of algorithms and how they work the two criteria for picking an algorithm and the dilemma of picking one criterion over the other In the next article we ll be discussing Asymptotic Analysis and how this technique helps us determine the efficiency of an algorithm and its suitability for the task at hand See you there |
2021-11-18 11:22:13 |
海外TECH |
DEV Community |
Repeat, Auto, Minmax aka RAM |
https://dev.to/hunzaboy/repeat-auto-minmax-aka-ram-5b5g
|
Repeat Auto Minmax aka RAMRAM is a great layout pattern for grid layouts in general It stands for Repeat Auto Minmax which entails to the css grid property of grid template columns to have flexible children and placed automatically in the parent without having to write any extra responsive css You can use this pattern for images cards items etc The code looks like below lt div class parent gt lt div class child gt A lt div gt lt div class child gt B lt div gt lt div class child gt C lt div gt lt div class child gt D lt div gt lt div gt parent display grid grid template columns repeat auto fill minmax px fr grid gap em You can use auto fill or auto fit depending upon your usecase Cover Photo helloimnik |
2021-11-18 11:15:45 |
海外TECH |
DEV Community |
An Ode to jQuery (and an alternative!) |
https://dev.to/inhuofficial/an-ode-to-jquery-4ae2
|
An Ode to jQuery and an alternative When jQuery came out it really was spectacular it gave developers a common Vernacular But times have changed and the year is and the time for jQuery has passed and gone I do not want you to think that I hate or despisean essential piece of internet history at least in my eyes but if you are using it to build your brand new siteI hate to tell you but it is probably shite jQuery adds bloat and it ruins your web vitals You don t need kb of JS just to adjust the titles instead use vanilla JS and querySelectorAll and watch your package size fall and fall But I like the syntax I hear you say Well let me show you another way In just kb of vanilla JS I can show you the way to performance success The code you can use instead is below allowing you to keep your current workflow but you can save those bytes to make performance better and still use the dollar sign as your global selector So here is the answer that will address your need for an extensible micro library that improves site speed the speed you need if you want your site to rank wellso you gain more visitors increasing your chances to sell Yeah I am not a poet My poetry sucks but I can show you an alternative to jQuery for a lot of needs simple sites and side projects not for complex stuff FYI that is bytes bytes gzipped of JavaScript It is a modified version of a library called ki js and works in IE you can make it much simpler if you don t need IE support if typeof undefined function b c d e f f b add e function i a d i for d a amp amp a nodeType a a a b querySelectorAll a c i d length i c unshift call this d i function a return f test typeof a in test b readyState setTimeout function a a new i a d i d on function a b return this each function c f c add e a b false c attachEvent on a b off function a b return this each function c f c remove e a b c detachEvent on a b each function a b for var c this d e c length d lt e d a call b c d c d d c return c splice c splice document prototype EventListener var props add remove toggle has maps add remove toggle contains props forEach function prop index prototype prop Class function a return this each function b if a b classList maps index a What functions do I get Right out of the box this gives you most things you need You get selector on off each splice addClass removeClass toggleClass hasClass And then you can extend it with a few extra useful functions prototype find function selector return selector this prototype parent function return this length this parentNode prototype first function return this prototype focus function return this focus prototype css function a b if typeof a object for var prop in a this each function c c style prop a prop return this else return b this style a this each function c c style a b prototype text function a return a this textContent this each function b b textContent a prototype attr function a b return b this getAttribute a this each function c c setAttribute a b param function obj prefix var str for var p in obj var k prefix prefix p p v obj p str push typeof v object param v k encodeURIComponent k encodeURIComponent v return str join amp prototype append function a return this each function b b appendChild a ajax function a b c d var xhr new XMLHttpRequest var type typeof b object var gp GET POST xhr open gp type a true if type xhr setRequestHeader X Requested With XMLHttpRequest xhr responseType typeof c string c var cb type b c xhr onerror function cb this true xhr onreadystatechange function if this readyState if this status gt amp amp this status lt cb this false else cb this true if type xhr setRequestHeader Content type application x www form urlencoded xhr send param b else xhr send xhr null That gives you find parent first focus css text attr param ajax All for an additional bytes bytes gzipped What more do you need Those are the top of jQuery selectors that people need and it lets you keep the jQuery syntax if that is what you prefer All for kb gzipped or kb raw It is worth noting that it isn t a drag and drop replacement there are some slight nuances when it comes to single item selection you may need to use item to select an item if you don t use first for example In fact it isn t something I would recommend most people use I am using it purely to give you an example of how you could start your own micro library and introduce the idea of micro libraries in general to you Before the angry comments start Look I am not saying don t use jQuery despite the tongue in cheek poem What I am actually saying is explore alternatives before just including jQuery in a new project Core Web Vitals and website performance are essential parts of success nowadays The easiest way to have a high performance site is to ditch heavy JS and unused code jQuery is still useful if you need to support older browsers edge case browsers so use it if it fills a need Also bear in mind that if you use code splitting and tree shaking etc you can make jQuery performant still The same advice applies to using React for static sites React is obviously useful for SAAS products but stop using it to build brochure sites It is way too much JS to render a nav bar hero image and a title Pick the right tool for the job and your life as a developer will not only become easier but you will make faster sites that can be enjoyed by people even on a G connection I hope you enjoyed this silly article We will see how many people actually read it when we read the comments P S this post was inspired by this post by ben Do you still work with jQuery Ben Halpern・Nov ・ min read jquery javascript webdev discuss You should go read the comments there as there are some interesting points about jQuery usage today |
2021-11-18 11:15:33 |
海外TECH |
DEV Community |
Create a direct messages feature like on Booking.com with TalkJS |
https://dev.to/ozfarooq/create-a-direct-messages-feature-like-on-bookingcom-with-talkjs-2pin
|
Create a direct messages feature like on Booking com with TalkJSRecently we have managed to customize the TalkJS default UI theme to make chat lookalikes like Uber WhatsApp LinkedIn and other chats In the following article we will make the Booking com chat using the TalkJS Chat API We will show you how to create the blue and white theme of the booking com chat Things To DoOpen the Theme Editor and create a new theme named “booking chat Now integrate this theme with the application to preview the theme changes The users can also get an idea by following the starter guide and having an easy preview with an HTML page without application integration Below is the default theme of the TalkJS Chat Following is a complete summary of the changes that the user has to perform for making a chat like Booking com Change the header to dark blue and the header text to white Remove the avatar from the header Remove the search icon from the header Change the font weight and family of the header text to normal and Arial respectively Remove the avatars from both sender and receiver chat Remove the timestamp and message status from the chat Change the chat background from the default white to any other color as booking com uses an image that Talk JS does not support yet Change the alignment styles and padding of the messages Change the client s chat background to blue and the support agent s chat to white Change the format of the chat to make it look like the booking com speech bubbles Layout Chat panelThe initial step is to open the layout section from the Theme Editor and click on the Chat panel dropdown The next thing is to change the background color to white Note We are going for white colour for this tutorial and the users can choose to set any color of their choice Following is an image for the demo Message field areaIn the layout section open the message field area section and change the background color to white Doing this will change the area s colour around the message input field to match the background color Below is the image to demonstrate it ChatHeaderThe first top level component to alter is the ChatHeader Open the stylesheet of the ChatHeader section from the left menu Change the header CSS with the following CSS to set the background color of the header to dark blue This change makes it look like the header of Booking com chat header display flex align items center height rem background color FD flex shrink The next thing is to change the title colour to white set the alignment of the title and change its font size to make it more similar to the booking com chat Replace the title CSS with the following CSS to make these changes title text overflow ellipsis overflow hidden white space nowrap color white font size px padding left px Moreover remove the and class from the header as these are unnecessary To make the chat look like booking com remove the following lines from the ChatHeader stylesheet Line the search box Line else condition Line to image on the left side Line line Line to Line to image CSS Line to search action Line to search code Following is the modified header after going through all the changes UserMessageThe following top level component to alter is the UserMessage The user has to open the UserMessage stylesheet to make changes according to the booking com chat layout The user has to modify line like the following to hide the avatars lt t set showAvatars true gt to lt t set showAvatars false gt Moreover remove lines to in order to remove the avatar code from the file The next thing is to remove the timestamp and message delivery status show status from the chat Alter the MessageBody tag at line to remove the following code from the file timestamp timestamp floatTimestamp auto showStatus sender isMe Another thing is to add the below CSS to in the file to add the triangle in order to customise the speech bubbles to make them look like booking com chat bubbles Following is the CSS to alter the speech bubble by the sender by me message before content width px height px position absolute border left px solid EE border right px solid transparent border top px solid transparent border bottom px solid transparent right px top px Following is the CSS to alter the speech bubble by the receiver by other message before content width px height px position absolute border right px solid DDD border left px solid transparent border bottom px solid transparent border top px solid transparent right px top px Replace the by me message CSS to change the background color margins and borders to make it look like the booking com chat by me message background color EE color fff margin right px border color EE Replace the by other message CSS to alter the background color of the chat and the left margin by other message background color DDD margin left px The next thing to do is to replace the message CSS to align it with the speech bubble styling and the borders of the bubbles Moreover alter the font family font weight and the font size of the chat to make it similar to the booking com chat Note Users can make the above changes in the Layout section by setting the font size and font family in the ChatPanel section message border color EECEE background color EECEE color padding px font weight font family arial position relative white space normal border radius rem border width px border style solid word wrap break word position relative display inline block max width calc rem rem rem font size px font weight normal padding px By performing all these changes and replacements the chat now looks like this The below gif demonstrates the functional design of the booking chat |
2021-11-18 11:04:28 |
海外TECH |
DEV Community |
How to build a cryptocurrency dashboard in 10 minutes using ToolJet |
https://dev.to/sherfin94/how-to-build-a-cryptocurrency-dashboard-in-10-minutes-using-tooljet-11i2
|
How to build a cryptocurrency dashboard in minutes using ToolJetIn this tutorial I will walk you through building a cryptocurrency dashboard in less than minutes using the ToolJet platform ToolJet is a free open source low code platform that allows you to quickly build tools Here is the final application that you would have at the end of this tutorial This dashboard was created with desktop screens in mind please make sure you open it from your desktop Step Get ToolJetYou can run ToolJet locally or you can create a free ToolJet cloud account which will be the easiest way to get started Step Create an applicationStep Create a query to list the major cryptocurrenciesI m using the API provided by coinstats app feel free to use any other API you d like API URL limit amp currency USDAnd I m calling it coinListAnd make the query run whenever the application is opened Step Add a table and list all the coins on itThe data returned by the query can be fed into the table using its inspector panel which opens up when you click on the table component s handle Make sure that you ve run the query by pressing the play button next to its name otherwise the query s data wont be available Step Create a query to fetch historical price dataThe table row which was last clicked by the user is available in the global variable components as components table selectedRow Therefore the id of the coin that the user clicked last is available as components table selectedRow id Note that table is the name of the table if you change this the above code fragment will also change accordingly The URL for the query shall therefore be coinId components table selectedRow id Let s call this query monthData Click on one of the rows of the table and run the monthData query to ensure that the query has run and therefore that its response is available Step Make sure that the query is run whenever a row is clickedStep Add a chart to visualize price historyThe chart takes in data in the format x y x y We can use this snippet to convert the response of our monthData API to this format where x values are day numbers and y values are the price of the coin in US dollars queries monthData data chart map point day gt x day y point OPTIONAL Step Repeat step to step to visualize weekly price history as wellThis time for step the URL would become coinId components table selectedRow id as we need to get data for one week instead of one month For step the query to be run will be the newly created weekData query For step the code snippet would become the following as the query name is different as well as instead of day this endpoint brings us price per hour of the coin hence the variable day is renamed to hour queries weekData data chart map point hour gt x hour y point Step Save deploy and launch the application Done we now have a fully functional cryptocurrency dashboard Optional Make the dashboard look a little betterStyling the tableThe appearance of the table can be configured from the inspector panel Click on the table on the inspector panel that opened up on the right make the following changes Turn off Show search box Turn on Highlight selected row Change Table type to borderlessYou may also adjust the width of the columns to make the table look like this Loading icons and titles for the chartsTo show loading icons on the charts simply fill in their Loading state field on the inspector with queries monthData isLoading for the month level chart and queries weekData isLoading for the week level chart The isLoading variable is made available with every query and it indicates whether the query is loading or not You can also type in relevant titles for the charts on their Title field on the inspector Making these changes would finally make our application more interactive What would you like to build with ToolJet I m eager to listen to your ideas questions and comments |
2021-11-18 11:02:19 |
医療系 |
医療介護 CBnews |
21年度介護留学生、前年度比206人減の2,189人-介養協調査 |
https://www.cbnews.jp/news/entry/20211118200401
|
人となり |
2021-11-18 20:20:00 |
ニュース |
BBC News - Home |
HS2 cut confirmed amid promise to transform rail |
https://www.bbc.co.uk/news/business-59334043?at_medium=RSS&at_campaign=KARANGA
|
speed |
2021-11-18 11:50:02 |
ニュース |
BBC News - Home |
Dawn Sturgess public inquiry to be held into Novichok death |
https://www.bbc.co.uk/news/uk-england-wiltshire-59332227?at_medium=RSS&at_campaign=KARANGA
|
sturgess |
2021-11-18 11:48:19 |
ニュース |
BBC News - Home |
University of Warwick stabbing: Two arrested on attempted murder charge |
https://www.bbc.co.uk/news/uk-england-coventry-warwickshire-59332710?at_medium=RSS&at_campaign=KARANGA
|
chargestudents |
2021-11-18 11:07:40 |
ニュース |
BBC News - Home |
First long-acting injection for HIV approved |
https://www.bbc.co.uk/news/health-59330979?at_medium=RSS&at_campaign=KARANGA
|
approvedengland |
2021-11-18 11:18:06 |
ニュース |
BBC News - Home |
Walkers crisp shortage leaves Leicestershire family desperate |
https://www.bbc.co.uk/news/uk-england-leicestershire-59323918?at_medium=RSS&at_campaign=KARANGA
|
crisp |
2021-11-18 11:46:48 |
ニュース |
BBC News - Home |
Somerset reprimand Brooks over historical tweets |
https://www.bbc.co.uk/sport/cricket/59334173?at_medium=RSS&at_campaign=KARANGA
|
connotations |
2021-11-18 11:50:34 |
LifeHuck |
ライフハッカー[日本版] |
スマホ中毒から抜け出す5つのアプローチ |
https://www.lifehacker.jp/2021/11/digital-detox-matome.html
|
方法 |
2021-11-18 21:00:00 |
北海道 |
北海道新聞 |
163人感染、5人死亡 国内の新型コロナ |
https://www.hokkaido-np.co.jp/article/613212/
|
新型コロナウイルス |
2021-11-18 20:18:00 |
北海道 |
北海道新聞 |
養殖カキ漁、最盛期 サロマ湖 |
https://www.hokkaido-np.co.jp/article/613211/
|
養殖 |
2021-11-18 20:17:00 |
北海道 |
北海道新聞 |
道内高温注意 27日から5日間 |
https://www.hokkaido-np.co.jp/article/613207/
|
札幌管区気象台 |
2021-11-18 20:07:00 |
北海道 |
北海道新聞 |
ワクチン2回接種完了75・7% カナダ超えG7トップに |
https://www.hokkaido-np.co.jp/article/613206/
|
新型コロナウイルス |
2021-11-18 20:05:00 |
北海道 |
北海道新聞 |
フリーランス4割がトラブル経験 立場の弱さ浮き彫りに、連合調査 |
https://www.hokkaido-np.co.jp/article/613175/
|
浮き彫り |
2021-11-18 20:02:03 |
IT |
週刊アスキー |
マイクロソフト、PCメーカーと共同でWindows 11をアピール |
https://weekly.ascii.jp/elem/000/004/075/4075553/
|
windows |
2021-11-18 20:30:00 |
コメント
コメントを投稿