Caching is a technique very important to help the web page load faster. It helps increase the UX (user experience) of the user. To cache data, I will introduce In-memory cache in Asp.net Core to help you cache very fast and easy.

1. What is In-memory cache in Asp.Net core?

When the first time a user requests to load a web page, to get data and respond to the browser, we have to connect to the database to get data. And then we will put this data to cache. In-memory cache will store data in the server’s memory (RAM). From secondary request data will not get from the…


1. Installing Vim editor on Ubuntu.

2. Using Vim mode.

3. Create a file using the Vim editor.

4. Open the file to edit with Vim editor.

5. How to save changes in Vim editor.

5.1 Save and quit Vim editor.

5.2 Save file but without quit Vim editor.

5.3 Quit Vim editor but without save change file.

6. Clone and rename file with Vim editor

7. Summary

Please note that in this article I only guideway to manipulation with Vim editor in Ubuntu Linux.

1. Installing Vim editor on Ubuntu.

By default, you need to open a terminal or login to the remote Ubuntu server…


1. Why do we need to resolve dependency injection?

To explain the problem of dependency injection in asp.net core, I provide an example below:

I need to create an application to manage the students of a class in the school. We have many actors such as Student, Class, School…
Now I will create an interface of Student actor and a class to implement this interface (this is a class in the data access layer — DAL).

Interface IStudentDal

public interface IStudentDal
{
List<Student> GetAll();
Student GetById();
Student GetByName();
}

Implement class

public class StudentDal : IStudentDal { private static List<Student> lstStudent = new List<Student>() { new Student(){ Id =…

Dung Do Tien - Jun/03/2020

We have selected 17 frequently asked questions in the CSS interview to help you synthesize your knowledge of CSS and prepare well for your interview. We hope it helpful to you.

CSS Interview questions and answers

1. What is the box-sizing in CSS?

Answer:

The box-sizing property defines how the width and height of an element are calculated (related to the box model in CSS).
As you know by default:
- Width of an element = border left + padding left + width of content + border right + padding right. …


We have many ways to add CSS to Html page but each way has its own advantages and disadvantages. So what is the best way to increase the page loading speed? Let’s find out together.

1. Add css file external to html.

This is the most popular way to add css to html web page. We will separate css to another file with the .css extension. This file can contain large css define and you can import css file to many html pages. To add css file to html page, html support <link> tag to help import a css file. You can use multiple <link> tags to…


If you are a beginner in javascript the first question you will ask: How to add javascript to the HTML page? This is the first step to using javascript.

Answer: We have 3 ways to include javascript to the Html page.

Okay, I will example and explain the advantages and disadvantages of each way.

1. Include javascript inline to Html page

1.1 How to use

All Html tags always have one or more attributes to fire some events when users interact. So write javascript inline is write inside of that attribute ex: Attribute onclick of a button.

Example: I want to display box information show “Hello world” when I click onto…


In all versions of .net, we also see they have config files. From WebForm to MVC 4 we have a web.config file format in XML syntax, this file is very important to config value for some package, version, connection string and custom config value to use when an application running. When we code we have many values needed to fix and use it in more like code but it’s not constant to hand code. If you hand-code it, it will be hard to change when the application is running, also related to maintaining source code. Such as metadata information of…


In this article, I will guide you on how to bundle, minification and gzip static files in ASP.Net Core (all versions). With a web application, the performance load page is very important so we need to reduce page size to make the website load faster. To reduce page size we have many things to do eg: custom img, bundle Js, CSS, hosting, server… But in this article, I only guide to bundle js and CSS files.

1. Setup Environment & Create project

We need a visual studio editor to code. I will use VS2019 to create this example. You can use a lower version.

I will…


Center a div tag in css

If you are a programmer and familiar with CSS, you must know a very simple technique that is how to center a div in CSS?

To center align a div or any tag in CSS is often doing when you write code HTML and CSS. In this article, I will show you 6 ways to center a div in CSS. I only get the div tag to make an example, you can apply this solution for the same tags.

Explain some rules call:

  • Parent tag: This parent tag contains a tag need center.
  • Child tag: Tag needs align center.

1. Using text-align: center

To…


1. What is responsive web design?

In the past, when designing websites, we only designed for a screen that is the desktop device, but today the number of smartphone users accounts for the majority, so this type of design does not meet the needs of users. We need to design a responsive website not only for the desktop device but also for the mobile and some other devices.

Responsive web design means creating a website with an interface that is compatible with all screen sizes. For example, a website that can display well without being broken, clear and easy to use on desktop, tablet, mobile, etc…

Do Dung

Do Dung

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