Questions

Is there a XAML equivalent to nameof?

I'm working with DevExpress's WPF tree list view and I came across what I think is a more general problem relating to renaming properties on the objects used as an item source. In the tree list view o...

18 Aug at 14:59

Convert Microsoft.AspNetCore.Http.HttpRequest to HttpRequestMessage

I need to convert from an AspNetCore context to an to pass to an HttpClient. Is there a simple way of achieve this? Or any hint to implement this would be very helpful. I want to convert the reque...

21 Aug at 14:14

How to insert a record into a table with a foreign key using Entity Framework in ASP.NET MVC

I'm new to Entity Framework code-first. This is my learning in ASP.NET MVC, using code-first for database creation. I have two classes: ``` public class Student { public int StudentId { get; set...

how to change jest mock function return value in each test?

I have a mock module like this in my component test file ``` jest.mock('../../../magic/index', () => ({ navigationEnabled: () => true, guidanceEnabled: () => true })); ``` these functions...

18 Aug at 14:51

Use custom validation responses with fluent validation

Hello I am trying to get custom validation response for my webApi using .NET Core. Here I want to have response model like ``` [{ ErrorCode: ErrorField: ErrorMsg: }] ``` I have a validator ...

Create instance using ctor injection and ServiceProvider

I know there is `IServiceCollection` interface where I can register my services and `IServiceProvider` which can instantiate the services. How do I instantiate a class, based on specified Type, which...

How to use MemoryCache in C# Core Console app?

I would like to use the Microsoft.Extensions.Caching.Memory.MemoryCache in a .NET Core 2.0 console app (Actually, in a library that is either used in a console or in a asp.net app) I've created a tes...

18 Aug at 08:22

Argument order for '==' with Nullable<T>

The following two `C#` functions differ only in swapping the left/right order of arguments to the operator, `==`. (The type of `IsInitialized` is `bool`). Using and . ``` static void A(ISupportIniti...

Pandas how to use pd.cut()

Here is the snippet: ``` test = pd.DataFrame({'days': [0,31,45]}) test['range'] = pd.cut(test.days, [0,30,60]) ``` Output: ``` days range 0 0 NaN 1 31 (30, 60] 2 45 (30, 6...

18 Aug at 07:54

Getting IConfiguration from ServiceCollection

I´m writing my own extension method for `ServiceCollection` to registered the types of my module and I need to access the `IConfiguration` instance from the collection to register my Options. ``` ...

How to downgrade tensorflow, multiple versions possible?

I have tensorflow 1.2.1 installed, and I need to downgrade it to version 1.1 to run a specific tutorial. What is the safe way to do it? I am using windows 10, python 3.5. Tensorflow was installed with...

18 Aug at 06:35

Disable Property of Azure Functions not working in Visual Studio 2017

I have Azure function with timer trigger. ``` public static void Run([TimerTrigger("0 */15 * * * *"), Disable("True")]TimerInfo myTimer, TraceWriter log) ``` Here the `Disable("true")` is not worki...

Http Request in TypeScript

I was trying to convert the following snippet in nodejs to typescript: [How do I make Http Request in Nodejs](https://docs.nodejitsu.com/articles/HTTP/clients/how-to-create-a-HTTP-request/) Here is m...

18 Aug at 04:15

Flutter: Trying to bottom-center an item in a Column, but it keeps left-aligning

I'm trying to bottom-center a widget at the bottom of a Column, but it keeps aligning to the left. ``` return new Column( new Stack( new Positioned( bottom: 0.0, new Center( ...

How do I stretch an image to fit the whole background (100% height x 100% width) in Flutter?

I have an image that doesn't match the aspect ratio of my device's screen. I want to stretch the image so that it fully fills the screen, and I don't want to crop any part of the image. CSS has the c...

23 Jul at 15:48

Detecting .net core 2.0

In a dotnet core 2.0 console application, the output of: ``` Console.WriteLine("Hello World from "+ System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription); ``` Is a rather unexpect...

17 Aug at 21:20

How to have the semicolon character in a password for a SQL connection string?

My connection string: ``` con = new SqlConnection("Server=localhost;Database=mainDB;User Id=sqluser;Password=Y;9r.5JQ6cwy@)V_"); ``` That semicolon in the password causes an exception. How do I wri...

17 Aug at 18:5

Could not load type 'Microsoft.Build.Framework.SdkReference' on project open in VS 2017 U1 (15.3)

After doing an (apparently successful) upgrade from VS 2017 15.1 to 15.3, I can no longer load any C# project (can't open existing, can't create new). All fail with this error: > Could not load type '...

5 May at 15:51

How do I customize Visual Studio's private field generation shortcut for constructors?

VS 2017 (and maybe olders versions) gives me this handy little constructor shortcut to generate a `private readonly` field and assign it. Screenshot: [](https://i.stack.imgur.com/L3Ec9.png) This en...

17 Aug at 13:36

Local user account store for Web API in ASP.NET Core 2.0

I'm using ASP.Net Core 2.0, I want to build a Web API project with Individual User Accounts Authorization type, but the only option is `Connect to an existing user store in the cloud`. [](https://i.st...

The current .NET SDK does not support targeting .NET Standard 2.0 error in Visual Studio 2017 update 15.3

I want to create a class library project with Target Framework .NET Standard 2.0. I've updated my `Visual Studio 2017` to Version `15.3` and also in Visual Studio installer checked `.NET Framework 4...

How to download a file in ASP.NET Core?

In MVC, we have used the following code to download a file. In ASP.NET core, how to achieve this? ``` HttpResponse response = HttpContext.Current.Response; System.Net.WebClient ne...

25 May at 21:46

.net core why can i get the IFormCollection by key the alone

lets say i have an ``` <form method="post" action"/user/create"> <input type="text" name="FirstName" placeholder="FirstName" /> <button type="submit">Submit</button> </form> ``` I want to a...

17 Aug at 03:2

Flutter BoxDecoration’s background color overrides the Container's background color, why?

I have a Flutter Container widget and I defined a color for it (pink), but for some reason, the color in BoxDecoration overrides it (green). Why? ``` new Container( color: Colors.pink, decoration...

What is a "span" and when should I use one?

Recently I've gotten suggestions to use `span<T>`'s in my code, or have seen some answers here on the site which use `span`'s - supposedly some kind of container. But - I can't find anything like that...