I have a char array with data from a text file and I need to convert it to hexadecimal format.
Is there such a function for C language.
Thank you in advance!
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?
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??
In silverlight 3 I had an object that had a property that was an observable collection. I returned this via a web service then databinded to it.
Upgrade to silveright 4.....
Now my program crashes because the Observable Collection is converted to an array.
What is the best way to do this? Observable collection is not even an option any longer.
Hi Guys
var arr = new Array();
arr[0] = 'Departmental News'
arr[1] = 'Departmental News'
arr[2] = 'Another Cat'
arr[3] = 'Another Cat'
arr[4] = 'Departmental News'
alert(arr)
alert($.unique(arr))
In IE I get duplicates.
In any other browser only the unique ones
Any Ideas?
// The first example:
char text[] = "henri";
char *p;
p = text;
*(p + 1) = 'E'; // Output = hEnri
// Now If we want to remove the "e" ie hnri, we would go for?????
*(p + 1)=?????
Please dont say start copying the array. I am looking for the best solution
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 a bunch of product sku's that look like:
abc234
asdf234324
adc234-b
result:
abc 234
asdf 234324
adc 234-b
I want to split the text at the first instance of a letter.
When I say split, basically I want to have access to both parts of the text, maybe in an array?
What's the best way to do this?
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'm having some issues in allocating memory for an array dynamically in C++ within Qt SDK ... Here's for I'm doing:
int dx = 5;
QPoint * qPoint;
qPoint = new QPoint[dx+1];
However when I try to debug the code, the programs just crashes when it tries to execute the third line .... any clues ?
I'm in the process of changing part of my C++ app from using an older C type array to a templated C++ container class. See this question for details. While the solution is working very well, each minor change I make to the templated code causes a very large amount of recompilation to take place, and hence drastically slows build time. Is there any way of getting template code out of the header and back into a cpp file, so that minor implementation changes don't cause major rebuilds?
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 a function foo(i) that takes an integer and takes a significant amount of time to execute. Will there be a significant performance difference between any of the following ways of initializing 'a':
a = [foo(i) for i in xrange(100)]
,
a = map(foo, range(100))
, and
vfoo = numpy.vectorize(foo)
vfoo(range(100))
? (I don't care whether the output is a list or a numpy array).
Is there some other better way of doing this?
Thanks.
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.
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?
Hello coders,
Super simple example:
var Path:String="E:\SWF Security\Acess Current Path\Access SWF URL.swf"
var Path1:Array = Path.split("\\") // Split using the backslash as delimiter (No limit the number of returned tokens)
trace(Path1)
What do you expect path1 to be ?
E: ?
No its E:SWF SecurityAcess Current PathAccess SWF URL.swf and i have no idea why.
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'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 ?
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;
}