Questions

Object must implement IConvertible (InvalidCastException) while casting to interface

I'm trying to cast an object of a certain type to an interface it implements using `Convert.ChangeType()`, however an `InvalidCastException` gets thrown because . The types: ``` public IDocumentSet ...

16 Sep at 11:28

bulk creating keys in Redis C# - SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted

I'm bulk creating keys in Redis dB under multi-threading environment for some reason in my ASP.NET MVC Web Application. And I'm using [ServiceStack.Redis](https://github.com/ServiceStack/ServiceStack....

Force HttpWebRequest to send client certificate

I have a p12 certificate, that I load it in this way: ``` X509Certificate2 certificate = new X509Certificate2(certName, password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Persi...

16 Sep at 10:15

Reading SQL Varbinary Blob from Database

I am working on saving files to sql blob to a varbinary(max) column, and have got the save side of things working now (I believe). What I can't figure out is how to read the data out, given that I'm ...

27 Sep at 16:13

How to retrieve output parameter from stored procedure by EF code first

i am new in EF and working with EF code first. just got a link [https://code.msdn.microsoft.com/How-to-retrieve-output-e85526ba](https://code.msdn.microsoft.com/How-to-retrieve-output-e85526ba) which ...

Json.net serialize numeric properties as string

I am using JsonConvert.SerializeObject to serialize a model object. The server expects all fields as strings. My model object has numeric properties and string properties. I can not add attributes to ...

5 May at 15:53

Method that returns Task<string>

I need a method that returns a `Task<string>` with empty string like ``` public static Task<string> AsyncTest() { return new Task<string>(() => string.Empty); //problem here // this me...

16 Sep at 07:26

How to fill a dictionary with all request headers

Im able to get request headers one by one when I have the header key name with this method ``` private string GetHeader(string Name) { IEnumerable<string> headerValues; if (Request.Headers.Tr...

16 Sep at 07:17

Visual Studio Code: How to show line endings

How can I display lineendings (CR,LF) in Visual Studio Code (not in Visual Studio)? At the moment there is only the little statusbar menu which display/change the line ending if the actual file. But s...

29 Oct at 14:58

Change the speed of animation at runtime in unity c#

The default speed of animation in unity is . I set the default speed value of animation to . And during runtime of program, I want the speed of animation to . ``` using UnityEngine; using System.Co...

16 Sep at 06:20

Xcode error: Code signing is required for product type 'Application' in SDK 'iOS 10.0'

I have Xcode 8 installed on OS X El Capitan. I get this error: > Signing for "target" requires a development team. Select a development team in the project editor.Code signing is required for product ...

20 Jun at 09:12

How to get the current CPU/RAM/Disk usage in a C# web application using .NET CORE?

I am currently looking for a way to get the current CPU/RAM/Disk usage in a C# web application using .NET CORE. For CPU and ram usage, I use PerformanceCounter Class from `System.Diagnostics`. This is...

27 Dec at 03:36

Why are web apps going crazy with await / async nowadays?

I come from a back end / thick client background, so maybe I'm missing something... but I recently looked at the source for an open source JWT token server and the authors went crazy with await / asyn...

16 Sep at 00:18

NSPhotoLibraryUsageDescription key must be present in Info.plist to use camera roll

Recently I started to get this error: > NSPhotoLibraryUsageDescription key must be present in Info.plist to use camera roll. I am using React Native to build my app (I am not familiar with ios na...

18 Nov at 10:42

Make XmlHttpRequest POST using JSON

How can I make an AJAX POST request sending JSON data using vanilla JS. I understand the content-type is url form encoded and it doesn't support nested JSONs. Is there any way I can make such a POST...

15 Sep at 20:7

userManager.AddToRoleAsync() - Error: role does not exist

I'm creating a user registration system using .NET Core, Identity Core, and MVC Core. I'm able to create users and create roles in the database. Here's the form on the view that lets me select a user...

Using async / await inside .Select lambda

I am using Asp.Net Core Identity and trying to simplify some code that projects a list of users to a ViewModel. This code works, but in trying to simplify it I have gone into a crazy spiral of error...

Facebook SDK for .NET Core

Up until now I've been using Facebook SDK for .NET by [https://hackerapp.com/](https://hackerapp.com/) I want to upgrade my project to ASP.NET Core, but I see that their library doesn't have support ...

OData Error: The query specified in the URI is not valid. The property cannot be used in the query option

I'm trying to get an OData endpoint up and working and I'm having this error that even Google doesn't have much to say about. I have created an Entity Framework EDMX context (database first), had the...

How to take input as String with spaces in java using scanner

I need to read spaces (present before string and after String) given as input using Scanner Note : if there is no spaces given in input it should not add space in output Please find the below code:...

17 Sep at 22:42

Bulk create keys in Redis - ServiceStack C#

Is there any way to bulk-create keys (`SETS`) in ""? Of course, without putting `for` loop. There is one command in Redis which does this: [MSET](http://redis.io/commands/mset) but, I couldn't fin...

Get current date in Swift 3?

How can I set label.text current date in Swift 3? I want to print just today to the screen. I did not find how to do that. In c# is very simple: ``` var date = DateTime.Now ``` I need to write 1...

9 Apr at 23:47

Deploying entity framework code first with production database

I've developed a pretty simple web app using entity framework code first. I realized after hours of frustration that even though localdb is SQL Server Express it is actually not meant to be used with ...

Is there any difference between the Ok() method new ObjectResult()?

Scenario: implementing a standard REST API / GET method on a .net core controller. The [documentation](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.okobjectresult) states that...

21 Apr at 08:32

Exposing .NET events to COM?

I've been trying to expose and fire an event to a VBA client. So far on the VBA client side, the event is exposed and I see the method event handling method added to my module class however the VBA ev...

26 Sep at 08:5