casting Questions

4

I'm trying to write a light observer class in Swift (currently Swift 2). The idea is to use it within an Entity Component system, as a means for the components to communicate with one-another witho...
Dealer asked 28/6, 2016 at 10:29

4

Solved

In laravel 5.1 there is new feature called Attribute Casting, well documented at here : http://laravel.com/docs/5.1/eloquent-mutators#attribute-casting My question is, it is possible to make attri...
Concussion asked 6/8, 2015 at 4:47

4

In Typescript, suppose I want to call a function with following signature- function foo(param: "TRUE"|"FALSE"|"NONE") How can I do something like- var str = runtimeString() if(str === "TRUE" | ...
Sawn asked 22/7, 2016 at 11:10

8

Solved

I know it's possible to cast a list of items from one type to another (given that your object has a public static explicit operator method to do the casting) one at a time as follows: List<Y>...
Swat asked 25/2, 2011 at 8:51

4

When I Tried to return an Array in VFP9 language COM/DLL to my .NET C# project I receive a System.Object[*] array and I can not cast to System.Object[] (Without asterisk).
Twice asked 16/9, 2010 at 22:20

4

Solved

I would like to import the following csv as strings not as int64. Pandas read_csv automatically converts it to int64, but I need this column as string. ID 00013007854817840016671868 000130078548178...
Slavonic asked 8/11, 2012 at 16:54

2

I have a table of items with the following columns: start_time column (timestamp without time zone) expiration_time_seconds column (integer) For example, some values are: SELECT start_time, ex...
Palmetto asked 15/2, 2015 at 16:5

10

In Java, I can write code like: void cast(A a) { if(a instanceof Person) { Person p = (Person) a; } } In Kotlin, what should I do? Use as operator or is operator?
Burma asked 2/11, 2017 at 3:50

5

Solved

How do I convert an integer to string as part of a PostgreSQL query? So, for example, I need: SELECT * FROM table WHERE <some integer> = 'string of numbers' where <some integer> can be...
Diarrhea asked 10/12, 2012 at 21:27

7

Solved

I want to accomplish the following answer = True myvar = "the answer is " + answer and have myvar's value be "the answer is True". I'm pretty sure you can do this in Java.
Godsey asked 9/5, 2012 at 4:21

7

Solved

Can you explain me why does this happen and how can I fix it please? So I'm using Oracle-ADF and I'm using shuttle components. I get the selected values using the sos1.getValue(); The getValue() me...
Goatfish asked 4/3, 2015 at 10:8

6

Solved

To simplify my real use case, let's suppose that I want to find the maximum number in a list: var max : Int? = null listOf(1, 2, 3).forEach { if (max == null || it > max) { max = it } } Ho...
Adrea asked 12/8, 2016 at 23:41

2

Solved

I'm trying to apply a function to a pandas dataframe, such a function required two np.array as input and it fit them using a well defined model. The point is that I'm not able to apply this functi...
Teenyweeny asked 21/9, 2016 at 13:56

4

Solved

How can I cast an array initially declared as container for Any object to an array of Strings (or any other object)? Example : var array: [Any] = [] . . . array = strings // strings is an array o...
Conover asked 27/1, 2016 at 13:9

3

Solved

#ifndef NUMBER_HPP #define NUMBER_HPP template <class T> class Number { public: Number( T value ) : m_value( value ) { } T value() const { return m_value; } void setValue( T value ...
Brunhilde asked 29/11, 2011 at 4:43

20

Solved

How can I convert string to boolean? $string = 'false'; $test_mode_mail = settype($string, 'boolean'); var_dump($test_mode_mail); if($test_mode_mail) echo 'test mode is on.'; it returns, b...
Mandibular asked 7/9, 2011 at 15:54

4

Solved

How would I cast a byte array to a primitive type in Rust? let barry = [0, 0]; let shorty: u16 = barry; I have already tried let shorty: u16 = barry as u16; but that didn't work due to a "non s...
Evenson asked 20/8, 2014 at 21:44

4

Solved

Why do you need a C-style cast for the following? int* ptr = static_cast<int*>(0xff); // error: invalid static_cast from type 'int' // to type 'int*' int* ptr = (int*) 0xff; // ok.
Averil asked 18/9, 2014 at 0:38

4

Solved

I'm trying to make a cast in my code from the body of a request in express (using body-parser middleware) to an interface, but it's not enforcing type safety. This is my interface: export interfa...
Showbread asked 10/5, 2017 at 13:54

4

Solved

it works on 32-bit platform.but not 64-bit here is the exzample TVerbInfo = packed record Verb: Smallint; Flags: Word; end; var VerbInfo: TVerbInfo; strList : TStringList; verb : Smallint;...
Doody asked 19/12, 2013 at 11:11

18

A very easy one for someone, The following insert is giving me the ORA-01722: invalid number why? INSERT INTO CUSTOMER VALUES (1,'MALADY','Claire','27 Smith St Caulfield','0419 853 694'); IN...
Corfam asked 23/9, 2012 at 1:24

5

Solved

Let's say I have two different classes, both represent 2D coordinate data in the same internal way like the following: class LibA_Vertex{ public: // ... constructors and various methods, operato...
Bib asked 14/10, 2011 at 4:9

0

Consider the following C code: #include <stdatomic.h> struct _opaque; typedef struct _opaque *opaque; struct container { _Atomic opaque x; }; struct container get_container(); void consume_...
Garnetgarnett asked 2/9, 2023 at 22:0

14

Solved

This is a silly question, but you can use this code to check if something is a particular type... if (child is IContainer) { //.... Is there a more elegant way to check for the "NOT" instance? ...
Barricade asked 1/5, 2009 at 14:34

6

Solved

In an interview, I was asked what do I think about the following code: #include <stdio.h> int main() { float f = 10.7; int a; a = f; printf ("%d\n", a); } I answered: The compiler w...
Gautier asked 26/1, 2016 at 7:14

© 2022 - 2024 — McMap. All rights reserved.