variables

How to store local variables in jQuery click functions?

I'm trying to figure out how to store external variable values in the functions created during jQuery's click() event. Here's a sample of the code I'm working with now. for(var i=0; i<3; i++){ $('#tmpid'+i).click(function(){ var gid = i; alert(gid); }); } <div id="tmpid0">1al</div> <div id="tmpid1">asd</div> <div id="tmpid2">qwe<...

ruby logging convenience method

I would like a ruby method "show" which does this: anyobject.show the output of the call would be: anyvar => the pp string of the object Something close , but not quite is : p "any_var => #{any_var.pretty_inspect}" Since you have to type "anyvar" out to accomplish that. ...

Automate variable declaration PHP

I want to try and write a function to automate some of the legwork in checking/declaring a variable i.e. function checkVariable($var) { if(!isset($var)||empty($var)) { return ''; } else { return $var; } } $myvar = checkVariable($myvar); obviously, this isn't going to work, because the variable doesn't exist pr...

Grab/input php variable in javascript?

Hello, I am trying to dynamically get a php variable and place them into my javascript variable as seen below: var site_url = "getsite.php?name=SiteName&link=linkURL"; That above script is what I have now and it is harcoded(SiteName,linkURL). I want to change 'SiteName' and 'linkURL' to display whatever the PHP variable is on another...

Reusing xml for-each blocks in XSLT?

Hello, I have an attribute whose value is the XPath to the current node, like so: <xsl:attribute name="path"> <xsl:for-each select="ancestor-or-self::*"> <xsl:if test="name() != 'root'"> <xsl:value-of select="name()"> <xsl:if test="not(position()=last())"> <xsl:text>/</xsl:text> </xsl:if> ...

jQuery passing element ID into jquery statement?

I'd like to pass the ID of an element into a function which then calls jQuery. However, I'm stumped as to how to actually take the ID variable and concatenate it with other text inside the jQuery statement. For example, this returns an error: myFunction("#myObject"); function myFunction(IDofObject){ $("'"+IDofObject+" img'").doSom...

Using mod_rewrite to strip certain GET variables

I'm a mod_rewrite noob and I'm getting a headache trying to figure out something that should be simple. What I'm trying to do is strip out unwanted variables from a URL displayed after a GET form is used. In other words, I'm trying to change this: stats.php?gender=W&team_id=88&btnGet=Get+Stats to this: stats.php?team_id=88 Please...

windows command line script variable going wrong somewhere?

Hi Battling with a windows command line script I just can't get to work. Basically I am trying to launch a program called vnctv.exe with the parameters of HOST ipaddress PORT 5900 PASSWORD x, however I only want to run the program with IP addresses of computers currently online. I've tried a few different things but I cant get anythi...

Language of variable names? (native foreign language speakers)

We are a spanish speaking development team, we code in django and we all are pretty fluent in english, as all documentation, sample code, APIs, etc come in english. On our last project we chose to name all the variables, class names, modules, files and such in english, even though the whole application was in spanish, we kept a strings ...

Can i define UIView as a variable in Objective-C?

According to documents i read, they always show that I should define a subview in a class. Like this : @interface PolygonView : UIView. I have to inherit from UIView. Could i define a variable with UIView type in a class which inherit from NSObject? After that, i make a connection from that variable to UIView which is defined in Inter...

C#: Scope-specific variable binding

In some languages, there are things like these: Lisp: (let ((x 3)) (do-something-with x)) JavaScript: let (x = 3) { doSomethingWith(x); } Is there anything like this in C#? ...

Drupal 6 passing variables from Forms to Content, how to?

I created a BLOCK (left) with this simple form. Now I want to PROCESS and DISPLAY results on PAGE (center) How can I do it ? inputs: name = James surname = Bond output I want : <div style="color:red">Welcome, James Bond</div> here is a BLOCK which i wrote and works. <?php echo drupal_get_form('myForm'); function myForm($form_st...

SASS - define variable in for loop

I was hoping that defining variables in a loop would work in SASS but unfortunately I get errors saying that the variable isn't defined, here is what I tried @for !i from 1 through 9 !foo = #000 @if !i == 1 !bg_color = #009832 @if !i == 2 !bg_color = #195889 ... #bar#{!i} color: #{!foo} ...

Is there a way to reduce this further?

I have a php function that I wish to reduce even further. <?='Testing'?> Is there a way to reduce this any further? ...

Is there a way to store part of a 16 bit value in an 8 bit variable in Assembly?

I created one variable that stores a 16 bit variable, and I'm tring to store the upper half in an 8 bit variable. How do I do this? EDIT: its for the IA-32, and I don't think i can use registers EDIT2: I am allowed to use registers. ...

What is the difference between int x=1 and int x(1) in C++?

Possible Duplicate: Is there a difference in C++ between copy initialization and assignment initialization? I am new to C++, I seldom see people using this syntax to declare and initialize a variable: int x(1); I tried, the compiler did not complain and the output is the same as int x=1, are they actually the same thing? Ma...

Google Maps : get route, Km, and ... price

Hello guys, I think I am in a project which is probably too much for me, but I thought you could put me in the right direction. We are trying to have a form where the user will write a starting point and an ending one, as seen in the Google Maps examples (http://code.google.com/apis/maps/documentation/examples/directions-advanced.html)...

Changing class variables by means of a second and third class

I'm working on a personal project and at the same time experimenting with it. I've got 3 classes contained in 3 files: Calculate.java, Geometry.java, and Test.java. Geometry.java so far only contains some variables I want to work with, the get/set methods along with a constructor method. package project; public class Geometry { ...

What's the best practice to transfer a variable value to javascript from server?

I'm developing a pet project with jQuery. Now the application requires some variable value is transferred to client javascript when the page is loaded. I'm wondering what's the best practice to do it. I can image to do it in two ways. First, render it to be a javascript variable in the page. <script> <?php echo "var maxid = $maxid;"?> ...

Create table variable in MySQL

I need a table variable to store the particular rows from the table within the MySQL procedure. E.g. declare @tb table (id int,name varchar(200)) Is this possible? If yes how? ...