Is there any way by which I can add keys to superglobals in php without defining the corresponding values to those key?
For example:
$_SESSION['key']='set';//key` automatically gets defined.
But I want to do something like this
add_key($_SESSION,'key')//key is added to $_SESSION array.
Is it possible?
Basically I want to get bezier control points from a ttf font and then draw them. I was basically wondering 2 things.
Does it return an array of points or is it more complex?
How can you tell the points of 1 contour from another ex: the letter O which has 2 contours?
Thanks
use heap sort to sort this in descending order and show the steps or explanation please
below is the tree
79
33 57
8 25 48
below is the array
79 - 33 - 57 - 8 - 25 - 48
ok ascending is easy because the largest element is at the top we can exchange the last element and the first element and then use heapify as the sample code in wikipedia describes it.
Hi
I'm quite sure that it is a stupid issue but it drives me crazy..
how could i print on the console a TCHAR array?
DWORD error = WSAGetLastError();
TCHAR errmsg[512];
int ret = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, error, 0, errmsg, 511, NULL);
i need to print errmsg...
Does Scala have iterators with 'set' and 'remove' methods for
iterating (and modifying) mutable collections like array?
If there is no such iterator then is there a good reason for that?
I would like to add a favorites tab to my iphone app that i am developing. I am using core data to populate a UITableView and would like in the detailed view to be able to add the selected item to the users favorites.
Would i go about this by adding the selected item to a new array?
I am very new to xcode and iphone programming so as much help and code would be gratefully received.
Hello all
I am just a beginner in programing i wish covert some code from C# to F#,
I have encotered this code: "float[] v1=new float[10]"
I need to use this pointer to pass to the function:
"ComputeBuffer bufV1 = new ComputeBuffer(Context, ComputeMemoryFlags.ReadWrite | ComputeMemoryFlags.UseHostPointer, v1);"
If i creat an array in F# like this: "let v1 = [| 1.0..10.0 |]"
and call now the funaction like this:
"let bufV1 = new ComputeBuffer(Context, ComputeMemoryFlags.ReadWrite ||| ComputeMemoryFlags.UseHostPointer, v1)"
Is it an error?? How do i pass a pointer??
I would like to have a quick script listing all active hosts in a LAN, and I am a bit lost. From other posts I figured that this can be done most effectively by polling the DHCP server (in my case a Lancom router) using SNMP.
However, I am not familiar with the SNMP commands in PHP. Is snmpwalk() the correct function? Can I get snmpwalk() or any other php function to return an array that contains a list of all live hosts?
How can I find the dimensions of a matrix in Python. Len(A) returns only one variable.
Edit:
Hi Thanks.
close = dataobj.get_data(timestamps, symbols, closefield)
Is (I assume) generating a matrix of integers (less likely strings). I need to find the size of that matrix, so I can run some tests without having to iterate through all of the elements. As far as the data type goes, I assume it's an array of arrays (or list of lists).
Hi all
I created a simple class in C++ which has a private dynamic array. In the constructor I initialize the array using new and in the destructor I free it using delete.
When I instantiate the class using Class a = Class(..); it works as expected, however it seems I cannot instantiate it using the new operator (Like Class *a = new Class(..);), I always get a segmentation fault.
What I don't understand is when I should use new to instantiate a class and when just call the constructor or should it be possible to instantiate a class either with new or by just calling the constructor.
float** A = new float*[3];
for (int i=0; i<3; i++) {
A[i] = new float[3];
}
A[0][0] = 3; A[0][1] = 3; A[0][2] = 4;
A[1][0] = 5; A[1][1] = 6; A[1][2] = 7;
A[2][0] = 1; A[2][1] = 2; A[2][2] = 3;
Matrix *M = new Matrix(A, 3, 3);
delete[] A;
delete M;
Below the class definition..
class Matrix
{
private:
int width;
int height;
int stride;
float* elements;
public:
Matrix(float** a, int n, int m);
~Matrix();
};
Matrix::Matrix(float** a, int n, int m)
{
// n: num rows
// m: elem per rows
elements = new float[n*m];
for (int i=0; i<n; i++) {
for (int j=0; j<m; j++) {
elements[i*n + j] = a[n][m];
}
}
}
Matrix::~Matrix()
{
delete[] elements;
}
I'm using OpenGL and was told I should draw circles at each vertex of my outline to get smoothness. I tried this and it works great. The problem is speed. It crippled my application to draw a circle at each vertex. I'm not sure how else to fix the anomaly of my outlines other than circles, but using display lists and trying with vertex array both were brutally slow. Thanks
if we have to implementations of string split for j2me, one returns vector and the other returns array , in terms of performance on hand held devices which one is the best choice ?
I try out CakePHP. I follow this Tutorial and can't find out why this code doesn't work. The code from the tutorial works fine.
echo $html -> link('Löschen', array('action' => 'delete', 'id' => $post['Post']['id']), null, 'Sind Sie sicher?' );
Hi, I'm trying to output lists of objects as json and would like to know if there's a way to make objects usable to json_encode? The code I've got looks something like
$related = $user->getRelatedUsers();
echo json_encode($related);
Right now, I'm just iterating through the array of users and individually exporting them into arrays for json_encode to turn into usable json for me. I've already tried making the objects iterable, but json_encode just seems to skip them anyway.
I have built a class which has a few methods in it, once of which returns an array, lets call this class A.
I have a second class, class B, which I would like to use to call the method from class A.
But, now how do I call that method from class A and store what is returned in a var in class B? Do I have to initiate the class? I have made sure to include the .h file from class A into class B.
Thanks for helping a newbie.
I have an array of NSStrings:
Flower
Car
Tree
Cat
Shoe
Some of these strings have images associated with them; some don't. I can build an image name by appending .png to the name (e.g. Flower.png).
How do I check whether that image actually exists within the bundle before I try to load it into the view?
question: how can i bind the same vector, lets say o=c(1,2,3,4) mutiple times to get a matrix like
o=array(c(1,2,3,4,1,2,3,4,1,2,3,4), dim(c(4,3))
o
[,1] [,2] [,3]
[1,] 1 1 1
[2,] 2 2 2
[3,] 3 3 3
[4,] 4 4 4
in a nicer way then: o=cbind(o,o,o) and maybe more generalized (dublicate()??
I need this to specifiy colors for elements in textplot()
thx a lot
I've got a method:
public native void doSomething(ByteBuffer in, ByteBuffer out);
Generated by javah C/C++ header of this method is:
JNIEXPORT void JNICALL Java__MyClass_doSomething (JNIEnv *, jobject, jobject, jobject, jint, jint);
How can I get a data array from jobject (that is a ByteBuffer instance) ?
I've got a function that requires const some_type** as an argument (some_type is a struct, and the function needs a pointer to an array of this type). I declared a local variable of type some_type*, and initialized it. Then I call the function as f(&some_array), and the compiler (gcc) says:
error: invalid conversion from ‘some_type**’ to ‘const some_type**’
What's the problem here? Why can't I convert a variable to const?
I'm basically trying to save all current css properties of an element in a local var/array.
I tried :
el.css();
and
el.css("*");
With no luck.
Is there any quick tip do to so ?
i have a textbox array using that i create 20 text boxes in runtime,
i need to get the focus if a particular text box(if i press downarrow
in keyboard how to get the key down of a particular text box it can be
3rd text box).
I want to take a string from stdin but I don't want a static array of fixed size
i knew that scanf need something where save the stdin input, but i can't do something like this:
char string[10]
scanf("%s",string);
becouse i need to knew before how long will be the string in order to allocate the right memory space
can you help me to resolve this problem?
When I try to initialize a 3D array of size 300*300*4 in a C program, my program stops running and reports stack overflow error. The system I am using has 3GB RAM, which should be sufficeint. Is there any way to increase memory allocated to a program? I am using Dev C++ on Windows Vista.