|
RICHUNCLEPENNYBAGS posted:I guess my problem is I don't really want to spend that much time on UI and I want, you know, the kind of "Bootstrap" of Windows UI development where there are sensible defaults and I don't usually have to mess with it. haha MS and sane defaults?
|
# ? Apr 8, 2015 05:32 |
|
|
# ? Jun 8, 2024 09:11 |
|
I might be completely insane for even thinking this is possible but here it goes. Could a template in VS take a c# class and create a matching Controller. I would like to turn this: code:
code:
|
# ? Apr 8, 2015 15:53 |
|
RICHUNCLEPENNYBAGS posted:Is there any option for C# desktop apps that isn't totally painful? I'm half-tempted to go with self-hosted WebAPI + browser for my next project To be fair, this would be a lot less painful if I were starting fresh instead of adding another UI to a Silverlight LOB monstrosity. I made a mockup of the UI that looked great and everything really quickly and could have connected it to a fairly clean view model without much trouble, but welp. GoodCleanFun posted:If you add it to App.xaml it can be used throughout that project. I think that's what you mean by you don't want to define it globally. Right - there are already global style definitions in the main project and this stuff just doesn't need to be all the way up there. I can't justify doing something that far outside the established pattern this thing follows, but I'll keep that in mind for later. Inverness posted:Having separate design and runtime constructors is also useful if you want to give your view model design data to see how it looks. I kinda like that idea. Munkeymon fucked around with this message at 16:35 on Apr 8, 2015 |
# ? Apr 8, 2015 16:28 |
|
Calidus posted:I might be completely insane for even thinking this is possible but here it goes. Could a template in VS take a c# class and create a matching Controller. I dunno about with Visual Studio but I solved a similar problem by using reflection and a StringBuilder and TagBuilder to build up Angular HTML views and JavaScript services to talk to my WebAPI controllers. So sure, it's possible to do.
|
# ? Apr 9, 2015 00:21 |
|
What does everyone suggest for good code coverage tool? Right now I'm looking at NCover, OpenCover, and dotCover It looks like NCover and OpenCover provide better code coverage reporting vs dotCover. If I could actually use Visual Studio instead of Xamarin Studio (barf) it might swing things in dotCover's favor but as it is that isn't a possibility for me currently. Any comments about NCover vs OpenCover? Or some other code coverage tool?
|
# ? Apr 9, 2015 00:23 |
|
xgalaxy posted:What does everyone suggest for good code coverage tool?
|
# ? Apr 9, 2015 04:30 |
|
Calidus posted:I might be completely insane for even thinking this is possible but here it goes. Could a template in VS take a c# class and create a matching Controller. Not statically, I don't think. You'll need runtime shenanigans (either with dynamic or reflection). F# could
|
# ? Apr 9, 2015 04:31 |
|
Destroyenator posted:What's your end goal here? Is it going to be a metric you track or do you just want some confidence? Mostly confidence but metrics would be nice to have. Using git-flow model with feature branches in git and it would be nice to 'fail' a feature branch if it doesn't pass some basic filters.
|
# ? Apr 9, 2015 04:54 |
|
xgalaxy posted:Mostly confidence but metrics would be nice to have. Using git-flow model with feature branches in git and it would be nice to 'fail' a feature branch if it doesn't pass some basic filters. Code coverage is an awful metric because it tells you practically nothing and is easy to game with worthless tests.
|
# ? Apr 9, 2015 04:59 |
|
Ithaqua posted:Code coverage is an awful metric because it tells you practically nothing and is easy to game with worthless tests. Thats great. I don't care? I wasn't asking for opinions about code coverage. I was asking for advice about good code coverage tools.
|
# ? Apr 9, 2015 05:13 |
|
JetBrains makes pretty solid tools in my experience. I've never used their dotCoverage, but I'd try it just because its them.
|
# ? Apr 9, 2015 14:31 |
|
Inverness posted:JetBrains makes pretty solid tools in my experience. I've never used their dotCoverage, but I'd try it just because its them. Unfortunately dotCoverage is a Visual Studio plugin which I can't use at the moment. I need something that works outside of Visual Studio. Preferably something that can be implemented into a build pipeline inside of Jenkins or some other CI server.
|
# ? Apr 9, 2015 15:36 |
|
GrumpyDoctor posted:Not statically, I don't think. You'll need runtime shenanigans (either with dynamic or reflection). RICHUNCLEPENNYBAGS posted:I dunno about with Visual Studio but I solved a similar problem by using reflection and a StringBuilder and TagBuilder to build up Angular HTML views and JavaScript services to talk to my WebAPI controllers. So sure, it's possible to do. Thank you both for the suggestions. I have an ugly winform app, that I have managed to strip out most of the business logic into its own project. I would like to use that business logic to create a single page web app(maybe 3 pages at most) to replace it. I figured wrapping everything in json would a good place to start.
|
# ? Apr 9, 2015 16:09 |
|
xgalaxy posted:Unfortunately dotCoverage is a Visual Studio plugin which I can't use at the moment. I need something that works outside of Visual Studio. Preferably something that can be implemented into a build pipeline inside of Jenkins or some other CI server.
|
# ? Apr 9, 2015 17:33 |
|
Yup -- TeamCity (another JetBrains product) comes with free dotCover support. The other options require getting licenses on the server but dotCover just works. Note if you've got a lot of code it can add a ton of time to the build -- Lucene.NET would take 2+ hours with coverage versus ~10 minutes without it. While I agree code coverage can be gamed, especially if you are using it as a stupid management metric, you can still get a ton of value out of knowing what you are testing and where.
|
# ? Apr 9, 2015 18:19 |
|
I'm using AutoMapper in a project and realised that it performs very slowly in debug mode. When I publish the project and run it properly, it performs fine so I'm thinking it could be related to IIS Express or perhaps something internal to AutoMapper. Does anyone have any ideas what could be causing this? Obviously if it works well in production then that's something at least, but testing/debugging it is a real pain because it's awfully slow.
|
# ? Apr 10, 2015 00:47 |
|
I'm kind of curious how people use Automapper in real projects. I thought I'd try it out and I quickly found that it was just making more work for me and it seemed like unless your view models were like, almost exactly like your domain models, it wouldn't save you time.
|
# ? Apr 10, 2015 02:58 |
|
Calidus posted:Thank you both for the suggestions. I have an ugly winform app, that I have managed to strip out most of the business logic into its own project. I would like to use that business logic to create a single page web app(maybe 3 pages at most) to replace it. I figured wrapping everything in json would a good place to start. Well if you're gonna do that I'd just skip ahead to generating the views personally.
|
# ? Apr 10, 2015 02:59 |
|
RICHUNCLEPENNYBAGS posted:I'm kind of curious how people use Automapper in real projects. I thought I'd try it out and I quickly found that it was just making more work for me and it seemed like unless your view models were like, almost exactly like your domain models, it wouldn't save you time. I use it extensively at work for a very large project. We use it to map our domain models to DTOs. What you describe is pretty much our situation. The DTOs are very similar to the domain models except missing some properties not mapped from the domain models and with some additional ignored properties on the DTO. I don't think we've had any material performance problems with it, debug mode or not, though we don't map nearly enough things for this to be a performance bottleneck for us versus other things. Another team in our company has complained about it being slow however so now they just manually map everything. They also had really complex mappings that are annoying to debug for something that should be so simple, so rather than deal with debugging strange AutoMapper issues for something that's slow anyway they decided to do everything by hand. Life is a lot easier now they say.
|
# ? Apr 10, 2015 03:14 |
|
It's also useful for moving data between your objects and generated classes for messaging/remote services/etc. Never bothered looking into performance though.
|
# ? Apr 10, 2015 03:22 |
|
Cryolite posted:I use it extensively at work for a very large project. We use it to map our domain models to DTOs. What you describe is pretty much our situation. The DTOs are very similar to the domain models except missing some properties not mapped from the domain models and with some additional ignored properties on the DTO. Yeah, alright. Probably not well suited to my work. I do like how you can have it run a test to assert you remembered to specify a way to map each field but that does not justify typing a billion lambdas out to set one field as equal to another.
|
# ? Apr 10, 2015 04:32 |
|
RICHUNCLEPENNYBAGS posted:I'm kind of curious how people use Automapper in real projects. I thought I'd try it out and I quickly found that it was just making more work for me and it seemed like unless your view models were like, almost exactly like your domain models, it wouldn't save you time. I'm similar to Cryolite in how I use it. You're right though it's a lot of extra work and if I had known when I started what I know now, I probably wouldn't have bothered with it.
|
# ? Apr 10, 2015 06:02 |
|
epalm posted:The fact that they haven't offered an uncheckable checkbox for this is criminal. I'm literally afraid to Ctrl-V in *.cshtml files because it's SO loving BAD.
|
# ? Apr 10, 2015 06:35 |
|
RICHUNCLEPENNYBAGS posted:I'm kind of curious how people use Automapper in real projects. I thought I'd try it out and I quickly found that it was just making more work for me and it seemed like unless your view models were like, almost exactly like your domain models, it wouldn't save you time. It does a lot of things which save time beyond basic mapping. You can validate mappings so that if properties change on the domain model, you will know if you missed them in your view. You can also write generic ValueResolvers which allow you to share methods of mapping specific values (such as localized values / currencies which I've found it very useful for). It can be frustrating if all you are doing is mapping two or three properties each time but it's been a life saver for me multiple times.
|
# ? Apr 10, 2015 13:38 |
|
I've been looking around for this information but have had no luck. What is the minimum framework version that can be targeted with C# 6?
|
# ? Apr 10, 2015 13:55 |
|
Inverness posted:I've been looking around for this information but have had no luck. It depends on what features of C# 6 you want to use. See this: http://stackoverflow.com/questions/28921701/does-c-sharp-6-0-work-for-net-4-0
|
# ? Apr 10, 2015 15:37 |
|
Nother academic question. I've been going through and updating all this old code I've inherited from when we were much smaller. In this case I'm creating and writing a large file, with little changes for each file (saving 4 times). What the first guy did:code:
code:
|
# ? Apr 10, 2015 21:31 |
|
That is the canonical way to solve that problem, yes.
|
# ? Apr 10, 2015 22:15 |
|
Scaramouche posted:Is this streamreader/streamwriter thing common, or am I assuming they can co-exist and this will actually improve the situation? If you need to work with large files or anything that may use a lot of memory (but doesn't have to), then yes streams are the idiomatic way of limiting memory usage. I have some suggestions on cleaning up your code, though, if you're interested. StreamWriter has a constructor overload that takes a path and defaults to FileMode.Create. The if statement to check if the line is null is redundant since you're already checking that in the while statement. VB doesn't support assignment inside an expression, so you can't do while((line = reader.ReadLine()) != null) like in C#, though you can do something similar. End result would be something like: Visual Basic .NET code:
|
# ? Apr 10, 2015 22:23 |
|
You can also combine multiple Using variables in a single block, and terminate your loop by checking for .EndOfStream instead of waiting for a null Also, I wouldn't bother checking for file existence. You want to handle I/O exceptions anyway, because file permissions / drive access / network access could drop at any time during the operation, so might as well write the code only once. Visual Basic .NET code:
I'm trying to learn the ropes of F#, and I don't quite get why I must always put an identifier in discriminated unions. Basically, it seems to me that this ought to be legal code: code:
Can anybody help me understand if there's a reason the above code is not allowed? NihilCredo fucked around with this message at 00:47 on Apr 11, 2015 |
# ? Apr 10, 2015 23:29 |
|
NihilCredo posted:Unrelated: So that you can have multiple cases backed by the same type that vary semantically. code:
|
# ? Apr 11, 2015 01:19 |
|
Funking Giblet posted:It does a lot of things which save time beyond basic mapping. You can validate mappings so that if properties change on the domain model, you will know if you missed them in your view. You can also write generic ValueResolvers which allow you to share methods of mapping specific values (such as localized values / currencies which I've found it very useful for). It can be frustrating if all you are doing is mapping two or three properties each time but it's been a life saver for me multiple times. Yeah, I'm familiar with those and I think they're cool, but they weren't enough to make me feel it was worth it.
|
# ? Apr 11, 2015 04:16 |
|
RICHUNCLEPENNYBAGS posted:Yeah, alright. Probably not well suited to my work. Are all of your property names different? I think most people rely on the property names being the same and it mapping those by convention. Most of our maps are nothing more than Mapper.CreateMap<Client, ClientDto>(); with maybe a few .ForMember(x => x.SomeAdditionalProperty, opt => opt.Ignore()). We rarely use MapFrom.
|
# ? Apr 11, 2015 21:17 |
|
Am I overlooking something or is there not an easy way to put a click-able e-mail address in an RTF text box? Here's a bunch of pieced-together code that I found online when researching the issue. I had to convert most of it to VB from C# and then tweak it along the way. When I run my program I eventually get an out of memory exception at "thread.Start(threadData)".code:
code:
Edit- Was following the advice located here- http://stackoverflow.com/questions/28864778/sending-email-as-html-from-richtext-box TheEffect fucked around with this message at 23:56 on Apr 11, 2015 |
# ? Apr 11, 2015 23:48 |
|
Cryolite posted:Are all of your property names different? I think most people rely on the property names being the same and it mapping those by convention. Most of our maps are nothing more than Mapper.CreateMap<Client, ClientDto>(); with maybe a few .ForMember(x => x.SomeAdditionalProperty, opt => opt.Ignore()). We rarely use MapFrom. Sometimes, but more importantly, usually the view model contains data from multiple tables.
|
# ? Apr 12, 2015 00:03 |
|
TheEffect posted:Am I overlooking something or is there not an easy way to put a click-able e-mail address in an RTF text box? Here's a bunch of pieced-together code that I found online when researching the issue. I had to convert most of it to VB from C# and then tweak it along the way. When I run my program I eventually get an out of memory exception at "thread.Start(threadData)". I think you copied your code from http://matthewmanela.com/blog/converting-rtf-to-html/ but mistyped. It should be code:
|
# ? Apr 12, 2015 01:41 |
|
ljw1004 posted:That said, I don't know what that code is doing nor why. Whenever I wanted a hyperlink in win32, I made basically just made it a TextBlock, set font to blue underline, set its cursor to a Hand, and added a Click hander. I like this much better. Thanks@
|
# ? Apr 12, 2015 07:20 |
|
I'm trying to create a pause function so that users can pause an operation. My code is set up something like so:code:
I read something about making my application events separate from my GUI, but I'm not sure where to even start with that. Do I add a new module or something? LiterallyAnything fucked around with this message at 15:42 on Apr 13, 2015 |
# ? Apr 13, 2015 15:35 |
|
Brady posted:I'm trying to create a pause function so that users can pause an operation. My code is set up something like so: What is DoStuff doing? If it's an I/O bound operation (reading files, getting stuff from a web service, etc), use async/await. If it's a long-running CPU-bound operation, use Tasks or Background Workers. Background workers are conceptually simpler than Tasks. Basically, your application starts out with 1 thread: The UI thread. Everything that your application does happens in this thread. There's something called the event loop in UI applications, and updating the UI happens as part of the event loop. Your application code also happens in the event loop. If you run something long-running in the UI thread, the event loop stops processing, your application "freezes", and you're sad. Async/await solves the problem for I/O bound tasks by doing a lot of scary stuff under the covers to keep the event loop running while the other logic executes, but it all stays on the same thread and is much easier for someone who doesn't have a solid grasp of threading behavior to get a handle on. Background workers solve the problem by letting you kick off an additional thread to handle the processing. You can't update the UI from that thread, so you have to call a method on your background worker to report progress back to the UI thread and update the UI accordingly. New Yorp New Yorp fucked around with this message at 16:29 on Apr 13, 2015 |
# ? Apr 13, 2015 16:24 |
|
|
# ? Jun 8, 2024 09:11 |
|
Ithaqua posted:Background orkers are conceptually simpler than Tasks. I think calling Task.Run is easier than spinning up a BackgroundWorker, so is there something else I'm not thinking of?
|
# ? Apr 13, 2015 16:59 |