dart - its_all_about_you tutorial error - dart

I am trying to run the latest version of its_all_about_you with the latest version of Dart Editor/SDK and I am getting this error. I copied the latest source from github
Internal error: 'http://.../web/out/packages/web_ui/src/linked_list.dart':
Error: line 72 pos 29: cannot resolve class name 'IterableBase' from 'LinkedList'
class LinkedList<E> extends IterableBase<E> {
Does anyone know what the problem is and how to fix it? And for future reference how would one go about debugging the issue?

This looks like a version mismatch. Could you please verify that your sdk (comes with the editor) is up to date.
If the error persists after an upgrade, post the version number of your editor and try the following (untested) example:
import 'dart:collection';
class A extends IterableBase { get iterator => null; }
main() { new A(); }
In recent versions of Dart this should work.

Related

Error running ParseTree

In the Rascal shell, doing this:
import lang::c90::\syntax::C;
import ParseTree;
parse(#TranslationUnit, |file:///teste.c|);
I get in the stable standalone jar:
|prompt:///|(24,93,<1,24>,<1,117>): ParseError(|file:///home/rafael2k/files/UnB/static_analysis/eclipse-workspace/rascal-C/c-source/teste.c|(47,0,<4,0>,<4,0>))
at parse(|prompt:///|(24,93,<1,24>,<1,117>))
at *** somewhere ***(|prompt:///|(24,93,<1,24>,<1,117>))
at parse(|prompt:///|(24,93,<1,24>,<1,117>))
And in Eclipse I get a giant message error:
(...)
public AbstractStackNode<IConstructor>[] FloatingPointConstant() {
return FloatingPointConstant.EXPECTS;
}
public AbstractStackNode<IConstructor>[] StructDeclarator() {
return StructDeclarator.EXPECTS;
}
}
Advice: |http://tutor.rascal-mpl.org/Errors/Static/JavaCompilation/JavaCompilation.html|null
Any tip?
Btw, running Debian Jessie, Oracle Java 1.8.0_112,x86_64.
I think it can be fixed with this:
parse(#start[TranslationUnit], |file:///teste.c|);
By using a start non-terminal you can parse files which begin and/or end with whitespace or source code comments. See also the answer to this question: Layout in Rascal
By the way, this grammar will parse c programs after the processor has been applied.
The Eclipse error is a seemingly unrelated issue for which we would love to receive a stack trace on the github issue tracker.

Crawler4j with Grails App throws error

This might be a very basic and silly question for experienced people. But please help. I am trying to use Crawler4j with in my Grails app by following this tutorial.
I know its Java code but I am using it in a controller class called CrawlerController.groovy.
I added the jar files but when I write CrawlConfig crawlConfig = new CrawlConfig()
it throws me a compiler error saying "Groovy unable to resolve class" . I refreshed dependencies and tried everything. May be I am missing something since I am a beginner. This is what I have written so far and all the import statements and CrawlConfig statement throws errors:
import edu.uci.ics.crawler4j.crawler.Page;
import edu.uci.ics.crawler4j.crawler.WebCrawler;
import edu.uci.ics.crawler4j.parser.HtmlParseData;
import edu.uci.ics.crawler4j.url.WebURL;
class CrawlerController extends WebCrawler {
public static void main(String[] args) {
CrawlConfig crawlConfig = new CrawlConfig()
}
}
` Please help. Thanks.
Just refresh your dependencies.

Grails 2.3.0 Restful Service Runtime Exception

I´m currently running Grails 2.3.0 and Java jdk1.7.0_40 on a Windows 7 machine, no IDE. I wanted to see how the new Rest functionality looks like. So I created the domain class as follows:
package fergara
import grails.rest.*
#Resource(uri='/Cars', formats=['json', 'xml'])
class Car {
String model
static constraints = {
}
}
The error I got when open the url:
URI
/FergaraTest/Cars/1 Class
org.codehaus.groovy.runtime.typehandling.GroovyCastException
Message
Cannot cast object 'fergara.CarController#12c43f7' with class 'fergara.CarController' to class 'org.codehaus.groovy.grails.plugins.web.api.CommonWebApi'
I feel that the Oracle´s Java SDK is the problem. To make the app run I have to pass "no-reloading" to the grails run-app command, otherwise I get an error saying that it could not start the VM and cannot open the springloaded-core-1.1.3.jar.
A have the Grails 2.3.0 installed on an Ubuntu 13.04 with OpenJDK6 and it is working good.
Hope someone can shed a light on this. Thank you.

Compiler error running ootb web_ui sample

i'm trying to compile the ootb web_ui sample. (Using Generate Sample Content - Web Application (using the web_ui library)
I have updated to latest editor 0.0.0_r18915 and have run pub update but am getting
Internal error:
'http://127.0.0.1:3030/C:/Users/me/dart/WebApplication/web/packages/logging/logging.dart':
Error: line 250 pos 24: wrong number of type arguments in type 'Comparable'
class Level implements Comparable<Level> {
^
Anyone have any ideas?
Got the same problem here, and after some time, i've decided to pay attention at the stack trace... It says "Wrong number of type arguments in type 'Comparable'". Then, i just opened "logging.dart" and changed this:
class Level implements Comparable<Level> {
to this:
class Level implements Comparable {
Don't know if i did right, but worked fine for me. If someone knows the right way to do it, please, let us know ;)
Click Dart Editor (menu item) -> About Dart Editor.
Click the Download Update button.
After the update has downloaded, install/apply the update.
After the installation is complete, go to Tools (menu item) -> Pub Install.
Go to Tools (menu item) -> Pub Update.
After doing those five steps, I am able to compile the code.

javac will not compile enum, ( Windows Sun 1.6 --> OpenJDK 1.6)

package com.scheduler.process;
public class Process {
public enum state {
NOT_SUBMITTED, SUBMITTED, BLOCKED, READY, RUNNING, COMPLETED
}
private state currentState;
public state getCurrentState() {
return currentState;
}
public void setCurrentState(state currentState) {
this.currentState = currentState;
}
}
package com.scheduler.machine;
import com.scheduler.process.Process;
import com.scheduler.process.Process.state;
public class Machine {
com.scheduler.process.Process p = new com.scheduler.process.Process();
state s = state.READY; //fails if I don't also explicitly import Process.state
p.setCurrentState(s); //says I need a declarator id after 's'... this is wrong.
p.setCurrentState(state.READY);
}
Modified the example to try and direct to the issue. I cannot change the state on this code. Eclipse suggests importing Process.state like I had on my previous example, but this doesn't work either. This allows state s = state.READY but the call to p.setCurrentState(s); fails as does p.setCurrentState(state.READY);
Problem continued.... Following Oleg's suggestions I tried more permutations:
package com.scheduler.machine;
import com.scheduler.process.Process;
import com.scheduler.process.Process.*;
public class Machine {
com.scheduler.process.Process p = new com.scheduler.process.Process();
public state s = Process.state.READY;
p.setCurrentState(s);
p.setCurrentState(state.READY);
}
Okay. It's clear now that I'm a candidate for lobotomy.
package com.scheduler.machine;
import com.scheduler.process.Process;
import com.scheduler.process.Process.state;
public class Machine {
public void doStuff(){
com.scheduler.process.Process p = new com.scheduler.process.Process();
state s = state.READY; //fails if I don't also explicitly import Process.state
p.setCurrentState(s); //says I need a declarator id after 's'... this is wrong.
p.setCurrentState(state.READY);
}
}
I needed to have a method in the class--but we're still missing something (probably obvious) here. When I go via the command line and run javac on the Machine class AFTER compiling Process, I still get the following error:
mseil#context:/media/MULTIMEDIA/Scratch/Scratch/src/com/scheduler/machine$ javac Machine.java
Machine.java:3: package com.scheduler.process does not exist
import com.scheduler.process.Process;
^
So I guess the question now becomes, what idiot thing am I missing that is preventing me from compiling this by hand that eclipse is doing for me behind the scene?
======
Problem solved here:
Java generics code compiles in eclipse but not in command line
This has just worked for me:
Download latest Eclipse
Create new project
Create two packages com.scheduler.process and com.scheduler.machine
Create class Process in package com.scheduler.process and class Machine in com.scheduler.machine and copy their contents from your post modifying them to conform to Java language syntax, like this:
Everything compiles right away.
------ to answer the previous version of the question ------
To answer the question as it is right now: you need to either
import com.scheduler.process.Process.status or import com.scheduler.process.Process.* and refer to status as just status
or
import com.scheduler.process.* or import com.scheduler.process.Process and refer to status as Process.status
------ to answer the original version of the question ------
You can't import classes that are not inside some package. You just can't. It is a compile time error to import a type from the unnamed package.
You don't need to import anything if your classes are in the same package, or if all of your classes are packageless.
If Process class was inside some package it would be possible to import just its status inner class: import a.b.c.Process.status would work just fine.
All your Windows/Linux migration issues don't have anything to do with Java and exceptions that you see. import Process.state; will produce exception on any OS because you can't import classes that don't belong to any package.
Eclipse doesn't use the Sun JDK by default. I would assume that you are using Eclipse's built in compiler as Sun's JDK and the OpenJDK are almost identical.
Java code compiles and runs exact the same on Windows and Linux most of the time (unless you use a few of the platform specific operations)
I suspect you are not building the code the same way and when you compile Machine, the Process class has not been compiled.
I suggest you use a standard build system like maven or ant and it will build the same everywhere. Failing that run Eclipse on Linux or just the same .class you use on windows as they don't need to be re-compiled in any case.
BTW: You don't need to import Process.state as it not used and its in the same package (so you wouldn't need to if you did)

Resources