Questions

C# webBrowser script error

I keep getting a script error when trying to load the page using `webBrowser.Navigate("https://home.nest.com/")`. It will pull up fine from my normal internet browser but not in my program. Can anyo...

20 May at 19:18

How is C# string interpolation compiled?

I know that interpolation is syntactic sugar for `string.Format()`, but does it have any special behavior/recognition of when it is being used with a string formatting method? If I have a method: ``...

20 May at 15:50

Is there any way for the nameof operator to access method parameters (outside of the same method)?

Take the following class and method: ``` public class Foo public Foo Create(string bar) { return new Foo(bar); } ``` So getting "Create" is obvious: `nameof(Foo.Create)` Is there a...

2 Nov at 15:29

Is it possible to put a ConstraintLayout inside a ScrollView?

So recently, with Android Studio 2.2 there's a new ConstraintLayout that makes designing a lot easier, but unlike `RelativeLayout` and `Linearlayout`, I can't use a `ScrollView` to surround `Constrain...

Difference between @: and <text> in Razor

What's the difference between these 2 in Razor? I find that I can accomplish the same, whether I use `@:` or `<text>`.

20 May at 14:17

Why is accessing an element of a dictionary by key O(1) even though the hash function may not be O(1)?

I see how you can access your collection by key. However, the hash function itself has a lot of operations behind the scenes, doesn't it? Assuming you have a nice hash function which is very efficien...

21 May at 04:11

How to solve the memory error in Python

I am dealing with several large txt file, each of them has about 8000000 lines. A short example of the lines are: ``` usedfor zipper fasten_coat usedfor zipper fasten_jacket usedfor zipper fasten_pan...

20 May at 13:10

ngModel for textarea not working in angular 2

I am trying to print json object in textarea using `ngModel`. I have done following: ``` <textarea style="background-color:black;color:white;" [(ngModel)]='rapidPage' rows="30" cols="120"> ...

16 Mar at 19:52

How do I find and replace all occurrences (in all files) in Visual Studio Code?

I can't figure out how to find and replace all occurrences of a word in different files using Visual Studio Code version 1.0. I get the impression this should be possible since doing Ctrl + Shift + F...

10 Jul at 10:32

Hosting ASP.NET Core as Windows service

As I get it in RC2 there's a support for hosting applications within Windows Services. I tried to test it on a simple web api project (using .NET Framework 4.6.1). Here's my Program.cs code: ``` usi...

Retrieving new Firebase access token for REST services in .NET from Google auth service

After a change of firebase authorization system, I'm trying to retrieve access token in c# from google auth server. According to new documentation: [https://firebase.google.com/docs/reference/rest/da...

How to get float value with SqlDataReader?

In my database, I have NextStatDistanceTime value as a float. When "`float time = reader.GetFloat(0);`" line excecuted, it gives an error of > system invalid cast exception How can I get float value...

20 May at 10:28

How to use FromQuery Attribute get a complex object?

How to use FromQueryAttribute get a complex object? ``` [HttpGet] public IActionResult Get([FromQuery] DataGridRequest request) { ... } ``` The DataGridRequest class like this: ``` public clas...

20 May at 13:17

Find a KeyValuePair inside a List

Suppose I have ``` List<KeyValuePair<int, string>> d ``` I know the string but I want to find its integer. How do I find the keyvaluepair inside this List?

20 May at 09:26

VSCode "go to definition" not working

I installed Visual Studio Code 1.1 with the C/C++ extension, opened my C++ project and tried to use "Go to definition" in vain. The "Go to definition" is not working at all. Example, go to definition...

23 Aug at 20:16

Get DB DataType ServiceStack Ormlite

Is there a way from a POCO class to get the actual DB Data Type of the various properties? For Example: Let's assume the POCO class ``` public class Product : IHasId<int> { [Alias("id")] [Re...

23 May at 14:41

Test Environment.Exit() in C#

Is there in C# some kind of equivalent of [`ExpectedSystemExit`][1] in Java? I have an exit in my code and would really like to be able to test it. The only thing I found in C# is a not really nice [w...

Linq Sum with group by

I am having a table structure with columns FeesNormal FeesCustom Currency Now i am looking for a SUM function group by currency . For example 20 USD + 30 EURO + 40 INR something like this fr...

20 May at 05:57

Which one is faster? Regex or EndsWith?

What would be faster? ``` public String Roll() { Random rnd = new Random(); int roll = rnd.Next(1, 100000); if (Regex.IsMatch(roll.ToString(), @"(.)\1{1,}$")) { return "double...

12 Jun at 21:45

Where can I find the API KEY for Firebase Cloud Messaging?

I am trying to figure out how the new version of GCM or Firebase Cloud Messaging works so I moved one of my projects to the new Firebase console, If I did not have the API KEY or I want to create a ne...

React.js: Set innerHTML vs dangerouslySetInnerHTML

Is there any "behind the scenes" difference from setting an element's innerHTML vs setting the dangerouslySetInnerHTML property on an element? Assume I'm properly sanitizing things for the sake of sim...

24 Aug at 07:45

Throw "IDX10223: Lifetime validation failed. The token is expired." when working Azure AD with Microsoft.Owin.Security.OpenIdConnect

I'm integrating the "Microsoft Azure AD" to our Asp.NET web projects, all works fine following the guide shown at [https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquicksta...

Can you mark XUnit tests as Explicit?

I'm making the transition from NUnit to XUnit (in C#), and I was writing some "Integrated Tests" (ITs) that I don't necessarily want the test runner to run as part of my automated build process. I typ...

How to delete an element from a Slice in Golang

``` fmt.Println("Enter position to delete::") fmt.Scanln(&pos) new_arr := make([]int, (len(arr) - 1)) k := 0 for i := 0; i < (len(arr) - 1); { if i != pos { new_arr[i] = arr[k] k+...

5 May at 06:32

How do you add a file as a link in a .NET Core library?

I've added a .NET Core RC2 class lib to my solution (for fun) and the first thing I usually do is add a link to a shared `GlobalAssemblyInfo.cs` and edit the existing `AssemblyInfo.cs` down to the ass...