danielkorzekwa / atpworldtour-api

Scala API for atpworldtour.com tennis statistics
52 stars 18 forks source link

Atpworldtour Api #10

Open IspasCapital opened 12 years ago

IspasCapital commented 12 years ago

Hi,

could you please give me a quick explanation of how to run your atpworldtour-api? I tried running it but get some error messages.

Thanks a lot.

danielkorzekwa commented 12 years ago

At the project home page I added short instruction on how to download all tennis matches for a given year to csv file: https://github.com/danielkorzekwa/atpworldtour-api.

What kind of information do you need, are you a developer, do you know how to run Scala code?

IspasCapital commented 12 years ago

I saw the short instruction. Basically, what I did so far is to save down the scripts that you wrote and then run the script in your short instruction. I am using scalaedit and I am getting the following errors:

the following lines in GenericTournamentAtpApi:

val List(playerATotalServicePoints, playerATotalServicePointsWon) = totalServicePointsWonText.child(0).text.split("\D").takeRight(2).map(.toInt).toList val List(playerBTotalServicePoints, playerBTotalServicePointsWon) = totalServicePointsWonText.child(1).text.split("\D").takeRight(2).map(.toInt).toList

val List(winner, playerA, playerB) = matchStatsDoc.getElementsByClass("playerName").map(e => e.text).toList

produce the following error messages: recursive vale x$4 needs type, recursive vale x$6 needs type, recursive vale x$6 needs type

I would need the most detailed data I can get...and I would like to be able to run it by myself so that I can update it weekly.

Thanks

danielkorzekwa commented 12 years ago

You are seeing joda and jsoup errors as you probably don't have those dependencies included in your class path while running atp-api example application.

Look here https://github.com/danielkorzekwa/atpworldtour-api/blob/master/pom.xml under dependencies section.

You can either download all required dependencies from http://mvnrepository.com/ or use maven, http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

Personally what I do is:

1) Get project from git hub. 2) Run mvn eclipse:eclipse - this generates eclipse project. 3) Import atp-api project into eclipse (before that, install Eclipse Scala plugin from here: http://scala-ide.org/) 4) Create a new Scala project in Eclipse and add the atp example application there. 5) Add dependency between newly created project and imported atp-api project. 6) Run atp application.

If you know how do all those steps and have Maven, Eclipse, Github and Eclipse Scala plugin already installed, it's less than 2 minutes.

IspasCapital commented 12 years ago

Ok thanks for that!

IspasCapital commented 12 years ago

Ok, so far what I did is...I got maven, eclipse, and eclipse scala plugin. I can run 2) but I am not sure about 3). I basically saved all the scala files you created in a zip file in the path where I generated the eclipse project from 2). But if I go on File --> import and select the zip file I get an error message in eclipse "Cannot import into a workspace with no open projects. Please create a project before importing."

Do you what the problem is? Could you also please elaborate on how to build the dependencies in step 5)?

Thanks a lot

IspasCapital commented 12 years ago

Ok, I set everything up as you described. I have all dependencies included but still see the erros:

object joda is not a member of package org object jsoup is not a member of package org

In GenericTournamentAtpApi, I also still see the errors in line 89, 90, 92 "recursive value needs type".

Any ideas?

IspasCapital commented 12 years ago

Any ideas, what the problem is or where I can find help? thanks

eclipse.buildId=M20110210-1200 java.version=1.6.0_32 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE Command-line arguments: -os win32 -ws win32 -arch x86_64

Error Mon Apr 30 22:28:47 BST 2012 Crash in the build compiler.

java.lang.Error at scala.tools.nsc.symtab.SymbolTable.abort(SymbolTable.scala:35) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:737) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4273) at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:4430) at scala.tools.nsc.typechecker.Typers$Typer.typedValDef(Typers.scala:1567) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3918) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:731) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4273) at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184) at scala.collection.immutable.List.loop$1(List.scala:117) at scala.collection.immutable.List.mapConserve(List.scala:133) at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184) at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1512) at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1278) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3912) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:731) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4273) at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184) at scala.collection.immutable.List.loop$1(List.scala:117) at scala.collection.immutable.List.mapConserve(List.scala:133) at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3908) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:731) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4273) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4333) at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anonfun$transform$1.apply(Erasure.scala:1182) at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anonfun$transform$1.apply(Erasure.scala:1177) at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:95) at scala.tools.nsc.transform.Erasure$ErasureTransformer.transform(Erasure.scala:1177) at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:892) at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30) at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:329) at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:297) at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:297) at scala.collection.Iterator$class.foreach(Iterator.scala:660) at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:316) at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:297) at scala.tools.nsc.Global$Run.compileSources(Global.scala:953) at scala.tools.nsc.Global$Run.compile(Global.scala:1038) at xsbt.CompilerInterface.run(CompilerInterface.scala:106) at scala.tools.eclipse.buildmanager.sbtintegration.ScalaSbtCompiler.compile(ScalaSbtCompiler.scala:35) at scala.tools.eclipse.buildmanager.sbtintegration.AnalysisCompile$$anonfun$8.compileScala$1(AnalysisCompile.scala:124) at scala.tools.eclipse.buildmanager.sbtintegration.AnalysisCompile$$anonfun$8.apply(AnalysisCompile.scala:162) at scala.tools.eclipse.buildmanager.sbtintegration.AnalysisCompile$$anonfun$8.apply(AnalysisCompile.scala:99) at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:21) at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:19) at sbt.inc.Incremental$.cycle(Incremental.scala:33) at sbt.inc.Incremental$.compile(Incremental.scala:20) at sbt.inc.IncrementalCompile$.apply(Compile.scala:17) at scala.tools.eclipse.buildmanager.sbtintegration.AnalysisCompile.doCompile(AnalysisCompile.scala:180) at scala.tools.eclipse.buildmanager.sbtintegration.EclipseSbtBuildManager.runCompiler(EclipseSbtBuildManager.scala:360) at scala.tools.eclipse.buildmanager.sbtintegration.EclipseSbtBuildManager.update(EclipseSbtBuildManager.scala:327) at scala.tools.eclipse.buildmanager.sbtintegration.EclipseSbtBuildManager.build(EclipseSbtBuildManager.scala:389) at scala.tools.eclipse.ScalaProject.build(ScalaProject.scala:697) at scala.tools.eclipse.ScalaBuilder.build(ScalaBuilder.scala:107) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:311) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:343) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:242) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

danielkorzekwa commented 12 years ago

You shouldn't zip anything.

After getting project from github, go to directory with src and pom.xml file and run inside this directory mvn eclipse:eclipse. This command should generate .project and ,classpath files. Then import project into eclipse pointing to a directory containing src, pom.xml, .project and .classpath files.

IspasCapital commented 12 years ago

Yes, that's what I did, pls ignore previous post.

I got project from github, run mvn eclipse:eclipse in directory where project is. Then I import the project in eclipse and create new project with the application containing the code of the atp example. I create dependencies between the two projetcs by referencing the atpworldtour-api in the build path of the atp-example project. Afterwards, I get the above error: compiler crashed.

danielkorzekwa commented 12 years ago

Does this compilation error happen every time?

Can you create a Scala project with hello world app only and run it successfully?

Which Eclipse version and Scala IDE plugin have you installed?

PS. Now you are very close to make it running.

IspasCapital commented 12 years ago

Hello world runs without any problems. I have eclipse helios 3.6.2 and Scala IDE for scala 2.9.2 which is my scala version. The error I get in the console is the following: java.lang.NoClassDefFoundError: dk/test/MatchesLoadSimple Caused by: java.lang.ClassNotFoundException: dk.test.MatchesLoadSimple at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Exception in thread "main"

And in the error log I get the error I posted above. Do you have any suggestions?

Thanks a lot for your help.

danielkorzekwa commented 12 years ago

Don't you have compilation problem with dk.test.MatchesLoadSimple?

Send to me atp-example eclipse project zipped by email. daniel korzekwa at gmail and I will have a look.

IspasCapital commented 12 years ago

Hi, I just got it to work. Thanks a lot!!!