Questions

MongoDB: exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating

I created `/data/db` in root directory and ran `./mongod`: ``` [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating [initandl...

23 Jun at 16:38

netcoreapp2.0 with netstandard2.0

I have a project(x) that targets the NetStandard.Library 2.0 and a console app that targets netcoreapp2.0. ``` <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2...

10 Jan at 13:45

Looping through a JSON array in Python

I have the following data taken from an API. I am trying to access the restaurant name using a Python script and have the script display it. Here are my files: test.py ``` with open('data.json') as ...

8 Jun at 14:3

ShowBalloonTip Not Working

On Windows 10, the `ShowBalloonTip` method of `NotifyIcon` NEVER shows the balloon tip. This would appear to have something to do with Windows itself. If I go to `Settings > System > Notifications & ...

24 Feb at 17:14

OnActionExecuted get status code

Is there a way to get the HTTP status code from MVC action from `OnActionExecuted`, without using the session variables?

24 Feb at 16:54

Keras split train test set when using ImageDataGenerator

I have a single directory which contains sub-folders (according to labels) of images. I want to split this data into train and test set while using ImageDataGenerator in Keras. Although model.fit() in...

C# Linq aggregate intermediate values

Given an array of positive and negative numbers is there a Linq expression that can get intermediate values? for example ``` var heights = new List<int>(); var numbers = new [] { 5, 15, -5, -15 ...

3 Oct at 13:31

Bootstrap col align right

I'm trying to create a row with 2 cols. One col on the left with its contents aligned left, and the second col with its contents aligned right (old pull-right). How to do I go about this in alpha-6? ...

escape for "{" inside C# 6 string interpolation

I am hoping to use a "{" inside a string interpolation statement but I'm having trouble finding the escape character to do it. ``` var val = "ERROR_STATE"; var str = $"if(inErrorState){ send 1,\"{val...

24 Feb at 13:32

ServiceStack session info error

The incorrect ВisplayName through the entrance on Facebook: [](https://i.stack.imgur.com/BUwZH.png) any ideas how to fix without changing native SS code? ) PS:if sign in with Google all the rules.....

24 Feb at 13:12

Why the size of struct A is not equal size of struct B with same fields?

Why the size of `struct A` is not equal size of `struct B`? And what I need to do, they will the same size? ``` using System; namespace ConsoleApplication1 { class Program { struct ...

24 Feb at 16:46

How to adjust height of UICollectionView to be the height of the content size of the UICollectionView?

I would like the UICollectionView (The red one) to shrink to the height of the content size in this case UICollectionViewCells(the yellow ones) because there is a lot of empty space. What I tried is t...

How can I return asQueryable without LoadSelect?

I'm using lastest ServiceStack OrmLite(currently v4.5.6) with C# I need to return asQueryable from a method, such as; ``` using (IDbConnection databaseConnection = _databaseFactory.Open()) { ...

23 Mar at 20:25

DateTime.Now in XAML without binding

Can I put the date of today in a label without binding it in XAML, something like ``` <Label Text="DateTime.Now, StringFormat='{0:MMMM dd, yyyy}'"/> ```

5 Jun at 15:8

Line chart generated image that will be sent through email

I want to create a line chart similar below: [](https://i.stack.imgur.com/Eh5xT.png) I just wonder if there are available framework or API available in ASP.NET MVC that generates chart images since ...

TypeInfo.IsAssignableFrom in Roslyn analyzer

In my Roslyn analyzer I get `Microsoft.CodeAnalysis.TypeInfo` of an argument by ``` var argumentTypeInfo = semanticModel.GetTypeInfo(argumentSyntax.Expression); ``` also I have another instance of ...

Progress Bar not available for zipfile? How to give feedback when program seems to hang

I am fairly new to C# and coding in general so some of this might be going about things the wrong way. The program I wrote works and compresses the file as expected, but if the source is rather large,...

5 May at 17:46

better way to store long SQL strings in C#

I have searched around for a while for this and have not found anything. I am storing some pretty long SQL select strings (a shorter one like this:) ``` string mySelectQuery = "select distribution_s...

24 Feb at 11:9

Set Caret/Cursor Position in RichTextBox - WPF

How to set caret/cursor position in RichTextBox in WPF? I use the code in [MSDN CaretPosition](https://msdn.microsoft.com/zh-tw/library/system.windows.controls.richtextbox.caretposition(v=vs.110).asp...

24 Feb at 02:52

Transitive references in .Net Core 1.1

While developing a sample web app in .NET Core 1.1 and Visual Studio 2017 RC, I realized the following: [](https://i.stack.imgur.com/y71Ca.png) As you can see: - - I wrote a simple method in clas...

Cannot invoke an expression whose type lacks a call signature

I have apple and pears - both have an `isDecayed` attribute: ``` interface Apple { color: string; isDecayed: boolean; } interface Pear { weight: number; isDecayed: boolean; } ``` A...

27 Feb at 13:59

How can I generate a cryptographically secure random integer within a range?

I have to generate a uniform, secure random integer within a given range for a program that generates passwords. Right now I use this: ``` RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider()...

21 Sep at 06:46

Getting the Arizona Standard Time in .net

I have an application in which time zones are treated as string, by using the system name so we can make an actual `System.TimeZoneInfo` object by doing: ``` var tz = TimeZoneInfo.FindSystemTimeZoneB...

23 Feb at 19:46

.Net DownloadFileTaskAsync robust WPF code

The WPF code below hangs forever when network connection is lost for 3 or more minutes. When connection is restored it neither throws nor continues downloading nor timeouts. If network connection is l...

3 Mar at 07:26

Default password of mysql in ubuntu server 16.04

I have installed ubuntu 16.04 server. Mysql server was installed by default in it. When I am trying to access the mysql with `mysql -u root -p`, I am unable to log in to mysql because I dont have the ...