|
Any suggestions for the most modern way to run PowerShell scripts from C#? From what I can google, a lot of stuff is PS1.0 and .NET 2.0 and seems out of date. Looking to run actual script files, ideally natively (so possibly read the PowerShell file contents and then execute that as a PowerShell object). Any suggestions?
|
# ? Jul 25, 2015 15:52 |
|
|
# ? Jun 6, 2024 17:45 |
|
So what do you guys do for storing passwords? I have a couple of certificates (pfx) that need a password to open, so I can't really store salted passwords. Somewhere I would need to store the password otherwise I can't sign new certs for other nodes in the network. I don't want to store them in the cert manager otherwise it won't work on Linux. Any ideas? I am fine by storing them on disk, I mean if they have physical access to the machine the whole point is moot anyway. I was just wondering if some of you might have done something like this before.
|
# ? Jul 25, 2015 21:02 |
|
I accidentally just wrote an event handler for A that caused event B to fire, which in turn had a handler that caused A to fire, but the resulting infinite loop didn't blow my stack. Is that as impressive of a runtime achievement is it seems?
|
# ? Jul 25, 2015 23:19 |
|
GrumpyDoctor posted:I accidentally just wrote an event handler for A that caused event B to fire, which in turn had a handler that caused A to fire, but the resulting infinite loop didn't blow my stack. Is that as impressive of a runtime achievement is it seems? Not really, I think. Events are async, so each handler will happily terminate and GTFO of the stack after firing off the event that continues the loop - kinda like TCO, in a way. In a normal infinite loop you blow the stack because there's an endless chain of calling functions that never got to terminate, but that doesn't happen here.
|
# ? Jul 25, 2015 23:32 |
|
ljw1004 posted:PS. I'm due to give some Microsoft internal training talks on UWP app development in .NET, and the new CoreCLR and NuGet stuff. If you have further questions I'd love to hear them so I can incorporate the answers into my talks . I'll make public versions of the talks too. Here's a question: I don't understand how to target .NET Core in VS 2015. I had expected to see it in the framework dropdown on the 'New Project' screen, along with all the full .NET versions, but it's not there. I've googled but I don't know what the appropriate incantation is. This only shows command line tools. The 'More Frameworks' link doesn't say anything (and ps- the url implies I clicked this from 2013, but it was 2015). Is this something that will only be possible after the 29th? Factor Mystic fucked around with this message at 02:04 on Jul 26, 2015 |
# ? Jul 26, 2015 02:02 |
|
NihilCredo posted:Not really, I think. I had never heard this before. Do you know somewhere I can read about it?
|
# ? Jul 26, 2015 02:13 |
|
Factor Mystic posted:Here's a question: I don't understand how to target .NET Core in VS 2015. I had expected to see it in the framework dropdown on the 'New Project' screen, along with all the full .NET versions, but it's not there. I've googled but I don't know what the appropriate incantation is. This only shows command line tools. The 'More Frameworks' link doesn't say anything (and ps- the url implies I clicked this from 2013, but it was 2015). Today in VS2015 you can do File>New>C#>Web>ConsoleApp/ClassLibrary. These are still in preview. As of July 29th you'll be able to do File>New>C#/VB>Windows>Universal>App/ClassLibrary. Those are all the project types which take advantage of .NETCore. (That means: these app types pick up one of the .NETCore implementations of the .NET runtime, and they pick up the .NETCore implementations of the .NET framework, and they deploy them app-locally.) .NETCore hasn't yet made its way into any other project types. I don't think we'll see it as an option for regular desktop apps (Console, WPF, WinForms) for a while. That's because these project types all depend upon the very large .NET framework that's part of the OS, and includes things like WPF and Winforms, things that aren't in .NETCore.
|
# ? Jul 26, 2015 05:24 |
|
GrumpyDoctor posted:I had never heard this before. Do you know somewhere I can read about it? Ok, sorry there, midnight brain fart, forget what I said. I'm so used to putting events, particularly UI events, on async execution (event handlers just wrap a threadpool call) that I forgot it's not the default behaviour. Event handler methods, by themselves, are blocking and synchronous. There still could be several reasons why your loop didn't explode. Maybe one of the events only actually fires after the method is exited, maybe you're using WaitHandles in a way that prevents the problem... I'd like to see the code, to be honest.
|
# ? Jul 26, 2015 11:23 |
|
GrumpyDoctor posted:I accidentally just wrote an event handler for A that caused event B to fire, which in turn had a handler that caused A to fire, but the resulting infinite loop didn't blow my stack. Is that as impressive of a runtime achievement is it seems? The CLR JIT, particularly on x64, is quite happy to do tail-call optimization. That's when the last act of one method is to invoke another method, and it decides to simply re-use the callers stack frame rather than starting a new one. I wonder if this is happening? (you can disable it with MethodImplOptions attribute on your method, or something like that).
|
# ? Jul 26, 2015 13:02 |
|
I'm going nuts trying to sort this out in my head. In the MVVM pattern, are ViewModels expected to contain instances of their associated models, or should the actual data be stored/kept somewhere else? If the latter, what the hell should I be googling for? The first is what I defaulted to trying to learn this, but then I wondered how the hell two viewmodels should be sharing data that they both need to work with. (I sort of alluded to this earlier with the Command question. Really dealing with having multiple viewmodels in general is what's killing me I think )
|
# ? Jul 26, 2015 19:56 |
|
Ciaphas posted:I'm going nuts trying to sort this out in my head. In the MVVM pattern, are ViewModels expected to contain instances of their associated models, or should the actual data be stored/kept somewhere else? If the latter, what the hell should I be googling for? Ain't it grand? I usually encapsulate my model in my viewmodel, saves me from writing proxies. So I have a viewmodel that has a model as property, any properties set or get from the viewmodel will be get and set the from the model it contains. The setters in the viewmodel will INPC. The problem with this is with collections, you have to write your own adder and remover functions if the model has no ObservableCollections in it. A for viewmodel to viewmodel, use messages. In the MVVMlight toolkit you'll find a good messaging solution.
|
# ? Jul 26, 2015 20:02 |
|
I'm trying to avoid using outside toolkits or libraries, at least at work, because of the Internet thing (I could download it and drag a CD upstairs but ). Is a good inter-VM messaging scheme much of a pain to write? While I'm at home I'll take a look at MVVM Light, thanks Ciaphas fucked around with this message at 22:51 on Jul 26, 2015 |
# ? Jul 26, 2015 22:47 |
|
ljw1004 posted:Today in VS2015 you can do File>New>C#>Web>ConsoleApp/ClassLibrary. These are still in preview. "File>New>C#>Web>ConsoleApp/ClassLibrary" doesn't show .NET Core in the New Project window, but I see I can switch over to it in project properties. That's a bit weird but I can deal. Not sure why normal desktop Console apps couldn't target .NET Core the way a "web" Console app can.
|
# ? Jul 27, 2015 01:38 |
|
Ciaphas posted:Is a good inter-VM messaging scheme much of a pain to write? The concept isn't complicated, but there can be a lot of weirdness with garbage collection so you have to use WeakReference. Also, if you want your message subscriptions strongly typed (you do), then you have to deal with collections containing multiple generic types. It's annoying enough that you're probably better off picking up someone else's battle tested implementation. Also who restricts a programmer's internet? That's just a guaranteed destruction of productivity.
|
# ? Jul 27, 2015 04:29 |
|
Bognar posted:The concept isn't complicated, but there can be a lot of weirdness with garbage collection so you have to use WeakReference. Also, if you want your message subscriptions strongly typed (you do), then you have to deal with collections containing multiple generic types. It's annoying enough that you're probably better off picking up someone else's battle tested implementation. Sounds like is in favor of getting MVVMLight or some other library, then. Thanks.
|
# ? Jul 27, 2015 05:10 |
|
Ciaphas posted:Sounds like is in favor of getting MVVMLight or some other library, then. Thanks. From having used MVVMLight, it is not something you whip up in a day. It is a well respected library though.
|
# ? Jul 27, 2015 05:33 |
|
Factor Mystic posted:"File>New>C#>Web>ConsoleApp/ClassLibrary" doesn't show .NET Core in the New Project window, but I see I can switch over to it in project properties. That's a bit weird but I can deal. it's due to legacy and IP the 'full' non-core framework is required for WPF, forms, etc because they are implemented in terms of windows-specific APIs. directx is used heavily, stuff like system.drawing uses GDI, system.web uses http.sys, etc. the new core is open source and cross-platform- they don't want to open source and can't make cross-platform parts of the older stuff. asp.net 5 runs purely on the OSS code and can use things like IIS optionally as plugins. windows 10-specific (uwp) stuff runs on .net core + proprietary windows specific parts. it can be thought of as a refactoring of WPF so that the xaml layer exists 'above' the .net one. (although this is an oversimplification and not actually true. uwp is really more like 'WPF reimplemented in c++/COM, with the environments including .net able to access its apis via 'projection' plugins. for windows 8, the .net projection was a custom vertical; now it is .net core)
|
# ? Jul 27, 2015 06:08 |
|
Any ETA on Azure supporting 4.6?
|
# ? Jul 27, 2015 07:27 |
|
clandestine cactus posted:Any ETA on Azure supporting 4.6? Apparently you shouldn't upgrade to 4.6, yet.
|
# ? Jul 27, 2015 18:21 |
|
Gul Banana posted:it's due to legacy and IP I know all that, perhaps you misinterpreted my statement. I'm not expecting that WPF or Winforms or a Full Desktop Console app be able to be targetted to .NET Core. I AM expecting that for certain project template types, I would be able to target .NET Core... for example, Console apps and Library (dll) projects as previously stated. This is part of where my confusion was, because even though "Web" Console/Library projects CAN target .NET Core, you CANNOT pick it from the "Framework" list in the New Project dialog. Furthermore, I'm not sure what differentiates a "Web" Console/Library project from a "Windows" Console/Library project except that the former can target .NET Core & the latter can't even though a "Web" Console/Library certainly will work on WIndows. If I want to make a Console app that works on Windows and also works on Linux, and I want to build this thing in VS2015, currently I have to make a "Web" Console app targetted to Full .NET 4.6, then go into project properties and retarget it to .NET Core. This is confusing and irritating. Hence my question, why can't a "Windows" Console app retarget to .NET Core the way a "Web" Console app can. Is what's actually going on here a project file format selection? So if I go "Web" I get project.json and if I go "Windows" I get mything.csproj? And then what is changing on the 29th?
|
# ? Jul 27, 2015 18:36 |
|
epalm posted:Apparently you shouldn't upgrade to 4.6, yet. The 4chan-Boston-Marathon-witchhunt style debugger diagrams in the github issue are great.
|
# ? Jul 27, 2015 18:47 |
|
Factor Mystic posted:If I want to make a Console app that works on Windows and also works on Linux, and I want to build this thing in VS2015, currently I have to make a "Web" Console app targetted to Full .NET 4.6, then go into project properties and retarget it to .NET Core. This is confusing and irritating. Hence my question, why can't a "Windows" Console app retarget to .NET Core the way a "Web" Console app can. Is what's actually going on here a project file format selection? So if I go "Web" I get project.json and if I go "Windows" I get mything.csproj? And then what is changing on the 29th? The .NET Core "Console app" stuff currently in VS2015 is all still "PREVIEW" -- that's why it's confusing and irritating! there's just the bare minimum there at the moment to demonstrate things working end-to-end. What's changing on the 29th is (1) One new .NET Core targets have been finished up, UWP. Also, UWP apps use .NET Native when you build them in "Release" mode. (2) Another new .NET Core target has mostly been finished up, PCL. Plus the shims needed to get a .NET Core PCL working properly in non-.NETCore-projects. There are still a couple of rough edges in ".NET Core PCLs" regarding Project2Project references, but nothing show-stopping. Writing a "PCL which targets .NET46 + UWP" is another option you have now for writing a .NET Core class library. (3) Technically as of July 29th you can use project.json in any project type, although there might be rough edges and it's not yet documented. I wrote a blog post about project.json and what it means for NuGet package authors: http://blogs.msdn.com/b/lucian/archive/2015/07/27/writing-a-nuget-package-for-vs2015-rtm-and-uwp.aspx As for what the next .NET Core target will be and when it will be done? I don't know. I do hope it's console apps because I love me some console apps, and the ASP.NET web console apps don't quite hit the spot for me.
|
# ? Jul 27, 2015 19:07 |
|
epalm posted:Apparently you shouldn't upgrade to 4.6, yet. Wow, that's a pretty big deal. A bug that only pops up in Release builds, with optimizations enabled, that silently passes incorrect parameters to methods. EDIT: Oh, cool. It also affects 64-bit .NET 4.5 apps (maybe 4.0 too?), since installing 4.6 replaces the JITter for earlier framework versions. Bognar fucked around with this message at 19:21 on Jul 27, 2015 |
# ? Jul 27, 2015 19:07 |
|
epalm posted:Apparently you shouldn't upgrade to 4.6, yet. Haha holy poo poo I love how much emphasis he puts on how big a deal this is. I'm not really sure there's anyone who'd see "sometimes arguments are passed incorrectly" as anything other than a huge problem.
|
# ? Jul 27, 2015 19:45 |
|
Yeah, wow. That's terrifying.
|
# ? Jul 27, 2015 20:03 |
|
Wow now I'm wondering if I should hold off on upgrading to windows 10.
|
# ? Jul 27, 2015 20:20 |
|
Does anyone know a good hand-holding introduction to C# for someone who's never programmed before?
|
# ? Jul 27, 2015 23:11 |
|
epalm posted:Apparently you shouldn't upgrade to 4.6, yet. quote:
|
# ? Jul 27, 2015 23:17 |
|
GrumpyDoctor posted:Does anyone know a good hand-holding introduction to C# for someone who's never programmed before? Although C# wasn't my first language, I learned a lot from the C# Primer Plus.
|
# ? Jul 27, 2015 23:59 |
|
quote:edit: removed my article, since the NuGet team are keen to explain this themselves in a few days -- can't wait!
|
# ? Jul 28, 2015 02:20 |
|
Hello developers You're pretty much a different bunch from the infrastructure crew, so it's possible I've never met any of you before. I'm a long time infrastructure consultant, me and Microsoft are good friends. I've ended up writing a lot of VBScript (and now increasingly Powershell), scripting against Active Directory and making increasingly complex scripts until someone hired me to do just that. I did MIS at Uni, not CS. I never wanted to be a dev, because I had ideas about what that meant and what the industry is like.. which were right but also pretty naive. I am at a crossroads in my career, I'm 34 and at pretty much the pointy end of infrastructure. I'm really, really thinking about development as I think it suits my personality more. .NET makes the most sense, it's in the Windows platform which I know a lot about.. I'm already really comfortable with VBS and Powershell and I even did some actual VB coding back in the day. Anyone got some advice? Where to start? Should I do this? Yes, I earn a lot of money and work with big corporations.. are there developers who wish for these things and want to warn me to stay where I am? I guess the biggest hurdle for me is getting that first real dev job and will my code suck because I don't have the formal CS training. I'm willing even to do that.. but it doesn't seem like a mandatory first step. Why do I want to be a dev? I want to be left alone to work on large problems, basically project work I enjoy detail and am meticulous about comments in my own code and doing things in a way that doesn't create a loving mess I enjoy the sense of accomplishment after writing something useful. Infrastructure can end up so soulless, you don't actually create anything and at least at the end of a day of scripting I can look at what I wrote and be proud. I'm getting fed up with infrastructure types.. I know it's probably where I'm working now.. but brainless shitheads that should still be on the helpdesk. I want to work with IT professionals that really want to be here and be good at what they do, not just close tickets and collect pay. I've got a lot of experience in the industry and that would translate to projects.. I know a lot about the Active Directory Scripting Interface, etc, so I'm not some kid who knows coding best practice but has never actually worked in commercial IT. What do you think, .NET devs? Am I doing this for the right reasons? Tony Montana fucked around with this message at 05:51 on Jul 28, 2015 |
# ? Jul 28, 2015 05:49 |
|
Tony Montana posted:
You may very well like development better but I think you need to temper your expectations with regards to a lot of this stuff, like: - I want to be left alone to work on large problems, basically project work - I enjoy detail and am meticulous about comments in my own code and doing things in a way that doesn't create a loving mess - I want to work with IT professionals that really want to be here and be good at what they do
|
# ? Jul 28, 2015 10:13 |
|
just realised something rather sad- it looks like T4 isn't getting updated to C#6. i wanted to use elvis and so on in my templates
|
# ? Jul 28, 2015 11:36 |
|
Re: Switching from IT to Dev: You may find that you enjoy it more, you may find that you enjoy it less. Programmers can be dumb as a box of rocks, too. I'd start trying to learn by taking some scripts you've made and translating them into applications so you can get a feel for working with VS. You can also try hitting up any open source projects you use and going through the code base (maybe with a programmer buddy) to see what you can glean there. Also, read a lot of books on data structures and algorithms.
|
# ? Jul 28, 2015 12:40 |
|
Prefer self documenting code to well documented code. code:
code:
Dietrich fucked around with this message at 14:44 on Jul 28, 2015 |
# ? Jul 28, 2015 13:42 |
|
Dietrich posted:And when you're relying on comments to understand your code, you've got two things to maintain now rather than one. code:
|
# ? Jul 28, 2015 14:13 |
|
Gul Banana posted:just realised something rather sad- it looks like T4 isn't getting updated to C#6. i wanted to use elvis and so on in my templates You mean they're dropping support? Link?
|
# ? Jul 28, 2015 14:14 |
|
Dietrich posted:Prefer self documenting code to well documented code. Your second example has a bug
|
# ? Jul 28, 2015 14:43 |
|
GrumpyDoctor posted:Your second example has a bug dammit i just edited it.
|
# ? Jul 28, 2015 14:44 |
|
|
# ? Jun 6, 2024 17:45 |
|
I'm loving all of this node.js/react/etc integration stuff coming down lately. The real beauty is that even if the implementations are off the mark it gives those of us in corporate IT departments the leverage to start using those technologies since "MSFT is doing it". And yeah, code comments and other largely ceremonial things seem to be for some reason the trappings that new developers associate with "good code" that are in fact (usually) the opposite.
|
# ? Jul 28, 2015 14:51 |