rules

Postgresql subquery execution within ON UPDATE rule (maybe bug in postgresql?)

半腔热情 提交于 2019-12-12 01:27:16
问题 I am running into a strange behavior (or is this a bug within postgresql?) within postgresql's execution order of subqueries within rules. Consider the following SQL: BEGIN; CREATE OR REPLACE FUNCTION debug(anyelement) RETURNS bool AS $$ pg_raise('notice', 'debug(): ' . json_encode($args[0])); RETURN TRUE; $$ LANGUAGE PLPHP IMMUTABLE STRICT; CREATE TABLE foo_table (c1 text); CREATE OR REPLACE RULE foo_update_rule AS ON UPDATE TO foo_table DO INSTEAD ( WITH foobar_update AS ( SELECT unnest('{a

Mediawiki parsing in ANTLR: processing ' tokens

狂风中的少年 提交于 2019-12-11 23:13:51
问题 I'm trying to write a grammar to parse Media wiki's wiki syntax, and after this the Creole syntax too (unfortunately an existing Creole grammar doesn't work in Antlr 3). My issue right now is being able to capture a bold rule when I'm already inside an italic rule, or visa versa. For example '' this text is bold '''now it's italic''' and just bold again'' I've got a lot of help from this question but I'm stuck. The goal is to produce HTML inside the grammar using actions, or possibly an AST -

Nanoc layout compile Rules

老子叫甜甜 提交于 2019-12-11 12:17:42
问题 I'm working with nanoc and I want my index.html to point to specific layout so I created that layout and it is called nosidebar.html My Rules looks like: compile 'index.html' do layout 'nosidebar' end and this doesn't seem to work. What am I doing wrong? 回答1: I haven't done exactly what you are but maybe something like this: compile '/' do rep.layout 'nosidebar' end 回答2: You can always add something like: compile '*' do if item.binary? # don’t filter binary items else layout item[:layout] ||

how to install latest version of prometheus/promtool in ubuntu?

被刻印的时光 ゝ 提交于 2019-12-11 11:32:56
问题 I downloaded my prometheus version is 2.3.2 wget https://github.com/prometheus/prometheus/releases/download/v2.3.2/prometheus-2.3.2.linux-amd64.tar.gz untared and prometheus already running as service. I want to verify my Prometheus alert manager rule using promtool. created one rule from below blog. https://petargitnik.github.io/blog/2018/01/04/how-to-write-rules-for-prometheus when I run the promtool check rules /etc/prometheus/prometheus.rules.yml it says, Promtheus not installed, so

Rule to group two facts in prolog?

六眼飞鱼酱① 提交于 2019-12-11 07:04:41
问题 I am writing code for the London tube. I have declared facts that display the name of a station and also which line it is on. e.g. station(aldgate,metropolitan). station(brixton,victoria). station(baker,metropolitan). I'm trying to work out a rule that will check whether two stations are on the same line, and which line that is. For example, aldgate and baker are on the same line, metropolitan . Any ideas? 回答1: I'm trying to work out a rule that will check whether two stations are on the same

CLIPS: modify-instance does not trigger pattern matching

我是研究僧i 提交于 2019-12-11 06:16:57
问题 Having a file test.clp: (defclass TestClass (is-a USER) (role concrete) (pattern-match reactive) (slot value) (slot threshold)) (definstances TestObjects (Test of TestClass (value 0) (threshold 3))) (defrule above-threshold ?test <- (object (is-a TestClass)) (test (> (send ?test get-value) (send ?test get-threshold))) => (printout t "*** Above threshold!! ***" crlf) (refresh below-threshold)) (defrule below-threshold ?test <- (object (is-a TestClass)) (test (> (send ?test get-value) (send

How to set prometheus rules in stable/prometheus chart values.yaml?

跟風遠走 提交于 2019-12-11 02:57:08
问题 Using official Prometheus chart stable/prometheus . Customized its values.yaml file to set alertmanager.yml file and serverFiles area. At rules: {} : https://github.com/kubernetes/charts/blob/master/stable/prometheus/values.yaml#L598 It's {} . How to write real alert rules as official format here? For example, I tried: serverFiles: alerts: {} rules: # Alert for any instance that is unreachable for >5 minutes. - alert: InstanceDown expr: up == 0 for: 5m labels: severity: page annotations:

Only allow unique values in Firebase Realtime Database [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 02:44:25
问题 This question already has answers here : How do you prevent duplicate user properties in Firebase? (2 answers) Firebase security rules to check unique value of a child #AskFirebase (1 answer) Closed 2 years ago . Here's my data structure: root ---+ mydata |--- -KqI0uf--1-bD3oLlx2h:"Joe" |--- -Kdk0bf--1-bx0oLlb9a:"Mike" |--- -Kox8gf--1-b36onlT3h:"Eve" How do I write a rule to only allow unique values in my Firebase Realtime Database? For example, I don't want this to happen: root ---+ mydata |

Which Python language rule allows the descriptor to be found first?

不羁的心 提交于 2019-12-11 01:59:23
问题 I bumped into the following last night and I'm still at a loss as to explain it: class Foo(object): @property def dave(self): vars(self)['dave'] = 1 return 2 f = Foo() print f.dave print f.dave Running this code produces: 2 2 The question is why? My understanding of attribute access is that the instance dictionary is checked before the class dictionary, and the dictionary of any bases, however as seen above the instance dictionary doesn't appear to be getting checked before the descriptor is

Rule for capturing SYN-scanning

。_饼干妹妹 提交于 2019-12-11 00:12:39
问题 I need to write a rule that captures the SYN-scanning. I tried this: alert tcp any any -> any any (flags:S,12; msg:"SYN"; sid: 1231213;) then try to scan: nmap -sS myIP but this does not output "SYN" How to write a correct rule? Thanks. 回答1: Try to change flags:S,12 to flags:S as the Snort manual states: The reserved bits '1' and '2' have been replaced with 'C' and 'E', respectively, to match RFC 3168, "The Addition of Explicit Congestion Notification (ECN) to IP". The old values of '1' and