I have a Scala file and I am using Play Framework 2.0.4 to compile it. Here is a part of it
import play.api.templates.Html;
import play.api.templates.Txt;
import securesocial.controllers.Registration.RegistrationInfo;
import securesocial.controllers.TemplatesPlugin.
import securesocial.core.{SecuredRequest, SocialUser};
import play.api.data.Form;
import securesocial.core.Identity;
import securesocial.core.SecureSocial._;
import securesocial.controllers.PasswordChange.ChangeInfo;
At compile time I get this error
identifier expected but 'import' found.
What is the issue here?
Could it be import securesocial.controllers.TemplatesPlugin.: the trailing dot?
Either remove the dot or make it import securesocial.controllers.TemplatesPlugin._
Related
I'm trying to use QTree and QTreeSemigroup in the algebird package but am unable to import them in the spark-shell.
I tried both:
spark-shell --jars ~/jars/algebird-core_2.10-0.1.11.jar
SPARK_CLASSPATH="~/jars/algebird-core_2.10-0.1.11.jar" spark-shell --jars ~/jars/algebird-core_2.10-0.1.11.jar
and I'm able to successfully import algebird like this:
import com.twitter.algebird._
But when I try to import Qtree I get that they are not members of the algebird package:
scala> import com.twitter.algebird.QTree
<console>:22: error: object QTree is not a member of package com.twitter.algebird
import com.twitter.algebird.QTree
^
scala> import com.twitter.algebird.QTreeSemigroup
<console>:22: error: object QTreeSemigroup is not a member of package com.twitter.algebird
import com.twitter.algebird.QTreeSemigroup
What gives?! Anyone seen this before?
Figured it out, I was using an old version of algebird. Works with the latest.
I read the source code of KMeans.scala in spark and it confused me with the following code:
import org.apache.spark.Logging
import org.apache.spark.annotation.Experimental
import org.apache.spark.mllib.linalg.{Vector, Vectors}
import org.apache.spark.mllib.linalg.BLAS.{axpy, scal}
import org.apache.spark.mllib.util.MLUtils
import org.apache.spark.rdd.RDD
import org.apache.spark.storage.StorageLevel
import org.apache.spark.util.Utils
import org.apache.spark.util.random.XORShiftRandom
I found the file RDD is in the path "spark-1.4.0\core\src\main\scala\org\apache\spark\rdd" which corresponds to import org.apache.spark.rdd.RDD. But the file MLUtils is in the path "spark-1.4.0\mllib\src\main\scala\org\apache\spark\mllib\util" which corresponds to import org.apache.spark.mllib.util.MLUtils.
Why their import paths start with "org.apache.spark"? It seems they are in the same folder "spark".
Why do their import paths start with "org.apache.spark"?
Path to the source file doesn't determine the package it belongs to, package declarations in it do. Nonetheless, it's standard (and useful in some ways) to put source files in the directory corresponding to the package, under src/main/scala or <subproject(core and mllib in these two cases)>/src/main/scala. Relative to it you can see the directories are org/apache/spark/rdd and org/apache/spark/mllib/util, just as in imports.
I am new to Teamsite and a not sure which jar file to use for resolving the issue that I get while trying to write a Java Datasource in Eclipse.
The list of imports I am using are:
import com.interwoven.datasource.MapDataSource;
import com.interwoven.datasource.core.DataSourceContext;
import com.interwoven.livesite.dom4j.Dom4jUtils;
import com.interwoven.serverutils100.InstalledLocations;
import com.interwoven.cssdk.filesys.CSVPath;
All these imports show the same error
The import com.interwoven cannot be resolved.
Can anyone please tell me which jar files should I add?
import org.apache.tomcat.util.http.fileupload.DiskFileUpload;
In my Eclipse said import org.apache.tomcat.util.http.fileupload.DiskFileUpload cannot resolved.
Even import jar commons-fileupload-1.2.2
import org.apache.tomcat.util.http.fileupload.FileItem;
import org.apache.tomcat.util.http.fileupload.FileUpload;
import org.apache.tomcat.util.http.fileupload.FileUploadException;
But above three does"nt gives error..Why?
please check if you have coyote.jar or tomcat-coyote.jar in your classpath as this error is not a commons-fileupload-1.2.2.jar error.
Suppose I have such packages:
package test
package test.views
package test.others
package views
Now in a scala file, I want to import test._ and views._(not test.views._), so I write:
import test._
import views._
But when I use some classes under views._, it reports type xxx not found, unless I change views package to another name.
What should I do now?
You can switch package import order (theoretically it should work):
import views._
import test._
Or you can be more precise in views import:
import _root_.views._
Here's yet another way (though using _root_ is the surest way to go):
import test.{views => testviews, _}
import views._