مقدمه ای کاربردی بر Machine Learning
شروع کار با Web Assembly
معرفی Roslyn Tools
NetVips is a wrapper for the libvips image processing library. It's a bit like Magick.NET, but typically 8x faster. It's API-stable, supports around 300 image-processing operations, and a good range of image formats is supported.
NuGet package: https://www.nuget.org/packages/NetVips
There's a benchmark here: https://github.com/kleisauke/net-vips/tree/master/tests/NetVips.Benchmarks
Formatted docs, including a tutorial and full API: https://kleisauke.github.io/net-vips/
Blog post: https://jcupitt.github.io/libvips/2018/04/10/libvips-for-dot-net.html
استفاده از Async و Await در برنامههای دسکتاپ
تهیه مقدمات بحث
ابتدا یک برنامهی WPF جدید را آغاز کنید. سپس کدهای MainWindow.xaml آنرا به نحو ذیل تغییر دهید.
<Window x:Class="Async10.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <DockPanel> <DockPanel Dock="Top"> <Button Name="BtnGo" Content="Go" Click="BtnGo_OnClick" /> <ProgressBar Name="ProgressBar" IsIndeterminate="True" Visibility="Collapsed"/> </DockPanel> <TextBox Name="Results"/> </DockPanel> </Window>
در این مثال از کلاس جدید HttpClient نیز استفاده خواهیم کرد. برای استفاده از آن نیاز است ارجاعی را به اسمبلی استاندارد System.Net.Http.dll نیز به پروژه اضافه کنید.
روش اول
در ادامه کدهای فایل MainWindow.xaml.cs را به نحو ذیل تغییر داده و سپس برنامه را اجرا کنید.
using System.Net.Http; using System.Windows; namespace Async10 { public partial class MainWindow { public MainWindow() { InitializeComponent(); } private void BtnGo_OnClick(object sender, RoutedEventArgs e) { BtnGo.IsEnabled = false; ProgressBar.Visibility = Visibility.Visible; var url = "https://www.dntips.ir"; var client = new HttpClient(); // make sure you have an assembly reference to System.Net.Http.dll client.DefaultRequestHeaders.UserAgent.ParseAdd("Test Async"); var task = client.GetStringAsync(url); task.ContinueWith(t => { Results.Text = t.Result; BtnGo.IsEnabled = true; ProgressBar.Visibility = Visibility.Collapsed; }); } } }
اگر پروژه را اجرا کنید، برنامه با استثنای زیر متوقف میشود:
The calling thread cannot access this object because a different thread owns it.
الف) با استفاده از SynchronizationContext.Current و متد Post آن
var context = SynchronizationContext.Current; task.ContinueWith(t => context.Post(state => { Results.Text = t.Result; BtnGo.IsEnabled = true; ProgressBar.Visibility = Visibility.Collapsed; }, null));
ب) با استفاده از امکانات TaskScheduler
var taskScheduler = TaskScheduler.FromCurrentSynchronizationContext(); task.ContinueWith(t => { Results.Text = t.Result; BtnGo.IsEnabled = true; ProgressBar.Visibility = Visibility.Collapsed; }, taskScheduler);
برای مثال اگر در برنامههای وب یک Task جدید را اجرا کنید شاید اینطور به نظر برسد که به HttpContext دسترسی ندارید. این نقیصه را میتوان توسط کار با SynchronizationContext جاری برطرف کرد.
در مثال فوق، چون taskScheduler پیش از فراخوانی متد ContinueWith ایجاد شدهاست، به ترد UI اشاره میکند. در این حالت برای نمایش اطلاعات در همان ترد اصلی برنامه کافی است این taskScheduler را به عنوان پارامتر متد ContinueWith معرفی کنیم.
روش دوم
در دات نت 4.5 میتوان روال رخدادگردان تعریف شده را به صورت async نیز معرفی کرد (یعنی مجاز هستیم امضای متد پیش فرض تولید شده را تغییر دهیم):
private async void BtnGo_OnClick(object sender, RoutedEventArgs e)
private async void BtnGo_OnClick(object sender, RoutedEventArgs e) { BtnGo.IsEnabled = false; ProgressBar.Visibility = Visibility.Visible; var url = "https://www.dntips.ir"; var client = new HttpClient(); // make sure you have an assembly reference to System.Net.Http.dll client.DefaultRequestHeaders.UserAgent.ParseAdd("Test Async"); Results.Text = await client.GetStringAsync(url); BtnGo.IsEnabled = true; ProgressBar.Visibility = Visibility.Collapsed; }
We are proud to present the first beta release of Kendo UI for Angular 2. It’s been designed specifically for Angular 2. Written in Typescript, built as native Query-free components and distributed as NPM packages, Kendo UI for Angular 2 makes integrating UI components into ng2 a piece of cake for developers. In this beta release, you’ll find the business application essential building blocks — form elements, grid and data visualization components.
:When to use Async/Await
- Linux support for tier-1, mission-critical workloads – SQL Server 2017 support for Linux includes the same high availability solutions on Linux as Windows Server, including Always On availability groups integrated with Linux native clustering solutions like Pacemaker.
- Graph data processing in SQL Server – With the graph data features available in SQL Server 2017and Azure SQL Database, customers can create nodes and edges, and discover complex and many-to-many relationships.
- Adaptive query processing – Adaptive query processing is a family of features in SQL Server 2017 that automatically keeps database queries running as efficiently as possible without requiring additional tuning from database administrators. In addition to the capability to adjust batch mode memory grants, the feature set includes batch mode adaptive joins and interleaved execution capabilities.
- Python integration for advanced analytics – Microsoft Machine Learning Services now brings you the ability to run in-database analytics using Python or R in a parallelized and scalable way. The ability to run advanced analytics in your operational store without ETL means faster time to insights for customers while easy deployment and rich extensibility make it fast to get up and running on the right model.