#development
1 messages · Page 2062 of 1
all the commands in leaderboard are nested in a type:1 object. so i just needed to make a container for those two options
let r = {"test": {"first" : [], "second" : [], "third" : [], "fourth" : [], "fith" : [], "sixth" : []}}
fs.writeFileSync("./hall.json", (JSON.stringify(r)), (err) => {
if (err) console.log(err)
});```
Hey why is this code not updating my json file properly?
For some reason if i log the first key, it still returns as the previous set value
app.get("/clearTable", function(request, response) {
response.setHeader("Content-Type", "application/json");
var removeDatabase = db.prepare("DELETE FROM messages");
removeDatabase.run();
var createDatabase = db.prepare("CREATE TABLE messages (message TEXT NOT NULL, user TEXT NOT NULL)");
createDatabase.run();
response.json({ success: true });
});
``` anyone knows why it doesn't delete the table?
idk much about it but after run i think u also gotta call the finalize method

and ig to delete table its
DROP TABLE <TABLENAME>
tysm
Use let please

Also use VARCHAR for user instead of text
Unless ur using sqlite
TEXT takes way too much space for something that small
I'd even say message can be a varchar, people don't type stuff that big in a single msg
Oh and last but not least, add an id column
Non-indexed tables are awful (natural search is many orders slower than indexed search)
The difference can be like 15s vs 6ms
I wonder what this guy is even making
a chat for his game
But...isn't his game in discord?
I don't ask questions, all I do is deliver the package


So if I tell you to deliver something for me across the border will you question it?
My UPS driver when I ask him where my 30 Amazon packages went
when u buy a a book but instead receive 30 1TB hdds
I wouldn't be mad
50$ per hdd roughly
Fuck bro
I'd sell em
make bank
when life gives u hdds, you make a server
// Fetching our messages
let fetchResult = await fetch("https://transparent-speckle-door.glitch.me/getMessages", {
method: "GET",
}).then(res => res.json());
// Lets now structure the messages we fetched. :)
fetchResult = await Promise.all(fetchResult.message.forEach(message, user => `${user}: ${message}`));
``` anyone know how to fix this?
sell most of em
did u change the table structure?
also, yes, user and message are objects not string
visit the API you will see how I structured it
user and message are objects you can't just put em in strings like that
no, I mean, the CREATE TABLE u sent earlier
yeah
this
yes I fixed that
u added an index?
wdym index?
then u didn't fix it
unless u want to make your users wait several seconds after each message sent, use an index
Lmao
why tf no git?
Don't forget to put all the sensitive information in there as well
I first need to get it working then I can start optimizing
it's not about optimizing, it's about basic sql structure
lest you have to go back and change the code anyway to fetch by index
just cause you said that ima never use index again
it's a socket.io app
You should make it so when someone is typing it says {user} is typing.. kinda like discord no reason really just something to do to practice socket.io
There really is no actual reason to do so, it is literally just for aesthetics
yeah
I may make it look like my tool does
hold on
let me
show u
this one communicates with the same backend
so it will be easy to integrate some features
like the logo display
I wanna make a terminal version of discord but on a smaller level
You will likely make something better as I don't feel like going all out
just some simple shit
we'll see
gonna make a website? 🤣
I made it look a little bit better
and fixed all the issues with the CLI
not even using electron
what are u gonna use then :0
inb4 “wpf is too hard”
sameee
they dont even have their github linked to discord
😔
who does that anyway
people who like showing off their shit code
it's the only thing I have publicly linked
It would be nice if you could publicly link your discord server
instead of just using about me
or status
yeah
unfortunately not
@sharp geyser
added role colours and some other improvements
how is it going for u?
my g I am using something completely new to me going to take a while
he is using a real men's programming language
yes
actually no that's C
ik
what are you doing now? need help?
np
gl with it
send me a pic once u start making some UI
lovely UI
indeed
are you making a program to communicate with the discord's API or are u making ur own chatting server?
I have not decided on everything ima use yet
I am likely going to implement voice calling so I will probably use something like webrtc (unless there is something better)
I used raw socket, you won't believe how primitive I made most of it 🤣
as for the basic communication between each other it will be a websocket implementation of some sort unless there is a better way
I am going for an actual chat app kek
that's not raw socket...
raw socket for backend
holy shit just burnt my tongue lovely
after the post request it sends data back to the front end to display what I sent
are you gonna add ability to form guilds etc. like discord?
makes sense, by socket I meant how I get and deliver data
doing too much at once will be a pain to handle
yh
Ima just start out with making users and shit first and getting the login and signup working
my chat is a one big chat for now and a one big DB with messages
which isn't very scalable
loading messages will be an interesting thing
it's pretty fast actually
I optimized it as much as I could
takes around 10ms to send a request to retrieve messages
I am probably just going to go with the approach of loading the messages once you enter that dm and then just add messages onto it after once they are sent.
plus optimized it to only send if you hear back from the API that the chat needs upating
very efficient
Loading all messages for everything your apart of seems inefficient
pretty much what discord is doing
yes and they still manage to use twice the ram they need 😔
😭
Imma dip for today
gl with ur project
cya
no me
What is right image size for description in topgg
both of us
There’s none
You can use css to resize the image based on the clients resolution
Within the limits of the site
When it comes to scientific numbers, in a floating point number, is there a difference between e and E?
public class Main {
public static void main(String[] args) {
float f1 = 35e3f;
double d1 = 12E4d;
System.out.println(f1);
System.out.println(d1);
};
};
man please stop putting semicolons after everything 
there is no difference
The format of scientific notation in Java is exactly the same as you have learned and used in science and math classes. Remember that an uppercase 'E' or lowercase 'e' can be used to represent "10 to the power of". Scientific notation can be printed as output on the console if it passes a certain number.

Yeah those semicolons on the braces are completely unnecessary
just to make sure there are no syntax errors 👍
class definitions in C++ requires semicolons in the braces
yeah
Waaat, there is no Strictly Equal to operator on Java?
I believe Java handles type comparison, true?
Wdym?
Java does not have ===, there's no point
You can't compare two different types like that
Like 1 == "Something" is just invalid
You can do like 97 == 'a' but that's because chars are represented by numbers
it'll throw
Fair enough. 👍
same tbh
but what would bring me more joy is if @earnest phoenix leaked me the secret of writing a program in TQ instead of js

tq?
let moderations = await this.container.client.db.moderations.findMany({ where: { id: `${message.guild?.id}`}})
await this.container.client.db.moderations.create({
data: {
id: `${message.guild?.id}`,
user: member.id,
mod: message.author.id,
case: `${moderations.length}`
}
})
let e = new MessageEmbed()
.setColor('RED')
.setAuthor({ name: `${message.author.username}`, iconURL:`${message.author.avatarURL({ dynamic: true}) || message.author.defaultAvatarURL}`})
.setFooter({ text:`Case #${moderations.length}`, iconURL:`${this.container.client.user?.avatarURL()}`})
.setDescription(`› **Action**: Ban\n› **Offender**: ${member.user.tag} (${member.user.id})\n› **Moderator**: ${message.author.tag} (${message.author.id})`)
message.channel.send({ embeds:[e]})
how do i make case in prisma
i tried this
no ideas?
This document explains the V8 Torque language, as used in the V8 codebase.
yes
the hidden easter egg of javascript
the language that is hidden from us
because they dont want us to experience the performance of it
very selfish
Kekw
it's probably on par with C++
@earnest phoenix is there a way to write a Uint8Array to a Buffer in Node.js? the one in the docs only supports string as input https://nodejs.org/api/buffer.html#bufwritestring-offset-length-encoding
or do you have to set them manually with buf[x] = y
thanks
can someone explain what is happening in here?
its true but doesn't make it to the final array
ayo wth
your regex probably has a g flag which makes it stateful
don't make it global if you want it stateless
also check Buffer.from(ArrayBuffer) if you want to wrap the existing memory and not create a copy of it
is it a copy or a reference
Folks any idea how I can get my bot's name & avatar on top.gg updated? I hear my bot needs to be in a bot list server for that to happen, is this said server?
My bot has already been approved fwiw
the bot does not need to be in any server, simply press the refresh data button on the bot page
That isn't working for me, think its just a matter of waiting?
I do already have my avatars and name updated in the discord dev portal if that matters
Good shout! Yup that fixed it, many thanks!
Buffer.from(buffer | typedarray) creates a copy
Buffer.from(arraybuffer) references the original arraybuffer
pf efficiency
irrelevant but its funny how in c++ if you dont use references or pointers for function parameters everything will be copied
even giant structs
working with buffers is fun, because you can have a Buffer, a TypedArray and DataView all work on and reference the same memory
whats the difference between a uint8 array and a buffer
they should be the same thing
node buffer extends uintarray
and implements similar methods to dataview
plus extra methods for strings
so basically node buffer = uint8array + dataview + textencoder/textdecoder
arraybuffer is the base for all of them, is what actually contains the memory block
everything else extends arraybuffer
i feel like thats a good standard to have, better than js's "somethings are copied other things are referenced"
i mean it has to be the case anyways
functions are supposed to be standalone pieces of code
they have no perception whether something should be copied or not you have to specify so
a single & might just save you a lot of performance
tho copying on modern processors is quite fast anyways
even faster if the code you're running takes advantage of SSE
ye

developers help, I've been browser hijacked
how do i find what caused this and remove it?
i removed 3 extensions and it looks like its gone
the thing that made me notice it is gone now
np
i noticed when i googled, every search result would first be redirected to search.bevoci.com
so i googled that website and that got me to an article saying it was a browser hijacker fake search engine
earlier today everyting i searched would be redirected to bing
this is why im insane
Welp
must be fun
happened on my school laptop
turned out
how long does it take to accept a discord bot
too long
fr
i coded a bot where you can save your crypto addresses and can be viewed by anyone by running a command which would help to make, payments, donations etc or in a marketplace server
no, but it gives you a blockchain link which does show
all transaction to the wallet
incoming and outgoing
which determines how much cash u got
dm me @split hazel
some random thoughts
memory garbage collection is kinda like cleaning your room
you leave it until a special time
and then if it gets to be too much you lose motivation to clean it
Do you have a good source that i can read more?
regex often act weird when i'm using it
same regex, same input
use https://regex101.com/ to test
its very handy
like this one, same input, different output
odd
to be more specific, the one that didn't work is a string from cheerio
i copy the input and test it again.
and it actually works
still confused why tho
nvm i found the problem, the string contain a weird space.
which doesn't count as a space hmm
Use \s instead if " " for spaces
\s matches any space-like character
yup i've changed it
Also when matching letter "i" remember turkish don't put tittle in "i" 
imagine using join when you can implode a string


oops, wrong button
imagine using implode when you can explode

php is too aggressive
who said php wasnt rough
hey does anyone have some good vsc themes? I just installed a purple one and it's fucking my eyes
One dark pro + JetBrains mono font
not easy to find one that hits you
guys, how do I check if bot have higher role than selected user?
Which library are you using?
discord.js
ik that there was part of the code like
.highestPosition
something similar
but cant find it anywhere
You can compare the position of the highest role of said guild members to check that, to get their highest role position; you can access the <GuildMember>.roles.highest.position property
yea i think thats it, now i need to compare it to bots role
should that then be something like
me.roles.highest.position
Although roles themselves have a method to compare positions if you'd like it that way
https://discord.js.org/#/docs/discord.js/stable/class/Role?scrollTo=comparePositionTo
<Guild>.me.roles.highest.position
thank you verry much
How to get the date when a user joined the discord or discord server?
https://discord.js.org/#/docs/discord.js/stable/class/User?scrollTo=createdAt to get when their Discord account was created
https://discord.js.org/#/docs/discord.js/stable/class/GuildMember?scrollTo=joinedAt to get when they joined a Discord server
my bot is i think offline rn
WTH IS GAYMETER 😂
doing some fixes due to permissions
Nope it's functioning
well...calculating ur gayrate 😉
ahh nice
👍
Where do you host it?
heroku
Like me...
those dynos. you using more accounts to get free hours?
Definitely
i dont use any dynos?
lemme see
What? then how you keep your bot alive?
😂
Impossible to keep one alive without a worker
I seaeched about 2 days to find it
wth😂
guys so I need a game idea
I want to create a short horror game
something like max 30 minutes of gameplay and something I can create in max a week
cause every project I start gets too big too easily and hard to manage
so looking for a short game idea
why
if I do a check for the MANAGE_MESSAGES perm anyone with admin/server owner should still be able to use the command no?
I completely forget how discord perms work
@sharp geyser how's your discord V2 going?
are you looking for <member>.permissions.has(...) ?
yea nah not using djs
just forget how discord perms work
I'm pretty sure discord checks them based on roles or global permissions, if you have a role with manage channels permission for example then checking for that permission would return true, but if you have a channel that gives you that permission it would return false even if you have that permission
:|
^ also pls
Look at the way djs does it, probably not too difficult
development chat screenshot jumpscares
cursed
What would be the easiest way to make a button collector? (I am not using djs so ye)
create a component listener and apply filters to it
Wouldn't that cause it to never stop the event listener?
I don't think keeping a constant event listener going is a good idea
you need to stop it once the collector finishes
fair point
thats whats djs does
I tried looking at djs implementation but it was super hard for me to follow
an alternative is to have an always on listener internally
and this listener checks for active collectors in a list
so your collectors just add/remove themselves from that list
instead of creating and deleting a new listener
that isn't very performant tho is it?
there shouldnt really be any difference
is this okay to do every frame?
depends on what UPDATE_BODY does
why not run this function when the user does a thing that requires a change instead of constantly polling to see if a change has been made
In ts I want to filter out all the values that is not undefined and get the keys
I just want to keep undefined keys.
type RootParamList = {
loading: undefined;
home: undefined;
dontwant: number;
};
How do I convert above type to just "loading" | "home"
Instead of using a literal object to define such a type, you need to declare a record type
type UndefinedOnlyMapper<T> = {
[Key in keyof T as T[Key] extends undefined ? Key : never]: T[Key]
}
type UndefinedOnly<T> = keyof UndefinedOnlyMapper<T>
type Test = UndefinedOnly<RootParamList>;
To limit the object to keys with only the value undefined, you can declare it as
Record<string, undefined>
yes I know, but I cant do that. In my case
magic ✨
This is the type of shit I wish I understand
Maybe I should just fuck with types more than actual coding useful shit
How to keep setDescription like this ||Track queued - Position 2||
.setDescription("Track queued - Position 2")
actually just realized smth
you cant reply to that message since it was deleted before 
though am sure that was back when it would just do
ok
@rustic nova
are websockets necessary to make a music stream/radio website?
I'd recommend something like Shoutcast / Icecast
I personally use Azuracast which provides a web admin GUI for Shoutcast and Icecast
I see
I have it even better
nedd help
we all do
That's a pretty easy one
Typings were something I struggle with quite a bit. I've seen people do some crazy shit with em tho
I mean it makes sense but I don't see why you would ever need this lol
hm guys wanna pick your brains real quick.. I just wanna know how JSON knows the object from the array after this
var obj={0:1,1:2,2:3,__proto__:Array.prototype}
Object.defineProperty(obj,'length',{value:3,writable:true,configurable:false})
var arr=[1,2,3] //an equivalent array in terms of the values
let test1=JSON.stringify(Object.getOwnPropertyDescriptors(obj))
=== //literally all properties are the same
JSON.stringify(Object.getOwnPropertyDescriptors(arr))
let test2=obj.toString()===arr.toString() //again, same value
let test3=(obj instanceof Array)&&(arr instanceof Array) //true
let test4=JSON.stringify(obj)===JSON.stringify(arr)
//this test4 result is false but HOW DOES JSON KNOW THE DIFFERENCE
When you stringify an object with JSON it's typically used to make RESTFUL api calls is why.
It's different from .toString()
json stringify returns a string, so in the end you are comparing two strings
these strings may contain differences that are not visible to the eye, for example invisible characters and differences in encoding
if the strings look exactly the same when logged, the only way to find the difference is convert them both to buffers and analyze it byte by byte
however in this case the difference is clearly visible
nevermind, i understand what you're referring to now
looking at it deeper now, im puzzled as well, this is a really interesting behavior
its also a v8 specific bug/oddity
chrome:
firefox:
here's my theory, the js engine creates and manages objects on the c++ level, you cannot change what the object is from js. JSON.stringify is also written at the c++ level for performance reasons, so the function can tap into the object's "true" type. and firefox's engine seems to respect this as well, but for some reason chrome/v8 can actually be tricked into thinking an object is an array just from modifying its prototype, but its "true" type at the c++ level remains unchanged
@earnest phoenix what do you think? ^
yea, but the properties are all the same 😳 test1
pf strings are slow
use binary instead
a json struct

honestly you can do that for something like an API or tcp connection if all your messages have a predefined size and amount of expected entries
naming things is such a human thing
computers are way superior
zamn 😳
honestly this looks more like a chrome/v8 bug than anything else
perhaps
interestingly, node is also not affected
even though it uses the same v8 as chrome
so far chrome's dev tools are the only place where this happens
ah.. so even with the same values.. nothing gets fooled
so.. then what's the difference between the array from properties and an actual array.. gonna put that up on SO and see some answers..
yeah because there are hidden properties that are not visible from js
why are y'all turning objects into arrays by abusing __proto__ 💀
this is how objects look like in c++ (with v8)
they are much more complex than what is visible from js
js cannot change those hidden properties and values
why are we on discord?
for fun

abusing js is fun
because js lets us do it
other langs dont, they fight back
so we cant bully them
currently coping with everyone's favourite library
msal!
sadly i'm getting 401s if i try to get a bearer token with a code
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
write a system driver that runs at ring 0 privilege level and try to make the hardware in the system blow up or something idk
now thats fun
vanguard
nobody uses ring 0 to try blow things up
only to try stealing stuff
is it even possible to actually blow something up (i mean like modern computers) from software only?
doesnt the hardware have a ton of safety checks and emergency shutdowns?
true, javascript is super flexible
I love it for that ngl
likewise
i think the only security features are really voltage monitors (if any) and the internal firmware monitoring temperatures and shutting down if they get too high
other than that not really
if a chip does not have sufficient protections against bad code and instructions it can indeed break or do something unexpeced
in fact back in the day apparently badly coded os's broke certain monitors because they displayed color in an unexpected way
like completely bricked them
lmao
well yeah but bricking is not exactly the same as blowing up xD
i mean, these days you can pretty much blow up a battery if you do something bad with its charge controller i guess
idk if you can even access that from the os tho
you wish
i thought the os would have more control but not really
the os doesnt have much control over hardware
its really only up to the bios i think
yeah
most components have their own tiny os'es controlling them
and everything is wired by ultra fast usb's
lmao
it can send bytes and receive bytes from certain IO ports and thats it
kind of
have you ever messed up with RWE?
read & write everything
wot
lmao
if anything can access the darkest corners of your pc, its this thing
why not
i used it once to override a laptop's fan speeds
following strict instructions i found online of course, i couldnt have figured it out by myself
those shouldnt be controllable via software 💀
some are
most laptop fans are only controllable by the bios firmware
that means my os can 😮
tim you need to make an os it just seems like your end goal in life
its not as bad as it sounds
fan speeds are normaly stored in the EC, and you can access and override it
i willguide you towards your hello world program
lmao
just dont go too deep and you'll be fine
server{
listen 80;
server_name http.capy.pics;
location / {
try_files $uri $uri.png @redirect;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_pass http://localhost:9000/httpcapy/;
}
location @redirect {
return 301 https://capy.pics/;
}
}```
this isn't working 
its meant to allow both filename and filename.png to be allowed to be accessed
all files are pngs and that isn't going to change
the stay away zones for a good fun experiences are the ACPI, networks and other stuff like that
dont know about disks i wanna try them soon
i really wanna write persistent data to the disk soon
you need to set the root directory, to make sure it finds the files
its stored in a Minio bucket tho
is the bucket accessible from the OS as a regular drive?
then set the root dir to the correct path
try_files will check the disk and try to read the file
so the files have to be found and accessible on disk
and the path has to be correct
ah ok
if you just want to check if the url contains a png file, then you need to do something else
how would I do that 
you can use something like if ($request_uri ~ .*.png) {}
inside the location block
what does that do
$request_uri is a variable that represents the url you're trying to visit
without the host name
the rest is some nginx specific way of doing pattern matching, i dont know much about it either
you can try looking up more examples
The JavaScript engines does create and manage objects at the C++ level (or whatever programming language it's written in, but in this case V8 is written in C++, so going off of that), it's not just objects but almost every primitive type is created and managed at that level for performance and memory concerns, JSON.stringify() is also indeed written in C++, almost every native method is; most operations do have access to the object's actual type on the user-land, but to a certain extent to not break things and so the same case with many other types, about the object prototype modification to "trick" the engine, some things depend on the prototype of primitives, and since arrays are also considered objects, that's why it thinks that way
Arrays are just objects with indexes as properties and elements as values
{
"command": {
"roles": [],
"blacklistchannels": [],
"arguements": {
"args1": {
"roles": [],
"arguements": {
"args1_1": {
"roles": [],
"args1_1_1": {
"roles": []
},
"args1_1_2": {
"roles": []
}
},
"args1_2": []
}
},
"args2": {
"roles": [],
"arguements": {
"args2_1": {
"roles": []
},
"args2_2": {
"roles": []
}
}
}
}
}
}
{
"mute": {
"roles": ["player","moderator","admin","owner"],
"blacklistedchannels": [],
"arguements": {
"add": {
"roles": ["moderator","admin","owner"],
"arguements": {
"type_pingid": { //any @ or id (@user)
"roles": ["moderator","admin","owner"],
"arguements": {
"type_input": { //any input (time)
"roles": ["moderator","admin","owner"],
"arguements": {
"type_input": { //any input (reason)
"roles": ["moderator","admin","owner"]
}
}
}
}
}
}
},
"remove": {
"roles": ["moderator","admin","owner"]
"arguements": {
"type_pingid": { //any @ or id (@user)
"roles": ["moderator","admin","owner"]
}
}
},
"list": {
"roles": ["player","moderator","admin","owner"],
"arguements": {
"type_pingid": { //any @ or id (@user)
"roles": ["player","moderator","admin","owner"]
}
}
}
}
}
}
Ive been trying to solve this for a few days and ive finally given up. Basically its a permission handler, the bot goes through this before executing the command. im trying to make this system infinitely expandable. Basically itll only check the perms needed as far into the file as it has to, like for the "mute" example, if you just type "/mute @user 5h" itll stop before checking if perms are needed for the (reasoning)
Idk anymore, brain fried lmao
sorry for lack of stuff, again brain fried, can barely think rn
what do you think about the bug/oddity above?
where the chrome dev tools can be tricked into thinking an object is an array
but the same trick doesnt work on node nor firefox
Hmm, I suppose the implementation of the JSON.stringify() method in the V8 engine actually looks into the internal slots rather than the prototype, I'm not exactly sure if this is a bug or if the other JavaScript engines are following the specification incorrectly, I found this pretty interesting as well
im curious, will javascript die out? Like i know it will someday, but theoretically how far is that 'day'?
It'll never die out
its more like the chrome dev tools follows something incorrectly
the other engines correctly differentiate between object and arrays in their repl environment
the chrome dev tools environment is the only one that is tricked
but something cant live forever, like (i dont have much knowledge on this) binary, its still alive in some sense, but its been sortof replaced/refaced with newer and faster languages
its not replaced, its upgraded upon
i mean, the bases are never gonna be removed
people will just use tools that work on top of those bases because they are easier
but you're free to still use those bases if you want
so in that sense, javascript will always have its roots intertwined in code forever, in at least some form?
pretty much yes
I suppose there's something incorrect in the Google Chrome dev tools REPL as it uses a different mode of the V8's behavior rather than the original, I think something there was inconsistently placed at that part
👍
This is actually amazing, I never saw anybody figure out this bug in the chrome dev tools
isnt it? i thought the same
never seen this before
oh talking about chrome, whats up with the new javascript limit in chrome? like sometimes when ive accidentally pushed one of my scripts too far chrome just kills it and pops up an error?
what limits?
there are no hard limits, just protections against problems like infinite loops and memory leaks, where it crashes the process on purpose to avoid crashing the browser and the pc
there were some javascript based games i used to play on chrome after flash died, now when i try play them a lot of them have come up with things like chrome no longer supports certain memory javascript or smt like that, generally they say to run the game on firefox
@earnest phoenixbtw i dont recall if i've ever mentioned to you about the performance issues for the this keyword inside a Proxy object
usually when they say that its because the game still requires flash
i wish that were the case, these were games i played way after flash died, some of them i even played near the start of the year, it was around the start of the year that they started coming up with this error
Does it behave like it has some sort of performance regression?
can you show an example?
gimme a few min, ill try to find one of the games
check this out: ```js
const obj = {
str: "a",
test1() {
for(let i = 0; i < 9999999; i++) {
this.str + this.str;
}
},
test2() {
let str = this.str;
for(let i = 0; i < 9999999; i++) {
str + str;
}
}
}
the only change is using this directly or putting this in a local var beforehand
this produces equal performance
but if you put it in a Proxy object, like any of these
let a = new Proxy(obj, {
get(target, key, receiver) {
return Reflect.get(target, key, receiver);
}
})
let b = new Proxy(obj, {
get(target, key, receiver) {
return target[key];
}
})
let c = new Proxy(obj, {
get(target, key, receiver) {
return target[key].bind(target);
}
})
let d = new Proxy(obj, {
get(target, key, receiver) {
return obj[key];
}
})
let e = new Proxy(obj, {
get(target, key, receiver) {
return obj[key].bind(obj);
}
})
then the this variant is 50-100x slower
oh wait nvm u were right, it was to do with the engine the games running on, its using renpy, its one of those timekilling anime decision making games etc, runs off renpy, apparently they dont render properly in google chrome v 100.0 and above
and now its going on to say that half of the time the game still runs if u have the console open??? wait so the console can influence an engines performance in some way even by being open?
if a program logs a lot of stuff, then yes the console will cost performance to receive and display those logs
i havent heard of the renpy engine
Well there is actually logic behind this, the reason the direct usage of the this keyword is slower in case of proxies is because the this keyword kinda also depends on the proxy methods you provide to override the native behavior and work with the things it returns, which can significantly affect the performance, but I'm not exactly sure if this is the case with 50-100x slower performance but it might be
it seems like a kinda old engine hastily upgraded to run on newer systems, but thousands of old and new games still run on it
its a visual novel engine
yeah, i wrote a test script to test this a couple years ago and just had it sitting here, tried it again today and the results are still the same
first two are the normal access
then the proxy accesses in pairs, this version, no this version
server{
listen 80;
server_name http.capy.pics;
location / {
try_files /home/ubuntu/capy/$uri /home/ubuntu/capy/$uri.png @redirect;
}
location @redirect {
return 301 https://capy.pics/;
}
}```
always returns to `@redirect` 
and for some funny reason, the .bind() versions are the fastest
and the Reflect version is the slowest
is there any way to successfully run javascript functions "simultaneously"
concurrently yes, in parallel no. with worker threads however, its possible to run in parallel
mkay, so in a sense its impossible to run it in parallel without using 'seperate' workers?
yes because js is single threaded
damn the day a multi threaded version of js is released someone will take over the world lol
i believe the v8 devs said at some point it would be near impossible to accomplish that
Interesting, also I love the one with just 9
xD
this is the full script ```js
const obj = {
str: "a",
test1() {
for(let i = 0; i < 9999999; i++) {
this.str + this.str;
}
},
test2() {
let str = this.str;
for(let i = 0; i < 9999999; i++) {
str + str;
}
}
}
let a = new Proxy(obj, {
get(target, key, receiver) {
return Reflect.get(target, key, receiver);
}
})
let b = new Proxy(obj, {
get(target, key, receiver) {
return target[key];
}
})
let c = new Proxy(obj, {
get(target, key, receiver) {
return target[key].bind(target);
}
})
let d = new Proxy(obj, {
get(target, key, receiver) {
return obj[key];
}
})
let e = new Proxy(obj, {
get(target, key, receiver) {
return obj[key].bind(obj);
}
})
t = performance.now(); obj.test1(); console.log(performance.now() - t);
t = performance.now(); obj.test2(); console.log(performance.now() - t);
t = performance.now(); a.test1(); console.log(performance.now() - t);
t = performance.now(); a.test2(); console.log(performance.now() - t);
t = performance.now(); b.test1(); console.log(performance.now() - t);
t = performance.now(); b.test2(); console.log(performance.now() - t);
t = performance.now(); c.test1(); console.log(performance.now() - t);
t = performance.now(); c.test2(); console.log(performance.now() - t);
t = performance.now(); d.test1(); console.log(performance.now() - t);
t = performance.now(); d.test2(); console.log(performance.now() - t);
t = performance.now(); e.test1(); console.log(performance.now() - t);
t = performance.now(); e.test2(); console.log(performance.now() - t);
so i guess you can only make the illusion of running parallel javascript, reality being its running on separate workers or worker threads?
pretty much yes
and thats why most people including me prefer to live in an illusion, so much better than reality
its not much different from what other languages do, just that workers are more complex and more expensive for js
since they need an entire new engine environment
so the cost to output is not worth it?
depends on the job
so for something thats just registering things, it can just queue them up during a high and reduce that queue during a low, but for things that have to do smt instant on a large scale, its worth it?
if the job is big enough that it blocks the main thread for more than a few ms, then yes it would be worth it
also if you have many jobs like that, its preferable to keep a thread always alive
instead of creating and destorying them
so a project thats constantly getting an input that needs to be checked by pinging a server, you couldnt have it running while waiting for the ping to return so itd back up unless you had multiple workers running?
i/o does not block js
files and network requests are not handled by js itself
so while js is waiting for a ping to return, its actually idle, not blocked
so it can run other things
but for example
await dns.lookup("google.com");
depending on the latency could back it up?
Zamn (after changing let to const since none of them are reassigned, and some style changes, but doesn't really matter)
ye, its funny how the proxied version without direct this is actually faster than the non proxied version
and the binded versions are also faster than the non binded versions for got knows why
no, that will not block the program
so with something like a script that you input names into and it checks if any of 702 domain extension of that name exist, would take quite a while
that specifically does, when i was testing with it certain domain extensions would hold up the entire program for upwards of 10 seconds
hmm, so how would one un-idle it?
awaiting promises does not block the whole program, it just pauses the execution of the current context
so for example, this uses promises. All it does is check if google.* exists for any of the 702 domain extensions added
when monitoring it by the added console.log(hostname) in the dns.lookup, i noticed that certain domain extensions froze the entire script for upwards of 10seconds
most likely just my shoddy coding skills or ive missed smt
hmm
well for dns.lookup specifically it has the following conditions:
Though the call to dns.lookup() will be asynchronous from JavaScript's perspective, it is implemented as a synchronous call to getaddrinfo(3) that runs on libuv's threadpool. This can have surprising negative performance implications for some applications, see the UV_THREADPOOL_SIZE documentation for more information.
ok running it now it holds up for at most a second at certain points, so most likely wifi issues when i last tested it, but still a small noticable buffer on certain domain extensions
so ive probably understood incorrectly, but i was using it wrong?
no you're not using it wrong, but your code could be greatly simplified
i mean makes sense, im still a newbie to javascript
const dns = require('dns');
const domainextensions = [...];
Promise.all(domainextensions.map(domain => new Promise(resolve => dns.lookup(`google.${domain}`, error => resolve({hostname, exists: !error}))))).then(listOfStatuses => console.log(listOfStatuses));
``` well technically its an exagerated one liner lol
but using Promise.all is not a good idea when doing network requests
because it can be considered/confused with a DOS attack
basically you're flooding google with hundreds of requests at once
;-;
so a more correct approach would be this, even if slower ```js
const dns = require('dns');
const domainextensions = [...];
const results = [];
for(const domain of domainextensions) {
const test = await new Promise(resolve => dns.lookup(google.${domain}, error => resolve({hostname, exists: !error})));
results.push(test);
}
console.log(results);
yeah
if performance becomes too bad, you can try grouping multiple requests together, for example 5-10 at a time
so its entire documentation is
Usage
const tlds = require('tlds');
console.log(tlds);
//=> ['aaa', 'aarp', 'abarth', 'abb', 'abbott', 'abbvie', 'abc', ...]
dafuq am i meant to get from that
so like what does it do...
@spark flint
oh wait im dumb
it just returns all possible tlds
yeah
const dns = require('dns');
const tlds = require('tlds');
const results = [];
for(const tld of tlds) {
const test = await new Promise(resolve => dns.lookup(`google.${tld}`, error => resolve({hostname, exists: !error})));
results.push(test);
}
console.log(results);
sorry i dont think it was name.com
cant remember the site
long story short it gave me 702 after i removed the non english alphabet ones
mkay ill make sure to switch to that
and preferably not attempt a ddos attack accidentally XD]
i was working on at one point a bot thatd try to retrieve the websites code and check it for anything malicious and i mean it worked but missed 50% of the malicious code lmao
just use https://anti.fish at that point
best antiscam api
so any malicious site has a 50/50 chance of bypassing lol
ill check it out
do you have a file.png in your /home/ubuntu/capy/ folder and you went to http.capy.pics/file.png?
yeah
well i went to 404.png because thats deffo there
https://http.capy.pics/404?1 example
ay what
why does it work now I ask for help
wtf
lol
lel

you made http cats into http capybaras?
time to add caching too
lmao
and thats asking for help in a nutshell
10/10
made 65 capybaras
its broken till you try to show someone
https://http.capy.pics/508 best one
When your issue gets resolved on it's own
tho in most cases it works till u try to show it off
i think its just CF caching too
Let's see, https://http.capy.pics/418
lmao
10 doesn't exist
dafuq did i type
love that one
418 best HTTP code
i give up
you need to type a valid http code
basically anyone that https://http.cat has this has
ik i realised that after failing twice lol
so i managed to put together a basic ai that my friend talked to for an hour before realizing its an ai... now the problem is i dont know if i made a good ai or if my friends just oblivious
eh i mean he spoke to a ended phone call for 2min before realizing it had ended just yesterday so i mean...
xD
i need a new friend, this ones broken
naa but hes that fun friend, the one u know u can talk to without it getting serious, a good dude to just chill and have a blast with
whats ur view on selfbots? like theyre bannable but still possible in v13
but now comes the puncher, it depends on its usage lmao
also for any anti-scam people, new scam name
i laugh it was just a dude who liked emails
lmao
its deffo a scam
the username matched API filters
wait no pfp
not username
or again, a dude who loves emails a lot and uve just crushed his dreams of becoming an emailer
💀
lol
https://http.capy.pics/409 causing conflict
Looks like they're about to kiss
That one fateful day, the day I joined the nightmare of discord...
All I was was an email lover, ever since the first time my grandfather sent me an email, I've always been fascinated with them! What better to name and use as a profile picture for my discord account than an email! Both my love and social lively hood would be on the line but whatever, I loved it!
I had barely logged in before being banned... They accused me of horrible things, all because of my email love... Discord, a nightmare of email haters! I shall never step foot in that hellhole again
lol
Amazing story, cried at the end
XD
how do u plead @spark flint? After crushing this poor childs dreams of being in love with an email?

I rest my case judge
he deserves to be locked up
bloomin' email hater
what a cruel man
lol
Interesting API errors to see for one thing lmao.
Still braking TOS
Lmao watch ur discord account get termed
Still not a good thing to have
Why do you even share accounts
You’ll get banned on valid and too
Valorant
"You can't share your account or Login Credentials with anyone. You must keep your login credentials secret."
Yeah but you can’t really style it well on Disxord
no, very different

Lol
🚓
That's going to fall onto deaf ears
call the poopooleeheece
Meop meop
bump
sooo any ideas why it still gets input from other people?
Istg that's how you do a collector I repeated what voltrex told me
You're passing the filter as an option called f, it's supposed to be called filter
really? that's an actual requirement??
this is what makes me question him sometimes

🤷♂️
what is that?????
failed, reason: connect ENETUNREACH
that shit leaked my VPS's IPv6
Error NETwork UNREACHable
means address could not be resolved
so u probably mistyped something
or the other side is closed to the world
Do what? The rich presence?
I guess so, I still want to know how to do it
Then you need to use the Discord GameSDK to do so
https://discord.com/developers/docs/game-sdk/sdk-starter-guide
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
You can also use Discord-RPC but it's deprecated, so it's recommended to use the GameSDK
okay thank you very much
Yes
Then look at my previous messages, I've outlined what you can use to do so
I don't understand what should I do? Dm me
It's only available on PC, right?
Yes
okay thanks
not really
I wrote a script for rich presence that works on any platform even android
Can I trigger an event every time a message comes on youtube live streams? Or should I check periodically and check incoming messages in the meantime?
I guess I can't check incoming messages simultaneously
interaction.component.value?
not working
what does it say
but i will try again
o is that an array?
of objects
if thats an array of objects
const d = array.find(data => {
return data.label == "Dota2"
});
console.log(d.value)
there is no single option
wym
so like u want to pull values of all objects in that array?
i have 10 options
yea?
how do i get the value of all
undefined
interactions.component.forEach(d => console.log(d.value))
interaction.component.forEach is not a function
is interaction.component just an object or an array?
components
💀
it says component in document
i am trying to make a react role system with select menu.
object
hmm
actually prints the selection menu completely

for each users realising it has a ton of overhead and there's no way to stop it other than setting some closure variable
whats overhead?
Hello
Hello
in lays terms, extra resources dedicated to a task
i.e. the entirety of the node ecosystem
It's literally mentioned in https://v8.dev/docs/torque if you read it carefully
This document explains the V8 Torque language, as used in the V8 codebase.
i see
The Torque compiler is located at https://chromium.googlesource.com/v8/v8.git/+/refs/heads/main/src/torque/
You can have a look at https://v8.dev/docs/test on how to build the cctest executable to test out your Torque code, as well as compiling them
It's also pretty important to notice how Torque generates code (https://v8.dev/docs/torque#how-torque-generates-code)
This document explains the testing framework that is part of the V8 repository.
This document explains the V8 Torque language, as used in the V8 codebase.
generates c++ same thing as assembly
@quartz kindle this you? https://www.youtube.com/watch?v=VchuKL44s6E
This python tutorial aims to teach you python as fast as possible. This python speed course will cover all the fundamentals of python and give you a quick overview of all of the main python features.
⭐️ Thanks to Simplilearn for sponsoring this video and giving you all a 10% discount on their Data Scientist Master's program by using the code: Y...
Someone know if in sql we can do a where on all column value like Where *=1 ?
In the facts i would get all column where the bit is at one
ig u need to add all column names in bracket after where but before =
or idk try adding * in bracket prolly not work
what db?
do you mean do bitwise operations in where queries?
no, they probably mean matching all columns against a value
like, if all columns are equal to something
ik in postgres u can, but idk what database it is
thats just where x = y no?
yes but for all columns at once
that'd be the sensible answer
tbh the true question here would be why they have a scenario where all columns hold the same value
IDs people? where IDs?
yeah its a pretty common query type
for example if you store emails in a table and you want to only fetch emails that are archived or active
but that wouldn't be comparing ALL columns to a single value
lmao
Mysql
True
That what i want or something which act like that
mind to explain your exact scenario?
Sure let me 15min time to i get back at home
So as i said previously i have a tables as :
CREATE TABLE `model_hl7` (
`idModel_hl7` int(8) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`ACK` BIT NOT NULL DEFAULT 0,
`SRR_S06` BIT NOT NULL DEFAULT 0,
`SRR_S07` BIT NOT NULL DEFAULT 0,
`SRR_S08` BIT NOT NULL DEFAULT 0,
-- 300 mores bit
)ENGINE=InnoDb DEFAULT CHARSET=utf8;
I have ~350 column of bit type. but if every time i do a request like ```sql
SELECT * FROM tables
it's not very optimizing so its why i need to select ONLY column where the bit it as 1 but i won't do a request of 35000 line cause i have ~350 column
- Nodejs/Javascript is going to cache all of them so it going to be bad
that why i said i need to made a where on value and not on specific column
with your current structure you're wasting 7 bits for each field
it'll be the exact same thing but coalesced into a single column
any data must be represented by at least 8 bits
okok
So how could I do it? properly
i gotta implement a error and message handler on my site
worked with ejs
any suggestion
with bitfields, although you'd need to use more than one field to be able to represent 150 fields
lemme check what's the biggest mysql integer type
ok bigint it is
first of all, do you need 150 fields?
what are they for?
currently i have 353 event
ok, what are they?
so 353 fields
Contretely its the list of HL7 trigger event (https://hl7-definition.caristix.com/v2/HL7v2.5.1/TriggerEvents)
HL7 Standard Specification Reference
For my app i just need to know if the user is going to use them
So yes = true no = false
so i have to make a function who's decoding the bits?
not really, mysql has means to do bitwise ops
doing bitwise is basically treating a number as an array
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
this a bigint
yep
for bits it's always right to left, so first index would be the rightmost bit
to get it, you do (bits >> index) & 1
>> moves the bits to the right by specified number
so let's consider number 0100
if I do (0100 >> 3) it'll move the bits 3 places to the right, resulting in 01
when we do bits & 1 we're doing an AND operation to get bits that exists on both sides
so 01 & 1 (leftmost bits are irrelevant) will result in 1
which u can consider as true
since mysql has a bit field it most likely means they automatically do this kind of thing in the background
10 & 1 results in false, because first bit is false in one of the sides
oh, good to know
dont know tho
although I'm a bit skeptical on letting mysql "handling" stuff
but it would make sense since the smallest realistic type is a byte
but how im supposed know the 64em bits equals to "DKT_848"
you don't, you'll check if the index is 1 or 0
bitfields shouldn't be treated as a whole, they're just another form of array
an efficient array at that
you just need to map each event into an index
okok that what i would know so with this now i'm not losing bits anymore
you'll be wasting a few bits since the count isn't a power of 2
yep
31 bits to be exact
