« first day (3408 days earlier)      last day (1765 days later) » 
01:00 - 13:0013:00 - 22:00

13:05
Is there any element of realism in skeletons that can play their own ribcage like a xylophone? What does a human rib really sound like if you hit it with a small mallet? Has this been tested?
is there a viable close reason for based on wrong assumptions?
It seems plausible enough to me that ribs of different length would produce different sounds, but maybe they all fall into the range of "dull thunk" rather than anything truly musical
Cbg
@variable Before changing your code, try practicing with an Enum like class Color(Enum) with values of 'red', 'blue', 'green', and 'yellow'. You'll see that you can iterate over Color to get all its values, so that if you change your code to add 'purple', there will be no separate 'list_of_colors' list to be updated also. This concept is called DRY (Don't Repeat Yourself), and it is a property of a good design.
Confession: I never use enums. In the rare case that I need to associate names with integers, I use a dict.
I've used enums in more explicitly typed languages, mostly because the IDE will notice immediately if I mistakenly type if(this.color == Color.yelow). In Python, if self.color == Color.yelow only crashes at runtime, same as if self.color == "yelow", so I may as well use the shorter one
Or, hmm, bad example, since the former crashes, and the latter fails silently.
@Kevin I would imagine that the porous structure of bone mean that they cannot sustain any note. I think it will be a dull thunk
13:19
Let's say that if self.color == "yelow": is most likely to appear in a big if/elif block that covers all legal colors. Then the code will crash a couple lines later at else: raise Exception(f"Unrecognized color {self.color}"). So the ultimate result is still an exception, it just happens a couple nanoseconds later than it would if I used an enum.
In Python you should write if self.color is Color.yellow, not ==, and your IDE should help you autocomplete the 'yellow' part after typing the '.', or would visually indicate some form of attribute-undefined with Color.yelow.
Notepad++ isn't smart enough to do either of those ;_;
@Kevin IDEs, linters and type checkers generally support enum these days
"Building a house is hard", said Kevin, who was using a ham sandwich to drive in a nail
Seems very similar to the "why use objects when you can model attributes in an object with keys in a dict?" It may be time to migrate to an actual IDE. I used SciTE for a loooong time, but shifting to PyCharm has made a world of difference (even just the free version). I've also poked at VSCode, and it seems equally nice.
13:32
Is my memory failing me or did SO align with some code-skill-testing company as part of jobs? I'm not sure what you'd call it - something to benchmark yourself
@Kevin I refuse to believe that "plink" is not up to reality's expectations
One big difference between PyCharm and SciTE (and I expect Notepad++ as well) is that it is not easy to "just open a file". You have to open a project, and then create your file. To work around this, on my system at home, I just have a "dev" or "working" or "hacking" directory as a project for this kind of quick script dabbling.
My searches are bring up QA/testing jobs :/ IIRC there was a lot of criticism of the actual test so I'm wondering whether they ditched the partnership
roganjosh's porosity argument is convincing to me. If the bone has a complex internal structure, then pressure waves traveling through it are unlikely to rebound with any kind of harmony. It would all be uselessly dispersed.
13:33
Not to mention that I don't think it would have any stable resonant frequency
If only I had a corpse...yes, how may I help you, officers?
That's not to say that I wouldn't go to some orchestral performance if they had a skeleton come on stage and play their own ribs. I mean, it's one of those things you really wanna be a part of, right?
As in, it wouldn't be resonant even if the bone was a solid hunk of constant density? I guess the shape itself could also be a problem
Now that I think about it, I'm not sure I've ever been in physical contact with a skeleton (other than my own). The skeleton we had in biology class was mad of plastic.
@Kevin potato-shaped solids can still go plink, the density thing is a more compelling argument. Guess we could ask some audio engineers.
I bet there's an SE site for this...
I was going to say "perhaps necromancer school offers elective illusionist classes so they can change the sound effects of their skeletal minions" but in classic DnD illusionism and necromancy are opposing schools so they'd be unlikely to intermingle
13:38
@Permian no
Theory: necromancers take themselves very seriously, so xylophone ribcages are a humiliating prank played upon them by their illusionist rivals
The skeletons themselves love it, naturally
@AndrasDeak exactly
@AndrasDeak you seem like a really smart guy btw
@Kevin They have a dark sense of humour. The triviality of the whole thing - re-animating the dead simply to play a ditty - is probably quite appealing
That problem seems harder than the average easy programming challenge site problem. I'd put it towards the easy end of "medium".
@Kevin no way
its easy to traverse every path
but finding subsets adding to 8 is so hard
13:46
It might be a smidgen harder if it asked you to yield the node values of every path that sums up to 8. But it only wants to know the number of paths, which saves you a lot of bookkeeping
I'd hate to spoil the problem :-) I'm sure there are plenty of solutions on the discussion page you can refer to if you're dying to know.
@Kevin do you practice these much?
No, I prefer working on my own weird problems
how did you get so good?
like whats your rough backgrdoun?
reanimating Turing every so often for his secrets... and his melodies
How do you know I'm good? Maybe I can't even program. ;-)
13:50
at least you have an idea. i didnt haha
Anyone can claim that they can solve a leetcode problem with only an easy-medium amount of effort
yeah but you need an idea to start
@Permian If you already know how to traverse every path, what stops you from a) accumulating the sum of each path and b) incrementing a counter each time you have a sum of n?
i cant think how the counter would work
The thing that keeps me from categorizing this problem as easy is that the path doesn't necessarily start at the root.
13:54
exatly
So you have to either store more data than just a single "sum of path so far", or traverse each node more than once, or some combination of those
you need to keep a list of parent nodes
By the way, my super-simple toy compiler is this close to getting compile time templates. I might be overcomplicating this.
14:24
Oops, now that I actually test my solution, it counts the number of subsets of paths that sum up to a value. In other words, it can skip nodes as it travels downwards; so it considers [10, -2] a valid subset, despite there being a 5 and a 3 between them
that seems harder to do than the actual requirements
My love for overcomplication is well-established by now :-)
I guess there's no harm in showing my work, since it doesn't actually solve the problem: https://pastebin.com/5h6YXhAv pastebin.com/EgaiQ03s
This prints a Counter of path subset sums. For the sample input, there are five path subsets that sum to 8: 5 -> 3; 5 -> 2 -> 1; -3 -> 11; 10 -> (skip 5) -> (skip 3) -> -2; 5 -> (skip 3) -> 3
I think I can refactor it so it only considers contiguous paths, but I'll lose out on the efficiency that drove me to try this approach in the first place
I have a working solution that iterates over all contiguous paths in a straightforward way, but I'm not totally convinced that it will be efficient for trees with a thousand nodes.
Open question: A perfect binary tree of height 9 has 1023 nodes. How many paths does it have?
Open question 2: are there any binary trees with 1023 nodes that have more paths than the perfect binary tree?
14:52
i just cant think this through
what do you think about the difficulty?
I have no idea how that's supposed to be solved.
there's probably some bitwise trick that enables O(N)
If you take 31 buckets and label them 0 through N, and put each number into a bucket if 2^N <= the_number < 2**(N+1), then exactly one of the numbers in the solution will come from the non-empty bucket with the largest label. In the sample input, that would be 25; there is no other number greater than 2^4.
In the best case, the largest-labeled non-empty bucket contains exactly one value. Then you can iterate over every other number and find the smaller value of the solution in O(N), and you're done.
In the worst case, every single number is in the largest-labeled non-empty bucket.
Or, hmm, is it worse if all the buckets have about the same number of numbers?
I've decided that that's worse. All the numbers being in the largest bucket mean that you can discard the leftmost bit of each, and start over. You're guaranteed to finish in no more than 31 passes that way.
O(31*N) is still O(N), so that's not a problem
15:09
Overheat.... melting... rebooting...
Quick pytorch question: I have a tensor of dimensions [x*y, 2] that represents a list of coordinates (0,0) to (x,y) and I want to append a feature vector of dimension [z] to every single coordinate so I get a tensor of shape [x*y, 2+z] ... what operation do I need to perform? its not concatenation ...
I feel like I could do this in O((2^M) * N), where M is the maximum size, in bits, of any number in the array. Since M is constant in this problem, that reduces down to O(N), but it's a big constant, so my approach would probably take a thousand years to finish.
The problem asks "Could you do this in O(n) runtime?" and I answer "yes", and I declare victory. If they wanted an implementation that finishes in a human lifetime, they should have specified that.
Is there a way to see all routes on a website if you don't provide a map? If I were to create a route like /something/<some_uuid_here> is it easily exposed?
75% confident the answer is "no"
15:25
My confidence interval isn't any higher :/
I'd make that number higher, but since this is presumably a security-related question, and the consequences are probably disastrous if I'm wrong, I'm intentionally lowballing
Nah, the worst is just more spam
It's an extension of:
yesterday, by roganjosh
One of my friends is working at a place where IT is dragging its feet on a really simple package that I'm pretty confident could be built in a day. I was curious whether I just make a demo and ship it over to him to play with... keeping in mind that none of them are programmers. If you're regularly distributing your apps as exe's, you might know some pitfalls because I'd rather not send something that ends up being a pain for them to run
I'll just give you my anecdotal data and let you draw your own conclusions. In every tutorial about web crawlers I've read, they describe exactly two ways to locate pages to crawl: 1) query the website's sitemap; 2) start at the homepage and recursively click on every link.
Now I'm thinking I could just host the example application on my existing site with some weird route, to avoid any issues with anti-virus
if roganjosh dot biz slash admin is not in your sitemap and not reachable from your homepage, then an ordinary web crawler will not reach it
Google, the CIA, and Elbonian script kiddies may have extraordinary web crawlers that find pages using secret methods, but I don't know about them, because they're secret.
15:33
In this case, I think your intuition is enough to make me think this is viable. It's nothing sensitive, I just don't want to be bombarded by a bot. Thanks :)
@Kevin 3) Guess some typical "homepage"-ish urls and try to access them
@AndrasDeak perfect. Thanks!
@PaulMcG True. So for best results, don't name your admin page /admin, name it /correctHorseBatteryStaple
@Kevin I bet that that is on the list of passwords xkcd.com/936
15:38
the camelCase makes it secure
/correctHorseBatteryStaple2: uncrackable
Yeah, I'm not betting money on that being in the standard list. Probably uncrackable.
My poor little plusminus demo page is getting slammed with wordpress-ish address accesses <grrrrrr>
The Elbonian script kiddies found you with their amazing crawlers
15:58
Tempted to put up some honeypot pages to redirect them to ... well, someplace annoying
rickrolling had its time. What's the modern equivalent?
@PaulMcG wordpressish?
@roganjosh stackoverfiow.com
I don't have access to the access logs just now, but lots of attempts for things like /wp-login/admin or /wp-admin/login or some such, anyway lots of them starting with "/wp" which I guess is a default prefix for most of the popular canned WP templates.
Ah, gotcha
Nicely ties in with roganjosh's question
Of course, they all 404 since this is the most elementary of bottle web apps.
16:06
Just block anyone who does that
@roganjosh knowyourmeme.com/memes/youve-been-gnomed has some underdog appeal
Anyone think they can help me out with this question: stackoverflow.com/q/60213453/10886529
@AJHello is your question about the actual DataFrame or just about formatting the axis?
@AndrasDeak Ha. That's very dry. Love it!
Of course you have to capitalise the i...
16:18
@MisterMiyagi it's about formatting the axis
For some reason when I try to set the x-axis by using .set_xticks the plotted data disappears.
Nothing is plotted as it is
@roganjosh right but if I comment out the .set_xticks line of code then the data is plotted.
I don't understand why they Community Wiki'd their answer as it is
Because it's a guess at best
My own guess is that matplotlib is getting confused with plotting just times. It comes up frequently, in the last couple of days here in fact, with people trying to work with times and not datetimes
16:24
that's possible, I've only seen datetimes being plotted
A guess is that it's plotting the data in 1900 and you've zoomed into the wrong part of the graph based on time alone
The min-to-max range of the x-axis must include your plotted points for them to get plotted. Once you have that working, then do the tick-mark formatting.
What @roganjosh said
So the min and max have to include values in the dataframe?
only if you want to see values in the figure
Or min <= the smallest datetime and max >= the greatest datetime
16:26
Oh, of course this is less than a day old. Don't know what I expected.
I don't see a min/max setting (plt.xlim/ax.set_xlim) in the code, though. The default should always include the data entirely.
@AJHello - you've gotten a few shots in the dark here, but generally we'd like to let questions have a chance for a couple of days to get answered in the main SO before raising them in chat
there's also a lot of cruft in the question that's not really relevant to the problem
4 hours ago, by Arne
@AndrasDeak it's barely after lunch, still lots of time to get worse =)
We are open to helping you hone your question to be a better question.
@AJHello I don't think that Code Wizard has helped you at all in that chat. I'm not sure I understand what you want your plot to look like, though. It's just going to be a straight line?
You want a scatter plot against time of day? The repeated 1 value is a red herring. You just want a plot of occurrences against time?
16:37
Yeah a scatter plot would be fine as well but I ran into the same issue when trying to adjust the x-axis ticks for a scatter plot.
Actually sorry, the issue I ran into with a scatter plot was that the x-axis with scatter plots had to be numeric values
@AJHello I don't follow. What do you mean by "numeric"? It's a time that you've shown
When I tried to change the kind parameter in the .plot function from kind='bar' to kind='scatter', I get the error "ValueError: scatter requires x column to be numeric"
I assumed that this meant you needed a numeric value for a scatter plot?
Envision converting timestamps to some kind of numeric value.
Indeed, you need either continues or discrete but numeric values for x and y axis
Like number of seconds since some time prior to the earliest timestamp in your data set
16:44
you can just convert to a from-epoch timestamp and format the ticks appropriately. But I'd think that's exactly what pyplot would do.
Not sure why it would be forbidden to have dates in a scatter plot if they are allowed in line plots.
I'm guessing these are strings, not really timestamps
I'm pretty sure they are timestamps because of these two lines of code I do after loading in the csv: df.Time = df.Time.map(lambda x: x.replace(second=0))
df['Time'] =df['Time'].dt.time
So perhaps instead of time values for x-axis I could do time since 00:00 for x-axis and then I could create a scatter plot
Happy Valentine's Day Python
love == True
Traceback (most recent call last):
  File "<input>", line 1, in <module>
NameError: name 'love' is not defined
Man, that's deep
@Dodge Haha
17:06
@Dodge can we make love truthy?
@roganjosh of course, truthy love is what all humans seek
Seems like all celebrated valentines day very seriously xd
 
1 hour later…
18:34
am i just stupid? i have read that so many times and still dont get it lol
I read it twice and it's still not clear to me what they're saying, so no.
i dont understand any of the solutions
but am not missing the fundamental knowledge
I came closer to understanding the answers that used a trie, although I doubt I could write a solution from scratch based on that
yeah i know
only a medium
I've seen coding challenge sites that rate "write me a fully functioning social media site" at Medium, so the rankings are pretty much arbitrary if you ask me
18:39
its something to do with and and or being different bits turned off and on
Every program ever made has something to do with different bits turned off and on ;-)
@Kevin "now draw the rest of the owl"
Perhaps I could understand this solution or the trie based ones if I cared more about solving the problem, but today I'm hyperfocusing on Wikipedia articles about minor Greek deities, so that's not happening
18:56
@Permian can you link the original problem description?
The ancient Greek god of computer science... what was her name? :)
Nov 3 '17 at 12:14, by Kevin
Graphene is the only valid statuary medium to depict Palygone, the two-dimensional muse of computer programming, shown covered in pythons.
wikiepedia says Athena was the god of weaving and weaving is programmish
@Kevin took me a while to understand that
Arachne would be my vote, or maybe The Medusa? Scylla? Charybdis? Sisyphus? I know some of these aren't gods, more like monsters or otherwise tragic characters.
19:04
Hephaestus constructs the hardware, Zeus fills it with the necessary lightning, the muses tell you what to program, and Eris makes sure it crashes the first couple of tries.
subtler bugs are thanks to Artemis
Due to the above, my vote is for Dionysus - who needs alcohol more?
user11867329
>:|
Hello everyone, do anyone has some experience with sqlitebiter running in pythonanywhere? I have it installed in my virtual environment but in the server log I get these error messages:
2020-02-13 01:18:25 sh: 1:
2020-02-13 01:18:25 sqlitebiter: not found
2020-02-13 01:18:25
2020-02-13 01:18:25 ERROR:root:Error running WSGI application
2020-02-13 01:18:25 ERROR:root:sqlite3.OperationalError: no such table: data1
20:20
What's unclear about that error?
I can't say that I'm familiar with pythonanywhere but that error is telling you that the db table doesn't exist
@HugoPablo looks like you need to create a table in your database
Hi guys is there a way to generate bitcoin address and private key without some bitcoin module? Just in Python?
20:49
@Pijes The answer to "is there a way..." questions is almost always "yes".
Read the bitcoin specification and implement it, easy ¯\_(ツ)_/¯
21:00
@Code-Apprentice Thank you. Yes you are right
@Aran-Fey Thank you. I just wanted to check
user11867329
21:16
Anyone know if there's a python command to pause and prompt for text string and use that text sting value in the following code?
input()?
user11867329
It'll prompt for input?
I need an example of an awful one-liner for the post I'm writing... and I think I know where I can find some
user11867329
Which type of one-liner?
user11867329
Does it need to rhyme?
21:25
like a needlessly complex list comprehension
user11867329
your mum is like a needlessly complex...
wim
wim
stdlib is getting a topological sort PR11583, PR18155, bpo17005
^ this would have been really useful in AoC (especially for those "chemical reaction" type problems in their various guises)
patch is by Pablo Galindo, Tim Peters and Larry Hastings
Oxidized cabbages everyone :)
01:00 - 13:0013:00 - 22:00

« first day (3408 days earlier)      last day (1765 days later) »