ClearCase - Find invisible versions of elements under a certain path - find

I am trying to find all versions on a particular branch, but the config spec of my working view should not matter (I want to work in a view with /main/LATEST).
I am working on Windows. Assuming that the version has been created before 27.May.17:47 and I don't want to see the 0 version on my branch.
I tried to do that by using cleartool find:
cleartool find M:\my_view.dv\MY_VOB\folder_x\folder_y\ -version "brtype(my_branch) && ! created_since(27-May.17:47) && ! version(...\my_branch\0)" -print
That works for all elements that have got at least a version \main\1 or later from which the element has been branched off to my_branch.
But for an element which has just got version \main\0 (because it has been created with a rule like "element * \main\0 -mkbranch my_branch") it does not work.
So I tried using another cleartool find with "-nvisible", but "-nvisible" does not work without "-all". So I have to use following:
cleartool find M:\my_view.dv\MY_VOB\folder_x\folder_y\ -all -nvisible -version "brtype(my_branch) && ! created_since(27-May.17:47) && ! version(...\my_branch\0)" -print
But because of the "-all" option my path "M:\my_view.dv\MY_VOB\folder_x\folder_y\" is completely ignored. Instead of just searching in my path it is searching the whole VOB, which is not what I want. Because it also gives me files under "M:\my_view.dv\MY_VOB\folder_z\" as result.
So I either need to modify first query that it will give me also elements that have been created with "element * \main\0 -mkbranch my_branch", or I need a second query that gives me elements that have been created with "element * \main\0 -mkbranch my_branch" under a certain path only...
Any idea how to solve the problem without an additional script?

Looking at query language used by cleartool find, you can use compound queries
query && query
query || query ! query ( query )
That means you could try and select:
any version but the mybranch/0: ! version(...\my_branch\0)
OR:
any version 0 which does not have a version 1: version(...\my_branch\0) && ! version(...\my_branch\1)
Something like:
brtype(my_branch) && ! created_since(27-May.17:47) && \
( ! version(...\my_branch\0)
|| \
( version(...\my_branch\0) && ! version(...\my_branch\1) ) \
)
To be complete, that might select the version 0 of a file for which multiple versions have been created on mybranch, but the version 1 have been deleted (rmver).
I don't think this would be too frequent though.

The goal is to get a list of all element versions on a branch "my_branch" under a certain path only, but the view and its config spec should not matter. So it does not matter what kind of query I use because if the element itself is not selected by the view I am using to run the cleartool find, then it won't give me any of its versions as a result. If an element has just got version /main/0 but also a version .../my_branch/1 then it is not selected by a view with a config spec element * CHECKEDOUT \ element * /main/LATEST, so even if the query itself would list that element, it will anyway not be processed because of the view does not select it...
So the solution should be to add -nvisible, so all elements will be processed even if they are not selected by the views config spec. But to add -nvisible without adding -all too is not possible... As soon as I add -all the find command will ignore my given path and search the whole VOB.

Related

Drools filtering stream within DRL

I would like to create a rule with lamba expression like below:
when
rule_id: String() from "784acba8-32e5-41de-bd73-04f9ce2bfaff"
$: DroolsEventWrapper(Arrays.stream("testing".split("")).filter(element->(element!=null && element.contains("e"))).findFirst().isPresent())
then
System.out.println("Qualified for "+rule_id);
end
just a simple check "testing" will be given as a parameter also; however when I use it drl. It gave error like:
mismatched input '.' in rule "784acba8-32e5-41de-bd73-04f9ce2bfaff" in pattern
When I check the location of that dot; it belongs to filter(element->(element!=null && element.contains("e"))) when I omit it, it is working.
I am using the latest version of Drools: 7.55.0.Final. I found some tickets which say that lambda expressions somehow buggy at previous versions but not the latest ones.
Do I missing something, or is there any way to run this within DRL ?

CKan toolkit.get_action function is giving empty list when sorting by package_count

I'm new to CKAN and encountered a problem with template helpers. Particularly in my case, I will have to invoke toolkit.get_action('group_list') in my own template helper. However, when I add the constraint like the following:
results = toolkit.get_action('group_list')(data_dict={'sort': 'package_count desc',
'type': 'MyType',
'all_fields': True})
The results that I get back is an empty list. If I remove the 'sort' constraint from the data_dict, I can get the results of list the groups with 'MyType'. I don't know what caused this problem, because when I followed ckan toolkit official examples, it works for without any problems. However, what I can think of is this customized group might have its own schema such that package_count can not be used as a sort key. Since there's no error message, I can't make further assumption.
I figured out my own problem. The implementation I've showed in my question is correct. However, the database is not being populated properly. Basically you have to populate some packages for the particular groups. If you have no packages within each groups this function will return an empty query result. With the advice of #DRead, I researched the source code of _group_or_org_list(). If you take a look at this piece of code:
if sort_info and sort_info[0][0] == 'package_count':
query = model.Session.query(model.Group.id,
model.Group.name,
sqlalchemy.func.count(model.Group.id))
query = query.filter(model.Member.group_id == model.Group.id) \
.filter(model.Member.table_id == model.Package.id) \
.filter(model.Member.table_name == 'package') \
.filter(model.Package.state == 'active')
else:
query = model.Session.query(model.Group.id,
model.Group.name)
If you don't have packages created for groups, filter(model.Member.table_id == model.Package.id) will filter all groups out.

Using where() node to filter empty tags in Kapacitor

Using Kapacitor 1.3 and I am trying to use the following where node to keep measurements with an empty tag. Nothing is passing through and I get the same result with ==''.
| where(lambda: 'process-cpu__process-name' =~ /^$/)
I can workaround this issue using a default value for missing tags and filter on this default tag, in the following node but I am wondering if there is a better way structure the initial where statement and avoid an extra node.
| default()
.tag('process-cpu__process-name','system')
| where(lambda: \"process-cpu__process-name\" == 'system' )
Sure it doesn't pass, 'cause this
'process-cpu__process-name'
is a string literal it TICKScript, not a reference to a field, which is
"process-cpu__process-name"
You obviously got the condition always false in this case.
Quite common mistake though, especially for someone with previous experience with the languages that tolerates both single & double quote for mere string. :-)
Also, there's a function in TICKScript lambda called strLength(), find the doc here, please.

CQ5 QueryBuilder Search Not Working as Expected (when property NOT present)

I'm trying to produce a query that will return all pages under a path where a property is NOT present.
Effectively I want the query builder query that will produce the following xpath: /jcr:root/content/site/my/path//element(*, cq:Page)[not(jcr:content/task/#finished)]
For CQ 5.3 the 'exists' property doesn't seem to be present (according to the docs: http://docs.adobe.com/docs/en/cq/5-3/javadoc/com/day/cq/search/eval/JcrPropertyPredicateEvaluator.html), however it looks like I can use 'not', so I've tried the following two examples but neither work as I expect in query debugger:
1
path=/content/site/my/path
type=cq:Page
property=jcr:content/task/finished
property.operation=not
2
path=/content/site/my/path
type=cq:Page
property=jcr:content/task/finished
property.operation=not
property.value=true
I've also seen pages that suggest these should work, and I can't seem to see any hotfixes that would cover fixing this (assuming it isn't actually working correctly).
Can anyone offer a solution or point out where I'm going wrong?
Using CQ 5.3, upgraded to crx 2.2.
Cheers
Chris
I have a few resource that I hope help you:
My blog post about query API options: http://itgumby.github.io/blog/2014/10/cq-queries-demystified/
6 Dimension's post about specific query examples: http://labs.sixdimensions.com/blog/2014-10-07/9-jcr-sql-2-queries-every-aem-dev-should-know/
Adobe QueryBuilder documentation: http://docs.adobe.com/docs/en/aem/6-0/develop/search/querybuilder-api.html
Non-empty SQL2 (From the 6D post):
SELECT * FROM [cq:PageContent] WHERE [jcr:title] IS NOT NULL
Which means you could convert that to WHERE [jcr:title] IS NULL
If using QueryBuilder predicates, the property generally won't exist (deleted from node) if it is false. Please manually verify in your case using CRX-DE lite and examining the node & its properties. If the property does exist, but its value is false, then:
path=/content/site/my/path
type=cq:Page
property=#jcr:content/task/finished
property.value=false
For any still struggling, this is how you do it
path=/content/site/my/path
type=cq:Page
property=jcr:content/task/finished
property.operation=exists
property.value=false

Macro name expanded from another macro in makefile

I have a makefile with the following format. First I define what my outputs are;
EXEFILES = myexe1.exe myexe2.exe
Then I define what the dependencies are for those outputs;
myexe1.exe : myobj1.obj
myexe2.exe : myobj2.obj
Then I have some macros that define extra dependencies for linking;
DEP_myexe1 = lib1.lib lib2.lib
DEP_myexe2 = lib3.lib lib4.lib
Then I have the target for transforming .obj to .exe;
$(EXEFILES):
$(LINK) -OUT:"Exe\$#" -ADDOBJ:"Obj\$<" -IMPLIB:$($($(DEP_$*)):%=Lib\\%)
What I want to happen is (example for myexe1.exe)
DEP_$* -> DEP_myexe1
$(DEP_myexe1) -> lib1.lib lib2.lib
$(lib1.lib lib2.lib:%=Lib\\%) -> Lib\lib1.lib Lib\lib2.lib
Unfortunately this is not working. When I run make --just-print, the -IMPLIB: arguments are empty. However, if I run $(warning DEP_$*) I get
DEP_myexe1
And when I run $(warning $(DEP_myexe1)) I get
lib1.lib lib2.lib
So for some reason, make does not like the combination of $(DEP_$*). Perhaps it cannot resolve macro names dynamically like this. What can I do to get this to work? Is there an alternative?
Where does $(warning DEP_$*) give you DEP_myexe1 as output exactly? Because given your makefile above it shouldn't.
$* is the stem of the target pattern that matched. In your case, because you have explicit target names, you have no patten match and so no stem and so $* is always empty.
Additionally, you are attempting a few too many expansions. You are expanding $* to get myexe1 directly (assuming for the moment that variable works the way you intended). You then prefix that with DEP_ and used $(DEP_$*) to get the lib1.lib lib2.lib. You then expand that result $($(DEP_$*)) and then expand that (empty) result again (to do your substitution) $($($(DEP_$*)):%=Lib\\%).
You want to either use $(#:.exe=) instead of $* in your rule body or use %.exe as your target and then use $* to get myexe1/myexe2.
You then want to drop two levels of expansion from $($($(DEP_$*)):%=Lib\\%) and use $(DEP_$*:%=Lib\\%) instead.
So (assuming you use the pattern rule) you end up with:
%.exe:
$(LINK) -OUT:"Exe\$#" -ADDOBJ:"Obj\$<" -IMPLIB:$(DEP_$*:%=Lib\\%)
I managed to get it working without needing to resolve macros in the way described above. I modified the linking dependencies like this;
myexe1.exe : myobj1.obj lib1.lib lib2.lib
myexe2.exe : myobj2.obj lib3.lib lib4.lib
Then I need to filter these files by extension in the target recipe;
$(EXEFILES):
$(LINK) -OUT:"$(EXE_PATH)\$#" -ADDOBJ:$(patsubst %, Obj\\%, $(filter %.obj, $^)) -IMPLIB:$(patsubst %, Lib\\%, $(filter %.lib, $^))
The $(pathsubst ...) is used to prepend the path that the relevant files are in.
In the case of myexe1.exe, the link command expands to;
slink -OUT:"Exe\myexe1.exe" -ADDOBJ: Obj\myexe1.obj -IMPLIB: Lib\lib1.lib Lib\lib2.lib
Out of interest's sake, I would still like to know if it is possible to resolve macro names like in the question.