How do I dynamically create a read-only contract in Perl? - perl

My attorney gave me a 10 page contract that we need to fill in the blanks with the client name, pricing etc and then provide the client with a PDF or equivalent of the contract.
I have looked at PDF::Create but it looks like I would have to create the entire document through code, not just the the placeholders.

CAM::PDF, PDF::API2 can modify existing documents. Your question is not very specific, so no code example.

I would look into using a templating system and LaTeX rather than making the pdf by hand.

Related

Is it possible to use data frame in r-exams?

I would like to paste the data-frame from the R environment to the latex part (question or solution part) when creating exercises in r-exams. Later the exercises will be imported into Moodle. Is that possible in r-exams? We saw it is possible when the object is matrix object via $\Sexpr{toLatex(matrix_obj)}$. But a similar way does not seem to work with the data-frames. Thank you!
A data.frame would usually be included as a {tabular} in LaTeX and there are various packages for automatic conversion like xtable or using the function kable() in knitr. For PDF output this also works nicely including all vertical and/or horizontal lines included in the table. However, for HTML-based output (as for Moodle) the table as such is converted correctly but without any lines.
An overview of a couple of solutions is available as:
Different copies of question with table for Moodle with R-Exams
Moreover, Kenji Sato has proposed to inject some dedicated CSS code to handle the table formatting in HTML. We are currently working on some automated way of including this in R/exams:
https://www.kenjisato.jp/en/post/2020/07/moodle-bordered-table/

Most efficient way to change the value of a specific tag in a DICOM file using GDCM

I have a need to go through a set of DICOM files and modify certain tags to be current with the data maintained in the database of an external system. I am looking to use GDCM. I am new to GDCM. A search through stack overflow posts demonstrates that the anonymizer class can be used to change tag values.
Generating a simple CT DICOM image using GDCM
My question is if this is the best use of the GDCM API or if there is a better approach for changing the values of individual tags such as patient name or accession number. I am unfamiliar with all of the API options but have a link to the API documentation. It looks like the DataElement SetValue member could be used, but it doesn't appear that there is a valid constructor for doing this in the Value class. Any assistance would appreciated. This is my current approach:
Anonymizer anon = new Anonymizer();
anon.SetFile(myFile);
anon.Replace(new Tag(0x0010, 0x0010), "BUGS^BUNNY");
Quite late, but maybe it would be still useful. You have not mention if you write in C++ or C#, but I assume the latter, as you do not use pointers. Generally, your approach is correct (unless you use System.IO.File instead of gdcm.File). The value (second parameter of Replace function) has to be a plain string so no special constructor is needed. You should probably start with doxygen documentation of gdcm, and there is especially one complete example. It is in C++, but there should be no problems with translation.
There are two different ways to pad dicom tags:
Anonymizer
gdcm::Anonymizer anon;
anon.SetFile(file);
anon.Replace(gdcm::Tag(0x0002, 0x0013), "Implementation Version Name");
//Implementation Version Name
DatsElement
gdcm::Attribute<0x0018, 0x0088> ss;
ss.SetValue(10.0);
ds.Insert(ss.GetAsDataElement());

How does an addin retrieve and process data from the AddinRoot?

I'm planning to use Mono.Addins in my C#/.NET project.
For that, I've read the Programming Guide and Reference Manual presented in codeplex.com, downloaded the latest version of source code from github.com, and successfully built all the samples included in the source package. However, whether the online documents or sample projects, all try to demonstrate how to extend an AddinHost by creating new instances of an ExtensionNode. There seems to miss something about how to retrieve and process data from the AddinHost.
For example, say I have a text editor, which processes RTF document, and I want to provide the possibility for addins to find/replace the document with its own way (For example, Regex / Forward / Backward / Whole document / Current Line...), so the addin need to get the content from AddinHost first. This is the question I need an answer for.
Any ideas?
If I understood well you have to maintain a reference to the RTF document, I think that providing it inside an initialization code for your plugin could be a way to obtain it.
Or you can have a sort of "IFindReplaceAddin" with a method, say "FindReplace", that accepts the RTF document as argument and returns the elaborated document.

Extracting function call list from DOxygen XML Output

I posted a question on the DOxygen forums and also am posting it here for a better response.
I have a moderately sized C project of about 2,900 functions. I am using DOxygen 1.5.9 and it is successfully generating a call graph for the functions. Is there a way to extract this out for further analysis? A simple paired list would be sufficient, e.g.
Caller,Callee
FunctionX, FunctionY
...
I am comfortable with XSLT but I must say that the DOxygen XML output is complex. Has anyone done this before and can provide some guidance on how to parse the XML files?
Thanks in advance!
Based on what I see in the contrived example that I created,
Parse files with a name similar to ^_(.+)\d+(c|cpp|h|hpp)\.xml$, if my regex-foo is right.
Find all <memberdef kind="function">. It has a unique id attribute. I believe the XPath for this is //memberdef[#kind='function'].
Within that element, find all <references>.
For each of those tags, the refid attribute uniquely refers to the id attribute of the corresponding <memberdef> that is being called.
The text node within each <references> corresponds to the <name> of the corresponding <memberdef> that is being called.
This seems like a nice, straightforward way to express call graphs. You should have no trouble using XSLT or any other sane XML-parsing suite to get the desired results.

Using YAML tags to denote types

I don't quite understand how to use application specific YAML tags, and maybe its because my desired use of them is purely wrong. I am using YAML for a configuration file and was hoping to use tags to provide my configuration loader with a hint as to what datatype it should parse the data into - application specific datatypes.
I'm also using libyaml with C.
So I'm trying to do something like...
shapes:
square: "0,4,8,16"
circle: "5,10"
In my app I'd like to use tags as hints so I can load the values of square into my square data structure, and the values of circle into my circle data structure (these values mean nothing in this example).
So I'm currently doing:
shapes:
square: !square "0,4,8,16"
circle: !circle "5,10"
Libyaml will provide a tag of "!square" when I'm passed the scalar "0,4,8,16". Is it valid to use this tag to provide my loader with a hint of how to process the scalar?
Since it does work for me, I'm more curious to know if its proper. And if not, how would I go about making this more proper.
Thanks.
I know that this is an ancient question, but anyway I've seen !int, etc being used in yaml files before so I went to look up the specs at Yaml 1.2 Spec # Tags
application specific tag: !something |
The semantics of the tag
above may be different for
different documents.
As per the document, it does look like your intended usage of tags is correct for application specific tag.