Search Results

Search found 10131 results on 406 pages for 'natural sort'.

Page 27/406 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • How to program a Sort feature

    - by Brian Roisentul
    I'm working on Ruby on rails 2.3.4 and I'm trying to develop a Sort feature on my website's search page(its url is /anuncios/buscar). What I tried is to create a "map" on routes file: map.search_filter_relevance "/anuncios/buscar", :controller => 'announcements', :action => 'search_filter_relevance' Then, I wrote this on the view: <%= link_to 'M&Aacute;S RELEVANTES', search_filter_relevance(@announcements) %> And finally, I created a method in the controller, as is specified on the routes' line: def search_filer_relevance raise params.inspect end First of all, as I'm sorting search results, I'd like to keep them in their public variable called @announcements. Please help me do this. An the other thing is that when I click the link I get an error due its trying to access the Show action instead of search_filter_relevance as specified in routes. Why is this happening?

    Read the article

  • question about Batcher odd-even sort

    - by davit-datuashvili
    hi i ave question about Batcher's odd-even sort i have following code public class Batcher{ public static void batchsort(int a[],int l,int r){ int n=r-l+1; for (int p=1;p<n;p+=p) for (int k=p;k>0;k/=2) for (int j=k%p;j+k<n;j+=(k+k)) for (int i=0;i<n-j-k;i++) if ((j+i)/(p+p)==(j+i+k)/(p+p)) exch(a,l+j+i,l+j+i+k); } public static void main(String[]args){ int a[]=new int[]{2,4,3,4,6,5,3}; batchsort(a,0,a.length-1); for (int i=0;i<a.length;i++){ System.out.println(a[i]); } } public static void exch(int a[],int i,int j){ int t=a[i]; a[i]=a[j]; a[j]=t; } } //result is 3 3 4 4 5 2 6 what i missed ? hat is wrong?

    Read the article

  • Inter-rater agreement (Fleiss' Kappa, Krippendorff's Alpha etc) Java API?

    - by adam
    I am working on building a Question Classification/Answering corpus as a part of my masters thesis. I'm looking at evaluating my expected answer type taxonomy with respect to inter-rater agreement/reliability, and I was wondering: Does anybody know of any decent (preferably free) Java API(s) that can do this? I'm reasonably certain all I need is Fleiss' Kappa and Krippendorff's Alpha at this point. Weka provides a kappa statistic in it's evaluation package, but I think it can only evaluate a classifier and I'm not at that stage yet (because I'm still building the data set and classes). Thanks.

    Read the article

  • Word filter that groups words?

    - by Legend
    Is there any library that achieves the following: Convert Microsoft Windows 98 Microsoft Windows XP Windows 7 Windows Ultimate Desktop Windows to Windows 4 The complicated part here is to recognize that "Desktop Windows" is an anomaly here and not count it. If nothing is added before the word "Windows", perhaps it can be counted but if there is something else and the suffix does not match any popular suffix, it can still be counted. Maybe I am a little vague here but perhaps someone could have an idea about what I am talking about here. Any suggestions?

    Read the article

  • Find and sort by number of ocurrences of tag with Active Admin and act_as_taggable_on

    - by nunopolonia
    I'm using act_as_taggable_on and Active Admin on a Rails project. In that project there are Posts and each Post has Tags. I want to show a list of Tags in Active Admin and the number of ocurrences of each one. The way I found to do this was: index do column :name column :ocurrences do |tag| ocurrences = Post.tag_counts.find(tag.id).count end default_actions end Which will search the Tag List every time for every Post, which performance wise looks really bad. I would also like to be able to sort the tags by ocurrence. Any idea of how I can do it?

    Read the article

  • List of uninteresting words

    - by Hooked
    [Caveat] This is not directly a programing question, but it is something that comes up so often in language processing that I'm sure it's of some use to the community. Does anyone have a good list of uninteresting (English) words that have been tested by more then a casual look? This would include all prepositions, conjunctions, etc... words that may have semantic meaning, but are often frequent in every sentence, regardless of the subject. I've built my own lists from time to time for personal projects but they've been ad-hoc; I continuously add words that I forgotten as they come in.

    Read the article

  • How to filter/sort/rank object model nodes?

    - by BCS
    I have some kind of object model and I need to filter and sort it's nodes for some kind of property. What kinds of automated systems exist to generate and select properties of the object model that correlate to what I want? (I'm intentionally being abstract and non-specific) I'm thinking of a system that works kind of like spam filters or supervised classification systems in that given an example data set it identifies rules that find nodes of interest. However I'm looking for a more general system in that it shouldn't require any design time information about the object model. It should work equality well as a spam filter on e-mail, a bug finder on a code base, an interest filter in a newsgroup or bot accounts finder on a social networking site. As long as it can explore the object model via reflection and be given a set of "interesting" nodes, it should be able to find rules that will find more nodes like them.

    Read the article

  • question abouut string sort

    - by davit-datuashvili
    i have question from programming pearls problem is following show how to use lomuto's partitioning scheme to sort varying length bit strings in time proportional to the sum oof their length and algorithm is following each record in x[0..n-1] has an integer length and pointer to the array bit[0..length-1] code void bsort(l,u,depth){ if (l>=u) return; for (int i=l;i<u;i++) if (x[i].length<depth) swap(i,l++); m=l; if (x[i].bit[depth] ==0) swap(i,m++); bsort(l,m-1,depth+1); bsort(m,u,depth+1); please help me i need following things 1. how this algorith works 2.how implement in java?

    Read the article

  • trying to sort a simple string in c++

    - by every_answer_gets_a_point
    #include "stdio.h" #include "conio.h" #include <iostream> using namespace std; int main (void) { char my_char[] = "happy birthday"; int i; bool j=false; char my_char_temp[1]; do { for (i=0;i<sizeof(my_char)-2;i++) { j=false; if (my_char[i+1] < my_char[i]) { my_char_temp[0]=my_char[i+1]; my_char[i+1] = my_char[i]; my_char[i] = my_char_temp[0]; j=true; } } }while (j); cout << my_char; } what am i doing wrong? im just trying to sort the letters within the char the output i get is completely wrong

    Read the article

  • Is "programmatically" a word? [closed]

    - by Lo'oris
    I can't find it on any of the online dictionaries I know: dict.org, word reference, urban dictionary, oxford paravia, garzanti. To my ears of a non-native speaker, it sounds horrible. Actually it sounds like a word made-up by another non-native speaker that wanted to say something, didn't know how, and just hacked in a word of his language. The only place I've read it other then user-created-content is the android documentation, so this might or might not be related. Do you happen to know where did it start to be used, why by did it spread so much, what does it really mean?

    Read the article

  • PHP sort multidimensional array by value

    - by stef
    How can I sort this array by the value of the "order" key? Even though the values are currently sequential, they will not always be. Array ( [0] => Array ( [hashtag] => a7e87329b5eab8578f4f1098a152d6f4 [title] => Flower [order] => 3 ) [1] => Array ( [hashtag] => b24ce0cd392a5b0b8dedc66c25213594 [title] => Free [order] => 2 ) [2] => Array ( [hashtag] => e7d31fc0602fb2ede144d18cdffd816b [title] => Ready [order] => 1 ) )

    Read the article

  • Sort a DataGridView by DisplayMember

    - by Dave
    Hi, I have a DataGridView that is bound to a DataTable. In this table there are some foreign keys. I am then using the CellFormatting event to get the corresponding text from another database table for each foreign key. I want to sort the DataGridView when the user clicks the header. Automatic sorting works but is not correct as it is Sorting on the ValueMember (ForeignKey ID) and not on the DisplayMember (the text). I tried using the SortCompare event but then I read that it does not work on DataGridViews that use the DataSource property. How can this be done? Thanks

    Read the article

  • Sort an object by an other one.

    - by kevinb92
    Here's the deal : I have Publication objets in my application. I also have Vote objet. I can add votes on publication. A vote is defined like this, forOrAgainst, LinkedPublication, date, author etc etc... I want to sort Publication list by number of vote. What is the best way to link them ? Should i return a hashmap ? a treeset ? How do i add votes to publication. It's kinda messy in my brain now...

    Read the article

  • About insertion sort and especially why it's said that copy is much faster than swap?

    - by Software Engeneering Learner
    From Lafore's "Data Structures and Algorithms in Java": (about insertion sort (which uses copy + shift instead of swap (used in bubble and selection sort))) However, a copy isn’t as time-consuming as a swap, so for random data this algo- rithm runs twice as fast as the bubble sort and faster than the selectionsort. Also author doesn't mention how time consuming shift is. From my POV copy is the simplest pointer assignment operation. While swap is 3x pointer assignment operations. Which doesn't take much time. Also shift of N elemtns is Nx pointer assignment operations. Please correct me if I'm wrong. Please explain, why what author says is true? I don't understand.

    Read the article

  • How should I sort images in an isometric game so that they appear in the correct order?

    - by Andrew
    This seems like a rather simple problem but I am having a lot of difficulty with it. What should I do to properly sort images in an isometric game? In a normal 2d top-down game one could use the screen y axis to sort the images. In this example the trees are properly sorted but the isometric walls are not. Example image: sorted by screen y Wall2 is one pixel below wall1 therefore it is drawn after wall1. If I sort by the isometric y axis the walls appear in the correct order but the trees do not. Example image: sorted by isometric y

    Read the article

  • How should I sort images in an isometric game so that they appear in the correct order?

    - by Andrew
    Hi! This seems like a rather simple problem but I am having a lot of difficulty with it. What should I do to properly sort images in an isometric game? In a normal 2d top-down game one could use the screen y axis to sort the images. In this example the trees are properly sorted but the isometric walls are not. Example image: sorted by screen y Wall2 is one pixel below wall1 therefore it is drawn after wall1. If I sort by the isometric y axis the walls appear in the correct order but the trees do not. Example image: sorted by isometric y

    Read the article

  • RadGrid nestedview sort makes nestedview disappear?

    - by lance
    When I click on the header of my detail table, it disappears entirely, leaving empty white space in the browser where it used to be. The Ajax postback caused by my clicking on the header does fire FooGridNeedDataSource and FooGridItemCommand, but I've used the debugger to skip the code inside those handlers (after clicking the header of the column I'm trying to sort, in the detail table), and I still get the same behavior. I'm hoping someone can tell me what I'm doing wrong? The MasterTableView sorts just fine (my real markup enables that with AllowSorting="true" on MasterTableView). <telerik:RadGrid ID="FooGrid" runat="server" AutoGenerateColumns="false" OnNeedDataSource="FooGridNeedDataSource" OnItemCommand="FooGridItemCommand" > <MasterTableView ClientDataKeyNames="FooData" DataKeyNames="FooData"> <Columns> <telerik:GridBoundColumn DataField="FooData" HeaderText="Foo"></telerik:GridBoundColumn> </Columns> <DetailTables> <telerik:GridTableView AllowSorting="true"> <Columns> <telerik:GridBoundColumn DataField="FooDetailData" HeaderText="Foo Detail" ></telerik:GridBoundColumn> </Columns> </telerik:GridTableView> </DetailTables> </MasterTableView> </telerik:RadGrid>

    Read the article

  • sort django queryset by latest instance of a subset of related model

    - by rsp
    I have an Order model and order_event model. Each order_event has a foreignkey to order. so from an order instance i can get: myorder.order_event_set. I want to get a list of all orders but i want them to be sorted by the date of the last event. A statement like this works to sort by the latest event date: queryset = Order.objects.all().annotate(latest_event_date=Max('order_event__event_datetime')).order_by('latest_event_date') However, what I really need is a list of all orders sorted by latest date of A SUBSET OF EVENTS. For example my events are categorized into "scheduling", "processing", etc. So I should be able to get a list of all orders sorted by the latest scheduling event. This django doc (https://docs.djangoproject.com/en/dev/topics/db/aggregation/#filter-and-exclude) shows how I can get the latest schedule event using a filter but this excludes orders without a scheduling event. I thought I could combine the filtered queryset with a queryset that includes back those orders that are missing a scheduling event...but I'm not quite sure how to do this. I saw answers related to using python list but it would be much more useful to have a proper django queryset (ie for a view with pagination, etc.)

    Read the article

  • save xml object so that elements are in sorted order in saved xml file

    - by scot
    Hi , I am saving a xml document object and it is saved in a xml file as shown below . <author name="tom" book="Fun-II"/> <author name="jack" book="Live-I"/> <author name="pete" book="Code-I"/> <author name="jack" book="Live-II"/> <author name="pete" book="Code-II"/> <author name="tom" book="Fun-I"/> instead i want to sort the content in document object so that when i persist the object it is saved by grouping authors then book name as below: <author name="jack" book="Live-I"/> <author name="jack" book="Live-II"/> <author name="pete" book="Code-I"/> <author name="pete" book="Code-II"/> <author name="tom" book="Fun-I"/> <author name="tom" book="Fun-II"/> I use apache xml beans..any ideas on how to achieve this? thanks.

    Read the article

  • Idiomatic default sort using WCF RIA, EF4, Silverlight?

    - by Duncan Bayne
    I've got two Silverlight 4.0 ComboBoxes; the second displays the children of the entity selected in the first: <ComboBox Name="cmbThings" ItemsSource="{Binding Path=Things,Mode=TwoWay}" DisplayMemberPath="Name" SelectionChanged="CmbThingsSelectionChanged" /> <ComboBox Name="cmbChildThings" ItemsSource="{Binding Path=SelectedThing.ChildThings,Mode=TwoWay}" DisplayMemberPath="Name" /> The code behind the view provides a (simple, hacky) way to databind those ComboBoxes, by loading Entity Framework 4.0 entities through a WCF RIA service: public EntitySet<Thing> Things { get; private set; } public Thing SelectedThing { get; private set; } protected override void OnNavigatedTo(NavigationEventArgs e) { var context = new SortingDomainContext(); context.Load(context.GetThingsQuery()); context.Load(context.GetChildThingsQuery()); Things = context.Things; DataContext = this; } private void CmbThingsSelectionChanged(object sender, SelectionChangedEventArgs e) { SelectedThing = (Thing) cmbThings.SelectedItem; if (PropertyChanged != null) { PropertyChanged.Invoke(this, new PropertyChangedEventArgs("SelectedThing")); } } public event PropertyChangedEventHandler PropertyChanged; What I'd like to do is have both combo boxes sort their contents alphabetically, and I'd like to specify that behaviour in the XAML if at all possible. Could someone please tell me what is the idiomatic way of doing this with the SL4 / EF4 / WCF RIA technology stack?

    Read the article

  • How to horizontally sort divs using Sortable in JQuery

    - by Tahir Akram
    I am looking to sort my divs horizontally in a container div. I found an example on JQuery website but that is vertical sorting. I want it horizontal. I want to do it sorting in #sortable Div. Will you please guide me how can I convert this vertical sorting in horizontal manner. CSS <style type="text/css"> #draggable1 { width: 150px; height: 35px; padding: 0.5em; } #draggable2 { width: 150px; height: 35px; padding: 0.5em; } #draggable3 { width: 150px; height: 35px; padding: 0.5em; } #sortable { width: 700px; height: 35px; padding: 0.5em; } </style> JavaScript <script type="text/javascript"> $(function() { $("#sortable").sortable({ revert: true }); }); </script> HTML <div class="demo"> <div id="sortable" class="ui-state-default"> <div id = "draggable1" class="ui-state-default">Home</div> <div id = "draggable2" class="ui-state-default">Contact Us</div> <div id = "draggable3" class="ui-state-default">FAQs</div> </div> </div> Screenshot

    Read the article

  • How to sort linq result by most similarity/equality

    - by aNui
    I want to do a search for Music instruments which has its informations Name, Category and Origin as I asked in my post. But now I want to sort/group the result by similarity/equality to the keyword such as. If I have the list { Drum, Grand Piano, Guitar, Guitarrón, Harp, Piano} << sorted by name and if I queried "p" the result should be { Piano, Grand Piano, Harp } but it shows Harp first because of the source list's sequence and if I add {Grand Piano} to the list and query "piano" the result shoud be like { Piano, Grand Piano } or query "guitar" it should be { Guitar, Guitarrón } here's my code static IEnumerable<MInstrument> InstrumentsSearch(IEnumerable<MInstrument> InstrumentsList, string query, MInstrument.Category[] SelectedCategories, MInstrument.Origin[] SelectedOrigins) { var result = InstrumentsList .Where(item => SelectedCategories.Contains(item.category)) .Where(item => SelectedOrigins.Contains(item.origin)) .Where(item => { if ( (" " + item.Name.ToLower()).Contains(" " + query.ToLower()) || item.Name.IndexOf(query) != -1 ) { return true; } return false; } ) .Take(30); return result.ToList<MInstrument>(); } Or the result may be like my old self-invented algorithm that I called "by order of occurence", that is just OK to me. And the further things to do is I need to search the Name, Category or Origin such as. If i type "Italy" it should found Piano or something from Italy. Or if I type "string" it should found Guitar. Is there any way to do those things, please tell me. Thanks in advance.

    Read the article

  • php - sort and delete duplicates?

    - by c41122ino
    I've got an array that looks like this: Array ( [0] => Array ( num => 09989, dis => 20 ) [1] => Array ( num => 09989, dis => 10 ) [2] => Array ( num => 56676, dis => 15 ) [3] => Array ( num => 44533, dis => 20 ) [4] => Array ( num => 44533, dis => 50 ) ) First, I'm trying to sort them by num, and can't seem to get the usort example from php.net working here. It simply doesn't appear to be sorting... I'm also trying to delete the array element if it's a duplicate and whose dis value is higher than the other one. So, based on the example above, I'm trying to create: Array ( [0] => Array ( num => 09989, dis => 10 ) [1] => Array ( num => 44533, dis => 20 ) [2] => Array ( num => 56676, dis => 15 ) ) This is the code from php.net: function cmp($a, $b) { if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; }

    Read the article

  • MVC Paging and Sorting Patterns: How to Page or Sort Re-Using Form Criteria

    - by CRice
    What is the best ASP.NET MVC pattern for paging data when the data is filtered by form criteria? This question is similar to: http://stackoverflow.com/questions/1425000/preserve-data-in-net-mvc but surely there is a better answer? Currently, when I click the search button this action is called: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Search(MemberSearchForm formSp, int? pageIndex, string sortExpression) {} That is perfect for the initial display of the results in the table. But I want to have page number links or sort expression links re-post the current form data (the user entered it the first time - persisted because it is returned as viewdata), along with extra route params 'pageIndex' or 'sortExpression', Can an ActionLink or RouteLink (which I would use for page numbers) post the form to the url they specify? <%= Html.RouteLink("page 2", "MemberSearch", new { pageIndex = 1 })%> At the moment they just do a basic redirect and do not post the form values so the search page loads fresh. In regular old web forms I used to persist the search params (MemberSearchForm) in the ViewState and have a GridView paging or sorting event reuse it.

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >