You need to add two more lines of CSS: To make the % height works use this: html,form {height:100%} And to avoid the padding increase the height of container use this .container-front { box-sizing:border-box; } Check the Snippet Below <!DOCTYPE html> <html> <head> <title>Sticky Header and Footer</title> <style type="text/css"> @font-face...

Maybe I don't understand something, but you can add two columns in group by, like the following example. Just add ,(comma) between the two or more columns. SELECT * FROM performs NATURAL JOIN athletes JOIN (SELECT athlete_id, MIN(perform) AS perform, category_id, discipline_id FROM zaznamy WHERE discipline_id = 4 GROUP BY...

you can get min , max dates in a subquery and then can get the results. select member_id, upper(name), registration_date from db.member cross join ( select min(registration_date) as minDate, max(registration_date) as maxDate from db.member ) t where registration_date in ( t.minDate, t.maxDate) or you can do it with in and...

Replace left--; with the following: left -= (left > 0 ? 1 : 0); ...

Depending on your RDBMS, you may be able to use ROW_NUMBER() to assign a ranking to each record and pick the one's that rank first. This is faster than using additional joins or correlated sub-queries, but isn't, for example, supported in MySQL at present. WITH sorted_supplies AS ( SELECT supplies.*,...

This function float average(int days) { for (int i = 1; i <= days; i++) { cout << "Enter the temperature for day number " << i << ": "; cin >> temperatures[i]; temptotal += temperatures[i]; //... is already wrong because element temperatures[0] will not be uninitialized. You have to...

With data like: Use the array formula: =MIN(IF((B1:B10="Credit")*(A1:A10>0),A1:A10)) Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key....

java,algorithm,collections,min

Keep a hash table of counts for each value, then update it and also the min if there are no more values equal to min in your hash table. // when increasing the i'th count coll[i] += 1; --hashTable[coll[i] - 1]; ++hashTable[coll[i]]; // check whether also to update the max:...

sql,sql-server,database,where-clause,min

Try this, though note technically the value 100 doesn't fall in the range 90-99 and therefore should probably be classed as 11, hence why the value 60 comes out with a scale of 6 rather than your 7: SQL Fiddle MS SQL Server 2008 Schema Setup: Query 1: create table...

You can use a generator expression with min. This will set m as the minimum value in a that is greater than 0. It then uses list.index to find the index of the first time this value appears. a = [4, 8, 0, 1, 5] m = min(i for i...

From the help page on ?min: pmax and pmin take one or more vectors (or matrices) as arguments and return a single vector giving the ‘parallel’ maxima (or minima) of the vectors. On the other hand: max and min return the maximum or minimum of all the values present in...

python,max,average,min,genetic-algorithm

You have this error because you're calling the method without passing any list (a population in this case).

There is no method for this in python. You can try using primitive methods to build what you want using lists. This code does the job: #!/usr/bin/python a = [] b = [] nums = raw_input("Enter input- ") #append all to a list for n in nums.split(): n = int(n)...

Given your criteria, the first two points of your sorting algorithm degenerate into one much simpler algorithm. That is: No matter which column is full of 0's, you are always sorting by first column, then by second column, then by third column ascending values. This will leave your target item...

You are pretty close. When working with correlated subqueries, always use table aliases to be absolutely clear about where the columns are coming from: select S.Date, Unit_price, (SELECT min(s2.Unit_Price) FROM table s2 WHERE s2.DATE BETWEEN s.DATE - interval 3 day and s.DATE - interval 1 day ) as min_price_3_days FROM...

In Python 2, numeric values always sort before strings and almost all other types: >>> sorted(['a', 5]) [5, 'a'] Numbers then, are considered smaller than strings. When using max(), that means the string is picked over a number. That numbers are smaller is an arbitrary implementation choice. See the Comparisons...

This: function GetMinMaxPrices(Array $prices) { if (empty($prices)) { return array(); } else { $return_arr = array(); } // Get highest and lowest for all keys: _regular_price, _sale_price, and _price. foreach($prices as $varBar => $price_info) { if ( !('' === $price_info['_price'] && '' === $price_info['_regular_price'] && '' === $price_info['_sale_price']) ) {...

how about the following: // assume students.length > 0 static void printMinMax(Student[] students) { Student min = students[0]; Student max = students[0]; for (Student student: students) { if (student.getGrade() > max.getGrade()) max = student; if (student.getGrade() < min.getGrade()) min = student; } System.out.println("Best student: " + max); System.out.println("Worst student: "+...

Disclaimer: I'll add my own answer to the question just in case anyone else is still interested in more details on the matter. Some theory ... I looks like this issue is more complex than I expected. As Alexey Romanov has already pointed out, the notion of incomparability would require...

Collect the triagers with tMax value in loop and put them into the string. Set rngValues = [C5:C32] Set rngTables = [A5:A32] tMax = Application.WorksheetFunction.Max(rngValues) idx = Application.Match(tMax, rngValues, 0) For Each IssuesCount In rngValues If IssuesCount.Value = tMax Then Triagers = Triagers & IIf(Triagers = "", "", " and...

I would do, you can access it with a lambda: lowest = min(alist, key=lambda o: len(o.attr_name)) that will sort the items by that attribute....

I think what you want is to use a Common Table Expression (CTE), which specifies a temporary result set that you can query on. The MIN function used with an OVER clause to divide the result set produced by the FROM clause into partitions to which the function is applied....

Here you are using assignment operator = instead of comnparison operator == if (c = 1) The loop for finding minimum and maximum can be written simpler for ( c = 1; c <= n; c++ ) { scanf_s( "%d", &value ); if ( c == 1 ) { max...

The main problem here is the last line: else (temp)))))) The parentheses are incorrect here—the else keyword needs to be within the parens. Changing that to this: (else temp)))))) ...fixes the algorithm. You also aren't calling maxmin properly—it needs a list, not a series of parameters. Your final line of...

This is equivalent to SELECT i601_ID, MIN(row) AS row FROM SortPlaetzeDate. It assigns the name "row" to the second column. "AS" is optional.

python-3.x,matrix,max,return-value,min

Use the built-in functions max() and min() after stripping the list of lists: matrix = [[1, 2, 4], [8, 9, 0]] dup = [] for k in matrix: for i in k: dup.append(i) print (max(dup), min(dup)) This runs as: >>> matrix = [[1, 2, 4], [8, 9, 0]] >>> dup...

You could use: DateTime dateFrom = models .SelectMany(d => d.Trans) .Select(tr => Convert.ToDateTime(tr.PostingDate)) .Min(); DateTime dateTo = models .SelectMany(d => d.Trans) .Select(tr => Convert.ToDateTime(tr.PostingDate)) .Max(); If the type of PostingDate is already a DateTime, you don't need the Convert call: DateTime dateFrom = models .SelectMany(d => d.Trans) .Min(tr => tr.PostingDate);...

Use LEAST instead of MIN: UPDATE Inventory SET TargetPrice = LEAST(Price1,Price2) WHERE Quantity = 0 MIN is an aggregate function operating on a rowset, whereas LEAST operates on the list of arguments passed. EDIT: UPDATE Inventory SET TargetPrice = LEAST(COALESCE(Price1, Price2), COALESCE(Price2, Price1)) WHERE Quantity = 0 You can use...

prolog,order,min,swi-prolog,sicstus-prolog

The actual source of confusion is a common problem with general Prolog code. There is no clean, generally accepted classification of the kind of purity or impurity of a Prolog predicate. In a manual, and similarly in the standard, pure and impure built-ins are happily mixed together. For this reason,...

If you take the difference (using diff) then you're looking for where the difference is greater than 0. We search for the first time that happens u <- c(.5, .4, .3, .6) min(which(diff(u) > 0)) This gives us 3 which is close to what we want but not exactly. Since...

You can get the min and max rows separately with df1[which.max(df1[,2]),] Or df1[which.min(df1[,2]),] For plotting, may be df2 <- subset(df1, Number %in% c(min(Number), max(Number))) m1 <- t(df2[,2]) colnames(m1) <- df2[,1] barplot(m1) Update Using the example in the image, dfN <- data.frame(Col1=c('Controlli di Polizia Giudiziaria', 'Ricrosi a seguito di contravvenzioni', 'Ordinanze...

This query based on analytic functions lag() and lead() gives expected output: select id, nid, point from ( select id, point, p1, lead(id) over (order by id) nid from ( select id, point, decode(lag(point) over (order by id), point, 0, 1) p1, decode(lead(point) over (order by id), point, 0, 2)...

You can use this, This will order from Minimum price vendor product SELECT VENDOR.V_NAME, MIN(PRODUCT.P_PRICE) AS LOWEST_PRICE FROM VENDOR INNER JOIN PRODUCT ON VENDOR.V_CODE = PRODUCT.V_CODE GROUP BY VENDOR.V_NAME ORDER BY LOWEST_PRICE SQL FIDDLE:- http://sqlfiddle.com/#!3/467c8/2...

Any efficient way to calculate the maximum element in a 2-D array(or vector in your case) involves a complexity of O(n^2) irrespective of what you do, as the calculation involves a comparison between n*n elements.Best way in terms of ease of use is to use std::max_element on the vector of...

sql,sql-server,max,average,min

Remove b,c from group by and add period instead SELECT name,period, max(b), max(c), min(b), min(c) FROM tablename group by name,period ...

group <- "somegroup" groupwiseList$group is not the same as groupwiseList$somegroup You probably want to use groupWiselist[,group] instead. I didn't take the time to fully debug to see if this was the issue but it certainly stuck out to me....

As long as your compiler is optimizing that's probably as good as you're going to get. #include <algorithm> int test(int i, int j, int k) { return std::min(i, std::min(j, k)); } compiled with g++ -S -c -O3 test.cpp I get cmpl %edi, %esi movl %edx, %eax cmovg %edi, %esi cmpl...

Does this work for you? min(q, key = lambda x: (x[1],x[0])) ...

You don't need to worry about where the data ends, just skip the first two rows: Sub NotTheFirstTwoRows() Dim c As Range Set c = Range("C3:C" & Rows.Count) MsgBox Application.WorksheetFunction.Min(c) End Sub Because any blanks at the bottom of the column will be ignored....

You can use direct min or max SELECT max(time) from t; SELECT min(time) from t; http://sqlfiddle.com/#!3/3aad3f...

replace <input type="submit"/> to <button type="submit" value="" onclick="minmax();">Submit</button> and add JS function: function minmax() { min(); max(); } ...

If I understand correctly, this query is a bit trickier than it seems. Use a subquery to get the counts per category, using a window function to get the minimum count. Then join this back to the original data: select s.model, s.VIN, s.cost from stock s join (select category, count(*)...

The standard SQL to do this is: SELECT bus_id, stop_id, MIN(time) as time FROM tablename GROUP BY bus_id, stop_id ORDER BY bus_id, stop_id This will return the minimum value from the time field for each combination of bus and stop ID. I've also sorted the results using an ORDER BY...

java,arrays,loops,return-value,min

The logic of your program is: 1. Declaring an array of names. 2. Declaring an array of times. 3. Writing the names and times through a loop to the console. You also wrote a method to retrieve the minimum value within an int array, but you did not include that...

matlab,min,matrix-multiplication

I don't know your values so i wasn't able to check my code. I am using loops because it is the most obvious solution. Pretty sure that someone from the bsxfun-brigarde ( ;-D ) will find a shorter/more effective solution. alpha = 0:0.05:2; beta = 0:0.05:2; L1(kx3) = [t1(kx1) t2(kx1)...

You may use bsxfun like this for a generalized case. Code %%// Slightly bigger example than the original one mat= [ 1 2 3 6; 2 3 4 2; 3 4 5 3;] test = [ 2 3 4 8 5 6 7 1; 3 4 5 3 6 7...

std::max_element http://www.cplusplus.com/reference/algorithm/max_element/ std::min_element http://www.cplusplus.com/reference/algorithm/min_element/

A PivotTable may be easiest, with Name for ROWS and Min of Score and Max of Score for Sigma VALUES. HOWEVER, this gives a min of 170 for Ben: ...

Are you sure you're looking at the right source, and not just a compiled class in your IDE. I have the following: /** * A constant holding the minimum value an {@code int} can * have, -2<sup>31</sup>. */ public static final int MIN_VALUE = 0x80000000; /** * A constant holding...

select count(VIN), Category from STOCK having count(VIN)=(select max(count(VIN)) from STOCK group by Category ) OR count(VIN)=(select min(count(VIN)) from STOCK group by Category ) group by Category; ...

You can use MIN in the column list if you group the query appropriately: select a.skucode, a.sizecode, b.colourdescription as colourdesc, a.season, MIN(case when sp.eventnbr in (select eventnbr from event where sysdate between eventbegints and eventendts) then rate else sellprice end) as listprice from sku a INNER JOIN colour b ON...

A generic hash table is not a sorted list of elements. So it's going to be an O(n) operation to find the min() and max() of a given table.

oracle,oracle11g,where-clause,min

As well as missing a comma, your subqueries need to be enclosed properly in parentheses; and the ones you already have are unbalanced. Or rather, in the wrong place; you currently start those with SELECT(MIN... where it should be (SELECT MIN.... Move the opening parenthesis to before the subquery's SELECT,...

public static double min(double a, double b): "Returns the smaller of two double values. That is, the result is the value closer to negative infinity. If the arguments have the same value, the result is that same value. If either value is NaN, then the result is NaN. Unlike the...

You minimum cut is not s, a, c, but s, a, b, c. Its capacity is 5 which is the maximum flow that you've calculated. You can find the minimum cut by using the definition of the residual network. Recall that the Ford-Fulkerson terminates when there are no paths between...

UPDATE 2: According to the updated XML sample, assuming that you want to find minimum value of l attribute of line element, try this way : //page/block/text/par/line[not(preceding::line/@l <= @l) and not(following::line/@l<@l)]/@l output : Attribute='l="253"' UPDATE : Actually, by having combination of preceding-sibling::block/@l <= @l and following-sibling::block/@l < @l, there is...

One approach would be to store the previous two values lines in two variables, and use a third variable to store the line. So you could get the local minimum like this: awk 'prev!=""&&prev<=prev2&&prev<=$2{print line}{prev2=prev;prev=$2;line=$0}' file and the local maximum like this: awk 'prev!=""&&prev>=prev2&&prev>=$2{print line}{prev2=prev;prev=$2;line=$0}' file ...

You can get the minimum value first, then get the item that has the minimum value: var minValue = items.Min(x => x.Value); var item = items.First(x => x.Value == minValue); You can also do that in one line that won't be efficient because it will perform Min for each item:...

When you write open(file), Python is trying to find the the file tc.out in the directory where you started the interpreter from. You should use the full path to that file in open: with open(os.path.join(root, file)) as f: Let me illustrate with an example: I have a file named 'somefile.txt'...

javascript,arrays,object,max,min

You could call Math.min and Math.max, passing in a mapped array containing only the relevant values like this: function endProp( mathFunc, array, property ) { return Math[ mathFunc ].apply(array, array.map(function ( item ) { return item[ property ]; })); } var maxY = endProp( "max", pts, "Y" ), // 8.389...

There are several ways to do that. 1) A simple one is to use this script. 2) If the data is not large, you can write your own algorithm analyzing gradient in each point or analyzing increment: 1D array jmin=0; jmax=0; for j=2:length(M)-1 if (M(j)>M(j-1))&&(M(j)>M(j+1)) jmax=jmax+1; max_index(jmax)=j; max_value(jmax)=M(j); end; if...

If I understand correct and since you're already using dplyr, you could do it like this: library(dplyr); library(tidyr) unite(df, X, ID1:ID2, sep = ".") %>% mutate(Position = row_number()) %>% group_by(X) %>% slice(which.min(value)) #Source: local data frame [4 x 3] #Groups: X # # X value Position #1 1.1 1 1...

matlab,min,matrix-multiplication,bsxfun

I believe you need this correction in your code - [minindex_alongL2, minindex_alongL1] = ind2sub([size(L2,1) size(L1,1)],p) For the solution, you need to add the size of p into the index finding in the last step as the vector whose min is calculated has the "added influence" of alpha - [minindex_alongL2, minindex_alongL1,minindex_alongalpha]...

I think all of your sub-queries can be replaced with this simple one ;WITH CTE AS ( SELECT * , ROW_NUMBER() OVER (PARTITION BY c_code ORDER BY c_key) rn FROM c_dim WHERE flag = 'X' ) DELETE FROM CTE WHERE rn > 1 ...

A bit of a non-scalable solution would be to drop 2014 and then call max and min - tr2['max07_13']=tr2.drop('2014', axis=1).max(axis=1) If you know the columns of interest, you can also use that - columns_of_interest = ['2007', '2008', '2009', '2010', '2011', '2012', '2013'] tr2['max07_13']=tr2[columns_of_interest].max(axis=1) ...

From your Explanation it looks like you need something like below: 1) SELECT Sales , date FROM TABLE_NAME WHERE Sales = ( SELECT MIN(Sales) FROM TABLE_NAME) 2) SELECT Sales , date FROM TABLE_NAME WHERE Sales = ( SELECT MAX(Sales) FROM TABLE_NAME) In single Query SELECT Sales , date FROM TABLE_NAME...

mysql,max,greatest-n-per-group,min,create-table

SELECT tmin.Name, tmin.ValueA, tmax.ValueA, tmin.ValueB1, tmin.ValueB2, tmax.ValueB1, tmax.ValueB2 FROM ( SELECT Name, MAX(ValueA) AS ValueAMax, MIN(ValueA) AS ValueAMin FROM `foo` GROUP BY Name ) AS t JOIN `foo` AS tmin ON t.Name = tmin.Name AND t.ValueAMin = tmin.ValueA JOIN `foo` AS tmax ON t.Name = tmax.Name AND t.ValueAMax = tmax.ValueA;...

The answer from this link shared in the comments: const double mid = std::max(std::min(x,y),std::min(std::max(x,y),z)); Edit - As pointed out by Alan, I missed out on a case. I have given now a more intuitive proof. Direct Proof: Without Loss of Generality with respect to x and y. Starting with the...

Update Specific answer : SQL> WITH Equip_price AS 2 ( SELECT 1 pid, 1 equipmentID, 50 price FROM dual 3 UNION ALL 4 SELECT 2 , 2 , 20 FROM dual 5 UNION ALL 6 SELECT 3 , 1 , 100 FROM dual 7 UNION ALL 8 SELECT 4 ,...

Most probably you have a variable named min that shadowed the built in min function. If you are using the interactive console just do: del min Also consider using numpy, as it can be faster on bigger lists: >>> import numpy >>> numpy.min(mylist) ...

With Tim's answer you'll have the first item that matches the condition. Just in case you have several items with the same price and you want to have the index of all these items, you can use this : int minPrice = closingsBook.Min(book => book.LimitPrice); var indexes = closingsBook.Select((book, index)...

Something like this will get what you want: SELECT LEFT(FirstIssued, 6) AS YYMM, COUNT(DISTINCT Policy_No) AS NumPolicies FROM ( SELECT Policy_No, MIN(issue_date) AS FirstIssued FROM table_a WHERE indicator = 'fln' GROUP BY Policy_No ) A GROUP BY LEFT(FirstIssued,6) The key is to first find the min date for each policy,...

c#,linq,extension-methods,ienumerable,min

This could happen if enumerable changes between the calls. It seems GetNetworkRoutes uses lazy evalution to return the result. And that's why it's result is enumerated each time you call Min method on it. So the second returns different results and that's why the min. value you get is different....

android,max,min,android-datepicker

You can try replacing this line: return new DatePickerDialog(this, pDateSetListener, pYear, pMonth, pDay); By those: DatePickerDialog dpDialog = new DatePickerDialog(this, pDateSetListener, pYear, pMonth, pDay); DatePicker datePicker = dpDialog.getDatePicker(); Calendar calendar = Calendar.getInstance();//get the current day datePicker.setMaxDate(calendar.getTimeInMillis());//set the current day as the max date return dpDialog; in the same way you...