« first day (4330 days earlier)      last day (843 days later) » 

00:00
Are you just looking for "composition"?
Avv
Avv
@roganjosh. Here is an example:
I suspect that there will be others in the room better-qualified than me to answer that, so I will pause my output for now
Though they might well be in bed (... why am I not asleep?). Anyway, I think I extracted enough pertinent info from you that they might be able to pick it up another time
Avv
Avv
00:16
np
 
2 hours later…
02:23
@Avv Hard to say without context, but it sounds reasonable
 
4 hours later…
06:23
@PM2Ring I like that!
 
2 hours later…
09:09
Hello all! It seems easy but I'm stuck. How do I remove all lines from my dataframe, where the value in the column "name" starts with T?
I know how to delete all rows with a certain condition
But I need the condition that the value in the column starts with t..
df = df.loc[(df[['name']] != 'Tobias').all(axis=1)]
I've packaged up a GUI application through python - however when I click the X button to close the GUI the application still runs in the background in my task manager. Any idea on how to quit the scrip/exe safely so I don't have it running in the background?
09:42
Did you start a thread?
Is this problem not seen on the py file?
@Baobab try no_t_df = df.loc[~df["Name"].str.startswith("T")]
10:00
@DelriusEuphoria Hmm sort of, when I press X on the window my shell becomes unable to run the script again until I restart it.
I get the following error:
I can't get it to show in code form
but its this: invalid command name "2296472450816check_dpi_scaling"
while executing
"2296472450816check_dpi_scaling"
("after" script)
invalid command name "2296488062784update"
while executing
"2296488062784update"
("after" script)
So I assume it's to do with plotting inside the tkinter window or the window itself.
Unless I go through task manager and kill the app there thats the only way to end the executable
@Govind75 a bit of a hacky way, but you can detect/bind the "click on close" event to something that will send a SIGINT or basically just close it externally (using taskkill or some other way).
something like this: dpaste.org/2dV7V
or something that use signal.raise_signal: stackoverflow.com/questions/35772001/…
I said bind, but I think it's actually root.protocol("WM_DELETE_WINDOW", close_function)
10:43
@JRichardSnape Thanks! It's great that NASA/JPL makes that ephemeris data available. en.wikipedia.org/wiki/… has a brief description, for more details see The JPL Planetary and Lunar Ephemerides DE440 and DE441, Ryan S. Park et al 2021 AJ 161 105.
@PM2Ring wow, this is crazy and so cool
@PM2Ring yes - I very much like the more open way of doing things - it's fun to have plenty of data around and can help people to improve their own understanding. It can even occasionally facilitate improving all our understanding.
11:35
@Govind75 Yep, looks like a tkinter error to me. But it's strange. Normally, you don't have to do anything special to get Python to exit after you close the tkinter window.
Maybe update() and/or mainloop() is getting called in an atypical way... Put an MCVE up on dpaste.org and I'll investigate further.
I made this code. I want to match one "key" at a time by appending them in a list (and joining them with a delimiter that makes sense to me, so using +). I'm trying to empty the buffer of keys either if: 1. if the partial key combination doesn't match at any point, empty the whole list and start over, 2. if there a whole match (since at some point the combo_buffer will fully match to the key_dict_single's entry) then empty the combo_buffer.
I also made another slightly different version based on my attempt: dpaste.org/Yg5yt
technically, I could also make 2. be "if there only a single entry from key_dict that match, then empty the buffer"
11:51
I think a good first step would be to take out the tkinter parts, so you can test the code without having to actually type anything. For example dpaste.org/Unsey
Here's the output that I get.

After pressing 'p', it_match=0 and combo_buffer=['p']
After pressing 'q', it_match=1 and combo_buffer=[]
After pressing 'space', it_match=1 and combo_buffer=[]
After pressing 'a', it_match=1 and combo_buffer=[]
After pressing 'r', it_match=1 and combo_buffer=[]
After pressing 'space', it_match=1 and combo_buffer=[]
After pressing 'a', it_match=1 and combo_buffer=[]
After pressing 'g', it_match=1 and combo_buffer=[]
After pressing 's', it_match=1 and combo_buffer=[]
On a conceptual level, it seems strange to me that combo_buffer is allowed to contain "p", even though none of your key_dict_single keys start with "p"
@Kevin I have a feeling it is to do with the matplotlib plot - as when I don't compile the plots I do not get the error...
I wouldn't know. I don't really have any input to give until you give me an MCVE.
@NordineLotfi I'd store the hotkeys as a tree. Makes the logic much simpler dpaste.org/V29J4
@Kevin this is so I can make my own key combo scheme. Basically, if I create a specific combo like "p+g+j", if I press any key that isn't part (when appended) as partial match, then it start over, until I decide to consciously make the combo (or if it happen by accident, but that doesn't matter much)
the if block logic I made in the two link seems to work when you look at it, but they don't actually do what I thought they should have
@Aran-Fey Thanks, I'll try this one :)
If "p+g+j" was in your dict, it would make sense for "p" to be in the combo buffer. But "p+g+j" isn't in your dict. You already know that the contents of the buffer can't make a valid combo, so why are you still storing it?
12:02
because I'm gonna use this while typing normally? basically like a keyboard daemon
if I press anything successively that isn't part of the dict, then it act normally (eg: letter/text when normally typed on keyboard, etc)
I understand the overall goal.
Aight I'll try
I actually already thought of doing simulated output, especially since I wanted to fix this on ipython before making it as a full script/app. (for some reason, I'm more productive when doing things in ipython)
Suppose you are deep in the gold mines, and you find a big chunk of shiny yellow ore that might be gold, or it might be pyrite. The only way to tell is to analyze it using the lab at the surface. You load the heavy ore into the minecart, and with great effort you push it to the lab. Analysis indicates that it's worthless pyrite. Darn!

You load the pyrite back onto the minecart, and with great effort you push it back to your mining area. After hours of work, you've only find dirt. You occasionally choose a new spot to dig, dragging the heavy minecart everywhere you go. Finally, you find a b
I don't know if this story is useful. I mostly wrote it to inspect my own viewpoint from the outside.
Maybe I should do a project with global shortcuts, myself... I have one little application that waits for the Shift key to be pressed, and then it takes a screenshot and saves it to c:/screenshots. It would be nice if I could listen for key sequences and not just individual keys.
@Kevin nice story (analogy?) :)
It's not the most perfect analogy because having a global list is more like pushing around multiple minecarts that are hooked together. And trying to match a list against a string is more like, the lab can tell you either "it's gold" or "it's pyrite" or "we're not sure, go bring us more yellow ore"
12:34
@Kevin I have lots of projects that depend on keys combo (different combo strategy/scheme besides what I explained earlier). I think I tried every library that has keyboard support in my quest for perfect keys comboing. For now, the closest I found was using Xlib, but even that has limitations, as I found (it has a limit of 2 keys max for simultaneously pressed keys, and I think every modifiers pressed down + 2-4 keys max as limits)
@Kevin yeah, I know it's not the best way to tackle this, but if it somehow worked, I wouldn't mind it :)
here I tried tkinter because I knew most people would be able to run my MRE, compared to if I used curses, Xlib, or any other library (I don't want to put any unnessecary burden on people helping me!)
It might not be Xlib's fault. Some (all?) keyboards have a hardware limitation that means they can't detect more than ~4 simultaneous keypresses.
true, I also didn't take into account the raw keyboard output...I planned on tackling this but binary packing scares me (for now)
I remember it being a problem for me when I was playing a game, when I needed to strafe with up+right, and crouch with Shift, and reload my weapon with Ctrl, all at the same time
sounds like the kind of problem I faced
Looks like it's only some keyboards, and it's only some key combinations en.wikipedia.org/wiki/Rollover_(keyboard)#Ghosting
12:42
I see :o I guess I'll research this more seriously laters on, Thanks
I wonder if this is related to a strange thing my laptop does. Sometimes when I'm playing Vampire Survivors, I need to perform a little half-circle maneuver by pressing [left, left+up, up, up+right, right]. Occasionally my computer will emit a hardware beep when I hit the "right" key.
@Kevin probably true, but I imagine you can get around it by a timewindow, because keyboards poll at high HZ, so if at the edges of the window keys 5 and 6 overlap with the 4 simultaneous ones you could have fake 6 simultaneous key presses
Maybe it happens when I'm too slow to release the Left key before I press the right, so the sequence is actually more like [left, left+up, left+up+right, up+right, right]. The keyboard might be mad at me for having three buttons held down at once.
@Kevin I think this is a feature on Windows. If you press a key enough times, it will emit a beep sound and display (most of the time) a window saying roughly "do you want to disable/enable sticky keys". or at least I faintly remember this being a thing
I've encountered Sticky Keys before. Usually when I'm doing a lot of crouching and uncrouching. It triggers when you press shift five times. The beep that sticky keys plays is not the beep I hear during left+up+right.
And it's not Toggle Keys or Filter Keys, since their shortcuts are "hold num lock down for five seconds" and "hold right shift down for eight seconds" respectively
12:50
@Hakaishin yeah, you can easily make fake multiple simultaneous keys, problem is listening/detecting the real key press when there are more than 2 (here talking about simultaneous not successive or other types). If you add modifiers, I found that you can get total_number_of_modifiers + 2-4 simultaneous press, but I think that's the max I seen
@Kevin I was about to mention those but you beat me to it. Kevin'd? :P Also, found this: answers.microsoft.com/en-us/windows/forum/all/…
but given your numlock is probably not turned on, it can't be that either
The only reasons might be either the keyboard itself or the motherboard. If it's the keyboard, the closest reason might the Rollover/Jamming thing you mentioned.
Alas, my laptop does not have a num lock key.
hmm, maybe a FN keys? or some combination. I seen some laptop that support numlock through either of those, and if you happen to press them by accident just once on Windows, on the same installation, it will sometimes remember and turn it on when you bootup.
Going by the past history of the strange problems I've had with that laptop, it's quite possible that there's some obscure key combination that simulates num lock. The manufacturers strike me as... Whimsical.
Speaking of keyboards, I played a game with a fun bug today. It's a visual novel, but all the text was garbled. I think it somehow got tripped up by my Colemak keyboard layout, so every "e" turned into an "f", every "r" turned into a "p", etc. It's such a crazy screw-up, it made me laugh
13:07
interesting. That reminds me of some script that did the same, but for switching keyboard layout on the previously written (based on some limit) text. Then it retyped it into another current layout.
@Kevin Here is the MCVE
when you click the X window button after running
@Aran-Fey If the novel uses the Ren'Py engine, maybe you could track down the problem yourself :-) it's all written in Python.
it gives the error I am talking about
Ren'Py games work fine, fortunately!
That's like... 90% of all visual novels
@Govind75 Cool :-) I'll investigate, post-haste
13:11
also, think I figured out a way to do my key combo (successive version): dpaste.org/zwVaq
this even work with more than one combo inside the dict (which the other attempt I made didn't)
it probably waste a lot of cpu cycle for what it does though :/ but I guess I'll make this better later on (by CPU cycles, I mean that I use too many loops)
Pressing the X button gives me, invalid command name "2087835738752live_plot", just as described. There's nothing like a nice reproducible error :-D
I bet
If I have to guess right, its the self.after working
I think there's a thing you can do to clean up after callbacks that haven't executed yet. I will consult the ancient texts.
The program shuts down as expected on my PC
13:16
Despite that error
I don't get any error though
Excellent, let's containerize your PC and deploy it to production
The containment team will arrive in 15 minutes. Do not resist!
I won't, but my PC will!
It's programmed to recognize normies who use QWERTZ instead of colemak and blow itself up
"I invented a new kind of uninterrupted power supply by welding my computer's power cable to the outlet"
Nope, closed the app 2 times, no error
13:19
The error shows up if you start it with the -i flag
@Kevin it's the more direct way of harvesting radiowaves and ambient interference as electricity, only to realize you pay much more on your electric subscription next month
@Aran-Fey Ah theres the good ol' error
I've known about this tkinter and -i interaction for a while, but I never thought about what that entails... tkinter must be doing some really weird stuff under the hood
I try not to think about interactive mode too carefully. It's like looking at the sun, or Cthulhu.
@Govind75 Okay so the solution that works for me even in -i is to catch the close event of the window and cancelling the scheduled after method
13:32
@DelriusEuphoria thank you will try
@Kevin btw, Thanks since I based my working prototype on this :P
github.com/matplotlib/matplotlib/issues/8107 looks somewhat related. Similar error message, and I'm guessing _on_timer is powered by after or something like it. Unfortunately, conversation peters out with "This was maybe fixed by an unrelated change?" and "it's still happening for me, I'll open a new issue", and then AFAICT that guy never opened a new issue.
There's a link to a workaround which looks like it's using an extra layer of callback registration to make sure the queue is still alive enough to process events. I hoped I could apply that approach to Govind75's code by changing self.after(1000, self.live_plot) to self.after_idle(lambda: self.after(1000, self.live_plot)). But the error happens the same as before.
@NordineLotfi 👍
@DelriusEuphoria That seems to work for the MCVE I gave but it turns out I am getting even further errors such as
invalid command name "2180925514048check_dpi_scaling"
while executing
"2180925514048check_dpi_scaling"
("after" script)
invalid command name "2180925379136update"
while executing
"2180925379136update"
("after" script)
In my actual code
Any idea what the source of these errors may be
github.com/matplotlib/matplotlib/issues/… mentions that after_cancel is supposed to stop these kinds of errors, but in their case it wasn't executing at the right time. So I think Delrius is on the right track by hooking up after_cancel to the window close event.
13:47
Yeah, it works for the MCVE I've just found these two new ones which I suspect are related to something else in my code
@Govind75 I don't understand when you are calling the check_dpi_scaling method
That is what triggers this error, some code somewhere is scheduling a call to a function called check_dpi_scaling when the root window is destroyed.
We need to see the code, to be able to give any further help
Currently browsing around github.com/matplotlib/matplotlib/blob/…... Very suspicious of the filter_destroy function
@DelriusEuphoria Let me attempt to isolate it so I can send you a short piece
@Kevin I did not know we could say something like this to check if an item was an instance of the second, I always thought isinstance(obj, ins) was the right way
Not to pass the buck, but @Govind75: the matplotlib team might be able to help if you create an issue and include the contents of your first MCVE. The one at dpaste.org/pA27e.
13:56
I will consider @Kevin I think I've almost found the piece of code which is causing the problem
@DelriusEuphoria I believe that line is checking to see if the objects are 100% identical, not just to see if the types match
@Kevin Ah I see I see
@DelriusEuphoria when you run the code you changed, once you destroy the window does your shell become broken?
I do occasionally see code that tries to do type comparison using e.g. if type(x) is int:. I'm a little wary of that approach because is can behave in surprising ways if you don't know about pointers and interning and other such implementation details
@Govind75 It goes into the interactive mode, I suppose
14:00
Just by writing the word "pointer" I feel as though I have invited a dark presence into this place
Is there a way to just entirely stop the program
I am actually going deep into the docs and looking at how the close_events are handled by matplotlib
sys.exit(0) is usually good at entirely stopping a program. But it would be tricky to call it if your code is busy looping forever in the mainloop method
For me it doesn't have to be a clean exit - even if it force closes the executable
If we're allowed to get our hands dirty... I'll see what I can do
Time to get out the blowtorch
14:05
Hehe
sometimes found that sys.exit(0) doesn't work, so I use quit() or in worse cases, use a process signal.
currently I just have exit() in the window_destroy
@NordineLotfi the built-in quit function?
@vaultah yeah :)
probably not good practice but I did it a couples times when nothing worked on some prototype or proof of concept I did
even that doesn't work sometimes, so the last way is just sending signals (SIGINT, etc)
I've always wondered why people use exit instead of sys.exit, but never asked them. quit is even weirder :(
14:13
yeah, I don't know why one uses the other instead of the other ones. I just pick any of them when one doesn't work and go with the one that does for my case. But I agree they are all weird in a way
> They are useful for the interactive interpreter shell and should not be used in programs.
interesting. I found a couple modules that use it once, so I thought it was fine
_sitebuiltins.Quitter raises SystemExit, just like sys.exit
So they shouldn't behave that differently :P
this is weird. I assure you sys.exit sometimes doesn't work, whereas quit() works in those instances...I just don't have a MRE to prove it (yet)
14:29
A somewhat silly approach, but it works on my machine dpaste.org/PrBs4
Interestingly, the Watchdog thread can kill Python using signal.raise_signal(signal.SIGINT), but not sys.exit(1).
quit() doesn't work either, for the record.
What Kevin said, seems to be more sensible, creating a new issue there might help you get better help
Paging @Govind75 -- possible solution in dpaste.org/PrBs4
In a perfect world, the matplotlib team will be able to figure out what is causing FigureCanvasTkAgg to behave strangely, and nobody will need any workarounds if their libraries are up to date. In an imperfect world, there's watchdogs with blowtorches.
15:01
@Kevin Thank you, will have a look at
15:27
@Kevin Here's your cone intersection, using 2 implicit plots. Maybe there's a more elegant solution... I also plot the hyperbola where the 2 cones meet.
There's a canonical about exit vs sys.exit: Difference between exit() and sys.exit() in Python
Annoyingly, neither works in SageMathCell. But raise SystemExit does.
@PM2Ring informative, although it misses mentioning quit()
@NordineLotfi Good point. Here's a more recent one that does mention quit. stackoverflow.com/q/19747371/4014959 I just linked it with a comment to that older question.
15:45
@PM2Ring Thanks! This is much more informative :D (also clears some misunderstanding on my end)
15:59
Actually, sys.exit does work in SageMathCell, but it prints a silly message telling you to use exit or quit or ctrl-d.
@PM2Ring Ooh, very nice.
16:21
@Kevin I wonder which world we're in
16:40
@Kevin No worries. Actually, the z bounds in the implicit_plot3d calls can be changed to (z, 0, H-1/2). The implicit_plot3d function uses the Marching Cubes algorithm to find the surface, so it's a good idea to make the bounding box as tight as possible. You can pass mesh=True to implicit_plot3d if you want to see the triangulation of the surface, but it's generally not pretty. ;)
@Aran-Fey maybe in a bit of both: even if you report the bug on github, it could be delayed or just not fixed. At that point, using a workaround with watchdogs and blowtorches will be the only way, while waiting for the fix or just indefinitely using the workaround.
 
2 hours later…
18:54
@Aran-Fey btw, I tried to add another combo but it doesn't work with more than one:dpaste.org/CuZDK
19:04
What is it with all the 0-width spaces in pastes today?
Is dpaste.org adding those? Maybe we should avoid that site
I was about to say the same thing, especially yesterday (noticed it only recently, since I usually use the raw paste, which I think don't have those)
Anyway, I think you botched the indentation (and curly braces). The hotkey you added is space+a+f+s+d
oh, I thought I was adding a second hotkey. That make more sense
I mean, it is a 2nd hotkey. The other one being space+a+g. But it looks like you meant to add f+s+d
yep, that's what I meant (adding f+s+d as a separate hotkey)
19:24
nvm, figured it out. dpaste.org/G4NL2 never worked with tree structure (usually dict look pretty linear on my end)
@Aran-Fey Thanks for the hint (and the prototype) :D
currently browsing through dpaste's github repo, looking for changesets that set insert_zero_width_spaces = True...
I always something from my discord-server that is a paste service
Looks like the PlainCodeHighlighter uses &#8203 (aka zero width space) when django.template.defaultfilters.escape returns a Falsey string.
I'm guessing escape only returns an empty string when its input is an empty string. I call no foul on Django then.
I don't think the Python highlighter inherits from PlainCodeHighlighter, though, so this doesn't explain why it's showing up in pages with python highlighting.
19:41
That checks out, it did seem to add 0-width spaces only around double newlines
As a practical workaround, I suggest the "copy to clipboard" button, which does not put zero-width spaces anywhere. On my machine at least.
Well that's certainly a useful button that probably should be more prominent
I object to such buttons on principle. Text should be copiable without a button.
I do not want my browser to have fewer features than the browser I used in 1999. highlight + Ctrl-C must remain the dominant paradigm forever.
@Aran-Fey At least more highlighted
Very simple and easy to use, even python discord server uses this
ah yeah, hastebin. I used it a couple times last year, with ghostbin too.
19:53
Logo is a bit blurry. Next!
Uploads a 4K Logo for Kevin
I demand logos of the utmost workmanship. Decadent logos.
I lounge on my emperor's sofa while I am fanned with palm fronds, and fed grapes by servants*. A score of marketing executives perform a languid yet exquisitely intricate choreography routine, revealing the most beautiful logos from hidden pockets, and concealing them again in turn.
(*fairly compensated with pay/benefits/worker's rights, but they get a bigger bonus if they pretend otherwise for the sake of my megalomaniacal skit)
Dpaste's Python highlighter comes from Pygments. I don't think Pygments is directly at fault, because I can copy text from their interactive demo and there's no zero width spaces in it.
20:11
Whenever I see one of Kevin's innocuous asterisks, I can't help but wonder if today is the day when he reveals that it was all a long con, and instead of adding some harmless clarifying information he'll just double down and say something that makes it worse
"servants*"? (*they are all black)
hehe
I was imagining basically a, mad emperor of ancient Rome sort of thing. Think Caucasian with a Mediterranean tan.
Not that the servants can hit the beach very often, if they want to get that bonus. They gotta make it look like they've never gone beyond the walls of my palace
Hmm, good point. It would make sense for servants to be pasty
On the other hand, the marketing executives come from all over the empire. They've trained for their entire lives for the privilege of stepping foot in my sofa room.
Traveling the world to find the most trendy and fresh ways of drawing a circle and putting "pepsi" on top of it

« first day (4330 days earlier)      last day (843 days later) »