WHAT'S NEW?

Andy Android Emulator Review : its a headache emulator

In the last 2 days, I have tried installing multiple Android Emulators out there on the internet. I will now start writing the review on those one after the other.
I would like to start this with Andy emulator, the one that had tortured me and literally harrasd me.

The biggest downsides of Andy are:

  1. It took away a huge piece of disk space. It took 4.5 GB space.
  2. Leave about eating away space, the biggest disadvantage is that it did not give me an option during setup to change the location of the installation. It by default installed everything in C drive. What the Heck! is this.
  3. It took close to an hour to install on a machine that runs on i5 Intel, with 4 processors and an internet speed on 8GB. BS! a real BS.
  4. I did not show what all are its dependencies. Half way through, it started asking me permissions to install Java Virtual Box softwares of multiple types. One more BS. This made me stick to my seat staring at my monitor.

I felt like i will puke (vomit) on my laptop screen before it finishes. Thanks to my mom, she gave me a needed break with a wonderful coffee. 




Elasticsearch :: count query

I have an index in Elasticsearch that has bank details. What if I want to query this index (database) to find all the account holders whose age is equal to 40 and who does address lane does not have the word 'lane' in it?

here is the query. I get the count

Why I do 15 min or else duration video tutorials

Building Nodejs REST API - Part 1 - What is package.json

Hi friends,
Here is the 3rd video in the series for learning Node.js and building a REST API. In this video, i give you a brief introduction to package.json file.

package.json file is the place where it holds few important information about our nodejs application. It holds the information like the dependencies, the dev-dependencies etc. So, if you install express, then the version of the express that you installed is mentioned here as a dependency.
Watch this 11 min video. As promised, i will make sure that i dont cross 15 min of time in video length. So that each video can separately answer you a concept.




How a C# code becomes a running application


Ever wondered how our C# code gets compiled and becomes an executable that runs on our machines?

I am sure I wrote more than a million lines of code in C# alone in my career of 7 years till date. I should have written another million lines of code in SQL Server, Android, Node.js, JavaScript and few other NO SQL languages like Mongodb, Redis and Elasticsearch.

Today, i was cleaning up my book shelf and found a book that i wrote sometime in 2012. That was when i was not even 4 years of experienced and the only language that i spoke apart from my mother tongue, Hindi and English was C#. In that i drew a flow chart which explained me the steps that were involved in making my C# code become an executable/ a dll that ran on my machine. I wanted to share it with you all and here it is [ not the hand written one, of course :-) ]


What is EventLoop in Nodejs and how does it work







What is EventLoop is Nodejs and how does it work

Step by step installation of Nodejs application to Heroku Cloud platform for beginner

Step by step installation of Nodejs application to Heroku Cloud platform for beginner

Hi friend, this time I have decided to write on how to deploy Nodejs application to Heroku cloud platform. This is such an important article on my blog and in my faith of sharing knowledge helps us more. This is because I have had a very tough time understanding on how Heroku works and how to push an application(Nodejs) in my case. I spent almost 2-3 days of sleepless nights apart from my working hours at office, and 3 hours of travel everyday. 
So here we go...
Points to note, I did not address on how to create an account in Heroku or what is Heroku dashboard etc as they are basic steps and are easy to do. I have used Mongodb as my backend and I use a separate Mongo lab account and call it in my app than getting it registered inside the Heroku as an add on. The add on via Heroku is a chargeable account.


Review : Visual Studio Code

Visual Studio from Microsoft is mostly used as a paid one except for small application and demos that are done by people like us. For quick code snippets and tutorials, Visual Studio Express has been released a along with VS2010. From then on, Microsoft has been having an eye on the trends and developments in the market.
They have released plugins via their NuGet package manager for Node.js, CofeeScript and many others in the last few months.
After Satya Nadella became its CEO, Microsoft has predominantly been embracing open source communities. Their MVP now includes open source contributions as well.
They have recently released VS-Code editor that fits rightly for a right looking IDE for Node.js. Its light wait and installs quickly. It is a perfect one to develop ASP.NET with Node.js.
  

ASP.NET WEB API Basic Authentication Custom with ASCII encoding and Base64 Encoded username and password

ASP.NET WEB API Basic Authentication Custom with ASCII encoding and Base64 Encoded username and password

Hi mates, In the last article, we have explored the ways to do basic authentication by picking up the username and password from the request headers in Node.js using Express.js request object.


Today, in this article we will look at how we can achieve the same in ASP.NET Web API.

To Implement the basic authentication, we need to have our custom authentication class inherit from AuthorizationFilterAttribute that is part of the System.Net.Http.Filters namespace.

So, lets create a class named myAuthentication and let it inherit from AuthorizationFilterAttribute  as shown below.


Once that is done, let us see if the headers have the authorization property filled with data.
The username and password are in the headers under the authorization property that returns AuthenticationHeaderValue object. Of all these values, Scheme and Parameter are the properties that are of our interest.


Once we have the authorization one, the Parameter property of this has the encoded value that is of our interest. We need to decode this. In general, the caller of the API and the API provider have an understanding about the kind of encoding they follow. In our example let us consider that our data is ASCII formated Base64 encoded data.



As of this example, we will see if the username and the password are same. If they are, we will allow the user to access our API else we will throw unauthorized error status (HttpStatusCode)

So this unauthorized exception is thrown with a custom information on how the user can make a call to our API. This is done by adding data in the response headers of the actionContext object that we get when we inherit AuthorizationFilterAttribute  and override OnAuthorization method.

So, lets look at our myAuthentication class code.

Basic Authentication using Expressjs in Nodejs API with Base64 encoding

Basic Authentication using Expressjs and Nodejs Base64 encoding


Express.js gives us an out-of-box solution for ding basic authentication via its request parameter.

We all know that the callback function has request and response (req,res). So, when the user makes a request to our Node.js, we receive Header information as well in the request object. In that if 'authorization' property is set and given a value, that can be used. We can ask our REST API consumers to send username and password in Base64 encoding as the value of this authorization property.

The base64 coded value can be obtained using https://www.base64encode.org/
For us, the validation is if username is equal to password we give the data to the consumer of the API. In real life scenario, we might do it against the data values in our DB.

Let us take a look at the code. The code itself has explanation. Please drop a comment /share this post if you like it or even if you have any queries. See you soon with one more tutorial.



Ultimate Node.js Beginner Tutorial - series - Introduction


Ultimate Node.js Beginner Tutorial - Introduction

I know you would have read a lot of blogs / articles and pages on internet and watched hours of Node.j sessions on YouTube and coursera. You might have landed on this page praying that at least this page should do some justice to your relentless and tiring search for a better article. 

If the above statements are true, even to a certain extent then trust me, you are at the right place. In the series of articles on my blog, I will make sure you leave from here with stomach full of knowledge on Node.js and your nerves full of enthusiasm and your heart full of belief and your neurons full of excitement to develop the next Node.js application. 

Let’s jump right away on the task. We have a big task ahead and no time should be wasted.



Here is the Video for you guys. There is more in it on top of the content that is in this post. Listen to it, subscribe and share.


Building REST API using Node.js 

Question: What is Node.js?

Answer:
·         I know it might be boring to read again and so I will keep it plain and simple.
·         Node.js is a framework that makes us JavaScript run on server.
·         It is built on top of Google Chrome’s V8 engine which is the fastest JavaScript engine till date.
·         Node.js is single threaded.
·         Node.js helps us do Asynchronous I/O operations.
·         Node.js does I/O operations that are non-blocking.
·         Node.js helps us build not just websites but also REST APIs that are easy to design and are faster than web services or WCF services.

Question: How Node.js is fast if it is single Threaded and how does it do non-blocking Asynchronous I/O operations?

Answer: Ahh.!!! I can see the expression on your face. Spot On! That’s what I said, right.
Node.js under the hood takes help of the C++ libraries called as libev and libuv and libeio to make this work.
Libuv is the module from C++ that makes Node.js do all the talking in Asynchronous I/O operations.

Below is the picture to help you understand better.

Question: Then what about the non-blocking aspect?

Answer: As you know JavaScript engine has the event loop that takes care of waiting functions and processes. It is the same thing that is used here. Because that is from V8 engine, it is faster than anything else.

To understand better, here is the picture of the same