Questions tagged [custom-data-type]

199 questions
251
votes
19 answers

SQL server query to get the list of columns in a table along with Data types, NOT NULL, and PRIMARY KEY constraints

I need to write a query on SQL server to get the list of columns in a particular table, its associated data types (with length) and if they are not null. And I have managed to do this much. But now i also need to get, in the same table, against a…
Shrayas
  • 6,040
  • 11
  • 34
  • 54
14
votes
6 answers

Why does ('1'+'1') output 98 in Java?

I have the following code: class Example{ public static void main(String args[]){ System.out.println('1'+'1'); } } Why does it output 98?
Robin
  • 155
  • 5
13
votes
2 answers

Rails migrations with database-specific data types

I'm currently running a Rails migration where I am adding a datatype specific to Postgres, the tsvector. It holds search information in the form that Postgres expects for its built-in text searching capabilities. This is the line from my…
William Jones
  • 17,349
  • 16
  • 57
  • 97
10
votes
2 answers

Defining DataRange Expression in Protege for a Data Type Property

I am adding few new DataType in the OWL using Protege. The DataType is like percentage and I want to specify it's range with the double value ranging from 0 to 100. Similarly a DataType named Quality and I want to specify it's range with the double…
Gaurav
  • 491
  • 1
  • 4
  • 15
7
votes
1 answer

Is a Haskell type constructor 'just' a function?

I am going through "Haskell Programming from first principles" and found an exercise asking if the following [code slightly edited here] was valid: module Test where type Subject = String type Verb = String type Object = String data Sentence = …
Penguino
  • 2,008
  • 1
  • 12
  • 19
6
votes
2 answers

How to convert a custom type to an Integer in Haskell?

I am trying to use my own data type in haskell for prime numbers, but i am currently running into a few issues. newtype Prime = Prime Integer deriving (Eq, Ord, Typeable, Show) As soon as i am doing any numeric operation on a prime number (e.g. the…
6
votes
3 answers

Handling `id` in derived Aeson FromJSON instances with Aeson/JSON

If I have JSON and I try to derive the FromJSON instances automatically with Generics, I run into problems with id existing in more than one place in the JSON. Is there a way for me to override just the id part or do I have to write the whole…
matt
  • 1,376
  • 7
  • 19
5
votes
3 answers

How to define a lambda function that filters list based on subtype of a sum type?

The example is taken from a "Haskell programming from first principles" The goal of filter function is get rid of all the objects except those of 'DbDate' type. On somone's github I found a way to filter sum types with list comprehension and pattern…
5
votes
2 answers

Why so many custom data types in C?

Why are there so many custom data types like socklen_t, ssize_t, size_t, uint16_t? I don't understand the real need for them. To me, they’re just a bunch of new variable names to be learned.
Danilo Gacevic
  • 384
  • 2
  • 9
5
votes
1 answer

VBA Handling multiple custom datatype possibilities

I have done some research and haven't found any similar question. I have a VBA macro that imports a .CSV file containing telegrams sent by a device. In the end of this macro, I want to create a graph with the time elapsed on the x-axis and the value…
mickael
  • 63
  • 5
4
votes
1 answer

Problem with Eq in Haskell for comparing Lists

I'm implementing Lists in Haskell by myself, but I had a little problem while comparing two Lists for equality, data List a = Void | Cons a (List a) -- deriving (Show, Eq) instance (Eq a) => Eq (List a) where (==) a b = equalHelp a b equalHelp…
4
votes
1 answer

How to register the following datatype to allow serialization?

I am using QJson to serialize a QObject-derived class. I am able to serialize the class itself without any problems, but when it comes to one of its members, I am having a bit of trouble. The class is named CProject and it contains a property files…
Nathan Osman
  • 63,773
  • 66
  • 242
  • 344
4
votes
2 answers

Haskell: Understanding custom data types

I am trying to make my own custom data type in Haskell. I have the following data types: type Length = Integer type Rotation = Integer data Colour = Colour { red, green, blue, alpha :: Int } deriving (Show, Eq) I am trying to make a…
4
votes
1 answer

Spyder Variable explorer how to show custom data types?

The Spyder Variable explorer looks very interesting to me, but currently it can show only a limited number of data types: https://pythonhosted.org/spyder/variableexplorer.html If I define a custom class/data type, its instances will not show in the…
Sean Zhu
  • 130
  • 1
  • 7
4
votes
5 answers

Umbraco get PreValues in a data type

I am using Umbraco 7 and I have created a data type that uses the property type dropdown list publishing keys. How can I get the id of each prevalue? Thanks in advance.
sidy3d
  • 421
  • 1
  • 6
  • 20
1
2 3
13 14