order

Ensure that objects implement Comparable

I have a litte problem and was wondering how to solve it. I have a generic class Tuple<A,B> and now I would like to sort their tuples according to A and B. It should look like this: Unsorted: (1,5) (2,8) (6,8) (1,4) (2,4) Sorted: (1,4) (1,5) (2,4) (2,8) (6,8) For that reason I thought of implementing a generic compare method (pu...

Find a number which occurs an odd number of times in a SORTED array

Hi, I have a question and I tried to think over it again and again... but got nothing so posting the question here. Maybe I could get some view-point of others, to try and make it work... The question is: we are given a SORTED array, which consists of nos. which occur EVEN no. of times, except one, which occurs ODD no. of times. We nee...

Get an asset's numerical position in an array in Ruby on Rails

Hi All, I'm working with a list of assets, sorted alphabetically (through another method). I would like to assign a value to the "position" key, which essentially just says where this particular asset appears in the ordered list of all assets. Here is the code I'm working with now (:position left blank on purpose): @active_resources.ea...

Can XNA DrawableGameComponents be drawn before SpriteBatch draw calls so that sprites are drawn on top of DrawableGameComponents?

I would like some 2D sprites to occlude some 3D DrawableGameComponents. For a simplified example, a pause menu (implemented as a 2D sprite) should be drawn on top of a paused space ship (implemented as 3D game component). The XNA framework automatically calls Draw methods of classes from Microsoft.Xna.Framework.Game and Microsoft.Xna.Fr...

Ordering a WITH RECURSIVE query in Postgres

Hi, I'm executing a recursive query in Postgres to retrieve a list of emails and their threaded children as follows: WITH RECURSIVE cte (id, title, path, parent_id, depth) AS ( SELECT id, title, array[id] AS path, parent_id, 1 AS depth FROM emails WHERE parent_id IS NULL UNION A...

Prevent ListView from reordering items

I have a ListView that is backed by a CursorAdapter. The cursor passed into the adapter is a MergeCursor. It is a MergeCursor because I have two tables, type1 and type2. I want to list all of the elements from type1 and type2 in a single ListView with all of the elements from type1 first, and all of the elements from type2 last. In a...

fadeTo executes before .attr change though first in source

Here is a piece of code: $(document).ready(function() { $('#nextBtn').live('click', function() { $(this).attr('id', 'next2Btn') $('#cs_contentToSlide').animate({ left: '-=500', }, 200, function() { $('#stateGraphic').attr('src', 'images/state2_3stage.gif'); ...

Sql Statement construction

Hi im trying to use Sql within MySql to sort some values and this is what I have: Select from my table the rows where the value in column status equals online and the value in column tags equals museum, order them by name and in ascending order. SELECT * FROM tech WHERE `STATUS` = 'online' AND `TAGS` = 'museum' ORDER BY NAME ASC ...

mysql order by 2 dates

Hi i have a table with 2 dates the ADDDATE and UPDATEDATE When add an item the ADDDATE is the current date and the UPDATEDATE is 0000-00-00 i need to ORDER BY the sql command and get the best date of those 2 For example if ADD=12/1/2010 and UPDATE=30/6/2010 the UPDATE DATE is best (newest) Any help or reading appreciated ...

Spring Validation Annotations Order

Hi, I want to ask is it possible to set explicitly the validation order in Spring. I mean, I have this command object: public class UserData { @NotBlank private String newPassword; @NotBlank private String confirmPassword; @Email(applyIf="email is not blank") @NotBlank private String email; @NotBlank private String firstNam...

javascript prototype inheritance and order of definitions

hi, I'm working on a Actionscript 3.0 to Javascript-converter. I tried to find a way to circumvent the problem with the order of definitions, because it doesn't matter in AS, which package is defined first. To my surprise the following code works, although the prototype of A is defined after BA inherits from A: javascript (example outp...

Maintaining order of items in java

What is the best way to do the following(make sure that items from List are following the same order as those in ListTwo): List harry~20 marry~22 peter~40 jerry~33 janice~20 ListTwo harry marry peter janice Now the result should look like this ListThree harry marry peter janice jerry Step by step : For each item in List : ...

Control order in which SharePoint workflows are executed

Is there a way to control (e.g., prioritize) the order in which SharePoint workflows (not workflow activities, but entire workflows) are being executed? The set of workflows for a SharePoint list consists of workflows that are either created using SharePoint Designer or are custom workflows installed via WSP. We would like to guarantee...

Two triggers on one table sql server

I have two triggers on one of the tables in my database. One is for insert trigger and the other is an after update trigger. The insert trigger will update the table with values. My question is this; Is it possible that that the update trigger is firing at the same time that the insert is doing its job? ...

DIV order swapping / toggling

Hi... I'm hoping that someone might be able to give me some heads up on DIV order swapping, and how best to achieve this via jQuery. Basically what I have is 2 divs... #Front and #Back and a div for toggling which DIV is displayed in the foreground.The effect I am after is not a 'show and hide' as both divs are displayed at the same time...

How to order (sort) a numeric value using simpleXML and PHP

I am extracting data from an XML Engine using simplexml, and I am completely stuck when I try to oder ASC or DESC the data. Be aware that I am not writing this values myself, but I am extracting them from another source. Ive got another response to a similiar question and I had this as an example (which works): $d = new SimpleXMLEle...

Change order in .net resx file

Is there a way to change the order of keys in a resx file? I'm only using strings if that makes a difference. ...

How can I define an Order parameter through a belongsTo table in Castle ActiveRecord

Hi guys take a look in the following entity: Produto = Products (in english) [ActiveRecord("produtos", Lazy=true)] public partial class Produto : ActiveRecordBase<Produto>, IObjetoEntidade<Produto> { [PrimaryKey(PrimaryKeyType.Native, "prod_id")] public virtual int Id { get; set; } [StringLengthValidator(0, 100)] [Prop...

Mysql Query group by

Hi, I am trying to make a query to get some results: I have a table with sote data: client | price 1 | 100 1 | 150 1 | 200 2 | 90 2 | 130 2 | 200 3 | 95 3 | 120 3 | 250 I would like with one query to select the results and order it by price and client and get them in this form, ordered by the best price of each clint: 2 | 9...

Same Z order for multiple controls in a C# Form application.

I am working on an application that has 3 different types of custom made controls - Planes, Connectors and Elements. User can add them on a canvas, move, delete them etc. So far all good. These 3 type of control MUST appear in a specific Z order no matter in which order user adds them on the canvas. That's where the problem is. Planes ...