Plain Text Files Without Text Mimetypes - mime-types

There are a lot of file types that are categorized under application even though they contain only plain text. For example, application/javascript. Where can I find a list of all of these miscategorized mime types?
In other words, how can I determine if it is safe to view a file as plain text?

Related

Why is it `text/html` but `application/json` in media types?

What's the difference between application and text in media types and when do they use what?
For example there is text/html but on the other hand it's application/json.
Is this a historical thing?
This is described on the MIME types page of the mozilla documentation.
application refers to any kind of binary data while text is theoretically human readable.
type/subtype
The structure of a MIME type is very simple; it consists of a type and
a subtype, two strings, separated by a '/'. No space is allowed. The
type represents the category and can be a discrete or a multipart
type. The subtype is specific to each type.
A MIME type is case-insensitive but traditionally is written all in lower case.
Further down the page you can find a table containing the discrete types:
Type Description
text Represents any document that contains text and is theoretically human readable
image Represents any kind of images. Videos are not included, though animated images (like animated gif) are described with an image type.
audio Represents any kind of audio files
video Represents any kind of video files
application Represents any kind of binary data.
To answer your question about JSON, while you'll frequently come across JSON that is human readable it's primarily used for containing data and isn't necessarily intended to simply be read. Meanwhile a machine can always easily convert the data from JSON into an object (assuming the JSON is correctly formatted).

Can you concatenate RTF in a Crystal Reports formula Field

I'm currently building an application that generates a separate letter for each user in the dataset. The letter contents are managed through a vb.net application and their RTF format saved to a database. When the letter is created, all the content is pulled from the database to form the letter using vb.net logic.
Once compiled it was sent as a parameter to Crystal. This worked great, setting the field text interpretation to RTF allowed proper RTF viewing.
The client has decided that they would instead like to make changes to the logic (if statements that compile the text) within Crystal.
So what I did was create a blank dataset with a bunch of columns and filled those columns with the RTF (Ordered by ID so the values will never change unless a paragraph is deleted and there is no option for this). This would allow me to build an RTF string by going {table.1} + {table.2} etc...
This is where the problem is. When building an RTF string in a Formula (Using + or &) it only displays the first RTF entry. If I switch the formula to no interpretation, I can see the RTF for the entries written out with all their content so I know it’s there. I also manually combined the RTF in the formula field and had the same issue.
StringVar output;
output := output & "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\lang1033\f0\fs23 this is a first test }";
output := output & "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\lang1033\f0\fs23 this is a second test \par\par}";
Output
At this point I am unsure if there is a way around this other than moving all the text to separate Formula fields within crystal itself and then combine. This would mean if they wanted to change text it would have to be done within crystal. I would rather not go this route so I’m looking for opinions and suggestions.
Crystal does support RTF however it needs to be fully formed within the first occurance of an RTF entry. In my question it shows two separate COMPLETE RTF entries. As the entries all have the RTF ID tags this will not be possible. The same issue would occur if you copied the above text into a text editor and saved it as RTF. You would only get the first line. This doesnt explain why it works as a parameter and not a formula but its likely how each are evaluated and the later (parameter could loose support in the future).
To Properly pass RTF to crystal you will need to two Rich text box objects. One being a temp box and the other being the builder box and only selecting the formatted text, not the entire RTF content. An example of this can be found at:
http://moneybaron.org/2011/08/23/vb-net-merge-rtf-documents/
Aside from some hacks such as removing the closing brace from the RTF string or rebuilding the RTF table are also avaliable however removing the brace could lead to an unsupported configuration and rebuilding can get messy really quick.
Hope this helps!!

How to create file format with metadata

I am trying to make a new file format for music. It needs to be a file that actually stores multiple audio files, for example a zip file. I am looking for a way to turn the zip file into this new file format. However, I still want to use id3 tags with these new files. I was wondering how I can make this new file format which is one file that holds multiple audio files, but still contains overall id3 tags for that one file, so that I can load it into my mobile applications.
Any help/recommendations would be appreciated.
Cheers,
AJ
The problem with creating your own new file format is that only you can use it. Until you convince lots of other people that it is a useful new format, no one else will have the tools to be able to do anything with the files you create.
For existing music player programs to be able to handle a new file format, you must write a CODEC for your file format in that player's plug-in style. Probably more than one plug-in as your file format is both a container of music and a catalog as well.
One alternative to creating a new file format is to put the MP3 files you have into a new MP3 file with each old file a new TRACK in the new file. Be sure to set each new tracks start time to be after the sum of all previous tracks play duration, so they don't step on each other. Merge the metadata about each file into the metadata of the new file. This might work OK for collections with lots of common metadata (like same artist), but might not work very well if the metadata is extremely varied.
Another alternative is to convert them to CDA format and put then into an Audio-CD image file, just as if you had burned them to a CD.
A third alternative is to put your files into an SQLite database file. Your metadata from each MP3 file fill in records, and you have your choice of leaving the MP3 file external and just linking to it, or storing the blob of your MP3 file in the DB as well. If you do store the blobs, then the SQLite database file is a single file that contains everything you put in it.
-Jesse
Don't create new formats unless you really really have a very good reason to do so.
Its sounds like Matroska can do anything you need. But in contrast to your own format you and other developers will have a bunch of ready to use tools to work with the format. This includes editors, players,... Additionally it you can leave making initial engineering errors to other people.
If you really really want to create your own format: Either just put your audio files that support id3 tags into your zip file, or create a meta file, for example in XML format, into your zip files as well, that contains the meta information that you want to be included.

How to filter the Filelistbox with multiple filetype masking?

Somehow I need to make a custom "file-open form".
I manage to retrieve the file list with filelistbox.
My question is when I enter this in filelistbox1.mask
Image Files|*.jpg;*.jpeg;*.bmp;*.gif;*.png;*.tiff;*.tga
all of the *.jpg files did not show up, but other image files ( .jpeg;.bmp;.gif;.png;.tiff;.tga) shows up. how come this be ?
I'm sure there is the *.jpg files in the folder, but why the they did not show up in the filelistbox ?
how to fix my mask ? any idea what is the correct mask for it ?
You need to list just the extensions.
*.jpg;*.jpeg;*.bmp;*.gif;*.png;*.tiff;*.tga
At least, that's how I read the documentation.
From the comments it looks like you want to store in the control some friendly text that indicates what type of file the mask refers to, e.g. image files, executable files, text files etc. You could perhaps re-purpose the Hint property to do this. You could use the Tag property and store a PChar. You could derive from TFileListBox a new class that contained an extra property. Or you could just store the information in the form class that owns the list box.
Remove Image Files|.
It's for the File Dialogs.

most common file type to html converter

Is there a plugin(for example joomla plugin) or program which converts most known file type(.chm, .doc, .pdf etc..) to html. After conversion I want to search any item in that text.
PS: I know that there are some programs pdftodoc, doctohtml.. But I need a whole program or portal which converts all generic file types to html and in that portal there must be a search properties.
Thanks.

Resources