Questions

pass char * to C DLL from C# string

I need to use a library of C functions in a DLL from a C# application. I am having trouble calling DLL functions with char * arguments: The C DLL: The C# app needs to look something like this: I've se...

4 Jun at 03:45

How does List<SelectListItem> safely cast to SelectList in view

I was following a question where the OP had something like this ``` [HttpGet] public ActionResult Index() { var options = new List<SelectListItem>(); options.Add(new SelectListItem { Text = "...

24 Jun at 02:8

How can I safely reset Hangfire to a clean state?

I have a server with Hangfire installed. I haven't checked it for a while and it seems one recurring job has gone rogue. It stopped working and then it has stacked up with retries resulting in a compl...

11 Oct at 13:39

C# Optional Array Parameter for Class

I know this can be done using `null` so I have a workaround for that, but I was wondering if there was a better way that I can have an optional `int[]` parameter for a class? ``` class PriceLevels { ...

11 Oct at 06:18

Deprecation warning in Moment.js - Not in a recognized ISO format

I'm getting a warning that a value provided to moment is not in a recognized ISO format. I changed my variable today with the moment function and still it doesn't work. Here's the warning error: > Dep...

6 Jul at 07:3

Why is the scheme required for AuthenticationHeaderValue?

I am setting the authorization header of an `HttpClient` in the following manner: ``` httpClient .DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(null, "abc"); ``` ...but am...

How to loop an object in React?

New to React and trying to loop Object attributes but React complains about Objects not being valid React children, can someone please give me some advice on how to resolve this problem? I've added cr...

10 Oct at 20:7

Is using Single as an Assert a bad practice?

I'm testing a method that manipulates a collection. Given a set of parameters it should contain exactly one element that matches a condition. I'm using [Single](https://msdn.microsoft.com/en-us/libr...

10 Oct at 17:52

React: Passing props to function components

I have a seemingly trivial question about props and function components. Basically, I have a container component which renders a Modal component upon state change which is triggered by user click on a...

21 Dec at 04:55

What is the purpose of the ContainsPrefix method of the Web API IValueProvider interface?

I've created some implementations of `IValueProvider` for my Web API project and I'm confused about the purpose of the `ContainsPrefix` method on the interface. The `ContainsPrefix` method has this s...

10 Oct at 19:52

.Net Framework and .Net Core in same solution

I have an application targeting .NET Framework, and now I need to develop a library in .NET Core. I plan to put both projects in the same solution and add the .NET Core library as a reference in the ....

How does the Shouldly assertion library know the expression the assertion was applied to?

The [Shouldly assertion library for .NET](http://shouldly.readthedocs.io/en/latest/) somehow knows what expression the assertion method was called on so it is able to display it into the message. I tr...

10 Oct at 13:19

Epplus find column using column name

I have excel sheet created dynamically, i would like to format some columns as date however i don't know the index of these columns in advance i only know the header title. 1- I load the excel from D...

10 Oct at 12:54

ServiceStack TypeSerializer.DeserializeFromString bug with C# nullable types

It seems that there is a bug in the ServiceStack method TypeSerializer.DeserializeFromString regarding nullable types Is this a known issue? Is there a fix or a workaround? Consider the following co...

Gracefully handling corrupted state exceptions

Related to [this question](https://stackoverflow.com/q/39954552/1488067), I would like to force CLR to let my .NET 4.5.2 app catch Corrupted State Exceptions, for the sole purpose of logging them and ...

Why IsAssignableFrom return false when comparing a nullable against an interface?

The following call in C# returns false : ``` typeof(IComparable).IsAssignableFrom(typeof(DateTime?)) ``` However, the following line is perfectly valid : ``` IComparable comparable = (DateTime?)D...

10 Oct at 10:14

FluentValidation message for nested properties

I have a class with a complex property: ``` public class A { public B Prop { get; set; } } public class B { public int Id { get; set; } } ``` I've added a validator: ``` public class AVal...

C# x509 certificate decoder

I'm looking for a C# code how to decode x509 certificate from string like in this page: https://www.sslshopper.com/certificate-decoder.html I have a certificate string, that starts with MII... and end...

7 May at 07:19

How to completely uninstall Android Studio from windows(v10)?

I have already seen [this](https://stackoverflow.com/questions/17625622/how-to-completely-uninstall-android-studio?noredirect=1&lq=1) question. But that's for Mac OS. I am using windows. Every time I ...

23 May at 12:10

How to upload an image file in Retrofit 2

I have an image of postman like below. How can I do the same thing in Retrofit 2? [](https://i.stack.imgur.com/QWLb0.png) I've declared the interface like this: ``` @Multipart @POST("/api/Pharmarcy/Up...

7 Sep at 14:50

Get video dimension in python-opencv

I can get size of image, like this: ``` import cv2 img = cv2.imread('my_image.jpg',0) height, width = img.shape[:2] ``` How about video?

10 Oct at 07:30

User Authentication in ServiceStack

I did not get the Authentication and Authorization concept in servicestack. I have been watching pluralsight tutorial but still i am not getting the point about how we can authenticate the username an...

More ServiceStack request DTO advice

This is a follow up regarding: [ServiceStack Request DTO design](https://stackoverflow.com/questions/15927475/servicestack-request-dto-design) In the above question the design was strictly regarding...

23 May at 11:48

How to convert string to ByteString when using protobuf?

I want to convert a string object to ByteString.I have tried to use ByteString.CopyFrom() function to convert,but the return value is always "{Google.ProtocolBuffers.ByteString}".Why? How can I do? ...

C++ error: terminate called after throwing an instance of 'std::bad_alloc'

I wrote the code pasted below to perform the following tasks in the order in which they are stated: 1. Read an input file and count the number of entries in it 2. Create an array of appropriate siz...

8 Oct at 19:56