Property initialization using "by lazy" vs. "lateinit"

In Kotlin, if you don't want to initialize a class property inside the constructor or in the top of the class body, you have basically these two options (from the language reference): 1. Lazy Initial...

3 Oct at 10:44

How to ensure that ServiceStack always returns JSON?

We have decided to only allow requests with a Content-Type header "application/json". So, whenever we receive a request with an alternative or missing Content-Type header, we throw an HttpError. This ...

14 Apr at 12:9

Why WorkflowInvoker exception is not returning filename and line number in stacktrace

I am using the WorkflowInvoker in my application. if any exception occurred, in StackTrace i am not getting the proper file name and line number.`do i need to include any logic? ``` try { ...

How to divide two columns element-wise in a pandas dataframe

I have two columns in my pandas dataframe. I'd like to divide column `A` by column `B`, value by value, and show it as follows: ``` import pandas as pd csv1 = pd.read_csv('auto$0$0.csv') csv2 = pd.re...

22 Jan at 10:47

How do I add a new line to a richtextbox without making the last line blank?

I'm making a log system for a program im creating and I currently have it to where it does this: ``` void outToLog(string output) { logRichTextBox.AppendText(output + "\r\n"); logRichTextBox....

28 May at 13:52

Contract that ensures the IEnumerable is not empty

The given code ``` static public int Q() { return Enumerable.Range(0, 100) .Select(i => i) .First(); } ``` emits the following warning: ``` warning : CodeContracts: requires un...

Mockito : doAnswer Vs thenReturn

I am using Mockito for service later unit testing. I am confused when to use `doAnswer` vs `thenReturn`. Can anyone help me in detail? So far, I have tried it with `thenReturn`.

15 Dec at 06:44

How to implement Ads in Desktop Application built with WPF or Windows Forms?

I would like to implement like as it comes in Utorrent/Skype. I looked forward to lot of options. Here is the list: - - - - - Thought of using Google Adsense by implementing in Website and fetchin...

23 May at 12:7

C# List<object> to Dictionary<key, <object>>

I am a beginner c# developer and I need to create a dictionary of object from my list. First, let me define my object as Person. ``` public class Person { public int Id { get; set; } public ...

14 Apr at 01:36

Custom Route for ServiceStack Razor Content Pages

I have the following content page: `/folder/_new.cshtml` My intention is to have the page accessible through the following url: `/folder/_new` However it seems that such file name is not mapped to t...

14 Apr at 01:1

SQL write to ASP.NET user table doesn't save

My setup: - - When a user first signs up, I show them a "getting started intro". The intro is only supposed to run once - I log the timestamp of the intro launch date as a custom field in the ASP.N...

How to label scatterplot points by name?

I am trying to figure out how to get labels to show on either Google sheets, Excel, or Numbers. I have information that looks like this ``` name|x_val|y_val ---------------- a | 1| 1 b | ...

14 Apr at 08:3

How do I view the metaproj files generated by Visual Studio when building an ASP.NET website?

I have a fairly large solution with a mix of assemblies and ASP.NET websites (the ones without a csproj file). I'm trying to customize the build from the command line, and so I need to understand what...

13 Apr at 19:14

CGPDFDocument unable to read pdf

I followed the following example to view a [pdf in my App](https://github.com/vfr/Viewer) (Xamarin.iOS). Everything worked fine until recently I started to notice some pdf files can't be read using th...

14 Apr at 15:42

C# check object type against multiple types

IS there a way to pass an array of types to the "is" operator? I am trying to simplify the syntax of checking an object against multiple types. Something like: ``` public static function bool IsOfT...

13 Apr at 16:19

Include collection in Entity Framework Core

For example, I have those entities: ``` public class Book { [Key] public string BookId { get; set; } public List<BookPage> Pages { get; set; } public string Text { get; set; } } pub...

Copy blob between storage accounts

I'm trying to copy a blob from one storage account to another (In a different location). I'm using the following code: ``` var sourceContainer = sourceClient.GetContainerReference(containerId); var ...

13 Apr at 13:21

How do I correctly upgrade angular 2 (npm) to the latest version?

Recently I started Angular 2 tutorial at [https://angular.io/docs/ts/latest/tutorial/](https://angular.io/docs/ts/latest/tutorial/). and left off with Angular 2 beta 8. Now I resumed the tutorial and...

19 Sep at 06:3

Unable use PooledRedisClientManager

I'm using Visual Studio 2015 but am unable to resolve `PooledRedisClientManager` in AppHost. Can anybody tell what the problem is? > ERROR : The type or namespace name 'PooledRedisClientManager' cou...

String interpolation in C# 6 and overridden ToString()

Given the following classes: ``` public abstract class ValueBase { public new abstract string ToString(); } public class EmailAddress : ValueBase { public MailAddress MailAddress { get; } ...

13 Apr at 09:12

Why is the enumeration value from a multi dimensional array not equal to itself?

Consider: ``` using System; public class Test { enum State : sbyte { OK = 0, BUG = -1 } static void Main(string[] args) { var s = new State[1, 1]; s[0, 0] = State.BUG; ...

ServiceStack.LicenseException with a valid License Key

I am trying to register the license key by the Application_Start method. When I execute Licensing.RegisterLicense("{LicenseKey}"), the method LicenseUtils.ActivatedLicenseFeatures() returns the value ...

13 Apr at 02:5

How to remove Authentication-related routes from ServiceStack Metadata Plugins?

Is there a way to remove authentication related routes (/auth, /assignroles, /authenticate) from ServiceStack metadata plugins (e.g. swagger and postman)?

12 Apr at 18:45

How to configure NLog to only log from a certain level for a logger namespace for *all* targets

I have the following loggers configured. ``` <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <targets> <target name="file" xsi:t...

9 Nov at 00:18

Run NUnit tests in .NET Core

I am trying to run unit tests for my C# project with .NET Core. I am using a [Docker](https://en.wikipedia.org/wiki/Docker_%28software%29) container for the runtime. Dockerfile ``` FROM microsoft/do...