3 Steps To Import Excel At .Net Core

Today I will tell you 3 steps to import excel at .Net Core.

  1. Install Spire.XLS, you can manage this at NuGet Package manager.


Figure: If you don’t have licence, you can use FreeSpire.XLS.

  1. import Spire.Xls;
1
using Spire.Xls;
  1. Enjoy
1
2
3
4
5
Workbook workbook = new Workbook();
workbook.LoadFromFile([fileURL/fileStream]);
Worksheet sheet = workbook.Worksheets[0];
CellRange range = sheet.Range[sheet.FirstRow, sheet.FirstColumn, sheet.LastRow, sheet.LastColumn];
DataTable dt = sheet.ExportDataTable(range, true, true);

Thanks for watching

5 Steps to use Google Sign-In for Websites

Interesting video about this - https://www.youtube.com/watch?v=Oy5F9h5JqEU

Todays infomation is from google’s guides

  1. Create authorization credentials
    1.1 Go to the Credentials page - https://console.developers.google.com/apis/credentials
    1.2 Click Create credentials > OAuth client ID.
    1.3 Select the Web application application type.
    1.4 Name your OAuth 2.0 client and click Create

  2. Load the Google Platform Library

  3. Specify your app’s client ID

    Or you can also specify your app’s client ID with the client_id parameter of the gapi.auth2.init() method.

  4. Add a Google Sign-In button

  5. Get profile information

    1
    2
    3
    4
    5
    6
    7
    function onSignIn(googleUser) {
    var profile = googleUser.getBasicProfile();
    console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
    console.log('Name: ' + profile.getName());
    console.log('Image URL: ' + profile.getImageUrl());
    console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
    }

More info here - https://developers.google.com/identity/sign-in/web/sign-in

Use Azure Blob Create Cloud Disk

After you know how to use Azure blob, Today I will tell you how to create Cloud disk with Azure blob and MySql

  1. When we upload file, we will get the file md5.
  2. Store that md5 to your Mysql.
  3. When you upload file, if the md5 exist, get the url from mysql, else upload file and save md5.

In that way, same md5 file will only have one file on your blob.

I will show you a story

Figure: User green and user red, they have 5 files


Figure: Only 4 files will be upload


Figure: If User blue want to upload file1, we will only link him with the file

Thanks for watching.

Azure blob Transfer

After you know how to use Azure blob, Today I will tell you how to Migrate your data from one account to another.
We will use AzCopy to do that, you can get more info on Azure Storage Doc - Here

  1. You should download the AzCopy V10 executable file, you can place it anywhere on your computer. - Windows


    Figure: Let’s assume you put it at D:

  2. Get “Blob service SAS URL” of two accounts.
    You will find it at “Azure | Storage accounts | [Your account] | Shared access signature”.
    Just click “Generate SAS and connection string”, you will get the url under the button.


    Figure: Get “Blob service SAS URL”

  3. Use CMD to run AzCopy command
    3.1 Open CMD.
    3.2 Type d:
    3.3 Type azcopy copy “[Source Blob service SAS URL]” “[Target Blob service SAS URL]” –recursive
    E.g. azcopy copy “https://testsourceblob.core.windows.net/?sv=2020-05-06&asdfsdfsagfdsgfdgsdfgfdg"https://testtargetblob.core.windows.net/?sv=2020-05-06&asdfsdfsagfdsgfdgsdfgfdg" –recursive
    PS: Don’t forget add quote at your url.

  4. You can find the log file at your CMD


    Figure: The transfer speed is about 71MB/s

Thanks for watching.

Azure blob

Today I will show you how to use Azure blob.

If you’re not sure what Azure Blob is, or why you would use it, you can see more info on Azure blob - Here


Figure: Relation (As mentioned above, I would expand on this a little)

If you don’t already have an account, you’ll need to sign up for an Azure account, you can register Here
Once registered, click “Portal” in the right corner


Figure: Go to portal

  1. Search blob at search bar, you will find the “Storage accounts” at the Services section


    Figure: Search blob

  2. Click “Add” in the left corner and fill in the required items


    Figure: Add account

  3. Azure blob need “Containers” and fill in the required items


    Figure: Add container
    PS: Pay attention to the Public access level

  4. Now you can upload file throw Azure panel or API (We might talk about this in tne next post)


    Figure: Upload blob

Thanks for watching.

.Net Core 3.1.x Deploy

Today I will show you How to setup .Net Core deploy environment.

  1. Install .net core - https://dotnet.microsoft.com/download/archives
  2. Use Choco to install dotnetcore-windowshosting (3.1.x version)
    2.1 Open powershell - (Run as Administrator)
    2.2 Type “choco install dotnetcore-windowshosting”

    Figure: That figure shows you have successfully installed dotnetcore-windowshosting
  3. Install IIS - use Control panel to install IIS.
  4. Deploy your .Net core web/api on the IIS. - Don’t forget to set “.NET CLR version” to “No Managed Code” at Application Pools

Thank you for see that.

Create React Framework UmiJS

Today I will show you how to create React framework UmiJS at windows 10 system.

Praperation

  1. Install the Node.js (Here is the Link)
  2. Open your cmd
  3. npm i umi -g
  4. mkdir myapp
  5. cd myapp
  6. npm create umi
    create umi

Start

  1. npm start
  2. then you will see the image
    create umi

Deploy

  1. npm build
  2. copy the public to server

More

See the https://umijs.org to find more information

Thank you for see that.