#development
1 messages · Page 259 of 1
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)```
you use eclipse?
intelij
package backend;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
public class Connect {
String username = "dbadmin";
String password = "dbadmin";
String database = "quiz";
String host = "localhost:3306";
String connection = String.format("jdbc:mysql://%s/%s", host, database);
private static Connection con;
private Statement st;
private static Connect connect;
public static Connect getInstance() {
if (connect == null) {
connect = new Connect();
}
return connect;
}
private Connect() {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
con = DriverManager.getConnection(connection, username, password);
st = con.createStatement();
} catch (Exception e) {
e.printStackTrace();
}
}
public boolean insertUser(String userName, String email, String password, String gender, String role, String dateOfBirth) {
int newUserId = getNextUserId();
String sql = "INSERT INTO MsUser (UserID, UserName, Email, Password, Gender, Role, DateOfBirth) VALUES (?, ?, ?, ?, ?, ?, ?)";
try (PreparedStatement preparedStatement = con.prepareStatement(sql)) {
preparedStatement.setInt(1, newUserId);
preparedStatement.setString(2, userName);
preparedStatement.setString(3, email);
preparedStatement.setString(4, password);
preparedStatement.setString(5, gender);
preparedStatement.setString(6, role);
preparedStatement.setString(7, dateOfBirth);
int rowsInserted = preparedStatement.executeUpdate();
return rowsInserted > 0;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
private int getNextUserId() {
String sql = "SELECT MAX(UserID) AS maxUserId FROM MsUser";
try (Statement statement = con.createStatement(); ResultSet resultSet = statement.executeQuery(sql)) {
if (resultSet.next()) {
return resultSet.getInt("maxUserId") + 1;
}
} catch (Exception e) {
e.printStackTrace();
}
return 1;
}
}```
is it the code issue or what, my brain is not working now
have you added mysql-connector-java in dependency?
maven -> reload project
this uni makes everything harder
like you cant even use FXML... or javaswing
and if i am not mastaken i remember you also cant that.....
i amma cry, ill just make it into array local storage for now....
i need to reask them if i can do that
Like they should atleast allow you to use any lib coise in real life, they use dont always use the same lib
Ye i have to make a login page gui that is connected to mysql
Like from them even the lib version if i use 8.0.23
When its supposed to be 8.0.24
Thats a min -20% total score
what the fuck
No need from this project
Saved on db without any security messure
oooo
Yeah thats why i have to be really carefull for the lib and project stracture
And this project call for 70% of your total score
More then the exams
I really hate such tests
Type the class outside a string and see if it exists
If it doesnt, then the path is wrong
Wdm by that?
I am too dumb
The driver path you put in Class.forName is an actual class in java
Just type it out, as if importing
If the path becomes red then the driver path is wrong
Ah ill try it in a bit (moving class irl)
is there a way to make mongodb to dont create new database file if there already and exist one before?
i just want it to upload the same file but just update the timing
"upload the same file"?
here i give you how the bot save
New session started for user 263941845590081538 at Tue Oct 22 2024 02
55 GMT+0000 (Coordinated Universal Time) in channel 126498329177436
Session ended for user 932286343869005884. Total time: 131.897 seconds.
so it save something like this
_id
671710349f99bd1d213b1df9
userId
"263941845590081538"
guildId
"1204272641306005514"
channelId
"1214550847770337300"
joinedAt
2024-10-22T02:38:44.206+00:00
totalOnlineTime
0
__v
0```
Ok but wdym upload same file?
so once i reconnect to driifent vc in the same guild
the file above
it create another files same structure i highlight
i want it to update
totalOnlineTime 0
I...still don't understand, are we talking about files or documents?
That's a document
something like this?
No, get the string you were using before, remove everything but the string, remove quotes
If the last part in the resulting text is red then the classpath is wrong
How are you saving it? Are you using the same id?
this? my brain is too dead
guild and user id Yes same
Now delete Class.forName and parentheses
const mongoose = require('mongoose');
const onlineTimeSchema = new mongoose.Schema({
userId: {
type: String,
required: true,
index: true, // Index for faster queries
},
guildId: {
type: String,
required: true,
},
channelId: {
type: String,
required: true,
},
joinedAt: {
type: Date,
required: true,
},
totalOnlineTime: {
type: Number, // Online time in seconds
default: 0,
},
});
// Check if the model already exists
const OnlineTime = mongoose.models.OnlineTime || mongoose.model('OnlineTime', onlineTimeSchema);
module.exports = OnlineTime;
it save from this
But it's enough already tbh, see how Driver is red?
It means the class wasn't found
Thus forName won't work either
com.mysql.cj.jdbc.Driver is an actual class, you could just import it for all we know
But anyway, the path is wrong or you didn't install the lib correctly
Yes, see, not found
but it seem like other import work
What import?
the one above com.mysql
oh...
what pom?
That's the model, but where are u actually saving to the db?
Ok, raw it is then
you mean from the event itself right?
I mean where u call .save()
Go to the libraries screen and click add new, then select "Download from URL" or smth like that
const OnlineTime = require('../models/OnlineTime'); // Ensure the model is correctly imported
/**
* Function to handle when a user joins or reconnects to a voice channel.
* @param {String} userId - The ID of the user.
* @param {String} guildId - The ID of the guild (server).
* @param {String} channelId - The ID of the voice channel.
*/
async function handleVoiceChannelConnection(userId, guildId, channelId) {
try {
// Check if the user already has an entry
let onlineRecord = await OnlineTime.findOne({ userId, guildId });
// Get current time and set milliseconds to 0
const currentTime = new Date();
currentTime.setMilliseconds(0);
// If a record exists, update the `channelId` and `joinedAt`
if (onlineRecord) {
onlineRecord.channelId = channelId;
onlineRecord.joinedAt = currentTime; // Set to current time without milliseconds
await onlineRecord.save();
} else {
// Create a new record if one doesn't exist
const newOnlineRecord = new OnlineTime({
userId,
guildId,
channelId,
joinedAt: currentTime, // Set to current time without milliseconds
totalOnlineTime: 0, // Start with 0 total time
});
await newOnlineRecord.save();
}
} catch (error) {
console.error('Error handling voice channel connection:', error);
}
}
module.exports = (client) => {
client.on("voiceStateUpdate", async (oldState, newState) => {
// Check if the user has joined or reconnected to a voice channel
const userId = newState.id;
const guildId = newState.guild.id;
const newChannelId = newState.channelId;
// Only proceed if the user has joined a new voice channel
if (!oldState.channelId && newChannelId) {
// User has joined a voice channel
await handleVoiceChannelConnection(userId, guildId, newChannelId);
} else if (oldState.channelId && newChannelId && oldState.channelId !== newChannelId) {
// User has switched to a different voice channel
await handleVoiceChannelConnection(userId, guildId, newChannelId);
}
});
};
Download the lib from there, it'll configure classpath properly for u
it save form here too
See, ur creating a new document, it won't automatically grab the existing one
You need to fetch it then update the value before saving it back
You can also pass a package path to it to get from maven central
The format is group:name:version
just did it and it sent me a new error
java: package com.mysql.cj.jdbc does not exist
It's cuz u left the import there
It's still the same error but compile-time now
That's javadocs
But well, use maven central to get the package
Oh wait lmao
U got the wrong file
It's a zip
Java libs are jar
I believe the jar is inside it, unpack
const OnlineTime = require('../models/OnlineTime'); // Your OnlineTime model for tracking voice state
module.exports = (client) => {
const GUILD_ID = process.env.GUILD_ID; // Get the GUILD_ID from the .env file
// Track user voice channel join/leave times
client.on("voiceStateUpdate", async (oldState, newState) => {
if (newState.guild.id !== GUILD_ID) return; // Only track if in the specified guild
// User joined a voice channel
if (!oldState.channel && newState.channel) {
const userId = newState.member.user.id;
const joinedAt = new Date();
const channelId = newState.channel.id; // Get the ID of the channel the user joined
let session = await OnlineTime.findOne({ userId: userId, guildId: GUILD_ID, totalOnlineTime: 0 });
if (!session) {
session = new OnlineTime({
userId: userId,
guildId: GUILD_ID,
channelId: channelId, // Include channelId
joinedAt: joinedAt,
totalOnlineTime: 0, // Initialize total online time to 0
});
await session.save();
console.log(`New session started for user ${userId} at ${joinedAt} in channel ${channelId}.`);
} else {
// Update the session with the new channel and joinedAt time
session.channelId = channelId;
session.joinedAt = joinedAt;
await session.save();
console.log(`User ${userId} reconnected at ${joinedAt} in channel ${channelId}.`);
}
}
// User left the voice channel
if (oldState.channel && !newState.channel) {
const userId = oldState.member.user.id;
const leftAt = new Date();
const session = await OnlineTime.findOne({ userId: userId, guildId: GUILD_ID });
if (session) {
// Calculate the duration in seconds
const durationInSeconds = (leftAt - session.joinedAt) / 1000;
// Update the totalOnlineTime by adding the session duration
session.totalOnlineTime += durationInSeconds;
await session.save();
console.log(`Session ended for user ${userId}. Total time updated to: ${session.totalOnlineTime} seconds.`);
}
}
});
};
i am not sure why it recreated new doc
When downloading libs always get it from maven central, it's guaranteed to be correct
The text inside quotes there is what u put in Download from URL in intellij
Optionally u just download the jar from there, works too but more work
To find just type "[package name] maven central" on google
is it common to get timeout 10000ms for mongodb?
No
i have use the same database with the main bot and testing bot maybe could that cause a timeout?
That's a javadoc m'lad
Javadocs are, well, the documentation
Is the lib listed under Sources? If not then u probably just added to download the docs
i think this is now correct?
It depends, I don't know if it applies but if you're using atlas it might limit how many connections you can have
Yes
Now the import will become white
Which means that forName will also work
i think i use atlas the free one
See if it allows connecting if you stop other connections
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.```
oh wait
If it does then ur SOL
forgot to start the sql
It did work then, since it found the class
Maven central is a godsend for when u need a package, it's like npm or pub but even better
Since it indexes all packages from all main repositories
ah yeahhhhhhhhhhh finaly it work
Thankyou so much now i can do the backedn of this program
Nice
if only i know about mvn central
when i setup my javafx
-# (that setup took almost 2 week+ of debuging)
i missed js npm ngl doint this lib
Yeah, you'll very rarely ever need to work on java doing libraries raw like that
-# unless you are doing uni work
With a package manager u just put the lib path and they'll get from mvncentral for u
That's why I blame unis for java hatred
I could even guess they told u to use java 8
he is readinng henti..... in class
here 11
Lmao why the hell
Eh, somewhat better but still so fuckin outdated
Java's at 23 now
24 by feb next year
i mean mysql connectorhas ver 9 and we use 8
and javafx is 17
Also that mysql connector has CVE warnings of severe class
let me get the versheet
Eclipse 2020.6 R
Java 11.0.18
JavaFX 17.0.7
MySQL Java Connection Library 8.0.24
XAMPP 8.0.7
althou i dont use the eclipse couse it can be same with intelij
Good thing you were allowed to use intellij
well tecnily it would be eazyer to do with eclipse (couse they have tutorial on how to setup) but yeah i thik intellij is better imo
i still hate it if the version is diffrent by like 0.0.1
thats a -20%
SO no latest
Which also goes against a proper project planning
and best part of this.... they have not even teach javafx or mysql code
As using outdated libs is a liability
it will be teach in the last week before i have to submit this assiment
so i had to self learn all of this
good thing there is docs and stackoverflow
Yep, java has a long track record, plenty of Q&A around
ngl this would be eazyer if its in py and using mongodb, couse i somehow know more then java+mysql
also i really dont wanna make a documentation on this project
I mean, technically you'd be using JPA not raw connectors, or at least some connection pool like hikari
Nobody does raw connection managing like that anymore
Fun fact: This is supposed to be a group project with 7 member
and i am somehow the onlyone that does the work
Always like that lmao
couse my team member
Member 1: me
Member 2-7: No one
somehow i become solo in the group...
And you're forced to carry the group, else you also fail the assignment
atleast i made a deal with the teacher
as long as backend work and use the correct lib
100%
they will ignore the frount end design and such
its not carry
this group only has 1 member (witch is me)
atleast i have that to clear my mind
also that i know out of 12 group, i am the only one that has progress
My teacher used to ask questions individually after assignment completion, to ensure everybody participated
i wish
in this, even if the member does no work, it will follow the group scorre
it used to be like
they give out a list
and we write what we do
and if we lie, other member can argue it
i want the old system back
they change it to the new system couse there is too much complain
Yep, it sucks and puts a high value target on your head for any assignment, everybody will want to hitchhike on you
i bet the one who complain is the one who dosent do the work
yeah thats why when i got this class
i know most peeps in this class just want to hitchhike
thats why i immediately apply this group to be solo (and i am now in this situation) on the first day of this semester
bro.... he is still reading that thing iin class
But don't let uni turn you down on java, try to do some side projects with it, it's quite enjoyable
and now its the video version
At worst you get to learn a language that can go into resumee
At best you like it
imagie that guy bluetooth earphone disconected
i would do more java tbh, but not raw
Isso don't get how people can read such stuff in public
Like, what if you need to stand up?
you will (soon) , this week is presentation week
Definitely, start a maven/gradle project (xml vs groovy, u choose), it's much more enjoyable
Coding should be about writing code, not dealing with packages
Btw you should apply from intellij ultimate while ur still in uni
on this project
i did, love the codesharing
Also embedded DB tools
Code with me*
i used Code with me so i can code on my laptop then run the code in my gaming laptop
Oh, in case u didn't know u dont need to do that
In intellij folder there're 2 executables
One is for server, one for client
Yep
ok i need to learn that
U can code entirely remote
Oh, the cloud will be where ur hosting the server
Like, u could rent a vps and host the server there
It's mostly for the scenario u said, the gaming pc would run the server
Then ur laptop would connect using the client
rip vm broke
The input field has gone behind this control bar...
Lmao
U need to use safe screen area, whatever ur using for the site should have it
I'm using css jss 💀😭🙏
btw what ver is the best for vm
i am going to just rebuild
out of this option
sending sc in a sec
The env() CSS function can be used to insert the value of a user-agent defined environment variable into your CSS, in a similar fashion to the var() function and custom properties. The difference is that, as well as being user-agent defined rather than author-defined, environment variables are globally scoped to a document, whereas custom proper...
Nvm css
Idk the diff tbh
Btw, in case ur using mysql workbench there's no need to
ill just choose standart
Just click the db icon at the left sidebar
is the dns good?
Connect to the db there
Set secondary to 1.1.1.1
got it
If google fails cloudflare for sure wont
i have try to create an ai reply using chatgpt modules
Failed to load event aichat.js: TypeError: Configuration is not a constructor
require('dotenv').config(); // Load environment variables from .env
const { Configuration, OpenAIApi } = require('openai');
const { EmbedBuilder } = require('discord.js');
// Set up OpenAI API with the key from .env
const configuration = new Configuration({
apiKey: process.env.API_KEY,
});
const openai = new OpenAIApi(configuration);
module.exports = (client) => {
client.on("messageCreate", async (message) => {
// Ignore messages from bots and non-text messages
if (message.author.bot || !message.content) return;
if (message.channel.id !== '1298129194693165066') return; // Filter for specific channel if needed
try {
// Send the user's message to OpenAI to generate a response
const response = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [{ role: "user", content: message.content }],
});
// Extract the response content and modify it to add "หนูคิดว่า..." to every sentence
const aiResponse = response.data.choices[0].message.content;
const modifiedResponse = aiResponse.split('.').map(sentence => sentence.trim() ? `หนูคิดว่า...${sentence.trim()}` : '').join('. ').trim();
// Send the AI's response as an embed
const embed = new EmbedBuilder()
.setColor('#0099ff')
.setAuthor({ name: 'AI Chat', iconURL: client.user.displayAvatarURL() })
.setDescription(modifiedResponse)
.setTimestamp()
.setFooter({ text: 'Powered by OpenAI' });
message.channel.send({ embeds: [embed] });
} catch (error) {
console.error('Error generating AI response:', error);
message.channel.send('เกิดข้อผิดพลาดในการสร้างคำตอบจาก AI, กรุณาลองใหม่อีกครั้ง.');
}
});
};
The API_KEY is in .env
win server
Ah
Win server is technically just win11 with some booleans set to true
i rather have a win server always on stendby tbh
couse there is somebot i rather try on vm
Ur using hyperv?
nope
but i can just rebuild anytime
since i dont store importent data there
Ic
plus my build is setup so it has all the nesesery stuff (discord, vsc, chrome, steam, java, js, py and few more)
well its just script
Why not linux btw?
topgg bot testing,
my main server where i run my bot and other program is linux
Ah
for example my bot clone detection bot is on my linux server
most used app in my vm
let me flex my best bot feature for some reason
used on dms more then 50+ since it has been made
Lul
Btw that Discord choice is weird, like, you can manage channels but can't change its permissions?
Tbh i like that so i can have free decline
And then you can manage roles but also change who can do what in certain channels
Lmao
90% of thay wrong perms decline
Is clone too btw
So its gonna get decline anyways
I know this. Couse there is quite abit that use this arguement
"But acording to this ripo, you need manage channel"
I don't even get why submit clones
Like, it likely already exists there working, maintained and hosted for you to use at will
Why bother with a clone, and even attempt to list it on the same place
Bragging maybe?
I can see some edits or using it as a way to learn how to use a language, but posting it to a bot list is insanity unless it's totally different. The only case I can see is music bots for multiple VCs, but like... Why though?
Just use a private instance(s)
I know why
Couse i have ask some
They just want the bot to be in the site
To flex that they are "top.gg developer"
By having bot dev role
They flex it to non-tech friends that dont know anything
I know this is a fact couse i know one person irl ||old me|| who does that
Lul
Here is another thing
Alot of non dev discord user
Think that topgg is own by discord/opperate by discord
Including some of medal volenteer/staff (i think medal own topgg)
So it works becouse of it
They think
Bot get accept = auto verified
unpeak fp
Guys I have a problem with the location measurements on the phone How can I solve it?
define "problem"
It’s going to depend on what way you’re adding it, but usually there is a .lib file alongside include files (.h/.hpp), and potentially DLLs. You can look up a tutorial of linking something like GLM since it’ll show the process
Also, if you want to make an efficient HTTP Server, try out Go. It’s very good at multithreading and reduces the complexity you’ll encounter with C++
It is
C++ has many use cases still
Rust will not see widespread adoption for a little while longer, it still needs to be more supported by the enterprise community
That’s why languages like Java are still so popular, decades of enterprise infrastructure was built on it
haku is biased
@quartz kindle can you explain little bit about session limit to @minor epoch
Just found out about them to be honest, I knew they existed, just thought it wasn't as major as it really is on discord.
mhm
topgg-tester?
yea
Doing what
idfk
Lmfao
ok
I seen this exact message from a different member in a different server. I'd suggest @solemn latch prolly should delete this (sry for ping) as its prolly a new typa scam
you mean the daily 1000 bot logins?
you want a package manager
consider vcpkg or conan
it makes things a lot easier
if you're new to C++ don't try integrating libs by hand
also get an ide that helps you by maintaining your cmakelists.txt for you, e.g. clion
Yea
they are called sessions limits
Hi topgg teater
The one time...that autocorrect did not Work is when i did typo

been learning blender py and its kinda fun ngl
Still not a huge fan of py syntax but it is what it is
Its so facinating to play with
hell yeah
All the animation work here is a python script.
Really good way to learn. https://www.youtube.com/watch?v=r9wzrST_fcw
Testing the new model & texture, checking to see how much detail is required when passed through YouTube compression.
Also checking higher brightness/higher opacity on the water.
pub enum Token<'a> {
#[regex("V[0-9]+(\\.[0-9]+\\[[0-9]+\\])?", |lex| lex.slice())]
MemoryLocation(&'a str),
}
I love lexer generator
so, as per webster's request, i shall now explain session limits:
once upon a time there was big mountain called Discord, which then turned into a fancy building with magic rocks and somehow learned telepathy.
366 days later an elephant tried to let the sink in but we dont know what happened after that.
They then decided to install a special door and call it a session, and they slapped a little paper on it with some text written in chinese.
the text said something something about documentation. whatever that means... you need to reach a certain level of drunkness to be able to read it.
so after a night of drinks i went to check it out and it said the following:
depending on the size of your bot (number of server), you are allowed a certain number of "logins" per day (they reset every 24 hours), usually 1000 for small bots.
these "logins" are basically successful "identify" requests over the websocket, meaning every time your bot connects it counts as a "login".
each shard counts as a separate "login", so if you have 10 shards, every time you start your bot, it will use 10 logins.
if a shard disconnects and is able to "resume", that will not count as a login and will not count towards the limit, only if the resume fails and the shard needs to reset completely.
if you go over the 1000 logins per day, your bot will be locked out for the remainder of the time until the next reset. you can see how many logins you have left and much time is left until the next reset if you make a GET request to /gateway/bot
when your bot becomes very big, ie 150k+ servers, discord will increase this number, usually to 2000 and first and then more if needed.
resuming sessions where possible is critical
I need to add cold session resumes into my lib. I currently bypass a lot of lib logic just so that I can apply the session ID and sequence number after a process restart
wondering if anyone has ever hit the Number.MAX_SAFE_INT for seq on a session
@quartz kindle Do you have any idea what might happen when someone reaches such a point?
its extremely unrealistic to think you'd ever reach such a number lmao
if you go past max_safe_int it will start getting rounding errors, like n+1 returning n again
I mean. My shards used to receive a LOT of messages when those werent privileged
My cluster has been alive for over 2 months
Idk if the sessions the cluster started with are the same ones but they likely are
Time to make a bot that gets insanely popular and ensure the gateway sessions last for as long as possible
👋
1000 shards connecting once per hour for 100 years makes a total of 26 billion sessions
very very far from 9 quadrillion :^)
One message removed from a suspended account.
One message removed from a suspended account.
that's what she said

😭 thank you!
AI

lmao
how does top.gg calculate "more like this"?
im trying to determine "similar forums" for my forum website, but i cant seem to get it to be fast and accurate, its one or the other
probably tags? maybe tracking which bots IPs access then finding the overlaps
how would IPs help determine this? i could look at an anime bot and then a moderation bot
is there anything more to make it more specific
you can gather which pages a specific IP accesses
if an IP accesses page A then page B this means they're related in some way, or just means B caught the interest of A users
this enters the big data analysis area, but you can "guess" which pages an user is interested in by grouping similar users
add tags to the equation and you get things that are similar
but i dont think top.gg would go through the process of all of this, it sounds as tho this would probably hurt performance
it hurts performance if you're doing this in real time
you can simply process in the server then use the preprocessed data in the site
the "data cruncher" is never in the frontend
does this generally look good so far? https://9000.webhook.pet/NEOFORGE/versions
pretty good yeah
took ages to load for me for some reason but looks nice
tho u could not make version dropdown a 50% flex, same for search
yeah its on a dev server
maybe the graphics should go full width
like, they're way too big
you mean 2 versions per row?
also add a looking glass button to the right
makes it easier to find the search bar
oh and one small feat you could add is that when click "browse" and get that sort of popup
make "esc" also a way to close it
eventually clicking outside as well
having to use the mouse and slide down is kinda annoying
version dropdown still pretty big
u can use 15em for the width, basically 15 "M"s side by side
in my print I used 120px
looking good now
would it be a good idea to do 2 versions per row on desktop?
try it to see how it ends
oh actually
on desktop u could use card layout
this way bigger monitors get more items per row
for me it looks better, but might go from person to person
u could add a "display mode" button on top right corner
to switch between single-list, 2-columns and card
i fixed it already
I don't like uneven things 
You're using grid right?
no
Im curious what was your solution
flex
its so I can make the last rows grow dynamically
yea
nah that's not really good tbh
well I dont really know if it should be
you can center them but keep the same size
even centering is a stretch for me
I usually leave them all the same size, and keep them in their positions
or just let the right one be empty, not a big deal and that's how it's usually done
I'd rather it look like one is mising, than trying to fill it in
yeah that's perfectly fine
alright
yes much better imo
Also, why the choice of making a button you have to click to view the information on that release?
wanted to try something different than the old site, https://mcjars.app
Ah
Yea that's how I usually do it, though im not completely against using a separate button
https://blog.jetbrains.com/blog/2024/10/24/webstorm-and-rider-are-now-free-for-non-commercial-use
kinda banger
🔥 🔥 🔥 🔥 🔥 🔥 🔥
holy moly
what is a cucumber tree structure?
Introduction: Cucumber is a popular open-source tool for Behavior-driven development (BDD). It is widely used in software development to bridge the gap between technical and non-technical team members, making it easier to define, document, and automate the testing of software features in a human-readable format. Cucumber encour...
it's pain
Looks interesting tho
i once participated in a java class where the instructor was teaching about cucumber
the whole thing did not make any sense
i mean, i understood the concept, but like, why?
Hey guys, does anyone know a free or paid api that shows a constant stream of web3 tokens that are being created?
I am trying to make an automatic buy/sell bot and got pretty far already, but i just need to find a realiable streamer, which i for some fucking reason cannot seem to find.
sigh
is there a way to put in the logo to php
the file are in images/facebook.png
images/instragram.png
easiest way would be to make that image publicly accessible under some URL and then use that relative URL path in your img src parameter
if you want something more fancy like importing images and referencing them without explicitly making them public youre going to need some library probably
So like if my image file are at Images and the php are in sub so I just use /image/x/the file name
Correct?
if you can access an image called test.png at URL some_website.com/image/test.png then you can just embed it with <img src="/image/test.png"> in your php code
"Edit" button
@radiant kraken Why do rust generics restriction only work with traits? 
hate having to do something like
impl MyTrait for i32 {}
impl MyTrait for f32 {}
what do you mean?
Like I can't do
fn blah<T: i32 + f32>(b: T) {}
You can
No
Not working with primitive types, it expects traits
So you can get around it by making a trait which implements both, but it's kinda shit
Ah I thought you just meant generic restrictions on functions
Nah
I have to do something like
trait Allowi32f32: std::fmt::Display {}
impl Allowi32f32 for i32 {}
impl Allowi32f32 for f32 {}
fn blah<T: Allowi32f32>(b: T) {
println!("{}", b);
}
fn main() {
blah(3); // works
blah(1.3); // works
blah(std::i64::MAX); // fails, i64
blah("hello"); // fails, &str
}
And I personally find that horrible
yeah it's a bummer, you can sort of counteract this with macros or third-party crates such as https://crates.io/crates/num-traits
yeh found that as well, it's just unfortunate you can't do it :c
obv that doesn't make much sense because there's no type that implements both i guess
but something like
fn blah<T: i32 | f32>(b: T) {}
could be cool
I mostly use traits for the few generics use cases i have but now facing one where i'd need two normal types
honestly true
that would make a cool crate idea tho, something like
#[alias_trait]
fn thing<T: i32 | f32>(b: T) {}
i wish Rust had a built-in trait like As<T> for types that can be type-casted by the compiler with as _
definitely
don't know macros enough to be able to do that lmao
those are procedural macros, they modify the AST of the code fragment next to it, in this instance, the entire function thing
which is very useful for doing magical things like that 
one of the things i wish more languages had tbh
yeah definitely not for me 
yeah true
yeah uhm im not sure what this is, this is a .mp4 hosted file over http
actual mp4 size is around 300mb
but it just repeatedly tries to fetch 5 mb chunks, network resources going into the gigabytes
18gb for 300mb to be exact
appears just with this though
content-length: 305482274
content-range: bytes 0-305482273/305482274
content-type: video/mp4
i have a very broad question
how to do sharding and is it necessary
google says its only necessary for bots in 2500+ servers
Are you anywhere near 2500 servers?
How? Depends the library
Necessary? Yes, if you still have just one shard and your bot is in 2500 guilds, you won't be able to start it. Recommended is something like 1000-1200 guilds per shard
no lol
i see
my bot's very new so it looks like i dont have to worry about sharding for a long time
Usually libraries have this auto sharding thing, where they use the recommended number of shards that discord gives for your bot
i see
Discordjs you can add literally 1 thing to your client and have auto sharding up to a certain extent
Technically you can implement sharing since the beginning, it's not much of a difference
what about discordpy?
Not a clue
Auto sharding will just make one shard for your case
oh
You just replace Bot with AutoShardedBot
yup
wow
Shards are just multiple connections for specific guilds - libraries make that easier for you by just simplifying stuff
thanks 💯
You also have new events you can listen to like on_shard_ready(shard_id)
This will get triggered when a shard is ready as the name suggests
For your case, you'll likely just have a single shard with ID 0
And your bot variable has new attributes like bot.shards or bot.shard_ids
so i can use like len(bot.shards) to show the number of shards
bot.latency uses the average latencies between the shards and you can get all the latencies separately with bot.latencies
Lots of cool stuff to play with
Absolutely
interesting
Consider shards as being different connections to discord.
Each of these shard/connection handles events for a set list of guilds.
So if one day you have 2 shards, and one shard cannot connect for some reason to discord, then you won't receive the events for the guilds on that shard, but the other shards will be perfectly fine.
Hence why sometimes big bots work in some servers but not all
There's a formula on the docs to know which guild will send its events on which shard, but you don't really need to know that - it's just to show that Discord splits the guilds into the shards to lower the workload per connection as each connection will receive a more normal amount of events, and not all for every single guild
shard_id = (guild_id >> 22) % num_shards
I'm experiencing something really weird
I have a debian server, 192.168.1.250
I try to SSH into it, I get timed out
I ping it, clean response
I ssh into another server, 192.168.1.251
And then ssh into 192.168.1.250, it works fine
This server is also available via my public ip, I try that, it doesn't work. I connect to a VPN, it works.
ghosts
And it works sometimes
ipconfig /flushdns
netsh interface ip delete arpcache
did both
such big question mark
subnet mask shenanigans? idk
It's just ssh though
192.168.1.250 also is running a sharex server that I upload to directly
and it works just fine
😭
that ip is in your local network right?
yes
i've seen this happen before, stuff being unaccessible from inside the same network for some reason
I'm on a different vlan, 192.168.178.20
but working fine when accessed from outside/vpn
Weird as I can ssh into 192.168.1.251 just fine
maybe an issue with port forwarding?
Port forwarding as in public ip -> network?
wat
my router thinks im ssh scanning
within my network
so it blocked me on that port
lmao
xddddd
why does it say 192.178?
i love you
@_@

lmao
and ofc it immediately starts working
xD
Mutex<Vec<Arc<Box<dyn Module>>>> much fun
Hey guys why the fuck am i blocked by a chinese internet provider
i swear i did an internet check as my mailing service was not working for some customers, i found out that 9 providers in china have blocked my vps's ip 😭
i did nothing to deserve all that
average china moment
you can send them an email asking why
they may unblock it, who knows
whahahah i will try to, but idk it seems so strange
probs because it's not gov monitored idk
Does anyone know if I need DBOTS_TOKEN, DBL_TOKEN and BOD_TOKEN, or do I just need the topgg API token
?
I'm trying to finish my bots coding but I'm not sure if I need all 4 tokens
Well considering you coded it, you should know?
I didn't finish coding it genius
????? then why do you have 4 variables/tokens if you don't know for what they're used
Either you use them or not, if you don't there's no point in having them
And whether you use them, you should know it because you're coding it
hes on a higher plain of thinking than us
your bot is from a template isn't it?
but well, those tokens are from other listings
dbl is how topgg was called years ago
dbots is a brazillian listing
bod idk
How did you know
because you're asking whether u should fill those variables
Then why does it say dbl and topgg
On the template
templates usually have a list of variables and an explanation of each for forkers to fill
because it's either an old template or they didn't bother to rename
it doesn't really matter the name
So do I fill it in if I'm in the us?
it...depends on how they implemented it
a good template will have all tokens optional, as in, it'll only attempt to execute dependent code if it's filled
but bad templates could simply outright crash if not filled
they aren't mutually exclusive mind you, you can have all filled if you're listed on those too
the template should include a README.md file with instructions for setup
give it a read
I didn't even see it until you mentioned it
Debugging is a murder mystery where you're the victim, the detective and the murderer
Love that
does anyone know how to embed discord images (e.g. user avatars) in link embeds.
for example, top.gg links are supposed to also include the bots avatar as per view source but it doesnt
https://top.gg/bot/432610292342587392
Database of 110,000 anime/game characters: make and customize the best collection in your server. 400 commands, multiplayer games and more!
It should work but not in this case I guess 
og:tags
Hey, I use NodeJS, and i can execute my bot commands in channels where he can't see (he don't have the permission ViewChannel), how to make him handle that ? He gives me DiscordAPIError[50001]: Missing Access
try { ... } catch { ... }
or for promises .except()
i know, but i don't want to write this on every command bro
yup it crashes
ok, then u dont have a global catch, good
on interactionCreate?
are you using some sort of command handler?
like one file for one command?
you'd have it on global scope actually, you should add one later so the runtime doesn't crash for any missed error
client.commands = new Collection();
const commandsFoldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(commandsFoldersPath);
for (const folder of commandFolders) {
const commandsPath = path.join(commandsFoldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
}
else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}```
i think this is my command handler
that's for registering them, idk how d.js cmd handler works, on my own I just put a try-catch where I call cmd.execute(), but that's in my case
and on interactionCreate event, i have :
const { Events } = require('discord.js');
module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
}
catch (error) {
console.error(`Error executing ${interaction.commandName}`);
console.error(error);
}
},
};```
so i got the try {} catch {}
on the global catch you could prevent the crash, but you'd not be able to send an error message on the console
oh, good, that's where it is
a try-catch wont work there, since it's a promise
you need to use .except() after the execute
yep, the issue is that promise errors happen in another execution, so the regular try-catch can't catch those
since for it, the execution is no longer there
try catch doesnt mean anything here so?
well, it's good to have
since non-promise errors might happen
and those wont reach .except()
do add a global catch tho, so your runtime doesnt crash from tiny errors
.except?
it isn't except?
Am I missing something or do u mean .catch
its .catch
.catch it is then
oh okay
what u mean?
I hate how I work with 3 different js-like langs and each has their own names 
after a certain node version, any uncaught exception is gonna stop the runtime
idk why i didn't learnt python and i wanted to make it in js too 💀
yeah i know that
with a global catch u can handle the exception
but where am i supposed to put this global
it looks like that
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
client.commands = new Collection();
const commandsFoldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(commandsFoldersPath);
for (const folder of commandFolders) {
const commandsPath = path.join(commandsFoldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
}
else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
const eventsFolderPath = path.join(__dirname, 'events');
const eventFolders = fs.readdirSync(eventsFolderPath);
for (const folder of eventFolders) {
const eventsPath = path.join(eventsFolderPath, folder);
const eventFiles = fs.readdirSync(eventsPath);
for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
}
else {
client.on(event.name, (...args) => event.execute(...args));
}
}
}
client.login(token);```
it just registers commands right ?
and events
so i don't really understand where it executes them
yep, somewhere there add the uncaughtException event handler
oh wait
shouldn't matter where
i know what it is
just dont simply mute the errors, let them stay verbose so u dont ignore them
then fix them when you can
process.on('uncaughtException', function (err) {
console.log(err)
});```
isnt that the same?
.error uses ERROR level and is more apparent
.log uses INFO level, and is meant just for informational log
i host the bot online, so i don't really watch logs or smth... 😅
you should lul
I mean, you're the one supposed to be seeing it
not the users
the console I mean
ah
but i mean, missing permissions is the only error i encountered
and it's in very specific conditions, so not fixable lol
in those cases u should check beforehand and send on the channel so the executer knows it's missing perms
it do it lol
and i dont really understand why
cause the bot isn't supposed to see the channel
well, it needs to to be able to interact with it in any way
i can't clear all this channel gotta be the hardest shit i ever heard
its the same for my website and i cant figure out a solution
One message removed from a suspended account.
@midnight valve No ads please
want a break from the ads?
english isn't my native language bro
- im pretty young lol
Need app testers for my discord bot, wont take too long just need to enter commands, report any discrepancies, make a list of commands that need work and give feedback. Need 4-5 people. DM me if you are free and Interested.
And also, this is just voluntary help i am asking for so please dont ask for money T_T
just need to enter commands, report any discrepancies, make a list of commands that need work and give feedback
Need 4-5 people
you want a literal QA team
btw mods will warn you the moment they see that message
yep, and looking for testers
what should i do then?
well, if you have users then they'll kinda test them for you already
just setup proper logging to report errors to you
the issue is that i want to make sure everything baseline works then i can start advertising and putting it on top.gg
if it passed verification then you're good to go
?
topgg verification
oh
the bar is very low for bots, dont be afraid to fix/implement things along the way
very few software launches bugless
the biggest issue i have is that i am building a game system and a lot of thought needs to be put in that, a lot of logical loopholes etc.
so that needs testing and i alone am not enough
also i have spent so much time on this that i have started to become lazy -_-
ik, I also made a game for my bot, sadly the best way until you have enough users is to do it yourself
once users start gathering you can open applications for a tester team
just launch it as-is, fix bugs as they happen
ok
depending on what kind of game you created it'd be impossible to find every bug yourself anyway
hmm
its kind of basic - exploring, gathering, battles, pets etc. really common stuff
not as common as you'd imagine, most game bots are just cookie clickers or simple pokemon-like (with just attack/defend buttons)
you're already above the average if you have more than that
oh ty
first i'll complete the all command version then i'll try to get into the nitty-gritty
Bugs are a part of software. No project is ever complete
Hey fellow bot developers. Quick question since I am about to launch my bot, how much is the exposure with your bot being in the "new section" of topgg?
I will be trying for trending but I dont think I will have enough userbase to support that
but still if anyone wants to help with app testing, please dm me 🙂
I'd not rely on that section for getting new users
Mind DMing you?
I mind
How would you recommend to start the growth?
To break into trending you will need 20-30ish votes to begin with
After that it's easier as word of mouth does the trick
well, the slower but steady way would be to bring the bot in topic when the conversation allows
the probably faster but gamble-y way would be to bid on spots
Its a mini game. Its not another AI, waifu or anime or pokemon game
It's the same for every bot, or product in general. Just have the presentation be good enough to grab people's attention
If you were looking for a bot, what would make you look at your bot?
The answer to this is what you need to do to gather more users
And always remember, the first 20 words are the most important of your description
If they fail to grab the attention then they'll likely move to the next bot
Do you have your bot listed?
yep
hi, i have a discord bot who use puppeteer. i tried to host it on koyeb, but i get this error when puppeteer is needed
Instance created. Preparing to start...
Instance is starting... Waiting for health checks to pass.
Listening to health check on port 8000
Ready! Logged in as Crackwatch#4718
Error executing search
Error: Could not find Chrome (ver. 130.0.6723.69). This can occur if either
1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or
2. your cache path is incorrectly configured (which is: /app/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
at ChromeLauncher.resolveExecutablePath (/workspace/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserLauncher.js:292:27)
at ChromeLauncher.executablePath (/workspace/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:210:25)
at ChromeLauncher.computeLaunchArguments (/workspace/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:91:37)
at async ChromeLauncher.launch (/workspace/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserLauncher.js:71:28)
at async search (/workspace/commands/all/search.js:7:18)
at async Object.execute (/workspace/commands/all/search.js:123:16)
at async Object.execute (/workspace/events/required/interactionCreate.js:16:4)
someone got an idea ?
(doing the npx command in the console doesn’t work too)
did you try reading the guide mentioned there?
where?
This one I guess https://pptr.dev/guides/configuration
most errors usually explain themselves at the very first few lines
yeah i just read it
nothing what can help me
did you install the puppeteer browser as directed by the script over there?
async function createButtons(allNames: string[]): Promise<ActionRowBuilder[]> {
let rows: ActionRowBuilder[] = [];
let currentFill: number = 0;
let currentRow: ActionRowBuilder = new ActionRowBuilder();
for (let i = 0; i < allNames.length; i++) {
if (currentFill == 5) {
rows.push(currentRow);
currentRow = new ActionRowBuilder();
currentFill = 0;
}
currentRow.addComponents(
new ButtonBuilder()
.setCustomId(`${allNames[i].toLowerCase().trim()}`)
.setStyle(ButtonStyle.Secondary)
.setLabel(`${allNames[i]}`)
);
currentFill++;
}
return rows;
}
async function sendAndSave(
allNames: string[],
channel: GuildChannel,
Embed: EmbedBuilder,
status: any
) {
if (channel.isTextBased()) {
const rowArray: ActionRowBuilder[] = await createButtons(allNames);
let sentMessage = await (channel as TextChannel).send({
embeds: [Embed],
components: rowArray,
});
status.status = sentMessage.id;
fs.writeFileSync("./status.json", JSON.stringify(status), (err) => {
if (err) console.log(err);
});
} else {
console.error("Channel is not a text-based channel.");
}
}```
pretty long one.
Why do i have an error that ```js
Type 'ActionRowBuilder<AnyComponentBuilder>[]' is not assignable to type '(APIActionRowComponent<APIMessageActionRowComponent> | ```
I swear TS combined with Discord api is literal cancer
why not just java
isnt java a pain to handle?
such a dumb joke lmao
depends on what you mean
some say it's a pain cuz it enforces very strict typing, but I find that to be an upside
i whine about it all the time cause it feels like it hasn't kept up with the features of modern languages
doesn't have string templating, doesn't have async/await, uses type erasure for generics so making T[] arrays is a pain, etc
doesn't have string templating
it does on java 22 (in preview atm - https://openjdk.org/jeps/459)
doesn't have async/await
well, we have futures instead, java doesn't use event thread so async/await wouldn't work anyway
didn't string templating get canned as well?
As much as I love C#, the reason it’s able to have all these features over java is that it took the stance of being adaptable. Java is very set in stone because they don’t want to mess with their standards all the time. It can be verbose, but it is very consistent
Java hasn’t changed a lot in the last 20 years, which is another reason why I think it’s a great language to learn on. There’s no new “best practices” coming out with every new release. That’s something that C# does a lot, which is great for those people paying attention to the changes but not so great for legacy code that should be rewritten
there's a balance to be struck between feature creep and being stuck in stone though
C# pushes too far one way and Java too far the other
I see C# as the experimental ground for language features that other languages may choose to implement later, it’s very bleeding edge and it’s constantly having something new added. Not a bad thing, just depends on your circumstances
nope, it's been in preview for a while, openjdk just take their time when adding such things
When starting out what stats should i track. Users & Servers should be more than enough right
Or should I track invite origin as well? (App, directory, topgg etc)
invite origin would probably be really useful to see what to focus more on
Users & Servers
User count is by far the most useless stat to have
not only is it inaccurate, but it wont tell how many USERS you have either
command usage + invite origin + servers are the ones that are useful
By users I meant records in my database
seconds per command might be relevant too
so people who have interacted with the bot
interacted as in used a command? or do you have XP/currency system?
No its a mini game not a moderation bot
Interacted as of having complete >5 levels
which is 10min of gameplay
ok, then it's a relevant stat
What do u mean by that
how many seconds a command took to execute
I'd argue Java doesn't really push for it. it's slow in developing itself because of the distribution system it has
it's still a good enough language in 2024 though
I'm still siding towards C# as my favorite though, love the advancements in the native AOT
One thing I find funny about C# is that sometimes people don't need to comment code because the function names are comments already
Not even portainer has support for docker plugins but now i do
Not only function names but visual studio is amazing at visualizing what functions and parameters do even without comments, compared to say javascript which is dynamic and requires some initial usage help
also named parameters can help SO much with readability
that's honestly just IDE specific, and from all the languages i've used so far, was everywhere
it depends, for js it'd be impossible for the ide to guess
^
yeah because it's js and it sucks, but that's a language issue so no ide can do anything against it
say you use ts, you get the same
well, yes that's the whole point of ts
just like any typed other language
no honestly nothing really something cool about c tic tac toe tbh
that's just the ide doing fancy stuff because the language is typed
and the function names being comments was more a meme about them being super long
Depends how you want to use those functions instead of long parameters you could create them as builder methods like what discord.net does with embeds
new EmbedBuilder()
.WithTitle("Test")
.WithDescription("Hello");
pretty much the same as JDA lul, but set instead of With
how me changes my discord bot profile in top gg?
refresh data > edit > save
K
tq
if guys need website for bot u can see in my repo include mdx blog
O_O ew
somehow, my tauri project's setup exe
has the same sha256 hash
as a probable trojan

happened with me too, one of our company apis is flagged as trojan by windows
hahahah i had the same shit was fun to encounter.
const ; val = 5;
in a perfect world, the code wouldn't let you compile because it's clearly an error
but js isn't perfect world, so it executes anyway
Now this is how you do a permissions system
I want color of this to be #3b3f8c I tried applying filter to image but didn't turned good? is there any method or online tool to this thing? sorry I'm not a math guy.
filter: invert(30%) sepia(67%) saturate(275%) hue-rotate(190deg) brightness(95%) contrast(90%);
worth to note, filter order matters
oh, what should I do then
well, you'll need to fiddle with the values till the color reaches what you want
it'll take a while of trying
😭😭
Whoever thought it was a good idea is like my brother, a moron
import { VoteUser } from './VoteUser';
import { getCollection } from '../mongo';
import { addEvent } from '../functions';
module.exports = async (data: VoteUser) => {
await getCollection("votes").findOneAndUpdate({
id: data.user_id
},
{ "$set": {
votes: {
at: Date.now(),
source: data.source
}
}
},
{
upsert: true,
new: true
}
);
addEvent({
type: "vote",
command: "vote",
source: data.source
});
}
can anyone help with this
nothing gets added
Because your database is empty
it should create one no?
findOneAndUpdate looks for a document and updates it. It won't update the document if it doesn't find it because it doesn't exist
The code you sent doesn't indicate this
import { VoteUser } from './VoteUser';
import { getCollection } from '../mongo';
import { addEvent } from '../functions';
module.exports = async (data: VoteUser) => {
const result = await getCollection("votes").findOneAndUpdate(
{ id: data.user_id },
{
"$set": {
votes: { at: Date.now(), source: data.source }
}
},
{
upsert: true,
returnDocument: 'after'
}
);
// make new thing here
if (!result.value) {
await getCollection("votes").insertOne({
id: data.user_id,
votes: { at: Date.now(), source: data.source }
});
}
addEvent({
type: "vote",
command: "vote",
source: data.source
});
}
still doesnt work
The upsert creates if not exists. Read the docs
Ok
But yea, it should work
However it may be better to check it exists first then create or update instead
oh
yeah it still isnt working
^
can someone help explain how this outputs 4? @pearl trail @lyric mountain @wheat mesa ```c
#include <stdio.h>
int main() {
int a = (25, 4.61);
printf("%d\n", a);
return 0;
}
found this question in the C basics quiz (that i failed 😭) and i really need to know how this works because i'm about to have final exams next week 
wait is it just that
yes
try int a = (25, 5.61); it'll return 5
doubt
well my grades state otherwise
😔
like i hate my professor so much
// omitted scanf
for (int i = 0; i < n; i++) {
if (data[i] == input) {
printf("The data is in index no. %d\n", i + 1);
break;
}
}
Given a data with the size of 10 and the inputs of 12, 14, 15, 16, 15, 14, 11, 10, 15, 17.
In which index is the number 15?
A. 2
B. 2 and 4
C. 3, 5, and 9
D. 2, 4, and 8
what is the answer to THIS??????
even IF you know what indexes are or you understand everything, you still wouldn't be able to answer it properly
i answered 3, 5, and 9 but i don't think i got it right because my grades are shit
i don't know they never tell me in WHICH questions i got wrong
ffs
😭
should be D imo
it doesnt ask "in which index based on the printed text is the number 15"
¯_(ツ)_/¯
no sane c programmer would use this syntax
WELL MY LECTURER APPARENTLY DOES
bro he should stfu with this "uhm but actually 🤓" bs 😭
its so annoying
its very unclear im not sure why C even supports this syntax, there may be a better use case for it but not sure
he would put the most cursed code in a quiz for a C basics lecture
it allows for stuff like
int a = (printf("this is supposed to be 50 ig"), 50);
but you can just do
printf("this is supposed to be 50 ig");
int a = 50;
saves a line maybe
one liner 😍 😍 😍
why tf would anyone write like that 😭
js basics quiz:
what does this output ```
[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]])+[])[!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]]
most clear JS code
pro code
yeah you
Real
a solid 5/7
The only lang that I know of that uses 1 based indexing is lua
Everyone else is sane and starts at 0
Sql
😔 This is so much better than Portainers current "roles" system
not really
you can kinda guess the raw value tho
varchar takes 2+n bytes, boolean takes 1 byte zoneless timestamp takes 8 bytes and idk what a loader_type is
4 bytes then
postgres is fine
but wdym "lots of rows"? what will that table store?
that sounds very wasteful tbh
but that table wouldn't have which launcher was used right? only which loader
wouldn't it be better to assign an unique id to each player (hashed) and then update their entry with the last played date instead?
like, a composite key with (id, mc_version) since some people play multiple versions
at least you limit it to a few rows per player, instead of unbounded
that's true
Thank you for asking a specific question and indicating what your problem is
i have question i am trying to create /reload ping without to put .js and it show out the command not found
the structure are in
commands/subfolder/command.js
here is the code
const { ApplicationCommandType } = require('discord.js');
const fs = require('fs');
const path = require('path');
const commandsDir = path.join(__dirname, 'command');
module.exports = {
name: 'reload',
description: "Reloads a specific command file.",
type: ApplicationCommandType.ChatInput,
options: [{
name: 'command',
description: 'The name of the command to reload (without .js)',
type: 3,
required: true
}],
run: async (client, interaction) => {
const commandName = interaction.options.getString('command');
await interaction.deferReply();
try {
const commandPath = path.join(commandsDir, `${commandName}.js`);
if (!fs.existsSync(commandPath)) {
return await interaction.editReply(`Command "${commandName}" not found.`);
}
if (client.commands.has(commandName)) {
client.commands.delete(commandName);
}
delete require.cache[require.resolve(commandPath)];
const command = require(commandPath);
client.commands.set(command.name, command);
await interaction.editReply(`Successfully reloaded the command: ${commandName}`);
} catch (error) {
console.error('Failed to reload command:', error);
await interaction.editReply('There was an error while reloading the command.');
}
}
};
it give me result command not found
what did i do wrong ?
does it say command not found or Command "" not found.?
hey guys is anyone here familiar with the Gale-Shapley Algorithm
i was about to be but wikipedia decided to beg for donations for the 50th time
so my attention was diverted
why are wikipoopas like this
Check out our long-term partner Holzkern and get an exclusive 10% off your order using the code “FERN-HK”: https://fern.deals/holzkern94 (ad)
Wikipedia frequently asks for donations. But does the site actually need the money?
Thanks to Andreas Kolbe for the interview!
Sources:
https://docs.google.com/document/d/1mudb6v_p-1EI9Af9mj9F-nzzI4A...
they do this every few months
its already been debunked they have enough money to last for a long while
plus their fundraiser messages use all of the corporate marketing and persuasive strategies in the book
thought it was a bit odd they include the exact day in the message but thats fully intentional
yh its annoying


Whoever though this was a good design choice in docker is a masochist