#development

1 messages · Page 201 of 1

wheat mesa
#

(Probably not the place to put this but nobody is here anyways so w/e)

sharp geyser
#

Your gambling is not based on real probability

#

Ask waffle to give you the math on it

#

He loves statistics

wheat mesa
#

I mean this is the one part of stats that isn't absolute dogshit

glass acorn
wheat mesa
#

It's fake currency so chances are it's probably actually not favored poorly

sharp geyser
#

Casinos better watch out for waffle

#

He’ll empty em out

wheat mesa
#

If it was real currency the expected value of your winnings is always in the negative

glass acorn
#

From 1-10

#

If you get the bad number

wheat mesa
#

Because if casinos have a game that is constantly in their favor, they may lose in the short term, but will always win in the long term

glass acorn
wheat mesa
#

There are some games where you can win based on some skill like poker or blackjack but at the end of the day there is always a predetermined probability at each game state

#

So you randomly choose 2 (unique?) numbers between 1-10 and your player guesses a number and hopes that it's not one of those two

#

What kind of return is that?

#

Are you just 2x'ing? If so, people will get bored quickly because they will make way more money than they lose

#

To keep a game fun, you can't just win with no effort

#

You have to do the math here to keep the stakes high

glass acorn
glass acorn
#

🤫

wheat mesa
#

All I'm saying is that your game it's cool and all but if you intend it to have replayable value, giving 2x for a 4/5 chance of winning (assuming the losing numbers are unique), people are going to abuse it to make a lot of money

#

A "fair" game would be to pick 5 unique random losing numbers between 1-10 and give a 2x return

real rose
#

@sullen crater getting shown up

frosty gale
#

theres your gambling game

#

in a nutshell

eternal osprey
#

hey guys

#

i am looking into creating my own algorithm for compression for some reason

#

just doing some side tasks in life ig KEKW

#

so this was my idea:

#

what did i do

frosty gale
#

You've attempted to share potentially unsafe content, which has therefore been blocked.

eternal osprey
#

well no shit i can read

#

but why

#

how tf is this not safe

#

is it cuz of the bitstring?

frosty gale
#

we shall investigate

#

yeah i have no idea

#

some word probably has a bad word in it

eternal osprey
#

yeah they just don't like me

#

anywys, would my idea work?

frosty gale
#

but your idea of converting it to bits wont actually save any space

#

you should interpret it on a byte level

sullen crater
real rose
sullen crater
#

with you

eternal osprey
eternal osprey
frosty gale
#

if youre storing each part of the file as bits you still have to likely store the data in bytes so youve effectively made a single bit use 8x the space

#

it gets a little tricky doing it in bytes since you have to distinguish the data in the file from actual data of the file and your compression algorithms repeat characters

eternal osprey
#

i can use byte reconstruction, where i paste the bits together to fill the data?

#

I've done that in the past when working with mutexes for my OS course

frosty gale
#

you cant really deal with bits in a byte world

#

memory addresses and storage minimum unit is usually a single byte so 8 bits

#

you can of course in theory compress and reduce things on a bit level but in practice youll end up using more storage

#

and that kinda defeats the point of a compression algorithm

eternal osprey
#

you are right.

#

Damn

#

but on byte level, how can i ever reduce it?
like suppose i have 11111110 00000001
then i can read the bytes consecutively and increase the prefix number till i encounter a character that is not the same as the previous for example?

#

owh wait yeah that should work

frosty gale
#

what run length encoding does is literally do what you did with the bits

#

looks for the same consecutive bytes and puts a prefix with the number of them in a row to expand them

#

but you cant do it for all bytes in the file because youll likely end up using more space also

#

youd likely have to have some sort of header at the start of the data/file which indicates the locations of prefixes and data that has to be expanded

#

you cant really add a magic number at the start of the bytes to be expanded because what if the data happens to be the magic number

#

unless youre certain that number will never appear in the data which in that case can save a bit of space

eternal osprey
#

hmm i see, i will have to investigate more about this. But pretty sure i want to implement it for fun starting today.

#

thanks for all the help Chloe! I will @ you if i run into problems.

frosty gale
#

sure, i'd also recommend experimenting with different variations and ways of doing it

#

maybe even instead of every consecutive byte its every byte after it thats a duplicate

lyric mountain
lyric mountain
#

it's fairly good for text, but really bad for anything else since long chains of repeated bits become very rare

surreal sage
#

imagine finding a cve worthy bug/exploit and waiting for new year's eve to end so you can get the first assigned id 🗿

lyric mountain
#

someone at 31/12 23:59 - finds that bug/exploit and reports it

surreal sage
lament rock
#

Depends on the use case I'd say. Syncing the threads is a bit of overhead. Could make the operation async by only having an owner thread update entries and you just send an update op from one thread to another

#

Unless the results need to be immediate

wheat mesa
#

Multithreading is painful, especially in Java. You can overcomplicate it pretty easily, it really depends on your use case

wheat mesa
#

Probably don’t need a mutex, just use a standard lock

radiant kraken
#

@quartz kindle

quartz kindle
#

lmao

lyric mountain
#

new ConcurrentHashMap<>()

#

same performance, slightly higher memory usage

#

that loses pretty much all of hashmap's upsides

frosty gale
#

i assume its slow

#

oh i see

#

probably because you cant do normal keys

lyric mountain
#

but well, you could extend concurrenthashmap and use equals instead of hash for comparison

lyric mountain
frosty gale
#

is that even a hashmap then

#

its just a map

lyric mountain
#

so you could for example use a completely unrelated class to retrieve a value as long as both are equal

#

it probably stores entries under a hashtable

#

but for obvious reasons it isn't O(1) for retrieval

#

synchronizing the map would be the same as not using concurrency at all, since you force all threads to wait their turn to use the map

#

volatile doesn't work for this

#

the issue is that the map cannot manipulate the hash table when 2 or more threads are trying to add stuff at the same time

#

do note tho, you will lose a lot of performance by not using hashes for retrieval

#

it'll go from O(1) to O(n)

#

why do you even need an identity map btw?

#

ok but this doesn't need an identity map still

#

any specific reason to use equals instead of hashcode?

#

why not?

#

like, the only case where an identity map would be needed would be smth like this: ```java
class A {
int someKey = 1;

@Override
public boolean equals(Object other) {
return someKey == ((B) other).someKey;
}
}

class B {
int someKey = 1;

@Override
public boolean equals(Object other) {
return someKey == ((A) other).someKey;
}
}

var a = new A();
var b = new B();
var map = new HashMap<A, Object>();

map.put(a, 123);
System.out.println(map.get(b)); // wont find, as classes are different

#

simplified it for simplicity's sake

#

with a regular hashmap this would never work because both classes aren't the same type

#

they use hashcodes

#

all classes have a public int hashcode() implementation, hashmaps store entries by class and then by hashcode (which is why the above example fails)

#

it wont collide unless you have an ungodly amount of entries

#

and at that point you need to ponder whether there isn't a better way of doing whatever you're doing

#

actually, I need to correct myself, I pretty much confused IdentityHashMap with another different Apache implementation

#

dont remember the name of it, but apache's impl is the one that solely relies on equals, java's std identityhashmap is a different thing entirely

#

ihm (identityhashmap) ignores equals/hashcode entirely

#

it uses the pure version of them, which compares references themselves, not their values, and as such is faster

#

sync map is better if you can afford putting the threads in a queue for writing to it

#

idk, try to measure loading time, maybe the different is small enough

eternal osprey
#

hey guys, so to authorize actions users will do on my site, i am basically saving the user_id on the client side together with email hash, password hash and username. Is this save? This is needed for my users to make actual actions to the database

#

i save it using localStorage btw

frosty gale
#

usually the industry practice is to have some kind of session token that the server ties to the user

#

then the user sends that session token to authenticate the user

#

if you want to store the users data on the client and have the server be able to see them you should use JWT's with a hmac

eternal osprey
#

i see

#

To be fair, users can only get to specific actions anyways if they are logged in ya know using the hash, so i think i should be good.

quartz kindle
#

no hashes should ever be stored client side

#

its always a session token or a jwt token

eternal osprey
#

so how can i do that then? Like, how can i keep track to what sessionId a user ID belongs?

#

Suppose a user is in the home page of the website, how can my site recognize this user using it's sessionid? keeping track of it in a database?

quartz kindle
#

in the database, the session token has an expiration date, and the user id

#

as well as other info like ip address and what not

eternal osprey
#

ahh i see. I already indeed created such a timestamp after which a user MUST login again to prevent some type of attacks. But indeed, after a login and or register i can create a sessionToken that links to a user ID in the database.

frosty gale
eternal osprey
#

Instead of implementing a timer based approach i rather want to check the sessionid AND THE TIME IT after which theymust login again each action a user makes.

sharp geyser
#

I feel like I’ve went over this with you before

sharp geyser
#

Better hurry up on that astronomy api tim or else

eternal osprey
sharp geyser
#

I never told you to store hashes

eternal osprey
#

no i know

eternal osprey
#

but checking the timestamp after each action

sharp geyser
#

I also never recommend such thing

#

I told you to do exactly what they said

#

Store a session token in the server and have the client compare

#

Or use jwt

#

That’s the only real way to do it now

#

JWT is meh though as they don’t rely on a server for confirmation and can’t be revoked/invalidated unless they naturally expire

#

I’d never recommend them for login persistence unless it absolutely needs to be stateless

eternal osprey
#

but hold on

#

can't i just save a user id that my system automatically assigns a user upon registration?

#

Like fuck it, a user id is not even that important right?

#

That way i can query my database based on that user id which is also the primary key for all tables.

#

or would that still be stupid and dumb and stupid?

sharp geyser
#

wdym

eternal osprey
#

okay look

sharp geyser
#

That’s how sessions work

eternal osprey
#

hollup i will show you sum

sharp geyser
#

You generate a session token, save it to the database alongside a user id (or anything unique to the user) and save that token to the client side to be sent over any subsequent requests

eternal osprey
#

omg aaron i love you so fuckig fucking much

#

what i have rn is:

user registers and queries database -> database will now register user, it will save a specific random 50-char length code as sessionID. This will be linked to a user id. Now i return that sessionid back. A user can now using the localstorage query shit using the sessionID, by checkin the database session table and retrieving the actual user id. Using that we can execute what the user wanted to do.

#

++ it expires after 24h after which you must login again

sharp geyser
#

That’s a typical way to do it yes

eternal osprey
sharp geyser
#

All it is just comparing session ids

eternal osprey
#

frontend aint got shit on me lets go

sharp geyser
#

Also

#

Just to note

#

You are checking to see if the session is expired right?

#

If so don’t delete sessions when they expire

#

Just mark a field as it being expired

sharp geyser
eternal osprey
#

i am not deleting the entry, only updating it.

#

That way i can keep track to which user a session belongs, even when it renews.

sharp geyser
#

That’s smart but also keep note of who uses the token after it’s been expired/revoked

#

A lot of people will bot requests using stolen tokens

#

As haku pointed out

quartz kindle
#

since one user can have multiple tokens (one for each device/browser)

sharp geyser
eternal osprey
#

I do

frosty gale
#

but you can still do things like country detection yeah

#

if you primarily log in from the usa and suddenly log in from spain there might be a problem

quartz kindle
#

:^)

sharp geyser
#

Especially if you’re a high valued company

#

💀

quartz kindle
#

nah f u i dont want to have to relog every time i get out of a plane :^)

frosty gale
#

the attacker isnt really bothered by it all that much

#

minor obstacle if you can get that far

sharp geyser
#

I don’t travel around the world every day

quartz kindle
#

if youre homeless, just buy a house

#

duh

sharp geyser
#

Shit that’s revolutionary

#

Need to write a book about that

lament rock
#

Logging every word Tim says since hes an oracle

frosty gale
#

make a tim markov chain

#

in case he gets banned

#

then we can have him forever

#

scary thing is nowadays if you have the hardware you can make a very convincing LLM of someone

quartz kindle
#

lmao

frosty gale
#

it will talk exactly like them

quartz kindle
#

even though for some things you dont even need to go that far

frosty gale
#

laws will probably get more strict on accepting images or videos as evidence to compensate

#

right now theyre in a state where they can be detected if you look close enough but thats fading very quickly

quartz kindle
frosty gale
#

governments will probably instead try to limit LLMs and stop businesses from allowing people to do their own stuff with them but that wont work at all

quartz kindle
#

back then if you messed with the wrong people you'd get beaten up, today you get falsely accused of random shit and canceled to oblivion

#

all you need is a bunch of gullible people to parrot your accusations away and suddenly millions of people hate you and you have no idea why

#

lmao

sharp geyser
#

Oh boy sounds like the job for the internet alright

#

They’ll believe just about anything if it has drama behind it

#

They’ll pick a side and root for it without even knowing what’s going on

quartz kindle
#

ye

frosty gale
#

we are fucked

#

we truly are

#

ive already accepted it

quartz kindle
#

and once the damage is done, they pretend they didnt do anything wrong

frosty gale
#

people are also getting less intelligent statistically speaking as time goes on

#

so hardly going to be a next einstein if you think hes smart

quartz kindle
#

idiocracy coming up fast

#

:^)

frosty gale
#

this sets up society becoming a totalitarian state

#

soon what china is doing will become normal

#

considering everything thats happening combined

sharp geyser
surreal sage
sharp geyser
#

It’s some dumb movie

#

But it speaks facts that’s how I feel like things are going 😭

frosty gale
#

if people disagree youre kind of screwed

sharp geyser
#

That’s what I’m saying

frosty gale
#

a lot of people nowadays blindly follow social conventions and dont even step up and ask hey maybe theres more to this or xyz

sharp geyser
#

That’s why I disagree with everything the internet has become for the most part

frosty gale
#

einsteins initial observations and theories were heavily discredited by scientists and people at the time for example

#

apply that logic to anything

sharp geyser
#

Bro barely looks 25

frosty gale
#

i have not

quartz kindle
#

its already happening

sharp geyser
#

Yea

surreal sage
#

nice one google

#

should inserting a document with mongoose take this long?
(see difference between last 2 logs)

#

(empty collection.)

#

io write only goes to like 16 kb/s, no high usage

sharp geyser
#

Depends on what you’re doing in between

#

Also is that in ms?

surreal sage
#

yes

#

performance.now

#

21.49 - 19.24 = 2.25 sec insertion time

#

its just a simple schema with one default function calling nanoid

sharp geyser
#

What’s taking so long that it takes 20s just to validate

surreal sage
#

2s****

sharp geyser
#

20,000 ms is 20s

surreal sage
#

nono

#

only look at the differences

#

performance.now returns the time since process start in nanosec or whatever

#

validate takes 7 ms

#

checking (read collection) like 21ms

sharp geyser
#

Either way 2s isn’t terrible

surreal sage
#

it's an empty collection

#

empty database

#

new mongo instance

sharp geyser
#

Okay

#

And I have an empty pg table

#

And even with records it still takes 1-2s to finish creating

#

That’s where bulk of my endpoint time is

surreal sage
#

🫠

#

should've used redis fr

sharp geyser
sullen crater
#

Redis™️©️

sharp geyser
#

Redis isn’t all it’s made out to be

#

Especially not for lengthy storage

surreal sage
sharp geyser
#

Redis may persist records but they aren’t for lengthy storage

#

They are meant to expire

surreal sage
#

restart proof ig

sharp geyser
#

🤔

surreal sage
#

crash proof then

sharp geyser
#

I have no clue what you’re on about bro

sharp geyser
#

Right immaturity shows with this one

#

Can we never have a normal conversation in this fucking channel

surreal sage
frosty gale
#

come on postgres devs

sharp geyser
#

It’s not even Postgres

#

He uses mongo

frosty gale
#

ah

#

that explains a lot then

surreal sage
#

i don like them weird sql cmds

#

they scare me

sharp geyser
real rose
#

battless, noob, etc

sharp geyser
#

At this point im convinced they are related

frosty gale
#

battleless is a gem

real rose
sharp geyser
#

Or ItsOkayBae

frosty gale
sharp geyser
frosty gale
#

though you can still use mongo its good enough

surreal sage
#

im not doing things on a scale

sharp geyser
#

Honestly I could probably drastically improve my speeds

frosty gale
#

so even so

surreal sage
#

no rapidly changing things

sharp geyser
#

But im in the prototyping phase so idrc rn

frosty gale
#

mongo is designed to run in production at scale anyways

#

probably by scaling horizontally on the atlas cloud and charging you 20x for that

surreal sage
#

scaling horizontally? i prefer diagonally

real rose
#

plus noob hasnt been active since being called out wawa

sharp geyser
#

Yes he has

frosty gale
#

who is this noob person

real rose
#

its been 10 days

frosty gale
#

oh this dude

real rose
#

not super active

frosty gale
#

i remember

sharp geyser
#

The chatgpt guy

frosty gale
#

that is definitely battleless

#

95% sure

sharp geyser
#

Oh ofc

#

If I remember correctly Battleless had the same pfp at one point

#

Not exactly a slam dunk but yknow

#

They act the same and had the same pfp

real rose
#

next time i see noob speakin

#

ill drop a bombshell

frosty gale
#

i have not seen a single productive message come out of battleless or this person

sharp geyser
#

Cause there is none

sharp geyser
real rose
sharp geyser
#

Precursor to Battleless

#

Same energy

frosty gale
#

its just something subconscious

#

you just feel it

#

him and battleless emit the same energy

sharp geyser
#

ong

frosty gale
#

@harsh aspen thin ice buddy

sharp geyser
#

Oh no he’s been summoned

#

Prepare for a 5 page ChatGPT essay on how he doesn’t know who this Battleless person is

quartz kindle
surreal sage
#

sry internet bit shitty

#

cant select most bottom requests bcuz that status bar is blocking

sharp geyser
#

Wait what didn’t even see that

#

💀

#

Bro working on dialup

quartz kindle
#

what in the actual heck takes 2 hours to load

surreal sage
#

dev tools just buggy

#

someone needs to fire up dev tools' dev tools

sharp geyser
#

Yea okay

quartz kindle
#

1gb in resources

sharp geyser
quartz kindle
#

lmao

sharp geyser
#

Okay time for me to head off

#

Joke made now I skidaddle

surreal sage
#

1.02 mbps coding

#

its js the same tab ive been working on the past 3-ish hours

#

(live reload)

quartz kindle
#

lmao

lament rock
sharp geyser
#

Mostly uuid and strings

lament rock
#

Something is up then if it takes 2 seconds

sharp geyser
#

Yea no sure I’ll do further testing later

sharp geyser
#

No way you scrolled to post that

harsh aspen
stark abyss
#

i am sick of coding. Cs field not worth it anymore. No money, no women, no respect only grinding ):

radiant kraken
#

dont have too high expectations

stark abyss
#

didnt have any.. just did coding in highscool as a hobby n then in college decided to pursue cs bc i liked it

#

i like coding dont like theory or math

#

i think i just contradicted myself

radiant kraken
#

yeah sadly that's a problem for most new CS students

#

CS is often a lot of theory, unless the curriculum proves otherwise

stark abyss
#

yeah

molten reef
#

Yey i have my green role

stark abyss
#

yeah i also had my green role for years, and havent coded a discord bot since sophmore year of highschool so

stark abyss
#

discord api went full crazy and it was time consuming to keep updatinng the bot

lament rock
#

The api didn't change too terribly much. Libraries like discord.js like to change a lot for some reason

stark abyss
#

yeah i meant discord.js specifically

#

but discord too the whole thing with removing bot perms to secure privacy & buttons, dropdown and so much more

eternal osprey
#

I really want to thank everyone for helping me on my coding journey in here. Everyone’s been great with explaining and pushing me to do stuff out of my comfort zone. I remember asking to be spoonfed code, and now I have somewhat mastered Haskell, Java, js, (bootstrap, html, css not really code but still in my stack), c++, Python.

spark flint
#

postgres question time again

#

so theoretically if i had 890 million database records, how would I make querying them fast? atm it takes just over a minute to query the count and 1-2 minutes to query any field

#

vm specs

lament rock
spark flint
#

i dont think so

#

some example queries i do are:

SELECT * FROM data WHERE addresses @> $1 ORDER BY timestamp DESC
SELECT * FROM data WHERE domain LIKE $1
SELECT * FROM data ORDER BY timestamp DESC LIMIT 1```
#

id
domain
addresses (array)
rcode
hostname
subdomain
ns (array)
timestamp

lament rock
#

Hm. LIKE is pretty tough

spark flint
lament rock
#

I'm not too sure. I've only dealt with predictable conditions so you can easily make a b-tree on a specific column

spark flint
#

i could do a full text search index

#

and query using that instead

#

since LIKE doesn't work with FTS

spark flint
#

array contains

quartz kindle
#

for the third query, try using the MAX() function instead:
SELECT * FROM data WHERE timestamp = (SELECT MAX(timestamp) FROM DATA)

#

for the second query, try using a trigam index, although it only works with minimum 3+ character queries, but it supports both LIKE and ILIKE queries

#

there are a lot of other techniques for fast text-queries depending on the type and format of strings you store

#

it also shows how you can use a GIN index to speed up your first query

frosty gale
#

this discussion is encouraging me to work on my project

limpid rain
#

Hi

radiant kraken
#

mhm

wheat mesa
#

JNI is a PAIN

#

Have fun

#

You’ll probably spend more time debugging your Java JNI stuff than you will working on the actual rust part lmao

lyric mountain
#

they made it better on newer versions, tho jdk 22 onwards

#

try groovy

lyric mountain
#

I created a gin index on my materialized view, currently comparing fuzzy search options to see which one performs better

#

levenshtein dist is the one that got the best actual total time atm

#

why

lyric mountain
#

and when did you see a groovy codebase?

#

ps: build.gradle isn't groovy code, it's just declarations and settings

#

I'm 120% sure it either wasn't groovy or they didn't know how to use it

#

saying that it looked like java is why, especially saying prehistoric java

#

I've used java 1.4 before, trust me

radiant kraken
#

took me about a day to get used to jni

#

JNI binaries are essentially just dll files

wheat mesa
#

Yes but you’re assuming that the binary you’re using doesn’t have issues

radiant kraken
#

like what?

wheat mesa
#

If you’re writing your own DLL, you’ll probably be doing a lot of debugging unless you’re not doing something complex

#

I’m not sure how it works with Rust but I know running into segfaults with C++ DLLs fucking sucks

radiant kraken
#

well if you're using Rust the library does most of the heavy lifting for you

#

while you also get Rust's safety features

surreal sage
#

crazy how gen digital (owner of norton and avast) also owns ccleaner

#

very interesting

pale vessel
#

malware

radiant kraken
#

true

surreal sage
#

malwarebytes better though

radiant kraken
#

windows defender is good enough

surreal sage
#

disabled that shit

#

at least i want to

#

it no no let

#

shit uses too much of my system for no reason when its enabled

radiant kraken
#

yeah especially you own a low end pc

surreal sage
#

(this happened with a mid-end)

#

im not in fckn switzerland

#

first ireland then switzerland 😭

quartz kindle
#

demanding websites to comply with every single country's regulations just because some people from there access your website

#

its the stupidest thing ever

#

oh man people from north korea are viewing my website, i better change my website to cater to their demands

lyric mountain
spark flint
#

index time

lyric mountain
#

the hell you're making a regex index

spark flint
#

React is the library for web and native user interfaces. Build user interfaces out of individual pieces called components written in JavaScript. React is designed to let you seamlessly combine components written by independent people, teams, and organizations.

lyric mountain
#

nah, more like linux is too decentralized to be able to make viruses for

#

windows is easy cuz there's only one windows

spark flint
#

also clamav is good

quartz kindle
#

thats pretty much what the whole xz attack tried to do

spark flint
#

i dont think it actually affected anyone iirc?

#

cuz of smth stupid like bad code which errored

surreal sage
spark flint
#

smh

#

look at the logo

radiant kraken
spark flint
#

fr

surreal sage
#

nvm it sets to local storage

#

mb

radiant kraken
# spark flint fr

Reawct is the librawry fowr web awnd nawtive uwuser interfawces. Buwuild uwuser interfawces owuwut owf individuwuawl pieces cawlled cowmpownents written in JawvawScript. Reawct is designed tow let yowuwu seawmlessly cowmbine cowmpownents written by independent peowple, teawms, awnd owrgawnizawtiowns.

quartz kindle
#

it failed only because it was detected unexpectedly early by accident

#

in its current state, it would only affect very specific builds and distros, presumably for testing

#

but since it piggybacked on a library that builds for a shit ton of distros, it could easily spread to other builds later on

surreal sage
radiant kraken
#

time to make a linux malware that installs windows

surreal sage
#

my autism doesnt like that there arent any new lines here

#

and unnecessary curly brackets...

spark flint
#

i add new lines all the time

surreal sage
#

code that belongs together together, seperate else

radiant kraken
surreal sage
#

i mean like

#
for (let i = 0; i < 10; i++)
    if (something)
        console.log("stuff")```
radiant kraken
#

C doesn't really like it if you do that

#

sometimes it throws a compile error

surreal sage
#

js just better

radiant kraken
#

frfr C is js but better

#

oh wait i read that wrong

surreal sage
#

js is good for what it can

surreal sage
#

ip grab

spark flint
#

tbf mongodb index was fast af

#

this is 890 million records and like 15% of a 1.5tb ssd

quartz kindle
#

hue

radiant kraken
#

typescript is actually pretty good

#

and ESM node.js

surreal sage
#

esm everything

#

commonjs outdated now

radiant kraken
#

also

#

where is C

#

smh

surreal sage
#

i love the letter c

#

its the 3rd in the alphabet

#

so close to the 1st

#

so cool

quartz kindle
#

what about nim, julia, crystal, zig, D

silver jackal
#

so guys my bot is hosted on vps and uses a sql file to store databases

radiant kraken
#

what about c#

#

its really good

#

its literally java

#

😭

#

yeah because it loves u

quartz kindle
silver jackal
#

because what if alot people use a command tha changes their user varianle

surreal sage
silver jackal
#

variable like adds money to their account

#

it also has transcation

surreal sage
#

and random ips tryna find vulnerabilities

quartz kindle
#

by sql file i assume you mean you're using SQLite

#

sqlite is a very powerful database, it can easily handle thousands of operations per second, as long as its configured correctly

quartz kindle
radiant kraken
#

so which is better

sharp geyser
#

Okay but that’s like impossible to compare

radiant kraken
#

@sharp geyser good morning!!

sharp geyser
#

At that point it comes down to your use case

#

SQLite is a disk oriented database, whereas Postgres is a cloud database which requires a server running

radiant kraken
#

ah i see

surreal sage
#

postgres for scalability

sharp geyser
#

Sqlite is limited to read/write speeds of the disk and Postgres has no such limits other than tls connection limits

surreal sage
#

sqlite for anything else

quartz kindle
sharp geyser
#

Not to mention because of how SQLite is, the data types it supports is also rather limited where it only supports the basics

radiant kraken
#

does postgres store data in the cloud the same way as mongodb?

sharp geyser
#

Like you won’t get any relational tables from it, which to most is fine but it is also annoying for anything large scale where you want to be able to tie data to each other

surreal sage
#

mongo can be selfhosted

sharp geyser
#

So can Postgres?

surreal sage
#

p sure

quartz kindle
#

i mean, "cloud" is not really the correct term, as you will most likely run pgsql yourself in some vps

#

not hire a managed service

surreal sage
#

cloud is by a 3rd party like mongo atlas

#

yes

sharp geyser
#

I mean it’s still in the cloud

#

Just in a private vps

quartz kindle
#

so is sqlite by that logic

#

:^)

surreal sage
sharp geyser
#

Astrid you have no opinion once you stated you were going to use redis as a database

surreal sage
#

i was asking abt it

#

havent even used it

#

ever

lyric mountain
radiant kraken
#

redis is literally just const database = {}

lyric mountain
#

I mean, that's the whole point of sql

sharp geyser
#

SQLite is limited in that regard

lyric mountain
#

what's the diff?

surreal sage
#

need me a kv http db that is not couchdb

sharp geyser
#

Pretty sure SQLite doesn’t support join statements

lyric mountain
#

it does

quartz kindle
sharp geyser
#

Oh does it?

#

Cool

lyric mountain
#

yes, that's the point of sql

quartz kindle
#

sqlite supports 99% of the sql language

#

with minor differences

sharp geyser
#

Then I was wrong :^)

#

Either way, SQLite is still limiting on scale

#

So anything big I would never use it for

radiant kraken
quartz kindle
#

according to the better-sqlite3 author, there are 3 cases where using sqlite is not recommeended:

If you expect a high volume of concurrent reads each returning many megabytes of data (i.e., videos)
If you expect a high volume of concurrent writes (i.e., a social media site)
If your database's size is near the terabyte range

lyric mountain
#

on the opposite side, if your database size is near a terabyte, you need to rethink whether you really need to store all that data

quartz kindle
#

likely

sharp geyser
#

unless you just serve that many users

surreal sage
#

If your database's size is near the terabyte range
scaling on raid required right there

quartz kindle
#

SQLite3 is very very fast. With proper indexing, we've been able to achieve upward of 2000 queries per second with 5-way-joins in a 60 GB database, where each query was handling 5–50 kilobytes of real data.

lyric mountain
#

the only thing I miss on sqlite is that you cant make functions

quartz kindle
#

our*sql

lyric mountain
#

it has to be implemented through external means

deft wolf
#

Our

lyric mountain
quartz kindle
#

better-sqlite3 does

lyric mountain
#

yes, I mean raw sqlite

quartz kindle
#

ye

sharp geyser
#

I love Cassandra

lyric mountain
#

cassandra classic

sharp geyser
#

Never met her before but she sounds nice

quartz kindle
#

sqlite+lmdb > pgsql+redis

#

:^)

sharp geyser
#

Disagree

#

Your opinion invalid cause I say so

lyric mountain
#

pgsql + caffeine = s p e e d

sharp geyser
#

Honestly

#

What’s the point of Cassandra

#

I know discord swapped to it

lyric mountain
#

to send raids to your colony /j

sharp geyser
#

Well I figured that much

#

But how is it different from the other dbs

#

Everything is better than mongodb

silver jackal
#

like if 5 people do /work command in one second

lyric mountain
#

that's the expected speed if you do worry about it

#

but yes, 5 people is nothing

#

even with the worst possible database setup it'd still be far from the bottleneck

silver jackal
#

Oh so i don't have to worry because i don't think i will ever get 5 people at one time

#

bruh why did two people said nah bro is using sql file for databases

#

in different server

#

When its good

lyric mountain
#

well, it's all relative

silver jackal
#

also i use vps

#

One of the great

lyric mountain
#

sqlite is good but if you have too many writes per second you might start noticing performance issues

quartz kindle
#

as long as its correctly indexed

#

and WAL mode is enabled

#

also helps to disable sync

silver jackal
#

I have some transcation

#

What is it

#

Like i open it and its a random string code

#

in it

quartz kindle
#

what is?

silver jackal
#

ye i found it in database folder

#

its called transcation

#

It says its used for sql

quartz kindle
#

dont you mean transaction?

silver jackal
quartz kindle
#

transcation lol

lyric mountain
#

did you clone some project?

silver jackal
#

No

#

Its my project

#

i don't clone trash bots

lyric mountain
#

why is there a file you dont know about then?

quartz kindle
#

transactions are used to batch queries together

silver jackal
#

i got it with sql

radiant kraken
silver jackal
#

i also have 3 more folders

#

in databases

sharp geyser
quartz kindle
#

which library are you using for sqlite?

sharp geyser
#

Cassandra is a database

silver jackal
#

aoi.js

radiant kraken
#

never knew libraries can have pronouns

quartz kindle
#

does aoi.js have sqlite bundled with it?

silver jackal
sharp geyser
#

It has a database wrapper

silver jackal
#

it comes with more stuff

sharp geyser
#

Let’s you connect to various dbs

silver jackal
#

that i don't know about

sharp geyser
#

SQLite being one of em

silver jackal
#

Oh

#

idk i want to make something i always dreamed

#

bot where you get a living creature for your population

#

idk how to explain it

lyric mountain
#

a tamagotchi

silver jackal
#

like usa population live count

#

but instead its a bot and you race to be first on leaderboard

radiant kraken
silver jackal
#

i will stick with sql for now

#

i think it will work

#

also my bot in 2 servers

#

💀

quartz kindle
#

im looking at the aoi.js repos and cant find any reference to sqlite or dependencies to sqlite libs

silver jackal
#

you get when download

#

npm i aoi.js

quartz kindle
#

yes i am looking at aoi.js package.json

#

and there is no dependencies for sqlite

silver jackal
#

What

#

But how do i have it connected with aoi.js?

lyric mountain
#

aoi has wrappers no? not necessarily the database implementation itself

#

open your package.json and search for anything containing sqlite

sharp geyser
#

It uses another lib

quartz kindle
#

no sqlite there

sharp geyser
#

hm

#

Idk then

vivid fulcrum
#

did anyone here dip their toes into 3D game development? it's been peaking my interest for a while, but I find it too intimidating to even begin. I've fiddled around with UE for a short period, it seems like a powerful engine but I generally always end up being lost in whatever I'm doing. visual scripting seems nice but I'm aiming to write actual code so I can have fine grain control

I'm looking for engine suggestions for a first timer, heard about godot. if anyone has personal experience with game dev, I'm all ears

silver jackal
#

idk its called .sql file

sharp geyser
#

All I know is it allows you to connect to various dbs from my research

lyric mountain
#

I really dont recommend UE as a starting engine, it's powerful and fancy yes, but REALLY hard to get the hang of

silver jackal
#

so like aoi.js

lyric mountain
#

also it's heavy af

vivid fulcrum
sharp geyser
vivid fulcrum
#

or you can use their scripting api with c++ files.
didn't know that, so you can mix&match cpp and blueprints?

sharp geyser
#

Unreal is a "industry" grade engine as some would call it. Unity is also popular but it’s in hot water right now unless they’ve fixed their problems

lyric mountain
#

I recommend trying godot as a start, it supports gdscript (python-like), c# and c++ so you can raise the ceiling if you prefer lower levels

#

and the engine is a few hundred mbs

sharp geyser
surreal sage
wheat mesa
#

Godot is awesome for beginners. Unreal is very difficult to get the hang of, not to mention it’s very big in size

silver jackal
#

i didn't even know aoi.js would work perfectly with vps just like @timber hatch told me

wheat mesa
#

Godot is a few hundred mb and opens super quick. Runs on basically anything

sharp geyser
#

I only recommend unreal if you’re serious about game dev tho

#

Otherwise don’t bother

silver jackal
surreal sage
sharp geyser
#

Astrid we are trying to give good advice

lyric mountain
sharp geyser
#

Shut up

surreal sage
wheat mesa
#

Honestly if you want to make your own game and it’s not something you want to get out quickly, make your own engine for it

#

It’s not that hard and you just add things as you go

sharp geyser
#

Depending on the game sure

wheat mesa
#

Teaches you a lot

vivid fulcrum
sharp geyser
#

Imagine implementing multiplayer

surreal sage
#

real

wheat mesa
#

Multiplayer really isn’t super complex

silver jackal
silver jackal
#

you need whole team bruh...

sharp geyser
surreal sage
#

3d in 2d game = gd

wheat mesa
#

I mean the idea is your client sends info to the server, the server sends info to another client

sharp geyser
#

Idk how it’s 3D space is but it’s 2D is definitely well developed

silver jackal
wheat mesa
#

Or if you don’t really care about cheating you can do peer to peer

silver jackal
surreal sage
#

said by a gd player

sharp geyser
#

I’d still let a professional engine handle multiplayer for me

lyric mountain
silver jackal
#

i don't play it i just check what cool levels community made @surreal sage

surreal sage
#

discord added a reply feature u can use btw :3

lyric mountain
#

I often saw people on gamedev subreddit who started on UE just because big games are made on it

sharp geyser
#

I’d definitely check out unreal at least once in your game dev career once you get used to game development though

lyric mountain
#

then a few weeks later they gave up because UE doesn't care for your feelings

sharp geyser
#

Its combination of blueprints and c++ is powerful

#

Some games even use exclusively blueprints

lyric mountain
#

starting with a simpler engine does help building skills till u reach the more complex engines

wheat mesa
#

I learned a ton from making my own mini engine, 10/10 would recommend if you have the time

surreal sage
#

in js with canvas 🗿

sharp geyser
#

Im still waiting on WaffleEngine v2

#

I want to make a game

lyric mountain
#

also gamedev will require skills in 4 different areas, the lower stress will help developing them

#

that is, coding, 3d modelling, audio and image editing

sharp geyser
#

Other than coding they are the bane of my existence when I was doing game dev

vivid fulcrum
lyric mountain
#

image part is becoming pretty good with introduction of stable diffusion

#

and modelling is also becoming easier for coders because blender's geometric nodes

sharp geyser
lyric mountain
sharp geyser
#

I assumed you already had game dev experience (because you picked UE)

lyric mountain
#

I forgot storytelling

sharp geyser
#

So I recommended UE

#

But if you have none go for a lower risk engine like godot

#

It’s more user friendly

vivid fulcrum
sharp geyser
#

As for the reasons we’ll haku and waffle already end preached that part

sharp geyser
#

It’s learning curve is STEEP because of what it offers

vivid fulcrum
#

godot it is for now, I hope I'll check back in here every once and a while to show off my monstrosities

lyric mountain
#

only thing about godot, I do recommend using an external editor

#

for code, that is

#

their own editor is a bit too basic

vivid fulcrum
#

yeah I use rider for everything c# related anyway, I sold my soul to jetbrains

lyric mountain
#

rider does have official integration to it

#

and I mean like, truly direct integration

#

you just need to disable the built-in editor and set rider as external tool and ur good to go

eternal osprey
#

hey guys how can i portect against bruteforce attacks?

#

this is the only thing i haven't implemented yet.

lyric mountain
#

for the site?

eternal osprey
#

yuhh

lyric mountain
#

ratelimits or captcha

#

it's hard to bruteforce when you can only do it 5 times per min

wheat mesa
#

(Server side ratelimits, client side can always be bypassed)

lyric mountain
#

also enforce strong passwords

sharp geyser
#

require them to use hashes as passwords

#

😎

sharp geyser
#

:D

tawny lava
#

wait u might've just solved security

sharp geyser
#

I know I’m a genius

spark flint
#

db still indexxing 2 hours later

sharp geyser
spark flint
sharp geyser
#

Oh

spark flint
#

i mean indexxing 890 million records will take time understandably

sharp geyser
#

You’re db is still indexing

spark flint
#

yes

sharp geyser
#

I thought you meant my hash hash hash hash db

lyric mountain
#

you better leave that overnight

sharp geyser
#

Well you’re not wrong

#

Gin will make you want to sleep

spark flint
#

😭

lyric mountain
#

btw, shouldn't u be using the trigram thing?

spark flint
#

idk 😭

#

i dont use postgres enough

#

i am a mongo person

#

but i was persuaded to use postgres for this

sharp geyser
#

Also what’s the proper steps to setting up a vps to be secure

sharp geyser
spark flint
#

ssh key auth, maybe IP whitelisting?

spark flint
sharp geyser
#

bun uses mongo

spark flint
#

yes

#

for years

lyric mountain
#

CREATE INDEX index_on_domain ON data USING GIN (domain gin_trgm_ops)

#

which is what tim mentioned earlier

sharp geyser
#

What da heck is gin and create index

spark flint
#

ERROR: operator class "gin_trgm_ops" does not exist for access method "gin"

sharp geyser
#

I’ve used pg for years but never ran into it

lyric mountain
spark flint
#

ah

lyric mountain
#

CREATE EXTENSION pg_trgm

sharp geyser
#

Invalid syntax

#

Missing ;

spark flint
#

smh

spark flint
#

cancelled old index

sharp geyser
#

I’m too lazy rn

lyric mountain
#

tldr, they're to make text indexing faster

sharp geyser
#

I’m still getting over the feeling of being sick

spark flint
#

ok making this index insdead KEKW

#

instead*

lyric mountain
#

if your data changes too much, or too many new rows are inserted all the time you might want to make a materialized view instead

#

or use gist, which is faster for updating indexes

sharp geyser
lyric mountain
#

materialized views are like a snapshot of whatever query u put inside

#

you can add indexes to them

#

but it requires refreshing to retrieve new changes

sharp geyser
#

hm, is there an easy way to manage all this?

#

@spark flint referring to you mention ssh keys and ip whitelisting

#

for some reason it didn't reply to your message

spark flint
#

i use termius for ssh if it involves keys

#

since you can set and generate ssh keys per host

sharp geyser
#

If the development team ever grows i'd like to be able to easily add or remove users to allow them to connect

spark flint
#

for IP whitelisting, only do this if you have a static IP or a VPN to connect

sharp geyser
#

but it's a process to add their pub key each time

spark flint
#

its not that hard iirc

sharp geyser
#

It'd require someone already connected to the vps

#

Which means they'd already need to be both sudo perms and have their ssh key on the server

#

As password auth will be disabled same with root login

#

It can record ssh sessions, so anything you do during that session gets recorded

#

Though this seems overkill KEKW

#

Cool project tho

green kestrel
#

syslog can do this

lyric mountain
#

up-key, up-key, up-key, up-key, up-key, up-key, up-key, up-key

#

who needs a log

frosty gale
#

log4j

sharp geyser
#

Which is meh tbh cause it’s not like it’s important for any small scale servers

#

But if you’re running a server that allows multiple people to connect to then I guess it’s a viable solution

#

Idk what it does entirely as I’ve only just learned about it a few days ago but it does a lot more than just recording sessions

spark flint
#

still indexxing KEKW

green kestrel
#

currently going into a deep dive of i18n

#

trying to make it nice as possible to maintain

#

so, i can define a command like this and just wrap it in the _() function

#
dpp::slashcommand bio_command::register_command(dpp::cluster& bot) {
    return _(dpp::slashcommand("bio", "Update player biography", bot.me.id)
        .set_dm_permission(true)
                .add_option(
            dpp::command_option(dpp::co_sub_command, "picture", "Set a custom profile picture")
            .add_option(dpp::command_option(dpp::co_attachment, "image", "Image to upload", true))
        )
                .add_option(
            dpp::command_option(dpp::co_sub_command, "text", "Set custom biography")
            .add_option(dpp::command_option(dpp::co_string, "biography", "Biography to set", true))
        )
    );
}
#

then, define my strings in my lang.json:

#
  "CMD_NAME_BIO": {
    "en": "bio"
  },
  "CMD_DESC_BIO": {
    "en": "Update player biography"
  },
  "CMD_OPT_NAME_BIO_PICTURE": {
    "en": "Set a custom profile picture"
  },
  "CMD_OPT_NAME_BIO_IMAGE": {
    "en": "Image to upload"
  },
  "CMD_OPT_NAME_BIO_TEXT": {
    "en": "Set custom biography"
  },
  "CMD_OPT_NAME_BIO_BIOGRAPHY": {
    "en": "Biography to set"
  }
#

if it works first time, i'll be shocked kekeke

green kestrel
#

i found a nicer way to do it 🙂

warm imp
#

I am in visual studio but when I get in it just says that my MODULE_NOT_FOUND. This is because my Visual Studio Code isn't finding my Node.js files. How do I change it in VSC so it can find it so i can start building my bot. It would mean alot if someone could help me.

#

I looked on Google for over 2 hours so I thought I would come here because most of you own bots

quartz kindle
quartz kindle
#

npm install

warm imp
#

In the node.js command?

quartz kindle
#

in the vsc terminal

warm imp
#

I can't

#

I can't use any of those commands in VSC

quartz kindle
#

why not

warm imp
#

Just says that message

quartz kindle
#

show the full error

warm imp
#

Ok

warm imp
warm imp
#

But Not on my PC

sharp geyser
#

it can't find app.js

warm surge
quartz kindle
#

you said you cant run npm commands but you can

warm surge
#

Sometimes it doesn’t autosave

quartz kindle
#

instead of node app.js you first run npm init

warm imp
#

And it says that thing

quartz kindle
#

what thing

warm surge
quartz kindle
#

in your picture you dont have a package.json

#

package.json is created by running npm init

warm imp
#

If so I can't

quartz kindle
#

in the same place you typed node app.js

warm imp
#

Everything with the word npm doesn't work

quartz kindle
#

why not

warm imp
quartz kindle
#

show what happens

warm imp
#

Says that

#

I have done

quartz kindle
#

show full error please

warm imp
#

Npm install

#

Npm -v

sharp geyser
#

Just show the full error

warm imp
#

But that is the full error

sharp geyser
#

then ask for help when you are

#

and no thats not the full error

#

that's part of the error

warm imp
#

Above that is just me typing Npm init -y

sharp geyser
#

We need to see the full stacktrace

#

doubtful

#

i've never seen npm init -y telling you module not found

warm imp
#

Wdym

sharp geyser
quartz kindle
#

thats what we need to see

warm imp
sharp geyser
#

tim correct m eif I am wrong, but npm init literally cant respond with that kind of error no?

quartz kindle
#

it can if the installation is borked

#

happened to me before

sharp geyser
#

ah

quartz kindle
#

usually reinstalling node fixes it

sharp geyser
#

ig i've never installed node incorrectly

#

or seen anyone who has

#

since its literally simple asf

warm imp
#

Just went on website and click download

#

And didn't work

sharp geyser
#

well ig if that error does happen when node is installed incorrectly ig try reinstalling node is a good first step, unless tim still wants to see the full error

quartz kindle
#

literally cannot help if dude is not at the pc to run the necessary tests

warm imp
sharp geyser
#

true enough

#

Sir, please request for more help once you are at your pc, there is nothing we can do for you otherwise :)

warm imp
#

Tim can I ping you tommorow

sharp geyser
#

you can just ask here

#

anyone who is available to help will help

frosty gale
#

what if no ones available

frosty gale
#

for my chat app im thinking of breaking a few normalisation rules and im not sure if its a good idea

#

so a message can of course have multiple images