I've been running a podcast now for over 600 episodes and I do most of my recordings here at home using a Peavey PV6 Mixing Console - it's fantastic. However, I also work remotely and use Skype a lot to talk to co-workers. Sometimes I use a USB Headset but I also have a Polycom Work Phone for conference calls. Plus my webcams have microphones, so all this adds up to a lot of audio devices. Wi…
SO I figured out why I get a stackoverflowexception - I literally have too many items in a linkedlist, blowing the stack with a recursive method going through the list. The list pretty much hold data for each year. The method calculates something from that data. Usually this kind of data goes for a few decades max. I made an entry over 1100 years. THAT blew the stack.
Anyone know how to increase stacksize during runtime, from within the thread?
Tail call optimization is a compiler technique that changes the opcodes emitted in a recursive function. Right now it's doing a call function, return which means it has added one entry to your call stack (and thus why it can blow out). Tail optimization figures that 'call function, return' is pointless, and changes it to a 'jump to'. Thus, nothing is ever added to the call stack and you won't get stack overflow exceptions.
That said, I think Roslyn supports it now so you might want to check that out.
This list usually has like 5-10 elements, so really nothing to worry about. Unless someone like comes around and makes a contract running a thousand years.
We have an editor where you can select people; a scrollable table with checkboxes and names. There are usually 10-20 people in it. Until one customer decided to add 50k+ people. That's when all hell starts to break loose. A gentle reminder to always consider what happens when you don't count on large volume.
In my old job, we had this huge engine for MRP, so using a bill of materials, number of workers, their hours, raw materials in the warehouse, etc. to determine when orders can be completed and raw materials necessary for completing them
It was written in rpg which is sort of like a cobol type language (fortunately I stayed on the C++ side of things)
The whole thing required massive loading from the database, and even then, you had to punch in specific dates or it would load years of data to take into consideration
We're talking millions of records
A client had the fancy idea of putting the start date as the beginning of 1900 until now
I think he could have imagined that if it took 2 hours to come out with a result for last month, starting from the beginning of time was going to take quite a bit longer
They had the gallstones to complain about the speed
Figure that seeing that it was slow, they decided if they submitted 3 or 4 additional requests, it would somehow speed up!
So they kept submitting requests, each likely would have taken 24 hours to complete with the system working full speed
The whole system slowed to a crawl
I've never seen a shitstorm like that.
It doesn't surprise me anymore what users will rationalize
To my understanding a Thread.Sleep(0) force a context switch on the OS.
I wanted to check what was the maximum amount of time that could pass in an application before to receive some CPU time.
So I built an application that does Thread.Sleep(0) in a while loop (c#) and calculate the time that p...
To suspend the current thread for 0ms, I guess to allow the app to switch thread if there are others that need to be executed: msdn.microsoft.com/en-us/library/…
I suppose C# calls the Sleep function from the windows api: msdn.microsoft.com/en-us/library/windows/desktop/… - A value of zero causes the thread to relinquish the remainder of its time slice to any other thread that is ready to run. If there are no other threads ready to run, the function returns immediately, and the thread continues execution.
so there's some logic, but for the program I'm maintaining it's useless. This program has no dependencies and shouldn't care about other processes. Theres an OS that can handle that just fine.
my previous developer got so used to it so the other systems written in C# and C++ all set a dummy value for index 0 and start for loops at 1. There's a lot of lists, and they all point to each other via indexes. But I'm slowly removing that crap
On previous day, I encountered an unhandled exception thrown by this ConcurrentDictionary. The doc says it would throw if the key is non-existent yet. But this one doesn't. How come?
why is it that ConcurrentDictionary[key] or ConcurrentDictionary.TryGetValue throws a KeyNotFoundException when the key is not yet there? I am expecting it just to return a null value?