directory-structure

Finding the location of a file that calls a function (nodejs)

人盡茶涼 提交于 2021-02-16 15:10:59
问题 If a method of a module is called from within a file, can I tell the location of that file from within the module? So // my-module.js module.exports = { method: function () { // in here I would like to detect the path to my-app.js } } // my-other-module.js require('my-module').method(); I want some equivalent of access to __filename for my-other-module.js from within my-module.js. I don't want to have to pass __filename as a parameter 回答1: For a utility logging you could use this (I used

mkdir's “-p” option

隐身守侯 提交于 2021-02-05 12:39:15
问题 So this doesn't seem like a terribly complicated question I have, but it's one I can't find the answer to. I'm confused about what the -p option does in Unix. I used it for a lab assignment while creating a subdirectory and then another subdirectory within that one. It looked like this: mkdir -p cmps012m/lab1 This is in a private directory with normal rights ( rlidwka ). Oh, and would someone mind giving a little explanation of what rlidwka means? I'm not a total noob to Unix, but I'm not

Copy-Item is copying unexpected folder

早过忘川 提交于 2021-01-29 08:03:47
问题 I'm struggling to understand how PowerShell handles recursion and Copy-Item command. $date=Get-Date -Format yyyyMMdd $oldfolder="c:\certs\old\$date" New-PSDrive -Name "B" -PSProvider FileSystem -Root "\\(server)\adconfig" $lastwrite = (get-item b:\lcerts\domain\wc\cert.pfx).LastWriteTime $timespan = new-timespan -days 1 -hours 1 Write-Host "testing variables..." Write-Host " date = $date" `n "folder path to create = $oldfolder" `n "timespan = $timespan" if (((get-date) - $lastwrite) -gt

React import folder navigation

淺唱寂寞╮ 提交于 2021-01-28 11:52:24
问题 I am trying to import images from an assets folder in my src folder in my react app but for some reason the path is not being recognised. My folder structure is as follows: |src |Assets |Common |Components I am trying to import the image located in the assets folder from the components folder. I was able to import from my common folder to files in the components folder by doing the following: import * as Constants from '../Common/Constants'; However following this same structure for loading

WebStorm/PhpStorm exclude file from search everywhere

烈酒焚心 提交于 2021-01-27 06:21:16
问题 When I search everywhere I would like to exclude JS and js.map files from the search results. ( I am using TypeScript ). My expected behaviour is to have these files omitted from Search Everywhere. Yes, I can mark the files as plain text, but that's cumbersome on a per file basis. I have used scopes: I have researched these links: PHPStorm exclude files by mask from indexing How to exclude file from PhpStorm global search (Ctrl+Shift+F) What am I missing? Can this be done? 回答1: You can

Python folder structure for project directory and easy import

試著忘記壹切 提交于 2021-01-26 09:46:23
问题 My team has a folder of several small projects in python3. Amongst them, we have a utility folder with several utility functions, that are used throughout the projects. But the way to import it is very uncomfortable. This is the structure we use: temp_projects util storage.py geometry.py project1 project1.py project2 project2.py The problem is that the import in the projects looks terrible: sys.path.insert(1, os.path.join(sys.path[0], '..')) import util.geometry util.geometry.rotate

Python folder structure for project directory and easy import

感情迁移 提交于 2021-01-26 09:46:02
问题 My team has a folder of several small projects in python3. Amongst them, we have a utility folder with several utility functions, that are used throughout the projects. But the way to import it is very uncomfortable. This is the structure we use: temp_projects util storage.py geometry.py project1 project1.py project2 project2.py The problem is that the import in the projects looks terrible: sys.path.insert(1, os.path.join(sys.path[0], '..')) import util.geometry util.geometry.rotate

What is the role of Angular core module?

僤鯓⒐⒋嵵緔 提交于 2021-01-20 19:52:20
问题 I read an article about organizing folders in Angular and the author uses one called core , in which he creates the core module and insert only services which will be called once. Currently, I'm working on a project whereupon I adopted the structure recommended by the article. Inside my core folder/module I created a module called api : \app \core \api ... \shared ... My question is: as the api is a module, I was wondering why not remove it from core and put in app folder? \app \api \core

rename a files within a folder of a folder to its parent folder?

别说谁变了你拦得住时间么 提交于 2021-01-04 09:23:20
问题 I have a batch of folders that have a name based on the date. Each folder has a folder where they have file names which are all the same. Is there a way rename the files so they become unique based on the directory structure (which appears is the parent folder (the first folder) which is based on the date) that they are held within. \user\date\1_2_2019\ABC\0001.csv -> abc_1_2_2019.csv \user\date\1_3_2019\JKL\0001.csv -> JKL_1_3_2019.csv \user\date\1_4_2019\XYZ\0001.csv -> XYZ_1_4_2019.csv

rename a files within a folder of a folder to its parent folder?

て烟熏妆下的殇ゞ 提交于 2021-01-04 09:23:12
问题 I have a batch of folders that have a name based on the date. Each folder has a folder where they have file names which are all the same. Is there a way rename the files so they become unique based on the directory structure (which appears is the parent folder (the first folder) which is based on the date) that they are held within. \user\date\1_2_2019\ABC\0001.csv -> abc_1_2_2019.csv \user\date\1_3_2019\JKL\0001.csv -> JKL_1_3_2019.csv \user\date\1_4_2019\XYZ\0001.csv -> XYZ_1_4_2019.csv