Questions

How to execute a Bash command only if a Docker container with a given name does not exist?

On a Jenkins machine I would like to create a docker container with a specified name only if it does not already exist (in a shell script). I thought I might run the command to create the container re...

28 Oct at 18:7

How to search for text in all files in a directory?

Is there a way to search for text in all files in a directory using VS Code? I.e., if I type `find this` in my search, it will search through all the files in the current directory and return the file...

10 Mar at 20:44

How to detect when an @Input() value changes in Angular?

I have a parent component (), a child component () and an ApiService. I have most of this working fine i.e. each component can access the json api and get its relevant data via observables. Currentl...

In ServiceStack, how do I broadcast messages from the Server?

Is there a simple tutorial showing how to use Server Events with ServiceStack? Specifically, I'm looking for a way to have a server generate messages to be broadcast to all clients. I've been readin...

25 Jul at 14:56

How to get HttpContext.Current in ASP.NET Core?

We are currently rewriting/converting our ASP.NET WebForms application using ASP.NET Core. Trying to avoid re-engineering as much as possible. There is a section where we use `HttpContext` in a class...

15 Jun at 04:0

How to determine if .NET Core is installed

I know that for older versions of .NET, you can determine if a given version is installed by following ``` https://support.microsoft.com/en-us/kb/318785 ``` Is there an official method of determin...

31 Jan at 13:24

tap detection on a gameobject in unity

i'm currently making a soccer game. In this mini-game, when the player touch the ball, it adds force, and the goal is to make the higher score. So i wrote: ``` void Update() { if(Input.touchCou...

25 Jul at 11:11

Change drive in git bash for windows

I was trying to navigate to my drive location `E:/Study/Codes` in `git bash` in windows. In command prompt in order to change drive I use `E:` It returns an error in `git bash`. > bash: E:: command ...

5 May at 03:1

Maximum http request size for asp web.api with json

I have web api project. I need to post there json data with file as encoded base64 string (up to 200 mb). If i send data up to about 10 mb, then next method normally get properly filled model Import...

25 Jul at 09:12

Force IEnumerable<T> to evaluate without calling .ToArray() or .ToList()

If I query EF using something like this... ``` IEnumerable<FooBar> fooBars = db.FooBars.Where(o => o.SomeValue == something); ``` IIRC, This creates a lazy-evaluated, iterable state machine in the ...

Getting inappropriate output with left join

I am trying to get list of variants and for each of this variants get all `subvariants list` irrespective of where subvariants fall for particular `Test say 100`.This is sample data: ``` Id Test...

1 Aug at 18:57

How to get current available GPUs in tensorflow?

I have a plan to use distributed TensorFlow, and I saw TensorFlow can use GPUs for training and testing. In a cluster environment, each machine could have 0 or 1 or more GPUs, and I want to run my Ten...

26 Jul at 02:37

Node.js heap out of memory

Today I ran my script for filesystem indexing to refresh RAID files index and after 4h it crashed with following error: ``` [md5:] 241613/241627 97.5% [md5:] 241614/241627 97.5% [md5:] 241625/...

JContainer, JObject, JToken and Linq confusion

I am having trouble understanding when to use `JContainer`, `JObject`, and `JToken`. I understand from the "standards" that `JObject` is composed of `JProperties` and that `JToken` is the base abstrac...

3 Apr at 07:21

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...