video – What screen recording software supports virtual camera input on MacOS?

I’ve got a M1 Mac Mini running the latest MacOS and want to record screen input for youtube videos via Iriun or other virtual webcam software, as the webcams currently available are of inferior quality as opposed to my iPhone 12 camera IMO and I don’t really want to purchase a DSLR.

When I go into quicktime there is no option to use the virtual camera input, however Zoom and Discord both support it. So my question is what other 3rd party screen recorders also support virtual camera input on MacOS?

transactions – Confused about input and output spending limitations and consolidation

I am sure the answer to this is trivial to someone who already knows the answer, but not to me.

I recently wanted to spend some received bitcoin for the first time and discovered that the associated transaction fee was huge (more than I wanted to spend!), for two reasons:

  1. Fees are presently naturally high due to network congestion.
  2. The address has small amounts of bitcoin from many sources, which apparently is problematic.

I spent some time researching the problem and learned that all money in an address must be spent at once. I read about the analogies to not being able to split a coin. Hence the need for change addresses and such. I learned about “consolidation” and how to consolidate transactions during times of low fees.

Experimentally, I consolidated the 3 inputs of a different address into 1 new address, using a low fee. It took a few weeks for the transaction to confirm, but now has successfully made that money more spendable, because the consolidation reduces future fees. Okay, fair enough.

Now I want to do that to my main bitcoin address which has 22 received inputs. So I will consolidate them all with a (relatively) low fee, into 1 new address, which, when it finally confirms, I will finally be able to spend.

But entirely by accident I discovered something weird in Electrum:

  • If I right-click an address, there is a secret feature “Spend from” which lets me select the source address. (This is useful, because previously the only way I knew to select the source address was to fudge the spending and fees numbers until they exactly matched the total of a particular address, which tricked the program into using that address.)

  • On the “Send” tab, Electrum then lists each individual received input to that source address. If I right-click the individual inputs, I can remove them. WHHHAAT?!?!?

This contradicts everything I spent days reading about, which was that I had to spend the entirety of inputs at once.

Is this configuration valid? Or will there be an error when I try to commit the transaction? Or will all the other inputs to the address be permanently lost? I am too scared to try it.

Perhaps, for example, the design purpose of being able to remove specific inputs from a transaction is a way to purge “dust”, to prevent an attack whereby somebody could DoS a bitcoin address by sending it many 1-satoshi inputs, causing the address to become practically unspendable without incurring a fortune in fees. But this design would discard the unused inputs forever, or gift them to miners as fees.

If it is valid to spend only part of an address, and I won’t lose the rest, then why did I wait 3 weeks for this silly consolidation lark? And why was Electrum moronically trying to force me to spend all of the address at once, phenomenally increasing the fee when I was perfectly happy leaving the rest of the damn money exactly where it was. And why are there so many articles online explaining why you have to spend inputs all at once?

I am terrified I will lose all my bitcoin if I try this, so I would appreciate links to example transactions on the blockchain to satisfy myself that this partial inputs thingie is valid.

dnd 3.5e – Input on Variation on KRyan’s TWF Elf Barbarian

I really like KRyan’s solution to this character concept:
How to optimize a TWF Barbarian Elf

I’m looking to build something similar, but I don’t have all the restrictions that the OP had. For instance, I am planning on using the Arctic Template from Dragon #306 applied to a Wood Elf, giving me +2 Str, +2 Dex, -2 Int, -2 Cha.

With those bonuses, does TWF even make sense anymore? If so, are there changes that would make sense to utilize the STR/DEX synergy?

Getting back into 3.5e after a long time, and I’d forgotten that the limitless options are such a double-edged sword…

javascript – Onchange behavior of Safari input type=”date”

I have a 700-line HTML/JavaScript page that, among other things, validates dates. It works on Chrome, Edge, and Firefox, and fails on iOS Safari 14.4 because the change event on input type="date" fires before the user makes a selection. A mostly-minimal example is this:

<form name="test" >
<input type="date" name="date1" id="date1"><br>
<br>
</form>
<button id="ckValue">Check Value</button>
<script type="text/javascript">
document.getElementById("date1").addEventListener("change",dtChange);
document.getElementById("ckValue").addEventListener("click",getValue);
function dtChange(evt) {
    var val=document.getElementById("date1").value;
    alert('Change event signaled; value='+val);
}
function getValue() {
    var val=document.getElementById("date1").value;
    alert("Value of date ="+val);
}
</script>

It’s in a fiddle here: https://jsfiddle.net/1jnqf5aL/1/

In this example run on Safari, when the form is initially loaded and the date item is touched/tapped, the change event fires immediately and the value of the input item is the current date. My application detects the change event and emits a “Departure date must be in the future” error message before the user has had an opportunity to select a date.

With other browsers, e.g. Chrome, Edge, Firefox, the change event does not fire until the user has selected a date in the calendar form.

I can make Safari behave, sort-of, by providing an initial value= attribute on the input element where the value is the current date in ISO 8601 format. The trouble with that is, the current date is not a valid date in this application, so I don’t want to show it to the user of the application. Browser sniffing will fail if/when Safari is changed to behave similarly to other browsers.

My question: How can I accommodate, or “program around” this behavior of Safari without browser sniffing? Or, have I missed something obvious and fundamental?

html5 – Desconsiderar outras entradas do input com javascript

Estou desenvolvendo um código aonde o javascript escreve no html de acordo com o valor imputado, o problema que ao repetir o valor de input uma pergunta já feita é reescrita, gostaria de saber se há uma solução aonde isso não aconteça.

dialog open=”dialogo”>

Ok

var pergunta = document.getElementById(‘pergunta’);

function responder(){

var resposta = document.getElementById(“desejo”).value;
if(resposta == ‘S’){

pergunta.innerHTML = "Escolha seu personagem : 1 - mago, 2- ladra, 3- guerreiro";

}

Why ArcTan[x,y] limits yield different answers for symbolic and numeric input

I can’t find any reason why in version 12.1

Limit(ArcTan(3, x)/x, x -> 0)
(*1/3*)

contradicts to

Limit(ArcTan(y, x)/x, x -> 0)
(*Indeterminate if Re(y^2)>0&&Re(y/Sqrt(y^2))>0*)

performance – Python pynput keyboard + mouse input printer

I needed to have input shown for some things in a game I play on Linux, but Linux doesn’t seem to have any good input display programs. I decided it would be good enough to have python print to a pair of xterm windows (one for keyboard and one for mouse) using pynput. I do this using two different python programs because the only way I found to have one python programs deal with two terminals is to constantly write to a file and use tail -f, and I didn’t want to do that.

Because both programs ended up being so small and simple, I tried to write it so that the key/mouse listeners would run their functions as fast as possible. But I might have missed some things that could be done. I’m wondering if anyone knows of any other ways to optimize this for response time. I know it won’t make anything close to a noticeable difference, I’m just asking out of curiosity.

*Edited because I thought of ways to make it faster

mouse_listener.py

from pynput import mouse

def main():
    
    print_count = 0
    
    def on_click(x,
        y,
        button,
        pressed,
        local_print=print,
        dashes="--- ",
        no_dashes="    ",
        pressed_str=" mouse pressed",
        released_str=" mouse released"
        ):
        nonlocal print_count
        if print_count >= 10:
            if pressed:
                local_print(dashes + button.name + pressed_str)
                print_count = 0
            else:
                local_print(dashes + button.name + released_str)
                print_count = 0
        else:
            if pressed:
                local_print(no_dashes + button.name + pressed_str)
                print_count = print_count + 1
            else:
                local_print(no_dashes + button.name + released_str)
                print_count = print_count + 1
    
    def on_scroll(x,
        y,
        dx,
        dy,
        local_print=print,
        dashes="--- ",
        no_dashes="    ",
        up_str="scroll up",
        down_str="scroll down"
        ):
        nonlocal print_count
        if print_count >= 10:
            if dy == 1:
                local_print(dashes + up_str)
                print_count = 0
            else:
                local_print(dashes + down_str)
                print_count = 0
        else:
            if dy == 1:
                local_print(no_dashes + up_str)
                print_count = print_count + 1
            else:
                local_print(no_dashes + down_str)
                print_count = print_count + 1
    
    try:
        listener = mouse.Listener(on_click=on_click, on_scroll=on_scroll)
        listener.start()
        listener.join()
    except KeyboardInterrupt:
        listener.stop()

main()

key_listener.py

from pynput import keyboard

def main():
    
    print_count = 0
    held = set()
    
    def on_press(key,
        local_print=print,
        local_hasattr=hasattr,
        held_local=held,
        hold=held.add,
        str_lower=str.lower,
        dashes="--- ",
        no_dashes="    ",
        end_text=" pressed",
        str_for_hasattr="name"
        ):
        nonlocal print_count
        if key not in held_local:
            if local_hasattr(key, str_for_hasattr):
                if print_count >= 10:
                    local_print(dashes + key.name + end_text)
                    print_count = 0
                else:
                    local_print(no_dashes + key.name + end_text)
                    print_count = print_count + 1
            else:
                if print_count >= 10:
                    local_print(dashes + str_lower(key.char) + end_text)
                    print_count = 0
                else:
                    local_print(no_dashes + str_lower(key.char) + end_text)
                    print_count = print_count + 1
            hold(key)
    
    def on_release(key,
        local_print=print,
        local_hasattr=hasattr,
        unhold=held.remove,
        str_lower=str.lower,
        dashes="--- ",
        no_dashes="    ",
        end_text=" released",
        str_for_hasattr="name"
        ):
        nonlocal print_count
        if local_hasattr(key, str_for_hasattr):
            if print_count >= 10:
                local_print(dashes + key.name + end_text)
                print_count = 0
            else:
                local_print(no_dashes + key.name + end_text)
                print_count = print_count + 1
        else:
            if print_count >= 10:
                local_print(dashes + str_lower(key.char) + end_text)
                print_count = 0
            else:
                local_print(no_dashes + str_lower(key.char) + end_text)
                print_count = print_count + 1
        try: # I don't trust this part
            unhold(key)
        except KeyError:
            pass
    
    try: # TypeError is possible because numpad 5's char attribute is None
        listener = keyboard.Listener(on_press=on_press, on_release=on_release)
        listener.start()
        listener.join()
    except (KeyboardInterrupt, TypeError):
        listener.stop()

main()

xterm_opener.sh

xterm -xrm 'XTerm.vt100.allowTitleOps: false' -T "keyboard" -geometry 28x16 -e python3 '/home/USERNAME/input_listener/key_listener.py' &
xterm -xrm 'XTerm.vt100.allowTitleOps: false' -T "mouse" -geometry 28x16 -e python3 '/home/USERNAME/input_listener/mouse_listener.py'

performance – under 100 line Python pynput keyboard + mouse input printer

I needed to have input shown for some things in a game I play on Linux, but Linux doesn’t seem to have any good input display programs. I decided it would be good enough to have python print to a pair of xterm windows (one for keyboard and one for mouse) using pynput. I do this using two different python programs because the only way I found to have one python programs deal with two terminals is to constantly write to a file and use tail -f, and I didn’t want to do that.

Because both programs ended up being so small and simple, I tried to write it so that the key/mouse listeners would run their functions as fast as possible. But I might have missed some things that could be done. I’m wondering if anyone knows of any other ways to optimize this for response time. I know it won’t make anything close to a noticeable difference, I’m just asking out of curiosity.

mouse_listener.py

from pynput import mouse

def main():
    
    print_count = 0
    
    def on_click(x, y, button, pressed, local_print=print):
        nonlocal print_count
        try:
            if print_count >= 10:
                local_print(f"--- {button.name} mouse {'pressed' if pressed else 'released'}")
                print_count = 0
            else:
                local_print(f"    {button.name} mouse {'pressed' if pressed else 'released'}")
                print_count += 1
        except AttributeError:
            pass
    
    def on_scroll(x, y, dx, dy, local_print=print):
        nonlocal print_count
        try:
            if print_count >= 10:
                local_print(f"--- {'scroll up' if dy == 1 else 'scroll down'}")
                print_count = 0
            else:
                local_print(f"    {'scroll up' if dy == 1 else 'scroll down'}")
                print_count += 1
        except AttributeError:
            pass
    
    try:
        listener = mouse.Listener(on_click=on_click, on_scroll=on_scroll)
        listener.start()
        listener.join()
    except KeyboardInterrupt:
        listener.stop()

main()

key_listener.py

from pynput import keyboard

def main():
    
    print_count = 0
    held = set() # this is needed because it keeps calling on_press when you hold a key
    
    def on_press(key, local_print=print, held_local=held, hold=held.add, str_lower=str.lower):
        nonlocal print_count
        if key not in held_local:
            try:
                if print_count >= 10:
                    local_print(f"--- {key.name} pressed")
                    print_count = 0
                else:
                    local_print(f"    {key.name} pressed")
                    print_count += 1
            except AttributeError:
                if print_count >= 10:
                    local_print(f"--- {str_lower(key.char) if key.char is not None else 5} pressed")
                    print_count = 0
                else:
                    local_print(f"    {str_lower(key.char) if key.char is not None else 5} pressed")
                    print_count += 1
            hold(key)
    
    def on_release(key, local_print=print, unhold=held.remove, str_lower=str.lower):
        nonlocal print_count
        try:
            if print_count >= 10:
                local_print(f"--- {key.name} released")
                print_count = 0
            else:
                local_print(f"    {key.name} released")
                print_count += 1
        except AttributeError:
            if print_count >= 10:
                local_print(f"--- {str_lower(key.char) if key.char is not None else 5} released")
                print_count = 0
            else:
                local_print(f"    {str_lower(key.char) if key.char is not None else 5} released")
                print_count += 1
        try:
            unhold(key)
        except KeyError:
            pass
    
    try:
        listener = keyboard.Listener(on_press=on_press, on_release=on_release)
        listener.start()
        listener.join()
    except KeyboardInterrupt:
        listener.stop()

main()

xterm_opener.sh

xterm -xrm 'XTerm.vt100.allowTitleOps: false' -T "keyboard" -geometry 28x16 -e python3 '/home/USERNAME/input_listener/key_listener.py' &
xterm -xrm 'XTerm.vt100.allowTitleOps: false' -T "mouse" -geometry 28x16 -e python3 '/home/USERNAME/input_listener/mouse_listener.py'

c++ – How to get struct layouts from vertex shader input using ID3D12Reflection

I am attempting to write a code generator that builds C++ structs/classes from D3D12 reflection data built using DXC. Given a simple vertex shader signature:

struct Light
{
    float3 Color;
    float3 Dir;
};

struct cbPerPass : register(b0)
{
    float4x4 gWorldProjTransform;
    Light gGlobaLight;
};

struct VertexIn
{
    float3 Pos      : POSITION;
    float4 Color    : COLOR;
};

struct VertexOut;  // unimportant for the question

VertexOut VS(VertexIn vin) { // do calculations here }

I can retrieve the input parameters via ID3D12ShaderReflection::GetInputParameterDesc(), but this only reports the mapping of VertexIn members to shader registers and any attached semantics. I can get the layout of cbPerPass through ID3D12ShaderReflection::GetConstantBufferByIndex() and the layout of Light through the ID3D12ShaderReflectionType interface.

However, what I would like to retrieve is the layout of the VertexIn struct. Is there a way to do this?

Python dictionary based on input file

I’m trying to create a dictionary object like below using the input file data structure as below, During conversion inner object is being replicated. Any advise what fix is needed for desire output

input file data:/home/file1.txt

(student1)
fname       : Harry
lname       : Hoit
age         : 22

(Student2)
fname       : Adam
lname       : Re
age         : 25

expected output :

{'Student1' : {'fname' : 'Harry', 'lname' : 'Hoit', 'Age' : 22},
'Student2' : {'fname' : 'Adam', 'lname' : 'Re', 'Age' : 25}}
def dict_val():
    out = {}
    inn = {}
    path= '/home/file1.txt'
    with open(path, 'r') as f:
        for row in f:
            row = row.strip()
            if row.startswith("("):
                i = row(1:-1)
                # inn.clear() ## tried to clean the inner loop during second but its not correct
            else:
                if len(row) < 2:
                    pass
                else:
                    key, value = row.split('=')
                    inn(key.strip()) = value.strip()
                    out(i) = inn
    return out

print(dict_val())

current output: getting duplicate during second iteration

{'student1': {'fname': 'Adam', 'lname': 'Re', 'age': '25'}, 
 'Student2': {'fname': 'Adam', 'lname': 'Re', 'age': '25'}}