اشتراک‌ها
تاریخچه‌ی NET.

Microsoft .NET History
A timeline to highlight the evolution of the .NET world and all its related components. 

تاریخچه‌ی NET.
نظرات مطالب
روشی برای محاسبه‌ی تعداد کاربران آنلاین در ASP.NET Core
- زمانیکه از memory cache در ASP.NET Core استفاده می‌کنید، باید دقت داشت که افزودن آیتم‌ها به آن، thread-safe نیست و نیاز به یکسری ملاحظات خاص را دارد.
- می‌توان با تنظیم MemoryCacheEntryOptions و AbsoluteExpiration آن، قسمت حذف دستی آیتم‌های کش را پیاده سازی نکرد.
مطالب
آموزش زبان Rust - قسمت 9 - Memory Management در Rust از طریق Ownership
Rust، یک زبان برنامه نویسی است که به دلیل ایمنی و عملکرد مشهور است و مفهوم مالکیت را برای مدیریت مؤثر حافظه معرفی می‌کند. با رعایت مجموعه‌ای از قوانین زمان کامپایل، توسعه دهندگان Rust می‌توانند مشکلات مربوط به حافظه را کاهش داده و کد خود را بهینه کنند. این مقاله، قوانین مالکیت، مشکلاتی را که حل می‌کند و مثال‌های مختلفی را برای نشان دادن کاربرد آن، بررسی می‌کند.


قوانین مالکیت  

  • هر مقدار در Rust دارای یک متغیر مرتبط به نام مالک آن است.
  • در هر لحظه فقط یک مالک می‌تواند وجود داشته باشد.
  • وقتی مالک از scope خارج می‌شود، مقدار مرتبط حذف می‌شود.

مالکیت در Rust به جلوگیری از چندین مشکل مدیریت حافظه کمک می‌کند، از جمله:
 
  • Memory/resource leaks
  • Double free
  • Use after free

هر مقدار در Rust دارای یک متغیر مرتبط به نام مالک آن است

به مثال زیر توجه کنید:
let s1 = String::from("Rust");
در این مورد، s1 یک اشاره‌گر است که در stack قرار دارد؛ در حالیکه مقدار "Rust" در heap قرار می‌گیرد.

 طبق قوانین مالکیت:
 
  • s1 مالک داده‌های ذخیره شده‌ی در heap است.
  • هنگامیکه s1 از scope خارج شود، داده‌های آن نیز پاک می‌شوند.

تلاش برای ارجاع به s1 پس از خارج شدن آن از scope، منجر به خطا می‌شود؛ زیرا مقدار آن از heap حذف شده و دیگر وجود ندارد.


مالکیت منحصر به‌فرد (در هر لحظه فقط یک مالک می‌تواند وجود داشته باشد)  


اگر برای انتقال s1 به s2 از کد زیر استفاده کنید:
let s2 = s1;
Rust به‌طور خودکار مقدار s1 را به s2 منتقل می‌کند و اطمینان حاصل می‌کند که تنها یک مالک در یک زمان حضور دارد.


Cloning Values

اگر بخواهیم بجای جابجایی مقدار، آن را تولید/نمونه‌سازی مجدد (cloning) کنیم، می‌توانیم با فراخوانی متد ()clone این‌کار را انجام دهیم:
let s2 = s1.clone();
اکنون s2 کپی خود را از مقدار s1 دارد.


Primitive Data و Cloning

در Rust، داده‌های اولیه به‌طور کامل در stack ذخیره می‌شوند و به‌طور پیش فرض clone می‌شوند. نمونه سازی مجدد این انواع، ارزان است و تفاوتی بین clone و moving وجود ندارد.


پاس دادن Variables به Functions

ارسال یک متغیر به یک تابع، همان تأثیری را دارد که یک متغیر را به متغیر دیگری اختصاص می‌دهیم. به عنوان مثال، اگر s1 را به یک تابع ارسال کنیم، مالک جدید رشته p1 است ( p1 نام آرگومان تابع است). برای رفع هرگونه خطایی که ممکن است به این دلیل  ایجاد شود، می‌توانیم s1 را clone کرده و به تابع ارسال کنیم.
سیستم مالکیت Rust، یک راه قدرتمند را برای مدیریت حافظه‌ی در زمان کامپایل فراهم می‌کند و از مشکلات رایج مرتبط با حافظه جلوگیری می‌کند. با درک و پیروی از قوانین مالکیت، می‌توانید کد ایمن‌تر و کارآمدتری را در Rust بنویسید. 
نظرات مطالب
مراحل تنظیم Let's Encrypt در IIS

یک نکته‌ی تکمیلی

ACME V1 تا چند ماه دیگر به پایان خواهد رسید:
In June of 2020 we will stop allowing new domains to validate via ACMEv1.
در این حالت برای ارتقاء به نگارش 2 آن، تنها کافی است نگارش جدید win-acme را دریافت و اجرا کنید (که برای اجرا نیاز به نصب NET Core 3.1. را دارد). همچنین scheduled task قدیمی را هم که در سیستم برای نگارش 1 داشتید، disable کنید.
یک نمونه لاگ اجرای نگارش جدید آن به صورت زیر است:
 A simple Windows ACMEv2 client (WACS)
 Software version 2.1.3.671 (RELEASE, PLUGGABLE)
 IIS version 7.5
 Running with administrator credentials
 Scheduled task not configured yet
 Please report issues at https://github.com/PKISharp/win-acme

 N: Create new certificate (simple for IIS)
 M: Create new certificate (full options)
 L: List scheduled renewals
 R: Renew scheduled
 S: Renew specific
 A: Renew *all*
 O: More options...
 Q: Quit

 Please choose from the menu: m

 Running in mode: Interactive, Advanced

  Please specify how the list of domain names that will be included in the
  certificate should be determined. If you choose for one of the "all bindings"
  options, the list will automatically be updated for future renewals to
  reflect the bindings at that time.

 1: IIS
 2: Manual input
 3: CSR created by another program
 C: Abort

 How shall we determine the domain(s) to include in the certificate?: 1

  Please select which website(s) should be scanned for host names. You may
  input one or more site identifiers (comma separated) to filter by those
  sites, or alternatively leave the input empty to scan *all* websites.

 1: Default Web Site (2 bindings)

 Site identifier(s) or <ENTER> to choose all: 1

 1: dotnettips.info (Site 1)
 2: www.dotnettips.info (Site 1)

  You may either choose to include all listed bindings as host names in your
  certificate, or apply an additional filter. Different types of filters are
  available.

 1: Pick specific bindings from the list
 2: Pick bindings based on a search pattern
 3: Pick bindings based on a regular expression
 4: Pick *all* bindings

 How do you want to pick the bindings?: 4

 1: dotnettips.info (Site 1)
 2: www.dotnettips.info (Site 1)

  Please pick the most important host name from the list. This will be
  displayed to your users as the subject of the certificate.

 Common name: 2

 1: dotnettips.info (Site 1)
 2: www.dotnettips.info (Site 1)

 Continue with this selection? (y*/n)  - yes

 Target generated using plugin IIS: www.dotnettips.info and 1 alternatives

 Suggested friendly name '[IIS] Default Web Site, (any host)', press <ENTER> to
accept or type an alternative: <Enter>

  The ACME server will need to verify that you are the owner of the domain
  names that you are requesting the certificate for. This happens both during
  initial setup *and* for every future renewal. There are two main methods of
  doing so: answering specific http requests (http-01) or create specific dns
  records (dns-01). For wildcard domains the latter is the only option. Various
  additional plugins are available from https://github.com/PKISharp/win-acme/.

 1: [http-01] Save verification files on (network) path
 2: [http-01] Serve verification files from memory (recommended)
 3: [http-01] Upload verification files via FTP(S)
 4: [http-01] Upload verification files via SSH-FTP
 5: [http-01] Upload verification files via WebDav
 6: [dns-01] Create verification records manually (auto-renew not possible)
 7: [dns-01] Create verification records with acme-dns (https://github.com/joohoi/acme-dns)
 8: [dns-01] Create verification records with your own script
 9: [tls-alpn-01] Answer TLS verification request from win-acme
 C: Abort

 How would you like prove ownership for the domain(s) in the certificate?: 2

  After ownership of the domain(s) has been proven, we will create a
  Certificate Signing Request (CSR) to obtain the actual certificate. The CSR
  determines properties of the certificate like which (type of) key to use. If
  you are not sure what to pick here, RSA is the safe default.

 1: Elliptic Curve key
 2: RSA key

 What kind of private key should be used for the certificate?: 2

  When we have the certificate, you can store in one or more ways to make it
  accessible to your applications. The Windows Certificate Store is the default
  location for IIS (unless you are managing a cluster of them).

 1: IIS Central Certificate Store (.pfx per domain)
 2: PEM encoded files (Apache, nginx, etc.)
 3: Windows Certificate Store
 C: Abort

 How would you like to store the certificate?: 3

 1: IIS Central Certificate Store (.pfx per domain)
 2: PEM encoded files (Apache, nginx, etc.)
 3: No additional storage steps required
 C: Abort

 Would you like to store it in another way too?: 3

  With the certificate saved to the store(s) of your choice, you may choose one
  or more steps to update your applications, e.g. to configure the new
  thumbprint, or to update bindings.

 1: Create or update https bindings in IIS
 2: Create or update ftps bindings in IIS
 3: Start external script or program
 4: Do not run any (extra) installation steps

 Which installation step should run first?: 1

 Use different site for installation? (y/n*)  - no

 1: Create or update ftps bindings in IIS
 2: Start external script or program
 3: Do not run any (extra) installation steps

 Add another installation step?: 3

 Enter email(s) for notifications about problems and abuse (comma seperated): name@site.com

 Terms of service:   C:\ProgramData\win-acme\acme-v02.api.letsencrypt.org\LE-SA-v1.2-November-15-2017.pdf

 Open in default application? (y/n*)  - no

 Do you agree with the terms? (y*/n)  - yes

 Authorize identifier: dotnettips.info
 Authorizing dotnettips.info using http-01 validation (SelfHosting)
 Authorization result: valid
 Authorize identifier: www.dotnettips.info
 Authorizing www.dotnettips.info using http-01 validation (SelfHosting)
 Authorization result: valid
 Requesting certificate [IIS] Default Web Site, (any host)
 Store with CertificateStore...
 Installing certificate in the certificate store
 Adding certificate [IIS] Default Web Site, (any host) @ 2020/2/1 9:43:55 to store My
 Installing with IIS...
 Updating existing https binding www.dotnettips.info:443 (flags: 0)
 Updating existing https binding dotnettips.info:443 (flags: 0)
 Committing 2 https binding changes to IIS
 Adding Task Scheduler entry with the following settings
 - Name win-acme renew (acme-v02.api.letsencrypt.org)
 - Path C:\Programs\win-acme.v2.1.3.671.x64.pluggable
 - Command wacs.exe --renew --baseuri "https://acme-v02.api.letsencrypt.org/"
 - Start at 09:00:00
 - Time limit 02:00:00

 Do you want to specify the user the task will run as? (y/n*)  - no
بازخوردهای دوره
معرفی پروژه NotifyPropertyWeaver
من امروز با این مطلب آشنا شدم و سعی در استفاده از آن داشتم ولی  بعد از مزین کردن کلاس به خصوصیت [ImpementPropertyChanged] با خطای زیر مواجه شدم :
ImplementPropertyChangedAttribute' is obsolete: 'This configuration option has been deprecated. The use of this attribute was to add INotifyPropertyChanged to a class with its associated event definition. After that all classes that implement INotifyPropertyChanged have their properties weaved, weather they have the ImplementPropertyChangedAttribute or not.
بعد از بررسی متوجه شدم که در بروز رسانی‌های جدید این بسته نیازی به قید این خصوصیت نیست.و پیاده سازی اینترفیس InotifyPropertyChanged برای استفاده از این بسته کفایت می‌کنه
اشتراک‌ها
مایکروسافت و اپن‌سورس

Microsoft has come a long way in its effort to initially warm up to and later adopt open source software — from small skunkworks projects to full-fledged adoption and now supporting more than 10,000 engineers contributing to open source. 

مایکروسافت و اپن‌سورس
اشتراک‌ها
معماری های رایج برنامه های وب

Most traditional .NET applications are deployed as single units corresponding to an executable or a single web application running within a single IIS appdomain. This approach is the simplest deployment model and serves many internal and smaller public applications very well. However, even given this single unit of deployment, most non-trivial business applications benefit from some logical separation into several layers. 

معماری های رایج برنامه های وب
اشتراک‌ها
مبانی Redis برای توسعه دهندگان دات نت

Redis Fundamentals for .NET Developers

Redis is an open source, in-memory data store used by millions of developers as a database, cache, streaming engine, and even a message broker.
In this live sessions, Stephen Lorello, Senior Field Engineer at Redis, joins us to show the the fundamental features .NET developers show know about using Redis 

مبانی Redis برای توسعه دهندگان دات نت