Search Results

Search found 11238 results on 450 pages for 'miserable variable'.

Page 52/450 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • Pass Success variable to code

    - by João Dias
    How can I pass a variable that has been calculated in the success callback of an ajax function, to the document.ready ? I have this code function loadActions() { var countDiv; $.ajax({ type: "POST", cache: false, url:"modules/actions/actions.php", success : function (data) { $("#actions-container").html(data); $('.action-details').hide(); countDiv = $('.action-tab-odd').length + $('.action-tab-even').length ; } }); return countDiv; } $(document).ready(function(){ var count = loadActions(); }); But count is allways undefined. How can I get this to work? Thank you

    Read the article

  • Using php variable inside a query

    - by Aruna
    Hi, i am using a query inside php as $query = 'SELECT * from #__chronoforms_UploadAuthor where text_6 like "%'.$_GET['title'].'%" and text_7 like "%'.$_GET['author'].'%" limit 0,1'; where i am trying to insert a php variable instead of 1 in the limit.. $query = 'SELECT * from #__chronoforms_UploadAuthor where text_6 like "%'.$_GET['title'].'%" and text_7 like "%'.$_GET['author'].'%" limit 0,"'.$_GET['limit'].'"'; but it shows me the error . Pls help me .. THere are some errors in keeping $_GET['limit']..

    Read the article

  • store in a variable only the first or only the second class of an element

    - by shecky
    I'm using this bit of jQ to add a class to two different elements based on the class of another (parent/grandparent, etc) element: $(document).ready(function(){ var containerClass = $('#main-content').attr('class'); $('#nav-primary li#'+containerClass).addClass('active'); $('#aux-left div[id$='+containerClass+']').addClass('active'); }); Brilliant, but I have two problems with it: First, when there's no class at all in <div id="main-content">, the 'active' class is added to all the #nav-primary LIs, and also to all the #aux-left DIVs; how can I modify this so that in the absence of any class on #main-content, do nothing? Second, how can I target only the first or second of multiple classes to store in the 'containerClass' variable, e.g., <div id="main-content" class="apples bananas">? Very much appreciated! svs

    Read the article

  • Couldn't assign 'top' from variable in jQuery Animate

    - by bhu1st
    Hi, I am stuck here, i am trying to animate number of 'x' divs (the code below is just for one div) by selecting their original 'top' position & adding some 'newTop' pixel values to them. var dur = 1500; var origTop = $("#div_x").position().top; var newTop = parseInt(origTop) + 30; $("#div_x").animate({ top : newTop + "px" }, dur); I checked alerting the 'newTop' variable and it's showing correct values but the animation is not working. I tried different variants to assign 'top' to the animate function but nothing is working. any suggestion would help me a lot. thanks in advance.

    Read the article

  • Maintain a variable value between program runs

    - by Akshay J
    I have a simple c# console application that is scheduled after every 5 mins. Every invocation of the program requires the output of the last run. What I am doing right now is using a text file and store the result in it. next time when it runs it opens the text file and know the output of the previous run. Is there any other way to do it that wont require any such text file ? Like maintaining a session variable etc ?

    Read the article

  • Passing PHP session variable to AJAX URL

    - by user547794
    Hello, I am trying to pass a session variable into an AJAX loaded page. Here is the code I am using: jQuery(document).ready(function(){ $("#userdetail").click(function() { $.ajax({ url: "userdetail.php?id=<?php $_SESSION['uid']?>", success: function(msg){ $("#results").html(msg); } }); }); }); This is the HTML URL I had working, not sure how to get this into the AJAX call: userdetail.php?id=<?php $_SESSION['uid']?> I should also mention that if I manually pass in the userID it works fine url: "userdetail.php?id=1",

    Read the article

  • How to write a variable with input ?

    - by ldigas
    the title is somewhat vague, so let me explain I'm trying to ask the user for a value of some variable, but at the same time, showing him the last value used (at the termination of the program, the values are saved to a file, and loaded at the start of the program). Something like this: Enter new radius value (R=12.6) : ... user enters 12.7 ... Enter new pi value (pi=3.14) : Enter new height value (h=30.0) : Usually I would write the first one with write statement, then read the new one (in fortran, for example). In matlab however, I don't know how to write something out with input statement. Are there some other statements for getting input ? All your thoughts on the subject appreciated.

    Read the article

  • refactoring this function in Java

    - by Joel
    Hi folks, I'm learning Java, and I know one of the big complaints about newbie programmers is that we make really long and involved methods that should be broken into several. Well here is one I wrote and is a perfect example. :-D. public void buildBall(){ /* sets the x and y value for the center of the canvas */ double i = ((getWidth() / 2)); double j = ((getHeight() / 2)); /* randomizes the start speed of the ball */ vy = 3.0; vx = rgen.nextDouble(1.0, 3.0); if (rgen.nextBoolean(.05)) vx = -vx; /* creates the ball */ GOval ball = new GOval(i,j,(2 *BALL_RADIUS),(2 * BALL_RADIUS)); ball.setFilled(true); ball.setFillColor(Color.RED); add(ball); /* animates the ball */ while(true){ i = (i + (vx* 2)); j = (j + (vy* 2)); if (i > APPLICATION_WIDTH-(2 * BALL_RADIUS)){ vx = -vx; } if (j > APPLICATION_HEIGHT-(2 * BALL_RADIUS)){ vy = -vy; } if (i < 0){ vx = -vx; } if (j < 0){ vy = -vy; } ball.move(vx + vx, vy + vy); pause(10); /* checks the edges of the ball to see if it hits an object */ colider = getElementAt(i, j); if (colider == null){ colider = getElementAt(i + (2*BALL_RADIUS), j); } if (colider == null){ colider = getElementAt(i + (2*BALL_RADIUS), j + (2*BALL_RADIUS)); } if (colider == null){ colider = getElementAt(i, j + (2*BALL_RADIUS)); } /* If the ball hits an object it reverses direction */ if (colider != null){ vy = -vy; /* removes bricks when hit but not the paddle */ if (j < (getHeight() -(PADDLE_Y_OFFSET + PADDLE_HEIGHT))){ remove(colider); } } } You can see from the title of the method that I started with good intentions of "building the ball". There are a few issues I ran up against: The problem is that then I needed to move the ball, so I created that while loop. I don't see any other way to do that other than just keep it "true", so that means any other code I create below this loop won't happen. I didn't make the while loop a different function because I was using those variables i and j. So I don't see how I can refactor beyond this loop. So my main question is: How would I pass the values of i and j to a new method: "animateBall" and how would I use ball.move(vx + vx, vy + vy); in that new method if ball has been declared in the buildBall method? I understand this is probably a simple thing of better understanding variable scope and passing arguments, but I'm not quite there yet...

    Read the article

  • Save the contents of manipulated div to a variable and pass to php file

    - by Danielle Zarcaro
    I have tried to use AJAX, but nothing I come up with seems to work correctly. I am creating a menu editor. I echo part of a file using php and manipulate it using javascript/jquery/ajax (I found the code for that here: http://www.prodevtips.com/2010/03/07/jquery-drag-and-drop-to-sort-tree/). Now I need to get the edited contents of the div (which has an unordered list in it) I am echoing and save it to a variable so I can write it to the file again. I couldn't get that resource's code to work so I'm trying to come up with another solution. If there is a code I can put into the $("#save").click(function(){ }); part of the javascript file, that would work, but the .post doesn't seem to want to work for me. If there is a way to initiate a php preg_match in an onclick, that would be the easiest. Any help would be greatly appreciated.

    Read the article

  • PHP IF statement not taking variable into account!

    - by Jess
    I have a tabled view in a while loop, where a user can view information on books. For example, book ISBN, book name, read status... Basically, when the user sets their 'readstatus' to 'complete' I want that specific table row to become grey! The logic is very straight forward, however I can't get my IF statement to recognise this: $readstatus = $_GET['readstatus']; if ($readstatus == 'complete') { echo '<tr class="completed">'; } else if ($readstatus != 'complete') { echo '<tr class="reading">'; } I'm obviously doing something wrong here, but all I need is the CSS class of the table row to change if the value of 'readstatus' = 'complete', if not, then output the default CSS table row color ('reading') Should I be putting $result as the variable or something? I have this coming just before my nested IF statement: $result = mysql_query($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); while($row = mysql_fetch_array($result)) { ?>

    Read the article

  • Reference variable to an object instantiated/initialized in another class in Java

    - by Alex
    The reason I'm asking is because I'm getting NullPointerException. I now this is very easy but I'm pretty new programming and find this a bit confusing. So say I have initialized an object in a class and want to access that same object from another class. Like now for instance I'm working on a small Chess game, in my model Game class I have an instance of Board, an object. Board, in turn, has an array of Squares. Square[][]. Game has board, board has Square[][]. Now if I want to access the Square[][] through the object board (in Game) of type Board. Do I just declare a variable with the same name and type or do I have to initialize it again? Board board OR Board board = new Board(); Note, I have already initialized board in the class Game so if I do it again, won't they be two totally different Board objects?

    Read the article

  • Passing CMD Results to Variable in a Batch File

    - by TripleNad
    I am trying to install an application and a group of services using PSTools, but I want to take into account that the computer I am trying to connect to may be turned off or on a different network, which is not reachable from the internal network. Basically if the machine is not able to be accessed through the admin share, this is the message that I am getting: Couldn't access MachineName: The network path was not found. Make sure that the default admin$ share is enabled on MachineName. This is the syntax I am using to try to capture the "Error Message" and then report back that if installation was successful or not (depending on if it can contact the machine) @echo off set /p name=What is the machine name?: psexec.exe \\\%name% -u *useraccount* -p *password* \\\ServerName\installation.bat FOR /F "tokens=*" %%A IN ('COMMAND ^| FIND "Couldn't access"') DO SET Error=%%A If "%Error%"=="Couldn't access" ECHO Installation Failed. Else ECHO Installtion complete. Pause exit Currently it hangs right at the point it's defining the Error Variable. Can't quite figure out what I am going wrong here.

    Read the article

  • accessing variable sheet ranges within Google spreadsheet?

    - by Daniel Harvey
    I've been trying to keep this little project entirely within Google docs, but I may have hit a wall. The spreadsheet is being used as a way for multiple users to record individual events with a Template they duplicate. I want to be able to compile a list of names of those attended onto a "report" sheet from all of the unique sheets, which should be after a certain sheet index [3] to [infinite]. Is this sort of variable sheet range possible in Google spreadsheets or do I need to go to the API to get this accomplished?

    Read the article

  • Reading a variable messes it up?!?!

    - by EpsilonVector
    We have the following line of code: printf("%d\n", toc->runlist.next); printf("%d\n", toc->runlist.next); These are the definitions: typedef struct thread_overview_control{ int id[NR_UTHREADS]; list_t runlist; int active_counter; int main_thread; int need_resched; } thread_overview_control; thread_overview_control* toc; What I'm trying to do is implement user threads. For some reason the output of the above code at the point where our test run crushes is: 12345678 //some address 0 //NOW IT'S NULL?!?!?! How can this happen?? All we do is read a variable. And the strange thing is, without printf's there are no crashes. What's going on?

    Read the article

  • How do I take the advantage of the variable column key/value structure of Cassandra

    - by icejade
    If I have to predefine all the columns, how do I take the advantage of the variable column key/value structure of cassandra? If I use update table command, it will insert null for all the rows which don't have that column. This is same as relational DB. For example, for contact column family, I have name, phone, email. I have 100 contacts have all 3 field. Then number 101 contact has skype id which I want to add. If I use insert statement, it won't let me add skypeid since it's not defined in the CF. So I have to run alter statement to change the CF, then all the first 100 contacts will have a null field for each of them.

    Read the article

  • Why doesn't variable img increase?

    - by Annette B
    I can upload image but the sprite name remains pict1 each time I upload another image. Why doesn't imgVal function increase? function imgVal() { img += 1; trace("image: pict" + img); } imgVal(); _fla.lights_mc.visible=false; _fla.lights_mc.stop(); _fla.pre_mc.fill_mc.stop(); _fla.pre_mc.visible=false; var sprite:Sprite=new Sprite(); sprite.addChild(loader); sprite.name = "pict" + img; //trace(sprite.name); _fla.myBorder.box.addChild(sprite); I'd like each sprite to be given a new name like pict1, pict2, pict3, etc but img variable is not increasing. I think this is where my problem occurs. Would someone please help?

    Read the article

  • Initializing a value through a Session variable

    - by William Calleja
    I need to Initialize a value in a Javascript by using a c# literal that makes reference to a Session Variable. I am using the following code <script type="text/javascript" language="javascript" > var myIndex = <%= !((Session["myIndex"]).Equals(null)||(Session["myIndex"]).Equals("")) ? Session["backgroundIndex"] : "1" %>; However the code above is giving me a classic Object reference not set to an instance of an object. error. Why? Shouldn't (Session["myIndex"]).Equals(null) capture this particular error?

    Read the article

  • Django: how to pass form variable to simple tag in template

    - by Remigijus
    Hello. I am trying to do some custom things in Django comments form. I have simple tag named "get_flatpage_by_id" that returns flatpage model data as array. This is working I expected: {% get_flatpage_by_id 14 as page %} It's returning flatpage that ID is 14. But this is not working, if I try to pass {{ form.object_pk.data }} (that returns 14). This is how it should look like: {% get_flatpage_by_id form.object_pk.data as page %} Simple tag receives value "form.object_pk.data" (string), not 14. I don't know how to tell Django that "form.object_pk.data" is variable, not a string!

    Read the article

  • bash copy with variable

    - by zaf
    I'm trying to copy files to the current directory using a bash script. In order to handle paths that need escaping a variable is used that is escaped and then supplied to the cp command. The cp command is complaining with: usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory I know what that means but I cannot understand why that happens. Here is the code: z="/a/b/c d e f.txt" y=`printf %q "$z"` cp $y x.txt # not working as expected echo cp $y x.txt # output is "cp /a/b/c\ d\ e\ f.txt x.txt"

    Read the article

  • How to assign HTML value to a asp.net string variable

    - by Zerotoinfinite
    I am using asp.net and C#. I want to send mail to my user in HTML format, I have the content in HTML format let say like this <table style="width:100%;"> <tr> <td style="width:20%; background-color:Blue;"></td> <td style="width:80%; background-color:Green;"></td> </tr> </table> Now I am unable to assign this to a string variable, so that I could send it as a mail. Please let me know how can I bind this whole HTML content into a varibale. Also, please note that the above code is only a demo, I have around 100 lines of HTML code.

    Read the article

  • Java environmental variable woes, maven also

    - by Blankman
    So I re-installed java in a directory that doesn't have any spaces in it, as I was having issues with it before. Java JDK is installed in: E:\downloads\java\jdk I created a User variable: JAVA_HOME E:\downloads\java\jdk And my Path looks like: %JAVA_HOME%\bin;%M2%; Now opening a NEW cmd prompt: c:\java 'java' is not recognized... but echoing works: c:\echo %JAVA_HOME% E:\downloads\java\jdk and so does this: c:\%JAVA_HOME%\bin\java -version java version "1.6.0_17" I am trying to get this to work, so I can then get maven to work as maven is having the same type of issues (I created M2_HOME and M2 and none work). What exactly am I doing wrong? I am having the exact same issue on my laptop also, both are running windows 7. I must be missing something!

    Read the article

  • How can i access the value of the moving slider in a jquery variable

    - by user1673591
    html <h1>HTML Slider Test</h1> <div class="slider" data-max="10"></div> <p>Your slider has a value of <span class="slider-value"></span></p> <div class="slider" data-max="100"></div> <p>Your slider has a value of <span class="slider-value"></span></p> jquery $(".slider").each(function() { $(this).slider({ value : 1, min : 1, max : $(this).data('max'), step : 1, slide : function (event, ui) { var a= $(this).next().find('span.slider-value').html(ui.value); } }); }); I want the value of the moving slider in a jquery variable

    Read the article

  • Counter variable for class

    - by George
    I am having problem getting this piece of code to run. The class is Student which has a IdCounter, and it is where the problem seems to be. (at line 8) class Student: def __init__(self): # Each student get their own student ID idCounter = 0 self.gpa = 0 self.record = {} # Each time I create a new student, the idCounter increment idCounter += 1 self.name = 'Student {0}'.format(Student.idCounter) classRoster = [] # List of students for number in range(25): newStudent = Student() classRoster.append(newStudent) print(newStudent.name) I am trying to have this idCounter inside my Student class, so I can have it as part of the student's name (which is really an ID#, for example Student 12345. But I have been getting error. Traceback (most recent call last): File "/Users/yanwchan/Documents/test.py", line 13, in <module> newStudent = Student() File "/Users/yanwchan/Documents/test.py", line 8, in __init__ idCounter += 1 UnboundLocalError: local variable 'idCounter' referenced before assignment I tried to put the idCounter += 1 in before, after, all combination, but I am still getting the referenced before assignment error, can you explain to me what I am doing wrong? Thank you Edit: Provided the full code I have

    Read the article

  • Stack around variable corrupted when using cvBlobsLib (OpenCV)

    - by jpromvi
    I am trying to do simple image processing with OpenCV and the cvBlobsLib in Visual C++ 2008, and I get an error message when I try to create a CBlobResult object IplImage* original = cvLoadImage("pic6.png",0); cvThreshold(original, original, 100, 255, CV_THRESH_BINARY); CBlobResult blobs = CBlobResult(original, NULL, 255); The message is the following: Run-Time Check Failure #2 - Stack around the variable blobs was corrupted Why does this happen? How should I create this object? Thank you very much for your help.

    Read the article

  • frame variable cannot be found

    - by Umzz Mo
    I am making 3 board games, and I have started my coding off in one class. Now that i wanted to move around it is giving me problems. In my view class I just want to have the main frame where users can pick from the games. And in the other views, i.e the childrens of view class i want to have the interface for the actual games. Now that the Jframe frame = new frame was created in the parent class, it cannot find the variable frame in the children classes.

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >