|
kingcrimbud posted:Unit tests don't necessarily show that software is 'correct'. They simply allow you to show it does something, so that when you make changes to your software you can quickly see how that something changed. The better your testing, the more accurate you can measure the potential delta. So we are in agreement.
|
# ? Dec 18, 2014 13:47 |
|
|
# ? Jun 6, 2024 13:51 |
|
mortarr posted:Yeah, same here... I not at work so no code to hand, but the object model you're working with is pretty opaque - the best I could do was get the SSRS report to render to pdf in memory and then I sent that down to the client as a filecontentresult. The reports are on the server already, I just need to meaningfully navigate to them and get the user to the report. I tried setting adding a service reference to the project but it didn't like the credentials, I'm at a roadblock until I hear back from the database guy about this. If presentation and logging in wasn't such an issue, I'd just use the iframe method and call it a day.
|
# ? Dec 18, 2014 14:01 |
|
Hoping someone knows what is going wrong. The software that we make at our place makes a data warehouse and populates it from a source DB and sets it up to do all sorts of ETL and reports poo poo. I have yet to have a successful installation on my desktop because it will always timeout on the enable CDC portion of the install. This should not happen because the DW owner is set to sa, the passwords are all correct. Everything else goes fine. This is loving me up because the install also creates the SSISFramework DB etc that set up everything for testing and actually using the BIDS thing to develop on that specific machine that it is installed. But it can never get to that point. So TLDR. What could be causing enable CDC to timeout on a DW with an sa owner?
|
# ? Dec 18, 2014 14:09 |
|
mortarr posted:In fact, I remember I got so cross with the whole thing I put the report up on the sql server and just called that from my mvc proj. This is what we do too.
|
# ? Dec 18, 2014 14:34 |
|
Ithaqua posted:Don't worry, Microsoft's entire strategy around software deployment is kind of schizophrenic right now. It's going to get better, but probably not in the next 3-6 months. Hm yea it's a pain. I think there's too much QC for a desktop application. Not sure what was wrong with the old .msi or install wizard approach there. And for mobile apps if they don't want to allow appx packages to be installed from the web, at least have the InTune company portal accept universal apps easily without having to put a sensitive enterprise program on the store. Unfortunately our mobile launch date will be before any likely fixes, but it looks like we'll be able to use the current system, but just have it as a private store entry. It's no wonder the Windows Phone market isn't doing that great. The new 8.1 devices are actually pretty sweet all things considered. Also boo at hosted TFS being down right now. Stuff like this seems to happen every time I work remotely and absolutely have to pull the current source. MICROSOFT!
|
# ? Dec 18, 2014 18:31 |
|
RICHUNCLEPENNYBAGS posted:So we are in agreement. Tests are only going to be perfect for simple and obvious functions, and it's funny when people act like code without automated tests is a time bomb. It's not that black and white. But the nice thing about tests is you get to be specific and literal about what the expected behavior of your code is. That's really handy when evaluating how well your program fulfills requirements and it's very useful for the poor sap maintaining your code in the future who needs to figure out what the gently caress it does.
|
# ? Dec 18, 2014 18:39 |
|
EssOEss posted:You can unload assemblies by unloading the AppDomain that they belong to, though managing AppDomains can be a bit of a hassle. Is it really worth the convenience of swapping bits out at runtime? Possibly it is easier to just stop the service, update it and start it again. This, of course, assumes that the service code has been built with proper stopping logic in mind - not always the case. Ok, I didn't know it was this complicated. It would be nice if I could toggle a new version flag in the db where the service would then reload the new dll and flip the flag bit, but I don't want to rock the boat. I mean it gets the job done like it is and the service does have proper stopping logic in there.
|
# ? Dec 18, 2014 20:23 |
|
fleshweasel posted:Tests are only going to be perfect for simple and obvious functions, and it's funny when people act like code without automated tests is a time bomb. It's not that black and white. But the nice thing about tests is you get to be specific and literal about what the expected behavior of your code is. That's really handy when evaluating how well your program fulfills requirements and it's very useful for the poor sap maintaining your code in the future who needs to figure out what the gently caress it does. Well, again, sure. But tests are code that has to be maintained and can have bugs too and TDD's obsession with "code coverage" leads, I'm contending, to lower software quality.
|
# ? Dec 19, 2014 02:49 |
|
VS wouldn't autogenerate a .update() command for a tableadapter(i think because it doesn't have a primary key). Is there any way to force it to or at least get close? Typing these things out sounds tedious as hell. Edit: Nevermind, I didn't see the 'new' drop down under properties that would eventually get me to the query builder. bobua fucked around with this message at 03:06 on Dec 19, 2014 |
# ? Dec 19, 2014 03:03 |
|
RICHUNCLEPENNYBAGS posted:So we are in agreement. Yes and no. I personally think TDD makes sense on paper. With what I said before, unit tests can guarantee a minimum state of the classes in your system. Once a class changes, tests can go red or they can stay green. If you've truly designed your system well (good luck doing that) where you're open for extension and closed for modification, then your tests from TDD will already cover your previous code and you'll never go red. Two problems with this though is that we'll never design it perfectly the first time and requirements will always shift. Until we get perfect requirements with which we can perfectly design, TDD will not be perfect.
|
# ? Dec 19, 2014 07:49 |
|
I'm trying to grab the size of a specific folder within my code, and in looking around the Internet I'm seeing a lot of references to Scripting.FileSystemObject, which looks like it's a VB 6 artifact. Is there a more up to date .NET object I should be using to get attributes of file system objects?
|
# ? Dec 19, 2014 16:48 |
|
SquadronROE posted:I'm trying to grab the size of a specific folder within my code, and in looking around the Internet I'm seeing a lot of references to Scripting.FileSystemObject, which looks like it's a VB 6 artifact. Is there a more up to date .NET object I should be using to get attributes of file system objects? System.IO.Directory.EnumerateFiles() and you can iterate over the file entries. Per entry get a System.IO.FileInfo from the path and this FileInfo object has a length property.
|
# ? Dec 19, 2014 16:59 |
|
Mr Shiny Pants posted:System.IO.Directory.EnumerateFiles() and you can iterate over the file entries. Per entry get a System.IO.FileInfo from the path and this FileInfo object has a length property. System.IO looks to have all the stuff I need. Thanks.
|
# ? Dec 19, 2014 17:01 |
|
code:
code:
|
# ? Dec 21, 2014 21:28 |
|
bobua posted:
Make a generic method that takes whatever class Grey and Rgb derive from as a constraint, move all of the logic into that method. code:
|
# ? Dec 21, 2014 21:42 |
|
Ithaqua posted:Make a generic method that takes whatever class Grey and Rgb derive from as a constraint, move all of the logic into that method. Sweet. Never messed with this sorta thing. Thanks!
|
# ? Dec 21, 2014 21:59 |
|
Can I use a List of Strings as a the key for a dictionary? Or, can anyone think of a neat solution to this? I've got a collection of Foos, each of which has a collection of Strings. I need to find each unique list of Strings, along with the Foos that share it. p.s. VB, not C#, if it makes any difference. p.p.s. I am aware that this is a somewhat remedial level question, but I am ill and sleep deprived and it is the end of the day. chippy fucked around with this message at 18:24 on Dec 22, 2014 |
# ? Dec 22, 2014 18:22 |
|
chippy posted:Can I use a List of Strings as a the key for a dictionary?
|
# ? Dec 22, 2014 18:33 |
|
Sedro posted:You can, but the List in .NET doesn't implement equality/hash in terms of its items. So you should use a custom EqualityComparer when you construct the dictionary. Thanks, yeah I just tried it out in LINQPad and found that the standard equality operator won't work. I'll look into that.
|
# ? Dec 22, 2014 18:36 |
|
chippy posted:Can I use a List of Strings as a the key for a dictionary? From the way you describe the problem, it sounds like you want to start with the Foos as the keys, and the lists of strings as the values, and then turn that "inside-out" into the dictionary you actually want. GroupBy would fit exactly what you want to do, but as Sedro says it would also require you to define an EqualityComparer (using SequenceEqual). If you would have no further use for the comparer I'd just go with the lo-tech approach of a For Each loop: https://dotnetfiddle.net/fBRDaW
|
# ? Dec 22, 2014 22:14 |
|
I'm trying to save and load images using PngBitmapEncoder and PngBitmapDecoder. After I save png it opens fine in gimp and colors look right. But after loading with FromPNG method I get red and blue channels switched up. Format property on bitmapSource in the second method says format is Bgr24 for some reason, and I'm not sure where it gets this idea, or how to force correct format.code:
|
# ? Dec 22, 2014 22:58 |
|
chippy posted:Can I use a List of Strings as a the key for a dictionary? Using mutable objects as dictionary keys is a Real Bad Idea. It can "work" as long as you make sure you don't actually mutate the objects once they become keys, but it's a smelly thing to do, at best.
|
# ? Dec 22, 2014 23:59 |
|
chippy posted:Can I use a List of Strings as a the key for a dictionary? You could extend the list and override GetHashCode to order the strings, join them and call string.GetHashCode, or use an int as the key. It really depends on how important the hash is. If it's only used in memory, then you should be fine. Storing the hash would mean you should use a consistent hash instead of GetHashCode for string.
|
# ? Dec 23, 2014 09:10 |
|
Thanks everyone. I ended up writing a custom IEqualityComparer and using GroupBy().
|
# ? Dec 23, 2014 12:44 |
|
gently caress, do I struggle with Form controls. I have a form which has a PictureBox in it. When the form loads initially, that picture box is a gray dot. When I hit a button, it needs to turn to a green dot. I can not for the life of me get this son of a bitch to change it's picture. Just to test it, I'm trying to get it to flip a color on startup, and it won't even do that and I'm way too stupid at code:
code:
code:
code:
|
# ? Dec 23, 2014 13:01 |
|
Canine Blues Arooo posted:Than it will load as a green dot, as it should. But anything that happens after Run() is called is no bueno. I just want to change the picture in a picture box on a button click! This has got to be really simple. What the gently caress do I do!?!? I'm assuming this is in WinForms? You need to make an event handler to process your button's Click event. If you're in the design view, the quickest way to do this is just double-click on the button in question, and Visual Studio will automagically create the function stub for you. It'll look something like this: C# code:
C# code:
http://msdn.microsoft.com/en-us/library/dd492171.aspx Is a set of basic WinForms tutorials that looks pretty good. #1 has you write button click event handlers the way I told you about, and #2 goes a little deeper into events and shows you where they're attached to the controls that generate said events. ---- Also on a more personal note, stop getting down on yourself for not getting this right away. Windows GUI programming has a lot of extra baggage and complexity attached to it which does a fantastic job of muddying the waters when you're just trying to learn basic programming concepts. It can be difficult to teach yourself because dozens of little things have to be correct, and if you don't know several of them at once, it's hard to know where you're going wrong or what you're missing. Just keep asking questions when you don't understand something (and frankly, get comfortable with not understanding things - the more you learn about programming, the more you realize just how much there is that you don't know.)
|
# ? Dec 23, 2014 13:48 |
|
Canine Blues Arooo posted:Than it will load as a green dot, as it should. But anything that happens after Run() is called is no bueno. I just want to change the picture in a picture box on a button click! This has got to be really simple. What the gently caress do I do!?!?
|
# ? Dec 23, 2014 13:48 |
|
Forgall posted:I don't see your button click event handler in code you posted, do you have one? Oh yeah. I removed pretty much all the functionality in the name of isolating where the problem is here. Complete code for main is: code:
code:
|
# ? Dec 23, 2014 14:15 |
|
Ok, this is a little convoluted, especially your createHash function... But that aside, best thing would probably be to put a debugger breakpoint in changeNtpStatus and make sure that it is being called when you click a button, that it is called with correct parameter, and that it is being called only once. I have a feeling that changeNtpStatus is either not called at all or called multiple times, with latter call overwriting ntpBox.Image with wrong icon. Edit: And this is unrelated to your present problem, but function called createHash should not be changing state of UI, and it really shouldn't be making calls to the network. Forgall fucked around with this message at 15:07 on Dec 23, 2014 |
# ? Dec 23, 2014 15:03 |
|
Yeah, you're passing in the form to your createHash function, which reeeealy shouldn't be necessary. Can you show us where you're calling createHash?
|
# ? Dec 23, 2014 15:07 |
|
Speaking of WinForms, I've been looking for ways to make some of the apps that I maintain a bit cleaner / more modular / more maintainable. Reading this article has me pretty keen on trying out an event aggregation approach, but I don't really have any idea how things would fit together in a larger app. Has anyone done something similar before, or know of any open source examples of a similarly architected app? I've got a little Rx event aggregator that I wrote a while back, but my biggest pain points at the moment are wiring up the subscriptions and putting things together - particular with non-UI classes that process events, etc.
|
# ? Dec 23, 2014 15:27 |
|
Che Delilas posted:Yeah, you're passing in the form to your createHash function, which reeeealy shouldn't be necessary. Can you show us where you're calling createHash? Sure -- Just a quick note: I've made a mess of this code trying to fix this. I've restored it to where I left off before I said 'gently caress it'. First, the form class. This is the only form on the application, so that makes things a little easier: code:
code:
code:
Canine Blues Arooo fucked around with this message at 15:55 on Dec 23, 2014 |
# ? Dec 23, 2014 15:53 |
|
Canine Blues Arooo posted:I realize I cannot actually create a new form object here (in the Hash class) and expect it to change the existing form's state, but I think this at least clearly illustrates what I want to accomplish. Added stuff in bold. This is correct, you can't do that. But you are also doing it in your Reporting class: code:
---- Beyond that, as forgall mentioned you really, really shouldn't be changing the state of your UI outside of your form. WinForms is bad about letting you separate display logic from other logic, but at the very least, your form class should be manipulating the color of the picture box based on the results of the other classes, not letting those classes do it. Something like this: C# code:
Probably a good idea to explicitly try/catch/rethrow the exception within your Reporting.GenerateReport() method too, but it should bubble up either way.
|
# ? Dec 23, 2014 16:53 |
|
I have a collections data structures question about ArrayList. I am in a situation where I wanted to use one, but the data I'm inserting into it is be placed in reverse-order. So I'm adding to the beginning every time. Is there any reason this is suboptimal for that container? I was wondering if, say, its default array started with i=0 and I immediately wreck it. I wonder then if it compensates in the second internal array it makes, or what.
|
# ? Dec 24, 2014 17:45 |
|
Rocko Bonaparte posted:I have a collections data structures question about ArrayList. I am in a situation where I wanted to use one, but the data I'm inserting into it is be placed in reverse-order. So I'm adding to the beginning every time. Is there any reason this is suboptimal for that container? I was wondering if, say, its default array started with i=0 and I immediately wreck it. I wonder then if it compensates in the second internal array it makes, or what. You don't want to use an ArrayList for anything, ever. It's a legacy holdover from .NET 1.1, which didn't have generics. Use a List<T> and the Insert method. Internally, it's just copying and resizing the backing array, which shouldn't matter to you -- it's not going to be a performance issue unless you have a huge list, and if you have a huge list, you probably have a design issue. You could also use a SortedSet<T>, which will maintain the sort order automatically. New Yorp New Yorp fucked around with this message at 17:59 on Dec 24, 2014 |
# ? Dec 24, 2014 17:54 |
|
Ahh that is right. I keep relearning not to use ArrayLists. I should figure out an IDE extension to yell at me when I type it.
|
# ? Dec 24, 2014 21:09 |
|
Also, if you are inserting into beginning of List, it's going to move every element already in there every time you do that. You could just reverse it once you are done adding elements, or not reverse it at all and access it using a[a.Count - 1 - n] instead of a[n]. Or use a stack.
|
# ? Dec 24, 2014 21:29 |
|
Che Delilas posted:Added stuff in bold. This is correct, you can't do that. But you are also doing it in your Reporting class: This is what I ended up doing and it works just fine. It seems so obvious but it never even crossed my mind until you mentioned it. Thanks!
|
# ? Dec 24, 2014 21:59 |
|
Ithaqua posted:You don't want to use an ArrayList for anything, ever. I don't really agree with this in practice. On mobile ArrayList performs better than generic List. In fact on mobile avoiding generics as much as possible helps performance a ton. This is using the Xamarin mono runtime not official runtime. So this may not be relevant for Windows Phone stuff.
|
# ? Dec 24, 2014 23:03 |
|
|
# ? Jun 6, 2024 13:51 |
|
xgalaxy posted:I've got a question / concern about HttpWebRequest. From memory, HttpWebRequest.BeginGetResponse does some initial part of the connection (resolving URL? opening up the TCP port?) synchronously. My vague memory is that when I had a misconfigured network connection I could observe BeginGetResponse hanging rather than returning immediately. I agree with "what's the point?". I think the underlying problem is I've *NEVER* met a developer who really pays pedantic attention to the low-level nuts and bolts of what exactly each operation will do and whether it might fail. As you said, doing it on a background thread sounds like a fine approach. You'll have the problem that the background thread might hang indefinitely and it's rude to terminate a thread...
|
# ? Dec 27, 2014 17:44 |