« first day (2909 days earlier)      last day (2032 days later) » 
00:00 - 19:0019:00 - 00:00

12:44 AM
 
 
4 hours later…
4:48 AM
Hi
i have issue with module import pycrfsuite
pycharm is saying no module name ...
@shad0w_wa1k3r can you please help me in this
 
5:23 AM
@sunil why are you pinging him out of the blue? That's not nice. Whoever can and wants to will answer. Don't harass users.
 
5:59 AM
I am sorry
We had dicussion in past and hence i mentioned him
 
It's OK
 
I wish people would include more diagnostic information in their questions than "it's spitting out this error"...
 
Can you import that module outside pycharm, directly in python? If no, it's unrelated to pycharm and you have to install the module
 
@sunil Have you installed that module? Does it work outside of pycharm? Do you have multiple python versions installed?
 
6:41 AM
@AndrasDeak Cool! I just had a look at the code... My Python coding style has improved a little since 2011. :) I've converted the program to Python 3, but there are a couple of mysterious lines that could do with better commenting which I'm currently trying to decipher. It's not a big program, but I would like to make it a little more readable. The majority of the variable names are one or two characters. :oops:
In the mean time, here's the original article that I used to extrapolate my code from. craftster.org/forum/index.php?topic=341241.0 As you can see, the crocheted spheres look pretty good.
 
6:55 AM
This list slicing question was closed as a duplicate of a more broad question that includes slicing generators. Is it worth reopening, or is the question too useless to matter?
 
@Aran-Fey The dupe target is too broad, but I guess it's nice to mention islice. I don't think it's worth re-opening, and it already has adequate answers of its own. FWIW, the OP is still active.
 
cabbage to isle 6, cabbage to isle 6
 
7:25 AM
Thanks for the shoe suggestions, folks. I've settled on a pair of Nike runners
The product is Nike Free RN Motion Flyknit. I quite like the sleek design and the ankle support.
 
@Aran-Fey closed
 
8:02 AM
cbg
 
stackoverflow.com/questions/6305061/get-an-object-attribute unclear. If the question is about dynamic attribute access, there's a better question about that topic. If it's about static attribute access, it should never have existed.
 
@Aran-Fey Hammered. That's definitely about dynamic attribute access. Not that I've ever done much PHP, but I have done a little bit.
 
fair enough
 
8:48 AM
I have absolutely no idea how to do this, and therefore don't know where to ask, so I'll just try here and see if anyone has any ideas.
We have (IMO) too few Autocad licenses at my work, so I have to just randomly try to open it and wait for someone to close their session. This is obviously slightly annoying. Is there a way to send a request to the license server every 5 minutes or so, to check if there's an available license, without actually opening Autocad?
 
@StewieGriffin You could check if they have an web API or something, there are a couple Autocad python libraries out there, but I'm not sure / confident if they might have something like this built-in.
And then there's GUI automation that may try, so that at least it's automated, instead of manual checks. Not so sure about that as well.
 
Dilemma: the tag description sounds like it's a Java-specific thing, and the tag description specifically says "annotations are things that can't be expressed by the type system", so neither is really a good fit for python's type annotations
 
9:08 AM
@shad0w_wa1k3r Thanks! I'll give it a try. I guess I must have Autocad open for this to work though, and that's the problem :/
 
For the GUI, yep (although it can open it for you, if not already open). For the other thing, perhaps not.
 
@RobertGrant would you agree that the ACL/Auth/whatever was 1 reason why you didn't stay with Pyramid :?
 
hello all ...
anyone ever tried doing unit testing in eclipse with PyDev plugin in Windows?
I am stuck with not able to run any python unit test
asked detailed question here:
1
Q: Python unit tests are not running at all

anirI am first time trying out python unit tests referring to this article. I have PyDev plugin installed in my Eclipse. My test_hello.py looks like this: import unittest class TestHello(unittest.TestCase): def test_abc(self): print("Test!!!") result = True self.assertE...

 
9:35 AM
I'm expecting the comments here to turn into a Python version of Who's on First any moment now...
 
I was so confused :/ Originally, they defined the function below the for loop so I guessed there may be an issue. Then they edited that, leaving nothing left
 
Aaaaand, it's gone. I was about to link a LMGIFY
 
10:04 AM
^ closed. Thanks.
 
cbg all
 
cbg
 
10:22 AM
@user2357112 aaaarghh, yes! I forgot about that didn't I. I now added it to my proper TODO backlog. Do keep poking me, that's important.
@davidism: remind me where the Werkzeug asyncio discussion is taking place? I found vorpus.org/blog/… and a lot of the exposition there is important background info for anyone attempting to write fundamental asyncio-based libraries.
 
10:59 AM
something wrong with my code here ,please help me
 
@AkhilAlexander Hi Akhil. Please note that the forum rules suggest that longer blocks of code should be pasted into something like a pastebin and linked to in this room. It will also be easier for you to keep the code formatting to help with readability
 
r_data is a dictionary? You will need {% for pic,name in r_data.items() %}
@AkhilAlexander the error in the second example doesn't make sense to me. Did you change the name of the output variable from your views function?
 
11:22 AM
@roganjosh i did try this...but the error is same,I am using python 2.7
 
But the errors are not related. You can't go from ValueError to a name error in Jinja2 without changing something in your python-side views function
 
11:40 AM
@roganjosh i put the cropped image and corresponding name in different loops , but my result repeating the same image multiple times
 
I don't agree that this should be put on hold: the OP posted code several minutes before the last vote was cast: stackoverflow.com/questions/52625673/… But they got a useful answer, so I guess there's no need to re-open it.
 
@AkhilAlexander I'm not clear on how that relates to what I said? Currently we're looking at sections of your code that have been chopped out. An MCVE and traceback will remove ambiguity here because I think you're misunderstanding what I was trying to say
 
@PM2Ring necessity != correctness. +1 for reopening.
 
12:07 PM
@vash_the_stampede How about [u==v for u, v in zip(*list1)] ?
 
@PM2Ring did Op mention what comparisons he was trying to do with the pairs once he got them?
I didnt evne notice
I thought he just needed to have the pairs connected to do some evaluations
 
@vash_the_stampede No they didn't, which is rather annoying.
 
yeah thats why i just left it at the pairs and said to use i[0] and i[1]
 
Fair enough. And the ninja is now on the case.
 
haha you should have seen what this OP was asking for yesterday request after request, after he was put on hold I solved his problem like 3 steps deeper than question, no accepted answer smh YAM
Yeah I see the ninjas comment I have an answer @PM2Ring
 
12:17 PM
@vash_the_stampede I disagree with Martijn's comment. The OP's real question is how to compare the sublists.
 
@PM2Ring I stand by my solution and thanks for the backup haha
@PM2Ring I think OP just confused everyone with his failed attempt to create a way to compare elements of both lists, makes it appear as if he wants some list of all elements as independent lists, he just is confused I believe
hahah OP just confirmed it ahhahaha
 
Yes he's confused. This is what's known as an XY problem. He really wants to do the comparison (X), but he's got a crazy theory that he needs to do that list-wrapping stuff (Y) in order to do the comparison.
 
Yeah he commented beneath me and martin and confirmed our assumption, rendering martin's downvote blah
 
"cant use zipping for this project" Grrr. Why didn't he say that in the question? I hate questions with stupid restrictions like that, especially when the OP doesn't bother stating them from the outset, but only reveals them drip by drip.
I mean, I understand teachers placing such restrictions when they're trying to teach a specific concept, but it gets yamming annoying when you post a nice Pythonic answer, and the OP keeps adding extra conditions that invalidate your code.
 
yeah stupid but now martin upset at OP but not taking back his downvote lol he judged my post on his missinterpretation of OP , where I interpreted it properly ... hmmm
@PM2Ring just formed the tuples with list comprehension isntead
 
12:32 PM
The whole 1 line of the question
 
@vash_the_stampede Sure.
 
Some people just suck :/
 
stackoverflow.com/questions/52623789/… @PM2Ring was gonna work on this keep putting it off
 
Well, at least they toned down their comment now. It's a start.
 
12:36 PM
haha martin got snarky when I asked to take his downvote back , I countered by upvoting his snarky comment hahaha
 
Need another set of eyes and a relatively fresh mind on stackoverflow.com/review/low-quality-posts/21026567 (LQP review queue)
(relatively fresh brain, OMG...)
 
@vash_the_stampede I remember seeing a very similar question a few weeks ago. I guess it could be a common homework assignment. I don't blame you for putting it off, it's a stupid problem. :)
 
@shad0w_wa1k3r Definitely looks like an answer.
 
thanks
 
@PM2Ring how would you approach this, I know there has to be a simpler way, my solution works but I feel im doing too much
 
12:42 PM
@shad0w_wa1k3r It's not great, but it's an answer.
 
that's what I thought, LQP review queue is a bit tricky at times, and sadly some answers may face the axe for it.
and thanks
I did ping one of the 5k rep user who voted to delete, they removed their comment, so hopefully they do better reviews henceforth.
 
@vash_the_stampede It's a messy problem. I think using Counter to identify dupes is good. And then I'd use itertools.groupby to identify groups of identical items. And you can copy the keys of the Counter to a set so that you can test if a replacement number is ok. You can't use the Counter itself, because you need to update that set with each replacement number.
stackoverflow.com/questions/52625673/… Still needs 1 vote. The existing answer is ok, but he didn't explain why the OP's code fails. And he's using type instead of isinstance.
 
@PM2Ring okay but either way its going to be multiple steps, I was just making sure there wasnt a 1 or two line solution i was missing , and i was mentioning this question stackoverflow.com/a/52617780/10255652 not that homeowrk one forgot to paste link
 
@vash_the_stampede That's another messy one. But yeah, you're current approach does too much work. Let me think about it...
b = [[1,2,3], [1,2], [3,5], [2,3,4], [2,3,4], [3,4,5], [1,2,4,6,7]]
result = []
for u in sorted(map(set, b), key=len, reverse=True):
    if not any(u <= v for v in result):
        result.append(u)
print(result)
 
1:03 PM
ty saving that for later use
 
It's annoying because he's using lists instead of sets. And I suppose he probably wants to preserve the orders of the b list. But that's easy to fix with a final pass.
 
@vash_the_stampede I'm working on an idea for this which I hope will reduce the complexity
Hopefully can finish it before the end of lunch :)
 
haha @roganjosh it looks fun was I have it left open in my tab for sometime today
 
The code will be just as long, if not longer with my approach but I'm shooting for timings. Then again, I might just be imagining I have a faster solution. Tense times.
 
I'm going to hit 2k rep today I might take the day off after I do , 44 days 311 answers 2k rep , sounds I'm going to relax and celebrate
 
1:10 PM
@vash_the_stampede I might post it myself. ;)
Done. :)
@roganjosh Good luck!
 
Almost sussed it I think :)
 
cbg
 
@vash_the_stampede it's Martijn, not Martin. Count the letters
 
@AndrasDeak Martin is slang for Martijn
 
Gah, it's that last 27 in the list that I'm faffing with, the rest of the idea worked how I wanted
 
1:23 PM
very nice @PM2Ring always enjoy your methods I learn every time
@roganjosh hahaha hate when that happens
 
@vash_the_stampede Thanks!
 
@roganjosh I'm starting it now, lets see ....
 
\o cbg
 
Im going to enumerate and then group doubles and tell if they are consecutive using indexes from the min index O.o something like that
 
Fixed the part I was fiddling with and now up to 31 lines of code. A big chunk of that handling the last value without increasing the time complexity
cbg Mooing
Gotcha. Now time to set up some timings. I bet after all this it will be no faster :P
 
1:37 PM
@roganjosh Just posted a groupby solution
 
After all that; typo, recursively extending a list into itself and blew the laptop lol
Waiting for it to reboot then can do some decent timings
Probably we had similar thinking but groupby wasn't my first choice, it's probably led you to a much more elegant looking solution
 
Iterators often tend to make rather elegant solutions, yeah :)
 
Sam
Would it be stupid of me to attempt to secure my APIs using libraries such as flask-jwt-extended instead of using some paid, off-the-shelf solution such as OAuth? In your professional opinions..
 
@Aran-Fey you've beaten me on timings so I won't post my answer since the code is like some swamp monster.
%timeit aran(sample)
2.28 ms ± 25.4 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
%timeit my_approach(sample)
3.86 ms ± 68.6 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
But there's an issue comparing to the original approach, I need to figure out how to push it through timeit
 
The OP's solution modifies the input list, so that's probably why
 
1:52 PM
d = {}
for idx, item in enumerate(l):
if l.count(item) > 1:
if item not in d:
d[item] = [idx]
else:
d[item].append(idx)

for k, v in d.items():
for i in v:
i started it this is where im at Igot all the indexes for the doubels hahah now the hard part
 
All the big block at the beginning of the for loop to catch the last index for the lone 27 :/ pastebin.com/tXhiyxti
 
@roganjosh is that facebook sourcecode?
hahaha
 
My issue was starting with the defaultdict
I may actually have been better looking backwards rather than +1 but that really just pushes the problem to the start of the loop which is kinda cheating
@vash_the_stampede laugh all you wish, it's still 57 times faster than the approach by Rakesh and that's on a list of 4000 numbers :P
 
hahahah I know i kid i kid :)
 
I've upped the test size. Mine took 1 sec to complete. I have a feeling I will have to give up on testing Rakesh's at this scale :P We're already at the 3 min mark
 
jpp
2:01 PM
stackoverflow.com/questions/52628370/… Dup (reopened by someone seconds after I closed it!)
 
its tricky altering the numbers pproperly
gonna take a break
rhubarb
 
@vash_the_stampede see sopython.com/wiki/…
 
@shad0w_wa1k3r does my vote count?
 
2:15 PM
No, you need 3k rep (or more) to vote to reopen (you can't vote)
 
Why is there no "reopen" flag? Does casting a reopen vote automatically put the question into the reopen queue?
(There is a reopen queue, right?)
 
@Aran-Fey yup
I imagine reopen flags would be rare in nature, why bother
 
@Aran-Fey I think it is to avoid spam from those whose questions have been closed
and ^^
 
2:26 PM
cbg
I just had a lot lettuce XD
 
@shad0w_wa1k3r opened finally :) cc @PM2Ring
 
How do you tell someone that almost everything that they think they know about classes is plain wrong? stackoverflow.com/questions/52629288/…
 
It's a very lazy day :-| I had the weirdest dream last night. I wanted to buy cigarettes and the labels were "requests" "OpenCV" and "Click" then for some reason I thought "click" was menthol and I bought it :-|
 
@shad0w_wa1k3r Yay!
 
jpp
Anyone have advice on what to do when your dup-closing is immediately (or shortly afterwards) reversed by another gold badge holder without comment? It's happening repeatedly with the same person (you can guess who).
Dup-finding is time-consuming and I don't like it when it's not appreciated / reversed without comment.
 
2:33 PM
@jpp complain on meta as always
 
@jpp Comment on the question, then after repeated behaviour (without satisfactory response in comments), post to meta.
 
@PM2Ring by giving them a link to this?
 
jpp
@shad0w_wa1k3r, That's fair, I'll comment and see if it works.
 
@PM2Ring oof, couple of answers on that... :/
 
Why didn't I guess? The OP is using LPTHW. I better post my standard comment...
 
jpp
2:36 PM
@AndrasDeak, I'd rather not bring to Meta if it can be avoided. Because it's only one individual and I don't want to turn this into a me vs him/her. There's no flag for this, so going to comment and, if no response, keep a log + bring to Meta.
 
@jpp Well, there's no other option you have. And I think this has already been on meta in the past, you may want to dig a little.
 
@PM2Ring what's LPTHW :-| I'd better go back to sleep!
 
Sounds like a recurring thing, I thought you tried talking already
 
@PM2Ring wth is that
 
2:39 PM
Learn Python the Hard Way
 
its making my head hurt
 
@roganjosh literally :-p
 
I've read parts of LPTHW but that right there is wild
lol
 
Hey, I'm a survivor of the course, and my attempt at that last question was undeniably elegant coding :P
 
ugh, never read that. I went with the university library instead. Does this also have a theme like those books "learn blahblah in 21 days?"
I always hated them. You cannot "Learn" a programming language in 21 days
 
2:41 PM
no idea, lucky to have been learning from the docs, official tutorial and Udacity + SO
 
... Im on day 44 I think you can :)
atleast a bit
 
@NasrinShirali I think I linked this before, but again norvig.com/21-days.html
 
@AndrasDeak that link, hilarious
 
@vash_the_stampede if you can do something it's great and shows you being very intelligent, but those books spread the mindset that anyone can learn a programming language in 21 days which is clearly wrong. It's almost like beauty products, wear this and everyone will love you!
 
Haha keto!
 
2:45 PM
@Aran-Fey i have two version of python and it is working outside the pycharm
 
17 hours ago, by Andras Deak
@Mirv this is not the first time, so: are you aware you can post directed replies to chat messages? Like the one I just posted. These make it much easier to understand context.
 
Conversely, I think the Flask Mega Tutorial is probably one of the best I've followed
 
@shad0w_wa1k3r ? related?
 
@vash_the_stampede yeah, couple of your previous replies might not link the previous comment correctly, so hard to follow, even for the one who was pinged.
 
@vash_the_stampede Many moons ago, we noticed that every now & again we'd get odd questions from people who had some strange ideas about Python & about how to approach coding. Of course it's to be expected that some people will develop strange notions, especially if they're teaching themself.
But rather than just random weirdness we noticed this consistent pattern of shared weirdness, like they were from a bizarre parallel universe, with different Python syntax. And different laws of logic. Eventually, a pattern emerged: these people were all learning from Learn Python The Hard Way!
 
2:48 PM
17 hours ago, by Andras Deak
There's a "reply to this message" option in the context menu of messages here in chat and in the transcript‌​. The starboard is the exception where this is missing, but you can copy the message URL and put the colon and the ID in front of the message manually to get the directed reply
 
@sunil Does it work in both python versions? Does PyCharm use a virtualenv?
 
jpp
Soon there'll be Learn Python the SO way. The world where variables are called list and dict - just for fun!
 
@Aran-Fey
no
 
Don't forget the if loops and broken for loops
 
it does not work for python 2
 
2:49 PM
And you're sure PyCharm is using python 3?
 
Ihaha thats insane! I think I learned most from here trying to keep up with everyone
 
rbrb, back to learning JS (the right way :-p )
 
didnt know that book was that bad I read a few chapters and stopped, I read the entire PCC book
but Stack is the best
hands down
 
@Aran-Fey yes
 
Well, then the only reason I can think of is that PyCharm uses a virtualenv where that module isn't installed
But virtualenvs are way outside of my area of expertise
 
2:52 PM
PyCharm uses its own virtual environment and each time you want a module you need to install it (per project)
That's what I am doing and I might not be doing it correctly
but everytime I need a module, for a new project, I need to install it again
previously I was using vim. Way easier! :-P
 
The general recommendation (which I never follow myself) is to have a separate virtualenv for each of your projects so that your dependencies are clean and don't conflict. You can install packages globally into a system interpreter instead, and you can point PyCharm to use that interpreter instead of a virtualenv.
 
does that then make it do that "indexing" more?
it literally takes minutes for it to stop that, and my laptop is super old
 
Yes, when you switch interpreters it will update indices
 
that's so annoying :-(
 
Well, I posted an answer to that hierarchical dictionary parsing question. I don't expect to (or want to) win the "accept", but hopefully the OP (& perhaps some future readers) will get some benefit from it.
 
3:06 PM
@AnttiHaapala yeah, I struggled
 
cbg
 
There was a classic question an hour ago: Which one is best python or pycharm? (10k+) It was short, so I can quote it here in full: "In coding which version is good for easy coding python with version 3.7 or pycharm?"
 
ah yes, pycharm, the new language that will replace python
I keep forgetting about that one
 
Phyton will replace Python
 
3:12 PM
When you ask a question like that in Texas people will say "Bless your heart.."
 
But the oddest one I saw today had a class where the __init__ method was defined inside a for loop.
 
If anyone says that to you punch them in the face, metaphorically of course
 
@W.Dodge If you're going to put someone down, it's nice to be polite about it. :)
 
@PM2Ring and I really have no room to talk... lol
 
3:26 PM
@PM2Ring lol, seriously?
 
I'm trying to make a Flask template app to use as a starting point in my projects and it's become a full project itself. Every time I get one thing in, "oh, better add a copy/pastable function for pagination. Yeah, I better throw some email support in there too" :/
 
Inb4 you accidentally have a full CRM template
 
This is exactly the way it's going :/
 
thankfully, to the wasteland of unfinished frameworks, a fine addition this might not be ;)
 
IT needs to hurry up and send me the data I need so I can get back to my actual current project
True, and it's reinforcing it in my head along the way anyway. There are other templates available, but I kinda think that's cheating when I could use it as a learning exercise
 
jpp
3:34 PM
@PM2Ring, Shouldn't we keep that question open for canonicals / pointing out the obvious?
If I'm not mistaken, it's not the first time "I did this in PyCharm but PyCharm doesn't like this..." has happened.
 
@jpp I close-voted, but the OP self-deleted. You can't actually use rubbish like that as a dupe target: it has to have at least one answer. The exception to that rule is if the OP posts a dupe of their own closed question.
@jpp There are numerous questions tagged Pycharm where the fact that the OP is using Pycharm is completely irrelevant. Eg, stackoverflow.com/questions/52624391/…
 
I never thought this would ever happen to me, but I just fixed a test case by adding a time.sleep(0.01)
Apparently Path.touch doesn't bother updating the ctime if you call it twice in a row too quickly ¯\_(ツ)_/¯
 
jpp
@PM2Ring, Fair enough. Yep, I have no doubt PyCharm has been misused throughout. It would be nice to have a canonical link to post to about "language vs IDE" (this could be a cross-language one). Likewise about shadowing built-ins, I haven't found an all-encompassing canonical.
So instead of typing I can just Ctrl+C, Ctrl+V in comments.
 
@jpp Oh, ok. Yes, it can be good to link to stuff without actually dupe-hammering. Especially if the question is something that we really don't want to keep.
And regarding shadowing built-ins, that's often an incidental issue to the OP's main problem, so a shadowing canonical is rarely going to be used as a dupe target. And it would be useful to link to it in a comment on answers that shadow built-ins.
@jpp BTW, there are browser userscripts to simplify posting common comments, eg gist.github.com/kms70847/b600792c78b0790c3c4d
 
jpp
3:56 PM
@PM2Ring, Thanks, will have a look. And yes, this is only for comments really. I feel it happens every other post.
 
wim
TIL, have been mispronouncing Huygens all my life.
@Aran-Fey never add time.sleep to a test.
instead you want this: install pytest-freezegun, inject the freezer fixture and use the freezer.tick method.
 
'morning cabbage
anyone hiring right now? I have suddenly found myself in need of gainful employment. I guess that's the risk of working at a startup :(
 
@wim Would that even work? Does Path.touch use any of the mocked functions?
I could rewrite the test to manually set the ctime, I guess
 
4:15 PM
Random question popped into my head. Is there any consideration to be made regarding storage location of login hashes? For example, is there any benefit to be had by keeping them in an entirely separate database to the app data?
 
@roganjosh you mean for the passwords?
 
The app database clearly has a larger surface area so seems more likely to be breached by some loophole, but the passwords would still be hashed. Or would they likely focus on hacking via the login/authentication mechanism, which means it was wasted effort?
 
Not much benefit to keeping them in a separate db. I mean there's some, because in theory you could ultra-harden that server, but if you're properly salted & hashed then there's not a lot of risk to letting those be compromised with the rest of your database
 
@shad0w_wa1k3r Lost the LQP review battle (2 Looks ok vs 4 Recommend Deletion) :( cc @PM2Ring
 
it's possible that it mitigates some risk, but it probably introduces roughly as much as it mitigates shrugs
 
4:20 PM
For what it's worth, the answer wasn't that great anyway, plus other answers look better.
 
@shad0w_wa1k3r Oh well. We tried.
 
That was kinda my thinking. Thanks
 
cabbage
 
Cbg
 
I recently read a SO Meta post (maybe linked here by Andras) saying that it's not the job of the LQP review to delete technically incorrect answers, or answers that don't have much value. If the answer has zero useful content, or it's just plain incomprehensible, then sure, nuke it. Otherwise, let the voting process take care of it.
 
wim
4:26 PM
@roganjosh no benefit
 
@PM2Ring yep, that's what I read (and initially felt right), and that's why I posted that one here.
I get to work only when the red dot pops up on some review queue...
 
@wim Yeah, was just one of those things where I figured I might be missing some theory so shouldnt just rule it out offhand :)
 
wim
not sure if crossword or sudoku..
 
So my meta.SE custom comments not needed flag has been pending for 3 days now, huh. SO flags get worked at pretty quick (~2-4 hours max)
 
wim
@Aran-Fey Yes, it should work. It's not the end of the world to have time.sleep calls in your test suite, but it's definitely a code smell.
 
4:38 PM
Anyone have a good beginners' tutorial for mocking in (python) tests?
 
wim
you could watch Martijn's pycon talk, posted in here recently, that was beginner level.
 
yeah, watched that. went right over my head :|
 
wim
oh.
I can help if you have more targeted questions
 
In my defence, the talk was how not to mock :-p
 
Sam
I've just written a unit test for an end point I've made but I'm a little unsure how I can pass a bearer token along with the request? The current unit test for unauthorized access looks like
 
4:42 PM
@wim thanks, but I'll just dig a little more
 
Sam
res = self.client().get('/auth/secret')
self.assertEqual(res.status_code, 401)
 
can't have targeted questions at a beginner level I suppose
 
@wim Ugh, that's annoying to solve. Why did they have to rotate the text on the bottom a different way than the text on the top...?
 
wim
@Aran-Fey text rotation seems correct/best to me. I printed out the page and rotate it 2*pi/3 rad turns, the text is always upright and horizontal on the left side of the page.
 
If the text on top were mirrored, then I could just rotate the whole puzzle 90 degrees clockwise and be able to read everything
 
wim
4:47 PM
true
but that would have broken symmetry, and have less mathematical beauty :P
 
There are multiple valid solutions, right?
Actually, maybe there aren't. Made a mistake.
 
5:03 PM
Recbg
 
cbg-re antti
 
Sam
Thanks I'll take a look now.
 
according to the docs "As of 2015, it is believed that 32 bytes (256 bits) of randomness is sufficient for the typical use-case expected for the secrets module." ... is this still the case?
is 32 still secure enough, you think?
 
I bet there's a resource on the Internet somewhere
 
@WayneWerner you mean for my question? I know there is, I just wanted to know what others thought. Just a random question :-)
 
wim
5:21 PM
@NasrinShirali yes.
 
@wim I asked this once, and someone in our class said nothing was secure enough for them. a few days ago chrome asked me if I wanted it to just come up with a password and store it for me, so I was thinking about how secure passwords can be
I clicked on "yes" of course!
 
Sam
@NasrinShirali That seemed to work I think.. now instead of failing my assertion fails xD
 
@wim I think I made a mistake. Is there a way to validate my partial solution?
 
@Sam so you're expecting your status to be that? Anyway, that's a good sign, you can print everything and check then. "requests" is so well documented, I really like it.
 
Sam
Nope wasn't expected my status to be that, but that means I've found an issue with the code :D
I went with a slight variation than using requests but works the same :)
I used json.loads(result.data.decode())['access token']
 
5:35 PM
Aren't you asserting the equality of your status code with 401?
 
Sam
Nope. I'm making a unit test for a secured end point so my unit test consists of registering a user, logging them in, extracting the bearer token, and trying to access said end point with the token
 
self.assertEqual(res.status_code, 401) I thought here you're asserting the return code to be 401.
 
Sam
Ah that was the example for an unauthorised access. Sorry, my bad. The next unit test asserts an authorized access.
 
wim
5:50 PM
@Aran-Fey I'm lacking context here
are you talking about the regex sudoku
 
yeah
I'm about halfway done, so if there's a mistake... I'd be wasting a lot of time
 
wim
@NasrinShirali brute-forcing a 256 bit key takes something like a gadzillion years
crypto vulnerabilities generally come from bugs in implementation, not brute force
@Aran-Fey dunno sorry, didn't get a chance to solve it myself yet
 
"i need coin change result likes (minimum coin, counter, [coin change list]) if input=63 (3, XXXXX, [21, 21, 21] please complete 'make_change', here are main code and testcode" - OP
 
airport-lounge-cbg
@NasrinShirali yes
128 bits is secure enough that you cannot guess one in 2¹²⁸ but... you can have a collision under extreme cases.
256 is way over...
 
6:23 PM
@AnttiHaapala and @wim Yes, that was what our professor said. I think my classmate was referring to what @wim also said, about the bugs in the implementation.
 
the 128, 160 bit hashes might not be that secure atm... (older of them)
FWIW, 256 bits is an overkill for most purposes - certainly it is enough for any single use where you don't know whether 256 is enough ...
 
wim
ooh, presidential alert
 
wat? :D
@wim I guess I am one of todays lucky 10kers
451 Unavailable For Legal Reasons
Sorry, this content is not available in your region.
 
@PM2Ring oooh that looks awesome! Can't wait to test your program :)
@wim I learned that in high school, though not from teachers
 
@wim also, it is enough here if one can pronounce Martijn!
 
6:32 PM
@AndrasDeak oh, man. There's a new user that would totally snare me in my own serial downvoting heuristic. I concede on our debate a couple of days ago where I said it should be a mark on your account.
 
Welcome to the path of light
 
@AnttiHaapala What's a 10kers ?
 
@IMCoins you're one of today's lucky 10k.
 
(cbg)
 
xkcd diet coke mentos
 
6:33 PM
But it's so dark:/ the tag is being blitzed right now
 
The path of ew
 
I learnt about diet coke + mentos last millennium or so
 
The same guy that vash is feeding?
 
Oh, I've just popped into chat on my phone making it extra hard to navigate. I've not seen a vash comment so far
 
Or an answerer
 
6:35 PM
Answerer
 
The one I had in mind is a serial asker
 
im about to jump off a cliff
 
@wim my solution, if you want to have something to compare yours to
 
Hello / cabbage :)
 
6:43 PM
whoa... now it happened...
 
wim
it's the POTUS new channel for cyberbullying. so long, twitter.
 
the random downvote on a correct solution
sihg
 
finally... I wrote an elif clause and realized:
"PEP 572 would have saved me some keystrokes"
 
@AndrasDeak seriously... stackoverflow.com/a/52633787/4799172
Literally blasting out answers all over
 
@AnttiHaapala Isn't saving keystrokes the only thing assignment expressions are good for? That shouldn't be so surprising
 
6:51 PM
@Aran-Fey yes, but this was the first time that I noticed I would have saved keystrokes.
it probably saves a little more keystrokes than having a ... as a short-hand for range, for example :D
 
@roganjosh not touching that
 
wim
@vash_the_stampede some users downvote for answering obvious dupes
 
@Aran-Fey leaking variables from a list comp is more than just a few keystrokes
 
wim
disclaimer: I didn't downvote you, and I don't agree with the practice of downvoting answers on dupes.
 
@AnttiHaapala Oh, I see. True, it's pretty rare to even think about PEP 572, and much rarer still to think about it in a good way :D
 
6:55 PM
@AndrasDeak that's fair enough, it's more about the answers from that guy pouring in and just being scattergun IMO.
 
yeah, I can imagine
 
I've got a problem
 
wim
programmers are paid for their keystrokes, so PEP 572 could cost us in $ ..
 
@AnttiHaapala no need to ask about asking, just ask
 
I don't wanna target a single user but this seems like the definition of "exploding onto the scene"
 
6:57 PM
I've appropriated the name soul for myself on PyPI...
 
@wim If that's true, why do we program in python? We'd earn much more $$$ with, say, java
 
i.e. xkcd 413
and I still haven't invented what I should be doing with it.
 
wim
just trying to spread some FUD about 572..
 
00:00 - 19:0019:00 - 00:00

« first day (2909 days earlier)      last day (2032 days later) »