وضعیت WebAssembly در 2021 و 2022
2021 was no exception and the following are some of the new areas where you’ll now find WebAssembly
-
- The Disney+ Application Development Kit is using WebAssembly: https://medium.com/disney-streaming/introducing-the-disney-application-development-kit-adk-ad85ca139073
- A simplified version of Photoshop on the web was released: https://www.theverge.com/2021/10/26/22738125/adobe-photoshop-illustrator-web-announced
- Microsoft’s Flight Simulator has a WebAssembly-based plugin system: https://docs.flightsimulator.com/html/Programming_Tools/WASM/WebAssembly.htm
طی مقاله چک لیست تولید برنامه Asp.net mvc و بررسی امنیتی ایجکس هنگام استفاده در مورد چک لیست امنیتی
سایت سرفصلهای مهم عنوان و بررسی شده است که یکی از موارد، مقاوم ساختن وب اپلیکشن در برابر حملات CSRF میباشد. اینگونه حملات بر پایه این استراتژی شکل میگیرند که با
ارسال درخواستی به نیابت از سمت سیستم/مرورگر کاربر تایید هویت شده، سایت مقصد را مجبور
به انجام عملی کند. برای مثال اگر شما در سایت a.com یک
کاربر تایید شده باشید و هم اکنون در سایت فوق نیز لاگین باشید، مهاجم با ارسال یک برنامه/صفحه یا موارد مشابه و در قالب src یک
عکس یا با ترغیب شما با کلیک بر روی یک لینک با href آلوده یا موارد
مشابه، از سمت مرورگر شما درخواستی را به سمت سایت a.com ارسال میکند .
این درخواست ممکن است شامل حذف اطلاعات، تغییر مشخصات، پرداخت هزینه یا موارد مشابه باشد. جهت مقابله با این حمله، یکی از موارد مهم، استفاده همیشگی از Html.AntiForgeryToken() در تمامی فرمهای ورود اطلاعات است. همچنین استفاده همیشگی از متد Post و بررسی تایید مبدا درخواستهای ایجکسی، بررسی http referrer ، محدود کردن طول عمر کوکی، استفاده از کپچهای قوی مانند کپچای گوگل میتواند تا حد زیادی وب اپلیکیشن را در مورد اینگونه حملات، مصون کند.
در این بین یکی از موارد دیگر، اضافه کردن AntiForgeryToken به درخواستهای ایجکسی سایت میباشد. جهت حصول این منظور، راههای مختلفی موجود است. یکی از راه حلها استفاده از یک هلپر جهت تولید توکن مورد نظر است.
ساختار
هلپر مورد نظر به شرح زیر است :
public static class AntiForgeryToken { public static MvcHtmlString AntiForgeryTokenForAjaxPost(this HtmlHelper helper) { var antiForgeryInputTag = helper.AntiForgeryToken().ToString(); // Above gets the following: <input name="__RequestVerificationToken" type="hidden" value="some value" /> var removedStart = antiForgeryInputTag.Replace(@"<input name=""__RequestVerificationToken"" type=""hidden"" value=""", ""); var tokenValue = removedStart.Replace(@""" />", ""); if (antiForgeryInputTag == removedStart || removedStart == tokenValue) throw new InvalidOperationException("Oops! The Html.AntiForgeryToken() method seems to return something I did not expect."); return new MvcHtmlString($@"{"__RequestVerificationToken"}:""{tokenValue}"""); } }
در مرحله بعد طبق الگوی زیر، درخواست ایجکسی به همراه توکن تولید شده و به کنترلر ارسال خواهد شد:
function AddToCart(pid) { $.ajax({ url: '@Url.Action("AddToBasket","Shop")', data: { 'pid': pid,@Html.AntiForgeryTokenForAjaxPost() }, type: 'post', success:function(e) { //do something } }); }
در مرحله آخر، باید کنترلر مورد نظر شامل ویژگیهای [HttpPost] [ValidateAntiForgeryToken] باشد تا صحت توکن تولیدی را بررسی کند و در صورت نامعتبر بودن، از اجرای دستورات جلوگیری گردد.
Domain Driven Design: The Good Parts
The greenfield project started out so promising. Instead of devolving into big ball of mud, the team decided to apply domain-driven design principles. Ubiquitous language, proper boundaries, encapsulation, it all made sense.
But along the way, something went completely and utterly wrong. It started with arguments on the proper way of implementing aggregates and entities. Arguments began over project and folder structure. Someone read a blog post that repositories are evil, and ORMs the devil incarnate. Another read that relational databases are last century, we need to store everything as a stream of events. Then came the actor model and frameworks that sounded like someone clearing their throat. Instead of a nice, clean architecture, the team chased the next new approach without ever actually shipping anything.
Beyond the endless technical arguments it causes, domain-driven design can actually produce great software. We have to look past the hype into the true value of DDD, what it can bring to our organizations and how it can enable us to build quality systems. With the advent of microservices, DDD is more important than ever - but only if we can get to the good parts.
5 آنتی ویروس رایگان برای ویندوز
Hackers are smart and users are not being able to cope with their pace of evolution. The result is malware outbreaks we get to know about frequently. Windows is the most widely used OS on Pcs. That makes it the most widely targeted OS too. What is an average user’s (by average I mean not too technical) defense in such case? The anti malware programs. Of course, you have to pay a decent price for your PC to be secured from latest malware derivatives, but what’s better than to get the security for no cost?
کتاب رایگان MongoDB 3 Succinctly
MongoDB is one of the biggest players in the NoSQL database market, providing high performance, high availability, and automatic scaling. It’s an open-source document database written in C++ and hosted on GitHub. Zoran Maksimovic’s MongoDB 3 Succinctly touches on the most important aspects of the MongoDB database that application developers should be aware of—from installation and the usage of the Mongo Shell, to examples of the MongoDB C# driver APIs for Microsoft .NET Framework.
Table of Contents
- MongoDB Overview
- MongoDB Installation
- The Mongo Shell
- Manipulating Documents
- Data Retrieval
- Basic MongoDB with C#
- Data Handling in C#
- Inserting Data in C#
- Find (Query) Data in C#
- Binary Data (File Handling) in C#
- Back Up and Restore
کتابخانه loadCSS
A function for loading CSS asynchronously
Why loadCSS?
Referencing CSS stylesheets with link[rel=stylesheet]
or @import
causes browsers to delay page rendering while a stylesheet loads. When loading stylesheets that are not critical to the initial rendering of a page, this blocking behavior is undesirable. The new <link rel="preload">
standard enables us to load stylesheets asynchronously, without blocking rendering, and loadCSS provides a JavaScript polyfill for that feature to allow it to work across browsers. Additionally, loadCSS offers a separate (and optional) JavaScript function for loading stylesheets dynamically.
npm install fg-loadcss --save