Drools log file - drools

I have tried and unable to find a document that describes the attributes in Drools log file. For example, in below HelloWorld example log what is type?
<org.drools.audit.event.ActivationLogEvent>
<type>4</type>
<activationId>Hello World [1]</activationId>
<rule>Hello World</rule>
<declarations>m=com.sample.DroolsTest$Message#19a01f9(1)</declarations>
</org.drools.audit.event.ActivationLogEvent>

From ActivationLogEvent.java:
#param type The type of event. This can only be ACTIVATION_CREATED, ACTIVATION_CANCELLED, BEFORE_ACTIVATION_FIRE or AFTER_ACTIVATION_FIRE.
From LogEvent.java:
public static final int ACTIVATION_CREATED = 4;
public static final int ACTIVATION_CANCELLED = 5;
public static final int BEFORE_ACTIVATION_FIRE = 6;
public static final int AFTER_ACTIVATION_FIRE = 7;
So I guess your event is an ACTIVATION_CREATED event.

Related

What are the "built-in" filter options for ag-grid?

I see a reference to a built-in filter for "empty" in the doc below. Where can I find documentation for all built-in filter options?
https://www.ag-grid.com/javascript-grid-filtering/#adding-custom-filter-options
I couldn't find it in the documentation either.
However, you can look at the definition of the BaseFilter of the ag-grid here on the GitHub and get all the built-in filters.
export abstract class BaseFilter<T, P extends IFilterParams, M> extends Component implements IFilterComp {
public static EMPTY = 'empty';
public static EQUALS = 'equals';
public static NOT_EQUAL = 'notEqual';
public static LESS_THAN = 'lessThan';
public static LESS_THAN_OR_EQUAL = 'lessThanOrEqual';
public static GREATER_THAN = 'greaterThan';
public static GREATER_THAN_OR_EQUAL = 'greaterThanOrEqual';
public static IN_RANGE = 'inRange';
public static CONTAINS = 'contains'; //1;
public static NOT_CONTAINS = 'notContains'; //1;
public static STARTS_WITH = 'startsWith'; //4;
public static ENDS_WITH = 'endsWith'; //5;
// .....
}

Eclipse code formatter customization

I've recently configured my Eclipse Formatter and I'm pretty happy with how it works, except for one thing. I'd like to set it up so my member variables are sorted into 3 distinct group with a blank line between each of the groups. I want the first group to be static final variables (constants), the second to be regular static variables, and in the third I want all the non-static variables (or again split final and non-final ones, I don't mind either way).
For example, I'd like my class to look like this:
public class Foo {
public static final String PATH_TO_BAR = "C:/Drunken/Clam/Bar";
public static final int N_BARS = 42;
public static BufferedWriter logger;
public int foobar;
public String barfoo;
private int lengthOfBarFoo;
...
}
but right now it formats it as
public class Foo {
public static final String PATH_TO_BAR = "C:/Drunken/Clam/Bar";
public static BufferedWriter logger;
private int lengthOfBarFoo;
public String barfoo;
public static final int N_BARS = 42;
public int foobar;
...
}
Is this possible to set up somehow?
Eclipse save actions might come handy here, however not to such of a detail you've been asking for.
i think you can do that via below :
in eclipse you can sort "Members Sort Order" preference:
"Window -> Preferences -> Java -> Appearance -> Members Sort Order"
you can up and down the choice according to your need.
if you have any query or doubt, comment below.

Unity3D Access class from another script

hey how can i access this list of int and strings from another
script?
// Slot One Data
[Serializable]
public class SlotOneStats
{
public string nameOne;
public int roleOne;
public int strengthOne;
public int meleeOne;
public int shootingOne;
public int huntingOne;
public int cookingOne;
public int craftingOne;
public int buildingOne;
public int engineeringOne;
}
i tried changing 'public' to 'static' or 'public static' but whenever i changed to static
it will say
Static member `Main.SlotOneStats.ALLTHESTATICVARIABLEGOESHERE' cannot be accessed with an
instance reference, qualify it with a type name instead
BinaryFormatter bfWriter = new BinaryFormatter();
FileStream file = File.Create(Application.persistentDataPath + "/dataStats" + onSlot + ".fgsv");
if(onSlot == 1)
{
SlotOneStats slotoneStats = new SlotOneStats();
slotoneStats.nameOne = name;
slotoneStats.roleOne = role;
slotoneStats.strengthOne = strength;
slotoneStats.meleeOne = melee;
slotoneStats.shootingOne = shooting;
slotoneStats.huntingOne = hunting;
slotoneStats.cookingOne = cooking;
slotoneStats.craftingOne = crafting;
slotoneStats.buildingOne = building;
slotoneStats.engineeringOne = engineering;
bfWriter.Serialize(file, slotoneStats);
}
I would suggest adding a public instance of the class to the first script:
public class SlotOneStats
{
public string nameOne;
public int roleOne;
public int strengthOne;
public int meleeOne;
public int shootingOne;
public int huntingOne;
public int cookingOne;
public int craftingOne;
public int buildingOne;
public int engineeringOne;
}
public SlotOneStats SOS;
Now just access the public varaible SOS and it should work:
GameObject example = GameObject.Find("Object_with_script").GetComponent<Script_with_class>.SOS;
// do stuff with example

Accessing public method of another class

Basically, I'm trying to call a method in another class, but I'm running into errors.
Here is the code:
public class Ocean
{
private static int gridWidth, gridHeight;
private int safeCount;
private boolean shipSafe;
private static Ship[] ships;
private static int[][] grids;
public Ocean(int a, int b, int c)
{
grids = new int[a][b];
ships = new Ship[c];
for(int i = 0; i < c; i++)
{
ships[i] = Ship();
}
gridWidth = a;
gridHeight = b;
}
I cannot access the public Ship class, and the error appears in ships[i] = Ship();
I've tried redefining it, adding a constructor.
change the line ships[i] = new Ship();

How to ignore a specific warning in PyDev?

How do I ignore a specific warning in Eclipse?
I am doing ZetCode's PyQt4 tutorial LPTHW style (yes, I'm using PyDev), and adding helpful comments so I can use it as a reference. Eclipse is bugging me about an unused variable. (It is being used, because the initialization function automatically runs the code. Just to be clear.)
I don't want to turn it off for the whole file, because that is actually handy in most situations. I just want to ignore that warning.
For suppressing warnings on a specific line, your only option is to add a comment such as ##UnusedVariable to the line:
def foo():
x = 5 # #UnusedVariable
return 10
To suppress a different type of warning, see the list of suppression string constants in the PyDev source code:
public static final String MSG_TO_IGNORE_TYPE_UNUSED_IMPORT = "#UnusedImport";
public static final String MSG_TO_IGNORE_TYPE_UNUSED_WILD_IMPORT = "#UnusedWildImport";
public static final String MSG_TO_IGNORE_TYPE_UNUSED_VARIABLE = "#UnusedVariable";
public static final String MSG_TO_IGNORE_TYPE_UNDEFINED_VARIABLE = "#UndefinedVariable";
public static final String MSG_TO_IGNORE_TYPE_DUPLICATED_SIGNATURE = "#DuplicatedSignature";
public static final String MSG_TO_IGNORE_TYPE_REIMPORT = "#Reimport";
public static final String MSG_TO_IGNORE_TYPE_UNRESOLVED_IMPORT = "#UnresolvedImport";
public static final String MSG_TO_IGNORE_TYPE_NO_SELF = "#NoSelf";
public static final String MSG_TO_IGNORE_TYPE_UNDEFINED_IMPORT_VARIABLE = "#UndefinedVariable";
public static final String MSG_TO_IGNORE_TYPE_UNUSED_PARAMETER = "#UnusedVariable";
public static final String MSG_TO_IGNORE_TYPE_NO_EFFECT_STMT = "#NoEffect";
public static final String MSG_TO_IGNORE_TYPE_INDENTATION_PROBLEM = "#IndentOk";
public static final String MSG_TO_IGNORE_TYPE_ASSIGNMENT_TO_BUILT_IN_SYMBOL = "#ReservedAssignment";
public static final String MSG_TO_IGNORE_TYPE_PEP8 = "#IgnorePep8";
public static final String MSG_TO_IGNORE_TYPE_ARGUMENTS_MISATCH = "#ArgumentMismatch";
For example:
def get_answer(format='string'): # #ReservedAssignment
answer = 42.0
if format == 'string':
return str(answer)
elif format == 'int':
return int(answer)
else:
return answer