Browsing 7239 questions and answers with Jon Skeet

Language code detection of spoken language in Google Speech API

Is there an option to automatically detect the spoken language using Google Cloud Platform Machine Learning's Speech API? https://cloud.google.com/speech/docs/languages indicates...
Jon Skeet
people
quotationmark

No, I believe you (at least currently) have to specify the input language. (Unlike the Translation API where you can let it auto-detect, for example.) more 7/4/2017 8:15:15 AM

people

Sort list while in a loop using groupby

I have a loop with linq like this: foreach (var group in part.Profiles.Skip(ixstart). GroupBy(b => new { b.Number, b.X }). OrderBy(g =>...
Jon Skeet
people
quotationmark

I suspect it turns out to be safe because GroupBy doesn't stream results - it consumes all of the input before it returns any values. (It's lazy in that it doesn't do any work until you ask it for its first element, but then it consumes... more 7/4/2017 8:05:22 AM

people

DateTime in Microseconds

Is datetime values with microseconds are converted into double with exact precision? For eg. i have date as 3 July 2017 10:00:00 00 Ticks 636346728000000050. which converted into...
Jon Skeet
people
quotationmark

There are two separate logical operations here: Converting from ticks to microseconds. This is basically a matter of dividing by 10 (there are 100 nanoseconds or 0.1 microseconds in each tick), so that can lose information already in... more 7/3/2017 8:26:19 AM

people

unsigned bytes in Java byte array

This may seem like an easy question, but I'm so confused. byte[] bArray = new byte[]{(byte) (0x80 & 0xff)}; System.out.println(bArray[0]); and my output is -128. Why? How...
Jon Skeet
people
quotationmark

I thought that the 0xff made it unsigned. Well, it does, sort of - it promotes it to an int, and keeps just the last 8 bits. However, you're then casting the result of that back to a byte, and a byte in Java is always signed. (It's... more 6/29/2017 7:37:33 PM

people

Unable to run Google Cloud PubSub in c#, DLL problems

I am working on integrating Google Cloud PubSub into my c# project, I used NuGet to install 1.0.0-beta11, no errors at all. When I run my project and when it reaches the code...
Jon Skeet
people
quotationmark

Okay, I've found the reference to Google.Apis.Auth 1.21.0 - it's in the Grpc.Auth NuGet package. If you just add a reference to the Grpc.Auth DLL, you'll get this kind of failure - but if you manage all the dependencies via NuGet, I'd... more 6/29/2017 2:44:26 PM

people

How to work Google Vision Api with Php library by using uri?

I am working on Google Vision Api and I know how to send a request by using any image uri below. `{ "requests":[ { "image":{ "source":{ ...
Jon Skeet
people
quotationmark

Looking at the Image code I believe you should just be able to pass in the URI as a string: $uri = "https://fallaviblob.blob.core.windows.net/createdblobs/20170601_191635_237.png" $image = $vision->image($uri, ['LABEL_DETECTION',... more 6/28/2017 6:05:41 AM

people

c# check enum is contained in options

I'm trying to check if an enum option is contained in the available options. Its a little bit difficult for me to explain it in english. Here's the code: public enum Fruits { ...
Jon Skeet
people
quotationmark

The simplest way is to use &: if ((available & me) != 0) You can use 0 here as there's an implicit conversion from the constant 0 to any enum, which is very handy. Note that your enum should be defined using the Flags attribute... more 6/27/2017 8:38:31 AM

people

Difference between associative and commutative

I am trying to understand associative in monoid. From the book, it says: Associativity simply says that you can associate the arguments of your operation differently and...
Jon Skeet
people
quotationmark

Take string concatenation as an example. Suppose you're using a language which uses + for string concatenation. That's naturally associative, as the grouping doesn't matter: ("a" + "b") + "c" == "abc" "a" + ("b" + "c") == "abc" But the... more 6/26/2017 12:18:44 PM

people

empty get in expression bodied syntax?

Is it possible to write this property: string Error { get; } in expression bodied syntax (=>), for example: string Title { get { return title; ...
Jon Skeet
people
quotationmark

No, because this: string Error { get; } ... is an automatically-implemented property. The compiler is generating a field for you behind the scenes, but you can't refer to that field within the code. If you need to use the backing field,... more 6/26/2017 9:43:53 AM

people

Why UTC (which is not a time zone) is considered as a time zone in Java (and not only there)?

Given that UTC is not a time zone, but a time standard (as stated, for example, here), why in my Java application I can use UTC as if it was a time zone (see the code snippet...
Jon Skeet
people
quotationmark

Because it makes life much, much simpler to regard UTC as a time zone than to treat it as something else, basically. It's one of those "Yeah, strictly speaking it's not" scenarios. For everything except "Which region of the world is this... more 6/26/2017 9:18:21 AM

people