« first day (4375 days earlier)      last day (567 days later) » 

2:05 AM
stackoverflow.com/questions/73993046 Where does the underlying assignment come from? I know I've seen this exact "room layout" before. Is it LPTHW?
@Aran-Fey I like "method" best, honestly
method, in the sense of technique
 
 
6 hours later…
7:53 AM
Yeah, I think I'll go with that
 
 
6 hours later…
1:23 PM
stackoverflow.com/questions/73997171 Am I missing something here? It seems like the underlying question is "how come when I use the .is_integer method on a float, it tells me whether the value is an integer?" But that can't possibly actually be it?
oh wait, I guess the confusion must be about the return, somehow.
 
Seems probable that OP doesn't understand what an integer is
 
It's not clear to me why someone who doesn't understand what an integer is, would a) have any way to discover that code; b) have a reason to want or need to use that code
 
Homework? ¯\_(ツ)_/¯
 
@KarlKnechtel I didn't know the difference between 1. integer, 2. decimal, 3. number back then, and I still tried to play around with stuff that was way beyond me (and maybe still is). I do know now, but I don't think not knowing basic terminology can prevent someone from testing/playing around with things they don't actually fully understand
 
1:39 PM
Note to self: when I write my Python book, don't take any mathematical knowledge beyond grade-school arithmetic for granted.
(That's a shame, because the quadratic formula is a pretty nice case study for conditional logic and for refactoring stuff with short functions.)
 
1:53 PM
stackoverflow.com/questions/73997307 Anyone know what the actual question is? I smell a common duplicate, based on the answers so far
er, problem statement (after doing the usual coding-contest interpretation stuff)
 
"Why is this code so slow?"
 
no, I mean, what is the problem that the code has to solve? some kind of set intersection type thing?
 
Counter(s2) <= Counter(s1)
 
Aha. Do we have an appropriate canonical?
 
Not sure. There are probably more than enough questions where the time complexity of copying strings has been brought up, but most likely in a different context
 
2:07 PM
no, I mean a canonical like "Q. How do I <brief description of what the code needs to do>? A. use collections.Counter and compare with <="
 
That wouldn't answer the question though? They're not asking for improved code, they're asking why their code is slow
 
@Aran-Fey I was about to suggest something like that. OTOH, running s2 into a Counter doesn't bail out as soon as a bad char appears in s2. OTOH, that's probably negligible unless s2 is quite long.
 
Haha, how many other hands do you have? :D
 
I guess it depends on what the test data looks like. If s2 doesn't contain any bad chars, but just fails to contain 1 or more s1 chars, you don't know that until you've finished scanning s2 anyway.
The Gripping Hand is a science fiction novel by American writers Larry Niven and Jerry Pournelle, published in 1993. A sequel to their 1974 work The Mote in God's Eye, The Gripping Hand is, chronologically, the last novel to be set in the CoDominium universe (though in 2010, Pournelle's daughter, Jennifer, published an authorized sequel entitled Outies). In the United Kingdom, it was released as The Moat around Murcheson's Eye (sometimes misspelled "The Mote around Murchison's Eye"). The Gripping Hand is set in the year 3042 (twenty-five years after the events of The Mote in God's Eye) and revolves...
Not that I'm a Motie, of course. I'm a harmless rhombic dodecahedron, so I don't have any hands.
 
2:24 PM
Well, I'm convinced
 
Is there a specific name for profilers that change the code they should profile?
 
3:16 PM
Maybe a bit too cryptic:
def scramble(s1, s2):
    c = Counter(s2)
    c.subtract(s1)
    return not c.most_common(1)[0][1]
 
3:26 PM
@KarlKnechtel A possible dupe target has been posted, but it only has an O(n^2) code-only answer.
@Imago Not that I'm aware of, but I guess we could call them DieselGate profilers. ;) en.wikipedia.org/wiki/Volkswagen_emissions_scandal
I've reverse hammered that old scramble question to the current one.
 
3:44 PM
Looking at a bash script and so confused by one line
 
3:57 PM
@rb3652 This isn't the Bash room... chat.stackoverflow.com/rooms/98569/bin-bash
 
 
1 hour later…
5:07 PM
Is there a way to get a Flask Blueprint static folder's absolute local path (not web path). So /www/app/blueprints/something/static. I presume the same method would work for nested blueprints. I can't find any documentation on getting the absolute local path, but only the web path.
What I'm trying to do is check if a file exists and if not serve a different file.
 
6:06 PM
@crypticツ blueprints don't get individual static paths?
 
 
1 hour later…
7:33 PM
AI generated art is becoming a thing. I hope we'll have AI generated code soon
There's copilot I guess
 
I could not think of anything worse
 
Well I mean it's unrealistic, but if it worked... I'd be all for it
 
How much of your own code has corner cases that you have to tackle?
 
like, all of it
 
It's bad enough with the amount of cargo-culting from SO without a machine just making arbitrary choices for you. It's a train wreck waiting to happen if people move to copilot
There's few enough people who could actually moderate the output without putting this stuff in the hands of the masses
 
7:44 PM
Isn't copilot just automatic - and probably better - cargo-culting, compared to doing it manually?
 
I guess that depends on how much cargo-culting you do in your day-to-day
 
I don't think it would make code quality go down
 
I certainly didn't expect to be having this discussion...!
Is there a clean demarcation that we can have a bet over, and we'll owe a pint to the winner?
 
Doubt it. Plus, I don't drink beer
 
I don't drink beer either. But, boo
 
7:48 PM
Anyway, writing code is tedious and error-prone, and I'm looking forward to anything that'll make it easier
 
A computer using code stolen from other people writing tedious and error-prone code, injected into your code without any contextual awareness? Good luck.
Actually, that reminds me to see how that got settled when they just ripped everyone's code from github and said "to hell" with licenses
 
@Aran-Fey copilot is, and I might be chewed on for saying this but: grep(1) but with natural language support. That's it. And they have like 1TB+ repos of best python project that they used as "training data", so yeah.
 
> Inspired by Copilot, Captain Stack is a code suggestion tool that uses Google instead of AI. It sends your search query to Google, retrieves StackOverflow and Github Gist answers, and auto-completes them.
Now that sounds like a terrible idea
 
ah yes, there tons of stuff like that existing already, even way before copilot existed
 
That's all that copilot is doing? They stole a bunch of code and it does... stuff. How is this an achievement? Not only do you get the benefit of your own mistakes, but now you have Joe Bloggs' idiocy leaking into your code
 
8:00 PM
@roganjosh yeah, you can look around for what some engineer who worked on it said on some forums/website, such as hackernews, etc. Many folks also tried their own verbatim and completely intelligible comment they forgot to remove once, and got a 1:1 output of their own code.
 
I wouldn't let it open a file for me, let alone anything I'm actually doing. And I struggle to think about how any of what I'm doing would get auto-completed
 
Have you used copilot?
 
it's literally grep with natural language support. that's it
yes
but I only tested it, so I mean, doesn't count as using it really
 
(I haven't, but my brother highly recommended it... at least two times)
 
Mmm. I can't believe this is actually gonna have to be added to my TODO
I don't trust it. I don't trust robots. Not in this house!
 
8:03 PM
Have a kill command ready, in case of any shenanigans :P
 
don't worry, I don't trust "AI" either. I once said what I truly felt when it comes to it once on a room in SE but someone insulted me for it. (it was a pedantic view but it was a three word sentence)
@roganjosh I think most add-ons for it don't scan your whole code, just the comments themselves.
I know it's the case for the vim and emacs ones at least
 
AI is basically what happens when graphics programmers start programming other things. It doesn't have to make sense, you just do some random stuff and as long as it produces ok results everything is fine
(On one end you have physically based rendering, where every law of physics is implemented as accurately as possible at the cost of speed... and on the other hand, you have real-time graphics, where speed is the only thing that matters and all the graphics are based on lies and deception)
 
that's basically what it boils down to yeah. It also align somewhat to what I once said myself, but I guess your version is less reducing :P
I wanted to say it but don't know why spoiler obfuscator doesn't seem to work.
 
It's not worked for a long time
I guess I could put in a PR but I never get round to it. Maybe copilot can write it for us... In the meantime has anyone got dash working behind Shinyproxy before I fork it and start fighting that? (Yes I have got all the google searches you might find)
 
does that mean you also already found that one github repo that showcase a demo for Running Dash apps inside ShinyProxy?
 
8:18 PM
Yes
 
All this time, I thought "shinyproxy" was a sarcastic joke name you came up with...
 
me too
 
Most galling is github.com/plotly/dash/blob/… means that the base container runs on http://0.0.0.0:8050/app_direct/default/ and I don't want that. I want it to run on http//:0.0.0.0:8050 and then render links appropriately
Just because I need links to prepend /app_direct/default/ doesn't mean that I want the server to launch with that base path. I just need it to prepend it to links once it's launched
@Aran-Fey No. ShinyProxy is a joke, but I wasn't joking
Bane. Of. My. Life.
 
@roganjosh this is related I think: github.com/plotly/dash/issues/119
 
Not really. I already know how to specify the address and port
It's this yam github.com/plotly/dash/blob/… that somehow changes the base path, and it has no good reason to
 
8:29 PM
I feel like they are doing a similar thing: github.com/openanalytics/shinyproxy/issues/235
 
They are. Again, I have googled the hell out of this thing. I'm looking for someone that's actually been through this pain because I have exhausted google
 
@roganjosh I see now. So, without actually having tested this, I'm guessing it doesn't work because while it doesn't use http://0.0.0.0:8050/app_direct/default/ as URL, it still use that as base path, so it end up not rendering files right, because of the difference in path/directory
 
This is a perfect illustration of the issue github.com/openanalytics/shinyproxy/issues/…. No it shouldn't launch on Running on http://0.0.0.0:8050/app_direct/dash-demo/. It needs to listen on the base path
 
hmm, did you also look on the plotly forum? found this: community.plotly.com/t/…
 
@NordineLotfi exactly that. I can run flask just fine (depending on your definition of fine) on shinyproxy but somehow dash just borks it by stopping the werkzeug server from launching on the base path
@NordineLotfi I have seen this too
 
8:40 PM
@roganjosh just to be clear, all of this is happening on both latest version of Shinyproxy + latest dash?
@roganjosh you completely got me D: I'm gonna stop posting google search and actually try this because this make me curious
 
No, not the latest version of shinyproxy. I don't have SHINYPROXY_PUBLIC_PATH for example, but that resolves to /app_direct/default/ in our case (and I've preemptively yelled at people not to touch our naming of shiny instances from default) so it's nothingness
 
Hello
 
Hey :)
 
Oops
Need to figure out hot to indent my code
 
8:45 PM
counter = 0

def fact(n):
    counter += 1
    print(counter, "\n")
    if n == 1:
        return
    for i in range(n):
        fact(n-1)
fact(3)
 
Nicely done :)
 
Why am I getting error: local variable 'counter' referenced before assignment?
counter is a global variable so I am not sure why I am getting this error
 
If you want to assign a new value to a global variable, you must have a global counter at the top of your function
 
@Mathphile something like this: w3schools.com/python/…
 
@Mathphile Why is your function named fact? Why does it return None ?
 
8:55 PM
@PM2Ring I am trying to make a function that runs exactly n! times
@DanielGarcíaBaena yup that worked thank you
 
you're welcome!
 
If this works then why didn't my code above work?
 
Because reading a global variable is not the same thing as modifying a global variable
 
Ah got ya
 
@Mathphile you don't need two variables for that, it's enough just with n
 
9:00 PM
I know
I'm using counter to see how many times fact is being called
 
@Mathphile FWIW, your code produces this sequence: oeis.org/A002627
 
Ah yes
I was wondering why the values of counter were turning out different
@PM2Ring Thank you
 
@Mathphile it should be called n times for n!
 
9:24 PM
All recursive code can be written iteratively right?
 
Yes
 
How would we right the code I wrote above iteratively?
 
recursion is a way of looping so try with a loop
 
Yeah I have been thinking of how I can use a while loop but still stuck on it
 
you will need some variable for storing the result
and another that you can keep decrementing until it reaches the stop condition from your loop
this time maybe it would be easier with a while instead of for
 
9:46 PM
Here's one way
 
10:04 PM
@Aran-Fey Ah yes that would work
I wonder if we can do it in O(1) space though
 
If you want O(1) space you need to eliminate the recursion entirely
 
you can achieve O(1) for, e.g., 5! doing print(5 * 4 * 3 * 2)
but you cannot write something like that for n
 
 
1 hour later…
11:40 PM
Ah yes, everything is O(1) when the problem size cannot be parameterized
 

« first day (4375 days earlier)      last day (567 days later) »