Is there any semantic difference between ToXXXX conversion methods and AsXXXX conversion methods in the .NET framework?
Examples of such methods are Object.ToString and Enumerable.AsEnumerable<T>.
If no: Are there still recommendations when to name a conversion method AsXXXX and when to name it ToXXXX?
If yes: Is there a .NET framewor...
I've been trying to watch a USB subsystem to detect when devices are added or removed, but I'm having trouble decoding the PDEV_BROADCAST_DEVICEINTERFACE::dbcc_name field. My code is based on an example over on codeproject.
If I right-click in my C++/CLI application in visual studio and go to the declaration in Dbt.h I get:
typedef str...
Short version: Why don't I have to coerce 60, and int, into a double, so that I can use division with another double if I DO care about the fractional part?
Long version: my boss called me out on a line of code. I tested it and it is working perfectly fine, but he thinks I have a bug waiting to happen.
int durationinseconds = 61; // ...
Attempting to implement code similar to that found in the higher-order-function example from http://www.codecommit.com/blog/scala/scala-for-java-refugees-part-6
val button = new JButton("test")
button.addActionListener{ e:ActionEvent => println("test") }
add(button)
leads to the following
error: type mismatch;
found : (java.awt.ev...
I've been banging my head against a wall for the past hour trying to figure this out, sql is giving me the following error
Msg 8169, Level 16, State 2, Procedure GetAppointmentsByProfessionalName, Line 6
Conversion failed when converting from a character string to uniqueidentifier.
when this stored procedure is executed
-- ======...
I am trying to read the contents of a file (which contains both 'standard' text and 'binary' data).
I then need to take that character (standard or extended ASCII) and get the corresponding Decimal (int) ASCII value.
I am having a heck of time getting it to work correctly.
Here is a snippet of the code to help show what I am currently...
int x = 5;
cout<<(char)x;
the code above outputs an int x in raw binary, but only 1 byte. what I need it to do is output the x as 4-bytes in binary, because in my code, x can be anywhere between 0 and 2^32-1, since
cout<<(int)x;
doesn't do the trick, how would I do it?
...
Is there any function in C++ which converts all data types (double, int, short, etc) to string?
...
I have following class:
template <size_t size>
class Araye{
public:
Araye(int input[]){
for (int i=0;i<size;i++)
araye[i]=input[i];
}
int araye[size];
};
How should I write a cast-to-reference-to-array operator for this class so that following works:
int adad[3]={1,2,3};
Araye<3> araye(adad);
int (&reference)[3]=araye;
...
Hi,
I have a string type to be assigned to owner of type 'User'. My method GetFullName returns the name in a 'string' format and i need to assign it to owner of type 'User'
def.Owner = uf.GetFullName(row["assignedto"].ToString());
Any suggestions would be helpful,
...
Hello, just when I thought I understood something about type conversion in JavaScript, I stumbled with this:
+[]; // 0
Number([]); // 0
My first thought was that I should get NaN, just like if I try to convert an empty object to number:
+{}; // NaN
Number({}); // NaN
I have been searching about this for a while without any success....
I'm having a problem creating a custom converter. It works if I type in the correct value, but if I intentionally type something incorrectly, instead of giving me the errors nicely, I get a long and mean looking stack trace.
Here is my converter:
public class CircleTypeConverter extends StrutsTypeConverter
{
public Object conver...
Is it possible to change the
float *pointer
type that is used in the VS c++ project
to some other type, so that it will still behave as a floating type but with less range?
I know that the floating point values never exceed some fixed value in that project, so I want to optimize the program by memory it uses. It doesn't need 4 byte...
I am trying to accept input of two integers, separated by a space: 3 5 and save that into an integer array. I do this 3 times, but I am having trouble converting this from string to integers. Here is my loop:
for i in 1..3
puts "What is point " + i.to_s + " ?" # asks for input
s.push gets.split(" ")
end
Then, I want to have...
Hello!
I am passing data from C# to R over a COM interface. When the data arrives in R it is housed in a 'Matrix'. Some of the functions that I use require that the data be inside a 'DataFrame' instead. I convert the data structure using
newDataFrame <- as.data.frame(oldMatrix)
The table of data reaches R just fine, once I make the...
I have my own SmartPointer class.
There are cases where SmartPtr contain a class that inherite from a Base class, and I would like to convert SmartPtr<ClassX> into SmartPtr<BaseClassOfClassX>;
I am trying to overload the SmartPtr Conversion operator to do this.
It work fine for the Class themself, such as:
template<class newType>
ope...
In PHP, when you have something in the URL like "var=true" in the URL, does the 'true' and 'false' in the URL get translated to boolean variables, or do they equal the text 'true' or 'false'? For instance, would, with the url having "var=false" in it:
if ($_GET['var'] == false) { ... }
work? Or would the variable always be true since ...
I'trying to convert a float to an int value in php:
var_dump((int)(39.3 * 100.0)); //Returns 3929 but should be 3930!
var_dump((int)(39.2 * 100.0)); //Returns 3920
I can use ceil to make it work but can somebody explain this to me?
var_dump((int)ceil(39.3 * 100.0)); //Returns 3930
...
Hello All,
I am new to C++ programming. I am analyzing a code and I found the following:
typedef unsigned short UINT16;
typedef unsigned long UINT32;
typedef UNIT16 FLAG;
//within a structure,
struct x
{
const FLAG& flag; //what this means??
};
When I change the FLAG datatype to UNIT32, then FLAG& is returning some other value...
Is there a way to override an abstract class's method signature which uses <T> with a ClassName so I can pass an object by reference without recasting it?
For example, I have a bunch of Object Managers. I want them all to contain a .Save(Object) method which will perform the appropriate save action based on the object state (Insert, Upd...