|
redleader posted:oh yeah, we do a similar thing - hence the class with 26+ parameters in its constructor Okay but how do you name the parameters after 26? FooService a, BarFactory b, BazManager c... Do you go excel style with ..., ButtsRepository aa? E: What a terrible joke for a snipe. I had a girlfriend who took a programming class back in the day, and she would write her assignment and then go through and rename all of the variables to a, b, c,... in order of use. Because that's more "computery". Nth Doctor fucked around with this message at 14:55 on May 31, 2020 |
# ? May 31, 2020 14:51 |
|
|
# ? Apr 24, 2024 20:59 |
|
Boz0r posted:Someone has started making nuget packages of the shared projects to avoid shared dependencies in projects, and I don't really see the point The most successful philosophy I have applied here is to tie everything versioning/deployment related to "pressing the deploy button". Is your thing A and thing B part of a same thing, always deployed together, never making sense to have running part A of a different version than part B? Then make it part of the same solution, share your code, do whatever you need and keep it together and don't even try to separate anything or use nuget. Or do your thing A and thing B have separate lifetimes, with one person pressing button "deploy thing A version 123" on Monday and another person pressing button "deploy thing B version qqq.beef999" on Thursday? Then separate them into different projects and only let them communicate via public APIs and (optionally) nuget packages that distribute parts of the API contracts (and/or API clients). In the end, the ways you release and tie together different pieces of software must map to the human processes. If you try to make a technical workflow that differs from the human decision workflow then you're in for pain and suffering.
|
# ? May 31, 2020 20:55 |
|
How do I include source in my Nuget packages, so I can at least debug through them?
|
# ? Jun 3, 2020 18:57 |
|
Boz0r posted:How do I include source in my Nuget packages, so I can at least debug through them? There’s a thing called Source Link but I’ve never managed to get it working when publishing. (I’ve gotten it to work when consuming packages, so someone’s gotten it to work.)
|
# ? Jun 3, 2020 19:21 |
|
Nth Doctor posted:Okay but how do you name the parameters after 26? "If you keep the variable names as short as possible, the computer can read them faster."
|
# ? Jun 3, 2020 19:30 |
|
Boz0r posted:How do I include source in my Nuget packages, so I can at least debug through them? Include pdb file and don't optimize in the caller.
|
# ? Jun 3, 2020 23:32 |
|
GoodCleanFun posted:[How to include source files in nuget?] Several years ago I wrote something you add in your .csproj file which tweaks your PDB so its source-link points directly to github. That way, anyone who uses your nuget package will be able to debug-step INTO it! I'm sure everything has changed completely since I wrote it. But there might still be some useful pointers. https://github.com/ljw1004/pdb2github
|
# ? Jun 4, 2020 03:55 |
|
I've got an interface with a default implementation on a couple of methods. Is there some way I can call those default implementations from a class that implements that interface (like how with an abstract class you'd call base.DoSomething())?
|
# ? Jun 4, 2020 13:01 |
|
Karia posted:I've got an interface with a default implementation on a couple of methods. Is there some way I can call those default implementations from a class that implements that interface (like how with an abstract class you'd call base.DoSomething())? Cast it to the interface?
|
# ? Jun 4, 2020 14:35 |
|
If nothing else, you can just make it a regular-rear end static method, have the default implementation call the static method, and then your specific implementation can call the static method too.
|
# ? Jun 4, 2020 14:56 |
|
Mr Shiny Pants posted:Cast it to the interface? Sorry, I should have specified: I want to implement the interface so that Foo.DoSomething() calls base.DoSomething() and adds additional functionality. As soon as I override the functionality, casting to the interface doesn't call the default implementation anymore. NiceAaron posted:If nothing else, you can just make it a regular-rear end static method, have the default implementation call the static method, and then your specific implementation can call the static method too. This was my workaround, yeah. Somehow doesn't feel very elegant. Which is stupid, it's fairly clean and works just fine, but it could be a couple characters shorter!
|
# ? Jun 4, 2020 15:08 |
|
Karia posted:Sorry, I should have specified: I want to implement the interface so that Foo.DoSomething() calls base.DoSomething() and adds additional functionality. As soon as I override the functionality, casting to the interface doesn't call the default implementation anymore. I'd say it's time to use an abstract class instead. You're looking for abstract class behavior, not interface-with-default-implementation behavior.
|
# ? Jun 4, 2020 15:32 |
|
ljw1004 posted:Several years ago I wrote something you add in your .csproj file which tweaks your PDB so its source-link points directly to github. That way, anyone who uses your nuget package will be able to debug-step INTO it! Whoa
|
# ? Jun 7, 2020 08:59 |
|
Do any of you have recommendations for an ad hoc report building library for an asp / mvc web application? My team looked at a few different ones, decided to try https://dotnetreport.com/ but after some initial evaluation it hasn't impressed us. Namely that it doesn't seem to be smart enough to restrict you from putting fields from completely unrelated tables onto a report, causing it to crash at run time. The two biggest things we're looking for: * Does not require an outside service to run. * Should be smart enough to prevent the behavior I described above^ It's my coworker doing the dicking around with these tools, so perhaps she didn't configure it correctly but during her demo it looked pretty mediocre. It lets us specify relationships between tables which is good, but yea when you select a field from a table it doesn't then filter out unrelated tables.
|
# ? Jun 10, 2020 13:28 |
|
Can anybody think of some generic/abstraction wizardry that can reduce some boilerplate I'm dealing with? I have to do some junk like this with the meta going on with my interpreter project with declaring class types for it in C# and making them visible to the interpreter correctly. Here's a draft of the boilerplate with an idea of what I'd like to do, but with the problems with it shown. I understand the nature of those errors but I wonder if I can dodge them through some alternative means:code:
|
# ? Jun 12, 2020 06:08 |
|
The two things you're trying to do have different causes and different ways of resolving them (which may not go together): 1. Instance static member: it's effectively telling you that this class itself can't be the one creating the instance, unless it does it via some sort of factory/factory method. It makes sense if you just look at this abstract, because the question is "how does this abstract know which of its non-abstract subclasses to create?". Generally the answer is going to be "it doesn't, your singleton pattern doesn't belong in this class but in one/all of the subclasses". That depends on what you want to happen though, how do you expect to be calling this? If you want to do BullshitClass<Whatever>.Instance.DoThing(), then what subclass of BullshitClass<Whatever> do you expect to get used? If you want to do MySubclass<Whatever>.Instance.DoThing() where MySubclass inherits BullshitClass, then the same pattern you have with .Instance should be in MySubclass. There's no way to reduce the boilerplate there since Instance is a static field (so no inheriting). Generally, I think this kind of thing is a signal that you don't really want a singleton, so maybe see if you actually want one (and consider that static fields and generics don't work the way you expect; you will have one __instance value for every value of <TInst> that gets used. So not a singleton, but a "singleton" per TInst type.) 2. Using a non-static method in a static context (base constructor): there's no general solution, but this specific situation is very common. You're trying to make it so the subclasses define their own "name", or "description", or "whatever piece of data", even though you know that bit of data should be static and stateless, but there's no way to inherit statics. Your best bet is to pass the data directly at compile time. Because the base constructor is there, a subclass is forced to implement it anyway (as you were just forced to implement it) so there's no chance of the developer forgetting. code:
I can't be sure because I don't know what the rest of your code is like, but it sounds like what you're looking for is something like a container/wrapper for Python objects that just handles the boilerplate of creation/init? If so: 1. Don't inherit from PyClass, instead store a private field of type PyClass and make the class non-generic (just use PyObject). That inheritance is what's enforcing your constructor passing a static type name in. 2. Don't use weird singletons because it doesn't sound like you want a singleton, you just want to not have duplicates. If that's the case then you want whatever's creating this object to be a factory that stores and reuses existing instances, mixing static and generics to try to do a factory like this won't work the way you're hoping. Not having a singleton means the class boils down to a wrapper for PyClass that handles the creation of __new__/__init__ and type name, which is the 'boilerplate' you want to reduce duplication of. Having a factory ahead of it that handles the creation of this wrapper means you're no longer handling anything static, so no more issues with static fields or abstracts.
|
# ? Jun 12, 2020 06:40 |
|
Red Mike posted:
Yes I generally just want to make sure I don't have duplicates. Some of that is to properly support the shenanigans people might do to redefine what some of the class methods are in the interpreter, and that has to trace back to a single class. This is about the time that I should apologize for how confusing the scenario is. I'm show a C# class for how a Python class should behave and the combination is a real brain bender. Regarding #2 and what's going in the class: I do have some other code I have to implement in every class; __new__ and __init__ are just the particular boilerplate code for those class types. All of the extra code are for the methods that go in the object. Why are they in the class then? Every object instance gets assigned the static class methods by default but they can be overridden thanks to Python's dynamic nature. So instance.foo_method can be reassigned, and even classinstance.foo_method can be reassigned. This is what I came up with to support that bullshit. Edit: I'll be playing around in the IDE later tonight and this weekend so I can experiment then so that's what I can actually try something.
|
# ? Jun 12, 2020 17:50 |
|
You're using 'static' as an analogue for 'single instance' which is incorrect. You're also using inheritance to reduce the duplication of that code when the correct tool is composition. If I'm following correctly, what you're looking for is something like this: code:
1. Mapping/parsing/whatever shared logic needs to exist statically (or effectively statically) 2. A class concerned with keeping one instance of a thing per type (or per whatever conditions you set) 3. A class concerned with either subclassing or wrapping a type. #2 and 3 can be merged together somewhat cleanly, it just depends on access modifiers and what the goal is (do you actually need a subclass/wrapper?). Basically, I really recommend taking a step back and starting over from what you're really trying to achieve because you're already down the rabbithole of fixing something that's only really needed because of a wrong choice back up the line.
|
# ? Jun 12, 2020 18:27 |
|
I currently work as a C# developer, but I don't do any coding in my spare time. I hope to change that, but I don't really want to add Visual Studio and poo poo to my gaming/media PC in case I somehow gently caress it up or bloat the system with other garbo. I am not sure I'll stick with it so I don't want to buy a different machine or pay for a subscription if I can avoid it. During a work meeting introducing me to Docker, it got me thinking about how one of my classes offered us a Linux VM that we installed in Virtual Box so we didn't have to try and get Antlr and poo poo running on every machine on earth. At the same point, it's currently the future, and I know Azure can spin up VMs as needed. Does anyone have any thoughts on or experience with Visual Studio in virtual environments? The tips I'm finding are from 2014(?) so I feel I am missing some grammar to make Google help me.
|
# ? Jun 13, 2020 20:21 |
|
Magnetic North posted:I currently work as a C# developer, but I don't do any coding in my spare time. I hope to change that, but I don't really want to add Visual Studio and poo poo to my gaming/media PC in case I somehow gently caress it up or bloat the system with other garbo. I am not sure I'll stick with it so I don't want to buy a different machine or pay for a subscription if I can avoid it. During a work meeting introducing me to Docker, it got me thinking about how one of my classes offered us a Linux VM that we installed in Virtual Box so we didn't have to try and get Antlr and poo poo running on every machine on earth. At the same point, it's currently the future, and I know Azure can spin up VMs as needed.
|
# ? Jun 13, 2020 20:36 |
|
It’s fine to install VS on your machine but you can also hang out with the cool kids and just use VS Code + .NET Core.
|
# ? Jun 13, 2020 20:53 |
|
Magnetic North posted:I don't do any coding in my spare time. I hope to change that Without knowing your motivation in detail, please don't think that this is somehow the norm. Most coders do not code in their spare time - this is perfectly normal. Your employer should be paying you to learn everything you might need to learn to advance in your coding career. I say this because sometimes there are employers that abuse programmers by making learning be something that happens during personal time. That's rear end-backwards in every way. Of course if you just enjoy coding even after hours, have fun and enjoy And yeah, feel free to install VS and/or VS code on your home PC. It's typically fairly harmless, although do note that some technologies VS might install can require Hyper-V to operate. Enabling Hyper-V will often permanently disable other virtualization software, so if you run VMs, do some reading in advance to verify compatibility.
|
# ? Jun 13, 2020 21:01 |
|
EssOEss posted:Enabling Hyper-V will often permanently disable other virtualization software, so if you run VMs, do some reading in advance to verify compatibility. FWIW, the latest version of VMWare Workstation Pro (15.5.5) now works with Hyper-V enabled, though you need a newer build of Windows 10 (20H1 build 19041.264).
|
# ? Jun 14, 2020 00:07 |
|
EssOEss posted:Without knowing your motivation in detail, please don't think that this is somehow the norm. Most coders do not code in their spare time - this is perfectly normal. Your employer should be paying you to learn everything you might need to learn to advance in your coding career. I say this because sometimes there are employers that abuse programmers by making learning be something that happens during personal time. That's rear end-backwards in every way. I appreciate hearing this. While that is the approach I try to take (aka gently caress You Pay Me), there is that lingering puritanical doubt creeping in that makes me wonder if I should be doing more. brap posted:It’s fine to install VS on your machine but you can also hang out with the cool kids and just use VS Code + .NET Core. I do want to be one of the cool kids. In all honesty, I forgot .NET Core on Linux was an option. I'll probably try that and see if I can get on with VS Code.
|
# ? Jun 14, 2020 00:14 |
|
vs code is great if you don't want to use an actual good ide for .net
|
# ? Jun 14, 2020 02:16 |
|
rider is extremely cool, and good
|
# ? Jun 14, 2020 02:44 |
|
VS Code is certainly worse for a lot of .NET workloads, however it lacks some of the baggage and architectural flaws of VS and that makes it more pleasant to use in some scenarios. Now that VS Codespaces are a thing, hopefully Microsoft will invest more in improving the quality of the .NET tooling in VS Code.
|
# ? Jun 14, 2020 04:45 |
|
Malcolm XML posted:rider is extremely cool, and good rider's decompile-and-go-to-definition blew my fuckin mind and i am legitimately jealous
|
# ? Jun 14, 2020 05:55 |
|
Red Mike posted://copy pasted from your code, although this might be replace-able by something like Action/Func? I'm still looking over what I can do to change the entire approach in the larger post. For one, I am seeing how I am currently looking up these static instances since I've lost track of it. But about this particular mess: I'm trying to remember what made me wind up doing this. I think I was trying to make a compile-time binding to DefaultNew instead of trying to get it dynamically using GetMethod(). There's a few places where I gave up and used GetMethod() because the signatures were async and I couldn't use an expression tree for them. It ultimately hasn't turned out to be so bad; it's a simple one-liner versus this code salad. It's just I get kicked in the dick if I type the method binding wrong and I'm very good at making that particular kind of typo. Edit: I might as well append on to here about my recall on the whole static Instance thing. The main place where I'm using that Instance is every time I create an instance of the actual object type. That's the TInst generic argument in my example. Every instance of an Pythonlike object needs to have an association with its class. If you are a Python person, you can see that as the __class__ dunder in any instance of an object. That becomes useful for issubclass() and isinstance(). This is looking like premature optimization, but I'd prefer to avoid a dictionary lookup in every constructor if I can avoid it. On the flip side, the alternative is that boilerplate garbage that I'm liable to copy-paste then forget to properly alter for the new class. Rocko Bonaparte fucked around with this message at 06:22 on Jun 14, 2020 |
# ? Jun 14, 2020 06:07 |
|
redleader posted:rider's decompile-and-go-to-definition blew my fuckin mind and i am legitimately jealous VS also does this if you enable it IIRC.
|
# ? Jun 14, 2020 06:59 |
|
Rocko Bonaparte posted:I'm still looking over what I can do to change the entire approach in the larger post. For one, I am seeing how I am currently looking up these static instances since I've lost track of it. I think you'll need to find an alternative yourself, since the problem is quite specific around the Python bits. Regarding the dictionary lookup specifically: a dictionary lookup is effectively O(1) and constructors can't be async so you don't need locks or blocking, it's way premature optimisation. Worse, what you've come up with (GetMethod/reflection) is many orders of magnitude slower and way more difficult to predict the performance of (e.g. turn one class it ends up needing to look up into a generic class and suddenly your O(n) might become O(n log n), who knows).
|
# ? Jun 14, 2020 11:34 |
|
brap posted:Now that VS Codespaces are a thing, hopefully Microsoft will invest more in improving the quality of the .NET tooling in VS Code. Now that you say that, I think it was watching a Build conference video that featured VS Codespaces that germinated this idea in my head. I should look into that too.
|
# ? Jun 14, 2020 11:36 |
|
brap posted:VS also does this if you enable it IIRC. I have no idea where that option lives, but I already have https://marketplace.visualstudio.com/items?itemName=SharpDevelopTeam.ILSpy installed which is kinda nice in that I can poke around in framework code without messing with the tab order in VS.
|
# ? Jun 15, 2020 15:03 |
|
Unless VS added its own natively recently, that's a feature of ReSharper, not VS itself.
|
# ? Jun 15, 2020 15:08 |
|
power crystals posted:Unless VS added its own natively recently, that's a feature of ReSharper, not VS itself. No, it's been in there for a few years. The setting to search for in the options menu is 'Enable navigation to decompiled sources' under Text Editor-C#-Advanced. It pops up an annoying disclaimer every time, but works great (and uses ILSPY under the hood.)
|
# ? Jun 15, 2020 15:21 |
|
B-Nasty posted:No, it's been in there for a few years. The setting to search for in the options menu is 'Enable navigation to decompiled sources' under Text Editor-C#-Advanced. It pops up an annoying disclaimer every time, but works great (and uses ILSPY under the hood.) AFAIK you don't even need to enable it in VS, it should already be enabled by default. At least it is in VS2019. It's also in Omnisharp/VSCode as a setting
|
# ? Jun 15, 2020 15:32 |
|
B-Nasty posted:No, it's been in there for a few years. The setting to search for in the options menu is 'Enable navigation to decompiled sources' under Text Editor-C#-Advanced. It pops up an annoying disclaimer every time, but works great (and uses ILSPY under the hood.) Huh. The more you know. Thanks!
|
# ? Jun 15, 2020 15:33 |
|
I think it might be the same underlying library providing the feature in reshaper, VS, and ILSpy.
|
# ? Jun 15, 2020 16:28 |
|
Anyone have experience implementing OAuth 2.0 for a WPF ( not UWP ) desktop app. This states 3 options
This page from Google implies that the one to use for standard desktop apps is the loopback scheme. I'm a little concerned about this approach because I'm not sure how local firewalls/antivirus software will interact with this approach. Is there a better way to accomplish this? We do own the OAuth server so changes can theoretically done on that end as well, if it makes things easier. Before reading the IETF Draft I was thinking about a different approach using another web server. The app would have a connection to that server and the redirect would pass the token to this server, making it available to the app. Given that this approach isn't listed I'm assuming it's a bad idea but it's not clear to me why.
|
# ? Jun 18, 2020 16:45 |
|
|
# ? Apr 24, 2024 20:59 |
|
fankey posted:Anyone have experience implementing OAuth 2.0 for a WPF ( not UWP ) desktop app. This states 3 options
|
# ? Jun 18, 2020 17:17 |