clearcanvas if file is a dicomfile - dicom

How to check if file is a dicomfile?

The Clearcanvas DicomFile.Load method throws an exception if the file is not a valid dicomfile. On the clearcanvas forums. I've found a similar topic. They are saying that if you ónly want to see if the file is a valid dicom file, you can add the following parameter to the DicomFile.Load method: DicomReadOptions.DoNotStorePixelDataInDataSet, this will speed it up a bit.

Related

Uploading Business Central Base App.xlf results in "Failed to extract the contents of the uploaded file."

I try to upload the Base App.xlf file from English into German (by Business Central 15), but everytime I upload the file, I receive an error that says "Failed to extract the contents of the uploaded file." after 2-3 minutes. If I upload a smaller .xlf file, everything is fine.
Base App.xlf: 62.25Mb
Smaller file: 74Kb
Both files are written in xliff version 1.2. Regarding to the post below, Custom Translator supports it in 2018.
Custom translator cannot extract contents of XLIFF file
I can't figure out, why the bigger file is not processed. Some more information would be useful. Is this error thrown cause of special character?
I just figuered out that the Base Application has some missing -tags in the -tags, which leads to the error, obviously. I used an xlst-File to delete tags with missing . This deleted -tags with an empty -tag, too.

convert xml to cpp with qdbusxml2cpp get error unknow type (uu)

I use qbusxml2cpp tool in Qt to convert xml to cpp class. I use the command below to convert a xml file named nm-device.xml (I get this xml file from network manager package v0.9.8.8)
qdbusxml2cpp -v -c Devices -p Devices.h:Devices.cpp nm-device.xml
but I get error, here is the output:
Got unknown type `(uu)' You should add name="org.qtproject.QtDBus.QtTypeName" value="<type>"/> to the XML description
I've also search on Google and I know (uu) is a struct and I need to add the line below to xml file
name="org.qtproject.QtDBus.QtTypeName" value="<type>"/>
The question is What type i should use in my situation?
I don't think there is a Qt type that specifically encapsulates two uint32 fields, so you might have to create a custom type and register it.
You can look at that part of a tutorial here https://techbase.kde.org/Development/Tutorials/D-Bus/CustomTypes#Edit_the_XML which is registering a custom type called "Message" and modifying the XML file accordingly.
I have just found my solution. it is
<annotation name="org.qtproject.QtDBus.QtTypeName" value="DeviceDBusStateReason"/>

What causes a HTTP 404 error when using GroupDocs viewer?

I'm using an XPS file reader to produce HTML output via the GroupDocs Viewer, and it's giving a result in HTML format using the UseHtmlBasedEngine property but giving me error in top corner of viewer like HTTP Error 404.0 not found.
string fileName = (sender as LinkButton).CommandArgument;
string scriptLibraries = Viewer.CreateScriptLoadBlock().LoadJquery().LoadJqueryUi().ToString();
string inlineDocPreviewScript = Viewer.ClientCode()
.TargetElementSelector("#divShow")
.FilePath(fileName)
.EnableRightClickMenu(true)
.ShowThumbnails(true)
.OpenThumbnails(true)
.ZoomToFitWidth()
.Quality(100)
.MinimumImageWidth(ImageWidth)
.UseHtmlBasedEngine(true,true,true,true)
.ToString();
HeadControl.Controls.Add(new Literal() { Text = scriptLibraries });
BodyControl.Controls.Add(new Literal() { Text = inlineDocPreviewScript });
How to resolve HTTP 404.0 not found error in this scenario?
Looks like you have changed the root URL of the application or have generated document’s cache with a URL and then changed it or deployed the application to another server. To resolve the issue, simply delete the Viewer cache – the "temp" folder, which can be found in the root storage path (which you’ve set in the .SetRootStoragePath() method).
If this will not help you, please share with us the following details: which type of the project you use (We3b Forms or MVC) and a code example of the Viewer initialization and web.configs.
As for the reading html and image files from different folders - please provide more info about the use case because it's not very clear what you actually want to do. Please post your request on our support forum at: http://groupdocs.com/Community/Forums/Default.aspx

check uploaded file in vb.net

I need a snippet to check file for validity (I'm allowing users to upload xml files). So I need to check whether uploaded file is XML.
The best I can think of is just check if extension is ".xml". What if its replaced?
You can try loading it like this and catch the exception:
XDocument xdoc = XDocument.Load("data.xml"));
Presumably, if they're uploading XML, then you're going to use it for something afterwards. In this case you should validate the XML against a Schema (XSD etc) so that you know you aren't going to hit unexpected values/layouts etc.
In Urlmon.dll, there's a function called FindMimeFromData.
From the documentation
MIME type detection, or "data
sniffing," refers to the process of
determining an appropriate MIME type
from binary data. The final result
depends on a combination of
server-supplied MIME type headers,
file extension, and/or the data
itself. Usually, only the first 256
bytes of data are significant.
So, read the first (up to) 256 bytes from the file and pass it to FindMimeFromData.
If you must validate the xml (assuming you want to validate the entire thing) you can use the XmlDocument class and catch an exception if it's not XML.

Getting extension of the file in FileUpload Control

At the moment i get file extension of the file like :
string fileExt = System.IO.Path.GetExtension(filUpload.FileName);
But if the user change the file extension of the file ( for example user could rename "test.txt" to "test.jpg" ), I can't get the real extension . What's the solution ?
You seem to be asking if you can identify file-type from its content.
Most solutions will indeed attempt the file extension, but there are too many different possible file types to be reliably identifiable.
Most approaches use the first several bytes of the file to determine what they are.
Here is one list, here another.
If you are only worried about text vs binary, see this SO question and answers.
See this SO answer for checking if a file is a JPG - this approach can be extended to use other file headers as in the first two links in this answer.
Whatever the user renames the file extension to, that is the real file extension.
You should never depend on the file extension to tell you what's in the file, since it can be renamed.
See "how can we check file types before uploading them in asp.net?"
There's no way to get the 'real' file extension - the file extension that you get from the filename is the real one. If file content is your concern, you can retrieve the content type using the .ContentType property and verify that it is a content type that you are expecting - eg. image/jpg.

Resources