#development

1 messages · Page 104 of 1

hushed robin
#

thx 🙌

raw nest
#

Does someone know ChartJS? Is there a possibility to place datasets between labels?
E.g. I want 30min periods as labels but between them I also have data for e.g. 12:37 AM a dataset etc.?

rustic nova
#

Oh you dont know how much I had to deal with ChartJS

#

you can have multiple datasets on one chart

#

Should also allow mixing multiple datasets with different labels

raw nest
#

@rustic nova hm okay. Yes I already saw that. So what I want is e.g. I have 1:00 PM & 2:00 PM labels and I want to place 10 datasets between it (e.g. 1:13 PM, 1:15 PM, 1:37 PM...) so the datasets don't stick to the labels

rustic nova
#

So essentially something like
1:01PM 1:02PM..
1:00PM 2:00PM

raw nest
#

exactly

rustic nova
#

the example seems to match what you'd need

#

just as an example with months and years

#

the implementation seems a bit more complicated than I thought, but yeah that should do it

rustic nova
raw nest
rustic nova
#

ohh

#

the second x-axis seems to only be for keeping track of the ranges itself rather than the times, so you'd need to have the main x-axis as the times, then the second one with the 1:00PM, 2:00PM and so on

#

as far as I can tell at least

raw nest
rustic nova
#

Am sure its possible, chartjs is pretty customizable

#

unsure how it would be done though

raw nest
compact pier
#

How should I save images that are being sent from client to server?

#

What is the most efficient way?

rustic nova
#

through bytes in memory

#

or are you referring to storing it long-term?

lament rock
#

lossy compression exists or resizing to a standard format

compact pier
wheat mesa
#

Anyone can sue anybody for anything. Doesn’t mean you would win, so I would seriously love to see you try lmfao

slender wagon
#

i don't think his parents are gonna agree on suing anyone over the internet

slender wagon
#

so change that to
i can't sue you

hushed robin
#

no

slender wagon
#

yes

hushed robin
#

i could sue him

slender wagon
#

u are underage and can't make a case

hushed robin
#

so

#

being underaged doesn’t mean I can’t sue him

slender wagon
#

anyway if u wanna talk more bring it to dms i'll show you why even tho u may sue them you can't win the case

#

dms are at $230 a hour rate

earnest phoenix
#

Yes

eternal osprey
#

Hey guys, i had a question about registers (a set of flip flops) in general. A flipflop must have 2 selector bits denoting whether we want to perform the set, reset or hold action right? In a digital circuit it's only denoted to have one input called d. Does this mean that d must expect 2 bits?

wheat mesa
#

We’ve been doing flip flops in my class and I’m ngl our teacher sucks so unfortunately I don’t understand them either

eternal osprey
#

brooo me too tvh

#

tbh

#

like flip flops are quite easy, i could help you with that

#

just registers were never really fucking mentioned besides a 2 minute short description brev

wheat mesa
#

Our teacher has an English degree and has never taught this course before and knows basically nothing about electronics

#

But the school gave him this course to teach for some reason

eternal osprey
#

whhahahhaha no way that's fucked up

wheat mesa
#

We literally teach him 💀

eternal osprey
#

whahahahah

#

do you have digital?

wheat mesa
#

The course is called digital electronics

eternal osprey
#

no i meant digital

wheat mesa
#

No idea what that is

eternal osprey
#

the program to simulate digital circuits

wheat mesa
#

We use a program called MultiSim

eternal osprey
#

ahh i see

wheat mesa
#

We’ve been trying to make truncated binary down counters for the last 3 days and our teacher can’t figure it out to teach us how to do it

eternal osprey
#

omgg that is fucking hell

#

i have a teacher that is like really smart in these things, so he assumes we already know everything

#

we are both fucked

wheat mesa
#

I can make a binary down counter with d flip flops but I can’t figure out how to use the async inputs to get it to count from 5 to 0 instead of 8 to 0

lament rock
#

@eternal osprey I was recently watching a yt video explaining stuff like registers and other concepts which I found very informative and fun.

https://youtu.be/I0-izyq6q5s

Exploring some of the basics of computer memory: latches, flip flops, and registers!

Series playlist: https://www.youtube.com/playlist?list=PLFt_AvWsXl0dPhqVsKt1Ni_46ARyiCGSq
Simulation tool (work in progress): https://sebastian.itch.io/digital-logic-sim
Source code: https://github.com/SebLague/Digital-Logic-Sim
Support the channel: https://www...

▶ Play video
eternal osprey
#

hey, thank you! i will have a look

lament rock
#

He does revise his logic a few times, but it shows some techniques

eternal osprey
#

I understand the topic quite well, but had trouble with understanding how the value actually gets hold. Then i came with an insight but not sure whether it's correct. If we select the I to be 1, we perform the set action right? So Q will be set to 1. But on the rising edge of the clock the Q could already be overridden as I could change. Does that mean if we want to hold a value, the input I must stay the same?

lament rock
#

once the set signal has been sent, any value sent to a register is stored but if the value of the input has changed due to a race condition, you may need to separate bus lanes if they're shared

#

or make a queue system

eternal osprey
#

oowh so the register takes one set/reset input and another input for selecting what you want to store?

lament rock
#

Yeah. Depending on the register size of course

eternal osprey
#

i thought that the registers were just flipflops attached to each other

#

as the flipflops don't really need an external input for the thing to be stored

lament rock
#

Well. 1 bit registers can effectively be flip flops

eternal osprey
#

hmm

#

the flipflops, if they have a 1 as input it will set the q to 1 right. It will instantly output it. Is this the same with registers? Because, if we set something in the registers, will it output the current value like normal flipflops or the previous value?

lament rock
#

I still recommend watching the video or at least parts that are relevant to you because he does go over accepting an input and a store signal

lament rock
eternal osprey
#

i already found it strange that the register had an extra input

#

oowh i see, i will def watch the video.

eternal osprey
#

oowh wow i understand it now

#

this fucking simulator sees the registers as a series of flipflops, so the d is the action you want to perform and the en the data to store (1100 for example if you want to have a register of 4 flipflops)

#

so suppose we are saving 1000, it will output 1000 as well. As long as our D is 1 (if that is our previous action) it will stay 1000. If the D is 0, it will reset the register (or if we have an input en that is different than 1000 and D is set to 1)

slender wagon
#

hey, so i am working on some discord webhooks rn and for some reason they work only once and then they respond with status 200

#

anyone has a clue?

earnest phoenix
#

Trying to add a pause in my code that looks somewhat decent;

            try {
                Thread.sleep(500); // Pause for half a second
            } catch (InterruptedException e) {
                // Handle the exception
            }
            if (i == 1) {
                System.out.print(".");
            } else if (i == 2) {
                System.out.print("..");
            } else if (i == 3) {
                System.out.print("...");
                System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); // Move the cursor back
                System.out.print("Creating Player..."); // Print the final message with an extra space
                z++;
            }

            try {
                Thread.sleep(500); // Pause for half a second
            } catch (InterruptedException e) {
                // Handle the exception
            }
            System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); // Move the cursor back
            System.out.print("            "); // Overwrite the previous output with an extra space
            System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); // Move the cursor back
            System.out.print("Creating Player");
            if(z == 1) {
                System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); // Move the cursor back
                System.out.print("            "); // Overwrite the previous output with an extra space
                System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); // Move the cursor back
                System.out.println("Creating Player...");
            }
        }```
#

Is there an easier way to do this lol? Seems like a lot for such a small thing

deft wolf
#

Please, use codeblocks

winged linden
#

Hey! I got a question 🙂

I have a setinterval function but sometimes the function inside it takes more time to execute then the interval time set (& it all depends how many guilds are using this feature) how can i insure this doesnt happen?

deft wolf
#

Thanks

rustic nova
#

also for

            if (i == 1) {
                System.out.print(".");
            } else if (i == 2) {
                System.out.print("..");
            } else if (i == 3) {
#

probably a way to optimize too

winged linden
rustic nova
#

also tbf, adding a simulated delay is ehh

lyric mountain
earnest phoenix
#

Just wanted to try it because it looked goofy with how it was

lyric mountain
#

Gone from path detection to cpp to circuit design

rustic nova
#

but yeah you can improve on the "move the cursor back" methods instead of having out.print all over

earnest phoenix
#

Also other random question-
I want to make this thing into a discord bot but have no idea how (lol)
Would it be hard to create the idea in java and then fix it to work with a discord bot? Or would it be easier to just learn how to make a bot and do it from the ground up

rustic nova
#

2 things, yes would suggest to learn bot development from the ground up

#

second, using thread.sleep inside a discord bot is gonna be pain

#

since it would pause the whole discord bot iirc

lyric mountain
#

You recalled correctly

#

Unless it's not js/python/dart/pascal

slender wagon
#

guys just so you know the global fetch of node can be very weird

#

keep node-fetch atm

#

i had to delete 15 webhooks cuz of it

#

for some reason it was sending the info only once

lyric mountain
#

Global fetch?

slender wagon
#

well the fetch node has on its own now

lament rock
#

what node version are you using because it might use outdated undici

slender wagon
#

18.13

eternal osprey
#

from databases, to coding, to fucking math.

#

each course is enlarging my ass

lyric mountain
#

U sure it ain't computing engineering?

#

CS doesn't usually go down to fucking circuits

wheat mesa
#

yeah circuit design classes usually are for electrical engineering majors

eternal osprey
# lyric mountain U sure it ain't computing engineering?

we got like 3 different degrees in the netherlands, so like you got the CS that's equivalent to college ig that mainly does practical things like coding etc, then you have a degree higher, which is university where you mainly learn about the information behind the practical things.

#

So cpu's, memory, as well as matrices, security and what not

#

ion know what the fuck i am doing with my live tbh

lyric mountain
#

You'll end up with 3 degrees at once

earnest phoenix
eternal osprey
#

yeah i wish that i went to a university in like the US or something

lyric mountain
#

I mean, you'll end up quite knowledgeable in a bunch of areas

#

At the cost of 1/3 of your sanity but oh well

eternal osprey
#

1/3?

#

Crank that shit up

#

i got no fucking social live

wheat mesa
#

I'd say the majority of software engineers probably don't know too much about the internals of a computer. You'd have an advantage over people in that space for sure

eternal osprey
#

i gotta study 24/7 to understand half of the topics lmao

wheat mesa
#

Rigorous programs will make you a diligent and experienced person when you get out of uni

eternal osprey
#

yup indeed, but at this moment it has become a bit too much for me

lyric mountain
#

Try to get a hobby to ease your tension if u can

#

Else you'll burn up like a grape in microwave

eternal osprey
#

yeah i go to the gym and love to code, but yeah don't really have much time for that as my exams start in a week

wheat mesa
#

@lyric mountain just made a pretty decent improvement to the performance of the systems in my engine by giving an initial size to the HashSet that stores the entities in each system

lyric mountain
#

The same applies to arraylist

#

In fact, arraylist is pretty slow if it grows fast since it increases the capacity only a bit at a time

wheat mesa
#

thought it doubled the size on every resize?

lyric mountain
#

Not arraylist iirc

#

Lemme check, just a sec

#

Most apache collections do use doubling method

earnest phoenix
#

What is this and why does it need my 2fa code

lament rock
#

Discord applications by default are assumed to be for rich presence purposes and you have to specifically mark it as a bot in order for it to be a bot account which is a destructive action

earnest phoenix
#

does it do anything to my actual account

lament rock
#

not to your account no

earnest phoenix
#

Is there any reason not to do it

lament rock
#

If you're not making a bot

lyric mountain
#

also making a bot there will not, I repeat, will not create a functional bot

#

it'll just create a bot account that can be used for programming a bot

earnest phoenix
#

wdym

lyric mountain
#

I mean you'll just create an empty shell

#

it won't give you a bot like @gilded plank or @grave zealot

earnest phoenix
#

i mean yeah

#

how do i get gradle

#

for this

wheat mesa
#

oh boy

lyric mountain
#

when you setup a project intellij will download it automatically

#

my question is, what are u trying to do?

earnest phoenix
#

make a bot

lyric mountain
#

do you have previous experience with java?

earnest phoenix
#

I know how to do everything I want to in java

#

just not discor dbot

#

trying to make something like this i guess

lyric mountain
#

what did u make in java before?

#

just asking cuz very rarely you'd not bump into maven/gradle soon or later when programming in java

earnest phoenix
#

AP cs stuff if you're familiar with that

#

this is my first time coding outside of taht shitty website codehs

#

so haven't really experienced all this stuff

lyric mountain
#

ah ic, no prob then ig

earnest phoenix
#

ignore the inputs (lol) but this is what I have so far- just want to make it into a discord bot

lyric mountain
#

I have to ask cuz we get a lot of people here who never touched code trying to make a bot

wheat mesa
#

uh so fair warning AP CS is a lot different than making a bot with JDA

#

it's going to be a challenge I'll warn you

#

but it's definitely something you can do if you've taken the fully AP CS course

earnest phoenix
#

yeah

lyric mountain
#

I suppose ur gonna use JDA right?

earnest phoenix
#

i understand that I don't know what I'm doing 💀

earnest phoenix
lyric mountain
#

the discord library I mean

#

there are a couple for java iirc, but jda is the most stable (and popular) atm

earnest phoenix
#

Yeah doesn't matter to me

#

It's what the guide i'm using says to use so whatever

lyric mountain
#

...you see, choosing the correct library is highly critical if ur gonna make a bot, since you can fall into pit traps (abandoned libs for example)

#

but well, did u download intellij?

earnest phoenix
#

ye

#

I have a program setup in intellji

#

just not for anything discordbot relayed

lyric mountain
#

then all you need to do is click new project and select gradle, the setup is pretty straightforward

quick ridge
#

Hello how are ther to dey

earnest phoenix
lyric mountain
#

the screenshot is outdated, gradle got merged into java

lyric mountain
#

I'll circle it

earnest phoenix
#

oh

#

i seee

lyric mountain
earnest phoenix
#

ye

lyric mountain
#

I do not recommend using java 8

earnest phoenix
#

what else is there

lyric mountain
#

java 18

earnest phoenix
#

oh

lyric mountain
#

java 8 is extremely outdated, you should always use the latest LTE version

earnest phoenix
#

can i just do this

lyric mountain
#

unless you're forced due to backwards compatibility

#

yes, that one is fine

#

intellij automatically downloads versions for you, which is nice

#

yes just checked, you're using jda

#

I recognize that guide

#

that guide is outdated tho, you don't need to make a shadowjar to run the bot

#

you can simply run with gradle directly

earnest phoenix
#

so how do i actually do it

lyric mountain
#

it's in the readme iirc

#

after u create a gradle project all u need to do is add what's written here

earnest phoenix
lyric mountain
#

yes, but what's shown there is if you were to create a shadowjar

#

implementation("net.dv8tion:JDA:VERSION") this is all that matters

#

replace version with the version shown in the repo

earnest phoenix
lyric mountain
#

replace $jdaVersion with the latest version

#

without v

#

u can also click on that tag to get the full gradle string

#

implementation group: 'net.dv8tion', name: 'JDA', version: '5.0.0-beta.5'

earnest phoenix
lyric mountain
#

u wrote something wrong

earnest phoenix
lyric mountain
#

yeah remove $

#

use the format I sent btw

#

implementation() is legacy format

earnest phoenix
lyric mountain
#

yes

#

now click the elephant button on the top right

#

and let it download the necessary stuff

earnest phoenix
#

what elephant button lol

#

the dinosaur?

lyric mountain
#

that's supposed to be an elephant lmao

earnest phoenix
#

k yeah it did it

lyric mountain
#

but yes

#

u can also remove the test block below

earnest phoenix
lyric mountain
#

it's useless since u cant unit test a bot

lament rock
earnest phoenix
#

so why does thbis still no tworth

#

still not work

lyric mountain
#

u need to import them

#

click on the lamp icon

lyric mountain
earnest phoenix
#

the lightbulb/

lament rock
#

You're only now realizing that after all this time I spent discussing all of my stupid projects?

lyric mountain
#

lmaoo

lament rock
sudden geyser
#

that's not really a stupid project

earnest phoenix
#

still says htis though

lyric mountain
#

do the same again

earnest phoenix
#

lightbulb went away

lyric mountain
#

alt enter

sudden geyser
#

testing remote stateful things is fairly useful

earnest phoenix
#

oooh

lyric mountain
#

also, BOT_TOKEN is supposed to be replaced

earnest phoenix
#

well yeah

#

but

lament rock
#

tbh I am a little intrigued in making a server people can override their gateway connections to test their bots

lament rock
#

since most libs offer proxying requests

earnest phoenix
#

why is it saying my token isn't a thing lol

lyric mountain
#

because it doesnt exist until you declare that constant

lament rock
#

Would be fun trying to have non committal objects which is based off of sessions

earnest phoenix
#

I put my bot token in it

#

saying cant resolve symbol for part of it

lament rock
#

or delete everything after a time period

lyric mountain
#

did u write "like this" or like this?

earnest phoenix
#

2nd

lyric mountain
#

...ok, listen

#

ik making bots is cool and all, but you should attempt an easier project until you get the hang of java

#

bots aren't as easy as it sounds

earnest phoenix
#

This has nothing to do with java

lyric mountain
#

it does

earnest phoenix
#

I'm just trying to get it setup and then learn it

lyric mountain
#

you forgot strings require quotes

earnest phoenix
#

No

lyric mountain
#

the token is supposed to be a string

earnest phoenix
#

I did not know it was supposed to be a string

lyric mountain
#

the function shows it

earnest phoenix
#

You just said put the token in lol

#

that has nothing to do with java

#

Like I said, I'm just trying to get the basics setup and then worry about everything

lament rock
#

That has everything to do with Java

earnest phoenix
#

Not this specific problem that prompted them to say that I should go learn java before trying something like this

lyric mountain
#

booting up intellij just to show it does ask for a string

lament rock
#

You cannot setup something without prior knowledge of the language

earnest phoenix
#

Like I said before

#

This is my first time actually using intellji

#

not some shitty website that doesnt help with anything

#

Forgot you could hover over it to see what it needs

#

The issue isn't that I didn't know a string needs "", I just didn't know it was supposed to be a string

lyric mountain
#

note "String token"

lament rock
#

as you type, I'm pretty sure a popup of the argument list and expected types pop up showing what's needed

earnest phoenix
#

Whats your point

#

I didn't say that it wasn't supposed to be a string

lyric mountain
#

java only has 3 types of values (from a very high view)

#

either a primitive, a string or a class

#

a token contains both numbers, letters and punctuation

#

which cannot be any of those

#

unless put in quotes

#

plus the error would tell u it was supposed to be a string

earnest phoenix
#

Someone else told me that you can't create a bot in java and it's completely different. I wasn't thinking about java logic. Again, I'm just trying to get the basics setup and then figure everything out. I know what I need to know in java for this

lyric mountain
#

that person is terribly wrong lul

#

you can make a bot in any language that allows http requests

earnest phoenix
#

And as I said before, this is my first time using intellji. What I've mostly coded on before doesn't tell you what needs what, or anything close to that, so I wasn't even thinking about looking at it to see what was wrong.

lyric mountain
#

no problem with that, but try to make a simple project just to get used to your tools first

#

else you'll get stuck after the guide ends

#

and I mean it, most of using JDA is using javadocs and ctrl + space to discover methods

#

since it lacks a comprehesive wiki (don't blame them tho, it's a huge lib)

wheat mesa
#

Keep in mind that AP CSA is actually also a fairly introductory course to the language and actually doesn’t teach a ton

#

The most advanced data structure they go into there is like arraylists pretty much

lyric mountain
#

if u do choose to practice before making a bot I'd gladly help you with your questions

earnest phoenix
#

so even making a bot that's just input output is complicated?

lyric mountain
#

well, not exactly "complicated", but it's somewhat counter-intuitive for a new dev

wheat mesa
#

there's a lot of setup involved

earnest phoenix
earnest phoenix
#

but yeah i guess i could see how its not as simple as i thought it would be

lyric mountain
#

like, with bots you'll be mostly working in an async scope

wheat mesa
#

Yeah, HTTP requests and responses are not taught in AP CSA, so it's going to be a new concept

#

Events as well

#

Lambdas and such

winged linden
#

hey can someone help 🙂

#
  verifyservers.find().then(async function (b) {
    for (const server of b) {
      const address_to_track = server.track_address;
      const guildid = server.server_id;
      const roles = server.roles;
      const guild = client.guilds.cache.get(guildid);

      if (guild) {
        const perms = guild.me.permissions.has("MANAGE_ROLES");
        if (perms) {
          const members = await guild.members.fetch();
          await Promise.all(
            members.map(async (member) => {
              const account = await profiles.find({
                discord_id: member.id,
              });
              let count = 0;
              if (account.length > 0) {
                //check number of nfts
                await sleep(100);
              } else {
                //remove the related roles
              }
            })
          );
        }
        await sleep(1000);
      }
    }
  });
} finally {
  isRunning = false;
}```

i have this piece of code in a setinterval function but its making my bot SUPER slow, does changing to a much more powerful vps solve that problem?
solemn latch
#

Why sleep?

You're sleeping every member of every guild,
If your bot is in one guild with 30000 bots that's 3000 seconds for just that one guild for no reason

#

Also, you're fetching every member of a guild every time

deft wolf
#

It's not sleep per server?

solemn latch
#

100ms per member

#

1000ms per server

#

From what I see

deft wolf
#

Ah yes

#

You're right

winged linden
earnest phoenix
#

mee6 moment

winged linden
#

Bots arent in my database anyways, the database consist of users that linked their wallets only

deft wolf
#

Yes, but you fetch all users on each such server, not just those who are in the database

lyric mountain
#

can't you just track that data through other means?

deft wolf
#

If you don't need them then why do you need them in the cache

winged linden
#

It doesnt sleep if they arent in the database though so this part isnt causing problems

lyric mountain
#

try a reactive approch, instead of proactive

#

like, react to actions instead of taking actions yourself

#

for example when the user speaks

winged linden
lyric mountain
#

it's cuz ur fetching + sleeping

#

sleep usually takes quite a bit of cpu usage (in js)

#

and fetching will create new entities, thus using more ram

#

other than that, might want to use more named functions instead of lambdas, since apparently js creates a new anon function every single time it's called

winged linden
#

const account = await profiles.find({discord_id: member.id,});

deft wolf
#

Each database query takes some time

winged linden
#

gonna just cache all the data each min and just use cache then

#

probably better

deft wolf
#

I have no idea how much, but in the case of my bot, it's enough that it can't respond within 3 seconds of receiving an interaction

lyric mountain
winged linden
lyric mountain
#

kinda, but you'll compete with mongo's cache

#

and you risk desync

winged linden
#

true

frosty gale
#

i'd say more cache is never a bad thing

#

you should 100% keep your own cache alongside the databases one imo

#

you can also save a lot of requests to mongodb over a network

earnest phoenix
#

unless you need alotta ram

deft wolf
#

You mean the .env file?

earnest phoenix
#

Just ask your question, if someone is experienced with something they'll answer your question

lament rock
#

The Path env var is basically a list of directories the command prompt looks at for binaries (commands) the shell can execute. You would append a directory to the Path variable and separate entries with whatever character is used

#

I think on windows it's ;

#

what os

#

oh

#

windows 8.1

#

does it give you an error when you try to add another

#

Whenever you click the edit button on path, you should get an option to Add an entry

earnest phoenix
#

That's literally what's supposed to happen

#

You don't add variables to the PATH environment variable, you edit it and add paths

#

They're separated by semicolons on Windows

#

Which one are you choosing? The user variable or the system variable?

lyric mountain
#

semicolon

#

that path editor is weird tho

#

was supposed to be like this

earnest phoenix
#

I wonder why you're using Windows 8.1 anyway unless you can't upgrade to Windows 10/11 for hardware incompatibility reasons

winged linden
#

hey i have this,

members.forEach(async (member) => { });```

if i change it to 
```const members = await guild.members.fetch();
for (const member of members) { }``` its bugs why?
wheat mesa
#

You haven’t even shown what you’re doing with the members

#

Fundamentally those two things do the exact same thing

#

Also you haven’t described what you mean by “bugs” either

winged linden
wheat mesa
#

Ok again, I don’t know what “bugs” means here

#

That could mean a lot of things

winged linden
#

in the for loop^

#

in forEach, it works normally somehow

#

the one commented doesnt work

wheat mesa
#

Oh

#

You need to do for(const [guildId, member] of memberstest) {} instead

#

Because member in your for..of loop is [string, GuildMember], not GuildMember like you think it is

#

(Typescript for the win)

wheat mesa
#

@lyric mountain do you know if there's a way to "simulate" command line args? I want my program to always run with -Dsun.java2d.opengl=true but I don't want to have to specify that for each user running it

sudden geyser
#

how about programmatically setting the option

wheat mesa
#

yeah that's what I'm trying to do but I've never done that

lament rock
#

you can also do launch scripts the user is supposed to run versus the user trying to run it themselves.
This is what I do for most of my typescript software because I enable source maps for debugging even in production systems

#

also telling my users to launch a LavaLink remake I did using the start script via npm run start or yarn start if they prefer yarn package manager over npm

dull dragon
#

i need to be 16 to be verified dev right

hushed robin
civic scroll
# winged linden the one commented doesnt work

that memberstest is of Collection<string, GuildMember>
so if you call regular forEach, it gets called like an array (<Array>.forEach)
https://discord.js.org/#/docs/collection/main/class/Collection?scrollTo=forEach

Collection<string, GuildMember>
.forEach((value: GuildMember, key: number, map: Map<string, GuildMember>) => void)

but when you loop like for const, membertest turns into an iterator
(possibly via calling .entries() of Map)
https://discord.js.org/#/docs/collection/main/class/Collection?scrollTo=entries
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries
(optional https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols)

Collection<string, GuildMember>
.entries(): Iterator<[string, GuildMember]> // something that Array implements

that's an iterator of arrays with two elements (key, value)
to make it do the what you want it to do (which is only accessing its value)
, make a call to .values() instead

for (const member of membertest.values()) {
    //...
}

for more of that, i assume that you use discord.js, can read more here
https://discord.js.org/#/docs/collection/main/class/Collection

#

oh shit the signature was differnt

radiant kraken
#

imagine using Collection

sterile vault
queen mango
quick helm
#

hi guys,

when I need to return information that exceeds the amount of characters allowed in the embedded message, what should I do around it? Instead of an embedded message, send a DM to the person who requested it?

rustic nova
#

you can just return that error to the user, unsure how that "embed creation" is being triggered

quick helm
#

ok but the complete information requires more characters than allowed.

#

can i send the complete info to DM breaking the message ?

final tangle
jagged knoll
#

It would then look spammy and untidy but yes you could.

final tangle
#

or you can use fields if you wish

#

I have no idea what's the limit for fields

quick helm
deft wolf
#

Yea but u can send up to 10 embeds per 1 message

#

No 1 embed per 1 message

quick helm
#

interesting, that I didn't know, but will they deny it if I do that too? ^^

#

ohh i see i can send array of embedds

deft wolf
#

I don't know that, but it's definitely a better option for sending many embeds

#

Yes

quick helm
#

so nice , i'll try apply modifying it

#

ty dude @deft wolf

deft wolf
#

Np

quick helm
#

how i turn around for reviewers dont deny it lol

rustic nova
#

check if the embed is too large, if it is, just strip the rest of it and replace it with ...

#

if your embed really needs to have that content, consider using pagination

winged linden
#

hey! if i wanna slice members to process them in batches how can i do so?

quick helm
winged linden
#
const members_to_process = members.array().slice(processed_members, processed_members + batchsize);```

i have that but it doesnt work
quick helm
#

the code becomes cleaner and more readable

winged linden
quick helm
#
const takeNumber = 3

const numbers = ['1', '2', '3', '4', '5','6', '7', '8', '9', '10'];

for(let i = 0;i < numbers.length ; i + takeNumber){
console.log(numbers.splice(i,takeNumber))
}
quick helm
winged linden
#

const members_to_process = members.map((member) => member).slice(processed_members, processed_members + batchsize);
did that and its all good now, not sure if its efficient though

winged linden
#

starts at 0

#

increase each loop by the batchsize

rigid maple
#

do you know of a nodejs package that returns audio properties like this

quick helm
# winged linden ```const members_to_process = members.map((member) => member).slice(processed_me...

don't use map for loop, use map if u have to return a different object. instead of map use for.

const takeNumber = 3

const members = [
{id: 1, nome: "jao"},
{id: 2, nome: "maria"},
{id: 3, nome: "augusto"},
{id: 4, nome: "lerolero"},
{id: 5, nome: "fabiano"},
{id: 6, nome: "namala"}
];

let membersProcessed = [];
for(let i = 0;i < members.length ; i + takeNumber){
 let arrayConcat = members.splice(i,takeNumber);
 membersProcessed.push(arrayConcat); 
}

console.log(membersProcessed);
#

the output will return an array of object arrays

earnest phoenix
#

If bot

#

Reach

#

More then 100 Servers

#

and after it verifed

#

can I still use prefix COmmands?

#

without slashes

charred nest
#

yes

earnest phoenix
#

oh Okay

charred nest
#

you have to apply for message content intent for that as well

#

not just verification

earnest phoenix
#

bcz Slash commands is

#

too hard to make

#

but the prefix is easy

#

to setup so

charred nest
#

it rlly isn’t but onionpray

earnest phoenix
earnest phoenix
#

🥲

charred nest
#

discord is moving away slowly from message prefix commands anyway which means lib devs will probably eventually drop support as well

#

by support i mean helping w coding it

earnest phoenix
#

kk

final tangle
hushed robin
#

it's basically the same process

#

and they're easier to use as a developer

wheat mesa
charred nest
#

it’s still going to exist in libs. it just means that they won’t have support for it

wheat mesa
#

That doesn’t make any sense either

charred nest
#

many are already doing that

wheat mesa
#

Of course they’re going to support people working with message commands

#

I don’t know of anybody that does that

charred nest
#

hanashrug doesn’t mean it doesn’t happen

wheat mesa
#

That would make no sense, anybody that does that probably doesn’t have many people using their lib

sick agate
#
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "pico/stdlib.h"
#include <stdlib.h>
int main() {
    stdio_init_all();
    printf("Working");
    size_t current_size = 0;  
    char buffer[1024];
    memset( buffer, 0, sizeof( buffer ) );
    while (true) {
        char character;
        character = getchar();
        int a = (int)character;
        if (a==10 || a==13){
            printf("%d",a);
            printf("%s\n", buffer);
            memset( buffer, 0, sizeof( buffer ) );
            current_size = 0;
        }
        else {
            buffer[current_size++] = character;
        }
        }
    return 0;
}

i somehow end up not being able to reuse the array

radiant kraken
sick agate
#

second

#

i need the first

radiant kraken
#

buffer[current_size++] = character; sounds like an array access out of bounds nvm

sick agate
#

it works fine without 2nd.memset but probably

radiant kraken
#

wha

radiant kraken
sick agate
#

will try

#

fixes

radiant kraken
#

np

sick agate
#

thanks

radiant kraken
#

glad my C brain is still working

sick agate
#

i want to learn c better lol

radiant kraken
#

why

sick agate
#

¯_(ツ)_/¯

#

i just wanna?

radiant kraken
#

then gl

#

C wasnt a pleasant experience for me

sick agate
#

yeah i know that

radiant kraken
#

took me a few months to get used to the pointer system

sick agate
#

yeah it will to me

lyric mountain
#

That is, unless discord cuts messages from bots permanently, in which case it'd mark the death of discord as we know it

radiant kraken
#

i doubt

#

it wouldn't go as far as the literal death of discord itself

quick helm
#

prefix basically is to distinguish if it is a command or not

lyric mountain
#

It would become a different thing, not necessarily die entirely

radiant kraken
#

how

quick helm
#

started with a prefix what is concatenated with the prefix is the command after spaces become parameters

lyric mountain
#

Many unprefixed features like moderation, automatic responses, drop prizes (ik discord hates this one, but people like it), levelling, and other stuff I can't remember now

#

By "cut messages from bots entirely" i don't mean just content, I mean the actual message event

radiant kraken
#

i doubt they would do that

#

but i understand what they were trying to accomplish with the message content intent

lament rock
#

its funny though because clients receive message events for channels they can't read. There are obviously not contents attached to it, but you can exploit it for images

lyric mountain
radiant kraken
#

so i can technically view images from the #moderators channel here

lament rock
#

Discord: we dont want our users to create AIs using our users' messages.

also Discord: we're making an AI from our users' messages

lament rock
radiant kraken
lament rock
#

if on pc you can try unknown.png

lament rock
#

yeah

rustic nova
#

nah they dont

#

poc where

lament rock
lyric mountain
#

I knew about being able to see hidden channels, but didn't know about events

lament rock
#

one sec

rustic nova
#

the events arent sent to the client

lament rock
#

Then they already patched it

#

Im trying to find the video

rustic nova
#

yeah then that was old

#

I know that was a thing before

lament rock
#

Yeah it wasnt recent

#

but I didnt imagine it would be patched since it seemed like it had to deal with arbitrary permission assignment like editing the channel last_message_id so that you don't have to GET the channel before you can GET /channels/:cid/messages

#

oh wait nvm last_channel_id is just for before searches which are optional

#

Please ignore me I am dumb

#

also I think it was only user accounts that got the events because this was probably before the message content intent so having the content be null would have broken apps

wheat mesa
#

@lyric mountain I have a performance question, would it be a bad idea to get() from a HashMap every frame using a string? I'm thinking of using this for a custom input system so I can do something like if(keybindManager.triggered("Fire")) {}

#

That wouldn't be very expensive at a small scale right?

lyric mountain
#

Hashmap access is always O(1), it's fine to use it

wheat mesa
#

Well yeah algorithmically but I wasn't sure if the hashing operation on strings would get expensive to call frequently

#

I'm assuming it's probably cached after one use anyways though

#

oh perfect

lyric mountain
#

Strings are stored in a special table in java, so their hash values are stored when they're created

#

Which is why strings are immutable

wheat mesa
#

Figured so, that's one of the things I would expect java to optimize (considering what little optimization it actually does)

#

kinda insane that it does almost all of the optimization at runtime

#

not sure why they went with that design decision, maybe to optimize differently on different platforms

lyric mountain
#

The whole thing around strings in java is overwhelmingly optimized

#

I think most languages where strings are immutable use some sort of string table

wheat mesa
#

Yeah that's generally one of the most basic optimizations languages make

#

string interning is super optimized

lyric mountain
#

But yeah, java speed ramps the longer it runs since JIT will fine-tune the code depending in where it's running

#

Also why micro-benchmarking is remarkably hard to do in java

wheat mesa
#

Yeah I never understood why java doesn't do more compile-time optimizations

#

Hell it doesn't even do inline function calls until runtime

lyric mountain
#

You can hint the compiler with annotations

#

Like @Range annotation which tells the compiler the expected range of values in a param

#

There are others that tell it to inline too, I don't recall the names now

wheat mesa
#

I don't think there's an inline function annotation

#

unless I've been living under a rock

lament rock
#

@inline Trolled

wheat mesa
#

there's certain things you can do to convince it to inline, like I think that final functions are more likely to get inlined

#

if a method is too many bytes in the resulting bytecode it won't inline as well

#

I think default is 12

lyric mountain
#

Hm, I think I mistook with scala's inline annotation

eternal osprey
#

does anyone know why we would use .DATA over .CONST in assembly?

#

Like for example in one of my lectures, they computed k = i + j

#

so they used i: .DATA 3
J: .DATA 5
but couldn't they also use constants for this or am i wrong?

lyric mountain
#

AND NOW YOU'RE IN ASSEMBLY

#

Soon you'll be bashing rocks together to program

eternal osprey
#

whahahhaha

#

believe it or not, this is still part of my processors course

earnest phoenix
#

Bro's gonna be using punch cards next ☠️

eternal osprey
#

i will become a master coder/engineer/rock smasher in a few years

#

yall aint ready for this

earnest phoenix
wheat mesa
#

(I would assume he's probably doing x86)

earnest phoenix
#

x86 doesn't have a .CONST assembler directive

eternal osprey
#

i honestly have no clue

#

it's talking about assembly in general

#

i actually think that we use our own assembler

#

but not sure what it's based on

earnest phoenix
#

You can't really talk about Assembly in general because it doesn't have a single or general form, it has many upon many

#

So there's no way we can help without knowing the specifics

eternal osprey
#

ah np, i didn't know that mb

lyric mountain
#

Java is multiplataform, C is single plataform, ASM is half-plataform KEKW

#

Which makes RCT even more impressive

craggy pine
#

This channel is for asking help regarding code and other things related to coding. No one here will help you make a bot for you.

lament rock
#

I'd like to add that probably most people here even want help on their own bots, so

rustic nova
#

I wish to throw devs against a wall

#

bootstrap select

  • support for bootstrap 5
  • does not work on bootstrap 5
compact pier
#

How to validate the image buffer, that are being sent from client to backend

lament rock
#

You can probably try to load it into a bitmap image manipulator and if it fails then it obviously isn't an image. Otherwise, you can check Content-Type header if it's sent by the browser itself and not an API. You can also add extra hidden fields to a form if it is posted via form to verify that it was sent on your site and most likely sent by a browser, but people can scrap html. Having hidden forms is recommended to protect against XSRF

compact pier
#

btw do you have any docs about bitmap image manipulator?

craggy pine
wheat mesa
#

So currently learning a little bit of git/github, does anyone know how I would fetch the most recent commits/version from a repo if the fork I'm working on is behind the original copy? My friend is working with me on my game engine, and so he has his own fork of it which needs to be caught up with the commits I pushed to my repo.

lyric mountain
#

if there's anything u don't want the user to see, don't put in the frontend

earnest phoenix
# wheat mesa So currently learning a little bit of git/github, does anyone know how I would f...

The original repository is called the upstream repository meanwhile the forked repository is called the origin repository, if you want to sync your fork (origin) with the original (upstream), simply add it as a remote:

$ git remote add upstream <URL of the original repository>

And pull from it (I would also recommend using the --rebase CLI flag as it would put your work on top of the new changes/commits):

$ git pull --rebase upstream main

(Note that main is the branch, in this example we're pulling the changes/commits from the original (upstream) repository's main branch)

wheat mesa
#

thank you for the detailed explanation C:

earnest phoenix
#

You're welcome

#

Or you could make a PR like everyone would do

wheat mesa
#

Well, I'm working on a repo that I own, and my friend has forked that repo and is working on it as well, but when I commit to the repo he needs to be able to sync his cloned fork with my repo so he can continue where I left off

#

So this is basically exactly what I was looking for

#

That way he can update his copy, create his own changes, make a PR, then I can merge it

flat prawn
#

Sooooo
Im working on a bot...
Made from BotGhost because...well...idk C+ and so im making It there
My Bot can do Tickets/Moderation/Role give/Partnership and im working on much more made from scratch
I've send the bot to TOP.GG and im waiting approval...
But if i want to create a website for my bot to join servers and get a Premium version of It...
Is It a normal thing or not?
+
I know Bluerpinte Is not appreciated by the most of the Devs because of multiple Things...
But can i still call my self a Dev if i programm Whit Bluerpinte?

lyric mountain
flat prawn
#

I forgot the right leanguage

deft wolf
#

Also I don't know why people care so much about being called a developer

flat prawn
#

I don't care that much Im Just curios

wheat mesa
flat prawn
#

and a lot stupid

deft wolf
#

You can call yourself the king of Great Britain, but that doesn't change anything

flat prawn
#

I Was Just asking... 😦

earnest phoenix
#

And they're replying

#

It doesn't matter, say what you want

#

If you want to make people call you a developer, do it

#

If you want to make people call you a king, do it

flat prawn
#

No One calls me the way i want

earnest phoenix
#

And that's the hard reality of life

flat prawn
#

Even at my Age you can see the entire Life and know how hard It is

spark flint
#

at what age sussy

flat prawn
#

🫣

earnest phoenix
#

Someone doing a fully fledged game on unreal engine with blueprints is more a developer than someone doing a discord bot with blueprints.

flat prawn
spark flint
#

@ mods ban !!!

flat prawn
flat prawn
#

Silence

earnest phoenix
#

Because there's nothing to say

flat prawn
#

Ok

deft wolf
#

As for these "partnerships", I hope that the bot does not send links in private messages because they will not accept your bot

wheat mesa
#

You can call yourself whatever you want, but don’t expect people to call you a developer if you’re using botghost, it’s not really a “real” development experience

flat prawn
wheat mesa
#

I don’t even call myself a developer about 2.5 years after starting programming

flat prawn
wheat mesa
#

You can call yourself whatever you want but other people may not do the same

earnest phoenix
#

You don't need to do anything to call yourself whatever you want

wheat mesa
#

^^

earnest phoenix
#

Others won't call you the way you may want, and who cares

#

If they don't consider you a developer but you do, then you probably did something wrong

#

E.g. using botghost which is not a development experience as already said

wheat mesa
#

Calling yourself a developer when you’re a beginner is the epitome of the dunning-kruger effect though

flat prawn
earnest phoenix
#

Nobody called me by my job's nature so far

wheat mesa
#

In case you’re not familiar ^

earnest phoenix
#

I haven't done any drama around it either

lyric mountain
#

being a dev is more about thinking logically than writing code

flat prawn
flat prawn
wheat mesa
#

Yeah the majority of programming is logical thinking/problem solving

lyric mountain
#

we frown upon "blueprints" because they're severely limited and a pretty cheap way to solve things

#

nothing wrong with who use it, but there're better options

wheat mesa
#

Yeah, plus they shelter you from what you would actually use in the real world

flat prawn
wheat mesa
#

Like IDEs and GitHub and other tools that are used frequently in development

earnest phoenix
#

Nothing's easy if you want to be good at it

wheat mesa
#

This ^

#

Nobody starts off as a senior dev, you gotta work your way up by getting out of your comfort zone a little

#

And that’s a perfectly good thing to do

sudden geyser
#

I think they mean blueprint as in a specification for how something should be implemented

earnest phoenix
#

No

wheat mesa
#

You sure? They were talking about using BotGhost and such earlier

earnest phoenix
#

Blueprints as in Unreal Engine's blueprints

wheat mesa
#

That too

flat prawn
earnest phoenix
#

So did I

wheat mesa
#

Not quite sure if I understand what you mean by that

flat prawn
wheat mesa
#

Generally speaking when you start to learn a new skill you start off with virtually 0 knowledge of it, yeah

earnest phoenix
#

Starting off with botghost and blueprints is nice and easy, but at some point you will have to face the challenge to move away from these and use technologies closer to reality.

wheat mesa
#

Nobody uses blueprints in the real world because like KuuHaku said, they are very limiting and don’t provide much customization, and often times “blueprint languages” don’t even exist for what you may attempt to do

#

Blueprints are very introductory and are used as a way to not confuse you a ton when first starting something like Unity

earnest phoenix
#

Most developers combine blueprints with some C++ or C#

#

They do make use of blueprints, not in the game's entirety

earnest phoenix
#

You won't achieve with just blueprints what people achieve without them

wheat mesa
#

Not sure what that has to do with the topic

flat prawn
wheat mesa
#

You can make games without them

earnest phoenix
#

As said, the game won't be the same quality

flat prawn
wheat mesa
#

But you usually can’t do much complex stuff with only blueprints

wheat mesa
earnest phoenix
#

Try to make a proper multiplayer FPS game with blueprints only, good luck kek

flat prawn
#

Not bad actually

earnest phoenix
#

Not at all

spark flint
#

inb4 people actually start using scratch for discord lmfao

wheat mesa
#

Roblox uses lua as its primary scripting language

earnest phoenix
#

Networking can't be handled by blueprints

spark flint
earnest phoenix
#

So won't be multiplayer

wheat mesa
#

Which is a language that is pretty easy to pick up quickly

deft wolf
flat prawn
# earnest phoenix Not at all

Knowing that the base pack for FPS games uses A weapon and a character i only Need to do AI plugin/Character in Blender and a map

earnest phoenix
#

Again, multiplayer

flat prawn
wheat mesa
#

Yeah that’s not the only thing that goes into making a game

earnest phoenix
#

Blueprints won't be able to handle network packets correctly

wheat mesa
#

You basically just described how the art works

flat prawn
earnest phoenix
#

So why'd you say

Easy
:)

#

make a triple A game only using blueprints

#

no balls

flat prawn
#

I actually love Cars more so i Was thinking about making a car game not an FPS Game

earnest phoenix
#

oh shit i said the forbidden word

#

mods pls have mercy

#

and pls dont write me a 2k char long dm

#

Same thing, you won't have the same tools available by just using blueprints

flat prawn
earnest phoenix
#

I did

wheat mesa
#

He…did..

earnest phoenix
#

Message has not been edited, you said

Easy

#

the average discord user who cant read

#

Replying to the message that said it as well

#

pretty common in tech related servers

flat prawn
flat prawn
earnest phoenix
#

So there's no point on talking if you don't read imo

wheat mesa
#

I think that the initial argument was about whether or not you can call yourself a developer by only knowing blueprints and botghost. The position I take on this is that you can call yourself whatever you want, but other people may or may not consider you a developer

flat prawn
flat prawn
earnest phoenix
wheat mesa
#

I wouldn’t consider you a developer by only using the skills you described, but you can call it whatever you want

#

That’s just my personal opinion

flat prawn
wheat mesa
#

Nothing is stopping you

flat prawn
flat prawn
#

Well

#

Gotta search for it

wheat mesa
#

It’s called HTML + CSS + JavaScript

flat prawn
#

only knows JavaScript because of Minecraft Modding

#

I know more of Jbeam actually

wheat mesa
#

That’s not even the same language

#

Java and JavaScript are very different

flat prawn
wheat mesa
#

It’s like the difference between car and carpet

#

They have the same word in them, but they are drastically different from one another

flat prawn
#

I know but as i said...

#

Im stupid

wheat mesa
#

You can learn

flat prawn
#

I know but what?
C+/++/#?
Difficult...
Jbeam?
Alredy trying

#

Whit success actually

deft wolf
#

You can try JavaScript for discord bot

flat prawn
#

Isn't It the same?

wheat mesa
#

What?

deft wolf
#

There are plenty of tutorials and JS will also be useful for a website

wheat mesa
#

C++ is leagues more difficult than JS

#

You don’t use C++ for websites

flat prawn
wheat mesa
#

JS is pretty easy, especially in comparison to the languages you just described

flat prawn
deft wolf
#

Just do what is in the discord.js guide and you have a bot, the rest you can write yourself using the acquired knowledge

wheat mesa
#

Dude, JBeam isn’t even a language

#

It’s not even comparable to javascript

#

They do fundamentally different things

plain jackal
wheat mesa
#

This is for like physics or some shit for an engine

plain jackal
#

it looks more like json than javascript

deft wolf
#

Probably not very useful in discord bots and websites angeryBOYE

wheat mesa
flat prawn
wheat mesa
#

It’s not a language

#

It’s a file format

flat prawn
wheat mesa
#

I’m telling you that javascript and Jbeam are not comparable because they are quite literally different things

flat prawn
#

Yeah i know

#

I Just understand Jbeam better

wheat mesa
#

I give up

flat prawn
#

I know you are trying to Say: Jbeam isn't a leanguage and so on

#

But the entire modding community of BeamNG can easily Say to you that It Is right...
But Is It still used for information and Automation mods

plain jackal
#

a whole community of flat earthers will say the earth is flat, doesn't mean it's true

deft wolf
#

Okay, but it won't help you write a discord bot in any way

#

Or website

plain jackal
#

or anything other than beamng

eternal osprey
#

does anyone know why i am unable to save keynumber?

#

like, it always logs undefined outside the listener, eventhough keynumber is initialized globally.

#

while if logged in the listener it is actually defined for some fucking reason like tf

lyric mountain
#

is the event supposed to be lowercase?

eternal osprey
#

i copied it from their docs

#

so yeah i think so

solemn latch
#

Result[0].key.key?

eternal osprey
#

not really

#
{
  key: {
    id: 16948418,
    name: 'ChittyKat - 345138133429649408',
    key: 'x',
    active: true,
    admin: false,
    type: 'anonymous',
    share_type: 'all_subcalendars',
    role: 'modify_from_same_link',
    subcalendar_permissions: [],
    require_password: false,
    has_password: true,
    creation_dt: '2023-03-20T01:46:47+00:00',
    update_dt: null
  }
}      ```
#

so result[" key"].key

#

also logs me the right value, just outside the listener it's not working. Almost like the keynumber isn't saving

#

also forget that last snippet, i already removed the [0] from the code call

lyric mountain
#

tbh, modifying variables from inside an async scope is never a good thing, tho I don't think that's the reason

eternal osprey
#

hmm strange..

lyric mountain
#

did u try debugging?

eternal osprey
#

for some reason my vsc on mac is looking primal lmao

#

so ion know where to find it tbh

#

i am using the go debugger now

lament rock
#

You'd usually just return a new Promise and resolve with the key and then use it when you need it

junior summit
#

why is making discord embed my media so difficult

#

im trying to use meta tags on html but it just wont embed

rustic nova
#

Keep in mind that discord caches previous urls

#

so add a ?aaaaaa or anything else to the end that still goes to your wanted page to get a new uncached one

#

each time you want a different url tho, so ?a then ?aa and so on

compact pier
#

PNG image files begin with an 8-byte signature which identifies the file as a PNG file and allows detection of common file transfer problems: \211 P N G \r \n \032 \n (89 50 4E 47 0D 0A 1A 0A). That signature contains various newline characters to permit detecting unwarranted automated newline conversions, such as transferring the file using FTP with the ASCII transfer mode instead of the binary mode.[10]
Can this be faked and execute as a XSRF

earnest phoenix
#

You can edit any bytes of any file

#

Do whatever you want with that

rustic nova
#

as long as the library you're using isnt assuming that "Yup I hope this is correct im just dropping it into memory" you're good

compact pier
#

Does checking the signature of the first bytes is enough?

rustic nova
#

you can, if you want to go the extra mile, ensure that all the data matches the rfcs for an image/file/etc

#

though I really suggest having a library handle that

compact pier
rustic nova
#

theres a common data format within the image itself, such as the length of the signature, length of options etc

#

you can ensure these are valid and discard the image if these are not

#

cant provide resources about that, dunno where to find em

compact pier
#

ahh okok, I understand. I have googled it, I think it is called the magic numbers or smth

rustic nova
#

not magic numbers, one sec

compact pier
#

okok, thank you a lot. I will take a look into it

#

One more question, what if I use the Content-Type header to check if the data is an image, what will happen if I send the Content Type with header image/png, but the data is something else?

earnest phoenix
#

Magic numbers is basically what you've written as first message

#

Usually called magic bytes though

#

Don't rely on headers to know what content type it is, it's as naive as checking the file extension after the dot

compact pier
#

so is there a way to validate if the data is an image?

earnest phoenix
#

More than one check

compact pier
#

wdym?

earnest phoenix
#

Edit the permissions for the files uploaded, check the MIME type, check the file extension, check the magic bytes, rename the files to random names, validate content type header, etc. etc. etc.

#

Also actually host uploaded files on a completely different server or service offering that

compact pier
#

okok, thank you

winged linden
#

Hey! If i wanna process members in chunks, is it better to fetch the guild members in a pagination format or to fetch all the members then split them into chunks?

deft wolf
#

If I understand correctly, fetching server members every time someone changes page doesn't seem like a very good idea

winged linden
# deft wolf If I understand correctly, fetching server members every time someone changes pa...

No not that, i have a loop that goes over a specific guild members, this guild has a huge number of members & i have to process them to check if they own a specific nft

If i just loop over them it takes so much memory and cpu usage so i am splitting them into chunks

My question is, is it better to fetch all the members and split into chunks after or fetch the members directly in chunks??

lyric mountain
#

fetching will always load the members into memory, you can't avoid that

#

you can simply track from your database if you really want to check automatically on a schedule

winged linden
winged linden
#

I got to a point my bot is doing much better during that loop, but still wanna optimize it to the max

lyric mountain
#

fetching by itself is bad if ur going to do many times a day

winged linden
#

Its once / twice a day

lyric mountain
#

simply track from within your own db

winged linden
lyric mountain
#

if they got manually you won't be able to prevent them from getting again

#

at this point it's more about staff discipline than anything

winged linden
#

True

radiant kraken
spark flint
#

iiii

potent wing
#

hey guys i was wondering if i could get a little help with something because ive been trying to fix this issue for awhile now and havent been able to figure out what i did wrong

deft wolf
#

Then describe the "issue"

#

Maybe someone will know the answer

potent wing
#

so during the night i was making a giveaway command for my bot. i got the creating the giveaway down pretty well but its the reroll command im having issues with ill do a test giveaway with one of my friends to react to it so theres more than one person then once the giveaway is over i attempt to reroll but it says "no one has participated in the giveaway" so its not registering that theres people in the giveaway and ive tried for hours and cant figure it out

deft wolf
#

You'd have to provide your code and possibly what database you're using

potent wing
#

for these commands in particular im not using a db but i do use MySQL

lyric mountain
#

ah, u mean for those specific commands

potent wing
#

yes

lyric mountain
#

well, if ur not using for those commands then u should, since u need to create a new giveaway in the db

potent wing
#

ahhh i see

lyric mountain
#

or if you want not to, you'll need a global variable of some kind to hold those who react

#

actually, just saw you're using reactions, don't you need to fetch the users who reacted?

potent wing
#

im kinda new to this sort of stuff so maybe i do idk

lyric mountain
#

yep, it has no cache property

#

nvm, it had a manager

#

oh well, what a messy structure

potent wing
#

damn

lyric mountain
potent wing
#

so something like this?

#
const filter = (reaction, user) => reaction.emoji.name === '🎉' && !user.bot;
    message.awaitReactions({ filter, max: winners, time: 15_000})
    .then (collected => console.log(`Collected ${collected.size} reactions`))
    .catch(console.error);```
lyric mountain
#

yes, not necessarily the example shown there

#

inside .then see if it logs the users who reacted

potent wing
#
Unhandled Rejection: ReferenceError: collector is not defined```
#

i get that error

wheat mesa
#

Show your code

potent wing
wheat mesa
#

You never defined collector

lyric mountain
#

also the awaitReactions need to be inside the collector, not outside

deft wolf
#

Also I guess awaitReactions should be assigned to sentMessage, not message

lyric mountain
#

that too

earnest phoenix
#

Yes

crystal furnace
#

Hey I want to ask that does presence_count counting people who are online but they are in invisable status or it just count online + dnd + idle?

#

I am confusing about this so much :))

eternal osprey
#

hey guys i wrote this piece of assembly code here

#

READ [i], R1 # R1 := i

READ [j], R2 # R2 := j
READ [k], R3 # R3 := k

CMPF R1, R2 # R1 - R2 (TO CHECK)
JUMP.LE else # if I <= j, jump to else

if: MOVE R1, R3 # k = 1
JUMP endif 

else: MOVE R2, R3 # k = j



endif: WRITE R3, [k]
           
       HALT


i: .DATA 7
j: .DATA 12
k: .DATA 0
 ``` does anyone know where i can assembly this into machine code and actually execute it?
lyric mountain
#

idk how to setup it for offline compilation tho

wheat mesa
#

I believe it depends on the type of assembly

#

But nasm is the command I believe?

eternal osprey
#

yeah it is

#

we are using nasm apparently

crystal furnace
neon leaf
#

json parsing blocks the main thread in nodejs if im not mistaken, correct? If so is there any module (thats not irrelevant) that does that either in a streamed or in an async way?

deft wolf
lyric mountain
#

you can put it inside a promise to prevent blocking

neon leaf
#

🧐

#

so

const parseJSON = async(json: string) => {
  return JSON.parse(json)
}```
or what
lyric mountain
#

yeah ig

#

tho u can drop the block and simply => JSON.parse(json)

neon leaf
#

yeah, but why does that work?

#

I mean, isnt it a sync function at the end of the day?

lyric mountain
#

it's inside an async block

#

it doesn't matter if the operation is sync (everything is sync - they're just wrapped in async blocks)

neon leaf
#

interesting

#

so technically an actual async json parse would not change perf?

lyric mountain
#

change perf?

neon leaf
#

I have no clue why I just wrote that, whether an actual async parse would run better, generally

lyric mountain
#

an actual async json is impossible

earnest phoenix
#

what da heck is that horror

lyric mountain
#

async is simply "something that might return a result in a near future", so the runtime simply continues its path without waiting for the result

#

that function will simply allow the code continue before it finishes parsing the json, but it holds little value if ur going to await it anyway

neon leaf
#

ah, now it makes sense, so await basically turns something async into something sync (pure technically, not actually)

lyric mountain
#

await tells the runtime to wait for the result

neon leaf
#

yes

#

just like with a normal function

lyric mountain
#

yes

neon leaf
#

so something like the render function from the ejs package would not benefit from running as async if in an async enviroment anyway, right?

lyric mountain
#

yes ig

eternal osprey
#

does anyone know how we can transform such hexadecimals to bin v

#

0x8000 012f

#

i tried searching it up online, however i only found easy examples and no 0x... things

wheat mesa
#

Converting a hex string to a binary string? What language?

eternal osprey
#

just by hand..

#

like, in a mathematical way

wheat mesa
#

Hex is just like binary, but with powers of 16 instead of powers of 2

#

Usually I would convert the hex number to decimal then the decimal number to binary

#

First place is the 1s place, second place is the 16s place, third place is the 16^2s place, fourth is the 16^3s place, etc

earnest phoenix
#

Same for binary numbers who often use 1011b for example

#

The b itself is just to show it's a binary number, nothing else

lyric mountain
#

in some langs it's 0b1011

earnest phoenix
#

Yeah that as well

eternal osprey
#

owh wow this is pretty easy actually

#

so each char in the string can be seen as a 4 bit code?

#

0x8000 01af

#

f = 1111

#

0 = 0000 etc

earnest phoenix
#

I mean

#

0x800001af

#

f*16^0 + a*16^1+ 1*16^2, etc.

eternal osprey
#

1000 0000 0000 0000 0000 0001 1010 1111 this would be the result right

eternal osprey
earnest phoenix
#

That's how it works, just like the decimal system

eternal osprey
#

oowh yeah

#

that's the mathematical way indeed

earnest phoenix
#

154 decimal is

4*10^0 etc.

eternal osprey
#

i rather just wanted like a bistring from a hexa string

#

i denoted it wrong in my question

earnest phoenix
eternal osprey
#

but i think that i got it now, thanks for all the help

#

one last question about loadhi, sorry for so much crap i been asking but i've got a test to learn for and they didn't give us the right answers lmao.
1000 0000 0000 0000 0000 000110101111
10-00 0000 0000 0000 0000 00*01- 1010* 1111


.LOADHI 1, R10
.ADD 175, R10

would this be a correct translation?

#

if we have this format

#

like, the 1 is the 22 bit constant within the - -

#

and the ** the 10 bit constant (as loadhi is c22 + c10 )

deft wolf
#

Yea

earnest phoenix
#

Try it and see

deft wolf
#

You can use displayAvatarURL() too