intellij not honoring .editorconfig - intellij-idea

I have a code block being auto-formatted as:
.withStuff(ImmutableList.of(Stuff.builder().withName("Animaniacs").build(),
Stuff.builder().withName("Pinky and the Brain").build()))
.build());
That ideally I want idea to auto format as:
.withStuff(ImmutableList.of(
Stuff.builder().withName("Animaniacs").build(),
Stuff.builder().withName("Pinky and the Brain").build()
))
.build());
I doubt I can get exactly what I'm after, it seems idea is failing to honor several settings in the .editorcofig:
ij_java_call_parameters_new_line_after_left_paren = true
ij_java_call_parameters_right_paren_on_new_line = true
ij_java_call_parameters_wrap = split_into_lines
ij_java_keep_line_breaks = true
Can anyone advise how to fix this?

If you put a line-break before ImmutableList.of the default formatting will give you this:
.withStuff(
ImmutableList.of(
Stuff.builder().withName("Animaniacs").build(),
Stuff.builder().withName("Pinky and the Brain").build()
)
).build());
which is not exactly what you wanted but it is much nicer than your first example and it aligns the list items under each other like you wanted.

Related

Setting Qtile Margins Dynamically Through Keyboard Input

I'm looking to set up keybindings to increase/decrease gaps and margins in Qtile similar to what the following does in i3-gaps:
bindsym $mod+equal gaps inner current plus 5
bindsym $mod+minus gaps inner current minus 5
bindsym $mod+Shift+equal gaps outer current plus 5
bindsym $mod+Shift+minus gaps outer current minus 5
I can somewhat get the equivalent of outer-gaps to work with the following code:
def increase_gap(qtile):
qtile.screens[0].top.size = screens[0].top.size+5
qtile.screens[0].right.size = screens[0].top.size+5
qtile.screens[0].left.size = screens[0].top.size+5
#margs = screens[0].bottom.margin
screens[0].bottom.margin[0] = screens[0].bottom.margin[0]+5
screens[0].bottom.size=20
qtile.screens[0].cmd_resize()
def decrease_gap(qtile):
qtile.screens[0].top.size = max(screens[0].top.size-5, 0)
qtile.screens[0].right.size = max(screens[0].top.size-5, 0)
qtile.screens[0].left.size = max(screens[0].top.size-5, 0)
#margs = screens[0].bottom.margin
screens[0].bottom.margin[0] = max(screens[0].bottom.margin[0]-5, 0)
screens[0].bottom.size=20
qtile.screens[0].cmd_resize()
Key([mod, "shift"], "equal", lazy.function(increase_gap), desc="Increase gap"),
Key([mod, "shift"], "minus", lazy.function(decrease_gap), desc="Decrease gap"),
I'm not sure this is the right way to do things, though. I'm not sure if this is supposed to be manipulated this way. I'm not really sure that the cmd_resize() function is what I should be using, however from trial and error it's what I've found to work. I'm not sure why the screen[0].bottom.size=20 (20 is the size of my bottom bar. I know I shouldn't hardcode, but I'm trying to produce a proof of concept before I clean the code) is needed, but the bar starts floating if I don't have that there. Finally, increasing and decreasing the gap gets close, but not quite to the original configuration. The gaps look slightly different than the original. So, I'm not sure this is the right way to accomplish this, and I could use the advice.
Secondly, though that gets close to accomplishing what I want on the outer gaps, I have not been able to make any headway to getting the inner gaps to work. I initially tried changing the margin parameter of a layout, and when that didn't work I tried simply initializing a new layout and replacing the old one as posted below, but neither approach worked.
def column_increase_margin(qtile):
current_margin = current_margin + 5
layouts[0] = layout.Columns(border_focus_stack='#d75f5f', margin=current_margin, border_width=0)
screens[0].bottom.size=20
qtile.screens[0].cmd_resize()
I've tried going through the code here, but it's a big project and I'm struggling to make heads or tails from it.
Any advice would be appreciated.
If I understand what you want, you can add the following to the Layout class in libqtile/layout/base.py:
def cmd_increase_margin(self):
self.margin += 10
self.group.layout_all()
def cmd_decrease_margin(self):
new_margin = self.margin - 10
if new_margin < 0:
new_margin = 0
self.margin = new_margin
self.group.layout_all()
You can then add some keys in your config.py to increase and decrease margins. e.g.
KeyChord([mod], "m", [
Key([], "Up", lazy.layout.increase_margin()),
Key([], "Down", lazy.layout.decrease_margin())
],
mode="Margins"
),
I'm new to qtile, so maybe there is something wrong with the above approach, but it seems to work.

where is "PS_META_DESCRIPTION" and "PS_META_KEYWORDS" and how can i change it?

in classes/Meta.php i found this lines in "completeMetaTags" function:
if (empty($meta_tags['meta_description'])) {
$meta_tags['meta_description'] = Configuration::get('PS_META_DESCRIPTION', $context->language->id) ? Configuration::get('PS_META_DESCRIPTION', $context->language->id) : '';
}
if (empty($meta_tags['meta_keywords'])) {
$meta_tags['meta_keywords'] = Configuration::get('PS_META_KEYWORDS', $context->language->id) ? Configuration::get('PS_META_KEYWORDS', $context->language->id) : '';
}
it seems, when a page doesn't have any keywords or description, it tries to set "PS_META_KEYWORDS" and "PS_META_DESCRIPTION" to those.
but the value of "PS_META_DESCRIPTION" and "PS_META_KEYWORDS" are empty for me and i don't know where can i change these values ?
i searched "configuration" table but i can't find "PS_META_DESCRIPTION" and "PS_META_KEYWORDS" values.
I cannot find what you are searching for in the whole raw Prestashop 1.6 repository, except the legacy code you are talking about.
A way to set this could be to make a simple module with these fields to custom, you can find an helper here : https://validator.prestashop.com
Anyway it's not possible with the actual version, it surely was in the past.

Talend - Dynamic Column Name (Enterprise version)

Can anyone help me solve this case?
I have much file to process, two of them is like on below screenshot with my expected output.
I use this transformation on Talend: tFileList---tInputExcel---tUnpivotRow---tMap---tPostgresqlOutput
The output is different to my expected output. This is the screenshot of the output
Can anyone help me to reach my expected output which is like on my first picture above?
This will be pretty hard. You'd have to handle that as a text file. And whenever you found "store" value in the first column you'd update your type with the value.
Here's how I'd start:
Basically tJavaFlex begin piece would contain:
String col1Type
String colNType
main part:
if input_row.col0.equalsIgnoreCase("store") {
col1Type = input_row.col1;
col2Type = input_row.col2;
colNType = input_row.colN;
continue; /*(so this record will be Ignored for the rest of the components!)*/
}
output_row.col1Type = col1Type;
output_row.col1Value = Integer.valueOf(input_row.col1);
/*coz we have text and need numbers :( */
I think using propagate results will save you from writing down all the other fields.
And from here it would be very simple as you have key-type-value-type-value-type-value results.

RavenDB DeleteByIndex RetrieveDetails

I have a RavenDB Index that I am using to delete a bunch of documents at one time. I would like to know home many documents were actually deleted after the operation is done, however I can't figure out how to get that information from a DatabaseCommands call. For a RavenQuery/DocumentQuery you can use the out Statistics, but I haven't found anything for the DatabaseCommands.
I did find a RetrieveDetails flag as part of the BulkOperationsOptions but I'm not sure how to actually see the details. Here is what my query looks like
var op = connection.Store.DatabaseCommands.DeleteByIndex(
"Store/ByExpiration",
new IndexQuery
{
Query = "Expiration:yes"
},
new BulkOperationOptions
{
AllowStale = false,
RetrieveDetails = true
});
op.WaitForCompletion();
At this point I am not sure how to get the details once the operation has completed. Has anyone else figured out how to get these details?
The result is returned as a RavenJToken in WaitForCompletion.
var result = op.WaitForCompletion();
The documentation isn't clear on this.
Hint: When I can't find examples in the documentation I look at the RavenDB source code unit tests for examples, e.g. the ShouldRetrieveOperationDetailsWhenTheyWereRequested unit test.

Mule ESB: How to do Condition checking in Datamapper using Xpath

i'm facing issue in xpath-I need do a check two attribute values, if the condition satisfies need to do hard code my own value. Below is my xml.
I need to check the condition like inside subroot- if ItemType=Table1 and ItemCondition=Chair1 then i have to give a hard coded value 'Proceed'( this hard coded value i will map to target side of datamapper).
<Root>
<SubRoot>
<ItemType>Table1</ItemType>
<ItemCondition>Chair1</ItemCondition>
<ItemValue>
.......
</ItemValue>
</SubRoot>
<SubRoot>
<ItemType>Table2</ItemType>
<ItemCondition>chair2</ItemCondition>
<ItemValue>
.......
</ItemValue>
</SubRoot>
....Will have multiple subroot
</Root>
I have tried to define rules as below, but it is throwing error
Type: String
Context:/Root
Xpath: substring("Proceed", 1 div boolean(/SubRoot[ItemType="Table1" and ItemCondition="Chair1"]))
But it is throwing error like
net.sf.saxon.trans.XPathException: Arithmetic operator is not defined for arguments of types (xs:integer, xs:boolean)
Is there any other shortcut way to perform this.Could you please help me, i have given lot more effort. Not able to resolve it. Thanks in advance.
I am not sure where you are applying this but the XPath expression you are looking for is:
fn:contains(/Root/SubRoot[2]/ItemCondition, "chair") and fn:contains(/Root/SubRoot[2]/ItemType, "Table")
So here is an example returning "Proceed" or "Stop" as appropriate:
if (fn:contains(/Root/SubRoot[1]/ItemCondition, "Chair") and fn:contains(/Root/SubRoot[2]/ItemType, "Table")) then 'Proceed' else 'Stop'
To implement the above condition , i was initially tired to do in xpath, gave me lot of error. I have implemented by simple if else condition in script part of data mapper
if ( (input.ItemType == 'Table') and (input.ItemCondition == 'chair')) {
output.Item = 'Proceed'}
else {
output.Item = 'Stop '};
Make sure about your precedence. Example, Here in the xml structure( or converted POJO) ItemType has to be checked first then followed with ItemCondition.
&& not seems to be working for me, change to 'and' operator
If you were first time trying to implement the logic. It may help you.