Runnig Twiiter Cassovary Examples in eclipse - eclipse

I have imported the Twitter Cassovary into Eclipse form Git Hub but not sure how to run the examples.Please advise as I am new to eclipse as well as scala

I imported the project, opened a benchmark (cassovary-benchmarks/src/main/java/GraphGenerationBenchmarks) and used Run as->Scala application.
You can also do this from the command line. Start sbt in the main project directory, choose subproject cassovary-benchmarks and then use run. You will be asked which benchmark to run.
➜ twitter-cassovary git:(master) ✗ ls
README.md cassovary-examples project
cassovary-benchmarks cassovary-server sbt
cassovary-core lib_managed target
➜ twitter-cassovary git:(master) ✗ sbt
Loading /Users/szymon/bin/sbt-launch-lib.bash
[info] Loading global plugins from /Users/szymonmatejczyk/.sbt/0.13/plugins
[info] Loading project definition from /Users/szymon/oss/twitter-cassovary/project
[info] Set current project to cassovary (in build file:/Users/szymon/oss/twitter-cassovary/)
> project cassovary-benchmarks
[info] Set current project to cassovary-benchmarks (in build file:/Users/szymon/oss/twitter-cassovary/)
> run
[info] Compiling 12 Scala sources to /Users/szymon/oss/twitter-cassovary/cassovary-core/target/scala-2.11/classes...
[info] Compiling 56 Scala sources to /Users/szymon/oss/twitter-cassovary/cassovary-core/target/scala-2.11/classes...
[info] Compiling 2 Scala sources to /Users/szymon/oss/twitter-cassovary/cassovary- benchmarks/target/scala-2.11/classes...
[warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list
Multiple main classes detected, select one to run:
[1] com.twitter.cassovary.PerformanceBenchmark
[2] com.twitter.cassovary.SubsetSamplingBenchmarks
[3] com.twitter.cassovary.GraphGenerationBenchmarks
[4] com.twitter.cassovary.utils.FastUtilsWrappingBenchmark
Enter number:

Related

Issue with installing CMAK - kafka manager

I am trying CMAK on ubuntu 20.4 and I am following instruction on https://github.com/yahoo/CMAK and https://codeforgeek.com/setting-up-kafka-management-for-kafka-cluster/. After running command ./sbt clean dist and trying to switch to directory /target/ in am not seeing universal directory. Is there any thing I am missing?
Please see below screenshot.
After running: ./sbt clean dist. I am getting below result.
root#ubuntu-s-1vcpu-1gb-blr1-01-testing-server:/opt/CMAK-master# ./sbt clean dist
[info] Loading settings for project cmak-master-build from plugins.sbt ...
[info] Loading project definition from /opt/CMAK-master/project
[info] Loading settings for project root from build.sbt ...
[info] Set current project to cmak (in build file:/opt/CMAK-master/)
[success] Total time: 1 s, completed Apr 4, 2021, 10:40:07 AM
Warning: node.js detection failed, sbt will use the Rhino based
Trireme JavaScript engine instead to run JavaScript assets compilation, which in some cases may be orders of magnitude slower than using node.js.
[info] Wrote /opt/CMAK-master/target/scala-2.12/cmak_2.12-3.0.0.5.pom
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] Main Scala API documentation to /opt/CMAK-master/target/scala-2.12/api...
[info] Compiling 136 Scala sources and 2 Java sources to /opt/CMAK-
master/target/scala-2.12/classes ...
model contains 640 documentable templates
[info] Main Scala API documentation successful.
[info] LESS compiling on 1 source(s)
./sbt: line 241: 7926 Killed "$#"
root#ubuntu-s-1vcpu-1gb-blr1-01-testing-server:/opt/CMAK-master#
| => root / Web-assets / less 122s
| => root / Compile / compileIncremental 352s
After that when navigating to target directory, there is no universal directory.
root#ubuntu-s-1vcpu-1gb-blr1-01-testing-server:/opt/CMAK-master# ls
LICENSE README.md app build.sbt conf img project public sbt
src target test
root#ubuntu-s-1vcpu-1gb-blr1-01-testing-server:/opt/CMAK-master# cd target/
root#ubuntu-s-1vcpu-1gb-blr1-01-testing-server:/opt/CMAK-
master/target# ls
scala-2.12 streams web / less 122s
root#ubuntu-s-1vcpu-1gb-blr1-01-testing-server:/opt/CMAK-master/target# ls
scala-2.12 streams web
root#ubuntu-s-1vcpu-1gb-blr1-01-testing-server:/opt/CMAK-master/target#

Why does the sbt ~compile command do not recompile on code change?

I currently have a problem with recompile on code change with sbt.
I was following the sbt reference 'sbt by example'
I installed sbt 1.2.8 and followed the instructions:
Create a minimum sbt build
$ mkdir foo-build
$ cd foo-build
$ touch build.sbt
Start sbt shell
$ sbt
[info] Loading global plugins from C:\Users\hce\.sbt\1.0\plugins
[info] Loading project definition from E:\learn\Scala\demo\foo-build\project
[info] Loading settings for project foo-build from build.sbt ...
[info] Set current project to foo-build (in build file:/E:/learn/Scala/demo/foo-build/)
[info] sbt server started at local:sbt-server-57c501e502d72a00d890
Recompile on code change (Note the ~ prefix before the compile command)
sbt:foo-build> ~compile
[success] Total time: 0 s, completed Jul 6, 2019 12:01:24 PM
1. Waiting for source changes in project foo-build... (press enter to interrupt)
Create a source file
Leave the previous command running. From a different shell or in your file manager create in the project directory the following nested directories: src/main/scala/example. Then, create Hello.scala in the example directory using your favorite editor as follows:
package example
object Hello extends App {
println("Hello")
}
This new file should be picked up by the running command. But it is not working on my system.
Expected Behaviour:
[info] Compiling 1 Scala source to /tmp/foo-build/target/scala-2.12/classes ...
[info] Done compiling.
[success] Total time: 2 s, completed May 6, 2018 3:53:42 PM
2. Waiting for source changes... (press enter to interrupt)
Here are some Information about my environment
$ java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
$ sbt sbtVersion
[info] Loading global plugins from C:\Users\hce\.sbt\1.0\plugins
[info] Loading project definition from E:\learn\Scala\demo\foo-build\project
[info] Loading settings for project foo-build from build.sbt ...
[info] Set current project to foo-build (in build file:/E:/learn/Scala/demo/foo-build/)
[info] 1.2.8
$ systeminfo.exe | grep '^OS'
OS Name: Microsoft Windows 10 Enterprise LTSC
OS Version: 10.0.17763 N/A Build 17763
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
What I already tried:
reinstall sbt
try it with windows commad line
try it mingw64 bash
What am I missing to run the sbt ~compile command correctly?
I found the answer.
The instruction contains an error.
We are supposed to put the src/main/scala/example directory in the project directory.
From a different shell or in your file manager create in the project directory the following nested directories: src/main/scala/example.
But this leads to the problem described. foo-build/project/ is for build definition code.
If I put the src/main/scala/example directory in the foo-build directory it is working.
I should have executed the run command beforehand, which gives the 'No main class detected' error. Which in turn helped to discover, that the directory structure was incorrect by reading the following stackoverflow question: how to set main class in sbt project .
My mistake. Sorry for bothering you.

Can not reflect changes using gwt-maven-plugin superdev

Follow steps in this post,
I use gwt-maven-plugin 2.6.0, when I run mvn gwt:run-codeserver it compiled successfully:
[INFO] binding: user.agent=safari
[INFO] Compiling module com.example.myModule
[INFO] Validating units:
[INFO] Ignored 3 units with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO] ...
[INFO] Compiling 1 permutation
[INFO] Compiling permutation 0...
[INFO] Source Maps Enabled
[INFO] Compile of permutations succeeded
[INFO] Linking into C:\Users\admin\AppData\Local\Temp\gwt-codeserver-5664784549647002986.tmp\com.example.myModule\compile-4\war\myModule;
Writing extras to C:\Users\admin\AppData\Local\Temp\gwt-codeserver-5664784549647002986.tmp\com.example.myModule\compile-4\extras\myModule
[INFO] Link succeeded
[INFO] Compilation succeeded -- 3.401s
[INFO] Compile completed in 3496 ms
Then I started the dev server using mvn install gwt:run, made changes on my source file and click the Dev Mode On bookmark. After compiling the changes cannot reflect to UI: the UI always show old values.
Any ideas on this problem?
There's a bug in gwt-maven-plugin up to (including) 2.6.0; you have to run mvn process-classes gwt:run-codeserver instead of just mvn gwt:run-codeserver. This is fixed in 2.6.1.
Also, if you change anything in src/main/resources, you'll have to run mvn process-resources to make your changes available to Super Dev Mode (this is because you might use resource filtering, so Super Dev Mode doesn't directly look at src/main/resources).
Similarly, if you use plugins that generate resources or Java sources, you'll have to run them manually (e.g. mvn generate-sources or mvn generate-resources; or just use the same mvn process-resources as above, which will do everything at once). This will be necessary for example if you use gwt:generateAsync and change your GWT-RPC interface (note that you'll also have to redeploy your server-side code).
Note: I just updated my answer in the linked post for GWT 2.6.0, and added a note about GWT-RPC, and the gwt-maven-plugin bug.

How to use plugin in sbt project when only the plugin's sources available?

I want to use the sbt-scrooge plugin, but its repo is unavailable now - http://koofr.github.com/.
I thought I'd include this plugin's source code directly in my own repo (as a git submodule).
I tried:
git submodule add https://github.com/bancek/sbt-scrooge.git project/sbt-scrooge
and added:
addSbtPlugin("net.koofr" % "sbt-scrooge" % "3.0.45")
to project/plugins.sbt. But it doesn't work - the following exception is thrown:
sbt.ResolveException: unresolved dependency: net.koofr#sbt-scrooge;3.0.45: not found
What's the right way to do that?
I know that I could checkout sbt-scrooge to the local filesystem, then sbt publish-local, and add the local ivy2 repo to sbt as a resolver. But I just want to know whether there are other ways to do this.
As explained here you can puth this in your project/plugins.sbt:
lazy val root = project.in(file(".")).dependsOn(scroogePlugin)
lazy val scroogePlugin = file("sbt-scrooge")
Or simply (without creating a local submodule):
lazy val root = project.in(file(".")).dependsOn(scroogePlugin)
lazy val scroogePlugin = uri("https://github.com/bancek/sbt-scrooge.git")
If you want to use a plugin it has to be available to sbt (and somehow finds its place in your local repository so addSbtPlugin can eventually find it or the project (sub)project of your sbt project should have it on the classpath).
Be adviced that not all plugins should be an integral part of a sbt project. Quite the contrary - they can be used in a project, but that doesn't necessarily mean they should be referenced by any project-specific files (within the project's directory), e.g. plugins to generate IDE-specific files. These plugins should be part of the global configuration in ~/.sbt under plugins.
There's also the issue of version mismatch between plugins and sbt. In your case, sbt-scrooge supports 0.12.2 (see project/build.properties) that might be unusable in sbt 0.13+.
With that said, I think the "right way" in your case since the sbt-scrooge plugin seems no longer maintained is to fork the project and maintain yourself in your own repository. sbt 0.13.1 is already the latest version, and the plugin may not yet support it. When the plugin gets new life with your fork other developers might benefit from the resurrection, too and having the sources attached to another project would only hinder reusability.
The answer to a similar question has helped me to offer a working solution that works with sbt 0.12.2 and without cloning the git repository.
$ cat project/build.properties
sbt.version=0.12.2
$ cat project/project/SbtScroogePlugin.scala
import sbt._
object SbtScroogePlugin extends Build {
lazy val plugins = Project("plugins", file(".")) dependsOn sbtScroogePlugin
lazy val sbtScroogePlugin = uri("https://github.com/bancek/sbt-scrooge.git")
}
$ cat sbt-scrooge.sbt
import net.koofr.sbt._
seq(CompileThriftScrooge.newSettings: _*)
With the project files above, sbt should be able to use the tasks and settings of the sbt-scrooge plugin.
$ sbt
[info] Loading global plugins from /Users/jacek/.sbt/plugins
[info] Loading project definition from /Users/jacek/sandbox/tmp/sample-project/project/project
[info] Loading project definition from /Users/jacek/.sbt/staging/52a2b7ff1377492a32ff/project
[info] Loading project definition from /Users/jacek/sandbox/tmp/sample-project/project
[info] Set current project to default-fe8e50 (in build file:/Users/jacek/sandbox/tmp/sample-project/)
> about
[info] This is sbt 0.12.2
[info] The current project is {file:/Users/jacek/sandbox/tmp/sample-project/}default-fe8e50
[info] The current project is built against Scala 2.9.2
[info] Available Plugins: org.sbtidea.SbtIdeaPlugin, com.timushev.sbt.updates.UpdatesPlugin, net.koofr.sbt.CompileThriftScrooge
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.2
> scrooge-version
[info] 3.0.43
For the other tasks and settings, write scrooge- and hit TAB.
> scrooge-[TAB]
scrooge-build-options scrooge-cache-folder scrooge-fetch scrooge-gen
scrooge-jar scrooge-name scrooge-thrift-external-source-folder scrooge-thrift-include-folders
scrooge-thrift-namespace-map scrooge-thrift-output-folder scrooge-thrift-source-folder scrooge-thrift-sources
scrooge-unpack-deps scrooge-version

How to run Lift's 'Ecommerce example' app

I'm new to Scala and Lift and SBT. I've cloned Ecommerce example from Lift's sample applications.
Now I want to simply run the application.
Documentation says, that container:start should start the app. But I'm getting error:
> container:start
[error] No action named 'container:start' exists.
[info] Execute 'help' for a list of commands or 'actions' for a list of available project actions and methods.
[info]
[info] Total time: 0 s, completed 25.05.2013 16:47:05
I guess that maybe it's because version difference.
[info] using LiftProject with sbt 0.7.5 and Scala 2.7.7
How can I start this application ?
And if it's caused by version difference is it possible to upgrade the application to latest sbt and scala version ?
Update
I've tried to use jetty-start and received another error:
> jetty-start
[error] No action named 'jetty-start' exists.
[info] Execute 'help' for a list of commands or 'actions' for a list of available project actions and methods.
I've also found another similar command jetty-run from sbt help. When I run it I'm getting a huge number of compilation errors. It seems like my scala 2.9.2 cannot compile the code.
This project, as far as I see, uses the old SBT version. The old way to start the web application is:
./sbt
> jetty-start
if you want to reload the app on source change, use ~ jetty-start
Note that there's a far more up to date liftweb project example here: https://github.com/lift/lift_25_sbt
probably sbt did not download the requried jar files.
run the following command
> sbt
> update
now sbt should download the requried jar files
>jetty-run
now sbt should compile and run the web-app.