Efficiently get sorted sums of a sorted list

You have an ascending list of numbers, what is the most efficient algorithm you can think of to get the ascending list of sums of every two numbers in that list. Duplicates in the resulting list...

Merge nested list items based on a repeating value

Although poorly written, this code: marker_array = [['hard','2','soft'],['heavy','2','light'],['rock','2','feather'],['fast','3'], ['turtle','4','wet']] marker_array_DS = [] for i in...

Reading from and writing to text files using arrays

I am working on a program in the C language for a class and I am stuck. I have been researching everywhere (textbooks, Internet, classmates, class notes) and I can't seem to find the problem. Here...

Kendo UI Grid - Sort by Descending Before Ascending

I've read through every online post I could find about about sorting with the Kendo Grid. Basically I'm trying to find a way to sort by descending first and then ascending after. I know how to set...

Use of INDEX MATCH to find absolute closest value

I've long sought a method for using INDEX MATCH in Excel to return the absolute closest number in an array without reorganizing my data (since MATCH requires lookup_array to be in descending order...

Enumerate factors of a number directly in ascending order without sorting?

Is there an efficient algorithm to enumerate the factors of a number n, in ascending order, without sorting? By “efficient” I mean: The algorithm avoids a brute-force search for divisors by...

MongoDB: How to get the newest documents within a collection by using _id?

How would I retrieve the newest documents created in my collection by using _id? I'm trying to implement a pagination in my web application by: Retrieving the _id of the last document loaded in...

Wordpress Custom Column Default Ordering

I have a custom post type named "Team Members" along with some custom columns - one specifically set up to use for ordering the custom posts. I've set it up so that when you first visit the Team...

Firebase query sort order in swift?

When I load the following Firebase Database data into my tableView, the data is sorted in ascending order by date. How can I order this by descending (show the newest post at the top)? Query in...

Sort the data of a Qml ListView by using a QSortFilterProxyModel.

I'm making a chat client, and I am using a qml ListView to display all the messages in a "chat room". I am using my own model class that derives from QAbstractListModel for storing all the...

Javascript: using the replace method on hex or dec character using the hex or dec value itself

I have a HTML table with a sorting function to sort in ascending or descending order by column. To show that I am using the down- and up- pointing small triangles with hex code x25BE; and x25B4;...

Ordering listview with get_queryset

Two models : Post and Author This view displays the last Post for each Author (author is a ForeignKey) I want to have these posts in a descending order, but it does not work. The template keeps...

Arranging strings in ascending and descending order using array lists

I wrote a post before with a much more rudimentary version of the following code. I rearranged it, but it still doesn't work. Whenever I input a new string, it doesn't go in either of the two...

How to sort an array of odd numbers in ascending order, but keep even numbers at their position?

I want to sort only odd numbers without moving even numbers. For example, when I write : sortArray([5, 3, 2, 8, 1, 4]) The expected result is : [1, 3, 2, 8, 5, 4] I am new to JavaScript...

Order Firestore data by TimeStamp in Ascending order

I am storing Ideas posted by the application in Firestore. The data is stored in Firestore like this Ideas/{documentID}/IdeaObject. The issue is when I retrieve the data it is not sorted w.r.t...

WP_Query not ordering by title

I try to get all the posts (with a specific custom type) ordered by the title ascending, but the SQL query generated, orders after post_date. Code: $my_query = new WP_Query( array( ...

Re-ordering the x-axis values in Power BI - "Sort By" not working

I have a chart where the x-axis values are showing as: 0-3 months, 10-12 months, 4-6 months, 7-9 months (see picture below) and i want them to be in ascending order. i am sorting by "months open"...

Sorting a multi-dimensional array in VBA - descending version

7 years ago @NigelHeffernan at https://stackoverflow.com/questions/4873182/sorting-a-multidimensionnal-array-in-vba/5104206#5104206 posted a very fast VBA implementation of QuickSort for...

Infinite useEffect loop when using Redux with React Hooks

I am refactoring some code and turning my class components into function components as a way of learning how to use Hooks and Effects. My code uses Redux for state management and axios for...

How to add ordinal numbers to the start of each line in text file

I have a leaderboard for a game stored in a file. The format of the file is this: bob has 46 points fred has 0 points leo has 27 points I have this code to display the scores in order from...

Firestore startAfter() returning the same data in infinite scrolling when ordered by descending timestamp

I'm writing a profile page with chronological user posts (latest post on top) using Firestore on Ionic by setting orderBy() to "timestamp" descending. I'm using Ionic's infinite loading to load...

How to reorder x-axis based on y-axis values in R ggplot2

I am trying to reorder (I don't mind whether it is ascending or descending order) the x-axis on my errorplot based on the mean values of the y-axis. I have applied a solution based on this post,...

Sort by custom meta_key in WordPress get_posts(), and include posts that do not have the meta_key

I have set on my WordPress post custom meta called "my_sort" which have a numeric values like 1, 2, 3, 4..... See below image: I want to sort in ascending order by this meta "my_sort". This is...

PostgreSQL Sequence Ascending Out of Order

I'm having an issue with Sequences when inserting data into a Postgres table through SQL Alchemy. All of the data is inserted fine, the id BIGSERIAL PRIMARY KEY column has all unique values which...

Matching/Aligning columns of two DFs in R

I'm having trouble matching the columns of a dataframe in R. I need to run this line: rownames(clusterDF) <- rownames(OrderByCluster) Where the rownames of both these dfs correspond to a gene...

How to control sort direction in a list query in AWS-Amplify with GraphQL

I've seen several useful posts on how to create schemas in AWS-Amplify's GrahphQL API package that will return a sorted response. In brief, if you have the following in your schema.graphql...

Failed to crawling FB post in new FB layout by using python selenium, how to fix it?

I've used python selenium to crawl FB post in 4 group. everything is working when i used FB old layout, Recently, FB forced people change to new FB layout,at the beginning, the regulation is not...

Mark Core Data entries as Favourites SWIFTUI

I am working on an app that stores posts from on-line Json to CoreData for offline content. It is a Real Estate Listings app where users sell and rent properties. So far i accomplish to save...

Sorting a Future List in Flutter

I've been looking for a solution to sort a list (ascending and descending) On Button Press inside of a FutureBuilder, that is a Future<List>, but can't seem to understand how to define it as a...

How to make Lodash sortBy() to sort data to descending order?

sortBy() in Lodash isn't sorting to the descending order, when I pass 'desc', when calling the function as const sortedData = _.sortBy(data, ['rawAvgPrice'], ['desc']);. This works fine with the...