Search Results

Search found 215 results on 9 pages for 'thead'.

Page 8/9 | < Previous Page | 4 5 6 7 8 9  | Next Page >

  • HTML client-side portable file generation - no external resources or server calls

    - by awashburn
    I have the following situation: I have set up a series of Cron jobs on an internal company server to run various PHP scripts designed to check data integrity. Each PHP script queries a company database, formats the returned query data into an HTML file containing one or more <tables>, and then mails the HTML file to several client emails as an attachment. From my experience, most of the PHP scripts generate HTML files with only a few tables, however there are a few PHP scripts the create HTML files with around 30 tables. HTML files have been chosen as the distribution format of these scans because HTML makes it easy to view many tables at once in a browser window. I would like to add the functionality for the clients to download a table in the HTML file as a CSV file. I anticipate clients using this feature when they suspect a data integrity issue based on the table data. It would be ideal for them to be able to take the table in question, export the data out to a CSV file, and then study it further. Because need for exporting the data to CSV format is at the discretion of the client, unpredictable as to what table will be under scrutiny, and intermittently used I do not want to create CSV files for every table. Normally creating a CSV file wouldn't be too difficult, using JavaScript/jQuery to preform DOM traversal and generate the CSV file data into a string utilizing a server call or flash library to facilitate the download process; but I have one limiting constraint: The HTML file needs to be "portable." I would like the clients to be able to take their HTML file and preform analysis of the data outside the company intranet. Also it is likely these HTML files will be archived, so making the export functionality "self contained" in the HTML files is a highly desirable feature for the two previous reasons. The "portable" constraint of CSV file generation from a HTML file means: I cannot make a server call. This means ALL the file generation must be done client-side. I want the single HTML file attached to the email to contain all the resources to generate the CSV file. This means I cannot use jQuery or flash libraries to generate the file. I understand, for obvious security reasons, that writing out files to disk using JavaScript isn't supported by any browser. I don't want to create a file without the user knowledge; I would like to generate the file using JavaScript in memory and then prompt the user the "download" the file from memory. I have looked into generating the CSV file as a URI however, according to my research and testing, this approach has a few problems: URIs for files are not supported by IE (See Here) URIs in FireFox saves the file with a random file name and as a .part file As much as it pains me, I can accept the fact the IE<=v9 won't create a URI for files. I would like to create a semi-cross-browser solution in which Chrome, Firefox, and Safari create a URI to download the CSV file after JavaScript DOM traversal compiles the data. My Example Table: <table> <thead class="resulttitle"> <tr> <th style="text-align:center;" colspan="3"> NameOfTheTable</th> </tr> </thead> <tbody> <tr class="resultheader"> <td>VEN_PK</td> <td>VEN_CompanyName</td> <td>VEN_Order</td> </tr> <tr> <td class='resultfield'>1</td> <td class='resultfield'>Brander Ranch</td> <td class='resultfield'>Beef</td> </tr> <tr> <td class='resultfield'>2</td> <td class='resultfield'>Super Tree Produce</td> <td class='resultfield'>Apples</td> </tr> <tr> <td class='resultfield'>3</td> <td class='resultfield'>John's Distilery</td> <td class='resultfield'>Beer</td> </tr> </tbody> <tfoot> <tr> <td colspan="3" style="text-align:right;"> <button onclick="doSomething(this);">Export to CSV File</button></td> </tr> </tfoot> </table> My Example JavaScript: <script type="text/javascript"> function doSomething(inButton) { /* locate elements */ var table = inButton.parentNode.parentNode.parentNode.parentNode; var name = table.rows[0].cells[0].textContent; var tbody = table.tBodies[0]; /* create CSV String through DOM traversal */ var rows = tbody.rows; var csvStr = ""; for (var i=0; i < rows.length; i++) { for (var j=0; j < rows[i].cells.length; j++) { csvStr += rows[i].cells[j].textContent +","; } csvStr += "\n"; } /* temporary proof DOM traversal was successful */ alert("Table Name:\t" + name + "\nCSV String:\n" + csvStr); /* Create URI Here! * (code I am missing) */ /* Approach 1 : Auto-download * downloads CSV data but: * In FireFox downloads as randomCharacers.part instead of name.csv * In Chrome downloads without prompting the user * In Safari opens the files in browser (textfile) */ //var hrefData = "data:text/csv;charset=US-ASCII," + encodeURIComponent(csvStr); //document.location.href = hrefData; /* Approach 2 : Right-Click Save As... */ var hrefData = "data:text/csv;charset=US-ASCII," + encodeURIComponent(csvStr); var fileLink = document.createElement("a"); fileLink.href = hrefData; fileLink.innerHTML = "download"; parentTD = inButton.parentNode; parentTD.appendChild(fileLink); parentTD.removeChild(inButton); } </script> I am looking for an example solution in which the above example table can be downloaded as a CSV file: using a URI the user is prompted to save the file the default filename is the name of the table. code works as described in modern versions of FireFox, Safari, & Chrome I have added a <script> tag with the DOM traversal function doSomething(). The real help I need is with formatting the URI to what I want within the doSomething() function.

    Read the article

  • html-encode output && incorrect string error

    - by fusion
    my data includes arabic characters which looks like garbage in mysql but displays correctly when run on browser. my questions: how do i html-encode the output? if i add this to all my files: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> i get this error: Error: Incorrect string value: '\xE4\xEE\xC3\xD8\xEF\xE6...' for column 'cQuotes' at row 1 i'm working on php/mysql platform. insertion form in html: <!doctype html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Your Favorite Quotes</title> <link rel="stylesheet" type="text/css" href="style.css" /> <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" charset="utf-8" /> <script type="text/javascript" src="scripts/jquery-1.4.2.js"></script> <script src="scripts/jquery.validationEngine-en.js" type="text/javascript"></script> <script src="scripts/jquery.validationEngine.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $("#submitForm").validationEngine() }) </script> </head> <body> <div class="container"> <div class="center_div"> <h2>Submit Your Quote</h2> <fieldset> <form id="submitForm" action="qinsert.php" method="post"> <div class="field"> <label>Author: </label> <input id="author" name="author" type="text" class="validate[required,custom[onlyLetter],length[0,100]]"> </div><br /> <div class="field"> <label>Quote: </label> <textarea id="quote" name="quote" class="validate[required, length[0,1000]]"></textarea> <br /> </div> <input id="button1" type="submit" value="Submit" class="submit" /><br /> <input id="button2" type="reset" value="Reset" /> </form> </fieldset> </div> </div> </body> </html> ////////////////////// query in php: //<?php //header('Content-Type: text/html; charset=UTF-8'); //?> <!doctype html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="style2.css" /> <title>Your Quote Databank</title> </head> <body> <?php include 'config.php'; echo "Connected <br />"; //check for quotes and apostrophes $author = ''; $quote = ''; $author = $_POST['author']; $quote = $_POST['quote']; $author = mysql_real_escape_string(trim($author)); $quote = mysql_real_escape_string(trim($quote)); //************************** //validating data $query = "SELECT * FROM Quotes where cQuotes = '$quote' limit 1;"; $result = mysql_query($query, $conn); //now check that the number of rows is 0 if (mysql_num_rows($result) > 0 ) { header("Location: /error.html"); exit; } //inserting data //mysql_query("SET NAMES 'utf8'"); //mysql_query("SET CHARACTER SET utf8"); $sql="INSERT INTO Quotes (vauthor, cquotes) VALUES ('$author', '$quote')"; if (!mysql_query($sql,$conn)) { die('Error: ' . mysql_error()); } echo "<div class='container'><p><label class='lbl_record'> Record Added Successfully!</label>"; echo "<a href='qform.html'> Submit a New Quote!</a></p>"; //************************** //selecting data $result = mysql_query("SELECT * FROM Quotes ORDER BY idQuotes DESC"); echo "<div class='center_div'>"; echo "<table> <thead> <tr> <th>Author</th> <th>Quotes</th> </tr> </thead>"; while($row = mysql_fetch_array($result)) { echo "<tbody><tr>"; echo "<td width='150px'>" . $row['vAuthor'] . "</td>"; echo "<td>" . $row['cQuotes'] . "</td>"; echo "</tr>"; } echo "</tbody></table>"; echo "</div></div>"; //************************** include 'close_config.php'; ?> </body> </html>

    Read the article

  • another onmouseover problem this one concerns pictures

    - by user334118
    Hi all! have problems with mouseover in Mozilla and Chrome after making it work in IE, for sure I can tell you that my code woked perfectly in Chrome at least, cause thats my default browser and I used it for debuging when creating the javascipt and it worked nicely... until I tried to make it work in IE too. Here I post the full code of the webpage I'm having trouble with. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebbShop.aspx.cs" Inherits="FSwebportal.WebbShop" %> .prodShow{width: 100%; text-align:center;border:0; float:right; position:inherit; padding-left:310px;} prodFollow{display:block; width:100%; height:100%; position:fixed; overflow:hidden;} orderSett{display:block; position:relative; float:left; padding-top:inherit;} .ShowBig{width:290px;height:290px; padding-top:10px;} .pTb{width:50px;} .order{background-color:Transparent;margin:3px;} .txtArea{border:0;overflow:auto;width:200px;height:100px;} .prodRow{background-image:url("produktbakgrund.png"); background-repeat:repeat;} .row{background-color:Transparent;width:100%;margin: 0px auto;display:inline-table;} .col{background-color:Transparent;width:100%;margin:3px;} <div id="prodFollow"> <table id="dumbTable"> <tr> <td> <img id="sideImg" class="ShowBig" src="" alt=""/> </td> </tr> <tr> <td> <h3><b>Specifikationer:</b></h3> <select name=""> </select> </td> </tr> </table> </div> <table id="itemList" class="prodShow" cellspacing="0"> <thead> <tr class="prodRow"> <th>Bild</th> <th>Förklaring</th> <th>Artikelnummer</th> <th>Pris</th> </tr> </thead> </table> <script type="text/javascript"> function appendRow() { var tbl = document.getElementById('itemList'); var len = <%= aspInfo.Count %>; var arr = new Array(len); var currIndex = 0; var imgID=0; <% for (int x = 0; x < aspInfo.Count; x++) { Response.Write("arr["+x+"]= '"+ aspInfo[x]+"';"); } %> for(row =0; row < arr.length/4;row++) { var rad = tbl.insertRow(tbl.rows.length); rad.setAttribute('class','prodRow'); for (c = 0; c < tbl.rows[row].cells.length; c++) { if(c < 1) { createCell(rad.insertCell(c), arr[currIndex], 'col',imgID); imgID++; } else { if(c < 3) { createCell(rad.insertCell(c),"<Label class=txtArea>" + arr[currIndex] + "</Label>", 'row',imgID); } else { createCell(rad.insertCell(c),"<Label class=txtArea>" + arr[currIndex] + " SKR</Label><br>Antal:<input type=text class=pTb /><input type=button width=100px value='Lägg i varukorg'></input>", 'order',imgID); } } currIndex++; } } } function createCell(cell, text, style,imgID) { if (style == 'col') { var arrLen = <% = largeImg.Count %>; var imgArr = new Array(arrLen); <% for (int x = 0; x < largeImg.Count; x++) { Response.Write("imgArr["+x+"]= '"+ largeImg[x]+"';"); } %> var div = document.createElement('div'); div.setAttribute('class', style); div.setAttribute('className', style); div.innerHTML = "<a href='#'><img id='" + imgID + "' src='" + text + "' onmouseover=javascript:onImg('" + imgArr[imgID] + "') border='0' alt='Animg' /></a>"; cell.appendChild(div); } else { var div = document.createElement('div'); div.setAttribute('class', style); div.setAttribute('className', style); div.innerHTML = text; cell.appendChild(div); } } </script> <script type="text/javascript" language="javascript"> function onImg(bigImg) { var img = document.getElementById('sideImg#'); img.src = bigImg; alert(img.src.toString()); } </script> </form> hope you guys can solve it for me, going mad! best regards David

    Read the article

  • Using jQuery to slideToggle a group of Table Rows

    - by CCC
    Hi. I'm fairly new to javaScript and jQuery, so hopefully this will be a quick fix. I need to display a table containing data that can be grouped into several categories, and I'd like to implement a slideToggle that hides/reveals all of the observations in each given category. The code below should (ideally) display a table with 4 columns and 9 rows, with every group of 3 rows preceded by a green "Section i" row. I would like each Section header to work as a slideToggle that expands or collapses all of the rows beneath it. Right now, nothing is collapsing. Any thoughts? <head> <style type="text/css"> td{padding:5px;} </style> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".flip").click(function(){ $(this).next(".section").slideToggle(); }); }); </script> </head> <body> <p> <table id="main_table"> <thead> <tr class="firstline"> <th>Column1</th> <th>Column2</th> <th>Column3</th> <th>Column4</th> </tr> </thead> <tbody> <tr style="background-color:green; color:white"> <td colspan="4" class="flip"> Section 1 </td> </tr> <div class="section"> <tr> <td>item 111</td> <td>item 112</td> <td>item 113</td> <td>item 114</td> </tr> <tr> <td>item 121</td> <td>item 122</td> <td>item 123</td> <td>item 124</td> </tr> <tr> <td>item 131</td> <td>item 132</td> <td>item 133</td> <td>item 134</td> </tr> </div> <tr style="background-color:green; color:white"> <td colspan="4" class="flip"> Section 2 </td> </tr> <div class="section"> <tr> <td>item 211</td> <td>item 212</td> <td>item 213</td> <td>item 214</td> </tr> <tr> <td>item 221</td> <td>item 222</td> <td>item 223</td> <td>item 224</td> </tr> <tr> <td>item 231</td> <td>item 232</td> <td>item 233</td> <td>item 234</td> </tr> </div> <tr style="background-color:green; color:white"> <td colspan="4" class="flip"> Section 3 </td> </tr> <div class="section"> <tr> <td>item 311</td> <td>item 312</td> <td>item 313</td> <td>item 314</td> </tr> <tr> <td>item 321</td> <td>item 322</td> <td>item 323</td> <td>item 324</td> </tr> <tr> <td>item 331</td> <td>item 332</td> <td>item 333</td> <td>item 334</td> </tr> </div> </tbody> </table> </p> </body>

    Read the article

  • Hide/Show some HTML table cells individually and align the remaining cells as they belong to the same row [closed]

    - by Brian
    [Edited at the resquest of admins] The best way I can explain my problem is showning an example. I have the table that you can see on the link below (since I can't post images...), that ha a table head (blue) and four rows, whose cells are green and white in color. I just want the white cells to hide/show alternately by clicking on green cells, which would remain always visible as parent cells. After hiding white cells, the green ones should be aligned into the same row, as they would fit like tetris bricks. That's all, I think more clear is impossible. http://i.stack.imgur.com/3n3In.jpg (follow the link to see the image explanation) The table code: <table class="columns" cellspacing="0" border="0"> <tr> <td class="left" rowspan="2"> <div style="text-align:center;"></div> </td> </tr><tr><td class="middle"> <div id="detail_table_source" style="display:none"></div> <br> <table id="detail_table" class="detail"> <colgroup> <col style="width:20px;"> <col style="width:40px;"> <col style="width:70px;"> <col style="width:20px;"> </colgroup> <thead> <tr> <th width="88">Blahhh</th> <th width="211">BLAHH</th> <th width="229">BLAHH</th> </tr> </thead> <tbody> <tr class="parent" id="row123" style="cursor: pointer; " title="Click to expand/collapse"> <td bgcolor="#A6A4CC">Blahhh</td> <td bgcolor="#A6A4CC">blah blah </td> <td bgcolor="#A6A4CC">Blahh</td> </tr> <tr class="child-row123" style="display: none; "> <td rowspan="3" bgcolor="#5B5B5B">&nbsp;</td> <td>blah blah </td> <td>blah blah</td> </tr> <tr class="child-row123" style="display: none; "> <td>blah blah</td> <td>blah blah</td> </tr> <tr class="child-row123" style="display: none; "> <td>blah blah</td> <td>blah blah</td> </tr> <tr> <td bgcolor="#6B7A94" class="parent" id="row456" style="cursor: pointer; " title="Click to expand/collapse"><strong>Blahh</strong></td> <td bgcolor="#FFFFFF" class="child-cell456" style="display: none; ">blah blah</td> <td bgcolor="#FFFFFF" class="child-cell456" style="display: none; ">blah blah</td> </tr> <tr> <td rowspan="4" valign="top" bgcolor="#5B5B5B" class="child-row456" style="display: none; ">&nbsp;</td> <td bgcolor="#6B7A94" class="parent" id="cell456" style="cursor: pointer; " title="Click to expand/collapse">blah blah</td> <td bgcolor="#6B7A94" class="parent" id="cell456" style="cursor: pointer; " title="Click to expand/collapse">blah blah</td> </tr> <tr> <td class="child-cell456" style="display: none; ">blah blah</td> <td class="child-cell456" style="display: none; ">blah blah</td> </tr> <tr> <td class="child-cell456" style="display: none; ">blah blah</td> <td class="child-cell456" style="display: none; ">blah blah</td> </tr> </tbody> </table> The script to hide/show whole rows (this works because it is copied from another example): <script language="javascript"> $(function() { $('tr.parent') .css("cursor","pointer") .attr("title","Click to expand/collapse") .click(function(){ $(this).siblings('.child-'+this.id).toggle(); }); $('tr[@class^=child-]').hide().children('td'); }); </script> And the failed attempt at expanding/hiding individual cells: <script language="javascript"> $(function() { $('td.parent') .css("cursor","pointer") .attr("title","Click to expand/collapse") .click(function(){ $(this).siblings('.child-'+this.id).toggle(); }); $('td[@class^=child-]').hide().children('td'); }); </script>

    Read the article

  • ASP.NET PowerShell Impersonation

    - by Ben
    I have developed an ASP.NET MVC Web Application to execute PowerShell scripts. I am using the VS web server and can execute scripts fine. However, a requirement is that users are able to execute scripts against AD to perform actions that their own user accounts are not allowed to do. Therefore I am using impersonation to switch the identity before creating the PowerShell runspace: Runspace runspace = RunspaceFactory.CreateRunspace(config); var currentuser = WindowsIdentity.GetCurrent().Name; if (runspace.RunspaceStateInfo.State == RunspaceState.BeforeOpen) { runspace.Open(); } I have tested using a domain admin account and I get the following exception when calling runspace.Open(): Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Requested registry access is not allowed. The web application is running in full trust and I have explicitly added the account I am using for impersonation to the local administrators group of the machine (even though the domain admins group was already there). I'm using advapi32.dll LogonUser call to perform the impersonation in a similar way to this post (http://blogs.msdn.com/webdav_101/archive/2008/09/25/howto-calling-exchange-powershell-from-an-impersonated-thead.aspx) Any help appreciated as this is a bit of a show stopper at the moment. Thanks Ben

    Read the article

  • jQuery for dynamic Add/Remove row function, it's clone() objcet cannot modify element name

    - by wcy0942
    I'm try jQuery for dynamic Add/Remove row function, but I meet some question in IE8 , it's clone() objcet cannot modify element name and cannot use javascript form (prhIndexed[i].prhSrc).functionKey, but in FF it works very well, source code as attachment, please give me a favor to solve the problem. <html> $(document).ready(function() { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Define some variables - edit to suit your needs //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // table id var _table = jQuery("#prh"); // modify here // tbody tbody var _tableBody = jQuery("tbody",_table); // buttons var _addRowBtn = jQuery("#controls #addRow"); var _insertRowBtn= jQuery("#controls #insertRow"); var _removeRowBtn= jQuery("#controls #removeRow"); //check box all var _cbAll= jQuery(".checkBoxAll", _table ); // add how many rows var _addRowsNumber= jQuery("#controls #add_rows_number"); var _hiddenControls = jQuery("#controls .hiddenControls"); var blankRowID = "blankRow"; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //click the add row button //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _addRowBtn.click(function(){ // when input not isNaN do add row if (! isNaN(_addRowsNumber.attr('value')) ){ for (var i = 0 ; i < _addRowsNumber.attr('value') ;i++){ var newRow = jQuery("#"+blankRowID).clone(true).appendTo(_tableBody) .attr("style", "display: ''") .addClass("rowData") .removeAttr("id"); } refreshTable(_table); } return false; //kill the browser default action }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //checkbox select all //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _cbAll.click(function(){ var checked_status = this.checked; var prefixName = _cbAll.attr('name'); // find name prefix match check box (group of table) jQuery("input[name^='"+prefixName+"']").each(function() { this.checked = checked_status; }); }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Click the remove all button //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _removeRowBtn.click(function(){ var prefixName = _cbAll.attr('name'); // find name prefix match check box (group of table) jQuery("input[name^='"+prefixName+"']").not(_cbAll).each(function() { if (this.checked){ // remove tr row , ckbox name the same with rowid jQuery("#"+this.name).remove(); } }); refreshTable(_table); return false; }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Click the insert row button //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _insertRowBtn.click(function(){ var prefixName = _cbAll.attr('name'); jQuery("input[name^='"+prefixName+"']").each(function(){ var currentRow = this.name;// ckbox name the same with rowid if (this.checked == true){ newRow = jQuery("#"+blankRowID).clone(true).insertAfter(jQuery("#"+currentRow)) .attr("style", "display: ''") .addClass("rowData") .removeAttr("id"); } }); refreshTable(_table); return false; }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Function to refresh new row //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function refreshTable(_table){ var tableId = _table.attr('id'); var count =1; // ignore hidden column // update tr rowid jQuery ( "#"+tableId ).find(".rowData").each(function(){ jQuery(this).attr('id', tableId + "_" + count ); count ++; }); count =0; jQuery ( "#"+tableId ).find("input[type='checkbox'][name^='"+tableId+"']").not(".checkBoxAll").each(function(){ // update check box id and name (not check all) jQuery(this).attr('id', tableId + "_ckbox" + count ); jQuery(this).attr('name', tableId + "_" + count ); count ++; }); // write customize code here customerRow(_table); }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Function to customer new row : modify here //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function customerRow(_table){ var form = document.myform; var pageColumns = ["prhSeq", "prhChannelproperty", "prhSrc"]; //modify here var tableId = _table.attr('id'); var count =1; // ignore hidden column // update tr rowid jQuery ( "#"+tableId ).find(".rowData").each(function(){ for(var i = 0; i < pageColumns.length; i++){ jQuery ( this ).find("input[name$='"+pageColumns[i]+"']").each(function(){ jQuery(this).attr('name', 'prhIndexed['+count+'].'+pageColumns[i] ); // update prhSeq Value if (pageColumns[i] == "prhSeq") { jQuery(this).attr('value', count ); } if (pageColumns[i] == "prhSrc") { // clear default onfocus //jQuery(this).attr("onfocus", ""); jQuery(this).focus(function() { // doSomething }); } }); jQuery ( this ).find("select[name$='"+pageColumns[i]+"']").each(function(){ jQuery(this).attr('name', 'prhIndexed['+count+'].'+pageColumns[i] ); }); }// end of for count ++; }); jQuery ( "#"+tableId ).find(".rowData").each(function(){ // only for debug alert ( jQuery(this).html() ) }); }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }); <div id="controls"> <table width="350px" border="0"> <tr><td> <input id="addRow" type="button" name="addRows" value="Add Row" /> <input id="add_rows_number" type="text" name="add_rows_number" value="1" style="width:20px;" maxlength="2" /> <input id="insertRow" type="button" name="insert" value="Insert Row" /> <input id="removeRow" type="button" name="deleteRows" value="Delete Row" /> </td></tr> </table></div> <table id="prh" width="350px" border="1"> <thead> <tr class="listheader"> <td nowrap width="21"><input type="checkbox" name="prh_" class="checkBoxAll"/></td> <td nowrap width="32">Sequence</td> <td nowrap width="153" align="center">Channel</td> <td nowrap width="200">Source</td> </tr> </thead> <tbody> <!-- dummy row --> <tr id='blankRow' style="display:none" > <td><input type="checkbox" id='prh_ckbox0' name='prh_0' value=""/></td> <td align="right"><input type="text" name="prhIndexed[0].prhSeq" maxlength="10" value="" onkeydown="" onblur="" onfocus="" readonly="readonly" style="width:30px;background-color:transparent;border:0;line-height:13pt;color: #993300;background-color:transparent;border:0;line-height:13pt;color: #993300;"></td> <td><select name="prhIndexed[0].prhChannelproperty"><option value=""></option> <option value="A01">A01</option> <option value="A02">A02</option> <option value="A03">A03</option> <option value="A04">A04</option> </select></td> <td><input type="text" name="prhIndexed[0].prhSrc" maxlength="6" value="new" style="width:80px;background-color:#FFFFD7;"> <div id='displayPrhSrcName0'></div> </td> </tr> <!-- row data --> <tr id='prh_1' class="rowData"> <td><input type="checkbox" id='prh_ckbox1' name='prh_1' value=""/></td> <td align="right"><input type="text" name="prhIndexed[1].prhSeq" maxlength="10" value="1" onkeydown="" onblur="" onfocus="" readonly="readonly" style="width:30px;background-color:transparent;border:0;line-height:13pt;color: #993300;background-color:transparent;border:0;line-height:13pt;color: #993300;"></td> <td><select name="prhIndexed[1].prhChannelproperty"><option value=""></option> <option value="A01">A01</option> <option value="A02">A02</option> <option value="A03">A03</option> <option value="A04">A04</option> </select></td> <td><input type="text" name="prhIndexed[1].prhSrc" maxlength="6" value="new" style="width:80px;background-color:#FFFFD7;"> <div id='displayPrhSrcName0'></div> </td> </tr> <tr id='prh_2' class="rowData"> <td><input type="checkbox" id='prh_ckbox2' name='prh_2' value=""/></td> <td align="right"><input type="text" name="prhIndexed[2].prhSeq" maxlength="10" value="2" onkeydown="" onblur="" onfocus="" readonly="readonly" style="width:30px;background-color:transparent;border:0;line-height:13pt;color: #993300;background-color:transparent;border:0;line-height:13pt;color: #993300;"></td> <td><select name="prhIndexed[2].prhChannelproperty"><option value=""></option> <option value="A01">A01</option> <option value="A02">A02</option> <option value="A03">A03</option> <option value="A04">A04</option> </select></td> <td><input type="text" name="prhIndexed[2].prhSrc" maxlength="6" value="new" style="width:80px;background-color:#FFFFD7;"> <div id='displayPrhSrcName0'></div> </td> </tr> </tbody> </table>

    Read the article

  • pagination for displaytag with colorbox in Spring framework

    - by Hitesh Solanki
    Hi..... I want to display the pop up for user selection using colorbox. I have put link on manageblacklist.jsp named 'select'. when I click on 'select' link ,colorbox is displayed. all user is displayed but pagination is not worked. I have used display tag for pagination. Without using colorbox, pagination is worked fine. I have used spring framework. The code of manageblacklist.jsp is given below: <%@ page contentType="text/html" pageEncoding="UTF-8" import="java.util.*"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ include file="/WEB-INF/jsp/include.jsp" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib uri="http://displaytag.sf.net" prefix="display" %> <%@ page import="com.sufalam.mailserver.bean.User"%> <%@ page import="javax.servlet.http.HttpSession" %> <% String pageSize = (String) request.getAttribute("pageSize"); System.out.println("page size:" + pageSize); HttpSession session1 = request.getSession(); List<User> userList = (List<User>) session1.getAttribute("userList"); Iterator iterator = userList.iterator(); String user = (String) request.getAttribute("user"); System.out.println("user in the jsp :" + user); %> <html> <head> <script type="text/javascript" src="js/jquery142.js"></script> <script type="text/javascript" src="js/jquery.colorbox.js"></script> <link rel="stylesheet" href="style/colorbox.css" type="text/css"> <script type="text/javascript"> $(document).ready(function(){ //Examples of how to assign the ColorBox event to elements $(".example5").colorbox(); //Example of preserving a JavaScript event for inline calls. $("#click").click(function(){ $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here."); return false; }); }); </script> <script type="text/javascript"> function changePageSize() { var myValue = document.getElementById("combo1").value; document.getElementById("selectedPageSize").value=myValue; document.whitelistBlacklistForm.submit(); } function selectAll() { var selectAll = document.getElementById("checkAll"); var returnById = document.getElementsByName("check"); var i; var val; if (selectAll.checked == true) { val = true; } else { val = false; } for (i = 0; i < returnById.length; i++) { returnById[i].checked = val; } } function onload() { insertNavigation ('insertHereTop', 'insertHereBottom'); } function insertNavigation( topElementID, BottomElementID ) { if ( document.getElementById('pagingBanner') ){ document.getElementById(topElementID).innerHTML=document.getElementById('pagingBanner').innerHTML; document.getElementById(BottomElementID).innerHTML=document.getElementById('pagingBanner1').innerHTML; } } function confirmDelete() { if (confirm("Are you sure you want to delete selected records?")) { flag = 1; return true; } else { return false; } } function loadModels() { var flag=true; var textValue = document.getElementById('txtuser'); $.getJSON("ajaxblacklist.htm", // url { param :textValue.value }, // request params function(json) { // callback // var options = '<table class="displayTable" cellspacing="0"><thead><tr><th align = "center">Blacklisted Sender</th>'+ // '<th align ="center">Delete</th></tr></thead><tbody>'; var options = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td style="background:url(images/leftbg.gif) repeat-y; width:8px;"></td>' + '<td class="middlesection"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>' + '<td height="30" class="p10"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="allboder" >' + '<tr><td class="tebelhd"> Blacklisted Sender </td></tr>'; for (i in json) { var state = json[i]; for(j in state){ var op = state[j]; if(op.length==undefined){ options += '<tr><td class="tdhd"><table width="0%" border="0" cellspacing="0" cellpadding="0"><tr><td width="741">'+ state[j].senderEmail + '</td><td align="center" width="148"><a href="managewhitelistblacklist.htm?sender='+state[j].senderEmail+'&recipient='+ state[j].recipientEmail+'&action=delete"><span> <img src="/MailServerV2/images/delete.gif"/> </span></a></td></tr></table></td></tr>'; break; } for(k in op) { if(flag == true) { flag = false; options += '<tr><td class="tdhd"><table width="0%" border="0" cellspacing="0" cellpadding="0"><tr>'; } else { flag = true; options += '<tr><td class="tdhd2"><table width="0%" border="0" cellspacing="0" cellpadding="0"><tr>'; } options += '<td width="741">'+ op[k].senderEmail +'</td><td align="center" width="148"><a href="managewhitelistblacklist.htm?sender='+op[k].senderEmail+'&recipient='+op[k].recipientEmail+'&action=delete"><span> <img src="/MailServerV2/images/delete.gif"/> </span></a></td></tr></table></td></tr>'; } } } options += '</td></tr></table>'; $("div[name^=blacklist]").html(options); }); } </script> </head> <body> <table width="" border="0" align="center" cellpadding="0" cellspacing="0" class="maintable"> <tr> <td class="topsection"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top" align="center" class="middlesection" ><table width="96%" border="0" cellspacing="0" cellpadding="0"> <tr> <td >&nbsp;</td> </tr> <tr> <td> <table width="100%" border="0" cellspacing ="0" cellpadding="0"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td align="left" valign="middle"><h1>Manage Blacklist</h1></td> <td align="right" valign="bottom"><div style="float:right;"><a href="savewhitelistblacklist.htm" class="buttonash"><span>Create Whitelist Blacklist </span></a></div></td> </tr> </table></td> </tr> <tr> <td class="bottomboder"><img src="images/ashish.gif" height="1" /></td> </tr> </table> </td> </tr> <tr> <td>&nbsp;</td> </tr> <tr> <td> </td> </tr> <tr> <td> <div id="TabbedPanels1" class="TabbedPanels"/> <div style="display: block;" class="TabbedPanelsContent"/> <div align="left" class="tebelhd"> Blacklist Information </div><div class="entry-edit"> <div class="fieldset" id="base_fieldset"> <div class="hor-scroll_1" align="left"> <fieldset Class="label1css" style="color:#666666"> <legend>Fields</legend> <table> <tr> <td align="right"> Recipient Email : </td> <td><input type="text" id="txtuser" name="txtuser" <% if (user != null) { %> value="<%=user%>" <% } else { %> value="" <% } %> /> </td> <td><a href="#" class="buttonash" onclick="loadModels()"><span>Search</span></a></td> <!-- <td><a href="javascript:void(0)" class="buttonash" onclick="window.open('selectuser.htm','selectuser','width=600,height=400,menubar=yes,status=yes,location=yes,toolbar=yes,scrollbars=yes');" ><span>Select</span></a></td>--> <td><a href="selectuser.htm" class="example5 buttonash" ><span>Select</span></a> </td> <td align="right"> </td> </tr> </table> </fieldset> <div id="blacklist" name="blacklist"></div> </div> </div> </div> </td> </tr> </table> </td> </tr> </table> </td> <!-- InstanceEndEditable --> <td style="background:url(images/rightbg.gif) repeat-y; width:8px;"></td> </tr> </table> <% // session1.removeAttribute("user"); %> </body> </html> So , please tell me how to work pagination .... Thanks in advanced...

    Read the article

  • Javascript not able to read data generated by ajax script

    - by user1371033
    I have a situation in which my Jquery Ajax script generates HTML table. And another script is meant to filter the table column by providing a dropdown comprising of unique values in that particular column. If i have static content in html page the filter script works fine. But is not able to read table content when it is generated via Ajax that is during runtime. Any idea what could be the reason. I also tried to align script in order. My Ajax script is here:- $(document).ready(function() { $("#getResults").click(function(){ bug = $("#bug").val(); priority = $("#priority").val(); component = $("#component").val(); fixVersion = $("#fixVersion").val(); dateType = $("#dateType").val(); fromDate = $("#dp2").val(); toDate = $("#dp3").val(); $("#query").empty(); $("tbody").empty(); $.post("getRefineSearchResultsPath", {bug:bug,priority:priority,component:component, fixVersion:fixVersion,dateType:dateType,fromDate:fromDate,toDate:toDate }, function(data) { // setting value for csv report button //clear the value attribute for button first $("#query_csv").removeAttr("value"); //setting new value to "value" attribute of the csv button $("#query_csv").attr("value", function(){ return $(data).find("query").text(); }); $("#query").append("<p class='text-success'>Query<legend></legend><small>" +$(data).find("query").text() +"</small></p>"); var count = 1; $(data).find("issue").each(function(){ var $issue = $(this); var value = "<tr>"; value += "<td>" +count +"</td>"; value += "<td>" +$issue.find('issueKey').text() +"</td>"; value += "<td>" +$issue.find('type').text() +"</td>"; value += "<td><div id='list' class='summary'>" +$issue.find('summary').text() +"</div></td>"; value += "<td><div id='list' class='mousescroll'>" +$issue.find('description').text() +"</div></td>"; value += "<td>" +$issue.find('priority').text() +"</td>"; value += "<td>" +$issue.find('component').text() +"</td>"; value += "<td>" +$issue.find('status').text() +"</td>"; value += "<td>" +$issue.find('fixVersion').text() +"</td>"; value += "<td>" +$issue.find('resolution').text() +"</td>"; value += "<td>" +$issue.find('created').text() +"</td>"; value += "<td>" +$issue.find('updated').text() +"</td>"; value += "<td>" +$issue.find('os').text() +"</td>"; value += "<td>" +$issue.find('frequency').text() +"</td>"; value += "<td>"; var number_of_attachement = $issue.find('attachment').size(); if(number_of_attachement > 0){ value += "<div id='list' class='attachment'>"; value += "<ul class='unstyled'>"; $issue.find('attachment').each(function(){ var $attachment = $(this); value += "<li>"; value += "<a href='#' onclick='document.f1.attachmentName.value='" +$attachment.find('attachmentName').text(); value += "';document.f1.issueKey.value='"+$attachment.find('attachmentissueKey').text(); value += "';document.f1.digest.value='"+$attachment.find('attachmentdigest').text(); value += "';document.f1.submit();'>"+$attachment.find('attachmentName').text(); value += "</a>"; value += "</li>"; value += "<br>"; }); value +="</ul>"; value +="</div>"; } value += "</td>"; value += "</tr>"; $("tbody").append(value); count++; }); }); }); }); And my script to filter table is here, I got this script from this link http://www.javascripttoolbox.com/lib/table/ My JSP page is here:- <html> <body> <table class="table table-bordered table-condensed table-hover example sort01 table-autosort:0 table-autofilter table-autopage:10 table-page-number:t1page table-page-count:t1pages table-filtered-rowcount:t1filtercount table-rowcount:t1allcount"> <thead > <tr> <th class="table-sortable:numeric" Style="width:3%;">No.</th> <th class="table-sortable:default" Style="width:5.5%;">Issue Key <br> </th> <th>Type</th> <th Style="text-align: center;">Summary</th> <th Style="text-align: center;">Description</th> <th class="table-filterable table-sortable:default" id ="priorityColumn" Style="width:5%">Priority</th> <th class="table-filterable table-sortable:default" >Component</th> <th class="table-filterable table-sortable:default" Style="width:5%">Status</th> <th class="table-filterable table-sortable:default">Fix Version</th> <th class="table-filterable table-sortable:default" Style="width:6%">Resolution</th> <th>Created</th> <th>Updated</th> <th>OS</th> <th>Frequency</th> <th>Attachments</th> </tr> </thead> <tbody> </tbody> <tfoot> <tr> <td class="table-page:previous" style="cursor:pointer;"><img src="table/icons/previous.gif" alt="Previous"><small>Prev</small></td> <td colspan="13" style="text-align:center;">Page <span id="t1page"></span>&nbsp;of <span id="t1pages"></span></td> <td class="table-page:next" style="cursor:pointer;">Next <img src="table/icons/next.gif" alt="Previous"></td> </tr> <tr Style="background-color: #dddddd"> <td colspan="15"><span id="t1filtercount"></span>&nbsp;of <span id="t1allcount"></span>&nbsp;rows match filter(s)</td> </tr> <tr class="text-success"> <td colspan="15">Total Results : ${count}</td> </tr> </tfoot> </table> </body> </html>

    Read the article

  • Retrieve click() handler in jQuery for later use

    - by Xiong Chiamiov
    I'm using the jQuery tablesorter plugin to sort a table, which assigns .click() handlers to the <th>s in the table. Since my table has alternating colors for each column, I've built a simple fix_table_colors(identifier) function that does as it should when I call it manually using Firebug. I would like, however, to have that automatically called after a sort. To do this, I decided to retrieve the .click() handler from the <th>s, and assign a new handler that simply calls the previous handler, followed by fix_table_colors(). (This SO question is similar, but uses standard onClick() attributes, which won't work here.) From the accepted answer to this question, I have created the following code: $(document).ready(function() { $("table.torrents").tablesorter({ debug: true, headers: { 1: { sorter: 'name' }, 2: { sorter: 'peers' }, 3: { sorter: 'filesize' }, 4: { sorter: 'filesize' }, 5: { sorter: 'filesize' }, 6: { sorter: 'ratio' } } }); $('table.torrents thead th').each(function() { var th = $(this); var clickHandler = th.data('events').click[0]; th.click(function() { clickHandler(); fix_table_colors('table.torrents'); }); }); }); While this is conceptually correct, clickHandler doesn't appear to actually be a function, and so I cannot call it. With a bit more digging in Firebug, I found that click[3] appears to hold the function I'm looking for (and click[10] my new one). I get an 'e is undefined' error on line 2 of tablesorter.min.js when using that, though. Am I even going down the right path? I have a feeling that with what I've found so far, I can make this work, but it's going to be much uglier than I would expect it needs to be.

    Read the article

  • What other things would be good to include in CSS reset (along with eric meyer reset) for any projec

    - by metal-gear-solid
    I know and use eric meyer CSS reset, but is there any more things which would be good to add in reset css? and can save our time and increase compatibility. This is default meyer's latest CSS reset code. /* v1.0 | 20080212 */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } /* remember to define focus styles! */ :focus { outline: 0; } /* remember to highlight inserts somehow! */ ins { text-decoration: none; } del { text-decoration: line-through; } /* tables still need 'cellspacing="0"' in the markup */ table { border-collapse: collapse; border-spacing: 0; }

    Read the article

  • Javascript - How to index html code into variables

    - by Fernando SBS
    The webpage has the following source (only copied the important part): <h1>Relatórios</h1> <div id="textmenu"> <a href="berichte.php" class="selected ">Tudo</a> | <a href="berichte.php?t=2">Comércio</a> | <a href="berichte.php?t=1">Reforços</a> | <a href="berichte.php?t=3">Ataques</a> | <a href="berichte.php?t=4">Outros</a> </div> <form method="post" action="berichte.php" name="msg"> <table cellpadding="1" cellspacing="1" id="overview" class="row_table_data"> <thead> <tr> <th colspan="2">Assunto:</th> <th class="sent"> enviada</th> </tr> </thead><tfoot> <tr> <th>&nbsp;</th> <th class=buttons><input name=del value=apagar alt=apagar type=image id=btn_delete class=dynamic_img src=img/x.gif /></th> <th class=navi>&laquo;<a href="berichte.php?s=10&amp;o=0">&raquo;</a></th> </tr> </tfoot> <tbody> <tr> <td class="sel"><input class="check" type="checkbox" name="n1" value="15737030" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15737030">Rio Grande Do Leste ataca lcsanchez da aldeia</a> </div> </td> <td class="dat">hoje 21:33</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n2" value="15736877" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15736877">Rio Grande Do Leste ataca Thabiti da aldeia</a> </div> </td> <td class="dat">hoje 21:32</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n3" value="15736759" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15736759">Rio Grande Do Leste ataca Dionisio</a> </div> </td> <td class="dat">hoje 21:31</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n4" value="15736513" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15736513">Rio Grande Do Leste ataca Aldeia de troakris</a> (nova)</div> </td> <td class="dat">hoje 21:30</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n5" value="15736275" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15736275">Rio Grande Do Leste ataca Thabiti da aldeia</a> </div> </td> <td class="dat">hoje 21:28</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n6" value="15736220" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15736220">Rio Grande Do Leste ataca Aldeia de troakris</a> (nova)</div> </td> <td class="dat">hoje 21:28</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n7" value="15734824" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15734824">Rio Grande Do Leste ataca Austrália</a> </div> </td> <td class="dat">hoje 21:18</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n8" value="15734440" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15734440">Rio Grande Do Leste ataca andrômeda</a> (nova)</div> </td> <td class="dat">hoje 21:15</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n9" value="15730612" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15730612">Rio Grande Do Leste ataca wLG02 KING OF POP</a> (nova)</div> </td> <td class="dat">hoje 20:49</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n10" value="15730304" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15730304">Rio Grande Do Leste ataca wLG02 KING OF POP</a> (nova)</div> </td> <td class="dat">hoje 20:47</td> </tr> </tbody> </table> </form> </div> I want to read from the source and assign to a variable the values like: relatorio[0] = berichte.php?id=15730304; relatorio[1] = berichte.php?id=15730612; ... relatorio[9] = berichte.php?id=15737030; How to do that? thanks

    Read the article

  • Auto complete from database using CodeIgniter (Active Record)

    - by Ralph David Abernathy
    I have a form on my website in which one is able to submit a cat. The form contains inputs such as "Name" and "Gender", but I am just trying to get the auto completion to work with the "Name" field. Here is what my jquery looks like : $(document).ready(function() { $( "#tags" ).autocomplete({ source: '/Anish/auto_cat' }); }); Here is what my model looks like: public function auto_cat($search_term) { $this->db->like('name', $search_term); $response = $this->db->get('anish_cats')->result_array(); // var_dump($response);die; return $response; } } Here is my controller: public function auto_cat(){ $search_term = $this->input->get('term'); $cats = $this->Anish_m->auto_cat($search_term); } And here is my view: <head> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> </head> <h1>Anish's Page</h1> <form action="/Anish/create" method="POST"> <div class="ui-widget"> <label for="tags">Name</label><input id="tags" type="text" name="name"> </div> <div> <label>Age</label><input type="text" name="age"> </div> <div> <label>Gender</label><input type="text" name="gender"> </div> <div> <label>Species</label><input type="text" name="species"> </div> <div> <label>Eye Color</label><input type="text" name="eye_color"> </div> <div> <label>Color</label><input type="text" name="color"> </div> <div> <label>Description</label><input type="text" name="description"> </div> <div> <label>marital status</label><input type="text" name="marital_status"> </div> <br> <button type="submit" class="btn btn-block btn-primary span1">Add cat</button> </form> <br/><br/><br/><br/> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Name</th> <th>Gender</th> <th>Age</th> <th>Species</th> <th>Eye Color</th> <th>Color</th> <th>Description</th> <th>Marital Status</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody> <?php foreach ($cats as $cat):?> <tr> <td> <?php echo ($cat['name']);?><br/> </td> <td> <?php echo ($cat['gender']);?><br/> </td> <td> <?php echo ($cat['age']);?><br/> </td> <td> <?php echo ($cat['species']);?><br/> </td> <td> <?php echo ($cat['eye_color']);?><br/> </td> <td> <?php echo ($cat['color']);?><br/> </td> <td> <?php echo ($cat['description']);?><br/> </td> <td> <?php echo ($cat['marital_status']);?><br/> </td> <td> <form action="/Anish/edit" method="post"> <input type="hidden" value="<?php echo ($cat['id']);?>" name="Anish_id_edit"> <button class="btn btn-block btn-info">Edit</button> </form> </td> <td> <form action="/Anish/delete" method="post"> <input type="hidden" value="<?php echo ($cat['id']);?>" name="Anish_id"> <button class="btn btn-block btn-danger">Delete</button> </form> </td> </tr> <?php endforeach;?> </tbody> </table> I am stuck. In my console, I am able to see this output when I type the letter 'a' if I uncomment the var_dump in my model: array(4) { [0]=> array(9) { ["id"]=> string(2) "13" ["name"]=> string(5) "Anish" ["gender"]=> string(4) "Male" ["age"]=> string(2) "20" ["species"]=> string(3) "Cat" ["eye_color"]=> string(5) "Brown" ["color"]=> string(5) "Black" ["description"]=> string(7) "Awesome" ["marital_status"]=> string(1) "0" } [1]=> array(9) { ["id"]=> string(2) "16" ["name"]=> string(5) "Anish" ["gender"]=> string(2) "fe" ["age"]=> string(2) "23" ["species"]=> string(2) "fe" ["eye_color"]=> string(2) "fe" ["color"]=> string(2) "fe" ["description"]=> string(2) "fe" ["marital_status"]=> string(1) "1" } [2]=> array(9) { ["id"]=> string(2) "17" ["name"]=> string(1) "a" ["gender"]=> string(1) "a" ["age"]=> string(1) "4" ["species"]=> string(1) "a" ["eye_color"]=> string(1) "a" ["color"]=> string(1) "a" ["description"]=> string(1) "a" ["marital_status"]=> string(1) "0" } [3]=> array(9) { ["id"]=> string(2) "18" ["name"]=> string(4) "Matt" ["gender"]=> string(6) "Female" ["age"]=> string(2) "80" ["species"]=> string(6) "ferret" ["eye_color"]=> string(4) "blue" ["color"]=> string(4) "pink" ["description"]=> string(5) "Chill" ["marital_status"]=> string(1) "0" } }

    Read the article

  • What is preferred strategies for cross browser and multiple styled table in CSS?

    - by jitendra
    What is preferred strategies for cross browser and multiple styled table in CSS? in default css what should i predefined for <table>, td, th , thead, tbody, tfoot I have to work in a project there are so many tables with different color schemes and different type of alignment like in some table , i will need to horizontally align data of cell to right, sometime left, sometime right. same thing for vertical alignment, top, bottom and middle. some table will have thin border on row , some will have thick (same with column border). Some time i want to give different background color to particular row or column or in multiple row or column. So my question is: What code should i keep in css default for all tables and how to handle table with different style using ID and classes in multiple pages. I want to do every presentational thing with css. How to make ID classes for everything using semantic naming ? Which tags related to table can be useful? How to control whole tables styling from one css class?

    Read the article

  • Help Optimizing MySQL Table (~ 500,000 records) and PHP Code.

    - by Pyrite
    I have a MySQL table that collects player data from various game servers (Urban Terror). The bot that collects the data runs 24/7, and currently the table is up to about 475,000+ records. Because of this, querying this table from PHP has become quite slow. I wonder what I can do on the database side of things to make it as optomized as possible, then I can focus on the application to query the database. The table is as follows: CREATE TABLE IF NOT EXISTS `people` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(40) NOT NULL, `ip` int(4) unsigned NOT NULL, `guid` varchar(32) NOT NULL, `server` int(4) unsigned NOT NULL, `date` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Person` (`name`,`ip`,`guid`), KEY `server` (`server`), KEY `date` (`date`), KEY `PlayerName` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='People that Play on Servers' AUTO_INCREMENT=475843 ; I'm storying the IPv4 (ip and server) as 4 byte integers, and using the MySQL functions NTOA(), etc to encode and decode, I heard that this way is faster, rather than varchar(15). The guid is a md5sum, 32 char hex. Date is stored as unix timestamp. I have a unique key on name, ip and guid, as to avoid duplicates of the same player. Do I have my keys setup right? Is the way I'm storing data efficient? Here is the code to query this table. You search for a name, ip, or guid, and it grabs the results of the query and cross references other records that match the name, ip, or guid from the results of the first query, and does it for each field. This is kind of hard to explain. But basically, if I search for one player by name, I'll see every other name he has used, every IP he has used and every GUID he has used. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Search: <input type="text" name="query" id="query" /><input type="submit" name="btnSubmit" value="Submit" /> </form> <?php if (!empty($_POST['query'])) { ?> <table cellspacing="1" id="1up_people" class="tablesorter" width="300"> <thead> <tr> <th>ID</th> <th>Player Name</th> <th>Player IP</th> <th>Player GUID</th> <th>Server</th> <th>Date</th> </tr> </thead> <tbody> <?php function super_unique($array) { $result = array_map("unserialize", array_unique(array_map("serialize", $array))); foreach ($result as $key => $value) { if ( is_array($value) ) { $result[$key] = super_unique($value); } } return $result; } if (!empty($_POST['query'])) { $query = trim($_POST['query']); $count = 0; $people = array(); $link = mysql_connect('localhost', 'mysqluser', 'yea right!'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db("1up"); $sql = "SELECT id, name, INET_NTOA(ip) AS ip, guid, INET_NTOA(server) AS server, date FROM 1up_people WHERE (name LIKE \"%$query%\" OR INET_NTOA(ip) LIKE \"%$query%\" OR guid LIKE \"%$query%\")"; $result = mysql_query($sql, $link); if (!$result) { die(mysql_error()); } // Now take the initial results and parse each column into its own array while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $name = htmlspecialchars($row[1]); $people[] = array( 'id' => $row[0], 'name' => $name, 'ip' => $row[2], 'guid' => $row[3], 'server' => $row[4], 'date' => $row[5] ); } // now for each name, ip, guid in results, find additonal records $people2 = array(); foreach ($people AS $person) { $ip = $person['ip']; $sql = "SELECT id, name, INET_NTOA(ip) AS ip, guid, INET_NTOA(server) AS server, date FROM 1up_people WHERE (ip = \"$ip\")"; $result = mysql_query($sql, $link); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $name = htmlspecialchars($row[1]); $people2[] = array( 'id' => $row[0], 'name' => $name, 'ip' => $row[2], 'guid' => $row[3], 'server' => $row[4], 'date' => $row[5] ); } } $people3 = array(); foreach ($people AS $person) { $guid = $person['guid']; $sql = "SELECT id, name, INET_NTOA(ip) AS ip, guid, INET_NTOA(server) AS server, date FROM 1up_people WHERE (guid = \"$guid\")"; $result = mysql_query($sql, $link); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $name = htmlspecialchars($row[1]); $people3[] = array( 'id' => $row[0], 'name' => $name, 'ip' => $row[2], 'guid' => $row[3], 'server' => $row[4], 'date' => $row[5] ); } } $people4 = array(); foreach ($people AS $person) { $name = $person['name']; $sql = "SELECT id, name, INET_NTOA(ip) AS ip, guid, INET_NTOA(server) AS server, date FROM 1up_people WHERE (name = \"$name\")"; $result = mysql_query($sql, $link); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $name = htmlspecialchars($row[1]); $people4[] = array( 'id' => $row[0], 'name' => $name, 'ip' => $row[2], 'guid' => $row[3], 'server' => $row[4], 'date' => $row[5] ); } } // Combine people and people2 into just people $people = array_merge($people, $people2); $people = array_merge($people, $people3); $people = array_merge($people, $people4); $people = super_unique($people); foreach ($people AS $person) { $date = ($person['date']) ? date("M d, Y", $person['date']) : 'Before 8/1/10'; echo "<tr>\n"; echo "<td>".$person['id']."</td>"; echo "<td>".$person['name']."</td>"; echo "<td>".$person['ip']."</td>"; echo "<td>".$person['guid']."</td>"; echo "<td>".$person['server']."</td>"; echo "<td>".$date."</td>"; echo "</tr>\n"; $count++; } // Find Total Records //$result = mysql_query("SELECT id FROM 1up_people", $link); //$total = mysql_num_rows($result); mysql_close($link); } ?> </tbody> </table> <p> <?php echo $count." Records Found for \"".$_POST['query']."\" out of $total"; ?> </p> <?php } $time_stop = microtime(true); print("Done (ran for ".round($time_stop-$time_start)." seconds)."); ?> Any help at all is appreciated! Thank you.

    Read the article

  • webpage scrollbar scrolls to top when typing in input box, how to fix?

    - by derei
    I have a HTML table that is scrollable and I'm forcing the scroll bar at the bottom. But every time I type something in a input box situated inside <thead> it scrolls back to top. I have no idea how to stop it to do that... I'm sorry for not explaining it better, if anybody wants to help, I could provide a link. I cannot place it public because is a private project. Thanks, let me know. EDIT -added jsfiddle example (below is the link) click here for jsfiddle example EDIT2 the issue seem to be present only in Chrome, but that it's more than enough (the app is intended to be used in chrome) EDIT3 I found a similar issue here: on webkit browsers typing into edit box causes scrolling , so the problem seem explained: the parent element gets focus on the side where the input-box is. I verified this on a mockup-template and it acts accordingly. *The question is:*how to prevent this to happen? I am forced by situation to have the input-box as child for the scrollable div, but I don't want that scroll to move (somehow to not give focus to the parent element, when I type in the input-box). Any idea?

    Read the article

  • auto refresh of div in mvc3 ASP.Net not working

    - by user1493249
    ViewData.cshtml(Partial View) Date Bill Amount PayNow </tr> </thead> <tbody> @{ for (int i = @Model.bill.Count - 1; i >= 0; i--) { <tr> <td width="30%" align="center">@Model.billdate[i]</td> <td width="30%" align="center">@Model.bill[i]</td> <td width="30%" align="center"> <a class="isDone" href="#" data-tododb-itemid="@Model.bill[i]">Paynow</a> </td> </tr> } } </tbody> Index.cshtml(View) $(document).ready(function () { window.setInterval(function () { var url = '@Url.Action("SomeScreen", "Home")'; $('#dynamictabs').load(url) }, 9000); $.ajaxSetup({ cache: false }); }); @Html.Partial("ViewData") HomeController.cs(Controller) public ActionResult Index() { fieldProcessor fp= new fieldProcessor(); return View(fp); } public ActionResult ShowScreen() { return View("ViewData",fp); } Still the same is not working..

    Read the article

  • paginate the class

    - by small
    please help me with pagination of this method my method is this one controller # def show @topic = Topic.find(params[:id]) @posts = @topic.posts.find(:all ,:order=> 'id') end views # %div{:style=>"margin: 0 auto;"} %table.sortable.style2{:cellpadding=>5} %thead %tr %td{:width => "25%",:align => "center",:style => "font-weight: bold;"}Posted By %td{:width => "75%",:style => "font-weight: bold;"}Comments %tbody - for post in @posts %tr %td{:align => "center"} &nbsp %div{:width=>"5px" , :style=>"border: 1px solid rgb(232, 232, 232);background-color: rgb(248, 248, 248);width: 60px; height:60px;" } - if post.posted_by.image = image_tag(post.posted_by.image.public_filename(),:width => "60px", :height => "60px",:align=>"center") %div{:style => "font-weight: bold; font-style: italic;"} = post.posted_by ? post.posted_by.firstname : "<em>Unknown User</em>" %br %div{:style => "font-style: italic;"} Posted on = post.created_at.strftime('%d of %B %Y ') = post.created_at.strftime('at %H:%M') %td{:valign => "top"} =post.body

    Read the article

  • .NET 4 ... Parallel.ForEach() question

    - by CirrusFlyer
    I understand that the new TPL (Task Parallel Library) has implemented the Parallel.ForEach() such that it works with "expressed parallelism." Meaning, it does not guarantee that your delegates will run in multiple threads, but rather it checks to see if the host platform has multiple cores, and if true, only then does it distribute the work across the cores (essentially 1 thread per core). If the host system does not have multiple cores (getting harder and harder to find such a computer) then it will run your code sequenceally like a "regular" foreach loop would. Pretty cool stuff, frankly. Normally I would do something like the following to place my long running operation on a background thread from the ThreadPool: ThreadPool.QueueUserWorkItem( new WaitCallback(targetMethod), new Object2PassIn() ); In a situation whereby the host computer only has a single core does the TPL's Parallel.ForEach() automatically place the invocation on a background thread? Or, should I manaully invoke any TPL calls from a background thead so that if I am executing from a single core computer at least that logic will be off of the GUI's dispatching thread? My concern is if I leave the TPL in charge of all this I want to ensure if it determines it's a single core box that it still marshalls the code that's inside of the Parallel.ForEach() loop on to a background thread like I would have done, so as to not block my GUI. Thanks for any thoughts or advice you may have ...

    Read the article

  • JavaScript: Replacement for XMLSerializer.seralizeToString()?

    - by NRaf
    I'm developing a website using the Seam framework and the RichFaces AJAX library (these isn't really all that important to the problem at hand - just some background). I seem to have uncovered a bug, however, in RichFaces which, in certain instances, will cause AJAX-based updating to fail in IE8 (see here for more info: http://community.jboss.org/message/585737). The following is the code where the exception is occurring: var anchor = oldnode.parentNode; if(!window.opera && !A4J.AJAX.isWebkitBreakingAmps() && oldnode.outerHTML && !oldnode.tagName.match( /(tbody|thead|tfoot|tr|th|td)/i ) ){ LOG.debug("Replace content of node by outerHTML()"); if (!Sarissa._SARISSA_IS_IE || oldnode.tagName.toLowerCase()!="table") { try { oldnode.innerHTML = ""; } catch(e){ LOG.error("Error to clear node content by innerHTML "+e.message); Sarissa.clearChildNodes(oldnode); } } oldnode.outerHTML = new XMLSerializer().serializeToString(newnode); } The last line (the one with XMLSerializer) is where the exception is occurring in IE. I was wondering if anyone knows of any replacement method / library / etc I could use there (only on IE is fine). Thanks.

    Read the article

  • Help Optimizing MySQL Table (~ 500,000 records).

    - by Pyrite
    I have a MySQL table that collects player data from various game servers (Urban Terror). The bot that collects the data runs 24/7, and currently the table is up to about 475,000+ records. Because of this, querying this table from PHP has become quite slow. I wonder what I can do on the database side of things to make it as optomized as possible, then I can focus on the application to query the database. The table is as follows: CREATE TABLE IF NOT EXISTS `people` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(40) NOT NULL, `ip` int(4) unsigned NOT NULL, `guid` varchar(32) NOT NULL, `server` int(4) unsigned NOT NULL, `date` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Person` (`name`,`ip`,`guid`), KEY `server` (`server`), KEY `date` (`date`), KEY `PlayerName` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='People that Play on Servers' AUTO_INCREMENT=475843 ; I'm storying the IPv4 (ip and server) as 4 byte integers, and using the MySQL functions NTOA(), etc to encode and decode, I heard that this way is faster, rather than varchar(15). The guid is a md5sum, 32 char hex. Date is stored as unix timestamp. I have a unique key on name, ip and guid, as to avoid duplicates of the same player. Do I have my keys setup right? Is the way I'm storing data efficient? Here is the code to query this table. You search for a name, ip, or guid, and it grabs the results of the query and cross references other records that match the name, ip, or guid from the results of the first query, and does it for each field. This is kind of hard to explain. But basically, if I search for one player by name, I'll see every other name he has used, every IP he has used and every GUID he has used. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Search: <input type="text" name="query" id="query" /><input type="submit" name="btnSubmit" value="Submit" /> </form> <?php if (!empty($_POST['query'])) { ?> <table cellspacing="1" id="1up_people" class="tablesorter" width="300"> <thead> <tr> <th>ID</th> <th>Player Name</th> <th>Player IP</th> <th>Player GUID</th> <th>Server</th> <th>Date</th> </tr> </thead> <tbody> <?php function super_unique($array) { $result = array_map("unserialize", array_unique(array_map("serialize", $array))); foreach ($result as $key => $value) { if ( is_array($value) ) { $result[$key] = super_unique($value); } } return $result; } if (!empty($_POST['query'])) { $query = trim($_POST['query']); $count = 0; $people = array(); $link = mysql_connect('localhost', 'mysqluser', 'yea right!'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db("1up"); $sql = "SELECT id, name, INET_NTOA(ip) AS ip, guid, INET_NTOA(server) AS server, date FROM 1up_people WHERE (name LIKE \"%$query%\" OR INET_NTOA(ip) LIKE \"%$query%\" OR guid LIKE \"%$query%\")"; $result = mysql_query($sql, $link); if (!$result) { die(mysql_error()); } // Now take the initial results and parse each column into its own array while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $name = htmlspecialchars($row[1]); $people[] = array( 'id' => $row[0], 'name' => $name, 'ip' => $row[2], 'guid' => $row[3], 'server' => $row[4], 'date' => $row[5] ); } // now for each name, ip, guid in results, find additonal records $people2 = array(); foreach ($people AS $person) { $ip = $person['ip']; $sql = "SELECT id, name, INET_NTOA(ip) AS ip, guid, INET_NTOA(server) AS server, date FROM 1up_people WHERE (ip = \"$ip\")"; $result = mysql_query($sql, $link); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $name = htmlspecialchars($row[1]); $people2[] = array( 'id' => $row[0], 'name' => $name, 'ip' => $row[2], 'guid' => $row[3], 'server' => $row[4], 'date' => $row[5] ); } } $people3 = array(); foreach ($people AS $person) { $guid = $person['guid']; $sql = "SELECT id, name, INET_NTOA(ip) AS ip, guid, INET_NTOA(server) AS server, date FROM 1up_people WHERE (guid = \"$guid\")"; $result = mysql_query($sql, $link); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $name = htmlspecialchars($row[1]); $people3[] = array( 'id' => $row[0], 'name' => $name, 'ip' => $row[2], 'guid' => $row[3], 'server' => $row[4], 'date' => $row[5] ); } } $people4 = array(); foreach ($people AS $person) { $name = $person['name']; $sql = "SELECT id, name, INET_NTOA(ip) AS ip, guid, INET_NTOA(server) AS server, date FROM 1up_people WHERE (name = \"$name\")"; $result = mysql_query($sql, $link); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $name = htmlspecialchars($row[1]); $people4[] = array( 'id' => $row[0], 'name' => $name, 'ip' => $row[2], 'guid' => $row[3], 'server' => $row[4], 'date' => $row[5] ); } } // Combine people and people2 into just people $people = array_merge($people, $people2); $people = array_merge($people, $people3); $people = array_merge($people, $people4); $people = super_unique($people); foreach ($people AS $person) { $date = ($person['date']) ? date("M d, Y", $person['date']) : 'Before 8/1/10'; echo "<tr>\n"; echo "<td>".$person['id']."</td>"; echo "<td>".$person['name']."</td>"; echo "<td>".$person['ip']."</td>"; echo "<td>".$person['guid']."</td>"; echo "<td>".$person['server']."</td>"; echo "<td>".$date."</td>"; echo "</tr>\n"; $count++; } // Find Total Records //$result = mysql_query("SELECT id FROM 1up_people", $link); //$total = mysql_num_rows($result); mysql_close($link); } ?> </tbody> </table> <p> <?php echo $count." Records Found for \"".$_POST['query']."\" out of $total"; ?> </p> <?php } $time_stop = microtime(true); print("Done (ran for ".round($time_stop-$time_start)." seconds)."); ?> Any help at all is appreciated! Thank you.

    Read the article

  • Struts 1 ActionForm - retrieving a collection from pure HTML

    - by Yaneeve
    Hi all I have (just like the rest) inherited some struts 1 code. I have had need to add a few more pages to this project. What I cannot figure out is how to map several distinct but similarly natured input elements to the my ActionForm. Let me elaborate. I create a new <Input> element dynamically as the user inputs more and more items (I use the YUI autocomplete form element and for each entered input I add it as an input element to my form and draw a new YUI autocomplete - complex sounding, I know) So... My form looks a bit like (... after some prettifying and some such...): <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>My Cool App - Test Case Builder</title> <link rel="stylesheet" type="text/css" href="../script/yui/fonts/fonts-min.css" /> <link rel="stylesheet" type="text/css" href="../skins/myCoolApp/button/button.css" /> <link rel="stylesheet" type="text/css" href="../script/yui/autocomplete/assets/skins/sam/autocomplete.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../skins/myCoolApp/testcase.css" /> <!-- YUI JAVA SCRIPTS --> <script type="text/javascript" src="../script/yui/yahoo-dom-event/yahoo-dom-event.js"></script> <script type="text/javascript" src="../script/yui/element/element-min.js"></script> <script type="text/javascript" src="../script/yui/button/button-min.js"></script> <script type="text/javascript" src="../script/yui/datasource/datasource-min.js"></script> <script type="text/javascript" src="../script/yui/autocomplete/autocomplete-min.js"></script> <!-- APP JAVA SCRIPTS --> <script type="text/javascript" src="../script/myCoolApp/myCoolApp.js" ></script> <script type="text/javascript" src="../script/myCoolApp/stack.js" ></script> <script type="text/javascript" src="../script/myCoolApp/testcase/testcase.js"></script> <script type="text/javascript" src="../script/myCoolApp/testcase/default-data.js" ></script> <script type="text/javascript" src="../script/myCoolApp/testcase/data-structs.js" ></script> <script type="text/javascript" src="../script/myCoolApp/testcase/ui-elements.js" ></script> </head> <body class="cf010"> <div id="wrap"> <div id="header"> <div id="main-header"> COOL APP </div> </div> <div id="main-body"> <div id="content"> <div class="col main"> <div id="main"> <form method="post" id="testcaseForm" class="typea" action=""> <fieldset> <legend>Test Case Builder</legend> <div id="tk1" class="tabcontrol"> <ul class="tabs"> <li class="first active"> <a href="#"> <span>General</span> </a> </li> <li class="last"> <a href="#"> <span>Parameters</span> </a> </li> </ul> <div id="tab0" class="tc-panel"> <dl class="cls9"> <dt> <label for="scenario">Choose Scenario:</label> </dt> <dd> <input type="text" id="scenario" name="scenario" class="text" /> <span id="scenarioToggle"></span> <div class="auto-complete" id="scenarioContainer"></div> </dd> <dt> <label for="ruleID">Choose Rule ID:</label> </dt> <dd> <input type="text" id="ruleID" name="ruleID" class="text" /> <span id="ruleIDToggle"></span> <div class="auto-complete" id="ruleIDContainer"></div> </dd> <dt> <label for="Test Case Name" accesskey="t"><span class="accesskey">T</span>est Case Name:</label> </dt> <dd> <input type="text" id="testCaseName" name="testCaseName" class="text" /> </dd> </dl> </div> <div id="tab1" class="tc-panel hidden"> <div class="toolbar" id="action-bar"> <ul> <li class="first"> <a title="select all" href="#" id="btmSelectAll" class="button"> <span>select all</span> </a> </li> <li> <a title="remove row" href="#" id="btmRemove" class="button"> <span>remove row</span> </a> </li> <li> <a title="undo last" href="#" id="btmRollBack" class="button disabled"> <span>undo last</span> </a> </li> <li class="last"> <a title="accept row" href="#" id="btmAccept" class="button disabled"> <span>accept row</span> </a> </li> </ul> </div> <div id="param.list" class="gridclip"> <table id='param.list.tbl' class='grid modela' > <caption>Test Case Summary</caption> <col/><col/><col/> <thead> <tr> <th class='hl center first'> <input class='grid-select-all' type='checkbox' /> <th> <th scope='col'>Row</th> <th scope='col'>Parameter</th> <th scope='col' class='last'>Value</th> </tr> </thead> <tfoot> <tr> <th scope='row'>Total</th> <td colspan='3'>2 parameters as Test Case input</td> </tr> </tfoot> <tbody id='param.list.tbl.body'> <tr class='odd'> <td class='rowcheck center first'> <input value='param1###value1' id='cb1' name='SelectedRows' class='grid-select-row' type='checkbox'/> </td> <td class='id'>1</td> <td>param1</td> <td class='last'>value1</td> </tr> <tr class='even'> <td class='rowcheck center first'> <input value='param2###value2' id='cb1' name='SelectedRows' class='grid-select-row' type='checkbox'/> </td> <td class='id'>2</td> <td>param2</td> <td class='last'>value2</td> </tr> <tr class='odd'> <td class='rowcheck center first' /> <td class='id'><em>new</em></td> <td> <dl class='clsTable'> <dt> <input type='text' id='param' name='param' class='text paramInput' /> </dt> <dd> <span id='paramToggle' /> </dd> <div class='auto-complete' id='paramContainer' /> </dl> </td> <td class='last'> <dl class='clsTable'> <dt> <input type='text' id='value' name='value' class='text valueInput' /> </dt> </dl> </td> </tr> </tbody> </table> </div> </div> </div> <!-- tabcontrol --> </fieldset> <div class="submit-box"> <input type="submit" name="formRun" id="formRun" class="form-save" value="Execute" accesskey="x" title="Run: Press Alt + [Shift] + x" /> <input type="submit" name="formSave" id="formSave" value="Save" accesskey="s" title="Save: Press Alt + [Shift] + s" /> <input type="submit" name="formLoad" id="formLoad" value="Load" accesskey="l" title="Load: Press Alt + [Shift] + l" /> <input type="submit" name="formCancel" id="formCancel" class="form-cancel" value="Cancel" accesskey="c" title="Cancel: Press Alt + [Shift] + c" /> </div> </form> </div> </div> </div> </div> </div> </body> </html> As you can see the following is pretty much a duplicate: <tr class='odd'> <td class='rowcheck center first'> <input value='param1###value1' id='cb1' name='SelectedRows' class='grid-select-row' type='checkbox'/> </td> <td class='id'>1</td> <td>param1</td> <td class='last'>value1</td> </tr> <tr class='even'> <td class='rowcheck center first'> <input value='param2###value2' id='cb1' name='SelectedRows' class='grid-select-row' type='checkbox'/> </td> <td class='id'>2</td> <td>param2</td> <td class='last'>value2</td> </tr> The relevant part of my stuts-config.xml file is: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"> <struts-config> <data-sources /> <form-beans> <form-bean name="TestCaseForm" type="com.blahblah.mycoolapp.forms.TestCaseForm" /> </form-beans> <action-mappings> <action path="/pages/SaveTestCase" name="TestCaseForm" type="org.springframework.web.struts.DelegatingActionProxy" scope="request"> </action> </action-mappings> <message-resources parameter="MessageResources" /> </struts-config> I also use spring 2.56 (The relevant part being): <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean name="/pages/SaveTestCase" class="com.blahblah.mycoolapp.actions.TestCaseBuilderSaveAction" /> </beans> My Java ActionForm class (from what I had learned off the net) is: package com.blahblah.mycoolapp.forms; import java.util.ArrayList; import java.util.List; import org.apache.struts.action.ActionForm; public class TestCaseForm extends ActionForm { private static final long serialVersionUID = 2352146257739099766L; private String scenario; private String ruleID; private String testCaseName; private List<String> SelectedRows = new ArrayList<String>() ; public String getScenario() { return scenario; } public void setScenario(String scenario) { this.scenario = scenario; } public String getRuleID() { return ruleID; } public void setRuleID(String ruleID) { this.ruleID = ruleID; } public String getTestCaseName() { return testCaseName; } public void setTestCaseName(String testCaseName) { this.testCaseName = testCaseName; } public List<String> getSelectedRows() { return SelectedRows; } public void setSelectedRows(int index, String value) { this.SelectedRows.add(value); } } The question is why do I get an empty SelectedRows in my TestCaseBuilderSave Action? Thanks all who have the patience to read such a long question... and (hopefully) thanks to all you potential saviors :)

    Read the article

  • Unexpected behavior of IntentService

    - by kknight
    I used IntentService in my code instead of Service because IntentService creates a thread for me in onHandleIntent(Intent intent), so I don't have to create a Thead myself in the code of my service. I expected that two intents to the same IntentSerivce will execute in parallel because a thread is generated in IntentService for each invent. But my code turned out that the two intents executed in sequential way. This is my IntentService code: public class UpdateService extends IntentService { public static final String TAG = "HelloTestIntentService"; public UpdateService() { super("News UpdateService"); } protected void onHandleIntent(Intent intent) { String userAction = intent .getStringExtra("userAction"); Log.v(TAG, "" + new Date() + ", In onHandleIntent for userAction = " + userAction + ", thread id = " + Thread.currentThread().getId()); if ("1".equals(userAction)) { try { Thread.sleep(20 * 1000); } catch (InterruptedException e) { Log.e(TAG, "error", e); } Log.v(TAG, "" + new Date() + ", This thread is waked up."); } } } And the code call the service is below: public class HelloTest extends Activity { //@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent selectIntent = new Intent(this, UpdateService.class); selectIntent.putExtra("userAction", "1"); this.startService(selectIntent); selectIntent = new Intent(this, UpdateService.class); selectIntent.putExtra("userAction", "2"); this.startService(selectIntent); } } I saw this log message in the log: V/HelloTestIntentService( 848): Wed May 05 14:59:37 PDT 2010, In onHandleIntent for userAction = 1, thread id = 8 D/dalvikvm( 609): GC freed 941 objects / 55672 bytes in 99ms V/HelloTestIntentService( 848): Wed May 05 15:00:00 PDT 2010, This thread is waked up. V/HelloTestIntentService( 848): Wed May 05 15:00:00 PDT 2010, In onHandleIntent for userAction = 2, thread id = 8 I/ActivityManager( 568): Stopping service: com.example.android/.UpdateService The log shows that the second intent waited the first intent to finish and they are in the same thread. It there anything I misunderstood of IntentService. To make two service intents execute in parallel, do I have to replace IntentService with service and start a thread myself in the service code? Thanks.

    Read the article

  • How to display subversion URL for the Project with jenkins email-ext plugin?

    - by kamal
    Here is the jelly script i am using: <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"> <STYLE>BODY, TABLE, TD, TH, P { font-family:Verdana,Helvetica,sans serif; font-size:11px; color:black; } h1 { color:black; } h2 { color:black; } h3 { color:black; } TD.bg1 { color:white; background-color:#0000C0; font-size:120% } TD.bg2 { color:white; background-color:#4040FF; font-size:110% } TD.bg3 { color:white; background-color:#8080FF; } TD.test_passed { color:blue; } TD.test_failed { color:red ; } TD.console { font-family:Courier New; }</STYLE> <BODY> <j:set var="spc" value="&amp;nbsp;&amp;nbsp;" /> <!-- GENERAL INFO --> <TABLE> <TR> <TD align="right"> <j:choose> <j:when test="${build.result=='SUCCESS'}"> <IMG SRC="${rooturl}static/e59dfe28/images/32x32/blue.gif" /> </j:when> <j:when test="${build.result=='FAILURE'}"> <IMG SRC="${rooturl}static/e59dfe28/images/32x32/red.gif" /> </j:when> <j:otherwise> <IMG SRC="${rooturl}static/e59dfe28/images/32x32/yellow.gif" /> </j:otherwise> </j:choose> </TD> <TD valign="center"> <B style="font-size: 200%;">BUILD ${build.result}</B> </TD> </TR> <TR> <TD>Build URL</TD> <TD> <A href="${rooturl}${build.url}">${rooturl}${build.url}</A> </TD> </TR> <TR> <TD>Project:</TD> <TD>${project.name}</TD> </TR> <TR> <TD>Date of build:</TD> <TD>${it.timestampString}</TD> </TR> <TR> <TD>Build duration:</TD> <TD>${build.durationString}</TD> </TR> <TR> <!-- BRANCH --> <TD>Subversion Repo:</TD> <TD>${build.scm}</TD> </TR> <tr> <td>Build Cause:</td> <td> <j:forEach var="cause" items="${build.causes}">${cause.shortDescription} </j:forEach> </td> </tr> </TABLE> <BR /> <!-- CHANGE SET --> <j:set var="changeSet" value="${build.changeSet}" /> <j:if test="${changeSet!=null}"> <j:set var="hadChanges" value="false" /> <TABLE width="100%"> <TR> <TD class="bg1" colspan="2"> <B>CHANGES</B> </TD> </TR> <j:forEach var="cs" items="${changeSet}" varStatus="loop"> <j:set var="hadChanges" value="true" /> <j:set var="aUser" value="${cs.hudsonUser}" /> <TR> <TD colspan="2" class="bg2">${spc}Revision <B>${cs.commitId?:cs.revision?:cs.changeNumber}</B>by <B>${aUser!=null?aUser.displayName:cs.author.displayName}:</B> <B>(${cs.msgAnnotated})</B></TD> </TR> <j:forEach var="p" items="${cs.affectedFiles}"> <TR> <TD width="10%">${spc}${p.editType.name}</TD> <TD>${p.path}</TD> </TR> </j:forEach> </j:forEach> <j:if test="${!hadChanges}"> <TR> <TD colspan="2">No Changes</TD> </TR> </j:if> </TABLE> <BR /> </j:if> <!-- ARTIFACTS --> <j:set var="artifacts" value="${build.artifacts}" /> <j:if test="${artifacts!=null and artifacts.size()&gt;0}"> <TABLE width="100%"> <TR> <TD class="bg1"> <B>BUILD ATRIFACTS</B> </TD> </TR> <TR> <TD> <j:forEach var="f" items="${artifacts}"> <li> <a href="${rooturl}${build.url}artifact/${f}">${f}</a> </li> </j:forEach> </TD> </TR> </TABLE> <BR /> </j:if> <!-- MAVEN ARTIFACTS --> <j:set var="mbuilds" value="${build.moduleBuilds}" /> <j:if test="${mbuilds!=null}"> <TABLE width="100%"> <TR> <TD class="bg1"> <B>BUILD ATRIFACTS</B> </TD> </TR> <j:forEach var="m" items="${mbuilds}"> <TR> <TD class="bg2"> <B>${m.key.displayName}</B> </TD> </TR> <j:forEach var="mvnbld" items="${m.value}"> <j:set var="artifacts" value="${mvnbld.artifacts}" /> <j:if test="${artifacts!=null and artifacts.size()&gt;0}"> <TR> <TD> <j:forEach var="f" items="${artifacts}"> <li> <a href="${rooturl}${mvnbld.url}artifact/${f}">${f}</a> </li> </j:forEach> </TD> </TR> </j:if> </j:forEach> </j:forEach> </TABLE> <BR /> </j:if> <!-- JUnit TEMPLATE --> <j:set var="junitResultList" value="${it.JUnitTestResult}" /> <j:if test="${junitResultList.isEmpty()!=true}"> <TABLE width="100%"> <TR> <TD class="bg1" colspan="2"> <B>${project.name} Functional Tests</B> </TD> </TR> <j:forEach var="junitResult" items="${it.JUnitTestResult}"> <j:forEach var="packageResult" items="${junitResult.getChildren()}"> <TR> <TD class="bg2" colspan="2">Name: ${packageResult.getName()} Failed: ${packageResult.getFailCount()} test(s), Passed: ${packageResult.getP assCount()} test(s), Skipped: ${packageResult.getSkipCount()} test(s), Total: ${packageResult.getPassCount()+packageResult.getFailCount()+packageResult.getSkipCount()} test(s)</TD> </TR> <j:forEach var="failed_test" items="${packageResult.getFailedTests()}"> <TR bgcolor="white"> <TD class="test_failed" colspan="2"> <B> <li>Failed: ${failed_test.getFullName()} <br /> <pre> ${failed_test.errorDetails} </pre></li> </B> </TD> </TR> <TR bgcolor="white"> <TD class="test_failed" colspan="2"> <B> <li>StackTrace: ${failed_test.getFullName()} <br /> <pre> ${failed_test.errorStackTrace} </pre></li> </B> </TD> </TR> </j:forEach> </j:forEach> </j:forEach> </TABLE> <BR /> </j:if> <!-- COBERTURA TEMPLATE --> <j:set var="coberturaAction" value="${it.coberturaAction}" /> <j:if test="${coberturaAction!=null}"> <j:set var="coberturaResult" value="${coberturaAction.result}" /> <j:if test="${coberturaResult!=null}"> <table width="100%"> <TD class="bg1" colspan="2"> <B>Cobertura Report</B> </TD> </table> <table width="100%"> <TD class="bg2" colspan="2"> <B>Project Coverage Summary</B> </TD> </table> <table border="1px" class="pane"> <tr> <td>Name</td> <j:forEach var="metric" items="${coberturaResult.metrics}"> <td>${metric.name}</td> </j:forEach> </tr> <tr> <td>${coberturaResult.name}</td> <j:forEach var="metric" items="${coberturaResult.metrics}"> <td data="${coberturaResult.getCoverage(metric).percentageFloat}">${coberturaResult.getCoverage(metric).percentage}% (${coberturaResult.ge tCoverage(metric)})</td> </j:forEach> </tr> </table> <j:if test="${coberturaResult.sourceCodeLevel}"> <h2>Source</h2> <j:choose> <j:when test="${coberturaResult.sourceFileAvailable}"> <div style="overflow-x:scroll;"> <table class="source"> <thead> <tr> <th colspan="3">${coberturaResult.relativeSourcePath}</th> </tr> </thead>${coberturaResult.sourceFileContent}</table> </div> </j:when> <j:otherwise> <p> <i>Source code is unavailable</i> </p> </j:otherwise> </j:choose> </j:if> <j:forEach var="element" items="${coberturaResult.childElements}"> <j:set var="childMetrics" value="${coberturaResult.getChildMetrics(element)}" /> <table width="100%"> <TD class="bg2" colspan="2">Coverage Breakdown by ${element.displayName}</TD> </table> <table border="1px" class="pane sortable"> <tr> <td>Name</td> <j:forEach var="metric" items="${childMetrics}"> <td>${metric.name}</td> </j:forEach> </tr> <j:forEach var="c" items="${coberturaResult.children}"> <j:set var="child" value="${coberturaResult.getChild(c)}" /> <tr> <td>${child.xmlTransform(child.name)}</td> <j:forEach var="metric" items="${childMetrics}"> <j:set var="childResult" value="${child.getCoverage(metric)}" /> <j:choose> <j:when test="${childResult!=null}"> <td data="${childResult.percentageFloat}">${childResult.percentage}% (${childResult})</td> </j:when> <j:otherwise> <td data="101">N/A</td> </j:otherwise> </j:choose> </j:forEach> </tr> </j:forEach> </table> </j:forEach> </j:if> <BR /> </j:if> <!-- HEALTH TEMPLATE --> <div class="content"> <j:set var="healthIconSize" value="16x16" /> <j:set var="healthReports" value="${project.buildHealthReports}" /> <j:if test="${healthReports!=null}"> <h1>Health Report</h1> <table> <tr> <th>W</th> <th>Description</th> <th>Score</th> </tr> <j:forEach var="healthReport" items="${healthReports}"> <tr> <td> <img src="${rooturl}${healthReport.getIconUrl(healthIconSize)}" /> </td> <td>${healthReport.description}</td> <td>${healthReport.score}</td> </tr> </j:forEach> </table> <br /> </j:if> </div> <!-- CONSOLE OUTPUT --> <j:getStatic var="resultFailure" field="FAILURE" className="hudson.model.Result" /> <j:if test="${build.result==resultFailure}"> <TABLE width="100%" cellpadding="0" cellspacing="0"> <TR> <TD class="bg1"> <B>CONSOLE OUTPUT</B> </TD> </TR> <j:forEach var="line" items="${build.getLog(100)}"> <TR> <TD class="console">${line}</TD> </TR> </j:forEach> </TABLE> <BR /> </j:if> </BODY> </j:jelly> <!-- BRANCH --> <TD>Subversion Repo:</TD> <TD>${build.scm}</TD> </TR> does not work, and i am not sure which argument to use with build object to get subversion url. outside jelly script, i can get the Subversion URL, using: Subversion URL: ${ENV, var="SVN_URL"}

    Read the article

  • DOM memory issue with IE8 (inserting lots of JSON data)

    - by okie.floyd
    i am developing a small web-utility that displays some data from some database tables. i have the utility running fine on FF, Safari, Chrome..., but the memory management on IE8 is horrendous. the largest JSON request I do will return information to create around 5,000 or so rows in a table within the browser (3 columns in the table). i'm using jquery to get the data (via getJSON). to remove the old/existing table, i'm just doing a $('#my_table_tbody').empty(). to add the new info to the table, within the getJSON callback, i am just appending each table row that i am creating to a variable, and then once i have them all, i am using $('#my_table_tbody').append(myVar) to add it to the existing tbody. i don't add the table rows as they are created because that seems to be a lot slower than just adding them all at once. does anyone have any recommendation on what someone should do who is trying to add thousands of rows of data to the DOM? i would like to stay away from pagination, but i'm wondering if i don't have a choice. Update 1 So here is the code I was trying after the innerHTML suggestion: /* Assuming a div called 'main_area' holds the table */ document.getElementById('main_area').innerHTML = ''; $.getJSON("my_server", {my: JSON, args: are, in: here}, function(j) { var mylength = j.length; var k =0; var tmpText = ''; tmpText += /* Add the table, thead stuff, and tbody tags here */; for (k = mylength - 1; k = 0; k--) { /* stack overflow wont let me type greater than & less than signs here, so just assume that they are there. */ tmpText += 'tr class="' + j[k].row_class . '" td class="col1_class" ' + j[k].col1 + ' /td td class="col2_class" ' + j[k].col2 + ' /td td class="col3_class" ' + j[k].col3 + ' /td /tr'; } document.getElementById('main_area').innerHTML = tmpText; } That is the gist of it. I've also tried using just a $.get request, and having the server send the formatted HTML, and just setting that in the innerHTML (i.e. document.getElementById('main_area').innerHTML = j;). thanks for all of the replies. i'm floored with the fact that you all are willing to help.

    Read the article

< Previous Page | 4 5 6 7 8 9  | Next Page >