#ot2-the-original-pubsta
652 messages · Page 58 of 1
I'm always hesitant about recommending free hosting and free databases
it never ends well
But if you're already hosting a modmail bot
supabase is the exception actually, lol, I do like supabase
Why not host a postgres db in the same place?
even if the goal is for everybody to use for free i think u only really need to start looking for good hosting options once u start getting lots of users
like how many users are currently using the app now
you're missing it slightly, ARU is not hosting
^
I'm using Supabase just cause I know I'll be the only one ever using my app
the idea is that ARU provides the source code and then users can set it up however they want
And 9k people use the kyb3r modmail
oh ic
Are we talking about databases
so obviously designing it to be low cost is appealing
y dont just let the users decide how they want to store their data or sth
but yeah, personally I'd fork out the few bucks/mo for hosting a VPS w/ PSQL
Thank you, lol
well, you can't build every database method into your app
I need to learn the basics and intermediates of SQL. I'm not really employable without that. I've avoided it for so many years because I hate it so much
like give them a range of options
Ye, but I've been in the server and hosting for free is a really big appeal
which is what most orms do
I mean, if you wanna code all of the different database methods, I won't stop you lol
But to interface with different databases, I have to write code for that
what is an orm?
you can't abstract mongodb vs postgres behind an ORM
they are completely different databases
postgres is relational sql, mongodb is document & nosql
like typeorm apparently supports some nosql and lots of sql
I like that it's open source
it does have the notable disadvantage of being typescsript in a python app 😛
I've yet to see a fully compatible mongodb/postgres ORM in Python
and... frankly I don't want there to be one
it would lead to some really horrible database setups
https://github.com/supabase/supabase-py for the Python API wrapper, although you could always just use the API
mongo and sql arent much compatible
hm
tho if you do an orm for sql databases you still have lots of options
well i guess if ur just using sqlalchemy or pymongo u cant mix
yeah, but mongodb generally does have the best free hosting offerings
can't i use a postgresql connection uri?
additionally you could bundle an sqlite database
It hosts Postgres databases for you
It has it's own uri that it gives you I think
ngl i can't even find the supabase pricing
Is that a good thing or a bad thing?
good thing
the one little problem i have with this is this line
and this is for an important reason
That just means the database pauses iirc
So the first query might take a little longer
and you have to restart it from the portal
Oh, idk
Oh, I see
Well in my thinking, if you're not getting one thing in a week, then you don't need a modmail bot
and this is a small problem since heroku gives only 550 hours a month which doesn't cover the entire month
welp thats kinda what happens with free tier
but i think its okay to live with that slightly friction imo
cuz its their electricity that u r using
ehh, I've maintained communities where that is the case, but they still need modmail
I'll have to ask the other people who I'm working with
I mean I guess.
I would think you would just message a mod
But if you have error handling in the bot, it shouldn't really be a problem
Or just use Mongo
the issue is you have to open the dashboard when that goes down
a small solution would just be set up a ping on uptime robot lmao
depending on their terms of service
Or just have the bot get data from the database every day
And gather data that it does nothing with
.
bot might be off for a week
Ah
there's 750 hours a month
Well if it's been offline for a week or whatever it is, it shouldn't be too much of an inconvenience to go to a dashboard imo
yeah
But it's up to you
and its possible to get heroku to host for the whole month for free anyhow
also can just add a tip to the setup guide
there isn't any db support yet
You should add a README
soon, its on my list
Why are the emojis commented out? https://github.com/discord-modmail/modmail/blob/main/modmail/config-default.toml#L30-L32
modmail/config-default.toml lines 30 to 32
[emoji]
# sent_emoji = "white_heavy_check_mark"
# blocked_emoji = "\\N{NO ENTRY SIGN}"```
that file shouldn't even be commited atm
Oh lol
will fix
tl;dr if i can figure out how to get a db connection uri for the databases on supabase
we'll use it
since i want this to be compatiable with not just supabase
afk
It's in Settings > Database > Connection String
Dope
@grim seal i talked with the team and postgresql on supabase all the way
so no more mongodb
now i gotta redo a portion of the config system for the nth time
asyncpg or aiopg?
Nice
Rice sure is entertaining
read it as "Rust", had no questions
haha
help, my laptop is lagging even though i have about 50gbs left of space and 3.79 ram that is still usable out of 4.00 ram
How do you test a programming language you're making? Simple question, but for some reason it's stumping me
Well
You can give a test input, and have it evaluate it
Or for seperate parts, have each of the parts of the language do its own thing with a given input
And see what the output is
oooHHH
How can I run exe files on mac, on big sur?
when windows thinks drscheme installer is a virus
@grim seal you here? need some help
@dim root I replied in the discord-modmail guild but does it work locally?
same
!pypi poetry
Need to open docs since on mobile lmao
Hm
Oh
The package itself seems to be installed
Idk
poetry remove piston-cli?
what it works now, did a relock
Ah lol
Fwiw I would think of adding this to your commit list or whatever
🤞
running
nooo
it works locally tho
i am using tokens and they are correct
boom it worked
those who are interested: https://github.com/Piston-CLI/piston-cli/releases/tag/v1.4.0
epic
nice
what's some good essay writing music?
got a long night ahead of me
lofi is a bit too sleepy for me
who plays fall guys
not me
ya I can prob help later today if you didn't fix
fixed it already 🙃
debugging workflows is hell lot of work
you cannot do it locally ig
https://github.com/nektos/act works dometimes
ah yes, dometimes
dometimes. lol
Lol
yes
lol
Wow so realistic
lol
lol
editing 
no 1 billion
cry about it
lol
sorry
@indigo nest This isn't a place to advertise your minecraft server, please also read our off-topic etiquette if you haven't already
Hey @midnight perch!
It looks like you tried to attach file type(s) that we do not allow (.7z). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a.
Feel free to ask in #community-meta if you think this is a mistake.
L
O
L
static int program1(int n, int[] arr) {
int val = 0;
for (int i = 0; i < arr.length; i++) {
val *= arr[i];
}
if (n==0) return val;
return program1(n-1, arr);
}
what does this program do?
i was thinking if u set val = 0 wouldnt 0 multiplied by anything give u 0?
yes
this will always return 0
where'd you find this
they probably meant to set val = 1
it was a worksheet
ohh ok
lemme thinking abt it again
Depending on how java defines signed overflow, it may also be infinite/undefined in some cases
oh ok
or it might be a trick question
Wait, why would there be overflow on multiplication by zero?
btw this function gives out an integer right?
and you're supposed to answer 0
cuz after static it's int
n-1 doesn't tend towards 0
yes
Oh, right
dont think so it's asking what's the recurrence relation here
can i check for this function, all it does is to return the product of the integers in an array?
i feel the n is abit unnecessary? like even if it starts of n>0, it's gonna keep -1 till it reaches n== 0
ye, the recursion thing does seem useless to me
not like arr changes at each recursive call
oh ok can i check with you for return , does it only return the last value?
it wont be a few values?
yeah cuz before n reaches 0, it will keep returning the arr
i see ok so it jus returns the last value when n==0
thanks
@dusky cliff i realise when the qn asked find the recursion relation, they were finding T(n) = ...
the efficiency
which was T(n) = O(x) + T(n-1)
hmm
Yes Rice is good
riceing
ricing good
I have a question
A, well, inquiry
shall I use arch or openSUSE
I can't decide
fuck it im using arch
well, one of the rules of ot is to respect ongoing discussions. so people in other channels just continued their topics
and yes, one can make their own operating system
I mean I wrote a kernel once
But I'm not sure how I would go about ricing that
or using it
uh
somewhere in my files
all it does is print hello world to the screen :P
It was just to see if I could do it
just a question, why do many pythoners prefer to write json data instead of python data format?
does it offer efficiency benefits?
For pure python projects, I tend to just write python literals to the data file and import it as a module
Am I losing any efficiency doing this?
Wdym json data and python data
json is a serialisation format, whats python data format
json is literally the same as you would write in python, but limited to the following datatypes: list, dict, int, float, str
it has the advantage of easily being writable from python code, which a python file does not have, at least not with this little effort.
you're most likely not loosing efficiency (or actually, a json parser is a lot easier to run than a python parser but both are negligible in most cases)
but you're loosing persistance of changes.
Json parsing is extremely unlikely to crash the compiler
Like if it does, that's almost certainly a bug in python itself
Python parsing with ast has good potential to crash the compiler
well, yes but actually no. you can still wrap a import in a try except block to continue after it fails, which is the same as handling the errors raised by the json parser
what is {!d ast} supposed to be?
Source code: Lib/ast.py
The ast module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each Python release; this module helps to find out programmatically what the current grammar looks like.
An abstract syntax tree can be generated by passing ast.PyCF_ONLY_AST as a flag to the compile() built-in function, or using the parse() helper provided in this module. The result will be a tree of objects whose classes all inherit from ast.AST. An abstract syntax tree can be compiled into a Python code object using the built-in compile() function.
Inline commands 
@idle comet
ofc it was vco's idea
i shoulda known
@soft quiver good idea you got there, inline commands, now i deperately want that
lolll
this will be in every bot i make from now on. just need a decent implementation
its one of those things
once you realise its a possiblity, once the idea even comes up, you cant stop thinking about it
MIT licensed?
@hidden rose I think you're looking for:
typedef struct s_info
{
int *num_array;
int size;
} t_info;
int main(void)
{
t_info *info;
info = malloc(sizeof(t_info));
info->size = 16;
info->num_array = malloc(info->size * sizeof(int));
}
A utf-16 txt file shouldn’t ever have an odd number of bytes, right?
I do believe you are right
Good, thank you
Some ye
ok so
do i push the entire proj with the pyproject.toml to git or just the main proj itself
alright
Yes
discord-modmail/site#1
Pyproject is necesarry
Push your .lock file too
You should also push poetry.lock
Yep
^
aight
Look at the repo linked above to see about it
ok so next thing, is there a pipenv run like feature with poetry
We just set that repo up, so you can see most of the stuff used
Aha I need to make CONTRIBUTING.MD
There's poetry run ____
Mhm
"poetry run something"
I use taskipy as a dev dep so I can define scripts in the pyproject file
Ex poetry run task lint
Runs pre-commit
hmm
Fwiw if you look at the pr linked above
All of that code in the repo at that point was just linting and workflows
Yeah I cant do int size: 16 inside the struct otherwise that would be a bit-field, not an int of value 16. So I would have to declar the size outside like how you did. Thanks!
And the proper way to free would be to first free info->num_array and then info struct:
free(info->num_array);
free(info);
is it expected that a 8 core last gen cpu cannot playback 8k 60fps video from youtube?
No
hmm
interesting
i have other stuff running too tho
And like
It's 60 gbit s of data
each second
@median blade the mans replied
it uses like %975 cpu
that's like 10 threads
fully working on playbacking one youtube video
i think the problem is chrome not doing hardware acceleration
bcos gpu only draws 30W max
nvm it draws up to 70W
but still
it drops like %30 of frames
I found the issue
hardware acceleration off actually turns it on lmao
||JsOn Is A dAtAbAsE||
yes
aight
whats the difference between .rst and .md files
can i just replace the .rst with a .md which was pregenerated by poetry
They use different syntax afaik
If theyre equivalent then yea, idk why people use rst instead of md
it is similar enough that it may just work, but they are slightly different languages
Where does the bot make up the ot names from lol
Mods and admins can add them
What a coincidence.
I am currently thinking about saving my ISO-639-1 JSON as a model in my DB and feel called out
@round moss actually, markdown and reStructuredText are very different, with rst being the more advanced format
https://pandoc.org/try/?text=%23+title
-+list
-+list+element+2
_italics_
[hyperref](https%3A%2F%2Fexample.com)&from=markdown&to=rst&standalone=0
here, have a comparison
that example is almost the same
but yeah, maybe not enough to just use one as the other
its definitely not supposed to be transferrable. be aware, my example here was VERY basic for what rst can do
ok who named this channel it makes me angry
have a more advanced example that i had to link shortenbecause the URL is longer than 2k chars https://u.nu/rsttomd
wait
oof i think i broke the link shortener
because the URL is longer than 2k chars
sorry what
pandoc encodes the entire text in the url
tf
I love the channel name
json is a db wtf
breh
breh
class ItemBase(BaseModel):
title: str
description: Optional[str] = None
calories: int
why does this post request go through
{
"title": "water",
"description": 10,
"calories": 0
}
shouldnt it error because i gave it an int
it seems to have an implicit conversion
whats the point of pydantic if its gonna convert things without me telling it to lmao
theres a strictstr type apparently
travis ci is having an aneurysm with build configs
automate your testing they said
im trying to use the trigger build feature and its running duplicate commands and then failing the build
fun times
It got deleted?
NO
I do not know why they will match the json format to be a database, I think we would optimize the database if we did not unnecessarily transform a python dictionary to a json dictionary
also if I would create my own database I would use a compression algorithm, I imagined your database has many but not so much to match BIG or MEDIUM Data, the encoding is utf-8, your file will have a size of 80mb while with compression we will have 3kb and very fast when reading and writing.
this has the bad databases in pypi
• import json,
• open("database", "r+")
good databases:
• import lz4framed
import ast
• _io
I mean, it is hard to beat sqlite3 when it comes to easy databases
i think sqlite3 has over 100000 lines of code (7mb)
Yeah
But it is still the best option that is a meaningful improvement over json
It's part of the standard library, and even on platforms where you link it dynamically, enough things depend on it that you likely need it anyway
it is good for small projects or that do not require big data
Yup
Or well, tasks that aren't write bound
It is pretty ok for even sizable datasets when reading
I mean to have 6tb of data
I hate the channel name so much
same
but obviously json IS a database, DUH
laundmo, you ok?
i may or may not have assumed that DUH would mark sarcasm clearly enough
nope, obviously UDH
JavaScript Object Notation
what is it?
many other languages support JSON files too
data storage thing, its literally just lists and dicts
ok.. thx!
looks like this for example
{
"x": "y"
}
``` ||||
@ancient summit en taro adude, my dun
!rule 4
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
HA
Ha
would the big O for line 2 and 3 be O(n)?
since it's iterating from i = 0 to i = (2^x)n
i mean if ur just ignoring x then yeah
well n halves each time and x increases by 1 each time
which means it cancels out in the n*2^x cuz (n/2) 2^(x+1) = n/2 * 2 * 2^x
and since ur basically dividing n by 2 each time, u call program4 log(n) times
and u get overall of log(n) * n * 2^x (not sure if u can simplify this further) if u want to account for the effect of both variables.
oh so if you are calling it every divided by 2 it's logn times
Thanks!
Yeah I thought of an eg and I get why I'm wrong thanks
hey
Suggest more topics here!
Set arson
Erm, excuse me? 🤨
In games
Riight... ok.
can you update windows 10 32 bit too 64 bit without deleting any files
aaaaaaaaaaaaaaaaaanswer
please
Be patient bruh
are u mod?
No I'm god
hahahahahaha
who are u
damn
Ik
Fuck
I just did an assignment for half an hour
and guess what
its fucking gone
That blows
F
lol @pastel nest
i have been pingethed
yes
pinged for the hell of it
@idle raptor its like he ignores everything we say lol
exactly
i think he just copied the code from somewhere
.topic
Suggest more topics here!
ipmaosata
Sus
trust me
.topic
cyan.
.topic
Suggest more topics here!
Suggest more topics here!
Suggest more topics here!
Suggest more topics here!
.topic
Suggest more topics here!
lol
@knotty anvil giv all frog emotes
wat 
Yes
pepe*

More
bro how many u need
depends
ok

@tranquil ridge you look familiar 

Hata best
no :/
😔

I need those frogs, I saved all the pepes when global emotes were sacrificed
😔
Ok ill send all
In the dm Or they will mute
what's the fastest way to exit vim ?
isnt :q fast enough for you
that's just for fun
ZZ
map it to some other keybinding
lak's always here lol
I remember lak cheated last time lol
or was it someone else...
I think I did cheat
lol
[adam@DESKTOP-319402F ~]$ echo exit >> .vimrc
[adam@DESKTOP-319402F ~]$ time vim
real 0m0.005s
user 0m0.000s
sys 0m0.005s
```I think I got a worse result than this sol though
did you use this one last time ?
I think I piped :q to vim
oh
is that zsh or bash?
bash
[pouridev@pouridev-pc ~]$ time vim --noplugin --cmd ":q" & killall -9 vim
real 0m0.004s
user 0m0.004s
sys 0m0.000s
here you go
I don't think I can make it faster
alias vim=true
that's beyond cheating
:P
hey @blissful pollen you mentioned that pablo galindo said I should use soft keywords in yeethon, i dont suppose you'd know how I could achieve that? I've looked around and found something called _PyPegen_expect_soft_keyword but it doesn't seem to appear in Python.gram so I'm not quite sure how match and case actually define themselves as soft :D
pegen's c_generator.py generates a *soft_keywords table and match/case are in it. True keywords are single-quoted strings in the grammar, soft keywords are double-quoted strings.
haha no wonder i didnt find that, it's a pretty subtle change, thanks!
@soft quiver not sure why the soft keyword wouldn't work
I haven't tried adding any myself in PEG and my LL1 experience is useless now 😉
yeah, its odd, the keyword should definitely be there, and its listed in keyword.softkwlist, so my best guess is that having ('del' | "yeet") rather than just yeet is somehow messing it up
So some random account DMed me from here.
Report it through @vapid maple
ive asked this before but i still dont get it
i get the intention is to reduce any duplication of values calculated so u create a memory array to store the value then check if the value has been calculated before, if it isnt then calculate the new one
but in line 7 when u set memoryArray[i] = -1 does it replace all the values in the array to -1
so if u r returning memory[n] afterwards, would it return the previous fib value or -1
lol its a dp problem
those are kinda intresting but not always trivial
essentially u set them all to -1 cuz u havent "visited" the numbers yet
hence y in that helper function there is a check if the number is -1
ya but afterwards u return memory[n]
would it return an array of -1
u only return memory[n] if the value isnt -1
which means u return it if u visited it before
and the else happens if u get -1 from memory which it does a computation for it
i dont get why when the value != -1 it means u visited it before
u know how u set them all to -1 in the beginning
isit like u create a memory array with all the values u have, then u set all of them to -1
yeah
-1 means u havent visited it
honestly if i had to implement this i would use a hashmap and do like a get
on an index
yeah so let say u input n as 5
then it would give [0, 1, 1, 2, 3, 5]
right
then what u doing is
creating a memory array of [0, 1, 1, 2, 3, 5]
then afterwards setting them as [-1, -1, -1, -1, -1, -1]
?
oh no u first create an array of 6 elements
they are not initalized which means its a compiler default value
and then u set them all to -1
before u compute any fib number
the -1 is the "initalization" of the array
imo a cleaner way would to be use a dict
u still get constant lookup
and u dont need to initialize -1
I agree webhooks are people too
ok
I suppose I agree too, they have sender IDs. Like a user ID.
You can find the ID on phone or rclick it while network panel open
webhooks are people too hmm imma get some hookas
!class
Classes
Classes are used to create objects that have specific behavior.
Every object in python has a class, including lists, dictionaries and even numbers. Using a class to group code and data like this is the foundation of Object Oriented Programming. Classes allow you to expose a simple, consistent interface while hiding the more complicated details. This simplifies the rest of your program and makes it easier to separately maintain and debug each component.
Here is an example class:
class Foo:
def __init__(self, somedata):
self.my_attrib = somedata
def show(self):
print(self.my_attrib)
To use a class, you need to instantiate it. The following creates a new object named bar, with Foo as its class.
bar = Foo('data')
bar.show()
We can access any of Foo's methods via bar.my_method(), and access any of bars data via bar.my_attribute.
!classes
classmethod
class
!classmethod
Although most methods are tied to an object instance, it can sometimes be useful to create a method that does something with the class itself. To achieve this in Python, you can use the @classmethod decorator. This is often used to provide alternative constructors for a class.
For example, you may be writing a class that takes some magic token (like an API key) as a constructor argument, but you sometimes read this token from a configuration file. You could make use of a @classmethod to create an alternate constructor for when you want to read from the configuration file.
class Bot:
def __init__(self, token: str):
self._token = token
@classmethod
def from_config(cls, config: dict) -> Bot:
token = config['token']
return cls(token)
# now we can create the bot instance like this
alternative_bot = Bot.from_config(default_config)
# but this still works, too
regular_bot = Bot("tokenstring")
This is just one of the many use cases of @classmethod. A more in-depth explanation can be found here.
i dont understand at all
classes or classmethods?
as for classes
classes are a way to make a bunch of objects which have the same properties and behaviours
for example
if Human was a class
jack could be one object of the class, john could be another
lmao
lurc
anyway
they'd have the attributes and methods as defined in the Human class
that kind of makes sense
classmethods aren't directly related to this concept
basically
all functions in a class take in a class object as the first parameter
usually named self
then the function would work with this object
if walk was a function in the Human class, it would look like:
class Human:
def walk(self):
and if you did john.walk(), self would be set to the john object, if you called jack.walk(), self would be set to the jack object
this is the default behaviour, where the first parameter is an object of the class
In a classmethod however, the class itself is the first parameter
oh quic RFC passed
that's dope as heckk
this is fantastic news
oh I see you mentioned it earlier @half timber hah
I wonder if the DNS roots will consider DNS-over-QUIC
they for obvious reason rejected DoH and DoT because of their stateful nature, the roots can't operate like that
but QUIC remains UDP, which is advantageous
I guess the fact facebook were using QUIC heavily encouraged IETF to pass it
iirc it's an RFC requirement that there is existing implementation
holy heck https://engineering.fb.com/2020/10/21/networking-traffic/how-facebook-is-bringing-quic-to-billions/
Today, more than 75 percent of our internet traffic uses QUIC and HTTP/3 (we refer to QUIC and HTTP/3 together as QUIC).
what am i.. oh yeah lol
it's both good and questionable when it's semi abused to deliver ads
Damn
for lines 4 to 10
isit the case where high == low is when the array only has one value?
while high < low, isnt it it could be the list is unsorted?
high==low will always eventually happen as the function recursively calls itself.
high<low, meanwhile, just means that the user passed an incorrect range for some reason, so a null they get (which is a bad idea IMO, one should throw an exception in such a case).
oh right yeah
oh i see
thx
is it in line 10, it's setting int small as 2^31-1?
that's how Integer.MAX_VALUE work?
i dont get whats happening in line 12, for (int j = i; j < newArr.length; j++)
what are they iterating?
yeah
wdym what?
selection sort works by finding the element that should go on each position, basically
it's because at the ith iteration the first i items are already sorted, so the inner loop starts at i
so you find the minimum of the array and place it at first place. Then you find the minimum of all the other elements and place it at the second place, and so on.
i dont get how the first i items are sorted before the j loop, we are jus assigning the int small and smallIndex? i dont see wheres it being sorted
at the first iteration, it starts from the first item
after the j-loop ends, it has found the minimum number in the whole array
it then swaps the first item in the array with the min number
so the first iteration of i fixes the first position
similarly
in the second iteration of i, it finds the smallest number in the array, excluding the first number which is already fixed
oh yeah
so the second iteration of i fixes the first 2 positions
generalizing, after n iterations of i, the first n positions get sorted
right yeah i get it
the reason why they use Integer.MAX_VALUE is cuz they dunno the max value in the array?
yeah, so the small variable gets overwritten at the first opportunity
okay thanks both i gotit!
nice
true
!pypi pyunity
Can I ask for stuff like sorting and searching algorithms I want to be able to code them quickly, I'm still in the midst of learning them. But I feel the transition from understanding how it works to writing the pseudocode/implementing it is hard. Like once we get the general idea, how shd we proceed?
you can ask.
#algos-and-data-structs this a nice place for that too btw.
searching algos are mainly just 2 btw, linear sort (O(n)) easy af, and another sort which is done on sorted list.
O(logn)
||linear search* another search*||
Binary search
clairvoyance
hey we wrote together.
log n is probably about as good as it gets
I mean if you're just checking if something exists its ||almost|| O(1) with a set
jinx
you're weird you're reading the goddamn future
Thats not really a search tho
ackerman function be like
can anyone give examples of objectively oriented languages in which it is impossible to implement some Gang of Four pattern?
welp i think i remember reading that the singleton pattern is rather frowned upon in python
Rust compile times :c
indeed
it's wild
this cli tool does arguably do quite a lot, so it's understandable there are a lot of deps, but sheesh
Yes, my laptop gets fairly hot when compiling bigger programs lol
tbf its only the first time
when all the deps are built the build times are fast af
hmmmm, they haven't been super fast for me even after
well
i mean depends on how fast you consider super fast lol
I'm getting 1 minute build time for https://github.com/cloudflare/wrangler for a one file change
tbf thats extremely fast for a project that size
idk how long a similarly sized cpp or c project would take
ya this is a dev build
am adding a command https://github.com/cloudflare/wrangler/pull/1941
dev build taking a minute? 🤨
can cargo build with multiple threads
yeah
like can u specify or sth
sure ill check in in a day or so 
or does it pick a number for u
oh fuck no nevermind, lol. not waiting for all this lol
building llvm be like
Automatically uses everything available
1 hr build time
single core aint it?
Hello
No
!e print(True * 3 + (True + True) + True * 7)
@upbeat sandal :white_check_mark: Your eval job has completed with return code 0.
12
That was Chili's idea
yes but instead of being a normie and writing True I spammed a bunch of dunders and achieved the same thing
@upbeat sandal :white_check_mark: Your eval job has completed with return code 0.
42
!e print(((21 << True) ^ 384) - 6)
@upbeat sandal :white_check_mark: Your eval job has completed with return code 0.
420
@real forum BLAZE IT
lmao SHEEESH
can someone explain this sorcery to me?
bitshift
you shift all the bits to the left. Why would you want to do this? no clue.
interesting. Haven't touched to bit shifting in a while. So shifting 21 in binary by 1 makes it 42, am I right?
bit shift to the left, yes
yeah, I just played with that in an interpreter and now I got it. Thanks
x << y == x * 2 ** y, x >> y == x // 2 ** y
ok
bye
damn
@idle comet reloading is fucking amazing! Thankyou for doing it!
copied the folder locally and messing around with it
not python, but funny https://www.reddit.com/r/memes/comments/nnkyu1/i_am_on_the_other_street_are_you_on_this_street/
@keen burrow typo! in #pixels-announcements You can now run an HEAD request you probably mean You can now run a HEAD request
aha, thanks
the french got to u
It totally did
lol
oh another grammatical error
rate-limited endpoint to know how what is your current rate-limit state without actually interacting
you probably mean
rate-limited endpoint to know what your current rate-limit state is without actually interacting
@keen burrow ^ (sorry for double ping)
Lol
correctionok*
correcshanok*
yes
ok
what is pixels
Hi daspecito
you're welcome, i really thinks its a great tool, but still needs some work. mainly, file change date checking so it only parses the ast if the file actually changed
So i am doing an internship and unable achieve targets what to do
??
Its been 3 weeks
[::-1] goes in reverse
[2:8:2] for example starts at 2, stop at 8 and steps 2 at a time
!e
print("Hello that one dude"[2:8:2])
what is it used for
@fluid haven :white_check_mark: Your eval job has completed with return code 0.
lot
Making selections from strings
I see
Personally mostly reversing strings
!e py print("This gonna be reversed"[::-1])
@rustic lagoon :white_check_mark: Your eval job has completed with return code 0.
desrever eb annog sihT
keyboard warrior it seems
@wooden panther just one book, its on the web nothing to purchase. scroll down a bit. some of it is super simple but given your q about return in a for loop id recommend reading through it all quickly
sry was away didnt answer when u asked
this image has more layers than a coconut
I believe Shrek liked coconuts.
@sterile pelican
If I host a microservice using a GPL library, do I have to make all code that sends requests to that microservice GPL-licensed?
well isn't that not including a copy of the code?
yes, unless that library is LGPLed
then that's the most ridiculous license ever
how come?
well, that's kind of the whole point of GPL, to prevent close-sourcing any projects, if you only want to prevent close-sourcing of a work based on your library, i.e. a derivative, you can license under LGPL so that people who just use your lib are fine and can use some other license
gpl was designed to be ridiculous, yeah
basically it tries to turn copyright on its head forcefully, using its own laws against itself
true, but for a good reason, it does the job it is supposed to be doing very well
i'm not saying it's bad
that's probably why the call licenses that do this copyleft
Okay, let's take this scenario:
- Someone writes a microservice "A" without using any GPL code, so e.g. the microservice code is MIT-licensed.
- I write a piece of code "B" that talks to that microservice. I license it under the MIT license.
- The author of microservice "A" rewrites it from scratch using a GPL library, but preserves the same interface.
Does the piece of code "B" now have to be licensed under GPL?
no as long as you use the non-updated version
Or:
- A person writes two implementations of a library (with the same interface), one implementation is licensed under MIT, another one is licensed under GPL.
- I write a piece of code that imports that library.
Do I have to license my code under GPL?
I'm just talking to the API, I don't control what implementation is hosted there. I can't even know which version is hosted there.
for this case no, even if your application is "compatible" with the GPL library, you made it to use the MIT library
oh, I missunderstood then, well this is the part of GPL that's uncelar, but most people wouldn't consider just talking to the API as something you'd have to inherit the license from, but this excatly is a dispute that's not very clear by the GPL license text
for this, i'm honestly not sure. GPL makes it clear that static or dynamic linking against it does require your code to be GPL, but I don't know if API calls would fall under that
So what's the difference between:
import library_licensed_under_gpl
print( library_licensed_under_gpl.some_function(42) )
``` and ```py
def some_function(n: int):
r = requests.post(f"https://api.that-uses-a-library-licensed-under.gpl/{n}")
return r.json()["result"]
print( some_function(42) )
```?
the API author could probably try and make a case against you, but I very much doubt he'd succeed with something like that, though it's possible, since GPL simply isn't clear on this
I would say yes, but again, GPL simply isn't clear enough on it
I think part of the problem is that there also isn't much legal precedent on these matters
it seems that GPL brings up lots of paradoxes that weren't considered when it was created
yeah, that it certainly does
the GPL library copyright holder might take you to court on these and who knows what the outcome will be
but I doubt any api author would realistically try to enforce usage of GPL to clients since his API is GPLed
but yes, if the author would decide to take it to the court, the outcome is unclear
well
the good news is that if you decide to use GPL
you don't really have to enforce it
if you're the copyright holder that is
I do like using GPL for some of my things, but I'd never enforce those minor things on anybody
and I doubt I'd have any success even if i tried doing so, though again, it's technically possible
I think the idea that importing a library is making a derivative work of it doesn't really make sense.
why in sorting, we can't directly exchange two values, but we have to create a temp to swap them?
you can swap directly in python with something like a, b = b, a
and you can swap two numbers in any lang without a temp variable with a trick
but in general its not possible to swap two vars without a third
something like
a = b
b = a
won't swap a and b
both a and b will end up with the value of b
because when it gets to the second line, the value of a has changed to that of b, and the original a has been lost already
oh
what trick isit
a = a + b
b = a - b
a = a - b
its a bit hard to explain in words, just work it out for two numbers and you'll see
oh wow yeah
show 👀
xor is the poggest one
ye it works
e🅱️ic
i read an article on xor tricks on reddit some time back
finding duplicates in lists and stuff
xor only really works when ur thing fits in one register
hmm
oh ok, i think i asked this before but i still dont get it
lets say the array is [5,2,4,3],
array clone = [5,2,4,3]
for the first iteration, i = 0, j= 0
since 5 < 2147483647,
small = 5, smallIndex = 0
for the next iteration, i = 1, j=1,
(a side qn, does small reupdate to 2147483647 or it remains as 5 when the i loops again)
since 2 < 5,
small = 2, smallIndex = 1,
then swap(newArr, 1, 1)?
wouldnt that be swapping nth
the j loop is nested inside the i loop
you're not considering the (i=0, j=1), (i=0, j=2)... etc iterations
when the inner j loop ends, smallindex will be 1 (the index of 2, the smallest no. in the arr)
oh yea i was unsure abt this, so we have to loop within the j first
lemme try again
okay im clear abt it alr thanks! 👍
Ig monkey patching it would be
Like,
As the only feature of your library, and then shipping that
public class sort {
static void swap(int[] arr, int i1, int i2) {
int temp = arr[i1];
arr[i1] = arr[i2];
arr[i2] = temp;
}
static int[] bubbleSort(int[] arr) {
for (int i = 0; i < arr.length - 1; i++) {
for (int j = i; j< arr.length-1; j++) {
if (arr[j+1] < arr[j]) {
swap(arr, j, j+1);
}
}
}
return arr;
}
public static void main(String[]args) {
int[] x = new int[]{10, 40, 30, 20};
System.out.println(bubbleSort(x));
}
why is the output so weird?
I tried to create a function which bubble sorts
But the output is some string of characters
can u print out arrays in java?
not directly no
System.out.println(Arrays.toString(arr))
and you'd need to have java.util.Arrays imported
or java.util.*
@woven hornet
thats probably the issue
ye
i think may be swap is sus.
oh wait no we can't print array like that, it may be printing its address
yeah that was the issue
public class sort {
static void swap(int[] arr, int i1, int i2) {
int temp = arr[i1];
arr[i1] = arr[i2];
arr[i2] = temp;
}
static int[] bubbleSort(int[] arr) {
for (int i = 0; i < arr.length - 1; i++) {
for (int j = i; j< arr.length-1; j++) {
if (arr[j+1] < arr[j]) {
swap(arr, j, j+1);
}
}
}
return arr;
}
public static void main(String[]args) {
int[] x = bubbleSort(new int[]{10, 40, 30, 20});
for(int i=0; i<x.length;i++){
System.out.println(x[i]);
}
}
}
This works fine
oh i see i tried this but it still doesnt work
public class sort {
static void swap(int[] arr, int i1, int i2) {
int temp = arr[i1];
arr[i1] = arr[i2];
arr[i2] = temp;
}
static int[] bubbleSort(int[] arr) {
for (int i = 0; i < arr.length - 1; i++) {
for (int j = i; j< arr.length-1; j++) {
if (arr[j+1] < arr[j]) {
swap(arr, j, j+1);
}
}
}
return arr;
}
public static void main(String[]args) {
int[] x = new int[]{10, 40, 30, 20};
int[] y = bubbleSort(x);
String y = Arrays.toString(y);
System.out.println(y);
}
}
oh so ur method is like printing a value in the array by using a loop? and that's acceptable
is there any way to return an array back though? or its not possible in java?
return array from a function? you did that.
yeah i meant print*
yeah you can do it as hahastinkypoop has mentioned(sorry for the ping)
@jovial island oh do u mind seeing whats wrong with this
i tried using his Arrays.toString
alright? so any error came?
javac /tmp/Q9i8rsATpT/sort.java
/tmp/Q9i8rsATpT/sort.java:22: error: variable y is already defined in method main(String[])
String y = Arrays.toString(y);
^
/tmp/Q9i8rsATpT/sort.java:22: error: cannot find symbol
String y = Arrays.toString(y);
^
symbol: variable Arrays
location: class sort
2 errors
you can't have variables of same name.
also you need to import the class
as above mentioned.
oh right that makes sense
wait what does that mean
Arrays is a class which in order to use we need to import just like we import scanner class.
this(again sorry for ping)
ping
pong
ohh
that's what he means
i see
okay thanks
Nice timing @rigid echo

Discord barrier skip 101
lol
hi


