آیا کدهای شما قابل فهم نیست ؟
Using UTC in Applications
Using UTC dates for data is a pretty common and necessary practice but it definitely adds some complexity when managing dates as you always have to remember to properly adjust dates. For display purposes this is pretty straight forward, but for query operations there’s a bit of mental overhead to ensure your date math adds up properly.
No easy solutions, but I hope this post and some of the helpers make life a little easier for you – I know they do for me.
Impersonation Process
Impersonation is when an admin user is logged in with the same privileges as a user, but without knowing their password or other credentials. I’ve used this in couple applications and it was invaluable for support cases and debugging user permissions.
[Authorize(Roles = "Admin")] // <-- Make sure only admins can access this public async Task<IActionResult> ImpersonateUser(String userId) { var currentUserId = User.GetUserId(); var impersonatedUser = await _userManager.FindByIdAsync(userId); var userPrincipal = await _signInManager.CreateUserPrincipalAsync(impersonatedUser); userPrincipal.Identities.First().AddClaim(new Claim("OriginalUserId", currentUserId)); userPrincipal.Identities.First().AddClaim(new Claim("IsImpersonating", "true")); // sign out the current user await _signInManager.SignOutAsync(); await HttpContext.Authentication.SignInAsync(cookieOptions.ApplicationCookieAuthenticationScheme, userPrincipal); return RedirectToAction("Index", "Home"); }
متود IsIn
/// <summary> /// (Syntactic Sugar) Checks if the given value is among a list of values or not. /// </summary> /// <remarks> /// This method is for syntactic sugar. What it actually does is to allow developers to wrtie a code like this /// <code> /// xVariable.IsIn(MyEnum.Value1,MyEnum.Value2) /// </code> /// Instead of these codes: /// <code> /// new []{ MyEnum.Value1, MyEnum.Value2 }.Contains(xVariable); /// </code> /// Or more commonly: /// <code> /// xVariable == MyEnum.Value1 || xVariable == MyEnum.Value2 /// </code> /// </remarks> /// <typeparam name="T"></typeparam> /// <param name="source"></param> /// <param name="list"></param> /// <returns></returns> public static bool IsIn<T>(this T source, params T[] list) { Func<T, T, bool> compare = (v1, v2) => EqualityComparer<T>.Default.Equals(v1, v2); return list.Any(item => compare(item, source)); }
آیا SPA همان قسمت Front-end است؟
It is common when working on a web application, comprised of a server-side Web API, running on a framework like ASP.NET or NestJS, and a client-side Single Page Application (SPA), running on a framework like Angular, to refer to the server-side as "the back-end" and to the client-side as "the front-end". I've been a culprit of this until recently.
These are the customer-reported issues addressed in this release:
- The debugger cannot continue running the process. Operation not supported. Unknown error: 0x9233000b.
- Recent Projects and Solutions not populated once executed.
- Full build every time with 15.5.
- Wrong IntelliSense errors are still shown on VS 15.5.2 for Visual Basic projects.
- VS2017 15.5.2 Unresolved references when "Allow parallel project initialization" is enabled.
- Upgrading to 15.5.2: cannot launch nor repair VS.
- VS2017 Installation issue.
- Unable to install because of BSoD.
Intermediate & Advanced
this.setState({ name: "myname" }, () => { //callback // this function will be executed after the state change occurs console.log(this.state.name) // myname });
useEffect(() => console.log("re-render because x changed:", x), [x]); //[x] is a dependency array, useEffect will run only when x changes.
.modal.modal-wide .modal-dialog { width: 90%; } .modal-wide .modal-body { overflow-y: auto; } /* irrelevant styling */ body { text-align: center; } body p { max-width: 400px; margin: 20px auto; } #tallModal .modal-body p { margin-bottom: 900px }
// when .modal-wide opened, set content-body height based on browser // height; 200 is appx height of modal padding, modal title and button bar $(".modal-wide").on("show.bs.modal", function() { var height = $(window).height() - 200; $(this).find(".modal-body").css("max-height", height); });
+ یک مثال دیگر: ^