variables

How can I assign the output of a function to a variable using bash?

I have a bash function that produces some output: function scan { echo "output" } How can I assign this output to a variable? ie. VAR=scan (of course this doesn't work - it makes VAR equal the string "scan") ...

Using the ternary operator to determine a variable is not null and assigning it to another

Is this an acceptable coding practice? public class MessageFormat { private static final Color DEFAULT_COLOR = Color.RED; private Color messageColor = DEFAULT_COLOR; public MessageFormat(Person person) { Color color = person.getPreferredColor(); messageColor = (color != null) ? color : messageColor; // this...

viewing session data on master page in asp.net

hey.. if i m keeping userid in a session how can i view this userid on the master page(like welcome user1)..across all the pages...??my master is designed using tables and i hv to view it in one of the rows.... thanx... ...

Knowing the availability of variables in crontab

What all variables BY DEFAULT are available if a script is executed by the crontab on UNIX Are .profile and oracle.env executed when the cron job is executed? ...

Is a variable binding to a collection item possible

Hello everyone, I'm trying to bind to an item inside a collection but the index for that item needs to be "variable". Take the following pseudo syntax for example: <TextBlock Text="{Binding Fields[{Binding Pos}]}" /> Is something like this possible? If my property Pos is 1 it should bind to the first item out of the collection "Field...

JavaScript Classes and Variable Scope

I'm relatively new to JS and I'm having issues properly emulating OOP principles. I guess I have two questions. Question the first is regarding the many ways to declare variables. Say I have a class: function clazz(a) { this.b = 2; var c = 3; this.prototype.d = 4; // or clazz.prototype.d = 4? } var myClazz = new clazz(1)...

Variable assignment in JavaScript

hi Friends, I have a js function I want to assign a variable to a variable my variable is in a forloop I have two variables ie; var spcd_1= "http://www.colbridge.com"; var spcd_2 = "http://www.google.com"; below is my js function function openNewWindow(spcd) { //alert("hello"); var tt = spcd; alert(tt); var i=0; var spcd_1= "htt...

How to share variables across scripts in python?

The following does not work one.py import shared shared.value = 'Hello' raw_input('A cheap way to keep process alive..') two.py import shared print shared.value run on two command lines as: >>python one.py >>python two.py (the second one gets an attribute error, rightly so). Is there a way to accomplish this, that is, share a ...

How to determine if a string is a valid variable name?

I'm looking for a quick way (in C#) to determine if a string is a valid variable name. My first intuition is to whip up some regex to do it, but I'm wondering if there's a better way to do it. Like maybe some kind of a secret method hidden deep somewhere called IsThisAValidVariableName(string name), or some other slick way to do it tha...

Concatenating Variable Names in C?

Is it possible to concatenate variable names in C? Specifically, I have a struct that contains 6 similar variables in it called class1, class2, class3, etc. I want to run through a for loop to assign each variable a value, but I can't see how to do it without somehow concatenating the variable name with the value of the for loop counter...

String & variable Help needed - iphone sdk

Hey guys, I have this quick problem I need to solve. I have a string here like so: textbox.text =@"Your name is" then I want to add right after "your name is" a variable that displays text. so in Visual Basic I learned it like this... textbox.text =@"Your name is" & variable1. but now i can see that it doesn't work like that in c...

IPhone SDK - Passing Variables between views with animations

Hi I'm new to the IPhoneSDK so please bear with me. What I'm basically trying to do is I have one view with 10 buttons, named 'one' to 'ten' respectively. What I want to happen is that when I click on a button (eg: 'nine'), it'll go to another view, with animation, then on that next view, there's a label that will display the text corre...

overwriting a specific line on a text file?

Hello again,how do I go about overwriting a specific line on a text file in c?. I have values in multiple variables that need to be written onto the file. ...

how to pass variables inside one page

Hello, I want to know how to pass variables from a form to a php page. Thanks. Edit: I have some input and a submit button in a form. I want my php page to search the database and display a relevant table after I click the submit button. And all the actions here are in one page. So I want to know how to pass variables from a form...

Makefile: ifeq directive compares special variable to constant does not work

Hi're, I have a little issue with my Makefile. I want make to change commands regarding the working directory. I added a conditionnal directive to the rule testing the current target's directory ($(*D)). The thing is that make always goes to the second branch of my test, even when my file is in mySpecialDirectory and echo indeed prints...

How to convert variable name to string in c#.net?

public new Dictionary<string, string> Attributes { get; set; } public string StringAttributes = string.Empty; public int? MaxLength { get; set; } public int? Size { get; set; } public int? Width { get; set; } public int? Height { get; set; } protected override void OnInit(EventArgs e) { Attributes = new Dictionary<string, string>()...

Can you declare a variable in ASP classic like this?

I am trying to see if this can be done in classic ASP: Dim myVar myVar = <<< END <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>test</title> </head> <BODY> END I can do this in PHP, but I am not positivte if it can be done in ASP. Problem is I need to handle the HTML output via a variable, and I...

variable initialization

If I am getting an error on a function that a variable opcode may not have been initialized, should this be done inside this method or in the beginning of the class. private void compileDo() { int endLabel, endLabelLoc, topLabel, opcode; accept("do"); accept("("); compileExpr(); accept(")"); ...

Pass variable from image to next page

Hey I have dynamic image begin created with imagecreate(), and I have random values being produced, and I want to pass that random number, to a variable, and use that variable inside the page where Im using the image source. The image is on random.php, and Im using <img src="random.php" /> on page index.php if that matters, and I want ...

Query a template for the variables it needs?

I'd like to be able to instantiate a template from a file (presumably using the django.template.loader.get_template(filename) ), and then determine the set of variables that should be defined in whatever context it is passed. I thought there would be a method on the Template object, but there doesn't seem to be. I read the docs, and t...