I have a file with t4 code, but I want to separate it into 2 files, how I do a include tt file in my tt file?
Try the include directive in Microsoft docs
Related
I want to delete the line configuration (This word "configuration" is inside the angular brackets in the file "hdfs-site.xml"). I tried using this code but no luck.
ruby_block "delete_lines_in_hdfs_site" do
block do
file = Chef::Util::FileEdit.new("/opt/hadoop-2.4.1/etc/hadoop/hdfs-site.xml")
file.search_file_delete_line(/<configuration>/)
end
end
You need to end the ruby block with
file.write_file
Otherwise the changes are not written out.
While I agree that using a template is preferred and considered best practices, there are times you need to edit an existing file which may have variations and not fit the template model.
You do not add to or remove lines from files with chef. Instead you replace the configuration file with yours, which you put into your cookbook under files/ or templates/ forlder.
template "/opt/hadoop-2.4.1/etc/hadoop/hdfs-site.xml"
or
cookbook_file "/opt/hadoop-2.4.1/etc/hadoop/hdfs-site.xml"
When you just add/replace lines in config files, you cannot be sure, that after upgrade of installed software your config files are right.
So I have some project files all with .txt extensions which are really HTML templates. I am trying to syntax highlight those .txt files as HTML using Webstorm. Any tips on how to do that?
Open File > Settings > Editor > File Types > HTML files and add your extension to registered patterns in the right panel.
Source
I would like the file watcher for SCSS files to ignore files with file names starting with an underscore, for example _buttons.scss.
How would I do that?
Start by adding a _ to a file that you want to be ignored... Done! From the documentation:
Partials
If you have a SCSS or Sass file that you want to import but don’t want
to compile to a CSS file, you can add an underscore to the beginning
of the filename. This will tell Sass not to compile it to a normal CSS
file. You can then import these files without using the underscore.
For example, you might have _colors.scss. Then no _colors.css file
would be created, and you can do
#import "colors";
So adding an underscore will do the job. Just don't import.
Be careful naming your files because if you have a style.scss and _style.scss Sass will see these as the same filename and trow an error:
>>> Change detected to: /Users/allcaps/test/style.scss
WARNING: In /Users/allcaps/test:
There are multiple files that match the name "style.scss":
_style.scss
style.scss
A simple workaround will be to add two underscores: __style.scss.
#LazyOne has the right idea. A Scope can be created that excludes files that being with an underscore (_). The page at http://www.jetbrains.com/phpstorm/webhelp/scopes.html#d437174e402 has more information about this, but basically you select the folder you want after creating a custom scope and then in the scope field append it again with && ! between the two and exclude files starting with an underscore.
For example:
file:website/css//* && !file:website/css//_*
I am writing a documentation and I would like to include links to pdf files or zip archives. How can I achieve that using rst language and sphinx ?
If I do that
here is a pdf file : `pdf <doc/mypdf.pdf>`_
It does not work because, during the compilation sphinx do not copy the contains of the doc directory (I use the makefile generated by sphinx-quickstart).
On the contrary, using the image directive :
.. image:: img/plop.png
sphinx does copy the plop.png image in build directory. How can I obtain the same behavior for pdf or zip archive ?
A solution is to use the :download: “role” (detailed in the sphinx documentation on roles).
Here is a short example assuming you have a file mypdf.pdf in a directory doc. The directory doc and your rst file must be in the same directory:
here is a pdf file :download:`pdf <doc/mypdf.pdf>`
Note that you mustn't put a blank space between :download: and the path to the file.
The image directive also works for PDF files.
.. image:: doc/mypdf.pdf
I wonder if there a standard way to include a postscript file into another.
For example, say I have got one file of data generated by a 3rd party program:
%!PS
\mydata [ 1 2 3 4 5 6
(...)
1098098
1098099
] def
and I would like to include it into a main PS document
%PS
\processData
{
mydata { (..) } foreach
}
(...)
(data.ps) include %<=== ???
Thanks
The operator you want is run.
string run -
execute contents of named file
Unfortunately, run is not allowed if the interpreter has the SAFER option set.
Edit: Bill Casselman, author of *Mathematical Illustrations" has a Perl script called psinc you can use to "preprocess" yor postscript files, inlining all (...) run files.
The standard way to include PostScript is to make the code to be included an EPS (Encapsulated PostScript) file. There are rules on how encapsulated PostScript must be created, and how to include it. See Adobe Tech Note 5002 'Encapsulated PostScript File Format Specification'
Simply executing 'run' on a PostScript file may well work, but it might also cause problems. Many PostScript files (especially those produced by 3rd parties) will include procedure definitions which may clash with your own names, and also the included program may leave the interpreter in a state different from the one it was in when the included file was executed. At the very least you should execute a save/restore pair around the code included via 'run'.
I would suggest meta-solution: use C preprocessor or M4 preprocessor. They are powerful tools and their power may find use in other ways as well, not only file inclusion. Though this was not asked, but use of Makefile will be wise to automate whole workflow. By using a preprocessor and Makefile in combination you can elegantly automate complex inclusions processing and beyond.
C Preprocessor
Including a file:
#include "other.ps"
Commandline for preprocessing:
cpp -P main.pps main.ps
M4 Preprocessor
Including a file:
include(other.ps)
Commandline for preprocessing:
m4 main.pps > main.ps