نظرات مطالب
فعال سازی قسمت ارسال فایل و تصویر ویرایشگر آنلاین RedActor در ASP.NET MVC
آقای نصیری من برای ذخیره یه متن با redactor به مشکل خوردم. Error ای به صورت زیر میدهد: 
System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (Body="<p>aaaaaaa...").  
اشتراک‌ها
انتشار Visual Studio 2022 version 17.6 Preview 1

GitHub Issues

The GitHub Issues integration allows you to search and reference your issues from the commit message box in VS, in response to this suggestion ticket. You can reference an issue or a pull request by typing # or clicking on the # button in the lower right side of the commit message text box. If you weren't already authenticated to access related issues, you will now be prompted to sign in to take advantage of this feature.

Line Unstaging

To continue improving our line-staging (aka interactive staging) feature, we've added unstage. You can now use the tool tip option to unstage changes, line by line, as requested here Unstage individual lines and hunks in a file - 4 votes

Arm64

We continue to build native support for Arm64 on Windows 11 for the most popular developer scenarios. We now support the .NET Multi-platform App UI (MAUI) workload on Arm64 Visual Studio.

C++

  • Available as a preview feature, you can now view Unreal Engine logs without leaving VS. To see the logs from the Unreal Engine Editor, click View > Other Windows > UE Log. To filter your logs, click on the "Categories" or "Verbosity" dropdowns. Since this is an experimental feature, feedback is greatly appreciated.
  • You can now import STM32CubeIDE projects for embedded development within Visual Studio with File > Open > Import STM32CubeIDE project. This generates a CMake project with device flashing and debugging settings for STLink. You must have the STM32CubeIDE installed with the board support package for your device. More details available here.
  • You can use the new CMake Debugger to debug your CMake scripts at build time. You can set breakpoints based on filenames, line numbers, and when CMake errors are triggered. Additionally, you can view call stacks of filenames and watch defined variables. Currently, this only works with bundled CMake, and projects targeting WSL or remote machines are not supported yet. We are actively working to add more support to the CMake debugger, and feedback is greatly appreciated. 
انتشار Visual Studio 2022 version 17.6 Preview 1
مطالب دوره‌ها
الگوی Matching
الگوی Matching در واقع همون switch در اکثر زبان‌ها نظیر #C یا ++C است با این تفاوت که بسیار انعطاف پذیرتر و قدرتمندتر است. در برنامه نویسی تابع گرا، هدف اصلی از ایجاد توابع دریافت ورودی و اعمال برخی عملیات مورد نظر بر روی مقادیر با استفاده از تعریف حالات مختلف برای انتخاب عملیات است. الگوی Matching این امکان رو به ما می‌ده که با استفاده از حالات مختلف یک عملیات انتخاب شود و با توجه به ورودی یک سری دستورات رو اجرا کنه. ساختار کلی تعریف آن به شکل زیر است:
match expr with
| pat1 -> result1
| pat2 -> result2
| pat3 when expr2 -> result3
| _ -> defaultResult
راحت‌ترین روش استفاده از الگوی Matching هنگام کار با مقادیر است. اولین مثال رو هم در فصل قبل در بخش توابع بازگشتی با هم دیدیم.
let booleanToString x =
match x with false -> "False" 
| _ -> "True"
در تابع بالا ورودی ما اگر false باشد "False" و اگر true باشد "True" برگشت داده می‌شود. _ در مثال بالا دقیقا همون default در switch سایر زبان هاست.
let stringToBoolean x =
match x with
| "True" | "true" -> true
| "False" | "false" -> false
| _ -> failwith "unexpected input"
در این مثال (دقیقا بر عکس مثال بالا ) ابتدا یک string دریافت  می‌شود اگر برابر "True" یا "true" بود مقدار true برگشت داده میشود و اگر برابر "False" یا "false" بود مقدار false برگشت داده می‌شود در غیر این صورت یک FailureException  پرتاب می‌شود. خروجی مثال بالا در حالات مختلف به شکل زیر است:
printfn "(booleanToString true) = %s"
(booleanToString true)
printfn "(booleanToString false) = %s"
(booleanToString false)
printfn "(stringToBoolean \"True\") = %b"
(stringToBoolean "True")
printfn "(stringToBoolean \"false\") = %b"
(stringToBoolean "false")
printfn "(stringToBoolean \"Hello\") = %b"
(stringToBoolean "Hello")
خروجی :
(booleanToString true) = True
(booleanToString false) = False
(stringToBoolean "True") = true
(stringToBoolean "false") = false
Microsoft.FSharp.Core.FailureException: unexpected input
at FSI_0005.stringToBoolean(String x)
at <StartupCode$FSI_0005>.$FSI_0005.main@()
هم چنین علاوه بر اینکه امکان استفاده از چند شناسه در این الگو وجود دارد، امکان استفاده از And , Or نیز در این الگو میسر است.
let myOr b1 b2 =
match b1, b2 with
| true, _ -> true  //b1 true , b2 true or false
| _, true -> true // b1 true or false , b2 true
| _ -> false
printfn "(myOr true false) = %b" (myOr true false) printfn "(myOr false false) = %b" (myOr false false)
خروجی برای کد‌های بالا به صورت زیر است:
(myOr true false) = true
(myOr false false) = false
استفاده از عبارت و شروط در الگوی Matching 
در الگوی Matching اگر در بررسی ورودی الگو با یک مقدار نیاز شما را برطرف نمی‌کند استفاده از فیلتر‌ها و شروط مختلف هم مجاز است. برای مثال
let sign = function
    | 0 -> 0
    | x when x < 0 -> -1
    | x when x > 0 -> 1
مثال بالا برای تعیین علامت هر عدد ورودی به کار می‌رود. -1 برای عدد منفی و 1 برای عدد مثبت و 0 برای عدد 0.

عبارت if … then … else
استفاده از if در #F کاملا مشابه به استفاده از if در #C است و نیاز به توضیح ندارد. تنها تفاوت در else if است که در #F به صورت elif نوشته می‌شود.
ساختار کلی
if expr then
    expr
elif expr then
    expr
elif expr then
    expr
...
else
    expr
 برای مثال الگوی Matching پایین رو به صورت if خواهیم نوشت.
let result =
match System.DateTime.Now.Second % 2 = 0 with
| true -> "heads"
| false -> "tails"
#با استفاده از if
let result =
if System.DateTime.Now.Second % 2 = 0 then
box "heads"
else
box false
printfn "%A" result
در پایان یک مثال مشترک رو به وسیله دستور swith case در #C و الگوی matching در #F پیاده سازی می‌کنیم.


اشتراک‌ها
بهترین فریم ورک جاوا اسکریپتی برای یادگیری در سال 2021

Based on the above observations, we can conclude that React will be the best framework to learn in 2021, followed by Vue. But there is a high chance of Angular defending second place since it has been there for a longer period of time than Vue, and surely 2021 is not the end of that. So if you are an Angular developer, I suggest you learn React in the upcoming days.

بهترین فریم ورک جاوا اسکریپتی برای یادگیری در سال 2021
نظرات مطالب
EF Code First #7
- علت به Optional و Required بودن روابط بر می‌گردد. حالت Required یعنی فرزند، بدون والد نمی‌تواند وجود داشته باشد؛ برعکس حالت optional. بنابراین فقط در حالت Required حذف فرزندان در صورت حذف والد صورت خواهد گرفت.
- جزئیات بیشتر از زبان طراحان EF:
Deleting orphans with Entity Framework 
+ طراحی پیش فرض است؛ مطابق مستندات MSDN:
If a foreign key on the dependent entity is nullable, Code First does not set cascade delete on the relationship, 
and when the principal is deleted the foreign key will be set to null.
اشتراک‌ها
کتابخانه ngx-page-scroll

Animated scrolling functionality for angular written in pure typescript with no additional dependencies  Demo

  • easy-to-use directive: scroll to an element referenced in the href-attribute (href="#mytarget) just by adding pageScrolldirective
  • service usage: trigger scroll animations from your component or when server responds
  • customizable: adjust duration, offset or whether scrolling stops if the user interrupts (read more)
  • use custom easing functions to calculate the scroll position over time
  • works across routes (scrolls to target element as soon as the routing has finished) and in both directions (horizontal/vertical) 
npm install ngx-page-scroll  
کتابخانه ngx-page-scroll
اشتراک‌ها
Redis 6.0.0 GA منتشر شد

The next major release of the popular data structure server is here. Redis is at the heart of so many data systems nowadays that any major release is big news but 6.0 packs in a lot of new bits and pieces that make it more robust and capable of modern workloads, including:
- Access Control Lists (ACL) for limiting what certain clients can do.
- Diskless replication on replicas.
- Threaded I/O (but Redis itself remains primarily single threaded).
- SSL/TLS support.
- A new client-server protocol, RESP3.
 

Redis 6.0.0 GA منتشر شد
نظرات مطالب
ASP.NET MVC #18
ممنون، تا اینجاش رو مشکلی ندارم و به این صورت که گفتید پیاده سازی کردم :
[HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult LogOn(User user, string returnUrl)
        {
            if (this.ModelState.IsValid)
            {
                if (_userService.IsValid(user))
                {
                    int userID = _userService.GetUser(u => u.Username == user.Username && u.Password == user.Password).Id;
                    FormsAuthentication.SetAuthCookie(userID.ToString(CultureInfo.InvariantCulture), user.RememberMe);
                    if (shouldRedirect(returnUrl))
                    {
                        return Redirect(returnUrl);
                    }
                    FormsAuthentication.RedirectFromLoginPage(userID.ToString(CultureInfo.InvariantCulture), user.RememberMe);
                }
            }
            this.ModelState.AddModelError("", "The user name or password provided is incorrect.");
            ViewBag.Error = "Login faild! Make sure you have entered the right user name and password!";
            return View(user);
        }
در این صورت Id هم صفر نیست و مقدار به درستی داخل کوکی ذخیره می‌شود، مشکل اصلی من این اجرای چند گانه است یعنی موقعی که کنترلری را با ویژگی Authorize و تعیین Role و یا User مزین می‌کنم میدهد خطای Attempted to perform an unauthorized operation را میدهد.
نظرات مطالب
آموزش Prism #1
با سلام و تشکر از مطلب مفیدتون 
همانطور که می‌دانید مدل‌های مختلف توسعه MVVM برای مقاصد مختلف بهتر است و به طور کلی نمی‌توان گفت که کدام بهتر است لطفا در ادامه مطلب این فریم ورک را با MVVM Light هم مقایسه بفرمائید تا موارد استفاده هر کدام بهتر مشخص شود