types/uuid - Uncaught TypeError Object(...) is not a function less than 1 minute read

If you want to check if a string is an UUID (Universally Unique Identifier, aka GUID) in reactjs.

You can use the NPM package @types/uuid to do it.

Read more
Which tools you need to develop web applications in ReactJS? 1 minute read

Tools:

  • Visual studio code
  • Chrome


Visual studio code extensions:

  • Auto Import

This extension will propose to import the related type you add in your file. It works for scripts developed in TypeScript and TSX.


Read more
An optimized version of function sys.fn_cdc_is_bit_set less than 1 minute read

Change Data Capture (CDC) table uses __$update_mask to track the modifications of ordinal columns.

__$update_mask’s type is varbinary(128)

The function sys.fn_cdc_is_bit_set is provided within Microsoft SQL Server. It is used to calculate if the value of a column is modified, based on the column’s position and the __$update_mask.

Read more
Microsoft .NET challenge France 2020 final 3 minute read

I’ve participated in the Microsoft .NET challenge France 2020 final, eventually one year later. ;)

The Microsoft .NET challenge France is co-organized by several companies:

  • SoftFluent, an IT consulting company specialized in the Microsoft ecosystem with C#, .NET, Azure, SQL Server etc
  • EditX, a company host a lot of online tests.
  • Microsoft. No need for introduction. :)

Read more
How to create integration tests with Entity Framework (EF) core? 2 minute read

It’s not easy to create integration test with database, no matter whether you create queries directly against entity framework’s DbContext or you create your queries with repositary pattern which operate on your DbSets.

You need to always connect to your database to test your use cases with the real data or fake data you have prepared.

The good news is you can use the EF core’s in-memory database provider to tackle it easily.

Read more
How to upload and download file in Angular 5+ and .net core 3 minute read

When you develop a web application in Angular for the front-end and C# or Java in the back-end, it’s frequently that you need to upload and download files.

Here is an example that may inspire you in your development.

Read more
MS SQL server full-text index reserved words 6 minute read

Full-text index is different from clustered and non-clustered index in SQL Server.

Clustered and non-clustered index use a B-tree structure.

One table can have only one clustered index. And table data is physically ordered and stored into pages based on the clustered index. Page is the fundamental unit of data storage in SQL Server.

The table data is organized with root node (type: INDEX_PAGE), intermediate nodes (type: INDEX_PAGE) and leaf nodes (type: DATA_PAGE).

Read more
How to create unit tests on internal methods and protected methods in .net core? 1 minute read

You’ll inevitablly write unit tests or integration tests for internal methods and protected methods in your .net project.

Here are some techniques you can use.

To test internal methods in projects developed in .NET Framework, you need add the following code in the AssemblyInfo.cs of the target target, then all its internal methods are visible to the tests project.

[assembly: InternalsVisibleTo("AssemblyName.Test")]
Read more
How to download an Excel file from ASP.NET Web API in Angular application? 1 minute read

I’ve looked for some complete solution to download an EXCEL file from an ASP.NET Web API in Angular 9 application, but I didn’t find it.

As I’ve done it recently, I would like to share my implementation with you if it helps.

Firstly, expose an interface in the Web API to download the Excel file.

Read more
Which library to generate Excel in C#? OpenXmlSdk or ClosedXml? 9 minute read

I need to generate Excel files in my recent work. The file is not huge and it’s around 5000 lines.

I have tried two open source libraries to generate them.

They are:

  • OpenXmlSdk
  • ClosedXml

There is very good library EPPlus which is very popular. It has become a commercial product since the version 5, so a license is required for commercial use. I work for a French bank, and I prefer to use an open source library because of the long purchase procedure in the bank and the cost.

Read more
How to deploy react app to GitHub pages 2 minute read

Github-pages is very practical to host static websites, not only Jekyll based websites, but also Angular, React based static websites etc.

You don’t need to purchase a space for the websites hosting. It’s totally free! All you need is just a GitHub account. :)

Read more
How to transform web config or app config by environment in visual studio 1 minute read

In software development, there are at least several environments to manage: development (DEV), staging (STAG or PRE), and production (PRD).

There will be integration (INT), user acceptance testing (UAT) in a more complete environment configuration.

It could be frustrating when managing all those environments because a small error in the deployment could generate an incident, or disaster!

Fortunately there is a cool tool to facilitate the environment management and software deployment in visual studio.

Read more
How to change ASP NET MVC Web API output to camelCase less than 1 minute read

Unlike ASP.NET CORE Web API, ASP.NET MVC Web API’s will not serialize the output in camelCase.

camelCase example:

firstName
lastName

PascalCase example:

FirstName
LastName
Read more
How to resolve CORS AllowAnyOrigin and AllowCredentials conflict in ASPNET CORE Web API less than 1 minute read

When you implement an ASP.NET CORE Web API, you may want the API to support all clients from anywhere and enable credentials at the same time.

You need to make the CORS (Cross Origin Resource Sharing) configuration in your Web API.

Read more
REST API Design - What is OpenAPI-compliant API? 10 minute read

The OpenAPI Initiative (OAI) was created in order to standardize the API design.The OpenAPI Specification (OAS) was originally based on the Swagger Specification, donated by SmartBear Software.

The OpenAPI is programming language agnostic.

You can see the OpenAPI Specification change history here


Read more
REST API Design - Richardson Maturity Model 2 minute read

Leonard Richardson has defined a Model to determine an REST API maturity, called Richardson Maturity Model.

There are 4 levels of maturity.


Read more
How to do Code-First approach with Entity Framework Core and SQL LocalDB 4 minute read

If you have used Entity Framework, you have probably known that there are 3 possible approaches to work with the database:

  • Database First

Database First is the most common practice when working an existing database.

In this case, an .EDMX (Entity Data Model XML) file will be generated when you map the database in your project. And it contains all the data models.

Read more
SqlLocalDb Versions - Windows API call RegGetValueW returned error code less than 1 minute read

I’ve met this error when I check the version of SQL Server LocalDb in my machine.

>sqllocaldb.exe versions

Error:

Read more
Some useful resources in developing websites with Angular 1 minute read

I would like to share some useful tips in developing web applications with Angular.

Read more
How to configure Jekyll on Windows? 7 minute read

Let’s see how to configure Jekyll on Windows.

1. Install RubyInstaller on Windows

It’s recommanded to install rubyinstaller-devkit-2.6.5-1-x64.exe for now.

Download RubyInstaller

Read more