## immutability – Is there a better method to implement an immutable double ended queue, that uses two single link lists internally for the dequeue using C++?

I am writing an immutable interpreter in C++ for fun. Originally standard vectors and dequeues were used to create a double ended queue data type, but it was very slow, because each operation require a whole new copy of the original container to be created.

So it was redone using a custom immutable single linked node lists which only requires a single node to be recreated during each operation on list like data types. And a double ended queue was implemented using two of these single linked lists. While it doesn’t require the whole data type and each element to be copied during each operation. It does require a limited recreation of the data type during dequeue operations to rebalance the two lists, which is expensive.

Is there a more efficient, and less copy expensive method, that could have been used to implement the double ended queue? Which does not require rebalancing the lists, and the original data still remains immutable during each operation.

``````class list {

let    _last;
int_t  _size;

public:

list();
list(const list& exp);
list(let exp);
virtual ~list();

friend str_t           __type__(const list& self);
friend bool_t            __is__(const list& self);
friend real_t          __comp__(const list& self, const let& other);
friend void             __str__(stream_t& out, const list& self);
friend void            __repr__(stream_t& out, const list& self);

friend int_t            __len__(const list& self);
friend let             __last__(const list& self);
friend let       __place_lead__(const list& self, const let& other);
friend let       __place_last__(const list& self, const let& other);
friend let       __shift_last__(const list& self);
friend let          __reverse__(const list& self);

private:
void  balance();
};

/********************************************************************************************/
//
//                               'list' Class Implimentation
//
/********************************************************************************************/

list::list() : _lead(__node__()), _last(__node__()), _size(0) {
}

}

list::list(let exp) : _lead(__node__()), _last(__node__()), _size(0) {

while (exp.is()) {

_size += 1;
}

balance();
}

list::~list() {
}

std::string __type__(const list& self) {
return "list";
}

bool_t __is__(const list& self) {

return true;
}

return false;
}

real_t __comp__(const list& self, const let& other) {

const list* e = other.cast<list>();

if (e) {

return 0.0;
}
}

return NOT_A_NUMBER;
}

void __str__(stream_t& out, const list& self) {

if (!__is__(self)) {
out << "()";
return;
}

out << "(";

if (self._last.is()) {

out << " ";
}

out << str(self._last.reverse());
}

out << ")";
}

void __repr__(stream_t& out, const list& self) {

if (!__is__(self)) {
out << "()";
return;
}

out << "(";

if (self._last.is()) {

out << " ";
}

out << repr(self._last.reverse());
}

out << ")";
}

int_t __len__(const list& self) {
return self._size;
}

}

}

let __last__(const list& self) {

if (!self._last.is()) {
}

}

let __place_lead__(const list& self, const let& other) {

if (other.is_nothing()) {
return self;
}

list e = self;

e._size += 1;

if (!e._last.is()) {
e.balance();
}

return e;
}

if (__len__(self) == 0) {
return self;
}

list e = self;

// Balance if _last has more than one element.
e.balance();
}
else {
return e;
}
}

e.balance();
}
}

return e;
}

let __place_last__(const list& self, const let& other) {

if (other.is_nothing()) {
return self;
}

list e = self;

e._size += 1;

e.balance();
}

return e;
}

let __shift_last__(const list& self) {

if (__len__(self) == 0) {
return self;
}

list e = self;

if (!e._last.is()) {

// Balance if _last has more than one element.
e.balance();
}
else {
return e;
}
}

if (!e._last.is()) {

e.balance();
}
}

return e;
}

let __reverse__(const list& self) {

if (__len__(self) < 2) {
return self;
}

list e;

e._size = self._size;

return e;
}

void list::balance() {

// print("lead = " + str(_lead) + " : last = " + str(_last));

bool_t flip = _last.is() && !_lead.is();

if (flip) {
}

int_t i = _size < 2 ? 1 : _size / 2;

_last = _last.reverse();

while (i --> 0) {

}

_last = _last.reverse();

if (flip) {
}
}
$$```$$
``````

## How do I change this sql query to Magento2 filter collection method?

I have below query

``````SELECT * FROM newsletter_subscriber WHERE change_status_at >=  (NOW() - INTERVAL 10 DAY);
``````

How do I make it works with below?

``````        public function  getSubscriberStatus()
{

\$subscriberCollectionData =\$this->subscriberCollection->create();

/***********************query where cause **************************/

foreach(\$subscriberCollectionData as \$subscriber)
{
print_r(\$subscriber->getData());
}

return \$subscriberCollectionData;
}
``````

Thanks!

## javascript – Consumindo API com Axios

alguém pode me ajudar, estou tentando consumir uma API só que está dando um erro.

Meu codigo:

``````    async function getCatalog() {
const catalog = await axios.get('https://appanimeplus.tk/api-animesbr-10.php?letra=')
}
getCatalog()

builder.defineCatalogHandler(async (args) => {
let {id, category_name, category_image} = await getCatalog()
let catalog = {
id: `\${id}`,
name: `\${category_name}`,
releaseInfo: '2008',
poster: `https://cdn.appanimeplus.tk/img/\${category_image}`,
posterShape: 'regular',
banner: 'https://image.tmdb.org/t/p/original/aHLST0g8sOE1ixCxRDgM35SKwwp.jpg',
type: 'series'
}
console.log(catalog)
return Promise.resolve({ metas: (catalog) });
})
``````

Segue erro: `TypeError: Cannot destructure property 'id' of '(intermediate value)' as it is undefined.`

## dnd 5e – Does Globe of Invunerability stop the Catapult spell?

What a cool way around Globe of Invulnerability! I’m imaging a mighty spellcaster monologuing to his foes “Your spells are useless against my might!” only to be pegged in the face by a flying tchotchke.

The globe says:

Any spell of 5th level or lower cast from outside the barrier can’t affect creatures or objects within it (…) Such a spell can target creatures and objects within the barrier, but the spell has no effect on them.

(…) The object flies in a straight line up to 90 feet in a direction you choose before falling to the ground, stopping early if it impacts against a solid surface

It seems to me that catapult is vague on how exactly the spell’s magic interacts with the projected object. Does the magic imbue the object for the duration of the flight or does it impart the force to fling it as an instantaneous impulse that doesn’t last?

The rules do not say and so a DM would have to decide. Other questions (which you have pointed out) have suggested that the globe does nothing against the magic of a spell that is cast on an object outside of the globe but which is subsequently moved into the globe’s area.

Does Catapult target a creature or create a line of effect that would be interrupted by the globe because “the area within the barrier is excluded from the areas affected by such (AoE) spells?”

The description of Catapult does not mention a line-shaped area like spells like Lightning Bolt do. Nor does it really say that it targets a creature. It says “If the object would strike a creature, that creature must make a Dexterity saving throw.”

But, even if we decide that this isn’t the case, that is: that objects affected by a spell are suppressed while they are within the globe, the fact remains that an object has been flung with a great deal of force. The globe might nullify magic, but it doesn’t nullify inertia.

Of course, D&D is not a physics simulator, but it seems to me that the simplest way of resolving the issue is to say that one of the following is true:

• The magic which flings the object is not nullified by the Globe of Invulnerability because it does not prevent spells from affecting objects outside of its area and which are then moved inside it.
• The magic would be nullified but it doesn’t matter. The object has already been accelerated and made to fly through the air by the magic. The globe does not prevent a mundane physical object from passing through it and impacting a creature inside it.

In either case, the Globe offers no protection against the Catapult spell.

## How do I unhide folders on macOS 11?

I’ve tried How to unhide files on Mac?, and chflags nohidden not unhiding hidden files to no avail. I want to unhide the desktop folder in `~/Users/username/` while I have iCloud desktop turned on.

## dnd 5e – Can an Eldritch Knight Attack Twice With Green Flame Blade and War Magic?

An 8th-level Eldritch Knight has a sword.

The War Magic class ability says:

When you use your action to cast a cantrip, you can make one weapon attack as a bonus action

And the cantrip Green Flame Blade says:

You brandish the weapon used in the spell’s casting and make a melee attack with it against one creature within 5 feet of you

So I think that means there are 2 sword attacks in total for that turn.

One attack is a bonus action, and one is a side effect of the cantrip. In addition to that are the flame effects of the cantrip as well.

(The 2 attacks are not related to the Extra Attack Fighter class ability, which requires taking the Attack action, which is not being done here.)

Is the above information correct?

## vector calculus – Numerically solving 3D Maxwell equations with NDEigensystem

I am trying to get electric $$vec{E}$$ and magnetic $$vec{B}$$ fields in a cylindrical cavity with a dielectric, as in the following Figure. .

Both the cavity (pink) and dielectric (blue, with dielectric constant epsilon_r) are cylindrical and share the main axis. The cavity is assumed to be conducting, such as the field at its surface has to be null.

By resorting to the vector potential $$vec{A}$$, and using the generalized Coulomb Gauge transformation such that:

$$vec{E}(t,vec{r})=-partial_t vec{A}(t,vec{r}),$$

$$vec{B}(t,vec{r})=vec{nabla} times vec{A}(t,vec{r}),$$

$$vec{nabla} cdot left( epsilon_r(vec{r}) vec{A}(t,vec{r}) right)= 0,$$

I got the system of differential equations that $$vec{A}$$ has to satisfy:
$$begin{equation} vec{nabla}^2 vec{A}(t,vec{r}) – frac{1 + epsilon_r(vec{r})}{c^2}partial_t^2 vec{A}(t,vec{r})=0. end{equation}$$
Here, $$vec{r} = (x,y,z)$$.

I would like to have the eigenfrequencies and (spatial) eigenfunctions of this last operator. As far as I have understood, NDEigensystem with DirichletCondition is what I have to use; with the first output being the frequencies of the modes and the second output the spatial envelopes of the eigenfunctions.

I tried that, and failed (quite miserably). Not only the eigenfrequencies are imaginary and the spatial envelopes of the eigenfunctions do have an imaginary part$$^{*}$$. If I plug the outcome of NDEigensystem into the differential equations, I find that these equations are not even satisfied. I am sure that it is me failing somewhere, but after long time spent trying, I am starting being really frustrated. My code is the following:

``````{vals, funs} = NDEigensystem({EqSt(t, x, y, z, z1, z2, e, c) == {0, 0, 0}, BndCnd}, {Ax(t, x, y, z), Ay(t, x, y, z), Az(t, x, y, z)}, t, {x, y, z} (Element) Cylinder({{0, 0, 0}, {0, 0, d}}, r), 16, Method -> {"PDEDiscretization" -> {"FiniteElement", "MeshOptions" -> {"MaxCellMeasure" -> 0.01}}}});
``````

where `EqSt(t, x, y, z, z1, z2, e, c)` is the system of differential equations

``````EqSt(t_, x_, y_, z_, z1_, z2_, er_, c_) := Laplacian({Ax(t, x, y, z), Ay(t, x, y, z), Az(t, x, y, z)}, {x, y, z}) - (1 + fer(z, z1, z2, er))/c^2 {D(Ax(t, x, y, z), {t, 2}), D(Ay(t, x, y, z), {t, 2}), D(Az(t, x, y, z), {t, 2})};
``````

and `BndCnd` the boundary conditions

``````BndCnd = {DirichletCondition(Ax(t, x, y, z) == 0, True), DirichletCondition(Ay(t, x, y, z) == ,True), DirichletCondition(Az(t, x, y, z) == 0, True)};
``````

Finally, the dielectric function `fer(z, z1, z2, er)` that I use to mimic the dielectric is the following:

``````fer(z_, z1_, z2_, e_) := e (HeavisideTheta(z - z1) - HeavisideTheta(z - z2));
``````

which is a step function in the z-th coordinate (= the axis of both cylinders) having value `e` betweem `z1` and `z2` and zero elsewhere.

I have tried different methods and different values of “MaxCellMeasure” (there is little improvement, but the error which I obtain by plugging the solution into the differential equations is above one!!!). Do you have any idea what is wrong here?

I have few “bonus questions” here.

-First, I tried increasing the mesh resolution for getting better outcomes, but all the times the eigenfunctions look quite bad, not smooth at all. I guess that a 3D mesh is quite demanding, but I know that the most difficult part is going to be at the dielectric. How can I tell NDEigensystem to have a finer mesh there?

-Second, there is a way to change the normalization of the eigenfunctions? I have read that NDEigensystem spits out eigenfunctions $$vec{phi}_i$$ s.t.: $$int vec{phi}_i^* cdot vec{phi}_j d vec{r} = delta_i,j$$. I would change that to $$int epsilon_r(vec{r}) vec{phi}_i^* cdot vec{phi}_j d vec{r} = delta_i,j$$, would this be possible?

-Finally, I guess that it might be easier for NDEigensolver to remove the time dependence from the differential equations. This can be easily done by assuming that $$vec{A}(t,vec{r}) rightarrow vec{A}(vec{r})e^{-i omega t})$$. In this case, one can rewrite the operator equation above as:
$$begin{equation} vec{nabla}^2 vec{A}(vec{r}) + frac{omega^{2}}{c^2}(1 + epsilon_r(vec{r})) vec{A}(vec{r})=0. end{equation}$$
However, I do not know how to tell NDEigensystem that $$omega$$ is not a parameter, but should be found with the system constraints… There is a way to remove the time dependence from the equation to be given in NDEigensystem?

$$^*$$I guess this is a stupid problem; if I change the sign of the Laplacian I get real eigenfrequencies and eigenfunctions… But I am quite confident that the sign in the above equation is correct. There is something that I am missing here?

## bitcoincore development – Does python-bitcoinlib and the Bitcoin Core functional test framework share code? Were changes ever pushed down/upstream?

script.py of the Bitcoin Core functional test framework contains a comment that it was initially modified from python-bitcoinlib.

There doesn’t appear to have been any code sharing beyond that and certainly not any later changes pushed up/downstream.

I asked Kanzure (previous maintainer of python-bitcoinlib) on IRC about it and he said:

python-bitcoinlib is forked from a thing that was itself incorporated into bitcoin core’s functional test framework or the thing it was forked from was from code in the bitcoin core repository, i forget the lineage exactly but python-bitcoinlib came later

## python 3.x – Create a Dictionary of panda.DataFrames out of Folder and give Keys consecutive names

I have csv.data in my folder with names online4, online5, online6, online7 and online8

i want to loop through the folder, read evry file with pd.read_csv and safe them in a list or in a dict with keynames = filenames.

i tried the following:

``````path = r'C:dataonline'
online_files = glob.glob(os.path.join(path, "*.csv"))
online_dict = {}

for f, i in zip(online_files, range(4,9)):
online_dict = online_dict("online{0}".format(i)) = pd.read_csv(f, usecols = ("a", "b", "c", "d","e","f"))
``````

This gives me:
ValueError: Wrong number of items passed 6, placement implies 1

Im a bit confused, since this code is working:

``````d = {}
u = ("4lol","5lol", "6lol", "7lol", "8lol")
for i ,x in zip(u, range(4, 9)):
d("string{0}".format(x)) = i
``````

print(d)

``````output : {'string4': '4lol', 'string5': '5lol', 'string6': '6lol', 'string7': '7lol', 'string8': '8lol'}
``````

Or would it be a better idea to create a list of dataframes and convert that into a dict?
Im pretty new to programming 🙂
Thanks

## I will give you Ways to Make Money Online for \$2

#### I will give you Ways to Make Money Online

Hello dear,

Today we have videos explaining you various online methods that could be used to make money online, this GIG is an instant download and you can download the file as soon as your BUY this GIG.

The package contains videos that shows you Top 20 Methods to Make Money Online Easily.

.