« first day (4434 days earlier)      last day (497 days later) » 

2:32 AM
hey guys, how can i use regex to match the string contains number and underscore, and must contans both of them?
[\d_]+ can only match any of them
 
 
2 hours later…
mr5
4:51 AM
omg
my brain isn't working
 
5:55 AM
@mr5 coffee time! i mean a 15mins break, with a coffee
Im interested in pigeons topic after back from london, curious in why wild animals are so much friendly and dont afraid of human, especially pigeons and squirrels, they even climbing and standing on human
 
6:32 AM
@Mr.Squirrel.Downy ^(?=.*\d)(?=.*_)[\d_]+$
Although if it's one number and one underscore, you can just check for all two permutations: ^(?:_\d|\d_)$
 
6:59 AM
oh! it works! I forgot that I can use "lookahead assertion" to check target contains certain characters!
(?=.*AnythingNeedContains)
 
Yes, basically. There is no other (sane) way to do it.
 
 
1 hour later…
8:08 AM
Good moaning
 
Good morning
 
 
2 hours later…
10:34 AM
Hello all,
what does "deterministically" mean here?: https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose#:~:text=it%20is%20true%20when%20deterministically%20called%20and%20false%20when%20non%2Ddeterministically%20called.

Does it mean explicitly?
 
it is similar to predictable, basically in a deterministic approach, you would be able to tell when exactly a certain operation happens
if you do:
using (var x = stuff) {}
you can determine that the Dispose() will run after the code block
if you rely on, for example, the garbage collector to do its work, you cannot determine ahead of time when the Dispose() will run, hence being non-deterministic
 
Got it, thanks
 
11:03 AM
In the context of the Dispose pattern:
why setting objects to null in the Dispose method, aren't they supposed to be "managed resources", hence GC can take control of freeing the memory allocated to them? also the same question for event handlers, and unsubscribing in the Dispose method
 
[milleniumbug] tbh "dispose pattern" is utterly bad
 
@Botler go on, you got my attention
 
[milleniumbug] it's specifically for a case when a.) you have a base class b.) someone else inherits from it c.) that someone else puts an unmanaged resource in a derived class
 
by unmanaged resource you mean things like loading external .dlls i.e. by P/Invoke?
 
[milleniumbug] this is a really bad idea as the complexity of dealing with unmanaged resource is high and the responsibility should be delegated specifically to a class which makes the unmanaged resource into a managed resource
[milleniumbug] most notably it's not stuff like System.IO.FileStream
[milleniumbug] so anyway, we satisfy Single Responsibility Principle and we avoid putting unmanaged resources in classes which have other responsibilities
[milleniumbug] and once we only have managed resources, the only thing necessary in a Dispose method is calling the Dispose on the contained managed resources or unsubscribing from events, and optionally having a flag if you want operations to throw
[milleniumbug] on disposed objects
[milleniumbug] mshwf, I can talk a looooooot about this subject, but theoretically I can't slack much at work
[milleniumbug] so for now I'll be brief and I'll potentially elaborate later
[milleniumbug] yes, deregistering callbacks from events is very important to avoid keeping a references to objects longer than necessary, and therefore avoiding memory leaks. setting to null is not needed that often, but it may be useful sometimes.
 
11:18 AM
Maybe setting objects to null in the Dispose method is just a matter of time; I mean: "Don't wait the GC to free the resources these objects are consuming, instead, free them now, as I no longer need them.."?
 
[milleniumbug] do note that from the runtime and language perspective Dispose() is just a method and there is nothing tying it to the GC mechanism
[milleniumbug] a significant part of dispose pattern involved tying them together and making sure the code between the finalizer and Dispose is shared, and whatever must be called in one of these is called and whatever must be not called is not called
[milleniumbug] but this is something one opts into
 
11:46 AM
@milleniumbug you like Red Alert 2 more?
actually, nvm, that is the same as the dispose pattern
generally speaking, I'd use the execute-around pattern over dispose pattern
using var stream = File.OpenStream(path);
stream.Write(bytes);

vs

File.OpenStream(path, stream => {
	stream.Write(bytes);
});
würst käse scenario in dispose is that you do not dispose and keep using resources, potentially piling up and slowing your application down until it breaks
würst käse scenario in execute-around is that you assign the stream to a variable outside of the lambda, but then having a reference to a stream that is already closed, so you just get an exception when you try to write stuff to it
// bad (missing using)
var stream = File.OpenStream(path);
stream.Write(bytes);

vs

// bad (violating scope)
Stream? st = null;
File.OpenStream(path, stream => {
	st = stream;
});
st.Write(bytes); // Exception
 
12:02 PM
[milleniumbug] you can't use control flow with execute-around
[milleniumbug] this seem to be missing in your analysis
 
control flow?
you mean return, break, continue and stuff?
 
meh, I dont care about those
they are smells anyway
they couple everything in the method, not allowing you to extract out the correct layers of abstraction, and on every addition of stuff simply makes the method larger
and in most cases they are not necessary and there are easier ways to do stuff
what I did not include in my analysis is larger scopes
for example, for loggers, you might want to have that stream open for a longer period of time than just in one function call
I dont really know of a nice way to inherit resources
public class Logger
{
	private Stream Stream { get; }

	public Logger(string path)
	{
		Stream = File.OpenStream(path);
	}

	public void Log(string text)
	{
		Stream.Write(text);
	}

	public void Dispose()
	{
		Stream.Dispose();
	}
}
 
mr5
12:37 PM
I am struggling to explain something to PO
I've already explain it to them in meeting but they still want me to document it.
My mind is going blank _____
 
mr5
1:04 PM
When mentioning code within an English sentence, e.g., "I used WKWebView to display this thing...WKWebView is something that ...", and I chose to italicize WKWebView, to denote importance, should I italicize it throughout the entire document?
 
you should inline-code-block it
so that you try to be explicit about it being code, even when it is not important
 
Oh god, I want to ask about Dispose pattern again... should I?
 
should I answer the same?
or just reference to earlier convesation?
or is it a different question?
 
surely it's different
 
mr5
@Wietlol we're using Confluence, and I believe that can be done via back ticks, but I found it not visually appealing
 
1:10 PM
I find your face not visua... I mean, that sounds like a minor inconvenience
:)
 
mr5
What if it's a brand name, e.g., Chrome, Firefox, should it still be inline-code-block?
 
if it is code, then code, if it is not code, just text
if it is a quote then quote tho
although if it is just a single word, you could choose to not even do any styling
 
mr5
@Wietlol my face is drawn by a USAnian, not a Japanese weeb, what can I do
 
> we use Newtonsoft.Json for json (de)serialization
 
mr5
why did you parenthesize the (de)?
 
1:12 PM
> I prefer to do a != null ? a : b over a == null ? b : c
the sentence "in the Product class we ..." is probably in between
it is just mentioning something but not actually being code
for that, just choose what feels nice
@mshwf if you have questions, you can always ask
 
thanks, I'm collecting the info and reference links from Docs, they are three questions now
 
mr5
This documentation shit is making my job very stressful
How about abbreviations, do I code-inline-block them too?
err, inline-code-block
 
abbreviations?
like...
We create websites, webservices, etc
 
mr5
google fu says:
a shortened form of a word or phrase.
"SKU is the abbreviation for Stock Keeping Unit"
 
1:19 PM
@mr5 I don't think Confluence uses backticks for formatting. It has the WYSIWYG editor. You have to choose the Monospace style at the top: i.imgur.com/TpZ73dQ.png
 
and etc is the abbreviation of etcetera
 
Mark your text then choose it from the dropdown.
 
mr5
eh what
 
But the way it formats it is not great. I'd consider Monospace + Bold
 
mr5
It's the same though
I tried back ticks and the one you suggested in your ss
 
1:21 PM
This looks much better than what we have. Maybe it's a plugin or something that adds the backticks. We just have the WYSIWYG editor. Same as my old job.
 
mr5
enumerating those code in English with code block formatting looks horrible though
Your Confluence does different thing for back ticks?
 
More specifically, doesn't do anything with backticks.
Just adds them in the text.
 
mr5
hmm, we must be using different Confluence version
 
1: Why it's a bad idea to free managed resources in the finalizer? The false parameter passed to the Dispose(bool) method indicates not to dispose of managed state (resources).. there seems a reason!

2: Why it's important to implement IDisposable when implementing IAsyndDisposable (https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-disposeasync#:~:text=Dispose%20method.-,Caution,-If%20you%20implement), I still can implement IDisposable logic in IAsyncDisposable, so why both?
 
1: you have no control over when the finalizer runs... if it runs at all
just like the example before, the Garbage Collector is in charge of the finalizer stuff, so if you dispose stuff inside the finalizer, you can no longer determine when it runs
 
mr5
1:26 PM
I second that
 
2: Dispose() and DisposeAsync() are 2 separate functions
 
mr5
but isn't explicitly disposing resources in C# in general does not also guarantee it will be freed immediately?
 
it doesnt really matter, because the compiler will prevent you from running anything that would violate the contracts of the disposable
@mr5 no, Dispose is just a normal method on a normal class with a normal interface
you simply tell the object you are done with it, which allows it to stop using resources earlier than if it would during the GC
it could also be necessary for GC to operate
certain event-systems will have cyclic references, often preventing the GC from clearing all the garbage
 
Or maybe the Microsoft docs, refers to the situation where the developer disposes only async resources in IAsyncDisposable, in such case he may ignore the sync resources, then a memory leak could happen?
 
Microsoft docs are wrong... probably
but only on the details
effectively, IAsyncDisposable and IDisposable are 2 separate interfaces, using different keywords to do similar things
IAsyncDisposable allows you to do await using
IDisposable allows you to do using
if you only implement one and not the other, using the incorrect keywords is a compiler error
the same if you have a function that has an argument of IDisposable, you can only give it instances that implement that interface
the only thing I can think of what they would mean is something silly like this
public static void DisposeBecauseICan(object instance)
{
    if (instance is IDisposable disposable)
        disposable.Dispose();
}
although, if you are doing this, you have a bigger issue
but even if you failed as a dev, maybe you can work as a chef for the exellent spaghetti you can make :D
 
1:37 PM
> würst käse

I love it :D
 
mr5
@Wietlol heh, this reminds me of that discussion about async/await implementation: whether bake it into the language or use language itself to build it. Isn't it better that this issue gets detected at compile time?
 
> is a compiler error
isnt that detected at compile time?
 
mr5
Yes, sorry that sentence requires more context
 
imo, async/await should be baked into the runtime, not the language
 
mr5
The other solution to implement async/await in C# is to do it like Kotlin way
 
1:41 PM
HttpResponse response = httpClient.send(new HttpRequest()); should already be "async"
Kotlin way is the same as C# way, but they just use a smarter compiler to do the work
and have reasonable defaults
 
hey guys you may remember from a few days ago I was really concerned about an OIDC thing with .net framework 4.5. turns out intellisense> documentation. there was an option that is deprecated according to documentation but not in my version which was critical redeemCode
so now I succesfully get back a jwt from an IP after the redirect. and when I plug it into any decoder the scope pops out of the user (no key needed, does that mean it is unsafe)?
 
jwt is a token that you give out on trust
you give it to your user, expecting them to keep the value a secret
if anyone else would know the jwt token, they could impersonate that user
 
mr5
@Wietlol tbh, I still don't get how coroutine works in Kotlin
 
nodding. most people who use my app wouldn't know what a jwt is. but i understand
 
@mr5 you dont know how a car engine works either, you just need to know how to handle the steering wheel
 
1:48 PM
if I have a jwt i can plug it into here
 
@Sagick normally, you wouldnt introduce the jwt to the user anyway
 
@Wietlol what do you mean
why
sorry
i misread wouldn't as would
 
it should usually be handled by the website, the user only needs to know if it is there and if it hasnt expired yet
 
right
I follow you
 
you can plug it into jwt.io
 
1:50 PM
yeah I tried and I get a value and it looks great
 
mr5
@Sagick the signature part acts like a checksum. It's up to the issuer to validate it
 
but I don't kknow how to decode in c#
 
mr5
header.payload.signature
 
there is a library for it probably
 
mr5
you can decode both header and payload. signature exists to determine if it has been tampered
 
1:50 PM
I tried googling rs256 c# and all i get is public private key ecoders
@mr5 that's cool
 
mr5
they are all base64 encoded, you just need to split them by '.'
 
mr5
but yeah, just use a library
 
@Sagick "C# jwt decode" would get you more interesting results
3
 
mr5
you don't actually need to decode the entire JWT though if you just want to check if it's expired
 
1:52 PM
@Wietlol can you see that i just starred your message?
 
no
 
well thumbs up anyways
thanks
 
I can see that someone just starred my message
 
mr5
you starred it twice
 
I cannot see who
actually, maybe Wietbot can...
 
mr5
1:53 PM
he's lying. wietlol can see everything happening in this room
 
I can only stare a message once ? @mr5
why are are there 2 stars
 
mr5
dunno
 
 
2 hours later…
4:06 PM
posted on December 06, 2022 by Dante Gagne

We often hear feedback from users like you that request smaller quality-of-life improvements in Visual Studio. While we can’t address every piece of feedback right away, we appreciate the time you spend providing it and hope you continue to share your thoughts on how to make Visual Studio even better. The post What’s new in Visual Studio productivity appeared first on Visual Studio Blog.

 

« first day (4434 days earlier)      last day (497 days later) »