#development
1 messages · Page 56 of 1
Hey guys, i recently update my Visual studio code to the last version and now i'm getting this error
Type instantiation is excessively deep and possibly infinite.
I change nothing about my npm
export class Players extends Model<InferAttributes<Players>, InferCreationAttributes<Players>> {}
________________________
That warning/error is thrown by TypeScript, your types are too complex to compute either due to a bug in your types causing infinite recursion, or simply overnested typings
It could also be that you're using recursive types incorrectly
yep i investigate and i saw that, i'm currently using Vscode with this extension and they just push @types/node to the version 18.8.4 which made this error.
( https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-next)
Honestly i don't know i just use the documentation of sequelize
That's probably the reason, you shouldn't use nightly extensions
what do you mean
The TypeScript-Next extension you just linked for VSCode is nightly, meaning that any new changes pushed to TypeScript will be available as a new release in VSCode, it probably contains this bug that causes that warning/error to be incorrectly shown
ahhh
Yep obviously but which extension i should use to see typing error?
type typo idk how write that
You don't need any extensions, VSCode deeply supports both JavaScript and TypeScript by default because it's literally written in it
Alright, Thanks you for your time bro ! Also maybe you have some guide or tutorial to learn typescript in a deeper way? Because i'know the basis of typescript but not really more
The official TypeScript handbook is a good source for that
https://www.typescriptlang.org/docs/handbook/intro.html
Your first step to learn TypeScript
It goes from the basics to the deeper concepts of it
OKAY i want to format a list of new line strings into a full array
actually they arent strings they are just words
aha i found smth for that now i just need to figure out how to use really long arrays with autocomplete
<string>.split("\n")?
figured that one out lmao
i wanna store an array in a different file for cleanliness but im not sure how to pull that off
wdym?
i mean i have a massive array that i need to use for autocomplete
and i dont want to have it with my events cause of that reason
its a single line array
u could use a dictionary file
I have something like that for my shiritori game
tho mine is encoded in a way I can simply jump to relevant words instead of checking each line
ok heres what i did
all u need is to have a file with one word per line, then simply stream the file
i have a cars.js file
with a defined array
carsArray=[
"smth",
"smth2",
]
etc etc
arrays (or any collection datatype) are pretty bad if u have many entries
since ur keeping it all in memory
125 is nothing
okay so how would i use this? ive never had a designated file for an array
why not json?
why does that prevent using json?
json is literally made for that, containing fixed data that is loaded on startup
const something = require("../jsonfile.json")
and how would the json be formatted
ah fuck i have to store a large amount of info for each of these entries
actually
i can do that somehow
i have no idea how
then yeah, a json file is the way to go
basically its for a bot for a game that has cars that has a bunch of different builds
a minimum of 4 builds
Do yall do packs for grand mafia?
do what?
What's the formal answer/reply that I can reply to: What is a programming language?.
a way to allow a human to tell a computer what to do, but in a way that can still be understood by humans too
A tool for solving computational problems, complex or simple
what is programming, wrong answers only
fixing printers
a way to suffer in pain and agony
turning it on and off again
mood
god I fucking hate lvalue rvalue stuff
Getting In template: non-const lvalue reference to type 'Vec2<...>' cannot bind to a temporary of type 'Vec2<...>' with cpp auto radius = (firstTrans.position - secondTrans.position).length(); // position is a Vec2<double> in both and ```cpp
template <class T>
class Vec2 {
public:
T x, y;
Vec2() : x(0), y(0) {}
Vec2(T x, T y) : x(x), y(y) {}
Vec2(const Vec2& v) : x(v.x), y(v.y) {}
Vec2& operator-(const Vec2& v) {
return Vec2(x - v.x, y - v.y);
}
// Etc, other operators giving similar issues when I attempt to use them
}
I appreciate any advice anyone can give me here, I just want to be able to do vector math easily
That would do it
C++ errors be like
Hi I want to create a leveling system private bot, but I have a problem here...
well I am using mongoDB as my data base and for level system I have to update each member data set with each message
so this way the bot will become to slow because it have to update data base all the time what should I do?
caching
keep a memory based collection of your data, occasionally push onto your database
I generally recommend against having your bot directly access your database and instead have it push onto your database occasionally, like every hour or so
this should also allow quicker handling of when you're rewarding users for their levels
how can i run my html app in background android
then what if bot restart or crash? this way all the data in cache will remove before the data base update
id use a local persistent cache such as lmdb, or even sqlite
but otherwise its possible to listen to kill signals and schedule a function to be run before node exits completely
kill signals work differently on different operating systems tho, so youd have to test every possibility to make sure
i highly recomment lmdb tho, its mostly in-memory but has disk persistance and supports multiprocessing
just a note, do not underestimate how fast databases are
a million operations per second might seem too much, but for databases it's child's play
see https://discord.com/blog/how-discord-supercharges-network-disks-for-extreme-low-latency and https://discord.com/blog/how-discord-stores-billions-of-messages
It's no secret that Discord's your place to talk; 4 billion messages sent a day have us convinced. But text only accounts for a chunk of the features that Discord supports — learn how Discord optimizes its platform to respond to the high frequency of queries for all types of content and data as quickly as possible.
so update the data base with each message of members? (there will be a cooldown for each message ig set it to 30seconds or maybe 15)
if your mongodb local or remote?
amm what do you mean from local or remote? 😅
I host my bot on my Windows VPS and connect to the data base with mongoose
and where is the database?
did you install the database on you windows vps and connect via localhost?
nope
mongodb atlas?
yes
then its a remote database
so
so i wouldnt update it on every single message
besides the database performance, you also have to deal with network congestion and whatever rate limits atlas gives you
if you're using their free plan its probably heavily limited
well u suggest to change the data base or do something else instead of update for each message
yes ^.^
BTW its for private bot for 1 server
sus
well, if its not a giant server with 50 messages per second then you should be fine
amm 5K members and 10-15K messages (user and bots) in a day
you shouldn't be reading messages from bots
I know I just told how many messages sent in the server but I will ignore them in events
what is this err for?
one of your dependencies uses the package uuid
ig canvas use it
and its warning you that uuid version 3.4 is not recommended
Tim I have a problem I use pm2 to run my bots I remove one of them from pm2 but it still run in the background what should I do? how can I turn it off?
well I dont know which one is my bot thats the problem
oh okay
ok so I have this Code:
const rankCard = new canvas.Rank()
.setAvatar(userobj.displayAvatarURL({
format: 'png'
}))
.setCurrentXP(parseInt(arraylevel[1])*10)
.setRequiredXP(1000)
.setProgressBar('#90CDF4', 'COLOR')
.setUsername(userobj.username)
.setDiscriminator(userobj.discriminator)
// .setBackground('COLOR', '#1D192B')
.setProgressBarTrack('#413E4D')
.setLevel(parseInt(arraylevel[0]), 'LEVEL ', true)
.setRank(parseInt(counts[0]/5), totalxp, true)```
It creates a rank card. But when I send it there is a background, can I make it 100% transparent?
let me introduce you to a little friend called loops
yeah i know i've done that
i have a stubborn issue here
Do you know game of life?
Invented by John von neuman
Are you using Canvacord?
yes
try using setBackground with alpha
for example a hex code with 8 digits instead of 6 digits is an RGBA hexcode and has an alpha channel, where the last 2 digits represent transparency from 0 to 255
for example #aabbcc00 would be fully transparent, event tho it has red green blue values because the last one, the transparency value, is 0
It's RGBA most of the time
thanks
bool read_universe_file(string filename, Cell universe[NO_OF_ROWS][NO_OF_COLUMNS])
{
char z;
ifstream input;
input.open(filename);
if (input.fail())
{
cout << "Error cannot open " << filename << endl;
return false;
}
for (int k = 0; k < NO_OF_ROWS; k++)
{
for (int n = 0; n < NO_OF_COLUMNS; n++)
{
z = input.get();
if(z == LIVE){
universe[k][n] = Live;
}
if(z == DEAD){
universe[k][n] = Dead;
}
cout << universe[k][n];
}
}
input.close();
return true;
}```why the fuck is my array showing this:
Is it maybe due to the spaces in the file?
those are newlines not spaces
\n right?
however js if(z == LIVE){ universe[k][n] = Live; } if(z == DEAD){ universe[k][n] = Dead; } would only write if the character is of enum type Dead or Live
so that means that it wouldn't even write those to the multi dimensional array am i right?
LIVE is '*' dead is '. '
yes i am just logging the array each type to reveal the written data
what is Live and Dead?
Enum values. Dead is 0 and live 1
I don't see any error then
damn that's really strange wtf
huh
when u access an uninitialized array index you gotta expect junk
but i am already renewing the array using k and n that are being increased right?
no you're not
huh
in red ur defining the indexes, but you're printing regardless in blue
i am looping the universe array that is 2d. I am incrementing the k and then the n right?
and updating the file.
what happens if u print an index that u didn't define? u see junk
yeah i see. But regardless the k, our output is still different.
no it's not
the google test of my school says different
u created a matrix with the same size of the input matrix
but u forgot newline IS a character
so ur not defining anything when u see a newline
i seee
which leaves junk in those indexes
i will try that out
and you CANT simply ignore \r\n
because you'd be disregarding other cases like mac and linux
and files not created using notepad
that's a hack job, not a solution
iterate over the first row, count how many columns aren't newline chars
use that count to create a matrix
How can I make a message send to a channel if it contains a message in py?
huhhh
Get the actual matrix size, excluding non-valid chars basically
If u simply skip newlines you'll still get junk because of wrong matrix size
Retrieve message history
If the message is there, send whatever u want to
No because newlines are different depending on what was used to save the file
And u still need to retrieve the correct matrix size
Also that code is invalid because '' is for char, not string
i honestly have no clue what a matrix is
sorry i am new to c++, just 7 weeks in with my study
You're also not comparing but reassigning the variable in that if statement
owh yeah i know it was a typo
To get what newlines you should use you can use a directive
#ifdef _WIN32
#define NEWLINE "\r\n"
#else
#define NEWLINE '\n'
#endif
owh damn i am not this far with c++ so i have honestly no clue what t do with that
A bidimensional array
a 2d array?
Yes
It's called a matrix
Doesn't this run when the program is compiling though?
i see
or does it not
Directives run during runtime
You can use it like this, going by the code you previously sent
if (z == NEWLINE) n--;
They were already defined btw, the matrix size
defined with NO_OF_ROWS and NO_OF_COLUMNS
Yes, directives are run only at compile time, they're replaced by the preprocessor but they can also use them in this case because they have to compile their program
sharing the executable won't work then tho
Directives are runtime no? My job uses them for linux/windows compat
That said, we use delphi not c++
Directives are run before the code is even compiled, they have their own processor, which basically just replaces the values
how would i exclude the non-valid chars?
Whitelist instead
maybe i should just use a while loop to make it easier?
Since u only use 2 predefined chars
Huh? It should work no matter what because it's compiled either way, unless you mean something else
A while won't fix bad logic
It's the same as for but less appropriate for the job
owh i see
if(z == '\r\n'){
n--;
}
if(z != '\r\n'&& z == LIVE){
universe[k][n] = Live;
}
if(z != '\r\n' && z== DEAD){
universe[k][n] = Dead;
}
cout << universe[k][n];
``` this indeed doesn't work.
Tf
Is \r\n even valid as a single character
Why do check if z != … and z == … in the same statement?
If z is LIVE or DEAD it’s not your line break chars automatically
you see, in c++ (and most langs) '' is for char (as I said before)
char stands for character, as in, a single character
\r\n is two chars (CRLF - carriage return & line feed)
and as fake said, if it's equal to LIVE it'll automatically not be equal to anything else
your logic itself is flawed since if u do n-- you'll get an infinite loop
I’m surprised that it would let you write more than one character in a char literal without screaming at you
I'm also not sure == "string" is a valid operation, if cpp uses a string pool that is
tho == 'c' is valid (char is a number)
if(z == '\n'){
n--;
}
if(z != '\n'&& z == LIVE){
universe[k][n] = Live;
}
if(z != '\n' && z== DEAD){
universe[k][n] = Dead;
}
```
you'll get an infinite loop & wrong results if it has a carriage return
infinite loop for anything else
It’s valid
It’s an overloaded operator, since strings are part of the stdlib and not built into the language
ah ic
Not until you tell the compiler to include all warnings :^)
Although technically multi-character characters are valid as long as they don't exceed the char limit, but can cause unexpected behaviors
Is a char not one byte? I thought one byte was guaranteed, then it may or may not be larger due to padding
They're exactly one byte, that's why I said multi-character characters are valid as long as they don't exceed that one byte range, which \r\n does not
Ah
how
I was assuming it would treat it as concatenating them, not adding them together
i'm sure that corrupts the character
Well yeah
It's basically this
https://www.geeksforgeeks.org/multi-character-literal-in-c-cpp/
characters can be composed into another char, which is what happens with most emojis
that's called surrogate pairs, and a pain to mysql users
Why the fuck is this even a supported thing to do
🇧🇷 for example is a single char, but composed by 2 surrogate pairs (\🇧🇷)
yes but
Just imagining the pain that certain js users would go through
that would still be a string, no?
nope
it's a single char, but 2 chars
confusing yes, but you eventually have to deal with that
you were probably referring to glyphs or something like that
if u treat it as 2 chars u get those 2 inside parens
another example is á
2 chars, but 1 char
that doesnt make any sense
Multi-character characters are not entirely defined by the C/C++ standards and some implementors took the advantage to implement them which are held as pure numbers instead of the complexity of strings, surrogate pairs are also a part of why this was implemented
that thing alone is enough to wreck most mysql bot databases
can i input a string and take the response back with puppeteer
This behavior was taken from the B programming language btw
just put a single emoji in ur name (if they store usernames)
if u are familiar with it
unless they use specifically VARCHAR(191) utf8mb4, it'll crash all queries where ur name is included
pure... numbers?
chars are numbers
strings are arrays of numbers
everything consists of bytes
hello guys
bytes are just numbers
Strings have their own complexity over characters that are just stored as numbers
anyone know how to enable dark mode on snapchat?
like what
the white mode is giving me a headache
🙄
they are literally just a wrapper over characters stored as numbers, so they could be growable
strings aren't growable
they're usually immutable, unless u want to walk through hell
are we talking about char *s or std::strings here
the latter, the former is "u want to walk through hell"
will not work, since you didn't use %c
ah true, printf
you were probably thinking of putchar()
putchar?
yes
ye that works, and doesn't need a (char) cast
Strings cannot be optimized by the compilers, they're set in stone as ASCII values in the register, and used when needed which it has to be fetched from a very far region of the register regions, which can make things slower while characters are just numbers that can be modified in the ways it desires for an optimized execution, and they aren't placed far from the other registers since they're just numbers
Internally strings also hold a considerable amount of differing implementations compared to chars, ranging from growing their size to the concerning case of overheads due to the way they're packed together
Strings aren't just a "wrapper" around chars
Internally they're pretty different
We were mainly talking about C++
so std::strings?
sir uh what are you talking about
Are you confused about the first part or the second part?
so does anyone know
they are just constant numbers
🤨
Internally strings also hold a considerable amount of differing implementations compared to chars, ranging from growing their size
well obviously, you can't grow characters
characters are just a single number
by "their" he meant the string itself
You asked a non #development question in the middle of a #development conversation and expected a response 💀
The few rare times we are on topic
😔👍
To dumb it down for people who are not familiar with codegen and optimization passes
- Strings are packed together in a way that hold a reference to each character, and are placed extremely far away from everything in the Assembly output for example, due to their overhead and differing implementations
- Since characters aren't packed at all and are just their ASCII values, the compiler knows how to optimize it given the context, and are placed right into the registers normally instead of putting them far away from all the regions in the registers
- Strings and characters do hold some similarities in case of their implementation, but most other parts are different due to how they're handled, indexing, comparisons, passes, references, and others
i can change the bkg_value with gameguardian to enable dark mode but it looks bad
i might just edit the whole app with android studio and just change colors ig
Or just stop breaking their ToS and use the app like a normal person
oh i get it now
bae editing stuff again smh
it's unfair only ios has dark mode
my eyes need peace from white mode
but '\r\n' is not the right choice for the issue
ye it isn't
Yeah
it'll most likely result in something that's neither \n nor \r
since comparing them with strings will always fail
nor a linebreak char at all
they're comparing with a char btw
z is a char in the file
I'm pretty sure the guy that was asking the question have gone far away from this channel
chitty will return, he always does
Yes, always
This beginner Java tutorial describes fundamentals of programming in the Java programming language
if so then how do they pack more than 1 byte worth of data e.g '\r\n' to a single character without losing information
Just like Bae
less than 1 byte concatenation
we're talking about C/C++ here
tho java primitives are the same as C/C++'s
how does that work
2 + 2 = 22
then what if they overflow
then u get nuclear gandhi
It’s UB to treat them as not one character, but still technically could work due to padding, right?
wait paddings exist in C/C++?
like, there's a reason the compiler hates when u do that, and most langs throw that entirely as an error
aren't paddings a feature only to dynamic high-level languages
No
They would technically work, but yes it's incorrect to not treat them as a single character, the char type can never exceed a single byte
like how a boolean is always 1 byte
Structs have to be aligned to a 4 byte multiple on 32 bit machines iirc
yes but they are still their original size in memory
So a struct with a char as a field could technically have more than one byte in a char, no?
i wasn't referring to that, i was referring to padding metadata to variables in memory
any data has to be aligned so it's readable
Hello. I am wanting a way to add notify me in discord when someone on a website goes unregistered or is removed from my “clan”. Is this possible?
chars aren't 16-bits, no?
void copy_array(Cell now[NO_OF_ROWS][NO_OF_COLUMNS], Cell universe[NO_OF_ROWS][NO_OF_COLUMNS])
{
for (int i = 0; i < NO_OF_ROWS; i++)
{
for (int j = 0; j < NO_OF_COLUMNS; j++)
{
now[i][j] = universe[i][j];
}
}
// pre-conditions, post-conditions, implementation
}```why am i not able to copy an array like this?
In c++
what do u mean with "notify me"?
like, u can always have an event-based approach
you dont pass arrays as arguments like that
I have seen other discord channels that have a “bot” post in their channel when someone registers or unregistered. I’m just not sure how they done it.
pass a reference/pointer to the first element of both arrays along with the size of both columns and rows
The extra bytes allocated for the struct aren't given/forwarded towards the char field in any way, their sizes are completely different from each other as char will still have it's own size, but since it's inside the struct and you try to get the struct's size, it'll count not only the struct's size, but also all of it's field types' sizes combined, basically:
// Let's consider this struct's size as 4 bytes.
struct Foo {
// This will be a single byte still.
char bar;
};
// They have their own sizes, the character for example will still have the size of a single byte even though the parent struct is 4 bytes
// When you try to get it's size, you're getting the total size
sizeof(Foo); // 5 bytes
because your array size is different to the actual data size
that's why I told u to calculate the real size before attempting to fill it
couldn't i else do: c++ k = universe[i][j] and then: now[i][j] = k;
the actual size is 40 by 60
is the 40 and 60 constant/hardcoded
and the file?
yeah its constant
constant as well
numbers, I want numbers
always 40 height by 60 width
wah
does C++ have a split_newlines function in their string standard library
if I know his teacher well, they can't use std libs
yup
i've already removed the newlines
ran some google tests and my array seems to be equivalent to the precoded one
why
how are you supposed to write a c++ program without ever touching the std library
ur reading each char and adding either 0 or 1 based on whether they're . or *, ok
however
there are characters that don't fit in either, namely newlines
this is your issue
you will touch the std library or at least a third-party library at some point
if u make an array that's 1:1 to the file, you'll get 1-2 columns of junk, because there's where the newline chars would be
seems to be good
40x60 all either dead or alive
so that means that the newlines have been filtered out successfully
At this point their teacher will probably tell them to write their own compiler instead of using an already existing one :^)
Teachers these days are weird
this adventure goes a long way already, just search for chitty messages in this channel
the teacher forces him to write 100 lines where a single std call would suffice
programmers don't work like this, we don't reinvent the wheel for every single task ffs
this is basically the reason most people end college hating java
well, i can't help it either
because stubborn teachers insist on using java 1.1
"existing one like our sponsor, clang which is the best compiler ever made by our legendary LLVM team which also helped other popular programming languages, get your clang discount today at clang.llvm.org/voltrex"
i could've went to college and mainly focus on coding itself, but went to university instead and now we mainly focus on the logic instead of actual programming
Teachers when you force them to write an HTTP client from scratch without touching the standard library (suddenly they want the students to use the standard library)
imagine having to use inline assembly with direct syscalls just to print things on the screen

really, it's no surprise fresh coders see python and think "Wow, this is much simpler than how I did with <language>"
Don't forget to enter code "null is awesome" for a 30% additional discount today!
people after they finished school be like
Also fresh computer science graduates wondering why the things they were thought in the class aren't useful in the real world
when you memorize the entire ascii table codes but can't use it to invert a binary tree
Is math.random() really random
no
depends on what u call "really random"
it's not cryptographically secure random at least
random -> yes
random -> no
Nothing is truly random, until you enter the quantum land
like, any pseudo rng is indistinguishable from an atomic rng from user's pov
the only difference is how hard it is to reproduce the same result chain
@earnest phoenix proposal for Math.random() to turn it to an alias for crypto.randomBytes(1)[0] / 255 when

/dev/urandom
That's not available in the browser so not possible, until you're proposing it for Node.js only
Massive trolling time
implement from scratch
ezpz
Should be very easy! Alright let do that real quick
https://www.imagesco.com/kits/random-number-generator.html if u need a very secure rng
background radiation rng
bro whatdafuk
C++ moment
I could just use the randomness of how often Discord runs into issues, perfect RNG
wrong
what does it mean?


accessing/modifying an invalid memory location
you should stop using ternaries instead of actual if clauses
third time I say this
basically you probably accessed an array out of range
dayum
or indexing with a negative number
Null it's your time to shine to promote the blazingly fast 🔥🚀 and safe 🥶 Rust
No more segfaults! 😤
does anyone know the game of life?
use rust!T!!!$@$!@12 :Rocket: 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 💪🔥💪🔥💪🔥💪🔥💪🔥💪🔥💪🔥💪🔥💪🔥💪🔥💪🔥💪🔥💪🔥
conway
yes
not some random, THE random
John
von Neuman,
its a game made by @earnest phoenix
are u trying to recreate it, perchance?
Although it's interesting how the Linux kernel developers managed to make Rust segfault, although those were fixed recently
well yeah
as you can see this is what they have to do
Not the unsafe keyword!!!?! 😱
I...uhh...why are u reading a file then?
i am almost at the finish line however if i have a dead or live cell i must check these things
the game i must create uses boundaries
#[forbid(unsafe_code)]!!!!!%26152615361253 :Rage:
conway's is dynamically generated from the current game state
you're just making a renderer
the actual simulation logic is much more complex
I have one big issue here tho.
what issue?
hmm is it against the rules to use a in-app api with fetch
I must check if the dead characters have 3 live characters around them, and i must also check if the live characters have > 3 live ones around them, or only dead ones.
However, i cannot do that when i am at the end of the line.
As it will only have 3 contactpoints instead of 8 \0/
example i made a an API just for my site and someone uses it on their own app
Must i create like 6 different if statements for each side?
simply check if the next value is bigger than the boundaries
so lets say i go to your site get your api and use it on my own app
your api isn't public
it depends on the api provider
but how would i check if it has 3 alive around them, or only dead ones?
That would be your fault if they're able to just use it without any authentication
I've got this: ```c++
void check_walls(Cell now[NO_OF_ROWS][NO_OF_COLUMNS], Cell next[NO_OF_ROWS][NO_OF_COLUMNS])
{
int dead_with_live_neighbour = 0;
for (int i = 0; i < NO_OF_ROWS; i++)
{
for (int j = 0; j < NO_OF_COLUMNS; j++)
{
if (i >= 0 && j == 0)
{
dead_with_live_neighbour = static_cast<int>(cell_at(now, i, j++) + cell_at(now, i++, j) + cell_at(now, i++, j++));
if (now[i][j] == Dead)
{
if (dead_with_live_neighbour == 3)
{
next[i][j] = Live;
}
else
{
next[i][j] = Dead;
}
}
else if (now[i][j] == Live)
{
if (dead_with_live_neighbour >= 2)
{
next[i][j] = Live;
}
else
{
next[i][j] = Dead;
}
}
}```
Private APIs should be guarded with authentication
if it's outside of the boundaries it's presumed to be dead
unless u want a wrapping simulation
owh god so the code i wrote above is basically just bullshit
yandev moment
weirrdd
imagine u have a car
you allow other people to use it without a key, or borrow your key to them
if the driver breaks any law, or the car itself, it's your fault
can you give me an example of a site with a locked api
regardless of who was driving it
just curious is it possible to turn a google sheet into a json
it is
youtube
how would i accomplish that
Yeah but still, i still must check the other 8 places around each character, either alive or dead to check whether it will become alive or dead
but i have 4 corners, and 4 borders so i must have 8 if statements?
export it as csv, manually map it into a json
the first row will always be the keys (if u structured it like that)
why do it manually when you can just code a script that does it for you
I mean, the script will do it manually
when I say "manually" I mean through code, not copypasting each cell
sounds like a pain
huh how?
thats automatically
i did this for 8 different cases
4 borders and 4 corners
automatically would be a solution where gsheets itself exports as a json
so u dont have to do anything
owh lmao you guys don't talk to me XD
because ur code is 🤌
ah that's great to hear thanks!
i think i have an idea of how to build this
like, you rely too much on EOP instead of using the proper methods
what's eop
error-oriented programming
owh
you treat errors/exceptions individually by adding if-elses
instead of solving the root cause
export as csv -> read lines to array -> remove first entry (this is where your keys are) -> map with a double loop
i just don't know a way to check these rules without adding if statements
big brain will do
as we have 4 corners and 4 borders, that don't have 8 contact points with their 'neighbours'.
read how conway works
They will only have 5.
you're making a simulator, not a pipe bomb
dude there are thousands of examples of creating conway's game of life
simulators rely heavily on working formulas
if u add if-else everywhere you'll only get more and more side-cases where it fails
that's where yandev failed
the way I'd approach conway's is by first making a matrix wrapper where I could get a cell by supplying x and y directly getCell(x, y), which would have methods to retrieve its neighbors
i've already have that
that way I could use OOP to let the simulation work by itself
cell_at!
but I bet it returns the char, not an object
the part ur missing is that the cells aren't aware of what's around them
they need to be so they can "think" for themselves
The code only needs to run once
conway is an infinite simulation, it should be able to run infinitely
well not in this assignment
do it right regardless
how often it runs should be separated from the main logic anyways
that's irrelevant
Design and implement a function that computes the next configuration of the universe according to the
“Game of Life” rules.
The array now is the current configuration of the universe, the array next contains the next configuration
of the universe. Use cell_at (part 1) to retrieve the correct (neighbor) cell values in now. Test your
implementation by reading a universe configuration file,
computing one transition step, and showing the resulting universe on the console.
there's versions where it runs infinitely, there's versions when a human controls how fast it happens, etc
How did he make the picture like that? * I mean that it called the server image and that the server does not have an image in the first place!
effectiveAvatarUrl, depending on what lib u use
Can you explain more?
no because u didn't say what lib u use
djs why are you angry ?
I'm not angry, u just didn't pass enough info so I asked for it
Ok, What's Next
I am just going to check all 8 neighbours around the current character
dead_with_live_neighbour = static_cast<int>(cell_at(now, i++, j) + cell_at(now, i, j++) +
cell_at(now, i++, j++) + cell_at(now, i, j--) + cell_at(now, i++, j--) + cell_at(now, i--, j) + cell_at(now, i--, j++) + cell_at(now, i--, j--));
```and check whether this is bigger than 3
not in the way u think
imagine i have a character at coordinates i,j
I will have to check all 8 neighbours around it
it modifies the value in the variable
you want to do + 1
2
I don't think you want to increment the number in the variable anyways
both will fuck your loop iterators nonetheless
owh i see
What about
++i++
I'd totally imagine that could exist in cpp
it does indeed (also in any lang where ++ exists)
oh lordy lord
i tried my method out but instead of working it left me: js \1110000000000000000000000000000000000000000000000000000000123220000000000000000000000000000000000000000000000000000000024520000000000000000000000000000000000000000000000000000000012420000000000000000000000000000000000000000000000000000000002110000000000000000000000000000000000000000000000000000000000100000000000000000100000000000000000000000000000000000000
looks legit
i am going to de-register from this course
like tf i am getting fucked in all possible ways
does that increase, get and increase?
or what kind of witchcraft is that
.then(res => Promise.all([res.status, res.json()]))
uhh how do i catch an error if res.json doesn't exist without crashing the entire application
I guess yeah
Doesn't even exist sadly
I'd see so many use cases for it 
Yes. I created the game of life
And added a shot ton of randomness
Life the Game?
The game where the most infamous sentence is from? "God damn it Alan!"
?
try (++i)++;
WONDERFUL
@rustic nova we are saved
int main()
{
int i = 0;
cout << (++i)++;
cout << "-";
cout << i;
return 0;
}
1-2
nah I do java
I'll call it life saver operator
java doesn't like it
js doesn't like it either
aaand keep it coming
not both at the same time
Invalid left-hand side expression in postfix operation
how the fuck is my glider upside down
updraft
dead_with_live_neighbour = static_cast<int>(cell_at(now, ++i, j) + cell_at(now, i, ++j) +
cell_at(now, ++i, ++j) + cell_at(now, i, --j) + cell_at(now, ++i, --j) + cell_at(now, --i, j) + cell_at(now, --i, ++j) + cell_at(now, --i, --j));
if(dead_with_live_neighbour > 3){
next[i][j] = Dead;
}else if (dead_with_live_neighbour == 2 || dead_with_live_neighbour == 3){
next[i][j] = Live;
}else if(dead_with_live_neighbour < 2){
next[i][j] = Dead;
}
```this is my current code
i honestly ain't sure if this is any good
yoikes
ur still using ++j
i am checking all 8 possible solutions around each character, and that returns either 0 or 1 using the cell_at.
didn't we tell u not to
i don't know how to do it otherwise
I mean i have a for loop that increments already
j + 1
but that won't chekc any other places around them
never assume anything when it comes to programming
because ur not checking if j + 1 exists at all
owhhh
i must of course check no_of_rows-1
how would i else check for the neighbouring characters?
As this method is not going to work
I'd make a wrapper that's boundary-aware
simply make a function that checks if the coordinate would be outside the boundaries
if it's inside, retrieve the value at position
is i !== false = !!i?
no
what is tho
i == true
note ==
I've already done that?
you didn't
Cell cell_at(Cell universe[NO_OF_ROWS][NO_OF_COLUMNS], int row, int column)
{
// pre-conditions, post-conditions, implementation
return (universe[row][column] < 0 || universe[row][column] > 1) ? Dead : universe[row][column];
}
this checks if it's out of bound and then returns either dead or alive
that's not checking for out-of-boundaries case
this is not js buddy
you cannot simply access an invalid array index and expect a value
TEST(part1, cell_at)
{
Cell universe[NO_OF_ROWS][NO_OF_COLUMNS] = {
{Live, Dead},
{Dead, Live},
};
EXPECT_EQ(cell_at(universe, 0, 0), Live);
EXPECT_EQ(cell_at(universe, 0, 1), Dead);
EXPECT_EQ(cell_at(universe, 1, 0), Dead);
EXPECT_EQ(cell_at(universe, 1, 1), Live);
EXPECT_EQ(cell_at(universe, -1, -1), Dead);
EXPECT_EQ(cell_at(universe, 0, NO_OF_COLUMNS + 10), Dead);
EXPECT_EQ(cell_at(universe, -5, 0), Dead);
EXPECT_EQ(cell_at(universe, NO_OF_ROWS, 0), Dead);
EXPECT_EQ(cell_at(universe, NO_OF_ROWS + 4, NO_OF_COLUMNS + 8), Dead);
}
```i've ran these tests and they came out good.
well, your current code says otherwise
that's strange
Cell cell_at(Cell universe[NO_OF_ROWS][NO_OF_COLUMNS], int row, int column)
{
// pre-conditions, post-conditions, implementation
return (row > NO_OF_ROWS ||column > NO_OF_COLUMNS || universe[row][column] < 0 || universe[row][column] > 1) ? Dead : universe[row][column];
} ```I Modififed it a bit
now it should also check for boundaries
why are u initializing an array in the function parameters?
cout << cell_at(now,554,6); yup this returned 0
i got the function like this
i am not allowed to change it
as the boundary function is set, how would i now proceed to check if a char should be dead or alive
does anyone know what to do?
throw it in the garbage
nah fam my deadline is in exactly 1 hour
i am fucked
this is literally the last part but i just dont understand how to fucking check the next cycle
he's trying to recreate conway's game of life
this is my output
identical to what it should be
my google test is still displaying that its false
wtf
yeah i cropped it
i put it in an online counter and the chars are the same
how would i check both arrays?
like in a console.log() js way?
dayuuum 7 minutes left
is it because of whitespaces or anything
complain to the exam board or whatever
Dear teacher
Please fuckin let me use the remaining 99% of c++ when solving homeworks
Kthxbye
To be fair a lot of teachers only have those specifications because they want you to understand the algorithm/logic behind the problem, not just how to use a stdlib function that does it for you
that's fair, but I meant the language features themselves
usually the constraints he brings don't even allow value-returning functions
Yeah that's pretty dumb
also someone rate my code https://github.com/Jwaffled/PhysicsSim thankies
a solid 5/7
it works
it displays exactly the same fucking output
but my test fucking fails
howww
look att his shit. My fucking output is exactly the same as the one under it
could anyone please help me
is there not a way to display my array like this
use linebreak
huh?
breakpoints?
If i use that it only displays that my array has 1 row instead of 40
void check_walls(Cell now[NO_OF_ROWS][NO_OF_COLUMNS], Cell next[NO_OF_ROWS][NO_OF_COLUMNS])
{
//precondition
assert(true);
//result is a new 2d array based on the older array and how much neighbours each character has.
int neighbour_live_cell = 0;
for (int d = 0; d < NO_OF_ROWS; d++)
{
for (int m = 0; m < NO_OF_COLUMNS; m++)
{
neighbour_live_cell = count_live_neighbour_cell(now, d, m);
if (now[d][m] == Live && (neighbour_live_cell == 2 || neighbour_live_cell == 3))
{
next[d][m] = Live;
}
else if (now[d][m] == Dead && neighbour_live_cell == 3)
{
next[d][m] = Live;
}
else
{
next[d][m] = Dead;
}
}
}
}```this is the current code
cout << '\n'
^
nah like i mean
i worded it wrong
the test that i am failing checks whether the arrays are the same
i think that my array is not actually 2d
so i wanted to display it like that to see all the colums + rows
not only the values of array[row][column]
since i've implemented this code it works, but the arrays are not the same for some reason
and i don't know how to find out how
ngl i will pay you 15$ if this works through paypal
good
but why did you write class contents in header files
because why not
I didn't feel like making 30 more files for each component when all that they really have is basic builders in them
And as for the ECS, templates are annoying to write in other files, doesn't work very well
jokes aside, good job, probably one of the best c++ projects i've seen @wheat mesa

C:
Kinda weird seeing big bots getting hijacked
not like well known bots, maybe like 50k guilds+
How are they getting hijacked? If that's a thing I will need to upgrade my bot's security to stop it from happening
their tokens get leaked because bad security practices or it's exposed somehow probably on accident such as committing the token on github
or their owner accounts get scammed and stolen
done that a few times then got an alarming email from discord, Only happend once and it was on a test bot
Yeah that happens. Usually Discord system will DM you saying your token popped up on GitHub
in my opinion you should always have to answer a security question before changing a bot's token
such a simple change that would prevent a lot of this
Nah I mean just the token gets leaked. No changes required
Well yeah but if the owner's account gets hijacked then the token would still be safe
Other methods are just the fault of forgetfulness and stupidity
You can view the token regardless
iirc, yeah. Unless they changed it to where you can only view it once and then have to reset it to get it again
ok fair
https://github.com/mrvautin/expressCart
Would it be possible to convert that into java for a minecraft server and hook it into luck perms for premission management
A fully functioning Node.js shopping cart with Stripe, PayPal, Authorize.net, PayWay, Blockonomics, Adyen, Zip and Instore payments. - GitHub - mrvautin/expressCart: A fully functioning Node.js sho...
It used to be like that though
it can still get leaked through other methods
dear god
I mean sure it could be
How about just not
But that would be a hell of a project, might as well just remake the entire thing at that point
that's what Someone sent me
and I said I'll see what I can do
I don't know java
I do not think Minecraft is a good medium to monetize something regardless of if it fits in the TOS
but they want it to sell ranks for cheaper fees
Java is very different from js in many ways. It's not feasible to convert that to a minecraft-based backend either way
Just use an already well established plugin like Buycraft or whatever it's called
well I mostly wanted to keep the website format after viewing
yeah they wanted an alternative because of BuyCraft's fee
Then have a UI in minecraft that redirects to a page like that on a browser
The unfortunate truth is that most things involving transactions are not going to be made out of the goodness of someone's heart. There is almost always a fee associated with transactions
payment processing will always have a fee
yeah they said on here their was a cheaper fee than buycraft
whether it be a considerable amount of time or money for instant transactions
They could set up their own website with like paypal donations or something, not sure how that compares to buycraft
Everything regarding that is going to take a percentage though
Automations
yeah
People are going to have to pay somehow
I could remake the code and sell it lmfao
the developer did a good job, I will give him credit
So there's probably going to need to be a website regardless
yeah
Just automate paypal, I heard it's hell but it can work
No real way to do it without because oauth2 requires a redirect URI
yeah
(except if you have an unreliable backend)
so I've been allowing dynmap to render on the server
and it's using 10 GB of ram
Dynmap alone
instead, I'd make sure the user has an account in game, then create a transaction flow with a reference number and then once the payment is done, get the user data by reference number and apply rewards
idk what dynmap is
an interactive map on the web
Google earth map for minecraft
Is this a paper or a fabric/forge server
Why should that use so much RAM? Seems excessive to me, unless your world is absolutely massive
wanna see?
Oh wait does it keep track of 3d data
Minecraft Dynamic Map
probably paper since you mentioned luckperms, but options that allow you to load paper plugins on modded platforms exist
all of it
Ok that's why
You can make use of modded platforms to achieve a lot of performance enhancements
Sounds like a big waste of memory to me for a feature that really doesn't add much to the server tbh
people requested it
once it's done rendering
the ram will cool down
but it's basically guidance
Oh I assumed that it was live rendering
if your in north america you could get to south america with a map
nah, I render it monthly on the secound week
dynmap my beloved
I was able to fit a heavily modded server into a 2GB VM
you know what I learned yesterday that disgusted me
what
apparently the java compiler doesn't inline functions at compile time
it does it during runtime
:)
(also I am a thorough believer in adding an inline keyword to hint the compiler to inline something)
remake minecraft java's server in c++
I think that already exists with something like waterfall though
might not be the actual name
this is the map
I zoomed out to get the whole thing
To be fair making a server isn’t too hard, it doesn’t require any rendering and it’s (I think) fairly well documented on what the server needs to do
in minecraft
nvm it isn't waterfall. waterfall is basically horizontal scaling of servers as "lobbies" I guess
This is probably gonna keep me up at night
what is?
there's a platform that allows both java and bedrock clients to join
geyser
Cuberite is a C++ server for minecraft
Geyser is the plugin
for waterfall, Bungeecord, Spigot
Geyser allows java and bedrock crossplay
Geyser is still made in Java though

so this plugin isn't made in java? the one your talking about
He’s talking about a custom server implementation
In c++
Since you’re never directly dealing with the mc client, you don’t need any Java to write a server
I could write one in JS
Already exists
I think it’s called like mineflayer
Yeah it is
Oh wait
This isn’t what I was thinking of
This is a botting API
Not a server
@wheat mesa you can find everything, Find me a botting API with AI in the bots. The server I'm working on is gonna have a prison and I wanted to bot the guards with AI
we call it the ban prison
whenevre you get banned
AI in the bots???
The only thing I know that’s AI/ML based for minecraft is baritone
But that’s a mod, I don’t know of anything server side that does that
I'd probably rather just take volunteers
because Minecraft is too complex for a traditional AI model
Yeah
That’s like phd level stuff, minecraft is almost similar to training AIs in real life in a way
Albeit a lot more simple than that
But still not a feasible project without a background in ML
ML logic destroys my brain
does anyone wanna work on group developments
split the profits @wheat mesa @lament rock ?
There is no profit, not even for Discord bots unless you're top % or insanely lucky
But if you don't sell anything that people want, you will have no profit
Finding people who share your vision is hard and would be better off contracting people off fiver
Didn't you take business Management? (dont take offense)
Ha, I worked on fiverr. If you don't have bots to review you, You don't get anything
And not my fancy
We are not running a business lol
Yeah
Mine was required, In MIDDLE SCHOOL.
weird school
It's a volunteer job with the potential to make 22 cents at the price of hosting, hard work, and time
If it were that easy to start a business and make money, I'd be rich already
22 cents per bot or whatever price we sell it for
Unfortunately it's not
Oh you're talking bot development
Then my estimate goes down to 0 cents
he means the profit margins
It somewhat is, If you have the stuff to sell. people will buy


