xhrFields:{ responseType: 'blob' }
$.ajax({
url: MY_URL_,
method: "GET",
xhrFields: {
responseType: 'blob'
},
headers: {
"Authorization": "Basic YAZRt45aWDa25wDDdFND232YFmVmb23213ffWEa5OA=="
}
}).then(response => {
console.log(response);
$('#canvas').attr('src', URL.createObjectURL(response));
}).catch(error => {
console.log(error);
})
public static IOrderedQueryable<TSource> OrderByAscOrDesc<TSource>(this IQueryable<TSource> query, string propName, bool isDesc)
{
var entityType = typeof(TSource);
var propInfo = entityType.GetProperty(propName);
if (propInfo.DeclaringType != entityType)
propInfo = propInfo.DeclaringType.GetProperty(propName);
if (propInfo == null) return (IOrderedQueryable<TSource>)query;
var arg = Expression.Parameter(entityType, "x");
var property = Expression.MakeMemberAccess(arg, propInfo);
var selector = Expression.Lambda(property, new ParameterExpression[] { arg });
var methodName = isDesc ? "OrderByDescending" : "OrderBy";
var method = typeof(Queryable).GetMethods()
.Where(x => x.Name == methodName && x.IsGenericMethodDefinition)
.Where(x => x.GetParameters().Length == 2)
.Single();
var genericMethod = method.MakeGenericMethod(entityType, propInfo.PropertyType);
return (IOrderedQueryable<TSource>)genericMethod.Invoke(genericMethod, new object[] { query, selector });
}
var dict = new Dictionary<string, ValueTuple<double, double>>();
public struct Coordinate {
public double Longitude { get; set; }
public double Latitude { get; set; }
}
public class MapPart {
public string Name { get; set; }
public ICollection<Coordinate> Coordinates { get; set; }
}
Image srcImage = pictureBox.Image;
RectangleF rectangleDest = new RectangleF(0, 0, srcImage.Width * 2, srcImage.Height * 2); // тут масштаб х2
RectangleF rectangleSource = new RectangleF(0, 0, srcImage.Width, srcImage.Height);
Bitmap destBitmap = new Bitmap(Convert.ToInt32(rectangleDest.Width), Convert.ToInt32(rectangleDest.Height));
Graphics graphics = Graphics.FromImage(destBitmap);
graphics.DrawImage(srcImage, rectangleDest, rectangleSource, GraphicsUnit.Pixel);
graphics.Save();
destBitmap.Save("resizable.png");
var mostRepeatedNumber = array.GroupBy(x => x, x => x)
.OrderByDescending(x => x.Count())
.First().Key;
array = array.Where(val => val !=mostRepeatedNumber).ToArray();