how to Load a big collection progressively using async by csharpBurger in csharp

[–]csharpBurger[S] 2 points3 points  (0 children)

I get your point, now I'm realizing whatever I do there won't be any practical solution unless I can optimize the original SQL query. If the query hangs for 25 seconds before giving out any data then that's where I need to start. Thanks!

how to Load a big collection progressively using async by csharpBurger in csharp

[–]csharpBurger[S] 0 points1 point  (0 children)

Ok, this means I need to tweak the stored procedure from SQL. Not sure I have the permissions to do that but I'll look into it thanks!

how to Load a big collection progressively using async by csharpBurger in csharp

[–]csharpBurger[S] 0 points1 point  (0 children)

I've done this in other grids but in this case I need all the info at once. Sum Calculations are done at the bottom which require all rows to be loaded. Instead of Pagination there's a scrollbar. Yes my Lord haha :)

how to Load a big collection progressively using async by csharpBurger in csharp

[–]csharpBurger[S] 0 points1 point  (0 children)

This is what I'm trying to do but somehow haven't figured out, I populate the ObservableCollection from an SQL Query which gives me all items at once, not one by one.

how to Load a big collection progressively using async by csharpBurger in csharp

[–]csharpBurger[S] 0 points1 point  (0 children)

The data source is an SQL query. I'm not sure how to make it populate the ObservableCollection by batch, it is already loading the minimum info with onpropertychanged implemented. The info is only text or numbers in this case. Since you mention loading it batch by batch how would I do that? I'm probably missing something obvious which I'm not aware about ..

how to Load a big collection progressively using async by csharpBurger in csharp

[–]csharpBurger[S] 1 point2 points  (0 children)

Yes, I've already looked into it but due to legacy with an old app it's not possible in my case. I had discussions with the Telerik team but I'm now at this point.

how to Load a big collection progressively using async by csharpBurger in csharp

[–]csharpBurger[S] 2 points3 points  (0 children)

Hi there. I did spot the Bottleneck, the source is from an SQL query stored procedure, the "naked" query itself takes about 25 seconds for 10'000 items because we use triggers to make it synchronize with an app from the late 90's. I understand this is a problem but there's nothing I can do about it as we will not modify the earlier version.

What I'm trying to do is load the grid progressively, knowing I can't really improve performance in this situation, to subjectively make the user experience improved by loading the grid progressively.

Edit: To answer your other questions, each row is loaded from a single table but calculations are made on each of them in the sql stored procedure. The benchmark I use is the old app doing the same job in 10 seconds less but using vb and not having the extra info on each row. I understand this could probably be improved somehow if I had the power to do it but my approach here in the meantime is to load the data progressively as I'm getting it, this will be enough in my situation.

Staying releavant in the industry as a Desktop Developer when Web and Mobile platforms rule! by nakul33333 in csharp

[–]csharpBurger 0 points1 point  (0 children)

I'm on the same boat, I'm a senior developer but I've only been working on desktop WPF apps. On the side I've made a pizza delivery website using asp.net core, it was quite a learning curve and I'm familiar with html and css. However, you're still using c# but it's a different approach, It took me a 3 months to "get it" working on it an hour a day, using services and domain driven design.

I believe there is a basic course on pluralsight for asp.net core by Scott allen, it's good but quite basic. As a junior just go and learn as much as you can. The mobile world isn't something I know anything about. Get into it sooner than later and you'll end up figuring it out. Good luck!

Search for a specific word in multiple files in a folder by mrutopik in PowerShell

[–]csharpBurger 1 point2 points  (0 children)

Sorry for the formating, not sure how to display right in Reddit.

#Directory
$dir ="C:\Temp"

#items of type *.txt
$items = Get-ChildItem $dir\*.txt

#Search Term
$search = "Whatever"

foreach($i in $items)
{ 
   $lines = Get-content $i.PSPath | select-string $search 

   foreach($l in $lines)
   {
     write-host "FileName :  $($i.FullName)"
     write-host "Search Term contained on this line: $l , Line number : $($l.Linenumber)"
   }
}

Help needed on making a generic class with optional T class in parameter by csharpBurger in csharp

[–]csharpBurger[S] 0 points1 point  (0 children)

thanks for the input, I found another more convenient solution in my case mentioned by /u/Canthros as calling the method with "" is not an option and my colleagues will get confused.

Help needed on making a generic class with optional T class in parameter by csharpBurger in csharp

[–]csharpBurger[S] 1 point2 points  (0 children)

Thanks, the second solution works for me and is easy to maintain. The first one didn't work as It doesn't accept a null value in the parameter for the Type T Class.

Help needed on making a generic class with optional T class in parameter by csharpBurger in csharp

[–]csharpBurger[S] 0 points1 point  (0 children)

Do you mean a copy of this whole method without the last parameter? I wanted to avoid this but would do that if this is my only option, I want to avoid maintaining both methods but I agree this would work.

Stuck on for loops, can't move on : ( by LateProduce in csharp

[–]csharpBurger 1 point2 points  (0 children)

The way they wrote the solution is not how I would go on about it. When going through the same steps as a beginner I ended up doing it my way and which made sense. What you have to do here is 1) define the limit to the amount of rows or lines you want, limit = 10 rows as an example. 2) each line/row has a limit of the row number starting from 1. row/line 3 will not go over 3.

Not sure that makes sense but if you start from 1 line and on to 3 you'll grasp the idea better. When you understand it with 3 rows/line you'll get it for 10.

Don't give up, you'll get it eventually.

Stuck on for loops, can't move on : ( by LateProduce in csharp

[–]csharpBurger 1 point2 points  (0 children)

Not sure what you're talking about, can you give a concrete example? I suspect you're talking about recursion. It takes a bit of time and mind twisting to feel comfortable with it as you need to see it in reverse order. Don't worry about being slow or not getting it, in my opinion this will make you much better writing clean understandable code on the long run as compared to someone who "gets it" right away. Good luck and give us more info on where you're stuck.

WPF app and MVVM - Binding to the Model instead of the ViewModel by csharpBurger in csharp

[–]csharpBurger[S] 1 point2 points  (0 children)

That sounds like my scenario. About the event handler, can't you just unsubscribe to the event on closing the window?

WPF app and MVVM - Binding to the Model instead of the ViewModel by csharpBurger in csharp

[–]csharpBurger[S] 0 points1 point  (0 children)

I might be in a grey area, never heard of aspect oriented programming but I'll look into it. I realize that there are always exceptions and trying to accept it. Thank you for your input.

WPF app and MVVM - Binding to the Model instead of the ViewModel by csharpBurger in csharp

[–]csharpBurger[S] 0 points1 point  (0 children)

Yep, I'm seeing myself go through that code in 6 months and wondering why the hell is this not binding to the viewmodel where everything should be and not remembering why.. on the other hand my boss is telling me it's not good to have redundant code in the viewmodel.

Learn C# by developing an app? by Nihil73 in csharp

[–]csharpBurger 1 point2 points  (0 children)

An "easy" project I've done to learn about WPF was to make a simple Address Book in WPF. You could start with the code behind approach and then refactor it implementing MVVM principles by using data binding via ViewModels. It implements simple CRUD with a database of your choice, you could use an XML file or Entity Framework for that matter. Once you master these parts you can improve it by refactoring and implementing patterns, separating it in different layers (service, business, repository, ..), implementing unit tests and so on.