#ot2-the-original-pubsta
652 messages · Page 56 of 1
It's a fork of kyb3r's bot
present
Which is the bot of this server
o
And at least 9k other servers
Basically used in a lot of servers
If you see a modmail chances are pretty good it's this bot
Unfornately, it does have some quirks and flaws.
I'm trying to fix that and make it easier for all to use while still being insanely customizable.
But perhaps you want to deploy multiple bots all with the same custom settings.
So there's a way to configure settings through a .toml
I have started to study Data Science from online courses .Currently I am planning to buy a laptop which will help me in studying Data Science and also in the long run. Please recommend me a suitable laptop
depends. AI? laptops are shite - buy desktop + GPU. only going to use cloud services? M1 Macbook Air
cloud is a bit expensive tho, but as long as you have a job - shouldn't be too much of an issue
Why a macbook of all things?
cuz M1 homeboi
Why does it matter if it's a Macbook or anything else? (this is coming from someone with no hardware knowledge)
M1 is not that good of a CPU
M1 is much better for AI > CPU because of neural engine
because Apple is notorious for not being worth your money
well, if you don't have anything to argue about then don't ping me
Why not just get a good CPU on any other laptop?
Apple might be "notorious" but unless anyone can give me a spec sheet and 10 page essay on why M1 is bad for ML, those arguemnts are useless
what resources does ML take?
well for starters it takes memory
Neural Engine and shared memory are +++ for large models
and cpu
Okay, say Mac is good. Is everything else bad?
ikr
Providing such an essay would be entirely useless
nah bruv
The debate is not whether or not it's "good" it's a comparison of all options and how much you've gotta pay for them and what you get in return
M1 helps much more than a normal CPU. granted, software support is kinda slow but it's a long term plan
the debate is not mac vs. anything else
I refuse to believe any Apple device is ever worth the price
alright
it's the best recommendation for DS/AI, which is M1, which is Mac Mini or Air or Pro
iMac is good too
Where does this come from, though?
https://www.einfochips.com/blog/everything-you-need-to-know-about-hardware-requirements-for-machine-learning/#:~:text=So%2C if you are planning,a GPU is not necessary.&text=If your task is a,end should do the work.
if this is correct,
you are better off buying a laptop with dedicated graphics than a Apple device
for large models, memory becomes a huge bottleneck. shared memory is faster, its kinda cheaper too (seeing Apple tax) and Neural Engine can be fully optimized to take full advantage which is something AMD lacks. (who talks about f-ing intel lol)
for serious DL, it's cloud + TPU
but what about GPU's 😏
yeah at the price , you can get a more powerful machine lol
A single processor is not worth a whole laptop ngl
better off not buying apple
probably not, but for DS it is
Just get a good OS, beef it up with a nice CPU if you really need it, and be happy
it doesnt work that way
I doubt it's worth it, truthfully
if only it was simple as that
I'm sure you could make it work
I mean, why are we even arguing if most of you don't do ML?
if you for some reason want only a CPU in your laptop - it should be light etc, an Apple device is a great option
yes
cuz one person asked
yeah, and he meant in ML
wat
I imagine you can put the money you save from buying a whole macbook into cloud, honestly
mm true
cloud is not good for experimentation; in reality, the pressure of the $ you waste discourages experimentation
If you're just experimenting, then you don't need every ounce of performance
you waste a lot of $ on Apple too lol
speaking from expereince who blew 600$
long term
no
I can use it a long time, while in cloud only for a few weeks
Apple products are essentially built specifically not to last
ah that way
and this has been proven time and time again
damn
if you are experimenting then just use googles colab you even get gpus lol
and its ~free~
see, either you can get the "APplE bAd"route, or you could look at the hardware
and i say its overpriced for the hardware
either way, depends on the budget
The mentioning of Apple immediately puts me off
same
oof
then don't talk about it 🤷
k
k
I don't think I prefer having someone recommend a macbook
i would only for design etc
your choice - MB's are pretty standard in DL now since M1 got Neural Engine
adobe software
it's basically a huge edge over AMD
AMD without GPU
yeah ofc
AMD with GPU will kill apple ig
but if you really need that much performance, I don't think getting that from a laptop is a good idea
agree
especially an Apple one
nah, fine-tuning models doesn't take much
yeah so , at the same price, you can get an AMD + GPU lol
so then why does it matter ;-;
ikr
You have to assume that person is going to be daily driving that laptop... and I refuse to believe a mac is their best option
why does anything mater
because with an AMD + GPU comb, you can't train big models you would actually use IRL. but pre-trained models can be fine-tuned on Neural engine and shared memory can help to use the large flavours of some models too
ram
The only acceptable reason is that someone has the money and just likes the UI
No matter how much that mentality annoys me
i see, i cant argue with that cuz i dont know a lot about ML
I still think the money can be better spent
uh-huh. that's why M1 is pretty great for data scientists. prob widespread adoption may take place if they make it more cheaper at M3/M4 and more focused in Neural Engine
knowing apple, they can prob afford a new lineup with a new chip
God, I'd hate to be put in that position
yeah, it's already in production
if I have to seriously consider getting an Apple product, something is wrong
95% of cases in webdev and other things (which is smthing pretty common on this server) you won't need Apple at all
Only for AI/DS/Artistic work = Mac
I just don't think any hardware gains are worth it when it comes to Apple
because everything else just doesn't make it worth it for me
most creative professionals use Mac 🤷
Yes and they're weird
But why
they do use apple
I never understand
that true
all works very well in mac
Apple is very art-focused since Steve Jobs. it's a tradition they maintain
and Mac displays are sick
they have more rez than most monitors on Amazon 😮
I don't know, I know too much... My decisions are always based completely on efficiency
pro duplsay xdr
not the same refresh rate but yeah
and I find Apple absolutely horrible for anything efficient
bruh
Everything is always completely preference
only artists need that kind of resolution
its easy to see that mac's are aimed at creative profssionals
exactly
I mean what's stopping them from using Windows or something?
artists love that sort of thing - wider colors, more art emphasis, integrated eco where everything simply works
yes
the software hardware integration is very nice with Mac's
yes
they don't want to mess about nerdy things like patches and code. they just want their shit to work
makes sense from their perspective
I kind of feel like 99% of them don't even think about patches
if that's even really a thing
I feel like 99% don't even know about technical things, and they shouldn't really
they dont have to
yeah
so how does that justify "their point" if they don't even know it's a point?
wat
?
wdym
People want what works for them
I mean to say
ye
Mac works for artists(and other people) who don't want to mess with technical stuff
How do they know Apple fixes their problems if they didn't even know they had problems to begin with
How does Windows not "just work"?
they did have problems
Never said it didn't
Windows laptops dont come with high refresh rates, icky integration etc
But some people just might prefer mac
But you mention mac specifically
they don't really care. they have an ecosystem that simply works and doesn't break down. they have devices which while are expensive works well enough for them 🤷
Because that's what this convo is about
lol
for example, Adobe loves to crash in my PC
What an annoying situation
ye
For me, even Microsoft office crashes
lmao
Oh well. I'll forever abstain from both macOS and Windows (as much as I really can)
I mean, I tried to do music production in windows and I couldn't even get the fukin installer to run
eh
dang
its not that bad
Apple just really has a monopoly on their own software
its just not efficient
everything they have only works on what they have
perhaps. But with Mac, you know most Apple software works out of the box
all they do is raise the price and make their products intentionally bad
I think you are looking at this with a pretty nerdy perspective. Other people are not like that
yes
they don't want to fix stuff they don't understand
I've already said that
they would pay more just to get everything to work
Which is just an annoying mentality, honestly
because now all the support goes over to Apple
and so those who refuse to use Mac (cough) are stuck with the shorter end of the stick
and the monopoly continues
because there's no reason this software can't work fine on another OS
yes and no one can do anything about it 👍
same way we don't know about what chemicals we get when we drink coke, but chemists would consider it heresy that you drink somthing which has x chemical which would cause cancer.
I don't really care i would get cancer. I just want to enjoy my coke
wat
I mean I'd rather live with a "worse" experience than support a company like that
Yeah shooting the gun for the love of its sound
more like no experience
I mean I'd save more time fixing whatever issues I encounter rather than having to work more hours to make up for the price
Like what?
high res screen, lack of software
dang
What software could you possibly need in this context?
final cut pro
and I don't understand the "high res screen" argument
im talking about laptops here btw
bruh
Why would you need this, though? Surely there aren't absolutely no alternatives
and for the price, apple is the best
ask professionals that
:|
what
context...
lol
Idk man. I have a hard time believing Apple is ever the "best"
better than manjaro ;)
do professionals use Final Cut Pro?
afaik yes
shushhhhh 🤫
I'd still prefer Manjaro over macOS ngl
Strange
for real , move on to arch already
yeah, Final Cut pro is a very solid piece of software
as compared to what, though?
i assume it crashes less than premiere
Premiere
lol yes
companies don't use Apple for the lulz, they use apple because it is the most profitable
well ive never really done any 6hr editing job so my premieres never crashed
yup
but it can never be as good as Windows Movie Maker™️
1st rule for me as a programmer is whatever i use should be a free software. I haven’t spent a single penny for online software
yeah, that is a worthy priority
gentoo even lets you set a limit which prevents non-free software on your PC
damn
and its the default
Gentoo is really just the distro for masochists
any new software you have to build from source, so it checks for a license
you can probably bypass it
I'd hate to miss a month of updates and sit there for a day or two or three just compiling everything
(and well, you can probably also run apimages)
interesting
Jeez
not exactly sure
wtf
but they do not support large updates
You guys use any paid software for programming?
no
pycharm professional
I use word for writing down notes and such
I don't pirate lmao
which my parents do pay for
free software is a cool idea, but I don't think I care that much
same
well tbf if you use Windows or macOS you're basically using paid software
except when i need it
yeah
I am debating putting gentoo on my laptop for uni and just use vi for taking notes
gotta have a good battery life
but why would you do this
I downloaded windows 10 for free from their main website
could just use any server install :c
Install Alpine 👍🏽
I don't think that'd help much
I doubt it's as optimized
Alpine might be a good case for this... considering it's supposed to be incredibly light for use with Docker
honestly, even just fedora workstation would probably be fine. It's mostly the screen that is energy hungry
as well as WIFI
I don't think Fedora would be good
alpine as a daily driver seems unwise
you can install fedora with something other than gnome
at least I saw the button in the installer
Yes, but their spins are low quality
ah
You dont need a spin to install a desktop enviroment,
Someone can chat with me I m alone
You'd ideally want a generic desktop
but I don't think Fedora has an install for that
Honestly, for the most part distro is kind of irrelevant
it's pretty much mostly the DE that you have to worry about
Nobody?
so openSUSE or Arch might be good picks, because you can customize your installations fairly easily
hey guys could someone help me out with a code?
Depends on how difficult the problem is 😄
and yes, this is correct... but I assumed it'd work well if all you wanted was vi lol
how do I assign a unique number to an item in a list?
So you have a list like ["a","b","c"] and want [("a",0), ("b",1), ("c",2)] ?
zip a set of random IDs with the list to have a dict with {id: item}, maybe
you'd want to use UUID too
the library?
yes
basically i want so when the first item appears in the list, it's assigned to the number "1", the second one to number 2, but if the first item appears again, the program would know that this item is number 1
I mean it could still work lol
where do you wanna assign it?
in another list
so ['Michael', 'James', 'Andrew', 'Josh', 'Michael', 'Josh'] would be [1,2,3,4,1,4]
Are you sure you dont want to use a dictionary instead? So you have a mapping from the item/names to numbers?
I'm thinking this might be some X/Y problem
yeah a dictionary could work better lol
and maybe step back and say what it is you're trying to accomplish
because I think using just a set might be able to work if you don't require order or something
could be a homework assignment too, they give the craziest most useless
stuff
You'd want to use a dictionary or a class for that
but the numbers would have to be going up to 50
or even a tuple/list, I guess
a named tuple
why do you wanna store the number in another list?
Sorry, I'm way too tired to be awake right now
It'd be helpful if we had some clarification as to what you're doing lol
with a dictionary, is the number forever assigned to the value, or it can be overwritten if a new value is added?
it can be overwritten
Could you maybe explain what it is you're trying to achieve ;-;
yea
so basically i want to add a bunch of names to a list
uhuh
and i want to write a program so that each name is the list is assigned to a specific number
Something like could work, but this is python so there probably exists some fancy one liner:
result = {}
ident = 0
for item in the_list:
if not item in result:
result[item] = ident
ident += 1
{i: name for i, name in enumerate(names)}
Is there a reason for this?
so if the same name is added to the list again, the program would automatically know the number asigned to that program
uni assessment :))))
I see
but i just struggle to write this
then u can check if such a value already exists in the dictionary
Does not give same id to same names.
oof
It's list.index right?
I might be thinking of list.find
ok
D:
it is defintely index
yeah maybe a list of dicts would be good
so u allow duplicate names in ur dict? @jovial island
oh there's a cool way to do this one
Or just use one dict
the key will be the name of the person and the value will be the unique ID
before adding a key to the dictionary, check if the key already exists
if it exists, dont add it
if it does not exist, add it and assign the unique id to the key.
yes
does the unique id have to be 1, 2, 3.. etc?
using OrderedDict
well. I managed to come up with a solution
idk how I would... explain it without giving it
['Michael', 'James'. 'Peter', 'Michael', 'Peter'] = [1, 2, 3, 1, 3]
so every name is assigned to a number
but if the item appears in the list again, the program would use it's appropriate number
Okay, so list.index() returns the index of the first item it finds in a list
or maybe that's any... "indexable"
lists
So even if you have multiple of the same item... the index will always be of the first one
Nobody wants to give you the answer directly, but if you take the code from #ot2-the-original-pubsta message and tweak it slightly you can have it do what you want.
You can land on something much more straight-forward with list.index(), though
yeah that's a good idea
thank you 🙂
yeah that makes sense
if the item appears one in the list, an index is assigned to it
why though?
You don't need an if, though
why not an ordinary dict?
list.index will probably make it even more complicated
unless you mean OrderedSet
Want me to show you the solution lol
or from what I did
I have a solution alrd
wait, maybe dict will work now
the actual "solution" is like a single line
Dicts are guaranteed to preserve their order nowadays
||list(dict.items())[x] \😎||
yeah, should work with normal dict
bUt yOu ShOulDn't rEly oN iT
Karen said
who cares, it's in the reference now
lol
all you have to do is make a list of dicts
the key the index, the value the item
Smh nowadays you can
how can i add the index of an item from one list to another one<
so the index of a value from list1, how can i append this number to list2?
[{0: 'A'}, {1: 'B'}, {2: 'C'}, {1: 'B'}, {0: 'A'}]
this is the result of what I've got
this is good, but my program needs to include up to 50 names
and random ones
so the person would just type in the name, and this name would be assigned to a number
I think you may be overthinking it
yea
The secret lies in list.index()
In [1]: x = ["A", "B", "C", "B", "A"]
In [2]: for i in x:
...: print(x.index(i))
...:
0
1
2
1
0
hmm
ah, actually.. I think I see the situation
if I add another, it'd need to be 3, wouldn't it
defaultdict
almost
yeah
you get an issue with an input like this, [1, 1, 1, 1, 5]
but it should be 0 (or 1, depending on what you start at) 1
no it should be 0, 0, 0, 0, 1
yep, exactly
okay, but index can still be useful here
I hav a one liner
nevermind. maybe not
[{0: 'A'}, {1: 'B'}, {2: 'C'}, {1: 'B'}, {0: 'A'}, {3: 'D'}]
there we go
a = {name: i for i, name in enumerate(dict.fromkeys(l))}
res = [a[name] for name in l]
``` sth like this?
keep in mind this is someones assignment lol
🤔
that was my sol, yeah
mine's different
oh. but actually not
because all I did was not use enumerate in my obsession with list.index
I also have a question. I am thinking about creating a special kind of profiler for python. To explore this idea and to see if its feasible, i need to have access to some code to test. Does anyone know about any python based projects that has a good collection of benchmarks? Preferably for longer running tasks.
most web servers have some sort of benchmark
Like the frameworks or specific web serves/websites? A web server would be a great fit.
web frameworks, there may be some project that maintains them. You could also just pick out the python ones from this list https://www.techempower.com/benchmarks/
Thanks
Reporting on the birdie. It eats a loooot and shits a lot. The feathers are now bigger. Birdie likes hands because they're warm.
nice
Well, the eating and shitting parts are not as nice. It's loud when it wants something :D
lol
daily bird reports letsgo
#birb channel when
Free range help
what the fuck was i thinking when i coded this
Girls?
PFFT
i legit coded a database schema into a config file
this was dumb
so i have to re-rewrite half of my rewrite of the configuration
I just searched it up.
since pydis was the first server (public server) I joined.
same
I just wanted to join a public server since the only server I joined before this one was my frens' server which is currently dead.
i saw r/python and then saw the discord which was the day i joined this server and discord
!u
You are not allowed to use that command here. Please use the #bot-commands channel instead.
almost deleted discord until I found this server, and a couple of others too.
hence ^
nice.
fuck pipenv lol
all my homies use poetry
folks How much shud I charge for a website like this website clone
https://www.chibishiba.com/#tokenmetrics
But responsive and scalable!
what does scalable mean btw?
Scalability is the property of a system to handle a growing amount of work by adding resources to the system. ... In computing, scalability is a characteristic of computers, networks, algorithms, networking protocols, programs and applications.
oh hmm
ye
Scalability only really matters if you have a backend
I need a few more mins to let that sink in..
@lucid osprey it's like... it shud be like... capable or adding new features and.. thinks
ah got it.
scalable doesn't mean extensible, scalable means you can take this from 100 users to 1000000
Capable of scaling... the program in future.. ig.. coz wikipedia thingy doesn make sense
I wanted to add one more functionality to it
oooooooo
folks How much shud I charge for a website like this website clone
https://www.chibishiba.com/#tokenmetrics
But responsive and scalable!
welppp
plss
the code was written like a final one or smth it was a pain to accommodate it.
ooooo
what country are you in?
@round moss INDIA
but client
is from the us
u can say the us
standards
@round moss......
On second thought, I am not the right person to give advice for pricing. Consider asking in #career-advice
I was actually using poetry
But I decided to just
Take pipenv and remove it from the project for now lol
ahhhhhh cute
ikr
yeah
hes such a lad
same
ok
damn
ey?
agree
wow
dogo
quite
wong server smh
but its dogo
smeh
Thanks a lot. This is what I was looking for :)))
that will have incorrect behavior on certain inputs
What is the edge case?
[1, 1, 1, 2]
I don't get why that will cause a issue.
Oh yeah, you are right. Well the id's are unique, but they are not compact.
a repo for example
More like.... rice.
fair enough
:0
I know what a fucking repo is.
😮
🤣
Don't cancel me.
what if the algorithm was the impostor
Imagine.
ejected the algorithm
Fuck 🤣
rip algorithm 2021 to 2021
oh no. everywhere i go, I see the sus word STOP
" " - AlgorithmSus 2021
we need to go help people
Yep
general is dead
yup
Amongus/sus is such a dead meme now it's just a calling card for those who are behind the times or just unfunny in general
Ur sus
Im sorry I had to
I wish you a very bad day
OMG SUS
lol
I had one smh
sususu
Tbf everything they said was correct, the meme isn't funny, it's dead, and it's annoying.
lmao
Basically I'm no longer rewriting @vapid maple
I'm writing a fresh modmail
That's mostly compatible with @vapid maple installs 😏
Pog
because this way I can license the rewrite under MIT or LGPL
Tbf after looking at @vapid maple's source code it's a bit of a mess
^^^
Mods can we pin this
I redid the entire bot configuration
And then redid the other code
And then when I got to the threads code
And I could run self.threads.bot.threads.bot...
lol
I gave up on that code and started a totally new bot
Hm
It actually runs atm
It doesn't do anything other than connecting to the gateway
Next step is to add the database
You know, I looked at most of the bots source, and I didn't find a single on_message event
bot.py line 1125
async def on_message(self, message):```
Nvm I found it
Reason 2 for a rewrite, a gigantic 2k+ line main file
That includes bot definition and most of the thread logic
But not ALL of it since half of that is in the core.thread file
Yeah I don't get why most of it isn't in threads.py
EXCEPT core.models also includes half of the thread model
Ugh I keep seeing the %s method and it pains me
AND in core.threads the ThreadsManager has a attribute of bot!!
👀
That's what pains u?
Smhhhhh
Well ehh
Lol
Off topic but is the title of this channel sarcastic?
Probably
xD
This is where the rewrite is @real forum
Look at that config file 🧑🍳 💋
Pydantic, toml, and dotenv used automatically load from a config-default.toml, a config.toml, and a .env file
microsoft teams is terrible software
@jovial island do pls share more, what do you find its weaknesses are?
I'm on mobile so bear with me
why do you have a bear with you
- teams is not a native application:
of course, it is an electron app, meaning it'll be way slower if implemented incorrectly, and it relies on layers and layers of software to display things correctly, which of course means overhead
- teams is full of Microsoft fuckery
since teams isnt a native application, and it embeds things like power point and word, it was very easy for Microsoft to simply load the webpage version of those two, and on teams for some reason the toolset for those embedded apps is very restricted, try to edit a word document in teams for example
- not asynchronous
teams loads every bit of information from the database in the main thread, whenever you go fetch something like your messages, team list, team chat whatever
and that leads us to the last point, teams doesn't cache anything, it fetches everything again and again and never bad a local copy of a document, you can guess how well that goes.
for people with fast internet connections and slow response times they might not feel the effects of these poor implementation choices
but me with my puny 10mbps uplink cries about it every day
@hollow heart
why is your rewrite branch on main 
wait I thought that was a fork nvm
imagine not having a message cache and loading in 1000 messages each time you pop up a new tab
It was earlier.
But due to licensing and the current state of the code of @vapid maple, it's more efficient to rewrite from scratch.
Rewriting from nothing means I can safely license it with MIT
Since all code is mine or is from other bots with MIT licenses
thanks for this... my company has been using personal Skype which is stupid and i was gonna push us towards using Teams since we already have the full o365 setup
so to be clear, this is not a rewrite
instead we're trying to move to zoho cliq bc we also have the zoho one subscription but.. i don't love cliq it just feels like a barely completed application to me. I'm not technical enough to outline the faults like you did though.
is there a dream work-messaging app for you?
ah so you're writing a new modmail bot
no, microsoft teams sucks
oof'
pls don't use it if you have that option
of course it does suck everything from microsoft except Task Manager and Ms Paint does
indeed Microsoft Teams is great software
a
.topic
Suggest more topics here!
Wait is this channel a joke ?
yes
Ah okay
the names change every 24hrs
Okay
.topic
donuts
ye teams is great
.topic
Suggest more topics here!
the Daodejing
Brave New World
pygeneral be like: aUtOmAtE tHe BoRiNg sTuFf
lol
educated by tara westover
?
it doesnt fully collapse
o lol
how do i make it fully collapse
what is {% %}
django syntax
In Django? It indicates their template tags
o
it is singular bongocat
he is not bongoing
just sittin there with his paw in the air
🐱
bongocat
hi
hi
hello
!resources check out our resources list for many guides
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
thx
>>> ᓚᘏᗢ="cat"
>>> print(ᓚᘏᗢ)
cat
hmmm
mhm
what is this ?
The python discord off topic channel
@rare moat is back y'all
sup.
ouch, took me 3 hours of fiddling, but I made it work! Spotify api export of all my playlists and imported it to sqlite db. Unicode tables is still a challenge. Also the max request of 100 each time
!rule 6
lol, the staff breaking their own rules
¯_(ツ)_/¯
I can finally legitimately charge the admins for the voilation of their own rules 😎
same
same
ok
It's still on tho
lol
Faxmachine
google meet for me 🚀
🤮
discord vc 
lol
zoom is the worst of all
BigBlueButton > anything else
can't comment - Ive forgotten them all
thats what you get for browsing youtube during online classes
lol
I love myself
nice
bru I must leave now
it's love-hate relationship
@pastel nest added some python questions to the doc.
I like your new pfp @bold dove
a
b
could we not have blatant lies in channel names please?
wa
got it, i'll check it out!
c
@round moss you're singlehandedly carrying the entire next pr. thank you soooo much, these are incredible contributions :) i just finished checking your python questions, on to the cs!
Nice
yes
i installed it many moons ago
it was discord which downloaded it
file: C:\Users\\AppData\Roaming\discordcanary\Cache\f_004e1a
mm
why do u keep saying nice smh
going to think to some image questions tmr to spice up the variety, and then it's PR Time™️
@grim seal nice channel name
Why are you replying to them in the wrong channels
why are you pointing that out
Because I want to
?
why not ping there lol
you've been well versed in python for many years
soon i'll bar your permissions from ot2
i'll use ot1 then 😏
haha get rekt
lmao
👀
ooh
That's amazing!
yep
I've reached the point where the poor Rust function actually runs for a decent fraction of a second, lol
when I use a high MaxIters and horizon
still works fine, though
Only programmers would think a second is long
users would too if they were using it 😛
oh good i can chat here again
by the way, the window is resizable!
and the viewport automatically adjusts to it - as in, if you resize the window to half the size, fewer fixels will be calculated each time and performance will be better
my otn 😌
Lol
a second to me is an eternity
now make it colourful 🔫
black and white are colours too smh
this ot name is too good
Hey! How do I pass a 2d array to a function?
#include<bits/stdc++.h>
using namespace std;
// Print the distance of nearest cell
// having 1 for each cell.
void printDistance(int mat[N][M])
{
int ans[N][M];
// Initialize the answer matrix with INT_MAX.
for (int i = 0; i < N; i++)
for (int j = 0; j < M; j++)
ans[i][j] = INT_MAX;
// For each cell
for (int i = 0; i < N; i++)
for (int j = 0; j < M; j++)
{
// Traversing the whole matrix
// to find the minimum distance.
for (int k = 0; k < N; k++)
for (int l = 0; l < M; l++)
{
// If cell contain 1, check
// for minimum distance.
if (mat[k][l] == 1)
ans[i][j] = min(ans[i][j],
abs(i-k) + abs(j-l));
}
}
// Printing the answer.
for (int i = 0; i < N; i++)
{
for (int j = 0; j < M; j++)
cout << ans[i][j] << " ";
}
}
// Driven Program
int main()
{
int T;
cin>>T;
while(T--){
int N,M;
cin>>N>>M;
int mat[N][M];
for(int i=0;i<N;i++)
for(int j=0;j<M;j++)
cin>>mat[i][j];
printDistance(mat);
}
return 0;
}
It shows me that N and M were not declared in void printDistance(int mat[N][M])
How can I declare it before hand when I am supposed to get it as input in my main
Sorry for this C++ 😦
But might be you guys can help as always:)
if its anything like java, it should be void printDistance(int[][] mat)
or maybe void printDistance(int mat[][])
also please use codeblocks when posting code
yes
like so
```cpp
code
```
precisely
you're missing a few 69s in your username
lol
you can't have VLAs in C++, no?
i don't think you can
they are optional
afaik only standard that forces VLA's to exist is C99
huh, it does work in C++ with gcc, but not with msvc
yes, gcc has all the non-mandotory stuff while msvc doesn't have any of em
gcc adds more awesome features too
you have pointers
you know
int func(int *arr)
{
}```
and then you can pass
int arr[45] = {4};
func(arr);
you will also have to pass the size if you want it to be useful
but yes, that would work
well yeah
it creates a array of length 45 with all elements being 4
yes
o ic
it should create an array whose first element is 4 and the rest 0
oh yeah, sorry
i just woke up
pfp change?
me, yes
it's been a while with the mordecai one
so i decided to change it
I am! That's the pixelated image when I zoom in very far. And yes, that's doubles.
how tho
like, what would each color mean
currently I'm using the shade of gray to mark the iteration count
yea
uhh, but that'd literally be gray though
because all three colors would be the same
no using hsv
pub fn calculate_mandelbrot(
x_min: F,
x_max: F,
y_min: F,
y_max: F,
width: u32,
height: u32,
max_iters: u32,
horison: F,
shades_max: u8,
) -> Array2<u8> {
assert!(shades_max >= 1);
let horison_sq = horison.powi(2);
let fun = |(i, j), el: &mut u8| {
let y = y_min + (i as F) * ((y_max - y_min) as F / height as F);
let x = x_min + (j as F) * ((x_max - x_min) as F / width as F);
let c: C = Complex::new(x, y);
let mut z: C = Complex::default();
let mut converged = true;
let mut iter: u32 = 0;
while iter < max_iters {
z = z.powi(2) + c;
if z.norm_sqr() >= horison_sq {
converged = false;
break;
}
iter += 1;
}
if !converged {
let color: u8 = (iter as u8 % shades_max) * (255 / shades_max);
*el = color;
}
};
let mut img: Array2<u8> = Array2::zeros((height as usize, width as usize));
Zip::indexed(&mut img).par_for_each(fun);
img
}
here's my current impl
hmm, hsv... what'd be the hue, saturation and v?
saturation full, lightness half and hue the number of iterations
let's see what happens when I do that
might need to figure out how to make hsv images with image first though
or, rather, how to recode them into RGB
because I think it's easier to do on the Rust side than on the C# side
are u using Bitmap in c#?
yeah, I have to use WritableBitmap even because the normal one doesn't seem to support loading grayscale (1 byte/pixel) images
but with an RGB image I can probably use the normal one (passing it a stream made from the array)
ah, first I need to figure out how, in Rust, iterate only over 2 dimensions of an array...
how many shades of grey
32 by default, you can see it in the video 😔
how long does it take to index one tiny package aaaaa
ah, I see, it's because of my sins
yay! you replied to me
I'm in color hell now
how does palette even work
and it wants float32 components, u8 is a no-no
wait whot
let color: f32 = (iter as u8 % shades_max) as f32 / shades_max as f32;
let pxl: Hsv<Srgb, f32> = Hsv::from_components((color, 0.5f32, 1f32));
let rgb: LinSrgb<u8> = LinSrgb::from(&pxl);
el[0] = rgb.red;
el[1] = rgb.green;
el[2] = rgb.blue;
not pictured - the 10 errors I get from this snippet
