Questions tagged [types]

Types, and type systems, are used to enforce levels of abstraction in programs.

0
votes
0answers
12 views

String to char in switch function, java

I am new to programming and I am trying to write a code for frequency analysis of a sentence. I have a problem, that in switch statement it is char and in case it is string, which does not work ...
3
votes
1answer
47 views

Why is this template expansion legal in C++?

Consider the following code:template <typename T>void foo(const T& param) {std::cout << __PRETTY_FUNCTION__ << std::endl;std::cout << param;}int main(){...
0
votes
1answer
15 views

Is it possible to add a subtype's tuple to a type's tuples array in Swift?

I want to declare this constant:let simultaneousGestures: [(UIGestureRecognizer.Type, UIGestureRecognizer.Type)]=[(UIPanGestureRecognizer, UIPinchGestureRecognizer), (...
2
votes
2answers
56 views

Bit rotation with signed char (C)?

I'm trying to rotate a signed char (*c), which in binary is 10011010, right 4 (numRotate) places. The desired outcome after the shift is 10101001. The code I currently have is:void right(char *c, ...
0
votes
1answer
24 views

How to display monetary value in PostgreSQL

My database query is below, but I still can't display a monetary value properly. Please help me.SELECT SUM (orders.quantity * products.price) as total,to_char((orders.quantity * products.price), '$...
1
vote
1answer
16 views

Yaml serialization through camel: using base class load/dump and accessing type(self) in decorator

TL;DR: how to use type(self) in the decorator of a member function?I would like to do serialization of derived classes and share some serialization logic in the base class in Python.Since pickle ...
0
votes
1answer
42 views

Python - Problem involving multiplication between 'int' and 'type'

I am trying to make work a piece of code in Python, composed of four modules.When running I get the following error in the module optimizer_Neuroevolution: "line 149, in evolveretain_length=...
0
votes
0answers
35 views

when different data types are used in a c++ expression like : a + b – c * d [duplicate]

what will the data type of the following code:std::cout<<a + b – c * dIf the types of a, b, c, and d are int, long int, float, and double respectively, then the type of the expression is:(i....
0
votes
0answers
18 views

What is the correct type of a varibale that holds the id of setTimeout? [duplicate]

I want to store a timeout in a variable. MDN says:The returned timeoutID is a positive integer value whichidentifies the timer created by the call to setTimeout() […]So I declared a variable ...
0
votes
0answers
13 views

What type of sentence is this?

I would like to know what type of sentence this is? I know it's not rhetorical."The comment you put suggests you have a tiny mind and unable to think about the bigger picture witch I'm sure is not ...
1
vote
1answer
57 views

“The C standards set lower bounds on the numeric ranges of the different data types, but there are no upper bounds”?

While reading my textbook Computer systems by Randal E. Bryant & David R. O'Hallaron, I got a question on this:The C standards set lower bounds on the numeric ranges of the different data ...
4
votes
4answers
63 views

Why do type(x) and print(type(x) display slightly different results in python?

Let x=[1,2,3]Then in ipython, I get the following> In [8]: type(x) Out[8]: list> > In [9]: print(type(x)) <class 'list'>Why doesn't print(type(x)) just print list, ...
0
votes
3answers
48 views

C# Use type of object for casting (to avoid use of switch case)?

I got an abstract Room with multiple child classes. Some of those childs have a property MaximumCapacity. When anything enters a room, I want it to check if that Room has the property, and if so, what ...
-1
votes
0answers
27 views

Haskell type casting problem confusing error messages

I am trying to calculate a value and understand typing in Haskell, but I always get type errors.type Nat0=Inttype Nat1=Inttype Zentimeter0=Nat0type Zentimeter1=Nat1type Fl_Laenge=...
2
votes
1answer
35 views

Factory functions that return classes (=class constructors) in TypeScript

If I define a class in the following way in TypeScriptclass A {}then A is both a value and a type, so I can use it in both ways:type B=Aconst C=AIf A would be the result of a fancy class ...
0
votes
1answer
9 views

What is the data type of SHA-a output?

SHA-1 produces a 160-bit (20-byte) hash value known as a message digest – typically rendered as a hexadecimal number, 40 digits long, so is this (20-byte) of hex value as an array or just normal hex ...
2
votes
2answers
54 views

Property does not exist on type 'T' - Generic problems

I have a util that takes an array and a predicate to perform a filtration of the array, however after using my custom type for the predicate I am getting an error stating property 'name' does not ...
4
votes
1answer
40 views

How are the datatype size limits in limits.h determined?

How are the size limits for data types in C determined?This question's answers says to use limits.h for minimum and maximum values for datatypes. Although some people might stop at that and say ok, ...
-1
votes
0answers
18 views

How Can I Get Instance-Type On Aws Console? [on hold]

I hope getting Instance Type ( ex. m5.xlarge ) with command on Console.Are there some cases?Thank you.
1
vote
2answers
61 views

Haskell Generic Type

So I just started learning Haskell and I have been stuck on this for quite some time already. So I have a function that calculates a number after an offset has been minus (minimum value is 0). I ...
0
votes
0answers
13 views

PowerBI Return Empty Value on Date Type Column After Data Refreshing on Web Server

I have 2 tables containing Date type columns each: Transaction table and Date Dimension Table. Both table has relationship on that date column.When I check on PowerBI desktop everything seems fine ...
3
votes
1answer
43 views

Closure compiler thinks a parameter is mismatched due to a null condition that never happens

I am using the google closure compiler to minify my code and I recently added JSDoc annotations to allow the compiler to do type checking and better minification (in advanced mode). Unfortunately, it ...
0
votes
0answers
26 views

Dealing with polymorphic values in Typescript

I'm trying to write some parsers in Typescript. My parsers are all instances of a base class, Parser, parametrized by types, A and S, representing the result of a parse and the parser state.class ...
-2
votes
2answers
41 views

Why does `new Array(4).join(“”+10) + “ Batman!”` return “NaNNaNNaNNaN Batman!”

I saw this snippet in a video online (if anyone can find the link, please feel free to add it to the question). The video was quite short, so there was no explanation as to why JavaScript returns ...
-1
votes
2answers
30 views

Access subscript of array of type any refering to dictionaries

There are a lot of questions on SO about using a subscript on an Array of objects of type ANY that generally recommend casting the Any Object to a variable type that can take a subscript with ...
1
vote
0answers
48 views

What is Type ev.R?

I have a ResultSet which is com.datastax.driver.core.ResultSet from which I am taking the ExecutionInfo and from the executionInfo I am extracting the queryTrace as you can see the following code....
1
vote
2answers
38 views

How do I make this typescript mapping function much less complex?

I'm trying to do a pretty simple map between some known values to some other known values. Everything about this code screams I'm missing something simple that typescript can do.type PortInfoProp='...
0
votes
3answers
60 views

Type checking in C

I am coding the following if-statement:if(chars[a]==char){do sth;}My purpose is to test if the element in chars array is a character and if so do something to it. In languages like Python, ...
0
votes
0answers
28 views

How to set the types of columns in an empty data.frame? [duplicate]

I need to union a result set into this data.frame, in order to make sure I have the columns in place, even if the result set does not contain them. This is for the purposes of writing to a MySQL DB ...
1
vote
1answer
20 views

Proper type annotation for an object that can be unpacked with the * operator?

What is the proper type annotation for an object that should be unpacked with the * operator, i.e. foo in this (random) example:def some_function(foo):...=bar(*foo)I know that * can unpack ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,