Methods in Golang

Methods in Golang

In Golang methods act on types. They are very similar to regular functions except that they take a receiver as a parameter. The receiver is the type which the method will be attached to. This will allow us to do something like myTypevar.doSomething(). For those coming from a language with classes and objects methods in Golang are similar to class member methods. As with regular functions you can pass the receiver by value or by reference. By convention a type’s…

Read More Read More

Useful Resources

Useful Resources

This isn’t a post post. Its just a post to list some useful resources which I don’t want to forget about. They will be really useful for you too… Websites Refactoring.guru – An amazing site about refactoring AND design patterns. Exercism.org – . Learn to program in a programming language of your choice. NeetCode.io – Learning algorithms and interview prep FrontEndMasters.com – Free Algorithms Course Youtube ThePrimeAgen – Really cool channel about software dev/engineering.

Observer Design Pattern

Observer Design Pattern

The Observer Design Pattern defines a one to many dependency between objects such that when one object changes state all of its dependants are notified and updated automatically. The observer design pattern is a really simply, yet incredibly useful pattern. You’ll already be familiar with how it works. Imagine you want to be kept informed of the weather updates for your area (or if you’re in South Africa – Eskom se push!). You download your favourite weather app and subscribe…

Read More Read More

Linked Lists

Linked Lists

Linked lists are a data structure in which the data nodes are linked together via pointers. Pointers point to something. In this case a node points to another node. Linked lists are useful in building up other data structures like binary search trees etc. In this blog we’re not going to use pointers to memory as we would in a language like c, we’re rather going to emulate this with simple arrays. We’re going to discuss then extremely briefly and…

Read More Read More

Laravel Factories

Laravel Factories

When creating an application you’ll often want to add in dummy data for testing functionality, layouts etc. PHP has an excellent faker library to create all manner of fake/dummy data like email addresses, names, surnames etc. This faker library comes packaged with Laravel, ready to use. A quick Laravel faker test. We’ll do a quick faker test. Open up tinker and get a name. name will return a full name in the format “firstName lastName”. In tinker, type: fake()->name();. You…

Read More Read More

Streamlining API Versioning in Laravel: A Smart Approach to Route Inheritance and Overrides

Streamlining API Versioning in Laravel: A Smart Approach to Route Inheritance and Overrides

A new Laravel install has several route files. The two most widely used route files are routes/web.php and route/api.php. As their names imply, these are for web (browser) routes and API related routes. In this post we’re only going to be looking at the API route. Let’s assume that we have a GET endpoint to get a list of all users in our API. We could do this simply in the route file (typically we’d set up controllers etc but…

Read More Read More

Web sockets | real time communication between front and back ends

Web sockets | real time communication between front and back ends

NOTE: I have a new post in the pipeline about web sockets using Laravel’s Reverb which is new in Laravel 11 as well as Laravel’s echo on the front end. I will include a link to that post here once its up. This is a more general post so perfectly usable in PHP without a framework. Its been a while since I’ve written a post and this is a good one (if I do say so myself!). In today’s fast-paced…

Read More Read More

Laravel Service Container

Laravel Service Container

In the realm of web development, managing dependencies effectively and ensuring code remains flexible and maintainable is crucial. Laravel offers a powerful tool known as the Service Container to address this.

In this post, we’ll delve into understanding the Laravel Service Container, why it’s invaluable, and how it can make your development process smoother. We’ll explore the intricacies of Dependency Injection, the significance of Interfaces, and the convenience of Laravel’s app() helper function.

Install and configure HA Proxy on Ubuntu

Install and configure HA Proxy on Ubuntu

Installing the latest HA Proxy You could use sudo apt-get install haproxy, but the version in the repo is likely not the latest stable release. To get the latest stable release, check on the HA Proxy site which is the latest. At the time of this writing it was 2.5. You can use PPA (personal package archive) on Ubuntu to get the latest version: sudo apt install –no-install-recommends software-properties-common sudo add-apt-repository ppa:vbernat/haproxy-2.5 -y sudo apt install haproxy=2.5.\* Adding =2.5.\* to the end…

Read More Read More

How to check your paypal account age

How to check your paypal account age

Paypal have done a decent job of hiding your own info from you. You may want to know when you opened your paypal account (as I recently did as part of a vetting process). The info seemed to be well and truly “not there”. Fortunately I stumbled across a link, which I am keeping here for future reference: https://www.paypal.com/businessprofile/settings/info