why cloudlet.getSubmissionTime() & cloudlet.getExecStartTime() in cloudsim returns same value? - cloudsim

i wanted to compute the response time for all cloudlets submitted. for that i am using the following statement:
responsetime = cloudlet.getExecStartTime() - cloudlet.getSubmissionTime();
The problem i am facing is that the two methods cloudlet.getSubmissionTime() & cloudlet.getExecStartTime() returns same value. Please suggest solution for the same

responsetime = cloudlet.getFinishTime()- cloudlet.getExecStartTime()

Related

issues with Formatdate function in ampscript

I have an issue where I want to display only the hh.mm in da-DK from the NOW() function in AMPscript.
I have tried the following two options.
formatdate(Now(),"","HH.mm","da-DK")
This inputs only time but servertime, ex. 03.16
format(Systemdatetolocaldate(Now()),"","hh.mm")
Correct time but the whole string, ex. 12/10/2020 10:16:44 AM
Anyone with some pointers?
I've found a "quickfix" with the set of
SET #redeemedHour = datePart(Systemdatetolocaldate(Now()),"H")
SET #redeemedMinute = datePart(Systemdatetolocaldate(Now()),"minute")
and then concanate

How to use a SQL output parameter with FromSqlInterpolated? Or alternative

Using ASP.Net core 3.0. my Database query works - I can get the result set (records), but how to pass/get the output parameter? Also would like to know if there's a way to get the return value.
I tried using different ways to call the SQL query and the only one I was able to get working was FromSqlInterpolated, but open to different methods.
This code works for me, but I want to pass an additional parameter that can get populated as an output parameter (which is working when I test it by calling the stored proc from within SQL Server).
var result = _context.Users
.FromSqlInterpolated($"EXEC mystoredproc {user.Username} ").AsEnumerable().FirstOrDefault();
I tried creating a variable before the call
string out1 = null;
And then including that in the call but I can't figure out the syntax and I'm not sure if it's supported with this method.
var result = _context.Users
.FromSqlInterpolated($"EXEC mystoredproc {user.Username}, OUTPUT {out1}").AsEnumerable().FirstOrDefault();
Console.WriteLine(out1);
Hoping someone can point me in the right direction - would like to know both how to use the output parameter and how to get the return value, not just the record set. Thank you.
The answer accepted does not seem to work for me.
However I finally manage to have the OUTPUT parameter work by using the following code
var p0 = new SqlParameter("#userName", {user.Username});
var p1 = new SqlParameter("#out1", System.Data.SqlDbType.NVarChar, 20) { Direction = System.Data.ParameterDirection.Output };
string out1 = null;
var result = _context.Users
.FromSqlRaw($"EXEC mystoredproc #userName, #out1 OUTPUT ", p0, p1).AsEnumerable().FirstOrDefault();
Console.WriteLine(p1.Value); // Contains the new value of the p1 parameter
Just a litte warning, the p1 value property will be changed only when the request will be executed (by an AsEnumerable, Load() or anything that forces the Sql execution)

bug with IEntity.toString()?

There seem to be a bug with calling .toString() on an entity created by createQueryEntity. If you use it in a query. It will have some garbage string "tring" in it.
IEntity queryEntity = (IEntity) GenerateQuery.createQueryEntity(Vendor.class);
queryEntity.toString();
Calendar start = Calendar.getInstance();
start.add(Calendar.YEAR, -1);
Vendor vendor = (Vendor) queryEntity ;
return select($(vendor))
.where($(vendor.getMetaData().getLastUpdatedTime()).gte(start))
.where($(vendor.isActive()).eq(false))
.skip(1).take(1000)
.generate();
This would result to something like "select tring.tring.* from ..." Has anyone else seen this?
Finally figured it out. Apparently you can't call any methods on the queryEntity returned by createQueryEntity BEFORE calling select(). That means toString() or ((Vendor) queryEntity).isActive() shouldn't be called before select ($(vendor)).
The solution is to store the results of select($(vendor)) first before calling these methods.
Be careful when debugging because adding a watch expression will call toString() too.

setting object properties value for object array in matlab

I have created an array of objects and I would like assign a property value in a vector operation without using a for loop. Unfortunately I get an error.
A simplified example of the problem.
classdef clsMyClass < handle
properties
dblMyProperty1
end
methods
function obj = clsMyClass()
end
end
end
And when running
vecMyArray = clsMyClass.empty(100,0);
vecMyArray(100) = clsMyClass;
vecMyArray.dblMyProperty1 = 1:100;
We get the following error:
??? Incorrect number of right hand side elements in dot name
assignment. Missing [] around left hand side is a likely cause.
Any help would be appreciated.
I see what you're trying to do now. Use disperse from the MATLAB File Exchange:
>> [vecMyArray.dblMyProperty1] = disperse(1:100);
>> vecMyArray(1).dblMyProperty1
ans =
1
>> vecMyArray(10).dblMyProperty1
ans =
10
You can use the deal function for exactly this purpose:
[vecMyArray.dblMyProperty1] = deal(1:100);
See: http://www.mathworks.com/company/newsletters/articles/whats-the-big-deal.html
Edit: No you can't, actually; that'll set them to all be the vector 1:100.
I think you'll find your answer here in "Struct array errors." Even though this is a class, similar rules apply.
Unfortunately missing [] is not the cause, since adding them causes more errors. The cause is that you cannot assign the same value to all fields of the same name at once, you must do it one at a time, as in the following code:
So you'll need:
for ii=1:100
vecMyArray(ii).dblMyProperty1 = ii;
end
I know it's not satisfying, but I think it at least helps us to definitively understand this error.

Google App Engine GREATER_THAN and LESS_THAN comparison operator not working

I am trying to pull data from an Entity called latLongInfo and trying to get all the results with the lattitude results within a certain range. Below code should work but it's not:
Filter lowerLatF = new FilterPredicate("lat", FilterOperator.GREATER_THAN, botLat);
Filter topLatF = new FilterPredicate("lat", FilterOperator.LESS_THAN, topLat);
Filter twoFilter = CompositeFilterOperator.and(lowerLatF, topLatF);
Query rip = new Query("latLongInfo").setFilter(twoFilter);
PreparedQuery ripQ = datastore.prepare(rip);
List<Entity> llResult = ripQ.asList(FetchOptions.Builder.withLimit(15));
int sizeOfList=llResult.size();
The value of botLat is 40.94495459565217 and the value of topLat is 41.3797372043.
In the Datastore that I am pulling the data from there's a result with lat = 41.1623459 however, the code above doesn't find it and keeps giving me a sizeOfList = 0.
I should be getting at least one result but it's not returning it. Is there something simple I am missing?
I figured this out. I was saving the lat as String rather than a numerical float or double. Once i changed it to save doubles (these were actually converted to floats in the datastore) I was able to do the comparison without issue.
Decided to answer my own question...in case this helps anyone else.

Resources