I have used System.Collections.Queue and its object form_elements_queue
if (form_elements_queue.Count > 0)
queue_element = (RecordQueue)form_elements_queue.Peek();
I'm modifying the queue_element like below,
queue_element.Children--;
RecordQueue is my custom Type which I Enqueue in form_elements_queue.
but its not referenci...
I am unsure how javascript stores objects, and references them. So, I don't know if my plan will cause bad performance. Any insight would be appreciated.
I have many divs on a website, and each has a unique id. I have an object constructor:
function box_object(box_id){
this.the_box = document.getElementById(box_id);
this.rela...
I need to get three objects out of a function, my instinct is to create a new type to return the three refs. Or if the refs were the same type I could use an array. However pass-by-ref is easier:
private void Mutate_AddNode_GetGenes(ref NeuronGene newNeuronGene, ref ConnectionGene newConnectionGene1, ref ConnectionGene newConne...
Hi,
One of the libraries I'm using defines this in C#:
public ushort GetParameterSet(string name, out ParameterSet parameterSet)
I'm trying to call this from F#:
let parameterSet = new ParameterSet();
let retVal = currentPanel.GetParameterSet(name, ref parameterSet);
However, even though the parameterSet is set to an instance of t...
I want to create a string and pass it by reference such that I can change a single variable and have that propagate to any other object that references it.
Take this example:
function Report(a, b) {
this.ShowMe = function() { alert(a + " of " + b); }
}
var metric = new String("count");
var a = new Report(metric, "a");
var b = new...
Two questions rolled into one here...
I have a number of functions which are called multiple times per frame for a real-time video processing application. Taking advice about const and pass by reference, the functions have a signature somewhat like this
void processSomething(const int& value);
As I keep typing the few extra character...
Hi guys,
please tell me theres a way around this...
$my_var = 'hello';
class Test{
private $my_var;
private $my_internal_var = 'if you see this it works!';
function __construct(){
global $my_var;
$this->my_var = &$my_var;
}
function get_my_var(){
return $this->my_var;
}
function...
Seeking suggestions from PHP architects!
I'm not terribly familiar with PHP but have taken over maintenance of a large analytics package written in the language. The architecture is designed to read reported data into large key/value arrays, which are passed through various parsing modules to extract those report parameters known to eac...
I would like to have a method where the parameter could be Int32 or Single:
void myMethod( ref object x )
{
//...CodeHere
}
Since C# does not allow me to pass a specialization of object when using out or ref, the solution I found claimed that assigning the variable to a variable of the type object would be enough:
Single s = 1.0...
Here is a particular scenario that I have been unclear about (in terms of scope) for a long time.
consider the code
#include <stdio.h>
typedef struct _t_t{
int x;
int y;
} t_t;
typedef struct _s_t{
int a;
int b;
t_t t;
}s_t;
void test(s_t & s){
t_t x = {502, 100};
s.t = x;
}
int main(){
s_t s;
test(s);
printf("value i...
Hello,
I have two forms (Form1 and Form2). On Form1 there is a 'public int i' variable, which is set to value 1 in Form1 constructor.
Then I open Form2 from Form1 with this code:
Form2 f2 = new Form2(ref i);
f2.ShowDialog();
The constructor of Form2 looks like this:
public int i;
public Form2(ref int x)
{
InitializeComponent();
...
Hi.
I stumbled upon a very puzzling feature(?) of Java.
It seems that using a "new" keyword to replace a method argument kind of shifts that object into a different scope:
import java.util.ArrayList;
public class Puzzle {
public static void main(String[] args) {
ArrayList<Integer> outer = new ArrayList<Integer>();
...
Hi,
Take a look at the following classes (UNIdirectional @OneToMany)
@Entity
public class Team {
private Integer id = -1;
@Id
@GeneratedValue
public Integer getId() {
return this.id;
}
private List<Player> playerList;
@OneToMany
@Cascade(CascadeType.SAVE_UPDATE)
@JoinColumn(name="TEAM_ID...
I'm trying to pass a list to a function in Lisp, and change the contents of that list within the function without affecting the original list. I've read that Lisp is pass-by-value, and it's true, but there is something else going on that I don't quite understand. For example, this code works as expected:
(defun test ()
(setf origina...
I'm trying to figure out how to allocate a block of memory in a function and pass back a pointer to that block through one of the arguments. This is a C program. I seem to be having some trouble. Here's the code:
void foo(char *ptr)
{
if (!(ptr = malloc(size)))
printf("error");
/* code here */
printf("buffer a...
I'm using references to alter an array:
foreach($uNewAppointments as &$newAppointment)
{
foreach($appointments as &$appointment)
{
if($appointment == $newAppointment){
$appointment['index'] = $counter;
}
}
$newAppointment['index'] = $counter;
$newAppointments[$counter] = $newAppointment;
$counter++;
}
If I print the arra...
i am reading http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_3_-_Using_the_Database
$db =
when do i need to use references? i tried the same thing without reference and it works. i thought objects are passed by reference (probably assignment also)? if i assign by "copy" will there be any difference? maybe dro...
Hi,
[EDIT 1 - added third pointer syntax (Thanks Alex)]
Which method would you prefer for a DAL and why out of:
Car& DAL::loadCar(int id) {}
bool DAL::loadCar(int id, Car& car) {}
Car* DAL::loadCar(int id) {}
If unable to find the car first method returns null, second method returns false.
The second method would create a Car objec...
I am reasonably new to C# as a language (coming from a C++ background) and I am currently in the process of writing an application that makes use of an event driven API.
Primarily this consists of registering event/response handlers and starting event monitors then dealing with these asychronous events/responses.
The thing i'm having a...
Hey,
I have a Java program that calls a C++ program to authenticate users. I would like the program to return either true or false, and if false, update a pointer to an error message variable that i then can grab from the Java program.
Another explination:
The nataive method would look something like this:
public native String takeIn...