Babel F# pipeline operator

Introduction

Writing readable and declarative code in JavaScript, how nice it would be! 😆
I know, readable and declarative don’t go in the same sentence when talking about JavaScript, but should it be always like this? The community has been looking for ways to improve these problems with the language for years.

Since Babel 7.0 there have been a few proposals implemented that lean towards the readable and declarative JavaScript goal. I’m sure you have heard about the pipeline operator, but if you haven’t then it’s fine, this post will guide you through. This operator is syntactic sugar with the intention to make our code really sweet (pun intended). In this post I’m going to discuss one of the competing proposals, the F# variant.

Continue reading

To box (and unbox)? Or better not to?

Introduction

Working with types sometimes can be very tricky for a developer, regardless of the employed programming language. Surely, many professionals have a story or two to share on this. Types can be tricky beasts and it’s not uncommon to be accompanied with few surprises and often sinister quirks which can cause all kinds of trouble. In this post, I want to discuss about boxing & unboxing value types, the performance penalty of this technique and ways to avoid this altogether when applicable.

Continue reading
Stack of pancakes

Learning data structures – Stack in depth in C#

What is a stack and how it works? What is an Abstract data type and how it’s related with the stack? In this post we’ll explore the stack data structure, I’ll go through the theory behind, explain why stacks are important programming tools, create a custom implementation of a stack with an array from scratch and finally, go through some interesting examples. By the end of this post I do hope that you’ll have a very good understanding of how a stack works under the hood and how you can use it to tackle day-to-day programming problems.

Continue reading

Build a secure Angular client using ASP.NET Core and OAuth

What is the resource owner password credentials grant? How can I secure my Angular client using OAuth and JWT bearer tokens? In this post I will focus on the resource owner password credentials grant, a different kind of credential flow supported by the OAuth protocol, and how it can be used to secure certain resources on an Angular application. Similarly to previous post, I will create the authorization server from scratch, then the resource server, a simple ASP.NET Core RESTful API, and finally the Angular 6 application, with all the bits and pieces required to prevent unauthorized access.

Continue reading

How the pomodoro technique has changed the way I work

For many years I thought that working hard was the way to go. Just make some TO-DO lists, pick work items in order, carry the task on and move to the next. This was my style and I thought this was the proper way. However this proved to be not that great plan, as I had a hard time tracking my progress, maintain focus on tasks at hand, while burnouts occurred more often than usual. On top of that, health issues risen to make things worse, degrading my focus even more. There were times that I was at terrible shape and my performance at work and at personal time decreased, spanning for periods of 3-4 weeks. So working that hard was not the way to go, apparently. Until I found out about the Pomodoro technique.

This is my story about the Pomodoro technique and how it helped me.

Continue reading

ASP.NET Core API authentication using JWT bearer tokens

What is OAuth 2.0 and how its flows can be applied for securing my applications? What does a token do and how it is useful in securing API’s? Is there any way to implement all these nice and easy in ASP.NET Core? In this post I will cover these topics, by first discussing about why token based security is so successful in security scenarios, and the OAuth protocol play in this. We’ll see more closely one of OAuth flows, the client credentials flow and implement it to secure an ASP.NET Web API application.

Continue reading

Structs and the in keyword in C#

Since the release of 7.0 version for C#, we’ve seen many small, yet useful features added to the language, aiming to aid developers, directly or indirectly. A new keyword was added in version 7.2, the in keyword, which makes the reference semantics of the language richer. In this post, I will explore this new keyword, along with readonly structs and the ref readonly modifier.

Continue reading

Learning data structures – Arrays in C#

This is the first post in the series on Learning data structures. What this series aims is to provide basic knowledge on some popular data structures and their algorithms, their use cases and how such knowledge can unleash your potential into thinking and solving problems. In this series I’ll focus primarily in the C# language but I might discuss some topics in the F# language as well, for the most part though I will materialize theory in C# code.

In this post I will discuss about the most fundamental data structure in computer science, arrays.

Continue reading

ASP.NET Core 2.0 Authentication with Azure Active Directory B2C

In today’s post of ASP.NET Core 2.0 Authentication series, I am going to discuss about Azure Active Directory B2C, a service provided by Microsoft Azure for identity access and management.
In previous post, I talked about Azure Active Directory and how useful it is in corporate scenarios, however B2C is a better option for external user access and identity management, with powerful features such as support for various identity providers, policies and many more.

I will first briefly discuss about Azure AD B2C, what is it and how it is different from standard Azure AD. Then I am going to show you how to setup a tenant on Azure Portal, how to configure an identity provider, GitHub in this scenario, and how to setup policies. In the last part, I will show you how to configure your application to authenticate users using Azure AD B2C and how to handle failure events.

Continue reading