Seperate python envoirment from global envoirment - python-3.x

I have a problem.
I would like to create/add costume library's for a project in a virtual environment in python with an IDE. Sealed off of the global environment.
How did this problem occurred?
I dragged the costum-selfmade- library's to the new project and I started using them/changing them. Because there is a init file in this folder, other projects become dependent on these libraries. I fixed it to change the library's names and added the project extension to it. But this is to dirty for my standards/ not sustainable. So I would like to somehow add these custom libraries to a virtual environment and prevent it from creating unwanted dependencies.
Own research for solution:
I have looked up if there is a way to create a library in a global env. No result.
Checked the VENV if there is a map with library's/packages. There is one, but I dont know how don't I'm supposed to develop in the virtual environment. If this is the way, please tell me your experience.
Project structure:
Main folder project A/ stript folder / transactions_handler(class that helps transactions)
Main folder project B/ stript folder / transactions_handler(class that helps transactions)
problem, the classes in project A that use transactions_handler excidently use the class of project B instate. Very tricky.

Related

Setting up a modular project in Android Studio

I'm coming from the Visual Studio world of solutions, where each solution can consist of multiple projects that can refer to each other.
What I want to do is create a modular Android project in Android Studio such that all my code doesn't live in one huge app project. However, it seems terribly difficult to do this, so much so that I am sure I am doing something wrong.
I created a blank project called MyProject. This creates a project with the name MyProject and a package com.sohum.myproject. There is a single app project contained within containing no source files.
I now want to add another module under the same namespace (e.g. com.sohum.myproject.library1). However, it seems when I try to add a new module via the menu, I can only do so into a com.sohum.library1 project. How do I get it to use the same package as the project?
My end goal is to have all my modules under the com.sohum.myproject package, referencing each other. For example:
com.sohum.myproject.application will be the entry point. It might depend on com.sohum.myproject.library1 and com.sohum.myproject.someotherlibrary. And I would like to see all of these modules when I open the MyProject file.
You can click File > New > New Module. Then choose Android Library and enter the details.
Reference: https://developer.android.com/studio/projects/android-library
Another way is to set up the project in a subpackage when creating it.
For example, create a project MyProject in a root directory. Call the application Application and rename the package to be com.sohum.myproject.app instead of just com.sohum.myproject. Now any new modules created will be added below the com.sohum.myproject package space.

How to deal with node_modules in PhpStorm

I have been setting up my development environment for my Laravel/AngularJS project. My IDE is JetBrains PhpStorm. I am wondering what are the best practices for configuring the IDE to deal with the node_modules (or bower_components or vendor for my PHP) folder, so that:
It is not included in the code inspection as far as the modules' internal code is concerned.
It is included in the code inspection as far as references in my own code to the modules is concerned.
It is included in Autocomplete or Code Navigation (Ctrl+click on methods)
To make it more clear: I want to be able to Ctrl+click on methods of my node modules and be redirected to the source code of these modules. I also want to be warned if I write a node module method wrong, or if it does not exist. Also autocomplete a method, when I press Ctrl+Space. But I don't want the internal code of my node modules to be included in code inspection, because it takes a lot of time to inspect all the modules, and they are supposed to be ok, so I don't need to inspect them.
I already tried two solutions:
Marking the folders as excluded: This does not work because the folders are totally excluded from the project and redirection and inspection does not work at all
Creating a specific Scope (in PhpStorm Settings), that includes all files except the node_modules folder, to use when I manually run Code Inspection: It is impossible to exclude the node_modules folder, because my IDE recognizes it as a module "I think" (it has [webapp] next to it in the Project explorer). I could however exclude bower_components and vendor.
Regardless my tries, what is the best way to deal with it?
As it's mentioned in help, PhpStorm auto-excludes node_modules folder from indexing for better performance, adding the direct dependencies listed in package.json to javascript libraries for completion, etc. So the best way to handle node_modules is relying on the IDE default procedures

How to structure your NodeJS application in different modules?

so far i've learned a bit about NodeJS. But now i want to write a huge enterprise app with it and i'm wondering how to setup the structure correctly? Coming from other languages like PHP and Java, i imagine, i would split my project in different NPM modules. For example #mybigproject/customer, #mybigproject/cart and #mybigproject/checkout and so on.
But those submodules would be installed in the node_modules folder of the application skeleton. How would i tell for example Express, that the template files are in the different module directories? Or for example i use TypeORM for data access. So each module would have it's own set of models. How do those models know the database configuration data, as it's only in the main application skeleton, or the other way around, how does the application skeleton should know where to find the models?
Don't use npm modules for different parts of your project.
This components is integral part of your project and usually depend on your global config / schema / routing / etc
Just put it in different files and require it where you need it.
You can get an idea for folders structure from projects like Sail.JS
Use npm modules if you writing some utility that going to serve you for different apps and you want an easy way to upgrade the utility code once for all your apps (or in case you want to share that utility as open source for all of us)
NPM can install your local folder as a dependency. (ref)
npm install <folder>:
Install the package in the directory as a symlink in the current
project. Its dependencies will be installed before it's linked. If
sits inside the root of your project, its dependencies may be
hoisted to the toplevel node_modules as they would for other types of
dependencies.
Your module keeps its original location after installed and a symlink is created as the same name of your module folder in the top level node_modules folder.
In these custom sub-modules, you can use __dirname and relative paths to locate you configuration files to feed to database or other data consumers.
But remember that, sub-modules often serve as utility functions for the main module. They should be independent from the project context.

How do I add non-NuGet packages to ASP.NET MVC application?

This is possibly the dumbest question ever, but I've downloaded the jsPDF library from here: jsPDF. It's not offered through the NuGet packages, so how do I then use it in my .NET MVC project solution? Do I need to move the downloaded folder to the "Packages" folder in my project's directory? Do something else?
Obviously, I'm a total newbie to this, so please keep your answers uncomplicated if possible. Thanks!
A Nuget package is literally just a zip file of a compiled project. If it's C# code, it's a collection of DLLs, but depending on the project, it could have static resources like CSS, JS, etc. It could also have views or other resources. The long and short, is that all of this is just pretty much dumped into your project when you include a Nuget package, much as if you had simply added it yourself.
The slight exception is with DLLs, which are placed in packages simply to keep them organized, and then simply referenced by the project they were added to. Therefore, in order to add something not available as a Nuget, you simply just add all the stuff to your project. If there's JS/CSS and such, then just drop that somewhere in your project. If there's DLLs, create some place to house those on your filesystem, and then add a reference to them in your project. I would not recommend sticking them in the packages directory, because that's managed by Nuget, and it could clobber your DLLs if you put them there.

How to import existing node.js module into Intellij IDEA?

I have an existing Node.js codebase, forked from GitHub. Now I want to import it to the Intellij IDEA 13 (ultimate version, which supports Node.js). When I simply try to import the project from the root folder of my existing code, IDEA doesn't add the 'lib' folder, where all the sources are. It should be simple, but I cannot figure it out. Any hints?
Well, I've figured out a workaround, but not sure if it's the best solution. One can just create a new project of type "Web", and point it to the directory containing the module's sources. Then IDEA understands the whole structure, and you can create run configurations with Node.js.
In order to get additional Node features, like Intellisense for standard Node APIs, you'll still want to configure the project to be a Node project:
Open the Preferences window
Click Languages & Frameworks → Node.js and NPM
In the section Coding Assistance you'll see if Node.js Core library is [not] enabled. If it is enabled, there's nothing more to do. If not click the Enable button
Leave For the whole project checked, and click Configure
The text should now change to Node.js Core library is enabled.
Another workaround:
If you have a version controlled Node app with no local changes, you could also create a new project of type "Node.js and NPM", point that to the directory. Then just use any standard settings.
After the project is created, you can just revert the files overwritten by IDEA (e.g. app.js and package.json), delete any new directories and files, and you will get the additional Node features in your project.
Intellij 15 Professional Edition:
Import a new project -> Select the base folder of the project -> choose import form existing source.
When Intellij is done it wont look correct so do the following:
1) Project Structure CMD + ;
2) Go to Modules
3) Add a new module and select Node/Npm (if you dont have it then add a new plugin)
4) Point the source of the project to the base folder and click apply.

Resources