variables

Variables Behaving Oddly (Intel 8086)

Edit: Answered my own question. See below. -_- I have a variable defined in the .data segment as follows: retVal DW 0100h ;stores hex fraction of the intermediate value. Starts at 1.00 This is the value that I add or subtract to to get my return value. The first time it shows up in the code segment is at the following point: sub [...

jQuery - string disapearing from a variable

Hey, I'm doing a search box and when I want the page to redirect, something strange heppens. Here is the script: $('#search_form').submit(function(ev) { var searchTerm = $("input[name = search_term]").val(); var search_location = conf_fullSiteAddress + "search/" + searchTerm + "/"; alert(search_location); window.locatio...

Correct syntax for C pointer datatypes

I vaguely recall seeing this before in an answer to another question, but searching has failed to yield the answer. I can't recall what is the proper way to declare variables that are pointers. Is it: Type* instance; Or: Type *instance; Although I know both will compile in most cases, I believe there are some examples where it is ...

[R] How do you select multiple variables from a matrix using a randomly selected vector of column indices?

Hopefully this has an easy answer I just haven't been able to find: I am trying to write a simulation that will compare a number of statistical procedures on different subsets of rows (subjects) and columns (variables) of a large matrix. Subsets of rows was fairly easy using a sample() of the subject ID numbers, but I am running into a...

How to get a variable to have 2 decimals

I have a variable i would like to force to have 2 and always 2 decimals. Im comparing to a currency. Often i get a comparison looking like the following. if self.price != price #do something end Where self.price = 120.00 and price = 120.0. The self.price is set with a :precision => 2 in the model, but how do i do the same with a var...

Is it proper to use the term "global" in a relative sense?

Please assume the following contrived JavaScript: function do_something() { var x = 5; function alert_x() { alert(x); } alert_x(); } do_something(); The variable x is local to the function do_something. It isn't a global variable because it's not available in every scope (i.e., outside of either of the functions, such...

Private variable needs to be initialized only in constructor. How?

I have a class called Foo with a constructor that needs arguments, and a other class Bar with a Foo private variable class Foo { public: Foo(string); } class Bar { public: Bar() { this->foo = Foo("test") } private: Foo foo; } However, when I try to compile this, I get a compile error that t...

Where to store editable configuration parameters

Hi, I am building a small cms system in MVC.NET, and I have some editable variables to store. Footer information, website title etc. These are Global variables so they should only be declared once. These should be editable in the cms. Where could I store them ? Isn't it a bit stupid to create a table for them, there they only would occ...

Why and when there are things I can not do in CLASS SCOPE in C# ?

hi, well... I'm confused about what can I do and what I can't do in CLASS SCOPE. For example ========================= class myclass { int myint = 0; myint = 5; *// this doesnt work. Intellisense doesn't letme work with myint... why?* void method() { myint = 5; *//this works. but why inside a method?* } } ========...

How do I use variables to do substitution in Perl?

I have several text files, that were once tables in a database, which is now disassembled. I'm trying to reassemble them, which will be easy, once I get them into a usable form. The first file, "keys.text" is just a list of labels, inconsistently formatted. Like: Sa 1 # Sa 2 U 328 #* It's always letter(s), [space], number(s), [spac...

Eclipse gives error "... is not a valid location for linked resources."

When I try to add a new Classpath Variable in Eclipse for my Build Path configuration, and the path I add is a directory that the current workspace is a subdirectory of, Eclipse gives the error: 'C:\JavaStuff' is not a valid location for linked resources. Why does Eclipse impose this restriction? I can't think of a good reason for it...

C#: How can I send a PHP session variable to a WebBrowser control?

Okay, I am using the following code to navigate to a page in my WebBrowser control based on information entered in a login form: private string currentUser = usernameTextbox.Text; private string currentPasswd = passwordTextbox.Password; public static byte[] StrToByteArray(string str) { System.Text.ASCIIEncoding encoding = new Syste...

how do I convert a string to a valid variable name in python ?

Python n00b here I need to convert an arbitrary string to a string that is a valid variable name in python. Here's a very basic example: s1 = 'name/with/slashes' s2 = 'name ' def clean(s): s = s.replace('/','') s = s.strip() return s print clean(s1)+'_'#the _ is there so I can see the end of the string That is a very n...

JavaScript Variable inside string without concatenation - like PHP

I know in PHP we can do something like this : $hello = "foo"; $my_string = "I pity the $hello"; output : "I pity the foo" I was wondering if this same thing is possible in JavaScript as well. Using variables inside strings without using concatenation -- it looks more concise and elegant to write. ...

Main() doesn't want to access a class variable

Why I can access to X variable from "method()" and not from Main() method? class Program { int X; // this is the variable I want access static void Main(string[] args) { int a; a = X; // this doesnt work, but why? } void metodo() { int b; ...

Please Solve/Answer C++ Program problems with Functions Variables

Please solve/answer problems to get program to work. I am not fully understanding the passing variables by reference or value and I think that is what is making this so hard. So if you could fix the program. I've been at this for the last 2 days. I have included my full code. paxdiablo suggested this and I'm trying to do what they said ...

Best Aproach to Relate A Entity Class to the Correspoding Table in a DataBase

i want to relate each Field of an Entity Class to the corresponding datatable Field. im working on c# currently Any Suggestions? ...

What's the difference between $@ and $* in UNIX?

Hi, So I was just wondering what's the difference between $@ and $* in UNIX, as when echoed in a script they both seem to produce the same output. Thanks. ...

Singletons in Google App Engine can get expired, or does that many that any static variable can get expired? (java)

I read that in Google App Engine there is a chance that a singleton class might die, if the application gets idled for too long (or a new application instance is created), and I have experienced this myself. But does that really mean that Any static variable in any class might get expired in the application? or how can GAE identify that...

Variable binding in Prolog

Hi all, I have written a predicate common_participant(Person, PairEvent). which returns pairs of facts from my knowledge base. I was wondering whether there is any way to perform variable binding and collect all results without using the semicolon every time. Thanks, I. ...