Questions

How are Equals and GetHashCode implemented on anonymous types?

The Help says this: > Anonymous types are class types that derive directly from object, and that cannot be cast to any type except object. The compiler provides a name for each anonymous type, al...

25 Jul at 02:11

Mocking IPrincipal in ASP.NET Core

I have an ASP.NET MVC Core application that I am writing unit tests for. One of the action methods uses User name for some functionality: ``` SettingsViewModel svm = _context.MySettings(User.Identity...

Simple example using System.Data.SQLite with Entity Framework 6

I am trying to get a simple code first example to work in a console app using SQLite and EF6, however I am running into multiple errors: I created a new console project in VS 2015. Then install EF (6....

How can I mock a method that returns a Task<IList<>>?

I am trying to unit test a method that returns a Task>: ``` void Main() { var mockRepo = new Mock<IRepository>(); mockRepo.Setup(x => x.GetAll()).Returns(new List<MyModel>() { new MyModel { N...

24 Jul at 21:2

Mock System Environment Variable In C#

I want to unit test the function which creates/Updates system environment variables. So how do i test the above functions using Nunit in C#?

24 Jul at 17:44

How get permission for camera in android.(Specifically Marshmallow)

Hey I am designing an app in android studio. In which i require permission of camera. I have included `<uses-permission android:name="android.permission.CAMERA" />` in the the AndroidManifest.xml fi...

24 Jul at 12:43

Set BindingContext to ViewModel in XAML on Xamarin.Forms

I want to develop a simple project with Xamarin.Form and MVVM. In my solution (named XamarinPOC) i have (in addition to standard Xamarin.Forms projects) one separate project for the model (XamarinPOC....

403 Access Denied on Tomcat 8 Manager App without prompting for user/password

I have set up tomcat 8 according to [this](https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04), and I have the following tomcat-users.xml file: ``` <?xml ...

24 Jul at 13:42

Entity Framework core .Include() issue

Been having a play about with ef core and been having an issue with the include statement. For this code I get 2 companies which is what i expected. ``` public IEnumerable<Company> GetAllCompanies(Hs...

26 Nov at 20:1

How to find which version of TensorFlow is installed in my system?

I need to find which version of TensorFlow I have installed. I'm using Ubuntu 16.04 Long Term Support.

docker container exits immediately even with Console.ReadLine() in a .NET Core console application

I am trying to run a .NET Core 1.0.0 console application inside a docker container. When I run `dotnet run` command from inside the Demo folder on my machine, it works fine; but when run using `docker...

Design reasons behind making ToUpper a static method on Char

In C#, we have this non-static method on the type string: ``` "abc".ToUpper() ``` but for char, we need to use a static method: ``` char.ToUpper('a') ``` When introducing c# to beginners, they a...

24 Jul at 04:46

Docker Compose keep container running

I want to start a service with docker-compose and keep the container running so I can get its IP-address via 'docker inspect'. However, the container always exits right after starting up. I tried to ...

31 Dec at 12:13

Could pandas use column as index?

I have a spreadsheet like this: ``` Locality 2005 2006 2007 2008 2009 ABBOTSFORD 427000 448000 602500 600000 638500 ABERFELDIE 534000 600000 735000 710000 775000 AIREYS INLE...

18 Jul at 06:4

Bootstrap close modal not working

I have two button here that are being used to close the modal. The first is the close icon and the other one is cancel button, both use data-dismiss to close the modal. However, both of them are not w...

Why do explicit interface calls on generics always call the base implementation?

Why do explicit C# interface calls within a generic method that has an interface type constraint always call the base implementation? For example, consider the following code: ``` public interface I...

22 Jul at 22:15

Check if a file exists in jenkins pipeline

I am trying to run a block if a directory exists in my jenkins workspace and the pipeline step in workspace doesn't seem to work correctly. I'm using Jenkins v 1.642 and Pipeline v 2.1. and trying t...

23 Dec at 00:52

Set C# console application to Unicode output

I have a C# console application, and I was trying to do some ASCII art within it. However, some of the characters I wanted to use are Unicode. So, I was searching the internet/SO and couldn't find a c...

23 May at 11:47

Bad Dapper performance for parametrized queries

I was researching porting some of our EF6 code to Dapper for better performance when I ran into a weird issue. A single row query was taking **almost 10 times** as much in Dapper than it did in EF. It...

ASP.NET Core Entity Framework Core cannot find IndexAttribute

I receive the following from Visual Studio Code on my Mac, both in IDE and console window after executing "dotnet run": > The type or namespace name 'IndexAttribute' could not be found I have a class ...

Can ServiceStack parse similar routes?

I've got the following routes that i want defined in my app: ``` /s/customers/1234/summary ``` and ``` /s/locations/5767/summary ``` now normally i would define my route like so: ``` Add<Custom...

22 Jul at 15:58

ASP.NET Core 404 Error on IIS 10

I have a problem with ASP.NET Core web application running on IIS 10. I am developing a Single Page Application with AngularJS. The index.html loads perfectly but the backend requests are failing wit...

WPF ListBox vs ComboBox

I'm working on an application with C# and WPF, in which I need to bind to a dictionary and display key-value pairs. How are ListBoxes different from ComboBoxes, and what are some possible advantages/d...

23 May at 12:33

Namespaces for .NET JWT token validation: System vs. Microsoft

I am trying to use JWT to authenticate a Node application to an ASP.NET Web API. In ASP.NET, I am using .NET 4.5.1 and nuget package `System.IdentityModel.Tokens.Jwt` 5.0.0 What I don't understand i...

11 Aug at 21:49

Linux Command History with date and time

I wants to check on my linux system when which command was fired - at which date and time. I fired commands like this: ``` history 50 ``` It shows me the last 50 commands history, but not with dat...

22 Jul at 13:7