types

Type mismatch with generics

Here's an interface: public interface Foo<T> extends Comparable<Foo<T>> { ... } And there are some classes implementing this interface: public class Bar extends Something implements Foo<Something> { public Vector<Foo<Bar>> giveBar() { ... } } public class Boo extends SomethingElse implements Foo<SomethingElse> { ...

PHP array_intersect() - how does it handle different types?

If I've got an array of values that are basically zerofilled string representations of various numbers and another array of integers, will array_intersect() still match elements of different types? For example, would this work: $arrayOne = array('0003', '0004', '0005'); $arrayTwo = array(4, 5, 6); $intersect = array_intersect($arrayOn...

Why can't I reference a user defined type field when using nested queries?

So I have the following user defined type in my oracle database: CREATE OR REPLACE TYPE METRIC_IMPERIAL_DISTANCE AS OBJECT ( METERS_FEET INTEGER, CENTIMETERS_INCHES INTEGER, FRACTION NUMBER ) I can do the following: SELECT t_id, get_distance_breakdown (h.height, h.unit_of_measure_id) height_breakdown FROM heights h an...

ASP.Net Validation

I want to validate the value a user enters in a text box, so that it only enters float numbers. I'm not interested in range. How can I do this, considering also culture localization information (e.g. "." or "," as separators)? ...

Why do C++ streams use char instead of unsigned char?

I've always wondered why the C++ Standard library has instantiated basic_[io]stream and all its variants using the char type instead of the unsigned char type. char means (depending on whether it is signed or not) you can have overflow and underflow for operations like get(), which will lead to implementation-defined value of the variabl...

Why Type.Equals(t1, t2) and not the equality operator?

Why must Type.Equals(t1, t2) be used to determine equivalent types, and not the equality operator (e.g. for VB.NET, t1 = t2)? It seems inconsistent with other parts of the .NET API. Example in VB.NET: If GetType(String) = GetType(String) Then Debug.Print("The same, of course") End If causes a compile-time error of "Operator '=...

Difference between <input type='button' /> and <input type='submit' />

There is no such thing as a stupid question, so here we go: What is the difference between between <input type='button' /> and <input type='submit' />? ...

warning C4244: 'argument' : conversion from 'SIZE_T' to 'DWORD', possible loss of data

I need to have a set of overloaded functions in my code but I get convertion wanrings. Here is a test code: #include windows.h void f(DWORD arg){...} //void f(SIZE_T arg){} void main(void) { DWORD dword=0; SIZE_T size_t=dword; f(size_t); } The compiler gives warning: test.cpp(11) : warning C4244: 'argument' : conversion from 'SIZ...

What is an Existential Type?

I read through the wikipedia entry on this. I gathered that they're called existential types because of the existential operator (∃). I'm not sure what the point of it is, though. What's the difference between T = ∃X { X a; int f(X); } and T = ∀x { X a; int f(X); } ...

workarounds for nameof() operator in C#: typesafe databinding

There's been a lot of wishes to include nameof () operator in C#, so that you could do, for instance, nameof (Customer.Name), which will return you "Name". I have a domain object. And I have to bind it. And I need names of properties as strings then. And I want them typesafe. I remember, there was a workaround for .NET 3.5 which involv...

Correct way to detect sequence parameter?

I want to write a function that accepts a parameter which can be either a sequence or a single value. The type of value is str, int, etc., but I don't want it to be restricted to a hardcoded list. In other words, I want to know if the parameter X is a sequence or something I have to convert to a sequence to avoid special-casing later. I...

Java Hashmap and Mutlidimensional array type sig in JNSI?

I've got a method JSNI that calls a Java method that take a Hasmap as input. I've tried [email protected]::myMethod(Ljava/util/Hashmap;)(myHashMap); [email protected]::myMethod(Ljava/util/Hashmap<Ljava/lang/String,Ljava/lang/String>;)(myHashMap); I'm can't seem to define the correct type signature to include the Strings or...

Do C# objects know the type of the more specific class?

Suppose you create a generic Object variable and assign it to a specific instance. If you do GetType(), will it get type Object or the type of the original class? ...

Check for any int type in C#?

I have a function that, among other things, takes in an object and a Type, and converts the object into that Type. However, the input object is often a double, and the type some variation of int (uint, long, etc.). I want this to work if a round number is passed in as a double (like 4.0), but to throw an exception if a decimal is passe...

Deciding on type in the runtime and applying it in generic type - how can I do this ?

I would like to create a strongly type list and decide the type in runtime. This is my code.I thought it should work, but it doesn't :) Type elementType = Type.GetType(parts[0].Trim(),false,true); var elementsBeingSet = new List<elementType>(); would you have any ideat how to create a strongly typed list whose type I...

Warnings using format strings with sprintf() in C++

Compiling this lines long int sz; char tmpret[128]; //take substring of c, translate in c string, convert to int, //and multiply with 1024 sz=atoi(c.substr(0,pos).c_str())*1024; snprintf(tmpret,128,"%l",sz); I read two warning on snprintf line: warning: conversion lacks type at end of format warning: too ...

The 'invalid field type' error with TClientDataSets I don't understand

Hi I use nested database stuctures with TClientDataSets. I'm new to programming so my lingo is ten-to-one wrong. My problem is as follows: I defined my database stucture and all the fields of the nested stuctures and then I called the CreatDataSet method of the master clientDataSet and it worked. I then wanted to add another data fiel...

How to change the base type of a UDT in Sql Server 2005?

I have my type "x" of type varchar(50). How can I alter it to varchar(100)? It seems I can't! ...

Finding the type of an object in C++

I have a class A and another class that inherits from it, B. I am overriding a function that accepts an object of type A as a parameter, so I have to accept an A. However, I later call functions that only B has, so I want to return false and not proceed if the object passed is not of type B. What is the best way to find out which type t...

How do you find the range of values that integer types can represent in C++?

The size and range of the integer value types in C++ are platform specific. Values found on most 32-bit systems can be found here. How do you determine what the actual size and range are for your specific system? ...