|
Mr. Crow posted:Tangentially on the topic of DI/IoC, what are you guy's preferred MVVM + IoC frameworks these days (WPF/Silverlight)? I am using mvvm cross for my latest winphone app and so far seems to work. Our enterprise 'standard' used to be no framework. That was a headache...
|
# ? Feb 11, 2014 20:56 |
|
|
# ? Jun 4, 2024 20:01 |
|
ljw1004 posted:Gosh, I've not used IOC/DI myself, and after that video I strongly don't want to. In my opinion, the real benefit of unit tests and, by extension, IoC isn't what all the videos show you. All the information talks about a green field application and how to start with unit tests, which is great but doesn't show the real power. It's most useful when you pick up a project that another developer stopped working on 3 months ago to fix some obscure bug that the customer finally found. The unit tests show you what the return values should be and give you some insight into the application. You write your failing unit test for the bug, fix the bug, then run unit tests for every single other bug ever fixed to make sure you didn't break anything in the process.
|
# ? Feb 12, 2014 06:13 |
|
Dirk Pitt posted:I am using mvvm cross for my latest winphone app and so far seems to work. I haven't heard of this, seems really cool at first glance, watching this video.
|
# ? Feb 12, 2014 17:27 |
|
Mr. Crow posted:I haven't heard of this, seems really cool at first glance, watching this video. Holy crap.
|
# ? Feb 12, 2014 19:03 |
|
Mr. Crow posted:I haven't heard of this, seems really cool at first glance, watching this video. That's nothing new. Xamarin and Monotouch have been around for ages. Personally, I'm still not using any MVVM frameworks when I mess around with WPF. I just haven't seen any compelling features that would convince me to use one.
|
# ? Feb 12, 2014 19:08 |
|
Ithaqua posted:That's nothing new. Xamarin and Monotouch have been around for ages. Seems ideal for larger teams, like Dirk we aren't using one and I can see plenty of benefits of migrating over to one at some point. The only reason I use them on personal projects is to try out and learn the framework itself.
|
# ? Feb 12, 2014 19:25 |
|
Bognar posted:In my opinion, the real benefit of unit tests and, by extension, IoC isn't what all the videos show you. All the information talks about a green field application and how to start with unit tests, which is great but doesn't show the real power. It's most useful when you pick up a project that another developer stopped working on 3 months ago to fix some obscure bug that the customer finally found. The unit tests show you what the return values should be and give you some insight into the application. You write your failing unit test for the bug, fix the bug, then run unit tests for every single other bug ever fixed to make sure you didn't break anything in the process. There's that and there's also the benefit of being able to (relatively) quickly switch out anything that is being injected. For example, we've abstracted out our caching into an ICacheProvider interface and made a few implementations. When we found some limitations of the method we were using, we just added a few lines of configuration, spun up a memcached server and swapped out providers in our Autofac registry. It literally took me longer to get a memcached server downloaded, installed and working on my local for testing than it did to do all the code/configuration changes.
|
# ? Feb 13, 2014 04:28 |
|
I'm having trouble figuring out an async memory leak. I have the following codecode:
|
# ? Feb 14, 2014 21:12 |
|
fankey posted:I'm having trouble figuring out an async memory leak. I have the following code Did you try code:
code:
|
# ? Feb 14, 2014 21:28 |
|
fankey posted:I'm having trouble figuring out an async memory leak. ... (1) Please tell me that you're using the nuget package Microsoft.Bcl.Async rather than the old flakey "compatibility pack"... (2) You should understand that that async makes certain inherent heap allocations, but there are ways to minimize them. I recorded a short channel9 video on the subject here that you should definitely watch: http://channel9.msdn.com/Series/Three-Essential-Tips-for-Async/Async-libraries-APIs-should-be-chunky (3) The very concept "memory leak" is unclear in .NET. Do you mean that stuff is being allocated on the heap, causing need for a subsequent garbage collection? As per the above video, that's inherent with async methods but its impact can be reduced. Or do you mean that stuff is being allocated but the GC is unable to free it because there remains a live reference to it? That's possible with poorly written code, including poorly written code in the framework or in the old flakey async compatibility pack, but it's hard to diagnose without a complete minimal self-contained repro. (4) In the VB/C# compiler team our perf experts spend a lot of time discovering how our code is causing "GC pressure" (a nicer term than "memory leak"!). I think they primarily use PerfView and the equivalent that's built into VS. The game is always the same: run your code, use PerfView to discover which objects are taking up all the space on the heap, and figure out which bits of code exactly are allocating them. One thing I'd start by asking: how is the memory allocation pattern different in these three examples? code:
EDIT: You might also consider this idiom for a watcher which says repeatedly whether the thing is up and doesn't involve allocations. Or also RX. code:
ljw1004 fucked around with this message at 21:44 on Feb 14, 2014 |
# ? Feb 14, 2014 21:37 |
|
Ithaqua posted:Did you try
|
# ? Feb 14, 2014 21:39 |
|
ljw1004 posted:(1) Please tell me that you're using the nuget package Microsoft.Bcl.Async rather than the old flakey "compatibility pack"... ljw1004 posted:(2) You should understand that that async makes certain inherent heap allocations, but there are ways to minimize them. I recorded a short channel9 video on the subject here that you should definitely watch: http://channel9.msdn.com/Series/Three-Essential-Tips-for-Async/Async-libraries-APIs-should-be-chunky ljw1004 posted:(3) The very concept "memory leak" is unclearin .NET. ljw1004 posted:(4) In the VB/C# compiler team our perf experts spend a lot of time discovering how our code is causing "GC pressure" (a more technically precise term than "memory leak"). I think they primarily use PerfView and the equivalent that's built into VS. The game is always the same: run your code, use PerfView to discover which objects are taking up all the space on the heap, and figure out which bits of code exactly are using them. ljw1004 posted:One thing I'd start by asking: how is the memory allocation pattern different in these three examples? I'm going to work on a simple repro example.
|
# ? Feb 14, 2014 21:50 |
|
Memory dump and windbg. Is dt_Tick being attached to a multicast delegate without being removed later?
|
# ? Feb 14, 2014 22:07 |
|
I've been struggling with the ConfigurationManager class trying to get it to read a value from my App.config file. It is copied to the Debug directory when I compile and it contains the key/value pair I stored in it. I restarted a blank project with the bare minimum to isolate potential issues, but it still won't read my configuration value. I just get an empty value when I try to read it. After much googling and searches on StackOverflow I found that you could use Properties.Settings.Default which works! But after spending so much time on what was supposed to something trivial to implement in C#, I'd like to know why my implementation below doesn't work. This is on Visual Studio 2013 and .NET 4.5. Here's my whole test program: code:
code:
Secx fucked around with this message at 03:28 on Feb 18, 2014 |
# ? Feb 18, 2014 03:26 |
|
ConfigurationManager.AppSettings["pdfinputdir"] is looking for this XML formatcode:
aBagorn fucked around with this message at 03:47 on Feb 18, 2014 |
# ? Feb 18, 2014 03:44 |
|
Sedro posted:
This was several pages ago, but I wanted to thank you! I just got around to using it and it works great.
|
# ? Feb 18, 2014 22:53 |
|
Great! Thanks for following up
|
# ? Feb 18, 2014 23:49 |
|
This is more curiosity than anything else, but do any of you have any of the C# certifications MS puts out? Is there any reason to be interested if you're already a working developer?
|
# ? Feb 19, 2014 01:11 |
|
RICHUNCLEPENNYBAGS posted:This is more curiosity than anything else, but do any of you have any of the C# certifications MS puts out? Is there any reason to be interested if you're already a working developer? No.
|
# ? Feb 19, 2014 01:39 |
|
RICHUNCLEPENNYBAGS posted:This is more curiosity than anything else, but do any of you have any of the C# certifications MS puts out? Is there any reason to be interested if you're already a working developer? I did 70-483 (Programming in C#) on a whim, mainly because I had some downtime at work and my employer was paying for it. It was really easy. The next two in sequence for an MCSD look like they're tougher and have far more limited usefulness (Windows App Store! ), so I haven't bothered. It's one of those things where it doesn't hurt to have the certs, but I certainly wouldn't go out of my way to get them.
|
# ? Feb 19, 2014 02:03 |
|
Since we were recently on the topic of memory leaks, can anyone explain why this causes an unmanaged memory leak in WPF?C# code:
|
# ? Feb 19, 2014 06:00 |
|
Anyone done 70-461, sql something something? Was it hard?
|
# ? Feb 19, 2014 07:31 |
|
Bognar posted:Since we were recently on the topic of memory leaks, can anyone explain why this causes an unmanaged memory leak in WPF? Try freezing your images http://msdn.microsoft.com/en-us/library/ms750509(v=vs.110).aspx Mr. Crow fucked around with this message at 16:04 on Feb 19, 2014 |
# ? Feb 19, 2014 16:01 |
|
Mr. Crow posted:Try freezing your images http://msdn.microsoft.com/en-us/library/ms750509(v=vs.110).aspx I tried that as well with no effect. The only thing that seems to have worked at all is manually setting references to null.
|
# ? Feb 19, 2014 18:26 |
|
We've got a little project that involves reading a bunch of PDFs and making them searchable. We can handle the whole "take bags of text and make it searchable" pretty easily but we are having some trouble with the reading PDFs end of the equation. We've tried using PdfTextract which is a pretty thin wrapper on the last free version of PdfSharp before they went commercial with limited success. We have also tried Docotic.Pdf which seems to work but I really hate to pay $1k to read PDFs. Is there anything else out there that is reliable for less or better yet free*? * money isn't really the problem, all the overhead of dealing with license components rubs me wrong and is a pain in the rear end with the CI setup we've got.
|
# ? Feb 19, 2014 20:22 |
|
Any idea why I would get a TypeInitializationException "The type initializer for '<Module>' threw an exception" with the inner exception a CryptographicException "Padding is invalid and cannot be removed?" I'm assuming it's some kind of assembly loading problem (my application doesn't use crypto for anything) but since every object in the offending call has already been instantiated (and thus, all relevant assemblies appear to have loaded) I haven't the faintest idea what the problem could be or how to diagnose or fix it.
|
# ? Feb 19, 2014 21:31 |
|
Google gave me this, is it a desktop application or a web-thingy?
|
# ? Feb 20, 2014 15:00 |
|
It's desktop.
|
# ? Feb 20, 2014 15:15 |
|
wwb posted:Is there anything else out there that is reliable for less or better yet free*? I've used a couple of different libraries at work and the only one I was able to find that did everything I needed was iTextSharp. It is free and has been around long enough that there are tons of StackOverflow posts on how to get stuff done. It is however not the most user-friendly API. I've never used it to capture PDF text but a cursory search looks like it is capable of that.
|
# ? Feb 20, 2014 17:12 |
|
Thanks, iTextSharp was the 1st cut -- the last free version is 4.1.6 which specifically doesn't work with documents higher than v6 and seems to be barfing on a lot of the documents I've got. Checks the box but doesn't do it so well unfortunately. Now, I have started to figure out some of iTextSharp's problem -- these PDFs had some embedded search because they are off those old "buy a book on CD" sort of things that embedded poo poo in PDFs. Rebuilding everything as pdf/a to see if that helps. PS: how much is iText these days? Good question -- they won't even tell you, you have to tell them what you are doing and they give you a round number. wwb fucked around with this message at 19:41 on Feb 20, 2014 |
# ? Feb 20, 2014 19:12 |
|
Still on the subject of memory leaks, what's the general approach to tracking them down? I have what seems like a pretty easy situation - BackgroundWorker does some stuff and generates a DataTable, which is then used in another window/class. When it's closed, however, the DataTable sticks around even though it shouldn't be used by anything any longer. I can't just delete it and see what blows up so I'm kind of stuck there
|
# ? Feb 20, 2014 21:53 |
|
I'm using the WPF Extended Toolkit ColorPicker, and I want to remove its text headers. This doesn't appear to be easily customizable. Is there some way I can reach into it and hide them without retemplating the whole thing? The tricky bit is that the target TextBlocks don't have names. I've got access to the default template (via this stackoverflow post). Basically I want to do this, except the target element isn't named.
|
# ? Feb 20, 2014 22:33 |
|
mobby_6kl posted:Still on the subject of memory leaks, what's the general approach to tracking them down? I have what seems like a pretty easy situation - BackgroundWorker does some stuff and generates a DataTable, which is then used in another window/class. When it's closed, however, the DataTable sticks around even though it shouldn't be used by anything any longer. I can't just delete it and see what blows up so I'm kind of stuck there Start off by listing types with lots of bytes allocated: pre:0:010> .loadby sos clr 0:010> !dumpheap -stat -min 10000 Statistics: MT Count TotalSize Class Name 5179cf14 1 20971532 System.Byte[] Total 1 objects pre:0:010> !dumpheap -type System.Byte[] -min 10000 Address MT Size 04cf1000 5179cf14 20971532 Statistics: MT Count TotalSize Class Name 5179cf14 1 20971532 System.Byte[] Total 1 objects pre:0:010> !gcroot 04cf1000 Thread 15a0: 0040ef10 0f5ccc30 DomainBoundILStubClass.IL_STUB_PInvoke(System.Windows.Interop.MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32) ebp-c: 0040ef4c -> 0224ad18 System.Windows.Threading.Dispatcher -> 022d8760 System.EventHandler -> 022ce724 System.Object[] -> 022cc948 System.EventHandler -> 022cc080 System.Windows.Media.MediaContext -> 022cc218 System.Collections.Generic.Dictionary`2[[System.Windows.Media.ICompositionTarget, PresentationCore],[System.Object, mscorlib]] -> 022cdcf0 System.Collections.Generic.Dictionary`2+Entry[[System.Windows.Media.ICompositionTarget, PresentationCore],[System.Object, mscorlib]][] -> 022cb8fc System.Windows.Interop.HwndTarget -> 02276ac8 MemoryLeakTest.MainWindow -> 04cf1000 System.Byte[] Found 1 unique roots (run '!GCRoot -all' to see all roots). C# code:
|
# ? Feb 20, 2014 22:38 |
|
mobby_6kl posted:Still on the subject of memory leaks, what's the general approach to tracking them down? I have what seems like a pretty easy situation - BackgroundWorker does some stuff and generates a DataTable, which is then used in another window/class. When it's closed, however, the DataTable sticks around even though it shouldn't be used by anything any longer. I can't just delete it and see what blows up so I'm kind of stuck there In .Net both jetbrains and redgate have really good profilers that I typically use. Both cost, but Jetbrains has a rework of their old one in EAP and I've used it to resolve some really painfully obscure hanging event handlers keeping Windows in memory. Given its EAP it's missing some UX features but is faster than Redgates in my experience. Redgates is more mature though obviously which has its benefits (but is significantly more expensive as well). Edit: derp this is the .Net thread.
|
# ? Feb 21, 2014 00:10 |
|
Would someone PLEASE help me out. I'm working on a small personal project using the Yahoo Fantasy Sports API and I've been stuck for like, 2 weeks trying to figure this out and I want to cry. All I'm trying to do is make a call to the Yahoo API. I'm able to able to authenticate using OAuth 1.0 and get an access token. The problem I'm having is when I'm actually making the request and I have to send a signature signed with HMACSHA1. I'm using OAuthBase.cs and this to help me check my signatures. However, I keep getting a 401 with oauth_problem="ST_OAUTH_SIGNATURE_INVALID_ERROR! My method to create a request: php:<? public void CreateRequest(string token) { string baseURI = "http://query.yahooapis.com/v1/yql?"; OAuthBase o = new OAuthBase(); var authorizeUri = new StringBuilder(); string query = "select * from fantasysports.players where league_key='314.l.408939'"; string nonce = o.GenerateNonce(); string timestamp = o.GenerateTimeStamp(); string token_secret = (string)Session["oauth_token_secret"]; authorizeUri.AppendFormat("callback={0}&", ""); authorizeUri.AppendFormat("format={0}", "json"); //authorizeUri.AppendFormat("q={0}", query); Uri url = new Uri(baseURI + authorizeUri.ToString()); string normalizedURL; string normalizedRequestParameters; string sig = o.GenerateSignature(url, consumer, secret, token, token_secret, "GET", timestamp, nonce, out normalizedURL, out normalizedRequestParameters); var queryUri = new StringBuilder(); queryUri.AppendFormat("callback={0}&", ""); queryUri.AppendFormat("format={0}", "json"); //queryUri.AppendFormat("q={0}", HttpUtility.UrlEncode(query)); var request = (HttpWebRequest)WebRequest.Create(baseURI + queryUri); request.Method = "GET"; var header = new StringBuilder(); header.AppendFormat("OAuth realm={0},", "\"yahooapis.com\""); header.AppendFormat("oauth_consumer_key={0},", "\"" + o.UrlEncode(consumer) + "\""); header.AppendFormat("oauth_nonce={0},", "\"" + o.UrlEncode(nonce) + "\""); header.AppendFormat("oauth_signature_method={0},", "\"" + o.UrlEncode("HMAC-SHA1") + "\""); header.AppendFormat("oauth_timestamp={0},", "\"" + o.UrlEncode(timestamp) + "\""); header.AppendFormat("oauth_token={0},", "\"" + o.UrlEncode(token) + "\""); header.AppendFormat("oauth_version={0},", "\"" + o.UrlEncode("1.0") + "\""); header.AppendFormat("oauth_signature={0}", "\"" + o.UrlEncode(sig) + "\""); request.Headers["Authorization"] = header.ToString(); request.ContentType = "Content-Type: application/x-www-form-urlencoded"; try { HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse(); var result = webResponse.GetResponseStream(); } catch (Exception ex) { } } ?> code:
code:
|
# ? Feb 21, 2014 05:38 |
|
Twenty minutes of googling have turned up nothing so I'm assuming I'm SOL on this one. I'm working on automating localization testing, so the same tests will run in four different languages. The way it's currently set up, there's a french machine, a german machine, etc. I'd like to run them all on the same machine if possible, which requires switching Windows's language settings between tests. Is there a way to change the global language preference through C#? Everything I've found is about localizing one single winforms app which isn't what I need.
|
# ? Feb 21, 2014 18:10 |
|
Sockser posted:Twenty minutes of googling have turned up nothing so I'm assuming I'm SOL on this one. Can't you change the thread's CurrentCulture? I've never messed with this but it's the first thing that popped into mind. There's also changing your application to take in a CultureInfo using Dependency Injection because really your classes are being tightly coupled with the local machine which is causing you issues with your automated unit testing.
|
# ? Feb 21, 2014 19:18 |
|
That's the thing, it's not enough to change my program to German or what have you, I need to set all of windows to German. e: Not unit testing, integration testing, automation bullshit, should've been more explicit there. I'm writing a testing harness that calls other applications and runs test scripts. Hence Windows needs to be localized, not my program.
|
# ? Feb 21, 2014 19:29 |
|
Sockser posted:That's the thing, it's not enough to change my program to German or what have you, I need to set all of windows to German. Gotcha! Tried PowerShell? You can run PowerShell from your application and use the Set-WinSystemLocale with it.
|
# ? Feb 21, 2014 19:40 |
|
|
# ? Jun 4, 2024 20:01 |
|
Sedro posted:Windbg. Mr. Crow posted:In .Net both jetbrains and redgate have really good profilers that I typically use. Thanks guys! Didn't have the time for this yet but seems like these two approaches should do the trick.
|
# ? Feb 21, 2014 19:53 |