Shortcut: String to number in JS

Put a + (plus) operator in front of a string to convert it into a number.

+'12' (string) => 12 (number)
let x = '40'; (string)
+x => 40 (number)
There are three types of people.

  1. People who complain about the flow
  2. People who do nothing and go with the flow
  3. People who go with the flow and change the flow themselves

Now, you choose which one you want to be, do nothing, complain or change?

Structures in C

An introduction to structures (struct) in C.



Reactive Extensions (Rx) Programming

Reactive extensions (Rx) is a set of tools/API available for almost any popular languages/platforms out there, which aids in a new way of asynchronous programming (well, not completely new :p).

Most of the time, the way we write programs, we query data from a data source and wait for that data set to be ready. Once the data from the source is ready, only then we can perform different kinds of operation on it. This waiting process is blocking or synchronous i.e it blocks the program execution and waits for the data to be loaded. What if there was a mechanism that allowed the data source to push data to us and we could perform various kinds of operations on the data as it comes? Welcome to Reactive Extensions (Rx). Rx allows us to do exactly this. It exposes a set of types (Observables  & Observers) and operators (operations we can perform on those types) to aid us in asynchronous programming. This way, we don't need to wait for the data by blocking the program execution. Besides, we can perform operations on the data as it comes rather than wait for the whole data set to be ready. Its quite similar to event driven programming where you subscribe to an event by passing a callback and the system will execute the callback whenever an event happens. Although, Rx is much more powerful than just ordinary event driven mechanism.

Power function

In C/C++ (and also other languages), we have the built in power function to raise a number to a given power. What if we need to calculate ...