How to restrict indexed_search to show only results of subtree (pages and there subpages) typo3 8 LTS - typo3

Search Page Domain 1 should not list results of Domain 2 and Domain 3
Search Page Domain 2 should only list results of Domain 2
Search Page Domain 3 should only list results of Domain 3
- - Domain 1 (uid:1)
- - Lvl1 Page Domain 1 (uid:2)
- - - Lvl2 Page 1 Domain 1 (uid:3)
- - Lvl1 Page Domain 1 (uid:4)
- - Lvl1 Page Domain 1 (uid:5)
- - Search Page Domain 1
- - Microsites (uid:5)
- - - Domain 2 (uid:6)
- - - - Unterseite 1 Domain 2 (uid:7)
- - - - Unterseite 2 Domain 2 (uid:8)
- - - - Unterseite 3 Domain 2 (uid:9)
- - - - Search Page Domain 2
- - - Domain 3 (uid:10)
- - - - Unterseite 1 Domain 3 (uid:11)
- - - - Unterseite 2 Domain 3 (uid:12)
- - - - Unterseite 3 Domain 3 (uid:13)
- - - - Search Page Domain 2

TS Setup for Pages:
UID:1
plugin.tx_indexedsearch.settings.defaultOptions.sections = rl1_2, 4, 5
Declaration:
rlx_y = Level x, Page y
4,5 = PageUid 4, PageUid 5
Search results:
Search Page Domain 1: Shows Content of PageUid's: 2,3,4,5
UID:6 (Domain 2 or Subpage)
plugin.tx_indexedsearch.settings.defaultOptions.sections = rl1_6
Search results:
Search Page Domain 2: Shows Content of PageUid's: 7,8,9
UID:10 (Domain 3 or Subpage)
plugin.tx_indexedsearch.settings.defaultOptions.sections = rl1_10
Search results:
Search Page Domain 3: Shows Content of PageUid's: 11,12,13

Related

Substring function to extract part of the string

data = {'desc': ['ADRIAN PETER - ANN 80020355787C - 11 Baillon Pass.pdf', 'AILEEN MARCUS - ANC 800E15432922 - 5 Mandarin Way.pdf',
'AJITH SINGH - ANN 80020837750 - 11 Berkeley Loop.pdf', 'ALEX MARTIN-CURTIS - ANC 80021710355 - 26 Dovedale St.pdf',
'Alice.Smith\Jodee - Karen - ANE 80020428377 - 58 Harrisdale Dr.pdf']}
df = pd.DataFrame(data, columns = ['desc'])
df
From the data frame, I want to create a new column called ID, and in that ID, I want to have only those values starting after ANN, ANC or ANE. So I am expecting a result as below.
ID
80020355787C
800E15432922
80020837750
80021710355
80020428377
I tried running the code below, but it did not get the desired result. Appreciate your help on this.
df['id'] = df['desc'].str.extract(r'\-([^|]+)\-')
You can use - AN[NCE] (800[0-9A-Z]+) -, where:
AN[NCE] matches literally AN followed by N or C or E;
800[0-9A-Z]+ matches literally 800 followed by one or more characters between 0 and 9 or between A and Z.
>>> df['desc'].str.extract(r'- AN[NCE] (800[0-9A-Z]+) -')
0
0 80020355787C
1 800E15432922
2 80020837750
3 80021710355
4 80020428377
If not all your ids start with "800", you can just remove it from the pattern.

How to filter out input from Prometheus for a Grafana bar chart [duplicate]

I am running a diskspace used query in Prometheus and would like to return only the top 5 or 10 entries from the search result. Is there anyway I can achieve that?
Currently, the query I am trying is returning me 58 entries
(100 - 100 * (node_filesystem_avail{device!~"by-uuid",device!~"tmpfs",mountpoint="/"} / node_filesystem_size{device!~"by-uuid",device!~"tmpfs",mountpoint="/"})) > 70
Just add topk(5, ...) in your query:
topk(5, (100 - 100 * (node_filesystem_avail{device!~"by-uuid",device!~"tmpfs",mountpoint="/"} / node_filesystem_size{device!~"by-uuid",device!~"tmpfs",mountpoint="/"})) > 70)

Get shadow copies older than 5 days using PowerShell

I would like to get these shadow copies that were created more than 5 days ago. How could I do this using PowerShell?
cmd> Diskshadow
Diskshadow> List shadows all
* Shadow copy ID = {49fb469b-4940-45f7-98bd-08441e9e353c}
<No Alias>
- Shadow copy set: {32224b82-e802-4eab-a903-fb5dc6558800}
<No Alias>
- Original count of shadow copies = 11
- Original volume name: \\?\Volume{bba82744-b690-4b68-9180-c0d81
7c5a38f}\ [G:\]
- Creation time: 4/13/2021 6:03:34 PM
- Shadow copy device name: \\?\GLOBALROOT\Device\HarddiskVolumeS
hadowCopy313
- Originating machine: app.contoso.local
- Service machine: app.contoso.local
- Not exposed
- Provider ID: {b5946137-7b9f-4925-af80-51abd60b20d5}
- Attributes: No_Auto_Release Persistent Differential
* Shadow copy ID = {8ac42987-5f9a-4535-aef0-c6d64d7a658b}
* Shadow copy ID = {d9be01ee-c1e6-424f-ac9a-cf82ef4e5e58}
<No Alias>
- Shadow copy set: {32224b82-e802-4eab-a903-fb5dc6558800}
<No Alias>
- Original count of shadow copies = 11
- Original volume name: \\?\Volume{1120d149-97e5-4b8d-af19-bb243
38626ef}\ [H:\]
- Creation time: 4/13/2021 6:03:34 PM
- Shadow copy device name: \\?\GLOBALROOT\Device\HarddiskVolumeS
hadowCopy271
- Originating machine: app.contoso.local
- Service machine: app.contoso.local
- Not exposed
- Provider ID: {b5946137-7b9f-4925-af80-51abd60b20d5}
- Attributes: No_Auto_Release Persistent Differential
There is a module that can do this:
https://www.powershellgallery.com/packages/CPolydorou.ShadowCopy/1.1.2/Content/ShadowCopy.psm1

can slot take entity values without a action function or forms in RASA?

is it possible to pass values in the entity to slots without form or writing an action function?
nlu.yml
nlu:
- intent: place_order
examples: |
- wanna [large](size) shoes for husky
- need a [small](size) [green](color) boots for pupps
- have [blue](color) socks
- would like to place an order
- lookup: size
examples: |
- small
-medium
-large
- synonym: small
examples: |
- small
- s
- tiny
- synonym: large
examples: |
- large
- l
- big
- lookup: color
examples: |
- white
- red
- green
domain.yml
version: "2.0"
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- place_order
entities:
- size
- color
slot:
size:
type: text
color:
type: text
responses:
utter_greet:
- text: "Hey! can I assist you ?"
utter_order_list:
- text : "your order is {size} [color} boots. right?"
stories.yml
version: "2.0"
stories:
- story: place_order
steps:
- intent: greet
- action: utter_greet
- intent: place_order
- action: utter_order_list
debug output: it recognize entity , but the value is not passed to slot
Hey! can I assist you ?
Your input -> I would like to place an order for large blue shoes for my puppy
Received user message 'I would like to place an order for large blue shoes for my puppy' with intent '{'id': -2557752933293854887, 'name': 'place_order', 'confidence': 0.9996021389961243}' and entities '[{'entity': 'size', 'start': 35, 'end': 40, 'confidence_entity': 0.9921159148216248, 'value': 'large', 'extractor': 'DIETClassifier'}, {'entity': 'color', 'start': 41, 'end': 45, 'confidence_entity': 0.9969255328178406, 'value': 'blue', 'extractor': 'DIETClassifier'}]'
Failed to replace placeholders in response 'your order is {size} [color} boots. right?'. Tried to replace 'size' but could not find a value for it. There is no slot with this name nor did you pass the value explicitly when calling the response. Return response without filling the response
"slot" is an unknown keyword. you should write "slots" instead of "slot" in the domain file and it will work.

How to comment on a specific line number on a PR on github

I am trying to write a small script that can comment on github PRs using eslint output.
The problem is eslint gives me the absolute line numbers for each error.
But github API wants the line number relative to the diff.
From the github API docs: https://developer.github.com/v3/pulls/comments/#create-a-comment
To comment on a specific line in a file, you will need to first
determine the position in the diff. GitHub offers a
application/vnd.github.v3.diff media type which you can use in a
preceding request to view the pull request's diff. The diff needs to
be interpreted to translate from the line in the file to a position in
the diff. The position value is the number of lines down from the
first "##" hunk header in the file you would like to comment on.
The line just below the "##" line is position 1, the next line is
position 2, and so on. The position in the file's diff continues to
increase through lines of whitespace and additional hunks until a new
file is reached.
So if I want to add a comment on new line number 5 in the above image, then I would need to pass 12 to the API
My question is how can I easily map between the new line numbers which the eslint will give in it's error messages to the relative line numbers required by the github API
What I have tried so far
I am using parse-diff to convert the diff provided by github API into json object
[{
"chunks": [{
"content": "## -,OLD_TOTAL_LINES +NEW_STARTING_LINE_NUMBER,NEW_TOTAL_LINES ##",
"changes": [
{
"type": STRING("normal"|"add"|"del"),
"normal": BOOLEAN,
"add": BOOLEAN,
"del": BOOLEAN,
"ln1": OLD_LINE_NUMBER,
"ln2": NEW_LINE_NUMBER,
"content": STRING,
"oldStart": NUMBER,
"oldLines": NUMBER,
"newStart": NUMBER,
"newLines": NUMBER
}
}]
}]
I am thinking of the following algorithm
make an array of new line numbers starting from NEW_STARTING_LINE_NUMBER to
NEW_STARTING_LINE_NUMBER+NEW_TOTAL_LINESfor each file
subtract newStart from each number and make it another array relativeLineNumbers
traverse through the array and for each deleted line (type==='del') increment the corresponding remaining relativeLineNumbers
for another hunk (line having ##) decrement the corresponding remaining relativeLineNumbers
I have found a solution. I didn't put it here because it involves simple looping and nothing special. But anyway answering now to help others.
I have opened a pull request to create the similar situation as shown in question
https://github.com/harryi3t/5134/pull/7/files
Using the Github API one can get the diff data.
diff --git a/test.js b/test.js
index 2aa9a08..066fc99 100644
--- a/test.js
+++ b/test.js
## -2,14 +2,7 ##
var hello = require('./hello.js');
-var names = [
- 'harry',
- 'barry',
- 'garry',
- 'harry',
- 'barry',
- 'marry',
-];
+var names = ['harry', 'barry', 'garry', 'harry', 'barry', 'marry'];
var names2 = [
'harry',
## -23,9 +16,7 ## var names2 = [
// after this line new chunk will be created
var names3 = [
'harry',
- 'barry',
- 'garry',
'harry',
'barry',
- 'marry',
+ 'marry', 'garry',
];
Now just pass this data to diff-parse module and do the computation.
var parsedFiles = parseDiff(data); // diff output
parsedFiles.forEach(
function (file) {
var relativeLine = 0;
file.chunks.forEach(
function (chunk, index) {
if (index !== 0) // relative line number should increment for each chunk
relativeLine++; // except the first one (see rel-line 16 in the image)
chunk.changes.forEach(
function (change) {
relativeLine++;
console.log(
change.type,
change.ln1 ? change.ln1 : '-',
change.ln2 ? change.ln2 : '-',
change.ln ? change.ln : '-',
relativeLine
);
}
);
}
);
}
);
This would print
type (ln1) old line (ln2) new line (ln) added/deleted line relative line
normal 2 2 - 1
normal 3 3 - 2
normal 4 4 - 3
del - - 5 4
del - - 6 5
del - - 7 6
del - - 8 7
del - - 9 8
del - - 10 9
del - - 11 10
del - - 12 11
add - - 5 12
normal 13 6 - 13
normal 14 7 - 14
normal 15 8 - 15
normal 23 16 - 17
normal 24 17 - 18
normal 25 18 - 19
del - - 26 20
del - - 27 21
normal 28 19 - 22
normal 29 20 - 23
del - - 30 24
add - - 21 25
normal 31 22 - 26
Now you can use the relative line number to post a comment using github api.
For my purpose I only needed the relative line numbers for the newly added lines, but using the table above one can get it for deleted lines also.
Here's the link for the linting project in which I used this. https://github.com/harryi3t/lint-github-pr