Questions

How do you get ServiceStack.ToJson to *sometimes* ignore properties?

I have a ServiceStack DTO: ``` [Route("/images", "POST")] public class PostImageCommand { public string Notes { get; set; } public byte[] Image { get; set; } //other properties removed fo...

25 May at 09:35

How to Validate on Max File Size in Laravel?

I'm trying to validate on a max file size of 500kb in Laravel: ``` $validator = Validator::make($request->all(), [ 'file' => 'size:500', ]); ``` But this says that the file should be exactly 5...

28 Nov at 15:52

Why do we need backing fields in C# properties?

This is a question about auto-implemented properties. Auto-implemented properties are about properties without logic in the getters and setters while I stated in my code very clearly that there is s...

23 Oct at 22:25

Why IReadOnlyCollection has ElementAt but not IndexOf

I am working with a `IReadOnlyCollection` of objects. Now I'm a bit surprised, because I can use `linq` extension method `ElementAt()`. But I don't have access to `IndexOf()`. This to me looks a bit...

ASP.NET Core HTTPRequestMessage returns strange JSON message

I am currently working with ASP.NET Core RC2 and I am running into some strange results. So I have an MVC controller with the following function: ``` public HttpResponseMessage Tunnel() { var mes...

Error MSB3027: Could not copy "C:\pagefile.sys" to "bin\roslyn\pagefile.sys". Exceeded retry count of 10. Failed

I am consistently getting this error with VS 2013: > Could not copy "C:\pagefile.sys" to "bin\roslyn\pagefile.sys". Exceeded retry count of 10. Failed. Unable to copy file "C:\pagefile.sys" to "b...

How to properly apply a lambda function into a pandas data frame column

I have a pandas data frame, `sample`, with one of the columns called `PR` to which am applying a lambda function as follows: ``` sample['PR'] = sample['PR'].apply(lambda x: NaN if x < 90) ``` I the...

25 May at 05:6

Check if variable exist in laravel's blade directive

I'm trying to create blade directive which echo variable (if variable defined) or echo "no data" if variable undefined. This is my code in `AppServiceProvider.php`: ``` <?php namespace App\Provider...

Unreported exception java.lang.Exception; must be caught or declared to be thrown

I tried compiling the below but get the following around m16h(x): ``` Line: 16 unreported exception java.lang.Exception; must be caught or declared to be thrown ``` Not sure why though. I've tried ...

25 May at 11:55

Why do I have to place () around null-conditional expression to use the correct method overload?

I have these extension methods and enum type: ``` public static bool IsOneOf<T>(this T thing, params T[] things) { return things.Contains(thing); } public static bool IsOneOf<T>(this T? thing, p...

24 May at 21:3

Moq Expression with Constraint ... It.Is<Expression<Func<T, bool>>>

Ok, I am having a hard time trying to figure out how to setup a moq for a method that takes in an expression. There are a lot of examples out there of how to to It.IsAny<>... that is not what I am aft...

25 May at 18:29

If async-await doesn't create any additional threads, then how does it make applications responsive?

Time and time again, I see it said that using `async`-`await` doesn't create any additional threads. That doesn't make sense because the only ways that a computer can appear to be doing more than 1 th...

readFileSync is not a function

I am relatively new to Node.js and have been looking around but cannot find a solution. I did check the require javascript file and it does not seem to have a method for "readFileSync". Perhaps I don'...

1 Jul at 10:6

Height of Windows in WPF Application when Touch Keyboard appears

I'm in the process of writing an 'touch-able' WPF Application for Windows 10. Imagine a window containing the following grid: ``` <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"...

13 May at 19:40

How do I join 2 tables in ServiceStack OrmLite and select both classes?

I'd like to do a simple SQL join in ServiceStack OrmLite and get both tables as the corresponding .NET objects. In LINQ-to-Entities it would be something like this: ``` Claim.Join(Policy, c => c.Pol...

7 Jul at 13:44

Error: Node Sass does not yet support your current environment: Windows 64-bit with false

``` E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj>ionic serve -l (node:4772) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs...

30 Dec at 18:14

Is there a YSOD in ServiceStack for Unhandled Exceptions?

Is there a built-in renderer for unhandled exceptions when using the RazorFormat plugin? Our service is throwing an exception, but ServiceStack is rendering the corresponding Razor view anyway (just ...

24 May at 14:13

Add a PDF viewer to a WPF application

I am new to WPF, and am trying to add a PDF viewer to my WPF application, but can't seem to work out how to do it... I have tried following a couple of tutorials/ examples that I have found online, bu...

20 Jun at 09:12

Xamarin Android how to get Java class name for passing into ComponentName

I need the Java class's name in the Constructor for `Android.Content.ComponentName` as Xamarin doesn't have an overloaded constructor that takes `typeof(ClrType)` like it does for some other things.

24 May at 12:55

Send push to Android by C# using FCM (Firebase Cloud Messaging)

I am using this code to send notification message by C# with GCM, using Winforms, Webforms, whatever. Now I want to send to FCM (Firebase Cloud Messaging). Should I update my code? : ``` public class...

24 May at 12:0

How to Subscribe with async method in Rx?

I have following code: ``` IObservable<Data> _source; ... _source.Subscribe(StoreToDatabase); private async Task StoreToDatabase(Data data) { await dbstuff(data); } ``` However, this does no...

23 May at 12:24

Change Spinner dropdown icon

The solutions I found to change the spinner dropdown icon where all: ``` <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android...

1 Aug at 23:37

"The located assembly's manifest definition does not match the assembly reference"

I have deployed an .NET WebAPI app (compiled against .NET 4.5.2, and running locally) into an Azure App Service. The error thrown there is > Could not load file or assembly 'System.Web.Mvc, Version...

How to use ServiceStack OrmLite Sql.Count

I'm trying to use the Sql.Count, the compiler raised a type issue: it returns the result with type T, but I want an int or long type. ``` var UsedTimesCount = conn.Scalar<AgencyFee,int>( f => Sq...

24 May at 19:4

How to implement the field decimal(5,2) in EntityFrameworkCore 1.0 rc2?

How to implement the field `decimal(5,2)` in `EntityFrameworkCore 1.0 rc2` ? `HasPrecision` seems to be not available anymore?

23 May at 21:25