« first day (3913 days earlier)      last day (1258 days later) » 

01:40
@CoolCloud 8? 3 horizontal, 3 vertical and 2 diagonal? also xkcd.com/832
 
4 hours later…
05:54
@python_user Ah I forgot to count one diagonal :P
06:48
if a is b: pass
elif b is d: pass
Is this a nested if?
if a is b:
    if d is a: pass
Or is this nested if.
depends what you interpret as "nested" meaning?
the second one is a nested if, you might be asking about "if else ladder" not sure if that is a common term
@JonClements Not sure, I have question in my question paper that says, use nested if statements to display the grade of the student
they taught me that in college
Hmmmm if ladder, never heard of it before
07:00
@CoolCloud okay without more context, the use of is, is probably wrong
@CoolCloud first hit for "if else ladder" web1.eng.famu.fsu.edu/~haik/met.dir/hcpp.dir/notes.dir/cppnotes/… so I guess this is a term at least one other college other than mine has used
I'd take a guess you're probably expected to do if, elif, else...
@JonClements Well it was just an example, it could be anything other condition too
@JonClements Ah me too, but was just making sure, because nested loop means a loop inside a loop
@python_user oh I see
@CoolCloud you've got me curious - can you share it?
Ummm what I meant was, I was just giving an example to show an if condition, it is not based on any real scenario :P
07:05
so why do you think that anyone that'd be able/want to help out would be able to do so?
My question was based on nested if statements right, I did not think it needed to have context on the condition, was I wrong?
technically, no - wasn't worrying about that - just can see you going in a completely wrong direction is all
Ah I get what you mean
If you have to do if/elif/else... then so be it, but it from a first reading it sounds like you're trying to effectivly do something like the example given here: docs.python.org/3/library/bisect.html
Oh, nope, never heard of it
07:22
is that what you're trying to do though?
Nope, not at all
no idea then what you're trying to achieve then :p
@CoolCloud So you asked a question that wasn't the one you needed an answer to? That seems calculated to lower the probability of getting the answer you need somewhat.
So this morning I'm noodling with fastapi, pydantic, wtforms and mongoengine and rather liking what's happening. Fascinating stuff!
@holdenweb morning :)
07:37
@holdenweb Okay I think I made myself unclear, ill rephrase
Morning Jon, how are things. We haven't emailed in a blue age. Now I'm in Hastings the logical place to meet for a pint would be Ashford. How doable is that for you?
@holdenweb just looking on a map - don't have a car at the moment so one sec...
I was going through through class and then the teacher says nested loop is
if (condition): pass
elif (condition): pass
@CoolCloud that's a good idea. It seemed to me you were grasping for the understanding that elif is pretty much syntactic sugar for nested ifs that avoids multiple levels of indentation. I'm guessing the class is seeking to have you understand the need to indent with nested ifs so you appreciate the value of elif when they produce it out of a hat, but I'm just guessing.
But nested loop means a loop inside a loop
so I thought would be
if (condition):
    if (condition) :
        pass
07:42
Ah, OK, so your teacher perhaps isn't a programer ...
@holdenweb "perhaps* coughs...
So my interpretation was correct?
As I said, elif is just syntactic sugar. Your teacher has a point, but doesn't appear to be teaching the language particularly thoroughly (not uncommon nowadays).
@holdenweb what's best... if I travel a bit down south, or if you travel a bit north - we don't both need do it
07:46
Hmmm yea, I've seen alot of people say nested if statements means if then elif
I couldn't really tell what your interpretation was. That would ding you in providing written answers, but I get the impression you're being groomed for a multiple choice question like "elif is used in" and where the required answer is "nested ifs". Blerch.
@JonClements Whereabouts are you?
@holdenweb Faversham now
For some reeason I thought Canterbury.
Ooh, lots of places between with good pubs, I suspect. Do you travel mostly by train?
@holdenweb Ah I see
maps says it's about an hour and a quarter by car.
[goes back to building forms from mongoengine documents]
07:53
@holdenweb drop me an email mate - I've lost your number
@holdenweb don't travel at all these days - don't need to really
Haven't been doing a great deal of that myself as I too have the 15-second commute. I'm supposed to visit our Zurich office asap a year ago, but that hasn't happened yet.
that's just lazy, are you saying there's a pandemic or something? sighs
@holdenweb while fastapi and pydantic go hand in hand, you might also want to check marshmallow.readthedocs.io/en/stable
Tried marshmallow. It's OK, but not as elegant from the relatively little experience I have with both ...
having used both, I'm not going say to one rules over the other... but if you're going to use fastapi then stick with pydantic - they're a good couple
@CodyGray @MisterMiyagi I'm sorry for my bad description. I really have trouble with descriptions. Here is a proper summary.
The python code downloads and unzips the files. The game was written in C++, so interacting with any element in the game would use C++. Basically, the game has been modified so that it shows download progress in game. The python code when it is downloading outputs to the console. The main Dev was asking, instead of the python code outputting to the console, can it interface with the c++ code? So the c++ takes the download progress from the python code and shows it in game.
The python code has been packaged with py-to-exe.
08:21
Does the C++ code launch the Python executable in a separate process?
If so, it can simply read the progress status from the output stream of the Python executable. The Python executable doesn't even need to be modified.
@Dave Yes, being able to create good problem descriptions takes practice and experience.
@CodyGray that is what I was trying to say first. When the game exe launches it calls something in the folder, the main Dev said it's a DLL. This this checks if the game folder has all the right files. If it does not, the python exe is called to download the file. How would the c++ code read from here on?
@holdenweb thanks. I'm still learning bit by bit.
Should we write the output stream to a text file?
Kudos for taking the feedback from the others and responding positively. You'll do.
I've never give into this before so I don't know which module or library to use. And how to even progress.
No, you don't need to write the output stream to a text file.
When you launch an executable, you get a handle to its output stream.
So the Python program can just write directly to its standard output stream, but that output stream will be received by the calling application.
08:33
Wild idea... could you make the Python executable a micro-service (using RCP) and then issue anything from the C++ main process from that?
I don't even know what that means
I would just read from the output stream. Or use a callback function.
It's kind of a gnarly problem. You want to communicate with the code, written in C++, in a running process? Presumably the game is what triggers the execution of a separate Python process? In that case the best you can do is agree some protocol that has your Python program output a chunk of data, terminated with a newline, periodiically to indicate current progress. Would that do?
Yeah, that's basically what I'm suggesting. The Python program would write that data (in an agreed-upon format, since you control both programs) to its standard output stream. The C++ program, which launches the Python program, would be given a handle to the output stream of its child process, and it could read the output of the Python program directly from that stream.
That isn't necessarily the most efficient approach, but it requires minimal development work.
This is a great idea, but I don't know how to even code this. What is an output stream? What do you mean about protocol. Thank you guys for the ideas though.
Ah, you may be in over your head, then :-)
Protocol is just some established format that both sides agree on, so they can understand each other.
An output stream is... what every program can output to. When you have a console application, its output stream is stdout, which gets redirected to the console window, resulting in the text that you can see in the console.
I don't even know what Python's built-in command to print/output a message is, but whatever it is, it sends that to the standard output stream.
08:45
Ok.I understand the output stream will enough. One question though. Can you give some ideas of a protocol? I think that would be my main challenge.
It's whatever you want.
It can be something as simple as you send a number (in text format), followed by a line break, for each progress change.
1
3
8
9
10
15
etc.
Or, you know, serially incrementing from 1 to 100. But that's not as fun. :-) And no real-world progress bar works like that...
Ok I understand. Let me explain to see if it's right. The python code would output in such a way that the c++ code understands. So it takes that output and then displays it.
Right
Thanks to everyone who helped
That one @Cody? :p
08:57
Haha
Well... that's a particularly pathological case caused from early estimates with insufficient data.
I mean more that not every operation takes exactly the same amount of time. Some complete faster than others, so the progress bar is almost definitely going to jump. Unless you're just running a timer....
I get rather piddled off when it says 100% and you're tapping your paws on the desk 30 minutes after...
Some software produced by my company has progress bars that will routinely run backwards.
They get to 90% or 100%, realize there's more work to be done, and then jump back to 70%. Repeat again, and again, and again...
This is not software for which I have access to the source code, or this maddening behavior would have been changed a long time ago. Even if all I could do was replace the progressive progress bar with an indeterminate one.
must be frustrating for you and the users
Most frustrating for me is that my drivers are providing accurate progress estimates, but the higher-level GUI is ignoring them. :-|
heh... not sure if bad or not, but every time I see something that comes up computer wise with "time to install".. (or update or similar) . I just shove it to another virtual desktop
09:12
A couple of things wrong with that... One, it runs slower if it's running in the background, and will slow down your stuff if it's hitting the disk a lot (which is common for installers). Second, way too many applications don't properly handle multiple processes running during their installation. I'd be afraid of something getting corrupted.
09:35
@holdenweb I'm curious about how wtforms got bundled into that?
If it's an API you're building, are you just pulling on its validator methods?
@CodyGray based upon your experience, can you give an an ideal progress bar that would work for both my python and C++ code. The one I use right now uses some python modules which the c++ cannot access.
@JonClements how did your DB voodoo pan out in the end? Did you manage to restore at least most of it? :P
@Dave I don't understand the question.
 
2 hours later…
11:20
cbg
 
3 hours later…
13:56
@roganjosh yup... took some voodoo... got it back to a state that was probably 2 minutes from where it should have been - but it's close enough... need to look at logs to see if there's anything in that 2 minutes that should be there... but that's not my job (might well become mine but it's my day off - so they can sod off)
@roganjosh ironically, the same guy that's "looking at it to fix it", is also the one the f*ed it in the first place... so could well be expecting a message later :p
they still have access to the db...?
I guess that's your job security
@AndrasDeak I'm not in charge of hiring/firing who my clients use... were it me though... they'd be out the door pronto
@AndrasDeak heh... getting some pennies for correcting f* ups is always nice... just don't want 'em in the first place
as I said before ^^^, I've made 'em, everyone makes 'em...
still make mistakes and won't write perfect code... pretty damn sure I have the wits about me to double check what DB I'm doing truncate some_stable on though before executing it :p
14:17
I didn't necessarily mean "fire", just "revoke access to prod for the time being"
I have access to do that, but not the remit to do so... shrugs
14:31
I've written to the client anyway with my opinions... up to them
 
8 hours later…
22:31
@roganjosh If it were just an api there'd be no need for forms, would there? Human input's a part of the deal.
 
1 hour later…
23:49
@holdenweb that's why I was asking, because you're dealing with fastapi?
You could still use the validators without it being a web form. wtforms is one library I really haven't enjoyed using
@JonClements This sounds like a fun setup! :P

« first day (3913 days earlier)      last day (1258 days later) »