#⌨coders-cave
1 messages · Page 81 of 1
@orchid frigate question
when you pass
a variable to some function
without referencing with &
does the function steal the variable and does it just delete it afterwards if its not used anymore (redirected to a second function for example)
or am i wrong
depends if i remember
the thing is
if you pass & the pointer
its the memory address to that value
but without its
its just the value
so for objects
without & is:
obj.doSomething();
with & is:
obj->doSomething();
How i like quantum bugs
When you received bug
And then trying to check it by adding log funcs
and after this bug removed by itself

what i am doing wrong?
spoiler:shsh
Hi
How do I add custom traits
Hi hi rei
OS?
enlo
suspicious phone code
lmoa no
import logging
import sys
import click
from copy import copy
from typing import Optional
COLOURED_LEVEL = {
logging.NOTSET: "{}".format(click.style("LOG", fg="bright_white")),
logging.DEBUG: "{}".format(click.style("DEBUG", fg="bright_green")),
logging.INFO: "{}".format(click.style("INFO", fg="bright_blue")),
logging.WARNING: "{}".format(click.style("WARNING", fg="yellow")),
logging.ERROR: "{}".format(click.style("ERROR", fg="red")),
logging.CRITICAL: "{}".format(click.style("CRITICAL", fg=(255, 40, 40))),
}
class ColouredFormatter(logging.Formatter):
def __init__(
self,
fmt: Optional[str] = None,
datefmt: Optional[str] = None,
style: str = "%",
use_colours: Optional[bool] = None,
):
if use_colours is None:
self.use_colours = sys.stdout.isatty()
else:
self.use_colours = use_colours
super().__init__(fmt=fmt, datefmt=datefmt, style=style)
def formatMessage(self, record: logging.LogRecord):
copied: logging.LogRecord = copy(record)
if self.use_colours:
levelname = COLOURED_LEVEL[copied.levelno]
copied.__dict__["levelname"] = levelname
return super().formatMessage(copied)
class ClickStreamHandler(logging.StreamHandler):
def emit(self, record: logging.LogRecord):
try:
msg = self.format(record)
click.echo(msg + self.terminator, nl=False, file=self.stream)
self.flush()
except RecursionError:
raise
except Exception:
self.handleError(record)
here's the full code

the only dependency are click
tats cool
ues
My friend has had to restart discord 3 times today already because windows just fucks up his audio for no apparent reason every few hours
Ah yes... The nerd cave
el mao
you cant use this as an arguement
because its probably a driver issue
since if never seen anyone complain about it anywhere
¯_(ツ)_/¯
so its not that common
i could argue that i couldnt find a driver for my wifi adapter on linux
but that's not linux's fault
Yep, but people make it seem like it Linux's fault and only problem on Linux but it is definetly problem on Windows as well
I’m glad the newborn baby will pass away quickly
I think my favorite part about this cave is that the stalagmites are really spiky
it does Thing x times if you specify smth like how many times to do it
in python that'd be
for i in range(10):
or
you can make it do Thing to every element in some collection
again in python:
for i in my_list_name:
"i" either represents the element its currently on or the number from range()
i think you were memin but i still explained le loop

ive no idea how cpp arrays work
agree
but rust
is not 
kek
Hey can anyone tell me how to give traits
we really need some thing that says "NOT GAME RELATED"
@orchid frigate
guess what
i have a subdomain with ssl
its a tunnel

i don't need to buy packages like
a database
since i host them all locally
yes
He ate too many kernels and died
Busy person
hello
thats punny
yes?
what
i mean that's okay
lmao
but issues are
cin doesn't cut newline
it cut spacebar
aka whitespace
switch statement are good if
you're checking for 1 condition
and ==
lile
if a is 1 or 2
but not if
a + b is 69
or b is 10
i mean for the case
format yoyr code properly smh
I am pretty much the only guy in my class who knows how to format code
it is shit to read anyone elses code when they don't format code in any way
if you mean a single character
its storing the ascii value
int a = 'a';
this is valid
i just use black
lmoa
black looks quite nice
not productive
but I mostly code in JS and C# nowadays
lol

Quick change of subject
oh wait that's a finnish site
these
My current headphones have so shitty mic that everyone keeps complaining about it
and the passive noise canceling on them is basically nonexistent
and they're over 20€ cheaper atm
so for example in:
int a = 10;```
a is just the variable name
if you mean that
But if you mean
int variablename = 'a'```
It saves the ascii code of the letter a
i-
i just use an earphone
with a shitty mic
you can even hear the wind
lmoa
I use JBL Tune beat 600 something atm, they're good for music and entertainment but suck with gaming
like a lot
i just need headphones to like
listen to music
while coding
I need headphones for online school, possible remote work and gaming mostly. And all those are way better with nice microphone and noise cancelling headphones
foo = 1
if foo >= 1:
reset_life()
else:
pass
if main== 'main'
print('that module is just a mess')
Do something more clear than that
reset_life()
if main == 'main':
print('Another module -_&+(;')
#include <iostream>
#include "otherModule.hh"
int main(int argc, char** argv)
{
std::cout << "Module gone. No need to even test it.";
return 0;
}
fuck yeah
finally got this c++ linked list working
reversing lists with pointers is pain 
nevermind there's a bug

ffs the reversing method was working but the print function was not
I'm smort
Had to use notepad to simulate variables debugging because idek how to make c++ debugger work in VS code 
wait
why is making a linked list hard
isnt it like one of the most popular things
you can find code for it everywhere
assembly
Aand let's not get sexist or anywhere close that
I'm preparing for my exam lol no point in copying it online
pointers have the tendency of making things hard
Especially for someone who hasn't touched c/c++ in years
im not saying copy it from online
im saying understand it from online
no need to reinvent the wheel
I think I understand stuff better if I make it myself
Might not be true
Buuut I did it anyways
doesnt work when you are failing to make it

Now I know what can go wrong during the exam, and (maybe??) how to fix it 
Ah who am I kidding
Of course I will repeat the same errors 
Also now it works 
main is not defined
Yes, meu Rei
meu?
Ah yes.... The nerd cave
If you were a nerd, you wouldn't be unemployed
They're paying 800 dollars for a python dev
In Bangladesh
It'll rise in future I'm sure
so i uh
i fucked up
i apparently accidentally
reformatted my partition
to ext4 linux
and the device became read only

but i just
unplug it and plug it back
the write protection just go poof
and i managed to turn it back to FAT32
formatting sucks smh
800 dollars a month
But job in the privet sector is risky a lil bit
They could fire you when business not good
So, I would take a job in government owned sector
Yes it is
It's gonna increase I belive
The future is coming
Get ye skillz, you shall survive the Information Technology Revolution
beans
i have regex
([>\]]\s[<\[])|([<\[]|[>\]])
for parsing discord bot usually command usages
like command <arg1> <arg2>
became an array
[ "arg1", "arg2" ]
some even hiring software engineer for like
150k per year
this is literally like
asking a korean person to translate japanese
even though some do know japanese
its not like
we all know japanese
like this channel and your request
"decode this morse code"
dude just

Handling data with JS sucks so bad. I am doing advent of code with JS because I really need to become proficient with it for school and even the first puzzle is annoying to do with it
If I was using python, I'd already be done
it only took me 37 minutes to do the first puzzle
not too bad considering I knew nothing about handling data with JS
This error makes no sense
I am just doing:
array.shift();
array.push(item);
2000 times and after few hundred the array becomes Canceled
I can't find any reasoning why it does that
it just randomly becomes Canceled
hmm it doesn't seem to matter
it is still using the data inside the array correctly
it just logs it as Canceled
timeout is likely
@wet girder By the way can you deal with this
mine works lmao @wet girder
be a chad and idk
delegate???
I have the greatest and dumbest project idea: a mod that uses neural networks.
that's hamza
a neural network for what 
I've always wanted to start ML but the math behind it kinda scares me, also can't find neither a decent tutorial nor the time to do it
ooops forgot to close vs code before leaving
I'm gonna try to have 30 days in vs code this month as my Discord rpc as there's a "bug" in discord with windows that you can just put windows on sleep and it will add the time it was in sleep
i'm really fascinated by neural networks and machine learning in general, problem is, i only know lua lmfao
have to learn python
Alright well
took a lil break because I realised what an asshole I became for a moment there
but im back 😎
Shouldnt be that hard of a jump
Actually lua may be a bit harder than python but havent worked in either so idk
rookie numbers
I have had vs code open for 11 hours 7 days in a row
Back when I tryharded coding
i believe lua is easier than python
seems very wordy and I would have to agree it does look a bit easier
but still I dont think you will have a problem with python and if you do remember that you can always ask here
What time exactly is the update coming out
00:00:00.000
I only know some HTML and a tad CSS
Ey. Me too! I’m mastered scratch, because I use it for school, but I’m studying Unity
haha no
lua is literally
"fuck you"
no exaggeration
python is easier than lua
No spy don’t!
There's definitely no arguing with this lol
Lua seems incredibly uneededly wordy
Like if something then end
This seems more complex than using brackets
not really
not the issue here with lua
it has a functional programming
but not object oriented
and exception are basically non-existent
except for one
and it sucks
handling tables are fucked
seems like an unpleasant language now innit🧐
always has been
lmao
go error handling is better than lua
because you don't get weird undefined shit
sometimes a function returns a pair of error and results
sometimes they throw an error
and the error
is fuckin text based
so an integer error shows the same error as string error
This seems awful for the function itself to return the error
but different text
Who made this
it don't
usually they return
true or false
if it errors
the person who made lua
so like
to raise an error
error("text")
you can't differentiate between errors
yes
or error
alright but this seems like awful design
no
😄 awful I guess
local array = {2,3}
local _table = {1: 2, 2: 3}
and to iterate
both is the exact same
ok so uhhh 1 has two?
havent worked with tables
Wait there was some language where arrays start at 1 not 0
is this the one
lua tables are similar to javascript object
so
a = {}
a["x"] = 1
a.x
but you can't have undefined
which leads to fucking shitty behavior
How is this possible
everything is null if the thing doesn't exist
> x
nil
> a = {}
> a["x"] = 1
> a.x
1
> a.y
nil
>
a["X"] = 1 //the x-ed member???
eh
You dont make a language like that this is awful
this would cause days of trying to figuere out some simple mistake in language
lmoa
also
anyone got an idea on how to make alot of using tags easier
things are getting incredibly unreadable
hi
Took a break
realised what an asshole I was before with constantly reminding people with what I do so decided to stay away from discord for a while
but now im back
better than ever
Go ahead I mean you dont need permission to ask something
honestly
i don't understand what is wrong with lua because i haven't tried any other programming language except for c# which i didn't last long in
Ummmm...
c# was just a pain because it was overly complicated in places where it really didn't need to be
try another language some time and learn the more...detailed stuff
you will realise its design is awful
having to write ";" after everything is just annoying
c#? Has a history of being that way
and the language is barely readable
but the lower you go the more this becomes an issue
lower level languages like cpp and c can be incredibly complicated because they dont have as many features
even tho c# is a higher level language
Thats why they arent as widely used
bad languages
they are good to make new languages out of but anything else is just.. no
they have their uses
I prefer writing in c than in python for instance
Alright well now that I have made an array of all forbidden languages (spoiler alert ||lua||)
time to get to work
yknow dictionaries? yeah lua lets you mix up arrays and dictionaries togheter, although it's not recommended. I'm pretty sure you can do shit like:
local dict = {}
dict[1] = 10
dict['1'] = 'lmao'
haven't tested but prob works
dict[1] and dict['1'] count as different entries
I...dont know em
is it like
enums
dictionaries are like
arrays
but you can use other objects to index
like strings
or objects
it's kinda useful actually
dictionaries are also in C#
but better than how they are implemented in lua
a lot more stricter
Yea I remember seeing them
I always thought they were the same as lists
and lists are the same as arrays
Everything is better than lua
depends on the language
in #⌨coders-cave we bully lua
lol
I spent years using lua for roblox dev and yeah most of the time it sucks
you don't want to see OOP in lua
you DO NOT
luau is the roblox version of lua
btw luau is also banned
in the array
are there any other lua like languages
that I can ban
hmmmmmmm
not that I can think of
maybe there was something like moon lua
I think
gotta check
this is like
"we worked hard so you can use lua without having to use lua"
ah so this also looks awful
lmfaooo this is the lua version
Why does it have an end tag
this is what I meant when I said "do not look up lua OOP"
ayo
Why are there so many types of arrays
can you download worlds or no beacause im new to this game
But like
there are dictionaries
lists
arrays
tables
why
just use fucking arrays
you can
ok so how?
Follow this guide to see how you can install and upload maps
https://the-official-worldbox-wiki.fandom.com/wiki/Maps
thx
Only thing about enums
iritating through one is garbage
no languages supports enums as well as arrays and whatever other table it has
it has an error

no but seriously show some code
seeend the coode
I'm doing binary trees rn
they are cool but still I hate pointers
a bit less now
this is like going to stack overflow and saying "my code in an undefined language doesnt work when it should help?!?!"

segmentation fault 
dont you ever say anything bad about pointers or I will block you forever
and unfriend you on facebook
nooo not facebook 
I mean pointers are just hard to learn but they are cool indeed
please
string syntax = "highliting";
string pin;
string start;
string yes;
string password;
string Start;
string playername;
int entry;
cout << "**Hello This is A Pokemon Fan Made Game Called Pokemon Fan Made Version 1 Input Start To Start the Game**\n >>";
cin >> start;
if (password == start)
{
cout << "Dr.Roway: Hello Young Man " << endl << endl;
sleep (3);
cout << "Dr.Roway: Would You Mind Telling Your Name?\n >>";
cin >> playername;
cout << "Dr.Roway: My Name is Dr.Roway Stone The Pokemon Doctor Who study's About Pokemon" << endl << endl;
sleep (3);
cout << "Dr.Roway: I Was Your Father Friend " << playername << endl << endl;
sleep (3);
cout << "Dr.Roway: You're Father Made A Request From Me to Give You A Pokemon" << endl << endl;
sleep (3);
cout << "Dr.Roway: Do You Wish To Pick A Pokemon " << playername << " ?" << endl << endl;
sleep (3);
cout << "Type Yes To Pick a Pokemeon\n >>";
cin >> yes;
}
ok so first and formost
there we go
password is unassigned
when you compare it you are comparing to nothing which should result in an exception
nothing is assigned
everything inside the if statement should be tabbed

just use auto indent feature in vs code 
no functions
very useful
so all this is never going to be ran
and alot of errors will start
ah so thats in main
but still
random tabs
ohhhhh
you are declaring password twice
the second time you gotta do
password = start;
don't put string in front of it
also nice game name
ok what else
im happy you used == because to this day I forget the second =
ok uhhh
at one point you do double endl
kinda useless but ok
nah
its the same
\n and endl are the same
space before the next string
or after
basically use spaces
and tabs please
what im mainly concerned about is
why is there a random tab in the middle of the code
two random tabs actually
4 spaces
no no no please
I enjoy talking to others about this
basically tabs should only be used if you are putting code inside of methods, statements etc
not randomly putting them
use pastebin
makes everything much easier
and shorter
or github
no no wait wait
use like
pastebin
or github
this is very long
or atleast use the three `
pastebin would be cool
pretty sure you don't even need an account to do it

can you just give me the errors
maybe that'll help
bruh
so what happens when you run it
helloworld.(1)-5611.=False

so it skips all the couts?
ok there's something weird going on
so you declare a bunch of strings
without initializing them
then you assign password to start with password = start
the problem is that neither password nor start contain anything
string var1;
string var2;
var1 = var2;
this doesn't do anything at all
variables are like containers
they contain stuff
but the name of the variable doesn't really mean anything, except for you
if you want to set password to the string start, you need to do
password = "start";
with this, you are assigning the variable password's value to the literal "start"
and they are much faster than lists
but you need a key
dictionaries are actually a hashmap
with the key being the hash
that's why they are fast
yup
you cant master c++
you cant master any language really
you can master the basics
but you cant master all libraries
and mastering the standard library is insanely difficult
because its huge
you dont have to know c++
in fact you dont have to know any difficult language nowdays
the most widely used languages and best paid are also the easiest like python, html(if you call it a language), css, js, c#
so on
also mastering the basics of cpp takes like
3 years
because of all its quirks

wut
@knotty root
I mean yeah, c++ is the hard way of learning programming, you start from the basics and learn about some low level stuff like memory management, dynamic allocation, pointers, all that stuff. If you are not interested in knowing how it works, you can go with easier languages that abstract most of that stuff for you
java is meh, I guess it's still widely used but I don't really like it. Python on the other hand is quite easy to get started with and has a lot of little things that you don't usually find in other languages
honestly I'd say, do some research on both
and decide
Java doesn't have as good job opportunities anymore and there are less and less every day pretty much
it's not a modern language so to say
But doing your own research for your purposes is the best thing to do
Python is pretty widely used because it's easy and powerful but it's extremely slow.
Java is old and outdated but if you are doing mobile dev then it's probably your best choice.
There are other choices than py and java
I'd personally recommend C# as it can be used for almost anything
and it's quite easy to move to other languages
Kotlin is more widely used for android nowadays
True.
And Swift for iOS ofc
Well if you want to make iOS apps natively you have to use Swift because apple bullshit
Oh ok
that apple bullshit is called being annoyingly independent
Still bullshit.
"We have our own os with our own design and kernel and hardware because fuck you"
They have their own Arm-based CPU architecture now too I think.
This seems so overly complicated
apple is literally me if I was a company
Making absoluetly everything myself because...well actually the reasons are different
but still
it is kinda a bold play tho
They're like the British Empire of the tech world.
because then you can sell a computer stand for $999 
A computer from 50 BC*
apple's marketing team is smart ngl
well yeah they sell stuff for absurdly high prices and a lot of people still buy them, so yeah they are big brains
And then they make little to no parts for their hardware so the parts are also expensive
and actually working on the hardware is expensive because its hard
damn they are showering in money
in terms of market yes
and for home os
but outside that no
from what I heard all 500 best supercomputers use some linux distro
and alot of stuff is linux
elloh
no
olleh
and you can only do it on a mac
I think thats a bit overkill at this point
no that's actually one of the best things apple did
they are becoming too independent
cuz they can make stuff with slow chips but they are still competing with the best
if you have your own everything
you can tune everything to your need
making it super efficient
Yes but noone will want you if you are competing with yourself I dont think
bruh
Ok what im trying to say is
Becoming too independent means you are dividing two groups
mac users and non mac users
even better
and its a big gamble if you win
lock people into your own stuff
make it so they cant change
sounds like good marketing
and that also means you cant really interact with anything non mac so things become even worse
but they make there stuff so good
that people dont care
in western countries most people dont care that apple is expensive
Im in an economics school I get very mediocre grades on all my economy theory tests so im basically donald trump at this point
And I can agree
i mean if its not good marketing apple wouldnt be worth over 2 trillion $
Still I think competing with a big ass company like Microsoft this way is pretty bold
I have to agree that it does work
actually it was the other way around
But like your own arm based architecture?
microsoft was competing with apple
Thats overkill
i think this is the best thing apple have ever done
Why
look at the new mac books
these things are so fucking good
and the battery is huge too
jk the battery isnt huge
but it lasts longer than everything else
which is even better
its apple their phone batteries suck so I didnt expect much
I have heard alot of complains about it
but they also came from people living in first world countries complaining that they dont have a phone for 3k so
its not as good as a 5000 ma battery
but its very good for a 2000 ma battery
that 2000 lasts like a 4000 on an android
In finland when it goes even a bit under 0c iphones become unusable outside
the batteries keep dying in the "cold"
0c is quite warm still ngl
well point being, iphones are not good to use in winters in finland
which is why very many finns keep changing away from apple
what
but all the phones have the same type of battery
lithium ion batteries
all the same thing
I have never had a phone that wasn't able to be in -30c - -35c, but everyone I know who has apples can't take their iphones out of their pockets when it's cold outside
well the recommended temperature for a battery is above 0c
tru
Here we have the opposite problem
Our summers are insanely hot which is strange for thr country's location
So sometimes while doing something I just see the phone dying
Or my pc becomes a fucking helicopter trying to deal with the heat
no like
you can learn stuff in python
robotics
ai
etc
everything is different
i cry cause of HTML at night
yeau
html do be taking your husband
and threatening to kill him
unless you make a good html structure
Cin?
The one in c++?
Yea the console is available in py as well as js and c#
As well as most languages I presume
If u meant actual cin
No
But console? Yes
The terminal
U know where words come out
What I thought ur able to get input from user
In python
what rly?
I can't believe it lol
Bcuz it only works in c++ or c
It's one of the interfaces 2 the console/terminal/whatever u call it
I search a bit and it said you can use input()
Havent learned python so idk
just like make a project for yourself and whenever you get stuck search the answer online
cin is literally
from C++ std namespace
python streams are file based
for inputs
its handled on
sys module
sys.stdin
for outputting to the stdout
sys.stdout
but you rarely use this
there's print() and input()
hm?
first of all
use codeblock
```language(like py or js or something)
code
```
second of all
your code doesn't match the error
imagine like
"the gallon was leaking"
but you showed them a broken dispenser
not the gallon
yes very nice
LX=23
(Helloworld.com) True=False
Sus=1
Color+999999
77=False
99=True
???
what language is that
Then, is there a way to get that file?
Just curious
yes
its just the
fd's
for the terminal
like
the wrapper on sys.std[in/out/err]
are just file wrapper to the /proc/pid/fd/[0/1/2]
or whatever its located
on the process
do they get replaced or do they just stay there forever building up? or is there a limit until they are replaced?
or do they get cleared when the program ends? and when two python programs run together they just use
fd/0 for first
fd/1 for second
and etc.
oh don't worry
the stdout/stderr are just temporary
they're for displaying text on the console
they don't contain any size likely
you can't read them because there's write only
there's no limit to them however
the file descriptor also got deleted if the program ends
two python program running together is gonna be different
like they have different pid
so each referring to their own streams
even though they're the same fd
so why the file wrapper? for structural and design purposes?
its not system wide fd
oh
its easier for us to do that
ok thx
>>> sys.stdout.write("hi\n")
hi
3
>>>
there's no istream or smth in python?
or is the design gonna be too "far apart" and weird
>>> sys.stdin.readline()
hi
'hi\n'
>>>
so they just immediately use file
idk how to word ir
ye
this one
so why instead of
istream => file
Istream => console
They use
file => console
it's an oversight? early on?
are wrapper around the console
so everything written there is written to console
or read from console
they treat fd as files
normal files
specifically stream
we don't have separate
like print()
they take a file argument
o
oversight as in?
like they didn't see that others would use stream like functions aside from files
or is it just named like that
so they just "fake" a file?
bcuz u said there's no size
here's an example ```py
import io
stream = io.StringIO()
print("hi", file=stream)
stream.seek(0)
0
stream.read()
'hi\n'
ah well
they don't wanna make python complicated
since the standard i/o is like
also a fd
they treat is as file
since you can read and write to a fd
but it's not actually written to?
similar to how this works
i echoed
but redirect its stdout
to /dev/pts/0
which outputs to my terminal
does echo save automatically? sry I don't use linux
Ooo ok
it doesn't do any saving
also windows have similar command
called "echo"
literally the same
sry I don't do that much in windows
oh then what os are you using
I meant I do not use the command line that much aside from just git and installing crap
ah lmao
I sometimes wonder
When some code is ran the results(prints) are put into a terminal
But what is that terminal
what traits does it own
how does printing on it work is it just integrated vga
well i mean
terminal is uhm
a place where shell commands are executed
like bash for example
that's a shell
different shell may output different result
depending on some traits
but outputting through it is
hard to explain
with the unix filesystem there's some folders
that are virtual
so my guess is that
when you write to the terminal
it writes to the device
and that device is the machine itself
so
gah this is confusing
what's the better question?
whats a shell but I already answered that myself
basically
its literally just a file that reads info from the user and tells the kernel to execute it(the kernel is needed because its the only program with unlimited power)
so its simple af
the kernel does the heavy lifting
Actually I guess everything is already on the kernel so it just needs permissions
o
Mmmmmm
Make a file called con on windows.
Exactly.
wincon
It's abbreviated to con.
what's con though
It's a dos thing but windows is big compatible.
Console.
ah
msdos
Ok
