« first day (3993 days earlier)      last day (938 days later) » 

3:03 AM
@Kevin I mentioned this a couple of times a few years ago. In the late 90s, Greg Egan wrote some great articles on relativity & QM: gregegan.net/FOUNDATIONS "These articles are meant for the interested lay reader. If you can follow high school algebra and geometry, and aren’t afraid to take in a few new concepts — which is the whole point, after all — nothing here should faze you".
@AndrasDeak Egan discusses some of the issues in gregegan.net/SCIENCE/Rindler/RindlerHorizon.html "This web page was inspired by a discussion on the Usenet group sci.physics.research entitled “The Black Fishing Hole”, in which Edward Green asked for an account of precisely what would happen if someone lowered an object through a black hole’s horizon on a fishing line".
 
3:51 AM
@Kevin Even if you could do that, it wouldn't help much. "The idealisation, often used in Newtonian physics, of a “perfectly rigid body” that responds to a push at one end with the far end moving instantly in exactly the manner needed to maintain the object’s shape becomes even more absurd in special relativity, which imposes a limit of the speed of light on the rate at which any such influence can propagate".
The speed of sound through an object is the speed that a mechanical vibration travels through it. That's usually much lower than the speed of light.
It's possible that the speed of sound inside a neutron star gets up to relativistic speeds. But we're a bit hazy about what happens deep in a neutron star, it gets insanely difficult to model it accurately. Various things that we can ignore or approximate in less extreme conditions need to be calculated more accurately if you don't want the model to produce nonsense.
 
 
1 hour later…
5:26 AM
cbe
 
5:57 AM
I have problems delegating from the form action to the fastapi post route. My main.py is located at a folder (called backend) between the form-html, but writing "./backend/main.py/uploadImages" does not work
 
6:11 AM
Cbg
 
what do u mean by cabbage
its inappropiate to ask here?
 
MELON
 
I was outof game , don't know if other word than cabbage are currently used
 
7:45 AM
@AndrasDeak 🎱 Signs point to sleep
 
7:57 AM
Hello!
I use Ajax to send a value to my view.py in django
but ajax send this : /dashboard/?term=%D8%B3&_type=query&q=%D8%B3
How can i decode value of term?(%D8%B3&)
 
 
2 hours later…
10:00 AM
cabbage
 
10:48 AM
Is it salad language or word salad? Haha
 
To the regulars here, under what situations would it be more prudent to use a more (featured?) language like Java or C# compared to Python? Assuming somewhat equal competence or no pressing need to use any particular framework, what are some of the reasons you would use a more statically typed, boilerplatey language over Python?
 
it depends. in general, specifically for a language that's also a high level language like your Java or C# examples, you could argue that python is good enough. Often, the deciding factors are indeed the frameworks you need to use (say, android development you'd probably prefer java, or if you're using unity you have to go C#). So if you take that aspect away, there's not a lot left.
The other factors to consider are whether there's already some existing code base with one specific language, in which case it's worth just sticking with whatever language the existing codebase is using.
It gets more interesting if you consider languages that can fundamentally do different things to what python does. in those scenarios, you end up picking based on your needs at the time. Say, C or C++ for low level stuff or if you really need the extra performance, or perhaps rust as well.
in general, the ecosystem matters more than the language itself. most high level languages today can generally do the same set of tasks.
 
Except python 3, which isn't turing complete /s
 
hm, this sounds like an inside joke that i dont know the context of
 
11:03 AM
The author of LPTHW wrote something about why python 2 is better than python 3 or something like that, and that was one of his "arguments"
But it's ok because he later clarified it was only a joke, so funny
 
oh i see
 
@PM2Ring neat, thanks
 
i guess that is the personification of a "gift" that keeps on giving...
 
@astralwolf I wouldn't say any of these are more "featured". Python offers most if not all features people usually care about.
What's relevant is which features are actually understood by a compiler – iff you care for speed at all. In that regard I'd say unless you feel languages such as C++ or Rust are suitable for your usecase, you might as well use Python whatever the domain currently uses, or just Python for a fresh project.
 
I see, thanks for the responses all
 
 
1 hour later…
12:18 PM
@PM2Ring Looks useful, thanks. The first chapter has a lot of math, but very few greek letters. This is a promising sign that it's at the right level of accessibility for me
Whenever I lay eyes upon a "ω", I know I am doomed
 
Was chat for everybody down the last few hours?
 
No, not that I can tell. Granted, I was asleep. But usually I wake up to a banner on the page saying "we're having trouble connecting you" if chat conks out at any point during the night
 
nope
 
hmmm weird, must have been a local dns outage, because google and other stuff was working
 
@PM2Ring Good point. Ok, let's model each atom as a rigid sphere of radius zero, so it doesn't violate causality when an influence propagates through it instantaneously
This is an excellent plan and nothing can go wrong
[Episode title card: Kevin divides by zero in the next fifteen seconds]
Guys, you'll never believe what happened
 
12:40 PM
Currently questioning the wisdom of purchasing a novelty calculator that comedically explodes into a shower of confetti and glitter when one divides by zero
 
1:04 PM
@Aran-Fey It is Turing-complete though, right?
 
If a language has if and while, it is almost certainly turing complete
There are other combinations of features that you can use besides those two -- I think recursion is a popular one -- but if/while are the easy targets
 
Okay, welp, that was indeed a terrible joke from the LPTHW guy
I wish i could build a Turing machine but I'll need to find and infinitely long tape
 
There's a store that sells those, just down the road. Go south for infinity blocks, then turn left.
 
Kinda like in grade school when I built a volcano I understood how volcanos work. It's all baking soda and vineger. There is apparently a lot of that within our earth.
 
It is occasionally argued that a turing complete system is impossible to construct in reality, because you would need a storage device of infinite capacity. A zillion gigabytes isn't enough.
Not if you need to calculate the zillion-plus-one-th digit of pi
 
1:12 PM
One's imagination is infinite. Can I borrow someone's brain?
 
I'm not sure where I put mine. It responds to pings, but the nutrient tank is buried somewhere under a bunch of half-finished projects
 
I have just imagined and infinite tape. It goes forever in both directions. That was easy. Now, if I could just remember what was written on it.
 
Imagination applies lossy jpeg compression to the bits you're not looking at
 
Why is does the tape have to be infinite anyway?
 
Because 640K aren't enough for anybody
 
1:26 PM
"tape of sufficient size" would have been just fine
ya know, for the algorithm simulation aspect of this mental model
 
There's probably some category of programs where you can't easily predict ahead of time what its "sufficient size" is
Proposal: construct a machine that temporarily pauses when it runs out of tape, and sends an email to the administrator asking for more
They didn't have email in Turing's day, so that's probably why he didn't think of it
 
The tape doesn't have to be of actual infinite length, just potentially infinite. IIRC, the usual description is that the tape is unlimited. IOW, there's no "Out Of Tape" error state.
 
Then you'd know if a program stops or halts or whatever?
 
@Dodge except... there's a very good chance it wasn't. My bet is that was him trying to save face.
and now that i have explained it, i have ruined it. apologies, universe.
 
If you can see the code of program you know whether it stops, right?
> the halting problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program will finish running
When they say description do they mean code?
 
1:38 PM
When a Turing machine halts, it's easy to tell. You know ahead of time which states are the "halt" states, and you can always see what the machine's current state is.
"description" and "code" are basically equivalent there, yeah
 
@Dodge sure, though they used it in the sense of the actual algorithm/steps involved, that's why the lingo
 
@ParitoshSingh Ok, makes sense
 
Perhaps "description" is a bit more broad, encompassing anything that unambiguously describes what the program does. "Iterate upwards through the natural numbers until you find the one millionth prime number" is arguably a description, despite not being code
 
@Kevin No worries. As a science /maths explainer, Greg Egan's not quite as easy to read as Isaac Asimov, but he does tackle more technically challenging material than the Good Doctor ever attempted. Egan can even get away with the occasional equation in his sci-fi. He tries to keep the in-story info-dumps to the minimum consistent with hard sci-fi, but he does put extra technical info on his site.
 
@Dodge Not necessarily. Suppose I have a function that calculates the digits of pi. Then I write a program that iterates through those digits until I encounter one million 9s in a row. Even though this program is relatively simple, nobody knows whether it will halt or not.
People much smarter than me strongly suspect that pi is normal and that all finite digit sequences eventually appear inside it. But none of them have been able to prove it.
 
1:46 PM
@Kevin Ah, cool.
 
The classical example of the halting problem seems to be the program "don't halt if you halt". That's sufficiently edgy to convince me.
 
Another one is the twin prime conjecture. It's easy to prove that the number of primes is infinite. But we don't know if there are an infinite number of twin primes, i.e., primes like 11 & 13 that are separated by 1 number. So a program that prints all twin primes might halt eventually, or it might run forever.
 
but your gut tells you there are, right?
 
@Dodge It's a bit more definite than that. Consider "description" to be the actual source code of the program, or at least unambiguous pseudo-code.
 
The classic "don't halt if you halt" example is good for proving that the halting problem is unsolvable even if we proved that pi is normal and there are an infinite number of twin primes and just generally had enough smartness to prove or disprove everything that can be proven or disproven
 
1:53 PM
@Dodge Yes, I believe in unlimited twin primes. But it would also be interesting if a proof were found that they're finite. OTOH, it may be possible to show they're finite without actually being able to calculate the highest pair. That'd be a bit frustrating.
 
ah, life's little frustrations
 
It's not a good idea to rely on gut instincts on prime numbers. Smart people have made reasonable conjectures about the primes that turned out to be wrong. Sure, it's a lot easier to test stuff now, compared to pre-computer days, but we'll never be able to do empirical testing of really large numbers, even if we turn the whole observable universe into computronium.
 
"I have a proof for that one theory everybody was curious about!"
[cheers, clapping]
"It's a non-constructive proof, though"
[booing, someone throws a protractor]
Luckily that particular nerd had poor arm strength so the protractor merely clattered to the ground at the speaker's feet
Similarly to testing of the primes, the Collatz Conjecture has been tested for all integers below 2^68. But that's only 0% of all natural numbers, so it doesn't tell us much.
 
There are patterns with small primes that continue for larger primes, but which break down when you go even larger. Eg, the "prime race" between primes of the form 4n+1 vs 4n+3, see en.wikipedia.org/wiki/Chebyshev%27s_bias A more subtle pattern involves 2 functions that approximate the number of primes <n en.wikipedia.org/wiki/Skewes%27s_number
 
2:08 PM
Anyone can help me with this coroutine generator
def coroutine1(val):
    while True:
        next_cor = yield #next_cor = cor2 obj
        print(val) #20
        val -= 1 #val = 19

    #Dont signal a next() if received NoneType
        if next_cor != None:
            val = next_cor.send(val) #cor2.send(19)
                                     #WAITING for a 17, but Exception occurs

def coroutine2(next_cor):
    #next_cor = cor1
    while True:
        val = yield #val
        print(val) #19
        val -= 2 #val = 17

    #Dont signal a next() if received NoneType
 
The Collatz Conjecture page mentions the Pólya conjecture, which didn't have a disproof until a counterexample was proven to exist around 1.845 × 10^361. A good example of how testing lots of small values won't give you the right answer
 
@Kevin I hope there's a conjecture about the lowest counterexample for the Pólya conjecture
 
I can post a version withotu comments, but anyway here is the output
20
19
Traceback (most recent call last):
File "<string>", line 28, in <module>
File "<string>", line 9, in coroutine1
File "<string>", line 21, in coroutine2
ValueError: generator already executing
 
They later found a smaller counterexample, about nine digits long. Unclear to me whether this is the smallest counterexample.
@astralwolf I guess coroutine2 isn't allowed to call send on coroutine1 until coroutine1 suspends itself by reaching a yield
Is it possible for you to refactor your code so that each function uses only yield or only send, but not both?
 
@Kevin hasn't coroutine1 alreday suspended itself in the last line, via val = next_cor.send(val) ? Control was passed to coroutine2 after that, no?
 
2:16 PM
@Kevin I was just about to mention that one. :) A couple of months ago, in response to bogus claims about a proof of the Riemann hypothesis, I did a Sage / Python program to make nice SVG graphs of that cumulative Liouville function.
 
@Kevin i will try this and report back, still inept on coroutines tho
 
Control is passed, yes, but not the way you want
I'm not sure if I'm using the term "suspend" properly, but the way I'm imagining it, just calling a function doesn't make the caller suspend execution. Only a proper yield statement will do.
I find coroutines pretty challenging too. I try to offload a lot of the work to asyncio when I can.
 
@AndrasDeak Glad I could help the cause
 
> Note that calling any of the generator methods below [including send()] when the generator is already executing raises a ValueError exception.
@AlexandreMarcq I'd make it clear which languages you checked, even if it was "all of them"
 
2:23 PM
@AndrasDeak Do you know if I can edit the message or do I have to make a separate comment ?
 
@AlexandreMarcq you'll probably have to add a new one, but that's alright
 
If normal programs are like chess, then programs with multiple interacting generators are like 5D chess with multiverse time travel
 
I think if you approve without a comment there's nothing to edit
 
Alright, it's done thanks
 
The Internet needs better ways to share really long urls
 
2:33 PM
The first link worked didn't it ?
 
Yeah. I have an earlier version that I managed to post on the Math chat.
 
it worked if you pressed "expand message" or whatever
 
I'll try one more time...
 
Success?
I tried it out myself in the sandbox and I think it worked...
Modulo a bit of whitespace oddness
 
@Kevin Weird. I 1st got an error message, but then it worked.
 
2:40 PM
I'm going to blame... Caching.
 
Anyway, it's pure Python & Numpy, apart from the actual plotting, which is done by Matplotlib, under a thin wrapping of Sage.
It takes ~15 seconds to count the factors of the numbers under m, but then you can set lo & hi to zoom in on the graph, to look for crossover regions.
You can set m to a higher value than 1000000, but if it's too big, the server will just abort the job.
Of course, if you modify it to run on your own machine with different plotting routines, you can set m as high as you want, assuming you have the RAM. :)
I did a fun one the other day. It can plot the distance between a pair of Solar System bodies. It uses JPL Horizons data, which is about as good as it gets. See space.stackexchange.com/a/55061/38535
 
2:55 PM
is it possible to construct 2 coroutine functions where each function has a yield statement in it?
instead of using .send()
something like that pseudocode form wikipedia en.wikipedia.org/wiki/Coroutine#Comparison_with_subroutines
 
Python's yield statement doesn't natively understand what it means to yield "to" a particular thing, it just blindly yields to whatever context owns it. But I think it would be possible to write a little engine that could handle things with more sophistication
 
@astralwolf please don't post code as images
including pseudocode
 
There's also a good chance that asyncio can do this out-of-the-box, but researching that would not be fun for me, so I'm skipping it
 
anything text, really
 
var q := new queue

coroutine produce
    loop
        while q is not full
            create some new items
            add the items to q
        yield to consume

coroutine consume
    loop
        while q is not empty
            remove some items from q
            use the items
        yield to produce

call produce
here's the pseudocode
@AndrasDeak just curious why no images?
 
3:02 PM
my text-to-speech system can't read them
 
wow, how does one set up a TTS to read code, intersting
 
170
Q: Why not upload images of code/errors when asking a question?

Ashley PieterseI am new to Stack Overflow, and I have asked about 5 questions so far. I have uploaded images of my code on most of my questions. On two separate occasions, two different users advised me not to upload images of code and outputs. One even jokingly said that, every time an image of code is uploade...

 
@astralwolf I don't know, I don't use TTS
 
Not all of the stuff in that linked post about not posting images of text is relevant to chat, but most of it is.
Images of text can't be searched, and we can't copy & paste from them. And if it's an image of code, we can't run it.
 
Here is a silly and hastily constructed proof-of-concept of two generators that cooperatively multitask with the help of a very small engine at the top level. After a generator does a piece of work, they yield the name of the generator that they want to run next. The engine assigns that value to g and runs it in the next iteration.
 
3:09 PM
@Kevin by context you mean execution order on the call stack right?
 
Sorry, I was a bit vague there. It just blindly yields to whatever code called next or send on it.
(Note that a for loop may call next on your behalf, behind the scenes)
 
I see.. are generator objects even placed on the call stack? (ok im pretty sure they aren't as they are invoked via methods, not by calling them directly)
 
@astralwolf Your "yield to" isn't what coroutines do. Those are continuations.
We don't do them here. 🧐
 
One thing I'm not happy about in my proof-of-concept: the generators use global variables within their yield statements. There are a number of designs that could work around this. Perhaps each generator could yield a string that identifies a generator, and the engine keeps a dict of string:generator pairs.
Or perhaps the generators could yield nothing at all, and it's the engine's job to decide what generator gets to run next. Just executing them alternately would be sufficient for this simple example.
 
Coroutines can only yield to their "caller".
 
3:14 PM
Truth
 
You can contruct something akin to continuations if said caller can switch between coroutines.
That's basically what event loops in async frameworks do.
Give or take some aspirin.
 
@astralwolf I don't know the specifics, but certainly anything that executes must be placed on a call stack. Generators might get their own offshoot, or something...
@MisterMiyagi And it's basically what my hastily constructed prototype does. I hope.
 
If you don't mind going the extra mile, IMO it helps to build your own generator – i.e. a class with __next__ and send. That should clear up the question of what gets put on the call stack.
@Kevin Indeed. Welcome on the path to insanity.
Erm. I think you know the drill already. :P
 
I've been sitting on this path for who-knows-how-long, and the bus still hasn't come
 
Hi All, anyone know how I can check request.method on API call with python/rest-framework on Django? I'm trying to validate data only if it's a POST request method
 
3:19 PM
@MisterMiyagi That ^. Generator functions are convenient, but they can get confusing if they try to get too fancy.
 
@Kevin Aha. You have to await it.
 
Theoretically, generators don't give you any additional power. In other words, anything you can do with a generator, you can also do without a generator. Sometimes it takes ten times as much code, but you can do it.
So if generators give you a splitting headache, there's always another way
 
Last time I messed around with a pair of interacting generator functions that used send, it almost worked, apart from an annoying edge case with the first yield. I ended up just confusing myself & abandoning it. :)
 
I once used cooperating generators to replace the native call stack entirely, because I wanted to recurse as deeply as I wanted. It worked, but the things I saw... We dug too deep.
 
My silliest generator-based program is a recursive filter that generates primes. It works ok, at first, but it gets pretty slow, after 10,000 or so, due to the recursive chain of 25 or so filters.
 
3:26 PM
10,000? But that's only 0% of all primes :-/
 
Computing 10 primes gets you as close to 100% as computing 10000. So just call it a day and head for the pub.
 
The concept is to make a prime generator that just keeps going, expanding itself as required. It's much more efficient to just use a sieve, if you only want a fixed number of primes. One option is to use a segmented sieve, i.e., sieve blocks of (say) 1 million numbers at a time. But it's kind of fun to come up with other schemes.
 
Keep it up and you might accidentally find all the twin primes one day
 
Betcha a turing machine could do it.
Python ain't Turing complete. □
 
If I understand the problem correctly, it wouldn't be too hard to write an embarrassingly inefficient twin prime generator. But whenever it goes quiet for a million years or so, you can never be sure whether it's completely done, or just taking its time
 
3:35 PM
There's an old Game of Life pattern that generates primes. It creates a regular horizontal stream of spaceships, and uses gliders to kill off the ships at composite positions in the stream. Someone modified it to only produce twin primes.
It's basically a sieve of Eratosthenes constructed using glider gun generators. It's impressive to watch it growing, even if it isn't a very fast prime generator.
It's easy to prove that there are strings of composites of length n for any positive n.
 
Efficient in terms of lines of code, if nothing else :-)
 
n!+2 through to n!+n must all be composite, so that's (at least) n-1 composites in a row.
 
Interesting, I must investigate that once work stops consuming 51% of my brainpower
 
The earlier stuff about rigidity in relativity inspired me to write a tiny program to calculate how close a steel beam can get to a black hole before it gets ripped apart due to the tidal stress. I posted it to a comment on a Physics.SE answer, read that answer for the background info.
I turned that tension formula into a Python programPM 2Ring 10 hours ago
So a 1 metre steel beam, falling vertically towards a 3 solar mass BH gets ripped apart at 112.176 km from the centre of the BH.
 
4:12 PM
@Kevin hey kevin, in your example, why was g = producer necessary? If i remove it I get an Index Error exception from pop
 
@PM2Ring and what's the radius of the event horizon?
 
Thanks to both of you (and @MisterMiyagi) by the way, ill read up on continuations tomorrow
 
@astralwolf The first assignment to g tells the engine which coroutine should run first. If you instead tell the consumer to run first, it won't have anything to consume, because the producer hasn't added anything to the queue yet.
That said, I'm surprised you're getting an IndexError. Even if the consumer runs while the queue is empty, it shouldn't try to pop from an empty queue. It should just go back to sleep.
 
@Kevin I changed g = next(g) into producer = next(producer) as well. Hang on let me double check my code
 
If you're trying to integrate my code into a thread-based or async framework, that might have something to do with it. My functions aren't atomic or threadsafe, so a race condition might occur if control gets passed around at the wrong time
 
4:21 PM
Yup, I think in the process of simplifying the example I broke it somehow. Nope, Im just playing around with it on its own. Ill take another dive tomorrow
 
Ok 👍
@AndrasDeak The Internet tells me that a 3 solar mass black hole has a schwarzschild radius of 5.507 miles.
Or 8.862 km if you prefer
My layman's mental model tells me that a black hole has about as much gravitational influence as a star with the same mass. I'm imagining teleporting a steel beam 112 kilometers from the center of our sun... Yep, it doesn't last long. Data checks out.
 
4:59 PM
@AndrasDeak That's the Schwarzschild radius: 8.860 km. I chose 3 solar masses as the default because that's pretty close to the smallest black hole that can be formed in a core collapse supernova.
@McMidas Sorry, but we request that you don't ask about your fresh questions on the main site here. Please see sopython.com/chatroom
 
My uninformed belief is that there is no "date range" data type, so you'll have to make do with two datetimes
 
Melon
 
5:18 PM
Aaand it turns out it's one of your recent questions. Same rules apply as for McMidas
 
I need to make a search and obtain data with python
I don't know how to access html elements when I access the webdata
take for e.g., this snippet of code;
```
import urllib
import bs4
url = 'https://www.nndc.bnl.gov/ensdf/'
content = urllib.request.urlopen(url)
read_content = content.read()
soup = bs4.BeautifulSoup(read_content, 'html.parser')
pAll = soup.find_all('p')
print(pAll)

```
the output is,
```
[<p>
<span style="color: rgb(204, 204, 204);">NNDC Databases:</span>
<a href="/nudat2">NuDat</a> |
<a href="/nsr">NSR</a> |
<a href="/xundl/">XUNDL</a> |
<a href="/ensdf/">ENSDF</a> |
<a href="/mird">MIRD</a> |
<a href="/endf">ENDF</a> |
<a href="/exfor">CSISRS</a> |
<a href="/sigma">Sigma</a>
</p>, <p id="stderr"></p>]
```
I don't see the search bar element in this output except other websites such as NuDat, XUNDL, ...
 
@Kevin thanks, @PM2Ring likewise
 
Well, first of all, the search bar isn't a p element, it's an input element. But more importantly, what's the point of finding the search bar in the HTML? It's not like you can interact with it or anything
If you want to perform a search, you have to figure out how the corresponding HTTP request for that looks. Open up your browser console, run a search, and then look what the HTTP request looks like
 
@Aran-Fey I need to interact with search bar by typing a string and search for it
 
5:33 PM
And how exactly are you planning to type something into a piece of HTML code?
That's not how that works, like I said
 
@EnthusiastiC please see our code formatting guide to chat and practice in the sandbox
 
You basically have 2 options here:
1) Figure out how the internet works
2) Use selenium
 
it's just a series of tubes
 
Aran-Fey is correct, but you do not want selenium for this task. If you don't want to track the HTTP request, which can be difficult, contact the proprietors of this data. It is a huge dataset and sponsored by *multiple national labs. Im sure you can have access somehow
 
Bless the websites that make search accessible via url query string
 
5:41 PM
bless them even more if they have a dedicated API :P
 
Much nicer to fetch the results of example.com?query=foobar than to dig around through ten layers of obfuscated ajax
Sometimes the dedicated API is hidden inside the ten layers of ajax, which gives me mixed feelings
 
but Selenium is like interacting as a human with a web browser which I didn't intend to do. I just want to grab data for any string I type in the search bar and save it in a file for later use.
 
Maybe it gives me a couple extra bells and whistles not exposed by the UI, but dang if I don't have to work for it
 
@Kevin dedicated public API
 
If the code is executing on my computer, that's public enough >:-)
 
5:43 PM
the assumption being, "please don't parse our html if you can just ask for the data directly"
 
@EnthusiastiC this is how a human uses the page, what you describe
just ask the scientists responsible
or look into the exact datasets you want, the info is there
 
@AndrasDeak Filled with cats?
 
Recently I automated a task involving browsing a web site, and the resulting script is guaranteed to make fewer requests to the server than I would have, as an imperfect human. You're welcome, web site.
And I'm not being sneaky with my metrics by saying I'm making fewer requests per execution, and then I turn around and execute the script 100 times a second. It runs as often as the manual approach did.
 
6:30 PM
@jeremy @Aran-Fey I think my question is about understanding HTML more than Python
except that, I don't know if I am able with requests and bs4modules to perform a search action, i.e., how to translate pressing search button into HTML?
 
Send a HTTP request to the correct URL with the correct headers and parameters and body
 
good to know.
 
1 hour ago, by Aran-Fey
If you want to perform a search, you have to figure out how the corresponding HTTP request for that looks. Open up your browser console, run a search, and then look what the HTTP request looks like
 
6:45 PM
@EnthusiastiC again, stop
Mar 10 at 17:25, by Andras Deak
Feb 20 at 12:29, by Andras Deak
@EnthusiastiC I tried helping you multiple times. Each time I saw the same thing: you either not reading properly what you're told, or just not being able to understand what people try to tell you. Then you keep asking the same thing over and over again, hoping to get the answer you expect (but then why ask in the first place?).
To repeat what I said next: please try to ask for help elsewhere now, @EnthusiastiC. We're not getting anywhere.
 
6:59 PM
I'd probably be better off spending half an hour finding a good webscraping tutorial rather than answering the same question every few weeks
Ok, never mind. I underestimated how bad and obnoxious written tutorials are (who the yam makes a tutorial website that constantly flashes "(1) new message" at you?!), and I don't have the patience to watch video tutorials
Hooray for the internet
 
7:27 PM
@Aran-Fey as usual if you want something done right you have to do it yourself
 
@EnthusiastiC Aran-Fey explained it to you. the page you are looking at with a search bar is an interface. it can only be used to trace back the API that is being used. you need to open your network console and start tracking your request (which is either processed via AJAX through some type of API, or directly using your browser in some POST request)
open up dev tools and use your network tab. submit the form and trace it. I see form data being passed in a POST header: nuc=208Pb&nsrch=Search&searchType=quick&datasource=ensdf
now use requests/cURL or something to pass similar headers depending on your query to the request URI (RL: https://www.nndc.bnl.gov/ensdf/DatasetFetchServlet)
then you can start HTML scraping
 
8:17 PM
I don't know if parts of it were there already, but numpy/scipy is definitely new there
 

« first day (3993 days earlier)      last day (938 days later) »