import com. ... cannot be resolved issue - import

I found a carousel source code from internet.
Instead of importing project, I copied it to my project and pasted in the library files.
However, I still have an error on the line:
import com.arduandro.CarouselView.R;
How can I fix it?
Problem occurs on the second line of the following code:
import com.nineoldandroids.view.ViewHelper;
import com.arduandro.CarouselView.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

Are you using Eclipse? If yes, you have to import the .jar and add it to the build path

Related

ImportError: cannot import name 'compute_associations' from 'dython.nominal'

I just installed dython using pip install dython to use the tabsyndex. Here is the block of import
import pandas as pd
from tabsyndex import tabsyndex
from sklearn.model_selection import train_test_split
and it always shows
ImportError: cannot import name 'compute_associations' from 'dython.nominal'
Are there any way to import compute associations?
So far I tried reinstalling dython, but it always show the same error.

A confusion about import in Spark

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.

Error in compilation of scala file in play

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._

Eclipse "organize imports" changes the order of existing imports

Using Eclipse Juno (3.8/4.2), when I press ⇧⌘O (shift+ctrl+o), it organizes imports according to the Organize Imports preferences; fine.
Now imagine I'm working on some source code I checked out from SVN, and I add some code depending on new classes, I'd like Eclipse to add the new imports, WITHOUT messing with the existing order of imports (for commit's clarity sake)
for example :
package toto;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.sun.jersey.api.client.AsyncWebResource;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.json.JSONConfiguration;
will be organized in :
package toto;
import com.sun.jersey.api.client.AsyncWebResource;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.json.JSONConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
according to my preferences.
I want to avoid that, I just want to add the imports necessary for the new code I added (I don't want to organize already existing imports), is there something else than Organize Imports to do that ? (I know I can click on the error hint on the left of my new code needing a new import to add it, but I'd like a keyboard shortcut instead)
thanks for your help!
Use CtrlShiftM on an error marker to fix a missing import, repeat by jumping to the next error with Ctrl.. There is no other possibility to fix all imports in one go than organizing them (which you don't want).
This is not a single keyboard shortcut, but you can do what you describe in a series of steps using the keyboard only:
Press Ctrl+. to go to the next error in the code
Press Ctrl+1 to display the quick fixes
Press Enter to add the import.

Error in uploading file from diskfileupload

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.