« first day (4283 days earlier)      last day (658 days later) » 

mr5
12:21 AM
@Freerey what does pos mean?
position?
person of shit?
point of sale?
 
 
2 hours later…
mr5
2:32 AM
3 messages moved to #!/bin/bash
@Wietlol I noticed in Kotlin string.equals, it doesn't produce an NPE if this === null, and it also seems like it's an instance method instead of the usual extension for safe invocation check. On that regard, how would you tell if a method is safe to be invoked if an object instance might be null?
1 message moved to #!/bin/bash
🤦‍♂️
 
 
1 hour later…
mr5
3:45 AM
hey folks
 
 
1 hour later…
5:58 AM
Good morning
 
6:24 AM
[Squirrel in Training] GoOoOoOoOoOoOoOoOoOoOoOd Mornin' neglecterinos!
 
6:54 AM
[milleniumbug] mr5, the same way you do with C# extension methods: the docs
[milleniumbug] this is good, as the way Java checks for equality have always been utterly moronic
 
7:20 AM
@mr5
public actual fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean {
    if (this === null)
        return other === null
    return if (!ignoreCase)
        (this as java.lang.String).equals(other)
    else
        (this as java.lang.String).equalsIgnoreCase(other)
}
this is the actual function
in case of nullables
 
mr5
yeah I saw that too
 
i guess the equals method is one of few exceptions where null is handled differently
everything else has the same rules C# has
which means NPE for member methods and a null pass to extension methods
 
mr5
but let's say for a newbie, they might assume it's always safe to invoke instance methods after encountering this
 
not really
 
mr5
why not just make every methods have this check
 
7:23 AM
if you actually type a.equals(b) the IDE will show it is an extension method
 
mr5
wut? so it's an extension method?
 
the actual fun is
 
mr5
@milleniumbug I was thinking it would be more intuitive to have a certain pattern in the name or some indicators that would tell it's an extension method or safe to be called from a nullable instance
 
you also dont have that problem anyway
 
mr5
y though
how
 
7:27 AM
null is not a valid value for an instance of Any (the root type)
if you have a function that does not explicitly allow nulls, it wont have nulls as input
because you cant call it
fun foo(a: String?)
{
	a.replace("", "")
}
this wont compile
because in Kotlin, the compiler actually cares about nullability
> Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String?
as long as you stay away from the assumed types, nullability is pretty well preserved
 
mr5
how about lateinit var or a Java variable which is used by Kotlin and have its nullability check a bit confusing for compiler
 
the java variable is from an assumed type T!
which is where the compiler becomes more lax
 
[milleniumbug] yeah, nullable types solve the problem of not knowing if a function is safe to call
 
lateinit, iirc, will throw a special error though, indicating the value has not been initialized yet
it wont leak null references
 
mr5
compiler assumed it's not nullable but it may actually be because it's from auto gen gralde file
 
7:33 AM
in the currently built gradle file, will the value be null?
or might it be null in future generations?
 
mr5
it might be null in other "flavors"
 
in case of the first, something's fucky
 
mr5
it's currently not though when I ss this
 
in case of the latter, you should tell the compiler to shut up and be a smart ass and do the null stuff anyway
 
mr5
but we have this setup for multiple "Android flavors" where it will be null
build variants*
@Wietlol but isn't it still technically NPE?
 
7:37 AM
that is an implementation detail
the technical difference is that null leaking values throw the exception later in the process
which hides where the null actually came from
an eager null check, as implemented by lateinit, throws it when you try to access the variable, which is clear where the invalid state came from and when
 
mr5
7:48 AM
It maybe that Kotlin have stricter rules for matching nullable and non-nullable
 
what do you mean with "matching"?
 
mr5
8:00 AM
@Wietlol I mean something like this will only work for nullable string right
 
it doesnt compile, so it doesnt work
if you mean the check, it works for every single type
 
mr5
a: String? = null
b: String = ""
a.equals("")
b.equals("")
Both will not produce warning
 
true
and?
 
mr5
So how do you tell if a method is safe to be invoked without checking the implementation or docs
 
it is safe to be invoked if the compiler allows it
these are 2 different methods that you are calling
the first is an extension method, the second is a member method
 
mr5
8:07 AM
oic
but then again, it is confusing on the first glance
 
no, it is not
you coming from a land of perpetual fear of nulls being everywhere, prevents you from diverting the question to the compiler
does the compiler allow it? if so, then you are fine
 
mr5
some devs are actually eager to remove the error by whatever method they know
Some force unwrap the nullable !!.
So I think it's fair to say it's confusing for them
 
then those devs dont know the methods, they just dont care enough to learn them
!!. means "My arrogant arse knows better than you what this code is supposed to expect, and I am perfectly fine with having errors that no one can reason with and are difficult to identify."
 
Invalid command! Did you mean: 3, c, d? Try help for a list of available commands..‍.‍.‍.‍
 
no, I did in fact not mean 3, c, d? Try help for a list of available commands..‍.‍.‍.‍
 
8:14 AM
!!3
 
I don't know what I expected
 
!!c
 
@Wietlol "undefined"
 
!!d
 
8:17 AM
 
im scared to click that link...
 
lol, teh thumnail indicate unavailble video
 
Since oneboxing doesn't work, the video probably doesn't exist anymore or something
 
Video is not available any more
 
mr5
 
8:18 AM
||info d
 
I'm a bot. I am owned and operated by @JBis. I am open source. I am written in JavaScript.
 
Damnit I just wanna know who made that command
 
James giving you the deets on the D :P
|| man d
 
d: "User-taught command: https://www.youtube.com/watch?v=0O82h5F2AN8#t=12" Creator: rlemon
 
Had to test that in the sandbox. Which also triggered another bot to respond. I found it very funny.
in Sandbox, 3 mins ago, by OakBot
@JamesBot Hi a bot, I'm Oak!
 
mr5
8:27 AM
Hey, does anyone know if a login session issued by SAML can be converted so that it can be used by SP that are using OIDC
Say for example, I login from SO using Google and SO is using SAML for their SSO. Since I am logged in to Google, I would assume I can use this session other than SO considering it was initiated by SP (SO) using SAML protocol
 
 
2 hours later…
10:01 AM
Hi all
 
Is it possible to serialize an Entity Framework object graph and then deserialize it?
 
You mean like...export the database?
 
[milleniumbug] if you think about it, that's pretty much what EF Core is doing when you save changes
 
Well, not the database but an entity and its children. Basically, we're trying to archive a record
To take a snapshot
 
10:09 AM
[milleniumbug] you can use changetracker to get the entities in the "before" state
[milleniumbug] I used that capability to record a history entry when an entity was changed
 
@Alex so, you are asking if it is possible to serialize an object and deserialize it?
EF doesnt have any special stuff to it
 
Yeah, thought so
 
if you just want to log the changes, you can use Audit tables though
but storing a snapshot is probably just serializing to json
 
10:37 AM
It seems there's no easy way to use something like Newtonsoft's serializer to "stringify" this
 
11:00 AM
why not?
what horrible atrocities have you performed on those poor objects?
 
[milleniumbug] tbh you have a higher chance of successfully serializing these than any other objects
 
hold up, let me pull out my PrinterConnectionStream class
 
12:06 PM
@mr5 your second guess was almost correct
 
[Captain Obvious] JsonConvert.SerializeObject(EntityObject) works fine
[Captain Obvious] If you have circular references then you may have an issue, but you can set JsonSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore to solve that
 
12:59 PM
Thanks. The circular refs have caused headaches before but good to know there's a flag for it
 
 
2 hours later…
3:08 PM
If you have a list A that contains ints 2, 3 and you have a larger list B that contains 1,2,3,4,5, how do you check that all items in A are in B using Linq? Is it a simple Contains?
So both 2 and 3 need to be in B
 
A.All(it => B.Contains(it))
if B is collected into a set, this should be fast
 
Oh, you're right, it's a .All
Combo of contains and all
Thanks
 
3:39 PM
[Captain Obvious] So you know how building & Signing Xamarin apps is painful enough already
[Captain Obvious] Well imagine doing it from the command line
 
3:51 PM
[Captain Obvious] Specifically, writing a powershell script which works on multiple peoples (slightly differently configured) machines that does it all
[Captain Obvious] Anyway, good luck, see ya next weekl
 
 
8 hours later…
11:46 PM
 

« first day (4283 days earlier)      last day (658 days later) »