Questions

How can I specify default values for method parameters in c#7 tuples?

In C#, you can define default parameters as described [here](https://stackoverflow.com/q/3482528/1016343). I was playing around with tuples and C#7 (using [LinqPad](http://www.linqpad.net/) with `Pref...

5 Nov at 15:20

VS ServiceStack Template - Requires Git to be installed

I am trying to use ServiceStack templates to create a new project on Visual Studio 2015 Professional. Some of the templates seem to require an installation of Git. I faithfully download & install Git...

27 Jan at 10:54

Filter df when values matches part of a string in pyspark

I have a large `pyspark.sql.dataframe.DataFrame` and I want to keep (so `filter`) all rows where the URL saved in the `location` column contains a pre-determined string, e.g. 'google.com'. I have trie...

Is there a difference between passing a function to a delegate by ref?

I came upon this piece of C# code that uses delegates and passes the function to the delegate by reference... ``` delegate bool MyDel(int x); static bool fun(int x) { return x < 0...

27 Jan at 11:18

SELECT list is not in GROUP BY clause and contains nonaggregated column .... incompatible with sql_mode=only_full_group_by

I'm using MySQL 5.7.13 on my windows PC with WAMP Server My problem is while executing this query ``` SELECT * FROM `tbl_customer_pod_uploads` WHERE `load_id` = '78' AND `status` = 'Active' GROU...

12 Jan at 18:31

Does SignInAsAuthenticationType allow me to get an OAuth token without overwriting existing claims?

I need a user to login to a website using out of the box authentication to Facebook. I now need to link to the users drive in Google (and other services). I want to use ASP.Net Identity OAuth Identi...

How can I mock the JavaScript 'window' object using Jest?

I need to test a function which opens a new tab in the browser ``` openStatementsReport(contactIds) { window.open(`a_url_${contactIds}`); } ``` I would like to mock 's `open` function, so I can ver...

4 Aug at 21:6

Django - is not a registered namespace

I am trying to process a form in django/python using the following code. --- home.html: ``` <form action="{% url 'home:submit' %}" method='post'> ``` --- views.py: ``` def submit(request): ...

navigation property should be virtual - not required in ef core?

As I remember in EF [navigation property should be virtual](https://stackoverflow.com/questions/25715474/why-navigation-properties-are-virtual-by-default-in-ef): ``` public class Blog { publi...

mysqli_real_connect(): (HY000/2002): No such file or directory

``` mysqli_real_connect(): (HY000/2002): No such file or directory ``` PhpMyAdmin error on MacOS. I want answer I really have no idea what I need to do to resolve this.

27 Dec at 19:50

What does IRedisClient.As<T>() do behind the scenes?

I'm curently using the c# ServiceStack RedisClient in the following way ``` using (var cache = new BasicRedisClientManager(readWriteHosts).ClientFactory.GetClient()) { var r = cache.As<Foo...

26 Jan at 17:23

How do I set multipart in axios with react?

When I curl something, it works fine: ``` curl -L -i -H 'x-device-id: abc' -F "url=http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" http://example.com/upload ``` How do I get this to work right ...

How do I move the panel in Visual Studio Code to the right side?

It's at the bottom by default. For example in the following image ,panel(Section D) is at the bottom, instead I want it to move to the rightside i.e., in the area where README.md editior shown in Edit...

5 May at 04:30

Exclude complete services from swagger-ui with servicestack

I am trying to figure out a way to hide/remove complete services from the swagger-UI. According to the [documentation](https://github.com/ServiceStack/ServiceStack/wiki/Swagger-API%22documentation%22)...

27 Jan at 09:13

How to extract custom JWT properties using servicestack

I can successfully authenticate against a servicestack endpoint secured with an `Authenticate` attribute when supplying the below JWT as a bearer token in an `authorization` header. Some properties a...

26 Jan at 12:41

Newtonsoft Json Error converting value {null} to type 'System.Int32'

When performing an AJAX request I am getting the following error: > Error converting value {null} to type 'System.Int32'. Path '[5].tabID', line 1, position 331. The error occurs on the second line ...

26 Jan at 12:40

Are these try/catch'es equivalent?

I have a method that does database operation (let's say). If during that operation any exception is raised, I just want to throw that exception to the caller. I don't want to do any specific task in...

1 Sep at 21:50

How can I bind an array with asp-for tag?

I would like to ask, how can I bind an array in Asp.NET Core MVC ? ``` <input type="text" asp-for="Requests[@index].Name" /> ``` It was working very well in older versions of ASP MVC. This example ...

9 Mar at 06:37

MailKit C# SmtpClient.Connect() to Office 365 generating exception: "An existing connection was forcibly closed by the remote host"

I have a problem sending email via Office 365 SMTP and MailKit. The exception I get is: > Unhandled Exception: System.IO.IOException: Unable to read data from the transport connection: An existing ...

26 Jan at 11:48

Updating php version on mac

I want to update php version, currently I have 5.5.38 and I want 7.1 What I tried so far is using this command: ``` curl -s https://php-osx.liip.ch/install.sh | bash -s 7.1 ``` I tried several dif...

26 Jan at 11:38

Validate ModelState.IsValid globally for all controllers

In my ASP.NET Core Controllers I always check if the ModelState is valid: ``` [HttpPost("[action]")] public async Task<IActionResult> DoStuff([FromBody]DoStuffRequest request) { if (!ModelState.IsV...

26 Jan at 12:6

Refresh user cookie ticket in ASP.Net Core Identity

In a controller in an ASP.NET Core web application I want to refresh the user and claims in the cookie ticket stored on the client. The client is authenticated and authorized, ASP.NET Core Identity s...

26 Jan at 11:53

How does JSON deserialization in C# work

I am trying to understand how `JsonConvert.DeserializeObject<X>(someJsonString)` is able to set the values by using the constructor. ``` using Newtonsoft.json public class X { [JsonProperty("so...

26 Jan at 09:15

Unit test ServiceStack services in ServiceStack 3.9.71

I recently took a .Net project over which exposes DAOs from a Microsoft SQL Database via ServiceStack(3.9.71) REST API. Since I am gonna refactor some parts I want to unit test (at least) all services...

Pass action delegate as parameter in C#

I have a method which accepts an `Action` delegate and executes the given method as shown here: ``` public void ExpMethod(Action inputDel) { inpuDel(); } ``` I can call above given method like ...

26 Jan at 10:7