How can I get a simple bixby Action to work with refresh? - refresh

I have this action it its model file HandlQuestionTimeOut.model.bxb :
action (HandleQuestionTimeOut)
{
type(Calculation)
description (Handles Question Time Out.)
collect
{
input (message)
{
type (core.Text)
min (Required) max (One)
}
}
output (core.Text)
}
This in HandleQuestionTimeOut.js
var console = require("console");
module.exports.function = function handleQuestionTimeOut (message)
{
console.log("handleQuestionTimeOut -> message: " + message);
return message;
}
This in the quiz.endpoints.bxb inside the endpoints bracket:
action-endpoint (HandleQuestionTimeOut)
{
accepted-inputs (message)
local-endpoint (HandleQuestionTimeOut.js)
}
I am trying to call that action with refresh like this:
input-view
{
match: Answer(this)
{
to-input: UpdateQuiz(action)
}
refresh
{
if(true)
{
spec
{
delay-seconds (3)
with-request
{
intent
{
goal {HandleQuestionTimeOut}
value: core.Text(Timeout)
}
}
}
}
}
// code continues...
Can you please tell what am I doing wrong? I don't get that HandleQuestionTimeOut log in the console.

Can you clarify you questions?
Though I noticed something, based on my personal opinion:
1) correct module.exports.function -> module.export.function
2) In the refresh section I think you need to specify condition for 'true' or is it there for debugging purpose?

I've just verified that this issue is fixed in 20B SDK release.
Please refer the release notes for details about other changes.

Related

Jenkins DSL Plugin (>=1.77): Use gerrit-trigger in pipelineJob

I don't know how to use the gerrit-trigger plugin in a DSL pipelineJob. According to the dsl plugin doc triggers is deprecated for pipelineJobs. And from the wiki 1.77 replaced by pipelineTriggers. So I have change my triggers section to
properties {
pipelineTriggers {
triggers {
gerrit {
events {
patchsetCreated()
}
project('**My/Git/Repo', '**')
}
}
}
}
However, when I use pipelineTriggers i get the following
ERROR: (configure_seed_jobs.groovy, line 25) No signature of method: events() is applicable for argument types: (configure_seed_jobs$_run_closure1$_closure4$_closure9$_closure10$_closure11$_closure12) values: [configure_seed_jobs$_run_closure1$_closure4$_closure9$_closure10$_closure11$_closure12#3bcd6c54]
Possible solutions: gerritProjects(), buildFailureMessage(), buildNotBuiltMessage(), buildStartMessage(), buildSuccessfulMessage(), buildUnstableMessage(), buildUnsuccessfulFilepath(), changeSubjectParameterMode(), commentTextParameterMode(), commitMessageParameterMode(), customUrl(), dependencyJobsNames(), dynamicTriggerConfiguration(), escapeQuotes(), gerritBuildFailedCodeReviewValue(), gerritBuildFailedVerifiedValue(), gerritBuildNotBuiltCodeReviewValue(), gerritBuildNotBuiltVerifiedValue(), gerritBuildStartedCodeReviewValue(), gerritBuildStartedVerifiedValue(), gerritBuildSuccessfulCodeReviewValue(), gerritBuildSuccessfulVerifiedValue(), gerritBuildUnstableCodeReviewValue(), gerritBuildUnstableVerifiedValue(), gerritSlaveId(), nameAndEmailParameterMode(), notificationLevel(), serverName(), silentMode(), silentStartMode(), skipVote(), triggerConfigURL(), triggerOnEvents()
What am I missing?
I had the same problem, because either events{..} or project() is no more available to gerrit in pipelineTriggers, you should use triggerOnEvents {..} and gettitProjects{...} instead. For more details, you could find them in the document on your jenkins (e.g. http://0.0.0.0:8080/plugin/job-dsl/api-viewer/)
properties {
pipelineTriggers {
triggers {
gerritTrigger {
gerritProjects {
gerritProject {
compareType('PLAIN')
pattern('**My/Git/Repo')
branches {
branch {
compareType('PLAIN')
pattern('master')
}
}
}
}
triggerOnEvents {
changeMerged()
}
}
}
}

Extracting requierement properties from Capella

I would like to extract the requirements data in capella using m2doc, requirements (SystemFunctionalRequirement) are located in a "RequirementsPkg" package in System analysis, thanks to the "m:RequirementsPkg.eContents().summary" command I managed to retrieve the summary of all requirements but I would like to retrieve the name and the summary of a specific requirement.
Can you help me ?
Thanks in advance
This mechanism is deprecated. You should use the requirement extension.
Starting from the root element, you can use something like:
{ m:system.ownedArchitectures->filter(la::LogicalArchitecture).ownedRequirementPkgs.ownedRequirements.name }
With the requirement extension the easiest way is to create a service:
public List<Requirement> getRequirements(ExtensibleElement element) {
List<Requirement> res = new ArrayList<>();
for (ElementExtension extension : element.getOwnedExtensions()) {
if (extension instanceof Requirement) {
res.add((Requirement) extension);
break;
} else if (extension instanceof CapellaOutgoingRelation) {
res.add(((CapellaOutgoingRelation) extension).getTarget());
}
}
return res;
}
and call it, for instance on a diagram:
{ m:for req | '[LAB] IFE System - All Components, CEs'.representationByName().eAllContents(viewpoint::DRepresentationElement).semanticElements->filter(emde::ExtensibleElement).getRequirements() }
{ m:req.ReqIFLongName }
{ m:endfor }

After Effects Expression (if layer is a CompItem)

I am trying to make slight modification at line 5 of below After Effects expression. Line 5 checks if the layer is visible and active but I have tried to add an extra check that the layer should not be a comp item. (In my project, layers are either text or image layer and I beileve an image layer means a comp item). Somehow the 'instanceof' method to ensure that layer should not be a comp item is not working. Please advise how to fix this error, thanks.
txt = "";
for (i = 1; i <= thisComp.numLayers; i++){
if (i == index) continue;
L = thisComp.layer(i);
if ((L.hasVideo && L.active) && !(thisComp.layer(i) instanceof CompItem)){
txt = i + " / " + thisComp.numLayers + " / " + L.text.sourceText.split(" ").length;
break;
}
}
txt
While compItem is available only in ExtendScript, you can actually check the properties available in the {my_layer}.source object.
Here's a working example (AE CC2018, CC2019 & CC2020): layer_is_comp.aep
The expression would be something similar to:
function isComp (layer)
{
try
{
/*
- used for when the layer doesn't have a ['source'] key or layer.source doesn't have a ['numLayers'] key
- ['numLayers'] is an object key available only for comp objects so it's ok to check against it
- if ['numLayers'] is not found the expression will throw an error hence the try-catch
*/
if (layer.source.numLayers) return true;
else return false;
}
catch (e)
{
return false;
}
}
try
{
// prevent an error when no layer is selected
isComp(effect("Layer Control")(1)) ? 'yes' : 'no';
}
catch (e)
{
'please select a layer';
}
For your second question, you can check if a layer is a TextLayer by verifying that it has the text.sourceText property.
Example:
function isTextLayer (layer)
{
try
{
/*
- prevent an expression error if the ['text'] object property is not found
*/
var dummyVar = layer.text.sourceText;
return true;
}
catch (e)
{
return false;
}
}
You're mixing up expressions and Extendscript. The compItem class is an Extendscript class and I'm pretty sure that it isn't available for expressions.
I'd suggest reading the docs: https://helpx.adobe.com/after-effects/user-guide.html?topic=/after-effects/morehelp/automation.ug.js

Google Sheets Script - If or statement. Restrict onEdit to specific sheet

Super quick question. I have this function I want to run on entire workbook, except two specific sheets.
This is my code:
function onEdit(e) {
var sheet = SpreadsheetApp.getActiveSheet();
if (sheet.getName() != "Total" || sheet.getName() != "DataRange" ) {
someAction();
}
}
This just does not work, the code runs on all sheets no matter what. This is probably a noob question but.
not an "answer" as you already answered your own question, but an alternative:
I'll prefer to use an indexOf I found that (in this case) clearer thant the switch:
function onEdit(e) {
var sheet = SpreadsheetApp.getActiveSheet();
if (["Total","DataRange"].indexOf(sheet.getName()) == -1 ) {
someAction();
}
}
I just identify in an array all the sheet that I want to avoid and then check that the current sheet is not one of then (return -1)
I solved it by using switch instead
switch (sheet.getName()) {
case "Total":
return;
case "DataRange":
return;
default:
doSomething();
break;
}
Answer by Kenny Bones moved from question to answer space.

Tag-it shows no delete-symbol

I don't know why I don't get the "X" symbol ...
It should be like this:
How can I find the problem? Maybe an CSS-file is blocking an other CSS-file?
JavaScript-Code
$(function() {
var sampleTags = ['Klavier', 'Blockflöte', 'Schlagzeug', 'Gesang', 'Saxophon', 'Klarinette', 'Keyboard', 'Panflöte', 'Mundharmonika', 'Beatboxing', 'Akkordeon', 'Cello', 'Bratsche', 'Tuba', 'Kontrabass', 'E-Gitarre', 'E-Bass', 'Akustikgitarre'];
$('#singleFieldTags').tagit({
availableTags: sampleTags,
singleField: true,
singleFieldNode: $('#mySingleField'),
beforeTagAdded: function(evt, ui) {
var counter = jQuery.inArray(ui.tagLabel, sampleTags);
if(counter != -1) {
return true;
} else {
$('.tagit-new input').val('');
return false;
}
},
});
});
Susanne, encountered the same issue. After a significant amount of time wasted, I determined that the 'x' icon is present, it's just not rendering on the browser level.
var removeTag = $('<a><span class="text-icon">\xd7</span></a>') // \xd7 is an X
This is line 485 of tag-it.js; when you check the rendering of your page, you'll see this is actually present. I changed it to the following in order to confirm that it was present and just needed to be rendered differently.
var removeTag = $('<a><span>x</span></a>') // \xd7 is an X
It can be styled however, from this point. Hope this helps anyone encountering this issue.