Search Results

Search found 14182 results on 568 pages for 'andrew answer'.

Page 25/568 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • BASH tr command

    - by user1457809
    Id like to convert it to uppercase for the simple purpose of formatting so it will adhere to a future case statement. As I thought case statements are case sensitive. I see all over the place the tr command used in concert with echo commands to give you immediate results such as: echo "Enter in Location (i.e. SDD-134)" read answer (user enters "cfg" echo $answer | tr '[:lower:]' '[:upper:]' which produced cfg # first echo not upper? echo $answer #echo it again and it is now upper... CFG

    Read the article

  • Finding substring of a word found in joining a string from another string

    - by 2er0
    Given a list of words, L, that are all the same length, and a string, S, find the starting position of the substring of S that is a concatenation of each word in L exactly once and without any intervening characters. This substring will occur exactly once in S. Example: L: "fooo", "barr", "wing", "ding", "wing" S: "lingmindraboofooowingdingbarrwingmonkeypoundcake" Word found in joining L and also found in S: "fooowingdingbarrwing" Answer: 13 L: "mon", "key" S: "monkey Word found in joining L and also found in S: "monkey Answer: 0 L: "a", "b", "c", "d", "e" S: "abcdfecdba" Word found in joining L and also found in S: "ecdba Answer: 5

    Read the article

  • how to send value to the from action page from database

    - by Mayank swami
    I am creating a faq panel for there can be multiple answers for question and i want to take the answer id .because i am storing comment by answer id the problem is that how to sent the $answer_id to the comment_submit_process.php and how to recognize the answer ? $selected_ques= mysql_prep($_GET['ques']); $query = "SELECT * FROM formanswer where question_id = {$selected_ques}"; $ans= mysql_query($query); if($ans){ while($answer = mysql_fetch_array($ans)) //here is the form <form id="add-comment" action="comment_submit_process.php" > <textarea class="comment-submit-textarea" cols="78" name="comment" style="height: 64px;"></textarea> <input type="submit" name="submitbutton" value="Add Comment" class="comment-submit-button" > <br> <?php $ans_id= $answer['id']; echo $ans_id; ?> <input type="hidden" name="ques" value="<?php echo $_GET['$ans_id'] ?>" /> <span class="counter ">enter at least 15 characters</span> <span class="form-error"></span> </form> <?php }} ?>

    Read the article

  • Is it worth investing time in learning to use emacs?

    - by Andrew
    Right up front: I do not want to start a religious war. I've used vi for as long as I can remember, and the few times I've tried to pick up emacs I've been so lost so quickly I've given up. Lots of people find emacs very powerful, however. Its programmability is somewhat legendary. I'm primarily doing Solaris+Java development, and I'd like to ask a simple question: will my productivity increase if I invest time in getting my head around emacs? Is the functionality that it offers over vim going to be paid back in productivity increases in a reasonable timeframe? Repeat: I don't want a "my editor is better than yours". I just want a yes or no answer as to whether it's worth investing the time or not. Will my productivity really increase?

    Read the article

  • Hide/Show problems on a questionerre application

    - by T. Todd
    I am doing an assignment involving the creation of a simple Quiz type form application. However, whenever I run the program, only the first answer shows for a multiple question and I cannot for the life of me figure out why. This is the contstructor: MultipleChoice dlg = new MultipleChoice( new Question("What is the capital of Zimbabwe?", new Answer("Paris", false), new Answer("Washington D.C.", false), new Answer("Harare", true), new Answer("Cairo", false), new Answer("N'Djamena", false))); if (dlg.ShowDialog() == DialogResult.OK) { if (dlg.Correct) MessageBox.Show("You got something right!"); else MessageBox.Show("You couldn't be more wrong"); } And this is the Question Form Code: private Question Q; public MultipleChoice (Question q) { Q = q; InitializeComponent(); textPrompt.Text = Q.Prompt; if (Q.A != null) { radioA.Text = Q.A.Prompt; } else radioA.Hide(); if (Q.B != null) { radioB.Text = Q.B.Prompt; } radioB.Hide(); if (Q.C != null) { radioC.Text = Q.C.Prompt; } radioC.Hide(); if (Q.D != null) { radioD.Text = Q.D.Prompt; } radioD.Hide(); if (Q.E != null) { radioE.Text = Q.E.Prompt; } radioE.Hide(); } public bool Correct { get { if (Q == null) return false; if (Q.A != null && Q.A.Correct && radioA.Checked) return true; if (Q.B != null && Q.B.Correct && radioB.Checked) return true; if (Q.C != null && Q.C.Correct && radioC.Checked) return true; if (Q.D != null && Q.D.Correct && radioD.Checked) return true; if (Q.E != null && Q.E.Correct && radioE.Checked) return true; return false; } Where have I gone wrong? Thank you, Travis

    Read the article

  • SQL Server 2005 stored procedure error

    - by user1670625
    I have created a stored procedure of insert command for employee details in SQL Server 2005 in which one of the parameters is an image for which I have used varbinary as the datatype in the table.. But when I am adding that parameter in the stored procedure I am getting the following error- Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query. Stored procedure: ( @Employee_ID nvarchar(10)='', @Password nvarchar(10)='', @Security_Question nvarchar(50)='', @Answer nvarchar(50)='', @First_Name nvarchar(20)='', @Middle_Name nvarchar(20)='', @Last_Name nvarchar(20)='', @Employee_Type nvarchar(15)='', @Department nvarchar(15)='', @Photo varbinary(50)='' ) insert into Registration ( Employee_ID, Password, Security_Question, Answer, First_Name, Middle_Name, Last_Name, Employee_Type, Department, Photo ) values ( @Employee_ID, @Password, @Security_Question, @Answer, @First_Name, @Middle_Name, @Last_Name, @Employee_Type, @Department, @Photo ) Table structure: Column Name Data Type Allow Nulls Employee_ID nvarchar(10) Unchecked Password nvarchar(10) Checked Security_Question nvarchar(50) Checked Answer nvarchar(50) Checked First_Name nvarchar(20) Checked Middle_Name nvarchar(20) Checked Last_Name nvarchar(20) Checked Employee_Type nvarchar(15) Checked Department nvarchar(15) Checked Photo varbinary(50) Checked I am not getting what to do..can anyone give me some suggestion or solution? Thanks in advance.

    Read the article

  • PHP: How do I have a variable hhtp-header value for my GET request?

    - by Cortopasta
    I want the user to submit an answer to a question, then upon submission be redirected back to the page where they asked the question and I can't seem to get this to work: if (!isset($_POST['answer']) && !isset($_POST['verse'])) { echo "Please fill out form."; } elseif (!isset($_POST['answer']) || !isset($_POST['verse'])) { echo "one field left blank"; } else { $user->submitAnswer($question_id); header("Location: welcome.php?question_id=$question_id"); exit; } What am I doing wrong? EDIT: Sorry, wasn't very clear. I'm trying to pass the variable $question_id to the header(location: part so that it will pull up the question they were just on and show the answer they posted

    Read the article

  • how to change color of text following function in javascript

    - by OVERTONE
    Ok before i make spaghetti of this code i thought id ask around here. ive made a quiz for an online site. The answers are stored in an array, and ive a function that checks the answers array to what youve clicked. then it counts them and gives you your score. but i want to change the clor of the right answer wen the user clicks the score button. so the correct answers are highlighted. something like this https://www.shutterpoint.com/Home-Quiz.cfm (just hit submit at the bottom, no need to do the quiz). the little answer icon at the side looks flashy but id rather just have the text change color. heres how my questions are formatted <p>Depth of field is controlled by :?</p> <p id = "question2"><input type="radio" name="question2" id="Answer1" value = "a" onClick ="recordAnswer(2,this.value)"/> The focal length of the lens. <br/> <input type="radio" name="question2" id="Answer2" value = "b" onClick = "recordAnswer(2,this.value)"/> The size of the aperture opening. <br/> <input type="radio" name="question2" id="Answer3" value = "c" onClick = "recordAnswer(2,this.value)"/> The distance between the camera and lens. <br/> <input type="radio" name="question2" id="Answer4" value = "d" onClick = "recordAnswer(2,this.value)"/> All of these. <br/></p> and these are the two functions that are called throughout. record answer is called every time the user clicks a button function recordAnswer(question,answer) { answers[question-1] = answer; } this is the final button which calculates the score function scoreQuiz() { var totalCorrect = 0; for(var count = 0; count<correctAnswers.length;count++) { if(answers[count]== correctAnswers[count]) totalCorrect++; } <!-- alert("You scored " + totalCorrect + " out of 12 correct!"); --> } another function is best i think. ive already made attemots at it and know i have to set the color using document.getElementById('question2').style.color = '#0000ff'; question2 being the p id i think if i take in the value part of (input type....) ill be able to compare it to the answers array. but im not quite sure how to do this. any helpers? maybe something like this document.getElementById("Answer1").style.color = '#0000ff'; using the id part of the (input type line) i think i got it actually. ill post my answer in a sec

    Read the article

  • Question about Multicaste Delegates?

    - by IbrarMumtaz
    I am going through some exam questions for the 70-536 exam and an actual question one developer postedon his blog has popped up in my exam questions. I cannot remember what his answer was .... but below is the question: You need to write a multicast delegate that accepts a DateTime arguement and returns a bool value. Which code segment should you use? A: public delegate int PowerDeviceOn(bool, DateTime) B: public delegate bool PowerDeviceOn(Object, EventArgs) C: public delegate void PowerDeviceOn(DateTime) D: public delegate bool PowerDeviceOn(DateTime) The answer is A. Can someone please explain why? As I already did some research into this question a while ago and so I was sure that it was C, obviously now looking back at the question its clear that I did not read properly. As i was sure I had seen the same one before so I jumped to the most obvious one. A varitation on this question: You need to write a multicast delegate that accepts a DateTime arguement. Which code segment should you use? A: public delegate int PowerDeviceOn(bool, DateTime) B: public delegate bool PowerDeviceOn(Object, EventArgs) C: public delegate void PowerDeviceOn(DateTime) D: public delegate bool PowerDeviceOn(DateTime) Now this is another variation on this quesiton, it still has the same bogus sample answers, as they still kind work in throwing the exam taker off. Notice how by simply keeping the sample asnwers the same and by removing a small portion of the question text, the answer is C and not A. The variation has no official answer as I just conjured it up using the exam question as a baseplate. The answer is definately C. This time round its easy to see why C is correctr but the very first question I have an inkiling but as you know an inkling is not good enough in passing exams. Thanks For Reading.

    Read the article

  • SEO dynamic / AJAX pages

    - by Andrew
    I have a very dynamic / ajax powered website which also includes iframes and due this reason I have a very bad SEO rank and it come in my mind to make one more additional version of the site (text based / no script) and serve it to the search engines based on the user agent . Please let me know if you think that is a feasible method and if it's not what else would you recommend me to do .. I don't want to loose any fancy ajax feature but I also need to keep the website on the google map :) thank you in advance for any answer ! btw the website is developed in asp.net c# .

    Read the article

  • How to run a program in python?

    - by Luka Mihaldinec
    this is my code. I'm trying to make a script which would run an .exe file from my computer. And this one isn't working :/ I think I'm using the wrong command.. I tried all the other commands like import os, os.startfile, but they won't work too. I think my code is just wrong :P loop=0 while loop==0: answer=raw_input("coded by: Narralol\n\n" "Pick a task:\n" "1) Start Minecraft.exe\n" "2) Start Minecraft_Server.jar\n" "3) Backup your server\n" "4) Copy the backup to your desktop\n" "5) Exit\n") if answer==1: execfile('D:\Games\Minecraft\Minecraft.exe') elif answer==2: execfile('D:\Games\Minecraft\Minecraft_server.jar') elif answer==5: loop=1

    Read the article

  • where to store temporary data in MVC 2.0 project

    - by StuffHappens
    Hello! I'm starting to learn MVC 2.0 and I'm trying to create a site with a quiz: user is asked a question and given several options of answer. If he chooses the right answer he gets some points, if he doesn't, he looses them. I tried to do this the following way public class HomeController : Controller { private ITaskGenerator taskGenerator = new TaskGenerator(); private string correctAnswer; public ActionResult Index() { var task = taskGenerator .GenerateTask(); ViewData["Task"] = task.Task; ViewData["Options"] = task.Options; correctAnswer= task.CorrectAnswer; return View(); } public ActionResult Answer(string id) { if (id == correctAnswer) return View("Correct") return View("Incorrect"); } } But I have a problem: when user answers the cotroller class is recreated and I loose correct answer. So what is the best place to store correct answer? Should I create a static class for this purpose? Thanks for your help!

    Read the article

  • Error in Android's clearCheck() for RadioGroup?

    - by Manuel R. Ciosici
    I'm having an issue with RadioGroup's clearChecked(). I'm displaying a multiple choice question to the user and after the user selects an answer I check the answer, give him some feedback and then move to the next question. In the process of moving to the next question I clearCheck on the RadioGroup. Can anyone explain to me why the onCheckedChanged method is called 3 times? Once when the change actually occurs (with the user changes), once when I clearCheck(with -1 as the selected id) and once in between (with the user changes again)? As far as I could tell the second trigger is provoked by clearCheck. Code below: private void checkAnswer(RadioGroup group, int checkedId){ // this makes sure it doesn't blow up when the check is cleared // also we don't check the answer when there is no answer if (checkedId == -1) return; if (group.getCheckedRadioButtonId() == -1) return; // check if correct answer if (checkedId == validAnswerId){ score++; this.giveFeedBack(feedBackType.GOOD); } else { this.giveFeedBack(feedBackType.BAD); } // allow for user to see feedback and move to next question h.postDelayed(this, 800); } private void changeToQuestion(int questionNumber){ if (questionNumber >= this.questionSet.size()){ // means we are past the question set // we're going to the score activity this.goToScoreActivity(); return; } //clearing the check gr.clearCheck(); // give change the feedback back to question imgFeedback.setImageResource(R.drawable.question_mark); //OTHER CODE HERE } and the run method looks like this public void run() { questionNumber++; changeToQuestion(questionNumber); }

    Read the article

  • Problem with mathamatical calculation in JQUERY

    - by Param-Ganak
    Hello friends! I have two text boxes. I enter number in one textbox. I write following JQUERY for that textbox which get executed when the focus out from first text box. The JQUERY code takes the entered value from first text box and multiply it by a decimal number 34.95 and display the answer in second text box. The code is doing the calculation little bit ok because when I enter the value 1000 in first text box it gives answer 34950 in second textbox and when I enter the value 100 in first text box it gives answer 3495.0000000000005 in second text box. **Please any one tell me what is the problem. is problem is in my JQUERY code. I also want to show the answer always in decimal point. Answer should always dislply only two digits after decimal point. so How to achieve this too.** This is my JQUERY code. $("#id_pvalue").focusout(function() { q=$("#id_pvalue").val(); var ans=q*34.95; $("#id_tvalue").val(ans); }); Please guide me friends! Thank You!

    Read the article

  • The shell dotfile cookbook

    - by Jason Baker
    I constantly hear from other people about how much of the stuff they've used to customize their *nix setup they've shamelessly stolen from other people. So in that spirit, I'd like to start a place to share that stuff here on SO. Here are the rules: DON'T POST YOUR ENTIRE DOTFILE. Instead, just show us the cool stuff. One recipe per answer You may, however, post multiple versions of your recipe in the same answer. For example, you may post a version that works for bash, a version that works for zsh, and a version that works for csh in the same answer. State what shells you know your recipe will work with in the answer. Let's build this cookbook as a team. If you find out that an answer works with other shells other than the one the author posted, edit it in. If you like an idea and rewrite it to work with another shell, edit the modified version in to the original post. Give credit where credit is due. If you got your idea from someone else, give them credit if possible. And for those of you (justifiably) asking "Why do we need another one of these threads?": Most of what I've seen is along the lines of "post your entire dotfile." Personally, I don't want to try to parse through a person's entire dotfile to figure out what I want. I just want to know about all the cool parts of it. It's helpful to have a single dotfile thread. I think most of the stuff that works in bash will work in zsh and it may be adapted to work with csh fairly easily.

    Read the article

  • Dynamic form in PHP not processing correctly

    - by user1497265
    My last question regarding this suggested I incorporate AJAX with PHP. However, I really wanted to try PHP exclusively for this project, and I seem to have made it about 95% there. I just need help on this one issue. Here's a quick background. My project requires a dynamic form to be populated with a max limit of 10 questions. Each form contains one question, one question number, and a text field. Students would go on and answer the questions. This is all driven by a database table (obviously), and when a question gets answered correctly, it will close and the next question in line will appear. There will always be 10 questions on the page. Here's how the coding looks, and it works perfectly. <? $rt = mysql_query("SELECT * FROM The_Questions WHERE Status='Open' ORDER BY 'Number' LIMIT 10"); while ($row = mysql_fetch_array($rt)) { $number=$row[0]; $category = $row[1]; $question=$row[2]; $points=$row[4]; $_SESSION['number'] = $number; ?> <form action="processor.php" method="post" class="qForm"> <div class="questionCell"> <div class="question"><? echo $number; echo $question ?></div> <div class="answer">Answer: <input class="inputField" name="q1" type="text" size="40" maxlength="40" /> <input name="HHQuestion" value="Submit" type="submit" /></div> </div> </form> <? } ?> The questions appear as they should, in the correct order, and the correct limit. Everything seems to be looking fine until a question gets answered and gets processed through the processor.php action. First here's the code to the processor.php file: <?php session_start(); if(isset($_POST["HHQuestion"])){ $dbhost = 'localhost'; $dbname = 'localhost'; $dbuser = 'localhost'; $dbpass = 'localhost'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname, $conn); { $number1 = $_SESSION['number']; $answer=$_POST['q1']; $sql="SELECT * FROM The_Questions WHERE Number='$number1'"; $result=mysql_query($sql); $row=mysql_fetch_array($result); $question = $row[2]; echo $question .'<br>'; echo $number1.'<br>'; echo $answer; } } ?> This is NOT live yet, and for testing purposes I'm echoing the question, question number, and answer (as you can see). What's happening is that the $question and $number1 displays the last question in the array (the $answer displays correctly, meaning it displays whatever was written in the dynamic form). Can anyone tell me why that is? If I change the LIMIT number to 20, the processor.php action will display the 20th question and number, even if I was answering question 8, for example, in the dynamic form. Again, the dynamic forms are being displayed correctly, and are numbered correctly. For some unknown reason to me, the action - processor.php - is grabbing the last question in the array. Any ideas on what I'm doing wrong? I'm hoping it's a simple code change that I'm overlooking. Thanks in advance guys!

    Read the article

  • Freemarker rendering differently on IE8

    - by scphantm
    we have a template that uses this for the record line <input type="${inputType}" name="${variableName}.code" id="${variable}.${vnum}.${answer.code}" class="checkbox" value="${answer.code}" [#nested/] [#if (answer.textLength > 0) && scripting]onchange="showOtherBox( this, '${variable}.[#if descriptionHack]${variableNumber}[#else]${vnum}[/#if].${answer.code}.description' )"[/#if] [#if showValues && (existing == answer.code)]checked="checked"[/#if]/> On IE8 it renders as this <span class="field"> <INPUT id=responses.8.L class=checkbox value=L type=checkbox name="responses['8'].answers['L'].code"> <LABEL for=responses.8.L>Award(s) for special accomplishment or performance related to activity participation (please list)</LABEL> <TEXTAREA id=responses.8.L.description class=" visible" rows=4 cols=60 name="responses['8'].answers['L'].description"></TEXTAREA> </span> and on every other browser we tried, it renders as this <span class="field"> <input type="checkbox" name="responses['8'].answers['L'].code" id="responses.8.L" class="checkbox" value="L" onchange="showOtherBox( this, 'responses.8.L.description' )"> <label for="responses.8.L">Award(s) for special accomplishment or performance related to activity participation (please list)</label> <textarea rows="4" cols="60" name="responses['8'].answers['L'].description" id="responses.8.L.description" class="visible" classname="visible"></textarea> </span> The difference being that in the FTL script, the if statement [#if (answer.textLength > 0) && scripting] is true for everything except IE. In IE8 its false for some reason and therefore it does not put the OnChange javascript event on the input tag. Has anyone seen anything like this before? we are using Freemarker 2.3.9 Update, it kinda works if i turn compatibility mode on for IE8. but not exactly. when i do that, the onchange event doesn't fire until the check box loses focus. which is very different than everything else. Is there a quick way to fix this without too much trouble? i suppose i could put something in that says if ie8, insert onclick instead of onchange. that may work, but i would need an authorization from the client to fix it like that.

    Read the article

  • Why won't JPA delete owned entities when the owner entity loses the reference to them?

    - by Nick
    Hi! I've got a JPA entity "Request", that owns a List of Answers (also JPA entities). Here's how it's defined in Request.java: @OneToMany(cascade= CascadeType.ALL, mappedBy="request") private List<Answer> answerList; And in Answer.java: @JoinColumn(name = "request", referencedColumnName="id") @ManyToOne(optional = false) private Request request; In the course of program execution, the Request's List of Answers may have Answers added or removed from it, or the actual List object may be replaced. My problem is thus: when I merge a Request to the database, the Answer objects that used to be in the List are kept in the database -- that is, Answer objects that the Request no longer holds a reference to (indirectly, via a List) are not deleted. This is not the behaviour I desire, as if I merge a Request to the database, and then fetch it again, its Answers List may not be the same. Am I making some programming mistake? Is there an annotaion or setting that will ensure that the Answers in the database are exactly the Answers in the Request's List? A solution is to keep references to the original Answers List and then use the EntityManager to remove each old Answer before merging the Request, but it seems like there should be a cleaner way. Thank you!

    Read the article

  • Why Create Mock Objects?

    - by Chris
    During a recent interview I was asked why one would want to create mock objects. My answer went something like, "Take a database--if you're writing test code, you may not want that test hooked up live to the production database where actual operations will be performed." Judging by response, my answer clearly was not what the interviewer was looking for. What's a better answer?

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >