Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)Z
Posts
28
Comments
523
Joined
2 yr. ago

  • Honestly the worst thing about this equation isn't the fact that they had poor typesetting, it was that they used decorative constants. The ε and φ values they chose just cancel out. The equation is equivalent to (xᵢ - mᵢ) / mᵢ.

  • Asterisks for multiplication are fine and normal and common in typed text. Where it's unusual is in text that's been typeset, where using things like asterisks for multiplication defeat the point of typesetting, It would be like going through all the effort to typeset an equation, but still saying sqrt(x) instead of using the square root symbol.

  • disregard this comment

  • Do you follow the reasoning for why they set it up this way? The comments in this function from _xorg in keyboard make it seem like it expects K1 K2 K3 K4.

     python
        
    #: Finds a keycode and index by looking at already used keycodes
            def reuse():
                for _, (keycode, _, _) in self._borrows.items():
                    keycodes = mapping[kc2i(keycode)]
    
                    # Only the first four items are addressable by X
                    for index in range(4):
                        if not keycodes[index]:
                            return keycode, index
    
    
      

    I assume that second comment is the reason the person who wrote your function likes the number 4.

    Which way is right/wrong here? It would seem at least part of the issue to me is that they don't make the list be K1 K2 K1 K2 as they say, since the function I quoted above often receives a list formatted like K1 K2 K1 NoSymbol.

    Also, if I modify the function you quoted from to remove the duplications, I'm still finding that the first element is always duplicated to the third element anyways - it must be happening elsewhere as well. Actually, even if I modify the entire function to just be something nonsensical and predictable like this:

     python
        
    def keysym_normalize(keysym):
        # Remove trailing NoSymbol
        stripped = list(reversed(list(
            itertools.dropwhile(
                lambda n: n == Xlib.XK.NoSymbol,
                reversed(keysym)))))
        if not stripped:
            return
        else:
            return (keysym_group(stripped[0], stripped[0]), keysym_group(stripped[0], stripped[0]))
    
      

    then the behavior of the output doesn't change at all from how it behaves when this function is how it normally is... It still messes up every third special character, duplicating the previously encountered special character

    Later edit: After further investigation, the duplication of the first entry to the third entry seems to happen in the Xlib library, installed with pynput, in the display.py file, in the change_keyboard_mapping function, which only has a single line. Inspecting the output of the get_keyboard_mapping() function both before and after the change_keyboard_mapping function does its thing shows that it jumps right from [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] to [keysym, 0, keysym, 0, 0, 0, 0, 0, 0, 0]. It's still unclear to me if this is truly intended or a bug.

  • Gonna make some notes since I made some progress tonight (so far).

    Within pynput's keyboard's _xorg.py file, in the Controller class, self._keyboard_mapping maps from each key's unique keysym value, which is an integer, to a 2-tuple of integers. The actual keysym for each key in the mapping appears to be correct, but occasionally the 2-tuple duplicates that of another entry in self._keyboard_mapping - and these duplicates correspond precisely to the errors I see in pynput's outputs.

    For example, '𝕥' has keysym = 16897381 and '𝕖' has keysym = 16897366, but both 16897381 and 16897366 map, in self._keyboard_mapping, to the 2-tuple (8, 1) - and '𝕖' is indeed printed as '𝕥' by pynput. (𝕥's keysym appears first in self._keyboard_mapping). (The 2-tuple keysyms map to are not unique or consistent, they vary based on the order they were encountered and reset when X resets)

    Through testing, I found that this type of error happens precisely every third time a new keysym is added to self._keyboard_mapping, and that every third such mapping always duplicates the 2-tuple of the previous successful mapping.

    From that register function I mentioned, the correct 2-tuple should be, I believe, (keycode, index). This is not happening correctly every 3rd registration, but I'm not yet sure why.

    However, I did find a bit more than that: register() gets its keycode and index from one of the three functions above it, reuse() borrow() or overwrite(). The problematic keys always get their keycode and index from reuse - and reuse finds the first unused index 0-3 for a given keycode, then returns that. What I found here is that, for the array keycodes, the first element is always duplicated to the third position as well, so indexes 0 and 2 are identical. As an example, here are two values of keycodes from my testing:

     python
        
    keycodes = array('I', [16897386, 0, 16897386, 0, 0, 0, 0, 0, 0, 0])
    keycodes = array('I', [16897384, 16897385, 16897384, 0, 0, 0, 0, 0, 0, 0])
    
      

    With this in mind, I was actually able to fix the bug by changing the line for index in range(4): in reuse() to for index in range(2):. With that change my script no longer produces any incorrect characters.

    However, based on the comments in the function, I believe range(4) is the intended behavior and I'm just avoiding the problem instead of fixing it. I have a rather shallow understanding of what these functions or values are trying to accomplish. I don't know why the first element of the array is duplicated to the third element. There's also a different issue I noticed where even when this function returns an index of 3, that index of 3 is never used in self._keyboard_mapping - it uses 1 instead. I'm thinking these may be two separate bugs. Either way, these two behaviors combined explain why it's every third time a new keysym is added to self._keyboard_mapping that the issue happens: While they in theory support an index of 0 1 2 or 3 for each keycode, in practice only indices 0 1 and 3 work since 2 always copies 0 - and whenever 3 is picked it's improperly saved as 1 somewhere.

    I may keep investigating the issues in search of a true fix instead of a cover-my-eyes fix.

  • I agree and appreciate it. I've been trying to figure it out myself but feel a bit out of my element.

    What I've found is that in pynput's keyboard's _xorg.py file, the Controller class's self._keyboard_mapping seems to map some different keycodes to the same value, and that seems to correlate exactly with the errors I'm seeing. I haven't figured out why yet. I got to thinking it had something to do with the register function in the _resolve_borrowing function but I forget why and I'm too tired to continue for now. I'll continue tomorrow though.

  • Hey! Sorry for the very late reply. I've been checking the thread regularly and I swear just a few hours ago (when I made the cross-posts) it was still at 0 replies. I'm gonna blame federation issues.

    The command you provided does indicate I'm on pynput 1.8.1, so I can confirm v1.8.1 has the issue.

  • I absolutely hate this title. The first 70% gets you so excited.

  • I'm a little out of the loop on how reddit's been. Is blocking links to X officially no longer allowed there?

  • Is there confirmation that he actually specifically wanted that image off reddit? Or is this just someone making assumptions after the recent story about him interfering with moderation at reddit?

  • Deleted

    Permanently Deleted

    Jump
  • My random username generator

  • Bidet

  • For anyone who didn't click through to the article, here are pictures of the two posters in question. She wasn't asked to remove anything else. The article made clear this wasn't a situation where the school backed down after pushback, and that even after prolonged meetings and discussions with legal counsel, they're still threatening her with repercussions if the posters aren't removed by the end of the school year.

  • old.lemmy.world##div.post:has(div.rank):has-text(/Trump|Elon|Musk|nazi|maga/i)

  • I'm in firefox + uBlock on lemmy.world too, and it works fine for me - I can see on my current front page 2 posts are being blocked and the rest are showing up. Do you have any other uBlock filters going on? Are you on some page other than the lemmy.world homepage? Are you using the default UI or one of the alternate UIs?

  • What an insightful post 🙂

    The only one of these I've updated since the original is the one for Ars Technica, which is now this:

    arstechnica.com##:not(:not(head>title:has-text(/Serving the Technologist/))) article:has-text(/Trump|Elon|Musk|nazi|doge|maga/i)

    The reason being that 'Ars Technica' now appears in the title of articles, while it didn't originally, which caused the original filter to block out entire articles. 'Serving the Technologist' only appears on the homepage so this updated filter will still filter the homepage but display the contents of articles that contain blacklisted words.

  • Or averages, it seems to be absolute counts each day

  • And it's so annoying to hear the excuse "BEcaUsE tHe sWITCh iS aN UNDErpOWeRed SYsTEm" when the Switch's launch title was Breath of the Wild.