« first day (4181 days earlier)      last day (997 days later) » 

01:32
@Squirrelkiller OK. Thanks. I don't know what elderberries are. :-)
02:20
Hello guys; when I set my volumes in my docker-compose.yml file, the destination folder always is empty; why?

volumes:
- /var/www/html:/var/www/html:rw

When I run docker-compose exec php ls /var/www/html -l it returns 0 items.

I can't solve this problem; it's wasted most of my time ):
Isn't anyone here familiar with docker volumes?
 
4 hours later…
user14803978
06:15
I have a custom type.
I want to be able to use that custom type the same way we use floats and ints.
The purpose of this type is to contain a float value between 0 and 1 only.

What I really really am desperate to figure out is... How can I make a struct assignable, like a Single or an Int is?

Like if I have
public struct Q{

}

I want to be able to declare it like so:

Q = 1.0f
user14803978
What I dont want is to have to do:

Q.value value = 1.0f.

We dont say:
Single.value val = 1.0f

We say:
float val = 1.0f
user14803978
Basically I am asking, how can I create a type similar to a native type
07:07
Good morning
@JoWmbejnjsQvujoXfUsvtu It's a reference to Monty Python and the holy grail :) dai.ly/x2hwqkt
07:26
@Triangle4 As there is no syntactical way of writing a literal Q (like 1.0f being a literal float, 1 being a literal int), you'll have to write an implicit operator so a passed number literal is "converted" to your Q:
public struct Q {
    public float Value;
    public static implicit operator Q(float f) => new Q { Value = f };
}
Then you can instantiate it like a float:
You can also write an implicit operator in the other direction like implicit operator float(Q q) => q.Value;
Then, your Q is basically a float
08:01
@Squirrelkiller: He is a good student.
08:12
cant sure, but sure was stackoverflow real fans
09:03
@Squirrelkiller: We cannot do the following in C# right?
import static java.lang.System.out;

interface OnClickListener {
    void onClick(String str);
}

class JavaInterface {
    public static void main(String[] args) {
        OnClickListener listener = new OnClickListener() {
            @Override
            public void onClick(String str) {

                out.println(str);
            }
        };

        // OnClickListener listener = (str) -> out.println(str);
        listener.onClick("Hello World");
    }
}
09:15
@JoWmbejnjsQvujoXfUsvtu Which part of this do you want to do in C#?
OnClickListener listener = new OnClickListener() {
            @Override
            public void onClick(String str) {

                out.println(str);
            }
        };
Depends.
creating anonymous type with method in c#
Not the exact same way as in java - you can't make an anonymous object implement an interface.
But you can put an anonymous object in there that has a Action<string>
If you give me like 10 minutes to reboot I can prototype something in C# interactive real quick
09:18
@Squirrelkiller Yes. I see.
@JoWmbejnjsQvujoXfUsvtu technically speaking, no, C# does not have anonymous types like Java has
@Wietlol: OK. Thanks.
however, considering your listener might be a SAM interface (single abstract method), you can write that as a lambda
in C#, you could have listeners that you register with lambda expressions
if you use the C# events, then you do myEvent += (args) => {};
however, I can recommend a better event library than the built-in events
I cant recommend a specific library though, as the one I use is a private lib
Don't listen to him, builtin events are absolutely a nice thing
they are trash
09:26
||votekick Wietlol
@Squirrelkiller voted to kick @Wietlol
but at least they are better than what you'd write in 5 minutes, so they are usable
C# is filled with these language features that could be a 3 function library
C# is like the programming language equivalent of "this meeting could have been an email"
You're gonna like javascript
It's filled with 3 line libraries that could have been a language feature
builtin events are trash. Sorry
no, because in Javasript, those 3 function libraries want to depend on a 4000 function library
and that one depends on 100 more 3 function libraries
and those depend on more libraries
and now you are waiting 10 minutes for NPM to install a new black hole per project
09:29
The following is my attempt but it does not compile:
    abstract class OnClickListener
    {
        public Action<string> onClick;
    }
    class Button
    {
        private OnClickListener _onClickListener;
        public void setOnClickListener(OnClickListener onClickListener) => _onClickListener = onClickListener;
        public void Do(String str) => _onClickListener.onClick(str);
    }

    class Program
    {
        static void Main()
        {
            Button b = new Button();
            b.setOnClickListener(new
            {
                onClick = _ => Console.WriteLine(_)
if you have to use event based stuff, just convert it to Observable. If you don't have to, start out from Observable from the beginning stackoverflow.com/questions/60443925/…
oh, and if those functions do anything with html, they will probably not work on all browsers either
@JoWmbejnjsQvujoXfUsvtu because onClick isnt a property
I would expect b.SetOnClickListener(x => Console.WriteLine(x));
I'd recommend not using fields, but I know I will get votekicked out if I say that
^ also, that
don't use _ for the lambda param if you use it
it's a language feature to ignore the lambda param
09:32
you'd want an IList<Action<MyEvent>>
class Button
{
  private Action<string> onClick;
  public void SetOnClickListener(Action<string> onClickListener) => onClick = onClickListener;
  public void Do(string str) => onClick(str);
}
public void SetOnClickListener(Func<string> onClick) ...
where MyEvent is a class with properties to represent your event data
@ntohl I'd not use Func there
main
{
  [...]
  myButton.SetOnClickListener(str => Console.WriteLine(str));
}
And done, just throw that lambda in there, don't even need to explicitely build a new object for that
I want to mimic java. :-)
09:34
dont try
ButWhy.gif
C# is weak and puny, it can't fulfill Java's superiority
/bunker
Only for learning purposes.
[Captain Obvious] Just you need to go in there tho
09:35
In Vladimir Putin We Trust
I will use this one instead then
bunker has been added
|| bunker
[Captain Obvious] much better
09:37
@JoWmbejnjsQvujoXfUsvtu for learning purposes, try to mimic needs
anonymous object cannot have a delegate in c#?
you might actually learn something useful
anonymous objects in C# are not the same kind of anonymous objects in Java
error CS0828: Cannot assign 'lambda expression' to anonymous type property
var subscription = ClickObservable.Subscribe(x => OnNext(x); ex => OnError(ex); () => OnCompleted()); // where subscription is Disposable, and should be handled whenever the listening is done
in Java, they are just unnamed classes
in C#, they are just a fancy version of a dictionary<string, object>
09:39
[Captain Obvious] As a general if you're that set on giving it a method it probably shouldn't be anonymous
I know the popular joke goes that C# is like Java but...it's not. Not sure for how long that hasn't held true but nowadays trying to get into C# and treating it like Java is probably going to end up with not what you really wanted.
[Captain Obvious] In C# they are literally unnamed classes t
[Captain Obvious] The compiler gives them a really unhelpful name
@CaptainObvious except that they dont give you the flexibility of a class
their implementation might be a class, but that's it
[Captain Obvious] That's because if you want the flexibility of a proper class, use a proper class
Yeah, not really a full class. They are more or less a slim dynamic DTO but can't have methods, for example.
09:40
in Java, you can make that anonymous class implement/extend interfaces/classes, you can override methods, give it new methods, etc
[Captain Obvious] Why the hell would you want that anonymous tho
In fairness, that's probably better done as an actual class. But you can do it in Java without one.
[Captain Obvious] Unless you're just being lazy
[Captain Obvious] In which case, stop being so damn lazy
because sometimes you just want an implementation without being fancy
lol wiet
again?
09:42
for example, listeners in Java's ui frameworks are often implemented as these anonymous classes
That anonymous class usage got more meaning later on with functional interfaces.
[Captain Obvious] That's probably the weakest argument for somethign you've ever given
[Captain Obvious] Is a listener like an event handler?
listeners are often a set of event handlers
for example, a key listener has 3 methods: keyUp, keyDown and keyPressed
09:43
Java's listener callback interface pattern is just a workaround to what should be like C# events.
a mouse listener has even more
[Captain Obvious] Why would you want them smashing into one method though
you dont
that is why you have separate methods
[Captain Obvious] Then why are they in one listener
because they work the same way, they just get invoked at a different time
09:44
[Captain Obvious] Or is a listener just arbitrary event grouping
static void Main()
{
    var foo = new
    {
        Do = new Action<string>(str => Console.WriteLine(str))
    };
    foo.Do();
}
Does not compile too. :-)
Not quite arbitrary. Key stuff, mouse stuff are well defined groups.
[Captain Obvious] Button.MouseUp += MouseUpMethod;
@CaptainObvious in newer ui libraries, you often see that the methods are separated more because it supports SAM interfaces and therefor lambda expressions
but this is from before things like Func or Action existed
[Captain Obvious] Button.MouseDown += () => Console.WriteLine("Look ma, I pressed the mouse down");
09:46
Why isn't that a proper class?
That's the same argument that was levelled at anonymous classes in Java. They existed well before lambdas were introduced. And I think before lambdas were in C#, either. So, they solve the same kind of problem just...in a more primitive OO manner.
@JoWmbejnjsQvujoXfUsvtu because you need an argument
[Captain Obvious] I mean actions have been around almost since C# was born
@Wietlol Trying....
I mean, not compiling is a good thing because the compiler will tell you exactly what you... oh wait, this is C# room
||bunker
09:49
The following does not compile:
    abstract class IFoo
    {
        public Action<string> Do;
    }


    class Program
    {
        static void Main()
        {
            IFoo foo = new
            {
                Do = new Action<string>(str => Console.WriteLine(str))
            };
            foo.Do("Hello world");
        }
    }
[Captain Obvious] Because that's garbage
error CS0029: Cannot implicitly convert type '<anonymous type: System.Action<string> Do>' to 'IFoo'
Did someone do flagging?
@JoWmbejnjsQvujoXfUsvtu Make it not abstract
@Squirrelkiller Trying...
Does not compile tooo.
Interface, abstract class, normal class, all do not work.
Rob
Rob
Well yes, because an anonymous object has its own type
var foo = new ... will work, you can remove the IFoo class entirely
09:55
@JoWmbejnjsQvujoXfUsvtu because Do isnt a property
once again, stop using fields
[Captain Obvious] Wait Java only got support for lambdas in 2014 🤣
yes, before that, there was no need for it
[Captain Obvious] I mean sure if you used those anon types
09:56
lambdas were introduced because Stream<E> and Optional<T> were introduced
because at that point, a single-abstract-method interface would be used quite often
so, they needed a way to declare them more easily, which is the lambda expression
I am still wondering why lambda cannot be assigned to anonymous type properties as follows.


    static void Main()
    {
        var foo = new
        {
            // Do = new Action<string>(str => Console.WriteLine(str))
            Do = str => Console.WriteLine(str)
        };
        foo.Do("Hello world");
    }
because C# compiler has a lot of trouble identifying the type of the lambda
that is why you need the new Action
or a cast to a delegate type
Not sure where the problem is?
Rob
Rob
10:01
@JoWmbejnjsQvujoXfUsvtu How would it know what type str is?
@Squirrelkiller But it is not anonymous type.
Correct, an anonymous type cannot implement an interface
You have to let go of the java-style callback interface
It is a crutch because java doesn't have events
@Rob OK. But the following does not compile too. :-)
static void Main()
{
    var foo = new
    {
        // Do = new Action<string>(str => Console.WriteLine(str))
        Do = (string str) => Console.WriteLine(str)
    };
    foo.Do("Hello world");
}
[Captain Obvious] C# is not java
[Captain Obvious] Should be the channel topic
C# is designed with java drawback in mind.
10:05
C# is designed with improving on java
[Captain Obvious] It's designed with the same basic idea as Java, but to be Betterâ„¢
Rob
Rob
@JoWmbejnjsQvujoXfUsvtu Do could still be Action<string> or Expression<Action<string>>
[Captain Obvious] And then over the years the two have influenced eachother
@Rob OK. Thank you. I have to learn Expression first. :-)
By the way. I have to quit. See you next time. Good bye. Thank you all!!!!!
hmmm... how to pronounce Wmbejnjs ?
I even tried upside down, backward
10:24
[Captain Obvious] Jesus christ I fucking hate Xamarin property binding so much
@nyconing "James" obviously
[Captain Obvious] No property, BindableProperty, or event found for "IsChecked", or mismatching type between value and property.
@nyconing decipher with Caesar of one shift.
Use nameof(IsChecked) instead
No difference
I had that first
10:27
Of course not, nameof is just to make it nicer
Binding in Xamarin such a pain in the dick
Even if it's implemented as a OnPorpertyChanged one it's still fucked
mr5
mr5
Iirc, declaring a binding property requires this pattern:
- static property of type BindableProperty
- the actual property
so it looks like you're just missing the static keyword
Why in the fuck does masking the bindableproperty static fix it
mr5
mr5
iforgot
you might find this helpful
use it as:
public static bool IsCheckedProperty = BindableHelper.CreateProperty<bool>();
public bool IsChecked { get; set; }
[Captain Obvious] The really annoying thiing though
[Captain Obvious] BindableProeprty dpoes not need to be static
[Captain Obvious] Though allegedly according to the docs it does need to be static. WHY DOES THAT ONE WORK THEN
Rob
Rob
10:43
Is FormGroup static?
Rob
Rob
Wait, of course it wouldn't be if the properly wasn't
Ignore me
[Captain Obvious] haha np
[Captain Obvious] Okay so it builds now, but the binding isn't actually being used
[Captain Obvious] wait that might be my fauilt
me donot support mr.p
@nyconing mrs. v?
Whether or not it is a miracle.

Mr. P (mister Putin)

Mrs. V (miss Vladimir)

But you know that the terms Mr. P and Mrs. V have already been known which are related to Pen** and Vag***. :-)
10:53
no, me do not support both side, but more on p
@nyconing: Kamu sudah makan nasi lemak?
11:50
[Captain Obvious] So I tried making the FormGroup.FormItems BindableProeprty static to match the docs and it royally fucks up
[Captain Obvious] So I think that there's something wrong going on
[Captain Obvious] Because I've nver had to make them static before, and making them static now makes them go nuts
[Captain Obvious] But I think that the BP being static is why the binding isn't actually binding. It builds but it doesn't work, which imo is no better than it not building
mr5
mr5
12:49
Err
It should actually be static
How is it not working?
[Captain Obvious] Basically
[Captain Obvious] It becomes static
[Captain Obvious] so all of the instances of FormGroup have the same items in
[Captain Obvious] Which is not ideal when they're meant to be different groups
[Captain Obvious] Liek I understand the bindable magic property thing being static, but the underlying data should not be static
[Captain Obvious] Basically, this is it not static
Seems like the BindableProperty basically tells the view what non-static property to bind to?
[Captain Obvious] And this is the same with no changes except for making FormItemsProperty static
Looks like a thin wrapper over reflection lol
13:22
[Captain Obvious] OH SHIT
[Captain Obvious] I worked out why it's not working properly
[Captain Obvious] Well, kinda
[Captain Obvious] The child items are not having the binding context passed down to them
13:44
@nyconing Awak bisa cakap Malay?
14:00
[Captain Obvious] I think it's somethign to do with how the FormGroup is outputting the controls (via a templated StackLayout) which I think is interfering with the binding
Guest Post on March 28, 2022
You may not think about images as part of your web dev work, but they can affect your web app’s performance more than any other part of your code.
14:59
I prefer lambda to anonymous inner class because the outer this can be accessed without ambiguity as follows.
mTrueButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        Toast.makeText(MainActivity.this, "Hello World", Toast.LENGTH_LONG).show();
    }
});
mFalseButton.setOnClickListener(v -> {
    Toast.makeText(this, "Hello World", Toast.LENGTH_LONG).show();
});
15:13
[Captain Obvious] Oh god are you doing Xmaarin.Android stuff
[Captain Obvious] If so then ayyylmao welcome to the club, the knives are in the kitchen and there's a cliff to jump off around the back
 
1 hour later…
16:42
Yo I'm getting tired, where do I cut this so I don't duplicate all the things?
And yes I realise that bracket is wrong there
 
4 hours later…
21:06
@Squirrelkiller generally speaking, you cant
welcome to out parameters
if those functions were nullable returns (without out parameters then) it would be easy
my own utility lib covers most of the TryParse functions (and even with sane default values for the optional parameters)
so, there it would be much easier
var valueText = Data!.GetValue<String>()
... => ParseJson(ParseDouble, valueText, 0D),
... => ParseJson(ParseDateTime, valueText, DateTime.UtcNow),
... => ParseJson(ParseBoolean, valueText, false),

private static JsonValue ParseJson<T>(Func<String, T?> parser, String text, T defaultValue) =>
	parser(text) ?? defaultValue;
(depending on how JsonValue.Create behaves, you might have to pass the correct overload of that function as well to the ParseJson function)
 
1 hour later…
22:23

« first day (4181 days earlier)      last day (997 days later) »