« first day (3163 days earlier)      last day (1802 days later) » 
00:00 - 14:0014:00 - 22:00

Today is a day for losing rep it seems
 
./pat
 
o/ morning all
 
morning
 
@ParitoshSingh I was reimbursed and the question was closed so all is good :)
 
2:14 PM
small victories! :)
 
Perhaps coincidental but I just got 2 upvotes on other answers back-to-back. If it's someone here, please don't do that, I didn't mean to make it seem like I was actually bothered
Now 4, so it's gonna get reversed.
 
If we all upvote enough, can we get ourselves and roganjosh banned?
 
most likely, yes
 
i think only if one person is upvoting/downvoting one person, you will get reversed
 
i presume it wouldn't be a ban outright at first though
 
2:22 PM
also 2-4 upvotes is not enough for roomba to catch up
 
4 will be flagged, and I honestly don't know what's going on.
 
same as when downvoted, i'd say just ignore.
 
that is if a single person upvoted! If 4 different people upvoted for u, no flagging
 
@ParitoshSingh I'm single and someone clearly loves me. I already know I'll be met with crippling disappointment tomorrow with a -40 but... who is this person?!
 
With all of the RO power vested within me, I ask everyone to only upvote posts if they're actually good. That is all.
 
2:26 PM
actually if u want, post the links of the answer which got upvoted, and someone else will downvote them :)
 
No. Let's not. :P
 
or just edit the ones which got upvoted, and if someone was from this group, they might revert their upvote :)
 
@roganjosh :P well well, now don't get our hopes up too much.
 
@DeveshKumarSingh Or.... leave it to the automated system
 
that as well
although, do you want more upvotes :P
 
2:29 PM
@ParitoshSingh I take it as a sign I need to do some peacocking. Maybe an epic one-liner answer; that'll seal the deal
 
sounds like a plan!
 
Guys. Let's just downvote everyone's answers in this room. Just to be sure we can't be accused of colluding.
 
i... think that'd definitely be counted as colluding :P
 
... Sure. You guys collude on the downvotes, I'll start my hunt for a 1-liner. Then we're all happy
 
@roganjosh not flagged and don't worry about it
 
2:33 PM
@ParitoshSingh First date: "So, how awesome are ass expressions?!" Yeah, I'll manage my expectations
 
ha. plot twist, what if they're into that?
 
@roganjosh pats sad walrus don't worry, he'll see your worth soon enough
 
Oh, wow. You think I was the one delivering that line? No, that's my imaginary cue to get up and leave
 
.. which makes the walrus sad
Or did i just experience a major woosh?
I just always assume i'm the only one who likes 572 in this room :p
 
2:44 PM
I like assignment expressions for exactly and only the use case of if m := re.match(pattern, s):
 
I was just trying to encapsulate the moment when I meet the person that somehow thought I needed +40 in the space of 2 minutes. Only to find out that they loved assignment expressions. I mean, if I can make walruses cry with my story, maybe I have a blockbuster on my hands
 
All other use cases may take a hike
 
@Kevin how appropriate, that's exactly the use case why I dislike re
 
stdlib devs, please implement a method re.get_last_match() so I can do if re.match(pattern, s): print("Found match:", re.get_last.match().group()
 
3:05 PM
I think you can do that with finditer
for match in re.finditer(pattern, s):
    print("Found match:", match.group())
 
@Kevin without that, people would have never been on board with 572.
Or rather, even less
 
@MisterMiyagi I think we've discussed this before. Now I will say "yes, although to match the behavior of match exactly you'll need to put a '^' in front of your pattern" and you will say "that's not too big a deal" and I will say "but I am terribly lazy" and you will silently agree.
 
So I've got a list and wanting to export it to something another program can read. Is a text file the fastest or is there a faster/more optimized way?
 
@biggi_ I expect that just directly writing the string representation of the object would indeed be faster than using any of the popular serialization modules such as json or pickle.
 
@Kevin I don't think the stdlib devs mess around with the internals of the regex engine. github.com/python/cpython/blob/… ## Secret Labs' Regular Expression Engine
 
3:11 PM
This is assuming that the other program knows how to parse Python list literals, which is definitely not a sure thing.
 
I'm just opening/writing a text file at this point (I guess using my own serializer).
I've go list that I'm just doing a file.write to
 
@Kevin Even using it to grab the True-ish item found by any ?
 
@PM2Ring I welcome other users to enjoy that use case, but I'm not planning on doing so.
 
Ok.
 
@biggi_ If you're also writing the deserializer, remember not to use eval or else anybody with write access to your text file can inject malicious code that erases your hard drive.
 
3:16 PM
@biggi_ Is the other program also in Python?
 
All I'm doing is writing a list to a file XD
@PM2Ring I guess it could be
Originally it wasn't going to be, but it seems like all things in corporate life, someone with little to no understanding of how things work is running things ;)
 
I'm not sure whether you're saying "I'm writing a list to a file and I don't particularly care if any other program can read it" or if you're saying "I'm writing a list to a file and it's somebody else's responsibility to write a program that can read it" or "I'm writing a list to a file and I'm not going to worry about writing a program that can read it until I'm finished writing this program first"
 
It's a: I'm writing a list to a file for something else to interpret. This was going to be done in LabView, but thinking about it, I might be able to do all the calcs in Python then spit the final thing out.
 
@biggi_ What's in the list? Strings? Integers? Floats? Something else?
 
floats
 
3:19 PM
You know what's good for serializing a list that needs to be read by a program that won't necessarily be written in Python? json.
 
It's a 360 element list with floats. So like right now I have it where I can open the text file and I can read it myself. However, it seems like the text open/write is taking a bit of time (longer than it should), so was just seeing if there's a better way to write it.
But thinking on it more, it might all be for not if I can just manipulate what I need in the same program then spit out the final product.
 
Oh, only 360 elements? I figured it was a couple million, since you were worried about speed.
 
Nah, for some reason it seems like it's taking ~3 seconds to open a text file and write.
Which seemed like a long time
 
Regardless of how long it takes to open the file, for a list that small the difference between writing the string representation and using json is practically immeasurable.
So don't go out of your way to devise your own serialization format :-)
Three seconds does seem like a long time to open a file though.
 
@biggi_ That is weird. Unless the disk is almost full, or that directory has many thousands of files in it already.
 
3:23 PM
C:\Users\Kevin\Desktop>python -m timeit 'open("test.py")'
5000000 loops, best of 5: 48.7 nsec per loop
 
But yeah, doing the processing in Python, possibly using Numpy, makes more sense than exporting it.
 
Nah, it's on a 1TB SSD that's like 10% full. And it's an 8 core/16 thread engineering machine....and I freshly restarted.
 
Maybe multiple processes are "fighting" over the file. If your program is constantly writing to the file, and another program is constantly reading from it, that might gum things up.
 
Kevin: it's only one program writing to it. It's just my pc being wonky I guess.
 
Interleaved read/writes?
 
3:25 PM
nope
 
I'm curious what my timeit command would say on your machine.
If it takes three seconds to open a file, even one that has nothing to do with your project directory, that's concerning.
 
perhaps python startup is 3 seconds? Unclear methodology.
 
Nah, I have it in a loop, every iteration it should write.
 
There has to be some kink in the code or measurement causing overhead
 
If you haven't done so already, move the open call outside the loop.
 
3:28 PM
Lemme do some digging, I'll report back in a bit.
 
#good
with open("foo.txt", "a") as file:
    for i in range(10):
        file.write(str(i))

#bad
for i in range(10):
    with open("foo.txt", "a") as file:
        file.write(str(i))
 
any idea if there is any method to do this: stackoverflow.com/questions/56600757/… without creating a new df?
 
@Kevin I was just thinking the same thing. But even that shouldn't take 3 seconds to open, append & close 360 times.
 
@anky_91 since the string header probably breaks numeric column types I suspect not, but I'm not a pandas person
 
I wish I knew enough metric to multiply 48.7 nsec by 360. You're probably right though.
 
3:32 PM
@AndrasDeak I am not aware of any other methods too. :)
 
@Kevin 50x400 - 10%
18 microseconds
 
Yeah, but I want to convert the result to seconds and I forget what "nano" corresponds to.
Google says 1.7532 × 10e-5 seconds. Thanks, Google.
 
Ah. Milli - micro - nano decrease by powers of 1/1000
 
Kevin: is in a while loop. Just every iteration it writes one thing.
 
@biggi_ we won't progress without an MCVE
 
3:34 PM
SI system designers, please change the "milli" prefix to "thousi", thanks
 
That's the one that is named right :D
 
In the Deomcratic People's Republic of Kevin, there are one million millimeters in a meter, and one thousand thousimeters in a meter.
So easy.
 
And powers of 12? Dosimeters?
 
I think we've had this conversation before. Now you will say "there is actually a very good and logical explanation for the way it is now" and I will begrudgingly agree with your very convincing explanation, and then I will forget about it ten minutes from now
Much in the same way I forget why "math" really should be pluralized as "maths". It just slides off the teflon coated surface of my brain.
 
It's just milli as in millennium. Same as centimeter for century.
I.e. blame Latin
 
3:38 PM
I also want to change a millennium to mean a million years. If nothing else I'm consistent.
 
Some folks (like us) use decimeters for 0.1 meters i.e. 10 centimeters i.e. ~4 inches
Also deciliters \o/
 
It's a unit that really doesn't make sense
 
Which one?
 
decimeters/decileters
 
Better than volumetric kilograms fluid ounces
Expert level: dekagrams :D
 
3:41 PM
I've never known its real value beyond adding confusion
dekagram... that's one I haven't heard of
 
You should live somewhere where it's used. If people use it it's meaningful.
@roganjosh basic foodstuff unit here. 10 grams = 0.01 kilos...
 
I'd be totally gung-ho for metric if I was raised in a society that teaches you what the prefixes correspond to.
It's too late for me now, my brain has hardened into a flimsy chalk-like substance
 
Umm, I'm in the UK. I was also a Chemical Engineer. You don't need to translate 10g for me :P
 
@Kevin honestly most people probably don't know them either. They learn what they use.
 
There are only two units I'm truly irritated about and that's the cal and the Cal
 
3:44 PM
@Kevin does "silently afk" count as well?
 
grocers won't know nanoseconds, even micro seems doubtful
 
@MisterMiyagi That'll do in a pinch.
I changed my mind, I'm also annoyed about "kilobyte" meaning like four different things
 
No, they retconned it to mean 1000 bytes :'(
 
Like the vengeful elephant, I don't forget and I don't forgive
 
How do you feel about Pluto?
 
3:46 PM
It's a planet, damn it
 
It continues to move around the sun regardless of what labels we apply to it. Pluto is strong and independent and doesn't need us to tell it what it is.
 
And now Planet X is really planet IX
 
@Kevin and as a strong, independent object, it continues to exert its influence on our daily lives. Astrologers also don't forget
 
FWIW, Pluto's mass is less than 20% of the Moon's mass.
 
4:42 PM
The moon can be a planet too if it wants. It's the largest visible object in the sky after all.
 
poor Pluto.
 
en.wikipedia.org/wiki/Angular_diameter tells me that the Sun has an angular diameter of 31′27″ – 32′32″ and the Moon has an angular diameter of 29′20″ – 34′6″ and it's not clear to me whether these are given as ranges because we don't have good enough tools, or if it's hard to define the exact border of a ball of plasma, or what
Explanation 3: elliptical orbit
 
Doesn't the rocking back and forth of the Earth's axis account for an apparent change in diameter?
 
@Kevin I thought you were joking, because obviously the Sun is much larger than the Moon :P
 
The sun, the moon, and a nickel held at arm's length all have the same largeness.
@Dodge I don't think the Earth's nutation has much to do with it.
The wiki article on Supermoons tells me that the change in the moon's angular diameter is mostly because of its elliptical orbit
 
5:02 PM
We might agree that distance to the object would change the apparent diameter (which is probably different than angular diameter) and for those far from the equator the distance would change with nutation (TIL), but negligibly so I guess.
 
Hello, I am having my python panda returning response that contains NaN. This is showing an error in the frontend SyntaxError: Unexpected token N in JSON at position 15164 Any advice on what to do with that? should this NaN part be fixed on the backend python? I tried several fixes on the frontend javascript JSON.parse and stringify and such but to no avail. Any ideas how to fix that?
 
This sounds like something that needs an MCVE
handling nans on the python side sounds reasonable, yes
 
basically the python code is pulling data from CSV files, where it finds nothing, it posts NaN
 
But you have 1. pandas, 2. requests, 3. Nans, 4. jsons and 5. parsing in JS. The connection of these is unclear.
 
5:15 PM
i want to know how to fix the NaN on the python side and if this is the right approach... what i tried is df = df.fillna('') i replaced it with empty string, things work on the frontend now, but i am not sure this is the right approach
 
How do you pass the data to the front end?
 
just returning the response
 
@JoeSaad it's the right approach if you want to replace nans with empty strings.
 
Returning the response how? Is this Django or Flask or other?
 
Just to be clear we can't help until we see an MCVE.
@roganjosh and I'd rather not play battleships
 
5:18 PM
i was hoping the response to contain null instead of NaN
 
I'm agreeing with Andras on this
 
You have to at least show df -> json -> request complete with example df
 
The smart way would be to pass your dataframe as a JSON string: response.post(..., json=df.to_json(orient='records')) and decode it on the other end
NaNs are converted to JSON standard null type
 
can a json response contain null and still work without an error?
 
uh, yes. it's in the spec
 
5:21 PM
if i do df.fillna('null'), is this considered right?
 
No
 
no, that's a string which says "null". Very different things
 
@JoeSaad stop. Now.
 
Didn't we have a conversation a whole lot like this last month?
 
Go put together an MCVE or read elsewhere.
 
5:22 PM
I remember being confused that dumps has an allow_nan parameter but loads doesn't
 
@AndrasDeak i am trying to understand general questions here.. is there a problem with that?
 
Yes.
 
so it is better to use loads
 
Read what we've been telling you. What I've been telling you.
 
Andras: Yup, I was getting ready to put one together, but something made me think it wasn't code.
 
5:23 PM
I hope you didn't come to the conclusion "it is better to used loads" based on my messages, because that has nothing to do with what I was saying
 
@Kevin tried it on my personal pc at home on lunch, everything worked well, still slow on work PC. Apparently work has some exe filter that filters requests like that one and was drastically slowing it down (to keep ransomware/etc away). Quit that process and now all is working well.
 
Huh, weird
Glad you've found it
 
@Kevin yes, that was a problem last month then i started doubting the approach of mine of using fillna()
 
Andras: I know. That's why I wasn't posting code, it was more theory type stuff. Something wasn't feeling quite right, glad we got that taken care of. Apparently it's just some wonky IT thing that as they explained "is trying to keep batch scripts from installing junk with notepad"
Which doesn't make a lot of sense, but hey, whatever they say I guess.
 
Great counter-measures :|
Like when you can't take water on plane trips
@biggi_ the reason I wanted code is that you can never know if the other party knows what they're talking about. The 3 seconds may have been an artifact of a misunderstanding.
 
5:28 PM
I agree :) I should have posted, you are 10/10 correct.
 
But it's fine
 
I was on a grounded plan for 4 hours. I asked for water but they weren't allowed to give it to me. But they were allowed to give boiling water with ice cubes in it. I think my brain melted right there.
 
@Dodge If the calculations I've just done on this cocktail napkin are correct, then the angular diameter of the moon doesn't change much depending on whether you're viewing it while it's directly overhead or while it's on the horizon. equivalently (or nearly so), it shouldn't matter if you view it from the equator or the north pole. It's a difference of about 2%.
 
@biggi_ the difference between someone like you who knows what they're talking about and someone who doesn't is exactly that you can figure it out without having 3 people tear all their hair out :P
@Kevin something something illusion
that's the largest effect of all, for humans
 
haha i agree
 
5:31 PM
I'm not completely confident in my cocktail napkin, however, since it says that for a moon-to-planet distance of 385,000, a moon radius of 1737.1, and a planet radius of 6371, the angular diameter of the moon would be half a degree. Which is way off.
>>> import math
>>> math.degrees(2*math.asin(1737.1 / (385000-6371)))
0.5257328294998244
 
@Kevin what cocktail did than napkin come with? :p
 
Blue, with a tropical umbrella.
 
@Kevin atan
although for small angles it doesn't matter
 
True. I tried atan also and got 0.5257272965951905
 
@Kevin linear vs spherical degrees perhaps?
 
5:34 PM
I was using asin because en.wikipedia.org/wiki/Angular_diameter#Formula said that's better if you're not sure whether the apparent edge of the object is the same as its tangent points for a viewer at infinity
 
it should be close enough, probably, assuming I understand that correctly
 
Yeah, I think the moon is far enough away that it doesn't matter.
 
Hmm. Was it wrong of me to assume that there are 360 arcminutes in a degree?
 
unless it's imperial inch-degrees
@Kevin indeed, it's all base-60
degrees are the hours, arcminutes and arcseconds are minutes and seconds
 
5:38 PM
Ok, in that case my answer is not way off, and in fact within the range specified
 
We may have found your arcenemies.
 
faith in cocktail napkin restored.
 
lol! But it was behind a paywall? Still pretty lame of MS.
 
and they are going opensource, and calling the project MAlt, oh the irony!
 
5:47 PM
hello
I need a selenuim help
 
Hmm I appreciate that our moon chat dovetails into a selenium problem solving session.
 
@piRSquared you mean the article I linked? It loads for me.
 
@Kevin hope it wasn't about flat moon!
 
It kind of was. There are two formulas for calculating angular diameter, and the one that uses atan is only appropriate for flat things.
 
aah, maybe you are a flat planetary bodier in disguise
 
5:52 PM
I couldn't work out the problems with Gravity 2 so I gave up on that.
 
are this funny chat/
 
If you're asking "are you guys just goofing around? Because none of this seems very helpful to me", you are correct. Feel free to ask your question.
 
@piRSquared some options chat.stackoverflow.com/transcript/message/46506962#46506962 (noscript ate the paywall)
 
@AndrasDeak yeah! It loads then tells me to sign up while dimming the content... ok
 
5:54 PM
i want to change class inner text using selenium ,can any one help me
 
Microsoft might be onto CERN's plan to build a time machine and take over the world
 
@Kevin I guess arcsin is more exact in a way. But then the distance of the body has to be corrected.
 
hey any cooking experts here? We need your assistance
 
@cs95 they already have, and we're in the "and THAT'S why you don't build a time machine to kill Smurnox The Unholy" timeline
 
@mtesta010 what have you tried? What's happening instead?
@cs95 cooking.stackexchange.com probably ;)
 
5:59 PM
@cs95 if its Indian I can help. :P
 
@AndrasDeak is that a reference? "Smurnox The Unholy" returns zero search results on google D:
 
Thank CERN.
 
Aaaah. El Psy Congroo
maybe someone can cook up a to throw at that cooking question
 
d=driver.find_elements_by_xpath("//*[@class='myclass']")
driver.execute_script("arguments[0].text = arguments[0];", d, "testing");
 
That question was obliterated
 
6:03 PM
I'd rather it had more delvotes and fewer downvotes...
 
@AndrasDeak Well, the downvotes are cancelled now.
 
why?
 
@PM2Ring no, the rep loss is cancelled. There's no way OP can recover from that if they clarify their question...
with 1 rep they can't go into negatives anyway
 
@Kevin Yes. And the Moon's orbit around Earth is more eccentric than Earth's orbit around the Sun, so the range of the Moon's apparent diameter is larger than the Sun's.
 
Please join me in designing the web page, isthemoonbiggerthanthesunrightnow dot com, which displays "no" or "yes" depending on their relative angular diameters
I'll start. <html><head>...
 
6:12 PM
@Kevin That should be fairly easy, using Astropy. At least, I assume it is, I've never used Astropy myself, but it's got a good reputation. ;)
 
@Kevin I can help you with scrapping. When the project is over I mean.
 
can any one help me?
 
FWIW, calculating Moon orbit stuff is a bit painful because the Earth-Moon system is almost a double planet. It doesn't quite qualify because the barycentre is inside the Earth.
 
*wiggle wiggle wiggle*
 
@mtesta010 Hmm, can't say I know anything about Selenium. I didn't know it was even possible to change the information on the page; I thought it was all read-only.
Except for like check boxes and stuff
 
6:19 PM
@mtesta010 - there may not be any takers on Selenium questions in the room just now. You may have better luck just posting a question. A tip: be specific about what you want, what you tried, what you expected, and what you got instead.
 
Lunar theory has a long & noble history. The major perturbation terms used in calculating the Moon's orbit even have their own names. If you merely want to calculate the time of the Full & New Moons (or First & Last Quarter) to the nearest quarter of a minute, you can get by with around 15 trig terms, IIRC. Calculating arbitrary points along the orbit is quite a bit harder than the 4 main phases.
 
Hmm I'm beginning to think that it was unfair to reject the epicycle model for being overly complicated, because what we've got now is overly complicated too :-P
(inb4 "Modern astronomical modelling is not overly complicated, it's exactly as complicated as it needs to be in order to produce accurate results")
 
that's what Big Moon wants you to think
 
If anything, Big Moon should want less accurate models, so it can creep closer to earth (and thus become Bigger Moon) without anyone noticing
None of this "the Moon is moving away from earth at a rate of 1cm/year" business
 
Epicycles weren't that complicated. And doing calculations with a bunch of circles is a lot easier than with ellipses. And with complicated orbits like the Moon's, the ellipse is somewhat perturbed & wobbly. :)
But the big problem with the epicycle model is that astronomers knew it was just a calculation tool & it couldn't be a good model of reality. Eg, using epicycles, the Moon's apparent diameter should vary by something like 50%, and it obviously doesn't vary that much.
 
6:39 PM
Hi everyone
I'm new to both python and Django
I did a small app for a client and he brought an update, a message could have multiple images
pastebin.com/2938a5MC here is my code. Trying to make my form accept multiple images
 
hello
 
Anyone here doing Django don't mind?
 
^closed
 
witches i suspect — SuperStew 38 secs ago
 
6:46 PM
heresy
 
a comment to the question just closed
 
7:12 PM
@PM2Ring Really? Some of those 'big' moons have definitely looked twice as big as the moon often looks to me, especially when I see it during the day.
 
watch out with the Moon illusion
 
 
1 hour later…
^ gone
 
Happy Father's Day to any fathers in the room! (Since I'll likely be away all weekend)
 
It's fathers day?
 
@scitronboy this Sunday, yes
 
9:40 PM
I am looking for a decent graphical profiling tool for python, Not just profiling the odd python script, but profiling applications (exe) written entirely in Python/PyQt The tool must work on Windows. I am looking for something like hotspot a video can be seen here Any good suggestions? free/opensource would be ideal
 
00:00 - 14:0014:00 - 22:00

« first day (3163 days earlier)      last day (1802 days later) »