Hello Fellow Developers:
I have an issue that I am sure someone out here have solved easier than what I am thinking to do. I have a list that have name and number. Name is required and could be duplicate and number could only be one, but not required.
|name|number|
|A |2 |
|A | |
|B | |
|C | |
|C | |...
Hey. I have a very large array and I want to find the Nth largest value. Trivially I can sort the array and then take the Nth element but I'm only interested in one element so there's probably a better way than sorting the entire array...
...
What's a fast way to sort a given set of images by their similarity to each other.
At the moment I have a system that does histogram analysis between two images, but this is a very expensive operation and seems too overkill.
Optimally I am looking for a algorithm that would give each image a score (for example a integer score, such a...
I have a data with the following format:
foo<tab>1.00<space>1.33<space>2.00<tab>3
Now I tried to sort the file based on the last field decreasingly.
I tried the following commands but it wasn't sorted as we expected.
$ sort -k3nr file.txt # apparently this sort by space as delimiter
$ sort -t"\t" -k3nr file.txt
sort: multi-charac...
Hey there.
This has been bugging me for some time now. I've tried several approaches and none have worked properly.
I'm writing and IRC client and am trying to sort out the list of usernames (which needs to be sorted by a users' access level in the current channel).
This is easy enough. Trouble is, this list needs to added to whenever...
I need to take a C++ vector with potentially a lot of elements, erase duplicates, and sort it. Looks like this code will do the trick: (Correction--it won't; next time I'll test before posting. Thanks for the feedback.)
vec.erase(
std::unique(vec.begin(), vec.end()),
vec.end());
std::sort(vec.begin(), vec.end());
Is it f...
We have a system that is based around Events that Users are invited to [UserInvite].
Currently, I have a page that lists all the Users invited to an Event; they can be sorted by various properties, such as Surname [ascending and descending]. All fine and dandy, but now I'm required to additionally sort by a UserInvite property: DateEdit...
I have a GridItemCollection defined as
GridItemCollection items = (GridItemCollection) Session["driveLayout"];
I want to sort the collection based off of one of the items in each GridItem. In particularly this item
item["VolumeGroup"].ToString().ToLower()
What is the best way to do this? Thanks
...
What would i need to put in the SortIP function to make the custom sort function sort the array by the last digit of the IP number. This doesn't work.
function SortIP(a, b)
{
return a[0][3] - b[0][3];
}
LAN = new Array
(
["ADSL Router", [192, 168, 0, 1]],
["Gary's Mac", [192, 168, 0, 15]],
["Network Switch", [192, 168, ...
Hi
I've got a DataGridView that has a DataTable as it's Datasource.
Whenever I sort a column and then edit a cell, after editing the column, the column autosorts so the recently edited cell is no longer in the viewable area. Is there any way to prevent this auto sort from happening and only sort when I click on the columns?
Many thanks ...
I'm working on sorting a list of objects, and unfortunately, I'm not quite getting the information from the debugging to see where I'm going wrong.
I have a custom class that I implemented a CompareTo method in, and I call .Sort() on a List of items of that class. Unfortunately, my program never actually gets to the compareTo() method.....
The following code makes a list of names and 'numbers' and gives each person a random age between 15 and 90.
#!/bin/sh
file=$1
n=$2
# if number is zero exit
if [ "$n" -eq "0" ]
then
exit 0
fi
echo "Generating list of $n people."
for i in `seq 1 $n`;
do
let "NUM=($RANDOM%75)+15"
echo "name$i $NUM (###)###-####" >> $file
d...
I have a python script which outputs lots of data, sample is as below. the first of the 4 fields always consists of two letters, one digit, a slash and one or two digits
Gi3/2 --.--.--.-- 0024.e89b.c10e Dell Inc.
Gi5/4 --.--.--.-- 0030.c1cd.f038 HEWLETTPACKARD
Gi4/3 --.--.--.-- 0020.ac00.6703 INTERFLEX DATENSYSTEME GMBH
Gi3/7 --....
Hi everyone.
I need your help.
Let me tell you what my problem is.
I have a text file as follows:
Music 3.6G
Other 254.5M
Videos 4.6G
Games 1.3G
Apps 10.1G
As you can see the file has two columns which consist of directory names and their appropriate sizes.
What i want to do is to sort this file by directory's size in a decreasing o...
I have a handful of records that I would like to sort based on a computed value. Got the answer over here... like so:
sorted (Profile.objects.all (), key = lambda p: p.reputation)
on a Profile class like this:
class Profile(models.Model):
...
@property
def reputation(self):
...
Unfortunately the generic view i...
I am attempting to write a SortableBindingList that I can use for my application. I have found lots of discussion about how to implement basic sorting support so that the BindingList will sort when used in the context of a DataGridView or some other bound control including this post from StackOverflow:
http://stackoverflow.com/questions...
Setup: I have a Struts web application where I use displaytag elements to do all of my table work. Each column is sortable.
Situation: When I click sort, on a long page, it sorts, but drops you at the top of the page.
Question: How do I use an anchor or some other method to come back to the table rather than the top of the page.
Additio...
What's the most efficient way to sort objects in an NSSet/NSMutableSet based on a property of the objects in the set? Right now the way I am doing it is by iterating through each object, add them to a NSMutableArray, and sort that array with NSSortDescriptor.
...
Does anyone have a macro that will take data from a compiled list, sort out a particular month, the paste only the sorted month into a new worksheet?
What I am setting up is a log where the samples are placed in the "Full List" by all employees and then when the boss wants to view only a certain months samples say January, he will be ...
If I have a javascript object such as:
var list = { 'you': 100, 'me': 75, 'foo': 116, 'bar: 15};
is there a way to sort the properties based on value? So that I end up with
list = { 'bar':15, 'me': 75, 'you': 100, 'foo': 116 };
I'm having a real brain-dead moment regarding this.
...