|
Howmuch posted:Thanks for the explanation and the link. So you could reserve the namespace during install, when admin permissions might already be required, or bundle a separate script or application that can do it. That way your actual program won't need admin access.
|
# ? Nov 20, 2012 20:18 |
|
|
# ? May 30, 2024 12:48 |
|
I'm considering writing a windows service to use a web client to warm a IIS site up after the app pool recycles on a timed basis. I'm pretty sure something like that exists somewhere already. Anyone have a lead for me?
|
# ? Nov 20, 2012 20:22 |
|
Ithaqua posted:I disagree about the dynamic SQL thing. I think it makes code a lot uglier and less maintainable. Well, sure. I pretty much write everything in Linq these days, for EF. But sometimes (increasingly rare) I still need to build some SQL. I'm sure it could even make code easier to read in places, instead of abusing the poo poo out of reflection and what have you.
|
# ? Nov 21, 2012 00:32 |
|
I'm not sure how tolerant you guys are with Stupid Newbie Questions, but I am troubled and I wish to share. While I've been working on other parts of my little project, earlier I managed to get my listview working with a databind in XAML. It was a good day, but there is a dark secret to the code. code:
code:
code:
extra horror: var id = ((ObservableCollection<listVideo.VideoData>)(listVideosView.SelectedItems)[0])[0].ID; User0015 fucked around with this message at 00:48 on Nov 21, 2012 |
# ? Nov 21, 2012 00:45 |
|
It looks like you're not using a separate view model, in which case you're doing things the Wrong Way. I'm interpreting your intention as this: whenever the user changes their selection in a ListBox, a TextBox updates with the content of what they've selected in some way. The way to do this properly is by binding your ListBox to a property in your view model, binding your TextBox to a property in your view model, and then rigging up the setter for the ListBox-bound property to update the TextBox-bound property so that whenever the former changes the latter does as well. I think, anyway. I'm pretty new to WPF myself.
|
# ? Nov 21, 2012 01:01 |
|
I'd prefer to stay out of view model stuff, for now. That will come later. Keep in mind there's two possibly important things here: There's multiple columns of data (and I want just one column of info), and there is a DirectoryInfo object watching the folder itself, so the listview can change either by the user, or if a file changes in the directory. Part of the code there is handling the case where the user has a file selected that is then deleted, for example. Forgot to add: I attempted to do something stupid simple earlier. A generic object with just those 3 Parameters (or whatever). This worked, except it was showing up as blank on the list view itself. I posted that problem here, and Ithaqua said "override your ToString" which I did. Except I needed it to spit out Filename in column 1, Status in column 2, etc....and I couldn't figure out how to separate the columns and the parameters. User0015 fucked around with this message at 01:24 on Nov 21, 2012 |
# ? Nov 21, 2012 01:21 |
|
User0015 posted:I'd prefer to stay out of view model stuff, for now. That will come later. User0015 posted:Even extra bonus points if there's a really simple approach to doing this that is completely different than mine and would have taken 5 minutes.
|
# ? Nov 21, 2012 01:36 |
|
I'm worried digging into view model stuff won't be a 5 minute thing, but another hurdle that will take a long time to learn. I have so much I need to get up to speed with already, I really hate to add another thing on top of it. That's all. Especially if it isn't strictly necessary and there's other ways to do it in 5 minutes.
|
# ? Nov 21, 2012 01:42 |
|
Dietrich posted:I'm considering writing a windows service to use a web client to warm a IIS site up after the app pool recycles on a timed basis. Modern versions of IIS have some app warmup plumbing, see http://blogs.iis.net/thomad/archive/2009/10/14/now-available-the-iis-7-5-application-warm-up-module.aspx for an intro. I have not used it myself so I can't add anything meaningful. @User0015: use the model view stuff. It seems like double work on the surface, but the truth of it is you are being much more ornithological. Model binding is one problem. Updating the database is another problem. They have strange conflicts the way ASP.NET MVC and .NET ORMS are implemented.
|
# ? Nov 21, 2012 01:53 |
|
User0015 posted:I'm worried digging into view model stuff won't be a 5 minute thing, but another hurdle that will take a long time to learn. I have so much I need to get up to speed with already, I really hate to add another thing on top of it. That's all. Especially if it isn't strictly necessary and there's other ways to do it in 5 minutes. The big problem with WPF is that it doesn't let you fall into pit of success and gives you enough rope to hang yourself with. Where ASP.NET MVC forces you to do the "right thing" (MVC pattern) and makes it really hard to do the "wrong thing" like put data access code in your web page. The correct path for WPF is doing MVVM even if the tooling and language doesn't point you in that direction. It is the correct path and will remove all of that nasty code through data binding. gariig fucked around with this message at 02:07 on Nov 21, 2012 |
# ? Nov 21, 2012 02:05 |
|
Dietrich posted:I'm considering writing a windows service to use a web client to warm a IIS site up after the app pool recycles on a timed basis. This do the trick? http://www.iis.net/downloads/microsoft/application-initialization
|
# ? Nov 21, 2012 02:19 |
|
User0015 posted:I'd prefer to stay out of view model stuff, for now. That will come later. C# code:
C# code:
XML code:
|
# ? Nov 21, 2012 02:19 |
|
Hmm. What would the structure of the project look like? Are each of these classes just a separate file? Are they included somewhere specifically?
|
# ? Nov 21, 2012 02:29 |
|
User0015 posted:Hmm. What would the structure of the project look like? Are each of these classes just a separate file? Are they included somewhere specifically? Read this: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
|
# ? Nov 21, 2012 02:46 |
|
uXs posted:Well, sure. I pretty much write everything in Linq these days, for EF. But sometimes (increasingly rare) I still need to build some SQL. My dynamic SQL aversion is probably because in the Dark Ages of 2008, I worked for a place that had a rule: No in-line SQL, anywhere, ever. Stored procedures only. So I ended up with some truly butt-ugly stored procedures, but at least my code was nice and clean. Have you ever felt like you needed to unit test your SQL?
|
# ? Nov 21, 2012 04:16 |
|
Yup. Done it with home rolled ORMs, no ORMs and with "real ORMs" These days my data access strategy is: * RavenDb (seriously gently caress sql and schemas) * [smaller scale, fixed inputs / outcomes] : Dapper * [larger scale, not so fixed inputs] : EF code first
|
# ? Nov 21, 2012 14:10 |
|
Ithaqua posted:My dynamic SQL aversion is probably because in the Dark Ages of 2008, I worked for a place that had a rule: No in-line SQL, anywhere, ever. Stored procedures only. So I ended up with some truly butt-ugly stored procedures, but at least my code was nice and clean. Well, your C# code may have been nice and clean, but SQL code is still code. It's like saying your room is clean while your closet is full of rats and dead pigeons. And poo poo. As for unit testing: I only really started to unit test very recently, after I switched to EF. So there's basically no SQL code anyway. And if there was, I'd probably just use integration tests. (Which is what I do for the really low level EF code too.)
|
# ? Nov 21, 2012 16:09 |
|
^^^ I generally argue that anything using these magic linq containers really needs unit tests to at least force the linq to generate the SQL successfully. You can do lots of things that will compile, do just fine in linq to objects and then crash magic sql generators hard. The nightmarish part of unit testing database stuff is when you have data you care about in some way shape in form. If you are just testing the schema build + your magic sql generator then you are in better shape than most.
|
# ? Nov 21, 2012 17:02 |
|
wwb posted:^^^ I generally argue that anything using these magic linq containers really needs unit tests to at least force the linq to generate the SQL successfully. You can do lots of things that will compile, do just fine in linq to objects and then crash magic sql generators hard. I just did a project using nHibernate, which can be a huge pain in the rear end to get mappings set up correctly. I used Sqlite as my integration test database, and still bumped into some weird issues. For example, I needed to do a query that grouped up the year/month. It's hair-pullingly frustrating to do that with nHibernate, so I ended up giving it a sql fragment to group on. It turns out Sqlite doesn't support YEAR() and MONTH() functions.
|
# ? Nov 21, 2012 17:13 |
|
This is probably more of just me being dumb, but here goes anyway. In doing some post-deployment tweaking between one project and the next, I want to find out all ways I can improve performance (or, in this case, user's perceived performance). I've done some really good refactoring in the data access layer, and cleaned up my models, controller, and view models. Now I want to see if I can shave off any more precious milliseconds. We have several Partial Views that are nested within divs on one View (and then made pretty with jQuery tabs), as such: code:
Just looking for some ideas at this point, and it's not like it's business critical, but I figured if anyone would know, it's you guys (and asking this question validates my justification to have the forums unblocked by our new web filter since I use them for 'business purposes')
|
# ? Nov 21, 2012 17:25 |
|
This definitely applies to nhibernate too. If I am going through the pain of testing against a real live database, I would definitely test against at least a family member of what is in production. I never understood the fascination of using sqllite as a test bed, might as well use sql express. Note this also applies to ravendb -- the embedded version can see things the server can't, seen lots of code that seems briliant in local tests that dies when talking cross-process.
|
# ? Nov 21, 2012 17:29 |
|
aBagorn posted:I want to find out all ways I can improve performance First: Profile the application. Use ANTS or the built-in VS profiler.
|
# ? Nov 21, 2012 17:33 |
|
Ithaqua posted:First: Profile the application. Use ANTS or the built-in VS profiler. We're getting a version of ANTS before the calendar year is over But no VS Profiler though, we're only on Professional aBagorn fucked around with this message at 17:38 on Nov 21, 2012 |
# ? Nov 21, 2012 17:35 |
|
aBagorn posted:We're getting a version of ANTS before the calendar year is over You should be able to use AJAX.RenderPartial. Hack around at it a little bit. What's with the ugly @{HTML.RenderAction("foo");} stuff, anyway? Those curly braces are redundant, and removing them will make the semicolon redundant too.
|
# ? Nov 21, 2012 17:42 |
|
Ithaqua posted:You should be able to use AJAX.RenderPartial. Hack around at it a little bit. @Html.Action("foo") returns MvcHtmlString and can be called without braces/semicolon @Html.RenderAction("foo") returns void and needs the braces/semicolon (I think they are functionally equivalent in this case.
|
# ? Nov 21, 2012 17:59 |
|
User0015 posted:Hmm. What would the structure of the project look like? Are each of these classes just a separate file? Are they included somewhere specifically?
|
# ? Nov 21, 2012 18:14 |
|
So I've created a web app in Visual Web Developer 2010 that uses a database and want to pull data out of that database with a C# app I'm making. The problem is that Web Developer only supports SQL Compact 4.0 and Visual C# only supports SQL Compact 3.5. They are not forward or backward compatible. How the gently caress do I do this because I'm about to burn Redmond to the ground.
|
# ? Nov 21, 2012 19:28 |
|
Ithaqua posted:You should be able to use AJAX.RenderPartial. Hack around at it a little bit. It's because the method writes directly to the response stream. I haven't messed around with MVC much lately but I think there are cleaner equivalents now that actually return IHtmlStrings and don't introduce confusing use cases, as noted.
|
# ? Nov 21, 2012 19:32 |
|
BiohazrD posted:Visual C# only supports SQL Compact 3.5. That's not true. What version are you talking about? http://blogs.msdn.com/b/sqlserverco...s-2010-sp1.aspx
|
# ? Nov 21, 2012 19:32 |
|
Ithaqua posted:That's not true. What version are you talking about? I'm using Express unfortunately, which doesn't have SP1. I can grab a license for the real deal if I have to, or try Express 2012.
|
# ? Nov 21, 2012 19:44 |
|
BiohazrD posted:I'm using Express unfortunately, which doesn't have SP1. That is also not true. VS 2010 Express has the exact same SP1 as every other version of VS 2010. aBagorn posted:But no VS Profiler though, we're only on Professional If you can upgrade to 2012, 2012 Pro does include the profiler. Zhentar fucked around with this message at 22:49 on Nov 21, 2012 |
# ? Nov 21, 2012 22:47 |
|
WCF question hoping you all can help me with. I think I know the answer I just want some internet confirmation here. Say I have a data contract like this code:
Kind of confirming how I'm going to handle fault contracts, but also derived types.
|
# ? Nov 22, 2012 08:13 |
|
Is there a significant performance difference loading a workflow activity from XAML versus defining it entirely in code?
|
# ? Nov 22, 2012 09:43 |
|
aBagorn posted:This is probably more of just me being dumb, but here goes anyway. Don't use Actions. In your situation, where you aren't passing anything in to each action and require a specific order to things, you'd probably be better off processing it all together and then calling it as Partials. e.g. Controller code:
code:
|
# ? Nov 22, 2012 10:32 |
|
Just a heads up, Mindscape is having a Black Friday sale, where the price increases by $1 every time they make a sale. I just bought WPF Elements for $151, so now it costs $152 (retails for $799). http://www.mindscapehq.com/black-friday-2012
|
# ? Nov 22, 2012 15:23 |
|
adaz posted:WCF question hoping you all can help me with. I think I know the answer I just want some internet confirmation here. My WCF is a little rusty, but that should work just fine. You can assign an ArgumentNullException to a property of type Exception. Of course, in my view, an exception that occurs within your WCF service should be handled within your WCF service. You can certainly notify the caller that something went wrong, but the caller shouldn't necessarily be concerned with the exact nature of the problem, especially if it's something that the caller has no control over and can't possibly recover from. I'd probably just end up having the result be something along these lines: code:
Meanwhile, on the service side, you can catch and handle your actual exceptions however you want, including logging full stack traces and other relevant information that's totally useless from the perspective of the caller.
|
# ? Nov 22, 2012 16:54 |
|
In case anyone is curious, I finally had a chance last night to test my Silverlight 5 Out Of Browser app on a MAC and it works! Had no issues accessing the file system, copying files, creating directories, renaming files etc. For the record that's 1 application, 1 code base, works on both PC and MAC with full local file system access.
|
# ? Nov 22, 2012 17:23 |
|
Ithaqua posted:My WCF is a little rusty, but that should work just fine. You can assign an ArgumentNullException to a property of type Exception. Oh sure, but there are occasions when I'd like to let a client know more about the exception (for centralized logging purposes as an example) than just a general fault type message which I why I was asking. Also, having a derived class and knowing if it can be serialized is a fairly common scenario. Not that I don't believe you Ithaqua - your advice tends to be stellar and on point - but I went and looked this up on msdn and found the section. Assuming I'm reading it right you in fact cannot send a derived type without using the Known Type attribute: http://msdn.microsoft.com/en-us/library/ms734767(v=vs.100).aspx unless I am reading this completely wrong! msdn posted:A data contract from a derived class can be sent when a data contract from a base class is expected, but only if the receiving endpoint "knows" of the derived type using the KnownTypeAttribute. For more information, see Data Contract Known Types. In the previous example, an object of type Employee can be sent when a Person is expected, but only if the receiver code employs the KnownTypeAttribute to include it in the list of known types. Ithaqua posted:I'd probably just end up having the result be something along these lines: This is actually an interesting idea. Essentially going back to the age old do you want exceptions (fault contracts in WCF terminology) or like result codes as you propose. I'm not a huge fan of using exceptions to handle every known error, and I think I like your approach much better than a fault contract. Or, more precisely, use this when at all possible but still define a fault contract for true exceptions like can't communicate with endpoint type of things. e: Also somewhat random but I cam across this nice link on SQL Query optimization. I'm not a DBA and try to avoid directly touching SQL when at all possible (thanks to you folks and your push of entity framework ) but like a lot of folks I end up doing more of it than I'd like. Good blog post on just the basics of query optimization and stuff if you're using MS SQL Server: http://blogs.msdn.com/b/karthick_pk/archive/2012/11/22/tuning_2d00_sql_2d00_server_2d00_query.aspx adaz fucked around with this message at 23:13 on Nov 22, 2012 |
# ? Nov 22, 2012 23:09 |
|
Is there anyway to use expression blend to simply add new and edit existing brushes defined in a resource dictionary? I have never used expression blend, and i really don't want to manually create all of the brushes by hand. If i open the project in expression blend (which takes forever), i can see the existing brushes under the resource tab, however it doesn't seem to let me add new ones.
|
# ? Nov 23, 2012 04:13 |
|
|
# ? May 30, 2024 12:48 |
|
I'm finally getting around to working on my project that uses MVC and MVVM for WPF with some shared code. I had previously asked about how to separate the project logically and am going for something like: Project.Web.View Project.Web.Controllers Project.Client.View Project.Client.ViewModels Project.Model Project.Data Project.Tests.Unit I have this mostly set up. I made the Controllers project a class library, but when I moved my controllers to this project, I lose the ability to scaffold views from a controller via right click. Did I setup the project wrong or is there another way to maintain this functionality? Additionally, since I'm also new to Entity Framework, I wasn't sure which code went into Data vs Model in the above project structure. Would models only hold the basic model classes that inherit DbContexts and then the Data project house interfaces and classes with virtual properties that represent the data from the model? Getting slightly confused on this part. Is this unnecessary separation or call all of that go in Models and I don't need a separate Data project? Screenshot of how I have it so far: Uziel fucked around with this message at 21:01 on Nov 24, 2012 |
# ? Nov 24, 2012 19:00 |