Suppose I declare a structured Javascript variable like this:
var mydata = {'list':[
{'fname':'george','lname':'washington'}
,{'fname':'oscar','lname':'wilde'}
,{'fname':'james','lname':'polk'}
]
,'summary':this.list[1]['lname']
}
Question: How can I ensure that
this.list[1]['lname']
equals 'wilde' and that my "this" is actually re...
I'm developing an inference engine, this means that basically I have a certain number of "facts" which are basically the representation of the world in a certain moment. Together with the facts (that usually are only two, the starting state and the goal state) I have many rules (could literally be hundreds for certain problems). The aim ...
I am currently taking a c++ course and trying to get a deep understanding of the whole thing.
I came up with some theories, it would be great if somebody could confirm them:
Every variable (local,global,staic,member and non-member) is guaranteed to have its ctor called before first use
The ctors of primitives like int are essentially n...
When defining a path to a directory as a variable or constant, should it end with a trailing slash? What is the convention?
pwd in unix shows your current directory without a trailing slash, while the tab complete of cd /var/www/apps/ includes the trailing slash, which left me unsure.
...
Hi,
What I need is an equivalent for PHP's fseek() function. The function works on files, but I have a variable that contains binary data and I want to work on it. I know I could use substr(), but that would be lame - it's used for strings, not for binary data. Also, creating a file and then using fseek() is not what I am looking for ei...
I've frequently heard claims that Haskell doesn't have varibles; in particular, this answer claims that it doesn't, and it was upvoted at least nine times and accepted.
So does it have variables or not, and why?
This question also appears to apply ML, F#, OCaml, Erlang, Oz, Lava, and all SSA intermediate languages.
I'd appreciate a co...
I have a jquery function ('rater') that I call this way:
<div id="someID"></div>
<script type="text/javascript">
$('#someID').rater({options});
</script>
I want to get the ID ('someID' in this case) so then I can use it inside the function as a variable.
Then I use it in something like this:
if (??? == 'someID') { do something ...
Hey, I'm programming a feedback form on a website for a client, however, there are over 100 inputs (all uniquely named). I was wondering if there was a loop I could run to get all of the variables, do you have to call them like this:
$variable = $_REQUEST['variable'];
EDIT:
I'm going with $_POST as recommended by everyone here - than...
I have the following constant defined in my PHP script:
define("MODULE_PATH", "D:\\modules\\");
Whenever I try and assign the constant to a variable or as a function argument, I get a PHP parse error (with no explanation).
var $jim = MODULE_PATH;
var $fh = fopen(MODULE_PATH . "module1.xml");
Both above lines throw the parse erro...
I need to use a global flag. This flag will be set whenever I change my datagrid i.e. add/ update rows, change checkboxes, radiobuttons, etc. in my screen. Also, on what event can this global variable be set. Will "change()" or "click()" work. Need some idea in this context.
...
I have an XML reader class which I initialize with a URL
- (id)initWithURL:(NSURL *)url
This class adds objects to an array in the calling class using an instance variable
// in the interface
ViewController *viewController;
// in the implementation
[viewController addObject:theObject];
Now, I initialize my XML reader class, then s...
One aspect of javascript that it's hard to find information on is casing practices. By casing practices, I mean what casing style (ie. camel-case, pascal-case, etc) should be used for what elements (Constructors, private functions, public functions).
The only rule I've heard was from a Douglas Crockford lecture on YUI theater, stating ...
In another question I posted someone told me that there is a difference between:
@variable
and:
variable
in MySQL. He also mentioned how MSSQL has batch scope and MySQL has session scope. Can someone elaborate on this for me?
...
Ok, building off of the last question I asked, How does Mysql handle the where statment in the following code:
DELIMITER ;//
DROP PROCEDURE IF EXISTS `test`;//
CREATE PROCEDURE `test`
(
id INT
)
BEGIN
SELECT *
FROM some_table
WHERE id = id;
END;//
What does MySQL do in this case? Does it treat the where clause as
some_tabl...
This is surely a JS beginner question.
My issue is I want to use the value of the variable type to access the relevant checkbox; however it is treating the variable as a string. I have tried it to two ways.
function toggleGroup(type) {
if (document.getElementById(type).checked == true){
alert("foo");
}
}
or
function ...
Alright. So I have a table called contacts. In this table I have people and there contact information and how their preferred method of contact (Phone, Address, Email, or Fax). I want to be able to have ruby output a list of said people in a manner I could copy paste into a email address bar or such.
<% @contacts.each do |contact| %>
...
I have a html page with an iFrame, from which i want to read a few variable.
Its basically a map, from which i want to retrieve the Latitude and Longitude values.
I've been working on Adobe AIR, and I've tried retrieving values from innerHTML, contentWindow, but still been unable to get this working.
Any good ways to get this done?
...
In my HTML file I have linked to the JS with:
src="myscript.js?config=true"
Can my JS directly read the value of this var like this?
alert (config);
This does not work, and the FireFox Error Console says "config is not defined". How do I read the vars passed via the src attribute in the JS file? Is it this simple?
...
I'm looking at some older Perl code on Perl Monks to figure out programming with Win32::OLE and MS Word. Scattered throughout the code are variables with names like $MS::Word and the like, without a 'my' included in their declaration. After reading a bit on Google, I understand that these are called 'package variables' versus 'lexical va...
Hi,
Say you have a variable called hotelPropertyNumber. The contents will always be a number but normally be used as a string. Would there be anything "wrong" with declaring it as a string so that you don't have to continually convert it to a string....or is that a bad programming habit?
Thanks.
...