Total Time reports with XtraScheduler control - devexpress

Is any easy way to make "total time" reports with XtraScheduler control.
I need couple reports that will calculate total time by day/week/month for each resorce and appointment type.
Is posible to do this with XtraSchedulerReport or I must calculate this manualy?

There aren't any built in functions to calculate the total time by resource and appointment type, but it's definitely possible to do this using XtraScheduler. Check out the two following examples for better details on how:
http://www.devexpress.com/Support/Center/e/E977.aspx
http://www.devexpress.com/Support/Center/e/E121.aspx
:)
Also, try something like this:
internal static TimeIntervalCollectionEx CalculateBusyTime(AppointmentBaseCollection appointments, TimeInterval interval) {
TimeIntervalCollectionEx busyIntervals = new TimeIntervalCollectionEx();
int count = appointments.Count;
for (int i = 0; i < count; i++)
busyIntervals.Add(TimeInterval.Intersect(interval, appointments[i].CreateInterval()));
return busyIntervals;
}

Related

Alternative to moveWithCollision

I've been making a (potentially massive) multiplayer video game in javascript, nodejs and babylonjs...
It's been a few months that a code is causing me problems in front:
it's currently a simple first person shooter with waves of monsters in player versus player.
The code I'm having trouble with is gravity.
players and monsters can therefore fall or climb, and those from more or less high, of course, the ground is not smooth.
for the moment I calculate the gravity in front only (the server does not receive "y"): I would like not to change that.
The monsters, which can be numerous, are also impacted by gravity only in front.
I searched, went through the babylonjs api and I can't find a viable alternative to "moveWithCollisions"
if (gamers[id][0] == false) {
var before = scene.getMeshByName(gamers[id][1]).gravity.y;
var after = scene.getMeshByName(gamers[id][1]).gravity.y;
for (var a = 0; a < Math.abs(4); a++) {
if (Math.round(after) == Math.round(before)) {
before = scene.getMeshByName(gamers[id][1]).position.y+scene.getMeshByName(gamers[id][1]).gravity.y;
scene.getMeshByName(gamers[id][1]).moveWithCollisions(scene.getMeshByName(gamers[id][1]).gravity);
after = scene.getMeshByName(gamers[id][1]).position.y;
} else {
a = 5;
gamers[id][0] = true;
}
}
when the character receives a move gamers[id][0] becomes false again
I really need a lighter command:
With 100 players and 1000 monsters you will understand that there is no chance that this code will work?
Hence my question, not having the strength to create this command myself, is there a real alternative to the "moveWithCollision" command?
I take you to consider my question, I have been looking for several weeks without finding anything better...
thanks in advance

Java8 Date and Time with Instant API

I get dynamic date from my request,
Instant duration = request.getStartDate(); // my input is 2020-03-01T00:00:01Z
for (int i = 0; i < 12; i++) {
duration = duration.with(TemporalAdjusters.firstDayOfNextMonth ());
}
Basically i wanted to get first day of every month for 12 months, i tried with above code but getting exception,
java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: DayOfMonth
My output could be,
2020-04-01T00:00:01Z
2020-05-01T00:00:01Z
2020-06-01T00:00:01Z
:
:
2021-03-01T00:00:01Z
anything am missing here? tried with using plus()
duration.plus(30, ChronoUnit.DAYS);
I tried to convert instant to locateDate, then it prints fine, but for my required format i need to convert to Instant from localdate. I'm not seeing 1st day of next month.
2019-03-31T22:00:00Z
2019-04-30T22:00:00Z
2019-05-31T22:00:00Z
2019-06-30T22:00:00Z
2019-07-31T22:00:00Z
2019-08-31T22:00:00Z
2019-09-30T22:00:00Z
2019-10-31T23:00:00Z
2019-11-30T23:00:00Z
2019-12-31T23:00:00Z
any suggestion are appreciated. Thanks!
Much less fiddly than my namesake's answer: provided you convert to an OffsetDateTime up-front, there is no problem using the nice human-readable adjuster that you were trying to use initially.
OffsetDateTime duration = Instant.now().atOffset(ZoneOffset.UTC);
for (int i = 0; i < 12; i++) {
duration = duration.with(TemporalAdjusters.firstDayOfNextMonth());
}
The issue is that an Instant is an unambiguous point in time, irrespective of any specific timezone or geographic location. There is no specific date associated with an instant; what is Monday the 1st in one location may be Sunday the 31st in another, but it's still the same instant. That is why when trying to set a first day of the month, you get an exception.
If you convert to an OffsetDateTime, you are applying an offset (in this case UTC, so an offset of zero). This converts your data to a format in which a date is unambiguous.
Instant startInstant = request.getStartDate();
LocalDate start = startInstant.atZone(ZoneOffset.UTC).toLocalDate().withDayOfMonth(1);
for (int i = 0; i < 12; i++) {
System.out.println(start.plusMonths(i).atStartOfDay().toInstant(ZoneOffset.UTC));
}

Only incremental values - PowerBI Calculate between dates

this might look simple.. but dk how to do it
this is the information:
So.. i got the Cumulative Total using this function:
CumulativeTotal = CALCULATE(
SUM(vnxcritical[Used Space GB]),
FILTER(ALL(Datesonly[Date]),
Datesonly[Date] <= MAX(Datesonly[Date])))
But what i need is to get the differences between the dates, in the first date and the second the difference will be of 210. I need to get another column with that information. know the formula to do that?
ok..
So.. i used this:
IncrmentalValueTEST =
VAR CurrDate = MAX(vnxcritical[Date])
VAR PrevDate = CALCULATE(LASTDATE(vnxcritical[Date]), vnxcritical[Date] < CurrDate)
RETURN SUM(vnxcritical[Used Space GB]) -
CALCULATE(SUM(vnxcritical[Used Space GB]), vnxcritical[Date] = PrevDate)
and this is the result:
Ok, so this is is my data table:
You can see all the dates that i have for now, this is a capacity report for diferents EMC Storage Arrays, for diferentes Pools. The idea would be to have the knolwdge to review the incremental space used in a determinated portion of time.
allready tried another idea to get this, but the result was the same.. i used this:
Diferencia =
Var Day = MAX(Datesonly[Month])
Var Month = MAX(Datesonly[Year])
RETURN
SUM('Used Space'[used_mb])
- CALCULATE(
SUM('Used Space'[used_mb])
,FILTER(ALL(Datesonly[Date]),Datesonly[Date] <= Max(Datesonly[Date])))
But the return is the same.. "47753152401"
i'm using graphical filters, and other things to get a minimal view, because there are only 5 weekly reports and the sql database got more than 150.000 rows.
and this is the relation that i made with a only a table full of "dates" in order to invoke the function in a better way, but the result is the same..
Try something along these lines:
IncrmentalValue =
VAR CurrDate = MAX(Datesonly[Date])
VAR PrevDate = CALCULATE(LASTDATE(Datesonly[Date]), Datesonly[Date] < CurrDate)
RETURN SUM(vnxcritical[Used Space GB]) -
CALCULATE(SUM(vnxcritical[Used Space GB]), Datesonly[Date] = PrevDate)
First, calculate the current date and then find the previous date by taking the last date that occurred before it. Then take the difference between the current value and the previous value.

AX 2009: Adjusting User Group Length

We're looking into refining our User Groups in Dynamics AX 2009 into more precise and fine-tuned groupings due to the wide range of variability between specific people within the same department. With this plan, it wouldn't be uncommon for majority of our users to fall user 5+ user groups.
Part of this would involve us expanding the default length of the User Group ID from 10 to 40 (as per Best Practice for naming conventions) since 10 characters don't give us enough room to adequately name each group as we would like (again, based on Best Practice Naming Conventions).
We have found that the main information seems to be obtained from the UserGroupInfo table, but that table isn't present under the Data Dictionary (it's under the System Documentation, so unavailable to be changed that way by my understanding). We've also found the UserGroupName EDT, but that is already set at 40 characters. The form itself doesn't seem to restricting the length of the field either. We've discussed changing the field on the SQL directly, but again my understanding is that if we do a full synchronization it would overwrite this change.
Where can we go to change this particular setting, or is it possible to change?
The size of the user group id is defined as as system extended data type (here \System Documentation\Types\userGroupId) and you cannot change any of the properties including the size 10 length.
You should live with that, don't try to fake the system using direct SQL changes. Even if you did that, AX would still believe that length is 10.
You could change the SysUserInfo form to show the group name only. The groupId might as well be assigned by a number sequence in your context.
I wrote a job to change the string size via X++ and it works for EDTs, but it can't seem to find the "userGroupId". From the general feel of AX I get, I'd be willing to guess that they just have it in a different location, but maybe not. I wonder if this could be tweaked to work:
static void Job9(Args _args)
{
#AOT
TreeNode treeNode;
Struct propertiesExt;
Map mapNewPropertyValues;
void setTreeNodePropertyExt(
Struct _propertiesExt,
Map _newProperties
)
{
Counter propertiesCount;
Array propertyInfoArray;
Struct propertyInfo;
str propertyValue;
int i;
;
_newProperties.insert('IsDefault', '0');
propertiesCount = _propertiesExt.value('Entries');
propertyInfoArray = _propertiesExt.value('PropertyInfo');
for (i = 1; i <= propertiesCount; i++)
{
propertyInfo = propertyInfoArray.value(i);
if (_newProperties.exists(propertyInfo.value('Name')))
{
propertyValue = _newProperties.lookup(propertyInfo.value('Name'));
propertyInfo.value('Value', propertyValue);
}
}
}
;
treeNode = TreeNode::findNode(#ExtendedDataTypesPath);
// This doesn't seem to be able to find the system type
//treeNode = treeNode.AOTfindChild('userGroupId');
treeNode = treeNode.AOTfindChild('AccountCategory');
propertiesExt = treeNode.AOTgetPropertiesExt();
mapNewPropertyValues = new Map(Types::String, Types::String);
mapNewPropertyValues.insert('StringSize', '30');
setTreeNodePropertyExt(propertiesExt, mapNewPropertyValues);
treeNode.AOTsetPropertiesExt(propertiesExt);
treeNode.AOTsave();
info("Done");
}

Is there a way to time how long a function takes?

I have some function I want to time, but I have no idea how to do it. In javascript I can just get the current time in milliseconds, run the rest of my function, get the current time in milliseconds again and alert the difference. Viola, I know how long the function ran.
In ActionScript, it runs everything at once, so my start and end times are the same. How can I measure the span of time a function is taking to process?
Thanks,
Quick way below. It's better to do a statistical test, eg. run the toMeasure a 100 times between setting time1 and time2 and dividing the result by 100. It might give you a more realistic estimate. Remember that modern computers can do a bit of calculations in under a millisecond.
private var time1:Number;
private var time2:Number;
private function toMeasure():void
{
for (var i:int = 0;i<30000;i++)
{
trace (i);
}
}
protected function main():void
{
time1= new Date().time;
toMeasure();
time2= new Date().time;
trace ("ms:"+(time2-time1));
}

Resources