How do I sort a keyvalue pair with descending order of their values?
foreach (KeyValuePair<string, int> item in keyvalue.OrderBy(key => key.Value))
{
}
I've some sorted lists with variable number of elements. I wold like to merge the lists into one big list which contains all other lists in same order, without duplicates.
Example:
1. XS,M,L,XL
2. S,M,XXL
3. XXS,XS,S,L
Result:
XXS,XS,S,M,L,XL,XXL
The function should notify, if there are elements which have ambiguous positions. Here, it would be XXL and I need to specify its position after XL.
I have a table of pages in my database, each page can have a parent as below:
id parent_id title
1 0 Home
2 0 Sitemap
3 0 Products
4 3 Product 1
5 3 Product 2
6 4 Product 1 Review Page
What would be the best MySQL query to select all pages ordered by parent then child then child again if there is more than one level, there will be a maximum of three levels. The above example would produce the desired order:
Home
Sitemap
Products
Product 1
Product 1 Review Page
Product 2
I know this is a simple question, but I haven't had the chance to test it in any browser other than Firefox.
If I attach multiple event handlers to a single event on a single DOM element, are the event handlers guaranteed to be called in the order they were added? Or should I not rely on this behavior?
Programming challenge: Given a set of integers [1, 2, 3, 4, 5] I would like to generate all possible k-combinations in ascending size order in Java; e.g.
[1], [2], [3], [4], [5], [1, 2], [1, 3] ... [1, 2, 3, 4, 5]
It is fairly easy to produce a recursive solution that generates all combinations and then sort them afterwards but I imagine there's a more efficient way that removes the need for the additional sort.
I have 3 rectangles being rendered here. Let's say i wanted to move them all above the line yet keep their order, how would i go about that? I tried subtracting the Y and height rather than adding the Y it but as expected, the lower rectangle goes at the top, middle stays in the middle and top goes to the bottom
before:
after:
So is there any simple solution to render them just above rather than having to change all values ?
I have read the following rails guide : http://guides.rails.info/active_record_querying.html
in there exemple a client has many orders and orders belong to clients.
They explain how to find a lot of stuff from client. But if i want all orders from yesterday, with the corresponding client name, how do i retrieve the client from an order?
I have a tableView with several Sections being populated from a plist of NSDictionaries
How do I have it arrange the sections in the order they are in in the NSDictionary instead of alphabetically?
Is there a way to get the tests inside of a TestCase to run in a certain order? For example, I want to seperate the lifecycle of an object from creation to use to destruction but need to make sure that the object is set up first before I run the other tests.
it puts item1 down as DESC for some reason.
edit:
$sql_result = mysql_query("SELECT post, name, trip, Thread, sticky FROM (SELECT MIN(ID) AS min_id, MAX(ID) AS max_id, MAX(Date) AS max_date FROM test_posts GROUP BY Thread ) t_min_max INNER JOIN test_posts ON test_posts.ID = t_min_max.min_id WHERE Board=".$board." ORDER BY sticky ASC, max_date DESC", $db);
http://prime.programming-designs.com/test_forum/viewboard.php?board=0&page=3
As I understand it, when using F#, you have to manually list the source files in dependency order for the compiler's benefit (if there is any way around that, please let me know!)
Listing them on the command line from left to right obviously isn't going to scale. Is there a way to at least make it accept the list of files in a text file, one per line, preferably with the ability to put in blank lines and comments? I've checked the compiler options, and I don't see anything that looks promising.
this table i want to create and how assign job to first position???
job_id dynamic
Jobs Title text
Job Description text
Order combo box to choose after what job or at first position in the website
i create this table and cannot choose first job to view in my website
i am trying to create a statement in sql (for a table which holds stock symbols and price on specified date) with avg of 5 day price and avg of 15 days price for each symbol.
table description:
symbol
open
high
close
date
the average price is calculated from last 5 days and last 15 days. i tried this for getting 1 symbol:
SELECT avg(close),
avg(`trd_qty`)
FROM (select *
from cashmarket
WHERE symbol = \'hdil\'
order by `M_day` desc
limit 0,15 ) s
...but I couldn't get the desired the list for showing avg values for all symbols.
Does anyone know off hand what order Drupal executes it's _cron hooks? It is important for a certain custom module I am developing and can't seem to find any documentation on it on the web. Maybe I'm searching for the wrong thing!
Any help?
Jeff
I am using CakePHP for a price-comparison website.
I have a table products with fields: id, pride_regular, price_action.
I would like to combine the fields price_regular and price_action into a dynamic field: price. The lowest value of these two fields should be the value of the new price field. Also I want to order on it Ascending.
Should I use a custom MySQL-query?
Related to my other question: What's the best way to layout a C# class?
Is there a way in ReSharper to define the order you want your members to be in, so that ReSharper will maintain it?
Hi,
I'd like the ability to list the category name alongside the product in the New Order transactional email like shown in the screenshot below.
Any help would be appreciated.
Thanks.
I am designing database tables for a master-detail scenario. The specific requirement is that it is necessary to store information about the order of children. I see some possible solutions (like adding a column representing a position in the sequence, or a column with foreign key to the previous child) but I would like to know the best practices how to solve such problems.
Best regards
Lukasz Glaz
i need the code for sorting of numbers in ascending order using visual c++ in the windows forms,the output comes on the forms text box and i am doing it in visual studio....
anyone please help...provide the code
Here is an interesting use of JavaScript: reordering items with drag and drop. The implementation itself in my page works fine, but is there a way to determine in which order the user put the items?
How can I order the nodes alphabetically in my Drupal back-end ?
I cannot sort the columns by clicking on the headers unfortunately. Should I hack the code or install any plugin ?