Question : SQL Agent Job Alert for Long Running Jobs

Using SQL 2005 and have many sql agent jobs to perform application functions.  We use Notify to alert when a job fails.  Looking for a way to use either Alerts or Notify to email us when a job runs longer than a defined time period, say 2 minutes.

Answer : SQL Agent Job Alert for Long Running Jobs

For iterators... It may look not so at the first time, but iterators are a kind of more natural.  When you solve a problem, you tend to think in terms "process all elements from...", or mathematically "for all elements in...".  The only conventional way to do that is to use a loop.  The while loop in C-family languages is too general; you have do some steps on your own.  The for loop in C-family languages is a small syntactic improvement of the while.  In other programming languages, the for loop is a counted loop.  But this also means that you have to transform an index to the indexed element.  Because of that, you often tend to put the elements into some indexed structure -- to an array or to a vector.

If you think more about it, what your really need is a kind of generalized loop that loops through all elements of a container without neccessarily preparing some numeric index.  If you personify the process, the worker says to another one "give me the next one", and not "give me the 3254th one".  This is exactly what iterators are good for.  The iterator is somehow type-bound to the container.  Then you may be not interested in internal details (whether it is indexed inside, or whether it is a linked structure).  In other words, the iterators bring more abstraction.

Unfortunately, the iterators are newer than the core of C++ and therefore there is no generalized loop and syntax to make all of this more apparent syntactically.  Once you get used to better sytax of the generalized loop (in other languages, like in Python where iterators work almost magically, hidden), you really miss that syntax in C++.  The new C++ standard is going to improve it a bit.
Random Solutions  
 
programming4us programming4us