Build jb
JaversBuilder jb = JaversBuilder.javers().withMappingStyle(MappingStyle.BEAN).withListCompareAlgorithm(ListCompareAlgorithm.LEVENSHTEIN_DISTANCE).withPrettyPrint(true)
and then
log.info(diff.prettyPrint())
gives
1. ListChange{globalId:'fn.dsl.diff.javers.Instance/Folder:{0F1E2D3C-4B5A-6978-8796-A5B4C3D2E1F0}', property:'permissions', containerChanges:[(3).removed:'fn.dsl.diff.javers.Permission {type: 'ALLOW', mask: '135159', GN: 'entos_users_tst#tn.fntst.ru', GT: 'GROUP', source: 'DIRECT', depth: 'THIS_OBJECT_ONLY' }', (2).'fn.dsl.diff.javers.Permission {type: 'ALLOW', mask: '999415', GN: 'entos_admins_tst#tn.fntst.ru', GT: 'GROUP', source: 'DIRECT', depth: 'THIS_OBJECT_ONLY' }' to 'fn.dsl.diff.javers.Permission {type: 'ALLOW', mask: '135159', GN: 'entos_users_tst#tn.fntst.ru', GT: 'GROUP', source: 'DIRECT', depth: 'THIS_OBJECT_ONLY' }']}
, but expected pretty formatting. Like in docs - http://javers.org/documentation/diff-examples/#compare-valueobjects
System.out.println(diff);
//.. shouldDetectBossChange()
Diff:
1. ReferenceChange{
globalId:'org.javers.core.examples.model.Employee/Great Developer',
property:'boss',
oldRef:'org.javers.core.examples.model.Employee/Manager One',
newRef:'org.javers.core.examples.model.Employee/Manager Second'}
2. ListChange{
globalId:'org.javers.core.examples.model.Employee/Manager Second',
property:'subordinates',
containerChanges: [(0).added:'org.javers.core.examples.model.Employee/Great Developer']}
3. ListChange{
globalId:'org.javers.core.examples.model.Employee/Manager One',
property:'subordinates',
containerChanges:[(0).removed:'org.javers.core.examples.model.Employee/Great Developer']}
What am I do wrong?
Should I expect pretty formatting as showed in docs or it was formatted manually?
In the doc you are referring to, line breaks was added manually.
diff.toString() and diff.prettyPrint() (as it's only the alias)
adds br after each change.
So even ListChange with a series of ElementChanges is printed in a single line.
Use ChangeProcessor
to customize your diff formatting. See SimpleTextChangeLog example
Related
I want to strip the "other" array if its length is 0
Here is my schema
languages: Yup.object({
native: Yup.string().oneOf(languages),
other: Yup.array()
.max(5)
.of(
Yup.object({
language: Yup.string().oneOf(languages),
speaking: Yup.string().oneOf(fluency),
reading: Yup.string().oneOf(fluency),
writing: Yup.string().oneOf(fluency),
})
)
.when("other.length", {
is: 0,
then: (s) => s.strip(),
}),
}),
The error I get:
Uncaught Error: Cyclic dependency, node was: "other"
Thank beforehand
For someone who may encounter the same issue:
I found the issue in:
.when(".length", {
is: 0,
then: (s) => s.strip(),
I needed to reference the .length of the array rather than the arr.length and this resolved the problem.
So I'm working with amcharts v4 and Sankey diagram.
I'm trying a dataset that is quite simple but I have the node 500 and 652 on same level and causing some visual issues as in the picture below.
I've tryied to arrange differently the dataset but having same issue.
Anyone can help?
Is even possibile to reduce the links width in order to make it fit better? (tryied everything from SankeyLink but with no results)
[{from: '100', to: '200', value: 1},
{from: '200', to: '450', value: 1},
{from: '450', to: '652', value: 1},
{from: '450', to: '652', value: 1},
{from: '652', to: '500', value: 1},
{from: '652', to: '500', value: 1},
{from: '500', to: '650', value: 1},
{from: '500', to: '650', value: 1}]
enter image description here
So it seems to be a bug becouse all nodes have names that are all numbers.
Below the reply from amcharts responsable.
It seems to be a bug caused by all-number names. If I change the name of the last node to something that starts with a letter, the chart displays fine.
Is it possible to change the line spacing for the abstract specified in my YAML header to single space, while leaving the rest of the document in double space? My YAML is below:
output: pdf_document
number_sections: true
title: |
| My Title
author:
- Me
header-includes:
- \usepackage{setspace}\doublespacing
- \usepackage{float}
abstract: "My abstract"
keywords: "My keywords"
date: "`r format(Sys.time(), '%B %d, %Y')`"
geometry: margin=1in
fontsize: 12pt
spacing: double
fig_caption: yes
indent: true
---
I've tried wrapping the abstract like so, but it did not work:
abstract:
- \usepackage{setspace}\singlespacing
"My abstract"
- \end{singlespacing}
The abstract is automatically wrapped, so it is enough to use \singlespacing before it:
---
output: pdf_document
number_sections: true
title: |
| My Title
author:
- Me
header-includes:
- \usepackage{setspace}\doublespacing
- \usepackage{float}
abstract: \singlespacing My abstract which has to be long enough to take multiple
lines otherwise one does not see the effect of single-spacing.
keywords: "My keywords"
date: "`r format(Sys.time(), '%B %d, %Y')`"
geometry: margin=1in
fontsize: 12pt
fig_caption: yes
indent: true
---
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for
authoring HTML, PDF, and MS Word documents. For more details on using R Markdown
see <http://rmarkdown.rstudio.com>.
Result:
I'm successfully getting data back through StreamBuilder and need to sort it. How can I sort a Map of my snapshot data by keys? Also, If you give an example of doing this my value that would help also. I think I want to do a SplayTreeMap, but if there is a better way please provide. Here is my dictionary...
{Vid2: {imageString: https://i.ytimg.com/vi/Amq-qlqbjYA/mqdefault.jpg, title: BLACKPINK - '마지막처럼 (AS IF IT'S YOUR LAST)' M/V, rank: 2, videoID: Amq-qlqbjYA}, Vid10: {imageString: https://i.ytimg.com/vi/KSH-FVVtTf0/mqdefault.jpg, title: EXO 엑소 'Monster' MV, rank: 10, videoID: KSH-FVVtTf0}, Vid6: {imageString: https://i.ytimg.com/vi/BVwAVbKYYeM/mqdefault.jpg, title: [MV] BTS(방탄소년단) _ DOPE(쩔어), rank: 6, videoID: BVwAVbKYYeM}, Vid3: {imageString: https://i.ytimg.com/vi/m8MfJg68oCs/mqdefault.jpg, title: [MV] BTS(방탄소년단) _ Boy In Luv(상남자), rank: 3, videoID: m8MfJg68oCs}, Vid4: {imageString: https://i.ytimg.com/vi/9pdj4iJD08s/mqdefault.jpg, title: BLACKPINK - '불장난 (PLAYING WITH FIRE)' M/V, rank: 4, videoID: 9pdj4iJD08s}, Vid1: {imageString: https://i.ytimg.com/vi/3s1jaFDrp5M/mqdefault.jpg, title: EPIK HIGH - 'BORN HATER' M/V, rank: 1, videoID: 3s1jaFDrp5M}, Vid8: {imageString: https://i.ytimg.com/vi/3QAcvc4Ysl0/mqdefault.jpg, title: LONNI - LA KPOP 2, rank: 8, videoID: 3QAcvc4Ysl0}, Vid5: {imageString: https://i.ytimg.com/vi/2ips2mM7Zqw/default.jpg, title: BIGBANG - 뱅뱅뱅 (BANG BANG BANG) M/V, rank: 5, videoID: 2ips2mM7Zqw}}
I would like to display it either by keys...
Vid1, Vid2, Vid3...
or by values like rank ie...
Vid1:rank "1", Vid2: rank "2", Vid3: rank "3"...
If the source is a map, this should do what you want:
final sorted = new SplayTreeMap<String,dynamic>.from(map, (a, b) => a.compareTo(b));
DartPad example
I need show this format: 12.123,33 € for use it in Spain.
Change period (point) for thousands and comma for decimals.
In my code I have:
<script type="text/javascript" src="js/kendo.culture.es-ES.js"></script>
The value of the decimal column (MySQL database) is: 12123.33
I tried with this code:
a)
$("#importe_oferta").kendoNumericTextBox({
culture: "es-ES"
format: "c2",
min: 0,
decimals: 2,
spinners: false
});
Result: 1.212.33.00 € ->wrong
b)
$("#importe_oferta").kendoNumericTextBox({
format: "c2",
min: 0,
decimals: 2,
spinners: false
});
Result: $12,123.33 ->wrong
c)
$("#importe_oferta").kendoNumericTextBox({
min: 0,
decimals: 2,
spinners: false
});
Result: 1,2123.43 ->wrong
And the same problem on the grid : 12,123.43 <-wrong
If anybody have the solution of this problem, please write a possible solution.
Thanks
Julio
You can try some work-around like this one:
$("#percentage").kendoNumericTextBox({
format: "{0:###########.########## $}",
culture: "es-ES",
min : 0,
max: 0.1,
step: 0.01
});