|
Good to hear. What is the modern state of getting a nice-looking WPF app off the ground without major design effort? I remember there being some issues with the default visuals being rather bland and few meaningful 3rd party themes being available some years ago when I last used WPF. Has this improved?
|
# ? Jan 19, 2015 21:09 |
|
|
# ? Jun 6, 2024 16:27 |
|
EssOEss posted:Good to hear. What is the modern state of getting a nice-looking WPF app off the ground without major design effort? I remember there being some issues with the default visuals being rather bland and few meaningful 3rd party themes being available some years ago when I last used WPF. Has this improved? Hari replied: We have not done any new out of box themes. We have added support for Windows 8.1 with a new Aero2 theme that is enabled when you are running on 8.1. Hope that helps.
|
# ? Jan 19, 2015 22:20 |
|
ljw1004 posted:[plug] The WPF team wants to get the message out about work they're doing for WPF. In this case, they've brought the XAML-performance-analysis tools from WinRT XAML (VS2013) to also now work with desktop WPF XAML (VS2015 CTP5): Neat! I'm always glad to hear that WPF is still being worked on (it being the one true .NET desktop framework and all). While we're on the topic, is the WPF team planning to add any quality of life stuff? For me, it's nothing major, but in every WPF project I seem to always end up re-implementing certain classes that I feel should be provided by the framework. For example: C# code:
http://stackoverflow.com/a/3128498/957673 There are a few others that I always end up using, but I can't think of them now since I haven't done a WPF project in a while.
|
# ? Jan 20, 2015 16:07 |
It always did seem a little silly to me that there weren't basic, pre-built implementations of INotifyPropertyChanged and ICommand included with WPF. There's plenty of reasons to want to build your own, but it's annoying to have to write a class implementing each in every WPF project I work on. There's plenty more that I implement in every project, but I can't imagine a proper WPF project that didn't use either of those. I''m sure there is some justification of this, but it just seems odd to me.
|
|
# ? Jan 20, 2015 16:51 |
|
What WPF needs is improvements to make easier those little things that it tends to make harder. Want a modal dialog with MVVM? Go gently caress yourself. View model binding from a context menu? Not a chance. Bind to selected item on a tree view? Nope. Also, doesn't it still use some old outdated XAML version?
|
# ? Jan 20, 2015 18:55 |
|
I want to be able to use OneWayToSource bindings with read-only dependency properties.
|
# ? Jan 20, 2015 19:38 |
|
Hell, I'd just like it if events could bind directly to view-model without needing code-behind shenanigans. Seriously, how has that not been addressed in the ~eight years of WPF? I mean, yeah, there's triggers (if you know about them, and if you include an additional DLL with your project, and if you do a bunch of additional boilerplate code to make it happen) but seriously, events are already supported and a major part of C#. Why not take what's already there and make it intuitive? In essence, this: Inverness posted:What WPF needs is improvements to make easier those little things that it tends to make harder... Blasphemeral fucked around with this message at 20:11 on Jan 20, 2015 |
# ? Jan 20, 2015 20:09 |
|
Figured I would crosspost this here in case any of you have some suggestions. I'm running out of ideas and I have a feeling this is due to something lacking in the cmdlets for forcing NTLM authentication, and writing a wrapper for cURL isn't going to be a feasible solution. http://stackoverflow.com/questions/27975936/new-webserviceproxy-failing-to-authenticate-with-ntlm
|
# ? Jan 20, 2015 20:34 |
|
I'm making WebAPI controllers. Right now, our routing is done in the "{controller}/{action}/{id}" style. One pathing that is now desired in one case is: What They Want posted:Foo/{FooId}/Bar/ Is there any way to do this? Should I? Why not just do "Foo/Bar/{FooId}"?
|
# ? Jan 20, 2015 20:36 |
|
As far as whether you should, APIs like this are pretty commonpre:GET /posts fetch all posts GET /posts/16 fetch specific post #16 GET /posts/16/comments fetch all comments for post #16 GET /posts/16/comments/7 fetch specific comment #7 for post #16
|
# ? Jan 20, 2015 21:18 |
|
Just stumbled onto attribute routing, so there's that.
|
# ? Jan 20, 2015 21:53 |
|
Space Whale posted:Is there any way to do this? Should I? Why not just do "Foo/Bar/{FooId}"? Just use attribute based routing. This is exactly what it was made for. ^ e;fb
|
# ? Jan 20, 2015 21:55 |
|
So, where's the HoloLens SDK? And does it work on .Net?
|
# ? Jan 21, 2015 20:56 |
|
I'm getting a pretty generic error from connecting to a MSSQL server with my web app so I thought I'd pick youse guys' brains to see if anyone's come across it before. The error is: Exception message: [DBNETLIB][ConnectionRead (recv()).]General network error. Check your network documentation So googling around leads me to a lot of bitching about how generic and unhelpful it is but not much for remediation. This is the scenario: There is a development server called ServerB that runs a web app. There are scheduled tasks that kick off every (interval) that cause ServerB to query an MSSQL 2008R2 server over OpenVPN (ServerA), take that query and turn it into XML. The event occurs in ServerB's event log, but I can't find sign of any matching problem in ServerA's event log. Most of the troubleshooting I've seen around this is saying check cables, check network cards, etc. but this setup has been running smoothly for months now, and I doubt any physical/network infrastructure events have occurred since this started happening (Monday). The one thing I did read that kind of made sense was suggesting bad re-use/recyles of connections (near the end, ignore that it's a Delphi question): http://stackoverflow.com/questions/10755560/auto-recover-when-dbnetlib-connectionwrite-general-network-error-causes-ado-conn So the way we do these database calls is a general function in a 'helper' file that is structured like so (for those worried about injection/etc. this thing is locked down to only accept connections from the OpenVPN connection): code:
code:
Anyone run into this or have any insight? Lastly, here's the detailed text from the event: Thread ID: 7 Thread account name: IIS APPPOOL\buttesbackend Is impersonating: False Stack trace: at System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr) at System.Data.OleDb.OleDbDataReader.GetRowHandles() at System.Data.OleDb.OleDbDataReader.ReadRowset() at System.Data.OleDb.OleDbDataReader.Read() at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) (line numbers and file names removed)
|
# ? Jan 22, 2015 00:53 |
|
Scaramouche posted:So the way we do these database calls is a general function in a 'helper' file that is structured like so (for those worried about injection/etc. this thing is locked down to only accept connections from the OpenVPN connection): Locking down connections to your SQL Server won't stop injection attacks. What kind of hardware are these two servers running on? Are they on the same LAN or are they in different countries? How often do you see this error? There's a lot of blabber on the internet about SNP (Scalable Networking Pack) in Windows Server that can cause problems with dropped packets under high load if the network cards aren't up to snuff. In any case, if this happens intermittently and your servers aren't on the same LAN (or are hosted on VMs), it could be a transient network error. You could trying adding some retry logic in your Execute method.
|
# ? Jan 22, 2015 02:46 |
|
I would strongly suspect network issues -- such as saturation -- here. I've seen this sort of thing and every time it traced back to either flaky network hardware or network saturation. That was a little more impressive in some of these cases but I'd suspect it would not take much to saturate one side of this open vpn connection. Unfortunately Sql Server's native protocol isn't the greatest at crossing WANs and tends to error out rather than retry a-la-http. I would architect around the problem -- one thought would be to expose sql server's http interface and then have the app communicate with that. Http should be able to deal with network issues sql's binary protocol can't and you'd still get XML at the other end. PS: why oledb? I'd use the native drivers as they might be more bulletproof there.
|
# ? Jan 22, 2015 03:05 |
|
Scaramouche posted:DB Connection error I noticed you create a new connection and other ADO objects every time you connect. I set up a connection pool (we have multiple databases) and reuse oledbconnection objects. I am not sure which is better, as I am in no way an expert in how ADO works. If you have access to your database server and a copy of SSMS, check the activity monitor for excess connections and/or other activity in excess. I am too familiar with that error message, even in my VB6 apps. It almost always means something wrong with either the user's network connection, or the database server it's self.
|
# ? Jan 22, 2015 22:03 |
|
mastersord posted:I noticed you create a new connection and other ADO objects every time you connect. I set up a connection pool (we have multiple databases) and reuse oledbconnection objects. I am not sure which is better, as I am in no way an expert in how ADO works. Don't do this. ADO.Net is already doing connection pooling. The only reason to do your own object pooling is if you are having trouble with GC and creating/destroying a new object is too expensive (generally not). A "General network error. Check your network documentation" is something of a legend. Every person who has solved this has a different way. I think Richard Campbell from .NET Rocks/Runas Radio once said it was a bad keystone jack. You can check out Polly about handling and retrying because of the transient error
|
# ? Jan 22, 2015 22:15 |
|
Thanks for all the good info guys; I figured it was something like that (incredibly generic error) that some of you had come across before. Some answers to people's questions: The server info: ServerA - Actually a repurposed desktop sitting under my desk, all it does is generate XML; it's not public facing or anything, just has scheduled tasks fire off that make calls into web pages. So basically it's running IIS and that's it. Q6600 @ 2.4 GHz processor and 4gb of RAM. ServerB - Oldass Dell rack server we're in the process of clouding out. Runs IIS and MSSQL. Xeon 2 quadcore 3.2 GHz 8gb RAM. Location: ServerA is in the office, and ServerB is in the colocation facility about 20 kilometers away; they are not in the same LAN. ServerB is running an OpenVPN listener that ServerA connects to. Error frequency: About once or twice a day, usually first thing in the morning (which makes sense because that's when XML is being generated). OLEDB vs Native: Haven't even thought of it to tell the truth. Is there somewhere that lists the differences between them? Activity Monitor: This is a Good Thing that I forgot about. Problem being, I'm not 100% sure on how read the results. I'm currently concentrating on 'Recent Expensive Queries'. There's one with a plan count of 13,000 which seems high; it's basically a proc that goes 'SELECT * FROM Product WHERE Productid=@Productid' to help build and XML file about products (about 100,000 products).
|
# ? Jan 22, 2015 23:25 |
|
If you've got IIS on server B I'd just push the app over there and eliminate the network angle. Keep Fowler's 1st law in mind.
|
# ? Jan 23, 2015 00:43 |
|
wwb posted:If you've got IIS on server B I'd just push the app over there and eliminate the network angle. Keep Fowler's 1st law in mind. That's actually what it was like originally, but was causing load problems because ServerB is a full blown web server handling tens of thousands hits a day. The 'brute' crunch was string handling, not database operations, so I moved t hat off to ServerA.
|
# ? Jan 23, 2015 02:03 |
|
gariig posted:Don't do this. ADO.Net is already doing connection pooling. The only reason to do your own object pooling is if you are having trouble with GC and creating/destroying a new object is too expensive (generally not). Seconding this. Don't pool your own OleDbConnections, it's a waste of time and effort. Also, if you're having trouble with GC (and you're almost assuredly not), OleDbConnections are not going to be the cause of your problems.
|
# ? Jan 23, 2015 05:10 |
|
This is more a Visual Studio question than a .net question, but this seems the closest place to ask. Is there a way to add C as a project type to VS2013? My Intro OS-es class is taught in C and I don't really want to give up my IDE creature comforts to code in Vim or Notepad++ or something. That was enough of a bitch doing basic stuff in Java and I'd rather devote my limited time/brainspace to learning the actual material than loving around debugging things and syntax-tweaking without a good IDE.
|
# ? Jan 23, 2015 05:45 |
LeftistMuslimObama posted:This is more a Visual Studio question than a .net question, but this seems the closest place to ask. I don't know about project types but if you create an empty C++ and add *.c files instead of *.cpp they are supposed to be compiled as C.
|
|
# ? Jan 23, 2015 05:51 |
|
Under "Code Generation" you can also just set the whole project to be compiled as C. And make sure you create an "Empty project," or else a bunch of other stupid garbage will be included.
|
# ? Jan 23, 2015 05:54 |
|
Shy posted:I don't know about project types but if you create an empty C++ and add *.c files instead of *.cpp they are supposed to be compiled as C. ed tablet posting' still betting used to typimg.. Edit with keyboard: Holy crap, MS has a ways to go on their autocorrect for the Surface's touch keyboard! The MUMPSorceress fucked around with this message at 16:35 on Jan 23, 2015 |
# ? Jan 23, 2015 07:18 |
|
Scaramouche posted:That's actually what it was like originally, but was causing load problems because ServerB is a full blown web server handling tens of thousands hits a day. The 'brute' crunch was string handling, not database operations, so I moved t hat off to ServerA. Buy a new server? I don't want to sound like a dick or anything but I just bought a Lenovo Thinkserver with 4 core HT Xeon with 32GB of ram for less than 1000 euro's. I mean, if it's an important application a new rackserver is not that much of an investment these days.
|
# ? Jan 23, 2015 10:04 |
|
Mr Shiny Pants posted:Buy a new server? I don't want to sound like a dick or anything but I just bought a Lenovo Thinkserver with 4 core HT Xeon with 32GB of ram for less than 1000 euro's. No I get you, the problem being we want this server to eventually not exist and are in the process of offloading everything on it into VMs and Cloud Storage, and therefore don't want to invest in further infrastructure. I've just got to baby this along until we finish switching over. As for the error, uggh it happened over a dozen times yesterday. I uploaded a new code base last night that has optimized a lot of the high plan count queries and today I'll be working on the high execution time ones. I've also put a network monitor on ServerA to see if the network card is getting over-saturated when these errors happen so we'll see how that goes.
|
# ? Jan 23, 2015 20:54 |
|
If I need to kick off a long-running, CPU-bound task and not care about the results, is just calling Task.Run(whatever) the right way to do it?
|
# ? Jan 23, 2015 21:10 |
|
GrumpyDoctor posted:If I need to kick off a long-running, CPU-bound task and not care about the results, is just calling Task.Run(whatever) the right way to do it? Yes but don't have the implementation call Task.Run have the caller (here's why). Just remember you won't get any exception messages unless the code in the Task handles it. It's truly fire and forget if the task isn't awaited. If you are in ASP.NET you are sucking up a thread from your thread pool that is used to handle requests and IIS might shut down your app while it's running. You can use QueueBackgroundWorkItem to get around that or ship it off the box. gariig fucked around with this message at 22:05 on Jan 23, 2015 |
# ? Jan 23, 2015 21:25 |
|
GrumpyDoctor posted:I want to be able to use OneWayToSource bindings with read-only dependency properties. How recently have you tried to do this and with what version of .NET?
|
# ? Jan 23, 2015 23:23 |
|
Mr Shiny Pants posted:So, where's the HoloLens SDK? And does it work on .Net? The only answer at the moment is "please wait for HoloLens at BUILD" and "everything you learn about developing for Windows will help you get ready to develop for Microsoft HoloLens": http://www.microsoft.com/microsoft-hololens/en-us/get-ready
|
# ? Jan 24, 2015 00:07 |
|
Scaramouche posted:No I get you, the problem being we want this server to eventually not exist and are in the process of offloading everything on it into VMs and Cloud Storage, and therefore don't want to invest in further infrastructure. I've just got to baby this along until we finish switching over. One thing I found when using VPNs is that MTU sizes and packets might get all messed up. It might be that your firewall drops large packets or fragments them and the other end can't fix them up. I don't know if you can set the MTU size for the SQL libraries but it might be worth checking it out. Especially as it seems to happen with larger queries ( or is this something that I am assuming? ). There are some KB articles that mention this with Group Policy not working over VPN tunnels. More info: http://community.spiceworks.com/topic/217130-mtu-issues-in-vpn-connections ljw1004 posted:The only answer at the moment is "please wait for HoloLens at BUILD" and "everything you learn about developing for Windows will help you get ready to develop for Microsoft HoloLens": Cool, can't wait!
|
# ? Jan 24, 2015 01:05 |
|
The HoloLens thing is fantastic. Now if only they could shrink it to the size of a normal pair of glasses.gariig posted:Yes but don't have the implementation call Task.Run have the caller (here's why). Just remember you won't get any exception messages unless the code in the Task handles it. It's truly fire and forget if the task isn't awaited. I have a WPF client application with a service interface containing something like Task<Data[]> GetDataAsync(). This is implemented as a call to Task.Run() on a private GetData() which does the actual network communication with WCF asynchronously. This seems proper. Making the service-user invoke Task.Run() seems like it would bloat my code and imply that there is every a case where you shouldn't be having that executed asynchronously. Inverness fucked around with this message at 04:42 on Jan 24, 2015 |
# ? Jan 24, 2015 04:30 |
|
Inverness posted:How does this apply to something like network communication? There is indeed a common case where you shouldn't be doing that... Users of your GetDataAsync won't even know that it uses Task.Run. They'll be mislead by its signature into believing its a "truly async" and hence lightweight call, whereas actually it's a fake async call that looks async but isn't really async under the hood. We encountered this within VS itself. Other folks in teams within VS would use Task.Run internally in their components to handle network and disk activity exactly like you're doing and the rest of us wouldn't know. The problem is that the threadpool only grows at a rate of about 1 thread per second. So we'd get situations where every thread in the threadpool was busy doing Task.Run for network/disk access, and the IDE needed just one small brief thread to quickly compute what intellisense to show after the user types "dot", but all of VS would mysteriously hang for 1 second until the threadpool granted us another thread or until a piece of network/disk activity finished. The way we improved typing responsiveness (and made C#/VB more responsive in VS2015 than in VS2010, VS2012, VS2013) was by ruthlessly eliminating every internal call to Task.Run, so only the "top level" components within VS are allowed to decide when and how to use the threadpool. I made a short tutorial video on this subject: http://channel9.msdn.com/Series/Three-Essential-Tips-for-Async/Async-Library-Methods-Shouldn-t-Lie ljw1004 fucked around with this message at 05:25 on Jan 24, 2015 |
# ? Jan 24, 2015 05:22 |
|
Mister Duck posted:How recently have you tried to do this and with what version of .NET? 6-9 months ago and with .NET 4.0, I believe. Did it get fixed? That's great.
|
# ? Jan 24, 2015 05:28 |
|
ljw1004 posted:I made a short tutorial video on this subject: http://channel9.msdn.com/Series/Three-Essential-Tips-for-Async/Async-Library-Methods-Shouldn-t-Lie Oh, you're Lucian Wischik? Your async tips and tricks videos, particularly the first three, really helped me get a handle on Async (at least, they got me past the first hump which was understanding the program flow when async and await are in play). Great stuff.
|
# ? Jan 24, 2015 12:21 |
|
ljw1004 posted:There is indeed a common case where you shouldn't be doing that... Users of your GetDataAsync won't even know that it uses Task.Run. They'll be mislead by its signature into believing its a "truly async" and hence lightweight call, whereas actually it's a fake async call that looks async but isn't really async under the hood. In that case, my next question would be if there is any way to wrap a synchronous WCF service call in a Task that is properly async? I believe its possible to generate async methods for WCF services nowadays, but I am using the existing libraries used on the server rather than generating my own. I know I can ultimately not worry about this and just leave the async up to the top level component, as you suggested, but I'm curious. Inverness fucked around with this message at 17:23 on Jan 24, 2015 |
# ? Jan 24, 2015 17:20 |
|
Inverness posted:In that case, my next question would be if there is any way to wrap a synchronous WCF service call in a Task that is properly async? No, unfortunately not. "It has to be turtles all the way down"
|
# ? Jan 24, 2015 19:11 |
|
|
# ? Jun 6, 2024 16:27 |
|
So Xamarin switched to Slack from Hipchat. There's no official Windows Phone client yet (They are actually making one though, which shocked me) nor a Windows 8 version, so I figured I would start making one. If only as an excuse to play around with WebSockets. I have the connection set up with MessageWebSocket and it's sending and receiving messages successfully. I have a timer set up so it can ping the server so it can maintain a connection, and close it when the view pages, or if there is a network issue. But I'm having an issue trying to figure out how to handle the messages I'm receiving. If you look at their API, it returns messages as JSON. That's great, but I like to deserialize json as objects with JSON.NET, and the objects it brings back can be different. For example JavaScript code:
JavaScript code:
|
# ? Jan 24, 2015 22:40 |