variables

Javascript Global variables

Hello.Here is my code : <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt; <script type="text/javascript"> var toggle; toggle=1; function open(){ jQuery(window).bind("beforeunload", function(){$.post("logout.php");}) $.post("online.php",function(data){ $("#Layer6").html(data); }); } fu...

SQL server-declare local variable: "there is already an object named '' in the database"

hello, I wrote the following stored procedure, in which I use a local variable 'syncParam': declare @syncParam bit select isSync into syncParam from MyTable where id=@id if (@syncParam='True')... else ... return @syncParam When I executed this stored procedure at the first time it worked, but after that I get the following error:...

How do I make a function return the result of multiple variable types in C?

Just started learning C from Cocoa developing guide and I was wondering how (if at all possible) I would return the result of a function with multiple variable types. For example, I have a simple math function that I made to practice what I am reading and I gave it multiple variable types: #include <stdio.h> float doMath (int variable...

Javascript - returning a variable is failing

I'm trying to do something that should be pretty simple - but it's doing my head in. I can't seem to get a variable to return from a function var where; if (navigator.geolocation) { where = navigator.geolocation.getCurrentPosition(function (position) { // okay we have a placement - BUT only show it if the accuracy is lower than ...

Using variable from code behind in ASP.NET

I'm having a bit of difficulty setting a variable from the code behind and utilising it in the ASP.NET page (setting it as the value inside a textbox). My webpage simply errors and says it does not exist in the current context. The variable is declared and set all in the Page_Load method. Here is the relevant ASP.NET code. I assume you ...

Which one is better? "var" or "DataType"?

Hi In C# 4, which one is better or maybe faster for declaring a variable? var ds = new Class1(); OR Class1 ds = new Class1(); I myself believe that second one should be faster coz compiler doesn't need to look for the type Class1, but some addins like ReSharper always notify me to change Class1 to var. Can anyone explain me why? ...

how to use variable in a variable name

hi so i am working with a json variable like this: opponentInvData.item1 it contains items 1 through 6 i need to access the different items dynamically and set them to null. itemNum is the specific item i need to access. im trying to use the eval function var itemNum = 2; eval(opponentInvData.item + itemNum + ' = ""'); needless t...

jQuery - animate() properties

Hi I'm using jQuery's animate function like this: var css1 = { display: "block", marginTop: 20 }; var direction = "marginTop"; $(element).animate(css1, 150, 'swing'); Notice the marginTop property above. Well I want to replace that with the direction variable, but it doesn't work for some reason. Does anyone know w...

PHP - i expect some error about undefined object, but there is none, why?

Hi, The code is: error_reporting(E_ALL); $user->username = "new user"; echo $user->username; I expect some error or warning, but I get none - why? ...

What is the scope of a java variable in a block?

I know in c++ variables have block scope, for example, the following code works in C++ void foo(){ int a = 0; for(int i = 0; i < 10; ++i){ int a = 1; //re-define a here. } } but this snippet doesnt work in java, it reports "duplicate local variable a", does it mean java variables dont have BLOCK scope? ...

Dynamically creating local variables in Ruby

I have a CSV file which I'm parsing and inserting bits of it in a database. I'd like to write a parser which takes account of the fact that the column order may change in the future. I thought that I could do this by grabbing the header line as an array, and for each line, putting the value in a dynamically created local variable (usin...

Get list of {} templates from String [PHP]

Hi, I want to get the template words in a string. Template in the sense of words in {} inside a string. I am adding here a code to explain what I want exactly. $string = "Hi {username}, Here is your {password}"; function get_template_variables($string) { .... .... return array(); } $result = get_template_variables($strin...

Variable to hold results of http request is undefined

In my code, I am making a http request (using cfhttp) and storing the result in a variable. The http request does return results- I know this because I am logging the time of the request and the results. However, something is apparently going wrong sometimes with storing the results of the http request (cfhttp.filecontent) in a variabl...

Retrieving User Name in Sharepoint?

Hi all, How does Sharepoint retrieve the user's actual name as displayed in the top right corner? e.g Welcome John Smith I need to call this name as a variable or parameter on custom code in the XSL editor but I can't figure out how I can retrieve it, is it a global variable? ...

How do I store and access a list within a variable in Prolog?

I am attempting to learn the basics of Prolog for a class. I'm running into the seemingly simple problem of not being able to store a list within a rule and retrieve it for usage in other clauses. For example: % These are the contents of the pl file I want to consult % Numbers I want to process inputList([3,2,1,0]). % Prints out the c...

Matlab's 'save' function - how to name the variable inside the .mat file same as file name?

I want to save the result of the q_yearly for each case_no in corresponding string of the q_cases_yearly as a .mat file. With my statement of save(q_cases_yearly{case_no},'q_yearly') even though the names of files are coming as the corresponding string of q_cases_yearly, however all those .mat files contain variable with the same name of...

Insert vim variables into text for comment shortcut.

I have a simple goal: Map Ctrl-C, a command I don't think I've ever used to kill vim, to automatically insert at the beginning of a line the correct character(s) to comment out that line according to the file's filetype. I figured I could use an autocommand the recognize the file type and set a vim variable to the correct comment charac...

In Perl, how can I use a string as a variable name?

Possible Duplicate: How can I use a variable as a variable name in Perl? Is this doable? I need to change a string into variable. Example: If I have a variable like this: $this_is_test = "what ever"; $default = "this"; $default = $default . "_is_test"; I want $default to take the value of $this_is_test. ...

PHP 5.2 Error with static var: "syntax error, unexpected T_STATIC"

Hi, I have a pretty weird problem: My Class looks like this <?php class asd { private static $variable; public static function blabla(){ self::$variable="blubb"; } } ?> When I'm trying to call asd::blabla() with the help of the __autoload function, everything works fine. But when I'm trying to call it without a...

JavaScript Pass Variables Through Reference

Hello! Is there an equivalent in JavaScript for PHP's reference passing of variables? [PHP]: function addToEnd( } $myVar="Hello"; addToEnd($myVar," World!"); print $myVar;//Outputs: Hello World! How would the same code look in JavaScript if possible? Thank you! ...