## audio – How do I redirect speaker output to microphone input for a Redmi Note 4?

I have a Redmi Note 4 android device and I have installed LineageOS 16.0. The phone is rooted. I want to redirect the speaker output to the microphone. Could you please suggest the change required in /etc/ to make those changes?

My requirement is as below: I am a live streamer. I want to play music on my Redmi note 4 android phone. The live streaming app is also installed on the same device. I need to send the output of those background music as input to my phone microphone and avoid any surrounding noise. (i.e. the phone microphone should not capture any noise and it should only capture the output of background music).

Reference 1: LineageOS Source https://wiki.lineageos.org/devices/mido

Reference 2: Mido Kernal https://github.com/MiCode/Xiaomi_Kernel_OpenSource/tree/mido-m-oss

## transaction input – How can the segwit witness data be “off-chain”? What does it really mean?

No that’s not accurate, witness data is on-chain, inputs have a similar byte length as before, they are just weighed differently, and the transaction throughput is increased because segwit is a defacto blocksize increase.

Thus, with segwit, the witness data was separated from the rest of the input. More specifically, the witness data is now “off-chain”. This made the input much lighter and, in turns, it made spending an UTXO cheaper and faster to process.

This is a common misunderstanding perpetuated by an abundance of (sometimes deliberately) confusing descriptions of how segwit works.

A transaction is not complete without the proof that it was authorized by the owner of the spent funds. As such, the witness is explicitly part of a “complete transaction”. What segwit did was to segregate the witness (read “signature”) out of the input script and move it to the “witness section” of the transaction. The witness section is at the same hierarchical level as the inputs and outputs.

The witness section is excluded when calculating the transaction id (txid), but it is part of the transaction, and used to calculate the witness transaction id (wtxid). While the merkle root in the blockheader commits to the txids of the included transactions, each segwit block additionally commits to a merkle tree of the transactions’ wtxids. In conclusion, the witnesses are a) part of the transaction, b) part of the blockchain, c) necessary to fully validate the blockchain.

Segwit replaced the blocksize limit with a blockweight limit. The blocksize was based on the raw byte length of transactions and capped at 1,000,000 bytes. The blockweight limit is capped at 4,000,000 weight units, where weight is calculated by counting witness bytes with a factor of one, and non-witness bytes with a factor of 4. This happens to result in an equivalent limit if a block only includes transactions without witness data.

The actual transaction data of a segwit input compared to a non-segwit input is only marginally smaller. It is the discount of witness data that allows blocks to exceed the previous blocksize limit, making segwit an effective blocksize increase with the biggest block to date having 2,422,858 bytes (but 3,993,379 weight units).

Segwit transactions and blocks are made forward compatible to pre-segwit nodes. Segwit nodes will strip the witness data before relaying the data to pre-segwit nodes. The stripped transactions and blocks are non-standard but valid according to the pre-segwit protocol rules, and thus pre-segwit nodes can follow the blockchain and converge on the same UTXO set.

Note that pre-segwit nodes have not been “fully validating nodes” since segwit was activated on August 24th 2017 as they do not unilaterally enforce all consensus rules of the Bitcoin protocol.

## transaction input – How can the segwit witness data can be “off-chain”? What does it really mean?

No that’s not accurate, witness data is on-chain, inputs have a similar byte length as before, they are just weighed differently, and the transaction throughput is increased because segwit is a defacto blocksize increase.

Thus, with segwit, the witness data was separated from the rest of the input. More specifically, the witness data is now “off-chain”. This made the input much lighter and, in turns, it made spending an UTXO cheaper and faster to process.

This is a common misunderstanding perpetuated by an abundance of (sometimes deliberately) confusing descriptions of how segwit works.

A transaction is not complete without the proof that it was authorized by the owner of the spent funds. As such, the witness is explicitly part of a “complete transaction”. What segwit did was to segregate the witness (read “signature”) out of the input script and move it to the “witness section” of the transaction. The witness section is at the same hierarchical level as the inputs and outputs.

The witness section is excluded when calculating the transaction id (txid), but it is part of the transaction, and used to calculate the witness transaction id (wtxid). While the merkle root in the blockheader commits to the txids of the included transactions, each segwit block additionally commits to a merkle tree of the transactions’ wtxids. In conclusion, the witnesses are a) part of the transaction, b) part of the blockchain, c) necessary to fully validate the blockchain.

Segwit replaced the blocksize limit with a blockweight limit. The blocksize was based on the raw byte length of transactions and capped at 1,000,000 bytes. The blockweight limit is capped at 4,000,000 weight units, where weight is calculated by counting witness bytes with a factor of one, and non-witness bytes with a factor of 4. This happens to result in an equivalent limit if a block only includes transactions without witness data.

The actual transaction data of a segwit input compared to a non-segwit input is only marginally smaller. It is the discount of witness data that allows blocks to exceed the previous blocksize limit, making segwit an effective blocksize increase with the biggest block to date having 2,422,858 bytes (but 3,993,379 weight units).

Segwit transactions and blocks are made forward compatible to pre-segwit nodes. Segwit nodes will strip the witness data before relaying the data to pre-segwit nodes. The stripped transactions and blocks are non-standard but valid according to the pre-segwit protocol rules, and thus pre-segwit nodes can follow the blockchain and converge on the same UTXO set.

Note that pre-segwit nodes have not been “fully validating nodes” since segwit was activated on August 24th 2017 as they do not unilaterally enforce all consensus rules of the Bitcoin protocol.

## php – How to retrieve quantity input field by id in woocommerce

I want to retrieve quantity input field for the product having 95 id. trying this function but it is not
working. it adds only one product in cart even after selecting more than one in the input field.

``````<div class="quantity">
<label>QTY</label>
<?php woocommerce_quantity_input(array(
'product_id'=>95
)); ?>
</div>
``````

## python – Randomly selected integers from predetermined lists add up to specific input value

Hello im trying to write a Python code that selects integers from arrays up to a certain value.

I wrote this code however the code uses every list once (as is intended). But sometimes it is still below the input value and has no more options to choose from.

For example if i say WantedNumber is 15 and it picks 4 from listC and 5 from listA, it then has no more options for a correct answer in listB.

or sometimes it picks 1 from every list and then it has no more lists to choose from cause it used all of them already.

How can I make it select a random sequence of integers that adds up to WantedNumber

Note: ”similar questions” are always about completely random numbers adding up to input value. But I don’t want random numbers, I want randomly selected predetermined numbers from my lists.

``````import random

listA = (1,2,3,4,5)
listB = (1,2,3)
listC = (1,2,4,7)

All = (listA,listB,listC)

x = 0

while x < int(WantedNumber):
print(x) #this prints the new x value with the new Random2 added up

Random1 = random.choice(All)
Random2 = random.choice(Random1)

print(Random1) #this prints which variable of the list it chose
print(Random2) #this prints which integer from the array from Random1 it chose
index = All.index(Random1)
All.pop(index)

Y = int(x) + int(Random2)

if Y<=int(WantedNumber):
x=Y
$$```$$
``````

## 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:

app/design/frontend/Custom/default/Magento_Wishlist/layout/catalog_product_view.xml

``````<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
</referenceBlock>
</body>
</page>
``````

``````<?php
/** @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"
name="qty"
id="qty"
min="0"
value="<?= \$block->getProductDefaultQty() * 1 ?>"
title="<?= \$block->escapeHtmlAttr(__('Qty')) ?>"
class="input-text qty"
data-validate="<?= \$block->escapeHtml(json_encode(\$block->getQuantityValidators())) ?>"
/>
</span>
</span>

</div>

</div>

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

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

## Is there a way to take user input (comments) using Microsoft flow "Email with Options" feature?

I have configured Microsoft flow on a task list item creation using “Send Mail with Options”. Different options that I have configured are “Approve” and “Deny”. It is working fine however I wonder if there is a way to take user input (comments) as mandatory when user clicks on “Deny” option in mail.

## Fixed physics time step and input lag

Everywhere I read says I should fix the time step of my physics simulation, and interpolate the result to the actual frame rate of my graphics. This helps with simplicity, networking, reproducibility, numerical stability, etc.

But as I understand it, fixed time step guarantees between 1 and 2 Δt of input lag, because you have to calculate one step ahead in order to interpolate. If I use 90 Hz physics, it gives me an input lag of about 17 ms, on average.

Since I often see gaming enthusiasts talking about 1 ms input lag, 1 ms delay, and how that makes a difference, I wonder how fast-action games does it, and how they reduce the input lag using fixed time step.

Or they don’t, and 1 ms delay is just marketing mumbo jumbo?

## protocol – Can a Bitcoin transaction have the same address for input and output?

At the protocol level, there is no such thing as “balance of an address”. There are individual unspent outputs (like coins in a wallet), which must be individually spent. You can’t partially spend an output, but you can split/combine it.

So for example, you have a 70 BTC output assigned to an address, and a 80 BTC output assigned to the same address. Some software will show this as 150 BTC balance of that address, but you still need to know the individual outputs to spend them. If you want to send 100 BTC to someone, you would consume those two outputs in a transaction, and create two new outputs using it, a 100 BTC one (to the recipient) and a 50 BTC one (back to yourself).

Whether you use a new address for that 50 BTC “change” output doesn’t matter to the protocol. You can reuse the old one, but will make it obvious to everyone in the world which who was the sender and who was the recipient in the transaction. Using a fresh address improves privacy.

Seen otherwise: reusing the same address may look convenient, as it allows you (and software you use) to more easily distinguish what your balance is, but it does this at the cost of making it obvious to everyone in the world. This hurts Bitcoin’s privacy – not just yours, but that of everyone in the system.

## memory – How does one completely scrub everything saved from notebook input into system so that a new evaluation of a notebook starts fresh?

I tend to code in small chunks before putting it all together into a larger sum that does a lot more. In doing so I often need to erase or delete as much as possible from memory and cache (including all symbols and messages) so that I can do a fresh new `Evaluation` of a `Notebook` without hidden definitions, bugs, etc. corrupting my work. Here is what I usually do.

``````FrontEndExecute(FrontEndToken("DeleteGeneratedCells"))
ClearAll("Global`*")
Remove(list of symbols)
ClearSystemCache("Symbolic")
``````

For context I am only running Mathematica locally. Am I doing this correctly? Should I do more? Should I do less? Is any of this redundant? How would you scrub the entire system so you have a completely fresh start every time you do an `Evaluation`?