Hello there,
I don't know if there is an easy way to do it but basically what I would like to do is:
var highlights = db.Banners.Where(h => h.Category == "highlight").ToList().GetRange(0,4);
I have this model Banners where I have some highlights but I would like to retrieve just 4 random highlights each time in different order.
So th...
Hello i
Have a "vector of vectors"
that looks something like this
3 1 2 0 77
0 3 1 2 44
1 0 3 2 29
3 0 1 2 49
I would like to sort them according to the last element in every row so that it would look like this in the end
1 0 3 2 29
0 3 1 2 44
3 0 1 2 49
3 1 2 0 77
Of course my real example is a lot more complex... but this is ba...
I want to remove all lines where all the second column 05408736032 are same
0009300|05408736032|89|01|001|0|0|0|1|NNNNNNYNNNNNNNNN|asdf| 0009367|05408736032|89|01|001|0|0|0|1|NNNNNNYNNNNNNNNN|adff|
these lines are not consecutive. Its fine to remove all the lines . I dont have to keep one of them around.
Sorry my unix fu is really w...
In class we were given a simple decision tree for sorting 3 elements (a,b,c).
While looking at this, it makes sense to me. I was able to follow it.
However, I now have to make a decision tree for 4 elements (a,b,c,d) and the number of leafs just shot up to 24.
I'm struggling approaching the decision tree in a methodical way that h...
Could anyone can tell me how to add effect to all divs?
jQuery:
data = $("#sortable_list1").sortable("serialize");
update:function()
{
$.ajax({
data:serial,
url:"list.php",
type:"post",
success:function(data){
$("#serverResponse").html(data);
}
});
}
Html:
I have 2 divs which id is sorta...
It seems that i'm missing something trivial.
Anyway, here it goes:
var order = new[]{1,3,2};
var foos = new[]{new Foo{Id=1}, new Foo{Id=2}, new Foo{Id=3}};
How to sort foos by order array using Linq?
Desired result:
foos == new[]{new Foo{Id=1}, new Foo{Id=3}, new Foo{Id=2}};
Edit:
Order contains Foo ids. Sorry that i didn't m...
You have (up to 100) distinct sets of (2-4) numbers. The order of the sets or numbers in the sets does not matter. The highest number relates to the number of sets and goes up to 30. Like:
{1 2 3 4}
{1 2 3 5}
{1 2 3}
{1 2 4 5}
{6 2 4}
{6 7 8 9}
{6 7 9}
{7 8 9}
{2 4 8 9}
The goal is, to arrange these sets in a particular order, where tw...
I need to be able to sort the items of a combobox so they will be in alphabetical order. how would I do this?
...
I'm using VBA to sort columns in Excel 2003. I need to sort by column 5 ascending, then column 3 using a custom order, then by column 4 ascending. I'm having difficulty getting the sort to work and I don't totally understand how OrderCustom applies.
Any pointers in the right direction would be appreciated :) My code is below.
With wsDa...
For sorting item names, I want to support numbers correctly. i.e. this:
1 Hamlet
2 Ophelia
...
10 Laertes
instead of
1 Hamlet
10 Laertes
2 Ophelia
...
Does anyone know of a comparison functor that already supports that?
(i.e. a predicate that can be passed to std::sort)
I basically have two patterns to support: Leading number (as...
I'm trying to write a merge sorting algorithm in Perl and I've attempted to copy the pseudo code from Wikipedia.
So this is what I have:
sub sort_by_date {
my $self = shift;
my $collection = shift;
print STDERR "\$collection = ";
print STDERR Dumper $collection;
if ( @$collection <= 1 ) {
return $c...
Is there any guarantee that the array of filenames returned from a glob (e.g. <*>) will be sorted?
I can't find that sorting is mentioned one way or the other in the documentation, but it seems to be the case in every directory I've tried it on.
I'm talking about using this syntax:
@files = <*>;
If I need the files to be sorted, wou...
Hi,
I have in a form two combo boxes that have the exact itemssource property. Both combo boxes need to be sorted, but in two different ways. One is sorted by the ID (numeric), the other one by Name(Alphabetic).
Is it possible to do such a thing?
Thanks
...
If I have an object as such:
class Person {
var $age;
function __construct($age) {
$this->age = $age;
}
}
and I have any array of Person's
$person1 = new Person(14);
$person2 = new Person(5);
$people = array($person1, $person2);
Is there an easy way to sort the $people array by the Person->age property?
...
Hi, I have a groovy list of lists i.e.
list = [[2, 0, 1], [1, 5, 2], [1, 0, 3]]
I would like sort it by order of the first element, then second, then third.
Expected
assert list == [[1, 0, 3], [1, 5, 2], [2, 0, 1]]
I started with list = list.sort{ a,b -> a[0] <=> b[0] } but that only sorts the first element. How do you finish?
Th...
I have two tables, like this:
Table 1
A
1 FirstPhase
2 SecondPhase
3 ThirdPhase
4 FourthPhase
Table 2
A B
1 Item1 FirstPhase
2 Item4 FourthPhase
3 Item2 SecondPhase
4 Item3 ThirdPhase
The result I want to achieve after sorting is:
A B
1 Item1 FirstPhase
2 Item2 SecondPhase
3 Item3 ThirdPhase
4 Item4 FourthPhase
...
I have a GridView that is using a LinqDataSource which is tied to a table in my database. This table of mine has a int foreign key. In my presentation layer, using TemplateField in Gridview, i hide the foreign key value and make another call to the database to show the name of it's associated name so it's more readable for the user.
Ho...
Hello,
I have an application that makes use of Django's UserProfile to extend the built-in Django User model. Looks a bit like:
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
# Local Stuff
image_url_s = models.CharField(max_length=128, blank=True)
image_url_m = models.CharField(max_length=...
I have many files with results of command:
uniq -c some_file > some_file.out
For example:
1.out:
1 a
2 b
4 c
2.out
2 b
8 c
I would like to merge these results, so I get:
1 a
4 b
12 c
I thought that sort or uniq could handle it but I don't see any option related to it.
Writing some ruby/perl script is one of way to go...
I have a pet project where I build a text-to-HTML translator. I keep the content and the converted output in a directory tree, mirroring the structure via the filesystem hierachy. Chapters go into directories and subchapters go into subdirectories. I get the chapter headings from the directory and file names. I want to keep all data in f...