Use of Erfc function: commons.apache.org library - java

My problem is simple: I would like to use the error function Erfc(double) in Java with Eclipse but I do not want to implement it (because it is complicated).
So, I have found this:
http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/special/Erf.html
That does exactly what I want. The problem is that I can not use it. As it is not from "docs.oracle.com", I can not just import it. But unfortunately, I can not include the library and use it neither because what I download from :
http://commons.apache.org/proper/commons-math/download_math.cgi
is not a .jar
Does someone know how to "install - use" it?
I use Ubuntu 12.04 on a Intel® Core™ i7-3610QM CPU # 2.30GHz × 8 and my IDE is ecplipse.

Ok, this was a stupid question! So I have found the answer by myself.
I just needed to download the binary files and add it as a .jar. Then it works as a classical library.
To use it, I must
import org.apache.commons.math3.*;

Related

installing openimaj's statistic package

I followed the instructions on this page - http://www.openimaj.org/tutorial/getting-started-with-openimaj-using-maven.html and created a project. However, it's missing org.openimaj.math.statistics package. I just wanted to use MeanAndCovariance method. How do I install this missing package? I'm on osx (Mountain Lion)
I just found out that I really don't need to follow that instruction that basically installed whole lot of unnecessary package. All I need is, download core-math jar file from this link - http://mavensearch.io/repo/org.openimaj/core-math/1.3 and adds to my project. Vola works like charm!

Java look into API method

Is there a way to look into originally given methods by API?
I am a beginner in programming and sometimes feel like taking huge shortcuts when using given methods and not really having an idea what tools i would use if i had to write it on my own.
Thanks in advance for given advices.
You want to look into Java code?
Here is a snapshot to attach java documentation and source code
Click Windows
Click Preferences
Click Java
Click Installed JRE
See the image for more steps
After you clarified your question, I think I can suggest you a solution. Let's suppose that you want to see what java.util.Collections.reverse(List list) do! When you downloaded the JDK you downloaded the sources too. You can find it here (or else to where you placed) for example for JDK8: C:\Program Files\Java\jdk1.8.0_66 => src.zip In this zip file you can find \java\util directories and inside this you can find Collections.java and inside this you can find the reverse(List list) method in JAVA source format. (Anyway, you can find the bytecode of this example method too in the rt.jar...but I think you shouldn't bother yourself with it if you are a beginner.) I hope I could help.

Cannot resolve com.parse.ParseQueryAdapter

My current setup :
OS : windows 7
IDE : Android Studio (with updated SDKs)
Parse jar (v 1.10)
I am trying out an example for ParseQueryAdapter, and I run into this error on my IDE : import com.parse.ParseQueryAdapter; -> cannot resolve symbol ParseQueryAdapter
I want to try something similar to this example, and the import does not seem to go through because of the error.
If you need anymore information, please leave comments & I will respond.
PS : I am able to add com.parse.ParseObject without errors.
In your libs folder you'll find Parse-1.4.1.jar file.
Right click or control+click on it then 'Add as Library...'
Edit: Parse-1.10 does not have ParseQueryAdapter. You have to use Parse-1.4.1, which is included in that example.
ParseQueryAdapter was removed from the official Parse SDK and moved onto the Parse-UI libraries..
You can install them on via this link: https://github.com/ParsePlatform/ParseUI-Android
If we include 1.4.1, and keep 1.10.1 as well, it gives error because we cannot keep the same jar with two versions in the libs folder. And I think its not advisable to use just 1.4.1. I feel that ParseQueryAdapter is deprecated and we would just have to use the normal adapters. Any comments?

add extra resources to the library

I am new to Java, so, my question may be so simple for you. But I am trying to solve this issue for ages.
I am not writing my code. It is from MATSim. Their codes have two versions: one from 2009, and the other from 2013.
please see this screenshot:
If tis picture does not work please see it via tweeter: ScreenShot
I have downloaded the 2013 version and added its library according to the guidelines. BUT the code up in Eclipse is a code from 2009 and as you can see some of the classes needed for this code is removed from the 2013 library.
***>>>>>>For example, this one is not in the library:..... import org.matsim.core.scoring.PlanScorer;<<<<<<<<<<<***
import org.matsim.knowledges.Knowledges;
import org.matsim.locationchoice.constrained.LocationMutatorwChoiceSet;
import org.matsim.locationchoice.constrained.ManageSubchains;
import org.matsim.locationchoice.constrained.SubChain;
import org.matsim.planomat.Planomat;
import org.matsim.planomat.costestimators.DepartureDelayAverageCalculator;
import org.matsim.planomat.costestimators.LegTravelTimeEstimatorFactory;
import org.matsim.population.algorithms.PlanAlgorithm;
**>>>>>>> or these specific classes: ..... import playground.mfeil.MDSAM.ActivityTypeFinder;
import playground.mfeil.config.PlanomatXConfigGroup;<<<<<<<<<<**
Fortunately I found their .java files from their archive. I tried to put them in the .jar folder and add them to the library via >>> properties/Java Build Path. But this didn't work for me.
I wonder if you help me in this matter. Please if you know how to do it, help me in how to change the path of files in the above code too. Is it enough just to change the path manually?
Your help is much appreciated.
Thank you,
Somayeh
Guessing around from the information you gave...
Option A:
According to MATSim's issue tracker, planomat does not exist anymore. The preferred way of replanning is adding smaller strategies to the MATSim config that change only one dimension at a time (instead of the best-response planomat). Check out the latest MATSim user guide chapter 7 for the strategies available and how to use them. The user guide is shipped with the latest release.
Option B:
If you really need planomat, fetch an older MATSim build. Planomat should then be part of the MATSim core. So there is no need of adding the playground of mfeil to your build path. Again, I do not recommend this. The preferred way is option A.
There is not really sufficient information here, so I'm going to guess a little bit about what you are doing and what the problem is. It is really helpful if you say "I got this error message at compile time (or runtime) and here it is, and then paste that into the post. Otherwise we're left guessing.
I think you have two versions of a library that you are trying to use from code that you did not write, and that the code uses one of the versions but you have the library for the other one. (Again, this is stuff you could put into questions to make them more complete "I have version 2009, there is another version from 2013...").
You should not need source code for the modules you do not have; in particular, it would be a bad idea to use source code just for those that aren't found in one version and the other version's library -- they are bound to be incompatible.
Java libraries are generally distributed as 'jar' files (extension of jar); I think your problem might be solved if you have a jar file for the library version being used and put it on a "classpath" so your compiler and runtime can find it.
We'll be happy to help you set a path to use a different version of the library, but you have to tell us how you're compiling. There are several popular IDEs (eclipse, IntelliJ, others) and the ol' command-line special. The setting of paths for these are all different.

String cannot be resolved to a type - Java RAD

I've recently started developing in Java (coming from .Net). The IDE I am using is RAD 7.3.
After importing a project, which I need to do some enhancements on, I am receiving this error:
"String cannot be resolved to a type"
This applies to all variables of the String data type, as well as any methods that take string arguements. I'm very inexperienced with Java so I'm not sure how to go about fixing this. My guess is that it has something to do with the way RAD was installed, and that required libraries are missing. Again, not sure how to address that.
Any help or guidance would be much appreciated! Thank you
My guess is you miss the JRE Runtime Library in your project. But this would cause all the java.* classes to generate this message! Can you post your code so we can see what might be the problem?
try doing :
right-click on your project.
->properites
->java Build Path
->tab Librairies
check if the JRE System Library is there.
i am a beginner. i am using Eclipse and got stuck at the Hello World code. Got same error description and also error stating can't resolve 'system'.
After staying frustrated for few hours, as I checked JRE library path and stuff, I just Capitalized 'S' of 'string' and 'system'.. and bang.. problem solved. I hope this helps.
I don't know if this helps anyone, but here I go.
I had the same problem just now in Visual Studio Code (I am on Linux). On my java.home, I had the options in my directory of:
/usr/lib/jvm/java-8-openjdk-amd64
/usr/lib/jvm/java-1.8.0-openjkd-amd64
I had the first one as default, but when I switched to the second one, it all started working properly.
You need to capitalize the "s" in the string.
Another way to solve this problem is in the following way.
Right click on the project-->properties-->Java build path-->go to the
library option
and delete or remove the library that is in error, after this you select add library and download the library that you deleted and ready.
error- string cannot be resolved to a type
Here in the declaring the method "string" in bold is lower case.
Change string to upper case.
Example:
public static string howManyPass(double grd1, double grd2) {
}

Categories