select

How can I show a label depending on whether a drop-down list has options?

I have a drop down list that is populated through a Javscript function provided by an external company. It basically checks if the input is of a valid postcode type and then returns possible addresses into a drop-down list. I am stuck as to how to then display a little message once the drop-down list has some options, i.e. some address...

How to use the select() function in socket programming?

The prototype is: int select (int nfds, fd_set *read-fds, fd_set *write-fds, fd_set *except-fds, struct timeval *timeout); I've been struggling to understand this function for quite some time. My question is, if it checks all the file descriptors from 0 to nfds-1, and will modify the rea...

Spurious readiness notification for Select System call

On http://linux.die.net/man/2/select, under BUGS section it is mentioned that the select system call may sometimes spuriously set the FD ready and the subsequent read call will return 0. The text describes one such example (wrong checksum) but I am assuming there would be other reasons too (otherwise they would have fixed this). Any id...

select to group rows

i have a table like this : Alternative |Total |Male |Female a |20 |10 |10 b |50 |20 |30 c |40 |10 |30 c |30 |15 |15 now i want to select all the rows and the "c" alternative to be grouped. ...

Displaying zero-valued data in an SQL Query?

I have the following two tables (simplified for this question): CREATE TABLE team ( teamID CHAR(6) NOT NULL PRIMARY KEY); CREATE TABLE member ( memberID CHAR(7) NOT NULL PRIMARY KEY, teamID CHAR(6) NOT NULL REFERENCES team(teamID) ); I also have the following query, which is to list the number of members in each team: SELECT tea...

Auto-selection of <option> based on input field, with some caveats

I have a SELECT element in which I need to auto-select the appropriate option based on the first half of a postcode entered in a text field. British postcodes are of the form AB12 3CD, where the first section consists of 1-2 letters representing the county and a number representing the area within the county. The last 3 characters are ir...

string + db table to populate values in gridview.

Hi, I've have a string with prodIDs like "3, 16, 12" is it possible to match these Ids with the product table in the db and display details like name, price in the gridview? PS: im new to c# and asp.net! thanks, ...

is it possible to find out if a ruby socket is in state ESTABLISHED or CLOSE_WAIT without actually sending or reading data?

s = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0) s.connect(Socket.pack_sockaddr_in('port', 'hostname')) ssl = OpenSSL::SSL::SSLSocket.new(s, sslcert) ssl.connect from here on i would like to check in a thread if the ssl connection and the underlying socket is still ESTABLISHED or if it went into CLOSE_WAIT after the default of ...

SubQueries in MS ACCESS: selecting only one record per "person" per date.

I am using a table called analyzed in Microsoft Access. It has many fields but the three ones being used for filtering in this case are analyzed.readings_miu_id, analyzed.ReadDate, analyzed.ReadTime. I need to pull the records from the "analyzed" table where readings_miu_id are grouped together then sorted by ReadDate but showing only th...

How can I select only one record per “person”, per date with an inner join in an MS Access query?

I need to pull data from two tables: Neptune_FN_Analysis and Neptune_prem There will be 3 fields called readings_miu_id (comparable to a persons name or item #), ReadDate, ReadTime (all of which are in Neptune_FN_Analysis). Some readings_miu_ids have multiple ReadTimes for multiple days but I only want to pull the "last time" entered per...

Results of UNION Selects in SQL Server

Is it possible to UNION queries from tables or views that don't have any result in common? What I'm trying to do is combine data from different views into one result. I have select a,b,null,c from VIEW1, VIEW2 where VIEW1.a = VIEW2.a UNION select null,null,z,null from VIEW3 I would like the result to be a,b,z,c. Is this where I wou...

Prototype hide the div that has a specific link (<a href)

I have the following HTML: <div> <a href="http://google.com"&gt; Google </a></div> I am using prototype library. I need to hide the div that has the link http://google.com with it. Thank you. ...

Having trouble populating a select box in rails for editing?

I have a form that has been split out into a partial so I can use it both in the new view and the edit view. I have several dropdowns(selects) that are populated from a static array generated in a model. In location model: def open_close_times @times = '','12:00 AM', '12:30 AM', '1:00 AM', '1:30 AM', '2:00 AM', '2:30 AM', '3:00 AM',...

Single SQL SELECT Returning multiple rows from one table row

We have a table which is of the form: ID,Value1,Value2,Value3 1,2,3,4 We need to transform this into. ID,Name,Value 1,'Value1',2 1,'Value2',3 1,'Value3',4 Is there a clever way of doing this in one SELECT statement (i.e without UNIONs)? The column names Value1,Value2 and Value3 are fixed and constant. The database is oracle 9i. ...

Hibernate - Same result after update/select

Hi, hibernateSession.createQuery("select foo where id = 1"); // This command return the Item with id 1. // [BREAK POINT STOP] ==> I go in MySQL and I delete this item manualy. // [BREAK POINT CONTINU] hibernateSession.createQuery("select foo where id = 1"); // This command return the Item with id 1 too ! :-( It's the same with hibern...

SQL to select the middle third of all values in a column in PostgreSQL

Suppose I have a column of heights -- how can I select all and only those height values that are neither in the top 30% of values nor the bottom 30% of values. UPDATE: I'd like the answer for PostgreSQL (or, failing that, MySQL -- I'm using Rails). ...

Check Socket File Descriptor is Avaiable?

If I got a file descriptor (socket fd), how to check this fd is avaiable for read/write? In my situation, the client has connected to server and we know the fd. However, the server will disconnect the socket, are there any clues to check it ? ...

Select multiple ids from a PostgreSQL sequence

Is there a concise way to select the nextval for a PostgreSQL sequence multiple times in 1 query? This would be the only value being returned. For example, I would like to do something really short and sweet like: SELECT NEXTVAL('mytable_seq', 3) AS id; And get: id ----- 118 119 120 (3 rows) ...

Select million+ records while huge insert is running

I am trying to extract application log file from a single table. The select query statement is pretty straightforward. select top 200000 * from dbo.transactionlog where rowid>7 and rowid <700000 and Project='AmWINS' The query time for above select is above 5 mins. Is it considered long? While the select is running, the bulk insert...

MySQL: duplicate entry error with SELECT...INSERT INTO with UNIQUE constraint

I've got the following table: CREATE TABLE `products_quantity` ( `id` int(11) NOT NULL auto_increment, `product_id` varchar(100) NOT NULL, `stock_id` int(11) NOT NULL, `quantity` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `product_id` (`product_id`,`stock_id`), KEY `products_quantity_product_id` (`product_id`), KE...