Is there a more fluid way of writing a series of updateMasks? - firebase

I am sending a query to patch the value of a few fields. Do I need to separate these updateMasks? Is there an alternative API that passes in a list instead of arguments separated by an '&'? I was hoping for something along the lines of updateMask.fieldPaths=lastName&firstName f.e.
string dataQuery = $"https://firestore.googleapis.com/v1beta1/projects/PROJECTID/databases/(default)"
+ "/documents/items/{localId}?updateMask.fieldPaths=firstName&updateMask.fieldPaths=lastName"

Related

How to verify text but except some text in line using robot framework

I have to verify text that present on web page but in the text line have dynamic wording that I don't know how to verify this situation.
Wait Until Element Contains &{verScript}[Script] Test automate for 50,000 time timeout=60s
I want to verify text "Test automate for 50,000 time" but 50,000 is dynamic value. I don't want to verify 50,000 in this locator and can it whatever for this value in line.
Can any help me please.
using set
#{queryResultsA}= split string Test automate for 50,000 time
#{queryResultsB}= split string Test automate for XX,XXX time
${z} = Evaluate (set(${queryResultsA}) - set(${queryResultsB}))
## here ${z} will be 50,000
Using keyword
will return all lines on the page which are matching given string. the following keyword will return Lines as one string concatenated back together with newlines
Get Lines Containing String Test automate for
for more keywords
which match partial and full text/strings
using regex and pattern matching

LINQ query on dotnet code and how concat will work here

i am not a dot net programmer but need to migrate dotnet code to java .having issue understanding this follwing piece
Lets say specificTermical and ShipTo have latitutde property with different value so what happends when we use concat what will be the final value eg. 23.10+43.10 or something else
List<OrderDispatchItemDTO> locations =(List<OrderDispatchItemDTO>) msg.Details.Select(x => x.SpecificTerminal).Concat(msg.Details.Select(x => x.ShipTo));
The line of code that you provide returns a List of OrderDispatchItemDTO objects, that contains the values of both the SpecificTerminal and ShipTo properties of the Details objects.
It doesn't make any kind of calculation between the values of SpecificTerminal and ShipTo properties; it only adds both of them in a common list.
More detailed:
The Select method returns a new IEnumerable of the selected objects
And the Concat method concatenates the second collection into the first.
Concat is a string method. When you concatenate "23.10" and "43.10", it gives "23.1043.10". Therefore combining the two strings together.
To do any calculation in c#, you have to convert from strings data types to other mathematical data type that fits the say.
You may convert those two values to float and add them as shown below:
Float sum = Convert.ToFloat(23.10) + Convert.ToFloat(43.10);

Using Marklogic Xquery data population

I have the data as below manner.
<Status>Active Leave Terminated</Status>
<date>05/06/2014 09/10/2014 01/10/2015</date>
I want to get the data as in the below manner.
<status>Active</Status>
<date>05/06/2014</date>
<status>Leave</Status>
<date>09/10/2014</date>
<status>Terminated</Status>
<date>01/10/2015</date>
please help me on the query, to retrieve the data as specified above.
Well, you have a string and want to split it at the whitestapces. That's what tokenize() is for and \s is a whitespace. To get the corresponding date you can get the current position in the for loop using at. Together it looks something like this (note that I assume that the input data is the current context item):
let $dates := tokenize(date, "\s+")
for $status at $pos in tokenize(Status, "\s+")
return (
<status>{$status}</status>,
<date>{$dates[$pos]}</date>
)
You did not indicate whether your data is on the file system or already loaded into MarkLogic. It's also not clear if this is something you need to do once on a small set of data or on an on-going basis with a lot of data.
If it's on the file system, you can transform it as it is being loaded. For instance, MarkLogic Content Pump can apply a transformation during load.
If you have already loaded the content and you want to transform it in place, you can use Corb2.
If you have a small amount of data, then you can just loop across it using Query Console.
Regardless of how you apply the transformation code, dirkk's answer shows how you need to change it. If you are updating content already in your database, you'll xdmp:node-delete() the original Status and date elements and xdmp:node-insert-child() the new ones.

AvalonEdit reordering of document lines

We have currently started to evaluate AvalonEdit. We want to use it for a custom language. One of our requirements is to reorder and also to sort document lines by a certain criteria. How can this be accomplished?
Thanks in advance!
AvalonEdit provides the ICSharpCode.AvalonEdit.Document.DocumentLine class but this class just provides meta data on the line's length, starting and ending offset and so on.
In my opinion, there are 2 ways to accomplish your problem
Loop through all lines using TextEditor.LineCount and save the Line into a DocumentLine using TextEditor.Document.GetLineByNumber(int number). Furthermore you can use TextEditor.Document.GetText(DocumentLine.Offset, DocumentLine.Length to get the line's text
Use TextEditor.Text.Split('\n') to get all lines as a string array.
I'd recommend you using the DocumentLine method. Even if you have to use the GetText method in order to get the line's text the meta data on the lines is very nice.
To get all DocumentLines you can use a loop
List<DocumentLine> DocumentLines = new List<DocumentLine>(TextEditor.LineCount - 1);
for (int i = 1; i < TextEditor.LineCount; i++)
{
DocumentLines.Add(TextEditor.Document.GetLineByNumber(i));
}

Acquiring all nodes that have ids beginning with "ABC"

I'm attempting to scrape a page that has about 10 columns using Ruby and Nokogiri, with most of the columns being pretty straightforward by having unique class names. However, some of them have class ids that seem to have long number strings appended to what would be the standard class name.
For example, gametimes are all picked up with .eventLine-time, team names with .team-name, but this particular one has, for example:
<div class="eventLine-book-value" id="eventLineOpener-118079-19-1522-1">-3 -120</div>
.eventLine-book-value is not specific to this column, so it's not useful. The 13 digits are different for every game, and trying something like:
def nodes_by_selector(filename,selector)
file = open(filename)
doc = Nokogiri::HTML(file)
doc.css(^selector)
end
Has left me with errors. I've seen ^ and ~ be used in other languages, but I'm new to this and I have tried searching for ways to pick up all data under id=eventLineOpener-XXXX to no avail.
To pick up all data under id=eventLineOpener-XXXX, you need to pass 'div[id*=eventLineOpener]' as the selector:
def nodes_by_selector(filename,selector)
file = open(filename)
doc = Nokogiri::HTML(file)
doc.css(selector) #doc.css('div[id*=eventLineOpener]')
end
The above method will return you an array of Nokogiri::XML::Element objects having id=eventLineOpener-XXXX.
Further, to extract the content of each of these Nokogiri::XML::Element objects, you need to iterate over each of these objects and use the text method on those objects. For example:
doc.css('div[id*=eventLineOpener]')[0].text

Resources