« first day (4024 days earlier)      last day (907 days later) » 

12:34 AM
@Kevin Here's a better version. It gives all the triads with c=2a±1 sagecell.sagemath.org/…
 
 
1 hour later…
 
3 hours later…
4:29 AM
can this be closed stackoverflow.com/questions/69671367/… ? I have cv, but would retract if its wrong
 
 
3 hours later…
7:12 AM
@roganjosh If you mean the close vs. commit debacle, we ran into that as well. Totally not the behaviour I would have expected.
 
7:56 AM
cbg
 
@MisterMiyagi Yeah, exactly that. It makes me feel better that I'm not alone on that one, then :) We launched a new API service on K8s and within hours had massively exceeded the 500 concurrent redshift connections, so everything just ground to a halt
 
8:15 AM
Similar thing here. It creeped up on us slowly because garbage collection would occasionally clean up most of the backlog.
 
Why do I even write my own code, I just discovered urllib.parse.urlencode(filter), after implementing a whacky custom solution
 
Probably would not have caught that if we wouldn't run our tests with PyPy as well.
 
In fact, I think it's worth showing what we're referring to in my panicked code message on Slack because I really don't think it's well-known
with psycopg2.connect(user=os.environ['REDSHIFT_USERNAME'],
                      password=os.environ['REDSHIFT_PASSWORD'],
                      host=os.environ['REDSHIFT_HOST'],
                      port=os.environ['REDSHIFT_PORT'],
                      dbname=os.environ['TENANT']) as conn:
    c = conn.cursor()
    c.execute("SELECT * FROM transform.parcel_scans LIMIT 1")
    c.close()

# None of this should be possible!
c = conn.cursor()
c.execute("SELECT * FROM transform.parcel_scans LIMIT 1")
 
"# None of this should be possible!" 😭
 
lol wait wow. That code example says more than a thousand words. That is UNintuitive behaviour.
Is this a bug or a feature?
sounds like a bug, but based on how you described it it seems to be a feature, but why...
 
8:18 AM
That's seemingly a feature, since other DB bindings use the same behaviour
 
So we duplicate a bug because other buggy code expects this bug, nice
 
It's not a bug, they kinda hijacked the context manager mechanics
 
The sqlite3 module claims to be PEP compliant, so I guess that's indeed expected. :/
 
Could you both explain a bit more? I mean I get they could use a context manager and just leave the exit method empty, but why would you? Also how does that pep mandate this behaviour? Can you point out the section, I searched for context manager but no hits on that page
 
8:26 AM
> The Python DBAPI was written well before context managers were added to the Python language.
whoah
 
> The Python DBAPI was written carved in stone well before context managers were added to the Python language.
 
I mean if you start moving the goalpost for an abstract API reference it starts losing its point
what they should have done right from the start, however, is mandate '?' as a format specifier for prepared statements...
 
Don't get me started....
 
I'm stick in a meeting for another one and a half hours... please do get started. :P
 
Too late. %s as a binding parameter is just an endless source of confusion and I think it's the dumbest problem I encounter at least weekly, if not daily
And I can't be angry with people that can't see the difference between string formatting and parameterization, but I have to keep making example after example to show it's different. It's just begging to be mixed up with string formatting, while we continually preach about SQL injection. And it really didn't need to be like that
 
8:40 AM
Unfortunately the people designing those APIs couldn't imagine people being confused, because obviously string formatting and parametrisation are very different things.
 
SQLite is pretty old, though, so presumably they did see the issue because they chose correctly with ?
 
@AndrasDeak They probably thought it was helpful to make the parameterisation syntax parallel to printf formatting, because every C coder already knows how to do that.
 
whatever they thought, they didn't expect future noobs
 
Indeed
 
8:48 AM
> There is a race between mankind and the universe. Mankind is trying to build bigger, better, faster, and more noobproof code. The universe is trying to build bigger, better, and faster noobs. So far the universe is winning.
 
9:22 AM
cbg everyone
 
cbg
 
I found this answer here: stackoverflow.com/a/69671543/4001592 is an exact copy of the one linked. What is the procedure here? As I don't see a flag for plagiarism
 
@DaniMesejo custom mod flag explaining the plagiarism
and vote to close the question as a dupe if the answer applies
OK, you already hammered it
 
Thanks!
 
@DaniMesejo Wow. I suspect that guy doesn't even realise that he's doing something wrong. It's not like he tried to hide his source.
You have to use a custom flag for plagiarism because it always needs at least a brief explanation, and a link to the plagiarised source.
Plagiarism is a bit of a hot topic at the moment...
I think there's a bit of a cultural aspect to it. If you come from a country where the education system has a very heavy emphasis on memorising things parrot-fashion, and regurgitating definitions verbatim, it may be a bit hard to understand that you're not actually supposed to copy stuff.
 
9:46 AM
@PM2Ring I hadn't noticed :p
 
:D
 
10:00 AM
@PM2Ring True, btw I did not that SO was so heavy on plagiarism until the recent developments. I've seen plagiarised all over the place (even in the same question)
 
@DaniMesejo See meta.stackexchange.com/questions/160071/… Sometimes, the author genuinely doesn't understand they're doing a bad thing. If you suspect that's the case, a simple comment like "you need to put quoted material into a quote block, and mention the name of the original author, preferably with a link to your source" may be sufficient. But if they don't respond, please flag!
 
10:16 AM
@JonClements Interesting. I don't remember that song. It reminds me a little bit of Genesis.
 
 
3 hours later…
12:47 PM
Does creating a tag python-generators make sense? I see there is one for python-decorators...
 
Seems more useful than python-decorators, that's for sure
 
@DaniMesejo A better link is stackoverflow.com/help/referencing. You can use this link in the comments that @PM2Ring was describing, too. It lays out very clearly what our policies are with respect to plagiarism, and it also explains the very simple solution: attribution. Attribution requires 3 things: (1) the name of the original author (if available), (2) a link to the original source, and (3) proper use of blockquote formatting to indicate all copied portions.
 
1:19 PM
One time in high school I got an F on an English paper because I attributed an author in the works cited, but not in the actual paragraph where I quoted them. Oops.
 
Gee, that's pretty strict for high school.
 
I think it was a mandate from the administrators, because my teacher seemed quite apologetic about it. Pretty sure I still got an A that semester :>
I like using quote blocks and attribution links on here, because the fewer statements of fact I personally make, the better. If I speak a falsity, the reader calls me a fool. If I quote a falsity, the reader and I can laugh together about what fool wrote it.
 
Here's a scary case I saw a few days ago on the HNQ: academia.stackexchange.com/questions/176558/… While working on a paper, my PhD advisor (at a prestigious school, if that matters) sent revisions that included three pages plagiarized from a book. Thankfully I caught this before the paper was submitted, but otherwise it could have had terrible consequences.
 
@Kevin That's why I always like to point out the fools who believe it.
 
I am constantly honing my insincerity so that nobody can be really sure what I actually believe
Although as an enthusiast of philosophical materialism, perhaps I should believe that there's no such thing as believing, only in behaving as though you believe
 
1:31 PM
Seems like a bulletproof strategy
Unless you are interested in credibility
 
I try to be diplomatic when I post a "please make it clear when you are quoting other people's work" comment. Most of the time, the author is happy to comply, and they honestly didn't realise they were doing anything wrong. But I have had a few hostile reactions.
 
I fully support advising people on the first infraction.
I would prefer that you advise, rather than just fix it for them, though. And I would say that repeat offenders need to be brought to a moderator's attention.
 
One guy responded "I don't need to do that, it's only from blah-blah". I said, "Yes, you do. Otherwise, it's plagiarism". He replied "How dare you insult me! I come from a respectable family!"
At that point, I backed off, and flagged it. That was on Physics.SE.
 
I half hope you told him that by committing plagiarism, he brings shame down upon his entire family.
 
The nice thing about this profession is, you don't need credibility to write code that runs
 
1:38 PM
@CodyGray I was very tempted, but I didn't want things to escalate. In the mean time, my comments gathered several upvotes, so it was pretty clear that the community agreed with what I was saying.
 
You might need it to get a million downloads, but I'm usually happy with one
 
@PM2Ring Hey, as long as you're not escalating things on a site I moderate, carry on! :-p
 
"Let us continue this conversation on the Esperanto Stack Exchange, where we can escalate as much as we want"
(as long as you do so in Esperanto)
 
You can get by writing answers on SO with mediocre English skills, if you can troubleshoot & write half-decent code. On Physics, you need to be a bit more articulate. So when a regular with sub-par English suddenly posts a big chunk of clear grammatical text, it immediately sets off my alarm bells. ;)
 
Same heuristic works perfectly well here on SO
 
1:43 PM
Thanks @CodyGray
 
@CodyGray Sure, it's just harder to notice if the answer is mostly code.
OTOH, when you see high quality code from someone who doesn't seem to have the necessary skills, there's a good chance that the code was lifted from elsewhere.
 
I think finding high quality code to plagiarize is harder than writing your own high quality code...
 
@DaniMesejo You're welcome! ...What'd I do? :-)
 
Point me to the link :D
 
True, unless you find a good dupe. ^ @Aran-Fey
 
1:52 PM
Good point. I forgot those existed for a minute
 
I've caught a few plagiarists by doing a search on a few lines of the code combined with "Martijn Pieters"
 
Did ya'll hear the hubbub about Github Copilot, an AI tool that suggests autocompletions for your functions, using github as a training set?
I recall a tweet from a detractor showing how easy it is to get it to suggest the fast inverse square root function from Doom
> GitHub states that "training machine learning models on publicly available data is considered fair use across the machine learning community"
Ah, much in the same way that posting "no copyright infringement detected :-)" in the description of your video is considered fair use across the Youtube community
 
@Kevin Well, that is a nice algorithm for inverse square roots. :) It's a bit opaque, due to the bit-twiddling of the float representation, though. Of course, it's still usable without the bit twiddling, though. It's main advantage over the usual square root algorithm is that it (mostly) avoids divisions (apart from bit shifts). It's a bit unstable though, so you need a good initial approximation, otherwise it diverges.
Oops. Too many "though"s in that last post. :)
 
2:08 PM
I see that you, also, are also a man of culture that also doesn't like using the same word many times in one message
I didn't really notice until you pointed it out, which reaffirms my suspicion that it's more noticeable to the author than to the reader
 
I'd be interested in trying that Github Copilot thing. It could be annoying, but it might be very handy. Even my phone's completion suggestions are getting pretty good.
Sep 26 at 11:06, by PM 2Ring
I write a lot of Python on my Android phone. It took a while, but the suggestions I get while typing are now often quite useful. Eg, if I start typing a for loop, enumerate pops up as a suggestion at the appropriate time. Or if I type from itertools then import pops up, followed by the functions I'm most likely to import.
 
I tried a handful of AI-based autocompletion tools in the past and none of them lasted longer than 5 minutes. So I don't have high hopes, even if it's made by Github
 
I'd be interested in using it after it has a decade or so of thoroughly tested legal groundwork
The hazard of being an early adopter of legally dubious tech: hearing the phrase "we have decided to make an example out of you"
one million dollar penalty for every time you pressed Tab
 
You do have to give completion algorithms time to learn your patterns. Pre-training helps, of course, but it's not sufficient.
 
In 100 years, the majority of a programmer's education will involve training yourself to use patterns that completion algorithms work best with
 
2:22 PM
@PM2Ring Hmm, do they really learn your patterns? If they're interested in those, I have like 3 dozen past projects they can look at...
 
"The great machine spirits will be displeased if you use camelCase, and gift you with mediocre completions"
 
The GPT algorithms were trained using a huge number of Wikipedia pages (as well as other data). They do pretty well. However, the quality of grammar on Wikipedia is deteriorating (IMHO). Lots of the science, maths, and coding articles I read have a high frequency of "the" being absent in places where a native speaker wouldn't omit it.
 
Lately I've noticed a lot of comma splices, I'm not sure if it's a trend or confirmation bias
 
@Aran-Fey Sure! My Samsung phone does a pretty good job now. It was just annoying when I first got it. It still offers dumb completions, but nowhere near as often as it used to. And it can handle when I switch to coding JavaScript or SVG. I suppose it does get a little confused when I write Python that outputs SVG, though.
@Kevin I See What You Did There.
 
:-P
One construction I've begun noticing is, "Dogs love bones, however I am not a dog". It always scans weirdly to me. However, I'm not entirely sure it's wrong. "Dogs love bones, but I am not a dog" is certainly valid. Why shouldn't "however" have clause-joining powers too?
 
2:43 PM
"But" is a coordinating conjunction, along with "and", "or", "for", "yet", and "nor". Coordinating conjunctions join two independent clauses, and they are used with a comma.
 
In any case I think I'll put my foot down against "Dogs love bones, I am not a dog however"
 
How do you feel about "Dogs love bones, however, I am not a dog"?
 
Close. this random page I just googled says that "Dogs love bones; however, I am not a dog" is valid web.sonoma.edu/users/f/farahman/subpages/utilities/however.pdf
 
"However" is a complex conjunction (too many of these to list). If a complex conjunction comes at the beginning of the sentence (first clause), then you use a semicolon to separate the clauses. Otherwise, if the complex conjunction comes between the two clauses, then you use a comma.
@Aran-Fey Incorrect. First comma must be a semicolon.
 
Independent verification!
 
2:44 PM
@Kevin "Dogs love bones; I am not a dog, however."
Awkward, but grammatical.
 
Huh, I didn't know that was grammatically incorrect
 
Yeah, it's a comma splice.
You've got two complete sentences (independent clauses). They can't be joined by a mere comma (too weak).
 
I do love discussions about grammar where the other person mentions a term I can add to my collection
 
I just love discussions about grammar
 
I'll put "complex conjunction" in the drawing room, next to the dangling participle
 
2:46 PM
Oops. Actually...
No, that's right. Never mind.
You confused me with all of your lauding of praise :-)
 
Relatable, my default reaction to praise is, "... Are you trying to trick me"
After I draw up some game theory punnett squares I usually conclude this is not the case
 
@CodyGray Pretty sure I can come up with a counter-example for this... like "no, that's alright". Aren't those two complete sentences joined by a comma?
 
I don't think "no" would be considered an independent clause
 
There's probably a ton of sentences in everyday speech that sound and look normal, but violate one formal rule or another
 
In that sentence, "no" is being used as either an interjection or an exclamation.
 
2:52 PM
Natural languages are hard. I'll just stick to programming languages
 
3:27 PM
@Aran-Fey I always find it funny when people say that, it's not like there are language drafts which make certain syntax correct and others wrong. Some phrase might be more grammatically common or less, but since there is no formal standard natural language can not be right or wrong. You might have less communication success using less common grammar though
Except for French, as I've heard they are crazy about their language and I would not be surprised if they actually have a document describing French grammar, like there is one for valid Python programs :D
 
Yes, lots of natural languages have documents defining what is correct.
English doesn't have that, but that doesn't mean no languages do.
 
@CodyGray sure and I always considered people doing that preposterous and wasting their and my time, but well it's a hobby I guess
 
Agreed
But then there are commonly agreed-upon rules for syntax and grammar.
So it's not quite as anarchic as you make it sound, even for languages that don't have strict formal documents.
There may be multiple ways to be right, but rest assured that there are still ways to be wrong. :-)
 
I'd call them conventions, rules sounds too technical. It's not like something is gonna happen if I break the rule, whereas if I break a rule of a programming language I get SyntaxError :D
 
Do you know how many times I want to reply to emails with "Syntax Error: Unable to parse this message"?!
At least once a day, often more.
 
3:37 PM
XD
Omg, I just read the line up which lead to the starred message of I'm an expert in crap. Holy molly, there is some wild stuff out there :D
 
If it's really true that the english language has no formal specification, shouldn't it be a lot messier and inconsistent? I have a hard time believing that
 
People have to be able to understand each other. That keeps it from drifting too far, too fast.
 
Wait wait wait, I just realized the implications of this. This means that if I see someone say "should of" instead of "should have", I can't tell them they're wrong and making a mockery of themselves?!
 
You absolutely can, and you have my blessing.
Words still mean things, independently of grammar.
 
The meaning of words is also subject to change though
 
3:45 PM
I'll let you know when "of" changes into "have"...
 
Pretty sure that happened years ago... at least when it's preceded by "should" :P
 
@Aran-Fey lol, never heard that one, but it's hilarious. I can see it, should have does sound an awful lot like should of.
 
Back when I only knew english from school books, it blew my mind that "your" and "you're" sound alike. I never understood how people got those mixed up
 
You pronounced them differently?
 
@CodyGray slightly, there is just a faint e you can hear. But that might be just in my head and I couldn't tell the difference hearing recordings of myself saying these two words :D
 
3:51 PM
Maybe. I can convince myself there's some extra noise at the end of "you're", too.
 
Proposal: all apostrophes should be pronounced with a glottal stop.
 
Hard to say what it is, or if it's really there.
 
@CodyGray extra noise sounds right :D
 
Americans already know how to do this mouth move, as it appears in the middle of "uh-oh"
 
@CodyGray Yeah. Since "you're" is supposed to be a contraction of "you" and "are", I assumed you should be able to hear that "you". Like "yu". But no, it's a "yo"
 
3:53 PM
@Aran-Fey Ah, that actually makes sense.
And... sometimes it is pronounced that way!
This is where everyone curses English pronunciation "rules". :-)
 
After trying to read up if there are evolutionary benefits to different hair and eye color. I followed the citation links a few levels deep and ended up at this: ncbi.nlm.nih.gov/pmc/articles/PMC2626753 What a ridicolous amount of bs pseudoscience. It's odd we don't know why there are different hair and eye colors, even odder is trying to find a signal in random noise.
 
Wow.
 
I've heard of digit ratios before. Apparently it's a weirdly good predictor of certain traits that have no apparent connection to digits.
(digit as in finger, not number, if that's not clear)
 
@Kevin the wiki article section critic is illuminating
seems to be weakly related to some hormones in early development, but even that I'm not sure of and the rest seems way out of reach
this one fits better :D
 
4:59 PM
@Hakaishin "For the remaining 44 traders [...]"
that's, like, at least 20 more than the sample size of the competing research group so it's all good
 
5:39 PM
Hi guys, does anyone know an approach?
 
Seems more like a statistical analysis problem than a programming problem. How about least squares?
 
Thinking using the linear regression from keras
 
@Castiel for future reference, please don't ask for help here with fresh questions on the main site as per our rules
 
Input: [8.94, 7.67, 4.92, 1.19, 1.73]
Next number as output: [4.68, 1.38, 13.25, 1.12, 1.08, 1.12, 1.64, 6.72, 1.54]
@AndrasDeak ok
@Kevin how would you approach it?
 
I would ask my statistical analysis friends how they'd approach it. (not sarcasm)
 
5:41 PM
haha
 
I'm imagining it as a graph problem. The inputs are the Y values for five points. the X values can be [0,1,2,3,4]. Now draw a line passing through the points. You can use that line to predict future values.
 
6:06 PM
@PM2Ring thanks a lot for the explanations and details regarding sets, lists and order mate!
 
"or get close to predict". One either predicts or they don't predict. The question is just homework
 
6:24 PM
does anyone understand this if condition, first time i am seeing an 'in' in a if condition
if os.getenv("ENVIRONMENT") in ("master", "release", "develop"):
 
A in B evaluates to True if A is an element of the collection B
So, if os.getenv("ENVIRONMENT") is equal to "master", or "release", or "develop", then your condition is true
 
okay so it is not an or condition
 
It's... Kind of an or condition? You could write the same logic using ors.
A in [X, Y, Z] is effectively identical to A == X or A == Y or A == Z
Keeping in mind that neither of those is like A == X or Y or Z, which is almost always a mistake and should not be used
 
wait why can't I use an or condition I want to check if it is one or the other environment
if os.getenv("ENVIRONMENT") == "master" || "release" || "develop":
 
oof
 
6:29 PM
For one thing, || isn't a valid Python operator :-)
 
A == X or Y or Z is equivalent to (A == X) or bool(Y) or bool(Z), and since bool(any_non_empty_string) evaluates to True, doing A == X or Y or Z with strings will probably give you an if block that always executes no matter what
>>> def verify_user(password):
...     if password == "hunter2" or "swordfish" or "correct horse battery staple":
...             print("Welcome")
...     else:
...             print("Access denied.")
...
>>> verify_user("hunter2")
Welcome
>>> verify_user("swordfish")
Welcome
>>> verify_user("coconut")
Welcome
>>> verify_user("")
Welcome
>>> verify_user("1234")
Welcome
 
mad mad thanks guys
btw are you the same kevin?
 
@S.Code please avoid using expletives here
 
If you've seen a Kevin in here, there's about a 99% chance it was me
Other Kevins drift in and out, but I put in more hours
 
dude i am not using expletives its a term in London to say mad like crazy like i can't believe i didn't know it
 
I meant the message that I've moved since
 
cbg folks
 
cbg
 
oh sorry, didn't realise, thanks for helping out guys
 
6:39 PM
no worries
 
have you all heard about the no-gil python implementation that's showing some promise? mailing list
^ might be an good read for those interested
 
In passing.
 
I'm genuinely curious if it changes the roadmap for future python versions, considering 3.11 and higher were already planning on performance improvements
 
 
3 hours later…
9:57 PM
How difficult is it to develop an indi game in python, like hacknet ?
 

« first day (4024 days earlier)      last day (907 days later) »