|
Destroyenator posted:I feel like there should be a more idiomatic way of doing it, but it works. do initial requests using an HttpWebRequest instead of a web client. you can specify an HTTP request that only gets header information (e.g. Method = "HEAD"). try to set an object or add the valid request url to a list only if the list is empty or the object is null
|
# ? Feb 17, 2015 18:07 |
|
|
# ? May 17, 2024 12:02 |
|
chippy posted:I'm afraid I don't know the answer to your specific question but this looks to be a good starting point: Sorry, should've specified this was Lync 2013, but I looked around for that documentation and think I found the 2013 versions of the articles you linked, so thank you! I should really utilize MSDN more often.
|
# ? Feb 17, 2015 18:11 |
|
TheEffect posted:I was just wondering if the following was possible with VB.Net- Why don't you just sign your scripts so everyone can run them, if you think it can be done via PowerShell?
|
# ? Feb 17, 2015 18:16 |
|
EssOEss posted:When spawning new processes and fiddling with their input/output streams, I always create a new thread for each stream and handle any synchronization manually. Perhaps wasteful in some sense but it has been rock solid so far, without any pesky little issues due to assuming an order of data consumption/generation. I think this is what I'm going to do - when using separate threads, the process runs in under a second, but with the async way it takes more than ten. When I step through with the debugger nothing takes that long so I have no idea how to even begin solving the problem.
|
# ? Feb 17, 2015 18:33 |
|
Destroyenator posted:I feel like there should be a more idiomatic way of doing it, but it works. Thanks, this is wonderful. Now I need to figure out how it works. Thanks a bunch!
|
# ? Feb 17, 2015 18:45 |
|
EssOEss posted:Why don't you just sign your scripts so everyone can run them, if you think it can be done via PowerShell? Because I don't control the certificate server for my org unfortunately.
|
# ? Feb 17, 2015 19:18 |
|
Our third party order entry system uses SQL server on the backend(database A). I have number of table valued functions which I use to generate reports using a internal MVC web app, the web app calls them directly with System.Data.SqlClient. The web app has it's own database(B) and I use Entity framework, LINQ and lambas to make my life easy. I current have all those table valued report functions stored in database A. Is there any down side to moving all those functions to database B and adding them to the entity framework for easy of use?
|
# ? Feb 17, 2015 23:09 |
|
I have a question that might be a bit stupid. I'm doing some experimentation with Win2D and I noticed that the Vector classes and Drawing methods all use floats, but the CanvasControl uses doubles for its Height and Width. Why is that? Compatability with old stuff while using a smaller type for faster calculations? Does anyone have any insight into this?
|
# ? Feb 18, 2015 12:20 |
|
anyone have recommendations for a good ASP.NET MVC 5 book?
|
# ? Feb 18, 2015 16:29 |
|
I've been using a practice of my own for well over a decade and I want to run it past everyone to see if I am behind the times or something. Basically when you have a Parent->Child relationship in SQL where the Parent is more or less a description and the children are transactions, I leave cascading update/deletes open in SQL for ease of maintenance by the DBA or if there is an archiving feature or something. Sometimes I don't want to let a user delete a Parent and the entire history with it by accident in an application. To handle this in the past, I used to query the parent and children and then create a property to allow deletion. This property was dependent on the children being returned from the database and carried along with the parent object. I had my own type which was a three-phase Boolean. It basically returned CanDelete/NoDelete/NoData with NoData being returned if the children were lost or never returned from the database. This allowed me to choose what to do (e.g. reQuery, force delete, etc..) depending on the context at the moment. Fast forward and I am using the Nullable Boolean instead. It works great because of the method GetValueOrDefault(T) which returns a value if it HasValue or a default value so you can choose what to do when Null. I've been using this like crazy. Problem is I am also using other Nullable types to represent Sums, Averages, Counts, etc... for display so for example: code:
Is this bad? I have Nullable fields on almost all of my models similar to the above. It seems solid but, I have a nagging feeling I am overusing Nullable types and trusting something too much. Like they are inherently dirty and will stab me in the balls when I'm not looking.
|
# ? Feb 18, 2015 21:25 |
|
So at work, I'm having a massive issue with Massive, and MySQL. Once every few days, the App Pool in our IIS server shits the bed. Looking at the event logs, I get:quote:Application: w3wp.exe Ooof, that's bad. What's worse is I can't replicate it on our Staging server, nor on my dev machine. Elmah got nothing either, as well as any of the other logging stuff we have set up. Basically, it just crashes, and I don't know why. So, in a fit of desperation, I put the IIS Debugger tools on to get a Minidump... in Production. So once I got a dump, I turned off the debugger and took a look. quote:Unhandled exception at 0x000007FD89AA7B8C (KERNELBASE.dll) in w3wp__DefaultAppPool__PID__3392__Date__02_18_2015__Time_04_05_37PM__13__First Chance Access Violation.dmp: 0xC0000005: Access violation reading location 0x0000000000000040. And the call stack: So MySqlConnection tries to get the server version (for some reason), then it blows up... but this does not happen all the time. The start of the call stack is a normal call requesting data to be shown, and as far as I can tell there is nothing special about it. It just... happens. I thought it might have been an updated MySQL driver causing it, but I rolled that back to the version we had before and the same thing happens (Although less often it seems, but that's probably just happenstance). Any ideas? Anything else I should look at? Myself and another web dev looked at my previous commits trying to see if I introduced something that would cause it, but from what we can tell there is nothing obvious from the changes I made that would cause this to happen.
|
# ? Feb 18, 2015 22:02 |
|
Your call stack explains the reason why it's trying to get the server version - New Relic is using it for analytics. You might have encountered a bug triggered by reentrancy, as i see that ServerVersion.get is ultimately being called within OpenConnection thanks to the analytic shim... does that require a connection to be already open? Does it open one itself? Either would be bad.
|
# ? Feb 18, 2015 22:21 |
|
Gul Banana posted:Your call stack explains the reason why it's trying to get the server version - New Relic is using it for analytics. You might have encountered a bug triggered by reentrancy, as i see that ServerVersion.get is ultimately being called within OpenConnection thanks to the analytic shim... does that require a connection to be already open? Does it open one itself? Either would be bad. I'm going to end up getting rid of NewRelic for now and see if that helps. It should be using the same database connection from what I can tell, but maybe something else in it is opening up another one? And only some of the time? I'm going all over it, but I asked around and it does not seem to be very useful for us at the moment so I can just turn it off.
|
# ? Feb 18, 2015 22:47 |
|
Kuvo posted:anyone have recommendations for a good ASP.NET MVC 5 book? Pro ASP.NET MVC 5 by Freeman. I started reading it and a week later I was building a production site from scratch. It's not genius or a scintillating read but it works. RICHUNCLEPENNYBAGS fucked around with this message at 02:36 on Feb 19, 2015 |
# ? Feb 19, 2015 02:32 |
|
This is a hypothetical question I guess, since I've already done it, and it's going to be replaced by the real solution (make the proc on the database return the right results) eventually. But I found myself in need of filtering down one datatable based on the contents of another. I just threw together a quick and dirty Linq-y style thing since I knew it would work:code:
|
# ? Feb 19, 2015 04:42 |
|
Kuvo posted:anyone have recommendations for a good ASP.NET MVC 5 book? I am pretty new to the .net/mvc game myself, but this book is around at work and its been pretty good as a reference /overall view of things combined with MSDN docs for specifics. I don't really have anything to compare it to, however, and there may be better ones out there.
|
# ? Feb 19, 2015 06:15 |
|
I'm trying to play around with the profiler in VS2013, and I keep seeing "ThePreStub" show up. Is this just function call machinery? Googling just turns up references to ngen, which I'm not using.
|
# ? Feb 19, 2015 06:26 |
|
RICHUNCLEPENNYBAGS posted:Pro ASP.NET MVC 5 by Freeman. I started reading it and a week later I was building a production site from scratch. It's not genius or a scintillating read but it works. I bought the beginner's version of this book a couple weeks ago and it was absolute poo poo. If you can write a for loop already get this 'pro' version.
|
# ? Feb 19, 2015 17:48 |
|
I've inherited a really, really sloppy application at work and I have done virtually no *real* web development to speak of. The application has an <asp:GridView> that gets its data source bound when the user clicks a Search button. ViewEditProjects.aspx.cs: code:
code:
I know BoundField has a NullDisplayText and DataFormatString property but I can't seem to achieve what I'm looking for with that.
|
# ? Feb 19, 2015 22:31 |
|
bobua posted:I bought the beginner's version of this book a couple weeks ago and it was absolute poo poo. If you can write a for loop already get this 'pro' version. I think "pro" means "for a professional programmer," not "for ASP.NET MVC pros." Anyway this guy churns out like 10 books a year or something so I'm sure there's a lot of recycled content there.
|
# ? Feb 19, 2015 23:34 |
|
Sab669 posted:this 'myCol' BoundField can display 3 values: "Yes", "No", or "Select" (it's not a Mandatory field so whoever originally wrote this just writes Select to the DB). I'd just like to show an empty string in place of "Select" in the grid, is that possible? You can listen for the RowDataBound event on the GridView. Then you can use something like this to change the values: C# code:
|
# ? Feb 20, 2015 15:25 |
|
e; nevermind stupid type-o. Thanks Bognar
Sab669 fucked around with this message at 16:33 on Feb 20, 2015 |
# ? Feb 20, 2015 16:28 |
|
What's the best framework to go with for game dev? I just want to mess around with F# and have a little fun.
|
# ? Feb 21, 2015 21:32 |
|
Well, if you're using F# that rules out playing with Unity. XNA is dead since Microsoft doesn't support it anymore, but it's more like a Dawn of the Dead or 28 Days Later kind of dead where it can still run real fast and gently caress poo poo up. There's also SFML.Net and OpenTK, but I haven't played with either. I hear Duality is a good option for 2D style games. I'd probably say go with XNA even though it's not supported, since you're just messing around. It probably still has the most documentation available, so it shouldn't be too hard to get something running. EDIT: Maybe check out MonoGame? Never used it, but it looks like it will work with F#: https://bruinbrown.wordpress.com/2013/10/06/making-a-platformer-in-f-with-monogame/ Bognar fucked around with this message at 22:17 on Feb 21, 2015 |
# ? Feb 21, 2015 22:15 |
|
I recommend MonoGame. It's coming along great. Just make sure you get one of the nightly builds which are quite stable. 3.2 doesn't have any of the new pipeline stuff that its in the nightly builds.
|
# ? Feb 21, 2015 22:38 |
|
Thanks very much guys, I'll have a look at monogame. It'll make a change from parsers.
|
# ? Feb 21, 2015 22:58 |
Oh, God. I am not good with .Net. How did I get here? I have an object (a big, complicated object with much inheritance, and not of my creation) which is owned by the main thread in a C# WPF application. I spawn a second thread that does all the meaty stuff, and some of that meaty stuff is dependent on the object in question. The meaty stuff will also occasionally make changes to the object, which will be reflected in the GUI. I need to pass the object back and forth between the threads, and I am just failing all over the place. It seems like, no matter what I do, I end up with those "owned by another thread" exceptions. I am starting to think crazy thoughts, like round-robin invoking between the threads. I've never had this problem, before, and I can't figure out what is different, this time. Thread A: Creates object, assigns it as source of GUI element. Thread B: Creates another object based on the first object. Does **something** to this new object, then turns around and publishes changes to the original object. The above story is pure fiction, but it's what I'd like to see happen.
|
|
# ? Feb 22, 2015 22:43 |
|
Centripetal Horse posted:Oh, God. I am not good with .Net. How did I get here? Examine the Dispatcher class and decide which method you want to use. The ones that invoke the method synchronously on the dispatcher's thread will block the current thread until the operation is completed on the other thread. For async stuff you want either InvokeAsync() which has new style tasks, or BeginInvoke() for the old style. Here is a simple example: code:
|
# ? Feb 22, 2015 23:17 |
|
Centripetal Horse posted:Oh, God. I am not good with .Net. How did I get here? Why do you need to pass it between threads? Edit: Why do you need to create another object if the changes need to passed on to the other one? Why not update the object right away and update the UI accordingly?
|
# ? Feb 22, 2015 23:18 |
Inverness posted:Examine the Dispatcher class and decide which method you want to use. The ones that invoke the method synchronously on the dispatcher's thread will block the current thread until the operation is completed on the other thread. I am moderately familiar with Dispatchers, which is how I usually get things done between the UI and other threads. That's why I'm puzzled, here. Mr Shiny Pants posted:Why do you need to pass it between threads? Maybe I don't. I'm not sure how to give a good explanation without going into boring detail about what I'm working on. The gist of it is, the object is going to undergo a large number of transformations before finding one that is suitable for display. I don't want to manipulate it directly and show all the intervening steps. A quick rundown/overview: User loads an image file through a standard dialog. This file is loaded into an object that is a descendant of the Bitmap class. That becomes the source for an image control on the GUI. A thread is spawned to do the real work. This thread needs to create another object based on the original. The worker thread needs not only basic information such as height, width, pixel format, and so on, but also access to the actual pixels of the original. Every once in a while, I want to update the object that is being shown by the GUI.
|
|
# ? Feb 22, 2015 23:47 |
|
How big is the image? Will it cause significant performance problems to just make a copy of it and do your work on the copy in another thead? If not, just do that, then you're free to do whatever you want to the copy without worry about updating the UI, then you can sync back to the UI whenever.
|
# ? Feb 23, 2015 01:27 |
|
Bognar posted:How big is the image? Will it cause significant performance problems to just make a copy of it and do your work on the copy in another thead? If not, just do that, then you're free to do whatever you want to the copy without worry about updating the UI, then you can sync back to the UI whenever. I think this is exactly what he wants to do but he doesn't get it to work.
|
# ? Feb 23, 2015 06:33 |
|
Are you trying to read the image from a picturebox in the worker thread or something? I'm not sure why else you'd get those exceptions.
|
# ? Feb 23, 2015 15:10 |
|
Mr Shiny Pants posted:I think this is exactly what he wants to do but he doesn't get it to work. I guess I misunderstood what he was saying - the way I read it, it seemed like he was working with the same object in both threads. Seeing some code would really help here.
|
# ? Feb 23, 2015 15:17 |
Bognar posted:How big is the image? Will it cause significant performance problems to just make a copy of it and do your work on the copy in another thead? If not, just do that, then you're free to do whatever you want to the copy without worry about updating the UI, then you can sync back to the UI whenever. The image can be of any size. I am not too worried about the overhead of passing it around. If it becomes an issue, I can just adjust the frequency of the updates. Mr Shiny Pants posted:I think this is exactly what he wants to do but he doesn't get it to work. Bognar posted:I guess I misunderstood what he was saying - the way I read it, it seemed like he was working with the same object in both threads. Seeing some code would really help here. I would prefer to work on one object, but I've been failing. I fail just as badly if I try to make a copy specifically for the worker thread. I guess I can try re-opening the file from the worker thread, and re-doing whatever work is involved in loading and pre-processing the image, but I don't like the sound of that. I'm far enough along that it would be tough to separate out just the bits in question. HappyHippo posted:Are you trying to read the image from a picturebox in the worker thread or something? I'm not sure why else you'd get those exceptions. It's am Image control, which I think is equivalent to a PictureBox. I get the "owned by another thread" exceptions whether I try to use the Bitmap-descended object, or try to access the control. It's been a couple of years since I did anything in WPF/.Net, but I don't recall ever having quite this issue. I'm starting to feel like a bit of a dick for wasting everyone's time, because I am sure this is just me missing some fundamental concept. I haven't run into this problem, before.
|
|
# ? Feb 23, 2015 18:22 |
|
Centripetal Horse posted:It's am Image control, which I think is equivalent to a PictureBox. I get the "owned by another thread" exceptions whether I try to use the Bitmap-descended object, or try to access the control. It's been awhile but I believe you can't access a control from a thread other than the one it was created in. With winforms you had to use InvokeRequired / Invoke to get access. Some googling tells me you have to use Dispatcher to do the same with WPF. So maybe you should look into that?
|
# ? Feb 23, 2015 18:30 |
|
Centripetal Horse posted:Oh, God. I am not good with .Net. How did I get here? I'd go about this entirely a different way. The insight is * Pretty much most of your code can be done fine on the UI thread because it's not CPU-intensive * There are a few CPU-intensive bits but these are generally "pure functions" that take in some input, give back an output, and don't need access to all the objects in memory. So do most of your code on your single UI thread. That way you don't need to worry about thread-safety. When you encounter the small piece of code which has a compute-intensive inner loop, then run only the smallest part of it you can on a background thread via Task.Run. For instance, code:
|
# ? Feb 23, 2015 18:32 |
|
Centripetal Horse posted:I would prefer to work on one object, but I've been failing. I fail just as badly if I try to make a copy specifically for the worker thread. I guess I can try re-opening the file from the worker thread, and re-doing whatever work is involved in loading and pre-processing the image, but I don't like the sound of that. I'm far enough along that it would be tough to separate out just the bits in question. Are you copying the object reference, or are you actually copying the image bytes over? This is really hard to diagnose without code.
|
# ? Feb 23, 2015 19:42 |
|
Any of you guys ever had to programmatically connect to Google drive and grab the content for use/insertion into a database? We've got a marketplace that we're doing good sales on, but they have zero automation for sales reporting, order importing, etc. So the way our staff keep track of them is to update a Google Spreadsheet Doc. The idea being I'd connect to Drive, open this sheet, and grab new rows and put them in the database. I've found and am messing around with this: https://developers.google.com/resources/api-libraries/documentation/drive/v2/csharp/latest/annotated.html But am just wondering if anyone else has done it and if they have any 'gotchas' or advice.
|
# ? Feb 23, 2015 22:26 |
|
|
# ? May 17, 2024 12:02 |
|
VS2015 CTP 6 came out earlier today, along with the first CTP of TFS 2015, with all the awesome new build stuff.
|
# ? Feb 23, 2015 23:06 |