The Evolution of Concurrency Patterns in Go: From Goroutines to Advanced Worker Pools
Remember when you first dipped your toes into the world of concurrent programming? If you’re like me, it probably felt like trying to juggle while riding a unicycle. But here’s the thing: in today’s tech landscape, mastering concurrency isn’t just a cool party trick—it’s becoming as essential as knowing how to loop. Enter Go (or Golang, if you’re feeling fancy). This language burst onto the scene in 2009 with a battle cry of “concurrency made easy!
ChatGpt 4o, the Rise of Conversational Interfaces and the Shifting Landscape of Human-Computer Interaction
Picture this: You’re a sales manager trying to stay on top of your team’s performance. Instead of navigating through complex menus and dashboards, you simply turn to your computer and say, “Get me the list of all new leads for the last month.” Instantly, your screen displays a neatly organized list of every new lead your team has generated, complete with contact information, lead source, and potential revenue. Or imagine this: You’re a business analyst tasked with identifying trends and opportunities in your company’s sales data.
The Art of the Algorithm: How AI's Gaming Strategies are Shaping the Future of Innovation
Demis Hassabis is a name you might not have heard before, but trust me, you will. This guy is the real deal when it comes to artificial intelligence (AI). He’s the mastermind behind DeepMind, a company that’s been making waves in the AI world for years now. And recently, he gave a talk that blew my mind. Now, I’ve been around the block a few times when it comes to technology.
Exploring Chain-of-Thought: Enhancing Problem-Solving in Large Language Models
LLMs are like enormous digital brains that have read a vast amount of text from the internet—books, articles, websites, and more. By doing so, they learn how to predict what word comes next in a sentence, which in turn helps them write essays, summarize texts, and even create poetry. However, despite their impressiveness in handling language, these models often struggled with tasks that required deeper levels of reasoning or problem-solving, such as math.
Building a simple query parser using PEG in Go
In another post, Simple Query Parser we had built a simple query parser using Participle - a parser builder for go lang. Parsing expression grammar (PEG) is a type of grammar. The advantage of PEG is that it doesn’t tolerate ambiguous grammar definitions and so is better in error reporting. The go language port of PEG is pigeon The popular Javascript port of PEG is pegjs. A good introduction to PEG grammar can be found in the pegjs documentation and also here.
How to support custom Javascript scripting in Go Applications
Why will someone need a Javascript Parser, written natively in Go? Isn’t it a crazy, Architecture Astronauts solution that is looking for a problem? Not necessarily. There was a time when applications allowed some kind of scripting to extend them and to make them fit into any workflow. For example VBScript for Microsoft office products. However, very few Web applications have the infrastructure to allow custom scripts inside them. There are a few that does support; one example is Google Apps Script.
Let's build a search query parser in Go
Mini languages are great. Makes it easy to express what you want in a concise manner. Sometimes a complex UI can be replaced with a mini-language. Some time back, google used to support a simple language in the search queries. For example: “some phrase” +required -not_required . Alas! they stopped it and Google search is less cool ever since. I would count regular expressions also as a mini-language. Imagine we are building an online store that allows searching for products using a simple but structured query language.
How to load from a JSON file to Javascript class object (Javascript/Typescript Serialization)
It is a common requirement to load a nested Javascript class from a JSON file. Sometimes you want to send the JSON across a network and load it back to a Javascript class. For better clarity, let us understand the difference between a Javascript class instance and an Object. Take this class for example: This is a class that draws a rectangle on the canvas class Rectangle{ public x:number=0 public y:number=0 public width:number=0 public height:number=0 public draw(ctx:CanvasRenderingContext2D) { ctx.
Creating an isolated cluster - provisioning a cluster and a Bastion host using Ansible
This is the second part of the series on setting up a cluster using Terraform and Ansible. In the first part, we had set up the bare cluster Virtual Machines. The set up included a virtual private network, a bastion server, and a separately configurable cluster of nodes. The nodes are ready but not software or configuration is done so far. In the next step, we will provision all the nodes in our cloud
Setting up a Bastion host and a three-node cluster on Hetzner cloud using Terraform and Ansible
Infrastructure as code has a great benefit - you can make a cluster available in a few minutes. Then, switch the configuration with a few updates to the configuration. If you ever had long hours staring at blinking LEDs while it installed from a stack of CDs, you will know what a relief this is. Terraform makes it possible to declaratively create the cloud infrastructure, supports all major cloud providers, and is easy to learn if you can spare an afternoon.
Background task processor in Go with persistence support using BadgerDB
Goroutines can run tasks concurrently. However, for most practical scenarios, you have to keep track of the status of those tasks. In case the process exited, killed, or power cycled, a mechanism should restart the unfinished tasks. For example, imagine you moved order status emailing to a goroutine. If the process was terminated or restarted we have no way to keep track of the tasks that were in progress. A background task manager can keep track of the task in progress, retry if required, and also manage scheduled and recurring tasks.
A Simple Wrapper to BadgerDB Key-Value store in Go
BadgerDB is an embeddable key-value store written in Go. It is a persistent store. In this article, we build a wrapper around badgerDB. The purpose of this wrapper is to make it simple to save simple values to the DB in “virtual tables”. The concept is an adaptation from the Sett project. Much of the code -especially the unit tests - are changed though. Usage import( "github.com/prasanthmj/sett" ) s := sett.
Build a very fast, highly customizable static website using Hugo in less than 10 minutes
Hugo is a fast static website builder written in Go language. The advantage of static sites is that the site can be hosted easily since it does not require any server-side scripting like PHP, Ruby, or a database like MySql. Static sites are very fast since there is very little server-side processing involved. Most importantly, there are several platforms where you can host your website for Free! That’s right, absolute 0 monthly costs.