Search Results

Search found 11735 results on 470 pages for 'global variables'.

Page 64/470 | < Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >

  • Can't echo jquery (with ajax) variable in php

    - by Lars Kerff
    I'm trying to post a variable through ajax. But it won't echo the variable in php. This are the variables (these are working, seen in the log): $("#slider").bind("valuesChanged", function(e, data){console.log("min: " + data.values.min + " max: " + data.values.max);}); The Ajax part: $("#slider").bind("valuesChanged", function (e, data) { $.ajax({ type: "POST", dataType: "text", url: "../test.php", data: { minValue: data.values.min, maxValue: data.values.max }, async: false, success: function(data){ alert('yeah') }, error: function(xhr) { alert('fail') // if your PHP script return an erroneous header, you'll land here } }); }); </script> And php echo: <?php if ( $_POST ) { echo $_POST[ 'minValue' ]; } ?> Now why does it not echo the post? Thanks!

    Read the article

  • Qt: default value of variable in class

    - by Martin
    When creating my own class in Qt I would like my variables in the class to have a standard/default value if I haven't set them to anything. It would be perfect if this was possible to set in the h-file so I don't have to do it in each instance method of my class. You can see what I want to do in the code below. In the example myBool would have the value of false and myInt the value of 0 when the object have been created. Is this possible at all? In myclass.h: class MyClass { Q_OBJECT public: MyClass(); ~MyClass(); bool myBool = false; //I want to set myBool and myInt to a default/standard value int myInt = 0; };

    Read the article

  • how to pass session variable to model in RoR?

    - by siulamvictor
    I used a global variable in my app for passing information before. But I got a problem and thanks everyone here suggested me to store those data in session with database. I tried, but I found that I can't access the session variable in Model. I googled and knew this is the Model normal behavior, RoR won't pass the session variable to Model. So how to pass the value of the session variable into Models? or is there any other method for my use case? I need a variable storing a value, which is required in all MVCs, and should be independent between different concurrent users. Thanks everyone. :)

    Read the article

  • is there a way to add a variable/property to a DOM element (eg, an element returned by a jQuery sele

    - by bt
    Hi there, I am looking for an alternative to using an object/variable in global scope -- I would like to associate key/value pairs with specific DOM elements (eg, a DIV), so that I can use them as input for logic that processes other elements (eg, child elements of said DIV). I tried something naive like: $('[foo=bar]').key='value' , and $('[foo=bar]')[key]='value', but it puked. Doing something like: var foobar = $('[foo=bar]'); foobar.key = 'value' -- works, but the new property/value only affects the new object (ie, foobar, not $('[foo=bar]')) Most likely there's something terribly basic I am overlooking. Any help is appreciated, thanks!

    Read the article

  • JavaScript's Associative Array / Object can't be read in functions

    - by Matrym
    At the very beginning of the javascript file, I have: var lbp = {}; lbp.defaults = { minLength: 40 }; I can successfully alert it afterwards, with: alert(lbp.defaults.minLength); But as soon as I put it inside a function, when I alert, I get "Undefined". What gives, and how do I avoid this? Is it absolutely necessary to pass this variable into each function, for example, by doing: function(lbp) { alert(lbp.defaults.minLength); } I would have thought that defining it first, it would attain global scope and not be required to be passed in? Thanks in advance for enlightening me :)

    Read the article

  • How to declare a variable that spans multiple lines

    - by Chris Wilson
    I'm attempting to initialise a string variable in C++, and the value is so long that it's going to exceed the 80 character per line limit I'm working to, so I'd like to split it to the next line, but I'm not sure how to do that. I know that when splitting the contents of a stream across multiple lines, the syntax goes like cout << "This is a string" << "This is another string"; Is there an equivalent for variable assignment, or do I have to declare multiple variables and concatenate them? Edit: I misspoke when I wrote the initial question. When I say 'next line', I'm just meaning the next line of the script. When it is printed upon execution, I would like it to be on the same line.

    Read the article

  • ViewState Vs Session ... maintaining object through page lifecycle

    - by Kyle
    Can someone please explain the difference between ViewState and Session? More specifically, I'd like to know the best way to keep an object available (continuously setting members through postbacks) throughout the lifecycle of my page. I currently use Sessions to do this, but I'm not sure if it's the best way. For example: SearchObject searchObject; protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { searchObject = new SearchObject(); Session["searchObject"] = searchObject; } else { searchObject = (SearchObject)Session["searchObject"]; } } that allows me to use my searchObject anywhere else on my page but it's kind of cumbersome as I have to reset my session var if I change any properties etc. I'm thinking there must be a better way to do this so that .NET doesn't re-instantiate the object each time the page loads, but also puts it in the global scope of the Page class? Please advise. TIA

    Read the article

  • Can a variable like 'int' be considered a primitive/fundamental data structure?

    - by Ravi Gupta
    A rough definition of a data structure is that it allows you to store data and apply a set of operations on that data while preserving consistency of data before and after the operation. However some people insist that a primitive variable like 'int' can also be considered as a data structure. I get that part where it allows you to store data but I guess the operation part is missing. Primitive variables don't have operations attached to them. So I feel that unless you have a set of operations defined and attached to it you cannot call it a data structure. 'int' doesn't have any operation attached to it, it can be operated upon with a set of generic operators. Please advise if I got something wrong here.

    Read the article

  • PHP concatenate variable

    - by Jerry
    Hi guys. Might be an easy question for you guys. can't find it on google. I am trying to concatenate two variables name; $i=0; for ($i=0;$i<5;$i++){ if($array[$i]>0){ $test.$i=//do something }else{ $test.$i=//do something } } //echo $test0 gives me nothing. //echo $test1 gives me nothing. I know I can't use $test.$i but don't know how to do this.Any helps? Thanks!

    Read the article

  • Linking Error: undefined reference to `MPI_Init' on Windows 7

    - by fatpipp
    I am using OpenMPI library to write a program to run on Windows 7. I compile and build with C Free 4.0, Mingw. Compiling is Ok but when the compiler links object, errors "undefined reference to ..." occurs. I have set the environment already: I added OpenMPI lib, include and bin folder into C Free Build Directories. I added them into Windows environment variables too. But the error still occurs. Can anyone tell me how to fix it? Thanks a lot.

    Read the article

  • Inconsistent Session data from IE - cached sessions???

    - by pedalpete
    I'm trying to prevent some basic click-fraud on my site, and am building links based on session time data. Everything works in FF, but in IE the information I'm storing in the session is somehow being changed. When I load up the main page, I set my session variables like this session_start(); $_SESSION['time']=$time(); I'm out putting the session value into the page, so I get something like 1275512393. When the user clicks on a link, I send an ajax request, and that page is returning the session which I am putting into an alert. session_start(); echo $_SESSION['time']; die(); The alert is returning 1275512422. Only in IE is the $_SESSION['time'] being returned different from the original $_SESSION['time'] It doesn't appear that this is a caching issue, as the times are always VERY near each other, and the second one is always after the first, but I'm not positive.

    Read the article

  • Access variable value using string representing variable's name

    - by Paul Ridgway
    Hello everyone, If the title was not clear, I will try to clarify what I am asking: Imagine I have a variable called counter, I know I can see its current value by doing something like: std::cout << counter << std::endl; However, assume I have lots of variables and I don't know which I'm going to want to look at until runtime. Does anyone know a way I can fetch the value of a variable by using its name, for example: std::cout << valueOf("counter") << std::endl; I feel being able to do this might make debugging large complex projects easier. Thanks in advance for your time.

    Read the article

  • Export environment variable from PHP, for use by exec()'d shell command?

    - by anonymous coward
    Somewhat similar to http://stackoverflow.com/questions/2002970/export-a-variable-from-php-to-shell, but my problem is different. I am forced to work with a program that gets an important location variable from an Environment Variable (Linux), rather than a config or, better, a command line option. I have to call this program from within PHP, and currently am doing it like so: shell_exec('/path/to/program option1 option2'); I need to be able to set/override the environment variable that program will be looking for. As an example, this does not work: shell_exec('VAR1=foo /path/to/program option1 option2'); nor does: shell_exec('VAR1=foo; export foo; /path/to/program option1 option2'); for good measure. Both of the above command lines work "as expected" from the shell. Is it possible to override environment variables for programs called via exec, shell_exec, etc?

    Read the article

  • C++ Access variable value using string representing variable's name

    - by Paul Ridgway
    Hello everyone, If the title was not clear, I will try to clarify what I am asking: Imagine I have a variable called counter, I know I can see its current value by doing something like: std::cout << counter << std::endl; However, assume I have lots of variables and I don't know which I'm going to want to look at until runtime. Does anyone know a way I can fetch the value of a variable by using its name, for example: std::cout << valueOf("counter") << std::endl; I feel being able to do this might make debugging large complex projects easier. Thanks in advance for your time. PS: Please do not respond with 'Google it', I have, though maybe not with the best query to get the answer I'm looking for...

    Read the article

  • Problem with httpContext.RewritePath on IIS 7

    - by PNR
    I am using httpContext.RewritePath in Global.asax for som URLrewriting, and it works very well in my development environment on the Cassini server. But when I copy it to the production server, witch is a IIS 7 it isn't working. I have also tried to use Context.Server.TransferRequest but thne I get the error: "This operation requires IIS integrated pipeline mode." on both Cassini and IIS 7, and on IIS 7 the website is running in "Integreret" mode in the AppPool. I rewrite all urls on the website like /[The main menuname]/[pagename].aspx fx from /web/thesite.aspx?mainmenu=manager to /manager/thesite.aspx OR /web/theOtherSite.aspx?mainmenu=about to /about/theOtherSite.aspx And so on... Thanks very much in advance!

    Read the article

  • PHP 5.3 Namespaces should i use every PHP function with backslash?

    - by lhwparis
    Hi, im now using namespaces in PHP 5.3 now there is a fallback mechanism for functions which dont exist in the namespace. so php every time checks if the function exists in namespace and then tries to load it from global space. So what about all php internal functions? strstr for example? Should i now use every php internal function with a \ ? to avoid php first checking the namespace? is this fallback a huge performance drop? what do you think?

    Read the article

  • PHP to make vars and values part of array

    - by Chris
    I currently have this function to search and replace in a text file. // Input $ect = array('Visssa', 'Lisssa', 'her'); // Placeholders in the file $put = array('lname', 'fname', 'hisher'); // Replace the placeholders $oput = str_replace($put, $ct, 'tmpfile.txt'); This is not the full program but the idea is replace the values found in tmpfile.txt with the ones found in the $etc array. And it works flawlessly. But, what I need to do is get all passed vars (get/post) and then make the arrays so that the var is the value to replace and the value is the value to replace it with. So, if I sent the url http://xyz.com/?lname=tom&ogre=yes All instances of lname in the file would be replaces with tom and all instances of ogre would be replaced with yes. So somehow it just gets any/all variables passed in get/post and then the arrays showed above would cause the var to be replaced by the value in the file.

    Read the article

  • What is the best place to store globals in Rails app?

    - by Nick Gorbikoff
    Hello. I was wondering if there is the best practice on where to store global settings in a rails app. What I mean by that is i.e: I have a few globals defined that may change, but not likely and it seems inappropriate to store them in DB since they are used so much. For instance I have SYSTEM_EMAIL & SYSTEM_EMAIL_SIGNATURE & SYSTEM_STORAGE_ROOT. Right now I keep them in environment.rb, but I'm not sure if this is the right palce to store them. Thank you

    Read the article

  • PHP variable question

    - by Kyle Parisi
    This works: $customerBox = mysql_query("MY SQL STATEMENT HERE"); $boxRow = mysql_fetch_array($customerBox); $customerBox = mysql_query("MY SQL STATEMENT AGAIN"); while($item = mysql_fetch_assoc($customerBox)) { foreach ($item as $columnName = $value) { if (empty($value)) { print $columnName; } } } This does not: $customerBox = mysql_query("MY SQL STATEMENT HERE"); $boxRow = mysql_fetch_array($customerBox); while($item = mysql_fetch_assoc($customerBox)) { foreach ($item as $columnName = $value) { if (empty($value)) { print $columnName; } } } Why? I guess I don't understand how variables work yet.

    Read the article

  • Bash, Concatenating 2 strings to reference a 3rd variable

    - by Im Fine
    I have a bash script I am having some issues with concatenating 2 variables to call a 3rd. Here is a simplification of the script, but the syntax is eluding me after reading the docs. server_list_all="server1 server2 server3"; var1 = "server"; var2 = "all"; echo $(($var1_list_$var2)); This is about as close as I get to the right answer, it acknowledges the string and tosses an error on tokenization. syntax error in expression (error token is "server1 server2 server3.... Not really seeing anything in the docs for this, but it should be doable. EDIT: Cleaned up a bit

    Read the article

  • bash—Better way to store variable between runs?

    - by shardbearer
    I've made a bash script which I run every hour with crontab, and I need to store one variable so that I can access it the next time I run it. The script changes the variable every time it runs, so I can't hardcode it in. Right now I am writing it to a txt file and then reading it back. Is there a better way to do it than this? And the way I am reading the txt file is something I found on here, I don't understand it, and it's kinda clunky. Is there not a built in command for this? Anyway, here's the applicable code, with some of the variables changed to make it easier to read. while read x; do var=$x done < var.txt # Do some stuff, change var to a new value echo $var > var.txt The variable is only a single integer, so the text file feels overkill.

    Read the article

  • Where is the best place to store globals in Rails app?

    - by Nick Gorbikoff
    Hello. I was wondering if there is the best practice on where to store global settings in a rails app. What I mean by that is i.e: I have a few globals defined that may change, but not likely and it seems inappropriate to store them in DB since they are used so much. For instance I have SYSTEM_EMAIL & SYSTEM_EMAIL_SIGNATURE & SYSTEM_STORAGE_ROOT. Right now I keep them in environment.rb, but I'm not sure if this is the right palce to store them. Thank you

    Read the article

  • using jquery $.post() for returning multiple values

    - by Aninemity
    Hi all I am trying to use a $.post() in the following way: $.post("file.php", { file_id: $(this).val()}, function(data){...} The file.php then does a database query and returns an array with a title, description and image reference. What I want to do then is be able to update the .val() for form fields for each. I understand how to do this on a single variable, it would just be the following: $.post("file.php", { file_id: $(this).val()}, function(data){ $('#title').val(data); } But, how do I get the data returned to be recognizable in jquery as either separate variables or as an array? Thanks in advance

    Read the article

  • Check if IsCallback on Application_BeginRequest

    - by user136405
    I have a web application (.NET 3.5) that has this code in Global.asax: Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) LinkLoader() PathRewriter() PathAppender() End Sub I want all those functions inside to get called except for when it's an AJAX call back. So, ideally I would have it changed to: Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) If not Page.IsCallback then LinkLoader() PathRewriter() PathAppender() End If End Sub But there is not access to the page object here. So, basically my question is: How do I check if the request is an AJAX call back inside Application_BeginRequest? Thank you very much for any feedback.

    Read the article

  • PHP Losing variable data

    - by Conor B
    Hi, I'm having an issue with PHP losing data in a variable. There is quite a bit of data in the variable, because it basically contains a binary file, but I'm wondering if this is cause for it to completely lose it's information. Looking at a snippet from my code which is used to deal with email attachments: var_dump($data) if (array_key_exists('filename', $params) || array_key_exists('name', $params)) { var_dump($data) ... } The first var_dump gives the desired output of the file: "string(283155) " --Apple-Mail-5-930065543 ... etc while the second gives an output of: string(0) "" ... string(0) "" Any idea why this is happening? Does PHP just drop data in variables if they are really large? (I didn't think so, as I've never had this problem before) If so, any workaround? Thanks!

    Read the article

< Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >