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?


Let’s say that I have an MST, $ T$ . I pick an edge not in $ T$ and change its weight, and add it to $ T$ to create a cycle. Will removing the heaviest edge from that cycle result in an MST?

MST means minimum spanning tree of a graph. I came across these two posts:

  • https://stackoverflow.com/questions/13437702/how-to-get-the-new-mst-from-the-old-one-if-one-edge-in-the-graph-changes-its-wei
  • https://sudeepraja.github.io/MST/

and I follow both until the case where $ w_{old}>w$ and $ e\notin T$ . They both say that deleting the heaviest edge will guarantee an MST, but I don’t see how to prove that. The cycle property just says that IF you have an MST, it can’t have an edge which is the heaviest edge in a cycle of the original graph $ G$ ; it is NOT saying that IF you have a tree that doesn’t contain an edge that happens to be the heaviest edge of some cycle in the original graph $ G$ , you are an MST.

To make the question more explicit in terms of the problem it was trying to solve, I will copy a part of the first link:

If its weight was reduced, add it to the original MST. This will create a cycle. Scan the cycle, looking for the heaviest edge (this could select the original edge again). Delete this edge.

I don’t understand why this guarantees that we find an MST. Sure, we get a spanning tree but why does deleting this heaviest edge yield a MINIMUM spanning tree?

calling mysql procedure return empty result

when i call procedure it gives me empty result

   call hussian('prstate','table_1','column1,column2,column3',1) 

it run but gives empty result, please help me…

 DELIMITER //    CREATE PROCEDURE hussain(IN src_col varchar(20),                       IN tblname varchar(100),                       IN col_names varchar(100),                       IN _leadid int)   BEGIN     IF (col_names  = 'column1' AND col_names  = 'column2'  AND col_names = 'column3') THEN      SET @sql = CONCAT('insert into ', tblname, '(',col_names,')', ' select ' ,src_col,',','firstname,lastname from tbllead where id = ',_leadid);      PREPARE s1 from @sql;      EXECUTE s1;     DEALLOCATE PREPARE s1;  END IF;   END //   DELIMITER ;  

it insert data into table when i romove if condition…..

Do characters know they did a poor job if the result of a dice roll isn’t automatically obvious?

During a discussion I had with @jgn based on the question discussing rolling twice on an investigation check, I realized we were operating with entirely different ideas of how dice rolls actually function inside of the narrative of the game.

For example:

A fighter searches a room he’s never been in before. If he rolls a 15, he’ll find the hidden switch that opens the secret laboratory of the mad doctor Fred. He rolls and its a 3, he does not find the secret switch.

My point of view is that the fighter did his best to find something special about the room, didn’t find anything, and has no reason to roll again, and he’d get a new try, or find it automatically, if somebody later informed him about the hidden switch in the room.

@jgn’s point of view is that the fighter is aware of the fact that he did a poor job searching the room and can keep trying until he is confident that he did a good job. In essence, the fighter “knows” the dice roll and will stop trying when he rolls high enough.

To me, the later approach seems like it’d be better served with a taking 10 (passive) Investigation check and refluffing “oh I rolled a 1, I did a poor job searching, I’ll roll again!” is essentially fishing for advantage based on meta game information.

In earlier editions, “try until you are 100% certain you gave it your best” was done with taking 20, but that no longer exists in 5e.

So which, exactly, is the official D&D 5e stance?

Do characters know they did a poor job because of low dice rolls if a failed roll gives them no new information?

Is there a vulnerability other than XSS which can result in client side script execution?

If the intention of attacker is to execute an arbitrary client side script in the context of a web application, is XSS the only possible attack other than compromising the server with an RCE or a sub-resource supply chain attack? I am looking for attacks which can be mitigated by an application owner rather than attacks which the application cannot control.

  • XSS is Cross Site Scripting – Be it reflected, persistent or DOM based.
  • A sub-resource supply chain attack is where you compromise a sub resource such as CSS, javascript, flash objects etc by compromising the supply chain ie; compromising the CDNs, S3 buckets etc or by MITM a subresource loaded over non-https channel.

If XOR of n distinct numbers is ANDed over one of the number, the result would be zero

Say we Have n distinct numbers

x1,x2,....xn 

And we xor the result

xoredResult = x1^x2...^xn 

And if we AND(&) with one of the number say x2 We get Zero

xoredResult & x2 = 0 

Can we always claim that if the ANDed result is zero that the number is repeated ? Can this be used to find the first repeated element in a stream of numbers ?

ERROR: structure of query does not match function result type

   CREATE OR REPLACE FUNCTION "cem_dashboard"."n_performance_value"("city" character varying, "testdate" character varying, "technology" int4, "param" character varying)       RETURNS TABLE("sim_network_operator_code_a" float8, "client_city" text, "signal_cell_type_a" float8, "test_date" text, "data_value" float8) AS $  BODY$       BEGIN         IF param = 'download' THEN             RETURN QUERY SELECT cem_dashboard.network_performance.sim_network_operator_code_a,network_performance.signal_cell_type_a,network_performance.test_date,sum(network_performance.download_kbps) as download_kbps FROM network_performance WHERE cem_dashboard.network_performance.client_city = city AND cem_dashboard.network_performance.test_date LIKE testdate AND cem_dashboard.network_performance.signal_cell_type_a = technology GROUP BY cem_dashboard.network_performance.sim_network_operator_code_a,cem_dashboard.network_performance.signal_cell_type_a,cem_dashboard.network_performance.test_date;         ELSIF param = 'upload' THEN             RETURN QUERY SELECT cem_dashboard.network_performance.sim_network_operator_code_a,network_performance.signal_cell_type_a,network_performance.test_date,sum(network_performance.upload_kbps) as upload_kbps FROM network_performance WHERE cem_dashboard.network_performance.client_city = city AND cem_dashboard.network_performance.test_date LIKE testdate AND cem_dashboard.network_performance.signal_cell_type_a = technology GROUP BY cem_dashboard.network_performance.sim_network_operator_code_a,cem_dashboard.network_performance.signal_cell_type_a,cem_dashboard.network_performance.test_date;         ELSE             RETURN QUERY SELECT cem_dashboard.network_performance.sim_network_operator_code_a,network_performance.signal_cell_type_a,network_performance.test_date,sum(network_performance.latency) as latency FROM network_performance WHERE cem_dashboard.network_performance.client_city = city AND cem_dashboard.network_performance.test_date LIKE testdate AND cem_dashboard.network_performance.signal_cell_type_a = technology GROUP BY cem_dashboard.network_performance.sim_network_operator_code_a,cem_dashboard.network_performance.signal_cell_type_a,cem_dashboard.network_performance.test_date;         END IF;      END; $  BODY$         LANGUAGE plpgsql VOLATILE       COST 100       ROWS 1000 

I want to make a function with the contents if conditional. In if conditional, I insert a sql query where the sql has special conditions according to the parameters given, but I am confused about how to return it.

Please help me 🙁

sorry if my english is bad, I use google translate

Finding original command result from MD5 hash

Basically I hashed the result of the “date” command with md5sum:

$ date | md5sum

The output is indeed in the likes of:

e4c94362cd4fd71ec6aca78c7411bdc3 -

My question was: is it possible to recover the result of the date command knowing the date pattern (except for maybe the minutes and seconds)?

I tried using john’s mask option as well as a custom wordlist, without result.

Do you guys have any idea how we could pull that off?

sysbench runs give different result for mysql database performance evaluation

i am trying to evaluate the performance of mysql database cluster , INNODB cluster (group replication) , so i use sysbench , i run multiple test using the lua scripts (read_write.lua / read_only.lua / bulk_insert.lua) , each test is run 100 runs for repetition (to give more accurate value) ,and took the mean of the result for each test with different number of threads, but i have a problem if i rerun the test on same servers with same sysbench variables and same values for mysql cluster configuration i have different result which make me confused , could any one advise of what could the problem please. noting that i am using 3 servers vms (on same datacenter vms ) with same specification for cluster , and one server as router on same vm , sysbench installed on different server also on same vm to not have network issues.

servers specification of cluster:

ram: 8G

cpu: 2cores , x86_64, 2593.906 MHz

sysbench version : 1.0.18-1

mysql version : 8.0.18

noting below is the same values on 3 servers of my.cnf file, for sure with different server id

my.cnf file on the 3 nodes:

sysbench command used for bulk insert

sysbench –mysql-host=router_IP –mysql-port=6446 –db-driver=mysql –mysql-user=root –mysql-password=** –mysql-db=test_cluster –threads=30 –events=100000 –time=60 /usr/share/sysbench/bulk_insert.lua run |cat > innodb.log

sysbench command used for read_only test

sysbench –mysql-host=router_IP –mysql-port=6447 –db-driver=mysql –mysql-user=root –mysql-password=** –mysql-db=test_cluster –tables=5 –table_size=2000000 –threads=30 /usr/share/sysbench/oltp_read_write.lua run |cat > innodb.log

Retrieving the evaluation result of an Initialization Cell in a notebook `nb1` from another notebook `nb2`

I have a very long code in a notebook nb1 in which all the initialization cells are tagged. I have another notebook nb2 where I want to evaluate the initialization cells in nb1 and get the results in nb2 by using CellTags.

I tried the following code, which does something but I cannot see the results in nb2.

myButton[tag_] :=  Button["Evaluate " <> tag,  NotebookEvaluate[ "C:\Users\ttemel\Desktop\World_Bank_projects\WB_Contract_2\\ Extension_to_1st_contract_27oct19\IOdatabase_oecd\database_IOtables_\ SA_NO_UK_2000_2015_run_1.m", EvaluationElements -> {"Tags" -> {tag}}], Method -> "Queued"]; Grid[{Map[myButton, {"SectorIOMarketChains", "DensityPlot"}]}] CellPrint[ ExpressionCell[Defer[Print["SectorIOMarketChains"]], "Input",  CellTags -> {"SectorIOMarketChains"}, ShowCellTags -> True]] CellPrint[ ExpressionCell[Defer[Print["DensityPlot"]], "Input",  CellTags -> {"DensityPlot"}, ShowCellTags -> True]] 

Why does not this code give me the results in nb2?