In this post, lets explore some lesser known Javascript concepts.

The arguments object

Functions in Javascript have a arguments property that contains the arguments passed during a call. It looks like an array but it’s not an array, it is of the type Arguments.

function foo() { console.log(arguments.length); } foo('a'); // 1 foo('a', 1, []); // 3

That’s why Javascript functions are so flexible. For example, you can write functions like this

function sum() { 
var sum = 0;
for(var i=0; i<arguments.length; i++) {
sum += arguments[i];
}
return sum;
}
console.log(sum(10, 5)); // 15
console.log(sum(1, 2, 3, 4, 5)); // 15

call() and apply()

When we declare a function (without any enclosing scope), it’s declared in the document object (Browser Javascript, not…


The Wikipedia definition of blockchain says

A blockchain, originally block chain, is a continuously growing list of records, called blocks, which are linked and secured using cryptography.

Okay, let’s break it down to get a better understanding.

Blocks

A block contains transaction data, the cryptographic hash of the previous block, the timestamp and a nonce. You must be wondering what a nonce is, It will be explained in detail later, but for now just think of it as a random number.

Image for post
Image for post

A block’s hash is generated using the transaction data, timestamp, previous block’s hash and the nonce as input.

For example, let’s say the hashing algorithm used is SHA-256 (more complex hashing algorithms are used in actual implementations) and assume the following as the block’s…


Blockchain works in a peer to peer network and every new transaction is broadcast to all the nodes so that any one of the nodes could mine it. The process of mining a block involves predicting a nonce value that could satisfy the difficulty level.

What does “difficulty” mean in blockchain?

Difficulty is the relative measure of how difficult it is to find a new block. The difficulty is adjusted periodically as a function of how much hashing power has been deployed by the network of miners.

How is a blockchain validated

  • Every block must satisfy the difficulty criteria (proof of work).
  • Every block must contain the hash value of the previous block and it should match with the previous block’s hash. …


SignalR is a ASP.NET/ASP.NET Core library that can be used to develop real time web applications.

What are real time web applications?

Real time web applications differ significantly from traditional web applications. Traditional web applications pull data from the server by making HTTP requests. In real time web applications the server and client are connected continuously and data flows in this connection without the need for establishing and terminating every connection for every request.

Let’s create a simple application where multiple users can add data points to a graph in real time. We will be using ASP.NET Core 2.1 …


What is content projection?

Sometimes it’s not enough to just design a component and have a fixed view provided in the component’s template.

For example, let’s take a card component that prints the provided data as a fancy card.

One way to create such a component is to get the title, body and footer as component inputs via @Input

and the template (using Bootstrap for styling)

Sure, it does work fine, but what if we want to pass rich text which contains text decorations such as bold, italics, etc? That’s where content projection comes in.

Content projection using ng-content

The ng-content tag when used in a component's template projects the content provided during the component's…


Angular provides two types of Change detection strategies — Default and OnPush.

While starting out with Angular I had a hard time understanding what a change detection strategy is and how it affects the components, I also faced a lot of problems while working with Input properties such as this.

In this post, I will try to explain the two different types of change detection strategies.

Lets start with the Default change detection strategy,

We have the following child component

And in the parent component we have a textbox and a increment/decrement button for changing the name and age properties of a Person object. …


I recently had to write a plugin for eclipse, which needed the ability to run a pattern match on console output. This was the first time I was developing plugins for eclipse so I was pretty clueless as to where to start.

I couldn’t find a tutorial online which was focused specifically on this (or maybe I am really bad at search), so I’m writing one myself.

Note: By no means this a complete tutorial, I’m just presenting my development experience here.

Step 1 : First things first, Install PDE

You have to install PDE (Plugin Development Environment) in order to create plugins for eclipse.

If you have already done this, you can skip over to step…

About

Ravi Teja

Angular, Web, Java and other tech stuff

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