How to use node package preinstalled by VS Code - visual-studio-code

For example,
npm install vscode-textmate
requires dev tools to compile native C code. Since VSC already installed grammars for many languages as well as the node package precompiled for the current platform - is there a way to load the package already on disk along with the preinstalled language grammar?

Please don't do this. It would create an implicit dependency between your extension and VS Code's internal modules, which we don't guarantee will be the expected version or even exist.
See this thread for pointers on native modules in extensions

Related

pyodbc has a .pyi file but mypy doesn't see the stub file

pyodbc has a .pyi file but when running pytest-mypy, I have this error:
__________________________________________________________________________________________________ connexion.py __________________________________________________________________________________________________
3: error: Cannot find implementation or library stub for module named "pyodbc"
3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
_
This should only happen when the library doesn't have stub files but it appears there are stub files. What should I do?
I'm using Python 3.10.2 and i've updated pyodbc to the latest version (pyodbc==4.0.34)
Let's assume your python is installed in /usr. In that case, your python executable will be in /usr/bin, and any libraries you install with pip will be installed in /usr/lib/python3.10/site-packages. In this case, all the sources for pyodbc can be found in /usr/lib/python3.10/site-packages/pyodbc.
Following this pattern we would expect to find type stubs in /usr/lib/python3.10/site-packages/pyodbc.pyi, but there is an issue in pyodbc, so that the stubs are actually installed in /usr/pyodbc.pyi.
In order to pick up this path, you will need to modify settings in your development environment. In Linux, try setting PYTHONPATH=/usr in your environment. The link mentioned in rogdham's comment includes others' comments on how to make this work in VS Code. Other development environments should support similar workarounds.

How to make VS Code have some extensions installed by default in remote containers?

I know that I can use the extensions property of the devcontainers.json file to tell VS Code about the extensions I want to be there when I start my remote container session.
I also develop .NET and I know that these components are needed:
Installing C# dependencies...
Platform: Linux, x86_64, name=ubuntu, version=18.04
Downloading package 'OmniSharp for Linux (x64)' (36011 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package 'OmniSharp for Linux (x64)'
Downloading package '.NET Core Debugger (Linux / x64)' (3411 KB).................... Done!
Installing package '.NET Core Debugger (linux / x64)'
Downloading package 'Razor Language Server (Linux / x64)' (61682 KB).................... Done!
Installing package 'Razor Language Server (Linux / x64)'
Finished
So as you can see, each time I start the container the list of extensions have to be installed and these dependencies should also be installed.
Is there a way that I embed these dependencies and extensions once inside my docker image, so that they are there always?
Because we have an infrastructure that deletes containers randomly (chaos engineering), the current behavior is extremely inefficient. Each time a container comes up we have to wait a lot to see these being installed.
That's impossible (at least not right now). Those dependencies are defined and acquired by individual extensions (you pasted what the C# extension generated), so they won't be covered anywhere else.
While you might find it inefficient, the extension authors (including me) find it friendly, as
It allows latest dependencies to acquire easily.
It allows platform specific dependencies to be downloaded on demand.
It also keeps extensions themselves small.
VSCode Marketplace is introducing some new feature that might ultimately solve this, so you might keep an eye on that. But even if Marketplace is ready, you need individual extensions to adapt to those changes.

How to create and compile a custom module in MongooseIM

System Info:
MongooseIM version: 3.0.0
Installed from: pkg
Erlang/OTP version: 18
Ubuntu 16.04
I am having trouble creating a standard base for a custom module. I want to create a simple hello world program as outlined in the documentation for ejabberd.
However, I cannot get it to work for MongooseIM. Are there any instructions for how to do this? As a beginner I am just looking for building blocks to creating my own modules, and everything I look at is a little too complex for what I am trying to achieve at the moment.
Here is the code for my module: (taken from ejabberd) https://docs.ejabberd.im/developer/extending-ejabberd/modules/#mod-hello-world
And here is my log error:
I have added the following line in my config file with all other running modules:
{mod_hello_world, []}
I am assuming it has something to do with the compilation and there being no .beam file created for the modules as well as some syntax errors specific to MongooseIM. I am also unfamiliar with documentation for compiling modules when using a pre-built pkg as opposed to installing from source.
DISCLAIMER: I'm a MongooseIM developer working for Erlang Solutions.
The link you posted hints at the answer to the immediate question:
If you compiled ejabberd from source code, you can copy that source code file with all the other ejabberd source code files, so it will be compiled and installed with them. If you installed some compiled ejabberd package, you can create your own module dir, see Managing Your Own Modules.
MongooseIM (a.k.a. MIM) does not support the latter method of managing modules, i.e. it's not possible to drop source code into some predefined location when MIM is installed from a package and let it just compile and run the module. If we want to write a custom module, we have to build MongooseIM from source.
To be precise, we don't have to build the whole server from source and package it ourselves. We have to, however, clone the repository, place the new module source there (due to build time requirements like header files) and build it there. Once we get a .beam file of the new module we can just drop it into an installed MongooseIM's code path.
To be even more precise, let's say we have installed MIM from mongooseim_3.0.0-1~ubuntu~artful_amd64.deb available from the Downloads page at erlang-solutions.com, therefore we want to build a module compatible with 3.0.0:
Clone MIM: git clone https://github.com/esl/mongooseim
cd mongooseim
git checkout 3.0.0
Place mod_hello_world.erl under ./src/
rebar3 compile
Once rebar3 finishes get ./_build/default/lib/mongooseim/mod_hello_world.beam and copy to the target host where we installed MIM from a package.
Please note, though, that an example taken straight from ejabberd documentation might not work "as is" in MongooseIM. In this simple module, for example, we'll not be able to include logger.hrl as MongooseIM doesn't have such a header file - we would have to -include("mongoose_logger.hrl"). instead.

VS Code 3rd Party Intellisense not working

I am using the latest release build of VS Code (1.13.1) and I am having some issues with the IntelliSense when trying to use 3rd party libraries.
My example is using JQuery, I have installed JQuery via NPM and imported this into my main.ts file. according to the VS Code website, the IntelliSense should automatically pick up common libraries and display functions and members that are available to that language, so when I type $ and click the '.' key I should see "ajax" for example. I can get the IntelliSense working by installing the types in NPM (npm install #types/jquery).
Am I doing something wrong that might be stopping the automated process from occuring?
Many thanks
Stuart

netbeans c++ deployment

I had developed a small program in netbeans using c++. I need to know how can i deploy/run the package on another linux system
Abdul Khaliq
I have seen your code, you probably missing XML files in the current folder... where the executable is located... paste then and then run as ./your-executable
I recommend that you use a makefile to recompile on your target machine which will ensure that your program is deployed properly.
You should use a makefile as suggested. I know that NetBeans can generate one, but it's been a while since I last did so. Maybe this can help: http://forums.netbeans.org/topic3071.html
Typically, once compiled, your executable will need several libraries. Chance is that those libraries will also be available on the target linux system.
Thus, you can simply copy your executable over to the other system. If you run ldd on your executable, you should see the list of libraries your executable is dynamically loading. Those libraries should be available on the target system as well.
In case your executable makes use of resources such as images and other binary files, you can use a resource system (e.g. Qt Resource System) and compile those binary files into your executable.
The easiest way to test is to do the copy, run
ldd yourExecutable
on the target system. It will tell you if you are missing any library. Install those libraries using the system package manager.
Of course, you also have the option to statically build all libraries into your executable. However, this is not recommended since it makes the executable too large and complicates matters.
What type of package is your netbeans compiler creating? deb,rpm? If you are moving the package to a different linux install you will need to use that distributions package type. Ubuntu - deb
Fedora/Redhat - rpm
etc...
I'm not sure how you change this in netbeans but I'm pretty sure it has the ability to. A google search could help you more.