forms – What is the best practise for a Search button state – should we always keep search button active or make it active after user inputs?

If a user can start search without any text input, they need to receive some meaningful results. It can actually be a feature: maybe your user doesn’t know what to type in, but you think you have something to offer them anyway. Show them your hot offers, suggest something based on your knowledge about user.

There was a conception of “zen search” when you don’t type anything, but get some random results after clicking [Search].

This is not a direct answer to your question, but maybe it can solve your problem. Your button can be always available and always working. No need to disable it. Just show people something good.

theming – How to add class to all text inputs in Drupal 8?

You can do it using template_preprocess_form_element something like:

use DrupalComponentUtilityHtml;
function (YOURTHEME)_preprocess_form_element(&$variables) {
  $input_types = ('search', 'textfield', 'password');
  $type = $variables('element')('#type') ?? NULL;
  if (in_array($type, $input_types)) {
    $variables('element')('#attributes')('class')() = Html::cleanCssIdentifier('form__text');
  }
}

Update
If the below doesn’t work try the following using hook_preprocess:

/**
 * Implements hook_preprocess().
 */
function (YOURTHEME)_preprocess(&$variables, $hook) {
  if ($hook == 'input') {
    $variables('attributes')('class')() = Html::cleanCssIdentifier('form__text');
  }
}

cryptography – Making complex boolean circuits that give true as output only for a specific combination of boolean inputs

This is my first question on a stack exchange website so please bear with me.
I am making challenges for a jeopardy style capture the flag event in my college and I had come across the minetest challenge in the hardware section of google CTF qualifier conducted last year. A clean and organized solution to this problem has been provided by liveoverflow.

I would like to design a simpler version of this problem for my college’s CTF event but I am unable to design a complex circuit that gives true output only for a specific combination of inputs. I know that a circuit with this functionality is not very difficult to implement and just needs to represent the following logic:

trueinput1 AND trueinput2 AND ... NOT falseinput1 AND NOT falseinput2 ... 

However I want it to be vast and complicated so that participants cannot decode its functionality just by doing a visual analysis. Is there any technique to complicate the boolean logic above and to design a corresponding circuit that looks ugly even for a small number of inputs(32/64).

magento2 – Magento 2 – Password Inputs in the Admin Panel Can’t be Edited

I am using Magento 2.3.4 with the Solwin FreeGo theme and all of my password inputs in the admin panel look like the below image. Even if I force them to a specific height, I still can’t access the field to change the data.

enter image description here

I thought it might’ve been an extension but I disabled all of them that could potentially cause this to happen then cleaned the cache. No change. I did find that a particular CSS rule that explicitly declares ‘inherit’ for the font does allow it to render out properly but I shouldn’t have to use the element inspector for this.

List of enabled modules:
MSP_ReCaptcha
AuthorizeNet_Core
AuthorizeNet_Centinel
AuthorizeNet_CreditCard
AuthorizeNet_ECheck
AuthorizeNet_PayPalExpress
AuthorizeNet_VisaCheckout
AuthorizeNet_Webhooks
BitExpert_ForceCustomerLogin
MSP_TwoFactorAuth
Custom_RestrictEmails
Solwin_Breadcrumbs
Solwin_Core
Solwin_Cpanel
Solwin_ScrolltoTop
Solwin_Soldout
Taxjar_SalesTax

List of disabled modules:
Amazon_Core
Amazon_Login
Amazon_Payment
Dotdigitalgroup_Email
Dotdigitalgroup_Chat
Klarna_Core
Klarna_Ordermanagement
Klarna_Kp
Temando_Shipping
Vertex_Tax
Vertex_AddressValidation
Yotpo_Yotpo

Those are the non-Magento modules I have installed and disabled.

What would cause the password fields to behave this way? It isn’t one browser either. I tried Firefox and Chrome, and both resulted in the same thing.

Design inputs for XML based java application

I have a java application which basically has to do 1 thing.
Read a large xml, extract information from it, and send the information to another system but in a different xml format.

Earlier we were using jaxb to convert it to a relational database and then use jaxb again to convert it to the desired xml, but given the increasing size of the XMLs, we have to implement a fragmented reading approach using a combination of sax parsing and jaxb so that the memory usage stays within the accepted limits.
But this has slowed down the application considerably. I know there are always tradeoffs, but could anyone please provide any design inputs on the below:

Would it make sense to

  • use something like an XML database instead of the relational one
  • store the xml as is and instead use apache Lucene or Solr to index it and make it searchable

Any other recommendations are welcome. Please let me know if any more information is needed.

html – Stacked inputs with rows using flexbox

.stacked-inputs,
.stacked-inputs .row {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-flow: row wrap;
    flex-flow: row wrap;
    -ms-flex-align: center;
    align-items: center;
}
.stacked-inputs .row {
    width: 100%;
    margin-bottom: 10px;
}
.stacked-inputs > input,
.stacked-inputs .row > input {
    position: relative;
    -ms-flex: 1 1 0%;
    flex: 1 1 0%;
    min-width: 0;
}
<div class="stacked-inputs">
  <input type="text" placeholder="First name">
  <input type="text" placeholder="Last name">
</div>

<br /><br />

<div class="stacked-inputs">
  <div class="row">
    <input type="text" placeholder="First name">
    <input type="text" placeholder="Last name">
  </div>
  <div class="row">
    <input type="text" placeholder="Job title">
    <input type="text" placeholder="Year started">
  </div>
</div>

multi signature – What are the sizes of single-sig and 2-of-3 multisig taproot inputs?

Everything below is best effort. Corrections welcome!

Taproot generally has two ways of spending. The default way is to spend the output using the key path: pay-to-taproot then behaves like a p2pk output except that it is using a schnorr signature and the corresponding address being encoded using bech32.

The alternative is to reveal that the inner key was tweaked with the root of a Merkle tree, the Merkel path to one of the leafs, and the arbitrary segwit v1 script contained in the leaf, and then to fulfill the spending conditions of this script.

In the following, a 2-of-3 spending condition is split out into three 2-of-2 conditions:

2-of-{A, B, C} = (A && B) || (A && C) || (B && C)

The assumption is that two of the keys are hot while the third is a backup key for recovery. The default case of spending with the two hot keys is aggregated into the root path pubkey using MuSig. The other two spending conditions using the backup key are stored leaves of the tree. Two variants are explored: one where the backup key is capable of participating in MuSig signing, another that falls back to a simpler multisig scheme where signing is non-interactive e.g. because the backup key is airgapped and the multiple roundtrips required for MuSig are inconvenient.

* outpoint (txid:vout): 32+4vB
* scriptSig size: 1vB
* nSequence: 4vB
* num witness items: 1WU
* witness item size: 1WU
* signature: 64WU

32+4+1+4+(1+1+64)/4 = 57.5vB

Depth 0 control block:

  * Length of control block: 1WU
  * Header byte (script version, sign of output key): 1WU
  * Inner key of root key: 32WU
= 34WU

Depth 1 control block:

  * Length of control block: 1WU
  * Header byte: 1WU
  * Inner key of root key: 32WU
  * Hashing partner in tree: 32WU
= 66WU

Script path spend assuming 2-of-2 MuSig leaf

* script size: 1WU
* script "<pk> OP_CHECKSIG": 33+1WU
* Depth 1 Control block: 66WU

57.5+(1+34+66)/4 = 82.75vB

Leafs cannot do MuSig, construction with 2-of-2 OP_CHECKSIG:

* +2nd sig: 1+64WU
* script size: 1WU
* Script "<pk1> OP_CHECKSIGVERIFY <pk2> OP_CHECKSIG": 33+1+33+1=68WU
* Depth 1 Control block: 66WU

57.5+(1+64+1+68+1+1+32+32)/4 = 107.5vB 

Less inefficient construction for 2-of-2 OP_CHECKSIG

* +2nd sig: 1+64WU
* Length of script: 1WU
* Script "<pk1> OP_CHECKSIGVERIFY <pk2> OP_CHECKSIG 2 OP_EQUAL": 33+1+33+1+1+1=70WU
* Depth 1 Control block: 66WU

57.5+(1+64+1+70+66)/4 = 108vB

Less private, more costly variant with a single 2-of-3 leaf in lieu of two 2-of-2 leaves:

* +2nd sig: 1+64WU
* +1 empty witness item: 2WU
* Length of script: 1WU
* Script "<pk1> OP_CHECKSIG <pk2> OP_CHECKSIGADD <pk3> OP_CHECKSIGADD 2 OP_EQUAL": 33+1+33+1+33+1+2=104WU
* Depth 0 Control block:

57.5+(1+64+2+1+104+1+1+32)/4 = 109vB

complexity theory – If $B$ is worse than $A$ on some inputs, how do their worst-case time complexities compare?

You are given two algorithms $A$ and $B$, with worst-case time complexity $f_A(n)$ and $f_B(n)$, respectively.

Assume:

(i) For each $n$ there exists an input $x$ of size $n$ such that the number of steps of algorithm $A$ on $x$ is half the number of steps of $B$ on $x$.

(ii) $f_A(n) = Omega(h(n))$ for some positive function $h(n)$.

  • Is it possible that $f_B(n) = Omega(h(n))$
  • Is it necessary that $f_B(n) = Omega(h(n))$?

Explain your answers.

machine learning – How Joint Probability Distributions are used to solve the problem of missing inputs in Classification

With n input variables, we can now obtain all 2^n different classification functions needed for each possible set of missing inputs, but the computer program needs to learn only a single function describing the joint probability distribution.

This is page 98 of Ian Goodfellow’s Deep Learning Book. My confusion comes from how joint probability distributions are used to solve the problem of missing inputs. What are the random variables in this scenario? I don’t really understand the connection here so if someone could please elaborate that would be great.