variables

What's the difference between theese two java variable declarations?

in java... public class someclass { private HashSet<Someobject> contents = new HashSet<Someobject>(); private Set<Someobject> contents2 = new HashSet<Someobject>(); } what's the difference? in the end it's both a hashset isn't it? the second one looks just wrong to me but i have seen it frequently used, accepted and working......

Undefined Variable error

Hi, I'm a newbie to programming in C, and I'm having trouble understanding the error that is coming up when I attempt to compile my program. I've got the following program, which is fairly simple and which my professor says is correct: #include <stdio.h> #define TRUE 1 #define FALSE 0 #define BOOL int extern int x; extern BOOL do_exp; ...

Which Language Uses '@' Encapsulated Variables

I'm trying to figure out how a rather large Java project works by stepping through it in the debugger on my Windows machine, but for it to get past its initialization routines all the values in multiple .properties files must be correct. Many of these .properties files include lines like: program.root=file://@program.root.dir@ It woul...

naming variable in mathematica with an algorithm

I'd like to generate definitions of variables using an algorithm. For example: i'd like to run a loop that does the following p=p1 p^2=p2 p^3=p3 so for p^i i'd like to define a variable pi (i is a number). ...

Python Variable References Tutorial

I need to explain how Python variables are references to objects to a collegue. E.g., how changing the value of an object in one place changes other variables that reference it. I remember reading a wonderful tutorial on that a long time ago. It had diagrams with lines connecting the variables to the objects and showed how those conne...

Making global var from inside a function in PHP

Hi, I am trying to define dynamically variables. I am using a function for this, but I don't know how to define the new var as global (because it never created before the function). is that possible ? Thanks. edit ok, this is what I've built. is it that dangerous ? function extract_values($row) { foreach ($row as $key => $val...

jquery variable as div ID or class

var $name = ('div#amuchlongername'); $('#wrapper').prepend('<div id="$name"></div>'); Obviously I know this code is wrong lol, but I'm fairly knew to jQuery and I can't seem to find anything about this. How would one go about achieving a variable name inside a div id? ...

Where is my variable ? objective-c

I initialize a view(Image) through: Image *myImageView = [[Image alloc]init]; myImageView.myId = randomImageNumber; [myImageView initWithImage:myImage]; At the Image class I do a Log(LOG1) and get the previously set randomImageNumber. Later on, in the very same Class, I do a second Log(LOG2). Why does my second log have no va...

javascript - using a variable in getElementById

How can I use a variable in getElementById html: <td><a href="#" onclick='selectEditActivity("id3319201010153333");'>Click</a></td> javascript: function selectEditActivity(pass_id){ // this works alert(pass_id) // this works; var A = document.getElementById("id33192010101533333").getAttribute("seq"); alert(A); // b...

ColdFusion Arrays and Variables

Hey guys, I really am stuck here. I keep getting an error on this code and I have absolutely no idea why. Basically what I am trying to do is check a form for a field called quantity_# with # being a number. If it finds it I want to go through all those fields and add them onto a 2 dimension array so I can store the actual value of that ...

Setting a Variable Once... I don't Know How to Explain (Android Projgramming)

This is kind of hard to explain, so i'll try the best I can to inform you on my problem. I have a variable that changes every now and then. In the main app activity i have int count = 0; (count is the variable) I would like to only set that at the very beginning. The first time a viewer opens it up I want to set it to 0. After that, I...

Saving Variables (Android)

I have a variable that I would like to save and be able to restore when the viewer opens the app back up. I call this variable, count private int count=0; It changes every now and then through out my main activity. How can I save this after editing and changing it and be able to restore it? ...

Problem saving shared preferences in Android

Right now I am trying to save a variable when i close the app and get the variable back when i open the app back up. I have no idea if I'm doing this right. My variable is called count and would like to save and restore it. Is this right? If so, why isn't it working? If not, what do i need to change? (i'm obviously using SharedPreference...

Order form with jQuery Calculation plugin using variable pricing

Greetings, I am trying to code a solution for an order form pricing calculator using the excellent calculation plugin. My form has two different prices for each item, one for quantities under 10 and one for quantities over that amount. This is the code I have so far: $(document).ready(function() { // bind the recalc function to t...

C: Which is faster, accessing global variable or passing a pointer to the function

I am currently rewriting one of my programs. It has a heavily recursive function which solves peg-solitaire: int solve(int draw){ if(finished()) return true; //loop over every possible move (about 76 long long values) //do a move (access the board, which is a long long value) if(solve(int draw + 1)) return true; retu...

Recycling variable name within single function

I have a function that contains two for loops, and I'm using a variable called count as the counter. I've chosen to recycle the name as the the first loop will finish it's execution completely before the second one begins, so there is no chance of the counters interfering with each other. The G++ compiler has taken exception to this via...

Javascript variable scope in event

I have this web application where users are able to fill out and submit reports. The reports and scripts are part of a whole system, that is, they are used on a couple of different clients written in both vb and c#. This is the web-version of those clients. The scripting language is javascript and is executed using different script engi...

Variable Global Scope understanding questions

Hey, my question is actually one of understanding - I have a working solution, I just don't understand how it works. Okay, so - what I'm trying to do is adding a setTimeout in a loop, and passing a changing value through it. Example: for (i=0;i<11;i++) { setTimeout("alert(i)",1000); } If I understood correctly, this doesnt work...

Rails passing @variable from one show page to another

I have a Gallery application that has Album and Photo models. I have the user search in the Album's show view (search in the specific album) and I store the results in a variable named @search in the show action of the controller. I want to pass this variable to the Photo model's show page so when a user clicked on a particular pictur...

Is it possible to build variable names from other variables in bash?

I apologise for the pretty terrible title - and the poor quality post - but what I basically want to do is this: for I in 1 2 3 4 echo $VAR$I # echo the contents of $VAR1, $VAR2, $VAR3, etc. Obviously the above does not work - it will (I think) try and echo the variable called $VAR$I Is this possible in Bash? ...