variables

Prepending "http://" to a URL that doesn't already contain "http://"

I have an input field that saves a URL, I'd like this saved input to recognize when "Http//" is absent from the start of the variable but have no idea where to begin... is it possible to check only a portion of a string? - then have a function that will append if necessary? ...

PHP: Removing items from a session

I'm having trouble removing items in a session array in a shopping cart project. The following code should take the selected item and remove it from the session. However the end result is just the same session as before with nothing removed. I've seen similar problems by googling, but haven't found a working solution yet. Here is the str...

jquery/javascript - accessing variables from outside a function

I'm trying to use a variable value outside of the function it was defined in. Thought I. just needed to declare the variable outside the function but that doesn't cut it. Gotta be an easy one for those who know? Fiddle Here jQuery(document).ready(function() { var readOut; var readOut2; $(document).mousemove(function(e) { ...

jQuery get text as number

This code doesn't work: var number = $(this).find('.number').text(); var current = 600; if (current > number){ // do something } HTML: <div class="number">400</div> Seems there is some problem with converting text() from text-like value to number. What is the solution? ...

How to store molecules in memory?

I want to store molecules in memory. These can be simple molecules: Methane (CH4) C-H bond-length: 108.7 pm H-H angle: 109 degrees But also more complex molecules, like paracetamol (C8H9NO2): How can I store molecules in memory, including all bond-lengths and angles? A good idea to store atom-structs in an array? Or is there a be...

How to return the name of a variable stored at a particular memory address in C++

Hey StackOverflow, first time posting here after having so many of my Google results come up from this wonderful site. Basically, I'd like to find the name of the variable stored at a particular memory address. I have a memory editing application I wrote that edits a single value, the problem being that every time the application holdin...

How do you pass variables from c# to javascript?

Looking to pass variables from c# to javascript to use some jquery code. Passing doubles, ints, strings, arrays. Does anyone know how to do this? for example if I have this code snip in c#: string blah = "this is a blah string"; I would like to pass this into javascript so that I could use a mouseover event in jquery: $('#myDiv').mo...

Clearing Value on Multiple Inputs?

I have a jQuery script below that clears the value of an input on focus and puts it back on blur if the input remains empty. It works great, but here's the problem: Let's say I have 3 input fields on the same page. I click on the first one with the value "Name", defaultValue variable becomes "Name" and the field clears. If I click out, ...

Use the value inside a cell as variable for a function

Hi, I would like to create a dynamic function in excel (no VBA) to pass the value of a variable to a number of similar functions. Example: instead of doing: =sum(a1:z1) =sum(a2:z2) =sum(a3:z3) and then rewrite all functions to do: =sum(a1:t1) =sum(a2:t2) =sum(a3:t3) I would like to do: =sum(a1:"var"&1) =sum(a2:"var"&2) =sum(a3:"var"&3) ...

Pass variable to string in include file - PHP

What I am trying to do is to have an include file with generalized language in a string that will be used across multiple pages, but I also need to pass a variable to the string from the current page. Here is an example: Here is a snippet of the index.php page: <?PHP require_once($_SERVER['DOCUMENT_ROOT'].'/lib/prefix.php'); echo $GE...

excel - true vs "true" vs true()

When writing an Excel formula, does it make a difference whether you set a value to true, "true", or true()? In other words, which of the following is the best? Or does it depend on the circumstances? if (A1 = 1, true, false) if (A1 = 1, "true", "false") if (A1 = 1, true(), false()) ...

C program variable that holds cartesian coordinates?

I have never programmed in C and have not programmed in C++ for a little while and either way, I am still learning. I am writing a program in C and am converting a MATLAB program to this C program. I have a lot of variables from MATLAB that are cartesian coordinates, X Y Z, of points. Is there a variable type I could use built into C? I...

How to bound 2 variables in C++ one with other so when one changes changes another?

How to bound 2 variables in C++ one with other so when one changes changes another? for example I created Int A and Int B bound one to another and than when I change A one using some function another one will automatically change to new value of A. I am intrested in version for C++ .net 4th version. ...

Python, string (consisting of variable and strings, concatenated) used as new variable name?

I've been searching on this but am coming up a little short on exactly how to do specifically what i am trying to do.. I want to concatentate a string (I guess it would be a string in this case as it has a variable and string) such as below, where I need to use a variable consisting of a string to call a listname that has an index (from ...

Assigning a function's result to a variable within a PHP class? OOP Weirdness

EDIT: Question Answered. Thanks deceze! I know you can assign a function's return value to a variable and use it, like this: function standardModel() { return "Higgs Boson"; } $nextBigThing = standardModel(); echo $nextBigThing; So someone please tell me why the following doesn't work? Or is it just not implemented yet? Am ...

PHP - Add String to Array

Hello everyone, I am wondering how I can add a string variable to the current array. For example, I have an array called $finalarray. Then I have a loop that adds a value on every run. Basically: $finalarray = $results_array + string; A very basic structure. I am using this for MySQL so that I can retrieve the final array of the colu...

Classes deleting Variables? iPhone SDK

I have been having some problems with some variables inside a class being deleted lately. Here is how I declare: MyClass *myClass; -(void)viewDidLoad { myClass = [MyClass new]; //something using my class then when I call a function later that uses an array and a dictionary inside the class. [myClass doSomething]; Here is the code I...

Is there any abstract variables in java?

in java any abstract variables there? i worked this abstract variables in constructor i am nort sure but i think the constructor support static variables.pls clarify my doubt ...

Variable length encoding of an integer

Whats the best way of doing variable length encoding of an unsigned integer value in C# ? "The actual intent is to append a variable length encoded integer (bytes) to a file header." For ex: "Content-Length" - Http Header public string somefunction(int data) { //returns the binary format of the data byte as a string string data_...

php: check against dynamic $_POST possible?

<?php $var = "tax_" . $taxkey; if(isset($_POST[$var])) echo $var . "SET"; ?> I need to check wheter a "dynamic" POST value is set or not, is this possible in PHP? EDIT: sorry guys, this has been solved! ...