variables

Javascript object property inaccessible from another property (function)

Hi, Quick question, why does my reference to weekdays inside change_date() give weekdays is undefined error in Firebug? I also tried this.weekdays, same. How do I correct this? var timesheet_common = { weekdays : ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"], change_date: function() { $('#text_input').val( weekdays[(n...

What do the '&=' and '=&' operators do? [PHP]

Finding the answer to this is turning out to be much more difficult than I would have thought. Since I don't have a clue what you'd call this, it's hard to run a Google search since it will ignore those characters. I tried browsing the PHP Assignment Operators page, and even the other operators pages, and found nothing that told me exact...

javascript reflection: get variables

how can be a collection of global and/or local varibles be obtained in javascript? (like e.g. in Python by globals() or locals()) if there is no such functionality available in javascript, how do some javascript console interfaces obtain them, to be able to autocomplete? ...

Variables are not being rewritten as page is processed.

I have a php script that checks to see if a particular file exists. This name of the file is defined by the 'compartment' variable. When the script is copied and pasted again into a separate block, changing only the compartment variable it runs into a problem... Say for example 1.jpeg exists but 2.jpeg doesn't. The first block displays ...

MS Access 2003/2007 - Passing data through a variable on unbound forms vs. a hidden text box

Ok so I hope the title of the question matches what I about to ask, but here is what I am trying to get at: So I have an access database that uses a number of unbound forms, and the purpose of the forms are to collect data and save to various tables with VBA click events using SQL statements (INSERT or UPDATE based on whether the ID of ...

Can I set up variables for use in an apache configuration file?

I have a php webapp convention that I'd like to follow and a lot of setup for it is done in the apache configuration file. Is there any way I can configure some strings that contain paths for multiple uses throughout the configuration file? A dim example might be: EnginePath = /opt/engine AppPath = /opt/anapp DocumentRoot [AppPath]/P...

Regular expressions in java with a variable

I have a variable v that possibly appears more than one time consecutively in a string. I want to make it so that all consecutive *v*s turn into just one v. For example: String s = "Hello, world!"; String v = "l"; The regex would turn "Hello, world!" into "Helo, world!" So I want to do something like s = s.replaceAll(vv+, v) But o...

Proper way to make a global "constant" in C++.

Typically, the way I'd define a true global constant (lets say, pi) would be to place an extern const in a header file, and define the constant in a .cpp file: constants.h: extern const pi; constants.cpp: #include "constants.h" #include <cmath> const pi=std::acos(-1.0); This works great for true constants such as pi. However, I a...

URL returns a number. How do I assign that url as a value to a variable?

I'm doing a lending rates page. I have a url which, upon entering in a browser, returns a number. I need to be able to do (in human terms) this: var x=http://www.wherever.com/assest?cmsid=P-2870159 in the html: <td>Our rate today is:<var x></td> So in javascript, I'm just blanking on how I get the value returned from the url to b...

Strict mode in PHP?

Hey, Other languages with automatic variable declaration - like Perl - have a strict mode. By activating this strict mode, variable declaration is required, and Perl throws an error as soon as you try to use an undeclared variable. Does PHP offer any similar feature? Thx ...

PHP global variable is undefined inside a function even if global keyword is used

Yes I know global variables is a bad practice, but ease up on that rule for this one :P My code: include('something.php'); //where $from is declared function myfunc() { global $from; echo "from(myfunc)=$from<br />"; ... } echo "from=$from<br />"; myfunc(); The result is: from=2010-05-01 from(myfunc)= What's going on?...

Finding nr of an array value based on a string that exist in the array

Hi. I have an array for all the cars in a online game I'm making that look like this: $GLOBALS['car_park'] = array ( "Toyota iQ3", "Think City", "Lancia Ypsilon", "Smart fourtwo", "Chevrolet Matiz", "Mazda 2", "Peugeot 107", "Nissan Micra", "Mercedes-Benz 310" /* dårlige biler */ , "Lexus IS-F", "BMW M3 CSL",...

PHP - weird changes of variable value

hi a have written this code: <?php require("../../config.php"); require("../php/funct.php"); try { $pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_TABL.';', DB_AUSER, DB_APASS); } catch(PDOException $e) { echo 'Error: ' . $e->getMessage(); } $idee=unique_id(); $insystem=true; include('session_check.php'); unset($insystem)...

Jquery - How do you pass a variable into a function to use?

Hi, I am stumped by a problem which i'd assume is a common Jquery occurence, but i've no idea how to fix! I have 5 variables - var pubtimed var toolstimed var newstimed var mylinkstimed var partnerstimed Which are used to store on and off states. I then have a script that checks cookies for recent states and updates the va...

How to randomize an integer variable using JavaScript?

How can I randomize a variable in JavaScript between 0-4, so that every time the page loads the variable is different but between 0 and 4? ...

Conditional variable value

I will try to make this simple and quick.. I have never attempted this before so I am a little lost.. What I want to do is to have a variable string (op20) that has a value based on a condition that is met.. Perhaps there is an easier way to accomplish this... Example: string op20A = "5"; string op20D = "19"; string op20C = "6"; string ...

Variables viewer on Eclipse debugging truncates the string values

I'm debugging Python code and when I try to show the contents of an string variable its showed truncated... How can show the full contents of a variable debugging Python code with PyDev on Eclipse? ...

What does immutable mean?

If a string is immutable, does that mean that.... (let's assume JavaScript) var str = 'foo'; alert(str.substr(1)); // oo alert(str); // foo Does it mean, when calling methods on a string, it will return the modified string, but it won't change the initial string? If the string was mutable, does that mean the 2nd alert() would retur...

Public Property Definition

Hi guys, What are the benefits of defining a property for a object instead of giving direct access to the private variable? Instead of : public class A private _x as integer = 0 Public property X() as integer Get return _x End Get Set(ByVal value As integer) _x = value ...

jQuery - sharing vars between functions

This should be fairly simple; i'm pretty sure I've just not understood it. FYI, the website is using jQuery to run ajax .load() on content. On my main parent page, in the header I have my nav .load() jQuery code:- <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('a.nav').click(function() { ...