Understanding networking in Kubernetes is paramount. Understanding Services can let us enable our pods to talk to each other and choose the right strategy based on the origin of traffic (either from within or outside the cluster) for our user-defined applications and services.
This article aims to cover the significance of Services in a Kubernetes cluster, the various shortcomings they overcome, followed by various types of Services objects offered by k8, their capabilities, and when to use each one of them.
NOTE: To avoid any confusion between the two services terms we’ll be using throughout, one refers to the Services offered by Kubernetes which we’ll be discussing in detail while the other one is the user-defined services which run inside Pod, example frontend, backend services etc. For our demonstration purpose, we will be using the Nginx service. (To readers who are not familiar with Nginx, it’s a web server that can proxy our request to application services and provides other capabilities like load-balancing, HTTP-cache, etc. out of the box. You can read more here). It will be serving as a hello world for our HTTP request. …
Deep learning in computer vision has made rapid progress over a short period. Some of the applications where deep learning is used in computer vision include face recognition systems, self-driving cars, etc.
This article introduces convolutional neural networks, also known as convnets, a type of deep-learning model universally used in computer vision applications. We’ll be deep-diving into understanding its components, layers like convolutional layer, pooling layers, and fully connected layers and how they can be applied to solve various problems.
So let’s get started.
Above is an image of a cat, as a kid we are told that this animal is a cat. As we grow up learning and seeing more images of cats, our brain registers the various features of it like the shape of eyes, ears, facial structure, whiskers, etc. and next time we see an image of an animal possessing those features, we’re able to predict it as a cat because that is something we’ve learned with experience. …
Python has lots of cool features such as first class functions, lambdas, generators, comprehensions etc. There are plenty of articles on the subject. However, there are some of the features in Python, which are generally not so commonly used.
In this article, we’ve tried to summarize some of the these features, which will provide us a better knowledge on the subject and can come in handy at times for developers.
So let’s dive in!
Resources like CPU, memory utilised by our Python program can be controlled using the resource library.
To get the processor time (in seconds) that a process can use, we can use the resource.getrlimit() method. It returns the current soft and hard limit of the resource. …
Coordinated Universal Time (UTC) is the standard, time-zone independent representation of time. UTC works great for computers that represents time as seconds since the UNIX epoch (starting point against which we can measure the passage of time).
For example, if we define the epoch to be midnight on January 1, 1970 UTC — the epoch as defined on Windows and most UNIX systems — then we can represent midnight on January 2, 1970 UTC as
86400 seconds (
24 * 60 * 60) since the epoch.
But UTC isn’t ideal for humans. Since we usually refer time relative to where we’re currently located. We usually say “noon” or “10 am” instead of “UTC 18:00 minus 3 hours.” If our program handles time, we’ll probably find ourself converting between UTC and local clocks to make it easier for us to understand. …
In this article, we’ll learn about the anonymous function, also known as lambda functions. We’ll try to decode as to why there’s a big fuss about lambdas, understand their syntax and when to use them.
So Let’s jump right in.
The lambda keyword in Python provides a shortcut for declaring small anonymous functions. Lambda functions behave just like regular function declared with def keyword. They can be used whenever function objects are required.
For example, this is how we’d define a simple lambda function carrying out an addition:
>>> add = lambda x, y: x + y
>>> add(22, 10)…
This article details how to create generator functions and why we would want to use them in the first place.
The simplest choice for functions that produce a sequence of result is to return a list of items. For example, let’s say we need to find the index of every word in the string. Here, we accumulate results in a list using the append method and return it at the end of the function.
result = 
for index, letter in enumerate(text):
if letter == ' ':
result.append(index + 1)
This works as expected for some sample input. …
An array is a fundamental data structure available in most programming languages, and it has a wide range of uses across different algorithms.
In this article, we’ll take a look at less known array implementation in Python that only use core language features that’s included in Python standard library.
We’ll see the strengths & weaknesses of each approach so we can decide which implementation is right for our use-case. But before we jump in, let’s cover some of the basics first.
How do arrays work, and what are they used for?
Arrays consist of fixed-size data records that allow each element to be efficiently located based on its index. …
After learning about the global interpreter lock (GIL), many new Python programmers assume that we can forgo using mutual-exclusion locks (mutexes) in our code altogether.
If the GIL is already preventing Python threads from running on multiple CPU cores in parallel, it must also act as a lock for a program’s data structures, right?
But beware, this is truly not the case. The GIL will not protect us. Although only one Python thread runs at a time, a thread’s operation on data structures can be interrupted between any two instructions in the Python interpreter.
This is dangerous if we access the same objects from multiple threads simultaneously. …
In Python, dictionaries (dicts) are a central data structure. Dicts store an arbitrary number of objects, each identified by a unique dictionary key.
Dictionaries are also often called maps, hashmaps, lookup tables, or associative arrays. They allow for the efficient lookup, insertions and deletion of any object associated with a given key.
Dictionaries are one of the most frequently used and most important data structures in computer science. So, how does Python handle dictionaries? Let’s take a tour of the dictionary implementations in core Python and the Python standard library.
Because of their importance, Python features a robust dictionary implementation that’s built directly into the core language: the dict data type. …
Repetitive execution of the same block of code over and over is referred to as iteration. Definite iteration (number of iterations is known) is very common in any programming language including Python. Definite iteration loops are frequently referred to as
The two concepts of iterables and iterators form the basis of definite iteration in Python.
The aim of the article is to get an understanding of iterables and iterators and then tie them together to get an insight of how the Python’s elegant loop construct work behind the scenes? How does the loop fetch individual elements from the objects it is looping over? …