variables

XSL: Assigning the result of position() to a variable

I am trying to assign the position of an element like this: <xsl:variable name="offset" select="ancestor::myparent/position() * 8"/> I am trying to show the result of the calculation in the output, so using a selector is not enough. xsltproc generates the following error: XPath error : Invalid expression ancestor::myparent/position()...

If-statement: how to pull 2nd GET variable

How do I get this to pull my 2nd variable? (I already have a switch setup) <body id="<?php if (! isset($_GET['page'])) { echo "home"; } else { $_GET['page']; echo $page; } ?>"> I have a switch statement that pulls the pages from index.php?page=##### and I have just added this part to my switch: index.php?page=####&section=#####...

Java: Checking contents of char variable with if condition

Hello, I have a char variable that is supposed to contain either a Y,y,n or N character, I want to test if it does not contain it, then display an error message and exit the program. This is the code I am using; if (userDecision != 'Y' || userDecision != 'y' || userDecision != 'n' || userDecision != 'N') { Syste...

python: inserting a variable value into a variable name

I would like to insert the value of a variable into the name of another variable in python. In a shell script this would be something like: for n in `more list` do var_$n = some_calculation done but I can't see how to do a similar thing in python. Is there a way or should I be using an alternative approach? thanks, Andy ...

Defining XSLT Variables dynamically using xsl:choose

Within my XSLT spreadsheet, I need to define an xsl:variable with one value or another depending on the value of an xml node. The code just below shows what I'm trying to do. I would like to define multiple variables this way. A major issue is that in order to choose a variable value based on the node value of each item, the choosing mu...

Parsing variables in and out of functions jquery

Hi, i'm sure this is just a simple one, but its got me stumped on a few different projects now.. i have to keep declaring my variables, and i'm sure there is a better way to be doing things. in the example below, i'm finding at the "#gender" stage "gender" is printing out fine, but "#age" stage "gender" is no longer defined &/or is not...

How can I stop PHP from replacing the variable everytime the form is updated?

Basic question - I have a text area with a submit button that is linked to the variable $ListItem. Further down the page I want to print $ListItem in a <li> and everytime something new is entered in the text area, I want to assign it a new variable ($ListItem2 perhaps?) and then print it below the previous one. With my current code, ...

c#: Variable types in delegate

Hi, I'm trying to break down the problem to a more simple description. I'm using an external class library, which exposes 4 base classes, all very similar, sometimes derived from each other. During the execution I'm called back on several delegate functions, all carrying an "object Sender", which contains the initial object of one of t...

JavaScript removes slash from JSP variable

Have JSP variable ${remoteFolder} It's value is \\file-srv\demo Use jQuery embedded in this JSP. jQuery resolves ${remoteFolder} variable as \file-srvdemo ,i.e. one slash is removed. How to remain initial value of this var? edited: when ${remoteFolder} is used inside form tag, that it resolved OK. edited2: JS part of JSP, slashes ...

Have a variable available for class __construct()

I am trying to pass a variable into a class so the __construct() can use it however the __construct() is called before any variables are passed to the class. Is there any way to send the variable before the __construct()? Here is the code: class Controller { public $variable; function __construct() { echo $this->variable; } } $ap...

Basic bash script variable declaration - command not found

This seems like such a simple question I'm embarrassed to ask it: test.sh #!/bin/bash STR = "Hello World" echo $STR when I run sh test.sh I get this: test.sh: line 2: STR: command not found What am I doing wrong? I look at extremely basic/beginners bash scripting tutorials online and this is how they say to declare variables... S...

Can the terms 'variable' and 'field' be used interchangeably in java?

While studying java with several books, none of them seem to make it clear when to use which term. Right now I understand it as follows: Variables are defined within a method, while fields are part of a class. ...

JavaScript variable value in element.append

$('#test-list').append($(document.createElement("li")).attr({id: data.msg})); $('#'+data.msg).append($(document.createElement("img")).attr({src: "kep.php?kep=upload/"+data.msg+"&w=180;&h=150;"})); Does not work, because of the $('#'+data.msg). param. I don't know how to fix it. I want to make a sub-element to the #test-list and name it...

How do I declare an external char pointer?

File 1: static char* const path; //GLOBAL int main() { path = FunctionReturningPath(); UsePath() } File 2: extern char* const path; //GLOBAL from file 1 UsePath() //function using global { something = path; } (Pseudo) Would like to use path in file 2. I'm defining the global within main in file 1, is that bad practice u...

Website: What is the best way to store a large number of user variables?

Hi, I'm designing a website using PHP and MySQL currently and as the site proceeds I find myself adding more and more columns to the users table to store various variables. Which got me thinking, is there a better way to store this information? Just to clarify, the information is global, can be affected by other users so cookies won't ...

How do I use the @ sign in Mysql?

A user on SO recently gave me this Query to put into MYSQL, but I don't know what to do with the @ sign. SELECT user_id, GLength(LineString(utm, @mypoint)) FROM users WHERE MBRWithin(utm, LineString(Point(X(@mypoint) - 20, Y(@mypoint - 20)), Point(X(@mypoint) + 20, Y(@mypoint + 20)) AND GLength(LineString(utm, @mypoint)) <...

How sort elements and store them in a variable, XSLT

Hello everyone, I was wondering whether it's possible to sort some elements first and store them (already sorted) in a varible. I would need to refer to them thought XSLT that's why I'd like to store them in a variable. I was trying to do the following, but it doesn't seem to work <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/...

Are there any length limits on PHP echo?

Hi, I have this script that fetches some data from mysql and then uses echo to output it. But, as the page have grown and gotten longer all of a sudden i have this weird behavior where it cuts of the end at 65535 chrs (when using strlen to check) The data is all saved in MySQL, beyond the 65535 chrs showing when using echo. EDIT: Sorry,...

Is there something in PHP similar to Option Explicit in VB

I am doing a big project in PHP. In PHP you do not need to declare variables. This is causing a lot of problems for me. In Visual Basic 6, the Option Explicit statement makes it mandatory to declare variables. Is something similar available in PHP? ...

Javascript/Jquery: using a variable in the css-property of animate

Hi! Why does this work: <something>.stop().animate( { 'top' : 10 }, 10 ); but this doesn't: var thetop = 'top'; <something>.stop().animate( { thetop : 10 }, 10 ); To make it even clearer: At the moment I'm not able to pass a css-property to the animate function as variable. Thank you! ...