How to restrict Shiny fileInput to text files only? - shiny

I want to restrict my file browser to displaying only the types of file I specify, e.g. .txt files only. The only relevant snippets of a code I found are like the following:
fileInput("in_file",
"Input file:",
accept=c("txt/csv", "text/comma-separated-values,text/plain", ".csv")
However, this does't filter the files showing in the browser to just .txt and .csv. Any ideas?

As far as I understand, that's the right way to do it. If you view your app in the RStudio viewer it wouldn't do anything, but in a browser it should. I'm using Chrome and I just ran that code and it did in fact only show me txt and csv files.
Of course the user can still choose to view other files by going to the little select box and choosing to view all files, but they have to consciously choose to do that. By default only csv and txt files will be shown

Related

Pass parameters from one rmarkdown page to another?

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?

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

Show contents of .csv file in Markdown

I have a C# solution that contains unit tests automatically generated from a .csv file via text templates.
The .csv file is a nice table for any team member to refer to, and serves as living documentation of the system.
We're running TFS 2015 and I understand that Markdown can be used in conjunction to provide clear system documentation.
Is it possible to use Markdown to display the contents of a .csv file (stored on the TFS server) within a table? So that if the .csv file is edited, the Markdown page reflects this?
For now, it's impossible. Detail info about Markdown page in TFS, please refer this tutorial: Markdown guidance
I have created a uservoice for you, you can vote up for it and TFS admin will kindly review the suggestion.
Show contents of .csv file in Markdown
https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/17749084-show-contents-of-csv-file-in-markdown
you can use dbeaver that will create a markdown table of your query result
click on export data and than:
next next
and in Output section check Copy to clipboard
click next and at the end click proceed
now you can copy your markdown text saved in your clipboard (this is the place where the system store data once you hit CTRL+C) insiede your markdown file

Django text file upload and security when using 'mark_safe'

I'm working on a Django app where the user uploads a space/tab/comma delimited text file. I display the text in a browser and the user can then interactively parse columns of delimited values which get highlighted with css as they change the settings. (Only a sample is displayed not the whole file!)
To highlight the selections I insert html/css code in and around the text but have to 'mark_safe' the text to get the html/css to render. I assume this opens security issues as even I, a complete noob could insert html in my input file and get it to render.
My Question:
Is there something I can use to strip html out of the text file immediately after I've uploaded it and before I render it in the browser? Would stripping '<' and '>' out be enough? What about something to disable .js if required?
I understand there are other well documented security measures I can take regarding file uploads. However I'm after a solution to my specific issue relating to me 'marking_safe' the input text I then render to the browser.
Django already has Automatic HTML escaping for this. Take a look at the link I posted in the docs. Hope this helps.

Download file with CGI C++

I have one page that shows links, and I have some text data. How can I make using C++ CGI that by clicking on hyperlink "Save As" dialog will appear and certain amount of my text will be saved with user-defined path and name to the file on the users filesystem.
Actually, main question is how to show "Save as" dialog. After it, I think, everything will be easy.
Just set an appropriate content-type header and then output the file.
The browser takes care of the rest. Any file type it doesn't recognize causes the Save as dialog to be displayed.
They key to forcing the "Save as" dialog with a MIME type the browser can display is the Content-Disposition header.