Sorting HTML attributes for comparison - html

Is there a way to sort HTML attributes when comparing things in BeyondCompare?
So for example the following should be considered equivalent:
<div class="btn" id="someId">
vs
<div id="someId" class="btn">

Beyond Compare doesn't provide a method to sort HTML attributes.
If you can find a command line application to sort HTML attributes, you can use a Beyond Compare file format to run it as a preprocessor before comparison.
To define a file format that runs an external app before comparison:
Open Tools > File Formats.
Click +.
Select Text Format.
In the General tab, enter *.html as the file mask.
Go to the Conversion tab.
Change the top dropdown from None to External program (Unicode
filenames).
In Loading, enter the path to the external app, followed
by variables %s and %t for the source and target filenames.
Save.
The highest format in the list with matching file mask is used when comparing pairs of files in Beyond Compare or running rules-based comparison in the Folder Compare.

Related

Converting several html files into one word file

I received web-service documentation in html format, but it is very unfriendly when it comes to search for a specific word. Using index file it displays list of names of each request on the left and when you click on a particular one then on the right it displays description and content of this request.
Unfortunately I have to do some mapping with web-services that we already have. When searching through CTRL + F it only goes trough the left side (list), doesn't matter if you place cursor over the description on the right, click and try to search this way too - it doesn't work.
My idea is to extract all html files that have been provided to us into one word document (this way I can go through descriptions not only trough the list of names). Unfortunately all I can reach is that these files open in separate word files (one html file per one word file). It's almost 1000 requests to be mapped and working this way is going to take forever...
So the question is: How to combine more than one html file into one word file?
There two ways to merge html files
Using Command Line
Copy all html files that you want to merge into a folder.
Navigate to that folder using terminal or command prompt.
Execute following commands
on Mac/Linux
cat *.html > output.html
on Windows :
type *.html > output.html
Using already available tools
https://www.sobolsoft.com/howtouse/combine-html-files.htm, html-merge (Windows Only)
In order to convert merged html file to a word document, read here.

Is there a way to only accept a file with a certain name for an input button?

The accept object property filters files with a certain extension -- but is there a way to filter based on object name as well?
<input type="file" id="HelloWorld" accept=".txt"></input>
Let's say I wanted to filter for a file called "HelloWorld" with the extension of ".txt". How could this be done?
No you only can provide mime types according this page: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept
accept
If the value of the type attribute is file, then this attribute will
indicate the types of files that the server accepts, otherwise it will
be ignored. The value must be a comma-separated list of unique content
type specifiers: A file extension starting with the STOP character
(U+002E). (e.g. .jpg, .png, .doc).
A valid MIME type with no extensions.
audio/* representing sound files.
video/* representing video
files. HTML5 image/* representing image files.
To explicit check the filename you need to do something with javascript or in your backend where you POST.
The "accept" argument only filters on file types and extensions (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file)
You could write a JavaScript handler on before form post, or server-side handler, to capture and validate that the correct file name was chosen -- in fact, if you truly needed the file type to be correct, you would want to do this anyway -- as noted in the above reference documentation:
The accept attribute doesn't validate the types of the selected files; it simply provides hints for browsers to guide users towards selecting the correct file types. It is still possible (in most cases) for users to toggle an option in the file chooser that makes it possible to override this and select any file they wish, and then choose incorrect file types.
Because of this, you should make sure that the accept attribute is backed up by appropriate server-side validation.

SSIS package: ForEach Container is picking undefined file from the source location

My SSIS Package takes gpg file rather then text file i have puts file "*.txt" file in Files. any help will be appreciated.
This is expected, documented behavior. From MSDN:
Use wildcard characters (*) to specify the files to include in the
collection. For example, to include files with names that contain
“abc”, use the following filter: *abc*.
When you specify a file name extension, the enumerator also returns
files that have the same extension with additional characters
appended. (This is the same behavior as that of the dir command in the
operating system, which also compares 8.3 file names for backward
compatibility.) This behavior of the enumerator could cause unexpected
results. For example, you want to enumerate only Excel 2003 files, and
you specify "*.xls". However, the enumerator will also return Excel
2007 files because those files have the extension, ".xlsx".
You can use an expression to specify the files to include in a
collection, by expanding Expressions on the Collection page, selecting
the FileSpec property, and then clicking the ellipsis button (…) to
add the property expression. For more information about dynamically
selecting specified files, see SSIS–Dynamically set File Mask :
FileSpec
Try using *txt instead of *.txt so it doesn't treat "txt" as an extension and include files that end in ".txt.gpg"

html5 file input always accepts "unknown" file type

I'm writing web app which requires user to select csv file. However due to requiring user to have files with serveral suffixes it's quite typical to have multiple files with similar names while only one of them is .csv. the problem is accept=".csv" works only partially - it allows user to filter by csv but doesn't do it by default filtering by unknown file type
<fieldset name="inputForm">
<legend>Input</legend>
<label>Input file:</label>
<input name="inputFile" type="file" accept=".csv">
</fieldset>
I also tried accept="text/csv, .csv" but it doesn't change anything.
result:
user could accidentally select for example one of .txt files or .png and that would lead to application malfunction due to malformed input file. User can select filtering by only CSV or only "unknown" but I'd prefer CSV only to be default filter because it's quite obvious nobody gonna ever switch file filtering options so realistically it's useless...
This is OS behavior and not within the scope of the browser, unfortunately. The accept attribute is mainly for ease of use on the front end and not true validation. I suggest using JavaScript or server-side validation to ensure the file selected is the right mime type desired.

Provide a description for a file dialog

In HTML5, I can get an open file dialog with the following code:
<input id="fileOpenDialog" type="file" accept=".proj" />
(note, .abc is my own project format)
When Google Chrome opens the dialog, it shows it like this:
Is there a way to provide an additional description for the file type? I would like it to show something like "ABC Project File (.proj)".
Although I like the suggestion, there is no attribute in the input type=file that supports this.
File extensions are kept on the client, and those values are shown in the dropdown.
You can find all supported attributes in the specification.
No this isn't possible.
That said, however, your upload form itself should clearly specify which type of file is being requested from the user; the user should know what file they are expected to load before selecting to chose a file.
Whilst on this subject, it's also worth noting that the HTML5 Candidate Recommendation specifies the following warning:
Warning: Extensions tend to be ambiguous (e.g. there are an untold number of formats that use the ".dat" extension, and users can typically quite easily rename their files to have a ".doc" extension even if they are not Microsoft Word documents), and MIME types tend to be unreliable (e.g. many formats have no formally registered types, and many formats are in practice labeled using a number of different MIME types). Authors are reminded that, as usual, data received from a client should be treated with caution, as it may not be in an expected format even if the user is not hostile and the user agent fully obeyed the accept attribute's requirements.
Even if you were somehow able to rename your desired file type to "ABC Project File (.proj)", the user would still be able to upload any other file with the .proj extension.