|
So, I am web-retarded, but trying to get Blazor running. Since this is a proof-of-concept, I can use any version I want. What I'm running into is all the documentation is ... inconsistent at best. It seems like a lot changed between 3.0 and 3.1. Does anyone have a good, known-to-work-with-3.1 guide for Blazor? I'm even having trouble with things like component tags (like <MyComponent> render in the browser DOM instead of running on the server), which seems like Blazor 101.
|
# ¿ Dec 27, 2019 00:58 |
|
|
# ¿ May 21, 2024 09:36 |
|
mystes posted:Perhaps I'm misunderstanding something since I've only messed around with Blazor a little bit and only Blazor Server, but if you're using it with webassembly isn't the whole point that it renders in the browser? It literally puts <MyComponent> in the final markup instead of running the component
|
# ¿ Dec 27, 2019 02:25 |
|
Whenever I get bound-up on that kind of problem I will leverage my hosts file. Yeah, you have to add the port, but you can still get hosts in.
|
# ¿ Jan 8, 2020 15:47 |
|
Dictionaries are really, really fast. Millions of lookups per second on an average desktop.
|
# ¿ Feb 2, 2020 21:09 |
|
adaz posted:this assumes the dictionary isnt huge but yeah in general I wouldn't worry about the 2 lookups. Chances are relatively high if the size of the dictionary is reasonable its a low value. The thing to worry about though is if you overriding gethashcode() and have a complex op in there. That _will_ destroy dictionary lookups. I haven't really noticed slowdowns, unless I'm swapping. I use dictionaries for their insane lookup performance when running 5-8 million entries. Definitely agreed on the GetHashcode performance though (and Equals).
|
# ¿ Feb 3, 2020 00:01 |
|
Boz0r posted:I have a constructor that should only be called from a factory. How do I give the other devs a warning and refer them to the factory(also suppress the warning in the factory) if they try to use it? I was thinking of using Obsolete, but the constructor isn't obsolete. Can you #pragma ignore the warning in the factory?
|
# ¿ Feb 11, 2020 14:49 |
|
Hughmoris posted:If I don't have admin rights for a Windows 10 machine, what are my options for learning C#? A second machine :/
|
# ¿ Apr 7, 2020 17:38 |
|
I still use l4n, but behind my own ILogger interface. It's worked well enough so far for me.
|
# ¿ Apr 11, 2020 22:53 |
|
NihilCredo posted:If it's like most projects, 6-7 of those classes are basic stuff that virtually everything depends on, like loggers and databases. Wrap those in a "commons" POCO and inject that. wtf no
|
# ¿ May 23, 2020 17:36 |
|
Boz0r posted:I've been messing around with AutoFixture and AutoMoq and it's really cool, but I've hit a snag that I don't know how to solve. My code gets a bunch of proxies from a static factory class that I switch out with a mock factory in my test base class, and I use AutoDataAttribute to inject fixtures into my tests. Make the factory class injectable instead of static and swap factory implementations?
|
# ¿ Jul 7, 2020 18:02 |
|
Sounds like a use-case for T4
|
# ¿ Jul 13, 2020 00:22 |
|
Embrace CQRS. It flattens everything.
|
# ¿ Aug 14, 2020 05:27 |
|
MisterZimbu posted:DI best practices question. Say I have a project already up and running that digests data in a database: Don't inject IAppSettings, but instead inject your own IConnectionStringProvider. Then, use the "for X class dependency Y, use implementation Z". The code for Lamar is approximately: code:
|
# ¿ Aug 18, 2020 03:37 |
|
Calidus posted:Anyone have positive or negative experiences with Math.NET? I need to rewrite someone else’s Matlab code. I have much more experience with .NET than python. I wasn't a fan the 19 minutes I played with it. It is probably a very authentic port, but it's not very .NET friendly. A lot of the method calls are static calls, and they update the parameters passed in, and that's gross to me.
|
# ¿ Aug 25, 2020 04:24 |
|
Withnail posted:lol I need to refactor hundreds of legacy classes. That would not be time efficient. Sounds like you need Roslyn!
|
# ¿ Sep 5, 2020 03:04 |
|
raminasi posted:Then I'm not explaining it right. It was basically this: Is it ok to do this? C# code:
|
# ¿ Sep 16, 2020 02:46 |
|
How do I safely "get into" an async/await stack if I'm not in one to begin with?
|
# ¿ Sep 16, 2020 02:55 |
|
Just checking, the API isn't WCF, is it? If so, you can generate client-side code with a single command that does *alllll* that crap for you.
|
# ¿ Oct 2, 2020 04:52 |
|
Seconding learn how LINQ works (specifically LINQ-to-objects). It is NOT just a database provider. Be very comfortable with generics, async/await, and rudementary data structures (HashSet is usually what you want when using List, for instance). With that much background in PHP you'll probably be going full-stack/frontend, so brush up on Razor Pages and how they're different than MVC. Depending on how you wrote your PHP, Razor Pages may feel completely at home.
|
# ¿ Nov 8, 2020 22:36 |
|
Dolemite you're going to do fine in .NET. You clearly show enough aptitude that any decently competent interviewer will let you reason yourself into the answer they want to hear (your thinking along Func/Action sold me). Now go learn that var is good and is not dynamic and you're golden.
|
# ¿ Nov 9, 2020 22:23 |
|
I'm an always-var after being stymied at big refactors because of things like this:code:
code:
|
# ¿ Nov 10, 2020 03:03 |
|
sorry your variable names and ide suck
|
# ¿ Nov 10, 2020 06:52 |
|
The difference is that dynamic actually sucks though
|
# ¿ Nov 10, 2020 16:47 |
|
Can't you use the Func itself as a key? I know you can with a Dictionary.
|
# ¿ Dec 7, 2020 15:12 |
|
Thirding "don't worry about it". Your constructors aren't doing anything except storing a reference to other items anyway, no actual work happens in them (riiiiiiight? ), and references are cheap.
|
# ¿ Dec 7, 2020 23:12 |
|
HAP exposes the DOM via IEnumerable<HtmlElement>, so you can write LINQ against that. It will be regular LINQ-to-Objects, but I don't know if that's missing anything that System.Xml.Linq has.
|
# ¿ Dec 25, 2020 23:10 |
|
that's a 404
|
# ¿ Jan 6, 2021 19:23 |
|
gently caress i am stealing all that. I literally just wrote an article on our corporate wiki about why we implement the IConverter<TIn, TOut> interface manually instead of AutoMapper. Also gently caress any team that buries AutoMapper directly in code instead of behind an interface.
|
# ¿ Feb 2, 2021 06:13 |
|
That is exactly what a service bus is for. Like, all of it.
|
# ¿ Feb 12, 2021 17:54 |
|
Funking Giblet posted:Improved pattern matching makes generic exceptions easier to work with. The language designers had to add this because everybody involved is garbage at exceptions and exception hierarchies. It's literally 90 seconds to add a new exception type yet somehow that's too much work. Throwing 'new Exception ($"Unable to load {id} from database")' is apparently way better than "new MissingDataException(id)" for reasons I'll never understand. Bonus if you catch the actual exception and throw your own Exception (not even any subtype!) without including any of the original context. Or double bonus if you catch(Exception e) { throw e; } and blow away my stack trace when I'm trying to debug logs from prod. Or super gently caress you if you catch(Exception up) { throw up; /* he he he */ } like the actual code I found, complete with "he he he" in a comment.
|
# ¿ Mar 9, 2021 17:02 |
|
salisbury shake posted:If I'm a Linux user who will never use the .NET platform on Windows, how painful is it to use F# for application, system or web development? F# is as platform-agnostic as C# is. The underlying library also got very cross-platform in Core, and continues to do so. You as the developer will be the weak link, doing things like concatenating paths together instead of using Path.Combine. VSCode and 'dotnet' will do a lot more than you'd think they will!
|
# ¿ Mar 11, 2021 06:17 |
|
Just an FYI if you're not aware, RavenDB is actually really cool, and not like any database you're used to using.
|
# ¿ Mar 19, 2021 05:08 |
|
Mata posted:I've been finding myself reinventing List<T>, because I need to store my data as an array for non-managed reasons, but generally want all the list-like behavior when it comes to adding and removing items. This has left me wondering though, since lists are built on top of arrays, is there any reason why I couldn't just yoink the internal array, like so: Please don't write murderous-rage-inducing "clever code" on the assumption it's faster without actually profiling it. There are a lot of things the JITer can do if you give it code it's familiar with.
|
# ¿ Apr 6, 2021 15:25 |
|
New Yorp New Yorp posted:Why trigger on a timer? It seems like you'd want to use a queue and skip the blob storage bit entirely. NO QUEUE. ONLY FIRST-IN FIRST-OUT MECHANISM WITH PERSISTENCE. I have no idea why so many teams gently caress up queues *so badly*
|
# ¿ Jun 12, 2021 18:05 |
|
thats the joke. So many teams will reinvent queuing mechanisms with databases and polling instead of just using a queue.
|
# ¿ Jun 12, 2021 19:48 |
|
I just went through this! The Configuration system in Core (and above) is a hierarchical, multi-layered providers-based approach. All configuration key/values are ultimately turned into a colon-separated key, with a value. So, the following JSON becomes: code:
So, if you have multiple sources, what gets updated on Save?
|
# ¿ Sep 6, 2021 00:09 |
|
Glad they didn't waste too much time making the esoteric thing of "web requests" too easy.
|
# ¿ Sep 16, 2021 14:27 |
|
There's also the option of closing the tickets after a period of inactivity, and blaming the ineffective user on it. Public shaming is a powerful tool.quote:Ticket #555123 has been closed by some.butthole after 6 days of inactivity. The ticket was assigned to some.butthole on 2021-10-19 and has not been updated in 7 days.
|
# ¿ Oct 26, 2021 17:49 |
|
Yeah, BackgroundWorker is exactly what you're looking for. They run when your app pool starts, stop when you app pool stops, and are in the same process space for easy communication between web and service. If you have a Singleton instance between the web and service, you can have the web project directly talk to data populated by the service (like an in-memory ConcurrentDictionary).
|
# ¿ Nov 17, 2021 18:34 |
|
|
# ¿ May 21, 2024 09:36 |
|
Quick and dirty solution: chuck a .ToList() on the Messages inside the loop.
|
# ¿ Nov 25, 2021 21:37 |