I'm new to Kotlin so forgive me if this is an easy question. I'm writing a kotlin script that I hope will utilize a custom Hashtable implementation to store data from a file. I'm having trouble getting the script to find the HashTable class.
Here is my structure:
.
├── scripts
│ ├── kotlin
│ │ ├── [other scripts]
│ │ └── wordcount.kts
│ └── tests
│ └── wc
│ └── smallfile.txt
└── src
├── main
│ └── kotlin
│ └── dataStructures
│ └── HashTable.kt
└── test
The script is wordcount.kts and the class I'm trying to import is in HashTable.kt. I tried import dataStructures.HashTable and import kotlin.dataStructures.HashTable to no avail. I also tried adjusting the PWD (in IntelliJ runtime configuration) to the project directory, also with no luck. How do I import HashTable correctly? Let me know if I can provide any further information!
import is used to link to things that are on your classpath, so before you can use that you need to allow the compiler to actually find that HashTable class.
You have a couple of options, I would however recommend to rename wordcount.kts to wordcount.main.kts (kotlin script requires the executable to be named x.main.kts for most features to work), HashTable.kt to HashTable.kts and link it with #file:Import(<path-to-hashtable.kts>).
If you can't rename the hashtable you will need to import it either by compiling it to a class file and adding it to the classpath with kotlinc -script -cp <dir-with-.class> wordcount.main.kts. Or compile to a jar and link the jar with #file:DependsOn<path-to-jar> in the script.
For the reference to all this stuff, look here: https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md
Related
Quick question - since when Cucumber doesn't need any separate runner class with steps glued etc? Nothing else is needed currently after adding JUnit dependency to pom.xml? I've just setup a simple project and as I can see nothing besides chromedriver, step definitions, feature files and Selenium/JUnit/Cucumber dependencies is needed. Was it always like that? Because I remember these projects were uneasy to setup because of that class and few other things. Was I just stupid back then, or did something change and it's easy now?
Quite a few things have improved! Just not the thing you mentioned.
When you are using the CLI (either directly or through IDEA) Cucumber will search the entire class path for step definitions and feature files. This means that things usually just work.
To integrate with JUnit4 you will still need a runner class. However unless you tell it otherwise with #CucumberOptions the runner class will look for features and glue in the package and subpackages it is in.
So if you put everything in the right group and in the same package no additional configuration is needed. You should make use of this!
There is a little gotcha when using maven. If you put your feature files in the src/test/java folder, maven won't copy them to your class path. Features should always go into src/test/resources.
~/Projects/cucumber/cucumber-jvm/examples/calculator-java-junit4$ tree
.
├── pom.xml
└── src
├── main
│ └── java
│ └── io
│ └── cucumber
│ └── examples
│ └── calculator
│ └── RpnCalculator.java
└── test
├── java
│ └── io
│ └── cucumber
│ └── examples
│ └── calculator
│ ├── RpnCalculatorSteps.java
│ └── RunCucumberTest.java
└── resources
├── cucumber.properties
└── io
└── cucumber
└── examples
└── calculator
└── basic_arithmetic.feature
You can also do the 10 minute tutorial to get a fresh start: https://cucumber.io/docs/guides/10-minute-tutorial/
Is it possible to structure a rust project in this way?
Directory structure:
src
├── a
│ └── bin1.rs
├── b
│ ├── bin2.rs
└── common
├── mod.rs
from Cargo.toml:
[[bin]]
name = "bin1"
path = "src/a/bin1.rs"
[[bin]]
name = "bin2"
path = "src/b/bin2.rs"
I would like to be able to use the common module in bin1.rs and bin2.rs. It's possible by adding the path attribute before the import:
#[path="../common/mod.rs"]
mod code;
Is there a way for bin1.rs and bin2.rs to use common without having to hardcode the path?
The recommended method to share code between binaries is to have a src/lib.rs file. Both binaries automatically have access to anything accessible through this lib.rs file as a separate crate.
Then you would simply define a mod common; in the src/lib.rs file. If your crate is called my_crate, your binaries would be able to use it with
use my_crate::common::Foo;
I am using webtop 6.8.1 , CS 7.2.
I need to add one new Document format say .xyz. I have added it successfully.
But when such Document is listed, its icon is not getting shown correctly, while for other formats like pdf or gif it is showing correct icon.
do we need to add any gif in war file theme/icons folder?
You can add custom icon for any format.
Icon images should be in GIF format and should be present in two dimensions: 16x16 and 32x32 pixels. Both GIF files should be located in webtop/custom/theme/documentum/icons/format folder and named using this pattern: f_formatname_XX.gif where:
formatname - is a value of the name attribute of the dm_format object
XX - is an image size with possible values 16 and 32
For example we had on our past project icons for Jasper Reports and InfoPath XML files in this structure:
webtop
├── custom
│ └── theme
│ └── documentum
│ └── icons
│ ├── format
│ │ ├── f_jasperreport_16.gif
│ │ ├── f_jasperreport_32.gif
│ │ ├── f_xmlinfopath_16.gif
│ │ └── f_xmlinfopath_32.gif
...
I have a spring boot 1.5.1 project that uses profile properties file. In my /src/main/resources I have all my properties files
When using IntelliJ 2016.3.4 I set the
Run Configuration | Active Profile
to "local" and run it. I see this in the console:
The following profiles are active: local
But there is a value in the property file
data.count.users=2
and used as:
#Value("${data.count.users}")
private int userCount;
that is not being picked up and thus causing the error:
Caused by: java.lang.IllegalArgumentException: Could not resolve
placeholder 'data.count.users' in string value "${data.count.users}"
However, if I run this via gradle
bootRun {
systemProperty 'spring.profiles.active', System.properties['spring.profiles.active'] }
as
gradle bootRun -Dspring.profiles.active=local
then everything starts up using the local profile as expected. Can anyone see why this is not being properly picked up? In IntelliJ Project Structure I have my /src/main/resources defined as my Resource Folders.
UPDATE:
Adding screenshot of Configuration:
I could be wrong here but it doesn't look like the spring.profiles.active environment variable is actually set in your configuration, regardless of what you've selected as your Active Profile. This may be a bug with IntelliJ.
However, setting the environment variable in Run -> Edit Configurations definitely works for me.
Pease add Spring facet to your Spring Boot module to get full support
Is classpath of module heimdall the correct one, i.e. does it contain the shown resources folder with your application.properties?
If this doesn't help, please file a minimum sample project reproducing the exact structure of your project in our bugtracker, there are too many variables to investigate https://youtrack.jetbrains.com/issues/IDEA.
Using -Dspring.config.location in VM options in IntelliJ helped me.
-Dspring.config.location=file:/C:/Users/<project path>/src/main/resources/application-dev.properties
This could also be due to a non-standard configuration setup, for instance:
src/main/resources
├── application.properties
├── config1
│ ├── application-dev.properties
│ ├── application-prod.properties
│ ├── application.properties
│ └── logback-spring.xml
├── config2
│ ├── application-dev.properties
│ ├── application-prod.properties
│ ├── application.properties
│ └── logback-spring.xml
└── config3
├── application-dev.properties
├── application-prod.properties
├── application.properties
└── logback-spring.xml
This can be solved by passing using the parameters logging.config & spring.config.name for logback & spring respectively. For the above example:
java -jar \
-Dspring.profiles.active=dev \
-Dlogging.config=classpath:config1/logback-spring.xml \
-Dspring.config.name=application,config1/application \
target/my-application.0.0.1.jar
Here root application.properties is used, overridden by config1/application.properties, overridden by config1/application-dev.properties. The parameters (environment variables) can be specified in IDEA's run configuration in VM Options.
As far as advanced IDE support (highlighting, completion etc.) is concerned, there is an open issue for complex/custom configuration setups: IDEA-180498
After setting up my Scaladoc, i see that some documentation is still missing from the IDE
It seems to me (many thanks to Peter for noticing this) that:
functions with non-bold font have no documentation
functions with bold font have bare minimum
underlined functions have complete documentation
No documentation (normal non-bold font)
Bare minimum documentation (bold)
Complete documentation (underlined)
For the record, my scaladoc is installed as follows
doc
├── scala-devel-docs
│ └── api
│ ├── index
│ ├── lib
│ └── scala
│ ├── actors
│ │ ├── remote
│ │ └── scheduler
│ ├── annotation
│ │ ├── meta
│ │ └── unchecked
and is configured as follows:
EDIT:
Downloaded Javadoc from Oracle and placed into the /Library/Scala/2.10.0-RC2/doc/javadoc
javadoc/api
├── index-files
├── java
│ ├── applet
│ │ └── class-use
│ ├── awt
│ │ ├── class-use
│ │ ├── color
│ │ │ └── class-use
│ │ ├── datatransfer
│ │ │ └── class-use
Added 1 more entry to IDEA:
Does not seem to help.
Please clarify
You should install Javadocs as well - those bold methods have in fact plenty of documentation because they come from Java.
On the meaning of highlighting, I've answered on your other thread.
To add the JavaDocs, take a look at the picture below: .
From your snapshot, I'm tempted to guess you added them next to the ScalaDocs for the same library. However, the JavaDocs/ScalaDocs are associated with a specific library, so you should undo the step you did - IDEA will only look for docs of Scala library classes within the paths you specified there.
The picture shows that within the "Project structure" dialog, you need to go to SDKs, select the Java SDK you're using, go to documentation paths and press one of the "+" buttons on the bottom. The picture shows how to add a link to the Internet documentation, but with the other "+" button you can add the local documentation you downloaded (which will be faster to access). The path you specified seems correct.