variables

Comparing large numbers with javascript

Can anyone tell me how to compare large numbers in javascript? Something like var sla = 1263293940000; var resp = 1263296389700; if(sla > resp) { //do something } ...

Why SQL Server throws Arithmetic overflow error converting int to data type numeric?

Hi guys I have an error being thrown by SQL Server Management Studio when running this code: declare @percentage numeric(3,2) set @percentage = cast(15 as numeric(3,2)) but when I change numeric declaration to declare @percentage numeric(4,2) set @percentage = cast(15 as numeric(4,2)) everything goes fine. Is there a limitation ...

Bash syntax question: variable in brackets {} with # comments?

I just saw some code in bash that I didn't quite understand. Being the newbie bash scripter, I'm not sure what's going on. echo ${0##/*} echo ${0} I don't really see a difference in output in these two commands (prints the script name). Is that # just a comment? and what's with the /*. If it is a comment, how come it doesn't int...

PHP -What's the difference between global variables and constants

According to many sources, register_globals (global variables that is) should be disables in your php.ini. Should I write define() in my code and use constants if global variables are disabled? Are those even related? ...

Classic ASP, application variables, refreshing

Hi, I have an application variable which is populated onstart (in this case it is an array). Ideally I need to rebuild this array every 3 hours, what is the best way of going about this? Thanks, R. ...

Sending a variable through a link_to without url query in Ruby on Rails

Hi all, I'm trying to send a variable through a link_to, without using url query in Ruby on Rails, from one controller's index view to be used on another controller's index. Basically, I need to pass the Turma.id (school class id), to the Elementos_turma(peoples in the class) controller, so I can use it and filter the index: ElementosT...

PHP: Changing the query variables during the while loop

I was hoping to change one of the variables of a query, from inside the while loop, is it possible to do this? EG. $query = mysql_query('SELECT column1, column2 FROM table1 WHERE column1 = "'.$variable.'";', $conn); while ($data = mysql_fetch_assoc($query)) { if($data['column2'] == 'original') { $variable = 'altered'; } ...

launch gdb and print out variable value using ruby

Hi , I want to write a ruby program that could inspect the variable value of a program by launch the gdb and then print that value. How could I achieve this? If I were in the shell, I would do this : shell > gdb test [...gbd started] (gdb) p variable $1 = 20 (gdb) I also like to hear other ways that can achieve the same g...

An unnset-variable default value?

alot of time in programming the value of variables are passed through url parameters, in php; if (isset($_GET['var'])) {$var = $_GET['var'];} But if that does not execute, we will have an unset variable, in which may cause errors in the remaining of the code, i usually set the variable to '' or false; else {$var = '';} I was wo...

WCF service level variable - C#

Hello there, My WCF Service is hosted in Windows Service and I have added some keys in the appSettings section of Windows Service app.config. Now, I want these keys to be available at more than one code file in WCF Library. Is there any way I can define WCF Service level variable, so that I can avoid - ConfigurationSettings.AppSetti...

Actionscript3: add and remove EventListeners (with dynamic name and dynamic variables)

picture: http://yfrog.com/1rcheckerboardflashvraagjg Hey all! I am making a boardgame in flash Action Script 3 each position on the board is a buttons like this: button_1_1, button_1_2 etc. Whenever a character is selected you want to move it so the script has to add event listeners for positions around the selected unit // This f...

Where can I find information about the $[ variable in Perl?

I tried Google. I tried Yahoo. I tried Bing. None of them had results for the $[ variable. Does anyone know where I can find the documentation for it? ...

JQuery .click pass variables

Hi folks, propb. very simple, but not for me. Looking to pass a variable on a click function to show either div a or div b based on the a link clicked. My code is something like this $('.view').click(function() { var id = this.id.replace('view_', ""); if(id=1) { $('#show').show('slow'); } if(id=2 ) { $('#show2').show('slow'); } $(...

Javascript Scope and local variables

I'm really not sure if this is possible in Javascript. Here's my function: var tree = function(name, callback) { if (this.name) { this.name.push(name) print(this.name) } else { this.name = [] } callback() } I'd like to use it as follows and print out the heirarchy: tree("john", function() { tree("geoff", functio...

Do you use 1-3 letters variables EVERYWHERE?

I notice, in C# i use very short variable names EVERYWHERE. My code is polluted with foreach(var (v|f|i) in SOMETHING) for(int (i|n|z)=0 var (ret|r) = blah(); ... return ret; var sw = new StringWriter(); using(var r = cmd.ExecuteNonQuery()) { while(r.Read()) { r.GetSomething(3) I dont know if this is bad or ok. I can c...

How to dynamically adjust method names and calls with Objective-C

Hello. I am trying to condense my code for a method and was wondering how I would achieve the following: I have a bunch of variables that differ only in their number such as: int intVariable1 int intVariable2 UILabel Label1 UILabel Label2 BOOL bool1 BOOL bool2 etc. So I want to call a method and pass in an int. That int would dete...

Accessing Instance Variable from Controller In View

Hi, I am very new to Rails so this will probably seem basic to most of you. I am having trouble getting instance variables from one of my controller methods to show in my view. I am trying to get the first 10 entries of a MySQL table called Odds to show up in a table on my index view. Here is my Model: class Odds < ActiveRecord::B...

Jquery .post used to store php session variable. How to avoid refresh to call session value.

I am using jquery's .post ajax call to pull an form input value and pass it to a php file that starts a session and stores the value in it. The session value is then called on a different page. The problem is, this all takes place without a page refresh, so the session value is always one page refresh behind. I.E. the first time the ses...

jquery submit form from text link

Hi all, I'm trying to create a small form that submits a form and passes a value from a text link.. Here's what I've got so far.. <form id="calendar" name="calendar" action="" method="post"> <a href="<?php echo $next_month; ?>" class="submitCal">&raquo;</a> </form> <script type="text/javascript"> jQuery.noConflict(); jQuery('.submitCal...

sed with & in variable

hi, I would like to search and replace with sed and replace with something in a variable wich is containing some specials symbols like &. For example I done something like that: sed "s|http://.*|http://$URL|" where URL=1.1.1.1/login.php?user=admin&pass=password. I thinks it became a problem because I use ? and & in my variable. How...