Menu
  • HOME
  • TAGS

Problems with Flash 8 (AS2), Timelines, and Variable Scopes

flash,variables,scope,actionscript-2

The issue is likely that your Text fields are being unloaded (eg There are frame where they are not on the stage anymore), so when frame 1 comes around, it re creates them (which gives them the text that you put in on the keyframe). To work around this, In...

Delphi - Use a string variable's name in assignfile()

file,delphi,variables,assign

Is it possible to use a variable in the AssignFile command? Yes. The second parameter of AssignFile has type string. The expression cFileDir + '\' + sFile has type string. FWIW, AssignFile is known as a function rather than a command. Getting on top of terminology like this will...

Pass variable from PHP into HTML [duplicate]

php,html,variables

You should generate your HTML page from PHP file too. That's how php works. That way you can print out PHP variables. HTML is no programming language - it's just markup language...like ...hmmm..XML.

JMeter 2.10 Random Variable that gets data from string

variables,random,jmeter

Your code looks good, the only possible failure point is your erroridcox variable not being set. Add a Debug Sampler and View Results Tree listener to double-check erroridcox and rnd_erroridcoxvariable values. Also you can put debug(); function at the beginning of your script and look into STDOUT to observe its...

How to create an variable property based on the other property in the class

swift,variables,properties

Declare restaurantIsVisited with the lazy keyword. This will insure that it isn't created until it is accessed the first time, and by that time you will be able to ask restaurantNames for its count: class someClass { // This is a list of restaurant names var restaurantNames = ["Cafe Deadend",...

Why is interface variable instantiation possible?

c#,variables,interface,instance

You're not instantiating an interface, but an array of that interface. You can assign an instance of any class that implements IDynamicCode<string> to that array. Say you have public class Foo : IDynamicCode<string> { }, you can instantiate that and assign it to an element of that array: var x...

SQL Repeated Condition in Two Tables

sql,variables,coding-style,condition

you can achieve it like this DECLARE @AccountId int; @AccountID=20; DELETE FROM Table_A WHERE FunctionId IN (Select FunctionId FROM Table_B WHERE [email protected]); DELETE FROM Table_B WHERE [email protected]; ...

Div with a simple variable height

javascript,html,css,variables,height

<?php $numberOfPurchases = getNumberOfPurchases(); // call the function that queries the database ?> <script> var defaultDivHeight = 10; var purchaseDiv = document.getElementById('purchaseDiv'); if (<?= numberOfPurchases; ?> > 0) { purchaseDiv.style.height = <?= numberOfPurchases; ?> * defaultDivHeight + 'px'; } else { purchaseDiv.style.height = defaultDivHeight + 'px'; } </script> I suggest...

What is the best nomenclature for a task that “only happens once” or a task that “repeats”?

variables,theory,nomenclature

Repeat is definitely going to work, although I would probably use iterate or maybe recurrent; if it could be confused with a loop. Ad hoc is not a good choice in my opinion. I would go for onetime or simply put a non- in front of the other word (non-iterating,...

When are variables evaluated when passing them into functions?

javascript,function,variables,arguments

My question is, if you wrapped the modifying methods in a function and passed objects[i] to the function, would objects[i] be calculated once and set as the local variable obj in the function? Yes. Once the value is passed, it's passed. It doesn't recompile the argument each time. Therefore,...

read variable excel data into variant with the same format

excel,vba,excel-vba,variables,data-structures

You could force test to be an array with only one cell, if the last column is B or less : ' Define Last Column with a value LastCol = Sheets("Filter").Cells(20, Sheets("Filter").Columns.Count).End(xlToLeft).Column Col_Letter = Split(Cells(1, LastCol).Address(True, False), "$")(0) If LastCol <= 2 Then ReDim test(1 To 1, 1 To 1)...

Declare a php constant within a php variable

php,string,variables,echo,constants

$background_holder is just a variable you're assigning a variable to, no need to echo. Additionally, seems like you're trying to concat '/images/banner.jpg' to some base directory. If this is the case, you'd need to use the concatination operator (.`): <?php $background_holder = get_bloginfo('template_directory') . '/images/banner.jpg';?> background-image: url("<?php echo get_theme_mod('header_background_image', $background_holder);...

How do I include variable between {} brackets in a php preg_match?

php,variables,preg-match

Use double quotes instead of single quotes, and the variable will be substituted: preg_match("/^([^.!?]*[\.!?]+){0,$variable}/", $text, $abstract); ...

Assign the value from a text field into an int variable to do some math with other variables and then return it?

ios,xcode,variables,textfield,assign

The opposite of that would be getting converting string to float. You can do it with this init = [_Initial.text floatValue]; ...

subtracting from multiple variables at a time

python,variables,syntax-error

Just move them to two separate lines if minutes >= 60: hours += 1 minutes -= 60 From PEP 8 Compound statements (multiple statements on the same line) are generally discouraged. For the sake of completeness, I will tell you that you can add ; to terminate a statement, so...

Prolog- singleton variable in branch warning

variables,prolog,singleton

TL;DR: Prolog is right. And you really are doing the best taking the messages seriously. You are using if-then-else in an unconventional manner. For this reason it is not that simple to figure out what is happening. When I say listing(check) I get the following: check(A, B) :- ( related_to(A,...

Get variable *value* instead of variable itself

javascript,variables

JavaScript has function scope for variables. If you want to use the same variable twice but it should not be the same reference, you need to put the code in different scopes (functions). So you could do this: button = document.getElementById("button"); button2 = document.getElementById("button2"); (function() { var x = 5;...

SSIS “Failed to lock variable” error in File System Task within foreach Loop

variables,foreach,ssis,source,ssis-2012

The issue turned out to be that the parameter for the import file path was being used where the User::FilePath was needed in the source Connection Manager.

Batch file %%i was unexpected at this time

variables,batch-file

If you are executing this directly in command prompt try this: for /f %i in ('wmic process where "name='chrome.exe'" get caption /format:value ^| find "chrome.exe" /c') do set var=%i for batch file left the double %...

Undefined local variable post

ruby-on-rails,ruby,variables,undefined,local

You need to use partial: when you pass locals to a partial as follows: <%= render partial: 'post', locals: { post: post, user: @user} %> I hope this will help you....

How to get value from property in BeanShell (jmeter)

variables,jmeter,beanshell

In the first Thread Group: props.put("erroriden", vars.get("erroriden1")); In the second Thread Group: String[] erroriden = props.get("erroriden").split(","); JMeterVariables scope is limited to the current thread group only JMeter Properties are usual Java Properties which are global for JVM instance See How to use BeanShell: JMeter's favorite built-in component guide for more...

Writing PHP variable based on jQuery calculations and displaying predetermined value

php,jquery,list,variables,automation

The problem your having is the difference between server-side processing and client-side processing. An easy way to think about this is that PHP is handled before the HTML is even put on the screen replacing all the PHP parts with their variable contents. meaning that adding that php text with...

Global variables, Jquery

javascript,jquery,variables,scope

The following piece of code does the same you are trying to accomplish. This way you declare the global variables: oss, mainLogo and container outside the scope of document.ready(). var oss; var mainLogo; var container; $(document).ready(function(){ oss = $("#us"); mainLogo = $("#mainLogo"); container = $(".container"); oss.hide(); oss.fadeIn(1000); mainLogo.hide(); mainLogo.fadeIn(1000); container.find("#images").hide();...

Javascript: Resetting variable value created by form

javascript,forms,variables

your function resetForm(){ document.getElementById("form").reset(); } should be function resetForm(){ document.getElementById("form").reset(); msg.innerText=""; msg.className=""; } basically: you are not re-setting #message back to hidden which is where you start. And, I am also making sure that innerText is blank. ...

PS pipe WorkingSet as variable

variables,powershell

Use Select-Object -ExpandProperty to grab just a single property from the process: $WorkingSet = Get-Process spiceworks |Select-Object -First 1 -ExpandProperty WorkingSet if($WorkingSet -gt 120MB) { # Send email } ...

C# PictureBox variable in a class

c#,variables,picturebox

A class would be easier, and I would also recommend using a List instead of array. Example: class Container { public PictureBox picture { get; set; } public double number { get; set; } } List<Container> PicturesAndNumbers = new List<Container>(); To add things to the list you will need to...

Call known function (with parameters) in class whose name is defined by string variable

java,function,class,variables

Your can use Reflection Object action = ???; // perhaps you need .newInstance() for action class // Hopefully you have a interface with performLogic String methodName = "performLogic"; try { Method method = action.getClass().getMethod(methodName, param1.class, param2.class); method.invoke(action, param1, param2); } catch (SecurityException | NoSuchMethodException e) { // Error by get...

How to pass variable filename to python ete?

python,variables,tree

Are you sure the format=1 is correct? According to documentation - for named internal nodes we will use format 1 Are you sure your newick tree has named internal nodes? If not, try without passing any value to the format argument. Also, please make sure that the filename is either...

How exactly works the Javascript variable scope? [duplicate]

javascript,variables,scope

The declaration in your "inner" function is missing the var keyword. That makes val2 a global symbol.

How to get the name of parent directory in Python? [duplicate]

python,variables,directory

You can get the complete file path for the script resides using __file__ variable , then you can use os.path.abspath() to get the absolute path of your file , and then use os.path.join() along with your current path , and the parent directory descriptor - .. in most operating systems...

Deleting unnecessary symbols from variable in Jmeter

variables,jmeter,trim,symbols,beanshell

It can be done via Beanshell PreProcessor as follows: Add Beanshell PreProcessor as a child of the request which needs "another variable" Put the following code into the PreProcessor's "Script" area: String yourvar = vars.get("yourvar"); String anothervar = yourvar.replace("[","").replace("]","").replaceAll("\\\"",""); vars.put("anothervar",anothervar); Change "yourvar" and "anothervar" according to your variables reference names....

Access to class instance variable

ruby-on-rails,ruby,variables

First of all, @randomUsrId refers to an instance variable, not a class variable. You can access it through an instance of the class, not direct on the class. For a class variable, you should use @@randomUsrId. What you are actually looking for is attr_accessor :randomUsrId, through this, you can read...

How to use Dynamic Variables?

excel-vba,variables,dynamic

Y10 cannot be the name of variable (because it could be confused with cell Y10). Code that attempts to use such variable names will not work. Try other name, for example y_10 will be fine.

MySQL multi SELECT query into form and then UPDATE

php,mysql,forms,variables,post

Success, I figured it out myself [= i had to add a row to the end of the table with the end value of $i <tr hidden> <td hidden> <input type="text" name="ivalue" style="width:120px;" Value="'; echo $i;echo '" style="width:70px" hidden></font> </td> </tr> Then this was in my <form action="senddata.php" file> i...

How to take name from file with specific extension and use it as variable in batch script?

windows,variables,batch-file

for %%f in (*.pdf) do ( set x=%%f ) echo %x% Assuming there's only one PDF in the current directory....

How to assign key to object literal when they keyname is represented by a variable?

javascript,jquery,variables,object,key

In the same way you already used it with optionSet1 – using the bracket notation: signState = {}; signState[optionSet1] = {}; signState[optionSet1][name1] = value1; ...

Is [ $var ] an acceptable way to check for variables set/empty in bash?

bash,shell,variables

./script one '' oops [ $2 ] will be false when $2 is the empty string. And as that other guy points out in a comment, bash will split both strings, opening up a range of issues, including potential security holes....

Variable in html code

variables

You need to create a form in html. Basically, a form is a block which let user input some values (text, password, email, date, integer, file, ...) and that send these values, once submitted through a submit button, to a certain file that will process these datas. A classic example...

How to change css image via php depending on weekday

php,html,css,variables

Instead of <img> place another div inside <div class="image center"> and place an image in its background depending on the day Like this <div class="image center"><div class="image1"></div></div> and your css will be <style type="text/css"> .image .image1{background: url(http://www.mydomain.de/img/<?php $day = strftime('%A'); if($day == 'Monday') echo 'montag'; elseif($day == 'Tuesday') echo 'dienstag';...

calling string as variable in python

python,string,variables

It's probably better to use a dictionary here. Define one with segments = {}. Then you can create a SignalParam by keying into your dictionary with your segment number: segments[segment_number] = SignalParam() and use the object like this: segments[segment_number].frequency = 33 ...

Compiler modifying a variable without adressing it

c#,variables,dictionary

What you are currently doing: Dict2 = Dict1; Is reference copying, so both Dict1 and Dict2 are pointing to the same location. You can create a new copy like: Dict2 = Dict1.ToDictionary(d=> d.Key, d=> d.Value); Remember, if your Key and Value are custom objects (based on some class), in that...

How can I use a variable to get an Input$ in Shiny?

r,variables,csv,shiny

input is just a reactivevalues object so you can use [[: print(input[[a]]) ...

Django : How to hide a variable in a template

django,variables,templates

In the template, {{ category }} is interpreted as Category.__str__() and a string is displayed. But in {% if category != "general" %}, category is an object that will always be different to the String "general". What you want to do is: {% if category.name != "general" %} Also, note...

Matches in a string in Java

java,string,variables,match

String string = "40' & 40' HC"; if(string.contains("&")) System.out.println("Found"); replace .matches with .contains, i believe you are trying to check for a character in the string....

Java Variable Scope - Instance and class variables

java,variables

ClassVar is declared static. public static int classVar = 25; This means that it is not tied to an instance of Roughwork. It is a global variable if you will. You can call this variable even from other classes in your application like this: Roughwork.classVar To get your expected behaviour,...

String concatenation not working in HTML declaration of TABS through PHP variables [closed]

php,html,variables,tabs

It looks like you are missing " //your code echo '<div class="tab-pane" id="panel-"'.$a.'>'; ///should be echo '<div class="tab-pane" id="panel-'.$a.'">'; ...

C passing terminal commands and print answer

c,variables,terminal

system doesn't return the output the command you run but simply returns the exit status. You probably want to use popen() to read the output of the command you run. See an example in the linked man page. You also need to use strcmp for comparing strings, not ==....

Calling PHP variable as function value

javascript,php,jquery,variables,sharepoint

I tried what MattyF and Venkat suggested, and I couldn't get it to work, and what I ended up doing was creating a solution using Java alone. var day = new Date().getDate(); var checkActive; if (day % 2 == 0) { // If the day number is Odd, we will...

Java: Assigning a variable its current value?

java,variables,optimization,value

the cost of calling the method isEmpty() (allocating new space in the thread stack etc) negate any gains. if you want to assign an empty String to the variable, its most efiicient to do so without the if statement.

gnuplot - get errors on fit parameters, get fit output values as variables, print variable to screen

variables,gnuplot,curve-fitting,data-fitting,function-fitting

Quoting the documentation: If activated by using set fit errorvariables, the error for each fitted parameter will be stored in a variable named like the parameter, but with "_err" appended. ...

Where are the local variables of an Android app stored?

android,variables,local

From https://source.android.com/devices/tech/dalvik/dalvik-bytecode.html: Because, in practice, it is uncommon for a method to need more than 16 registers, and because needing more than eight registers is reasonably common, many instructions are limited to only addressing the first 16 registers. When reasonably possible, instructions allow references to up to the first 256...

PHP global variable is not changing [duplicate]

php,variables,global

Your solution could look like this: <?php require_once("rpcl/rpcl.inc.php"); //Includes use_unit("forms.inc.php"); use_unit("extctrls.inc.php"); use_unit("stdctrls.inc.php"); //Class definition class Page1 extends Page { public $Label8 = null; private $someVar; public function __construct($application) { parent::__construct($application); //load from storage $this->someVar = $_SESSION['someVar']; $this->Label8->Caption = $this->someVar; } public function __destruct() { //save to storage $_SESSION['someVar'] = $this->someVar;...

Swift Reverse Geocoding using the Data

swift,variables,geocode

Your problem is most likely due to the fact that reverseGeocodeLocation is an asynchronous request made to Apple servers. What needs to happen is: You call reverseGeocodeLocation reverseGeocodeLocation finishes, starts its completion which calls a method passing the placemark you just recovered. In order to do that: @IBAction func btnInsertClicked(sender:...

PHP: How to use function to either echo result or to save it in a variable (partially working)

php,function,variables,echo

Just return the value in the function instead of echoing it: function fetchTransMain($trans, $itemID){ foreach($trans as $key => $val){ if($val["ID"] == $itemID){ return $val["trans"]; } } } Then, when you want to print it you do: echo fetchTransMain($trans, someID); Otherwise you do: $someVariable = fetchTransMain($trans, someID); ...

Better coding of making a check each time function runs

javascript,variables

Removing a single if statement, especially considering it only occurs once per click will not effect running time at all. However for the purpose of discussion say it was performance critical, like if it was attached to onmousemove, then you can adjust your second approach with a small change to...

Bind every line from two variables in a third variable in powershell

variables,powershell,powershell-v2.0

this is a rapid way (variables's lenght must be equal): $i = 0 ; $var3 = $var1 | % { "$_ $($var2[$i])"; $i++ } ...

Run 3 variables at once in a python for loop.

python,loops,variables,csv,for-loop

zip the lists and use a for loop: def downloadData(n,i,d): for name, id, data in zip(n,i,d): URL = "http://www.website.com/data/{}".format(name) #downloads the file from the website. The last part of the URL is the name r = requests.get(URL) with open("data/{}_{}_{}.csv".format(name, id, data), "wb") as code: #create the file in the format...

Variable value assign and retrieve

c#,variables,properties

You can look at the IL if you want. Here's a simple sample using linqpad: void Main() { int i ; i=5 ; i.Dump(); i_p = 6; i.Dump(); } // Define other methods and classes here public int i_p {get; set;} and here's the IL for it: IL_0000: nop IL_0001:...

SQL Multiple LIKE Statements

sql,sql-server,tsql,variables,like

WITH CTE AS ( SELECT VALUE FROM ( VALUES ('B79'), ('BB1'), ('BB10'), ('BB11'), ('BB12'), ('BB18'), ('BB2'), ('BB3'), ('BB4'), ('BB5'), ('BB6'), ('BB8'), ('BB9'), ('BB94'), ('BD1'), ('BD10'), ('BD11'), ('BD12'), ('BD13'), ('BD14'), ('BD15'), ('BD16'), ('BD17'), ('BD18'), ('BD19'), ('BD2'), ('BD20'), ('BD21'), ('BD22'), ('BD3'), ('BD4'), ('BD5'), ('BD6') ) V(VALUE) ) SELECT * FROM tbl_ClientFile...

jQuery - Increase integer by using arrays content as the variable name

jquery,arrays,variables,integer

Just change increase[0]++ to window[increase[0]]++ ...

Need Help in Python Variable updation (Pygame module)

python,python-2.7,variables,python-3.x,pygame

You are confusing the event KEYUP with the UP key. The event KEYUP occurs when a key (any key) is released. The event KEYDOWN occurs when any key is pressed down. In you code, this means that when the UP key is pressed down, the speed is set to 0.1,...

Maya MEL variables declaration and initialization

variables,maya,mel

You don't need to populate the variable, initializing it with a type declaration sets it to a default value (0 for ints, 0.0 for floats, and "" for strings). In general it's good practice to assign in place when the initial variable is meaningful: string $topCamera = "|top|topShape"; but it's...

Very weird behavior when using “var” keyword in an ajax request

javascript,ajax,variables,var

Cool, you discovered hoisting. MDN explains it as good as anyone: Because variable declarations (and declarations in general) are processed before any code is executed, declaring a variable anywhere in the code is equivalent to declaring it at the top. This also means that a variable can appear to be...

Variable value changing after returning from a function in C

c,variables,matrix

Update the function void allocate( int ***mat, int n, int m ) { int i; *mat = (int **) malloc( n * sizeof( int* ) ); for ( i = 0; i < n; i++ ) { ( *mat )[i] = ( int *) malloc ( m * sizeof( int...

read Excel cells into Stata global as variables

excel,variables,import,stata

I would recommend reading the variable names into a local, and use only global if strictly necessary. One way to do that is to use import excel along with levelsof: clear set more off // import from MS Excel and create local import excel using myvars.xlsx, cellrange(B2:B5) firstrow levelsof myvars,...

Python: Eval with undefined variables (2*x+x = 3*x)

python,variables,placeholder

You could use sympy for symbolic computation: In [126]: import sympy as sy In [127]: sy.simplify('2*x+x') Out[127]: 3*x To convert rationals to floats, use sy.nfloat: In [170]: sy.nfloat(sy.simplify('2*3+x+3/4')) Out[170]: x + 6.75 ...

VBA SUM Variable Range

excel,vba,variables,sum,range

Sub Test() Dim y As Variant Dim firstRow As Variant Dim lastRow As Variant lastRow = Range("C" & Rows.Count).End(xlUp).Row firstRow = Cells(lastRow, 3).End(xlUp).Row If IsNumeric(Cells(lastRow + 1, 1)) And IsEmpty(Cells(lastRow + 1, 2)) Then Cells(lastRow + 1, 3).Formula = "=SUM(C" & firstRow & ":C" & lastRow & ")" End If...

Is there a variable type for comparators?

c#,variables,compare

The various operators you've listed do not have a type no. Objects have types. You've listed operators, which are themselves not objects, and so have no type. If you're interested in how the C# language uses operators, you can look at the language spec; section 7.3 of the C# 5.0...

AS3 Dynamic variable naming

actionscript-3,flash,variables,dynamic

You should use an array for this kind of list of variables. While you can create properties dynamically, you usually want to avoid it. Especially in your case, where the actual identifier of each variable is not a String, but a number. So why not use something that does exactly...

Count variable Invalid Syntax [on hold]

python,variables,syntax

The specific error you are asking about is because of the missing colon: And card1 cannot be called. if guess==card1() count+=1 Should be if guess==card1: count+=1 There is also a missing closing bracket on the guess: guess = int(input(""" Pick One! 1:'Crown', 2:'Anchor', 3:'Heart', 4:'Diamond', 5:'Club', 6:'Spade', 0:'Quit', """)) ...

Javascript variable not acting global

javascript,variables

Remove the <a> and have the event on the image, it's refreshing the page. You don't need to have it wrapped in an <a> tag for a onclick event: <img src="_images/next.png" onclick="test()" width="100" /> ...

How do I use the Find function with a variable term, for example Run1, Run2, RunX

vba,excel-vba,loops,variables

Yes, you need a variable, and just concatenate it. Use something like this: Dim counter as long counter = 1 Cells.Find(What:="Run:" & counter, After:=Cells(1, 1), _ ...yaddayadda Or use it in a loop: For i=1 to 100 Cells.Find(What:="Run:" & i, After:=Cells(1, 1), _ ...yaddayadda Next i ...

Importing .kit file (variables) into .kit file (css)

css,variables,import,codekit

I figured out that the import tag inserted into a css document gets included into the first declaration because there is no end to it and it acts like it's part of the declaration. I simply put css comment tags on the import itself which allowed the variables to still...

Matlab - Constructor doesn't initliaize member values

matlab,variables,interface,constructor

Your constructor should be defined by function cObj = MeasurerComponent, without the PerformanceMeasurement prefix. This is just the way that packages are defined and used in Matlab - you add the prefix if using the class from outside the package, but not within the package (explained here: "Note that definitions...

Return Variable From Method

c#,variables,return-value

Just use the function itself to return the value. You do not need an additional output parameter. private static int runupdates(string arr) { updatestatement = ""; using (SqlConnection connection = new SqlConnection(SQLConnectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand(updatestatement, connection)) { command.CommandText = updatestatement; int nummmm = command.ExecuteNonQuery(); connection.Close();...

How do I create a RadioButton in my GUI in python?

python,user-interface,variables,radio-button

Use SetValue(self, False) to set it to unchecked. You can read more about it here

How to extract first letters of dashed separated words in a bash variable?

linux,string,bash,shell,variables

This isn't the shortest method, but it doesn't require any external processes. IFS=- read -a words <<< $MY_TEXT for word in "${words[@]}"; do MY_INITIALS+=${word:0:1}; done ...

php form mail function

php,email,variables,concatenation

As I mentioned in comments, you're overthinking this and there are a few simpler ways to go about this. Either by changing your whole block to: (no need for all those variables) $mail = " <h1> </h1><h2>Afzender:</h2><p> ( )</p><h2>Bericht:</h2><p> </p> "; then mail("$myEmail","$emailOnderwerp",$mail,... But, if you wish to continue using...

Java Pass-by-reference not working?

java,variables,reference,pass-by-reference

The problem is that you aren't updating the reference in your Player class. When you store your Dimension in your Entity constructor you are storing a reference to that Dimension in memory. In your resetOverWorld() method you change the overworld and activedimension variables to point to a new OverWorldDimension but...

PHP / JavaScript: How to pass variable from one page to another

javascript,php,jquery,variables,get

You can use cookies to do so setcookie(name, value, expire, path, domain, secure, httponly); i.e.: setcookie('language', 'german', 60000,"/"); and then check this wherever with $_COOKIE["language"] http://php.net/manual/en/features.cookies.php reference...

How do I keep quotations in variable used with PHP string

php,string,variables

If Magic Quotes is On It automatically escapes incoming data to the PHP script. This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. When on, all ' (single-quote), " (double quote), \ (backslash) and NULL characters are escaped with a backslash automatically. magic_quotes_gpc Affects...

do while repeated region in variable php

php,variables

Do can do it by iterating it into a while loop and concat it and adding a comma near to it. $CountingQuery = "SELECT * FROM users"; $ExecutingCountingQuery = $Connection->query($CountingQuery); $Bcc = ''; // Declaring a Variable while($row = $ExecutingCountingQuery->fetch_array()) { $Bcc .=$row['email'].','; } echo $Bcc; // Now $Bcc is...

PHP Define var = one or other (aka: $var=($a||$b);)

php,variables,operators

Update I've managed to create a function for you that achieves exactly what you desire, allowing infinite arguements being supplied and fetching as you desire: function _vars() { $args = func_get_args(); // loop through until we find one that isn't empty foreach($args as &$item) { // if empty if(empty($item)) {...

Why does $variable not return the most recently assigned value of variable in a shell script?

bash,shell,variables

Bash performs full variable expansion every time it is evaluating an expression. That is filename="Testfile_$variable" can be interpreted as Evaluate the expression "Testfile_$variable" performing variable expansion. Assign the resulting string to variable $filename. Therefore any further changes to $variable would not affect the value of $filename. You can somehow get...

Increment Variable on horizontal UIScrollView slide

swift,variables,uiscrollview

I'm assuming you can't use the paging property of UIScrollView. Contrary to the previous answer, you will actually need two different swipe recognizers. See http://stackoverflow.com/a/7760927/5007059 I understand that you want to detect swipes on the scroll view. To accomplish this, you could add two UISwipeGestureRecognizers to your scrollView, one for...

How to check for a variable name using a string in Python?

python,variables

>>> spam= [1,2,3] >>> stuff = [spam] >>> eval('spam') in stuff True DISCLAIMER : do this at your own risk. ...

Substitution of variable into link with many interior quotes - how to escape correctly

javascript,variables,escaping,quotes

Fix it to: <a href='#' onclick="return launchEditor('editableimage1','http://www.mywebsite.com/' + imgNamePassed);"/>LINK TEXT</a> Example: JSFiddle...

What code is required to swap a javascript variable (trailimage) to another when clicking within a website

javascript,jquery,image,variables,cursor

Try this Fiddle var trailimage = ["http://img2.wikia.nocookie.net/__cb20130626213446/elderscrolls/images/2/2d/TES3_Morrowind_-_Glove_-_Black_Left_Glove.png", "http://img2.wikia.nocookie.net/__cb20130626213454/elderscrolls/images/9/91/TES3_Morrowind_-_Glove_-_Black_Right_Glove.png"] $(function() { $(".logo").attr("src",trailimage[0]); $(document).mousemove(function(e) { $('.logo').offset({ left: e.pageX, top: e.pageY + 20 }); }); $(document).on("mousedown",function() { $(".logo").attr("src",trailimage[1]); })...

Is there any way of protecting a variable for being modified at runtime in C?

c,variables,constants

You can make the result of the input be const like this: int func() { int op = 0; scanf( "%d", &op ); if( op == 0 ) return 1; else return 2; } int main() { const int v = func(); // ... } NB. Of course, there is...

Create variable execution time Java [on hold]

java,variables

No. You cannot create a variable, at execution time, with a particular name. However, you can use a Map, which probably does what you want. The get method will look up an entry, and the put method will set an entry. Example: Map<String, Integer> myMapOfThings = new HashMap<>(); String nameOfThing...

Is it necessary to Initialize / Declare variable in PHP?

php,variables,initialization,declaration

PHP does not require it, but it is a good practice to always initialize your variables. If you don't initialize your variables with a default value, the PHP engine will do a type cast depending on how you are using the variable. This sometimes will lead to unexpected behaviour. So...

If a = b, what happens if each value changes respectively?

java,variables

What happens to b? Nothing happens to b. When you do a = b; you're copying the value stored in b and putting it in a. (You're not making a an alias of b.) When you then do a += 1; you're changing the value stored in a (and...

XSLT filePath with document as variable

variables,xslt,filepath

I am mostly guessing here, but supposing your XSLT stylesheet contains: <xsl:variable name="vpDocNr" select="'abc123'"/> <BodyPart filePath="C:\FileOutEmail\{$vpDocNr}.xml"/> then the result of this part will be: <BodyPart filePath="C:\FileOutEmail\abc123.xml"/> ...