Playframework: Custom template path - playframework-2.5

I was wondering if it is possible to override/add to the template paths for Playframework? For instance, the default templates are looked under views folder and are compiled automatically. These templates are further reachable directly using a URL without any additional config.
---app
|-controllers
|-models
|-templates //How do I compile templates under this folder?
|-views
What I would like to know is if it is possible to add a custom path in addition to the views folder that is also compiled with the build process. Alternatively, is it possible to block certain templates to be not reachable by direct URL ?
Thanks in advance!

Under the app directory, Play should automatically compile anything that looks like a Twirl template - that is, has a registered extension such as *.scala.html - regardless of what directory it's in. The views directory is just a convention, and compiling templates under an app/templates directory should already happen.
If you open an SBT prompt you can verify this by running the command:
show twirlCompileTemplates::sourceDirectories
Which should give you something like:
[info] my-project/compile:twirlCompileTemplates::sourceDirectories
[info] List(/home/me/my-project/app)
For adding a templates directory outside the app folder, you should be able to add something like the following in your build.sbt (for example, the directory extra_templates):
import play.twirl.sbt.Import.TwirlKeys._
sourceDirectories in (Compile, compileTemplates) += file("extra_templates")

Related

no such file or directory - swiftdoc swiftmodule swiftsourceinfo swiftdoc

I have a project where I write XCUITests. I would like to place the accessibility IDs in a separate framework along with other things so that they can be read in the project and in the tests.
MyProject
- MyProject.xcworkscapce
- MyFramework
- MyApp
-MyApp (main-target)
-MyAppUITests (uiTest-target)
Loading MyFramework in the project is no problem. To make it visible for the UITests I import MyFramework into the UITests. The class and the static variables (Acc-Ids) are public. The completion also recognises everything, no errors are shown in the code, I can also navigate to the variables. The app works.
Now when I run the test, I get 4 error messages, which unfortunately tell me nothing at all:
/Users/john.doe/Library/Developer/Xcode/DerivedData/ALIS-ffdwrkfpekfzrggbfmnsazmrxelm/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppUITests.build/Objects-normal/x86_64/MyAppUITests.abi.json
/Users/john.doe/Library/Developer/Xcode/DerivedData/ALIS-ffdwrkfpekfzrggbfmnsazmrxelm/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppUITests.build/Objects-normal/x86_64/MyAppUITests.abi.json: No such file or directory
/Users/john.doe/Library/Developer/Xcode/DerivedData/ALIS-ffdwrkfpekfzrggbfmnsazmrxelm/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppUITests.build/Objects-normal/x86_64/MyAppUITests.swiftdoc
/Users/john.doe/Library/Developer/Xcode/DerivedData/ALIS-ffdwrkfpekfzrggbfmnsazmrxelm/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppUITests.build/Objects-normal/x86_64/MyAppUITests.swiftdoc: No such file or directory
/Users/john.doe/Library/Developer/Xcode/DerivedData/ALIS-ffdwrkfpekfzrggbfmnsazmrxelm/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppUITests.build/Objects-normal/x86_64/MyAppUITests.swiftmodule /Users/john.doe/Library/Developer/Xcode/DerivedData/ALIS-ffdwrkfpekfzrggbfmnsazmrxelm/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppUITests.build/Objects-normal/x86_64/MyAppUITests.swiftmodule: No such file or directory
/Users/john.doe/Library/Developer/Xcode/DerivedData/ALIS-ffdwrkfpekfzrggbfmnsazmrxelm/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppUITests.build/Objects-normal/x86_64/MyAppUITests.swiftsourceinfo /Users/john.doe/Library/Developer/Xcode/DerivedData/ALIS-ffdwrkfpekfzrggbfmnsazmrxelm/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppUITests.build/Objects-normal/x86_64/MyAppUITests.swiftsourceinfo: No such file or directory
What I tried:
clean project
delete derived data
the framework is in Copy Bundle Resources?
copy bundle resources: is there something red
This is a special "no such file or directory" error that some people seem to get.
Any help appreciated.

Are pysa users expected to copy configuration files?

Facebook's Pysa tool looks useful, in the Pysa tutorial exercises they refer to files that are provided in the pyre-check repository using a relative path to include a path outside of the exercise directory.
https://github.com/facebook/pyre-check/blob/master/pysa_tutorial/exercise1/.pyre_configuration
{
"source_directories": ["."],
"taint_models_path": ["."],
"search_path": [
"../../stubs/"
],
"exclude": [
".*/integration_test/.*"
]
}
There are stubs provided for Django in the pyre-check repository which if I know the path where pyre check is installed I can hard-code in my .pyre_configuration and get something working but another developer may install pyre-check differently.
Is there a better way to refer to these provided stubs or should I copy them to the repository I'm working on?
Many projects have a standard development environment, allowing for hard coded paths in the .pyre_configuration file. These will usually point into the venv, or some other standard install location for dependencies.
For projects without a standard development environment, you could trying incorporating pyre init into your setup scripts. pyre init will setup a fresh .pyre_configuration file with paths that correspond to the current install of pyre. For additional configuration you want to add on top of the generated .pyre_configuration file (such as a pointer to local taint models), you can hand write a .pyre_configuration.local, which will act as an overlay and overwrite/add to the content of .pyre_configuration.
Pyre-check looks for the stubs in the directory specified by the typeshed directive in the configuration file.
The easiest way is to move stubs provided for Django in the pyre-check repository to the typeshed directory that is in the pyre-check directory.
For example, if you have installed pyre-check to the ~/.local/lib directory, move the django directory from ~/.local/lib/pyre_check/stubs to ~/.local/lib/pyre_check/typeshed/third_party/2and3/ and make sure your .pyre_configuration file will look like this:
{
"source_directories": ["~/myproject"],
"taint_models_path": "~/myproject/taint",
"typeshed": "~/.local/lib/pyre_check/typeshed"
}
In this case, your Django stubs directory will be ~/.local/lib/pyre_check/typeshed/third_parth/2and3/django
Pyre-check uses the following algorithm to traverse across the typeshed directory:
If it contains the third_party subdirectory, it uses a legacy method: enters just the two subdirectories: stdlib and third_party and there looks for any subdirectory except those with names starting with 2 but not 2and3, and looks for the modules in those subdirectories like 2and3, e.g. in third_party/2and3/
Otherwise, it enters the subdirectories stubs and stdlib, and looks for modules there, e.g. in stubs/, but not in stubs/2and3/.
That's why specifying multiple paths may be perplexing and confusing, and the easiest way is to setup the typeshed directory to ~/.local/lib/pyre_check/typeshed/ and move django to third_parth/2and3, so it will be ~/.local/lib/pyre_check/typeshed/third_parth/2and3/django.
Also don't forget to copy the .pysa files that you need to the taint_models_path directory. Don't set it up to the directory of the Pyre-check, create your own new directory and copy only those files that are relevant to you.

Ansible, override single module file

I want to tweak one Ansible module, I am using multiple modules. Now I want minor tweaks in one of them. How can I override default code?
I am not sure but my assumption is if I created a similar directory structure of modules in current directory, it will refer this code and for rest of module it will refer default code eg. for yum_repository module, default path is:
/usr/local/Cellar/ansible/2.4.1.0/libexec/lib/python2.7/site-packages/ansible/modules/packaging/os/yum_repository.py
but If I create the directory structure in my working directory as:
ansible/modules/packaging/os/ and keep edited file yum_repository.py there, it should refer this edited file.
Ansible will look for modules in ./library subdirectory of the playbook dir.
You can also use library parameter in the Ansible configuration file to specify a common directory for your modules.

Linking with a Windows library outside the build folder

Is there a way to link with a library that's not in the current package path.
This link suggests placing everything under the local directory. Our packages are installed in some repository elsewhere. I just want to specify the libpath to it on windows.
authors = ["Me"]
links = "CDbax"
[target.x86_64-pc-windows-gnu.CDbax]
rustc-link-lib = ["CDbax"]
rustc-link-search = ["Z:/Somepath//CPP/CDbax/x64/Debug/"]
root = "Z:/Somepath//CPP/CDbax/x64/Debug/"
But trying cargo build -v gives me
package `hello v0.1.0 (file:///H:/Users/Mushfaque.Cradle/Documents/Rustc/hello)` specifies that it links to `CDbax` but does not have a custom build script
From the cargo build script support guide, it seems to suggest that this should work. But I can see that it hasn't added the path. Moving the lib into the local bin\x68_64-pc-windows-gnu\ path works however.
Update
Thanks to the answer below, I thought I'd update this to give the final results of what worked on my machine so others find it useful.
In the Cargo.toml add
links = "CDbax"
build = "build.rs"
Even though there is no build.rs file, it seems to require it (?) otherwise complains with
package `xxx v0.1.0` specifies that it links to `CDbax` but does not have a custom build script
Followed by Vaelden answer's create a 'config' file in .cargo
If this is a sub crate, you don't need to put the links= tag in the parent crate, even though it's a dll; even with a 'cargo run'. I assume it adds the dll path to the execution environment
I think the issue is that you are mistaking the manifest of your project with the cargo
configuration.
The manifest is the Cargo.toml file at the root of your project. It describes your project itself.
The cargo configuration describes particular settings for cargo, and allow for example to override dependencies, or in your case override build scripts. The cargo configuration files have a hierarchical structure:
Cargo allows to have local configuration for a particular project or
global configuration (like git). Cargo also extends this ability to a
hierarchical strategy. If, for example, cargo were invoked in
/home/foo/bar/baz, then the following configuration files would be
probed for:
/home/foo/bar/baz/.cargo/config
/home/foo/bar/.cargo/config
/home/foo/.cargo/config
/home/.cargo/config
/.cargo/config
With this structure you can specify local configuration per-project,
and even possibly check it into version control. You can also specify
personal default with a configuration file in your home directory.
So if you move the relevant part:
[target.x86_64-pc-windows-gnu.CDbax]
rustc-link-lib = ["CDbax"]
rustc-link-search = ["Z:/Somepath//CPP/CDbax/x64/Debug/"]
root = "Z:/Somepath//CPP/CDbax/x64/Debug/"
to any correct location for a cargo configuration file, it should work.

CLIPSJNI.SymbolValue cannot be cast to CLIPSJNI.MultifieldValue

I'm trying to run the example CLIPS GUI projects, both versions 0.2 and 0.3, however without success. Nothing special - I create a simple Eclipse project with the codes, using Debian 64bit and I always end up with the "CLIPSJNI.SymbolValue cannot be cast to CLIPSJNI.MultifieldValue" exception. I got the libCLIPSJNI.so in /usr/lib64. Any help or suggestions appreciated.
I think your issue is that either the rule or resource files are not being found in your projects. There are probably multiple (or better) ways to do this, but what I did was create a CLIPSJNI project to contain the CLIPSJNI.dll, CLIPSJNI.jar, and libCLIPSJNI.jnilib files and then a separate project for each of the demos. I placed the clp files at the root level of the demo project, the java code within the src directory and the resources folder within the src directory:
Animal
src
AnimalDemo.java
resources
AnimalResources.properties
.
.
.
animaldemo.clp
bcdemo.clp
I placed an archive zip of the projects at https://sourceforge.net/projects/clipsrules/files/CLIPS/Misc/: CLIPSJNI_0_3_Eclipse_projects_64Bit.zip

Resources