I'm a bit confused what happened in the following code:
const int e = 2;
int* w = ( int* ) // (1) cast to remove const-ness
*w = 5; // (2)
cout // (3) outputs 5
cout // (4) outputs 2
cout // (5) w points to the address of e
cout
In (1), w points to the address of e. In...
The short version of the question - why can't I do this? I'm restricted to .NET 3.5.
T[] genericArray;
// Obviously T should be float!
genericArray = new T[3]{ 1.0f, 2.0f, 0.0f };
// Can't do this either, why the hell not
genericArray = new float[3]{ 1.0f, 2.0f, 0.0f };
Longer version -
I'm working with the Unity engine here, alth...
Well,
the question is kinda simple.
I have a object defined as:
public class FullListObject : System.Collections.ArrayList, IPagedCollection
And when i try to:
IPagedCollection pagedCollection = (IPagedCollection)value;
It don't work... value is a FullListObject... this is my new code trying to get around a issue with the "is" op...
Hi,
I have a string with hexvalues that I use with sha1()
echo sha1("\x23\x9A\xB9\xCB\x28\x2D\xAF\x66\x23\x1D\xC5\xA4\xDF\x6B\xFB\xAE\x00\x00\x00\x01");
ab94fcedf2664edfb9b291f85d7f77f27f2f4a9d
now I have another string with the same value only not hex.
$string2=strtoupper("239ab9cb282daf66231dc5a4df6bfbae00000001");
I want to co...
My issue is within AMO in a C# console application. I have a DataSourceView that has a table which has a column of type Decimal.
When I try to create a measure out of it, AMO says that it cannot create a measure because the data type is string.
I believe there may be some implicit typecasting going on in the background that is causing...
I need to call the index of a matrix made using the linspace command, and based on somde data taken from an oscilloscope. Because of this, the data inputed is a double. However, I can't really call:
Time[V0Found]
where V0Found is something like 5.2 however, taking index 5 is close enough, so I need to drop the decimal. I used this ...
Hi all,
Is there any way how can i convert a nstimeinterval type value to a string type in xcode?
Thanks in advance
Joy
...
Hi,
I am coding up an implementation of Interpolation Search in C.
The question is actually rather simple, I need to use the floating operations to do linear interpolation to find the correct index which will eventually be an integer result.
In particular my probe index is:
t = i + floor((((k-low)/(high-low)) * (j-i)));
where, i,j,...
InvalidCastException when calling COM interface on Windows Mobile.
I am trying to build a DirectShow source filter on Windows Mobile 5 based on the Generic Sample Source Filter (GSSF) sample from DirectShowLib. It uses C# configuration and callback functions with a C++ DirectShow filter.
I have this working in .Net CF on Windows XP but ...
I have a question about type casting. I have the following JSON String:
{"server":"clients","method":"whoIs","arguments":["hello"]}
I am parsing it to the following Map<String, Object>.
{arguments=[hello], method=whoIs, server=clients}
It is now possible to do the following:
request.get("arguments");
This works fine. But I need ...
My Code:
public class Contact
{
public string id{ get; set; }
public string contact_type_id { get; set; }
public string value{ get; set; }
public string person_id { get; set; }
public Contact()
{
}
}
public class Contact:Base.Contact
{
public ContactType ContactType { get; set; }
public Person Perso...
Hello,
I have two classes which both extends Example.
public class ClassA extends Example {
public ClassA() {
super("a", "class");
}
....
}
public class ClassB extends Example {
public ClassB() {
super("b", "class");
}
....
}
public class Example () {
public String get(String x, Strin...
I have method to which I pass an object. In this method I check it's type and depending on the type I do something with it and return a Long. I have tried every which way I can think of to do this and I always get several compiler errors telling me it expects a certain object but gets another. Can someone please explain to me what I a...
I have a COM object written in Visual Fox Pro 9.0. It has the following procedure:
PROCEDURE GetArray(m.vcArrayName as String) as array
RETURN @&vcArrayName
The COM object is referenced in a VS2010 project using C#. The signature of the procedure in C# is:
object GetArray(string vcArrayName);
When debugging I can see that the r...
I'm learning about static vs dynamic types, and I am to the point of understanding it for the most part, but this case still eludes me.
If class B extends A, and I have:
A x = new B();
Is the following allowed?:
B y = x;
Or is explicit casting required?:
B y = (B)x;
Thanks!
...
Somewhere in lines of code, I came across this construct...
//void* v = void* value from an iterator
int i = (int)(long(v))
What possible purpose can this contruct serve?
Why not simply use int(v) instead? Why the cast to long first?
...
I have the following code, which uses a Unicode string class from a library that I'm writing:
#include <cstdio>
#include "ucpp"
main() {
ustring a = "test";
ustring b = "ing";
ustring c = "- -";
ustring d;
d = "cafe\xcc\x81";
printf("%s\n", (a + b + c[1] + d).encode());
}
The encode method of the ustring class instances co...
I wrote a blog post a while ago detailing how the availability of both primitive and object-wrapped value types in JavaScript (for things such as Number, String and Boolean) causes trouble, including but not limited to type-casting to a boolean (e.g. object-wrapped NaN, "" and false actually type-cast to true).
My question is, with all ...
Hi all,
i want to cast from upper class pointer to lower class i.e from the base class pointer to derived class pointer.
Should i use "Dynamic_cast" or "reinterpret_cast"? please advice me
...
I know you can convert a String to an number with read like so:
Prelude> read "3" :: Int
3
Prelude> read "3" :: Double
3.0
But how do you grab the string representation of an Int value?
...