Search Results

Search found 29816 results on 1193 pages for 'select tag'.

Page 2/1193 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • javascript - multiple dependent/cascading/chained select boxes on same form

    - by Aaron
    I'm populating select box options via jquery and json but I'm not sure how to address multiple instances of the same chained select boxes within my form. Because the select boxes are only rendered when needed some records will have ten sets of chained select boxes and others will only need one. How does one generate unique selects to support the auto population of secondary select options? Here's the code I'm using, and I thank you in advance for any insight you may provide. <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> function populateACD() { $.getJSON('/acd/acd2json.php', {acdSelect:$('#acdSelect').val()}, function(data) { var select = $('#acd2'); var options = select.attr('options'); $('option', select).remove(); $.each(data, function(index, array) { options[options.length] = new Option(array['ACD2']); }); }); } $(document).ready(function() { populateACD(); $('#acdSelect').change(function() { populateACD(); }); }); </script> <?php require_once('connectvars.php'); $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $squery = "SELECT ACD1ID, ACD1 from ACD1"; $sdata = mysqli_query($dbc, $squery); // Loop through the array of ACD1s, placing them into an option of a select echo '<select name="acdSelect" id="acdSelect">'; while ($row = mysqli_fetch_array($sdata)) { echo "<option value=" . $row['ACD1ID'] . ">" . $row['ACD1'] . "</option>\n"; } echo '</select><br /><br />'; <select name="acd2" id="acd2"> </select> acd2json.php <?php $dsn = "mysql:host=localhost;dbname=wfn"; $user = "acd"; $pass = "***************"; $pdo = new PDO($dsn, $user, $pass); $rows = array(); if(isset($_GET['acdSelect'])) { $stmt = $pdo->prepare("SELECT ACD2 FROM ACD2 WHERE ACD1ID = ? ORDER BY ACD2"); $stmt->execute(array($_GET['acdSelect'])); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); } echo json_encode($rows); ?>

    Read the article

  • Nested SELECT clause in SQL Compact 3.5

    - by Sasha
    In this post "select with nested select" I read that SQL Compact 3.5 (SP1) support nested SELECT clause. But my request not work: t1 - table 1 t2 - table 2 c1, c2 = columns select t1.c1, t1.c2, (select count(t2.c1) from t2 where t2.id = t1.id) as count_t from t1 Does SQL Compact 3.5 SP1 support nested SELECT clause in this case? Update: SQL Compact 3.5 SP1 work with this type of nested request: SELECT ... from ... where .. IN (SELECT ...) SELECT ... from (SELECT ...)

    Read the article

  • How to select all text inside text area of code field on web pages

    - by Moorage
    In all the forums web pages the download links are given inside the [code] braces that looks like text area with white background. When the download links are in large numbers then there are scroll bars. I find it difficult to scroll up and then select and then drag down to select all links. Is there any way to select all , when I click on select all on right click then it usually selects the text from whole page not from that code segment

    Read the article

  • jqGrid - customizing the multi-select option (restrict single selection and adding custom events)

    - by Renso
    Goal: Using the jgGrid to enable a selection of a checkbox for row selection - which is easy to set in the jqGrid - but also only allowing a single row to be selectable at a time while adding events based on whether the row was selected or de-selected. Environment: jQuery 1.4.4 jqGrid 3.4.4a Issue: The jqGrid does not support the option to restrict the multi-select to only allow for a single selection. You may ask, why bother with the multi-select checkbox function if you only want to allow for the selection of a single row? Good question, as an example, you want to reserve the selection of a row to trigger another kind of event and use the checkbox multi-select to handle a different kind of event; in other words, when I select the row I want something entirely different to happen than when I select to check off the checkbox for that row. Also the setSelection method of the jqGrid is a toggle and has no support for determining whether the checkbox has already been selected or not, So it will simply act as a switch - which it is designed to do - but with no way out of the box to only check off the box (as in not to de-select) rather than act like a switch. Furthermore, the getGridParam('selrow') does not indicate if the row was selected or de-selected, which seems a bit strange and is the main reason for this blog post. Solution: How this will act: When you check off a multi-select checkbox in the gird, and then commence to select another row by checking off that row's multi-select checkbox - I'm not talking there about clicking on the row but using the grid's multi-select checkbox - it will de-select the previous selection so that you are always left with only a single selection. Furthermore, once you select or de-select a multi-select checkbox, fire off an event that will be determined by whether or not the row was selected or de-selected, not just merely clicked on. So if I de-select the row do one thing but when selecting it do another. Implementation (this of course is only a partial code snippet):             multiselect: true,             multiboxonly: true,             onSelectRow: function (rowId) {                 var gridSelRow = $(item).getGridParam('selrow');                 var s;                 s = $(item).getGridParam('selarrrow');                 if (!s || !s[0]) {                     $(item).resetSelection();                     $('#productLineDetails').fadeOut();                     lastsel = null;                     return;                 }                 var selected = $.inArray(rowId, s) != -1;                 if (selected) {                     $('#productLineDetails').show();                 }                 else {                     $('#productLineDetails').fadeOut();                 }                 if (rowId && rowId !== lastsel && selected) {                     $(item).GridToForm(gridSelRow, '#productLineDetails');                     if (lastsel) $(item).setSelection(lastsel, false);                 }                 lastsel = rowId;             }, In the example code above: The "item" property is the id of the jqGrid. The following to settings ensure that the jqGrid will add the new column to select rows with a checkbox and also the not allow for the selection by clicking on the row but to force the user to have to click on the multi-select checkbox to select the row: multiselect: true, multiboxonly: true, Unfortunately the var gridSelRow = $(item).getGridParam('selrow') function will only return the row the user clicked on or rather that the row's checkbox was clicked on and NOT whether or not it was selected nor de-selected, but it retrieves the row id, which is what we will need. The following piece get's all rows that have been selected so far, as in have a checked off multi-select checkbox: var s; s = $(item).getGridParam('selarrrow'); Now determine if the checkbox the user just clicked on was selected or de-selected: var selected = $.inArray(rowId, s) != -1; If it was selected then show a container "#productLineDetails", if not hide that container away. The following instruction populates a form with the grid data using the built-in GridToForm method (just mentioned here as an example) ONLY if the row has been selected and NOT de-selected but more importantly to de-select any other multi-select checkbox that may have been selected: if (rowId && rowId !== lastsel && selected) {                     $(item).GridToForm(gridSelRow, '#productLineDetails');                     if (lastsel) $(item).setSelection(lastsel, false); }

    Read the article

  • SQL Select Permissions

    - by Brandi
    I have a database that I need to connect to and select from. I have an SQL Login, let's call it myusername. When I use the following, no SELECT permission shows up: SELECT * FROM fn_my_permissions ('dbo.mytable', 'OBJECT') GO Several times I tried things like: USE mydatabase GO GRANT SELECT TO myusername GO GRANT SELECT ON DATABASE::mydatabase TO myusername GO GRANT SELECT ON mytable TO myusername GO It says the queries execute successfully, but there is never any difference in the first query. What simple thing am I missing to grant database level select permissions. As a note, I made double sure it was the correct user, correct database, and I have already tried granting table level select permissions. So far I keep getting the error: SELECT permission denied on object 'mytable', database 'mydatabase', schema 'dbo'. Any ideas what I'm missing? Thanks in advance.

    Read the article

  • How to tag and goes to a tag in hg

    - by michael
    Hi, From here, it said 'hg tag 1.0' is to get my hg repository to a tag name. http://wiki.pylonshq.com/display/pylonscookbook/Mercurial+for+Subversion+Users How can I switch my repository to that tag name? $ hg tag myTag1.0 $ $ hg commit -m "a message" $ hg how to go back to that tag? and if I make a new 'hg commit' here, what will happen? Will it goes to the branch of myTag1.0? or it will stay with default branch? Thank you.

    Read the article

  • How to design tag database structure?

    - by liuxingruo
    I have a subjects database, and I want to create a new tag database to tag the subjects, but I have no idea how to design the new tag database structure. I'm assuming the new database looks like this: tag_id tag_name tagged_subject_ids 1 tag1 1, 2, 3, 5, 10 2 tag2 2, 4, 5, 6, 10, 12 so, if I want to select the tags belong to subject 1: SELECT tag_name FROM tag_database WHERE tagged_subject_ids LIKE '1'; I think the way that I select tag may be very slow, so please help me. Thanks!

    Read the article

  • oracle plsql select pivot without dynamic sql to group by

    - by kayhan yüksel
    To whom it may respond to, We would like to use SELECT function with PIVOT option at a 11g r2 Oracle DBMS. Our query is like : "select * from (SELECT o.ship_to_customer_no, ol.item_no,ol.amount FROM t_order o, t_order_line ol WHERE o.NO = ol.order_no and ol.item_no in (select distinct(item_no) from t_order_line)) pivot --xml ( SUM(amount) FOR item_no IN ( select distinct(item_no) as item_no_ from t_order_line));" As can be seen, XML is commented out, if run as PIVOT XML it gives the correct output in XML format, but we are required to get the data as unformatted pivot data, but this sentence throws error : ORA-00936: missing expression Any resolutions or ideas would be welcomed, Best Regards -------------if we can get the result of this to sys_refcursor using execute immediate it will be solved ------------------------ the procedure : PROCEDURE pr_test2 (deneme OUT sys_refcursor) IS v_sql NVARCHAR2 (4000) := ''; TYPE v_items IS TABLE OF NVARCHAR2 (30); v_pivot_items NVARCHAR2 (4000) := ''; BEGIN FOR i IN (SELECT DISTINCT (item_no) AS items FROM t_order_line) LOOP v_pivot_items := ',''' || i.items || '''' || v_pivot_items; END LOOP; v_pivot_items := LTRIM (v_pivot_items, ','); v_sql := 'begin select * from (SELECT o.ship_to_customer_no, ol.item_no,ol.amount FROM t_order o, t_order_line ol WHERE o.NO = ol.order_no and OL.ITEM_NO in (select distinct(item_no) from t_order_line)) pivot --xml ( SUM(amount) FOR item_no IN (' || v_pivot_items || '));end;'; open DENEME for select v_sql from dual; Kayhan YÜKSEL

    Read the article

  • html select option tag closes itself due to a "/" character in the dynamic value (JSP, JSTL)

    - by saky
    <select id="ordersSelect" class="drop-down" onchange="somemethod()"> <c:forEach items="${orders}" var="order" varStatus="orderStatus"> <option value="${order.id}"> ${order.publicId} </option> </c:forEach> </select> I have the above peice of code in a JSP page, that receives a list of Orders and each order has some information, the particular information that I want to display in a SELECT field is the publicId. The problem is that, on display there is only one OPTION in the SELECT and the rest of the order's publicId s are displayed as normal text below the SELECT box and not an OPTION to select. I found out that the publicId actually contains a String like A10/0001/0 and that is the character "/" is most probably causing the problem. Any solutions/suggestion/ideas?

    Read the article

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

    - by Frederick
    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 included. (2) Rows in the middle table (Table2) are included only when the values in column1 (UserName) and column4 (CourseName) do not match with any row from Table1. Both columns need to match for the row in Table2 to not be included. (3) Rows in the bottom table (Table3) are included only when the value in column4 (CourseName) is not already in any row of the results from combining Table1 and Table2. I have had success in implementing (1) and (2) with an SQL query like this: SELECT DISTINCT UserName AS UserName, MAX(AmountUsed) AS AmountUsed, MAX(AnsweredCorrectly) AS AnsweredCorrectly, CourseName, MAX(course_code) AS course_code, MAX(NoOfQuestionsInCourse) AS NoOfQuestionsInCourse, MAX(NoOfQuestionSetsInCourse) AS NoOfQuestionSetsInCourse FROM ( "SELECT statement 1" UNION "SELECT statement 2" ) dt_derivedTable_1 GROUP BY CourseName, UserName Where "SELECT statement 1" is the query that generates Table1 and "SELECT statement 2" is the query that generates Table2. A picture of the data table generated by this query is located at www.britestudent.com/pub/2.png. I can get away with using the MAX() function because values in the AmountUsed and AnsweredCorrectly columns in Table1 will always be larger than those in Table2 (and they are identical in the last three columns of both tables). What I fail at is implementing (3). Any suggestions on how to do this will be appreciated. It is tricky because the UserName values in Table3 are null, and because the CourseName values in the combined Table1 and Table2 results are not unique (but they are unique in Table3). After implementing (3), the final table should look like the table in picture 2.png with the addition of the last row from Table3 (the row with the CourseName value starting with "4. Klasse..." I have tried to implement (3) using another derived table using SELECT, MAX() and UNION, but I could not get it to work. Below is my full SQL query with the lines from this failed attempt to implement (3) commented out. Cheers, Frederick PS--I am new to this forum (and new to SQL as well), but I have had more of my previous problems answered by reading other people's posts on this forum than from reading any other forum or Web site. This forum is a great resources. -- SELECT DISTINCT MAX(UserName), MAX(AmountUsed) AS AmountUsed, MAX(AnsweredCorrectly) AS AnsweredCorrectly, CourseName, MAX(course_code) AS course_code, MAX(NoOfQuestionsInCourse) AS NoOfQuestionsInCourse, MAX(NoOfQuestionSetsInCourse) AS NoOfQuestionSetsInCourse -- FROM ( SELECT DISTINCT UserName AS UserName, MAX(AmountUsed) AS AmountUsed, MAX(AnsweredCorrectly) AS AnsweredCorrectly, CourseName, MAX(course_code) AS course_code, MAX(NoOfQuestionsInCourse) AS NoOfQuestionsInCourse, MAX(NoOfQuestionSetsInCourse) AS NoOfQuestionSetsInCourse FROM ( -- Table 1 - All UserAccount/Course combinations that have had quizzez. SELECT DISTINCT dbo.win_user.user_name AS UserName, cast(dbo.GetAmountUsed(dbo.session_header.win_user_id, dbo.course.course_id, dbo.course.no_of_questionsets_in_course) as nvarchar(10)) AS AmountUsed, Isnull(cast(dbo.GetAnswerCorrectly(dbo.session_header.win_user_id, dbo.course.course_id, dbo.question_set.no_of_questions) as nvarchar(10)),0) AS AnsweredCorrectly, dbo.course.course_name AS CourseName, dbo.course.course_code, dbo.course.no_of_questions_in_course AS NoOfQuestionsInCourse, dbo.course.no_of_questionsets_in_course AS NoOfQuestionSetsInCourse FROM dbo.session_detail INNER JOIN dbo.session_header ON dbo.session_detail.session_header_id = dbo.session_header.session_header_id INNER JOIN dbo.win_user ON dbo.session_header.win_user_id = dbo.win_user.win_user_id INNER JOIN dbo.win_user_course ON dbo.win_user_course.win_user_id = dbo.win_user.win_user_id INNER JOIN dbo.question_set ON dbo.session_header.question_set_id = dbo.question_set.question_set_id RIGHT OUTER JOIN dbo.course ON dbo.win_user_course.course_id = dbo.course.course_id WHERE (dbo.session_detail.no_of_attempts = 1 OR dbo.session_detail.no_of_attempts IS NULL) AND (dbo.session_detail.is_correct = 1 OR dbo.session_detail.is_correct IS NULL) AND (dbo.win_user_course.is_active = 'True') GROUP BY dbo.win_user.user_name, dbo.course.course_name, dbo.question_set.no_of_questions, dbo.course.no_of_questions_in_course, dbo.course.no_of_questionsets_in_course, dbo.session_header.win_user_id, dbo.course.course_id, dbo.course.course_code UNION ALL -- Table 2 - All UserAccount/Course combinations that do or do not have quizzes but where the Course is selected for quizzes for that User Account. SELECT dbo.win_user.user_name AS UserName, -1 AS AmountUsed, -1 AS AnsweredCorrectly, dbo.course.course_name AS CourseName, dbo.course.course_code, dbo.course.no_of_questions_in_course AS NoOfQuestionsInCourse, dbo.course.no_of_questionsets_in_course AS NoOfQuestionSetsInCourse FROM dbo.win_user_course INNER JOIN dbo.win_user ON dbo.win_user_course.win_user_id = dbo.win_user.win_user_id RIGHT OUTER JOIN dbo.course ON dbo.win_user_course.course_id = dbo.course.course_id WHERE (dbo.win_user_course.is_active = 'True') GROUP BY dbo.win_user.user_name, dbo.course.course_name, dbo.course.no_of_questions_in_course, dbo.course.no_of_questionsets_in_course, dbo.course.course_id, dbo.course.course_code ) dt_derivedTable_1 GROUP BY CourseName, UserName -- UNION ALL -- Table 3 - All Courses. -- SELECT DISTINCT null AS UserName, -- -2 AS AmountUsed, -- -2 AS AnsweredCorrectly, -- dbo.course.course_name AS CourseName, -- dbo.course.course_code, -- dbo.course.no_of_questions_in_course AS NoOfQuestionsInCourse, -- dbo.course.no_of_questionsets_in_course AS NoOfQuestionSetsInCourse -- FROM dbo.course -- WHERE is_active = 'True' -- ) dt_derivedTable_2 -- GROUP BY CourseName -- ORDER BY CourseName

    Read the article

  • org.apache.sling.scripting.jsp.jasper.JasperException: Unable to load tag handler class [migrated]

    - by Babak Behzadi
    I'm developing an Apache Sling WCMS and using java tag libs to rendering some data. I defined a jsp tag lib with following descriptor and handler class: TLD file contains: <?xml version="1.0" encoding="UTF-8"?> <taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"> <tlib-version>1.0</tlib-version> <short-name>taglibdescriptor</short-name> <uri>http://bob/taglibs</uri> <tag> <name>testTag</name> <body-content>tagdependent</body-content> <tag-class>org.bob.taglibs.test.TestTagHandler</tag-class> </tag> </taglib> Tag handler class: package org.bob.taglibs.test; import javax.servlet.jsp.tagext.TagSupport; public class TestTagHandler extends TagSupport{ @Override public int doStartTag(){ try { pageContext.getOut().print("<h1>Helloooooooo</h1>"); } catch(Exception e) { return SKIP_BODY; } return EVAL_BODY_INCLUDE; } } I packaged the tag lib as BobTagLib.jar and deployed it as a bundle using Sling Web Console. I used this tag lib in a jsp page deployed in my Sling repository: index.jsp: <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="bob" uri="http://bob/taglibs" %> <html> <head><title>Simple jsp page</title></head> <body> <bob:testTag/> </body> </html> Calling the page cause the following exception: org.apache.sling.scripting.jsp.jasper.JasperException: /apps/TagTest/index.jsp(7,5) Unable to load tag handler class "org.bob.taglibs.test.TestTagHandler" for tag "bob:testTag" ... Can any one get me a solution? In advance, any help is apreciated.

    Read the article

  • jQuery Select Menu Replacement

    - by Brad
    I have a select drop-down that selects a theme for the current page the user is on: <select id="style" name="acct-stylenum"> <option value="1" selected="true">Light</option> <option value="2">Dark</option> </select> Now what I would like to do is add two divs that will also control this select menu. I would much rather have the user select between two images than a select menu. The divs are as follows: <div class="style-box light"></div> <div class="style-box dark"></div> I would like to use jQuery to make the select menu hidden but still use its input. Also I would like the divs to control the menus value and show a selected state. Please let me know the easiest way this can be done using jQuery or JavaScript. Thanks in advance. -B

    Read the article

  • autostart app with tag in awm

    - by nonsenz
    while giving awm a try i encounter some problems. i want to autostart some apps when awm is started with specific tags. here's the relevant config i use for that. first my tags with layouts: tags = { names = {"mail", "www", "video", "files", 5, 6, 7, 8, 9}, layout = {layouts[11], layouts[11], layouts[11], layouts[11], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1]} } for s = 1, screen.count() do -- Each screen has its own tag table. tags[s] = awful.tag(tags.names, s, tags.layout) end now the app-autostart stuff: awful.util.spawn("chromium-browser") awful.util.spawn("firefox") awful.util.spawn("vlc") awful.util.spawn_with_shell("xterm -name files -e mc") awful.util.spawn_with_shell("xterm -name 5term") awful.util.spawn_with_shell("xterm -name 5term") awful.util.spawn_with_shell("xterm -name 5term") awful.util.spawn_with_shell("xterm -name 5term") awful.util.spawn_with_shell("xfce4-power-manager") i use xterm with the -name param to give them custom classes (for custom tags via rules). and now some rules to connect apps with tags: awful.rules.rules = { -- All clients will match this rule. { rule = { }, properties = { border_width = beautiful.border_width, border_color = beautiful.border_normal, focus = true, keys = clientkeys, buttons = clientbuttons } }, { rule = { class = "MPlayer" }, properties = { floating = true } }, { rule = { class = "pinentry" }, properties = { floating = true } }, { rule = { class = "gimp" }, properties = { floating = true } }, -- Set Firefox to always map on tags number 2 of screen 1. -- { rule = { class = "Firefox" }, -- properties = { tag = tags[1][2] } }, { rule = { class = "Firefox" }, properties = { tag = tags[1][2] } }, { rule = { class = "Chromium-browser" }, properties = { tag = tags[1][1] } }, { rule = { class = "Vlc"}, properties = { tag = tags[1][3] } }, { rule = { class = "files"}, properties = { tag = tags[1][4] } }, { rule = { class = "5term"}, properties = { tag = tags[1][5] } }, } it works for chromium, firefox and vlc but not for the xterms with the "-name" param. when i check the xterms after they started with xprop i can see: WM_CLASS(STRING) = "5term", "XTerm" i think that sould work, but the xterms are placed on the first workspace/tag.

    Read the article

  • select for update problem in jdbc

    - by kartiku
    I'm having a problem with select for update in jdbc. The table i'm trying to update is the smalldb table, i'm having problems-- i'm using select for update which does a lock on the selected row the update statement is -- String updateQ = "UPDATE libra.smalldb SET hIx = ? WHERE name = ?"; the select statement is -- rs = stmt1.executeQuery("SELECT hIx FROM libra.smalldb for update"); rs0 = stmt2.executeQuery("SELECT name,aff FROM libra.smalldb"); the second statement is because i need those fields as well. Here is the complete code -- import java.sql.*; import java.util.ArrayList; import java.util.Collections; public class Jdbcexample1 { /** * @param args */ public static void main(String[] args) { Connection con = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql:///test", "root", "*****"); //String url = "jdbc:msql://200.210.220.1:1114/Demo"; //Connection conn = DriverManager.getConnection(url,"",""); Statement stmt1 = con.createStatement(); Statement stmt2 = con.createStatement(); Statement stmt3 = con.createStatement(); Statement stmt4 = con.createStatement(); ResultSet rs0; ResultSet rs; ResultSet rs1; ResultSet rs2; String name; String hIx; int hIxInt; StringBuffer sb = new StringBuffer(); String affiliationSmall; ArrayList<String> affiliation = new ArrayList<String>(); ArrayList<Float> matchValues = new ArrayList<Float>(); ArrayList<Integer> hixValues = new ArrayList<Integer>(); ArrayList<Integer> idValues = new ArrayList<Integer>(); boolean moreFlag = false; String queryString; int tmpIdx; String name1; //get the hix at that index where the similarity is maximum int tmpHidx = 0; int tmpHix = 0; int id = 0; int count; int tmpidIdx = 0; //rs = stmt.executeQuery("SELECT id FROM libra.researchint WHERE id = 910887"); // Get name, affiliation , hIx from smalldb //rs = stmt1.executeQuery("SELECT name,aff,hIx FROM libra.smalldb"); // String cursorName = "OUR_CURSOR"; // stmt1.setCursorName(cursorName); //rs = stmt1.executeQuery("SELECT name,aff,hIx FROM libra.smalldb for update"); rs = stmt1.executeQuery("SELECT hIx FROM libra.smalldb for update"); rs0 = stmt2.executeQuery("SELECT name,aff FROM libra.smalldb"); while ( rs.next() && rs0.next() ) { //String lastName = rs.getString("id"); hIx = rs.getString("hIx"); hIxInt = Integer.parseInt(hIx); //if hIx if (hIxInt==-1) continue; //name = rs.getString("name"); name = rs0.getString("name"); name1 = new String(name); System.out.println(name); //affiliationSmall = rs.getString("aff"); affiliationSmall = rs0.getString("aff"); //name = "\"" +name+ "\""; // Get matching names from large faculty table //String queryString = "SELECT id,name,hIx FROM libra.faculty WHERE name = " +name; //name = does not work names are similar but not same (in faculty and // smalldb) String query = "SELECT id,name,hIx FROM libra.faculty WHERE name like ?"; //String query = "SELECT id,name,hIx FROM libra.faculty for update of hIx WHERE name like ?"; PreparedStatement prepStmt = con.prepareStatement(query); String[] nameArr = name.split(" "); StringBuffer tmpSb = new StringBuffer(); for(int idx = 0;idx<nameArr.length;idx++) { tmpSb.append(nameArr[idx] + "%"); } name = tmpSb.toString(); prepStmt.setString(1, name); rs1 = prepStmt.executeQuery(); //Try to get matching names from faculty big db //Execute the query on faculty table //rs1 = stmt2.executeQuery(queryString); if(rs1.isClosed()) continue; count = 0; matchValues.clear(); affiliation.clear(); while(rs1.next()) { //name = rs1.getString("name"); id = Integer.parseInt(rs1.getString("id")); //idValues.add(id); tmpHix = Integer.parseInt(rs1.getString("hIx")); queryString = "SELECT aff FROM libra.affiliation WHERE id = "+id; rs2 = stmt3.executeQuery(queryString); //affiliation = rs1.getString("aff"); sb.delete(0, sb.length()); while (rs2.next()) { //Concatenate it to the same string using a stringbuffer sb.append(rs2.getString("aff")); //affiliation.add(rs2.getString("aff")); } affiliation.add(sb.toString()); count++; // if(count1) // { // moreFlag = true; // //Call fuzzy match function, store the distance values and select the // //affiliation that has the minimum distance from affiliationSmall // // //problem is here, affiliation.get Index: 2, Size: 2 // // matchValues.add(fuzzyMatch(affiliationSmall,affiliation.get(count))); // hixValues.add(tmpHix); // idValues.add(id); // } }//end of while rs1 -> faculty rs1.close(); int idx = 0; if(count>1) { moreFlag = true; //Call fuzzy match function, store the distance values and select the //affiliation that has the minimum distance from affiliationSmall //problem is here, affiliation.get Index: 2, Size: 2 matchValues.add(fuzzyMatch(affiliationSmall,affiliation.get(idx))); hixValues.add(tmpHix); idValues.add(id); idx++; } if(moreFlag) { Object obj = Collections.max(matchValues); float maxVal = Float.parseFloat(obj.toString()); //int tmpIdx = matchValues.indexOf(new Float(maxVal)); //get the index at which similarity between affiliation strings is maximum, //as returned by fuzzyMatch //int tmpIdx = matchValues.indexOf(maxVal); tmpIdx = matchValues.indexOf(maxVal); //get the hix at that index where the similarity is maximum //int tmpHidx = hixValues.get(tmpIdx); tmpHidx = hixValues.get(tmpIdx); tmpidIdx = idValues.get(tmpIdx); //update the smalldb table String updateQ = "UPDATE libra.smalldb SET hIx = ? WHERE name = ?"; //String updateQ = "UPDATE libra.smalldb SET hIx = ? WHERE current of "+cursorName; //PreparedStatement prepStmt1 = con.prepareStatement("UPDATE libra.smalldb SET hIx = ? WHERE current of "+cursorName); PreparedStatement prepStmt1 = con.prepareStatement(updateQ); //PreparedStatement prepStmt1 = con.prepareStatement(updateQ); prepStmt1.setString(2, name1); prepStmt1.setString(1, Integer.toString(tmpHidx)); prepStmt1.executeUpdate(updateQ); //prepStmt1.execute(); //stmt4.executeUpdate(updateQ); }//end of if //For matching names get the affiliation based on id from affiliation table //con.close(); //System.out.println(lastName); System.out.println(name); }//end of while rs -> smalldb rs.close(); // String updateQ = "UPDATE libra.smalldb1 SET hIx = "+Integer.toString(tmpHidx)+ "WHERE id = "+Integer.toString(tmpidIdx); // stmt4.executeUpdate(updateQ); con.close(); } catch (Exception e) { System.err.println("Got an exception! "); System.err.println(e.getMessage()); e.printStackTrace(); } } public static float fuzzyMatch(String affiliationSmall, String affiliation) { //float distance = 0; String[] temp = null; temp = affiliationSmall.split(" "); int index; //int index1 = affiliation.indexOf(affiliationSmall); int matchCount = 0; for (int idx = 0;idx<temp.length; idx++) { index = affiliation.indexOf(temp[idx]); if (index!=-1) { matchCount++; } } float tmpFloat = matchCount/temp.length; //int[] aff1= new int[affiliation1.length()]; //int[] aff2 = new int[affiliation2.length()]; return tmpFloat; } } i think it is because of the second select statement (rs0) Here is the error- Got an exception! You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.Util.getInstance(Util.java:384) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3562) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2690) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1648) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1567) at Jdbcexample1.main(Jdbcexample1.java:184)

    Read the article

  • Iterating Over <select> Using jQuery + Multi Select

    - by Kezzer
    This isn't quite as straight forward as one may think. I'm using a plugin called jQuery MultiSelect and multiple <select options using XSLT as follows: <xsl:for-each select="RootField"> <select id="{RootField}" multiple="multiple" size="3"> <option value=""></option> <xsl:for-each select="ChildField"> <option value="{ChildField}"><xsl:value-of select="ChildField"/></option> </xsl:for-each> </select> </xsl:for-each> The accompanying JavaScript is as follows: var selects = document.getElementsByTagName("select"); $.each(selects, function() { $(this).multiSelect(); }); This allows me to apply the multiSelect(); function to every single <select on the page. The behaviour is quite strange, every other <select is being changed into the dropdown list (all the even ones anyway). I can't see anything wrong in my JavaScript to cause this issue as it would iterate over every single one. To make it more clear, the only lists that have that JavaScript applied to it are ones in position 2, 4, 6 and 8 (out of the 9 which are on the page). Any ideas?

    Read the article

  • How Do I Programmatically Set a File Tag

    - by Greg Bishop
    When using Windows Explorer to view files, I'm given the option to set a "tag", "category", or other attributes. For a JPEG a different set of attributes (including "tag") are options. I'd like to be able to set these programmatically. How do I programmatically set a file tag and other file attributes using Delphi (I have Delphi 2010 Pro)?

    Read the article

  • Looking to write a Tag class

    - by Austin Schneider
    I'm looking to write a Tag class (a tag is a string with no spaces). My first thought is to inherit from String: class Tag < String def initialize(str) raise ArgumentError if str =~ /\s/ super end end Does this look correct? Are there any other methods I should redefine?

    Read the article

  • jquery disable/remove option on select?

    - by SoulieBaby
    Hi all, I have two select lists, I would like jquery to either remove or disable a select option, depending on what is selected from the first select list: <select name="booking" id="booking"> <option value="3">Group Bookings</option> <option value="2" selected="selected">Port Phillip Bay Snapper Charters</option> <option value="6">Portland Tuna Fishing</option> <option value="1">Sport Fishing</option> </select> Here's the second list (which will only ever have two values): <select name="charterType" id="charterType"> <option value="1">Individual Booking</option> <option value="2">Group Booking</option> </select> If Group Bookings or Port Phillip Bay Snapper Charters are selected, I need only "Group Booking" to be displayed. (To basically hide "Individual Booking") but I can't seem to get it to work.. If someone could help me that'd be great!! :) I've also tried using a switch, but that doesnt work either.. /* select list */ switch (jQuery('#booking :selected').text()) { case 'Sport Fishing': alert('AA'); break; case 'Port Phillip Bay Snapper Charters': jQuery("#charterType option[value=1]").remove(); alert('BB'); break; case 'Portland Tuna Fishing': alert('CC'); break; case 'Group Bookings': alert('DD'); break; }; It alerts, but doesn't do anything else..

    Read the article

  • jQuery tag editor function

    - by Mad Hatter
    I'm using jQuery Tag Editor (http://blog.crazybeavers.se/wp-content/demos/jquery.tag.editor/) for a school project. Everything works perfect, but i'm not able to retrieve the array of tags that I added. This is my code: $("#allTags").click(function () { var tags = $("#tagEditor").tagEditor().getTags(); alert(tags); }); The array doesn't return anything. This is the code from the jQuery Tag Editor: (function ($) { $.fn.extend({ tagEditor: function (options) { var defaults = { separator: ',', items: [], className: 'tagEditor', confirmRemoval: false, confirmRemovalText: 'Do you really want to remove the tag?', completeOnSeparator: false, completeOnBlur: false, initialParse: true, } var options = $.extend(defaults, options); var listBase, textBase = this, hiddenText; var itemBase = []; this.getTags = function () { return itemBase.join(options.separator); }; ...

    Read the article

  • Finding An image tag using the alt text

    - by MrJackV
    I would like to know if it was possible using Javascript to find an image tag by its alt text. For instance I have this tag: <img src="Myimage.jpg" alt="Myimage"> would there be a vay to abtain the tag by looking for the "Myimage" alt attribute?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >