variables

How do I get SQL SELECT @variable = expression assignments to work like a spreadsheet?

Disclaimer: This is an "asked-and-answered question" posted in accordance with the FAQ statement that it's "perfectly fine to ask and answer your own programming question". Its purpose is to encourage members of the SQL Anywhere programming community to use StackOverflow by seeding the "sqlanywhere" tag with some real-world content. Edit...

Python - checking variable existing

Hello, i want to check whether variable exists. Now I'm doing something like this: try: myVar except NameError: # Doint smth Are there any other ways without exceptions? Or is that part of code right? ...

How to combine variables with Jquery?

Hey Guys, Got the following code: $(document).ready(function() { $('a.add-item').click(function() { if ($(this).parent().find('input').attr('value', '0')) { $(this).parent().find('input').attr('value', '1') } }); }); What I would like to do is to create a variable and increment it and...

How to set default values for Tcl variables?

Hi, I have some Tcl scripts that are executed by defining variables in the command-line invocation: $ tclsh84 -cmd <script>.tcl -DEF<var1>=<value1> -DEF<var2>=<value2> Is there a way to check if var1 and var2 are NOT defined at the command line and then assign them with a set of default values? I tried the keywords global, variable,...

How to create dynamic variable vbox in actionscript

Hello, I have to create several vbox-es in a for each loop. Now I want to do something like this. formsArray["vb"+counter] = new VBox; formsArray["vb"+counter].visible = true; add labels etc. I can't get this thing to work. Anybody any idea how to create dynamic variable names for my vbox-es? Thanks ...

Variable scope in onclick attribute with Javascript

Hi, I'm using Prototype and trying to dynamically access a variable in a loop. Code speaks better than me : for (var i=0;i<5;i++) { $('parent' + i).insert('<input type="button" value="Cancel" onclick="$('parent' + i).remove()" />', {position: 'after'}); } The problem is that "i is not defined" when I click on any of the Cancel bu...

dynamic class property $$value in php

How can i reference a class property knowing only a string? class Foo { public $bar; public function TestFoobar() { $this->foobar('bar'); } public function foobar($string) { echo $this->$$string; //doesn't work } } what is the correct way to eval the string? ...

Tweening a value in Lua

How'd I go about this one? I want to tween a value from one to another in x time. While also taking into account that it'd be nice to have an 'ease' at the start and end. I know, I shouldn't ask really, but I've tried myself, and I'm stuck. Please assume that to cause a delay, you need to call function wait(time). ...

jquery: Variables return NaN

Hello. Don't let below code scare you away. The question is really simple, only two lines are making trouble: Why do my code generated a NaN error code? I am trying to substract one variable value from another so position of elements will be correct. The variables got their value from jQuery position() which is supposed to be integer ...

How to check a not defined variable in javascript

I wanted to check whether the variable is defined or not. eg alert( x ); Throws a not defined error How can I catch this error? ...

Which variables are initialized when in Delphi?

So I always heard that class fields (heap based) were initialized, but stack based variables were not. I also heard that record members (also being stack based) were also not initialized. The compiler warns that local variables are not initialized ([DCC Warning] W1036 Variable 'x' might not have been initialized), but does not warn for...

iterate over properties of a php class

How can i iterate over the (public or private) properties of a php class? ...

How to change class variable in Javascript?

PROBLEM SOLVED. Special thanks to Andrew Noyes for explaining its not a class but a Object Literal Notation. What a noob am I.. EDIT: SORRY, i made a mistake in my js file, the structure of my js is like this: (I am totally new to javascript, i need your guys help here...) var className = { settings : { setA : true, setB: ...

How do I print a SET command in a Visual Studio 2008 build?

I want to see all of the current environment variables during a build. I'd like to do this in the pre or post-build steps if possible because I don't want to edit the Targets file. This could print to the Output window or to a file. I've tried a number of different ways without success. I'm using Visual Studio 2008. Thanks! ...

PHP Pass variable to next page

Hello, it seems pretty simple but I can't find a good way to do it. Say in the first page I create a variable $myVariable = "Some text"; And the form's action for that page is "Page2.php". So in Page2.php, how can I have access to that variable? I know I can do it with sessions but I think it's too much for a simple string, and I do ...

Badge system and storing conditions as variables?

I'm trying to write a piece of code that checks a users stats, be that their points, rank or num_friends and in turn awards them a badge similar to that used in SO. The system is set so when a task (vote up, comment, etc.) is completed by a user, their user_id is recorded and queued to be evaluated at 5 min intervals by a cron job. Is ...

Bash. Test for a variable unset, using a function

A simple Bash variable test goes: ${varName:? "${varName} is not defined"} I'd like to re-use this, by putting it in a function. How please? Following fails # # Test a variable exists tvar(){ val=${1:? "${1} must be defined, preferably in $basedir"} if [ -z ${val} ] then echo Zero length value else echo...

String and Final

What is difference between in the following statements String name = "Tiger"; final String name ="Tiger"; Although the String class is final class, why do we need to create a String "CONSTANT" variable as final? ...

Gathering POST data from similar fields

I am posting a form that has many similar fields (artist1, artist2, .... artist20). I am trying to add them to a database but I am not sure how to easily get all of the posted data with out having to write out each one separately. How can I combine an int to a string so that I dont have to write each one out? This is one way I tried that...

use Img source with php variable?

hey guys, i have the following code in my detailansicht.php: <div class="file_description_box"> <b>Beschreibung:</b><br /><br /> <?php if(!empty($beschreibung)) echo '<div align="center">'; echo '<img src="$coverlink" alt="Cover">'; echo '</div><br />'; echo fo...