I have installed Eclipse for PHP Developers (Oxygen package). I am not getting error messages for javascript. (for example, it is not showing error or warning even if semi-column for some lines are missing or statements like x=x is present)
I have referred this question . Accordingly, enabled all the validations.
Still Eclipse does not show warnings or error for javascript. I did clean build also but it did not help. For php, it is working fine.
Could anyone help me to know what I am doing wrong with the configuration.
EDIT: Errors are missing for files with js extension. Attaching sample file content below (content of a file test.js)
var test = 'hello';
test = test;
var test2 = 'e'
alert('hello');
Related
Rails will not let me run JS code, I have these errors
1)
2)
whenever you add JS code, the errors appear.
Some idea why this happening?
Just because you're getting error highlights in your IDE, doesn't necessarily mean your code is wrong. Try running your server, navigate to your site from your browser, and check the developer console. Do you still see javascript errors?
This warning (it is not an error) is being displayed because your IDE thinks that the variable $ is not defined in your code. However, it is not able to find out that $ is a global variable defined in the jQuery library, imported a few lines before.
The IDE is just saying that the presence of that variable is not guaranteed unless you properly import the needed libraries to make it exist (jQuery in this case). Your code should work properly. In order to identify errors in your javascript code, I would recommend you to use the built in console in the web browser.
I can't figure out how to use imacros with JavaScript. I have looked at their Help, have seen countless examples here on Stack Overflow, but don't know what am missing. It has not been explained clearly anywhere.
Here is what I tried:
Used the example explained in their help file here:
http://wiki.imacros.net/JavaScript
But nothing happens when I click the 'Click Here to Run' link (even in IE with ActiveX). NOTE: I don't have imacros for IE - the example shown above has image of the macro start in IE, but run in Firefox. And no further explanation..
Tried to import a JS file into imacros, but it doesn't seem to be working for me.
When I use code like the following:
var macro;
macro = "CODE:";
macro += "XXXXXX" + "\n";
macro += "XXXXXX" + "\n";
....
iimPlay(macro);
It says:
"Error -1100: Unknown command: VAR at line: 1"
Tried to use the above inside a script tag of an HTML page, & load the functions on page-load/click. But that doesn't work either.
What am I doing wrong, and what do I need to do?
Soon after I posted this, I think I got it to work for a while. I was able to open a JS file which opened a URL. So I had deleted the Q. But now it isn't working again, and I can't figure out why.. Can somebody help?
Basically I am having the exact same problem as this person here:
Javascript and Imacro to Open Google.com I get the same 'unknown command: var' as him. And their question remains unresolved too.
It looks like you are trying to run javascript inside an iim file. Open notepad or another text editor and paste the following code:
var test;
test ="CODE:";
test +="SET !ERRORIGNORE YES "+"\n";
test +="URL GOTO=www.google.com "+"\n";
iimPlay(test)
Save the file with a .js extension. Next open up firefox and the iMacros addon. Go to Manage -> Settings -> Paths Tab -> Folder Datasource. Enter the path where you saved the file above. Refresh iMacros by clicking the iMacro button on and off. The javascript file should show up in the left pane. Run the file to test.
You should notice the icon to the left of the file name is different for the javascript files and the extension is ".js" instead of ".iim".
Good answer Creamstout83
I would also add this to answer above. Un checking this option will speed up the process. And checking it will enable better debugging.
If you're experiencing this problem while using Chrome to run iMacros; the answer is really simple:
Download Firefox and run the iMacros plugin on there.
I experienced the same problem, receiving the error message: "Error -1100: Unknown command: VAR at line: 1", while using Chrome.
But with Firefox I can now run javascript files, have more options to play around with, and less bugs to disrupt my scrapes.
I am doing an experimental HTML template wich comes with jquery.min.js file - one of the most popular javascript libraries.
When I load the template from my local hard drive it works fine.
When I upload it and load it from server (GWAN) I get error (I think is not the only one) in Chrome looks like this:
Uncaught SyntaxError: Unexpected token { jquery.min.js:3
I inspected a bit and realized there is a
function $
which was turned into
function$
by GWan. The space removed is causing an error in Chrome, Firefox and Safari. I haven't tested other browsers but my IDE also reports a syntax error in the downloaded from GWAN version of the JS file.
I have also tried uploading the files to another server (Apache) and no problem there. The js file was not modified...
Any clues on how to get over this? I suppose there is a bug in javascript on-the-fly optimization of GWan?
Thanks.
It's a known issue and it will be fixed in next release (soon)
You'll be able to disable minifying directly from a init.c script in G-WAN v4.10+, this way:
u8 *www_mini = (u8*)get_env(argv, USE_MINIFYING);
if(www_mini)
{
*www_mini = 0;
puts("> disable minifying");
}
You just have to wait for few days for the new v5 release.
Trying to add tests support into my project. Attached JsTestDriver with coverage plugin.
Dummy tests are working correctly, but when I load up all my source files I'm getting application crashed with the following:
[java] **line 109:12 no viable alternative at input 'formFound'**
[java] Exception in thread "main" com.google.jstestdriver.coverage.CodeInstrumentor$InstrumentationException: error instrumenting /path/discover.js
[java] at com.google.jstestdriver.coverage.CodeInstrumentor.instrument(CodeInstrumentor.java:74)
[java] at com.google.jstestdriver.coverage.CoverageInstrumentingProcessor.process(CoverageInstrumentingProcessor.java:62)
This line of code looks like:
let formFound = tryToFindLoginForm();
I changed that definition into
var formFound = tryToFindLoginForm();
After that JSTD will pass over that string but will die on next let statement. Is there any way to workaround this, to tell JSTD the version of javascript used in code or something?
It'll be a very big issue to rewrite entire code into version without lets.
Thanks for help in advance.
Saw this question but renaming to jQuery doesn't help.
I'm trying to get some basic unit-testing in Webstorm to work. Even without the tests it's not finding things defined in other files.
I have this config file:
server: http://localhost:9876
load:
- libs/jquery-1.9.0.min.js
- src/jquery.combine/jquery.combine.js
But it get this error when running the tests:
error loading file: /test/src/jquery.combine/jquery.combine.js:2: Uncaught TypeError: Cannot set property 'union' of undefined
The path's are a bit different, but clicking it show's the right file.
jquery.combine.js looks like this:
(function($) {
$.union = function () {
// ...
};
}(jQuery));
Why is it not detecting jQuery? It includes it correctly because if I misspell the path it complains about missing file instead.
I was able to solve this with the help of JetBrains. Somehow this solves itself if you add a jsTestDriver adapter for QUnit. WebStorm comes bundled with this one.
My updated jsTestDriver.conf looks like this:
load:
- libs/qunit-jstd-adapter/equiv.js
- libs/qunit-jstd-adapter/QUnitAdapter.js
- libs/jquery/jquery.js
- src/*.js
test:
- test/*.js
I'm pasting the instructions I got from JetBrains (with slight modification) which helped me solve the issue:
1) delete jquery.combine/libs/qunit/qunit.js - doing so will make symbols 'test' and 'module' unresolved,
2) open jquery.combine/test/difference.tests.js and position test cursor on any 'test' function call, wait alittle and you'll see the suggestion:
"Add QUnit JsTestDriver adapter? Alt+Enter"
Invoking this quick fix will open a dialog, where you should specify a directory where "QUnit JsTestDriver Adapter" files will be added.
3) As equiv.js and QUnitAdapter.js files are located inside your project, load them in jsTestDriver.conf
4) Now right-click jsTestDriver.conf and select run (JsTestDriver server should be up and have a captured browser).