Search Results

Search found 9186 results on 368 pages for 'sort'.

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

  • php - sort the unsorted text file and rewrite to same text file in sorted order

    - by arrgggg
    Hi, I have a question. I am in process of learning how to read/write files, but having little trouble trying to do both at the same time in same php script. I have a text file with words like this, Richmond,Virginia Seattle,Washington Los Angeles,California Dallas,Texas Jacksonville,Florida I wrote a code to sort them in order and this will display in sort order by City. <?php $file = file("states.txt"); sort($file); for($i=0; $i<count($file); $i++) { $states = explode(",", $file[$i]); echo $states[0], $states[1],"<br />"; } ?> From this, how can I rewrite those sorted information back into the states.txt file? Thanks for your help.

    Read the article

  • ASP.NET - Overriding Gridview OnRowCreated to add sort images -- columns are null

    - by Zach
    I'm overriding the onrowcreated to add sort images to the header row of a gridview. This works, but actually adding a sortexpression doesn't. What I want to do is set the images as imagebuttons and set their commandarguments to the sort expression of the column they are sorting for. I would assume I could get the cell and from it's index get the gridviewcolumn. Then, I could just get the sortexpression of the gridview column, but this does not work. The columns are null. OnRowCreated Code snippet below: //if this is the header row, we add sort images to each cell if (row.RowType == DataControlRowType.Header) { //iterate through the cells for (int i = 0; i < row.Cells.Count; i++) { //if the column is sortable and visible if (this.Columns[i].SortExpression != string.Empty && this.Columns[i].Visible) { string strSort = this.Columns[i].SortExpression; } } } Can we not get columns in OnRowCreated like this?

    Read the article

  • How to sort a gridview once a radio button is selected

    - by metashockwave
    I'm trying to sort records in the gridview right after a radio button is selected. My approach is with the dataview, but because the dataset variable doesn't survive a round trip to the server, I don't know how to make this happen. please help! Public Sub GetCustomers() db.RunProcedure("usp_customers_get_all") db.doSort(radList.SelectedValue) gvCustomers.DataSource = db.MyView End Sub Protected Sub radList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radList.SelectedIndexChanged If radList.SelectedValue = 0 Then db.doSort(0) gvCustomers.DataSource = db.MyView End If If radList.SelectedValue = 1 Then db.doSort(1) gvCustomers.DataSource = db.MyView End If End Sub Public Sub doSort(ByVal strIn As Integer) If strIn = 0 Then MyView.Sort = "lastname, firstname" Else MyView.Sort = "username" End If End Sub Public Sub RunProcedure(ByVal strName As String) Dim objConnection As New SqlConnection(mstrConnection) Dim mdbDataAdapter As New SqlDataAdapter(strName, objConnection) Try mdbDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure Me.mDataset.Clear() mdbDataAdapter.Fill(mDataset, "tblCustomers") MyView.Table = mDataset.Tables("tblCustomers") Catch ex As Exception Throw New Exception("stored procedure is " & strName.ToString & " error is " & ex.Message) End Try End Sub

    Read the article

  • OS X contains heapsort in stdlib.h which conflicts with heapsort in sort library

    - by CryptoQuick
    I'm using Ariel Faigon's sort library, found here: http://www.yendor.com/programming/sort/ I was able to get all my code working on Linux, but unfortunately, when trying to compile with GCC on Mac, its default stdlib.h contains another heapsort, which unfortunately results in a conflicting types error. Here's the man page for Apple heapsort: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/heapsort.3.html Commenting out the heapsort in the sort library header causes a whole heap of problems. (pardon the pun) I also briefly thought of commenting out my use of stdlib.h, but I use malloc and realloc, so that won't work at all. Any ideas?

    Read the article

  • XSLT Sort Alphabetically & Numerically Problem

    - by Bryan
    I have a group of strings ie g:lines = '9,1,306,LUCY,G,89' I need the output to be: 1,9,89,306,G,LUCY This is my current code: <xsl:for-each select="$all_alerts[g:problem!='normal_service'][g:service='bus']"> <xsl:sort select="g:line"/> <xsl:sort select="number(g:line)" data-type="number"/> <xsl:value-of select="normalize-space(g:line)" /><xsl:text/> <xsl:if test="position()!=last()"><xsl:text>,&#160;</xsl:text></xsl:if> </xsl:for-each> I can get it to only display '1, 12, 306, 38, 9, G, LUCY' because the 2nd sort isn't being picked up. Anyone able help me out?

    Read the article

  • Batch INSYNC help needed...

    - by Raja Reddy
    I have a INSYNC batch to 'extract' certain conditioned data output. For instance, below insync code extracts the data if 44 pos has a value of '25'. Question here is, I wanna get the output in a sorted manner based on a particular field. Can we incorporate the SORT criteria below. Suggestions are really appreciated. FUNCTION=EXTRACT INDD=#INDD OUTDD=#OUTDD RDW=OFF LINESPERPAGE=080 CASE SEARCHDATA=(00044,002,EQ,C'25') ENDCASE PS: We can achieve the same by means of SORT utility through 'SORT FIELDS' parameter.

    Read the article

  • How to Sort List Collection

    - by Muhammad Akhtar
    I have class like public class ProgressBars { public ProgressBars() { } private Int32 _ID; private Int32 _Name; public virtual Int32 ID {get { return _ID; } set { _ID = value; } } public virtual Int32 Name { get { return _Name; } set { _Name = value; }} } here is List collection List<ProgressBars> progress; progress.Sort //I need to get sort here by Name how can I sort this collection? Thanks

    Read the article

  • How to Sort Typed List Collection

    - by Muhammad Akhtar
    I have class like public class ProgressBars { public ProgressBars() { } private Int32 _ID; private string _Name; public virtual Int32 ID {get { return _ID; } set { _ID = value; } } public virtual string Name { get { return _Name; } set { _Name = value; }} } here is List collection List<ProgressBars> progress; progress.Sort //I need to get sort here by Name how can I sort this collection by Name? Thanks

    Read the article

  • Sort files by name in Java differs from Windows Explorer

    - by Martyn Hopkins
    I have a simple Java program which reads a file directory and outputs a file list. I sort the files by name: String [] files = dirlist.list(); files = sort(files); My problem is that it sorts by name in a different way than Windows Explorer does. For instance if I have these files: abc1.doc, abc12.doc, abc2.doc. Java will sort like this: abc1.doc abc12.doc abc2.doc When I open the folder in Explorer, my files are sorted like this: abc1.doc abc2.doc abc12.doc How can I make Java sorts my files like in Windows Explorer? Is this a Windows trick?

    Read the article

  • Sort a 2D Points List (first by X and then Y)

    - by Mikos
    I am trying to sort a List of 2D Points first by x co-ordinate and then by y co-ordinate. I implemented the IComparer interface as follows: class PointComparer : IComparer<Point> { public int Compare(Point x, Point y) { if (x.Y != y.Y) { return x.Y - y.Y; } else { return x.X - y.X; } } } And then call my sorting as follows: pointsList.Sort(new PointComparer()); For some reason the list doesn't sort. Surely is something very simple and silly, but stuck on this for quite a while....TIA

    Read the article

  • Progressbar: Force element.innerHTML update before javascript sort call

    - by maras
    Hi, what is the best practice for this scenario: 1) User clicks "Sort huge javascript array" 2) Browser shows "Sorting..." through element.innerHTML="Sorting" 3) Browser sorts huge javascript array (100% CPU for several seconds) while displaying "Sorting..." message. 4) Browser shows result. Pseudo code: ... <a href="#" onclick="sortHugeArray();return false">Sort huge array</a> ... function sortHugeArray(){ document.getElementById("progress").innerHTML="Sorting..."; ...do huge sort ... ...render result... document.getElementById("progress").innerHTML=result; } When i do that this way, browser never shows "Sorting...", it freezes browser for several seconds and shows result without noticing user... Thank you for advice.

    Read the article

  • PHP sorting an array by mysql date.

    - by daviemanchester
    Hi I have an array that I would like to sort using a date field from a mysql database. Here is a sample of the array which is named 'news' in my class: [48] => Array ( [id] => 14 [type] => 3 [updated] => 2010-04-17 13:54:42 ) [49] => Array ( [id] => 15 [type] => 3 [updated] => 2010-04-17 13:57:21 ) I want to sort de by the 'updated' field. I have some code I have started but am unsure how to complete it and get it working. function sortNews($x) { usort($this->news, array("ProcessClass", "cmp")); //correct sort type? } function cmp($a, $b) { ...................................... missing code } Can anyone help??

    Read the article

  • Sorting in Matlab

    - by smichak
    Hi, I would like to sort elements in a comma-separated list. The elements in the list are structs and I would like the list to be sorted according to one of the fields in the struct. For example, given the following code: L = {struct('obs', [1 2 3 4], 'n', 4), struct('obs', [6 7 5 3], 'n', 2)}; I would want to have a way to sort L by the field 'n'. Matlab's sort function only works on matrices or arrays and on lists of strings (not even lists of numbers). Any ideas on how that may be achieved? Thanks, Micha

    Read the article

  • sort a list of objects based on runtime property

    - by jijo
    I have an arraylist of VOs. These objects have many properties and corresponding get/set methods. I want to sort this array list based on a property which I'll be getting in runtime. Let me explain in detail. My VO is like this public class Employee { String name; String id; private String getName() { return name; } private String getId() { return id; } } I will be getting a string ‘sort’ in runtime, which can be either ‘id’ of ‘name’. I want to sort the list based on the value of the string. I have tried to use comparator and reflection together, but no luck. I don’t want to use an if loop and create new comparator classes. Any other thoughts?

    Read the article

  • sort std::list case sensitive elements

    - by Dave18
    #include <list> #include <string> using std::string; using std::list; int main() { list <string> list_; list_.push_back("C"); list_.push_back("a"); list_.push_back("b"); list_.sort(); } does sort() function sort the elements according to their character codes? I want the result here to be a b C after the sorting is done.

    Read the article

  • jQuery/Tablesorter: maintain secondary alphabetical sort

    - by user460847
    I have a table of names and ages that I want the user to be able to sort. When the page initally loads, sortList lists the rows in order from oldest to youngest, and then secondarily from A to Z. I want the same thing (a SECONDARY alphabetical sort) when the user actually clicks on the age <th>, but sortForce is making the alphabetical sort primary. Is there an alternative? $('#super_results table').tablesorter({ sortForce: [[0,0]], sortList: [[1,1],[0,0]] }); Or am I misunderstanding sortForce? Documentation here.

    Read the article

  • Turning a log file into a sort of circular buffer

    - by pachanga
    Folks, is there a *nix solution which would make the log file act as a circular buffer? For example, I'd like log files to store maximum 1Gb of data and discard the older entries once the limit is reached. Is it possible at all? I believe in order to achieve that a log file should be turned into some sort of special device... P.S. I'm aware of misc logrotating tools but this is not what I need. Logrotating requires lots of IO, happens usually once a day while I need a "runtime" solution.

    Read the article

  • Excel wizardness needed - Group By, Sort, Count function help

    - by Chris
    Riddle me this: You have 3 part numbers with the same part name xyz, each with a quantity of 10 items. The items can be picked during the day or week, therefore changing the amount of items on hand. I know I need to use the group by, sort, count and perhaps sumif formulas to have a running count of the number of items on hand at the end of each day (which could be positive or negative). Help? it wont let me add an image because i'm a new user. 'Oops! Your edit couldn't be submitted because: * we're sorry, but as a spam prevention mechanism, new users aren't allowed to post images. Earn more than 10 reputation to post images. '

    Read the article

  • Default sort order in Windows folder

    - by Florian Müller
    I am running Windows 7 and I have a folder "Dropbox" inside my Documents folder. However, every time I restart Explorer and enter this folder, it is sorted by mutation date. I'd like to have it default sorted by name, which is still default in all other folders, however not in this one. Please let me know if there is a way to define this properly! Thanks in advance! Note: I actually found out that this is in every folder or library now, not only in some folders. This is the standard sort behaviour when I open explorer the first time.

    Read the article

  • Python 2 dict_items.sort() in Python 3

    - by DaveWeber
    I'm porting some code from Python 2 to 3. This is valid code in Python 2 syntax: def print_sorted_dictionary(dictionary): items=dictionary.items() items.sort() In Python 3, the dict_items have no method 'sort' - how can I make a workaround for this in Python 3?

    Read the article

  • sort by date in caml query

    - by AB
    I want to sort my list items by date: I m using <OrderBy><FieldRef Name='SortDate' Ascending='True'/></Order By> but its giving me results randomly.Is it possible to sort by date in CAML if not then if there is any other way to retrieve list items sorted on the basis of date....

    Read the article

  • fastest way to sort the entries of a "smooth" 2D array

    - by Drew Wagner
    What is the fastest way to sort the values in a smooth 2D array? The input is a small filtered image: about 60 by 80 pixels single channel single or double precision float row major storage, sequential in memory values have mixed sign piecewise "smooth", with regions on the order of 10 pixels wide Output is a flat (about 4800 value) array of the sorted values, along with the indices that sort the original array.

    Read the article

  • Sort by two values prioritizing on one of them

    - by Dojie
    How would I sort this data by count and year values in ascending order prioritizing on the count value? //sort this var data = [ { count: '12', year: '1956' }, { count: '1', year: '1971' }, { count: '33', year: '1989' }, { count: '33', year: '1988' } ]; //to get this var data = [ { count: '1', year: '1971' }, { count: '12', year: '1956' }, { count: '33', year: '1988' }, { count: '33', year: '1989' }, ];

    Read the article

  • Sort algorithm with fewest number of operations

    - by luvieere
    What is the sort algorithm with fewest number of operations? I need to implement it in HLSL as part of a pixel shader effect v2.0 for WPF, so it needs to have a really small number of operations, considering Pixel Shader's limitations. I need to sort 9 values, specifically the current pixel and its neighbors.

    Read the article

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