Skip to main content

Posts

Showing posts with the label learn

Basic CLI Application Using Golang

Writing a Basic CLI Application Using Go Go is a great language for building command-line tools due to its simplicity and powerful standard library. In this article, we will go through how to create a simple CLI app in Go that accepts commands and flags from the user. Step 1: Install Go Before you start, ensure that Go is installed on your machine. You can download it from here . Once installed, verify by running: go version Step 2: Set Up Your Project Create a new folder for your project and navigate into it: mkdir cli-app cd cli-app Step 3: Write Your CLI App In your project folder, create a file called main.go . This is where we'll write our CLI code. package main import ( "flag" "fmt" "os" ) func main() { name := flag.String("name", "World", "a name to say hello to") flag.Parse() if len(os.Args) Step 4: Run the Application You...

Why Interfaces are Awesome in Go

Why Interfaces are Awesome in Go Language Go, or Golang, is known for being a simple, yet powerful programming language. One of the core concepts that makes Go stand out is interfaces . Interfaces in Go help you write flexible, reusable, and maintainable code. They allow different types to share common behaviors without worrying about the exact type behind the scenes. In this article, we'll dive into why interfaces are awesome, with easy-to-understand examples. We’ll also give some tips on how to make the best use of them in your Go programs. What is an Interface? An interface in Go defines a set of method signatures (rules), but it doesn't provide the implementation. Instead, any type that implements these methods can be said to "satisfy" the interface. This allows you to write code that can work with different types as long as they share certain behaviors. Basic Example of an Interface package main import "fmt" // Define an interface with ...

How to Start Learning Go Language: A Beginner's Guide

  How to Start Learning Go Language: A Beginner's Guide Introduction to Go Language Go, also called Golang, is a programming language developed by Google in 2009. It’s simple, fast, and great for building reliable software. If you’re interested in learning programming or want to try a new language, Go is a great choice. This article will help you understand how to start learning Go in a simple and easy way. Why Learn Go? Before we jump into how to learn Go, let’s look at why Go is popular: Simple syntax: Go is easier to learn compared to other programming languages like C++ or Java. Fast performance: Go runs quickly, making it great for web servers and large systems. Great for beginners: Go has built-in tools that make coding easier, especially for new programmers. Growing demand: More companies are using Go, so learning it can help in your career. Steps to Start Learning Go 1. Set Up Go on Yo...

Hash Tables : Designing Hash Functions

In the last post , we saw how collision in handled in a hash table. Now its time to explore some real world scenarios because come on, what is the use of learning all this if we can't apply it in real world softwares. As we learned that open addressing and chaining were both good in different scenarios only if we met a condition that the keys are uniformaly distributed. But its not the application job to pass distributed keys to hash tables, its our job to map any key to some random location. We do this using a hash function (or prehash function, whatever term you prefer). A hash function should map the keys as uniform as possible. So lets discuss some decent hash functions to some high end hash functions. What Problems Does Hashing Solve ? Simple Implementation of Hash Table Collision Resolution Chaining Open Addressing Desining ...

Hash Tables : Handling Collision

We saw in the previous post how a simple hash table can be constructed without much effort. But, and that is a big But, that table was prone to collisions and could result in corrupted data. Of course we don't want a data structure which can corrupt our data even if it is faster. So to avoid data corruption we will study some collision resolution techniques and will see how to evenly distribute a key over the table to minimize collision. Lets continue the journey. What Problems Does Hashing Solve ? Simple Implementation of Hash Table Collision Resolution Chaining Open Addressing Designing Hash Functions How Python Dictionaries Work Hashing in Action Collision Resolution First of all, what is collision ? Collision is a phenomenon which happens when 2 or more distinct keys are mapped to the same hash table entry. But we don't wa...

Hash Tables : Scratching the Surface

Have you ever worked with key-value data stores where you can attach one value to a key and store it in some form to perform easy lookups ? If yes, then i guess you have already seen hash tables in action. Hash Tables are so common these days that you don't even realise when you start using them but not a lot of people are familiar with the internals of hash tables and how these can be used in real world problems like cryptography. This a series of articles all about hashing. So sit tight and enjoy the journey. What Problems Does Hashing Solve ? Simple Implementation of Hash Table Collision Resolution Chaining Open Addressing Desining Hash Functions How Python Dictionaries Work Hashing in Action What Problems Does Hashing Solve ? Hash Tables are the most popular data structure in computer science. We forget ...

Cache : Replacement, Mapping and Writing

In the previous article , we discussed about cache and its properties. We also learnt some concepts and terminology related to cache. If you haven't read that article, i will recommend you to read that article first. This article contains many terms which i've discussed in that article. In this article, we will learn cache replacement strategies, cache mapping techniques and cache writing techniques. Below is the index of this complete cache tutorial. Cache Introduction Cache Organisation Understanding a few Concepts Cache Replacement Strategies Random Replacement Least Recently Used (LRU) Replacement Cache Mapping Techniques Direct Mapped Cache Set Associative Mapped Cache Fully Associative Mapped Cache The Tedious Task of Cache Writing Write Through No Allocate (write around) Allocate Write Back Basic Cache Simulator Cache Replacement Strategies I...

Image Search Engine Using Python

Images provide a lot more information than audio or text. Image processing is the prime field of research for robotics as well as search engines. In this article we will explore the concept of finding similarity between digital images using python. Then we will use our program to find top 10 search results inside a dataset of images for a given picture. It won't be as good as google's search engine because of the technique we will be using to find similarity between images. But what we are going to make will be pretty cool. So lets start. Setting up the Environment Our Algorithm How the code looks Lets build the GUI Additional Techniques Setting up the Environment The code we are going to write requires a few tools which we need to install first. I will try to be as precise as i can and if you get stuck into installing some tool then you can drop a comment below and i will help you sort out the problem. So here are the tools and the steps to install ...

Authentication System : Basic Design

Being a system administrator, it is our main concern to protect users' data from theft and corruption. Regarding theft, we focus in building a sophisticated but secure authentication system which can fulfill all the basic needs we discussed in the last article . In the previous 2 articles, we learned about authentication and authorization. Also we understood the complications in building a secure system which can prevent tresspassing. But we have not code anything yet to build something. So in this article we will be designing an authentication system which will provide the functionalities we want and which will help us understand how the tech giants like google have taken security to another level. We will be writing code in php but the same applies to other languages also. What we'll be using Blueprint Building the system Running the system Additional Care What we'll be using Lets see what are the languages we will be using and database plus som...

Authentication: A step to security

Here we are, continuing our discussion on authorization and authentication. If you have red my previous article then you would have known by now how important these concepts are and why these need to be implemented efficiently. But in the previous article, we only talked about them and didn't look at how to actually implement them. Cybersecurity is so vast field that we can't understand all of its complexities in one article but what we can do is we can start with some pretty basic stuff and move along to provide our application some sort of security. So in this article we'll see how can we implement authentication checks in server-client systems and specifically in web applications. But for other type of applications like desktop apps, mobile apps you can follow the same procedure although the technology would be different. Lets have a look what we are gonna learn today:- Our Goal General Procedure Answers to some General Questions Cookie Theft Our Goa...

Authentication and Authorization

Authentication and Authorization are 2 independent concepts both of which are constituents of security. Authentication , in a vague manner, means to recognize someone and Authorization depicts to give that person some permissions. To understand it more better, a really simple example would be to know these concepts regarding to operating systems. When we log into our computer the OS checks whether our credentials match to any user of the computer. That is what we call authentication. Once the OS finds a match, it logs us into the computer. Now if we want to open a file then the operating system checks whether we have permission to do so or not. This is the time when the OS is authorizing us. If we have permission then OS will open the file for us otherwise it won't. So in this post we'll see how can we implement these features in any system and take safety measures to prevent intrusions. This post can be a bit boring but its actually a building block of what we'll learn i...