Apologies if asked and answered already.
I'm making a custom application leveraging pdftk to merge a handful of documents. I'm trying to implement a method to arrange an array similar to
$pdfArray = Get-Childitem Full\Pathname | where name -like "*.pdf"
I need to devise a way for my user to be able to rearrange that array such that when the array is passed into the pdftk.exe /cat $pdfarray /output $outputname the docs are merged in the desired order (dont quote me on the command at all, just trying to illustrate the point). Im not above making the users name their files in such a way that its sortable but if i could make it easy for them to click move up/move down like a common pdf application would be ideal. Any ideas on a good approach?
Related
This question already has answers here:
Limiting file types for a specific DocumentChooserBlock() Block in Wagtail Steamfield
(2 answers)
Closed 1 year ago.
I'm writing a custom StreamBlock that is designed to render a table based on the data in a given CSV file. The CSV files will be stored in the usual Document store, so the block needs to present the Document chooser to let the user pick a CSV file.
I would like to restrict this block's Document chooser to documents whose filenames end in .csv, without affecting any other Document chooser. I dug into the code to try to figure out a way to do that, but after 30 minutes of poking around, it doesn't look like there's any obvious way to determine the source of a request to the admin/documents/chooser/ view, which is what actually renders the Document listing.
My best guess at the moment for how to do this would be to subclass DocumentChooserBlock and AdminDocumentChooser, so that I can tell it to use a custom version of wagtaildocs/js/document-chooser-modal.js. I'd change it to send an extra GET argument, or something like that, whenever CSVTableBlock's Document chooser sends a request to admin/documents/chooser/. Then I could implement construct_document_chooser_queryset to look for that custom GET arg, so it knows when to filter the documents queryset to only .csv files.
But I'm really not at all sure that this is the right way to go about it, or if it's even possible for that strategy to work. Is there a better/possible way to do this?
you actually no need to do anything, almost all use cases for such filtering scenarios, an editor can input the ".csv" in the search box of the chooser modal
Situation:
I want to train and simple configure the retrieve and rank service.
I just uploaded some PDFs and now I want to upload some questions.
In the documentation I do not find a simple information how the csv file must be structured and which are the must fields and which are not must files.
Something like: "[YOUR QUESTION (MUST)]",[DOCUMENT ID (MUST)], [RANKING (OPTIONAL)]
The document ID you will find in xyz in section xyz.
Inside the help I can not find such kind of help.
https://www.ibm.com/watson/developercloud/doc/retrieve-rank/training_data.shtml#script
Impact:
There is no chance to get a "real" documentation of the configuration outside the tutorial.
Possible Solution:
Provide additional documenation.
Maybe I was not able to find it and someone can guide me to the right place?
Ok, I found the solution for me, by try and error. Following steps do work for me:
1) You need a plain text file and the ending should be *.txt
2) Inside the file you have to write your questions like this:
What is the best place to be?
Why should I travel to the USA?
-> Don't do it like
"What is the best place to be?"
For me the help was missleading, because saying something about CSV files.
You can take a look also in the comment of #dalelane he is right, and highlight the entry text for the upload of the file.
I'm using Laravel to gather directories from a drive using Storage::disk()->directories();. But I can see that it gathers all the hidden files as well, I'm using Windows so there is a few hidden folders i don't want it to gather. Is there a option or configuration to easily remove them? Or would I have to specify each item I don't want in the array and remove them one by one?
The ones I don't want to see in the array are things like: System Volume Information or $Recycle.bin etc..
You can use array filter to remove those that you don't want.
Something like that
$directories = array_filter(Storage::disk()->directories(), function ($directory) {
return !in_array($directory, ['System Volume Information', '$Recycle.bin']);
});
If you want a list of basic files that you may want to escape, you can take a look at that https://www.gitignore.io/api/windows
I'm using Elements a lot and I've just realised that I started prefixing their filenames with a controller and/or action names.
That made me think that keeping all elements in one folder might feel ok if there's a few of them and they're not controller-specific. Like a header menu, or a dialog of some sort. Otherwise I start feeling like I should group them, and doing that by their names will result in a mess and it just feels wrong.
So I'm thinking about grouping them into folders. The first folder structure that came to mind was View\ControllerName\Elements\element_name.ctp, i.e. a specific Elements subfolder in each of the controller folders, but I feel like it would be tricky to include them without using the full or relative paths.
Another option would be View\Elements\ControllerName\element_name.ctp, i.e. keep the Elements folder and create group them all by controller inside of it. But in that case I'd be duplicating each Controller name in both Elements folder and the View folder itself, meaning that if I ever need to change it I'll have to do that twice. In the first approach the subfolder name name ("Elements") will never change. I know it doesn't really sound like a huge problem as I won't be changing the controller names every day, but the whole approach just sounds not-so-effective because of that.
Do you guys know what would be a better way to do this?
Please advise
new to stackoverflow so forgive me if I make any mistake.
I'm new to programming and scripting, although I have messed a little little bit with python and understand the basic of filemaker pro.
This is my problem: I have a full database that I built over the years. Database is just a way to say because, actually, it's a huge amount of rtf files with topics inside it. Now that I've built some real database I want to transfer my data from one to another. Just one table
The real problem is: in my old rtf days, I used to store my data in a easy to view manner, meaning that all my titles were bold/italic/underlined, and the text itself wasn't. So, I have aproximately 200 rtf files, each with 10-20 (sub)topics, waiting to be transfered to a two-columns table (title; content)
I would appreciate if anyone have a better idea than mine. My idea was to run a script that found the bold/italic text, copy it to my table field, find the not-bold, copy to the other field, etc. But I'm unable to find the answer to my simple question: how do I search for (and select) bold text?
I'd like to use applescript (is what I'm sort of comfortable with), but could use some other stuff.
You can try something like:
tell application "TextEdit"
set boldText to attribute runs of text of document 1 whose font contains "Bold"
end tell