Questions tagged [type-conversion]

1

votes
2

answer
45

Views

Converting Map<key, value> to List<value>

I've been searching for a while without success. I am trying to convert a Map to a List (discarding key). Sure, I can do var addictionList = new List(); dataMan.forEach((String date, AddictionDay day) { addictionList.add(day); }); but is there a more straight approach, like var addictionList = dat...
Martin.
1

votes
1

answer
26

Views

How to convert specific byte in a byte array to integer

I have a scenario where in based on a given String I need to return an integer value. I am hashing String to a byte array . Now since my Integer range is 0-999 which can be represented by 2bytes, I am hoping to use last two bytes of the byte array to convert to integer . But I am not getting the co...
varkashy
1

votes
1

answer
29

Views

T-SQL: DateTme Column varchar cast that may contain '1753-01-01' to empty string

Task: convert a DateTme column (cast as varchar) that may contain 1753-01-01 to an empty string. What is the most efficient way to do this in T-SQL? For example, if I use: SELECT LEFT(CONVERT(VARCHAR, DateCol1, 120), 10) FROM ourDatabase.dbo.ourTable How can I efficiently change any row containing...
JosephDoggie
1

votes
1

answer
90

Views

Converting 32-bit integer value to unsigned 16-bit integer

What does the C standard say about: uint32_t a = 0x11223344; uint16_t b = a; When printed, I am getting 0x3344, which makes sense; so this must be legal and correct behaviour?
Mark
1

votes
1

answer
129

Views

Julia : How to convert vector of type string to type numeric (Float64)

In Julia 1.1 I want to convert a vector of type string to type numeric (Float64) here is the vector: string = ['2.2', '3,3', '4.4']; I tried the following line without success: x = convert(Float64, string) x = convert(DataVector{Float64}, string) x = map(x->parse(Float64,x),string) x = parse(Float...
ecjb
1

votes
1

answer
52

Views

String can't be converted to a double

I have a strange problem. I start by showing the error that I get in a sortLIST function, - which seems strange. The problem occurs for the string 'i' as seen in the debug error which is separated by ','. The first argument is 0.48 which is a double. Anyway the error says: Input string was not in a...
Andreas
1

votes
5

answer
5.5k

Views

decimal to long - always missing a dot separator

I want to be able to convert a varchar > decimal > long when dbreader[11] holds a 3319419,13 as varchar For example: decimal d = Convert.ToDecimal(dbreader[11], CultureInfo.InvariantCulture); I get d = 3319419.13M When i convert this to long object I end up with long i = 3319419 I want to end up w...
aghaux
1

votes
1

answer
356

Views

how to convert a date in GMT format to another format?

How can i convert Fri Dec 29 05:30:00 GMT 05:30 20 into 29-12-2017 02:28:03 this format in android.i already used the below code for convert the date but i can't work.so please help me out. String date = Fri Dec 29 05:30:00 GMT 05:30 20 SimpleDateFormat sdf = new SimpleDateFormat('dd-MM-yyyy h:mm:...
Radhika
1

votes
1

answer
91

Views

add a customized object to tinyDB

tinydb.putListObject(String,java.util.ArrayList) wants an object but I want to store restaurant object. How can I solve it? ArrayList restaurants = new ArrayList(); // This part gives error. tinydb.putListObject('restaurantsObject',restaurants); After that, I need to convert it to restaurant object...
ozo
1

votes
1

answer
385

Views

Why is there a result of `#Error` in an Access query with a join on two type-converted fields?

I’m getting a result of #Errorin an Access 2010 query which has a right join on two fields which are type-converted. I can eliminate the error by improving my queries, but I’m confused as to why it happens. I have the following two tables, T1 and T2. Both consist of an ID field and a text field....
Scott H
1

votes
0

answer
41

Views

What is the meaning of 'NK' in pandas int64?

I have a column pathsize (int64). However, I got some values define as 'NK'. I've tried to convert this value into an integer, but it doesn't seem to have any effect. NK 687 15 180 12 172 14 166 ... 3 123 Name: pathsize, Length: 92, dtype: int64 The script I used to convert NK into 0...
Saber Alex
1

votes
0

answer
24

Views

Type System attributes : Developing intuition and Addressing Misconceptions

A type system is a set of rules used to provide additional layer of information about entities in a program, so that the runtime, or the compiler, or any other piece of machinery, knows what to do with the strings of bits it operates on. It also help maintain contracts - the compiler (or code analys...
Gabriele Scarlatti
1

votes
0

answer
30

Views

Python3 List of binary data is not seen as bytes

I am having problems trying to extract integers and bytes from a list of data in Phython3. I read a serial port and capture a block of 282 bytes. It is stored as a 'list' where tedData[0] is the whole block. For example I need to extract bytes 249 and 250 and convert to a short integer. Below is...
PhippsJ
1

votes
1

answer
15

Views

Different byte length of base64 decryption

I am trying to decode this base64 string using VB.NET System.Convert.FromBase64String('AgBgVvBR0apvj88GZFp/0ontNtFIcsJoVTachX30kURDlK010Mv9/yv1yLXXr4mqII5z2Hzx9FlGxA==') And it returns 58 bytes. If I convert from Base64 on any online base64 decode program I get 32 bytes..?? What am I doing wrong?
Nathan Woodruff
1

votes
2

answer
3.7k

Views

Convert JSON Data into Excel File Download in Javascript

I have a AJAX POST Request fetching data back in form of a JSON Array. I want to convert this received JSON Data into an Excel File (Not CSV) for download (on a button-click), pls help. The JSON Data might have blank values and missing fields for each JSON row. I tried this in Client side using Jav...
Voila
1

votes
0

answer
323

Views

Cannot find/create new file in Docker

I couldn't find any information or a way to do this, and as I am new to Docker, I thought here would be a good place to ask. I have python code, where I take a .jpg image file, convert it to base64, then decode the base64 and create a .png image file with that data. It's been working outside of Dock...
1

votes
1

answer
54

Views

SAS coverting character variable using INPUT

I have the following dataset where each subject ID has a corresponding value (AVAL) that is currently in a character format. data test; input SUBJID$ AVAL$6.; cards; 001 97.9 001 119 001 061 001 62 001 151.0 ; run; Basically, I want to convert the AVAL variable from character to numeric. I us...
Nathan123
1

votes
0

answer
233

Views

Convert sql server datetimeoffset to C# datetimeoffset or datetime

I have a column with datetimeoffset data type. For e.g. 2018-02-19 10:08:53.8060711 +00:00 I am trying to set this value to the C# property having the same data type. In my application, I am using reflection to set the properties into the model (can't avoid reflection) Here is the sample code - Type...
Ankur Arora
1

votes
1

answer
43

Views

How to convert 2d Integer array into 2d String array?

I have a two dimensional Integer array and I need to convert it into a two dimensional String array. private Integer[][] microboardArray = new Integer[9][9]; Then I have 'get' method from interface which must be implemented. @Override public String[][] getBoard() { } Thank you for your help :).
MapeSVK
1

votes
1

answer
551

Views

Rcpp: Converting SEXP to float/double

SEXP callFunction1(List network, List words, Function testWordContinuity){ SEXP res = testWordContinuity(network, words); return res; } for(int i=0; i
thposs
1

votes
1

answer
95

Views

issue looping over clob data in pl/sql. invalid type when setting variable to current iteration

I am currently using pl/sql to attempt to loop over some data in a clob column from a table. When I use just a select query and do the operations to the clob data, the procedure finishes just fine. Here is that example: DECLARE l_xml Clob; type fieldIds is table of number; isIdInTable Number; BEGIN...
Andrew
1

votes
1

answer
350

Views

Cython with Python3.5: convert list of string to char**

I am trying to pass a list of string to a C++ function that takes a char** as argument using Cython. I tried other solutions I can't remember but I mainly tried the two following options: Using a convertion function extracted from here, which is basically the same answer than here, but it raises an...
Romzie
1

votes
2

answer
284

Views

Laravel DB query to array

I stored 'hello,world' in a mysql database as an array and then tried to retrieve using below query @php $post_id = $post->id; $result= DB::table('posts') ->select('tags') ->where('id', '=', $post_id) ->get(); echo($result); @endphp The echoed result is: [{'tags':'hello,world'}] I need to echo si...
Shawty
1

votes
2

answer
165

Views

set<shared_ptr<T>>::iterator to set<shared_ptr<T const>>::const_iterator

So I have seen the questions about casting std::shared_ptr to std::shared_ptr and that is working well so far. But I have another question. I'd like to return an interator to my std::set, where both the T and the std::shared_ptr is const. I have been unable to convert them straight over, or with any...
N00byEdge
1

votes
0

answer
202

Views

Date conversion error while loading into pandas dataframe from spark dataframe

I am getting the below error while trying to convert a spark data frame to pandas data frame here is the code to fetch two columns from a table import pyspark as py from pyspark import SparkContext, SparkConf from pyspark.sql import * import pandas as pd spark = SparkSession.builder \ .master('loca...
ragav
1

votes
1

answer
3.9k

Views

as.factor() in numeric conversion R

So I am learning R now, and I notice from many source that whenever we want to convert a datatype to numeric,we use two functions as.numeric() and as.factor(). For example if I want to convert column Year to numeric, it will be as.numeric(as.factor(survey.data$Year)) I tried to use as.numeric() alon...
Efan Du
1

votes
1

answer
228

Views

Word/Doc/Pdf file to csv file format

I'm developing a PHP project i just want to know that is it possible to convert a doc/pdf file into csv file format then i would be able to import it to database (mysql). I've tried every tutorial but failed to get an answer
1

votes
1

answer
114

Views

Why is conversion not working?

I'd like to develop an algorithm that is able to do a AnyBase 2 AnyBase conversion in C++. So I started with just translating this javascript code into C++ and ended with the use of a BigInt - library because it will of course not work using integer (long int, long double, etc) precision - so I had...
1

votes
1

answer
36

Views

Value incorrect Recursion

I have a little problem with my function, the function does the conversion of decimal to binary but I print the value backwards for example the following code: I pass the 28 to binary that would have to be 0000011100 but I return 0011100000 public void binary(int n, char[] array, int bits) { if (0 =...
Patrick
1

votes
0

answer
13

Views

unconventional time format syntax

I have an Excel sheet with one column defining time in the following format 3:34'35'. In R it is a factor. I would like to convert it to a numeric value. Unfortunately ' and 'signs prevent me from working with it as a string. Could anybody suggest how to get to recognizable time format or to numer...
Denis
1

votes
1

answer
244

Views

Date Conversion in .net format “dd/mm/yyyy HH:mm:ss AM/PM”

I'm trying to convert a date formatted like dd/mm/yyyy HH:mm:ss AM/PM into YYYY-mm-dd hh:mm:ss.fffZ but had no success. This is what I've tried: System.Globalization.CultureInfo enUS = new System.Globalization.CultureInfo('en-CA'); string inputDate = '14/02/2008 1:55:11 PM'; DateTime newDate = Conve...
Amar
1

votes
0

answer
177

Views

Loopback: Remote Method is converting “null” to null value

I am having an issue where whenever my front end (angular) makes a remote method call that has a string 'null' in it once it gets to the remote method in Loopback, Loopback has converted the string 'null' to a null value. For example if a remote method /query takes in a filter: { 'name': 'null' } Lo...
emarel
1

votes
1

answer
207

Views

c# - Reading From CSV, Type Conversion Error

I'm using CSVHelper, though this seems to occur with the manual methods I know. I'm trying to create some form of 'save data' system using csv files, which will store all important variables that need to be loaded on the program running. Here's my code with generalized variable names: StringReader...
Dylanerd
1

votes
1

answer
41

Views

Error in converting image in png

I am trying to convert the image from jpg into png.Its work fine $src1 = 'Camel.jpg'; $image = imagecreatefromjpeg($src1); imagepng($image, 'new.png'); But I put the 'src1' instead of 'new.png' the conversion is failed. $src1 = 'Camel.jpg'; $image = imagecreatefromjpeg($src1); imagepng($image, $src1...
Nandy
1

votes
0

answer
45

Views

Getting compiler error 'binary '<<' : no operator found' in VS 2005

I am getting the below compiler error when I build my project: XMLHelper.h(22) : error C2678: binary '
Raghu Ramaiah
1

votes
0

answer
18

Views

Creating a matrix for R

I have a txt file with two columns. A= gene names B= tumors with mutation in that gene I want to produce a file that is a matrix with all tumors listed in one column and then all the gene names across in a row. See attachment for example Can this be done with R or awk? enter image description her...
Meghan Rudd
1

votes
0

answer
43

Views

is it possible to infer higher-order function receiver type based on the parent function parameters?

Given a function: inline fun executeSomething( defaultValue: String, entity: T, maybeDefault: String = defaultValue, onSuccess: (T) -> Unit ) I would like to infer onSuccess, receiver type T based on the parent function parameters or something like that. This one works, compiler infer the entity...
1

votes
2

answer
366

Views

Converting DataResponse<String> to a usable type

I have a POST request that is illustrated below. I need some help on how to be able to use the response data. The response I am getting is in a form of a dictionary. What is the best practice to use here? The error message I am getting is: Cannot assign value of type 'DataResponse' to type 'String'...
EmbeddedOS
1

votes
1

answer
32

Views

Deal with Radio Buttons in Laravel

Problem: I have a table categories on my database which contains the cat_id as primary key of type int and cat_name as name of the category. But I collect info from the under via radio. Question: How can I convert the 'on' and 'off' from the user to integers? Error Given: Illuminate\Database\QueryE...
Malico
1

votes
0

answer
59

Views

Convert .GDB file to .shp file

I have a .gdb folder with LOCK Files, FREELIST Files, ATX Files, GDBINDEXES Files, GDBTABLE Files, GDBTABLEX Files and, SPX Files. I want to convert them to .shp files. Could you tell me the required codes? Thanks.
Sara Ebrahimi

View additional questions