In later AX versions it's easy to make base64 string from file using .NET components but how to do same thing in AX3.0?
In AX 4.0 or later you could use BinData.base64Encode.
In Axapta 3.0 you could interface with Crypt32.CryptBinaryToString.
The other way round would be interface with Crypt32.CryptStringToBinaryA. Morten Lehrmann has an implementation here.
Related
i'm migratinga portlet modulo from liferay 7.0 to 7.4, and i need to implement some constants what was in the class DDMIMPL in the package com.liferay.dynamic.data.mapping.util.impl.DDMImpl, i replace this with com.liferay.dynamic.data.mapping.form.field.type.constants.DDMFormFieldTypeConstants and I managed to get some of the constants I need, then I added com.liferay.dynamic.data.mapping.internal.util.DDMImpl but I still need to get DDMImpl.TYPE_DDM_LINK_TO_PAGE, where can I get it from? some idea?
grep -r "LINK_TO_PAGE" liferay-src/ reveals DDMFormFieldType.LINK_TO_PAGE from com.liferay.dynamic.data.mapping.model.
Though deprecated it's still in use in a couple of places in Liferay's own source code
I have a task to extract files from zip archive. Unfortunately, as I found from another question here, windows explorer in win10 still uses cp866 to encode filenames inside of archive file. .NET Core doesn't support this codepage, so extracting the archive results in non-readable symbols. Aspose.Zip faced me with the exactly same problem. Is there a way to solve this in .net core 3.1 stack? Maybe in .net 5?
By default, both .NET Core 3.1 and .NET 5+ includes limited set of encodings out-of-the-box. But, you can fix this by only pair rows of code: you just need to register a custom encoding provider (see https://learn.microsoft.com/en-us/dotnet/api/system.text.codepagesencodingprovider?view=net-5.0) and voila - get needed encoding by its number:
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
var encoding = Encoding.GetEncoding(866);
Then you can easily extract files from a zip, archived in Win Explorer, without non-ascii symbols problem.
I've inherited a pretty old Ant project, and been asked to 'upgrade it to java 1.7'.
Currently the project is 1.5, and has a mix of JAXB 1.0 and JAXB 2.0.
JAXB 2.0 bits upgrade fine, but when I try and upgrade the JAXB 1.0 bits to jdk1.7 I get errors such as;
Executing 'C:\Program Files\Java\jdk1.7.0_51\bin\java.exe' with arguments:
'-classpath'
'C:\Users\xyz123\development\proj\lib-common\JAXB1\jaxb-xjc-1.0-ea.jar'
'com.sun.tools.xjc.Main'
'C:\Users\xyz123\development/proj/xml/dtd/doodah.dtd'
'C:\Users\xyz123\development/proj/xml/xjs/doodah.xjs'
'-d'
'C:\Users\xyz123\development/proj/packages/mis-reports/doodah/xml'
The ' characters around the executable and arguments are
not part of the command.
An error has occurred in the JAXB compiler.
Please submit a bug report to jaxb-feedback#java.sun.com
containing your input files as well as the output below.
java.lang.NoSuchFieldError: INITIAL_COLOR
at javax.xml.bind.ValidatableObject.<init>(ValidatableObject.java:32)
at javax.xml.bind.MarshallableObject.<init>(MarshallableObject.java:54)
at javax.xml.bind.MarshallableRootElement.<init>(MarshallableRootElement.java:97)
at com.sun.tools.xjc.dtdx.DTDX.<init>(DTDX.java:57)
at com.sun.tools.xjc.dtd.DTD.convert(DTD.java:113)
at com.sun.tools.xjc.dtd.DTDParser.parse(DTDParser.java:92)
at com.sun.tools.xjc.Main.doCompile(Main.java:85)
at com.sun.tools.xjc.Main.compile(Main.java:106)
at com.sun.tools.xjc.Main.main(Main.java:275)
Anyone got any ideas? I don't see much (if any) info on running jaxb 1.0 on a recent JDK.
It seems to me that this is an impossible task because;
JAXB 1.0 and JAXB 2.0 implementations are different, i.e. JAXB 1.0 requires javax.xml.bind.MarshallerObject which does not exist in JAXB 2.0
JAXB 2.0 is provided in the 1.7 runtime
JAXB 2.0 classes will always be present when trying to compile JAXB 1.0 against 1.7jdk
So unless there is some way to load the JAXB 1.0 runtime before the JDK runtime, I think I am stumped.
It also looks like JAXB 2.0 turns element values (rather than attributes) into 'value' rather than JAXV 1.0 'content' so any code getters/setters will have to change to the corresponding getter/setter.
How do I get programatically current Windows 10 UAP version?
I did not find any suitable class or method.
GetVersionEx does not seem to be supported.
For things like metrics and analytics, you can use the new AnalyticsInfo class. The version number you get is a string-ized representation of the four-part version number (major.minor.revision.build).
Is there an XQuery command to load a text file?
I can load an xml document by doing the following;
declare variable $text := doc("test.xml");
But it only seems to work if test.xml is a well-formed xml document. What I want is to load a plain test.txt file into a string variable. Something like this;
declare variable $str as xs:string := fn:loadfile("test.txt");
Can it be done?
I'm using the Saxon engine but I can't find an answer in the saxon documentation.
Indeed you can find one implementation of the file functions in Zorba: http://www.zorba-xquery.com/doc/zorba-1.4.0/zorba/xqdoc/xhtml/www.zorba-xquery.com_modules_file.html
XQuery 3.0 has the function fn:unparsed-text (which was originally defined in XSLT), which does exactly what you want. XQuery 3.0 is still a work in progress though, but whilst there are not many XQuery 3.0 processors available, many XQuery processors already support this function (including Saxon).
There is a standardization effort for this on EXPath. A spec already exists for an XQuery File module that is capable of doing what you describe: EXPath File Module Spec.
Yet, I don't know how many implementations are out there. Saxon doesn't seem to implement it unfortunately (Or, please point me to it). An example implementation is shipped with zorba (see XQDoc Site of Zorba). If you want to know how to get started with zorba, you can check out this tutorial: Get Started with XQuery and Zorba.
XQuery by default( means fn: namespace ) doesn;t have any file-access methods.
MarkLogic :
xdmp:filesystem-file()
xdmp:filesystem-directory()
Zorba:
already mentioned by user457056
Exist
Exist File Module
Saxon since version 9.2 has an extension of fn:collection that can be used to read unparsed text. Here is an example:
collection('file:///c:/TEMP?select=text.txt;unparsed=yes')
This is described under "Changes in this Release" for 9.2. Apparently it is not mentioned in the function library documentation. However it works well and I have been using it a lot.