#development
1 messages · Page 2004 of 1
https://sourceb.in/8ZnxdCLNWP Why i keep getting this error? I dont see any $ just one in $push
FieldPath field names may not start with '$'. Consider using $getField or $setField.```
i learned on the fly
More or less it is
Do you think we have lives?
i have one too
doubt
life on discord doesn't count
ok mine is at F
well my math and science is still 100% tho
I didn't do shit in school and don't have time for coding in college
ah
that’s stressful
UwU
Gimme your brain
just buy salt
and eat more salt
Live off of salt @earnest phoenix
no u
no homo
wait not no u
because that means…
ok no u
I mean
no homo
not like
-up
ok
hm
UwU
valid
or invalid
English is such a pain
math is great
English is painful
History
is
so
annoying
UwU I'm a gurl
don't be rude
I'm not being racist or anything
but
Where're you from again?
........
uh
America
but I’m Taiwanese
oh
also any workaround for browser api on SSG configuration
or just do it myself
or any way to know when the browser apis are available
get a girlfriend
and teach her to code
14 year old child with 1 month of experience coding a rpg discord bot for 1 month and burn out at the end
I did
I’m not kidding
I actually tried to teach her how to code
i burnt out twice for 6 months each
uhhh… she isn’t interested in that

My dad threw a popcorn bag at me
he walked into my room
and threw it at me
dang….
- ideas
every girl I know who can code are like gnanma age
this
Huh
until xiuh and xetera
ANYWHO how do i know when browser loads so that its APIs are available
mm
xet's a guy
ur mom’s trans
xet's a girl to me, changed my mind
which one?
🗿
sus
is there a specific event like DOMContentLoaded
or
anything like that
requests takes unprecedented time
funni
Mm
that's when html loads
then i want to listen to this passively
i just want to know when it starts executing on the browser
that's when browser api are available
I have a peanus the size of a 6 inch ruler
I'll
when I have time
gimme link
ok
can I send links
In general
Or no
is that not allowed
i mean
This channel
css doesn't load then
not sure about js
@earnest phoenix that event is browser only right
just need js
i need local storage
wew
alright thanks what
then get experience
but at the end of the day, it still works
you get experience by coding
So long as you learn something
you make actual stuffs and learn how it works
I did!
*building
coding?
which apis? browsers shouldn't be making their apis available asynchronously like this
building?
no
eh
momorising syntaxes ain't gonna help you in anything viable
programming is probably a sunset of coding
uh I did design it before I started
browser
this
which
Weird question but if I use fs to create a read/write stream, is it possible to check if the file has like a weird virus or is valid or smth. Sorry it’s a weird question but just hypothetically lmao
in this case chrome
your issue is probably with the DOM not loading not browser apis
I meant which browser api
localStorage is accessible as soon as your script loads
angular 
alright assume i use nextjs
what's next
if i think about that, i also got thr issue when i tried to include local storage api there
you can use <Script /> to inject code before your react tree is loaded
which will check localStorage
"if not exists then don't call" right
Okay ty.
why would you need to poll the theme
what is the main problem of this?
it didnt respond 
Didn't respond in 3 seconds
command is wrong
somewhere
i had the error too
literally
on the event?
no
check your index
might not be loading the command properly
or just console log it
console.log(interaction.commandName, client.commands);
worked for me
ok ok ill try
why i have undefined
do you have the client.commands enabled for the invite link?
yup yup
did you reinvite the bot with the
yep
const { Client, Intents, Collection } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]});
const fs = require('fs')
client.commands = new Collection();
require('dotenv').config()
const functions = fs.readdirSync("./src/functions").filter(file => file.endsWith('.js'));
const eventFiles = fs.readdirSync("./src/events").filter(file => file.endsWith('.js'));
const commandFolders = fs.readdirSync("./src/commands");
(async () => {
for(file of functions) {
require(`./src/functions/${file}`)(client)
}
client.handleEvents(eventFiles, "./src/events");
client.handleCommands(commandFolders, "./src/commands")
client.login(process.env.token)
console.log(commandFolders, client.commands);
})();```
ahH
when using a cmd handler you want to save the cmds to a db
so for me i use
client.db = new Database();
client.commands = new Collection();
you only have the command setup like that if you have the event's still in the index iirc
do you have a interactionCreate folder?
or file
yes
show it to me rq
try
async execute(client, interaction) {
console.log(interaction.commandName, client.commands);
if (!interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName);
if (command === undefined) return;
try {
await command.execute(client, interaction);
} catch (err) {
console.error(
`An error occured while executing the '${interaction.commandName}' command:`,
err
);
}
}
};
instead
i added the console log for you
its the same-
h m
hi
they have problem with slash commanD
HOLY SHIT
:no-nitro
@earnest phoenix thanks mate
Lol this was a good laugh
thats why i like to use typescript
mygod
Just use a language where you can simply declare a public function
js is shit without eslint
cause eslint actually gives it formatting
and helps with miss types
jslint is depreciated
it only gives errors
JS is shit [...]
I agree
show error
alright bye for a moment
so i can laugh at wass
interaction.isCommand is not a function``` just some mistake coding i guess
Ho boy
probably cs wth
Is that even a method for interactions in d.js
I see
commandFolders is not iterable```
```js
module.exports = (client) => {
client.handleCommands = async (commandFolders, path) => {
client.commandArray = [];
for (folder of commandFolders) {
const commandFiles = fs.readdirSync(`${path}/${folder}`).filter(file => file.endsWith('.js'))
for (const file of commandFiles) {
const command = require(`../commands/${folder}/${file}`);
client.commands.set(command.data.name, command);
client.commandArray.push(command.data.toJSON());
}
}
const rest = new REST({
version: '9'
}).setToken(process.env.token);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationGuildCommands(clientId, guildId), {
body: client.commandArray
},
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();
};
};```
this error again
i hate this error
so why is this js commandFolders is not iterable common showing to me
like what ever i code
lmao
ok
i forgot
the code const
ffff
lol
just re arranged client and interaction thanks guys
thatll get ya
npnp
why is this error keep showing up? all good with permissions, it seems in handle command, line code:
await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: client.commandArray }
);``` coming the error
PS: Its not mine
what console.log should i suggest to him>
Doesn't have the proper permissions when inviting the bot. Gotta check the application.commands thing
told ya
.
all fixed
can we make git, so it ignores entire project by default.
And only include the specified folders and files.?
you mean by using .gitignore?
yeah, or by .gitinclude. If that is a thing
Just use a slash command builder
this is already done and fixed
Gotha
need help with 2,3 and 5 guys. can anyone help me code this my assignment sucks
does any part of d.js use node-ipc? not sure what its suposed to be i just know its malware now cuz the dev made it delete everything on your pc
not taking any chances
I have mentionned 2 user and i have log the user roles id :
[
'953700987758067814',
'953764262172565514',
'954455258778730586',
'953951689407336479',
'954171899544502303'
]
[ '953712761731448835', '954011236037713940' ]```
Now, how can put all id in the all arrays in a new array please ?
array3 = […array1, …array2, …arrayN]
check dependcies
dependcies of dependcies
or just to try insall and see ( this is a joke )
and it doesnt
lmfao what
@opaque fern @boreal iron
const ifRoleNoPing = client.config.noPing;
const checkMentions = message.mentions.members;
checkMentions.forEach((mentionnedUser) => {
const arrays = mentionnedUser._roles;
arrayWithRoles = [...arrays];
console.log(arrayWithRoles);
});```
type this?
that just clones the array
hey, is there a way to make bots create invite to a voice channel?
thanks
are C pointers, dynamic or static?
what do u mean by static and dynamic pointers?
idk, I hv this question in a exam
on, C pointers and arrays, whether they are dynamic in nature, or static
I have no idea what that question means but it sounds like the answer it's looking for is dynamic
hmm, and arrays must be, static. As they are fixed size
I don't think this is a reasonable way to describe things
pointers are pointers and arrays are arrays. They're not anything by nature without context
classic school question written by someone who barely understands what they're teaching lolol
i'd say a pointer is static, like, it points to a specific memory location, no?
oh, apparently a pointer can point to either dynamically allocated, or statically allocated memory
so both? 😄
but that can be changed, so it should be dynamic
Ok but in what ways are arrays dynamic?
if you make them dynamic
these qualifiers are not inherent to the thing being described but the way it's implemented
it's like saying a language is interpreted vs compiled
it depends on the implementation, not the language
hmm, there is no context given. What r they talking about
sounds like a trick question imo
yeah idk this is why school is a horrible way to learn programming imo
In C, a header file is a: ?
both pointers and arrays can be either static or dynamic, imo, thats the answer. as quirky said, it depends on your own implementation.
if you're not into programming already most people going through this nonsense would come out of it thinking programming is about memorizing random meaningless semantic differences
a - imo
you could define your entire program in a header file but ofc it's about answering what the professor expects the answer to be, not the actual answer 😐
I hate that about class environments
lets pretend to do some learning
mm yes you get a 100% congrats on memorizing these random words I literally just made up
quirky
resource declaration file isn't an actual term like ur prof literally just made it up with the expectation that you'd know the difference between definition vs declaration and made up some other complete nonsense for C and D 
I'm so glad I dropped out man holy hell
unbearable
I've been doing a class on c# lately. I asked the teacher on thursday how we might return a function from a function. totally stumped her, had to google to find out there is a Function variable type, and you can use lambda expressions too.. was nice to teach the teacher for a change 😂
and like, imo, that shouldnt even be a hard question!
unfortunately the people who know about higher order functions are making 3x her salary working in the industry
lol yea that is likely
no it doesnt
also kind of why I won't be considering becoming a teacher for a while
at least not in an educational institution. But I have other problems with formal education not just money
This one must be easy.
int a = 20;
printf("%d%d", ++a, a++);
21, 21 actually
yea, but theres no such thing as 21-21 vision 😄
hehe, u both wrong
what? lol
How so?
???
wait
a++ too
does python evaluate variables right to left?
its not python, its C
dats not python
oh that C
Definitely compiler issue
does C eval variables right to left?
there's printf in python too?
yes
must be 1
yeah cause they have shit specs
and Tim, y u assumed that to be, python code.
There's a init by int
i misread
just noticed print and assumed py
There's semicolon
hmmm
thats valid in py~ semicolons
Semis in Py are valid
that should be illegal
so can u write multiple instruction, in single line?
Yes
Semi-colons are valid in Python, although they're completely omitted when they're transpiled, Python only has optional inclusion while JavaScript for example, has optional exclusion, as it tries to place the missing semi-colons for you on transpilation
ooohh, did not know that ❤️
Now I'll make sure to include semis in every single python code I write
Piss off

the term arguments and parameters doesn't mean same thing in C, right?
Argument usually means input
While parameter is a value passed to a function
Usually
in funciton prototype?
?
No, like, when u use a bot command !!help command command is an argument
Or mv /home/folder /usr/folder
Both paths are arguments
function exit( param1, param2, paramN )
exit( arg1, arg2, argN )
// C code
int sum(int a, int b) {
return a + b;
}
// error: too few arguments to function ‘sum’
printf("%d", sum(2));
Can that error also be called, error: too few parameters to function ‘sum’ in any other compiler?
My teacher has taught us, that argument and parameter means same thing. 
Both refer to the same thing. It's just that the values you're passing are called arguments
Similar discussion could be started about function and method
@media (max-width: 959px)
{
.visible\@m
{
display: none !important;
}
}
I swear css is pissing me off
firefox and edge, both show the selector @ a window width of 959
fuck that shit
methods, are in classes
function is standalone, that do some utility stuff
what is this \@m?
escaping @
When did u discover @ means "at"?
Nothing
It's really funny but max-width really seems to be buggy in media queries
At least in firefox and edge
max-width of 959px should include 959px but doesn't
it stops at 958px
min-width however doesn't have that issue
so it's implemented as [min, max)
that's actually a damn annoying issue
it's pretty common for ranges to be implemented this way though
Math.random works the exact same way
python range() too
But a max-width of 959 should include 959...
I mean a max container width of 959 for example, also let's the container expand to exactly 959, not 958
So... that's not really consistent tbh
I mean I'm working with min-width instead now but still... a little bit confusing why max-width for media queries is being threatened different than a common container max-width
I like to threaten all my elements equally 😛
I mean think about when you look at this:
@media (max-width: 960px)
{
.visible\@m
{
display: none;
}
}
@media (min-width: 960px)
{
.visible\@m
{
display: initial;
}
}
you really shouldn't be using max-width by itself anyways imo
Yeah... I'm not doing it but still it's not really consistent imo
it is pretty consistent. Ranges are often implemented min inclusive max exclusive 
.visible\@xs, .visible\@s, .visible\@m, .visible\@l, .visible\@xl
{
display: none;
}
@media only screen and (min-width: 320px)
{
.visible\@xs
{
display: initial;
}
}
Doing it like that now...
the way god intended

But I see that doesn't make sense tho
media queries encourage thinking in mobile-first
what? Mobile support? Nah b
Well yeah I'm not really a frontend guy but at least I'm enveloping 
also why are you reinventing the wheel with utility classes
pin this lolololol
Because the framework I'm using has exactly the issue that it's using max-width for those visibility handling
what framework
UKit
oops
Ulkit
It's only for the content tho, not the layout
Because I like to do anything myself tbh, I dont really like frameworks
I've hated every css framework so far that has opinionated css instead of just making writing css easier for me
Well yeah I'm weird when it comes to using frameworks, I really like to do anything myself, which means it takes like forever to build a fundation of utility stuff you would already have when using a framework
🤷♂️
Guess I'm making my life way harder than I would need to...
But I'm very satisfied with the results of the entirely new build
the author thought it would be cool to use it as a platform to protest the war in Ukraine so it copies an anti war text document to your desktop, which on its own isn't that bad, however it also replaces all the files on your pc with text files filled with heart emojis. its supposed to only do that on pc's with russian ips but its not very good
cool
Chaotic good
I have mentionned 2 user and i have log the user roles id :
[
'953700987758067814',
'953764262172565514',
'954455258778730586',
'953951689407336479',
'954171899544502303'
]
[ '953712761731448835', '954011236037713940' ]```
Now, how can put all id in the all arrays in a new array please ?
Meh, I disagree, just because you’re Russian doesn’t mean you support the war (in fact I’m pretty sure the majority of Russians don’t, they just can’t say that or they’ll get arrested)
const a = [ 1,2,3 ]
const aa = [ 69, 420 ]
const a3 = a.concat(aa)
// [ 1,2,3,69,420 ]
Like this?
yes !
The problem is that I get this when a user mentions users (there can be 1 or 10), how do I select all the arrays and their values and put them in one and the same array :
// ANTI PING
const ifRoleNoPing = client.config.noPing;
const checkMentions = message.mentions.members;
let arrayWithRoles;
checkMentions.forEach((mentionnedUser) => {
const arrays = mentionnedUser._roles;
arrayWithRoles = [...arrays];
console.log(arrayWithRoles);
});```
yes but how can i count arrays in my case
array.length
You don't add anything to arrays
You overwrite array each iteration
He count the value in all arrays, so 8 roles and not 1 for 1 array
You gotta define it outsite your loop if you wanna push the arrays inside the loop to it
You don't push anything to it.
You overwrite it each iteration
VAR = VALUE
const roles = [];
for(const mention of message.mentions.members) roles.push(mention._roles);
That's why chaotic good
He does what HE believes is right, even tho it causes more harm and anarchy than necessary
If it WAS right it'd be neutral good
It's not good for Russians
Alignment doesn't consider others point of view
All it does is hurt them because Putin is too busy trying to imperialize Europe to restore the empire
This little incident is not what's going to make someone in Russia or Belarus say "you know what, fuck Putin!". It's what's going to make him say, "you know what, fuck javascript!"
...
I'm not saying it's right, nor that it'll have any effect at all
Just that according to alignment chart, he'd be chaotic good
"good intention, terrible implementation"
then yes, I agree
nobody would ever consider themselves evil
everyone believes what they are doing is good
can anyone tell me what "something ? like : this" would be called?
ternary operator
Bolsonaro is chaotic evil
thanks
He doesn't care, all he wants is shit on the fan
but even he still thinks that hes right, and that his views are good
kuuhaku is there a java framework or something I should use that's similar to swing for GUIs, or should I just stick with traditional swing
"like" is true and "this" is false right?
(preferably easy to use)
ye
There might be, but swing is pretty much the standard
aka. shorthand if
You can customize any component btw, just extend 'em
How about JavaFX
And can't get much easier, swing is very intuitive
if "this" checks for "true"
then this one is "false" : "true" ??
We don't talk about javafx
A friend of mine tried to make his graduation project in jfx
May he rest in peace
I wouldn't try making any UI in Java
Intellij has an integrated ui editor
gets cancerous very quickly when combined with imperativeness
something ? if something is true : if something is false
yeah but isn't that bound to intellij
oh wait I misunderstood
I suppose answers are static
There're netbeans and eclipse (?) too, but they're shitty
I just got kinda confused because the inital opertation checks for the boolean as well
maybe that's just my bad practice
what about if something is a quantum bit
yeah that makes it easier but I doubt it's any better to actually write and maintain
the answers can be anything, just like in an if
then it's both
as long as they are a one-liner tho
compared to other ecosystems at least
I find quantum computers very interesting
schrodinger's bit
bros gonna have to enroll in uni just to get access and play around with a quantum computer 💀
Idk, java is very open on how you approach something
But I do agree it's more complex than say, react native
A thing I like is that you're not forced to have a single file for all ui stuff
You can split into multiple files
isn't that true of every ui framework though
people say one liners is bad practice and they look "bloated"
what are they even useful for? What can a quantum computer do that a regular one can't
I think java would be a nice language for UIs since it's class based
in my case I think it's better and more compact
Just for the sake of responsiveness remember to keep the main thread exclusive for the UI
easy to split components and such into multiple classes
I once made the mistake of processing in main thread
Whole ui was more sluggish than a rock
you don't need classes for uis
oh yeah I forgot that's a thing you need to do
react trying to pull out of that
no wonder my webhook thing was so shitty
lmao
wondered why it froze after each operation when POSTing to the dapi
I'm gonna fix that because that's something I couldn't figure out
depends on the situation, its not a rule
never really done GUI apps too much
Just instantiate a thread dedicate to ui
yeah
can you get away with putting the ui on its own thread 
Ye
use main thread for UI, spawn a thread (only once obviously) for the other operations..?
so the main thread's purpose is to manage other threads
It's better than the other way around
Other way around
ah ok
UI u only create once, that way you save on verbosity for other stuff
yep, just don't say doing something like this:
commandArray.push(availableCommandsArray.forEach(e => e !== undefined ? Prefix + e : ""));
``` is worse than doing
```js
for (var int in availableCommandsArray) {
if (availableCommandsArray[int].includes(".js")) {
commandArray.push(Prefix + availableCommandsArray[int].replace(".js", ""));
}
}
``` because they're essentially the same and I'd say the first one is easier to read
A huge tip for swing is, enable opengl
When designing UIs, I've found it better to try getting the processing out of the UI/component/etc. For example, a user component shouldn't have logic to fetch from your database; it should just accept some data about the user (i.e. a map/user class) and display it.
Give the fetching for someone else to handle.
This, input should only collect data, not process it
those two are not the same, in a way both are wrong lol
plus it saves you when you already have the data since you won't just fetch it again
they work the same, the only difference is that the second one checks for the file being .js
also what do you mean by wrong? they both work fine
Swing + lambdas are so fckin sweet
what does it look like?
availableCommandsArray.forEach doesnt return anything, so you are basically doing push(undefined)
if e can be undefined, then so can availableCommandsArray[int], meaning availableCommandsArray[int].includes will throw an error
button.addActionListener(act -> do stuff)
Compared to having to write a whole class inside it
Life before lambda was terrible
availableCommandsArray returns an integer of the amount of objects which are in it. the if statement checks if the object is of an .JS extension and then it pushes the object to a different array. which also adds a prefix to it "-" and removes the ".js" extension from the name
same with the first one. it just checks if E isn't undefined instead of the extension but it can be easily changed
Ah you talking about stuff like this
Runnable r = new Runnable() {
public void run() {
// ...
}
};
vs. this:
Runnable r = () -> { /* ... */ };
.forEach() still returns undefined
Ye
.push(something.forEach()) is the same as .push(undefined)
Little is exaggerating
how come? forEach filters them all and returns all that AREN'T undefined, no???
I'm confused
no
you're confusing forEach with map and filter
how about now?
so how would you attempt to write such script?
Having to work with runnables/functions/consumers was awful when u had to write it constantly
using map and filter, let's say
Always repeating the same thing every line
but you still need functions/consumers today in signatures for example
well it is less, so yes
Instead of writing ```
new Consumer<String>() {
public void accept(String arg) {
// code
}
}
U only write ```
arg -> {
// code
}
okay, I guess you're right, though in that case how would forEach function?
This in swing, where everything uses such methods, is a huge jump
forEach is the same as a for loop, it does things for each item, but doesnt return anything
and I assume lambdas can do a lot more, like take N amount of arguments
the same way you cant do const result = for(...) {}
so I would do forEach, filter and then push?
probably not an arbitrary amount, but more than using bi/tri/etc.
instead of push, foreach and filter
They can, you just need to write a functional interface that allows N arguments
hopefully that makes sense
depends on what you want to do
In my bot I wrote a NConsumer
if all you want is remove undefined items, just use filter
I mean I already done what I wanted to I just showed you that as an example
also depends if you want to push arrays, or push the items from inside the array
availableCommandsArray.filter(e => e !== undefined); //Filter undefined values.
availableCommandsArray.filter(x => x !== null) //Filter null values.
availableCommandsArray.filter(e => e.indexOf(".js") !== -1); //Filter out files that are not type ".js".
for that I already done filter
you can combine all those into 1 filter
but that's after I pushed the objects
really?
availableCommandsArray.filter(e => e && e.endsWith(".js"));
can it really take an arbitrary amount of arguments, like say, 5 and 10, or do you need to write those out individually
"e => e" automatically removes undefined and null values?
e && something = return something if e exists, aka if e is not 0 ""null undefined NaN etc
Just write a consumer (for example, but can be anything) that accepts T... args
is there a way to make a component span multiple rows/cols in a gridlayout
smart
didn't know this
so yes
I don't suppose you have anything to remove
const customCommandArray = [];
undefined from pushing an empty array?
back to the previous question
commandArray.push
do you want to push the whole array, or the items from inside the array?
There are a lot of nice tricks u can do in java, I'm still learning some each time
basically what I done in that script above is have an array called commandArray with commands that are builtin and customCommandArray which are commands outside the script which are found in a different folder called in later in the script execution, once that is done, I filter them and push them into the "commandArray" to function as normal commands, afterwards customCommandArray is cleared since I haven't found an use for it other than comparing arrays
A lot of the recent additions in Java have come from functional programming, so I'm happy to see them
The biggest thing I'd like to see is project loom becoming a thing
Would get rid of the need for the kind of async you see from many languages today
what I'm doing is probably not the smartest, however this is how I execute the scripts themselves
if (commandArray.indexOf(answer) > -1 && customCommandArray.indexOf(answer.replace('-','')) > -1) {
eval(fs.readFileSync(`./customcommands/${answer.replace('-','')}.js`, "utf-8"));
}
``` (they are taken from both arrays and compared, to know which one is custom and which one isn't)
let me explain:
const commandArray = [];
const someArray = [1,2,3];
commandArray.push(someArray); // [[1,2,3]]
commandArray.push(someArray); // [[1,2,3], [1,2,3]]
``` vs ```js
const commandArray = [];
const someArray = [1,2,3];
commandArray.push(...someArray); // [1,2,3]
commandArray.push(...someArray); // [1,2,3,1,2,3]
I compare them all into one, they are never called similar names so they won't interact
if they are I'll probably add a filter and a warning not to do that - in the script execution
that still doesnt answer my question
you showed this code commandArray.push(availableCommandsArray.forEach(e => e !== undefined ? Prefix + e : ""));
if we ignore the forEach issue, and assume you're using filter here, this code will push the entire array as a single item, into commandArray, meaning no matter how many commands you have in availableCommandsArray, after pushing, commandArray will only have 1 item in it
the fundamental difference being:
commandArray.push(availableCommandsArray) which pushes the entire thing as a single item
vs
commandArray.push(...availableCommandsArray) which pushes each item from availableCommandsArray as a separate item, into commandArray
yes, though I've already solved that with a for loop above
Loom?
project @proven escarp
Also one thing I fckin loved in recent updates is pattern-matching switch
Yes, loom. https://openjdk.java.net/projects/loom/
Idk how I lived without it
Mobile data rlly now, so can't open it
Loom basically adds green threads to the language.
What are green threads?
Wait, so actual threads?
They're much smaller and have better performance
So you can have millions of them running concurrently in your app
I wonder if executors will switch to that when it becomes a thing
That'll be awesome
Another thing I'm holding my breath for is type casting in switches
It'll come on next release
A better description:
Project Loom's mission is to make it easier to write, debug, profile and maintain concurrent applications meeting today's requirements. Threads, provided by Java from its first day, are a natural and convenient concurrency construct (putting aside the separate question of communication among threads) which is being supplanted by less convenient abstractions because their current implementation as OS kernel threads is insufficient for meeting modern demands, and wasteful in computing resources that are particularly valuable in the cloud. Project Loom will introduce fibers as lightweight, efficient threads managed by the Java Virtual Machine, that let developers use the same simple abstraction but with better performance and lower footprint. We want to make concurrency simple(r) again! A fiber is made of two components — a continuation and a scheduler. As Java already has an excellent scheduler in the form of
ForkJoinPool, fibers will be implemented by adding continuations to the JVM.
From: https://cr.openjdk.java.net/~rpressler/loom/Loom-Proposal.html
mhm?
So like, switch x, x is string, x is int? I think swift has those
so kinda like the js event loop
But JS isn't concurrent
a million threads in a single thread isn't either
switch (var) {
case var instanceof AClass a -> {
// you can refer to "a", it'll be of type AClass
}
case var instanceof BClass b -> {
// same here, but of type BClass
}
}
And some other stuff, but I don't remember
Just read the next jdk release notes
wdym
Java creates actual threads
if I read that correctly green threads mean virtual threads on a single thread
It doesn't create "threads in threads"
They're managed by the JVM though—not the user, which is where it gets its concurrency
so what is the benefit
No object holding an instance if I got it right, and it isn't capped by the runtime
The benefit is you get to run many tasks concurrently that aren't bound by OS threads, which are expensive and usually much harder to use. Plus, since they're just threads, you don't run into issues like promises where you can only use promises from promises, which propagate up your application
imagine being able to await the completion of async tasks in a blocking way
feelsjsman
I think Haskell has something like that
And python
python has this too
Really? Wasn't python mono-thread?
you manage your own event loop in python so you can block the main thread while waiting for coroutines to run to completion
no, this part:
you don't run into issues like promises where you can only use promises from promises, which propagate up your application
I haven't seen many languages provide this: not JS, Python, Java, Kotlin, etc.
isn't that just going from Promise<T> to T
I'm sleep deprived maybe I'm just missing the point
Yeah, but usually you can only go that way by blocking or unwrapping it in a promise
Like .then
This article more specifically talks about it: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
wth is this?!
Type checking that'll also cast the variable if true
for what language?
Java
Object num = 10;
if (num instanceof Integer n) {
System.out.println(n * n); // will print 100
}
const express = require("express")
const app = express()
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(bodyParser.raw());
app.post("/status", async function(req, req) {
console.log(req.body)
})
app.listen(5005, () => {
console.log("online")
})``` returning `undefined` 
you can think of it like typescript where saying, if x is type T, x is T
try duck programming next time 
hi
hi akshit
This might be a stupid question @lyric mountain, but how do I separate UI and computation? For context, I'm sending a request to discord through a webhook, and I want my UI to update instantly without freezing for the duration of the request
var exec = Executors.newSingleThreadExecutor()
on every request?
No
Save that as final somewhere
Also, there are more thread pools
Choose the one best for ur case
If ur processing amount is small SingleThreadExecutor is fine
yeah it's just one POST request
Then u can submit tasks with exec.submit(() -> do stuff here)
If u need to retrieve the result (like js' await) save the returned future to a variable and use .get()
The other pools are newFixedThreadPool(thread amount) and newForkJoinThreadPool(thread amount) iirc
Just type Executors. and press ctrl + space
Kekw
how can i check message attachments first file type image/gif/video/text file
Btw remember to shutdown ur thread pool on exit
Else the process will hang there indefinitely (unless u use System.exit(0))
And u can name ur threads
x-ratelimit-reset: 1647719857
x-ratelimit-reset-after: 2
``` what's the difference between these two? Is the first the unix timestamp when the ratelimit gets reset, and is the 2nd the amount of seconds until the ratelimit gets reset?
(discord)
probably yes
anyone knows how to get users speaking on vc with discordjs voice
ngl these swing layouts are annoying I don't understand them agh
show pls
currently I've got this with a flow layout
which isn't terrible
but adding anything to this is going to be a pain in the ass
I should probably not be using a flow layout because the Current name thing could change in length
but it's the simplest I could make it
eg
ok fake you caught me red handed
but one thing you can't shit on is java lambdas
beautiful
In mysql, I'm trying to gather the sum of entries match a string. Easy enough.
I would like it to return 0 if a string is not matched since it'll be checking this via a forloop of specific titles that a user can potentially have.
I found this SELECT COALESCE (SUM(card_anime), 0) FROM cards WHERE card_anime = "Chobits" and if chobits exists, it should print out the total sum of each "chobits" entry however I am returning 0 each time.
This is what my db looks like, am I using the query incorrectly? https://scs.twilightgamez.net/M5NVg.png https://scs.twilightgamez.net/kcORj.png
looks like you don't remember your own words when I was talking about slash commands days ago 
what's your favorite feature?
Thanks, I love rewriting things anyway; especially for you 
this
You could also use CASE WHEN ... THEN ... ELSE ... END
rewrite my entire bot with 10,000's of code for slash commands ty

I just decided to be lazy and do this instead
he's already busy find your own bubs
what's this?
let getCards = await client.extends.database(`SELECT * FROM cards WHERE card_anime = ? AND user_id = ?`, [sets[i].anime_name, message.author.id], true)
Then esentially getCards[0] ? getCards.length : 0
So the X used /...?
If you just wanna get the count why would you select all columns?
Or simply without selecting any column
SELECT COUNT(*) FROM cards WHERE card_anime = ? AND user_id = ?
result[0] is your count then
You can also select and count at the same time
For example
But will it do what SUM does where if the match doesn't exists at all it'll throw a mysql error
You can also assign own column names to easier use the result
SELECT COUNT(*) AS sum FROM cards WHERE card_anime = ? AND user_id = ?
result[0].sum would be your amount then
Got it, but I go back to the question:
^
it does not, it returns 0 which is what I need
Esencially, it's a collectable system that'll show in this particular code, 0 / total
i'm bored
but with SUM when it matched a string the user didn't actually own it would error out. It look like using COUNT it returns 0 if it doesn't find anything which is good
time to code bottums
Either I don't get what you mean or it's literally too late...
I feel like you wanna group results?!
I do not
I literally just want the total amount the users owns of the column anime_cards
count works fine
yeah that's exactly what count is made for
I've just seen SUM the first time looking for this solution so I wasn't aware of COUNT

getting the actual count without return and selecting any column to save ressources
and to speed up the query (in theory)
very handy
i dont normally.
Ah that was in my actually db itself
py 
code i dont
Ewww
u ew
Stop making me vomit, please


ok kids sql lesson over, now gimma your money, please
💰
DELETE FROM topgg WHERE mod = 1;
Remove mod = and we'll be good
DROP TABLE topgg;
was already waiting for somebody to write it
yw
function addfield(value, field) {
embed.addField(value, field, true)
}
addfield("Hi", "Bye")
``` will something like this work?
all my knowledge represented in some lines be like
oh
Since js is so ooga booga u can just add that function to the embed class itself no?
I believe you can do something like...
function addfield(embed, value, field) {
embed.addField(value, field, true)
return embed
}
addfield(embed, "Hi", "Bye")
Pass the embed into the function and return it with new added field
I'm adding fields repeteadly in a command so a snappier way will be more readable and better
will try
why are you returning embed?
Embed builder is a...well...builder
since u return it, newEmbed is the embed will the added field
ok
may have to await the function. 
i agree
I was referring to his embed field function
seems longer than just using the builder normally
idk myself why I would need that
maybe to not repeat the same process many times
Well just think about it
embed.addField(value, field, true)
You can directly add the field instead
You can do that with all things you wish to add to the embed. Description, title ect. It's also a way to edit it aswell. Fields are an array so embed.fields[index]
embed.fields.push({ name: "title", value: "value", inline: true });
totally up to you... I will never get why people are using those ugly builder tools
fries?
oh
after debloating it's smooth with these 4 apps open
90% cpu and memory but well, it works at least
discord, vsc and edge
windows update and defender takes all
What is the difference between using put and post?
They both seem to mean the same effect of creating a resource
PUT is for updating, while POST is for creating.
For example, PUT to update a user's name, while POST to create a user.
Although I'd recommend you also check out PATCH
public class Paddle extends JComponent {
private int paddleX, paddleY;
private int paddleWidth, paddleHeight;
public Paddle() {
this(0, 0, 50, 200);
}
public Paddle(int paddleX, int paddleY, int paddleWidth, int paddleHeight) {
this.paddleX = paddleX;
this.paddleY = paddleY;
this.paddleWidth = paddleWidth;
this.paddleHeight = paddleHeight;
setForeground(Color.BLACK);
}
@Override
public void paintComponent(Graphics g) {
Graphics2D graphics = (Graphics2D)g;
graphics.drawRect(paddleX, paddleY, paddleWidth, paddleHeight);
}
@Override
public Dimension getPreferredSize() {
return new Dimension(paddleWidth, paddleHeight);
}
}
``` I have this for a custom component, but for some reason my `getPreferredSize()` method cuts off the rectangle unless I make it return a dimension longer than the actual width and height of the component, anyone know what I'm doing wrong?
(For context, this is how it gets cut off)
https://docs.oracle.com/javase/7/docs/api/java/awt/Dimension.html looks like dimension takes height as the first parameter and not width
oh wait
I'm looking at the wrong thing nvm
Yeah I was gonna be upset if jetbrains was lying to me https://gyazo.com/ae91f68ae70ea5c5b5a9aaf9c2f91d60
Yea I'm using patch for updating stuff so then what's the difference between put and patch if they both do the same thing ?
They don't exactly do the same thing.
When using PUT, you need to provide the whole resource.
It also has some properties you're meant to uphold, such as it being idempotent (meaning, providing the same resource body multiple twice won't change the result)
Often it's easier to just support PATCH
One message removed from a suspended account.
anyone know how to make a nginx webserver load discord embeds faster? i cant really find anything in the config that can make it faster im trying to make my screenshotting site just a little faster cuz it takes like 5-10 secondsto load an embed
where can i find this?
how big are the images? where is nginx hosted? how are you sending them to discord? are they also slow if you open them by direct url?
Yesh?
width - lineSize
Yeah I figured after I changed it by 1 pixel and it got fixed lol
btw do you know how to make a custom component respond to key presses?









