Drools - Decision table function call from action value cell - drools

I'm trying to call a getter method from action cell of drools decision table but getting an error:-
Syntax error on token ")", delete this token
see the screenshot below of error and the decision table code.

Actually, the issue was in the action declaration i.e. $obj.setCommissionRecieverMsisdn($param); and i just put one extra bracket in after closing parenthesis ($param)); that's why. ;)

Related

How can I resolve this syntax error in JPQL?

I am fairly new to JPQL and coming from SQL there are some things I still need to get familiar with, so the problem might be caused by that fact.
Working with the CUBA-Framework, I am trying to create a new entity with a JPQL like a form of projection in SQL and I already have succeeded in doing so but now with another case, I got a syntax error. So here is my JPQL:
SELECT NEW
com.example.vet.entity.vet_AnimalInformation(a.cage,0,0,'test',0)
FROM vet_Animals a
This gets transformed internally into what you can see in the exception below and gives me an error:
An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing
[SELECT NEWcom.example.vet.entity.vet_AnimalInformation(tempEntityAlias,0,0,'test',0) FROM vet_Cage tempEntityAlias, vet_Animals a where tempEntityAlias.id = a.cage.id].
[71, 72] The SELECT clause has 'NEWcom.example.vet.entity.vet_AnimalInformation' and '(tempEntityAlias, 0, 0, 'test', 0)' that are not separated by a comma.
Whyever this restructuring occurs, I can live with that, although in comparison to SQL I feel a lack of influence on the statement here :) somehow the constructor is not recognized as such.
What am I doing wrong here?
Thanks in advance!
edit:
Now I wrote my original SELECT clause in the exact way like it is shown in the error message, after it was automatically rewritten and it works! At least I get another error stating that the constructor with those types of parameters could not be found but at least it is recognized as a constructor.
My guess was then that maybe in rewriting the statement then space between NEW and the contructor gets lost but when I leave that out in my original statement I get a totally different error.

AnyLogic (systems dynamics) Square root function

im simply trying to find the square root of a dynamic (changing) variable but no matter how many different ways i feed it into the equation bar i get a syntax error or "the method SQRT(double) is undefined for the type main". im having this issue with a flow.
I think the problem is more fundamental than your use of sqrt, which works fine in a simple model mimicking what you say you've done (dynamic variable taking value from a stock and then a flow taking the sqrt of that dynamic variable); see screenshot below. I think you need to provide more detail (e.g., screenshots of your model) and/or try to reproduce the problem in a simple-as-possible model.
with IV=0
What does that mean?
"the method SQRT(double) is undefined for the type main"
Method names are case sensitive. You should use sqrt() not SQRT()
PS: If this works, ignore my other answer
**EDIT: see my other answer first, it is more likely your problem
"the method SQRT(double) is undefined for the type main"
For some reason it is looking in "main" for a square root method. The only way I could imagine this happening is if you used self.sqrt() instead of sqrt()
If sqrt() on its own doesn't fix it you could specify the actual location of the method
Math.sqrt()
Or to be even more explicit;
java.lang.Math.sqrt()

autocomplete gets in the way on method signature

errr ... dumb question but i could not find the appropriate settings for this.
When editing code, trying to add a new method in class , as shown below :
Line 355 shows my intended input. When typing it (as shown on line 360), Appcode suggests a bunch of totally irrelevant choices. Can I configure to stop that? I would normally type text[space] and get the annoying textInputContextIdentifier instead of my intent.
It's a bug in completion, track this issue for information about the progress on it.
The possible workaround is do not spent your time on first defining the method signature - try using the method which does not exists in the same way as it's already created, have the red code, press Alt+Enter and select "Create method". Press Enter and have the method stub created in .m file. After it, move cursor to the method signature, press Alt+Enter and have the declaration automatically created in .h file.

Best practices for MATLAB message IDs?

When creation a MATLAB exception (MException object) or printing a warning or error message, MATLAB lets you supply a message ID that defines the except you're throwing.
The message ID is in the format:
component:mnemonic
For example, MATLAB's own undefined variable message ID is:
MATLAB:dispatcher:nameConflict
So when you use exceptions in your own code, what do you use for a message ID? Do you reuse MATLAB's default ones? Make up your own? What do you use for the component and mnemonic strings?
I generally follow this pattern for error (or warning) message identifiers, where things in parentheses may or may not be present:
(className):(parentFunction):functionWhereErrorOccurs:descriptiveMnemonic
The components are:
className: The name of the class, if the function where the error occurs is a method/constructor.
parentFunction: If the function where the error occurs is a subfunction in an m-file or a nested function, this would be the primary m-file function or the parent of the nested function, respectively. You could therefore have multiple parentFunction components.
functionWhereErrorOccurs: The name of this component is pretty self-explanatory. ;)
descriptiveMnemonic: I stress descriptive. For example inputError doesn't really tell me anything, but notEnoughInputs makes it clear that I didn't pass enough arguments. I always use lower camel case for the mnemonic, where the first letter of a word is capitalized except for the very first word.
The className and parentFunction components could be considered somewhat redundant, since the stack property of the MException class already identifies a complete path to the parent m-file and the line number of the error. However, one of the purposes of a message identifier is that it allows you to uniquely identify an error for purposes other than just hunting down the source of the error.
Let's say you have a function myFcn and a class myClass that overloads myFcn. If you make an error message identifier for the first one be myFcn:maxIterationsReached and an error message identifier for the second one be myClass:myFcn:maxIterationsReached, this would allow you to, for example, set a breakpoint with DBSTOP that halts execution only when this error is produced by myClass\myFcn and not myFcn. Likewise, unique warning message identifiers are useful in that you can specifically choose to ignore warnings from specific functions while letting others be displayed.
Additionally, you could also include components in the identifier indicating that the function where the error occurs is located in a package folder or a private folder (but this might make for a rather long identifier).
In my work I use YMA:(mainFunctionName):(descriptiveMnemonic), where YMA are simply my initials. For example, all the warnings and errors invoked in my UIInspect utility have IDs similar to YMA:uiinspect:XXX.

Create a new method from selecting existing code block, Eclipse

I'm using Eclipse 3.something and would like to know if it is possible to create a new method from selecting a block of code? Obviously the method's signature would contain the necessary existing references and we can't return more than one variable from a method.
I have various methods where code related to presentation is mixed with code related to the logic. TY
Source:
The refactorings are Extract Method
(Alt-Shift-m) and Extract Local
Variable(Alt-Shift-l).
But I'm getting the error messages:
Not all selected statements are enclosed by the same parent statement.
or
The beginning of the selection contains characters that do not belong to a statement.
So some further refactoring is required as mentioned in the original question.
Note: in the upcoming Helios (eclipse3.6), the extract method is enhanced ("is", because it is available since September 2009, in the M1 release):
The Extract Method refactoring now handles selections that contain continue statements. To preserve the semantics of the existing code, the selection needs to include the last statement of the loop. In the extracted method, continue statements are changed to return:
For a selection that would need multiple return values in the extracted method, Eclipse now lists the conflicting variables in the error message: