pr.probability – Bounding the probability of success of adding elements into a list

Suppose we are given some lists of elements $L_1, dots, L_{ell}$ where each list has $n$ elements. We use a fully independent hash function $h$ to compute a value for each element of each list. (We suppose the hash function returns a value uniformly at random from $(n^2)$. Note also that
two elements $x$ and $y$ where $x = y$ has $h(x) = h(y)$.) We then use the $X$ elements corresponding to the $X$ smallest hash values of each list to do the following:

We have some set $C$ consisting of elements from the lists. We order the lists in an arbitrary order and process the lists in that order. Then, using the $X$ elements from each list, we add the elements in each list $L_i$ to $C$ if at most a $1/r$-fraction of $X$ elements are in $C$. The question is: how large does $X$ have to be if I want to ensure with probability at least $1 – frac{1}{n^c}$ for some constant $c$ that each list $L_j$ added to $C$ has at most a $(1+epsilon)(1/r)$-fraction of elements in $L_j$ that are in $C$ when it was added to $C$, and each list not added to $C$ has more than $(1-epsilon)(1/r)$-fraction of elements in $C$ when it was processed.

Suppose we have a random variable $R_i$ for each list $L_i$ representing whether list $L_i$ has at most a $(1+epsilon)(1/r)$-fraction of its elements in $C$ provided at most $(1/r)$-fraction of the elements in its $X$ elements is in $C$. The difficulty of the problem is that the $R_i$‘s are not only correlated with each other but also depends on which lists are added into $C$.

wishlist – How to move Wish List next to Qty input box in product detail page?

To move the element next to the input box you have to create these files in your local theme:


<?xml version="1.0"?>
<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="view.addto.wishlist" remove="true"/>
        <referenceBlock name="">
            <block class="MagentoWishlistBlockCatalogProductViewAddToWishlist" name="add-to-wishlist" template="Magento_Wishlist::catalog/product/view/addto/wishlist.phtml"/>


/** @var $block MagentoCatalogBlockProductView */
<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Add to Cart'); ?>
<?php if ($_product->isSaleable()) :?>
<div class="box-tocart">
    <div class="fieldset">
        <?php if ($block->shouldRenderQuantity()) :?>
        <div class="field qty">
            <label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
            <div class="control">
                <input type="number"
                       value="<?= $block->getProductDefaultQty() * 1 ?>"
                       title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
                       class="input-text qty"
                       data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"
                <span class="product-social-links">
                    <span clas="product-addto-links" data-role="add-to-links">
                        <?= $block->getBlockHtml('add-to-wishlist') ?>



        <?php endif; ?>
        <div class="actions">
            <button type="submit"
                    title="<?= $block->escapeHtmlAttr($buttonTitle) ?>"
                    class="action primary tocart"
                    id="product-addtocart-button" disabled>
                <span><?= $block->escapeHtml($buttonTitle) ?></span>
            <?= $block->getChildHtml('', true) ?>
<?php endif; ?>
<script type="text/x-magento-init">
        "#product_addtocart_form": {
            "Magento_Catalog/js/validate-product": {}

The wishlist block will then appear next to the input field in the dom. You will have to use css for the finishing touch:

enter image description here

Populate person field of custom list via REST

How do I get the values of get_id() function into person/group field via REST? I know the syntax of the REST part has to be like:

'AssignedToId': {"results": (ID1, ID2,...)}

But how do I load the values into an array and pass this into {"results": ()} ?

var Id = get_id();
'AssignedToId': {"results": (Id)} 


'AssignedToId': Id

doesn’t work

Here’s the code

var hostweburl;
 var appweburl;
 var getId = new Array();

// Run your custom code when the DOM is ready.
$(document).ready(function () {


     //Get the decoded URLs
        hostweburl = GetUrlKeyValue("SPHostUrl");
        appweburl = GetUrlKeyValue("SPAppWebUrl");

        //resources are in URLs in the form:
        var scriptbase = hostweburl + "/_layouts/15/";

        //load the js files and continue to the successHandler
        $.getScript(scriptbase + "SP.Runtime.js",
        function () {
            $.getScript(scriptbase + "SP.js",
                function () { $.getScript(scriptbase + "SP.RequestExecutor.js"); } 


// Render and initialize the client-side People Picker.
function initializePeoplePicker(peoplePickerElementId) {

    // Create a schema to store picker properties, and set the properties.
    var schema = {};
    schema('PrincipalAccountType') = 'User,DL,SecGroup,SPGroup';
    schema('SearchPrincipalSource') = 15;
    schema('ResolvePrincipalSource') = 15;
    schema('AllowMultipleValues') = true;
    schema('MaximumEntitySuggestions') = 50;
    schema('Width') = '280px';
    this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, null, schema);

// Query the picker for user information.
function getUserInfo() {

    // Get the people picker object from the page.
    var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerDiv_TopSpan;

    // Get information about all users.
    var users = peoplePicker.GetAllUserInfo();
    var userInfo = '';
    for (var i = 0; i < users.length; i++) {
        // Get the user's ID by using the login name.
        .then(function (result) {
                getId = result.get_id();


   // Get user keys.
   var keys = peoplePicker.GetAllUserKeys();


//Function to prepare and issue the request to get SharePoint Data
    function execCrossDomainRequest() {

       var rest_data = JSON.stringify({
            '__metadata': { 'type': 'SP.Data.TicketsListItem' },
            'Title': $("#Title").val(), 
            'AssignedToId': { 'results': getId}, 
            'Issue_x002d_Status': $("#status").val(), //be sure to enter the INTERNAL column name!
            'Priorit_x00e4_t': $("#prio").val(), //be sure to enter the INTERNAL column name!
            'Kategorie': $("#kat").val() 

        //executor: The RequestExecutor object
        //Initialize the RequestExecutor with the add-in web URL
        var executor = new SP.RequestExecutor(appweburl);

        // Issue the call against the add-in web.
        // To get the title using REST we can hit the endpoint:
        // appweburl/_api/web/lists/getbytitle('listname')/items
        // The response formats the data in the JSON format.
        // The functions successHandler and errorHandler attend the sucess and error events respectively
            url: appweburl + "/_api/SP.AppContextSite(@target)/web/lists(guid'F1176C57-5AA4-4E73-9865-0EE5638FA682')/items?@target='" + hostweburl + "'", //use guid of list to make sure there are no errors
            method: "POST",
            body: rest_data,
            headers: {
                "Accept": "application/json; odata=verbose", "content-type": "application/json;odata=verbose", "X-RequestDigest": $("#__REQUESTDIGEST").val(),
            success: successHandler,
            error: errorHandler

    //Function to handle the success event.
    function successHandler() {


    // Function to handle the error event
    function errorHandler() {


// Get the user ID.
function getUserId(loginName) {

    var deferred = $.Deferred();

    var context = new SP.ClientContext.get_current();
    var user = context.get_web().ensureUser(loginName);
            function () { deferred.resolve(user); }),
            function (sender, args) { deferred.reject(sender, args); }));

    return deferred.promise();


$.when(getUserId(users(i).Key)).then(function (result) {


the alert is showing me the correct Id’s (from time to time in different order, but that shouldn’t be a problem). Nevertheless there’s nothing populated in my AssignedToId column. All the other columns getting filled.

var rest_data = JSON.stringify({
        '__metadata': { 'type': 'SP.Data.TicketsListItem' },
        'Title': $("#Title").val(),
        'AssignedToId': { "results": getId },
        'Issue_x002d_Status': $("#status").val(), //be sure to enter the INTERNAL column name!
        'Priority': $("#prio").val(), //be sure to enter the INTERNAL column name!
        'Category': $("#cat").val()


the rest_data alert is giving me “…AssignedToId:{results: ()}..”


So I’m typing in 3 users and the alerts of alert(getId); are

the alert of alert(rest_data); is

plotting – Get a List plot with hep of module

I just want to get a list plot for my model which I wrote with help of the module.

pp(nn_) := Module({},
  n = nn;
(*......Main code Here ....*)
 N(U /. qsol);
 ListPlot(N(U /. qsol), n, AxesLabel -> {"n", "E (J)"}))
Show(Table(pp(j), {j, 1, 5}))

It gave me the correct answer, but I couldn’t get any action.

Its the answer :

Show({ListPlot(0., 1, AxesLabel -> {"n", "E (J)"}), 
  ListPlot(3087.46, 2, AxesLabel -> {"n", "E (J)"}), 
  ListPlot(7312.15, 3, AxesLabel -> {"n", "E (J)"}), 
  ListPlot(8717.81, 4, AxesLabel -> {"n", "E (J)"}), 
  ListPlot(9210.08, 5, AxesLabel -> {"n", "E (J)"})})

I want to get a plot that evaluates all my code for n and plots it for every n.

r – Construct list from a dataframe and a formula

A dataframe and a right-sided formula are given:

dat <- data.frame(
  A = c("a", "b", "c"),
  B = c("x", "y", "z"),
  NotUsed = c(1, 2, 3)

frml <- ~ A + B + A:B

From them, I want to get this list:

# ((1))
# (1) a b c
# Levels: a b c
# ((2))
# (1) x y z
# Levels: x y z
# ((3))
# (1) a:x b:y c:z
# Levels: a:x b:y c:z

Here is how I get this list:

library(lazyeval) # to use 'as.lazy' and 'lazy_eval'
tf <- terms.formula(frml)
factors <- rownames(attr(tf, "factors"))
tvars <- attr(tf, "variables")
tlabs <- attr(tf, "term.labels")
used <- lapply(eval(tvars, envir = dat), as.factor)
names(used) <- factors
lapply(tlabs, function(tlab){
  droplevels(lazy_eval(as.lazy(tlab), data = used))

Do you have a better way to propose?

multi select – List filter with multiple selection for ID column

In SharePoint 2016 I have a list that uses the ID column in the list view.

For all the other columns I can filter by using the checkboxes for multiple choices, but with the ID column I can not.
Does anyone have a workaround?

Please see the behavior of the ID column and another column.

ID Column doesn't show the check boxes

All other columns do show the check boxes for multiple filtering choice

Effy L.

datasheet – Blank window when editing list item

I have a problem when I want to edit a list item.
When click on it or “…” edit item I receive white window with “x” all items of the list.

However when I want to add an item there is no issue; form is opened and can be filled.

Have you already seen this kind of issue? Thank you for your help.

enter image description here

8 – How to limit country list for address form drop-down?

In my store I defined list of supported billing and shipping countries at store settings. This list is respected during checkout process – limited list of countries is shown when customer is entering the address. But when user is on “Address book” tab of user profile page and wants to add new address list is not limited, but all countries are allowed there.

How can I limit list of displayed countries when editing address at address book user profile tab?

I tried using hook_form_alter() but I don’t see country drop-down there?
Also tried hook_preprocess_input() and I see other fields, but not country drop-down.

theme_preprocess_field() didn’t help either.

And of course, I didn’t find that option in back-end.

list – HTML Button Doesn’t Redirect to SharePoint Form

As per my understanding (Correct me if I am wrong), you forgot to add the type="button" to your button element.

So, Add type=”button” to the button.

<button type="button" onclick="yourFunction()">Click Here</button>

Reference: prevent refresh of page when button inside form clicked

Also, it will be easier to answer your question more precisely by looking at at the code you are using currently. Can you please add the code you are using to your question?

text – Convert bulleted and numbered list HTML code to Markdown in AppleScript?

I have this text to manipulate in AppleScript (e.g. the text of a variable):

Example note exported from Apple.

    <li>*Further* indent</li>
      <li>Even **further **indent. With a (link)(</li>

End note.

I’m converting it all to Markdown from HTML. I need to clean up this remaining bit of HTML which is the bullet list, so that the result is:

Example note exported from Apple.

- Indent
    - *Further* indent
        - Even **further **indent. With a (link)(

End note.

It has to be able to cater to nested indenting with some rich text inside the items such as this example. I prefer Markdown output to use hyphens and either a tab or two spaces for the indenting.

It also has to be containable inside the applescript – no external .py files etc, and to not require homebrew or a third party tool to be installed.