I wanted to write a prolog program to find equality of two lists, the order of elements
doesn't matter.
So I wrote following:
del( _ , [ ] , [ ] ) .
del( X , [ X|T ] , T ).
del( X , [ H|T ] , [ H|T1 ] ) :- X \= H , del( X , T , T1 ).
member( X, [ X | _ ] ) .
member( X, [ _ | T ] ) :- member( X, T ).
eq...
I'm working on an application with a TabContainer. Some of the tabs in the tabcontainer are hard-coded in the page while others will be configured using settings in Web.Config.
For the dynamically added tabs, I can set the tab index to the value from Web.config, and things work fine. I'm doing this in Page_Init.
When I try to set the...
How would I list a page of the top commented pages on the site with PHP and mysql?
The database is set up sort of like this:
page_id | username | comment | date_submitted
--------+----------+---------+---------------
1 | bob | hello | current date
1 | joe | byebye | current date
4 | joe | stuff | d...
rails 2.3.4, sqlite3
I'm trying this
Production.find(:all, :conditions => ["time > ?",
start_time.utc], :order => "time DESC",
:limit => 100)
The condition works perfectly, but I'm having problems with the :order => time DESC.
By chance, I discovered that it worked at Heroku (testing with heroku console), which runs PostgreSQ...
Hi every body
I have an audit table that have data for insert, update and delete operations. I am writing a report that will display data in the order of Insert, Update and Delete. I don't think the order by clause will help. any help?
...
I want to add a jquery click event to href's that already have an onclick event.
In the example below the hard coded onclick event will get triggered first.
How can I reverse that?
<a class="whatever clickyGoal1" href="#" onclick="alert('trial game');">play trial</a>
<br />
<a class="whatever clickyGoal2" href="#" onclick="alert('real g...
Is there a way to change the draw order of Controls in a StackPanel without changing the actual ordering of these controls in the StackPanel?
The reason I ask is that we have a button bar with margin 0 between the buttons. The active button grows (ie margin set to -10) overlapping the neighbouring buttons. The problem here is that the r...
Hi.I am trying to get day of names with and correct order like Monday ,Tuesday.. But in my table I have records that after Monday comes Friday or I have Thursday between two Tuesday .I want to order them like Monday ,Monday ,Tuesday ,Tuesday, Wednesday so on .But I don`t want to group them.
I used this query but it does not make ...
I need a random query, but I don't know what's the best way to do this in the view.
...
Hi,
I have four models: Customer, QueueRed, QueueBlue, QueueGreen.
The Queue models have a one to many relationship with customers
A customer must always be in a queue
A customer can only be in one queue at a time
A customer can change queues
We must be able to find out the customers current position in their respective queue
In a...
I have a table T (structure below) which initially contains all-NULL values in an integer order column:
col1 varchar(30),
col2 varchar(30),
order int NULL
I also have a way to order the "colN" columns, e.g.
SELECT * FROM T ORDER BY some_expression_involving_col1_and_col2
What's the best way to assign - IN SQL - numeric order val...
Look:
class User < ActiveRecord::Base
has_many :scores, :order => 'score DESC',:autosave =>true,
end
class Score < ActiveRecord::Base
belongs_to :user
end
Now, I want to order the users by the maximun score of each one,
The thing is that i need to get a user, two up and two down users
like a top 5 scores
how can I do tha...
So Ive got a pretty big array of data and need to sort them by two criteria.
There is variable $data['important'] and $data['basic'].
They are simple numbers and I am using uasort to sort
$data firstly by important and then by basic.
So
Important | Basic
10 | 8
9 | 9
9 | 7
7 | 9
The usort function i...
I want to use the plugin WP Smart Sort to sort my posts alphabetically, except I need the most recent posted first on the home page. The relevant existing code for the home page is below. Is there something I can add to it to force it to include the recent posts and go by date rather than by the alphabetical order I want everywhere else?...
The output file from our project build has gone from 6MB to over 75MB in text.
Diff'ing the last good build and the first time it blew up, there's a section in the output file like this in the latest:
Processing /ORDER options
External code objects not listed in the /ORDER file:
?onCallDisconnected@CallStateConnected@CallImpl@space...
Hi all, I'm developing a web application using asp.net Mvc 2 and NHibernate, and I'm paging data (products in a category) in my page, but this data are random, so, I'm using a HQL statement link this:
string hql = "from Product p where p.Category.Id=:IdCategory order by rand()";
It's working fine, but when I page, sometimes the same p...
I'm trying to find a version of UDP which just alleviates the restriction of a maximum size of the message sent. I don't care about reliability or partial retransmission, if all chunks arrive I want the message to be assembled from the chunks in sending order and delivered to the listening app. If one or more chunks are missing I would j...
Is there a way to give a sticky post a specific order, rather than always displaying at the top of the list? For example, I want one sticky post to always display as the 5th post, and another to always display as the 8th.
Thanks!
...
Say I have a table with a field called "ordernum" that denotes the order of a given set of rows. Now imagine that I delete one of these rows. What type of query would work best for re-assigning the order numbers so that they remain sequential?
Here's an example:
id group_id name ordernum active
----------------...
Is there a singular regular expression that can be used in, say, a text editor's search/replace dialog to reverse the order of the items in a list?
For instance, take this list:
First item
Second item
Third item
Select it in a text editor like EditPad, bring up the search and replace box, apply a regex (run as a loop or not) and tu...