« first day (3201 days earlier)      last day (1972 days later) » 
02:00 - 19:0019:00 - 23:00

19:01
Does anybody know of a way to convert a plotly figure object to matplotlib?
I would bet that it's not possible
vtc as unclear what you're asking :P
If one probability can return multiple different messages, I'm not sure how your current dict-based approach is working. Maybe I'm misunderstanding the problem.
if d is {65: "you probably have meningitis"}, then there's no way that d[65] will return "you probably have meningitis" some of the time and "take two aspirin and call me in the morning" the rest of the time
"put the lime in the coconut"
I have to save to disk around 40 images. I'm able to save 35 with plotly.io.write_image. The leftovers throw an OSerror. And it's always these figure objects only. "Plotly wasn't able to connect to Orca, even though the server is running'.
19:06
wow, mother of all XY problems
is it the same 5?
have you considered trying to debug those 5 figures?
I even did this github.com/plotly/orca/issues/182 ; Is there any other I can save these figure objects? because the HTML files go over 100mb
Or are you saying that the output is deterministically dependent on the probability of immunity and the illness? So d[50, "meningitis"] returns "you might have meningitis, drink lots of fluids and get some rest", while d[50, "colon cancer"] says "you might have colon cancer, SEEK MEDICAL TREATMENT IMMEDIATELY"`?
@AndrasDeak I'm doing that
19:10
@Kevin More like some if/else branched logic that returns a dict with data and a message string.
if has_headache:
    if not positive_for_meningitis:
        return {'probability': 0.01,
                'meningitis_message': messages['unlikely but possibly early symptoms take an aspirin and see doc if symptoms persist.....message key from messages dictionary']}
    elif positive_for_meningitis and prev_illness:
        return {'probability': 0.1,
                'meningitis_message': messages['key with details about possibitity if recurrent infection after previous illness']}
    elif positive_for_meningitis and not prev_illness:
@AndrasDeak But the figure objects are normal when I convert them to dicts. These few figures are much larger than the others, I'm wondering that's causing the problem
probably, but I've never used plotly
@Kevin I'm saying the probability of immunity might have different messages for similar probabilities - so I'm saying the message is not deterministically dependent on the probability. The output currently consists of a float probability and a message. Both depend on the input, but the message is independent of the probability, otherwise I'd just have templates based on the probability.
19:31
I don't fully understand. But maybe that's good -- me not understanding something is evidence that the problem is "off the beaten path", to the extent that there isn't an idiomatic solution. So you can be confident that nobody's going to yell at you for not doing it the "normal" way.
What I think I need to do is figure out a way to refactor such that the messages are stored separately in markdown or something. I guess what I want is a module that can return the data (eg probability), with a message that's human readable, but can be rendered sensibly with it's formatting by a jinja template.
@toonarmycaptain assuming that's representative of your code you should at least gather those values into variables and have a single return {'probability': probability, 'meningitis_message': meningitis_message}
@AndrasDeak You don't like multiple return points? I do have a catchall return after the logic.
One question.. i need to make a split string but with different characters....in concrete @realdonaldtrump#ruhumancivilisedsane#justifyaoneallhumans@memuskneinstein£by#michaelcohenvledwabalchapo#aktiontatx££d#boburiedalive
@EduardoGutierrez When you need to split on multiple different characters, consider using re.split
19:36
id like to @realdonaldtrump #ruhumancivilisedsane #justifyaoneallhumans @memuskneinstein£by #michaelcohenvledwabalchapo #aktiontatx££d #boburiedalive
any example ?
>>> import re
>>> s = "@realdonaldtrump#ruhumancivilisedsane#justifyaoneallhumans@memuskneinstein£by#michaelcohenvledwabalchapo#aktiontatx££d#boburiedalive"
>>> re.split(r"[@#]", s)
['', 'realdonaldtrump', 'ruhumancivilisedsane', 'justifyaoneallhumans', 'memuskneinstein£by', 'michaelcohenvledwabalchapo', 'aktiontatx££d', 'boburiedalive']
But, hmm, it doesn't include the splitted symbols... I think there's a way to include them, but I forget how.
@toonarmycaptain I don't like the code duplication
any one of your 10 if branches could have a typo in 'probability'
@Kevin only partition comes to mind but that only splits once
Maybe findall would be better?
>>> re.findall(r"[@#][^@#]*", s)
['@realdonaldtrump', '#ruhumancivilisedsane', '#justifyaoneallhumans', '@memuskneinstein£by', '#michaelcohenvledwabalchapo', '#aktiontatx££d', '#boburiedalive']
oh, we're talking re.split, sorry
@Kevin how about a lookahead?
@AndrasDeak That's true. But any of my 10 if branches could also have a typo in my probability_variable if I do it that way (although I suppose that's more testable).
19:40
NameError is good
>>> re.split(r"(?=[@#])", s)
['', '@realdonaldtrump', '#ruhumancivilisedsane', '#justifyaoneallhumans', '@memuskneinstein£by', '#michaelcohenvledwabalchapo', '#aktiontatx££d', '#boburiedalive']
so close
Half-serious suggestion: now add a negative lookahead so it refuses to match a separator if it's at the start of the string
>>> re.split(r"(?=(?!^)[@#])", s)
['@realdonaldtrump', '#ruhumancivilisedsane', '#justifyaoneallhumans', '@memuskneinstein£by', '#michaelcohenvledwabalchapo', '#aktiontatx££d', '#boburiedalive']
im cleaning tweets and this com from a whole tweet.... i have to analyse them and i found that many people wrote wrong... no spaces between users and hashtags... so id like to separate a string in words... one word of the string could be @realdonaldtrump#ruhumancivilisedsane#justifyaoneallhumans@memuskneinstein£by#michaelcohenvledwabalchapo#aktiontatx££d#boburiedalive
Well, even though I only half-seriously suggested it, it's probably a functional solution.
For example i cleaning the last twet i post.... split " " works well 90%
@EduardoGutierrez does posting that really add anything to the discussion?
19:47
but i have to correct peoples faults ;)
clean tweets need no cleaning, great
' @'.join(' #'.join(thing for thing in part.split('#')) for part in part.split('@')) though I suppose that could insert more spaces where you don't want them shrug
Not sure if that splitter actually works
well im looking for a total solution jajajaj mixing split " " with re.split as kevin showed
you could always just split on \b
> i have to analyse them
@EduardoGutierrez sounds like you have a job or a research project to support you
19:49
If you want to split on "@" and "#" and space, just add space to the character set: r"(?=(?!^)[@# ])"
\W, I guess
though... that does split on unicode :P
re.split(r"(?=(?!^)[@#\b])", s) ?? imnot very good at regex....
it seems you have to learn
@AndrasDeak: im a student of big data assignemnt and im writing a little project
i have to count all differetn users mentioned in a range of 500 000 tweets....
Either I understand the requirements and you're ignoring my suggestions, or I don't understand the requirements and you're not clarifying the requirements very well. I don't like either of these options.
19:53
most of the cases it works , but im facing that is taken as an user : @realdonaldtrump#ruhumancivilisedsane#justifyaoneallhumans@memuskneinstein£by#michaelcohenvledwabalchapo#aktiontatx££d#boburiedalive
former it is
@Kevin : the first solution, the findall works well to solve the first part of the problem
@EduardoGutierrez The regexes I have suggested work perfectly on that. I don't understand why we're still talking about the problem when I have apparently already solved it twice.
to split what i asked for : @realdonaldtrump#ruhumancivilisedsane#justifyaoneallhumans@memuskneinstein£by#michaelcohenvledwabalchapo#aktiontatx££d#boburiedalive
@Kevin You didn't solve it hard enough
19:55
Know it comes the second part or the TOTAL solution...
I'm going home. If you can provide a script with 5-10 sample inputs and their corresponding expected outputs, I promise I'll look at them tomorrow morning. Otherwise, my work here is done.
Help vampires have been an uncannily frequent occurence here these days, so let me stop you here @EduardoGutierrez. Please read how not to be a help vampire and improve.
I guess my message was totally out of context here
@AndrasDeak So what you're saying is this contrast: pastebin.com/pEUmFkSA
indeed I do
I'd be very happy if my bottlenecks were due to skipped if/else clauses :P
20:05
Andras: sorry if I've been vampire :(
I try to hang out in here just to learn in general!
@biggi_ have I told you so?
Nope, but I semi feel like one
you needn't worry until I start telling you to get your yam together
@AndrasDeak Well that's fair. I had read it was good practice to return early and skip unnecessary logic.
@biggi_ that is only an...orange flag :P
@toonarmycaptain I think opinions vary on that (if you have a mix of early and returns it can be a bit spaghetti-like to track down execution), and you often don't return the same thing so what I suggested to you doesn't arise as a natural alternative.
20:09
another solution could be insert a character space blank before @ or #
@AndrasDeak that was just a case of me not explaining it as clearly as I should have. I now know what I need to do :)
Me no use words gud.
glad to hear that
@AndrasDeak Fair enough. Thankyou.
@AndrasDeak *early and late returns
 
1 hour later…
21:47
My Flask app at work has taken a battering today. IT have decided that I need an self-cert SSL certificate for encryption, which I can kinda understand because it does have a login, but now the browsers are going with errors and it's tough to make it accessible in a way that the non-tech shop-floor workers can handle, or just outright blocked. The server is only accessible internally to the company. Is there another way I might encrypt logins that won't send Chrome/Firefox nuts?
What is the point of array[:] when array == array[:]? I'm coming to Python from PHP and I don't understand this.
@amflare if it's not an array but a list, it creates a copy of the original list
that's a stupid way of writing array.copy()
4 bytes is no laughing matter
But couldn't you just copy by saying array2 = array?
21:50
nope
nope
please read nedbatchelder.com/text/names.html to understand why
@roganjosh letsencrypt?
@WayneWerner Doesn't that need external access? The server can only be reached on 192.168.x.x:5000
alternatively, if you can install certs (or can have certs installed), have IT install a company CA cert
@roganjosh You can run it by inserting records into DNS, if you have control over that
21:52
Oh, so its copy versus reference.
Cool. Thanks!
If your IT is requiring that you have SSL certs, I would push back and tell them to issue your app a cert and install a company-wide CA root on all the intranet boxes
but this concept is very fundamental to python so make sure you grok how it works here
they should have that power
21:53
@WayneWerner Oh, then IT have been totally pathetic here because they've made us all live with this issue for nearly 2 years. So they can fix this in the DNS; thanks for that
Good to know. I will keep that in mind.
@roganjosh They can either get certs for your domain, e.g. internal.company.example.com or just become their own internal CA
they should be doing one of those things instead of telling you to create your own self-signed certs and training everyone in your company to blindly click "whatever, I don't care about SSL"
They will need to be their own CA, but I guess that's the part that has not occurred to them
It's really really easy. Like, 30 minutes with Google and they can setup their own CA
@WayneWerner For sure. I also did push back because I knew exactly what issue this would create. But I've gone too far down researching letsencrypt and I'm not really aware of what I could suggest we do internally to fix this mess
21:59
@roganjosh here's the first result I got searching for "how to create an internal certificate authority" deliciousbrains.com/…
@WayneWerner That's really valuable, thanks. Like I said, I was going too far down research into letsencrypt and couldn't see the wood for the trees in my searches. I'll raise that.
Good luck :)
02:00 - 19:0019:00 - 23:00

« first day (3201 days earlier)      last day (1972 days later) »