Questions

Is changing the size of a struct a breaking change in C#?

Just curious, is changing the size of a struct/value type a breaking change in C#? Structs tend to be more sensitive in terms of memory layout since altering them directly affects the size of arrays/o...

16 Jun at 17:19

This view is not constrained vertically. At runtime it will jump to the left unless you add a vertical constraint

[](https://i.stack.imgur.com/0gpVY.png)New Layout editor in Android Studio 2.2 keeps showing this error on views like EditText and Buttons. kindly help.Also, any links that help in onboarding with the...

Implement "percent chance" in C#

I need some help with percent chance in C# code. Let's say i have for loop from 1 to 100 and in that loop i have an "if" code that i want to be executed 70% times (on random). How would i achieve that...

16 Jun at 12:1

Uncaught SyntaxError: Invalid or unexpected token

I have a razor syntax like this: ``` foreach(var item in model) { <td><a href ="#" onclick="Getinfo(@item.email);" >6/16/2016 2:02:29 AM</a> </td> } ``` My javascript that recieves the req...

16 Jun at 11:56

Laravel: how to set date format on model attribute casting?

I have in model: ``` protected $casts = [ 'date' => 'date', ]; ``` Does laravel have some ability to set cast format, something like: ``` protected $casts = [ 'date' => 'date_format:d/m/yy...

7 Dec at 12:39

chart js 2 how to set bar width

I'm using Chart js version: 2.1.4 and I'm not able to limit the bar width. I found two options on stackoverflow ``` barPercentage: 0.5 ``` or ``` categorySpacing: 0 ``` but neither of one works ...

16 Jun at 10:35

How to log the HTTP Response Body in ASP.NET Core 1.0

I'm creating a public REST Api using ASP.NET Core 1.0 RC2 and like to log incoming requests and outgoing responses. I have created a middleware class which is added to the pipeline before the call to...

23 May at 10:31

Having an actual decimal value as parameter for an attribute (example xUnit.net's [InlineData]

I'm trying to do unit testing with [xUnit.net](https://github.com/xunit/xunit). I want a 'Theory' test with '[InlineData]' which includes 'decimals': ``` [Theory] [InlineData(37.60M)] public void MyD...

6 Sep at 06:46

Can I send files via email using MailKit?

As the title, is MailKit supported to send file? If yes, how can I do it?

What is the difference between casting long.MaxValue to int and casting float.MaxValue to int?

I'm trying to understand difference between some data types and conversion. ``` public static void ExplicitTypeConversion2() { long longValue=long.MaxValue; float floatValue = flo...

16 Jun at 12:53

What does mean "?" after variable in C#?

What does this condition mean? ``` if (!helper?.Settings.HasConfig ?? false) ``` P.S. - `helper``class`- `Settings`- `HasConfig`

13 Feb at 13:6

Delete duplicates in a List of int arrays

having a List of int arrays like: ``` List<int[]> intArrList = new List<int[]>(); intArrList.Add(new int[3] { 0, 0, 0 }); intArrList.Add(new int[5] { 20, 30, 10, 4, 6 }); //this intArrList.Add(new i...

6 Mar at 18:21

Swapping Azure Web App deployment slots logs out all users in ASP.NET Core RC2

Whenever I updated my ASP.NET Core RC2 website running on as an Azure Web App, it logs out all users. It seems to be related to swapping a staging deployment slot to production (I use web deploy from ...

CORS not working with route

I have an issue with an endpoint on my web api. I have a POST method that is not working due to: > Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' ...

15 Jun at 23:21

^=, -= and += symbols in Python

I am quite experienced with Python, but recently, when I was looking at the solutions for the [codility](https://www.codility.com/) sample tests I encountered the operators `-=`, `+=`, `^=` and I am u...

4 Jun at 19:2

How query by global secondary index with DynamoDBContext

i have this class with this attributes: 1. ContactId -> HashKey 2. Email -> Global Seconday Index Hash Key 3. CreatedAt -> Property Actually, i have this method, but throw me an exception because...

Unit test an Entity Framework generic repository using Moq

I am not able to get a passing test because the class `this.dbSet = context.Set<T>();` is always `null`. As you can see in the code below, I have mocked up the `DbSet` and the context. I have also...

WebApi 2 POST with single string parameter not working

I have the following controller: ``` public class ValuesController : ApiController { // POST api/values public IHttpActionResult Post(string filterName) { return new JsonResult<s...

java.lang.IllegalArgumentException: No converter found for return value of type

With this code ``` @RequestMapping(value = "/bar/foo", method = RequestMethod.GET) public ResponseEntity<foo> foo() { Foo model; ... return ResponseEntity.ok(model); }...

18 Aug at 15:40

C# - Get Second to Last Item in a List

I have some code written in C#. In this code, I have a `List<KeyValuePair<int, string>> items`. I am trying to get the second-to-last item in the list. I'm having problems doing it though. Originally...

9 Oct at 13:56

ShouldSerialize*() vs *Specified Conditional Serialization Pattern

I am aware of both of the ShouldSerialize* pattern and the *Specified pattern and how they work, but is there any difference between the two? Are there any "gotchas" using one method vs the other w...

Python class input argument

I am new to OOP. My idea was to implement the following class: ``` class name(object, name): def __init__(self, name): print name ``` Then the idea was to create two instances of that c...

15 Jun at 15:13

How can I specify the function type in my type hints?

How can I specify the type hint of a variable as a ? There is no `typing.Function`, and I could not find anything in the relevant PEP, [PEP 483](https://www.python.org/dev/peps/pep-0483/).

Format DateTime in Xamarin Forms to Device Format string

How can I format a `DateTime`object to a string in the device default datetime format when running a PCL Xamarin.Forms project and my deployement targets include iOS, Android and Windows. The `DateT...

VSTests - Could not find diagnostic data adapter 'Code Coverage'

I'm new to VS Code Coverage, and I'm trying to use the VSTests tool from the command line (in windows). But i get this error. ``` Warning: Diagnostic data adapter message: Could not find diagnosti...

15 Jun at 11:31