Why can't I create an advanced routing manager? - javascript

I'm working with the nokia here api and I'm trying to create an advanced routing manager in javascript which for some reason does not work. Clearly I'm missing something but I just can't find it.
Basically that's all I'm doing:
<head>
<title>isoscope</title>
<meta charset="utf-8">
<script type="text/javascript" charset="UTF-8" src="http://js.cit.api.here.com/se/2.5.3/jsl.js?with=all"></script>
<link rel="stylesheet" href="style.css">
<script type="text/javascript">
nokia.Settings.set("appId", "xxxx");
nokia.Settings.set("authenticationToken", "xxxx");
var routingManager = new nokia.maps.advrouting.Manager();
</script>
</head>
And all I get is:
Uncaught TypeError: Cannot read property 'Manager' of undefined
It could have something to do with the Enterprise API vs the regular API because creating instances of e.g. a map works fine. But since I have access to the Enterprise API this shouldn't be any issue.

Ok for reasons of closure and completeness here's my solution to my problem as a regular answer.
Obviously the script I was including (I copied the URL from the isoline example on this page was just the wrong one. The correct one (or at least the one that works for me) can be found here.
It's
http://js.api.here.com/ee/2.5.3/jsl.js?with=all

Related

Why GoogleMap is not showing with key and is showing with v in my .net project

I am struck in a problem while using google map in my .net project
<script src="http://maps.google.com/maps/api/js?v=3&libraries=places&sensor=true" type="text/javascript"></script>
When I am using the above code I am properly getting the google map but if I tried to add key
<script src="http://maps.google.com/maps/api/js?key=xxxx-&libraries=places&sensor=true" type="text/javascript"></script>
Map is not showing and also getting this error
Uncaught TypeError: Cannot read property '__e3_' of undefined
I also tried
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?key=xxxxxxxx_xxx---------&libraries=places"></script>
But still it is not working.
Any suggesstion?
If you omit the "v=3" parameter, it defaults to the experimental version of the API (if you have a standard plan account). It appears that there is a fault with the experimental version that's not displaying a map at the moment. So add the "v=3" parameter in addition to the other parameters.
<script src="http://maps.google.com/maps/api/js?v=3&key=<YourAPIKey>&libraries=places&sensor=true" type="text/javascript"></script>

React JS not working with Internet Explorer 9

I'm trying to use React with Internet Explorer 9 but getting the following errors even trying to run something very barebones:
SCRIPT438: Object doesn't support property or method 'isArray'
react-with-addons.js, line 4 character 317
SCRIPT438: Object doesn't support property or method 'create'
JSXTransformer.js, line 4 character 326
I've read https://facebook.github.io/react/docs/working-with-the-browser.html, which says IE8 might have these issues, but no mention about IE9. Googling didn't really bring up any solutions either.
Still, I tried adding es5-shim/sham as suggested on that page. That results in a different error:
SCRIPT438: Object doesn't support property or method 'hasAttribute'
es5-shim.min.js, line 6 character 4143
Has anyone encountered these errors before in IE9 or otherwise?
Thanks for the help!
The full code I'm trying to run is:
<html>
<head>
<script src="js/es5-shim.min.js"></script>
<script src="js/es5-sham.min.js"></script>
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="js/react-with-addons.js"></script>
<script src="js/JSXTransformer.js"></script>
</head>
<body>
<div id="container"></div>
<script type="text/jsx">
React.render(
<h1>HELLO WORLD!</h1>
);
</script>
</body>
</html>
Generally, you need to include the specified polyfills for ES5 features (as you've noticed): https://facebook.github.io/react/docs/react-dom.html#browser-support
You may also need HTML5 Shiv in addition to the the polyfills you've provided.
More specifically, though, the problem is probably not with polyfills but with the document mode IE9 is running in. You want to make sure that you are setting the correct document mode in your HTML file so IE knows which version to target. Otherwise, even though you are using IE9 it may be targeting IE7 which is no good.
<meta http-equiv="X-UA-Compatible" content="IE=edge">
In index.js file you have to add polyfill. These imports should be in the first of your import.
import 'react-app-polyfill/ie9';
import 'react-app-polyfill/ie11';
//other imports
Now open in ur ie it works.
Before import you have to install react-app-polyfill.
//To install use below command:
npm install react-app-polyfill
link reference:
https://www.npmjs.com/package/react-app-polyfill

Node-webkit: ReferenceError: _ is not defined

When I try to run my app with node-webkit I have error: Node-webkit: ReferenceError: _ is not defined. I think it is about Lo-dash, but on browser everything work fine. Here is my index.html code:
<!DOCTYPE html>
<html ng-app="viewer">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="css/font-awesome.css">
<script src="components.min.js"></script>
<script src="app.min.js"></script>
</head>
<body>
<div id="content"></div>
<div ui-view></div>
</body>
</html>
In components.min.js i have all components I need - lodash, angular etc. When I run it by browsers or appJS i haven't any error, only on node-webkit.
Quite usually these reference errors arise when some script tries to reference another script which isn't loaded yet. Basically, the order in which you register your script matters. Script that is referenced should be registered before the script that uses it.
A good explanation of this issue (although with JQuery's $ selectors instead of the lodash _), is in this article here: http://jquery-howto.blogspot.nl/2013/02/referenceerror-jquery-is-not-defined.html.
Thus I would check the order in which your .js files are registered and their dependencies.
This is an issue with Lo-dash. The current edge version seems to have a fix for it, see this thread
A quick solutions seems to be to replace <script src="path_to_lodash.js"></script> with <script>require('lodash')</script>

D3.js: "Uncaught SyntaxError: Unexpected token ILLEGAL"?

I've just downloaded D3.js from d3js.org (link to zip file), unzipped it, and referenced it in the following HTML page:
<html>
<head>
<title>D3 Sandbox</title>
<style>
</head>
<body>
<script src="/d3.v3.js"></script>
</body>
</html>
But when I load this page, my console (in Chrome) is giving me this error:
Uncaught SyntaxError: Unexpected token ILLEGAL: line 2
It doesn't like the pi and e symbols at the start of the file. Errrr... what can I do about this? I am serving the file with python's SimpleHTTPServer.
Update: yes I know I can just link to a CDN version, but I would prefer to serve the file locally.
Try specifying the UTF-8 charset on the HTML host document :
<meta http-equiv="content-type" content="text/html; charset=UTF8">
D3 contains UTF-8 symbols (like π) invalids in non-UTF8 documents.
That sounds like a problem with encoding. I recommend The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!). Despite the somewhat condescending title, it contains some very useful information. Specifically, it sounds like your server is serving the d3.v3.js file with the wrong encoding.
Add 'charset="utf-8"'
<script src="/d3.v3.js" charset="utf-8"></script>
I tried setting the charset in the doc and in the script tag itself, but Chrome doesn't seem to care. Not sure if i'm doing something wrong.
I did find success by running it through uglify with the --ascii-only option first.
UPDATE: Turns out my View->Encoding setting in Chrome was not on Auto-Detect, but some Western encoding. Not sure why, but changing that resolved the problem. Ridiculous that that setting would trump a charset property right on the script tag. Considering that users might be in the same situation and not be able to figure it out, i'll still be using uglify to ensure success.
Check if you have a plus sign between all of your string concatenations, if you do not this error will be generated.

'Sys' is undefined javascript error

I am getting the following error:
Microsoft JScript runtime error: 'Sys'
is undefined
While trying to execute:
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
//ERROR IN THIS LINE!!!
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onUpdated());
function onUpdated() {
// get the update progress div
var pnlPopup = $get("div2");
// make it invisible
}
</script>
</head>
Ensure you have a Scriptmanager on the page and the script is below the scriptmanager. Maybe try to put your script tag into body and see what happens.
I don't know how you can fix that that its not in the body, but maybe there is a callback from Sys when its loaded
You don't need brackets to tell which function is neeeded:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onUpdated);
If that is your full code, then the problem is that the Microsoft AJAX libraries aren't being included. If it isn't your full code, then you need to post more as it's a little hard to get beyond the fact that the library isn't included. Somewhere in your file -- prior to the line you are having problems with you need to have a javascript include like:
<script type="text/javascript" src="/scripts/MicrosoftAjax.js" />
As well as probably a few others.
Note: I'm talking about the generated source. Showing more complete markup would probably also suffice.
I'm a bit late to the discussion here, but a simple solution is to create a "ASP.NET AJAX-Enabled Web Site" in Visual Studio and then merge the web.config from that site with your existing site.
In this way you get all the configuration you need without having to carefully read through a lot of docs. Speed is of the essence and all that :)
You can fix this issue by setting the EnableCDN property to "true".refer this link
I had the same issue , after all findings I found that the required script files ("MicrosoftAjax.js", "WebForms.js","jquery", "bootstrap" etc..) were not loaded properly which was causing me 3 errors "Sys' is undefined", "webform_docallback is undefined" and "webform_initcallback' is undefined", my actual problem was I had reference to these files which where not included in my propject, my bad I have not noticed it, I have tried all the possible solutions from the internet before I really found that my js files were not included and thats the reason its not loaded properly.
Hope this helps..

Categories