Polymer google-client-loader, does not care about root property - google-cloud-endpoints

I'm trying to get my Polymer1.0 app to work with my google cloud endpoints API but for some reason it seems that google-client-loader doesn't care what i put in for root, it always goes to content.googleapis.com to fetch the API , of course it isn't there !
code:
<google-client-loader
id="api" name="parliament" version="v1"
root="http://localhost:8080/_ah/api"></google-client-loader>
getting:
GET https://content.googleapis.com/discovery/v1/apis/parliament/v1/rest?fields=rootUrl%2CservicePath%2Cresources%2Cparameters%2Cmethods&pp=0 404 (OK)
tried:
api-root
apiRoot
root
api-root with app-id
apiRoot with app-id
root with app-id
doesn't work !
What's the problem ? Am I doing something wrong ?

The correct attribute to use is api-root (which works, just tested).
<google-client-loader
id="api" name="parliament" version="v1"
api-root="http://localhost:8080/_ah/api"></google-client-loader>
You have to make sure to use the latest version of the google-apis element collection, i.e. with this dependency in your bower.json:
"google-apis": "GoogleWebComponents/google-apis#^1.0.1"

Related

Here API | MultiValueQueryParameter for Via Points

I'm using the latest version of the here javascript sdk 3.1.32.0
When I use H.service.Url.MultiValueQueryParameter for my via points like
{
...,
via: new H.service.Url.MultiValueQueryParameter(['50.1234,8.7654', '51.2234,9.1123']);
}
I see in the URL params of my request this: &via=%5Bobject%20Object%5D
Someone an idea why this happens?
Thanks in advance!
When you use "via" parameter, you define a list of via waypoints. A via waypoint is not a native datatype recongnized by JavaScript, therefore, you will see in the URL params the word object refering to a particular data structure, in this case the via Waypoint composed mainly by Latitude, Longitude.
Regards.
This took a while to figure out the actual issue with the malformed url params. I was dynamically loading the here maps service script on mount of a component. Accidentally this happened in some cases twice. In both cases H was globally available and everything worked like expected. BUT when the script was loaded twice H.service.Url.MultiValueQueryParameter didn't return the correct params. It basically encoded them twice, or tried to.
The other side issue was that https://www.npmjs.com/package/#types/heremaps is outdated and doesn't cover MultiValueQueryParameter. So I had to remove the types and use my own. Else I probably would have realized the issue earlier.

change base path in blazor server application

I'm trying to change the base path in a Blazor server application. Instead of having it at
http://localhost:5000/ I want to have it at http://localhost:5000/CoolApp/
I followed this instructions, but the application crashes with:
InvalidOperationException: Cannot find the fallback endpoint specified by route values: { page: /CoolApp/{**path:nonfile}, area: }.
Here's the sample
I had this exact problem. I explored it for about an hour or so as well. The problem was that in my component I had a
href="#($"/myPageComponent/{id}")"
...When I removed the / and made it
href="#($"myPageComponent/{id}")"
then it worked. Basically, check your child's component and make sure that you have no slash in the beginning. As the slash is saying "Go to the root". Also, in my specific case, I had to include a separate web.config file that prevented the app from inheriting parent configuration features. Like So
`<configuration>
<location path="." inheritInChildApplications="false">
<configuration/>`
You should removing the app.PathBase():
app.Map("/CoolApp", coolApp =>
{
coolApp.MapBlazorHub();
coolApp.MapFallbackToPage("/_Host");
});
This will mean nothing will run unless it is on the /CoolApp endpoint - and you don't need to worry about appending the /CoolApp route to anything.
In future if you don't want the /CoolApp base path - move the inside of the Map() function out and remove it, replacing coolApp with app.
Let me know if this works for you!

Ruby/Selenium/Watir-Webdriver: "path is not absolute" error for absolute path

document_name ='TestDoc'
document_path = ("/Users/Me/QA/Project/Documents/#{document_name}")
File.new ("/Users/Me/QA/Project/Documents/#{document_name}") # => File is created
filename_field.send_keys("#{document_path}")
filename_field.send_keys :tab # => To Trigger event but where error occurs
filename_field = browser.file_field(:name, 'file') declared in a module elsewhere.
As far as I can tell, I have provided an absolute path for the filename to upload the file but when the tab key is sent, an error occurs of:
Selenium::WebDriver::Error::UnknownError: unknown error: path is not absolute:
With an odd squiggly symbol in RubyMine that I've never seen before. Any ideas?
Update:
I added
puts filename_field.value
# => C:\fakepath\TestDoc
Spoke to one of the developers and she said "Browser does it to fake things out, so the filesystem isn't exposed". Not sure if that helps solve my issue or I'm SOL?
That error comes from Chromedriver, and comes from sending an incorrect path string to a file element. Since :tab is not a path, it is correctly raising an error.
You shouldn't need to send a tab; just sending the path of the file should accomplish what you need.
I see many small strange things in your code.
Why
document_path = ("/Users/Me/QA/Project/Documents/#{document_name}")
Not
document_path = "/Users/Me/QA/Project/Documents/#{document_name}"
Why
filename_field.send_keys("#{document_path}")
Not
filename_field.send_keys(document_path)
But the main question is why you are using send_keys instead of set?
I failed to reproduce your problem. Maybe it will be possible if you will provide your html. But i suggest you to try:
filename_field.set(document_path)
Because you can easily check it even with irb send_keys is acting differently in firefox and in chrome for example. So maybe problem with it.
Another suggestion
That is a much more weak idea. But...
Try to clear value before changing it. You can do it with javascript:
b.execute_script("arguments[0].value=''", field)
I had the same issue with Chromedriver 2.26.436421 and it was solved when I removed the code which was sending the tab key.
With previous Chromedriver sending tab key was required to trigger the change event on the file input but with latest one it seems like it is only causing issues and the change event gets triggered without it.

middleware_stack.js:31 Uncaught Error: Handler with name 'route' already exists. Iron router Meteor

My code was working fine until last night and suddenly I am getting this error and routes are not working at all.
middleware_stack.js:31Uncaught Error: Handler with name 'route' already exists.
for simple routes like this:
Router.route('/admin/dashboard', {
template:"adminDashboard"
});
Router.route('/admin/create/table', {
template:"create_table"
});
I cannot figure out the error, I have checked all the routes. Have anyone else faced this error?
This is a known issue. The problem occurs with recent versions of Google Chrome and Microsoft Edge (edit: also Firefox now).
It has been fixed by a recent iron router update, it should be fixed by meteor update iron:middleware-stack.
Edit: If the middleware-stack package rolls back when you restart the server, check #bigsan's comment
Edit: this issue was fixed in iron:middleware-stack 1.1.0 .
I have the same problem. Weirdly, I have this problem on Chrome 51 but not on Chrome 46. I guess this has to do with updates in the javascript engine, and I'll post here if I figure out what exactly.
In the meantime, the workaround I used was to explicitly add names to the routes. It doesn't matter what they are, they just have to be declared, otherwise iron-router think the name of the route is "route." So your code would become:
Router.route('/admin/dashboard', {
name: "Boaty_McBoatface",
template:"adminDashboard"
});
Router.route('/admin/create/table', {
name: "Guacamole",
template:"create_table"
});
First, have a look here and see when this error is thrown. So, actually I have not faced that error but I've read about it. Further have a look at the official guide and post. I see that you are trying to create a subdirectory to your route /admin. Usually, I do this by using this.render() function. Concerning the layout I use this.layout() so I think that if you use these functions and remove template:"adminDashboard". It will work.

Why creating model in any other location than client, meteor runtime throws exception?

I am a meteor newbie. I am trying out by building a simple app and it does nothing but shows list of items. I first tried out with hard coded model values in my client javascript code and it worked just fine. I then created a folder called 'model' under root of the application and created the model there like the following
Favorites = new Meteor.collection("favorites")
with this change, meteor throws exception pointing to this line of the file on load. If I move this code to client the code works ofcourse that is wrong. The full code is # https://github.com/ksunair/13favs It is a very simple solution has few files and less than 20 or 30 lines altogether. My client code is,
Template.favorites_main.helper({
favorites:Favorites
});
I did the following in order to clear your app of errors:
Favorites = new Meteor.Collection("favorites"); (Collection starts with a capital C)
I moved model/mainmodel.js to lib/mainmodel.js so Favorites would be available as soon as the template rendered. I always put my models under lib (or in a subdirectory) so they will be loaded first. This contradicts what I see in other places including discover meteor, so I'm unclear what the best practice is. In any case, it fixed the problem.
$ meteor add accounts-ui was needed because you referenced Accounts.ui.config.
You need to actually do a find in your favorites_main template. So it should look something like:
Template.favorites_main.helpers({
favorites: Favorites.find();
});

Resources