typoscript 3 level menu - menu

i need specific menu for typo3: list all pages of all levels, like this:
level 1 page 1 -- level 2 page 1 -- level 3 page 1
level 1 page 1 -- level 2 page 1 -- level 3 page 2
level 1 page 1 -- level 2 page 1 -- level 3 page 3
level 1 page 1 -- level 2 page 1 -- level 3 page n
level 1 page 1 -- level 2 page 2 -- level 3 page 1
level 1 page 1 -- level 2 page 2 -- level 3 page 2
level 1 page 1 -- level 2 page 2 -- level 3 page n
level 1 page 2 -- level 2 page 1 -- level 3 page 1
level 1 page 2 -- level 2 page 1 -- level 3 page 2
level 1 page 2 -- level 2 page 1 -- level 3 page n
level 1 page 3 -- level 2 page 1 -- level 3 page 1
...
something like a table of breadcrumbs but visible on each page level.

Related

Find a subset of rows (N rows) in a Pandas data frame having the same values at a subset of columns

I have a df which contains customer data without a primary key. The same customer might show up multiple times.
I have a field (df2['campaign']) that is an int and reflects how many times the customer shows up in the df. There are also many customer attributes.
In my example, going from top to bottom, for each row (i.e. customer), I would like to find all n rows (i.e. all n customers) whose values of the education and default columns are the same. Remember n is the int contained in df2['campaign']
So as shown below, for row 0 and 1 I should search 1 row but find nothing because there are no matching values for education-default combinations.
For row 2 I should search 1 row (because campaign == 1) where education-default values match, and find 1 row in index 4.
df2.head()
job marital education default campaign housing loan contact
0 3 1 0 0 1 0 0 1
1 7 1 3 1 1 0 0 1
2 7 1 3 0 1 2 0 1
3 0 1 1 0 1 0 0 1
4 7 1 3 0 1 0 2 1
Use df2_sorted = df2.sort(['education', 'default'], ascending=[1, 1]).
Then if your data is not noisy, the rows should become neighbors.

List of all permutations

Verbs C. A. is related to permutations.
And they have very complicated documentation.
I want just get all possible permutations (n!)
For example for elements 1 2 3
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
Left argument of A. is a list of permutation indeces.
Right argument of A. is the list to be permuted.
The initial (unpermuted) list has index 0 and it goes on from there lexicographically [*].
Egs:
(0) A. 'a';'b';'c'
┌─┬─┬─┐
│a│b│c│
└─┴─┴─┘
(1 0) A. 1 2 3
1 3 2
1 2 3
(0 1 2) A. 5 1 2
5 1 2
5 2 1
1 5 2
To get all permutations of a list, you request all (! #y) (factorial of number of elements of list y to be permuted) of them, by requesting all indeces 0 ... (n-1): i. (! # y):
(i.!#y) A. y
[*]: Lexicographically by the implied list i. # y. That is, A. always permutes the simple list 0 ... n and then applies this permutation to your initial list: permutation { initial_list.

Tracking work towards awards in MS Excel

I’m trying to create a report from existing data about tasks people have completed and whether they can give given awards for completion of the tasks
I have a list of people who have been working to complete tasks in an exhaustive list, completion of which is recorded in an Excel sheet with ticks or similar characters. (table 1.)
For each of these people, awards can be given when various subsets of these tasks are completed. The tasks required for these awards overlap and are maintained in a list per award. (table 2.)
I would like to generate a report which identifies for each person how many tasks he or she has completed toward each award. I will use this report to identify if they can be given the award or how many more tasks they need to complete.
One way to do it... If you change the tick marks to a numeric value of one (1), you can add formulas to additional columns on the table (or a separate sheet).
| A B C D E F G H I J K L M N
+----+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+----------+----------+----------+
1 | task01 task02 task03 task04 task05 task06 task07 task08 task09 task10 Award 01 Award 02 Award 03
2 | name01 1 1 1 1 1 1 Yes No No
3 | name02 1 1 1 No No No
4 | name03 1 1 1 1 1 1 1 No Yes No
5 | name04 1 1 No No No
6 | name05 1 1 1 1 No No No
7 | name06 1 1 1 No No No
8 | name07 1 1 1 1 1 1 1 1 No Yes Yes
9 | name08 1 1 No No No
10 | name09 1 No No No
11 | name10 1 No No No
The formulas used in L2, M2, and N2:
=IF(SUM(B2:F2)=5,"Yes","No")
=IF(SUM(G2:K2)=5,"Yes","No")
=IF(SUM(C2,F2,I2,J2,K2)=5,"Yes","No")

How can I implement a grouping algorithm in J?

I'm trying to implement A006751 in J. It's pretty easy to do in Haskell, something like:
concat . map (\g -> concat [show $ length g, [g !! 0]]) . group . show
(Obviously that's not complete, but it's the basic heart of it. I spent about 10 seconds on that, so treat it accordingly.) I can implement any of this fairly easily in J, but the part that eludes me is a good, idiomatic J algorithm that corresponds to Haskell's group function. I can write a clumsy one, but it doesn't feel like good J.
Can anyone implement Haskell's group in good J?
Groups are usually done with the /. adverb.
1 1 2 1 </. 'abcd'
┌───┬─┐
│abd│c│
└───┴─┘
As you can see, it's not sequential. Just make your key sequential like so (essentially determining if an item is different from the next, and do a running sum of the resulting 0's and 1's):
neq =. 13 : '0, (}. y) ~: (}: y)'
seqkey =. 13 : '+/\neq y'
(seqkey 1 1 2 1) </. 'abcd'
┌──┬─┬─┐
│ab│c│d│
└──┴─┴─┘
What I need then is a function which counts the items (#), and tells me what they are ({. to just pick the first). I got some inspiration from nubcount:
diffseqcount =. 13 : ',(seqkey y) (#,{.)/. y'
diffseqcount 2
1 2
diffseqcount 1 2
1 1 1 2
diffseqcount 1 1 1 2
3 1 1 2
If you want the nth result, just use power:
diffseqcount(^:10) 2 NB. 10th result
1 3 2 1 1 3 2 1 3 2 2 1 1 3 3 1 1 2 1 3 2 1 2 3 2 2 2 1 1 2
I agree that /. ( Key ) is the best general method for applying verbs to groups in J. An alternative in this case, where we need to group consecutive numbers that are the same, is dyadic ;. (Cut):
1 1 0 0 1 0 1 <(;.1) 3 1 1 1 2 2 3
┌─┬─────┬───┬─┐
│3│1 1 1│2 2│3│
└─┴─────┴───┴─┘
We can form the frets to use as the left argument as follows:
1 , 2 ~:/\ 3 1 1 1 2 2 3 NB. inserts ~: in the running sets of 2 numbers
1 1 0 0 1 0 1
Putting the two together:
(] <;.1~ 1 , 2 ~:/\ ]) 3 1 1 1 2 2 3
┌─┬─────┬───┬─┐
│3│1 1 1│2 2│3│
└─┴─────┴───┴─┘
Using the same mechanism as suggested previously:
,#(] (# , {.);.1~ 1 , 2 ~:/\ ]) 3 1 1 1 2 2 3
1 3 3 1 2 2 1 3
If you are looking for a nice J implementation of the look-and-say sequence then I'd suggest the one on Rosetta Code:
las=: ,#((# , {.);.1~ 1 , 2 ~:/\ ])&.(10x&#.inv)#]^:(1+i.#[)
5 las 1 NB. left arg is sequence length, right arg is starting number
11 21 1211 111221 312211

Most concise J syntax for creating a numeric matrix

Imagine that I want to take the numbers from 1 to 3 and form a matrix such that each possible pairing is represented, e.g.,
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
Here is the monadic verb I formulated in J to do this:
($~ (-:## , 2:)) , ,"0/~ 1+i.y
Originally I had thought that ,"0/~ 1+i.y would be sufficient, but unfortunately that produces the following output:
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
In other words, its shape is 3 3 2 and I want something whose shape is 9 2. The only way I could think of to fix it is to pour all of the data into a new shape. I'm convinced there must be a more concise way to do this. Anyone know?
Reshaping your intermediate result can be simplified. Removing the topmost axis is commonly done with ,/ so in your case the completed phrase could be ,/ ,"0/~ 1+i.y
One way (which uses { as a monad in its capacity for permutation cataloguing):
>,{ 2#<1+i.y
EDIT:
Some fun to be had with this scheme:
All possible permutations:
>,{ y#<1+i.y
Configurable number in sequence:
>,{ x#<1+i.y
I realize this question is old, but there is a simpler way to do it: count to 9 in trinary, and add 1.
1 + 3 3 #: i.9
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
The 3 3 & #: gives you two digits. The general 'base 3' verb is 3 & #.^:_1.

Resources