|
JerikTelorian posted:I've got a complicated question (at least, it seems complicated). I'm working in C# and Unity. You can always use reflection to get the properties of a class. You can even define an attribute ('DisplayableAttribute') and only get the properties that you've tagged as displayable, so you can have other, non-displayable properties. Something like this may be what you're after. I haven't tested it so who knows. code:
|
# ? Jul 4, 2017 19:04 |
|
|
# ? Jun 8, 2024 07:26 |
|
New Yorp New Yorp posted:You can always use reflection to get the properties of a class. You can even define an attribute ('DisplayableAttribute') and only get the properties that you've tagged as displayable, so you can have other, non-displayable properties. Reflection is probably the way to go. An alternative might be to use xml or json serialization, and turn your object into a string (which, of course, uses reflection under the hood)
|
# ? Jul 4, 2017 20:08 |
|
That seems like exactly what I want! I'll go do some reading up on reflection, thanks!
|
# ? Jul 4, 2017 20:14 |
|
biznatchio posted:Add this property to the PropertyGroup in your csproj: Thanks man, I couldn't find this anywhere ...
|
# ? Jul 4, 2017 22:46 |
|
If you want to be able to add/remove/modify properties at runtime too, though, you should give up and just use a dictionary type. Or you could whole-hog Entity-Component-System it.
|
# ? Jul 5, 2017 12:53 |
|
I'm looking for a CI solution to build and deploy ASP.NET Core apps on Linux. I'd like to be able to trigger a build, run the unit tests and deploy when I commit to a given branch. Pretty standard stuff I think except I'd like to host it on my own servers. What would be a good project to handle this? I own the web and DNS servers so I can setup hostnames and install the stuff I have to. Note that some of the projects I want to set this up with aren't open source. I'm not against using online services if they are free but they must provide private repositories for the non-open source parts. Mostly because this is a side project of mine and I can't really spend more money on this than the price I pay for the VPS.
|
# ? Jul 5, 2017 19:56 |
|
I use Visual Studio Team Services and I love it. Easiest to use devops automation suite I have ever run into. The default build and release definition templates pretty much do exactly what you said. I think it has a free tier with up to 5 users? Not sure, we use the paid tier through MSDN.
|
# ? Jul 5, 2017 20:00 |
|
Sounds good, but how do they publish the app after its built? Do you have to use Azure or can they just POST the artifacts somewhere? edit: nevermind, I see their publish options now that I actually tried it. Furism fucked around with this message at 20:48 on Jul 5, 2017 |
# ? Jul 5, 2017 20:10 |
|
I think you can also have a app service that’s on Azure be auto-provisioned to have continuous deployment through a wizard that will set up a VSTS job for you. Got that working with one of our internal sites and it worked well.
|
# ? Jul 6, 2017 00:15 |
|
Yeah and in the end, the whole build & release workflow is just a set of steps to execute one after another. You can put any steps in there if you want - run your own exes, run them on Linux or Windows, publish to whereever you want. The default templates are just easy examples but it's fully customizable. For example, I push Docker images to an image registry in my build definition, then the release definition shoots out instructions to install them on various servers. Alternatively, you can install an agent on your server, which will then make it so that the VSTS release definition actually gets executed directly on your own server, pulling in any build outputs automatically.
|
# ? Jul 6, 2017 08:22 |
|
Nevermind..... Always check if you are iterating over the right list..... Mr Shiny Pants fucked around with this message at 21:13 on Jul 6, 2017 |
# ? Jul 6, 2017 19:28 |
|
I'm looking at introducing some more automated tests, and I'd like something where I can fire up a deployment of a project, point a tool of some description at it, and have that tool run over the entire project, clicking every clickable thing etc. The main caveat is that a lot of the "clickable things" are not necessarily <a> or <button> and a lot of it is client-side, single-page style navigation, so I'm not sure if there's a tool that will be able to follow these things correctly. That said, 95% of them ARE <a> or <button> so it's not a huge problem if it can't follow clicks on other elements.
|
# ? Jul 7, 2017 00:50 |
|
a hot gujju bhabhi posted:I'm looking at introducing some more automated tests, and I'd like something where I can fire up a deployment of a project, point a tool of some description at it, and have that tool run over the entire project, clicking every clickable thing etc. The main caveat is that a lot of the "clickable things" are not necessarily <a> or <button> and a lot of it is client-side, single-page style navigation, so I'm not sure if there's a tool that will be able to follow these things correctly. That said, 95% of them ARE <a> or <button> so it's not a huge problem if it can't follow clicks on other elements. Selenium, but seriously only use it for smoke tests. Unit and integration test first and foremost. UI tests are slow and brittle and suck to maintain. I've been down that road before with clients that refused to listen to reason and it never ended well. I cannot imagine what the value of "clicking every clickable thing" is. You clicked the thing. Did it behave properly? Who knows. Write tests tailored to actual use-cases. New Yorp New Yorp fucked around with this message at 00:58 on Jul 7, 2017 |
# ? Jul 7, 2017 00:56 |
|
New Yorp New Yorp posted:Selenium, but seriously only use it for smoke tests. Unit and integration test first and foremost. UI tests are slow and brittle and suck to maintain. I've been down that road before with clients that refused to listen to reason and it never ended well. "clicking every clickable thing" was really not the best way to describe it. Basically I'm trying to automate the process of hitting every controller action needed by the MVC project, as I suspect there are some that are no longer in use, and some that are but could maybe be refactored, and that refactoring itself might break some links as well.
|
# ? Jul 7, 2017 01:40 |
|
a hot gujju bhabhi posted:"clicking every clickable thing" was really not the best way to describe it. Basically I'm trying to automate the process of hitting every controller action needed by the MVC project, as I suspect there are some that are no longer in use, and some that are but could maybe be refactored, and that refactoring itself might break some links as well. This is a classic example of an XY problem. Your actual problem is that you want to find dead code -- in this case, unused controller actions. A good solution to that problem is to instrument your application so you can monitor what's being hit and what isn't. A less good solution is to try to figure this out by clicking around the UI. Look at Application Insights or Dynatrace or something. As far as I'm concerned, any non-trivial application should be instrumented to at least some degree. New Yorp New Yorp fucked around with this message at 04:23 on Jul 7, 2017 |
# ? Jul 7, 2017 04:20 |
|
I think you'd need to go over request logs to make sure your endpoints aren't being hit - unless you don't care if someone bookmarked one that you 'hid' by removing it from a view.
|
# ? Jul 7, 2017 15:02 |
|
New to this guys and I'm having an issue. I'm just trying to go through an array of strings in order to check if the word in the string is also in "enable1.txt". Every time a word does match, it should up score by one. However, as far as I can tell it is only processing the first element of "input" even when other words are in "enable1.txt". What am I doing wrong? code:
|
# ? Jul 8, 2017 22:37 |
|
So, you have essentially 2 collections of strings: the ones to check for and all the lines in the file. Doing something similar to how you wrote it, I would:code:
return File.ReadLines("enable1.txt").Count(x => input.Contains(x));
|
# ? Jul 8, 2017 22:49 |
|
a hot gujju bhabhi posted:"clicking every clickable thing" was really not the best way to describe it. Basically I'm trying to automate the process of hitting every controller action needed by the MVC project, as I suspect there are some that are no longer in use, and some that are but could maybe be refactored, and that refactoring itself might break some links as well. Sounds like you need code coverage and/or static analysis tools.
|
# ? Jul 9, 2017 00:40 |
|
B-Nasty posted:So, you have essentially 2 collections of strings: the ones to check for and all the lines in the file. Doing something similar to how you wrote it, I would: Thanks B-Nasty. I'm literally at the point where I'm learning new things by the hour. I understand the for loop code fairly easily, but the single line of code is a bit vexing. I just read up on lambda functions and I want to make sure I'm understanding the code correctly. The lambda expression is the really confusing part. It seems to say "look for x, but hey x itself is a search function". Does the lambda function just tell Contains() give me everything you can find and put it into a list? Edit: removed some questions, tested and got answers. Xeom fucked around with this message at 01:46 on Jul 9, 2017 |
# ? Jul 9, 2017 00:50 |
|
Xeom posted:The lambda expression is the really confusing part. It seems to say "look for x, but hey x itself is a search function". Does the lambda function just tell Contains() give me everything you can find and put it into a list? It's really kinda saying, for each x, do something and return something (in this case a boolean). So, the x could be named fileLine (it can be any name you want, but is usually a single letter), and it would read for all the lines in the file, where the input array contains that line, get the count. The Count(x => x...) syntax is just a shortcut for: fileLines.Where(fileLine => input.Contains(fileLine)).Count(); The contains is tricky here, because it is doing a search within a search (like the nested loops in the original.) LINQ can take a while to understand, but once it clicks, it really opens up a world of power and simplicity. The beauty of LINQ methods is that they are, at their core, really simple operations (https://github.com/dotnet/corefx/tree/master/src/System.Linq/src/System/Linq) on collections.
|
# ? Jul 9, 2017 02:54 |
|
It took me a long time to understand lambda expressions, but it kind of clicked for me when I likened them to a mathematical equation: Given some object X, I want to check if the input contains that X. Most of the applications of them within LINQ are against items in a collection.
|
# ? Jul 9, 2017 03:06 |
|
I always explained lambdas using the success / error callbacks of ajax calls to new .NET people at my last job. Not exactly 1:1 unless you're talking filter or map or something, but it seemed to get people over the is "x =>" thing.
|
# ? Jul 9, 2017 03:20 |
|
Xeom posted:New to this guys and I'm having an issue. I'm just trying to go through an array of strings in order to check if the word in the string is also in "enable1.txt". The while loop keeps advancing in the file until the end, and you don't do anything to reset the position to the beginning. This means that after the first time you go through the while loop, it will already be at the end. To make this code work, you would need to either open the file again in each iteration of the for loop (really terrible) or seek to the beginning each time (less terrible). The first code that B-Nasty gave is more efficient and solves this issue by switching the order of the loops, so that the outer loop reads through the file and you only have to do this a single time. quote:The lambda expression is the really confusing part. It seems to say "look for x, but hey x itself is a search function". Does the lambda function just tell Contains() give me everything you can find and put it into a list? x => input.Contains(x) is just like code:
mystes fucked around with this message at 03:46 on Jul 9, 2017 |
# ? Jul 9, 2017 03:41 |
|
Passing funcs as a parameter is a challenge for some. Even if they've technically seen it in AJAX calls, etc., many weren't really thinking about what was going on there.
|
# ? Jul 9, 2017 04:34 |
|
New Yorp New Yorp posted:This is a classic example of an XY problem. Sedro posted:Sounds like you need code coverage and/or static analysis tools. I know this and we're using dotCover for that part, but a code coverage tool is useless unless you actually have some way to exercise all the possible paths through your application. This second part is what I'm asking about. I could obviously open up the app and just click on everything I can find but that doesn't strike me as super reliable, and I was hoping there exists a tool to automate this part for me.
|
# ? Jul 10, 2017 02:55 |
|
a hot gujju bhabhi posted:I know this and we're using dotCover for that part, but a code coverage tool is useless unless you actually have some way to exercise all the possible paths through your application. This second part is what I'm asking about. I could obviously open up the app and just click on everything I can find but that doesn't strike me as super reliable, and I was hoping there exists a tool to automate this part for me. dotCover doesn't address my advice. Your code is exercised best in production, where people are using it, possibly in ways that you can't even imagine, including potentially via bookmarks to URLs that are no longer accessible via clicking. I'm saying to add monitoring in production so that this is easily identifiable information based on actual production usage data. https://azure.microsoft.com/en-us/services/application-insights/
|
# ? Jul 10, 2017 14:25 |
|
You must have a rough idea about which code seems to not be used anymore right? Otherwise you would not be doing this I guess. Maybe keep it simple and log something to a textfile whenever the code is being hit? Keep it running for a week? A month? If it seems to not be used anymore start removing stuff.
|
# ? Jul 10, 2017 18:10 |
|
New Yorp New Yorp posted:dotCover doesn't address my advice. Your code is exercised best in production, where people are using it, possibly in ways that you can't even imagine, including potentially via bookmarks to URLs that are no longer accessible via clicking. The problem is our application is ridiculously configurable, so some code may never (or very rarely) be hit in production but are still technically reachable with the right configuration. I know what Application Insights is and I understand what you're saying, but we're talking about two different things. Deploying that in production tells me nothing about code coverage with absolute certainty, it only tells me that none of our customers happened to hit a particular bit of code. I can't just go chopping out bits of code because they weren't hit in production, there's no guarantee that the code couldn't have been hit, only that it wasn't. I need some way to meticulously check every path through the application. But I'm guessing from the responses here that such a thing doesn't exist, so I guess it's going to have to be a manual task for us. Mr Shiny Pants posted:You must have a rough idea about which code seems to not be used anymore right? Otherwise you would not be doing this I guess. I do have some top suspects, yeah. I might do something like this in combination with the Application Insights suggestion. I was just kind of hoping there was a more rigorous approach I could use (other than manually doing it).
|
# ? Jul 11, 2017 01:28 |
|
Let's say I want the ability to test my code for midnight/new-year's-eve shenanigans, so I replace every call to DateTime.Now with a call to a wrapper that returns Now in production, and returns (Now.AddTicks(someOffset)) when I test specific date times. What would be the simplest way to ensure a direct call to DateTime.Now doesn't slip through code review?
|
# ? Jul 12, 2017 14:05 |
|
We cover almost exactly that situation with Sonarqube, but it isn't simple to set up and its too slow on our project to be practical as a pre-checkin condition (it runs nightly and so raises issues after they've been checked-in). Also unless you assign CRs based on the issues it raises most devs will just ignore it (we don't and now have 80k issues in our super serious must fix list of issues), but at least it allows us to track usage accurately and easily. You can also get it to check for things like db loading methods being used in loops which is cool.
|
# ? Jul 12, 2017 14:47 |
|
NihilCredo posted:Let's say I want the ability to test my code for midnight/new-year's-eve shenanigans, so I replace every call to DateTime.Now with a call to a wrapper that returns Now in production, and returns (Now.AddTicks(someOffset)) when I test specific date times. Don't know if this is possible or if it even runs on the full .Net, but could you compile a .Net framework version that overloads the DateTime.Now method and just returns what you want? That way you don't need to keep track, just make sure you deploy this framework in the right place, otherwise bad stuff will happen. It is opensource now right?
|
# ? Jul 12, 2017 14:58 |
|
Dirty Frank posted:We cover almost exactly that situation with Sonarqube, but it isn't simple to set up and its too slow on our project to be practical as a pre-checkin condition (it runs nightly and so raises issues after they've been checked-in). Also unless you assign CRs based on the issues it raises most devs will just ignore it (we don't and now have 80k issues in our super serious must fix list of issues), but at least it allows us to track usage accurately and easily. You can also get it to check for things like db loading methods being used in loops which is cool. I don't know about other solutions, but in VS Team Services, if you do a SonarQube analysis as part of a PR CI build, you'll get any new issues popping up as in-line annotations. Combine that with a branch policy that requires all annotations to be resolved before merging, and it forces people to deal with new issues. Or to intentionally, explicitly say "I don't care, I'm ignoring this", which the PR approver(s) can deal with as harshly as they'd like.
|
# ? Jul 12, 2017 15:08 |
|
New Yorp New Yorp posted:I don't know about other solutions, but in VS Team Services, if you do a SonarQube analysis as part of a PR CI build, you'll get any new issues popping up as in-line annotations. Combine that with a branch policy that requires all annotations to be resolved before merging, and it forces people to deal with new issues. Or to intentionally, explicitly say "I don't care, I'm ignoring this", which the PR approver(s) can deal with as harshly as they'd like. I'm not on the CI team, but as I understand it it takes ~2 hours to run, so not really practical, maybe there's a way to only run it on the effected projects or something though?
|
# ? Jul 12, 2017 15:16 |
|
Dirty Frank posted:I'm not on the CI team, but as I understand it it takes ~2 hours to run, so not really practical, maybe there's a way to only run it on the effected projects or something though? Not that I'm aware of, but I'm far from an expert. It's probably just a case where the application is too big to be continuously integrated as a single unit and needs to be made a bit more modular. Of course, that's frequently easier said than done.
|
# ? Jul 12, 2017 18:04 |
|
NihilCredo posted:Let's say I want the ability to test my code for midnight/new-year's-eve shenanigans, so I replace every call to DateTime.Now with a call to a wrapper that returns Now in production, and returns (Now.AddTicks(someOffset)) when I test specific date times. What about a custom Roslyn code analyzer that will fail the build when DateTime.Now is used?
|
# ? Jul 12, 2017 18:06 |
|
My project depends on a nuget package which is built from a project in a different solution. I want to develop some changes to the dependency. How am I supposed to deal with this? Can I switch it into a project reference temporarily somehow?
|
# ? Jul 12, 2017 23:05 |
|
a hot gujju bhabhi posted:The problem is our application is ridiculously configurable, so some code may never (or very rarely) be hit in production but are still technically reachable with the right configuration. I know your pain. Where I used to work we had over 1000 configurable values. The configuration values were just thrown into a dynamic table in the UI, which made it way too easy to add five new ones in every drat project since there was virtually no design work involved. I and another developer had many debates with the domain experts where we argued that the configuration creep was one of the major reasons we had so many bugs. From a mathematical point of view, adding a configuration value makes your system at least twice as complex, because every configurable value can be in at least two different states (sometimes far more), and technically every configuration value can alter the behavior of the system when interacting with any one of the other configuration values. If k is the number of unique configurable values, the number of possible configuration states is at least 2k. In practice most of them are independent of each other, but you can never know for sure when some weird combination you hadn't thought of will behave oddly.
|
# ? Jul 12, 2017 23:25 |
|
Sedro posted:My project depends on a nuget package which is built from a project in a different solution. I want to develop some changes to the dependency. How am I supposed to deal with this? Can I switch it into a project reference temporarily somehow? This is one of the major NuGet pain points. You could do something with MSBuild conditionals in the csproj file, I think. I dimly remember having done something like that once but I could be misremembering.
|
# ? Jul 12, 2017 23:30 |
|
|
# ? Jun 8, 2024 07:26 |
|
Sedro posted:My project depends on a nuget package which is built from a project in a different solution. I want to develop some changes to the dependency. How am I supposed to deal with this? Can I switch it into a project reference temporarily somehow? I don't know if you're using TeamCity, but it makes building/hosting Nuget packages easy. Make some changes to package, commit + build, and go to dependent project's Nuget management to update to the version+1 or whatever directly from TeamCity's feed.
|
# ? Jul 13, 2017 01:48 |