datatypes

In JDBC, when to use Time, Date, and Timestamp

JDBC offers me 3 different datatypes for time-related fields: "Date", "Time" and "Timestamp". Can someone provide a simple summary of what each one is used for and how to choose which to use for a given problem? ...

Type Name aliasing in C#

Possible Duplicates: typedef in C#? STL like containter typedef shortcut? I was wondering if there was an equivalent to Type aliasing from Functional Languages that I can use in C# For example in a nice functional language like Haskell I can say something like the following to alias an existing type to a custom Type Name typ...

What is the difference between UCHAR and WCHAR in Visual C++?

Hello, can any body tell me, what is actually the difference between UCHAR and WCHAR. I am using VC++ 6.0. Thanks in Advance ...

If a language has the type "string" and "float", but it also allows operation on any data type, then is this language typed or untyped?

This question arises from this question. One saying is that if a language has the type string or float, etc, then it is typed. But what if it also fits Wikipedia's explanation of untyped: http://en.wikipedia.org/wiki/Programming_language#Typed_versus_untyped_languages an untyped language, such as most assembly languages, allows ...

Fastest .Net and SQL data types

I hope this question isn’t too “right field” and I'll be upfront in saying I'm a newb compared to many people on stackflow... I want to compare object representations of images, audio and text for an AI project I am working on. I'd like to convert all three inputs into a single data type and use a central comparison algorithm to determi...

Is there any benefit to using char instead of string for single-character values?

For .NET fields and properties that by definition only contain a single character, is there any benefit to defining them as char instead of string? Or is that an incorrect use of the char data type? I'm thinking of a field that can hold an M or F for sex, or a middle initial, or an indicator stored in the database as a Y or N. I typical...

C# Generics and Type Checking

I have a method that uses an IList as a parameter. I need to check what the type of that T object is and do something based on it. I was trying to use the T value, but the compiler does not not allow it. My solution is the following: private static string BuildClause<T>(IList<T> clause) { if (clause.Count > 0) { if (c...

Python JSON encoding

I'm trying to encode data to JSON in Python and I been having a quite a bit of trouble. I believe the problem is simply a misunderstanding. I'm relatively new to Python and never really got familiar with the various Python data types, so that's most likely what's messing me up. Currently I am declaring a list, looping through and ano...

Why is Nan (not a number) only available for doubles?

I have a business class that contains two nullable decimal properties. A third property returns the result of multiplying the other two properties. If HasValue is true for the two nullable types then I multiply and return the result. I have a few options for the return value if one or both of the properties is null: Return 0 Throw an e...

hibernate mapping for postgresql "timestamp without time zone"?

I'm trying to map java.util.Date to postgresql timestamp without time zone type. I'm using a custom sql-insert statement (because the table is partitioned and postgresql won't return number of rows updated on a normal insert), and I keep getting an error saying the function does not exist. I suspect this is due to a problem mapping the...

PHP: intval() equivalent for numbers >= 2147483647

Hello! In PHP 5, I use intval() whenever I get numbers as an input. This way, I want to ensure that I get no strings or floating numbers. My input numbers should all be in whole numbers. But when I get numbers >= 2147483647, the signed integer limit is crossed. What can I do to have an intval() equivalent for numbers in all sizes? Her...

SQL Server 2005 Assembly Cast Invalid

I'm trying to call my assemblys SP and receive the following error: A .NET Framework error occurred during execution of user-defined routine or aggregate "Pmt_ImportJournal": System.InvalidCastException: Specified cast is not valid. System.InvalidCastException: at JournalImport.Pmt_ImportJournal(Int32 orderno) My SP in the assemb...

Is there any difference between these two statements?

float ff = 1.2f; Float fo = new Float(1.2f); double fg = 3.2d; Double fh = new Double(2.1d); Can I use '=' between the (1) and (3) or between the (2) and (4)?? ...

Flash Lite access complex data on the webservice .net based?

Hi All, I am new to flashlite/actionscript, my problem is.. how can i call a method in the webservice having complex data(return data and paramters), The web service is .net based and it is tuned for a mobile friendly type of webservice(without xsd:import)... And the problem is brought up when the complex data from/parameter of WS is a s...

Change a database column type while ignoring conversion errors using SQL

This is similar to a previous question MSSQL: Change type of a column with numbers from varchar to int, except in this case not all of the original data can be successfully converted from varchar to int. In these cases, I want the output to just be NULL. For example, the incoming set of values in a varchar column will look like: {'123...

What happens when we dont specify datatype of arguments in a function and pass parameters to it while calling it?

Look at the following program. int main() { char a=65, ch ='c'; printit(a,ch); } printit(a,ch) { printf("a=%d ch=%c",a,ch); } Even if the data type of the arguments is not specified in the function 'printit()', the result is shown on printf. I see correct answer when i compile it with gcc and run it.Why? Is it not neces...

Is there any way to DISTINCT or group by a text (or ntext) in SQL Server 2005?

In a table, I have a column called MEMO_TEXT that is a text data type. When I try creating a view and use a GROUP BY, I get the following error: SQL Server Database Error: The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. I get this error when I try to do a DISTINCT on the ...

Haskell lists of datatypes

This is probably another easy Haskell question. If I have some "nested" data types, such as in this example code: data Place = Country | State | City String deriving Show data State = California | NewYork deriving Show data Country = USA | Canada derivin...

Remove Invalid data from VarChar column

I have a database with a column of VarChar type, within which are integers (which I want to keep) and miscellaneous non-numeric values (which I want to remove). If I alter the table and add a new integer column, how can I copy only the integers into the new integer column? ...

What is be the most appropriate data type for storing an IP address in SQL server?

What should be the most recommended datatype for storing an IPv4 address in SQL server? Or maybe someone has already created a user SQL data-type (.Net assembly) for it? I don't need sorting. ...