Questions

How can I validate a JWT passed via cookies?

The `UseJwtBearerAuthentication` middleware in ASP.NET Core makes it easy to validate incoming JSON Web Tokens in `Authorization` headers. How do I authenticate a JWT passed via cookies, instead of ...

17 Jan at 19:47

EF7 Migrations - The corresponding CLR type for entity type '' is not instantiable

I'm trying to use EF7 migrations and got stuck when I modeled an `Organization` model with inheritance. `Organization` is an abstract class. There are two concrete classes that inherit from it called...

Get GraphQL whole schema query

I want to get the schema from the server. I can get all entities with the types but I'm unable to get the properties. Getting all types: ``` query { __schema { queryType { fields { ...

23 May at 18:19

Using ServiceStack Autoquery With Value Types that don't implement IConvertible

I was trying to use [AutoQuery](https://github.com/ServiceStack/ServiceStack/wiki/Auto-Query) with a `NodaTime.LocalDate` on a query parameter and I get the following exception when I try to filter us...

Simple token based authentication/authorization in asp.net core for Mongodb datastore

I need to implement pretty simple auth mechanizm with basically 2 roles: `Owners` and `Users`. And I think that having Enum for that will be enough. App itself is SPA with webapi implemented via Asp.n...

finding first day of the month in python

I'm trying to find the first day of the month in python with one condition: if my current date passed the 25th of the month, then the first date variable will hold the first date of the next month ins...

13 Dec at 09:47

How to hide a mobile browser's address bar?

Safari and Chrome on mobile devices both include a visible address bar when a page loads. As the `body` of the page scrolls, these browsers will scroll the address bar off screen to give more real est...

Add Response Headers to ASP.NET Core Middleware

I want to add a processing time middleware to my ASP.NET Core WebApi like this ``` public class ProcessingTimeMiddleware { private readonly RequestDelegate _next; public ProcessingTimeMidd...

23 May at 16:1

Which is the best way to add a retry/rollback mechanism for sync/async tasks in C#?

Imagine of a WebForms application where there is a main method named CreateAll(). I can describe the process of the method tasks step by step as follows: 1) Stores to database (Update/Create Db items...

26 May at 06:45

Why does a dynamic parameter in a generic method throw a null reference exception when using an Object?

I wonder if someone could explain why in this code ``` public class SomeClass { public T GenericMethod<T>(dynamic value) { return (T)value; } } ``` the 'return value;' statement...

24 May at 07:6

c# how Delete AM/PM from Date

I want to get Date Time of today without having "AM/PM" DateTime dt=DateTime.Now; gives me > 23/05/2016 03:16:51 AM I want the result be : > 23/05/2016 15:16:51

5 May at 15:3

Getter without body, Setter with

I have a property which is currently automatic. ``` public string MyProperty { get; set; } ``` However, I now need it to perform some action every time it changes, so I want to add logic to the set...

23 May at 13:25

Missing events using IServerEvents.NotifyChannel

I'm trying to send messages using Server Sent Events to JS clients. The client gets only every 6th or 7th event. What am I doing wrong? The behavior can be reproduced using a simple standalone sample...

23 May at 12:7

JPA Hibernate Persistence exception [PersistenceUnit: default] Unable to build Hibernate SessionFactory

I've been trying to sort out a connection to my DB with JPA Hibernate and mysql, but for some reason, no matter what i try, when launching the tomcat server i get the same exception: ``` org.springfr...

23 May at 10:37

Page loaded over HTTPS but requested an insecure XMLHttpRequest endpoint

I have a page with some D3 javascript on. This page sits within a HTTPS website, but the certificate is self-signed. When I load the page, my D3 visualisations do not show, and I get the error: > Mi...

ReactJS: Warning: setState(...): Cannot update during an existing state transition

I am trying to refactor the following code from my render view: ``` <Button href="#" active={!this.state.singleJourney} onClick={this.handleButtonChange.bind(this,false)} >Retour</Button> ``` to a ...

23 May at 09:29

Read environment variables in ASP.NET Core

Running my ASP.NET Core application using [DNX](https://stackoverflow.com/questions/30374725/is-net-execution-environment-dnx-similar-to-mono), I was able to set environment variables from the command...

Jenkins "Console Output" log location in filesystem

I want to access and grep Jenkins Console Output as a post build step in the same job that creates this output. Redirecting logs with `>> log.txt` is not a solution since this is not supported by my b...

23 May at 08:51

What does flex: 1 mean?

As we all know, the `flex` property is a shorthand for the `flex-grow`, `flex-shrink`, and the `flex-basis` properties. Its default value is `0 1 auto`, which means ``` flex-grow: 0; flex-shrink: 1; ...

31 May at 02:50

Difference between DbTransaction and DbContextTransaction?

When `EntityFramework` query was wrapped in `DbContextTransaction` created with `dbContext.Database.BeginTransaction()` method I've got the following error: > at NMemory.Transactions.Transaction.Ensu...

23 May at 08:20

Filter and delete filtered elements in an array

I want to remove specific elements in the original array (which is `var a`). I `filter()` that array and `splice()` returned new array. but that doesn't affect the original array in this code. How can...

4 Apr at 19:15

TensorFlow, "'module' object has no attribute 'placeholder'"

I've been trying to use tensorflow for two days now installing and reinstalling it over and over again in python2.7 and 3.4. No matter what I do, I get this error message when trying to use tensorflo...

23 May at 06:24

Can't compile SocialBootstrapApi

I downloaded the SocialBootstrapApi from GitHub but I can't run the example. When I try to run it I get: ``` Severity Code Description Project File Line Suppression State Error CS0234 The type or nam...

22 May at 23:15

HttpClient keeps receiving bad request

I'm having a hard time resolving my Bad Request responses from a REST api when I'm creating a client using C#. I tested the REST api using Fiddler 2 and executing it there, but when I'm creating the ...

22 May at 22:30

ServiceStack, authentication and passing session header with request

I need to validate a user against an application with custom UserName and Password. The credentials are compared with those in database and then the user can be authorized. I configured my adding t...

22 May at 21:18