Timed out while searching for 'workspaceContains' VSCODE - visual-studio-code

Extensions sometime not activated, in Log (Extension Hosts) appear this message
[2022-01-07 08:25:00.723] [exthost] [info] Not activating extension 'apollographql.vscode-apollo': Timed out while searching for 'workspaceContains' pattern **/apollo.config.[jt]s,**/apollo.config.cjs
and its happen with some extensions too. I checked config file is already in correct folder
What's I Tried so Far
Reload Window
Reinstall Extensions
Install Another Version (Ext)
Completely delete Ext files in %USERPROFILE%\.vscode\extensions
Activation Events apollographql.vscode-apollo
workspaceContains:**/apollo.config.[jt]s
workspaceContains:**/apollo.config.cjs
Workspace Tree
|-- Workspace
|-- Some Project
|-- Vue Project
|-- apollo.config.js
|-- Some Project
Reply in comment, if you need spesific settings.
Thanks in Advance.

Related

Import and use protobufs outside of lib directory - dart

I am trying to build a web application with with Flutter for the frontend, go for the backend and gRPC as the communication protocol. In an effort to avoid using identical protobufs in 2 different directories, I refactored the protobufs and compiled them into a third directory outside of the client and server folders (all within the same repo). Now I'm having trouble accessing the compiled dart protobufs from the client code. Here is my folder structure:
.
|-- client/
|-- pubspec.yaml
|-- protos/
|-- dart_protos/
|-- .dart_tool/
|-- .packages
|-- cards.pb.dart
|-- cards.pbenum.dart
|-- cards.pbjson.dart
|-- cards.pbserver.dart
|-- pubspec.lock
|-- pubscpec.yaml
|-- go_protos/
|-- cards.proto
|-- server/
Here is how I am defining my dependencies in my client/pubspec.yaml
dependencies:
flutter:
sdk: flutter
recase: ^4.0.0
search_choices: ^2.0.7
tcb_protos:
path: ../protos/dart_protos
My protos/dart_protos/pubspec.yaml:
name: tcb_protos
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
protobuf: ^1.1.4
protoc_plugin: ^19.3.1
And how I am importing the protobuf:
import 'package:tcb_protos/cards.pb.dart';
So I am running into a couple of issues:
I am getting Target of URI hasn't been generated: 'package:tcb_protos/cards.pb.dart'. on the import
I am unable to use the protobuf based on the import, and VSCode's intellisense isn't working on the package (which I am assuming is because either the package definition or import is wrong)
How can I use the protobuf in my Flutter widgets?
You need to have the proto .pb.dart files inside a lib/ folder.
I made a small example here: https://github.com/sigurdm/shared_proto_example
If you want to have protos in different packages that reference each other, that is currently not supported: https://github.com/google/protobuf.dart/issues/295

vscode omnisharp not working for solution but works for project

I have folders structured like this: project/csproj A, project/csproj B
If I open in vs code project dir, omnisharp works for csproj B only. If I open in vs code project/csproj A directory, omnisharp works for this project.
How fix that so I can open project directory and have working omnisharp for both projects?
Broken project is nunit type if that matters. I tried reloading vscode, disabling/enabling omnisharp.
I created project in empty directory with
dotnet new nunit -n=projectB
A solution is specified by a sln file, if you don't have one yet, just create a new one in the solution-level folder
dotnet new sln
And then, you must add the project references to the solution
dotnet sln path/to/solution add path/to/project
And if the omnisharp does not update it, restart it or vs code.
Omnisharp can only support a single project or solution, therefore, to support multiple projects, you must use "solution", which is not just a folder but with a sln file.
Your folder structure is antipattern and not naturally supported, because .NET Core uses SDK-style csproj project, which adds all source files in the project-level folder (which is where the csproj file is), so having multiple csproj files inside one project-level folder is just for one project with multiple targetings. If your project A and B is in the same folder, it means they may contain duplicate source files that may cause errors on conflict of types, unless you specified source exclusion respectively in the csproj files.
The recommanded folder structure is
<Solution and git repository level folder>
|-- src
| |-- <Project level folders>
| | |-- <Folder structures based on namespace>
| | | └-- <Source files>
| | |-- <Asset files with approprate folder structure>
| | └-- <The csproj file>
| |-- Directory.Build.props (Common MSBuild props for all src projects)
| └-- Directory.Build.targets (Common MSBuild targets for all src projects)
|-- test
|-- └-- <Test projects with similar folder structure to src>
|-- build
|-- └-- <Common MSBuild props and targets files to be referenced by src and test>
|-- docs
| └-- <Documents>
|-- <Other repository assets>
└-- <The sln file>

Invalid MEX file from any other folder except private folder

I have compiled matcaffe with caffe in Windows.
My current matcaffe folder structure is as below:
.
C:\PYTHON\caffe
|-- matlab
|
|-- +caffe
|
|--private
|
|-- caffe_.mexw64
|...
|-- all hard linked dlls
I have checked caffe_.mexw64 using dependency walker that the following files are missing:
LIBMEX.DLL
LIBMX.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
DCOMP.DLL
IESHIMS.DLL
which is quite obvious from dependency walker. All caffe-related dlls are found.
In matlab, I have added the following path:
addpath('C:\PYTHON\caffe\matlab');
but on running this command:
caffe.run_tests()
I get the following error:
Invalid MEX-file 'C:\PYTHON\caffe\matlab\+caffe\private\caffe_.mexw64': The
specified procedure could not be found.
Error in caffe.set_mode_cpu (line 5)
caffe_('set_mode_cpu');
Error in caffe.run_tests (line 6)
caffe.set_mode_cpu();
Interesting thing is the following. If I go to the caffe\matlab\+caffe\private folder and run the same caffe.run_tests(), then it runs successfully.
And thereafter only, I can run the matcaffe commands without MEX errors from any other folder (as the dlls are then already loaded in the memory).
My questions are:
What is happening here that I cannot directly run from any other folder?
How to solve this to get the normal behaviour?
Update:
Now I see that the same problem has been posted here, but no proper solution.
You need to add the directory with the DLLs to the PATH environment variable. You can do this from within MATLAB on Windows (this does not work to modify the equivalent LD_LIBRARY_PATH on Linux and Unix):
setenv('PATH',['C:\PYTHON\caffe\matlab\+caffe\private\;',getenv('PATH')]);

How do I re-root a eclipse project to a parent folder without break it?

I did a project with eclipse and I shared it on github. After much work, I realized that the whole project is in a folder called 'projectname'.
A graphic explains it better.
|-- README.md
`-- projectname
|-- model
|-- public
| |-- images
| |-- css
| `-- index.html
|-- package.json
`-- app.js
But I need it in the base directory.
|-- README.md
|-- model
|-- public
| |-- images
| |-- css
| `-- index.html
|-- package.json
`-- app.js
So how do I move these files without breaking the repository or break the eclipse project?
Delete the project from inside of Eclipse, making sure to NOT remove the underlying files, fix the git repository, and then re-import the project from the Git Repositories view into the workspace.

OSS Nexus: how to use REST API to retrieve last version as a text

I'd like to retrieve the latest version name (as text) to be able to rename the artificats retrieved from Nexus which have timestamps.
What I do is create an archive of several archives containing in-house jar projects, dependencies, related scripts, ... But if the packaged jars are snapshots, the archives end up with timestamps when downloaded. Those timestamps replace the X.X.X-SNAPSHOT extension of the archive and I cannot make any automated script to perform some tasks like extracting the archive, renaming the directory, make some symbolic links, ...
I did not find anything related to this in the rest api documentation. Is there a simple way to do this with the rest api or some kind of scripting?
Thanks.
Edit:
From the below answer I managed to retrieve the latest snapshot version using LATEST instead of the version name:
Then using a script I can retrieve the base version.
#!/bin/bash
VERSION=`curl --silent "http://redmine.saic.int:8081/nexus/service/local/artifact/maven/resolve?r=snapshots&g=com.g2mobility&a=G2-Modem-Mgr&v=LATEST&c=executable&e=tar.gz" | sed -n 's|<baseVersion>\(.*\)</baseVersion>|\1|p'`
VERSION=`echo "$VERSION" | tr -d ' '`
echo "Version is $VERSION"
Thanks!
Nexus has the following REST API for describing how Maven modules are resolved:
Artifact Maven Resolve
Example
To obtain the details about the following artifact:
<groupId>org.cometd.jetty</groupId>
<artifactId>cometd-jetty-client</artifactId>
<version>1.0-SNAPSHOT</version>
Use the following REST API:
https://oss.sonatype.org/service/local/artifact/maven/resolve?r=cometd-snapshots&g=org.cometd.jetty&a=cometd-jetty-client&v=1.0-SNAPSHOT&e=jar
Returns the following report:
<artifact-resolution>
<data>
<presentLocally>true</presentLocally>
<groupId>org.cometd.jetty</groupId>
<artifactId>cometd-jetty-client</artifactId>
<version>1.0-20090313.100344-2</version>
<baseVersion>1.0-SNAPSHOT</baseVersion>
<extension>jar</extension>
<snapshot>true</snapshot>
<snapshotBuildNumber>2</snapshotBuildNumber>
<snapshotTimeStamp>1236938624000</snapshotTimeStamp>
<sha1>0cbf7163f19bf4586e27632a1f742dd0c0e0036d</sha1>
<repositoryPath>/org/cometd/jetty/cometd-jetty-client/1.0-SNAPSHOT/cometd-jetty-client-1.0-20090313.100344-2.jar</repositoryPath>
</data>
</artifact-resolution>
This was an eariler deleted posting proposing an alternative way of assembling distributions from Maven repository content:
Ivy is an alternative dependency management client, which can be run from the command-line as follows:
java -jar ivy.jar -settings ivysettings.xml -dependency org.cometd.jetty cometd-jetty-client 1.0-SNAPSHOT -retrieve "distrib/[artifact]-[revision](-[classifier]).[ext]"
The retrieve option of the ivy command details how the downloaded files should be stored locally:
-- distrib
|-- cometd-api-1.0-SNAPSHOT.jar
|-- cometd-jetty-client-1.0-SNAPSHOT.jar
|-- cometd-jetty-client-1.0-SNAPSHOT-javadoc.jar
|-- cometd-jetty-client-1.0-SNAPSHOT-sources.jar
|-- cometd-jetty-server-1.0-SNAPSHOT.jar
|-- jetty-6.1.15.jar
|-- jetty-client-6.1.15.jar
|-- jetty-sslengine-6.1.15.jar
|-- jetty-util5-6.1.15.jar
|-- jetty-util-6.1.15.jar
`-- servlet-api-2.5-20081211.jar
The correct timestamped artifact is retrieved but the "SNAPSHOT" revision number is preserved, which is what I understand you're trying to do.
The ivysettings file details the repositories to be used when downloading artifacts:
<ivysettings>
<settings defaultResolver="repos"/>
<resolvers>
<chain name="repos">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="cometd-snapshot" root="https://oss.sonatype.org/content/repositories/cometd-snapshots/" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
The documentation for the Maven Resolve Nexus REST API can be found here: https://maven.java.net/nexus-core-documentation-plugin/core/docs/rest.artifact.maven.resolve.html