cbg, can anyone tell me how(why)? this works foo.__call__.__call__.__call__(). I was under the assumption that the () only calls the last function in the chain (__call__) but it calls foo
@python_learner Sure, it only calls the last function. But there's no difference between calling x() or calling x.__call__(). They do exactly the same thing. So, naturally, x() and x.__call__.__call__.__call__() also do the exactly the same thing.
@python_learner x() is syntactic sugar for the interpreter executing x.__call__, which in return is x.__call__() in source code land.
Remember that the interpreter can internally do some things that the programmer can not, such as directly executing functions and methods without going through the Python-rules of lookup.
Translating these back to source code land leeds to some nonsensical, infinite equalities such as x() being x.__call__.__call__......__call__().
On a different topic: Did they change the code coloring on SO main?
That's probably the base URL route that should return the template
For example in flask you'd define @app.route('/') and that would return index.html and you'd trigger the view by going to 127.0.0.1:5000. I can't remember how django projects are set up but have you got a "templates" directory?
Perhaps "everything is ok" in such a context means "The program did not delete my database or order 144 cardboard cutouts of Danny Devito on Amazon using my credit card"
In the grand scheme of things, "everything is normal except my program didn't finish" really is OK.
I tried using fourier transforms the other month to do one of those cool "circles within circles tracing out an outline of something humorous, such as rick astley" animations, but I couldn't wrap my brain around the 2d formula
There are almost certainly also more practical applications than drawing rick astley
This is the 3.0. So far a bit beefier than the first two. With similar at-launch features, although the sleep-mode seems a bit buggier than earlier versions.
@Kevin Cheers :) Yup, although when I was selecting dates on that form, I never thought he'd be arriving this late.
Kids these days don't know the value of punctuality
All they know is sleep, want milk, who's this hairy guy next to mom
Filling out a form for work... It's smart enough to guess my zip code based on my city/state, but dumb enough to strip the leading zero from it before putting it in the entry field
Here is my Crappy Web Software story for today: My wife does online tutoring now, and was helping a 6th grader with her online homework, on density of materials. The online density-compute-o-meter that is part of the homework shows the density of the object as "0.40 kg/L", so to the question "What is the density of the object?" the student enters "0.40", and it is marked WRONG. I am brought in to consult, and we finally find the answer.
For the tutoree's benefit (over Zoom), I made quite a fit over how she was right all the time and it was lousy software that was impeding her educational career.
They should just use the Javascript version of "eval" on whatever the student enters.
(answer: if the eval is occurring locally, not much, since presumably the student already has the ability to run arbitrary js using the debugger console)
(unless they're using some kind of custom locked-down browser)
Doesn't save the site devs much work, unfortunately -- they'll still have to strip units and stuff off of the answer before evaling it, to make sure that 0.40 kg/L doesn't crash with "unexpected identifier kg` or what have you
I understand the principle of epicycles reasonably well: x(t) = a * cos(b * t) + c; y(t) = a * sin(b * t) + c draws a circle of arbitrary position, radius, and rotational speed somewhere on the 2d plane. By adding together many of these components, you can link circles together. Using the right parameters, this draws rick astley.
Discovering the right parameters is the part I can't figure out on a cocktail napkin
The "linking circles together" is not exactly how I think about it, and I wonder if that throws you off somehow. It makes sense when someone plots it like that, but only because I know the underlying complex math.
scratch that, what you have is 2d real
I'd probably have to look up the specific math... I've never Fourier analysed a 2d curve.
Yeah, part of my conceptual confusion might be coming from that general area. It's like, x(t) and y(t) are related, but I'm also free to choose differing differing parameters for parts of them, so they're also independent...
What makes the connection is that the frequencies that make up the decomposition are fixed: you have a base frequency w0 and its upper harmonics, n*w0 for n natural numbers
The only thing is that the "plot as sum of circles" thing might not be evident when you decompose both. In general, for harmonic n you have a term x_n(t) = a_{x,n} cos(n*w0*t) + b_{x,n}*sin(n*w0*t). And the same with other coefficients for y_n(t).
I'm trying to figure out with a bowl of stew in my lap whether we need to be tricky to get circles...
That would be the straightforward way to ensure a circle in each term. But this would only work if x(t) is even in time and y(t) is odd.
If in one order you had x_n = a_{x,n} cos(w_n t) and y_n = a_{y,n} cos(w_n t) the two of these when plot together would lie on a line rather than a circle
so I'm starting to wonder if the plots we see with this are tricky to ensure that one is odd and the other is even as a function of time...
I wonder if you can do epicycle drawings with ovals... But that's a digression from the main topic
Actually that ties in with your "are the plots being tricky?" question. Are the artists specifically avoiding oval epicycles because they're ugly? Or is there some property we haven't noticed that make circle epicycles the only viable solution?
OK, the Homer video you linked is completely general, so there has to be a general thing I'm not noticing
If I had time to write this down I'd start from the circles' viewpoint. Assume there is a synthesis in the form of (x in sines, y in cosines, both with an optional but same starting phase), and expand that and try to show that they can construct any signal.
There's a reply to that post that's like "what if there are both cutesy anime girl angels and fiery eyeball wheel angels in the same setting" and someone replies with a drawing of the two of them holding hands* with the caption 'they're girlfriends"
I'd be willing to accept that those dudes were badly prejudiced. Wonder how much they'd have unconsciously objected to women being in positions of power.
Imagine you're Jacob chilling in the desert and this beautiful stranger comes up and is like "yo let's wrestle" and they're so dang fit that even in round 50 they're energetic enough to dislocate your hip like it's no big deal. You've got to think "dang but this is the manliest man to ever man"
And there's no way you're saying it was a woman in the scriptures because your wife is going to zero in on that right away and say "you were 'wrestling' until daybreak, huh?" and then you're sleeping on the couch for the rest of the pilgrimage
I don't want to be king, I want to be the king's brother who has almost zero chance of taking the throne, freeing up lots of time to hunt boar and look for holy relics
Ugh, you sound just like my Lady wife, always telling me I'm "too full o' the milk of human kindness", and why don't I pop down to the corner store and pick up some ear poison for the king's visit...
(Wait, that's Hamlet. Revision: why don't I pop down to the dagger store and pick up some daggers...)
In a pandas object series -- how can I drop a row if it breaks continuity. As in: x,x,x,y,x,x,x So I need to drop 'y'. Problem is y is valid value elsewhere in the series and 'x' might have to be dropped in that range : y,y,y,x,y,y,y ; here drop row with 'x'
by object series I mean str data type in pandas 0.23
@roganjosh I mean... Maybe. The earliest citation Wiktionary has for "pop" as in "To enter, or issue forth, with a quick, sudden movement", is, you guessed it, Shakespeare. "He that hath . . ./ Popp'd in between the election and my hopes."
The more specific "(intransitive, Britain, Canada, often with over, round, along, etc.) To make a short trip or visit. " has no citations at all unfortunately
Or, relatedly, xxxyxyxxx? You can reduce that to a no-single-interruptions string by either removing two ys, giving you xxxxxxx, or by removing one x, giving you xxxyyxxx
A one-pass approach might even do both, giving you xxxxxx
I wonder what the big-O complexity of "choose whichever solution has the longest result" would be...
@Kevin Thanks for these questions. Luckily, at least for now the physical process that I am trying to describe with the program doesn't have all cases. But I'm still trying to look for other ways to reach my end goal.
Encountered a fun little form today -- I filled in twenty fields, submitted, and it replied with "you must fill in values for 20 more field(s)" and returned me to the form, now empty. Turns out I have to click "save and preview" in between each and every field.
This form happens to be one that, if I submit it, I am entitled to cash rewards from the service. It's almost as if they want me to fail to fill it out until the offer expires...
Nah, probably a coincidence
Hmm, "field 'spouse' may not be empty". Hey Andras, have you ever wanted a green card...?
I mean, talk about being kicked to the curb. It's fine. I'm not hurt. I guess you like the challenge of the married guy. I get it. I'll just go back to the main feed.
On my part, I had a long lists of guests where, for any guests A and B, A may express one of the opinions {I must sit next to B, I must not sit next to B, no preference}, and we would have had to find the seating arrangement that satisfied the most preferences
Again, before I start working on that, please see how I made a copy/paste example here
I have a pretty good idea of what you want but make the self-building dataframe code and give a clear indication of the expected output
There's a reason that you were being asked by multiple people earlier about corner cases - there's an awful lot of wasted effort on SO when the OP turns around and goes "well, yeah, but what about {x}?"
It's up to you to decide whether it gives enough info for your purposes, not us. But starting scraping before you've reviewed the API is terrible practice
Some things are not available through the API, such as user tag scores. But 95% of stuff are available.
user13415013
My future problem is I have to query all stackoverflow questions when a user searchers a question and i have to match it with all question available to input question like if in one shot, I would get all Python question , Its link, (with only having answer) .
user13415013
So i have to repeat that thing again and again if person searches
Hmm, I tried /2.2/questions?page=1&pagesize=10000000000&fromdate=2678400&todate=1600992000&order=desc&sort=creation&site=stackoverflow but I don't think it likes that I'm asking for ten billion results
api.stackexchange.com/docs/search says its search capability is " intentionally quite limited", probably so that you can't easily write your own illegal(?) mirror of the site
user13415013
18:56
:) , I was thinking so at first, then realize i have to do some filters and should be saved to database.
I put the question mark there because I know the license is fairly friendly, but I also know that SO clones that poorly copy everything occasionally get taken down
Revision: "probably so that you can't easily write your own mirror of the site and legally redirect those sweet advertising dollars away from StackExchangeCorp"
Getting every question using regular old scraping would probably take a very very long time, and the administrators might even notice what you're doing halfway through and block you
Then ask questions about it, don't just drop it. Why did you come here if you weren't expecting some information that you didn't already know/understand?
user13415013
I was banned from asking question, I was just asking about, why?
I endorse "ask questions about it". I don't expect anyone to immediately understand how to work with the data dump I linked to. I start by showing the general direction, but I'm still willing to help with speed bumps along the way
user13415013
If a user cannot demonstrate, after asking a reasonable number of questions, that their contributions are making the site better (or at very least, not making it worse)
Incidentally, I know that there are trousers that loggers can buy that chew up chainsaws and stall them. Don't know why I've just thought of it. I think it's a Canadian brand
@AndrasDeak our sham marriage is off. You didn't know about it but I have charts and everything. The seating plan was already sorted. Anyway; it's over.
Open threat: "I'm going to hit you with this here two-by-four" Open ended threat: "I'm going to hit you with an object of your choice from my Wall of Implements"
@AndrasDeak Yeah, but we're leaving you guys behind. Wouldn't you like a bit of the tasty Stronger Britain (insert some actual yamming slogan here, I chose not to commit them to memory)?! Well, it's gone!
user13415013
:D, i'm not from india , but india have alot of population
user13415013
ok guys, bye, I will come after some days
user13415013
:)
user13415013
19:24
Thanks guys for voting, I've now unblocked , bye :)
Hello everyone. I'm looking for a Python library that will take a command string and break it up into its components. No, this is not for creating a commandline app so no argparse. For example rm -fr / would be the string and the library will break it up into rm, -f, -r, and /. So I can then do analysis on the structure of the command.
my question is , i have a blog okay , i can add new post from admin panel and give it name,url,img, small description then it appear in some html page and any user can click on img to read full article okay ( take him to other html page ) , so what i want to do is create the full article from admin panel and add it to post that i have created before , also i don't wan't create manully html page then go to urls and view.py and add it by my self
i want add post and full article from admin panel then django add it by auto to urls and views or without add it to views, just i want do that from my admin panel by auto