datatypes

If-else block and unexpected results with float datatype. [Edited with one more question]

Hello, I compiled the following program with gcc 4.4.1 and I get unexpected output (Well, unexpected for me) #include<stdio.h> int main() { float x=0.3, y=0.7; if(x==0.3) { if(y==0.7) printf("Y\n\n"); else printf("X\n\n"); }...

Can anyone explain this code?

1: user=> (def some-account {:number :any­-number :balance :any­-balance :bank :any­-bank}) 2: #'user/some-account 3: user=> (contains? some-account :bank) 4: true 5: user=> (assoc some-account :owner :any-owner) 6: {:owner :any-owner, :number :any­-number, :balance :any­-balance, :bank :any­-bank} 7: user=> (contains? some-account :owne...

Model inheritance using functional programming style data types

I've been using F# recently and tried to code in a functional way rather than doing OOP all over again in a different syntax. I've now run into a problem that I could solve with a mix of inheritance and discriminated unions but for which I'm trying to find a pure functional style representation. What I want to model is something like th...

How can I check the final type of a variable?

I have a BaseClass, a DerivedClass1 and a DerivedClass2 from a third party library. DerivedClass1 and DerivedClass2 both inherit from BaseClass. There's a ContainerClass, from the same library, with a member variable ActiveItem, which can be of DerivedClass1 or DerivedClass2, so it is declared as BaseClass. I want to know if ActiveItem...

Java library or text file that maps mime types to nice human friendly file types.

GOAL My goal is to find a text file or library that enables me to map when given a mime type input and return a nice human friendly format. For example given the mime type for Word (as shown below) I would like a result that is something like "Microsoft Office Word Document". application/vnd.openxmlformats-officedocument.wordprocessing...

How To Store Mixed Array Data?

Let's say I have an array I need to store string values as well as double values. I know I can store the doubles as strings, and just deal with the conversions, but is it possible to use an array with two data types? ...

How to retrieve the java data types of columns from the database using Hibernate ?

I want to retrieve the java data types of the columns of a table in MySql using hibernate so that I can dynamically convert my input data to corresponding data type while inserting into database. One way is to read the class-name.hbm.xml and retrieve the data type information but I want the data types straight from the database and not ...

C#: Is data type the same as type?

Hi, maybe its silly but I am not sure if there is difference between types and data types int is data type class A{} A is type or data type? ...

STATE_ABBR in SSRS data type does not match the matching field data type

I'm creating an analytical US state map using SSRS. I've matched the STATE_ABBR field to my db's state abbreviation field that is of data type VARCHAR(50). I changed the data type to VARCHAR(2) and CHAR(2) but still get the following error: The expression that specifies the binding field 'STATE_ABBR' for layer 'PlygonLayer2' in the m...

Can I name a tuple (define a structure?) in Scala 2.8?

It does not look very good for me to always repeat a line-long tuple definition every time I need it. Can I just name it and use as a type name? Would be nice to name its fields also instead of using ._1, ._2 etc. ...

What's the least (negative) integer value that can be exactly represented by Double type in all major x86 systems?

What's the least (negative) integer value that can be exactly represented by Double type in all major x86 systems? Especially in (simultaneously) JVM, MySQL, MS SQL Server, .Net, PHP, Python and JavaScript (whatever corresponding type it uses). The reason why I ask about this is because I'd like to choose a value to use to represent an ...

Python Excel parsing data with xlrd

Fairly simple; I've got the data I want out of the excel file, but can't seem to find anything inside the XLRD readme that explains how to go from this: xldate:40397.007905092592 number:10000.0 text:u'No' number:0.1203 number:0.096000000000000002 number:0.126 to their respective python datatypes. Any ideas? ...

Alter Colum Datatype from Int to Ntext and vice-versa

Hi Experts, I have a Sql table CREATE TABLE [UserTable] ( [ID] [int] NULL, [Name] [nvarchar](50) NULL, [City] [nvarchar](50) NULL ) ON [PRIMARY] In this table column ID have the Datatype Int, I want to alter the data type of the ID column to Ntext, For that I am using the following Sql Query: ALTER TABLE UserTable ALTER...

PHP Typecasting - Good or bad?

After some work in C and Java I've been more and more annoyed by the wild west laws in PHP. What I really feel that PHP lacks is strict data types. The fact that string('0') == (int)0 == (boolean)false is one example. You cannot rely on what the data type a function returns is. You can neither force arguments of a function to be of a sp...

What SQL Server DataType should I use for a Text field which will be JOINED, "LIKE'd" and Queried against alot?

The title really says it all, a bit more info though for those who bothered to click. Strings will be of variable length typically between 2-5 characters in length, could occasionalyl exceed 5 characters and be upwards of 10. Never more than 10. Will be queried on like such: SELECT ... WHERE ... = 'abcd'; SELECT ... WHERE ... LIKE 'ab...

How is memory allocated for Hashtable?

When a hash table is initialized how is memory is allocated for it? When we add new members to it how does the memory used by the hash table get extended? Does it ever happen that a hash table is not able to store objects after a fixed size? ...

What's the equvalent to .Net ArrayList mutable type in Scala 2.8?

What type in Scala 2.8 can I use to store a list of values? In C# I'd use ArrayList. ...

UIDatePicker return value data type question

I want to pass back data from a UIDatePicker that is setup like this: UIDatePicker *pickerView = [[UIDatePicker alloc] init]; pickerView.datePickerMode = UIDatePickerModeCountDownTimer; The picker mode is set to be the count down timer. What type of data type do I need to pass back to the delegate? I was thinking it would be somethi...

Does it really matter to distinct between short, int, long?

Hi, In my C# app, I would like to know whether it is really important to use short for smaller numbers, int for bigger etc. Does the memory consumption really matter? ...

defining a "VARIANT" column type in SQLite?

Is there a way to define a column type in SQLite that holds any datatype that SQLite supports? I have unsigned chars, signedchars, unsigned ints, signed ints, UTF-8 chars and blobs that I want to populate in a single column. Reference to any literature is also appreciated. ...