« first day (4433 days earlier)      last day (739 days later) » 

00:01
I mean, I don't care if it's based on the window attributes or something else, but yes. I want to know if it'll be ShowWindow(SW_SHOWNORMAL)'d or ShowWindow(SW_MAXIMIZE)'d
alright, I'll make an MRE
btw, unrelated but, just noticed that Pycharm actually doesn't manage to correctly find errors (it gets stuck on Analyzing...) whenever there are certain Unicode char, such as Japanese inside the comments, etc.
it doesn't immediately happen if it's just one char, but it does become noticeable if you have more than one comment written entirely in say, Japanese. I guess this is probably another bug I found
00:21
I just decided tonight that I'm going to spend my "work from anywhere for a month" in Japan and bought a load of language courses. Give me 3 months and I'll figure this all out
I did buy them years ago but somehow lost them. That's why I fired up the old external HDD hoping they would be there. I can't believe I actually seemingly deleted something :/
00:38
wow, what a coincidence (given I mentioned the language above)
btw, to console yourself, you can at least blame bitrot for this, in case you just don't remember whether or not you did delete them
(or wild cosmic ray, that works too)
I wanted to tell you when you mentioned your HDD earlier, but the first thing I would do when seeing a long time friend HDD is firing it up on Linux, and backing up everything using ddrescue. Then, I would look up if there are any bad sectors, or corrupted files. Lastly, maybe I would look around to see if I can find any relevant files (eg: search for whatever you want then)
One of the reasons that Linux is better for this isn't just the tooling, it's the fact it doesn't use as much disk write as Windows. Every waking moment, when there is a drive to save, if you let it write to itself, at some point, the recoverable will become unrecoverable.
At least on Linux (and by extension Android), I know that whenever it writes something, it "overwrites" existing sectors on the drive(s). It does so in a certain way, which I do not know (eg: random, etc), so it's hard to predict which one it will use. But if one of the files that can be recovered, even in parts, from a certain sector become overwritten, then it's probably lost. Or your best bet is an expert in HDD recovery, but those are costly...
but since there might be some hope, maybe try the above, or, try using everything to search your whole disk to see if there anything relevant for you
if you still want to use ddrescue, then try one of my answer on the subject.
 
1 hour later…
02:10
I want to create a single-player game with OpenGL and its size would relatively be comparable to Legend of Zelda: Breath of the Wild. I have literally no ideas right now though on how the story and mechanics should work.
 
2 hours later…
04:26
I'm using tk with PhotoImage(file = "file.png")but it keeps saying no such file or directory, even though I put the image in the same directory with the script. Do you know why?
05:21
Any people with experience with matplotlib buttons/widgets/animations? I'm pretty sure I have something very simple that I'm missing.. stackoverflow.com/questions/74682743/…
06:18
I am using pywinauto to automate a few clicks of a software, the script then needs to run on Azure self hosted agent, if I log into the self hosted agent and run the script it works, but if I use if from Azure pipeline trigger it is not able to find any buttons, my best understnading currently is it fails to find UI as it runs as a user that doesnt exist, and thus has no active display
Any thoughts on what would cause this?
 
1 hour later…
07:23
Hello everyone.
How can i use canny detective only for tray edges ? I added it to the bottom of the read.me page on the github link. github.com/learnergthb/Example/blob/main/README.md @Aran-Fey
 
3 hours later…
10:21
def ppr_dst(a, b, c, x1, y1):
    return (abs(a*x1 + b*y1 + c) / math.sqrt(a^2 + b^2))
runs fine, when I tested it, but when Im using it in a script, says typeerror
then I changed it to ** instead of ^
and it worked
please explain
... what do you expect the ^ to do, and why?
and when you decided to change it to **, what motivated that choice?
and, when you got the TypeError, did you read the message attached to it? Did you understand the message?
TypeError: ufunc 'bitwise_xor' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
this was the message I got, no I didnt understand, and I changed it because it was suggested in a similar question in stakoverflow, link: stackoverflow.com/questions/22725421/…
I expect ^ to do exponent calculation, eg. 2^4 = 2*2*2*2
10:40
doesn't the post explain it though? you expected ^ to be the power-operator in python, but it turns out it wasn't. when you googled your error, you learned that ** is the power-operator, and now it works.
your first stop for these kinds of question should always be the official docs, googling "python docs power" leads to this section: docs.python.org/3/library/functions.html#pow, which also touches on it being equivalent to **
@Arne yes thats correct, but I am curious, why did it work though? when I tested in REPL?
ah, my bad. I misunderstood that part. sorry, that must have come off as very haughty
maybe in your tests a and b were integers, and in your script they weren't? bitwise operations only work with integers
@Arne that explains the problem actually, thank you
11:24
@Ooker The script directory doesn't matter, what matters is the Current Working Directory. If you want a path relative to the script location, then you have to create it manually by finding out where your script is.
@OceanWaves I'm not sure I understand the question. Are you saying you only want to detect the edges of the tray itself, and not the food on the tray?
I am iterating over a list of objects. For each object, I need to modify one of its properties. So far so good.
Now, however, I need to do the exact same thing, but on a different list and modify a different property.
Conceptually the code is the same. But I'm struggling to find a way to avoid duplication.
def change_property_ONE(self, elements_list: list):
    converter = SomeConverter()
    output = []

    for element in elements_list:
        element.property_ONE = converter.convert(input=element.property_ONE)

        output.append(element)

    return output


def change_property_TWO(self, elements_list: list):
    converter = SomeConverter()
    output = []

    for element in elements_list:
        element.property_TWO = converter.convert(input=element.property_TWO)

        output.append(element)
It seems like a really easy thing to do, but for some reason my brain is frozen. Could anyone help?
11:46
Do we have a guide for creating reproducible Selenium examples, including a small example hard-coded web page content?
@KurtBourbaki Use getattr and setattr to specify the property name as a string, then you can just iterate over strings as needed.
However, if tasks like this are common, it is also worth reconsidering the design. Rather than storing separate properties, it might be better to have them as values in a dict.
@KarlKnechtel yes, I think the design itself is flawed here. But suppose we start using a dictionary for these properties: wouldn't we then need to access them as generated strings anyway? E.g. element[generated_property_name] = ... ?
Why "generated" strings? Generated from what?
Anyway, the point is that if you do things like this often, element[attr] is easier than getattr(element, attr) and setattr(element, attr, ...)
12:10
^ exactly
Sorry, I was confused. The solution to my issue is basically to use strings to identify the names of these properties, as this would allow me to pass these names as parameters, thus reducing code duplication.
I just wonder if there is some OO design that would allow me to have a similar flexibility in a different way (besides using dictionaries or setattr).
@Aran-Fey first tray, then food
@KurtBourbaki For that you'd basically have to throw standard OOP overboard and build your own, more high-level one. Something like
class Point:
    x = Attribute[int]()
    y = Attribute[int]()

for attr in (Point.x, Point.y):
    for point in points:
        attr.set(point, attr.get(point) + 1)
because the food is in the tray. No need to look at the whole picture.
I mean, then just don't give it the whole picture as input?
for x, y, w, h in find_trays(img):
    tray_img = img[y:y+h, x:x+w]
    do_whatever(tray_img)
12:25
how to handle any modifcation to django model in django shell , i am getting this error
RuntimeError: Model class __main__.SOMECLASS doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Anonymous
Is there anyone here that could show me a small example of a "Monitor" class that should be able to both receive "stdout" and "stderr" from a subprocess, including redirecting it to another output of some sort? I'm kind of new into this.
I'm not sure what that means. Could you show an example of how you'd use this class?
12:51
Hi guys, can someone help me to fix Match 6 on this: regex101.com/r/3HhOMF/1
I tried [*=\d] in the group but it doesn't recognize a two digit number
You probably want ([*=]|\d{1,2}) I guess?
This looks good, ty.
13:07
@Aran-Fey Thanks for the help above :)
No problem
13:39
I have a pandas dataframe where one row has duplicate values spread across several columns, like this
```python
1 2 3 4 5 8 \
0 Semifinals Semifinals Semifinals Semifinals Semifinals Final
2 1 Ashleigh Barty 6 6 NaN NaN
3 1 Ashleigh Barty 6 6 NaN NaN
4 5 Iga Świątek 2 4 NaN NaN
5 5 Iga Świątek 2 4 NaN 1
14:01
@Aran-Fey other objects besides the tray may be around
we remove restrictions
does not control objects other than tray
Seems like a chicken and egg problem. In order to do edge detection on only the tray, you must first identify the parts of the image that aren't the tray, and remove them. But in order to identify those parts, you must first detect the tray.
14:58
Hola! any advance level scrapy expert here?
No, but I'm here.
@OceanWaves Sorry, I don't know what that means. And to be honest, I'm not very keen on continuing this - I have a hard time extracting useful information from everything you say, and the only advice I can give is trivial stuff like "write a for loop". I don't think this is productive
At least not productive enough that I want to continue
15:43
@Warcaith What exactly do you expect the functionality to be? I assume you have chosen the name "Monitor" for a reason, but it isn't clear what that reason is.
15:56
turn out, if you want to capture the mouse on a screenshot, you have to save the position and paste it on the said screenshot (if you use PIL, mss, ctypes, win32, or pyautogui). It's weird stuff.
On linux, you can capture both the cursor and whatever is under though, so it's really weird how Windows handle this
16:32
Where is the best place to ask if I have a question regarding a log parsing architecture pipeline? More like an opinion-based Q. :(
17:10
Hello, any idea what makes the below code smell?

def new():
try:
do()
except Exception as ecx:
raise f"new exception: {ecx}"
The analytical tool says "Change this code so that it raises an object deriving from BaseException." -- does it mean to be more explicit?
You can't raise a string
@aeiou we have a formatting guide for chat and I'm pretty sure you've been directed to it before. Please practice in the sandbox before brute-forcing here
17:25
@Aran-Fey sorry i didn't explain fully. ietresearch.onlinelibrary.wiley.com/doi/10.1049/ipr2.12302 (what I was told about the tray is similar to the method here) Thank you for all the ideas.
17:47
>>> l
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> l[-2:]
[8, 9]
>>> l[-2::-1]
[8, 7, 6, 5, 4, 3, 2, 1, 0]
Where do I find more details about this behavior?
My intent is to get the last two elements in reverse order.
but that's not what happened in the last expression
docs.python.org/3/reference/… describes the syntax and semantics of slicing
Last two elements in reverse order is actually l[:-3:-1].
See also the "sequences" section of docs.python.org/3/reference/datamodel.html#types: "Some sequences also support “extended slicing” with a third “step” parameter: a[i:j:k] selects all items of a with index x where x = i + n*k, n >= 0 and i <= x < j."
Honestly, I'd write l[-2:][::-1]
Trying to decide if those two pages are enough to fully define the behavior of all possible list slices... Strictly speaking I don't think it allows negative values for start or stop
That's probably described elsewhere, but my search powers are weak today
17:58
@Kevin thanks
@MisterMiyagi thanks...trying to wrap my head around it. Very interesting how this works, but a little unexpected.
@Kevin yah, the ` i <= x < j` needs adjusted for negative i and j.
but x = i + n*k still works
which is probably the main thing that's helping me understand the behavior
I used reversed() in my latest AoC solution and a friend's solution had -1 for the step. So I was trying to figure out how to get it to work.

« first day (4433 days earlier)      last day (739 days later) »