#development

1 messages ยท Page 228 of 1

sharp geyser
#

Looks like I have to download the file

#

๐Ÿ˜”

#

Really didn't want to do that

quartz kindle
#

what kind of info are you looking for?

sharp geyser
#

exactly what I said

#

the stream data of the file

quartz kindle
#

wdym by stream data

sharp geyser
#

bro

#

the contents of the image?

#

Like the raw data

quartz kindle
#

thats literally the file itself?

sharp geyser
#

its a discord attachment

quartz kindle
#

when you said "without download" i though you meant like, metadata or something

#

the stream is literally the download

sharp geyser
#

I was trying to see if I can avoid downloading the file to get the raw data of said file

quartz kindle
#

thats literally downloading the file

#

@_@

sharp geyser
#

yea well tim, here's the thing I am not smart

quartz kindle
#

lmao

sharp geyser
#

I just didn't want to download the file only to upload it using minio to a nother location on the same server

#

๐Ÿ’€

quartz kindle
#

you cant not download the file, what you can is not wait until the download is complete before uploading

sharp geyser
#

Honestly, I wonder if I can download the file to my minio bucket folder and just have minio fetch it

#

Im not sure how minio works internally if it stores any kind of data to easily find the files or not but im sure it just reads through the dir (bucket) until it finds the file it needs

quartz kindle
#

if you pipe the download stream into an upload stream, thats basically redirecting the download to the upload

sharp geyser
#

no idea how to do that in C#

quartz kindle
#

its still downloading the file, just immediately uploading it again as the download comes in

#

without saving the file

sharp geyser
#

How does that even work

quartz kindle
#

you know how streams work right?

sharp geyser
#

not really no

#

first time messing with em

quartz kindle
#

ok so

#

a stream is like an event emitter but also a data manager

#

a stream object can receive data and can emit data

#

so for example, a network connection uses a stream object to emit data events as the data comes in

#

you can also create a write stream to send data through it

#

the thing about streams is that the data always flows in pieces

#

small parts at a time

#

thats why its like an event emitter

sharp geyser
quartz kindle
#

when you open a file on your pc, the program creates a stream of that file

#

and slowly reads it from disk

#

you get data events for each piece that it reads

#

and you can do things with it as it comes in, withou waiting to load trhe entire file at once

sharp geyser
#

I see

#

so do I have to build those pieces together as they come in then upload, or do I just upload the pieces as they come

quartz kindle
#

you can upload the pieces as they come, that way you dont need to store them nor assemble them

#

youre basically proxying the download

sharp geyser
#

Icic

quartz kindle
#

streams have built in methods to make this easier

#

called pipes

sharp geyser
#

time to figure out how to do this in C#

quartz kindle
#

so you can pipe from one stream to another

#

and it takes care of doiung it for you

#

for example in js:

#
const abc = fs.createReadStream("somefile")
const xyz = fs.createWriteStream("newfile")

abc.pipe(xyz)
#

that is the same thing as:

const abc = fs.createReadStream("somefile")
const xyz = fs.createWriteStream("newfile")

abc.on("data", chunk => {
  xyz.write(chunk)
})
#

so what you want is to get the download stream and pipe it into the upload stream

sharp geyser
#

Yea so thats all fine and dandy

#

but doing this in C# is going to be painful if idk the classes to use.

#

Googling gives me shit from 10 years ago that are now deprecated and no longer work

quartz kindle
#

rip

sharp geyser
#
MinIO API responded with message=Data read 0 is shorter than the size 5077 of input buffer.
#

wtf is this even supposed to mean

#

maybe discord wont let me read the data from it

quartz kindle
sharp geyser
#

well

#

now im getting a new error

#

[2024-06-22 21:08:14 -04:00] [0 /Showcase ] [Crit ] Cannot access a closed Stream.

#

for some odd fucking reason the stream is closing

quartz kindle
#

also, if you want to use the stream, you cant do anything else with it

#

stuff like reading headers or body will automatically download the stream, which closes it

sharp geyser
#
            using (var client = new HttpClient())
            {
                using (var response = await client.GetAsync(picture.Url, HttpCompletionOption.ResponseContentRead))
                {
                    response.EnsureSuccessStatusCode();

                    using (var stream = await response.Content.ReadAsStreamAsync())
                    {
                        args
                        .WithBucket("showcase")
                        .WithObject($"petpics/{image_id}.{picture.MediaType.Split('/')[1]}")
                        .WithObjectSize(picture.FileSize)
                        .WithStreamData(stream)
                        .WithContentType(picture.MediaType.ToString())
                        .WithServerSideEncryption(ssec)
                        .WithProgress(progress);
                    }
                }
            }
#

this is all im doing tho?

quartz kindle
sharp geyser
#

what

quartz kindle
#

you get the stream from the client

#

not from the response

#

the stream itself is the response

sharp geyser
#

oh

#

๐Ÿ’€

#

MinIO API responded with message=Data read 0 is shorter than the size 5077 of input buffer.

#

bro

#

what

#

๐Ÿ˜ญ

#

Wtf am I doing wrong

#

How is it 0

quartz kindle
#

client.GetStreamAsync returns Task<Stream>

#

.WithStreamData expects Stream

#

so you need to get the Stream from the Task first

sharp geyser
#

time to figure that out

quartz kindle
#

altough, shouldnt await do that?

quartz kindle
#

where are you getting the size from?

sharp geyser
#

[Option("picture", "Picture you want to upload!")] DiscordAttachment picture

#

its a slash command option

sharp geyser
quartz kindle
#

ah so you get it from discord ok

sharp geyser
#

but if I do response. it shows a lot of methods

#

it is a stream

#

but its nullable

spark flint
#

Cba to read the code but

#

Are you setting a content-size header

quartz kindle
#

how about this

    using(var response = await client.GetAsync("http://httpbin.org/get", HttpCompletionOption.ResponseHeadersRead))
    {
        if(response.IsSuccessStatusCode)
        {
            using (var stream = await response.Content.ReadAsStreamAsync())
            using (var streamReader = new StreamReader(stream))
spark flint
#

Sometimes s3 can be fussy

sharp geyser
# spark flint Are you setting a content-size header
                  args
                        .WithBucket("showcase")
                        .WithObject($"petpics/{image_id}.{picture.MediaType.Split('/')[1]}")
                        .WithObjectSize(picture.FileSize)
                        .WithStreamData(response)
                        .WithContentType(picture.MediaType.ToString())
                        .WithServerSideEncryption(ssec)
                        .WithProgress(progress);
``` thats what WithObjectSize does according to the docs
spark flint
sharp geyser
sharp geyser
#

honestly bout to say fuck it and just make my own minio trollface

sharp geyser
#

[Error] MinIO API responded with message=Data read 0 is shorter than the size 1258 of input buffer.

lament rock
#

:)

#

You find out pretty quickly why popular libs are the way they are

sharp geyser
#

I find out very quickly I fucking hate popular libs

neon leaf
#

it actually happened

#

the first cuid2 colliided

#

rjns-mcvapi_web | ERR 23.06.2024, 11:15:04 HTTP Request Error
rjns-mcvapi_web | (http.handle.onRequest)
rjns-mcvapi_web |
rjns-mcvapi_web | PrismaClientKnownRequestError:
rjns-mcvapi_web | Invalid prisma.aPIRequest.create() invocation:
rjns-mcvapi_web |
rjns-mcvapi_web |
rjns-mcvapi_web | Unique constraint failed on the fields: (id)
rjns-mcvapi_web | at In.handleRequestError (/app/server/node_modul

sharp geyser
#

L

green kestrel
#

i think ive reached the practical limit

#

822mb ๐Ÿ˜ฎ

sharp geyser
#

thats like

#

impossible to achieve in js

neon leaf
#

time to work off the backlog now

rigid maple
#

I don't want a border at the intersection of the topbar and sidebar. Is there anything I can do?
Adding border-l-white to topbar doesn't work.

#

i'm using tailwindcss

pearl trail
#

maybe try using outline instead?

#

there is outline offset

#

not sure about tailwindcss version

rigid maple
#

thank you

#

I guess we don't have the chance to give the outline to a single side, like a border?

eternal osprey
#

ain't no way. I left my program run overnight and it tripled the data ๐Ÿ˜ญ

#

deadass went from 8tb -> 24tb cuz i am not removing intermediate keys and i am copying each block 3x to be more error resilient when processing in scala lmao.

dusky idol
#

how can I get the members having x role in a specific server?
.jsk py
g = ctx.guild
role = await g.get_role(1216080016048259303)
yield len(role.members)

this returns 1 which is false now, well it used to work not anymore

#

I believe because the bot is in a lot of guilds and doesnt get to cacheup etc?

frosty gale
#

whats the best/most performant html parsing library in js? im thinking of writing an email quote parsing library that also handles HTML

#

since the only one i saw on npm is 10 years old and doesnt support HTML emails

#

i remember hearing about cheerio but it sounds kinda heavy

#

actually ill probably end up using cheerio

#

oh actually i want it to run in the browser but i dont think cheerio supports that

pale vessel
#

cheerio is just an implementation of jquery

frosty gale
#

i am not importing jquery

pale vessel
#

maybe you can use whatever they use under the hood

frosty gale
#

i guess my thing would just have to use a hybrid approach that detects the environment

#

if its node it will use cheerios parser

#

if not im sure browsers have the ability to parse and modify HTML

#

although that will be annoying

neon leaf
#

I use node-html-parser

#

its pretty much the browser api

#

but in node

pale vessel
neon leaf
#

well just create an element

frosty gale
neon leaf
#

do element.innerHtml = whatever

#

and use that

frosty gale
#

if i were to make a library id want it to work both in browser and node

#

but for now i can write a frontend implementation

#

you can do it natively im pretty sure that way

#

i could make 2 libraries, one for node and one for frontend but that can be annoying

#

yeah in the browser i can use DOMParser which is probably very fast since it uses the same backend as the browser for parsing pages and manipulating DOM

frosty gale
# neon leaf I use node-html-parser

for node I can use this library that way i can retain as much of the same code as possible, but not sure how id go about that hybrid approach

slender wagon
#

Guys lets say my chrome got corrupted. How do i decrypt my cookies from the folder

slender wagon
#

Oh so there is this master key

slender wagon
slender wagon
quartz kindle
quartz kindle
slender wagon
slender wagon
neon leaf
#

its possible, if you display fake server counts

quartz kindle
#

:^)

#

its also possible if you offload the entire cache

neon leaf
#

onto a floppy disk?

quartz kindle
#

yes

neon leaf
#

ok

slender wagon
#

Idk if u have looked into it

neon leaf
#

๐Ÿ”ฅ๐Ÿ”ฅ

slender wagon
neon leaf
#

yes totally

#

the screenshot is definitely not an sql query related to requests

slender wagon
#

Requests for what

neon leaf
#

http requests

slender wagon
#

Bruh

slender wagon
neon leaf
#

sadly yes

green kestrel
#

I kept my http request counter going by mistake for 4 years on triviabot

slender wagon
#

Prisma is a life saver wym sadly

green kestrel
#

when I checked it said 90 million

neon leaf
#

prisma is slow as fuck

slender wagon
#

Crazy

neon leaf
#

drizzle on top

green kestrel
#

hmm what's prisma again?

neon leaf
green kestrel
#

ah

slender wagon
green kestrel
#

sure

#

raw sql with cached prepared statements

neon leaf
#

รญts impossible to use prisma without some raw sql too

green kestrel
#

designed in an external app

neon leaf
#

way too restricting

green kestrel
#

I build my queries on mysql workbench then use explain to optimise them

slender wagon
green kestrel
#

I do like having migrations

neon leaf
#

this is about 10x slower with prisma

#

sometimes 50x slower

green kestrel
#

trying to manage dev, test and live without migrations is painful

slender wagon
green kestrel
#

I usually roll out migrations from the web using Laravel eloquent

slender wagon
green kestrel
#

and then raw queries on the C++ side

neon leaf
#

im slowly switching to drizzle

slender wagon
#

Does drizzle support node

neon leaf
#

yes

#

I only use node

slender wagon
#

Okay

neon leaf
#

bun is slow

#

deno is bad

slender wagon
#

Do u just use discord.js

neon leaf
#

sometimes

slender wagon
#

Mainly

#

?

neon leaf
#

depends

#

only if I need a full bot i do

#

otherwise i raw dog the ws

green kestrel
slender wagon
#

One of my friend save 80% resources switching to deno

green kestrel
#

all my bots share a similar db namespace, they just work differently internally on the newer bots

slender wagon
#

Nice

neon leaf
#

I save 5ms cpu time per request by staying on node (compared to bun)

slender wagon
#

Bun spares me the pain of setting up tsc

neon leaf
#

bun leaks memory for me

green kestrel
#

I saved most CPU time per request by:

  1. caching prepared statements instead of preparing every time
  2. switching to Unix sockets for connection
#

first one cuts the time per request by orders of magnitude

neon leaf
#

ye prepared stmts are amazing

slender wagon
#

Where r ur servers located

green kestrel
#

you can do that on most db libs

neon leaf
#

what is also amazing is running most unimportant stuff after the request finishes

green kestrel
#

but everyone seems to follow the pattern of.... oh look a query! prepare, execute, get results

#

you can cut out that first step and it's mega slow

slender wagon
#

R u using mysql or psql

green kestrel
#

mysql

#

oh and I run mysql on localhost

#

not managed

slender wagon
#

Thats the way lol

neon leaf
#

i dont get why people do it externally

green kestrel
#

if I need to I can do replication

slender wagon
neon leaf
#

I replicate to usa, singapore and eu currently

green kestrel
#

especially for master master replication

neon leaf
#

yeah master master is above my level

#

I use master -> slave, slave

slender wagon
#

Do u use a dedi or smthn like aws

green kestrel
#

I'm not replicating rn though

#

I have two dedicated servers, one holds sporks and triviabot and their DBs, the other is for seven spells and beholder and their DBs (and sites/dashboards)

#

both are now massively over specified

slender wagon
#

Oof

#

Is horizontal scaling a thing on bot dev?

green kestrel
#

I could run all the bots on a potato and I'm paying for servers that could run a js bot

#

sure, my bots are kinda built for it

#

but in practice I won't need to scale at all until tens of millions of guilds and that isn't gonna happen lol

slender wagon
#

Cpp coming in handy

neon leaf
#

idk if im gonna be learning go or c++ as my second lang

#

I like both

slender wagon
#

Go if u wanna get hired

green kestrel
#

CPP is fun

slender wagon
#

Rust if u wanna overkill

neon leaf
#

rust is shit

#

i hate the syntax

#

i hate the compiling

spark flint
#

hi krypton

green kestrel
spark flint
#

long time no see

green kestrel
#

when you want to execute it again fill the pointers and call execute

earnest phoenix
#

Aren't prepared statements already getting cached on the DBMS?

green kestrel
#

not in that way no

#

they're cached by the dbms only if you save that structure

#

that's your handle

earnest phoenix
#

Yeah, so the difference is significant enough?

green kestrel
#

otherwise every time you tell the db server to reparse the query string for parameters

earnest phoenix
green kestrel
#

yes, you cut out a whole interpretation of a text based language

#

it's like the difference between compiling a C program then running it, or just running it

earnest phoenix
#

Yeah but I learned that it caches the statements and then just replaces the parameters

#

As being the default behavior of prepared statements

green kestrel
#

not if you discard the struct

#

some high level libs will retain that for you

#

in C and C++ it's your job

earnest phoenix
#

Yeah fair enough

green kestrel
#

you can time the difference with a profiler, it takes the time to execute some queries down from 1ms to 0.1ms

earnest phoenix
#

Well if there is effectively a difference then it surely does help lulw

green kestrel
#

triviabot doesn't do this caching btw

#

it does other stuff, with a thread pool

#

triviabot has different database needs than seven spells

earnest phoenix
#

Not worth it or not the motivation to do it?

green kestrel
#

different requirements

#

triviabot has other abilities to push a db query to the background

#

if i dont care about its results, i can push it to a second thread

#

where it runs some time later

#

but the function returns near instantly

#

seven spells doesnt have this (yet)

#

also triviabot has a connection pool of many connetions and round robins queries between inactive connections

lyric mountain
#

tf is mainheading?

#

?

#

any example or image?

lyric mountain
frosty gale
#

think they mean a h1 or something

#

probably bot page on topgg or something

#

or on discord

#

markdoown

#

big thing

pale vessel
#

yeah, you're not supposed to

#

it's supposed to be a very short description of your bot

#

you shouldn't need to bold

quartz kindle
#

you can use css in description

#

to edit headline

lyric mountain
#

it'll only affect it when inside your bot page

#

not in the bot list

#

also can you even do it anymore? the css classes are changing all the time

#

you cant use markdown there

#

what tim means is that you can force styles upon the headline using css in the long description

#

but this will only change if inside the bot page, not at the bot listing

rigid maple
#

Is there a way to change all scrollbars with single css?

digital swan
#

can you not use * {}

sharp geyser
#

wdym

#

in what context?

#

oh you are talking about in css

#

Sure you can do that if you are making a global css file

#

but if you want to fine tune the scrollbars or other aspects of a page individually its better to tap into that class itself

lyric mountain
eternal osprey
#

I have been waiting in the queue for fucking 21h

#

My cluster is clogged

#

deadass constipation

#

its over

sharp geyser
tawny condor
#

!help

hard wyvern
#

Help Menu - Page 2 of 3

guess: Play a number guessing game.
help: Displays the help menu.
ping: Display the ping
quiz: Play a trivia quiz game.
spam: Spam a message repeatedly

solemn latch
#

hmm, which one

#

!spam test

hard wyvern
#

You do not have permission to use this command.

solemn latch
#

oh ๐Ÿ˜ฆ

tawny condor
#

A self bot

solemn latch
#

But I wanna

#

!ping

hard wyvern
tawny condor
#

Found him in my server lol

solemn latch
#

!help

hard wyvern
#

Help Menu - Page 1 of 3

addy: Display the owner ltc
avatar: Displays the avatar.
calc: Perform arithmetic calculations.
donate: Provides the donation address for Litecoin.
getbal: Get the balance of a Litecoin address

solemn latch
#

!calc 1+1

hard wyvern
#

Result of 1+1 = 2

solemn latch
#

lmao

tawny condor
#

๐Ÿ’€

#

!addy

hard wyvern
#

ltc My Addy ltc

Address: ltc1q7eaxgncqv7cqecz4sseucge0m09qmezk33qlda
Confirmed Balance: 0 LTC
Estimated Balance (INR): โ‚น0.00

solemn latch
#

!calc 1:99999999999999999999999999999999999999999999999999

hard wyvern
#

An error occurred while calculating. Please check your expression.

solemn latch
#

๐Ÿ˜ฆ

tawny condor
#

Well handled

solemn latch
#

alrighty, done goofing with it @tawny condor

tawny condor
#

Thanks lol

#

A self bot have nitro and I donโ€™t ๐Ÿ˜”

quartz kindle
#

what the fuck lmao

sharp geyser
#

I HAVENT HAD MY FUN

#

๐Ÿ˜ญ

#

I wanted to see if the calc function would return a token

solemn latch
#

It would have just been the users token

sharp geyser
#

exactly

#

what better way to troll them then to delete their account

#

rahhhhh /j

rigid maple
sharp geyser
#

mozilla has limited support for customizing scrollbars

#

as for how to do this

#

Easiest way to see is by looking here

#

It tells you how to do this on Safari, Chrome, Edge and Opera

rigid maple
#

I'm using svelte and even though I place css code in the style in app.html, the scrollbar does not change.

sharp geyser
#

Firefox is different where it only has scrollbar-width and scrollbar-color

sharp geyser
#

I dont remember how svelte handles global styles

rigid maple
#

Oh I did it somehow and now it's working

rigid maple
sharp geyser
#

sweet!

radiant kraken
pearl trail
#

also ltc what

#

linus tech c??

radiant kraken
pearl trail
#

L

neon leaf
wheat mesa
#

Why bother making your own?

#

If you want random and truly unique, use GUIDs

#

If youโ€™re just generating random bytes then thereโ€™s a very tiny chance you get the same number twice

#

Very very tiny but still possible

lyric mountain
#

another option is to just allow the database itself to generate the value

#

besides, why not just use a sequential number?

frosty gale
#

real programmers assert their dominance by using long and complicated strings as IDs

#

(literally every big tech)

lyric mountain
#

there's little value in using random numbers when an autoincrement column would do

lyric mountain
#

hash the user_id then

#

unless you want to allow one user to have many sessions

quartz kindle
#

one session for each device

quartz kindle
#

its not that hard, if session cookie is present check if its a valid session in db, else delete cookie and redirect to login page

#

if there is no session cookie, show login page

pearl trail
dawn socket
#

how can i add svg in my vote log?

quartz kindle
pearl trail
#

oki imma do that

dawn socket
quartz kindle
pearl trail
#

uh yeah damn idk is it because of the driver or c#, once result.FirstOrDefault() called, the next call will return null

warm surge
#

something like this?

pearl trail
#

๐Ÿ’€

quartz kindle
#

many things use such a system, like streams

pearl trail
#

oohh it's about memory,, pretty expected from c family langs lmao

dawn socket
pearl trail
#

thanks anyways!

dawn socket
quartz kindle
quartz kindle
#

svg does not have a size by default, you need to specify the size you want

lyric mountain
#

simply because svg has infinite detail, whereas png is constrained to pixels

#

also if ur using it to draw, you can use canvas instead of svg, this way you remove the middleman conversion

lyric mountain
#

then why are u converting from svg to png?

pearl trail
#

canvas on node right?

lyric mountain
#

iso format

quartz kindle
#

timestamp ftw

lyric mountain
#

timestamp does not store timezone info

pearl trail
#

it is +0 isn't it

sharp geyser
#

Wdym

#

You realistically shouldn't

#

You can't really serialize the entire struct like that

#

you would have to serialize a side effect of one of the functions on it as it gives a proper return value

lyric mountain
#

how many millis since it

quartz kindle
#

yeah timestamp is always utc

#

but even so, if you do need the timezone you can store it as two values, like [timestamp, timezone]

#

still probably more space efficient than ISO xD

#

or better yet, if you need a string version, you can do base64timestamp+-base64timezoneoffset

sharp geyser
#

hey tim

#

question

#

what's the diff between a for and a while loop? Like syntactically I know the difference, but beyond that

#

Like why is there a need for two loops

lament rock
#

for is for iteration over an IterableIterator. While does stuff while a condition is true which can be totally unrelated to iteration

sharp geyser
#

fair

lament rock
#

Well, you can treat for like a while loop kinda, but for loops usually just go in the direction of for (let i = 0; i < someInt; i++) meaning it has a definite lifetime

sharp geyser
#

i see

#

you can do like

for(let i = 0; ;i++){}

to make it essentially a while loop right?

#

or iirc you can even do for(;;){} ?

#

at least in js

lament rock
#

I can't say if those are syntactically correct as I've never encountered them or used them but if so then probably. Then you'd just escape that loop with break;

sharp geyser
#

I wonder

#

let me test them

lyric mountain
#

it is correct

#

none of the for arguments are required

sharp geyser
#

yea

#

I just tested it it works

#

kind of neat

#

but you have to pass it something don't you?

lyric mountain
#
for (int i = 0; i < MAX; i++) {
  ...
}
``` is transformed into ```java
int i = 0;
while (i < MAX) {
  ...
  i++;
}
``` during compilation
sharp geyser
#

I figured

#

I just wasn't sure how to ask what it did under the hood properly

lament rock
#

I think when the JIT goes over a for loop, if it has a fixed lifetime, it can just unroll the loop making it just execute a fixed number of times which is more performant

sharp geyser
#

Cause I was looking at it and wondering, is for just a glorified while loop?

#

Just supposed to be "nicer" way of writing it

lyric mountain
#

it applies to both for and while loops btw

#

as they're effectively the same

lament rock
#

Yeah. I've had my fair share of unrolling in GPU shaders

lyric mountain
#

also helps that the variable is promptly available for GC as soon as it exits the loop

lament rock
#

Unless you're using var :)

lyric mountain
#

if you're using var you're cordially invited to gtfo

sharp geyser
#

I use var often

lyric mountain
#

(in javascript)

sharp geyser
#

yea ik what you meant

#

๐Ÿ’€

lyric mountain
#

wait till u learn about goto and comefrom

sharp geyser
#

I use em DAILY

lyric mountain
quartz kindle
sharp geyser
#

but why tho

quartz kindle
#

because its shorter to type than while(true){}

sharp geyser
#

just do while(true)

#

lazy mfs

quartz kindle
#

lmao

#

yeah

sharp geyser
#

although

#

im talkin bout programmers

#

so I guess I cant say much

quartz kindle
#

but basically while and for exist to cover two different cases, one where you know exactly how many iterations its gonna take, and one where you dont

sharp geyser
#

icic

#

but for loop is basically just a while loop beefed up a little

quartz kindle
#

yup

sharp geyser
#

like you can do what a for loop can in a while loop

#

albeit more code

quartz kindle
#

but i guess knowing how many iterations can make it easier to optimize at the compile level

#

because you can "unroll" loops

#

and convert it into linear code

sharp geyser
#

I see

quartz kindle
sharp geyser
quartz kindle
#

basically the compiler can compress the loop into fewer iterations that do more at once

#

cant do that if the loop conditions are unknown

pearl trail
# quartz kindle

my competition when giving me that code and asking me to resolve it manually without a computer: cocksquint

pearl trail
quartz kindle
#

also, just noticed that kuuhaku and papi already answered the question before,sorry for butting inยณยณยณยณยณยณยณยณยณยณยณยณยณยณยณยณยณยณยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒยฒ

spark pebble
#

edit again, i dare you

#

damn he did it

pearl trail
#

ong

spark pebble
#

this guy

pearl trail
#

Tim trying to hit the discord's rate limit:

deft wolf
#

No, he's just cluttering up that user's chat (I assume)

spark pebble
#

(incorrectly)

quartz kindle
#

so guys

#

i have an issue

#

my mic has randomly stopped working on discord, out of nowhere

#

i was in a call, and somewhere in the middle of the call i noticed people couldnt hear my and my icon wouldnt turn green

#

ever since then i already reinstalled discord, restarted pc, etc and my mic still refuses to work on discord

#

but it works on windows audio test and browsers audio tests lol

warm surge
sharp geyser
#

if that dont work

#

make sure discord didn't swap the input channel

#

sometimes they like doing that on their own

quartz kindle
#

already did

#

even changed the audio thing to legacy and experimental

sharp geyser
#

hm

#

What mic do yo uhave

sharp geyser
quartz kindle
#

built in laptop mic

sharp geyser
#

oh uh

quartz kindle
#

just tested discord on the browser and it works fine there

sharp geyser
#

goodluck

quartz kindle
#

but on the desktop app it doesnt

sharp geyser
#

hm

#

I would say corrupted drivers

#

but if it works everywhere else

quartz kindle
#

yeah it works if i plug in a headset, but doesnt with the built in mic

#

im gonna try mess with drivers

sharp geyser
#

why is 3 < "3" valid

#

does js ignore the "" during comparison like that?

#

because if I do 3 < "6" it evaluates to true

quartz kindle
#

it tries to coerce it

#

x > y is generally equivalent to y < x, except that x > y coerces x to a primitive before y, while y < x coerces y to a primitive before x. Because coercion may have side effects, the order of the operands may matter.

sharp geyser
#

why though

#

That seems like something you shouldn't promote/allow

#

A number can't be greater than or less than a string

quartz kindle
#

it can

sharp geyser
#

How?

#

Unless you are doing length

quartz kindle
#

its used to compare string char codes

sharp geyser
quartz kindle
#

and order alphabetically

#

for example

sharp geyser
#

what

#

that dont make no sense

quartz kindle
#

aac is bigger than aab because aac comes after aab in alphabetical order

sharp geyser
#

but

#

nvm

#

I understand ya

quartz kindle
#

you can also see it via their character codes

#

97 97 99 is bigger than 97 97 98

sharp geyser
#

Honestly forgot charcodes was a thing

#

๐Ÿ’€

#

so wait

#

oh wait nvm

#

I was about to answer my own question

quartz kindle
#

back to the audio thing

#

i found out the mic was having a lot of noise for some reason, so i rolledback to some older drivers and the noise is better, but still doesnt work

civic scroll
#

unfortunate

quartz kindle
#

then i disabled this

#

and now it works lol

#

ffs

#

if i chose single presenter or multi presenter, it stops working

#

wtf

#

fucking ai bullshit

frosty gale
quartz kindle
#

then suddenly those 2 options got borked

#

well at least my mic works again

sharp geyser
#

did windows update?

quartz kindle
#

the weirdest thing is that it suddenly stopped working during a discord call

sharp geyser
#

an update could of borked it

quartz kindle
#

its possible

#

although im pretty sure my windows updates are off

sharp geyser
#

probably some windows engineer fucked up and their code had a bug in it

quartz kindle
#

windows engineers and asus engineers are all shit

#

i still like asus laptops tho

sharp geyser
#

it wouldn't be windows otherwise

#

๐Ÿ’€

#

say what you will about apple

#

but their software is top notch

#

just the price is so fucking high

quartz kindle
#

their software is good because its only tested on a handful of proprietary platforms

sharp geyser
#

right

quartz kindle
#

so they have much more control over it and freedom to optimize

#

but sometimes they still produce garbage anyway

sharp geyser
#

indeed which I think is a good thing

#

its cool your os can work on a number of hardware and platforms

#

but that comes with stability costs

quartz kindle
#

i dont know what is the current state of macos, havent used it since like 10.7

sharp geyser
#

It's not terrible

quartz kindle
#

but i absolutely hated how apple would try to hide everything from the user

sharp geyser
#

Just the prices are so abnormally high its ridiculous

quartz kindle
#

there were literally no progress bars or any progress information for basic stuff like syncing, uploads, etc

sharp geyser
#

even the m1 and m2 chip macbooks are pricey

#

despite m3 and now m4 being a thing

quartz kindle
#

trying to download images from an iphone into a mac was such a pain

sharp geyser
#

quite honestly if you dont have a m series chip you dont buy a macbook for anything serious

#

you need a m series chip to do anything worth while

quartz kindle
#

yeah they are pretty good

#

but intel gen12+ are also very good

civic scroll
#

oh yeah

#

tim

#

speaking of mic issues

#

my mic array caused my system to bluescreen'd 4 times

quartz kindle
#

dafuq

civic scroll
#

just by unplugging my headphones

quartz kindle
#

dafuqยฒ

civic scroll
#

same question

quartz kindle
#

man if only we could write drivers in js

#

we would just write our own drivers

#

and throw their garbage drivers out the window

frosty gale
#

i wanna laugh at this so bad

#

going through terrible job postings make my day

quartz kindle
#

rip

#

reminds me of that one where a job posting was asking for 10+ years of experience in something that only came out 4 years ago

sharp geyser
#

Im sure if its you

#

you can find a way

#

๐Ÿ’€

#

At this point im starting to question if you arent the one who wrote js

frosty gale
#

its actually quite simple

#

all you need to do is write some node gyp bindings so you can access kernel resources through js

#

you could even have the js read and write from memory locations

quartz kindle
#

lmao

#

there are 2 main issues tho

sharp geyser
frosty gale
#

this is literally the only binding you need for this

void write_to_memory_location(JS_NUMBER address, JS_NUMBER value) {
  *(uint64_t*)address = value;
}
#

then you receive SIGSEGV

sharp geyser
#

signal seg v?

quartz kindle
#
  1. the entire windows bullshit ecosystem you need to navigate through to make your thing be accepted as a driver and integrated into windows
  2. the entire device io specs and shit which you probably wont find any resources about and would need to do shit like dump usb data and analyse low level registers and switches and what not
frosty gale
sharp geyser
#

makes sense

frosty gale
#

although since youre kernel you wont get that

frosty gale
#

youll just get undefined behaviour or the system will crash

sharp geyser
#

:)

quartz kindle
#

lmao

#

i quit

sharp geyser
#

lol

quartz kindle
frosty gale
#

its already been done

sharp geyser
frosty gale
#

but you could definitely make it kernel as well

quartz kindle
quartz kindle
#

user interface powered by webkit

#

written with svelte

civic scroll
quartz kindle
#

imagine, a kernel with v8 embedded into it

civic scroll
#

does it start like v8 tho

#

make it sound like one

quartz kindle
#

:^)

#

a kernel with an embedded v8 that runs the system core, and then spawns more v8 instances for system processes

#

and every user app is based on another v8 instance

#

so every single software written for this os needs to be written for v8

civic scroll
#

"Your OS is just a huge Electron application"

quartz kindle
#

basically

civic scroll
quartz kindle
#

embedded webkit for UI

#

all apps are basically browser windows

#

ram go brrrrrrrrr

civic scroll
#

the ability to surf web from everywhere

#

system requirements: 1TB ram

quartz kindle
#

oh yeah, every single system app has access to chatgpt

#

clock, calculator, notepad, restart button

#

every single button runs on its own v8 instance

#

:^)

lament rock
#

ngl if you could make your system just one browser instance and style it with html and css, that'd be pretty cool. Sub apps could be iFrames or just child nodes

frosty gale
#

but theres not much of a point

#

most custom operating systems now are written for embedded devices

#

those need to be very performant and do a lot with least power on very small chips and power available

#

js is a big no

#

for more desktop sized machines you just have linux kernel and you can run js on there as much as you want

radiant kraken
sharp geyser
#

rice?

sharp geyser
#

the games themselves would have to be webgl ported

#

unless you are fine playing those boring games that they got available on the browser

lament rock
#

Can write wrappers for APIs to run in the browser context

#

You aren't limited to a browser as an app. The browser is the whole system

radiant kraken
pearl trail
radiant kraken
pearl trail
#

!!!

desert verge
#

Wtf

sharp geyser
#

do you use something by dell?

desert verge
#

Yes... but I can't afford for anything else, the laptop I currently use was like 150โ‚ฌ, my old pc was also a laptop and it already has 4 years when my mom bought it for my birthday, I just noticed that when that old computer started lagging, I just saw that it had actually 7 years (it's really dead though and it's a very big old laptop, second-hand)

#

I can only use this laptop, my parents wouldn't buy another computer if I break mine

#

That's shit, I want MSI Katana or Razer Katana lol forgot the brand name

#

but it's like 4 numbers cost

desert verge
# desert verge

What can I do to use only one? I'm afraid to RIP my audio card if I do this

#

But it would reduce memory usage though, but I still want audio lol

pearl trail
#

i personally use realtek audio

desert verge
#

a driver ?

#

Ye I should use it

#

Realtek I already heard that name

pearl trail
#

"RtkNGUI64.exe and RAVBg64.exe are the Realtek Audio device driver on your PC. LogiLDA.dll is the Logitech Download Assistant. HPStatusBl.dll is the Taskbar icon app for your HP Printer driver software."

#

yes

#

so maybe just remove that wavesvc

desert verge
#

Why there is 2, like ???

#

Okay

#

You know what it actually is ?

#

wavesvc ?

#

I'm gonna update my audio drivers

pearl trail
#

"What is WavesSvc64? Wavessvc64.exe is associated with Waves MaxxAudio Service Application, and it's a part of Waves MaxxAudio or Realtek High Definition Audio Driver." ๐Ÿ’€ part of realtek too

desert verge
#

on the official site

#

A

pearl trail
#

yeah, updating it is the best way

#

or maybe clean install audio driver

desert verge
#

oke

#

Yes

#

I'm gonna do that

pearl trail
desert verge
#

Thanks

desert verge
sharp geyser
#

wavesvc64.exe comes with basically anything dell

#

its their audio driver of choice

desert verge
#

Okay

#

Thx

#

I run Setup.exe ?

#

Wow so much Realtek things

pearl trail
sharp geyser
#

On that note

pearl trail
#

it was like 2-3 years ago

sharp geyser
#

dont attach anything to process

#

its a terrible idea

desert verge
#

I didn't watch

#

But no, I remembered nothing

desert verge
pearl trail
#

oo yeah senko-san

desert verge
#

So how can people cache things ?

#

in their code

sharp geyser
#

ofc you can cache things

desert verge
#

Or like

sharp geyser
#

Maps, Sets, even let a = {}

#

All get stored in memory

desert verge
#

Like, just store metadata, and it's permanent

sharp geyser
#

its not permanent no

#

cache should never be permanent

#

it should always drop when the process ends

#

If by permanent you mean while hte process is running then yes

#

during the duration of the process running it will remain there

#

once the process exits/stops it too should be dropped

#

and modern langauges have garbage collectors that do this for you

desert verge
#

Yeah if I want it to be kept if it's not running, it's actually called a db lol

sharp geyser
#

yea

desert verge
#

I was asking that because of this

sharp geyser
#

yea

#

depends on how long you want to hold onto that data

#

if you want to forever keep track of who voted then use a db

#

if you only care about temporarily holding onto it cache it in memory

desert verge
#

Actually, maybe it's useless for now, well, when I voted, my server crashed because I haven't well handled the request, it says that if doesn't return status 200, it will retry, but my server was down for several minutes, when I started my bot, topgg stopped retrying....

#

I said useless, because I have a reward system when someone votes

#

but it's not actually instant reward

#

But if a user voted and didn't receive that reward I should... well, verify if the user voted when the bot starts

sharp geyser
#

I disagree

#

Don't do that at start

#

Imagine you have a bunch of users who voted when your bot went down

desert verge
#

It uses RAM only at start

sharp geyser
#

ram isnt the issue here

#

its the api spam you are thinking of committing

#

That method has a fault where if there are a lot of users, you are going to be spamming top.gg's api to check

desert verge
#

Ah yah I thought twice, yeah actually

#

Should like make a command /vote receive

sharp geyser
#

Ima be real there is no real way to handle this

desert verge
#

?

#

or a thing like that

sharp geyser
#

a cmd is the best bet

#

unless you make your own api that builds off of top.gg's api that you run on a separate process from the bot

#

so if the bot goes down, if they vote you are still logging it

desert verge
#

Yeah that's pretty interesting

sharp geyser
#

then whenever someone runs a vote locked command fetch your api to see if they are in the recently voted list and they haven't expired

desert verge
#

I can make a separate webapp / rest api server

sharp geyser
#

That's one way yes, it'd save you from fetching top.gg all together

#

build it into your webhook

#

that top.gg will post to when someoen votes

desert verge
#

But my bot actually needs a database, and the server needs to send a message as the bot into a channel

#

So my bot "server" also needs a server

sharp geyser
#

you will already be making a web api for webhooks with top.gg's vote system

#

just use that

desert verge
#

to make request to my bot

#

Okay

sharp geyser
#

It'd save you from spamming top.gg's api

desert verge
#

I yes lol, I created a webhook for voting, but I used my bot user instead lol

sharp geyser
#

One thing you can do is
Cache it locally, when your bot requests your api check your cache if its not there check top.gg in case your api missed it

desert verge
#

But my bot should send a message to the user when the latter vote

sharp geyser
#

you will want to use a timed cache btw

#

So records expire in corrospondence to top.gg's vote system

desert verge
#

How much hours or days ?

sharp geyser
#

as people can vote every 12h iirc

desert verge
#

aj ok

sharp geyser
#

you dont want duplicate records in your cache

#

Cuz one could be old

desert verge
#

I do with a date

sharp geyser
#

or they could of not voted again

#

and now you are giving them free access

desert verge
#

and I create a lastVoteTimestamp field in my db in the users collection

#

To check

desert verge
#

I can compare votes with timestamps

desert verge
#

Well I'm gonna do that surely when I have the time

sharp geyser
#
#

keyv is a good way to cache things

desert verge
#

Wow

sharp geyser
#

it stores it in memory

desert verge
#

Thx

sharp geyser
#

or

#
npm install --save @keyv/redis
npm install --save @keyv/mongo
npm install --save @keyv/sqlite
npm install --save @keyv/postgres
npm install --save @keyv/mysql
npm install --save @keyv/etcd
#

any of these

#

keyv is more than just a cache it can also be used for persistent storage with things like mongo, postgres, mysql etcetc

#

its just a key value store

desert verge
#

I use mongodb

sharp geyser
#

if you want the cache stored in mongo go for it

#

but memory storage should be fine

#

since you are expiring records it wont bog up memory too much

#

if you notice performance issues definitely go to mongo tho

#

it will still expire the records

desert verge
sharp geyser
#

that gets rid of the api for ya minus needing the webhook api

desert verge
#

Yes

sharp geyser
#

on your webhook api just have keyv set

#

and on your bot have keyv get

#

from the same mongodb

desert verge
#

Oh yeah I see

#

so it's keyv on the two processes / servers ?

sharp geyser
#

I mean yea

desert verge
#

Yeah seems logic

sharp geyser
#

unless you make the webhook api on the same process as your bot

#

which I do not recommend in case your bot crashes

#

you dont want people voting and not being logged.

desert verge
sharp geyser
#

One thing to note

#

if both the api and bot go down since you are using mongodb

#

have your bot get from mongo, if they aren't there double check with top.gg

desert verge
#

Alright

sharp geyser
#

Its always better to double check yourself rather than ignore the possiblity

desert verge
#

Yeah I see

sharp geyser
#

I'd say also put them in cache but top.gg doesn't return the time they voted iirc

#

so it will be hard to expire them automatically

#

cuz they can use the vote cmd like 5m before their vote expires, if you put them in cache well now they are free to use cmds for 12h without voting again

desert verge
#

But actually, my hosting service or pterodactyl panel restarts the bot if it crashes, but if it crashes twice in the same delay, it is really down

#

So my vote handling server, will be likely to stay alive

#

Because

#

When I upload my bot, it can have bugs (or things I wrongly wrote so it crashes)

sharp geyser
#

still always good to have fail safes

#

Do all that you can to prevent the unexpected

#

you wont be able to catch everything

#

but the most obvious problems you can solve

desert verge
#

(btw I think I really improved in English)

sharp geyser
#

Anyway its 5:30am

#

Time for me to hit the hay

desert verge
#

it's 11 am 25 for me

#

France

#

lul

sharp geyser
#

gl on your adventures

#

all the best

desert verge
#

Thanks

sharp geyser
#

๐Ÿ‘

desert verge
#

You start working at 5:30 am?

#

Goodbye

#

See ya

sharp geyser
#

no

#

im going to bed

desert verge
#

ah ok

desert verge
#

Maybe it installed the main driver

#

And crashed on others

#

No it just didn't install

#

lemme translate for ya

#

Realtek HD audio driver installation failed.
No driver is supported by this driver suite

pearl trail
#

are you sure all audio drivers are uninstalled?

#

check device manager

sharp geyser
#

are you sure your hardware supports those drivers?

#

windows version

quartz kindle
#

go on your laptop's manufacturer website and download the drivers for your laptop model from there

desert verge
desert verge
# sharp geyser windows version

I have Win11 but I think it was little bit forced and my pc broke on day, but it was working again when we removed the battery

#

My actual laptop should be only capable of running Win10

#

not 11

#

It's showing Realtek Audio anyway idk why

#

Alr i'm gonna install on the dell website

#

yeah seems it's not the same page

quartz kindle
#

you should be able to run both without an issue

earnest phoenix
#

I am using .png format but why I'm getting this error?

digital swan
#

try hosting it on a different image hosting website

lyric mountain
#

background img is bugged atm

earnest phoenix
deft wolf
#

Because they put the banner link before it was bugged

lyric mountain
#

yep

earnest phoenix
earnest phoenix
deft wolf
#

I don't know, I've never used it

earnest phoenix
#

let me try

desert verge
earnest phoenix
#

In the TopGG, my bot shows as 784 server count

#

but the real server count is 960

#

how can I change it?

#

and my api also well connected

deft wolf
#

Your bot has stopped sending updated data since April

#

So apparently the top.gg API has stopped accepting your data since then

earnest phoenix
#

You need to send your data to the API again, see #topgg-api

quartz kindle
lyric mountain
quartz kindle
#

what model is your laptop?

earnest phoenix
desert verge
quartz kindle
desert verge
#

Maybe

lyric mountain
quartz kindle
desert verge
#

No

#

Realtek HD

#

Realtek HD Audio Driver

lyric mountain
#

why do u even need to manually install realtek drivers?

desert verge
#

??

earnest phoenix
lyric mountain
#

...

#

what http status?

#

actually, how are u (force) sending the request?

desert verge
#

yeah, what's the status response ?

#

@earnest phoenix

quartz kindle
# desert verge No

try installing both of them then, but anyway if your audio is working then what is the issue again?