SSRS Row Sorting [closed] - sorting

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a matrix report like this
route Friday Sunday Wednesday Tuesday Saturday Thursday Monday
van1 jlsjdf sdf dfsdf sfsd sdfs sf sdfs
sdfs
sdf
Days above are non grouped, now i want these days to come like this in sequence
route Monday Tuesday Wednesday Thursday Friday Saturday Sunday
What should i do Plz help
Thank you in Advance

When you say they are non-grouped, if each day is not a group and is an individual column then you can just re-arrange the columns on the tablix to suit.
However I suspect that your days is a column group, then if so on the column Group Properties click the Sorting tab and enter in the following expression:
Switch(Fields!Day.Value="Monday",Fields!Day.Value="Tuesday",2,Fields!Day.Value="Wednesday",3,Fields!Day.Value="Thursday",4,Fields!Day.Value="Friday",5,Fields!Day.Value="Saturday",1,Fields!Day.Value="Sunday",1,)
This converts each day into a number and it is then sorted based on this number.
This is useful when you want custom sort orders, you just need to convert the values into a sequence order using a switch statement then you can sort in numerical order.

Related

How to calculate a 4-week period of the billing year [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I'm refactoring a method that should return 4-week periods. A period is calculated as the number of 4-weekly blocks in the current billing year. There are thirteen periods per billing year. First billing year began on 24/08/2008.
I have created a formula:
def period
period = (((self.utc.to_time - Time.new(2008,8,23,0,0,0,0)) / 60 / 60 / 24 / 7 / 52).modulo(1) * 13).ceil
period == 0 ? 13 : period
end
Over the years, it has become inaccurate, and we're now seeing a shift of a whole period: bookings in Period 1 are showing as Period 2. I tried re-calculating the formula with no success. I feel the formula is too complex anyway, and can probably be achieved more simply.
I would just use Date instead of Time and the calculation would be much easier.
DAYS_PER_PERIOD = 28
def period
days = Date.today - Date.new(2008, 8, 23)
periods = days / DAYS_PER_PERIOD
periods.to_i # would return a `Rational` instead of an `Integer` otherwise
end

Facing the time bomb in computers? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
It is about the representation of time by using an int to store the number of seconds since January 1, 1970.
When will programs that use this representation face a time bomb? How should you proceed when that happens?
We are 2015 today. The number of seconds approximately since 1/1/1970 is
(2015 - 1970) * 365,25 * 24 * 60 * 60 = 1.420.092.000
That is the number of seconds in 45 years.
An unsigned int (32 bit) can store the value
4.294.967.295
which leaves us with
2.874.875.295 seconds ~ 90 years to go from now on
We still got some time to go.
In case a signed int is used, refer to this link (Thank you PM for the comment).
The signed int can store
2.147.483.647
which leaves us with
727.391.647 ~ 23 years to go from now on, i.e. 2038.
And thus the name of this problem: the Year 2038 problem
That is it can arise before our retirement.
For whatever you are concerned about, please refer to this link on SO.

Maintain realtime counter [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
The following is an interview question which shows up here and here:
Given a timer time() with nanosecond accuracy and given the interface
interface RealTimeCounter:
void increment()
int getCountInLastSecond()
int getCountInLastMinute()
int getCountInLastHour()
int getCountInLastDay()
The getCountInLastX functions should return the number of times increment was called in the last X
Here's one suggested solution (paraphrased from the above blog entry):
Maintain an ArrayList of timestamps. When asked for a given counter, let's say, the count for the last second, perform a binary search for (timer.time() - ONE_SECOND_IN_NANOSECONDS), and return the list.length() - list_index. Then, as a background process at regular intervals we trim our data. Since we only need to maintain data for the last day, we can delete all entries prior to the last day.
Please critique this solution or offer a better performing one.

Every seconds: measurement: 6 plots, which ones to update? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
The system shall accept one measurement every second. The system shall present 6 real-time plots:
last minute
last hour
last day
last week
last month
last year.
For example, here is a beautiful yearly plot of the measurement presenting the average temperature for every month of the year(suppose the plot consists of 12 datapoints, connected with straight lines). When and how should I update it? The worst case is to re-calcucate the average temperature for each month at every measurement (once per second), then redraw the plot.
The plot of last minute we solve with a circular buffer - the new measurement is simply pushed to the deque eveyr second.
What about the other plots? How do we minimize the re-calculations for each one?
Solution
Keep averages of all vectors. Whe a new event happens, check which vectors to update (time % vector_sample_period). For the chosen vectors, ask the previous vector for it's average and push it in own circular buffer.
You minimize re-calculation by calculating only when needed. For example when you start over on the circular buffers.

Time formatting string in ruby [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Why is "Y" for "Year" capitalized while "m" for month is not? Moreover, "M" for minute is capitalized!
Time.now.strftime "%Y/%m/%d %H:%M:%S"
I always have difficulty to remember that as an english as second language programmer.
Methods of how to memorize the above formatting notation or explanation is much appreciated.
%Y is capitalized because it's long form year (2013). You can use %y and it will produce short form (13).
Also all parts in time section should be capitalized, because their lower-case variants are already taken by something else (in parentheses I provided current values).
`%h` - human short name for month (Jun)
`%H` - hour (14)
`%m` - month (06)
`%M` - minute (09)
`%s` - unixtime (1370599766)
`%S` - second
Simple, no?
If there's no rules, I will memorize it
Just memorize :)

Resources