variables

What's the difference between %TMP% and %TEMP% in Vista environment variables?

On my computer, both points to the same location. Are those for backward compatibility issues only, or is there a real difference? ...

How is the memory allocation done for variables in scripting languages?

For example, in javascript I can say var x = 5; Later I can do x = 'a'; and then x = "hello"; So, how is memory allocated for the variables? As it is, all variables have a common type 'var' and values of variables can change at run-time as seen above. Isn't it a difficult task to allocate and manage memory for these variables?...

Weird behavior in referring to global variable. Is this a bug in javascript? Surely it isn't!

Consider the following piece of code. <html> <body> <script> var x = 5; //globally declared function showX() { alert("x="+x); //trying to display global value var x=10; //trying to create and initialize a local x } </script> <input type = "button" value="Show X" onclick="showX()"> </body> </html> The alert statement...

Regex for variable declaration and initialization in c#

I want to write a RegEx to pull out all the variable values and their names from the variable declaration statement. Say i have int i,k = 10,l=0 i want to write a regex something like int\s^,?|(^,?)* but this will also accept k = 10 i.e. (without int preceding it) Basically idea is If string starts with int then get the variable list s...

default value of a variable at the time of declaration in C# and VB ??

Can anybody tell me what is the default value of a variable at the time of declaration in C# and vb?? ...

ASP.Net Persisting Data Across the Application

How Can I persist a User-Specific data for an ASP.Net application. I tried Session Variable - Not good when the worker process recycles. I need something that can be accessed GLOBALLY by any class of my application. Advice most welcome. I tried to utilize asp.net session State Server but I got some DLLs crashing because they are Unse...

python variables not accepting names

I'm trying to declare a few simple variables as part of a function in a very basic collision detection programme. For some reason it's rejecting my variables (although only some of them even though they're near identical). Here's the code for the function; def TimeCheck(): timechecknumber = int(time.time()) timecheckdiv = backco...

How can you print a variable name in python?

Say I have a variable named choice it is equal to 2. How would I access the name of the variable? Something equivalent to In [53]: namestr(choice) Out[53]: 'choice' for use in making a dictionary. There's a good way to do this and I'm just missing it. EDIT: The reason to do this is thus. I am running some data analysis stuff where I...

Javascript Variable Variables

I have a set of global counter variables in Javascript: var counter_0 = 0; var counter_1 = 0; var counter_2 = 0; etc I then have a Javascript function that accepts an 'index' number that maps to those global counters. Inside this function, I need to read and write to those global counters using the 'index' value passed to the functio...

Changing Variable Names in Vim

I am trying to read a lot of c/perl code through vim which contain many single letter variable names. It would be nice to have some command which could help me change the name of a variable to something more meaningful while I'm in the process of reading the code so that I could read the rest of it faster. Is there some command in vim...

VB.NET variable scope

Are variables declared in a case statement local to that case statement - For example, in the following code, is it safe to use z like this? Or is the compiler just placing z at the procedure scope? Select Case x Case 6 Dim z As Integer = 6 Case 7 Dim z As Integer = 7 ...

Does static typing mean that you have to cast a variable if you want to change its type?

Are there any other ways of changing a variable's type in a statically typed language like Java and C++, except 'casting'? I'm trying to figure out what the main difference is in practical terms between dynamic and static typing and keep finding very academic definitions. I'm wondering what it means in terms of what my code looks like. ...

When a variable goes out of scope does that mean it doesn't exist?

I'm not sure I understand scope - does an out-of-scope variable (I'm using Ruby) exist in memory somewhere or does it stop existing (I know you can't access it). Would it be inaccurate to say that an out-of-scope variable does not exist any more? Maybe this is a philosophical question. ...

Variables within app.config/web.config

I was wondering if it is possible to do something like this in the app.config or web.config: <appSettings> <add key="MyBaseDir" value="C:\MyBase" /> <add key="Dir1" value="[MyBaseDir]\Dir1"/> <add key="Dir2" value="[MyBaseDir]\Dir2"/> </appSettings> I then want to access Dir2 in my code by simply saying: ConfigurationManager.AppS...

Find the smallest value among variables?

Hi People :) I have from 4 up to 20 variables that differ in size. They are all of type float and number values. Is there an easy way to find the smallest value among them and assign it to a variable? Thanks ...

PHP/HTML - isset function

Hi I'm fairly new to PHP and am creating a website for my company. I am using some existing code that I have obtained but can't seem to make it work properly - any help would be much appreciated! I have a variable, $id, which identifies the product category type to display on the page. I first need to check that the id variable has bee...

Why can't I store a PHP class instance as a SESSION variable

I have a PHP script that is called in 2 ways from a Dojo Ajax xhrGet call. The first time it is called with an "init" argument which causes the script to create an instance of the StateList class and read in a file of state names. session_start(); @include('StateList.php'); require_once('phplog.php'); //start executing here $comd=$_GET...

html value set from javascript?

<script type="text/javascript"> var p = s.getMaximum(); </script> <form action="/cgi-bin/Lib.exe" method="POST" name="checks" ID="Form1"> <INPUT TYPE="text" NAME="inputbox" VALUE="VAR P FROM JAVA SCRIPT HERE?" ID="Text1"><P></form> Possible to pass the javascript value 'p' as the value of input form? Thanks. ...

How to create multiple objects in the same function but without overwriting each other?

I'm trying to create an object in a function, but I am running into the problem that variable names have to be defined at runtime. Is there something I can do like with arrays that allows ne to dynamically create a variable in a function and preferably give it a different name from the one created when the function was called last? ***I...

Problem getting Javascript variable to hidden input value

Hi, I'm trying to create a system where you can drag and resize divs (jquery ui) and then save the positions and sizes to a css file. I already got the system working with one div, but now that I tried to update the system to support multiple divs, I ran into a problem. The source: http://ezmundorf.110mb.com/problem.txt (It's ugly, but...