« first day (1963 days earlier)      last day (1527 days later) » 

3:44 AM
@Shepmaster and... it does indeed work. I am confused by many things, I think one at the center of it all is: what actually are macros? I would naively expect two methods named with the same name to create problems at compile time, yet everything runs just fine.
I don't think I've seen a chapter specifically about that in the book
 
 
4 hours later…
7:57 AM
@Stargateur: If one as_deref() call converts an Option<&String> into an Option<&String>, two as_deref() calls will convert an Option<&String> into, well..., an Option<&String>. — rodrigo 16 hours ago
(which means you need three as_deref())
 
8:31 AM
@DenysSéguret somehow I understood that one deref did Option<&T> to Option<T>... :p
well, map will do that job
It's was just an idea
 
@Stargateur I also asked myself initially whether one additional deref would solve it so I won't mock you too much
 
I already saw some code need into().into() or similar :p
 
I'm still not at ease with those deref things
 
same
 
I've removed some Into implementation from some of my code because I was finding it painful to try to guess what was magically happening and I had had a bizarre bug related to the wrong type. I prefer to be cautious with those hidden conversions
 
8:35 AM
you should implement From not Into BTW
 
I guess it was From, but it's the same, the other one is deduced
 
well, I implement tryfrom for bson, this crates is bad, you need to do that: bson::from_bson(bson::Bson::Document(doc)) doc is doc: bson::Document
so they have an alias bson::Document that is a bson::ordered::OrderedDocument. And bson::from_bson only work for document but not these last two this one bson::Bson::Document
Simple no ?
 
 
3 hours later…
11:48 AM
Hello everyone...
 
 
2 hours later…
2:15 PM
o/
One thing I struggle with when writing high-level integration tests against a server is being able to find many arbitrary ports to use.
So I usually end up just hardcoding it and hoping for the best.
Is there a great technique for process 1 to see if a port is open and then spawn process 2?
I get that there's a possibility for a race condition where something takes it between steps 1&2
 
I wrote an answer to stackoverflow.com/q/60451635/3650362, but the OP added a stipulation to the question that makes my answer invalid.
However, the question can now reasonably be considered a duplicate, at least IMO.
What's a good thing to do in this situation?
I'm thinking either (1) mark it as dupe and delete the answer, after all I should probably have asked for clarification first; or (2) revert the edit to the question and encourage the user to ask a new one (but obviously I've already linked to the questions that should answer such a question)
 
I don't think that (2) is the best here. Simply marking as duplicate (hammering it if you can) and leaving the already posted answers is fine
you could have asked for clarifications, but the question was not glaringly unclear that anyone would meta-shame you into having answered without asking
 
2:40 PM
@trentcl (1) is probably the least contentious, as it answers the OPs question. If you think that your answer adds value to the site, you could ask the OP to post another question (unlikely) or you could self-ask-answer
 
2:50 PM
Let's see if just linking the other questions is enough to convince the OP to accept my answer...
 
3:18 PM
heh, I was thinking "yeah that's pretty much opinion based" before realizing that question from feeds was actually on code review :)
 
3:38 PM
@Shepmaster maybe but this will be os specific
 
@Stargateur right, you can bind to a random port and then get it.... is that the best option?
 
@Shepmaster That quite good, that would be better if a function like bind_and_return_port but :p
for your use case it's good no ?
@Shepmaster and it's not totally random
just an random open port
so unless all port are used this will not fail
for testing it's perfect no ?
 
4:10 PM
The thing is that I know what I want is actually possible.
You bind the random open port, then pass that file descriptor to the forked child
Which is some Blacke Magick.
and probably only cool on certain OS
 
 
1 hour later…
5:20 PM
@Shepmaster child already be forked ? before ?
 
5:44 PM
@Stargateur nah, you'd find the open port, then fork.
10
Q: How can I pass a socket from parent to child processes

user1995143I'm stuck on a problem in a C program on Linux. I know that when a processes is forked the child process inherits some things from the parent, including open file descriptors. The problem is that I'm writing a multi-process server application with a master process that accepts new connections a...

 
5:58 PM
@Shepmaster so no problem ?
 
@Stargateur well, it's very tied to the OS
 
if the socket is open before the fork, the child can use it without problem
 
On operating systems that use fork :-)
and not using exec
and not automatically closing all file descriptors
 
6:30 PM
I don't know that it guarantees anything...
 
7:01 PM
Two updoots for a question linking to a ZIP of source code?
 
 
2 hours later…
8:54 PM
folks do be shameless with upvotes
 
9:17 PM
I got an email asking me to remove a downvote.
and that same question now has two upvotes and one downvote
Smells like vote manipulation to me... shrug
 
9:35 PM
@Shepmaster what?!!!!!
from who, a concerned citizen or SO?
 
@FélixGagnon-Grenier from the author of the question
 
wow :/
would you er, happen to be able to link to that question? whistles
(I promise I'll not simply be vote brigading)
 
nah ;-)
 
If you find it naturally, you can downvote it on it's own merits
Don't worry, I'll still link to questions that should be closed
 
9:46 PM
:P
 

« first day (1963 days earlier)      last day (1527 days later) »