|
Is there a good resource for using json, ajax and js with MVC and .Net? I have been doing some MVC development off and on but it was mostly bootstrap html/css for the views and c# on the back end. I feel kind stupid when i come across simple stuff like using json and an ajax get for cascading combo-boxes which would have made my life so much easier months ago. Ajax partial page post backs were also a eye opener. There has to be a resource with more stuff like this.
|
# ? Mar 12, 2015 14:53 |
|
|
# ? May 19, 2024 11:13 |
|
Calidus posted:Is there a good resource for using json, ajax and js with MVC and .Net? I have been doing some MVC development off and on but it was mostly bootstrap html/css for the views and c# on the back end. I feel kind stupid when i come across simple stuff like using json and an ajax get for cascading combo-boxes which would have made my life so much easier months ago. Ajax partial page post backs were also a eye opener. There has to be a resource with more stuff like this. My experience lately has been that the industry is moving away from ASP .NET MVC and more toward single-page applications using frameworks like angular or knockout, because "front end" is becoming its own sub-discipline with its own specialized developers and toolchain. I talk to a lot of different companies, and nearly every one working on a greenfield project is using angular/web API.
|
# ? Mar 12, 2015 15:11 |
|
Calidus posted:Is there a good resource for using json, ajax and js with MVC and .Net? I have been doing some MVC development off and on but it was mostly bootstrap html/css for the views and c# on the back end. I feel kind stupid when i come across simple stuff like using json and an ajax get for cascading combo-boxes which would have made my life so much easier months ago. Ajax partial page post backs were also a eye opener. There has to be a resource with more stuff like this. JSON, AJAX, and JS are going to be the same regardless of your backend technology. With ASP.NET, the easiest (and recommended) way to handle JSON is to use Web API. There are some decent tutorials on the ASP.NET website that will get you started.
|
# ? Mar 12, 2015 15:51 |
|
Does anybody have a way to test if a remote private MSMQ exists that I have minimal permission to (usually just peek). This code BSODs machines if I try and run it. I've tried multiple machines and multiple remote queues.code:
|
# ? Mar 12, 2015 16:07 |
|
Chill Callahan posted:Does anybody have a way to test if a remote private MSMQ exists that I have minimal permission to (usually just peek). This code BSODs machines if I try and run it. I've tried multiple machines and multiple remote queues. Have you already tried just using MessageQueue.Exists()? I don't have much MSMQ experience, but everything I've done so far has used that to check for existence of a queue before creating it. Seems weird that you're a BSOD though.
|
# ? Mar 12, 2015 16:41 |
|
zerofunk posted:Have you already tried just using MessageQueue.Exists()? I don't have much MSMQ experience, but everything I've done so far has used that to check for existence of a queue before creating it. Seems weird that you're a BSOD though. Unfortunately the MSDN documentation says that specifically doesn't work on remote private queues. quote:Exists(String) cannot be called to verify the existence of a remote private queue. E: I found the method GetPrivateQueuesByMachine("<machine-name">) which works. It correctly gets the queues and I can print out the queue names, but if I try and inspect a queue in VS then it BSODs my machine with ATTEMPTED EXECUTE OF NOEXECUTE MEMORY. Nonetheless I got what I needed, but it's still odd. Chill Callahan fucked around with this message at 16:57 on Mar 12, 2015 |
# ? Mar 12, 2015 16:45 |
|
So I was tasked with updating MonkeyWrench (A mono based build server) with support for Google Oauth2. Currently it uses OpenID, and since Google is getting rid of support for it (and because we auth with Google for our business accounts) they want to switch. Now, here are the problems with doing that. If you look through their source code, you can see that this:
We can't use the built in user account system, because it stores passwords in plain text. So we need to add something. We plan on leaving MonkeyWrench, so they don't want an "elegant" solution, Just something to use as a stopgap we can get off of it. But I'm not sure where to start, and no one else seems to have any ideas. If I want, I can retarget the app to a higher version of .Net, and I can use Nuget. But then I need to make sure I don't break any other part of the app in the process. . I'm tempted to just add a salt/hash to the password field and call it a day. Anyone have any ideas?
|
# ? Mar 12, 2015 20:04 |
|
Hey, Can any one point me to some useful articles on how to properly implement certificate pinning with HttpWebRequest? The application will distribute some pinset data with the application but I would also like to allow adding additional pinning data through a trusted url. My particular hangups are there seems to be a couple of different api hooks where you are able to validate a certificate and I'm wondering which ones I need to implement or all of them or what? The api hooks I'm talking about are: - ICertificatePolicy.CheckValidationResult - HttpWebRequest.ServerCertificateValidationCallback - HttpWebRequest.ServicePoint.Certificate - HttpWebRequest.ServicePoint.ClientCertificate What is the difference between these? xgalaxy fucked around with this message at 20:09 on Mar 12, 2015 |
# ? Mar 12, 2015 20:05 |
|
Drastic Actions posted:So I was tasked with updating MonkeyWrench (A mono based build server) with support for Google Oauth2. Currently it uses OpenID, and since Google is getting rid of support for it (and because we auth with Google for our business accounts) they want to switch. Time to do your username proud!
|
# ? Mar 12, 2015 20:09 |
|
Drastic Actions posted:MonkeyW[url=https://github.com/mono/monkeywrench/blob/7f20ae8d9562d0a18ac29aea9aeaba4352aa16a1/MonkeyWrench.Database/Extensions/DBLogin_Extensions.cs#L46]stores passwords in plain text. quote:// TODO: Encrypt passwords somehow, not store as plaintext. As least they're aware of their own silliness.
|
# ? Mar 12, 2015 21:45 |
|
Chill Callahan posted:Unfortunately the MSDN documentation says that specifically doesn't work on remote private queues. Ahh, sorry. Didn't check the documentation. I've only been working with local queues myself, so that hasn't been an issue. I can't even remember the last time I saw a BSOD. I might try testing that out tomorrow. I'll need to work with remote queues at some point soon although probably not private ones.
|
# ? Mar 12, 2015 21:50 |
|
Drastic Actions posted:I'm tempted to just add a salt/hash to the password field and call it a day. Anyone have any ideas? Abandon ship. You're already planning on leaving it... don't even try to enhance it. Your time would be better served getting a new build environment running and migrating off of that shitheap.
|
# ? Mar 12, 2015 21:57 |
|
epalm posted:As least they're aware of their own silliness. It also tells you when you're making an account that the passwords are stored in plain text. But it's not that hard to put basic encryption in there, and the fact it's been like this for years... EDIT: Ithaqua posted:Abandon ship. You're already planning on leaving it... don't even try to enhance it. Your time would be better served getting a new build environment running and migrating off of that shitheap. Now if you can convince Miguel de Icaza of this, that would be awesome. It has been a few days of banging my head against a wall of all the issues I have to overcome to somehow hack Oauth2 into something that won't support it without breaking everything else. I got a meeting with my boss tomorrow, so I'm gonna have to say I just can't do it. Not in any sane way. They got a month to get their poo poo over to another build system (I think they're going with Jenkins), so they'll live with plain text passwords. Drastic Actions fucked around with this message at 22:02 on Mar 12, 2015 |
# ? Mar 12, 2015 21:57 |
|
Bognar posted:JSON, AJAX, and JS are going to be the same regardless of your backend technology. With ASP.NET, the easiest (and recommended) way to handle JSON is to use Web API. There are some decent tutorials on the ASP.NET website that will get you started. MVC has like, a whole suite of Ajax helpers, I think. But yeah, I've been using Angular on new projects too.
|
# ? Mar 13, 2015 01:32 |
|
Another MVVM question: I have my View and View Model setup. With help from you guys my NotifyPropertyChanged is working like it should and commands work as they should. My XAML is binded dynamically and I have almost no code in the code behind files. So far so good you would say, but I have a hard time with the following: Now where does the model come into play? I have a big class that represents my model data. It is a hierarchical structure of data that represents one work item in our business. The ViewModel has extraneous properties like currently selected item and the like, this is not "business data" so I get why business data is stored in the model. But how do I update the model and make the viewmodel aware of the changes? Do I need to make InotifyPropertyChanged properties on the model? This would just make the ViewModel a proxy for the model without the extraneous properties? It feels like DB -> DAL -> DTO -> ViewModel all over again Unpacking classes and repacking them again. This does not seem right to me. Is there something I am missing? Mr Shiny Pants fucked around with this message at 09:07 on Mar 13, 2015 |
# ? Mar 13, 2015 09:02 |
|
Mr Shiny Pants posted:Another MVVM question: The 'model' in MVVM generally isn't a specific object as such, it's just the rest of your program not related to dealing with WPF. Mr Shiny Pants posted:The ViewModel has extraneous properties like currently selected item and the like, this is not "business data" so I get why business data is stored in the model. In my experience the viewmodel is what's telling the model to change (in response to viewmodel property changes, commands, etc.), so it can update itself according to the results of the model changes. If this ends up making your viewmodels too complex then you can introduce controller classes to coordinate between the model and viewmodel, making a kind of MVCVM.
|
# ? Mar 13, 2015 09:34 |
|
ninjeff posted:In my experience the viewmodel is what's telling the model to change (in response to viewmodel property changes, commands, etc.), so it can update itself according to the results of the model changes. If this ends up making your viewmodels too complex then you can introduce controller classes to coordinate between the model and viewmodel, making a kind of MVCVM. This sounds reasonable. Thanks.
|
# ? Mar 13, 2015 09:42 |
|
Does anyone know--- if you call a method that does ADO.NET stuff, from inside a 'using x as TransactionScope' block, does the stuff in the called method get done within the transaction scope too? e: Looks like yes. chippy fucked around with this message at 10:35 on Mar 13, 2015 |
# ? Mar 13, 2015 10:10 |
|
How do I learn .NET as fast as possible? I have a job interview next week
|
# ? Mar 13, 2015 13:24 |
|
Boz0r posted:How do I learn .NET as fast as possible? I have a job interview next week Write some code. It would also help if you specified a language -- the advice for someone learning F# or PowerShell is going to be a lot different than if you're learning C#. .NET is just a framework, there are a ton of languages built on top of it.
|
# ? Mar 13, 2015 13:41 |
|
I think it's going to be C#.
|
# ? Mar 13, 2015 14:27 |
|
Boz0r posted:I think it's going to be C#. There really isn't a way to learn the entire .net framework in a week. Do you know Java at least?
|
# ? Mar 13, 2015 14:53 |
|
Yeah. I know C# too from programming in Unity3D. I'm just got my master's in computer science, so I'm into all that OOP and poo poo, so I just need a quick and dirty version, I think.
|
# ? Mar 13, 2015 14:55 |
|
Boz0r posted:I think it's going to be C#. What are you doing with it though? Web development? WinForms? WPF? WinRT?
|
# ? Mar 13, 2015 14:57 |
|
I would check out the content at http://www.microsoftvirtualacademy.com/ to at least start getting your feet wet.
|
# ? Mar 13, 2015 15:00 |
|
Drastic Actions posted:What are you doing with it though? Web development? WinForms? WPF? WinRT? I think it's going to be web service, WinForm and WPF. Dietrich posted:I would check out the content at http://www.microsoftvirtualacademy.com/ to at least start getting your feet wet. I watched a video there but I found the hosts unbearable. Maybe I should give it another shot, though.
|
# ? Mar 13, 2015 15:07 |
|
Boz0r posted:I think it's going to be web service, WinForm and WPF. Oh, the hosts are terrible. Content is good though.
|
# ? Mar 13, 2015 15:29 |
|
My ASP.NET/razor app lets users save and display messages. When a user saves a message, it contains newlines (the input is a multi-line textarea). When I want to display the message, I want to replace "\n" with "<br/>" so the message shows newlines (breaks) in html. But I don't want the whole message to be raw html, because I don't want users to save messages with iframes/divs/spans/etc. How do I partially html-ify a string? Edit: I guess I can split the string on "\n" and join it back together again in html pieces. "Hello\nWorld" => <span>Hello</span><br /><span>World</span> epswing fucked around with this message at 16:17 on Mar 13, 2015 |
# ? Mar 13, 2015 16:07 |
|
epalm posted:My ASP.NET/razor app lets users save and display messages. When a user saves a message, it contains newlines (the input is a multi-line textarea). When I want to display the message, I want to replace "\n" with "<br/>" so the message shows newlines (breaks) in html. But I don't want the whole message to be raw html, because I don't want users to save messages with iframes/divs/spans/etc. Is storing it as Markdown an option?
|
# ? Mar 13, 2015 16:14 |
|
epalm posted:My ASP.NET/razor app lets users save and display messages. When a user saves a message, it contains newlines (the input is a multi-line textarea). When I want to display the message, I want to replace "\n" with "<br/>" so the message shows newlines (breaks) in html. But I don't want the whole message to be raw html, because I don't want users to save messages with iframes/divs/spans/etc. You could use the white-space CSS property: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space. You probably want pre, pre-line, or pre-wrap. Bognar fucked around with this message at 16:36 on Mar 13, 2015 |
# ? Mar 13, 2015 16:25 |
|
Dr. Poz posted:Is storing it as Markdown an option? This is probably The Right Thing To Do (tm). Bognar posted:You could use the white-space CSS property: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space. You probably want pre, pre-line, or pre-wrap. 404! E: Oh it's just the period at the end. This works in the interim: code:
|
# ? Mar 13, 2015 16:27 |
|
You could also just squirt the string into a https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code
|
# ? Mar 13, 2015 16:39 |
|
Mr Shiny Pants posted:Another MVVM question: If you implement IDataErrorInfo on your viewModel, you can instance your model in your viewModel and then in your validation handling of your viewModel you would set your models properties after doing UI validation. If you want to do further business validation on your model, you can implement IDateErrorInfo on your model and then make a call to that validation after your UI validation completes. Straight forward example from the champ himself: https://joshsmithonwpf.wordpress.com/2008/11/14/using-a-viewmodel-to-provide-meaningful-validation-error-messages/
|
# ? Mar 13, 2015 16:45 |
|
Boz0r posted:Yeah. I know C# too from programming in Unity3D. I'm just got my master's in computer science, so I'm into all that OOP and poo poo, so I just need a quick and dirty version, I think. If you know programming but want to learn what makes C# standout I suggest C# In Depth. It goes over all of the changes in .NET 2/3/4/4.5 (generics, LINQ, async/await) which is what makes .NET standout from Java/C++. It also goes into a lot of the things that can be odd unless someone told out like LINQ being lazy evaluated. As far as learning WinForms, WCF, WebForms, MVC, Web API, etc. you are screwed but the employer knows that. Also, the Microsoft Virtual Academy has some hit or miss classes. I wouldn't dismiss all of them if you didn't like the one you saw.
|
# ? Mar 13, 2015 17:11 |
|
General WPF/MVVM question! I've made some decent applications which are pretty much devoted to WPF and no other 'View' framework. I know for Dialogs "NavigationServices" for Web/MVC are typically used. To simplify my development and avoid using reflection when handling confirmation dialogs and such, I've taken to just using parameters in my view models when responding to dialog commands. My view passes itself as a parameter on a command I specify so that the "owner" of the new dialog can be determined without reflection. This requires I specify: In XAML: code:
code:
I'm thinking about implementing an IDialogService<TOwnerBase> which would allow me to handle various types and not just WPF/WinForms Windows. My new service class would be a WpfDialogService which inherits IDialogService<System.Windows> and injected into the VM So the Command in my VM would get type injection and change to something akin to: code:
actual command code might be something like: code:
At least that's my thought... Haven't got around to doing anything yet. I'm wondering if it's better to keep ViewModels coupled more towards frameworks (WPF, etc..) building a new set of VMs for each different 'View' framework and not worry about it? OR should I have a single ViewModel which can work in Wpf/WinForms/ASP.NET whatever??? How is this handled normally when you want to swap out or add multiple UIs in a 'small' application?
|
# ? Mar 13, 2015 20:38 |
|
For Asp.net WebAPI and getting JSON as input (with whatever SPA framework you want), it's both painless and painful to receive data from the client. You could let the framework handle it: code:
code:
|
# ? Mar 13, 2015 21:32 |
|
crashdome posted:... I really like this approach (and think something like it should have been in WPF by default): http://www.codeproject.com/Articles/35553/XAML-Dialog-Control-Enabling-MVVM-and-Dialogs-in-W You define a dialog in XAML, then control opening it through a binding to your ViewModel. That said, in my current Xamarin application that uses the MVVM pattern, I have an IDialogService with async Alert() and Confirm() methods. The implementation of the interface is different for each platform (iOS, Android, WinPhone). However, those dialogs don't require an owner so I haven't quite run into your problem.
|
# ? Mar 13, 2015 21:34 |
|
Captain Capacitor posted:Or get fancy and let the DLR work some magic. I would argue this is less fancy and more detrimental to the maintainability of your application.
|
# ? Mar 13, 2015 21:38 |
|
crashdome posted:I'm wondering if it's better to keep ViewModels coupled more towards frameworks (WPF, etc..) building a new set of VMs for each different 'View' framework and not worry about it? OR should I have a single ViewModel which can work in Wpf/WinForms/ASP.NET whatever???
|
# ? Mar 13, 2015 21:47 |
|
|
# ? May 19, 2024 11:13 |
|
Sedro posted:Generally speaking, the purpose of the view-model/controller is to translate your (e.g. pre-existing, domain-specific) model into a form which is easily consumable from a given UI technology. So yes, it would be normal to have different view-models. That's what I figured. So many opinions flying around about MVVM it's hard to stay grounded sometimes to the root ideas. Bognar posted:I really like this approach (and think something like it should have been in WPF by default): I will read this. It will definitely come in handy. Thanks!
|
# ? Mar 13, 2015 23:59 |