« first day (4323 days earlier)      last day (608 days later) » 

2:03 AM
stackoverflow.com/questions/71246741 not a duplicate, but unsalvageably bad general "debug my code pls" question.
 
2:19 AM
@GitauHarrison Personally, I would make a clear separation between the user and their roles. As in, a class for the user and a separate class for his roles, then you have the comfort of choosing if, a user can have many roles, or just one role. See if a user with a specific role id returns none
 
2:50 AM
My last sentence isn't a suggestion for your code, I meant: Then, I just check if a user + role returns None. Sorry for the confusion it may have caused.
 
3:21 AM
It appears that openbookproject dot net (where "how to think like a computer scientist in python" has historically been hosted) got defaced with porn spam.
fortunately, there are other hosts, e.g. open.umn.edu/opentextbooks/textbooks/80
Okay, this is puzzling. There seem to be varying accounts of author credit for the book.
 
3:38 AM
all of this in re stackoverflow.com/questions/48653291/… . I edited as best I could, and summarized in the comments. This was interesting for me because I remembered the book as being relatively good
 
 
1 hour later…
4:41 AM
stackoverflow.com/questions/22633530 This mess has over 100k views. I don't know what to do with it precisely.
 
5:08 AM
Is it still allowed to ask a conceptual question on SO, like the one I usually encounter from back in the day ? Or does it always have to be about snippets of code ?
I really am not interested to ask Reddit or Quora and scroll through patckworked answers from Google results.
Nvm, I just remembered Software Engineering and it's already been answered many times. Sorry.
 
6:03 AM
I have "today"'s date in a datetime.date object and I want ["2022", "08", "01"] assuming the date was August 1, is there a better way than str(today).split("-")?
today.month seems to remove the 0 in 08 so this is the only way I can think of
the str way does not seem bad, but I am not sure if it will always stringify it as yyyy-mm-dd, could it be changed in a future version?
 
@Jake it might be locale-dependent. It's safer to use strftime.
 
alright, will do that
 
6:55 AM
@KarlKnechtel I CV'd as "needs details/clarity". As Martijn points out in the comments, the traceback doesn't even match the code.
 
@Jake might be safer/more readable to just do [today.year, today.month, today.day] imo.
 
Turns out you can still learn some stuff from main. Not exactly sure why I find this surprising but I do
>>> id
<built-in function id>
>>> hash(id)
5764607523036258949
I don't think it's ever occurred to me that functions, let alone builtins, could be dictionary keys. I have no idea why this would be useful, but apparently it's a thing one could do
I wonder if monkey-patching or partial can break that
 
7:20 AM
Cbg, I'm back from holidays. Hope you are all doing great :)
 
@IvoMerchiers this removes the 0 in 08 I need that zero
 
My boss says he needs a new (powerful) PC for... something something data analysis? We'll have a database with around 300k entries (in a single table). I don't know what kind of queries/grouping/analysis he's planning to do with those though. I'm pretty skeptical that this'll require a particularly beefy PC. What kind of specs would you guys recommend?
 
aha, nevermind my suggestion then
 
@Aran-Fey ask for a budget and just buy the most expensive one you can find ;)
 
300K rows is nothing so I don't think it matters too much. Still, you might find an i7 with 32GB of RAM on Amazon. Depends whether he will complain about price
Oh, and make sure it lights up blue. That's critical
5
 
7:34 AM
He's given me a website with PCs to choose from, and so far they've all been gaming PCs. So yeah, there will be plenty of lights
We're gonna pay good money for a useless graphics card, aren't we
 
I assume if anything matters, it's RAM and an SSD
 
Was gonna suggest something along the lines of 'just run it on one of these cloud/data warehouse options', but yeah, just giving him a decent pc might be the desired option here
 
Depends on whether he's gonna explore CUDA; that graphics card might come in handy
 
yeah, RAM can become important quickly, especially if you have multiple copies of the same table in memory
 
16GB should be enough though, right?
 
7:37 AM
16GB will cover 300K rows no problem. I personally would try for 32 for future-proofing a bit but it depends on the price difference
 
@Aran-Fey Unless he'll be browsing too :P
 
Maybe I should go for a super overpowered one just to make him realize how crappy all our PCs are. Lots of them have 4GB RAM and old slow HDDs
Combined with all the junk people have accumulated on their user accounts, logging in (i.e. downloading all the data from the domain server) regularly takes 4-5 minutes or more
 
oof, that one onboard gpu could pay for quite a few ssds
 
@Aran-Fey are you a manager? No? Then you'll be fine :P
 
8:00 AM
Uh oh, it looks like I might have broken my power cable :'( Not entirely unexpected with the way I treat it, but not great
 
I've always had a dell laptop and one of their Achilles' heels is chargers giving up before the rest of the machine gives up. I've had cables pull apart and chargers retire with a loud BANG...
 
Oh, this is far less dramatic. I've just noticed that the cable needs a bit of jiggling before things start charging. Chargers going with a BANG sounds very much the opposite of good
 
Yep - I've fixed up a few ad-hoc charger cables before now..
 
 
1 hour later…
9:12 AM
@roganjosh semantically, it makes sense that they should be hashable: if you create two functions, good luck making them equal to each other. so even though they have mutable attributes, there isn't a risk of creating a collision by mutating them
 
In a world of infinite possibilities, I'm pretty sure one could cause a hash collision. In which case, I don't know how that would be resolved when functions could be mutated at run time?
I guess it would go off __repr__ but I haven't troubled myself to look at how functions hash themselves; it was a passing curiosity
 
It should fall back to comparing them by identity.
 
@MisterMiyagi and then equality, right?
richcomparebool or whatever
same hash? -> if yes, same object? -> if no, equal object?
>>> class Weird:
...     def __hash__(self):
...         print("I'm being hashed!")
...         return 42
...     def __eq__(self, other):
...         print("I'm being equalled!")
...         return True
... Weird() in {Weird()}
I'm being hashed!
I'm being hashed!
I'm being equalled!
True
 
9:28 AM
Conceptually it makes sense to me with classes because you can control the dunders. I think I didn't really appreciate that "functions are first-class citizens" translated to them getting __hash__ by default
 
object has hash by default so...
you only lose the default hash if you define __eq__
 
Yeah, it's just a mental linkage fail
Kinda like when I used to walk half way around Nottingham and never realised there was a 100m path that linked two places together :P In my mental map, they were miles apart
 
@AndrasDeak--СлаваУкраїні My hunch is that for functions, equality is the same as identity.
 
that just means that the equality test is futile :P
 
Futile is such a harsh word...
 
9:32 AM
>>> import copy
... def foo(): pass
... foo == copy.deepcopy(foo)
True
 
>>> foo is copy.deepcopy(foo)
True
 
well that's a pretty crappy copy if you ask me
 
Practically beats purity to a pulp!
 
How does this make any sense? If I add a mutable default, it still returns the original function (at least it's consistent).
When is this preferred behaviour?
 
9:49 AM
Everytime you want to copy something that contains a function somewhere deep down?
I'd imagine there'd be some pretty nasty edge cases if it would clone the function for good.
Such as, now you have two things with an FQAN pointing to __main__.foo.
 
@MisterMiyagi hmmm
I'm not happy about it but I'll allow it :P
So if a method has a mutable default, deepcopies of instances will also share the mutable arg? I guess I can test that.
gnarly
but I guess that goes for every instance anyway
 
I think it makes sense that the mutable default argument gets carried over, but the identity check doesn't to me
 
@roganjosh :D
 
10:09 AM
I wish the Pycharm merge conflict window would exist for all kinds of decisions(politics, proposals, science etc.). Like a very clear way to tell who says what and what will be the result in what section and you can merge some things from left some from right. Not just polemics and big bills with yes and no questions. I think politics in the future will be revolutionary
 
10:45 AM
This seems to be something for people in here: zenorogue.blogspot.com/2012/03/…
 
 
2 hours later…
12:18 PM
The rubber duck solved my problem. Thanks, rubber duck. The answer was 'GREEK SMALL LETTER OMEGA'.
 
@Jake I think you could do something like that [f"{x:02}" for x in date(2022, 8, 1).timetuple()[:3]] to avoid depending on str() behavior.
 
12:43 PM
This code works, but I wonder if I could make it faster. Is it possible to define f without using loops/recursion/etc?
def f(b: int, n: int) -> int:
    assert b >= 1
    assert n >= 0
    x = 0
    t = 0
    while t < n:
        t += b**x
        x += 1
    return x

for i in range(42):
    print(i, f(3, i))
t is always equal to sum(b**i for i in range(x)). Maybe I can do something with en.wikipedia.org/wiki/Geometric_series#Closed-form_formula.
 
I doubt you can find anything significantly faster; the number of iterations is tiny
 
@Kevin you can definitely solve that for t_max
 
f is approximately O(log_b(n)) already, but I desire ludicrous speed
 
(b^(tmax+1) - 1)/(b - 1) < n
b^(tmax+1) < n*(b - 1) + 1
tmax < ln(n*(b - 1) +1) / ln b - 1
 
Hmm! I was just thinking of using logs. I like it.
 
12:58 PM
So you need x = ceil(that). Or floor that minus 1...
 
Ok :-)
 
Plus potential off-by-wrong errors. Make sure this doesn't drive your Kevinuclear generator without thorough testing.
 
I think I can sanity-check the results before I put them into my calamity device
 
import math
def math_equiv(b: int, n: int) ->int:
    return math.ceil(math.log(-n*(1-b)+1,b))
all(f(3, i) == math_equiv(3, i) for i in range(42))
 
That should be numba compilable too?
Well, I'm less sure about all()
 
1:04 PM
That's just the check to see that the result is the same
 
Sure, I just don't think my numba comment applies in that case
 
Isn't it fascinating that we have AIs doing the craziest stuff like text to image generation and what not, but I have to manually switch like 5 machines from bitbucket to gitlab? I wish there were an easy solution to do that
Ofc I could write a script, but writing the script takes way more time than doing it
I wish there were AIs for the top right quadrant: xkcd.com/1205 But I guess that would approach something close to general AI
 
@IvoMerchiers the edge cases are when the argument is an integer, in other words when n*(b-1) + 1 is a power of b.
 
1:48 PM
I am awash in a sea of off-by-one errors
 
2:00 PM
@KarlKnechtel The accepted answer to that question leads to the for statements part of the tutorial, where it says:
> The for statement in Python differs a bit from what you may be used to in C or Pascal. Rather than always iterating over an arithmetic progression of numbers (like in Pascal), or giving the user the ability to define both the iteration step and halting condition (as C), Python’s for statement iterates over the items of any sequence (a list or a string), in the order that they appear in the sequence. (emphasis mine)
I thought for iterated over any iterable, not just any sequence?
 
The tutorial isn't exactly thorough on technicalities.
 
The tutorial is less truthy than the docs, which is less truthy than the source code, which is less truthy than the electrons in your hardware.
 
No, but it's still a mis-statement.
 
"sequence" is frequently used to as a generic or mathematical term (as in "sequence of numbers", for example) but "(such as a list or a string)" might be an easy fix there.
 
Tragically, electrons aren't even all that truthy, what with quantum and all.
 
2:05 PM
Maybe it should say "(a list or string, for example)"
 
I approve
 
make it so
 
Divert power from the thrusters
 
I do have my contributor documentation all approved and stuff.
 
@MattDMo well it's true, just incomplete
 
2:12 PM
2-word PR, here we come!
 
Well dang. I think I hammered out my off-by-one errors, including one in my original definition of f. But the fast log-based approach is now failing in a manner that suggests floating point precision problems. dpaste.org/CuTNn
 
Use the 2-arg form of log as Ivo did
ln a / ln b = log_b a
int(z) is still risky though with floats
5 + 1e-16 works, 5 - 1e-16 doesn't
 
Let's see... Same result.
Maybe I have an off-by-X error, where 0 < X < 1
Hope it's not off-by-epsilon, I'll never find that little guy
 
Need some advice from you web devs. We were just contacted by a lawyer demanding 190€ in damages because our website uses google fonts, which leads to visitors' IP addresses being sent to google. So apparently it's illegal for european websites to load any resources from non-EU servers? Is this real? That sounds ridiculous
Or rather, load anything from a server that belongs to a non-EU company
 
2:24 PM
I haven't thoroughly proven that fast_f would be correct if I was working with infinite-precision reals rather than floats. I just shuffled expressions around until it passed all test cases from n=0 to n=100
 
So it's possible that floats are not the culprit, and my bad algebra just happened to be correct by random chance, 120 times in a row.
 
@Aran-Fey the bottom line is to ask your legal department :P
 
Oh, it's my dad's website. No legal department here
 
sounds fairly scammy to my layman's ear
But so does a lot of copyright
 
2:29 PM
did you added term and condition of using your website, if yes then mentioned it there ?
@AndrasDeak--СлаваУкраїні not copyright , but privacy related, it's EU GDPR law thing i guess
 
> A District Court in Munich, Germany, recently heard a legal complaint in which the plaintiff argued that a website that had linked across to Google Fonts, instead of downloading and hosting a copy of the free font on its own site, had violated their privacy.

The court agreed, demanded that the website operator start hosting fonts locally, and awarded the complainant damages of €100 (about $110).
@sahasrara62 my point was that just because something sounds scammy to me it doesn't imply that it's not actual law
 
I wonder if you can sue him for 191€ for exposing your mail server's IP address to his mail server
 
@sahasrara62 We do, but I don't think it covers this particular thing
 
@Aran-Fey then consult a lawyer first i guess, and use google font locally
 
@Aran-Fey There are some blogs from law firms (here's a German one) that TLDR to a) yes you are not allowed to do that and should self-host the fonts ASAP and b) unless a court actually ordered you to pay damages the other party has no claim to make. So the claim is most likely scammy but it's a good idea to get rid of the problem.
 
2:39 PM
So I checked the network monitor and couldn't find any google urls being loaded. The HTML does contain these:
<link rel='dns-prefetch' href='//fonts.googleapis.com' />
<link href='https://fonts.gstatic.com' crossorigin rel='preconnect' />
No idea what either one of those does, so I guess I've got research to do
 
it just tell your html to use font from this url, all you need to do is change the link to your static font folder
 
It sounds like he doesn't tell his HTML to use any fonts at all, at the moment.
 
Google has a guide on serving the fonts locally.
 
Terrible analogy: suppose Aran-Fey's neighbor is suing him because diesel fumes coming from Aran-Fey's property are giving the neighbor health problems. Aran-Fey had no idea this was happening. Upon closer inspection, he finds evidence that campers are occasionally putting up tents in his backyard and using a diesel-powered generator to power their speakers/lights/phone charger/etc.
If you give Aran-Fey the advice "make sure your generators are powered by something other than diesel", this is unhelpful, because Aran-Fey has never owned a diesel generator, and there are currently no diesel generators on his property.
The advice "put up a fence to keep uninvited guests out; turn away any invited guest that has a diesel generator in their luggage" may be more constructive
 
2:54 PM
Never mind, it does load a font from google if I reload the page with Ctrl+F5. But the relevant HTML code is 1) somewhere completely different than the screenshot the lawyer included and 2) from a wordpress theme
 
@Kevin @Kevin but still he is somewhere responsible for his neighbour bad health and he need to pay the compensation
 
@sahasrara62 Citation needed
 
3:24 PM
@MisterMiyagi Didn't get around to checking this out earlier, that's worth gold, thanks!
 
3:40 PM
def possibly_fast_f(n):
    g = lambda z: ((b**z + 1)/(b-1))-1
    left = 0
    right = 1
    while g(right) <= n:
        right *= 2
    while left < right-1:
        mid = (left + right)//2
        if g(mid) > n:
            right = mid
        else:
            left = mid
    return left
Slower than fast_f in all(?) cases, but I believe it's faster than f for large n.
And unlike fast_f, it passes my test cases for n up to 1000. Speed is nice but correctness is king
 
3:55 PM
if the original was log then this is probably log log
 
I'm suspicious of the g definition there, because I'd expect it to always return an int, as long as b and z are ints. But when b = 4, it returns a fraction with denominator 3. The test cases still pass up to 1000, but I'm uneasy...
Bad algebra continues to stalk me
 
definine it as a proper function
@Kevin need -1 in the numerator
Might want to bump up that test upper limit :P
 
4:13 PM
Yep, you're right.
This implies ((b^z)-1) % (b-1) is always zero... I think that makes sense, although a formal proof eludes me
For example, when b = 4, take the powers of four, [1, 4, 16, 64, 256, ...], subtract one, [0, 3, 15, 63, 255, ...], and divide by 3, [0, 1, 5, 21, 85, ...]. Whole numbers, huzzah
If you can prove that (x*y)%z == ((x%z)*(y%z))%z, I think that's sufficient to prove ((b^z)-1) % (b-1) = 0
b % (b-1) = 1; (b^2)%(b-1) = ((b%(b-1)) * (b%(b-1)))%(b-1) = (1*1)%(b-1) = 1; do some inductive stuff here and you're done
 
@Kevin it's a well-known* thing. (b^z - 1) = (b - 1) (b^(z - 1) + b^(z-2) - b^(z-3) + ... +- 1) or something
Polynomial division basically
 
If nobody knows about it, but it has a wikipedia article, that counts as well-known to me
 
4:29 PM
Also shown: I messed up the signs
 
That's ok, I didn't read them :-)
 
Teamwork makes the dream work
 
"(b^z - 1) = (b - 1) times foo plus bar minus baz... I think I remember that bit from school. Approved"
With this knowledge, I may be able to take a second crack at fast_f, and get it working for smallish values of N. Let's say, below 1e100.
 
@AndrasDeak--СлаваУкраїні exactly because of the geometric series, dummy
 
divmod is a handy way of describing the precise results of a division operation, even if the division returns a non-integer. I wonder if you could do something similar for finding Nth roots...
 
4:45 PM
yeah, and for primes and 1 it gives you 1^N*num
And for most other numbers :P
But if your number has some prime factor to the power of N: jackpot
 
if a + b*c = d, then divmod(d, b) = (c, a)
if a + b^c = d, then rootmod(d,b) = (c, a)
Something like that
 
If there's a constant-time solution, I could use it to implement fast_f without touching any floats
... I think
 
Take the logarithm with b...
 
Yeah. And if logarithm occasionally gives an off-by-one error, you can test for that in O(1) time, and search the, say, four closest integers in O(4) time to get the real answer
 
5:03 PM
What the... Who decided that log(1,1) is undefined
I demand to speak to math's manager
 
Now we finally know the male form of Karen... it's Kevin
 
I'm told that "Kevin" actually was a front-runner for the counterpart to Karen, during the peak of the Karen trend. I wasn't aware at the time.
 
I believe the most commonly used one is "Ken"... if we disregard "male Karen"
 
5:24 PM
>>> math.log(4**27, 4)
27.0
>>> math.log(4**28, 4)
28.0
>>> math.log(4**29, 4)
29.000000000000004
Uh oh, fam
truncating to int pushes out the limit a bit
>>> int(math.log(4**1477, 4))
1477
>>> int(math.log(4**1478, 4))
1478
>>> int(math.log(4**1479, 4))
1478
 
5:52 PM
count = 0

while count < 100000:
    count = count + 1

print(count)
i was wondering if compilers of the coming years will programmed to detect the redundancy and
execute it one go as against looping 100,000 times. --in bigger codes and lengthier loops
I wanted to know if this is simply illogical,
or there already some method in some even other programming languages.
to do this "intelligible" (or dumb) move.
 
compilers of the past decades can optimise that.
 
I wouldn't be surprised if compilers can already do that with optimisations turned on but it's not relevant to python
 
is there a right nomenclature for what i've tried to describe here
 
Constant folding and partial evaluation would be some names for the general techniques.
 
@MisterMiyagi wow thanks
 
5:58 PM
There's an article on loop optimisation of LLVM here
 
does it not affect the linearity plot of execution time
and thus making it improportional and harder to predict.
 
It would make it O(1) so your plot would be a flat line against loop counts - there is no loop any more
 
It's still O(1) even with the loop though
 
How can an incrementing loop be O(1) and not O(N)?
That's demonstrably not true?
 
6:13 PM
Because the number of iterations doesn't depend on N. The 100000 iterations are hard-coded, so the loop always takes the same (constant) amount of time
 
python3 -m timeit "for x in range(10): pass"
1000000 loops, best of 5: 219 nsec per loop
python3 -m timeit "for x in range(1000000): pass"
20 loops, best of 5: 18.1 msec per loop
@Aran-Fey is this a case of semantics that I'm falling foul of, then? I don't think it's useful to discuss complexity in this way but is that the baseline?
I won't argue that a single loop's execution time increases with increasing N but the time taken for the loop to complete does increase. If I want the time complexity of the loop, do I not look at N?
 
Expanding upon "not relevant to python"... In the general case, you can't guarantee that x + 1 + 1 is the same as x + 2, because x might have custom __add__ logic. During the compilation stage where Python optimizes these kinds of things, it doesn't have much information about the type of non-literal objects. So it can't make guesses about what any dunder-powered operation actually does
class A:
    def __init__(self, value=0):
        self.value = value
    def __add__(self, other):
        return A(self.value + 6 + other)
    def __lt__(self, other):
        return self.value < other
    def __repr__(self):
        return repr(self.value)

count = A()
while count < 100:
    count = count + 1
print(count) #105
 
So, time complexity is a measure of how execution time scales with an input, usually called N. If the program doesn't take any input, its time complexity is always O(1).
 
If you're thinking, "well, Python should simply deduce the type of each object before optimizing", that would require solving the Halting Problem
 
There's no meaningful distinction here. 10000 could just as easily be derived from some input but for demonstrative purposes it's hard-coded. It seems nonsensical to me to say "oh but if that came from a user input, it's now O(N) for the same calculation, otherwise it's O(1)"
I do get the distinction, but do people really communicate on that level?
 
6:21 PM
I can see where you're coming from, but since we're talking about optimizing the loop away, it does very much matter whether the number of iterations is hard-coded or not
The time complexity of the program doesn't improve if the compiler optimizes the loop away
@roganjosh In my experience almost nobody bothers to define their N, and sometimes that leads to problems
 
Switching to the other topic... I think of any "O(whatever)" expression as being shorthand for "O(whatever), with respect to {variable}". So it's valid to say that [x+y for x in range(N) for y in range(P)] is O(N), and it's also valid to say it's O(P).
 
There are countless benchmarks on SO where people fail to account for elided loops in their compilation and then get surprised with their benchmarks. Under strict definition you might say a loop is O(1) but I don't believe that's how people actually communicate
 
If the algorithm has more variables than are in your "with respect to..." clause, then it's assumed those variables are being held constant. So [x+y for x in range(N) for y in range(P)] is O(N) with respect to N, and [x+y for x in range(N) for y in range(10)] is also O(N) with respect to N.
 
The more formalities of Big-O I learn, the less I like it
 
"Holding P constant" here being slightly different than "hardcoding P", because the program is still allowed to accept P as input. The human pressing the keys just has to promise to put the same value in for P every time.
"O(1)" is tricky because the "with respect to..." is implied, but you don't have enough information to determine what it's in respect to. If the algorithm has only one variable, it's easy. If there's multiple variables, it's ambiguous.
 
6:30 PM
@roganjosh You may be right, but IMO people usually don't communicate these things clearly. I've seen plenty of questions like "Is [1 for _ in x for _ in y] O(N) or O(N^2)?" where the only correct answer is "I don't know, tell me what your N means"
 
[N + x for y in range(P)] is "O(P) with respect to P", and "O(1) with respect to N", but describing it as simply "O(1)" is asking the reader to make too many deductive leaps
I suspect people are less rigorous about Big-O with multiple variables, because it's not taught as often as the basics are. I'm pretty sure we never touched it in college.
 
[1 for _ in x for _ in y] can be O(x) or O(y) or O(x*y) or O(1) until you choose a (or more) variable(s) to analyze
So yeah, what Kevin's been saying
 
Oops, when I wrote [N + x for y in range(P)], I meant [N + x for x in range(P)]. I guess the overall point is the same.
 
I get the point and I won't argue on it directly, but don't you think that basically undermines the whole thing if basically nobody knows what the yam you're trying to convey?
 
Dear all, I am looking into updating a plot with plt.imshow for tkinter. I got it almost to work, but the colorbar has overlapping text in the animation. On stackoverflow I can only find examples with matplotlib animation. For example: https://stackoverflow.com/questions/39472017/how-to-animate-the-colorbar-in-matplotlib
Is this really the only way, please?
I should be more precise, could I also do it without matplotlibs animation, please? And what does cause the overlapping text?
 
6:36 PM
Is there a more sensible basis to explain why something is terribly wrong, for example? I swapped a list for a set in one of our scripts that brought the run time of the whole thing down by nearly 90%. Is it abuse of Big-O to try explain that a lookup went from O(N) to O(1) under these strict definitions when I'm not taking time to lay down all the foundations of what I'm talking about?
 
That's not abuse of Big-O. That's just taking a gamble on whether people will understand how you're using Big-O
 
I think there's an element of implication and custom there... When talking about sets and other such collection types, it's usually understood that the "N" refers to the number of objects in the collection.
 
@Aran-Fey so what would be the common parlance for this, to you?
This is news to me that people might be taking mental leaps to understand what I'm talking about (at least in this aspect)
 
On a few occasions I've had a function that takes a list of strings, and I needed to describe its performance in terms of the list's length and the average length of a string
Perhaps a crummy implementation of str.join would be O(N*S) with N being the size of the list, and S being the average string length
 
@roganjosh I think that's perfectly fine, in the context of lists vs sets it's usually perfectly clear what you mean by N (i.e. the size of the container)
I should just let Kevin do the talking for me at this point
I feel like a very delayed echo
 
6:43 PM
But I can't tell if I'm veering into lunacy unless I have a pace runner
 
:P In any case, this is somewhat enlightening
I get all the formal distinctions, I just think it makes things really hard to try actually convey anything between people in general discussion
 
People are taking little mental hops to understand what you mean when you say "x in my_list is O(N)", but I think it's OK to ask your audience to do a bit of hopping.
 
@roganjosh That's fair, but I do think it depends on the context. There are situations where it's clear (for example when talking about containers) and situations where it isn't
 
I was just about to say that :-)
 
Aran's echo caught up. It travels in O(N) time
 
6:49 PM
Well now I feel like Lucky Luke, the guy who's faster than his own echo
 
not the first time in this room, that i feel like that little child from the pixar short "one man band", except my currency is my query.
 
Tell us your query
 
@PythonSmurf I won't be able to help since I don't know matplotlib, but you'll likely need to provide an Minimal, Reproducible Example
 
@Kevin dont think i have one, i am all good for now.
 
Very well
I will non-answer the non-query.
[very loud silence ensues for exactly 1 second]
 
6:53 PM
Everyone knows you need to go for 4 minutes 33 seconds for proper, loud silence
 
That's only for my platinum-tier patrons
 
"It was composed in 1952, for any instrument or combination of instruments, and the score instructs performers not to play their instruments during the entire duration of the piece throughout the three movements." The phrasing is quite fun; now to look up the invisible sculptures to see if their wiki is equally as rigorous
 
Unironically art
 
7:23 PM
hey guys, are there any clean ways to define a closed loop/path and then define distance away from its boundary
 
I was trying to figure out how to make SVG do that, the other day. Never solved it.
 
if you got the path part parameterized well I might be able to work from there
there's also the question of how to define distance from "object"
but basically if I have the boundary/path I could define it as the shortest distance from a perpendicular wall. Just want to find a way to do this fast iteratively
 
<path> is a native element of SVG, so it does some of the hard parts. Are you familiar with Bezier curves? they're a pretty simple way of making a parametric function for a curve
 
I'm familiar, though I don't say, know how to define the path of a circle as a bezzier curve (or if that would take 4 curves) or how they come together to describe a single "closed" shape
 
If you have MS Paint, the Curve tool uses bezier curves. You can make a half-circle with one curve. I'm pretty sure you need two for a complete circle.
 
7:39 PM
@Aran-Fey: Yes, you are right, I am working on it to show it. Thank you!
 
@roganjosh The end goal of my problem is simply to retrieve the data in the database. Every other functionality such as loading all users, without the use of roles, is achieved.
 
What is the point of roles in that case?
 
@roganjosh With roles, everyone is a User, hence only one table called User is needed. The only addition here is to add what role each user will have, for example, admin role aka super user et cetera et cetera. I have seen this implementation before though I have never used it. I intend to give it a shot now that this 'problem' has come about. Though I am particularly interested in simply working with Joins for now
 
This is the functionality I offered you earlier. I have a setup that works not only for roles in terms of seniority but also by department. So, access can be limited both by seniority (a Manager can do more than shop floor workers) but also a Manager of Dept A can't mess with Dept B
 
7:54 PM
@roganjosh regarding the design of the database, the feedback I received after sharing this problem is that it is not well constructed. I did not follow up on what that exactly meant, but I did sign up for a database course to shed more light on this. So, hopefully in the next few weeks I will have a much better understanding
@roganjosh Right, and I am on that kind of implementation to understand it better
 
It's worth noting that flask-principal handles this kind of stuff supposedly out of the box but I sidestepped it (for better or for worse)
 
It is the same suggestion @dhiaagr has made which I am looking into at the moment
@roganjosh Thank you for the pointer. I will be on it
 
8:36 PM
@Aran-Fey: I think I have a working GUI that shows a bit the problem. Should I paste the code here, please?
@Aran-Fey I was so free to post my MWE with the GUI here discourse.matplotlib.org/t/…
 

« first day (4323 days earlier)      last day (608 days later) »