variables

How to use a variable as modifier in a substitution

Is there a way to use a variable as modifier in a substitution? my $search = 'looking'; my $replace = '"find: $1 ="'; my $modifier = 'ee'; s/$search/$replace/$modifier; I need to use an array of hashes to make bulk search-replace with different modifiers. ...

jQuery UI/Autocomplete - How to change default variable names?

jQuery UI Autocomplete uses the variable names "value", "id" and "label" to create the drop down list. For example: $("#cities").autocomplete({ source: "backend/cities.php", minLength: 2, select: function(event, ui) { city = ui.item.id; region = ui.item.label; country = ui.item.value; } }); the ...

PHP recursive variable replacement

Hello there, I'm writing code to recursively replace predefined variables from inside a given string. The variables are prefixed with the character '%'. Input strings that start with '^' are to be evaluated. For instance, assuming an array of variables such as: $vars['a'] = 'This is a string'; $vars['b'] = '123'; $vars['d'] = '%...

variable read from text file and passed to smarty shows up like "Home<i>\r</i><i>\n</i>"?

I have a code that look like this. $language = "eng"; $append = "_sidebar.txt"; $read_text_file = "languages\\$language$append"; $sidebar = file($read_text_file); $smarty->assign("sidebar_link",$sidebar); Why does all variables in smarty all look like this: Smarty_Variable Object (3) ->va...

Trouble comparing two PHP variables

Hello, this may seem like a stupid question, but it is stumping me nontheless. I'm sure that the answer is something small. I think it's just one of those situations where I have been looking at the code for too long. I am trying to compare two PHP variables to see if they are the same. As you can see below, I am comparing $verification...

Extra parameter for jQuery's ajax success function

I'm fetching an XML file using this code: function getMaps(){ toLoad = loadMaps.length; for (var i = 0; i < loadMaps.length; i++){ $.ajax({ type: "GET", url: loadMaps[i], dataType: "xml", success: processMap }); } } Which works fine, but I want to give processMap an...

Perl, using variable from within While loop outside of the loop?

This seems really simple but it is giving me a hard time figuring it out as I'm new to perl.. I've been looking through a lot of documentation now about loops and I am still stumped by this... I have a sub that contains a where loop and I want to use a variable value from within the loop outside of the loop (after the loop has run), howe...

identifying php unused variables

Hello, I have seen the bellow question and was wondering if there is something like it for eclipse. Also how can I make sure that this kind of errors get's thrown into my trigger error function so that I can write it to a log. Thank you for any help. http://stackoverflow.com/questions/2534176/identifying-php-unused-variables-in-emac...

C multiple single line declarations

What happens when I declare say multiple variables on a single line? e.g. int x, y, z; All are ints. The question is what are y and z in the following statement? int* x, y, z; Are they all int pointers? ...

Elegantly escaping errors

I have statements such as @user = User.find(current_user.id) throughout my app. Sometimes a user might enter with a nil variable (such as a new user for whom current_user is nil). I'm sure the dumb way to do this would be to scatter if statements everywhere like... if current_user.exists? @user = User.find(current_user.id) else re...

Getting javascript variable value with HTML Agility pack

Is it possible to get a javascript variable value with html agility pack? <script type="text/javascript"> var title = "Site title"; var articlesummary = "article summary."; </script> Is there any way that html agility pack would allow me to get the value of the variable title for example? ...

variables not printing in email form results

My form validates and submits fine, but the variables are not being printed in the emailed results. Can anyone take a quick look at my processing file and tell me why this might be? <?php // CHANGE THE VARIABLES BELOW $EmailFrom = $EmailFrom; $EmailTo = "[email protected]"; $Subject = "Proposal Submission"; $FirstName = $HTTP_POST_VARS['...

variable as button value in javascript

I will be reading a tag from xml and assign it to a variable, ID. ID=(x[i].getElementsByTagName("ID-NUM")[0].childNodes[0].nodeValue); How could I use the variable, ID, as the button value to display? document.write("<input type = button value = ID style='width:100'><br><br>"); Kindly let me know if I an not clear, thanks. ...

forms - processing textarea and checkbox variables

Alright, so I got my form to email most of the variables in php. However, my textarea variables show up blank and my textarea inputs print as "Array" Here is a snippet from my form: <label for="ProgramAudience">Intended Audience:</label> <span><input type="checkbox" name="ProgramAudience[]" value="AcademicAffairsFaculty...

C# Assign a variable that has a certain name

I want to slap a simple class together to pick out QueryString variables from an HTTP request that gets sent to my application. The variables are not always in the same order, but they're always there. I want to assign the variables in my class the values of the corresponding variables from the request, but I have no idea how to do this....

function call 'clear_all_cache' and 'clear_assign' is unknown or deprecated. error in smarty?

I need to remove the cache when a user change language, but I get an error message. $smarty = new Smarty; //$smarty->force_compile = true; $smarty->debugging = true; $smarty->caching = false; $smarty->cache_lifetime = 120; if (isset($_COOKIE['country'])) { $country = $_COOKIE['country']; $language = "eng"; if ($country ...

how to assign new values to variables in predefined equation?

for predefined equations,assigning new values to variables do not changes value of equation. how can i assign new values to variables so that i will get appropriate value of equation and not the previous one a,b,c,d,e,f=sympy.symbols('abcdef') a,b=c,d e=a+b #equation print e c+d #value of eqn a,b=d,f print e c+d #not d+f ...

is there a way to track the values of certain variables after the end of a program in visual studio?

i have found myself several times in the need of knowing the last values set to a range of variables that were in a certain portion of code, or method; maybe dispersed around the program. does anyone know a way to select variables and know the last value set to them after the program ends running - in a windows maybe ? ...

String or Integer variable Listener in java?

First off, I am pretty new to java and I am just staring to get the hang of how static classes can interface with non-static classes and how to get a static class to update a textbox. I keep searching for information, but I cannot find anything. I need a variable listener. here is something like what I am trying to do: public class...

variable or constant ?

Is there a benefit of using one over the other ? $lang = isset($_COOKIE['lang']) ? $_COOKIE['lang'] : 'en'; # OR define("LANG" , isset($_COOKIE['lang']) ? $_COOKIE['lang'] : 'en'); Thanks ...