Pass parameters from one rmarkdown page to another? - r-markdown

Thank you in advance. I am writing an rmarkdown script that outputs a pdf. It does a bunch of SQL queries based upon user inputs (I'm using the "knit with parameters" option now, but open to ideas).
I need the output pdf to go to a specific location. While I could do all of this manually, I'm trying to make this friendly to people with limited R experience.
The best I've found is using the render function, but I don't think you can render an Rmd file from inside itself.
So, is it possible to create an Rmd that prompts users for the inputs, passes these inputs to the Rmd that does the calculations and pdf creation, and then allows me to put this in a specified location?
Oh and finally, the location is dynamic - changing based on the inputs from the user.
Am I crazy? Is there an easier way?

Related

can I use cfspreadsheet to update data within in an already existing template without losing styles in it?

can I use cfspreadsheet to update/add some data within in an already existing template without losing styles in it?
I got a template with some column headers and tabular styling in it with some colors n all, so can I process that file and update data into it.
Any thoughts on this line will be much appreciated.
Thanks,
Just answering myself if it helps some one else...
Read file template using read action and specify sheet.
Use SpreadsheetSetCellValue() to update the values in the corresponding cells you needed(it wont disturb any other cells or their data).
Then use write action with overwrite true and specify sheet name...that's it
and this is all works in CF10
What have you tried so far? Without posting your code, it's not possible to provide an exact answer. As for myself, I've never tried it, but it does look possible. Although it appears that it's not as straightforward a process as one would think. According to the online docs it looks like you will need to read in all of the sheets of the file, and then use the update and write options, and then rewrite the entire file.
It looks like some experimentation might be in order on your part. I'd first start by trying with reading and re-writing the entire spreadsheet with no modifications first, and then proceed from there. See what you are able to accomplish in small steps, and then build on it.
To update an existing file, read all sheets in the file, modify one or more sheets, and use the contents, and use the write action and Update actions (for multiple sheet files) to rewrite the entire file.

Is it possible to hyperlink text output using c++?

I want to output some hyperlinked text to a file using C++. I want the text to be "clickable" so that when a user clicks the "text" it'll take him to a specified, linked webpage. I was trying to make sense of libcurl, but from what I understand it doesn't allow you to output the links in the way i'm describing. For example, I want to output a list of separate links,
Cookie
Cake
Pie
that all go to different webpages. If i'm wrong, i'll do some more learning, but if not, i'd like to hear other suggestions.
Thanks

Adding Template Select and Image upload to custom post in Wordpress

I have become a bit confused on the best way to move forward with something I'd like to achieve in Wordpress. My problem is partly workflow I think and knowing the correct way to do what I'd like to achieve but also there may be a few blanks on how to actually implement some of what I need to do. I have checked various online resources but they all are specific to what they are doing and I can't easily understand them to apply them in to the context of my own project, which is why I wanted to ask here. I'm sure my initial question will inevitably branch out to sub questions but here we go:
For my website I have created a custom post type called 'projects'. I have successfully set this up.
Then for each project I need to allow the following data to be entered:
Project Title
Project Description
Also post meta data that will display as a list on each project page (I'll need to display both the key and value on the page but only for those fields that contain data 'i.e. I don't want the list to show as Location: blank'):
Client Name:
Location:
Project Value:
Architect:
Engineer:
Site Area:
My main question is this, I need to show images for each project and allow the user to select a 'template' for each project post, this is because there are about 5 grid designs for layout of the images (1 main Image, 1 square image with two small images right side, 3 portrait image cols etc).
I thought the correct way would be to create a custom post type called projects, add write panels to allow easy input of data (I've yet to add image uploads as this will need to vary depending on the template selected and number of images required), at data input stage the user selects the preferred image layout/template and then uploads images for the containers that allow images (I’ll need to id each image upload to position it in the template with CSS, that was the plan).
Firstly, am I approaching this correctly? And secondly, how can I add functionality to the write panel I have created to allow users to a) select a 'Template' (bit like you can with pages but for my custom post type) and b) to add image upload fields which change depending on the template selected?
Finally, I would like to stay away from using plug-ins and try and achieve this myself through functions.php etc. This is to avoid problems later as plugins update or lose support etc.
Any help is appreciated, thank you.
This sort of question seems to come up a lot in regards to Wordpress (I answered essentially the same question the other day). I know you want to avoid plugins but this sounds like a job for Advanced Custom Fields.
You can create exactly the fields you need for your custom post type (including an image upload field), and then add them into the template the corresponds with your custom post type.
ACF does have a 'lite mode' which can be included directly in a theme. This way you needn't worry about updates nuking site functionality. Believe me you will save yourself a lot of time and energy this way.
It's admirable to try and do it with pure WP, but it's a maturing platform, it just doesn't lend itself to this sort of customization easily.

Saving user's data for my application

I was wondering what would be the correct method for saving all user data for an application I am working on. The application is in QT. The user inputs a lot of data into the application and the data will be different for every user. I want the ability for the user to save all the current data to a file that can be user by the loaded by the application again once the user wants to use it again or use it on another computer running the application.
What would be the correct and best way to do this? Do I need to use xml format? And then use the xmlreader for QT? Or do I just need to create my own file format and just use the stream to just read everything in. The data in the file will need to be labeled, because it will need to put the data in certain spots on the gui. And the user has the option to dynamically create boxes and tabs that hold certain information.
If you need any more information, please let me know.
A short example:
I am not only reading gui locations.
But the contents of those. For
instance. The user is able to create
tabs that contain edit text boxes. And
those tabs are associated with items
that are in a list. When the user
clicks on an item in the list the user
will be presented with a whole set of
new tabs. And each tab has some
editing forms. The file will need to
contain what is in the list, what tabs
the user has created under each item
in that list and the contents of each
tab associated with the tab of each
item in the list.
In essense, yes you'll be creating your own file format, but the actual content can just be XML in whatever scheme you need. Then you can use Qt's built-in XML processing capabilities to pull the heavy lifting of parsing the text (I personally prefer the DOM model, so I use QDomDocument as my base point), and you'll just need to worry about parsing things to and from the individual nodes.
The Qt framework has some great XML samples if I remember correctly that helped me get off the ground almost immediately. Hope they help!
Another great solution is to use internal database implementation (QSQL on top of sqlite). Compared to the xml solution, it might be more versatile (update when needed, can use external keys). Qt has some rgeat examples about using it aas well.
In terms of dependencies, XML solution will require you to use xml and xmlpatterns (if you want to validate stuff), whereas sqlite solution will require QSQL + sqlite plugin. I think that sqlite guarantees atomicity of writing , thus preventing corruption of data (think : the user is killing the app while it's saving).

Django: what is the most appropriate way to provide administrators with the ability to change small snippets of text

Using Django, what is the most appropriate way to provide administrators with the ability to change small snippets of text, for example in one of my sites there is a small piece of text on the front page I would like the administrator to be able to easily change in the backend, however I do not want to create a whole new app or model because then they would be able to create more than one area of text in this way, but I only want it to show up in one place on the homepage.
Any advice?
This might be a bit more than you're looking for, but django-chunks lets you embed snippets of text into your templates and allow administrators to edit them. Because the only way to put a chunk into a template is by embedding it yourself, you don't have to worry about someone creating additional chunks - they just won't show up anywhere on the site.
Create a new setting in the settings file (or if you're using something like Djblets, in the appropriate model [or if you're using something else, wherever it expects settings to be]) for it, and then use it in the template after passing the appropriate context.