photo from unsplash.com

Most recently, I was tasked with retrieving a CSV file from a remote Secure File Transfer Protocol(SFTP) server, extract certain fields from the file containing at least 5000 rows and save each of the rows as a record in PostgreSQL. Here is a summary of how I was able to pull that off :)

Introduction

I broke down the task into the following chunks:

  • Connect to SFTP
  • Check for a file match(regex came in handy here)
  • Download the file into an in-memory storage
  • Parse the file data from in-memory into an array
  • Destroy the existing locations database (more on this later)


Photo by Hans Eiskonen on Unsplash

The async/await paradigm has continued to dominate the JavaScript community since its invent. An async function, created from JavaScript’s AsyncFunction built-in (though not global) object (or constructor if you may ), offers a new iteration of (writing) asynchronous functions in JavaScript.

If you want to debate about async/await vs promises, kindly, do it on this blog post instead as this tutorial refrains from any attempts to differentiate/contrast the two. However, I should mention that they are not mutually exclusive but rather complementary: async/await builds on Promises and Promises use callbacks .

A few facts about async/await functions

  1. Declaration:

The approved syntax for async functions is placing…


Photo by Henri L. on Unsplash

What is Joi?

Joi is an object schema definition language and validator for JavaScript objects. It is a magical tool that allows you to create a set of rules and validate input data against them. How cool?

Its NPM package boasts of close to 3 Million weekly downloads! Presumably, it is by far the most used JavaScript schema validator, on the planet.

Joi in play

Joi in play.

In the personSchema above, name is a required field, but age isn’t. Joi differentiates two by calling required() function on the specific field. It supports many types such as number , boolean


image from unsplash.com

Introduction

Reassigning the value of an argument variable mutates the arguments object. Mutation is the act of changing the source or the original element. Misuse of mutability can cause side effects to your software. In light of this fact, senior developers have across the globe found themselves opting for persistent data structures or Facebook’s immutable-js as a way to avoid mutation.

See this:

mutation in play

How do we avoid mutation?

Since mutation alters the original object and returns it, this gives us the idea of copying/cloning the original object.

An update shouldn’t change the original object, instead create a…


Image from Unsplash.com

Knowing the usage of resources would go a long way in helping identify parts of your system that need to be optimized.

Since theevent loop is germane to the story, let’s decipher it first.

The Event Loop

Node’s architecture is mainly composed of two major components: V8, the engine that serves as the JavaScript interpreter and libuv, the library that provides event loop to Node.js. Also, of importance is the fact that in a Node application, everything goes through the event loop.

Node.js is an event-based platform, which means that everything happens as a reaction to an event. In any given event-driven application…


Image from unsplash

Apparently, JavaScript is a prototype-based language. This means all the basic data types you use come from an existing prototype.


Definition

In computer programming, variables are used to store information to be referenced and manipulated in a computer program. Their sole purpose is basically to label and store data in memory.

You should know that naming variables is known as one of the most difficult tasks in computer programming, so think hard about the names.

Ways of Variable Assignment

There are two known ways of variable assignment namely;

  • By Value
  • By Reference

By Value

Variables that are assigned a primitive data type are said to contain their values. In JavaScript, for example, there are five primitive data types namely; Number, String , Boolean, undefined and null .


New’s come, let go of the old! Technologies evolve over time, with very smart people behind the wheel in bringing these changes home. Newer versions of a framework, or a library, or any piece of software, in most cases is always an improvement of the previous version. Bugs fixed, issues raised by the user (tech) community addressed in subsequent releases.

Ruby on Rails, is one of the most maintained frameworks — with the most recent version being 5.1.4 at the time of this writing. D.H.H. …


Off to the village. Merry Christmas :)

CHRISTMAS, a time when Christians commemorate and celebrate the birth of their Saviour, and everyone, including atheists, get a break from work, is celebrated differently across the world. In Kenya, this season inevitably causes heavy traffic in most of our roads as a large number of excited kins rush into malls to make last-minute shopping, while others load up their baggage into public service vehicles en route to villages. At this time, almost everyone seems willing to wait in traffic, no hooting on the traffic controllers.

Having lived in the capital city for almost a decade, I have seen street…

Harrison Kamau

A software engineer, mentor, and a writer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store