投稿時間:2022-10-02 03:21:24 RSSフィード2022-10-02 03:00 分まとめ(22件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
Docker dockerタグが付けられた新着投稿 - Qiita 【Java/Kotlin/JPA】SpringBoot/JPAのはじめ方0 - Docker設定 https://qiita.com/komatsuh/items/61c28d581cf0d6a78c3b docker 2022-10-02 02:41:15
海外TECH MakeUseOf How to Minimize the Amount of Data Apple Music Uses https://www.makeuseof.com/minimize-apple-music-data-usage/ amount 2022-10-01 17:30:15
海外TECH MakeUseOf Is Your Windows Theme Not Syncing Properly? Here's the Fix https://www.makeuseof.com/windows-theme-not-syncing-fix/ fixes 2022-10-01 17:15:14
海外TECH DEV Community How to count all files in a directory in Linux https://dev.to/smpnjn/how-to-count-all-files-in-a-directory-in-linux-20lh How to count all files in a directory in LinuxTo count all files in a directory in linux simply cd to that directory and then run the following command ls wc lAlternatively you can select the directory by adding the directory to the command like so ls var css wc lHere var css is the directory you want to count the files in Counting all files in WindowTo do the same thing on windows use cd to move to the directory in question and then run the following on command line dirThis will list all files and directories in a folder and tell you how many files and directories exist 2022-10-01 17:48:50
海外TECH DEV Community Python: The Difference Between Sets, Lists, Dictionaries and Tuples https://dev.to/smpnjn/python-the-difference-between-sets-lists-dictionaries-and-tuples-24od Python The Difference Between Sets Lists Dictionaries and TuplesPython has four types of data collections When to use which and why we have four can be confusing In this guide I ll go through what each of the types are and how to use them The four types of data collection in python are lists which are ordered changeable and can contain duplicate values and indexed by numbertuples which are ordered unchangeable and can contain duplicate values sets which are unordered have unchangable values once set but may have items added or deleted and cannot contain duplicate values dictionaries which are unordered depending on your python version changeable have indexes and cannot contain duplicate values To put this into simpler terms here is a table of their key properties †dictionaries are ordered only after Python ††sets may have new values added or values removed but we cannot change values already addedYou might be wondering why there are so many but each of these have specific uses cases lists are useful when we have data which may contain duplicates They are like typical arrays in other languages such as Javascript tuples are faster than lists but cannot be changed This is useful when we have a set number of values to iterate through like the column names of a table which may contain duplicates sets which again are faster than lists but whose original contents cannot be changed We can still add and remove items though making them more flexible than tuples in that regard They are a great way to test if an item is a member of a specific set of other items i e if we wanted to check the word apple was in a set dictionaries which are like lists but with keys These are like objects in other languages such as Javascript and are useful for giving context to our data through key value pairs Learn More about Python Data StructuresEach of these types of data have a useful purpose in Python and using them properly is key to mastering Python I have written indepth guides on each here which go into much more detail on how to define and use each of these data structures To learn more click below Python Data CollectionsPython Data Collections ListsPython Data Collections TuplesPython Data Collections SetsPython Data Collections Dictionaries 2022-10-01 17:16:49
海外TECH DEV Community Python Dictionaries: A Complete Guide https://dev.to/smpnjn/python-dictionaries-a-complete-guide-afi Python Dictionaries A Complete GuideDictionaries are an important way to store data in Python They let us store information as key value pairs which are indexed by key name rather than index like in Python Lists In this guide we will cover everything you need to know about Python dictionaries If you are interested in other data collections in Python such as lists sets and tuples you can find out more about them here Let s begin by defining a dictionary We use curly brackets just like in Python sets but we define both keys and values which is slightly different than sets dictionary name Johnny age While this methods of creating dictionaries are great we are not limited by them If you are familiar with Python lists you can turn them straight into dictionaries using the dict function dictionary dict name Johnny age print dictionary name Johnny age Or we can use the dict function to create a dictionary from variables dictionary dict name Johnny age print dictionary name Johnny age Accessing Python dictionary values can be accessed using the square bracket notation dictionary name Johnny age print dictionary name JohnnyOr if you want you can get this information using the get method dictionary name Johnny age print dictionary get name JohnnyPython dictionaries are also mutable so using the square bracket notation above we can update values dictionary name Johnny age dictionary age print dictionary age Or you can use the update method based on your preference dictionary name Johnny age dictionary update age print dictionary age Dictionaries can also be multidimensional So this is also a valid dictionary dictionary name firstName Johnny lastName Simpson age Finally you can get the length of a dictionary i e the number of key value pairs using the len function dictionary name Johnny age dictionary update age print len dictionary Python Dictionary MethodsWe ve covered both get and update so far but there are a bunch of other methods which are useful too Here s a full list of them dict clear deletes all items from a python dictionary dict copy makes a copy of a dictionary which has the same value but a different reference dict popitem removes the last key value pair from the dictionary dict pop keyItem removes the key value pair with a key of keyItem dict update newDictionary updates the dictionary with keys and values from newDictionary overwriting any existing ones dict setdefault key default will return the value for the item key and if it doesn t exist will create a new key value pair of key default dict fromkeys keys values takes two sets of data for both keys and values and creates a new dictionary based off them dict items returns an iterable set of tuples for each key value pair The returned data is known as a view object dict keys returns an iterable set of keys for the dictionary The returned data is known as a view object dict values returns an iterable set of values for the dictionary The returned data is known as a view object View Objects in Python DictionariesYou might notice that the last three methods items keys and values all return a view object A view object are a dynamic way type of object which will update automatically should the dictionary be updated They are also iterable Let s look at a quick example using dict items dictionary dict name Johnny age getDictionaryItems dictionary items for x in setDictionary print x Returns name Johnny age dict items returns a list of tuples so we can easily iterate over them using a for loop View Objects also support membership checks For example we can check if a certain key exists in a dictionary using the keys method along with the in and not in operators dictionary dict name Johnny age getDictionaryItems dictionary keys print name in getDictionaryItems True as name is a key in dictionaryprint name not in getDictionaryItems False as name is a key in dictionary Deleting Items from Dictionaries in PythonThere are a number of ways to delete items from a dictionary as shown in the methods list above The main ones are popitem pop and clear Let s look at a few examples so it s clear how they work To remove a specific item from a dictionary we use pop In the example below I remove the dictionary item with the key favouriteDrink dictionary dict name Johnny age favouriteDrink tea dictionary pop favouriteDrink print dictionary name Johnny age If methods aren t your thing you can just use the del keyword to remove favouriteDrink in the same way dictionary dict name Johnny age favouriteDrink tea del dictionary favouriteDrink print dictionary name Johnny age If we only wanted to remove the last item without specifying it we can use popitem dictionary dict name Johnny age favouriteDrink tea dictionary popitem print dictionary name Johnny age Or if we wanted to clear the dictionary completely we can use clear dictionary dict name Johnny age favouriteDrink tea dictionary clear print dictionary Using setdefault with Python DictionariesThe setdefault method on Python dictionaries either returns a value for a key if it exists or creates that key value pair if it doesn t The first argument is the key and the second is the value you wish to set the key to should it not exist for example dict setdefault age If you do not set the second argument it defaults to the string None Here is an example which leads to a new key value pair being added to the object dictionary below dictionary name Johnny age dictionary setdefault age Does nothing but returns age as age exists on dictionarydictionary setdefault favouriteDrink tea Adds favouriteDrink to dictionaryprint dictionary name Johnny age favouriteDrink tea Creating a New Dictionary from two lists of data in PythonIf you wish to create a new dictionary in python from a set of data we can use the dict fromkeys method Here we can define a list set or tuple of data for keys and a single value for the value that each key should be For example below I ve defined a tuple and a single value of When combined with fromkeys we get a brand new dictionary myKeys name age favouriteDrink myValues newDict dict fromkeys myKeys myValues print newDict   name age favouriteDrink Iterating Over a Dictionaries KeysAn easy way to iterate over a dictionaries keys along with the dict keys method is to simply call iter which returns an iterable for the keys in your dictionary This essentially performs the same task as dict keys most of the time dictionary dict name Johnny age favouriteDrink tea dictKeys iter dictionary for x in dictKeys print x Returns name age favouriteDrinkThe difference between iter and dict keys is you cannot alter the keys after calling iter To show you what I mean below I add a new key after calling iter and try to iterate over with a for loop This produces an error as the keys changed during iteration dictionary dict name Johnny age favouriteDrink tea dictKeys iter dictionary dictionary birthday Monday for x in dictKeys print x RuntimeError dictionary changed size during iterationMeanwhile no error will be produced for dict keys since dict keys produces a view object which is a dynamic live view of the dictionaries contents dictionary dict name Johnny age favouriteDrink tea dictKeys dictionary keys dictionary birthday Monday for x in dictKeys print x Returns name age favouriteDrink birthday Iterating Over a Dictionaries Keys in Reverse OrderAnother useful function you might find yourself using is reversed This function takes a dictionaries keys and returns an iterable list of them in reverse order As with iter you will product errors if you try to update the dictionary while iterating over it in reversed form Once reversed the keys can be iterated upon to do some function of your choosing Here is an example which returns the string value of each key in reverse order for dictionary dictionary dict name Johnny age favouriteDrink tea reversedDict reversed dictionary for x in reversedDict print x Returns favouriteDrink age name Checking Membership in a Python DictionaryJust like in sets and other data collections in Python we can also check if something exists as a key in a dictionary For this we can use the in or not in operators Remember dictionaries membership is checked by key not value dictionary name Johnny age print name in dictionary Trueprint name not in dictionary False ConclusionThat s everything for dictionaries I hope you ve enjoyed this Python tutorial To learn more about engineering in general you can check out my other work here Otherwise click the links below to learn more about the different types of data collections in Python Python Data CollectionsPython Data Collections ListsPython Data Collections TuplesPython Data Collections SetsPython Data Collections Dictionaries 2022-10-01 17:15:07
海外TECH DEV Community It's Hacktoberfest time - Time to gear up your skill https://dev.to/kodeflap/its-hacktoberfest-time-time-to-gear-up-your-skill-21i7 It x s Hacktoberfest time Time to gear up your skill It s Hacktoberfest time Time to gear up your skillHacktoberfest is a month long fest to promote open source contributors The event is made by DigitalOcean community Developers from across the world can take part in this event It is not even limited to age experience or coders Anyone can participate and can scale up their skills This blog post is all about getting a glimpse of open source and also how can you be part of Hacktoberfest and what is it What is Open Sorce Open source projects are the projects that are hosted as publicly accessible Being a publicly active repository it can have a border number of communities and developers Don t limit it when hearing about open source because many software like Linux Mozilla Firefox WordPress Android VLC and many more are the result of open source Open source has a large number of non coders coders maintainers and contributors It doesn t have certain boundaries to contribute If you like to contribute just fork and run and write a good commit and make some good pull requests PR Does it limit to coders The straight answer is no anyone if you want to do some contributions you can have contributions Good copywriting finding issues having discussions making a new feature testing designing mentoring or organizing events for a big community It doesn t mean you have to be too much experience If you have a will go according and scale up your skills Hosting Open Source Project GitHub GitLabGitHub and GitLab are the main two platforms used to host the repositories Though it sounds like a replica we can either choose GitHub or GitLab on the basis of these If looking for collaborating with a large community it is better to choose GitHubIf the project matters in cost and likes to integrate third party tools then GitLab is the best option HacktoberfestBasically Hacktoberfest occurs every year at the time of October The event s main aim is to encourage open source and to develop an interest in open source contribution As I said it is not bound to coders even non coders can also participate Even if you are new to it just try to contribute to what you like You can also be a maintainer contributor or event coordinator Mainter is the person who makes a public repository according to the following conditions and welcomes contributors and can also merge and maintains the open source project Contributors can take part and contribute to code documentation test and design anything by following the code of conduct contributing guidelines making a good commitment and pulling requests for it Coordinators can conduct workshops and seminars if you take part as a coordinatorCheck out the official hacktoberfest site and know more about it Hacktoberfest Take a part in the event in any role you want as a maintainer contributor or coordinator How to do your first contribution in hacktoberfestCheck out the repositories participating in the event using the below linkBuild software better togetherYou can also search using the search bar by typing hacktoberfest you can also add the documentation keyword to give a contribution to the documentationAccording to your choice sort the result is based on the good first issue language etcIf you like to contribute to app development in kotlin check out my reposGitHub kodeflap Algo Guide Android application to visualize algorithmsGitHub kodeflap MyNotes My notes is for organizing your notes That s all for today Wishing a great day to all 2022-10-01 17:11:53
海外TECH DEV Community Python Lists: A Complete Guide https://dev.to/smpnjn/python-lists-a-complete-guide-3lga Python Lists A Complete GuidePython lists are a fundamental data type in Python They are similar to Arrays in other languages such as Javascript You can learn more about the main Python data structures here To create a list in Python is super easy Let s start with some of the basics and then dive into useful ways you ll be able to work with lists To start a new list simply define a variable in Python with the contents encapsulated in square brackets myList some list contents As Python is a language that is dynamically typed there are no major limitations on what can go inside a list so feel free to add other types such as integers or floats too myList some list contents etc Empty lists can be defined as empty square brackets should you need to do that too myList Lists can also be nested or contain lists within lists within lists So this is also valid python myList some list inside a list Getting the length of a list is done using the standalone len function Here s an example where we try to get the length of our nested list myList some list inside a list print len myList returns Finally we can reference items in a list using the square bracket notation For example to get the first item of a list myList some list contents etc print myList some Or to get the first two items myList some list contents etc print myList some list List Methods in PythonLists come with a bunch of built in methods in Python to allow us to fully realise their potential as data stores These methods are list append newItem appends an item with the value newItem to the end of the lists list extend newItem appends another iterable item onto the list for example combining two lists list insert newItem inserts a list item newItem and index You can change the value of the index to decide where the item should be inserted list clear deletes the lists contents entirely list remove someItem removes the first item of the list with a value of item Will throw an error if no value item exists list count someItem counts any instances of someItem in the list If no item in the list has the value someItem then it will return list copy creates a shallow copy of the list list reverse reverse the elements of the list list pop removes an item at position of the list and returns it If you don t define a number it ll remove the last item i e list pop list sort for sorting lists To bring this to life let s look at a few examples of how it works in practice Appending and Inserting new list itemsOne of the most common things you ll want to do with a list is adding new data to it If we ve created a list we can append data using the append method as mentioned or insert to insert items at a certain position myList inside a list myList append friend myList insert new print myList inside a new list friend You can also add to a list using myList inside a list myList friend print myList inside a list friend Or if you have two lists you can add the second onto the first using extend myList some list otherList other list myList extend otherList print myList some list other list Deleting lists and lists contentAn equally common thing you ll want to do once you add everything to your list is to delete items You can delete with remove or clear to simply delete the entire list myList inside a list myList remove inside print myList a new myList clear print myList returns Reversing a List in PythonYou ll also want to reverse lists in some situations Python has a build in method for this so no need to define your own myList inside a list myList reverse print myList list a inside Making copies of listsIn Python we use to compare by value and is to compare by reference We can use copy to make a new reference for a list This will make a new reference point in memory pointing to the same value Below myList and otherList are equal in value but now their reference is different so myList is otherList returns false myList a list otherList myList copy print myList otherList Trueprint myList is otherList FalseThis can also be written as myList if you want to avoid using the copy method myList a list otherList myList print myList otherList Trueprint myList is otherList False Sorting Lists in PythonSorting a list in ascending order is easy using the sort function and all items are of the same type myList a c e b f d g z w x myNumberList myList sort myNumberList sort print myList a b c d e f g w x z print myNumberList If you try to sort where the list contains different types like integers and strings you ll end up getting an error If you want to sort a list based on another feature of the list you can define its key and reverse arguments key gives us a number which will be used to compare the list contentreverse if set to true will reverse the order For example to put all values which are a at the start we could try something like this def isA letter if letter a return else return myList a c a f a z a x myList sort key isA reverse True print myList a a a a c f z x Here we define a function isA which takes each item in the list as its first argument letter If the letter is a then it returns otherwise it returns Then we reverse the list using the reverse True argument to get all the as at the start Lists function best as stacks of data Since lists are ordered they function best as stacks which means adding and removing items from the end of a list is super fast while adding or removing items from the start is kind of slow That means it s recommended to use pop and append where possible as this is going to be a lot faster on large data sets than other methods on lists ConclusionLists are super powerful data structures in Python and used everywhere You can learn more about Python data structures here To learn more about other engineering topics check out the rest of my content You can read more about Python data structures below Python Data CollectionsPython Data Collections ListsPython Data Collections TuplesPython Data Collections SetsPython Data Collections Dictionaries 2022-10-01 17:09:59
海外TECH DEV Community Challenges of microservice in Kubernetes https://dev.to/firdavs_kasymov/challenges-of-microservice-in-kubernetes-53kb Challenges of microservice in KubernetesThis article will describe in detail the common challenges of microservices in the Kubernetes world and how we can solve those challenges Let s start listing some of the challenges Every single microservice needs to know the service address Usually it is injected within the microservice business logic as Config dependency Once the request is received in the Kubernetes Cluster the communication is insecure as microservices talk to each other over HTTP Every single microservice inside the cluster can talk to any other service freely So when it comes to security there is no way to prevent attacks on the cluster Each microservice has a retry logic to make the whole application more robust If one microservice is unreachable or you lose a connection you naturally want to retry connecting So developers usually add retry logic to every service and the same process is continued when the new microservices are added We want to be able to monitor how the service performs what responses return how many requests the microservice receives the network latency and tracing The development team may add monitoring logic to Prometheus using the client library and collect tracing data using the tracing library for example Zipkin As you might have noticed the team of developers of each microservice needs to add all this logic to every service which is quite time consuming The developers are not integrating any business needs Instead they add logic for communication security and retry logic for each microservice These will add complexity to the service instead of keeping it simple and straightforward Managing Canary deployment and backward compatibility of software including websites and backend APIs in microservices gets challenging without proper Service Mesh patterns In software engineering canary deployment is the practice of making staged releases We roll out software updates for a small part of the live users first so they test it and provide feedback Once the changes are accepted the update will be rolled out for the rest of the users When it comes to Canary deployment we split users into two groups A small percentage of these groups will go to Canary while the rest will stay in the stable version Later we will decide whether to roll everyone to the Canary or roll back changes to the previous version Alternatively we can check the headers of requests to support Canary deployment for a specific set of users Some of the challenges I have faced are listed above As a result it would make sense to extract all non business logic out of the microservice into the separate sidecar application that handles all of the above mentioned issues Also the sidecar would act as a proxy We can solve all these challenges with the “service mesh with Sidecar pattern What is Service Mesh The main goals of a service mesh are to allow insight into previously invisible service communications layers and to gain full control of all microservices communication logic like dynamic service discovery load balancing timeouts fallbacks retries circuit breaking distributed tracing and security policy enforcement between services The insights are provided by traffic audit and tracing features Kubernetes already has a very basic “service mesh out of the box it s the “service resource It provides service discovery by targeting the needed pods and a round robin balancing of requests A “service works by managing iptables on each host in the cluster allowing only a round robin load balancing approach with no retries and back off logic and no other features that we might expect a modern service mesh to handle However implementing one of the fully featured service mesh systems in your cluster for example Istio Linkerd or Conduit will provide you with the following possibilities Allow services to talk plain HTTP and not bother about HTTPS on the application layer The service mesh proxies will manage HTTPS encapsulation on the sender side and TLS termination on the receiver side allowing the application components to use plain HTTP or gRPC and any other protocol without encryption in transit Proxies will take care of the encryption Security policies enforcement the proxy knows which services are allowed to access some other services and endpoints and will deny unauthorized traffic Circuit breaking automatic back off in case of accessing an overloaded service or endpoint that would already have high latency This is available to avoid hitting it with more and more requests which may cause that endpoint to fail under an excessive load Latency aware load balancing instead of using a round robin style of balancing which ignores the latency of each target use smarter balancing according to the response times of each backend target This is an incredibly crucial feature of a modern service mesh Queue depth load balancing route new requests based on the least busy target by the current request processing amount The service mesh knows where it has sent all previous requests and which ones are still being processed or were already completed It will send new incoming requests based on that logic to a target with the lowest queue for processing Per request routing route particular requests marked by selected HTTP header to specific targets behind the load balancer allowing easy canary deployment testing and other creative use cases One of the most powerful features a service mesh provides Metrics and tracing reporting requests volume per target latency metrics success and error rates We would be doing technical practice with the service mesh known as Istio We will execute Canary Deployment with the Istio to cover the above mentioned issues IstioService mesh is just a pattern while Istio is one of its implementations Istio architecture consists of a “Control Plane component also known as “Istiod which manages and injects proxy on each separate pod Istio uses Envoy Proxy as the Proxy layer The Envoy Proxy is an independent open source project which many other mesh providers use as a proxy sidecar You can learn more about Istio from its official documentation How to configure Istio in Kubernetes There is no need to adjust deployment and services in Kubernetes YAML files as the Istio configuration is separate from the application configuration Istio is configured with Kubernetes YAML files It uses Kubernetes Customer Resource Definitions CRD by extending the Kubernetes API CRD is a custom Kubernetes component object For example third party technologies like Istio Prometheus and many more can be used like any other native Kubernetes objects Using a few Istio CRDs we can configure different traffic routing between microservices including which services can communicate with each other traffic splitting retry logic and canary deployments Service DiscoveryIstiod has a central registry for all the microservices Instead of statically configuring endpoints for each microservice when a new microservice gets deployed it will be automatically registered in the service registry with no need for configuration from our side Envoy Proxy can query endpoints and send the traffic to the relevant services using this registry Certificate ManagementIstiod also acts as a Certificate Authority It generates certificates for all the cluster microservices allowing secure TLS communication between microservices proxies Metrics and TracingIstiod receives metrics and tracing data from Envoy Proxies It is gathered by monitoring servers such as Prometheus and tracing servers to have everything needed for microservice applications Istio Ingress GatewayIt is an entry point into the Kubernetes cluster almost an alternative to Nginx Ingress Controller Istio gateway runs as Pod into the cluster and acts as load balancing by accepting incoming traffic The gateway then will direct traffic to one of the microservices inside the cluster using VirtualService components VirtualServiceThe “VirtualService links the gateway and destination pods of any request Any “host DNS name or Kubernetes DNS name when services address each other inside the cluster can be defined only in one VirtualService Istio traffic flowA user will initiate a request to the web server microservice into the Kubernetes Cluster →then request hits to Istio Gateway because it is the entry point of the cluster →Gateway will evaluate the Virtual Service rules about how to route the traffic and send it to the WebServer microservice →Request reaches to the Envoy Proxy of web server microservice it will evaluate the request and forward it to the actual web server container within the same container by using localhost For instance webserver initiates another request to the Payment microservice so that the request will move out from Webserver container to the Envoy Proxy Then by applying the VIrtualService rules the Destination rules configuration will communicate with the Envoy Proxy of Payment microservice using mTLS mutual TLS Canary Deployment with IstioBefore we start the technical practice make sure that the necessary tools which are listed below are installed on your computer Docker Kubectl The Kubernetes command line tool allows you to run commands against Kubernetes clusters You can use kubectl to deploy applications inspect and manage cluster resources and view logs Minikube It is the most widely used local Kubernetes installer It offers an easy to use guide on installing and running single Kubernetes environments across multiple operating systems It deploys Kubernetes as a container VM or bare metal and implements a Docker API endpoint that helps it push container images faster It has advanced features like load balancing filesystem mounts and FeatureGates making it the best for running Kubernetes locally Run Minikube locally by executing the command minikube start to create Kubernetes resources locally Istio Addons additional elements that we can install with Istio It will include all data visualisation about metrics tracing basically what your microservices are doing and how they perform Below you can find a brief description of what each tool does but we don t dive into details as it is out of the scope of this article We will install some of those add ons into our local cluster You can follow the official guide for installing these add ons Please install the following add ons Kiali Grafana Jaeger and Promethteus Prometheus is used for monitoring anything in the cluster It can be the server itself memory cpu usage as well as Kubernetes components such as pods services and other components Grafana is a data visualization tool for metrics data Jaeger is a service for tracing microservice requests Kiali offers amazing data visualization features and configuring your microservice setup and communication We want to work in an isolated namespace for this example so please create a Kubernetes namespace and save the following to namespace ymal file apiVersion vkind Servicemetadata name website namespace website istio nsspec ports port targetPort protocol TCP name http selector app websiteThen run kubectl create f service yaml to submit these resource definitions to the cluster Create Istio Gateway and virtual service for the basic functionality of the service mesh ingress endpoint so that we can access our application through the Istio Ingress load balancer that was created when you deployed Istio to the cluster Save the following definition to the gateway yaml file apiVersion networking istio io valphakind Gatewaymetadata name website gateway namespace website istio nsspec selector istio ingressgateway servers port number name http protocol HTTP hosts Then run kubectl create f gateway yaml to submit these resource definitions to the cluster Save the following definition to the virtual service yaml file apiVersion networking istio io valphakind VirtualServicemetadata name website virtual service namespace website istio nsspec hosts gateways website gateway http match headers qa exact canary test route destination host website subset version route destination host website subset version The host field in the “VirtualService destination is a name of the Kubernetes “service object for use Destination can be divided into subsets if we want to distinguish between our pods by label and address them in different scenarios separately with URI path based or HTTP header based routing In this case we need to add a subset field like this http route destination host website subset something that is defined in DestinationRule“Subsets for routing are defined with “DestinationRule In addition to the label based separation of target pods of service we can apply a custom load balancing policy if for example we have a subset “version and “version defined below and saved in “destination rule yaml file apiVersion networking istio io valphakind DestinationRulemetadata name website namespace website istio nsspec host website subsets name version labels version website version name version labels version website version Now deploy with kubectl create f destination rule yaml By doing that we created a “subset of the “website destination named “version and “version That subset is any pod with “version website version or “version website version label and any other labels that are defined in the “website service definition which is “app website This will route to any pod with the “version label that equals “website version or “website version when a “VirtualService uses the destination service name We defined it in the “spec host field it is the Kubernetes “service object name the one we used in “spec http route destination host field of “VirtualService The next step is to prepare the service mesh for deploying the new website version Let s assume that this is a production cluster with real traffic flowing in and “website version is active and we have four pods that receive traffic By creating a separate deployment with version of the website pod and the same label “app website we will cause traffic to split and will impact existing users which we want to avoid Let s create a deployment pod with different version of the website apiVersion apps vkind Deploymentmetadata name web v namespace website istio nsspec replicas selector matchLabels app website version website version template metadata labels app website version website version spec containers name website version image hashicorp http echo alpine args listen text echo v ports name http protocol TCP containerPort imagePullPolicy IfNotPresentAt this point we have four “version pods and a “version canary pod In order to access “istio ingress gateway locally we must tunnel it locally with the help of Minikube by executing the following command minikube tunnel Finally we can test the results by visiting the following browser address “localhost As you can see on the screenshot the “version of our website responded as “echo v By default all visitors will land on the “version The QA team internal users and a small percentage of real users can see the updated version of the website known as the Canary version Any HTTP request must include the “qa header containing the “canary test value for viewing the Canary version Istio s virtual service will check headers and values that match them rerouting traffic to the “version of the website To include the header we can use Postman Insomnia API tools The easiest way to exercise this would be by installing the ModHeader extension for Google Chrome The below screenshot will demonstrate how the ModHeader extension would work in the browser Once you include the necessary headers you can visit “localhost As you can see after including the headers the Istio virtual service rerouted our request to the “version of our website The proof of the headers being sent out to the server For the purpose of this article I used a simplified version of the website It will just echo text based on the different versions of the website You can find the full working deployment codes from following GitHub link This setup can be used as a guide for Canary Deployment in different projects of yours Good luck 2022-10-01 17:09:29
海外TECH DEV Community Python Sets: A Complete Guide https://dev.to/smpnjn/python-sets-a-complete-guide-b1d Python Sets A Complete GuideSets in python provide a method to create a unique set of unordered items with no duplicates Their main use case is for checking is an item exists in a set of items which can be useful in many different situations Creating a set is pretty easy and is kind of similar to how we define lists in Python The only difference is we use curly brackets to define a set mySet some set of items Sets can also be defined from lists using the set function mySet set some list becoming a set set is some list becoming a set You can also create sets from strings using the same set function mySet set somestring set is s o m e s t r i n g As with other countable types of data we can use len to get the length of a set too let mySet set some list becoming a set print len mySet Returns Finally we can also define what is known as a frozenset which is simply an immutable unchangeable version of a set with fixed value using the frozenset function let mySet frozenset some list becoming a set Combining and Intersecting SetsWe can combine two sets into one using the operator If an item exists in both sets only one copy of it will be brought over Here s an example where we combine two sets mySet set one myNewSet set two combinedSet mySet myNewSetprint combinedSet set one two We can intersect sets using amp That means we ll end up with a set where the items are only items which exist in both Using the same example we can therefore create a set only containing the item set mySet set one myNewSet set two combinedSet mySet amp myNewSetprint combinedSet set Another way we can combine sets is by subtraction o end up with a new set which only contains items left when removing any common items in both sets For example the new set below only has one item cool since mySet and mySecondSet both contain set and one mySet set one cool mySecondSet set one myNewSet mySet mySecondSetprint myNewSet cool Finally we can do what is called symmetric difference where we end up with a set that contains items found in either mySet or mySecondSet but not both mySet set one cool nice mySecondSet set one friendly myNewSet mySet mySecondSetprint myNewSet cool nice friendly Testing Membership using SetsThe main use case for sets is testing membership to see if an item exists in a set We can do this using the in and not in keywords Let s look at an example If we want to check orange is in our fruits set we use in fruits orange apple peach print orange in fruits TrueOr if we want to check if orange is not in fruits we use not in fruits orange apple peach print orange not in fruits False Making a copy of a setAs with lists we can make a copy of a set using the copy method attached to all sets This will not change the value but will change the reference in memory for this new set That means that if compared by value using the sets will be the same when compared by reference using is the sets will not be the same mySet set one mySetCopy mySet copy print mySet mySetCopy Trueprint mySet is mySetCopy False Testing for Supersets and SubsetsAnother really useful use case for sets is the ability to check if a set is a superset or subset of another set which is a bit of a tongue twister subsets will be sets that are fully contained within another set supersets will be sets that contain fully the members of another set Checking for Subsets in PythonLet s say we have two sets as shown below mySet set one two mySecondSet set one mySecondSet is in fact a subset of mySet since it is fully contained within mySet We can test for this using the lt operator mySet set one two mySecondSet set one print mySecondSet lt mySet TrueWe can also use the lt operator to check for true subsets meaning that mySecondSet is contained within mySet but is not equal in value to mySet In the example above this is also true mySet set one two mySecondSet set one print mySecondSet lt mySet TrueIn the following example however mySecondSet is indeed a subset of mySet but it is not a true subset since both are equal in value mySet set one mySecondSet set one print mySecondSet lt mySet Trueprint mySecondSet lt mySet False Checking for Supersets in PythonSuper sets work exactly the same way as subsets the only difference is the arrow is the opposite way around So gt is used to check for true supersets while gt is used to check for any supersets Using our example from before mySet is a superset of mySecondSet so the following returns true mySet set one two mySecondSet set one print mySet gt mySecondSet TrueAnd similarly while mySet is a superset of mySeconSet below it is not a true superset so gt does not return true while gt does mySet set one mySecondSet set one print mySet gt mySecondSet Trueprint mySet gt mySecondSet False Testing if two sets have completely different values in PythonSometimes you ll also want to check if two sets are completely original when compared to each other For example one two and three four are two sets with unique values when compared to each other In Python the isdisjoint function allows us to accomplish that mySet one two mySecondSet three four print mySet isdisjoint mySecondSet True Other Set MethodsWhile everything we ve talked about so far apply both to frozensets and sets there are also a few other methods available to sets which allow us to mutate their value These are set add item adds an item to the set set remove item removes an item to the set set update newSet adds all items from newSet to the original set This can also be written as set newSetset clear removes all items from a setset pop removes the th item from a set or the last item if no number is specifiedset intersection update newSet keeps only items found in both set and newSet Can also be written as set amp newSetset difference update newSet takes set and removes any items found in newSet Can also be written as set newSetset symmetric difference update newSet keeps only found in either set and newSet but not both Can also be written as set newSetWhile the first provide easy ways to add and remove items from sets the last are the same as what we talked about before when we covered intersecting and combining sets The difference here is we can use these functions to change the set itself While this is possible on normal sets we cannot apply these methods to a frozenset ConclusionThat should be everything you need to know about sets in Python I hope you ve enjoyed this guide I ve also written more about all of the different data structures available in Python here If you ve enjoyed this guide you might also enjoy my other engineering content here Thanks for reading You can learn more about Python data collections below Python Data CollectionsPython Data Collections ListsPython Data Collections TuplesPython Data Collections SetsPython Data Collections Dictionaries 2022-10-01 17:06:16
海外TECH DEV Community Medusa Hackathon is live 🎉 Free swag and up to $1,500 in prizes https://dev.to/medusajs/medusa-hackathon-is-live-free-swag-and-up-to-1500-in-prizes-3e25 Medusa Hackathon is live Free swag and up to in prizes Medusa Hackathon is LIVE Participate in the Medusa Hackathon and contribute to the leading open source ecommerce platform for devs while celebrating Hacktoberfest What you ll get as participant Medusa Hackathon Tee Hoodie and more 🪄Certificate of Participation Chance to win up to Who can participate Participation is for EVERYONE You can go solo join as a team or join other projects in our Medusa DiscordSubmission deadline Oct Read more and sign up on medusajs com blog medusa hackathon 2022-10-01 17:04:16
海外TECH Engadget Sheryl Sandberg has left Meta, but the company will keep paying for her personal security https://www.engadget.com/sheryl-sandberg-meta-will-pay-for-personal-security-170637101.html?src=rss Sheryl Sandberg has left Meta but the company will keep paying for her personal securitySheryl Sandberg officially stepped down from her post as Meta COO in August but the company will continue to pay for her personal security into Reuters reports The board citing quot continuing threats to her safety quot agreed to pay for security services from October st through June th with protection available to Sandberg at her residences and while she is traveling nbsp It is unclear what threats Sandberg has been receiving that would warrant the company paying for continuing protection after she has resigned We have asked Meta for comment and will update this story if the company chooses to elaborate Sheryl Sandberg joined Meta in and her last official day as an employee was September th Going forward she will continue to serve on Meta s board and receive compensation as a non employee director Although Sandberg apparently resigned of her own volition her final chapter at the company was marred by personal scandal Earlier this year The Wall Street Journalreported that Sandberg used company resources to help kill negative reporting about Activision CEO Bobby Kotick who she was said to be dating at the time nbsp Two months later the Journal also reported that Meta had launched an internal investigation into Sandberg s use of company resources and that the inquiry actually extended back quot several years quot In addition to the allegations about protecting Kotick from negative press Sandberg was also reportedly being investigated for possibly using company funds to pay for her wedding Meta lawyers were also reportedly looking into whether and how Facebook staff helped Sandberg and her foundation Lean In promote her latest book Option B Sandberg s final years on the job were also marked by a series of company crises including the Cambridge Analytica scandal allegations of enabling genocide in Myanmar shrinking revenue earlier this year and a change last year in iOS s approach to third party app tracking that undercut the core of Meta s business model nbsp It is not unusual for Facebook to invest heavily on personal security for its top executives In the company reportedly spent million in to protect CEO Mark Zuckerberg However the board s announcement on Friday comes days after Meta was reported to have suspended all hiring with a warning of possible layoffs on the way making for some potentially awkward optics nbsp 2022-10-01 17:06:37
海外TECH CodeProject Latest Articles CodeProject.AI Server: AI the easy way. https://www.codeproject.com/Articles/5322557/CodeProject-AI-Server-AI-the-easy-way artificial 2022-10-01 17:58:00
ニュース BBC News - Home Arsenal 3-1 Tottenham: Gunners show identity & direction in outstanding derby win https://www.bbc.co.uk/sport/football/63104127?at_medium=RSS&at_campaign=KARANGA Arsenal Tottenham Gunners show identity amp direction in outstanding derby winArsenal have flattered to deceive in recent seasons but their outstanding win against Tottenham is proof they have rediscovered their identity 2022-10-01 17:04:54
ビジネス ダイヤモンド・オンライン - 新着記事 「ひとり親の家庭」が子育てで絶対に知っておきたいこと - 中学受験を目指す保護者からよく質問される「子育てQ&A」 https://diamond.jp/articles/-/310001 「ひとり親の家庭」が子育てで絶対に知っておきたいこと中学受験を目指す保護者からよく質問される「子育てQampampA」開成・桜蔭・筑波大駒場・渋谷幕張…。 2022-10-02 02:55:00
ビジネス ダイヤモンド・オンライン - 新着記事 【精神科医が教える】 たった数回会っただけの人を「親友」と言ってしまう残念な人… 人間関係を誇示したい人が見失っている 本当に大切なこと - 精神科医Tomyが教える 心の荷物の手放し方 https://diamond.jp/articles/-/310440 【精神科医が教える】たった数回会っただけの人を「親友」と言ってしまう残念な人…人間関係を誇示したい人が見失っている本当に大切なこと精神科医Tomyが教える心の荷物の手放し方不安や悩みが尽きない。 2022-10-02 02:50:00
ビジネス ダイヤモンド・オンライン - 新着記事 子どもが10歳までに身につけたい1つの習慣 - ひとりっ子の学力の伸ばし方 https://diamond.jp/articles/-/308816 自己肯定感 2022-10-02 02:45:00
ビジネス ダイヤモンド・オンライン - 新着記事 グーグルが「スマホでも見やすいページ」を評価する理由 - ブログで5億円稼いだ方法 https://diamond.jp/articles/-/310603 評価 2022-10-02 02:40:00
北海道 北海道新聞 不安の機体続々飛来 道内2演習場にオスプレイ 乏しい情報 自治体苦慮 https://www.hokkaido-np.co.jp/article/739419/ 米海兵隊 2022-10-02 02:14:00
北海道 北海道新聞 3点シュートの嵐防げず レバンガ初戦黒星(1日) https://www.hokkaido-np.co.jp/article/739417/ 黒星 2022-10-02 02:04:00
北海道 北海道新聞 コンサドーレ、聖地で逆転劇 「最後」の厚別 小柏が決勝点(1日) https://www.hokkaido-np.co.jp/article/739416/ 逆転劇 2022-10-02 02:01:00
海外TECH reddit Team Liquid vs Cloud9 / ESL Pro League Season 16 - Semi-Final / Post-Match Discussion https://www.reddit.com/r/GlobalOffensive/comments/xt0txx/team_liquid_vs_cloud9_esl_pro_league_season_16/ Team Liquid vs Cloud ESL Pro League Season Semi Final Post Match DiscussionTeam Liquid Cloud Inferno Ancient Dust nbsp Team Liquid have advanced to the Grand Finals and will face Team Vitality or G Esports Cloud have been eliminated nbsp Team Liquid Liquipedia HLTV Official Site Twitter Facebook Instagram YouTube Subreddit Cloud Liquipedia HLTV Official Site Twitter Facebook Instagram YouTube Twitch ESL Pro League Season Information Schedule amp Discussion For spoiler free CS GO VoDs check out EventVoDs or r CSEventVods Join the subreddit Discord server by clicking the link in the sidebar nbsp Liquid MAP Cloud X overpass vertigo X inferno ancient X mirage nuke X dust nbsp nbsp MAP Inferno nbsp Team CT T Total Cloud T CT Liquid nbsp Team K A D ADR Rating nbsp nbsp Cloud AxLe interz nafany shro HObbit nbsp nbsp Liquid NAF oSee YEKINDAR EliGE nitr Inferno Detailed Stats nbsp nbsp MAP Ancient nbsp Team CT T Total Liquid T CT Cloud nbsp Team K A D ADR Rating nbsp nbsp Liquid oSee YEKINDAR NAF EliGE nitr nbsp nbsp Cloud HObbit AxLe shro interz nafany Ancient Detailed Stats nbsp nbsp MAP Dust nbsp Team CT T Total Liquid T CT Cloud nbsp Team K A D ADR Rating nbsp nbsp Liquid YEKINDAR oSee nitr NAF EliGE nbsp nbsp Cloud shro AxLe interz HObbit nafany Dust Detailed Stats This thread was created by the Post Match Team The Post Match Team is looking for new members Message u Undercover Cactus if you want to join submitted by u cometweeb to r GlobalOffensive link comments 2022-10-01 17:16:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)