20/05/2022

Sử dụng sequence tạo mã tăng dần theo cấu trúc

 Đôi khi trong dự án bạn cần tạo mã tăng dần, theo cấu trúc nhất định

Có nhiều cách để thực hiện việc này, sql server sequence là 1 cách

bước 1:

tạo sequence bắt đầu giá trị 1, tăng dần 1 như sau

create sequence dbo.testing

start with 1

increment by 1;

go

bước 2:

tạo mã để sử dụng

select 'GID' + REPLACE(convert(nvarchar(10),getdate(),4),'.','')

+ right('0000'+cast(next value for dbo.testing as nvarchar(5)),5)

bước bổ sung:

kiểm tra sequence hiện tại

SELECT * FROM sys.sequences WHERE name = 'testing' ;  

có thể bạn cần reset giá trị của sequence

alter sequence dbo.testing restart with 1;

13/04/2022

Error send mail Security.SslState.StartSendAuthResetSignal c#

 Khi code chức năng gửi mail smtp bằng c#

đôi khi thiết lập mail server không chính xác hoặc SSL mail server không hợp lệ

bạn sẽ gặp exception như sau

===

> Source file path:SendMail

  > Source line number:107

   at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)

   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)

   at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)

   at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)

   at System.Net.Mail.SmtpConnection.Flush()

   at System.Net.Mail.ReadLinesCommand.Send(SmtpConnection conn)

   at System.Net.Mail.EHelloCommand.Send(SmtpConnection conn, String domain)

   at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)

   at System.Net.Mail.SmtpClient.GetConnection()

   at System.Net.Mail.SmtpClient.Send(MailMessage message)

===

(*) Cách sửa đơn giản: MailClient sét EnableSsl = false;

08/04/2022

Microsoft .NET Framework Lifecycle Policy.

 Thông tin vòng đời .net framework cho anh chị em lưu ý, nâng cấp, chỉnh sửa sản phẩm cũ hay phát triển sản phẩm mới liên quan .net

https://docs.microsoft.com/en-us/lifecycle/products/microsoft-net-framework


.NET Framework 4.5.2, 4.6, 4.6.1 will reach End of Support on April 26, 2022
https://devblogs.microsoft.com/dotnet/net-framework-4-5-2-4-6-4-6-1-will-reach-end-of-support-on-april-26-2022/

05/04/2022

Building CI/CD pipelines with Jenkins

 Build continuous integration and continuous delivery (CI/CD) pipelines with this step-by-step Jenkins tutorial.

refer:

https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins

other docs:
Best 14 CI/CD Tools You Must Know
https://katalon.com/resources-center/blog/ci-cd-tools

CI/CD for .NET MVC Using Jenkins
https://dzone.com/articles/cicd-in-aspnet-mvc-using-jenkins

get nuget CLI restore the NuGet packages.
https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-restore

Gitlab_Jenkins integration
https://docs.gitlab.com/ee/integration/jenkins.html



30/03/2022

Unable to Create Directory wp-content/uploads. Is its Parent Directory Writable by the Server in WordPress

 Khi gặp lỗi “Unable to Create Directory wp-content/uploads. Is its Parent Directory Writable by the Server in WordPress?” thì xử lý như thế nào?

Bước 1: Lý do wordpress chưa được phân quyền ghi/tạo thư mục (Permissions, chmod)

Hãy kiểm tra xem các thư mục wp-content/uploads

(url chứa media xem đã phân quyền đúng chưa. Cần set full quyền)

Bổ sung bước (2) sau đây nếu bước (1) chưa thành công

Bước 2: Thêm 2 dòng này vào file wp-config.php

/*Thiết lập chỉ định thư mục uploads cho wordpress*/

define('UPLOADS', 'wp-content/uploads');

21/03/2022

Cài mysql 8.0 vào server AlmaLinux


 Các bước cài đặt mysql server 8.0 vào server AlmaLinux

Phiên bản hiện tại, 8.0.26

bước 1) Cập nhật server

sudo dnf update

bước 2) Kiểm tra danh sách module

sudo dnf module list mysql

bước 3) Enable module

sudo dnf module enable mysql:8.0

bước 4) Cài đặt

sudo dnf install @mysql

bước 5) enable and start

sudo systemctl enable mysqld

sudo systemctl start mysqld 

bước 6) Kiểm tra trạng thái

sudo systemctl status mysqld 

bước 7) thiết lập bảo mật

sudo mysql_secure_installation

bước 8) kết nối mysql

 sudo mysql -u root -p

bước 9) kiểm tra mysql version

mysql>  SELECT VERSION ();

===> hoàn tất

03/03/2022

Kiểm tra port sử dụng trên windows


 Các cách để mở danh sách port đang sử dụng trên windows bằng giao diện

1) Start menu → All Programs → Accessories → System Tools → Resource Monitor

2) Phím windows+r, gõ resmon.exe, enter

3) từ TaskManager → Performance tab.

Đăng ký tên miền, hosting, máy chủ, thiết kế lập trình website theo yêu cầu

 Chính thức trở thành đơn vị cung cấp dịch vụ đăng ký tên miền quốc tế, tên miền Việt Nam hosting, máy chủ, cloud hosting, cloud server, ema...