#voice-chat-text-0
1 messages ยท Page 135 of 1
Lol
hello all
hi Shashank
how are you all doing
we chiling buddy
I am upto some stuff so I rather not
should we start
didn't know what we had to do
share your code
marolo
@midnight agate
Wouold you like to joing
So this is just a analogy. But say i am trying to create a project to maintain my email accounts. Say i have three emails, gmail, outlook, yahoomail.
Say i want to write program that might include things like to search email, read new emails, reply email etc. Naturally i dont want to create 3 programs to manage each of my accounts separately.
I was thinking of making a generic email class that impliments all the functionality i need. that i can use in my programs. And i was create a different class each of gmail, outlook and yahoo mail to write their logics. But i am not sure how do i link my generic class with say gmail class.
I want to know if there is a better way to structure this project or how can i link classes effectively.
Thanks.
there is #software-architecture channel for some questions of that sort
more of discussion rather than just help
I'd say "generic" not in formal sense
base class not generic class
find what functionality is inherent to all three classes
class EmailAccount:
...
class GmailAccount(EmailAccount):
...
class OutlookAccount(EmailAccount):
...
class YahooMailAccount(EmailAccount):
...
word "account" can be dropped
I'd prefer having an abstract method there
instead of reflection
NotImplementedError
exception NotImplementedError```
This exception is derived from [`RuntimeError`](https://docs.python.org/3/library/exceptions.html#RuntimeError "RuntimeError"). In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method, or while the class is being developed to indicate that the real implementation still needs to be added.
Note
It should not be used to indicate that an operator or method is not meant to be supported at all โ in that case either leave the operator / method undefined or, if a subclass, set it to [`None`](https://docs.python.org/3/library/constants.html#None "None").
Note
`NotImplementedError` and `NotImplemented` are not interchangeable, even though they have similar names and purposes. See [`NotImplemented`](https://docs.python.org/3/library/constants.html#NotImplemented "NotImplemented") for details on when to use it.
@midnight agate also derive from ABC
it must be NotImplementedError not NotImplemented
there's actually three different errors related to abstractmethods
!e
from abc import ABC, abstractmethod
class Proper(ABC):
@abstractmethod
def example(self):
raise NotImplementedError
class NotAbc:
def example(self):
raise NotImplementedError
class Typo:
def example(self):
raise NotImplemented
for class_ in [Proper, NotAbc, Typo]:
try:
class_().example()
except Exception as e:
print(repr(e))
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | TypeError("Can't instantiate abstract class Proper with abstract method example")
002 | NotImplementedError()
003 | TypeError('exceptions must derive from BaseException')
!e
from random import choice
class Fruit:
def name(self):
raise NotImplementedError
def scream_name(self):
print(self.name().upper())
class Apple(Fruit):
def name(self):
return "apple"
class Banana(Fruit):
def name(self):
return "banana"
fruit = choice([Apple(), Banana()])
# we no longer care which fruit it is
fruit.scream_name()
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
APPLE
first error occurs on instantiation
to simplify the code
it's about how we can use different classes without rewriting code for each class specifically
thanks @midnight agate @vocal basin
@whole bear ๐
@somber heath hi
the solution I chose to go with so far is quite ugly
but maybe it will work
in some sense, introducing method overloading (or very wrong mixins? idk) into Rust
"still not sure whether or not I consider overloading a crime against common sense"
@pure gale ๐
@lofty crater ๐
haven't heard of it
Nor I.
is it allowed by YT TOS?
Terms of Service
you already can use YouTube without account on mobile:
browser
Google gets fussy about people accessing YouTube in ways Google doesn't intend.
make a burner account, disable all tracking
youtube isn't even against it
it gives recommendations based on IP sometimes
find where you can tell google to stop and tell it
same network -> same external IP
usually
doesn't go the other way around because NAT can put multiple networks behind one IP
that's why, for example, IP bans and IP restrictions are not a good idea sometimes
I heard it, so you have to too
#artimuswolz #comedy #chaos #depression #saddydaddyo #lexapro
Lyrics:
Just went to the doctor to talk about my day
About the way I'm feeling that I wish that I was dead
My life is getting heavy and it's taking such a toll
So I stopped to get a coffee that's darker than my soul
I head up to his office to talk about my day
We talk about my daddy...
nice
it's not really a good principle, as some say
being strict in both input and output is often better
!voice
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
can do what?
@haughty idol ๐
they said it will be a pop-up
whether it will actually be one -- idk
Once this change rolls out for you, weโll send a pop-up in-app for you to pick a new username.
most of dust here is just walls falling apart
(and car dust coming through the open window)
!voice
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Hey any of ya'll participate in competitive programming competions using python?? If i should get voice verification and stop typing here lemme know pls-
what level of competitions are you talking about?
a couple of months ago I was playing clash of code (at codingame) but that's not really serious stuff
as for serious competitive programming, I stopped two years ago
as soon as the need for it ended
how "serious" were you about it?
like did u have a rank on codeforces
"regional" level
didn't make it to country finals
What country are u from if you don't mind me asking
you don't have to asnwer that if you don't want to- im new to discord servers
didn't practice on that site
!voice
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
im tryna get good at it but like its mostly independent learnign
fixed wing?
sorry?
response to VC
gotcha
didn't hear "straight wing" term before in the context of aviation before
often it's "fixed-wing" and "rotary-wing"
discrete taxonomy for personalities works poorly, it's always gradients not categories
time to register for no real reason
@elfin harbor ๐
hello ๐
@primal mountain ๐
hi
- there were some attempts at solving CTFs
mostly unsuccessful
what are those
funny how account recovery is under "/amnesia/" path
yo u a profesh or just a hobbyis
hacking, competitive
ahh thats crazy
hard for me too
Im in my senior year of HS rn so i've competed in some hackathons
not yet employed
@whole bear ๐
just out of college?
dropped out of university because health
oh, are u planning on joining back?
@somber heath do yall do this often or is it just a by chance thing when everyones free
I have no idea for now
@wind radish ๐
im in india rn so weekend are prolly the only time imma get on- but hopefully i see yall around
Uno de los peces gordos de Microsoft, en lo que parece una presentaciรณn de esta compaรฑรญa, no para de hablar de los "developers".
@vocal basin if you ever get back to competitive programming, lemme know if you u wann help upsolve together- im looking to build a group of people who want to work on competitive programming together
phrasing
there needs to be a better acronym for that...
i couldnt agreee more- i thought everyone liked it thats why its so widely used
o_o
SP, sports programming
Alborghetti
sm better
will sit on the devil's lap
@paper stirrup ๐
@potent plank ๐
parsed a tablature from the song Dont Fear the Reaper from Bue Oyster Cult, and ploted the exponential weighted mean of the notes from each string from the guitar tablature
@rugged heron I guess something like this may feed a model, what do you think?
please no
either use block if
or use messageable = ...
and then await messageable.send(response)
also having positional boolean flags is kind of meh
@wind raptor maybe closing too early?
or, like
disconnect server-side to fix that
close the session when the server receives the message
you can also check if the author is any bot
so it doesn't respond to other bots
should it really be without await?
you're running with debug logs on, right?
@civic zephyr default doesn't include message content
what is intents variable containing?
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.
There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.
Afterwards in your code, you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see discord.py's related guide, and for general information about them, see the Discord developer documentation on intents.
intents = Intents.default()
intents.message_content = True
Bot can do everything Client can
- some more
most importantly, Cogs support
you can have Bots without prefix
just with on_message
and Cogs allow to make multiple on_message handlers
discord.py came back and now it's foremost
@civic zephyr yes, it uses reflection
idk if you can define your own events
does that help?
@wind raptor
(sorry, might've missed if you tried it already)
I did miss that
and without this
ugh
why do sockets need to be so difficult
"good opportunity to learn ZeroMQ instead of raw sockets"
It's just a fun little project, I'm sure it's something dumb that I'm doing wrong
maybe it gets GC'd?
!d asyncio.Queue
class asyncio.Queue(maxsize=0)```
A first in, first out (FIFO) queue.
If *maxsize* is less than or equal to zero, the queue size is infinite. If it is an integer greater than `0`, then `await put()` blocks when the queue reaches *maxsize* until an item is removed by [`get()`](https://docs.python.org/3/library/asyncio-queue.html#asyncio.Queue.get "asyncio.Queue.get").
Unlike the standard library threading [`queue`](https://docs.python.org/3/library/queue.html#module-queue "queue: A synchronized queue class."), the size of the queue is always known and can be returned by calling the [`qsize()`](https://docs.python.org/3/library/asyncio-queue.html#asyncio.Queue.qsize "asyncio.Queue.qsize") method.
Changed in version 3.10: Removed the *loop* parameter.
This class is [not thread safe](https://docs.python.org/3/library/asyncio-dev.html#asyncio-multithreading).
I'll go try make the thing using
https://docs.python.org/3/library/asyncio-stream.html
@wind raptor this probably fits better with asyncio
like
proper async sockets
oh
wait
eh
do sockets you're already using have wait_closed?
if you want multithreaded async, then use Rust
ECDHE
last e being ephemeral, iirc
@whole bear RSA is often used for long-term keys
though there's no strong reason to choose it over EC
agreed
@whole bear can't u do that on youtube- thats what i try and do
g2g for a bit cheers
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
@wind raptor
I tried making something similar but using only asyncio
(didn't introduce usernames yet; only /list which returns count of connected users, /exit to stop, /msg to send messages)
https://paste.pythondiscord.com/osebibikey.py
https://paste.pythondiscord.com/emazocofop.py
not sure if this is an appropriate diagram type
yes it is not
I just selected the more fastest i could draw
just to make more illustrative
(getting somewhat confused when trying to read it because usecases are mixed with objects)
ohh i thought he was talking about the leetcode question
these are heterogeneous (doing different stuff), right?
(as in, they are not replicas of each other like workers)
let me try to explain
The lowest actors are devices deployed on field with sensors which communicate with each other in low range radio layers in the mesh network, until the message reache the main device (COO - stands for Coordinator) .
The coordinator is a more complex hardware that has a woreless communication to sends the data to a broker through the internet.
On the web layer there is a web service listening to the broker that receive and decompiles the transmission, queueing the message to specific queues that are cosumed by specific microservices responsible for processing this kind of data
of course in this middle process the data is saved in databases, to be queried by the client
@tepid edge
I forgot what that question was
this, I assume
ah
yes, I'm not calculating adequately, I know
there are mathematical optimisations
there is no need to store the sequence
(reposting to not have to look it up)
#voice-chat-text-0 message
class Solution:
def fizzBuzz(self, n: int) -> List[str]:
list = []
for i in range(n):
if i % 3 == 0:
list.append("Fizz")
elif i % 5 == 0:
list.append("Buzz")
elif i % 3 == 0 and i % 5 == 0:
list.append("FizzBuzz")
else:
list.append(str(i))
print(list)
is it any difference between "for i in range(1, n+1)" and "for i in range(n)"?
I'll try to rewrite mine first
rewritten
def allowed(delta):
return delta in [-1, 1]
def total(sequence_first, sequence_last):
n = abs(sequence_first-sequence_last) + 1
return (sequence_first+sequence_last) * (n**3+3*n*n+2*n) // 12
def sequence_sums(arr):
arr = iter(arr)
last = next(arr)
sequence_first = last
sequence_last = last
last_delta = None
for x in arr:
delta = x - last
if last_delta is None or delta == last_delta and allowed(last_delta):
sequence_last = x
else:
yield total(sequence_first, sequence_last)
sequence_first = last if allowed(delta) else x
sequence_last = x
last = x
last_delta = delta
yield total(sequence_first, sequence_last)
def solution(arr):
return sum(sequence_sums(arr))
knowing first and last elements of a continuous sequence is enough to get the sum
(sum of all sums of all subsequences)
polynomial fit of experimental data
(guessing)
by brain can't parse DSA as something other than Digital Signature Algorithm
I still have no idea if it's a correct solution
but two my solutions are equivalent, at least
class Solution:
def fizzBuzz(self, n: int) -> List[str]:
list = []
for i in range(n):
if i == 0:
pass
elif i == 1:
list.append(str(i))
elif i % 3 == 0 and i % 5 == 0:
list.append("FizzBuzz")
elif i % 3 == 0:
list.append("Fizz")
elif i % 5 == 0:
list.append("Buzz")
else:
list.append(str(i))
print(list)
!code
class Solution:
def fizzBuzz(self, n: int) -> List[str]:
list = []
for i in range(n):
if i == 0:
pass
elif i == 1:
list.append(str(i))
elif i % 3 == 0 and i % 5 == 0:
list.append("FizzBuzz")
elif i % 3 == 0:
list.append("Fizz")
elif i % 5 == 0:
list.append("Buzz")
else:
list.append(str(i))
print(list)
use proper range bounds instead of checking for 0
range(1, n)
this if is totally unnecessary
because it's already covered by the default case
try range(1, n+1)
!e
from operator import add
from itertools import starmap, cycle, count
or_ = lambda x, y: x or y
fizzes = cycle(["", "", "Fizz"])
buzzes = cycle(["", "", "", "", "Buzz"])
numbers = map(str, count(1))
solution = starmap(or_, zip(starmap(add, zip(fizzes, buzzes)), numbers))
print(" ".join(next(solution) for _ in range(100)))
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz Fizz 52 53 Fizz Buzz 56 Fizz 58 59 FizzBuzz 61 62 Fizz 64 Buzz Fizz 67 68 Fizz Buzz 71 Fizz 73 74 FizzBuzz 76 77 Fizz 79 Buzz Fizz 82 83 Fizz Buzz 86 Fizz 88 89 FizzBuzz 91 92 Fizz 94 Buzz Fizz 97 98 Fizz Buzz
so, apart from import errors, it worked first try
def logo(): where_are_they=( 'building','pubblic_structure','space','home','city','natural locatrion','office') sx=random.choice(where_are_they) if sx=='city': city=['phone box' 'office', 'parking lot', 'public library', 'art gallery', 'zoo', 'bookstore', 'cafรฉ', 'truck', 'marina', 'port', 'town square', 'vineyard', 'cinema', 'market', 'strip club','dark streat', 'bank','gym', 'hotel', 'motel', 'bus', 'car', 'restaurant', 'fast food', 'swimming pool', 'main hall', 'stadium', 'pubblic toilet',] fc=random.choice(city)
a=['home','hotel']
if a=='home':
alien
english
coats
Snowboard coat
Republic
Telepathy
Kevlar
Internet-connected appliances
Gin
Hot
Jet pack
Ice Helm
Jasmine
Tonfa
classes
Punk
classes
community center
futuristic
Stable Diffusio Online Demo. FREE forever. Create beautiful art using stable diffusion ONLINE
yeah yeah
just chilling
you are using django as backend for the bots?
no, just for websites
so, theres an idea you can use
and django API
and bots that communicate withe API to store data
storing a lot of messages and let parallel jobs running to generate statistics like word clouds, word frequencies, sentiment analysis, data mining, etc
so the bots doesnt nees do do the heavy work in runtime and leave thu user waiting for a response while the bor processes a lot of data
if you start now, tomorrow will be less difficult
but is only an idea of course ๐
so, imagine, the same django API that feeds the bots, may feeds a website
but I got your point, your planning a monolith, right? ๐
im sorry, dont really know what is monolith 
monolith is a all in one system
a webpage, a server, a database all together in the same project, running in the same environment
yes, if is a small prject is a good pick
otherwise, if one small part of the system fails, the entire system goes down ๐ฆ
use a message queue to connect web API and the bot
what kind of queue you intend to use?
though that depends on the specific usecase
imo, even for small systems, microservice architecture is easier to maintain
but doesnt makes more sense to build just right and Web API to comunicate with the Bots intead of it? ๐ค
how are you going to make an API request to the bot?
I have chatbots that works like that, communicating with backend APIs
hosting HTTP API in the same process as the bot isn't very good
but also, I have discord buts that does not communicate with any backend at all, just store data directly at a mysql host without need of API processing
I guess it will depends what your intention
(that was more about how to make requests to the bot)
actually, if you are intended to use a bot for telegram or discord, you dont make requests to the bot "directy"
although you can
but the platform does it for you
you do not do this from the server side
example:
discord bot that has a website to access some of its data
it can be done without involving the bot, if you're only querying
it becomes difficult when the bot needs to do stuff in response to web requests
so, in this case, I suggest you do something like I said
the discord interface interact with the bot,
the bot send the data to the django API
the django store data on database
website can query data from API
bot can query data from API throu bot command
mobile app can query data from API too if you develop an app
all of it communicate with a single core
which manage, process and secure all the data
how do you get the request from the browser to the bot?
with an http request
in what direction?
do you wat to see? I show you on dm since you cant speak on voice here
Ah sorry
Alisa can
bot can't "ask" for the request
polling periodically is inefficient
Ill ask you again, if you can see I share screen on dm with you because here I cant share screen
and its not polling
is on demmand
how does the bot know when to send the request?
@surreal cape to ask for streaming permissions, go via ModMail. I only saw your DM because I was trying to send one myselfโฆotherwise it would have sat there for days!
request is made by the browser, not by a bot command
when the user sends a message that trigger a necessary need to call a request to the backend
there is no message
request originates in the browser
which makes a request to the service which has a bot associated with it
this model works sometimes, but has drawbacks, mostly regarding reliability
Ty, I was not sure how these momail works so I was a little shy about use it, but a open a ticket, but Im still a little bit confused of how it works
it said that created a thread
what kind of bot youre talking?
a discord bot?
so how the request is made by the browser?
and what difference does it makes?
its an http request to a backend anyway
if you need to query information, you query information, if you need to save information, you save information
minimal example:
website has two features
- login (via discord)
- if logged in, a button that if pressed sends "test" from the bot account to the user
and then is sent by the internet over the http/https protocol
as it is expected if is this were the method you programed the software to behave
if you used another method like opening a websocket it will work as well over ws/wss protocoll
so, okay, what is the full route that the request takes from the browser to the bot in this case?
does HTTP API service somehow call the bot?
if you programmed to subscribe.publish to a AMQP queuing system it will pubsub to a rabbit queue
NO, thats what i have said
the discord interface interact with the bot code which send the http request to the API
the API only return a response of a request made by the bot or website or mobile app, or desktop application or whatever application
and yes, you'll often have to involve a broker to get reliability
with dependencies like this
as I said, IF you choose another paradigm, technic, methodology or whatever you want to call, or even a mixup of things you CAN use QUEUE
THEN bot will receive response but because the API CALL the bot but because the bt will be LISTENING our SUBSCRIBED to a QUEUE or TOPIC system
unless you implement an API server or grpc on the bot application
then you can eceute calls from anywhere to the bot application :hide_the_pain_harold:
(that all was just a long way to answer "rabbitmq"/"beanstalkd")
thats an answer I was expecting to hear/read
I like rabbitmq
actually I gotta move my ass someday and start to play with kafka sometime
interestingly, more reliable patterns even in the broken paradigm of how, for example, python async works, involve queues too
so, getting thinks to work correctly in async gets things easier to transfer over to multiple service architecture
so rabbitmq is broker right?
Yes, have ever used?
never)
everything like that belongs in docker
https://hub.docker.com/_/rabbitmq
RabbitMQ is an open source multi-protocol messaging broker.
yes, my instance is an docker image :hide_the_pain_harold:
depends on the specific message queue
decouples producers and consumers
I wonder how well it can be distributed given it's built on Mnesia (which can be multi-instance)
in the most primitive form without extra guarantees, it's just a queue:
you can push to it
you can pull from it
what extra systems and protocols do, are those extra guarantees
for example:
- ensuring messages are stored until they are properly processed
- managing what "properly processed" even means
In rabbit is a little confuse, but with practice you get it.
Is something like each CONSUMER must have your OWN QUEUE
the queue mus have a BOUND to and EXCHANGE
the BOUND is created by a ROUTING_KEY
all the messages a publisher sends is published in an EXCHANGE over a ROUTIN_KEY
a QUEUE can have as many ROUTING_KEYS as you want
all queues binded to the exchange containing the routing_keys associated to the message sent receive the message
interesting
example of the second
https://greenstalk.readthedocs.io/en/stable/quickstart.html#job-lifecycle
I have a public queue
how can i do it?)
sure
let me see if I find a easy solution to pub/sub with python
lets mine google around libs python to use rabbit
i know two of them
kombu
and ...
what was the other ๐ค
pika
I suggest kombu
google for kombu python
to publish
ill test here if its workin
and dont forget
pip install kombu
exchange type รฉ topic
bruh
(403) ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
easy, let me see here
got same error
let me check if theres a public user
seems like the public its not so public at all
:hide_the_pain:
much like the "public transport" here on Brazil :hide the pain:
nice
right we did it
now lets do the consumer
so we can view what each other are sending
oke
writhe down that producer to a script while I do a quick review for the consumer
so you can quickly run a script that gets an input from cmd and sends the input message in the producer payload, ok?
sort of
like
message = input('message: ')
# code of the producer
then where you have inputed that hello beelze you inser the value of the variable message inputed from message
then you run your script.py
input a message and voila
sends me a message
oh my youre fast, I was on the bathroom :hide the pain:
I guess nit test it send some messages it will nqueue here at the broker
hmm
because if i just write message its an error
actually the invert
use the input as value
oh no
sorry
correct
message is the variable used as value
so its fine?
but use a key, dont leave empty
okey
just fill with any "string" you want
So, Proxmox is used for?
gotcha
I do
ahh
make sense
remove everything lol
docker by default runs as a root user
don't I have permissions to unmute the mic in this voice chat?
gotcha
lemme see
RIP I need to send over 50 messages
can I spam this channel?
Oh I see
which channel again?
gotcha
there should be a bot
how's it going yall
@gentle hedge did it worked?
no
what happens?
"Have over 50 messages in the server."
yep
what your doing?
I'm talking to you so I can use voice lol
give me the copilot role bro
when you were copilt you have "azucrinated"
you're lying
but about the app
yep, but the interface is weird
do you want to still adjusting it or you rather fork and implement the graphql in the API?
idk
I still need to correct a lot of things in the way I create the chart
my heart tells me to finish it by tomorrow, or I owe you a pix
so i guess is this wat you want to do
:harold:
actually let me review my work
I have procrastinated the whole day
me too
and also, made new friends here
my gf wanted to watch movie
I didn't do much today, I became a useless being on this beautiful saturday
then code two, because mine might want to drop me
:harold
29 messages ;-;
if I achieve the capacity to be able to code a single one with scalability design, the I will surely replicate many and open a company to sell billions to nerds around the world
let's do it
I will sell my BMW and start to drive a Ferrari
I give you moral support and you do the rest
oh yeah, im a god
Hello, I am a beginner coder and I need help with a school assignment
A male version of Afrodite
can anyone help me?
what you need?
what the problem friend?
I am simply asking for guidence of what I would need to mark as x
I am very confused on what to mark as x since I do not understand the pattern
would be customisable just like cyberpunk
me or the AI gf?
but what was the last assignmet?
A simple multiplication chart which doesnt seem to correlate
let me see if I understand
yu have to print all X?
or stop the loop when find the first X?
it is not very clear
I have to make it look exactly like the output
HMMMMMMM
I have that done but I need to make it have the x's in the right spots
which is what is completely confusing me
you have to generate an output that looks like this matrix right?
if
got it
Like the white multiplication table
I made the black one
the second row is doubles
ok
like is second row so starts on 2, and goes multiplying for the value of the colum index
so
the columns index are
1 2 3 4..
2 * 1 = 2 | 2 *2 = 4 | 2 * 3 = 6 | ...
and the same pattern for each row
now lets find when we have to fill with X
its working?
Yeah
oh well
I just need to find out how to fill in the spots with x's
its kinda working
It results in this out put but I need to make it turn into this
lets say that works when it solves it purspose, just to we dont get lost or misunderstooded
Ok!
lets see, start simple
if row_num => 3 and col_num >=3:
value = 'x'
right?
I simplified, the appending you will do
I see
But what about the 81?
I suggest the iteration you execute with enumerate
for row_num, row in enumerate(matrix):
# do somethin with the row
for col_numm, col in enumerate(row):
# do something with the colum
YES, I was waiting you for asking that
this is an check taht you might use before the loop
ok
by doing this you saves cyclomatic complexity and time exceution
matrix[-1][-1] = 81
does it resolve?
I don't know what cyclomatic means ๐ญ ๐ญ ๐ญ
for row in range(1, num_rows + 1):
for column in range(1, num_columns + 1):
if column >= 3 and row >= 3:
print("X", end="\t")
else:
result = row * column
print(result, end="\t")
print()```
num_rows = ??
num_columns = ??```
sorry, correcting myself, you do this AFTER the loop
I am an extreme newbie at coding ๐ญ
ok lets go for parts
try
the matrix size is 9x9 right?
Yeah
>>> rows = list(range(9))
>>> rows
[0, 1, 2, 3, 4, 5, 6, 7, 8]
>>>
if I do that I make a row, right?
yeah
you need 9 of that
here it is
You can do better than that
since it is currently outputting this
idk if I can im so new to this ๐ญ
ok
keep calm bro
does the 81 need to appear at the end?
Yes.
ok...
if row == num_rows and column == num_columns:
print("81")```
num_rows = 9
num_columns = 9
for row in range(1, num_rows + 1):
for column in range(1, num_columns + 1):
if column >= 3 and row >= 3
if row == num_rows and column == num_columns:
print("81")
else:
print("X", end="\t")
else:
result = row * column
print(result, end="\t")
print()```
try
ok
That worked! Thank you!!

So I used yours as inspiration while tweaking mine and I got this! The code may be a little messy but this is what the rubric was graded on.
I got a solution
>>> matrix = []
>>> columns = list(range(1, 10))
>>> for i in range(1, 10):
... row = []
... for colum in columns:
... if i>=3 and colum >= 3:
... row.append('x')
... continue
... row.append(i*colum)
... matrix.append(row)
>>>
>>> matrix[-1][-1] = 81
>>>
>>> for r in matrix: print(r)
...
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[2, 4, 6, 8, 10, 12, 14, 16, 18]
[3, 6, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[4, 8, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[5, 10, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[6, 12, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[7, 14, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[8, 16, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[9, 18, 'x', 'x', 'x', 'x', 'x', 'x', 81]
nice
3
if i>=4 and colum >= 3
if i>3 and colum >= 3:
>>> matrix = []
>>> columns = list(range(1, 10))
>>> for i in range(1, 10):
... row = []
... for colum in columns:
... if i>3 and colum >= 3:
... row.append('x')
... continue
... row.append(i*colum)
... matrix.append(row)
...
>>> matrix[-1][-1] = 81
>>> for r in matrix: print(r)
...
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[2, 4, 6, 8, 10, 12, 14, 16, 18]
[3, 6, 9, 12, 15, 18, 21, 24, 27]
[4, 8, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[5, 10, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[6, 12, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[7, 14, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[8, 16, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[9, 18, 'x', 'x', 'x', 'x', 'x', 'x', 81]
of curse there are those line to draw and beautify the output
show the row and col numbers
etc
but the algorithm itself it something like that
now make a version where the output is a dictionary {} where each column is a key containing the multiplication table as a value, inside a list
lol
cant you talk yet ?
meh, I could but not interested
so weak
more interested in playing with that tablature data anal ysis
well Im here since 2020 and still cant screenshare ๐
.
@limpid crypt ๐
I'm talking to a bird.
So if I talk like I'm talking to a baby, I'm not talking to you. ๐
@shrewd delta ๐
its not letting me talk
!voice
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
!voice
yeah its not going to let me talk until i have been in the server for at least 3 days
@somber heath
!voice
!voice
im trying to figure out how to get my discord bot online
!code
import tkinter as tk
import time as t
import threading
root = tk.Tk()
label1 = tk.Label(text="0")
label1.pack()
first_value = 0
def sdd():
first_value = first_value + 1
label1.configure(text=str(first_value))
t.sleep(1)
root.mainloop()
@somber heath
import tkinter as tk
class App:
def __init__(self):
self.root = tk.Tk()
self.callback()
def callback(self):
print('Hello, world.')
self.root.after(1000, self.callback)
def run(self):
self.root.mainloop()
App().run()```
@whole bear ๐
@somber heath broooo how do i print first 10 prime numbers
need help
in my interview
yes
bro quik
i only have 5 minutes
๐ญ
no nothing
no skills
i just want the job
for i in range(1,11):
print(i)
def is_prime(n):
for i in range(2, n/2 + 1):
if n % i == 0:
return False
return True
bro i just wrote print("2,3,5,7,11,13,17,19,23,29")
hopefully i pass
while everyone is searching outside the box, ya know what i open and look inside the bo
x
๐ฟ

why so emptiness in the vc
@surreal grotto ๐
bro i cant speak i don't have voice perms for some reason
!voice
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
yt sigma edit mfs be like - "silence speaks more"
facts
๐ฟ
@red peak
unit tests or integration tests?
snakes in toilet or not
Depending on the changes
context sounded like writing it for other contributors' code
(that's why the question)
Nah, We do it for our own code. I work for a small company
other contributors as in not you
@surreal grotto do you know liqhtbee?
unit tests and code itself are supposed to be written by the same person
most of the times
@surreal grotto writing unit tests for other people's code is an incorrect workflow, often
so hate for that is somewhat reasonable
if there's a person who's good at unit testing, they should be reviewing tests other people wrote, not writing it for them
What about TDD? I've never worked in a TDD structure. Does everyone write their own tests even in TDDs?
what do you mean by TDD?
I know but there are different definitions
one is the correct one:
red-green-refactor loop with minimal iteration steps
just writing tests before code isn't enough for TDD
for certain reasons, not all development environments are fit for it
- not all tests are unit tests
TDD works only with unit tests
another reason:
you might not know what the function/method/etc. is expected to do
make components as simple as possible
so that the most rigorous and detailed documentation wouldn't be a mess
there are also different types of documentation
not documentation (comments)
in-code documentation
external documentation (books and stuff)
comments reduce readability
if the code is too complicated, there should be a separate paper/document to explain what it does
with comment linking to it as an excuse for it being unreadable
beep boop uwu
oh nawww ๐
2 + 2 @ "Alisa Feistel"
^ can't apply matrix multiplication between an `int` and a `str`
bro has 22k messages ๐
!d operator.matmul
operator.matmul(a, b)``````py
operator.__matmul__(a, b)```
Return `a @ b`.
New in version 3.5.
that one operator that was added only because numpy needed it
is that cheese?
!e
0 @ "str"
@vocal basin :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | 0 @ "str"
004 | ~~^~~~~~~
005 | TypeError: unsupported operand type(s) for @: 'int' and 'str'
Beaver cheese, maybe.
could be
Beaver parmesan.
i don't know much about cheese
You're not a bot right?
!e
import numpy as np
x1 = np.array([2j, 3j])
x2 = np.array([2j, 3j])
print(x1 @ x2)
@red peak :white_check_mark: Your 3.11 eval job has completed with return code 0.
(-13+0j)
I was checking what error it outputs
Ok. Because I think Elvis was tricking me into thinking you're a bot
which to be fair is kind of hard to discern nowadays anyway
i 'll choose a number between 1 to 10, i chose 7 guess what i number i picked.
is "chose" and "picked" the same thing
Broadly, but while you might choose a flower, the act of bisecting the stem is the picking.
E
mutton's texture is kinda weird
yeah
i think goat's meat is also called mutton?
O_o
who's setup is this clean and systematic ๐คฏ the plant tho ๐
not clean for long given food placement
guess my rat's name
Freddy
it starts with r and has 11 characters
like, why is it like that
that's so much not safe
fr
i don't want snake on my bum while excreting
๐ญ
the dogs in india bro ๐
what
@red peak where you live bro
has anyone been bitten by a spider?
i want my picture good tho
pretty
รle de Brรฉhat
yo this is wild
wtf
where is that?
Fairy Bridge, China.
oh naww
lovely place
No, I'm just being a dunce.
for what?
do you need uni tho you can defo learn everything online
just general competence, employability and jumping off points for further learning
that doesnt sound sustainable tbh
how long have you been doing this? @frail jetty
Weirs circumstances: being Russian.
And this fking government want to sent me to the fucking fields.
huh
hi guys! how can i get the right to participate in the discussion?
Total mastery, probably unrealistic, becoming highly competent in specific niches, very doable in relatively short time
You can defo learn multiple languages at once haha @turbid sandal
as previous developer i think, it would be easier to specify the field that you wanna be active in, cz python is so broad
@frail jetty
lol
Iโll be back I. A lil
@young vessel over here
!code
!e
class test():
def __str__(self):
print("test")
print(test)
@turbid sandal :white_check_mark: Your 3.11 eval job has completed with return code 0.
<class '__main__.test'>
!e
class MyVector:
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return f"({self.x}, {self.y})"
def __repr__(self):
return f"MyVector({self.x}, {self.y})"
def __eq__(self, other):
return self.x == other.x and self.y == other.y
def __len__(self):
return 2
v1 = MyVector(2, 3)
v2 = MyVector(2, 3)
print(v1)
print(repr(v1))
print(v1 == v2)
print(len(v1))
@wind raptor :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | (2, 3)
002 | MyVector(2, 3)
003 | True
004 | 2
if __name__ == '__main__':
show_popup()
Supervisor process control system for Unix (supervisord) - GitHub - Supervisor/supervisor: Supervisor process control system for Unix (supervisord)
!e
len(0)
@vocal basin :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | len(0)
004 | TypeError: object of type 'int' has no len()
(checking error message)
Learn assembly language programming with ARMv7 in this beginner's course. ๐ฆพ
ARM is becoming an increasingly popular language in the world of computer programming. It is estimated that over 200 billion devices contain an ARM chip, making the ARM language valuable to understand. By understanding an assembly language, programmers can have a better...
is there actually a meaning to __len__ when there is no __iter__/__getitem__?
(I wonder if there are valid usecases for that)
also I think this would be more correct
f"MyVector({self.x!r}, {self.y!r})"
# ^^ ^^
!e
class MyVector:
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return f"({self.x}, {self.y})"
def __repr__(self):
return f"MyVector({self.x}, {self.y})"
def __eq__(self, other):
return self.x == other.x and self.y == other.y
def __len__(self):
return 2
MyVector(0, 0) == 1
@vocal basin :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 18, in <module>
003 | MyVector(0, 0) == 1
004 | File "/home/main.py", line 13, in __eq__
005 | return self.x == other.x and self.y == other.y
006 | ^^^^^^^
007 | AttributeError: 'int' object has no attribute 'x'
lol it was just an example to show what dunder methods are and how they interact with built-in stuff
Not meant to be practical
I know
I still haven't settled on how I prefer to write __eq__, so now thinking
most of the time I do
if isinstance(other, MyVector):
return ...
else:
return NotImplemented
but that's neither looking good nor allowing duck-typed comparison
yeah, that makes sense to check that the type matches
I think ternary there is even uglier
though
depends on what you want to emphasise
return natural_and_obvious_comparison if that_comparison_is_possible else NotImplemented
if that_comparison_is_possible:
return natural_and_obvious_comparison
else:
return NotImplemented
different order of reading
or
match isinstance(other, MyVector):
case True:
return ...
case False:
raise Error("You done bad!")
haha
match other:
case MyVector(x=x, y=y):
return self.x == x and self.y == y
case _:
return NotImplemented
eh
register size depends on the operation
you specify it
@velvet palm ๐
@boreal shoal ๐
hey
unlike how it's often used in C where it's 4
can someone help me with making a Cookie Clicker for my school project?
making it with Flask
@hearty gorge ๐
java script, html and css.
@rugged tundra Oculus and stuff to eyes are like some distant object
in terms of how eyes focus on the object
lenses and stuff
but there is a different problem still
which is:
everything is at the same distance away anyway
like
you're moving your eyes depending on the depth
but you're not changing their focus distance
I think this impacts why sitting in darkness is bad too
return self.x == getattr(other, 'x', nan) and self.y == getattr(other, 'y', nan)
without type checking it becomes weird
this catches more than necessary
try:
return self.x == other.x and self.y == other.y
except AttributeError:
return NotImplemented
this is too long
try:
x, y = other.x, other.y
except AttributeError:
return NotImplemented
else:
return self.x == x, self.y == y
as for hasattr: just no
Oxide are developing their own Firmware
for stuff they can
Oxide Computer
I think Steve Klabnik works for them
and they believe in accessible open-source hardware being reality at some point
is there a way to automate this using decorators?
though most similar methods can just have type annotations
that'd have to be a decorator on the class, not on the method
another hard topic about special methods:
signature of __exit__
Pylance somehow understands __exit__'s return type
but I haven't found so far how to express it in code
there are two options
None | Literal[False]:
it never suppresses the error
None | bool:
sometimes it does
yes
if you use ExitStack with Pylance looking at your code, it will scream at you for using variables you defined inside with after it exited
because ExitStack can exit with True
I prefer wrapping everything in with
instead of adding hooks
when you might need hooks, is when you can't reach the with
panic/abort
#voice-chat-text-0 message
TaskGroups as a very useful example of context manager
I later did add the user list functionality
I still think async with is one of the main things keeping me from moving away from Python
I probably didn't
PySide seems to be fine with async/await
https://doc.qt.io/qtforpython-6/examples/example_async_minimal.html
ah, yes, they have their own async
I remember doing that
I used PySide for four months in school
yes
it seems to also properly handle when clients crash
but not the server yet
when the server crashes, it only detects that and says "please type /exit"
aiohttp is probably built on top of asyncio's channels
remember
++C == C
@quasi quiver
software engineering principles apply both to front-end and back-end
front-end has quite a lot beyond just HTML/CSS
HTML/CSS are weird
but anyway it's that kind of tools when you just can make it work
even when you build back-end, you can make monitoring tools and other stuff
eh
C++ is expressive too
"instantiating a class is very easy in C++
here are top 71 ways to do it: ..."
I still haven't checked my previous attempt at listing ones I know
new MyClass();
MyClass myinstance = new();
MyClass myinstance();
make_unique<MyClass>();
Rust's OOP is like Haskell's OOP + dynamic dispatch
that's the first option from those four
I just didn't bother writing variable name
idk
(in Haskell you don't need dynamic dispatch)
I guess also if the function has return type specified you can just return new();?
no idea, tbh
Learning Rust With Entirely Too Many Linked Lists
@random root here
void is weird
zero-sized types too sometimes
I think MSVC has some issues when you introduce zero-length arrays
to whoever asked:
VS Code has a more powerful language server
hello
whats a language server
so in python multiple inheritance
print("hello");

