مقایسۀ NoSQL و SQL
کتابخانه tap
Tap
is a Javascript library for easy unified handling of user interactions such as mouse, touch and pointer events.
- No need to detect what kind of events are supported,
Tap
handles this for you - Small distribution size of 1Kb
- Use fastest event types supported (majority of browsers has ~300ms delay between touch/pointer events and click). Every millisecond does really matter!
.NET Core 3.1 is a long-term supported (LTS) release (supported for at least 3 years). We recommend that you move any .NET Core 3.0 applications and environments to .NET Core 3.1 now. It’ll be an easy upgrade in most cases.
ویژگیهای جدید NET Core 3.0.
- اضافه کردن اسمبلیها به صورت دستی به پروژه و تنظیم Build Action آنها به Embedded Resource
- تنظیم فایل csproj پروژه برای Embed کردن خودکار رفرنسهای پروژه در زمان Build
روش اول
روش دوم
<Target Name="EmbedReferencedAssemblies" AfterTargets="ResolveAssemblyReferences"> <ItemGroup> <AssembliesToEmbed Include="@(ReferenceCopyLocalPaths)" /> <EmbeddedResource Include="@(AssembliesToEmbed)" Condition="'%(AssembliesToEmbed.Extension)' == '.dll'"> <LogicalName>%(AssembliesToEmbed.DestinationSubDirectory)%(AssembliesToEmbed.Filename)%(AssembliesToEmbed.Extension)</LogicalName> </EmbeddedResource> </ItemGroup> <Message Importance="high" Text="Embedding: @(AssembliesToEmbed->'%(DestinationSubDirectory)%(Filename)%(Extension)', ', ')" /> </Target> <Target Name="DeleteAllReferenceCopyLocalPaths" AfterTargets="Build"> <Delete Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" /> </Target>
همانطور که در تصویر بالا نیز مشاهده میکنید، اسمبلیهای ارجاعی برنامه TestApp به صورت Resource به آن اضافه شدهاند.
نحوه بارگذاری اسمبلیهای Embed شده
در پروژههای WPF، در OnStartup event کلاس App و در پروژههای WinForm در متد Main کلاس Program، قطعه کد زیر را وارد میکنیم:
private void App_OnStartup( object sender, StartupEventArgs e ) { AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly; var assembly = Assembly.GetExecutingAssembly(); foreach (var name in assembly.GetManifestResourceNames()) { if ( name.ToLower() .EndsWith( ".resources" ) || !name.ToLower() .EndsWith( ".dll" ) ) continue; EmbeddedAssembly.Load( name, name ); } } static Assembly OnResolveAssembly( object sender, ResolveEventArgs args ) { var fields = args.Name.Split( ',' ); var name = fields[0]; var culture = fields[2]; if ( name.EndsWith( ".resources" ) && !culture.EndsWith( "neutral" ) ) return null; return EmbeddedAssembly.Get( args.Name ); }
با استفاده از رویداد AssemblyResolve می توان اسمبلی Embed شده را در زمانیکه نیاز به آن است، بارگذاری کرد. کد مربوط به کلاس EmbeddedAssembly نیز به این صورت میباشد:
using System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Security.Cryptography; public static class EmbeddedAssembly { static Dictionary< string, Assembly > _dic; public static void Load( string embeddedResource, string fileName ) { if ( _dic == null ) _dic = new Dictionary< string, Assembly >(); byte[] ba; Assembly asm; var curAsm = Assembly.GetExecutingAssembly(); using ( var stm = curAsm.GetManifestResourceStream( embeddedResource ) ) { if ( stm == null ) return; ba = new byte[(int)stm.Length]; stm.Read( ba, 0, (int)stm.Length ); try { asm = Assembly.Load( ba ); _dic.Add( asm.GetName().Name, asm ); return; } catch { } } bool fileOk; string tempFile; using ( var sha1 = new SHA1CryptoServiceProvider() ) { var fileHash = BitConverter.ToString( sha1.ComputeHash( ba ) ) .Replace( "-", string.Empty ); tempFile = Path.GetTempPath() + fileName; if ( File.Exists( tempFile ) ) { var bb = File.ReadAllBytes( tempFile ); var fileHash2 = BitConverter.ToString( sha1.ComputeHash( bb ) ) .Replace( "-", string.Empty ); fileOk = fileHash == fileHash2; } else { fileOk = false; } } if ( !fileOk ) { File.WriteAllBytes( tempFile, ba ); } asm = Assembly.LoadFile( tempFile ); _dic.Add( asm.GetName().Name, asm ); } public static Assembly Get( string assemblyFullName ) { if ( _dic == null || _dic.Count == 0 ) return null; var name = new AssemblyName( assemblyFullName ).Name; return _dic.ContainsKey( name ) ? _dic[name] : null; } }
با استفاده از متد Load کلاس بالا، کل اسمبلیهایی که بارگذاری شدهاند در یک دیکشنری استاتیک نگهداری میشوند. ابتدا اسمبلیها را با استفاده از []byte بارگذاری میکنیم و در صورتیکه بارگذاری اسمبلی با خطایی مواجه شود، بارگذاری را با استفاده از فایل temp انجام میدهیم (که معمولا برای فایلهای unmanaged این مورد اتفاق میافتد).
با استفاده از متد Get که در زمان نیاز به یک اسمبلی توسط AssemblyResolve فراخوانی میشود، اسمبلی مربوطه از دیکشنری پیدا شده و برگشت داده میشود.
نکته ها
- در صورتیکه بخواهید فایلی را از Embed کردن خودکار (روش دوم) استثناء کنید، باید از Condition استفاده کنید:
<Target Name="EmbedReferencedAssemblies" AfterTargets="ResolveAssemblyReferences"> <ItemGroup> <AssembliesToEmbed Include="@(ReferenceCopyLocalPaths)" /> <EmbeddedResource Include="@(AssembliesToEmbed)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(AssembliesToEmbed.Filename)', '^((?!Microsoft).)*$')) And '%(AssembliesToEmbed.Extension)' == '.dll'"> <LogicalName>%(AssembliesToEmbed.DestinationSubDirectory)%(AssembliesToEmbed.Filename)%(AssembliesToEmbed.Extension)</LogicalName> </EmbeddedResource> </ItemGroup> <Message Importance="high" Text="Embedding: @(AssembliesToEmbed->'%(DestinationSubDirectory)%(Filename)%(Extension)', ', ')" /> </Target> <Target Name="DeleteAllReferenceCopyLocalPaths" AfterTargets="Build"> <Delete Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(Filename)', '^((?!Microsoft).)*$')) Or '%(Extension)' == '.xml'" /> </Target>
- در صورتیکه بعد از اجرای برنامه و یا اجرای به صورت دیباگ با خطای Stackoverflow مواجه شدید که به خاطر ارجاعات زیاد Resourceهای برنامه پیش میآید، کد زیر را به فایل AssemblyInfo، در پوشه Properties اضافه کنید:
[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)]
- در صورتیکه پروژه شما از نوع Office Add-Ins باشد، باید در کد مربوط به AssemblyResolve را در فایل ThisAddIn.Designer.cs (در صورت عدم تغییر نام) به متد Initialize اضافه کنید و دستور بارگذاری را در متد ThisAddIn_Startup اضافه کنید. نکته خیلی مهم: در فایل csproj حتما در قسمت Condition باید اسمبلیهایی را که با نام Microsoft شروع میشوند، از Embed شدن استثناء کنید و در قسمت DeleteAllReferenceCopyLocalPaths مقدار "AfterTargets="VisualStudioForApplicationsBuild را قرار دهید (تا امکان Build پروژه برای شما باشد) و همچنین پسوند vsto را نیز نباید حذف کنید.
Security Advisory Notices
CVE-2019-1077 Visual Studio Extension Auto Update Vulnerability
An elevation of privilege vulnerability exists when the Visual Studio Extension auto-update process improperly performs certain file operations. An attacker who successfully exploited this vulnerability could delete files in arbitrary locations. To exploit this vulnerability, an attacker would require unprivileged access to a vulnerable system. The security update addresses the vulnerability by securing locations the Visual Studio Extension auto-update performs file operations in.
CVE-2019-1075 ASP.NET Core Spoofing Vulnerability
A spoofing vulnerability exists in ASP.NET Core that could lead to an open redirect. An attacker who successfully exploited the vulnerability could redirect a targeted user to a malicious website. To exploit the vulnerability, an attacker could send a link that has a specially crafted URL and convince the user to click the link.
The security update addresses the vulnerability by correcting how ASP.NET Core parses URLs. Details can be found in the .NET Core release notes.
CVE-2019-1113 WorkflowDesigner XOML deserialization allows code execution
A XOML file referencing certain types could cause random code to be executed when the XOML file is opened in Visual Studio. There is now a restriction on what types are allowed to be used in XOML files. If a XOML file containing one of the newly unauthorized types is opened, a message is displayed explaining that the type is unauthorized.
For further information, please refer to https://support.microsoft.com/en-us/help/4512190/remote-code-execution-vulnerability-if-types-are-specified-in-xoml.
کتاب Visual Studio 2015 Succinctly
In Visual Studio 2015 Succinctly, author Alessandro Del Sole explains how to take advantage of the highly anticipated features in Microsoft Visual Studio 2015. Topics include sharing code between different types of projects, new options for debugging and diagnostics, and improving productivity with other services in the Visual Studio ecosystem, such as NuGet and Azure.