#development

1 messages Ā· Page 117 of 1

solemn latch
#

Why? I dont know, but I'm saying 7

#

if its not, then its probably infinity

sharp geyser
#

an API endpoint requires me to post a file alongside the body, what would be the best way to do this? I thought converting to a base64 but js can't handle converting larger files like that (I dont think anyway)

boreal iron
sharp geyser
#

I dont think that will work for large files

pale vessel
#

You can send files with multipart form data

#

Those work with buffers too

topaz terrace
#

how do i install realtek network drivers?

#

im using this network adapter

topaz terrace
#

alright

quartz kindle
topaz terrace
#

how do i install it on my kali linux if i dont even have any internet

#

i would have to prob put it on a usb drive first

quartz kindle
#

you will have to go for the second option

topaz terrace
#

no guides?

quartz kindle
#

do you have access to a virtual machine?

topaz terrace
#

let me show u when i put the iso on the vm

quartz kindle
#

your vt-x is disabled

#

you need to enable it in your bios

topaz terrace
#

oh

topaz terrace
quartz kindle
#

do you know what is bios?

topaz terrace
#

yes

#

i need to press a key while restarting

quartz kindle
#

yes

topaz terrace
#

so enter bios

quartz kindle
#

somewhere in there you should find an option to enable VT-X

topaz terrace
#

ok

quartz kindle
#

it may also be called "intel virtualization technology"

topaz terrace
#

ok

quartz kindle
#

for example

topaz terrace
#

oh

quartz kindle
#

it depends how your bios looks like

#

all bioses are different

topaz terrace
#

let me enter my bios

#

oh no

#

BSOD

#

when restarted

#

i havent edited my bios yet

topaz terrace
topaz terrace
topaz terrace
#

eh

#

that doesn't work

#

kali linux uses linux 6.1.0

#

this is only for 6.0.x

#

looks like i would have to use vm

slender wagon
#

what's the best site to generate ads for my projects?

#

some are requiring me to redirect my domains which is stupid

spark flint
#

they seem good

#

and supports banner ads and video ads (what i need)

solemn latch
#

The css doesn't load on that site

spark flint
#

you probs have adblocker on

solemn latch
#

Oh yeah lol, good point

topaz terrace
#

couldn't find any documentation or something on google

earnest phoenix
#

Just analyze network tab in developer tools

#

While using the tool normally

topaz terrace
topaz terrace
earnest phoenix
topaz terrace
#

ohh

#

why i dont find anything

spark flint
#

try disabling this

earnest phoenix
#

Don't select a range

#

You see the small squares, there are the requests - and you've selected a range where there's none

topaz terrace
#

how

earnest phoenix
#

Close and reopen it

topaz terrace
#

alright

earnest phoenix
#

You selected a range manually, don't do it again

topaz terrace
#

i see it

earnest phoenix
quartz kindle
earnest phoenix
#

spidermonke

quartz kindle
pale vessel
#

I use tio

radiant kraken
#

tio iara_chefskiss

slender wagon
lament rock
#

joi

surreal sage
#

Is it just me or does Electron have to warm up a little whenever you start your pc

slender wagon
#

it does the job well

#

also guys where should i store the user sessions on express? memory or save them on the db

lament rock
slender wagon
#

oh i am not sure

lament rock
#

it's nsfw so dont look it up anywhere compromising if you're curious

surreal sage
#

watch

slender wagon
#

i am at work

lament rock
#

🫠

surreal sage
lament rock
#

WHAT

earnest phoenix
#

@earnest phoenix

lament rock
#

What is this landing page lmao

surreal sage
#

unoptimized

#

(win)

lament rock
#

I’m less interested in this joi than I am what I originally thought of

#

whats your scale

surreal sage
#

lmao i don use it

slender wagon
#

kilogram

surreal sage
#

i just use mongoose cuz yeah

lament rock
#

because if its going to be large scale then a database will kinda be necessary

slender wagon
#

well i am expecting not more than 100 users a day

surreal sage
#

js a few

slender wagon
slender wagon
#

but if i use the database at this point its gonna use more processing power

lament rock
#

likely

#

If you're already using a database then no

slender wagon
#

should i make a session schema then

spark flint
lament rock
#

Whatever's necessary to interface with your database of choice

spark flint
#

thats one months data

surreal sage
#

damn

#

whatcha collectin

slender wagon
spark flint
#

domain dns data

#

means i can query the db for scam stuff

surreal sage
earnest phoenix
# earnest phoenix <@456226577798135808>

The reason that happens is because compilers replace infinite loops with a function called unreachable when optimizing, here's a comparison between unoptimized and optimized run and difference

surreal sage
#

yo u got my domain in there too?

slender wagon
#

and u are doing that with mongo

spark flint
#

probably

surreal sage
#

astrid.exposed

spark flint
#

if you have issued an SSL certificate in the last month

slender wagon
#

at that size i would move to postgres

spark flint
#

oh i can't query it rn

spark flint
#

i just migrated VPS so need to transfer all that data

#

2 days worth of data

#

this new vps can handle shit must faster

slender wagon
#

how much are u paying for it

spark flint
#

the old was $3.50 a month

#

this new one is $8 a month

#

but moving to $15 a month

#

i chose the 8gb ram 80gb storage for now

slender wagon
#

that's plenty

spark flint
#

and then will move to 16gb ram 160gb storage

slender wagon
#

for now lmfao

spark flint
#

yes for now

#

the fact i got 2 weeks worth of data in 2 days is amazing

#

lol

slender wagon
#

80GB is nothing at the rates ur db is moving

spark flint
#

purely because there are 4 cores now not 1

slender wagon
#

just buy your local servers

spark flint
#

i might do

slender wagon
#

my projects are hosted on microsoft servers under the water

lament rock
#

thought you said minecraft servers

#

I need sleep

slender wagon
#

go ahead sleep

#

your name sound familiar

#

from the breach forums

lament rock
#

The what forums

slender wagon
#

they are seized

lament rock
#

Never heard of it

meager lance
#

um i need a lil bit of help here

#

im trying to make a points system .. everything is correct and the coed is indeed able to read the file.. but when i use smth like

const 1 = ganyu["member1"]
ganyu.points++

the points don't go up .. even tho i can read them by ganyu.points .. i get no errors.. why?

earnest phoenix
meager lance
earnest phoenix
#

Showing your actual code is more helpful than random non-working, as variables can't be named with a number, example code krThumbsUp

meager lance
#

but infact it got updated the first time i used the command then it just stopped 🫔

earnest phoenix
meager lance
earnest phoenix
#

Then show your actual code

meager lance
#

client.on("messageCreate", async message => {
  if (message.content.startsWith(prefix + "point")) {
    const ganyu = JSON.parse(fs.readFileSync("./ganyu.json", "utf8"));
    if (message.member.roles.cache.some(role => role.name === `Ganyu's Prems`)) { 
      const args = message.content.split(' ').slice(1).join(' ')
   //declares.. like 20 of them
      if(reg.some(word => args === word)) {
       if (mond.some(mond => args === mond)) {
        message.channel.send("__role mention.. __ **Got a point!**")
        m.points++
       } else if(liy.some(liy => args === liy)) {
        message.channel.send("__role mention..__ **Got a point!**" + " " + liyue.points) 
       liyue.points++
       } else if(inz.some(inz => args === inz)) {
        message.channel.send("__role mention.. __ **Got a point!**") 
       } else if(sum.some(sum => args === sum)) {
        i.points++
        message.channel.send("__role mention.. __ **Got a point!**") 
       }  else if(fot.some(fot => args === fot)) {
        message.channel.send("__role mention.. __ **Got a point!**") 
        f.points++

       }  else if(nat.some(nat => args === nat)) {
        message.channel.send("__role mention.. __ **Got a point!**")
        n.points++ 
       }  else if(sn.some(sn => args === sn)) {
        message.channel.send("role mention..**Got a point!**") 
        sen.points++
       } 
      }
    }
  }
})
#

i can't send the msg with the declares ..

#

no nitro

#

but they are all just words

#

and for the letters before "points" theyre just like

const i = ganyu["I"]
#

@earnest phoenix topggHurt

meager lance
lyric mountain
#

it's what we call "yandev code"

earnest phoenix
#

yandere*

lyric mountain
#

yandere developer

earnest phoenix
#

isn't is just yandere code

meager lance
lyric mountain
earnest phoenix
#

now using switch

quartz kindle
#

json storage is a bad idea, but if you really wanna go down that road, at least use a cached copy for reads

#

for example

meager lance
#

i know it's useless and kills the cpu but im just used to it at this point

#

else if

lyric mountain
#

nah, cpu doesn't care much

#

like, it's fine to use if-else where it's due, just don't use it where avoidable

meager lance
#

yeah it does

quartz kindle
#
const ganyu = JSON.parse(fs.readFileSync("./ganyu.json", "utf8")); // top of the file

client.on("messageCreate", message => {
  // use ganyu here
  // whenever you update a value in ganyu, you need to use fs.writeFileSync("./ganyu.json", JSON.stringify(ganyu))
  // to save the changes to the file, otherwise the next time you restart your bot the changes will be lost
})
lyric mountain
#

it's more of a readability thing than performance (nothing is faster than if-else anyway)

meager lance
#

šŸ‘Øā€šŸ³

rustic nova
#

whenever you update a value in ganyu

grim aspen
#

isn't the largest asset in that yandere game a toothbrush?

earnest phoenix
#

I'm YandereDev! I worked at a video game company for 3 years, then left to become a freelance programmer and pursue my dream of becoming an independent game developer.
poor companies Sadge

quartz kindle
#

yandev is just an AI developer disguised as a game dev

lyric mountain
#

people wouldn't make a meme out of him if he wasn't such a douchebag

grim aspen
earnest phoenix
lyric mountain
#

the game ran at like 15fps on best rigs

earnest phoenix
#

YandereDev is ong stupid

grim aspen
#

i could've sworn it had like 300 parts to the asset that made up the brush part

earnest phoenix
quartz kindle
#

lmao

earnest phoenix
#

wait

grim aspen
#

OH it was 5k polygons

earnest phoenix
#

21/20 video

grim aspen
lyric mountain
#

oh, he used the hair generator for it

grim aspen
#

but 5,000 polygons tho

wheat mesa
#

Sometimes I wonder how people get as far as they do

#

He took ā€œfake it till you make itā€ to a whole new level

lyric mountain
#

plus the handle looks subdivided

#

and oh god that normal conflict on the head

earnest phoenix
#

Also super interesting

meager lance
earnest phoenix
#

holy shit

meager lance
#

does not update the value at all

quartz kindle
#

show where you actually update the value

meager lance
meager lance
quartz kindle
meager lance
#

sorry not the best english speaker wtfBacon

earnest phoenix
meager lance
# quartz kindle the code

im just using it like that

const ganyu = JSON.parse(fs.readFileSync("./ganyu.json", "utf8"));
const i = ganyu["I"]
i.points++ 
quartz kindle
#

numbers are considered a "primitive" value in javascript, and all primitive values are passed by "copy", which means that if ganyu["I"] is a number, then when you do const i = ganyu["I"], then i becomes a copy, not the original

#

can you console.log the value of ganyu["I"]?

meager lance
#

always 0

quartz kindle
#

if ganyu["I"] is 0, then i.points would not work

#

where is the points coming from?

meager lance
#

json file

quartz kindle
#

then its not 0

#

0 does not have a points property

meager lance
#
"i":{"points":0,"id":"role-"}
grim aspen
quartz kindle
earnest phoenix
meager lance
quartz kindle
#

do this ```js
const i = ganyu["I"];
console.log(i);
i.points++
console.log(i)

lyric mountain
grim aspen
#

^

lyric mountain
#

keys are case-sensitive

meager lance
grim aspen
#

^^

meager lance
#

const i = ganyu["I"]

grim aspen
#

yes

meager lance
#

i is the declare

lyric mountain
#

that's an l

meager lance
#

or wait a sec

lyric mountain
#

ganyu["i"] is not the same as ganyu["I"]

meager lance
#

yeah im stubid

meager lance
grim aspen
meager lance
#

file didn't get updated tho

quartz kindle
meager lance
spark flint
#

just why

#

id should not contain <@ >

meager lance
neon leaf
#

ok so lets say I have an array, it has 100 elements, exactly 100 every time or another multiple. lets imagine the array as a field thats 10x10, how would I always know the value of the field above my index? Its hard to explain

meager lance
#

but nvm anyway i kinda fixed it @spark flint @quartz kindle wtfBacon

lyric mountain
meager lance
#

ty

lyric mountain
#

it's not hard, you just need to know how to transform it

neon leaf
#

ah

#

oh

lyric mountain
#

the formula is (floored) ```
x = index % width
y = index / width

neon leaf
#

so I should have an array with 10 items and each item is an array with 10 more?

lyric mountain
#

...what?

#

no, simply convert the 1d coordinates into 2d

neon leaf
#

ignore that

grim aspen
#

assuming python?

lyric mountain
#

the formula I sent is 1d -> 2d

#

u just need to reverse it to get the index

#
index = y * width + x
#

alternatively simply use a 2d array

neon leaf
#

I think a 2d array would be the better choice here

eternal osprey
#

hey, i have a client created in my index.js. Is it possible to actually export client using module.exports?

#

and then just do const client = require("file)

neon leaf
#

yes

grim aspen
#

pretty much

eternal osprey
#

huhh it tells me it's undefined

grim aspen
#

what is undefined

deft wolf
#

Where do you need it?

neon leaf
#

this should be the correct approach for a 2d array and just finding the current state, correct? if so then I get it

const array = [
  [true, true, true, true],
  [true, false, false, true],
  [true, false, true, true],
  [true, true, true, true],
]

// y ^
// x >

const position = {
    x: 3,
  y: 1
}

const row = array.reverse()[position.y]
const place = position.x

console.log(row[place])
eternal osprey
#

file2: const client = require("../index.js")
file1: module.exports = client
in file2:
console.log(client)

#

literally outputs undefined

neon leaf
#

because I want y to go up, not down

lyric mountain
#

then do height - y

#

not reverse

neon leaf
#

oh right

lyric mountain
#

ur creating a new copy on each operation

grim aspen
eternal osprey
#

in index.js i exported it correctly, and i imported it correctly in my second file

#

so it should work?

grim aspen
#

it has no idea what client is basically

eternal osprey
#

but i am exporting the whole object so how tf

grim aspen
#

sorry my wifi cut out

#

read above

eternal osprey
lyric mountain
#

dont rely on gpt for everything

grim aspen
#

but it is correct

eternal osprey
#

yeah but in this case i couldn't fix it on my own

grim aspen
#

BRO

grim aspen
#

i said 'client is not defined'

deft wolf
#

Also, most events in discord.js already contain a client if i remember correctly

eternal osprey
#

../

boreal iron
#

That's wrong

#

./../index

eternal osprey
boreal iron
#

Try what I wrote

#

And make sure the path is right mmulu

rustic nova
#

I still suggest not using it at all for literally help you can look up yourself

grim aspen
#

that's what i did

#

and i gave what i found

rustic nova
#

good

grim aspen
#

from the internet

rustic nova
#

inb4 #development enforcing disallowing ai usage on answers like stackoverflow did KEKW

boreal iron
#

Thank you

grim aspen
#

stackoverflow completely banned chatgpt

rustic nova
#

good

boreal iron
#

Make it a bannable offense without warning

slender wagon
#

How many stuff do u guys store in the user schema usually?

rustic nova
boreal iron
grim aspen
eternal osprey
#

Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'fetch')

#

i tried the exports after the login, as well as changing the path

eternal osprey
#

v18.15.0

grim aspen
#

Stack Overflow banned OpenAI ChatGPT answers from being posted to their site. Is this fine?

#chatgpt #softwaredevelopment #stackoverflow

ā–¶ļø Visual Studio 2022 on M1 Max | First Look - https://youtu.be/Ad39jwkBLnk
ā–¶ļø My Parallels 17 first impressions | Windows 11 on a Mac - https://youtu.be/Mw2of0OEJJ8
ā–¶ļø M1 MacBook Air Running Visual Studio a...

ā–¶ Play video
lyric mountain
#

I mean, I use gpt too, but to explain complex concepts like ai building for games

#

not for fuckin code

boreal iron
slender wagon
#

I use chatgpt for syntax errors

#

Its faster than my brain

grim aspen
#

i literally have a message from a week ago that said "i wouldn't recommend chatGPT for advice"

#

or 2 weeks idk

lyric mountain
#

gpt can dumbify it enough to be more understandable

grim aspen
#

when in doubt use code from stackoverflow 🄲

eternal osprey
lyric mountain
#

SO cant help for concepts, really

#

people there are way too elitist to make things simple enough

#

and sometimes the answer simply isn't there yet (not going to ask it myself)

grim aspen
slender wagon
#

I mean it comes up to the person using the AI if they want to understand what they are doing they kind of have to limit the usage

lyric mountain
#

or should

boreal iron
eternal osprey
grim aspen
#

two things are happening. 1st is it doesn't know what client is

#
  1. what fake is saying
eternal osprey
#

i am trying to fetch a channel by id, but yeah i will need a client for that

lyric mountain
boreal iron
lyric mountain
#

or static access functions

#

anyway, what ide are u using?

#

most reputable ides would tell you if the path is wrong or not

eternal osprey
#

vsc

#

it is correct 100%

lyric mountain
#

if u ctrl click the import, does it take u to the file?

boreal iron
#

Would u show us a screen of the folder structure to make u aren't wrong?

eternal osprey
#

yup

boreal iron
lyric mountain
eternal osprey
#

do not roast my database.json

eternal osprey
lyric mountain
#

then the path is correct

boreal iron
#

What's file 2?

lyric mountain
#

vsc wouldn't find the file otherwise

eternal osprey
#

file2 is the test.js

boreal iron
#

Roger

eternal osprey
#
const channel = await client.channels.fetch(config["starter"].channel);```
#

this is where the original error came from

grim aspen
#

one moment

rustic nova
#

at least rename that database.json to database.db TrollBait

boreal iron
#

lol

eternal osprey
#

hahaha well yeah i got bigger issues to solve doubt

grim aspen
#

you should use await before assigning the result to the channel

#

that's your answer

boreal iron
#

You're trying to fetch the channel before the client is logged in

#

As you don't await your login process

#

Channels doesn't exist at this point as property of client

eternal osprey
#

hmmm

grim aspen
#

both what fake and i said

#

use await before assigning the result

#

to the channel i mean

boreal iron
#

Where / when do you fetch those?

grim aspen
#

wtf what

eternal osprey
#
async function startBot() {
 await client.login(token);
}
startBot();```
#

honestly this still fucks me in the ass with that error

boreal iron
#

You can still try to fetch the channel before executing this function

grim aspen
#

that's the next answer i had

eternal osprey
#

what the heeell

grim aspen
#

snippet from online: client object you're trying to call channels.fetch() on is properly defined and ready to use.

#

but probably incorrect

boreal iron
#

Make sure to fetch whatever u do after/with the REAFY event

eternal osprey
#

aight

#

thanks i will try!

boreal iron
#

Damn what's auto correct doin again

#

tf means reafy

eternal osprey
#

hmm is it possible to do client.on(ready) in the file2?

#

because maybe client would still be undefined?

neon leaf
#

why does this 2d array end up full of trues OR falses? like there isnt a mix, the complete array is either true or false

type Maze = boolean[][]

const randomBool = () => Math.random() < 0.5

if (isNaN(parseInt(process.argv[2]))) throw new Error("Usage: tsx mazer.ts <size>")
const size = parseInt(process.argv[2])

const maze: Maze = Array.from({ length: size }).fill(Array.from({ length: size }).fill(randomBool())) as any

console.dir(maze, { depth: null })```
eternal osprey
#

honestly let me just save the whole fucking channel object in a json file

#

would that fucking work?

#

could i then do channel.send

grim aspen
#

oops

neon leaf
#

it isnt because its working fine

#

it does generate a random bool 50%

grim aspen
#

it generates a number between 0 and 1 and returns 'true' if the number is less than 0.5 and false for everything else

neon leaf
#

yes

lyric mountain
#

it's the equivalent of (js cuz idk python) ```java
void fill(value) {
for (let i = 0; i < array.length; i++) {
array[i] = value;
}
}

neon leaf
#

oh

#

is there any one-liner or do I have to loop manually?

boreal iron
lyric mountain
boreal iron
#

Because it Could be gone meanwhile

lyric mountain
#

tho it'd not be in-place

neon leaf
#

why is it so consistent? i Have never seen that before

lyric mountain
#

well, random is random

neon leaf
#

is there a more "random" way? like this doesnt seem random at all

earnest phoenix
#

That will never change

lyric mountain
#

it's a function

lyric mountain
neon leaf
#

if you mean double as in the datatype that exists in java, not ts, sure

lyric mountain
#

double, float, number, whatever decimal type u have

#

see that math.random returns

#

use the same data type

neon leaf
#
[
  [
    0.9473456942576997,
    0.3122881440948011,
    0.22850317090401484,
    0.9333467014999379,
    0.40312894603266014,
    0.46176922317408287
  ],
  [
    0.9473456942576997,
    0.3122881440948011,
    0.22850317090401484,
    0.9333467014999379,
    0.40312894603266014,
    0.46176922317408287
  ],
  [
    0.9473456942576997,
    0.3122881440948011,
    0.22850317090401484,
    0.9333467014999379,
    0.40312894603266014,
    0.46176922317408287
  ],
  [
    0.9473456942576997,
    0.3122881440948011,
    0.22850317090401484,
    0.9333467014999379,
    0.40312894603266014,
    0.46176922317408287
  ],
  [
    0.9473456942576997,
    0.3122881440948011,
    0.22850317090401484,
    0.9333467014999379,
    0.40312894603266014,
    0.46176922317408287
  ],
  [
    0.9473456942576997,
    0.3122881440948011,
    0.22850317090401484,
    0.9333467014999379,
    0.40312894603266014,
    0.46176922317408287
  ]
]```
earnest phoenix
grim aspen
#

woah

lyric mountain
#

well, there we have it

eternal osprey
#

could i save the channel object in a json file and later on call it from the file to use channel.send()?

#

Because then i will remove the existing client exporting..

grim aspen
#

i've done that before but not with module exports

#

lemme go see how i used to do it

#

you would need fs

lyric mountain
boreal iron
lyric mountain
#

same issue as before

eternal osprey
#
onst guild2 = client.guilds.cache.get(config["starter"].guild);
const channel3 = guild2.channels.cache.find(c => c.name === 'šŸ“£-stock-notifications');
config["starter"].obj = channel3;
fs.writeFileSync("./config.json", JSON.stringify(config), (err)=>{
  if(err) console.log(err)
})``` i've used this. But yeah if i then call it with .send it wouldn't work
grim aspen
#

onst

neon leaf
#

oh right

lyric mountain
#

remember: fill does not call the function every time

eternal osprey
#

but i don't have any other solution

neon leaf
#

yeah, now it works
oof

eternal osprey
#

the client still returns undefined

neon leaf
#

thanks!

boreal iron
eternal osprey
#
async function startBot() {
 await client.login(token);
}
startBot();
module.exports = client;```
#

yeah

boreal iron
#

Leaving the highway now, so I will be back in 1 hour šŸ˜…

#

Yet I don't see the issue

grim aspen
#

I think that’s not the full code

quartz kindle
#

FakE driving as always

boreal iron
quartz kindle
#

:^)

boreal iron
#

Just 4 fun

eternal osprey
#

sure!

grim aspen
#

LMAO

eternal osprey
#

let timStinks = require("./../index.js")

#

oops

#

this is the result

#

first one is timStinks

#

should be 69

#

let timStinks = 69;
module.exports = {client, timStinks};

boreal iron
#

Dont u need to import the property of the object then?

quartz kindle
#

it wont work if you name the variable timStinks

#

you have to name it timStonks

boreal iron
eternal osprey
#

gpt tells me to use { var }

grim aspen
#

Don’t use GPT

eternal osprey
#

tf should i use else

#

gpt has been saving my life when i was sturggling with processors

#

passed it with a 10/10

#

no flex tho

wheat mesa
#

GPT is also wrong a surprising amount of time

eternal osprey
#

ops.

boreal iron
#

(when exporting it as object)

grim aspen
#

We should have a pinned message regarding ChatGPT-like answers

eternal osprey
#

this is what client returns me

#

what the actual fuck is this'

earnest phoenix
#

Javascript

earnest phoenix
#

Just like the average things

grim aspen
#

Fair

eternal osprey
#

honestly i will just create a 2nd client in my file2.js

earnest phoenix
#

Average development servers ban people for GPT answers krThumbsUp

eternal osprey
lyric mountain
eternal osprey
#

i instead wanted to now pass a channel

#

module.exports = channel;

#

but honestly it still fucks me by returning {} which contains an object

solemn latch
#

šŸ‘€ if you have the client passed, just get the channel from the client.

eternal osprey
#

creating a function for it like in java?

lyric mountain
#
function doSomeShit(client) {
    // use client
} 
#

Wherever u need client simply add a param for it

#

Every event will have client as a param

#

Unless ur using client outside events

#

In which case you'd need to set a global constant for client and access it directly

eternal osprey
#

i will create a variable like: let var1 =... and then use a method that takes the client to set it?

lyric mountain
#

Const

eternal osprey
#
let channel;
async function setChannel(channel1){
  channel = channel1;
}``` no way this would work
#

would it

lyric mountain
#

Don't set channel

#

You only ever need client

#

Entities should never be stored long-term in variables as they can change any time

eternal osprey
#

i see, i will try it! Thank you

wheat mesa
lyric mountain
#

i mean entities as in discord entities

#

since they change without reflecting to references

slender wagon
#

so i am trying to make a session handler,

 req.session.account = result[0].id;

req.session.account comes as undefined evrywhere else, besides the function where it is inserted

lament rock
#

so, it's either being assigned after or the requests are being duplicated

slender wagon
#

wym by duplicated requests

#

when i log the session elsewhere it just shows me this:
Session {
cookie: {
path: '/',
_expires: 2023-05-20T23:19:24.473Z,
originalMaxAge: 2592000000,
httpOnly: true,
secure: false
}
}

lament rock
wheat mesa
#

@lyric mountain do you think it's worth the effort to try to parallelize my ECS

#

I want this to be pretty optimized but rendering still needs to maintain order which kinda sucks

lyric mountain
wheat mesa
#

wdym?

lyric mountain
#

idk how to explain, basically u let the processing happen as much as it wants, and the renderer simply asks for the last rendered frame

wheat mesa
#

the issue is that I need certain things to be rendered before others so that I can maintain proper layers

lyric mountain
#

u can still use it

wheat mesa
#

how so?

lyric mountain
#

see my code, specifically Renderer

#

it's better to explain by showing

wheat mesa
#

it looks to me like it's just one thread running the rendering

lyric mountain
#

yes, note how I'm passing a Consumer

wheat mesa
lyric mountain
#

basically the processing updates the consumer with the latest frame

#

as to not have two thread using the same resources at once

wheat mesa
#

So are all of your entities drawing themselves to that consumer?

lyric mountain
#

no, see Game

#

I'm updating the render task itself, this way it's impossible to have two things using the swing renderer at once

#

I could have 100 threads without a single CME

#

the synchronized is also important on access methods

wheat mesa
#

hmmmm

#

this is interesting

#

kinda complex tho

lyric mountain
#

you'll get the logic once you start doing it

wheat mesa
#

Yeah I understand it for the most part I'm just trying to think about how to properly implement this into my engine

lyric mountain
#

there are other ways to achieve it, this is just one of them

wheat mesa
#

I think the issue would still persist

#

Because the order you render here still matters

#

If you render in the wrong order, something can still get drawn over something you don't want it to be

#

For example, I have layers implemented so that an entity on layer 1 would get overlapped by an entity on layer 2

lyric mountain
#

use a Map<Integer, BufferedImage>

wheat mesa
#

Since it goes in order

lyric mountain
#

then render according to the key

wheat mesa
#

I think my system is a little too complex for something like that

#

This is essentially the API that every system gets

#

The list being the layers, and the set being the actual entity IDs

#

And this is the render method of my canvas class, I just update each system with the created graphics

#

(As for whether or not this is efficient, I'm not sure)

lyric mountain
#

just finishing a game, will come help later

wheat mesa
#

hell, the majority of my CPU time for the render system isn't even spent rendering, it's spent looping over the hashset

#

(Granted I was looping over like 80 thousand entities, which would make some sense, but even then I don't think it would be that heavy since it's just HashSet<Integer>)

#

I'm not having performance issues yet (I maintain 60 fps until I hit roughly 80 thousand entities) but I'm just worrying about when I have to implement more extreme algorithms like collision

lyric mountain
#

try to understand this, will come back to explain it

wheat mesa
#

maybe multithreading rendering is too much

#

I should multithread physics if possible though

#

since collision is going to be expensive

lyric mountain
#

u can use that class for everything

#

it's just a wrapper for multithreading

lyric mountain
#

K back @wheat mesa

#

This class was an attempt I did to have parallel threads coalescing into one result, in an ordered manner

#

The concept is having each thread individually complete it's own task, returning one specific result. After all threads finish executing, the "merger" function is called to compose the final value

#

You could use this concept to split your map into smaller pieces and having each thread process its own piece

wheat mesa
#

Hmmmm

#

I could have a thread for each layer

#

That would significantly speed things up

lyric mountain
#

Yes

wheat mesa
#

I think I have a significant problem though, my ECS is not built for multithreading

lyric mountain
#

Should not be too hard to implement it

#

You can also make a custom iterator

#

And simply extend hashmap to use your iterator

#

This should affect every loop (and method) seamlessly

wheat mesa
#

The biggest problem being that my ECS is very intertwined in its respective classes, I don’t know if it would be easy to parallelize

#

There isn’t a whole ton of shared state but it mainly relies on one big array of bitsets

lyric mountain
#

Could try synchronizing it

#

That way no two threads would be able to access it at once

wheat mesa
#

Yeah

lyric mountain
#

By using semaphores, I mean

wheat mesa
#

I might try that in a bit when I finish eating

#

I’m going to have to learn a lot of multithreading to do this lol

#

We did multithreading in my cs class but it was very basic and pretty much only went over locks and signals, which I don’t think would be optimal for this

#

That would be hell to program

lament rock
#

I am facing so many technical challenges with a minecraft server and looking at performance metrics is a lot of back and forth trying to tune config so that server tick times don't exceed 50ms

#

also trying my hands at making my own mods for it like one where you cannot eat pork because that's haram

#

java is so hard imo

quartz kindle
#

lmao

grim aspen
#

Usually Minecraft servers (like hypixel) use their own hardware such as large server rooms. That’s how their servers have good connections with large players

#

I met Hypixel and asked him directly how most servers work

lament rock
#

Hardware doesn't really play into things because any hardware would struggle with more than like 150 players just running a vanilla mc server.

Some projects like paper really make a huge difference, although I'm not using paper because the bukkit api is REALLY limited

#

I settled on fabric which allows me to use mods like C2ME for multithreading chunk loading and detaching it from the server thread

earnest phoenix
#

What Minecraft version are you running on your server? That plays a major role in the performance

lament rock
#

1.19.2

#

I know a lot of big servers settle on 1.12

#

and use mods like viaversion to allow new players

#

I really think I have a really optimized server rn though

#

even when users are elytra flying generating chunks, tick times are a stable 50ms

earnest phoenix
#

From what I remember giant servers like 2b2t did testing on 1.16 and 1.18 and the server ran pretty well, not sure about 1.19

lament rock
#

1.19 is pretty good. I'd ask people to help stress test but :^)

earnest phoenix
lament rock
#

I have some mods that fix the bugs dw

quartz kindle
#

minecraft: the game where players have to fix the bugs themselves

solemn latch
#

kind of like Bethesda games

sharp geyser
#

not like there is unofficial patches for every one of bethesda's games that supports modding

lyric mountain
#

Like, the first attemp got you far enough, but implementing multithreading midway is much harder than simply starting again

#

This time it'll be much easier as you already got experience from it

#

To practice parallelism you could make a simple test project where many threads try to process something together

wheat mesa
#

Yeah I don’t have the time for that right now, I’ll probably just skip over multithreading. For the thing I’m making I think it should be just fine

lyric mountain
#

I mean, if it handled well up to 70k entities

#

you hardly will ever reach that count in a normal game

#

btw @wheat mesa

#

if u dont need random access, u can use ArrayDeque

#

it's much more efficient for head-tail access than Set or List

wheat mesa
#

I started using an arraylist of sets, is the iterator on ArrayDeque even faster?

lyric mountain
#

yep

#

but it's worth doing some benchmark

#

deques are entirely made around being iterated

#

and obviously cant have random access

wheat mesa
#

Actually I only store like 4 sets of stuff, and I do need random access so I can delete specific objects

#

(In the sets)

lyric mountain
#

ah

#

you could use a map instead of a list to store the sets

#

tho I don't think it should make much difference for only 4 ovjects

wheat mesa
#

Eh

#

List is faster because I only need in order access for those

lyric mountain
#

fair

wheat mesa
#

Should be plenty fast

#

I need to learn how to use quadtrees for collision

solemn latch
#

or even the text next to it

solemn latch
#

The text though? šŸ¤”

#

Figured it out, its platform_username

rustic nova
#

school project for a driving car essentially KEKW

#

rc ofc

#

not actual one

earnest phoenix
#

I'd just buy an already made one krThumbsUp

rustic nova
#

but you gotta remember: that aint the goal smart

#

trying to control it over bluetooth serial and shit, control the lights and the driving

#

current topic around vocational school

earnest phoenix
#

Bluetooth krThisIsFine

#

Reminds me of those house door lockers with bluetooth & app on phone

rustic nova
#

BluetoothSerial runs better than I expected, trust me

earnest phoenix
#

Electricity is yoikes tbh

#

Never liked it kek

wheat mesa
#

We’re using something called a pitop in our electronics class and it’s fun but it’s so limited

#

(And it forces you to use python)

earnest phoenix
#

We never did anything enjoyable krThumbsUp

wheat mesa
#

It comes with a bunch of different peripherals that are easy to set up like LEDs, potentiometers, buttons, a buzzer, etc

#

But all of the outputs on those are basically just on or off, no in between

rustic nova
wheat mesa
#

I have an rpi at home but I haven’t really done anything with it

rustic nova
#

do stuff with it, its fun asf

hushed robin
#

rip it in half

wheat mesa
#

Been too busy with other stuff to try much 😭

hushed robin
#

surprisingly hard

wheat mesa
#

Basically all the free time I have rn either goes to working on my game engine that I need to finish for school or sleeping

hushed robin
#

sleep less

#

= more time for other things

wheat mesa
#

I hope to be able to build a proper physics engine over the summer though, I found a course online for like 60 bucks that shows the ā€œproperā€ process for building something like that

#

(And it’s been suggested to me by experienced people in a graphics programming discord)

wheat mesa
#

Already getting like 4 hours a night for the past few weeks

#

Good days more like 6

hushed robin
#

ā˜ ļø

#

why buy a course

#

google can get you for free

wheat mesa
#

It’s not crazy expensive and I have it for life

#

There’s tons of content and I don’t mind paying for it

hushed robin
#

free = free

wheat mesa
#

Considering one semester of a course at the university I’m going to costs a whopping 50 times more, I think it’s worth it

hushed robin
#

it's probably leaked somewhere on the internet

wheat mesa
#

Plus it really does look good

wheat mesa
hushed robin
#

but

#

hes probably made a lot

#

100x60

#

=

#

someething big

#

thousands

wheat mesa
#

6000, and believe it or not 6k is not a lot for making a ton of content

digital swan
#

If you created educational resources for a living and people just pirated it you wouldn’t be very happy

wheat mesa
#

Sure it’s good, but like he’s genuinely providing good content

hushed robin
#

i wouldn't care

#

it's the internet

wheat mesa
#

It’s not scammy dogshit that doesn’t work

hushed robin
#

it's bound to happen

wheat mesa
#

This isn’t some super ultra popular course either

hushed robin
#

me personally i would just go work for google

wheat mesa
#

It’s not like the dude is a millionaire from this

hushed robin
#

sounds like i'd make more moneu

digital swan
#

Might not be possible for him

hushed robin
#

why

digital swan
#

Could live somewhere remote with family

wheat mesa
#

Yeah me when I just go work for google

hushed robin
#

google hires remote i think

#

also

#

just move

wheat mesa
#

It is totally as simple as just going to work for whatever company you want

hushed robin
#

🤯

digital swan
#

Move and leave his family

hushed robin
#

it seems this guy has a lot of qualifications

#

so why not

hushed robin
digital swan
#

Sounds pretty heartless

hushed robin
#

blood ain't thicker than that google money

wheat mesa
#

The arrogance is crazy but I’m trying to be a more wholesome person so I’m just gonna leave now šŸ™

hushed robin
#

this is my first conversation here in 3 days

#

cutting it off short NEUT

#

but i think this guy should work for google

#

imo

wicked pivot
#

Hello, I have a command that generates a canvas and it takes a long time to finish. Is it possible to do multithreading to make it run faster?

(instead of making one thread at 100% make two at 50% which would make execution much faster)

lyric mountain
#

canvas is not thread safe so no

#

u need to find out what's the bottleneck to begin with

hushed robin
#

šŸ¤”

lyric mountain
#

because it's not threadsafe

#

i means two threads will compete against eachother

#

instead of helping

hushed robin
#

sounds like a very big limitation 🫣

wheat mesa
#

Because it wasn’t written with threads in mind

hushed robin
#

why not

#

someone should rewrite it

wheat mesa
#

Multithreading is very complex and can be near impossible to implement in some cases

hushed robin
#

bruh

wheat mesa
#

Also more threads does not always mean better performance in every scenario

#

In most scenarios it’s pretty good but sometimes it’s not worth the complexity in the codebase for the performance you squeeze out

hushed robin
#

are threads and cores the same thing

wheat mesa
#

No

hushed robin
#

whats the difference

wheat mesa
#

Cores are physical CPU processing units

#

Threads in a programming sense are used when you need to do things in parallel

#

More cores usually means more physical threads

hushed robin
#

can javascript do multithreading

wheat mesa
#

But most threads are ā€œvirtualā€ threads in the sense that the CPU simulates execution in parallel by swapping between tasks on the cores really really fast

#

Javascript has worker threads but the language itself is single threaded

hushed robin
#

so whats the point of more than one thread

lyric mountain
#

being able to split the task

wheat mesa
#

^

lyric mountain
#

or having something running in the background without affecting the main flow

wheat mesa
#

Most CPUs have more than one physical thread available for processing

hushed robin
#

but you can't

wheat mesa
#

You can take advantage of that

hushed robin
#

so the solution is to get a better cpu

lyric mountain
#

(and python, dart, etc)

#

but other langs can can leverage threads to a whole new level

hushed robin
#

java?

lyric mountain
#

yes, for example

hushed robin
#

bruh

#

why would the makers of those other languages limit it so much

#

uhh l javascript

lyric mountain
#

because some langs are just not meant for it

#

js was made for sites, but people made node

hushed robin
#

but it's used so widely outside of websites so why not implement uhh

#

lazy devs?

lyric mountain
#

because it'd not be js anymore

wheat mesa
#

v8 is an absolutely MASSIVE engine

lyric mountain
#

node has worker threads, which is as close as js will get to actual threads

hushed robin
#

whats a worker threads

#

how's it different from actual thread

wheat mesa
#

Adding threading would take likely hundreds of thousands if not more than a million lines of complete reworks to the engine

lyric mountain
#

to ELY5, they're side processes basically

solemn latch
#

^_^

hushed robin
#

where do i find javascript source code

wheat mesa
#

I’ll give you half a line take it or leave it

hushed robin
#

google can probably pay people to do that

lyric mountain
#

you underestimate how big such a change is

#

ecma didn't even remove var out of fear of backwards compatibility

solemn latch
#

how would it help google anyway?

hushed robin
#

cus

lyric mountain
#

plus js is supposed to be lenient and lightweight

hushed robin
#

google use javascript

lyric mountain
#

adding multithreading would fail at both

solemn latch
#

they use languages with proper threading when they need to

hushed robin
#

i wanna see it

#

i can't find on github

lyric mountain
#

it's like asking to add a screwdriver head to a hammer

#

you use a hammer when u need a hammer, and a screwdriver when u need a screwdriver

hushed robin
#

very easy

lyric mountain
#

except it'll be a terrible hammer and screwdriver

hushed robin
#

why

lyric mountain
#

languages are tools for a certain goal

#

you don't need a language that does everything

hushed robin
#

so what should javascript be used for

neon leaf
#

websites

lyric mountain
#

it can be used for everything, but excels at websites

hushed robin
#

so should i not use javascript to make my bot

lyric mountain
#

you can, it's just not the strongest area of js

hushed robin
#

hm

#

ok

#

what about this uhh

solemn latch
#

IIRC nodejs excels in a ton of requests, but very small requests. šŸ‘€

lyric mountain
#

you wont find js sourcecode at github

#

it's like trying to find the pope in a rock concert

solemn latch
#

lmao

hushed robin
#

where do i find then

lyric mountain
#

you don't

hushed robin
#

bruh

#

wym

lyric mountain
#

js is maintained by ecma

#

idk if people can contribute to the language directly

wheat mesa
#

Javascript itself is not centralized, it’s a standard. Different engines implement the standard differently

hushed robin
#
#

wtf

lyric mountain
#

node is open source tho

wheat mesa
#

There is a v8 mirror on GitHub, and node is also on GitHub

lyric mountain
solemn latch
#

I've not really thought about this tbh

hushed robin
#

so javascript isn't open source?

#

wtf

wheat mesa
#

You won’t be able to contribute to it unless you’re a fucking wizard tho ngl

hushed robin
#

why not

lyric mountain
#

js is like english

#

you don't ask "how do I contribute to english"

hushed robin
wheat mesa
#

Voltrex does

hushed robin
#

fr?

wheat mesa
#

Yes

lyric mountain
#

he said a bunch of times

wheat mesa
#

He’s a maintainer of nodejs

hushed robin
#

he should give me access

wheat mesa
#

And LLVM

hushed robin
#

i wanna see the source code

lyric mountain
#

it's open source smh, everyone can see it

hushed robin
#

bruh

wheat mesa
#

I don’t know if he has DIRECT commit access, but I know he contributes

hushed robin
#

you said it wasn't

lyric mountain
hushed robin
#

broooooooooooooooooooooooo

lyric mountain
hushed robin
#

not node.js

#

javascript

wheat mesa
#

Javascript isn’t open source because that’s not a thing

hushed robin
#

wym

wheat mesa
#

Javascript as a language is not maintained in some central place

#

There’s just people that define what javascript should be like, and different engines implement those specifications

hushed robin
#

what language is javascript coded in

lyric mountain
#

in javascript

summer torrent
#

really

hushed robin
#

what

wheat mesa
#

No

lyric mountain
#

"what language is english made of?"

#

it's...made out of english

wheat mesa
#

Most engines use C++ to implement javascript

hushed robin
#

i don't get it

#

javascript is made of nothing

#

?

wheat mesa
#

Nodejs is a little special because they use both C++ and a custom language called torque

lyric mountain
#

javascript is a language, by itself it does nothing

hushed robin
#

how do you make a language

lyric mountain
#

javascript is made out of javascript, it's up to the engines to interpret it

hushed robin
#

without code to make it with

#

wtf

lyric mountain
#

you don't code a language

#

u code a compiler/engine

hushed robin
#

so whats the javascript compiler coded with

wheat mesa
#

^^

summer torrent
wheat mesa
#

Like I said 14 times

hushed robin
#

so

#

javascript is made with C++

lyric mountain
#

no, node is

wheat mesa
#

No šŸ¤¦ā€ā™‚ļø

hushed robin
#

bruh

lyric mountain
#

for example, I have my own language for command syntaxes, it's called shirosig

wheat mesa
#

Javascript by itself is a specification, it is up to individual developers on how they implement that specification. If the engine doesn’t match that spec, then it’s not javascript

lyric mountain
#

it does not need any engine, I parse it with my own interpreter

#

the language itself is made out of shirosig

hushed robin
#

this doesn't make snse

solemn latch
#

which part doesnt?

lyric mountain
#

that's because you're thinking js is executable

hushed robin
#

bro

lyric mountain
#

js is just a language, nothing more

#

it does nothing by itself

hushed robin
#

how can you code something without code

lyric mountain
#

you don't, languages aren't coded

hushed robin
#

how are they made then

#

bruh

lyric mountain
#

with paper and pen

hushed robin
#

bro what

#

paper?

#

\wtf

#

bruh javascript is digital

wheat mesa
#

You can’t. There’s a reason it’s called a ā€œtech stackā€. Everything is an abstraction at some level, and it ā€œstacksā€ up

earnest phoenix
lyric mountain
#

lmao

solemn latch
#

javascript, or what we think of as 'javascript'
is an idea, not code.

The "idea" is then turned into something like nodejs, which is made with code.

wheat mesa
#

^^^^^^

solemn latch
#

Thats how I think of it

wheat mesa
#

Best way to put it tbh

lyric mountain
#

you can make a language yourself, it doesn't need to be a programming language, you don't need any code

hushed robin
#

so... javascript is nothing without node.js

lyric mountain
#

you just need to say "X means Y" and ur done

wheat mesa
#

Well, yes and no

summer torrent
wheat mesa
#

There’s obviously other engines besides nodejs, but if nodejs were the ONLY engine, then yes

hushed robin
#

this doesn't make sense

#

so javascript is made with code NEUT

wheat mesa
#

No…

lyric mountain
hushed robin
#

but

wheat mesa
#

Javascript is IMPLEMENTED with code

hushed robin
#

if node.js

#

is made with C++

lyric mountain
#

if I say "go to abadaba" you know I mean "go to #development"

hushed robin
#

and nothing else ecists

#

and it's the only

lyric mountain
#

done, that's what a language is

hushed robin
#

that means javascript = C++

wheat mesa
#

No

hushed robin
#

yes

summer torrent
#

node.js isn't a language