Rally app SDK 2.0rc1 - Uncaught ReferenceError: rally is not defined - javascript

Long time SO reader, first time questioner. I'm fairly new to coding in JavaScript and I'm working on a Rally app. I'm trying to "update" existing items, so I figured I'd set up the datasource at the beginning of the app, like this:
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
this.rallyDataSource = new rally.sdk.data.RallyDataSource("__WORKSPACE_OID__",
"__PROJECT_OID__",
"__PROJECT_SCOPING_UP__",
"__PROJECT_SCOPING_DOWN__");
However, on page load, the Chrome console is showing me "Uncaught ReferenceError: rally is not defined". I checked the HTML to ensure there was a reference to sdk.js, and there is:
<script type="text/javascript" src="/apps/2.0rc1/sdk.js"></script>
I've searched around and attempted some solutions, but nothing seems to work. Any one else run into this or know what it causing it?
Edit: To clarify, I am testing this within the Rally workspace in which it will be used. I have comboboxes correctly loading and populating with Release and User Story info, so I know it is able to communicate.

rixo is on the right track above. Basically, you're trying to use sdk 1.x code (rally.sdk.data.RallyDataSource and the hangman variables) from the sdk 2.x.
SDK 1.x is deprecated but the docs are still available here: https://help.rallydev.com/app-sdk
SDK 2.x is the preferred platform and its docs are here: https://help.rallydev.com/apps/2.0rc2/doc/
Both of those resources contain a bunch of guides for getting started and whatnot.

Shouldn't that be Rally.sdk.data with a capital 'r'?

Related

TestCafe: ReferenceError: Cannot access 'ModuleName' before initialization

Im using testcafe for testing our page for now bout 1 year.
On the latest version of our page, the devs used preloading and critical CSS for performance optimizations.
Since then i get an error on page startup:
ReferenceError: Cannot access 'ModuleName' before initialization
Is there a problem with TestCafe if a a page uses rel="modulepreload" to import js?
The DOM shows, that this module is part of a js-file that is preloaded like this.
<link href="//cdn.test.local/version1/dist/script/something.static.js" rel="modulepreload">
-> link wont work since the page is on a local site.
Content of js-file:
import{ModuleName}from'./classes/something.class.ajax.js';export const someAjaxPlugin=new ModuleName;
This Error does only occur if i run the page in testcafe... is that a bug?
Any one an idea what i can do so my tests will run again?

Has the ViewingApplication constructor been removed from the AD Viewer API?

After leaving my Autodesk extension alone for a few weeks, my initialization code is failing to create a ViewingApplication.
In my browser's js console, I can see that the Autodesk.Viewing object contains many objects, but it no longer contains any ViewingApplication.
The Viewer API documentation still includes ViewingApplication.
Autodesk.Viewing.Initializer(options, function onInitialized(){
viewerApp = new Autodesk.Viewing.ViewingApplication('MyViewerDiv');
var config3d = {
extensions: ['WharfExtension']
};
viewerApp.registerViewer(viewerApp.k3D, Autodesk.Viewing.Private.GuiViewer3D, config3d);
var model = 'urn:' + defaultModel;
viewerApp.loadDocument(model, onDocumentLoadSuccess, onDocumentLoadFailure);
});
My browser says, "Uncaught TypeError: Autodesk.Viewing.ViewingApplication is not a constructor," and I am inclined to agree?
EDIT: It works as expected from my coworker's machine, so apparently it is not a problem with the API. I am serving the page from a web server on my machine.
EDIT2: Solved. Thanks, Petr. I was including the new, non-backwards-compatible version of the API without realizing it.
Autodesk describes how to create this behavior in the new version in their Migration Guide v6 to v7.
The viewer team has recently released new major version which is not backwards compatible.
Make sure that you're importing the viewer3d.js/viewer3d.min.js file with the expected major version. For example, if you've built your application against version 6 APIs, you should be using the following script tag:
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/6.*/viewer3D.min.js"></script>

Unable to load a js framework while the authors demo works without problems

I'm trying to use formio and a 3-rd party framework formio-export but I'm having trouble getting started.
The author provided a sample of the framework on his github page. Demo can be found here.
I've tried to recreate a simple demo using HTML/JS.
I was able to create the form, load a submission on demand, but I'm unable to get the print functionality working. When I press the print button, I get the error:
Uncaught ReferenceError: FormioExport is not defined
at HTMLButtonElement. (:47:21)
at HTMLButtonElement.dispatch (index.js:3)
at HTMLButtonElement.elemData.handle (index.js:3)
A fiddle for your convenience.
I would expect the formio-export to 'just work' once the script tag is added but maybe it requires some additonal configs?
You can't use it in the browser directly. You must use node in order to import the module
import FormioExport from 'formio-export';
and then use
npm run build
to make a browser bundle (as explained in the github page).

How to integrate tesseract OCR with Cordova/Phonegap app

Im trying use tesseract OCR with my app and by instructions posted here
http://scn.sap.com/community/developer-center/front-end/blog/2015/05/15/create-an-ocr-android-app-with-cordova-and-tesseract
several times I followed the instructions but with no success.When im inspecting code with Google Chrome Dev console thru the WebVieW it give me
Uncaught SyntaxError: Unexpected token }
in file tesseractPlugin.js:11
thats located somewhere in
file:///android_asset/www/plugins/com.tesseract.phonegap/tesseractPlugin/tesseractPlugin.js
and
Uncaught Error: Module com.tesseract.phonegap.tesseractPlugin.TesseractPlugin does not exist.
in cordova.js:1431
witch i think means the cordova cant find the plugin but i dont know why.I think it's something with the version of Cordova and its access to plugins
its frustrating because there are no other options on the web and i dont know how to write my own cordova plugin.
I would also like to add that I created the project exactly as instructed to avoid the mistakes and over I have found that it is not possible to download the plugin by git from
https://github.com/engzhaowei/Tesseract-phonegap-android-example/tree/master/plugins/com.tesseract.phonegap.tesseractPlugin
so i downloaded full package and fetch plugin from
C:\xxx\plugins\com.tesseract.phonegap.tesseractPlugin
There is tessaract js http://tesseract.projectnaptha.com/
which is a javascript library and you can use it and will work for phonegap its very easy to implement.
Just reference the cdn script in the header and call the code snippet it should work. Be warned actress is slow.
<script src='https://cdn.rawgit.com/naptha/tesseract.js/1.0.10/dist/tesseract.js'></script>
var myimage = document.getElementById("largeImage").src;
Tesseract.recognize(myimage)
.then(function(result){
// console.log(result);
document.getElementById("textarea1").value = result.text; // assign results to a textbox

EmberJS Reset Warning: Library is already registered with Ember

Some background...
We have an ASP.NET app we're slowly converting over to EmberJS. We have a single Ember application we instantiate for certain portions of the site. As we migration pages they get routes in the Ember app. The goal is to have everything in Ember over time. In the interim, the user can click on links that take them back to ASP.NET portions.
Our issue is with resetting the state of the Ember app if the user either clicks back to go back into Ember or clicks on a new link that takes them back into the Ember portion.
We've tried calling .reset on the application, but doing so gives us an error saying the following. Our application is called ConsoleCli and not the standard App.
Library "ConsoleCli" is already registered with Ember
Moreover, we get the following error saying one of our modules has already been registered.
Cannot re-register: `location:history-js`, as it has already been resolved.
I tried wrapping my registration of the history module with a check, but that creates a whole other slew of errors
if(!application.__container__.lookup('location:history-js')){
application.register('location:history-js', HistoryJsLocation, { singleton: true });
}
I read https://github.com/emberjs/ember.js/issues/10310 and I think it means reset() is supposed to clear all registries once this has all been merged into the main branches.
Shouldn't called App.reset() right in the middle of using an EmberJS application just reset it with no issue?
Excuse my lack of understanding, we're just learning all of this as we go.
We're running the following versions
Ember 1.11.0-beta.2
Ember Data 1.0.0-beta.15
jQuery 2.0.3
TIA!
I think you might have run into this bug: https://github.com/emberjs/ember.js/issues/10310
Try the fix mutewinter suggests in that thread, it has worked for most people (involving myself).

Categories