rules

Rules Table/Method in Access, has anyone heard of it?

你。 提交于 2019-12-13 05:57:46
问题 We have 5000 Products all with separate prices and 200 customers who could all have different prices for each of these products. We need some way of allowing the sales team to change prices for individual customers or products or ranges/categories without affecting the rest of the prices for the other customers. Right now this is done by copy and pasting a price list, making manual changes and importing the new price list as a category. This is not what we want. I have been told about a

Python CSV: write rows according to dict mapping

前提是你 提交于 2019-12-13 04:53:37
问题 I have a dict that describes a mapping I want applied to every row in a CSV file. dict1 = {"key1":["value1", "value2"], "key2":["value3"]} My program should read one row and map the key in a specific column to the value(s) provided by the dict . If there's only one value per key, then the script should write to a new file the row containing the new value. If there are multiple values to a key, then there should be one new row written per value. For example, csvin contains 2 rows. One row has

YACC Rules not reduced

北战南征 提交于 2019-12-13 04:48:44
问题 This is my code calc.y. I keep getting the error: yacc: 1 rule never reduced yacc: 3 reduce/reduce conflicts not really sure what this means Ive done some research in other places but I am now lost. Im guessing the rules being referred to is program and statement but even so... what does the reduce rule mean? %{ #include <stdio.h> FILE *outfile; int yyline = 1; int yycolumn = 1; %} %union{ int nw; struct{ int v; char s[1000]; }attr; } %token SEMInumber %token LPARENnumber %token <nw>

tree generation for rules in python

爱⌒轻易说出口 提交于 2019-12-13 03:58:40
问题 I would like to draw a tree like structure using Tkinter for the following data: S--->NP VGF NP VGNF NP--->N_NNP_O_M VGF--->V_VM_VF NP--->N_NNP_S_F VGNF--->V_VM_VNF V_VM_VF--->എത്തി N_NNP_S_F--->സീതയെ V_VM_VNF--->കാണാന്‍ N_NNP_O_M--->രാമൻ This is the CFG rules for a single sentence, it written in a file. How can i view these rules in the form of tree in python? That is parse tree. How can I draw the tree using Tkinter in GUI. Any help or any hint will be very much appreciated. 回答1: do you

How to control rule evaluation (or rule execution) stages in Drools?

丶灬走出姿态 提交于 2019-12-13 03:55:33
问题 I know that "salience" in Drools provides control under rule execution sequence. But above is an example of the problem when "saliences" cannot help anymore that I've faced with. Here I have three rules being executed one after another: rule "Rule 1" salience 30 when then Resource resource1 = new Resource(); resource1.setName("Resource 1"); resource1.setAmount("5"); insert(resource1); System.out.println("First"); end rule "Rule 2" salience 20 //no-loop (interesting, it doesn't lead to a loop)

How can i match on multiple objects of the same kind in Drools 5?

孤街醉人 提交于 2019-12-13 02:51:22
问题 Given a collection of BMSContract objects in memory of two or more, I need to match specific patterns using the BMSContract.status field. My rule should resolve to Success if in such collection exactly ONE and ONLY ONE BMSContract has a status of ACTIVE. Any other combination of objects and status codes should resolve to Fail. Again this rule is for a collection of 2 or more objects only and there could be any number of them: 2, 5, 10, 15 or more. There is a slightly different set of rules

JUnit @Rule lifecycle interaction with @Before

萝らか妹 提交于 2019-12-12 09:34:44
问题 I have some JUnit tests that use the TemporaryFolder @Rule . They use the TemporaryFolder in a @Before method to perform some setup: @Rule public TemporaryFolder folder = new TemporaryFolder(); @Before public void init() { folder.newFile("my-file.txt"); } @Test public void myTest() { ... } Most of the time this works perfectly. However, when using the SpringJUnit4ClassRunner I find that in some cases the init() method is invoked before the Statement inside my TemporaryFolder instance is

Why doesn't this rule prevent duplicate key violations?

时光怂恿深爱的人放手 提交于 2019-12-12 08:38:48
问题 (postgresql) I was trying to COPY csv data into a table but I was getting duplicate key violation errors, and there's no way to tell COPY to ignore those, so following internet wisdom I tried adding this rule: CREATE OR REPLACE RULE ignore_duplicate_inserts AS ON INSERT TO mytable WHERE (EXISTS ( SELECT mytable.id FROM mytable WHERE mytable.id = new.id)) DO NOTHING; to circumvent the problem, but I still get those errors - any ideas why ? 回答1: Rules by default add things to the current action

forall always evaluates to be true [Drools]

会有一股神秘感。 提交于 2019-12-12 04:09:22
问题 I have a class Application, within which there is a list of instances of CallPhones. class Application() { List<CallPhones> callPhonesList; ... } class CallPhones() { Integer callTimes; ... } I want to fire the rule when callTimes of all instances larger than 10. Here is the rule: rule "Application eligible" when app : Application() forall(CallPhones(callTimes > 10)) then // application is eligible end Strangely, the rule always fires , even when there's an instance with callTimes being 5. I

Complex conditional element in accumulate in Jess rules

会有一股神秘感。 提交于 2019-12-12 01:54:46
问题 I am trying to find average value of temperature observations in JessTab which requires joining facts from multiple classes. The following rule: (defrule averageOfObsValue ?res <- (accumulate (progn (bind ?s 0)(bind ?n 0)) (progn (bind ?s (+ ?s ?v)) (++ ?n)) (create$ ?n ?s ?qo) (and (object (is-a http..#ObservationValue) (OBJECT ?ov) (http..#hasDataValue ?v) ) (object (is-a http..#SensorOutput) (OBJECT ?so) (http..#hasValue ?ov) ) (object (is-a http..#Observation) (OBJECT ?o) (http..