Google Text to Speech Cloud service javascript - google-cloud-platform

I am looking for a guide on how to use google text to speech service in Java script. Currently I am using this:
var src = "https://translate.google.com/translate_tts?key='+key +'8&total=1&idx=0&textlen=32&client=tw-ob&q=" + encodeURIComponent(txt) + "&tl=" + language;
console.log(src)
var vid = $('#Audio');
vid.get(0).pause();
$('#Audio').attr('src', src);
vid.get(0).load();
vid.get(0).play();
The main issue is that this code is not stable. Sometimes it returns empty audio and sometimes it works for same request.

It seems this service is not added to google-cloud-platform. It was before under google translate but not anymore. using the link in the question will work if there is user interaction , like pressing a button,. However,calling it dynamically in the code without user interaction will result in an empty audio file. It looks like someway from google to prevent denial of service attack. I ended up using speechSynthesis for languages which are supported in speechSynthesis and third party products for other languages such as Arabic.

Related

problem with google speech to text model adaptation

i have a problem with model adaptation in Cloud console.
when i use Phrase with custom class,i do something like this:
i got this error,but i can't set or get customClassId in Cloud console,just customClassName,but is't wrong when i use it
in this code,request body has a customClassId.
how to set the customClassId in Cloud console?

Double values returned from REST API JSON different from the call made from Python app engine application

I am using Google REST API to collect metrics like CPU utilization for instances in a project from a Google App Engine built in Python 2.7, standard env. The implementation is based on this code given by Google:
https://github.com/GoogleCloudPlatform/stackdriver-metrics-export
The app engine code to collect CPU utilization metrics is like this:
from googleapiclient.discovery import build
service = build('monitoring', 'v3', cache_discovery=True)
timeseries = service.projects().timeSeries().list(
name="my-project",
filter="metric.type=compute.googleapis.com/instance/cpu/utilization"
aggregation_alignmentPeriod=86400s,
aggregation_perSeriesAligner="ALIGN_MEAN",
aggregation_groupByFields="metric.labels.key",
interval_endTime="2020-08-23T17:30:04.707Z",
interval_startTime="2020-08-22T17:30:05.603000Z",
pageSize=100
).execute()
It forms a REST API like this
https://monitoring.googleapis.com/v3/projects/my-project/timeSeries?pageSize=500&interval.startTime=2020-08-22T17%3A30%3A05.603000Z&aggregation.alignmentPeriod=86400s&aggregation.perSeriesAligner=ALIGN_MEAN&filter=metric.type%3D%22compute.googleapis.com%2Finstance%2Fcpu%2Futilization%22+&pageToken=&interval.endTime=2020-08-23T17%3A30%3A04.707Z&alt=json&aggregation.groupByFields=metric.labels.key
If I try the REST API in a tool like Postman or if I try the Python code directly in shell editor, I get the metrics value in JSON format for Postman and Unicode format for shell editor which is the correct one:
"value": {
"doubleValue": 0.87114489514772131
}
But when the same code is executed from the Python based Google App Engine application the response contained in the timeseries variable is returning a value in Unicode format which has a difference.
"value": {
"doubleValue": 0.8709659701719485
}
Update
This is happening for almost all metrics values of most instances.
The double values from the REST API are coming in JSON format, whereas the values called from app engine are coming in Unicode format and also in cloud shell editor they are coming in Unicode format but they are matching with the REST API values
I am new to Google App Engine and Python 2.7.

google cloud billing API: not able to update billing info

I am trying to learn how to use the cloud billing API and playing around with it's methods. I copied a code snippet in Java that shows how to use the updateBillingInfo method. I have a project in my cloud account, and it has a billing account associated with it, and I wanted to change it to a different billing account.
Here's what I tried:
String name = "projects/My project";
ProjectBillingInfo info = new ProjectBillingInfo();
info.setBillingAccountName("billingAccounts/$BILLING_ID");
Cloudbilling.Projects.UpdateBillingInfo request = cloudbillingService.projects().updateBillingInfo(name, info);
ProjectBillingInfo response = request.execute();
and my problem is that request.execute() (as well as the API browser explorer) throws an exception with code "500 - internal error encountered".
Am I not using it correctly? It was my understanding that after this, when I check my project in GCP, I should see my project listed to the new billing account. Help is much appreciated.
You are using an invalid Project ID, since GCP project IDs have no spaces in them. Note that Project IDs and Project names are different things. It needs to be the ID as seen here. The rest of your code snippet seems fine, just make sure you put the actual project ID like this: projects/your-project-id

How we acess System Note Search through PHP?

I have created a System Note Search which executes successfully. Now I'm trying to access this search results in php. I'm stuck with what type of object I use for implementing this search. Below is the code-
$service = new NetSuiteService();
$search = new needtoIdentify();
$search->savedSearchId = "897"; // SavedSearch ID.
Thanks in advance.
Unfortunately System Notes are not part of Netsuite Web Services Supported Records. You might need to work around this by using suitescript either to passthrough the data through a Suitelet/Restlet or a scheduled script that saves the results of the System Notes in the file cabinet so you can pick it up with WebServices.

Connect Adobe Flex To Arcgis Service?

I'm trying to connect my flex app to my Arcgis webservices. I tried using the connect to webservice interface. But I keep getting this error.
There was an error during service
introspection. WSDLException:
faultCode=PARSER_ERROR: Problem
parsing
'http://localhost/ArcGIS/rest/services/geodata/MapServer'.:
org.xml.sax.SAXParseException: The
element type "link" must be terminated
by the matching end-tag "/link".
My web service looks like this
ArcGIS Services Directory Home >
geodata (MapServer) Help | API
Reference geodata (MapServer) View In:
ArcMap ArcGIS Explorer ArcGIS
JavaScript Google Earth ArcGIS.com
Map
View Footprint In: Google Earth
Service Description:
Map Name: Layers
Legend
All Layers and Tables
Layers:
Geocoding_Result layer (0)
Tables:
Description:
Copyright Text:
Spatial Reference: 4326
Single Fused Map Cache: false
Intial Extent:
XMin: -95.901360470612
YMin: 29.4513469530748
XMax: -95.1472749640384
YMax: 30.045474927951
Spatial Reference: 4326
Full Extent:
XMin: -100.3273442
YMin: 29.451583
XMax: -94.8230278
YMax: 31.250677
Spatial Reference: 4326
Units: esriDecimalDegrees
Supported Image Format Types:
PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,AI,BMP
Document Info:
Title:
Author:
Comments:
Subject:
Category:
Keywords:
Credits:
Supported Interfaces: REST SOAP
Supported Operations: Export Map
Identify Find
Maybe you already know... but if you are trying to connect to an ArcGIS Server using Flex you might be interested in the ArcGIS API for Flex - http://links.esri.com/flex - it will take care of most of that for you.
Antarr,
It's a little hard to tell from your question what exactly you are trying to do. But here are a couple possibilities:
1) It looks like you might be trying to add a reference to this service via Flash Builder's "Connect to Web Service" dialog, which you would use for a SOAP web service, but not for the REST endpoint you note above (http://localhost/ArcGIS/rest/services/geodata/MapServer). If you are intending to use the REST endpoints, then you need to use the appropriate ESRI ArcGIS API for Flex class (for example DynamicMapServiceLayer or Locator) for whatever you are trying to do (generate a map image, geocode addresses, etc). Look at the ESRI help on the Flex API for more information:
http://help.arcgis.com/en/webapi/flex/apiref/index.html
2) If you are intending to use the ESRI SOAP API then you do want to use Flash Builder's "Connect to Web Service" dialog, but then you must use the SOAP service endpoint, which would be something like: http://localhost/ArcGIS/services/geodata//MapServer?wsdl (though I don't know why you'd want to do this since the Flex API is really designed to be used with ESRI's REST service endpoints).
3) The only layer in your service is called "Geocoding_Result" - is that an actual feature layer or just a temporary output from a geocoding operation done with ArcMap? I am not sure whether a temporary result would work when published as a service.
See if any of these suggestions help. If not, then clarify what you are trying to do and perhaps I can give you more specific assistance.