Search Results

Search found 3286 results on 132 pages for 'arthur br'.

Page 18/132 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Fun things you can do by mutating Java strings

    - by polygenelubricants
    So I've come around since I asked how to limit setAccessible to only “legitimate” uses and have come to embrace its power for fun. Enabled by its power, of course, is string mutation. import java.lang.reflect.Field; public class Mutator { static void mutate(Object obj, String field, Object newValue) { try { Field f = obj.getClass().getDeclaredField(field); f.setAccessible(true); f.set(obj, newValue); } catch (Exception e) { } } public static void mutate(String from, String to) { mutate(from, "value", to.toCharArray()); mutate(from, "count", to.length()); } public static void main(String args[]) { Mutator.mutate(System.getProperty("line.separator"), "<br/>\n"); System.out.println("Hello world!"); Mutator.mutate(Integer.toString(Integer.MIN_VALUE), "OMG!"); System.out.println(-2147483648); Mutator.mutate(String.valueOf((Object) null), "LOL!"); System.out.println(Arrays.toString(new int[3][])); Mutator.mutate(Arrays.toString(new int[0]), ":("); System.out.println(Arrays.toString(new byte[0])); } } Output (if no exception is thrown): Hello world!<br/> OMG!<br/> [LOL!, LOL!, LOL!]<br/> :(<br/> Let's see what other fun things we can come up with.

    Read the article

  • Can't get Zend Studio and PHPunit to work together

    - by dimbo
    I have a created a simple doctrine2/zend skeleton project and am trying to get unit testing working with zend studio. The tests work perfectly through the PHPunit CLI but I just can't get them to work in zend studio. It comes up with an error saying : 'No Tests was executed' and the following output in the debug window : X-Powered-By: PHP/5.2.14 ZendServer/5.0 Set-Cookie: ZendDebuggerCookie=127.0.0.1%3A10137%3A0||084|77742D65|1016; path=/ Content-type: text/html <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/var/www/z2d2/tests/application/models/UserModelTest.php</b> on line <b>8</b><br /> <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/var/www/z2d2/tests/application/models/UserModelTest.php</b> on line <b>8</b><br /> <br /> <b>Parse error</b>: syntax error, unexpected T_STRING in <b>/var/www/z2d2/tests/application/models/UserModelTest.php</b> on line <b>8</b><br /> The test is as follows: <?php require_once 'Zend/Application.php'; require_once 'Zend/Test/PHPUnit/ControllerTestCase.php'; abstract class ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase { public function setUp() { $this->bootstrap = new Zend_Application( 'testing', APPLICATION_PATH . '/configs/application.ini' ); parent::setUp(); } public function tearDown() { parent::tearDown(); } } <?php class IndexControllerTest extends ControllerTestCase { public function testDoesHomePageExist() { $this->dispatch('/'); $this->assertController('index'); $this->assertAction('index'); } } <?php class ModelTestCase extends PHPUnit_Framework_TestCase { protected $em; public function setUp() { $application = new Zend_Application( 'testing', APPLICATION_PATH . '/configs/application.ini' ); $bootstrap = $application->bootstrap()->getBootstrap(); $this->em = $bootstrap->getResource('entityManager'); parent::setUp(); } public function tearDown() { parent::tearDown(); } } <?php class UserModelTest extends ModelTestCase { public function testCanInstantiateUser() { $this->assertInstanceOf('\Entities\User', new \Entities\User); } public function testCanSaveAndRetrieveUser() { $user = new \Entities\User; $user->setFirstname('wjgilmore-test'); $user->setemail('[email protected]'); $user->setpassword('jason'); $user->setAddress1('calle san antonio'); $user->setAddress2('albayzin'); $user->setSurname('testman'); $user->setConfirmed(TRUE); $this->em->persist($user); $this->em->flush(); $user = $this->em->getRepository('Entities\User')->findOneByFirstname('wjgilmore-test'); $this->assertEquals('wjgilmore-test', $user->getFirstname()); } public function testCanDeleteUser() { $user = new \Entities\User; $user = $this->em->getRepository('Entities\User')->findOneByFirstname('wjgilmore-test'); $this->em->remove($user); $this->em->flush(); } } And the bootstrap: <?php define('BASE_PATH', realpath(dirname(__FILE__) . '/../../')); define('APPLICATION_PATH', BASE_PATH . '/application'); set_include_path( '.' . PATH_SEPARATOR . BASE_PATH . '/library' . PATH_SEPARATOR . get_include_path() ); require_once 'controllers/ControllerTestCase.php'; require_once 'models/ModelTestCase.php'; Here is the new error after setting PHP Executable to 5.3 as Gordon suggested: X-Powered-By: PHP/5.3.3 ZendServer/5.0 Set-Cookie: ZendDebuggerCookie=127.0.0.1%3A10137%3A0||084|77742D65|1000; path=/ Content-type: text/html <br /> <b>Fatal error</b>: Class 'ModelTestCase' not found in <b>/var/www/z2d2/tests/application/models/UserModelTest.php</b> on line <b>4</b><br />

    Read the article

  • django url user id versus userprofile id problem

    - by dana
    hello there, i have a mini comunity where each user can search and find another user profile. Userprofile is a class model, indexed differently compared to user model class (user id is not equal to userprofile id) But i cannot see a user profile by typing in the url the corresponding id. I only see the profile of the currently logged in user. Why is that? I'd also want to have in my url the username (a primary key of the user table also) and NOT the id (a number). The guilty part of the code is: what can i replace that request.user with so that it wil actually display the user i searched for, and not the currently logged in? def profile_view(request, id): u = UserProfile.objects.get(pk=id) cv = UserProfile.objects.filter(created_by = request.user) blog = New.objects.filter(created_by = request.user) return render_to_response('profile/publicProfile.html', { 'u':u, 'cv':cv, 'blog':blog, }, context_instance=RequestContext(request)) in urls (of the accounts app): url(r'^profile_view/(?P<id>\d+)/$', profile_view, name='profile_view'), and in template: <h3>Recent Entries:</h3> {% load pagination_tags %} {% autopaginate list 10 %} {% paginate %} {% for object in list %} <li>{{ object.post }} <br /> Voted: {{ vote.count }} times.<br /> {% for reply in object.reply_set.all %} {{ reply.reply }} <br /> {% endfor %} <a href=''> {{ object.created_by }}</a> <br /> {{object.date}} <br /> <a href = "/vote/save_vote/{{object.id}}/">Vote this</a> <a href="/replies/save_reply/{{object.id}}/">Comment</a> </li> {% endfor %} thanks in advance!

    Read the article

  • Problem with ajax form on Codeigniter

    - by Code Burn
    Everytime I test the email is send correctly. (I have tested in PC: IE6, IE7, IE8, Safari, Firefox, Chrome. MAC: Safari, Firefox, Chrome.) Nome: Jon Doe Empresa: Star Cargo: Developer Email: [email protected] Telefone: 090909222988 Assunto: Subject here.. But I keep recieving emails like this from costumers: Nome: Empresa: Cargo: Email: Telefone: Assunto: CONTACT_FORM.PHP <form name="frm" id="frm"> <div class="campoFormulario nomeDeCampo texto textocinzaescuro" >Nome<font style="color:#EE3063;">*</font></div> <div class="campoFormulario inputDeCampo" ><input class="texto textocinzaescuro" size="31" name="Cnome" id="Cnome" value=""/></div> <div class="campoFormulario nomeDeCampo texto textocinzaescuro" >Empresa<font style="color:#EE3063;">*</font></div> <div class="campoFormulario inputDeCampo" ><input class="texto textocinzaescuro" size="31" name="CEmpresa" id="CEmpresa" value=""/></div> <div class="campoFormulario nomeDeCampo texto textocinzaescuro" >Cargo</div> <div class="campoFormulario inputDeCampo" ><input class="texto textocinzaescuro" size="31" name="CCargo" id="CCargo" value=""/></div> <div class="campoFormulario nomeDeCampo texto textocinzaescuro" >Email<font style="color:#EE3063;">*</font></div> <div class="campoFormulario inputDeCampo" ><input class="texto textocinzaescuro" size="31" name="CEmail" id="CEmail" value=""/></div> <div class="campoFormulario nomeDeCampo texto textocinzaescuro" >Telefone</div> <div class="campoFormulario inputDeCampo" ><input class="texto textocinzaescuro" size="31" name="CTelefone" id="CTelefone" value=""/></div> <div class="campoFormulario nomeDeCampo texto textocinzaescuro" >Assunto<font style="color:#EE3063;">*</font></div> <div class="campoFormulario inputDeCampo" ><textarea class="texto textocinzaescuro" name="CAssunto" id="CAssunto" rows="2" cols="28"></textarea></div> <div class="campoFormulario nomeDeCampo texto textocinzaescuro" >&nbsp;</div> <div class="campoFormulario inputDeCampo" style="text-align:right;" ><input id="Cbutton" class="texto textocinzaescuro" type="submit" name="submit" value="Enviar" /></div> </form> <script type="text/javascript"> $(function() { $("#Cbutton").click(function() { if(validarForm()){ var Cnome = $("input#Cnome").val(); var CEmpresa = $("input#CEmpresa").val(); var CEmail = $("input#CEmail").val(); var CCargo = $("input#CCargo").val(); var CTelefone = $("input#CTelefone").val(); var CAssunto = $("textarea#CAssunto").val(); var dataString = 'nome='+ Cnome + '&Empresa=' + CEmpresa + '&Email=' + CEmail + '&Cargo=' + CCargo + '&Telefone=' + CTelefone + '&Assunto=' + CAssunto; //alert (dataString);return false; $.ajax({ type: "POST", url: "http://www.myserver.com/index.php/pt/envia", data: dataString, success: function() { $('#frm').remove(); $('#blocoform').append("<br />Obrigado. <img id='checkmark' src='http://www.myserver.com/public/images/estrutura/ok.gif' /><br />Será contactado brevemente.<br /><br /><br /><br /><br /><br />") .hide() .fadeIn(1500); } }); } return false; }); }); function validarForm(){ var error = 0; if(!validateNome(document.getElementById("Cnome"))){ error = 1 ;} if(!validateNome(document.getElementById("CEmpresa"))){ error = 1 ;} if(!validateEmail(document.getElementById("CEmail"))){ error = 1 ;} if(!validateNome(document.getElementById("CAssunto"))){ error = 1 ;} if(error == 0){ //frm.submit(); return true; }else{ alert('Preencha os campos correctamente.'); return false; } } function validateNome(fld){ if( fld.value.length == 0 ){ fld.style.backgroundColor = '#FFFFCC'; //alert('Descrição é um campo obrigatório.'); return false; }else { fld.style.background = 'White'; return true; } } function trim(s) { return s.replace(/^\s+|\s+$/, ''); } function validateEmail(fld) { var tfld = trim(fld.value); var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ; var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ; if (fld.value == "") { fld.style.background = '#FFFFCC'; //alert('Email é um campo obrigatório.'); return false; } else if (!emailFilter.test(tfld)) { //alert('Email inválido.'); fld.style.background = '#FFFFCC'; return false; } else if (fld.value.match(illegalChars)) { fld.style.background = '#FFFFCC'; //alert('Email inválido.'); return false; } else { fld.style.background = 'White'; return true; } } </script> FUNCTION ENVIA (email sender): function envia() { $this->load->helper(array('form', 'url')); $nome = $_POST['nome']; $empresa = $_POST['Empresa']; $cargo = $_POST['Cargo']; $email = $_POST['Email']; $telefone = $_POST['Telefone']; $assunto = $_POST['Assunto']; $mensagem = " Nome:".$nome." Empresa:".$empresa." Cargo:".$cargo." Email:".$email." Telefone:".$telefone." Assunto:".$assunto.""; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: no-reply' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail('[email protected]', $mensagem, $headers); }

    Read the article

  • Aligning a formtable with button

    - by Hulk
    In the below code how to align the the print button next to the table and not below or above it. <div id="content"> <form action="Empform" method="post" name="emp"> <tr><th>Name</t></tr> <tr><td></td></tr> </table> <br> <br> <label>Comments: </label> <br> <textarea rows=10 cols=75></textarea> </form> <input type="button" value="Copy" id="print" onclick="javascript:copy();" style="display:inline;/> <br> </div> Thanks..

    Read the article

  • Many DIVs inside parent DIV, CSS height issue

    - by Benjamin
    Hi everyone, I am putting together a dynamic photo gallery and getting stuck trying to place thumbnails. Basically I am trying to place each thumbnail and caption in its own DIV, floated to the left. The thumbnails are working just as I want them to but for some reason the parent DIV refuses to cover the height of the thumbnail area. Here is the CSS I am using.. #galleryBox { width: 650px; background: #fff; margin: auto; padding: 5px; text-align: center; } .item { display: block; margin: 10px; padding: 10px; float: left; background: #353535; min-width: 120px; } .label { display: block; color: #fff; } I have tried height: auto and that hasn't done anything. Here is what I am trying to style: <div id="galleryBox" class="ui-corner-all"> <div class="item ui-corner-all"> <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/> <p><span class="label">Testing</span></p> </div> <div class="item ui-corner-all"> <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/> <p><span class="label">Testing</span></p> </div> <div class="item ui-corner-all"> <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/> <p><span class="label">Testing</span></p> </div> <div class="item ui-corner-all"> <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/> <p><span class="label">Testing</span></p> </div> <div class="item ui-corner-all"> <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/> <p><span class="label">Testing</span></p> </div> <div class="item ui-corner-all"> <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/> <p><span class="label">Testing</span></p> </div> <div class="item ui-corner-all"> <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/> <p><span class="label">Testing</span></p> </div> </div> Thanks!

    Read the article

  • Java InputReader. Detect if file being read is binary?

    - by Trizicus
    I had posted a question in regards to this code. I found that JTextArea does not support the binary type data that is loaded. So my new question is how can I go about detecting the 'bad' file and canceling the file I/O and telling the user that they need to select a new file? class Open extends SwingWorker<Void, String> { File file; JTextArea jta; Open(File file, JTextArea jta) { this.file = file; this.jta = jta; } @Override protected Void doInBackground() throws Exception { BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); String line = br.readLine(); while(line != null) { publish(line); line = br.readLine(); } } finally { try { br.close(); } catch (IOException e) { } } return null; } @Override protected void process(List<String> chunks) { for(String s : chunks) jta.append(s + "\n"); } }

    Read the article

  • Why does this JSON.parse code not work?

    - by SuZi
    I am trying to pass json encoded values from a php script to a, GnuBookTest.js, javascript file that initiates a Bookreader object and use the values i have passed in via the variable i named "result". The php script is sending the values like: <div id="bookreader"> <div id="BookReader" style="left:10px; right:10px; top:30px; bottom:30px;">x</div> <script type="text/javascript">var result = {"istack":"zi94sm65\/BUCY\/BUCY200707170530PM","leafCount":"14","wArr":"[893,893,893,893,893,893,893,893,893,893,893,893,893,893]","hArr":"[1155,1155,1155,1155,1155,1155,1155,1155,1155,1155,1155,1155,1155,1155]","leafArr":"[0,1,2,3,4,5,6,7,8,9,10,11,12,13]","sd":"[\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\"]"}</script> <script type="text/javascript" src="http://localhost:8080/application/js/GnuBookTest.js"></script> </div> </div> and in the GnuBookTest.js file i am trying to use the values like: br = new BookReader(); // Return the width of a given page. br.getPageWidth = function(index) { return this.pageW[index]; } // Return the height of a given page. br.getPageHeight = function(index) { return this.pageH[index]; } br.pageW = JSON.parse(result.wArr); br.pageH = JSON.parse(result.hArr); br.leafMap = JSON.parse(result.leafArr); //istack is an url fragment for location of image files var istack = result.istack; . . . Using JSON.parse as i have written it above loads the Bookreader and uses my values correctly in a few web-browsers: Firefox, IE8, and desktop-Safari; but does not work at all in mac-Chrome, mobile-Safari, plus older versions of IE. Mobile safari keeps giving me a reference error msg: can't find variable: JSON. The other browsers just do not load the Bookreader and show the "x" instead, like they did not get the values from the php script. Where is the problem?

    Read the article

  • How to use Profile in asp.net?

    - by Phsika
    i try to learn asp.net Profile management. But i added below xml firstName,LastName and others. But i cannot write Profile. if i try to write Profile property. drow my editor Profile : Error 1 The name 'Profile' does not exist in the current context C:\Documents and Settings\ykaratoprak\Desktop\Security\WebApp_profile\WebApp_profile\Default.aspx.cs 18 13 WebApp_profile How can i do that? <authentication mode="Windows"/> <profile> <properties> <add name="FirstName"/> <add name="LastName"/> <add name="Age"/> <add name="City"/> </properties> </profile> protected void Button1_Click(object sender, System.EventArgs e) { Profile.FirstName = TextBox1.Text; Profile.LastName = TextBox2.Text; Profile.Age = TextBox3.Text; Profile.City = TextBox4.Text; Label1.Text = "Profile stored successfully!<br />" + "<br />First Name: " + Profile.FirstName + "<br />Last Name: " + Profile.LastName + "<br />Age: " + Profile.Age + "<br />City: " + Profile.City; }

    Read the article

  • Different between &$DataRow and $DataRow

    - by KoolKabin
    hi guys, I am confused from the result of the following code: I can't get my expected result: $arrX = array('a'=>array('val'=>10),'b'=>array('val'=>20), 'c'=>array('val'=>30)); foreach( $arrX as &$DataRow ) { $DataRow['val'] = $DataRow['val'] + 20; } foreach( $arrX as $DataRow ) { echo '<br />val: '.$DataRow['val'].'<br/>'; } Output: 30, 40, 40 Expected: 30, 40, 50 But again if i make small chage it works fine, $arrX = array('a'=>array('val'=>10),'b'=>array('val'=>20), 'c'=>array('val'=>30)); foreach( $arrX as &$DataRow ) { $DataRow['val'] = $DataRow['val'] + 20; } foreach( $arrX as &$DataRow ) { echo '<br />val: '.$DataRow['val'].'<br/>'; }

    Read the article

  • Ruby on Rails check box not updating on form submission

    - by user284194
    I have an entries controller that allows users to add contact information the website. The user-submitted information isn't visible to users until the administrator checks a check box and submits the form. So basically my problem is that if I check the check box as an administrator while initially creating an entry (entries#new) the entry will be publicly visible as expected, but if a non-admin user creates an entry (the normal user view doesn't include the 'live' check box, only the admin one does) then that entry is stuck in limbo because the entries#edit view for some reason doesn't update the boolean check box value when logged in as an admin. entries#new view: <% form_for(@entry) do |f| %> <%= f.error_messages %> Name<br /> <%= f.text_field :name %> Mailing Address<br /> <%= f.text_field :address %> #... <%- if current_user -%> <%= f.label :live %><br /> <%= f.check_box :live %> <%- end -%> <%= f.submit 'Create' %> <% end %> entries#edit (only accessible by admin) view: <% form_for(@entry) do |f| %> <%= f.error_messages %> <%= f.label :name %><br /> <%= f.text_field :name %> Mailing Address<br /> <%= f.text_field :address %> <%= f.label :live %><br /> <%= f.check_box :live %> <%= f.submit 'Update' %> <% end %> Any ideas as to why an administrator can't update the :live check box from the edit view? I would greatly appreciate any suggestions. I'm new to rails. I can post more code if it's needed. Thanks for reading my question.

    Read the article

  • Accessing Content Page elements

    - by Abdel Olakara
    Hi all, I am facing a strange problem.. may be i am overlooking something and not able to find the silly issue. Need your help! I have a Master page and a Content Page: <form id="AccountForm" runat="server"> <div> <asp:ContentPlaceHolder ID="MenuHolder" runat="server"> </asp:ContentPlaceHolder> </div> <hr /> <div> <asp:ContentPlaceHolder ID="ContentHolder" runat="server"> </asp:ContentPlaceHolder> </div> And my content page has some form elements: <asp:Content ID="Content3" ContentPlaceHolderID="ContentHolder" runat="server"> First Name: <asp:TextBox ID="fName" runat="server"></asp:TextBox> <br /> Middle Name: <asp:TextBox ID="mName" runat="server"></asp:TextBox> <br /> Family Name: <asp:TextBox ID="lName" runat="server"></asp:TextBox> <br /> Birthday: <asp:TextBox ID="birthday" runat="server"></asp:TextBox> <br /> Mobile Phone: <asp:TextBox ID="mobile" runat="server"></asp:TextBox> <br /> Alternate Phone: <asp:TextBox ID="phone" runat="server"></asp:TextBox> <br /> I also have the code for submit button in the content page where i try to retrieve the values from the form elements and persist it into DB. Here is the SubmitButton_Click code: protected void SubmitButton_Click(object sender, EventArgs e) { log.Info("From Submit button: " + customerObject.first_name + " " + customerObject.family_name); if (fName != null) log.Info("First Name is not null"); log.Info("First Name:" + fName.Text); log.Info("Middle Name:" + mName.Text); log.Info("Family Name:" + fName.Text); log.Info("Mobile:" + mobile.Text); log.Info("Phone: " + phone.Text); log.Info("Address:" + bAddressL1.Text + bAddressL2.Text); Strangly.. i don't get any data that is filled into my text fields? Their objects are not null as well!! why is this behaviour happening? I am not trying to access elements in master page or other.. all the fields are in the content page.. only thing is there is no form element in the content page and the form element is in master page! Thanks in advance for your suggestions and answers. Abdel Raoof Olakara

    Read the article

  • How can I show a div, then hide the other divs when a link is clicked?

    - by Abriel
    I am right now trying to hide six divs while showing only one of the divs. I've tried JavaScript and in jQuery, but nothing seems to work! Click here to get to the website. I would like to know if it has to do with my CSS, jQuery, or the HTML. Or is there an easier way of doing this? HTML: <div id="resourceLinks"> <a href="#" name="resource" id="resource1">General&nbsp;Information</a><br /> <a href="#" name="resource" id="resource2">Automatic&nbsp;401(k)</a><br /> <a href="#" name="resource" id="resource3">Consumer&nbsp;Fraud</a><br /> <a href="#" name="resource" id="resource4">Direct&nbsp;Deposit</a><br /> <a href="#" name="resource" id="resource5">Diversity</a><br /> <a href="#" name="resource" id="resource6">Women</a><br /> <a href="#" name="resource" id="resource7">Young&nbsp;Adults&nbsp;(20s&nbsp;-&nbsp;40s)</a> </div> <div id="resource1></div> <div id="resource2></div> <div id="resource3></div> <div id="resource4></div> <div id="resource5></div> <div id="resource6></div> <div id="resource7></div> CSS: #resource1, #resource2, #resource3, #resource4, #resource5, #resource6, #resource7 { position: absolute; margin-left: 400px; margin-top: -10px; width: 300px; padding-bottom: 120px; } #resourceLinks { position: fixed; margin-left: -450px; z-index: 3; margin-top: 180px; font-size: 16px; } jQuery: $(document).ready(function(){ $('#resourceLinks a').click(function (selected) { var getName = $(this).attr("id"); var projectImages = $(this).attr("name"); $(function() { $(".resource").hide().removeClass("current"); $("#" + projectImages ).show("normal").addClass("current"); }); }); });

    Read the article

  • Javascript - dynamically add input fields

    - by Neeraj
    Hi Guys, I have a code to add input fields dynamically in js. But the problem is if i add 3 fields or more and then browse a file(if the input field is file), the value of the field selected disappears. Can any one help Heres my code Thanks in advance. :) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script type="text/javascript"> <!-- Begin /* This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com Created by: Husay :: http://www.communitxt.net */ var arrInput = new Array(0); var arrInputValue = new Array(0); fields = 1; maxInput = 4; function addInput() { //arrInput.push(createInput(arrInput.length)); if(fields <= maxInput){ fields +=1; arrInput.push(arrInput.length); //arrInputValue.push(arrInputValue.length); arrInputValue.push(""); display(); } } function display() { document.getElementById('parah').innerHTML=""; for (intI=0;intI<arrInput.length;intI++) { document.getElementById('parah').innerHTML+=createInput(arrInput[intI], arrInputValue[intI]); } } function saveValue(intId,strValue) { arrInputValue[intId]=strValue; } function createInput(id,value) { return "<input type='file' id='test "+ id +"' onChange='javascript:saveValue("+ id +",this.value)' value='"+ value +"'><br>"; } function deleteInput() { if (arrInput.length > 0) { fields -=1; arrInput.pop(); arrInputValue.pop(); } display(); } // End --> </script> </head> <body> <a href="javascript:addInput()">Add more input field(s)</a><br> <a href="javascript:deleteInput()">Remove field(s)</a><br> <input type="file" /><br> <input type="file" /><br> <input type="file" /><br> <p id="parah"></p> </body> </html>

    Read the article

  • Cannot send email in ASP.NET through Godaddy servers.

    - by Jared
    I have an ASP.NET application hosted on Godaddy that I want to send email from. When it runs, I get: Mailbox name not allowed. The server response was: sorry, relaying denied from your location. The important parts of the code and Web.config are below: msg = new MailMessage("[email protected]", email); msg.Subject = "GreekTools Registration"; msg.Body = "You have been invited by your organization to register for the GreekTools recruitment application.<br/><br/>" + url + "<br/><br/>" + "Sincerely,<br/>" + "The GreekTools Team"; msg.IsBodyHtml = true; client = new SmtpClient(); client.Host = "relay-hosting.secureserver.net"; client.Send(msg); <system.net> <mailSettings> <smtp from="[email protected]"> <network host="relay-hosting.secureserver.net" port="25" userName="********" password="*********" /> </smtp> </mailSettings>

    Read the article

  • How do I write this MySQL query?

    - by CT
    I am working on an Asset DB using a lamp stack. In this example consider the following 5 tables: asset, server, laptop, desktop, software All tables have a primary key of id, which is a unique asset id. Every object has all asset attributes and then depending on type of asset has additional attributes in the corresponding table. If the type is a server, desktop or laptop it also has items in the software table. Here are the table create statements: // connect to mysql server and database "asset_db" mysql_connect("localhost", "asset_db", "asset_db") or die(mysql_error()); mysql_select_db("asset_db") or die(mysql_error()); // create asset table mysql_query("CREATE TABLE asset( id VARCHAR(50) PRIMARY KEY, company VARCHAR(50), location VARCHAR(50), purchase_date VARCHAR(50), purchase_order VARCHAR(50), value VARCHAR(50), type VARCHAR(50), notes VARCHAR(200))") or die(mysql_error()); echo "Asset Table Created.</br />"; // create software table mysql_query("CREATE TABLE software( id VARCHAR(50) PRIMARY KEY, software VARCHAR(50), license VARCHAR(50))") or die(mysql_error()); echo "Software Table Created.</br />"; // create laptop table mysql_query("CREATE TABLE laptop( id VARCHAR(50) PRIMARY KEY, manufacturer VARCHAR(50), model VARCHAR(50), serial_number VARCHAR(50), esc VARCHAR(50), user VARCHAR(50), prev_user VARCHAR(50), warranty VARCHAR(50))") or die(mysql_error()); echo "Laptop Table Created.</br />"; // create desktop table mysql_query("CREATE TABLE desktop( id VARCHAR(50) PRIMARY KEY, manufacturer VARCHAR(50), model VARCHAR(50), serial_number VARCHAR(50), esc VARCHAR(50), user VARCHAR(50), prev_user VARCHAR(50), warranty VARCHAR(50))") or die(mysql_error()); echo "Desktop Table Created.</br />"; // create server table mysql_query("CREATE TABLE server( id VARCHAR(50) PRIMARY KEY, manufacturer VARCHAR(50), model VARCHAR(50), warranty VARCHAR(50))") or die(mysql_error()); echo "Server Table Created.</br />"; ?> How do I query the database so that if I search by id, I receive all related fields to that asset id? Thank you.

    Read the article

  • How to use JQuery to focus on a specific DIV tag?

    - by kwokwai
    Hi all, Say I got a few DIV tags in a HTML page like: <DIV ID="div1"> <Input type="radio" name="data['site1']['user']" VALUE="1">user1<br/> </DIV> <DIV ID="div2"> <Input type="radio" name="data['site1']['user']" VALUE="2">user2<br/> </DIV> <DIV ID="div3"> <Input type="radio" name="data['site1']['user']" VALUE="3">user3<br/> </DIV> <DIV ID="div4"> <Input type="radio" name="data['site1']['user']" VALUE="4">user4<br/> </DIV> Is it possible to do the same effect in JQuery like this: Document.getElementByID('div2').focus();

    Read the article

  • Regex with dynamic <textarea>

    - by Oscar Godson
    How can I do this with the JS replace() method: Make \n\n change to <p>$1</p> Change single \n to <br> Then back again. I think I have this part, see the JS at the bottom. Example HTML: <p>Hello</p><p>Wor<br>ld</p> The <textarea> would look like: Hello Wor ld So, how can I achieve this? It's an AJAX form where when you click on this div it changes to a <textarea> and back, and fourth, etc. So, I need to it to go from <p>s and <br>s to \n\n and \n. For the going to <textarea> from HTML I have: $(this).html().replace(/\s?<\/?(p|br\s?\/?)>\s?/g,"\n")

    Read the article

  • appendTo() inside $.each in jquery seems to cause flicker....

    - by Pandiya Chendur
    appendTo() causes flicker when it is inside $.each.... $.each(jsob.Table, function(i, employee) { $('<div class="resultsdiv"><br /><span class="resultName">' + employee.Emp_Name + '</span><span class="resultfields" style="padding-left:100px;">Category&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Desig_Name + '</span><br /><br /><span id="SalaryBasis" class="resultfields">Salary Basis&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.SalaryBasis + '</span><span class="resultfields" style="padding-left:25px;">Salary&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.FixedSalary + '</span><span style="font-size:110%;font-weight:bolder;padding-left:25px;">Address&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Address + '</span></div>').appendTo('#ResultsDiv'); }); Right now i am appending every new div to #ResultsDiv inside$.each is it good/bad to do so... If it is bad What can be done to make my divs appendTo() after the loop so that i it wont flicker.... EDIT:(based on answer) var divs = ''; $.each(jsob.Table, function(i, employee) { divs += '<div class="resultsdiv"><br /><span class="resultName">' + employee.Emp_Name + '</span><span class="resultfields" style="padding-left:100px;">Category&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Desig_Name + '</span><br /><br /><span id="SalaryBasis" class="resultfields">Salary Basis&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.SalaryBasis + '</span><span class="resultfields" style="padding-left:25px;">Salary&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.FixedSalary + '</span><span style="font-size:110%;font-weight:bolder;padding-left:25px;">Address&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Address + '</span></div>'; }); $("#ResultsDiv").append(divs); But that too doesn't stop the flicker...

    Read the article

  • How to get the values from post method to the codehind file

    - by SmartestVEGA
    I have created a Webpage which will post as "post" method..not as "get" method. <html> <head> </head> <body> <FORM action="RetrieveData_Post.asp" id=form1 method=post name=form1> First Name: <br> <INPUT id="txtFirstName" name="txtFirstName" > <br> Last Name: <br> <INPUT id="txtLastName" name="txtLastName" > <br> <INPUT type="submit" value="Submit"> </FORM> </body> </html> i want to retieve the values in the textboxes in the code behind of another form. Please help me.

    Read the article

  • Uploading a file fails under WordPress

    - by Ash
    I'm using WordPress and I'm following W3's guide for uploading a file: HTML code: <html> <body> <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> PHP code (upload_file.php): <?php if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; } ?> The HTML code is pasted in a PHP page template and the PHP file under the WP installation directory under www. The problem is when I submit the file I get Error: 1. If I remark the "if" part of the PHP code and leave the "else" part I get: Upload: IMG_4258.JPG Type: Size: 0 Kb Stored in: So at least I know the PHP code is running. But what's causing it to fail? Is there a problem with the code or is WordPress meddling with the process?

    Read the article

  • Convert inline image tags like [image:123:title:size] into HTML img tags

    - by Jacques Joubert
    I am looking for help with regular expression $pattern to convert inline image tags like [image:123:title:size] into HTML img tags. here is the code: //[image:ID:caption:size] $content = '[image:38:title:800x900]'; preg_match_all( '/\[image:(\d+)(:?)([^\]]*)\]/i', $content, $images ); if( !empty( $images[0] ) ) { // There are image inline tags in the content foreach( $images[0] as $i => $tag ) { $link_ID = (int)$images[1][$i]; $caption = empty( $images[2][$i] ) ? '#' : $images[3][$i]; $size = empty( $images[4][$i] ) ? '#' : $images[4][$i]; } echo '<br />'; echo 'ID: '.$link_ID.'<br />'; echo 'Tag: '.$caption.'<br />'; echo 'size: '.$size.'<br />'; } which outputs: ID: 12 Tag: caption:size size: # Any help would be great!

    Read the article

  • Send html array as post variable using Request.JSON

    - by ian
    I have an html: First name: <input type='text' name='first_name' value='' /><br/> Last name: <input type='text' name='last_name' value='' /><br/> <input type='checkbox' name='category[]' value='Math' /> Math<br/> <input type='checkbox' name='category[]' value='Science' /> Science<br/> <input type='checkbox' name='category[]' value='History' /> History<br/> etc..... I want to send(using post method) the selected categories(category[]) via mootools ajax so that if I dump the $_POST variable in the server I will get something like: array(1) { [category]=> array(2) { [0]=> string(4) "Math" [1]=> string(7) "History" } } What should be the javascript(mootools) code for it? Below is my partial code. new Request.JSON({url: '/ajax_url', onSuccess: function(){ alert('success'); } }).post(???); Note that I don't want to send first_name and last_name fields. I only want to send the category field which is an html array.

    Read the article

  • How can I keep data that a user has entered in my jQuery/Ajax pop-up form?

    - by Lucas McCoy
    I have a form on a website I'm working (you can see it here) on that allows my users to give feedback. It's an jQuery/Ajax popup form: $('.contact_us').click(function(){ var boxy_content; boxy_content += "<div style=\"width:300px; height:300px \"><form id=\"feedbacked\">"; boxy_content += "<p>Subject<br /><input type=\"text\" name=\"subject\" id=\"subject\" size=\"33\" /></p><p>Your E-Mail Address:<br /><input type=\"text\" name=\"your_email\" size=\"33\" /></p><p>Comment:<br /><textarea name=\"comment\" id=\"comment\" cols=\"33\" rows=\"5\"></textarea></p><br /><input type=\"submit\" name=\"submit\" value=\"Send >>\" />"; boxy_content += "</form></div>"; // Other code here... Is there anyway I can save what the user has entered (in case they see our error message when they try to submit)?

    Read the article

  • Iterate set covered by cross-product of ranges in ruby

    - by wilsona
    I figured this answer had been asked before, so I searched, but I couldn't find anything. Granted, there are a ton of Ruby Array questions, so it might be there, just buried. In any case, I'm trying to reduce a cross-product of ranges, returning a sum of all elements of the cross-product that meet some set of conditions. To construct a trivial example, if I have an array like this: [0..1,0..1,0..1] I'd like to iterate over this set: [ [0,0,0], [0,0,1], [0,1,0], [0,1,1], [1,0,0], [1,0,1], [1,1,0], [1,1,1] ] and return a sum based the condition "return 1 if i[0] == 1 and i[2] == 0" (which would give 2). In my contrived example, I could do it like this: br = 0..1 br.reduce(0){|sumx, x| sumx + br.reduce(0){|sumy, y| sumy + br.reduce(0){|sumz, z| sumz + (x == 1 and z == 0 ? 1 : 0) } } } , but in the actual application, the set of ranges might be much larger, and nesting reduces that way would get quite ugly. Is there a better way?

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >