When I have a repository with both lightweight and annotated tags, git-for-each-ref only seems to sort one of the sets. I would like to modify my call to for-each-ref to get output which sorts all the tags and intermixes them in the output. For example:
bash-3.2$ git tag | xargs -I T git log -n 1 --format='%at T' T | sort -rn | awk '...
I have two arrays used in a small game.
If the player gets a score above a certain value their name & score gets output via
an UILabel.
NSArray *namesArray = [mainArray objectForKey:@"names"];
NSArray *highScoresArray = [mainArray objectForKey:@"scores"];
I need the UILabels to display with the highest score in descending order,...
There is a plugin that I am trying to adapt for my meta_tags for use with WordPress.
It is called Categories by Title by http://www.mikesmullin.com.
What I am trying to achieve is a nested sort. I have three meta_keys. A selection-no, release-month, and release-year. I would like to sort posts within their category by release-year (as...
I have an existing bit of code for sorting a list of objects.
productsList.Sort(
delegate(Product p1, Product p2)
{
int result = p1.StartDatetime.CompareTo(p2.StartDatetime);
if (result == 0)
{
if (p1.SomeId == p2.SomeId)
{
result = 0;
}
else if ...
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;
/...
Here's the scenario.
I have one hundred car objects. Each car has a property for speed, and a property for price. I want to arrange images of the cars in a grid so that the fastest and most expensive car is at the top right, and the slowest and cheapest car is at the bottom left, and all other cars are in an appropriate spot in the grid...
I am new to Python and am curious if I am doing this correctly. I have a tuple of dicts (from a database call):
companies = ( { 'companyid': 1, 'companyname': 'Company C' },
{ 'companyid': 2, 'companyname': 'Company A' },
{ 'companyid': 3, 'companyname': 'Company B' } )
I want to sort this on companyname. ...
I have an ObservableCollection of ViewModels that are sitting in a WPF DataGrid. The DataGrid has three columns:
Position column; this is rendered at runtime by a UserControl that displays the position of the row in my DataGrid
Name column; this is rendered at runtime by a UserControl that displays the name of the column (yes, I need a...
Right, ok, I have followed Scott Gu's example in his part 9, etc, etc blog and despite my best efforts to achieve 'automatic sorting, paging and editing, I cannot get the so and so to work.
Is automatic sorting, paging and editing possible with the following set up?
<asp:TextBox ID="tbxHowMany" runat="server"></asp:TextBox>
<asp:R...
I have an NSArray containing numbers as NSString objects. ie.
[array addObject:[NSString stringWithFormat:@"%d", 100]];
How do I sort the array numerically? Can I use compare:options and specify NSNumericSearch as NSStringCompareOptions? Please give me an example/sample code.
...
Hi all,
I was wondering how people were going about sorting a table in asp.net mvc?
I've heard of javascript solutions that work pretty well with non-paged tables, such as jquery's table sorter, but i need a solution that will work with paged tables.
The project i'm working on currently uses the following solution, but i find it very m...
Hello,
I am parsing an XML and storing all data in NSMutableArray in form of Dictionary.
NSMutableArray * stories;
// a temporary item; added to the "stories" array one at a time,
// and cleared for the next one
NSMutableDictionary * item;
- (void)parser:(NSXMLParser *)parser
didEndElement:(NSString *)elementName
namespaceURI:...
I need to sort filenames that can have a common root, but are then followed by numbers that are not necessarily padded uniformely; one example is what you obtain when you rename multiple files in Windows.
filenamea (1).txt
filenamea (2).txt
...
filenamea (10).txt
...
filenamea (100).txt
...
filenameb.txt
...
filenamec (1).txt
filenamec ...
I need to sort a list of tuples by first item in descending order, and then by second item in ascending order.
To do this, I have implemented the following function, but I think it could be faster.
>>> compare = lambda a, b: -cmp(b[1], a[1]) if b[0] == a[0] else cmp(b[0], a[0])
>>> sorted([(0, 2), (0, 1), (1, 0), (1, 2)], cmp=compare)
...
I have two groups of files that contain data in CSV format with a common key (Timestamp) - I need to walk through all the records chronologically.
Group A: 'Environmental Data'
Filenames are in format A_0001.csv, A_0002.csv, etc.
Pre-sorted ascending
Key is Timestamp, i.e.YYYY-MM-DD HH:MM:SS
Contains environmental data in CSV/column...
So I'm having a slightly tricky issue...
I'm generating an XML file within a class I'm writing. Let's say this was the starting XML:
<base>
<container id="0">
<element type="Image" x="0" y"0" />
<element type="Image" x="100" y"0" />
<container/>
</base>
I want to add additional <element>'s. The first order of...
This is a continuation of questions like this one.
Is there known guidlines for tweek the performance. I don't mean gains in big-O, just saving some linear time.
For example, how much does pre-sorting save on either SortedList or SortedDictionary?
Say I have a person-class with 3 properties to sort on, one of them is age in years. Sh...
We're looking at different methods to sort the objects/elements in an array, the thing that doesn't make sense to me is how the actual sorting is done. I guess the big point of confusion is how can the "sort" method be effective if it only compares one object against another?
If there are values a, g, b, d, z, s, h in the array im not ...
I have a key => value table I'd like to sort in Lua. The keys are all integers, but aren't consecutive (and have meaning). Lua's only sort function appears to be table.sort, which treats tables as simple arrays, discarding the original keys and their association with particular items. Instead, I'd essentially like to be able to use PH...
In Go, what's the easiest way to get the keys in a map sorted alphabetically? This is the shortest way I can do it:
package main
import "container/vector"
import "fmt"
import "sort"
func main() {
m := map[string]string {"b":"15", "z":"123123", "x":"sdf", "a":"12"}
var keys vector.StringVector;
for k,_ := range ( m ) {
...