|Related to : Comment out different ranges of values in a file - Perl|
|SQL query to get average values over a list of time ranges|
case based aggregation is one way to do this in single query.
SELECT AVG(case when dateColumn > startRange1 && dateColumn
< endRange1 then column1 end) as range1Avg,
AVG(case when dateColumn > startRange2 && dateColumn
< endRange2 then column1 end) as range2Avg
for representing a specific instant in time. In other words, a date
and a time. They internally track time by counting the number of
milliseconds that have elapsed since the Unix Epoch (Midnight, Jan 1st
1970 UTC) - ignoring leap seconds.
That means, fundamentally, they are not the best way to work with
whole calendar dates.
|Version ranges in buildout.cfg|
A version spec with something = <= 1234 is invalid. Both an = and a
<= isn't the right syntax.
I'd treat the problem differently. You use your setup.py's
install_requires already to restrict buildout a version between 1.7
and 1.8. Buildout will respect that requirement, so you don't need to
duplicate it in the buildout config.
What buildout's version pinning is for is exactly that: pinning
|Algorithm to Compare Ranges|
You need to use BETWEEN operator like
select * from table1 where values between 30 and 60;
(OR) where values between 59 and 100;
You can as well use > and < operator to get the same evaluation
select * from table1 where values >= 30 and values <= 60;
If it's a range comparison as Strawberry pointed in comment then you
can check like
where 30 < 59 and 59 < 60 and 60 < 1
|Appending ranges in loop|
First off, the end result of your code would appear to be similar to
(Assuming, from your sample code, that aaa contains integers in the
If you can afford to simply copy, just use a backinsert iterator:
for (size_t i = 0; i < aaa.size(); ++i)
boost::copy(boost::equal_range(aaa, i), back_inserter(