text:
Inconsistency between expectation values via SparseHamiltonian and get_restricted_hamiltonian?

Suppose I have an OpenFermion InteractionOperator and I want to measure its energy on a FQE wave function.
It appears there are two routs to do this:

Convert the InteractionOperator to a FermionOperator and then to a FQE SparseHamiltonian (btw, it would be nice if there was a more direct way to do this)

Get the tensors from the InteractionOperator and feed them into FQE's get_restricted_hamiltonian()

Naively I would have thought that this should yield the same result, but this does not seem to be the case, not even in the HartreeFock state as the following "minimal" example shows (just to be sure I am also constructing the InteractionOperator in two different ways):
import fqe
import numpy as np
import openfermion as of

from openfermion.chem.molecular_data import spinorb_from_spatial

def integrals_to_coefficients(one_body_integrals, two_body_integrals):
    return spinorb_from_spatial(one_body_integrals, two_body_integrals/2)

nact = 2
nalpha = 1
nbeta = 1

core_energy = 0.12345134
one_body_integrals = np.array([[-1.37560394, -0.26984563],
                               [-0.26984563,  1.09725617]])
two_body_integrals = np.array([[[[-0.56763992,  0.24989089],
                                 [ 0.24989089, -0.50890225]],
                                [[ 0.24989089, -0.50890225],
                                 [ 0.45668102, -0.21692285]]],
                               [[[ 0.24989089,  0.45668102],
                                 [-0.50890225, -0.21692285]],
                                [[-0.50890225, -0.21692285],
                                 [-0.21692285, -1.23529049]]]])

# make InteractionOperator manually
one_body_coefficients, two_body_coefficients = integrals_to_coefficients(one_body_integrals, two_body_integrals)
interaction_operator1 = of.InteractionOperator(core_energy, one_body_coefficients, two_body_coefficients)

# make InteractionOperator via MolecularData
molecule = of.MolecularData(
    geometry=[['?', [0, 0, 0]]],
    basis='cc-pvdz',
    multiplicity=nalpha-nbeta+1,
)
molecule.n_orbitals = nact
molecule.n_qubits = 2 * molecule.n_orbitals
molecule.nuclear_repulsion = core_energy
molecule.one_body_integrals = one_body_integrals
molecule.two_body_integrals = two_body_integrals
interaction_operator2 = molecule.get_molecular_hamiltonian()

wfn = fqe.Wavefunction([[nalpha+nbeta, nalpha-nbeta, nact]])
wfn.set_wfn(strategy="hartree-fock")

for interaction_operator in [interaction_operator1, interaction_operator2]:
    # btw: Is there a better way to transform an InteractionOperator into a FermionOperator?
    fermion_operator = of.FermionOperator()
    for key in interaction_operator:
        fermion_operator += of.FermionOperator(key, interaction_operator[key])
    fermion_operator = fqe.hamiltonians.sparse_hamiltonian.SparseHamiltonian(fermion_operator)
    print("SparseHamiltonian energy:           ", wfn.expectationValue(fermion_operator))

    fermion_operator = fqe.get_restricted_hamiltonian(
        ([interaction_operator.one_body_tensor,
          interaction_operator.two_body_tensor]),
        e_0=interaction_operator.constant)
    print("get_restricted_hamiltonian() energy:", wfn.expectationValue(fermion_operator))

The output I get is:
SparseHamiltonian energy:            (-3.19539646+0j)
get_restricted_hamiltonian() energy: (1.26736786+0j)
SparseHamiltonian energy:            (-3.19539646+0j)
get_restricted_hamiltonian() energy: (1.26736786+0j)

Am I doing something wrong?

I believe that fqe.get_restricted_hamiltonian assumes that the input tensors are spin-free form (i.e., in this case (2,2) and (2,2,2,2) size). It appears that you are passing (4,4) and (4,4,4,4) sized arrays to this function. If you zero out the two body and pass one_body_integrals to get_restricted_hamiltonian, they'd agree.
Second, your two-body operator is not consistent.  This is the print out - the coefficient in front of 3^3^11 should be identical to two_body_integrals[1, 1, 0, 0]. It appears that for this particular term, there is a factor of 2 missing. Also your hamiltonian does not have some elements, for example, 3^ 0^ 3 0 element, which I find odd.
Further, due to symmetry, I'd imagine that 3^ 1^ 1 3 and 3^ 1^ 3 1 should be the same magnitude but different sign. Something is odd.
0.124945445 [3^ 0^ 0 1] +
0.22834051 [3^ 0^ 0 3] +
-0.254451125 [3^ 0^ 2 1] +
-0.108461425 [3^ 0^ 2 3] +
-0.26984563 [3^ 1] +
0.124945445 [3^ 1^ 1 1] +
0.22834051 [3^ 1^ 1 3] +
-0.254451125 [3^ 1^ 3 1] +
-0.108461425 [3^ 1^ 3 3] +
-0.254451125 [3^ 2^ 0 1] +
-0.108461425 [3^ 2^ 0 3] +
-0.108461425 [3^ 2^ 2 1] +
-0.617645245 [3^ 2^ 2 3] +
1.09725617 [3^ 3] +
-0.254451125 [3^ 3^ 1 1] +
-0.108461425 [3^ 3^ 1 3] +
-0.108461425 [3^ 3^ 3 1] +
-0.617645245 [3^ 3^ 3 3]
SparseHamiltonian energy:            (-3.3188478+0j)
[[[[-0.56763992  0.24989089]
   [ 0.24989089 -0.50890225]]

  [[ 0.24989089 -0.50890225]
   [ 0.45668102 -0.21692285]]]

 [[[ 0.24989089  0.45668102]
   [-0.50890225 -0.21692285]]

  [[-0.50890225 -0.21692285]
   [-0.21692285 -1.23529049]]]]
get_restricted_hamiltonian() energy: (-1.2179846899999998+0j)

Well, the docstring of get_restricted_hamiltonian and the  RestrictedHamiltonian suggests otherwise. Both talk about "tensors of Hamiltonian elements" and not integrals. OpenFermion uses the term "integrals" to refer to the spin-free/spatial form and "coefficients" to the tensors of numbers in front of the operators in a representation of a Hamiltonian as a polynomial of, e.g., fermionic operators.
I can confirm that if I set the two body integrals to zero and pass the integrals instead of the coefficients to  get_restricted_hamiltonian(), the numbers do agree.
If get_restricted_hamiltonian() really expects integrals, then may I suggest to make the terminology in the documentation of that function consistent with the one used in OpenFermion? And maybe a dimension check could be added?
Regardless of whether I pass integrals or coefficient tensors to get_restricted_hamiltonian(), I however still cannot get the result to agree with the one obtained via the InteractionOperator -> FermionOperator -> SparseHamiltonian path, as soon as the two body integrals/tensors are non-zero.
You seem to say that my Hamiltonians are not well formed. But (at least in the second example) they are generated with standard OpenFermion tools from integrals that, while random, should have all the symmetries also shared by real RHF integrals.
To exclude that the discrepancy I observe is caused by my integrals, I have now added tests with integrals generated by openfermion-pyscf and such from the FQE unittest_data and still see the same discrepancy:
import fqe
import numpy as np
import openfermion as of
import openfermionpyscf
from fqe.unittest_data import build_lih_data
from openfermion.chem.molecular_data import spinorb_from_spatial
from pyscf import scf

def integrals_to_coefficients(one_body_integrals, two_body_integrals):
    one_body_coefficients, two_body_coefficients = spinorb_from_spatial(one_body_integrals, two_body_integrals)
    return one_body_coefficients, two_body_coefficients/2

# random integrals
core_energy = 0.
one_body_integrals = np.array([[-1.37560394, -0.26984563],
                               [-0.26984563,  1.09725617]])
two_body_integrals = np.array([[[[-0.56763992,  0.24989089],
                                 [ 0.24989089, -0.50890225]],
                                [[ 0.24989089, -0.50890225],
                                 [ 0.45668102, -0.21692285]]],
                               [[[ 0.24989089,  0.45668102],
                                 [-0.50890225, -0.21692285]],
                                [[-0.50890225, -0.21692285],
                                 [-0.21692285, -1.23529049]]]])

# make InteractionOperator manually from random integrals
one_body_integrals1, two_body_integrals1 = one_body_integrals, two_body_integrals
one_body_coefficients1, two_body_coefficients1 = integrals_to_coefficients(one_body_integrals1, two_body_integrals1)
interaction_operator1 = of.InteractionOperator(core_energy, one_body_coefficients1, two_body_coefficients1)

# make InteractionOperator from random integrals via MolecularData
one_body_integrals2, two_body_integrals2 = one_body_integrals, two_body_integrals
molecule = of.MolecularData(
    geometry=[['?', [0, 0, 0]]],
    basis='cc-pvdz',
    multiplicity=1,
)
molecule.n_orbitals = one_body_integrals.shape[0]
molecule.n_qubits = 2 * molecule.n_orbitals
molecule.nuclear_repulsion = core_energy
molecule.one_body_integrals = one_body_integrals2
molecule.two_body_integrals = two_body_integrals2
interaction_operator2 = molecule.get_molecular_hamiltonian()

# make InteractionOperator with openfermionpyscf
geometry = [('Li', (0., 0., 0.)), ('H', (0., 0., 1.4))]
interaction_operator3 = openfermionpyscf.generate_molecular_hamiltonian(geometry, 'sto-3g', 1, 0, 2, 2)
one_body_integrals3, two_body_integrals3 = None, None

# make InteractionOperator from FQE unit test data
one_body_integrals4, two_body_integrals4, _ = build_lih_data.build_lih_data('energy')
molecule = of.MolecularData(
    geometry=[['?', [0, 0, 0]]],
    basis='cc-pvdz',
    multiplicity=1,
)
molecule.n_orbitals = one_body_integrals.shape[0]
molecule.n_qubits = 2 * molecule.n_orbitals
molecule.nuclear_repulsion = core_energy
molecule.one_body_integrals = one_body_integrals4
molecule.two_body_integrals = two_body_integrals4
interaction_operator4 = molecule.get_molecular_hamiltonian()

for nact, nalpha, nbeta, interaction_operator, one_body_integrals, two_body_integrals, description in [
        (2, 1, 1, interaction_operator1, one_body_integrals1, two_body_integrals1, "InteractionOperator manually from random integrals"),
        (2, 1, 1, interaction_operator2, one_body_integrals2, two_body_integrals2, "InteractionOperator from random integrals via MolecularData"),
        (2, 1, 1, interaction_operator3, one_body_integrals3, two_body_integrals3, "InteractionOperator with openfermionpyscf"),
        (6, 2, 2, interaction_operator4, one_body_integrals4, two_body_integrals4, "InteractionOperator from FQE unit test data:"),
]:

    print(description)
    wfn = fqe.Wavefunction([[nalpha+nbeta, nalpha-nbeta, nact]])
    wfn.set_wfn(strategy="hartree-fock")

    # calculate energy via the InteractionOperator->FermionOperator->SparseHamiltonian route:
    # btw: Is there a better way to transform an InteractionOperator into a FermionOperator?
    fermion_operator = of.FermionOperator()
    for key in interaction_operator:
        fermion_operator += of.FermionOperator(key, interaction_operator[key])
    fermion_operator = fqe.hamiltonians.sparse_hamiltonian.SparseHamiltonian(fermion_operator)
    print("  InteractionOperator->FermionOperator->SparseHamiltonian energy: ", wfn.expectationValue(fermion_operator))

    # calculate energy with get_restricted_hamiltonian():
    if one_body_integrals is not None:
        fermion_operator = fqe.get_restricted_hamiltonian(
            ([
                one_body_integrals,
                two_body_integrals,
            ]),
            e_0=interaction_operator.constant)
        print("  get_restricted_hamiltonian() energy (called with integrals):    ", wfn.expectationValue(fermion_operator))

    fermion_operator = fqe.get_restricted_hamiltonian(
        ([
            interaction_operator.one_body_tensor,
            interaction_operator.two_body_tensor,
        ]),
        e_0=interaction_operator.constant)
    print("  get_restricted_hamiltonian() energy (called with coeffs):       ", wfn.expectationValue(fermion_operator))

I get
InteractionOperator manually from random integrals
  InteractionOperator->FermionOperator->SparseHamiltonian energy:  (-3.3188478+0j)
  get_restricted_hamiltonian() energy (called with integrals):     (0.3152385+0j)
  get_restricted_hamiltonian() energy (called with coeffs):        (1.14391652+0j)
InteractionOperator from random integrals via MolecularData
  InteractionOperator->FermionOperator->SparseHamiltonian energy:  (-3.3188478+0j)
  get_restricted_hamiltonian() energy (called with integrals):     (0.3152385+0j)
  get_restricted_hamiltonian() energy (called with coeffs):        (1.14391652+0j)
InteractionOperator with openfermionpyscf
  InteractionOperator->FermionOperator->SparseHamiltonian energy:  (-7.860538661020691+0j)
  get_restricted_hamiltonian() energy (called with coeffs):        (-7.4798403623090595+0j)
InteractionOperator from FQE unit test data:
  InteractionOperator->FermionOperator->SparseHamiltonian energy:  (-13.178585813739+0j)
  get_restricted_hamiltonian() energy (called with integrals):     (-8.857341498221992+0j)
  get_restricted_hamiltonian() energy (called with coeffs):        (-12.421481015593002+0j)

but still think that the energy from InteractionOperator->FermionOperator->SparseHamiltonian should agree with either the value returned by get_restricted_hamiltonian() when called with integrals or when called with coefficients.

Regarding the first point, I will include the docstring update in the next commit to clarify that what's expected is a Hamiltonian tensor in a spin-free form.
Regarding the second, get_restricted_hamiltonian is correctly working (see below); therefore, I can only speculate that there is some inconsistency in your code, perhaps with regards to interacting with OpenFermion and/or FQE.
Nick @ncrubin -- could you take a look?
import numpy
import fqe
from fqe.wavefunction import Wavefunction
from fqe.unittest_data import build_lih_data

"""Checking total energy with LiH
"""
eref = -8.877719570384043
norb = 6
nalpha = 2
nbeta = 2
nele = nalpha + nbeta
h1e, h2e, lih_ground = build_lih_data.build_lih_data('energy')

elec_hamil = fqe.get_restricted_hamiltonian((h1e, h2e))
wfn = Wavefunction([[nele, nalpha - nbeta, norb]])
wfn.set_wfn(strategy='from_data',
            raw_data={(nele, nalpha - nbeta): lih_ground})

ecalc = wfn.expectationValue(elec_hamil)
print(ecalc)
print(eref)

which returns
(-8.87771957038547+0j)
-8.877719570384043

I can also reproduce the problem with a more minimal example starting from your code:
import numpy
import fqe
from fqe.wavefunction import Wavefunction
from fqe.unittest_data import build_lih_data
import openfermion as of

"""Checking total energy with LiH
"""
eref = -8.877719570384043+0j
norb = 6
nalpha = 2
nbeta = 2
nele = nalpha + nbeta
h1e, h2e, lih_ground = build_lih_data.build_lih_data('energy')

elec_hamil = fqe.get_restricted_hamiltonian((h1e, h2e), e_0=0.0)
print("elec_hamil", elec_hamil)
wfn = Wavefunction([[nele, nalpha - nbeta, norb]])
wfn.set_wfn(strategy='from_data',
            raw_data={(nele, nalpha - nbeta): lih_ground})

ecalc = wfn.expectationValue(elec_hamil)
print(ecalc)
print(eref)

# now we try to reach the same result via the InteractionOperator->FermionOperator->SparseHamiltonian route:
molecule = of.MolecularData(
    geometry=[['?', [0, 0, 0]]],
    basis='cc-pvdz',
    multiplicity=1,
)
molecule.n_orbitals = h1e.shape[0]
molecule.n_qubits = 2 * molecule.n_orbitals
molecule.nuclear_repulsion = 0.0
molecule.one_body_integrals = h1e
molecule.two_body_integrals = h2e
interaction_operator = molecule.get_molecular_hamiltonian()
fermion_operator = of.FermionOperator()
for key in interaction_operator:
    fermion_operator += of.FermionOperator(key, interaction_operator[key])
fermion_operator = fqe.hamiltonians.sparse_hamiltonian.SparseHamiltonian(fermion_operator)
ecalc2 = wfn.expectationValue(fermion_operator)
print(ecalc2)

assert numpy.isclose(ecalc, ecalc2)

Here, I think, the correctness of the integrals is beyond doubt and I am only using standard OpenFermion functions to convert the given integrals into an InteractionOperator. I really don't see where my code can explain the result that I am getting:
(-8.87771957038547+0j)
(-8.877719570384043+0j)
(-13.129513263353799+0j)
Traceback (most recent call last):
  File "fqe_test2.py", line 45, in <module>
    assert numpy.isclose(ecalc, ecalc2)
AssertionError

Thank you, this example is helpful!
To summarize the situation for others: there seems some inconsistency in the conversion process of numpy.ndarray->InteractionOperator->FermionOperator->SparseHamiltonian, and I have observed in the initial reply that the SparseHamiltonian object does not seem to be properly formed. The first two steps are implemented in OpenFermion (that I am not familiar with) and the third step is implemented in FQE. I can double-check the third step, should we narrow down the problem to this step.
I will first let Nick @ncrubin review this example to get his insights.

Great!
There are all sorts of subtleties here concerning tensor index ordering and subsystem ordering (both qubits and fermions) but from reading the examples (and the great overlap in developers of the two packages), my impression was that OpenFermion and FQE should use all the same conventions, which is why I am puzzled by the discrepancy described above.

@cvjjm Unfortunately, the default convention used in OpenFermion is not consistent with FQE (which was designed for efficiency).     I'll take a look at the examples and report back.

Just to add a little more to this:  The following code computes the energy from the cirq wave function and the Hamiltonian obtained from OF:
qubit_op = of.transforms.jordan_wigner(fermion_operator)
hamiltonian_mat = of.get_sparse_operator(qubit_op).toarray()
cirq_state = fqe.to_cirq(wfn)
ecalc3 = cirq_state.conj().T.dot(hamiltonian_mat @ cirq_state)
print(ecalc3)

The result is also -13.129513263353799+0j, i.e., in line with result from fqe.hamiltonians.sparse_hamiltonian.SparseHamiltonian but again different from the get_restricted_hamiltonian() result.
My suspicion thus was that the problem is caused by some difference in how qubits or orbitals are ordered during the jordan wigner transformation. I have some code that does JW in 'sequential' ordering and the qubit ordering of the resulting operator can be changed with with openfermion.transforms.reorder, which allowed me to check all four combinations of sequential and interleaved, but none of the four results agrees with get_restricted_hamiltonian():
(-13.129513263353813+0j)
(-13.135429661233069+0j)
(-7.592300238551463+0j)
(-7.59127391423463+0j)

I think I found the solution to the mystery here.
FQE seems to use "chemists' ordering" of the two electron integrals and conversion from OpenFermion convention (which uses "physicist's ordering" can be done by means of numpy.einsum('ijlk', -0.5 * h2e) (notice also the 0.5).
One can thus go back from FQE convention to OF convention by means of numpy.einsum('ijlk', -2 * h2e). Passing two electron integrals treated in this way into the InteractionOperator->FermionOperator->SparseHamiltonian route yields energies that are consistent with the results from fqe.get_restricted_hamiltonian().
I wish this were documented somewhere, or even better that at least the packages from the same developers stick to the same conventions....

Hi @cvjjm , circling back to this in more detail today.  Indeed we provide the openfermion functions for interfacing the two Hamiltonian types.  You are right that ideally documentation on OpenFermion and FQE highlights (the very first page) integral formatting.  I will raise this as an issue and get someone to address it (myself or @jjgoings)   Indeed it would be nice if the ordering was the same for OpenFermion and FQE.  Just as a note, OpenFermion isn't even physics notation as I've traditionally seen it.  The OpenFermion convention is to use the pqrs ladder op indices as the tensor indices.  This is not the case in most quantum chemistry codes.
Another common way to build hamiltonians for FQE is to use the build_hamiltonian function.  We provide this as a high level interface that accepts FermionOperators and returns relevant Hamiltonians.  It is semi-smart and can recognize if you provide a general Hamiltonian, a quadratic Hamiltonian, or diagonal coulomb.   building a restricted hamiltonian using conversion from OpenFermion is the best option.
For example, augmenting your original code slightly
import numpy as np
import openfermion as of

from openfermion.chem.molecular_data import spinorb_from_spatial

def integrals_to_coefficients(one_body_integrals, two_body_integrals):
    return spinorb_from_spatial(one_body_integrals, two_body_integrals/2)

nact = 2
nalpha = 1
nbeta = 1

core_energy = 0.12345134
one_body_integrals = np.array([[-1.37560394, -0.26984563],
                               [-0.26984563,  1.09725617]])
two_body_integrals = np.array([[[[-0.56763992,  0.24989089],
                                 [ 0.24989089, -0.50890225]],
                                [[ 0.24989089, -0.50890225],
                                 [ 0.45668102, -0.21692285]]],
                               [[[ 0.24989089,  0.45668102],
                                 [-0.50890225, -0.21692285]],
                                [[-0.50890225, -0.21692285],
                                 [-0.21692285, -1.23529049]]]])

# make InteractionOperator manually
one_body_coefficients, two_body_coefficients = integrals_to_coefficients(one_body_integrals, two_body_integrals)
interaction_operator1 = of.InteractionOperator(core_energy, one_body_coefficients, two_body_coefficients)
fermion_operator1 = of.get_fermion_operator(interaction_operator1)
fqe_ham = fqe.build_hamiltonian(fermion_operator1, conserve_number=True,
                                norb=nact)

# make InteractionOperator via MolecularData
molecule = of.MolecularData(
    geometry=[['?', [0, 0, 0]]],
    basis='cc-pvdz',
    multiplicity=nalpha-nbeta+1,
)
molecule.n_orbitals = nact
molecule.n_qubits = 2 * molecule.n_orbitals
molecule.nuclear_repulsion = core_energy
molecule.one_body_integrals = one_body_integrals
molecule.two_body_integrals = two_body_integrals
interaction_operator2 = molecule.get_molecular_hamiltonian()

wfn = fqe.Wavefunction([[nalpha+nbeta, nalpha-nbeta, nact]])
wfn.set_wfn(strategy="hartree-fock")

for interaction_operator in [interaction_operator1, interaction_operator2]:
    # btw: Is there a better way to transform an InteractionOperator into a FermionOperator?
    fermion_operator = of.FermionOperator()
    for key in interaction_operator:
        fermion_operator += of.FermionOperator(key, interaction_operator[key])
    fermion_operator = fqe.hamiltonians.sparse_hamiltonian.SparseHamiltonian(fermion_operator)
    print("SparseHamiltonian energy:           ", wfn.expectationValue(fermion_operator))

    fermion_operator = fqe.get_restricted_hamiltonian(
        ([interaction_operator.one_body_tensor,
          interaction_operator.two_body_tensor]),
        e_0=interaction_operator.constant)
    print("get_restricted_hamiltonian() energy:", wfn.expectationValue(fermion_operator))

print("FQE Ham energy : ", wfn.expectationValue(fqe_ham).real)

Great! And thanks for making me aware of build_hamiltonian(). Feel free to close this issue or leave it open until the changes suggested above have been implemented.

I will leave it open until changes are made.  This is a good first issue for @jjgoings

authors: cvjjm ncrubin shiozaki

repo: quantumlib/OpenFermion-FQE


text:
Added IsingOperator

added IsingOperator class
refactored methods from QubitOperator to SymbolicOperator

Make sense.

Re the name, I was on the fence about "IsingOperator" for the exact reason you mention, though I found some literature that used the "Ising" descriptor to higher-locality diagonal terms. "DiagonalQubitOperator" seems fine, if a little long.
My original goal was to just have something like BinaryPolynomial but for {+1,-1}-valued variables rather than {0,1}-valued ones, then realized I could just exploit all the methods of SymbolicOperator (and, as you suggested, actually those of QubitOperator more specifically).
At this point, I don't have specific additional functionality I'd like to add to IsingOperator. The motivation was that it would be a flag to Cirq that would imply that its exponentiation is a diagonal unitary, and knowing that would simplify compilation.

I don't think we need this class unless it comes with some additional functionality. Besides, any code for compiling exponentials of QubitOperators should be smart enough to take full advantage of when the input consists of only Z's.

Re having it at all, of course any function that assumes or requires a diagonal QubitOperator could check its arguments, but over the course of a larger routine that adds up to a lot of unnecessary checks. With respect to efficiency and type checking, it seems better to have this class.
Re arithmetic between IsingOperator and QubitOperator, I'm not sure. On the one hand, it would be nice to have things behave as you said. On the other, in the use cases I'm imagining the user would only ever want to combine IsingOperators; arithmetic between QubitOperator and IsingOperator is more likely to be a mistake than intended, so it would be better to throw an error.

Okay I agree with you that we don't need to interact with QubitOperator. In that case, I think we should have a more specialized data structure. SymbolicOperator is really meant for situations in which there is more than one possible action. Since IsingOperator only has one kind of action, we don't need to store the action at all, but only the indices. As you mentioned, what we are really storing is a boolean polynomial, and implementing it that way will make it more convenient to add specialized functionality. For instance, we can have a method for evaluating the polynomial on a bitstring, and get_sparse_operator can probably be made faster than it would be if we used the QubitOperator machinery.
My current idea is to make this an independent class (not subclass SymbolicOperator) and store the terms in a dictionary with the keys being frozensets of indices.

The thing I like about subclassing SymbolicOperator is that then we can use all the string parsing and other functionality already implemented therefor. The only downside is carrying around all these extra 'Z's.

Why not just have an is_diagonal method on QubitOperator? I have a feeling that doesn't satisfy your needs, but I don't understand why.

A big problem I have with the current design is that isinstance(QubitOperator('Z0'), IsingOperator) will evaluate to False. I think that is very surprising behavior.

isinstance(1., int) also evaluates to False.

I think the main (maybe only) advantage of the IsingOperator class (regardless of whether it subclasses SymbolicOperator or QubitOperator) is that just by its type indicates that is_diagonal is True. What that avoids is having to execute is_diagonal over and over in a procedure in which it should never change.

Integers and floating point numbers have different internal representations. On the other hand, QubitOperator('Z0') and IsingOperator('Z0') have exactly the same internal representation, so it's surprising that they can behave differently.
Can you give an example of a procedure in which having IsingOperator around is helpful? What's the input and output of the procedure?

Kevin, you're quite the stickler! I think that perhaps the main utility of IsingOperator is just that people will recognize what it represents very easily whereas DiagonalOperator might be a bit obscure. I do think it worth having a couple use cases in mind before incorporating a new class like this though. In general we do want to avoid sprawl.

It is unfortunate how similar this is to DiagonalCoulombOperator. But its actually different because n_p n_q != Z_p Z_q (there are some local terms). Furthermore, DiagonalCoulombOperator would be an awful name for what you have in mind.
The thing is that QAOA does not really fit well within the scope of OpenFermion. We have something of a problem now (which we have been discussing) which is that certain classes like our variational framework (which is in OpenFermion-Cirq) and our QubitOperator class (which is in OpenFermion) are quite a bit more general. Its tempting to put them in Cirq but then these frameworks need to depend on Cirq, which is something we're also trying to avoid. I think we have a reasonable solution but cannot discuss publicly right now. In any event, the upshot of this is that I think having this class in OpenFermion is okay for now because there isn't really another good place to put it. But in the future I suspect we'll be moving it somewhere else (still open source of course).

@bryano that's a good point about the types. In any case, we haven't been enforcing that sort of thing here (e.g. the relationship between QuadraticHamiltonian and PolynomialTensor). I guess I'm okay with this, but I do think that ultimately we'll want a more specialized data structure to represent Z-type Hamiltonians.
Just address my comments. We can keep the name IsingOperator.

Any thoughts on which tests to leave in for IsingOperator? I just copied the ones for QubitOperator and modified as needed. That means they're all redundant in some sense, but we need to have at least some tests of IsingOperator explicitly for coverage.

To exercise the lines, you can use EqualsTester to test that, for instance, QubitOperator('Z0') is equal to IsingOperator('Z0'). I don't think you need to have any multiplication tests.

SymbolicOperator is now abstract; you'll have to take that into account.

Ooh sorry, I didn't realize you already addressed my comments; otherwise I would have merged this first...

What needs to change to take into account that SymbolicOperator is now abstract?

The four constants (actions, etc.,) are now abstract properties.

Done.

@bryano is this PR still active?

@babbush Sorry for letting this sit; ready for re-review.
@kevinsung I reverted to having IsingOperator directly subclass SymbolicOperator.

source: gharchive/pull-request

authors: babbush bryano kevinsung

repo: quantumlib/OpenFermion

license_type: permissive

license_source: bigquery


text:
Debug address sanitization crashes in github actions

Trying to figure out where the test address sanitization errors are coming from. Can't repro locally so doing it by pushing to this branch to trigger github actions.

Experimentation complete, workaround identified.

Oh, I see that there's like no granularity in choosing images so the workaround of using ubuntu-20 doesn't actually work when using C++20...

repo: quantumlib/Stim


text:
Modal: Is it possible to inject its own controller?

As the title suggests - with ui.bootstrap, you can inject a controller by specifying it upon initializing. I don't really see the same option with QuantumUI. Does it exist, and if so, how?
I know you can specify a controller through the view, however it doesn't allow me to interact with the modal itself (ex: self-close upon successful login).

+1

source: gharchive/issue

authors: Bartosh-s Taurvi

repo: quantumui/quantumui

license: mit


text:
Change usage of deprecated method in SqliteHibernateProcessor

Remove usage of deprecated constructor for future-proof upgrade of quarkus.

@gastaldi Hi George, need your help. What is changed and need to be fixed for new build?
fatal: ambiguous argument 'docs/modules/ROOT/pages/includes': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: pathspec 'docs/modules/ROOT/pages/includes' did not match any files
Error: Process completed with exit code 128.

@alexeysharandin your docs/ is missing some files. You can generate the extension structure by running quarkus create extension jdbc-sqlite and comparing the docs directory against yours

authors: alexeysharandin gastaldi magicDGS

repo: quarkiverse/quarkus-jdbc-sqlite

license_source: github-api


text:
Removed import that might cause compilation error due to ambiguity

Maybe we should also remove all imports from all the templates and qualify the classes on their usages.
WDYT @ricardozanini?

I think it's a good idea. Can you elaborate a little bit more in an issue, so we can have it documented?

I think it's a good idea. Can you elaborate a little bit more in an issue, so we can have it documented?

Issue created: https://github.com/quarkiverse/quarkus-openapi-generator/issues/103

@ricardozanini the PR description was not clear and might led you to misunderstand it.
Sorry for that.
I updated the PR description.

authors: hbelmiro ricardozanini

repo: quarkiverse/quarkus-openapi-generator


text:
[nextjs] Nodejs process doesn't stop

Describe the bug
I'm having a strange issue on windows. When I run dev mode, stop it, and then try to run it again, Next.js starts on a different port. I've found the cause, the node runtime isn't terminated when the app is stopped. If I try to access the original port, nothing is served, and I get a timeout, but the port remains blocked because the runtime is still running. I'm not sure if this can be fixed, as I don't know if it's possible to do anything if you stop dev mode.
Quinoa version
2.4.9
Quarkus version
3.13.2
Build / Runtime
Next.js
Package Manager
YARN
Steps to reproduce the behavior
Described above
Expected behavior
The nodejs runtime should be terminated and port should not be blocked.

OK it might be specific to Yarn?  I have not had any trouble with straight NPM on Windows and I use Quinoa a lot.
Can you put together a small reproducer showing the issue?

I have tested this directly from the command line (frankly, I could have done this before opening this issue) and it seems that if you execute mvn quarkus:dev and then stop it, it works and everything terminates perfectly fine. However, if you use IntelliJ and execute it through the UI or through 'Execute Maven Goal', it won't stop the process. I wonder if, when you stop it through IntelliJ, it doesn't terminate Maven gracefully but instead kills it, which would result in this behavior?

I am no expert on the IntelliJ plugin but you are right i am going to guess it some how shuts down differently than the command line.  Not sure where you report IntelliJ plugin issues but maybe on Quarkus Zulip channel to start to see what any of the devs say?  They might be able to guide you to the correct place.
I am going to close this as not a Quinoa issue for now...I can re-open if they report back that we aren't doing something correctly.

authors: melloware zZHorizonZz

repo: quarkiverse/quarkus-quinoa


text:
Fixed testing on linux jvm released version in daily.yaml

Summary
Noticed that there were not any tests in daily linux jvm released version so I decided to investigate and fix it
link to the daily test: https://github.com/quarkus-qe/quarkus-test-framework/actions/runs/10782729803/job/29903283110
Please check the relevant options

[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Dependency update
[ ] Refactoring
[ ] Release (follows conventions described in the RELEASE.md)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[ ] This change requires a documentation update
[ ] This change requires execution against OCP (use run tests phrase in comment)

Checklist:

[x] Example scenarios has been updated / added
[ ] Methods and classes used in PR scenarios are meaningful
[x] Commits are well encapsulated and follow the best practices

Let's not waste CI runners, I'll merge this after validation succeeds as CI is not testing anything.

authors: TimonCzech michalvavrik

repo: quarkus-qe/quarkus-test-framework


text:
Revert "Release 1.4.0.Beta3"

Reverts quarkus-qe/quarkus-test-framework#978 as update of Kafka utils turned out to be a bad decision. It is not possible to retrieve systemProperties from FW parent POM in the Quarkus QE TS

This wouldn't work (as release is out there already and next time we would try to release publishing would probably fail), in any case it is unnecessary, just tell dependabot to skip this verison. Thanks

authors: gtroitsk michalvavrik


text:
Fix #18 : registry file 기록시간 수정

docker restart시에도 이전 log들이 보내지지 않음을 확인.

원인
clean_inactive 시간이 너무 짧았다. -> registry file이 inactive_file에 대한 정보를 저장해놓는 시간.
registry file은 volume에 잘 저장되고 있었음.
차후 실제 프로젝트에서는 clean_inactive를 lotation 기간에 맞춰 정해줘야함.

close #18

license: MIT


text:
Request: add anyabs.com to the filter

Evidence: https://www.anyabs.com/questions/2905557.html
Original: https://stackoverflow.com/questions/63899040/how-to-reduce-stream-to-single-value-if-it-size-is-1-or-to-a-default-value-if-si

Thanks a lot!

authors: kegelink quenhus

repo: quenhus/uBlock-Origin-dev-filter

license: Unlicense


text:
Support for Hibernate @ColumnTransformer Annotation Processing

Hello,
I have a MySQL db and a table which contains some fields encrypted with AES via @ColumnTransformer. It seems to me that both JPAAnnotationProcessor and HibernateAnnotationProcessor does not take this into account so predicates that involve case sensitivity  such as equalsIgnoreCase() or containsIgnoreCase() are failing to perform the select on the decrypted values but rather on the gibberish.
Is there something I am missing or this is indeed not implemented yet?

Could you provide an example case? Also could you clarify which ColumnTransformer annotation you are refering to? Is it now standardized in JPA.
Querydsl JPA provides only a mapping to JPQL, and the ColumnTransformer should be utilized by the JPA provider for JPQL to SQL mapping.

Hello @timowest
So heres an example.
I have a got a Hibernate Entity like this:
@Entity
@Table(name = User.TABLE_NAME)
@AttributeOverride(name = BaseEntity.FIELD_NAME_ID, column = @Column(name = Employee.COLUMN_NAME_ID))
public class Employee extends User implements Serializable {
...
...
which has a field like that:
public static final String COLUMN_NAME_FIRSTNAME = User.FIELD_PREFIX + "FIRST_NAME";
@Column(name = COLUMN_NAME_FIRSTNAME, nullable = true)
@org.hibernate.annotations.ColumnTransformer(read = "AES_DECRYPT(" + COLUMN_NAME_FIRSTNAME + ", '" + Crypto.MY_KEY + "')", write = "AES_ENCRYPT(?, '" + Crypto.MY_KEY + "')")
private String firstName;
So the apt plugin generates my QEmployee which I am going to use in a BooleanExpression to build a QueryDSL Predicate to send to my employeeRepository.
So I would expect this to work:
this.userSearchExpression = this.userSearchExpression.and(QEmployee.employee.firstName.likeIgnoreCase(String.format("%s%s%s", PERCENTAGE, searchDTO.getFirstName(), PERCENTAGE));
likeIgnoreCase appears to lower the value of firstName before applying the like operation so I believe that the ColumnTransformer is invoked after the lower() so the encrypted text is getting modified and the query fails.
What do you think?

For your convenience, this is how my repository looks like:
@Transactional(readOnly = false)
public interface EmployeeRepository extends PagingAndSortingReadWriteRepository<Employee, Long>, QueryDslPredicateExecutor {
}

How did the rendered SQL look like?

2015-12-12 22:29:48 DEBUG o.h.s.i.ConcurrentStatisticsImpl:412 - HHH000117: HQL: select employee
from Employee employee
where employee.id is not null and employee.type in (:x1_0_, :x1_1_) and (lower(employee.firstName) like ?2 or employee.firstName like ?3 escape '!' or employee.lastName like ?2 escape '!' or employee.lastName like ?3 escape '!')
order by employee.id asc, time: 274ms, rows: 10
so essentially ignoreCase lowers it: lower(employee.firstName) like ?2 but given that it wont work for me I suspect that the column transformation takes place after the lowering?

this looks like the JPQL, how does the SQL look like?

On 13 Dec 2015, at 00:33, Stavros Lekkas notifications@github.com wrote:
2015-12-12 22:29:48 DEBUG o.h.s.i.ConcurrentStatisticsImpl:412 - HHH000117: HQL: select employee
from Employee employee
where employee.id is not null and employee.type in (:x1_0_, :x1_1_) and (lower(employee.firstName) like ?2 or employee.firstName like ?3 escape '!' or employee.lastName like ?2 escape '!' or employee.lastName like ?3 escape '!')
order by employee.id asc, time: 274ms, rows: 10
so essentially ignoreCase lowers it: lower(employee.firstName) like ?2 but given that it wont work for me I suspect that the column transformation takes place after the lowering?
—
Reply to this email directly or view it on GitHub.

lower(AES_DECRYPT(employee0_.USER_FIRST_NAME, @mykey)) like ?
If so something must be really wrong ...

But that looks's valid. At least your issues aren't caused by a missing transformation.

On 13 Dec 2015, at 15:28, Stavros Lekkas notifications@github.com wrote:
lower(AES_DECRYPT(employee0_.USER_FIRST_NAME, @mykey)) like ?
If so something must be really wrong ...
—
Reply to this email directly or view it on GitHub.

@timowest thanks a lot for helping out with this and please receive my apologies for the false alarm. You've been extremely helpful.

Ok, so likeIgnoreCase works?

It does. I just figured out what the problem was. the firstName is a varbinary in the DB. So I tried to do this:
@org.hibernate.annotations.ColumnTransformer(read = "CAST(AES_DECRYPT(" + COLUMN_NAME_FIRSTNAME + ", '" + Crypto.MY_KEY + "') AS CHAR)", write = "AES_ENCRYPT(?, '" + Crypto.MY_KEY + "')")
private String firstName;
but apparently QueryDSL added the table alias to CHAR so the query failed. Should I use StringTemplate on the StringExpression?

but apparently QueryDSL added the table alias to CHAR so the query failed.

What do you mean by that? I doubt that Querydsl added implicit casts.

Should I use StringTemplate on the StringExpression?

StringTemplate could be used for a cast if you don't get it sorted out otherwise. Does AES_DECRYPT also return a varbinary?

So If I change the ColumnTransformer to what it is above this SQL gets printed:
and (
lower(CAST(AES_DECRYPT(employee0_.USER_FIRST_NAME, Crypto.MY_KEY) AS employee0_.CHAR)) like ?
or lower(CAST(AES_DECRYPT(employee0_.USER_LAST_NAME, Crypto.MY_KEY) AS employee0_.CHAR)) like ?
)
Notice the alias prepended to CHAR. Yes it looks like that AES_DECRYPT returns varbinary. How could I possibly get along this?

If I set the firstName to byte[] I wont have much options to String comparisons on it for a search feature lets say.

This looks like a Hibernate bug https://forum.hibernate.org/viewtopic.php?f=1&t=1009635&view=next

Hi Guys, it seems I have the same issue and I could not find any reason why I can't see in the debug my sql
@timowest  Could you please help with it?

@timowest It seems I have found what I did wrong, but anyway I have come across with another issue.
I'm calling smth like ((cast(aes_decrypt(family,'1234567890123456') AS CHAR CHARACTER SET 'cp1251'))
but
The hibernate add extra to my transformation
Could you please advice how I can send exactly what I'd like to without extra addons
(cast(aes_decrypt(cliffio0_.family,
'1234567890123456')AS cliffio0_.CHAR cliffio0_.CHARACTER cliffio0_.SET 'cp1251') as family12_0_,
?
Thank you so much in advance.

@scyber This is an hibernate bug: HHH-8944. You can workaround it by using CAST(AES_DECRYPT(family, key) AS CHAR(LENGTH)).
Although CAST(TEXT AS CHAR) works directly, with hibernate it does not work till you add an specific length: i.e CHAR(128).
If you don't specify the CHARACTER SET, CAST will use your database defaults.

authors: codelirium lasneyx scyber timowest

repo: querydsl/querydsl


text:
🛑 Search Service is down

In aa44ff8, Search Service (https://quessttechnologies.com/search/healthcheck) was down:

HTTP code: 429
Response time: 34 ms

Resolved: Search Service is back up in 9ba2c7b after 12 minutes.


text:
UDP Buffer Size recommendation on Darwin errors out

I was trying to follow the recommendation here
But I get the following error:
sudo sysctl -w kern.ipc.maxsockbuf=8441037

kern.ipc.maxsockbuf: 8388608
sysctl: kern.ipc.maxsockbuf=8441037: Result too large

Setting it to the previously recommended amount of 2.5M doesn't error

Looks like a macOS problem, not a quic-go problem.

@marten-seemann thanks for replying. Could you elaborate a bit? Is this a macOS problem as in, the OS should be able to allocate this much memory, so I should investigate further why it doesn't, or is it just that I don't have that much memory to spare, so I should just do less? If it's the latter, how can I find out how much memory in my system can I allocate? And I guess the more I can allocate according to the recommendations, the better?

Works on my machine:
❯ sudo sysctl -w kern.ipc.maxsockbuf=8441037
kern.ipc.maxsockbuf: 8388608 -> 844103

And I guess the more I can allocate according to the recommendations, the better?

With diminishing returns. Beyond a certain value, there's little to be gained.

Could you elaborate a bit? Is this a macOS problem as in, the OS should be able to allocate this much memory, so I should investigate further why it doesn't, or is it just that I don't have that much memory to spare, so I should just do less?

I don't really know how the macOS kernel handles these allocations.

Got it, indeed, by default mine also comes with 8388608, so I'll keep it at that.
Appreciate you looking into this and your explanation of the gains. Closing

authors: marten-seemann mauromorales

repo: quic-go/quic-go


text:
[BUG] Controlnet models are providing noisy image outputs

Describe the bug
The controlnet pipeline is providing me noisy image output, in general it does its thing, but the quality of the image makes it unsable. Prompt: "photo, mid century modern, natural light, pink walls". See the input/output images below:
Input:

Outputs with various seed/guidance scale settings:

To Reproduce
Try to run the demo application with the following settings:

dpmsolver++ scheduler
23 or 35 steps
guidance scale 7.5 or 12.5
seed: between 1e7 - 1e10

I get this noise in every image, the image quality is nowhere compared to the original float controlnet model in here: https://github.com/AUTOMATIC1111/stable-diffusion-webui
Expected behavior
Have a comparable output with the original float controlnet model from here: https://github.com/Mikubill/sd-webui-controlnet
Something like this:

Host configuration:

OS and version: Win 11
QAI-Hub-Models version: latest controlnet

Am I missing something, shall I use another scheduler with different options or is there a better quantized model for controlnet?

nice find @kristoftunner
We will have to run this and get back to here with some analysis.

repo: quic/ai-hub-models


text:
dismissalObservable work fixed

Hello, I think that I realised what problem was about and fixed it in this pr.
This is from Apple's documentation:
      These four methods can be used in a view controller's appearance callbacks to determine if it is being
      presented, dismissed, or added or removed as a child view controller. For example, a view controller can
      check if it is disappearing because it was dismissed or popped by asking itself in its viewWillDisappear:
      method by checking the expression ([self isBeingDismissed] || [self isMovingFromParentViewController]).

Hey - thanks for the help! Since we removed RxCocoa as a dependency from XCoordinator, we now added the extension to the Extensions-section in the Example-app and adapted it according to your changes.

authors: Atimca pauljohanneskraft

repo: quickbirdstudios/RxCoordinator


text:
Update webhook push event handler.

Resolves #803.

Pull Request Test Coverage Report for Build 3219761850

0 of 26 (0.0%)  changed or added relevant lines in 1 file are covered.
1 unchanged line in 1 file lost coverage.
Overall coverage increased (+0.04%) to 27.488%

Changes Missing Coverage
Covered Lines
Changed/Added Lines
%

web/hooks/push.go
0
26
0.0%

Files with Coverage Reduction
New Missed Lines
%

web/hooks/push.go
1
0%

Totals

Change from base Build 3218209311:
0.04%

Covered Lines:
2983

Relevant Lines:
10852

💛  - Coveralls

repo: quickfeed/quickfeed


text:
osascript crash

I keep getting an osascript crash, parent process itunes. Quicksilver is the only app using osascript to control itunes so I'm wondering if this is a known bug or perhaps just started in the latest version.

What versions of macOS, iTunes, and Quicksilver (and the iTunes plug-in) are you running?
What commands are you sending to iTunes via Quicksilver?
For a long time now, Quicksilver has used Scripting Bridge to communicate with iTunes. While it uses the same underlying method as AppleScript (sending Apple Events), I don’t think that ever calls the osascript executable.

repo: quicksilver/Quicksilver


text:
Quicksilver 1.5.1(build 401C) can't startup on macOS Sierra

Thanks for all your hard work for the latest release of QS. However, after upgrading to version 1.5.1, it can't startup.

I have to turn back to version 1.4.2 :(
Any further information needed?

Hello. Can you try running 1.5.1 again, select it in Activity Monitor, and choose “Spindump” from the gear menu? The file might be a little large to paste here, but you can upload it somewhere and share the link or create a Gist. Thanks.

Hi, @skurfer
Sorry for the late reply, here is the gist of the "Spindump" log: https://gist.github.com/galeo/0e96e48f4c6e216d75abc445029007e8
Thanks.

Try this test build. It might fix the issue, but more likely just moves it to another spot. However, I’ve added some logging where I think the problem is, so hopefully we can narrow it down.
https://cl.ly/2e02333H1O33
If it still hangs, look in the Console app for messages from Quicksilver starting with “UT tag class” or “UTI for type string”. I’m hoping the last message it logs before it freezes will contain the string that’s confusing it.

I've just tried the test build version and It works well. It seems that the hang problem has been fixed.
Thanks so much.

OK. I’ll add the change I made to the app. Feel free to keep using the test build, but be aware that it might be a bit noisy in your logs.

I'm sorry, the hang problem occurred again.
Here is the last logs:
Jan  4 19:37:21 galeo-macbook Quicksilver[2405]: UTI for type string: QSObjectName
Jan  4 19:37:21 galeo-macbook Quicksilver[2405]: UT tag class: com.apple.ostype
Jan  4 19:37:22 galeo-macbook Quicksilver[2405]: UT tag class: public.filename-extension
Jan  4 19:37:22 galeo-macbook Quicksilver[2405]: UT tag class: public.mime-type
Jan  4 19:37:22 galeo-macbook Quicksilver[2405]: UT tag class: com.apple.nspboard-type
Jan  4 19:37:22 galeo-macbook Quicksilver[2405]: UTI for type string: QSLineReferenceType
Jan  4 19:37:22 galeo-macbook Quicksilver[2405]: UT tag class: com.apple.ostype
Jan  4 19:37:22 galeo-macbook Quicksilver[2405]: UT tag class: public.filename-extension
Jan  4 19:37:22 galeo-macbook Quicksilver[2405]: UT tag class: public.mime-type
... ...
Jan  4 19:37:45 galeo-macbook Quicksilver[2405]: UTI for type string: Apple URL pasteboard type
Jan  4 19:37:45 galeo-macbook Quicksilver[2405]: UT tag class: com.apple.ostype
Jan  4 19:37:45 galeo-macbook Quicksilver[2405]: UT tag class: public.filename-extension
Jan  4 19:37:45 galeo-macbook Quicksilver[2405]: UT tag class: public.mime-type

Give this a try. https://cl.ly/1O043N0o0W0W
It should be just a small executable. Save it somewhere and run it in Terminal. All it does is attempt to look up the MIME type for “Apple URL pasteboard type”, which seems to be where you’re getting stuck based on the above. I’m curious to see if the command hangs on your system.
On mine, it just outputs the result:
2017-01-11 08:31:48.193 types[29581:1391069] dyn.agq80c6durvwwa7pwruuha2pxsvw0e55bsmwca7d3sbwu

It outputs on mine, just the same with yours:
2017-01-11 21:51:01.393 types[4327:186900] dyn.agq80c6durvwwa7pwruuha2pxsvw0e55bsmwca7d3sbwu

I can’t say that I’m surprised, but I’m also not sure what to make of it. Based on the logs and the spin dump, that command should be doing the same thing QS gets stuck on. Of course, QS is trying to do it for multiple types rapid-fire.
Maybe your Launch Services database has some corruption? You can rebuild it by running
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Before you do something that drastic though, we should consider the possibility that Quicksilver’s getting hung in a different spot now. Feel free to try another spindump and we can check.

I rebuilt the Launch Services database and tried to launch the test build version of QS that given by you. It could startup the first time after reinstallation. However, when quit it and try to launch it again, it still hangs.
Here is the newer spindump gist: https://gist.github.com/galeo/335fb077d3ece4d98f43d65b9a92ce94
Thanks a lot.

Can you try to remove the cached indexes ? They are located under ~/Library/Caches/Quicksilver/Indexes.

Hi @tiennou,
It can't solve the problem by removing the cached indexes, the "QS" icon hangs at the center of screen.

Yeah, that was a shot in the dark, assuming that since it's stuck doing lots of UTI resolutions while loading indexes there could be something broken in there.
IIUC, after you reset the LS database, QS runs once, then on a subsequent run it hangs ?
@skurfer Could it be that manipulating UTIs cause us to corrupt our own "private" database in some way ? So the first time it runs, we declare all those UTIs, but the next time around since they already exist we get stuck on conformance tests ? It's a complete shot in the dark (again), but it's the first time I get to see LS underlying behavior so closely 😉 .

Give this test build a try and let me know if it’s any better. The version should show as “1.5.2:mine”.
https://cl.ly/0c3v0M031t3L

It immediately crashed after launching.
Here is the crash report:  https://gist.github.com/galeo/dad8bfdf8d944c7b05f91c2d0ef0af27

Sorry. A debugging setting snuck into the release build. See if this is any better.
https://cl.ly/420r2R0z3R3d

Sorry for the late reply. The test build version(1.5.2:mine) runs once, then it still hangs after relaunching.

This changes some of the behavior when reloading the catalog from disk after a relaunch.
https://cl.ly/0N3W180S2G45
Let me know if it’s any better.

It works OK now except that it's still not responding (high CPU consumption) for 10 seconds or so.
Thanks.

I was able to reproduce (and maybe fix) some of these delays. Try this: https://cl.ly/011O462y3r3C

authors: galeo skurfer tiennou


text:
Expire experiment picks when user hasn't been seen for 1 day

Only downloads outcome data when starting a new session
Uses quicktype to validate types when serializing to localStorage

Fixes #25

Not sure if we should manually store outcome data if our S3 cache headers also guarantee that we don't redownload outcomes too frequently.

repo: quicktype/autotune


text:
Readability of the investment table should be improved

I just opened the investment table and saw this :)

Before fixing it, this is maybe the right time to ask ourselves the questions:

Do we want to keep the investment table? It is now a super long unclear list with numbers.

If we want to keep it: how could we improve it? Which numbers are really relevant? How could we organise it better?

Please let me know your opinion :)
@AlexanderWirtz @ChaelKruip @jorisberkhout @redekok @MartLubben @DorinevanderVlies @michieldenhaan

This table is useful if you want to know which investments your scenario implies. To make it less long, we could investigate how to hide rows for which nothing has changed perhaps?

Maybe we can improve the translations/labels of the table somehow. Currently the translations are linked to the slider translations. For industry this means that 'gas heater' appears 8 times or so in table (one time for each subsector)

When somebody is going to update the investment table, could s/he also add the following greengas production technologies:

energy_biogas_fermentation_wet_biomass
energy_greengas_gasification_wet_biomass
energy_greengas_gasification_dry_biomass

Would anybody like to pick up this issue before the deploy? :)

I have assigned @michieldenhaan ! Reassign when needed

This table is useful if you want to know which investments your scenario implies. To make it less long, we could investigate how to hide rows for which nothing has changed perhaps?

@antw Would this be possible?

To make it less long, we could investigate how to hide rows for which nothing has changed perhaps?

@antw Would this be possible?

Sure. A day or two to create a custom table view would be needed.

To make it less long, we could investigate how to hide rows for which nothing has changed perhaps?

@antw Would this be possible?

Sure. A day or two to create a custom table view would be needed.

@ChaelKruip What are your thoughts on this?

@ChaelKruip What are your thoughts on this?

I like the idea to hide rows that show no info but I would like to be able to keep the total overview as well. Even the investments that are already present in the start-year can be interesting.
Also, I think this is low priority compared to actual bugs present in the model.

Also, I think this is low priority compared to actual bugs present in the model.

I agree! Closing this again.

authors: ChaelKruip antw marliekeverweij michieldenhaan redekok

repo: quintel/etmodel


text:
HNTP (Firefox) will not load from time to time except for settings button

Hey there & thanks for the extention but:
From time to time HNTP will turn blank except for the settings button. That is, no bookmarks will be shown on the New Tab page.

I am running Firefox 66.0.5 on MacOS High Sierra
After HNTP turns blank, if I restart Firefox, the browser freezes and then asks me to send a crash report upon closing... So I suspect there is a bug
This has been happening for several months several times a week, earlier Firefox versions included
I use HNTP for the New Tab only, I did not set it up as my Home Page (it is set to be blank).

Hope this helps, cheers.

Next time this happens, can you try pressing Command+Shift+J to open the console and let me know if there are any messages shown?

authors: antonsnotes quodroc

repo: quodroc/HumbleNewTabPage


text:
Mpi support

Related to qutip PR 2296.

I restarted all the CI builds in the hopes that the issues have been addressed in the relevant QuTiP branches.

I'm also okay with this PR being merged with the failing tests. We need to fix those as soon as possible, but not in this MR.

authors: hodgestar pmenczel

repo: qutip/qutip-tutorials


text:
🛑 Adguard Home DoT is down

In 2493ffb, Adguard Home DoT ($AG_DOT) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Adguard Home DoT is back up in b90e079.

repo: quyleanh/upptime


text:
🛑 Adguard Home DoT is down

In 68170fd, Adguard Home DoT ($AG_DOT) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Adguard Home DoT is back up in 47cd46e after 7 minutes.


text:
🛑 Adguard Home DoT is down

In a756e4e, Adguard Home DoT ($AG_DOT) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Adguard Home DoT is back up in 0a636f7 after 31 minutes.


text:
🛑 NextCloud is down

In 75b1194, NextCloud (https://cloud.qwq2333.top) was down:

HTTP code: 0
Response time: 0 ms

Resolved: NextCloud is back up in 972ec6b.


text:
🛑 Blog is down

In e2ca8e1, Blog (https://qwq2333.top) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Blog is back up in 7a0769c.


text:
creating a data structure.

A simple data structure for simple data processing, suitable for DE.  Added to unit test.

Why not NumPy's genfromtxt1 for data import?
# Code in the edgePy.io.Importer class could be replaced by
array = numpy.genfromtxt(filename, delimiter='\t', names=True)
header = array.dtype.names

This method will read the data into a contiguous block of typed memory. Supports gzip and bzip2 archives on-the-fly as input too.2

https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.genfromtxt.html#numpy.genfromtxt
https://docs.scipy.org/doc/numpy-1.13.0/user/basics.io.genfromtxt.html

authors: apfejes clintval

repo: r-bioinformatics/edgePy


text:
🛑 Home Assistant is down

In f998e6e, Home Assistant ($SECRET_SITE_HA) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Home Assistant is back up in ea7fd1d.


text:
sudden termination due to memory pressure while exporting

I changed the code to support 4k videos [ https://github.com/rFlex/SCRecorder/issues/254 ]. But now I'm the app terminates randomly due to memory pressure whenever I try to apply a filter and try to save the video. Without filter, I can save it without any crash. Here is the instrument data. swipeablefilterview is consuming too much of memory and system is terminating the app. What is the best way to fix this ?

Thank you

@bishtpradeep did you find a way to handle this ?

@wholeinsoul Did you get any solution?

authors: NileshKalathiya bishtpradeep janselr

repo: rFlex/SCRecorder


text:
Use argparse instead of using argv directly

The new PAC rebuild script is nice, but the error message you get when you don't provide the required argument is not.
Handle argument parsing in main with argparse, and call a function to do the work instead.
This will also allow easier extension in the future (for example: list SVDs, only build a subset of families)

Personally, I really like how click works. It's rather similar to rust's clap, in fact. Paired with rich, one can build some very nice TUI tools.

repo: ra-rs/ra


text:
blank page after build

so, when I perform all the tasks in the contributing.md file and successfully run grunt build, I fire brackets up with
brackets --port 3000 --proj-dir /workspace --supp-dir /workspace

and, with great excitement, I go to http://localhost:3000 ... I get ...
nothing

as in a blank page in the browser :(
what have I missed ?

I am trying to run in a docker container if that makes a difference .. do you have a working Dockerfile ?

Hmm yeah there is a problem with socket.io in container.  It's trying to
reach wrong URL. I will fix it tomorrow.
On Tue, 5 Jan 2016 at 23:57 jmls notifications@github.com wrote:

I am trying to run in a docker container if that makes a difference .. do
you have a working Dockerfile ?
—
Reply to this email directly or view it on GitHub
https://github.com/rabchev/brackets-server/issues/13#issuecomment-169146609
.

I'm close to resolve the issue with socket.io, but unfortunately I couldn't finish it today. I will continue tomorrow.
Sorry!

The issue is fixed. You can get the Dockerfile and brief explanation in README.md file in /docker/dev directory. Let me know if you encounter other issues.

authors: jmls rabchev

repo: rabchev/brackets-server


text:
Connect Books Store Api PR

In this pull request, I have:

[x] Made use of the Bookstore API as my backend.
[x] Used axios with createAsyncThunk to make HTTP requests to the backend.
[x] Fetch books from the Bookstore API after the component has rendered.
[x] Refactored code to persist changes in the server.

Thank you @AlphaNtihinduka,  I truly appreciate your time and efforts in reviewing my work,

repo: rachaouldbabaali/bookstore


text:
🛑 Pet Project is down

In fc16dff, Pet Project ($RINFO_SITE) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Pet Project is back up in 7adc59d.


text:
🛑 Pet Project is down

In 6c8cb82, Pet Project ($RINFO_SITE) was down:

HTTP code: 500
Response time: 4199 ms

Resolved: Pet Project is back up in dfde70d.


text:
Add method to return all headers

This is a request from issues #95

Thanks for your contribution @guillec! The project has unfortunately been abandoned for a few years, but we are back on track now and up to speed with reviewing PRs.
I will close this PR now since it's gone stale and needs a rebase. If/when you have time to do a rebase, you are very welcome to re-submit it again and we promise to take a closer look! 👍

authors: guillec perlun

repo: rack-test/rack-test


text:
 hash path in NodeJS

How can I get the Link component to generate href with # when rendering on the server?
https://github.com/rackt/react-router/blob/10359a50cc6df934a10dea581a8ac81eeff68efd/modules/createRouter.js#L235
The code seems to be checking for HashLocation, which is not available in Node.
Thanks.

#hashlinks

On the server you need to give the router a path.
Router.run(routes, req.path, callback)`

The links won't have hash the # in them.
http://jsbin.com/duyaxa/6/edit

But I want the link generated on the server to start with #.

If you have server rendering, use HistoryLocation in the client. Why would you want to use hashes?

I use HashLocarion on th client.
On Friday, February 6, 2015, Ryan Florence notifications@github.com wrote:

If you have server rendering, use HistoryLocation in the client. Why
would you want to use hashes?
—
Reply to this email directly or view it on GitHub
https://github.com/rackt/react-router/issues/779#issuecomment-73353227.

authors: ryanflorence trungpham

repo: rackt/react-router


text:
Research - Donator <> Donatee frameworks

Overview
https://www.blackbaud.co.uk/
The company below is software for charity
Apparently everyone uses them
Ideas
Look into their model of splitting funds and creating relationships between donators and donatees

https://www.siliconvalleycf.org/sites/default/files/publications/svcf-daf-brochure-2021.pdf

Hi. @bordumb I want to know more about this and how I can contribute.

Hi. @bordumb I want to know more about this and how I can contribute.

Hi @Victorybrown
Nothing concrete here.
But Radicle Drips launched the other week. It allows a "Community" to "split" incoming funds to other communities of their choice. So I can imagine this being useful infrastructure for some charity organizations.
This issue is mostly a reminder for myself to research a bit about the current financial infrastructure that charities are using in web2.
Are you interested in this topic?

authors: Victorybrown bordumb

repo: radicle-dev/radicle-grants


text:
https://github.com/radiumgame/sample-project MISSING [BUG]

** Describe Bug **
https://github.com/radiumgame/sample-project 404 error.
any chance of getting a copy?

We have shifted from projects to be cloned to use our new project manager. Checkout radiumgame/radium-project-manager and download the exec from the releases to get started.

authors: LandonHarter shntat

repo: radiumgame/radium


text:
🛑 Zon Application is down

In 5105144, Zon Application (https://www.zonapplication.com) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Zon Application is back up in 0c8e7b8.

repo: radiuszon/upptime


text:
Deprecate SlideMenuController and dependences

closes #532

Getting this Could not load the "account" image referenced from a nib in the bundle with identifier "com.decred.dcrios.testnet3" in the logs

authors: macsleven neddoz

repo: raedahgroup/dcrios

license: ISC


text:
Running LuaSnipListAvailable does not list react-es7 snippets

I recently migrated from vim-vsnip to LuaSnip. I am using friendly-snippets collections of snippets.
Today while coding a react project I noticed that snippets in javascript/react-es7.json are not listed amongst the completion items. I ran :LuaSnipListAvailable to cross check but these snippets were not loaded over there either.
Following are the relevant blocks from configuration
local cmp = require('cmp')
local luasnip = require('luasnip')

local has_words_before = function()
  local line, col = unpack(vim.api.nvim_win_get_cursor(0))
  return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end

cmp.setup({
  completion = { autocomplete = false, },

  snippet = {
    expand = function(args)
      luasnip.lsp_expand(args.body)
    end
  },

  mapping = {
    ['<C-p>'] = cmp.mapping.select_prev_item(),
    ['<C-n>'] = cmp.mapping.select_next_item(),
    ['<C-d>'] = cmp.mapping.scroll_docs(-4),
    ['<C-f>'] = cmp.mapping.scroll_docs(4),
    ['<C-Space>'] = cmp.mapping.complete(),
    ['<C-e>'] = cmp.mapping.close(),
    ['<CR>'] = cmp.mapping.confirm({
      behavior = cmp.ConfirmBehavior.Insert,
      select = true,
    }),

    ["<Tab>"] = cmp.mapping(function(fallback)
      if cmp.visible() then
        cmp.select_next_item()
      elseif luasnip.expand_or_jumpable() then
        luasnip.expand_or_jump()
      elseif has_words_before() then
        cmp.complete()
      else
        fallback()
      end
    end, { "i", "s" }),

    ["<S-Tab>"] = cmp.mapping(function(fallback)
      if cmp.visible() then
        cmp.select_prev_item()
      elseif luasnip.jumpable(-1) then
        luasnip.jump(-1)
      else
        fallback()
      end
    end, { "i", "s" }),
  },

  sources = cmp.config.sources({
    { name = 'nvim_lsp' },
    { name = 'luasnip' },
  }, {
    { name = 'buffer' },
    { name = 'path' },
  }),
})

luasnip.filetype_extend("javascript", { "javascriptreact" })
luasnip.filetype_extend("javascript", { "html" })

require("luasnip.loaders.from_vscode").lazy_load()

Please guide me on how to use react-es7 snippets thorough LuaSnip.

Hello @sisodiaa  !
You are on the right track with extending the file types.
The issue was due to an inconsistent naming of the file in the package.json and the actual file the snippets were stored in... which I missed during my code review on #164  ... however I merged #172 and if you resync your snippets they should be working correctly :sunglasses:
If you have any further issues though, let us know and we can reopen the issue and help further !

authors: OkelleyDevelopment sisodiaa

repo: rafamadriz/friendly-snippets


text:
Update usage of pretty_table to match v2

As in title. Allows merge of #48

Codecov Report

:exclamation: No coverage uploaded for pull request base (compathelper/new_version/2022-09-08-02-34-34-328-02406966953@d2ea771). Click here to learn what that means.
The diff coverage is n/a.

@@                                       Coverage Diff                                       @@
##             compathelper/new_version/2022-09-08-02-34-34-328-02406966953      #50   +/-   ##
===============================================================================================
  Coverage                                                                ?   79.76%
===============================================================================================
  Files                                                                   ?        3
  Lines                                                                   ?      173
  Branches                                                                ?        0
===============================================================================================
  Hits                                                                    ?      138
  Misses                                                                  ?       35
  Partials                                                                ?        0

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rafaqz any chance of a minor update released soon?

Sorry! I will now. I also just gave you moderator permissions.

Thanks!


text:
Test task number 1

Please add new file called hello.txt with "hello, world!" inside it.

See this PR https://github.com/ragnarlodbrok1992/DataScience-2024-04-practical-project/pull/2

Issue done!


text:
Deployed 0.4.0 on Goerli

In https://github.com/raiden-network/raiden/pull/3808 we found that the Raiden client expects the 0.4.0 deployment on the Goerli chain.  This commit adds that deployment.

@czepluch ah, I forgot etherscan.  Doing now.  Thanks.

Now I see etherscan_verify.py doesn't work with older versions. https://github.com/raiden-network/raiden-contracts/issues/864

This was a first step for https://github.com/raiden-network/raiden/issues/3819.

repo: raiden-network/raiden-contracts


text:
$('a').die('rails') not working

This is a problem described in https://github.com/rails/jquery-ujs/pull/29: I need to override the handlers bound by rails.js with my own functions in my application's application.js. The comments in that pull request indicate a
$('a').die('rails')
should do the trick. Only it doesn't. I've also tried it from the firebug console, and no luck. $('a').undelegate() and $('a').undelegate('rails') also don't work. Am I doing something wrong? Using jquery-ujs from head and jquery 1.4.4. Basically every link with a "data-confirm" attribute keeps bringing up the rails.js confirmation dialog (which is the one I want to override).

I'm going to close this now, since this can be taken care of now by using the $.rails.linkClickSelector and formSubmitSelector css selectors.

authors: JangoSteve capitaomorte

repo: rails/jquery-ujs


text:
Use PostgreSQL 9.6

This pull request upgrades PostgreSQL version to 9.6.
ubuntu@rails-dev-box:~$ psql -d postgres
psql (9.6.1)
Type "help" for help.

postgres=# select version();
                                                 version
----------------------------------------------------------------------------------------------------------
 PostgreSQL 9.6.1 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413, 64-bit
(1 row)

postgres=#

Reference:

Apt - PostgreSQL wiki
I am using a non-LTS release of Ubuntu

This does not seem to be officially supported, see https://www.postgresql.org/download/linux/ubuntu/.
We try to keep this VM current, but not ahead of time. I think the dev box works just fine with whatever is current in the latest Ubuntu regarding databases. If someone is working on something specially targeted for 9.6 they can manually install it.

Understood. Thanks.

authors: fxn yahonda

repo: rails/rails-dev-box


text:
feat: add support for multiple rust binaries

This PR adds support for multiple binaries inside a rust project.

[x] Docs are updated if needed

In relation to https://github.com/railwayapp/nixpacks/issues/779

Thanks @pxseu ❤🫡

authors: JakeCooper pxseu

repo: railwayapp/nixpacks


text:
Migration to async/await left some undefined resolves

0.2.46 throws this error at startup:

ReferenceError: resolve is not defined
at [..]/node_modules/serverless-dynamodb/index.js:401:21

Looks like there's a couple of resolves left that don't exist anymore after migrating from Promise(resolve) style to async/await:
https://github.com/raisenational/serverless-dynamodb/compare/v0.2.45...v0.2.46#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346R401

Thanks so much for raising this, and for identifying the root cause of the problem!
Sorry for the disruption. I plan in future to convert this project to TypeScript and add better unit tests to catch future bugs like this (#8). I appreciate the annoyance problems in a library like this can cause.
I've raised #26 to fix this, which I'll likely merge and release soon. Would appreciate your review if you have time, and do let me know if the problem remains in the new version.

0.2.47 works without issues! Thanks for the quick fix.

authors: domdomegg juhana

repo: raisenational/serverless-dynamodb


text:
Use not by modal or popup

Is there a way to use the component not by modal or popup? Currently, i have a requirement to use the date select view inside web view, not by select inside popup.

You may try to use this plugin with some modifications, so that it fits your needs. But as is you can't use this plugin for your need.

authors: rajeshwarpatlolla zjhiphop

repo: rajeshwarpatlolla/ionic-datepicker


text:
Adding numeric and JSON as types

This is probably the next most common type.  I've kept the color blue not knowing what you'd want to do there.

Thanks!

pushed 1.26

repo: rakutentech/laravel-request-docs


text:
Review

Hmm eerste wat ik zo snel zie: Je main.js bevat nog best veel functies die aparte modules kunnen worden zoals fetchdata die je bijvoorbeeld in een module map utils of w/e kan zetten.
Er is een verschil tussen base url en endpoint url, je hebt 2x een const met de naam endpoint :)
De directe execute van getdata in main js is een beetje raar omdat je eerst de functie callt terwijl hij paar regels daar onder staat.
Je wilt eigenlijk dat een module of functie altijd iets returned, probeer op basis van return iets te doen :) als dat niet kan dan is het maar zo maar probeer het. Wellicht een idee om al je module in aparte mappen te zetten met een benaming zodat het logischer is.
Ik zie dat je soms let gebruikt terwijl je daar ook const kan gebruiken.

Thanks Rowin, hier ga ik zeker mee aan de slag! :)


text:
compose and composeWith have different signature

Looks like compose takes functions as an argument when composeWith takes an array of functions. This is pretty confusing and some convention would really make sense here.

You're right.  Perhaps it was a mistake to introduce composeWith with the array signature.  But the goal is after v1.0 to move pipe and compose to match this, and to stop shipping any variadic functions.
So the fix for now will probably be in documentation.  Are you interested in creating a PR to document this?  (It would probably involve changing the JSDoc for composeWith and pipeWith.)

May I ask why is that the goal?
What comes to documentation, the behaviour is already documented in the examples. Or did you mean documenting the goal to move everything to use array syntax in 1.0?

I meant simply a note that said something like, "Note that this is subtly different from the signature of compse.  composeWith accepts an array of functions, not a arguments object full of them."
It's very hard to document variadic functions properly.  I'm not yet proposing that we disallow variadic user functions, although I hope that such use-cases will be rare.  But I would like it if all Ramda functions had fixed arities; this to my mind makes it easier to think about them.  (It should also clean up some implementations.)

authors: CrossEye villesau

repo: ramda/ramda


text:
move deprecated isArrayLike to internal

https://github.com/ramda/ramda/pull/1877
This turned out to be a bit more involved than expected. If someone could take a quick glance would be appreciated!

FWIW _isArrayLike appears in docs for 0.24.0.

authors: buzzdecafe kedashoe


text:
remove R.__

This is the alternative to #746. I see no reason to provide R.__ if its value is and will always be undefined. R.__ will be undefined even after this change. ;)

... and just as I'm (reluctantly, I admit!) coming around to share the point of view you and @buzzdecafe were expressing in #746!  :question: :smiling_imp:

won't fight for it, but i prefer a sentinel object to undefined. Using undefined feels too magicky. I prefer the specificity of an object that is associated with particular behavior.

What's sort of winning me over is the notion that someone might want to use op on a function
:: a -> b -> c

where a === undefined is not actually an error.  I can't really come up with such a function right now that makes sense with op, but I'd rather this API not be tied to my failure of imagination.  So I'm voting for #746 in spite of my previous comments and even my current reluctance.

Closing in favour of #746

authors: CrossEye buzzdecafe davidchambers


text:
Upgraded PHP CodeSniffer to 3.3 and changed PSR-2 to PSR-12 in Travis

Fixes  #16

Thank you for contributing to this repository for #hacktoberfest! 🎉
You check your progress here: https://hacktoberfest.digitalocean.com

authors: freezy-sk ramsey

repo: ramsey/collection


text:
[V2 Feature Request] Allow Different Bar Types

It would be great to be able to chart and process different bar types besides just OHLC candles. Maybe make the code flexible enough to support the different bars. I'm specifically interested in Renko Bars.

I was actually thinking about this just now, I use crosse_above and crosse_below in my algos, but I'm interested in implementing Renko as well.
Any updates regarding this? Or does anyone has any recommendation as to which library can represent them if we pass OHLCV as a pandas dataframe?

authors: Corfucinas Sorcerysoft

repo: ranaroussi/qtpylib


text:
Add E2E test for ClusterClass

We need to add an E2E to test ClusterClass integration

closing in favor of https://github.com/rancher-sandbox/cluster-api-provider-rke2/issues/271


text:
After installing CISv2 on a hardened cluster, tests fail on running a hardened cis 1.5 rke scan

What kind of request is this (question/bug/enhancement/feature request): bug
Steps to reproduce (least amount of steps as possible):

Deploy a CIS 1.5 hardened cluster (all the necessary manual steps for hardening should be done)
Install CIS v2 app on the cluster
RUn a rke-profile-hardened scan on the cluster by creating a clusterScan
There are 2 failures in the run. - tests 5.1.5 or 5.3.2 fail
Run the manual steps of hardening on the cluster - related to namespaces.
RUn a rke-profile-hardened scan again
There are no failures.

Expected Result:
CIS scan hardened run on a hardened cluster (before installing the app) should result in no failures.
Question: Is this something we have to document ?
Other details that may be helpful:
Environment information

Rancher version (rancher/rancher/rancher/server image tag or shown bottom left in the UI): master-head - commit id: 8d9cedde93
Installation option (single install/HA): HA

Cluster information

Cluster type (Hosted/Infrastructure Provider/Custom/Imported): custom - 8 nodes - 3 etcd, 2 control and 3 worker nodes
Kubernetes version (use kubectl version):

1.18

Adding in following fixes while installing the rancher-cis-benchmark chart:
a) Added a post-install hook that patches the default serviceaccount of cis-operator-system namespace to add flag automountServiceAccountToken: false. This is needed to pass cis 1.5 test 5.1.5 that breaks after creating the new cis-operator-system namespace as part of chart install.
b) Apply a basic network policy to the cis-operator-system namespace that is needed to pass cis-1.5 test 5.3.2

https://github.com/rancher/charts/pull/664

On master-head - commit id: 8fd81a9b4

CIS benchmark chart image

image:
  cisoperator:
    repository: rancher/cis-operator
    tag: v0.0.6
  securityScan:
    repository: rancher/security-scan
    tag: v0.2.0
  sonobuoy:
    repository: rancher/sonobuoy-sonobuoy
    tag: v0.16.3

two tests fail when a hardened scan is run on a CIS 1.5 hardened cluster. - tests - 5.1.5 and 5.3.2 fail

Reopening the issue

Logged issue for tests 5.1.5 and 5.3.2 failing here - https://github.com/rancher/fleet/issues/94 and https://github.com/rancher/rancher/issues/29014

Fleet needs to pass the CIS scan because it's auto deployed in 2.5. For the other charts it will be post 2.5.

Note: CIS hardened cluster will only work for downstream clusters for 2.5.

So for Test 5.1.5, following are the namespaces for which the default service accounts do not have the automount flag false, causing it to fail:

"dashboard-shells"
"default"
"fleet-system"
"kube-system"

And for Test 5.3.2, following are the namespaces which do not have any network policy defined:

cattle-system

On latest master-head - commit id: 0ccce450

Deploy a CIS 1.5 hardened cluster.
Test 5.1.5 fails.
Script kubectl get serviceaccounts --all-namespaces -o json | jq -r '.items[] | select(.metadata.name=="default") | select((.automountServiceAccountToken == null) or (.automountServiceAccountToken == true))' | jq .metadata.namespace lists namespace fleet-system

On master-head - commit id:2229f5cd7

Deploy a CIS 1.5 hardened cluster. (verified both 1.19.2 and 1.18.9 k8s clusters)
Test 5.1.5 fails.
"fleet-system" fails and is resulted in the below script when run

kubectl get serviceaccounts --all-namespaces -o json | jq -r '.items[] | select(.metadata.name=="default") | select((.automountServiceAccountToken == null) or (.automountServiceAccountToken == true))' | jq .metadata.namespace

Reopening the issue

The reason is that the fleet-agent chart generated, has wrong image tag for the kubectl image the post-install hook uses.
https://github.com/rancher/fleet/issues/94

On master-head - commit id: ec04f7878

Deploy a cis 1.5 hardened cluster.
Run rke-profile-hardened scan on the cluster
No failures are seen

authors: deniseschannon maggieliu prachidamle sowmyav27

repo: rancher/cis-operator


text:
Can't change expected config file paths for custom scans

Hello,
I followed the rancher documentation  to create my custom benchmark since my config files where deployed at a custom path. After configuring the right paths the checks for the config files still failed.
I think it is related to the host and mount paths of the rke2-root in the security scan plugin config template which are hard-coded to /var/lib/rancher.
Because when I changed the expected config paths in the scan to custom paths under /var/lib/rancher, for example /var/lib/rancher/test/scheduler.conf, it works but for other custom paths, like /srv/scheduler.conf, it fails.
I of course always placed the files to the right place with the right permission to test the behavior of the scan.
A solution could be to provide a variable to overwrite the paths of the rke2-root in the security scan plugin config template.
Thanks in advance!

@mitulshah-suse , you can decide if this is an enhancement worth pursuing.

@esen-transporeon the rke2-root path is used by other benchmarks so if we provide a variable for this and somebody change it then other benchmarks will not work in expected way.
The thing which you wanted to do is to refer files from the config files which are not in /var/lib/rancher, you can do that by just adding /node prefix to the path of those files and refer them in the config.yaml of custom benchmark. Since the root volume of the node is mounted on /node path of the pod.
so as per your example if you have placed the file on the node at path /srv/scheduler.conf then you can use /node/srv/scheduler.conf in the config.yaml of you custom benchmark. Ref: L102 and 32 of security-scan plugin template

Thanks for the explanation. We decided to just use the default path to solve this problem but I can comprehend your solution. That would have probably worked that way. This Issue can be closed.

authors: MKlimuszka esen-transporeon vardhaman22


text:
Update logs command

This fix along with the fix to agent will get tail/lines working but additional work in cattle-server will be needed to get the rest of the options working.
https://github.com/rancher/rancher/issues/12924

LGTM

authors: StrongMonkey dramich

repo: rancher/cli


text:
[backport 2.9.5] AKS: Unable to upgrade Nodepool's k8s version

Setup
Rancher: v2.9-eaafb03a1ed78475258b7523b514168a8d9c8367-head
Dashboard: release-2.9 c2c221a
Describe the bug
Unable to upgrade Nodepool kubernetes version. "A new cluster version has been selected. Once the upgrade has completed, you can come back and upgrade the node pool version" warning is not getting cleared.
To Reproduce

Provision AKS cluster from Rancher UI
Upgrade control plane version to new one, valid warning is displayed for Nodepool
Once the upgrade is finished, edit cluster and try upgrading Nodepool

Screenshots
2.9-head:

2.9.3 (as expected):

/forwardport v2.10.1

Rancher version: v2.9-811aaa845e17942c94458af87efb4083bee532d2-head
UI version: release-2.9 0a69edb
The same scenarios from 2.10 were executed to validate the fix in this version 2.11

I used an AKS hosted cluster with multiple node pools.
Selecting a newer k8s version shows the info box as expected regarding the pools update option after update.
If I select the current version back, the info box is hidden as expected.
I did two version bumps:

Update Kubernetes version. Save
Wait until the checkbox is visible in the Edit view.
Checked that multiple nodepools have this checkbox visible.
Update Pool A and save. Wait for update.
Go to edit again after waiting for the upgrade, Pool A is upgraded to the current kubernetes version. The checkbox is hidden.
Navigating to Pool B which is still not upgraded has the upgrade checkbox visible and information about the upgrade to version.
Check the box save and wait for Pool B to be upgraded.
All the pools match the kubernetes versions after the upgrade and going to edit.
Previous versions before the current in the Kubernetes versions dropdown are hidden

Next Scenario, version bump, repeat the above.

Closing as validated.

https://github.com/rancher/rancher/issues/48401

authors: cpinjani izaac richard-cox skanakal

repo: rancher/dashboard


text:
[harvester] harvester dashboard -> embedded grafana page shows no data, incorrect link is embedded

Setup

Rancher version: v2.6-head (0dd1ce6)
Browser type & version: chrome

Describe the bug

embedded grafana page on the harvester dashboard works through harvester, but not on rancher on the imported harvester cluster.
To Reproduce

deploy harvester setup
in rancher, import the harvester setup through virtualization management
after importing, navigate to the harvester dashboard through rancher

Result

grafana shows no data for all fields. Grafana link also shows no data

Expected Result
Grafana should show proper data through rancher
link should be to /proxy/d/rancher-cluster-nodes-1/rancher-cluster-nodes?orgId=1&from=now-5m&to=now&refresh=30s&theme=dark (pullled from the harvester grafana URL) instead of to what it is currently set to, /proxy/d/harvester-vm-dashboard-1/harvester-vm-dashboard?orgId=1&from=now-5m&to=now&refresh=30s&theme=dark
additional context
Here is the harvester feature targeted for 0.3.0

should be addressed via https://github.com/rancher/dashboard/pull/4285

Pending on PR https://github.com/rancher/dashboard/pull/4285

authors: guangbochen slickwarren yasker


text:
Force registration update on boot

Follow up of #471, to address @davidcassany 's comment.
We implemented a (not modifiable yet) 24 hours timer to update the registration information.
The elemental-register is triggered frequently (at every boot and every 30 minutes after that), however we are skipping updates if the last update was less than 24 hours ago.
Ideally we should run the registration update anyway at every boot, as we have most chances there to have information to update (for example a new device being attached, a new IP address, etc.).
Even more ideally I'd say we should trigger registration update frequently, but only perform it if we have changes to push.
For this reason I propose we extend the registration state to act as a cache and we force an update any time we actually have changes. This should minimize transactions, we can get rid of the 24 hours timer completely, and rely on systemd timer triggering an attempt at boot and every 30 minutes, should suffice for most use cases.
From @davidcassany other two options come to mind to force updates on boot:

We could have a sentinel file that is created on an ephemeral location to validate if this is a reboot or not.
We could add an  --install flag in elemental-register to run the installation or not. So the flag is only applied when running from the ISO (still need to figureout how, but there are ways) and this flag is never applied to the service that runs on an installed system. This way the timer can be directly over 24h.

Most likely the initial comment is out of date.
What we can still do here however is to add configuration arguments in the MachineRegistration to configure the re-registration behavior. For example enabled flag and a timer setting.

this is done

authors: anmazzotti kkaempf

repo: rancher/elemental-operator


text:
Kubewarden policy to validate cosign images

In order to validate images used for upgrades in kubernetes, we can have a kubewarden policy to validate cosign images and prevent upgrades from being pulled and hitting nodes.
Ping Kubewarden team to see if they have already a policy for it and we can just re-use it (and document it)
Action Items

[x]  See if there is a Kubewarden policy for validating cosign-ed images and see if fits our case, or either create a new one.
[ ] QA and check if fits our scenarios
[ ] Update our documentation with a practical example of building an image, signing it, and upgrading it in kubernetes with the kubewarden policy. Showing off also how an unsigned one would fail miserably in upgrading is a plus!

I've pinged the kubewarden team as I could not find any policy for cosign in https://hub.kubewarden.io/, if that's the case we should implement our own policy

I've checked in with @flavio and at the moment this doesn't seems to be technically possible with Kubewarden but it's in the roadmap.
Let's postpone this as there is no pressure for it right now, in the case we need a temporary solution we can write a custom admission controller for the purpose and replace it later with a kubewarden policy.

This seems to be possible now

This is the kubewarden policy that implements image verification: https://github.com/kubewarden/verify-image-signatures
Feel free to reach out if something is missing or if you want to propose improvements

From a preliminar test the policy seems sufficent as it is gating upgrades. I'm checking out now if I can make an upgrade going through it and documenting all the steps.

Seems to be fixed upstream now, having a look at it again

The DNS resolution failure seems weird to be fair. I wonder if it is a fluke.
We just released v0.1.5 of the policy. It has a new github_actions signature setting, that is more secure (prevents about attackers consuming GHA reusable workflows and passing signatures as them) and also simpler to use (upcoming blog post in kubewarden.io/blog)
apiVersion: policies.kubewarden.io/v1alpha2
kind: ClusterAdmissionPolicy
metadata:
  name: verify-image-signatures-policy
spec:
  module: registry://ghcr.io/kubewarden/policies/verify-image-signatures:v0.1.5
  rules:
  - apiGroups: [""]
    apiVersions: ["v1"]
    resources: ["pods"]
    operations:
    - CREATE
    - UPDATE
  mutating: true
  settings:
    signatures:
        - image: "*"
          github_actions:
              owner: "c3os-io"
              repo: "c3os" # optional

The second error, the mutation one, may have been because the ClusterAdmissionPolicy was missing .spec.mutating: true.
By default, the policy will validate the container tag and by default mutate the container definition to append the digest of the verified tag (digests are immutable, tags are mutable).
If one doesn't want the policy to mutate, they can set .spec.settings.modifyImagesWithDigest: false (default is true), and then it is irrelevant if the policy has .spec.mutating: true.

Just tried with a different policy, and I get the dns error too:

2022-07-21T09:43:13.952451Z ERROR policy_server: error while downloading policy clusterwide-psp-capabilities from registry://ghcr.io/kubewarden/policies/psp-capabilities:v0.1.9: the policy registry://ghcr.io/kubewarden/policies/psp-capabilities:v0.1.9 could not be downloaded due to error: error sending request for url (https://ghcr.io/v2/): error trying to connect: dns error: failed to lookup address information: Try again

I will look into it.

The DNS error seems to be here because I started the cluster with VPN enabled, and then took it off (thanks to @raulcabello for the hint). I wonder if that was it too in your side @mudler.

Elemental-toolkit does not provide images anymore, closing this.

authors: flavio frelon mudler viccuad

repo: rancher/elemental-toolkit


text:
[FEATURE] Create nodes in parallel to reduce the cluster creation time

Scope of your request
I've been quickly walking through the code.
Currently, all the nodes are created sequentially, and one by one:

Init node, if any
Cluster nodes
Aux nodes

This increase the k3d cluster create time that impacts the UX.
Describe the solution you'd like
At least for the cluster nodes, there is a chance to create them in parallel which may potentially reduce the cluster creation time, without significant code changes required.
What do you think?

Hi @brightzheng100 , thanks for opening this issue!
You're absolutely right there. In fact, that's how we did it back in v3.x... but then it broke cluster restarts. While this mainly happened in HA setups, where the server nodes have to come up one-by-one, sequentially, so that etcd properly learns its cluster members, it also broke from time to time, when too many agents tried to register to the cluster.
Aux nodes currently only consist of the loadbalancer, which has to come up after all target nodes (which in turn depends on the flags a user passed in, so it's the "way of least magic required" to simply start it after all other nodes).
So the only thing we could bring back in is the concurrent creation of agent nodes to speed things up a bit. I think there's even a TODO item somewhere for this (among many others :grimacing:)

Thanks for sharing the background @iwilltry42
That's exactly what I'm thinking too: to some kind of nodes, the sequence may matter.
But in most of the cases, we're creating a cluster with 1 server, x agent nodes so the agent nodes may still slow down the overall creation process -- that's why I asked too whether we can build the agent nodes in parallel.
Maybe I can dive deeper into the code and potentially make it another small PR too:)
(yeah, I can imagine you're busy as the versioning in K3d is quite aggressive)

Enhancement implementing this will land in the next major release (v5.0.0) :+1:

versioning in K3d is quite aggressive

Is it too aggressive? :thinking:


text:
[Grammar] Welcome to k3OS! message

Version (k3OS / kernel)

k3os --version
k3os version v0.20.4-k3s1r0

Architecture

x86_64
Describe the bug

The welcome message doesn't seem grammatically correct.
To Reproduce

Open a terminal and see the welcome message.
Expected behavior

How about we say, "The default mode", instead of "By default mode..."?
Or it could say, "By default, k3OS is run as a single node cluster...".
Actual behavior

By default mode of k3OS is to run a single node cluster...

Additional context

N/A

"By default, the mode of k3OS is to run a single node cluster..."
or
"The default mode of k3OS is to run a single node cluster..."
Those would be the two grammatically correct options for clarification.


text:
website k3s.io/docs/ only placeholder

Is there any work on the https://k3s.io/docs/ ?
Currently only placeholders there "Lorem markdownum..."

Yeah, sorry. The website isn't really done, we accidentally published it to early.  But right now the README.md in this repo is the only real docs.

I'll leave this issue open until we publish proper docs on the website.

For now, we're going to keep docs in the readme in the repo.

authors: curx deniseschannon ibuildthecloud


text:
Start cgroups service in OpenRC script

cgroups init script is present in Alpine Linux since 3.8.
Fixes #660

Thank you very much @radhus!

authors: erikwilson radhus