#development
1 messages Β· Page 231 of 1
id assume this one is stored as a linked list to save memory
and this one just as any other array/memory block for performance
hello tim
general kenobi
i mean
As you upload the files, and then encode them, and then stream them out to people through HLS/DASH
vod is like youtube video
stream is the same thing, but the file is not stored on disk, just buffered in memory
or likely both
on livestream you have an input, the recording, then as the input comes in, you both save it to disk, and redirect it to some network output
If I can do this myself and not use a service like bunny.net then I 100% will, it'd likely be cheaper
ye if you wanna go public with it, you definitely want a cdn
livestream is uploaded to cdn in real time, then viewers connect to the cdn to stream it
Can i not route it through cloudflare cdn?
I also have to encrypt/decrypt the files myself also π
probably yeah, but video cdn is like a separate service no?
becaude video is expensive
yea my only problem is
I dont want to pay for their storage if I can avoid it
I'd rather pay 4$ / tb rather than 10-20
or even 30
I get that it's replicating the files too those locations and making it faster for the cdn but still
up to 30$ a month per tb
I can't do that
π
I mean realisitcally its a pay as you go system, so you only pay for what you use so it wont be that much to start out with
but if it gets that high ima be fucked if im not bringing in revenue

I guess ima have to suck it up
bunny is the least expensive option
5$ /tb of bandwidth isn't the worst
The only sucky part is the storage but its whatever, hopefully it will bring in some revenue if I code this shit properly
like buttons a span svg etc
Wait question
is DRM support mandatory?
If I enable DRM, yes it stops video downloads
but it also limits how I can play said videos
There is only selected number of players (all of them look absolutely terrible) that support playing DRM protected content
and the ones that exist only work on x browsers, and sometimes doesn't work on x devices
I notice even youtube doesn't protect all their videos via DRM
only the paid ones
arent all numbers in js doubles? why is there one for normal elements and one for doubles
i would guess the other one is for arrays which contain things like objects
drm is probably the most anticonsumer thing ever and it isnt even effective a lot of the time
i wouldnt use it unless theres a good reason to
Gotcha
I was looking at bunny.net's DRM and I was like erm no thanks
their enterprise DRM is like expensive asf too
Each time someone plays a video it charges you 0.005 a license
some DRM also depends on the hardware and OS and will refuse to play if you dont have satisfactory hardware like HDCP which requires the gpu and monitor and drivers to support them
louis rossman did a whole video on netflix doing it
they dont allow you to stream HD on unsupported hardware
yea SMI = small integer
basically 1byte ints
so you have array of int/char, array of double and array of pointer
this is on the v8 side btw, on the js side all numbers are doubles yes
I use svelte and tailwind, but tailwind does not work when I try to design a homepage.
tailwind's output.css is in the head section
It works when I give it as a style instead of the tailwind class.
rate the jsdoc
wow
did you set tailwind up properly?
Ctrl + F
Yes, it works on /dashboard/ path. It only didnt works on the home page
are you importing the css on the correct layout?
yes i imported css from app.html
excuse me what
Error: Io(Os { code: 54, kind: ConnectionReset, message: "Connection reset by peer" })
the other side dropped connection
the other side
I am the other side
π
I am simply running an api that literally does nothing rn but return hello world at /
no, like, if u receive that on server it's cuz client dropped, same for the other way around
right
but here's the thing
How is it dropping if its happening when I start the webserver
does it appear when u access the url or when u literally start?
quite literally when I start it
I already authorized it on my macbook
so that can't be it
then that's where the issue lies
Forgot that I was
ngl
postgres://asdasd:asdasdads@localhost:5432/vidcord does this look correct?
ok but does it use the jdbc standard?
If it does it doesn't ask for it
the standard database url is driver://url:port/database
π¦
I got it working
When I opened the ssh tunnel I used the wrong ip
I put 0.1 instead of 1.1 as the last 2

skill issue
well, not specifically for oauth2, u have to do it to have a valid url to begin with 
non encoded urls aren't valid at all
is *.* a valid wildcard in dns
or does * already do that
asking cuz cloudflare doesnt supply ssl for anything but first level sub domains
nvm not possible
never saw a url that has 2 levels of sub domain
does it happen if u have too many jsx elements
or
not even a typescript.tv description
SO suggests its a typescript issue and recommends updating typescript and/or vsc typescript extensions
its alr i deleted my code anyways
ts won
noooo
js my love, it doesnt matter if ts won, js will always be the winner in my heart
:^)
Damn pesky aws engineers
how to i know the name of the that element?
how long discription have character limit?
i'm unable to save it
you can also Ctrl + Shift + C in devtools then click on desired element you want to inspect in the page
but then i have to manually click on the class and copy it's name
any help?
what are you trying to do exactly
what do you wish to aquire via topgg elements
worth to note, it's useless to use any of top.gg classnames
except for a few that are fixed, they change on every page load
i am trying to add elements like button
where user can interact with it
can i execute my bot command in the description
you can't use js in long desc
then just add it?
assuming topgg allows acripts
it doesn't, only html + css
but even so that is not recommended
i don't see the point of having interactive bot preview
because if anything they can try out in private servers, or your support server
also hi kuu
hi sa-yun
I did add an interactive preview, but just cuz there was no way of showcasing 20 cards without becoming a mess
it's just a roulette tho

yep
Whats the base url for discord's api
I swear I can never remember it
π
is it https://discord.com/api/v10/?
I think so
I can never find it on the docs
It's still supported and what the majority of bots were on
There might be some lobbying from larger bots to keep it alive
I don't think they'd have extended its life time this much if that wasn't the case
i mean, supported sure, but default is weird, especially how pushy discord was with v9 an v10 things
i guess its for compatibility with old libs who dont explicitly set a version in the url lol
Maybe. It's weird
A lot of old bots will die, that's for sure
I wonder what kind of message bots will receive when their gateway connection gets terminated for good looks like
"request to discord returned funny result"
cant wait to have to update discord.js for a discord bot i have running to track some data that i never touch
and then have to deal with djs breaking changes as a result
"just dont update djs" tell that to the discord gateway
djs is like apple, planned obsolete
force people into getting the new one every year
to keep the project running
lmao
is there a way to prevent the bot from crashing when someone tries to use it without the correct perms/view channel access? when i get βmissing accessβ error it shuts the bot down
handle the errors
itβs hard to pin point what guild is causing that errorπ
i mean, in your code, you can catch those errors, and prevent them from crashing
hey tim
have you ever heard of discord's oauth2 token endpoint returning an html page
the status code is 200 so I assume it was successful
but instead of giving me the access token and what not it returns an html page
its a cloudflare page im guessing
i've seen that happen before
returns some rate limit information or something, but in an html page lol
wait a sec
did I just find a vulnerability
why does it give me their stripe keys
π
its probably just stuff related to your session
but I don't have anything related to stripe?
well, a lot of services create sessions of everything, including visitors
but do thye put it in in window.Global_Env?
Response: "{\"message\": \"Invalid Form Body\", \"code\": 50035, \"errors\": {\"redirect_uri\": {\"_errors\": [{\"code\": \"URL_TYPE_INVALID_URL\", \"message\": \"Not a well formed URL.\"}]}}}"

Uhm but its the same exact url I used when authorizing

why do people give you formatted json responses
just have the user format the json themselves
its not meant to be transmitted in its formatted form lmao
bread
I gave them the same exact redirect uri as I did when authorizing
so how is it not well formed
http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fauth%2Fdiscord%2Fcallback
this is how it looks
Is this not correct?!?!?!
wait a sec
do I not need to url form encode the urls?
I guess not
noted
im writing a feature where you can search for users by username and it gives you the top x users depending on the likeness to the username you typed in
its an sql database and i am not sure if there is any way i can really optimise this for a large amount of users
was thinking of doing the levenshtein distance but that definitely defeats any hope of optimisation so maybe ill check by first letters in the usernames
what i usually do is first filter and then order
if usernames are indexed, get all usernames that match string in any position, then order result by levenshtein
but if you want something more fuzzy, then its more complicated
i dont think theres really a way to avoid a full table scan in this case
assuming there is a lot of users
depends on your index
i think normal indexes support LIKE query with prefix (basically startswith)
for LIKE queries with both prefix and postfix you probably need a different index, like trigram
ah i didnt know you could still do an indexed search with anything other than exact matches
i think in this case for best optimisation ill do searches by prefixes
i see why now its very interesting
for a lot of indexes b-trees are used
the nodes for each string are ordered by their character order
so it can traverse down the tree if you search by prefix of suffix easily
so you get an o(log(n)) search since each search of prefix/suffix halves the possible amount of combiantions
ye
im not sure if i can insert a template inside of a like statement but its worth a try
you cannot
you have to concatenate them
I am trying to remove really small outliers using the IQR but found that it sets the threshold to like a big minus. I know my calculation is correct though...
Is it just how iqr behaves? Is it skewed towards removing small value outliers instead of big value ones?
you can insert it in the variable
"... LIKE ?").all(`${username}%`)
when defining a varchar(x), x is the amount of bytes right, not like character length?
so I can do varchar(16) for a 16 byte string of text (GUID)
appaaaarently
its db dependent
lmao
since GUID is typically 36 characters long
idk if postgres does it
but if so oh well now there is a 36 byte roof
π

I put 36 cuz honestly doesn't really matter
its reasonable enough
it wont cause performance issues
if you want to save only 16 bytes then you need either the UUID type or binary type
understandable
idk

ah ok
so it is characters
looking at the docs for pg
varchar(n)where n is the number of characters (not bytes)
I mean, it's kinda the same thing
As chars and bytes have the same size
Varchar is 2 + n bytes
i'n unable to delete announcement
what
check if you have permission to delete it
i'm the owner
how can i fix this?
it was network issue
no when the element is not in focus it make the element visible
how can i make it invisible?
i'm editing my page

TypeError: client.commands.get is not a function
Is it related to my Discord.js version?
Beacuse in the updated documents, it seems to be a valid function
iirc client.commands is a custom property of client.
Related to this section of the guide.
https://discordjs.guide/creating-your-bot/command-handling.html#loading-command-files
anyone able to look at this and tell me why it's showing this timestamp?
const { SlashCommandBuilder } = require('@discordjs/builders');
const db = require('../db');
const DAILY_COINS = 30; // Number of daily coins a player can claim
const TWELVE_HOURS = 12 * 60 * 60; // Time period in seconds (12 hours)
module.exports = {
data: new SlashCommandBuilder()
.setName('daily')
.setDescription('Claim your daily Click War Coins.'),
async execute(interaction) {
const playerId = interaction.user.id; // Fetching the player's Discord ID
const now = Math.floor(Date.now() / 1000); // Current time in seconds
try {
// Fetching player stats from the database
const stmt = db.prepare('SELECT click_war_coins, last_daily FROM players WHERE id = ?');
const playerStats = stmt.get(playerId);
if (!playerStats) {
// If the player is not in the database, add them
const insertStmt = db.prepare('INSERT INTO players (id, click_war_coins, last_daily) VALUES (?, ?, ?)');
insertStmt.run(playerId, DAILY_COINS, now);
const nextClaimTime = now + TWELVE_HOURS;
await interaction.reply({ content: `You have claimed your daily ${DAILY_COINS} Click War Coins! Your next claim is available <t:${nextClaimTime}:R> at <t:${nextClaimTime}:t>.`, ephemeral: true });
} else {
const { click_war_coins, last_daily } = playerStats;
if (now - last_daily < TWELVE_HOURS) {
// If the player has already claimed their daily coins within the last 12 hours
const nextClaimTime = last_daily + TWELVE_HOURS;
await interaction.reply({ content: `You can claim your daily Click War Coins <t:${nextClaimTime}:R>. Your next claim is available at <t:${nextClaimTime}:t>.`, ephemeral: true });
} else {
// If the player can claim their daily coins
const updateStmt = db.prepare('UPDATE players SET click_war_coins = click_war_coins + ?, last_daily = ? WHERE id = ?');
updateStmt.run(DAILY_COINS, now, playerId);
const nextClaimTime = now + TWELVE_HOURS;
await interaction.reply({ content: `You have claimed your daily ${DAILY_COINS} Click War Coins! Your next claim is available <t:${nextClaimTime}:R> at <t:${nextClaimTime}:t>.`, ephemeral: true });
}
}
} catch (error) {
// Error handling for database operations
console.error('Database operation failed:', error);
await interaction.reply({ content: 'An error occurred while processing your request. Please try again later.', ephemeral: true });
}
}
};
Sure, send the code please
What exactly is the issue? Like what does the message that it sends look like?
Because Discord's built-in timestamping does not use milliseconds AFAIK, so you should try dividing it by 1000 before showing it up
I might be wrong as well, sorry if I am
Okay, let me check the code again
maybe it's the database
I don't really have much experience with SQL so it might be, please try printing what it returns so we may see the problem
iβve just added some debugging to see what itβs calculating
it won't let me post it
ohhhh i see what it is
Automod probably detected it as a phone number
yeah ^-^
Honestly, I dont know why we have that one, I've not seen a phone number posted ever. Or I dont remember that
Good job
The whatsapp scams use them
and dont have any invite links or pings in the messages
iirc
ah
@lyric mountain mr nginx i have routes like /api/users/:userid/delete, can you match routes like /api/users/*/delete or is it more complicated
why are you doing this at nginx level?
Is there something specific you want mapped at those routes?
yeah no, that's definitely not something ur supposed to do at nginx level
u probably can, but shouldn't
I have an app on a domain that is set by a developer to proxy at certain URLs:
example.com/browser/123foo0/stuff.js
for example, where 123foo0 is some random key. The key may also change length in
i would want to handle ratelimits on the nginx level and other stuff like upload limits and accepted data for specific routes
but nginx no no wanna support modern url conventions
that is not a pretty solution and im not sure how i feel about regex
wonder if theres a module that adds support for this

Why on the nginx level?
I mean without using regex idk what else you can do
any module will likely also use regex
why wouldnt you
i would think nginx would be able to handle things like this much more optimally than any server can
why would you want that on proxy level though
fast
if i wanna rate limit someone for example
i can make nginx go bye bye on connection instantly
if the app handled that it would have to proxy it through and process the request again on its end
Should I expire session cookies if I am using my own auth system?
or should I just remove the sessions when they log out
I feel like so long as they don't log out themselves I see no reason to log them out for them at a certain time
personal preference pretty much
icic
maybe just put 6 months or so

If they dont logout themselves why expire them
if they are dumb enough to give out their session id cookie sucks to be them
π
well if your data is very important, you should expire them
attackers steal cookies from websites to gain access to user's account
log out when user starts with css
like I said
Not my problem if someone allows their cookie to be stolen
then sure yeah
eh, well attackers don't ask users for permission to access their cookies or not
but whatever
I mean...
They don't need permission when they just give it out
π
"Here click this link and install it" "Ok sure"
"Use this public wifi without a vpn" "Ok sure"
@civic scroll can I handle db like insert on nextjs?
If I tried to protect people from their stupidity I would spend more time on that then actual features
Wym
You should not be making any direct db calls from nextjs
You should have an API you call to that handles that for you
nextjs had serverside code
which means you can setup api routes
do people actually use that tho?
why not?
yeah, it won't appear on the client's "application" right?
you have types usable by both frontend and backend
well in react you can disable that on build
yes
right, but thats only helpful if its a small api
anything big and complex is a bad idea to use that
you can break it out
not to mention any big api should not be written in js
in fact iirc nextjs has a separated foldersfor api endpoints
it does indeed
nestjs: 
oki, last question, can I do anything on the nextjs server? like I can install any npm that runs on node
but there's a reason companies don't use js for enterprise level backend apis
maybe like canvas, jimp, sharp
its not efficient
again, nestjs is server-first
okokokok
in SSR and and ISR configurations, you code runs on the server
thanks
so not node
ima make elysia in node and then cosplay
π
comptetitorβ’
I stand by that js is terrible for enterprise level abckend apis
its not efficient and wont hold up to that amount of traffic
yes BUT
tbh no enterprise has only one person for backend
EXCEPT
THE USS ENTERPRISE π¦ πΊπΈπ’
thats not a bad choice if you like ruby
My only thing is, if its something small js can definitely do it
but if you are getting thousands or hundreds of thousands of people hitting your backend api it becomes a problem
js isn't meant to handle that, and to make it even get close to being able to handle something like that is more work than its worth
yeah i want to learn it too
looks fast π
what api are you making
π€«
tell smh
if (n < 1e3) return n;
if (n >= 1e3 && n < 1e6) return +(n / 1e3).toFixed(1) + "K";
if (n >= 1e6 && n < 1e9) return +(n / 1e6).toFixed(1) + "M";
if (n >= 1e9 && n < 1e12) return +(n / 1e9).toFixed(1) + "B";
if (n >= 1e12) return +(n / 1e12).toFixed(1) + "T";
};
for pixxiebot
formats numbers
its just suggestions for his rpc
My rpc is how I want it to be 
@pearl trail question
<html lang='en'>
<body>
<div className='flex flex-row'>
<Drawer />
<Navbar />
{children}
</div>
</body>
</html>
not an optimal result
the Hello all the way at the right is the {children}

where do you want to have the {children}
I guess in the empty whitespace
Idk how to describe it
Ideally the content of each page should be surrounded by the navbar and drawer
<html lang='en'>
<body>
<div className='flex flex-row'>
<Drawer />
+ <div className="w-full">
<Navbar />
{children}
+ </div>
</div>
</body>
</html>
hope the width works
thought i had a hdd failure just now, just wasn't plugged in right..
before, you have
- drawer
- navbar
- hello
those 3 are in 1 flex-row, so you gotta do
- drawer
- div
- navbar
- hello
there are only 2 that will be "flexed", drawer and div with navbar and hello
ah shit
I just realized that w-full is likely going to interfear with me resizing the drawer's width no?
oh no wait
its me doing w-screen inside navbar
yea but that wasn't what was stopping me
it was me doing w-screen inside navbar's main element
I 100% will need to change the color scheme at a certain point
but for now i cba
I just want the stuff there
I can fuck with the color scheme later
sudo give me purpose
alias fucking='sudo'
fucking apt update && fucking apt full-upgrade -y
im doing away with the entire drawer + navbar thing
navbar only

the drawer looks UGLY
at least open 24/7
im doing this holy shit
no need to repeat conditions that were already eliminated before
function Formatter (n) {
if (n < 1e3) return n;
if (n < 1e6) return (n / 1e3).toFixed(1) + "K";
if (n < 1e9) return (n / 1e6).toFixed(1) + "M";
if (n < 1e12) return (n / 1e9).toFixed(1) + "B";
return (n / 1e12).toFixed(1) + "T";
};
What kind of algorithm should I use to show the user most liked videos in two scenarios
- They are not subscribed to anyone, show them most liked videos on topics they choose
- They are subscribed to people, show them their subscribed content creator's videos first, and then any other videos that are similar
ok question
i have a game that iβve created called click war
and idk if this makes sense
but is there a way to add every game state to the database? incase the bot crashes while the lobby is open? or crashes during a game in progress? so itβll continue when the bot is turned back on
yes
In order to initialize both the dashboard and the bot, I should prepare a mutual main .js file which both sets up the bot and configurate the routing right?
yes
just make sure both bot and webserver can access each other if you want your webserver to access some data from bot
thank you!
yes
;c
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
I'm a little confused with those long-named class names, are they Next.js classes? If so, where can I view the other classes as well?
It is from the default Next.js project
Oh, it's tailwind
what?
you return if n < 1e3, so afterwards you dont need to check if n >= 1e3 because you know for sure it is, otherwise it would have returned
Oh
Add some ads 
Lol for what?
What might have caused it tho?
i mean
only thing the bot does that could possibly cause this would be the demo system, a user runs the command, after 1 hour he gets a dm that demo expired and that command has a 24h cooldown
may be that its sus for discord when the app had like 5 people get dms on the day the bot was made
because people tried demo
Join messages/dm? π
@solemn latch may I please ask a question like:
Do I have to set up the routing in my main JS file or does Next.js do it for me automatically depending on the folder rotation?
Or do I somehow need to initialize it?
nextjs if you are using the app router does it all for you
it goes based off folder name
yeah
src
--app
---about
----page.tsx
---page.tsx
the page.tsx file in about folder is that folder's "index.html"
the page.tsx file in the app folder is your root / "index.html"
example.com -> "app/page.tsx"
example.com/about -> "about/page.tsx"
no
Not on the login/join page
π
Add a dark grey container around the login stuff π
π not using shadcn? 
Thank you, tho I have some non-routing related questions yet like
I'm confused how to create some sort of "search" box, like when they search something through it how will I create components that will show the results?
wait, that is shadcn isnt it?
Have you done your general layout yet?
Not really
I would wait to worry about search stuff until later.
You're right but it's such a major question mark in my head
But yes I think I should start with making the layout first
using nextui
Once you play with layout, and general stuff you'll learn a few things along the way like states and useEffect, which will help with how search will work.
Out of all the things in your dashboard search will probably be the most complicated, but it will be way easier to understand after you've displayed information and whatnot.
Thank you, it will help me
I'm not sure if this approach is right for you right now.
But a component library might be useful.
When I was learning all of this stuff I didn't use component libraries first, I learned everything else then came back to component libraries.
Its up to you what way you want to go.
https://ui.shadcn.com/
https://nextui.org/
I'm a big fan of shadcn, but I've only heard good things about nextui too.
Thank you a lot, I really appreciate it again
Well, What that total revenue actual indicate in the 1st image is it of user
Thats just a reference image to what a card looks like in shadcn
Where may I view tailwind classes such as this?
This is what I use.
https://tailwindcomponents.com/cheatsheet/
Find quickly all the class names and CSS properties with this interactive cheat sheet. The only Tailwind CheatSheet you will ever need!
I pretty much always have it open on an extra monitor when working in tailwind
Wow thank you
If you use Visual studio code I think theres an extension for tailwind too.
for autocomplete
I'd really appreciate it
Is it called Tailwind CSS IntelliSense`?
yep!
I'm starting to build the project, I'll start with a basic design
As "development" points out that I can always make it better with time so
Good, I started getting confused with JSX already
whats got you confused?
Hydration failed because the initial UI does not match what was rendered on the server.
<body>
<ul style ={{position:'sticky'}}>
</ul>
</body>
I just started yet, lol
Or I just have lack of HTML knowledge yet
Do you have a layout file?
Yes, this is what it looks like:
import { Inter } from "next/font/google";
import "./globals.css";
const inter = Inter({ subsets: ["latin"] });
export const metadata = {
title: "Page",
description: "Generated by create next app",
};
export default function RootLayout({ children }) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
);
}
It might be because you already have a body
Oh, you're right
Hydration errors are funky right now, in the next 6 months ish they should get better
It's weird tho, should I remove the body from the layout file?
Ah yes it worked to do so
You want your body to be in the layout, as that should be consistent across all pages.
So the layout isn't supposed to be included in every single page right?
Okay, I thought Next.js required it to do it
Yeah, your root layout will be across all pages
https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#root-layout-required
Ah thank you
Yes, I think I have a lot more to worry about before making a search box
I don't even know why those rectangle backgrounds are appearing around
// Send email
await transporter.sendMail(mailOptions1);
await transporter.sendMail(mailOptions2);
await transporter.sendMail(mailOptions3);
return res.status(200).send({ message: "Received successfully" });```
i have a problem.. when i send the mails with await it is basically making the user wait. I don't want to do that.
Is there a way to send one email, then directly return the status code so that the user doesn't have to wait and then send the other 2 mails (these are admin mails).
there's currently a delay of like 5 seconds or something
i am deadass r3tarded cuh
simply remove the return brev 
or i implement a loader y aknow that's also a possibility.
ayo chat is this real
Guys i have a service running on port 8443, when i use pm2 restart does it autoamtically release the port or will it block the fucking port?
in any case, how can i release the port gracefully?
it's not docker so it's open to host
wym gang
wdym release the port
i have a process running on port 8443. When i use pm2 restart, it creates a new instance of that process and closes the old one.
I am scared that it will return me that the port is still occupied.
are you using the same port every time?
if it restarts then it won't be occupied until it uses it again
i have one process using 8443 yeah
and also this ^
kinda rare stopped process still have the port occupied
ahh hell nah:
29|EMRE_OFFERTE | Error: listen EADDRINUSE: address already in use :::8443
29|EMRE_OFFERTE | at Server.setupListenHandle [as _listen2] (node:net:1751:16)
29|EMRE_OFFERTE | at listenInCluster (node:net:1799:12)
29|EMRE_OFFERTE | at Server.listen (node:net:1887:7)
29|EMRE_OFFERTE | at Object.<anonymous> (/root/site/offerte.js:267:13)
29|EMRE_OFFERTE | at Module._compile (node:internal/modules/cjs/loader:1256:14)
29|EMRE_OFFERTE | at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
29|EMRE_OFFERTE | at Module.load (node:internal/modules/cjs/loader:1119:32)
29|EMRE_OFFERTE | at Module._load (node:internal/modules/cjs/loader:960:12)
29|EMRE_OFFERTE | at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
29|EMRE_OFFERTE | at Module._compile (node:internal/modules/cjs/loader:1256:14) {
29|EMRE_OFFERTE | code: 'EADDRINUSE',
29|EMRE_OFFERTE | errno: -98,
29|EMRE_OFFERTE | syscall: 'listen',
29|EMRE_OFFERTE | address: '::',
29|EMRE_OFFERTE | port: 8443
29|EMRE_OFFERTE | }```
root@awsomecordServices:~/site# ps aux | grep 'Z'
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 3310215 0.0 0.0 8900 740 pts/0 S+ 19:27 0:00 grep --color=auto Z```
yeah, but as i though pm2 restart does not close the ports, but it closes the process. So the process is closed, but the host still has it bound to the port.
it's a zombie process now
i thought zombie proceses can't hold ports 
π§
what happens when you do pm2 stop first and then pm2 restart?
same thing
did you do that when it worked the first time?
dunno tbh, pm2 restart should work the same as stopping and starting
oh shit
i apparently assigned like 4 containers to one index file
so when i did pm2 restart index -> it started all 4 containers
yeah fr
i got some bad memories in terms of using docker so i kinda hate it
Does anybody have any idea why it's occurring?
Okay, I found it out
:^)
So I didn't figure it out
uh π is that execution time/task?
ye
unbelievable πππ
time to use fastify
i mean, you cant always trust random benchmarks like that
but here is the source
Node.js Ruby yjit - Which programs have fastest performance?
some of them went in ruby's favor
took them 2.5gb of ram tho
:^)
shrimply use js for everything
actually why dont you use c# for backend too
I want to try smth different
Performance:
- Express is faster than Rails probably because of its ability to process asynchronous I/O calls
- However, tasks that entail more cpu intensive requirements generally perform better with Rails
icic alr
imma do my own benchmark later
because that's what I can do
express is thresh
pls no rust
the learning curve
is beyond long
ive been lurking over waiting for another cpu spike and todays the day
i did this, the only thing ive noticed is that one feature gradually slows down when its ran (goes from 0.1 ms and gradually increases to 1400+ ms)
ok I decided to use golang, thanks Tim
You have a root layout, and then you can set layouts for each page as well if you want
I think I'm still confused, I don't know which property causes it
But I somehow fixed it so I think there's nothing to worry about for now
its not that deep docker
apparently it is
2 minutes now
im guessing its copying my entire 8gb dir
damn
shoutout to rust for that...
im so confused rn
damn keyboard double pressed u again
idk why but double presses have been going up over the last few weeks for me
only happens like every 30th time for me
might be just that my keyboard is hella dirty
wtffff
it just did a triple press
new record
Is there a way to use to App Router to seperate url.com/home and url.com/home#updates?
# is usually a markdown thing that just jumps you to a part of the document. I wouldn't recommend intentionally breaking that convention
that was aggressive
Look. I forgot # did that in Discord
So should I use url.com/home/updates instead?
Yeah
This is something you would just use another route for. home/updates
or just /updates
Yea
Well, it's going to be hard to create that dashboard
Error: Hydration failed because the initial UI does not match what was rendered on the server.
Expected server HTML to contain a matching <ul> in <body>.
This error is occuring again, it seems to fix it to remove the body from root layout, but then it breaks the whole site
Oh my God, the error message was telling me what to do whole the time and I just didn't notice it
Programming moment, anyways
Nevermind, it just sometimes works and it sometimes doesn't
any help
react strictmode
Well, what's funny is that there's nothing wrong in the surface
you know your bot might be using too many emojis when:
same
lol, theres also three more servers im using for the bots emojis but those are my main support server, and two other bots support servers
what does your bot do
I remember some time ago someone wanted to add a Pokemon emote in the embed with its name for every possible Pokemon in the Pokedex
idk why my bot server and shards count isnt increasing
result = await self.get_stats()
data = {"server_count": int(result["servers"]), "shard_count": int(result["shards"])}
headers = headers = {
"Authorization": "secret",
}
URL = API_BASE_URL + "/bots/{}/stats".format(self.bot.user.id)
await self.bot.session.post(URL, headers=headers, data=data)
here is my code
i would make a bot that automatically uploads the emojis for everything as i create new servers
this is my get_stats function code
docker try not to ignore the cache level impossible
?
no help?
Same
when was the last time it updated on the site? could be the site cache displaying old data
try accessing on another device
ctrl f5 and incognito (+ network tab "disable cache") my beloved
otherwise try manually making a post request to the website and see if it works
Its very long time ago
Last year i think
try to make a manual request with postman or reqbin or something
Ohk let me try
the problem is that you are using react
it is the only times i experience issues with my extensions or compilation
is when i use react
it has more dependencies than a drug addict
react is so slow and bulky that it doesnt actually react to anything in time
lol
it just feels wrong using it
maintainers must be the same people installing is-odd on npm
ok docker tweaking?
multi layer image
build: node:22-alpine
package: node:22-slim
324 mb
or
build: node:22
package: node:22-alpine
265mb
lol what is the actual difference betwen those?
alpine is a way smaller version of normal
slim is just node
like bare bones
slim should be smaller
so i dont get it
node:22 > node:22-alpine > node:22-slim
in sizes (big to small)
whats the difference between build and package tho
oh multi layer
build just builds the project
package just minimizes it completely
i was using spark to view github code and classify them based on language, but one thing that i really noticed was that many people in js in particular tend to do this:
if(condition1){
return ...
}else{
codeblock1
}
but can't you instead use this format to make it more readable/compact?
if(condition1){
return ...
}
codeblock1
yes...
you dont even need the brackets for the if either π (should use if it's only a return ...
i often do the first one as well at first, makes it easier to think in the head, but later on when refactoring i change it to the second one
no like deadass 8gb of html data got me tripping.All of em use the first construct
i know
ah i see
cant you do both build and package node:22-alpine?
hmmmmmm
or both slim
size doesnt change
only the package layer matters
so what OS does node slim use?
alpine i think
oh wtf
I do have a problem though guys.
I have around 8tb of data.
I am looking to reduce it to like, 800gb?
So what i came up with was using bloom filters (basically hashes) to check whether certain prominent features of languages fit in a category.
However as of now, my data gets tripled for some reason. I went from 140k entries to 7 million and i have no clue why:
Below snippet is the prominent feature extractor..
val filteredLinks = whs.filter { case (title, _, _) =>
val lowercaseTitle = title.toLowerCase
broadcastedToken.value.exists(coin => lowercaseTitle.contains(coin)) &&
broadcastedLanguages.value.exists(keyword => lowercaseTitle.contains(keyword))
}
val uniqueLinks = filteredLinks.flatMap { case (title, url, body) =>
val lowercaseTitle = title.toLowerCase
val mentionedCoins = broadcastedToken.value
.filter(coin => lowercaseTitle.contains(coin))
.toSet
mentionedCoins.map(coin => (coin, (url, body)))
}.groupByKey()
.mapValues { iter =>
val aggregatedCount = iter.flatMap { case (_, body) =>
body.toLowerCase
.replaceAll("[^a-z0-9\\s]", "")
.split("\\s+")
.groupBy(identity).mapValues(_.length).filter { case (word, counter) => word.length > 5 }
}.groupBy(_._1).mapValues(_.map(_._2).sum)
aggregatedCount.toSeq.sortBy(-_._2).take(30)
}
uniqueLinks.foreachPartition { partition =>
partition.foreach { case (coin, wordCounts) =>
println(s"\nCoin: $coin, Found Link Count: ${wordCounts.size}")
val topWords = wordCounts.toList.sortBy(-_._2).take(30)
topWords.foreach { case (word, count) =>
println(s" - $word: $count")
}
}
}
spark.stop()
we dont speak rocket science here
you're infiltrating junior territory with that senior stuff
thats not senior, thats harvard phd
go write your own lossless compression lib π
trust this is junior data science π
how do you even store 8tb
raid
do you have a 20tb drive?
hard drives
or that
lmao
but i continously get disk errors cuz my data went from 140k -> 7.6 million entries in 2 days.
EAACH QUERY TAKES 2 DAYS LMAO π
man what are you storing
web crawls.
elder scrolls
it's over for me
what lang is even that?
ii think that i am somehow not removing or deleting the intermediate webcrawls after i processed them.
scala
never seen scala code before lmao
what part of that code is in memory, and what part is disk based?
like how are you even operating here, ddo yu have 8tb of files and you process one file at a time?
multi threadingn't
Everything is disk based, but as soon as we process, we will load them into memory. Then send the data back to disk,
It basically processes it in batches ya know.
We have A LOOOOOT of files
how much is loaded into memory at once?
these files are distributed over 128mb blocks across the cluster (=10 machines at the time).
Each machine starts a seperate mapper instance to execute the code on the individual blocks stored there, in paralllel.
So each instance has roughly 128mb in memory at the time, and the blocks are evenly stored across the cluster. So as of now, i utilize around 80% of the RAM of each machine but i sometimes tend to get heap errors as well..
What i think that the issue is, is that for each web scrawl file that i obtain, i crawl and process all the links that are on that site which creates loops if i don't keep track of the visited links..
What's the best way to quickly check memberships? HashMaps right?
if you are crawling an entire website, then yeah you need to record visited links
a hash map is fine
or even a set
i see. This explains a lot.
the queries used to take 6h but now they take like 2 days.
i am processing a lot of data so i don't think i can use HashMaps.. i will have to reserve a lot of memory for the bitvector.
i mean, you would only do it per website
once the website is done with, you can delete it
or do you have cross links between websites?
you can limit crawling within the domain only
it's a raw crawl from like the whole web, so i think they might contain crosslinking.
so you have 2 sets, one holds domains, the other holds paths per domain
wait let me send you an image of the format
for each domain, check domain set to see if it was already done with
then for each domain create a set and add paths to it
for each path, check the set to see if it was already done with
then once all paths were exhausted, delete the set and move on to the next domain
so each warc file, contains these info's.
and in that html it can have anchor tags ofc. So the web crawler will then crawl those links again, etc.
hmm, what exactly do you mean with paths?
remove anchors/fragments from the url
owh dam i didn't even think about that.
although there are some websites gthat use anchors for SSR, which is stupid
ohk so i try updating manually and it works
now
it is showing curreint in website
The processing in the begin will be the same though, as the webcrawler already crawls it for me and i can't really make it ignore the anchor tags, but the processing that comes after it will definitely be easier.
but what is the issue through code/bot
Thank you tim!
print the response from the post request inside the bot
im recursively converting images in a dir to a webp
doing this on a single thread atm
do you think it's smarter to multi thread it, e.g. 4 workers
cpu usage with single thread:
or is that just dumb if it's alr begging for more cpu
it will definitely be faster, as long as you have spare cores
if you only have 1 core, dont bother
i have 4 cores
yw (although i didnt do anything)
i believe this is full server cpu usage
not one thread
server provider:
well are you sure its single threaded then?
how are you converting?
am getting 400 Bad Request through bot
idk why
apparently sharp is multithreaded already
yes
gonna see if effort 6 is too much effort
what are you using for the request? maybe you need to json strinfigy the data first
this is my code
aiohttp.ClientSession
am using that
use json, not data
await session.post(url, json=data)
effort 6 = 9.71 mb, 5.68s
effort 5 = 9.94 mb, 3.12s
effort 4 = 10 mb, 2.91s
effort 3 = 10 mb, 2.73s

oh ohk working
thanks for the help β€οΈ
what is effort? cpus used?
effort to make file size smaller
love it
ever messed with jpeg2000?
not sure if it's a good replacement for png even with quality = 100
ποΈ
i tried it once, was surprisingly good, like 30-40% smaller than jpeg
but browser support eeeeeeeeee
xD
yea then no π
there is lossless webp no?
i think quality: 100 is that
not sure though
i was using vercel and the first loaded image was 1.59 mb
my data transfer usage skyrocketed
i started using webp
like 70% reduction
nice
not even using vercel anymore
only good for hobby projects
once you get thousands of visitors/day it's ouch
ye nothing really beats running your own vps
using coolify with docker
but the image sizes EAT the ssd
it was at 50gb after a week, when using nixpacks
Come down this rabbit hole of pure optimization with us. Say no to bloated frameworks and say hello to pure HTML and JS
It's not that bad actually tbh
template frameworks
full SSR is cool though
I wrote my dashboard is all pure HTML and JS. Well, TypeScript
not always possible
why not
ok tbh it's just difficult
maybe not impossible
are you a print width 80 or 120 coder 
i think its more of a habbit thing
if youre used to frameworks, its hard not to use them
There are some cases where stuff is just better off using something like snowflakes are annoying if you do them all manually and the Discord API requires you to decode the snowflakes to get timestamps
isnt that like 3 lines of code
lel
:)
i use uuids for my IDs so you cant even get timestamps
I mean, some people might want other metadata but yeah
(they are unnecessarily long and slow but they look cool)
i remember ordering something off a company
indeed, im using them for my api keys
the invoice had a mongo objectid as order id
but i think im starting to get performance issues because of them so i might switch to numeric shorter IDs but keep uuids for other things
how about discord auth tokens and webhook tokens
they are liek 100 chars long
xD





