« first day (1805 days earlier)      last day (1677 days later) » 

6:07 AM
Thanks! I'm going to this this but instead use Command::new to run the command as sudo and then process::exit(0) to end the non sudo process. — SmushyTaco 2 mins ago
what?
 
6:28 AM
shrug
 
 
1 hour later…
7:34 AM
Hem... now the comment disappeared at the same time another answer is created with the same content and my answer is unaccepted...
And this answer is just crazy
 
Aha, so that's what the comment meant
Definitely an odd way to do it
 
8:11 AM
Should we close the question asking for an example of struct with 2 lifetimes ?
 
I don't see the point of the question. The more references there is, the more lifetimes there is too
 
I think the most I got to was 3 lifetimes in a struct. Did you get to more ?
@FrenchBoiethios Sometimes you can have the same lifetime for several references
 
8:27 AM
@DenysSéguret I think the question is fine. Seems like someone just has to write an answer with the information in the comments.
 
I'm writing an answer, trying to explain more
 
@DenysSéguret Sweet, thanks :)
 
@DenysSéguret Sure, but that's very specific
 
@FrenchBoiethios yes, I just mean you're not always forced to use different lifetimes
 
@DenysSéguret "real time" -> "real world", I assume?
 
8:35 AM
yeah, sorry
 
@DenysSéguret np, just wanted to quickly tell you without editing myself, as you're still in the ninja-edit period ^_^
 
@LukasKalbertodt thanks
 
Do you sometimes define (and write down) a convention for naming your lifetimes ?
 
8:56 AM
@FrenchBoiethios I don't think it needs to be closed. It represents a confusion about how lifetime annotations work, and could be useful to someone else having the same misconception.
It's part of someone's journey towards understanding lifetimes.
 
That's not false, I guess
Do you have any shortcut to get the last item of an iterator and the count of items?
 
can't you do enumerate().last() ?
 
@DenysSéguret Oh, right... I'm stupid -_-
5
 
@FrenchBoiethios Starring this message as "useful / interesting for the transcript"
 
@PeterHall LOL
 
9:04 AM
@PeterHall Thank you
 
I doubt it could get as many stars as E_net4's Phd announcement. But I like to see the two messages next to each other in the list :)
 
@PeterHall You convinced me
 
@PeterHall well, but that was pinned, not starred -- so it is kind of cheating, you know ;)
 
@DenysSéguret I assume everyone already understood that, but just to be sure: that number is the last index which is "count of items - 1". So add one.
 
@PeterHall And yet I do not know why that message is pinned.
There, unpinned.
 
9:12 AM
@LukasKalbertodt I thought I didn't need to precise that
 
Wait, we can pin messaged? 0.o how is that possible
 
@E_net4theMeta-RemoveR it didn't bother me -- that's not why I mentioned it..
 
@LukasKalbertodt Room owners can do that for as long as I can remembe.r
 
@LukasKalbertodt Yes, I needed to add 1
 
@DenysSéguret And you are probably correct in that assumption. I am often too cautious :P
 
9:13 AM
@PeterVaro Uh, yeah, I don't believe it bothered anyone, but I think we can let it go now. ;)
 
@E_net4theMeta-RemoveR No problem with your unpinning but other starred messages aren't really more interesting...
 
@DenysSéguret GATs.
 
The funny thing is a RO can pin their own messages
 
@PeterVaro Why not ? Imagine an announcement. It's not a kind of reward like an upvote
 
9:15 AM
I don't know.. it always felt wrong to me when I was RO
 
pins in SO chats are always badly used. I know they're very important in Miaou where rooms are more focused: all kinds of important announcements are pinned (and there's an optional feature to ask for your acknowledgment)
 
well, in general SO chat is horrible -- the features are adhoc, and there's very little logic put into it..
I've been moaning about this for years, SO doesn't really care
 
They care more about w e l c o m
 
@E_net4theMeta-RemoveR ROFL
yeah, and I know, that changing the background of closing message to blue is more important and will have higher impact..
but still.
 
Yes, it's horrible. There are a few good points though (even if not counting the fact it's on SO and related to a language) compared to a few hyped recent chats: doesn't break the browser and doesn't just display five lines of text with fancy backgrounds or spaces around.
 
9:21 AM
true.. I was actually thinking about this aspect of sites yesterday. I created a nice plugin/addon for a torrent site, to that it would support j, k, l, and ; key navigation (for scroll and pagination respectively) and the only reason I was able to "hack it" is because it was using the good ol' ways
 
There are already a few plugins and themes for the SO chat
 
I know, when I created the C chatroom, I also created a publicly available GreaseMonkey/TamperMonkey script package for quick standard insertion, book recommendation links, etc.
Anyway, you can make it easier to use, but features are genuinely missing from the chat
which you cannot just fix with tweaks on your local client
 
I started Miaou because other chats, including the SO one, were missing too many features
 
I did not know you created Miaou -- well done, matey, I remember (quite a few years ago) we used it for RO meetings in the Python room
 
It's still alive. 11 millions messages, never lost one, they're all searchable
 
9:27 AM
That is quite a bit of an achievement!
 
And people now start to get this badge:
 
10:09 AM
The sudo problem is an interesting one
if your program auto-sudos you run into an endless supply of cans of worms to open, as sudo isn't just "you can sudo" or "you cannot sudo"; most people have a much tighter restriction of what people can sudo into
 
 
1 hour later…
11:37 AM
@SébastienRenauld you would get infinite recursion whenever sudo doesn't fix the permission error :D
Yuck.
 
12:08 PM
@Stargateur he defined a From<_> conversion for that line, but I'm pretty sure that's the funky part
or rather, I'm pretty sure it's not a memory leak but a use-after-free
 
:4737753I bet the code doesn't compile
 
I didn't even bother
I don't have a system with python available right now
 
Damn... Even when they're not interested in Rust, recruiters contacting me are hiring for crypto finance :\
 
@DenysSéguret WE WANT MONEYYYYYYYYYYYYYYYYYY
 
Are there new jobs outside of crypto finance ?
 
12:14 PM
ecology
health
 
I need to fix the angle of my CV
I keep getting recruiters for management positions because of my previous 3 jobs being C-level
even though the reality is that I was a principal engineer, not a CTO
Yeah okay, his problem is easy to see once you actually look past all the From<_> BS
he's forgetting the vector but not its contents
Writing an elaborate answer
 
12:35 PM
Actually, it's even worse
his problem is in python
 
@SébastienRenauld I can't say for python, but rust code have UB anyway
 
Yup
This whole thing is a stinking pile of cobbled stuff put together
like, the more I dig the less it makes sense
 
@DenysSéguret Haha, that's the same trend I've seen
 
Got it to work cleanly
Answer to get it working is in. Didn't address the forget UB
 
1:33 PM
@DenysSéguret that's exactly what my experience is.. all the startups/companies here are obsessed with finance.. or gambling actually -- for example smarkets.. Amazing salaries, mind blowing offices, equipment, extras (food/snacks, activities, perks, etc.)
but then again.. finance.. gambling.. couldn't care less about those..
 
That's kinda where the money is, tbh
 
It looks so
 
I don't care where the money is -- probably that's why I'm working in an EdTech startup I guess
 
I'm willing to accept a kinda meh salary. I don't want to work in some fields.
 
I don't even mind if I would get lower salaries, not that many extras nor a good office, but if the tech stack is okay, and the goal is something I care about -- I'm in
 
1:35 PM
Finance can be really interesting, btw. I've had a brief foray into HFT algorithms on one of my previous jobs
I didn't like the trading part, but the high frequency part was extremely interesting and teaches you to think differently about certain problems you normally wouldn't even notice
"Tech stack is okay" - that's rare
to this day I'm still waiting to meet a company where the tech stack isn't crippled by technical debt
 
Hi folks
 
How r u E_net4
 
...Is there something we can assist you with? :)
 
I'm just spending time here at my office
because I don't want to work
 
1:39 PM
That's not spending
;-)
 
ahah you r right
and looking for badges also lol
 
I don't mind work in the bank system security but work for trader play with money is not fun at all
 
I never experienced Rust btw...I'm more into Javascript
 
javascript is still a thing ? :p
 
I hope so
 
1:40 PM
I hope typescript erase it
 
Give it a shot? You seem to be mostly on the front end part of JS, but if you've ever got a backend process to write for the shits and giggles, it's worth it
Re: "new" JS languages, there's too much fragmentation on that front to tell whether TS will come out on top or not
 
Typescript is form Microsoft and yes it's making JS more easy to learn
 
Not sure about easier to learn; it's safer than raw JS though
statistically I've shot myself in the foot more often with raw JS than with typescript
 
true
 
At least, TS has sum types
 
1:42 PM
o/
 
Is someone could push on a star on my message to fav
 
The main competitor to TS is dart
 
ah yes from google
 
There's also Flow, although it advertises itself more as a linter with a language extension to JS, rather than a new language altogether.
 
@SébastienRenauld I don't think it's exactly a competitor any more
it has a different direction
 
1:44 PM
Loose competitor, tbh
 
is it Syntactic sugar like coffee script or not ?
 
Okay, this is interesting
 
I'm not from Chicago :'(
 
Dart is so shitty, that I could even spend a day on it
 
@SébastienRenauld Can you fav one of my message to get the bronze badge :D
 
1:46 PM
Dude. This isn't a badge-hunting chat
 
I know :'(
 
Just say something that deserves to be stared
Speaking about the frontend, someone shared to me a language that allows to put some JS flavored code inside the HTML
 
Do you like Nils Frahm ?
 
But I forgot its name :(
 
I didn't understand your question
do you mean <script></script> in JS
in HTML*
 
1:49 PM
Nope
Something totally inline, like PHP, but client side
 
Is it a language or a framework ?
 
I found it nice because what I don't like in the modern frameworks is that everything is javascript.
A language
It's transpiled into a classical page.
 
@FrenchBoiethios In case of doubt, say GATs.
 
That's cheating
 
Can't have enough GATs in this chatroom, you know the drill.
 
1:52 PM
@E_net4theMeta-RemoveR Don't tell those chat's secrets to everybody, dho
 
@FrenchBoiethios 'Tis no secret.
 
Too many stars
 
OK, this is going a bit out of hand.
 
GATs.
 
We'll hit the rate limiter
 
1:53 PM
@RémyTesta Nope. Only works for E_net4
 
lol
 
@RémyTesta It only works if you know what GATs are.
 
@RémyTesta This badge isn't interesting and you WILL have it if you participate in a chat. Don't hunt for it.
 
I know
Trying to help instead
 
@DenysSéguret "You have already voted, but the voting has been cleared by a moderator"!!!!
 
And in case someone's wondering, room owners can cancel stars and I'm not afraid to (ab)use this feature.
 
@E_net4theMeta-RemoveR This
 
Do I throw the word monad in
or do I just let it slide
 
@SébastienRenauld Higher-kinded chat messages are welcome.
 
I wouldn't even drop a comment in this kind of questions
Being elitist, ya know
 
1:55 PM
@E_net4theMeta-RemoveR Can you be more specific? Was referring to the specific "a Result can be seen as a sequence of zero or one element", which flat-out isn't true
a Result is always one element, of either of the two types
 
@SébastienRenauld Ah, so you're talking about that question? In that context, I doubt that it will help, the OP doesn't seem to have the necessary know-how.
 
I don't mind the OP
it's the specific comment by Jmb I have an issue with
screw it, I'm dropping the M word
@FrenchBoiethios we've all started somewhere. I don't mind this kind of question as long as the OP has had a go at understanding it
 
Option is closer to the "collection of zero or one" idea
 
@SébastienRenauld I'm that kind of guy who can read a fackton of documentation to understand something, so I treat that as laziness.
 
2:04 PM
If it had been Option I wouldn't have batted an eyelid; applying this reasoning to Result is dangerous
 
@Shepmaster I prefer to think of it as 1 + N
 
@FrenchBoiethios Oh, I'm the same on the "being able to read a fuckton of documentation", but that doesn't mean that a) somebody new to the language will know where to start or b) they'll do it efficiently
For that reason, if they had a fair go at it I'll just help them
 
Option<T> should have been Result<T, ()>
 
Both should've had the same trait with all the combinators available to either, tbh
 
I'm just sayin that for the sake of the discussion
 
2:05 PM
which is one thing that pisses me off to no end with this language on combinators; suppose I want to write my own Map - there's no trait for it
that's one of the few things I loved with scala
 
@FrenchBoiethios disagree
 
Bear in mind that the logical step is different. a Result signifies failure
 
@Shepmaster Let's begin the discussion, then :D
 
However, an empty Option isn't always a failure
that's where the important idea is lost
and it's not because they have (mostly) the same combinators (they're both monoids so you'd expect as such) that they logically mean the same thing
 
The API are very similar. That's why
@SébastienRenauld Huh, sure
 
2:07 PM
Monoidal thingies tend to show similar API patterns
We just cannot generalize them without HKT's.
 
I mean, a monoid in FP is defined as identity + map, isn't it?
sorry, identity + map + fmap
my FP theory is rusty, I haven't had anybody to talk with regarding this for years
 
@E_net4theMeta-RemoveR IIRC, the core team has said that they didn't plan to add them, don't they?
 
@FrenchBoiethios Yeah, I did not wish to imply that this was a planned feature
GATs are planned, and we'll leave it at that.
 
@SébastienRenauld No
@SébastienRenauld No, that is (almost) a monad
Monoid is id + concat (and some laws)
 
@FrenchBoiethios I'd make the argument that you are saying the equivalent of "String should have just been Vec<u8>". The semantics of the type are as important (or more) than the underlying implementation / layout
 
2:10 PM
@SébastienRenauld fmap is just Haskell disambiguation of general functor's map vs list's map
 
@PeterHall You made me search a little with your comment. Most often the several lifetime problems come from inherited lifetimes, I guess.
 
BTW @Shepmaster play.rust-lang.org/…
You may want to tighten things a bit on the sandbox; I can iterate files as I see fit
consider jailing the interpreter
 
@DenysSéguret thoughts on dupe of stackoverflow.com/questions/29861388/…
 
A functor is id + map (+ laws)
Monad is functor + flat_map (+ laws)
 
@SébastienRenauld I guess it's sandboxed, or in a container
 
2:12 PM
@SébastienRenauld it is. A docker container.
 
Nevermind then
:-)
 
@Shepmaster looks so
 
@DenysSéguret Care to cast the first vote?
 
@Shepmaster I can't vote to close as a dupe: I already voted to close with another reason. I let you close
I think I only made an answer because somebody here asked me to ^^
 
@SébastienRenauld now, that's not to say that the security is ironclad. There are some holes I know of, but it's at the level of "good enough for the people who use it now"
 
2:15 PM
I can't see docker.sock so that's one obvious way around; at a cursory glance the worst I can think of is fucking around with the net stack
 
@SébastienRenauld external network is disabled, so I assume you mean more local-ish kinds?
 
Poking around /etc doesn't seem to bring me any of the system's secrets.
 
I'm sure the "value moved here" question is a dupe, I'm not going to get trapped again :)
 
Actually, outgoing network is completely disabled so that's also good
pretty sure I could break it if I wanted to, given time, but is it really worth it
 
@Shepmaster do you kill the container between sessions, or can we implement a chat by storing text files inside ? Or maybe use your container as an online volume for our needs ?
 
2:18 PM
That's the most likely use case tbh
 
we write a new file at every sent message, and we list them all at connection, and voila, we get a chat
 
-1
Q: value moved here, in previous iteration of loop

hzqelfToday I try to solve two problems on LeetCode —— First, and Second. For the first question, I have written the correct code, but there are still things I don't understand: Playground pub fn intersection(vec1: Vec<i32>, vec2: Vec<i32>) -> Vec<i32> { let mut vec = Vec::new(); for i in vec...

Code compiles on sandbox
 
@SébastienRenauld yes, it's a poorly flowing question. They describe in prose how to break it (and the error message shows the removal of the .clone())
@DenysSéguret The webserver creates a temporary directory, volume mounts that into the container, then destroys it after the request is done.
 
@Shepmaster well done
 
No CSRF though. So that's at least one vector
if I present you with a thread::sleep(3600) and literally spam it
 
2:29 PM
For some reason I've never dug into, those don't always get cleaned up.
drwxr-xr-x 3 root root 4.0K Jun  1 20:43 playground.suYgnYZAPZKe
drwxr-xr-x 3 root root 4.0K Jun  7 21:43 playground.FtTrMIOmLifo
drwxr-xr-x 2 root root 4.0K Jun 10 01:43 playground.fToym3CrsSs4
drwxr-xr-x 2 root root 4.0K Jun 11 19:43 playground.vxnfvLhsO1JV
drwxr-xr-x 3 root root 4.0K Jun 17 04:43 playground.KtMU8EgcTTmj
drwxr-xr-x 2 root root 4.0K Jun 19 04:45 playground.n5FZFXIhCWuE
drwxr-xr-x 3 root root 4.0K Jun 28 15:43 playground.05K7BicOqgeF
drwxr-xr-x 3 root root 4.0K Jul 10 16:43 playground.IHSTDGHHupRD
 
Should've asked before - "mounts that into the container", what's in it (other than the code, I guess) and what underlying FS is it?
I've seen this happen with docker mounts
Unrelated, if anybody wants to discover some cool music, I've just accidentally re-discovered 2cellos (youtube.com/watch?v=nkcm5cT9gGI ) thanks to youtube recommendations
 
input file and a directory to store --output (really only used for LLVM etc.)
It's an ext3 filesystem in a loopback device (to prevent filling up the primary drives)
 
3:14 PM
The documentation on patches in Cargo.toml is pretty obscure IMO
 
@DenysSéguret Not helped by the fact that replace existed first and is a better name. Too bad backwards compatibility is a thing.
 
3:30 PM
@FrenchBoiethios actually, it's the : token before an assignment, :: after
where implicit returns are considered RHS of assignment
 
@SébastienRenauld What do you mean?
 
::, if I remember correctly, is a different token depending on which side of an assignment it is
also, for your question re: token+lexer, PHP's tokenizer is independent of anything else
 
4:01 PM
this question is off topic anyway
 
Thinking face
 
4:44 PM
@Shepmaster I forgot that dynamically named maps are the "legitimate" case for flatten. We have basically stopped using flatten everywhere because it allocates an intermediate map, even when one shouldn't be needed (ie when flattening the fields of nested structs).
 
@PeterHall you mean in the generated implementation from flatten?
 
@Shepmaster yes
 
I'm surprised that's a problem as {HashMap,BTreeMap}::new should be really cheap.
since they don't allocate
it's just the stack space.
 
new doesn't allocate but, when the nested field is a struct, there are always values
the number of fields is known statically, and you can write this by hand
It actually makes quite a big difference. It's not just the overhead of allocating, cache non-locality might be the bigger impact
 
@PeterHall I seem to recall you talking about this before; have a link to the bug report handy?
 
4:53 PM
@Shepmaster I'll find it. In the meantime, there was this from that same time: gist.github.com/peterjoel/eafb936143a988f6a922efd2b52ebf18
 
Someday I'll figure out how to search GH for issues I've subscribed to
 
This can be made zero cost. For now, we can write the impls by hand
by "this", I mean nesting some fields rather than having all flat structs to begin with
I'm hoping to have time to make some alternative macros for serde. I would like to support some form of "unflatten" too
 
@PeterHall could be neat!
 
@Shepmaster It's a little hard to justify the effort, because we basically have hand-rolled the impls and tweaking them for a changed field here or there isn't really a big deal
But I would like to because it would be fun!
It's actually nice that the macros are separate so you can make different ones. The core model and traits are still pretty much ideal
 
5:15 PM
TIL in Markdown, ending a line with two spaces means <br />
 
@Shepmaster Hu ? Link to spec ? Markdown isn't supposed to interpret invisible chars
Are you sure this isn't a bug in a specific transpiler ?
 
@DenysSéguret I haven't found the spec yet, but check out spec.commonmark.org/dingus/?text=hello%20%0Aasd
 
Not Markdown but CommonMark. I haven't studied/tried this format
 
A line break (not in a code span or HTML tag) that is preceded by two or more spaces and does not occur at the end of a block is parsed as a hard line break (rendered in HTML as a <br /> tag):

Example 630Try It
 
This is insane/dirty IMO, and an obvious departure from the spirit of markdown
!!afk I must serve dinner
 
6:18 PM
 
6:29 PM
wife and kids, rather
 
7:24 PM
@SébastienRenauld I agree that asking for a library is off-topic, but there's this weird loophole around asking how to do something can be answered with "use this library"
I'd encourage you to show the Actix solution on stackoverflow.com/questions/14154753/…
 
@Shepmaster He's intending to upload something via multipart
(curl -T)
as a result, it's not a dupe of that, but it's covered by multiple libraries and therefore too broad, imho
what is the context? Is it a one-off command? Can it be blocking? If not, what is he using? tokio? an executor of some sort?
 
@SébastienRenauld assuming that OP knows what multipart is and that's not a cargo-culted flag ;-)
 
It's just too broad to recommend something. If he doesn't care about blocking calls reqwest does it, so does curl-rust. If he cares and wants something that runs on an event loop, actix-web with actix-multipart on top is the way to go
 
@SébastienRenauld Regardless of the current question, you can show the Actix solution on the other linked question
Or vote to close both as too broad ;-)
@SébastienRenauld this isn't super precise though:
5
Q: How can I perform parallel asynchronous HTTP GET requests with reqwest?

user964375The async example is useful, but being new to Rust and Tokio, I am struggling to work out how to do N requests at once, using URLs from a vector, and creating an iterator of the response HTML for each URL as a string. How could this be done?

reqwest / hyper have non-blocking
 
I voteclosed it as too broad with the intent to unvote if he specifies more
 
7:30 PM
And curl has the multi module docs.rs/curl/0.5.0/curl/multi/index.html
 
curl multi is extremely finicky though
 
Certainly. I had the pleasure of using it a bit in ye olde C
 
What did I just C
 
Could also make a case that the rust curl wrapper forces an external library as well
which may or may not be a downright pain depending on version differences installed on various hosts
Anyway. Time to finish this websocket codec and call it a day, I think
 
 
3 hours later…
11:09 PM
stackoverflow.com/questions/58070894/… - Micro-optimizing behavior
@Shepmaster I'd really appreciate your insight on this one
as I'm pretty sure that in both cases the underlying compiler will move things back to the stack if the functions are that simple (both for C++ and for rust)
I'm also pretty sure the dude is wrong about std::function being stack-allocated always
 
11:30 PM
People eyeballing performance optimizations based on incorrect assumptions. Thinking about it, I don't understand how you could stack-allocate std::function considering that it is a wrapper object; the underlying lambda, sure, but not the wrapper
 
stack doesn't mean faster anyway
 
Also correct
 
11:47 PM
0
Q: Can integers be strongly typed to specific ranges?

ListeroneCan Rust strongly type integers to defined ranges? For example, I'd like to define a type to represent months, which can be [1 .. 12], inclusive. Range checking would panic if this variable goes beyond this range.

there's a lot of misunderstandings on what a panic is in that one
 

« first day (1805 days earlier)      last day (1677 days later) »