Browsing 7239 questions and answers with Jon Skeet

How to format nodatime date string globally in asp.net core 2.1?

Currently I am trying to use the JsonFormatters for serializing string in ISO 8601 spec. format in my start up config. but could not get it to work. my Startup Config is as...
Jon Skeet
people
quotationmark

This is the problem, in your controller: res.NodaLocalDateString = apiResource.NodaLocalDate = nodaModel.NodaLocalDate.ToString (); You're not converting a LocalDate into JSON at all; you're converting a string into JSON, and you're... more 6/7/2018 10:39:30 AM

people

Trying detect image Values using Google Cloud Vision using c# asp.net c#

Trying detect image Values using Google Cloud Vision using c# asp.net c# but i am getting below error. Error loading native library. Not found in any of the possible locations:...
Jon Skeet
people
quotationmark

This error isn't really about the Vision API, or authentication - it's due to gRPC not loading properly. It sounds like you're using a "Web Site" project rather than a "Web Application" project. This is a known issue - there's a workaround... more 6/6/2018 8:28:02 AM

people

How to get a DateTimeOffset having local time information

I have these input strings: var timeStr = "03:22"; var dateStr = "2018/01/12"; var format = "yyyy/MM/dd"; var timeZone = "Asia/Tehran"; This is the information of a time that I...
Jon Skeet
people
quotationmark

Let's convert all your information into appropriate Noda Time types: // Input values (as per the question) var timeStr = "03:22"; var dateStr = "2018/01/12"; var format = "yyyy/MM/dd"; var timeZone = "Asia/Tehran"; // The patterns we'll... more 5/30/2018 11:14:43 AM

people

Though variables have been initialized I get might not have been initialized error

I am having problem with the following code in an android app that I am developing. Now even though I have initialized the variables I am getting the error variable might not have...
Jon Skeet
people
quotationmark

Now even though I have initialized the variables You haven't though - not necessarily. Suppose the new SimpleSpkDetSystem(...) call throws an AlizeException. You're catching that exception and continuing - but you won't have assigned... more 5/30/2018 8:58:01 AM

people

How to differentiate whether the code is running in an emulator or in GKE when working with GCP's Datastore

I am not sure whether I am missing any, after following the instructions given in https://cloud.google.com/datastore/docs/tools/datastore-emulator I was not able to connect to...
Jon Skeet
people
quotationmark

You can use the Platform class in the Google.Api.Gax namespace (in the Google.Api.Gax package): Platform platform = Platform.Instance(); switch (platform.Type) { case PlatformType.Gae: // Code for AppEngine break; ... more 5/29/2018 9:44:07 PM

people

Choosing the right version of GCP''s Datastore library for .Net Core

For GCP's Datastore I see two versions of Nuget, not sure what are the difference between, and which one to use when working with .Net Core...
Jon Skeet
people
quotationmark

Disclaimer/authority: I'm the primary author of Google.Cloud.Datastore.V1, and I'm responsible for the Google Cloud Client Libraries for .NET. So I know what I'm talking about here, but I do have biases :) You should really be picking... more 5/29/2018 5:40:44 AM

people

Inheritance of constructors in java

Whenever any constructor is called in any derived class the task gets accomplished only by eventually calling the base class constructor implicitly or explicitly (correct me if I...
Jon Skeet
people
quotationmark

Don't think of the constructor as creating the instance. Think of it as initializing the instance, with respect to that particular class. So the initialization process looks something like: Allocate memory Initialize object from... more 5/20/2018 2:07:38 PM

people

Replace the ' by \'

I'm trying to replace a single quote ' with this character \', the final goal is to transform this chay'ekka to chay\'ekka. I tried this code: String cityName = new...
Jon Skeet
people
quotationmark

You're using replaceAll, which works with regular expressions. While you can fix that by doubling the backslashes, there's no indication that you want regular expressions at all. It would be simpler just to call String.replace instead, as... more 5/17/2018 2:06:29 PM

people

C# Addition between objects that are numbers

I'm trying to find the best way to do following: I have two Objects, object A and B. At some point in the program I know A and B are of type int, double or float. I would like to...
Jon Skeet
people
quotationmark

The closest you can come is: dynamic a = ...; dynamic b = ...; dynamic c = a + b; That will perform the appropriate kind of addition, but you won't know the type of the result until execution time. more 5/14/2018 12:44:08 PM

people

Idempotency for BigQuery load jobs using Google.Cloud.BigQuery.V2

You are able to create a csv load job to load data from a csv file in Google Cloud Storage by using the BigQueryClient in Google.Cloud.BigQuery.V2 which has a CreateLoadJob...
Jon Skeet
people
quotationmark

There are two places you could end up losing the response: When creating the job to start with When polling for completion The first one is relatively tricky to recover from without a job ID; you could list all the jobs in the project... more 5/14/2018 10:14:21 AM

people