How to Query a JSON Column in PostgreSQL

As a software engineer, it is common to store structured data in a relational database such as PostgreSQL, or unstructured data in a non-relational database such as Mongo DB. Luckily, PostgreSQL allows defining column types as json and jsonb, which are two JSON (JavaScript Object Notation) data types that allow storing unstructured data in a … Read more

(Solved) Argument of type ‘() => Promise’ is not assignable to parameter of type ‘EffectCallback’

I’ve been using useEffect hooks heavily since React introduced them in version 16.8. A way to think of Effect hooks is like React lifecycle method (componentDidMount, componentDidUpdate, componentDWillUnmount) bundled into one function, or hook as React defines it to perform side effects in function components. Recently I came across the error Argument of type ‘() … Read more

(Solved) Property ‘allSettled’ does not exist on type ‘PromiseConstructor’

Recently I learned about the Promise.allSettled() method which generates a single promise from an array of promises similar to the Promise.all() method, with the main difference that Promise.allSettled() runs all the promises passed regardless if a promise is rejected. I initially was using Promise.all() for logic in a NodeJs Express application using TypeScript. However, after … Read more

How to make redirects from the server side using NextJS?

Whether you recently changed the path of your articles from /blog/[article-slug] to articles/[article-slug], or you need to redirect a user to the login screen to authenticate prior to granting access to a page, learning how to do redirects on the server side is an effective way to avoid React doing unnecessary rendering on the client … Read more

(Solved) Cannot Convert Undefined or Null to Object in JS

The error “TypeError: Cannot convert undefined or null to object” happens when JavaScript attempts to convert null and undefined to an object. Below you can see examples of when this error occurs. In the previous example, notice how the Object.assign() , Object.keys() , and Object.values() methods expect a parameter o equivalent to any JavaScript object … Read more

(Solved) TypeScript Array.find() possibly ‘undefined’

Errors like “TS2532: Object is possible ‘undefined’” can happen after defining the value of a variable by using the array.find() method. Here are the possible reasons why thearray.find() method returns undefined: The predicate parameter or callback function passed to the array.find() doesn’t explicitly use the return keyword to return a truthy value. The predicate parameter … Read more

How to Print a Raw Pointer in Rust?

The other day I wrote an article about the dereference unary operator (*) and I needed a way to explain the unary operator by first explaining about pointers in Rust, which are the memory address location of, for example, a variable. However, I didn’t know how to print the pointer of a variable, without displaying … Read more

Rust | (Solved) “Missing type for `const` or `static`”

Have you come across the following error error: missing type for const item in Rust? Chances are, you defined a constant value like this: At first, this doesn’t seem to be an error as Rust is capable of implicitly determine the data type of other non-constant scoped variables (let ) like the one you see … Read more