I have a variable $params which gets data from the database:
$params = mssql_fetch_array($result)
As far as I know, it is associative array. I want another array $tempParams to hold the value of this array. Can I assign it by using the following statement:
$tempParams = $params
In addition, do I need one single statement to decla...
One thing that has always bugged me is that when checking my php scripts for problems I get the warning "bool-assign : Assignment in condition" and I get them a lot.
e.g.:
$guests = array();
$sql = "SELECT * FROM `guestlist`";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result))
$guests[] = $row['name'];
Is there ...
Should be easy. I have an object. I want to modify it, but before i do I want to save a copy of it that I can go back to. I tried setting copy = original but when i modify the attributes of the original the copy also shows the changes. I am assuming this is because in actionscript any time you assign, it really just stores a referenc...
I have some 'legacy' code (which I can't change, but need to add on to) that looks something like this:
template<typename T> T Foo(T& target)
{
//Assign to 'target', but never read from it before that.
//Also, 'target' is going to be a POD-type.
target = T();
return target;
}
int main()
{
float value = Foo(value);...
I've asked a similar question on structs here but I'm trying to figure out how C handles things like assigning variables and why it isn't allowed to assign them to eachother if they are functionally the same.
Lets say I have two arrays:
int x[10];
int y[10];
Why won't x = y compile? If they are both the same "signature" like that,...
Suppose you do this in Ruby:
ar = [1, 2]
x, y = ar
Then, x == 1 and y == 2. Is there a method I can define in my own classes that will produce the same effect? e.g.
rb = AllYourCode.new
x, y = rb
So far, all I've been able to do with an assignment like this is to make x == rb and y = nil. Python has a feature like this:
>>> class ...
Hi,
my problem is that the assignment of decodedProxyExcerpt2 below overwrites decodedProxyExcerpt1 and I do not know why.
Any clues?
Thanks in advance.
DecodedProxyExcerpt decodedProxyExcerpt1 = new DecodedProxyExcerpt(stepSize);
if (audiofactory.MoveNext(stepSize))
{
decodedProxyExcerpt1 = audio...
There was a passing comment in a book of mine about people inputting commas into integers and messing up your program, but it didn't elaborate. That got me thinking, so I tried writing a little algorithm to take an std::string and remove all non-integer characters. This code compiles but skips over output. Why isn't anything being assign...
Disclaimer: This is an "asked-and-answered question" posted in accordance with the FAQ statement that it's "perfectly fine to ask and answer your own programming question". Its purpose is to encourage members of the SQL Anywhere programming community to use StackOverflow by seeding the "sqlanywhere" tag with some real-world content. Edit...
I'm debugging part of a large project in Visual Studio 2005, and stepping through the code line by line.
int speed = this->values.speed;
int ref = this->values.ref_speed;
After stepping past the first line, values.speed has a value of 61, but for some reason, speed is getting assigned the value 58. After the second line, values.ref_s...
I created a lua module with a very large number of wrapped C++ classes using swig. The wrappers are generated and compiled (with -Wall) without any issues. However, in a couple of places that I've found, I run into the following issue: basic assignment of member data fails.
If I run:
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio...
Hi,
I've inherited some VBA code (non-.NET, Excel 2003) I have to modify. I want to obtain a handle on a cell range but VBA doesn't like my syntax, saying 'Run-time error 424: Object required'.
When running this code it highlights the line assigning streamsTotal.
Private Sub totalStreams()
Dim streams, streamsTotal As Range
...
I have several methods that I need to wrap in new methods in basically the same manner. My first solution doesn't work, and I understand why, but I don't know if there is a simple solution to this problem or if it can't be done the way that I want to do it.
Here's an example. I have objects a-c that have an onClick method. I need to exe...
I have a vector of booleans. I need to set its elements from n-th to m-th to true. Is there an elegant way to do this without using a loop?
Edit: Tanks to all those who pointed out the problems with using vector<bool>. However, I was looking for a more general solution, like the one given by jalf.
...
I encountered an interesting situation today in a program where I inadvertantly assigned an unsigned integer to a std::string. The VisualStudio C++ compiler did not give any warnings or errors about it, but I happened to notice the bug when I ran the project and it gave me junk characters for my string.
This is kind of what the code lo...
What are some good projects to work on in an effort to learn (or relearn) C? Ideally something akin to the assignments one might get in a class at university. Links to actual assignments/project specifications that are available online would ideal.
Note: they don't have to be assignments specifically from a C class or anything like that...
I have this example from the coin package of R:
library(coin)
library(multcomp)
### Length of YOY Gizzard Shad from Kokosing Lake, Ohio,
### sampled in Summer 1984, Hollander & Wolfe (1999), Table 6.3, page 200
YOY <- data.frame(length = c(46, 28, 46, 37, 32, 41, 42, 45, 38, 44,
42, 60, 32, 42, ...
Hi,
I need to assign N entities (each with possible parents and possible children) to M computation nodes while satisfying the following optimization conditions:
Children of an entity want to be assigned to the same computation node (to maximize data locality among siblings)
The distribution of entities should be as even as possible (...
In this snippet:
class ClassWithConstants
{
private const string ConstantA = "Something";
private const string ConstantB = ConstantA + "Else";
...
}
Is there a risk of ending up with ConstantB == "Else"? Or do the assigments happen linearly?
...
I looking for a clarification regarding the pointers. I have compiled the following code in bordland c++ 5.5.1 without any errors. But while i am trying to execute gives a core error.
int main ()
{
int x=10,y=20;
int &a=x;
int &b=y;
int *c;
int *d;
*c=x;
*d=y;
return 0;
}
Basically I am trying to ...