Entity Framework 6 DbSet AddRange vs IDbSet Add - How Can AddRange be so much faster?

I was playing around with Entity Framework 6 on my home computer and decided to try out inserting a fairly large amount of rows, around 430k. My first try looked like this, yes I know it can be bett...

How to switch kubectl clusters between gcloud and minikube

I have Kubernetes working well in two different environments, namely in my local environment (MacBook running minikube) and as well as on Google's Container Engine (GCE, Kubernetes on Google Cloud). ...

Windows selfhosted service - Setting custom service properties like description etc

A windows service has several properties like servicename, servicedisplayname, description etc. Some of these props can be set with `sc.exe` but not all of them. I have several ServiceStack services ...

26 Apr at 19:37

.NET Core Global exception handler in console application

I'm porting an console application to `.NET Core`, and I'm trying to replace this line: ``` AppDomain.CurrentDomain.UnhandledException += UnhandledException; ``` After reading [this](https://deepum...

Updating an object with setState in React

Is it at all possible to update object's properties with `setState`? Something like: ``` this.state = { jasper: { name: 'jasper', age: 28 }, } ``` I have tried: ``` this.setState({jasper.name...

22 Mar at 11:37

C# string interpolation-escaping double quotes and curly braces

guys, I'm building a JSON object from an interpolated string, and not getting how escaping works. I have to use double quotes for the API. This does not interpolate the expressions between the cur...

26 Apr at 13:42

Recognize Disposable Objects in Visual Studio?

It is suggested that `IDisposable` objects should be disposed in either `using` statement or by calling `Dispose()` method. I find it is not intuitive to find out if an object is disposable in Visual ...

Get enum values via reflection from nested enum in generic class

I need to print out enum values and their corresponding underyling values from certain types i accquire through reflection. This works fine most of the time. However if the enum is declared within a g...

19 Jun at 02:48

How to check if a string contains a char?

I have a text file that I want to read. I want to know if one of the lines contains `[` so I tried : ``` if(array[i] == "[") ``` But this isn't working. How can I check if a string contains a cert...

3 Aug at 17:23

Using import fs from 'fs'

I want to use `import fs from 'fs'` in JavaScript. Here is a sample: ``` import fs from 'fs' var output = fs.readFileSync('someData.txt') console.log(output) ``` The error I get when I run my file ...

3 Oct at 19:23

Why can't I install python3.6-dev on Ubuntu16.04

I am trying to install `Python 3.6-dev` with this command: ``` sudo apt-get install python3.6-dev ``` but I'm getting this error: ``` E: Unable to locate package python3.6-dev E: Couldn't find any...

12 Mar at 22:1

Python Pandas iterate over rows and access column names

I am trying to iterate over the rows of a Python Pandas dataframe. Within each row of the dataframe, I am trying to to refer to each value along a row by its column name. Here is what I have: ``` i...

23 May at 12:2

OrmLite throws unknown error Insufficient parameters supplied to the command

I'm using ServiceStack.OrmLite v4.0.62 (the last one for .NET Framework 4.0). And I work with SQLite database. So, on my UI I have a form which contains search fields. And depending on the conditions ...

26 Apr at 09:40

I am getting an "Invalid Host header" message when connecting to webpack-dev-server remotely

I am using as an environment, a Cloud9.io ubuntu VM Online IDE and I have reduced by troubleshooting this error to just running the app with Webpack dev server. I launch it with: ``` webpack-dev-se...

Bandwidth Shaping in my C# application

I have a C# application that uses a native library that sends video to other IP over the internet using UDP. I have no traffic control over that library. My application also calls web services of ano...

How to disable a ts rule for a specific line?

Summernote is a jQuery plugin, and I don't need type definitions for it. I just want to modify the object, but TS keeps throwing errors. The line bellow still gives me: error. ``` (function ($) { ...

How to setup Mock of IConfigurationRoot to return value

I have used IConfigurationRoute to access a directory like this. ``` if (type == "error") directory = _config.GetValue<string>("Directories:SomeDirectory"); ``` _config is IConfigurationRoot inject...

Filtering on Include in EF Core

I'm trying to filter on the initial query. I have nested include leafs off a model. I'm trying to filter based on a property on one of the includes. For example: ``` using (var context = new Blogging...

16 Nov at 13:38

Check size of uploaded file in mb

I need to verify that a file upload by a user does not exceed 10mb. Will this get the job done? ```csharp var fileSize = imageFile.ContentLength; if ((fileSize * 131072) > 10) { // image i...

30 Apr at 17:51

EF6, SQLite won't work without App.config

I'm trying to make a plug in that will use EF6.1 and SQLite for an app where I can't change the App.config so all the configuration and connection string needs to be set in code. I found this answer ...

2 Sep at 18:5

Can Nullable types be sent through Protocol Buffers?

The [Proto3 C# Reference](https://developers.google.com/protocol-buffers/docs/reference/csharp-generated#wrapper_types) contains the following text: > Most of the well-known types in proto3 do not af...

25 Apr at 16:9

Project X targets '.NETStandard,Version=v1.6'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.6.1'

I really wanted to be a good citizen... copied all my classes to .net standard libraries. Just to find out that my test DLL can't use it. I get the following error > Project X targets '.NETStandard,...

28 Dec at 06:41

An enumerable sequence of parameters (arrays, lists, etc) is not allowed in this context in Dapper

I have the following code: ``` static void Main(string[] args){ string sql= "SELECT * FROM Posts WHERE 1=1 "; SqlParameter[] @params= SetDynamicParameter(ref sql, "Param=Value", "Para...

25 Apr at 14:15

Azure DocumentDB Read Document Resource Not Found

I'm building a .Net Console application to read information in a DocumentDB. The console app has data coming from an EventHub and inserts/updates recent data as it comes into the cloud. I am trying t...

22 Dec at 18:16

BadImageFormatException Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format

I am getting following runtime error, with my console application(VS2012) which refers to "dcasdk.dll". .Net Framework of the console app is 4.5, platform target is "Any CPU". ``` Could not load file...