Syntax for timestamp after a designated time - powerbi

This measure isn't calculating as expected.
SumAfter1300 =
CALCULATE (
COUNTROWS ( 'Fulfillment' ),
'Fulfillment'[DateCreated] > TIME ( 13, 0, 0 ),
'Fulfillment'[Status]
IN { "Awaiting Response", "In Progress", "Routed", "Unresolved" }
)

SumAfter1300 = CALCULATE(COUNTROWS('Fulfillment'),
'Fulfillment'[DateCreated]> today()+ TIME(13,0,0),
'Fulfillment'[Status] IN {"Awaiting Response","In Progress","Routed","Unresolved"})

Related

ImGui slowing down when using cpr

So I am trying to make a changelogs sort of thing
auto request = cpr::Post (
cpr::Url{ "http://leoservices.xyz/pchangelogs.php" }
);
auto response = request.text.c_str ( );
sprintf_s ( G->changelogsBuffer , "Changelogs: %s" , response );
ImGui::InputTextMultiline ( "##Change Logs" , G->changelogsBuffer , sizeof ( G->changelogsBuffer ) , ImVec2 ( ImGui::GetContentRegionAvail ( ).x - 10 , ImGui::GetContentRegionAvail ( ).y - 58 ) , ImGuiInputTextFlags_ReadOnly | ImGuiInputTextFlags_NoMarkEdited );
This is the current code but when I got to this tab it just starts laggin' is their something I am doing wrong?

Need to save product twice to have auto tag updated correctly

Thanks to 7uc1f3r, I was able to programatically assign tags to products based on their stock status. Link here
However, I have run into an issue. There is no error. At times, I have to save the product twice for the correct tag to reflect. I have tried the code using else & elseif but the issue persists. If someone could guide me to use switch case, I can try that & see if the tags get assigned correctly on the first save. Alternatively, if there is information on why this would occur & possible remedies, please let me know. Looks like the product is in the process of saving in the backend & the tag gets assigned prior to that but I don't know for sure. Please advise.
add_action( 'woocommerce_admin_process_product_object', 'mycode_woocommerce_stockstatus_tag', 10, 1 );
function mycode_woocommerce_stockstatus_tag( $product ) {
if( !$product->is_in_stock() ) {
$product->set_tag_ids( array (113) );
}
elseif( $product->is_on_backorder(1) ) {
$product->set_tag_ids( array (111) );
}
elseif( $product->is_in_stock() && !$product->is_on_backorder(1) ) {
$product->set_tag_ids( array (112) );
}
}
I am also posting a variant of the code where I split out where stock is being managed or not. The if statements here are independent & appear to do a better job. However, I still request if someone could pitch in & help with switch case as I believe it will execute faster.
add_action( 'woocommerce_admin_process_product_object', 'mycode_woocommerce_stockstatus_tag', 10, 1 );
function mycode_woocommerce_stockstatus_tag( $product ) {
if( $product->managing_stock() && ( $product->get_stock_quantity() > 0 ) ) {
$product->set_tag_ids( array (112) );
}
if( $product->managing_stock() && ( $product->get_stock_quantity() <= 0 ) && ( $product->backorders_allowed() || $product->backorders_require_notification() ) ) {
$product->set_tag_ids( array (111) );
}
if( $product->managing_stock() && ( $product->get_stock_quantity() <= 0 ) && !$product->backorders_allowed() && !$product->backorders_require_notification() ) {
$product->set_tag_ids( array (113) );
}
if( !$product->managing_stock() && $product->is_in_stock() && !$product->is_on_backorder(1) ) {
$product->set_tag_ids( array (112) );
}
if( !$product->managing_stock() && $product->is_on_backorder(1) ) {
$product->set_tag_ids( array (111) );
}
if( !$product->managing_stock() && !$product->is_in_stock() ) {
$product->set_tag_ids( array (113) );
}
}

Split parts of function calling

I am going to give the least extreme example I have: (Names/Identifiers are irrelevant)
session.TransmitUnsafe(
Details::Solve,
samplesCount,
pinnedInputData.GetDevicePointer( ),
Offset( pinnedOutputApproximationData.GetDevicePointer( ), outputIndex ),
Offset( SolutionData.get( ), SolutionIndices.at( outputIndex * SolutionSize ) ),
InputLength,
OutputLength,
samplesCount
);
I need to split it to something like this:
auto kernelCallingHeader = {
Details::Solve,
samplesCount
};
auto kernelArgumentsPointers = {
pinnedInputData.GetDevicePointer( ),
Offset( pinnedOutputApproximationData.GetDevicePointer( ), outputIndex ),
Offset( SolutionData.get( ), SolutionIndices.at( outputIndex * SolutionSize ) )
};
auto kernelArgumentsLengths = {
InputLength,
OutputLength,
samplesCount
};
session.TransmitUnsafe(
kernelCallingHeader...,
kernelArguments...,
kernelArgumentsLengths...
);
I can't change session.TransmitUnsafe's parameters at all, but I want to somehow structize the calling to that function. (Entirely for readability purposes)
NOTE: I used ... like expandation of variadic template function's arguments, because I am sure there's a fine way with it.
It won't harm even to have a few macros.

dynamo DB: QuerySpec vs QueryRequest

What differences exist between QueryRequest and QuerySpec?
QuerySpec spec = new QuerySpec()
.withKeyConditionExpression("#n_channel = :v_channel")
.withFilterExpression("#n_type = :v_type")
.withNameMap( new NameMap()
.with( "#n_type", DATABASE_CONTENT_TYPE_NAME )
.with( "#n_channel", PRIMARY_KEY_NAME ))
.withValueMap(new ValueMap()
.withString(":v_type", type)
.withString(":v_channel",channelId))
.withConsistentRead(true);
With QuerySpec - works
keyConditions.put( PRIMARY_KEY_NAME, new Condition().withComparisonOperator( ComparisonOperator.EQ ).withAttributeValueList( new AttributeValue().withS( channelId ) ) );
keyConditions.put( RANGE_KEY_NAME, new Condition().withComparisonOperator( ComparisonOperator.NOT_NULL ) );//default value
typeFilterExpression = "#n_type = :v_type";
nameMap.with( "#n_type", DATABASE_CONTENT_TYPE_NAME );
values.put( ":v_type", new AttributeValue().withS( type ) );
//
QueryRequest request = new QueryRequest().withTableName( tableName )
.withKeyConditions( keyConditions ).withLimit( QUERY_LIMIT )
.withReturnConsumedCapacity( ReturnConsumedCapacity.TOTAL ).withConsistentRead( false );
if( StringUtils.isNotBlank( typeFilterExpression ) ) {
request.withFilterExpression( typeFilterExpression );
}
if( !MapUtils.isEmpty( nameMap ) ) {
request.withExpressionAttributeNames( nameMap );
}
if( !MapUtils.isEmpty( values ) ) {
request.withExpressionAttributeValues( values );
}
With the same QueryRequest - not works.
com.amazonaws.AmazonServiceException: Attempted conditional constraint is not an indexable operation
Amazon version:
compile 'com.amazonaws:aws-java-sdk:1.10.65'
Thanks!
For QueryRequest need use filters map:
filters.put( TYPE, new Condition() //
.withComparisonOperator( ComparisonOperator.EQ ) //
.withAttributeValueList( //
new AttributeValue() //
.withS( type.name() ) //
) //
);
request.withQueryFilter( filters );
All works!

QAbstractItemModel + ModelTest::rowsInserted ASSERTion problem

I'm trying to debug my model (QAbstractItemModel) with ModelTest. And I can't understand one assertion.
There are two slots in ModelTest that intercept signals generated by my model.
ModelTest::rowsAboutToBeInserted
ModelTest::rowsInserted
Slot/function 1 looks like this
void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int end )
{
Changing c;
// ...
c.last = model->data ( model->index ( start - 1, 0, parent ) );
c.next = model->data ( model->index ( start, 0, parent ) );
insert.push ( c );
}
And slot 2 looks like this
void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
{
Changing c = insert.pop();
// other asserts ...
(*) Q_ASSERT ( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) );
}
I don't understand dla last assertion (*). Lets assume that in my app I add 1 row.
This row is the only row that is stored in my model. So the row number would be 0.
In my model before adding the row I call
beginInsertRows(parentIndex, 0, 0);
So why does modeltest require
model->data ( model->index ( start, 0, parent ) )
to be equal to
model->data ( model->index ( end + 1, 0, c.parent ) )
What am I missing here ? Please help :)
The idea behind this assert is to check if first row after added ones was correctly moved. If there are some rows after inserted ones, then their data are compared. If there aren't any, your model should both in the line
c.next = model->data ( model->index ( start, 0, parent ) );
and in
Q_ASSERT ( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) );
should return invalid (empty) QVariant. If both return empty QVariant (as they should) assertion succedes, thus providing some level of error-checking even in case of no rows after currently inserted.