variables

powershell: expanding variables in file contents

I have a file template.txt which contains the following: Hello ${something} I would like to create a PowerShell script that reads the file and expands the variables in the template, i.e. $something = "World" $template = Get-Content template.txt # replace $something in template file with current value # of variable in script -> get He...

Validate text boxes against custom set variable

I have a form that I want to create whereby the user enters in one digit per text box. I need all those digits to be correct when the user clicks a button - imagine the iPhone Passcode lock feature. Ideally I'd like the button only to be clickable when all the digits are correct (perhaps with a variable I define) - otherwise it doesn't...

Python auto define variables

Hello everyone, I am new to programming and am learning Python as my first language. I have been tasked with writing a script that converts one input file type to another. My problem is this: There is one part of the input files where there can be any number of rows of data. I wrote a loop to determine how many rows there are but cannot...

In Flex, How can I prevent my variable from losing state after being set?

I've hit a very strange issue in adobe flex and I'm not sure how to solve it. I have a popup box that is called on creationComplete before startup of my main application. The popup simply asks for an email address and then the application is enabled showing the email address in a label component. However, when I try to access the email ...

Variables in a setTimeout function (jQuery)

Hi, I'm trying to use a jQuery statement inside a setTimeout function, but I don't get it to work. I tried a lot of variants, like this one (I'm using 'this' because the setTimeout is inside an each function, and the selector is cached/stored in an object, thus the $selector): setTimeout("" + this.$selector + ".val('" + this.savVal + "...

What is the smallest exact representation of 1/(2^x) that can be represented in the C programming language?

What is the smallest exact representation of 1/(2^x) that can be represented in the C programming language? ...

Visual studio 2005: is there a compiler option to initialize all stack-based variables to zero?

This question HAS had to be asked before, so it kills me to ask it again, but I can't find it for all of my google and searching stackoverflow. I'm porting a bunch of linux code to windows, and a good chunk of it makes the assumption that everything is automatically initialized to zero or null. int whatever; char* something; ...and...

Pass Javascript Alert a Value

I'm looking for a simple javascscript alert box. I need to be able to pass the alert box a string of text. Is something like this possible? My syntax is probably wrong. <html> <head> <script type="text/javascript"> function show_alert() { alert(my_string_here); } </script> </head> <body> <input type="button" onclick="show_alert()" va...

java inheritance resolution in case of instance methods and variables

Hi As per java, instance method resolution is based on runtime types of the arguments. But while resolving instance variable it uses different approach as shown below. Output of program is .. Child Parent ParentNonStatic Here First output is based on runtime types of the argument but third output is not. can any on...

issue with php sessions

i cant seen to get the php sessions to work, im trying to create a form that saves the data then put its against regular expressions to verify its legit information. at the moment im trying to figure out how to get the sessions to register but i cant figure it out, please help. im new to sessions <?php session_start(); ?> <!DOCTYPE HT...

MySQL Stored Procedures : Use a variable as the database name in a cursor declaration

I need to use a variable to indicate what database to query in the declaration of a cursor. Here is a short snippet of the code : CREATE PROCEDURE `update_cdrs_lnp_data`(IN dbName VARCHAR(25), OUT returnCode SMALLINT) cdr_records:BEGIN DECLARE cdr_record_cursor CURSOR FOR SELECT cdrs_id, called, calling FROM dbName.cdrs WHERE lrn_...

Why does Perl complain about "Use of uninitialized value" in my CGI script?

I am cleaning my Perl code for production release and came across a weird warning in the Apache error log. It says: [Thu Nov 5 15:19:02 2009] Clouds.pm: Use of uninitialized value $name in substitution (s///) at /home/mike/workspace/olefa/mod-bin/OSA/Clouds.pm line 404. The relevant code is here: my $name = shift @_; my $nam...

Using a changing variable in JQuery's nextAll()

Hi, With jquery, I'm dynamically adding rows. To do this, I'm copying the first of the table and then with some regex I'm changing the names and sometimes ids from thing like "column_name[0]" to "column_name[1]". This is the regex that I'm using: newRow = newRow.replace(new RegExp("\\[[0-9]+][\"\']", "gm"), "[" + $("#rowNum").val() ...

WIX: Howto set the name of the msi output file dynamically

I want to include some dynamic part in the filename of the msi file my wix projects produce. This dynamic part should be controlled by variables which are part of my wix project and are declared like this: <?define ProductVersion="7.1.0.1" ?> Does anybody know about a way of sending that value of that wix variable to the linker to use...

Using a pointer to a local variable in Dynamic SQL

I am having trouble with dynamic SQL. Early in my code I assign data to a bunch of local variables. I want to access these later in my code and use the data values. The code example below shows a simplified example to explain what I am trying to do. -- ---------------------------------------------- -- Declare and set the data into a ...

Getting an instance name inside class __init__()

While building a new class object in python, I want to be able to create a default value based on the instance name of the class without passing in an extra argument. How can I accomplish this? Here's the basic pseudo-code I'm trying for: class SomeObject(): defined_name = u"" def __init__(self, def_name=None): if def_n...

Javascript eval multiple variables does not work

Hello, I got an array which I iterate over and try to create a variable. The name of the variable is variable and comes from the array. So I am using eval (this code will only be used on my local computer) to create the variables. Weird enough I can create a variable and add plain text to the contents of it. But whenever I try to set a...

How to set mutiple words variable from command line input in C shell

I'm writing a script to search for a pattern in file. For example scriptname pattern file1 file2 filenN I use for loop to loop through arguments argv, and it does the job if all arguments are supplied. However if only one argument is supplied (in that case pattern ) it should ask to input file name or names, and then check for pattern....

PHP: unexpected T_VARIABLE error

Okay, I know this is a common enough question, but all the solutions I've found thus far have involved a missing semi-colon or curly brace, both of which I know is not the case for me. I have a class that works FINE with this variable assignment: session.php: <?php class session { ... var $host = 'localhost'; ... ...

what is shared variable in java

is there any concept of shared variable in java and if it is what is it? ...