Search Results

Search found 1765 results on 71 pages for 'sorting'.

Page 13/71 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Table Sorting in Excel 2010 Cannot Parse the Table Headers Correctly

    - by Truth
    I have a rather weird issue I've never faced before. After defining my table with borders and such, and filling out data in my table, I try to sort my table according to the "ratio" (first) column, from biggest to smallest. When I right click the header and select the corresponding option, the table gets sorted, but the first row is omitted by the sorting function. What I mean is that the first line (with 3.50 ratio) will forever stay at the top line, even when I sort otherwise (by a different column, in a different order). This is my table below, it's tab separated so it's not very readable, but I hope you'll manage. ???? ??????? ????? ??? ???? ??? ??? ??? 14 4 0 0 0 0 0 0 0 0 0 0 0 0 0 3.50 3.50 ?????? 23 8 0 0 0 0 0 0 0 0 0 0 0 0 0 2.88 2.88 ???? 16 4 0 0 0 0 0 0 0 0 0 0 0 0 0 4.00 4.00 ??? 7 2 0 0 0 0 0 0 0 0 0 0 0 0 0 3.50 3.50 ???? 13 4 0 0 0 0 0 0 0 0 0 0 0 0 0 3.25 3.25 ????? 12 4 0 0 0 0 0 0 0 0 0 0 0 0 0 3.00 3.00 ???? 10 4 0 0 0 0 0 0 0 0 0 0 0 0 0 2.50 2.50 ??? 38 12 0 0 0 0 0 0 0 0 0 0 0 0 0 3.17 3.17 ???? 14 4 0 0 0 0 0 0 0 0 0 0 0 0 0 3.50 3.50 ????? 31 10 0 0 0 0 0 0 0 0 0 0 0 0 0 3.10 3.10 ???? 24 8 0 0 0 0 0 0 0 0 0 0 0 0 0 3.00 3.00 ????? 23 8 0 0 0 0 0 0 0 0 0 0 0 0 0 2.88 2.88 ???? 14 4 0 0 0 0 0 0 0 0 0 0 0 0 0 3.50 3.50 ???? 16 4 0 0 0 0 0 0 0 0 0 0 0 0 0 4.00 4.00 ???? 24 8 0 0 0 0 0 0 0 0 0 0 0 0 0 3.00 3.00 ???? 30 10 0 0 0 0 0 0 0 0 0 0 0 0 0 3.00 3.00 ????? 21 6 0 0 0 0 0 0 0 0 0 0 0 0 0 3.50 3.50 ???? 42 12 0 0 0 0 0 0 0 0 0 0 0 0 0 3.50 3.50 ??? 11 4 0 0 0 0 0 0 0 0 0 0 0 0 0 2.75 2.75 ???? 5 2 0 0 0 0 0 0 0 0 0 0 0 0 0 2.50 2.50 ???? 4 2 0 0 0 0 0 0 0 0 0 0 0 0 0 2.00 2.00 ??? 4 2 0 0 0 0 0 0 0 0 0 0 0 0 0 2.00 2.00

    Read the article

  • Can I remove the original file while running "sort"?

    - by Spaceman
    I'm sorting a huge file, around 400 gigabytes. I'm running out of the disk space and I must do something quickly. Let's assume the original file is called original_file. So I execute (simplified) it as "sort original_file | gzip -c output_file" I use /home/tmp as a temporary dir. From what I see, there are a lot of intermediate files, like so: tmpA465 tmpB154 ... and so on. The smallest ones have size 12 megabytes. The largest have ~182 megabytes. So, it seems that the "sort" command have already split the original file into small pieces, and have sorted them, and now it is merging them into bigger parts (which will be, eventually, sorted as well). Please correct me if I'm wrong. Can I remove the original file right now without terminating the sort process? I've been waiting for a few days for that and it's important that the "sort" command will not fail and I will get the result file, finally. The OS is Ubuntu server 13.04, x64. Thanks!

    Read the article

  • What's the easiest way to sort an EF4 EntityCollection<T>?

    - by Will
    I'd love to add some sorting to an EntityCollection that is bound to an ItemsControl (in xaml). I'd also like to do it as simply as possible. It appears that this is not possible. If I wrap the collection in a "sorted" version of the collection property within the Entity I lose collection change notifications. I can't use a CollectionViewSource because the entity collection's BindingListCollectionView does not support sorting for some goddamned reason (note: I've seen the blog post with the "dirty" hack to get around this, so please don't answer with that kthx). Is there a simple (couple lines of xaml, couple lines of code, whatever) way to achieve this??

    Read the article

  • How to do a natural sort on an NSArray?

    - by Cory Imdieke
    I've got an array of objects, and I need them sorted by their "title" key. It's currently working, though it's using an ASCII sort instead of a natural sort. The titles are filenames, so they look like this: file1 file2 file3 ... file10 file11 file12 I'm getting, as you would expect: file1 file10 file11 file12 file2 file3 ... Does anyone know if there is a way built-in to the NSArray sorting functionality to get this natural sorting as opposed to the alphabetical sort? I found some generic algorithms, but I was hoping for something built-in...

    Read the article

  • In Haskell, how can you sort a list of infinite lists of strings?

    - by HaskellNoob
    So basically, if I have a (finite or infinite) list of (finite or infinite) lists of strings, is it possible to sort the list by length first and then by lexicographic order, excluding duplicates? A sample input/output would be: Input: [["a", "b",...], ["a", "aa", "aaa"], ["b", "bb", "bbb",...], ...] Output: ["a", "b", "aa", "bb", "aaa", "bbb", ...] I know that the input list is not a valid haskell expression but suppose that there is an input like that. I tried using merge algorithm but it tends to hang on the inputs that I give it. Can somebody explain and show a decent sorting function that can do this? If there isn't any function like that, can you explain why? In case somebody didn't understand what I meant by the sorting order, I meant that shortest length strings are sorted first AND if one or more strings are of same length then they are sorted using < operator. Thanks!

    Read the article

  • Sort a GridView Column related to other Table

    - by Tim
    Hello, i have a GridView bound to a DataView. Some columns in the DataView's table are foreignkeys to related tables(f.e. Customer). I want to enable sorting for these columns too, but all i can do is sorting the foreignkey(fiCustomer) and not the CustomerName. I have tried this without success(" Cannot find column ERP_Customer.CustomerName "): <asp:TemplateField HeaderText="Customer" SortExpression="ERP_Customer.CustomerName" > A tried also the DataViewManager, but i've a problem to detect the table to sort: Dim viewManager As New DataViewManager(Me.dsERP) viewManager.DataViewSettings(dsERP.ERP_Charge).RowFilter = filter viewManager.DataViewSettings(dsERP.ERP_Charge).Sort = sort 'sort is the GridView's SortExpression Me.GrdCharge.DataSource = viewManager.CreateDataView(dsERP.ERP_Charge) I have to apply the sort on a distinct table of the DataViewManager, but this table would differ on the related tables. I have bound the TemplateColumns in Codebehind in RowDataBound-Event f.e.: Dim LblCustomer As Label = DirectCast(e.Row.FindControl("LblCustomer"), Label) LblCustomer.Text = drCharge.ERP_CustomerRow.CustomerName 'drCharge inherits DataRow What is the recommended way to sort a GridView on columns related to another table?

    Read the article

  • Stable separation for two classes of elements in an array

    - by AndreyT
    Consider the following problem. We are given an array of elements belonging to one two classes: either red or blue. We have to rearrange the elements of the array so that all blue elements come first (and all red elements follow). The rearrangement must be done is stable fashion, meaning that the relative order of blue elements must be preserved (same for red ones). Is there a clever algorithm that would perform the above rearrangement in-place? A non-in place solution is, of course, straightforward. An obvious in-place solution would be to apply any stable sorting algorithm to the array. However, using a full-fledged sorting algorithm on an array intuitively feels like an overkill, especially taking into account the fact that we are only dealing with two classes of elements. Any ideas greatly appreciated.

    Read the article

  • Using Comparable to compare objects and sorting them in a TreeMap

    - by arjacsoh
    II cannot understand how should the natural ordering of class be "consistent with equals" when implementing the Comparable interface. I deteted a flaw in my program and therefore I deteced that in the documentantion of the interface Comparable. My problem is that although two Objects are considered as distinct on the base of equals method, the TreeMap structure treats them as equal and consequently does not accept the second insert. The sample code is: public class Car implements Comparable<Car> { int weight; String name; public Car(int w, String n) { weight=w; name=n; } public boolean equals(Object o){ if(o instanceof Car){ Car d = (Car)o; return ((d.name.equals(name)) && (d.weight==weight)); } return false; } public int hashCode(){ return weight/2 + 17; } public String toString(){ return "I am " +name+ " !!!"; } public int compareTo(Car d){ if(this.weight>d.weight) return 1; else if(this.weight<d.weight) return -1; else return 0; } /*public int compareTo(Car d){ return this.name.compareTo(d.name); }*/ } public static void main(String[] args) { Car d1 = new Car(100, "a"); Car d2 = new Car(110, "b"); Car d3 = new Car(110, "c"); Car d4 = new Car(100, "a"); Map<Car, Integer> m = new HashMap<Car, Integer>(); m.put(d1, 1); m.put(d2, 2); m.put(d3, 3); m.put(d4, 16); for(Map.Entry<Car, Integer> me : m.entrySet()) System.out.println(me.getKey().toString() + " " +me.getValue()); TreeMap<Car, Integer> tm = new TreeMap<Car, Integer>(m); System.out.println("After Sorting: "); for(Map.Entry<Car, Integer> me : tm.entrySet()) System.out.println(me.getKey().toString() + " " +me.getValue()); } The output is : I am a !!! 16 I am c !!! 3 I am b !!! 2 After Sorting: I am a !!! 16 I am c !!! 2 That is, that the object c has replaced (somewhat) object b. If I comment the original equals method and uncomment the second equals method, which compares the objects according name, the output is the expected: I am a !!! 16 I am c !!! 3 I am b !!! 2 After Sorting: I am a !!! 16 I am b !!! 2 I am c !!! 3 Why does it come around in this way and what should I alter in order to insert and sort different objects with some attributes of equal value in a TreeMap?

    Read the article

  • Entity Framework 4.0 Databinding with sorting not working

    - by Mike Gates
    I want to do something that I thought would be very simple. I want to bind a generated Entity Framework EntityCollection to a WPF DataGrid. I also want this grid to be sortable. I have tried all kinds of things to make this happen, including using a CollectionViewSource. However, nothing seems to work. Using a normal CollectionViewSource around the EntityCollection gives me: 'System.Windows.Data.BindingListCollectionView' view does not support sorting. Ok...strange. I would have thought this would work. Next on the CollectionViewSource, I try setting: CollectionViewType="ListCollectionView" Great, sorting now works. But wait, I can't add or remove entities using the grid now, presumably because ListCollectionView doesn't support this with an entity framework context. So, I guess I need to capture events coming out of the datagrid in order to add or remove entities manually from my context. Now I can't find an event to capture to detect an add...! Why is this so hard? This should be the standard "demo" case that Microsoft should have designed around. Any ideas?

    Read the article

  • ASP, sorting database with conditions using multiple columns...

    - by Mitch
    First of all, I'm still working in classic ASP (vbScript) with an MS Access Database. And, yes I know its archaic, but I'm still hopeful I can do this! So now to my problem: Take the following table as an example: PROJECTS ContactName StartDate EndDate Complete Mitch 2009-02-13 2011-04-23 No Eric 2006-10-01 2008-11-15 Yes Mike 2007-05-04 2009-03-30 Yes Kyle 2009-03-07 2012-07-08 No Using ASP (with VBScript), and an MS Access Database as the backend, I’d like to be able to sort this table with the following logic: I would like to sort this table by date, however, depending on whether a given project is complete or not I would like it to use either the “StartDate” or “EndDate” as the reference for a particular row. So to break it down further, this is what I’m hoping to achieve: For PROJECTS where Complete = “Yes”, reference “EndDate” for the purpose of sorting. For PROJECTS where Complete = “No”, reference “StartDate” for the purpose of sorting. So, if I were to sort the above table following these rules, the output would be: PROJECTS ContactName StartDate EndDate Complete 1 Eric 2006-10-01 2008-11-15* Yes 2 Mitch 2009-02-13* 2011-04-23 No 3 Kyle 2009-03-07* 2012-07-08 No 4 Mike 2007-05-04 2009-03-30* Yes *I’ve put a star next to the date that should be used for the sort in the table above. NOTE: This is actually a simplified version of what I really need to do, but I think that if I could just figure this out, I’ll be able to do the rest on my own. ANY HELP IS GREATLY APPRECIATED; I’VE BEEN STRUGGLING WITH THIS FOR FAR TOO LONG NOW! Thank you!

    Read the article

  • Grouping Rows with Client Side HTML Table Sorting

    - by Alan Storm
    Are there any existing table sorting libraries, or is there a way to configure tablesorter, to sort every two rows? Alternatly, is there a better way to semantially express my table such that standard row sorting will work. I have an html table that looks something like this <table> <thead> <tr> <th>Header 1</th> <th>Header 2</th> </tr> </thead> <tbody> <tr> <td>Some Data: 1</td> <td>Some More Data:1 </td> </tr> <tr> <td colspan="2">Some text about the above data that puts it in context and visually spans under both of the cells above so as not to create a weird looking table</td> </tr> <tr> <td>Some Data: 2</td> <td>Some More Data: 2</td> </tr> <tr> <td colspan="2">Some text about the above data 2 set that puts it in context and visually spans under both of the cells above so as not to create a weird looking table</td> </tr> </tbody> </table> I'm looking for a way to sort the table such that the table is sorted by the data rows, but the row with the colspan travels with its data and is not sorted separately.

    Read the article

  • PHP 5.2 Function needed for GENERIC sorting FOLLOWUP

    - by donbriggs
    OK, you guys gave me a great solution for sorting a recordset array last Friday. (http://stackoverflow.com/questions/2884325/php-5-2-function-needed-for-generic-sorting-of-a-recordset-array) But now when I implement it, I end up with an extra element in the recordset array. I won't wast space reposting the same info, as the link is above. But the bottom line is that when I sort an array of 5 records, the resulting array has 6 records. The last element in the array is not a record array, but rather just a element containing an integer value of 1. I presume that it is somehow getting the output value of the "strnatcasecmp" function, but I have no idea how it is happening. Here is the function that you fine folks provided last week: function getSortCommand($field, $sortfunc) { return create_function('$var1, $var2', 'return '.$sortfunc.'($var1["'.$field.'"], $var2["' .$field .'"]);'); } And here is the line I am calling to sort the array: $trek[] = usort($trek, getSortCommand('name', 'strnatcasecmp')); This produces the following output, with an extra element tacked on to the end. Array ( [0] = Array ( [name] = Kirk [shirt] = Gold [assign] = Bridge ) [1] => Array ( [name] => McCoy [shirt] => Blue [assign] => Sick Bay ) [2] => Array ( [name] => Scotty [shirt] => Red [assign] => Engineering ) [3] => Array ( [name] => Spock [shirt] => Blue [assign] => Bridge ) [4] => Array ( [name] => Uhura [shirt] => Red [assign] => Bridge ) [5] => 1 )

    Read the article

  • parse xml with elementtree, custom sorting

    - by microspace
    I want to parse xml file in utf-8 and sort it by some field. Soring is made by custom alphabet (s1 from sourcecode). History of question is here: sorting of list containing utf-8 charachters. I've found how to sort xml here. Sorting work correctly, the problem is with elementtree, I must admit that it doesn't work on python3 Here is source code: #!/usr/bin/env python # -*- coding: utf-8 -*- #import xml.etree.ElementTree as ET # Python 2.5 import elementtree.ElementTree as ET s1='aáàAâÂbBcCçÇdDeéEfFgGgGhHiIîÎíiiIjJkKlLmMnNóoOöÖpPqQrRsSsStTuUûúÛüÜvVwWxXyYzZ' s2='11111122334455666aabbccddeeeeeeffgghhiijjkklllllmmnnooppqqrrsssssttuuvvwwxxyy' trans = str.maketrans(s1, s2) def unikey(seq): return seq[0].translate(trans) tree = ET.parse("tosort.xml") container = tree.find("entries") data = [] for elem in container: keyd = elem.findtext("k") data.append((keyd, elem)) print (data) data.sort(key=unikey) print (data) container[:] = [item[-1] for item in data] tree.write("sorted.xml", encoding="utf-8") Here are instructions to import elementtree module. When I import module this way :import xml.etree.ElementTree as ET, I get a message: Traceback (most recent call last): File "pcs.py", line 19, in <module> container[:] = [item[-1] for item in data] File "/usr/lib/python3.1/xml/etree/ElementTree.py", line 210, in __setitem__ assert iselement(element) AssertionError When I use this method to import: import elementtree.ElementTree as ET, I get this message: Traceback (most recent call last): File "pcs.py", line 4, in <module> import elementtree.ElementTree as ET File "/usr/local/lib/python3.1/dist-packages/elementtree/ElementTree.py", line 794, in <module> _escape = re.compile(eval(r'u"[&<>\"\u0080-\uffff]+"')) File "<string>", line 1 u"[&<>\"\u0080-\uffff]+" ^ SyntaxError: invalid syntax I use Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10). In python2.6 elementtree work without a problem. Content of tosort.xml: <xdxf> <entries> <ar><k>zaaaa</k>definition1</ar> <ar><k>saaaa</k>definition2</ar> ... ... </entries> </xdxf>

    Read the article

  • sorting a gridview in class

    - by user175084
    ok i have a project which has many gridview in its pages... now i am sorting the fridveiw using the sorting function like this: protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) { DataTable dt = Session["TaskTable2"] as DataTable; if (dt != null) { //Sort the data. dt.DefaultView.Sort = e.SortExpression + " " + GetSortDirection(e.SortExpression); GridView1.DataSource = Session["TaskTable2"]; GridView1.DataBind(); } } private string GetSortDirection(string column) { // By default, set the sort direction to ascending. string sortDirection2 = "ASC"; // Retrieve the last column that was sorted. string sortExpression2 = ViewState["SortExpression2"] as string; if (sortExpression2 != null) { // Check if the same column is being sorted. // Otherwise, the default value can be returned. if (sortExpression2 == column) { string lastDirection = ViewState["SortDirection2"] as string; if ((lastDirection != null) && (lastDirection == "ASC")) { sortDirection2 = "DESC"; } } } // Save new values in ViewState. ViewState["SortDirection2"] = sortDirection2; ViewState["SortExpression2"] = column; return sortDirection2; } but this code is being repeated in many pages so i tried to put this function in a C# class and try to call it but i get errors.... for starters i get the viewstate error saying :| "viewstate does not exist in the current context" so how do i go about doing this ....?? thanks

    Read the article

  • how to do sorting using java

    - by karthikacyr
    hi friends, I have text file with list of alphabets and numbers. I want to do sorting w.r.t this number using java. My text file looks like this: a---12347 g---65784 r---675 I read the text file and i split it now. But i dont know how to perform sorting . I am new to java. Please give me a idea. My output want to be g---65784 a---12347 r---675 Plese help me. Thanks in advance. My coding is String str = ""; BufferedReader br = new BufferedReader(new FileReader("counts.txt")); while ((str = br.readLine()) != null) { String[] get = str.split("----"); When i search the internet all suggest in the type of arrays. I tried. But no use.How to inlude the get[1] into array. int arr[]=new int[50] arr[i]=get[1]; for(int i=0;i<50000;i++){ for(int j=i+1;j<60000;j++){ if(arr[i]arr[j]){ System.out.println(arr[i]); } }

    Read the article

  • jqgrid with asp.net webmethod and json working with sorting, paging, searching and LINQ

    - by aimlessWonderer
    THIS WORKS! Most topics covering jqgrid and asp.net seem to relate to just receiving JSON, or working in the MVC framework, or utilizing other handlers or web services... but not many dealt with actually passing parameters back to an actual webmethod in the codebehind. Furthermore, scarce are the examples that contain successful implementation the AJAX paging, sorting, or searching along with LINQ to SQL for asp.net jqGrid. Below is a working example that may help others who need help to pass parameters to jqGrid in order to have correct paging, sorting, filtering.. it uses pieces from here and there... ================================================== First, THE JAVASCRIPT <script type="text/javascript"> $(document).ready(function() { var grid = $("#list"); $("#list").jqGrid({ // setup custom parameter names to pass to server prmNames: { search: "isSearch", nd: null, rows: "numRows", page: "page", sort: "sortField", order: "sortOrder" }, // add by default to avoid webmethod parameter conflicts postData: { searchString: '', searchField: '', searchOper: '' }, // setup ajax call to webmethod datatype: function(postdata) { mtype: "GET", $.ajax({ url: 'PageName.aspx/getGridData', type: "POST", contentType: "application/json; charset=utf-8", data: JSON.stringify(postdata), dataType: "json", success: function(data, st) { if (st == "success") { var grid = jQuery("#list")[0]; grid.addJSONData(JSON.parse(data.d)); } }, error: function() { alert("Error with AJAX callback"); } }); }, // this is what jqGrid is looking for in json callback jsonReader: { root: "rows", page: "page", total: "totalpages", records: "totalrecords", cell: "cell", id: "id", //index of the column with the PK in it userdata: "userdata", repeatitems: true }, colNames: ['Id', 'First Name', 'Last Name'], colModel: [ { name: 'id', index: 'id', width: 55, search: false }, { name: 'fname', index: 'fname', width: 200, searchoptions: { sopt: ['eq', 'ne', 'cn']} }, { name: 'lname', index: 'lname', width: 200, searchoptions: { sopt: ['eq', 'ne', 'cn']} } ], rowNum: 10, rowList: [10, 20, 30], pager: jQuery("#pager"), sortname: "fname", sortorder: "asc", viewrecords: true, caption: "Grid Title Here" }).jqGrid('navGrid', '#pager', { edit: false, add: false, del: false }, {}, // default settings for edit {}, // add {}, // delete { closeOnEscape: true, closeAfterSearch: true}, //search {} ) }); </script> ================================================== Second, THE C# WEBMETHOD [WebMethod] public static string getGridData(int? numRows, int? page, string sortField, string sortOrder, bool isSearch, string searchField, string searchString, string searchOper) { string result = null; MyDataContext db = null; try { //--- retrieve the data db = new MyDataContext("my connection string path"); var query = from u in db.TBL_USERs select u; //--- determine if this is a search filter if (isSearch) { searchOper = getOperator(searchOper); // need to associate correct operator to value sent from jqGrid string whereClause = String.Format("{0} {1} {2}", searchField, searchOper, "@" + searchField); //--- associate value to field parameter Dictionary<string, object> param = new Dictionary<string, object>(); param.Add("@" + searchField, searchString); query = query.Where(whereClause, new object[1] { param }); } //--- setup calculations int pageIndex = page ?? 1; //--- current page int pageSize = numRows ?? 10; //--- number of rows to show per page int totalRecords = query.Count(); //--- number of total items from query int totalPages = (int)Math.Ceiling((decimal)totalRecords / (decimal)pageSize); //--- number of pages //--- filter dataset for paging and sorting IQueryable<TBL_USER> orderedRecords = query.OrderBy(sortfield); IEnumerable<TBL_USER> sortedRecords = orderedRecords.ToList(); if (sortorder == "desc") sortedRecords= sortedRecords.Reverse(); sortedRecords= sortedRecords .Skip((pageIndex - 1) * pageSize) //--- page the data .Take(pageSize); //--- format json var jsonData = new { totalpages = totalPages, //--- number of pages page = pageIndex, //--- current page totalrecords = totalRecords, //--- total items rows = ( from row in sortedRecords select new { i = row.USER_ID, cell = new string[] { row.USER_ID.ToString(), row.FNAME.ToString(), row.LNAME } } ).ToArray() }; result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonData); } catch (Exception ex) { Debug.WriteLine(ex); } finally { if (db != null) db.Dispose(); } return result; } ================================================== Third, NECESSITIES In order to have dynamic OrderBy clauses in the LINQ, I had to pull in a class to my AppCode folder called 'Dynamic.cs'. You can retrieve the file from downloading here. You will find the file in the "DynamicQuery" folder. That file will give you the ability to utilized dynamic ORDERBY clause since we don't know what column we're filtering by except on the initial load. To serialize the JSON back from the C-sharp to the JS, I incorporated the James Newton-King JSON.net DLL found here : http://json.codeplex.com/releases/view/37810. After downloading, there is a "Newtonsoft.Json.Compact.dll" which you can add in your Bin folder as a reference Here's my USING's block using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Web.UI.WebControls; using System.Web.Services; using System.Linq.Dynamic; For the Javascript references, I'm using the following scripts in respective order in case that helps some folks: 1) jquery-1.3.2.min.js ... 2) jquery-ui-1.7.2.custom.min.js ... 3) json.min.js ... 4) i18n/grid.locale-en.js ... 5) jquery.jqGrid.min.js For the CSS, I'm using jqGrid's necessities as well as the jQuery UI Theme: 1) jquery_theme/jquery-ui-1.7.2.custom.css ... 2) ui.jqgrid.css The key to getting the parameters from the JS to the WebMethod without having to parse an unserialized string on the backend or having to setup some JS logic to switch methods for different numbers of parameters was this block postData: { searchString: '', searchField: '', searchOper: '' }, Those parameters will still be set correctly when you actually do a search and then reset to empty when you "reset" or want the grid to not do any filtering Hope this helps some others!!!! Please reply if you find major issues or ways of refactoring or doing better that I haven't considered.

    Read the article

  • How can I sort a DataGridTemplateColumn on a WPF Toolkit DataGrid?

    - by Kilhoffer
    I have a WPF Toolkit DataGrid with one DataGridTemplateColumn. I've specified in a grid attribute that I wish all columns to be sortable, but the DataGridTemplateColumn won't allow it. All other columns do allow sorting. I've even tried explicitly setting CanUserSort to true for that column, but no luck. Is it even possible to sort a template column? I've provided a custom sorter that works for all columns, but the header won't allow a sort click. <Controls:DataGrid ItemsSource="{Binding Events}" AutoGenerateColumns="False" CanUserSortColumns="True" CanUserReorderColumns="False" Sorting="DataGrid_Sorting" x:Name="EventsGrid"> <Controls:DataGrid.Columns> <Controls:DataGridTemplateColumn Header="Type" Width="42" CanUserResize="False"> <Controls:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Image Source="{Binding EventTypeImage, Mode=OneWay}" HorizontalAlignment="Center" Width="16"/> </DataTemplate> </Controls:DataGridTemplateColumn.CellTemplate> </Controls:DataGridTemplateColumn> <Controls:DataGridTextColumn Header="Source" Binding="{Binding Source, Mode=OneWay}" /> <Controls:DataGridTextColumn Header="Details" MinWidth="175" Binding="{Binding Details, Mode=OneWay}" /> <Controls:DataGridTextColumn Header="Timestamp" MinWidth="175" Binding="{Binding Timestamp, Mode=OneWay}" IsReadOnly="True"/> </Controls:DataGrid.Columns> </Controls:DataGrid>

    Read the article

  • Bubble sort algorithm implementations (Haskell vs. C)

    - by kingping
    Hello. I have written 2 implementation of bubble sort algorithm in C and Haskell. Haskell implementation: module Main where main = do contents <- readFile "./data" print "Data loaded. Sorting.." let newcontents = bubblesort contents writeFile "./data_new_ghc" newcontents print "Sorting done" bubblesort list = sort list [] False rev = reverse -- separated. To see rev2 = reverse -- who calls the routine sort (x1:x2:xs) acc _ | x1 > x2 = sort (x1:xs) (x2:acc) True sort (x1:xs) acc flag = sort xs (x1:acc) flag sort [] acc True = sort (rev acc) [] False sort _ acc _ = rev2 acc I've compared these two implementations having run both on file with size of 20 KiB. C implementation took about a second, Haskell — about 1 min 10 sec. I have also profiled the Haskell application: Compile for profiling: C:\Temp ghc -prof -auto-all -O --make Main Profile: C:\Temp Main.exe +RTS -p and got these results. This is a pseudocode of the algorithm: procedure bubbleSort( A : list of sortable items ) defined as: do swapped := false for each i in 0 to length(A) - 2 inclusive do: if A[i] > A[i+1] then swap( A[i], A[i+1] ) swapped := true end if end for while swapped end procedure I wonder if it's possible to make Haskell implementation work faster without changing the algorithm (there's are actually a few tricks to make it work faster, but neither implementations have these optimizations)

    Read the article

  • A Digg-like rotating homepage of popular content, how to include date as a factor?

    - by Ferdy
    I am building an advanced image sharing web application. As you may expect, users can upload images and others can comments on it, vote on it, and favorite it. These events will determine the popularity of the image, which I capture in a "karma" field. Now I want to create a Digg-like homepage system, showing the most popular images. It's easy, since I already have the weighted Karma score. I just sort on that descendingly to show the 20 most valued images. The part that is missing is time. I do not want extremely popular images to always be on the homepage. I guess an easy solution is to restrict the result set to the last 24 hours. However, I'm also thinking that in order to keep the image rotation occur throughout the day, time can be some kind of variable where its offset has an influence on the image's sorting. Specific questions: Would you recommend the easy scenario (just sort for best images within 24 hours) or the more sophisticated one (use datetime offset as part of the sorting)? If you advise the latter, any help on the mathematical solution to this? Would it be best to run a scheduled service to mark images for the homepage, or would you advise a direct query (I'm using MySQL) As an extra note, the homepage should support paging and on a quiet day should include entries of days before in order to make sure it is always "filled" I'm not asking the community to build this algorithm, just looking for some advise :)

    Read the article

  • Handling large (object) datasets with PHP

    - by Aron Rotteveel
    I am currently working on a project that extensively relies on the EAV model. Both entities as their attributes are individually represented by a model, sometimes extending other models (or at least, base models). This has worked quite well so far since most areas of the application only rely on filtered sets of entities, and not the entire dataset. Now, however, I need to parse the entire dataset (IE: all entities and all their attributes) in order to provide a sorting/filtering algorithm based on the attributes. The application currently consists of aproximately 2200 entities, each with aproximately 100 attributes. Every entity is represented by a single model (for example Client_Model_Entity) and has a protected property called $_attributes, which is an array of Attribute objects. Each entity object is about 500KB, which results in an incredible load on the server. With 2000 entities, this means a single task would take 1GB of RAM (and a lot of CPU time) in order to work, which is unacceptable. Are there any patterns or common approaches to iterating over such large datasets? Paging is not really an option, since everything has to be taken into account in order to provide the sorting algorithm.

    Read the article

  • Insertion sort invariant assertion fails

    - by user1661211
    In the following code at the end of the for loop I use the assert function in order to test that a[i+1] is greater than or equal to a[i] but I get the following error (after the code below). Also in c++ the assert with the following seems to work just fine but in python (the following code) it does not seem to work...anyone know why? import random class Sorting: #Precondition: An array a with values. #Postcondition: Array a[1...n] is sorted. def insertion_sort(self,a): #First loop invariant: Array a[1...i] is sorted. for j in range(1,len(a)): key = a[j] i = j-1 #Second loop invariant: a[i] is the greatest value from a[i...j-1] while i >= 0 and a[i] > key: a[i+1] = a[i] i = i-1 a[i+1] = key assert a[i+1] >= a[i] return a def random_array(self,size): b = [] for i in range(0,size): b.append(random.randint(0,1000)) return b sort = Sorting() print sort.insertion_sort(sort.random_array(10)) The Error: Traceback (most recent call last): File "C:\Users\Albaraa\Desktop\CS253\Programming 1\Insertion_Sort.py", line 27, in <module> print sort.insertion_sort(sort.random_array(10)) File "C:\Users\Albaraa\Desktop\CS253\Programming 1\Insertion_Sort.py", line 16, in insertion_sort assert a[i+1] >= a[i] AssertionError

    Read the article

  • find the difference between two very large list

    - by user157195
    I have two large list(could be a hundred million items), the source of each list can be either from a database table or a flat file. both lists are of comparable sizes, both unsorted. I need to find the difference between them. so I have 3 scenarios: 1. List1 is a database table(assume each row simply have one item(key) that is a string), List2 is a large file. 2. Both lists are from 2 db tables. 3. both lists are from two files. in case 2, I plan to use: select a.item from MyTable a where a.item not in (select b.item form MyTable b) this clearly is inefficient, is there a better way? Another approach is: I plan to sort each list, and then walk down both of them to find the diff. If the list is from a file, I have to read it into a db table first, then use db sorting to output the list. Is the run time complexity still O(nlogn) in db sorting? either approach is a pain and seems would be very slow when the list involved has hundreds of millions of items. any suggestions?

    Read the article

  • Dynamic sorting of tables on BIRT without javascript

    - by ebae
    I am using WebViewerExample as my reporting. I am designing reports within Eclipse using report designer. I have a table with several columns. Data is retrieved from database. Is there an easy way to dynamically sort the tables by clicking on the column header names? I tried to pass string as a sorting condition, but it ain't helping. Any ideas?

    Read the article

  • XSLT: How to reverse output without sorting

    - by prometoys
    Hi, I have a list of items: a x c z and I want as output z c x a I have no order information in the file and I just want to reverse the lines. The last line in the source file should be first line in the output. How can I solve this problem with XSLT without sorting by number etc.

    Read the article

  • Sorting XML generated by Castor

    - by Java Guy
    Hello, I am using Castor for XML Binding.. We need to sort the XML based on two different fields. Is there way we can specify the sort order in castor while marshalling? Which will be a better approach to do this sorting, if castor don't have this feature.

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >