javascript – How to add an input field with a date to the checkout page?

I’m studying Magento2, downloaded the module and added it to the app / code / vendor / module-delivery-date folder

I cannot understand in which files and what needs to be changed in order to display my input and connect with the checkout module.
I hope for your help

unity – Press and hold camera movement with mouse in new Input System?

I am transitioning to the new movement system and am having trouble figuring out how to move the camera when a mouse button is pressed and held.

Here’s how I did it before:

private void Update()
    // Get the position of the mouse when a middle click occurs
    if (Input.GetMouseButtonDown(2))
        _dragOrigin = cam.ScreenToWorldPoint(Input.mousePosition);

    // If the MMB is still held down, calculate the distance and move the camera
    if (Input.GetMouseButton(2))
        Vector3 difference = _dragOrigin - cam.ScreenToWorldPoint(Input.mousePosition);
        cam.transform.position += difference;

I have tried doing something similar in the new input system but it doesn’t work:

public void OnMMB(InputAction.CallbackContext context)
    if (context.phase != InputActionPhase.Started)
        // Get the position of the mouse when a middle click occurs
        dragOrigin = cam.ScreenToWorldPoint(Mouse.current.position.ReadValue());
        // If the MMB is still held down, calculate the distance and move the camera
        Vector2 newPosition = cam.ScreenToWorldPoint(Mouse.current.position.ReadValue());
        Vector3 difference = dragOrigin - newPosition;
        cam.transform.position += difference;

Here is how I set this up inside the Input editor:

The Action Type of the action is Button.

python – How to identify characters from user input in MAD calculator

so my teacher asked me another question witch was to create a MAD calculator with mean too.and I tried really hard and it just doesn’t work we’ve tried for loops but that didn’t work either. Here is the code.

input = list(map(float ,input('enter number here:').split(',')))
mean = sum(input)/len(input)
bob = sum(input) - mean
deviation = bob/mean

turing machines – When can a deterministic finite-state-automata along with its input sequence be said to be a part of another FSM?

There is a Finite State Automata / Finite State Machine (FSM) $F$. This FSM has an input alphabet, a set of possible states, an initial state, a set of possible final states and a state transition function.

For this FSM a finite input sequence $S$ is given, such that at the end of this sequence the FSM enters a final state and stays in that state.

Can this FSM $F$ along with the input sequence $S$ be considered a separate FSM $F’$?

Analogous to this, can a Turing machine $T$ along with the tape $P$ be considered a separate Turing machine $T’$?

What are the conditions, if any, for this to be true assuming it is true?

Note: I expect a formal proof, or a reference/outline to a formal proof that proves that either of this can or cannot be done. Some theory related to this is also welcome.

My research:

Related topic:

R. T. G. TAN (1979) Hardware and software equivalence, International Journal of Electronics, 47:6, 621-622, DOI: 10.1080/00207217908938690

I am aware of the principle of hardware and software equivalence, which states that a given task can be performed using hardware or software, i.e. digital hardware and software are equivalent models of computation. But I think that my question is different from this one.


  • From this question (
    Is there code below microcode? ) I think we can consider an FSM with its input sequence (microcode) to be a part of another FSM (the digital computer), but of course much more circuitry like Arithmetic and Logical Unit (ALU) and datapath is needed to make a computer. Microcode is used only for the control circuit.

  • This answer explains how the data in the RAM of a computer along with the CPU can be considered to be a part of a bigger circuit.

How to draw unity gizmos with new input system?

I am using the new Unity Input system for my game.

When I press a key, for example “Q”, I want gizmos to be drawn.

However, I can’t subscribe to a keypress event with a Gizmo drawing function, because it says it needs to be inside of OnDrawGizmos(). Furthermore, I can’t subscribe with that function because it says it doesn’t take any parameters, and I need to pass InputAction.CallbackContext context as a parameter, for it to be considered okay by the event system.

Here’s the code for how I did it before:

public void OnDrawGizmos()
    if (Input.GetKey(KeyCode.Q))

How can I recreate this?

New to programming advice and input on my first “real” Python project. What can I do to get better? best practices?

So this is a project I have been working on for the last few weeks. Just started learning Python. Started out with bash scripting and got the itch to learn more. Anyway code fetches covid-19 data from the internet, assembles data the way I need it to, plots it on graphs that are saved as .png files, writes all the data and graphs to a ‘’ file and pushes it to github. As I am self taught I am posting this for feedback so I dont develop bad habits and can learn the best practices. Any advice or criticism would be appreciated. Thank you.

#!/usr/bin/env python3
import requests
import pandas as pd
import io
import numpy as np
import matplotlib.pyplot as plt
import os

# **** Build data ****

# Fetch data
url = ''
download = requests.get(url).content
df = pd.read_csv(io.StringIO(download.decode('utf-8')))

# Extract each column individually
date = df('date')
cases = df('cases')
deaths = df('deaths')

# Calculate new cases
total_cases = np.array(cases)
new_cases = np.diff(total_cases)
new_cases = np.insert(new_cases, 0, 1)

# Calculate new deaths
total_deaths = np.array(deaths)
new_deaths = np.diff(total_deaths)
new_deaths = np.insert(new_deaths, 0, 0)

# Create csv for total cases and deaths
df = pd.DataFrame({'date': date, 'total cases': total_cases,
    'total deaths': total_deaths})
df.to_csv('data/us_covid-19_total.csv', index=False)

# Create csv for new cases and deaths
df = pd.DataFrame({'date': date, 'new cases': new_cases, 
    'new deaths': new_deaths})
df.to_csv('data/us_covid-19_new.csv', index=False)

# Create csv for all aggregated data
df = pd.DataFrame({'date': date, 'total cases': total_cases, 
    'total deaths': total_deaths, 'new cases': new_cases, 'new deaths': new_deaths})
df.to_csv('data/us_covid-19_data.csv', index=False)

# **** Plot data ****

# x axis for all plots
x = np.array(date, dtype='datetime64')

# Plot Total Cases
y = total_cases / 1000000
plt.figure('US Total COVID-19 Cases', figsize=(15, 8))
plt.title('US Total COVID-19 Cases')
plt.ylabel('Cases (in millions)')
plt.grid(True, ls='-.')
plt.yticks(np.arange(min(y), max(y) + 10))
plt.plot(x, y, color='b')

# Plot Total Deaths
y = total_deaths / 1000
plt.figure('US Total COVID-19 Deaths', figsize=(15, 8))
plt.title('US Total COVID-19 Deaths')
plt.ylabel('Deaths (in thousands)')
plt.grid(True, ls='-.')
plt.yticks(np.arange(min(y), max(y) + 100, 50))
plt.plot(x, y, color='b')

# Plot New Cases
y = new_cases / 1000
plt.figure('US New COVID-19 Cases', figsize=(15, 8))
plt.title('US New COVID-19 Cases')
plt.ylabel('Cases (in thousands)')
plt.grid(True, ls='-.')
plt.yticks(np.arange(min(y), max(y) + 100, 50))
plt.plot(x, y, color='b')

# Plot New Deaths
y = new_deaths
plt.figure('US New COVID-19 Deaths', figsize=(15, 8))
plt.title('US New COVID-19 Deaths')
plt.grid(True, ls='-.')
plt.yticks(np.arange(min(y), max(y) + 1000, 500))
plt.plot(x, y, color='b')

# **** Write to ****

# New cases and deaths in the last 24 hours
cases = new_cases(-1)
deaths = new_deaths(-1)

# 7-day mean for new cases and deaths
cmean = np.mean(new_cases(-7:))
dmean = np.mean(new_deaths(-7:))

# Date
date = np.array(date, dtype='datetime64')
date = date(-1)

# DataFrame for new cases and deaths in the last 24 hours 
df_24 = pd.DataFrame({'New cases': (f'{cases:,d}'), 'New deaths': (f'{deaths:,d}')})
df_24 = df_24.to_markdown(index=False, disable_numparse=True)

# DataFrame for 7-day average
df_avg = pd.DataFrame({'Cases': (f'{int(cmean):,d}'), 'Deaths': (f'{int(dmean):,d}')})
df_avg = df_avg.to_markdown(index=False, disable_numparse=True)

# Write to ''
f = open('', 'w')
f.write(f'''# US COVID-19 (Data)(
###### Reported numbers for {str(date)} 
###### 7-day average 
## (Total Cases and Deaths)(
### Cases
### Deaths
## (New Cases and Deaths)( 
### Cases
### Deaths

# **** push to github ****

os.system('git add . && git commit -m "Updating data." && git push')

audio – Bluetooth speaker connects to input rather than output – seems related to macOS Big Sur

I’ve got a bluetooth speaker (Bose Mini II SoundLink) that I’m trying to connect to my Mac. I was playing music through Tidal and it was working normally but then it suddenly disconnected, and now whenever I try and reconnect it, it will show up in input devices (under System Preferences > Sound) and not under output devices (even though I’m pretty sure it doesn’t even have a Mic).

It seems after updating to macOS Big Sur my bluetooth devices are consistently having problems because some headphones of mine also refuse to connect with the audio unless I redo pairing them every time.

Can someone tell me how to fix this?

How to see which mouse button was pressed (Unity Input System)

You don’t.

The InputActions assets in the new input system are meant to create an abstraction layer between different pieces of input hardware and what actions their inputs are supposed to trigger in the context of the game.

That means Actions are meant to be semantic, not technical. You don’t want to do something when the player clicked the mouse button. You want to do something when the player delivered an input with a specific meaning within the context of your game. And one way to deliver that input might be the click of a specific mouse button… and another might be a gamepad button… and another a gesture on a touchscreen.

This philosophy is reflected by the InputValue object passed to your event handlers which react to those actions. It only provides a value and hides the technical details of which physical part of which device provided that value.

Currently you have an action with the meaning “Mouse Button Clicked” which is triggered by three different hardware inputs, namely left-click, right-click and middle-click. This would be fine if you wanted all three mouse buttons to do the same thing, but even then you would rename that action to what you actually want to happen on a mouse-click.

If you want each mouse-button to perform a different kind of action, then you would create three actions named after what you actually want to do (Select, Deselect, NavigateBack, MapPanningMode, Fire, AltFire… whatever makes sense in the context of your game), and assign each mouse button to the corresponding action.

Yes, the new input system has a very different philosophy than you might be used to as a user of the good old hardware-oriented Input class (especially when you are one of the Unity developers who so far eschewed the InputManager window and preferred to work with KeyCode’s instead). So when you want to use the new input system efficiently, then you need to really change the way you think about input.

But it is really worth it to give it a chance, because when you understood and internalized the way it wants you to use it, then supporting different kinds of input devices and keyboard layouts turns from a chore into a triviality.