datatypes

Datatypes for physics

Hi, I'm currently designing a program that will involve some physics (nothing too fancy, a few balls crashing to each other) What's the most exact datatype I can use to represent position (without a feeling of discrete jumps) in c#? Also, what's the smallest ammount of time I can get between t and t+1? One tick? EDIT: Clarifying: What...

C# Datatype for large sorted collection with position?

I am trying to compare two large datasets from a SQL query. Right now the SQL query is done externally and the results from each dataset is saved into its own csv file. My little C# console application loads up the two text/csv files and compares them for differences and saves the differences to a text file. Its a very simple applicatio...

Is it possible to store and retrieve a boolean value in a varchar field using Java JDBC?

Hi, quick question: my customer has a situation where he has his database with a varchar field and the corresponding jdbc code is storing/retrieving a boolean. I guess that the boolean values false and true are going to be translated to "0" and "1" but I would like to have a confirmation of this (I can't find the precise behavior speci...

Should I never use primitive types again?

Mixing the use of primitive data types and their respective wrapper classes, in Java, can lead to a lot of bugs. The following example illustrates the issue: int i = 4; ... if (i == 10) doCrap(); Later on you figure that you want the variable i to be either defined or undefined, so you change the above instantiation to: Integer i =...

How do I parse a number from a String that may have a leading zero?

In ruby I am parsing a date in the following format: 24092008. I want to convert each section (year, month, date) into a number. I have split them up using a regex which produces three Strings which I am passing into the Integer constructor. date =~ /^([\d]{2})([\d]{2})([\d]{4})/ year = Integer($3) month = Integer($2) day = Int...

Setting data type when reading XML data in SAS

I need to control the data type when reading XML data in SAS. The XML data are written and accessed using the XML libname engine in SAS. SAS seems to guess the data type based on the contents of a column: If I write "20081002" to my XML data in a character column, it will be read back in as a numerical variable. An example: filename m...

SQL Server 2005 encryption trigger

Hello, I have a script that successfully encrypts a credit card. I need it to work as a trigger, so that any insert done to the creditcard column automatically encrypts it. Right now, my trigger works BUT the creditcard column is a varchar. When an app tries to insert, I do this: DECLARE @encryptedCreditCardNumber varbinary(max) SET @...

What are the lengths of common datatypes?

How many bytes would an int contain and how many would a long contain? Context: C++ 32 bit computer Any difference on a 64-bit computer? ...

Letters within integers. What are they?

This is an excerpt of code from a class I am working with in Java (below). Obviously the code is defining a static variable named EPSILON with the data type double. What I don't understand is the "1E-14" part. What kind of number is that? What does it mean? final double EPSILON = 1E-14; ...

VB6 Date Datatype: Precision and formatting

Guys, Does anyone know 1) how precise the vb6 Date date type is (by way of fractions of a second) and how to format it to show fractions of a second. I'm revisiting vb6 after many years absence, and for the life of me can't remember. The things I used to know . . . Thanks P.S. I considered putting a "memory-leak" tag on this, beca...

In MySQL, is there any difference (performance-wise) between decimal and double?

In my database, I would like to store a decimal score. A score can have a value from 0 to 10, and values in between, such as 2.3 or 9.4. I recently learned that int only stores whole numbers and not decimals. I found out that you could use either double or decimal, but what I would like to know is if there is any difference at all? I'm...

Data Types supported in visual studio 2008

I just downloaded and installed the latest Adventure Works database from http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=16040 to do some more playing around with LINQ and found that there are some data types that are not natively supported within Visual Studio 2008. I get the "One or more selected items ...

What is the best datatype to use for storing moderate amounts of text in SQL Server (2005)?

What is the best datatype to use for storing moderate amounts of text in SQL Server (2005)? For example, imagine a table, storing information on downloads available on a website. I want a title for the download which is brief, say varchar(20). A path, say varchar(255) then I want to store some user friendly text about the download - a d...

What data type do you use for storing IDs?

Why is there a minimum character count for posting questions? o.O Anyway, my question is as clear as can be from the title. Do you use int, bigint, tinyint, whatever. It seems like a small thing I guess, I was just wondering what the usual practice is. ...

What is the data type for length property for Java arrays?

I want to find out if length property for Java arrays is an int/long or something else. ...

String vs string in C#

In C# the string keyword (highlighted in Visual Studio as a data type) is just a shortcut to the String class right? In that case, it would be the same to use either while coding from the semantic point of view. However, is it the same from the performance point of view? I mean, when the mapping is performed: during compilation (I guess...

Limiting File Attachments to a SQL Server 2005 DB to a value > 8000 bytes

I have a .Net app that will allow the users to attach files to a SQL Server 2005 database. I want to limit the filesize to 10MB, so from what I can tell, I have to declare the datatype varbinary(max), since the max size I can actually specify is 8000 bytes. But the ~2GB filesize varbinary(max) allows seems like overkill. Is there a wa...

MySQL: what data type to use for hashed password field and what length?

I'm not sure how password hashing works (will be implementing it later), but need to create database schema now. I'm thinking of limiting passwords to 4-20 characters, but as I understand after encrypting hash string will be of different length. So, how to store these passwords in the database? ...

What is the best datatype for currencies in MySQL?

I want to store values in a bunch of currencies and I'm not too keen on the imprecise nature of floats. Being able to do math on them directly in queries is also a requirement. Is Decimal the way to go here? ...

Sql Server 2005: what data type to use to store passwords hashed by SHA-256 algorithm?

In Sql Server 2005 what data type should be used to store passwords hashed by SHA-256 algorithm? The data is hashed by the application and passed to the database ...