Click here to Skip to main content
14,972,394 members
Everything / General Programming / Sorting

Sorting

sorting

Great Reads

by Christoph Buenger
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).
by Member 9294701
A simple, portable yet efficient Quicksort implementation in C
by The Sun God
Welcome to our Comparison on Sorting Algorithms Article. Here, we'll be comparing the various sorting Algorithms out there on the basic of several factors.
by brunofer2007
Easy way to sort nodes in a TreeView using a recursive function.

Latest Articles

by The Sun God
Welcome to our Comparison on Sorting Algorithms Article. Here, we'll be comparing the various sorting Algorithms out there on the basic of several factors.
by DotNetLead.com
How to implement paging and sorting to yield good performance
by Sandeep Mewara
Linear-time partition: A divide & conquer based selection algorithm
by InvisibleMedia
An algorithm for sorting integers with a complexity less than O(n log (n))

All Articles

Sort by Score

Sorting 

Please Sign up or sign in to vote.
31 Oct 2014
Christoph Buenger
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).
Please Sign up or sign in to vote.
13 Oct 2013
Member 9294701
A simple, portable yet efficient Quicksort implementation in C
Please Sign up or sign in to vote.
15 Mar 2011
Sergey Alexandrovich Kryukov
Don't use ArrayList. This type is obsolete since generics were introduced in v.2.0. Why do you need all those problems with type casting?Instead, use the generic class System.Collections.Generic.List, http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx[^]. For sorting use some of the...
Please Sign up or sign in to vote.
19 Jul 2021N
The Sun God
Welcome to our Comparison on Sorting Algorithms Article. Here, we'll be comparing the various sorting Algorithms out there on the basic of several factors.
Please Sign up or sign in to vote.
11 Sep 2011
brunofer2007
Easy way to sort nodes in a TreeView using a recursive function.
Please Sign up or sign in to vote.
13 Apr 2012
VJ Reddy
The reason is in the SortedList, the key is added as an integer. So, the order will be 7, 31, 32, 33. Whereas, in the DataTable the value is text, hence, the order is 31e, 32e, 33e, 7i.To get the same sort as in data table, add the key as text i.e.emp.Add(key, type);where key is 31e,...
Please Sign up or sign in to vote.
25 Apr 2012
VJ Reddy
The Array.Sort(Of TKey, TValue) Method (TKey(), TValue(), IComparer(Of TKey)) explained here http://msdn.microsoft.com/en-us/library/x8kwfbye.aspx[^] can be used for this purpose. In the present case, as the sorting is to be done in Descending order IComparer is required, which is explained here...
Please Sign up or sign in to vote.
8 Aug 2013
Antariksh Verma
Hi ,After doing lot of R&D in Kendo UI i got that if we want sorting ,filtering and paging on client side we have to add .ServerOperation(false) so that all functionality like Sorting and filtering works on client side.
Please Sign up or sign in to vote.
15 Jan 2021
DotNetLead.com
How to implement paging and sorting to yield good performance
Please Sign up or sign in to vote.
16 Mar 2011
Espen Harlinn
Using IComparer, as SAKryukov mentioned, is a good idea, and in your case it should look something like this:using System;using System.Collections.Generic;namespace Harlinn.CP.ScoreTest{ public class Score { private string name; private double...
Please Sign up or sign in to vote.
1 Oct 2015
phil.o
If only CodeProject had one of the best articles on the subject[^].
Please Sign up or sign in to vote.
1 Oct 2015
CPallini
You know the major sorting algorithms have been studied and their performance is known (I would reccomend the oldie-goldie Wirth's book[^] as starting point).If you are really curious to measure the performance on your set of data then no one prevents you in doing that.
Please Sign up or sign in to vote.
28 Nov 2015
Patrice T
I see 2 reasons for your program not listing the numbers sorted.First: you list the numbers before sorting them.Second: the sort routine is bugged to the core. The general layout is of an insertion sort, but it is bugged and don't work.Since it is HomeWork, no solution, but advices.-...
Please Sign up or sign in to vote.
23 Feb 2016
Patrice T
The output is correctYour mistake is that you sort a list of strings, not a list of numbers.so "6" fall between "54" and "77"a sort on strings is alphabetical.
Please Sign up or sign in to vote.
2 Sep 2020
Sandeep Mewara
Using Bubble sort, it would be something like: def sortTuple(t): for i in range(0, len(t)): for j in range(0, len(t)-i-1): if (t[j][1] > t[j + 1][1]): #notice here, I have used index 1 to use price as the value ...
Please Sign up or sign in to vote.
28 Oct 2020
Sandeep Mewara
Linear-time partition: A divide & conquer based selection algorithm
Please Sign up or sign in to vote.
20 Nov 2020
k5054
You need to tell sort how to compare the two structs. since there's no default comparison for non basic types. Do you want to sort by name or by grade, or by grade then by name, or ...? Probably the easiest way is to add an operator
Please Sign up or sign in to vote.
7 Dec 2009
Pete O'Hanlon
I would look at using the KeyPress event on the textbox and set e.Handled=true if the key was a spacebar (e is the KeyPressEventArgs for the event handler). Your code might look something like this:private void TextBox1_KeyPress(object sender, KeyPressEventArgs e){ e.Handled = e.KeyChar ==...
Please Sign up or sign in to vote.
7 Dec 2009
jasonpang2011
To add onto the answer above, the KeyPress event handler won't work unless you set KeyPreview to true. The KeyPreview property is on the Windows Form (click your form, look to the property box to the right, find KeyPreview, and set it to True). Or you can manually add the following to the...
Please Sign up or sign in to vote.
7 Dec 2009
AspDotNetDev
VB does not use a double equal sign to test for equality. It only uses a single equal sign. Try:e.Handled = (e.KeyChar = " ")Also, it doesn't use semicolons to end lines.
Please Sign up or sign in to vote.
17 Feb 2010
#realJSOP
Try this:emails = (from p in DatabaseConnection.Emails where p.Newsmail == true select p).Distinct();
Please Sign up or sign in to vote.
16 Mar 2011
#realJSOP
Don't use an ArrayList - use a generic collection. Once you've converted your code, check out this tip/trick:A Generic Comparison Class for Collection Items[^]
Please Sign up or sign in to vote.
26 Mar 2012
Søren Gullach
A Shunting yard algorithm in C#
Please Sign up or sign in to vote.
17 Apr 2012
Fredrik Bornander
If you have a Player class that looks something like this;package my.company;public class Player { private final double x; private final double y; public Player(final double x, final double y) { this.x = x; this.y = y; } public...
Please Sign up or sign in to vote.
16 Sep 2013
Philippe Mori
The easiest way to do it is to uses Link to objects.myContainer .OrderBy(x => x.FirstColumn) .ThenBy(x => x.SecondColumn);Alternatively, you can define your own comparison operator that will compare first column and if there is a match it will compare next column until the answer is...
Please Sign up or sign in to vote.
16 Sep 2013
Maciej Los
I would suggest you to use OLEDB[^] drivers with T-SQL command like this:SELECT Field1, Field2, ... FieldNFROM MyFile.csvORDER BY Field1How to: Use OleDb to import text files (tab, csv, custom)[^]Read Text File (txt, csv, log, tab, fixed length)[^]
Please Sign up or sign in to vote.
19 Sep 2013
Prasad Khandekar
Hello Ganesh,For jQGrid if datatype other than "local" the sorting needs to get handled on the server side. For client side sorting the datatype must be "local" and each sortable column must have the sorttype property set (see this[^] link to know more about server side paging and client...
Please Sign up or sign in to vote.
17 Oct 2013
Javier Tirado Pampín
This article talks about how to solve the filter problem in Telerik MVC Extensions control suite
Please Sign up or sign in to vote.
16 Jan 2014
Codes Of Shadows
Header Style Combo Box Drop Down Filter Button
Please Sign up or sign in to vote.
23 Mar 2014
BillWoodruff
After playing with the CheckedListBox a while, I am convinced you will find it much easier to implement this using two ListBoxes. The ListBox offers you built-in sorting by setting its 'Sorted Property to 'true.If you still really wish to use a CheckedListBox, hopefully this code will give...
Please Sign up or sign in to vote.
25 Mar 2014
CHill60
As Richard MacCutchan said, you will need to design a Database first to capture the information about each meal each user has had.Here's a link to a beginners guide to databases[^]Think carefully about the tables you will need and what sort of information you will need to...
Please Sign up or sign in to vote.
24 May 2014
CPallini
I wouldn't choose the different path inside the sort function. I would use instead different comparators. For instance, have a look at the following code:#include #include #include using namespace std;struct my_struct{ my_struct(int i, string...
Please Sign up or sign in to vote.
8 Oct 2014
Thomas Daniels
Take a look at these CodeProject articles:Natural Sort Comparer[^]Sorting Strings for Humans with IComparer[^]
Please Sign up or sign in to vote.
18 Feb 2015
PIEBALDconsult
Here's an example of a class that uses two Dictionaries.I do caution you about your first criterion as I'm sure my solution will have trouble if a value's priority is changed. DumbStuff.PriorityDictionary d = new...
Please Sign up or sign in to vote.
17 Jul 2015
Richard Deeming
Your timezone data doesn't contain the offset value, so you'll need to extract it from the label.Something like this should work:timeZone.sort( function( a, b ) { var re = /^\(GMT([+-]\d{1,2}):(\d{1,2})\).*$/; var aOffset = parseFloat(a.label.replace(re, "$1.$2")); var...
Please Sign up or sign in to vote.
22 Nov 2015
Patrice T
Obviously, your own code is like a blackbox to you. It don't do what you expect.What follow is not directly a solution to your problem, but a key that will help you to understand by yourself what is wrong.The debugger is your friend. It will show you what your code is really doing.Follow...
Please Sign up or sign in to vote.
27 Nov 2015
OriginalGriff
"didn't sort by real number !"OK - but we have no idea what data you were looking at, or how you decided that it didn't work.Plus, it's your homework, so it's a good idea that you sort this yourself - you will learn a lot more than if I fix it and give you the sorted code.So, its going...
Please Sign up or sign in to vote.
23 Feb 2016
F-ES Sitecore
This will convert the string to a number when doing the comparison;if (int.Parse(a.ElementAt(j)).CompareTo(int.Parse(a.ElementAt(j + 1))) > 0)However it will error if you add somenone non-numeric to the list. For a number sort you're best using LinkedList x = new...
Please Sign up or sign in to vote.
27 Apr 2016
OriginalGriff
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may find it...
Please Sign up or sign in to vote.
27 Apr 2016
CPallini
Don't search for code. Study algorithms instead. An oldie-goldie book is Wirth's one: "Algorithms + Data Structures = Programs - Wikipedia, the free encyclopedia"[^]. It could be a staring point, covering all but string matching.
Please Sign up or sign in to vote.
4 Jun 2016
OriginalGriff
Um...that's some odd code you have there!Start with your first method:int my_array(int _array[],int size ) { for(int i=0;i { return _array[i]; } }It always returns the first element in the array, unless the size is negative, in which case...
Please Sign up or sign in to vote.
20 Jun 2016
KarstenK
To achieve your own sort order you must overwrite the sorting algorithm, by overwriting the comparison operator "
Please Sign up or sign in to vote.
3 May 2017
InvisibleMedia
An algorithm for sorting integers with a complexity less than O(n log (n))
Please Sign up or sign in to vote.
14 Aug 2017
CHill60
You appear to have at least 6 tables with exactly the same schema. This is usually a sure sign that your database design needs some attention. From what I can see all of this information could be (and should be) stored in a single table. Add another column that indications the "BuildingType" -...
Please Sign up or sign in to vote.
4 Apr 2019
OriginalGriff
Take your string, and use Split, then sort the array: string query = @"id = 657ec95c439eb4a76e48c5ea7 & amount = 1 & notify_status = success & currency = USD & time = 20190403095815 & reference = 190403175800PTM03428 & notify_id = D0000036639 - a6d98e5d0a08d3e8850f & fields = id %...
Please Sign up or sign in to vote.
29 Jan 2020
phil.o
The concept you need to do your task is called External sorting[^].
Please Sign up or sign in to vote.
29 Jan 2020
OriginalGriff
The first thing to do is to start by looking at what you have to sort: what does the file contain that needs sorting? What does it need sorting by? Think about it: if you have a stack of mixed banknotes on your desk, there are many ways to sort them: by denomination, by colour, by size, by...
Please Sign up or sign in to vote.
15 Sep 2020
CPallini
Try ''' Program to implement Selection Sort The time complexity of above algorithm is O(n^2) ''' def find_min (list0): min = 0 for i in range(1,len(list0)): if list0[i]
Please Sign up or sign in to vote.
13 Apr 2021
CPallini
The following program (Python 3) s = input() lnum = list(map(int, s.split())) print("Unsorted:", lnum) print("Sorted Ascending Order:") print (sorted(lnum)) print("Sorted Descending Order:") print(sorted(lnum, reverse=True)) executes this...
Please Sign up or sign in to vote.
23 Apr 2010
CyberSamuraiii
3 alternatives  
Hi all,I've landed in a situation where i need the top N number of items in an array, work on those items and reinsert (or update) them back at the exact same indices. I realized that the easiest way would be to sort an array 1st then pick N number of the highest elements, but I find my...
Please Sign up or sign in to vote.
22 Apr 2010
#realJSOP
With the pitiful amount of info you've provided, the best I can suggest is that you look into using a Dictionary object instead of an Array.
Please Sign up or sign in to vote.
1 Jun 2010
Samanvay
For this you need to pass Dropdownlist value to XSL using parameter and based on param value which you have received in XSL apply xsl:sort statement. Roughly you need to do following C# CODEXslCompiledTransform tras = new XslCompiledTransform();XsltArgumentList argList = new...
Please Sign up or sign in to vote.
8 May 2011
ukram2
Ok, found a solution that looks more or less ok to me. I used another class, point_sorter to hold the third point and defined a Comparison Delegate compatible function there to compare the two points.using System;using System.Collections.Generic;using System.Linq;using...
Please Sign up or sign in to vote.
8 May 2011
OriginalGriff
It's a bit simpler than that!This example sorts a list of Points by looking only at the X distance: List p = new List(); ... // Fill p with Points! p.Sort(new PointComparer()); ... public class...
Please Sign up or sign in to vote.
15 Jul 2011
#realJSOP
If all of your data will fit in available memory, you could retrieve all of the data you need to display, and then extract only the items that will fit in a page. Psuedo code:0) retrieve data 1) Calculate number of pages you have - Math.Min(1, Math.Floor(records_retrieved /...
Please Sign up or sign in to vote.
22 Sep 2011
Sergey Alexandrovich Kryukov
The bug is very apparent: this is the lineCurr.Next := Sorter(Curr.Next);It works only of Curr assigned to Head is NULL. In all other cases, nothing happens to pointers before Sorter calls you with the same very parameter always equal to initial Head. Not going into further detail,...
Please Sign up or sign in to vote.
28 Sep 2011
Stefan_Lang
At a glance, I'd say you should change void add(HeapNode * child) { // if the new value is bigger than this value if(child->value > value)to void add(HeapNode * child) { // if the new value is smaller than this value if(child->value
Please Sign up or sign in to vote.
17 Mar 2012
ProEnggSoft
An alternative is to create one field in the database for color code, say ColorCode, assign the values say 1 - Green, 2 - Yellow, 3 - Red. Then based on this field, apply color to the rows of the DataGridView in CellFormatting event.private void dataGridView1_CellFormatting(object...
Please Sign up or sign in to vote.
19 Mar 2012
ProEnggSoft
You cannot sort the hidden column visually by clicking on the DataGridView as the column is not visible. One of the following options can be used, to sort the hidden column, using the bindingSource1 to which the DataGridView is bound.Option1.Use buttons, say Button1 and Button2 to sort...
Please Sign up or sign in to vote.
2 Apr 2012
Abhinav S
To customize sort in a datagridview, go through this article - How to: Customize Sorting in the Windows Forms DataGridView Control[^].
Please Sign up or sign in to vote.
17 Apr 2012
Leonardo Paneque
Use a distance function D=sqrt((x1-x2)^2+(y1-y2)^2) and keep the closets ones on the array of K elements.Depending on what your final problem is you could either compare with all and sort, then grab first K, or do it in one pass while putting new ones in a sorted list. up to you.hope it helps.
Please Sign up or sign in to vote.
25 Apr 2012
Member 8312096
1 alternative  
Dear All,I have two arrays (array1 and array2)with double type data. I want to sort array1 to ascending order, and array2 with corresponding to the array1 indexes. Is this possible? Example below,Array1(0) = 2.30 Array1(1) = 4.20Array1(2) = 1.90Array1(3) = 0.20Array1(4) = 0.88...
Please Sign up or sign in to vote.
2 Oct 2012
wkiess01
How to sort a data bound combobox
Please Sign up or sign in to vote.
18 May 2012
smrizvi1
5 alternatives  
Hey everyone! i stuck here with a thing. I use this code in visual c++ to search a book by its author. I have used the approach of bubble sorting then binary searching.Alright, now this is what i have. what i want to do now is to search a particular BOOK by its author without using the...
Please Sign up or sign in to vote.
24 Jul 2012
_Amy
Hi,Use this://Dropdownlist selected value changed event. This can be done on button click event also.protected void DropDownList1_SelectIndexChanged(object sender, EventArgs e) { gvSorting.Sort(DropDownList1.SelectedValue, SortDirection.Ascending); ...
Please Sign up or sign in to vote.
5 Dec 2012
amrita_thakur
Hi...I have a WPF Datagrid which I've grouped by a column ProductName. I want to perform sorting on UploadDate which is a datefield. The issue here is on clicking on sort I want the data to be sorted on UploadDate within the groups, by the datagrid sorts the data based on the ProductName, on...
Please Sign up or sign in to vote.
16 Dec 2012
Basil_2
How to choose an STL sorting algorithm.
Please Sign up or sign in to vote.
18 Dec 2012
deepakdynamite
2 alternatives  
Hello Everyone,I want to sort few records which actually contains Duration but they are in nvarchar datatype.. For eg. Select '33:14:14' as 'Duration'UNIONSelect '1:16:36' as 'Duration'UNIONSelect '0:3' as 'Duration'UNIONSelect '0:29' as 'Duration'UNIONSelect '02:12:39'...
Please Sign up or sign in to vote.
18 Dec 2012
Amir Mahfoozi
Hi,One solution is converting your data to seconds either on the fly or by using a user defined function.Here is a SQL statement that converts your data to seconds on the fly :SELECT * FROM (SELECT Duration ,CASEWHEN CHARINDEX(':',Duration )=0 THEN CAST (Duration AS...
Please Sign up or sign in to vote.
24 Mar 2013
Sandeep Mewara
Following will help you: MSDN: GridView Examples for ASP.NET 2.0: Paging and Sorting the GridView's Data[^]Similar question with answers: Sorting in Gridview Asp.net C#[^]
Please Sign up or sign in to vote.
19 Jun 2013
OriginalGriff
How large?If it's a couple of megabytes, then try just using Split and Sort: Stopwatch sw = new Stopwatch(); sw.Start(); string s = File.ReadAllText(@"D:\Temp\MyText.txt"); string[] data = s.Split(' ', '\n'); Array.Sort(data); ...
Please Sign up or sign in to vote.
1 Oct 2013
ridoy
You can have a look at:How do I sort an observable collection?[^]Sorting values of ObservableCollection (Reactive Extensions)[^]
Please Sign up or sign in to vote.
3 Mar 2014
BillWoodruff
Yes, you can sort the values in an Enum for display in a ComboBox alpha-numerically, or any other way you want:// requires Linq// preserve the current ComboBox selectionprivate V currentVName;private void Form1_Load(object sender, EventArgs e){ var vAry =...
Please Sign up or sign in to vote.
4 Mar 2014
Maciej Los
Have a look here: Filtering and Sorting Directly in Data Tables[^]
Please Sign up or sign in to vote.
17 Mar 2014
CPallini
You may use a dictionary to map the Type Ids to your own order criterion, e.g.Dictionary mo = new Dictionary{ { 3, 0 }, { 5, 1 }, {2,2}, {4,3}, {6,4} };Thendocuments.OrderBy(d => mo[d.Type.Id])
Please Sign up or sign in to vote.
11 Apr 2014
iratus7
2 alternatives  
I have a bindinglist of keyvaluepairs that is filled dynamicaly. BindingList> Homelist = new BindingList>(); foreach (ListItem item in listBox2.Items) { Homelist.Add(new KeyValuePair(item.Id, item.Name)); ...
Please Sign up or sign in to vote.
11 Apr 2014
CHill60
For sorting the list on value rather than key just provide an appropriate compare method ... have a look at this example http://www.dotnetperls.com/sort-keyvaluepair[^]If you want to treat the first 5 items differently to the rest then you could split the list into two separate ones before...
Please Sign up or sign in to vote.
11 Apr 2014
iratus7
public int Compare(KeyValuePair a, KeyValuePair b) { return a.Value.CompareTo(b.Value); } List> Playinglist = new List>(); for (int i = 0; i
Please Sign up or sign in to vote.
20 Apr 2014
CPallini
Once you have fixed the code (as it stands it doesn't even compile), no one prevents you using the std::sort[^] function.
Please Sign up or sign in to vote.
29 May 2014
Nirav Prabtani
try this.. :) DataSet ds=new DataSet(); DataTable dtTable = new DataTable(); dtTable = ds.Tables[0]; DataView dv = dtTable.DefaultView; dv.Sort = "ColumnName" + " " + "ASC"; //OR dv.Sort =...
Please Sign up or sign in to vote.
8 Oct 2014
Manu Prasad
3 alternatives  
var strTest = new List { "B1", "B2","b3","0", "B3", "B10","B20","B90","GB2","B9","B21","GB1","GB11" };I need to sort the above list as "0, b3,B1, B2, B3, B9, B10, B20, B21, B90, GB1, GB2,GB11"Can anyone help me with this one.Thanks in Advance,
Please Sign up or sign in to vote.
29 Oct 2014
V5709
Hi.. Make little bit change in your code line ..change it to lstRecData = lstRecData.OrderBy(x => x.strRecPriority).ToList();Here is the sample codeclass Program { static void Main(string[] args) { List lstRecData = new...
Please Sign up or sign in to vote.
29 Oct 2014
Member 11091184
HiJust avoid Reverse().it will be fine.List lstRecData = lstRecData.OrderBy(x => x.strRecPriority).ToList();
Please Sign up or sign in to vote.
21 Nov 2014
PIEBALDconsult
Quote:unsortDon't alter the array -- make another array with the indices of the first array and alter that -- it's kind of a linked list that way.int[] i = new int[] { 20,5,90,7,44,81 };int[] j = new int[] { 1 , 3 , 0 , 2 , 4 , 5 };
Please Sign up or sign in to vote.
18 Feb 2015
Herbisaurus
3 alternatives  
I need a collection of objects that will: * allow get, set functionality object via a key (like in a dictionary)* I need to iterate through the collection in a sorted manner, ordered by a "Priority" value* the priority allows multiple values. * the keys can be an int or a string, it...
Please Sign up or sign in to vote.
3 Mar 2015
OriginalGriff
Um.You do realise that that code does a total of nothing?for (int i = 0; i
Please Sign up or sign in to vote.
7 Apr 2015
Sergey Alexandrovich Kryukov
So far, I came up with only some trivial solution: use one more intermediate int object. This is not prohibited by the problems formulation. You can use it to represent a kind of "array of digits". You have only 10 digit, so a digit object needs only 4 bits (half-byte) to represent. But maximum,...
Please Sign up or sign in to vote.
11 Apr 2015
User 59241
This will do it. It will handle multiple occurrences of digits but not 0 of course (at present 0 is ignored). If required 0 would have to be placed after 9. Easy enough to do. #include int main () { const __int64 input = 456120; __int64 output = 0, temp1; int len =...
Please Sign up or sign in to vote.
4 May 2015
Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Something like this...dt.DefaultView.Sort = "YourColumnName ASC"; // DESC for descending.
Please Sign up or sign in to vote.
26 Jul 2015
Artem Kulikov
Hello. You should notice, that in your code - you will get only one contour.For your purpose you should fistly get all contours, and after that order them. Check this code:var allContours = new List>(); for (var contours = image.FindContours(); contours !=...
Please Sign up or sign in to vote.
1 Oct 2015
George Jonsson
Looks like home work to me.Why not add time measure to your code, implement different algorithms and measure the outcome for the different cases.That should give you the answer which method is most efficient for each case (or maybe for all).
Please Sign up or sign in to vote.
27 Nov 2015
mbue
cur->prev = p; if(cur->prev != NULL) it is strongly recommended to use human readable names - so you can see 'cur' is 'p' now. if(p->prev != NULL) p->prev->next = p;regards.
Please Sign up or sign in to vote.
27 Nov 2015
Mehdi Gholam
Read this : http://stackoverflow.com/questions/7851387/sorting-complex-numbers[^]
Please Sign up or sign in to vote.
28 Nov 2015
Andreas Gieriet
Never ever reinvent sorting yourself. If this is a homework assignment, do it according to your text book. If it is otherwise needed, use any existing sorting, i.e. by using some of the existing Sort functions, e.g.Array.Sort(complexArray,(a,b)=>a.real.CompareTo(b.real));RegardsAndi
Please Sign up or sign in to vote.
19 Jul 2016
Member 12642406
3 alternatives  
I'm given this line of code in particular: public void Test8(List items, int places)The tasks for this problem is to come up with solution where I am able to rotate the List to the right by the specified number of places. A List rotation can be seen as circular, which means...
Please Sign up or sign in to vote.
9 May 2017
W Balboos, GHB
Your problem is rather obvious: the sort is perfect! You see date, the computer sees characters. You need to sort them either in your SQL query before you convert the datetime field to a string (unless you horribly store dates as strings!) or maybe try a more useful date format: YYYYMMDD...
Please Sign up or sign in to vote.
20 Jul 2017
Pat O'Brien
The easiest would be to create a sort helper column: assuming Name is col C, Stat is col D and Value is col E the formula in row 5 would be: =TEXT(IF(C5=C4,E4,E5),"000000")&C5 The sort would then be on the column this formula is in (Descending) and the second key column would be the Stat...
Please Sign up or sign in to vote.
9 Sep 2017
Andy Allinger
You need to be very careful in writing the for statement. If you use the
Please Sign up or sign in to vote.
6 Dec 2017
Peter Leow
There is no how, just walk through the code execution flow like a computer, and of course you need to know the language of that code. Do you?
Please Sign up or sign in to vote.
6 Dec 2017
Rick York
Think about what each line of code does and then describe that in writing. You don't have to describe every single line of code though. For example, in this algorithm the code in the inner loop could be described like this : swap values increment counter That's all - that is the pseudo code for...
Please Sign up or sign in to vote.
5 Apr 2018
Richard MacCutchan
int* mergeSort(int* arr){ int size= sizeof(arr)/sizeof(arr[0]); The variable arr is declared as int* type, so its size is 4, and arr[0] is int type, so its size is also 4. So size will always equal 1.
Please Sign up or sign in to vote.
5 Apr 2018
Jochen Arndt
Quote: it compiles but the Windows stops working That is not a good problem description. Windows is an operating system and it will usually not "stop working" when running a program that behaves unpredictable. Do you mean your application (main window) is not responding anymore? Then use a...
Please Sign up or sign in to vote.
23 Apr 2018
phil.o
Issues are underlined: Dim ascQuery = From asc In ascNames Order by ascName.Lendth Ascending, ascName Descending ... wouls rather be Dim ascQuery = From asc In ascNames Order By asc.Length Ascending, asc Descending Select asc - Variable name is asc, its type is...
Please Sign up or sign in to vote.
24 Apr 2018
Maciej Los
In addition to soultion #1 by phil.o[^], a lambda version of solution: Dim ascQry1 = ascNames.OrderBy(Function(x) x.Length).ThenByDescending(Function(x) x) For further details, please see: Enumerable.OrderBy(TSource, TKey) Method (IEnumerable(TSource), Func(TSource, TKey)) (System.Linq)[^]...
Please Sign up or sign in to vote.
12 Jun 2018
Richard Deeming
Something like this should work, and will correctly rank ties: Dim cumulativeRank As Integer = 1 For Each group As IGrouping(Of Object, DataGridViewRow) In DataGridView1.Rows.Cast(Of DataGridViewRow)().GroupBy(Function (r) r.Cells(0).Value).OrderByDescending(Function (g) g.Key) Dim rank As...
Please Sign up or sign in to vote.
13 Jun 2018
Maciej Los
In addition to Richard Deeming[^]'s solution and my comment to His solution... I'd suggest to use Dictionary[^] object when there are rows with duplicate values in ColA Dim dgv As DataGridView = Me.DataGridView1 Dim oDict As Dictionary(Of Integer, Integer) = dgv.Rows().Cast(Of...
Please Sign up or sign in to vote.
3 Sep 2018
OriginalGriff
You can't just used a "standard string sort" and expect it to give you results that aren't in standard string order - and string ordering is based on comparing each character in turn from the left to the right and the whole comparison being based on the first different character. You need to...
Please Sign up or sign in to vote.
12 Sep 2018
Peter Leow
First, fix those syntax errors in your code, then try this: newlist = sorted(oldlist, key=lambda x: x.cost) Sorting HOW TO — Python 3.7.0 documentation[^]
Please Sign up or sign in to vote.
27 Oct 2018
Rick York
If I were you, I would do make a little set of functions to deal with your data structure. It will clean up the code A LOT! I think you will be able to see logic errors much easier. Here are some examples :int ReadRecord( details * pd, FILE * pf ) { char a[512] = { 0 }; int i = 0; ...
Please Sign up or sign in to vote.
29 Jan 2020
RickZeeland
You can find examples in different languages here: external-sorting · GitHub Topics · GitHub[^]
Please Sign up or sign in to vote.
29 Jan 2020
Patrice T
Quote: I'm new to computer science and I can't understand the concept of sorting 100 GB in 1 GB and I would like your help with solving this specific problem. Probably because there is no such concept. HDD storage and memory are essentially the same thing, the difference is that memory space is...
Please Sign up or sign in to vote.
6 Dec 2009
nGrafix
2 alternatives  
Hi guyz,I wrote a tiny programme in VB.NET using VS.NET 2008 to sort numbers.I take the input of numbers separated by commas from TextBox1.text, play some algorithm then by clicking a button, display the sorted values in TextBox2.text.NOW i want to restrict the numbers to be only 20...
Please Sign up or sign in to vote.
6 Dec 2009
Ashish Sheth
No need to count the commas.Use Textbox1.Text.Split(',').Length. It gives you the count of the numbers added in the textbox separated by comma.
Please Sign up or sign in to vote.
7 Dec 2009
SiM99
You could do it the reqular expression way:Dim valid AS Boolean = Regex.IsMatch(TextBox1.Text, "^(,?\d+){0,20}$")This would also validate the input, anything other than numbers or commas would return false.
Please Sign up or sign in to vote.
7 Dec 2009
nGrafix
3 alternatives  
Hi guys, am back.First i need to thank you for the "regula expression" given to me ealier, it happily solved my problem.:thumbsup:NOW, before sorting an array I get values from TextBox1.Text like(eg. 323,1,65,7,3,999,0,).HOW can i disable the use of spaces in this control to restrict...
Please Sign up or sign in to vote.
7 Dec 2009
nGrafix
1 alternative  
Hi giys,i wrote my programme in VS.NET 2008 that takes real numbers separated by commas from TextBox1.Text, sort them and display the sorted in TextBox2.Text.Now i want to add another 2 sorting algorithm that uses the same TexBoxes with different buttons to perform the sorting.I need...
Please Sign up or sign in to vote.
7 Dec 2009
AspDotNetDev
This seems like a homework question...What do you need help with specifically? Sorting algorithms are well documented online. Have you searched online yet? Wikipedia has some good information. Once you've done that, then come here with specific questions and we'll be happy to assist (so long...
Please Sign up or sign in to vote.
9 Dec 2009
nGrafix
1 alternative  
Thanks for the help,I worked around modifying regular expression (given to me here here) for different textbox, but i could't get what I neeed. I google it, many things found but not for what i want.Dim valid AS Boolean = Regex.IsMatch(TextBox1.Text,...
Please Sign up or sign in to vote.
9 Dec 2009
AspDotNetDev
Sounds like you want us to make your regular expression for you. What particular trouble are you having creating your regular expression?
Please Sign up or sign in to vote.
11 Feb 2010
Christian Graus
What a bizarre post. Blocked where ? By your work ? Are you a programmer ? If there was such a thing as code you could run on the local level that circumvented a block that exists on your firewall, would you know what to do with it ?
Please Sign up or sign in to vote.
17 Feb 2010
grmihel2
2 alternatives  
IEnumerable emails;try{ emails = (from p in DatabaseConnection.Emails where p.Newsmail == true select p);}catch (Exception x){ throw x;}Any suggestions how to sort the Enum list, to have ONLY one of each email adress in the list? The database table can have 2 instances of...
Please Sign up or sign in to vote.
29 May 2010
Moreno Airoldi
Well if you must do many searches, I guess you can consider iterating through the array, finding the best match for each pixel, and storing it.This will sure take some time ( O(n2) ), but once it's done all queries will take no time at all. :)
Please Sign up or sign in to vote.
29 May 2010
AspDotNetDev
Excellent question. I believe I have an answer for you.Sort the pixels into 3 lists. Each list would be sorted by the color intensity of a color component (red, green, or blue). Now, make a grid and set each point to store information about where in the 3 arrays that pixel is located. The...
Please Sign up or sign in to vote.
29 May 2010
AspDotNetDev
Just to add to my previous answer, I thought of another optimization. In each of the 3 lists, you could store sublists. Say you have 10 pixels that have a red value of 0. Then redList[0] would contain a list of those pixels sorted accorded to their green values. So, redList[0][1] would store a...
Please Sign up or sign in to vote.
30 May 2010
AspDotNetDev
One more thing to optimize my previous suggestion. If you travel 1 color value at a time in all 3 lists at once, then you can keep track of how far you've travelled in the other lists to know what the best possible minimum color you could achieve is. That way, you can use that as an exit...
Please Sign up or sign in to vote.
31 May 2010
Luke.Price
1 alternative  
I have loaded a xml into my project and used xmltransform class to apply the Xslt so that it would sort the document by a particular column (while also using Xpath). I need to be able to change the sorting on the page to different columns by changing a Dropdownlist.I have tried various...
Please Sign up or sign in to vote.
28 Jun 2010
Derek R. White
3 alternatives  
I have employed List.Sort after reading that it's algorithm is not only much easier to use but also faster than my own sorting techniques.The benchmarks prove this true, but there is one thing that is stopping me from committing to using this method:When the comparison is equal, the sort...
Please Sign up or sign in to vote.
28 Jun 2010
Nish Nishant
I believe it's because of the QuickSort implementation that's internally used. This is a bit of a hack, but you could do this:friends.Sort(delegate(Friend f1, Friend f2) { return f2.Rating.CompareTo(f1.Rating) >= 0 ? 1 : -1; });
Please Sign up or sign in to vote.
28 Jun 2010
Derek R. White
So to anyone who cares, this is what I ended up with:friends.Sort(delegate(Friend f1, Friend f2) { int i = f2.Rating.CompareTo(f1.Rating); return i == 0 ? f1.FriendName.CompareTo(f2.FriendName) : i; });
Please Sign up or sign in to vote.
30 Aug 2010
P.T.R.K
3 alternatives  
Hi All,I have used to select method to get the data from datatable.For example, DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Group", typeof(int))); dt.Columns.Add(new DataColumn("name", typeof(string))); DataRow dr = dt.NewRow(); ...
Please Sign up or sign in to vote.
30 Aug 2010
Christian Graus
You use an order by clause to specific the order of your data. It seems to be ordering by group by default, so you need to be able to specify the order by some value.
Please Sign up or sign in to vote.
30 Aug 2010
P.T.R.K
Hi All,I tried to use dataview rowfilter instead of datatable.select when it is working fine. Here this,DataView dv = dt.DefaultView;dv.RowFilter = "group in (1,2)";dt = dv.ToTable();I got solution.Thanks
Please Sign up or sign in to vote.
31 Aug 2010
roschvis4
1 alternative  
I'm absolutely out of any ideas ...I want to sort a tree by the TreeNode_SortOrder field.Here is what I have so far:I have created an Ado .Net entity model looking like this:Sample ImageIn fact, this is more or less a common adjacent list. I can represent a whole tree with this...
Please Sign up or sign in to vote.
6 Sep 2010
mrdosu
This should be no problem with a value converter.Simple example (new WPF project, DataContext of MainWindow set to Application.Current): public class Node { public Node(int ordinal) { this.Ordinal = ordinal; this.Children = new...
Please Sign up or sign in to vote.
9 Nov 2010
AbbasKapasi
Hi,We have created a SSRS report over the analysis services database.This report is added to a web part in sharepoint 2010. When we sets the toolbar to be visible, sorting works fine but when it is made invisible, the request is not going to the report server and it shows report server...
Please Sign up or sign in to vote.
14 Feb 2011
Henry Minute
Sorting Lists Using an Anonymous Delegate
Please Sign up or sign in to vote.
17 Feb 2011
OriginalGriff
You need to handle the SortCommand event: MSDN[^] explains how - look under "Specifying Custom Sorting" for details
Please Sign up or sign in to vote.
17 Feb 2011
Michael Waguih
Hi Raghavendra HG,Be sure your entry to the datagridview is numeric not string dataIf not you must casting it before ordering.I hope this helps you,:)
Please Sign up or sign in to vote.
17 Feb 2011
SunilChavan1
Hi! You have to first set property AllowSorting="True" and then generate event OnSorting="gridview_Sorting". And then apply sorting on Datasource and Bind the data as per your sort order and column.And for sorting dataview u can use Lambda ExpressionDataView sorted =...
Please Sign up or sign in to vote.
17 Feb 2011
Raghavendra HG
Hi thank you for all your replies. I tried the below one.dt.Columns.Add("SOWId", typeof(int));You need to specify the type of the item template values before binding the data into data table by using 'typeof' keyword.This solved the problem... :)
Please Sign up or sign in to vote.
16 Feb 2011
Albin Abel
Hi,There are many ways to achieve this.1) The best way would be using a clustering algorithm with a maximum likelihood function. On the result of it each pixel will have a cluster membership. So in your subsequent search's you only need to search within the cluster members, not all the...
Please Sign up or sign in to vote.
26 Mar 2011
jc3po
How generics can be used to sort lists easily and efficiently.
Please Sign up or sign in to vote.
14 Apr 2011
Member 7838027
3 alternatives  
Hi,I have a code that filters the content of the datagrid based on the name(column)private void Filter_Click(object sender, System.Windows.RoutedEventArgs e){ ilterDescriptor filter = new FilterDescriptor("Name", FilterOperator.Contains, (RadGridView1.SelectedItem as...
Please Sign up or sign in to vote.
14 Apr 2011
Jeffrey Enzo
You can use GridView sort, http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.sort.aspx[^]
Please Sign up or sign in to vote.
14 Apr 2011
Abhinav S
You might want to visit the RadGrid forums. This code looks fine to me.
Please Sign up or sign in to vote.
30 Apr 2011
Member 7838027
private void Filter_Click(object sender, System.Windows.RoutedEventArgs e){ FilterDescriptor filter = new FilterDescriptor(RadGridView1.CurrentCell.Column.UniqueName, FilterOperator.IsEqualTo, RadGridView1.CurrentCell.Value); RadGridView1.FilterDescriptors.Add(filter);}
Please Sign up or sign in to vote.
8 May 2011
Hemant__Sharma
see if this alternate can help.. class Program { public class User { public string Name; public int Age; public User(string name, int age) { this.Name = name; this.Age = age; }...
Please Sign up or sign in to vote.
8 May 2011
yesotaso
An alternative if "point" is your custom type.public class point: IComparable{ // do your stuff public int CompareTo(point obj) { // Replace X with your distance stuff (however you compute it). return this.X.CompareTo(obj.X); }}This way you can call...
Please Sign up or sign in to vote.
6 Jun 2011
alessandro.campagna
I made some progress but still there're some problems after sort by clicking on header grid collumn. I tried to reset the bindingSource1.Sort = ""; in the move rows function, and the row and now the row get moved but the position is wrong!! Here the code so you try by yourself.. public...
Please Sign up or sign in to vote.
21 Jun 2011
afva
1 alternative  
Hello , In my datagrid my textColumn looks like:Collapse IsReadOnly="True" Width="300" Binding="{Binding Path=CT_APPR.NAME}" SortMemberPath="{Binding Path=CT_APPR.NAME}" >My datagrid looks fine, so the binding is correct.But when I click on the...
Please Sign up or sign in to vote.
21 Jun 2011
2irfanshaikh
I think this will help youhttp://stackoverflow.com/questions/1296532/making-a-datagrid-column-header-sortable-in-wpf-using-c[^]Or else try to put it into the SortMemberPath header template
Please Sign up or sign in to vote.
15 Jul 2011
Jephunneh Malazarte
1 alternative  
Hi Guys,I spent couple of hours in google looking for idea on how to implement paging/sorting in gridview in an optimize manner.Database side:make a query that will only get the number of records for display. (i am clear with this)(Server Code):Use ObjectContainerDatasource and...
Please Sign up or sign in to vote.
1 Oct 2011
sadas232341s
2 alternatives  
How to count positive values WHILE doing HeapSort? Here is my HeapSort and I count them in a loop at the end of the method, but it needs to be done while sorting. How's that?void Sift(int arr[], int left, int right){ int i, j, x; i = left; j = 2 * i + 1; x =...
Please Sign up or sign in to vote.
10 Oct 2011
Jeff.Jefferson
Hi commmmmmunity :)I have a WPF DataGrid. There are Two Columns. Column A is visible, Column B isnt.I've implement some code that does the following:By clicking into the header Of Column A, the datagrid get sorted by Column B.But, as said, Column B isnt visible. maybe the User...
Please Sign up or sign in to vote.
3 Nov 2011
TRK3
Why?It's not going to be faster. The sort is O(n log n). So the fastest you could hope to be while doing it during the sort is O(n log n) comparsions (and you can't do it in one comparison).The loop at the end is O(n). And if you want to speed that up, do it as:int i =...
Please Sign up or sign in to vote.
4 Nov 2011
Paul M Watt
There is no reason to loop over all of the values which requires a O(n) operation for an algorithm that is O(n logn).Since you will have a sorted array in the end, the "trick" is:During your heapsort identify the point in the code where the first positive integer resides. The number of...
Please Sign up or sign in to vote.
8 Dec 2011
Sergey Alexandrovich Kryukov
Please look at my comment to the question.Right, you don't need string sorting. You either need to sort on the data set and use binding or using custom order via implementation of IComparer. See this discussion:...
Please Sign up or sign in to vote.
30 Dec 2011
Kutayy
I am starting the a DownloadImages like this. ThreadStart ths = delegate { DownloadImages(ds.Tables[0].Rows.Count,ds); }; Thread download = new Thread(ths); download.Priority = ThreadPriority.Highest; download.IsBackground = true; download.Start()a part of my function....
Please Sign up or sign in to vote.
15 Feb 2012
Abbas_here
Abbas_here - 2 mins agofrds, The problem is that client saying me to create a web service method which able to consume their SOAP file and return back authenticate result in response SOAP massage, Request SOAP:
Please Sign up or sign in to vote.
2 Apr 2012
Kapil Waghe
1 alternative  
Hello All,I am having a column in my datagridview. This column contains "Get Value" in each cell.When I click on the "Get Value" it perform some calculations and display the value in the clicked cell. The result is of Integer type.Now I want to sort it like Integer then the text,...
Please Sign up or sign in to vote.
8 Apr 2012
hit003
can we use "dt.Select("group not in (1,2)")"?????
Please Sign up or sign in to vote.
17 Apr 2012
user_code
3 alternatives  
Hello,I have an array of N players in Java. Each player has a position by (X,Y) coordinates.I get as input a new player, with his position.I have to find the K closest players in the array to the input player.How can I do it in Java?I thought about going thru the players array,...
Please Sign up or sign in to vote.
12 May 2012
smrizvi1
2 alternatives  
I have a Books.txt file which looks like this. Book name---------------AuthorLord of the rings---------J. R R TolkiensTom sawyer--------------Mark twainJust after sunset---------Stephen kingThe shining--------------Stephen kingOliver twist------------Charles DickensHuck...
Please Sign up or sign in to vote.
18 May 2012
smrizvi1
Alright, now this is what i have. I have used the approach of bubble sorting then binary searching. what i want to do now is to search a particular BOOK from someone without using the bubble sorting or binary searching method and instead search all the records one at a time, from start till the...
Please Sign up or sign in to vote.
18 May 2012
smrizvi1
i have seen this version which resembles what i want. can anyone change it to my requirements please?struct book // declare book class{ int no; string author; // type name of string string book; // type name of string string topic; // type name of string ...
Please Sign up or sign in to vote.
21 May 2012
smrizvi1
I also wanted to know that is it possible search a particular string/char, having more than one word, by just a single word?? I mean If i want to search 'Lord of the rings' and i just input 'rings', is there any way that i get all the books that contain the word 'rings'?
Please Sign up or sign in to vote.
5 Jun 2012
rnbergren
Gives a run down of how to sort parameters for sharepoint lists selections
Please Sign up or sign in to vote.
10 Jun 2012
krumia
You can pass a sort function to JavaScript's array.sort().function sortFunction(a, b) { // your array elements will be passed to this function as a, b // TODO: // compare a to b // if a should come before b, return -1 // if a should come after b, return 1 // if a...
Please Sign up or sign in to vote.
10 Jun 2012
Ravi Tuvar
Here is the correct answer..!function MySort(alphabet){ return function(a, b) { var index_a = alphabet.indexOf(a[0]), index_b = alphabet.indexOf(b[0]); if (index_a === index_b) { // same first character, sort regular if (a
Please Sign up or sign in to vote.
15 Jun 2012
RedUnited
bool sortByField1(Task &t1, Task &t2){ if(t1->field1> t2->field1) { return true; } else return false;}and calledstd::sort(vec.begin(), vec.end(), sortByField1);
Please Sign up or sign in to vote.
24 Jul 2012
Ranjith Reddy CSE
1 alternative  
Hello FRNDS, Please solve my problem facing with GRIDVIEW AND DROPDOWNLIST.Am working on ASp.NET, c#, SqlSERVER2005.On my webpage I have a Dropdownlist and a Gridview...data is dispalying perfectly from database. and this gridview contains PAGING ALSO(it contains Large number of records...
Please Sign up or sign in to vote.
25 Jul 2012
ayerunka
1 alternative  
Can anyone help me to convert the following Excel VBA code to C# - this is sorting on cell colour in excel :- There is a table in an excel file with columns as TowerName, Incident, Problem and Change. The column Incident contains values as cell colour in Red, yellow and Green. I need to sort...
Please Sign up or sign in to vote.
25 Jul 2012
Aarti Meswania
Range["E3:H1...
Please Sign up or sign in to vote.
20 Aug 2012
Zsombi55
2 alternatives  
I have an Excel 97-2003 .xls spreadsheet converted from .dbf using C#-4.0 and Excel.Interop. The data is sorted by date according to column D.http://www.tiikoni.com/tis/view/?id=af4cf69[^]Now I would need to sort the selected range (shown in the image), by column G so that blank cells...
Please Sign up or sign in to vote.
16 Aug 2012
Kenneth Haugland
Here is how you would sort a sheet based on one column:http://msdn.microsoft.com/en-us/library/wxks80sb.aspx[^]And here is how to filter the collection:http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.autofilter%28v=vs.80%29.aspx[^]Filter with more than...
Please Sign up or sign in to vote.
7 Sep 2012
Zsombi55
In the end I managed to do it like this.A "datagroup" is a group of rows which have the same values in column(D) DATE, grouped by days. "type" is not really relevant, it is just because in my DataSet.Table[0]'s I have a column in which there are two possible values, and according to the...
Please Sign up or sign in to vote.
10 Sep 2012
joshrduncan2012
2 alternatives  
I am trying to filter comboboxes populated with data from a local sqlserverce database. My task is to select one index in one combobox and have that result filter the next combobox. Would LINQ work for this or can I do it with just plain SQL? I am using Visual Studio 2010/2012 with SQL Server...
Please Sign up or sign in to vote.
10 Sep 2012
manognya kota
Hi,Check this out.http://social.msdn.microsoft.com/Forums/eu/csharplanguage/thread/b888969e-bb8e-44e3-a83d-b576425c4e13[^]Hope this helps.
Please Sign up or sign in to vote.
11 Sep 2012
Kenneth Haugland
The Microsoft documentation is pretty specific on what to implement here:http://msdn.microsoft.com/en-us/library/0868ft3z.aspx[^]
Please Sign up or sign in to vote.
17 Sep 2012
mynkmitl
Actually sortingdescription added to my listviewcollection binded with itemsource of grid was getting undone when was getting assigned to grid so I applied my sortdescriptions after binding same to grid and things got done. :)Thanks.
Please Sign up or sign in to vote.
17 Sep 2012
mynkmitl
I was binding my list to grid in async method but was applying sorting in normal flow to grid so there were sync issues. therefore i applied sortingdescriptions in async method only after the list get binded to grid. So once grid is fully assigned data from list sortingdescription get added to...
Please Sign up or sign in to vote.
23 Sep 2012
V_R
Whenever you are configuring the select statementyou can use ORDER BY button beside the column name selection.There you have to set SORT BY which column.
Please Sign up or sign in to vote.
23 Sep 2012
Ajay J Singh
" SelectCommand="SELECT * FROM [AppSetting] ORDER BY [SettingID]">
Please Sign up or sign in to vote.
1 Oct 2012
ravijain03
2 alternatives  
Grid View having with various column between those Loan_number is string Field Column when sorting Loan_number column it is not sorted properly.Ex:On Page Load Loan_number Column display as98983982799898398277 9898398278111999777After Sorting Loan_number Column Appeared...
Please Sign up or sign in to vote.
1 Oct 2012
Aarti Meswania
convert loan_number in to numeric if it will not contain alphabet ever.fetch data from sql like below,select convert(numeric,'999') -- replace underline with Loan_Number in your query now, field is numeric so it will apply sorting properly.Happy Coding!:)
Please Sign up or sign in to vote.
1 Oct 2012
Sandeep Mewara
2 Options:1. Sort it while retrieving the data from database in the query itself. Similar to this answer: sort date in gridview[^]& this article: How to Non-alphabetically Sort GridView Columns with Text Data[^]2. Sort it in front end as you are doing right now: Use a sortcomparer....
Please Sign up or sign in to vote.
5 Nov 2012
cyberexel
Hi,Is it possible to have interactive sort of detail rows work in an SSRS 2008 matrix report? I have a simple structure as below:Bank | 2002 | 2003 | ----------------------------Bank 1 |2,000 | 2,500 | Bank 2 |2,500 | 2,100 | what i need is to be able to click...
Please Sign up or sign in to vote.
8 Nov 2012
Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Check the below articles and try to implement the techniques.They will help you for sure.1. how to show the up and down arrows during sorting of column in gridview using asp.net[^].2. A Look at the GridView's New Sorting Styles in ASP.NET 4.0[^].Thanks...
Please Sign up or sign in to vote.
9 Dec 2012
somu1729
Order values are: 24683579After applying converter on order. we are converting even orders to true and odd orders to false.But when applying...
Please Sign up or sign in to vote.
19 Dec 2012
Aarti Meswania
Note: Numeric conversion is must in this case for sorting AND insert data in proper formatsee below example...select dbo.SetFormat(duration) from( Select '33:14:14' as 'Duration' UNION Select '01:16:36' as 'Duration' UNION Select '0:3' as 'Duration' UNION ...
Please Sign up or sign in to vote.
15 Jan 2013
Coder93
1 alternative  
what comb sort and shell sort exactly do?
Please Sign up or sign in to vote.
15 Jan 2013
TorstenH.
Combsort[^]Shellsort[^]...
Please Sign up or sign in to vote.
16 Jan 2013
GinoMellino
1 alternative  
Hi, I am using Tom John's Drag Drop Treeview [posted here] which works great (Thanks!). However I wish to add functionality to be able to drop nodes in between other nodes and I am unsure of where to start with this. So something like when I drag a node a line representing the drop target is...
Please Sign up or sign in to vote.
16 Jan 2013
Sergey Alexandrovich Kryukov
Would you rather ask the advice from the author of this article? Locate the section "Comments and Discussions" below the article and use "Add a Comment or Question" to ask for advice. The author will get a notification and a chance to reply.This functionality is not a big deal, but if you...
Please Sign up or sign in to vote.
11 Feb 2013
kk2014
Hi,i have a requirement of Gridview with paging and Sorting(on column header click). numeric paging required on both top and bottom side.is there any reference source code or link available? that will helpful to me.thanks
Please Sign up or sign in to vote.
23 Mar 2013
doree007
1 alternative  
hi..is there any way to ceate a column header click event for grid view in asp.net. I want to click a clumn header of gridview and sort the grid view according go ghe column content. Ex: If that column hase siZe variable, I want to sort the gridview according to sizes..
Please Sign up or sign in to vote.
26 Mar 2013
Chaoscommander
1 alternative  
Hi,I have a DataGrid and bound an ObservableCollection to it:ObservableCollection MyValueList = new ObservableCollection();public MainWindow(){ gridViewReceivedValues.ItemsSource = MyValueList;}If I doMyValueList.Add(SomeValue);the...
Please Sign up or sign in to vote.
27 Mar 2013
josh-jw
sort observable collectioncheck this linkhttp://social.msdn.microsoft.com/forums/en-US/wpf/thread/5909dbcc-9a9f-4260-bc36-de4aa9bbd383/[^]
Please Sign up or sign in to vote.
29 Mar 2013
helplakmal
1 alternative  
hi, i have question about php arrays. i have array like $data. $data=array(array('a'='1','b'='2','c'='3','d'='4'), array('a'='5','b'='6','c'='7','d'='8'), array('a'='9','b'='10','c'='11','d'='12') );i want to get...
Please Sign up or sign in to vote.
4 Apr 2013
JaganPoovannan
1 alternative  
Guys can u please help me in removing the sort arrow symbol from the webgrid header of mvc3??
Please Sign up or sign in to vote.
4 Apr 2013
Sandeep Mewara
I believe by setting 'CanSort' as false should do the trick automatically. Quick reference: http://weblogs.asp.net/andrebaltieri/archive/2010/11/02/asp-net-mvc-3-working-with-webgrid-part-2.aspx[^]Try out if that works for a column.
Please Sign up or sign in to vote.
17 Apr 2013
JaganPoovannan
Hi I am getting the paging problem in the mvc3 webgrid footer when tried to sort the grid.In this instance i have a webgrid footer showing page 1 of 1 with two reports in it.When i tried to sort it with a report name, say fr instance, then the footer is displaying as "page 1 of 0".I am...
Please Sign up or sign in to vote.
21 Apr 2013
vanhook
1 alternative  
Dear friends dan vb master,Please help me. I'm newbie at vb. I use visual basic 2010. I have a DataGridSJF with several row. I want to sort it with ascending mode except the first row. the data is at the 3rd column:123521I want the result like this:121235Here...
Please Sign up or sign in to vote.
21 Apr 2013
Nelek
First of all... it doesn't work does not help much to understand your problem. Please use the widget "improve question" and give a bit more information about what is not working.On the other hand, why are you using "Row.Count - 2" ??If you want to skip the first row, with j = 1 (if...
Please Sign up or sign in to vote.
13 May 2013
sergio090588
1 alternative  
- I got a problem when sort column in listview- This is my code:+In class ListViewItemComparer:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Collections;using System.Windows.Forms;namespace ConvertPTU{ public class...
Please Sign up or sign in to vote.
13 May 2013
Johnny J.
Event though your listview has 4 columns, it doesn't automatically generate the subitems. For each item in the listview, you need to make sure that it has enough subitems, and if not, you need to add them (even if their text is empty).I would guess that that is the source of the problem.
Please Sign up or sign in to vote.
17 May 2013
computermagic
Generating sequential GUIDs in C++ and Qt 5
Please Sign up or sign in to vote.
19 Jun 2013
happyface120
1 alternative  
I would like to design a utility which sorts all words in a Unicode text file and output results into a separate file. Words are separated by spaces or new lines. My text file is very large... Any suggestions?
Please Sign up or sign in to vote.
28 Jul 2013
Mohammed Hameed
I have a Datagrid with 'Select' column, having Radiobutton. If sorting is performed on any other column the Radiobutton is loosing its selection.You can check the same kind of question posted on MSDN...
Please Sign up or sign in to vote.
14 Aug 2013
Antariksh Verma
Hi ,After doing lot of R&D in Kendo UI i got that if we want sorting ,filtering and paging on client side we have to add .ServerOperation(false) so that all functionality like Sorting and filtering works on client side.
Please Sign up or sign in to vote.
15 Sep 2013
Karthik JSR
step 1: I would suggest you to add a uploaddatetime field to your table and capture the uploaded datetime against all the images.step 2: In your select query :"SELECT ime, imethumb, imeslika, kategorija, datum, opis, slikapateka, thumbpateka, userid FROM Ohrid WHERE...
Please Sign up or sign in to vote.
15 Sep 2013
Dragan Jovanovski
1 alternative  
I am using facebox on my asp.net web site for my image gallery. when i am uploading images to the gallery, they are saved on my disc and url data is stored in my sql database. After the uploading, my gallery displays thumbnails from the images but not in the order as they are uploaded. I want to...
Please Sign up or sign in to vote.
19 Sep 2013
bedathur_ganesh
2 alternatives  
Hi,Sorting is not happening on the click of column headers. The "Loading..." shows up briefly over the data, but the columns are not getting sorted. Also, "OnSortCol" event gets triggered and I could see the alert popping up. But, the sorting is not happening. Any help on this is...
Please Sign up or sign in to vote.
1 Oct 2013
Paul0693
1 alternative  
Hello,I'm working on a project which parse colomn from a csv file.I store my datas like that :csv file :A1 ; A2 ; A3 ; A4;B1 ; B2 ; B3 ; B4;.. ; .. ; .. ; .. ;My class :public class Restaurant { public double X1 { get; set; } public double X2{...
Please Sign up or sign in to vote.
11 Oct 2013
ASP.NET Community
Both the GridView and ListView are important Data Controls in Visual Studio 2008.Scott Guthrie has a great introduction that uses the ListView
Please Sign up or sign in to vote.
14 Oct 2013
lukeer
1 alternative  
Hi experts,the central part of an application I'm working on is where User can select multiple objects and change some of their properties' values. The UI for that is a PropertyGrid[^].The objects live in an inheritance hirarchy, some being siblings of each other. Some are composed of...
Please Sign up or sign in to vote.
11 Oct 2013
ASP.NET Community
The ListView is a sort of hybrid between a DataGrid and Repeater thatcombines the free form templating of the Repeater with the editingfeatures
Please Sign up or sign in to vote.
14 Oct 2013
lukeer
Got it!I had read that all of PropertyGrid[^]'s built-in sorting had to be switched off (NoSort[^]) and instead ICustomTypeDescriptor[^]'s GetProperties[^] method should be designed to return the properties in the desired order.What I had overlooked was that the applied Sort()[^] method...
Please Sign up or sign in to vote.
17 Oct 2013
Somasundharam Arjunan
3 alternatives  
Hi friends, DataView dv = ds.Tables[0].DefaultView; dv.Sort = ViewState["Sort"].ToString();ORds.Tables[0].DefaultView.Sort=ViewState["Sort"].ToString();when i use first command gridview successfully sorted but the second command the gridview not sorting?Where i done a mistake,...
Please Sign up or sign in to vote.
17 Oct 2013
Deenuji
you must place your code in load event....or call your bind function in page load...GridView Paging and Sorting[^]http://www.dotnetgallery.com/kb/resource12-How-to-implement-paging-and-sorting-in-aspnet-Gridview-control.aspx[^]
Please Sign up or sign in to vote.
17 Oct 2013
Deenuji
Remove ! in postback and try once:if (IsPostBack) { ViewState["Sort"] = Sort; bind_gridView(); }
Please Sign up or sign in to vote.
17 Oct 2013
Somasundharam Arjunan
I got the Solution :)ds.Tables[0].DefaultView.Sort = ViewState["Sort"].ToString();GridView1.DataSource = ds.Tables[0];Its working me....Thanks for your comment DeenujiThanks and Regards,Somasundharam Arjunan
Please Sign up or sign in to vote.
13 Nov 2013
hassan Abbas
1 alternative  
I'm working in VS2012 on a C# WinForms app. By default when clicking on a column header in a DataGridView it not sorts that column Ascending, you can then click on the column header again to sort it Descending.so the initial click sorts Descending then the second click sorts Ascending and I...
Please Sign up or sign in to vote.
13 Nov 2013
Chetan Patel
Add this eventprivate void GridViewSortDirection(GridView g, GridViewSortEventArgs e, out SortDirection d, out string f){ f = e.SortExpression; d = e.SortDirection; //Check if GridView control has required Attributes if (g.Attributes["CurrentSortField"] != null &&...
Please Sign up or sign in to vote.
15 Nov 2013
Commish13
1 alternative  
My question is: Can a DataTable have sorting columns. I want to click on the column headers of my GridView that is being populated by a Fill DataTable code. Every time I try to look up Sorting columns they use a DataSet code. If anyone knows of a tutorial or just an answer if this can be...
Please Sign up or sign in to vote.
15 Nov 2013
Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
DataSet is just a collection of DataTables.Unless you are using multiple DataTables, you can always use one DataTable to populate GridView.
Please Sign up or sign in to vote.
15 Nov 2013
Commish13
Hi. I'm using this code to try and sort my GridView without a DataSource. The problem is I don't think my GridView is getting populated. Whenever I click on the Column header nothing happen. No Error message etc. This is the code I'm using. Please let me know if you need more info from...
Please Sign up or sign in to vote.
15 Nov 2013
Ali_100
http://postimg.org/image/8fm4y...
Please Sign up or sign in to vote.
18 Nov 2013
Commish13
2 alternatives  
I’m trying to implement a Sort feature for my GridView that is being populated from a DataTable. Also I have a Filter/Search feature so I can’t use ViewState cause every time the Filter /Search results are displayed and I try to Sort them the Sort displays all the records then Sorts them....
Please Sign up or sign in to vote.
26 Nov 2013
Goel Himanshu
3 alternatives  
I have a dataset in which there is a column contains various string type values like below:AircraftCrimePackage TotalApartmentsDIC - PersonnelNow the requirement is that after applying sorting logic on this colum if there is a "Package Total" value in it then it must come at the...
Please Sign up or sign in to vote.
27 Nov 2013
cigwork
Use a primary and secondary sort field. Primary controlled by "Package" and the secondary by the alphabetic order of the other values.insert into sortTest (name) values('Package')insert into sortTest (name) values('Crime')insert into sortTest (name) values('DIC')insert into...
Please Sign up or sign in to vote.
27 Nov 2013
Maciej Los
If i understand you well, you have got 2 columns in a result set, for example:NameOfSomething TotalPackage Total 500Aircraft 300Apartments 250Crime 200DIC - Personnel 150If it is a true, you should sort data on the second column.SELECT...
Please Sign up or sign in to vote.
22 Dec 2013
OriginalGriff
If memeory is the critical factor, then look at External sorting algorithms[^] - but be aware - they will be slower than memory intensive ones.
Please Sign up or sign in to vote.
22 Dec 2013
Er. Tushar Srivastava
Hi Friend,Can you do some kind of merge sort with some way where, you are going to do this :1. Create two buffer variables : size depends on you.2. Create a file handle to the input file. You may need to do some heavy temporary data file generation on the disk. So, it's actually...
Please Sign up or sign in to vote.
26 Jan 2014
Chungath85
1 alternative  
Please Sign up or sign in to vote.
26 Jan 2014
JoCodes
It seems you are creating a new DataTable in Sorting Event of the Gridview. Instead fetch it from the Datasource DataTable dataTable = GridView1.DataSource as DataTable;Or Can even use a Session for it ,like DataTable dataTable = Session["datatable"] as DataTable; //Session...
Please Sign up or sign in to vote.
27 Jan 2014
YvesDaoust
5 million strings, each less than 10 characters long (from your sample) is not such a big deal for main memory (50 MB).I suggest that you load the whole file in a large buffer, as contiguous null terminated strings, together with an array of indexes to the start of every string (this will...
Please Sign up or sign in to vote.
11 Feb 2014
woopsydoozy
Is this a Windows or web app? DataGridView is Windows, but you're talking about ViewState, so I assume you've got a web app with a GridView. Assuming that's the case, you're getting your "Empty" message every time because your grid's data source is nothing on postback (which is normal). If...
Please Sign up or sign in to vote.
11 Feb 2014
thatraja
Check theseGridView sorting with ViewState off - a solution to double querying and "why doesn't my Sorting event handler fire?"[^]GridView Sorting, Paging without using Session, ViewState or Cache[^]
Please Sign up or sign in to vote.
21 Feb 2014
Member 10338805
2 alternatives  
I need to sort a bunch of elements first by document name and then by the age of the people inside the document.sort(vec.begin(), vec.end(), ltNames);or can i change name into this? documentname+age and then just use ltNames?I would...
Please Sign up or sign in to vote.
26 Feb 2014
nv3
It is quite common that one want to sort not only by a single, but multiple properties of an object. This can even be done in a single sorting run. The trick is to use an appropriate compare function.The compare function tells the sorting algorithm, whether one element comes before or after...
Please Sign up or sign in to vote.
26 Feb 2014
David Days
Have you looked under the term "Radix sort"? This is the basis behind alphabetical sorting, and it sounds like you need to just have two sorts--one for alphabetical, then one for numeric.The advantage of going for a Radix sort is that a good algorithm maintains the sort from the previous...
Please Sign up or sign in to vote.
2 Mar 2014
OriginalGriff
There is no automatic way to sort enums into alphabetical order in VS so that:public enum myEnum { aaaa, dddd, eeee, bbbb }becomespublic enum myEnum { aaaa, bbbb, dddd, eeee }If that is what you want, you will have to do it...
Please Sign up or sign in to vote.
2 Mar 2014
lw@zi
I don't think you are using right object for the job. Order of elements in an Enum should be governed by integer value it holds and not by the text. Image a days of week enum that is displayed alphabetically on screen.I think what you need here is a sorted list or dictionary.
Please Sign up or sign in to vote.
3 Mar 2014
Maciej Los
There are two different things:1) bind enumeration,2) sort data.Ad 1)Have a look here:How to: Bind to an Enumeration[^]Accessing Enum members in Xaml[^]Ad 2) If enumeration is bind to any control, use its method to sort data.
Please Sign up or sign in to vote.
3 Mar 2014
King Fisher
i hope its useful for you.refer thisC# sort with examples
Please Sign up or sign in to vote.
3 Mar 2014
FarhanShariff
4 alternatives  
______________________________...
Please Sign up or sign in to vote.
3 Mar 2014
Member 10510822
Have you tried it ? Try yourself then ask question if any problem you faced. ok.Look the link for help:http://stackoverflow.com/questions/9107916/sorting-rows-in-a-data-table[^]Thanks!
Please Sign up or sign in to vote.
4 Mar 2014
FarhanShariff
1 alternative  
Language: C# Windows Form/Console DataTable Shown Below1.Sort the Columns in Ascending Order.(smallest to largest.)2.After sorting find x1 and x2 index number - a. x1 = 0.90*N b. x2 = 0.10*N N= +...