Google Cloud Natural Language Example - google-cloud-nl

I have followed the getting started page closely.
https://cloud.google.com/natural-language/docs/reference/libraries#client-libraries-install-php
The example code has the following: $projectId = 'YOUR_PROJECT_ID';
I fill in my project id taken from the json file and the Google console--e.g. "$projectID = 'myproject-197218'" and I always get a fatal error with "Permission Denied."
I have set the env variable, run composer to install the library. And, I created the Google json file. I am running the example in PHP code.
I am running the code on my local server (xampp).

I figured out my problem. The Google Cloud json file was stored on my drive d:, so in the env variable I referenced it as 'GOOGLE_APPLICATION_CREDENTIALS= d:\xampp\htdocs\googapi\mproj.json', it did not work; when I moved it to the root of the c: drive and referenced it there (GOOGLE_APPLICATION_CREDENTIALS=c:proj.json), it worked fine.

Are you sure that the ID of your project is that one? I'm working in Google Cloud and I cannot see this project ID in our database, but if I type "my-project-197218" with a "-" between "my" and "project" I am able to find one project. please, to make sure that this is your correct project ID, run this command in your Google Cloud Shell to get the default project ID:
gcloud config list --format 'value(core.project)' 2>/dev/null

Related

Google Maps JavaScript API warning: InvalidKey and Google Maps JavaScript API error: InvalidKeyMapError

I am trying to deploy an open source project (https://github.com/LiteFarmOrg/LiteFarm) on local host through docker composer and i have followed the instructions provided in the link, the app is a node.js app with frontend in react.js i have provided the (google_api_key) for the map to work in the application in the ".env" file but i am getting the error of "invalidkey" yet i tried to provide another newly generated key same error i faced. the screenshot is as
invalid key error
also in the location text field the "icon of something went wrong is coming".

Azcopy interprets source as local and adds current path when it is a gcloud storage https url

We want to copy files from Google Storage to Azure Storage.
We used following this guide: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-google-cloud
We run this command:
azcopy copy 'https://storage.googleapis.com/telia-ddi-delivery-plaace/activity_daily_al1_20min/' 'https://plaacedatalakegen2.blob.core.windows.net/teliamovement?<SASKEY>' --recursive=true
And get this resulting error:
INFO: Scanning...
INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support
failed to perform copy command due to error: cannot start job due to error: cannot scan the path /Users/peder/Downloads/https:/storage.googleapis.com/telia-ddi-delivery-plaace/activity_daily_al1_20min, please verify that it is a valid.
It seems to us that azcopy interprets the source as a local file destination and therefore adds the current location we run it from which is: /Users/peder/Downloads/. But we are unable to find any arguments to indicate that it is a web location and it is identical to the documentation in this guide:
azcopy copy 'https://storage.cloud.google.com/mybucket/mydirectory' 'https://mystorageaccount.blob.core.windows.net/mycontainer/mydirectory' --recursive=true
What we have tried:
We are doing this on a Mac in Terminal, but we also tested PowerShell for Mac.
We have tried single and double quotes.
We copied the Azure Storage url with SAS key from the console to ensure that has correct syntax
We tried cp instead of copy as the help page for azcopy used that.
Is there anything wrong with our command? Or can it be that azcopy has been changed since the guide was written?
I also created an issue for this on the Azure Documentation git page: https://github.com/MicrosoftDocs/azure-docs/issues/78890
The reason you're running into this issue is because the URL storage.cloud.google.com is hardcoded in the application source code for Google Cloud Storage. From this link:
const gcpHostPattern = "^storage.cloud.google.com"
const invalidGCPURLErrorMessage = "Invalid GCP URL"
const gcpEssentialHostPart = "google.com"
Since you're using storage.googleapis.com instead of storage.cloud.google.com, it is not recognized by azcopy as a valid Google Cloud Storage endpoint and it considers the value as one of the directories in your local file system.

GitHub Clone from VSCode eg-02-react-implicit-grant error /src/hoc/aux invalid argument

This question is regarding the repo for react implicit grant for docusign using react.
https://github.com/docusign/eg-02-react-implicit-grant
When I tried to clone the repo using VSCode, I received an error
Git: fatal: cannot create directory at 'src/hoc/Aux': Invalid argument
When I looked into the repo, there is a file under src/hoc/aux/aux.js which has the text below.
const aux = (props) => props.children;
export default aux;
Is the file aux.js necessary? Because I was able to extract the zip files after skipping to extract aux.js.
I just tried to clone the https://github.com/docusign/eg-02-react-implicit-grant repo using the GitHub desktop and did not have any problems.
I suggest that you download the repo using git directly or use the download zip option from the repo's page.
Re: aux.js
TL;DR. -- Yes, I believe the aux.js is needed.
Details: Unfortunately I'm not a React expert. (Even though I wrote this example.)
The /hoc directory is used for React Higher Order Components. In this case, I'm using it for a simple component that checks to see if the user has a valid token. I believe that the js file is needed. But you can find out by not including it as seeing what happens.
Also, note that I wrote this React example almost a year ago. You'll want to update it to current React best practices.
Try renaming the aux folder and aux.js file inside it to any random name do it preferably in vscode it will let you know which name is allowed and which isn't, worked for me.

Errors deploying Node.js app

So I am new to IBM Bluemix and all of their products and I am trying to do this project http://www.ibm.com/developerworks/library/ba-muse-toycar-app/index.html . I have done all of the modifying of the car and everything I am just having issues with the codes.
I have a few specific questions on part 2 step 2.b when you are entering in the information for the Cloudant database what information do I put in for the cradle connection and how do I acquire that information.
Second when I go to deploy the app Part 2 Step 2.4 how do I navigate to the application directory? I have looked at the help and googled to no avail. So if we fix these things I am hoping that I will be able to deploy the application. However currently when I go to deploy it I get this error.
cf push braincar
Updating app braincar in org ccornwe1#students.kennesaw.edu / space dev as myemailaddress#gmail.com...
OK
Uploading braincar...
FAILED
Error uploading application.
open /Users/codycornwell/.rnd: permission denied
>>
I am green to all this so any help and explanation to understand it is greatly appreciated! Thanks!
In the tutorial's part 2, step 2.b, you need to specify your Cloudant credentials. There are several ways to get Cloudant credentials, but I'll focus on doing it within the context of Bluemix and the cf command line tool.
You will first need to create a Cloudant service instance, then create a set of service keys (credentials) and then view them.
Create a Cloudant service instance named myCloudantSvc using the Shared plan:
$> cf create-service cloudantNoSQLDB Shared myCloudantSvc
Create a set of service keys (credentials) named cred1:
$> cf create-service-key myCloudantSvc cred1
View the credentials for the service key you just created
$> cf service-key myCloudantSvc creed
With the last step above, you should see output which provides you with the username, password and host values that you'll need to place into your app.js code. It should look something like the following:
{
"host": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-bluemix.cloudant.com",
"password": "longSecretPassword",
"port": 443,
"url": "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-bluemix:longSecretPassword#xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-bluemix.cloudant.com",
"username": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-bluemix"
}
For your second question, it looks like you're performing the cf push from your $HOME directory (as mentioned in the comment by #vmovva). By default, the cf push command will send all files in the current directory to Bluemix/CloudFoundry.
Try running the command from the directory where your source code is located to reduce the files pushed to Bluemix. If your source code is intermingled in your $HOME directory, move your source into a different directory and then push from that directory.

Spotify Folder in "My Documents"

I'm trying to make an app for Spotify, but I can't get the first step to work. I have made a folder named 'Spotify' in 'My Documents' (I use Windows 7 64 Bit), and made a folder inside it named 'test'. In 'test' I put a file 'index.html' to test if I can open it in Spotify, but I can't. I have a developer account, so that can't be a problem. When I type 'spotify:app:test' in the search bar, I get something like this:
(Note, in the screenshot it says spotify:app:tutorial, but I get the exact same result as displayed when I type spotify:app:test, saying failed to load application)
Also, I use Spotify version 0.8.7.111.gaf8d06ed-245
Spotify cannot load an application unless it has a valid manifest file. The manifest documentation can be found here.
Alternatively, see the Spotify Apps Tutorial app for a working example of a valid manifest. Note that you at least need an identifier, version and name for a manifest to be considered valid.

Resources