Skip to main content

Posts

Showing posts from May, 2020

Containers - Quick Low Level Guide

Containers Kernel, namespace, cgroups Kernel space and user space Before we actually get to explain containers let's define what is a kernel.  Because you know there is no such thing in reality as a kernel it's only how we name things, and different people name things differently. cgroups, namespaces, UFS We are going to discuss containers, cgroups, namespace, UFS, hypervisor, user space, kernetl space and more.   When we say "kernel" we mean this.  We have the hardware, this is not the kernel, now above the hardware we have a few layers of software, imagine now two boxes. User mode is all the application you run while the kernel is the lower level is all the virtual memory management scheduling, connection to hardware devices, network drivers, it's basically the abstraction on top of the hardware + the basic services which allow this. One box is closer to the hardware and contains a few layers, the second box sits on top of the kernel box and contains

Backtracking

Giving recursion structure a name It's just a name we give for a certain structure of a recursive method.  it's simply a form of a recursion. Backtracking is a name for a recursive structure Agenda Here is our agenda for this episode, we are going to try in free text and words to describe what backtracking means, how does it relate to other common types of recursions, why you should already know and even practice backtracking without even knowing it, what are the ingredients and structure and steps for creating a backtracking recursive solutions, and briefly describe two problem solutions that involved backtracking. Backtracking Sudoku Giving it a name It's useful to give names to the type's of a recursive solution.  In this way if I tell you my recursion is a tail recursion or my recursion is a backtracking recursion you already have much information about what kind of solution we had in mind for our problem, or you could already imagine how the body of the recursive f

SQL Window functions (OVER, PARTITION_BY, ...)

Introduction When you run an SQL Query you select rows, but what if you want to have a summary per multiple rows, for example you want to get the top basketball for each country, in this case we don't only group by country, but we want also to get the top player for each of the country.  This means we want to group by country and then select the first player.  In standard SQL we do this with joining with same table, but we could also use partition by and windowing functions. For each row the window function is computed across the rows that fall into the same partition as the current row.  Window functions are permitted only in the  SELECT  list and the  ORDER BY  clause of the query They are forbidden elsewhere, such as in  GROUP BY ,  HAVING  and  WHERE  clauses. This is because they logically execute after the processing of those clauses Over, Partition By So in order to do a window we need this input: - How do we want to group the data which windows do we want to have? so  def c