« first day (3498 days earlier)      last day (1464 days later) » 
02:00 - 22:0022:00 - 00:00

2:50 AM
@wim Okay, but I was only thinking str, and if it was only str, and not making any other fn calls, it's hard to see how it could crash.
 
wim
3:48 AM
e.g. when you used addition to concat a string literal with a string from an instance attribute (that you got from a filesystem or database, and oops it turned out to be encoded) - boom!
taking bets on this comment, will the Unfriendly Terminator 2.0 make it vanish?
 
 
3 hours later…
6:34 AM
cbg-ning
 
 
1 hour later…
7:34 AM
@smci Ha, I don't think I can share his nicknames after that incident :P
@smci I don't like dismissing people off-hand based on rep but it's a decent heuristic. I just had to leave the main feed shortly after because that was far from the worst question. Worse than just a constant stream of terrible questions and answers, it started to feel like there wasn't any critical mass of experienced users to maintain any kind of sanity. A veritable Alice in Wonderland experience :/
 
Who doesn't want to follow the white rabbit and take the red pill though? :p
 
print('Hola amigos')
 
print('cabbage')
 
@wim I don't see an accepted answer :P
@roganjosh look at the figures in meta.stackexchange.com/questions/347610/…
 
I suppose it should really have been print('repollo') but actually, does Salad translate to other languages as English does? If this is confusing you @ABcDexter, see Salad
@AndrasDeak I'm almost tempted to find the SEDE and give it a window just for 2020 but I think I'll just find it terrifying
Found the query. I apparently can't help or control myself :/
 
7:54 AM
You've still got 740 more rep to get :)
 
I did try avoid taking that threshold to heart :P
 
Well just don't think about it and then I won't keep reminding you to not think about it? :p
 
"Don't think of a white elephant"
 
You just lost the game
 
I don't mind white elephants... that pink one in the (socvr) room though :p
 
8:03 AM
@AndrasDeak noooo!
 
8:20 AM
Hmm, ok. Based on that query, there's a huge upward trend in May in the number of active users but at a more-reasonable threshold of 9000 rep for regulars, their activity is stable. I don't know how to add a Python filter but I bet the tag has eaten a decent chunk of the new activity
 
note that they claim that there was an uptick in registered users when the dark mode was introduced...probably people checking it out
 
I have a event loop where this function gets executed every time it receaves a signal
def printsomething(self, condition):
        if condition == True:
            self.show()
            print("True connection established")

        else:
            print("False no connection")
            self.hide()
I only want to execute it one time I found this answer stackoverflow.com/a/4104188/12753324
 
side note: if condition == True should just be if condition:
 
cbg patch
 
def run_once(f):
    def wrapper(*args, **kwargs):
        if not wrapper.has_run:
            wrapper.has_run = True
            return f(*args, **kwargs)
    wrapper.has_run = False
    return wrapper


@run_once
def my_function(foo, bar):
    return foo+bar
how can I implement this function I can not get this running one time
 
8:25 AM
aanybody here know how I can run python requests through my browser so it uses my session/cookie info?
like if i just pull the session info is that good enough
or is there an extra browser handshake that firefox or whatever automatically handles that also nneeds to be implemented
 
@roblox It's still not clear why your function is being executed more than once. What is triggering the execution? We need an MCVE
@Skyler check out selenium
 
@roblox what do you want to happen? if i run that code, my_func runs exactly once, which seems like what's supposed to happen
 
Ok, it was a simple-enough edit to the query to filter on python (I'm assuming that query isn't just accessible on my account and I don't need to save it with a name or anything)
 
its connected to signal that is constant ( QT ) when its receaves the signal its gets executed
 
@roganjosh umm... are the results from that going to be depressing? :(
 
8:34 AM
@Aran-Fey I've used selenium for some projects but the data I'm trying to pull has some peculiarities to its HTTP request, the header has a field "referer" that's generally not useed or used for analytics on most sites. Here it's actually used as a "security layer" of sorts, and I need to include a script to manage the referer
 
Running for just 1 year and eyeballing it: nearly 100% increase in unique users so far for 2020, and rising :O This is... not sustainable
 
so if I can add this referer code as a script of sorts into selenium then that does sound like a great idea
 
@JonClements no comment
 
There probably is a way to make selenium set specific header values. And if not, you can still use selenium to extract your cookies
 
Ok, that's a good point. Is selenium is able to also handle video data?
 
8:38 AM
"handle" meaning what exactly?
(my answer will probably be "I don't know")
 
selenium generall is good for scarping/download text/image, can it also download videos that aren't just statically embedded
 
probably not, I think
 
that being said, if a chrome sellenium session can essentially "host" my python script the script can do all the heavy lifting
 
8:53 AM
Well, the OP accepted the answer saying that HTML is a language written in Python, as is Machine Learning. Apparently doesn't understand anything that other people were saying but that was the best answer.
 
9:10 AM
@roganjosh how funny, i was just looking at something that might qualify as an answer
 
@Skyler pypy is a decent answer. The OP is just derailing everything and between them and the accepted-answerer, I can't if it's just a troll setup
 
i havent jumped into its details for implementation but its something of a javascript version of cython
 
You mean CPython, not Cython, I guess?
 
yea
waiit
 
Ah no, you were correct the first time, sorry
 
9:13 AM
yea
for a sec i was thinking i was getting opposites down
Cpython is generally just the standard python implementation right
and technically arent cpython and pypy more like c++ implementing python?
the python in Cpython is just kind of like how when you compile C you have to bootstrap a few intermediate compiler
to read the more complex C compilation
 
It was me that got confused initially (not between CPython/Cython but what parallel you were suggesting). Yes, CPython is the main implementation of Python. I hope the later comments aren't informed by the terrible answer to the linked question :P
 
well i was digging around the cpytthon codebase and its 30% C/C++ and 60%+ python
so i figure they probably use C kind of like how C uses assembly to bootstrap its compiler
 
 
1 hour later…
10:47 AM
@JonClements Now look what you made me do; I had to go answer a bountied question. I hope you're happy! :P Separately, there's a few decent questions open there for people to have a crack at
 
/me looks innocent... I have no idea what you mean...
You're on a roll though... just another 645 to go - don't start dilly dallying now :p
 
May I take some time to make a bacon sandwich first?
 
Depends. Are you sharing?
 
@roganjosh sure... as long as mine has some fried onions in it
 
No, bad dog! Onions are toxic to canines :P
 
10:59 AM
haha
 
@AndrasDeak well... if that's the case - then they've been lousy at being toxic so far :)
 
Actually, I think it's sort of random in how it affects dogs. The mechanism's unclear too if I recall correctly...but it has the potential to mess up the blood.
I've read at least one account where a boxer ate a plateful of fried onion rings and then fell into a coma :(
 
errr... how big a plate was it?
 
It didn't specify :)
Grapes and especially raisins are similar, by the way. But the real killer is xylitol.
 
wow... can you stop listing foods I quite like now? You're making me wonder if I've got some serious masochistic problems :)
 
11:11 AM
Hmm...since you like raisins—chocolate chip cookies maybe? :P
 
the larger the plate the better! :)
 
 
2 hours later…
1:41 PM
first time finished my week work on thursday , seeking for advice what to do tomorow that looks like Im busy?
 
Boring answer: ask your boss for more work
 
sure and tell him that he can erease my overtime too
 
1:55 PM
Add Easter Eggs to the completed work?
 
Vague probability question. I have an unfair coin with a 75%/25% distribution, but I don't know whether heads is the 75% side, or tails. I can flip the coin as many times as I want. How many times should I flip the coin before I guess which side is which?
 
First I think you would need to establish a confidence interval
 
If I flip once and declare whichever side appears is the 75% side, then I'll be right with 75% confidence. If I flip a million times, my confidence will be close to 100%.
How many trials do I need for, say, 95%?
 
Hmm, I should know this but it's gonna be a wiki job for Bayesian confidence intervals
 
I'm not sure how to formalize the concept of "after N trials, choose the side that appeared more and declare that the 75% side" if each side happens to appear exactly 50% of the time
 
2:05 PM
flip a coin to decide? :p
 
Well, that's what's sticking me too, since we already know the bias (which would be the traditional problem to solve)
I'm not sure whether it requires something like this but with 4 outcomes. Heads is 75% and you guess heads, heads is 75% and you guess tails, etc. I think I've started off from the wrong angle now
 
Hmm, thinking about it some more, I think my actual problem isn't quite isomorphic to this one
My actual problem is: a particular species of flower has one gene that determines its color. The dominant allele, R, produces a red flower. The recessive allele, r, produces a blue flower. You have a red flower, and you may cross-breed it with itself as many times as you like. How many offspring should you produce before you can decide with 95% confidence whether it is an RR flower or Rr flower?
I'm not even sure it makes sense to commit to producing a static number of offspring, because as soon as you find a single blue offspring, you can stop testing because the parent is definitely Rr
 
2:24 PM
That does sound like something to keep oneself amused during social-distancing :p
 
@Kevin In addition, they are dependent events, which the coin flips would not be
Actually, that's not true. Hmm
 
Maybe this one is easier, because the only case that does not give you 100% confidence is "N trials, N red offspring" and in that case you can determine the odds of the parent being an Rr flower as "the odds of N consecutive rand() calls all being lower than 0.25"
The odds of an Rr flower producing three red offspring in three trials is .25^3 = 1.5625%, so that should give me 98.4375% confidence that the parent is RR. Or am I misusing the term "confidence" here...
 
You're not testing against a normal distribution
Man my stats are rusty. Let me think about it a bit
 
Bonus question. Start with a single Rr flower. self-pollinate it with itself until it produces a red offspring. Self pollinate that offspring with itself until it produces a red offspring... Repeat N times. What are the odds that the final descendant is still Rr?
(You can't make any inferences based on how many blue offspring appeared in each generation because you delegated the actual pollination work to your clueless assistant, who destroyed all the blue flowers and didn't take notes)
 
Oh good, I was hoping for some context :P What's the assistant's name? May be relevant
 
2:40 PM
Carl. You miss your previous assistant, Igor, who was highly competent. He's currently away on medical leave getting his hunchback enlarged.
 
Get it together, Carl!
 
You tell Carl to start writing things down, and he assures you that he will, but you notice that he does not write down "start writing things down", so you aren't optimistic.
 
@Kevin In response to this question, I found this
 
Hmm, question seems applicable, if I plug in .25 and .75 for p and q
 
Particularly the second answer
For the actual problem, I don't think it needs to be anywhere near as complex. Your quick probability calculation will probably do
 
2:55 PM
The "you can never be completely sure" answer is objectively correct, but unhelpful if I want to keep my flower breeding grant
 
Well, you threw that away when you hired Carl
 
BruceET gives N~= 17 for p=.3 and q=.7, which probably means that p=.25 and q=.75 is in the same ballpark. Guess who's pulling overtime this weekend... (it's Carl)
 
3:16 PM
Here is a simulation of the take-first-red-offspring experiment. Looks like you need about 8 generations to get a 95% confidence of having an RR descendant.
I'm almost certain you can solve this symbolically. Not sure about closed-form though.
After one generation, you have a 1/3 chance of an RR flower, and a 2/3 chance of Rr... Uh oh, this isn't going to run up against the Boy or Girl paradox, is it?
 
Sounds like if you keep Carl on then you've got a 100% chance of having no flowers at all...
 
I think Carl might just need some training and confidence building. Maybe have him run a weekly seminar about plant breeding. A ~10 min presentation, 5 mins for questions should do.
 
Homozygous odds after two generations is 1/3 * (1) + 2/3 * (1/3) == 5/9... Matches my empirical numbers so far.
So generally, p[n+1] = p[n] + (1-p[n])*1/3
 
@roganjosh I didn't say I did that, and I didn't say 'dismiss offhand' (e.g. filter them out by OP rep), I merely said 'not spending much effort on'.
325
Q: It's time to reward the duplicate finders

wim Stack Overflow sees many questions asked repeatedly, despite the large quantity of existing content, because it's not always easy to know the best keywords to use in the search. Long-time users tend to know when and where there are already adequate answers on site, and will just go and find th...

Just saw wim asked this back on Feb 18
 
So p[n+1] = (2*p[n]+1)/3... Not quite a geometric progression, is it?
 
3:30 PM
@TheNamesAlc Any progress with your prime sieve?
 
Hmm. Does the sum of C^k for all k from 1 to N have a closed form representation using C and N?
 
@Kevin yes ^
the easy way to remember it is to compute sum_{k=1}^inf C^k - sum_{k=N+1}^inf C^k = sum_{k=1}^inf C^k - C^N sum_{k=1}^inf C^k = (1 - C^N) sum_{k=1}^inf C^k, where sum_{k=1}^inf C^k = sum_{k=0}^inf C^k - 1 = 1/(1-C) - 1 = C/(1-C) unless I'm mistaken
 
Incorporating the work I've scrawled on these cocktail napkins, p[n] = p[0] * B^n + C*(sum of B^k for k=0 to n-1 inclusive), where B = 2/3, and C = 1/3
I'm probably going to get about three fencepost errors trying to simplify that "sum of" component into its closed form
 
Skimming your original problem, I would want to involve the law of large numbers at one point
@Kevin that's even better
(sum of B^k for k=0 to n-1 inclusive) = sum_{k=0}^{n-1} B^k = sum_{k=0}^inf B^k - sum_{k=n}^inf B^k = sum_{k=0}^inf B^k - B^n sum_{k=0}^inf B^k = (1 - B^n)/(1-B)
the funny thing is that it's way easier to memorize the sum of the infinite series
 
3:48 PM
If I set p[n] to p[n+1] I get p[n]=1, which passes my sniff test
After infinity trials I'm pretty confident I'll have RR
 
Yeah, that's why I mentioned the law of large numbers. You might be able to derive the average number of blue children after n generations, and the deviation of this number.
It's weird because (as you've mentioned) once you get a blue child you know it's Rr, but until then you can't be sure. And there's always a small chance that you're chock full of Rr children without any rr. So at one point you'll have to accept an error margin.
this is jelly beans and acne all over again
 
I can live with an error margin. I've already made peace with the fact that none of my professional work can ever be 100% robust since a cosmic ray can always flip a bit
 
So the law of large numbers or something similar is probably your best bet. If you flip a fair coin n times you know you'll roughly get n/2 heads, and the deviation is ~1/sqrt(n) I think.
 
So I merely need to solve for p[n] = P(chances of a cosmic ray exciting an electron in my ram) and I'll be square
What are we talking here, like 1e-100?
 
I can't quantify the impossible
 
3:58 PM
If you're claiming the odds are flat zero, I'm skeptical
Ah, Wikipedia tells me that "the primary particle of the cosmic ray does not generally reach the Earth's surface", and it's secondary excited particles that cause the error. So you might plausibly argue that a cosmic ray hitting a hard disk directly has never happened
As for secondary particles, "IBM estimated in 1996 that one error per month per 256 MiB of ram was expected for a desktop computer"
 
@Kevin No just 0 for all intents and purposes. I would think that it's in the same ballpark as "all the air molecules gathering in one side of the room", which is 10^(-10^17)
OK, maybe more likely
 
Hard mode: assume that modern error-correcting firmware ensures that two bits need to be flipped in quick succession in order for the error to go uncorrected
Then it's like (10^(-10^17))^2
 
Bear the noobness, I have a function abc() that is supposed to fetch a row from sqlite check it's status and process it it status is 0 then change it to 1 and move on to the next row. I tried using while but obviously when there are no rows the rpogram exits which shouldn't happen the program should keep looking for rows with status 0 so that it can keep processing.
I tried using threading and ran the stuff that is inside func abc() in while loop yet it didn't work, I tried converting fetchone() to fetchall() that is not a good idea as it'll return all rows and yet will exit after all rows are finished processing. How do I navigate this?
 
@AndrasDeak 'Multiple Testing Problem', please. Before generation Z grow up thinking xkcd/Randall Munroe formulated it...
 
4:13 PM
@AshwinPhadke Perhaps you could put the entire program in one big while True: loop?
 
@AshwinPhadke put abc() inside the while loop, not having the while loop inside abc
 
Hmm I may agree with roganjosh, depending on the exact structure of the existing code
What does the current while line look like? I'm curious what the stop condition is
 
@roganjosh tried that, but as soon as there will be no rows it will still return 0 and exit as the condition becomes false right?
 
@Kevin No, but you can iteratively use the Faulhaber formula to get the coefficients for order m=n given you have the formulas for 0,...,n-1. I've only ever seen the coefficients stated for sum_(x^k), not for sum_{k=0..m-1} (x^k). Can you show us what the first few look like?
 
@Kevin stop condition will occur if one cannot fetch any more rows with status=0. but I need to keep monitoring new entries with status=0 whenever they occur
 
4:17 PM
@AshwinPhadke then don't have that response work as a stop condition
Just sleep(1) or something on it finding no new entries to process
 
I was checking threading but so far it hasn't worked. as threads would keep running I was looking for it.
@roganjosh you mean sleep(1), while , sleep(1) ?
 
@smci Ok. Using B=3, the sum of B^k for k =0 to n-1 inclusive is:
n= 0: 0
n= 1: 1
n= 2: 4
n= 3: 13
n= 4: 40
n= 5: 121
n= 6: 364
n= 7: 1093
n= 8: 3280
n= 9: 9841
 
How do you do the equivalent of the following scipy version 1.1.0 thing in Pillow?
img = imread('filename.jpg')
img_tinted = img * [1, 0.95, 0.9]
 
no, give me a min to get back to my laptop and I'll create an outline
Sorry Kevin for the ping
 
1 demerit has been recorded in your permanent record
 
4:20 PM
Whoops, convo going on
 
@JohnnyApplesauce are you multiplying it by some factor for 3 channels or anything else?
 
@JohnnyApplesauce it's fine to have multiple discussions. My phone just conspired against me to ping the wrong person :P
 
Multiplying the color channels
 
@JohnnyApplesauce have you tried writing matrix for your multiplication and calling im.convert() using Pillow?
* img_tinted.convert()
 
I was going to suggest using ImageChops.multiply on your image, using a solid image of [255, 242, 230] pixels, but it looks like one of the arguments has to have mode "1" (e.g. be black and white). This confuses me.
Multiplying doesn't seem as useful as it could be if you can only multiply by two numbers
 
4:26 PM
@JohnnyApplesauce try this if this helps : pillow.readthedocs.io/en/stable/reference/…
 
@AshwinPhadke Something like this. That's a really simple outline just for the process - you may want to have the connection persisted higher up and handle the connection teardown better on an exception, but it's just the rough idea.
You may also want to know whether the function actually found something to process vs just skipped, but I'd consider either scenario a success if the function is just there to listen for things to process forever
 
@Kevin No, I mean the Faulhaber coefficients for each x^k. Not just the sum values.
Looking for a pattern in the Faulhaber coefficients, even for say orders < 10, is hard.
 
Hmm
 
@Kevin actually, that figure corresponds to a room of around half an inch long on one side
 
4:42 PM
@roganjosh correct, just listening to the process is important for this application.
@roganjosh hey thanks a lot for the effort, I'll try this out. yeah i' going to add a few more exceptions too as it dependson the upload time and session. Thanks.
 
Hmm, now that I actually try calling ImageChops.multiply on two images that have mode RGB, it seems to work just fine. Am I reading outdated documentation, or something...?
 
@AshwinPhadke no worries. Please don't even vaguely attempt to cargo cult the code I posted, though :) It has plenty of issues. Just take it for the general outline. I really worry when I don't post internally-coherent snippets!
 
@roganjosh hehe yeah I understand. I'll do the necessary bits.
can i change if not data: return True to if not data : process_pending() would that work?
 
the latter would return None
 
Why would you want that? At best you're hinting at recursion
 
4:47 PM
I'd expect that to crash after 999 consecutive no-data checks
 
@roganjosh yeah realized that now, not very good.
@AndrasDeak yes.
 
Or possibly much sooner if "number of active connections to the DB" is a limited resource under a thousand
 
@Kevin yeah it probably will
 
The point of the structure is that you now have an open while loop so you can do other things inside that loop. Once it's inside the function, well, that's pretty much it
 
Rule of thumb: if all you want is to make the program jump back up to the top of your function, it is almost certain that you should not use recursion
 
4:50 PM
Everything before the comma is redundant there, surely? :p
 
sorry, I didn't read context
 
This principle is not exclusive to algorithms that make DB connections or perform I/O in general, incidentally
This reminds me of a tweet I saw the other day that showed how you could use ctypes to implement goto in Python. It was extremely cursed.
 
Is this May's disaster?
 
The thread goes on to link to github.com/python/cpython/blob/master/Doc/faq/design.rst, which is a nice resource for why Python's design makes a number of interesting choices, "why no goto?" among them
I wasn't aware of this page before, so at least something good came out of this
 
I had seen the "raise exception to jump out of five nested loops" tricks in MATLAB before I switched to python
 
4:57 PM
I've done that once or twice, when "put four of the loops in a nested function, and return out of that" was off the table
I think exceptions-as-multilayer-break is endorsed as Not Evil somewhere in the docs or mailing list
 
@Kevin that is a very good resource tbh.
 
Github needs an Issues tab for insecure people like me, called "issues, or maybe I just misunderstand the documentation"
For when your mental model of your program doesn't match the actual result, but you don't know which one is wrong
 
Don't forget that "git blame" lies down that road if the issue is an actual issue
 
@roganjosh : that did not work, it still returns False if it cannot find such a row. Much thanks for the help.
 
@AshwinPhadke that's an odd way to end the discussion. What didn't work? What was your implementation?
 
5:09 PM
Initially I forgot to add conn.commit() and was wondering why I am looping over the same video lol.
 
These are disparate issues
 
@roganjosh So i added the try catch and while block from your snippet and it is yet exiting from the code. with the if not condition.
 
Hmm, I can't actually tell where "At least one of the images must have mode 1" is injected into the ImageChops.multiply documentation. It's not in github.com/python-pillow/Pillow/blob/master/docs/reference/… nor github.com/python-pillow/Pillow/blob/master/src/PIL/…
 
@AshwinPhadke can you please show me an MCVE of the actual issue in your code?
I only gave an outline and someone here would already have loudly objected if I was way off in what I was trying to demonstrate
 
5:14 PM
"""improved"""
 
any chance it comes from there?
 
logical_xor and friends are allowed to have the mode restriction, since it makes sense for them (kinda)
 
@roganjosh : here's the entire version. pastebin.com/AN02iiEJ
 
Looks like github.com/python-pillow/Pillow/commit/… reverts the mode requirement for the ones that don't actually have a mode requirement
 
5:18 PM
I guess the readthedocs haven't been refreshed since 13 days ago
 
13 days ago so it hasn't percolated through yet
 
Independent verification 👍
 
a.k.a. Kevin'ed
 
@AshwinPhadke remember the part where I suggested not cargo culting my code? :'(
 
Ok, so @JohnnyApplesauce definitely can use ImageChops.multiply to tint his image, and he should ignore the part in the documentation about "1" mode, as "RGB" is also supported
 
5:21 PM
@AshwinPhadke anyway, try this first:
a = (False, False)
print(bool(a))
Does the answer surprise you?
 
@roganjosh yeah I do, I was trying out what was provided in order to debug and understand what can be changed and where I can create changes.
 
See ^^
 
ooo... just seen that json_normalize from pandas.io.json is now directly under pandas... sweet...
 
@AshwinPhadke there's a number of things we need to fix in that code. Since it's quiet in the room, we can try cover them briefly. The first is what I just asked you. I'll be back in a couple of mins, so I'm wondering if you know why you'd get such a result
 
@roganjosh well I am aware about what is inherently happening because of the db operations.
 
5:31 PM
Oh my god, how old am I?! I was just trying to enter a string in double quotes, and pressed Shift-2 to get " - which is what it used to be on old manual typewriters! Of course I got @ instead. Next I'll be entering lowercase-L for 1 (manuals didn't have a "1" key - it was a wasted key since you could just type "l" instead; also no "0").
 
Hey, shift-2 is " in the Hungarian qwertz layout. So perhaps you're not old, just Hungarian.
 
I actually am Hungarian on my mother's side. Grew up eating my grandmother's paprikas, kaposzta, and bablaves (did I remember the spelling right?).
 
@AshwinPhadke ok, so you know about SQL Injection, truthiness of tuples, and how unpacking None will throw exceptions
 
From Puzzling.SE "Find the (English) number between 1 and 60 s.t. if you take its WORD anagram and subtract this number you get anagram of the number - number > 5. Scripting solutions to find the smallest such number in a generalization to non-English languages...
 
@PaulMcG Well, shift-2 is " on UK layouts :)
 
5:39 PM
@JonClements Is this ASCII trivia round...?
 
yes... and your starter for 10 is... :p
 
Say, predict how many years until Euro and cents signs displace dollars and pounds on European keyboards? (possibly never, if the EU implodes)
 
That'd make jquery rather difficult... and we all know "everything needs moar jquery!" :p
 
or imagine a future where emoticons and emoji have replaced intelligent communication... wait, that's the present...
 
jquery was dropped from Bootstrap 5. It has begun
 
5:42 PM
¯\_(ツ)_/¯
 
@JonClements But why should '$' and '#' 'hegemonize' programming... it's merely an historical accident of 1950s US keyboards.... alternative histories solicited... the Man in the High Ca$tl€
 
u and ur l33t spk
stop b4 it 2 l8
 
u ok m8? pm me
 
...and the Thai Baht symbol ฿ (U+0E3F) was repurposed as Bitcoin symbol until ₿ (U+20BF) was created (in 2/2019)..
@Kevin try that Puzzling.SE above... I'm sure you can automate and generalize it. It's really interesting.
 
So, while 2020 is proving to be a yammy year, I don't think we really need to try and re-enact the 90's peeps :)
 
5:51 PM
Is there a way to get a list of all dundermethods? Without hard-coding it, of course
 
by "all" - do you mean everything that can potentially be used? ('cos there's quite a lot...)
 
yeah
 
can you post GET requests to the Data Model docs?
 
Lol, kevin'd. I was just going to say that scrapping seems the flavour of the day
 
Awww... it's no fun when you don't say "scrapping" :)
 
5:58 PM
@JonClements fixed. Thanks for catching it within the edit window
 
@roganjosh I did not know the truthiness of tuples part.
 
@smci Are we spelling 40 as "forty" or "fourty"?
 
@AshwinPhadke That was what my initial question was about but I must say that I've lost interest in the problem. I was proposing to give you a quick guide through the issues but you told me you knew what was happening, so you got the abridged version. The truthiness of tuples alone won't fix that code but the rest is up to you to research now
 
Okay thanks for the help so far too, atleast I now know that the direction was wrong, I'll look into it more now
 
0
Q: Multiilanguage generalization of "What number is that? Asks Grandpa"

smciThis is a multilingual generalized follow-on to "What number is that? Asks Grandpa", which I restate as: "What is the smallest positive English integer N, for which if you take its WORD anagram and subtract this number you get some positive integer quantity: Anagram of the number - number > zero...

No archaic spellings, I suppose. Current legal dictionary stuff only. See if you can help me nail down any other loopholes.
 
6:11 PM
please don't ask for help here with fresh questions on the network
:P
 
@AndrasDeak Hey, Kevin and PaulMcG enjoy that. I asked it verbally here, before I posted it on the network. Kevin asks lots of number riddles in here often.
 
I took the ":P" sign to mean "just kidding"
 
stackoverflow.com/q/61797196/4799172 no repro. The code is entirely redundant so don't be put off by that
 
6:27 PM
Hello guys, can anyone help me ?
 
@yaranefaa Hello :) Please make sure to review the room rules before asking, but otherwise, ask away
@yaranefaa yeah, that's against the room rules. Please wait at least 48 hours before bringing questions posted on the main site here
 
Helloo, thank you ! Sorry im new here!
 
It's fine. I'm sure you'll review the rules for going forward :)
 
 
2 hours later…
8:14 PM
Can I ask a question relating to putting an image in base64 format in a flask template, an error is thrown when I am trying to print the template as a pdf (using pdfkit)?
 
@LinuxUser as long as you abide by the room rules beforehand, you're welcome to
 
@app.route('/pdf')
def pdf_template():
        rendered = render_template('pdf_template.html')
        css = ['main.css']
        pdf = pdfkit.from_string(rendered,False,css=css)
        response = make_response(pdf)
        response.headers['Content-Type'] = 'application/pdf'
        response.headers['Content-Disposition'] = 'attachment; filename=output.pdf'
        return response
this is my flask route.
In my template, I am putting an image in base64 format and an error is thrown at this line.

`pdf = pdfkit.from_string(rendered,False,css=css)`
can you help why the err is thrown?
 
"An error" is never enough information
 
let me paste call stack...
Just a min
 
Wait
 
8:21 PM
sorry, I won't meddle :P
 
If it's a big traceback, please post in dpaste/pastbin etc
@AndrasDeak nah, I don't know this one. I just didn't want a gigantic post that had to be moved :P
 
and here I was hoping for lightning striking from your crystal ball
 
.... It needs exactly 1 traceback to power up
Coincidence? Yeah, probably. And lightning is hard to control, so it could go any which way :P
@AndrasDeak Fond memories of this discussion
 
@roganjosh speaking of which, I saw this (on the interwebz, not in real life)
@roganjosh I was going to remark on the miracle of harnessing MCVEs, but then I realized that we might as well go back to the stone age considering the abundance of this elusive resource
 
It's all the yamming Data Miners. No thought for the future; all the MCVEs are gone
 
8:34 PM
@rojanjosh, here is the call stack. Thank you for looking.
http://dpaste.com/2B5BA21
 
@roganjosh Charlie Brooker is on as good a form as normal :)
 
@LinuxUser oof, that's hard to read with all the red boxes
 
I don't know why it shows red.
Let me try pasting it in pastebin.
Just a min
 
raw is a bit better dpaste.com/2B5BA21.txt
 
Please check https://pastebin.com/zdMNNABA
It looks better
 
8:40 PM
Thanks. Loading pages (1/6)\r\r, referer: https://mywebsite.example.com/pdf/ what are you running this through?
 
sorry running through means?
 
That's not a Flask error at the end, even if it has the call stack. Gunicorn?
 
Apache
 
Ok. Have you tested this with the dev server with flask?
 
I haven't. Should I?
This is how things are working currently.
Apache/2.4.34 (Win64) mod_authnz_sspi/0.1.1 OpenSSL/1.1.0i mod_wsgi/4.6.4 Python/3.7
 
8:45 PM
@LinuxUser yes, I think you should. I don't use Apache and it's just an extra complication here. First, you should make sure that Flask can handle it correctly
 
thank you Rogan.
Let me test directly and will let you know.
 
Separately: I really think I need to change my name. I think my hold on trying to be consistent is just causing confusion
 
@roganjosh Carl? :p /me ducks and runs...
 
roganjosh should have died. I'll be reborn when the servers sync
 
ahhh interesting... I'm impatient so will force a sync
ahh there we go
 
8:52 PM
@JonClements no kidding, my dad is called Karl... and that's not a great name when it comes to intelligence
@JonClements did you force that? :P
 
yeah
boring old proper name user name hey... meh... was semi-hoping for something "way out there" :p
 
@JoshPilkington D:
 
@Josh next is the display picture... how 'bout a blue potato? :p
 
I'm not liking the change already :/
@JonClements don't push it
 
if you're really not liking it - better be quick else it gets locked in for 30 days :)
 
8:58 PM
What is "quick" here?
 
15 mins from when you changed it
 
oh yam
 
I thought it was instant 30-day freeze
 
Quick poll, then
 
Unless a mod helps, ahem
 
8:59 PM
Better with my name or do I go back?
 
you do you, fam
 
Ugh. I'm just trying to live my best life.... Now can we get serious? :P
 
I like both - go with what you're more comfortable with
 
Oh, it is what it is. It's my actual name and it makes me more accountable. I'll keep it
 
well, you're always accountable whatever, but are you comfortable with it?
 
9:02 PM
You don't really need your name for accountability. Then again nutjobs can find you from your profile anyway.
 
@JonClements I can review it down the line anyway if I don't like it
 
okie dokies
 
Thanks, though. I think most regulars will know my real name by now anyway... I hope
 
I'd have thought so
 
Programmer not used to Python need quick help here. I have a list of object and want the object that have the lowest value for a certain property, why won't this work?
class ValidCondition:
def __init__(self, condition, distance):
self.condition = condition
self.distance = distance


listOkCondition = [ValidCondition("1", 1), ValidCondition("2", 2), ValidCondition("3", 3), ValidCondition("4", 4)]
lower = min(listOkCondition, lambda x: x.distance)
print(lower.condition)
TypeError: '<' not supported between instances of 'function' and 'list'
 
9:13 PM
@Dunge Please see the formatting guide. But, the fact you're just duplicating ints and strings for instances suggests a broader problem
 
dupication is just for the example, my code have a more complex object
 
@Dunge key=lambda x: x.distance else it's considered the two argument form of min
 
oh
I thought the two argument form was this by default... didn't know passing key= would change anything
thanks
 
wim
@AndrasDeak touché 😆
 
rbrb for now
 
9:25 PM
Rbrb jon
 
9:37 PM
Today's goal: Upping the code coverage of a little lib from 76% to 100%
Result: Code is broken and in the middle of a refactor. Code coverage is only 88%
 
"I see this as an absolute win"
 
This is probably the first time I really got bitten by a lack of comments. The old code wasn't even bad, I just didn't understand it
 
9:59 PM
@Wildcard please see our code formatting guide to chat and practice in the sandbox if necessary
 
02:00 - 22:0022:00 - 00:00

« first day (3498 days earlier)      last day (1464 days later) »