In PlantUml, I have an object like this:
object MyObject {
#field1
#field2
}
Which renders like this:
I want to have more space between the rows which have the field names (in this case, field1, field2).
I tried this:
skinparam object {
DefaultPadding 40
BoxPadding 40
ParticipantPadding 40
Padding 40
}
skinparam Default {
DefaultPadding 40
BoxPadding 40
ParticipantPadding 40
Padding 40
}
None of this skinning helped.
So is there a way to have spacing between the rows that contain field names?
Not a real solution, but perhaps a possible workaround - you can use newline characters within the field names like this:
object MyObject {
#field1\n
#field2\n
}
Related
I am trying to assign multiple values for one variable in a table. One for the string name, and one for an integer. The code would go:
items = {
potion = "Potion", 100
}
I do not know how to formally write this, and how to call for those specific values.
(Do you call it like this?)
io.write(item.potion.1) --> Potion
io.write(item.potion.2) --> 100
(Or something else?)
Please help. :I
You can assign those values to a table indexed by numbers or identifiers:
-- identifiers
items = {
potion = {name = "Potion", value = 100},
}
print(items.potion.name, items.potion.value)
-- numeric indexes
items = {
potion = {"Potion", 100},
}
print(items.potion[1], items.potion[2])
I personally prefer the former approach (as it's more maintainable, even though a bit more verbose), but either one should work.
Lua allows for multiple assignments to multiple variables.
like so:
potion, value = "Potion", 100
but this can not be done inside a table definition.
items = {
potion = "Potion", 100
}
What your code here is doing is setting potion to the value "Potion" and then the , ends the assignment. The next assignment is 100 which will be assigned to a default key, in this case 1.
In side a table you end each assignment with a , so your tables contents are equal to:
items = {
potion = "Potion",
[1] = 100
}
To accomplish the desired behavior you can nest tables:
items = {
potion = {
"Potion",
100
}
}
This example can be accessed like items.potion[1] not like items.potion.1 this is because the . notation can't be used with a key that begins with a number.
maybe I'm doing it the wrong way, but I want to combine 2 arrays of different length in one object, so I use this code:
function MyArrayOfFilesAndFolders(){
var folders = [my array of folders] // 60 items
var files = [my array of files] // 220 items
var res = {
folders: folders,
files: files
}
return res
}
The resulting object has 60 items for folders, but only 100 items for files (despite the fact that the original array "files" contains 220 items).
There's something wrong in this method or is a GAS bug?
I'm missing something else?
Thanks for any help
Like Jonathon says, the debugger has a limit on the length of the arrays and in some cases it truncates long arrays to 100 items.
To test the real length of an array, it's better to use Logger.log("number of items: " + array.length).
Not sure how you want it to display the values... Does this help?:
function MyArrayOfFilesAndFolders(){
var folders = ["I", "Am", "Robot"];
var files = ["Yes","In","Deed"]
var res = folders+files;
Logger.log(res)
}
If it doesn't can you be more specific?
Cheers!
I have documents in my solr already indexed. I want to find Producer and model in tire.
I have file with producer and model like this:
Nokian;WR G2 SUV
Nokian;WR SUV
Nokian;V
Query:
((productname:"NOKIAN" OR producer:"NOKIAN") AND (productname:"V" OR description:"V" OR referencenumber:"V"))
But it found for example this:
"2X NOKIAN 215/55 R17 94V LINE (3)"
Because in this product speed index is V and here model is Line. My algorithm take this product for Nokian;V not for Nokian;Line.
How to ask solr to gives me only this product where this V don't have any other letters around?
LETNIE 225/45/17 94V NOKIAN V FINLAND - PŁOTY
This found beautiful. Its Nokian;V.
As far as I understand your question you need to put MUST quantifier before each boolean clause. So query will look like:
(
+(productname:"NOKIAN" OR producer:"NOKIAN") AND
+(productname:"V" OR description:"V" OR referencenumber:"V")
)
If your productname field is of type text it has the WordDelimiterFilter in the analysis chain. One of the default behaviors of this filter is to split terms on letter-number boundaries causing:
2X NOKIAN 215/55 R17 94V LINE (3)
to generate the following tokens:
2 X NOKIAN 215 55 R 17 94 V LINE 3
(which matches the "V" in your query).
You can always run debug=results to get an explanation for why something matches. I think in this particular case, you might construct another field type for your productname field that analyzes your model string less aggressively.
I solved the problem in such a way that sorted out brand,model Dictionary. I used my own comparer.
public class MyComparer : IComparer<string>
{
int IComparer<string>.Compare(string x, string y)
{
if (x == y)
{
return 0;
}
if (x.Contains(y))
{
return -1;
}
else
{
return 1;
}
}
}
All model that have V or H now are on the end of Dcitionary. It's works very well. Because first solr searched Nokian;Line and this product where found add to other list alreadyFound and skip this product where found model. Thanks all for your reply.
I want to get the text of the element without including the text of its elements. I have tried getText(), but it returns text that includes all the child elements text.
In the following example: When I retrieved text from the first div, it returns text that includes all its subelements.
<div class="row”>
<div class="col-lg-4 section”>
<div class="col-md-12”>
inseam 28 30 32
</div>
</div>
<div class="col-lg-5 section”>
<div class="col-md-13”>
inseam 28 34 36
</div>
</div>
</div>
Please let me know how to do this using webdriver in java.
Thanks
sean
I've been searching for the same thing for a while, here's my solution for those who can specify a WebElement or a list of WebElements:
def remove_child_text_from_webelement(webelement):
# Declaring the current text for this webelement
current_text = webelement.text
# Getting its childs elements in a list
childs_list = webelement.find_elements_by_xpath('./*')
# Manipulating text to remove child text from parents
childrens_text_list = [child.text for child in childs_list]
#return (childrens_text_list,type(childrens_text_list))
for children_text in childrens_text_list:
match_index = current_text.find(children_text)
if match_index != -1:
match_length = len(children_text)
current_text = current_text[0:match_index] + current_text[match_index+match_length:]
return current_text
Now you can do something like:
[remove_child_text_from_webelement(e) for e in browser.find_elements_by_xpath('//div[contains(#class,"person")]')]
When I retrieved text from the first div with class 'row', it returns text that includes all its subelements.
This happened because you retrieved text from the parent div and hence all the innerHTML/text of the child divs were retrieved along with them.
Below is the way to retrieve the necessary innerHTML/text only:
1- for 'inseam 28 30 32':
String text = driver.findElement(By.xpath("//div[#class='col-md-12']")).getText();
OR
String text = driver.findElement(By.className("col-md-12")).getText();
2- for 'inseam 28 34 36':
String text = driver.findElement(By.xpath("//div[#class='col-md-13']")).getText();
OR
String text = driver.findElement(By.className("col-md-13")).getText();
Not tried it specifically with Selenium, but with jQuery you can use contents() to get all elements including raw text nodes, filter by nodeType 3 (text nodes) and then take the first, in your example:
JSFiddle: http://jsfiddle.net/TrueBlueAussie/p33gcfk2/1/
var text = $('.row').contents().filter(function () {
return this.nodeType == 3;
}).first();
alert(text.text());
This is happening because you are trying to get the text of parent tag. If you want to get tag of particular child, you have to reach all the way there. You can take use of "nth-child" or "nth-of-type". For e.g in this case, if you want to have return this text "inseam 28 34 36".
The CSS selector will be "div.row div:nth-of-type(3)" or you can directly specify the div class "div.col-md-13"
You can refer to this article on more on selectors https://saucelabs.com/resources/selenium/css-selectors
I am importing an Excel file which is formatted like a report - that is some columns are only populated once for each group of rows that it belongs to, such as:
CaseID |Date |Code
157207 | |
|8/1/2012 |64479
|8/1/2012 |Q9967
|8/1/2012 |99203
I need to capture one of these group headers (CaseID, in the example above) and use it for subsequent rows where the field is blank, then save the next value that I encounter.
I have added a variable (User::CurrentCaseId) and a Script transform, with the following code:
public class ScriptMain : UserComponent
{
string newCaseId;
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
if (!Row.CaseIDName_IsNull && Row.CaseIDName.Length > 0)
newCaseId = Row.CaseIDName;
else
newCaseId = "DetailRow";
}
public override void PostExecute()
{
base.PostExecute();
if (newClaimNumber != "DetailRow")
Variables.CurrentCaseId = newCaseId;
}
Basically, I am trying to read the value when present and save it in this variable. I use a conditional split to ditch the rows that only have the CaseID and then use a derived column to put the variable value into a new column to complete the detail row.
Alas, the value is always blank (placed a data viewer after the derived column). I modified the script to always set the variable to a fixed string - the derived column is still blank.
This seemed like a good plan... I received some feedback in the MS forums that you can't set a variable value and use its new value within the same Data Flow Task. If that is so, the only solution I can think of is to write the CaseID out to a table when present and read it back in when absent. I really hate to do that with several million rows (multiple Excel worksheets). Any better ideas?
Best,
Scott
This can be a good starting point for you.
I used the following file as the source. Saved it into C:\Temp\5.TXT
CaseID |Date |Code
157207 | |
|8/1/2012 |64479
|8/1/2012 |Q9967
|8/1/2012 |99203
157208 | |
|9/1/2012 |77779
|9/2/2012 |R9967
|9/3/2012 |11203
Put a DFT on the Control Flow surface.
Put Script Component as Source on the DFT
3.1. Go to Inputs and Outputs section
3.2. Add Output. Change it name to MyOutput.
3.2.1 Add the following output columns - CaseID, Date, Code
3.2.1 The data types are four-byte unsigned integer [DT_UI4], string [DT_STR], string [DT_STR]
Now go to Scripts // Edit Script. Put the following code. Make sure to add
using System.IO;
to the namespace area.
public override void CreateNewOutputRows()
{
string[] lines = File.ReadAllLines(#"C:\temp\5.txt");
int iRowCount = 0;
string[] fields = null;
int iCaseID = 0;
string sDate = string.Empty;
string sCode = string.Empty;
foreach (string line in lines)
{
if (iRowCount == 0)
{
iRowCount++;
}
else
{
fields = line.Split('|');
//trim the field values
for (int i = 0; i < fields.Length; i++)
{
fields[i] = fields[i].Trim();
}
if (!fields[0].Equals(string.Empty))
{
iCaseID = Convert.ToInt32(fields[0]);
}
else
{
MyOutputBuffer.AddRow();
MyOutputBuffer.CaseID = iCaseID;
MyOutputBuffer.Date = fields[1];
MyOutputBuffer.Code = fields[2];
}
}
}
}
}
Testing your code: Add a Union All components right beneath where you put the Script component. Connect the output of the Script component to the Union All component. Put data viewer.
Hopefully this should help you. Please let us know. I responded to a similar question today; please check that one out as well. That may help in solidfying the concept - IMHO.