« first day (3546 days earlier)      last day (1387 days later) » 
00:00 - 15:0015:00 - 00:00

3:04 PM
cbg-late afternoon guys
@holdenweb thanks for your help Tuesday. Indeed something was missing. The method was working fine but not at the correct moment
 
@AndyK cbg... did you manage to solve your thingy in the end?
 
I've added a part and now the text is displayed correctly?
@JonClements I did, Jon. I did.
 
@JonClements cheers mate. I got an insight this morning when I woke up that the sequence was not correct. The trigger should only happen at the end when you lose. After some mind wrangling, i've added a tiny part and voilà, the trick was done, the text apprear at the end.
 
@AndyK Glad it helped. I've more or less managed to mentally convert from "why isn't it doing what I want" to "what am I not understanding about this code?" Right now this is involving a lot of (re-)learning Django bits. Now have four out of five tests passing, however, and discovered moto along the way, so perhaps worth spending the time.
 
3:08 PM
@holdenweb how old is the code base - from what I recall you were using a relatively old version?
 
@holdenweb ty. indeed, the toughest part is to understand what the person wanted to do and not get stuck at the method or whatever is not functionning the way it should function.
 
@JonClements Django 1.11 (cringe). Don't @ me - it's what I got!
 
ah, legacy I hate you but you keep me in business
 
@LinkBerest what can I say... Steve's a nice guy :)
 
repl and idle are the same right?
 
nope
 
or idle is pythons repl?
 
repl is what you get when you type python, or ipython, or pypy, or ...
Read Eval Print Loop
IDLE is Python's barebones IDE
IDLE has a REPL, but it is not a REPL itself.
 
huh I see, now I'm trying to start it, is there a simple shortcut to start it on windows?
 
4:01 PM
IDLE? Why would you start it?
 
hehe I found it :)
 
the only winning move is not to IDLE
 
oh this is so jolly :P IDLE is soooo python :P
I wonder who wrote ip :P Anybody in chat?
 
It was Guido
 
haha the gui and even a debugger so good :P
I'm reading about chaosnet: twobithistory.org/2018/09/30/chaosnet.html It's so arcane. And then repl came up and I thought Idle is the same, but I learned something new, I just hope no beginner really try to use idle, like that other guy ealier today
 
4:12 PM
why so, I learned python with idle
 
Today I experienced the classic "we need to talk", followed by the walk of terror to the bigwig's office, followed by "good news! You're getting that thing you wanted". I would declare it to be today's pet peeve, but, well, it's hard to complain about good news.
 
you made bigwig's day
"You guys should have seen his face!"
 
:D Congrats, what is the thing?
 
@Hakaishin it's that thing he wanted
 
@Hakaishin I learned (and still regularly) use gVim to write Python code (then just a command-line to run it within a larger pipe usually) - starting with "big" IDEs like PyCharm is adding more to learn so is not right for all people (or needed depending on why they use Python)
 
4:17 PM
idle doesn't require virtualenv to use. It was #python that taught me what was the use of virtualenv
 
The CH DNS class is a fun artifact of digital archaeology. But it’s also a living reminder that the internet was not born fully formed, that TCP/IP is not the only way to connect computers to each other, and that “the internet” is far from the coolest name we could have had for our global communication system.
Man Chaosnet would have been an epic name and kinda more accurate name for what the internet is :P
I guess, I always felt Pycharm good to start, I started with it but different strokes for different folks
 
The contents of the good thing are not revealed to the audience, but it must surely be good. Look how it glows.
Incidentally that gif is an accurate representation of how badly I need a haircut
 
You should just buzz it :)
 
Just keep it. That's the style of 2020.
 
I'm waiting for the mullet to come back
 
4:39 PM
Hi, when I run this in terminal, I dont see the print value in the console. Am i wrong somewhere
>>>
import pytest


@pytest.mark.parametrize('execution_number', range(5))
def run_multiple_times(execution_number):
print(execution_number)
assert True
>>>
python3 -m pytest test.py
 
@Kevin Tarantino came up on the work slack this morning. I posted "Counterattack" from the anime "Darling in the Franxx" as my "getting warmed up to test the yam out of the new build" theme, and one of the devs countered with "Battle without Honor or Humanity" (Kill Bill I soundtrack).
 
> pytest discovers all tests following its Conventions for Python test discovery, so it finds both test_ prefixed functions. There is no need to subclass anything, but make sure to prefix your class with Test otherwise the class will be skipped. We can simply run the module by passing its filename:
@PrashanthSams naming is important ^, quote is from Getting started
and please see our code formatting guide to chat and practice in the sandbox if necessary
 
4:55 PM
@PrashanthSams again, please pay attention to the formatting guide that you were just linked to
 
and the above formatting guide is not that easy to understand
 
@PrashanthSams then read it three more times, but more slowly this time. And practice in the sandbox.
One thing that isn't in the guide yet is that you can't combine code blocks and quotes with directed replies. That's why I posted mine in a separate message up there ^
but there's no way that triple backticks work here so this wasn't the reason your previous message went wrong
 
ah the sandbox really helps
 
Does it, now? :P
 
5:00 PM
Closed
 
TY
It's one of those days again. OP wants a list of n "0"s. Accepts the answer that calls random twice to create n random numbers.
 
After posting the 10th comment on leaving an MVCE and how it helps you & others to debug - I remembered why I stopped leaving comments on downvotes
Also, it seems like it CSV handling day in Java - always funny how you can tell which week classes are in if you pay attention to new questions
 
why not make a bot to add a comment then?
 
because that's not the only reason I downvote - it just happens to be a common one (and a bot still has the same problem of people pinging me unhappy with their downvote - in two cases I hadn't even actually voted yet was just making the comment)
 
5:17 PM
I don't know, you guys are code architects, you can find patterns in what problems a post is having. Now a days there deep learning which can tag posts better
post -> moderator's comments(ML model) You must be having a bulk of them till now.
then moderator's comment can be predicted
 
@LinkBerest Thanks to the invaluable power of trial and error, my default "MCVE-PLZ" message has converged to a state of roughly one angry OP per month. Might cause diabetes, too.
 
rb folks, beer time with the neighbours
 
It's the long-term abusers that don't get covered well, since the sickeningly sweet greeting does not apply.
 
Should I make my comment on this Gmail question an answer? (the code is bad but at least there's something and the answer is you cannot but I don't "think" we have a dupe for it)
^ it only stopped being possible last year (or maybe late 2018)
 
@MisterMiyagi so randomly pick a number in the half closed interval [0, 0)?
 
5:30 PM
@LinkBerest I assume they're looking to scrape data, though? I'm not sure the API would be appropriate for that? Perhaps it's enough to tell them they can't do it, though
 
@Code-Apprentice They actually picked 100 numbers between 0 and 11, then samples the desired count of numbers from that.
 
hey guys anybody have an idea of the best way to pass db query set into a list() from flask to javascript
 
Didn't we discuss this yesterday?
 
def bogo_generate_n_zeroes(n):
    target = "0" * n
    while True:
        s = generate_random_string()
        if s == target: return s
 
@roganjosh Still been trying to find the way to accomplish it ;/ really hit a wall with this
 
5:32 PM
@roganjosh Yeah, I mean you can use the API to download emails (by label) so its possible...okay, making an answer
 
@Kwsswart with what part exactly? Previously you suggested that you could query the data fine (and presumably could render the initial table prior to the AJAX magic)
Have you managed to render any data to your template?
 
@roganjosh Yeah I can render the template find what I am strugging with is getting it to render in portions, so say the query returns 1000 variables instead of loading all into the page at once load first 24 and when his bottom then loading the following 24
 
I just added a note if they want to look further into it - those are options but its just not possible to "scrape" Gmail like that
 
But that's why I suggested pagination of the query result. You wouldn't render 1000 entries at once.
 
Now anyone want to calculate the odds I'll get a "thanks" but not an upvote? (secondary odds: someone pointing to the old code I referenced as proof you can scrape Gmail even though I pointed out it doesn't work?)
 
5:37 PM
@Kevin Snarky, but amusing. I sometimes (in my darker moments) realise with horror that even making jokes this is liable to backfire when someone complains it "runs too slowly".
 
@Kwsswart So that's what you need to look into. The rest is front-end work; which I already suggested is likely not to be easy. It's also beyond my JavaScript to get a nice result for that, and not on-topic for here; better for the JS room
 
You can't prove it's not O(N)™
 
@roganjosh Ok I see thank you man I will look into it
 
@Kwsswart I suggest backing up a bit. Can you render the entire query that is returned? If you haven't figured that out, then jumping to pagination is premature.
 
mostly frontend - it also means understanding OFFSET & LIMIT (if we is talking SQL)
 
5:40 PM
@Code-Apprentice well when printing it in python i am getting the query and in the html when it takes substantial time loading big results but does load , when I limit it to 20 or 40 still loads nicely in html
 
@Kwsswart ok, well that isn't pagination if it's on its own. I left our last discussion assuming you understood the pagination part
 
@Kwsswart That's not really a Python question (though yesterday you'd have helped yourself by explaining the need to inject data from a Pandas dataframe into JS code ...) but bennadel.com/blog/… might help at least with a basic structure. bennadel.com/blog/…
The guy admits he's approaching it from first principles. I'd recommend you follow that approach, so you understand the tech you are using better. Good luck
 
@Kwsswart Then you need to limit the query to return only a fixed number of items on each response. And a way to request the next page of data.
 
@Kevin I've seen something almost like that (it was for permutations). The CS PhD in question was wondering why it degraded and eventually stopped working as they approached the PRNG period.
 
I think people have seriously tried to run joke code of mine, once or twice... Which is why I try to make it crash with a NameError or what have you before it does anything truly silly
 
5:42 PM
you're too kind-hearted
 
I think of it as karma farming
 
that's not kindness that's self-interest: keeps 'um from bothering you about it after it crashes their system
 
@Code-Apprentice No way of doing that programatically?
 
These days, they'll probably just post a +5 question on SO main...
 
@roganjosh I am sorry I am very new I am going to read into pagination, what do you mean if it is on its own
 
5:45 PM
Confession: In my .NET work I've always used an out-of-the-box paginator, so I have no idea how you'd do it from the ground up
 
@Kwsswart yes, of course. The point is that you need to track the OFFSET so that you get portions of your result rather than just LIMITing yourself to the same (ish, if order were guaranteed) first block.
 
@holdenweb Im sorry I am thinking of doing it via injecting into a JS code so that I can then use the JS to detect when the scroll is at bottom of page and update the information and create more div variables automatically with control variables
 
I'm trying to think of a good analogy... give me a min
 
@Kwsswart yes, you can do it with code. In a typical pagination scheme, the response includes a "next" field in the data with the URL for the next page. I'm assuming your flask backend is a rest API. Is it?
 
For queries with smallish results, I'm sure it's easy enough to store all the results in some intermediary medium and render a couple at a time... But what if you have 10 GB of results?
 
5:50 PM
:49799295 yes it is so you saying should work it to update from within the flask app?
 
@Kwsswart Your query results are a train. You start in the front carriage and walk down the train. With pagination, you've only rendered the first carriage in your table. Just before you get to the end of the first carriage, you want your database to send data for the second, or you'll fall on the track. But you don't want it to send the first carriage again, because it'll fall out of the sky and squash you (you're already in it). So, you need to know where the first carriage ends
before asking for the next carriage. That's your OFFSET
 
@Kwsswart No need to apologise: you seem to have formulated a potentially workable approach. As an experienced programmer I'm happy to find working (rare) code that exactly solves my problem OR a decent article that explains what I need to do. Or, maybe, code I can hack.
 
I'm not entirely happy with the analogy, given that carriages don't fall from the sky, but I'll run with it. I suggest you drop out of Flask just to figure out the pagination part. Then worry about making it a server response
 
@roganjosh I get what you mean... I was thinking to do this with the javascript with a start and an end variable and send it from flask to js to work with in there and update with those, but how would I do it from the flask app itself? as I would prefer to not use JS if can avoid itç
 
Whenever I procrastinate learning something for ten years, it always turns out to be very very simple, or exactly as complicated as it appeared in my nightmares. Going by blogs.oracle.com/oraclemagazine/on-top-n-and-pagination-queries, pagination from scratch is the latter case.
 
5:54 PM
@roganjosh I will see if i can read up on pagination for a couple days
 
I'm sure calling select * from ( select rownum rnum, a.* from (your_query) a where rownum <= :M ) where rnum >= :N; a million times on a ten million row table will be positively zippy, performance-wise
 
On the receiving side in Python a generator that invisibly and lazily accesses the DB only when necessary really simplifies code structure. I don't know whether JS has grown generators yet.
 
@holdenweb I am trying to learn lol this is the first flask app of a decent scale I am building.
 
@Kwsswart you can't do it without javascript because you want your table to grow dynamically as the user scrolls
Even if you store the offset on the back end, you still need a frontend trigger to ask for the next block of data
 
@Kwsswart Good for you. But please remember it isn't cheating to read explanatory material. As a learning exercise it sounds challenging enough to be interesting.
 
5:58 PM
not unless you use the old school version (using "previous" or "next" links with post data containing the required offsets) <- this is not true "pagination"
 
Back in the old days, people were quite happy to accept that web pages were presented as integral, and when you wanted the next chunk of data the server would just render a whole new page. Nowadays they insist on a more natural interface. Curse them ...
 
@LinkBerest too easy :P (though, seriously, I'd recommend this approach. @Kwsswart is perhaps a bit over-ambitious)
 
I see so I have to try get the javascript to detect the bottom and send a signal for flask to send the next set of data from there maybe using two variables on flask to track start and end and then pass it back with flask ?
 
you can always implement one and then change it to the other (i.e. the pure html, commit that, then iterate to a JS version using ajax or flask controls)
 
Something like that, but you've bitten off a lot. See my previous message. It's a decent first-pass if you can get that working
 
6:01 PM
@holdenweb I will keep it in mind just trying to keep the separator between cheating and not seems a very fine line as to whats ok and not ok in this field
@roganjosh I may try that first and read up on pagination and more on Javascript and come back to improve it
 
You still need pagination to make that first-pass work, but at least you can tie the "give me more data" event to a button, and not scrolling. Plenty of reading to do. Good luck :)
 
^ you need pagination but not dynamic pagination (hence, its the "first step")
 
ok I see i see ok time to go find some source of pagination for beginners ^^ thanks guys
 
rubber ducky :)
 
Was it python-related? Or just DNS woes?
 
6:08 PM
just dns :P But well where else to ask, all other chats I have ever been to on SO are dead, and plus the pros are here :P
 
Python pros are usually not network administration pros. Hint: chat.stackexchange.com
 
ah well many people in here wear many hats I think. But damn using bind correctly is hard :P
 
I don't know if server fault has an active chatroom, but a lot of technical sites do
 
why dont you try kiwi node IRC?
 
@Hakaishin Server Fault does not - got annoyed with every newcomer treating it as "live support"; Super User has a lot of active chatters though (network hardware questions would be on topic but read their rules beforehand)
 
6:17 PM
Just gave my first "thanks". I feel empowered.
 
yeah I checked server fault from time to time, but people check that channel every 24h
 
@roganjosh ew
 
SuperUser even has their own doggy mod ;)
 
@AndrasDeak It was to LinkBerest but shhhh :P He's not allowed to know
 
I have no intention of normalizing that facebook yam
 
6:19 PM
@roganjosh honestly I just hope that OP accepts it so I can use that as a dupe for the other questions which pop up from time to time with that issue
 
Calcatron predicts 5% probability
 
ah, that's good odds compared to my estimated .000000001%
@roganjosh lol - the thanks is public (its in the timeline)
 
@roganjosh that ^
@LinkBerest I don't think you need an accept for a dupe target, just positive score
 
hmm...might be remembering it wrong then. Also: yeah! dupe target added to my "how do I scrape X" list :)
 
Oh poop, I forgot about the timeline. I'm also tempted to remove it if it's gonna be part of their stat collection
 
6:24 PM
@Kwsswart If you use it to pass an exam, it's cheating. If you need it for work, it's acceptable. If you use it to lear, go you!
 
feel free - I blocked the thanks so I don't see it either way
@holdenweb If you use it for work and understand what its doing, it's acceptable
minor key point from a guy who fixes security holes a lot ;)
 
@Kwsswart From a first skim I'd definitely recommend moesif.com/blog/technical/api-design/… as an exposition of the principles. Also be aware there are standards which are already implemented, but for learning by all means write your own.
 
lol, I love that comic
 
@LinkBerest Absolutely a fair point. I forget sometimes not everyone here is a pro.
 
6:34 PM
@roganjosh honestly the only thing I'm looking to add to that (per your comment) is the article Google put out saying they removed the workaround through Oauth using GooglePlus to login. After the personal version was shutdown in 2019. Now it takes a Gsuite or API - no workaround - I still remember everything breaking - or at least the 5am call about it.
@holdenweb oh, how I wish pros didn't do that (I'm only going to use this to make the deadline - we'll fix it in the next iteration are famous last words) :P ;)
 
@LinkBerest I don't think there's anything to add tbh. They broke everything with their googlesheets too when they shifted their authorisation and it broke my code too (but back then, it just broke gspread for me and it stopped my ghetto front-end :P)
 
Eh, if I find it I'll add it but I'm not looking that hard (its just why I said 2016 - that's when I remember things starting to break)
 
I'm not expecting you to so don't do it for me :) I remember it breaking and really I was being a bit silly to see if you correlated the "thanks" with the comment, forgetting that they show in the timeline
 
nedbatchelder.com/blog/201803/…. Can someone confirm if I understood it right that the python that I use(3.8) it's code first gets compiled to bytecode (by a c compiler) (eg. 0 SETUP_LOOP 28 (to 30)) and then those cpu instructions those are generated are converted to machine code(by c again)(eg., 011010...)?
Adding There's also pypy which instead of a c uses a JIT(Just in time compiler) which is written in java
 
7:01 PM
cbg all
 
7:48 PM
@VisheshMangla almost. bytecode compilation happens by a Python compiler, and the instructions are directly executed by the Python VM. Both are written in C (in the case of CPython) but do not have an intermediate C representation.
@VisheshMangla PyPy is written in RPython, which is compiled to machine code (via an intermediary C representation). It is not written in or related to Java.
 
8:18 PM
@Kevin I was going to say that hashes of datetimes are also salted, but I just learned that's been changed in recent versions. See bugs.python.org/issue29535
 
8:28 PM
@NabiShaikh As others said, that code does a few questionable things, so be cautious of trusting the judgment of the person who wrote it. Python's built-in hash() may be ok for what you're doing, but it isn't a great general-purpose (non-cryptographic) hash.
It's quite fast, and it works well enough for its intended purpose: hashing keys for the Python objects that use hash tables: dicts & sets. But be aware that the dict & set algorithms compensate for the fact that hash may produce lots of hash collisions.
@NabiShaikh Also,
Mar 12 '19 at 20:06, by PM 2Ring
@Rick One measure of checksum and hash functions is the avalanche effect. I wrote a little bit about that stuff in here several months ago: https://chat.stackoverflow.com/transcript/6?m=43508803#43508803
 
@PM2Ring don't the dict and set implementations take hashes modulo some internal buffer size? That would make collisions a lot more common by design.
unless I still misunderstand how hash tables work
 
@VisheshMangla Just in case MisterMiyagi's answer wasn't totally clear for you, Python bytecode is not the same as your CPU's machine code. It's a fairly low-level language, but not as low as true machine code. Python bytecode runs on a program which is a "virtual CPU".
@AndrasDeak They do use modulus, but it doesn't matter. You can read the comments (by Raymond Hettinger) from here: github.com/python/cpython/blob/…
> Major subtleties ahead: Most hash schemes depend on having a "good" hash function, in the sense of simulating randomness. Python doesn't
 
@PM2Ring I see, thanks
 
No worries.
 
9:03 PM
Can we flag a user who keeps asking questions and does not care to accept any answers? To justify my question I have seen him with 23 questions, many of them are answered with one or two upvotes which seems to be correct. But he hasn't accepted any one of them. I was very skeptical in answering but in the end I did it anyway.
 
Nope, that's not a flaggable offense
 
@neferpitou Did you link them to the What should I do when someone answers my question? help page?
 
@PM2Ring wow, those comments are comprehensive. I'd like to know his process to arrive at those conclusions, that's super neat.
 
@neferpitou just let it go
 
@MisterMiyagi From now on I will do :)
@AndrasDeak seems like this is going to be my new fav for now :P
 
9:15 PM
@neferpitou you shouldn't be answering for an accept anyway
 
ok, I get the point that JIT compiler is not specific to Java.I guess a compiler is rather an algorithm/technique/ method.
 
@VisheshMangla Did you read the wikipedia page on JITs? It's a good idea to try and get an overview of the topic, even if you don't understand everything.
 
@PM2Ring this "Python bytecode is not the same as your CPU's machine code" is clear to me.It's only the links that I need to grab. Python 3.8 ->vm converts code to bytecode->c code converts to machine code
 
It will at least give you an idea about the general category a thing falls into. E.g. JITs not being exclusive to Java.
 
I did it a few months ago. Not only wikipedia but a few more. I was trying to understand numba . Let me refresh my memory
 
9:20 PM
The accept answer button could be more clear & noticeable (instead we get "jazz hands!")
 
On second review of the other posts, it's not worth the prompt tbh. Most are unanswered
Closed, thanks
 
For those of you who use flake8, is there a way you can ask it to auto format for you?
I looked through the documentation and couldn't find anything myself.
 
9:38 PM
@AndrasDeak Yes sir, these days I am learning more by answering :)
 
@qaispak flake8 is only a linter, not a formatter
black has recently gained traction as a formatter.
 
@MisterMiyagi, thanks that makes sense.
I'm using both.
 
9:52 PM
@cs95 Bear in mind that "the table load factor is kept under 2/3", so even with a bad hash function the probability of a collision isn't that high.
@VisheshMangla Im not totally clear on what you're trying to say there, but the bytecode program is not translated into a CPU machine code program.
 
 
2 hours later…
11:33 PM
Really wish folks would post their data without unnecessary borders, underlines or table formatting. I don't want to clean up your text before pd.read_clipboarding it, damnit!
 
I've never really understood why people don't post a self-building DF with a dictionary containing a bunch of lists. I'd even overlook the PEP8 violations, just to be able to c/p it into my editor and run.
 
same reason why any other kind of debugging problem is often unaccompanied by an MCVE
(i.e. ignorance)
 
There's so many cases where the OP does something when presenting their table format and it screws up read_clipboard for me; I've just given up if it doesn't work first-time
 
But coming up with a reproducible example is hardddd
 
So true. Apologies. My distress faffing with the broken data is trivial in comparison :P
 
11:53 PM
You're the expert, figure it out
 
Tangentially, I feel we've had a lot fewer numpy/pandas questions of late in the room. Is it just me? Most seem to be general (or obscure) OOP, and web frameworks
 
00:00 - 15:0015:00 - 00:00

« first day (3546 days earlier)      last day (1387 days later) »