#development

1 messages ยท Page 138 of 1

lyric mountain
#

Voltrex. voltrex does

sour dew
#

k

hushed robin
#

if I have the guild members intent will a members roles always be cached?

lyric mountain
#

U can check which roles can see it

#

And add individual user overrides

#

U can retrieve how many members have a certain role

#

Iterate over roles, check if they have view_channel perm on it

quartz kindle
#

but a member object only contains the role ids

#

not full role object

hushed robin
#

that's fine, i only need to check the IDs

#

so, does that mean it will

quartz kindle
#

most likely yes

hushed robin
#

wym most likely

#

in what case what it not be

quartz kindle
#

if whatever library you use decides to do something weird with it

neon leaf
#

I finally finished my new route matcher that works with params like
/@{user}/{file}-{version}/download
(multiple params per segment and also requires stuff like the @ in the first segment and the - in the second)

hushed robin
neon leaf
#

yes

hushed robin
#

๐ŸŽ‰

hushed robin
#

npm web server?

#

is it like express

neon leaf
#

thats how the repo is called yes

neon leaf
hushed robin
#

nice

deft wolf
#

Good job

hushed robin
#

code looks very complex

neon leaf
hushed robin
#

makes sense

rustic nova
#

question

#

is having a express server fast?

#

to lets say, run an application that is using ejs?

earnest phoenix
# rustic nova is having a express server fast?

You should generally avoid using Express and use something that more actively maintained, and there are multiple reasons why you shouldn't use Express:

  1. Express determines the behavior of your callbacks by their number of arguments
  2. Express does not support HTTP/2.0
  3. async/await isn't fully supported either: Express will not handle async route errors
  4. Express uses some deprecated/abandoned dependencies from a long time ago

A very close alternative is Fastify (https://www.fastify.io/), which is also generally faster too

rustic nova
#

do you know if fastify is also compatible with ejs?

earnest phoenix
#

Is there a reason you're choosing EJS over something like React, Svelte, Solid, or whatnot?

rustic nova
#

Coming from a Flask environment using django on python, aka generally templating

I have tried using Nextjs before, but to be brutally honest: Its general configuration seems to be somewhat more complicated than what I expected

#

heard that Svelte is "beginner friendly"

earnest phoenix
#

Hmm I don't think Next.js' configuration is actually complicated, you were probably doing something wrong because I've never seen anybody else complain about it

#

Though you should definitely give React or Svelte a try, they're both really good

rustic nova
#

just been going by their docs before

#

but yup will give Svelte and React a try

#

isnt nextjs just implementing react?

neon leaf
#

yes

rustic nova
#

fair enough

neon leaf
#

with some extra stuff

rustic nova
#

ofc ofc

earnest phoenix
rustic nova
#

generally want something that allows me to just

npm install thisfunnything or npm create something

and just get started using it

neon leaf
#

npm create vite@latest I think

rustic nova
#

ohh so vite is also something like nextjs, since it seems to ask me what framework to use

neon leaf
#

not really

#

it justs builds it to js / css

#

nextjs adds stuff like ssr

rustic nova
#

is it also possible to have a more log-based output on the npm run on vite? might be more docker friendly for my logging stuff

#

oh damn this is actually a cli

#

but is it possible to rather have it as just loglines?

earnest phoenix
rustic nova
#

something like this is likely not really log friendly I think

#

Would prefer something like lines with logs for it

earnest phoenix
rustic nova
#

instead of that above, something like

starting vite blabla
running on local http://localhost:5173
neon leaf
#

why exactly do you need that

#

what you showed is only for the dev server

round cove
#

Lately I've been getting plenty of 520's and 500's from Discord and lots of shards disconnecting. Anyone else having these issues?

proven lantern
#

is there a formula for doing Elo calculations for uneven matches like 1v2?

#

this is what i'm currently using for Elo calculations

#

does something like this make sense? when the other team has more players then the amount of Elo each player takes is dampened

rustic nova
#

@earnest phoenix but I'm still able to use express for backends right?

earnest phoenix
#

Yeah but I'd still recommend using Fastify

rustic nova
#

oh cool I can use vite to proxy my /api endpoint

hushed robin
#
const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildPresences
    ],
    presence: { 
        status: 'online',
        activities: [{
            name: "fortnite", 
            type: 'PLAYING'
        }]
    }    
});
#

what's wrong with the presence, it's not being set

#

nvm fixed

proven lantern
#

also status update pls

hushed robin
hushed robin
proven lantern
#

so if the team of 2 beats the solo or the solo beats the team, they get the same points

#

but now there are more points added to the pool when it should be zero sum

#

or removed

#

this is how it looks without modifying anything. it's zero sum which is good

#

but if you lose a 2v1 as a solo you lose more than if you lose as a team

hushed robin
sage bobcat
#

One message removed from a suspended account.

hushed robin
#

he showed me what and i said to do it yourself

#

then he sent all this

proven lantern
hushed robin
proven lantern
hushed robin
#

ask @quartz kindle

quartz kindle
#

can confirm, hes not smart

#

:^)

sage bobcat
sage bobcat
quartz kindle
#

hi fiath punto

sage bobcat
quartz kindle
#

gud n u

sage bobcat
#

One message removed from a suspended account.

hushed robin
#

that nerdy chess shit

#

i see

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed robin
#

what e;se does

quartz kindle
#

so do multiplayer online games like dota and league of legends

sage bobcat
quartz kindle
#

and several sports

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed robin
#

video games are poison

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

you are poison

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed robin
#

ok

#

i don't play games

sage bobcat
hushed robin
#

no

#

why would i cry about it

quartz kindle
#

im playing games right now lol

sage bobcat
#

One message removed from a suspended account.

hushed robin
#

nice

quartz kindle
sage bobcat
#

One message removed from a suspended account.

proven lantern
quartz kindle
#

lmao i figured

#

thats all u play

#

xD

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed robin
sage bobcat
hushed robin
#

not cap

#

โœจ

sage bobcat
#

One message removed from a suspended account.

hushed robin
#

sure

#

๐ŸงŒ

earnest phoenix
#

Hmm I honestly wonder why many C/C++ projects don't compile with LTO which can improve the performance (significantly even), nowadays there's no actual reason to not use it (other than the fact that it increases linking time but that is to be expected)

#

Not using LTO is like smallbrain

proven lantern
sage bobcat
sage bobcat
proven lantern
earnest phoenix
#

LTO doesn't change the behavior of your program, it only optimizes it

hushed robin
earnest phoenix
#

(For those who don't know, LTO stands for Link-Time Optimization)

proven lantern
#

i bet people write code that cant be optimized because it does naughty things

earnest phoenix
#

It doesn't matter what kind of code developers write, the compiler will 99% find a way to optimize it

proven lantern
#

they should make it the default option then. noob compiler writers. all their fault

earnest phoenix
#

Though the performance improvements outweighs the longer compilation and link times if the developers are up to it

proven lantern
#

maybe there should be a gui written in java swing that asks if the compile is for prod or dev

earnest phoenix
proven lantern
#

just add the jvm as a dependency

#

ezpz

#

java is fast so it should speed things up

#

who's ready for dark and darker to release

scenic kelp
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

no

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

Faith why are you fully capitalizing Elo? troll

sage bobcat
#

One message removed from a suspended account.

scenic kelp
#

dota also recently moved from Elo to Glicko with the 7.33 update in april

#

W ๐Ÿ’ช

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sage bobcat
scenic kelp
#

i applaud you for that take

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

the article previously listed "association football" so yes "American football" is the best terminology to reduce ambiguity

scenic kelp
sage bobcat
#

One message removed from a suspended account.

scenic kelp
#

nope dota legally stands for nothing

#

because valve doesn't own the rights or at least didn't to "defense of the ancients"

#

but blizzard let them use dota

quartz kindle
#

dota = damage over time asshat

#

also, good old wc3 days

sage bobcat
scenic kelp
#

ok but legally it does not stand for that

#

it is just Dota

#

and officially it is just Dota

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

someone mute this lala guy quick!!!!

sage bobcat
#

One message removed from a suspended account.

real rose
sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

:O

dusk field
#

I don't know what's wrong, maybe you could help me @hushed robin

quartz kindle
#

ie: [1,1,1,1] = 4 ( [1], [1], [1], [1] )

#

a set would make it 1 ( [1] )

proven lantern
#

mmkay

scenic kelp
#

most new games use glicko since it's just basically an improved elo, additionally a lot of games have switched from elo to glicko at some point

proven lantern
#

how did chat gpt do?

hushed robin
proven lantern
#

Glicko2 test

#

Elo test

dusk field
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

spark flint
#

lol

proven lantern
#

why would there be no rating change when someone beats an evenly matched player?

#

everyone would just keep their initial rating score

hushed robin
# dusk field help
const getLongestAndShortestWord = (sentence) => {
    const array = sentence.split(' ');
    
    let longest = '';
    let shortest = '';
    
    for (const word of array) {
        if (!longest) {
            longest = word;
        } else if (word.length > longest.length) {
            longest = word;
        }
        
        if (!shortest) {
            shortest = word;
        } else if (word.length < shortest.length) {
            shortest = word;
        }
    }
    
    return {
        longest,
        shortest
    }
}

there you go

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed robin
#

uh

#

they can improvise

proven lantern
hushed robin
#

but in javascript

#

idk python

proven lantern
#

i don't think chatgpt knows the Glicko 2 algorithm

hushed robin
hushed robin
#

who can help me

#

github desktop just deleted all my code

lyric mountain
#

lmao what did u do

hushed robin
#

but all my code reverted to the one on github

#

and now it's gone

#

i spent 4 days rewriting my bot

#

all that hardwork coding is gone

lyric mountain
#

well, u executed a git reset

#

and wtf do u stay 4 days without comitting changes?

hushed robin
#

if i commit when not done

#

then my bot will not function

#

bc code will not be done

lyric mountain
#

u don't need to push

#

just commit it when u leave the pc ffs

#

commits are kept locally until u push to remote

hushed robin
#

can i get back my code

lyric mountain
#

no

#

I mean, kinda

#

did u update windows within those 4 days?

hushed robin
#

no

lyric mountain
#

then no

hushed robin
#

๐Ÿ˜

lyric mountain
#

windows makes restore points before updates, so u could revert to one if there was any

hushed robin
#

so my code is gone

lyric mountain
#

yes

hushed robin
#

what the fuck

lyric mountain
#

next time commit regardless of completion state

#

then once ur done push it

hushed robin
#

because it's not done

lyric mountain
#

doesn't matter

#

commits wont go to remote until you push

hushed robin
#

can u help me recover my code

lyric mountain
#

you cant recover it, u reverted to head

hushed robin
#

i didn't

lyric mountain
#

you 100% did

#

git doesn't do anything by itself

hushed robin
#

i clicked commit and my code disappeared i dint' revert anything

lyric mountain
#

Then u didn't click commit

#

U likely missclicked

#

Did u read the confirmation window?

hushed robin
#

i'm going to cry

#

๐Ÿ˜ฎโ€๐Ÿ’จ

hushed robin
#

i typed summary

#

then i clicked commit

#

can someone experienced help me recover my code

lyric mountain
#

buddy, there's no going back, it's not like recovering a deleted file, whatever was there was overwritten already

#

this is the very reason I commit whenever I finish the immediate task I was doing

hushed robin
#

my code

#

i spent so much time problem solving

lyric mountain
#

if you did the problem solving, then rewriting it will be easy as u already did all the thinking before

#

from now on commit after every step you make, uncommited code is borrowed code

hushed robin
#

i completely rewrited my bot

#

now it's gone

lyric mountain
#

should've commited earlier

hushed robin
#

are you sure there's no chance

lyric mountain
#

yep

#

there's no undoing for git reset

hushed robin
#

i didn't do git reset

lyric mountain
#

if it reverted to the head, then yes u did reset

hushed robin
#

i committed

lyric mountain
#

commits don't delete code

hushed robin
#

mine did

#

did github desktop glitch?

lyric mountain
#

you likely missclicked on reset

hushed robin
#

theres no reset on github desktop

lyric mountain
#

there likely is, as it's a core feature

hushed robin
#

do you use github desktop?

lyric mountain
#

no, intellij has it integrated

#

so does vscode

hushed robin
lyric mountain
#

a commit cannot, by any means or ways cause code modification

#

it simply saves the current changes to the history

hushed robin
lyric mountain
#

it wouldn't cause what u said that happened

#

the only thing that'd make the code become the same as the one on the origin is git reset

hushed robin
#

where can i see history

lyric mountain
#

but you can check

hushed robin
#

where

hushed robin
#

is there a github link?

lyric mountain
#

you can also see if you didn't shelve the code on mistake

#

no, find it yourself

#

for shelve

hushed robin
#

i don't see in history

lyric mountain
#

Ofc it isn't there, because u didn't commit

hushed robin
#

bro i clicked commit

lyric mountain
#

Last place you can check is the shelf, if it isn't there then it's gone

hushed robin
#

on github desktop

lyric mountain
#

Search it

sage bobcat
#

One message removed from a suspended account.

hushed robin
lyric mountain
#

Search harder

sage bobcat
#

One message removed from a suspended account.

lyric mountain
#

That Garfield joke is terrible

sage bobcat
#

One message removed from a suspended account.

hushed robin
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed robin
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed robin
#

this is not funny

#

i spent many days on this project

#

and now it's all gone

#

i think i'm just going to delete my bot atp tbh

lyric mountain
#

Just write it again

hushed robin
#

bro

#

it was like 1k lines of code

lyric mountain
#

You've already gone through 4 stages of grief, simply accept it and move on

lyric mountain
hushed robin
#

only???

lyric mountain
#

I thought it was much more

hushed robin
#

that was my entire bot

lyric mountain
#

1k is a third of my game logic

#

And that's only 1 file

hushed robin
#

1k is my bot

#

thats now deleted

lyric mountain
#

Simply rewrite it, 1k is very little

#

If u write 100 lines per hour that's only 10 hours

hushed robin
#

to me it's not

lyric mountain
#

Then u must code very slowly

#

Anyway, just get back to it, the time u spent here would be better spent coding

hushed robin
hushed robin
#

that is how i learned to type

lyric mountain
#

Take some typing courses then, can even imagine picking keys like that while coding

#

F and J have that crease on them for a reason

hushed robin
#

wym

harsh nova
#

Sorry about you losing your code but if you view the situation optimistically:

  • you've learned a lesson about doing frequent commits
  • you get to rewrite your rewrite from scratch with the valuable lessons you learnt from the first rewrite
lyric mountain
#

Pass your finger over F or J

#

Feel there's a little bump on them?

hushed robin
#

yes theres a little line at the bottom of them

lyric mountain
#

That's where your pointer fingers should be at

hushed robin
#

i can't

#

i'm too used to two fingers

lyric mountain
#

Lose that habit then

#

With only 2 fingers your wpm is insanely low

hushed robin
#

how?

lyric mountain
#

Go to monkeytype and see for yourself

#

It'll ask you to write a long sentence within a certain time

#

Then show u how accurate and fast you were.

hushed robin
#

this is what i got

lyric mountain
#

Once I get to my pc I'll show u mine

hushed robin
#

ok

lament rock
#

What was the new method for getting a user's default avatar index from the ID

lyric mountain
#

nah, I'm shitty at typing random words

#

cant go above 80

#

somehow I lag if I need to retype something I read

hushed robin
#

how much money do u guys think it would cost to rewrite my discord bot

lyric mountain
#

About the same of getting a bot

hushed robin
#

huh

lyric mountain
#

Rewrite or not it's a full source code

#

Just rewrite it yourself

lament rock
#

nvm

Number(BigInt(user.id) >> BigInt(22)) % 5
hushed robin
lyric mountain
#

Idk, I don't freelance

#

Just go to fivrr and see the averages

hushed robin
#

how dont u know

lyric mountain
#

I don't freelance

hushed robin
#

just estimate

lyric mountain
#

Go to fiverr, "discord bot", sort by applications

hushed robin
#

i want your estimate

lyric mountain
#

I don't freelance

hushed robin
#

i know i don't want u to

lyric mountain
#

Thus I don't know the averages

hushed robin
#

i just wanna wonder

hushed robin
#

u must know how much u'd charge for something

lyric mountain
#

Just check any freelancing site goddamn

hushed robin
#

no they don't have real estimates

lyric mountain
#

The jobs with the most applicants will be a damn good price estimate

hushed robin
#

i need mine

#

if you can't estimate maybe someone else can

lyric mountain
#

About the same price as a general discord bot

#

A bit more if too specific

hushed robin
#

ok

#

$10?

lyric mountain
#

Is that what's listed there?

hushed robin
#

no

sage bobcat
#

One message removed from a suspended account.

sage bobcat
lyric mountain
#

๐Ÿซณ
๐Ÿ—‘๏ธ

hushed robin
spark flint
#

bargain

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lyric mountain
#

Idk what to say lul, I'm more of a java guy

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

lyric mountain
#

But isn't braces on namespace optional?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lyric mountain
#

Ah aight

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hushed robin
#

is code drunk

winged linden
#

yoo question, i am building a backend api for my frontend

  let data = req.headers.authorization;

  if (data == null || !data.startsWith("Bearer ")) {
    return "Unauthorized";
  }
  return {
    token_type: "Bearer",
    access_token: data.slice("Bearer".length).trim(),
  };
};

async function auth(req, res, next) {
  const Token = getToken(req);
  if (Token == "Unauthorized") {
    return res.status(401).json({ error: "Unauthorized" });
  }
  const accessToken = Token.access_token;
  if (!accessToken) {
    return res.status(401).json({ error: "Unauthorized" });
  }
  const userID = await getUserID(accessToken);
  if (!userID) {
    return res.status(401).json({ error: "Unauthorized" });
  }
  const discordUserID = req.headers["x-discord-id"];
  if (discordUserID != userID) {
    return res.status(401).json({ error: "Unauthorized" });
  }
  next();
}

async function getUserID(accessToken) {
  const API_ENDPOINT = "https://discord.com/api/v10";
  const res = await fetch(`${API_ENDPOINT}/users/@me`, {
    method: "GET",
    headers: {
      Authorization: "Bearer " + accessToken,
    },
  });

  if (!res.ok) {
    return null;
  }

  const user = await res.json();
  return user.id;
}

router.get("/api/protected", auth, (req, res) => {
  res.json({ message: "Authorized access" });
});```

is that efficient to authorize acc for post/get requests or i should do it in another format?
#

basically i get the auth token from headers & the userid from headers

fetch a request to https://discord.com/api/v10/users/@me, if they match user is authorized

lyric mountain
#

that way u can do if (!token || userID != discordUserID)

#

second u don't need to require Bearer in your endpoint if you're gonna cut it off moments later

#

third supposing you'll have more endpoints, const API_ENDPOINT = "https://discord.com/api/v10"; can be put outside of any functions, as it's used for all endpoints

frosty gale
#

actually i wonder if the interpreter would optimise that variable to act more like a macro and not an actual variable

#

since its const so it cant be changed

#

but then js dont really have a concept of defining static variables/items

earnest phoenix
quartz kindle
#

v8 does inlining to a certain point yes

frosty gale
#

but yeah id assume its only up to a certain point since the code thats going to be executed isnt exactly predictable

#

for example eval code or loading some random module

#

we will blame discord bot developers for having an eval command for that

quartz kindle
#

lmao

#

v8 will compile several possible code branches until a certain point

#

there is an option to force inlining as much as possible

frosty gale
#

just copying the cpus branch prediction at this point

quartz kindle
#

i've had some weird struggles with inlining in the past lol

#

i had an issue where at some point the code suddenly became 100x slower in the sythetic benchmark for no reason

#

just from "code size"

#

ie: even adding and removing a comment would cause the difference

frosty gale
#

v8 more like v7

quartz kindle
#

i havent tested this in a long time tho, it was with node 14 or 16 i think

#

also, it had to do with deoptimization and the order of the benchmark

frosty gale
#

thats weird though

#

interesting

earnest phoenix
#

Possibly a regression, and inlining isn't always a good idea as it can cause much worse performance in some cases, so it's best left to the optimizer for that decision

quartz kindle
#

ye

#

in my case using --stress-inline would fix the issue

#

but i couldnt understand what was happening at all

#

but well, the code had a lot of unpredictable branches

#

so im pretty sure the actual issue was v8 optimistically compiling a certain branch and then a different function parameter would cause deoptimization

#

but i still have no idea how adding or removing a comment after certain "code size" would cause the issue as well lol

earnest phoenix
#

The best way to see what was happening is to run it while telling V8 to emit bytecode so you can see what was causing the regression or something

#

Though that issue is most likely fixed now

quartz kindle
#

probably

#

i emit bytecodes for small snippets, not for larger things since its too big

frosty gale
#

does a memory write really take only one clock cycle??
for comparison a memory read is estimated to take 100-150 clock cycles assuming data is not present in cache
would make sense for a read to take longer since the cpu is actively waiting for the data to be read into a register but over 100x longer?

#

and they teach you in cs that ram is fast ๐Ÿคก

quartz kindle
#

well

#

an F1 car is also fast

#

:^)

#

but a cpu register is a Lockheed SR-71 Blackbird

frosty gale
#

the registers are fast mfs

#

cpus are basically bottlenecked by the ram

#

if it wasnt for cpu pipelining wed be fucked

quartz kindle
#

remember when FSB was a thing

frosty gale
#

fsb?

quartz kindle
#

front side bus

#

motherboard clock thingy between cpu and ram

frosty gale
#

that isnt a thing?

#

i dont know much about physical connections between ram and cpu should prob read about that

quartz kindle
#

In a traditional architecture, the front-side bus served as the immediate data link between the CPU and all other devices in the system, including main memory. In HyperTransport- and QPI-based systems, system memory is accessed independently by means of a memory controller integrated into the CPU, leaving the bandwidth on the HyperTransport or QPI link for other uses. This increases the complexity of the CPU design but offers greater throughput as well as superior scaling in multiprocessor systems.

#

the fsb doesnt really exist anymore

#

the fsb clock speed would basically bottleneck the cpu

#

way before ram did

#

the cpu clock speed (pre-multiplier) had to match with the fsb clock speed

frosty gale
#

i had a microcontroller and a LED driver which basically had a bunch of LEDs in parallel that could be controlled by a controller and it has no clock pin so you have to match its internal clock speed and transfer timing

#

its awful you have to write assembly for it so you perform all data transfers on time

#

c++ is not enough

earnest phoenix
# frosty gale does a memory write really take only one clock cycle?? for comparison a memory r...

A memory write can take more than one clock cycle to complete

It depends on the type of memory and the memory controller used by the system, it can take several clock cycles to even access a small amount of data, for example, in modern DDR4 SDRAM a single write operation can take 5 to 7 clock cycles to complete depending on the configuration

However newer DDR5 memory standard can take much less clock cycles to complete, usually 2 to 3 clock cycles

There are 4 main memory timings that affect the amount of clock cycles a memory write operation can take:

  1. CAS latency (CL): this is the number of clock cycles required between the arrival of the address and data at the memory controller and the beginning of the data output

  2. Row Column Delay (tRCD): this is the minimum number of clock cycles required between opening a row of memory and accessing columns within it

  3. Row Precharge Time (tRP): this is the minimum number of clock cycles required between issuing the pre-charge command and opening the next row

  4. Row Active Time (tRAS): this is the minimum number of clock cycles required between a row active command and issuing the pre-charge command

frosty gale
#

i see

#

essentially largely depends on the ram and its type im guessing

#

waiting for the day ram can essentially be incorporated into a cpu directly without having an external soc for it

#

that would probably rely on way smaller transistor sizes though and an increase in cpu dimensions i would guess

#

from what ive seen the industry is very hesistent on increasing the size/dimensions of the actual cpu to make room for more registers/cores

quartz kindle
#

just make cpus with built in ram lol

frosty gale
#

probably because its very complicated to make up a new standard and motherboard design

#

you have the threadrippers but literally nobody uses them bc they require a special motherboard

copper cradle
#

want to upgrade your ram? time to get a new cpu

quartz kindle
#

SoCs are getting mroe and more popular

#

only a matter of time before they start being used in desktop pcs

frosty gale
#

or a ploy to make people buy a whole new cpu just to upgrade ram

#

Intel and amd grinding their teeth

quartz kindle
#

make a layered memory layout, ie cpu with 4 layers of cache, l1 l2 l3 and iram

#

and then add an option to add external memory

copper cradle
#

now we're talking

copper cradle
frosty gale
quartz kindle
#

these days it shouldnt take much space to design a cpu with 4-8 gb of built in ram

quartz kindle
frosty gale
#

I literally forgot swap existed bc I have 32gb ram now lmao

quartz kindle
#

lmao

frosty gale
#

never run out of ram

quartz kindle
#

i have 8gb lmao

copper cradle
#

how come u only have 8 tim

quartz kindle
#

bought my laptop 5 years ago and didnt have the extra 100 bucks to make it 16gb

copper cradle
#

fair enough

#

I'm more of a desktop guy

#

I still have a laptop that I take to college

#

but that's all the use it gets lmao

quartz kindle
#

i disassembled my desktop and sold its parts

#

like 7 years ago

earnest phoenix
# frosty gale waiting for the day ram can essentially be incorporated into a cpu directly with...

Having RAM built into the CPU significantly limits the flexibility and upgradeability of the system, as mention as it the RAM can't be changed or increased

Additionally RAM requires significant amount of power to operate compared to a CPU, which would cause the power supply of the CPU to drain significantly

And besides, separating both the components allows for much better heat dissipation which is essential for high-performance computing

frosty gale
#

I used to have 4 and 8 and it's basically unusable nowadays

quartz kindle
#

ye

#

and companies still sell laptops with 4-8gb ram today

#

idk why

copper cradle
#

just so they can charge u more for the 16 gig 'upgrade'

frosty gale
copper cradle
#

w-what

earnest phoenix
#

Huh?

copper cradle
#

u running a double threadripper setup or something

earnest phoenix
frosty gale
#

brb

copper cradle
#

LMAO

frosty gale
#

theres this website that estimates the wattage needed based on components

#

ill put it in again

sage bobcat
#

One message removed from a suspended account.

solemn latch
#

I know it sucks, but memory is truly reaching a point that soldering super close to the cpu does improve performance.

When we reach ddr6 for cpus it will be normalized.

frosty gale
#

just the cpu and motherboard specified

quartz kindle
frosty gale
#

yeah they do that now

#

solder the physical dram chips onto the motherboard

quartz kindle
#

its horrible because you cant upgrade to 2x16

#

you will get stuck with 16+8

solemn latch
#

I mean like, every laptop will and desktops will start doing it too.

#

You'll buy a motherboard with ram built in

copper cradle
#

@earnest phoenix need that HD Skull rn

frosty gale
#

talk about integrated ram in the cpu limiting upgradability

quartz kindle
#

how is that different from the whole ram built into the cpu thing lmao, want to upgrade your ram? buy a new mobo

solemn latch
#

Even ddr5 some of the fastest ram you can get is soldered.
Iirc some laptop manufacturers played around with super high clocked soldered ddr5

solemn latch
#

I hate the idea, but eventually it will just have to happen

copper cradle
#

there we go

winged linden
winged linden
#

oh u mean outside of that function yeah i could place it outside, but its only used here anyway

winged linden
#

aside from that, that type of authorization is good?

sharp geyser
winged linden
copper cradle
#

I'm working on ddr7 dw

solemn latch
lyric mountain
sharp geyser
#

As of right now yea

#

Though I expect by the end of this year or beginning of next year it will happen

winged linden
#

what type of authorization do you personally use? any other suggestions

sharp geyser
lyric mountain
#

wdym type of authorization?

sharp geyser
#

nvidia always trying to make the most money they can

lyric mountain
#

there are only 2 afaik, token or oauth(2)

#

at least 2 commonly used

copper cradle
#

they'll release series 50 and right after that they'll just skip to series X or sum shit

sharp geyser
#

with the discord api there is only token and oauth2

winged linden
lyric mountain
sharp geyser
#

Did you hear of the PCIE NVME card?

lyric mountain
#

the docs has what data the token contains

copper cradle
#

the what

sharp geyser
#

The one that can support up to 16 NVME drives with dual channels in each slot

copper cradle
#

holy

lyric mountain
#

btw I'm not very sure, but using users token like that is borderline breaking tos

copper cradle
#

that's exactly what I need

sharp geyser
#

Its a PCIE expansion card that holds 16 NVME drives

#

And it is "hot swappable"

winged linden
copper cradle
#

now I'll be able to install all of my 0 nvme drives onto it

winged linden
sharp geyser
#

Its not really meant for consumers yet

#

but linus did a vid on it and put 16 8tb sabrient rocket drives in it

#

I think its 16 anyway

#

I could be wrong

lyric mountain
winged linden
#

cause i wanna limit unauthorized access (basically someone trying to replicate that he is someone else)

winged linden
copper cradle
lyric mountain
#

token only contains 3 things

copper cradle
#

I'll eventually get a hold of one

lyric mountain
#

user id, a secret key and when the token was created

#

u dont need to make a request to discord if all u want it the userid, but yeah u shouldn't be handling user tokens at all

#

oauth2 will give u all data u want as long as the user authorizes

winged linden
lyric mountain
#

yes, the issue is that ur handling raw tokens

winged linden
quartz kindle
#

this is an interesting image about sql's order of operations

tulip ledge
#

Is it possible to have your bot have extra commands just for one guild?

civic scroll
#

yup

#

iirc you can register commands based on guilds

tulip ledge
#

alright

hushed robin
#

what's the point of x-csrf-token

proven lantern
lament rock
# hushed robin what's the point of x-csrf-token

cross site request forgery tokens are used for protecting against clients making requests to your website from other sites.

For instance a website can abuse image elements from stuff like markdown to html where an attacker can have a link to an "image" which is actually a protected route that needs authentication and if the route accepts GET requests, the request can be performed which can be destructive. The client of course doesn't know this and tries to load it as an image

proven lantern
#

oh

#

oops

hushed robin
#

it's annoying

lament rock
#

You'd check for the presence of csrf headers in requests and for the love of god make sure they expire

hushed robin
#

how can i not do it

proven lantern
lyric mountain
#

columnar databases?

proven lantern
#

nosql databases

hushed robin
lyric mountain
#

I suppose it'd be the same thing, but without the join part

hushed robin
#

kuuhaku

#

do u know

proven lantern
#

what type of db is dynamodb?

lyric mountain
#

does it use tables?

proven lantern
#

yeah

quartz kindle
# proven lantern nosql databases

yeah the general scheme of things is mostly the same, just in a different syntax, for example instead off FROM and JOIN its a document selector, then instead of ON column and WHERE expression, is filtering and matching syntax, then grouping, ordering and limiting syntax

lyric mountain
#

does it allow having foreign keys?

#

if so, then it's sql

#

tbh it having tables already falls into sql

quartz kindle
#

Amazon DynamoDB is a proprietary fully managed NoSQL database offered by Amazon.com as part of the Amazon Web Services portfolio

proven lantern
#

i dont think it's columnar

quartz kindle
#

In DynamoDB, data is stored in Tables as items, and can be queried using indices. Items consist of a number of attributes which can belong to a number of Data Types, and are required to have a Key that is expected to be unique across the Table.

proven lantern
#

seems more like a big hashmap

lyric mountain
#

nosql as in mongo-like or nosql as in "not only sql" like postgres?

hushed robin
#

๐Ÿ˜

quartz kindle
#

DynamoDB uses JSON for its syntax because of its ubiquity.

proven lantern
#

would it be considered a columnar database?

lyric mountain
#

battleless when he discovers there are 2 meanings for "nosql"

lyric mountain
#

see my previous message

proven lantern
hushed robin
#

kuuhaku

#

do u know how i can bypass x-csrf-token on an api post request

lyric mountain
#

u cant

quartz kindle
#

Lol

lyric mountain
#

csrf rules are defined on the server

hushed robin
#

i don't get the point

#

it makes no sense

lyric mountain
#

to prevent cross domain attacks

hushed robin
#

it just makes my life harder

hushed robin
hushed robin
#

๐Ÿ˜

#

i don't click links

lyric mountain
#

then go to a library and find a book

quartz kindle
#

depending on how they set it up, you can bypass it

hushed robin
#

i don't want my discord token leaked

lyric mountain
#

it's not a discord token lmao

proven lantern
hushed robin
#

clicking link will get my discord token leaked

#

i don't want that to happen

quartz kindle
#

Lol

#

your token wont get leaked just from clicking a website lol

peak drum
#

Lmao

quartz kindle
#

token leaks happen when you download and run shit, or try to login in a fake discord

neon leaf
#

lmfao

hushed robin
#

๐Ÿ˜

quartz kindle
#

lmao

peak drum
hushed robin
#

i've been very safe ever since that

#

is it true or not?

quartz kindle
#

its impossible for a website to access your discord from within the browser

lyric mountain
#

if not, please be considerate and fuck off

hushed robin
#

what if my discord is logged into browser

quartz kindle
#

if you use discord in the browser, another tab still cannot access your discord tab

#

but a browser extension can

hushed robin
#

bruh

#

then why did kuuhaku and waffle say yes

quartz kindle
#

so dont install untrusted browser extensions

hushed robin
#

the only extension i have is

#

ublock origin

quartz kindle
#

then you're fine

sage bobcat
#

One message removed from a suspended account.

hushed robin
#

i don't really understand that

#

i'm trying to but it's not making sense

sage bobcat
#

One message removed from a suspended account.

lyric mountain
#

well, the first link I sent had it more digested

#

wikipedia will be 100% technical

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

surreal sage
#

wtf am i doing LOL

sage bobcat
surreal sage
#

w desktop

lyric mountain
#

windows sandbox?

surreal sage
#

yes

lyric mountain
#

...wasn't a yes/no question

surreal sage
#

too bad ur getting yes

proven lantern
hushed robin
#

i mean

#

i don't get how that works

quartz kindle
#

example

#

you open a website

hushed robin
#

how can someone put invisible website on my website

quartz kindle
#

when the website sends you the html page

proven lantern
hushed robin
#

but how

quartz kindle
#

they also sent you a hidden token in the html page

#

and also a hidden cookie

#

after that, every single page you load in that same website

#

secretly sends those tokens to the server

#

and the server checks if the tokens are the same as the tokens it gave you when you loaded the first page

#

if they are not the same, or if they are missing, it blocks the page

hushed robin
#

well

quartz kindle
#

its basically a session checking system

hushed robin
#

that makes slight sense but i don't get how someone can put an iframe on my website

quartz kindle
#

the first time you open the website, it creates a session for you

#

without that session, specific pages of that website may refuse to load for you

#

thats csrf

#

the iframe story is a different thing

lyric mountain
#

sites are just a big html document

quartz kindle
#

an XSS works like this

#

your website has an api, it sends a request to that api, and puts the response inside its html

#

if that resonse is not validated, a malicious user could for example create a proxy, or through a virus or malicious browser extension override your api with a fake api

#

so that when your website makes the request, the response will be different

#

and your website will try to load it into its own html anyway

proven lantern
neon leaf
#

do I need to worry about csrf when I store sessions in localstorage?

quartz kindle
#

ideally you would store sessions in a server-only cookie

#

to prevent access from client side js

neon leaf
#

because of xss or why?

quartz kindle
#

because of session theft basically

#

i mean, if the client is compromised, nothing prevents an attacker from stealing his session

hushed robin
#

bro I ordered doordash and they dropped it off to the wrong house

#

this ruined my day

quartz kindle
#

but a server-only cookie can only be accessed by a user

#

while localStorage can be accessed by a script

#

and browser extension

#

so its less safe

quaint night
#

How can I add a bot in discord

hushed robin
#

get invite link

#

put in browser

#

or click on in discord

neon leaf
hushed robin
#

then pick server

#

and authorize

quaint night
#

Ok thanks

neon leaf
#

does a server-only cookie get created using the set-cookie header(s)?

quartz kindle
#

yes

#

Set-Cookie: <cookie-name>=<cookie-value>; Domain=<domain-value>; Secure; HttpOnly

#

use Secure and HttpOnly

#

HttpOnly Optional
Forbids JavaScript from accessing the cookie, for example, through the Document.cookie property. Note that a cookie that has been created with HttpOnly will still be sent with JavaScript-initiated requests, for example, when calling XMLHttpRequest.send() or fetch(). This mitigates attacks against cross-site scripting (XSS).

#

Secure Optional
Indicates that the cookie is sent to the server only when a request is made with the https: scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks.

neon leaf
#

thank god I already added a helper to create / modify cookies in my webserver

quartz kindle
#

also use SameSite=Strict

neon leaf
#

yeah ill switch to server-only cookies then

quartz kindle
#

SameSite=<samesite-value> Optional
Controls whether or not a cookie is sent with cross-site requests, providing some protection against cross-site request forgery attacks (CSRF).

The possible attribute values are:

Strict
Means that the browser sends the cookie only for same-site requests, that is, requests originating from the same site that set the cookie. If a request originates from a different domain or scheme (even with the same domain), no cookies with the SameSite=Strict attribute are sent.

neon leaf
#

but still allow the authorization header obviously

maiden gazelle
#

im getting this error but i don't know why it's undefined and how i can define fetch

lyric mountain
#

require/import it

maiden gazelle
#

how

lyric mountain
#

the same way u do with every other module

lyric mountain
#

btw, if you're in newer node versions it should be included by default

hushed robin
#

free food ๐Ÿคฉ

maiden gazelle
#

wait thats discord.js

quartz kindle
hushed robin
#

node -v

#

to check node.js version

neon leaf
#

this should be fine for sessions, right?

const token = hashStr({ text: `${user.name}:${infos.email}.${infos.password};${user.tag}@${Date.now()}`, algorithm: 'sha256' })
quartz kindle
#

if you use a version lower than 18, you need to install fetch as a third party library, for example npm i node-fetch

#

and then require it in your code

lyric mountain
maiden gazelle
quartz kindle
maiden gazelle
#

oh

quartz kindle
#

is this your own pc or are you coding in glitch/replit?

lyric mountain
#

if ur fine with that, I'd recommend using a digester instead of a long string

neon leaf
#

Im just fetching it from the db on every request

maiden gazelle
lyric mountain
#

create a hash instance, update with the first part, then with the second, then the third

neon leaf
#

its fine since the db is on the same internal net (0.01ms)

lyric mountain
#

then finalize with a salt

quartz kindle
#

or you code in your computer then upload the files?

lyric mountain
maiden gazelle
neon leaf
#

I generate it once on login and add it to the db

maiden gazelle
lyric mountain
#

ah ok then

quartz kindle
hushed robin
#

you need to require node-fetch if your version isn't 18+

lyric mountain
#

anyway, I'd recommend a digester instead of a single string

quartz kindle
#

so fetch was added in node 18, you have node 16

lyric mountain
#

because you're able to salt it

quartz kindle
#

so you need to install a third party fetch

#

from npm

#

or upgrade your node

maiden gazelle
#

and if i upgrade node will it have any impact to the rest of my code

#

so do i need to change much

quartz kindle
#

most likely not

#

node versions are usually not breaking

lyric mountain
#

most notable change will be that uncaught exceptions will crash the runtime

#

instead of just logging

#

idk which version this came in

quartz kindle
#

because why not

lyric mountain
#

because exceptions are meant to be handled

hushed robin
#

why purposely crash the runtime

#

sounds like a bad addition

quartz kindle
#

if your code is broken, why keep running it?

hushed robin
#

why not?

#

what if it's an emergancy

quartz kindle
#

lmao

neon leaf
#

why do I keep screwing up endpoints like POST /api/user/friends/2/accept, anyone can accept anyones request... time to fix again

hushed robin
#

i need it running

lyric mountain
#

simply catch your promises

#

and treat your input

quartz kindle
#

nah, eval() your input :^)

lyric mountain
#

it's not hard to prevent it, js allowed so many bad habits that people became lazy

#

if your app is screaming for help and you're ignoring it you deserve the despair of it crashing in production

quartz kindle
#

its like driving a broken car

#

the longer you drive, the worse it gets

lyric mountain
#

wdym no, js devs are among the most "who tf cares"-type of programmers

quartz kindle
#

true tho

#

thats why 99% of the websites out there are bloated pieces of grabage

#

js culture = throw more hardware at it

neon leaf
lyric mountain
#

buddy u literally use the worst options available if they're the easiest ones

earnest phoenix
lyric mountain
#

ah they're safe then

quartz kindle
#

nah, voltrex broke battleless's code

#

:^)

earnest phoenix
#

Good mmLol

neon leaf
#

this should be it, right? Tim

hushed robin
#

i use the most ideal options

lyric mountain
hushed robin
#

should i be scared

frosty gale
#

where tf do you store your code files

neon leaf
hushed robin
#

on a folder on my desktop

lyric mountain
hushed robin
#

no

frosty gale
#

that might be it

hushed robin
#

where do i see

#

oh it is on

lyric mountain
#

that shouldn't be triggered by git anyway

frosty gale
#

yeah dont know why its triggering for him

#

bro downloaded the git from softonic ๐Ÿ’€

hushed robin
#

the file it's trying to change is in documents

lyric mountain
#

well, THEN there's a reason it triggered

hushed robin
#

why

lyric mountain
#

dont put code in documents

#

it's a protected folder

hushed robin
#

i didn't

frosty gale
#

yeah thats why i asked where tf he stores his code

hushed robin
#

github automatically did it

lyric mountain
#

git (not github) adds files to where u tell it to

frosty gale
#

i am the administrator???

hushed robin
lyric mountain
#

what did it add/remove?

hushed robin
#

%userprofile%\Documents\GitHub\PixelPieceTrello.git\FETCH_HEAD

neon leaf
lyric mountain
hushed robin
#

no

#

github did

quartz kindle
lyric mountain
#

it asks you to choose a folder, u chose documents

hushed robin
#

why is documents protected

lyric mountain
#

because it's used to store documents

neon leaf
#

it was

quartz kindle
#

because it belongs to a User

hushed robin
#

true

#

does that mean documents is unhackable

quartz kindle
#

no

lyric mountain
#

no

neon leaf
#

I think I have to set the path to /, no?

quartz kindle
lyric mountain
#

simply that making changes to it is more controlled than other folders

hushed robin
#

apparently srtasks.exe was trying to access my memory

#

should i be worried

neon leaf
#

works

quartz kindle
hushed robin
#

oh

#

w

#

i have no virus

quartz kindle
#

you are the virus

#

:^)

neon leaf
#

this is now the safest way, right?

quartz kindle
#

also make sure your website is https only

#

enable hsts

hushed robin
lyric mountain
neon leaf
quartz kindle
#

add all the relevant security headers as well

neon leaf
#

which headers?

quartz kindle
neon leaf
#

ah right

#

cloudflare sets most of them

quartz kindle
#

alright

#

then everything should be good

neon leaf
#

nice

#

almost forgot to remove the cookie when logging out

quartz kindle
#

:(

neon leaf
#

should be done now

hushed robin
#

because mods are bias and you should have tecnhically gotten muted

neon leaf
#

also do you know how to properly make a server sent events stream?

#

my current one kinda works but times out after 100000ms and restarts

rustic nova
rustic nova
#

Then read what I have said and stop continuously mentioning it if you're not willing to do that

hushed robin
#

ok

neon leaf
#

server sent events

#

sse

quartz kindle
#

hmm never used that

quartz kindle
#

i just know http polling and websocket

#

didnt know sse was a thing

neon leaf
#

basically a websocket but only from server to client

#

useful for notifications and shit

quartz kindle
#

cool

#

are you using a webserver like nginx?

#

or nodejs directly exposed?

neon leaf
#

cloudflare -> nginx -> node