## Why can Push Down Automata have infinite stack but Finite State Machine cannot have infinte state?

A Finite State Machine cannot accept the language

L = { $$0^n1^n | n > 0$$ }

because it will require infinite amount of memory to remember the number of zeros. But, a Push Down Automaton can recognize it with a infinite stack. Then Why are we allowing infinite storage for the stack of PDA but not for the states of FSM? If we can do with a infinite stack, You can also do it with a infinite FSM.So, Why is there no Infinite State Machine?What’s the problem with it?

## ansible – Update SLURM node state prior/after playbook execution

I would like to automatically set the state of a node in a SLURM cluster before/after running my Ansible playbook (from idle to drained and after applying the playbook back to idle). The `scontrol` command that is required for this, is only available on the head node of the cluster. The Ansible playbook, however, is applied to the compute nodes of the cluster. Is there any way to run a remote command on another host than the one currently connected to? I could think of just using the built-in `shell` module and then SSH to the head node. But maybe there’s a nicer way of doing it?

I already looked for ready-to-go Ansible modules but couldn’t find any for my use case. The existing ones are all focused on installing/configuring a SLURM cluster.

My idea is then to use a `do-until` loop that sets the new cluster node state and then repeatedly checks whether the node already switched to the new state (as there still could be running jobs).

## architectural patterns – How to construct a model state dependent context menu in a MVP GUI application

Lets say I have a GUI application which tries to adhere to Model-View-Presenter (MVP) as best as possible.
In this application I have a list box with items. One should be able to interact with these items via a context menu. But: Which entries in the context menu are shown depend on the state of the item.
For example: I have a list box of data sources whose context menu shall show “connect” or “disconnect”, depending on whether its already connected or not.

This is where I don’t know how to correctly implement this with the MVP architecture.

How can I fill the context menu with state dependent items while the view does not know about the state and the presenter does not know about where to put a context menu?

My thoughts so far:

The view receives the framework event for opening the context menu. Now it must populate the menu but has no info on the state of the underlying model.
It could just call a corresponding presenter method (the original framework event object would not be passed to the view, see assumptions). The presenter could query the model and get the state, but how does the info get to the view?
If the view had a method like “show_context_menu” then how would the view know where to put the context menu. This information would only be available in the method handing the original context menu event and I don’t think something like coordinates should be passed to the presenter. Or should it?

This is a general question and not framework or language dependent.

My Assumptions (Which might be wrong):

• Presenter should be independent from GUI framework (QT in my case), so no GUI framework objects used in presenter.
• View should not access model data directly (adhering to MVP)

## measure theory – There is no dispersion free quantum state on \$B(H)\$

Let $$H$$ be a Hilbert space and $$P(H)$$ denotes the lattice of all orthogonal projections on $$H$$. The famous generalized Gleason theorem states that if $$mu:P(H) to mathbb{R}$$ is a finitely additive function then $$mu$$ extends to a state on whole $$B(H)$$. If we assume that $$mu$$ is completely additive then the corresponding state turns out to be normal. This second part is the original Gleason theorem: one consequence of the original Gleason theorem is that there is no dispersion-free quantum state i.e. completely additive $$mu$$ as above such with values in the two element set $${0,1}$$.

How to prove (using the generalized Gleason theorem) that there is also no dispersion free quantum finitely additive measure, i.e. finitely additive $$mu$$ as above with values in $${0,1}$$?

## fraud – How does a fraudulent credit card charge to a Department of State work?

First of all, we don’t know if the charge really came from the NY Department of State. This could be a company using a similar name to make it look like NY Department of State and thus get away with it, for some time, as it might be overlooked by NY residents.

Second, assuming the charge was indeed done by NY Department of State I see a few possibilities.

NY DoS might have a platform which allows paying with one credit card, then reversing it by crediting another one. It doesn’t seem a good idea for the malfeasants to use a Government Agency for committing fraud, but I guess this would be an option.

A second possibility would be the following. Let’s suppose John Doe owes them \$200. Instead of paying, he goes to a criminal Alphonse Gabriel which agrees to pay their debt of \$200 in exchange of receiving only \$100. Alphonse Gabriel pays the sum with a stolen credit card, and receives 100 legit US dollars. John Doe manages to only pay half the sum.

This wouldn’t be very bright for John Doe, either, as he would be located when investigating the credit card fraud, and -if found- he would have a much bigger problem that such \$200 debt. But Alphonse Gabriel may not care about that.

A third option would be that a payment gateway have some unsecured system which allows a merchant to get payments stating as sender a different company (by changing some merchant id, perhaps). If then the charge-backs go to the NY Department of State, which might not scrutiny much the charge-backs it gets, that could be profitable. Or, if it was the result of a misconfiguration (e.g. a small shop which is charging everyone as the NY Department of State) this could be similar to the first case.

If there was a small company appearing as “NYS DOS CORP 518 473 8 ALBANY NY”, it may not be much noticed by the people who knows what that charge is for, and only raise suspicion when they receive some fraudulent purchases which end up on completely random people statements.

A fourth possibility would be that it somehow was legitimate (maybe some proceeding that is handled out-of-state? or a contractor of several states that issued your charge with the wrong sender?)

Finally, remember that you can dispute the charge at your bank, and have it reversed. Given that someone seems to have been able to use it, I would recommend getting a new one issued.

## fraud – How does a frauulent credit card charge to a Department of State work?

First of all, we don’t know if the charge really came from the NY Department of State. This could be a company using a similar name to make it look like NY Department of State and thus get away with it, for some time, as it might be overlooked by NY residents.

Second, assuming the charge was indeed done by NY Department of State I see a few possibilities.

NY DoS might have a platform which allows paying with one credit card, then reversing it by crediting another one. It doesn’t seem a good idea for the malfeasants to use a Government Agency for committing fraud, but I guess this would be an option.

A second possibility would be the following. Let’s suppose John Doe owes them \$200. Instead of paying, he goes to a criminal Alphonse Gabriel which agrees to pay their debt of \$200 in exchange of receiving only \$100. Alphonse Gabriel pays the sum with a stolen credit card, and receives 100 legit US dollars. John Doe manages to only pay half the sum.

This wouldn’t be very bright for John Doe, either, as he would be located when investigating the credit card fraud, and -if found- he would have a much bigger problem that such \$200 debt. But Alphonse Gabriel may not care about that.

A third option would be that a payment gateway have some unsecured system which allows a merchant to get payments stating as sender a different company (by changing some merchant id, perhaps). If then the charge-backs go to the NY Department of State, which might not scrutiny much the charge-backs it gets, that could be profitable. Or, if it was the result of a misconfiguration (e.g. a small shop which is charging everyone as the NY Department of State) this could be similar to the first case.

If there was a small company appearing as “NYS DOS CORP 518 473 8 ALBANY NY”, it may not be much noticed by the people who knows what that charge is for, and only raise suspicion when they receive some fraudulent purchases which end up on completely random people statements.

A fourth possibility would be that it somehow was legitimate (maybe some proceeding that is handled out-of-state? or a contractor of several states that issued your charge with the wrong sender?)

Finally, remember that you can dispute the charge at your bank, and have it reversed. Given that someone seems to have been able to use it, I would recommend getting a new one issued.

## reactjs – Cons of using state management alternatives to redux

It’s easy to argue that the un-opinionated nature of redux can make it verbose and hard to use, so I’ve been looking into alternatives. There are plenty opinionated state management alternatives. But as a consequence, you lose flexibility to suit your team’s exact needs.

For those that use or have used other state management libraries in production/enterprise-levels applications: What challenges have you faced because you did not use redux and used a more straightforward alternative? Was there a resolution?

## state – React one-way data binding vs Angular two-way data binding

After hours of reading blog posts, I understand that React has one-way data binding, and Angular has two-way. But I don’t actually know what that means….

React

``````import { useState } from 'react';
import Switch from "./switch";

function App() {
const (value, setValue) = useState(false);
return (
<Switch
isOn={value}
handleToggle={() => setValue(!value)}
/>
);
}
``````

Angular

``````import { Component } from '@angular/core';

@Component({
selector: 'app',
template: `
<switch (ngModel)="value" (ngModelChange)="value = \$event"></switch>
`,
})
export class AppComponent {
value = false;
}
``````

Those look functionally identical to me.

Can someone help explain the difference?

## python – How to disabled Handler when in spesific ConversationHandler state?

I have 1 `ConversationHandler` and 1 `MessageHandler`. This is my code:

``````menu_handler = ConversationHandler(
entry_points=(CommandHandler('start', start)),
states={
CommandHandler('back', start)),
EDIT: (MessageHandler(Filters.text & ~(Filters.regex('^/back|/quit\$')), edit),
CommandHandler('back', start)),
DELETE: (MessageHandler(Filters.text & ~(Filters.regex('^/back|/quit\$')), hapus),
CommandHandler('back', DELETE)),
},
fallbacks=(CommandHandler('quit', quit)),
)

help_handler = MessageHandler(Filters.text & ~(Filters.regex('^/start|/register|/myinfo\$')), help)
Let say user in `ADD` / `EDIT` / `DELETE` state, he want to send message “this is my input” to the bot.
How to run `MessageHandler` inside the state that user currently in instead of `help_handler`?