Questions

Cast null value to a type

If we cast some null variable to a type, I expect the compiler to throw some exception, but it doesn't. Why? I mean ``` string sample1 = null as string; string sample2 = (string)null; object t1 = nu...

is not a recognized built-in function name

Created a function ``` CREATE FUNCTION Split_On_Upper_Case(@Temp VARCHAR(1000)) RETURNS VARCHAR(1000) AS BEGIN DECLARE @KeepValues AS VARCHAR(50) SET @KeepValues='%[^ ][A-Z]%' WHILE PATINDEX(@KeepVa...

Get index of a row of a pandas dataframe as an integer

Assume an easy dataframe, for example ``` A B 0 1 0.810743 1 2 0.595866 2 3 0.154888 3 4 0.472721 4 5 0.894525 5 6 0.978174 6 7 0.859449 7 8 0.541247 8 9 0.232302 9...

20 Jun at 21:15

What is the time complexity of Linq OrderBy().ThenBy() method sequence?

I am using Linq and Lambda Operations in my projects and I needed to sort a List according to two properties of a class. Therefore, I used OrderBy().ThenBy() methods as below: ``` class ValueWithInde...

23 May at 12:2

Composer: file_put_contents(./composer.json): failed to open stream: Permission denied

I'm trying to install [Prestissimo](https://github.com/hirak/prestissimo) to an Ubuntu 16.04 server, but that leads to an error: ``` $ composer global require "hirak/prestissimo:^0.3" Changed current...

18 Dec at 20:6

tsconfig.json: Build:No inputs were found in config file

I have an ASP.NET core project and I'm getting this error when I try to build it: ``` error TS18003: Build:No inputs were found in config file 'Z:/Projects/client/ZV/src/ZV/Scripts/tsconfig.json'. Sp...

Error 415 when posting to ASP.Net Core WebAPI using XMLHttpRequest

Working on a new project using a WebAPI backend server and I am having trouble posting to the controller from an actual website, despite Postman having no issues posting to the controller. I get the a...

How do I safely call an async method from EF's non-async SaveChanges?

I'm using ASP.NET Core, and EF Core which has `SaveChanges` and `SaveChangesAsync`. Before saving to the database, in my `DbContext`, I perform some auditing/logging: ``` public async Task LogAndAud...

Why is -1L * -9223372036854775808L == -9223372036854775808L

I understand this has something to do with the way processors treat overflows, but I fail to see it. Multiplication with different negative numbers gives either zero or `-2^63`: In C# Interactive: `...

18 Dec at 00:50

Generic repository with Dapper

I'm trying to build a generic repository with Dapper. However, I have some difficulties to implement the CRUD-operations. Here is some code from the repository: ``` public class GenericRepository<TE...

9 Mar at 09:16

updating nodejs on ubuntu 16.04

I was recently going through the version of node in my ubuntu 16.04 when `node -v` command was used it shows me version 6.9.1 but when `nodejs -v` it shows 6.9.2 previously before using this commands ...

17 Dec at 06:23

Images in SVG Image tags not showing up in Chrome, but displays locally?

For some reason, Chrome is displaying the SVG without the images in its Image tags. Here is a sample from my SVG: ``` <image xlink:href="blocker.png" height="312.666661" width="85.693825" y="16.479...

17 Dec at 05:37

Debug Console window cannot accept Console.ReadLine() input during debugging

VSCode Version: 1.8.0 OS Version: Win10 x64 Steps to Reproduce: 1. Create a new .net core cli app using "dotnet new" 2. Open the folder using VS code 3. Add two lines of code in Program.cs string ...

12 Jul at 13:0

Unity Create UI control from script

I created a toggle by code but it won´t get displayed. Furthermore, I can´t change the position of my text field. I tried a lot and nothing works. This is my current version, maybe you see the mistak...

19 Dec at 09:15

vue.js proper way to determine empty object

Classic scenario: I want to display a list, but when it's empty I want to display "No data". The fact that it is somewhat complicated to do something I would expect to be simple makes me think I'm pr...

16 Dec at 20:56

What is difference between REST and API?

I want to know the main difference between REST and API. Sometimes I see REST API in programming documents, then is REST or API same as REST API? I would like to know more about relation between REST,...

9 May at 17:18

No templates in Visual Studio 2017

After a Visual Studio 2017 (RC) installation from scratch, I can't find a standard list of templates. I'm specifically interested in the `Console Application (C#) template` and the `Windows Form (C#) ...

Hook OData's $metadata response and convert it from XML to JSON

The answer of [Get OData $metadata in JSON format](https://stackoverflow.com/questions/18683338/get-odata-metadata-in-json-format) states that OData cannot return the metadata as JSON by default. But...

16 Dec at 14:53

Xamarin Forms: StackLayout with rounded corners

I am developing an app using Xamarin Forms PCL. I need a StackLayout with rounded corners. I have tried frame as well for rounded corner container but there is no corner radius property available for ...

Nuget connection attempt failed "Unable to load the service index for source"

While trying to connect to Nuget, I'm getting the error below, and then I am unable to connect: > [nuget.org] Unable to load the service index for source [https://api.nuget.org/v3/index.json](https://...

24 Jun at 14:54

web request in asp.net core

I want to do a web request in a asp.net core project. I tried the following but it doesn't seem to send the data in the request: ``` using System.Net; ... //encoder UTF8Encoding enc = new UTF8Encod...

19 Dec at 16:25

Extract day of week from date field in PostgreSQL assuming weeks start on Monday

``` select extract(dow from datefield) ``` extract a number from 0 to 6, where 0 is Sunday; is there a way to get the day of the week in SQL assuming that weeks start on Monday (so 0 will be Monday)...

16 Dec at 10:13

merging 2 dataframes vertically

I have 2 dataframes that have 2 columns each (same column names). I want to merge them vertically to end up having a new dataframe. When doing ``` newdf = df.merge(df1,how='left',on=['Col1','Col2'...

16 Dec at 10:8

Cast Generic<Derived> to Generic<Base>

I have a base WPF UserControl that handles some common functionality for derived UserControls. In the code-behind of any derived UserControl I call an event ``` private void SomeClick(object sender, ...

18 Apr at 21:49

AWS Lambda:The provided execution role does not have permissions to call DescribeNetworkInterfaces on EC2

Today I have a new AWS Lambda question, and can't find anywhere in Google. I new a Lambda function, there is no question. But when I input any code in this function[eg. console.log();] and click "Sa...