« first day (3669 days earlier)      last day (1262 days later) » 

2:55 AM
cbg, is asking to look into about my question that is marked as a duplicate (possibly wrongly) also have to wait for 2 days before I post here?
The dupe is linked to Java when I asked for python
 
3:44 AM
hello wordl!
 
 
2 hours later…
5:55 AM
Hi guys, I want to ask a dump question.
I just read something about ABI and binary compatible stuff related to C++.
But to my understanding, it seems that Python doesn't have that kind of problem.
Why? Maybe all dynamics languages e.g. Javascript don't have to concern about that?
Because dynamics lanuages don't have to be compiled and are executed just in time with so-called runtime engine? I don't know. I am not familiar with these concepts actually.
Hope you could give some ideas, thanks.
 
 
3 hours later…
9:08 AM
@AndrasDeak the solution was indeed simple. Use canvas.print_figure() to write a BytesIO object and pass that to QPixmap.loadFromData(). Too me the best part of a day to throw away my preconception that I'd need to create a QImage first!
@Rick Feel free to ask it.
@python_learner A link to the question would enable room owners to tell you whether the duplicate marking seems fair or not. Until then they are in a vacuum.
 
9:41 AM
 
 
1 hour later…
10:52 AM
@holdenweb the question is fairly new and I was not sure whether to post it within the 48 hour rule, but the question was reopened by a different user
link in case anyone is wondering stackoverflow.com/questions/64623841/…
 
@holdenweb all this work to cross it out? :(
 
That's just to remind you it's not production output ;-)
 
 
1 hour later…
12:06 PM
is there a way to run the loop til the second condition is also true to access the second variable ?
cv = ["a", 2]

for i in cv:
    if type(i) is str:
        y = i
    elif type(i) is cv:
        z = i
 
@Amundsen 1. I don't understand the question, 2. prefer if isinstance(i, str)
and you both iterate over cv and expect a variable to be of type cv which almost never works
 
@AndrasDeak typo : should mean int
 
I have chosen a bad example, I want to run the loop till the second condition also get executed for example for this statement
cv = ["abc", "cdb"]

for i in cv:
    if i.startswith("a"):
        y = i
    elif i.startswith("b"):
        z = i
so i can acces both variables
 
12:23 PM
and the expected output would be?
 
I want to declare y and z so the iteration should proceed till both conditions are satisfied or the iteration is over
 
@Amundsen I still don't get it, because the two conditions are mutually exclusive. You probably need two independent ifs: if condition1: ... if condition2: ....
(if that's the case then your example is terrible, I'm sorry to say :P)
@Amundsen but that message is again completely unclear to me.
You'll have to be more specific, explaining what should happen in each iteration, in an example that resembles your use case.
 
@AndrasDeak - they are mutually exclusive for each element, but he means the cumulative condition.
if found_a and found_b:
    break
 
Ah... may your crystal ball be always sparkly, Paul
 
I do this kind of looping over test data all the time
 
12:31 PM
I hate to say it but this might be a use case for asspressions
 
No, there is no need to go there
 
If asspressions were confined to the headers of conditional/loop suites I'd be a lot less hostile toward them
 
@AndrasDeak background for my question: i want to loop over the content of a directory and want to search for two files and delcare each file to a variable ,could be an easy way to do so
 
y, z = None, None
for item in seq:
    if item.startswith("a"):
        y = item
    elif item.startswith("b"):
        z = item

    # see if we have found both y and z - if so we are done
    if y is not None and z is not None:
        break
else:
    # the else clause of a for loop will get run if you run off the end
    # without doing a break
    print("Dang!, ran out of items before finding y and z!")
 
Please see our code formatting guide, Paul :P
 
12:35 PM
(Could have sworn I hit ^K - and wow, were you fast on that friendly advice!)
 
it must have been halloween paranormal activity
 
naive approach... condition_met = {'a', 'b'}.issubset(el[:1] for el in cv)
or == or whatever
 
^^ Omits the capture of y and z tho.
 
okies... need to read up - but didn't see that was necessary
ooops... one sec... fixing but breaking your message Paul... must be a Sunday
 
Ehm, I don't think it needed fixing? :P
 
12:42 PM
the leading indentation was bugging me?
 
Ha! I knew it was already indented!
 
hmm
But pressing ctrl-K twice should alternate between two levels, not add aditional levels.
 
"trailing indentation" - I guess that would be for right-to-left encodings
 
@PaulMcG or just a typo :p
 
12:45 PM
message got Stalinned
 
"Think horses not zebras" overlooks the fact that zebras are more stylish
@AndrasDeak - do mean that it was retro-corrected to align with goodthink?
 
yup
doubleplusgood message now
 
You might enjoy this The Commissar Vanishes
 
Ah, yes, thanks
Although rather than curiosity it's more history for us :)
"defaced", meaning with his face removed, nice!
 
Bracing myself to see if it becomes future history for us over here... big week coming up
 
12:52 PM
I thought "fake news" was already that
 
I keep waiting for FOX to rebrand themselves as "Truth News" - oh the irony.
 
I'm not terribly optimistic
Reading comments I get similar vibes than the last time
 
@AndrasDeak but the "fake news" is fake news... and it's the biggliest fake news, right? :(
oh, and don't forget, it's "alternative truth" now...
 
I don't think it's safe to describe anything as the biggliest because it will be surpassed only a few days later. It reminds me a bit of Dragon Ball Z where, miraculously, every new threat was only ever an order of magnitude bigglier than the previous...
 
1:13 PM
almost food time... a nice joint of meat has been in the slow cooker over night... bbiab
 
 
3 hours later…
4:20 PM
 
4:37 PM
^ closed
 
Thanks :)
SO on the weekend is just totally broken for the python tag. Now we're in a voting war when the OP and answerer is objectively wrong :(
Fantastic, we've progressed onto the revenge downvotes on my questions phase :P And that's quite enough of the main feed today :)
 
@roganjosh maybe flag the behavior?
 
4:53 PM
Nah, there's nothing that can be done for the single downvote. I mean... I cannot prove that it's in relation to that interaction anyway, and I keep this question around just to suck up the extra downvotes when I upset people
Mostly it seems that people like to pile on to an already-downvoted question. Some will go for the top-voted question and very few go for the most recent question. At least, I think
 
I presumed "revenge downvotes" to be in the multiple :)
Even the edit on that question is dubious. Needs pointing out.
 
Heh, just a cathartic shot-across-the-bow for them (so far) :P
 
Or maybe not. I can't spend the energy arguing in return :-p
 
Not worth it. Hows things with you, anyway?
 
5:12 PM
@roganjosh Trying to be constructive I posted an answer, plus a comment about the likelihood of the question being closed. So now can I vote to close it?
 
@holdenweb You can, of course, vote as you wish :) From a personal perspective, I'm not overly keen on people posting an answer and then closing, because I've seen people do that in the past just to farm rep and keep others out. I obviously know that's not your agenda, but that's sometimes how that behaviour comes across (at least to me)
Just in the interest of being explicitly clear (I think you know this already) - me being an RO of chat doesn't give me any authority on what goes on on the main site beyond what the regular rep system provides. What I said in my previous message is literally just personal opinion
 
Oh sure. Quite happy to ask for those with more experience to guide me, no badge of authority required.
As for closure, I posted a warning and I'm happy to leave it in the lap of the gods.
 
5:30 PM
@roganjosh that's my experience
@holdenweb FWIW that's usually bad form
Voting to close == you think it can or should not be answered
 
@roganjosh things are good here. Work from home with twitch on the TV for white noise (not so productive at times). What about you?
 
Thanks. Good input.
On a separate note, I'm surprised how little you need to do to stay in the top 1%.
 
That statistic is probably just a bit biased by 5M ban evasion accounts with a single negatively scoring question :)
 
Ah well.
 
Not to belittle your efforts :D
 
5:41 PM
Hello
 
 
2 hours later…
7:29 PM
Hello. I have an issue with the StackOverflow interface where I can't post my code in order to ask a question. If there is a better chat room for me to join in order to help, please suggest it to me.
I will be back shortly.
I have returned.
Unfortunately, I must leave for a long while now.
 
7:46 PM
@Mr.MintyFresh you should see a reason for why you can't post
Probably too much code and too little text, or the title is already used
In any case the UI should tell you what's wrong
 
8:37 PM
Hey guys I am not quite sure if this is possible but I have got this ajax call however before submitting the call i need to run something like this dpaste.com/BPMQ3LWXK Now I got this to work nicely when it was just a single form befing submitted however this is going to need to be done with multiple forms needing to recieve the
forms[i].csrf_token._value()
for each one individually on send as the i representing a numberic value of a for loop from javascript
now essentially what I want to know is is there a way to sub in the javascript value into the jinja2 templating code there dynamically so that it is changed on call or is this not possible
or should i look into preseting those into an array and using the it thus although that doesn't feel the best option at all
 
Not unless that function also gets rendered by jinja2
 
hmmm ok may need to think this through some more
 
But that wouldn't be necessary with forms because you would already have the csrf token as a hidden field, right?
The only time you need to use the code in the link you gave is if you were submitting a POST request that doesn't already carry a CSRF field injected by Flask e.g. if you were just submitting a generic JSON body from the template
 
8:54 PM
Well not quite so what I have at the moment is one form "update_progress" and then for each student in the class generating a new form 'attendance-' + i (i being the index number of the student
 
Ok, but the csrf token is a specific field you can template out in the form, no?
 
What I am aiming for is that on clicking submit of the update_progress form I use ajax to submit the attendance forms each point to a new route just to validate and organise the attendance separately
when looking at the html code in browser it seems all these forms have the same csrf token which I find weird no?
would it maybe be a good idea to assign the csrf globally flask-wtf.readthedocs.io/en/stable/csrf.html
 
Doubt it - they're supposed to expire
 
user13428955
Hello Mentors, please may help me to solve this problem. Please have a look in the link stackoverflow.com/questions/64589326/…
 
9:26 PM
@AndrasDeak It specifically says "Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon."
I would share a screenshot with you that shows that I have done exactly that if I could, and the question preview even shows that it's formatting correctly. I don't know what the issue is.
And, more importantly, I'm not getting the necessary feedback to fix it (on my own).
 
is there a preferred way of creating well-isolated business logic that you can just basically plugin to django code
im interested in bringing useful python functionality to a website but the django more acting like a microservice that just kind of passes through assets. Python --> Django --> JS website (part of this is that then I could swap out the JS website for any other type of front end hopefully then)
passes through assets/inputs/outputs*
 
10:25 PM
@Mr.MintyFresh hmm. Code formatting should be a no-brainer now that code fences are also supported. You can post a screenshot here and we can take a look. But make sure to add something to the message where you post the screenshot link, so that it doesn't expand and take up a lot of room in chat.
@Asif I don't see how the line you showed on top could have raised that error. But it's clear why the code at the end of your question raises that error. Compare the signature of your function and the way you call it later:
def fitsvm(c,gamma,epsilon,X_train, y_train, X_test, y_test):
    ...
fitsvm(X_train, y_train, X_test, y_test, c=X[0], gamma = X[1], epsilon = X[2] , axis=1)
You are passing four positional arguments, but this means that they get assigned to c, gamma, epsilon, X_train according to the signature. So when you then also pass c=X[0] as a keyword argument, you indeed pass c twice.
I can't comment on the semantic problem (of passing c and gamma based on your data) that desertnaut noted, because I'm not familiar with machine learning
 
10:55 PM
@AndrasDeak Do you want me to post a message after uploading the screenshot? Because, apparently, I can't do both simultaneously.
 
@Mr.MintyFresh no. Upload the screenshot, then edit the autogenerated message and put something (even just a dot) along with the image URL. That will prevent oneboxing.
I mean, uploading an image will automatically post its URL, thereby oneboxing the image
 
that is strange but I will try it out
 
Edit the message.
 
uhhhhhh
 
Posting another message will not magically edit it.
There you go. Now delete the other message with a dot.
Perfection. Thank you.
 
11:04 PM
this interface could use some work, but oh well for now
 
Yeah, chat has been an orphaned child for long
@Mr.MintyFresh I agree that your post seems well-formatted. If I had to guess, the file names interspersed with the code blocks gives a false positive. I'd first try replacin gthe four-space indents with triple backticks (that's newer and maybe more reliable).
 
I have done that before but will try again.
 
@Mr.MintyFresh nah, I'll take your word for it
Side note: always use , and only add version-specific tags if that's relevant. But a python question without the generic tag is mistagged
 
I didn't work... also, okay
 
no, actually, you already have empty lines there... *sigh*
 
11:11 PM
Try enclosing file names like __init__.py with `` perhaps?
 
@BožoStojković I was just about to suggest that, but I don't think that causes the issue.
but anyway that's important to prevent formatting mishaps
... but there OP had code markdown for the headings, if I understand correctl
I'm running out of ideas. If all else fails, you should ask on meta, explaining why all these dupes didn't help.
 
I changed the headings from the format of "# HEADING" to "# HEADING #" according to the mini-guide; that didn't quite work either...
 
The markdown engine has recently been changed, so it's even possible that this is a new kind of false positive...
 
I will try posting on meta using an updated screenshot and see what happens. Thank you for your time.
 
No worries, good luck
Just explain about the dupes I posted here so that it doesn't get hammered to a wrong target
 
11:23 PM
Okay, thank you.
 

« first day (3669 days earlier)      last day (1262 days later) »