|
I don’t understand. If your setup is properly signed why does AV care?
|
# ? Feb 16, 2022 19:07 |
|
|
# ? Jun 8, 2024 06:48 |
|
LongSack posted:Just starting, and haven’t gotten to that point yet. I’m very aware of Dapper (Tim Corey is a big fan), but I’m starting with the creation of the database and tables from the entity classes, which I don’t think Dapper handles. Dapper is definitely on my radar though. What is the real value of that? Often, relational data isn't stored in a really simple class=table format, and then, as time goes on, you're trying to tweak the class change->migration script logic in whatever strange tool you use. It's not like creating a table in a SQL script is difficult, and handwritten migrations will never surprise you or destroy data in a way you didn't expect. I've never used something like EF and not been sorry I did a few months later. Your database schema and the data it contains is far more valuable than your C# code.
|
# ? Feb 17, 2022 02:37 |
|
B-Nasty posted:What is the real value of that? I feel the same way. Generating classes that represent row objects (or query output rows etc.) otoh is extremely nice (and works great with stuff like Dapper!) There are a bunch that do it as a tooling step (typescript has some particularly nice ones), but f# can do it live!
|
# ? Feb 17, 2022 07:35 |
|
I use EF a lot, and I’ve never done code-first, even though I am typically also doing the db design as well as building the code. It makes more sense to me to build the db in the db, review a database diagram to make sure all the relationships and stuff are right, and then have EF scaffold the db into entity classes.
|
# ? Feb 17, 2022 10:33 |
|
Is there a way in Visual Studio (2022 if it matters) to hard limit the memory available to a process being debugged so I can try and track down what’s causing OutOfMemory exceptions?
|
# ? Feb 18, 2022 05:27 |
|
You don't need to do that
|
# ? Feb 18, 2022 11:22 |
|
I'm having another stab at implementing some logging for my practice Blazor Server app I'm looking at stuff like Serilog and it looks cool, but the thing is I want to output the log to the UI rather than a file, console, or external sink, and I can't really find anything about that. Would it be possible to setup Serilog (or some other logging package) with a Blazor component so that the component displays the log? How do I access the log from the component? Or the other way around: how do I tell the log to send its log events to the component?
|
# ? Feb 25, 2022 12:55 |
|
fuf posted:I'm having another stab at implementing some logging for my practice Blazor Server app If you're just trying to do some sort of output within a single user session then maybe serilog isn't what you want.
|
# ? Feb 25, 2022 13:14 |
|
mystes posted:If you're just trying to do some sort of output within a single user session yeah exactly this I guess I thought maaaybe it might be good to also write to a file but no it's mostly just info for the user within a single session ok so I should probably just come up with my own little logging service
|
# ? Feb 25, 2022 13:39 |
|
fuf posted:ok so I should probably just come up with my own little logging service lol no, don't try to reinvent the wheel, I guarantee what you want exists already. Here, check this out using Serilog: https://stackoverflow.com/questions/35567814/is-it-possible-to-display-serilog-log-in-the-programs-gui
|
# ? Feb 25, 2022 14:21 |
|
Just-In-Timeberlake posted:Here, check this out using Serilog: Thank you. I did actually see that but glossed over it because it looked like they were talking about desktop apps. But I added a new sink like in the suggestion and we are in business my friends
|
# ? Feb 25, 2022 16:28 |
|
Is there a way to adjust exponent formatting in a ToString() call without having to muck with a string each time? Like, let's say I have some float-point type and I'm printing it with ToString("e8"). But I may be adjusting that 8 quiet often. It feels silly to do that as a string operation. There's a NumberFormatInfo that has some stuff that should help but I don't see how I can get it to print an exponent. NumberFormatInfo carries settings for all the different types so just setting the number of decimal digits doesn't seem enough. Is it something like ToString("e", numberFormat) or something?
|
# ? Feb 27, 2022 21:46 |
|
You can use a placeholder ToString($"e{numberFormat}") I believe
|
# ? Feb 27, 2022 22:14 |
|
aperfectcirclefan posted:You can use a placeholder invoking the entirety of string interpolation to build a 2 character string? jfc
|
# ? Feb 27, 2022 22:15 |
|
insta posted:invoking the entirety of string interpolation to build a 2 character string? jfc What would you recommend then?
|
# ? Feb 27, 2022 22:20 |
|
aperfectcirclefan posted:What would you recommend then? I wanted to say something with NumberFormatInfo, but at a minimum just a string.Concat will be a lot faster than interpolation (which ultimately ends up using concat deep in the bowels after doing a bunch of character-by-character analysis and state machine tracking for finding curly braces). code:
insta fucked around with this message at 22:48 on Feb 27, 2022 |
# ? Feb 27, 2022 22:38 |
|
Like, if you really, really think the string concatenation is a performance problem in your usage scenario (it most likely isn't), you could cook up something like this:C# code:
If you write $"E{numberFormat}" (assuming numberFormat is an int) then that compiles to string.Format("{0}", numberFormat), which isn't a good idea considering all the performance overhead of that. You can trick it with $"E{numberFormat.ToString()}" that would compile to string.Concat("E", numberFormat.ToString()), but at that point just writing "E" + numberFormat is better in every way. SirViver fucked around with this message at 22:44 on Feb 27, 2022 |
# ? Feb 27, 2022 22:41 |
|
I feel like it's not going to be worth worrying about the performance of something like this in most cases...
mystes fucked around with this message at 22:48 on Feb 27, 2022 |
# ? Feb 27, 2022 22:45 |
|
I had no idea there was that big of a performance hit with interpolation.
|
# ? Feb 27, 2022 22:46 |
|
aperfectcirclefan posted:I had no idea there was that big of a performance hit with interpolation. mystes fucked around with this message at 22:51 on Feb 27, 2022 |
# ? Feb 27, 2022 22:49 |
|
aperfectcirclefan posted:I had no idea there was that big of a performance hit with interpolation. I suspect I'm equating string.Format runtime performance with interpolation, which may be broken down into string.Concat / StringBuilder.Append by the compiler to begin with.
|
# ? Feb 27, 2022 22:49 |
|
That makes sense then gotcha. Im just starting getting deeper into C# so good to know this stuff! That said, do any of you have a recommendation for a C# book that is more referential than tutorial?
|
# ? Feb 27, 2022 22:57 |
|
mystes posted:I feel like it's not going to be worth worrying about the performance of something like this in most cases... What!? Burning developer hours (at a cost of thousands of dollars) to determine the most performant way to format a string is the best use of resources. Unless this is some crazy hot-path, almost anything else you could be working on would bring more value to the business than saving 5 nanoseconds worth of processing time.
|
# ? Feb 27, 2022 23:22 |
|
B-Nasty posted:What!? Burning developer hours (at a cost of thousands of dollars) to determine the most performant way to format a string is the best use of resources. Having knowledge ahead of time that string.Concat is faster than Interpolation (and both are WAY faster than string.Format) can prevent you from writing slower code from the outset though. Hot paths should be tested for, yes, but we also start out with tested-faster code.
|
# ? Feb 27, 2022 23:39 |
|
mystes posted:I feel like it's not going to be worth worrying about the performance of something like this in most cases... You're right but it doesn't stop me from feeling stupid about concatenating a character to an integer converted into a string, only to have it parse the string under the hood and extract out the operations I really want to do. I was hoping I could skip the middle man and the resulting code could be more clear.
|
# ? Feb 27, 2022 23:57 |
|
The platform has made improvements to string interpolation which will eventually make it as good as concatenation or better in many cases. https://devblogs.microsoft.com/dotnet/string-interpolation-in-c-10-and-net-6/
|
# ? Feb 28, 2022 01:23 |
|
brap posted:The platform has made improvements to string interpolation which will eventually make it as good as concatenation or better in many cases. And even if they hadn't, worrying about the performance characteristics of one vs the other is a pointless micro-optimization that has a vanishingly small likelihood of ever being the culprit of a performance issue.
|
# ? Feb 28, 2022 04:29 |
|
New Yorp New Yorp posted:And even if they hadn't, worrying about the performance characteristics of one vs the other is a pointless micro-optimization that has a vanishingly small likelihood of ever being the culprit of a performance issue. Yes, string concatenation, never known to be the source of performance problems. Maybe it's different in your C# code, but in the code I inherit, string building is easily the #1 or #2 source of CPU-bound performance issues. The other is List<T>.Contains when HashSet<T>.Contains is equally viable.
|
# ? Feb 28, 2022 06:31 |
|
Just upgrade to .NET 6
|
# ? Feb 28, 2022 07:41 |
|
New Yorp New Yorp posted:And even if they hadn't, worrying about the performance characteristics of one vs the other is a pointless micro-optimization that has a vanishingly small likelihood of ever being the culprit of a performance issue. I guess so. I follow two maxims regarding this: 1. Make it correct, then make it fast. 2. The profiler knows, you don’t.
|
# ? Feb 28, 2022 21:37 |
|
brap posted:I guess so. I follow two maxims regarding this: Exactly. I'm not going to agonize over the performance characteristics of the 90 different ways to build and format strings unless I discover it's a performance issue. I've worked on a lot of applications over the years and I've never seen one where performance wasn't IO bound, memory bound, or CPU bound somewhere much deeper in the bowels of the app.
|
# ? Feb 28, 2022 22:01 |
|
I have worked on apps where string.Trim was the top line of the trace. Doing stuff like ‘s.Trim() == “some constant”’.
|
# ? Feb 28, 2022 23:47 |
|
New Yorp New Yorp posted:Exactly. I'm not going to agonize over the performance characteristics of the 90 different ways to build and format strings unless I discover it's a performance issue. I've worked on a lot of applications over the years and I've never seen one where performance wasn't IO bound, memory bound, or CPU bound somewhere much deeper in the bowels of the app. i've had string concatenated related performance issues cause noticeable performance impact, but it's usually something that would be in UI rather than backend - like if you have a feature that draws text in relation to something like mouse input (think like a photoshop style image editor with a text overlay), then slow string operations can make a difference in framerate of the resulting operation. just write the code the easy way and profile it after you're done.
|
# ? Mar 1, 2022 01:10 |
|
Bruegels Fuckbooks posted:just write the code the easy way and profile it after you're done.
|
# ? Mar 1, 2022 01:39 |
|
Is there a way to access the value in a SortedList and then iterate on that value? So i'd like to do (pseudo code):code:
Thanks!
|
# ? Mar 1, 2022 21:52 |
|
worms butthole guy posted:Is there a way to access the value in a SortedList and then iterate on that value? So i'd like to do (pseudo code): SortedList.Values doesn't work for you?
|
# ? Mar 1, 2022 22:05 |
|
Kyte posted:SortedList.Values doesn't work for you? Didn't know about that, thank you!
|
# ? Mar 1, 2022 22:15 |
|
I've seen bad string management take down a production web server. To be fair, the code was pathological, roughly this:C# code:
But then again, nothing is pathological until it is. I sure wish that whoever wrote that originally had cared about performance.
|
# ? Mar 1, 2022 22:48 |
|
raminasi posted:I've seen bad string management take down a production web server. To be fair, the code was pathological, roughly this: Almost every time I've run into something like that, the problem was a hat on an even stupider problem e.g. imbeciles concatenating strings to make xml/json/html.
|
# ? Mar 2, 2022 04:55 |
|
|
# ? Jun 8, 2024 06:48 |
|
I'm sorry I started the holy war on string performance. It's definitely bike-shedding. At the same time, if you never care because you've never needed to, it's easy to write concatenation code like that instead of the sightly clunkier StringBuilder version. If you know ahead of time what is and isn't fast, and they all look about the same, why wait until it's slow to write the other version?
|
# ? Mar 2, 2022 07:49 |