Entity Framework 6 - How can I view the SQL that will be generated for an insert before calling SaveChanges

In Entity Framework 6, is it possible to view the SQL that will be executed for an calling SaveChanges? ``` using (var db = new StuffEntities()){ db.Things.Add(new Thing({...}); //can I ge...

21 Apr at 19:43

How to validate phone number in laravel 5.2?

I want to validate user input phone number where number should be exactly 11 and started with 01 and value field should be number only. How do I do it using Laravel validation? Here is my controller:...

23 Apr at 11:31

Angular 2: Convert Observable to Promise

`.then(...)` My method I want to convert to a promise: ``` this._APIService.getAssetTypes().subscribe( assettypes => { this._LocalStorageService.setAssetTypes(assettypes); }, err...

21 Apr at 18:41

roslyn compiler not copied to AspnetCompileMerge folder using msbuild

I have a .NET MVC project that I'm trying to deploy using Jenkins. I had been letting Jenkins run msbuild, then copying the resulting files out using RoboCopy. I wanted to switch to just use a publis...

23 May at 12:10

How do I serve static files only to authorized users?

I have a collection of Excel spreadsheets that I'd like to serve in my ASP.NET 5 webapp only to authorized users. 1. Where should I store the files? I assume in wwwroot (e.g., wwwroot/files). 2. If ...

.NET: 100% CPU usage in HttpClient because of Dictionary?

Has anyone else encountered an issue in using a singleton .NET HttpClient where the application pegs the processor at 100% until it's restarted? I'm running a Windows Service that does continuous, ...

If my C# times out with a stored procedure call, does the procedure continue running?

I have just a general type of question. If I have a C# application that calls a SQL Server stored procedure, and the C# application times out, does the procedure call on the server continue running t...

VBA: Convert Text to Number

I have columns of numbers that, for whatever reason, are formatted as text. This prevents me from using arithmetic functions such as the subtotal function. What is the best way to convert these "text ...

4 Dec at 12:45

No tests to execute msTest

I'm trying to run .NET unit tests on the command line using MSTest My command is ``` "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcontainer:"full path of dll" /...

How to create a DataFrame from a text file in Spark

I have a text file on HDFS and I want to convert it to a Data Frame in Spark. I am using the Spark Context to load the file and then try to generate individual columns from that file. ``` val myFil...

ASP.NET Identity, add another user to role instantly (they don't have to log out and in again)

First of all, I'm aware of this question: [MVC 5 AddToRole requires logout before it works?](https://stackoverflow.com/questions/20495249/mvc-5-addtorole-requires-logout-before-it-works) and this one...

How to only load certain fields of a child object in Entity Framework 6.1?

I'm working on a model that has two classes, `Product` and `Transaction`. ``` public class Product { [DataMember] public Guid ProductId {get; set;} [DataMember] public virtual IColle...

In ServiceStack, how can I do integration testing with multiple endpoints?

We're using ServiceStack for a client project with several distinct problem domains, which we'd prefer to keep separated. We've developed a testing framework that spins up an AppHostHttpListener and ...

23 May at 12:7

Is there a "String.Format" that can accept named input parameters instead of index placeholders?

This is what I know ``` str = String.Format("Her name is {0} and she's {1} years old", "Lisa", "10"); ``` But I want something like ``` str = String("Her name is @name and she's @age years old"); ...

21 Apr at 04:56

How to have multiple conditions for one if statement in python

So I am writing some code in python 3.1.5 that requires there be more than one condition for something to happen. Example: ``` def example(arg1, arg2, arg3): if arg1 == 1: if arg2 == 2: ...

Is it possible to get a warning if return value is not used?

I have an extension method which returns a value. In this case, it should set a specific bit in a byte: ``` public static byte SetBit(this byte b, int bitNumber, bool value) { if (value) { ...

5 Nov at 00:9

Add Scrollbars to a Textbox

How does one get scrollbars on a `TextBox`?

6 Feb at 00:28

JS generate random boolean

Simple question, but I'm interested in the nuances here. I'm generating random booleans using the following method I came up with myself: ``` const rand = Boolean(Math.round(Math.random())); ``` W...

20 Apr at 22:57

Problems with multiple primary keys using ORMLITE

I use the ORMLite Poco generator for my database. The problem is that I have a table with multiple primary keys, and when I try to add any data into the database I get unique constraints. I have rea...

6 Nov at 13:11

Postgresql tables exists, but getting "relation does not exist" when querying

I have a postgresql db with a number of tables. If I query: ``` SELECT column_name FROM information_schema.columns WHERE table_name="my_table"; ``` I will get a list of the columns returned properl...

25 Apr at 01:36

Completely uninstall VS Code extensions

Since the latest release of VS Code, I get an error whenever I open a C# file (I have installed the csharp language extension, powered by OmniSharp). This is the error I get: [](https://i.stack.imgu...

12 Apr at 12:18

Passing MSBuild Arguments to Cake Build Script to produce _PublishedWebsites

I am currentlly in the process of writing a Cake build script to build a number of ASP.NET MVC sites. At the moment I am unable to see an option to pass arguments to MSBuild to produce the _Publishe...

How to add conditional attribute in Angular 2?

How can I conditionally add an element attribute e.g. the `checked` of a checkbox? Previous versions of Angular had `NgAttr` and I think `NgChecked` which all seem to provide the functionality that ...

17 May at 15:6

String interpolation using named parameters in C#6

Given I have a Meta Data resource string stored in my Database that will return like this: ``` var pageTitle = "Shop the latest {category1} Designer {category2} {category3} at www.abc.com"; ``` An...

21 Apr at 00:44

How to write 1GB file in efficient way C#

I have .txt file (contains more than million rows) which is around 1GB and I have one list of string, I am trying to remove all the rows from the file that exist in the list of strings and creating ne...

20 Apr at 13:58