How to validate document ids which are generated by spring-data-elasticsearch - spring-data-elasticsearch

How to validate document ids (for length and format, using a regex or something equivalent) which are generated by spring-data-elasticsearch for each document. For example
ko9aCXYBBPcZl3qx_3HQ
hI9RCXYBBPcZl3qx93FG

Related

HTML2FO not working in BI Publisher to convert HTML stored in CLOB to rendered HTML in RTF

I'v using BI Publisher Desktop Template Viewer, and BI Publisher Enterprise to render HTML stored in the database as formatted HTML, and I'm not getting any output for the HTML field when using html2fo
I'm storing HTML in a CLOB field in the database.
To select into the XML I'm using something like this per Oracle's documentation:
SELECT '<![CDATA' || '['|| CLOB1 || ']' || ']>' as HTML
FROM TABLE1
I'm getting what I expect in the XML output. Field has the CDATA wrapper, and is HTML.
I've tried this in my RTF and output for that field is blank.
<?html2fo: HTML?>
I've also tried these, no difference.
<?HTML2FO: HTML?> --function in upper case
<?HTML2FO:HTML?> --no space, function in upper case
<?html2fo:HTML?> --no space, function in lower case
When I just used this, I see the raw CDATA/HTML
<?HTML?>
Any idea what I could be doing wrong here? Thanks.
There is an option/setting for CLOB fields in the data diagram, when configuring the how the data is selected. Default option is CLOB, and the other option is XML.
Different versions of BI Publisher will display this option differently. Here is from Oracle documentation, and then from the version I'm using.
If CLOB is selected, the data will be HTML escaped, and tags will change from < to <
Option 1
Keep the CLOB type, and remove the CDATA tag insertion from the select statement.
Option 2
Change to XML type, and keep the CDATA tag insertion in the select statement.

Rails/Dragonfly: is it possible to decode URL (/media/W1siZiIsInRzYW...) to get the model instance it refers to?

This is what I want to accomplish:
On an extranet with a feed wall, users just type non-formatted text (non style, just \n and links recognition).
But quite often, users want to add a link to a document which is stored in the same extranet (using dragonfly). Obviously, the link is quite awful to display (ex: https://extranet.com/media/l0ngUiD/original_filename.pdf?sha=31310881DAEF1).
This document refers to a Document instance which has a nice title, ex: "Original Filename (PDF)"
I would like those links to be (automatically) replaced by
Original Filename (PDF)
Problem is: how to find which model and which document this document refers to, using the UID and sha.
I guess this is possible as Dragonfly decodes the url, but I can't find how to (not much comments in the code).
The variant's UID is Base64 encoded, so when decoding the UID you will get a JSON encoded array of Dragonfly processor steps.
Here an actual example from a live database:
uid = 'W1siZiIsIjIwMTUvMDcvMDkvMDkvMTMvMDIvOTE3LzE5NDg3ODk0MDc1XzE4NGYzMjc0MWVfay5qcGciXV0'
Base64.decode64 uid
# => "[[\"f\",\"2015/07/09/09/13/02/917/19487894075_184f32741e_k.jpg\"]]"
Each step is an array with the step's operation in the first element and the step's arguments in the remaining.

How to format hash-based parameters in the URL when creating Blueprint API doc?

With the Rails Way of adding hashes in the parameter of an URL like so:
http://api.example.com?person[first]=Jane&person[last]=Doe&person[email]=jane#doe.com
How do I format the API Blueprint doc to accommodate a list of available hashes?
Parameters
person[first] (required, string, Jane) ... First name
This is not legal when I execute the document.
Any ideas or tips are welcome!
Per https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2, you must escape [] in URIs. As such, you need to do:
Parameters
person%5Bfirst%5D (required, string, Jane) ...
If you template the URI in your blueprint, you must also escape the [] there as well.
FYI, there is a bug in the original documentation for code generation in Apiary.io (if you are using that) and the generated URIs at the moment that does not properly handle the escaping. You can turn on the Beta documentation, which does not have that issue.

XML Schema - Allow Invalid Dates

Hi I am using biztalk's FlatFile parser (using XML schema) to part a CSV file. The CSV File sometimes contains invalid date - 1/1/1900. Currently the schema validation for the flat file fails because of invalid date. Is there any setting that I can use to allow the date to be used?
I dont want to read the date as string. I might be forced to if there is no other way.
You could change it to a valid XML date time (e.g., 1900-01-00:00:00Z) using a custom pipeline component (see examples here). Or you can just treat it as a string in your schema and deal with converting it later in a map, in an orchestration, or in a downstream system.
Here is a a C# snippet that you could put into a scripting functoid inside a BizTalk map to convert the string to an xs:dateTime, though you'll need to do some more work if you want to handle the potential for bad input data:
public string ConvertStringDateToDateTime(string param1)
{
return DateTime.Parse(inputDate).ToString("s",System.Globalization.DateTimeFormatInfo.InvariantInfo);
}
Also see this blog post if you're looking to do that in multiple places in a single map.

Ruby on rails string parsing

I have a string that is a bunch of XML tags.
Basically there is the contents to one tag I want and ignore everything else:
The input would look like:
<Some><XML><stuff>
<title type='text'>key</title>
<Some><other><XML><stuff>
The output would look like:
key
I'm not sure if XML is appropriate since there doesn't seem very much structure to this particular XML.
Can regex do this in RoR or is it more of just a pattern matching thing (true or false) in ruby on rails?
Thanks so much!
Cheers,
Zigu
No. If your source could not be strictly valid XML, I strongly suggest you to use Nokogiri.
Handle the source as an HTML document and extract the info you need in this way:
doc = Nokogiri::HTML("Your string with <key>some value</key>"))
doc.search('key').each do |value|
puts value.content # do whatever you want
end
Here's why you don't parse xml with regexen: RegEx match open tags except XHTML self-contained tags

Resources