Finding an MST with one adding and removing vertex operation

I am facing the following problem: Given an undirected complete Euclidean weighted graph $ G(V, E)$ and its MST $ T$ . I need to remove an arbitrary vertex $ v_i \in V(G)$ , and given a vertex $ v_j \notin V(G)$ , I have to calculate the MST of $ G^{‘}((V(G) \backslash \{v_i\})\cup\{v_j\}, (E\backslash\{(v_i, v_k): v_k \in V(G)\})\cup\{(v_k, v_j): v_k \in V(G^{‘})\})$ , i.e, the graph $ G$ with the vertex $ v_j$ (and its respective edges) and without the vertex $ v_i$ (and its respective edges). To solve this, we can apply some well-know MST algorithms, such as Prim’s, Kruskal’s, Borukva’s algorithm. Neverthless, if we do this we would not use the already existing MST $ T$ , i.e., we would calculate a new whole MST. So, I would like to know if there is any way to reuse the existing MST $ T$ .

There are two a similar question to this here (with edges, considering only the removing of them), and here (with vertex, considering only the adding of them).

Adding Expect-CT header to HTTP response

In the security test report, I have a recommendation to add Expect-CT header to the HTTP response from web application, additionally developers set this to:

Expect-CT: max-age=0, report-uri=

I am not sure if it is a good idea to add this header. According to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect-CT:

“The Expect-CT will likely become obsolete in June 2021. Since May 2018 new certificates are expected to support SCTs by default. Certificates before March 2018 were allowed to have a lifetime of 39 months, those will all be expired in June 2021.”

So because certificates are expected to support SCTs by default I do not think that this header makes any sense.

When it comes to configuration according to https://scotthelme.co.uk/a-new-security-header-expect-ct/ max-age=0, report-uri= means:

“This policy is deployed in report-only mode and if the browser doesn’t receive CT information that it’s happy with, referred to as not being ‘CT Qualified’, rather than terminate the connection it will simply send a report to the specified report-uri value.”

Because I don’t have uri here, the report will not be sent, so there is no additional security at all.

On the other hand I see that some popular websites like Linkedin still use this header, the example from Linkedin:

Expect-CT: max-age=86400, report-uri="https://www.linkedin.com/platform-telemetry/ct"

woocommerce adding specific out of stock product directly to checkout [closed]

i have two types of products in my store , one is in stock products and the other one is on request product. On request product is set as out of stock . If a user needs an on request product he will will give a request , then from backend we will approve the request then in the oser account page we will give an proceed to checkout button which is an direct checkout . The issue is if i added the product to checkout page like this( Domainname/checkout/?add-to-cart=product id ) iam getting an error message like this(You cannot add “product 1” to the cart because the product is out of stock).

for checking the validation i have used the woocommerce_add_to_cart_validation hook but its only working if any of product is there in cart .

MST – adding an edge to graph

I have some difficulty proving the correctness of my solution to the following exercise. Let $ G = (V,E)$ undirected connected graph, $ w \colon E \to \mathbb{R}$ weight function. Let $ T$ a MST (minimum spanning tree) of $ G$ . Now, we add a new edge $ e’$ to $ E$ with weight $ w(e’)$ . Find an algorithm that updates $ T$ so it will be a MST of the new graph $ G’ = (V,E \cup \{e’\})$ . The time complexity of the algorithm should be $ O(V+E)$ .

Intuitively, the algorithm is quite simple: add $ e’$ to $ T$ , and then we got one cycle closed. Remove the edge with maximal weight from this cycle, and obtain a MST of $ G’$ .

However, I had some difficulties prove the correctness of this algorithm formally, and would appriciate some help.

BTW. I have read this post: If I have an MST, and I add any edge to create a cycle, will removing the heaviest edge from that cycle result in an MST? but unfortunately haven’t fully got the proof there.

DOM Based XSS and Adding HTML Elements

So as a rule of thumb I once learned that adding or removing HTML with JavaScript/JQuery (.html(),.append(), etc) leaves yourself wide open for DOM Based XSS Attacks. It is now my understanding that this is not 100% true. Supposedly there is a correct and safe way to add/remove HTML with JavaScript. I am hoping to learn some on what this “correct way” may be.

So as an example lets say I have an input filed that allows a user to append an item to a list. In this case the input would also be added to an array to be sent in future requests. Additionally this list would have a button to remove said item from that list. In an insecure environment we might do something like the following (negating array):

var list = $  ("#my_list");  $  ("#add_btn").on("click", function(){     let input = $  ("#input_field").val();     list.append(         '<li>'+input+' <button>Remove</button></li>'     ); });   $  ("#my_list").on("click", "button", function(){     $  (this).closest("li").remove(); }); 

How might one do the same but without the threat of XSS?

General error: 2006 MySQL server has gone away while adding a thread

error while adding a thread to database showing this errors

Warning: Error while sending QUERY packet. PID=138803 in /home/u758467727/domains/joint2purchase.com/public_html/admin/add-thread.php on line 673  Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in /home/u758467727/domains/joint2purchase.com/public_html/admin/add-thread.php:673 Stack trace: #0 /home/u758467727/domains/joint2purchase.com/public_html/admin/add-thread.php(673): PDO->exec('CREATE TABLE IF...') #1 {main} thrown in /home/u758467727/domains/joint2purchase.com/public_html/admin/add-thread.php on line 673 

and code where this error is

$  sql = "CREATE TABLE IF NOT EXISTS $  lim (    ID INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,     USERNAME TEXT NULL,    REPLY TEXT NULL,    REPLYNAME TEXT NULL,    MESSAGE TEXT NULL,    DATE TEXT NULL,    IMAGE TEXT NULL,    TYPE TEXT NULL,     LIKES TEXT NULL,    TROPHY INT(11) DEFAULT 0,    MESSAGES INT(11) DEFAULT 0,    JOINED TEXT NULL,    FILES TEXT NULL,    PHOTOS TEXT NULL,    LIKERECEIVED INT(11) DEFAULT 0    )"; $  db->exec($  sql); 

Is there any known limit for how many dice RPG players are comfortable adding up?

After reading a few RPG systems that use successes and others that use dice whose shown number are totalled, I came to the conclusion that personally I prefer adding up a maximum of 3–4 numbers and don’t like having to add up more than that — while with counting successes I had no such preference on a limit.

Now what I’m wondering is, if there are any known studies from the gaming industry (or if there is any known census there) that shows a practical limit at which the average player says “ok that is too many dice to add up” and thus loses interest?

(To clarify, adding up 3d6 in this context means adding up the face values to get somewhere between 3–18 as a sum.)

Does using an arcane focus reduce the cost of adding a spell to your spellbook?

The material explanation in chapter 10 of the Players Handbook states that:

‘A character can use a component pouch or a spellcasting focus in place of the components specified for a spell. But if a cost is indicated for a component, a character must have that specified component before he or she can cast the spell.

However in the Wizard class section it says that:

‘When you find a wizard scroll of 1st level or higher you can add it to your spellbook if it is of a spell level you can prepare and if you can spare the time to decipher and copy it. Copying that spell involves reproducing the basic form of the spell, then deciphering the unique system of notation used by the wizard who wrote it….etc,etc. For each level of the spell the process takes 2 hours and costs 50 gp. The cost represents the material components you expend as you experiment with the spell to master it, as well as the fine inks you need to record it.’

However immediately after that it states that copying a spell from your own book costs only 10 gp, which I assume constitutes the cost of the fine inks, therefore if you don’t have to expend the material components via using an arcane focus, does copying another wizards spells into your own spellbook still cost 50 gp per level, or just 10 gp per level for the fine inks.

If so would this also apply for a materials pouch?