« first day (5052 days earlier)      last day (37 days later) » 

12:00 AM
Remember Darwin; building a better mousetrap merely results in smarter mice. (source)
 
4 hours later…
3:46 AM
Anyone used entity framework recursive ?
4:34 AM
i did recommend loop, dont recursive
where would I do the loop?
private bool RecursiveGetContinuedMeetingIds(int MeetingId, ref List<int> ContinuedMeetingIds)
{
    var ReturnMeetingId = GetContinuedMeetingIds(MeetingId);
    if (ReturnMeetingId.HasValue)
    {
        ContinuedMeetingIds.Add(ReturnMeetingId.Value);
        RecursiveGetContinuedMeetingIds(ReturnMeetingId.Value, ref ContinuedMeetingIds);
        return true;
    }
    else
    {
        return true;
    }
}
 
1 hour later…
5:46 AM
@Feeds XKCD #2972 Explained: This comic explores the challenges of obtaining helium by taking an extremely long-term perspective. Hairy is leading a meeting with Megan, Cueball, and ...
 
2 hours later…
7:31 AM
botler, Value = x.DesignDataItem.IsText ?
x.ComponentHistoryValues.FirstOrDefault(y => y.ComponentHistoryValueGroupID == x.ID).ValueString
: x.ComponentHistoryValues.FirstOrDefault(y => y.ComponentHistoryValueGroupID == x.ID).Value.ToString()
Botler ded
does this look good or can be better ?
@VLAZ rest in memory, botler :(
These AI PR tools are annoying af, asked to refactor this lmao
@Sakthivel Extract x.ComponentHistoryValues.FirstOrDefault(y => y.ComponentHistoryValueGroupID == x.ID) as a variable. It makes this way easier to read.
Also, don't know that API, but it's possible that .Value.ToString() just calls .ValueString when it is a string. Or otherwise the two aren't different.
Oh, BTW, you haven't handled the case where it returns default. If there is nothing found, you'd get null
Yes, maybe right now the condition always matches. But maybe somebody does a refactor in the future and leaves a chance that the predicate fails.
Also, if you have many such lookups, consider building a dictionary.
@VLAZ they are two different database columns and value being a double and value string being a varchar
 .Select(x => new DesignDataItemDto
     {
         ID = x.DesignDataItem.ID,
         Name = x.DesignDataItem.Name,
         Units = x.DesignDataItem.Units,
         Value = x.DesignDataItem.IsText ?
                x.ComponentHistoryValues.FirstOrDefault(y => y.ComponentHistoryValueGroupID == x.ID).ValueString
                : x.ComponentHistoryValues.FirstOrDefault(y => y.ComponentHistoryValueGroupID == x.ID).Value.ToString(),
         CheckedStatus = x.CheckedStatus,
         CheckedBy = x.CheckedBy.Name,
This is the linq select after a query, not sure how adding a variable would work inside this
7:50 AM
.Select(x =>
  {
     var thing = x.ComponentHistoryValues.FirstOrDefault(y => y.ComponentHistoryValueGroupID == x.ID);
     return new DesignDataItemDto { Value = x.DesignDataItem.IsText ? thing.ValueString : thing.Value.ToString }
  })
Well, that's at least the syntax. Extract this into a separate method would be the best way to do it. .Select(x => MapToDesignDataItemDto(x)) is much cleaner.
This is exactly what i tried, and compiler slaps me with "A Lambda expression with a statement body cannot be converted to expression tree"
  .Select(x =>
   {
       var ddValue = x.ComponentHistoryValues.FirstOrDefault(y => y.ComponentHistoryValueGroupID == x.ID);

       return new DesignDataItemDto
       {
           ID = x.DesignDataItem.ID,
           Name = x.DesignDataItem.Name,
           Units = x.DesignDataItem.Units,
           Value = x.DesignDataItem.IsText ? ddValue.ValueString : ddValue.Value.ToString(),
           CheckedStatus = x.CheckedStatus,
           CheckedBy = x.CheckedBy.Name,
           CheckedOnUtc = x.CheckedOnUtc,
Extracting to separate method was a neat idea. works now
8:26 AM
oh right yeah I did stuff on the weekend which will have knocked botler out
private List<int> GetContinuedMeetingIds(int MeetingId)
{
var continuedMeetingIds = new List<int>();
int? currentMeetingId = MeetingId;

while (currentMeetingId.HasValue)
{
int? returnMeetingId = GetContinuedMeetingIds(currentMeetingId.Value);

if (returnMeetingId.HasValue)
{
continuedMeetingIds.Add(returnMeetingId.Value);
currentMeetingId = returnMeetingId;
}
else
{
break;
}
}

return continuedMeetingIds;
}
le me see if I can fix him remotely
Hello friends!
Hi, Botler.
8:50 AM
@Sakthivel Ah, that means that you don't actually have a lambda. It's something that will be sent to a database or whatever. It sort of looks like a lambda but has limitations - it can only be an expression (no statements). Also, IIRC, there is some limitation on what outside variables it can capture.
Overall, it's a PIA because it forces you to write code that's not actually that readable.
@VLAZ yes, i probably gotta do select stuff into random dto and then do another select :\
Morning.
Morning.
Hello friends!
9:29 AM
there's a bit of recursion confusion in your method. It looks like you are using `GetContinuedMeetingIds` inside `GetContinuedMeetingIds`, which will cause a stack overflow. You might want to refactor this to retrieve continued meeting IDs using a different approach or ensure you are calling the right method inside your while loop.

Also, it seems like you're missing the method signature of `GetContinuedMeetingIds` in the while loop. For example:

private int? GetContinuedMeetingId(int meetingId)
9:43 AM
EF can run select projections in the DB as long as you aren't doing something weird or something that will force it to run in the CLR, so although it's less readable, keeping it as an expression will technically make it more performant
9:53 AM
or use LoadAsync() wherever necessary ?
Depends on use case
Though it's probably better than lazily enumerating one at a time
 
3 hours later…
1:03 PM
/coffee
fancy dancy
1:23 PM
that's some posho "i can wait for my coffee" coffee
1:52 PM
I like my coffee made the right way: A store-brand blend on an Amazon Basics coffee maker.
Nah mine si made the right way: Bin the coffee, get some nice Yorkshite Tea instead
That's an unfortunate typo I make almost every time, because it's the exact opposite, it's quite good in fact.
 
2 hours later…
4:15 PM
at least its coffee
not this cream stuff again
!~shiba
4:53 PM
Hello friends!
5:16 PM
posted on August 15, 2024 by Rhea Patel

We are excited to announce that Copilot Content Exclusion is now available in Visual Studio 2022 17.11. This feature allows your admins to configure Copilot to ignore certain files in a repository or organization, giving you enterprise control that ensures sensitive information is protected while seamlessly integrating trusted AI for efficient coding. The post  Copilot Content Exclusion Now Av

5:58 PM
!~cat
The dog and cat are both cute
 
1 hour later…
6:59 PM
Hello friends!
 
1 hour later…
8:28 PM
posted on August 15, 2024 by .NET Team

Try out the latest features in .NET 9 Preview 7 across the .NET runtime, SDK, libraries, ASP.NET Core, Blazor, C#, .NET MAUI, and more! The post .NET 9 Preview 7 is now available! appeared first on .NET Blog.


« first day (5052 days earlier)      last day (37 days later) »