|
Monkeyseesaw posted:There's quite a few MS-approved best practices the BCL doesn't follow, usually because they were implemented back in the 1.1/2.0 days before it became evident they were a bad idea (e.g. mutable structs, Dispose, and the half-dozen incompatible async patterns). When you say Dispose, are you referring to IDisposable? That was a bad idea?
|
# ? May 24, 2014 03:44 |
|
|
# ? Jun 4, 2024 13:46 |
|
Is there any benefit to the "official dispose pattern" if your class is disposable just because it has instance-level IDispoable fields (as opposed to dealing directly with native resources)?
RICHUNCLEPENNYBAGS fucked around with this message at 05:20 on May 24, 2014 |
# ? May 24, 2014 05:17 |
|
RICHUNCLEPENNYBAGS posted:Is there any benefit to the "official dispose pattern" if your class is disposable just because it has instance-level IDispoable fields (as opposed to dealing directly with native resources)?
|
# ? May 24, 2014 08:04 |
|
epalm posted:When you say Dispose, are you referring to IDisposable? That was a bad idea? I am referring to… RICHUNCLEPENNYBAGS posted:Is there any benefit to the "official dispose pattern" if your class is disposable just because it has instance-level IDispoable fields (as opposed to dealing directly with native resources)? Originally IDisposable came with no guidance but it became clear sometime around 2.0 that no one understood how to combine IDisposable and Finalizers in a thread-safe way so they came up with that monstrosity. There's nothing wrong with it in a technical sense but what a loving albatross to hang around resource cleanup. Unfortunately they made it even worse by taking a hard line in the documentation and stating you *must* implement this pattern on *any* IDisposable or your CLR will burst into flame and kill your dog; ignoring the fact that 90% of the time average .NET developer is slapping IDisposable on their class just to forward on to a private member that is itself an IDisposable and therefore has no need for this meticulous finalization bookkeeping. So not only did they have to retcon a hand-crafted hack onto their elegant resource management scheme but they went full nuclear on the docs making resource disposal sound much scarier than it actually was. The final cherry on top is after beating this pattern into everyone's head for a few years their grand opus to service oriented architecture at the time (WCF) went and broke the guarantees of IDisposable. The base service class, from which all auto-generated proxies are inherited, implements IDisposable but throws exceptions from Dispose as part of normal, albeit fault-state, operation. So of course Microsoft had to release guidance that despite stressing the importance of the using statement and the proper usage of the dispose pattern that you *absolutely* must not diverge from under any circumstances you must now diverge from in all circumstances involving WCF service proxies or your code will break horribly. But I'm not bitter or anything. Dr Monkeysee fucked around with this message at 08:26 on May 24, 2014 |
# ? May 24, 2014 08:23 |
|
ninjeff posted:Nope; in that situation, and assuming the fields' types' IDisposable implementations are themselves correct, just call Dispose on each one from your own Dispose method. Yeah, that's what I thought, but then I saw some Microsoft code using the pattern even though they just had some disposable members and I started to doubt myself. Thanks.
|
# ? May 24, 2014 23:47 |
|
Does anyone here do interesting work in .NET and like what they do, or is it all boring CRUD LOB poo poo at the end of the day? I love C#, Visual Studio, ReSharper, the stuff Microsoft is doing with .NET, etc. and feel productive with the stack but I'm really just building forms for an enterprise web app and it's starting to drive me crazy. Looking around at C# jobs in my area it seems to be the same story just about everywhere else too, except worse with requirements to know WebForms, classic ASP, and other dead-ends. Some are on a more modern stack using MVC and even things like Angular... but Christ it's probably still just more forms. Outside of folks actually at Microsoft, does anybody do cool work in .NET? Looking at job postings for other languages like Python and Scala I see lots of cool stuff like machine learning, cybersecurity... things that simply aren't present in .NET postings. It seems like the more hipster of a language it is, the cooler and more out there the work tends to be. I wish C# was a hipster language. It makes me flirt with the idea of jumping ship and diving in to something like Scala. This might more belong in one of the jobs threads but I was hoping I could get a .NET perspective on this from people in here. Is your .NET job exciting? Do you like what you do, and if you do what the hell are you doing? Cryolite fucked around with this message at 03:53 on May 25, 2014 |
# ? May 25, 2014 03:50 |
|
Unity3d is pretty cool. It uses C# as a language.
|
# ? May 25, 2014 09:41 |
|
Cryolite posted:Does anyone here do interesting work in .NET and like what they do, or is it all boring CRUD LOB poo poo at the end of the day? Maybe look into F#?
|
# ? May 25, 2014 15:41 |
|
I've used C# for machine learning and text classification but try F#, it's cool.
|
# ? May 25, 2014 20:07 |
|
Cryolite posted:Does anyone here do interesting work in .NET and like what they do, or is it all boring CRUD LOB poo poo at the end of the day? I get energized by writing client apps (for WindowsPhone+WindowsStore). It's fun because I can imagine normal people using the apps for fun. My next stop will be picking up Xamarin to extend to iOS and Android. Like they say, C# is the best language for mobile development (and VB). (My day job is also fun, working at Microsoft on the VB/C# compiler team and working the recent "universal apps" feature. But up until a few years ago that meant coding in C++, and nowadays the only thing I get to write is presentations in Powerpoint and specification documents in Word...) I definitely second the recommendation to look at F#. Every week the F# team at Microsoft circulates a list of cool F# projects, and they really are cool. If you get tired of cool then F# will also let you settle down to a super highly paid job in finance. F# used to generate the specification for the cladding of the new Louvre Museum in Abu Dhabi. More information... video Weekly roundup of F# news link F# is now included by default in Xamarin Studio link F# user groups map Data science in F# presentation. According to Harvard Business Review, "data scientist is the sexiest job of the 21st century" link
|
# ? May 25, 2014 22:10 |
|
Can anyone recommend a prescribed order for reading C# In Depth (Skeet), Dependency Injection in .NET (Seeman), and Art of Unit Testing (Osherove)? I'm working on a project whose components I understand, but I feel unqualified to make the high level design decisions that underlie much of the work. I'm not in a huge rush - I hope to cobble a small working prototype by September - but I want to do things as correctly as I can in the meantime. Hence, the books.
|
# ? May 26, 2014 00:43 |
|
Newf posted:Can anyone recommend a prescribed order for reading C# In Depth (Skeet), Dependency Injection in .NET (Seeman), and Art of Unit Testing (Osherove)? C# in Depth is a good survey of the deeper features of C#. It's a good starting point. I haven't read the Seeman book, but based on the title it's about ways to handle one method of achieving loose coupling, which is important for unit testing. Osherove's book is an awesome intro to unit testing. So: 1/2: C# in Depth / TAOUT 3: DI
|
# ? May 26, 2014 01:29 |
|
That has more or less been my plan. I really don't have any experience with unit testing, but given everyone's opinion on it I'm terrified to write code for my own applications before I understand some of it. The big problem is that lots and lots of this system will be non-deteministic in nature, so I'm still not sure exactly where and how to appropriately unit test. I'm taking reading suggestions, too, by the way
|
# ? May 26, 2014 01:54 |
|
Cryolite posted:Does anyone here do interesting work in .NET and like what they do, or is it all boring CRUD LOB poo poo at the end of the day? Yea I've got a pretty cool job, write a tablet based mapping application in wpf it's pretty interesting. I'd say it's probably out of the norm though.
|
# ? May 26, 2014 22:16 |
|
I wonder if one of your Visual Studio gurus can help me: I have a medium sized web app that I run in VS2013. It is a solution with several web projects in it. Lately debugging my app in IE11 has become painfully slow. If I run it without debugging in any browser (including IE) it runs flawlessly, and debugging in a non-IE browser also runs without any problems. I can't figure out what is causing the slowdown. Lately I have:
Some other info:
Any ideas?
|
# ? May 27, 2014 02:04 |
|
Xarb posted:I wonder if one of your Visual Studio gurus can help me: Are you running any plugins?
|
# ? May 27, 2014 03:02 |
|
Ithaqua posted:Are you running any plugins? I tried running the IE11 profiler and it is a bit interesting. This is without debugging (this happens over about 3 seconds) This is with debugging (this takes about 22 seconds) All that "other" is what is taking so much time, no idea what it is. I wonder if there is still some VS profiling code being executed somewhere.
|
# ? May 27, 2014 04:07 |
|
ljw1004 posted:
If this is true, SA is truly taking over here. Also I second (third, fourth) the F# suggestion. I picked up F# for C# developers and it's been a good starting point. The book of F# has also been quite good.
|
# ? May 27, 2014 13:12 |
|
Cryolite posted:Is your .NET job exciting? Do you like what you do, and if you do what the hell are you doing? I admit my perspective is skewed because I'm only 21 and have 3 years in the industry. I started off as an intern at a company that writes loan software and got pulled on as a part-time junior developer. I eventually decided to move to a less enterprise-facing part of the company, still in a developer role, because I found that most of my tasks became menial and droning. As in, for 8 hours a day, 5 days a week, my work consisted of "change this ID in the database. okay. now move this textbox about 20 pixels to the left. add a new textbox." Which, at the time, was a great learning experience. Don't get me wrong. But when I moved, I also basically inherited a tool suite that the business analysts used almost exclusively. Which was cool, because I didn't have a lot of direction anymore, ergo there was a lot of room for creativity. I worked for like a solid month to get the application to not perform like dog poo poo and simultaneously not look like dog poo poo. I got to write my own MVC API completely from scratch, and that now exists in production, working smooth as butter. We're lucky because here, we get to use WPF for our application (not counting the VB6 app, but that's on it's way to actually being phased out and deprecated.) MVC, obviously, for our web APIs. The guy I replaced had a bad habit of pulling libraries off of recommendations from Stack Overflow, so there's been a lot of poo poo we had to filter out, but for the most part, it's been an enjoyable learning experience. Admittedly, loan software is not a very interesting field - but having, to some extent, a blank check with the code means you get to have a bit of fun. And it's pretty satisfying when you get to solve issues that senior developers attempted to solve, but didn't quite get there. For an example of cool stuff I wrote - our main application uses tiles for the main menu, and there was some attempt to make the tiles a little less boring than how it looked, well, gray-ish: Well, I wrote an algorithm that guesses the color of the icon by taking a 10x10 grid of evenly spaced pixels (so as 1024x1024px icons wouldn't take forever to process) and comparing it with several main colors (e.g. red, green, blue, yellow, et cetera): Things I also wrote - an error reporting framework that adheres to the log4net categories, since the previous method of reporting an error was, well, special, and had no idea about categories, even though the rest of the app used log4net. It took about 20 extra lines of code for each error, instead of feeding the exception to a method or handling unhandled exceptions. Which it now does. It's probably stupid, boring poo poo in reality, but hey, I'm having fun with it.
|
# ? May 27, 2014 15:11 |
|
Cryolite posted:Does anyone here do interesting work in .NET and like what they do, or is it all boring CRUD LOB poo poo at the end of the day? I'm doing backend web development. I frickin love it. I like it a lot more than when I was doing PHP web dev, tbh. I like C#, and the ASP.NET stack has come a LONG ways in the last few years. PHP feels like bush league, now. (No offense to PHP guys, I still have fond memories of it.) I dabble in frontend here and there, as needed. Honestly, if you want a bigger variety, you need to find a smaller dev agency, or a bigger corporate team that is run like a startup. That's what I've always done, and I love the aspect of wearing different hats at different times based on what's needed that week. It has some disadvantages, but I much prefer it.
|
# ? May 27, 2014 19:00 |
|
I'll jump in and say I picked up .Net after a several year hiatus and I'm converting VB6 apps to .Net on a case by case basis to familiarize myself with what's new. Most of the apps I deal with communicate via serial ports or special interface cards. It's amazing how many industrial products have .Net APIs now. Async is a big deal with these and if it wasn't for ljw1004 posting his videos here in SA, I'd still be struggling to understand it.
|
# ? May 27, 2014 19:36 |
|
I'm trying to take a class I wrote in c++, rewrite it into a dll, and use it from c#. As is, I'm compiling the dll and copying it into the c#'s directory, but debugging is impossible. Is there any way to step through the DLL's code as the c# program is accessing it?
|
# ? May 27, 2014 21:59 |
|
bobua posted:I'm trying to take a class I wrote in c++, rewrite it into a dll, and use it from c#. C# program's options screen -> Debug -> check "Enable unmanaged code debugging"
|
# ? May 27, 2014 22:42 |
|
Vandelay Industries?
|
# ? May 27, 2014 22:46 |
|
GrumpyDoctor posted:C# program's options screen -> Debug -> check "Enable unmanaged code debugging" The only option I see is 'native code' I'm assuming that's the same thing? Is there something else I need to include somehow? I assume I need to tell c# where the source code to the dll is or something?
|
# ? May 27, 2014 23:01 |
|
Just to sanity check, you did compile your c++ in debug mode, right?
|
# ? May 28, 2014 00:59 |
|
Yeah. Might have to toss this whole idea out the window. It's crashing on an opencv gpu function call and googling the error returns nothing. Are there some sort of limitations of a DLL or is it supposed to be able to do anything an exe can do basically? I had a c++ function that took an image, and ran a guassian blur( http://docs.opencv.org/modules/gpu/doc/image_filtering.html#gpu-gaussianblur ) on it. When I try and put it in a dll and call it, it crashes at the first call to a gpu function( http://docs.opencv.org/modules/gpu/doc/initalization_and_information.html?highlight=getcudaenabled#int gpu::getCudaEnabledDeviceCount() ) Would there be something special about that in this whole cpp dll -> c# scenario? This is my first foray into compiling\using a dll.
|
# ? May 28, 2014 01:24 |
|
bobua posted:The only option I see is 'native code' I'm assuming that's the same thing? bobua posted:Is there something else I need to include somehow? I assume I need to tell c# where the source code to the dll is or something? If the C++ code is in a separate project in the same solution, VS will figure it out no problem. If not, you'll have to wave some dead chickens and sacrifice a goat or something. There's a way to do it but I can never consistently figure it out. What I want to suggest is to step into the native call (via P/Invoke, right?) and wait for VS to ask you where the original source is. Making sure the .pdb that was emitted with the .dll is in the same directory as well wouldn't hurt. As an intermediate testing step, you can try calling into the .dll from some other native code.
|
# ? May 28, 2014 02:52 |
|
I have a (VB) program I wrote that will be put on one of several computers in an office. 1--The program is only made to run with one user at once, and multiple users trying to run it at the same time will jack things up. 2--It is OK if it is run from any one of the PCs, just not more than one at any time. 3--It is also OK if it is just limited to only running on the PC that it is installed on. Without depending on a server-type program, is there any easy way to do this? Allow only one single instance to run at all times/on all machines? Or at least, block it so that only one instance will run, and only on the PC it is installed on. I have found info about having the program check for a certain unlocked file on starting, and then locking that file while the program is in use. Or setting a binary value in a registry key the same way. The problem I see with both of these is that they would not automatically reset if the program crashed.
|
# ? May 28, 2014 19:06 |
|
edmund745 posted:Without depending on a server-type program, is there any easy way to do this? Allow only one single instance to run at all times/on all machines? Without an authoritative server or some complicated distributed application setup, you can't guarantee that the program won't be run on other machines. On your own machine, however, there are many ways to make sure you aren't running multiple instances of the same program. See http://stackoverflow.com/questions/6392031/c-sharp-how-to-check-if-another-instance-of-the-application-is-running for one example.
|
# ? May 28, 2014 21:46 |
|
GrumpyDoctor posted:I'm really curious about what's causing this - if you figure it out, be sure to post it! So I'm fairly certain it must be an EF bug or EF threading issue. Building out the data from a stored procedure rather than going through LINQ/EF fixed this. This was regardless of the fact that stepping through the code in the debugger worked very quickly.
|
# ? May 28, 2014 22:28 |
|
edmund745 posted:I have a (VB) program I wrote that will be put on one of several computers in an office. What do you mean by "jack things up"?
|
# ? May 28, 2014 22:37 |
|
edmund745 posted:I have a (VB) program I wrote that will be put on one of several computers in an office. Are all of the machines on the same subnet? You could use some kind of UDP broadcast on startup to say "hey, is anyone else running the app?" Or, you could designate one machine to run it on, install it as a Windows Service that can auto-restart if it crashes (maybe with some kind of error reporting in there too, to let you know)
|
# ? May 29, 2014 06:49 |
|
Ithaqua posted:What do you mean by "jack things up"? Hopefully this doesn't involve an Access database.
|
# ? May 29, 2014 16:39 |
|
code:
Instead, it shrinks it by a LOT more(but places it in the right place). If I mess with the dpi\original size of bitmap1, it changes the resulting size, but I'm not understanding the relation. I've also tried DrawImage's (image, int, int, int, int) overload. edit: apparently it does work that way, my bitmap just had a strange transparency that made it look smaller than it really was. bobua fucked around with this message at 21:51 on May 29, 2014 |
# ? May 29, 2014 20:31 |
|
Ithaqua posted:What do you mean by "jack things up"? When one user edits the file, the file is saved and re-read to view the changes. Each file is only kept open long enough to write an edit, and then closed. The problem with more than one user at a time is that each user would not see all changes unless they made an edit themselves, since that's the only time that the file normally gets re-read. Each user can manually re-read the file any time they want but there isn't anything to tell them to do that. It's just plain text files and the files themselves would still function if they were edited by more than one instance at a time, but each user would be reverting the other's last edit every time they themselves made an edit. I tried googling but all I could find was guides on how to get one VB program to start a program on another PC, not detect it and stop it.... I guess that I could just store the date-time of the file write when a change is made, and then just re-check that every ~3-5 seconds. If the file has a different date-time on it than what was stored, then that would mean that somebody else made edits and the file needs to be re-read again. ------ I don't think this is going to be a major issue if they are just told to only use it on one PC. It would just be nice to have something in there to prevent it.
|
# ? May 29, 2014 20:32 |
|
The files are located on a network share? Your program can just lock the files which are being edited: C# code:
Note: file locking capabilities depend on the OS and file system. If you're running a Windows stack you should be OK.
|
# ? May 29, 2014 20:57 |
|
edmund745 posted:I guess that I could just store the date-time of the file write when a change is made, and then just re-check that every ~3-5 seconds. If the file has a different date-time on it than what was stored, then that would mean that somebody else made edits and the file needs to be re-read again. Or you could use FileSystemWatcher to be notified whenever changes to the files are made.
|
# ? May 30, 2014 14:16 |
|
Or he could use an appropriate data storage mechanism instead of messing around with flat files.
|
# ? May 30, 2014 14:59 |
|
|
# ? Jun 4, 2024 13:46 |
|
Is there anything like 'source control' for stored procedures, besides "just use git and welp there you go?" Also, I've found myself doing some DB-janitoring lately. I'm NOT the DBA - we actually have one, thank god - but I still find myself wanting to think of what the best way to back up tables is. Just dump to an excel? I need to start scripting some of this poo poo don't I.
|
# ? May 30, 2014 16:26 |