variables

How to renew a text input value in a js var in jquery

Hello, I have a jquery + plugin Boxy + form input mess. That´s the situation: 1 - when I press a link, a form with only a text input and a submit button appears in a popup. 2- When I write some text and press the submit button, I get the text input value in a js var, and send it by ajax to a PHP function that performs a operation a ...

[.htaccess] - Define "AuthUserFile" with an environment variable

Hello everybody ! Do you know how I could do to use a variable to define the AuthUserFile in a .htaccess file ? Like : RewriteRule ^ - [E=BASE:%{DOCUMENT_ROOT}mysite/www/] AuthUserFile %{ENV:BASE}admin/.htpasswd It don't work... Here is my full .htaccess file (if you want to understand why I need to do that) : Any help would be real...

PHP: How can I reference variables from an included file before it's been included?

How can I reference variables from an included file before it's been included? Or can I somehow include the file (so I can lead its variables later) before its HTML is literally inserted into the body tag? Or can I contain all of home's body content in one big variable that I can echo as well in the index? Here's what I'm trying to do: ...

PHP - can a long string of HTML be wrapped in a PHP variable?

Can this be done - opening a variable with one PHP tag, then closing the PHP tag but keeping the variable open so everything beneath becomes the value of the variable? Or is there a limit on PHP variable size / characters? <?php $content = " ?> a bunch of content goes here <br /> with lots of HTML tags and JS scripts <?php "; ?> ...

Set variable in jinja

Hello all, I would like to know how can I set a variable with another variable in jinja. I will explain, I have got a submenu and I would like show which link is active. I tried this: {% set active_link = {{recordtype}} -%} where recordtype is a variable given for my template Thanks, ...

The importance of declaring a variable as unsigned

Is it important to declare a variable as unsigned if you know it should never be negative? Does it help prevent anything other than negative numbers being fed into a function that shouldn't have them? ...

Adding javascript loops into SQL database

What i am trying to achieve is adding the javascript loops and the named variables into an sql database, some of them are already added to an external script so work fine however some which i have named in the SQL script at the bottom still need adding, however as the database won't accept a colon ":" they won't enter it and is returning...

Javascript variable scope question

Hi, I'm having trouble resolving a scope issue with my javascript. I have an array, dog[] that is defined from JSON, that I need access to from inside a nested function. function blah(json) { for (var u = 0; u < json[0][1][u].length; u ++ ) { var dog = 'k' + json[0][1][u].doggies; console.log(dog); // prints array of doggie str...

Shorthand conditional to define a variable based on the existence of another variable in PHP

Essentially, I'd love to be able to define a variable as one thing unless that thing doesn't exist. I swear that somewhere I saw a shorthand conditional that looked something like this: $var=$_GET["var"] || "default"; But I can't find any documentation to do this right, and honestly it might have been JS or ASP or something where I sa...

From within a bash script, how do I create a new filename, place a $variable in part of it?

Within a loop in my bash script, I am 'doing work', then writing the result of each iteration to its own file. I'd like to name these files # User-defined Function (UDF) processLine(){ line="$@" # get all args index=$(echo $line | gawk -F::: '{ print $1 }') content=$(echo $line | gawk -F::: '{ print $2 }') # Let's tr it to remove do...

Unique variables inside foreach()

Trying to create a variable with unique name for each $item. To prevent error "Only variables can be passed by reference". If there are 5 items in array $items, we should get 5 unique variables: $item_name_1; $item_name_2; $item_name_3; $item_name_4; $item_name_5; All of them should be empty. What is a true solution for this? ...

How to check a variable's value using a debugger in XCode

How do you use the debugger in XCode to see if a variable is nil? ...

run jQuery on variable and not on document

Do you know if it's possible to run jQuery on a variable that contains html and not just on the document itself. Example: bg.inspectorGetRawHtml = function(){ var c = jQuery("#bg-admin-inspect-wrapper").html(); jQuery(".bg-admin-inspect-state", c).remove(); console.debug(c); } So bascially, reading a segment of the pages ...

Sharing class variables between the instance and the class itself when extended within a module

I'm trying to figure why this code: class BaseClass end module Extensions def self.included(base) base.extend(ClassMethods) end module ClassMethods def message(message) @@message = message end end end BaseClass.send(:include, Extensions) class ExtendedClass < BaseClass message "hello world!" def say_me...

PHP Variables with the same name

I am trying to integrate my login system made with PHP with the PHPBB Login system. My problem is that I am including the PHP login document which contains a class called $user but my login system uses $user as well. e.g My function for login is executing inside a class called $user and the phpbb login class is $user->login Is it possib...

Noob at Xcode and Objective C, trying to understand global variables, and switch statement

Hi! I'm new to this so please excuse my presumably simple questions. Hope you'll be able to help me out quite easily! I'm making an app that uses 4 variables to calculate the amount of water recommended for the user. The problem with this switch statement is that no matter what value i set age to, it always does the last case. Why is thi...

how to use a variable in various JPanel?

Hi, I’m new in Java. I use alternately various JPanel in a JFrame. And I would like to know how can I use a variable declared in a JPanel, in another JPanel? Thank you for your collaboration. Best regards. Daniel ...

Getting a value from an object php

Hi. I used var_dump on an object in my code. print var_dump( $$user); result: object(stdClass)#35 (1) { ["user1_ready"]=> string(1) "0" } How do I get to this value (0 in this case). I tried print $$user which resulted in Catchable fatal error: Object of class stdClass could not be converted to string in I need something like if($...

how to convert -1 to 1 with javascript ?

how to convert -1 to 1 with javascript ? var count = -1; //or any other number -2 -3 -4 -5 ... or var count = 1; //or any other number 2 3 4 5 ... result should be var count = 1; //or any other number 2 3 4 5 ... ...

Why is the variable's value not substituted in the string ?

Hai, can anyone help me... When I write like: $file=file_get_contents('https://graph.facebook.com/me?access_token=1932993|twetrg|vsfgsewr'); the code gets response as well good. but when I write like: 1. $tk=''; 2. $tk='1932993|twetrg|vsfgsewr';//intialize the token value to variable 3. $file=file_get_contents('https://graph.faceb...