Browsing 15711 questions and answers with Jon Skeet

Got an Exception, while reading the google spread sheet

I am beginner to read the google spread using service account in my project .For few days it work fine but now i got an exception as ...
Jon Skeet
people
quotationmark

Okay, I have an alternative solution. It doesn't explain exactly why things are going wrong, but it means you don't need to make the call at all. As you've already managed to call GetRSAPrivateKey() successfully, that may be all you need.... more 5/25/2017 7:02:57 AM

people

.net core / standard string.ToLower() has no culture parameter

In .net fx i can do myString.ToLower(frenchCulture); But when looking at .net core or .net standard there is no more a culture parameter that can be passed. There is only...
Jon Skeet
people
quotationmark

It looks like the capability is there, just in a more roundabout way. Instead of: string output = input.ToLower(culture); use string output = culture.TextInfo.ToLower(input); Also note that the overload has been added in... more 5/24/2017 10:51:16 AM

people

Parsing Json to zoned date time

Im reciving following json time format "TimeEnd": "2017-05-24 09:52:51+02:00" my dto is as follows: @JsonProperty("TimeEnd") @JsonDeserialize(using =...
Jon Skeet
people
quotationmark

You shouldn't be trying to parse it as a ZonedDateTime, as it really doesn't have a time zone - it has a UTC offset. OffsetDateTime is more appropriate here. It's worth differentiating between the two types - you can create a ZonedDateTime... more 5/24/2017 10:24:38 AM

people

In java.time.Period class, what are the purposes of withDays(), withMonths(), withYears()

I noticed that the java.time.Period class contains a few instance methods that behave the same as the available static factory methods. .withDays() behaves the same as...
Jon Skeet
people
quotationmark

You made an unfortunate choice to test with, basically - "weeks" isn't an independent unit; it's just a shorthand for 7 days. From the docs for ofWeeks: The resulting period will be day-based, with the amount of days equal to the... more 5/24/2017 10:06:48 AM

people

Java main method not found error on Windows 10 even with correct main signature

I have a couple of Java files A.java and B.java that use a common jar file C.jar. B.java contains reference variables to the object of type A. B.java contains the main method I...
Jon Skeet
people
quotationmark

Am I making some mistake in my commands? Yes - you're not including anything apart from C.jar when trying to run. Use java -cp C.jar;. // Windows java -cp C.jar:. // Unix So that you're including the current directory (which is... more 5/24/2017 7:46:34 AM

people

how to convert optional parameter method to delegate in c#

i have a casting problem. public void Test(int a = 0) { } System.Action d = Test; this code works well in unity 5. but visual studio 2015 can't compile it. CS0123 No...
Jon Skeet
people
quotationmark

I'm surprised it works in Unity - it shouldn't. That sounds like a Mono compiler bug. The C# 5 specification isn't as clear on this as it should be, but from the draft of the upcoming ECMA C# 5 standard, from the clause on method group... more 5/24/2017 6:06:34 AM

people

Java Regex to replace Octal value in string

I have set of octal values say (0177-0377). whenever these value I found in string, have to replace with ?. String a= "sccce¼»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕerferferfer"; for...
Jon Skeet
people
quotationmark

You don't want to do this to the whole file in one go - you need a streaming approach. I'd do something like this: // TODO: Rename to something more appropriate public static void replaceInvalidCharacters(Reader reader, Writer writer) { ... more 5/23/2017 1:33:50 PM

people

How to convert the Date format and store it in a Date field(not in string or println) with the new format in Java

I'm trying to get the date from an object and changing the format and down the line I need to use the date value as a date field itself(not as string). The format is getting...
Jon Skeet
people
quotationmark

A Date object doesn't have any state representing a format. It's just an instant in time. If you've got the right value in date1, then formatting and parsing it is completely pointless. Instead, when you want the Date in a particular... more 5/23/2017 12:25:55 PM

people

Json.Net deserialize JSON string inside a string

This sound very simple. But I can't find how to do it. I've receiving a bad json from an api. the actual json is inside a string Instead of...
Jon Skeet
people
quotationmark

If you've got a value which is "a string serialized as JSON", then just deserialize that first. Assuming your string genuinely starts and ends with a double quote, you should be fine to call JsonConvert.DeserializeObject<string> to... more 5/23/2017 11:01:22 AM

people

Escape XML using stringutils commons.lang version3 apply on writer

In the older version of "org.apache.commons.lang"(2.6) StringEscapeUtils, there is a method to escapexml by passing an instance of "java.io.Writer" as one of the parameter. eg:...
Jon Skeet
people
quotationmark

All the overloads accepting a Writer have been removed - but instead, CharSequenceTranslator instances are available, so you could write: StringEscapeUtils.ESCAPE_XML10.translate(input, writer); (Personally I'd strongly recommend using... more 5/23/2017 7:31:10 AM

people