sorting

Excel VBA - Apply auto filter and Sort by specific colour

微笑、不失礼 提交于 2020-01-21 19:00:06
问题 I have an auto-filtered range of data. The auto filter was created by the following VB code: Sub Colour_filter() Range("A4").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False Selection.AutoFilter End Sub I would like to sort the values in column "A" (the data actually start from cell "A4") by the following colour ( Color = RGB

Sorting Alphanumeric field in SQL CE (Compact Edition) version 3.5

孤人 提交于 2020-01-21 12:52:00
问题 Sorting Alphanumeric field in SQL CE (Compact Edition) version 3.5 TreeNumber is a nvarchar field with a mix of numbers and strings for the values. I want to sort these records so that the records that contain alpha characters are at the top and the rest are sorted in numeric order. I want something similar to the following query which works in SQL Server: SELECT * FROM Tree ORDER BY (CASE WHEN TreeNumber LIKE '%[a-z]%' THEN 0 ELSE TreeNumber END), TreeNumber The above query doesn't seem to

How to sort 'find' results in bash by size

南笙酒味 提交于 2020-01-21 12:24:27
问题 I am wondering if there's an "easy" way (through a pipe or something) to order (by file size) the results of a "find" command in bash such as: find /location/of/directory/ -type f -size +2G 回答1: You can use %k for example to print the size in kilobytes: find . -type f -size +2G -printf "%kKB %p\n" | sort -n By saying -printf "%kKB %p\n" you are printing the file in kilobytes and then the name. sort -n gets this input and sorts it accordingly. See an example: $ find . -type f -size +1M -printf

Sorting a list of strings in Python [duplicate]

倖福魔咒の 提交于 2020-01-21 12:08:49
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How do I sort a list of strings in Python? How do I sort unicode strings alphabetically in Python? I have a list of strings list and want to sort it alphabetically. When I call list.sort() the first part of the list contains the entries starting with upper case letters sorted alphabetically, the second part contains the sorted entries starting with a lower case letter. Like so: Airplane Boat Car Dog apple

Sorting a list of strings in Python [duplicate]

谁都会走 提交于 2020-01-21 12:08:45
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How do I sort a list of strings in Python? How do I sort unicode strings alphabetically in Python? I have a list of strings list and want to sort it alphabetically. When I call list.sort() the first part of the list contains the entries starting with upper case letters sorted alphabetically, the second part contains the sorted entries starting with a lower case letter. Like so: Airplane Boat Car Dog apple

Ruby: Sort array of objects based on array of integers

ぃ、小莉子 提交于 2020-01-21 11:52:09
问题 This seems like its fairly simple, and should have been asked before, but everything I find on Stack Overflow doesn't seem to work. I have an array of 4 objects, and I'd like to re-order it in a particular order. So, it looks like this: array = [Obj1, Obj2, Obj3, Obj4] I have another array of integers which represent the desired order of the indices: desired_order = [2,3,0,1] So what I would like to see after ordering array properly is: array = [Obj3, Obj4, Obj1, Obj2] I've already figured

Ruby: Sort array of objects based on array of integers

試著忘記壹切 提交于 2020-01-21 11:52:08
问题 This seems like its fairly simple, and should have been asked before, but everything I find on Stack Overflow doesn't seem to work. I have an array of 4 objects, and I'd like to re-order it in a particular order. So, it looks like this: array = [Obj1, Obj2, Obj3, Obj4] I have another array of integers which represent the desired order of the indices: desired_order = [2,3,0,1] So what I would like to see after ordering array properly is: array = [Obj3, Obj4, Obj1, Obj2] I've already figured

Fastest sort algorithm for millions of UINT64 RGBZ graphics pixels

半世苍凉 提交于 2020-01-21 11:41:46
问题 I am sorting 10+ million uint64_t s with RGB data from .RAW files and 79% of my C program time is spent in qsort . I am looking for a faster sort for this specific data type. Being RAW graphical data, the numbers are very random and ~80% unique. No partial sorting or runs of sorted data can be expected. The 4 uint16_t s inside the uint64_t are R, G, B and zero (possibly a small count <= ~20). I have the simplest comparison function I can think of using unsigned long long s (you CANNOT just

Why does Python sort put upper case items first?

我的梦境 提交于 2020-01-21 11:21:14
问题 Not looking for a work around. Looking to understand why Python sorts this way. >>> a = ['aaa','Bbb'] >>> a.sort() >>> print(a) ['Bbb', 'aaa'] >>> a = ['aaa','bbb'] >>> a.sort() >>> print(a) ['aaa', 'bbb'] 回答1: This is because upper case chars have an ASCII value lower than that of lower case. And hence if we sort them in increasing order, the upper case will come before the lower case ASCII of A is 65 ASCII of a is 97 65<97 And hence A < a if you sort in increasing order 回答2: str is sorted

How to sort a String array alphabetically (without using compareTo or Arrays.sort)

主宰稳场 提交于 2020-01-21 10:15:09
问题 I need to organize an array of Strings alphabetically. In theory, the first letter of each word is capitalized (although not necessarily, because one can't always trust users). I have tried Arrays.sort() and it won't run the program. I have tried using compareTo() , and while it runs the program, when it gets to that section of code, I get this error: Exception in thread "main" java.lang.NullPointerException at java.lang.String.compareTo(Unknown Source) at NameandAge.printNameOrder(NameandAge