« first day (4042 days earlier)      last day (900 days later) » 

1:54 AM
@Squirrelkiller https://www.youtube.com/watch?v=bBoYHl3pLEo
Good WPF Navigation starter
I'd just DL the code, but if you want some context
 
 
 
2 hours later…
4:05 AM
can someone give my project a shot to fix it up
 
 
2 hours later…
 
2 hours later…
mr5
7:23 AM
@SSpoke are you available after 4 hours from now? I think I have some suggestions.
 
7:58 AM
posted on November 02, 2021 by Scott Hanselman

If you're on a version of Windows 11 that is build 22000 or greater, you can now use WSL to mount Linux disks directly. Run winver to see your Windows version. I'm on 22000.282 as of the time of this writing. I can also run wsl --help and see the --mount instructions. If you don't have them, you're not on the latest, or you can try installing/update WSL from the Windows Store. Installing WSL f

posted on November 04, 2021 by Scott Hanselman

My PowerShell upgraded to the new PowerShell 7.2.0 and it happened automatically since I get PowerShell from the Windows Store. However, my fancy prompt use PSReadLine with Predictive Autocomplete stopped working suddenly. However, suddenly I started getting this error on every prompt. Could not load type 'System.Management.Automation.Subsystem.PredictionResult' from assembly 'Microsoft.Powe

 
8:37 AM
"As programmer I dont dare to download and run something from stranger"
 
mr5
9:16 AM
WTF/minute = 61
 
[Squirrel in Training] GoOoOoOoOoOoOoOoOoOoOoOd Mornin' neglecterinos!
 
9:36 AM
@mr5 just the casual "idgaf any more" code
 
\[**[flixius](https://discord.gg/PNMq3pBSUe)**] Quote: When using Visual Studio 2022 and starting your app with the debugger the basic Hot Reload experience *works with most types of .NET apps and framework versions*, this includes .NET Framework, *.NET Core* and .NET 5+ (for both C# and VB.NET as applicable).
^ i just downloaded vs 2022 commuinity, created a new project Web project on .net core 3.1 and this hot reload thing doesn't work...?! when i change the target framework to .NET 6.0 it works. on .NET 5.0 it also didn't. am i doing something wrong or did i missed something about hot re
 
I don't know if it is right post this here, but if anyone needs a junior/Mid level fullstack .NET developer FULL REMOTE, I'm game.
 
mr5
but is it for free though?
@Wietlol indeed. the author is old and now resigned.
 
9:55 AM
rip
 
mr5
10:35 AM
did you design that UI?
 
10:48 AM
!~shiba
 
11:22 AM
@mr5 that is just windows
iirc, cmd command: powercfg /batteryreport
 
mr5
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
didn't know that
 
[Captain Obvious] In fairness it was new in Windows 8 I think
 
 
2 hours later…
1:11 PM
quick question again, if I have a collection of numbers, is there a concise LINQ way to select the sum of numbers up to some index in that collection?
e.g.: var nums = new int[] { 2, 5, 3, 10, 4, -3, 8 }; var cumNums = /* mystery LINQ query here */.ToArray(); where cumNums evaluates to { 2, 7, 10, 20, 24, 21, 29 }
this works:

Enumerable.Range(1, nums.Length).Select(i => nums.Take(i).Sum()).ToArray();

but feels clunky
 
also repetitive
you basically want an aggregating collector
 
you're going for the approach that just takes the current element and adds it to the previous entry of cumNums then I'm assuming?
as you would with an ordinary for loop
 
probably
this is very specific behavior
you would find C# really doesnt like specific behavior
in Java, you could just implement the Collector interface
in C#, you could just write an extension method
 
[milleniumbug] this is known as "partial sum"
[milleniumbug] <https://stackoverflow.com/a/4831908>
 
thanks, I'll check it out
 
1:24 PM
53
A: using LINQ to find the cumulative sum of an array of numbers in C#

Eric LippertThere's a time for generality, and there's a time for solving the problem actually posed. This is one of the latter times. If you want to make a method that turns a sequence of doubles into a sequence of partial sums, then just do that: public static IEnumerable<double> CumulativeSum(this IEnume...

quite a nice solution, except for the dreaded: "Now, I note that if that is user input then double.Parse can throw an exception; it might be a better idea to do something like:"
 
and he also just uses a for loop disguised
as an extension method
I guess it's better practise to make it a method
 
> I guess it's better practise to make it a method
this is almost always true
Single Level of Abstraction principle always applies
 
[milleniumbug] all of LINQ is a for loop distinguished as an extension methods
[milleniumbug] like, have you seen an implementation of any LINQ to Object methods? it's delegates + extension methods + yield return
 
iirc, it is surprisingly few yield returns
 
[milleniumbug] the implementation presented as the extension method is pretty much what it would be if it was in .NET. The only thing that could be improved, would be to add parameter validation, and separate the iterator block to another method and call it after validation is done
 
1:40 PM
I suppose my conclusion is a bit biased though
considering yield is a compiler feature and yields no actual runtime concepts, the decompiler that I use to look at the implementations of functions like Select or Where would probably not pick up an actual yield statement
so it might be a lot more yields than I think
 
[milleniumbug] I personally look at referencesource
 
I am a Java familiar, I just go to source in IDE and the IDE will download the sources for the specific version of the library I use XD
I suppose habits don't easily die
 
Millennium means this website: source.dot.net
it shows the (public) source code for .NET Core 3 onwards
 
also, maybe because it is a much better system and I also use it for half of my programming time
 
and yes, I'm aware they use loops and stuff, but I just don't wanna write my own extension methods if the functionalities could potentially exist in the LINQ library
just cause it's easier if it already exists
 
1:44 PM
@JansthcirlU but still, I can't be bothered to look for which website actually hosts the source code, figure out which version I am running, figure out how to find the source for that version, then read from an online document how the function should behave rather than actually seeing it in my IDE
 
[milleniumbug] yeah, there isn't
 
maybe MoreLinq has PartialSum
 
it's ok
I've accepted the for loop implementation
but I'm gonna take a long shower after work today
 
1:55 PM
shouldnt be necessary
 
mr5
yeah
taking shower is optional
 
yeah you guys are right, it's only been two months or so
 
2:15 PM
taking a shower is necessary when you write dirty code, not clean code
writing a separate function to abstract out the logic of a specific operation is not dirty
having it not separated out to a different function is dirty
 
 
2 hours later…
3:56 PM
.NET Conf riddle
you can win a drone if you're lucky
 
no I don't think I will
 
when a challenge has to be baited by a price, there is something wrong with the challenge
the primary joy of a challenge should be the challenge
that is why it is a challenge and not a problem
 
challenge is just the HR term for problem to hype people up
 
then HR terms suck
:)
 
HR also sucks in general
 
4:03 PM
depends
but the general assumption is that they do
are you participating in the challenges?
 
I remember when raffles were illegal in student groups, so the group I was in had a "test of skill" to a random winner where they had to throw a crumpled ball of paper into a trashcan right next to them
 
4:29 PM
Hi all... I'm a bit new to C# (I'm in Unity FTR) and am trying to understand how to do the following. I know I can do string[][] to create an X,Y grid (100x100) where each 'cell' is a string value, but I can't figure out the syntax to create the same kind of grid, where each 'cell' value is an int array (4 integers, flags for Top, Right, Bottom, Left styling)
 
just make it an int instead of a string and add another dimension
however, considering you have a fixed set of named properties, perhaps a struct or class makes more sense
 
what would that syntax look like? I get compilation errors for every syntax I've tried
 
what have you tried?
 
int[][][] int[,,] int[][,]
 
all of them should work
 
4:31 PM
I thought the 3rd one was what i needed, but didn't
 
except if you use all of them
any of them work
 
ok, maybe i'm populating them wrong then... I'll try hacking some more
 
although the ordering in the third one is weird
hint: dont have the int array
use a struct
 
my guess was that the format was DataTypeOfThingInArray[x][y]
 
it isnt... iirc
the syntax is Type[size]
for a matrix, you might use Type[width, height] using a multidimensional array
or by using nested arrays as Type[][height]
where each entry is of size width
 
4:38 PM
hoping this gives more clarity... it doesn't work, but represents what I'm trying to do
 
"any of them work"
but not a combination of them
for example
string[][] arr = new string[100, 100];
this is invalid
either use string[,] arr = new string[100, 100];
or string[][] arr = new string[][100];
for the int array, the multidimensional array becomes worse
 
so, if I do CustomElem[,] where my CustomElem is a class to contain my 4 item array... will that work?
 
because of how C# defines consistency: "do the most random thing that users would never expect, as long as we always do it randomly, we are consistent"
this will work fine: var arr = new int[][100, 100];
but if we look at the actual type, it is int[,][]
which is the other way around
so int[,][] arr = new int[][100, 100];
 
I'm fine with anything that works ;-)
 
but yes, try to use a struct
structs define your models, arrays are for repetition
in your 4 element array, your items represent something unique
 
4:44 PM
ok, will look that up... I haven't used structs since C++ (and that was a loooong time ago) ;-)
 
one is the top, another the right, another the bottom and the final one is the left
according to the pattern and formatting I use, the struct will look like this:
public struct Cell
{
    public Int32 Top { get; }
    public Int32 Right { get; }
    public Int32 Bottom { get; }
    public Int32 Left { get; }

    public Cell(
        Int32 top,
        Int32 right,
        Int32 bottom,
        Int32 left)
    {
        Top = top;
        Right = right;
        Bottom = bottom;
        Left = left;
    }
}
generally speaking, I would use a class, but considering you do this for gaming purposes, and the object is defined by its value, a struct should be more appropriate
also, perhaps you should use an actual IDE
not sure what tool you use to write the code, but your experience can be much improved if you use a tool that is meant to do that job
also... turns out C# just doesnt seem to support arrays that well
int[][,] is a valid type, but there is no normal constructor syntax for it
 
Thanks for all your help. Yeah within Unity it branches out to a given editor you specify to edit the code. 99% of the time I'm fine with VS code... not sure what the price is these days for Visual Studio... but likely a bit out of my budget for tinkering with game building.
 
there should be a free tier for Visual Studio
iirc community edition
still doesnt match what I use, but the tool I use does not have a free version
int[][,] test1 = new int[4][,];
int[,][] test2 = new int[][100,100];
int[,][] test3 = new int[100,100][];
... "consistency"
is C# the new Javascript?
are we the baddies?
@scunliffe you might want to avoid using multidimensional arrays though
just use a flat array
maybe even encapsulate your logic into a Matrix struct
public struct Matrix<T>
{
    public Int32 Width { get; }
    public Int32 Height { get; }
    private T[] Data { get; }

    public Matrix(Int32 width, Int32 height)
    {
        Width = width;
        Height = height;
        Data = new T[width * height];
    }

    // functions to operate on the data
}
the multidimensional array will use poor approaches on the default behavior
and might affect your performance if you do a few operations on it with larger arrays (keeping in mind 100x100 is an array of 10.000 objects)
 
5:01 PM
@mr5 yah im here now
 
thanks, will give that a try too. I should note I used 100x100 for the example, but I expect the size to be well below 50... more like 15x15
 
5:56 PM
[Squirrel.98] morning
 

« first day (4042 days earlier)      last day (900 days later) »