Given an array of integers, what is the simplest way to iterate over it and figure out all the ranges it covers? for example, for an array such as:
$numbers = array(1,3,4,5,6,8,11,12,14,15,16);
The ranges would be:
 1,3-6,8,11-12,14-16
...
            
           
          
          
            
            I have a table which contains my server status
create table ServerStatus
(
    ServerId int, 
    StartTime datetime, 
    Seconds int,
    [State] char(8) 
)
I would like a query that given a start and end date will summarize the time the server spends in each state during that time. I would also like the query to return the amount o...
            
           
          
            
            Hi, if I have a range of say 000080-0007FF
and I want to see if a char containing hex is within that range, how can I do this?  Thanks a lot.
Example
char t = 0xd790;
if (t is within range of 000080-0007FF) // true
Thanks
...
            
           
          
            
            Hi, 
let's say I have a excel spread sheet like below:
col1   col2
------------
dog1   dog
dog2   dog
dog3   dog
dog4   dog
cat1   cat
cat2   cat
cat3   cat
I want to return a range of cells (dog1,dog2,dog3,dog4) or (cat1,cat2,cat3) based on either "dog" or "cat"
I know I can do a loop to check one by one, but is there any other me...
            
           
          
            
            I'm looking for a macro which can be run to select a consistent range of cells so that I can easily copy them to another spreadsheet. The range would be F3:BJ3.
Thanks for your help.
nlh
...
            
           
          
            
            Hi all,
I recently learnt that oracle has a feature which was pretty useful to me - as the designer/implementator didn't care much about data history - I can query the historical state of a record if it's available yet in the oracle cache, like this:
select * 
  from ( select * 
           from sometable where some_condition ) 
as of t...
            
           
          
            
            Hello,
I am trying to generate a random number with Java, but random in a specific range. For example, my range is 5-10, meaning that 5 is the smallest possible value the random number can take, and 10 is the biggest. Any other number in between these numbers is possible to be a value, too. 
In Java, there is a function random() in the...
            
           
          
            
            Hello..
MySQL column > sdate, edate ( its 2 column).
sdate is start date for project starting and edate is end date for project ending.
so i need to make search between them..
<strong>Search</strong><br />
<form method="post" action="search.php">
  Start Report Date : <input type="text" name="sdate" />
  End Report Date : <input type...
            
           
          
            
            The code below is checking performance of three different ways to do same solution.
    public static void Main(string[] args)
    {
        // for loop
        {
            Stopwatch sw = Stopwatch.StartNew();
            int accumulator = 0;
            for (int i = 1; i <= 100000000; ++i)
            {
                accumulator +...
            
           
          
            
            Suppose I have a std::vector (let's call it myVec) of size N.  What's the simplest way to construct a new vector consisting of a copy of elements X through Y, where 0 <= X <= Y <= N-1?  For example, myVec [100000] through myVec [100999] in a vector of size 150000.
If this cannot be done efficiently with a vector, is there another STL da...
            
           
          
            
            Hi there, I'm having some trouble with a large spreadsheet of mine. I bring in a lot of raw data into a data sheet, and then do a number of lookups across the data. Using built in functions I've come up with
=IF(ISNA(INDEX(Data!$L$7:$L$1100,MATCH(Data!$I$2&$B$199&$B29&Data!$J$5,Data!$K$7:$K$1100&Data!$J$7:$J$1100&Data!$I$7:$I$1100&Data!...
            
           
          
            
            I need to generate a list of sequential numbers.  I know Ruby you can do 1..10 or PHP you can do range(1, 10).  Anything like that in .Net already, or do I have to write it?   Thanks.
...
            
           
          
            
            Using Excel Interop (.NET) how can we set programmatically two different Excel formulas for every other column. For instance, 
Range r = _sheet.get_Range(_sheet.Cells[1, 1], _sheet.Cells[I, J])  
r.Formula = "=something1"
will do it for every cell.  
But within J columns every other column has to have formula "=something2".
The size ...
            
           
          
            
            Imagine a scenario where, using xml, the user is able to specify ranges in a flexible manner, using any combination of "gte", "gt", "lte", "lt" or "eq".
Here are some examples
<rangeElement gte="0" lt="5" ... />
<rangeElement gt="3" lte="7" ... />
<rangeElement eq="5" ... />
<rangeElement gt="10.5" ... />
Now what I need is two class...
            
           
          
            
            Is there a way to step between 0 and 1 by 0.1? I thought I could do it like the following but it failed:
for i in range(0, 1, 0.1):
    print i
Instead, it says that the step argument cannot be zero, which it's not.
Thanks.
...
            
           
          
            
            I want to find a string in a word document and delete everything after it. 
What is the best way to do this without using the selection object?
Thanks
...
            
           
          
            
            The default 
[1..5]
gives this
[1,2,3,4,5]
and can also be done with the range function. Is it possible to change the step size between the points, so that I could get something like the following instead?
[1,1.5,2,2.5,3,3.5,4,4.5,5]
...
            
           
          
            
            Given a set of random numeric values in a database, how do I generate a limited list of ranges where each range contains at least one value? The ranges should not overlap and ideally have a similar amount of values in them. Ideally their boundaries should also be multiples of 10, 100, 1000 etc...
For example:
Values: 100,150,180,300,40...
            
           
          
            
            Hey,
I need to build a full "number range" set given a series of numbers.  I start with a list such as :
ID   START  
*    0  
a    4  
b    70  
c    700  
d    701  
e    85
where "def" is the default range & should "fill-in" the gaps  
"overlaps" are value (70, 700, 701) in starting data
And need the following result:  
ID  ST...