Mr. Roach
Mr. Roach
CC#
Created by Mr. Roach on 7/24/2024 in #help
How do I change style of nested items?
No description
1 replies
CC#
Created by Mr. Roach on 7/16/2024 in #help
The "ResolvePackageAssets" task failed unexpectedly.
Hello there, i am getting the error in the title and don't know how to resolve it, below the title it says "System.NullReferenceException: Object reference not set to an instance of an object". Alternatively I get: projects that use central package version management should not define the version All my nuget dependencies have a yellow triangle on them suddenly. It started after I tried to install templates of WPF libaries, I dont know if it was an error by me to have executed some dotnet commands within my opened solution/project. Maybe someone here can help? I also noticed that in bin/debug the next folder is now named "net8.0-windows7.0" instead of only "net8.0-windows" I executed the following commands within my project, maybe i shouldn't have done this there:
dotnet new install Keboo.Dotnet.Templates
dotnet pack --configuration Release -o .
dotnet new install . --force
dotnet new keboo.wpf
dotnet build
dotent test --no-build
dotnet publish --no-build
dotnet new install Keboo.Dotnet.Templates
dotnet pack --configuration Release -o .
dotnet new install . --force
dotnet new keboo.wpf
dotnet build
dotent test --no-build
dotnet publish --no-build
followed this here: https://github.com/Keboo/DotnetTemplates I already googled a bit, deleted my bin and obj folder, tried to switch my local branch but nothing seems to fix it til yet. I tried looking for backuped files in roaming/local folder but sadly vs didn't backuped the whole project/solution, only few files I deleted on purpose. Can I somehow setup vs to do several complete backups of my stuff?
17 replies
CC#
Created by Mr. Roach on 7/7/2024 in #help
How do I reduce class coupling? Is class decoupling always necessary?
Hello, yesterday I discovered the code metrics feature in vs. The Microsoft doc says "9" would be the "magic number" regarding class coupling. When I looked at my metrics results, I discovered I got a class with 43 class coupling score, where a single method holds 27 of the score and some more classes with 20+ class coupling score. I mean everything works fine at the moment, so theres no issue needed to be fixed that stops my code from working but since ms docs seem to say good metric scores indicate better manageable and less subsceptible code, I thought it couldn't harm to ask. When I googled I got results mentioning implementing interfaces but dont even know if I got pointed to the right direction by that. As far as I understood, one could make an Interface ICar whichs content would be like a template classes that use ICar would have to implement as well which means one could make different types of car-classes with i.E different behaving Drive methods if I understood correctly. So if I understood those google/ms doc examples correctly til here, I still don't know how I would apply Interfaces onto my classes that I'm don't really even able to compare to that examples I read. The class with a 43 score is a class that handles an import process for csv files into a sqlite database. The method with 27 score is ProcessCsvFileAsync. https://github.com/MisterRoach/WoW_AH_Data_Project/blob/master/WoW_AH_Data_Project/Database/DatabaseImportCsvs.cs
20 replies
CC#
Created by Mr. Roach on 7/3/2024 in #help
Questions regarding a linq query
Hello there, I'm playing a little bit with linq queries but don't know if i truly understand this. Why do I need to orderby twice here(and group again) in order to get the full result and the parts its made of ordered how I want? I read something about primary and secondary sort and wondered if thats whats happening here. I'm also wondering if this query could be written better/smaller?


from sales in File.ReadAllLines(file).Skip(1)
select sales.Split(",") into sales
select (itemName: sales[1], stackSize: sales[2], quantity: decimal.Parse(sales[3]), price: decimal.Parse(sales[4]), otherPlayer: sales[5]) into grouped
// grouping the selection by otherPlayer and itemNames
group grouped by new { grouped.otherPlayer, grouped.itemName } into grouped
// therefore selecting for each player a grouped view where the values
// for quantity and price of each item that appears gets summed
select new
{
grouped.Key.otherPlayer,
item = grouped.Key.itemName,
quant = grouped.Sum(x => x.quantity),
price = grouped.Sum(x => x.price) / 10000
}
into grouped
// here the results for each otherPlayer but not the whole query are getting ordered(secondary sort?)
orderby grouped.price descending
// if i dont group here again, I cant order by the summed values that each player has, why?
group grouped by new { grouped.otherPlayer } into grouped
// this order makes the whole query ordered(primary sort?)
orderby grouped.Sum(x => x.price) descending
select grouped
;


from sales in File.ReadAllLines(file).Skip(1)
select sales.Split(",") into sales
select (itemName: sales[1], stackSize: sales[2], quantity: decimal.Parse(sales[3]), price: decimal.Parse(sales[4]), otherPlayer: sales[5]) into grouped
// grouping the selection by otherPlayer and itemNames
group grouped by new { grouped.otherPlayer, grouped.itemName } into grouped
// therefore selecting for each player a grouped view where the values
// for quantity and price of each item that appears gets summed
select new
{
grouped.Key.otherPlayer,
item = grouped.Key.itemName,
quant = grouped.Sum(x => x.quantity),
price = grouped.Sum(x => x.price) / 10000
}
into grouped
// here the results for each otherPlayer but not the whole query are getting ordered(secondary sort?)
orderby grouped.price descending
// if i dont group here again, I cant order by the summed values that each player has, why?
group grouped by new { grouped.otherPlayer } into grouped
// this order makes the whole query ordered(primary sort?)
orderby grouped.Sum(x => x.price) descending
select grouped
;
12 replies
CC#
Created by Mr. Roach on 6/28/2024 in #help
Microsoft DataFrame example not working
Hello there, I'm trying to understand Microsoft DataFrames for a c# project where I need to sum data of prices of items that have the same names inside a csv(sum costs for each entry of "apple", "banana" etc). In my python version I used pandas for that and pivoted after dropping not needed columns to achieve what I wanted with few lines of code. But now I'm stuck already trying to follow the examples provided by Microsoft for DataFrames. I tried to copy the code mentioned in the "Combine Data Sources" but I'm getting error that column "id" wouldn't exist. Does someone know how good the Microsoft Website is for getting into DataFrames or is there a better place or solution to achive what I want?
var ids = new List<Single>() { 1, 2, 3, 4, 5, 6 };
var bedrooms = new List<Single>() { 1, 2, 3, 2, 3, 1 };

var idColumn = new SingleDataFrameColumn("Id", ids);
var bedroomColumn = new SingleDataFrameColumn("BedroomNumber", bedrooms);
var dataFrame2 = new DataFrame(idColumn, bedroomColumn);

dataFrame = dataFrame.Merge(dataFrame2, new string[] { "Id" }, new string[] { "Id" });

DataFrame.SaveCsv(dataFrame, "path\\result.csv", ',');
var ids = new List<Single>() { 1, 2, 3, 4, 5, 6 };
var bedrooms = new List<Single>() { 1, 2, 3, 2, 3, 1 };

var idColumn = new SingleDataFrameColumn("Id", ids);
var bedroomColumn = new SingleDataFrameColumn("BedroomNumber", bedrooms);
var dataFrame2 = new DataFrame(idColumn, bedroomColumn);

dataFrame = dataFrame.Merge(dataFrame2, new string[] { "Id" }, new string[] { "Id" });

DataFrame.SaveCsv(dataFrame, "path\\result.csv", ',');
https://learn.microsoft.com/en-us/dotnet/machine-learning/how-to-guides/getting-started-dataframe
24 replies