Protocol Buffers library-dependent location in IntelliJ - intellij-idea

I try to use import in my *.proto instructions for Protobuf. In my app, I have a few plugins with these *.proto instructions. But IntelliJ with Protocol Buffers marks imports and classes from the imported files as red.
I found, if I add in Preferences->Languages & Frameworks->Protocol Buffers strong location to my *.proto it will be green. But I have many places with *.proto, for example for each plugin in my app, and some of this *.proto can have an equal name, like featuresDto for each plugin. How can I add library-dependent location instead of strong?
However, the protobuf-generator works as expected.
[screenshot]

I didn't get correctly what do you mean by library-dependent location - could you please explain?
As for protobuf plugin settings: there you can find all directories, where you'll be able to import files from. E.g. if the protobuf file is located in /foo/bar/MyService.proto, and you want to be able to import it as import "bar/MyService.proto";, you should add /foo/ directory to the plugin settings.
In fact those settings mean exactly the same as directories one specifies with proto-path cli argument: if any proto file can not be resolved against one of given proto-paths, compilation will not succeed.
Also you may find useful the following issues about simplifying solving imports-related problems: https://youtrack.jetbrains.com/issue/IDEA-283099 and https://youtrack.jetbrains.com/issue/IDEA-283097

Related

Rapidoid custom config file is ignored

I'm very new to Rapidoid and I'm experiencing problem with initial configuration of the application. I'm using Rapidoid 5.5.5 with following Rapidoid modules defined in pom:
rapidoid-commons
rapidoid-http-server
rapidoid-web
Java 11 is used to run the application.
I've prepared a custom config-develop.yml file where I've changed value for port to use from default 8080 to 18888 and added some menu items in gui: section however when I start application none of my changes were used: generated log does not have any data about accepting/use of parameters from my file and configuration files are the files that are included into rapidoid-commons Maven artefact.
Also, the log shows that classpath used is limited to /target/classes folder (I'm using Maven as build tool). So, these are my questions:
What are the rules for merging configuration information when multiple config-*.yml files are present in search path?
How I can tell Rapidoid to ignore some configuration files?
Is it possible to specify explicit name for configuration file as part of initialisation process?
I'm happy to provide additional information if this will help to find an answer to the questions above.
With best regards,
Nick

How to add/import a .kt file as a source in main.kt file in idle kotlin (gradle build) project

I'm learning kotlin recently and have experience with python and pycharm. I'm having some problems on importing a file as a source root in IntelliJ IDE.
my problems are,
If I keep my custom .kt file say calculation.kt in the same folder as main.kt i.e..$project$/src/main/kotlin/main.kt file directory I don't have to import or add calculation.kt in main.kt. All functions within the calculation.kt works fine, maybe being implicitly imported.
But if I keep the file in another folder i.e $project$/src/others/calculation.kt and mark the "others" folder as the source root, yet the calculation.kt doesn't get implicitly imported. Maybe I need to do an explicit import of calculation.kt in my main.kt. I need to know how to do that
Do I have to do any addition to build.gradle.kts file? I think I have to do some inclusion in there, please share an example on that.
Thank you.

ImportError: No module named my project (sys.path is correct)

This is kind of embarassing because of how simple and common this problem is but I feel I've checked everything.
WSGI file is located at: /var/www/igfakes/server.wsgi
Apache is complaining that I can't import the module of my project, so I decided to start up a Python shell and see if it's any different - nope.
All the proof is in the following screenshot, I'll walk you through it.
First, see I cannot import my project
Then I import sys and check the path
Note /var/www in the path
Leave python
Check the directory, then confirm my project is in that same directory
My project is exactly where I'm specifying. Any idea what's going on?
I've followed a few different tutorials, all with the same instructions, like this one.

How are Libraries named in xcode? How do I navigate to a specific library?

I am getting an error which says - "ld: - library not found for -lpods-AppName-DZNWebViewController"
My question is NOT how to fix this error but rather to understand where xcode is looking for this library? Is there a directory where this library needs to be? Below are snapshots of my project workspace.
image of my project files
Using CocoaPods to Maintain Library Dependencies
A library that supports CocoaPods will provide you with the command required to install the library. In this case, it is
pod 'DZNWebViewController'
If this doesn't work, you can always edit the project settings manually.
Manually Maintaining Library Dependencies
Even when using CocoaPods, you can still edit the locations yourself. You can provide Xcode with three types of paths for where to search for files, using project settings in the Search Paths section:
Framework Search Paths refers to frameworks that are pre-compiled
Library Search Paths refer to any library that you include in your project, for access from your code. These are usually the pre-compiled files that have the '.a' extension.
Header Search Paths are usually used in conjunction with Library Search Paths, to tell Xcode where the headers are located for a given library.
The error that Xcode provides will tell you which search path setting and the path it had a problem with:
ld: refers to library Search Paths
fd: refers to Framework Search Paths
hd: refers to Header Search Paths
To provide a fully-qualified search path, you can can begin the path using pre-set placeholders that Xcode provides for convenience.
The following two placeholders often refer to the same location and are therefore synonymous, by default:
$(PROJECT_DIR) - this refers to the project root directory, where the source code is located
$(SRCROOT) - this refers to the source root directory
To complete a path specification, you would follow with a '/', providing the full path to a directory, as in:
$(SRCROOT)/some_dir/some_other_dir
To provide a recursive search path, simply add two asterisks at the end of the path, as in:
$(SRCROOT)/some_dir/some_other_dir/**
To add multiple paths in one of the Searh Paths settings, you simply separate them with spaces:
$(SRCROOT)/some_dir/some_other_dir $(SRCROOT)/some_dir2/some_other_dir3
This brings up the obvious question: what if a path contains spaces?
If your path contains spaces, then wrap your path in double quotes, as in:
"$(SRCROOT)/some dir/some other dir/" "$(SRCROOT)/some dir2/some other dir3/"
Another option is to escape the spaces in your paths, by preceding each space with a backslash (in this case, you cannot use quotes). However, this makes it harder to read, and therefore more difficult to debug, especially when there are multiple long paths:
$(SRCROOT)/some\ dir/some\ other\ dir/ $(SRCROOT)/some\ dir2/some\ other\ dir3/

IntelliJ not recognizing typescript named module declarations

I have a situation where my module names need to be in a certain format. Typescript is fine when I do this:
// knockout interfaces, this is knockout.d.ts
declare var ko: KnockoutStatic;
declare module "core!lib/knockout" {
export = ko;
}
And then in my file that uses it:
import ko = require('core!lib/knockout');
IntelliJ doesn't like it though. It says "cannot find external module 'core!lib/knockout'. I'm using the latest stable version (14.1) and this happens with the in-built 1.4 compiler and a custom one.
I guess this may be a Jetbrains bug?
If you add this to the file with the import statement the error will probably go away
/// <reference path="test.ts" />
The real problem I think is that the configuration isn't fully correct. Is the config root correct or are you maybe using version control?
Relevant bits from the link:
From the Scope drop-down list, choose the scope to apply the compiler in. The available options are: – Project Files: all the files within the project content roots (see Content Root and Configuring Content Roots).
– Project Production Files: all the files within the project content roots excluding test sources.
– Project Test Files: all the files within the project test source roots.
– Open Files: all the files that are currently opened in the editor.
VCS Scopes: these scopes are only available if your project is under version control.
– Changed Files: all changed files, that is, all files associated with all existing changelists.
– Default: all the files associated with the changelist
See https://www.jetbrains.com/idea/help/transpiling-typescript-to-javascript.html