sorting

XSL - store unique and sorted data in a variable

痴心易碎 提交于 2020-01-16 19:43:13
问题 Using XSLT 2.0 and Apache FOP I want to be able to create a new variable, have unique and sorted values inside it by category but preserve the nodes. So the new variable should have the following nodes: <category>1. First Aid</category> <category>2. Access control</category> <category>3. Fire safety</category> <category>4. Recognition</category> The input XML is the following: <equipment> <E0132> <category>1. First Aid</category> <description>Lorem ipsum dolor sit amet, consectetur adipiscing

php, sort an array from mysql

谁都会走 提交于 2020-01-16 19:38:33
问题 I'm running a query on three columns; one column contains text, the other two contain numbers. I do a calculation on these numbers to get a new number called $average. I then spit out the result to an html table. The rows in the table are sorted in the order they come out of the database. I'm trying to sort the table so that the data is displayed from highest $average to lowest (while still be correctly associated with the correct text value from the first column). I've tried some asort and

How to sort a 3G bytes access log file?

自闭症网瘾萝莉.ら 提交于 2020-01-16 19:15:02
问题 Hi all: Now I have a 3G bytes tomcat access log named urls, each line is a url. I want to count each url and sort these urls order by the number of each url. I did it this way: awk '{print $0}' urls | sort | uniq -c | sort -nr >> output But it took really long time to finish this job, it's already took 30 minutes and its still working. log file is like bellow: /open_api/borrow_business/get_apply_by_user /open_api/borrow_business/get_apply_by_user /open_api/borrow_business/get_apply_by_user

How to sort a 3G bytes access log file?

♀尐吖头ヾ 提交于 2020-01-16 19:13:06
问题 Hi all: Now I have a 3G bytes tomcat access log named urls, each line is a url. I want to count each url and sort these urls order by the number of each url. I did it this way: awk '{print $0}' urls | sort | uniq -c | sort -nr >> output But it took really long time to finish this job, it's already took 30 minutes and its still working. log file is like bellow: /open_api/borrow_business/get_apply_by_user /open_api/borrow_business/get_apply_by_user /open_api/borrow_business/get_apply_by_user

Problem of result about swift array sorted

跟風遠走 提交于 2020-01-16 19:11:32
问题 I am facing a problem with array sorting. I am trying to sort an array, but not getting the result as expected. If I want to sort when the count are the same, they also get sorted by price. What's wrong with my approach? self.array = items.sorted(by: { (item1, item2) -> Bool in if item1.count > item2.count { return true } else { if item1.count == item2.count { if item1.price > item2.price { return true } } } return false }) this is my sort result: [Item(name: "AAA", count: 7, price: "30737517

Reading integers from a file with mixed integers, letters, and spaces C++

余生颓废 提交于 2020-01-16 18:48:29
问题 This is a sort of self-imposed extra credit problem I'm adding to my current programming assignment which I finished a week early. The assignment involved reading in integers from a file with multiple integers per line, each separated by a space. This was achieved easily using while(inFile >> val) . The challenge I put myself up to was to try and read integers from a file of mixed numbers and letters, pulling out all contiguous digits as separate integers composed of those digits. For

arraylist sorting in order

删除回忆录丶 提交于 2020-01-16 18:18:23
问题 Attempting to sort arraylist in alphabetical order but the Collection.sort is giving me an error which i do not what to do with it import java.util.ArrayList; import java.util.Collection; /** * * @author user */ public class BookShelf { ArrayList<Book> listOfBooks = new ArrayList<Book>(); public void addBook(Book book) { listOfBooks.add(book); } public ArrayList<Book> returnListOfBooks() { ArrayList<Book> myBook = new ArrayList<Book>(listOfBooks); Collection.sort(myBook); return myBook; } any

Manually sort a linked list in the C programming language

泪湿孤枕 提交于 2020-01-16 14:46:25
问题 How do you sort a linked list by name in a function in C? struct rec{ char name[20]; int nr; struct rec *nextRec; }; typedef struct rec Rec; /* synonym for struct rec */ typedef Rec *RecPtr; /* synonym for pointer */ void SortLinkedList(RecPtr *sPtr, int p_size);/* prototype */ int main() { RecPtr startPtr = NULL; /* filling upp the linked list... size = nr of nodes in list */ SortLinkedList(&startPtr, size); } void SortLinkedList(RecPtr *sPtr, int p_size){ int i, j; RecPtr tempPtr; RecPtr

Manually sort a linked list in the C programming language

放肆的年华 提交于 2020-01-16 14:46:12
问题 How do you sort a linked list by name in a function in C? struct rec{ char name[20]; int nr; struct rec *nextRec; }; typedef struct rec Rec; /* synonym for struct rec */ typedef Rec *RecPtr; /* synonym for pointer */ void SortLinkedList(RecPtr *sPtr, int p_size);/* prototype */ int main() { RecPtr startPtr = NULL; /* filling upp the linked list... size = nr of nodes in list */ SortLinkedList(&startPtr, size); } void SortLinkedList(RecPtr *sPtr, int p_size){ int i, j; RecPtr tempPtr; RecPtr

Sort 2nd nested array by value in 3rd with php

倾然丶 夕夏残阳落幕 提交于 2020-01-16 10:37:48
问题 Need to sort second nested array by a value n the third with php; 'Start Time'. Thinking maybe usort is the key. Posting the nested arrays of @week @day @class as well as a usort call and function I've been trying variations on. Array ( [Sunday] => Array ( [0] => Array ( [Class Name] => Fun Class [Instructor] => Fun Teacher [Class Type] => Yoga Stretches [Start Time] => 1899-12-30T17:00:00 [End Time] => 1899-12-30T18:15:00 [Day Name] => Sunday ) [1] => Array ( [Class Name] => Another Fun