Posts

Quick post about using Docker for setting R7 Repositories on an R8 VM

Image
A repository is much like a library for the operating system. Had a fun task at work today so wanted to write a quick post about it. A linux system receives its OS and software updates from a location called the 'Repository', for an Operating System such as CentOS or Ubuntu, the repositories come pre-listed with the operating system and there's no addition work involved. Fig. 1 - Ubuntu repolist However, for the Red Hat operating systems which are paid, you need to manually register the system to the Red Hat customer portal and then need to attach a subscription. The command to do so looks like the following:  subscription-manager register --username <username> --password <password> --auto-attach Doing so will give us access to the repositories from which we can install our packages and update existing ones. As you can imagine, different versions of Red Hat would have different repositories and they wouldn't be interoperable. If any of you have tried install...

What I've learned in Java up to Nov' 7th '22

Image
As mentioned in the previous blog post, I started learning Java just to be able to understand solutions to Leetcode problems & solutions discussed in 'Cracking the Coding Interview' book. This blogpost is going to focus a little less on being didactic and more about me just rambling on about what I've learned in the past few weeks. Part 1 - The Basics J ava was developed by  James Gosling  at  Sun Microsystems  and  released in May 1995 according the Java page on Wikipedia. To start writing and developing program in Java, we will first need the JDK ( Java Development Kit)  which provides all the tools, executables, and binaries required to compile, debug, and execute a Java Program.  JDK is a platform-specific software and that’s why we have separate installers for Windows, Mac, and Unix systems.  Java versioning is kinda weird (much like Samsung's S series) but what we need to know is that the long-term supported versions are 8, 11, and 17. I...

Back after a 3 month hiatus! - What's coming soon.

Image
Here's why I haven't been able to post to this blog for the past three months: September - Focussed on learning DSA for coding and got caught up with work. Also was excited about the upcoming trip and was planning/doing purchases. October - Took the month off to travel back home after 4 years. Arrived in Canada in September 2018 as a student and now went back home as a working professional with experience. It was a very good visit and got to visit family after a long time. November - This month, I'm focusing on learning Java. I have the silliest reason for learning this programming language, I picked up this book called Cracking The Coding Interview by Gaayle McDowell and all the solutions to the coding DSA problems are in Java. Also, on the Leetcode website, when you look at the official solutions, more often than not, the solutions are in Java there as well.  I also figured Java would be a good language to learn for the following reasons: 1. Since Java is an Object-o...

Sorting Algorithms

Image
Sorting In one of the previous posts, we have discussed ' Binary search ' in some detail. One of the requirements to run a Binary Search is that the data in our Array is sorted. In this blog, let's take a look at different ways to sort the lists and find the best way to sort the list. 1. Bubble sort Figure [1] Bubble Sort Here's the code for bubble sorting a simple array: def bubble_sort(array):     n = len(array)     for i in range(n):         already_sorted = True         for j in range(n-i-1):             if array[j] > array[j+1]:                 array[j], array[j+1] = array[j+1], array[j]             already_sorted = False         if already_sorted:             break     return array print(bubble_sort([2,3,9,8,7,1])) Since the bubble sort algorithm has 2 for loops...

Binary Search Algorithm

Image
Binary Search Figure [1] Binary Seach Algorithm applied to a descending order list Let's say we have an ascending-order sorted list of numbers as given below: number_list = [6, 12, 24, 39, 42, 43, 45, 89] Say we were tasked with finding whether a particular element was in the list or not, the simplest way that would occur to us is to use a 'for' loop.  target = 39 for num in number_list:   if num == target:     print(f"{num} is in number_list.") This works but say, we have a huge list of about a million or even a billion values, what would be the worst-case time complexity of such an operation? It could be that the target is the last item in the list, which results in the time complexity being O(n). So, let's think about a better way of solving this problem. Now, we know that the list is ascending-order sorted which means if we check a random number in the list and the number is bigger than our target , we can be sure that our target if it is in, will be to th...

Object Oriented Programming using Python

Image
Object-oriented programming Object-oriented programming is a paradigm of programming that models software code after real-life objects. Just like objects, you can have instances of objects and objects can have attributes. Let's get into it. Figure [1] - OOP Creating an object: class Car :     pass car1 = Car () print ( car1 ) In the script above, we first defined a class Car, then instantiated Car class on variable 'car1' and we received the following output for our print statement. <__main__.Car object at 0x0124E490> This refers to the object stored at a particular memory location. We will see how to make this output more user friendly later on. Adding attributes to an object: All cars would have a make, model, and year of manufacture, so we can set those as attributes for our car1. In the script below, we have done just that. class Car :     pass car1 = Car () car1 .make = 'Volkswagen' ca...

Python Paramiko module

Image
Introduction: Figure [1] Raspberry Pi A computer by definition is a digital electronic machine that can be programmed to carry out sequences of arithmetic or logical operations (computation) automatically & looks like the image above. As we can see, its not possible to input commands and receive output from the physical device itself so we need some form of input and output device attachments. This is where a ' computer terminal ' comes in, its a device that can be used for entering data into, & transcribing data from a computer. Early computer terminals looked like the image below. You can see some familiar elements from modern day computers such as a keyboard in the image. Figure [2] Early computer terminal VT100 A later improvement to the computing world was the concept of ' time-sharing ' which is the sharing of a computing resource among many users at the same time by means of multiprogramming and multi-tasking. Main Section: A typical modern day data cente...