select

How to extract N random different elements from a set of unique elements?

I have a set of unique elements (there are not two identical elements). And I would like to extract N random and different elements from the set. What is the easiest way to do it in Java? ...

Dynamic select with linq-to-xml?

I got a XML document with a lot of data divided into category->subcategory. Like this: <?xml version="1.0" encoding="utf-8" ?> <data> <car> <transmission> <option value="1" text="Manual" /> <option value="2" text="Automatic" /> </transmission> <milage> <option value="2" tex...

Find next date for certain record in SQL Server 2008

Hi In SQL Server 2008: I have two tables, dtlScheme and dtlRenewal, with a one to many relationship (one scheme can have many renewals). dtlRenewal has a unique key (dteEffectiveDate, dtlSchemeID). Now suppose I have the following data in dtlRenewal: dtlRenewalID dtlSchemeID dteEffectiveDate 1 1 1/1/2005 2 ...

jquery select elements between two elements that are not siblings

eg. [I've removed attributes, but it's a bit of auto-generated html] <img class="p"/> <div> hello world <p> <font><font size="2">text.<img class="p"/> some text</font></font> </p> <img class="p"/> <p> <font><font size="2">more text<img class="p"/> another piece of text </font><...

How can I create a "dynamic" WHERE clause?

Hello there, First: Thanks! I finished my other project and the big surprise: now everything works as it should :-) Thanks to some helpful thinkers of SO! So here I go with the next project. I'd like to get something like this: SELECT * FROM tablename WHERE field1=content AND field2=content2 ... As you noticed this can be a very...

PRoblem with select null option

Hallo all. I got a strange problem with this piece of code <select name="nazioni" id="nazioni"> <option selected="selected" value="val">Seleziona</option> <option value="0">text 1</option> <option value="1">test 2</option> </select> The correct behaviour is that with this html the selected option is the "Seleziona" On some brows...

Make a range in postgres

Hi, how can I make a range in a select in PostgreSQL ? I'd like to have this return: num --- 1 2 3 4 5 6 In a query like: SELECT range(1,6) AS num; ...

SQL -- How to combine three SELECT statements with very tricky requirements

I have a SQL query with three SELECT statements. A picture of the data tables generated by these three select statements is located at www.britestudent.com/pub/1.png. Each of the three data tables have identical columns. I want to combine these three tables into one table such that: (1) All rows in top table (Table1) are always includ...

XPath select an attribute based on value

Using VB.Net, I have an XmlNode object, xNode. I need to select an attribute of this node if it has a particular value. e.g. xNode.SelectSingleNode(".[@attr1='1']") I would expect this statement to return the attribute "attr1", only if it has a value of "1". However, I get an error - Expression must evaluate to a node-set. When I tr...

Iframe changing according to javascript and php

hi everyone! I'm attempting to reload an iframe when a onChange event occurs heres what i got in javascript tags in the header ` function getSchedule(oEvent) { var n = document.getElementById("wantedTherapist"); var newn = n.options[n.selectedIndex].value; window.frames['schedule'].src = "schedule.php?therapist="+newn; }...

Check For Duplicate Records VS try/catch Unique Key Constraint

I have a database table that has a Unique Key constraint defined to avoid duplicate records from occurring. I'm curious if it is bad practice to NOT manually check for duplicate records prior to running an INSERT statement on the table. In other words, should I run a SELECT statement using a WHERE clause that checks for duplicate value...

Is is possible to use IOCP (or other API) in Reactor-style operations?

Hello, Is there any scalable Win32 API (like IOCP not like select) that gives you reactor style operations on sockets? AFAIK IOCP allows you to receive notification on completed operations like data read or written (proactor) but I'm looking for reactor style of operations: I need to get notification when the socket is readable or writa...

ibm informix spatial datablade select statement error

Hi I am using IBM informix spatial datablade module for some geo specific data. I am trying to find points in table xmlData lying in a specified region. But i am getting this error for select statement. SELECT sa.pre, sa.post FROM xmlData sa WHERE ST_Contains(('polygon((2 2,6 2,6 6,2 6,2 2)),sa.point) Query: select count(*) ...

get an age from a D.O.B field

I need to calculate the age of a "customer" from their date of birth. have tried to use: DATEDIFF(year,customer.dob,"2010-01-01"); but it doesnt seem to like it. Any ideas, I KNOW its going to be something simple!? Thanks ...

Cannot sort a row of size 8130, which is greater than the allowable maximum of 8094

Hello All, SELECT DISTINCT tblJobReq.JobReqId , tblJobReq.JobStatusId , tblJobClass.JobClassId , tblJobClass.Title , tblJobReq.JobClassSubTitle , tblJobAnnouncement.JobClassDesc , tblJobAnnouncement.EndDate , blJobAnnouncement.AgencyMktgVer...

Notepad++ -like line-selecting in textarea with jquery?

Hey Is is possible to trigger a link to select a single line inside textarea. If it is, how? Martti Laine ...

MySQL: Storage of multiple text fields for a record

An inexperienced question: I need to store about 10 unknown-length text fields per record into a MySQL table. I expect no more than 50K rows in total for this table but speed is important. The database actions will be solely SELECTs for all practical purposes (and searches will be done using an integer PK id only). I'm using InnoDB. In...

serving large file using select, epoll or kqueue

Nginx uses epoll, or other multiplexing techniques(select) for its handling multiple clients, i.e it does not spawn a new thread for every request unlike apache. I tried to replicate the same in my own test program using select. I could accept connections from multiple client by creating a non-blocking socket and using select to decide ...

C Socket Programming, problems with select() and fd_set

Hello I'm learning my way about socket programming in C (referring to Beej). Here is a simple multi-user chat server i'm trying to implement: http://pastebin.com/gDzd0WqP On runtime, it gives Bus Error. It's coming from the lines 68-78. Help me trace the source of the problem? in fact, WHY is my code even REACHING that particular re...

i want easy Javascript code to change textarea value upon <select><option>

Hi please help me, I have some textarea data which needs to be changed when the user select different option from a <select>. can you please give me some javascript easy code to do that please i don't want jquery things ...