FAQ Database Discussion Community


Django : How to hide a variable in a template

django,variables,templates
I have a template with a tree Ceramic Composite Metals general I want to hide general I wrote {% for category in object_list %} {% if category != "general" %} <li class="closed"><span class="folder"><a >{{ category }}</a></span></li> {% endif %} it does not work What is the error...

How to use Dynamic Variables?

excel-vba,variables,dynamic
Alright what did I do wrong? Found this on the web, tried it and got a type mismatch. Just trying to make my code more concise by having the variables define themselves, for e.g. Y(10), Y(11), Y(12), Y(13), or Y10 ... Y13, so I'll have 4 variables at the end...

PS pipe WorkingSet as variable

variables,powershell
I have this which gives me the WorkingSet memory usage I'm after: $mem=Get-Process spiceworks | Select-Object Name,@{Name='WorkingSet';Expression={($_.WorkingSet/1KB)}} But I'm looking to only have the actual amount as the variable so I can then work with that to monitor it. I want to set it so it alerts me if it...

Create variable execution time Java [on hold]

java,variables
Is possible to do in Java something like this? : System.out.... -> ask for a string Store this string Create a variable with the name of this string Thank you very much!...

Calling a variable in Matlab without using the full name? [closed]

matlab,variables,filenames
I am creating a script to be universal in opening pre-made Data files that hold the same basic information, but the original files are not consistent in how they are named. An example, the same variable has 3 different variants in the different files: Data01.SubData Data01.SubData_01 Data01.SubData01 Is there a...

JMeter 2.10 Random Variable that gets data from string

variables,random,jmeter
I have 1st thread group that GETs some id's and writes it to the variable. This var has view like that "654564546,564564,56454,56456454,21231321,8972341,65423187". I need to pick up randomly one of the id and put it to the another variable. In jmeter 2.07 I used this code: import java.util.Random; String[] erroridcox...

Java Variable Scope - Instance and class variables

java,variables
I am new to Java and trying to learn by myself. I wrote the below code and I was wondering why the output is not as I expect. Below is the code I have written: public class Roughwork { public static int classVar = 25; public void getValue(int a){ classVar...

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

javascript,php,jquery,variables,get
I am new to PHP and hope someone can help me with this. I have a page (index.php) where users can select a language. If no language is selected than the page URL is just index.php which defaults to English. If they select a language than the page gets reload...

Matches in a string in Java

java,string,variables,match
I have this code: String string = "40' & 40' HC"; if(string.matches("&")) System.out.println("Found"); But the condition won't be true. why? Help is appreciated. Thanks...

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

variables,gnuplot,curve-fitting,data-fitting,function-fitting
Initial Question (Partially Answered) I am using gnuplot's fitting routines to fit a function to some data, and extract a "characteristic decay time constant". (I call this parameter d in my fitting function.) I have used the script code set fit quiet to prevent reams of text being printed to...

Matlab - Constructor doesn't initliaize member values

matlab,variables,interface,constructor
Dear lovely community, I already looked in Google and in the forum and also found some interesting posts. But in the end I still didn't get it worked. So, I am going to post the question here. I know in Matlab are already get/ Set methods implemented, but I am...

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

php,variables,preg-match
So I currently have this php code preg_match('/^([^.!?]*[\.!?]+){0,**3**}/', $text, $abstract); Instead of the number 3 I would like it to be a variable example > preg_match('/^([^.!?]*[\.!?]+){0,**$variable**}/', $text, $abstract); Please help thanks a lot :)...

Undefined local variable post

ruby-on-rails,ruby,variables,undefined,local
I write this code: <% @user.posts.each do |post| %> <%= render 'post', locals: { post: post, user: @user} %> <% end %> Then in _post.htm.erb I write follow code: <div class="post-title"> <img src="<%= @user.avatar.url%>" class="img-rounded post-image"> <h4 id="post-name"><%= @user.first_name + ' ' [email protected]_name %> </h4> <div id="post-date"><%= post.created_at.strftime('%d %b -...

Defining variable with multiple values in parentheses uses 2nd value [duplicate]

javascript,variables,parentheses
This question already has an answer here: Javascript expression in parentheses 2 answers Right so my question is: var x = (val1,val2); sets the value of x to val2; Why?...

AS3 Dynamic variable naming

actionscript-3,flash,variables,dynamic
Is dynamic variable naming like this possible in ActionScript 3? for (var xz=0;xz<10;xz++){ var this['name' + xz]:Number = xz; } ...

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

python,variables
For simplicity I'm try to do this. spam = [1,2,3] stuff = [spam] x = input() if x in stuff: print(True) else: print(False) As it runs: >>> spam False Of course it doesn't print 'True' because the string 'spam' is not equal to the variable spam. Is there a simple...

Java Pass-by-reference not working?

java,variables,reference,pass-by-reference
I'm trying to make this little game in Java but I seem to have stumbled upon a variable reference problem. My Entity class, which Player extends from, keeps a variable of type Dimension. This Dimension gets set via the constructor of the Entity class like so: protected Dimension dimension; public...

Maya MEL variables declaration and initialization

variables,maya,mel
Is it obligatory in MEL to initialize variables and especially strings when you declare them? I know that it is not necessary to initialize string arrays: string $buffer[]; $buffer[0] = "abc"; But what about strings and other variable types? Is it acceptably: string $str; $str = "abc"; Or should always...

read variable excel data into variant with the same format

excel,vba,excel-vba,variables,data-structures
I'm currently writing a Macro for Excel. First I want to read my variable settings from row 20 from my sheet "Filter" into my variable "test": ' 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) ' Read Data into variable test =...

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

linux,string,bash,shell,variables
I would like to extract the first letter of dashed separated words value of my bash variable, like this: MY_TEXT=this-is-my-custom-text I would like to create a second variable like this: MY_INITIALS=timct...

PHP global variable is not changing [duplicate]

php,variables,global
This question already has an answer here: PHP Pass variable to next page 7 answers I have problem with PHP and globals. In this code: at the page starts, the result is: Test 123. After click in: ListBox1Click the result is: XXXXXXXX. After click in: ListBox2Click the result is:...

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

windows,variables,batch-file
Can anyone tell me how to take name from specific file with specific extension (.pdf) and use it as variable? Thanks in advance...

Variable value assign and retrieve

c#,variables,properties
How does variable assigning (setting) and retrieve value works in the background? For example: { int myValue; myValue = 5; //here we assign value (set) Console.WriteLine(myValue); // here we retrieve value } So here we first declare value. In next line we assign value (does it work the same way...

Java: Assigning a variable its current value?

java,variables,optimization,value
If I have a string that is currently empty String s = ""; and reassign it s = ""; is it bad it I don't do it like this? if(!s.isEmpty()){ s = ""; } or will the compiler pick up on it and optimize for me?...

Writing PHP variable based on jQuery calculations and displaying predetermined value

php,jquery,list,variables,automation
Context: I'm trying to make an automatically generated list that has a different amount of items on each page. Each item needs a name and a link, based on its place on the list. Here's an example with two items for the problematic part: PHP variables: $item_link_1 = "link1"; $item_name_1...

Variable value changing after returning from a function in C

c,variables,matrix
I've been coding for my university where we are working with matrices and I can't find the error in the code that is changing the value of the variable where I save the columns of the matrix. I've tried debugging it and can´t find it, it simply ends the function...

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

vba,excel-vba,loops,variables
Cells.Find(What:="Run:1", After:=Cells(1, 1), _ LookIn:=xlValues, LookAt:=xlPart, _ SearchOrder:=xlByColumns, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) This is the code that I want to use, but I would like to loop it to find Run:1, Run:2, Run:3... Etc..., Is there a way to add a variable in a reference to find "Run:X"?...

Why is interface variable instantiation possible?

c#,variables,interface,instance
As far as I know, interfaces cannot be instantiated. If this is true, why does the below code compile and execute? It allows you to create a variable interface. Why is this possible? Interface: public interface IDynamicCode<out TCodeOut> { object DynamicClassInstance { get; set; } TCodeOut Execute(string value = "");...

Swift Reverse Geocoding using the Data

swift,variables,geocode
I am successfully getting the current address details based on my location. It printlns perfectly. What is throwing me is how I extract the data from this call. I have tried passing, say the ZIP/Postcode, as local and even global variables but with no joy. The data only seems to...

SQL Multiple LIKE Statements

sql,sql-server,tsql,variables,like
I'm currently working on a report that shows me all post codes covered by our sales team. Each team covers over 100 post codes. What i would like to do is create a report that brings back the clients within the post code. Currently my code looks like this. SELECT...

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

javascript,jquery,image,variables,cursor
When clicking (onmousedown or onclick) for example, I would like to change the variable of the trailimge in the javascript to another image. You see, I have an image (a hand) that is following the cursor coordinates. I am unable to code and change the current image to swap to...

Count variable Invalid Syntax [on hold]

python,variables,syntax
I'm back again with what you probably see as a stupid question. I have been working on a sim import random def main() game() def game(): suite_list() money = (100) count = (0) suite_list() card1 = random.randint(1,6) card2 = random.randint(1,6) card3 = random.randint(1,6) while user_money>start_bet: guess = int(input(""" Pick One!...

calling string as variable in python

python,string,variables
I created a class called SignalParam in python containing different properties (frequency, voltage, time, etc) I would like to create many instances of this type vars()['Segment'+str(segment_number)] = SignalParam() this line is working and i can create variables "Segment1", "Segment2", .... My question is: i would like to call those variabes...

Replacing a variable in vba powerpoint

vba,excel-vba,variables,powerpoint-vba
I am trying to replace and save an integer in VBA Powerpoint. I have a variable in 1 Subroutine named projectId. At the moment, the variable is set to 617. In another subroutine I am running a user input method that prompts the user for a new projectId and stores...

do while repeated region in variable php

php,variables
Trying to build contact page. I would like to be able to send multiple emails in one time. email addresses have been pulled in from database. I am managing getting them all with do while. However to add "bcc" all addresses I need them to be in one variable for...

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

css,variables,import,codekit
I'm using a .kit file to hold variables to make it easy to change up as a template. Importing the .kit file into my index.html file has no issues, but in order for the variables to also work in my css file, I have to import it there as well...

How to pass variable filename to python ete?

python,variables,tree
I am trying load newick string from a file using following code: filename = templist[1].lower().replace(" ","") + ".nwk" tt = Tree(filename, format=1) but getting following error: tt = Tree(filename, format=1) # Loads a tree structure from a newick string. The returned variable tt is the root node for the tree....

Run 3 variables at once in a python for loop.

python,loops,variables,csv,for-loop
For loop with multiple variables in python 2.7. Hello, I am not certain how to go about this, I have a function that goes to a site and downloads a .csv file. It saves the .csv file in a particular format: name_uniqueID_dataType.csv. here is the code import requests name =...

Prolog- singleton variable in branch warning

variables,prolog,singleton
Hello here is my code in Prolog: arc(a,h). arc(b,c). related_to(X, Ys) :- setof(Y, arc(X, Y), Ys). cut([H|T],Y) :- check(H,Y), T = [] -> cut(T,Y). check(X,Y) :- related_to(X,Xs), member(Y,Xs) -> write('There is a road'); cut(Xs,Y). When I am trying to run check(a,b) it doesn't run. I get the message Singleton variable...

Compiler modifying a variable without adressing it

c#,variables,dictionary
In my program I found that when asssigning a variable to another, modifying the first one, also modifies the second. Example: using System; using System.Collections.Generic; using System.Windows.Forms; namespace Dict_test { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void TestButton_Click(object sender, EventArgs e) { Dictionary<string,...

Javascript: Resetting variable value created by form

javascript,forms,variables
I've created a form whereby the user enters details which are stored in variables or calculated depending on user entry. When clicking the button, a message will be displayed showing a message with the cost variable. The form clears but the message remains. The problem I have is that the...

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

javascript,ajax,variables,var
I've been worrying about this for a while and I can't realize what's really happening. Explanation in code comments. There are 2 versions of an application, one of them throws weird results and the second one does the expected work. var id = "test1"; $.post("http://fiddle.jshell.net/echo/json/", {"data": "data"}, function(a) { alert(id);...

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

r,variables,csv,shiny
I am new to R and I am creating a shiny application to read a csv and filter data. I am reading the csv file, then creating dropdowns with a loop using the column names and the unique values: output$dropdowns <- renderUI({ if (is.null(x())) { return(NULL) } lapply(1:ncol(x()), function(i) {...

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

file,delphi,variables,assign
Is it possible to use a variable in the assignfile command? Eg. f : Textfile ; sFile : string ; {contains 'MyFile.txt' as content} ... cFileDir = 'C:\Users\User\Desktop\Data Engine\Data\Country' ; ... Assignfile(f, cFileDir + '\' + sFile) ; ... I appreciate your help very much. if it's unclear I'll edit...

Is it necessary to Initialize / Declare variable in PHP?

php,variables,initialization,declaration
This question's purpose is to only gain knowledge or information for me and many like me. So my question is: Is it necessary to Initialize / Declare a variable before a loop or a function? Asking this question is for my confusion because whether I initialize / declare variable before...

Access to class instance variable

ruby-on-rails,ruby,variables
How can I read a class variable? In my case I can't get value from variable. class MediaContentsController < ApplicationController @randomUsrId = rand(100) def create puts @randomUsrId end end ...

C passing terminal commands and print answer

c,variables,terminal
I am trying to execute a command in terminal and analyze the result, but i can´t get the output written in the variable. I have made an example code that shows my problem: extern char commandResult; int main() { char commandResult; commandResult = system("[ -f /etc/hosts ] && echo "Found"...

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

python,variables,placeholder
I'm looking for a way, to calculate strings, that might include variables. eval won't do the job, as I want to use undefined variables. I'm talking about a function, that would turn "2*3*x" to "6*x" for example. Is there a function for that? ...

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

flash,variables,scope,actionscript-2
Okay, so trying to not post 5 pages of information, I'll start with the following: In a movie clip, I have 3 keyframes. I'm trying to edit a textbox on each frame, but I've found previously that only the text box in the current frame is accessible. In an attempt...

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

javascript,jquery,variables,object,key
Perhaps someone can help me solve this. I'm pulling input elements' name and value out of a list like this simplified version: <ul id="options_set_1"> <li><input name="width" value="10" /></li> <li><input name="height" value="20" /></li> <li><input name="depth" value="5" /></li> </ul> The id of the ul and the names and values of the inputs...

Batch file %%i was unexpected at this time

variables,batch-file
I am trying to get a patch file to set a variable to the number of instances that are running for a particular executable but am getting this error: %%i was unexpected at this time Here is my code: for /f %%i in ('wmic process where name="chrome.exe" ^| find "chrome.exe"...

read Excel cells into Stata global as variables

excel,variables,import,stata
There are several panel datasets I'd like to join. The observations in these datasets are identified by an id variable and a variable identifying the time the observation was made. All datasets include some variables I need, some I don't need and never the same variables (excluding the id and...

Global variables, Jquery

javascript,jquery,variables,scope
I have the following code oss = $("#us"); mainLogo = $("#mainLogo"); container = $(".container"); $(document).ready(function(){ oss.hide(); oss.fadeIn(1000); mainLogo.hide(); mainLogo.fadeIn(1000); container.find("#images").hide(); container.find("#images").slideDown(); }) $(oss).click(function(){ container.fadeOut(); }) The problem I have is that I can't seem to access the variables outside. I've tried window.varName, just writing var infront etc. But the compiler...

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

bash,shell,variables
I wrote some bash before reading this popular question. I noticed the way I was doing things doesn't show up in any of the answers so I was curious if there is a danger/bug to my logic that I am not seeing. if [ ! $1 ] || [ $2...

Need Help in Python Variable updation (Pygame module)

python,python-2.7,variables,python-3.x,pygame
I am trying to increase my speed variable in my pygame code. But as i run this piece of code the speed remain 0.1 (if i press UP key) and 0 (else case). I am unable to debug this. Any help in this would be greatly appreciated. import pygame speed...

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

java,function,class,variables
I have a bunch of classes of various names and each has a performLogic function that accepts a number of preset parameters (always the same): public final class DoSomeAction extends SetupAction { public void performLogic(param1, param2... I want a way where I can call it like this: String actionName =...

Div with a simple variable height

javascript,html,css,variables,height
So, I want to make a div that has the height of a value I'm going to get from my database. To make it better do understand, the value is a the number of times a client has bought in the website. I'm thinking of a way to make my...

Javascript variable not acting global

javascript,variables
I'm just learning Javascript after starting out in PHP. I'm trying some basic stuff, but for some reason the below code doesn't act as I expect. I have researched it, and from what I can tell it should work. <script type="text/javascript"> showIndex=4; function test(){ showIndex++; alert(showIndex); } </script> I am...

Deleting unnecessary symbols from variable in Jmeter

variables,jmeter,trim,symbols,beanshell
I have variable as string in this view: ["564546","56454654","3123123","868987"] I need the script that deletes unnecessary symbols [ ] " and put it to another variable . (something like trim method) I assume it should be made in BeanShell pre-processor....

C# PictureBox variable in a class

c#,variables,picturebox
I was trying to make a struct with 2 variables, Double and PictureBox. People suggested that I should use class instead of struct. When I try to create the class. It won't let me add PictureBox card; it's just underlining it red. Any solution or reason why? or suggestion to...

How to change css image via php depending on weekday

php,html,css,variables
I have: <style type="text/css"> body{background: url(http://www.mydomain.de/img/<?php $day = strftime('%A'); if($day == 'Monday') echo 'montag'; elseif($day == 'Tuesday') echo 'dienstag'; elseif($day == 'Wednesday') echo 'mittwoch'; elseif($day == 'Thursday') echo 'donnerstag'; elseif($day == 'Friday') echo 'freitag'; elseif($day == 'Saturday') echo 'samstag'; elseif($day == 'Sunday') echo 'sonntag'; ?>.png) no-repeat fixed center top;} </style>...

VBA SUM Variable Range

excel,vba,variables,sum,range
I want a code to sum the Variable rows up if certain condition is met. e.g. If A12 is numeric and B12 is empty then insert a fomula in cell C12 to sum C3:C11. Then perform the same action at C22 and C30. The problem I have is don't...

Declare different type of variables using switch

c#,variables,switch-statement
I am trying to create a new variable based on a particular value received from a function. The variable can be of different classes. Here's what I am trying: switch (request) { case "ClassA": { var x = new ClassA(); break; } case "ClassB": { var x = new ClassB();...

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

java,variables
What happens if you change the variable b, or what if you change a. What does the order have to do with anything. I know count = count + 1 but the two variables is messing up my brain. b = 7; a = 7; a = b; a +=...

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

swift,variables,properties
class someClass { // This is a list of restaurant names var restaurantNames = ["Cafe Deadend", "Homei", "Teakha", "Cafe Loisl", "Petite Oyster", "For Kee Restaurant", "Po's Atelier", "Bourke Street Bakery", "Haigh's Chocolate", "Palomino Espresso", "Upstate", "Traif", "Graham Avenue Meats", "Waffle & Wolf", "Five Leaves", "Cafe Lore", "Confessional", "Barrafina", "Donostia", "Royal...

Get variable *value* instead of variable itself

javascript,variables
Look at this code: <button id="button">Test</button> <button id="button2">Test</button> <script> button = document.getElementById("button"); button2 = document.getElementById("button2"); var x = 5; button.onclick = function() { alert(x); } var x = 10; button2.onclick = function() { alert(x); } </script> When I click on both of the buttons, I get 10 as result. But...

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

php,variables,operators
Is there a way to define a php variable to be one or the other just like you would do var x = (y||z) in javascript? Get the size of the screen, current web page and browser window. var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var height = window.innerHeight...

How do I keep quotations in variable used with PHP string

php,string,variables
I am using a custom php query by submitting a custom search form. Everything works great except for if a string calls a name like O'Reilly, the search will come up with no results for O\'Reilly instead of O'Reilly. I am using the following to call the variable: $fullname=trim($_REQUEST["fullname"]); and...

Having two arrays in variable php

php,mysql,arrays,variables,multidimensional-array
i've this code, i'm trying to explode my date e.g "04 June 2015" to have the day and the month in other 2 variables, but i have all in a method, with an array, is it possible, my code doesn't work, it writes "Array[0]" why? while ($i < $number) {...

Pass variable from PHP into HTML [duplicate]

php,html,variables
This question already has an answer here: How do I add PHP code/file to HTML(.html) files? 7 answers I've got a simple .php file with Rock, Paper, Scissors game (some schoolwork) that tracks your score and a .html file with buttons to choose from R/P/S. Score is tracked via...

Declare a php constant within a php variable

php,string,variables,echo,constants
I have the following code: <?php $background_holder = echo get_bloginfo('template_directory');'/images/banner.jpg';?> background-image: url("<?php echo get_theme_mod('header_background_image', $background_holder;); ?>"); I'm trying to set a constant for the $background_holder and then add it to the background image variable. I'm sure I've just written something slightly wrong, but currently this does nothing....

Where are the local variables of an Android app stored?

android,variables,local
The Dalvik Virtual Machine (DVM) has a register-based architecture, as opposed to the Java Virtual Machine (JVM) which is stack-based. So I assume that the local variables of an Android app are stored in the registers. Am I correct? If not, please correct me. If yes, what kind of memory...

Better coding of making a check each time function runs

javascript,variables
I am trying to eliminate the useless check in a function, needed check variable is assigned at start-up of the app, so I don't want to check for it each time. I have a code like this: btnClose.addEventListener('click', function(e) { window.close() if (appSettings.sendAnonymousStats) { visitor.event("Application", "App has been closed.").send() }...

Return Variable From Method

c#,variables,return-value
I know how to pass variables to a procedure, but how do I return a variable to the calling procedure? For example, this is my syntax, no issue at all passing in the variable arr but how can I return the value nummmm back to Main? Please disregard the empty...

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

python,user-interface,variables,radio-button
I've been trying to create a simple RadioButton, but the issue is that both buttons already show up as clicked (they have the black circle inside of them when the GUI starts up). How would I fix this? this.myVar = StringVar() this.button1 = Radiobutton(this.root,text = "Small Boxes First",variable = this.myVar)...

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

variables,theory,nomenclature
I need to classify two different types of tasks as those that repeat, and those that do not repeat (i.e. the task self-destructs after it has successfully run, and never runs again). Right now, the former I am just going to call "repeat"; I was going to call the latter...

Increment Variable on horizontal UIScrollView slide

swift,variables,uiscrollview
How would I increment a variable when the user swipes to the right or left in my horizontal UIScrollView. For example; var pageNumber = 1 When the user swipes right it increments by 1 and when swipes left it decrements by 1 - Here is my scrollView code that is...

Calling PHP variable as function value

javascript,php,jquery,variables,sharepoint
I inherited a piece of code on our sharepoint site and understand it basically, but I am lost in the PHP. The code is an accordion: https://jqueryui.com/accordion/ And it takes a value of 1 or 0 to determine which is shown by default. I want this value to change each...

php form mail function

php,email,variables,concatenation
I am using a mail function to mail it to my email adress, but i want it to send me a message with variables in it. (I have tried to concatenate it with concatenation point, but it doesn't seem to work, or I did not use it right) The code:...

How exactly works the Javascript variable scope? [duplicate]

javascript,variables,scope
This question already has an answer here: What is the scope of variables in JavaScript? 13 answers I am pretty new in JavaScript and I have some doubts related to the variable scope. So I tryed to do this example: function outer() { alert("INTO outer()"); var val1 = 1;...

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

python,variables,directory
This question already has an answer here: How do I get the parent directory in Python? 12 answers I have a program in python that prints out information about the file system... I need to know to save the name of the parent directory to a variable... For example,...

MySQL multi SELECT query into form and then UPDATE

php,mysql,forms,variables,post
What i am trying to accomplish is Getting data from MySQL database into a table only containing rows where a user forgot to log in or out(done) Change the data in the table (done) Click submit and it updates all the data in the table into the MySQL database I...

Is there a variable type for comparators?

c#,variables,compare
Is there a variable type (something like string, int, or bool) for comparators? (==, !=, <=, >=, >, <) And if not, how does C# use them? I can use int integerVariable = 0; but is there something I can use to do comp comparatorVariable = ==; ?...

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 code showing here assigns the value of an variables to the text field I want to do the opposite of that. _Initial.text = [NSString stringWithFormat:@"%f", init]; The opposite of the code above. Please help...

Why does the variable executes the window object right away and not store it instead?

javascript,variables,global-scope
I would like to understand what's happening with the code in which a variable is not stored immediately, but instead executed first before it can be called. An example code can be this (in the global scope): var alertMe = alert("I\'m being executed then stored to be called again, but...

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

variables,powershell,powershell-v2.0
I got two variables, filled with: $Var1: Dog Cat Bird $Var2: makes wau makes miau makes beep How can I mix both of them like: $Var3 Dog makes wau Cat makes miau Bird makes beep $Var3 = $Var1 + $Var2 dosen't work...

Variable in html code

variables
I'm super new to html All I need is the code for a field where a User can type his Staff Number and then a button which takes him to a URL that is made up of his Staff Number somewhere in the path. Eg: The User enters '123' in...

XSLT filePath with document as variable

variables,xslt,filepath
I try to use a variable in the filePath, but it isn't working: BodyPart filePath="C:\\FileOutEmail\\($vpDocNr).xml" content-type="" content-id="" content-disposition="" multipart-type="" I also tried with the whole path in a variable without results: BodyPart filePath='$bestand' content-type="" content-id="" content-disposition="" multipart-type="" Is this possible, what is the right syntax?...

How to get value from property in BeanShell (jmeter)

variables,jmeter,beanshell
I have got several thread groups. I want to use variable from the first group. In second group this var should be used in BeanShell. So: in first thread group I created BeanShell Assertion with this code: ${__setProperty(erroriden, ${erroriden1})}; In second thread group I have BeanShell pre-processor. If has line...

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

php,function,variables,echo
I am new to PHP and hope someone can help me with this. I have the following function to which I can pass an itemID (unique integer) which it will then use to return the corresponding translation from a previously created array (this is just the final part). PHP function...

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

bash,shell,variables
For example: variable="version1" filename="Testfile_$variable" echo $filename variable="version2" echo $filename filename="Testfile_$variable" echo $filename produces the output: Testfile_version1 Testfile_version1 Testfile_version2 Why does it only changes the value of filename to "Testfile_version2" after explicitly reassigning a value to filename after changing variable? I would think when the second echo $filename is called it...

When are variables evaluated when passing them into functions?

javascript,function,variables,arguments
This is probably a simple question, but I would really like to know the answer. Are the arguments passed into a function calculated once and set as local variables or are they calculated every time they're used inside the function? For example: When you write a forLoop, you should set...

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

javascript,variables,escaping,quotes
I am setting up a link to Adobe's Aviary web app, which requires input in the following format: <a href="#" onclick="return launchEditor('editableimage1', 'http://www.mywebsite.com/IMAGE.jpg');">Edit!</a> I need to substitute a variable name for the IMAGE.jpg part of this, and I have tried to do this using the following code. Since the visual...

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

c,variables,constants
I was wondering if there is any way of protecting a variable for being modified once initialized (something like "constantize" a variable at runtime ). For example: #include <stdio.h> #include <stdlib.h> int main(void) { int v, op; scanf( "%d", &op ); if( op == 0 ) v = 1; else...

What is the scope of public variable in different methods of a same class in Console C#

c#,variables,scope
I have a class named Data that is used to retrieve a user's data class Data { public string firstName; public string lastName; public void getdata() { firstName = "ABC"; lastName = "XYZ"; } public static XDocument GetDataToXml() { var objget = new Data(); objget.getdata(); XDocument doc = new XDocument(...

subtracting from multiple variables at a time

python,variables,syntax-error
So recently I've ben interested in learning python, and I got the "Think python" last Christmas. Unfortunately I haven't had the time to really get into it because of my exams. Even though I the book was written for python 2 I decided to use python 3.4.3 anyway. This does...

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

jquery,arrays,variables,integer
Okay. This might be a little bit difficult to explain. Let's just say I have three variables in JavaScript window.seconds = 0; window.minutes = 0; window.hours = 0; and also three anchor tags in HTML <a id='seconds_plus' href=''>Increase seconds</a><br> <a id='minutes_plus' href=''>Increase minutes</a><br> <a id='hours_plus' href=''>Increase hours</a><br> Each time a...

SQL Repeated Condition in Two Tables

sql,variables,coding-style,condition
I am a beginner to SQL, and I am having trouble getting rid of repeated code. I have a condition "AccountId=20" that I use twice in a SQL query. The SQL looks something like: DELETE FROM Table_A WHERE FunctionId IN (Select FunctionId FROM Table_B WHERE AccountId=20); DELETE FROM Table_B WHERE...

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

php,html,variables,tabs
The below code is not showing similar results as other one : <?php $week = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); $k=0; while ( $k<= 6) { $t=$k+1; echo "<li>"; echo "<a href=#panel-".$t." data-toggle='tab'>".$week[$k]; echo "</a></li>"; $k+=1; } $a=1; echo '<div class="tab-content"> <div class="tab-pane" id="panel-"'.$a.'> <div class="alert alert-info" role="alert"> <a href="#" class="alert-link">'.$week[$a].'Bazaars</a> </div>'; ?>...

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

variables,foreach,ssis,source,ssis-2012
In SSIS 2012, I have a Foreach Loop and tasks within it to import data from a CSV file and then move the file to an archive folder. In the Foreach Loop Editor, there is a single Variable listed in Variable mappings: User::FilePath. The File System Task within the Foreach...