#🤖│community_dev

1 messages · Page 6 of 1

low pawn
#

oh tailscale is for different use

quick bough
#

We may be able to help each other superwoke

low pawn
#

vpn as in actual network, not just a proxy

#

@floral crane thanks for helping with this

#

synchronization is bad because I had to play the video and run the command at the same time
the flickering is not visible to my eyes, so may be camera things

quiet root
#

arent they like 700-900usd a year basically

quick bough
#

Pretty neat

floral crane
#

Windscribe is a VPN, it has desktop programs, browser extensions, other various things like OpenWRT, support OpenVPN, and WireGuard. but I don't know what Talescale is

quick bough
low pawn
#

tailscale is an overlay network to connect devices together

quick bough
#

basically, a company that is registered in a proper company register

low pawn
#

the clients for linux are open source and there's an open source server reimplementation, but the official one is free for 100 devices so that's fine too

quick bough
#

otherwise you can't get a code signing cert as far as I understand it

quiet root
#

so just setup one up

quick bough
#

really don't wanna

#

it's a privacy liability

quiet root
#

everything is lol

low pawn
#

basically, I can type my server's hostname from my phone or laptop and it will just work, tailscale will connect them either directly if it can or via one of their proxy servers, but the traffic is not metered and they can't see it as it's built on wireguard

quiet root
#

i thought tailscale is just a vpn

low pawn
#

well, yeah

#

wireguard is also just a vpn

#

that's what VPNs were used before everyone started the whole vpn = privacy proxy thing

quick bough
#

So, tailscale is just STUN/TURN as a service? lol

low pawn
#

basically yeah

#

just that it's not a hassle to always setup

#

really just a convenience service, but their free tier is basically always free for personal use, they're making money off companies

quiet root
#

only vpn i ever had was my router as vpn so i can just sit in my home network when needed

low pawn
#

yeah

quiet root
#

not like i needed it

low pawn
#

but I can also connect to my VPS, home server, etc from phone from anywhere without having to set up ip addresses etc

quiet root
#

i can also do that since they have public hostnames

#

lol

low pawn
#

also used to connect to my laptop from phone when I needed to remote into it, when both were off my home network

#

also they have really nice blog posts

floral crane
#

Hmm vmware doesn't let me pass in my keyboard... I guess I'm trying virtualbox or hyper-v

quick bough
floral crane
#

keyboard doesn't show up for me, just everything else

quick bough
#

Weird

floral crane
#

Virtualbox is so much slower... insane, but it shows my keyboard

floral crane
#

TIL Appimages require libfuse2 which isn't pre-installed on Ubuntu

#

You also have to run the appimage with sudo and --no-sandbox for the automatic udev rule creation

#

and virtualbox fails to pass through my keyboard... lets try hyper-v

floral crane
#

I found a setting to show all usb devices in vmware, and virtualbox requires disabling hyper-v, windows sandbox, device core isolation integrity, turning off any wsl 2 instances, and hyperv bcd boot setting thing. otherwise it uses software virtualization which is slow, but doesn't say that anywhere.

floral crane
#

Actually, it looks like VirtualBox is not compatible with WSL2 anymore because WSL2 requires the hypervisor launch type BCD setting to be auto now, not off... so VirtualBox is out on a Windows host, VMware only.

#

I finally got a vm to work and pass through my keyboard (vmware), but the automatic udev rule creation requires sudo/root but running the appimage with sudo/root causes a white screen. Maybe wootility could use pam/polkit thing to ask for privileges

quick bough
#

I created the udev rules myself on my VM

#

I don't think they are the issue, since your lib doesn't recognise the devices even with them installed

low pawn
#

Try the clib directly, but yeah it's weird that the same library doesn't return the same results..

quick bough
#

I don't understand Rust well enough to understand the semantics of using this "dynamic link library", because by all known laws of dynamic linkers, this program should not start at all.

low pawn
#

Maybe that lib is installed statically, or via GH?

torpid fox
low pawn
#

a library used from rust that should be dynamically loaded is not working, yet using that same library directly from rust works

#

which is really great explanation I know

#

there's a wrapper rust library around a C library, that C library works even when used from rust, but that wrapper library doesn't

#

yet it doesn't error out and works on windows

torpid fox
low pawn
#

yeah

#

it should be the same version though, as shay maintains both the library on AUR (which works) and the crate (which does not)

torpid fox
#

Weird, I don't have enough information to make a guess as to what's actually happening though

floral crane
#

I'm not really sure why it doesn't work either, I thought it might be libusb/hidraw/hidapi related but trying the system libusb or hidraw with the env instead of having it build from source doesn't make a difference

#

It's strange especially when it works on windows (and I think mac, I think Tony tested WPS on mac)

#

The AUR package is a version behind from the crate because it builds from source, but shouldn't matter. The other difference is that the link macro is dynamically linked, it requires the files with the binary while the crate is statically linked, they're built-in to the binaries.

EDIT: At this point maybe it's just easier to rewrite wooting-rgb as a purely native rust lib instead of bindgen, rgb sdk is small enough I could do it.

fallen surge
#

I'm not sure if this is discussed already but when I'm setting up my DKS, I noticed that the end of the actuation is set to 3.6mm. Is there going to be update where the end of the actuation point can be adjustable like in the case of the start actuation point and up to 4.0mm.

low pawn
floral crane
#

yeah that's usually my goto

#

I probably won't, that's a lot of work and I have little free time/no motivation to do it, but it would be fairly easy to remake it in native rust without system libraries like hidapi/libusb/hidraw/libclang, actually chatgpt could probably do it lol.

quick bough
#

Or you could write your app in C++ and not deal with the "magic" nature of Rust.

floral crane
#

C++ is magic to me, it's a mystical monster I'm not learning

quick bough
#

Yeah, Rust is quite a mystical monster to me too, but slowly and surely I understand.

#

And it seems very bad to me, coming from C++. I really don't get why people jump from C to Rust instead of C to C++. C++ solves most issues and it's backward-compatible with your old code. Like, properly backward-compatible.

floral crane
#

I've never understood pointers which were probably the biggest hurdle to C/C++ for me, I sorta understand them conceptually now because of Rust, but at the same time why that's a commonly used part of the language astonishes me, they're dangerous foot guns

quick bough
#

Raw pointers are not commonly used in C++ at all

#

Anyway, I just decompiled the thing I built on Linux. Apparently it didn't dynamically link the lib at all, it statically linked it.

#

That explains how the program can run, I guess.

floral crane
#

I like not having to setup gcc/make, clang/cmake, vs/msvc, xcode, all that stuff is just handled for me, dependencies and libraries are easy to use without having to compile them as part of my own project or link to them. there's a bit of that still with rust cause of C libs

quick bough
#

This lib version should definitely work, too.

floral crane
#

memory is managed for me so I don't create memory leaks cause I don't know how to do that, I don't have to use a debugger for segfaults all the time, etc

quick bough
#

Yeah, you don't leak memory because of RAII, a concept borrowed from C++.

floral crane
#

What's RAII

quick bough
#

Constructor acquire, destructor release

floral crane
#

again, never touched C++, I know the newer ones are better than the more commonly used older versions and has nice features, but even trying to get a single cross platform C++ project hello world to build is a hassle for me.

quick bough
#
#include <iostream>

int main()
{
    std::cout << "Hello, world!" << std::endl;
}
clang -o hello.exe main.cpp
floral crane
#

I think I have a C Makefile saved somwhere for gcc

#
SOURCES  := $(wildcard *.cpp)
OBJECTS  := $(patsubst %.cpp, %, $(SOURCES))
CXXFLAGS += `pkg-config --cflags fmt` -std=c++20 -O3 -pedantic -Wall -Wextra
LDLIBS   += `pkg-config --libs fmt`

.PHONEY: all clean

all: clean $(OBJECTS)

clean:
    $(RM) $(OBJECTS)

%: $.o
    $(CC) $(LDLIBS) $< -o $@

%.o: $.cpp
    $(CXX) $(CXXFLAGS) $< -o $@
#

I read the entire makefile docs to make that, and had a friend that knows the stuff help refine it

quick bough
#

I admit, I don't really like Make and all these build tools. I either use Visual Studio for most of my builds on Windows, or my own build system for builds on any platform.

#

The tooling around C/C++ certainly isn't that great, but it's not like insane people like me haven't been there before and made decent enough tooling to use for various jobs.

floral crane
quick bough
#

Yeah, this make stuff looks like aids

floral crane
#

If I had added a GUI to that version it would have been Qt, but that also uses cmake and I tried setting that up, the docs are bad.

#

I think there's a package manager vcpkg but I never tried it

#

If they focused on creating a better out of the box beginner friendly user experience, one command to install everything you need: compiler, build system, package manager, formatter, linter, everything cross-platform without having to deal with 5 different systems, and pre-configured for you. I come from JS/TS/PY and most people are learning higher-level first instead of C/C++ first and taking a class on it.

#

Hmm, I could probably just write C++ and use rust/cargo to build C++ with bindgen/cxx or something, basically a rust wrapper around a C++ project would be the best of both worlds...

quick bough
#

I would certainly not recommend C++ to biggers. I think it's good to start in a higher-level language, and when you understand programming well enough, and you reach the point where high-level languages are too abstract/high-level to get your work done, you can move on to C++.

#

I think you also need to be a bit of a perfectionist to use C++ correctly, because sometimes you can make stupid mistakes, and it is up to you to be a very harsh critic of yourself and your code.

low pawn
#

Being backward compatible is not the save all be all I think

#

also, you can use C code from rust and expose rust to C code just fine too

#

sure, you have to redefine the functions you use, but there are libraries that can do that for you (bindgen)

low pawn
# quick bough Constructor acquire, destructor release

Are you sure that's all though? C does free your stack memory too, just because the CPU does it by itself. From what I understand from this chat (and very narrowly checking c++, not even using it that much), it just adds destructors to freed memory.
But what if you write it to heap? When will it release that heap memory?

#

Like if you want to transfer that heap memory to a library and let it manage that, it shouldn't be cleared when your function exits

#

but then, if it's not, how does it know when to free it? I think it does not and you have to call free

#

but then you always have to remember to free your memory

#

or use Rc

#

but then you can't have cyclic dependencies, which is needed for GUI and etc, which can be 'defeated' by using weak pointers

#

but then you forget to check that the weak pointer still exits and you get either a segfault (the good ending) or random memory garbage (the bad ending)

#

that's not to say it's bad, I use Rc even in rust as it's still required to allow multiple owners, but it makes my life easier (on the cost of having to bear the pain of lifetimes and borrow checker)

#

also rust errors (except the cargo one you got earlier, that was the most confusing rust error I've ever seen) are generally really good. It will often just straight up tell you how to fix it, especially when the language wants you to be explicit about something (or to 'fix' your habits, for example if you write fn test(): bool it will show an error about it wanting to have -> instead)

quick bough
#

Yeah, C++ frees your heap memory, too, if you use unique_ptr, or shared_ptr (which is similar to Rust's awfully-named Rc and Arc).

low pawn
#

I don't think they're awfully named

#

if they're the same, what's unique ptr about? It's not even unique

#

uniquely bound to single thread? maybe singlethreaded_ptr ???

low pawn
#

You can find some bad namings or non-obvious names, I don't think rc is one of them

#

btw I'm not advocating rust is perfect, just that it might be a better choice for someone
also I'm learning some things about cpp from this chat as well, so thanks for that

quick bough
#

unique_ptr means only a single owner basically

low pawn
#

so it's not Rc

#

wait single owner at all times?

#

that sounds like a borrow checker

#

except, weird

#

ohhh

#

smart pointers

#

that really does sound like a borrow checker within cpp

#

hm

low pawn
# low pawn so it's not Rc

I misunderstood your message before, now I think I understand it
unique_ptr is the same as owned object in rust
shared_ptr is a reference counted object

#

except it doesn't require mutex for shared access

floral crane
#

After learning everything there is to know about Rust (I still haven't) I could see learning C++ being much easier. I wouldn't use it for a new project, but I could see being able to edit an existing project would be a nice ability.

low pawn
#

I wonder what do you think you missed about rust, at least core rust itself

#

especially since you already used bindgens and externs.
macros maybe?

quick bough
# low pawn but then you can't have cyclic dependencies, which is needed for GUI and etc, wh...

I don't get how this can ever be an issue if you have a clear idea of how your structures are supposed to work. For example, if you have a tree structure and you need a parent-pointer, it's alright to use a raw pointer, because you know a parent owns its children (e.g. in a vector of unique_ptr), so the lifetime semantics are very clear — the parent will always outlive the child, even if only by a few ns.

low pawn
#

yeah and then you move the child to a different parent

#

it's more like rust forces you to check everything while cpp let's you have your own fun

quick bough
flat wigeon
#

Somehow I just imagined moving a button from one window to another

quick bough
#

What lol

floral crane
low pawn
#

I should have used syn lol
I was like naah I'll use std rust that will be fine
1000 lines later it was not fine

quick bough
#

What were you trying to do?

low pawn
#

svelte is a great thing, but there's not really a good ui lib in rust

#

so uhh

#

I'm trying a bit

quick bough
#

Ah, web dev and Rust, just the things I am absolutely clueless about

#

Well, okay, I know you can deploy HTML, CSS, and JS on a web server and/or CDN

#

but that's not cool

#

We need more abstraction, more boilerplate, and more overhead

quiet root
#

the idea to use a higher level lang to generate HTML and poop out all the stuff is to write less code and not have rigid HTML files you need to hand write and maintain

quick bough
#

Wait, seriously, people think HTML is the problem in web dev?

#

Like, HTML is the chill part. CSS and JS is where the pain starts.

quiet root
#

well people started using js to make html more dynamic

quick bough
#

We had a tool for that, it was called PHP

quiet root
#

which

#

is the exact same as using node or rust or c#

#

you have a higher level lang (in this case interpreted) generating html with its js and css

quick bough
#

Oh, so it's like a CMS or templating engine?

quiet root
#

well no a cms would be sort of a meta construct build ontop of PHP, node or whatever lang you use to more dynamically crank out html while maintaining some form of database which can be used by the same underlying language to serve html

#

a templating engine is just used by said same programming languages to well template html for easier reusing of parts

#

the problem we tried to solve was how rigid html itself is

#

and we cant solve everything with clientside js

#

everything you currently use on the web is (most likely) completely impossible with just html and css

#

despite those 2 technically being turing complete

quick bough
#

I mean, I think PHP can replicate everything JS can do, just with more latency and wasted server resources...

quiet root
#

well no it can do more

quick bough
#

DOM-wise, anyway

quiet root
#

even DOM wise as you technically can spit out no script tags at all

#

the advantage is just a clear split between server side and client side data

quick bough
#

I really feel like web dev is going in circles

quiet root
#

well that depends on who you ask and what level of webdev they do

quick bough
#

I'm sticking to uploading HTML, CSS, and JS to my Linux VPS thank you very much

quiet root
#

that can only do so much though

quick bough
#

It can do literally everything

quiet root
#

and its sort of like saying well i can type my word documents on dos 3.1 thank you very much

quiet root
quick bough
quick bough
quiet root
# quick bough What can it not do?

i mean how about you try building a cms with just those 3 and keep in mind you can only use html, css and js files no rest servers or such

#

or better yet rebuild uwuting.com with just those 3 things

quick bough
#

Well, technically could do it with NodeJS

quiet root
#

thats not webjs

quick bough
#

but I would typically use PHP for the API routes

quiet root
#

so you waste the same resources you didnt like being wasted for spitting out html

quick bough
#

There's a difference

#

API routes are not the hot path

quiet root
#

so?

quick bough
#

Is it meant to look like this?

quiet root
#

your browser doesnt know emojis

#

apparently

quick bough
#

No it does know emojis, just not this one apparently

quiet root
#

it has to

#

its a default flag emote

quick bough
#

I am on Chrome 118 on Windows 10

quiet root
#

🇺🇸

#

literal default utf8 emote

#

for years now

quick bough
#

That looks fine, but also Discord uses (their own fork of) Twimoji to display them client-side

#

because they're not (that) stupid, they know emojis aren't universal

#

Is interesting, it literally doesn't show up

quiet root
#

anyway html, css and js cant solve everything on their own and as soon as you have to involve an API you may as well use PHP, nodejs or whatever

quick bough
#

Well, yeah, but the frontend can easily be done in HTML, I don't see the issue with that

quiet root
#

the issue is i dont want a slow af mobile device to chug js

#

my server has 0 issues running a loop and concating some strings and spitting out html

#

in less than a few ms

quick bough
#

My server has no issue running Apache2, serving static HTML files in less than a few ms

quiet root
#

ok so what if the client now takes a second or 2 running whatever js bloat file you send over with hundreds of kb

#

thats whats killing the web

#

everyone stuffing their mom and grandma into js

quick bough
#

There is no JS bloat on my websites

quiet root
#

and massive css sheets

quick bough
#

jQuery at worst

#

jQuery makes JS so much better to use tho so its worth it

#

Also far from a bloaty framework

quiet root
#

welp i dont need it at all

quick bough
#

Yes of course

quiet root
#

ok how much more does that website do than your js

#

not to mention i try reducing clientside js as much as possible moving to server side rendered as much as possible

quick bough
#

Well, let's see, I have 0 JS files loaded on my websites

quiet root
#

ok

#

how many dynamic content tables do you have

quick bough
#

(I use inline <script> tags)

quiet root
#

which doesnt make it better

quick bough
#

For once-off stuff, it works

#

At most 1 JS file for common stuff

quiet root
#

wheres this website

quick bough
#

Not relevant to the discussion

quiet root
#

i mean you seem to have high claims that your website can compare to youtube and twitch and co without using server side rendering

quick bough
#

I'm not saying it is functionally identical to either of these sites

quiet root
#

it will never be

#

your argument was it could

quick bough
#

I think I could make services functionally identical to Youtube or Twitch using my principles

quiet root
#

the limitation is that html5 and css can do a lot but not everything

quick bough
#

but one of my principles is "don't burn money", sooo 😄

quiet root
#

a poc doesnt require burning money

quick bough
#

Well, for a proof-of-concept, I could cheat a bunch

#

but actually making a streaming service, or hosting tonnes of videos with acceptable streaming speeds

#

hayyeelll noooo

quiet root
#

dont need to host a bunch

#

3 or 4 videos on disk, a few million randomly generated entries all linking to one of those at random

#

and then limit people to upload 10mb or so at best

#

then you can have a solid poc that demonstrates you can replicate this

quick bough
#

If I'm not gonna give it my best, why bother at all

quiet root
#

not to mention google would prob pay well if they can reduce all the processing they do to spit out html

quick bough
#

I think they know they can, they just rather hire incompetent people with their fancy JS frameworks because they're more plentiful

quiet root
#

so

quick bough
#

I mean why do you think people hire Rust devs? It's not that C++ is worse, it's that it's harder to find good C++ devs.

quiet root
#

they spend more money

#

to save less

#

despite the option to spend more and save more existing

quick bough
#

Rust may add bloat, but it removes human error, making it a better choice for a company

quiet root
#

i still dont know how they add bloat

quick bough
#

But I think the Youtube homepage is pretty optimised anyway

#

I mean, I don't know the specifics of their tech stack, but I highly doubt it's a lot of effort for them to serve it

#

They probably squeezed every metric as far as they could without compromising important values

quiet root
#

its not a lot of effort for anyone to serve dynamic html out of a webserver

#

you just throw out slow stuff like apache2

#

and then youre already good

quick bough
#

Apache2 is fine for a hybrid web server

#

NGINX is good for static content, poo for dynamic tho

quiet root
#

just use caddy and be done with either

quick bough
#

Isn't that just an NGINX fork?

quiet root
#

dont even think about lighttpd

quiet root
#

and not forked from nginx

#

then yes

quick bough
#

Love the sarcasm

quiet root
#

idk if anyone wants to fork nginx

quick bough
#

Might have to try caddy some day

quick bough
quick bough
quiet root
#

didnt cloudflare make pingora

#

a 100% custom rust webserver

quick bough
#

It's a proxy

#

but I guess they're replacing it with NGINX

#

about time I guess lol

quiet root
#

if i ever get around to it ill flip my private root to use caddy just cause its so much nicer

#

including the fact it talks REST for reconfiguring it

quick bough
#

Hmm, interesting

#

I'm still stuck on developing my own DNS server, so getting to HTTP might take a hot minute

#

At least my DNS server can issue TLS certs, that gotta count for something, right cat_holdingbacktears

quiet root
#

i assume all using your own self developed programming language

quick bough
#

No, using C++

quiet root
#

well now im disappointed

quick bough
#

I gotta get shit done lol

low pawn
low pawn
quiet root
#

but but $

#

jquery so good

#

oh and a lot of lodash ofc

low pawn
#

oh yes lodash everywhere my beloved

quiet root
#

i think lodash has like 1 or 2 functions i find useful but its nicer to write them myself lol

low pawn
low pawn
quiet root
#

anyone with some knowledge of js can

low pawn
#

yeah

quiet root
#

same for making a custom $ var to replace jquery

low pawn
#

well, tbf that $ is overloaded, which I don't think is great but may be useful for someone I guess

#

like you can select elements or create them

quiet root
#

yeah but who uses all of that

low pawn
#

yeah

quiet root
#

i think most people use the select itself

low pawn
#

I dunno I didn't use jquery that much, just when starting with JS (after learning PHP), then migrated to using svelte

#

but yeah

low pawn
quick bough
low pawn
#

fair

#

I'm kind of on the other side of the spectrum, using a full framework with lots of JS everywhere

quiet root
#

im still trying to fiddle out moving as much as possible server side

low pawn
#

but I think if you spend a bit on optimizing stuff you can still get away with it

quiet root
#

but my bane rn is form validation

low pawn
quick bough
low pawn
#

yeah, especially when the tooling is great

#

you can also just build a static site without js with the same tooling

#

then it just helps with organizing files

quick bough
#

I just have a really hard time accepting abstractions that are not solving any of my problems and just seem to add more complications, bloat, and boilerplate

low pawn
#

I just like websites that are fast, and JS does help with that

low pawn
#

but I think if the boilerplate is hidden, or is generated automatically then it's fine

quick bough
#

Then the boilerplate is called bloat 😛

low pawn
#

hm

#

what OS are you running again? :P

#

especially since all modern computing is abastraction over abstraction all the way down

quiet root
#

prob non gentoo

quick bough
#

Windows 10

#

The best desktop OS currently available

quiet root
#

i would disagree

#

id agree on gaming os

low pawn
#

I mean even x86_64 instructions is only an abstraction, as the cpu has microcode that translates the instructions to 'real' instructions

quiet root
#

but i do prefer macos for anything else really

low pawn
#

so you have bloat at the cpu level

quick bough
low pawn
#

lighthouse

quiet root
#

i assume google page insight

#

yeah

low pawn
#

yeah page insight uses the same except it runs on google servers, lighthouse runs on your machine

#

it's built into chrome devtools, and available as a command (though I never used the command)

quiet root
#

the only thing i dont like about pageinsight is that it always without fail recommends using next gen image formats

#

even if they just save 1 or 2kb

#

its like why flag something for that

low pawn
low pawn
#

they like to push webp

#

(after dropping support for jpegxl)

quick bough
#

Damn, my website does not seem very accessible

low pawn
#

nice perf

quick bough
#

idk what these seconds are

low pawn
#

I didn't compress small images enough (I think it's like 300kb)

quick bough
#

the CDN delivers the content in like 60 ms, it can draw basically instantly

low pawn
# quick bough idk what these seconds are

expand view shows more details
TLDR
FCP -> first draw on website that has real content
LCP -> largest drawn object
blocking time -> main js
layout shift -> how much the site moves during load
speed index -> I think that's until the page loads almost fully, but I'm not sure

quick bough
#

I mean, my website loads in like 300 ms tops

low pawn
#

did you not compress your images?

quick bough
#

That's based on human feel

#

but I would feel a second

low pawn
#

ooh wait

#

in the main page switch to desktop

#

you may be measuring mobile which is rate limited to 3g speeds

#

so that shows it would load in 2s under 3g

quick bough
#

Better, I suppose

low pawn
#

yeah that seems more like it :D

quick bough
#

Still a bit odd

low pawn
# low pawn

see and here I have almost the same timings except LCP, which is because the main image takes half the screen and half the bandwidth for that

quick bough
#

but, well, this is basically as close to bare HTML and CSS as it gets, the only JS on this page is a small <script> tag, lol

low pawn
#

and it's basically as far from bare HTML and CSS as it gets

#

a SPA with transitions between pages, animations, etc

#

yeah

quick bough
#

SPA is nice, but also adds overhead when loading, right?

low pawn
# low pawn

my FCP seems to be lower, although that might be difference between our internet etc

#

also, there's hydratation - the website is fully rendered as html and css which the browser can show, and then once that is shown the JS is loaded in the background to make it react to user events

#

my website should work almost as is without js, just without animations

quick bough
#

Hydration is a word I've heard of

#

And I have no idea what it means

low pawn
#

basically it's what you're doing

#

you ship HTML and CSS to the client as you normally would

#

but then JS is loaded in the background and takes over the website once loaded, acting as SPA from this point on

#

so you have the load speed of SSR with interactivity of SPA

#

here it means that my website is fully static (it's built once into HTML+CSS+JS) and works without JS, but if you have it enabled you'll see animations, faster loading (as it loads only content that it doesn't already have instead of the whole DOM) and more interactivity

quick bough
#

So, hydration is the process of loading a (hopefully) small script that handles SPA logic?

quiet root
#

i mean you can hydrate 10mb of js if you want

quick bough
#

I really don't want to

quiet root
#

but usually you hydrate bits and pieces as needed

low pawn
#

well, normal SPA loads only that javascript with no content to be shown if you don't have js

quick bough
#

I don't even wanna think about 10 mb of JS in general

#

That is too much code in a bad language

#

Write it in C++, compile it to WASM, jfc

low pawn
#

think of

<head><title>something</title></head><body><script src="./spa.js" /></body>
quick bough
#

No defer?

#

Oh, right, no, that's bad

#

but I think I get it

low pawn
#

why? there's nothing to be shown anyway

#

hydratation is a mix of both

#

basically something framework people invented to make it behave more like le olde php sites with javascript

quick bough
#

I don't really like making SPAs since I find the overhead of loading a new page is minimal anyway

low pawn
#

but once initially loaded, clicking on links doesn't reset browser state like it would normally, but JS takes over and only replaces stuff that changed

quick bough
#

but I can appreciate it I suppose

low pawn
#

yeah but you can still see your navbar without it moving around etc

#

and you can have cross-page transitions

low pawn
quick bough
low pawn
#

yeah

#

but it's not portable yet

#

not sure if it's even available to normal clients, it was under a feature flag until very recently

quiet root
#

i really dont know if the trend of have css fix a lot of "issues" is good

quick bough
#

I think the behaviour of having the new page load and then replacing the view works fine

#

e.g., navbar stays put

low pawn
#

I think css is a great programming language

quiet root
#

all my homies code in css

low pawn
quick bough
quiet root
#

so no real workload in the sense of having performance improvements or impact

low pawn
#

I think wasm is nice and has a good future, but currently it seems it's more supported outside the browser than in it, thanks to cloudnative folks

quick bough
low pawn
#

it is supported, but you can't change DOM from inside it, memory management is iffy, and communicating with JS is not that good either

quick bough
#

Plus, code reuse is always good

low pawn
#

yeah, that's why I use sveltekit for both FE and BE :)

quick bough
#

The same code I use to generate QR codes on my Windows app can also generate QR codes on my web apps. 10/10.

low pawn
#

you could also save time by using existing libraries

quick bough
quiet root
#

here we go again

quick bough
#

We building software CAPITAL, not a software CITY.

#

(Bad pun)

#

(idk if you guys are familiar with the concept of software capital, it might be a niche idea)

#

(it's basically the opposite of tech debt)

low pawn
#

I only ever heard of tech debt

#

because all code is bad and there should be the least possible code in the project

quick bough
#

LOL

#

I wholeheartedly disagree

quiet root
#

i mean thats how AAA games work in 2023 right

low pawn
#

lmao

#

I meant more like, sometimes people tend to over complicate stuff

quick bough
#

More code is generally better, it means more features, more functionality, better software, more desirable software

#

Thing is, people tend to be bad at writing software, they do it too fast, they don't have a clear vision, and they write buggy, unmaintainable messes

quiet root
#

i do like the unix way of making software

#

write 1 tool that does 1 thing very good

low pawn
#

like, writing a website made out of many microservices, a message queue, document database, etc
only for it to be used by about one school

#

it's awful to debug and has a lot of boilerplate for every new feature

quick bough
#

I'm proud of the work I do in C++ tho, all of it. And really, my only regret with it is: not writing more code.

#

It should have more features

#

It should be better

floral crane
quick bough
#

My UwU has arrived cat_smilingimp

#

The default key mapping is "zxc"?!

#

I'm guessing that's a Osu thing I don't understand. Otherwise, missed opportunity to make it "uwu"

quiet root
#

it is the lower left corner of alpha num which osu players use

#

or well most osu players

quick bough
#

Device up to date cat_raisedeyebrow

quiet root
quick bough
#

It says up to date for the "Wooting Two HE", tho

#

(which is not currently connected)

quiet root
#

cause its disconnected

#

we dont check fw of disconnected devices as the cached version is not necessarily whats on the kbd

#

might be good to hide it though

quick bough
#

Yeah, that's what I was thinking

#

Should I open this on wootility-issues? 😄

quiet root
#

will post it internally

quick bough
#

Alright

#

Probably not of any use tho

quiet root
#

for simon to decide

quick bough
#

Simon my beloved cat_holdingbacktears

#

It is interesting tho because in theory, input reports sent while the event listener is not registered should be discarded

#

And it seems like the event listener is only registered when the Wootility expects a response

#

inb4 Chrome bug lol

#

I just realised, both the Wootility and uwuting.com use Chakra UI. I see you, Tony. cutegiggle

quiet root
#

makes sense wootility expects rgb responses cause it sends rgb stuff

#

thats how the realtime preview works

quick bough
#

urg, it seems that while a DKS key is pressed, it eats up any non-DKS key being pressed

#

Can't have my UwU type ">.<" when I smash my hand on it

#

It just types "><"

flat wigeon
#

Well the issue of interleaving comes from not using input reports. I must be carful to not accidently start Wootility while my tool is running. Otherwise Wootility nukes my keyboard config

quick bough
flat wigeon
#

Well or instead of using HID input reports, it would already be sufficient to just have all metadata of the message

#

As far as I remember I have a somewhat wonky detection for unexpected reports

#

Like I expect a certain byte to be zero/non-zero

quick bough
#

Actually, it's even weirder, because WootDevRawReport has no response

#

Yet sending this alone makes it error out

#

Ah wait, no, I do also deinit

#

Right, okay, so I send it WootDevResetAll (D0 DA 20), it responds with D0 DA 20 88. So the Wootility could check byte at index 2 to see if it matches what it expected.

flat wigeon
#

But I'm happy this works: HidD_GetSerialNumberString

#

There are certain vendors which just supply an empty string

quick bough
#

It might not be a vendor issue, I think it's a Windows issue, at least in some regards.

flat wigeon
#

How?

quick bough
#

Any HID connected via BT or BTLE will not have a serial# reported

flat wigeon
#

Okay, BT and BTLE...

#

I was referring to Roccat/Logitech USB-Devices

quick bough
#

Hmm, idk what's up with that

#

Maybe they don't think it's important to make it work via HID

#

My Razer mouse also isn't reporting a serial

flat wigeon
#

Well a mandatory field just added with an empty string... I'm not sure if that was the intention of having it mandatory

quick bough
#

It's not even reporting the vendor + product string on all interfaces 💀

flat wigeon
#

1 c twice?

quick bough
#

Yeah, happens, they have some duplicates

#

On the keyboards it's even worse

#

There are different interfaces with different reports but all the same usage and shit

#

Wooting is spoiling us

quick bough
#

Hmm, the Wooting UwU makes for an excellent Morse Key. Wonder if there's a more efficient encoding than Morse code that can make use of the 3 keys.

#

Well, 3 keys does allow us to press the keys down in 7 distinct ways. If we use pairs of 2, we could have 49 different inputs. Enough for alphanum and some punctuation.

#

Although I kinda like the tree-like nature of Morse code, would be cool if every input was like taking a path down a tree. >.<

quick bough
#

Something like this I guess 😄

flat wigeon
#

Did you ever try C++ modules?

quick bough
#

The key mapping went a bit insane towards the end there, but the most common keys can be typed in only 2 "hand smashes"

#

Ah shit I just realised there's no backspace, that'd be a useful key to have xD

quick bough
#

I managed to mostly memorise the UwU code, got 9.37 wpm with 98% accuracy, although I feel like I'm developing carpal tunnel lol

umbral walrus
#

good job!

cyan saddle
#

A few of things:

  • Could you make a git repo that just has all of the shared object files so it's easy to use with git submodules? (I.E. git submodule add <repo> and friends)
  • What are the terms for shipping the shared object files?
  • Can I just have the shared object files in my public repos?
strong siren
#

we have the binaries checked into git for Artemis and Aurora

cyan saddle
#

There also really should be a way to redirect the stderr output because I have my own logger in this program. .-.

quick bough
#

You can use the RUST_LOG environment variable to put a leash on that, e.g. use "off" to disable it.

#

I must admit, tho, the logging is really silly for a shared library.

cyan saddle
#

I shouldn't have to do such a silly thing for that.

#

I think I'll open an issue about it....

quick bough
#

I already have

#

This is pretty much what I do

#

It just works™

cyan saddle
#

Yeah but I'd have to go in and use more natives for that and it's just a big pain.

quick bough
#

Well, if you wanna be fancy, you can look for a HID device with the Wooting VID, look for usage page 0xFF54, and read the analogue reports yourself 😉

#

but then you're missing out on the vast ecosystem of Wooting Analog SDK Plugins

#

(I at least made one that makes it support the Razer Huntsman V2 Analog keyboards as well)

cyan saddle
#

Oh it's open source but as pointed out it is Rust.

#

Which makes it very hard to submit a PR for. .-.

quick bough
#

But Rust is the best!!! How dare you criticise our beloved crab language!!!

cyan saddle
#

It really isn't "best".

quick bough
#

Don't let them hear that 😉

umbral walrus
#

c# c++!!!!

quick bough
#

C♯? I prefer D♭.

quick bough
#

Speaking of music... Where does F5 and onward go? There's not enough keys on a keyboard to make for a proper piano crybaby

cyan saddle
#

It's only 88 keys.

quick bough
#

At least it's enough to play Auld Lang Syne cat_holdingbacktears

fiery meadow
#

Does anyone know how to fix this?

#

I am trying to manually install the SDK on Arch Linux (There is currently no AUR package)

#

Nevermind, I just read this

#

Is there any example programs that use the SDK and show the current key press status of the keyboard

#

like just how far pressed each key is

#

I guess I could probably make something like that myself, I just wanted to see if I had installled the SDK correctly with something like that

quick bough
placid ledge
#
GitHub

List of awesomeness around Wooting keyboards. Contribute to WootingKb/awesome-wooting development by creating an account on GitHub.

GitHub

Pressure sensitive display for the analog values of your Wooting keyboard! Visit the page to mess around, or add it as a fully functional overlay to your streams. - GitHub - DjCrqss/Woot-verlay: Pr...

fiery meadow
#

I'm currently trying to port https://github.com/DjCrqss/Woot-verlay to Linux, and C# is very confusing. All of the documentation I can find expects you to use Visual Studio and let it handle all sorts of things, rather than using the command line and a normal text editor to do stuff.

GitHub

Pressure sensitive display for the analog values of your Wooting keyboard! Visit the page to mess around, or add it as a fully functional overlay to your streams. - GitHub - DjCrqss/Woot-verlay: Pr...

strong siren
#

you can do everything with a text editor and the dotnet command line utility. from a rough look at that c#, most should be portable to Linux. I'm not sure what the NeatInput.Windows is for though.

#

if you're on arch you can get everything from the aur

#

you'd also need to switch to a different UI framework which might be a little too much work :p

porting to something else might be faster

fiery meadow
# strong siren you'd also need to switch to a different UI framework which might be a little to...

Yeah I was trying to use this: https://platform.uno/ , but I have no clue how the .csproj is suposed to look for this, because all of the documentation just says to setup a project with Visual Studio

Pixel-Perfect Multi-Platform .NET Applications with C# and WinUI for Windows, WebAssembly, iOS, macOS, Android and Linux

strong siren
#

I can't comment on that, I've only used Avalonia for UI on Linux and it's pretty good

#

but i don;t think c# is the right tool for the job

fiery meadow
#

I would prefer to keep in C# because that’s what the original author wrote the project in, and by keeping it in C# they will likely continue to maintain it

#

Although if I were writing it, I would not use C#

#

I have never touched C# before today because it is steeped in Proprietary Microsoft stuff

fiery meadow
#

So, I gave up, and I am messing around with the Wooting SDK in rust now

#

I currrently have this code:

use core::time;
use std::thread::sleep;

fn main() {

    use wooting_sdk::{
        analog::read_analog_key,
        rgb::RgbKeyboard,
        Key
    };
    
    let min = u8::min_value();
    let max = u8::max_value();
    
    // Check how far down W has been pressed..
    match read_analog_key(Key::W) {
        Ok(press_amount) => {
            match press_amount {
                min => { println!("When the key is not pressed :skull:"); /* ..not pressed. */ },
                max => { /* ..completely pressed. */ },
                _ => { /* ..partially pressed. */ }
            }
        },
        Err(error) => { println!("{}", error.to_string()); }

    }
    
    let mut keyboard = RgbKeyboard::default();
    
    // Modify the keyboard array so QWERTY will be set to white..
    keyboard.array_set_full(&[
        (Key::Q, (255, 255, 255)),
        (Key::W, (255, 255, 255)),
        (Key::E, (255, 255, 255)),
        (Key::R, (255, 255, 255)),
        (Key::T, (255, 255, 255)),
        (Key::Y, (255, 255, 255)),
    ]);
    
    // ..and apply the change.
    keyboard.array_update();

    sleep(time::Duration::from_secs(5));
    println!("Hello, world!");
}
#

However, when I run this, I get the error Wooting keyboard is not connected

#

I have a wooting two he connnected , and wootility recognizes it

cyan saddle
#

Dang there's a new model of those things?

quick bough
fiery meadow
#

I already did that, and that’s why Wootility is able to detect it

#

Unless the SDK needs different udev rules than Wootility

quick bough
#

Hmm, no, that should be fine

#

Oh, wooting_sdk... this is not the official one. This is abandonware.

fiery meadow
#

Ah, ok

#

Is there an official rust crate?

quick bough
#

Yes, it should be called "wooting-analog-sdk" or "wooting-analog-wrapper"

fiery meadow
#

Ok, thank you

quick bough
#

So, yeah, that works. Just add this to your Cargo.toml:

[dependencies]
wooting-analog-wrapper = { path = "../Repos/wooting-analog-sdk/wooting-analog-wrapper" }

(Be sure to use a path that matches your setup.)

And then you can use it as follows:

fn main()
{
    wooting_analog_wrapper::initialise().as_ref().expect("failed to init sdk");
    loop
    {
        println!("{}", wooting_analog_wrapper::read_analog(0x04).as_ref().unwrap());
    };
}

(Silly example. In the real world, you'd probably read the full buffer and not just the 'A' key.)

#

This should probably be added to the crates.io repository, tho. Not sure why it's not there.

quick bough
#

I just realised you can just do this:

[dependencies]
wooting-analog-wrapper = { git = "https://github.com/WootingKb/wooting-analog-sdk" }
low pawn
#

hey, that reminds me of something ;)
rust rgb sdk seems to be broken, but you can just use the C lib directly just fine using extern.
the analog sdk, I think, is in rust directly so that should work fine

for example, install wooting-rgb-sdk as a system library (it's in the AUR)

#[link(name = "wooting-rgb-sdk")]
extern {
    fn wooting_usb_find_keyboard() -> bool;
    fn wooting_rgb_array_set_full(colors_buffer: *const u8) -> bool;
    fn wooting_rgb_reset() -> bool;
    fn wooting_rgb_array_update_keyboard() -> bool;
}

for basic RGB functionality. I made a simple app to show images on the keyboard: https://github.com/danbulant/wooting-fun/blob/master/src/main.rs

placid ledge
#

@quick bough I did a bit of a follow-up to your changes to the C Plugin interface as I noticed it caused tests to fail (as the test_c_plugin hadn't been updated). I ended up doing an overall cleanup pass on it, you wanna have a look over it and try it out to see if it works well with your plugin set-up? https://github.com/WootingKb/wooting-analog-plugin-examples

GitHub

Contribute to WootingKb/wooting-analog-plugin-examples development by creating an account on GitHub.

low pawn
placid ledge
low pawn
#

And all other calls are essentially ignored

quick bough
#

Oh, I see now, the way C plugins were supposed to construct a device info was by calling new_device_info. I'm not sure how they were supposed to link against this, tho.

#

So, I guess this is all a breaking ABI change, but I suppose it's for the better.

#

Ah, this also fixes the fact that the test_c_plugin is such a PITA to build btw

#

Yeah, works fine with the new ABI

quick bough
floral crane
placid ledge
quick bough
#

My PRs always making the CI fail cat_sob

placid ledge
#

Yeah, am not sure why it's not triggering the CI in the PR itself, I guess there's something I need to tweak to get it there? Anyway, I think it's erroring now because the generated headers are still referenceing the new_device_info func that you removed, so the generation just needs run again

quick bough
#

You would have to change this to on: [push, pull_request] I think

#

Also my copy of cargo doesn't seem to recognise this command

floral crane
#

cargo install cargo-make

quick bough
#

"Downloading 107 crates" cat_sob

#

The true npm experience

floral crane
#

cargo install cargo-binstall

quick bough
#

?

floral crane
#

binary install

quick bough
#

I don't think I need that?

floral crane
#

no, but you don't have to compile everything

quick bough
#

Meh, might as well make my CPU work for it

#

Anyway, does seem that test-flow also fails on my machine

floral crane
#

binstall is good for workflows to reduce build time (compile time) of dependencies

quick bough
#

I don't get this error: "Bindings changed"

#

I mean, it seems like something needs to be updated for the new bindings... whatever bindings means

grand flax
grand flax
strong siren
#

Ah you want to know if it's actuated as well, that makes sense

#

Yeah I'm not sure if there are easy ways to grab input on Linux, for Artemis I'm parsing dev input directly.

strong siren
#

yeah, i usually tell users to add themselves to the input group. If you have less stupid suggestions i'm all ears. i realise this is not great permissions-wise lol

quick bough
#

Nah, I have no better ideas myself. I think the only way you can get input on Linux is to have a window with keyboard focus and retrieve the events.

#

Which is why I don't bother porting most of my stuff to Linux 😄

strong siren
#

i mainly didnt want to add x11 and wayland separately... the /dev/input was more of a test and it seems to work great

#

having the default user access that file is not great for security though, unsure how to handle that

quick bough
#

I just use X11. I'm assuming that would work with all distros. If not, L to those distros I guess.

strong siren
#

fedora comes with wayland by default nowadays, unsure about other distros

quick bough
#

Hmm, I was just trying to do audio on Linux recently. Had a funny bug where "default" as non-root user would pick a different device that didn't support async

#

but "sysdefault" doesn't seem to have that issue

#

I am also not sure how to reasonably iterate output devices on Linux since ALSA doesn't seem to have the kind of enumerators that Windows has

#

and the "devices" don't have proper names

#

I find Wine to be most impressive. They had to deal with all of the garbage Linux had to offer with audio, input, peripherals, etc. and they had to make it work with apps written against sane APIs.

#

And it's also a great excuse for me to not port my apps to Linux. 😄

#

Although it seems even Wine doesn't have a good alternative for DirectInput

#

It can only say which keys are pressed when a window owned by the app has focus

#

That is so cringe

balmy iron
#

You shouldn't use ALSA directly unless you have a very good reason. Instead target PulseAudio or PipeWire

quick bough
#

Isn't ALSA just a common interface for PulseAudio, PipeWire, etc?

balmy iron
#

X11 allows any client to listen to all input and swallow it. Wayland compositors don't allow this (yet! Hopefully soon the global shortcut portal starts being implemented..)

quick bough
#

I don't think it does, since it only provides input to the window with keyboard focus

balmy iron
#

ALSA is the kernel level interface. If you want to write drivers for your fancy audio device or want the lowest possible latency you want to target it

quick bough
#

Well, ALSA seemed like the easiest way to port my Windows audio stuff to Linux

#

So, that's my reason for using it

balmy iron
#

Wine I don't know what it does exactly, but I know for sure X11 allows global input grabbing

#

For better or worse..

quick bough
#

Do enlighten me as to how one would grab input globally with X11

#

I'd still need to create a window for that to work, tho, right?

balmy iron
#

I don't do X11 stuff so don't ask me

quick bough
#

Alright

balmy iron
#

But probably something with XGrabKey and friends

#

And maybe XSelectInput

quick bough
#

XGrabKeyboard seems interesting, but I think that would yank the keyboard away from other apps

strong siren
balmy iron
#

Yeah right now Pulse is better for wide compatibility

quick bough
#

Why not just use ALSA?

#

libasound just exists so it's all bing chilling

balmy iron
#

Because almost all distros right now use either Pulse or Pipe, so it's better to target those for better functionality

quick bough
#

All the functionality I need is pushing PCM samples, that works fine

balmy iron
#

And if you start using ALSA you either steal a device all for yourself, silencing all other audio, or it roundtrips through the PW/PA ALSA wrapper which... works, ok...ish..

quick bough
#

Hmm, yeah, it does seem like I'm not able to play sound while Chrome is playing sound

#

So, the alternative is to use PipeWire or PulseAudio, but that depends on whatever is installed on the distro?

balmy iron
#

Yeah, target Pulse for wide compatibility, target Pipe if you want to be fancy pants modern

#

Better yet target both

quick bough
#

What a waste of time

#

Literally bothered with ALSA for something that doesn't even work like half the time

#

This is what happens when you don't pay 200 euros for your Windows 10 Pro license. You pay in days wasted.

balmy iron
#

Yeah although to be honest I really like PipeWire, being able to freely plug audio from any app into any app taking audio is nice, not having to worry about any virtual audio cable nonsense

strong siren
#

yeah it's really nice

#

and being able to route audio through effects as well

flat wigeon
#

Is it still crap today?

#

I remember trying... I guess it was Ubuntu a while ago. Per default it came with a non-functional audio mixer.

floral crane
#

PipeWire replicates PulseAudio to the point that Pulse Effects and pavucontrol worked flawlessly on it, so unless you have issues with older hardware and need PulseAudio, I recommend PipeWire.

I would suggest Pulse Effects/PipeWire Effects but since they switched to GTK4 and native PipeWire it's been kinda shit, especially if you use OBS, it's completely broken with OBS, but you can use the old unmaintained PulseAudio version with PipeWire still.

ruby crow
#

What's Up My Wootiggas!

quick bough
quick bough
#

Idk why but this damn SDK is super unstable with init & deinit, but only with wooting-analog-plugin

#

Well, yay for PDBs:

[12/11/2023 02:13:04] ---- ERROR INFORMATION BEGINS ----
Type: Caught ACCESS_VIOLATION while reading from FFFFFFFFFFFFFFFF
Message: Caught an exception.
Stack Trace:
  00007FFBF247AB38 (wooting_analog_sdk.DLL+000000000002AB38): core::core_arch::x86::sse2::_mm_load_si128 in /rustc/db7ff98a72f3e742b641f9cb16d0e8c285e87e9b\library\core\src\..\..\stdarch\crates\core_arch\src\x86\sse2.rs on line 1188
  00007FFBF2470747 (wooting_analog_sdk.DLL+0000000000020747): hashbrown::raw::RawIterRange<tuple$<u16,f32> >::new<tuple$<u16,f32> > in C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hashbrown-0.14.0\src\raw\mod.rs on line 2760
  00007FFBF24755EC (wooting_analog_sdk.DLL+00000000000255EC): hashbrown::raw::RawTable<tuple$<u16,f32>,alloc::alloc::Global>::iter<tuple$<u16,f32>,alloc::alloc::Global> in C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hashbrown-0.14.0\src\raw\mod.rs on line 1428
  00007FFBF2475928 (wooting_analog_sdk.DLL+0000000000025928): hashbrown::raw::RawTable<tuple$<u16,f32>,alloc::alloc::Global>::drain<tuple$<u16,f32>,alloc::alloc::Global> in C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hashbrown-0.14.0\src\raw\mod.rs on line 1454
  00007FFBF246C766 (wooting_analog_sdk.DLL+000000000001C766): std::collections::hash::map::HashMap<u16,f32,std::collections::hash::map::RandomState>::drain<u16,f32,std::collections::hash::map::RandomState> in /rustc/db7ff98a72f3e742b641f9cb16d0e8c285e87e9b\library\std\src\collections\hash\map.rs on line 617
  00007FFBF2454BCA (wooting_analog_sdk.DLL+0000000000004BCA): wooting_analog_sdk::sdk::AnalogSDK::read_full_buffer in C:\Users\Sainan\Desktop\Repos\wooting-analog-sdk\wooting-analog-sdk\src\sdk.rs on line 417
  00007FFBF245AA5A (wooting_analog_sdk.DLL+000000000000AA5A): wooting_analog_sdk::ffi::wooting_analog_read_full_buffer_device in C:\Users\Sainan\Desktop\Repos\wooting-analog-sdk\wooting-analog-sdk\src\ffi.rs on line 326
  00007FFBF245A8FD (wooting_analog_sdk.DLL+000000000000A8FD): wooting_analog_sdk::ffi::wooting_analog_read_full_buffer in C:\Users\Sainan\Desktop\Repos\wooting-analog-sdk\wooting-analog-sdk\src\ffi.rs on line 289
#

If I had to guess, it's a concurrent access into the same map without a mutex?

#

I have no idea, but I love how none of the offending code seems to be in an unsafe block 😄

quick bough
#

The fact that this can even be an issue makes me think that allowing plugins with the Rust ABI at all is not such a good idea. It would probably be best to use the C ABI for all plugins. Would also streamline the plugin stuff a lot, I reckon.

#

Because I am fully unloading the wooting-analog-sdk DLL after deinit, so it's a clean slate. It just seems to be a random thing where the wooting-analog-plugin just crashes on deinit.

quick bough
#

It's WootingPlugin::timer. The mere existence of this introduces like 200 KB of extra code bloat and instability when the plugin is dropped/unloaded.

quick bough
quick bough
#

In this case, Rust the standard library seems to have been modified in a breaking way, yet the dynamic linker did not know anything was wrong so still loaded this faulty code, for it to crash at runtime.

flat wigeon
#

Well... it's not so easy

quick bough
#

Of course, ideally you would use C ABI for the most compatibility anyway.

flat wigeon
#

First you must link to the same standard library

quick bough
#

I mean, all I can say is that I never had this issue in C++. Maybe part of it is because C++ devs don't try to rely on an unreliable ABI, instead using C ABI for compat.

flat wigeon
#

Also... which linker?

quick bough
#

The dynamic linker is a part of the OS

flat wigeon
#

I thought it was about plugins

quick bough
#

It is what makes DLLs/shared objects work

flat wigeon
#

Can you load plugins using the OS linker?

quick bough
#

The OS' dynamic linker is what load plugins

flat wigeon
#

Link?

quick bough
#

Yes, it loads the DLL, maps it into memory, and links it.

flat wigeon
#

I mean URL to the documentation

quick bough
#

As well as some other stuff, dynamic initialisation, exception tables, whatnot

#

Uhh, I don't have a documentation for this

#

Just trust me, this is what happens when you call LoadLibrary LUL

flat wigeon
#

I have a handle

#

I have to get that stuff out of the library myself

quick bough
#

Via GetProcAddress?

flat wigeon
#

Yeah

quick bough
#

Then you're the dynamic linker

flat wigeon
#

Very funny

quick bough
#

I mean the "import" tables are what get resolved by the OS

#

Via the "export" table from the DLL

#

Which is also what GetProcAddress uses to fetch your symbols

flat wigeon
#

Okay, but that's also not an issue for Rust, is it?

quick bough
#

The issue comes when all the dynamic linking succeeds, so your library has successfully loaded, and then it crashes at runtime because of incompatible data

#

Now, in regards to C++. On Windows, this would never be an issue because Microsoft is so anal about compat. On Linux, the dynamic linker will cry because standard library version mismatch and it fails to start/load.

flat wigeon
#

"We've changed this behavior in Visual Studio 2015 and later versions. The runtime libraries and apps compiled by any of these versions of the compiler are binary-compatible."

quick bough
#

Yeah, they do make major version bumps when it breaks

flat wigeon
#

But there are exceptions

quick bough
#

but they haven't made a major version bump since 2015 iirc

#

So I consider it basically a non-issue on Windows nowadays

flat wigeon
#

But it could happen

quick bough
#

It could, but then you would be acutely aware of it

flat wigeon
#

It's probably only stable, because that language is 40 years old

#

That's a lot of time to get is finally stable

quick bough
#

But again, in my C++ code, I have only ever used the C ABI for talking even to other C++ code, simply because it is the most universal, most compatible, and doesn't introduce redundancies by having multiple ABIs.

flat wigeon
#

For Rust it's probably just a matter of time until the ABI becomes stable

quick bough
#

Sure, I don't blame Rust for not having a stable ABI per-se, it's not like they keep it a secret

#

It's just silly that Wooting's plugin system is relying on something so fragile

flat wigeon
#

However I'm irritated, that didn't sort out ABI compatibility. I thought Rust was designed to get away from C++ flaws ^^

quick bough
#

LOL

#

Rust is designed to get away from C's flaws, except C++ already solved all of C's flaws ages ago

flat wigeon
#

Not really

#

Backwards compatibility 😦

quick bough
#

extern "C" cat_yawn

flat wigeon
#

No, not this

#

There are some stupid rules in C++ inherited from C and they can't be changed because of backwards compatibility with old code

quick bough
#

Ah, yeah

#

I mean it's whatever, I don't think it's that hard to write proper C++ if you just familiarise yourself with "What's a footgun and what's not"

flat wigeon
#

I would prefer C++ without the footguns ^^

quick bough
#

I admit, it's funny to say that, but it's pretty easy to tell you're messing up when you're using raw pointers, which is really the only pitfall inherited from C

flat wigeon
#

Raw pointers are okay

quick bough
#

And it's still good that I have access to raw pointers, because sometimes that's exactly what you need, but it's way too easy to misuse them

#

And subsequently leak memory

flat wigeon
#

Some of the implicit conversions are just stupid

quick bough
#

Well, you can have it the other way around, where you only have explicit conversions in BoilerplateLang with .into() 😄

flat wigeon
#

That's not the issue

#

The issue is that rules for implicit conversion are stupid, not implicit conversion itself

quick bough
#

I think they work fine

#

I love implicit conversions and not having them in Rust is a major PITA for any refactor-like task

flat wigeon
#

Again, not implicit conversions are the issue just the rules

quick bough
#

Do you have an example of what bothers you?

flat wigeon
#

Mom

quick bough
#

That's a very German abbreviation cutegiggle

flat wigeon
#

Is it? ^^

#

Implicit conversion from int to bool

#

Implicit conversion from char* to bool

quick bough
quick bough
#

Any pointer is implicitly a bool, false if nullptr, true if not.

flat wigeon
#

And?

quick bough
#

And it makes thing easier

flat wigeon
#

Except when it doesn't

quick bough
#

int to bool... I might agree that the good of this outweighs the bad

#

But I think it's more a matter of compiler warnings, and MSVC for example does warn you when you're implicitly casting to a smaller type

flat wigeon
#

It's primarily an issue with the builtin types

quick bough
quick bough
flat wigeon
#

The issue is if you happen to pass something incorrectly to a function

quick bough
#

I understand, I had this issue like once when I was just starting out with C++ and refactoring some code

#

but it was pretty easy to just make a = delete; overload to catch the offending call sites

flat wigeon
#

on bool?

quick bough
#

Yeah, something like this

flat wigeon
#

Not every caller is offending ^^

quick bough
#

Then it sounds more like you want some assert within the function itself to ensure all preconditions are satisfied?

flat wigeon
#

Okay, I had a function (maybe templated) which took several types. I forgot char* and it took bool

quick bough
#

Something like this, then

flat wigeon
#

Hmm...

flat wigeon
#

I can't actually find the code where this happened

#

And there is also the issue, that in general you should generally should declare constructors with one parameter integral parameter explicit

#

That's also legacy

quick bough
#

Well, the explicit thing depends on what you want your class to behave like

#

Sometimes implicit construction of your class is desirable

flat wigeon
#

Yeah, sometimes

quick bough
#

Actually, I'd wager to say most times

flat wigeon
#

In general not

quick bough
#

I'm not gonna say that OOP in C++ is boilerplate-free because OOP has some inherit boilerplate

#

I just accept it because I find the benefits of OOP are good enough to warrant it

#

And having seen the alternative with Rust's traits... I definitely prefer OOP.

flat wigeon
#

And even if you generally want implicit the default, the issue is. Accidental explicit throws a compiler error, accidental implicit compiles

quick bough
#

Accidental explicit?

#

I don't think explicitly constructing something is ever a compiler error

flat wigeon
#

If it's explicit and you got it wrong, it doesn't compile. If it's implicit and you got it wrong it compiles and does nonsense.

quick bough
#

I don't really think that's how it works

flat wigeon
#

Well the kind of wrong is different in both scenarios

quick bough
#

I think the explicit keyword just says the constructor can't be called implicitly

flat wigeon
#

Yeah

quick bough
#

Like, this behaviour may be desirable for your use-case.

#

If it's not, just do this:

#

And now that callsite has a compile error

flat wigeon
#

Pass a number to an explicit because, you expected implicit. You instantly get an compiler error. Pass a number but, that was wrong and it was implicit when you didn't expect it to be, it compiles.

quick bough
#

tbh I don't really see the issue

flat wigeon
#

It compromises type safety per default

quick bough
#

I suppose, but it's easy to overwrite the default

flat wigeon
#

...

#

Doesn't make the default better

quick bough
#

When I was just starting out with C++, I had the same opinions as you

#

and I still disagree with some defaults in C++

#

but it's really not that bad

#

The language gives you all the tools

flat wigeon
#

Still it's bad

quick bough
#

And the defaults make it very convenient to write

#

If you want the extra compiler checks, you can enable them with a keyword

flat wigeon
#

Still explicit as the default and implicit as override would be better

quick bough
#

Yeah, maybe, but implicit by default makes more code work

flat wigeon
#

old code

quick bough
#

By default, the compiler doesn't try to say that you're wrong. It assumes you're right, because you're a fucking God walking among men for all it knows.

flat wigeon
#

Obviously if one would change the default, it would be breaking

quick bough
#

but if you want the compiler to, you can very easily ask it to do some extra checking for you.

#

And ultimately, I've come to love this approach

#

because I started out exactly with your opinion lol

#

Or maybe it's just Stockholm Syndrome kicking in after all these years of C++ kappapeek

flat wigeon
#

^^

#

It's not, that it's a deal breaker

#

But stuff like that accumulates over time

#

Like >20 years

#

The standard library also is a bit inconsistent

quick bough
#

Well, most of the code I write looks like this

#

explicit on most ctors; [[nodiscard]] on most non-void functions

#

This is me asking the compiler to enforce a more explicit code style

flat wigeon
#

Well yeah, also that was my point. You more often want explicit then not.

#

You know what I hate about C#?

#

using

quick bough
#

I definitely agree that explicit would be a good default, but it's also not the worst thing in the world that it's opt-in rather than opt-out

quick bough
#

It's because they don't have RAII laughpoint

flat wigeon
#

Hahaha, old syntax. But yeah

quick bough
#

Poor GC langs

flat wigeon
#

Seriously, that crap drove me mad. The moment I noticed I had MEMORY LEAKS left and right

quick bough
#

It's not a memory leak if it gets cleaned up Eventually™ kekw

flat wigeon
#

Because I used bitmaps and bitmaps are unmanged memory and the GC didn't release it automatically. Just went OOM.

quick bough
#

Oh no lol

flat wigeon
#

It's nice to have a garbage collector, but still I need to manually manage my memory

#

And need to probe every object whether it's disposable or not

quick bough
#

I don't find GC to be nice because most of the time RAII "Just Works™" and GC is just such needless overhead to do what RAII could do

quick bough
#

Got one of my acquaintances to get a Wooting keyboard and when he uses the Analog SDK with the Wooting Analog Plugin, it seems to disconnect his Wootility. It's fine with my replacement plugin written in C++. The wonders of the Rust codebase. ifeelok

placid ledge
quick bough
#

Still waiting on the hidapi-rs maintainer but then I can PR my final patch

cyan saddle
#

So Rust is such a hard to use language that I couldn't get my PR quite into a state that compiles, I spent way way too long on it. I'm sure one of you guys that understands the arcane ways of this esoteric language could polish it up.

quick bough
#

C++ rewrite when kappapeek

#

Tho in seriousness, I don't quite get why a language as immature as Rust was chosen over C++, when the codebase was already in C and all you had to do was change the feature flags on your compiler and start writing better code.

#

I think the main issue with getting logger to a custom sink would be that plugins, such as the "Wooting Analog Plugin" have their own/independent logger instances, so this is just gonna cut through the entire chain basically

#

I would probably want to focus on getting Rust plugins ported over to using the C ABI first to make them more robust, and to streamline it in general.

#

Then maybe considerations like logging can be done

#

But for me personally, when all my patches will be merged and published, I won't feel the burning urge to rewrite it in C++ anymore, and then... unicorns?

quick bough
#

Oopsie, looks like something I did was not quite desirable for Wootility

umbral walrus
flat wigeon
#

My guess, his keyboard config got trashed because he used the configuration interface while Wootility was running

quick bough
#

I sent some funny data to the keyboard itself regarding the key mapping and broke FN 2 & FN 3 layers, but got it fixed

cyan saddle
#

Yeah POSIX and Windows both provide ways to load shared objects and resolve symbols from them.

#

One of these days I should make a system that allows me to create stub shared objects to MITM stuff to be able to check against reimplemented versions.

quick bough
#

Of course, assuming C ABI. C++ and Rust ABI are gonna be slightly more... challenging to shim. 😄

cyan saddle
#

Yeah but you also need to be able to handle arguments and returns in a reasonable manor.

quick bough
#
return reinterpret_cast<uintptr_t(cc*)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t)>(func)(args.at(0), args.at(1), args.at(2), args.at(3), args.at(4), args.at(5), args.at(6), args.at(7), args.at(8), args.at(9), args.at(10), args.at(11), args.at(12), args.at(13), args.at(14), args.at(15), args.at(16), args.at(17), args.at(18), args.at(19));
#

I mean just make a function that returns a uintptr_t (or void*), takes like 20 args, and just call the OG with all 20 args

#

This works absolutely fine with every calling convention I know

cyan saddle
#

Ideally you'd be dumping all of the data from the arguments and return values.

quick bough
#

Sure, but you don't know what that is. I mean, if you have more than just a DLL, but also a .h, you can be clever and cross-reference the exports with a function declaration. Then you can do more than blindly passing around register-sized data.

cyan saddle
#

You can also open it up and view the assembly.

#

I wonder how that handles floats and extra wide stuff like SIMD values.

quick bough
#

Hmm, I've not looked at how calling conventions handle the XMM and YMM registers

#

It's not been an issue for my work, including FFI stuff, so it's probably just fine

#

Yeah, just checked. It just puts pointers to the values in the respective registers.

#

Which makes sense. That's how it handles all types greater than 64 bits.

#

Although that's not correct. I have some custom types that fit in 64 bits or less, and it still uses pointers because the compiler is a little twat that doesn't like optimising my code.

cyan saddle
#

Huh, funky.

#

You'd think it would want to use the extra wide registers where possible instead of using memory.

quick bough
#

Well, tbf, it's pointers to values on the stack in the worst case

cyan saddle
#

Yeah but that's still a trip to cache.

quick bough
#

It just does so for interoperability with the calling conventions

quick bough
#

so the calling convention has to account for that

#

You can't just bend the calling convention based on argument types

#

(Well, you can, but at your own risk.)

cyan saddle
#

It just feels like one could define a calling convention that accounts for such HW features.

quick bough
#

One could, but wanna know what compilers do when it really matters?

#

They just don't call the function at all 😄

quick bough
#

because it would just inline it all

cyan saddle
#

Yeah things get inlined and deleted and transformed.

#

Only works when the contents of the function is known though.

#

Escape analysis is really freaking cool too.

quick bough
#

It makes sense, tho. In this case the function is about as big as the callsite would be.

cyan saddle
#

"You pass this thing with like 20 bytes of memory but only use an int from it? Okay we'll only use that small part and inline code for you."

quick bough
#

Sometimes the compiler is really smart at optimising code. Other times, not so much. Better to write code under the assumption that the compiler is a toddler.

cyan saddle
#

Trust but verify.

quick bough
#

One thing that bothers me is that LTCG is pretty damn limited, so you're better off putting important code in .h/.hpp files anyway.

#

And no way for me to (portably) inline ASM code when there's no intrinsic cat_cry

cyan saddle
#
static inline

my beloved.

quick bough
#

Luckily, there is a lot of intrinsics

#

What I hate about this is how both keywords have multiple meanings depending on context

cyan saddle
#

How so?

quick bough
#

Yah

#

Well, static has like 3 meanings, and inline I think has 2

cyan saddle
#

🤔

#

It's a shame that a common Panama code pattern makes the JVM not optimize some code the way it should in Java 22, it breaks the escape analysis. :-/

quick bough
#

In the context of a class, static means "static member". In the context of a compilation unit, "static" means "this symbol is not the same as other symbols of the same name in different compilation units", and in the context of a function, "static" is used to declare static initialisation of a variable.

cyan saddle
#

Oh yeah I forget static inside functions.

#

That's pretty much the same as the class one though?

quick bough
#

Not at all

#

that means "this has no this-pointer/can be used without an instance"

#

And "inline" means "please prefer to inline this function" and "this symbol can be present in multiple compilation units"

cyan saddle
#

How is it not, it will only ever be the one variable.

quick bough
#

I mean, it might be the same concept in your worldview, but to me, it's just a vastly different concept, and also has vastly different impacts on the generated code

cyan saddle
#
void func() {
    static int thing;
}
class Thing {
    static int thing;
};

are pretty much the same use for static.

quick bough
#

Except one of them generates vastly different code

cyan saddle
#

That's so weird.

quick bough
#

Practical example:

#

It doesn't need to do any of this initialisation dance for a static member because a static member just exists

#

(Although I guess it may need to anyway, depending on what kind of static member it is.)

cyan saddle
#

I wish godbolt worked on mobile.

quick bough
#

"Request desktop page"?

cyan saddle
#

Because backspace means "copy and paste a random thing into a bunch of new lines."

quick bough
#

wtf

cyan saddle
#

The carrot is also always at the end, the keyboard doesn't like to show up, you can't select text to copy and you can't paste.

I don't know what they are doing but it's not great.

quick bough
#

PC masterrace kappapeek

cyan saddle
#

More like "using JavaScript to reimplement browser features never works as well as the browser itself."

quick bough
cyan saddle
#

Hey sometimes JS is actually useful, it's just used for the wrong things 99% of the time.

quick bough
#

I used to do web dev back in the good ol' days when jQuery was the biggest framework (and it actually solved real problems!)

cyan saddle
#

It's weird, in another guild there's someone that loves JS and Rust but despises things like C, C++ and Java.

quick bough
#

Nowadays I'm so tired of the garbage language that JS is, and all the frameworks around it

#

And I'm very happy with my C++ work

#

I also get paid a lot better now, but that's only tangentially related :^)

cyan saddle
#

C++ is quite a language.

#

I can't find work as a programmer.

quick bough
#

Weird. Maybe need to learn more skills/tools/languages/whatever?

cyan saddle
#

Heck even the minimum wage sorts of positions don't want me for some reason. .-.

#

I keep trying Rust but it's just impossible, Go is pretty okay it just has bad error handling, I'm decent at C and I know a little C++, I'm really good with Java and I keep up to date on each release, I know Linux and Windows (but that's getting outdated from Microsoft doing weird crap), I've written some bash and Lua scripts, I'm not afraid of assembly it just takes me a bit, I'm definitely missing a lot.

quick bough
#

Seems like a good variety

#

If you're comfortable with C++ and/or RAGE Scripting Language, why not work on GTA VI? kappapeek

#

(Or a new Bully game, where they might use Lua for game scripts.)

cyan saddle
#

I've never heard of RAGE Scripting Language.

quick bough
#

It's an internal thing they use

#

because Lua wasn't cool enough for them

cyan saddle
#

None of those are anywhere near me.

quick bough
#

Fair enough lol

#

Lua would be like 10x cooler if it wasn't GC based but alas

cyan saddle
#

Eh, you kinda need that sort of thing if you want something like Lua.

quick bough
#

maybe

cyan saddle
#

Apparently the Roblox Lua engine is absolutely insane.

quick bough
#

Well, it's some Lua 5.1 based fork

#

That kinda diverged from Lua over the versions

#

and it still has GC crybaby

cyan saddle
#

From what I heard they have a custom runtime that has a really good JiT or transpiler.

quick bough
#

Yeah they apparently do have a JIT

#

My version of Lua also has a JIT, it's called "My CPU's cache"

#

it's actually insane how much faster VM code runs when it's not a cold boot lol

cyan saddle
#

🤔

#

It's amazing that DOOM can fit entirely in the cache of modern processors.

quick bough
#

It's unfortunate that most contemporary programs can't fit entirely in the cache of modern processors

cyan saddle
#

Modern C killers be like: 100MiB hello world.

#

Every time I touch someone else's Rust project it is so weird to have it download 200 different dependencies. .-.

quick bough
#

I love my little C++ apps that are like 1,5 MB and constantly take up 0% of my CPU

#

Just write it, compile it, put it in autostart, and forget it

cyan saddle
#

I do want to make a C++ service that has decent scope one of these days.

quick bough
#

I did this funny little thing so I could have RGB from games on my Wooting keyboard (currently in GTA V)

cyan saddle
#

I just need to figure out how I want to make it work the way I want it to, which is harder than it should be.

quick bough
#

I need to figure out a better UI approach than hosting an HTTP server on localhost

#

but it works I guess

cyan saddle
#

It's a thing that's going to need to talk to the currently active program among other tricky things.

quick bough
#

What do you want to make?

cyan saddle
#

Weird custom HID user space drivers.

#

Couldn't you use a unix socket/named pipe and a CLI thing? 🤔

#

I'm insane so I'd probably do that with a Swing UI.

quick bough
#

Probably could, but meh

quick bough
cyan saddle
#

It's supposed to be a libusb based thing that sits in the background.

quick bough
#

What problem(s) are you trying to address with this?

cyan saddle
#

I do wish it wasn't such a pain to get a root dialogue without doing evil stuff like asking for the root password yourself.

#

I want custom stuff to give me physical buttons for more IDE features without having to press five keys or define even more keyboard shortcuts.

#

Probably other system control stuff too.

quick bough
#

So, you want a Wooting UwU and use DKS to have it press keys for you? 😄

cyan saddle
#

DKS?

#

I feel like buying a bunch of UwUs is a bad idea.

quick bough
#

For who? kekw

quick bough
#

Maybe also Wootomation could help here idk

cyan saddle
#

Oh yeah I just want to be able to press the key and not have to worry about depth for this.

#

You can do it with one key.

#

.. -. ... .- -. .