Clang-format: don't align long variable assignment to equals sign - formatting

Clang-format is wrapping my long variable assignments. In doing so, however, it's also aligning any continuation lines relative to the equals sign, like this:
long long variable = 1000 | 1100000000001 | 122365781 | 1256523983472934
| 2452346256 | 1646478592 | 126234753952359
| 435234523425345;
However, I want this to respect ContinuationIndentWidth:
long long variable = 1000 | 1100000000001 | 122365781 | 1256523983472934
| 2452346256 | 1646478592 | 126234753952359
| 435234523425345;
Is there any way to achieve this with clang-format?

Related

How can I combine Postgresgl's ArrayField ANY option with LIKE

I'm trying to filter a queryset on the first characters of an element in an ArrayField in postgresql.
Data
--------------------
| id | registration_date | sbi_codes |
| 1 | 2007-11-13 | {9002, 1002, 85621} |
| 2 | 2010-10-11 | {1002, 9022, 9033 |
| 3 | 2019-02-02 | {9001, 8921} |
| 4 | 2012-02-02 | {120} |
I've tried the following (which obviously don't work), but I think clearly indicates what I'm trying to achieve.
select count(*)
from administrations_administration
where '90' = left(any(sbi_codes),2)
or
select count(*)
from administrations_administration
where '90%' like any(sbi_codes
So the sbi_codes can be for example 9002 or 9045, And I'm trying to filter all the records that contain an element that starts with 90.
expected result
____
| count | sbi_codes |
| 3 | 90 |
Thanks!
The thing on the left hand side of LIKE is the string, in which % is just a %. The thing on the right hand side is the pattern, in which % is a wildcard. Using ANY does't change these semantics, the pattern still goes the right.
To solve this, you could create your own operator which is like LIKE, but has its arguments reversed.

Not able to provide deicmal fields less than that is defined in fraction-digits

I am working with yang (RFC 6020). I have a leaf node 'Frequency' in yang. Frequency field is of type decimal64 and fraction-digits are defined as 6 and range from -90.000000 to 90.000000.
While trying to validate and save, following happens:
Number with 6 decimals gets saved eg. 34.000001
Number with no decimals gets saved eg. 34
But when I try to save number with decimal value less then 6 digits,
it doesn't get saved. It gives following error:
eg.
34.1:
"wrong fraction-digits 1 for type decimal64"
34.001 :
"wrong fraction-digits 3 for type decimal64"
34.00001 :
"wrong fraction-digits 5 for type decimal64"
Tried to search on net. Not much document is available on this.
Tried playing around with range parameter but it does not work.
leaf Frequency {
description "Frequency";
type decimal64 {
fraction-digits 6;
range "-90.000000..90.000000";
}
default 0;
}
I expect to be able to save values with/without decimal values where no of decimal values can vary from 0 to 6 digits. eg. 34, 34.1, 34.0004, 34.000001 etc
The value space for a decimal64 YANG type value with fraction-digits set to 6 are real numbers in the following range: -9223372036854.775808..9223372036854.775807. 34, 34.1, 34.001, 34.004, 34.00001 are all within this range and therefore valid values.
This is what the RFC says about decimal64 built-in type (RFC6020, Section 9.3, p1):
The decimal64 type represents a subset of the real numbers, which can
be represented by decimal numerals. The value space of decimal64 is
the set of numbers that can be obtained by multiplying a 64-bit
signed integer by a negative power of ten, i.e., expressible as
"i x 10^-n" where i is an integer64 and n is an integer between 1 and
18, inclusively.
So basically, d x 10^f, where d is a decimal64 value and f is fraction-digits, must result in a valid int64 value, which ranges from -9223372036854775808 to 9223372036854775807, inclusively.
Here is how fraction-digits is defined (RFC6020, Section 9.3.4, p1):
The "fraction-digits" statement, which is a substatement to the
"type" statement, MUST be present if the type is "decimal64". It
takes as an argument an integer between 1 and 18, inclusively. It
controls the size of the minimum difference between values of a
decimal64 type, by restricting the value space to numbers that are
expressible as "i x 10^-n" where n is the fraction-digits argument.
The following table lists the minimum and maximum value for each
fraction-digit value:
+----------------+-----------------------+----------------------+
| fraction-digit | min | max |
+----------------+-----------------------+----------------------+
| 1 | -922337203685477580.8 | 922337203685477580.7 |
| 2 | -92233720368547758.08 | 92233720368547758.07 |
| 3 | -9223372036854775.808 | 9223372036854775.807 |
| 4 | -922337203685477.5808 | 922337203685477.5807 |
| 5 | -92233720368547.75808 | 92233720368547.75807 |
| 6 | -9223372036854.775808 | 9223372036854.775807 |
| 7 | -922337203685.4775808 | 922337203685.4775807 |
| 8 | -92233720368.54775808 | 92233720368.54775807 |
| 9 | -9223372036.854775808 | 9223372036.854775807 |
| 10 | -922337203.6854775808 | 922337203.6854775807 |
| 11 | -92233720.36854775808 | 92233720.36854775807 |
| 12 | -9223372.036854775808 | 9223372.036854775807 |
| 13 | -922337.2036854775808 | 922337.2036854775807 |
| 14 | -92233.72036854775808 | 92233.72036854775807 |
| 15 | -9223.372036854775808 | 9223.372036854775807 |
| 16 | -922.3372036854775808 | 922.3372036854775807 |
| 17 | -92.23372036854775808 | 92.23372036854775807 |
| 18 | -9.223372036854775808 | 9.223372036854775807 |
+----------------+-----------------------+----------------------+
The tool you are using is wrong. The following is valid YANG:
typedef foobar {
type decimal64 {
fraction-digits 6;
range "-90.000000..90.000000";
}
default 34.00001;
}
YANG 1.1 (RFC7950) did not change this aspect of the language (the same applies).

How do I make this calculated measure axis independent and portable?

So I am a beginner at MDX and I have an MDX query that works the way I want it to so long as I put the set on either the columns or rows. If I put the same set on the filter axis it doesn't work. I'd like to make this calculated measure is independent on where this set lives. I'm guaranteed to always have some form of a set included, but I'm not guaranteed which axis the user will place it on (eg row, columns, filter).
Here is the query that works:
WITH MEMBER Measures.avgApplicants as
Avg([applicationDate].[yearMonth].[month].Members, [Measures].[applicants])
SELECT
{[Measures].[applicants],[Measures].[avgApplicants]} ON 0,
{[applicationDate].[yearMonth].[year].[2015]:[applicationDate].[yearMonth].[year].[2016]} ON 1
FROM [applicants]
And results:
| | applicants | avgMonthlyApplicants |
+------+------------+----------------------+
| 2015 | 367 | 33 |
| 2016 | 160 | 33 |
However, if I shift this query around to move the set onto the filter axis I get nothing:
WITH MEMBER Measures.avgApplicants as
Avg([applicationDate].[yearMonth].[month].Members, [Measures].[applicants])
SELECT
{[Measures].[applicants],[Measures].[avgApplicants]} ON 0,
{[Gender].Members} ON 1
FROM [applicants]
WHERE ([applicationDate].[yearMonth].[year].[2015]:[applicationDate].[yearMonth].[year].[2016])
I get this:
| | applicants | avgApplicants |
+-------------+-------------+------------+---------------+
| All Genders | | 478 | |
| | Female | 172 | |
| | Male | 183 | |
| | Not Known | 61 | |
| | Unspecified | 62 | |
So how do a create this calculated measure work so that it isn't dependent on which axis the set is placed on?

Change Y-axis label VB:net

I have a program that renders a chart that calculates the time of a work day.
It shows only 3 days ahead, and shows the numbers in percent.
Some thing like this:
400-|-----------------------------------
|
300-|-----------------------------------
| | 55% |
200-|-----------------------------------
| | 100% | | 98% |
100-|-----------------------------------
| | 100% | | 100% |
0---|-----------------------------------
| STATION 1 STATION 2
This data tells me that station 1 has 100% to do day 1 & 2 and only 55% of work 3 days from now. What i would like to change here, is just the Y-axis labels to "Day" with numbers. Something like this:
Day 4-|-----------------------------------
|
Day 3-|-----------------------------------
| | 55% |
Day 2-|-----------------------------------
| | 100% | | 98% |
Day 1-|-----------------------------------
| | 100% | | 100% |
----0-|-----------------------------------
| STATION 1 STATION 2
How can i do this? I guess something like
For Each YAxis in TheChart
YAxis.Label = "Day " & YAxis.Label / 100
End For
How do i do this more specific, or is there any other way?
Thanx in advance
Well im thinking you are using text. To do this you would first declare a variable called C1:
Dim C1 = [label that contains the number]/100.
repeate this with c2 c3 and c4.
Use the variables in the labels.
I did not really understand your question. So i may be way off as to what you're asking.

Grand Total value doesn't match with Top N Filtered values in SSRS

I have a report in reporting services. In this report, I am displaying the Top N values. But my Grand Total is displaying the sum of all the values.
Right now I am getting something like this.Here N = 2
+-------+------+-------------+
| Area |ID | Count |
+-------+------+-------------+
| - A | | 4 |
| | a1 | 1 |
| | b1 | 1 |
| | c1 | 1 |
| | d1 | 1 |
| | | |
| - B | | 3 |
| | a2 | 1 |
| | b2 | 1 |
| | c2 | 1 |
| | | |
|Grand | | 10 |
|Total | | |
+-------+------+-------------+
The correct Grand Total should be 7 instead of 10. A and B are toggle items(You can expand and contract)
How can I display the correct Grand Total using Top N filter?
I also want to use the filter in the report and not in the SQL query.
You should use the filter on the Dataset. Filtering the report object itself only turns off the items (rows, for example) visibility. The item / row itself will still be part of the group and will be used for calculations.
I found a way to solve my question. As Ido said I worked on the dataset. I am using Analysis Cube. So in this cube I created a Named Set Calculation.
In this set I used the TopCount() function. It filters out the TOP N values where N can be integer according to your choice.
So the final Named Set in this case is :-
TopCount([Dim Area].[Area].[Area], 2, ([Measures].[Count]))
This will give you Grand total of Top N filtered values.