## How to hide the column titles of all the lists on a Sharepoint page

Use below code in script editor or content editor web part:

``````<script type="text/javascript">

var allListTables = document.querySelectorAll("table.ms-listviewtable");

for(var i = 0; i < allListTables.length; i++) {
var tbodyElement = allListTables(i).firstChild;
var trElement = tbodyElement.firstChild;
trElement.style.display = "none";
}
}

</script>
``````

3. Click Edit Source under FORMAT TEXT tab

4. Paste above code in HTML Source dialog opened

5. Click OK

6. Click Stop Editing under PAGE tab in ribbon

## magento2 – Requisition Lists- How to enable and share out-of-box in Magento 2 Cloud

Had a question on requisition List. Some users are able to see the requisition list and for some it is hidden. I am aware there is an “enable” configuration for Requisition List at Website level(General -> B2B Features’)

Questions:
a) If some users do not see the Req. List, does it mean that the config is disabled for their website or is there some other configuration?
b) If out-of-box, user wants to share his Requisition List with other users in the company, is there such a feature, if yes, how would we do that?

Thanks!

## python – Finding unique top sums from multiple lists

My question arises from this post on MSE where I have provided an answer to solve the question :

There are multiple lists given. The number of lists is arbitrary.
Each list contains numbers and is sorted descendingly.
We shall take exactly $$1$$ element from each list and calculate the sum of elements.How would you go about finding the top $$N$$ sums?

Here the top sums need not to be different, just the indices of them. I wanted to write an algorithm to find the top $$N$$ unique sums, namely where the sum of elements is different. What I have done is using the same approach described in the linked post. The problem is that for some inputs there are lots of duplicates sums, so the research for the unique ones gets slower and slower. I post the implementation in python

``````import time

def top_solutions_2(N,lists):

N_best = ()
k, len_k_lists = len(lists), (len(x) for x in lists)
init_sol = (sum(x(0) for x in lists),tuple(0 for x in range(k)))
comp_list, new_vals = ((init_sol)), ()
seen = {init_sol(1)}

for _ in range(N) :

curr_best = (float('-inf'))
for x in comp_list :
if x and x(-1)(0) > curr_best(0) : curr_best = x(-1)

N_best.append(curr_best)

inds = ()

for arr in comp_list :

while arr :

comp_val = arr.pop()

if curr_best(0) > comp_val(0) : arr.append(comp_val); break

inds.append(comp_val(1))

comp_list.append(())

for ind in inds :

for x in range(k) :

if len_k_lists(x) > ind(x)+1 : r = tuple(c if i != x else c+1 for i,c in enumerate(ind))
else : continue

if r not in seen :
curr_sum = curr_best(0)+lists(x)(r(x))-lists(x)(r(x)-1)
comp_list(-1).append((curr_sum,r))

comp_list(-1).sort()

return N_best

for N in range(10,60,10) :

lists = ( (23,5,3,2,1),
(19,9,8,7,0),
(17,12,4,2,1),
(15,13,11,9,2),
(21,17,13,9,4),
(16,13,12,11,1),
(27,23,21,18,4),
(31,25,24,12,1),
(27,22,14,7,3),
(9,8,7,6,5))

a = time.time()
top_solutions_2(N,lists)
b = time.time()
print("Top {} in {} sec".format(N,b-a))
``````

where the output is

``````Top 10 in 0.0 sec
Top 20 in 0.07787561416625977 sec
Top 30 in 0.5308513641357422 sec
Top 40 in 2.2048890590667725 sec
Top 50 in 7.203002452850342 sec
``````

How can a more efficient algorithm with a lower complexity and/or a lower running time be made?And also, how can my approach be improved in efficiency?

## algorithms – FInding the unique top sums from multiple lists

My question arises from this post on MSE where I have provided an answer to solve the question :

There are multiple lists given. The number of lists is arbitrary.
Each list contains numbers and is sorted descendingly.
We shall take exactly $$1$$ element from each list and calculate the sum of elements.How would you go about finding the top $$N$$ sums?

Here the top sums need not to be different, just the indices of them. I wanted to write an algorithm where the top $$N$$ unique sums, namely where the sum of elements is different. What I have done is using the same approach described in the linked post. The problem is that for some inputs there are lots of duplicates sums, so the research for the uniques one gets slower and slower. I post the implementation in python

``````import time

def top_solutions_2(N,lists):

N_best = ()
k, len_k_lists = len(lists), (len(x) for x in lists)
init_sol = (sum(x(0) for x in lists),tuple(0 for x in range(k)))
comp_list, new_vals = ((init_sol)), ()
seen = {init_sol(1)}

for _ in range(N) :

curr_best = (float('-inf'))
for x in comp_list :
if x and x(-1)(0) > curr_best(0) : curr_best = x(-1)

N_best.append(curr_best)

inds = ()

for arr in comp_list :

while arr :

comp_val = arr.pop()

if curr_best(0) > comp_val(0) : arr.append(comp_val); break

inds.append(comp_val(1))

comp_list.append(())

for ind in inds :

for x in range(k) :

if len_k_lists(x) > ind(x)+1 : r = tuple(c if i != x else c+1 for i,c in enumerate(ind))
else : continue

if r not in seen :
curr_sum = curr_best(0)+lists(x)(r(x))-lists(x)(r(x)-1)
comp_list(-1).append((curr_sum,r))

comp_list(-1).sort()

return N_best

for N in range(10,60,10) :

lists = ( (23,5,3,2,1),
(19,9,8,7,0),
(17,12,4,2,1),
(15,13,11,9,2),
(21,17,13,9,4),
(16,13,12,11,1),
(27,23,21,18,4),
(31,25,24,12,1),
(27,22,14,7,3),
(9,8,7,6,5))

a = time.time()
top_solutions_2(N,lists)
b = time.time()
print("Top {} in {} sec".format(N,b-a))
``````

where the output is

``````Top 10 in 0.0 sec
Top 20 in 0.07787561416625977 sec
Top 30 in 0.5308513641357422 sec
Top 40 in 2.2048890590667725 sec
Top 50 in 7.203002452850342 sec
``````

Is there a way to design an algorithm with a lower complexity?

## architecture – Organising gameobjects into multiple lists

I have a very simple little game that consists of a player, zombies, food, and treasure. It’s all automated. The player will walk towards a zombie and shoot within a certain distance, which costs energy. If the player goes below a certain energy level, it will find the closest food item and walk towards that and once the player has reached it, the player will gain energy, and continue to move towards zombies and shoot them, until all are dead and the player will movie towards the zombie.

This is meant to be a way of learning object oriented programming for a class, so standard functional concepts such as ECS do not apply (and its so simple that would be overkill). Currently I have an array of GameObjects that all other objects such as player, zombie etc inherit from that gives them a position and an image to render (I’m aware an object shouldn’t be responsible for its own rendering). All GameObjects are put into this array so I can interate through it and rendering everything which works fine. But not every entity requires an update, so I made an updatable interface, allowing classes that require updating to implement. So now i’m in a situation where there are two lists, renderable game objects, and updatable game objects. My problem arises when the player must operate on a specific subset of entities at a time. e.g. find all the zombies or all the food items to determine which is the closest. So would it be better then, to have arrays of zombies, and arrays of food items instead that I can pass to the player to operate on? And since only 2-3 game objects will need to actually be updated, should I just not bother putting them into a list to be updated and just keep a list of all renderables, with seperate lists for all zombies and food items etc?

Any thoughts on how this could be best designed would be appreciated.

## office 365 – SharePoint Online – limit apps / lists available

My customer wants to limit the Apps (basically list templates, libraries, etc.) available in a site.

So after you create a team site or communication site, when the owner goes to add an app, how to limit what is available so they can’t create a travel request or issue tracking list for example.

This would have to be the default behavior for all sites across the tenant – limit what apps/lists can be created. Any help in pointing me to the best approach to get this done would be great.

## When do reference cycles occur other than doubly linked lists?

I’m trying to find examples of reference cycles and look for common patterns. The only one I’ve managed to find so far are doubly linked lists again and again.. any other common patterns or really any times you’ve encountered them in real life?

## algorithm – Flattening a List containing Empty Lists

As part of a text buffer implemented as a piece table, there is an often called procedure to flatten a nested list of character lists. The function is part of constructing substrings of the buffer for display, copying, and cutting.

I have been using a procedure based on Dan D.’s StackOverflow answer here: https://stackoverflow.com/a/33338608/193509. It has worked admirably except for one corner case.

If the user deletes all of the text in the buffer, the list of characters presented to the `flatten` function consists of a single element list. The single element is the empty list `'()`.

The “stock” version of `flatten` does not handle this correctly. I’ve added a special case to the `cond` that recognizes the condition and responds appropriately (to my mind any way.) So,

``````(flatten '(())) ;=> '()
``````

Here’s what I have for `flatten`.

``````(define (flatten lst)
(letrec ((helper (lambda (lst acc stk)
(cond ((null? lst)
(if (null? stk) (reverse acc)
(helper (car stk) acc (cdr stk))))

((pair? (car lst))
(helper (car lst) acc (if (null? (cdr lst))
stk
(cons (cdr lst) stk))))
;; Special case for a list containing just empty lists.
((null? (car lst)) '())

(else
(helper (cdr lst) (cons (car lst) acc) stk))))))
(helper  lst '() '())))
``````

But the special case feels clunky and not very general. Is there a better way to do this?

More generally, what should a flattened list containing empty lists look like? I have just assumed that reducing to a single empty list is correct. Likewise, it seems to me that flattening a list containing a mixture of empty lists and non-empty should just return a list of the non-empty elements.

``````(flatten '(() () ())) ;=> '()
(flatten '((a) (b (x y) c) () (d) () ())) ;=> (a b x y c d)
``````

Any thoughts on that?

## ct.category theory – Cyclic lists of Multisets

I am wondering if it is appropriate to ask about having a specific monad composition computed. We all know about the multiset monad, $$mathcal{M}_S$$, and some might know about the cyclic lists monad, $$mathcal{L}_C$$. I need to know all about the composition of these, so $$mathcal{L}_C otimes mathcal{M}_S$$, so cyclic lists of multisets. We need to first find out if they compose at all. Then, supposing they do compose, I would like to know their product axiom. Finally, I would like to know the Eilenberg-Moore category.

For a base category, sets is fine, though to make this a polynomial monad, it needs to be on the 2-category of Groupoids.

## google chrome – Integrating lists into Python/Selenium

What I am trying do is use a web page to create art template files so I don’t have to do it manually.
The web page is hosted on our private domain so you can only access it through a computer on the domain. I have about 1000 of these to do currently and they are listed in a excel document(the excel/xlsx doc in the google drive link only has 24).

I have the “bot” working with making one template. The thing I need help with is being able to use a `ForEach` action on either a `.xlsx` or with a `.txt` if its easier. Then changing the `TemplateName` in the python script and repeating the part I annotated.

``````     from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import os
import time

TemplateName = ("test2") ## template to be made

PATH = "C:Program Files (x86)chromedriver.exe"
driver = webdriver.Chrome(PATH)  ##chrome webdriver needs to installed for whatever version chrome you are using

## repeat from here down
driver.get ("http://pulse1.pgd.com/Admin/Templates/Create")  ## forwards you to the create template page
time.sleep(1) ## gives time for page to respond

##repo
TempName = driver.find_element_by_xpath(".//*(@id='Name')")
TempCode = driver.find_element_by_xpath(".//*(@id='Code')")
FileName = driver.find_element_by_xpath("//*(@id='Filename_chosen')")
FileSearch = driver.find_element_by_xpath("//*(@id='Filename_chosen')/div/div/input")
OrderType = Select(driver.find_element_by_id('OrderType'))
CreateBtn = driver.find_element_by_xpath("/html/body/div/div(1)/div/form/div(5)/div/input")

## create template
OrderType.select_by_visible_text('print-template') ## selects Print-template from dropdown box
TempName.clear()
TempName.send_keys(TemplateName) ## Inputs template name
TempCode.clear()
TempCode.send_keys(TemplateName) ## Inputs same as template name
time.sleep(1) ## waits 1 second for page to respond
FileName.click()  ## clicks on search box
FileSearch.send_keys(TemplateName + "n") ## fills in search box and hits enter
time.sleep(2) ## waits 2 seconds for art to load

CreateBtn.click() ## Clicks to create template
``````

I know not use `time.sleep` but i couldn’t get the implicit wait to work.
I’ve only been learning this for 2 days so I’m kind of happy with what I got so far 🙂
Also didn’t know what to name this question so feel free to change it or let me know what I should change it too.