bookdown preview with Rmd files in a subdirectory - subdirectory

I am wondering if it is possible to use preview_chapter() function with an .Rmd file that is in subdirectory? I've tried it, but got a document without actual text: only section headings and "Placeholder" string where text should have appeared. Once I moved the .Rmd file to the parent (project) directory, it generated the preview correctly. But having all .Rmd files in the project directory makes it look super messy and difficult to navigate through.

Related

WebStorm refresh file metadata after renaming

In WebStorm (2020.2.2) I accidentally named a file foo.jss and I renamed the file name to .js but WebStorm has not recognized the change. I already removed my .idea folder.
I appreciate any help or hint.
Focus the file in the Project View (just like you have on your screenshot).
Now invoke View | Quick Documentation: IDE will show a popup with file info. The info you are after is the File Type (how IDE treats this file).
I cannot say what the file type might be as it shows WebStorm's icon (never seen that before)... but .jss file extension usually stands for "JavaScript Style Sheet".
Now go to the Settings/Preferences | File Types, locate that file type in the top list, then look in the middle list (patterns) and remove such unwanted pattern (will be similar to the original file name before the rename).
If it's not under that file type... then also look through other file types, "Files Opened In Associated Applications" entry in particular (the idea based on the WebStorm file icon).
If such unwanted pattern cannot be found under any of the file types for some reason... then we need to look into the actual config files where such info is stored.

Adding a CSV file to a project in Visual Studio

I am working on a project where I have to read in serveral pre-existing CSV (dog.csv, horse.csv, etc.). I want to know how would I add these file into my project so that I may test to see if my print functions work (the code is written in c++). Would I have to copy and paste the files into the debugging folder or would I place it under the test folder of the project?
You can include the files in your project in whatever (sub)folder you wish by using Right click -> Add -> Existing Item. Then, right-click on each file and choose Properties. Set up "Copy to output directory" to "Copy if newer".
Then after build, your files will be copied into the bin/debug folder.
To read the file, you can just use:
System.IO.File.ReadAllText("dog.csv");
Another possible way is to add a file within project, right click and select properties, and then in Copy to Output Directory, select Copy always. This way, csv file will be automatically copied in your debug and release packages too.
string executableLocation = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().Location);
string csvLocation= Path.Combine(executableLocation, "file.csv");
Above code will read file location from bin directory where your csv file will be stored.
This link should help guide you how to add CSV files to a project.
If you wanted to do a down and dirty way you could just save the CSV's somewhere on your local machine, and then hard code the file path to that location.
Example:
c:\test\Dog.csv and then set that as a variable for whenever you need to read in the csv file.

Cant open html resource file using ifstream::open - Visual Studio 2013

I am working on a project which requires me to open an HTML file and use its contents. I added it to Resource files but when I try to open it lie this:
std::ifstream templateFile;
templateFile.open("filename.html", std::ifstream::in);
The operation fails. I checked it by using templateFile.fail().
The above operation works when I provide the full path. The file lies in the project folder along with other files. I tried setting build action to content but still it doesnt work. Please Help.
Output directory, where your executable is compiled and put into differs from the source directory, where you create all your .cpp/.hpp files (I assume there is filename.html file). Local path filename.html is supposed to be local for your executable file, not the source file.
Read more about changing the output directory here: https://msdn.microsoft.com/en-us/library/ms165410.aspx
Under Configuration Properties / Debugging, see what your Working Directory is using the macros dialog box. Move your file into this folder.
Click the button shown in the figure. There, click either Edit or Browse. Browse will take you to the working directory. Edit will expose the link to open the macros box

Setting up LESS file watcher in webstorm

If I add a "File Watcher" to compile .less files into .css files in webstorm with the default option it makes the .less file becomes a "node" and the .css file is created inside it.
The macro system seems to me a little tricky, I just want to create the .css file inside the same "style" folder in which the .less file is.
Basically now I have a structure like this:
root
|style
|-style.less
|-style.css
and my goal is to obtain a structure like this:
root
|style
|-style.less
|-style.css
any suggestion?
You will have to edit the 'File Watcher', there is Setting 'Arguments' this is what comes after the lessc command. Put somthing like this:
$FileName$ $FileNameWithoutExtension$.css
this should create your output file (.css) in the same directory.

Sublime Text 2 FileTemplates plugin doesn't work

I want to use "FileTemplates" plugin in Sublime Text 2. I installed it with Package Controller, but when I use "Create file from template" and select something, nothing happens! It doesn't even create a file.
How can I make it work? Any ideas?
You need to find you current user's packages folder. Here you will find where the FileTemplates package has been installed. On my Windows system it is %APPDATA%\Roaming\Sublime Text 2\Packages\FileTemplates. You may also get to this folder from the Preferences menu by selecting Browse Packages...
Inside this folder there is a Templates folder. Inside this folder you will find the pre-canned file templates. You may create your own by copying and pasting the existing files to create the templates you like. You will need to create a .file-template file in the FileTemplates folder. This file is an xml file which tells sublime where to find the actual template and what parameters to the file creation the user may pass into the template. For instance $name is the parameter that the user is prompted for which will be used to name the file created from the template. Hope this helps.