types

Altering SQL column type and adding PK constraint

How to change the type of a column in a SQL table? I've got: CREATE TABLE table( id INTEGER, salt TEXT NOT NULL UNIQUE, step INT, insert_date TIMESTAMP ); I'd like to change salt's type to just TEXT and id's type to INTEGER PRIMARY KEY. UPD: I'm using SQLite. ...

Java Primitive Data Types

Why aren't Java primitive data types just called "Java data types"? ...

Accessor with different set and get types?

Simple question, hopefully a simple answer: I'd like to do the following: private DateTime m_internalDateTime; public var DateTimeProperty { get { return m_internalDateTime.ToString(); } // Return a string set { m_internalDateTime = value; } // here value is of type DateTime } The above is just an example of what I'm trying to ...

C#: From base class, get drived type?

Let's say we've got these two classes: public class Derived : Base { public Derived(string s) : base(s) { } } public class Base { protected Base(string s) { } } How can I find out from within the ctor of Base that Derived is the invoker? This is what I came up with: public class Derived : Base { public ...

Casting a variable using a Type variable

In C# can I cast a variable of type object to a variable of type T where T is defined in a Type variable? ...

Activator.CreateInstance(t, 42, args) cannot find constructor

I am using (a slightly extended version of) the following code in a factory-pattern style function: public class SingleItemNew : CheckoutContext { public BookingContext Data { get; set; } public SingleItemNew(BookingContext data) { Data = data; } } public CheckoutContext findContext(BookingContext...

C# get the types defining a Dictionary at run time

Hi there, I was wondering what is the best way for getting the generic arguments that definine a dictionary at run time is. Take for example: Dictionary<string, object> dict; How at runtime can I find out that the keys are strings? Thanks ...

Testing if object is of generic type in C#

I would like to perform a test if an object is of a generic type. I've tried the following without success: public bool Test() { List<int> list = new List<int>(); return list.GetType() == typeof(List<>); } What am I doing wrong and how do I perform this test? ...

What to do with “Inferred type is less polymorphic than expected”?

Hi, I need the Numeric.FAD library, albeit still being completely puzzled by existential types. This is the code: error_diffs :: [Double] -> NetworkState [(Int, Int, Double)] error_diffs desired_outputs = do diff_error <- (diff_op $ error' $ map FAD.lift desired_outputs)::(NetworkState ([FAD.Dual tag Double] -> FAD.Dual tag Double)) ...

what primitive or what type should we use to represent a telephone number in java?

what type could contain a number like 2023209999 in java? do you think that using a string type to represent a telephone number is a good idea? ...

c# Reflection object[] issue

Hello, I am trying to use reflection to create object array of the type created from reflection like the folowing: Client[] newArray = new Client[] {client1, client2}; I need to somehow get the Client object type to create the object so it can be passed through. Any help would be greatly appreciated. Cheers, Rob object clientObjec...

Haskell 64 bit numerical type

I am writing a function in Haskell that deals with numbers beyond the length of a 32 bit int. I cannot find the type to do this and I seem to be searching for the wrong terms. It needs to be able to hold numbers with the length of about 2^40 without any loss of precision Example: addTwo :: Int -> Int -> Int addTwo a b = a + b main ::...

SSIS transactional data (different record types, one file)

An interesting one, we're evaluating ETL tools for pre-processing statement data (e.g. utility bills, bank statements) for printing. Some of the data comes through in a single flat file, with different record types. e.g. a record type with "01" as the first field will be address data. This will have name and address fields. A record ty...

type conversion from webservice object to class object

hi all, i've created bunch of classes. i have webservices which reference these classes and contains the classes as parameters and return objects. when i call the weservice, i have to convert the class to the webservice object else i can type conversion error. is there a generic way to convert between these types without having to as...

How are the basic Delphi types related to each other?

Delphi has long supported a few basic numeric types and I was wondering how they are related to each other. In Delphi 2007 I found these declarations (some are conflicting, some are mere aliasses) : Types.pas: DWORD = LongWord; Largeint = Int64; getmem.inc: DWORD = Integer; Windows.pas: DWORD = Types.DWORD; SHORT = Smallint; UIN...

mysql float type

hello i am having a database order with price and deposit fields set to float type. iam also implemeting a java gui to search the order , the problem is when i try to search for the orders in the database i dont find anything because it saves price=55.0 when i convert from string to float and in the database it saves as 55 . what is the ...

C# child class returning a unknown type (futher: from parent)

i have interface: public interface Inx<T> { T Set(Data data); } simple class with this metod public class Base { ??? Set(Data data) { ... } } and parent class like that: public class Parent : Base, Inx<Parent> { ... } i want to return Parent type from Set metod in child class It's possible ? I need it do to something li...

Type problems with native Java classes.

Hello, I have the following problem, maybe someone can help me (or explain, where my mistake is). Given are a trait and a class: trait TextAttr[T <: {def setText(s:String); def getText : String}] { val obj : T def txt_= (s:String) = obj.setText(s) def txt = obj.getText } class ScalaText { private var t = "" def setText(s:Str...

C++ - Generic programming - Type selection

The following fragment returns the next highest power of two for an (assumed unsigned) integer of type T. It does this by shifting the bits repeatedly. For all intents and purposes the unsigned type i used in the bit shifting loop is sufficiently large to represent a (nominally) 65536 bit number. Practically therefore it's fine to lea...

How to validate string can be convert to specific type?

I have string which might be int, datetime, boolean, byte etc'. How can i validate that the string can be convert into those types without using the TryParse of each type? ...