« first day (4000 days earlier)      last day (931 days later) » 

3:30 AM
 
 
2 hours later…
5:11 AM
Hi folks, do you have any ideas to mitigate human errors in which we forget to put attribute Authorize in action methods of webapi?
 
5:21 AM
Good morning
 
Good morning folks!
 
@StupidIsAsStupidDoes Activate authorization by default, then they have to actively add [AllowAnonymous] to deactivate it for an action method.
 
@Squirrelkiller: Very nice idea. Thank you!
 
 
1 hour later…
6:38 AM
[Squirrel in Training] GoOoOoOoOoOoOoOoOoOoOoOd Mornin' pleberinos!
 
7:14 AM
Morning
 
8:05 AM
Xamarin is quite cool - enjoying my new project :)
 
a lot of things are "quite cool" such as shotguns
 
 
1 hour later…
9:12 AM
Own one?
Any way this can be simplified?
                Rooms.Clear();

                List<TemperatureHumidityRecordModel> records = await ChecksService.GetAllRecordsAsync();
                List<TemperatureHumidityRecordModel> todaysRecords = records.Where(x => x.DateRecorded.Date == DateTime.Today).ToList();

                List<RoomsModel> rooms = await ChecksService.GetAllRoomsAsync();
                List<RoomsModel> checkedRooms = rooms.Where(x => todaysRecords.Any(y => y.RoomId.Id == x.Id && y.IsAM == IsAM)).ToList();

                foreach (var room in rooms)
 
[Squirrel in Training] yes use var instead of List<X>
 
How come?
 
im guessing var would know its a type of list implicitly? im not 100% so would also like to know lol
 
Yeah, I thought the way I currently have it now is a lot more readable & understandable
 
\[**[Squirrel in Training](https://discord.gg/PNMq3pBSUe)**] Takes up less space

`rooms ` already makes u know that it's a list of rooms
[Squirrel in Training] and checked rooms is clear also
[Squirrel in Training] records is not percicse IMHO
 
9:31 AM
pls dont use var
 
@Wietlol Why?
 
because it is unclear from the right hand expression what type it is
only use var when the type remains obvious with it
 
Got it
 
such as var amount = 5;
or var list = new List<Room>();
 
Thanks
By the way .. at what point I need to consider to use async void rather than async Task?
I had this convo with @Squirrelkiller - but can't remember what has been said.
 
9:34 AM
you use async void when some silly framework decides that Task is invalid as return type
other than that, you use async Task
 
Task is best practise then?
I also noticed this..
public SomeViewModel()
{
    LoadData(); // async void
}
This does not display any warnings.
Whereas as this way.. it does.
public SomeViewModel()
{
    LoadData(); // async Task
}
It'll say something like.. Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call
 
async void is only ever for event handlers, like on click events
 
and to avoid this warning - I'd call it like _ = LoadData()
 
Well, is it ok that the ctor finishes and execution continues before the LoadData-Call finishes?
Because that is gonna happen
 
@Squirrelkiller Should it really be used in ViewModel?
 
9:40 AM
async void? Sure.
For your relay commands
 
I see..
Something like async void SaveData() would be used in a relay command?
as the SaveData is only to be executed via click.
 
it should still be async Task
if Task is an option, then use it
LoadData() as async void wont give you a warning because there is nothing you can do against it
it is like "Warning: Users might be idiots." ... it is true and a big problem, but you cant solve it
for async Task, maybe you forgot to add an await
 
Project SiT and me did for our apprenticeship.
 
[Squirrel in Training] Dont listen to vieatlol
[Squirrel in Training] Varialbe names are enuff
[Squirrel in Training] DOn't listen to him, it waSNT ME THE BAD CODE IT AWUOB DPIUG WE
 
10:05 AM
always listen to Wietlol... just dont take it for granted
 
lol
 
Can confirm, 50% of the bad code is mine :D
Can also confirm: Don't listen to Wietlol
If your variable names are indeed fitting
 
variable names describe what the values represent
variable types describe how the values are represented
you shouldnt mix them
 
11:07 AM
Except when your variable name is a plural, it implies a list or array of something. And because we're in C#, between those two it will always be a list.
Or IEnumerable I guess
 
why 33333333 wont fit into decimal(24,18)?
I found it, 24-18 = 6, int cant exceed 6
 
11:29 AM
[DAustin] lol just looking at the discord room, just seen all your calls for this decimal xD
 
 
2 hours later…
1:13 PM
            // Option 1
            try
            {
                await SomeTask1();
                await SomeTask2();
            }
            catch (Exception)
            {

                throw;
            }
            // Option 2
            try
            {
                await SomeTask1();
            }
            catch (Exception)
            {

                throw;
            }

            try
            {
                await SomeTask2();
            }
            catch (Exception)
            {

                throw;
            }
Which one is the better practice ?
 
[DAustin] I think they do the same thing, so opt 1 is cleaner and would be my choice
 
DRY
option 1
 
Cheers lads
 
// Option 3
await SomeTask1();
await SomeTask2();
:)
 
no try catch?
 
1:24 PM
if you are just going to rethrow, why even catch?
this is not baseball dang it
 
1:58 PM
That was just a sample :)
 
It applies to any case though: If you just rethrow, don't even bother catching it.
If you do handle the exception, it depends. If Task1 fails, do you want Task2 to still be executed?
 
@Squirrelkiller How would you go about that? :/
 
Well option 1 stops completely when Task1 fails. Option 2 could handle an exception Task1 throws and then continue to execute Task2 afterwards.
Could log the first exception and set some default values so that Task2 still works.
 
I see... really depends on the scenario I suppose, to determine which option to use.
 
Exactly
 
2:12 PM
How good are you with xaml? :/
 
If the tasks are independent from each other, you can also just put both of them into a list and await Task.WhenAll(thatList)
@CaptainObvious where u at XAML bro
 
I currently have this xaml:
<StackLayout>
    <CollectionView ItemsSource="{Binding NavigationItems}">
        <CollectionView.ItemTemplate>
            <DataTemplate>
                <StackLayout Padding="10">
                    <Button Text="{Binding Title}"
                            Command="{Binding NavigateTo}"
                            ImageSource="{Binding Image}"/>
                </StackLayout>
            </DataTemplate>
        </CollectionView.ItemTemplate>
    </CollectionView>
</StackLayout>
I need to make this from this:
To this:
And the NavigationItems are set up like so:

            NavigationItems = new List<PageViewModel>
            {
                new PageViewModel
                {
                    Title = "Button 1",
                    NavigateTo = new Command(NavigateToSomePage)
                }
                new PageViewModel
                {
                    Title = "Button 2",
                    NavigateTo = new Command(NavigateToSomePage)
                }
                new PageViewModel
                {
 
WPF or Xamarin?
 
Xamarin.. but WPF is similarish - so I don't mind seeing some xaml using WPF :)
 
I think Xamarin has <FlexBoxLayout> or something, with like, the same stuff as CSS: flexDirection, flexWrap, and whatever you need to make it two columns wide.
Does this help maybe?
 
2:27 PM
Noiceee
 
Could put that template just before the ItemTemplate
 
Didn't know such thing existed
I'll try it out - see what I can do.
3
A: Displaying repeating items in multiple columns

Almir VukSince Xamarin.Forms introduced the CollectionView, this kind of layout is pretty simple to implement. Last year I wrote a blog post and made simple demo examples with CollectionView so in this answer I will show you a code and gif how the code will look in the final form. Using CollectionView you...

This worked for me
 
Ah nice, good to know
 
How's work?
 
Way too much administrative work
I signed up to develop software damnit
I've been spending the last hour to predict my working hours for october (cuz 3rd semester starts on 11th) and put all my work hours for that month into my calendar.
 
2:37 PM
 
predict working hours lol
 
 
1 hour later…
3:44 PM
I'm very disappointed java's wrapper types don't override equality.
((Boolean)null) == true should obviously be false. Instead it throws.
 
 
1 hour later…
4:52 PM
[DAustin] You'll make wiet cry
 
5:05 PM
Ben Popper on September 28, 2021
This is no joke. The copy and paste keyboard from our April Fool’s joke is real and available for purchase.
 
6:17 PM
posted on September 21, 2021 by Scott Hanselman

I love a good bug, especially ones that are initially hard to explain but then turn into forehead slapping moments - of course! There's a bug over on Github called Hysteresis effect on threadpool hill-climbing that is a super interesting read. Hill climbing is an algorithmic technique when you have a problem (a hill) and then you improve and improve (climb) until you have reached some maxi

 

« first day (4000 days earlier)      last day (931 days later) »